summaryrefslogtreecommitdiff
path: root/trapasm.S
blob: 3e0f37562a269a7bb382e17192a4307d07bed7f8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#include "mmu.h"
        
	.text
.globl trap
.globl trapret1

.globl alltraps
alltraps:
        /* vectors.S sends all traps here */
        pushl   %ds     # build
        pushl   %es     #  trap
        pushal          #  frame
        movl $16,%eax    # SEG_KDATA << 3
        movw %ax,%ds        #  kernel
        movw %ax,%es        #  segments
        pushl %esp      # pass pointer to this trapframe
        call    trap        #  and call trap()
        addl $4, %esp
        # return falls through to trapret...
        
	/*
         * a forked process RETs here
         * expects ESP to point to a Trapframe
         */
.globl trapret
trapret:
        popal
        popl %es
        popl %ds
        addl $0x8, %esp /* trapno and errcode */
        iret

.globl forkret1
forkret1:
	movl 4(%esp), %esp
	jmp trapret
		
.globl 	acpu
acpu:
	.long 0