+ COMMON_UISA_REG_NAMES,
+ PPC_UISA_SPR_NAMES,
+ PPC_SEGMENT_REG_NAMES,
+ PPC_32_OEA_SPR_NAMES,
+ /* 119 */ "hid0", "hid1", "iabr", "", "", "dmiss", "dcmp", "hash1",
+ /* 127 */ "hash2", "imiss", "icmp", "rpa"
+};
+
+char *register_names_604[] =
+{
+ COMMON_UISA_REG_NAMES,
+ PPC_UISA_SPR_NAMES,
+ PPC_SEGMENT_REG_NAMES,
+ PPC_32_OEA_SPR_NAMES,
+ /* 119 */ "hid0", "hid1", "iabr", "dabr", "pir", "mmcr0", "pmc1", "pmc2",
+ /* 127 */ "sia", "sda"
+};
+
+char *register_names_750[] =
+{
+ COMMON_UISA_REG_NAMES,
+ PPC_UISA_SPR_NAMES,
+ PPC_SEGMENT_REG_NAMES,
+ PPC_32_OEA_SPR_NAMES,
+ /* 119 */ "hid0", "hid1", "iabr", "dabr", "", "ummcr0", "upmc1", "upmc2",
+ /* 127 */ "usia", "ummcr1", "upmc3", "upmc4", "mmcr0", "pmc1", "pmc2",
+ /* 134 */ "sia", "mmcr1", "pmc3", "pmc4", "l2cr", "ictc", "thrm1", "thrm2",
+ /* 142 */ "thrm3"
+};
+
+
+/* Information about a particular processor variant. */
+struct variant
+ {
+ /* Name of this variant. */
+ char *name;
+
+ /* English description of the variant. */
+ char *description;
+
+ /* Table of register names; registers[R] is the name of the register
+ number R. */
+ int num_registers;
+ char **registers;
+ };
+
+#define num_registers(list) (sizeof (list) / sizeof((list)[0]))
+
+
+/* Information in this table comes from the following web sites:
+ IBM: http://www.chips.ibm.com:80/products/embedded/
+ Motorola: http://www.mot.com/SPS/PowerPC/
+
+ I'm sure I've got some of the variant descriptions not quite right.
+ Please report any inaccuracies you find to GDB's maintainer.
+
+ If you add entries to this table, please be sure to allow the new
+ value as an argument to the --with-cpu flag, in configure.in. */
+
+static struct variant
+ variants[] =
+{
+ {"ppc-uisa", "PowerPC UISA - a PPC processor as viewed by user-level code",
+ num_registers (register_names_uisa), register_names_uisa},
+ {"rs6000", "IBM RS6000 (\"POWER\") architecture, user-level view",
+ num_registers (register_names_rs6000), register_names_rs6000},
+ {"403", "IBM PowerPC 403",
+ num_registers (register_names_403), register_names_403},
+ {"403GC", "IBM PowerPC 403GC",
+ num_registers (register_names_403GC), register_names_403GC},
+ {"505", "Motorola PowerPC 505",
+ num_registers (register_names_505), register_names_505},
+ {"860", "Motorola PowerPC 860 or 850",
+ num_registers (register_names_860), register_names_860},
+ {"601", "Motorola PowerPC 601",
+ num_registers (register_names_601), register_names_601},
+ {"602", "Motorola PowerPC 602",
+ num_registers (register_names_602), register_names_602},
+ {"603", "Motorola/IBM PowerPC 603 or 603e",
+ num_registers (register_names_603), register_names_603},
+ {"604", "Motorola PowerPC 604 or 604e",
+ num_registers (register_names_604), register_names_604},
+ {"750", "Motorola/IBM PowerPC 750 or 740",
+ num_registers (register_names_750), register_names_750},
+ {0, 0, 0, 0}
+};
+
+
+static struct variant *current_variant;
+
+char *
+rs6000_register_name (int i)
+{
+ if (i < 0 || i >= NUM_REGS)
+ error ("GDB bug: rs6000-tdep.c (rs6000_register_name): strange register number");
+
+ return ((i < current_variant->num_registers)
+ ? current_variant->registers[i]
+ : "");
+}
+
+
+static void
+install_variant (struct variant *v)
+{
+ current_variant = v;
+}
+
+
+/* Look up the variant named NAME in the `variants' table. Return a
+ pointer to the struct variant, or null if we couldn't find it. */
+static struct variant *
+find_variant_by_name (char *name)
+{
+ int i;
+
+ for (i = 0; variants[i].name; i++)
+ if (!strcmp (name, variants[i].name))
+ return &variants[i];
+
+ return 0;
+}
+
+
+/* Install the PPC/RS6000 variant named NAME in the `variants' table.
+ Return zero if we installed it successfully, or a non-zero value if
+ we couldn't do it.
+
+ This might be useful to code outside this file, which doesn't want
+ to depend on the exact indices of the entries in the `variants'
+ table. Just make it non-static if you want that. */
+static int
+install_variant_by_name (char *name)
+{
+ struct variant *v = find_variant_by_name (name);
+
+ if (v)
+ {
+ install_variant (v);
+ return 0;
+ }
+ else
+ return 1;