From 1cb259a43b6ebcdeb5548dbe71f678cf3c65b600 Mon Sep 17 00:00:00 2001 From: Leifu Zhao Date: Tue, 11 Apr 2023 14:11:40 +0800 Subject: [PATCH] arch/x86/ia32: Add option to reserve GDT entries Some functions such as the ISH power management function needs to reserve GDT entry place holders which are filled during runtime. Add config option to define the number of GDT entry place holders reserved and change the ia32 linker script accordingly. Signed-off-by: Leifu Zhao --- arch/x86/core/Kconfig.ia32 | 8 ++++++++ .../zephyr/arch/x86/ia32/scripts/shared_kernel_pages.ld | 1 + 2 files changed, 9 insertions(+) diff --git a/arch/x86/core/Kconfig.ia32 b/arch/x86/core/Kconfig.ia32 index 03e2af8cdfb..4d3dffe78cf 100644 --- a/arch/x86/core/Kconfig.ia32 +++ b/arch/x86/core/Kconfig.ia32 @@ -39,6 +39,14 @@ config GDT_DYNAMIC This option stores the GDT in RAM instead of ROM, so that it may be modified at runtime at the expense of some memory. +config GDT_RESERVED_NUM_ENTRIES + int "Number of reserved GDT entry place holders" + depends on GDT_DYNAMIC + default 0 + help + This option defines the number of GDT entry place holders revserved + that can be filled at runtime. + endmenu menu "Processor Capabilities" diff --git a/include/zephyr/arch/x86/ia32/scripts/shared_kernel_pages.ld b/include/zephyr/arch/x86/ia32/scripts/shared_kernel_pages.ld index 62fdf16cf2e..30ab2544c04 100644 --- a/include/zephyr/arch/x86/ia32/scripts/shared_kernel_pages.ld +++ b/include/zephyr/arch/x86/ia32/scripts/shared_kernel_pages.ld @@ -47,6 +47,7 @@ #define GDT_NUM_ENTRIES 3 #endif /* CONFIG_X86_USERSPACE */ . += (GDT_NUM_ENTRIES + GDT_NUM_TLS_ENTRIES) * 8; + . += CONFIG_GDT_RESERVED_NUM_ENTRIES * 8; #endif /* LINKER_ZEPHYR_FINAL */ #endif /* CONFIG_GDT_DYNAMIC */