[RFA] regcache.c (register_fetched) + related changes

David Taylor
2001-02-27T14:25:00Z

Right now, we have:

. void register_changed (int regnum)
==> invalidates a single register REGNUM in the cache.

. void registers_changed (void)
==> indicate that registers may have changed, so invalidate the
cache.

. void registers_fetched (void)
==> indicate that all registers have been fetched, so mark them
all valid.

But, we don't have:

. void register_fetched (int regnum)
==> indicate that register REGNUM has been fetched.

I propose that we:

. add register_fetched

. change all the files that say
"register_valid[foo] = 1;" to instead say "register_fetched (foo);"

. change all the files that say
"register_valid[foo] = 0;" to instead say "register_changed (foo);"

. change all the files that say
"if (register_valid[regno])" or "if (!register_valid[regno])"
to instead say
"if (register_cached (regno))" or "if (!register_cached (regno))"

The following diff gets rid of all but 3 references to register_valid
from outside of regcache.c by *.c files from within the gdb directory.

Okay to commit?

ChangeLog:

Tue Feb 27 16:59:10 2001 David Taylor <taylor@redhat.com>

* regcache.c (register_fetched): New function.
* gdbcore.h (register_fetched): Declare it.
* alpha-nat.c (fetch_elf_core_registers): Replace references to
register_valid with appropriate function calls.
* arm-linux-nat.c (store_nwfpe_register, store_fpregister,
store_fpregs, store_register, store_regs, fill_gregset,
fill_fpregset): Ditto.
* i386gnu-nat.c (gnu_store_registers): Ditto.
* ia64-aix-nat.c (supply_gregset): Ditto.
* lynx-nat.c (fetch_inferior_registers, store_inferior_registers):
Ditto.
* remote-mips.c (mips_load): Ditto.
* remote-uid.c (udi_fetch_registers, store_register): Ditto.
* rs6000-nat.c (fetch_register): Ditto.
* sh-tdep.c (sh_fetch_pseudo_register, sh_store_pseudo_register):
Ditto.
* sparc-nat.c (fetch_inferior_registers,
store_inferior_registers): Ditto.

cvs server: Diffing .
Index: alpha-nat.c
===================================================================
RCS file: /cvs/src/src/gdb/alpha-nat.c,v
retrieving revision 1.5
diff -c -r1.5 alpha-nat.c
*** alpha-nat.c 2000/12/07 10:50:50 1.5
--- alpha-nat.c 2001/02/27 21:48:47
***************
*** 157,163 ****
memcpy (&registers[REGISTER_BYTE (PC_REGNUM)], core_reg_sect + 31 * 8, 8);
memset (&registers[REGISTER_BYTE (ZERO_REGNUM)], 0, 8);
memset (&register_valid[V0_REGNUM], 1, 32);
! register_valid[PC_REGNUM] = 1;
}
}

--- 157,163 ----
memcpy (&registers[REGISTER_BYTE (PC_REGNUM)], core_reg_sect + 31 * 8, 8);
memset (&registers[REGISTER_BYTE (ZERO_REGNUM)], 0, 8);
memset (&register_valid[V0_REGNUM], 1, 32);
! register_fetched (PC_REGNUM);
}
}

