2006-09-06 17:04:06 +00:00
|
|
|
.text
|
2006-07-16 01:15:28 +00:00
|
|
|
.globl trap
|
|
|
|
.globl trapret1
|
|
|
|
.globl alltraps
|
2007-08-27 13:11:13 +00:00
|
|
|
|
|
|
|
.set SEG_KDATA_SEL 0x10 # selector for SEG_KDATA
|
|
|
|
|
|
|
|
# vectors.S sends all traps here.
|
2006-06-13 15:50:06 +00:00
|
|
|
alltraps:
|
2007-08-27 13:11:13 +00:00
|
|
|
# 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
|
2006-09-06 17:04:06 +00:00
|
|
|
addl $4, %esp
|
2006-09-06 17:27:19 +00:00
|
|
|
|
2007-08-27 13:11:13 +00:00
|
|
|
# Return falls through to trapret...
|
2006-07-16 01:15:28 +00:00
|
|
|
.globl trapret
|
2006-06-12 15:22:12 +00:00
|
|
|
trapret:
|
2006-09-06 17:04:06 +00:00
|
|
|
popal
|
|
|
|
popl %es
|
|
|
|
popl %ds
|
2007-08-27 13:11:13 +00:00
|
|
|
addl $0x8, %esp # trapno and errcode
|
2006-09-06 17:04:06 +00:00
|
|
|
iret
|
2006-06-22 01:28:57 +00:00
|
|
|
|
2007-08-27 13:11:13 +00:00
|
|
|
# A forked process switches to user mode by calling
|
|
|
|
# forkret1(tf), where tf is the trap frame to use.
|
2006-07-16 01:47:40 +00:00
|
|
|
.globl forkret1
|
|
|
|
forkret1:
|
2006-09-06 17:04:06 +00:00
|
|
|
movl 4(%esp), %esp
|
|
|
|
jmp trapret
|
2006-09-06 17:27:19 +00:00
|
|
|
|