This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
Re: [PATCH] Fix returning floating points values for x86
- To: Mark Kettenis <kettenis at wins dot uva dot nl>
- Subject: Re: [PATCH] Fix returning floating points values for x86
- From: Eli Zaretskii <eliz at is dot elta dot co dot il>
- Date: Thu, 12 Jul 2001 10:01:14 +0300 (IDT)
- cc: gdb-patches at sources dot redhat dot com
On Wed, 11 Jul 2001, Mark Kettenis wrote:
> The problem the patch solves is returning from a
> function with the GDB `return' command, or more specifically returning
> from a function that has a floating point return value.
You mean, the "return EXPRESSION" command, where EXPRESSION is an FP
expression, right?
> If we suppose that the FPU starts out in a freshly initialized state,
> with all registers empty and TOP set to 0, this means that we'll
> always end up with storing return values in the hardware register 7,
> i.e. with TOP set to 7. So it makes sense to reset the FPU to that
> state in i386_store_return_value. What value we choose for TOP is in
> principle irrelevant since FP0_REGNO always refers to %st(0). But we
> must mark the right register as valid (and all others as empty) in the
> tag word, and here the value of TOP does matter. If we don't mark the
> right register as valid, the caller of the function won't be able to
> pop the return value from the stack, and if we don't mark the other
> registers as empty we might trigger an unwanted stack overflow.
Okay, I think I understand now: you are simulating the state of the
FPU at function return point. Perhaps this should be added to the
comments.
Thanks.