Index: arm-linux-nat.c
===================================================================
RCS file: /cvs/src/src/gdb/arm-linux-nat.c,v
retrieving revision 1.8
diff -c -r1.8 arm-linux-nat.c
*** arm-linux-nat.c 2001/02/06 19:59:05 1.8
--- arm-linux-nat.c 2001/02/27 21:48:48
***************
*** 198,204 ****
void
store_nwfpe_register (int regno, FPA11 * fpa11)
{
! if (register_valid[regno])
{
unsigned int fn = regno - F0_REGNUM;
switch (fpa11->fType[fn])
--- 198,204 ----
void
store_nwfpe_register (int regno, FPA11 * fpa11)
{
! if (register_cached (regno))
{
unsigned int fn = regno - F0_REGNUM;
switch (fpa11->fType[fn])
***************
*** 337,343 ****
}

/* Store fpsr. */
! if (FPS_REGNUM == regno && register_valid[FPS_REGNUM])
read_register_gen (FPS_REGNUM, (char *) &fp.fpsr);

/* Store the floating point register. */
--- 337,343 ----
}

/* Store fpsr. */
! if (FPS_REGNUM == regno && register_cached (FPS_REGNUM))
read_register_gen (FPS_REGNUM, (char *) &fp.fpsr);

/* Store the floating point register. */
***************
*** 375,381 ****
}

/* Store fpsr. */
! if (register_valid[FPS_REGNUM])
read_register_gen (FPS_REGNUM, (char *) &fp.fpsr);

/* Store the floating point registers. */
--- 375,381 ----
}

/* Store fpsr. */
! if (register_cached (FPS_REGNUM))
read_register_gen (FPS_REGNUM, (char *) &fp.fpsr);

/* Store the floating point registers. */
***************
*** 469,475 ****
int ret, tid;
struct pt_regs regs;

! if (!register_valid[regno])
return;

/* Get the thread id for the ptrace call. */
--- 469,475 ----
int ret, tid;
struct pt_regs regs;

! if (!register_cached (regno))
return;

/* Get the thread id for the ptrace call. */
***************
*** 513,519 ****

for (regno = A1_REGNUM; regno <= PC_REGNUM; regno++)
{
! if (register_valid[regno])
read_register_gen (regno, (char *) &regs.uregs[regno]);
}

--- 513,519 ----

for (regno = A1_REGNUM; regno <= PC_REGNUM; regno++)
{
! if (register_cached (regno))
read_register_gen (regno, (char *) &regs.uregs[regno]);
}

***************
*** 581,598 ****
{
int regnum;
for (regnum = A1_REGNUM; regnum <= PC_REGNUM; regnum++)
! if (register_valid[regnum])
read_register_gen (regnum, (char *) &(*gregsetp)[regnum]);
}
else if (regno >= A1_REGNUM && regno <= PC_REGNUM)
{
! if (register_valid[regno])
read_register_gen (regno, (char *) &(*gregsetp)[regno]);
}

if (PS_REGNUM == regno || -1 == regno)
{
! if (register_valid[regno] || -1 == regno)
{
if (arm_apcs_32)
read_register_gen (PS_REGNUM, (char *) &(*gregsetp)[CPSR_REGNUM]);
--- 581,598 ----
{
int regnum;
for (regnum = A1_REGNUM; regnum <= PC_REGNUM; regnum++)
! if (register_cached (regnum))
read_register_gen (regnum, (char *) &(*gregsetp)[regnum]);
}
else if (regno >= A1_REGNUM && regno <= PC_REGNUM)
{
! if (register_cached (regno))
read_register_gen (regno, (char *) &(*gregsetp)[regno]);
}

if (PS_REGNUM == regno || -1 == regno)
{
! if (-1 == regno || register_cached (regno))
{
if (arm_apcs_32)
read_register_gen (PS_REGNUM, (char *) &(*gregsetp)[CPSR_REGNUM]);
***************
*** 645,651 ****
}

/* Store fpsr. */
! if (register_valid[FPS_REGNUM])
if (FPS_REGNUM == regno || -1 == regno)
read_register_gen (FPS_REGNUM, (char *) &fp->fpsr);
}
--- 645,651 ----
}

/* Store fpsr. */
! if (register_cached (FPS_REGNUM))
if (FPS_REGNUM == regno || -1 == regno)
read_register_gen (FPS_REGNUM, (char *) &fp->fpsr);
}
Index: gdbcore.h
===================================================================
RCS file: /cvs/src/src/gdb/gdbcore.h,v
retrieving revision 1.5
diff -c -r1.5 gdbcore.h
*** gdbcore.h 2001/01/27 00:43:25 1.5
--- gdbcore.h 2001/02/27 21:48:55
***************
*** 109,114 ****
--- 109,115 ----
extern CORE_ADDR register_addr (int regno, CORE_ADDR blockend);

