OSDev.org

The Place to Start for Operating System Developers
It is currently Tue Oct 24, 2017 3:19 am

All times are UTC - 6 hours




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: 64 bit long mode page descriptors & GDT
PostPosted: Wed Mar 15, 2017 12:06 pm 
Offline
Member
Member

Joined: Wed Mar 15, 2017 9:22 am
Posts: 40
Hi all

I'm developing a secure (text mode) O/S on x-86. It's all going well, boot loader written, 32 bit protected mode running (thanks to your pages and others). I then realised I need to enter 64 bit long mode for memory and processing reasons. The cr registers I can understand but the paging tables are a little difficult to get my head around. The O/S will be the only process running and will only use one processor for now. What I want to have is (in 1GB page translation mode) is all of memory (4gb+) paged and a 100MB code segment with the rest given over to data. Do I just set up a blank PML4E table and 4 entries in the PDPE table (4 1gb pages) and then make two 64 bit GDT tables for the code and data bits? I'd be most grateful for any help on this subject as there doesn't seem to be any help on what I want to do and otherwise I can see weeks of triple faults ahead!

Bipman


Top
 Profile  
 
 Post subject: Re: 64 bit long mode page descriptors & GDT
PostPosted: Wed Mar 15, 2017 12:21 pm 
Offline
Member
Member
User avatar

Joined: Sat Jan 15, 2005 12:00 am
Posts: 8117
Location: At his keyboard!
Hi,

Bipman wrote:
I'm developing a secure (text mode) O/S on x-86. It's all going well, boot loader written, 32 bit protected mode running (thanks to your pages and others). I then realised I need to enter 64 bit long mode for memory and processing reasons. The cr registers I can understand but the paging tables are a little difficult to get my head around. The O/S will be the only process running and will only use one processor for now. What I want to have is (in 1GB page translation mode) is all of memory (4gb+) paged and a 100MB code segment with the rest given over to data. Do I just set up a blank PML4E table and 4 entries in the PDPE table (4 1gb pages) and then make two 64 bit GDT tables for the code and data bits? I'd be most grateful for any help on this subject as there doesn't seem to be any help on what I want to do and otherwise I can see weeks of triple faults ahead!


As a bare minimum; you'd need:
  • A PML4, with one entry (that points to a PDPT)
  • A PDPT, with four entries (one for each "1 GiB page")
  • A GDT with at least 3 entries (a "NULL" entry that the CPU won't touch, plus one for 64-bit code and another for data).


Cheers,

Brendan

_________________
For all things; perfection is, and will always remain, impossible to achieve in practice. However; by striving for perfection we create things that are as perfect as practically possible. Let the pursuit of perfection be our guide.


Top
 Profile  
 
 Post subject: Re: 64 bit long mode page descriptors & GDT
PostPosted: Wed Mar 15, 2017 1:35 pm 
Offline
Member
Member

Joined: Wed Mar 15, 2017 9:22 am
Posts: 40
Makes sense thanks.

Bipman


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], klange and 17 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