Skip to content
Commit 5a33fcb8 authored by George Spelvin's avatar George Spelvin Committed by Ingo Molnar
Browse files

x86/asm/tsc: Save an instruction in DECLARE_ARGS users



Before, the code to do RDTSC looked like:

  rdtsc
  shl $0x20, %rdx
  mov %eax, %eax
  or  %rdx, %rax

The "mov %eax, %eax" is required to clear the high 32 bits of RAX.

By declaring low and high as 64-bit variables, the code is
simplified to:

  rdtsc
  shl $0x20,%rdx
  or  %rdx,%rax

Yes, it's a 2-byte instruction that's not on a critical path,
but there are principles to be upheld.

Every user of EAX_EDX_RET has been checked. I tried to check
users of EAX_EDX_ARGS, but there weren't any, so I deleted it to
be safe.

( There's no benefit to making "high" 64 bits, but it was the
  simplest way to proceed. )

Signed-off-by: default avatarGeorge Spelvin <linux@horizon.com>
Signed-off-by: default avatarBorislav Petkov <bp@suse.de>
Cc: Andy Lutomirski <luto@amacapital.net>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Brian Gerst <brgerst@gmail.com>
Cc: Denys Vlasenko <dvlasenk@redhat.com>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: jacob.jun.pan@linux.intel.com
Link: http://lkml.kernel.org/r/20150618075906.4615.qmail@ns.horizon.com


Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
parent bb8dd960
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment