aboutsummaryrefslogtreecommitdiff
path: root/pk/handlers.c
diff options
context:
space:
mode:
authorAndrew Waterman <waterman@s144.Millennium.Berkeley.EDU>2011-11-11 03:40:24 -0800
committerAndrew Waterman <waterman@s144.Millennium.Berkeley.EDU>2011-11-11 03:40:24 -0800
commit8717517e048ff866167d6eee6c6d97225f0cd169 (patch)
treeab36a881f5f6700fb5d30e3abc5580be0c088002 /pk/handlers.c
parent2f5776b244a4a2a8297fee9e0160c835430e1f06 (diff)
downloadpk-8717517e048ff866167d6eee6c6d97225f0cd169.zip
pk-8717517e048ff866167d6eee6c6d97225f0cd169.tar.gz
pk-8717517e048ff866167d6eee6c6d97225f0cd169.tar.bz2
Synced up PK with supervisor changes/asm syntax
You must upgrade to the latest compiler and ISA simulator to build and run this version of the PK.
Diffstat (limited to 'pk/handlers.c')
-rw-r--r--pk/handlers.c30
1 files changed, 4 insertions, 26 deletions
diff --git a/pk/handlers.c b/pk/handlers.c
index ebc8f2a..fee9a51 100644
--- a/pk/handlers.c
+++ b/pk/handlers.c
@@ -99,30 +99,9 @@ void handle_fault_store(trapframe_t* tf)
panic("Faulting store!");
}
-static void handle_bad_interrupt(trapframe_t* tf, int interrupt)
-{
- panic("Bad interrupt %d!",interrupt);
-}
-
static void handle_timer_interrupt(trapframe_t* tf)
{
- mtpcr(PCR_COMPARE, mfpcr(PCR_COMPARE)+TIMER_PERIOD);
-}
-
-static void handle_interrupt(trapframe_t* tf)
-{
- int interrupts = (tf->cause & CAUSE_IP) >> CAUSE_IP_SHIFT;
-
- for(int i = 0; interrupts; interrupts >>= 1, i++)
- {
- if(interrupts & 1)
- {
- if(i == TIMER_IRQ)
- handle_timer_interrupt(tf);
- else
- handle_bad_interrupt(tf,i);
- }
- }
+ panic("Timer interrupt!");
}
static void handle_syscall(trapframe_t* tf)
@@ -148,7 +127,6 @@ void handle_trap(trapframe_t* tf)
[CAUSE_ILLEGAL_INSTRUCTION] = handle_illegal_instruction,
[CAUSE_PRIVILEGED_INSTRUCTION] = handle_privileged_instruction,
[CAUSE_FP_DISABLED] = handle_fp_disabled,
- [CAUSE_INTERRUPT] = handle_interrupt,
[CAUSE_SYSCALL] = handle_syscall,
[CAUSE_BREAKPOINT] = handle_breakpoint,
[CAUSE_MISALIGNED_LOAD] = handle_misaligned_load,
@@ -158,12 +136,12 @@ void handle_trap(trapframe_t* tf)
[CAUSE_VECTOR_DISABLED] = handle_vector_disabled,
[CAUSE_VECTOR_BANK] = handle_vector_bank,
[CAUSE_VECTOR_ILLEGAL_INSTRUCTION] = handle_vector_illegal_instruction,
+ [CAUSE_IRQ0 + TIMER_IRQ] = handle_timer_interrupt,
};
- int exccode = (tf->cause & CAUSE_EXCCODE) >> CAUSE_EXCCODE_SHIFT;
- kassert(exccode < ARRAY_SIZE(trap_handlers));
+ kassert(tf->cause < ARRAY_SIZE(trap_handlers) && trap_handlers[tf->cause]);
- trap_handlers[exccode](tf);
+ trap_handlers[tf->cause](tf);
pop_tf(tf);
}