flat assembler
Message board for the users of flat assembler.

flat assembler > OS Construction > 2MB pages in long mode and 0xB8000 address

Author
Thread Post new topic Reply to topic
CandyMan



Joined: 04 Sep 2009
Posts: 295
Location: film "CandyMan" directed through Bernard Rose OR Candy Shop
How to map 0xB8000..0xBFFFF at 68GB+16MB=(0x1101000000) ?
My code is:
Code:
MaxMem          dd      64              ;64GB
MemoryStart     dd      1024*1024       ;1M

        push    0
        pop     fs

        mov     eax,MaxMem
        shl     eax,12
        lea     ebx,eax+512*8*2+1

        mov     ebp,ebx
        push    ebx

        mov     eax,MemoryStart
        mov     ebx,eax

        lea     eax,ebx+4*1024-1      ;\ Align to 4*1024
        and     ax,not 4*1024-1       ;/
        mov     PML4,eax
        add     eax,4*1024
        mov     PDP,eax
        add     eax,4*1024
        mov     PDT,eax

        pxor    mm0,mm0
        pop     ecx
        shr     ecx,3
      @@
        dec     ecx
        movq    fsebx+ecx*8,mm0
        jnz     @B

        mov     eax,PML4
        mov     ebx,PDP
        mov     ecx,PDT
        or      bl,7
        or      cl,7
        mov     fseax+8*000,ebx

        ;Fill page tables
        mov     eax,PDP
        xor     edx,edx
      .1
        mov     fseax+8*edx,ecx
        add     ecx,4*1024
        inc     edx
        cmp     edx,MaxMem
        jb      .1

        mov     eax,2*1024*1024
        movd    mm1,eax
        mov     eax,PT_AVL+PT_PS+PT_U+PT_W+PT_P ;Start from 1st 0..2MB-1
        movd    mm0,eax

        mov     ecx,MaxMem
        shl     ecx,9
        mov     eax,PDT
      .0
        movq    fseax,mm0
        paddq   mm0,mm1
        add     eax,8
        loop    .0

        mov     eax,AddrLFB
        or      eax,eax
        jz      @F
        or      eax,PT_AVL+PT_PS+PT_U+PT_W+PT_P
        movd    mm0,eax

        mov     edx,PDT
        add     edx,68 shl 9*8
        mov     ecx,8
      .2
        movq    fsedx,mm0
        paddq   mm0,mm1
        add     edx,8
        loop    .2

        mov     eax,0xB8000+PT_AVL+PT_U+PT_W+PT_P
        movd    mm0,eax
        movq    fsedx,mm0
      @@    

_________________
smaller is better
Post 02 Aug 2016, 10:39
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-2019, Tomasz Grysztar.

Powered by rwasa.