www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/10/09/21:29:30

From: Nate Eldredge <neldredge AT hmc DOT edu>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Accessing variables in assembler
Date: Sat, 09 Oct 1999 17:58:52 -0700
Organization: Harvey Mudd College
Lines: 23
Message-ID: <37FFE4CC.83776382@hmc.edu>
References: <37FFB497 DOT 174422A AT ibm DOT net>
NNTP-Posting-Host: mercury.st.hmc.edu
Mime-Version: 1.0
X-Trace: nntp1.interworld.net 939517175 71758 134.173.45.219 (10 Oct 1999 00:59:35 GMT)
X-Complaints-To: usenet AT nntp1 DOT interworld DOT net
NNTP-Posting-Date: 10 Oct 1999 00:59:35 GMT
X-Mailer: Mozilla 4.61 [en] (X11; U; Linux 2.2.13pre12 i586)
X-Accept-Language: en
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

yhirsch wrote:
> 
> Hi,
>     I'm trying to access function variables inside __asm__ without
> loading them
>     in advance ( for example, ... : :"a"(my_int) - which loads my_int to
> %eax). How do
>     I access them inside the __asm__ part? When I opened the
> disassembler window,
>     it shows something like this: 0xc(%ebp), or something similar to
> this. How do I know
>     where they are in the memory? How do I access them?

You probably want something like

asm("frob %0" : : "g" (my_int));

The "g" constraint indicates that my_int can be in memory or in a
register.  %0 matches the 0th (i.e. first) operand.
-- 

Nate Eldredge
neldredge AT hmc DOT edu

- Raw text -


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