what executable format is using in your own os?

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.
pcmattman
Member
Member
Posts: 2566
Joined: Sun Jan 14, 2007 9:15 pm
Libera.chat IRC: miselin
Location: Sydney, Australia (I come from a land down under!)
Contact:

Post by pcmattman »

JamesM wrote:ELF, because I'm using linux and every tool works with it. And GRUB supports it fully, as opposed to the kludgy-at-best support it has for AOUT. Grub can also load your ELF symbol table for you :) :) ooooh my kernel is backtrace heaven! :)
You could just export debugging information into the final binary and use GDB... Being able to debug my source instead of my disassembly is so much easier.
User avatar
bluecode
Member
Member
Posts: 202
Joined: Wed Nov 17, 2004 12:00 am
Location: Germany
Contact:

Post by bluecode »

I noticed I forgot to mention that I am using elf (for 32bit protected mode and for 64bit long mode).
But someday I'll try to execute a 32bit Windows executeable on my OS (and therefore support PE). But that will only be a "Hello, World!" and just for fun/out of interest...
User avatar
JamesM
Member
Member
Posts: 2935
Joined: Tue Jul 10, 2007 5:27 am
Location: York, United Kingdom
Contact:

Post by JamesM »

I really should get round to using GDB with bochs. I never actually have :$
User avatar
elderK
Member
Member
Posts: 190
Joined: Mon Dec 11, 2006 10:54 am
Location: Dunedin, New Zealand
Contact:

Post by elderK »

What I'd be more interested in, would be how many of you using the ELF format completely support dynamic linking?

~Z
User avatar
bluecode
Member
Member
Posts: 202
Joined: Wed Nov 17, 2004 12:00 am
Location: Germany
Contact:

Post by bluecode »

zeii wrote:What I'd be more interested in, would be how many of you using the ELF format completely support dynamic linking?
Well I do not support it completely. Just to the extend I need it for shared-libraries and normal executables in my OS (both on x86 and x86-64).
User avatar
JamesM
Member
Member
Posts: 2935
Joined: Tue Jul 10, 2007 5:27 am
Location: York, United Kingdom
Contact:

Post by JamesM »

I support ELF dynamic linking - for my syscalls. I've gone for a break from the norm as far as syscalls are concerned :P
pcmattman
Member
Member
Posts: 2566
Joined: Sun Jan 14, 2007 9:15 pm
Libera.chat IRC: miselin
Location: Sydney, Australia (I come from a land down under!)
Contact:

Post by pcmattman »

JamesM wrote:I really should get round to using GDB with bochs. I never actually have :$
It's powerful, I can tell you that now... From the GDB command line I can execute any function in my kernel (in scope, of course). So I can break and then find out what pid is running by typing "currpid()".
What I'd be more interested in, would be how many of you using the ELF format completely support dynamic linking?
No, don't support it at all. Must get around to that later...
User avatar
elderK
Member
Member
Posts: 190
Joined: Mon Dec 11, 2006 10:54 am
Location: Dunedin, New Zealand
Contact:

Post by elderK »

Dynamic ELF is a doozy :)

~Z
User avatar
mcheung63
Member
Member
Posts: 175
Joined: Thu Jun 22, 2006 8:33 am
Location: Hong Kong
Contact:

Post by mcheung63 »

how you guys do the "dynamic linking" of ELF. I searched a few days in google, no good tutorial about that. Introduce one if you have any. many thanks.
from Peter
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:

Post by Combuster »

I suggest you start with the ELF specification. Its not the easiest document but it contains everything you should need. After that, just experiment with it.

As for the original question: I use ELF myself, and especially the relocation info to enable multiple processes to be loaded into the same address space.
"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
elderK
Member
Member
Posts: 190
Joined: Mon Dec 11, 2006 10:54 am
Location: Dunedin, New Zealand
Contact:

Post by elderK »

You do realize that a large number of tutorials on the subject of Operating system design, are buggy, broken and probably not as effective for your learning, than actually struggling through it yourself, with a good spec?

(Am I right or wrong here, people?)
~Z
User avatar
JamesM
Member
Member
Posts: 2935
Joined: Tue Jul 10, 2007 5:27 am
Location: York, United Kingdom
Contact:

Post by JamesM »

damn straight. Working it out for yourself is the way to learn. I'm writing tutorials about them anyway :P
calpol
Posts: 5
Joined: Sun Aug 26, 2007 10:15 am

Post by calpol »

I'm just loading a flat binary image into memory and jumping to it :?.

I should probably learn how to use these formats sometime but for now flat binary images do the job just fine and i don't like to overcomplicate thing's :mrgreen: .
User avatar
Dex
Member
Member
Posts: 1444
Joined: Fri Jan 27, 2006 12:00 am
Contact:

Post by Dex »

I agree with you about the keep it simple, you can easy make a simple relocatable bin file by using ebx as a add on to where you loaded the file to, even linux uses something simular.

You even use code like this

Code: Select all

example_function:

        call    _origin
    _origin:
        pop     ebx

        mov     eax,[ ebx + _const-_origin ]

        ret

_const dd 1234
But having said that, you can code a PE loader in about 20 lines of asm so you can still keep it simple.
Post Reply