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

x86/lib/memmove_64.S: Convert memmove() to ALTERNATIVE macro

Make it execute the ERMS version if support is present and we're in the
forward memmove() part and remove the unfolded alternatives section
definition.

Signed-off-by: Borislav Petkov <bp@suse.de>

+2 -17
+2 -17
arch/x86/lib/memmove_64.S
··· 5 5 * This assembly file is re-written from memmove_64.c file. 6 6 * - Copyright 2011 Fenghua Yu <fenghua.yu@intel.com> 7 7 */ 8 - #define _STRING_C 9 8 #include <linux/linkage.h> 10 9 #include <asm/dwarf2.h> 11 10 #include <asm/cpufeature.h> ··· 43 44 jg 2f 44 45 45 46 .Lmemmove_begin_forward: 47 + ALTERNATIVE "", "movq %rdx, %rcx; rep movsb; retq", X86_FEATURE_ERMS 48 + 46 49 /* 47 50 * movsq instruction have many startup latency 48 51 * so we handle small size by general register. ··· 208 207 13: 209 208 retq 210 209 CFI_ENDPROC 211 - 212 - .section .altinstr_replacement,"ax" 213 - .Lmemmove_begin_forward_efs: 214 - /* Forward moving data. */ 215 - movq %rdx, %rcx 216 - rep movsb 217 - retq 218 - .Lmemmove_end_forward_efs: 219 - .previous 220 - 221 - .section .altinstructions,"a" 222 - altinstruction_entry .Lmemmove_begin_forward, \ 223 - .Lmemmove_begin_forward_efs,X86_FEATURE_ERMS, \ 224 - .Lmemmove_end_forward-.Lmemmove_begin_forward, \ 225 - .Lmemmove_end_forward_efs-.Lmemmove_begin_forward_efs,0 226 - .previous 227 210 ENDPROC(__memmove) 228 211 ENDPROC(memmove)