Software interrupt support
authorAlyssa Rosenzweig <alyssa@backtick.town>
Sun, 14 Aug 2016 19:30:15 +0000 (12:30 -0700)
committerAlyssa Rosenzweig <alyssa@backtick.town>
Sun, 14 Aug 2016 19:30:15 +0000 (12:30 -0700)
romstage.c
start.s
trap.c

index c98dee9..c5e8d6c 100644 (file)
@@ -177,11 +177,14 @@ int _main(unsigned int cpuid, unsigned int load_address) {
        print_crap();\r
 \r
        g_CPUID = cpuid;\r
-       \r
+\r
        /* bring up SDRAM */\r
        sdram_init();\r
        printf("SDRAM initialization completed successfully!\n");\r
 \r
+        /* test software interrupts */\r
+        __asm__("swi 2");\r
+       \r
        /* bring up ARM */\r
        arm_init();\r
 \r
diff --git a/start.s b/start.s
index f8c2951..d36d930 100644 (file)
--- a/start.s
+++ b/start.s
@@ -72,12 +72,15 @@ _start:
        RegExceptionHandler breakpoint, #13
        RegExceptionHandler unknown, #14
 
-       add r1, r3, #252
+       //add r1, r3, #252
+        add r1, r3, #128
        lea r2, fleh_irq
-       mov r4, #492
+       //mov r4, #492
+        add r4, r3, #492
 
 L_setup_hw_irq:
-       st r2, (r1++)
+       st r2, (r1)
+        add r1, #4
        ble r1, r4, L_setup_hw_irq
 
        /*
@@ -93,13 +96,14 @@ L_setup_hw_irq:
        st r3, (r0)
        mov r0, #IC1_VADDR
        st r3, (r0)
+        
+        /* enable interrupts */
+       ei
 
        /* jump to C code */
        mov r0, r5
        lea r1, _start
 
-       ei
-
        bl _main
 
 /************************************************************
@@ -135,7 +139,8 @@ delayloop2:
  ************************************************************/
 
 .macro SaveRegsLower 
-       stm r0-r5, lr, (--sp)
+        stm lr, (--sp)
+       stm r0-r5, (--sp)
 .endm
 
 .macro SaveRegsUpper
@@ -186,6 +191,6 @@ fleh_irq:
 return_from_exception:
        ldm r16-r23, (sp++)
        ldm r6-r15, (sp++)
-       ldm r0-r15, (sp++)
+       ldm r0-r5, (sp++)
        ld lr, (sp++)
        rti
diff --git a/trap.c b/trap.c
index 0f3d5ba..5d233df 100644 (file)
--- a/trap.c
+++ b/trap.c
@@ -79,10 +79,12 @@ void sleh_fatal(vc4_saved_state_t* pcb, uint32_t n) {
        );\r
 \r
        printf("We are hanging here ...\n");\r
+        while(1) printf("Ahh!\n");\r
        \r
        hang_cpu();\r
 }\r
 \r
 void sleh_irq(vc4_saved_state_t* pcb) {\r
+        while(1) printf("Interrupt!\n");\r
        panic("interrupt at 0x%X!", pcb->pc);\r
-}
\ No newline at end of file
+}\r
This page took 0.033064 seconds and 4 git commands to generate.