Mail Archives: djgpp/1999/01/07/01:58:39
On Thu, 7 Jan 1999, Ng Wei Yang wrote:
> void initPermute(unsigned long *arg)
> {
> unsigned long temparray[arraysize];
> unsigned long *temp = temparray;
> unsigned char *table = tInitPermute;
>
> __asm__
> (
> //Initializes temp.
> "movl arraysize, %ecx \n"
> "movl temp, %esi \n"
> "movl $0, %eax \n"
You cannot directly reference local variables from inside inline
assembly. You need to reference them using the %N method (where N is
the ordinal number of the variable in the parameter list you put at
the end of the __asm__() pseudo-function. See the section "Extended
Asm" in the GCC docs and the header file sys/farptr.h, for examples.
One other thing: DJGPP prepends an underscore to C identifiers when it
generates assembly, so if you want to reference a global variable that
is declared in C as `foo', you generally need to write `_foo' in
assembly. (I'd guess that arraysize worked for you without an
underscore only because it was declared in the same source file.)
- Raw text -