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