OSDev.org

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

All times are UTC - 6 hours




Post new topic Reply to topic  [ 11 posts ] 
Author Message
 Post subject: Getting into long mode without paging
PostPosted: Tue Oct 25, 2022 11:59 am 
Offline
Member
Member

Joined: Tue Jun 07, 2022 11:23 am
Posts: 78
Location: France
Can I get into 64 bit mode without paging? Too lazy to learn and deal with it 8)

_________________
https://github.com/cheyao/Achieve-Core


Top
 Profile  
 
 Post subject: Re: Getting into long mode without paging
PostPosted: Tue Oct 25, 2022 12:05 pm 
Offline
Member
Member

Joined: Tue Feb 18, 2020 3:29 pm
Posts: 1071
No. You must either use paging or not use long mode.

You could achieve the same effect by identity mapping everything. But you'll still need to learn how to use paging.

_________________
"How did you do this?"
"It's very simple — you read the protocol and write the code." - Bill Joy
Projects: NexNix | libnex | nnpkg


Top
 Profile  
 
 Post subject: Re: Getting into long mode without paging
PostPosted: Tue Oct 25, 2022 12:12 pm 
Offline
Member
Member

Joined: Mon Mar 25, 2013 7:01 pm
Posts: 5100
You could use a bootloader that sets up paging for you, but then you're stuck with the bootloader's page tables until you learn how to set up your own.


Top
 Profile  
 
 Post subject: Re: Getting into long mode without paging
PostPosted: Wed Oct 26, 2022 2:20 pm 
Offline
Member
Member

Joined: Tue Jun 07, 2022 11:23 am
Posts: 78
Location: France
Okk thx, guess ill still have to deal with pagging

_________________
https://github.com/cheyao/Achieve-Core


Top
 Profile  
 
 Post subject: Re: Getting into long mode without paging
PostPosted: Wed Oct 26, 2022 3:40 pm 
Offline
Member
Member
User avatar

Joined: Mon Jun 05, 2006 11:00 pm
Posts: 2293
Location: USA (and Australia)
I have not tried this but I wonder if you could identity map a PML4 to 512 GB pages. But it will be easy to identify map at the PML3 to 1GB pages. You'd only need 8KB of memory to map the bottom 512GB of virtual memory to physical memory.

_________________
My OS is Perception.


Top
 Profile  
 
 Post subject: Re: Getting into long mode without paging
PostPosted: Wed Oct 26, 2022 4:23 pm 
Offline
Member
Member

Joined: Mon Mar 25, 2013 7:01 pm
Posts: 5100
AndrewAPrice wrote:
I have not tried this but I wonder if you could identity map a PML4 to 512 GB pages. But it will be easy to identify map at the PML3 to 1GB pages. You'd only need 8KB of memory to map the bottom 512GB of virtual memory to physical memory.

You can map a PML4 to a 512GB page if you enable 5-level paging, but pages aren't allowed to span memory type boundaries, so you wouldn't be able to use it to identity-map memory on most PCs unless you also set the page to uncacheable.

You'll also run into this problem with 1GB and 2MB pages, but at least at those sizes it's easier to avoid.


Top
 Profile  
 
 Post subject: Re: Getting into long mode without paging
PostPosted: Thu Oct 27, 2022 12:29 pm 
Offline
Member
Member

Joined: Tue Feb 18, 2020 3:29 pm
Posts: 1071
AndrewAPrice wrote:
I have not tried this but I wonder if you could identity map a PML4 to 512 GB pages.

Do you mean use the PS bit on PML4E's? I scanned the Intel manuals and it didn't say anything, so unless I'm missing something, I guess this isn't possible.

_________________
"How did you do this?"
"It's very simple — you read the protocol and write the code." - Bill Joy
Projects: NexNix | libnex | nnpkg


Top
 Profile  
 
 Post subject: Re: Getting into long mode without paging
PostPosted: Thu Oct 27, 2022 1:00 pm 
Offline
Member
Member

Joined: Mon Mar 25, 2013 7:01 pm
Posts: 5100
Huh, you're right, the Intel manuals don't say anything about it. My usual quick reference suggests it's possible; I wonder if Intel had originally planned to add it alongside 5-level paging and the page was never updated when Intel got rid of it...


Top
 Profile  
 
 Post subject: Re: Getting into long mode without paging
PostPosted: Mon Oct 31, 2022 12:38 am 
Offline
Member
Member
User avatar

Joined: Sat Mar 31, 2012 3:07 am
Posts: 4591
Location: Chichester, UK
cyao1234 wrote:
Can I get into 64 bit mode without paging? Too lazy to learn and deal with it 8)

You may have chosen the wrong hobby.


Top
 Profile  
 
 Post subject: Re: Getting into long mode without paging
PostPosted: Tue Nov 01, 2022 5:17 am 
Offline
Member
Member

Joined: Fri Feb 11, 2022 4:55 am
Posts: 435
Location: behind the keyboard
This is a simple page table to start with, it identity maps 1gb of low memory using 2mb pages.

NASM Syntax,
Quote:
align 0x1000
PageTable:
.Pml4:
dq .Pdp + 3 ; + 3 (or | 3 ) which set Present & R/W Bits
times 511 dq 0
.Pdp:
dq .Pd + 3
times 511 dq 0
.Pd: ; Identity Map low 1gb
%assign i 0
%rep 512
dq i + 0x83
%assign i i + 0x200000
%endrep


Remember, you will always need to make paging support.
So get up from your laziness and do it


Top
 Profile  
 
 Post subject: Re: Getting into long mode without paging
PostPosted: Wed Nov 02, 2022 2:11 am 
Offline
Member
Member

Joined: Tue Jun 07, 2022 11:23 am
Posts: 78
Location: France
devc1 wrote:
This is a simple page table to start with, it identity maps 1gb of low memory using 2mb pages.

NASM Syntax,
Quote:
align 0x1000
PageTable:
.Pml4:
dq .Pdp + 3 ; + 3 (or | 3 ) which set Present & R/W Bits
times 511 dq 0
.Pdp:
dq .Pd + 3
times 511 dq 0
.Pd: ; Identity Map low 1gb
%assign i 0
%rep 512
dq i + 0x83
%assign i i + 0x200000
%endrep


Remember, you will always need to make paging support.
So get up from your laziness and do it


Ooo thx! I will eventually find some time to study it later, but ima go with this atm

_________________
https://github.com/cheyao/Achieve-Core


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

All times are UTC - 6 hours


Who is online

Users browsing this forum: rdos, thewrongchristian and 78 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