Index: arm/arm/machdep.c =================================================================== --- arm/arm/machdep.c (revision 205571) +++ arm/arm/machdep.c (working copy) @@ -516,15 +516,15 @@ * Clear registers on exec */ void -exec_setregs(struct thread *td, u_long entry, u_long stack, u_long ps_strings) +exec_setregs(struct thread *td, struct image_params *imgp, u_long stack) { struct trapframe *tf = td->td_frame; memset(tf, 0, sizeof(*tf)); tf->tf_usr_sp = stack; - tf->tf_usr_lr = entry; + tf->tf_usr_lr = imgp->entry_addr; tf->tf_svc_lr = 0x77777777; - tf->tf_pc = entry; + tf->tf_pc = imgp->entry_addr; tf->tf_spsr = PSR_USR32_MODE; } Index: powerpc/booke/machdep.c =================================================================== --- powerpc/booke/machdep.c (revision 205571) +++ powerpc/booke/machdep.c (working copy) @@ -509,7 +509,7 @@ /* Set set up registers on exec. */ void -exec_setregs(struct thread *td, u_long entry, u_long stack, u_long ps_strings) +exec_setregs(struct thread *td, struct image_params *imgp, u_long stack) { struct trapframe *tf; struct ps_strings arginfo; @@ -553,7 +553,7 @@ tf->fixreg[7] = 0; /* termination vector */ tf->fixreg[8] = (register_t)PS_STRINGS; /* NetBSD extension */ - tf->srr0 = entry; + tf->srr0 = imgp->entry_addr; tf->srr1 = PSL_USERSET; td->td_pcb->pcb_flags = 0; } Index: powerpc/aim/machdep.c =================================================================== --- powerpc/aim/machdep.c (revision 205571) +++ powerpc/aim/machdep.c (working copy) @@ -951,7 +951,7 @@ * Set set up registers on exec. */ void -exec_setregs(struct thread *td, u_long entry, u_long stack, u_long ps_strings) +exec_setregs(struct thread *td, struct image_params *imgp, u_long stack) { struct trapframe *tf; struct ps_strings arginfo; @@ -995,7 +995,7 @@ tf->fixreg[7] = 0; /* termination vector */ tf->fixreg[8] = (register_t)PS_STRINGS; /* NetBSD extension */ - tf->srr0 = entry; + tf->srr0 = imgp->entry_addr; tf->srr1 = PSL_MBO | PSL_USERSET | PSL_FE_DFLT; td->td_pcb->pcb_flags = 0; } Index: sparc64/sparc64/machdep.c =================================================================== --- sparc64/sparc64/machdep.c (revision 205571) +++ sparc64/sparc64/machdep.c (working copy) @@ -969,7 +969,7 @@ } void -exec_setregs(struct thread *td, u_long entry, u_long stack, u_long ps_strings) +exec_setregs(struct thread *td, struct image_params *imgp, u_long stack) { struct trapframe *tf; struct pcb *pcb; @@ -992,8 +992,8 @@ tf->tf_out[0] = stack; tf->tf_out[3] = p->p_sysent->sv_psstrings; tf->tf_out[6] = sp - SPOFF - sizeof(struct frame); - tf->tf_tnpc = entry + 4; - tf->tf_tpc = entry; + tf->tf_tnpc = imgp->entry_addr + 4; + tf->tf_tpc = imgp->entry_addr; tf->tf_tstate = TSTATE_IE | TSTATE_PEF | TSTATE_MM_TSO; td->td_retval[0] = tf->tf_out[0]; Index: kern/kern_exec.c =================================================================== --- kern/kern_exec.c (revision 205574) +++ kern/kern_exec.c (working copy) @@ -799,11 +799,10 @@ /* Set values passed into the program in registers. */ if (p->p_sysent->sv_setregs) - (*p->p_sysent->sv_setregs)(td, imgp->entry_addr, - (u_long)(uintptr_t)stack_base, imgp->ps_strings); + (*p->p_sysent->sv_setregs)(td, imgp, + (u_long)(uintptr_t)stack_base); else - exec_setregs(td, imgp->entry_addr, - (u_long)(uintptr_t)stack_base, imgp->ps_strings); + exec_setregs(td, imgp, (u_long)(uintptr_t)stack_base); vfs_mark_atime(imgp->vp, td->td_ucred); Index: ia64/ia64/machdep.c =================================================================== --- ia64/ia64/machdep.c (revision 205571) +++ ia64/ia64/machdep.c (working copy) @@ -1328,7 +1328,7 @@ * Clear registers on exec. */ void -exec_setregs(struct thread *td, u_long entry, u_long stack, u_long ps_strings) +exec_setregs(struct thread *td, struct image_params *imgp, u_long stack) { struct trapframe *tf; uint64_t *ksttop, *kst; @@ -1366,7 +1366,7 @@ *kst-- = 0; if (((uintptr_t)kst & 0x1ff) == 0x1f8) *kst-- = 0; - *kst-- = ps_strings; + *kst-- = imgp->ps_strings; if (((uintptr_t)kst & 0x1ff) == 0x1f8) *kst-- = 0; *kst = stack; @@ -1385,7 +1385,7 @@ suword((caddr_t)tf->tf_special.bspstore - 8, 0); } - tf->tf_special.iip = entry; + tf->tf_special.iip = imgp->entry_addr; tf->tf_special.sp = (stack & ~15) - 16; tf->tf_special.rsc = 0xf; tf->tf_special.fpsr = IA64_FPSR_DEFAULT; Index: ia64/ia32/ia32_signal.c =================================================================== --- ia64/ia32/ia32_signal.c (revision 205571) +++ ia64/ia32/ia32_signal.c (working copy) @@ -120,7 +120,7 @@ void -ia32_setregs(struct thread *td, u_long entry, u_long stack, u_long ps_strings) +ia32_setregs(struct thread *td, struct image_params *imgp, u_long stack) { struct trapframe *tf = td->td_frame; vm_offset_t gdt, ldt; @@ -129,7 +129,7 @@ struct segment_descriptor desc; struct vmspace *vmspace = td->td_proc->p_vmspace; - exec_setregs(td, entry, stack, ps_strings); + exec_setregs(td, imgp, stack); /* Non-syscall frames are cleared by exec_setregs() */ if (tf->tf_flags & FRAME_SYSCALL) { Index: mips/mips/pm_machdep.c =================================================================== --- mips/mips/pm_machdep.c (revision 205571) +++ mips/mips/pm_machdep.c (working copy) @@ -472,7 +472,7 @@ * code by the MIPS elf abi). */ void -exec_setregs(struct thread *td, u_long entry, u_long stack, u_long ps_strings) +exec_setregs(struct thread *td, struct image_params *imgp, u_long stack) { bzero((caddr_t)td->td_frame, sizeof(struct trapframe)); @@ -481,8 +481,8 @@ * Make sp 64-bit aligned. */ td->td_frame->sp = ((register_t) stack) & ~(sizeof(__int64_t) - 1); - td->td_frame->pc = entry & ~3; - td->td_frame->t9 = entry & ~3; /* abicall req */ + td->td_frame->pc = imgp->entry_addr & ~3; + td->td_frame->t9 = imgp->entry_addr & ~3; /* abicall req */ #if 0 // td->td_frame->sr = SR_KSU_USER | SR_EXL | SR_INT_ENAB; //? td->td_frame->sr |= idle_mask & ALL_INT_MASK; @@ -511,7 +511,7 @@ td->td_frame->a0 = (register_t) stack; td->td_frame->a1 = 0; td->td_frame->a2 = 0; - td->td_frame->a3 = (register_t)ps_strings; + td->td_frame->a3 = (register_t)imgp->ps_strings; td->td_md.md_flags &= ~MDTD_FPUSED; if (PCPU_GET(fpcurthread) == td) Index: sun4v/sun4v/machdep.c =================================================================== --- sun4v/sun4v/machdep.c (revision 205571) +++ sun4v/sun4v/machdep.c (working copy) @@ -869,7 +869,7 @@ } void -exec_setregs(struct thread *td, u_long entry, u_long stack, u_long ps_strings) +exec_setregs(struct thread *td, struct image_params *imgp, u_long stack) { struct trapframe *tf; struct pcb *pcb; @@ -897,8 +897,8 @@ tf->tf_out[3] = p->p_sysent->sv_psstrings; tf->tf_out[6] = sp - SPOFF - sizeof(struct frame); - tf->tf_tnpc = entry + 4; - tf->tf_tpc = entry; + tf->tf_tnpc = imgp->entry_addr + 4; + tf->tf_tpc = imgp->entry_addr; tf->tf_tstate = TSTATE_IE | TSTATE_PEF | TSTATE_MM_TSO; td->td_retval[0] = tf->tf_out[0]; Index: compat/ia32/ia32_signal.h =================================================================== --- compat/ia32/ia32_signal.h (revision 205571) +++ compat/ia32/ia32_signal.h (working copy) @@ -185,5 +185,5 @@ extern int sz_ia32_sigcode; extern int sz_freebsd4_ia32_sigcode; extern void ia32_sendsig(sig_t, struct ksiginfo *, sigset_t *); -extern void ia32_setregs(struct thread *td, u_long entry, u_long stack, - u_long ps_strings); +extern void ia32_setregs(struct thread *td, struct image_params *imgp, + u_long stack); Index: pc98/pc98/machdep.c =================================================================== --- pc98/pc98/machdep.c (revision 205571) +++ pc98/pc98/machdep.c (working copy) @@ -1172,11 +1172,7 @@ * Reset registers to default values on exec. */ void -exec_setregs(td, entry, stack, ps_strings) - struct thread *td; - u_long entry; - u_long stack; - u_long ps_strings; +exec_setregs(struct thread *td, struct image_params *imgp, u_long stack) { struct trapframe *regs = td->td_frame; struct pcb *pcb = td->td_pcb; @@ -1192,7 +1188,7 @@ mtx_unlock_spin(&dt_lock); bzero((char *)regs, sizeof(struct trapframe)); - regs->tf_eip = entry; + regs->tf_eip = imgp->entry_addr; regs->tf_esp = stack; regs->tf_eflags = PSL_USER | (regs->tf_eflags & PSL_T); regs->tf_ss = _udatasel; @@ -1202,7 +1198,7 @@ regs->tf_cs = _ucodesel; /* PS_STRINGS value for BSD/OS binaries. It is 0 for non-BSD/OS. */ - regs->tf_ebx = ps_strings; + regs->tf_ebx = imgp->ps_strings; /* * Reset the hardware debug registers if they were in use. Index: i386/linux/linux_sysvec.c =================================================================== --- i386/linux/linux_sysvec.c (revision 205571) +++ i386/linux/linux_sysvec.c (working copy) @@ -105,8 +105,8 @@ static void linux_prepsyscall(struct trapframe *tf, int *args, u_int *code, caddr_t *params); static void linux_sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t *mask); -static void exec_linux_setregs(struct thread *td, u_long entry, - u_long stack, u_long ps_strings); +static void exec_linux_setregs(struct thread *td, + struct image_params *imgp, u_long stack); static register_t *linux_copyout_strings(struct image_params *imgp); static boolean_t linux_trans_osrel(const Elf_Note *note, int32_t *osrel); @@ -927,12 +927,11 @@ * override the exec_setregs default(s) here. */ static void -exec_linux_setregs(struct thread *td, u_long entry, - u_long stack, u_long ps_strings) +exec_linux_setregs(struct thread *td, struct image_params *imgp, u_long stack) { struct pcb *pcb = td->td_pcb; - exec_setregs(td, entry, stack, ps_strings); + exec_setregs(td, imgp, stack); /* Linux sets %gs to 0, we default to _udatasel */ pcb->pcb_gs = 0; Index: i386/i386/machdep.c =================================================================== --- i386/i386/machdep.c (revision 205571) +++ i386/i386/machdep.c (working copy) @@ -1461,11 +1461,7 @@ * Reset registers to default values on exec. */ void -exec_setregs(td, entry, stack, ps_strings) - struct thread *td; - u_long entry; - u_long stack; - u_long ps_strings; +exec_setregs(struct thread *td, struct image_params *imgp, u_long stack) { struct trapframe *regs = td->td_frame; struct pcb *pcb = td->td_pcb; @@ -1481,7 +1477,7 @@ mtx_unlock_spin(&dt_lock); bzero((char *)regs, sizeof(struct trapframe)); - regs->tf_eip = entry; + regs->tf_eip = imgp->entry_addr; regs->tf_esp = stack; regs->tf_eflags = PSL_USER | (regs->tf_eflags & PSL_T); regs->tf_ss = _udatasel; @@ -1491,7 +1487,7 @@ regs->tf_cs = _ucodesel; /* PS_STRINGS value for BSD/OS binaries. It is 0 for non-BSD/OS. */ - regs->tf_ebx = ps_strings; + regs->tf_ebx = imgp->ps_strings; /* * Reset the hardware debug registers if they were in use. Index: amd64/linux32/linux32_sysvec.c =================================================================== --- amd64/linux32/linux32_sysvec.c (revision 205571) +++ amd64/linux32/linux32_sysvec.c (working copy) @@ -124,8 +124,8 @@ static void linux_prepsyscall(struct trapframe *tf, int *args, u_int *code, caddr_t *params); static void linux_sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t *mask); -static void exec_linux_setregs(struct thread *td, u_long entry, - u_long stack, u_long ps_strings); +static void exec_linux_setregs(struct thread *td, + struct image_params *imgp, u_long stack); static void linux32_fixlimit(struct rlimit *rl, int which); static boolean_t linux32_trans_osrel(const Elf_Note *note, int32_t *osrel); @@ -828,11 +828,7 @@ * XXX copied from ia32_signal.c. */ static void -exec_linux_setregs(td, entry, stack, ps_strings) - struct thread *td; - u_long entry; - u_long stack; - u_long ps_strings; +exec_linux_setregs(struct thread *td, struct image_params *imgp, u_long stack) { struct trapframe *regs = td->td_frame; struct pcb *pcb = td->td_pcb; @@ -852,7 +848,7 @@ pcb->pcb_initial_fpucw = __LINUX_NPXCW__; bzero((char *)regs, sizeof(struct trapframe)); - regs->tf_rip = entry; + regs->tf_rip = imgp->entry_addr; regs->tf_rsp = stack; regs->tf_rflags = PSL_USER | (regs->tf_rflags & PSL_T); regs->tf_gs = _ugssel; @@ -862,7 +858,7 @@ regs->tf_ss = _udatasel; regs->tf_flags = TF_HASSEGS; regs->tf_cs = _ucode32sel; - regs->tf_rbx = ps_strings; + regs->tf_rbx = imgp->ps_strings; td->td_pcb->pcb_full_iret = 1; load_cr0(rcr0() | CR0_MP | CR0_TS); fpstate_drop(td); Index: amd64/amd64/machdep.c =================================================================== --- amd64/amd64/machdep.c (revision 205571) +++ amd64/amd64/machdep.c (working copy) @@ -841,11 +841,7 @@ * Reset registers to default values on exec. */ void -exec_setregs(td, entry, stack, ps_strings) - struct thread *td; - u_long entry; - u_long stack; - u_long ps_strings; +exec_setregs(struct thread *td, struct image_params *imgp, u_long stack) { struct trapframe *regs = td->td_frame; struct pcb *pcb = td->td_pcb; @@ -863,7 +859,7 @@ pcb->pcb_full_iret = 1; bzero((char *)regs, sizeof(struct trapframe)); - regs->tf_rip = entry; + regs->tf_rip = imgp->entry_addr; regs->tf_rsp = ((stack - 8) & ~0xFul) + 8; regs->tf_rdi = stack; /* argv */ regs->tf_rflags = PSL_USER | (regs->tf_rflags & PSL_T); Index: amd64/ia32/ia32_signal.c =================================================================== --- amd64/ia32/ia32_signal.c (revision 205571) +++ amd64/ia32/ia32_signal.c (working copy) @@ -701,11 +701,7 @@ * Clear registers on exec */ void -ia32_setregs(td, entry, stack, ps_strings) - struct thread *td; - u_long entry; - u_long stack; - u_long ps_strings; +ia32_setregs(struct thread *td, struct image_params *imgp, u_long stack) { struct trapframe *regs = td->td_frame; struct pcb *pcb = td->td_pcb; @@ -721,12 +717,12 @@ pcb->pcb_initial_fpucw = __INITIAL_FPUCW_I386__; bzero((char *)regs, sizeof(struct trapframe)); - regs->tf_rip = entry; + regs->tf_rip = imgp->entry_addr; regs->tf_rsp = stack; regs->tf_rflags = PSL_USER | (regs->tf_rflags & PSL_T); regs->tf_ss = _udatasel; regs->tf_cs = _ucode32sel; - regs->tf_rbx = ps_strings; + regs->tf_rbx = imgp->ps_strings; regs->tf_ds = _udatasel; regs->tf_es = _udatasel; regs->tf_fs = _ufssel; Index: sys/sysent.h =================================================================== --- sys/sysent.h (revision 205571) +++ sys/sysent.h (working copy) @@ -98,7 +98,8 @@ vm_offset_t sv_psstrings; /* PS_STRINGS */ int sv_stackprot; /* vm protection for stack */ register_t *(*sv_copyout_strings)(struct image_params *); - void (*sv_setregs)(struct thread *, u_long, u_long, u_long); + void (*sv_setregs)(struct thread *, struct image_params *, + u_long); void (*sv_fixlimit)(struct rlimit *, int); u_long *sv_maxssiz; u_int sv_flags; Index: sys/imgact.h =================================================================== --- sys/imgact.h (revision 205571) +++ sys/imgact.h (working copy) @@ -80,7 +80,7 @@ int exec_check_permissions(struct image_params *); register_t *exec_copyout_strings(struct image_params *); int exec_new_vmspace(struct image_params *, struct sysentvec *); -void exec_setregs(struct thread *, u_long, u_long, u_long); +void exec_setregs(struct thread *, struct image_params *, u_long); int exec_shell_imgact(struct image_params *); int exec_copyin_args(struct image_args *, char *, enum uio_seg, char **, char **);