Module Name: src
Committed By: matt
Date: Mon Feb 1 04:19:29 UTC 2010
Modified Files:
src/sys/compat/irix [matt-nb5-mips64]: irix_exec.c irix_prctl.c
irix_signal.c
Log Message:
fix fallout from frame/trapframe merger.
To generate a diff of this commit:
cvs rdiff -u -r1.52.14.2 -r1.52.14.3 src/sys/compat/irix/irix_exec.c
cvs rdiff -u -r1.48.14.1 -r1.48.14.2 src/sys/compat/irix/irix_prctl.c
cvs rdiff -u -r1.48.18.2 -r1.48.18.3 src/sys/compat/irix/irix_signal.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/compat/irix/irix_exec.c
diff -u src/sys/compat/irix/irix_exec.c:1.52.14.2 src/sys/compat/irix/irix_exec.c:1.52.14.3
--- src/sys/compat/irix/irix_exec.c:1.52.14.2 Thu Sep 10 01:52:34 2009
+++ src/sys/compat/irix/irix_exec.c Mon Feb 1 04:19:29 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: irix_exec.c,v 1.52.14.2 2009/09/10 01:52:34 matt Exp $ */
+/* $NetBSD: irix_exec.c,v 1.52.14.3 2010/02/01 04:19:29 matt Exp $ */
/*-
* Copyright (c) 2001-2002 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: irix_exec.c,v 1.52.14.2 2009/09/10 01:52:34 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: irix_exec.c,v 1.52.14.3 2010/02/01 04:19:29 matt Exp $");
#ifdef _KERNEL_OPT
#include "opt_syscall_debug.h"
@@ -124,12 +124,12 @@
void
irix_n32_setregs(struct lwp *l, struct exec_package *pack, vaddr_t stack)
{
- struct frame *f = l->l_md.md_regs;
+ struct trapframe *tf = l->l_md.md_utf;
/* Enable 64 bit instructions (eg: sd) */
- f->f_regs[_R_SR] |= MIPS3_SR_UX | MIPS3_SR_FR;
+ tf->tf_regs[_R_SR] |= MIPS3_SR_UX | MIPS3_SR_FR;
#ifdef _LP64
- f->f_regs[_R_SR] |= MIPS3_SR_KX;
+ tf->tf_regs[_R_SR] |= MIPS3_SR_KX;
#endif
}
Index: src/sys/compat/irix/irix_prctl.c
diff -u src/sys/compat/irix/irix_prctl.c:1.48.14.1 src/sys/compat/irix/irix_prctl.c:1.48.14.2
--- src/sys/compat/irix/irix_prctl.c:1.48.14.1 Thu Sep 10 01:52:34 2009
+++ src/sys/compat/irix/irix_prctl.c Mon Feb 1 04:19:29 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: irix_prctl.c,v 1.48.14.1 2009/09/10 01:52:34 matt Exp $ */
+/* $NetBSD: irix_prctl.c,v 1.48.14.2 2010/02/01 04:19:29 matt Exp $ */
/*-
* Copyright (c) 2001-2002 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: irix_prctl.c,v 1.48.14.1 2009/09/10 01:52:34 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: irix_prctl.c,v 1.48.14.2 2010/02/01 04:19:29 matt Exp $");
#include <sys/errno.h>
#include <sys/types.h>
@@ -392,8 +392,8 @@
int inh = isc->isc_inh;
struct lwp *lparent = isc->isc_parent_lwp;
struct proc *parent = lparent->l_proc;
- struct frame *tf = (struct frame *)l2->l_md.md_regs;
- struct frame *ptf = (struct frame *)lparent->l_md.md_regs;
+ struct trapframe *tf = l2->l_md.md_utf;
+ struct trapframe *ptf = lparent->l_md.md_utf;
kauth_cred_t pc;
struct irix_emuldata *ied;
struct irix_emuldata *parent_ied;
@@ -469,21 +469,21 @@
/*
* Setup PC to return to the child entry point
*/
- tf->f_regs[_R_PC] = (unsigned long)isc->isc_entry;
- tf->f_regs[_R_RA] = 0;
+ tf->tf_regs[_R_PC] = (unsigned long)isc->isc_entry;
+ tf->tf_regs[_R_RA] = 0;
/*
* Setup child arguments
*/
- tf->f_regs[_R_A0] = (unsigned long)isc->isc_arg;
- tf->f_regs[_R_A1] = 0;
- tf->f_regs[_R_A2] = 0;
- tf->f_regs[_R_A3] = 0;
- if (ptf->f_regs[_R_S3] == (unsigned long)isc->isc_len) {
- tf->f_regs[_R_S0] = ptf->f_regs[_R_S0];
- tf->f_regs[_R_S1] = ptf->f_regs[_R_S1];
- tf->f_regs[_R_S2] = ptf->f_regs[_R_S2];
- tf->f_regs[_R_S3] = ptf->f_regs[_R_S3];
+ tf->tf_regs[_R_A0] = (unsigned long)isc->isc_arg;
+ tf->tf_regs[_R_A1] = 0;
+ tf->tf_regs[_R_A2] = 0;
+ tf->tf_regs[_R_A3] = 0;
+ if (ptf->tf_regs[_R_S3] == (unsigned long)isc->isc_len) {
+ tf->tf_regs[_R_S0] = ptf->tf_regs[_R_S0];
+ tf->tf_regs[_R_S1] = ptf->tf_regs[_R_S1];
+ tf->tf_regs[_R_S2] = ptf->tf_regs[_R_S2];
+ tf->tf_regs[_R_S3] = ptf->tf_regs[_R_S3];
}
/*
Index: src/sys/compat/irix/irix_signal.c
diff -u src/sys/compat/irix/irix_signal.c:1.48.18.2 src/sys/compat/irix/irix_signal.c:1.48.18.3
--- src/sys/compat/irix/irix_signal.c:1.48.18.2 Thu Sep 10 01:52:34 2009
+++ src/sys/compat/irix/irix_signal.c Mon Feb 1 04:19:29 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: irix_signal.c,v 1.48.18.2 2009/09/10 01:52:34 matt Exp $ */
+/* $NetBSD: irix_signal.c,v 1.48.18.3 2010/02/01 04:19:29 matt Exp $ */
/*-
* Copyright (c) 1994, 2001-2002 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: irix_signal.c,v 1.48.18.2 2009/09/10 01:52:34 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: irix_signal.c,v 1.48.18.3 2010/02/01 04:19:29 matt Exp $");
#include <sys/types.h>
#include <sys/signal.h>
@@ -245,7 +245,7 @@
struct lwp *l = curlwp;
struct proc *p = l->l_proc;
void *sp;
- struct frame *f = l->l_md.md_regs;
+ struct trapframe *tf = l->l_md.md_utf;
int onstack;
int error;
sig_t catcher = SIGACTION(p, ksi->ksi_signo).sa_handler;
@@ -257,7 +257,7 @@
(void *)catcher, ksi->ksi_signo, ksi->ksi_trap);
printf("irix_sendsig(): starting [PC=0x%#"PRIxREGISTER
" SP=%#"PRIxREGISTER" SR=0x%08lx]\n",
- f->f_regs[_R_PC], f->f_regs[_R_SP], f->f_regs[_R_SR]);
+ tf->tf_regs[_R_PC], tf->tf_regs[_R_SP], tf->tf_regs[_R_SR]);
#endif /* DEBUG_IRIX */
/*
@@ -278,7 +278,7 @@
+ l->l_sigstk.ss_size);
else
/* cast for O64 case */
- sp = (void *)(intptr_t)f->f_regs[_R_SP];
+ sp = (void *)(intptr_t)tf->tf_regs[_R_SP];
/*
* Build the signal frame
@@ -287,7 +287,7 @@
if (SIGACTION(p, ksi->ksi_signo).sa_flags & SA_SIGINFO) {
irix_set_ucontext(&sf.isf_ctx.iss.iuc, mask, ksi->ksi_trap, l);
irix_signal_siginfo(&sf.isf_ctx.iss.iis, ksi->ksi_signo,
- ksi->ksi_trap, (void *)f->f_regs[_R_BADVADDR]);
+ ksi->ksi_trap, (void *)tf->tf_regs[_R_BADVADDR]);
} else {
irix_set_sigcontext(&sf.isf_ctx.isc, mask, ksi->ksi_trap, l);
}
@@ -322,10 +322,10 @@
/*
* Set up signal trampoline arguments.
*/
- f->f_regs[_R_A0] = native_to_svr4_signo[ksi->ksi_signo];/* signo */
- f->f_regs[_R_A1] = 0; /* NULL */
- f->f_regs[_R_A2] = (intptr_t)sp; /* ucontext/sigcontext */
- f->f_regs[_R_A3] = (intptr_t)catcher; /* signal handler address */
+ tf->tf_regs[_R_A0] = native_to_svr4_signo[ksi->ksi_signo];/* signo */
+ tf->tf_regs[_R_A1] = 0; /* NULL */
+ tf->tf_regs[_R_A2] = (intptr_t)sp; /* ucontext/sigcontext */
+ tf->tf_regs[_R_A3] = (intptr_t)catcher; /* signal handler address */
/*
* When siginfo is selected, the higher bit of A0 is set
@@ -334,17 +334,17 @@
* Also, A1 points to struct siginfo instead of being NULL.
*/
if (SIGACTION(p, ksi->ksi_signo).sa_flags & SA_SIGINFO) {
- f->f_regs[_R_A0] |= 0x80000000;
- f->f_regs[_R_A1] = (intptr_t)sp +
+ tf->tf_regs[_R_A0] |= 0x80000000;
+ tf->tf_regs[_R_A1] = (intptr_t)sp +
((intptr_t)&sf.isf_ctx.iss.iis - (intptr_t)&sf);
}
/*
* Set up the new stack pointer
*/
- f->f_regs[_R_SP] = (intptr_t)sp;
+ tf->tf_regs[_R_SP] = (intptr_t)sp;
#ifdef DEBUG_IRIX
- printf("stack pointer at %p, A1 = %p\n", sp, (void *)f->f_regs[_R_A1]);
+ printf("stack pointer at %p, A1 = %p\n", sp, (void *)tf->tf_regs[_R_A1]);
#endif /* DEBUG_IRIX */
/*
@@ -353,7 +353,7 @@
* see irix_sys_sigaction for details about how we get
* the signal trampoline address.
*/
- f->f_regs[_R_PC] = (intptr_t)
+ tf->tf_regs[_R_PC] = (intptr_t)
(((struct irix_emuldata *)(p->p_emuldata))->ied_sigtramp[ksi->ksi_signo]);
/*
@@ -375,29 +375,28 @@
struct lwp *l;
{
int i;
- struct frame *f;
+ struct trapframe *tf = l->l_md.md_utf;
KASSERT(mutex_owned(l->l_proc->p_lock));
#ifdef DEBUG_IRIX
printf("irix_set_sigcontext()\n");
#endif
- f = (struct frame *)l->l_md.md_regs;
/*
* Build stack frame for signal trampoline.
*/
native_to_irix_sigset(mask, &scp->isc_sigset);
for (i = 1; i < 32; i++) { /* save gpr1 - gpr31 */
- scp->isc_regs[i] = f->f_regs[i];
+ scp->isc_regs[i] = tf->tf_regs[i];
}
scp->isc_regs[0] = 0;
scp->isc_fp_rounded_result = 0;
scp->isc_regmask = -2;
- scp->isc_mdhi = f->f_regs[_R_MULHI];
- scp->isc_mdlo = f->f_regs[_R_MULLO];
- scp->isc_pc = f->f_regs[_R_PC];
- scp->isc_badvaddr = f->f_regs[_R_BADVADDR];
- scp->isc_cause = f->f_regs[_R_CAUSE];
+ scp->isc_mdhi = tf->tf_regs[_R_MULHI];
+ scp->isc_mdlo = tf->tf_regs[_R_MULLO];
+ scp->isc_pc = tf->tf_regs[_R_PC];
+ scp->isc_badvaddr = tf->tf_regs[_R_BADVADDR];
+ scp->isc_cause = tf->tf_regs[_R_CAUSE];
/*
* Save the floating-pointstate, if necessary, then copy it.
@@ -428,7 +427,7 @@
void
irix_set_ucontext(struct irix_ucontext *ucp, const sigset_t *mask, int code, struct lwp *l)
{
- struct frame *f;
+ struct trapframe *tf = l->l_md.md_utf;
KASSERT(mutex_owned(l->l_proc->p_lock));
@@ -436,18 +435,17 @@
printf("irix_set_ucontext()\n");
#endif
- f = (struct frame *)l->l_md.md_regs;
/*
* Save general purpose registers
*/
native_to_irix_sigset(mask, &ucp->iuc_sigmask);
memcpy(&ucp->iuc_mcontext.svr4___gregs,
- &f->f_regs, 32 * sizeof(mips_reg_t));
+ &tf->tf_regs, 32 * sizeof(mips_reg_t));
/* Theses registers have different order on NetBSD and IRIX */
- ucp->iuc_mcontext.svr4___gregs[IRIX_CTX_MDLO] = f->f_regs[_R_MULLO];
- ucp->iuc_mcontext.svr4___gregs[IRIX_CTX_MDHI] = f->f_regs[_R_MULHI];
- ucp->iuc_mcontext.svr4___gregs[IRIX_CTX_EPC] = f->f_regs[_R_PC];
- ucp->iuc_mcontext.svr4___gregs[IRIX_CTX_CAUSE] = f->f_regs[_R_CAUSE];
+ ucp->iuc_mcontext.svr4___gregs[IRIX_CTX_MDLO] = tf->tf_regs[_R_MULLO];
+ ucp->iuc_mcontext.svr4___gregs[IRIX_CTX_MDHI] = tf->tf_regs[_R_MULHI];
+ ucp->iuc_mcontext.svr4___gregs[IRIX_CTX_EPC] = tf->tf_regs[_R_PC];
+ ucp->iuc_mcontext.svr4___gregs[IRIX_CTX_CAUSE] = tf->tf_regs[_R_CAUSE];
/*
* Save the floating-pointstate, if necessary, then copy it.
@@ -540,9 +538,9 @@
#ifdef DEBUG_IRIX
printf("irix_sys_sigreturn(): returning [PC=%p SP=%p SR=0x%08lx]\n",
- (void *)((struct frame *)(l->l_md.md_regs))->f_regs[_R_PC],
- (void *)((struct frame *)(l->l_md.md_regs))->f_regs[_R_SP],
- ((struct frame *)(l->l_md.md_regs))->f_regs[_R_SR]);
+ (void *)l->l_md.md_utf->tf_regs[_R_PC],
+ (void *)(l->l_md.md_utf->tf_regs[_R_SP],
+ l->l_md.md_utf->tf_regs[_R_SR]);
#endif
return EJUSTRETURN;
@@ -551,32 +549,31 @@
static void
irix_get_ucontext(struct irix_ucontext *ucp, struct lwp *l)
{
- struct frame *f;
+ struct trapframe *tf = l->l_md.md_utf;
sigset_t mask;
KASSERT(mutex_owned(l->l_proc->p_lock));
/* Restore the register context. */
- f = (struct frame *)l->l_md.md_regs;
if (ucp->iuc_flags & IRIX_UC_CPU) {
- (void)memcpy(&f->f_regs, &ucp->iuc_mcontext.svr4___gregs,
+ (void)memcpy(&tf->tf_regs, &ucp->iuc_mcontext.svr4___gregs,
32 * sizeof(mips_reg_t));
/* Theses registers have different order on NetBSD and IRIX */
- f->f_regs[_R_MULLO] =
+ tf->tf_regs[_R_MULLO] =
ucp->iuc_mcontext.svr4___gregs[IRIX_CTX_MDLO];
- f->f_regs[_R_MULHI] =
+ tf->tf_regs[_R_MULHI] =
ucp->iuc_mcontext.svr4___gregs[IRIX_CTX_MDHI];
- f->f_regs[_R_PC] =
+ tf->tf_regs[_R_PC] =
ucp->iuc_mcontext.svr4___gregs[IRIX_CTX_EPC];
}
if (ucp->iuc_flags & IRIX_UC_MAU) {
#ifndef SOFTFLOAT
/* Disable the FPU to fault in FP registers. */
- f->f_regs[_R_SR] &= ~MIPS_SR_COP_1_BIT;
+ tf->tf_regs[_R_SR] &= ~MIPS_SR_COP_1_BIT;
if (l == fpcurlwp)
- fpcurlwp = NULL;
+ fpcurlwp = &lwp0;
(void)memcpy(&l->l_addr->u_pcb.pcb_fpregs,
&ucp->iuc_mcontext.svr4___fpregs,
sizeof(l->l_addr->u_pcb.pcb_fpregs));
@@ -623,24 +620,23 @@
irix_get_sigcontext(struct irix_sigcontext *scp, struct lwp *l)
{
int i;
- struct frame *f;
+ struct trapframe *tf = l->l_md.md_utf;
sigset_t mask;
KASSERT(mutex_owned(l->l_proc->p_lock));
/* Restore the register context. */
- f = (struct frame *)l->l_md.md_regs;
for (i = 1; i < 32; i++) /* restore gpr1 to gpr31 */
- f->f_regs[i] = scp->isc_regs[i];
- f->f_regs[_R_MULLO] = scp->isc_mdlo;
- f->f_regs[_R_MULHI] = scp->isc_mdhi;
- f->f_regs[_R_PC] = scp->isc_pc;
+ tf->tf_regs[i] = scp->isc_regs[i];
+ tf->tf_regs[_R_MULLO] = scp->isc_mdlo;
+ tf->tf_regs[_R_MULHI] = scp->isc_mdhi;
+ tf->tf_regs[_R_PC] = scp->isc_pc;
#ifndef SOFTFLOAT
if (scp->isc_ownedfp) {
/* Disable the FPU to fault in FP registers. */
- f->f_regs[_R_SR] &= ~MIPS_SR_COP_1_BIT;
+ tf->tf_regs[_R_SR] &= ~MIPS_SR_COP_1_BIT;
if (l == fpcurlwp)
fpcurlwp = NULL;
(void)memcpy(&l->l_addr->u_pcb.pcb_fpregs, &scp->isc_fpregs,
@@ -702,11 +698,10 @@
syscallarg(struct irix_ucontext *) ucp;
} */
struct proc *p = l->l_proc;
- struct frame *f;
+ struct trapframe *tf = l->l_md.md_utf;
struct irix_ucontext kucp;
int i, error;
- f = (struct frame *)l->l_md.md_regs;
kucp.iuc_flags = IRIX_UC_ALL;
kucp.iuc_link = NULL; /* XXX */
@@ -723,7 +718,7 @@
mutex_exit(p->p_lock);
for (i = 0; i < 36; i++) /* Is order correct? */
- kucp.iuc_mcontext.svr4___gregs[i] = f->f_regs[i];
+ kucp.iuc_mcontext.svr4___gregs[i] = tf->tf_regs[i];
for (i = 0; i < 32; i++)
kucp.iuc_mcontext.svr4___fpregs.svr4___fp_r.svr4___fp_regs[i]
= 0; /* XXX where are FP registers? */
@@ -746,7 +741,7 @@
syscallarg(struct irix_ucontext *) ucp;
} */
struct proc *p = l->l_proc;
- struct frame *f;
+ struct trapframe *tf = l->l_md.md_utf;
struct irix_ucontext kucp;
int i, error;
@@ -754,7 +749,6 @@
if (error)
goto out;
- f = (struct frame *)l->l_md.md_regs;
mutex_enter(p->p_lock);
@@ -777,7 +771,7 @@
if (kucp.iuc_flags & IRIX_UC_CPU)
for (i = 0; i < 36; i++) /* Is register order right? */
- f->f_regs[i] = kucp.iuc_mcontext.svr4___gregs[i];
+ tf->tf_regs[i] = kucp.iuc_mcontext.svr4___gregs[i];
if (kucp.iuc_flags & IRIX_UC_MAU) { /* XXX */
#ifdef DEBUG_IRIX