aboutsummaryrefslogtreecommitdiff
path: root/gdb/sparc64-tdep.c
diff options
context:
space:
mode:
authorUlrich Weigand <uweigand@de.ibm.com>2009-07-02 12:52:52 +0000
committerUlrich Weigand <uweigand@de.ibm.com>2009-07-02 12:52:52 +0000
commit209bd28e8ba1a8d4f3f5e90ea954437050870837 (patch)
treec698a17c33330d90bf8c511a622064e2ac6ccc82 /gdb/sparc64-tdep.c
parent270677457f363b213b10923759f4f96ed1aa868b (diff)
downloadgdb-209bd28e8ba1a8d4f3f5e90ea954437050870837.zip
gdb-209bd28e8ba1a8d4f3f5e90ea954437050870837.tar.gz
gdb-209bd28e8ba1a8d4f3f5e90ea954437050870837.tar.bz2
* i386-tdep.h (struct gdbarch_tdep): Add i386_eflags_type and
i386_mxcsr_type members. (i386_eflags_type): Make into function. (i386_mxcsr_type): Likewise. * i386-tdep.c (i386_eflags_type): Make into function. (i386_mxcsr_type): Likewise. (i386_register_type): Update uses. (i386_init_types): Remove. (_initialize_i386_tdep): Do not call it. * amd64-tdep.c (amd64_register_type): Update uses. * m68k-tdep.h (struct gdbarch_tdep): Add m68k_ps_type member. * m68k-tdep.c (m68k_ps_type): Make into function. (m68k_register_type): Update use. (m68k_init_types): Remove. (_initialize_m68k_tdep): Do not call it. * sparc-tdep.h (struct gdbarch_tdep): Add sparc_psr_type, sparc_fsr_type, sparc64_pstate_type, sparc64_fsr_type, and sparc64_fprs_type members. * sparc-tdep.c (sparc_psr_type): Make into function. (sparc_fsr_type): Likewise. (sparc32_register_type): Update uses. (sparc_init_types): Remove. (_initialize_sparc_tdep): Do not call it. * sparc64-tdep.c (sparc64_pstate_type): Make into function. (sparc64_fsr_type): Likewise. (sparc64_fprs_type): Likewise. (sparc64_register_type): Update uses. (sparc64_init_types): Remove. (_initialize_sparc64_tdep): Likewise.
Diffstat (limited to 'gdb/sparc64-tdep.c')
-rw-r--r--gdb/sparc64-tdep.c140
1 files changed, 79 insertions, 61 deletions
diff --git a/gdb/sparc64-tdep.c b/gdb/sparc64-tdep.c
index d1b04d7..acfbace 100644
--- a/gdb/sparc64-tdep.c
+++ b/gdb/sparc64-tdep.c
@@ -121,61 +121,89 @@ sparc64_structure_or_union_p (const struct type *type)
}
-/* Type for %pstate. */
-struct type *sparc64_pstate_type;
+/* Construct types for ISA-specific registers. */
-/* Type for %fsr. */
-struct type *sparc64_fsr_type;
+static struct type *
+sparc64_pstate_type (struct gdbarch *gdbarch)
+{
+ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
-/* Type for %fprs. */
-struct type *sparc64_fprs_type;
+ if (!tdep->sparc64_pstate_type)
+ {
+ struct type *type;
+
+ type = init_flags_type ("builtin_type_sparc64_pstate", 8);
+ append_flags_type_flag (type, 0, "AG");
+ append_flags_type_flag (type, 1, "IE");
+ append_flags_type_flag (type, 2, "PRIV");
+ append_flags_type_flag (type, 3, "AM");
+ append_flags_type_flag (type, 4, "PEF");
+ append_flags_type_flag (type, 5, "RED");
+ append_flags_type_flag (type, 8, "TLE");
+ append_flags_type_flag (type, 9, "CLE");
+ append_flags_type_flag (type, 10, "PID0");
+ append_flags_type_flag (type, 11, "PID1");
+
+ tdep->sparc64_pstate_type = type;
+ }
-/* Construct types for ISA-specific registers. */
+ return tdep->sparc64_pstate_type;
+}
-static void
-sparc64_init_types (void)
+static struct type *
+sparc64_fsr_type (struct gdbarch *gdbarch)
+{
+ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+
+ if (!tdep->sparc64_fsr_type)
+ {
+ struct type *type;
+
+ type = init_flags_type ("builtin_type_sparc64_fsr", 8);
+ append_flags_type_flag (type, 0, "NXA");
+ append_flags_type_flag (type, 1, "DZA");
+ append_flags_type_flag (type, 2, "UFA");
+ append_flags_type_flag (type, 3, "OFA");
+ append_flags_type_flag (type, 4, "NVA");
+ append_flags_type_flag (type, 5, "NXC");
+ append_flags_type_flag (type, 6, "DZC");
+ append_flags_type_flag (type, 7, "UFC");
+ append_flags_type_flag (type, 8, "OFC");
+ append_flags_type_flag (type, 9, "NVC");
+ append_flags_type_flag (type, 22, "NS");
+ append_flags_type_flag (type, 23, "NXM");
+ append_flags_type_flag (type, 24, "DZM");
+ append_flags_type_flag (type, 25, "UFM");
+ append_flags_type_flag (type, 26, "OFM");
+ append_flags_type_flag (type, 27, "NVM");
+
+ tdep->sparc64_fsr_type = type;
+ }
+
+ return tdep->sparc64_fsr_type;
+}
+
+static struct type *
+sparc64_fprs_type (struct gdbarch *gdbarch)
{
- struct type *type;
-
- type = init_flags_type ("builtin_type_sparc64_pstate", 8);
- append_flags_type_flag (type, 0, "AG");
- append_flags_type_flag (type, 1, "IE");
- append_flags_type_flag (type, 2, "PRIV");
- append_flags_type_flag (type, 3, "AM");
- append_flags_type_flag (type, 4, "PEF");
- append_flags_type_flag (type, 5, "RED");
- append_flags_type_flag (type, 8, "TLE");
- append_flags_type_flag (type, 9, "CLE");
- append_flags_type_flag (type, 10, "PID0");
- append_flags_type_flag (type, 11, "PID1");
- sparc64_pstate_type = type;
-
- type = init_flags_type ("builtin_type_sparc64_fsr", 8);
- append_flags_type_flag (type, 0, "NXA");
- append_flags_type_flag (type, 1, "DZA");
- append_flags_type_flag (type, 2, "UFA");
- append_flags_type_flag (type, 3, "OFA");
- append_flags_type_flag (type, 4, "NVA");
- append_flags_type_flag (type, 5, "NXC");
- append_flags_type_flag (type, 6, "DZC");
- append_flags_type_flag (type, 7, "UFC");
- append_flags_type_flag (type, 8, "OFC");
- append_flags_type_flag (type, 9, "NVC");
- append_flags_type_flag (type, 22, "NS");
- append_flags_type_flag (type, 23, "NXM");
- append_flags_type_flag (type, 24, "DZM");
- append_flags_type_flag (type, 25, "UFM");
- append_flags_type_flag (type, 26, "OFM");
- append_flags_type_flag (type, 27, "NVM");
- sparc64_fsr_type = type;
-
- type = init_flags_type ("builtin_type_sparc64_fprs", 8);
- append_flags_type_flag (type, 0, "DL");
- append_flags_type_flag (type, 1, "DU");
- append_flags_type_flag (type, 2, "FEF");
- sparc64_fprs_type = type;
+ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+
+ if (!tdep->sparc64_fprs_type)
+ {
+ struct type *type;
+
+ type = init_flags_type ("builtin_type_sparc64_fprs", 8);
+ append_flags_type_flag (type, 0, "DL");
+ append_flags_type_flag (type, 1, "DU");
+ append_flags_type_flag (type, 2, "FEF");
+
+ tdep->sparc64_fprs_type = type;
+ }
+
+ return tdep->sparc64_fprs_type;
}
+
/* Register information. */
static const char *sparc64_register_names[] =
@@ -261,9 +289,9 @@ sparc64_register_type (struct gdbarch *gdbarch, int regnum)
if (regnum == SPARC64_STATE_REGNUM)
return builtin_type (gdbarch)->builtin_int64;
if (regnum == SPARC64_FSR_REGNUM)
- return sparc64_fsr_type;
+ return sparc64_fsr_type (gdbarch);
if (regnum == SPARC64_FPRS_REGNUM)
- return sparc64_fprs_type;
+ return sparc64_fprs_type (gdbarch);
/* "Although Y is a 64-bit register, its high-order 32 bits are
reserved and always read as 0." */
if (regnum == SPARC64_Y_REGNUM)
@@ -274,7 +302,7 @@ sparc64_register_type (struct gdbarch *gdbarch, int regnum)
if (regnum == SPARC64_CWP_REGNUM)
return builtin_type (gdbarch)->builtin_int64;
if (regnum == SPARC64_PSTATE_REGNUM)
- return sparc64_pstate_type;
+ return sparc64_pstate_type (gdbarch);
if (regnum == SPARC64_ASI_REGNUM)
return builtin_type (gdbarch)->builtin_int64;
if (regnum == SPARC64_CCR_REGNUM)
@@ -1425,13 +1453,3 @@ sparc64_collect_fpregset (const struct regcache *regcache,
}
}
-
-/* Provide a prototype to silence -Wmissing-prototypes. */
-void _initialize_sparc64_tdep (void);
-
-void
-_initialize_sparc64_tdep (void)
-{
- /* Initialize the UltraSPARC-specific register types. */
- sparc64_init_types();
-}