load and exec djgpp coff

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
digo_rp
Member
Member
Posts: 233
Joined: Sun Jun 05, 2005 11:00 pm

load and exec djgpp coff

Post by digo_rp »

guis, I´m new into osdev. I´m trying to develop my os. called " digos " . so. now I have a small problem. I need to load and exec. some file what is the best file format to use ?
.coff .elf ? what is simplest to load and exec ? Please could anyone send to me a source code, cuz I don´t understand just reading a .pdf of .coff struct.
eddyb
Member
Member
Posts: 248
Joined: Fri Aug 01, 2008 7:52 am

Re: load and exec djgpp coff

Post by eddyb »

write those words(cuz, guis) correctly(cause, guys), and use ' instead of `.
ON: If you can load files, it's ok. binary format is so simple, you can run it by loading into memory and jumping to it. source code, i think no one would give you some. but you'll get some explanations, i'm sure ;)
JohnnyTheDon
Member
Member
Posts: 524
Joined: Sun Nov 09, 2008 2:55 am
Location: Pennsylvania, USA

Re: load and exec djgpp coff

Post by JohnnyTheDon »

I recommend elf, just because its simpler than .exe (assuming your OS is 32-bit) and it makes things like uninitialized data and read only data simple. It has something called program headers, which are basically instructions to the OS that tell it how to load the file. Google for the ELF specification.

As for source code, you'll have to do that on your own like shiner said. With elf it should be pretty simple, all the information you need from the file is in the ELF header and the program headers.
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: load and exec djgpp coff

Post by Combuster »

If reading PDFs (or specifications in general) is the problem, then you should work on that first. If all you want is code then you can just rip other people's open source code (link in my sig). You will need to know how things are supposed to work because it will give you no end of trouble if you don't.
"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 ]
System123
Member
Member
Posts: 196
Joined: Mon Jul 07, 2008 1:25 am

Re: load and exec djgpp coff

Post by System123 »

How new are you to OS dev? Because before you can load anything you need the drivers for your devices setup. Are you using Protected Mode, or is your OS real mode?

Before you get into Executable files, why don't you try load a .txt file or a .com file, as they have no headers. Once you get that write you will have enough experience to understand those specification documents.
Gizmic OS
Currently - Busy with FAT12 driver and VFS
digo_rp
Member
Member
Posts: 233
Joined: Sun Jun 05, 2005 11:00 pm

Re: load and exec djgpp coff

Post by digo_rp »

I got pmode with paging my kernel is loaded at 0xC000000 higher half. I got ring 3 protection vm86 mode too with software taskswitching. I have a bitmap memory manager.
I have a fat12 funcions like cd md rd type / cat dir/ls label. rmdir. and a very simple gui. " working on " .
System123
Member
Member
Posts: 196
Joined: Mon Jul 07, 2008 1:25 am

Re: load and exec djgpp coff

Post by System123 »

Well then try load a .com file and see if it runs. Remember you either need one that does not use interrupts or one that you have recoded the interrputs. Then the next important thing is to remember you need to wrap the loaded exe in something that will return it to the OS after execution. Like for a .com file test I just add 0xC3 after the last byte of the .com file.
Then you need to find out where the file was loaded and jump there.
Gizmic OS
Currently - Busy with FAT12 driver and VFS
Post Reply