aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorAndrew Cagney <cagney@redhat.com>2002-08-02 14:48:19 +0000
committerAndrew Cagney <cagney@redhat.com>2002-08-02 14:48:19 +0000
commitd8124050fd13563f995362c89e3ac581ec282678 (patch)
treec895c4e09fb8ea98d0b85a1eff02744709afbb4c /gdb
parentfd512f5c737a73747fd7c6017efb47c543d4c9f9 (diff)
downloadgdb-d8124050fd13563f995362c89e3ac581ec282678.zip
gdb-d8124050fd13563f995362c89e3ac581ec282678.tar.gz
gdb-d8124050fd13563f995362c89e3ac581ec282678.tar.bz2
2002-08-02 Andrew Cagney <cagney@redhat.com>
* gdbarch.sh (pseudo_register_read, pseudo_register_write): Replace the architecture methods register_read and register_write. * gdbarch.h, gdbarch.c: Regenerate. * regcache.c (init_regcache_descr): Update. (read_register_gen): Update. (write_register_gen): Update. (supply_register): Update comment. * sh-tdep.c (sh_gdbarch_init): Update. (sh_pseudo_register_read, sh64_pseudo_register_read): Add `regcache' and `gdbarch' parameters. Make `buffer' a void pointer. Update code. (sh_pseudo_register_write, sh64_pseudo_register_write): Add `regcache' and `gdbarch' parameters. Make `buffer' a constant void pointer. Update code. (sh64_register_write): Delete. (sh4_register_read): Delete. (sh64_register_read): Delete. (sh4_register_write): Delete. (sh_sh4_register_convert_to_raw): Make `from' parameter a constant void pointer, `to' parameter a void pointer. (sh_sh64_register_convert_to_raw): Ditto.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog26
-rw-r--r--gdb/gdbarch.c56
-rw-r--r--gdb/gdbarch.h16
-rwxr-xr-xgdb/gdbarch.sh4
-rw-r--r--gdb/regcache.c12
-rw-r--r--gdb/sh-tdep.c148
6 files changed, 124 insertions, 138 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 347b4bf..97b6d5b 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,28 @@
+2002-08-02 Andrew Cagney <cagney@redhat.com>
+
+ * gdbarch.sh (pseudo_register_read, pseudo_register_write):
+ Replace the architecture methods register_read and register_write.
+ * gdbarch.h, gdbarch.c: Regenerate.
+ * regcache.c (init_regcache_descr): Update.
+ (read_register_gen): Update.
+ (write_register_gen): Update.
+ (supply_register): Update comment.
+
+ * sh-tdep.c (sh_gdbarch_init): Update.
+ (sh_pseudo_register_read, sh64_pseudo_register_read): Add
+ `regcache' and `gdbarch' parameters. Make `buffer' a void
+ pointer. Update code.
+ (sh_pseudo_register_write, sh64_pseudo_register_write): Add
+ `regcache' and `gdbarch' parameters. Make `buffer' a constant
+ void pointer. Update code.
+ (sh64_register_write): Delete.
+ (sh4_register_read): Delete.
+ (sh64_register_read): Delete.
+ (sh4_register_write): Delete.
+ (sh_sh4_register_convert_to_raw): Make `from' parameter a constant
+ void pointer, `to' parameter a void pointer.
+ (sh_sh64_register_convert_to_raw): Ditto.
+
2002-08-01 Kevin Buettner <kevinb@redhat.com>
* mips-tdep.c (mips_register_virtual_type): Use architecture
@@ -149,7 +174,6 @@
* configure.host (gdb_host): Set to aix432 on AIX 4.3.2+.
* config/powerpc/aix432.mh: New file.
->>>>>>> 1.2978
2002-07-30 Daniel Jacobowitz <drow@mvista.com>
* ppc-linux-tdep.c (ELF_NGREG, ELF_NFPREG, ELF_NVRREG)
diff --git a/gdb/gdbarch.c b/gdb/gdbarch.c
index b9339e3..419d215 100644
--- a/gdb/gdbarch.c
+++ b/gdb/gdbarch.c
@@ -146,8 +146,8 @@ struct gdbarch
gdbarch_read_sp_ftype *read_sp;
gdbarch_write_sp_ftype *write_sp;
gdbarch_virtual_frame_pointer_ftype *virtual_frame_pointer;
- gdbarch_register_read_ftype *register_read;
- gdbarch_register_write_ftype *register_write;
+ gdbarch_pseudo_register_read_ftype *pseudo_register_read;
+ gdbarch_pseudo_register_write_ftype *pseudo_register_write;
int num_regs;
int num_pseudo_regs;
int sp_regnum;
@@ -602,8 +602,8 @@ verify_gdbarch (struct gdbarch *gdbarch)
/* Skip verify of read_sp, invalid_p == 0 */
/* Skip verify of write_sp, invalid_p == 0 */
/* Skip verify of virtual_frame_pointer, invalid_p == 0 */
- /* Skip verify of register_read, has predicate */
- /* Skip verify of register_write, has predicate */
+ /* Skip verify of pseudo_register_read, has predicate */
+ /* Skip verify of pseudo_register_write, has predicate */
if ((GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL)
&& (gdbarch->num_regs == -1))
fprintf_unfiltered (log, "\n\tnum_regs");
@@ -820,12 +820,12 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file)
(long) current_gdbarch->in_function_epilogue_p);
if (GDB_MULTI_ARCH)
fprintf_unfiltered (file,
- "gdbarch_dump: register_read = 0x%08lx\n",
- (long) current_gdbarch->register_read);
+ "gdbarch_dump: pseudo_register_read = 0x%08lx\n",
+ (long) current_gdbarch->pseudo_register_read);
if (GDB_MULTI_ARCH)
fprintf_unfiltered (file,
- "gdbarch_dump: register_write = 0x%08lx\n",
- (long) current_gdbarch->register_write);
+ "gdbarch_dump: pseudo_register_write = 0x%08lx\n",
+ (long) current_gdbarch->pseudo_register_write);
#ifdef ADDRESS_TO_POINTER
#if GDB_MULTI_ARCH
/* Macro might contain `[{}]' when not multi-arch */
@@ -2554,55 +2554,55 @@ set_gdbarch_virtual_frame_pointer (struct gdbarch *gdbarch,
}
int
-gdbarch_register_read_p (struct gdbarch *gdbarch)
+gdbarch_pseudo_register_read_p (struct gdbarch *gdbarch)
{
gdb_assert (gdbarch != NULL);
- return gdbarch->register_read != 0;
+ return gdbarch->pseudo_register_read != 0;
}
void
-gdbarch_register_read (struct gdbarch *gdbarch, int regnum, char *buf)
+gdbarch_pseudo_register_read (struct gdbarch *gdbarch, struct regcache *regcache, int cookednum, void *buf)
{
gdb_assert (gdbarch != NULL);
- if (gdbarch->register_read == 0)
+ if (gdbarch->pseudo_register_read == 0)
internal_error (__FILE__, __LINE__,
- "gdbarch: gdbarch_register_read invalid");
+ "gdbarch: gdbarch_pseudo_register_read invalid");
if (gdbarch_debug >= 2)
- fprintf_unfiltered (gdb_stdlog, "gdbarch_register_read called\n");
- gdbarch->register_read (gdbarch, regnum, buf);
+ fprintf_unfiltered (gdb_stdlog, "gdbarch_pseudo_register_read called\n");
+ gdbarch->pseudo_register_read (gdbarch, regcache, cookednum, buf);
}
void
-set_gdbarch_register_read (struct gdbarch *gdbarch,
- gdbarch_register_read_ftype register_read)
+set_gdbarch_pseudo_register_read (struct gdbarch *gdbarch,
+ gdbarch_pseudo_register_read_ftype pseudo_register_read)
{
- gdbarch->register_read = register_read;
+ gdbarch->pseudo_register_read = pseudo_register_read;
}
int
-gdbarch_register_write_p (struct gdbarch *gdbarch)
+gdbarch_pseudo_register_write_p (struct gdbarch *gdbarch)
{
gdb_assert (gdbarch != NULL);
- return gdbarch->register_write != 0;
+ return gdbarch->pseudo_register_write != 0;
}
void
-gdbarch_register_write (struct gdbarch *gdbarch, int regnum, char *buf)
+gdbarch_pseudo_register_write (struct gdbarch *gdbarch, struct regcache *regcache, int cookednum, const void *buf)
{
gdb_assert (gdbarch != NULL);
- if (gdbarch->register_write == 0)
+ if (gdbarch->pseudo_register_write == 0)
internal_error (__FILE__, __LINE__,
- "gdbarch: gdbarch_register_write invalid");
+ "gdbarch: gdbarch_pseudo_register_write invalid");
if (gdbarch_debug >= 2)
- fprintf_unfiltered (gdb_stdlog, "gdbarch_register_write called\n");
- gdbarch->register_write (gdbarch, regnum, buf);
+ fprintf_unfiltered (gdb_stdlog, "gdbarch_pseudo_register_write called\n");
+ gdbarch->pseudo_register_write (gdbarch, regcache, cookednum, buf);
}
void
-set_gdbarch_register_write (struct gdbarch *gdbarch,
- gdbarch_register_write_ftype register_write)
+set_gdbarch_pseudo_register_write (struct gdbarch *gdbarch,
+ gdbarch_pseudo_register_write_ftype pseudo_register_write)
{
- gdbarch->register_write = register_write;
+ gdbarch->pseudo_register_write = pseudo_register_write;
}
int
diff --git a/gdb/gdbarch.h b/gdb/gdbarch.h
index 9e23310..da33ef3 100644
--- a/gdb/gdbarch.h
+++ b/gdb/gdbarch.h
@@ -415,17 +415,17 @@ extern void set_gdbarch_virtual_frame_pointer (struct gdbarch *gdbarch, gdbarch_
#endif
#endif
-extern int gdbarch_register_read_p (struct gdbarch *gdbarch);
+extern int gdbarch_pseudo_register_read_p (struct gdbarch *gdbarch);
-typedef void (gdbarch_register_read_ftype) (struct gdbarch *gdbarch, int regnum, char *buf);
-extern void gdbarch_register_read (struct gdbarch *gdbarch, int regnum, char *buf);
-extern void set_gdbarch_register_read (struct gdbarch *gdbarch, gdbarch_register_read_ftype *register_read);
+typedef void (gdbarch_pseudo_register_read_ftype) (struct gdbarch *gdbarch, struct regcache *regcache, int cookednum, void *buf);
+extern void gdbarch_pseudo_register_read (struct gdbarch *gdbarch, struct regcache *regcache, int cookednum, void *buf);
+extern void set_gdbarch_pseudo_register_read (struct gdbarch *gdbarch, gdbarch_pseudo_register_read_ftype *pseudo_register_read);
-extern int gdbarch_register_write_p (struct gdbarch *gdbarch);
+extern int gdbarch_pseudo_register_write_p (struct gdbarch *gdbarch);
-typedef void (gdbarch_register_write_ftype) (struct gdbarch *gdbarch, int regnum, char *buf);
-extern void gdbarch_register_write (struct gdbarch *gdbarch, int regnum, char *buf);
-extern void set_gdbarch_register_write (struct gdbarch *gdbarch, gdbarch_register_write_ftype *register_write);
+typedef void (gdbarch_pseudo_register_write_ftype) (struct gdbarch *gdbarch, struct regcache *regcache, int cookednum, const void *buf);
+extern void gdbarch_pseudo_register_write (struct gdbarch *gdbarch, struct regcache *regcache, int cookednum, const void *buf);
+extern void set_gdbarch_pseudo_register_write (struct gdbarch *gdbarch, gdbarch_pseudo_register_write_ftype *pseudo_register_write);
extern int gdbarch_num_regs (struct gdbarch *gdbarch);
extern void set_gdbarch_num_regs (struct gdbarch *gdbarch, int num_regs);
diff --git a/gdb/gdbarch.sh b/gdb/gdbarch.sh
index f8b785b..734999e 100755
--- a/gdb/gdbarch.sh
+++ b/gdb/gdbarch.sh
@@ -428,8 +428,8 @@ f::TARGET_WRITE_SP:void:write_sp:CORE_ADDR val:val::0:generic_target_write_sp::0
# serious shakedown.
f::TARGET_VIRTUAL_FRAME_POINTER:void:virtual_frame_pointer:CORE_ADDR pc, int *frame_regnum, LONGEST *frame_offset:pc, frame_regnum, frame_offset::0:legacy_virtual_frame_pointer::0
#
-M:::void:register_read:int regnum, char *buf:regnum, buf:
-M:::void:register_write:int regnum, char *buf:regnum, buf:
+M:::void:pseudo_register_read:struct regcache *regcache, int cookednum, void *buf:regcache, cookednum, buf:
+M:::void:pseudo_register_write:struct regcache *regcache, int cookednum, const void *buf:regcache, cookednum, buf:
#
v:2:NUM_REGS:int:num_regs::::0:-1
# This macro gives the number of pseudo-registers that live in the
diff --git a/gdb/regcache.c b/gdb/regcache.c
index 592b3e5..7d4a8d6 100644
--- a/gdb/regcache.c
+++ b/gdb/regcache.c
@@ -143,8 +143,8 @@ init_regcache_descr (struct gdbarch *gdbarch)
/* If an old style architecture, construct the register cache
description using all the register macros. */
- if (!gdbarch_register_read_p (gdbarch)
- && !gdbarch_register_write_p (gdbarch))
+ if (!gdbarch_pseudo_register_read_p (gdbarch)
+ && !gdbarch_pseudo_register_write_p (gdbarch))
return init_legacy_regcache_descr (gdbarch);
descr = XMALLOC (struct regcache_descr);
@@ -724,7 +724,8 @@ read_register_gen (int regnum, char *buf)
if (regnum < current_regcache->descr->nr_raw_registers)
regcache_raw_read (current_regcache, regnum, buf);
else
- gdbarch_register_read (current_gdbarch, regnum, buf);
+ gdbarch_pseudo_register_read (current_gdbarch, current_regcache,
+ regnum, buf);
}
@@ -838,7 +839,8 @@ write_register_gen (int regnum, char *buf)
if (regnum < current_regcache->descr->nr_raw_registers)
regcache_raw_write (current_regcache, regnum, buf);
else
- gdbarch_register_write (current_gdbarch, regnum, buf);
+ gdbarch_pseudo_register_write (current_gdbarch, current_regcache,
+ regnum, buf);
}
/* Copy INLEN bytes of consecutive data from memory at MYADDR
@@ -1024,7 +1026,7 @@ supply_register (int regnum, const void *val)
/* NOTE: cagney/2001-03-16: The macro CLEAN_UP_REGISTER_VALUE is
going to be deprecated. Instead architectures will leave the raw
register value as is and instead clean things up as they pass
- through the method gdbarch_register_read() clean up the
+ through the method gdbarch_pseudo_register_read() clean up the
values. */
#ifdef DEPRECATED_CLEAN_UP_REGISTER_VALUE
diff --git a/gdb/sh-tdep.c b/gdb/sh-tdep.c
index 5beea29..67ebbf3 100644
--- a/gdb/sh-tdep.c
+++ b/gdb/sh-tdep.c
@@ -3331,7 +3331,7 @@ sh_sh64_register_convert_to_virtual (int regnum, struct type *type,
static void
sh_sh4_register_convert_to_raw (struct type *type, int regnum,
- char *from, char *to)
+ const void *from, void *to)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch);
@@ -3347,7 +3347,7 @@ sh_sh4_register_convert_to_raw (struct type *type, int regnum,
void
sh_sh64_register_convert_to_raw (struct type *type, int regnum,
- char *from, char *to)
+ const void *from, void *to)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch);
@@ -3371,11 +3371,12 @@ sh_sh64_register_convert_to_raw (struct type *type, int regnum,
}
void
-sh_pseudo_register_read (int reg_nr, char *buffer)
+sh_pseudo_register_read (struct gdbarch *gdbarch, struct regcache *regcache,
+ int reg_nr, void *buffer)
{
int base_regnum, portion;
char *temp_buffer = (char*) alloca (MAX_REGISTER_RAW_SIZE);
- struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch);
+ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
if (reg_nr >= tdep->DR0_REGNUM
&& reg_nr <= tdep->DR_LAST_REGNUM)
@@ -3385,7 +3386,7 @@ 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_raw_read (current_regcache, base_regnum + portion,
+ regcache_raw_read (regcache, base_regnum + portion,
(temp_buffer
+ REGISTER_RAW_SIZE (base_regnum) * portion));
/* We must pay attention to the endiannes. */
@@ -3400,30 +3401,21 @@ 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_raw_read (current_regcache, base_regnum + portion,
- buffer + REGISTER_RAW_SIZE (base_regnum) * portion);
+ regcache_raw_read (regcache, base_regnum + portion,
+ ((char *) buffer
+ + REGISTER_RAW_SIZE (base_regnum) * portion));
}
}
static void
-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_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);
-}
-
-static void
-sh64_pseudo_register_read (int reg_nr, char *buffer)
+sh64_pseudo_register_read (struct gdbarch *gdbarch, struct regcache *regcache,
+ int reg_nr, void *buffer)
{
int base_regnum;
int portion;
int offset = 0;
char *temp_buffer = (char*) alloca (MAX_REGISTER_RAW_SIZE);
- struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch);
+ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
if (reg_nr >= tdep->DR0_REGNUM
&& reg_nr <= tdep->DR_LAST_REGNUM)
@@ -3434,7 +3426,7 @@ 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_raw_read (current_regcache, base_regnum + portion,
+ regcache_raw_read (regcache, base_regnum + portion,
(temp_buffer
+ REGISTER_RAW_SIZE (base_regnum) * portion));
@@ -3453,8 +3445,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_raw_read (current_regcache, base_regnum + portion,
- (buffer
+ regcache_raw_read (regcache, base_regnum + portion,
+ ((char *) buffer
+ REGISTER_RAW_SIZE (base_regnum) * portion));
}
@@ -3467,8 +3459,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_raw_read (current_regcache, base_regnum + portion,
- (buffer
+ regcache_raw_read (regcache, base_regnum + portion,
+ ((char *) buffer
+ REGISTER_RAW_SIZE (base_regnum) * portion));
}
@@ -3479,7 +3471,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_raw_read (current_regcache, base_regnum, temp_buffer);
+ regcache_raw_read (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????*/
@@ -3493,7 +3485,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_raw_read (current_regcache, base_regnum, buffer);
+ regcache_raw_read (regcache, base_regnum, buffer);
}
else if (reg_nr >= tdep->DR0_C_REGNUM
@@ -3504,7 +3496,7 @@ 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_raw_read (current_regcache, base_regnum + portion,
+ regcache_raw_read (regcache, base_regnum + portion,
(temp_buffer
+ REGISTER_RAW_SIZE (base_regnum) * portion));
@@ -3522,8 +3514,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_raw_read (current_regcache, base_regnum + portion,
- (buffer
+ regcache_raw_read (regcache, base_regnum + portion,
+ ((char *) buffer
+ REGISTER_RAW_SIZE (base_regnum) * portion));
}
@@ -3555,11 +3547,11 @@ sh64_pseudo_register_read (int reg_nr, char *buffer)
*/
/* *INDENT-ON* */
/* Get FPSCR into a local buffer */
- regcache_raw_read (current_regcache, fpscr_base_regnum, temp_buffer);
+ regcache_raw_read (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_raw_read (current_regcache, sr_base_regnum, temp_buffer);
+ regcache_raw_read (regcache, sr_base_regnum, temp_buffer);
/* Get value as an int. */
sr_value = extract_unsigned_integer (temp_buffer, 4);
/* Build the new value. */
@@ -3577,28 +3569,17 @@ sh64_pseudo_register_read (int reg_nr, char *buffer)
/* FPUL_C register is floating point register 32,
same size, same endianness. */
- regcache_raw_read (current_regcache, base_regnum, buffer);
+ regcache_raw_read (regcache, base_regnum, buffer);
}
}
-static void
-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_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);
-}
-
void
-sh_pseudo_register_write (int reg_nr, char *buffer)
+sh_pseudo_register_write (struct gdbarch *gdbarch, struct regcache *regcache,
+ int reg_nr, const void *buffer)
{
int base_regnum, portion;
char *temp_buffer = (char*) alloca (MAX_REGISTER_RAW_SIZE);
- struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch);
+ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
if (reg_nr >= tdep->DR0_REGNUM
&& reg_nr <= tdep->DR_LAST_REGNUM)
@@ -3611,7 +3592,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 < 2; portion++)
- regcache_raw_write (current_regcache, base_regnum + portion,
+ regcache_raw_write (regcache, base_regnum + portion,
(temp_buffer
+ REGISTER_RAW_SIZE (base_regnum) * portion));
}
@@ -3622,30 +3603,20 @@ 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_raw_write (current_regcache, base_regnum + portion,
- (buffer
+ regcache_raw_write (regcache, base_regnum + portion,
+ ((char *) buffer
+ REGISTER_RAW_SIZE (base_regnum) * portion));
}
}
-static void
-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_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);
-}
-
void
-sh64_pseudo_register_write (int reg_nr, char *buffer)
+sh64_pseudo_register_write (struct gdbarch *gdbarch, struct regcache *regcache,
+ int reg_nr, const void *buffer)
{
int base_regnum, portion;
int offset;
char *temp_buffer = (char*) alloca (MAX_REGISTER_RAW_SIZE);
- struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch);
+ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
if (reg_nr >= tdep->DR0_REGNUM
&& reg_nr <= tdep->DR_LAST_REGNUM)
@@ -3658,7 +3629,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_raw_write (current_regcache, base_regnum + portion,
+ regcache_raw_write (regcache, base_regnum + portion,
(temp_buffer
+ REGISTER_RAW_SIZE (base_regnum) * portion));
}
@@ -3670,8 +3641,8 @@ 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_raw_write (current_regcache, base_regnum + portion,
- (buffer
+ regcache_raw_write (regcache, base_regnum + portion,
+ ((char *) buffer
+ REGISTER_RAW_SIZE (base_regnum) * portion));
}
@@ -3682,8 +3653,8 @@ 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_raw_write (current_regcache, base_regnum + portion,
- (buffer
+ regcache_raw_write (regcache, base_regnum + portion,
+ ((char *) buffer
+ REGISTER_RAW_SIZE (base_regnum) * portion));
}
@@ -3701,10 +3672,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_raw_read (current_regcache, base_regnum, temp_buffer);
+ regcache_raw_read (regcache, base_regnum, temp_buffer);
/* Write as an 8 byte quantity */
memcpy (temp_buffer + offset, buffer, 4);
- regcache_raw_write (current_regcache, base_regnum, temp_buffer);
+ regcache_raw_write (regcache, base_regnum, temp_buffer);
}
/* sh floating point compact pseudo registers. 1-to-1 with a shmedia
@@ -3713,7 +3684,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_raw_write (current_regcache, base_regnum, buffer);
+ regcache_raw_write (regcache, base_regnum, buffer);
}
else if (reg_nr >= tdep->DR0_C_REGNUM
@@ -3726,7 +3697,7 @@ 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_raw_write (current_regcache, base_regnum + portion,
+ regcache_raw_write (regcache, base_regnum + portion,
(temp_buffer
+ REGISTER_RAW_SIZE (base_regnum) * portion));
}
@@ -3739,8 +3710,8 @@ sh64_pseudo_register_write (int reg_nr, char *buffer)
for (portion = 0; portion < 4; portion++)
{
- regcache_raw_write (current_regcache, base_regnum + portion,
- (buffer
+ regcache_raw_write (regcache, base_regnum + portion,
+ ((char *) buffer
+ REGISTER_RAW_SIZE (base_regnum) * portion));
}
}
@@ -3783,39 +3754,28 @@ sh64_pseudo_register_write (int reg_nr, char *buffer)
fpscr_value = fpscr_c_value & fpscr_mask;
sr_value = (fpscr_value & sr_mask) >> 6;
- regcache_raw_read (current_regcache, fpscr_base_regnum, temp_buffer);
+ regcache_raw_read (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_raw_write (current_regcache, fpscr_base_regnum, temp_buffer);
+ regcache_raw_write (regcache, fpscr_base_regnum, temp_buffer);
- regcache_raw_read (current_regcache, sr_base_regnum, temp_buffer);
+ regcache_raw_read (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_raw_write (current_regcache, sr_base_regnum, temp_buffer);
+ regcache_raw_write (regcache, sr_base_regnum, temp_buffer);
}
else if (reg_nr == tdep->FPUL_C_REGNUM)
{
base_regnum = sh64_compact_reg_base_num (reg_nr);
- regcache_raw_write (current_regcache, base_regnum, buffer);
+ regcache_raw_write (regcache, base_regnum, buffer);
}
}
-static void
-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_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);
-}
-
/* Floating point vector of 4 float registers. */
static void
do_fv_register_info (int fv_regnum)
@@ -4448,8 +4408,8 @@ sh_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
set_gdbarch_num_pseudo_regs (gdbarch, 12);
set_gdbarch_max_register_raw_size (gdbarch, 4 * 4);
set_gdbarch_max_register_virtual_size (gdbarch, 4 * 4);
- set_gdbarch_register_read (gdbarch, sh4_register_read);
- set_gdbarch_register_write (gdbarch, sh4_register_write);
+ set_gdbarch_pseudo_register_read (gdbarch, sh_pseudo_register_read);
+ set_gdbarch_pseudo_register_write (gdbarch, sh_pseudo_register_write);
tdep->FPUL_REGNUM = 23;
tdep->FPSCR_REGNUM = 24;
tdep->FP_LAST_REGNUM = 40;
@@ -4540,8 +4500,8 @@ sh_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
/* Or should that go in the virtual_size? */
/*set_gdbarch_max_register_virtual_size (gdbarch, 8);*/
set_gdbarch_max_register_virtual_size (gdbarch, 4 * 4);
- set_gdbarch_register_read (gdbarch, sh64_register_read);
- set_gdbarch_register_write (gdbarch, sh64_register_write);
+ set_gdbarch_pseudo_register_read (gdbarch, sh64_pseudo_register_read);
+ set_gdbarch_pseudo_register_write (gdbarch, sh64_pseudo_register_write);
set_gdbarch_do_registers_info (gdbarch, sh64_do_registers_info);
set_gdbarch_frame_init_saved_regs (gdbarch, sh64_nofp_frame_init_saved_regs);