1 /* Copyright 2002 Andi Kleen, SuSE Labs */
3 #include <linux/config.h>
4 #include <linux/linkage.h>
5 #include <asm/dwarf2.h>
8 * ISO C memset - set a memory block to a byte value.
14 * rax original destination
24 /* expand byte value */
26 movabs $0x0101010101010101,%rax
27 mulq %rsi /* with rax, clobbers rdx */
42 /* expand byte value */
44 movabs $0x0101010101010101,%rax
45 mul %rcx /* with rax, clobbers rdx */
52 .Lafter_bad_alignment:
72 /* Handle tail in loops. The loops should be faster than hard
73 to predict jump tables. */
106 movq %rax,(%rdi) /* unaligned store */
111 jmp .Lafter_bad_alignment
117 /* Some CPUs run faster using the string instructions.
118 It is also a lot simpler. Use this when possible */
120 #include <asm/cpufeature.h>
122 .section .altinstr_replacement,"ax"
123 1: .byte 0xeb /* jmp <disp8> */
124 .byte (memset_c - memset) - (2f - 1b) /* offset */
127 .section .altinstructions,"a"
131 .byte X86_FEATURE_REP_GOOD
132 .byte .Lfinal - memset