aboutsummaryrefslogtreecommitdiff
path: root/gdb/sh-tdep.c
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2004-10-06 08:57:38 +0000
committerCorinna Vinschen <corinna@vinschen.de>2004-10-06 08:57:38 +0000
commit9bed62d7af4f64fa3fd1f320d05da3d45bb4ea0a (patch)
tree07885a0ffd883aa6f2bfbe934e6f76f9247b99d6 /gdb/sh-tdep.c
parent03131d99d39823574e8c0369f43a4eed4e885ca8 (diff)
downloadbinutils-9bed62d7af4f64fa3fd1f320d05da3d45bb4ea0a.zip
binutils-9bed62d7af4f64fa3fd1f320d05da3d45bb4ea0a.tar.gz
binutils-9bed62d7af4f64fa3fd1f320d05da3d45bb4ea0a.tar.bz2
* sh-tdep.c (sh_pseudo_register_read): Add PSEUDO_BANK_REGNUM handling.
(sh_pseudo_register_write): Ditto.
Diffstat (limited to 'gdb/sh-tdep.c')
-rw-r--r--gdb/sh-tdep.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/gdb/sh-tdep.c b/gdb/sh-tdep.c
index 80a6be9..bfed703 100644
--- a/gdb/sh-tdep.c
+++ b/gdb/sh-tdep.c
@@ -1866,6 +1866,9 @@ sh_pseudo_register_read (struct gdbarch *gdbarch, struct regcache *regcache,
int base_regnum, portion;
char temp_buffer[MAX_REGISTER_SIZE];
+ if (reg_nr == PSEUDO_BANK_REGNUM)
+ regcache_raw_read (regcache, BANK_REGNUM, buffer);
+ else
if (reg_nr >= DR0_REGNUM && reg_nr <= DR_LAST_REGNUM)
{
base_regnum = dr_reg_base_num (reg_nr);
@@ -1902,7 +1905,19 @@ sh_pseudo_register_write (struct gdbarch *gdbarch, struct regcache *regcache,
int base_regnum, portion;
char temp_buffer[MAX_REGISTER_SIZE];
- if (reg_nr >= DR0_REGNUM && reg_nr <= DR_LAST_REGNUM)
+ if (reg_nr == PSEUDO_BANK_REGNUM)
+ {
+ /* When the bank register is written to, the whole register bank
+ is switched and all values in the bank registers must be read
+ from the target/sim again. We're just invalidating the regcache
+ so that a re-read happens next time it's necessary. */
+ int bregnum;
+
+ regcache_raw_write (regcache, BANK_REGNUM, buffer);
+ for (bregnum = R0_BANK0_REGNUM; bregnum < MACLB_REGNUM; ++bregnum)
+ set_register_cached (bregnum, 0);
+ }
+ else if (reg_nr >= DR0_REGNUM && reg_nr <= DR_LAST_REGNUM)
{
base_regnum = dr_reg_base_num (reg_nr);