linux-c-programming.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Justinas <justinas@patikimi.lt>
To: siddharth vora <sjv@usc.edu>
Cc: sandeep <sandeep@codito.com>, A M <alim1993@yahoo.com>,
	linux-c-programming@vger.kernel.org,
	linux-assembly@vger.kernel.org
Subject: Re: Access to Program Counter in C
Date: Fri, 19 Nov 2004 10:03:00 +0200	[thread overview]
Message-ID: <20041119100300.731ff5ed@biesas.adminas.net> (raw)
In-Reply-To: <90db62064205.419d30cd@usc.edu>

On Thu, 18 Nov 2004 23:31:25 -0800
siddharth vora <sjv@usc.edu> wrote:

> 
> Try :
> 
>  Call ($+5)
>   pop ebp

yes, something like that.
In x86(DOS) when u do a call to near function(near, that means program don't change a code segment(CS) register) processot does something like this:
	mov	sp,sp-2
	mov	[sp],ip (next executable ip)

when call'e ret executed processor does:
	mov	ip,[sp]
	mov	sp,sp+2

so, you inscruction after call should be
	call <some function>
	mov  [ipdrr], sp-2
you'll get the IP if this instuction;]
I think u got the idea, look for call inctruction execution inside cpu for more details. I whote here with intension that cpu's word is 2B;]

_
Justinas Gulbinas
justinas@patikimi.lt

  reply	other threads:[~2004-11-19  8:03 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-11-19  7:31 Access to Program Counter in C siddharth vora
2004-11-19  8:03 ` Justinas [this message]
2004-11-19  8:04 ` sandeep
  -- strict thread matches above, loose matches on Subject: below --
2004-11-19  7:58 siddharth vora
2004-11-16 16:38 A M
2004-11-19  6:32 ` sandeep
2004-11-19 16:03 ` Glynn Clements

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20041119100300.731ff5ed@biesas.adminas.net \
    --to=justinas@patikimi.lt \
    --cc=alim1993@yahoo.com \
    --cc=linux-assembly@vger.kernel.org \
    --cc=linux-c-programming@vger.kernel.org \
    --cc=sandeep@codito.com \
    --cc=sjv@usc.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).