diff options
author | luoqi <luoqi@FreeBSD.org> | 1999-09-07 20:02:24 +0000 |
---|---|---|
committer | luoqi <luoqi@FreeBSD.org> | 1999-09-07 20:02:24 +0000 |
commit | 34e1ccb1bdaecd6a8320d6925c70c1db42c925d3 (patch) | |
tree | b8290ebeabe9c22cc39df20454d7d46ba070de26 /sys/i386 | |
parent | 214423fce236effd4370260f28cc3f2497f9e4ff (diff) | |
download | FreeBSD-src-34e1ccb1bdaecd6a8320d6925c70c1db42c925d3.zip FreeBSD-src-34e1ccb1bdaecd6a8320d6925c70c1db42c925d3.tar.gz |
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
Diffstat (limited to 'sys/i386')
-rw-r--r-- | sys/i386/i386/genassym.c | 3 | ||||
-rw-r--r-- | sys/i386/i386/locore.s | 10 | ||||
-rw-r--r-- | sys/i386/i386/machdep.c | 1 |
3 files changed, 10 insertions, 4 deletions
diff --git a/sys/i386/i386/genassym.c b/sys/i386/i386/genassym.c index 2df5182..d4023cc 100644 --- a/sys/i386/i386/genassym.c +++ b/sys/i386/i386/genassym.c @@ -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); diff --git a/sys/i386/i386/locore.s b/sys/i386/i386/locore.s index f262726..ad499bd 100644 --- a/sys/i386/i386/locore.s +++ b/sys/i386/i386/locore.s @@ -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: diff --git a/sys/i386/i386/machdep.c b/sys/i386/i386/machdep.c index a3c33bf..7b712d2 100644 --- a/sys/i386/i386/machdep.c +++ b/sys/i386/i386/machdep.c @@ -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; /* |