Date: Thu, 7 Jan 1999 08:59:02 +0200 (IST) From: Eli Zaretskii X-Sender: eliz AT is To: Ng Wei Yang cc: djgpp AT delorie DOT com Subject: Re: problems porting ms inline assembly codes to linux (gnu - AT&T syntax) In-Reply-To: <771ai0$9kd$1@news5.jaring.my> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Reply-To: djgpp AT delorie DOT com 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.)