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

x86/msr: Improve the comments of the DECLARE_ARGS()/EAX_EDX_VAL()/EAX_EDX_RET() facility

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 76deb545 0c7b20b8

+13 -11
+13 -11
arch/x86/include/asm/msr.h
··· 37 37 }; 38 38 39 39 /* 40 - * both i386 and x86_64 returns 64-bit value in edx:eax, but gcc's "A" 41 - * constraint has different meanings. For i386, "A" means exactly 42 - * edx:eax, while for x86_64 it doesn't mean rdx:rax or edx:eax. Instead, 43 - * it means rax *or* rdx. 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': 44 47 */ 45 48 #ifdef CONFIG_X86_64 46 - /* Using 64-bit values saves one instruction clearing the high half of low */ 47 - #define DECLARE_ARGS(val, low, high) unsigned long low, high 48 - #define EAX_EDX_VAL(val, low, high) ((low) | (high) << 32) 49 - #define EAX_EDX_RET(val, low, high) "=a" (low), "=d" (high) 49 + # define 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) 50 52 #else 51 - #define DECLARE_ARGS(val, low, high) u64 val 52 - #define EAX_EDX_VAL(val, low, high) (val) 53 - #define EAX_EDX_RET(val, low, high) "=A" (val) 53 + # define 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) 54 56 #endif 55 57 56 58 /*