extern void registers_fetched (void);
+ extern void register_fetched (int regnum);

#if !defined (KERNEL_U_ADDR)
extern CORE_ADDR kernel_u_addr;
Index: i386gnu-nat.c
===================================================================
RCS file: /cvs/src/src/gdb/i386gnu-nat.c,v
retrieving revision 1.3
diff -c -r1.3 i386gnu-nat.c
*** i386gnu-nat.c 2000/12/17 00:35:58 1.3
--- i386gnu-nat.c 2001/02/27 21:48:55
***************
*** 314,327 ****
proc_debug (thread, "storing all registers");

for (i = 0; i < NUM_GREGS; i++)
! if (register_valid[i])
fill (state, i);
}
else
{
proc_debug (thread, "storing register %s", REGISTER_NAME (regno));

! gdb_assert (register_valid[regno]);
fill (state, regno);
}

--- 314,327 ----
proc_debug (thread, "storing all registers");

for (i = 0; i < NUM_GREGS; i++)
! if (register_cached (i))
fill (state, i);
}
else
{
proc_debug (thread, "storing register %s", REGISTER_NAME (regno));

! gdb_assert (register_cached (regno));
fill (state, regno);
}

Index: ia64-aix-nat.c
===================================================================
RCS file: /cvs/src/src/gdb/ia64-aix-nat.c,v
retrieving revision 1.1
diff -c -r1.1 ia64-aix-nat.c
*** ia64-aix-nat.c 2001/02/22 03:01:26 1.1
--- ia64-aix-nat.c 2001/02/27 21:48:55
***************
*** 70,80 ****
by other means. Those that aren't are already handled by the
code above. */
for (regi = IA64_GR32_REGNUM; regi <= IA64_GR127_REGNUM; regi++)
! register_valid[regi] = 1;
for (regi = IA64_PR0_REGNUM; regi <= IA64_PR63_REGNUM; regi++)
! register_valid[regi] = 1;
for (regi = IA64_VFP_REGNUM; regi <= NUM_REGS; regi++)
! register_valid[regi] = 1;
}

void
--- 70,80 ----
by other means. Those that aren't are already handled by the
code above. */
for (regi = IA64_GR32_REGNUM; regi <= IA64_GR127_REGNUM; regi++)
! register_fetched (regi);
for (regi = IA64_PR0_REGNUM; regi <= IA64_PR63_REGNUM; regi++)
! register_fetched (regi);
for (regi = IA64_VFP_REGNUM; regi <= NUM_REGS; regi++)
! register_fetched (regi);
}

void
Index: lynx-nat.c
===================================================================
RCS file: /cvs/src/src/gdb/lynx-nat.c,v
retrieving revision 1.5
diff -c -r1.5 lynx-nat.c
*** lynx-nat.c 2001/02/25 04:45:11 1.5
--- lynx-nat.c 2001/02/27 21:48:56
***************
*** 297,303 ****
memcpy (&registers[REGISTER_BYTE (G1_REGNUM)], &ec.g1,
4 * REGISTER_RAW_SIZE (G1_REGNUM));
for (i = G1_REGNUM; i <= G1_REGNUM + 3; i++)
! register_valid[i] = 1;

supply_register (PS_REGNUM, (char *) &ec.psr);
supply_register (Y_REGNUM, (char *) &ec.y);
--- 297,303 ----
memcpy (&registers[REGISTER_BYTE (G1_REGNUM)], &ec.g1,
4 * REGISTER_RAW_SIZE (G1_REGNUM));
for (i = G1_REGNUM; i <= G1_REGNUM + 3; i++)
! register_fetched (i);

