Subject: port-powerpc/10130: powerpc port does not support PT_[GS]ETFPREGS
To: None <gnats-bugs@gnats.netbsd.org>
From: None <jtc@redback.com>
List: netbsd-bugs
Date: 05/16/2000 11:23:24
>Number:         10130
>Category:       port-powerpc
>Synopsis:       powerpc port does not support PT_[GS]ETFPREGS
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    port-powerpc-maintainer
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue May 16 11:24:00 PDT 2000
>Closed-Date:
>Last-Modified:
>Originator:     
>Release:        NetBSD-current 2000/04/29
>Organization:
J.T. Conklin
RedBack Networks
>Environment:
	
System: NetBSD powermac 1.4X NetBSD 1.4X (GENERIC) #1: Thu May 11 22:44:11 PDT 2000     jtc@powermac:/usr/src/sys/arch/macppc/compile/GENERIC macppc

>Description:
The powerpc port does not support the ptrace PT_[GS]ETFPREGS commands,
which are required to add floating point support to the GDB port I am
working on.

>How-To-Repeat:

>Fix:
*** OLD/ptrace.h	Thu May 11 22:19:52 2000
--- include/ptrace.h	Tue May 16 11:03:07 2000
***************
*** 3,5 ****
--- 3,7 ----
  #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)
*** OLD/reg.h	Thu May 11 10:48:44 2000
--- include/reg.h	Thu May 11 22:29:13 2000
***************
*** 8,10 ****
--- 8,15 ----
  	register_t ctr;
  	register_t pc;
  };
+ 
+ struct fpreg {
+ 	double	r_regs[32];
+ 	double	r_fpscr;
+ };
*** OLD/process_machdep.c	Thu May 11 10:57:39 2000
--- powerpc/process_machdep.c	Thu May 11 22:43:47 2000
***************
*** 33,41 ****
--- 33,46 ----
  
  #include <sys/param.h>
  #include <sys/proc.h>
+ #include <sys/user.h>
  #include <sys/systm.h>
  
  #include <machine/reg.h>
+ #include <machine/pcb.h>
+ 
+ #define process_pcb(p)          (&(p)->p_addr->u_pcb)
+ #define process_fpframe(p)      (&(process_pcb(p)->pcb_fpu))
  
  int
  process_read_regs(p, regs)
***************
*** 70,75 ****
--- 75,106 ----
  
  	return 0;
  }
+ 
+ int
+ process_read_fpregs(p, regs)
+         struct proc *p;
+         struct fpreg *regs;
+ {
+ 	if (p == fpuproc) {
+                 save_fpu(p);
+         }                                  
+ 
+         bcopy(process_fpframe(p), regs, sizeof(struct fpreg));
+         return (0);
+ }
+ 
+ int
+ process_write_fpregs(p, regs)
+         struct proc *p;
+         struct fpreg *regs;
+ {
+ 	if (p == fpuproc)
+ 		fpuproc = NULL;
+       
+         bcopy(regs, process_fpframe(p), sizeof(struct fpreg));
+         return (0);
+ }
+ 
  
  /*
   * Set the process's program counter.

>Release-Note:
>Audit-Trail:
>Unformatted: