1bb6811beSMatthew Dillon/* 2bb6811beSMatthew Dillon * Copyright (c) 2010 The DragonFly Project. All rights reserved. 3bb6811beSMatthew Dillon * All rights reserved. 4bb6811beSMatthew Dillon * 5bb6811beSMatthew Dillon * This code is derived from software contributed to The DragonFly Project 6bb6811beSMatthew Dillon * by Venkatesh Srinivas <me@endeavour.zapto.org> 7bb6811beSMatthew Dillon * 8bb6811beSMatthew Dillon * Redistribution and use in source and binary forms, with or without 9bb6811beSMatthew Dillon * modification, are permitted provided that the following conditions 10bb6811beSMatthew Dillon * are met: 11bb6811beSMatthew Dillon * 12bb6811beSMatthew Dillon * 1. Redistributions of source code must retain the above copyright 13bb6811beSMatthew Dillon * notice, this list of conditions and the following disclaimer. 14bb6811beSMatthew Dillon * 2. Redistributions in binary form must reproduce the above copyright 15bb6811beSMatthew Dillon * notice, this list of conditions and the following disclaimer in the 16bb6811beSMatthew Dillon * documentation and/or other materials provided with the distribution. 17bb6811beSMatthew Dillon * 3. Neither the name of The DragonFly Project nor the names of its 18bb6811beSMatthew Dillon * contributors may be used to endorse or promote products derived from this 19bb6811beSMatthew Dillon * software without specific prior written permission. 20bb6811beSMatthew Dillon * 21bb6811beSMatthew Dillon * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' 22bb6811beSMatthew Dillon * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23bb6811beSMatthew Dillon * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24bb6811beSMatthew Dillon * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 25bb6811beSMatthew Dillon * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 26bb6811beSMatthew Dillon * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 27bb6811beSMatthew Dillon * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28bb6811beSMatthew Dillon * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29bb6811beSMatthew Dillon * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 30bb6811beSMatthew Dillon * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31bb6811beSMatthew Dillon * SUCH DAMAGE. 32bb6811beSMatthew Dillon */ 33bb6811beSMatthew Dillon 34bb6811beSMatthew Dillon#include <machine/asmacros.h> 35bb6811beSMatthew Dillon#include <machine/specialreg.h> 36bb6811beSMatthew Dillon 37bb6811beSMatthew Dillon#include "assym.s" 38bb6811beSMatthew Dillon 39bb6811beSMatthew Dillon .text 40bb6811beSMatthew Dillon 41bb6811beSMatthew Dillon/* 42bb6811beSMatthew Dillon * void bzeront(void *buf, size_t n); (%rdi, %rsi) 43bb6811beSMatthew Dillon * 44bb6811beSMatthew Dillon * bzero() using non-temporal stores to bypass cache pollution. Both 45bb6811beSMatthew Dillon * the buffer and size must be 8-byte aligned. 46bb6811beSMatthew Dillon */ 47bb6811beSMatthew DillonENTRY(bzeront) 48bb6811beSMatthew Dillon xorq %rax,%rax 49bb6811beSMatthew Dillon shrq $3,%rsi 50bb6811beSMatthew Dillon1: 51bb6811beSMatthew Dillon movnti %rax,(%rdi) 52bb6811beSMatthew Dillon addq $8,%rdi 53d87e79b9SMatthew Dillon subq $1,%rsi 54bb6811beSMatthew Dillon jne 1b 55d87e79b9SMatthew Dillon retq 56*b1d2a2deSzrjEND(bzeront) 57