xv6-65oo2/trapasm.S

38 lines
662 B
ArmAsm
Raw Normal View History

2009-05-31 01:00:38 +00:00
#define SEG_KCODE 1 // kernel code
#define SEG_KDATA 2 // kernel data+stack
#define SEG_KCPU 3 // kernel per-cpu data
2007-08-27 13:11:13 +00:00
# vectors.S sends all traps here.
2007-08-28 18:23:48 +00:00
.globl alltraps
2006-06-13 15:50:06 +00:00
alltraps:
2007-08-27 13:11:13 +00:00
# Build trap frame.
pushl %ds
pushl %es
pushl %fs
pushl %gs
2007-08-27 13:11:13 +00:00
pushal
2009-05-31 01:00:38 +00:00
# Set up data and per-cpu segments.
movw $(SEG_KDATA<<3), %ax
movw %ax, %ds
movw %ax, %es
movw $(SEG_KCPU<<3), %ax
movw %ax, %fs
movw %ax, %gs
2007-08-27 13:11:13 +00:00
# Call trap(tf), where tf=%esp
pushl %esp
call trap
addl $4, %esp
2006-09-06 17:27:19 +00:00
2007-08-27 13:11:13 +00:00
# Return falls through to trapret...
.globl trapret
2006-06-12 15:22:12 +00:00
trapret:
popal
popl %gs
popl %fs
popl %es
popl %ds
2007-08-27 13:11:13 +00:00
addl $0x8, %esp # trapno and errcode
iret