155e95b16Srtm.text 20a70d042Srtm 3efc12b8eSrsc.set SEG_KDATA_SEL, 0x10 # selector for SEG_KDATA 4e1872bb1Srsc 5e1872bb1Srsc # vectors.S sends all traps here. 6*c1b100e9Srsc.globl alltraps 7e1872bb1Srscalltraps: 8e1872bb1Srsc # Build trap frame. 9e1872bb1Srsc pushl %ds 10e1872bb1Srsc pushl %es 11e1872bb1Srsc pushal 12e1872bb1Srsc 13e1872bb1Srsc # Set up data segments. 14e1872bb1Srsc movl $SEG_KDATA_SEL, %eax 15e1872bb1Srsc movw %ax,%ds 16e1872bb1Srsc movw %ax,%es 17e1872bb1Srsc 18e1872bb1Srsc # Call trap(tf), where tf=%esp 19e1872bb1Srsc pushl %esp 20e1872bb1Srsc call trap 21e1872bb1Srsc addl $4, %esp 22e1872bb1Srsc 23e1872bb1Srsc # Return falls through to trapret... 2465bd8e13Srsc.globl trapret 2555e95b16Srtmtrapret: 2655e95b16Srtm popal 2755e95b16Srtm popl %es 2855e95b16Srtm popl %ds 29e1872bb1Srsc addl $0x8, %esp # trapno and errcode 3055e95b16Srtm iret 3121a88fd4Skaashoek 32e1872bb1Srsc # A forked process switches to user mode by calling 33e1872bb1Srsc # forkret1(tf), where tf is the trap frame to use. 34856e1fc1Srsc.globl forkret1 35856e1fc1Srscforkret1: 36856e1fc1Srsc movl 4(%esp), %esp 3765bd8e13Srsc jmp trapret 3821a88fd4Skaashoek 39