fix include paths
[rpi-open-firmware.git] / start.s
diff --git a/start.s b/start.s
index 8beda47..716e918 100755 (executable)
--- a/start.s
+++ b/start.s
@@ -41,20 +41,21 @@ _start:
        mov r0, cpuid
        mov r5, r0
 
-       # get addr of the exception vector table
-       lea r1, __INTERRUPT_VECTORS
-       mov r3, r1
+       /* vectors */
+       mov r3, #0x1B000
+       mov r1, r3
 
        /*
         * populate the exception vector table using PC relative labels
         * so the code isnt position dependent
         */
 .macro RegExceptionHandler label, exception_number
-       lea r2, Exc_\label
+       lea r2, fleh_\label
        st r2, (r1)
        add r1, #4
 .endm
 
+
        RegExceptionHandler zero, #0
        RegExceptionHandler misaligned, #1
        RegExceptionHandler dividebyzero, #2
@@ -71,6 +72,14 @@ _start:
        RegExceptionHandler breakpoint, #13
        RegExceptionHandler unknown, #14
 
+       add r1, r3, #252
+       lea r2, fleh_irq
+       mov r4, #492
+
+L_setup_hw_irq:
+       st r2, (r1)++
+       ble r1, r4, L_setup_hw_irq
+
        /*
         * load the interrupt and normal stack pointers. these
         * are chosen to be near the top of the available cache memory
@@ -125,17 +134,30 @@ delayloop2:
  * Exception Handling
  ************************************************************/
 
-_sleh_generic_gate:
-       # get faulting PC
-       ld r1, 4(sp)
-       # call the C exception handler
-       b sleh_fatal
+.macro SaveRegsLower 
+       push r0-r5, lr
+.endm
 
+.macro SaveRegsUpper
+       push r6-r15
+       push r16-r23
+.endm
+
+.macro SaveRegsAll
+       SaveRegsLower
+       SaveRegsUpper
+.endm
+
+fatal_exception:
+       SaveRegsUpper
+       mov r0, sp
+       b sleh_fatal
 
 .macro ExceptionHandler label, exception_number
-Exc_\label:
-       mov r0, \exception_number
-       b _sleh_generic_gate
+fleh_\label:
+       SaveRegsLower
+       mov r1, \exception_number
+       b fatal_exception
 .endm
 
        ExceptionHandler zero, #0
@@ -154,12 +176,16 @@ Exc_\label:
        ExceptionHandler breakpoint, #13
        ExceptionHandler unknown, #14
 
-/************************************************************
- * ISRs
- ************************************************************/
+fleh_irq:
+       SaveRegsAll
+
+       /* top of savearea */
+       mov r0, sp
+       bl sleh_irq
 
-.align 4
-__INTERRUPT_VECTORS:
-       # 31 slots, 4 byte each for processor exceptions. patched to have the correct
-       # exception handler routines at runtime to allow the code to be loaded anywhere
-       .space 124, 0
+return_from_exception:
+       pop r16-r23
+       pop r6-r15
+       pop r0-r15
+       ld lr, (sp)++
+       rti
This page took 0.027856 seconds and 4 git commands to generate.