-static void
-init_legacy_regcache_descr (struct gdbarch *gdbarch,
- struct regcache_descr *descr)
-{
- int i;
- /* FIXME: cagney/2002-05-11: gdbarch_data() should take that
- ``gdbarch'' as a parameter. */
- gdb_assert (gdbarch != NULL);
-
- /* Compute the offset of each register. Legacy architectures define
- DEPRECATED_REGISTER_BYTE() so use that. */
- /* FIXME: cagney/2002-11-07: Instead of using
- DEPRECATED_REGISTER_BYTE() this code should, as is done in
- init_regcache_descr(), compute the offets at runtime. This
- currently isn't possible as some ISAs define overlapping register
- regions - see the mess in read_register_bytes() and
- write_register_bytes() registers. */
- descr->sizeof_register
- = GDBARCH_OBSTACK_CALLOC (gdbarch, descr->nr_cooked_registers, long);
- descr->register_offset
- = GDBARCH_OBSTACK_CALLOC (gdbarch, descr->nr_cooked_registers, long);
- for (i = 0; i < descr->nr_cooked_registers; i++)
- {
- /* FIXME: cagney/2001-12-04: This code shouldn't need to use
- DEPRECATED_REGISTER_BYTE(). Unfortunately, legacy code likes
- to lay the buffer out so that certain registers just happen
- to overlap. Ulgh! New targets use gdbarch's register
- read/write and entirely avoid this uglyness. */
- descr->register_offset[i] = DEPRECATED_REGISTER_BYTE (i);
- descr->sizeof_register[i] = DEPRECATED_REGISTER_RAW_SIZE (i);
- gdb_assert (MAX_REGISTER_SIZE >= DEPRECATED_REGISTER_RAW_SIZE (i));
- gdb_assert (MAX_REGISTER_SIZE >= DEPRECATED_REGISTER_VIRTUAL_SIZE (i));
- }
-
- /* Compute the real size of the register buffer. Start out by
- trusting DEPRECATED_REGISTER_BYTES, but then adjust it upwards
- should that be found to not be sufficient. */
- /* FIXME: cagney/2002-11-05: Instead of using the macro
- DEPRECATED_REGISTER_BYTES, this code should, as is done in
- init_regcache_descr(), compute the total number of register bytes
- using the accumulated offsets. */
- descr->sizeof_cooked_registers = DEPRECATED_REGISTER_BYTES; /* OK */
- for (i = 0; i < descr->nr_cooked_registers; i++)
- {
- long regend;
- /* Keep extending the buffer so that there is always enough
- space for all registers. The comparison is necessary since
- legacy code is free to put registers in random places in the
- buffer separated by holes. Once DEPRECATED_REGISTER_BYTE()
- is killed this can be greatly simplified. */
- regend = descr->register_offset[i] + descr->sizeof_register[i];
- if (descr->sizeof_cooked_registers < regend)
- descr->sizeof_cooked_registers = regend;
- }
- /* FIXME: cagney/2002-05-11: Shouldn't be including pseudo-registers
- in the register cache. Unfortunately some architectures still
- rely on this and the pseudo_register_write() method. */
- descr->sizeof_raw_registers = descr->sizeof_cooked_registers;
-}
-