Deleted Added
full compact
ia32_signal.c (190620) ia32_signal.c (195486)
1/*-
2 * Copyright (c) 2003 Peter Wemm
3 * Copyright (c) 1982, 1987, 1990 The Regents of the University of California.
4 * All rights reserved.
5 *
6 * This code is derived from software contributed to Berkeley by
7 * William Jolitz.
8 *

--- 18 unchanged lines hidden (view full) ---

27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 * SUCH DAMAGE.
32 */
33
34#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 2003 Peter Wemm
3 * Copyright (c) 1982, 1987, 1990 The Regents of the University of California.
4 * All rights reserved.
5 *
6 * This code is derived from software contributed to Berkeley by
7 * William Jolitz.
8 *

--- 18 unchanged lines hidden (view full) ---

27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 * SUCH DAMAGE.
32 */
33
34#include <sys/cdefs.h>
35__FBSDID("$FreeBSD: head/sys/amd64/ia32/ia32_signal.c 190620 2009-04-01 13:09:26Z kib $");
35__FBSDID("$FreeBSD: head/sys/amd64/ia32/ia32_signal.c 195486 2009-07-09 09:34:11Z kib $");
36
37#include "opt_compat.h"
38
39#include <sys/param.h>
40#include <sys/exec.h>
41#include <sys/fcntl.h>
42#include <sys/imgact.h>
43#include <sys/kernel.h>

--- 110 unchanged lines hidden (view full) ---

154 mcp->mc_cs = tp->tf_cs;
155 mcp->mc_eflags = tp->tf_rflags;
156 mcp->mc_esp = tp->tf_rsp;
157 mcp->mc_ss = tp->tf_ss;
158 mcp->mc_len = sizeof(*mcp);
159 ia32_get_fpcontext(td, mcp);
160 mcp->mc_fsbase = td->td_pcb->pcb_fsbase;
161 mcp->mc_gsbase = td->td_pcb->pcb_gsbase;
36
37#include "opt_compat.h"
38
39#include <sys/param.h>
40#include <sys/exec.h>
41#include <sys/fcntl.h>
42#include <sys/imgact.h>
43#include <sys/kernel.h>

--- 110 unchanged lines hidden (view full) ---

154 mcp->mc_cs = tp->tf_cs;
155 mcp->mc_eflags = tp->tf_rflags;
156 mcp->mc_esp = tp->tf_rsp;
157 mcp->mc_ss = tp->tf_ss;
158 mcp->mc_len = sizeof(*mcp);
159 ia32_get_fpcontext(td, mcp);
160 mcp->mc_fsbase = td->td_pcb->pcb_fsbase;
161 mcp->mc_gsbase = td->td_pcb->pcb_gsbase;
162 td->td_pcb->pcb_full_iret = 1;
162 return (0);
163}
164
165/*
166 * Set machine context.
167 *
168 * However, we don't set any but the user modifiable flags, and we won't
169 * touch the cs selector.

--- 26 unchanged lines hidden (view full) ---

196 tp->tf_rcx = mcp->mc_ecx;
197 tp->tf_rax = mcp->mc_eax;
198 /* trapno, err */
199 tp->tf_rip = mcp->mc_eip;
200 tp->tf_rflags = rflags;
201 tp->tf_rsp = mcp->mc_esp;
202 tp->tf_ss = mcp->mc_ss;
203 td->td_pcb->pcb_flags |= PCB_FULLCTX;
163 return (0);
164}
165
166/*
167 * Set machine context.
168 *
169 * However, we don't set any but the user modifiable flags, and we won't
170 * touch the cs selector.

--- 26 unchanged lines hidden (view full) ---

197 tp->tf_rcx = mcp->mc_ecx;
198 tp->tf_rax = mcp->mc_eax;
199 /* trapno, err */
200 tp->tf_rip = mcp->mc_eip;
201 tp->tf_rflags = rflags;
202 tp->tf_rsp = mcp->mc_esp;
203 tp->tf_ss = mcp->mc_ss;
204 td->td_pcb->pcb_flags |= PCB_FULLCTX;
205 td->td_pcb->pcb_full_iret = 1;
204 return (0);
205}
206
207/*
208 * The first two fields of a ucontext_t are the signal mask and
209 * the machine context. The next field is uc_link; we want to
210 * avoid destroying the link when copying out contexts.
211 */

--- 177 unchanged lines hidden (view full) ---

389
390 regs->tf_rsp = (uintptr_t)sfp;
391 regs->tf_rip = FREEBSD32_PS_STRINGS - sz_freebsd4_ia32_sigcode;
392 regs->tf_rflags &= ~(PSL_T | PSL_D);
393 regs->tf_cs = _ucode32sel;
394 regs->tf_ss = _udatasel;
395 regs->tf_ds = _udatasel;
396 regs->tf_es = _udatasel;
206 return (0);
207}
208
209/*
210 * The first two fields of a ucontext_t are the signal mask and
211 * the machine context. The next field is uc_link; we want to
212 * avoid destroying the link when copying out contexts.
213 */

--- 177 unchanged lines hidden (view full) ---

391
392 regs->tf_rsp = (uintptr_t)sfp;
393 regs->tf_rip = FREEBSD32_PS_STRINGS - sz_freebsd4_ia32_sigcode;
394 regs->tf_rflags &= ~(PSL_T | PSL_D);
395 regs->tf_cs = _ucode32sel;
396 regs->tf_ss = _udatasel;
397 regs->tf_ds = _udatasel;
398 regs->tf_es = _udatasel;
399 td->td_pcb->pcb_full_iret = 1;
397 /* leave user %fs and %gs untouched */
398 PROC_LOCK(p);
399 mtx_lock(&psp->ps_mtx);
400}
401#endif /* COMPAT_FREEBSD4 */
402
403void
404ia32_sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t *mask)

