start_32 now maps 2GiB of virtual memory instead of 1 GiB

This commit is contained in:
2022-12-24 10:28:01 +00:00
parent a3be1de07d
commit 62ec27e76b

View File

@@ -5,10 +5,15 @@
.set MAGIC, 0x1BADB002
.set CHECKSUM, -(MAGIC + FLAGS)
/* the amount of memory to allocate for bootstrap page directories. */
/* with buffer size 0x1000 (enough for exactly one page directory)
/* we can map 1 GiB of virtual memory */
#define BOOTSTRAP_PDIR_SIZE 0x1000
/* the amount of memory to allocate for bootstrap page directories.
with buffer size 0x2000 (enough for exactly two page directories)
we can map 2 GiB of virtual memory.
we use this to map the virtual address range 0xffffffff'80000000 -> 0xffffffff'fffff000
to the physical address range 0x00000000 -> 0x80000000,
to map the kernel's code and data, and give the kernel plenty of space to initialise itself.
*/
#define BOOTSTRAP_PDIR_SIZE 0x2000
.extern start_64 # defined in start_64.S
@@ -166,8 +171,9 @@ init_page_tables:
xchg %eax, %ecx
add $0x1000, %edi
sub %ecx, %edi
sub $0x08, %edi # subtract one from the index here, otherwise the mapping will be at 0xffffffffc0000000
# (each entry in the array is 8 bytes long)
#sub $0x08, %edi # subtract from the index here to adjust where the mapping starts
# NOTE that you must subtract in multiples of 0x8
/* %ESI is a pointer into the pagedir buffer.
%EDI is a pointer into the PDPT.