I tried 0x144000 with rtl8139 and it doesnt work, need help.
I have much comments, so that might help you too
Code: Select all
section .text
init_paging:
;page table
mov ecx, 1024 ;need to map 1024 pages to frames - 1024*1024*4 is 4194304 bytes!
mov edi, 0x9d000 ;address of the page table 4 kb right after pde
mov edx, 0b00000000000000000000000000000011 ;set attributes, 00000000 00000000 00000000 00000011 <- user1/kernel0, read0/write1 and present1,
.loop1:
mov [edi], edx ; attribut
add edi, 4 ;go to next memory location, 4 bytes next because the descriptor is 32 bits
add edx, 4096 ;go to next frame adress
cmp ecx, 700
jz .mmio
jmp .next
.mmio:
mov edx, 0b11110010000000000001000000000001 ;0xf200100 - physical MMIO adress, BAR @ 324*4096 - 0x144000, but dont works
.next:
dec ecx
jnz .loop1 ;looping tills we reach 0x9e000
;Page Directories
mov ecx, 1024
mov edi, 0x9C000 ;address of the page directory 4 kb before pte
mov edx, 0
.loop2:
mov [edi], edx ;attribut
add edi, 4 ;go to next memory location
dec ecx
jnz .loop2 ;looping tills we reach 0x9d000
mov ecx, 0
.loop3:
mov ebx, 0x3
mov dword [edx+ecx], 0x9d000
add dword [edx+ecx], ebx
add ebx, 0x4
add ecx, 0x4
cmp ecx, 1024 ;megabyte counter
jne .loop3
mov cr3, edx
mov eax, cr0 ;enable paging!
or eax, 0x80000000
mov cr0, eax
ret