-/* $OpenBSD: machdep.c,v 1.240 2014/12/10 15:29:53 mikeb Exp $ */
+/* $OpenBSD: machdep.c,v 1.241 2015/01/20 19:43:20 kettenis Exp $ */
/*
* Copyright (c) 1999-2003 Michael Shalayeff
tf->tf_iioq_head = pack->ep_entry | HPPA_PC_PRIV_USER;
tf->tf_iioq_tail = tf->tf_iioq_head + 4;
tf->tf_iisq_head = tf->tf_iisq_tail = pcb->pcb_space;
- tf->tf_arg0 = (u_long)PS_STRINGS;
+ tf->tf_arg0 = p->p_p->ps_strings;
/* setup terminal stack frame */
setstack(tf, (stack + 0x3f) & ~0x3f, 0);
-/* $OpenBSD: machdep.c,v 1.76 2014/12/10 15:29:53 mikeb Exp $ */
+/* $OpenBSD: machdep.c,v 1.77 2015/01/20 19:43:20 kettenis Exp $ */
/*
* Copyright (c) 2005 Michael Shalayeff
tf->tf_iioq[1] = 4 +
(tf->tf_iioq[0] = pack->ep_entry | HPPA_PC_PRIV_USER);
tf->tf_rp = 0;
- tf->tf_args[0] = (u_long)PS_STRINGS;
+ tf->tf_args[0] = p->p_p->ps_strings;
tf->tf_args[1] = tf->tf_args[2] = 0; /* XXX dynload stuff */
/* setup terminal stack frame */
-/* $OpenBSD: machdep.c,v 1.563 2015/01/19 16:01:44 jsg Exp $ */
+/* $OpenBSD: machdep.c,v 1.564 2015/01/20 19:43:21 kettenis Exp $ */
/* $NetBSD: machdep.c,v 1.214 1996/11/10 03:16:17 thorpej Exp $ */
/*-
tf->tf_edi = 0;
tf->tf_esi = 0;
tf->tf_ebp = 0;
- tf->tf_ebx = (int)PS_STRINGS;
+ tf->tf_ebx = (int)p->p_p->ps_strings;
tf->tf_edx = 0;
tf->tf_ecx = 0;
tf->tf_eax = 0;
-/* $OpenBSD: machdep.c,v 1.166 2015/01/20 18:34:00 mpi Exp $ */
+/* $OpenBSD: machdep.c,v 1.167 2015/01/20 19:43:21 kettenis Exp $ */
/* $NetBSD: machdep.c,v 1.4 1996/10/16 19:33:11 ws Exp $ */
/*
pargs = -roundup(-stack + 8, 16);
newstack = (u_int32_t)(pargs - 32);
- copyin ((void *)(VM_MAX_ADDRESS-0x10), &args, 0x10);
+ copyin ((void *)p->p_p->ps_strings, &args, 0x10);
bzero(tf, sizeof *tf);
tf->fixreg[1] = newstack;
-/* $OpenBSD: sh_machdep.c,v 1.37 2014/05/08 21:43:04 miod Exp $ */
+/* $OpenBSD: sh_machdep.c,v 1.38 2015/01/20 19:43:21 kettenis Exp $ */
/* $NetBSD: sh3_machdep.c,v 1.59 2006/03/04 01:13:36 uwe Exp $ */
/*
tf->tf_r6 = stack + 4 * tf->tf_r4 + 8; /* envp */
tf->tf_r7 = 0;
tf->tf_r8 = 0;
- tf->tf_r9 = (int)PS_STRINGS;
+ tf->tf_r9 = (int)p->p_p->ps_strings;
tf->tf_r10 = 0;
tf->tf_r11 = 0;
tf->tf_r12 = 0;
-/* $OpenBSD: trap.c,v 1.54 2014/11/16 12:30:59 deraadt Exp $ */
+/* $OpenBSD: trap.c,v 1.55 2015/01/20 19:43:21 kettenis Exp $ */
/* $NetBSD: trap.c,v 1.47 1999/08/21 19:26:20 matt Exp $ */
/*
* Copyright (c) 1994 Ludd, University of Lule}, Sweden.
exptr->r6 = stack; /* for ELF */
exptr->r7 = 0; /* for ELF */
exptr->r8 = 0; /* for ELF */
- exptr->r9 = (u_long) PS_STRINGS; /* for ELF */
+ exptr->r9 = p->p_p->ps_strings; /* for ELF */
retval[1] = 0;
}
-/* $OpenBSD: exec_elf.c,v 1.108 2014/12/22 15:05:24 kettenis Exp $ */
+/* $OpenBSD: exec_elf.c,v 1.109 2015/01/20 19:43:21 kettenis Exp $ */
/*
* Copyright (c) 1996 Per Fogelstrom
iov.iov_len = sizeof(pss);
uio.uio_iov = &iov;
uio.uio_iovcnt = 1;
- uio.uio_offset = (off_t)(vaddr_t)PS_STRINGS;
+ uio.uio_offset = (off_t)pr->ps_strings;
uio.uio_resid = sizeof(pss);
uio.uio_segflg = UIO_SYSSPACE;
uio.uio_rw = UIO_READ;
-/* $OpenBSD: kern_exec.c,v 1.155 2015/01/15 16:31:19 kettenis Exp $ */
+/* $OpenBSD: kern_exec.c,v 1.156 2015/01/20 19:43:21 kettenis Exp $ */
/* $NetBSD: kern_exec.c,v 1.75 1996/02/09 18:59:28 christos Exp $ */
/*-
goto exec_abort;
/* copy out the process's ps_strings structure */
- if (copyout(&arginfo, (char *)PS_STRINGS, sizeof(arginfo)))
+#ifdef MACHINE_STACK_GROWS_UP
+ pr->ps_strings = (vaddr_t)PS_STRINGS + sgap;
+#else
+ pr->ps_strings = (vaddr_t)PS_STRINGS - sgap;
+#endif
+ if (copyout(&arginfo, (char *)pr->ps_strings, sizeof(arginfo)))
goto exec_abort;
stopprofclock(pr); /* stop profiling */
-/* $OpenBSD: kern_sysctl.c,v 1.278 2015/01/13 10:07:58 mpf Exp $ */
+/* $OpenBSD: kern_sysctl.c,v 1.279 2015/01/20 19:43:21 kettenis Exp $ */
/* $NetBSD: kern_sysctl.c,v 1.17 1996/05/20 17:49:05 mrg Exp $ */
/*-
char **rargv, **vargv; /* reader vs. victim */
char *rarg, *varg, *buf;
struct vmspace *vm;
+ vaddr_t ps_strings;
if (namelen > 2)
return (ENOTDIR);
(error = suser(cp, 0)) != 0))
return (error);
+ ps_strings = vpr->ps_strings;
vm = vpr->ps_vmspace;
vm->vm_refcnt++;
vpr = NULL;
iov.iov_base = &pss;
iov.iov_len = sizeof(pss);
uio.uio_iov = &iov;
- uio.uio_iovcnt = 1;
- uio.uio_offset = (off_t)(vaddr_t)PS_STRINGS;
+ uio.uio_iovcnt = 1;
+ uio.uio_offset = (off_t)ps_strings;
uio.uio_resid = sizeof(pss);
uio.uio_segflg = UIO_SYSSPACE;
uio.uio_rw = UIO_READ;
-/* $OpenBSD: sys_process.c,v 1.66 2014/12/12 07:45:46 tedu Exp $ */
+/* $OpenBSD: sys_process.c,v 1.67 2015/01/20 19:43:21 kettenis Exp $ */
/* $NetBSD: sys_process.c,v 1.55 1996/05/15 06:17:47 tls Exp $ */
/*-
int
process_auxv_offset(struct proc *curp, struct proc *p, struct uio *uiop)
{
+ struct process *pr = p->p_p;
struct ps_strings pss;
struct iovec iov;
struct uio uio;
iov.iov_len = sizeof(pss);
uio.uio_iov = &iov;
uio.uio_iovcnt = 1;
- uio.uio_offset = (off_t)(vaddr_t)PS_STRINGS;
+ uio.uio_offset = (off_t)pr->ps_strings;
uio.uio_resid = sizeof(pss);
uio.uio_segflg = UIO_SYSSPACE;
uio.uio_rw = UIO_READ;
uiop->uio_offset += (off_t)(vaddr_t)(pss.ps_envstr + pss.ps_nenvstr + 1);
#ifdef MACHINE_STACK_GROWS_UP
- if (uiop->uio_offset < (off_t)(vaddr_t)PS_STRINGS)
+ if (uiop->uio_offset < (off_t)pr->ps_strings)
return (EIO);
#else
- if (uiop->uio_offset > (off_t)(vaddr_t)PS_STRINGS)
+ if (uiop->uio_offset > (off_t)pr->ps_strings)
return (EIO);
- if ((uiop->uio_offset + uiop->uio_resid) > (off_t)(vaddr_t)PS_STRINGS)
- uiop->uio_resid = (off_t)(vaddr_t)PS_STRINGS - uiop->uio_offset;
+ if ((uiop->uio_offset + uiop->uio_resid) > (off_t)pr->ps_strings)
+ uiop->uio_resid = (off_t)pr->ps_strings - uiop->uio_offset;
#endif
return (0);
-/* $OpenBSD: proc.h,v 1.192 2015/01/15 23:59:09 deraadt Exp $ */
+/* $OpenBSD: proc.h,v 1.193 2015/01/20 19:43:21 kettenis Exp $ */
/* $NetBSD: proc.h,v 1.44 1996/04/22 01:23:21 christos Exp $ */
/*-
struct plimit *ps_limit; /* Process limits. */
struct pgrp *ps_pgrp; /* Pointer to process group. */
struct emul *ps_emul; /* Emulation information */
+ vaddr_t ps_strings; /* User pointers to argv/env */
vaddr_t ps_sigcode; /* User pointer to the signal code */
u_int ps_rtableid; /* Process routing table/domain. */
char ps_nice; /* Process "nice" value. */
-/* $OpenBSD: uvm_meter.c,v 1.34 2014/07/11 16:35:40 jsg Exp $ */
+/* $OpenBSD: uvm_meter.c,v 1.35 2015/01/20 19:43:21 kettenis Exp $ */
/* $NetBSD: uvm_meter.c,v 1.21 2001/07/14 06:36:03 matt Exp $ */
/*
uvm_sysctl(int *name, u_int namelen, void *oldp, size_t *oldlenp, void *newp,
size_t newlen, struct proc *p)
{
+ struct process *pr = p->p_p;
struct vmtotal vmtotals;
int rv, t;
- struct _ps_strings _ps = { PS_STRINGS };
switch (name[0]) {
case VM_SWAPENCRYPT:
return (sysctl_rdint(oldp, oldlenp, newp, nkmempages));
case VM_PSSTRINGS:
- return (sysctl_rdstruct(oldp, oldlenp, newp, &_ps,
- sizeof(_ps)));
+ return (sysctl_rdstruct(oldp, oldlenp, newp, &pr->ps_strings,
+ sizeof(pr->ps_strings)));
+
case VM_ANONMIN:
t = uvmexp.anonminpct;
rv = sysctl_int(oldp, oldlenp, newp, newlen, &t);