aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYoshihiro Takahashi <nyan@FreeBSD.org>2002-10-08 12:53:26 +0000
committerYoshihiro Takahashi <nyan@FreeBSD.org>2002-10-08 12:53:26 +0000
commitde62287d075ff242fb3cf5ea2481c2338881fbd5 (patch)
tree34bbc7688197dc58e9d1be714bd200846d3fd24c
parent6d8c8fabad2614cff868ac4faec4a5133d8e5d31 (diff)
downloadsrc-de62287d075ff242fb3cf5ea2481c2338881fbd5.tar.gz
src-de62287d075ff242fb3cf5ea2481c2338881fbd5.zip
MFi386: revisions 1.539, 1.540 and 1.541.
Notes
Notes: svn path=/head/; revision=104675
-rw-r--r--sys/pc98/i386/machdep.c32
-rw-r--r--sys/pc98/pc98/machdep.c32
2 files changed, 40 insertions, 24 deletions
diff --git a/sys/pc98/i386/machdep.c b/sys/pc98/i386/machdep.c
index 45c77ade3c84..5513bc0ea38d 100644
--- a/sys/pc98/i386/machdep.c
+++ b/sys/pc98/i386/machdep.c
@@ -2179,15 +2179,14 @@ get_mcontext(struct thread *td, mcontext_t *mcp)
/*
* Set machine context.
*
- * However, we don't set any but the user modifyable flags, and
- * we we won't touch the cs selector.
+ * However, we don't set any but the user modifiable flags, and we won't
+ * touch the cs selector.
*/
int
set_mcontext(struct thread *td, const mcontext_t *mcp)
{
struct trapframe *tp;
- int ret;
- int eflags;
+ int eflags, ret;
tp = td->td_frame;
if (mcp->mc_len != sizeof(*mcp))
@@ -2221,7 +2220,7 @@ get_fpcontext(struct thread *td, mcontext_t *mcp)
#ifndef DEV_NPX
mcp->mc_fpformat = _MC_FPFMT_NODEV;
mcp->mc_ownedfp = _MC_FPOWNED_NONE;
-#else
+#else /* DEV_NPX */
union savefpu *addr;
/*
@@ -2251,8 +2250,9 @@ get_fpcontext(struct thread *td, mcontext_t *mcp)
bcopy(addr, &mcp->mc_fpstate, sizeof(mcp->mc_fpstate));
bzero(&mcp->mc_spare2, sizeof(mcp->mc_spare2));
}
+ bcopy(&mcp->mc_fpstate, &td->td_pcb->pcb_save, sizeof(mcp->mc_fpstate));
mcp->mc_fpformat = npxformat();
-#endif
+#endif /* !DEV_NPX */
}
static int
@@ -2262,10 +2262,7 @@ set_fpcontext(struct thread *td, const mcontext_t *mcp)
if (mcp->mc_fpformat == _MC_FPFMT_NODEV)
return (0);
- else if (mcp->mc_fpformat != _MC_FPFMT_387 &&
- mcp->mc_fpformat != _MC_FPFMT_XMM)
- return (EINVAL);
- else if (mcp->mc_ownedfp == _MC_FPOWNED_NONE)
+ if (mcp->mc_ownedfp == _MC_FPOWNED_NONE)
/* We don't care what state is left in the FPU or PCB. */
fpstate_drop(td);
else if (mcp->mc_ownedfp == _MC_FPOWNED_FPU ||
@@ -2288,14 +2285,25 @@ set_fpcontext(struct thread *td, const mcontext_t *mcp)
* be called with interrupts disabled.
*/
npxsetregs(td, addr);
-#endif
/*
* Don't bother putting things back where they were in the
* misaligned case, since we know that the caller won't use
* them again.
*/
- } else
+ } else {
+ /*
+ * There is no valid FPU state in *mcp, so use the saved
+ * state in the PCB if there is one. XXX the test for
+ * whether there is one seems to be quite broken. We
+ * forcibly drop the state in sendsig().
+ */
+ if ((td->td_pcb->pcb_flags & PCB_NPXINITDONE) != 0)
+ npxsetregs(td, &td->td_pcb->pcb_save);
+#endif
+#if !defined(COMPAT_FREEBSD4) && !defined(COMPAT_43)
return (EINVAL);
+#endif
+ }
return (0);
}
diff --git a/sys/pc98/pc98/machdep.c b/sys/pc98/pc98/machdep.c
index 45c77ade3c84..5513bc0ea38d 100644
--- a/sys/pc98/pc98/machdep.c
+++ b/sys/pc98/pc98/machdep.c
@@ -2179,15 +2179,14 @@ get_mcontext(struct thread *td, mcontext_t *mcp)
/*
* Set machine context.
*
- * However, we don't set any but the user modifyable flags, and
- * we we won't touch the cs selector.
+ * However, we don't set any but the user modifiable flags, and we won't
+ * touch the cs selector.
*/
int
set_mcontext(struct thread *td, const mcontext_t *mcp)
{
struct trapframe *tp;
- int ret;
- int eflags;
+ int eflags, ret;
tp = td->td_frame;
if (mcp->mc_len != sizeof(*mcp))
@@ -2221,7 +2220,7 @@ get_fpcontext(struct thread *td, mcontext_t *mcp)
#ifndef DEV_NPX
mcp->mc_fpformat = _MC_FPFMT_NODEV;
mcp->mc_ownedfp = _MC_FPOWNED_NONE;
-#else
+#else /* DEV_NPX */
union savefpu *addr;
/*
@@ -2251,8 +2250,9 @@ get_fpcontext(struct thread *td, mcontext_t *mcp)
bcopy(addr, &mcp->mc_fpstate, sizeof(mcp->mc_fpstate));
bzero(&mcp->mc_spare2, sizeof(mcp->mc_spare2));
}
+ bcopy(&mcp->mc_fpstate, &td->td_pcb->pcb_save, sizeof(mcp->mc_fpstate));
mcp->mc_fpformat = npxformat();
-#endif
+#endif /* !DEV_NPX */
}
static int
@@ -2262,10 +2262,7 @@ set_fpcontext(struct thread *td, const mcontext_t *mcp)
if (mcp->mc_fpformat == _MC_FPFMT_NODEV)
return (0);
- else if (mcp->mc_fpformat != _MC_FPFMT_387 &&
- mcp->mc_fpformat != _MC_FPFMT_XMM)
- return (EINVAL);
- else if (mcp->mc_ownedfp == _MC_FPOWNED_NONE)
+ if (mcp->mc_ownedfp == _MC_FPOWNED_NONE)
/* We don't care what state is left in the FPU or PCB. */
fpstate_drop(td);
else if (mcp->mc_ownedfp == _MC_FPOWNED_FPU ||
@@ -2288,14 +2285,25 @@ set_fpcontext(struct thread *td, const mcontext_t *mcp)
* be called with interrupts disabled.
*/
npxsetregs(td, addr);
-#endif
/*
* Don't bother putting things back where they were in the
* misaligned case, since we know that the caller won't use
* them again.
*/
- } else
+ } else {
+ /*
+ * There is no valid FPU state in *mcp, so use the saved
+ * state in the PCB if there is one. XXX the test for
+ * whether there is one seems to be quite broken. We
+ * forcibly drop the state in sendsig().
+ */
+ if ((td->td_pcb->pcb_flags & PCB_NPXINITDONE) != 0)
+ npxsetregs(td, &td->td_pcb->pcb_save);
+#endif
+#if !defined(COMPAT_FREEBSD4) && !defined(COMPAT_43)
return (EINVAL);
+#endif
+ }
return (0);
}