Page 1 of 1
load and exec djgpp coff
Posted: Mon Dec 29, 2008 6:56 am
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.
Re: load and exec djgpp coff
Posted: Mon Dec 29, 2008 7:26 am
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
Re: load and exec djgpp coff
Posted: Mon Dec 29, 2008 3:48 pm
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.
Re: load and exec djgpp coff
Posted: Mon Dec 29, 2008 5:24 pm
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.
Re: load and exec djgpp coff
Posted: Tue Dec 30, 2008 10:33 am
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.
Re: load and exec djgpp coff
Posted: Tue Dec 30, 2008 2:58 pm
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 " .
Re: load and exec djgpp coff
Posted: Tue Dec 30, 2008 11:32 pm
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.