From 87c550209612d49384b0a8f1177ea278fc14bbc7 Mon Sep 17 00:00:00 2001 From: Philip Guenther Date: Wed, 26 Mar 2014 05:23:43 +0000 Subject: Move p_emul and p_sigcode from proc to process. Tweak the handling of ktrace EMUL when changing ktracing: only generate one per process (not one per thread) and pass the correct proc pointer down to the VFS layer. Permit generating of NAMI and CSW records inside ktrace(2) itself. ok deraadt@ millert@ --- sys/arch/i386/i386/linux_machdep.c | 10 +++++----- sys/arch/i386/i386/machdep.c | 4 ++-- sys/arch/i386/i386/trap.c | 16 ++++++++-------- 3 files changed, 15 insertions(+), 15 deletions(-) (limited to 'sys/arch/i386') diff --git a/sys/arch/i386/i386/linux_machdep.c b/sys/arch/i386/i386/linux_machdep.c index ffa82f656f4..81d4081d6f0 100644 --- a/sys/arch/i386/i386/linux_machdep.c +++ b/sys/arch/i386/i386/linux_machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: linux_machdep.c,v 1.44 2014/03/22 06:05:45 guenther Exp $ */ +/* $OpenBSD: linux_machdep.c,v 1.45 2014/03/26 05:23:42 guenther Exp $ */ /* $NetBSD: linux_machdep.c,v 1.29 1996/05/03 19:42:11 christos Exp $ */ /* @@ -179,7 +179,7 @@ linux_sendsig(sig_t catcher, int sig, int mask, u_long code, int type, */ tf->tf_es = GSEL(GUDATA_SEL, SEL_UPL); tf->tf_ds = GSEL(GUDATA_SEL, SEL_UPL); - tf->tf_eip = p->p_sigcode; + tf->tf_eip = p->p_p->ps_sigcode; tf->tf_cs = GSEL(GUCODE_SEL, SEL_UPL); tf->tf_eflags &= ~(PSL_T|PSL_D|PSL_VM|PSL_AC); tf->tf_esp = (int)fp; @@ -283,7 +283,7 @@ linux_read_ldt(struct proc *p, struct linux_sys_modify_ldt_args *uap, if (user_ldt_enable == 0) return (ENOSYS); - sg = stackgap_init(p->p_emul); + sg = stackgap_init(p); gl.start = 0; gl.desc = SCARG(uap, ptr); @@ -333,7 +333,7 @@ linux_write_ldt(struct proc *p, struct linux_sys_modify_ldt_args *uap, if (ldt_info.contents == 3) return (EINVAL); - sg = stackgap_init(p->p_emul); + sg = stackgap_init(p); sd.sd_lobase = ldt_info.base_addr & 0xffffff; sd.sd_hibase = (ldt_info.base_addr >> 24) & 0xff; @@ -529,7 +529,7 @@ linux_machdepioctl(struct proc *p, void *v, register_t *retval) return error; lvt.frsig = sig; - sg = stackgap_init(p->p_emul); + sg = stackgap_init(p); bvtp = stackgap_alloc(&sg, sizeof (struct vt_mode)); if ((error = copyout(&lvt, bvtp, sizeof (struct vt_mode)))) return error; diff --git a/sys/arch/i386/i386/machdep.c b/sys/arch/i386/i386/machdep.c index 26c177d02f9..fca0ad8b2b0 100644 --- a/sys/arch/i386/i386/machdep.c +++ b/sys/arch/i386/i386/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.534 2014/03/22 06:05:45 guenther Exp $ */ +/* $OpenBSD: machdep.c,v 1.535 2014/03/26 05:23:42 guenther Exp $ */ /* $NetBSD: machdep.c,v 1.214 1996/11/10 03:16:17 thorpej Exp $ */ /*- @@ -2401,7 +2401,7 @@ sendsig(sig_t catcher, int sig, int mask, u_long code, int type, tf->tf_gs = GSEL(GUGS_SEL, SEL_UPL); tf->tf_es = GSEL(GUDATA_SEL, SEL_UPL); tf->tf_ds = GSEL(GUDATA_SEL, SEL_UPL); - tf->tf_eip = p->p_sigcode; + tf->tf_eip = p->p_p->ps_sigcode; tf->tf_cs = GSEL(GUCODE_SEL, SEL_UPL); tf->tf_eflags &= ~(PSL_T|PSL_D|PSL_VM|PSL_AC); tf->tf_esp = (int)fp; diff --git a/sys/arch/i386/i386/trap.c b/sys/arch/i386/i386/trap.c index 73f4d190ebd..216d16656fa 100644 --- a/sys/arch/i386/i386/trap.c +++ b/sys/arch/i386/i386/trap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: trap.c,v 1.112 2014/03/07 07:47:14 gerhard Exp $ */ +/* $OpenBSD: trap.c,v 1.113 2014/03/26 05:23:42 guenther Exp $ */ /* $NetBSD: trap.c,v 1.95 1996/05/05 06:50:02 mycroft Exp $ */ /*- @@ -562,8 +562,8 @@ syscall(struct trapframe *frame) opc = frame->tf_eip; code = frame->tf_eax; - nsys = p->p_emul->e_nsysent; - callp = p->p_emul->e_sysent; + nsys = p->p_p->ps_emul->e_nsysent; + callp = p->p_p->ps_emul->e_sysent; params = (caddr_t)frame->tf_esp + sizeof(int); @@ -582,7 +582,7 @@ syscall(struct trapframe *frame) case SYS_syscall: #ifdef COMPAT_LINUX /* Linux has a special system setup call as number 0 */ - if (p->p_emul == &emul_linux_elf) + if (p->p_p->ps_emul == &emul_linux_elf) break; #endif /* @@ -605,13 +605,13 @@ syscall(struct trapframe *frame) break; } if (code < 0 || code >= nsys) - callp += p->p_emul->e_nosys; /* illegal */ + callp += p->p_p->ps_emul->e_nosys; /* illegal */ else callp += code; argsize = callp->sy_argsize; #ifdef COMPAT_LINUX /* XXX extra if() for every emul type.. */ - if (p->p_emul == &emul_linux_elf) { + if (p->p_p->ps_emul == &emul_linux_elf) { /* * Linux passes the args in ebx, ecx, edx, esi, edi, ebp, in * increasing order. @@ -666,8 +666,8 @@ syscall(struct trapframe *frame) break; default: bad: - if (p->p_emul->e_errno && error >= 0 && error <= ELAST) - frame->tf_eax = p->p_emul->e_errno[error]; + if (p->p_p->ps_emul->e_errno && error >= 0 && error <= ELAST) + frame->tf_eax = p->p_p->ps_emul->e_errno[error]; else frame->tf_eax = error; frame->tf_eflags |= PSL_C; /* carry bit */ -- cgit v1.2.3