OSDev.org

The Place to Start for Operating System Developers
It is currently Thu Apr 18, 2024 12:43 am

All times are UTC - 6 hours




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: Triple Fault on Far Jump To Long Mode
PostPosted: Sat May 26, 2018 5:52 pm 
Offline
User avatar

Joined: Sat May 26, 2018 5:32 pm
Posts: 22
Whenever I run the following code to switch to long mode in qemu, it triple faults (by way of #GP). I've tried changing the GDT entry for the code segment, but I haven't had success so far. Any ideas would be much appreciated.

Links to file for the code to switch from the 32-bit environment grub loads the bootstrapper in to 64-bit long mode (fault is on the far jump), the gdt, and the overall repository.

_________________
The maker of Foxtrot microkernels. Currently just Greyhound, which is currently smaller than 3 KiB.
Also working on osmkVII.


Top
 Profile  
 
 Post subject: Re: Triple Fault on Far Jump To Long Mode
PostPosted: Mon Jun 04, 2018 6:58 am 
Offline

Joined: Mon Jun 04, 2018 6:37 am
Posts: 4
This (most likely) won't fix your triple fault, but just a quick look at your early.asm and I noticed you've labeled (and set up) your stack backwards. Remember: On x86 The stack grows downwards. From the wiki:
Code:
   To set up a stack, we set the esp register to point to the top of our
   stack (as it grows downwards on x86 systems). This is necessarily done
   in assembly as languages such as C cannot function without a stack.
Although written for 32 bit protected mode, it should apply to you. I could also be completely wrong, because I am new to OSDev, but being proven wrong is an opportunity to learn :D

EDIT: Sorry, I goofed. I misread your code and had a dyslexic moment. Your stack is set up properly.

_________________
"You’re free to praise Microsoft Windows on your own if you want, but please don’t do this in GNU packages." - GNU C Portability Standards


Top
 Profile  
 
 Post subject: Re: Triple Fault on Far Jump To Long Mode
PostPosted: Mon Jun 04, 2018 8:17 am 
Offline
Member
Member
User avatar

Joined: Sat Mar 31, 2012 3:07 am
Posts: 4594
Location: Chichester, UK
1. Perhaps I'm missing something, but I couldn't see a long jump in your code.

2. You don't appear to set up a page table.


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

All times are UTC - 6 hours


Who is online

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