formatting, fix comment
This commit is contained in:
parent
e0240674f5
commit
e1872bb130
1 changed files with 23 additions and 18 deletions
41
trapasm.S
41
trapasm.S
|
@ -1,33 +1,38 @@
|
||||||
.text
|
.text
|
||||||
.globl trap
|
.globl trap
|
||||||
.globl trapret1
|
.globl trapret1
|
||||||
|
|
||||||
.globl alltraps
|
.globl alltraps
|
||||||
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()
|
|
||||||
addl $4, %esp
|
|
||||||
# return falls through to trapret...
|
|
||||||
|
|
||||||
/*
|
.set SEG_KDATA_SEL 0x10 # selector for SEG_KDATA
|
||||||
* a forked process RETs here
|
|
||||||
* expects ESP to point to a Trapframe
|
# vectors.S sends all traps here.
|
||||||
*/
|
alltraps:
|
||||||
|
# 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...
|
||||||
.globl trapret
|
.globl trapret
|
||||||
trapret:
|
trapret:
|
||||||
popal
|
popal
|
||||||
popl %es
|
popl %es
|
||||||
popl %ds
|
popl %ds
|
||||||
addl $0x8, %esp /* trapno and errcode */
|
addl $0x8, %esp # trapno and errcode
|
||||||
iret
|
iret
|
||||||
|
|
||||||
|
# A forked process switches to user mode by calling
|
||||||
|
# forkret1(tf), where tf is the trap frame to use.
|
||||||
.globl forkret1
|
.globl forkret1
|
||||||
forkret1:
|
forkret1:
|
||||||
movl 4(%esp), %esp
|
movl 4(%esp), %esp
|
||||||
|
|
Loading…
Reference in a new issue