X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fthreads%2Fintr-stubs.pl;h=75cde7b6bb8cdf2629357beef89886a00d6eb1ea;hb=e5c7df720147528ab310fe5ac983cc5115b998da;hp=9725860b24b297b70175cbaac1618a200f153e0b;hpb=d4c9aca807cfbe799e211f574eab051954e7fd8c;p=pintos-anon diff --git a/src/threads/intr-stubs.pl b/src/threads/intr-stubs.pl index 9725860..75cde7b 100755 --- a/src/threads/intr-stubs.pl +++ b/src/threads/intr-stubs.pl @@ -1,10 +1,11 @@ #! /usr/bin/perl print <<'EOF'; -#include "mmu.h" +#include "threads/loader.h" .data - .globl intr_stubs + .intel_syntax noprefix +.globl intr_stubs intr_stubs: EOF @@ -20,42 +21,46 @@ EOF for $i (0...255) { $x = sprintf ("%02x", $i); - print "\t.globl intr${x}_stub\n"; + print ".globl intr${x}_stub\n"; print "intr${x}_stub:\n"; - print "\tpushl \$0\n" + print "\tpush 0\n" if ($i != 8 && $i != 10 && $i != 11 && $i != 13 && $i != 14 && $i != 17); - print "\tpushl \$0x$x\n"; + print "\tpush 0x$x\n"; print "\tjmp intr_entry\n"; } print <<'EOF'; intr_entry: - # FIXME: build a fake stack frame to improve backtraces. # Save caller's registers. - pushl %ds - pushl %es - pushal + push ds + push es + push fs + push gs + pusha # Set up kernel environment. cld - movl $SEL_KDSEG, %eax - movl %eax, %ds - movl %eax, %es + mov eax, SEL_KDSEG + mov ds, eax + mov es, eax - # Call handler. - pushl %esp - .globl intr_handler + # Call interrupt handler. + push esp +.globl intr_handler call intr_handler - addl $4, %esp + add esp, 4 - .globl intr_exit +.globl intr_exit intr_exit: - # Restore caller's registers. - popal - popl %es - popl %ds - addl $8, %esp + popa + pop gs + pop fs + pop es + pop ds + add esp, 8 + + # Return to caller. iret EOF