2011-08-08 19:30:08 +02:00
|
|
|
#include "mmu.h"
|
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
|
2008-09-24 03:48:31 +02:00
|
|
|
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
|
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
|
2008-09-24 03:48:31 +02:00
|
|
|
popl %gs
|
|
|
|
popl %fs
|
2006-09-06 19:04:06 +02:00
|
|
|
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
|