From bafb893a704b2d0d44b9ad92beb7b4339cbf1f0b Mon Sep 17 00:00:00 2001 From: Reto Buerki Date: Wed, 11 Feb 2015 15:43:13 +0100 Subject: [PATCH] hw_x86_64: Declare initial pagetables in .data segment The table specifies the initial identity mapping for the memory region from 2 MiB to 4 MiB using one 2 MiB mapping. --- .../src/core/spec/x86_64/kernel/crt0.s | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/repos/base-hw/src/core/spec/x86_64/kernel/crt0.s b/repos/base-hw/src/core/spec/x86_64/kernel/crt0.s index 79c322049..e96176fe6 100644 --- a/repos/base-hw/src/core/spec/x86_64/kernel/crt0.s +++ b/repos/base-hw/src/core/spec/x86_64/kernel/crt0.s @@ -12,6 +12,8 @@ * under the terms of the GNU General Public License version 2. */ +.include "macros.s" + .section ".text.crt0" /* magic multi-boot header to make GRUB happy */ @@ -69,3 +71,29 @@ .p2align 8 .space 32 * 1024 _stack_high: + +.data + + /**************************************** + ** Initial pagetables ** + ** Identity mapping from 2MiB to 4MiB ** + ****************************************/ + + /* PML4 */ + .p2align MIN_PAGE_SIZE_LOG2 + _kernel_pml4: + .quad _kernel_pdp + 0xf + .fill 511, 8, 0x0 + + /* PDP */ + .p2align MIN_PAGE_SIZE_LOG2 + _kernel_pdp: + .quad _kernel_pd + 0xf + .fill 511, 8, 0x0 + + /* PD */ + .p2align MIN_PAGE_SIZE_LOG2 + _kernel_pd: + .quad 0 + .quad 0x20018f + .fill 510, 8, 0x0