summaryrefslogtreecommitdiffstats
path: root/sys/amd64
diff options
context:
space:
mode:
authornwhitehorn <nwhitehorn@FreeBSD.org>2010-03-25 14:24:00 +0000
committernwhitehorn <nwhitehorn@FreeBSD.org>2010-03-25 14:24:00 +0000
commitd63c82a6ac162cf5ffe6c7e960eadbfd6cfeff71 (patch)
tree1b94b19913504191437503d3847784285efcec5f /sys/amd64
parentb60f1f5349665e80134bc9f0afab88b52539ab40 (diff)
downloadFreeBSD-src-d63c82a6ac162cf5ffe6c7e960eadbfd6cfeff71.zip
FreeBSD-src-d63c82a6ac162cf5ffe6c7e960eadbfd6cfeff71.tar.gz
Change the arguments of exec_setregs() so that it receives a pointer
to the image_params struct instead of several members of that struct individually. This makes it easier to expand its arguments in the future without touching all platforms. Reviewed by: jhb
Diffstat (limited to 'sys/amd64')
-rw-r--r--sys/amd64/amd64/machdep.c8
-rw-r--r--sys/amd64/ia32/ia32_signal.c10
-rw-r--r--sys/amd64/linux32/linux32_sysvec.c14
3 files changed, 10 insertions, 22 deletions
diff --git a/sys/amd64/amd64/machdep.c b/sys/amd64/amd64/machdep.c
index 2318975..1155eaa 100644
--- a/sys/amd64/amd64/machdep.c
+++ b/sys/amd64/amd64/machdep.c
@@ -841,11 +841,7 @@ SYSCTL_PROC(_machdep, OID_AUTO, idle, CTLTYPE_STRING | CTLFLAG_RW, 0, 0,
* 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 @@ exec_setregs(td, entry, stack, ps_strings)
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);
diff --git a/sys/amd64/ia32/ia32_signal.c b/sys/amd64/ia32/ia32_signal.c
index 10ec641..a4293c8 100644
--- a/sys/amd64/ia32/ia32_signal.c
+++ b/sys/amd64/ia32/ia32_signal.c
@@ -701,11 +701,7 @@ freebsd32_sigreturn(td, uap)
* 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 @@ ia32_setregs(td, entry, stack, ps_strings)
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;
diff --git a/sys/amd64/linux32/linux32_sysvec.c b/sys/amd64/linux32/linux32_sysvec.c
index d967ad7..06f1e97 100644
--- a/sys/amd64/linux32/linux32_sysvec.c
+++ b/sys/amd64/linux32/linux32_sysvec.c
@@ -124,8 +124,8 @@ static register_t *linux_copyout_strings(struct image_params *imgp);
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 @@ exec_linux_imgact_try(struct image_params *imgp)
* 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 @@ exec_linux_setregs(td, entry, stack, ps_strings)
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 @@ exec_linux_setregs(td, entry, stack, ps_strings)
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);
OpenPOWER on IntegriCloud