This is the mail archive of the
gdb@sourceware.cygnus.com
mailing list for the GDB project.
Re: ST(i) and MMj
> > * Change functions that read and write registers from/to memory to
> > handle the MMX registers specially by looking at the appropriate
> > ST(i) register instead.
>
> Which functions would these be, exactly?
>
> On the i386, both variable references and direct register references
> (like $eax) go through (via a torturous chain of calls)
> read_register_gen, which just reaches directly into the register file.
Okay, let's look at read_register_gen (I removed the irrelevant
clutter):
void
read_register_gen (regno, myaddr)
int regno;
char *myaddr;
{
if (!register_valid[regno])
target_fetch_registers (regno);
memcpy (myaddr, ®isters[REGISTER_BYTE (regno)],
REGISTER_RAW_SIZE (regno));
}
This can be changed like this:
1) Define REGISTER_RAW_SIZE to be 8 for MMX registers, and define
REGISTER_BYTE so that for MMX registers it goes to the data of
the according ST(i) register using the current TOS.
2) target_fetch_registers then will actually bring the value of the
appropriate ST(i) register when passed a regno of an MMX
register.
> I think I'd need to see a very specific explanation of how to do this,
> showing which functions to change, etc. Talking about it at a higher
> level is just getting confusing.
You are right. All functions in findvar.c that deal with registers
will have to be inspected, but just by looking at these functions, it
seems like a smart enough definition of REGISTER_* macros will do most
of the work. We might also need to update register_valid[] for an MMX
register together with its corresponding ST(i) register, though; this
might require to introduce a target-dependent function to update
register_valid[] when a given register REGNO is fetched (but code that
reads register_valid[] can be left intact).
If it will help, I can try to make these changes, once the MMX support
for x86 is in place.