From 86ac32df3d32694581a3aee123c3bd1622e8cbaf Mon Sep 17 00:00:00 2001 From: tsubai Date: Sun, 4 Jun 2000 09:30:43 +0000 Subject: [PATCH] Add PT_GETFPREGS and PT_SETFPREGS support. --- sys/arch/powerpc/include/ptrace.h | 4 ++- sys/arch/powerpc/include/reg.h | 7 +++- sys/arch/powerpc/powerpc/process_machdep.c | 42 +++++++++++++++++++++- 3 files changed, 50 insertions(+), 3 deletions(-) diff --git a/sys/arch/powerpc/include/ptrace.h b/sys/arch/powerpc/include/ptrace.h index bdad33ca8442..b46c54ccda67 100644 --- a/sys/arch/powerpc/include/ptrace.h +++ b/sys/arch/powerpc/include/ptrace.h @@ -1,5 +1,7 @@ -/* $NetBSD: ptrace.h,v 1.3 1999/05/03 10:02:19 tsubai Exp $ */ +/* $NetBSD: ptrace.h,v 1.4 2000/06/04 09:30:43 tsubai Exp $ */ #define PT_STEP (PT_FIRSTMACH + 0) #define PT_GETREGS (PT_FIRSTMACH + 1) #define PT_SETREGS (PT_FIRSTMACH + 2) +#define PT_GETFPREGS (PT_FIRSTMACH + 3) +#define PT_SETFPREGS (PT_FIRSTMACH + 4) diff --git a/sys/arch/powerpc/include/reg.h b/sys/arch/powerpc/include/reg.h index 5399bbb8a59c..2785d94e665e 100644 --- a/sys/arch/powerpc/include/reg.h +++ b/sys/arch/powerpc/include/reg.h @@ -1,4 +1,4 @@ -/* $NetBSD: reg.h,v 1.3 1999/05/03 10:02:19 tsubai Exp $ */ +/* $NetBSD: reg.h,v 1.4 2000/06/04 09:30:44 tsubai Exp $ */ struct reg { register_t fixreg[32]; @@ -8,3 +8,8 @@ struct reg { register_t ctr; register_t pc; }; + +struct fpreg { + double fpreg[32]; + double fpscr; +}; diff --git a/sys/arch/powerpc/powerpc/process_machdep.c b/sys/arch/powerpc/powerpc/process_machdep.c index eccb951560bf..68f3c6067f0b 100644 --- a/sys/arch/powerpc/powerpc/process_machdep.c +++ b/sys/arch/powerpc/powerpc/process_machdep.c @@ -1,4 +1,4 @@ -/* $NetBSD: process_machdep.c,v 1.2 1999/05/03 10:02:19 tsubai Exp $ */ +/* $NetBSD: process_machdep.c,v 1.3 2000/06/04 09:30:45 tsubai Exp $ */ /* * Copyright (C) 1995, 1996 Wolfgang Solfrank. @@ -33,8 +33,10 @@ #include #include +#include #include +#include #include int @@ -71,6 +73,44 @@ process_write_regs(p, regs) return 0; } +int +process_read_fpregs(p, regs) + struct proc *p; + struct fpreg *regs; +{ + struct pcb *pcb = &p->p_addr->u_pcb; + + /* Is the process using the fpu? */ + if ((pcb->pcb_flags & PCB_FPU) == 0) { + bzero(regs, sizeof (struct fpreg)); + return 0; + } + + if (p == fpuproc) + save_fpu(p); + bcopy(&pcb->pcb_fpu, regs, sizeof (struct fpreg)); + + return 0; +} + +int +process_write_fpregs(p, regs) + struct proc *p; + struct fpreg *regs; +{ + struct pcb *pcb = &p->p_addr->u_pcb; + + if (p == fpuproc) + fpuproc = NULL; + + bcopy(regs, &pcb->pcb_fpu, sizeof(struct fpreg)); + + /* pcb_fpu is initialized now. */ + pcb->pcb_flags |= PCB_FPU; + + return 0; +} + /* * Set the process's program counter. */