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.
This commit is contained in:
Daniel Eischen 2002-10-04 14:50:55 +00:00
parent bd8ab1f63e
commit 80047e95cf
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=104460
4 changed files with 36 additions and 40 deletions

View File

@ -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);
}

View File

@ -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 */

View File

@ -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);
}

View File

@ -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 */