port-work; won't compile or even work
[ppcskel.git] / exception.c
index 2d7451ecb8166db387559902ec6c43dc6c27b47e..f42b78be2da341bf1f7eeef5aa477967bc82394b 100644 (file)
@@ -3,6 +3,8 @@
        Requires mini.
 
 Copyright (C) 2008             Segher Boessenkool <segher@kernel.crashing.org>
+Copyright (C) 2009             Bernhard Urban <lewurm@gmx.net>
+Copyright (C) 2009             Sebastian Falbesoner <sebastian.falbesoner@gmail.com>
 
 # This code is licensed to you under the terms of the GNU GPL, version 2;
 # see file COPYING or http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt
@@ -18,17 +20,15 @@ extern char exception_2200_start, exception_2200_end;
 
 void exception_handler(int exception)
 {
+       u32 cookie = irq_kill();
        // check if the exception was actually an external interrupt
        if (exception == 0x500) {
-               u32 cookie = irq_kill();
                irq_handler();
-               irq_restore(cookie);
-               //_CPU_ISR_Enable(); //wtf
        }
 
        // check if exception happened due to the decrementer
        else if (exception == 0x900) {
-               printf("\nDecrementer exception occured - who cares?\n");
+               //printf("\nDecrementer exception occured - who cares?\n");
        }
 
        else {
@@ -56,6 +56,8 @@ void exception_handler(int exception)
                for (;;)
                        ;
        }
+
+       irq_restore(cookie);
 }
 
 void exception_init(void)