root/trapasm.S
/* [<][>][^][v][top][bottom][index][help] */
1 #include "mmu.h"
2
3 # vectors.S sends all traps here.
4 .globl alltraps
5 alltraps:
6 # Build trap frame.
7 pushl %ds
8 pushl %es
9 pushl %fs
10 pushl %gs
11 pushal
12
13 # Set up data and per-cpu segments.
14 movw $(SEG_KDATA<<3), %ax
15 movw %ax, %ds
16 movw %ax, %es
17 movw $(SEG_KCPU<<3), %ax
18 movw %ax, %fs
19 movw %ax, %gs
20
21 # Call trap(tf), where tf=%esp
22 pushl %esp
23 call trap
24 addl $4, %esp
25
26 # Return falls through to trapret...
27 .globl trapret
28 trapret:
29 popal
30 popl %gs
31 popl %fs
32 popl %es
33 popl %ds
34 addl $0x8, %esp # trapno and errcode
35 iret