From 1824e4d39b4f042474d29ac91ee59b326ab00da1 Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Fri, 27 Aug 2004 00:05:15 +0000 Subject: [PATCH] Clean up interrupt handling. --- src/threads/interrupt.c | 3 +-- src/threads/interrupt.h | 2 +- src/threads/intr-stubs.h | 9 +++++++++ src/threads/intr-stubs.pl | 7 ++++++- 4 files changed, 17 insertions(+), 4 deletions(-) create mode 100644 src/threads/intr-stubs.h diff --git a/src/threads/interrupt.c b/src/threads/interrupt.c index 4ab0050..6250f81 100644 --- a/src/threads/interrupt.c +++ b/src/threads/interrupt.c @@ -1,5 +1,6 @@ #include "interrupt.h" #include +#include "intr-stubs.h" #include "debug.h" #include "io.h" #include "lib.h" @@ -94,8 +95,6 @@ pic_eoi (void) uint64_t idt[256]; -extern void (*intr_stubs[256]) (void); - intr_handler_func *intr_handlers[256]; void intr_handler (struct intr_frame *args); diff --git a/src/threads/interrupt.h b/src/threads/interrupt.h index 917fc75..a40276a 100644 --- a/src/threads/interrupt.h +++ b/src/threads/interrupt.h @@ -37,7 +37,7 @@ struct intr_frame void (*eip) (void); uint16_t cs, :16; uint32_t eflags; - uint32_t esp; + void *esp; uint16_t ss, :16; }; diff --git a/src/threads/intr-stubs.h b/src/threads/intr-stubs.h new file mode 100644 index 0000000..5ff9164 --- /dev/null +++ b/src/threads/intr-stubs.h @@ -0,0 +1,9 @@ +#ifndef HEADER_INTR_STUBS_H +#define HEADER_INTR_STUBS_H + +extern void (*intr_stubs[256]) (void); + +void intr_entry (void); +void intr_exit (void); + +#endif /* intr-stubs.h */ diff --git a/src/threads/intr-stubs.pl b/src/threads/intr-stubs.pl index 8987c43..ea20e96 100755 --- a/src/threads/intr-stubs.pl +++ b/src/threads/intr-stubs.pl @@ -17,7 +17,9 @@ for $i (0...255) { $x = sprintf ("%02x", $i); print "\t.globl intr${x}_stub\n"; print "intr${x}_stub:\n"; - print "\tpushl \$0\n" if $i != 8 && $i != 10 && $i != 11 && $i != 13 && $i != 14 && $i != 17; + print "\tpushl \$0\n" + if ($i != 8 && $i != 10 && $i != 11 + && $i != 13 && $i != 14 && $i != 17); print "\tpushl \$0x$x\n"; print "\tjmp intr_entry\n"; } @@ -40,6 +42,9 @@ intr_entry: pushl %esp .globl intr_handler call intr_handler + + .globl intr_exit +intr_exit: addl $4, %esp # Restore caller's registers. -- 2.30.2