projects
/
pintos-anon
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Save and restore user processes' FS and GS registers.
[pintos-anon]
/
src
/
threads
/
intr-stubs.pl
diff --git
a/src/threads/intr-stubs.pl
b/src/threads/intr-stubs.pl
index 8987c43d9ca8396c44c64d24c68ac31e5bd8606c..75cde7b6bb8cdf2629357beef89886a00d6eb1ea 100755
(executable)
--- a/
src/threads/intr-stubs.pl
+++ b/
src/threads/intr-stubs.pl
@@
-1,9
+1,11
@@
#! /usr/bin/perl
print <<'EOF';
#! /usr/bin/perl
print <<'EOF';
-#include "
mmu
.h"
+#include "
threads/loader
.h"
- .globl intr_stubs
+ .data
+ .intel_syntax noprefix
+.globl intr_stubs
intr_stubs:
EOF
intr_stubs:
EOF
@@
-11,41
+13,54
@@
for $i (0...255) {
$x = sprintf ("%02x", $i);
print "\t.long intr${x}_stub\n";
}
$x = sprintf ("%02x", $i);
print "\t.long intr${x}_stub\n";
}
-print "\n";
+
+print <<'EOF';
+
+ .text
+EOF
for $i (0...255) {
$x = sprintf ("%02x", $i);
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 "intr${x}_stub:\n";
- print "\tpushl \$0\n" if $i != 8 && $i != 10 && $i != 11 && $i != 13 && $i != 14 && $i != 17;
- print "\tpushl \$0x$x\n";
+ print "\tpush 0\n"
+ if ($i != 8 && $i != 10 && $i != 11
+ && $i != 13 && $i != 14 && $i != 17);
+ print "\tpush 0x$x\n";
print "\tjmp intr_entry\n";
}
print <<'EOF';
intr_entry:
print "\tjmp intr_entry\n";
}
print <<'EOF';
intr_entry:
- # FIXME: build a fake stack frame to improve backtraces.
# Save caller's registers.
# Save caller's registers.
- pushl %ds
- pushl %es
- pushal
+ push ds
+ push es
+ push fs
+ push gs
+ pusha
# Set up kernel environment.
cld
# Set up kernel environment.
cld
- mov
l $SEL_KDSEG, %eax
- mov
l %eax, %ds
- mov
l %eax, %es
+ mov
eax, SEL_KDSEG
+ mov
ds, eax
+ mov
es, eax
- # Call handler.
- push
l %
esp
-
.globl intr_handler
+ # Call
interrupt
handler.
+ push
esp
+.globl intr_handler
call intr_handler
call intr_handler
- add
l $4, %esp
+ add
esp, 4
+.globl intr_exit
+intr_exit:
# Restore caller's registers.
# 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
iret
EOF