x86: synchronize usage of CONFIG_X86_STACK_PROTECTION

Most places use CONFIG_X86_STACK_PROTECTION, but there are some
places using CONFIG_HW_STACK_PROTECTION. So synchronize all
to use CONFIG_X86_STACK_PROTECTION instead.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
This commit is contained in:
Daniel Leung 2024-03-07 16:15:18 -08:00 committed by Anas Nashif
commit ac5835565b
6 changed files with 8 additions and 8 deletions

View file

@ -134,7 +134,7 @@ FUNC_NORETURN void arch_user_mode_enter(k_thread_entry_t user_entry,
stack_start = POINTER_TO_UINT(_current->stack_obj);
stack_size = K_THREAD_STACK_LEN(_current->stack_info.size);
#if defined(CONFIG_HW_STACK_PROTECTION)
#if defined(CONFIG_X86_STACK_PROTECTION)
/* With hardware stack protection, the first page of stack
* is a guard page. So need to skip it.
*/

View file

@ -185,7 +185,7 @@ def main():
# fault exception handling
if "CONFIG_USERSPACE" in syms:
num_entries = 7
elif "CONFIG_HW_STACK_PROTECTION" in syms:
elif "CONFIG_X86_STACK_PROTECTION" in syms:
num_entries = 5
else:
num_entries = 3

View file

@ -120,7 +120,7 @@ void z_x86_pentry_get(int *paging_level, pentry_t *val, pentry_t *ptables,
void z_x86_dump_page_tables(pentry_t *ptables);
#endif /* CONFIG_EXCEPTION_DEBUG */
#ifdef CONFIG_HW_STACK_PROTECTION
#ifdef CONFIG_X86_STACK_PROTECTION
/* Legacy function - set identity-mapped MMU stack guard page to RO in the
* kernel's page tables to prevent writes and generate an exception
*/

View file

@ -45,7 +45,7 @@
*/
#if defined(CONFIG_USERSPACE)
#define GS_TLS_SEG (0x38 | 0x03)
#elif defined(CONFIG_HW_STACK_PROTECTION)
#elif defined(CONFIG_X86_STACK_PROTECTION)
#define GS_TLS_SEG (0x28 | 0x03)
#else
#define GS_TLS_SEG (0x18 | 0x03)

View file

@ -41,7 +41,7 @@
#ifdef CONFIG_USERSPACE
#define GDT_NUM_ENTRIES 7
#elif defined(CONFIG_HW_STACK_PROTECTION)
#elif defined(CONFIG_X86_STACK_PROTECTION)
#define GDT_NUM_ENTRIES 5
#else
#define GDT_NUM_ENTRIES 3

View file

@ -14,7 +14,7 @@
#define ARCH_STACK_PTR_ALIGN 4UL
#endif
#if defined(CONFIG_HW_STACK_PROTECTION) || defined(CONFIG_USERSPACE)
#if defined(CONFIG_X86_STACK_PROTECTION) || defined(CONFIG_USERSPACE)
#define Z_X86_STACK_BASE_ALIGN CONFIG_MMU_PAGE_SIZE
#else
#define Z_X86_STACK_BASE_ALIGN ARCH_STACK_PTR_ALIGN
@ -62,7 +62,7 @@
* privileged mode stack.
*/
struct z_x86_thread_stack_header {
#ifdef CONFIG_HW_STACK_PROTECTION
#ifdef CONFIG_X86_STACK_PROTECTION
char guard_page[CONFIG_MMU_PAGE_SIZE];
#endif
#ifdef CONFIG_USERSPACE
@ -78,7 +78,7 @@ struct z_x86_thread_stack_header {
#define ARCH_THREAD_STACK_RESERVED \
sizeof(struct z_x86_thread_stack_header)
#ifdef CONFIG_HW_STACK_PROTECTION
#ifdef CONFIG_X86_STACK_PROTECTION
#define ARCH_KERNEL_STACK_RESERVED CONFIG_MMU_PAGE_SIZE
#define ARCH_KERNEL_STACK_OBJ_ALIGN CONFIG_MMU_PAGE_SIZE
#else