xv6-cs450/trapasm.S

39 lines
650 B
ArmAsm
Raw Normal View History

.text
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.
2007-08-28 20:23:48 +02:00
.globl alltraps
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
addl $4, %esp
2006-09-06 19:27:19 +02:00
2007-08-27 15:11:13 +02:00
# Return falls through to trapret...
.globl trapret
2006-06-12 17:22:12 +02:00
trapret:
popal
popl %es
popl %ds
2007-08-27 15:11:13 +02:00
addl $0x8, %esp # trapno and errcode
iret
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.
.globl forkret1
forkret1:
movl 4(%esp), %esp
jmp trapret
2006-09-06 19:27:19 +02:00