xref: /xv6-public/trapasm.S (revision 0a70d042)
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        # return falls through to trapret...
17
18        .globl trapret
19	/*
20         * a forked process RETs here
21         * expects ESP to point to a Trapframe
22         */
23trapret:
24        popal
25        popl %es
26        popl %ds
27        addl $0x8, %esp /* trapno and errcode */
28        iret
29