x86/cpu: Use TLS_SIZE instead of open coding it
PATCH 1/1 x86/cpu: Use TLS_SIZE instead of open coding it
Currently, there is already a macro named TLS_SIZE defined in segment.h, which is equivalent to 'GDT_ENTRY_TLS_ENTRIES * 8'. Therefore, we can use this macro directly in cpu_init() instead of open coding it.
Signed-off-by Yuntao Wang <[email protected]>
--- arch/x86/include/asm/segment.h | 2 +- arch/x86/kernel/cpu/common.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
arch/x86/include/asm/segment.h +1 -1
@@ -227,7 +227,7 @@#define GDT_SIZE (GDT_ENTRIES*8)#define GDT_ENTRY_TLS_ENTRIES 3 -#define TLS_SIZE (GDT_ENTRY_TLS_ENTRIES* 8) +#define TLS_SIZE (GDT_ENTRY_TLS_ENTRIES*8)/* Bit size and mask of CPU number stored in the per CPU data (and TSC_AUX) */ #define VDSO_CPUNODE_BITS 12
arch/x86/kernel/cpu/common.c +1 -1
@@ -2220,7 +2220,7 @@ void cpu_init(void)if (IS_ENABLED (CONFIG_X86_64 )) {loadsegment (fs,0 ); -memset (cur->thread.tls_array,0 ,GDT_ENTRY_TLS_ENTRIES *8 ); +memset (cur->thread.tls_array,0 ,TLS_SIZE );syscall_init ();wrmsrl (MSR_FS_BASE ,0 );
Signature · 1 line
2.45.2