diff options
author | Andrew Cagney <cagney@redhat.com> | 2002-06-20 03:13:51 +0000 |
---|---|---|
committer | Andrew Cagney <cagney@redhat.com> | 2002-06-20 03:13:51 +0000 |
commit | 3fadccb31d170305dfcf1fb0ee9b24eab9d79da3 (patch) | |
tree | c2d851697a9dc475b3c1013f62e22278610389ad /gdb/sh-tdep.c | |
parent | e1820627dc17f5dcfad70db2d4087f926a24d1a1 (diff) | |
download | gdb-3fadccb31d170305dfcf1fb0ee9b24eab9d79da3.zip gdb-3fadccb31d170305dfcf1fb0ee9b24eab9d79da3.tar.gz gdb-3fadccb31d170305dfcf1fb0ee9b24eab9d79da3.tar.bz2 |
* regcache.h: Update copyright.
(struct regcache, struct gdbarch): Add opaque declarations.
(current_regcache): Declare global variable.
(regcache_read, regcache_write): Add gdbarch parameter.
(regcache_save, regcache_save_no_passthrough)
(regcache_restore, regcache_restore_no_passthrough)
(regcache_dup, regcache_dup_no_passthrough)
(regcache_cpy, regcache_cpy_no_passthrough)
(deprecated_grub_regcache_for_registers)
(deprecated_grub_regcache_for_register_valid)
(regcache_valid_p): Add function declarations.
* regcache.c: Update copyright.
(regcache_descr_handle): New global variable.
(struct regcache_descr): Define.
(init_legacy_regcache_descr, init_regcache_descr): New functions.
(regcache_descr, xfree_regcache_descr): New functions.
(struct regcache): Define.
(regcache_xmalloc, regcache_xfree): New functions.
(regcache_cpy, regcache_cpy_no_passthrough): New functions.
(regcache_dup, regcache_dup_no_passthrough): New functions.
(regcache_valid_p, regcache_read_as_address): New functions.
(deprecated_grub_regcache_for_registers): New function.
(deprecated_grub_regcache_for_register_valid): New function.
(current_regcache): New global variable.
(register_buffer): Add regcache parameter. Update calls.
(regcache_read, regcache_write): Add regcache parameter. Rewrite.
(read_register_gen, write_register_gen): Update register_buffer
call. Test for legacy_p instead of gdbarch_register_read_p or
gdbarch_register_write_p.
(regcache_collect): Update register_buffer call.
(build_regcache): Rewrite. Use deprecated grub functions.
(regcache_save, regcache_save_no_passthrough): New functions.
(regcache_restore, regcache_restore_no_passthrough): New
functions.
(_initialize_regcache): Create the regcache_data_handle. Swap
current_regcache global variable.
* sh-tdep.c (sh_pseudo_register_read): Add current_regcache
parameter to regcache_read and regcache_write calls.
(sh4_register_read): Ditto.
(sh64_pseudo_register_read): Ditto.
(sh64_register_read): Ditto.
(sh_pseudo_register_write): Ditto.
(sh4_register_write): Ditto.
(sh64_pseudo_register_write): Ditto.
(sh64_register_write): Ditto.
* defs.h (XCALLOC): Define.
Diffstat (limited to 'gdb/sh-tdep.c')
-rw-r--r-- | gdb/sh-tdep.c | 89 |
1 files changed, 46 insertions, 43 deletions
diff --git a/gdb/sh-tdep.c b/gdb/sh-tdep.c index a0117f0..2ef89fa 100644 --- a/gdb/sh-tdep.c +++ b/gdb/sh-tdep.c @@ -3385,9 +3385,9 @@ sh_pseudo_register_read (int reg_nr, char *buffer) /* Build the value in the provided buffer. */ /* Read the real regs for which this one is an alias. */ for (portion = 0; portion < 2; portion++) - regcache_read (base_regnum + portion, - temp_buffer - + REGISTER_RAW_SIZE (base_regnum) * portion); + regcache_read (current_regcache, base_regnum + portion, + (temp_buffer + + REGISTER_RAW_SIZE (base_regnum) * portion)); /* We must pay attention to the endiannes. */ sh_sh4_register_convert_to_virtual (reg_nr, REGISTER_VIRTUAL_TYPE (reg_nr), @@ -3400,7 +3400,7 @@ sh_pseudo_register_read (int reg_nr, char *buffer) /* Read the real regs for which this one is an alias. */ for (portion = 0; portion < 4; portion++) - regcache_read (base_regnum + portion, + regcache_read (current_regcache, base_regnum + portion, buffer + REGISTER_RAW_SIZE (base_regnum) * portion); } } @@ -3410,7 +3410,7 @@ sh4_register_read (struct gdbarch *gdbarch, int reg_nr, char *buffer) { if (reg_nr >= 0 && reg_nr < gdbarch_tdep (current_gdbarch)->DR0_REGNUM) /* It is a regular register. */ - regcache_read (reg_nr, buffer); + regcache_read (current_regcache, reg_nr, buffer); else /* It is a pseudo register and we need to construct its value */ sh_pseudo_register_read (reg_nr, buffer); @@ -3434,9 +3434,9 @@ sh64_pseudo_register_read (int reg_nr, char *buffer) /* DR regs are double precision registers obtained by concatenating 2 single precision floating point registers. */ for (portion = 0; portion < 2; portion++) - regcache_read (base_regnum + portion, - temp_buffer - + REGISTER_RAW_SIZE (base_regnum) * portion); + regcache_read (current_regcache, base_regnum + portion, + (temp_buffer + + REGISTER_RAW_SIZE (base_regnum) * portion)); /* We must pay attention to the endiannes. */ sh_sh64_register_convert_to_virtual (reg_nr, REGISTER_VIRTUAL_TYPE (reg_nr), @@ -3453,8 +3453,8 @@ sh64_pseudo_register_read (int reg_nr, char *buffer) /* FPP regs are pairs of single precision registers obtained by concatenating 2 single precision floating point registers. */ for (portion = 0; portion < 2; portion++) - regcache_read (base_regnum + portion, - buffer + REGISTER_RAW_SIZE (base_regnum) * portion); + regcache_read (current_regcache, base_regnum + portion, + buffer + REGISTER_RAW_SIZE (base_regnum) * portion); } else if (reg_nr >= tdep->FV0_REGNUM @@ -3466,8 +3466,8 @@ sh64_pseudo_register_read (int reg_nr, char *buffer) /* FV regs are vectors of single precision registers obtained by concatenating 4 single precision floating point registers. */ for (portion = 0; portion < 4; portion++) - regcache_read (base_regnum + portion, - buffer + REGISTER_RAW_SIZE (base_regnum) * portion); + regcache_read (current_regcache, base_regnum + portion, + buffer + REGISTER_RAW_SIZE (base_regnum) * portion); } /* sh compact pseudo registers. 1-to-1 with a shmedia register */ @@ -3477,7 +3477,7 @@ sh64_pseudo_register_read (int reg_nr, char *buffer) base_regnum = sh64_compact_reg_base_num (reg_nr); /* Build the value in the provided buffer. */ - regcache_read (base_regnum, temp_buffer); + regcache_read (current_regcache, base_regnum, temp_buffer); if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG) offset = 4; memcpy (buffer, temp_buffer + offset, 4); /* get LOWER 32 bits only????*/ @@ -3491,7 +3491,7 @@ sh64_pseudo_register_read (int reg_nr, char *buffer) /* Build the value in the provided buffer. */ /* Floating point registers map 1-1 to the media fp regs, they have the same size and endienness. */ - regcache_read (base_regnum, buffer); + regcache_read (current_regcache, base_regnum, buffer); } else if (reg_nr >= tdep->DR0_C_REGNUM @@ -3502,9 +3502,9 @@ sh64_pseudo_register_read (int reg_nr, char *buffer) /* DR_C regs are double precision registers obtained by concatenating 2 single precision floating point registers. */ for (portion = 0; portion < 2; portion++) - regcache_read (base_regnum + portion, - temp_buffer - + REGISTER_RAW_SIZE (base_regnum) * portion); + regcache_read (current_regcache, base_regnum + portion, + (temp_buffer + + REGISTER_RAW_SIZE (base_regnum) * portion)); /* We must pay attention to the endiannes. */ sh_sh64_register_convert_to_virtual (reg_nr, REGISTER_VIRTUAL_TYPE (reg_nr), @@ -3520,8 +3520,8 @@ sh64_pseudo_register_read (int reg_nr, char *buffer) /* FV_C regs are vectors of single precision registers obtained by concatenating 4 single precision floating point registers. */ for (portion = 0; portion < 4; portion++) - regcache_read (base_regnum + portion, - buffer + REGISTER_RAW_SIZE (base_regnum) * portion); + regcache_read (current_regcache, base_regnum + portion, + buffer + REGISTER_RAW_SIZE (base_regnum) * portion); } else if (reg_nr == tdep->FPSCR_C_REGNUM) @@ -3552,11 +3552,11 @@ sh64_pseudo_register_read (int reg_nr, char *buffer) */ /* *INDENT-ON* */ /* Get FPSCR into a local buffer */ - regcache_read (fpscr_base_regnum, temp_buffer); + regcache_read (current_regcache, fpscr_base_regnum, temp_buffer); /* Get value as an int. */ fpscr_value = extract_unsigned_integer (temp_buffer, 4); /* Get SR into a local buffer */ - regcache_read (sr_base_regnum, temp_buffer); + regcache_read (current_regcache, sr_base_regnum, temp_buffer); /* Get value as an int. */ sr_value = extract_unsigned_integer (temp_buffer, 4); /* Build the new value. */ @@ -3574,7 +3574,7 @@ sh64_pseudo_register_read (int reg_nr, char *buffer) /* FPUL_C register is floating point register 32, same size, same endianness. */ - regcache_read (base_regnum, buffer); + regcache_read (current_regcache, base_regnum, buffer); } } @@ -3584,7 +3584,7 @@ sh64_register_read (struct gdbarch *gdbarch, int reg_nr, char *buffer) if (reg_nr >= 0 && reg_nr < gdbarch_tdep (current_gdbarch)->DR0_REGNUM) /* It is a regular register. */ - regcache_read (reg_nr, buffer); + regcache_read (current_regcache, reg_nr, buffer); else /* It is a pseudo register and we need to construct its value */ sh64_pseudo_register_read (reg_nr, buffer); @@ -3608,8 +3608,9 @@ sh_pseudo_register_write (int reg_nr, char *buffer) /* Write the real regs for which this one is an alias. */ for (portion = 0; portion < 2; portion++) - regcache_write (base_regnum + portion, - temp_buffer + REGISTER_RAW_SIZE (base_regnum) * portion); + regcache_write (current_regcache, base_regnum + portion, + (temp_buffer + + REGISTER_RAW_SIZE (base_regnum) * portion)); } else if (reg_nr >= tdep->FV0_REGNUM && reg_nr <= tdep->FV_LAST_REGNUM) @@ -3618,7 +3619,7 @@ sh_pseudo_register_write (int reg_nr, char *buffer) /* Write the real regs for which this one is an alias. */ for (portion = 0; portion < 4; portion++) - regcache_write (base_regnum + portion, + regcache_write (current_regcache, base_regnum + portion, buffer + REGISTER_RAW_SIZE (base_regnum) * portion); } } @@ -3628,7 +3629,7 @@ sh4_register_write (struct gdbarch *gdbarch, int reg_nr, char *buffer) { if (reg_nr >= 0 && reg_nr < gdbarch_tdep (current_gdbarch)->DR0_REGNUM) /* It is a regular register. */ - regcache_write (reg_nr, buffer); + regcache_write (current_regcache, reg_nr, buffer); else /* It is a pseudo register and we need to construct its value */ sh_pseudo_register_write (reg_nr, buffer); @@ -3653,8 +3654,9 @@ sh64_pseudo_register_write (int reg_nr, char *buffer) /* Write the real regs for which this one is an alias. */ for (portion = 0; portion < 2; portion++) - regcache_write (base_regnum + portion, - temp_buffer + REGISTER_RAW_SIZE (base_regnum) * portion); + regcache_write (current_regcache, base_regnum + portion, + (temp_buffer + + REGISTER_RAW_SIZE (base_regnum) * portion)); } else if (reg_nr >= tdep->FPP0_REGNUM @@ -3664,7 +3666,7 @@ sh64_pseudo_register_write (int reg_nr, char *buffer) /* Write the real regs for which this one is an alias. */ for (portion = 0; portion < 2; portion++) - regcache_write (base_regnum + portion, + regcache_write (current_regcache, base_regnum + portion, buffer + REGISTER_RAW_SIZE (base_regnum) * portion); } @@ -3675,7 +3677,7 @@ sh64_pseudo_register_write (int reg_nr, char *buffer) /* Write the real regs for which this one is an alias. */ for (portion = 0; portion < 4; portion++) - regcache_write (base_regnum + portion, + regcache_write (current_regcache, base_regnum + portion, buffer + REGISTER_RAW_SIZE (base_regnum) * portion); } @@ -3693,10 +3695,10 @@ sh64_pseudo_register_write (int reg_nr, char *buffer) /* Let's read the value of the base register into a temporary buffer, so that overwriting the last four bytes with the new value of the pseudo will leave the upper 4 bytes unchanged. */ - regcache_read (base_regnum, temp_buffer); + regcache_read (current_regcache, base_regnum, temp_buffer); /* Write as an 8 byte quantity */ memcpy (temp_buffer + offset, buffer, 4); - regcache_write (base_regnum, temp_buffer); + regcache_write (current_regcache, base_regnum, temp_buffer); } /* sh floating point compact pseudo registers. 1-to-1 with a shmedia @@ -3705,7 +3707,7 @@ sh64_pseudo_register_write (int reg_nr, char *buffer) && reg_nr <= tdep->FP_LAST_C_REGNUM) { base_regnum = sh64_compact_reg_base_num (reg_nr); - regcache_write (base_regnum, buffer); + regcache_write (current_regcache, base_regnum, buffer); } else if (reg_nr >= tdep->DR0_C_REGNUM @@ -3718,8 +3720,9 @@ sh64_pseudo_register_write (int reg_nr, char *buffer) sh_sh64_register_convert_to_raw (REGISTER_VIRTUAL_TYPE (reg_nr), reg_nr, buffer, temp_buffer); - regcache_write (base_regnum + portion, - temp_buffer + REGISTER_RAW_SIZE (base_regnum) * portion); + regcache_write (current_regcache, base_regnum + portion, + (temp_buffer + + REGISTER_RAW_SIZE (base_regnum) * portion)); } } @@ -3730,7 +3733,7 @@ sh64_pseudo_register_write (int reg_nr, char *buffer) for (portion = 0; portion < 4; portion++) { - regcache_write (base_regnum + portion, + regcache_write (current_regcache, base_regnum + portion, buffer + REGISTER_RAW_SIZE (base_regnum) * portion); } } @@ -3773,25 +3776,25 @@ sh64_pseudo_register_write (int reg_nr, char *buffer) fpscr_value = fpscr_c_value & fpscr_mask; sr_value = (fpscr_value & sr_mask) >> 6; - regcache_read (fpscr_base_regnum, temp_buffer); + regcache_read (current_regcache, fpscr_base_regnum, temp_buffer); old_fpscr_value = extract_unsigned_integer (temp_buffer, 4); old_fpscr_value &= 0xfffc0002; fpscr_value |= old_fpscr_value; store_unsigned_integer (temp_buffer, 4, fpscr_value); - regcache_write (fpscr_base_regnum, temp_buffer); + regcache_write (current_regcache, fpscr_base_regnum, temp_buffer); - regcache_read (sr_base_regnum, temp_buffer); + regcache_read (current_regcache, sr_base_regnum, temp_buffer); old_sr_value = extract_unsigned_integer (temp_buffer, 4); old_sr_value &= 0xffff8fff; sr_value |= old_sr_value; store_unsigned_integer (temp_buffer, 4, sr_value); - regcache_write (sr_base_regnum, temp_buffer); + regcache_write (current_regcache, sr_base_regnum, temp_buffer); } else if (reg_nr == tdep->FPUL_C_REGNUM) { base_regnum = sh64_compact_reg_base_num (reg_nr); - regcache_write (base_regnum, buffer); + regcache_write (current_regcache, base_regnum, buffer); } } @@ -3800,7 +3803,7 @@ sh64_register_write (struct gdbarch *gdbarch, int reg_nr, char *buffer) { if (reg_nr >= 0 && reg_nr < gdbarch_tdep (current_gdbarch)->DR0_REGNUM) /* It is a regular register. */ - regcache_write (reg_nr, buffer); + regcache_write (current_regcache, reg_nr, buffer); else /* It is a pseudo register and we need to construct its value */ sh64_pseudo_register_write (reg_nr, buffer); |