R.I.P Terry (merak etme baba bende gelecem yanına)

ZIP indir
0
main
1 dal
git@carbon4code.com:ozsipahi/NakedOS.git
Ömer Özsipahi feature: C kernel
9 commit
NakedOS nkboot long_mode paging_table.asm
paging_table.asm 1.1 KB
section .text

set_pg_table:

    mov edi, pt_table ; dw yerleştirir 4 bayt
    mov ecx, 4096 ; 4096 tur dön 16k bayt adresteki ilk table'In adresini verdiğiniz için peşindekileride sıfırlıcak
    xor eax, eax
    rep stosd

    mov dword [pml4_table], pdpt_table + 0x03
    mov dword [pdpt_table], pd_table + 0x03
    mov dword [pd_table], pt_table + 0x03


_map_pt_table:
    mov ecx, 0
    mov eax, 0x03

    map_pt_table_loop:
        mov dword[pt_table + ecx * 8], eax
        add eax, 0x1000
        inc ecx
        cmp ecx, 512
        jne map_pt_table_loop

_activate_pg:
    mov eax, pml4_table ; page table'ın hiyerarşideki en büyük table'ın adresini sitiyor bizde veiryoruz
    mov cr3, eax

    mov eax, cr4 ; cr4 register'ının 5.biti sistemin paging'i etkinleştirmesini sağlıyor yapıyoruz.
    or  eax, 1 << 5
    or  eax, 1 << 9
    or  eax, 1 << 10
    mov cr4, eax

    mov ecx, 0xC0000080
    rdmsr
    or eax, 1 << 8
    wrmsr

    mov eax, cr0
    or eax, 1 << 31
    mov cr0, eax


    mov ebx, MSG_COMP_MODE
    mov ecx, 10
    call _print_str_vga32

    jmp _ignite_long_mode