supply_register (PS_REGNUM, (char *) &ec.psr);
supply_register (Y_REGNUM, (char *) &ec.y);
***************
*** 308,314 ****
memcpy (&registers[REGISTER_BYTE (O0_REGNUM)], ec.o,
8 * REGISTER_RAW_SIZE (O0_REGNUM));
for (i = O0_REGNUM; i <= O0_REGNUM + 7; i++)
! register_valid[i] = 1;
}

if (whatregs & WHATREGS_STACK)
--- 308,314 ----
memcpy (&registers[REGISTER_BYTE (O0_REGNUM)], ec.o,
8 * REGISTER_RAW_SIZE (O0_REGNUM));
for (i = O0_REGNUM; i <= O0_REGNUM + 7; i++)
! register_fetched (i);
}

if (whatregs & WHATREGS_STACK)
***************
*** 322,334 ****
&registers[REGISTER_BYTE (I0_REGNUM)],
8 * REGISTER_RAW_SIZE (I0_REGNUM));
for (i = I0_REGNUM; i <= I7_REGNUM; i++)
! register_valid[i] = 1;

target_read_memory (sp + FRAME_SAVED_L0,
&registers[REGISTER_BYTE (L0_REGNUM)],
8 * REGISTER_RAW_SIZE (L0_REGNUM));
for (i = L0_REGNUM; i <= L0_REGNUM + 7; i++)
! register_valid[i] = 1;
}

if (whatregs & WHATREGS_FLOAT)
--- 322,334 ----
&registers[REGISTER_BYTE (I0_REGNUM)],
8 * REGISTER_RAW_SIZE (I0_REGNUM));
for (i = I0_REGNUM; i <= I7_REGNUM; i++)
! register_fetched (i);

target_read_memory (sp + FRAME_SAVED_L0,
&registers[REGISTER_BYTE (L0_REGNUM)],
8 * REGISTER_RAW_SIZE (L0_REGNUM));
for (i = L0_REGNUM; i <= L0_REGNUM + 7; i++)
! register_fetched (i);
}

if (whatregs & WHATREGS_FLOAT)
***************
*** 346,352 ****
memcpy (&registers[REGISTER_BYTE (FP0_REGNUM)], fc.f.fregs,
32 * REGISTER_RAW_SIZE (FP0_REGNUM));
for (i = FP0_REGNUM; i <= FP0_REGNUM + 31; i++)
! register_valid[i] = 1;

supply_register (FPS_REGNUM, (char *) &fc.fsr);
}
--- 346,352 ----
memcpy (&registers[REGISTER_BYTE (FP0_REGNUM)], fc.f.fregs,
32 * REGISTER_RAW_SIZE (FP0_REGNUM));
for (i = FP0_REGNUM; i <= FP0_REGNUM + 31; i++)
! register_fetched (i);

supply_register (FPS_REGNUM, (char *) &fc.fsr);
}
***************
*** 409,415 ****

