]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blobdiff - gdb/ppcobsd-nat.c
opcodes: bfin: simplify field width processing and fix build warnings
[thirdparty/binutils-gdb.git] / gdb / ppcobsd-nat.c
index 35269d7358431ffe61161fc973095690b9487321..db9a6129d9d26be9019b07bb155d92f18f714ae9 100644 (file)
@@ -1,6 +1,6 @@
 /* Native-dependent code for OpenBSD/powerpc.
 
-   Copyright (C) 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
+   Copyright (C) 2004-2012 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -45,9 +45,9 @@
 /* Returns true if PT_GETFPREGS fetches this register.  */
 
 static int
-getfpregs_supplies (int regnum)
+getfpregs_supplies (struct gdbarch *gdbarch, int regnum)
 {
-  struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch);
+  struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
 
   /* FIXME: jimb/2004-05-05: Some PPC variants don't have floating
      point registers.  Traditionally, GDB's register set has still
@@ -59,7 +59,7 @@ getfpregs_supplies (int regnum)
      It's not clear to me how best to update this code, so this assert
      will alert the first person to encounter the NetBSD/E500
      combination to the problem.  */
-  gdb_assert (ppc_floating_point_unit_p (current_gdbarch));
+  gdb_assert (ppc_floating_point_unit_p (gdbarch));
 
   return ((regnum >= tdep->ppc_fp0_regnum
            && regnum < tdep->ppc_fp0_regnum + ppc_num_fprs)
@@ -72,7 +72,8 @@ getfpregs_supplies (int regnum)
    for all registers.  */
 
 static void
-ppcobsd_fetch_registers (struct regcache *regcache, int regnum)
+ppcobsd_fetch_registers (struct target_ops *ops,
+                        struct regcache *regcache, int regnum)
 {
   struct reg regs;
 
@@ -88,7 +89,8 @@ ppcobsd_fetch_registers (struct regcache *regcache, int regnum)
 #endif
 
 #ifdef PT_GETFPREGS
-  if (regnum == -1 || getfpregs_supplies (regnum))
+  if (regnum == -1
+      || getfpregs_supplies (get_regcache_arch (regcache), regnum))
     {
       struct fpreg fpregs;
 
@@ -106,7 +108,8 @@ ppcobsd_fetch_registers (struct regcache *regcache, int regnum)
    this for all registers.  */
 
 static void
-ppcobsd_store_registers (struct regcache *regcache, int regnum)
+ppcobsd_store_registers (struct target_ops *ops,
+                        struct regcache *regcache, int regnum)
 {
   struct reg regs;
 
@@ -126,7 +129,8 @@ ppcobsd_store_registers (struct regcache *regcache, int regnum)
     perror_with_name (_("Couldn't write registers"));
 
 #ifdef PT_GETFPREGS
-  if (regnum == -1 || getfpregs_supplies (regnum))
+  if (regnum == -1
+      || getfpregs_supplies (get_regcache_arch (regcache), regnum))
     {
       struct fpreg fpregs;
 
@@ -148,7 +152,8 @@ ppcobsd_store_registers (struct regcache *regcache, int regnum)
 static int
 ppcobsd_supply_pcb (struct regcache *regcache, struct pcb *pcb)
 {
-  struct gdbarch_tdep *tdep = gdbarch_tdep (get_regcache_arch (regcache));
+  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
   struct switchframe sf;
   struct callframe cf;
   int i, regnum;
@@ -167,14 +172,14 @@ ppcobsd_supply_pcb (struct regcache *regcache, struct pcb *pcb)
     return 0;
 
   read_memory (pcb->pcb_sp, (gdb_byte *)&sf, sizeof sf);
-  regcache_raw_supply (regcache, gdbarch_sp_regnum (current_gdbarch), &sf.sp);
+  regcache_raw_supply (regcache, gdbarch_sp_regnum (gdbarch), &sf.sp);
   regcache_raw_supply (regcache, tdep->ppc_cr_regnum, &sf.cr);
   regcache_raw_supply (regcache, tdep->ppc_gp0_regnum + 2, &sf.fixreg2);
   for (i = 0, regnum = tdep->ppc_gp0_regnum + 13; i < 19; i++, regnum++)
     regcache_raw_supply (regcache, regnum, &sf.fixreg[i]);
 
   read_memory (sf.sp, (gdb_byte *)&cf, sizeof cf);
-  regcache_raw_supply (regcache, gdbarch_pc_regnum (current_gdbarch), &cf.lr);
+  regcache_raw_supply (regcache, gdbarch_pc_regnum (gdbarch), &cf.lr);
   regcache_raw_supply (regcache, tdep->ppc_gp0_regnum + 30, &cf.r30);
   regcache_raw_supply (regcache, tdep->ppc_gp0_regnum + 31, &cf.r31);