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

x86/asm: Fix register order

Ensure the register order is correct; this allows for easy translation
between register number and trampoline and vice-versa.

Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: Borislav Petkov <bp@suse.de>
Acked-by: Josh Poimboeuf <jpoimboe@redhat.com>
Tested-by: Alexei Starovoitov <ast@kernel.org>
Link: https://lore.kernel.org/r/20211026120309.978573921@infradead.org

+10 -4
+10 -4
arch/x86/include/asm/GEN-for-each-reg.h
··· 1 + /* SPDX-License-Identifier: GPL-2.0 */ 2 + /* 3 + * These are in machine order; things rely on that. 4 + */ 1 5 #ifdef CONFIG_64BIT 2 6 GEN(rax) 3 - GEN(rbx) 4 7 GEN(rcx) 5 8 GEN(rdx) 9 + GEN(rbx) 10 + GEN(rsp) 11 + GEN(rbp) 6 12 GEN(rsi) 7 13 GEN(rdi) 8 - GEN(rbp) 9 14 GEN(r8) 10 15 GEN(r9) 11 16 GEN(r10) ··· 21 16 GEN(r15) 22 17 #else 23 18 GEN(eax) 24 - GEN(ebx) 25 19 GEN(ecx) 26 20 GEN(edx) 21 + GEN(ebx) 22 + GEN(esp) 23 + GEN(ebp) 27 24 GEN(esi) 28 25 GEN(edi) 29 - GEN(ebp) 30 26 #endif