Page 1 of 1
Miscellaneous questions
Posted: Wed May 04, 2005 11:00 pm
by Maniace
Hi. I'm new here and I also have a dream to make my own working operating system
I've got some miscellaneous questions about coding operating system:
1.) What makes ELF format better than binary format?
2.) How can I produce ELF file with DJGPP, my LD doesn't seem to support ELF output(should be latest version).
3.) Using YASM would be better than using NASM? I'll get all NASM features + AMD64 support?
4.) I'm making my own RTL from scratch. How should I construct it? Should I make directory for my OS' own function libraries and interface them with a standard ANSI C compliant functions? For example I've got "vid" class that prints to the screen. So printf-function should call my "vid" class?
5.) Beautiful C++ style code with interfaces or speed-optimized cryptic code?-) Maybe something between them...
6.) GCC's "-masm=intel" option gives me bunch of errors(I'm not now at my own computer, I'll paste errors when I'm at home if you want to. If U R familiar with these errors? They've got something to do with memory and mov commands).
Thanks for all, good to have forum like this =)
Re: Miscellaneous questions
Posted: Wed May 04, 2005 11:00 pm
by Legend
1) It contains more information for any loader, like the address of the first instruction of the kernel/program and a lot of other things. At least when you get to run applications, you'll want an executable format instead of a flat binary already for linking in shared libraries.
2) You need to recompile binutils, the package that contains ld, as, and other programs with elf support, or try to download compile ones.
4) That seems reasonable to me, if you want a c library, but don't want to limit yourself.
5) Depends on what function of the os you want to cover. For init routines cryptic code is just a maintaince problem. For inner loops in 3d software rendering for example, assembler is a must.
And who said C++ got to be slow?
Re: Miscellaneous questions
Posted: Thu May 05, 2005 11:00 pm
by Maniace
Thanks. I'll try first find already compiled utils, if I i don't find them I'll try to recompile them my self.
Hmm, I've also got Dev-C++(MinGW) and it's LD seem to support elf32-i386 but I always get error "PE operations in non PE file". I can link to pei-i386 and objcopy it to ELF but output is invalid(GRUB complains).
I'll also check Cygwin, i read somewhere that it would be possible produce ELF files with it. I don't even know what it is
Yeah, your right, C++ hasn't be slow if U know how to code it correctly. But interfaces and virtual functions are a bit slow. It's all about how to code it
Thx for your answer.
Re: Miscellaneous questions
Posted: Fri May 06, 2005 11:00 pm
by Legend
You might find precompiled binutils for djgpp here:
http://www.osdever.net/downloads.php !
However, that the result after an objcopy is invalid is weird, as I'm having the same setup.
Cygwin is at the very core a unix emulation library for Windows, and a lot of Unix programs have been ported to run with the help of it + additional tools like a X server for windows.
In the case that you solve a problem with virtual functions, it is very likely that you would work with function pointers in C, which at least isn't the wide gap that it looks like first when looking at virtual functions.
Re: Miscellaneous questions
Posted: Fri May 06, 2005 11:00 pm
by Maniace
Could you paste your objcopy command line for me so that I can check I have done things correctly?
Now I'm making NASM ELF and GCC default object files, linking them to PE with LD and objcopying them to ELF with command line something like(memory lack
objcopy -IPE_format_parameter -OELF_format PE_input_file_name ELF_output_file_name.
Thanks for that link, must buy somewhere couble of floppys 'cause my own computer is offline
Re: Miscellaneous questions
Posted: Sat May 07, 2005 11:00 pm
by Maniace
If someone is interested, i got intel syntax inline assembly work with GCC.
I haven't found any resources about this from internet, everybody is saying that you can use only global variables when using inlined intel syntax assembly.
For example:
Code: Select all
void outb(unsigned short port, unsigned char val) {
asm volatile(".intel_syntax\n"
"out %b0, %w1"
".att_syntax\n"
:: "al"(val), "dx"(port));
}
Don't know much about GNU's syntax, are those b and w necessary
Maybe just parameter number is necessary. I'll test
I made my decision, I'll load all formats as aout kludge so I can load any format without changing my boiler plate.[/code]