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

x86/msr: Move the EAX_EDX_*() methods from <asm/msr.h> to <asm/asm.h>

We are going to use them from multiple headers, and in any case,
such register access wrapper macros are better in <asm/asm.h>
anyway.

Signed-off-by: Ingo Molnar <mingo@kernel.org>
Cc: Andy Lutomirski <luto@kernel.org>
Cc: Brian Gerst <brgerst@gmail.com>
Cc: Juergen Gross <jgross@suse.com>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Kees Cook <keescook@chromium.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Josh Poimboeuf <jpoimboe@redhat.com>
Cc: Uros Bizjak <ubizjak@gmail.com>
Cc: linux-kernel@vger.kernel.org

Ingo Molnar bdfda83a c9d8ea9d

+19 -19
+19
arch/x86/include/asm/asm.h
··· 243 243 #define _ASM_EXTABLE_FAULT(from, to) \ 244 244 _ASM_EXTABLE_TYPE(from, to, EX_TYPE_FAULT) 245 245 246 + /* 247 + * Both i386 and x86_64 returns 64-bit values in edx:eax for certain 248 + * instructions, but GCC's "A" constraint has different meanings. 249 + * For i386, "A" means exactly edx:eax, while for x86_64 it 250 + * means rax *or* rdx. 251 + * 252 + * These helpers wrapping these semantic differences save one instruction 253 + * clearing the high half of 'low': 254 + */ 255 + #ifdef CONFIG_X86_64 256 + # define EAX_EDX_DECLARE_ARGS(val, low, high) unsigned long low, high 257 + # define EAX_EDX_VAL(val, low, high) ((low) | (high) << 32) 258 + # define EAX_EDX_RET(val, low, high) "=a" (low), "=d" (high) 259 + #else 260 + # define EAX_EDX_DECLARE_ARGS(val, low, high) u64 val 261 + # define EAX_EDX_VAL(val, low, high) (val) 262 + # define EAX_EDX_RET(val, low, high) "=A" (val) 263 + #endif 264 + 246 265 #endif /* __KERNEL__ */ 247 266 #endif /* _ASM_X86_ASM_H */
-19
arch/x86/include/asm/msr.h
··· 37 37 }; 38 38 39 39 /* 40 - * Both i386 and x86_64 returns 64-bit values in edx:eax for certain 41 - * instructions, but GCC's "A" constraint has different meanings. 42 - * For i386, "A" means exactly edx:eax, while for x86_64 it 43 - * means rax *or* rdx. 44 - * 45 - * These helpers wrapping these semantic differences save one instruction 46 - * clearing the high half of 'low': 47 - */ 48 - #ifdef CONFIG_X86_64 49 - # define EAX_EDX_DECLARE_ARGS(val, low, high) unsigned long low, high 50 - # define EAX_EDX_VAL(val, low, high) ((low) | (high) << 32) 51 - # define EAX_EDX_RET(val, low, high) "=a" (low), "=d" (high) 52 - #else 53 - # define EAX_EDX_DECLARE_ARGS(val, low, high) u64 val 54 - # define EAX_EDX_VAL(val, low, high) (val) 55 - # define EAX_EDX_RET(val, low, high) "=A" (val) 56 - #endif 57 - 58 - /* 59 40 * Be very careful with includes. This header is prone to include loops. 60 41 */ 61 42 #include <asm/atomic.h>