xref: /xv6-public/trapasm.S (revision a4c03dea)
1#include "mmu.h"
2
3	.text
4        .globl alltraps
5        .globl trap
6alltraps:
7        /* vectors.S sends all traps here */
8        pushl   %ds     # build
9        pushl   %es     #  trap
10        pushal          #  frame
11        movl $16,%eax    # SEG_KDATA << 3
12        movw %ax,%ds        #  kernel
13        movw %ax,%es        #  segments
14        pushl %esp      # pass pointer to this trapframe
15        call    trap        #  and call trap()
16        addl $4, %esp
17        # return falls through to trapret...
18
19        .globl trapret
20	/*
21         * a forked process RETs here
22         * expects ESP to point to a Trapframe
23         */
24trapret:
25        popal
26        popl %es
27        popl %ds
28        addl $0x8, %esp /* trapno and errcode */
29        iret
30