if (regno == -1 || regno == SP_REGNUM)
{
! if (!register_valid[L0_REGNUM + 5])
internal_error (__FILE__, __LINE__, "failed internal consistency check");
target_write_memory (sp + FRAME_SAVED_I0,
&registers[REGISTER_BYTE (I0_REGNUM)],
--- 409,415 ----

if (regno == -1 || regno == SP_REGNUM)
{
! if (!register_cached (L0_REGNUM + 5))
internal_error (__FILE__, __LINE__, "failed internal consistency check");
target_write_memory (sp + FRAME_SAVED_I0,
&registers[REGISTER_BYTE (I0_REGNUM)],
***************
*** 421,427 ****
}
else if (regno >= L0_REGNUM && regno <= I7_REGNUM)
{
! if (!register_valid[regno])
internal_error (__FILE__, __LINE__, "failed internal consistency check");
if (regno >= L0_REGNUM && regno <= L0_REGNUM + 7)
regoffset = REGISTER_BYTE (regno) - REGISTER_BYTE (L0_REGNUM)
--- 421,427 ----
}
else if (regno >= L0_REGNUM && regno <= I7_REGNUM)
{
! if (!register_cached (regno))
internal_error (__FILE__, __LINE__, "failed internal consistency check");
if (regno >= L0_REGNUM && regno <= L0_REGNUM + 7)
regoffset = REGISTER_BYTE (regno) - REGISTER_BYTE (L0_REGNUM)
Index: regcache.c
===================================================================
RCS file: /cvs/src/src/gdb/regcache.c,v
retrieving revision 1.17
diff -c -r1.17 regcache.c
*** regcache.c 2001/02/20 22:39:03 1.17
--- regcache.c 2001/02/27 21:48:57
***************
*** 190,195 ****
--- 190,205 ----
Fetching all real regs might not account for all pseudo-regs. */
}

+ /* REGISTER_FETCHED
+
+ Indicate that register REGNUM has been fetched, so mark it as valid. */
+
+ void
+ register_fetched (int regnum)
+ {
+ set_register_cached (regnum, 1);
+ }
+
/* read_register_bytes and write_register_bytes are generally a *BAD*
idea. They are inefficient because they need to check for partial
updates, which can only be done by scanning through all of the
Index: remote-mips.c
===================================================================
RCS file: /cvs/src/src/gdb/remote-mips.c,v
retrieving revision 1.17
diff -c -r1.17 remote-mips.c
*** remote-mips.c 2001/02/25 04:45:11 1.17
--- remote-mips.c 2001/02/27 21:49:00
***************
*** 3440,3446 ****
/* Work around problem where PMON monitor updates the PC after a load
to a different value than GDB thinks it has. The following ensures
that the write_pc() WILL update the PC value: */
! register_valid[PC_REGNUM] = 0;
}
if (exec_bfd)
write_pc (bfd_get_start_address (exec_bfd));
--- 3440,3446 ----
/* Work around problem where PMON monitor updates the PC after a load
to a different value than GDB thinks it has. The following ensures
that the write_pc() WILL update the PC value: */
! register_changed (PC_REGNUM);
}
if (exec_bfd)
write_pc (bfd_get_start_address (exec_bfd));
Index: remote-udi.c
===================================================================
RCS file: /cvs/src/src/gdb/remote-udi.c,v
retrieving revision 1.12
diff -c -r1.12 remote-udi.c
*** remote-udi.c 2001/02/02 23:04:14 1.12
--- remote-udi.c 2001/02/27 21:49:01
***************
*** 665,671 ****
if (err = UDIRead (From, To, Count, Size, &CountDone, HostEndian))
error ("UDIRead() failed in udi_fetch_registers");

! register_valid[GR1_REGNUM] = 1;

#if defined(GR64_REGNUM) /* Read gr64-127 */

--- 665,671 ----
if (err = UDIRead (From, To, Count, Size, &CountDone, HostEndian))
error ("UDIRead() failed in udi_fetch_registers");

! register_fetched (GR1_REGNUM);

#if defined(GR64_REGNUM) /* Read gr64-127 */

***************
*** 679,685 ****
error ("UDIRead() failed in udi_fetch_registers");

for (i = GR64_REGNUM; i < GR64_REGNUM + 32; i++)
! register_valid[i] = 1;

#endif /* GR64_REGNUM */

--- 679,685 ----
error ("UDIRead() failed in udi_fetch_registers");

for (i = GR64_REGNUM; i < GR64_REGNUM + 32; i++)
! register_fetched (i);

#endif /* GR64_REGNUM */

***************
*** 693,699 ****
error ("UDIRead() failed in udi_fetch_registers");

for (i = GR96_REGNUM; i < GR96_REGNUM + 32; i++)
! register_valid[i] = 1;

/* Local Registers */

--- 693,699 ----
error ("UDIRead() failed in udi_fetch_registers");

for (i = GR96_REGNUM; i < GR96_REGNUM + 32; i++)
! register_fetched (i);

/* Local Registers */

***************
*** 705,711 ****
error ("UDIRead() failed in udi_fetch_registers");

for (i = LR0_REGNUM; i < LR0_REGNUM + 128; i++)
! register_valid[i] = 1;

/* Protected Special Registers */

--- 705,711 ----
error ("UDIRead() failed in udi_fetch_registers");

for (i = LR0_REGNUM; i < LR0_REGNUM + 128; i++)
! register_fetched (i);

/* Protected Special Registers */

***************
*** 717,723 ****
error ("UDIRead() failed in udi_fetch_registers");

for (i = SR_REGNUM (0); i < SR_REGNUM (0) + 15; i++)
! register_valid[i] = 1;

if (USE_SHADOW_PC)
{ /* Let regno_to_srnum() handle the register number */
--- 717,723 ----
error ("UDIRead() failed in udi_fetch_registers");

for (i = SR_REGNUM (0); i < SR_REGNUM (0) + 15; i++)
! register_fetched (i);

if (USE_SHADOW_PC)
{ /* Let regno_to_srnum() handle the register number */
***************
*** 735,741 ****
error ("UDIRead() failed in udi_fetch_registers");

for (i = SR_REGNUM (128); i < SR_REGNUM (128) + 135 - 128 + 1; i++)
! register_valid[i] = 1;
}

if (remote_debug)
--- 735,741 ----
error ("UDIRead() failed in udi_fetch_registers");

for (i = SR_REGNUM (128); i < SR_REGNUM (128) + 135 - 128 + 1; i++)
! register_fetched (i);
}

if (remote_debug)
***************
*** 1506,1513 ****

/* Writing to this loc actually changes the values of pc0 & pc1 */

! register_valid[PC_REGNUM] = 0; /* pc1 */
! register_valid[NPC_REGNUM] = 0; /* pc0 */
}
else
/* An unprotected or protected special register */
--- 1506,1513 ----

