OSDev.org

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

All times are UTC - 6 hours




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: Long mode paging only works well for the first 2MB
PostPosted: Mon Feb 11, 2019 7:56 pm 
Offline

Joined: Wed Oct 31, 2018 6:15 am
Posts: 18
I'm experiencing some very weird issues with long mode paging.. it seems like my first two MB identity mapping works very well. However, if I try mapping the 2MB starting at 0xFF00_0000_0000 (255TiB), accessing that location does not work. Strangely enough, if I map the 2MB region starting at 512GB (index 1 in the PML4T), I can access it, but I run into other weird issues like not getting the right value from a location in the area...

Please, if anyone has some time, could you tell me if you could spot a bug in my code? I'm already in protected mode .. the code sets up the paging tables and jumps into long mode. I'm also posting a link to my 64bit GDT.

Thank you so much.

https://pastebin.com/ghBLv1Db (Page tables + long mode)

https://pastebin.com/WHC4ZSJG (GDT for 64bits)


Top
 Profile  
 
 Post subject: Re: Long mode paging only works well for the first 2MB
PostPosted: Mon Feb 11, 2019 9:52 pm 
Offline
Member
Member

Joined: Fri Aug 26, 2016 1:41 pm
Posts: 671
Are you on a system where the virtual address space is 48 bits. If so the canonical addresses that are valid are:
0x0000000000000000 and 0x00007FFFFFFFFFFF
0xFFFF800000000000 and 0xFFFFFFFFFFFFFFFF
Anything in between is not a canonical address. Unless I counted things up incorrectly 0x0000FF0000000000 is outside those ranges. Maybe you mapped 0xFFFFFF0000000000 in your page table which is 0x0000FF0000000000 where the value at bit 47 is copied into bits 48 to 63.


Top
 Profile  
 
 Post subject: Re: Long mode paging only works well for the first 2MB
PostPosted: Tue Feb 12, 2019 7:18 am 
Offline

Joined: Wed Oct 31, 2018 6:15 am
Posts: 18
I .. can't believe I forgot about that, our assembly teacher actually mentioned this in one of the courses. Thank you very, very much! That was indeed the problem!!


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: Octocontrabass and 105 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