]> git.ipfire.org Git - thirdparty/linux.git/commit
x86/asm: Remove semicolon from "rep" prefixes
authorUros Bizjak <ubizjak@gmail.com>
Fri, 18 Apr 2025 07:13:51 +0000 (09:13 +0200)
committerIngo Molnar <mingo@kernel.org>
Fri, 18 Apr 2025 07:33:33 +0000 (09:33 +0200)
commit42c782fae38f0559e6355707ee0afde9ac16dcc3
treeeabb9d7a83a73b1288cfeb259268f583732f0db3
parent4850074ff06fce894a9946c5d3ab8ea13fa33e43
x86/asm: Remove semicolon from "rep" prefixes

Minimum version of binutils required to compile the kernel is 2.25.
This version correctly handles the "rep" prefixes, so it is possible
to remove the semicolon, which was used to support ancient versions
of GNU as.

Due to the semicolon, the compiler considers "rep; insn" (or its
alternate "rep\n\tinsn" form) as two separate instructions. Removing
the semicolon makes asm length calculations more accurate, consequently
making scheduling and inlining decisions of the compiler more accurate.

Removing the semicolon also enables assembler checks involving "rep"
prefixes. Trying to assemble e.g. "rep addl %eax, %ebx" results in:

  Error: invalid instruction `add' after `rep'

Signed-off-by: Uros Bizjak <ubizjak@gmail.com>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Cc: Andy Lutomirski <luto@kernel.org>
Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com>
Cc: Brian Gerst <brgerst@gmail.com>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Josh Poimboeuf <jpoimboe@redhat.com>
Cc: Juergen Gross <jgross@suse.com>
Cc: Kees Cook <keescook@chromium.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Pavel Machek <pavel@kernel.org>
Cc: Rafael J. Wysocki <rafael@kernel.org>
Link: https://lore.kernel.org/r/20250418071437.4144391-2-ubizjak@gmail.com
12 files changed:
arch/x86/include/asm/io.h
arch/x86/include/asm/string_32.h
arch/x86/kernel/head_32.S
arch/x86/kernel/relocate_kernel_32.S
arch/x86/kernel/relocate_kernel_64.S
arch/x86/lib/iomem.c
arch/x86/lib/string_32.c
arch/x86/lib/strstr_32.c
arch/x86/lib/usercopy_32.c
arch/x86/platform/pvh/head.S
arch/x86/power/hibernate_asm_32.S
arch/x86/power/hibernate_asm_64.S