gdbserver/linux-low: turn some more static functions into private methods
[deliverable/binutils-gdb.git] / gdbserver / linux-ppc-low.cc
index 5d8d67bec2fbdc10b1054f916fd4af80adf1a826..096308a44d8d12d190fd294c7d9aff2bb934c7a0 100644 (file)
 #define PPC_LI(insn)   (PPC_SEXT (PPC_FIELD (insn, 6, 24), 24) << 2)
 #define PPC_BD(insn)   (PPC_SEXT (PPC_FIELD (insn, 16, 14), 14) << 2)
 
+/* Linux target op definitions for the PowerPC architecture.  */
+
+class ppc_target : public linux_process_target
+{
+public:
+
+  const regs_info *get_regs_info () override;
+
+protected:
+
+  void low_arch_setup () override;
+
+  bool low_cannot_fetch_register (int regno) override;
+
+  bool low_cannot_store_register (int regno) override;
+};
+
+/* The singleton target ops object.  */
+
+static ppc_target the_ppc_target;
+
 /* Holds the AT_HWCAP auxv entry.  */
 
 static unsigned long ppc_hwcap;
@@ -143,8 +164,8 @@ ppc_check_regset (int tid, int regset_id, int regsetsize)
   return 0;
 }
 
-static int
-ppc_cannot_store_register (int regno)
+bool
+ppc_target::low_cannot_store_register (int regno)
 {
   const struct target_desc *tdesc = current_process ()->tdesc;
 
@@ -152,21 +173,21 @@ ppc_cannot_store_register (int regno)
   /* Some kernels do not allow us to store fpscr.  */
   if (!(ppc_hwcap & PPC_FEATURE_HAS_SPE)
       && regno == find_regno (tdesc, "fpscr"))
-    return 2;
+    return true;
 #endif
 
   /* Some kernels do not allow us to store orig_r3 or trap.  */
   if (regno == find_regno (tdesc, "orig_r3")
       || regno == find_regno (tdesc, "trap"))
-    return 2;
+    return true;
 
-  return 0;
+  return false;
 }
 
-static int
-ppc_cannot_fetch_register (int regno)
+bool
+ppc_target::low_cannot_fetch_register (int regno)
 {
-  return 0;
+  return false;
 }
 
 static void
@@ -277,7 +298,7 @@ ppc_breakpoint_at (CORE_ADDR where)
 {
   unsigned int insn;
 
-  (*the_target->read_memory) (where, (unsigned char *) &insn, 4);
+  the_target->read_memory (where, (unsigned char *) &insn, 4);
   if (insn == ppc_breakpoint)
     return 1;
   /* If necessary, recognize more trap instructions here.  GDB only uses
@@ -791,21 +812,21 @@ static struct regsets_info ppc_regsets_info =
     NULL, /* disabled_regsets */
   };
 
-static struct regs_info regs_info =
+static struct regs_info myregs_info =
   {
     NULL, /* regset_bitmap */
     &ppc_usrregs_info,
     &ppc_regsets_info
   };
 
-static const struct regs_info *
-ppc_regs_info (void)
+const regs_info *
+ppc_target::get_regs_info ()
 {
-  return &regs_info;
+  return &myregs_info;
 }
 
-static void
-ppc_arch_setup (void)
+void
+ppc_target::low_arch_setup ()
 {
   const struct target_desc *tdesc;
   struct regset_info *regset;
@@ -3371,11 +3392,6 @@ ppc_get_ipa_tdesc_idx (void)
 }
 
 struct linux_target_ops the_low_target = {
-  ppc_arch_setup,
-  ppc_regs_info,
-  ppc_cannot_fetch_register,
-  ppc_cannot_store_register,
-  NULL, /* fetch_register */
   ppc_get_pc,
   ppc_set_pc,
   NULL, /* breakpoint_kind_from_pc */
@@ -3410,6 +3426,10 @@ struct linux_target_ops the_low_target = {
   ppc_get_ipa_tdesc_idx,
 };
 
+/* The linux target ops object.  */
+
+linux_process_target *the_linux_target = &the_ppc_target;
+
 void
 initialize_low_arch (void)
 {
This page took 0.03958 seconds and 4 git commands to generate.