summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrsc <rsc>2007-08-27 13:11:13 +0000
committerrsc <rsc>2007-08-27 13:11:13 +0000
commite1872bb130da5a9b198ca484da8534304ea9fc79 (patch)
treebd59ec929de63b290da57a9643c1bf06918e6d7d
parente0240674f5b30adf92714162cf51dabc43b17aa7 (diff)
downloadxv6-labs-e1872bb130da5a9b198ca484da8534304ea9fc79.tar.gz
xv6-labs-e1872bb130da5a9b198ca484da8534304ea9fc79.tar.bz2
xv6-labs-e1872bb130da5a9b198ca484da8534304ea9fc79.zip
formatting, fix comment
-rw-r--r--trapasm.S37
1 files changed, 21 insertions, 16 deletions
diff --git a/trapasm.S b/trapasm.S
index 6eaa57d..ac96413 100644
--- a/trapasm.S
+++ b/trapasm.S
@@ -1,33 +1,38 @@
.text
.globl trap
.globl trapret1
-
.globl alltraps
+
+.set SEG_KDATA_SEL 0x10 # selector for SEG_KDATA
+
+ # vectors.S sends all traps here.
alltraps:
- /* vectors.S sends all traps here */
- pushl %ds # build
- pushl %es # trap
- pushal # frame
- movl $16,%eax # SEG_KDATA << 3
- movw %ax,%ds # kernel
- movw %ax,%es # segments
- pushl %esp # pass pointer to this trapframe
- call trap # and call trap()
+ # Build trap frame.
+ pushl %ds
+ pushl %es
+ pushal
+
+ # Set up data segments.
+ movl $SEG_KDATA_SEL, %eax
+ movw %ax,%ds
+ movw %ax,%es
+
+ # Call trap(tf), where tf=%esp
+ pushl %esp
+ call trap
addl $4, %esp
- # return falls through to trapret...
- /*
- * a forked process RETs here
- * expects ESP to point to a Trapframe
- */
+ # Return falls through to trapret...
.globl trapret
trapret:
popal
popl %es
popl %ds
- addl $0x8, %esp /* trapno and errcode */
+ addl $0x8, %esp # trapno and errcode
iret
+ # A forked process switches to user mode by calling
+ # forkret1(tf), where tf is the trap frame to use.
.globl forkret1
forkret1:
movl 4(%esp), %esp