Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 20 Sep 2002 19:12:15 -0700 (PDT)
From:      Peter Wemm <peter@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 17799 for review
Message-ID:  <200209210212.g8L2CFSF086698@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://people.freebsd.org/~peter/p4db/chv.cgi?CH=17799

Change 17799 by peter@peter_daintree on 2002/09/20 19:12:09

	shoot osendsig and osigreturn in the head (I know, it wont link)

Affected files ...

.. //depot/projects/hammer/sys/x86_64/x86_64/machdep.c#3 edit

Differences ...

==== //depot/projects/hammer/sys/x86_64/x86_64/machdep.c#3 (text+ko) ====

@@ -161,10 +161,6 @@
 long physmem = 0;
 int cold = 1;
 
-#ifdef COMPAT_43
-static void osendsig(sig_t catcher, int sig, sigset_t *mask, u_long code);
-#endif
-
 static int
 sysctl_hw_physmem(SYSCTL_HANDLER_ARGS)
 {
@@ -277,136 +273,6 @@
  * frame pointer, it returns to the user
  * specified pc, psl.
  */
-#ifdef COMPAT_43
-static void
-osendsig(catcher, sig, mask, code)
-	sig_t catcher;
-	int sig;
-	sigset_t *mask;
-	u_long code;
-{
-	struct osigframe sf;
-	struct osigframe *fp;
-	struct proc *p;
-	struct thread *td;
-	struct sigacts *psp;
-	struct trapframe *regs;
-	int oonstack;
-
-	td = curthread;
-	p = td->td_proc;
-	PROC_LOCK_ASSERT(p, MA_OWNED);
-	psp = p->p_sigacts;
-	regs = td->td_frame;
-	oonstack = sigonstack(regs->tf_esp);
-
-	/* Allocate space for the signal handler context. */
-	if ((p->p_flag & P_ALTSTACK) && !oonstack &&
-	    SIGISMEMBER(psp->ps_sigonstack, sig)) {
-		fp = (struct osigframe *)(p->p_sigstk.ss_sp +
-		    p->p_sigstk.ss_size - sizeof(struct osigframe));
-#if defined(COMPAT_43) || defined(COMPAT_SUNOS)
-		p->p_sigstk.ss_flags |= SS_ONSTACK;
-#endif
-	} else
-		fp = (struct osigframe *)regs->tf_esp - 1;
-	PROC_UNLOCK(p);
-
-	/* Translate the signal if appropriate. */
-	if (p->p_sysent->sv_sigtbl && sig <= p->p_sysent->sv_sigsize)
-		sig = p->p_sysent->sv_sigtbl[_SIG_IDX(sig)];
-
-	/* Build the argument list for the signal handler. */
-	sf.sf_signum = sig;
-	sf.sf_scp = (register_t)&fp->sf_siginfo.si_sc;
-	PROC_LOCK(p);
-	if (SIGISMEMBER(p->p_sigacts->ps_siginfo, sig)) {
-		/* Signal handler installed with SA_SIGINFO. */
-		sf.sf_arg2 = (register_t)&fp->sf_siginfo;
-		sf.sf_siginfo.si_signo = sig;
-		sf.sf_siginfo.si_code = code;
-		sf.sf_ahu.sf_action = (__osiginfohandler_t *)catcher;
-	} else {
-		/* Old FreeBSD-style arguments. */
-		sf.sf_arg2 = code;
-		sf.sf_addr = regs->tf_err;
-		sf.sf_ahu.sf_handler = catcher;
-	}
-	PROC_UNLOCK(p);
-
-	/* Save most if not all of trap frame. */
-	sf.sf_siginfo.si_sc.sc_eax = regs->tf_eax;
-	sf.sf_siginfo.si_sc.sc_ebx = regs->tf_ebx;
-	sf.sf_siginfo.si_sc.sc_ecx = regs->tf_ecx;
-	sf.sf_siginfo.si_sc.sc_edx = regs->tf_edx;
-	sf.sf_siginfo.si_sc.sc_esi = regs->tf_esi;
-	sf.sf_siginfo.si_sc.sc_edi = regs->tf_edi;
-	sf.sf_siginfo.si_sc.sc_cs = regs->tf_cs;
-	sf.sf_siginfo.si_sc.sc_ds = regs->tf_ds;
-	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;
-
-	/* Build the signal context to be used by osigreturn(). */
-	sf.sf_siginfo.si_sc.sc_onstack = (oonstack) ? 1 : 0;
-	SIG2OSIG(*mask, sf.sf_siginfo.si_sc.sc_mask);
-	sf.sf_siginfo.si_sc.sc_sp = regs->tf_esp;
-	sf.sf_siginfo.si_sc.sc_fp = regs->tf_ebp;
-	sf.sf_siginfo.si_sc.sc_pc = regs->tf_eip;
-	sf.sf_siginfo.si_sc.sc_ps = regs->tf_eflags;
-	sf.sf_siginfo.si_sc.sc_trapno = regs->tf_trapno;
-	sf.sf_siginfo.si_sc.sc_err = regs->tf_err;
-
-	/*
-	 * If we're a vm86 process, we want to save the segment registers.
-	 * We also change eflags to be our emulated eflags, not the actual
-	 * eflags.
-	 */
-	if (regs->tf_eflags & PSL_VM) {
-		/* XXX confusing names: `tf' isn't a trapframe; `regs' is. */
-		struct trapframe_vm86 *tf = (struct trapframe_vm86 *)regs;
-		struct vm86_kernel *vm86 = &td->td_pcb->pcb_ext->ext_vm86;
-
-		sf.sf_siginfo.si_sc.sc_gs = tf->tf_vm86_gs;
-		sf.sf_siginfo.si_sc.sc_fs = tf->tf_vm86_fs;
-		sf.sf_siginfo.si_sc.sc_es = tf->tf_vm86_es;
-		sf.sf_siginfo.si_sc.sc_ds = tf->tf_vm86_ds;
-
-		if (vm86->vm86_has_vme == 0)
-			sf.sf_siginfo.si_sc.sc_ps =
-			    (tf->tf_eflags & ~(PSL_VIF | PSL_VIP)) |
-			    (vm86->vm86_eflags & (PSL_VIF | PSL_VIP));
-
-		/* See sendsig() for comments. */
-		tf->tf_eflags &= ~(PSL_VM | PSL_NT | PSL_VIF | PSL_VIP);
-	}
-
-	/*
-	 * Copy the sigframe out to the user's stack.
-	 */
-	if (copyout(&sf, fp, sizeof(*fp)) != 0) {
-#ifdef DEBUG
-		printf("process %ld has trashed its stack\n", (long)p->p_pid);
-#endif
-		PROC_LOCK(p);
-		sigexit(td, SIGILL);
-	}
-
-	regs->tf_esp = (int)fp;
-	regs->tf_eip = PS_STRINGS - szosigcode;
-	regs->tf_eflags &= ~PSL_T;
-	regs->tf_cs = _ucodesel;
-	regs->tf_ds = _udatasel;
-	regs->tf_es = _udatasel;
-	regs->tf_fs = _udatasel;
-	load_gs(_udatasel);
-	regs->tf_ss = _udatasel;
-	PROC_LOCK(p);
-}
-#endif /* COMPAT_43 */
-
 void
 sendsig(catcher, sig, mask, code)
 	sig_t catcher;
@@ -426,12 +292,6 @@
 	p = td->td_proc;
 	PROC_LOCK_ASSERT(p, MA_OWNED);
 	psp = p->p_sigacts;
-#ifdef COMPAT_43
-	if (SIGISMEMBER(psp->ps_osigset, sig)) {
-		osendsig(catcher, sig, mask, code);
-		return;
-	}
-#endif
 	regs = td->td_frame;
 	oonstack = sigonstack(regs->tf_esp);
 
@@ -550,126 +410,6 @@
  * MPSAFE
  */
 int
-osigreturn(td, uap)
-	struct thread *td;
-	struct osigreturn_args /* {
-		struct osigcontext *sigcntxp;
-	} */ *uap;
-{
-#ifdef COMPAT_43
-	struct osigcontext sc;
-	struct trapframe *regs;
-	struct osigcontext *scp;
-	struct proc *p = td->td_proc;
-	int eflags, error;
-
-	regs = td->td_frame;
-	error = copyin(uap->sigcntxp, &sc, sizeof(sc));
-	if (error != 0)
-		return (error);
-	scp = &sc;
-	eflags = scp->sc_ps;
-	if (eflags & PSL_VM) {
-		struct trapframe_vm86 *tf = (struct trapframe_vm86 *)regs;
-		struct vm86_kernel *vm86;
-
-		/*
-		 * if pcb_ext == 0 or vm86_inited == 0, the user hasn't
-		 * set up the vm86 area, and we can't enter vm86 mode.
-		 */
-		if (td->td_pcb->pcb_ext == 0)
-			return (EINVAL);
-		vm86 = &td->td_pcb->pcb_ext->ext_vm86;
-		if (vm86->vm86_inited == 0)
-			return (EINVAL);
-
-		/* Go back to user mode if both flags are set. */
-		if ((eflags & PSL_VIP) && (eflags & PSL_VIF))
-			trapsignal(p, SIGBUS, 0);
-
-		if (vm86->vm86_has_vme) {
-			eflags = (tf->tf_eflags & ~VME_USERCHANGE) |
-			    (eflags & VME_USERCHANGE) | PSL_VM;
-		} else {
-			vm86->vm86_eflags = eflags;	/* save VIF, VIP */
-			eflags = (tf->tf_eflags & ~VM_USERCHANGE) |
-			    (eflags & VM_USERCHANGE) | PSL_VM;
-		}
-		tf->tf_vm86_ds = scp->sc_ds;
-		tf->tf_vm86_es = scp->sc_es;
-		tf->tf_vm86_fs = scp->sc_fs;
-		tf->tf_vm86_gs = scp->sc_gs;
-		tf->tf_ds = _udatasel;
-		tf->tf_es = _udatasel;
-		tf->tf_fs = _udatasel;
-	} else {
-		/*
-		 * Don't allow users to change privileged or reserved flags.
-		 */
-		/*
-		 * XXX do allow users to change the privileged flag PSL_RF.
-		 * The cpu sets PSL_RF in tf_eflags for faults.  Debuggers
-		 * should sometimes set it there too.  tf_eflags is kept in
-		 * the signal context during signal handling and there is no
-		 * other place to remember it, so the PSL_RF bit may be
-		 * corrupted by the signal handler without us knowing.
-		 * Corruption of the PSL_RF bit at worst causes one more or
-		 * one less debugger trap, so allowing it is fairly harmless.
-		 */
-		if (!EFL_SECURE(eflags & ~PSL_RF, regs->tf_eflags & ~PSL_RF)) {
-	    		return (EINVAL);
-		}
-
-		/*
-		 * Don't allow users to load a valid privileged %cs.  Let the
-		 * hardware check for invalid selectors, excess privilege in
-		 * other selectors, invalid %eip's and invalid %esp's.
-		 */
-		if (!CS_SECURE(scp->sc_cs)) {
-			trapsignal(p, SIGBUS, T_PROTFLT);
-			return (EINVAL);
-		}
-		regs->tf_ds = scp->sc_ds;
-		regs->tf_es = scp->sc_es;
-		regs->tf_fs = scp->sc_fs;
-	}
-
-	/* Restore remaining registers. */
-	regs->tf_eax = scp->sc_eax;
-	regs->tf_ebx = scp->sc_ebx;
-	regs->tf_ecx = scp->sc_ecx;
-	regs->tf_edx = scp->sc_edx;
-	regs->tf_esi = scp->sc_esi;
-	regs->tf_edi = scp->sc_edi;
-	regs->tf_cs = scp->sc_cs;
-	regs->tf_ss = scp->sc_ss;
-	regs->tf_isp = scp->sc_isp;
-	regs->tf_ebp = scp->sc_fp;
-	regs->tf_esp = scp->sc_sp;
-	regs->tf_eip = scp->sc_pc;
-	regs->tf_eflags = eflags;
-
-	PROC_LOCK(p);
-#if defined(COMPAT_43) || defined(COMPAT_SUNOS)
-	if (scp->sc_onstack & 1)
-		p->p_sigstk.ss_flags |= SS_ONSTACK;
-	else
-		p->p_sigstk.ss_flags &= ~SS_ONSTACK;
-#endif
-	SIGSETOLD(p->p_sigmask, scp->sc_mask);
-	SIG_CANTMASK(p->p_sigmask);
-	signotify(p);
-	PROC_UNLOCK(p);
-	return (EJUSTRETURN);
-#else /* !COMPAT_43 */
-	return (ENOSYS);
-#endif /* COMPAT_43 */
-}
-
-/*
- * MPSAFE
- */
-int
 sigreturn(td, uap)
 	struct thread *td;
 	struct sigreturn_args /* {

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe p4-projects" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200209210212.g8L2CFSF086698>