OSDev.org

The Place to Start for Operating System Developers
It is currently Thu Mar 28, 2024 4:30 pm

All times are UTC - 6 hours




Post new topic Reply to topic  [ 294 posts ]  Go to page Previous  1 ... 16, 17, 18, 19, 20  Next
Author Message
 Post subject: Re: How to make a GDT?
PostPosted: Tue Dec 13, 2022 8:16 pm 
Offline
Member
Member

Joined: Tue Nov 02, 2021 11:26 am
Posts: 195
I'm doing something wrong. What is it?


Top
 Profile  
 
 Post subject: Re: How to make a GDT?
PostPosted: Tue Dec 13, 2022 8:22 pm 
Online
Member
Member

Joined: Mon Mar 25, 2013 7:01 pm
Posts: 5100
What have you done to debug it so far?


Top
 Profile  
 
 Post subject: Re: How to make a GDT?
PostPosted: Tue Dec 13, 2022 8:26 pm 
Offline
Member
Member

Joined: Tue Nov 02, 2021 11:26 am
Posts: 195
Octocontrabass wrote:
What have you done to debug it so far?

Nothing at the moment. I'm still trying to get GRUB to recognise the multiboot header.


Top
 Profile  
 
 Post subject: Re: How to make a GDT?
PostPosted: Tue Dec 13, 2022 8:33 pm 
Online
Member
Member

Joined: Mon Mar 25, 2013 7:01 pm
Posts: 5100
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.


Top
 Profile  
 
 Post subject: Re: How to make a GDT?
PostPosted: Tue Dec 13, 2022 8:42 pm 
Offline
Member
Member

Joined: Tue Nov 02, 2021 11:26 am
Posts: 195
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.

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.


Top
 Profile  
 
 Post subject: Re: How to make a GDT?
PostPosted: Tue Dec 13, 2022 9:13 pm 
Online
Member
Member

Joined: Mon Mar 25, 2013 7:01 pm
Posts: 5100
zap8600 wrote:
If correct, you're saying that the multiboot header should be at the start of the file, right?

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.


Top
 Profile  
 
 Post subject: Re: How to make a GDT?
PostPosted: Tue Dec 13, 2022 9:17 pm 
Offline
Member
Member

Joined: Tue Nov 02, 2021 11:26 am
Posts: 195
Octocontrabass wrote:
zap8600 wrote:
If correct, you're saying that the multiboot header should be at the start of the file, right?

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.

Is there a certain value I'm looking for?


Top
 Profile  
 
 Post subject: Re: How to make a GDT?
PostPosted: Tue Dec 13, 2022 9:29 pm 
Online
Member
Member

Joined: Mon Mar 25, 2013 7:01 pm
Posts: 5100
What value does the Multiboot header start with? Look for that value.

(Don't forget that x86 is little-endian.)


Top
 Profile  
 
 Post subject: Re: How to make a GDT?
PostPosted: Tue Dec 13, 2022 9:34 pm 
Offline
Member
Member

Joined: Tue Nov 02, 2021 11:26 am
Posts: 195
Octocontrabass wrote:
What value does the Multiboot header start with? Look for that value.

(Don't forget that x86 is little-endian.)

The header starts with 0x1BADB002, the value for the magic. I'm also not sure what little-endian is.


Top
 Profile  
 
 Post subject: Re: How to make a GDT?
PostPosted: Tue Dec 13, 2022 9:54 pm 
Online
Member
Member

Joined: Mon Mar 25, 2013 7:01 pm
Posts: 5100
zap8600 wrote:
I'm also not sure what little-endian is.

That's the sort of thing you should probably already know before you try to write an OS.

Type it into your favorite search engine, see if you can figure out why it matters when you're looking for your Multiboot header.


Top
 Profile  
 
 Post subject: Re: How to make a GDT?
PostPosted: Tue Dec 13, 2022 10:10 pm 
Offline
Member
Member

Joined: Tue Nov 02, 2021 11:26 am
Posts: 195
Octocontrabass wrote:
zap8600 wrote:
I'm also not sure what little-endian is.

That's the sort of thing you should probably already know before you try to write an OS.

Type it into your favorite search engine, see if you can figure out why it matters when you're looking for your Multiboot header.

If correct, little-endian means that the data is stored with the least significant bit first. Does that just mean reverse order?


Top
 Profile  
 
 Post subject: Re: How to make a GDT?
PostPosted: Wed Dec 14, 2022 10:12 am 
Offline
Member
Member

Joined: Tue Nov 02, 2021 11:26 am
Posts: 195
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.


Top
 Profile  
 
 Post subject: Re: How to make a GDT?
PostPosted: Wed Dec 14, 2022 10:35 am 
Offline
Member
Member
User avatar

Joined: Sat Mar 31, 2012 3:07 am
Posts: 4591
Location: Chichester, UK
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.


Top
 Profile  
 
 Post subject: Re: How to make a GDT?
PostPosted: Wed Dec 14, 2022 10:50 am 
Offline
Member
Member

Joined: Tue Nov 02, 2021 11:26 am
Posts: 195
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.

Will my OS boot, even if GRUB doesn't recognize the multiboot header?


Top
 Profile  
 
 Post subject: Re: How to make a GDT?
PostPosted: Wed Dec 14, 2022 11:08 am 
Offline
Member
Member
User avatar

Joined: Sat Mar 31, 2012 3:07 am
Posts: 4591
Location: Chichester, UK
No.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 294 posts ]  Go to page Previous  1 ... 16, 17, 18, 19, 20  Next

All times are UTC - 6 hours


Who is online

Users browsing this forum: Google [Bot] and 79 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group