loading and executing programs
loading and executing programs
I am at the stage where I want my OS to load and execute a program, however I am not sure how to implement this. I know what has to be done but I don't know where to start.
Gizmic OS
Currently - Busy with FAT12 driver and VFS
Currently - Busy with FAT12 driver and VFS
Re: loading and executing programs
Without sounding patronising, firstly you need to load the program, then you need to execute it.
To load a program you will need a filesystem layer and a driver or two to interact with the physical media.
To execute a program you will need a parser for the file format of your choice (ELF, PE, COFF, binary, etc), a virtual memory manager and (possibly) a system call layer.
If you need more specific information you're really going to have to be more specific in your question!
To load a program you will need a filesystem layer and a driver or two to interact with the physical media.
To execute a program you will need a parser for the file format of your choice (ELF, PE, COFF, binary, etc), a virtual memory manager and (possibly) a system call layer.
If you need more specific information you're really going to have to be more specific in your question!
Re: loading and executing programs
Ok I know that the app must be loaded into memory. It then needs to have the header files read which will then start execution. I am creating my Floppy Device driver to search and load the file into memory. The problem is I don't know if I can load the file anywhere in memory? The other thing is that once it is loaded how do I read the header file, like can I get an example of what it looks like for a PE file.
Gizmic OS
Currently - Busy with FAT12 driver and VFS
Currently - Busy with FAT12 driver and VFS
Re: loading and executing programs
Hi,
First Google Hit for PE Specification
First Google Hit for ELF Specification
Your OS can either specify that an executable must be linked at a certain address (or address range) or can use position independent code / relocation. The memory layout of your OS is something that you surely design fairly early on, though?
Later, you may want to look at lazy loading for your executables.
Cheers,
Adam
First Google Hit for PE Specification
First Google Hit for ELF Specification
Your OS can either specify that an executable must be linked at a certain address (or address range) or can use position independent code / relocation. The memory layout of your OS is something that you surely design fairly early on, though?
Later, you may want to look at lazy loading for your executables.
Cheers,
Adam