On Tue, Sep 23, 2014 at 12:41 PM, Andrew Haley <a...@redhat.com> wrote:
> On 09/23/2014 10:39 AM, Bin Meng wrote:
>> On Tue, Sep 23, 2014 at 5:11 PM, Bin Meng <bmeng...@gmail.com> wrote:
>>>
>>> Sorry I still don't get it. The inline-asm codes are put in the very end
>>> of the test function just before return, so the clobbered registers are
>>> not used by gcc.
>
> And neither are they used by the asm; so you have no right to expect %edx
> to contain anything, and neither have you the right to touch it.
>
> Do this:
>
>      asm volatile (
>      "pushl      %1;"
>      "call       *%%eax;"
>      "addl       $4, %%esp;"
>      : "=a"(status) : "m"(params_ptr), "a"(pcall), "d"(d)
>      );
>

I suppose doing "m" (*params_ptr) would also work.

Richard.

> "If you lie to the compiler, it will get its revenge." -- Henry Spencer
>
> Andrew.
>

Reply via email to