accessing C arrays from within ASM

From: Phil Carmody (thefatphil_demunged_at_yahoo.co.uk)
Date: 01/21/04


Date: 21 Jan 2004 22:47:25 +0200

I've decided to biteteh bullet, and actually write (rather than
just tweak someone else's) asm - the first time in about 8 years,
so be gentle, please.

Equ's, res directives, and db's etc. I'm happy with, _however_
I can't see in Paul Carter's otherwise excellent tutorial how
to access C's global variables.

e.g. I've got in my C code:

signed long long bigvals[256];
unsigned char hashcounts[16384];
unsigned char hashrecords[16384][4];

What would I need to insert in my .nasm files to get access to those?
(the hashrecords above can be viewed as unsigned int [16384] if that
simplifies things, it's how I'll treat it anyway).

Feeling rather dim presently,
Phil

-- 
Unpatched IE vulnerability: window.open search injection
Description: cross-domain scripting, cookie/data/identity 
             theft, command execution
Reference: http://safecenter.net/liudieyu/WsFakeSrc/WsFakeSrc-Content.HTM
Exploit: http://safecenter.net/liudieyu/WsFakeSrc/WsFakeSrc-MyPage.htm


Relevant Pages

  • inline assemby question
    ... driver.c:1309: error: can't find a register in class 'DREG' while reloading 'asm' ... May be some one else has a good suggestion how to fix this. ... Fix wrong use of ## in PutMonoImageMacro macro. ... + unsigned char WinAAttributes; ...
    (comp.os.msdos.djgpp)
  • Re: Set all bits to 1 in an array of raw bytes
    ... you have invoked undefined behavior the first time ... through the loop. ... with every type, not just unsigned char, just rewrite the function). ...
    (comp.lang.c)
  • Re: Computer time -> Developer time -> User time?
    ... > but asm not ... There can't be an overflow in a modulo 2**n arithmetic. ...
    (alt.lang.asm)