From 0b930a21955eb730fcd6d16a3b9cbddd24124b22 Mon Sep 17 00:00:00 2001 From: Stephanos Ioannidis Date: Sun, 3 May 2020 18:18:37 +0900 Subject: [PATCH] kconfig: Rename x86 FPU sharing symbols This commit renames the x86 Kconfig `CONFIG_{EAGER,LAZY}_FP_SHARING` symbol to `CONFIG_{EAGER,LAZY}_FPU_SHARING`, in order to align with the recent `CONFIG_FP_SHARING` to `CONFIG_FPU_SHARING` renaming. Signed-off-by: Stephanos Ioannidis --- arch/x86/core/Kconfig.ia32 | 6 +++--- arch/x86/core/ia32.cmake | 2 +- arch/x86/core/ia32/excstub.S | 8 ++++---- arch/x86/core/ia32/float.c | 2 +- arch/x86/core/ia32/intstub.S | 6 +++--- arch/x86/core/ia32/swap.S | 8 ++++---- arch/x86/core/ia32/thread.c | 8 ++++---- arch/x86/core/offsets/ia32_offsets.c | 2 +- arch/x86/include/ia32/kernel_arch_data.h | 4 ++-- include/arch/x86/ia32/thread.h | 12 ++++++------ .../fp_sharing/float_disable/src/k_float_disable.c | 8 ++++---- tests/kernel/fp_sharing/generic/src/load_store.c | 2 +- 12 files changed, 34 insertions(+), 34 deletions(-) diff --git a/arch/x86/core/Kconfig.ia32 b/arch/x86/core/Kconfig.ia32 index 8ebc724721c..8f1e9b9d00a 100644 --- a/arch/x86/core/Kconfig.ia32 +++ b/arch/x86/core/Kconfig.ia32 @@ -98,7 +98,7 @@ config SSE_FP_MATH Disabling this option means that the compiler utilizes only the x87 instruction set for floating point operations. -config EAGER_FP_SHARING +config EAGER_FPU_SHARING bool depends on FPU depends on USERSPACE @@ -113,10 +113,10 @@ config EAGER_FP_SHARING FPU register set, should be used any time CONFIG_FPU is enabled, regardless if the FPU is used by one thread or multiple. -config LAZY_FP_SHARING +config LAZY_FPU_SHARING bool depends on FPU - depends on !EAGER_FP_SHARING + depends on !EAGER_FPU_SHARING depends on FPU_SHARING default y if X86_NO_LAZY_FP || !USERSPACE help diff --git a/arch/x86/core/ia32.cmake b/arch/x86/core/ia32.cmake index 128e5d40071..cc89fcd67ef 100644 --- a/arch/x86/core/ia32.cmake +++ b/arch/x86/core/ia32.cmake @@ -21,7 +21,7 @@ zephyr_library_sources( zephyr_library_sources_ifdef(CONFIG_IRQ_OFFLOAD ia32/irq_offload.c) zephyr_library_sources_ifdef(CONFIG_X86_USERSPACE ia32/userspace.S) -zephyr_library_sources_ifdef(CONFIG_LAZY_FP_SHARING ia32/float.c) +zephyr_library_sources_ifdef(CONFIG_LAZY_FPU_SHARING ia32/float.c) # Last since we declare default exception handlers here zephyr_library_sources(ia32/fatal.c) diff --git a/arch/x86/core/ia32/excstub.S b/arch/x86/core/ia32/excstub.S index 90d83eed153..16cec0fa48b 100644 --- a/arch/x86/core/ia32/excstub.S +++ b/arch/x86/core/ia32/excstub.S @@ -124,7 +124,7 @@ SECTION_FUNC(TEXT, _exception_enter) #endif /* ESP is pointing to the ESF at this point */ -#if defined(CONFIG_LAZY_FP_SHARING) +#if defined(CONFIG_LAZY_FPU_SHARING) movl _kernel + _kernel_offset_to_current, %edx @@ -141,7 +141,7 @@ SECTION_FUNC(TEXT, _exception_enter) orb $X86_THREAD_FLAG_EXC, _thread_offset_to_flags(%edx) -#endif /* CONFIG_LAZY_FP_SHARING */ +#endif /* CONFIG_LAZY_FPU_SHARING */ /* * restore interrupt enable state, then call the handler @@ -164,7 +164,7 @@ allDone: call *%ecx /* call exception handler */ addl $0x4, %esp -#if defined(CONFIG_LAZY_FP_SHARING) +#if defined(CONFIG_LAZY_FPU_SHARING) movl _kernel + _kernel_offset_to_current, %ecx @@ -194,7 +194,7 @@ allDone: andb $~X86_THREAD_FLAG_EXC, _thread_offset_to_flags(%ecx) nestedException: -#endif /* CONFIG_LAZY_FP_SHARING */ +#endif /* CONFIG_LAZY_FPU_SHARING */ /* * Pop the non-volatile registers from the stack. diff --git a/arch/x86/core/ia32/float.c b/arch/x86/core/ia32/float.c index 17b9aec4c72..b807ae6e8bb 100644 --- a/arch/x86/core/ia32/float.c +++ b/arch/x86/core/ia32/float.c @@ -17,7 +17,7 @@ * safely by one or more cooperative threads OR by a single preemptive thread, * but not by both. * - * This code is not necessary for systems with CONFIG_EAGER_FP_SHARING, as + * This code is not necessary for systems with CONFIG_EAGER_FPU_SHARING, as * the floating point context is unconditionally saved/restored with every * context switch. * diff --git a/arch/x86/core/ia32/intstub.S b/arch/x86/core/ia32/intstub.S index 2cb4bf72e0b..f0e016a3e24 100644 --- a/arch/x86/core/ia32/intstub.S +++ b/arch/x86/core/ia32/intstub.S @@ -232,7 +232,7 @@ alreadyOnIntStack: * debug tools that a preemptive context switch has occurred. */ -#if defined(CONFIG_LAZY_FP_SHARING) +#if defined(CONFIG_LAZY_FPU_SHARING) orb $X86_THREAD_FLAG_INT, _thread_offset_to_flags(%edx) #endif @@ -261,7 +261,7 @@ alreadyOnIntStack: * returning control to it at the point where it was interrupted ... */ -#if defined(CONFIG_LAZY_FP_SHARING) +#if defined(CONFIG_LAZY_FPU_SHARING) /* * arch_swap() has restored the floating point registers, if needed. * Clear X86_THREAD_FLAG_INT in the interrupted thread's state @@ -270,7 +270,7 @@ alreadyOnIntStack: movl _kernel + _kernel_offset_to_current, %eax andb $~X86_THREAD_FLAG_INT, _thread_offset_to_flags(%eax) -#endif /* CONFIG_LAZY_FP_SHARING */ +#endif /* CONFIG_LAZY_FPU_SHARING */ /* Restore volatile registers and return to the interrupted thread */ popl %edi diff --git a/arch/x86/core/ia32/swap.S b/arch/x86/core/ia32/swap.S index ad5b9d89f13..a3888e8ae44 100644 --- a/arch/x86/core/ia32/swap.S +++ b/arch/x86/core/ia32/swap.S @@ -142,11 +142,11 @@ SECTION_FUNC(TEXT, arch_swap) */ #endif -#ifdef CONFIG_EAGER_FP_SHARING +#ifdef CONFIG_EAGER_FPU_SHARING /* Eager floating point state restore logic * * Addresses CVE-2018-3665 - * Used as an alternate to CONFIG_LAZY_FP_SHARING if there is any + * Used as an alternate to CONFIG_LAZY_FPU_SHARING if there is any * sensitive data in the floating point/SIMD registers in a system * with untrusted threads. * @@ -166,7 +166,7 @@ SECTION_FUNC(TEXT, arch_swap) #else frstor _thread_offset_to_preempFloatReg(%eax) #endif /* CONFIG_SSE */ -#elif defined(CONFIG_LAZY_FP_SHARING) +#elif defined(CONFIG_LAZY_FPU_SHARING) /* * Clear the CR0[TS] bit (in the event the current thread * doesn't have floating point enabled) to prevent the "device not @@ -320,7 +320,7 @@ restoreContext_NoFloatSwap: CROHandlingDone: -#endif /* CONFIG_LAZY_FP_SHARING */ +#endif /* CONFIG_LAZY_FPU_SHARING */ /* update _kernel.current to reflect incoming thread */ diff --git a/arch/x86/core/ia32/thread.c b/arch/x86/core/ia32/thread.c index 97b39c877b4..5d5ecea2f10 100644 --- a/arch/x86/core/ia32/thread.c +++ b/arch/x86/core/ia32/thread.c @@ -51,11 +51,11 @@ extern int z_float_disable(struct k_thread *thread); int arch_float_disable(struct k_thread *thread) { -#if defined(CONFIG_LAZY_FP_SHARING) +#if defined(CONFIG_LAZY_FPU_SHARING) return z_float_disable(thread); #else return -ENOSYS; -#endif /* CONFIG_LAZY_FP_SHARING */ +#endif /* CONFIG_LAZY_FPU_SHARING */ } #endif /* CONFIG_FPU && CONFIG_FPU_SHARING */ @@ -110,8 +110,8 @@ void arch_new_thread(struct k_thread *thread, k_thread_stack_t *stack, * doesn't care about their state when execution begins */ thread->callee_saved.esp = (unsigned long)initial_frame; -#if defined(CONFIG_LAZY_FP_SHARING) +#if defined(CONFIG_LAZY_FPU_SHARING) thread->arch.excNestCount = 0; -#endif /* CONFIG_LAZY_FP_SHARING */ +#endif /* CONFIG_LAZY_FPU_SHARING */ thread->arch.flags = 0; } diff --git a/arch/x86/core/offsets/ia32_offsets.c b/arch/x86/core/offsets/ia32_offsets.c index 0cbe9a8382c..1b962e23ebb 100644 --- a/arch/x86/core/offsets/ia32_offsets.c +++ b/arch/x86/core/offsets/ia32_offsets.c @@ -26,7 +26,7 @@ #include -#if defined(CONFIG_LAZY_FP_SHARING) +#if defined(CONFIG_LAZY_FPU_SHARING) GEN_OFFSET_SYM(_thread_arch_t, excNestCount); #endif diff --git a/arch/x86/include/ia32/kernel_arch_data.h b/arch/x86/include/ia32/kernel_arch_data.h index 6974be6e0e4..ebec7a7525d 100644 --- a/arch/x86/include/ia32/kernel_arch_data.h +++ b/arch/x86/include/ia32/kernel_arch_data.h @@ -44,9 +44,9 @@ #define _THREAD_WRAPPER_REQUIRED #endif -#if defined(CONFIG_LAZY_FP_SHARING) && defined(CONFIG_SSE) +#if defined(CONFIG_LAZY_FPU_SHARING) && defined(CONFIG_SSE) #define _FP_USER_MASK (K_FP_REGS | K_SSE_REGS) -#elif defined(CONFIG_LAZY_FP_SHARING) +#elif defined(CONFIG_LAZY_FPU_SHARING) #define _FP_USER_MASK (K_FP_REGS) #endif diff --git a/include/arch/x86/ia32/thread.h b/include/arch/x86/ia32/thread.h index 816ab2be369..fbe9baa2c57 100644 --- a/include/arch/x86/ia32/thread.h +++ b/include/arch/x86/ia32/thread.h @@ -73,14 +73,14 @@ struct _callee_saved { typedef struct _callee_saved _callee_saved_t; /* - * The macros CONFIG_{LAZY|EAGER}_FP_SHARING shall be set to indicate that the + * The macros CONFIG_{LAZY|EAGER}_FPU_SHARING shall be set to indicate that the * saving/restoring of the traditional x87 floating point (and MMX) registers * are supported by the kernel's context swapping code. The macro * CONFIG_SSE shall _also_ be set if saving/restoring of the XMM * registers is also supported in the kernel's context swapping code. */ -#if defined(CONFIG_EAGER_FP_SHARING) || defined(CONFIG_LAZY_FP_SHARING) +#if defined(CONFIG_EAGER_FPU_SHARING) || defined(CONFIG_LAZY_FPU_SHARING) /* definition of a single x87 (floating point / MMX) register */ @@ -169,7 +169,7 @@ typedef struct s_FpRegSetEx { #endif /* CONFIG_SSE == 0 */ -#else /* !CONFIG_LAZY_FP_SHARING && !CONFIG_EAGER_FP_SHARING */ +#else /* !CONFIG_LAZY_FPU_SHARING && !CONFIG_EAGER_FPU_SHARING */ /* empty floating point register definition */ @@ -179,7 +179,7 @@ typedef struct s_FpRegSet { typedef struct s_FpRegSetEx { } tFpRegSetEx; -#endif /* CONFIG_LAZY_FP_SHARING || CONFIG_EAGER_FP_SHARING */ +#endif /* CONFIG_LAZY_FPU_SHARING || CONFIG_EAGER_FPU_SHARING */ /* * The following structure defines the set of 'volatile' x87 FPU/MMX/SSE @@ -221,14 +221,14 @@ struct _thread_arch { char *psp; #endif -#if defined(CONFIG_LAZY_FP_SHARING) +#if defined(CONFIG_LAZY_FPU_SHARING) /* * Nested exception count to maintain setting of EXC_ACTIVE flag across * outermost exception. EXC_ACTIVE is used by z_swap() lazy FP * save/restore and by debug tools. */ unsigned excNestCount; /* nested exception count */ -#endif /* CONFIG_LAZY_FP_SHARING */ +#endif /* CONFIG_LAZY_FPU_SHARING */ /* * The location of all floating point related structures/fields MUST be diff --git a/tests/kernel/fp_sharing/float_disable/src/k_float_disable.c b/tests/kernel/fp_sharing/float_disable/src/k_float_disable.c index 421a038e67c..1b96b2a3f28 100644 --- a/tests/kernel/fp_sharing/float_disable/src/k_float_disable.c +++ b/tests/kernel/fp_sharing/float_disable/src/k_float_disable.c @@ -33,7 +33,7 @@ static void usr_fp_thread_entry_1(void) } #if defined(CONFIG_ARM) || defined(CONFIG_RISCV) || \ - (defined(CONFIG_X86) && defined(CONFIG_LAZY_FP_SHARING)) + (defined(CONFIG_X86) && defined(CONFIG_LAZY_FPU_SHARING)) #define K_FLOAT_DISABLE_SYSCALL_RETVAL 0 #else #define K_FLOAT_DISABLE_SYSCALL_RETVAL -ENOSYS @@ -87,7 +87,7 @@ void test_k_float_disable_common(void) zassert_true( (usr_fp_thread.base.user_options & K_FP_OPTS) != 0, "usr_fp_thread FP options cleared"); -#elif defined(CONFIG_X86) && defined(CONFIG_LAZY_FP_SHARING) +#elif defined(CONFIG_X86) && defined(CONFIG_LAZY_FPU_SHARING) zassert_true((k_float_disable(&usr_fp_thread) == 0), "k_float_disable() failure"); @@ -96,7 +96,7 @@ void test_k_float_disable_common(void) (usr_fp_thread.base.user_options & K_FP_OPTS) == 0, "usr_fp_thread FP options not clear (0x%0x)", usr_fp_thread.base.user_options); -#elif defined(CONFIG_X86) && !defined(CONFIG_LAZY_FP_SHARING) +#elif defined(CONFIG_X86) && !defined(CONFIG_LAZY_FPU_SHARING) /* Verify k_float_disable() is not supported */ zassert_true((k_float_disable(&usr_fp_thread) == -ENOSYS), "k_float_disable() successful when not supported"); @@ -131,7 +131,7 @@ void test_k_float_disable_syscall(void) k_yield(); #if defined(CONFIG_ARM) || defined(CONFIG_RISCV) || \ - (defined(CONFIG_X86) && defined(CONFIG_LAZY_FP_SHARING)) + (defined(CONFIG_X86) && defined(CONFIG_LAZY_FPU_SHARING)) /* Verify K_FP_OPTS are now cleared by the user thread itself */ zassert_true( diff --git a/tests/kernel/fp_sharing/generic/src/load_store.c b/tests/kernel/fp_sharing/generic/src/load_store.c index da988710443..2201faabee9 100644 --- a/tests/kernel/fp_sharing/generic/src/load_store.c +++ b/tests/kernel/fp_sharing/generic/src/load_store.c @@ -182,7 +182,7 @@ static void load_store_low(void) * After every 1000 iterations (arbitrarily chosen), explicitly * disable floating point operations for the task. */ -#if (defined(CONFIG_X86) && defined(CONFIG_LAZY_FP_SHARING)) || \ +#if (defined(CONFIG_X86) && defined(CONFIG_LAZY_FPU_SHARING)) || \ defined(CONFIG_ARMV7_M_ARMV8_M_FP) /* * In x86: