Symbols in the kernel

Discussions on more advanced topics such as monolithic vs micro-kernels, transactional memory models, and paging vs segmentation should go here. Use this forum to expand and improve the wiki!
xyzzy
Member
Member
Posts: 391
Joined: Wed Jul 25, 2007 8:45 am
Libera.chat IRC: aejsmith
Location: London, UK
Contact:

Post by xyzzy »

I compile a symbol table into my kernel - the first time it links the Makefile adds in a fake symbol table, then runs a script to generate a real symbol table and links again with that, then a final time to get the right addresses for the symbols. In the symbol table there's an array of ksym_t's and an int stating how many symbols there are. Then the code that access the symbol's can just loop through the array.
User avatar
ucosty
Member
Member
Posts: 271
Joined: Tue Aug 08, 2006 7:43 am
Location: Sydney, Australia

Post by ucosty »

kscguru wrote:Grub, alas, cannot load mine; there is a 32-to-64-bit switch, so I have to load myself in a bootstrap stage. (Not terribly hard to do.)
You know, I had a brainwave regarding that today. What if you have grub load a 32-bit to 64-bit mini kernel that then loads the real kernel from a grub image? A third stage for grub, would be a good way to put it.
The cake is a lie | rackbits.com
User avatar
AndrewAPrice
Member
Member
Posts: 2299
Joined: Mon Jun 05, 2006 11:00 pm
Location: USA (and Australia)

Post by AndrewAPrice »

ucosty wrote:
kscguru wrote:Grub, alas, cannot load mine; there is a 32-to-64-bit switch, so I have to load myself in a bootstrap stage. (Not terribly hard to do.)
You know, I had a brainwave regarding that today. What if you have grub load a 32-bit to 64-bit mini kernel that then loads the real kernel from a grub image? A third stage for grub, would be a good way to put it.
Some real-mode kernels do the opposite when loaded into grub. Sort of sad in a way :(
My OS is Perception.
User avatar
AJ
Member
Member
Posts: 2646
Joined: Sun Oct 22, 2006 7:01 am
Location: Devon, UK
Contact:

Post by AJ »

ucosty wrote:You know, I had a brainwave regarding that today. What if you have grub load a 32-bit to 64-bit mini kernel that then loads the real kernel from a grub image? A third stage for grub, would be a good way to put it.
[plug]
That's what CBoot (see the sig - screenshots here is partly an attempt to do. CBoot is installed as GRUB's kernel and relocates the real kernel which is a GRUB module. It is also capable of having two kernels in memory and deciding whether to launch the 32 or 64 bit version based on what the CPU supports.

It installs all paging necessary and also passes argc and argv, so your kernel's 'main' function can have that 'traditional' feel to it. It sets up a physical memory stack or bitmap so that your kernel doesn't have to and switches VESA mode through the command line arguments passed from GRUB. It has a debug console too.
[/plug]

Let me know if you want an up-to-date floppy image and I'll put it up on my web site. CBoot already has all the features mentioned above, but there's still a lot of code tidying to do!

Cheers,
Adam
Post Reply