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 segments. |
14 | movw $(SEG_KDATA<<3), %ax |
15 | movw %ax, %ds |
16 | movw %ax, %es |
17 | |
18 | # Call trap(tf), where tf=%esp |
19 | pushl %esp |
20 | call trap |
21 | addl $4, %esp |
22 | |
23 | # Return falls through to trapret... |
24 | .globl trapret |
25 | trapret: |
26 | popal |
27 | popl %gs |
28 | popl %fs |
29 | popl %es |
30 | popl %ds |
31 | addl $0x8, %esp # trapno and errcode |
32 | iret |
33 | |