🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.asm.x86
Article #57

Re: Absolute addresses, relative addresses

#57
From: hp
Date: Wed, 27 Aug 2003 08:23
40 lines
3299 bytes
Koms Bomb wrote:

> "Eric Minso" <minso@altern.org> wrote in message
> news:7db38e60.0308260511.4b9a371@posting.google.com...
> 
>> The main problem is that it seems that assembly language is required
>> and I still have some troubles with absolute and relative addresses.
> 
> No trouble.
> call @@1
> @@1:
> pop ebp
> Then you can use ebp and offset @@1 to do you relative address, then
> you needn't absolute address any more.
> As you said, there are a lot of virus source code in the internet, you can
> learn how they use above code to play relative address.

the above example is the common referencing method in relocatable code as
compiled by linux GCC which is certainly not to be mis-interpreted as a
'virus'. I use it with my 'lib4th' dll, too, and never run into trouble.

I should think that this method is common practice (since several decades).

a more efficient variant (cache 'friendly', faster), at&t syntax:
; ---

getref: movl (esp),ebx  ; att: "mov dwords source, destn"
        ret

relref: call getref
regref: lea coderef-regref(ebx),ecx     ; e.g, ref to label <coderef>
        ...

; ----

hp

-- 
>>> hp : lxhp in-berlin de <<<
linux,asm,forth http://www.lxhp.in-berlin.de/index-lx.html
Technical Details
Message-ID: <bihmae$nm3$1@news.eusc.inter.net>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-post-01!supernews.com!corp.supernews.com!news.crayne.org!clax86!robomod!not-for-mail
References: <7db38e60.0308250121.6135ebc1@posting.google.com> <bieiii$8dsqb$1@ID-165313.news.uni-berlin.de> <7db38e60.0308260511.4b9a371@posting.google.com> <bih2a5$9c0db$1@ID-165313.news.uni-berlin.de>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f7d8d,44f17f79ebe31523
X-Google-Attributes: gidf7d8d,public
X-Google-Thread: 1093da,44f17f79ebe31523
X-Google-Attributes: gid1093da,public
X-Google-Thread: feaef,44f17f79ebe31523
X-Google-Attributes: gidfeaef,public
X-Google-Thread: 114917,44f17f79ebe31523
X-Google-Attributes: gid114917,public
X-Google-ArrivalTime: 2003-08-27 02:56:58 PST
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-post-01!supernews.com!corp.supernews.com!news.crayne.org!clax86!robomod!not-for-mail
From: hp <phpr@snafu.de>
Newsgroups: comp.lang.asm.x86,alt.lang.asm,alt.os.assembly,borland.public.tasm
Subject: Re: Absolute addresses, relative addresses
Approved: CLAX86 Moderators <ccrayne@crayne.org>
Followup-To: comp.lang.asm.x86
Date: Wed, 27 Aug 2003 09:23:20 +0100
Organization: Lux1
Message-ID: <bihmae$nm3$1@news.eusc.inter.net>
X-CLAX86-Policy: http://www.pacificsites.com/~ccrayne/clax86.html
X-CLAX86-Faq: http://www.faqs.org/faqs/by-newsgroup/comp/comp.lang.asm.x86.html
X-CLAX86-Info-1: Send submissions to comp-lang-asm-x86@moderators.isc.org
X-CLAX86-Info-2: Send technical complaints to    ccrayne@crayne.org
X-CLAX86-Info-3: Send complaints about policy to ccrayne@crayne.org
X-Comment: moderators do not necessarily agree or disagree with this article.
References: <7db38e60.0308250121.6135ebc1@posting.google.com> <bieiii$8dsqb$1@ID-165313.news.uni-berlin.de> <7db38e60.0308260511.4b9a371@posting.google.com> <bih2a5$9c0db$1@ID-165313.news.uni-berlin.de>
Reply-To: phpr@snafu.de
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7Bit
X-MailScanner-Information: Please contact the ISP for more information
X-MailScanner: Found to be clean
X-MailScanner-SpamCheck: not spam (whitelisted), SpamAssassin (score=-2,
 required 4, EMAIL_ATTRIBUTION -0.50, QUOTED_EMAIL_TEXT -0.48,
 REFERENCES -0.50, REPLY_WITH_QUOTES -0.50)
X-UIDL: -9\"!h-R!!5Ba"!-aO"!
X-Complaints-To: abuse@supernews.com
Lines: 42