diff options
author | deischen <deischen@FreeBSD.org> | 2002-10-04 14:50:55 +0000 |
---|---|---|
committer | deischen <deischen@FreeBSD.org> | 2002-10-04 14:50:55 +0000 |
commit | 6bcd2dc9e022006dbb1b3ada2b0729c25ca3acd6 (patch) | |
tree | 3020d97c8745c3f94c8537fee09c69fad9da4221 /sys/amd64 | |
parent | 86b70d31d68020b42d10fcf161a4a76077c34fda (diff) | |
download | FreeBSD-src-6bcd2dc9e022006dbb1b3ada2b0729c25ca3acd6.zip FreeBSD-src-6bcd2dc9e022006dbb1b3ada2b0729c25ca3acd6.tar.gz |
Add another temporary hack to allow running older i386 binaries.
This will be removed when new versions of syscalls sigreturn()
and sigaction() are added (mini is working on this but is in
the middle of a move).
This should fix the problem of cvsupd dying.
Diffstat (limited to 'sys/amd64')
-rw-r--r-- | sys/amd64/amd64/machdep.c | 26 | ||||
-rw-r--r-- | sys/amd64/include/ucontext.h | 12 |
2 files changed, 18 insertions, 20 deletions
diff --git a/sys/amd64/amd64/machdep.c b/sys/amd64/amd64/machdep.c index 81711d1..fc59d1e 100644 --- a/sys/amd64/amd64/machdep.c +++ b/sys/amd64/amd64/machdep.c @@ -2147,10 +2147,6 @@ set_mcontext(struct thread *td, const mcontext_t *mcp) static void get_fpcontext(struct thread *td, mcontext_t *mcp) { -#if 1 /* XXX: tmp hack to restore ability to run releng4 binaries */ - /* For now, always store the FP state in the PCB. */ - (void)npxgetregs(td, (union savefpu *)&td->td_pcb->pcb_save); -#else #ifndef DEV_NPX mcp->mc_fpformat = _MC_FPFMT_NODEV; mcp->mc_ownedfp = _MC_FPOWNED_NONE; @@ -2184,25 +2180,18 @@ 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 /* tmp hack to restore ability to run releng4 binaries */ } static int set_fpcontext(struct thread *td, const mcontext_t *mcp) { -#if 1 /* XXX: tmp hack to restore ability to run releng4 binaries */ - /* For now, the FP state is always stored in the PCB. */ - npxsetregs(td, (union savefpu *)&td->td_pcb->pcb_save); -#else union savefpu *addr; 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) /* We don't care what state is left in the FPU or PCB. */ fpstate_drop(td); @@ -2232,9 +2221,18 @@ set_fpcontext(struct thread *td, const mcontext_t *mcp) * misaligned case, since we know that the caller won't use * them again. */ - } else + } else { + /* + * There's no valid FPU state to restore, so use the + * saved state in the PCB only of the process has used + * the FPU since. + */ + if ((td->td_pcb->pcb_flags & PCB_NPXINITDONE) != 0) + npxsetregs(td, &td->td_pcb->pcb_save); +#if !defined(COMPAT_FREEBSD4) && !defined(COMPAT_43) return (EINVAL); -#endif /* tmp hack to restore ability to run releng4 binaries */ +#endif + } return (0); } diff --git a/sys/amd64/include/ucontext.h b/sys/amd64/include/ucontext.h index 1739818..d02959c 100644 --- a/sys/amd64/include/ucontext.h +++ b/sys/amd64/include/ucontext.h @@ -59,13 +59,13 @@ typedef struct __mcontext { int mc_ss; int mc_len; /* sizeof(mcontext_t) */ -#define _MC_FPFMT_NODEV 0 /* device not present or configured */ -#define _MC_FPFMT_387 1 -#define _MC_FPFMT_XMM 2 +#define _MC_FPFMT_NODEV 0x10000 /* device not present or configured */ +#define _MC_FPFMT_387 0x10001 +#define _MC_FPFMT_XMM 0x10002 int mc_fpformat; -#define _MC_FPOWNED_NONE 0 /* FP state not used */ -#define _MC_FPOWNED_FPU 1 /* FP state came from FPU */ -#define _MC_FPOWNED_PCB 2 /* FP state came from PCB */ +#define _MC_FPOWNED_NONE 0x20000 /* FP state not used */ +#define _MC_FPOWNED_FPU 0x20001 /* FP state came from FPU */ +#define _MC_FPOWNED_PCB 0x20002 /* FP state came from PCB */ int mc_ownedfp; int mc_spare1[1]; /* align next field to 16 bytes */ int mc_fpstate[128]; /* must be multiple of 16 bytes */ |