Getting into long mode without paging
-
- Member
- Posts: 78
- Joined: Tue Jun 07, 2022 11:23 am
- Libera.chat IRC: Cyao
- Location: France
- Contact:
Getting into long mode without paging
Can I get into 64 bit mode without paging? Too lazy to learn and deal with it
Re: Getting into long mode without paging
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.
You could achieve the same effect by identity mapping everything. But you'll still need to learn how to use paging.
-
- Member
- Posts: 5563
- Joined: Mon Mar 25, 2013 7:01 pm
Re: Getting into long mode without paging
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.
-
- Member
- Posts: 78
- Joined: Tue Jun 07, 2022 11:23 am
- Libera.chat IRC: Cyao
- Location: France
- Contact:
Re: Getting into long mode without paging
Okk thx, guess ill still have to deal with pagging
- AndrewAPrice
- Member
- Posts: 2300
- Joined: Mon Jun 05, 2006 11:00 pm
- Location: USA (and Australia)
Re: Getting into long mode without paging
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.
-
- Member
- Posts: 5563
- Joined: Mon Mar 25, 2013 7:01 pm
Re: Getting into long mode without paging
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.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'll also run into this problem with 1GB and 2MB pages, but at least at those sizes it's easier to avoid.
Re: Getting into long mode without paging
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.AndrewAPrice wrote:I have not tried this but I wonder if you could identity map a PML4 to 512 GB pages.
-
- Member
- Posts: 5563
- Joined: Mon Mar 25, 2013 7:01 pm
Re: Getting into long mode without paging
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...
Re: Getting into long mode without paging
You may have chosen the wrong hobby.cyao1234 wrote:Can I get into 64 bit mode without paging? Too lazy to learn and deal with it
Re: Getting into long mode without paging
This is a simple page table to start with, it identity maps 1gb of low memory using 2mb pages.
NASM Syntax,
So get up from your laziness and do it
NASM Syntax,
Remember, you will always need to make paging support.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
So get up from your laziness and do it
-
- Member
- Posts: 78
- Joined: Tue Jun 07, 2022 11:23 am
- Libera.chat IRC: Cyao
- Location: France
- Contact:
Re: Getting into long mode without paging
Ooo thx! I will eventually find some time to study it later, but ima go with this atmdevc1 wrote:This is a simple page table to start with, it identity maps 1gb of low memory using 2mb pages.
NASM Syntax,Remember, you will always need to make paging support.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
So get up from your laziness and do it