/* Writing to this loc actually changes the values of pc0 & pc1 */

! register_changed (PC_REGNUM); /* pc1 */
! register_changed (NPC_REGNUM); /* pc0 */
}
else
/* An unprotected or protected special register */
Index: rs6000-nat.c
===================================================================
RCS file: /cvs/src/src/gdb/rs6000-nat.c,v
retrieving revision 1.14
diff -c -r1.14 rs6000-nat.c
*** rs6000-nat.c 2001/02/10 11:05:39 1.14
--- rs6000-nat.c 2001/02/27 21:49:02
***************
*** 233,239 ****
}

if (!errno)
! register_valid[regno] = 1;
else
{
#if 0
--- 233,239 ----
}

if (!errno)
! register_fetched (regno);
else
{
#if 0
Index: sh-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/sh-tdep.c,v
retrieving revision 1.30
diff -c -r1.30 sh-tdep.c
*** sh-tdep.c 2001/02/08 06:03:53 1.30
--- sh-tdep.c 2001/02/27 21:49:04
***************
*** 1649,1655 ****
target_fetch_registers (base_regnum + portion);

}
! register_valid [reg_nr] = 1;
}
}

--- 1649,1655 ----
target_fetch_registers (base_regnum + portion);

}
! register_fetched (reg_nr);
}
}

