Skip to content
Snippets Groups Projects
trapasm.S 856 B
Newer Older
rtm's avatar
rtm committed
#include "mmu.h"
        
rtm's avatar
rtm committed
	.text
rsc's avatar
 
rsc committed
.globl trap
.globl trapret1

.globl alltraps
rtm's avatar
rtm committed
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
rtm's avatar
rtm committed
        # return falls through to trapret...
        
rtm's avatar
rtm committed
	/*
         * a forked process RETs here
         * expects ESP to point to a Trapframe
         */
rsc's avatar
 
rsc committed
.globl trapret
rtm's avatar
rtm committed
trapret:
        popal
        popl %es
        popl %ds
        addl $0x8, %esp /* trapno and errcode */
        iret
rsc's avatar
 
rsc committed
.globl forkret1
forkret1:
	movl 4(%esp), %esp
rsc's avatar
 
rsc committed
	jmp trapret