Raised This Month: $ Target: $400
 0% 

Idea to find functions in memory


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
pRED*
Join Date: Dec 2006
Old 04-20-2010 , 19:11   Re: Idea to find functions in memory
Reply With Quote #1

joaquimandrade: This is part of the -fPIC compile flag valve uses on it's linux builds.

Don't get me started on this.

Anyway, that function uses a sneaky assembly hack to retrieve the current program counter value and stores it into the EBX register (calls the dummy function and reads the return address off the stack).

The code then adds a fixed offset to EBP (the distance from the current location to the global offset table) and then uses this register for all global value lookups.

It's an alternative to using load time relocation. Why you'd want to occupy a general purpose register and impose a runtime overhead is beyond me.
pRED* is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 07:09.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode