1.text 2.globl trap 3.globl trapret1 4 5.globl alltraps 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 /* 20 * a forked process RETs here 21 * expects ESP to point to a Trapframe 22 */ 23.globl trapret 24trapret: 25 popal 26 popl %es 27 popl %ds 28 addl $0x8, %esp /* trapno and errcode */ 29 iret 30 31.globl forkret1 32forkret1: 33 movl 4(%esp), %esp 34 jmp trapret 35 36