diff options
author | jake <jake@FreeBSD.org> | 2003-04-01 23:18:13 +0000 |
---|---|---|
committer | jake <jake@FreeBSD.org> | 2003-04-01 23:18:13 +0000 |
commit | d8464b70a3ce9a508a7ec417289322ea1b69334f (patch) | |
tree | befb3ea4257eaa4940ea1926529202e5b39aa7ce | |
parent | 4b5aacdfc871360134c035a6c5e6010072f105a6 (diff) | |
download | FreeBSD-src-d8464b70a3ce9a508a7ec417289322ea1b69334f.zip FreeBSD-src-d8464b70a3ce9a508a7ec417289322ea1b69334f.tar.gz |
- Set the version number in the mcontext in get_mcontext and check it in
set_mcontext.
- Don't make assumptions about the alignment of the mcontext inside of the
ucontext; we have to save the floating point registers to the pcb and then
copy to the mcontext.
-rw-r--r-- | sys/sparc64/sparc64/machdep.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/sys/sparc64/sparc64/machdep.c b/sys/sparc64/sparc64/machdep.c index 45d6c7c..9cfdfc5 100644 --- a/sys/sparc64/sparc64/machdep.c +++ b/sys/sparc64/sparc64/machdep.c @@ -518,15 +518,17 @@ get_mcontext(struct thread *td, mcontext_t *mc) struct trapframe *tf; struct pcb *pcb; - if (((uintptr_t)mc & (64 - 1)) != 0) - return (EINVAL); tf = td->td_frame; pcb = td->td_pcb; bcopy(tf, mc, sizeof(*tf)); + mc->mc_flags = _MC_VERSION; critical_enter(); - if ((tf->tf_fprs & FPRS_FEF) != 0) - savefpctx(mc->mc_fp); - else if ((pcb->pcb_flags & PCB_FEF) != 0) { + if ((tf->tf_fprs & FPRS_FEF) != 0) { + savefpctx(pcb->pcb_ufp); + tf->tf_fprs &= ~FPRS_FEF; + pcb->pcb_flags |= PCB_FEF; + } + if ((pcb->pcb_flags & PCB_FEF) != 0) { bcopy(pcb->pcb_ufp, mc->mc_fp, sizeof(*mc->mc_fp)); mc->mc_fprs |= FPRS_FEF; } @@ -541,7 +543,8 @@ set_mcontext(struct thread *td, const mcontext_t *mc) struct pcb *pcb; uint64_t wstate; - if (!TSTATE_SECURE(mc->mc_tstate)) + if (!TSTATE_SECURE(mc->mc_tstate) || + (mc->mc_flags & ((1L << _MC_VERSION_BITS) - 1)) != _MC_VERSION) return (EINVAL); tf = td->td_frame; pcb = td->td_pcb; |