aboutsummaryrefslogtreecommitdiff
path: root/gdb/mips-tdep.c
diff options
context:
space:
mode:
authorAndrew Cagney <cagney@redhat.com>2003-11-16 04:57:25 +0000
committerAndrew Cagney <cagney@redhat.com>2003-11-16 04:57:25 +0000
commit5ef80fb0d122190295f7674990d2bf26b50262a5 (patch)
tree2b381e39ba3864e27f6aa333dec0f16d54585c85 /gdb/mips-tdep.c
parentf6f411cf91766d9e12dd45187587d1a464a8327f (diff)
downloadgdb-5ef80fb0d122190295f7674990d2bf26b50262a5.zip
gdb-5ef80fb0d122190295f7674990d2bf26b50262a5.tar.gz
gdb-5ef80fb0d122190295f7674990d2bf26b50262a5.tar.bz2
2003-11-15 Andrew Cagney <cagney@redhat.com>
* mips-tdep.c (mips_register_type): Simplify. Eliminate reference to MIPS_REGISTER_TYPE. Make integer registers signed. Make IRIX n32 registers 64 bit. (mips_register_raw_size, mips_register_byte): For pseudo registers, use the register's pseudo size and not the corresponding raw register's size. * config/mips/tm-mips64.h (MIPS_REGISTER_TYPE): Delete macro. * config/mips/tm-mips.h (MIPS_REGISTER_TYPE): Delete macro. * config/mips/tm-irix6.h: Don't #undef MIPS_REGISTER_TYPE. * config/mips/tm-irix5.h (MIPS_REGISTER_TYPE): Delete macro.
Diffstat (limited to 'gdb/mips-tdep.c')
-rw-r--r--gdb/mips-tdep.c65
1 files changed, 34 insertions, 31 deletions
diff --git a/gdb/mips-tdep.c b/gdb/mips-tdep.c
index 9342c40..962e821 100644
--- a/gdb/mips-tdep.c
+++ b/gdb/mips-tdep.c
@@ -649,9 +649,8 @@ mips_register_raw_size (int regnum)
else if (regnum < 2 * NUM_REGS)
{
/* For the moment map [NUM_REGS .. 2*NUM_REGS) onto the same raw
- registers, but always return the virtual size. */
- int rawnum = regnum % NUM_REGS;
- return TYPE_LENGTH (gdbarch_register_type (current_gdbarch, rawnum));
+ registers, but return the register's virtual size. */
+ return TYPE_LENGTH (gdbarch_register_type (current_gdbarch, regnum));
}
else
internal_error (__FILE__, __LINE__, "Register %d out of range", regnum);
@@ -681,8 +680,7 @@ mips_register_byte (int regnum)
/* Add space for all the proceeding registers based on their
real size. */
for (reg = NUM_REGS; reg < regnum; reg++)
- byte += TYPE_LENGTH (gdbarch_register_type (current_gdbarch,
- (reg % NUM_REGS)));
+ byte += TYPE_LENGTH (gdbarch_register_type (current_gdbarch, reg));
return byte;
}
else
@@ -762,35 +760,40 @@ mips_value_to_register (struct frame_info *frame, int regnum,
static struct type *
mips_register_type (struct gdbarch *gdbarch, int regnum)
{
- /* For moment, map [NUM_REGS .. 2*NUM_REGS) onto the same raw
- registers. Even return the same type. */
- int rawnum = regnum % NUM_REGS;
- gdb_assert (rawnum >= 0 && rawnum < NUM_REGS);
-#ifdef MIPS_REGISTER_TYPE
- return MIPS_REGISTER_TYPE (rawnum);
-#else
- if (FP0_REGNUM <= rawnum && rawnum < FP0_REGNUM + 32)
+ gdb_assert (regnum >= 0 && regnum < 2 * NUM_REGS);
+ if ((regnum % NUM_REGS) >= FP0_REGNUM
+ && (regnum % NUM_REGS) < FP0_REGNUM + 32)
{
- /* Floating point registers... */
- if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG)
- return builtin_type_ieee_double_big;
- else
- return builtin_type_ieee_double_little;
+ /* The floating-point registers raw, or cooked, always match
+ mips_regsize(), and also map 1:1, byte for byte. */
+ switch (gdbarch_byte_order (gdbarch))
+ {
+ case BFD_ENDIAN_BIG:
+ if (mips_regsize (gdbarch) == 4)
+ return builtin_type_ieee_single_big;
+ else
+ return builtin_type_ieee_double_big;
+ case BFD_ENDIAN_LITTLE:
+ if (mips_regsize (gdbarch) == 4)
+ return builtin_type_ieee_single_little;
+ else
+ return builtin_type_ieee_double_little;
+ case BFD_ENDIAN_UNKNOWN:
+ default:
+ internal_error (__FILE__, __LINE__, "bad switch");
+ }
}
- else if (rawnum == PS_REGNUM /* CR */)
- return builtin_type_uint32;
- else if (FCRCS_REGNUM <= rawnum && rawnum <= LAST_EMBED_REGNUM)
- return builtin_type_uint32;
+ else if (regnum >= (NUM_REGS + FCRCS_REGNUM)
+ && regnum <= NUM_REGS + LAST_EMBED_REGNUM)
+ /* The pseudo/cooked view of the embedded registers is always
+ 32-bit. The raw view is handled below. */
+ return builtin_type_int32;
+ else if (mips_regsize (gdbarch) == 8)
+ /* 64-bit ISA. */
+ return builtin_type_int64;
else
- {
- /* Everything else...
- Return type appropriate for width of register. */
- if (mips_regsize (current_gdbarch) == TYPE_LENGTH (builtin_type_uint64))
- return builtin_type_uint64;
- else
- return builtin_type_uint32;
- }
-#endif
+ /* 32-bit ISA. */
+ return builtin_type_int32;
}
/* TARGET_READ_SP -- Remove useless bits from the stack pointer. */