Page 1 of 1

Loading programs

Posted: Thu Oct 24, 2002 11:00 pm
by Bill
How can I load a program in the memory and jump to it?
I need some assembler source code.

RE:Loading programs

Posted: Fri Oct 25, 2002 11:00 pm
by Khumba
What OS are you using?

RE:Loading programs

Posted: Mon Oct 28, 2002 12:00 am
by Bill
I'm using an OS created by me.

RE:Loading programs

Posted: Mon Oct 28, 2002 12:00 am
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

RE:Loading programs

Posted: Tue Oct 29, 2002 12:00 am
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.