Load "exe"

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
Setsuna

Load "exe"

Post by Setsuna »

How can I load an windows "exe" and unix "elf" in my operating system.
carbonBased

RE:Load

Post by carbonBased »

Here is a simplified order of events to executing a binary:

You need to load the binary header and binary itself into memory (possibly in different locations, as the header is no longer needed after the binary has begun execution, and can be discarded).

Prepare any OS specific application environment things, such as the apps ldt and page tables.  At this point, you may also set up a TSS for the task.

Parse the binary header to determine relocations, etc, so that you can link your binary with any libraries and external dependancies.

Once all these relocations have been resolved, you can finally jump to the binary's entry point (also defined in the binary header).  There are many different methods to actually jump to the binary (jump to tss, "fudge" the stack and ret, simply jump, etc)... no matter what method you choose, make sure that the registers are set to the proper application descriptors.

Cheers,
Jeff
User avatar
bubach
Member
Member
Posts: 1223
Joined: Sat Oct 23, 2004 11:00 pm
Location: Sweden
Contact:

RE:Load

Post by bubach »

i do not know about .elf, but i have seen some tutorial about how to load a .exe... make a search..
then of course u have to make sure that the exe don´t make a call to some INT 21h service that dosn´t exist in your os.. =)
"Simplicity is the ultimate sophistication."
http://bos.asmhackers.net/ - GitHub
Post Reply