software: factorize exception_handler
authorSebastien Bourdeauducq <sb@m-labs.hk>
Wed, 14 May 2014 13:01:38 +0000 (15:01 +0200)
committerSebastien Bourdeauducq <sb@m-labs.hk>
Wed, 14 May 2014 13:01:38 +0000 (15:01 +0200)
software/bios/isr.c
software/libbase/Makefile
software/libbase/exception.c [new file with mode: 0644]

index 47d91542f8238cef750c84eb381ffc1f2e3537e2..c49d31d8dbd8b6bcb88774d504f619eaee04fb0c 100644 (file)
@@ -12,17 +12,3 @@ void isr(void)
        if(irqs & (1 << UART_INTERRUPT))
                uart_isr();
 }
-
-#ifdef __or1k__
-#define EXTERNAL_IRQ 0x800
-void exception_handler(unsigned long vect, unsigned long *sp);
-void exception_handler(unsigned long vect, unsigned long *sp)
-{
-       if ((vect & 0xf00) == EXTERNAL_IRQ) {
-               isr();
-       } else {
-               /* Unhandled exception */
-               for(;;);
-       }
-}
-#endif
index 124352c73b8ea163284ad7ff32a5c89a4b0c2331..50291547d6165d11230ff287e6256c049987449b 100644 (file)
@@ -1,7 +1,7 @@
 MSCDIR=../..
 include $(MSCDIR)/software/common.mak
 
-OBJECTS=setjmp-$(CPU).o libc.o errno.o crc16.o crc32.o console.o system.o id.o uart.o time.o qsort.o strtod.o
+OBJECTS=setjmp-$(CPU).o exception.o libc.o errno.o crc16.o crc32.o console.o system.o id.o uart.o time.o qsort.o strtod.o
 
 all: crt0-$(CPU).o libbase.a libbase-nofloat.a
 
diff --git a/software/libbase/exception.c b/software/libbase/exception.c
new file mode 100644 (file)
index 0000000..0b3bae3
--- /dev/null
@@ -0,0 +1,17 @@
+void isr(void);
+
+#ifdef __or1k__
+
+#define EXTERNAL_IRQ 0x800
+
+void exception_handler(unsigned long vect, unsigned long *sp);
+void exception_handler(unsigned long vect, unsigned long *sp)
+{
+       if ((vect & 0xf00) == EXTERNAL_IRQ) {
+               isr();
+       } else {
+               /* Unhandled exception */
+               for(;;);
+       }
+}
+#endif