diff options
author | Michael Shalayeff <mickey@cvs.openbsd.org> | 2002-09-20 19:06:27 +0000 |
---|---|---|
committer | Michael Shalayeff <mickey@cvs.openbsd.org> | 2002-09-20 19:06:27 +0000 |
commit | 0eed527c6aac1b4f0cf78edec37832fc6b143d3a (patch) | |
tree | 3535d91909f59bc4ac242347bc1e6ddc5aedc477 | |
parent | 2c893d10853879128ba3036ab62184392ea50576 (diff) |
flush cpu state on read/write fpregs, force reload on write
-rw-r--r-- | sys/arch/hppa/hppa/process_machdep.c | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/sys/arch/hppa/hppa/process_machdep.c b/sys/arch/hppa/hppa/process_machdep.c index 6edd17662f0..94540d75eac 100644 --- a/sys/arch/hppa/hppa/process_machdep.c +++ b/sys/arch/hppa/hppa/process_machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: process_machdep.c,v 1.5 2002/03/15 19:02:54 mickey Exp $ */ +/* $OpenBSD: process_machdep.c,v 1.6 2002/09/20 19:06:26 mickey Exp $ */ /* * Copyright (c) 1999-2002 Michael Shalayeff @@ -37,6 +37,8 @@ #include <sys/ptrace.h> #include <sys/user.h> +#include <machine/cpufunc.h> + int process_read_regs(p, regs) struct proc *p; @@ -85,7 +87,12 @@ process_read_fpregs(p, fpregs) struct proc *p; struct fpreg *fpregs; { - bcopy (p->p_addr->u_pcb.pcb_fpregs, fpregs, sizeof(*fpregs)); + extern paddr_t fpu_curpcb; + + if (p->p_md.md_regs->tf_cr30 == fpu_curpcb) + fpu_save((vaddr_t)p->p_addr->u_pcb.pcb_fpregs); + bcopy(p->p_addr->u_pcb.pcb_fpregs, fpregs, 32*8); + return 0; } @@ -139,7 +146,17 @@ process_write_fpregs(p, fpregs) struct proc *p; struct fpreg *fpregs; { - bcopy (fpregs, p->p_addr->u_pcb.pcb_fpregs, sizeof(*fpregs)); + extern paddr_t fpu_curpcb; + + if (p->p_md.md_regs->tf_cr30 == fpu_curpcb) + fpu_save((vaddr_t)p->p_addr->u_pcb.pcb_fpregs); + bcopy(fpregs, p->p_addr->u_pcb.pcb_fpregs, 32 * 8); + + if (p->p_md.md_regs->tf_cr30 == fpu_curpcb) { + mtctl(0, CR_CCR); + fpu_curpcb = 0; + } + return 0; } |