xref: /xv6-public/trapasm.S (revision 5ce9751c)
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        pushl $kernel_lock
26        call release_spinlock
27        addl $0x4, %esp
28
29        popal
30        popl %es
31        popl %ds
32        addl $0x8, %esp /* trapno and errcode */
33        iret
34
35
36.globl 	acpu
37acpu:
38	.long 0
39