mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-29 16:38:05 +08:00
2002-08-18 Andrew Cagney <ac131313@redhat.com>
* regcache.c (regcache_xfer_part): New function. (regcache_raw_read_part): New function. (regcache_raw_write_part): New function. (regcache_cooked_read_part): New function. (regcache_cooked_write_part): New function. * regcache.h (regcache_raw_read_part): Declare. (regcache_raw_write_part): Declare. (regcache_cooked_read_part): Declare. (regcache_cooked_write_part): Declare.
This commit is contained in:
@ -1,3 +1,15 @@
|
|||||||
|
2002-08-18 Andrew Cagney <ac131313@redhat.com>
|
||||||
|
|
||||||
|
* regcache.c (regcache_xfer_part): New function.
|
||||||
|
(regcache_raw_read_part): New function.
|
||||||
|
(regcache_raw_write_part): New function.
|
||||||
|
(regcache_cooked_read_part): New function.
|
||||||
|
(regcache_cooked_write_part): New function.
|
||||||
|
* regcache.h (regcache_raw_read_part): Declare.
|
||||||
|
(regcache_raw_write_part): Declare.
|
||||||
|
(regcache_cooked_read_part): Declare.
|
||||||
|
(regcache_cooked_write_part): Declare.
|
||||||
|
|
||||||
2002-08-18 Daniel Jacobowitz <drow@mvista.com>
|
2002-08-18 Daniel Jacobowitz <drow@mvista.com>
|
||||||
|
|
||||||
* remote.c (remote_open_1): Add async_p.
|
* remote.c (remote_open_1): Add async_p.
|
||||||
|
@ -916,6 +916,86 @@ write_register_bytes (int myregstart, char *myaddr, int inlen)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Perform a partial register transfer using a read, modify, write
|
||||||
|
operation. */
|
||||||
|
|
||||||
|
typedef void (regcache_read_ftype) (struct regcache *regcache, int regnum,
|
||||||
|
void *buf);
|
||||||
|
typedef void (regcache_write_ftype) (struct regcache *regcache, int regnum,
|
||||||
|
const void *buf);
|
||||||
|
|
||||||
|
void
|
||||||
|
regcache_xfer_part (struct regcache *regcache, int regnum,
|
||||||
|
int offset, int len, void *in, const void *out,
|
||||||
|
regcache_read_ftype *read, regcache_write_ftype *write)
|
||||||
|
{
|
||||||
|
struct regcache_descr *descr = regcache->descr;
|
||||||
|
bfd_byte *reg = alloca (descr->max_register_size);
|
||||||
|
gdb_assert (offset >= 0 && offset <= descr->sizeof_register[regnum]);
|
||||||
|
gdb_assert (len >= 0 && offset + len <= descr->sizeof_register[regnum]);
|
||||||
|
/* Something to do? */
|
||||||
|
if (offset + len == 0)
|
||||||
|
return;
|
||||||
|
/* Read (when needed) ... */
|
||||||
|
if (in != NULL
|
||||||
|
|| offset > 0
|
||||||
|
|| offset + len < descr->sizeof_register[regnum])
|
||||||
|
{
|
||||||
|
gdb_assert (read != NULL);
|
||||||
|
read (regcache, regnum, reg);
|
||||||
|
}
|
||||||
|
/* ... modify ... */
|
||||||
|
if (in != NULL)
|
||||||
|
memcpy (in, reg + offset, len);
|
||||||
|
if (out != NULL)
|
||||||
|
memcpy (reg + offset, out, len);
|
||||||
|
/* ... write (when needed). */
|
||||||
|
if (out != NULL)
|
||||||
|
{
|
||||||
|
gdb_assert (write != NULL);
|
||||||
|
write (regcache, regnum, reg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
regcache_raw_read_part (struct regcache *regcache, int regnum,
|
||||||
|
int offset, int len, void *buf)
|
||||||
|
{
|
||||||
|
struct regcache_descr *descr = regcache->descr;
|
||||||
|
gdb_assert (regnum >= 0 && regnum < descr->nr_raw_registers);
|
||||||
|
regcache_xfer_part (regcache, regnum, offset, len, buf, NULL,
|
||||||
|
regcache_raw_read, regcache_raw_write);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
regcache_raw_write_part (struct regcache *regcache, int regnum,
|
||||||
|
int offset, int len, const void *buf)
|
||||||
|
{
|
||||||
|
struct regcache_descr *descr = regcache->descr;
|
||||||
|
gdb_assert (regnum >= 0 && regnum < descr->nr_raw_registers);
|
||||||
|
regcache_xfer_part (regcache, regnum, offset, len, NULL, buf,
|
||||||
|
regcache_raw_read, regcache_raw_write);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
regcache_cooked_read_part (struct regcache *regcache, int regnum,
|
||||||
|
int offset, int len, void *buf)
|
||||||
|
{
|
||||||
|
struct regcache_descr *descr = regcache->descr;
|
||||||
|
gdb_assert (regnum >= 0 && regnum < descr->nr_cooked_registers);
|
||||||
|
regcache_xfer_part (regcache, regnum, offset, len, buf, NULL,
|
||||||
|
regcache_cooked_read, regcache_cooked_write);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
regcache_cooked_write_part (struct regcache *regcache, int regnum,
|
||||||
|
int offset, int len, const void *buf)
|
||||||
|
{
|
||||||
|
struct regcache_descr *descr = regcache->descr;
|
||||||
|
gdb_assert (regnum >= 0 && regnum < descr->nr_cooked_registers);
|
||||||
|
regcache_xfer_part (regcache, regnum, offset, len, NULL, buf,
|
||||||
|
regcache_cooked_read, regcache_cooked_write);
|
||||||
|
}
|
||||||
|
|
||||||
/* Return the contents of register REGNUM as an unsigned integer. */
|
/* Return the contents of register REGNUM as an unsigned integer. */
|
||||||
|
|
||||||
|
@ -42,6 +42,15 @@ extern void regcache_raw_read_signed (struct regcache *regcache,
|
|||||||
int regnum, LONGEST *val);
|
int regnum, LONGEST *val);
|
||||||
extern void regcache_raw_read_unsigned (struct regcache *regcache,
|
extern void regcache_raw_read_unsigned (struct regcache *regcache,
|
||||||
int regnum, ULONGEST *val);
|
int regnum, ULONGEST *val);
|
||||||
|
|
||||||
|
/* Partial transfer of a raw registers. These perform read, modify,
|
||||||
|
write style operations. */
|
||||||
|
|
||||||
|
void regcache_raw_read_part (struct regcache *regcache, int regnum,
|
||||||
|
int offset, int len, void *buf);
|
||||||
|
void regcache_raw_write_part (struct regcache *regcache, int regnum,
|
||||||
|
int offset, int len, const void *buf);
|
||||||
|
|
||||||
int regcache_valid_p (struct regcache *regcache, int regnum);
|
int regcache_valid_p (struct regcache *regcache, int regnum);
|
||||||
|
|
||||||
/* Transfer a cooked register [0..NUM_REGS+NUM_PSEUDO_REGS). */
|
/* Transfer a cooked register [0..NUM_REGS+NUM_PSEUDO_REGS). */
|
||||||
@ -63,6 +72,14 @@ extern void regcache_cooked_read_signed (struct regcache *regcache,
|
|||||||
extern void regcache_cooked_read_unsigned (struct regcache *regcache,
|
extern void regcache_cooked_read_unsigned (struct regcache *regcache,
|
||||||
int regnum, ULONGEST *val);
|
int regnum, ULONGEST *val);
|
||||||
|
|
||||||
|
/* Partial transfer of a cooked register. These perform read, modify,
|
||||||
|
write style operations. */
|
||||||
|
|
||||||
|
void regcache_cooked_read_part (struct regcache *regcache, int regnum,
|
||||||
|
int offset, int len, void *buf);
|
||||||
|
void regcache_cooked_write_part (struct regcache *regcache, int regnum,
|
||||||
|
int offset, int len, const void *buf);
|
||||||
|
|
||||||
/* Transfer a raw register [0..NUM_REGS) between the regcache and the
|
/* Transfer a raw register [0..NUM_REGS) between the regcache and the
|
||||||
target. These functions are called by the target in response to a
|
target. These functions are called by the target in response to a
|
||||||
target_fetch_registers() or target_store_registers(). */
|
target_fetch_registers() or target_store_registers(). */
|
||||||
|
Reference in New Issue
Block a user