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 | ||||
/* | |||||
* Our lcall $7,$0 handler remains in user mode (ring 3), since lcalls | |||||
* don't change the interrupt mask, so if this one went directly to the | |||||
* kernel then there would be a window with interrupts enabled in kernel | |||||
* mode, and all interrupt handlers would have to be almost as complicated | |||||
* as the NMI handler to support this. | |||||
* | |||||
* Instead, convert the lcall to an int0x80 call. The kernel does most | |||||
* of the conversion by popping the lcall return values off the user | |||||
* stack and returning to them instead of to here, except when the | |||||
* conversion itself fails. Adjusting the stack here is impossible for | |||||
* vfork() and harder for other syscalls. | |||||
*/ | |||||
ALIGN_TEXT | |||||
lcall_tramp: | |||||
int $0x80 | |||||
1: jmp 1b | |||||
#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 |