Changeset View
Changeset View
Standalone View
Standalone View
sys/i386/i386/sigtramp.s
Show First 20 Lines • Show All 91 Lines • ▼ Show 20 Lines | osigcode: | ||||
testl $PSL_VM,SC_PS(%eax) | testl $PSL_VM,SC_PS(%eax) | ||||
jne 9f | jne 9f | ||||
mov SC_GS(%eax),%gs /* restore %gs */ | mov SC_GS(%eax),%gs /* restore %gs */ | ||||
9: | 9: | ||||
movl $103,%eax /* 3.x SYS_sigreturn */ | movl $103,%eax /* 3.x SYS_sigreturn */ | ||||
pushl %eax /* junk to fake return addr. */ | pushl %eax /* junk to fake return addr. */ | ||||
int $0x80 /* enter kernel with args */ | int $0x80 /* enter kernel with args */ | ||||
0: jmp 0b | 0: jmp 0b | ||||
/* | |||||
* The lcall $7,$0 handler cannot use the call gate that does an | |||||
* inter-privilege transition. The reason is that the call gate | |||||
* does not disable interrupts, and, before the kernel page table is | |||||
* activated on MMU, we would have a window where the ring 0 code is | |||||
* executed with the wrong page table and interrupts enabled. | |||||
* | |||||
* Instead, set LDT descriptor 0 as code segment, which reflects | |||||
* the lcall $7,$0 back to ring 3 trampoline. The trampoline sets up | |||||
* the frame for int $0x80. | |||||
*/ | |||||
ALIGN_TEXT | |||||
lcall_tramp: | |||||
cmpl $SYS_vfork,%eax | |||||
je 1f | |||||
pushl %ebp | |||||
movl %esp,%ebp | |||||
pushl 0x24(%ebp) /* arg 6 */ | |||||
pushl 0x20(%ebp) | |||||
pushl 0x1c(%ebp) | |||||
pushl 0x18(%ebp) | |||||
pushl 0x14(%ebp) | |||||
pushl 0x10(%ebp) /* arg 1 */ | |||||
subl $4,%esp /* gap */ | |||||
int $0x80 | |||||
leavel | |||||
lretl | |||||
1: | |||||
/* | |||||
* vfork handling is special and relies on the libc stub saving | |||||
* the return ip in %ecx. Also, we assume that the call was done | |||||
* with ucode32 selector in %cs. | |||||
*/ | |||||
int $0x80 | |||||
movl $0x33,4(%esp) /* GUCODE32_SEL | SEL_UPL */ | |||||
movl %ecx,(%esp) | |||||
lretl | |||||
#endif /* COMPAT_43 */ | #endif /* COMPAT_43 */ | ||||
ALIGN_TEXT | ALIGN_TEXT | ||||
esigcode: | esigcode: | ||||
.data | .data | ||||
.globl szsigcode | .globl szsigcode | ||||
szsigcode: | szsigcode: | ||||
.long esigcode-sigcode | .long esigcode-sigcode | ||||
#ifdef COMPAT_FREEBSD4 | #ifdef COMPAT_FREEBSD4 | ||||
.globl szfreebsd4_sigcode | .globl szfreebsd4_sigcode | ||||
szfreebsd4_sigcode: | szfreebsd4_sigcode: | ||||
.long esigcode-freebsd4_sigcode | .long esigcode-freebsd4_sigcode | ||||
#endif | #endif | ||||
#ifdef COMPAT_43 | #ifdef COMPAT_43 | ||||
.globl szosigcode | .globl szosigcode | ||||
szosigcode: | szosigcode: | ||||
.long esigcode-osigcode | .long esigcode-osigcode | ||||
.globl sz_lcall_tramp | |||||
sz_lcall_tramp: | |||||
.long esigcode-lcall_tramp | |||||
#endif | #endif |