***************
*** 1666,1672 ****
/* Write the real regs for which this one is an alias. */
for (portion = 0; portion < 2; portion++)
{
! register_valid[base_regnum + portion] = 1;
target_store_registers (base_regnum + portion);
}
}
--- 1666,1672 ----
/* Write the real regs for which this one is an alias. */
for (portion = 0; portion < 2; portion++)
{
! register_fetched (base_regnum + portion);
target_store_registers (base_regnum + portion);
}
}
***************
*** 1678,1684 ****
/* Write the real regs for which this one is an alias. */
for (portion = 0; portion < 4; portion++)
{
! register_valid[base_regnum + portion] = 1;
target_store_registers (base_regnum + portion);
}
}
--- 1678,1684 ----
/* Write the real regs for which this one is an alias. */
for (portion = 0; portion < 4; portion++)
{
! register_fetched (base_regnum + portion);
target_store_registers (base_regnum + portion);
}
}
Index: sparc-nat.c
===================================================================
RCS file: /cvs/src/src/gdb/sparc-nat.c,v
retrieving revision 1.5
diff -c -r1.5 sparc-nat.c
*** sparc-nat.c 2001/02/25 04:45:11 1.5
--- sparc-nat.c 2001/02/27 21:49:04
***************
*** 70,76 ****
to the stack pointer. */
if (regno < O7_REGNUM /* including -1 */
|| regno >= Y_REGNUM
! || (!register_valid[SP_REGNUM] && regno < I7_REGNUM))
{
if (0 != ptrace (PTRACE_GETREGS, inferior_pid,
(PTRACE_ARG3_TYPE) & inferior_registers, 0))
--- 70,76 ----
to the stack pointer. */
if (regno < O7_REGNUM /* including -1 */
|| regno >= Y_REGNUM
! || (!register_cached (SP_REGNUM) && regno < I7_REGNUM))
{
if (0 != ptrace (PTRACE_GETREGS, inferior_pid,
(PTRACE_ARG3_TYPE) & inferior_registers, 0))
***************
*** 85,100 ****
*(int *) &registers[REGISTER_BYTE (Y_REGNUM)] = inferior_registers.r_y;

for (i = G0_REGNUM; i <= O7_REGNUM; i++)
! register_valid[i] = 1;
! register_valid[Y_REGNUM] = 1;
! register_valid[PS_REGNUM] = 1;
! register_valid[PC_REGNUM] = 1;
! register_valid[NPC_REGNUM] = 1;
/* If we don't set these valid, read_register_bytes() rereads
all the regs every time it is called! FIXME. */
! register_valid[WIM_REGNUM] = 1; /* Not true yet, FIXME */
! register_valid[TBR_REGNUM] = 1; /* Not true yet, FIXME */
! register_valid[CPS_REGNUM] = 1; /* Not true yet, FIXME */
}

/* Floating point registers */
--- 85,100 ----
*(int *) &registers[REGISTER_BYTE (Y_REGNUM)] = inferior_registers.r_y;

for (i = G0_REGNUM; i <= O7_REGNUM; i++)
! register_fetched (i);
! register_fetched (Y_REGNUM);
! register_fetched (PS_REGNUM);
! register_fetched (PC_REGNUM);
! register_fetched (NPC_REGNUM);
/* If we don't set these valid, read_register_bytes() rereads
all the regs every time it is called! FIXME. */
! register_fetched (WIM_REGNUM); /* Not true yet, FIXME */
! register_fetched (TBR_REGNUM); /* Not true yet, FIXME */
! register_fetched (CPS_REGNUM); /* Not true yet, FIXME */
}

/* Floating point registers */
***************
*** 112,119 ****
&inferior_fp_registers.Fpu_fsr,
sizeof (FPU_FSR_TYPE));
for (i = FP0_REGNUM; i <= FP0_REGNUM + 31; i++)
! register_valid[i] = 1;
! register_valid[FPS_REGNUM] = 1;
}

