Re: How to make a GDT?
Posted: Tue Dec 13, 2022 8:16 pm
I'm doing something wrong. What is it?
Nothing at the moment. I'm still trying to get GRUB to recognise the multiboot header.Octocontrabass wrote:What have you done to debug it so far?
There are no sections before the multiboot header. I don't use linker flags, but there are C flags used. If correct, you're saying that the multiboot header should be at the start of the file, right? If so, then (I think) only the ELF header is there. I'm not sure.Octocontrabass wrote:Have you examined your kernel binary in a hex editor? Your Multiboot header needs to be located within the first 8kB of your kernel. You may need to modify your linker script or your linker flags to ensure the linker doesn't insert any other sections or any padding before the Multiboot header.
No, the ELF header goes at the start of the file. The Multiboot header should be somewhere after the ELF header, within the first 8kB of the file.zap8600 wrote:If correct, you're saying that the multiboot header should be at the start of the file, right?
Is there a certain value I'm looking for?Octocontrabass wrote:No, the ELF header goes at the start of the file. The Multiboot header should be somewhere after the ELF header, within the first 8kB of the file.zap8600 wrote:If correct, you're saying that the multiboot header should be at the start of the file, right?
The header starts with 0x1BADB002, the value for the magic. I'm also not sure what little-endian is.Octocontrabass wrote:What value does the Multiboot header start with? Look for that value.
(Don't forget that x86 is little-endian.)
That's the sort of thing you should probably already know before you try to write an OS.zap8600 wrote:I'm also not sure what little-endian is.
If correct, little-endian means that the data is stored with the least significant bit first. Does that just mean reverse order?Octocontrabass wrote:That's the sort of thing you should probably already know before you try to write an OS.zap8600 wrote:I'm also not sure what little-endian is.
Type it into your favorite search engine, see if you can figure out why it matters when you're looking for your Multiboot header.
Will my OS boot, even if GRUB doesn't recognize the multiboot header?iansjack wrote:We’re all dumb until someone has taught us or we have read the appropriate documents.
I would suggest you use multiboot (it’s easy to construct the header if you read the specifications) and use grub as your boot loader. It can handle BIOS or UEFI.