From 0818c12a55c2aba820b8f7c7774bcdc698b757ee Mon Sep 17 00:00:00 2001 From: Andrew Cagney Date: Wed, 24 Jul 2002 14:38:55 +0000 Subject: [PATCH] 2002-07-24 Andrew Cagney * regcache.h (regcache_raw_read, regcache_raw_write): Replace regcache_read and regcache_write. (regcache_raw_read_as_address): Replace regcache_read_as_address. * regcache.c: Update. * sh-tdep.c (sh64_push_arguments): Update comment. (sh_pseudo_register_read): Update. (sh_pseudo_register_write): Update. (sh4_register_read): Update. (sh4_register_write): Update. (sh64_pseudo_register_read): Update. (sh64_pseudo_register_write): Update. (sh64_register_read): Update. (sh64_register_write): Update. * i386-tdep.c (i386_extract_return_value): Update. (i386_extract_struct_value_address): Update. (i386_extract_return_value): Update. * blockframe.c (generic_read_register_dummy): Update. (generic_call_dummy_register_unwind): Update * infrun.c (write_inferior_status_register): Update. --- gdb/ChangeLog | 22 +++++++++ gdb/blockframe.c | 9 ++-- gdb/i386-tdep.c | 10 ++-- gdb/infrun.c | 2 +- gdb/regcache.c | 12 ++--- gdb/regcache.h | 6 +-- gdb/sh-tdep.c | 120 +++++++++++++++++++++++++---------------------- 7 files changed, 106 insertions(+), 75 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 917cf935af1..a3bdf19627f 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,25 @@ +2002-07-24 Andrew Cagney + + * regcache.h (regcache_raw_read, regcache_raw_write): Replace + regcache_read and regcache_write. + (regcache_raw_read_as_address): Replace regcache_read_as_address. + * regcache.c: Update. + * sh-tdep.c (sh64_push_arguments): Update comment. + (sh_pseudo_register_read): Update. + (sh_pseudo_register_write): Update. + (sh4_register_read): Update. + (sh4_register_write): Update. + (sh64_pseudo_register_read): Update. + (sh64_pseudo_register_write): Update. + (sh64_register_read): Update. + (sh64_register_write): Update. + * i386-tdep.c (i386_extract_return_value): Update. + (i386_extract_struct_value_address): Update. + (i386_extract_return_value): Update. + * blockframe.c (generic_read_register_dummy): Update. + (generic_call_dummy_register_unwind): Update + * infrun.c (write_inferior_status_register): Update. + 2002-07-23 Jim Blandy * parser-defs.h (expression_context_pc): Make this extern. diff --git a/gdb/blockframe.c b/gdb/blockframe.c index 25bc0005673..93a4765e7d5 100644 --- a/gdb/blockframe.c +++ b/gdb/blockframe.c @@ -1215,7 +1215,7 @@ generic_read_register_dummy (CORE_ADDR pc, CORE_ADDR fp, int regno) struct regcache *dummy_regs = generic_find_dummy_frame (pc, fp); if (dummy_regs) - return regcache_read_as_address (dummy_regs, regno); + return regcache_raw_read_as_address (dummy_regs, regno); else return 0; } @@ -1393,7 +1393,7 @@ generic_call_dummy_register_unwind (struct frame_info *frame, void **cache, gdbarch_register_read() method so that it, on the fly, constructs either a raw or pseudo register from the raw register cache. */ - regcache_read (registers, regnum, bufferp); + regcache_raw_read (registers, regnum, bufferp); } } @@ -1543,8 +1543,9 @@ generic_get_saved_register (char *raw_buffer, int *optimized, CORE_ADDR *addrp, gdbarch_register_read() method so that it, on the fly, constructs either a raw or pseudo register from the raw register cache. */ - regcache_read (generic_find_dummy_frame (frame->pc, frame->frame), - regnum, raw_buffer); + regcache_raw_read (generic_find_dummy_frame (frame->pc, + frame->frame), + regnum, raw_buffer); return; } diff --git a/gdb/i386-tdep.c b/gdb/i386-tdep.c index 342a71304c0..efdea9e3369 100644 --- a/gdb/i386-tdep.c +++ b/gdb/i386-tdep.c @@ -962,7 +962,7 @@ i386_extract_return_value (struct type *type, struct regcache *regcache, its contents to the desired type. This is probably not exactly how it would happen on the target itself, but it is the best we can do. */ - regcache_read (regcache, FP0_REGNUM, buf); + regcache_raw_read (regcache, FP0_REGNUM, buf); convert_typed_floating (buf, builtin_type_i387_ext, valbuf, type); } else @@ -972,14 +972,14 @@ i386_extract_return_value (struct type *type, struct regcache *regcache, if (len <= low_size) { - regcache_read (regcache, LOW_RETURN_REGNUM, buf); + regcache_raw_read (regcache, LOW_RETURN_REGNUM, buf); memcpy (valbuf, buf, len); } else if (len <= (low_size + high_size)) { - regcache_read (regcache, LOW_RETURN_REGNUM, buf); + regcache_raw_read (regcache, LOW_RETURN_REGNUM, buf); memcpy (valbuf, buf, low_size); - regcache_read (regcache, HIGH_RETURN_REGNUM, buf); + regcache_raw_read (regcache, HIGH_RETURN_REGNUM, buf); memcpy (valbuf + low_size, buf, len - low_size); } else @@ -1066,7 +1066,7 @@ i386_store_return_value (struct type *type, char *valbuf) static CORE_ADDR i386_extract_struct_value_address (struct regcache *regcache) { - return regcache_read_as_address (regcache, LOW_RETURN_REGNUM); + return regcache_raw_read_as_address (regcache, LOW_RETURN_REGNUM); } diff --git a/gdb/infrun.c b/gdb/infrun.c index 7c47e44c9de..672d5f93c65 100644 --- a/gdb/infrun.c +++ b/gdb/infrun.c @@ -3917,7 +3917,7 @@ write_inferior_status_register (struct inferior_status *inf_status, int regno, int size = REGISTER_RAW_SIZE (regno); void *buf = alloca (size); store_signed_integer (buf, size, val); - regcache_write (inf_status->registers, regno, buf); + regcache_raw_write (inf_status->registers, regno, buf); } /* Save all of the information associated with the inferior<==>gdb diff --git a/gdb/regcache.c b/gdb/regcache.c index 6927f3e5ee9..4f21942bf28 100644 --- a/gdb/regcache.c +++ b/gdb/regcache.c @@ -312,8 +312,8 @@ regcache_cpy (struct regcache *dst, struct regcache *src) for (i = 0; i < src->descr->nr_raw_registers; i++) { /* Should we worry about the valid bit here? */ - regcache_read (src, i, buf); - regcache_write (dst, i, buf); + regcache_raw_read (src, i, buf); + regcache_raw_write (dst, i, buf); } } @@ -362,13 +362,13 @@ regcache_valid_p (struct regcache *regcache, int regnum) } CORE_ADDR -regcache_read_as_address (struct regcache *regcache, int regnum) +regcache_raw_read_as_address (struct regcache *regcache, int regnum) { char *buf; gdb_assert (regcache != NULL); gdb_assert (regnum >= 0 && regnum < regcache->descr->nr_raw_registers); buf = alloca (regcache->descr->sizeof_register[regnum]); - regcache_read (regcache, regnum, buf); + regcache_raw_read (regcache, regnum, buf); return extract_address (buf, regcache->descr->sizeof_register[regnum]); } @@ -671,7 +671,7 @@ legacy_read_register_gen (int regnum, char *myaddr) } void -regcache_read (struct regcache *regcache, int regnum, char *buf) +regcache_raw_read (struct regcache *regcache, int regnum, char *buf) { gdb_assert (regcache != NULL && buf != NULL); gdb_assert (regnum >= 0 && regnum < regcache->descr->nr_raw_registers); @@ -761,7 +761,7 @@ legacy_write_register_gen (int regnum, char *myaddr) } void -regcache_write (struct regcache *regcache, int regnum, char *buf) +regcache_raw_write (struct regcache *regcache, int regnum, char *buf) { gdb_assert (regcache != NULL && buf != NULL); gdb_assert (regnum >= 0 && regnum < regcache->descr->nr_raw_registers); diff --git a/gdb/regcache.h b/gdb/regcache.h index 108b3faa6b4..7de8e2ebe37 100644 --- a/gdb/regcache.h +++ b/gdb/regcache.h @@ -35,10 +35,10 @@ struct regcache *regcache_xmalloc (struct gdbarch *gdbarch); /* Transfer a raw register [0..NUM_REGS) between core-gdb and the regcache. */ -void regcache_read (struct regcache *regcache, int rawnum, char *buf); -void regcache_write (struct regcache *regcache, int rawnum, char *buf); +void regcache_raw_read (struct regcache *regcache, int rawnum, char *buf); +void regcache_raw_write (struct regcache *regcache, int rawnum, char *buf); int regcache_valid_p (struct regcache *regcache, int regnum); -CORE_ADDR regcache_read_as_address (struct regcache *regcache, int rawnum); +CORE_ADDR regcache_raw_read_as_address (struct regcache *regcache, int rawnum); /* Transfer a raw register [0..NUM_REGS) between the regcache and the target. These functions are called by the target in response to a diff --git a/gdb/sh-tdep.c b/gdb/sh-tdep.c index 32d67820ce9..d840e5ae863 100644 --- a/gdb/sh-tdep.c +++ b/gdb/sh-tdep.c @@ -2251,11 +2251,12 @@ sh64_push_arguments (int nargs, struct value **args, CORE_ADDR sp, } #endif /* Note: must use write_register_gen here instead - of regcache_write, because regcache_write works - only for real registers, not pseudo. - write_register_gen will call the gdbarch - function to do register writes, and that will - properly know how to deal with pseudoregs. */ + of regcache_raw_write, because + regcache_raw_write works only for real + registers, not pseudo. write_register_gen will + call the gdbarch function to do register + writes, and that will properly know how to deal + with pseudoregs. */ write_register_gen (regnum, val); fp_args[double_arg_index] = 1; fp_args[double_arg_index + 1] = 1; @@ -3385,9 +3386,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 (current_regcache, base_regnum + portion, - (temp_buffer - + REGISTER_RAW_SIZE (base_regnum) * portion)); + regcache_raw_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,8 +3401,8 @@ 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 (current_regcache, base_regnum + portion, - buffer + REGISTER_RAW_SIZE (base_regnum) * portion); + regcache_raw_read (current_regcache, base_regnum + portion, + buffer + REGISTER_RAW_SIZE (base_regnum) * portion); } } @@ -3410,7 +3411,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 (current_regcache, reg_nr, buffer); + regcache_raw_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 +3435,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 (current_regcache, base_regnum + portion, - (temp_buffer - + REGISTER_RAW_SIZE (base_regnum) * portion)); + regcache_raw_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 +3454,9 @@ 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 (current_regcache, base_regnum + portion, - buffer + REGISTER_RAW_SIZE (base_regnum) * portion); + regcache_raw_read (current_regcache, base_regnum + portion, + (buffer + + REGISTER_RAW_SIZE (base_regnum) * portion)); } else if (reg_nr >= tdep->FV0_REGNUM @@ -3466,8 +3468,9 @@ 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 (current_regcache, base_regnum + portion, - buffer + REGISTER_RAW_SIZE (base_regnum) * portion); + regcache_raw_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 +3480,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 (current_regcache, base_regnum, temp_buffer); + regcache_raw_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 +3494,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 (current_regcache, base_regnum, buffer); + regcache_raw_read (current_regcache, base_regnum, buffer); } else if (reg_nr >= tdep->DR0_C_REGNUM @@ -3502,9 +3505,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 (current_regcache, base_regnum + portion, - (temp_buffer - + REGISTER_RAW_SIZE (base_regnum) * portion)); + regcache_raw_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 +3523,9 @@ 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 (current_regcache, base_regnum + portion, - buffer + REGISTER_RAW_SIZE (base_regnum) * portion); + regcache_raw_read (current_regcache, base_regnum + portion, + (buffer + + REGISTER_RAW_SIZE (base_regnum) * portion)); } else if (reg_nr == tdep->FPSCR_C_REGNUM) @@ -3552,11 +3556,11 @@ sh64_pseudo_register_read (int reg_nr, char *buffer) */ /* *INDENT-ON* */ /* Get FPSCR into a local buffer */ - regcache_read (current_regcache, fpscr_base_regnum, temp_buffer); + regcache_raw_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 (current_regcache, sr_base_regnum, temp_buffer); + regcache_raw_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 +3578,7 @@ sh64_pseudo_register_read (int reg_nr, char *buffer) /* FPUL_C register is floating point register 32, same size, same endianness. */ - regcache_read (current_regcache, base_regnum, buffer); + regcache_raw_read (current_regcache, base_regnum, buffer); } } @@ -3584,7 +3588,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 (current_regcache, reg_nr, buffer); + regcache_raw_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,9 +3612,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 (current_regcache, base_regnum + portion, - (temp_buffer - + REGISTER_RAW_SIZE (base_regnum) * portion)); + regcache_raw_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) @@ -3619,8 +3623,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 < 4; portion++) - regcache_write (current_regcache, base_regnum + portion, - buffer + REGISTER_RAW_SIZE (base_regnum) * portion); + regcache_raw_write (current_regcache, base_regnum + portion, + (buffer + + REGISTER_RAW_SIZE (base_regnum) * portion)); } } @@ -3629,7 +3634,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 (current_regcache, reg_nr, buffer); + regcache_raw_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); @@ -3654,9 +3659,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 (current_regcache, base_regnum + portion, - (temp_buffer - + REGISTER_RAW_SIZE (base_regnum) * portion)); + regcache_raw_write (current_regcache, base_regnum + portion, + (temp_buffer + + REGISTER_RAW_SIZE (base_regnum) * portion)); } else if (reg_nr >= tdep->FPP0_REGNUM @@ -3666,8 +3671,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 (current_regcache, base_regnum + portion, - buffer + REGISTER_RAW_SIZE (base_regnum) * portion); + regcache_raw_write (current_regcache, base_regnum + portion, + (buffer + + REGISTER_RAW_SIZE (base_regnum) * portion)); } else if (reg_nr >= tdep->FV0_REGNUM @@ -3677,8 +3683,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 < 4; portion++) - regcache_write (current_regcache, base_regnum + portion, - buffer + REGISTER_RAW_SIZE (base_regnum) * portion); + regcache_raw_write (current_regcache, base_regnum + portion, + (buffer + + REGISTER_RAW_SIZE (base_regnum) * portion)); } /* sh compact general pseudo registers. 1-to-1 with a shmedia @@ -3695,10 +3702,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 (current_regcache, base_regnum, temp_buffer); + regcache_raw_read (current_regcache, base_regnum, temp_buffer); /* Write as an 8 byte quantity */ memcpy (temp_buffer + offset, buffer, 4); - regcache_write (current_regcache, base_regnum, temp_buffer); + regcache_raw_write (current_regcache, base_regnum, temp_buffer); } /* sh floating point compact pseudo registers. 1-to-1 with a shmedia @@ -3707,7 +3714,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 (current_regcache, base_regnum, buffer); + regcache_raw_write (current_regcache, base_regnum, buffer); } else if (reg_nr >= tdep->DR0_C_REGNUM @@ -3720,9 +3727,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 (current_regcache, base_regnum + portion, - (temp_buffer - + REGISTER_RAW_SIZE (base_regnum) * portion)); + regcache_raw_write (current_regcache, base_regnum + portion, + (temp_buffer + + REGISTER_RAW_SIZE (base_regnum) * portion)); } } @@ -3733,8 +3740,9 @@ sh64_pseudo_register_write (int reg_nr, char *buffer) for (portion = 0; portion < 4; portion++) { - regcache_write (current_regcache, base_regnum + portion, - buffer + REGISTER_RAW_SIZE (base_regnum) * portion); + regcache_raw_write (current_regcache, base_regnum + portion, + (buffer + + REGISTER_RAW_SIZE (base_regnum) * portion)); } } @@ -3776,25 +3784,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 (current_regcache, fpscr_base_regnum, temp_buffer); + regcache_raw_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 (current_regcache, fpscr_base_regnum, temp_buffer); + regcache_raw_write (current_regcache, fpscr_base_regnum, temp_buffer); - regcache_read (current_regcache, sr_base_regnum, temp_buffer); + regcache_raw_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 (current_regcache, sr_base_regnum, temp_buffer); + regcache_raw_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 (current_regcache, base_regnum, buffer); + regcache_raw_write (current_regcache, base_regnum, buffer); } } @@ -3803,7 +3811,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 (current_regcache, reg_nr, buffer); + regcache_raw_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); -- 2.30.2