--- 104 unchanged lines hidden (view full) ---

509
510 regs->tf_rsp = (uintptr_t)sfp;
511 regs->tf_rip = FREEBSD32_PS_STRINGS - *(p->p_sysent->sv_szsigcode);
512 regs->tf_rflags &= ~(PSL_T | PSL_D);
513 regs->tf_cs = _ucode32sel;
514 regs->tf_ss = _udatasel;
515 regs->tf_ds = _udatasel;
516 regs->tf_es = _udatasel;
400 /* leave user %fs and %gs untouched */
401 PROC_LOCK(p);
402 mtx_lock(&psp->ps_mtx);
403}
404#endif /* COMPAT_FREEBSD4 */
405
406void
407ia32_sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t *mask)

--- 104 unchanged lines hidden (view full) ---

512
513 regs->tf_rsp = (uintptr_t)sfp;
514 regs->tf_rip = FREEBSD32_PS_STRINGS - *(p->p_sysent->sv_szsigcode);
515 regs->tf_rflags &= ~(PSL_T | PSL_D);
516 regs->tf_cs = _ucode32sel;
517 regs->tf_ss = _udatasel;
518 regs->tf_ds = _udatasel;
519 regs->tf_es = _udatasel;
520 td->td_pcb->pcb_full_iret = 1;
517 /* XXXKIB leave user %fs and %gs untouched */
518 PROC_LOCK(p);
519 mtx_lock(&psp->ps_mtx);
520}
521
522/*
523 * System call to cleanup state after a signal
524 * has been taken. Reset signal mask and

--- 81 unchanged lines hidden (view full) ---

606 regs->tf_fs = ucp->uc_mcontext.mc_fs;
607 regs->tf_gs = ucp->uc_mcontext.mc_gs;
608
609 PROC_LOCK(p);
610 td->td_sigmask = ucp->uc_sigmask;
611 SIG_CANTMASK(td->td_sigmask);
612 signotify(td);
613 PROC_UNLOCK(p);
521 /* XXXKIB leave user %fs and %gs untouched */
522 PROC_LOCK(p);
523 mtx_lock(&psp->ps_mtx);
524}
525
526/*
527 * System call to cleanup state after a signal
528 * has been taken. Reset signal mask and

--- 81 unchanged lines hidden (view full) ---

610 regs->tf_fs = ucp->uc_mcontext.mc_fs;
611 regs->tf_gs = ucp->uc_mcontext.mc_gs;
612
613 PROC_LOCK(p);
614 td->td_sigmask = ucp->uc_sigmask;
615 SIG_CANTMASK(td->td_sigmask);
616 signotify(td);
617 PROC_UNLOCK(p);
618 td->td_pcb->pcb_full_iret = 1;
614 return (EJUSTRETURN);
615}
616#endif /* COMPAT_FREEBSD4 */
617
618/*
619 * MPSAFE
620 */
621int

--- 75 unchanged lines hidden (view full) ---

697 regs->tf_gs = ucp->uc_mcontext.mc_gs;
698 regs->tf_flags = TF_HASSEGS;
699
700 PROC_LOCK(p);
701 td->td_sigmask = ucp->uc_sigmask;
702 SIG_CANTMASK(td->td_sigmask);
703 signotify(td);
704 PROC_UNLOCK(p);
619 return (EJUSTRETURN);
620}
621#endif /* COMPAT_FREEBSD4 */
622
623/*
624 * MPSAFE
625 */
626int

--- 75 unchanged lines hidden (view full) ---

702 regs->tf_gs = ucp->uc_mcontext.mc_gs;
703 regs->tf_flags = TF_HASSEGS;
704
705 PROC_LOCK(p);
706 td->td_sigmask = ucp->uc_sigmask;
707 SIG_CANTMASK(td->td_sigmask);
708 signotify(td);
709 PROC_UNLOCK(p);
710 td->td_pcb->pcb_full_iret = 1;
705 return (EJUSTRETURN);
706}
707
708/*
709 * Clear registers on exec
710 */
711void
712ia32_setregs(td, entry, stack, ps_strings)

--- 29 unchanged lines hidden (view full) ---

742 regs->tf_flags = TF_HASSEGS;
743
744 load_cr0(rcr0() | CR0_MP | CR0_TS);
745 fpstate_drop(td);
746
747 /* Return via doreti so that we can change to a different %cs */
748 pcb->pcb_flags |= PCB_FULLCTX | PCB_32BIT;
749 pcb->pcb_flags &= ~PCB_GS32BIT;
711 return (EJUSTRETURN);
712}
713
714/*
715 * Clear registers on exec
716 */
717void
718ia32_setregs(td, entry, stack, ps_strings)

--- 29 unchanged lines hidden (view full) ---

748 regs->tf_flags = TF_HASSEGS;
749
750 load_cr0(rcr0() | CR0_MP | CR0_TS);
751 fpstate_drop(td);
752
753 /* Return via doreti so that we can change to a different %cs */
754 pcb->pcb_flags |= PCB_FULLCTX | PCB_32BIT;
755 pcb->pcb_flags &= ~PCB_GS32BIT;
756 td->td_pcb->pcb_full_iret = 1;
750 td->td_retval[1] = 0;
751}
757 td->td_retval[1] = 0;
758}