aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Cagney <cagney@redhat.com>2004-08-03 03:58:49 +0000
committerAndrew Cagney <cagney@redhat.com>2004-08-03 03:58:49 +0000
commit1d94326ff66409be65c133744ca8bdad6a41fb29 (patch)
treee5045c06dac562a37a0ce1e36dd002c44a362502
parent331ae7edef62361ede14f99995e83d6ff8f4b698 (diff)
downloadgdb-1d94326ff66409be65c133744ca8bdad6a41fb29.zip
gdb-1d94326ff66409be65c133744ca8bdad6a41fb29.tar.gz
gdb-1d94326ff66409be65c133744ca8bdad6a41fb29.tar.bz2
2004-08-02 Andrew Cagney <cagney@gnu.org>
* cris-tdep.c (cris_register_size): Restore function, still used locally.
-rw-r--r--gdb/ChangeLog3
-rw-r--r--gdb/cris-tdep.c39
2 files changed, 42 insertions, 0 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 5162fcd..11b07ea 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,8 @@
2004-08-02 Andrew Cagney <cagney@gnu.org>
+ * cris-tdep.c (cris_register_size): Restore function, still used
+ locally.
+
* gdbarch.sh (deprecated_target_read_fp)
(deprecated_frame_locals_address, deprecated_frame_args_address)
(deprecated_frame_chain_valid, deprecated_frame_chain)
diff --git a/gdb/cris-tdep.c b/gdb/cris-tdep.c
index 0d11fd1..1cb0d52 100644
--- a/gdb/cris-tdep.c
+++ b/gdb/cris-tdep.c
@@ -1096,6 +1096,45 @@ cris_spec_reg_applicable (struct cris_spec_reg spec_reg)
}
}
+/* Returns the register size in unit byte. Returns 0 for an unimplemented
+ register, -1 for an invalid register. */
+
+static int
+cris_register_size (int regno)
+{
+ int i;
+ int spec_regno;
+
+ if (regno >= 0 && regno < NUM_GENREGS)
+ {
+ /* General registers (R0 - R15) are 32 bits. */
+ return 4;
+ }
+ else if (regno >= NUM_GENREGS && regno < NUM_REGS)
+ {
+ /* Special register (R16 - R31). cris_spec_regs is zero-based.
+ Adjust regno accordingly. */
+ spec_regno = regno - NUM_GENREGS;
+
+ /* The entries in cris_spec_regs are stored in register number order,
+ which means we can shortcut into the array when searching it. */
+ for (i = spec_regno; cris_spec_regs[i].name != NULL; i++)
+ {
+ if (cris_spec_regs[i].number == spec_regno
+ && cris_spec_reg_applicable (cris_spec_regs[i]))
+ /* Go with the first applicable register. */
+ return cris_spec_regs[i].reg_size;
+ }
+ /* Special register not applicable to this CRIS version. */
+ return 0;
+ }
+ else
+ {
+ /* Invalid register. */
+ return -1;
+ }
+}
+
/* Nonzero if regno should not be fetched from the target. This is the case
for unimplemented (size 0) and non-existant registers. */