FRV register related updates

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

FRV register related updates

Kevin Buettner
I've comitted the patch below.  It updates NUM_REGS (which should've
been done quite a while back) and prevents an error when attempting to
read PSR on FRV.

unix/ChangeLog:

        * linux-target.c (NUM_REGS)[FRV_LINUX_TARGET]: Update.
        (frv_read_only_register): New function.
        (reginfo)[FRV_LINUX_TARGET]: Mark as read-only.

Index: unix/linux-target.c
===================================================================
RCS file: /cvs/src/src/rda/unix/linux-target.c,v
retrieving revision 1.23
diff -u -p -r1.23 linux-target.c
--- unix/linux-target.c 3 Oct 2006 22:49:05 -0000 1.23
+++ unix/linux-target.c 9 Apr 2007 22:33:39 -0000
@@ -1252,7 +1252,7 @@ is_extended_reg (int regnum)
 
 enum
 {
-  NUM_REGS = 149,
+  NUM_REGS = 166,
   PC_REGNUM = 128,
   sign_extend = 0
 };
@@ -1263,6 +1263,8 @@ enum
 
 static int frv_fdpic_loadmap_addresses (struct gdbserv *, int, int, void *,
                                         const void *);
+static int frv_read_only_register (struct gdbserv *, int, int, void *,
+                                   const void *);
 
 static struct peekuser_pokeuser_reginfo reginfo[] =
 {
@@ -1398,7 +1400,8 @@ static struct peekuser_pokeuser_reginfo
   { PT_FR(63) * 4,  4, fpreg_offset_and_size (fr[63]), 4, 0 },
 
   { PT_PC * 4,      4, greg_offset_and_size (pc),      4, 0 },
-  { PT_PSR * 4,     4, greg_offset_and_size (psr),     4, 0 },
+  /* The PSR is read-only.  */
+  { PT_PSR * 4,     4, greg_offset_and_size (psr),     4, frv_read_only_register },
   { PT_CCR * 4,     4, greg_offset_and_size (ccr),     4, 0 },
   { PT_CCCR * 4,    4, greg_offset_and_size (cccr),    4, 0 },
 
@@ -1493,6 +1496,19 @@ frv_fdpic_loadmap_addresses (struct gdbs
   return 0;
 }
 
+int
+frv_read_only_register (struct gdbserv *serv, int pid, int regno,
+                        void *read_buf, const void *write_buf)
+{
+  if (read_buf != NULL)
+    {
+      return ptrace_read_user (serv, pid, reginfo[regno].ptrace_offset,
+                               reginfo[regno].ptrace_size, read_buf);
+    }
+  return 0;
+}
+
+
 /* Breakpoint methods for the frv.  These use the stock breakpoint
    code.