2 * ====================================================
3 * Copyright (C) 2007 by Ellips BV. All rights reserved.
5 * Permission to use, copy, modify, and distribute this
6 * software is freely granted, provided that this notice
8 * ====================================================
11 #include "x86_64mach.h"
14 SOTYPE_FUNCTION(memset)
17 movq rdi, r9 /* Save return value */
23 movq rdi, r8 /* Align on quad word boundary */
33 movabs $0x0101010101010101, r8
39 shrq $7, rcx /* Store 128 bytes at a time with minimum cache polution */
56 movntiq rax, 104 (rdi)
57 movntiq rax, 112 (rdi)
58 movntiq rax, 120 (rdi)
85 rep stosb /* Store the remaining bytes */