How to make a GDT?
Re: How to make a GDT?
I'm doing something wrong. What is it?
-
- Member
- Posts: 5562
- Joined: Mon Mar 25, 2013 7:01 pm
Re: How to make a GDT?
What have you done to debug it so far?
Re: How to make a GDT?
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?
-
- Member
- Posts: 5562
- Joined: Mon Mar 25, 2013 7:01 pm
Re: How to make a GDT?
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.
Re: How to make a GDT?
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.
-
- Member
- Posts: 5562
- Joined: Mon Mar 25, 2013 7:01 pm
Re: How to make a GDT?
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?
Re: How to make a GDT?
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?
-
- Member
- Posts: 5562
- Joined: Mon Mar 25, 2013 7:01 pm
Re: How to make a GDT?
What value does the Multiboot header start with? Look for that value.
(Don't forget that x86 is little-endian.)
(Don't forget that x86 is little-endian.)
Re: How to make a GDT?
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.)
-
- Member
- Posts: 5562
- Joined: Mon Mar 25, 2013 7:01 pm
Re: How to make a GDT?
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.
Re: How to make a GDT?
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.
Re: How to make a GDT?
Should I use something like NASM? Should I use EDK2 to make my kernel an EFI file? Is there an existing multiboot header I can use? What do I do?
Edit: I'm going to just continue to use the Limine boot protocol. I thought it would of been better to to set up paging myself, because I would learn from it, but I'll just use the Limine boot protocol, since I'm dumb.
Edit: I'm going to just continue to use the Limine boot protocol. I thought it would of been better to to set up paging myself, because I would learn from it, but I'll just use the Limine boot protocol, since I'm dumb.
Re: How to make a GDT?
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.
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.
Re: How to make a GDT?
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.