Save %gs in sigcontext when delivering a signal and restore them upon

return (in signal trampoline code). I plan to do the same on -stable,
so that we have a consistent interface to userland applications.

Reviewed by:	bde
This commit is contained in:
Luoqi Chen 1999-09-07 20:02:24 +00:00
parent aa8fac6c4d
commit ab6ec55891
7 changed files with 26 additions and 12 deletions

View File

@ -148,6 +148,9 @@ main()
printf("#define\tSIGF_HANDLER %#x\n", OS(sigframe, sf_ahu.sf_handler));
printf("#define\tSIGF_SC %#x\n", OS(sigframe, sf_siginfo.si_sc));
printf("#define\tSC_PS %#x\n", OS(sigcontext, sc_ps));
printf("#define\tSC_FS %#x\n", OS(sigcontext, sc_fs));
printf("#define\tSC_GS %#x\n", OS(sigcontext, sc_gs));
printf("#define\tB_READ %#x\n", B_READ);
printf("#define\tENOENT %d\n", ENOENT);

View File

@ -410,8 +410,6 @@ NON_GPROF_ENTRY(prepare_usermode)
ret /* goto user! */
#define LCALL(x,y) .byte 0x9a ; .long y ; .word x
/*
* Signal trampoline, copied to top of user stack
*/
@ -421,9 +419,13 @@ NON_GPROF_ENTRY(sigcode)
/* copy at 8(%esp)) */
pushl %eax
pushl %eax /* junk to fake return address */
testl $PSL_VM,SC_PS(%eax)
jne 1f
movl SC_GS(%eax),%gs /* restore %gs */
1:
movl $SYS_sigreturn,%eax /* sigreturn() */
LCALL(0x7,0) /* enter kernel with args on stack */
hlt /* never gets here */
int $0x80 /* enter kernel with args on stack */
2: jmp 2b
ALIGN_TEXT
_esigcode:

View File

@ -410,8 +410,6 @@ NON_GPROF_ENTRY(prepare_usermode)
ret /* goto user! */
#define LCALL(x,y) .byte 0x9a ; .long y ; .word x
/*
* Signal trampoline, copied to top of user stack
*/
@ -421,9 +419,13 @@ NON_GPROF_ENTRY(sigcode)
/* copy at 8(%esp)) */
pushl %eax
pushl %eax /* junk to fake return address */
testl $PSL_VM,SC_PS(%eax)
jne 1f
movl SC_GS(%eax),%gs /* restore %gs */
1:
movl $SYS_sigreturn,%eax /* sigreturn() */
LCALL(0x7,0) /* enter kernel with args on stack */
hlt /* never gets here */
int $0x80 /* enter kernel with args on stack */
2: jmp 2b
ALIGN_TEXT
_esigcode:

View File

@ -562,6 +562,7 @@ sendsig(catcher, sig, mask, code)
sf.sf_siginfo.si_sc.sc_ss = regs->tf_ss;
sf.sf_siginfo.si_sc.sc_es = regs->tf_es;
sf.sf_siginfo.si_sc.sc_fs = regs->tf_fs;
sf.sf_siginfo.si_sc.sc_gs = rgs();
sf.sf_siginfo.si_sc.sc_isp = regs->tf_isp;
/*

View File

@ -148,6 +148,9 @@ main()
printf("#define\tSIGF_HANDLER %#x\n", OS(sigframe, sf_ahu.sf_handler));
printf("#define\tSIGF_SC %#x\n", OS(sigframe, sf_siginfo.si_sc));
printf("#define\tSC_PS %#x\n", OS(sigcontext, sc_ps));
printf("#define\tSC_FS %#x\n", OS(sigcontext, sc_fs));
printf("#define\tSC_GS %#x\n", OS(sigcontext, sc_gs));
printf("#define\tB_READ %#x\n", B_READ);
printf("#define\tENOENT %d\n", ENOENT);

View File

@ -410,8 +410,6 @@ NON_GPROF_ENTRY(prepare_usermode)
ret /* goto user! */
#define LCALL(x,y) .byte 0x9a ; .long y ; .word x
/*
* Signal trampoline, copied to top of user stack
*/
@ -421,9 +419,13 @@ NON_GPROF_ENTRY(sigcode)
/* copy at 8(%esp)) */
pushl %eax
pushl %eax /* junk to fake return address */
testl $PSL_VM,SC_PS(%eax)
jne 1f
movl SC_GS(%eax),%gs /* restore %gs */
1:
movl $SYS_sigreturn,%eax /* sigreturn() */
LCALL(0x7,0) /* enter kernel with args on stack */
hlt /* never gets here */
int $0x80 /* enter kernel with args on stack */
2: jmp 2b
ALIGN_TEXT
_esigcode:

View File

@ -562,6 +562,7 @@ sendsig(catcher, sig, mask, code)
sf.sf_siginfo.si_sc.sc_ss = regs->tf_ss;
sf.sf_siginfo.si_sc.sc_es = regs->tf_es;
sf.sf_siginfo.si_sc.sc_fs = regs->tf_fs;
sf.sf_siginfo.si_sc.sc_gs = rgs();
sf.sf_siginfo.si_sc.sc_isp = regs->tf_isp;
/*