diff options
author | Mark Kettenis <kettenis@cvs.openbsd.org> | 2005-12-16 18:48:28 +0000 |
---|---|---|
committer | Mark Kettenis <kettenis@cvs.openbsd.org> | 2005-12-16 18:48:28 +0000 |
commit | 4a550814464b5fa814d29d13d9f69143362bd870 (patch) | |
tree | 4f5560138ba0be9f20d94ae49c72924bb813229d /sys/arch/sparc | |
parent | caa01cdc4c3140c00a15752b960ec407c6158d82 (diff) |
Flush fpu state before reading/modifying the state in the pcb.
ok miod@
Diffstat (limited to 'sys/arch/sparc')
-rw-r--r-- | sys/arch/sparc/sparc/process_machdep.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/sys/arch/sparc/sparc/process_machdep.c b/sys/arch/sparc/sparc/process_machdep.c index 595aa4c7e83..671ac7abce2 100644 --- a/sys/arch/sparc/sparc/process_machdep.c +++ b/sys/arch/sparc/sparc/process_machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: process_machdep.c,v 1.8 2004/03/02 23:45:27 miod Exp $ */ +/* $OpenBSD: process_machdep.c,v 1.9 2005/12/16 18:48:27 kettenis Exp $ */ /* $NetBSD: process_machdep.c,v 1.6 1996/03/14 21:09:26 christos Exp $ */ /* @@ -70,6 +70,8 @@ #include <machine/frame.h> #include <sys/ptrace.h> +#include <sparc/sparc/cpuvar.h> + int process_read_regs(p, regs) struct proc *p; @@ -89,8 +91,11 @@ process_read_fpregs(p, regs) struct fpstate *statep = &initfpstate; /* NOTE: struct fpreg == struct fpstate */ - if (p->p_md.md_fpstate) + if (p->p_md.md_fpstate) { + if (p == cpuinfo.fpproc) + savefpstate(p->p_md.md_fpstate); statep = p->p_md.md_fpstate; + } bcopy(statep, regs, sizeof(struct fpreg)); return 0; } @@ -143,6 +148,12 @@ process_write_fpregs(p, regs) if (p->p_md.md_fpstate == NULL) return EINVAL; + if (p == cpuinfo.fpproc) { + /* Release the fpu. */ + savefpstate(p->p_md.md_fpstate); + cpuinfo.fpproc = NULL; + } + bcopy(regs, p->p_md.md_fpstate, sizeof(struct fpreg)); return 0; } |