summaryrefslogtreecommitdiff
path: root/sys/arch/sparc64
diff options
context:
space:
mode:
authorJason Wright <jason@cvs.openbsd.org>2002-08-03 15:22:07 +0000
committerJason Wright <jason@cvs.openbsd.org>2002-08-03 15:22:07 +0000
commitbc99d976975fe334c02b4b51cadf1d8de5cbeec7 (patch)
tree49d25a4c1e85b440d35a03cc5d5f8dd1e919662d /sys/arch/sparc64
parentc083bfa135e6f036f2c307b30bb14d8e74b5648d (diff)
Don't depend on curproc, pass the proc * down to the functions that need it (fmovr/fmovcc).
Diffstat (limited to 'sys/arch/sparc64')
-rw-r--r--sys/arch/sparc64/fpu/fpu.c43
-rw-r--r--sys/arch/sparc64/fpu/fpu_extern.h4
2 files changed, 25 insertions, 22 deletions
diff --git a/sys/arch/sparc64/fpu/fpu.c b/sys/arch/sparc64/fpu/fpu.c
index 906e1cdb82a..a02a9599493 100644
--- a/sys/arch/sparc64/fpu/fpu.c
+++ b/sys/arch/sparc64/fpu/fpu.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: fpu.c,v 1.6 2002/07/10 20:30:14 jsyn Exp $ */
+/* $OpenBSD: fpu.c,v 1.7 2002/08/03 15:22:06 jason Exp $ */
/* $NetBSD: fpu.c,v 1.11 2000/12/06 01:47:50 mrg Exp $ */
/*
@@ -104,8 +104,8 @@ int fpu_insn_fmulx(struct fpemu *, union instr, int *, int *, u_int *);
int fpu_insn_fdiv(struct fpemu *, union instr, int *, int *, u_int *);
int fpu_insn_fadd(struct fpemu *, union instr, int *, int *, u_int *);
int fpu_insn_fsub(struct fpemu *, union instr, int *, int *, u_int *);
-int fpu_insn_fmovcc(struct fpstate64 *, union instr);
-int fpu_insn_fmovr(struct fpstate64 *, union instr);
+int fpu_insn_fmovcc(struct proc *, struct fpstate64 *, union instr);
+int fpu_insn_fmovr(struct proc *, struct fpstate64 *, union instr);
void fpu_fcopy(u_int *, u_int *, int);
#ifdef DEBUG
@@ -268,7 +268,7 @@ fpu_cleanup(p, fs)
(instr.i_op3.i_op3 != IOP3_FPop1 &&
instr.i_op3.i_op3 != IOP3_FPop2))
panic("bogus fpu queue");
- error = fpu_execute(&fe, instr);
+ error = fpu_execute(p, &fe, instr);
switch (error) {
case 0:
@@ -334,7 +334,7 @@ fpu_emulate(p, tf, fs)
return;
} else if (fpu instr) {
fe.fe_fsr = fs->fs_fsr &= ~FSR_CX;
- error = fpu_execute(&fe, fs, instr);
+ error = fpu_execute(p, &fe, fs, instr);
switch (error) {
etc;
}
@@ -371,7 +371,8 @@ fpu_regoffset(rx, type)
* modified to reflect the setting the hardware would have left.
*/
int
-fpu_execute(fe, instr)
+fpu_execute(fpproc, fe, instr)
+ struct proc *fpproc;
struct fpemu *fe;
union instr instr;
{
@@ -405,7 +406,7 @@ fpu_execute(fe, instr)
case FMVFC3S: case FMVFC3D: case FMVFC3Q:
case FMVICS: case FMVICD: case FMVICQ:
case FMVXCS: case FMVXCD: case FMVXCQ:
- return (fpu_insn_fmovcc(fs, instr));
+ return (fpu_insn_fmovcc(fpproc, fs, instr));
case FMOVZS: case FMOVZD: case FMOVZQ:
case FMOVLEZS: case FMOVLEZD: case FMOVLEZQ:
@@ -413,7 +414,7 @@ fpu_execute(fe, instr)
case FMOVNZS: case FMOVNZD: case FMOVNZQ:
case FMOVGZS: case FMOVGZD: case FMOVGZQ:
case FMOVGEZS: case FMOVGEZD: case FMOVGEZQ:
- return (fpu_insn_fmovr(fs, instr));
+ return (fpu_insn_fmovr(fpproc, fs, instr));
}
return (NOTFPU);
}
@@ -908,10 +909,11 @@ fpu_insn_fsub(fe, instr, rdp, rdtypep, space)
}
/*
- * Handler for FMOV[SDQ][cond] emulation. XXX Assumes we are curproc.
+ * Handler for FMOV[SDQ][cond] emulation.
*/
int
-fpu_insn_fmovcc(fs, instr)
+fpu_insn_fmovcc(fpproc, fs, instr)
+ struct proc *fpproc;
struct fpstate64 *fs;
union instr instr;
{
@@ -940,11 +942,11 @@ fpu_insn_fmovcc(fs, instr)
cond = (fs->fs_fsr >> FSR_FCC3_SHIFT) & FSR_FCC_MASK;
break;
case 4:
- cond = (curproc->p_md.md_tf->tf_tstate >> TSTATE_CCR_SHIFT) &
+ cond = (fpproc->p_md.md_tf->tf_tstate >> TSTATE_CCR_SHIFT) &
PSR_ICC;
break;
case 6:
- cond = (curproc->p_md.md_tf->tf_tstate >>
+ cond = (fpproc->p_md.md_tf->tf_tstate >>
(TSTATE_CCR_SHIFT + XCC_SHIFT)) & PSR_ICC;
break;
default:
@@ -959,10 +961,11 @@ fpu_insn_fmovcc(fs, instr)
}
/*
- * Handler for FMOVR[icond][SDQ] emulation. XXX Assumes we are curproc.
+ * Handler for FMOVR[icond][SDQ] emulation.
*/
int
-fpu_insn_fmovr(fs, instr)
+fpu_insn_fmovr(fpproc, fs, instr)
+ struct proc *fpproc;
struct fpstate64 *fs;
union instr instr;
{
@@ -981,32 +984,32 @@ fpu_insn_fmovr(fs, instr)
switch (instr.i_fmovr.i_rcond) {
case 1: /* Z */
if (rs1 != 0 &&
- (int64_t)curproc->p_md.md_tf->tf_global[rs1] != 0)
+ (int64_t)fpproc->p_md.md_tf->tf_global[rs1] != 0)
return (0);
break;
case 2: /* LEZ */
if (rs1 != 0 &&
- (int64_t)curproc->p_md.md_tf->tf_global[rs1] > 0)
+ (int64_t)fpproc->p_md.md_tf->tf_global[rs1] > 0)
return (0);
break;
case 3: /* LZ */
if (rs1 == 0 ||
- (int64_t)curproc->p_md.md_tf->tf_global[rs1] >= 0)
+ (int64_t)fpproc->p_md.md_tf->tf_global[rs1] >= 0)
return (0);
break;
case 5: /* NZ */
if (rs1 == 0 ||
- (int64_t)curproc->p_md.md_tf->tf_global[rs1] == 0)
+ (int64_t)fpproc->p_md.md_tf->tf_global[rs1] == 0)
return (0);
break;
case 6: /* NGZ */
if (rs1 == 0 ||
- (int64_t)curproc->p_md.md_tf->tf_global[rs1] <= 0)
+ (int64_t)fpproc->p_md.md_tf->tf_global[rs1] <= 0)
return (0);
break;
case 7: /* NGEZ */
if (rs1 != 0 &&
- (int64_t)curproc->p_md.md_tf->tf_global[rs1] < 0)
+ (int64_t)fpproc->p_md.md_tf->tf_global[rs1] < 0)
return (0);
break;
default:
diff --git a/sys/arch/sparc64/fpu/fpu_extern.h b/sys/arch/sparc64/fpu/fpu_extern.h
index 5df6c8c0d6b..2a974f893b3 100644
--- a/sys/arch/sparc64/fpu/fpu_extern.h
+++ b/sys/arch/sparc64/fpu/fpu_extern.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: fpu_extern.h,v 1.3 2002/03/14 01:26:45 millert Exp $ */
+/* $OpenBSD: fpu_extern.h,v 1.4 2002/08/03 15:22:06 jason Exp $ */
/* $NetBSD: fpu_extern.h,v 1.4 2000/08/03 18:32:08 eeh Exp $ */
/*-
@@ -57,7 +57,7 @@ int fpu_emulate(struct proc *, struct trapframe *, struct fpstate *);
void fpu_cleanup(struct proc *, struct fpstate64 *);
int fpu_emulate(struct proc *, struct trapframe64 *, struct fpstate64 *);
#endif /* SUN4U */
-int fpu_execute(struct fpemu *, union instr);
+int fpu_execute(struct proc *, struct fpemu *, union instr);
/* fpu_add.c */
struct fpn *fpu_add(struct fpemu *);