Symbols in the kernel
-
- Member
- Posts: 391
- Joined: Wed Jul 25, 2007 8:45 am
- Libera.chat IRC: aejsmith
- Location: London, UK
- Contact:
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.
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.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.)
The cake is a lie | rackbits.com
- AndrewAPrice
- Member
- Posts: 2299
- Joined: Mon Jun 05, 2006 11:00 pm
- Location: USA (and Australia)
Some real-mode kernels do the opposite when loaded into grub. Sort of sad in a wayucosty 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.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.)
My OS is Perception.
[plug]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.
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