1#include "mmu.h" 2 3 .text 4.globl trap 5.globl trapret1 6 7.globl alltraps 8alltraps: 9 /* vectors.S sends all traps here */ 10 pushl %ds # build 11 pushl %es # trap 12 pushal # frame 13 movl $16,%eax # SEG_KDATA << 3 14 movw %ax,%ds # kernel 15 movw %ax,%es # segments 16 pushl %esp # pass pointer to this trapframe 17 call trap # and call trap() 18 addl $4, %esp 19 # return falls through to trapret... 20 21 /* 22 * a forked process RETs here 23 * expects ESP to point to a Trapframe 24 */ 25.globl trapret 26trapret: 27 popal 28 popl %es 29 popl %ds 30 addl $0x8, %esp /* trapno and errcode */ 31 iret 32 33.globl forkret1 34forkret1: 35 movl 4(%esp), %esp 36 jmp trapret 37 38.globl acpu 39acpu: 40 .long 0 41