OSDev.org

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

All times are UTC - 6 hours




Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: GPF when interruption occur in ring 3
PostPosted: Sun Jan 29, 2023 5:55 pm 
Offline

Joined: Sun Jan 29, 2023 5:06 pm
Posts: 1
Hello !

I am doing a little 64 bit kernel (so i am in long mode) and as said in the title I have a problem with interruptions after switching to ring 3. (But all is working before switch)

My gdt descriptors seems ok (null, kernel code, kernel data, user code, user data, tss). My tss is empty.
The switch is ok (with the fake stack and iretq), and the user program is an infinite loop that only bug when an interruption occur (the timer interruption or any other if i call int xx from ring 3 program).

Qemu is raising v=0xd and e=0x0000...so thats a general protection fault but without any supplement informations...

Sorry for no code snippet, i cant post it for the moment.

If you have an idea im taker !

Have a good day.


Top
 Profile  
 
 Post subject: Re: GPF when interruption occur in ring 3
PostPosted: Mon Jan 30, 2023 6:00 pm 
Offline
Member
Member

Joined: Mon Mar 25, 2013 7:01 pm
Posts: 5099
aigle wrote:
My tss is empty.

You need to at least set RSP0 in your TSS.


Top
 Profile  
 
 Post subject: Re: GPF when interruption occur in ring 3
PostPosted: Mon Jan 30, 2023 11:35 pm 
Offline
Member
Member

Joined: Fri Aug 26, 2016 1:41 pm
Posts: 671
aigle wrote:
v=0xd and e=0x0000


*If* it was a segment related error, E=0000 means that the General Protection Fault occurred accessing descriptor index 0x0000 (a NULL descriptor) in the GDT.

Did you happen to look at what instruction (at EIP) was being executed when you got the fault? There *may* have been other hints as to what might be going wrong if you had given us a full dump of QEMU's processor state at the time the exception occurred.

Another recommendation might be to toss it in BOCHS which at times can be better at identifying low level problems. BOCHS will often throw warning information on the console that can offer hints at where a problem may lie.

Do you have your code available online like Github or other service?


Last edited by MichaelPetch on Tue Jan 31, 2023 9:46 pm, edited 5 times in total.

Top
 Profile  
 
 Post subject: Re: GPF when interruption occur in ring 3
PostPosted: Tue Jan 31, 2023 8:23 am 
Offline
Member
Member

Joined: Sat Nov 21, 2009 5:11 pm
Posts: 852
No, it means that the fault happened from some reason other than a segment check or IDT problem.


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

All times are UTC - 6 hours


Who is online

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