Page 1 of 1

executing files

Posted: Thu Jun 26, 2008 6:22 pm
by balthasar
How can i load a executible within my developed OS? I have the ReadFile funtion of my Filesystem implimented now what i would like to do is load a COFF Executible and have my LoadCOFFExtencion(filename,entrypoint); function load the Extention and run the entrypoint asked. how could i impliment this?

Re: executing files

Posted: Fri Jun 27, 2008 5:27 am
by lukem95
you need to read the COFF specification, it will tell you how to do it.

I'm afraid i've never read it, so i can't help you with the specifics, although my OS can load ELF files :)

Re: executing files

Posted: Fri Jun 27, 2008 9:43 pm
by balthasar
What if i switch it to a basic Binary file. My filesystem does things differently where i needed a Binary only instead of COFF. My compiler cant compile to ELF otherwise i use it :|

Re: executing files

Posted: Sat Jun 28, 2008 3:20 am
by Combuster
What if i switch it to a basic Binary file
Then you have absolutely no information about your program. It must always be linked to the same address and you waste lots of space on the BSS section which needs to be hardcoded to zeroes.
My compiler cant compile to ELF otherwise
Read GCC Cross-Compiler

Re: executing files

Posted: Sat Jun 28, 2008 9:38 pm
by ChazZeromus
If you want to strive away from reading the coff specification, then you can make a linker script that can your own custom executables. Or even better, a make file that calls a program that handles your own headers and such after compiling.

Re: executing files

Posted: Sun Jun 29, 2008 4:14 am
by lukem95
...or you could use ELF :)

it's really not that hard to set up a cross-compiler

Re: executing files

Posted: Sun Jun 29, 2008 9:12 pm
by balthasar
I desided on just using a VM of linux to compile my kernel resulting in now ELF! so now im using the ELF executable set. I did look at the coff one but ELF seemed to be the way.