2002-07-25 Andrew Cagney <cagney@redhat.com>
* regcache.c (struct regcache_descr): Rename nr_registers to nr_cooked_registers. Revise comments describing the structure member fields. (init_regcache_descr): Update. (init_legacy_regcache_descr): Update. (read_register_gen, write_register_gen): When a cooked register in the raw register range, directly access the value from the raw register cache.
This commit is contained in:
parent
1e3f0be004
commit
d138e37abc
2 changed files with 53 additions and 29 deletions
|
@ -1,3 +1,14 @@
|
||||||
|
2002-07-29 Andrew Cagney <cagney@redhat.com>
|
||||||
|
|
||||||
|
* regcache.c (struct regcache_descr): Rename nr_registers to
|
||||||
|
nr_cooked_registers. Revise comments describing the structure
|
||||||
|
member fields.
|
||||||
|
(init_regcache_descr): Update.
|
||||||
|
(init_legacy_regcache_descr): Update.
|
||||||
|
(read_register_gen, write_register_gen): When a cooked register in
|
||||||
|
the raw register range, directly access the value from the raw
|
||||||
|
register cache.
|
||||||
|
|
||||||
2002-07-29 Andrew Cagney <ac131313@redhat.com>
|
2002-07-29 Andrew Cagney <ac131313@redhat.com>
|
||||||
|
|
||||||
* z8k-tdep.c: Do not include "obstack.h".
|
* z8k-tdep.c: Do not include "obstack.h".
|
||||||
|
|
|
@ -56,22 +56,25 @@ struct regcache_descr
|
||||||
long sizeof_raw_registers;
|
long sizeof_raw_registers;
|
||||||
long sizeof_raw_register_valid_p;
|
long sizeof_raw_register_valid_p;
|
||||||
|
|
||||||
/* Offset, in bytes, of reach register in the raw register cache.
|
/* The cooked register space. Each cooked register in the range
|
||||||
Pseudo registers have an offset even though they don't
|
[0..NR_RAW_REGISTERS) is direct-mapped onto the corresponding raw
|
||||||
(shouldn't) have a correspoinding space in the register cache.
|
register. The remaining [NR_RAW_REGISTERS
|
||||||
It is to keep existing code, that relies on
|
.. NR_COOKED_REGISTERS) (a.k.a. pseudo regiters) are mapped onto
|
||||||
write/write_register_bytes working. */
|
both raw registers and memory by the architecture methods
|
||||||
|
gdbarch_register_read and gdbarch_register_write. */
|
||||||
|
int nr_cooked_registers;
|
||||||
|
|
||||||
|
/* Offset and size (in 8 bit bytes), of reach register in the
|
||||||
|
register cache. All registers (including those in the range
|
||||||
|
[NR_RAW_REGISTERS .. NR_COOKED_REGISTERS) are given an offset.
|
||||||
|
Assigning all registers an offset makes it possible to keep
|
||||||
|
legacy code, such as that found in read_register_bytes() and
|
||||||
|
write_register_bytes() working. */
|
||||||
long *register_offset;
|
long *register_offset;
|
||||||
|
|
||||||
/* The cooked / frame / virtual register space. The registers in
|
|
||||||
the range [0..NR_RAW_REGISTERS) should be mapped directly onto
|
|
||||||
the corresponding raw register. The next [NR_RAW_REGISTERS
|
|
||||||
.. NR_REGISTERS) should have been mapped, via
|
|
||||||
gdbarch_register_read/write onto either raw registers or memory. */
|
|
||||||
int nr_registers;
|
|
||||||
long *sizeof_register;
|
long *sizeof_register;
|
||||||
long max_register_size;
|
|
||||||
|
|
||||||
|
/* Useful constant. Largest of all the registers. */
|
||||||
|
long max_register_size;
|
||||||
};
|
};
|
||||||
|
|
||||||
static void *
|
static void *
|
||||||
|
@ -89,19 +92,19 @@ init_legacy_regcache_descr (struct gdbarch *gdbarch)
|
||||||
|
|
||||||
/* FIXME: cagney/2002-05-11: Shouldn't be including pseudo-registers
|
/* FIXME: cagney/2002-05-11: Shouldn't be including pseudo-registers
|
||||||
in the register buffer. Unfortunatly some architectures do. */
|
in the register buffer. Unfortunatly some architectures do. */
|
||||||
descr->nr_registers = NUM_REGS + NUM_PSEUDO_REGS;
|
descr->nr_cooked_registers = NUM_REGS + NUM_PSEUDO_REGS;
|
||||||
descr->nr_raw_registers = descr->nr_registers;
|
descr->nr_raw_registers = descr->nr_cooked_registers;
|
||||||
descr->sizeof_raw_register_valid_p = descr->nr_registers;
|
descr->sizeof_raw_register_valid_p = descr->nr_cooked_registers;
|
||||||
|
|
||||||
/* FIXME: cagney/2002-05-11: Instead of using REGISTER_BYTE() this
|
/* FIXME: cagney/2002-05-11: Instead of using REGISTER_BYTE() this
|
||||||
code should compute the offets et.al. at runtime. This currently
|
code should compute the offets et.al. at runtime. This currently
|
||||||
isn't possible because some targets overlap register locations -
|
isn't possible because some targets overlap register locations -
|
||||||
see the mess in read_register_bytes() and write_register_bytes()
|
see the mess in read_register_bytes() and write_register_bytes()
|
||||||
registers. */
|
registers. */
|
||||||
descr->sizeof_register = XCALLOC (descr->nr_registers, long);
|
descr->sizeof_register = XCALLOC (descr->nr_cooked_registers, long);
|
||||||
descr->register_offset = XCALLOC (descr->nr_registers, long);
|
descr->register_offset = XCALLOC (descr->nr_cooked_registers, long);
|
||||||
descr->max_register_size = 0;
|
descr->max_register_size = 0;
|
||||||
for (i = 0; i < descr->nr_registers; i++)
|
for (i = 0; i < descr->nr_cooked_registers; i++)
|
||||||
{
|
{
|
||||||
descr->register_offset[i] = REGISTER_BYTE (i);
|
descr->register_offset[i] = REGISTER_BYTE (i);
|
||||||
descr->sizeof_register[i] = REGISTER_RAW_SIZE (i);
|
descr->sizeof_register[i] = REGISTER_RAW_SIZE (i);
|
||||||
|
@ -111,7 +114,7 @@ init_legacy_regcache_descr (struct gdbarch *gdbarch)
|
||||||
|
|
||||||
/* Come up with the real size of the registers buffer. */
|
/* Come up with the real size of the registers buffer. */
|
||||||
descr->sizeof_raw_registers = REGISTER_BYTES; /* OK use. */
|
descr->sizeof_raw_registers = REGISTER_BYTES; /* OK use. */
|
||||||
for (i = 0; i < descr->nr_registers; i++)
|
for (i = 0; i < descr->nr_cooked_registers; i++)
|
||||||
{
|
{
|
||||||
long regend;
|
long regend;
|
||||||
/* Keep extending the buffer so that there is always enough
|
/* Keep extending the buffer so that there is always enough
|
||||||
|
@ -148,10 +151,10 @@ init_regcache_descr (struct gdbarch *gdbarch)
|
||||||
descr->gdbarch = gdbarch;
|
descr->gdbarch = gdbarch;
|
||||||
descr->legacy_p = 0;
|
descr->legacy_p = 0;
|
||||||
|
|
||||||
/* Total size of the register space. The raw registers should
|
/* Total size of the register space. The raw registers are mapped
|
||||||
directly map onto the raw register cache while the pseudo's are
|
directly onto the raw register cache while the pseudo's are
|
||||||
either mapped onto raw-registers or memory. */
|
either mapped onto raw-registers or memory. */
|
||||||
descr->nr_registers = NUM_REGS + NUM_PSEUDO_REGS;
|
descr->nr_cooked_registers = NUM_REGS + NUM_PSEUDO_REGS;
|
||||||
|
|
||||||
/* Construct a strictly RAW register cache. Don't allow pseudo's
|
/* Construct a strictly RAW register cache. Don't allow pseudo's
|
||||||
into the register cache. */
|
into the register cache. */
|
||||||
|
@ -170,10 +173,10 @@ init_regcache_descr (struct gdbarch *gdbarch)
|
||||||
|
|
||||||
{
|
{
|
||||||
long offset = 0;
|
long offset = 0;
|
||||||
descr->sizeof_register = XCALLOC (descr->nr_registers, long);
|
descr->sizeof_register = XCALLOC (descr->nr_cooked_registers, long);
|
||||||
descr->register_offset = XCALLOC (descr->nr_registers, long);
|
descr->register_offset = XCALLOC (descr->nr_cooked_registers, long);
|
||||||
descr->max_register_size = 0;
|
descr->max_register_size = 0;
|
||||||
for (i = 0; i < descr->nr_registers; i++)
|
for (i = 0; i < descr->nr_cooked_registers; i++)
|
||||||
{
|
{
|
||||||
descr->sizeof_register[i] = TYPE_LENGTH (REGISTER_VIRTUAL_TYPE (i));
|
descr->sizeof_register[i] = TYPE_LENGTH (REGISTER_VIRTUAL_TYPE (i));
|
||||||
descr->register_offset[i] = offset;
|
descr->register_offset[i] = offset;
|
||||||
|
@ -198,7 +201,7 @@ init_regcache_descr (struct gdbarch *gdbarch)
|
||||||
don't go into infinite recursion trying to, again, create the
|
don't go into infinite recursion trying to, again, create the
|
||||||
regcache. */
|
regcache. */
|
||||||
set_gdbarch_data (gdbarch, regcache_descr_handle, descr);
|
set_gdbarch_data (gdbarch, regcache_descr_handle, descr);
|
||||||
for (i = 0; i < descr->nr_registers; i++)
|
for (i = 0; i < descr->nr_cooked_registers; i++)
|
||||||
{
|
{
|
||||||
gdb_assert (descr->sizeof_register[i] == REGISTER_RAW_SIZE (i));
|
gdb_assert (descr->sizeof_register[i] == REGISTER_RAW_SIZE (i));
|
||||||
gdb_assert (descr->sizeof_register[i] == REGISTER_VIRTUAL_SIZE (i));
|
gdb_assert (descr->sizeof_register[i] == REGISTER_VIRTUAL_SIZE (i));
|
||||||
|
@ -716,6 +719,11 @@ read_register_gen (int regnum, char *buf)
|
||||||
legacy_read_register_gen (regnum, buf);
|
legacy_read_register_gen (regnum, buf);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
gdb_assert (regnum >= 0);
|
||||||
|
gdb_assert (regnum < current_regcache->descr->nr_cooked_registers);
|
||||||
|
if (regnum < current_regcache->descr->nr_raw_registers)
|
||||||
|
regcache_raw_read (current_regcache, regnum, buf);
|
||||||
|
else
|
||||||
gdbarch_register_read (current_gdbarch, regnum, buf);
|
gdbarch_register_read (current_gdbarch, regnum, buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -825,6 +833,11 @@ write_register_gen (int regnum, char *buf)
|
||||||
legacy_write_register_gen (regnum, buf);
|
legacy_write_register_gen (regnum, buf);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
gdb_assert (regnum >= 0);
|
||||||
|
gdb_assert (regnum < current_regcache->descr->nr_cooked_registers);
|
||||||
|
if (regnum < current_regcache->descr->nr_raw_registers)
|
||||||
|
regcache_raw_write (current_regcache, regnum, buf);
|
||||||
|
else
|
||||||
gdbarch_register_write (current_gdbarch, regnum, buf);
|
gdbarch_register_write (current_gdbarch, regnum, buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue