Add PT_GETFPREGS and PT_SETFPREGS support.

This commit is contained in:
tsubai 2000-06-04 09:30:43 +00:00
parent e56538278d
commit 86ac32df3d
3 changed files with 50 additions and 3 deletions

View File

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

View File

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

View File

@ -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 <sys/param.h>
#include <sys/proc.h>
#include <sys/user.h>
#include <sys/systm.h>
#include <machine/pcb.h>
#include <machine/reg.h>
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.
*/