/* These regs are saved on the stack by the kernel. Only read them
--- 112,119 ----
&inferior_fp_registers.Fpu_fsr,
sizeof (FPU_FSR_TYPE));
for (i = FP0_REGNUM; i <= FP0_REGNUM + 31; i++)
! register_fetched (i);
! register_fetched (FPS_REGNUM);
}

/* These regs are saved on the stack by the kernel. Only read them
***************
*** 124,140 ****
&registers[REGISTER_BYTE (L0_REGNUM)],
16 * REGISTER_RAW_SIZE (L0_REGNUM));
for (i = L0_REGNUM; i <= I7_REGNUM; i++)
! register_valid[i] = 1;
}
else if (regno >= L0_REGNUM && regno <= I7_REGNUM)
{
CORE_ADDR sp = *(CORE_ADDR *) & registers[REGISTER_BYTE (SP_REGNUM)];
i = REGISTER_BYTE (regno);
! if (register_valid[regno])
printf_unfiltered ("register %d valid and read\n", regno);
target_read_memory (sp + i - REGISTER_BYTE (L0_REGNUM),
&registers[i], REGISTER_RAW_SIZE (regno));
! register_valid[regno] = 1;
}
}

--- 124,140 ----
&registers[REGISTER_BYTE (L0_REGNUM)],
16 * REGISTER_RAW_SIZE (L0_REGNUM));
for (i = L0_REGNUM; i <= I7_REGNUM; i++)
! register_fetched (i);
}
else if (regno >= L0_REGNUM && regno <= I7_REGNUM)
{
CORE_ADDR sp = *(CORE_ADDR *) & registers[REGISTER_BYTE (SP_REGNUM)];
i = REGISTER_BYTE (regno);
! if (register_cached (regno))
printf_unfiltered ("register %d valid and read\n", regno);
target_read_memory (sp + i - REGISTER_BYTE (L0_REGNUM),
&registers[i], REGISTER_RAW_SIZE (regno));
! register_fetched (regno);
}
}

***************
*** 194,200 ****

if (regno < 0 || regno == SP_REGNUM)
{
! if (!register_valid[L0_REGNUM + 5])
internal_error (__FILE__, __LINE__, "failed internal consistency check");
target_write_memory (sp,
&registers[REGISTER_BYTE (L0_REGNUM)],
--- 194,200 ----

if (regno < 0 || regno == SP_REGNUM)
{
! if (!register_cached (L0_REGNUM + 5))
internal_error (__FILE__, __LINE__, "failed internal consistency check");
target_write_memory (sp,
&registers[REGISTER_BYTE (L0_REGNUM)],
***************
*** 202,208 ****
}
else
{
! if (!register_valid[regno])
internal_error (__FILE__, __LINE__, "failed internal consistency check");
target_write_memory (sp + REGISTER_BYTE (regno) - REGISTER_BYTE (L0_REGNUM),
&registers[REGISTER_BYTE (regno)],
--- 202,208 ----
}
else
{
! if (!register_cached (regno))
internal_error (__FILE__, __LINE__, "failed internal consistency check");
target_write_memory (sp + REGISTER_BYTE (regno) - REGISTER_BYTE (L0_REGNUM),
&registers[REGISTER_BYTE (regno)],
***************
*** 213,219 ****

if (wanna_store & INT_REGS)
{
! if (!register_valid[G1_REGNUM])
internal_error (__FILE__, __LINE__, "failed internal consistency check");

memcpy (&inferior_registers.r_g1, &registers[REGISTER_BYTE (G1_REGNUM)],
--- 213,219 ----

if (wanna_store & INT_REGS)
{
! if (!register_cached (G1_REGNUM))
internal_error (__FILE__, __LINE__, "failed internal consistency check");

memcpy (&inferior_registers.r_g1, &registers[REGISTER_BYTE (G1_REGNUM)],
***************
*** 235,241 ****

if (wanna_store & FP_REGS)
{
! if (!register_valid[FP0_REGNUM + 9])
internal_error (__FILE__, __LINE__, "failed internal consistency check");
memcpy (&inferior_fp_registers, &registers[REGISTER_BYTE (FP0_REGNUM)],
sizeof inferior_fp_registers.fpu_fr);
--- 235,241 ----

if (wanna_store & FP_REGS)
{
! if (!register_cached (FP0_REGNUM + 9))
internal_error (__FILE__, __LINE__, "failed internal consistency check");
memcpy (&inferior_fp_registers, &registers[REGISTER_BYTE (FP0_REGNUM)],
sizeof inferior_fp_registers.fpu_fr);