Filling out the rest of the page tables
This commit is contained in:
parent
c41288151a
commit
11cdc51979
1 changed files with 28 additions and 8 deletions
36
lboot.S
36
lboot.S
|
|
@ -103,8 +103,7 @@ _gmdone: add $24, %di
|
|||
ret
|
||||
|
||||
// paging: Set up initial page tables for long mode
|
||||
paging:
|
||||
mov $4*4096, %ecx
|
||||
paging: mov $4*4096, %ecx
|
||||
call alloc
|
||||
mov %eax, pd_ptr
|
||||
mov $4096, %ecx
|
||||
|
|
@ -114,21 +113,42 @@ paging:
|
|||
call alloc
|
||||
mov %eax, pml4_ptr
|
||||
|
||||
// fill PDEs with identity map < 4Gb
|
||||
mov pd_ptr, %edi
|
||||
xor %ecx, %ecx
|
||||
_pgnext: mov %ecx, %eax
|
||||
shl $21, %eax
|
||||
or $0b110000111, %eax
|
||||
or $0b10000011, %eax
|
||||
movl %eax, 0(%edi)
|
||||
//movl %eax, 0(%edi,%ecx,8)
|
||||
//movl $0, 4(%edi,%ecx,8)
|
||||
movl $0, 4(%edi)
|
||||
add $8, %edi
|
||||
inc %ecx
|
||||
cmp $4*512, %ecx
|
||||
jne _pgnext
|
||||
|
||||
//mov pml4_ptr, %edi
|
||||
//movl 0(%edi)
|
||||
//movl $0, 4(%edi)
|
||||
// link to PDs in PDP
|
||||
mov pdp_ptr, %edi
|
||||
mov pd_ptr, %eax
|
||||
orl $0b11, %eax
|
||||
|
||||
movl %eax, 0(%edi)
|
||||
movl $0, 4(%edi)
|
||||
add $0x1000, %eax
|
||||
movl %eax, 8(%edi)
|
||||
movl $0, 12(%edi)
|
||||
add $0x1000, %eax
|
||||
movl %eax, 16(%edi)
|
||||
movl $0, 20(%edi)
|
||||
add $0x1000, %eax
|
||||
movl %eax, 24(%edi)
|
||||
movl $0, 28(%edi)
|
||||
|
||||
// link to PDP in PML4
|
||||
mov pml4_ptr, %edi
|
||||
mov pdp_ptr, %eax
|
||||
orl $0b11, %eax
|
||||
movl %eax, 0(%edi)
|
||||
movl $0, 4(%edi)
|
||||
|
||||
ret
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue