Mail Archives: djgpp/1995/07/23/00:27:51
>>>>> "Long" == Long Doan <ld AT jasmine DOT netrix DOT com> writes:
Long> |> 2) How do i reference a local variable (or label) or an
Long> argument passed to a |> function from an asm? _varname only
Long> seems to work with globals.
Long> You'll have to look at their orders (some might be optimized
Long> away!), and the offset them from %ebp.
This is _extremely_ bad advice, especially for local variables! I
can't believe you're suggesting it. Use gcc's asm operands to specify
input and output values, e.g.
void
foo (int a)
{
int x;
asm ("movl %1,%0"
: "=r" (x) /* Outputs */
: "g" (a) /* Inputs */);
printf ("%d\n", x);
}
This is all explained in the gcc docs.
-Mat
- Raw text -