Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Assembly Language > Addresses in me...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 7 Topic 4984 of 5187
Post > Topic >>

Addresses in memory

by ljhffmn@[EMAIL PROTECTED] Apr 30, 2008 at 08:10 AM

I'm a simple hobbiest programmer with no formal education who recently
started working in Linux, I was screwing around on the internet the
other day and found a tutorial on creating super tiny elf
executables.  I did the tutorial and would now like to write a small
program that when run can print out the following list of things.

1.  Exact place in memory where the program starts and what is found
there.
2.  Exact memory location of the beginning of the elf header and how
it relates to #1.
3.  Exact length of ehdr and the location of the end of ehdr in memory
and what comes directly after that.
4.  Exact memory location of _start.
5.  Exact memory location and size of phdr.

Now I understand how to figure the size of any of the sections without
knowing exact memory addresses:

--Code--

ehdr:

.... ehdr stuff goes here ...

(at end of ehdr)
ehdrsize equ $ - ehdr

However, how would I look back into memory from within the .text
section and return the actual address of ehdr?
Is there any way of returning the actual address of the .text
section's beginning or maybe even the calling routine?

I have searched google pretty hard and I don't think I am going to
find any code examples there so I had hoped maybe one of you could
help.

Thanks for your help.
 




 7 Posts in Topic:
Addresses in memory
ljhffmn@[EMAIL PROTECTED]  2008-04-30 08:10:19 
Re: Addresses in memory
Frank Kotler <fbkotler  2008-04-30 21:13:06 
Re: Addresses in memory
Chuck Crayne <ccrayne@  2008-04-30 15:40:04 
Re: Addresses in memory
Frank Kotler <fbkotler  2008-05-01 00:28:43 
Re: Addresses in memory
Chuck Crayne <ccrayne@  2008-04-30 19:33:00 
Re: Addresses in memory
Frank Kotler <fbkotler  2008-05-01 06:26:06 
Re: Addresses in memory
Herbert Kleebauer <kle  2008-05-01 14:19:39 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Wed Dec 3 16:36:08 CST 2008.