xv6-cs450/trapasm.S

38 lines
662 B
ArmAsm
Raw Normal View History

2009-05-31 03:00:38 +02: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 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
pushl %fs
pushl %gs
2007-08-27 15:11:13 +02:00
pushal
2009-05-31 03:00:38 +02: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 15:11:13 +02:00
# 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 %gs
popl %fs
popl %es
popl %ds
2007-08-27 15:11:13 +02:00
addl $0x8, %esp # trapno and errcode
iret