🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: How can I get the current Instruction Address using asm language for intel i386

#182
From: Calvin
Date: Fri, 01 Nov 2002 05:56
67 lines
3214 bytes
"Iman Habib" <pixelpajas@hotmail.com> ���g��l�� news:dfb2581c.0210311605.22532859@posting.google.com...
> Hi.
>
> Is it a joke or is there a valid reason for the:
>
> > mov    eax, eax    ; EAX = EIP of THIS mov instruction :p
>
> i just not get it.. ??


In fact it is a joke to demostrate the eax being the instruction pointer of the MOV instruction,
but not the CALL instruction. I think it's important to make it clear.



>
> it seems to me that EIP is already moved to EAX
> at the line where it says:
>
> > mov    eax, [esp-4]
>
>
> really tired here.. to tired to understand a joke.. (if its a joke)
> please dont kill me for this remark.. i probably just need some sleep..


I need some sleep too! it should be

mov    eax, [esp + 4]



>
> //iman
>
>
>
> "Calvin" <foo@bar.com> wrote in message news:<apqb7h$a6h$1@tenorhorn.hk.dyxnet.com>...
> > You can make use of the stack and CALL/RET instruction
> >
> > provided the CALL instruction push the (E)IP on the stack
> > you can write a GetIP function like this:
> >
> > ; DWORD GetIP (void);
> > GetIP:
> >     mov eax, [esp-4]
> >     ret
> >
> >
> > call    GetIP
> > mov    eax, eax    ; EAX = EIP of THIS mov instruction :p
> >
> >
> > --
> >
> >
> >
> >
> >
> > "Edward" <yongtian@lucent.com> ���g��l�� news:3DC179AE.F8F77BB@lucent.com...
> > > I am trying to get the current instruction address.
> > > Does anybody give me a kindly suggestion?
> > >
> > > Thanks
> > >
> > >
>
Technical Details
Message-ID: <apt3gq$6vu$1@tenorhorn.hk.dyxnet.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!sn-xit-03!sn-xit-06!sn-post-01!supernews.com!corp.supernews.com!news.crayne.org!clax86!robomod!not-for-mail
References: <3DC179AE.F8F77BB@lucent.com> <apqb7h$a6h$1@tenorhorn.hk.dyxnet.com> <dfb2581c.0210311605.22532859@posting.google.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII
X-Google-Thread: 11318c,c1ae2bfd06633400
X-Google-Attributes: gid11318c,public
X-Google-Thread: 114917,c1ae2bfd06633400
X-Google-Attributes: gid114917,public
X-Google-ArrivalTime: 2002-10-31 23:56:37 PST
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!sn-xit-03!sn-xit-06!sn-post-01!supernews.com!corp.supernews.com!news.crayne.org!clax86!robomod!not-for-mail
From: "Calvin" <foo@bar.com>
Newsgroups: comp.lang.asm.x86,gnu.gcc.help
Subject: Re: How can I get the current Instruction Address using asm language for  intel i386
Approved: CLAX86 Moderators <ccrayne@crayne.org>
Date: Fri, 1 Nov 2002 05:56:06 +0000 (UTC)
Organization: Diyixian.com Ltd.
Message-ID: <apt3gq$6vu$1@tenorhorn.hk.dyxnet.com>
Sender: clax86@odin.asgard
References: <3DC179AE.F8F77BB@lucent.com> <apqb7h$a6h$1@tenorhorn.hk.dyxnet.com> <dfb2581c.0210311605.22532859@posting.google.com>
X-CLAX86-Policy: http://www.pacificsites.com/~ccrayne/clax86.html
X-CLAX86-Faq: http://www2.dgsys.com/~raymoon/x86faqs.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.
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.50.4807.1700
X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4807.1700
X-MailScanner: Found to be clean
X-UIDL: -+T!!@U1!!'K"#!V';"!
X-Complaints-To: abuse@supernews.com
Lines: 70