www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/06/09/18:27:23

Xref: news2.mv.net comp.os.msdos.djgpp:4775
From: Brian Drum <drum AT ix DOT netcom DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: Inline ASM and variables
Date: Sun, 09 Jun 1996 15:42:49 -0400
Organization: Netcom
Lines: 24
Message-ID: <31BB2939.58D3@ix.netcom.com>
NNTP-Posting-Host: knx-tn5-04.ix.netcom.com
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

I'm trying to learn how to use my newly aquired copy of DJGPP and am 
running into trouble with using the inline assembler.  When I have some 
inline assembly inside a function I can't access varialbes that are 
passed to the function.  For eaxample:

void foo(int x) {
  __asm__ __volatile__ ("
    movl _x, %%eax"
    :
    :
    :"eax" );
}

Won't work.  I get the following linker error:
test_asm.c(.text+0x4): undefined reference to `x'

I know that I could simply have GCC load x for me but that won't do in 
the more complicated things that I'm doing because I don't want to use 
up a bunch of registers.

Is there anyway to access these variables that are passed to the 
function?

Thanks.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019