155e95b16Srtm.text 20a70d042Srtm 3efc12b8eSrsc.set SEG_KDATA_SEL, 0x10 # selector for SEG_KDATA 4e1872bb1Srsc 5e1872bb1Srsc # vectors.S sends all traps here. 6c1b100e9Srsc.globl alltraps 7e1872bb1Srscalltraps: 8e1872bb1Srsc # Build trap frame. 9e1872bb1Srsc pushl %ds 10e1872bb1Srsc pushl %es 11*c7317d4dSkolya pushl %fs 12*c7317d4dSkolya pushl %gs 13e1872bb1Srsc pushal 14e1872bb1Srsc 15e1872bb1Srsc # Set up data segments. 16e1872bb1Srsc movl $SEG_KDATA_SEL, %eax 17e1872bb1Srsc movw %ax,%ds 18e1872bb1Srsc movw %ax,%es 19e1872bb1Srsc 20e1872bb1Srsc # Call trap(tf), where tf=%esp 21e1872bb1Srsc pushl %esp 22e1872bb1Srsc call trap 23e1872bb1Srsc addl $4, %esp 24e1872bb1Srsc 25e1872bb1Srsc # Return falls through to trapret... 2665bd8e13Srsc.globl trapret 2755e95b16Srtmtrapret: 2855e95b16Srtm popal 29*c7317d4dSkolya popl %gs 30*c7317d4dSkolya popl %fs 3155e95b16Srtm popl %es 3255e95b16Srtm popl %ds 33e1872bb1Srsc addl $0x8, %esp # trapno and errcode 3455e95b16Srtm iret 3521a88fd4Skaashoek 36e1872bb1Srsc # A forked process switches to user mode by calling 37e1872bb1Srsc # forkret1(tf), where tf is the trap frame to use. 38856e1fc1Srsc.globl forkret1 39856e1fc1Srscforkret1: 40856e1fc1Srsc movl 4(%esp), %esp 4165bd8e13Srsc jmp trapret 4221a88fd4Skaashoek 43