flat assembler
Message board for the users of flat assembler.

Index > OS Construction > PAE question

Author
Thread Post new topic Reply to topic
merlin



Joined: 17 Nov 2003
Posts: 11
merlin 19 Sep 2006, 21:50
Hi guys...
I have some problem with setting PAE.
As I see it these steps should do the work in case my code is in the first MB:
    Switch to PM
    Create PDPE
    Create PDE (one 2Mb page with 1:1 mapping)
    Set control registers W/O cr0
    Set CR0 with paging bit


Here is something that resembles my code
Code:
 ; Here I start in PM with a basic flat model
        mov     edi, PDPE_BASE
        mov     cr3, edi
        
        mov     eax, cr4
        or      eax, PAE_BIT
        mov     cr4, eax

        mov     eax, APP_PDE
        mov     ebx, eax
        shr     eax, 20
        shl     ebx, 12
        or      ebx, P_BIT
        stosd
        mov     eax, ebx
        stosd
        
        mov     ecx, 6
        xor     eax, eax
        rep     stosd
        
        mov     edi, APP_PDE
        xor     eax, eax
        or      eax, P_BIT + PS_BIT
        stosd
        xor     eax, eax
        stosd
        
        mov     ecx, 511*2
        xor     eax, eax
        rep     stosd

        mov     eax, cr0
        or      eax, PAGING_BIT
        mov     cr0, eax

; Do something
    


While "Do something" could probably be a far jump
or anything else that executes with paging mechanism
running (thats why 1:1 mapping), but anyway, with
this code it never reached.
Once paging bit is set everything goes to hell and crashes...

I do realize that I can set all those pages from RM,
and only then enable paging, without the need of 1:1
mapping, because paging wouldn't be really enabled untill
some far jump.
However, this should work also. Doesn't it?
Post 19 Sep 2006, 21:50
View user's profile Send private message Reply with quote
merlin



Joined: 17 Nov 2003
Posts: 11
merlin 20 Sep 2006, 13:27
Problem solved (all PDPEs have to be peresent), topic closed...
Post 20 Sep 2006, 13:27
View user's profile Send private message Reply with quote
Niels



Joined: 17 Sep 2006
Posts: 255
Niels 27 Sep 2006, 15:15
Hello merlin,

That particular problem seems to be Bochs related...

Intel,Page118: The present flag (bit 0) in the page-directory-pointer-table entries can be set to 0 or 1.
If the present flag is clear, the remaining bits in the PDPTE entry are available to the operating system.
Post 27 Sep 2006, 15:15
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
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 vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.