executing files

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
User avatar
balthasar
Member
Member
Posts: 30
Joined: Mon Mar 31, 2008 8:39 pm
Contact:

executing files

Post 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?
My OS: NasuTek Ensemble http://code.google.com/p/ensemble/
User avatar
lukem95
Member
Member
Posts: 536
Joined: Fri Aug 03, 2007 6:03 am
Location: Cambridge, UK

Re: executing files

Post 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 :)
~ Lukem95 [ Cake ]
Release: 0.08b
Image
User avatar
balthasar
Member
Member
Posts: 30
Joined: Mon Mar 31, 2008 8:39 pm
Contact:

Re: executing files

Post 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 :|
My OS: NasuTek Ensemble http://code.google.com/p/ensemble/
User avatar
Combuster
Member
Member
Posts: 9301
Joined: Wed Oct 18, 2006 3:45 am
Libera.chat IRC: [com]buster
Location: On the balcony, where I can actually keep 1½m distance
Contact:

Re: executing files

Post 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
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
User avatar
ChazZeromus
Member
Member
Posts: 61
Joined: Sun Jun 22, 2008 4:09 pm

Re: executing files

Post 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.
Image
User avatar
lukem95
Member
Member
Posts: 536
Joined: Fri Aug 03, 2007 6:03 am
Location: Cambridge, UK

Re: executing files

Post by lukem95 »

...or you could use ELF :)

it's really not that hard to set up a cross-compiler
~ Lukem95 [ Cake ]
Release: 0.08b
Image
User avatar
balthasar
Member
Member
Posts: 30
Joined: Mon Mar 31, 2008 8:39 pm
Contact:

Re: executing files

Post 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.
My OS: NasuTek Ensemble http://code.google.com/p/ensemble/
Post Reply