Index: sys/amd64/amd64/support.S =================================================================== --- sys/amd64/amd64/support.S +++ sys/amd64/amd64/support.S @@ -526,6 +526,9 @@ 1256: movq %rdi,%r9 movq %r10,%rax + testq $15,%rdi + jnz 3f +1: .if \erms == 1 rep stosb @@ -536,14 +539,24 @@ stosq movq %r9,%rax andl $7,%edx - jnz 1f + jnz 2f POP_FRAME_POINTER ret -1: +2: movq %r10,-8(%rdi,%rdx) .endif POP_FRAME_POINTER ret + ALIGN_TEXT +3: + movq %r10,(%rdi) + movq %r10,8(%rdi) + movq %rdi,%r8 + andq $15,%r8 + leaq -16(%rcx,%r8),%rcx + neg %r8 + leaq 16(%rdi,%r8),%rdi + jmp 1b .endm ENTRY(memset_std)