2011-08-08 17:30:08 +00:00
|
|
|
#include "mmu.h"
|
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
|
2008-09-24 01:48:31 +00:00
|
|
|
pushl %fs
|
|
|
|
pushl %gs
|
2007-08-27 13:11:13 +00:00
|
|
|
pushal
|
|
|
|
|
2017-08-09 12:07:55 +00:00
|
|
|
# Set up data segments.
|
2009-05-31 01:00:38 +00:00
|
|
|
movw $(SEG_KDATA<<3), %ax
|
|
|
|
movw %ax, %ds
|
|
|
|
movw %ax, %es
|
2007-08-27 13:11:13 +00:00
|
|
|
|
|
|
|
# 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
|
2008-09-24 01:48:31 +00:00
|
|
|
popl %gs
|
|
|
|
popl %fs
|
2006-09-06 17:04:06 +00:00
|
|
|
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
|