Loading programs

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
Bill

Loading programs

Post by Bill »

How can I load a program in the memory and jump to it?
I need some assembler source code.
Khumba

RE:Loading programs

Post by Khumba »

What OS are you using?
Bill

RE:Loading programs

Post by Bill »

I'm using an OS created by me.
carbonBased

RE:Loading programs

Post by carbonBased »

I think you missed the sarcasm :)

Such a task is different from OS to OS, and since you're writting your own OS, it's _impossible_ for us to _tell_ you how do load a program.

Essentially, most OSs do the following:
find the binary file without your file system
parse the binary file's header to find information about this program (size, linkage info, etc)
load the appropriate sectors into newly allocated memory
perform any dynamic linking necessary (ie, like Win32 dll's, and Linux so's)

jump to the program's entry point (also, usually, specified in the header)

That's it.
Jeff
Schol-R-LEA

RE:Loading programs

Post by Schol-R-LEA »

IF it helps any, there is an excellent book on the subject, _Linkers and Loaders_ by John Levine, which you might want to pick up or borrow (many college libraries will have it). An early draft of the book, with some serious errata, is available at the book's website (http://linker.iecc.com/), but the final published version is substantially better IMO.
Post Reply