Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

x86/gsseg: Make asm_load_gs_index() take an u16

Let GCC know that only the low 16 bits of load_gs_index() argument
actually matter. It might allow it to create slightly better
code. However, do not propagate this into the prototypes of functions
that end up being paravirtualized, to avoid unnecessary changes.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
Signed-off-by: Xin Li <xin3.li@intel.com>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Link: https://lore.kernel.org/r/20230112072032.35626-4-xin3.li@intel.com

authored by

H. Peter Anvin (Intel) and committed by
Ingo Molnar
df729fb0 5a91f126

+2 -2
+1 -1
arch/x86/entry/entry_64.S
··· 782 782 783 783 /* 784 784 * Reload gs selector with exception handling 785 - * edi: new selector 785 + * di: new selector 786 786 * 787 787 * Is in entry.text as it shouldn't be instrumented. 788 788 */
+1 -1
arch/x86/include/asm/special_insns.h
··· 120 120 asm volatile("wbinvd": : :"memory"); 121 121 } 122 122 123 - extern asmlinkage void asm_load_gs_index(unsigned int selector); 123 + extern asmlinkage void asm_load_gs_index(u16 selector); 124 124 125 125 static inline void native_load_gs_index(unsigned int selector) 126 126 {