#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;
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;
/* Some kernels do not allow us to store fpscr. */
if (!(ppc_hwcap & PPC_FEATURE_HAS_SPE)
&& regno == find_regno (tdesc, "fpscr"))
- return 1;
+ 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 1;
+ 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
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 ®s_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;
}
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,
ppc_get_ipa_tdesc_idx,
};
+/* The linux target ops object. */
+
+linux_process_target *the_linux_target = &the_ppc_target;
+
void
initialize_low_arch (void)
{