This adds both boot and pinned sections to the linker script for ia32. This is required for enabling demand paging for kernel and data. Signed-off-by: Daniel Leung <daniel.leung@intel.com>
58 lines
1.5 KiB
Plaintext
58 lines
1.5 KiB
Plaintext
/*
|
|
* Copyright (c) 2021 Intel Corporation
|
|
*
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
*/
|
|
|
|
#ifdef CONFIG_X86_KPTI
|
|
MMU_PAGE_ALIGN_PERM
|
|
z_shared_kernel_page_start = .;
|
|
/* Special page containing supervisor data that is still mapped in
|
|
* user mode page tables. IDT, GDT, TSSes, trampoline stack, and
|
|
* any LDT must go here as they always must live in a page that is
|
|
* marked 'present'. Still not directly user accessible, but
|
|
* no sensitive data should be here as Meltdown exploits may read it.
|
|
*/
|
|
#endif /* CONFIG_X86_KPTI */
|
|
|
|
#ifdef CONFIG_DYNAMIC_INTERRUPTS
|
|
. = ALIGN(8);
|
|
_idt_base_address = .;
|
|
#ifdef LINKER_ZEPHYR_FINAL
|
|
KEEP(*(staticIdt))
|
|
#else
|
|
. += CONFIG_IDT_NUM_VECTORS * 8;
|
|
#endif /* LINKER_ZEPHYR_FINAL */
|
|
#endif /* CONFIG_DYNAMIC_INTERRUPTS */
|
|
|
|
#ifdef CONFIG_GDT_DYNAMIC
|
|
KEEP(*(.tss))
|
|
. = ALIGN(8);
|
|
_gdt = .;
|
|
#ifdef LINKER_ZEPHYR_FINAL
|
|
KEEP(*(gdt))
|
|
#else /* LINKER_ZEPHYR_FINAL */
|
|
|
|
#ifdef CONFIG_USERSPACE
|
|
#define GDT_NUM_ENTRIES 7
|
|
#elif defined(CONFIG_HW_STACK_PROTECTION)
|
|
#define GDT_NUM_ENTRIES 5
|
|
#else
|
|
#define GDT_NUM_ENTRIES 3
|
|
#endif /* CONFIG_X86_USERSPACE */
|
|
. += GDT_NUM_ENTRIES * 8;
|
|
#endif /* LINKER_ZEPHYR_FINAL */
|
|
#endif /* CONFIG_GDT_DYNAMIC */
|
|
|
|
#ifdef CONFIG_X86_KPTI
|
|
z_trampoline_stack_start = .;
|
|
MMU_PAGE_ALIGN_PERM
|
|
z_trampoline_stack_end = .;
|
|
z_shared_kernel_page_end = .;
|
|
|
|
ASSERT(z_trampoline_stack_end - z_trampoline_stack_start >= 40,
|
|
"trampoline stack too small");
|
|
ASSERT(z_shared_kernel_page_end - z_shared_kernel_page_start == 4096,
|
|
"shared kernel area is not one memory page");
|
|
#endif /* CONFIG_X86_KPTI */
|