OSDev.org

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

All times are UTC - 6 hours




Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: General protection fault after reloading CS
PostPosted: Wed May 25, 2022 2:49 am 
Offline

Joined: Wed May 25, 2022 2:39 am
Posts: 1
Location: Italy
I'm following the GDT guide but according to gdb
Code:
jmp 0x08:reload_cs
is causing a "General Protection Fault" (0xd), according to the wiki this exception is thrown when a code segment is used improperly but as far as I understand if the GDT is not set segmentation is not enabled. What's going on? I cannot really understand
PS: I'm using GRUB2 as bootloader with Multiboot2 specification and I'm in protected mode


Top
 Profile  
 
 Post subject: Re: General protection fault after reloading CS
PostPosted: Wed May 25, 2022 5:32 pm 
Offline
Member
Member

Joined: Mon Mar 25, 2013 7:01 pm
Posts: 5100
LolzDEV wrote:
as far as I understand if the GDT is not set segmentation is not enabled.

Segmentation is always enabled.

LolzDEV wrote:
What's going on?

The CPU is unable to use the segment descriptor corresponding to segment selector 8 as a code segment.

  • Maybe the selector is wrong, and your code segment needs a different selector.
  • Maybe you've made a mistake defining the descriptor and it's not a valid code segment.
  • Maybe you've made a mistake loading the GDTR and the CPU isn't reading your GDT.

It's hard to say for sure without more information. For example, post a link to your git repository, or provide a register dump using QEMU's "-d int" option.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: Bing [Bot], DotBot [Bot] and 75 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