Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit da834796 authored by Linus Torvalds's avatar Linus Torvalds
Browse files

Merge branch 'x86-asm-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull x86/asm changes from Ingo Molnar:
 "The one change that stands out is the alternatives patching change
  that prevents us from ever patching back instructions from SMP to UP:
  this simplifies things and speeds up CPU hotplug.

  Other than that it's smaller fixes, cleanups and improvements."

* 'x86-asm-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  x86: Unspaghettize do_trap()
  x86_64: Work around old GAS bug
  x86: Use REP BSF unconditionally
  x86: Prefer TZCNT over BFS
  x86/64: Adjust types of temporaries used by ffs()/fls()/fls64()
  x86: Drop unnecessary kernel_eflags variable on 64-bit
  x86/smp: Don't ever patch back to UP if we unplug cpus
parents 80749df4 c416ddf5
Loading
Loading
Loading
Loading
+0 −3
Original line number Diff line number Diff line
@@ -2649,9 +2649,6 @@ bytes respectively. Such letter suffixes can also be entirely omitted.
	smart2=		[HW]
			Format: <io1>[,<io2>[,...,<io8>]]

	smp-alt-once	[X86-32,SMP] On a hotplug CPU system, only
			attempt to substitute SMP alternatives once at boot.

	smsc-ircc2.nopnp	[HW] Don't use PNP to discover SMC devices
	smsc-ircc2.ircc_cfg=	[HW] Device configuration I/O port
	smsc-ircc2.ircc_sir=	[HW] SIR base I/O port
+2 −2
Original line number Diff line number Diff line
@@ -60,7 +60,7 @@ extern void alternatives_smp_module_add(struct module *mod, char *name,
					void *locks, void *locks_end,
					void *text, void *text_end);
extern void alternatives_smp_module_del(struct module *mod);
extern void alternatives_smp_switch(int smp);
extern void alternatives_enable_smp(void);
extern int alternatives_text_reserved(void *start, void *end);
extern bool skip_smp_alternatives;
#else
@@ -68,7 +68,7 @@ static inline void alternatives_smp_module_add(struct module *mod, char *name,
					       void *locks, void *locks_end,
					       void *text, void *text_end) {}
static inline void alternatives_smp_module_del(struct module *mod) {}
static inline void alternatives_smp_switch(int smp) {}
static inline void alternatives_enable_smp(void) {}
static inline int alternatives_text_reserved(void *start, void *end)
{
	return 0;
+6 −8
Original line number Diff line number Diff line
@@ -355,7 +355,7 @@ static int test_bit(int nr, const volatile unsigned long *addr);
 */
static inline unsigned long __ffs(unsigned long word)
{
	asm("bsf %1,%0"
	asm("rep; bsf %1,%0"
		: "=r" (word)
		: "rm" (word));
	return word;
@@ -369,7 +369,7 @@ static inline unsigned long __ffs(unsigned long word)
 */
static inline unsigned long ffz(unsigned long word)
{
	asm("bsf %1,%0"
	asm("rep; bsf %1,%0"
		: "=r" (word)
		: "r" (~word));
	return word;
@@ -417,10 +417,9 @@ static inline int ffs(int x)
	 * We cannot do this on 32 bits because at the very least some
	 * 486 CPUs did not behave this way.
	 */
	long tmp = -1;
	asm("bsfl %1,%0"
	    : "=r" (r)
	    : "rm" (x), "0" (tmp));
	    : "rm" (x), "0" (-1));
#elif defined(CONFIG_X86_CMOV)
	asm("bsfl %1,%0\n\t"
	    "cmovzl %2,%0"
@@ -459,10 +458,9 @@ static inline int fls(int x)
	 * We cannot do this on 32 bits because at the very least some
	 * 486 CPUs did not behave this way.
	 */
	long tmp = -1;
	asm("bsrl %1,%0"
	    : "=r" (r)
	    : "rm" (x), "0" (tmp));
	    : "rm" (x), "0" (-1));
#elif defined(CONFIG_X86_CMOV)
	asm("bsrl %1,%0\n\t"
	    "cmovzl %2,%0"
@@ -490,13 +488,13 @@ static inline int fls(int x)
#ifdef CONFIG_X86_64
static __always_inline int fls64(__u64 x)
{
	long bitpos = -1;
	int bitpos = -1;
	/*
	 * AMD64 says BSRQ won't clobber the dest reg if x==0; Intel64 says the
	 * dest reg is undefined if x==0, but their CPU architect says its
	 * value is written to set it to the same as before.
	 */
	asm("bsrq %1,%0"
	asm("bsrq %1,%q0"
	    : "+r" (bitpos)
	    : "rm" (x));
	return bitpos + 1;
+23 −25
Original line number Diff line number Diff line
@@ -49,38 +49,36 @@ For 32-bit we have the following conventions - kernel is built with
#include "dwarf2.h"

/*
 * 64-bit system call stack frame layout defines and helpers, for
 * assembly code (note that the seemingly unnecessary parentheses
 * are to prevent cpp from inserting spaces in expressions that get
 * passed to macros):
 * 64-bit system call stack frame layout defines and helpers,
 * for assembly code:
 */

#define R15		  (0)
#define R14		  (8)
#define R13		 (16)
#define R12		 (24)
#define RBP		 (32)
#define RBX		 (40)
#define R15		  0
#define R14		  8
#define R13		 16
#define R12		 24
#define RBP		 32
#define RBX		 40

/* arguments: interrupts/non tracing syscalls only save up to here: */
#define R11		 (48)
#define R10		 (56)
#define R9		 (64)
#define R8		 (72)
#define RAX		 (80)
#define RCX		 (88)
#define RDX		 (96)
#define RSI		(104)
#define RDI		(112)
#define ORIG_RAX	(120)       /* + error_code */
#define R11		 48
#define R10		 56
#define R9		 64
#define R8		 72
#define RAX		 80
#define RCX		 88
#define RDX		 96
#define RSI		104
#define RDI		112
#define ORIG_RAX	120       /* + error_code */
/* end of arguments */

/* cpu exception frame or undefined in case of fast syscall: */
#define RIP		(128)
#define CS		(136)
#define EFLAGS		(144)
#define RSP		(152)
#define SS		(160)
#define RIP		128
#define CS		136
#define EFLAGS		144
#define RSP		152
#define SS		160

#define ARGOFFSET	R11
#define SWFRAME		ORIG_RAX
+0 −1
Original line number Diff line number Diff line
@@ -423,7 +423,6 @@ DECLARE_INIT_PER_CPU(irq_stack_union);

DECLARE_PER_CPU(char *, irq_stack_ptr);
DECLARE_PER_CPU(unsigned int, irq_count);
extern unsigned long kernel_eflags;
extern asmlinkage void ignore_sysret(void);
#else	/* X86_64 */
#ifdef CONFIG_CC_STACKPROTECTOR
Loading