/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright (c) 2009, Intel Corporation
* All rights reserved.
*/
/*
* str[n]cpy - copy [n] chars from second operand into first operand
*/
#include "SYS.h"
#include "proc64_id.h"
#ifdef USE_AS_STRNCPY
#else
#endif
#ifdef USE_AS_STRNCPY
/*
* Check if the count is satisfied in first 16 bytes examined.
*/
#endif
#ifdef USE_AS_STRNCPY
/*
* If strncpy count <= 16 go to exit case
*/
#endif
/*
* At least 16 bytes to copy to destination string. Move them now.
* Don't worry about alignment.
*/
/*
* so far destination rdi may be aligned by 16, re-calculate rsi and
* rcx is offset of rsi
* rdx is offset of rdi
*/
#ifdef USE_AS_STRNCPY
/*
* Will now do 16 byte aligned stores. Stores may overlap some bytes
* (ie store twice) if destination was unaligned. Compensate here.
*/
#endif
/*
* align src to 16-byte boundary. Could be up or down depending on
* whether src offset - dest offset > 0 (up) or
* src offset - dest offset < 0 (down).
*/
#ifdef USE_AS_STRNCPY
#endif
/*
* Index = (16 + (src offset - dest offset)) % 16
*/
/*
* ashr_0 handles the following cases:
* src alignment offset = dest alignment offset
*/
.p2align 5
#ifdef USE_AS_STRNCPY
#endif
#ifdef USE_AS_STRNCPY
#endif
#ifdef USE_AS_STRNCPY
#endif
#ifdef USE_AS_STRNCPY
#endif
#ifdef USE_AS_STRNCPY
#endif
/*
* ashr_15 handles the following cases:
* (16 + (src offset - dest offset)) % 16 = 15
*
* Based on above operation, start from (%r9 + rsi) to the left of this cache
* bank, there is no null byte.
*/
.p2align 4
#ifdef USE_AS_STRNCPY
#endif
.p2align 4
#ifdef USE_AS_STRNCPY
#endif
#ifdef USE_AS_STRNCPY
#endif
#ifdef USE_AS_STRNCPY
#endif
#ifdef USE_AS_STRNCPY
#endif
.p2align 4
#ifdef USE_AS_STRNCPY
#endif
#ifdef USE_AS_STRNCPY
#endif
#ifdef USE_AS_STRNCPY
#endif
#ifdef USE_AS_STRNCPY
#endif
/*
* ashr_14 handles the following cases:
* (16 + (src offset - dest offset)) % 16 = 14
*
* Based on above operation, start from (%r9 + rsi) to the left of this cache
* bank, there is no null byte.
*/
.p2align 4
#ifdef USE_AS_STRNCPY
#endif
.p2align 4
#ifdef USE_AS_STRNCPY
#endif
#ifdef USE_AS_STRNCPY
#endif
#ifdef USE_AS_STRNCPY
#endif
#ifdef USE_AS_STRNCPY
#endif
.p2align 4
#ifdef USE_AS_STRNCPY
#endif
#ifdef USE_AS_STRNCPY
#endif
#ifdef USE_AS_STRNCPY
#endif
#ifdef USE_AS_STRNCPY
#endif
/*
* ashr_13 handles the following cases:
* (16 + (src offset - dest offset)) % 16 = 13
*
* Based on above operation, start from (%r9 + rsi) to the left of this cache
* bank, there is no null byte.
*/
.p2align 4
#ifdef USE_AS_STRNCPY
#endif
.p2align 4
#ifdef USE_AS_STRNCPY
#endif
#ifdef USE_AS_STRNCPY
#endif
#ifdef USE_AS_STRNCPY
#endif
#ifdef USE_AS_STRNCPY
#endif
.p2align 4
#ifdef USE_AS_STRNCPY
#endif
#ifdef USE_AS_STRNCPY
#endif
#ifdef USE_AS_STRNCPY
#endif
#ifdef USE_AS_STRNCPY
#endif
/*
* ashr_12 handles the following cases:
* (16 + (src offset - dest offset)) % 16 = 12
*
* Based on above operation, start from (%r9 + rsi) to the left of this cache
* bank, there is no null byte.
*/
.p2align 4
#ifdef USE_AS_STRNCPY
#endif
.p2align 4
#ifdef USE_AS_STRNCPY
#endif
#ifdef USE_AS_STRNCPY
#endif
#ifdef USE_AS_STRNCPY
#endif
#ifdef USE_AS_STRNCPY
#endif
.p2align 4
#ifdef USE_AS_STRNCPY
#endif
#ifdef USE_AS_STRNCPY
#endif
#ifdef USE_AS_STRNCPY
#endif
#ifdef USE_AS_STRNCPY
#endif
/*
* ashr_11 handles the following cases:
* (16 + (src offset - dest offset)) % 16 = 11
*
* Based on above operation, start from (%r9 + rsi) to the left of this cache
* bank, there is no null byte.
*/
.p2align 4
#ifdef USE_AS_STRNCPY
#endif
.p2align 4
#ifdef USE_AS_STRNCPY
#endif
#ifdef USE_AS_STRNCPY
#endif
#ifdef USE_AS_STRNCPY
#endif
#ifdef USE_AS_STRNCPY
#endif
.p2align 4
#ifdef USE_AS_STRNCPY
#endif
#ifdef USE_AS_STRNCPY
#endif
#ifdef USE_AS_STRNCPY
#endif
#ifdef USE_AS_STRNCPY
#endif
/*
* ashr_10 handles the following cases:
* (16 + (src offset - dest offset)) % 16 = 10
*
* Based on above operation, start from (%r9 + rsi) to the left of this cache
* bank, there is no null byte.
*/
.p2align 4
#ifdef USE_AS_STRNCPY
#endif
.p2align 4
#ifdef USE_AS_STRNCPY
#endif
#ifdef USE_AS_STRNCPY
#endif
#ifdef USE_AS_STRNCPY
#endif
#ifdef USE_AS_STRNCPY
#endif
.p2align 4
#ifdef USE_AS_STRNCPY
#endif
#ifdef USE_AS_STRNCPY
#endif
#ifdef USE_AS_STRNCPY
#endif
#ifdef USE_AS_STRNCPY
#endif
/*
* ashr_9 handles the following cases:
* (16 + (src offset - dest offset)) % 16 = 9
*
* Based on above operation, start from (%r9 + rsi) to the left of this cache
* bank, there is no null byte.
*/
.p2align 4
#ifdef USE_AS_STRNCPY
#endif
.p2align 4
#ifdef USE_AS_STRNCPY
#endif
#ifdef USE_AS_STRNCPY
#endif
#ifdef USE_AS_STRNCPY
#endif
#ifdef USE_AS_STRNCPY
#endif
.p2align 4
#ifdef USE_AS_STRNCPY
#endif
#ifdef USE_AS_STRNCPY
#endif
#ifdef USE_AS_STRNCPY
#endif
#ifdef USE_AS_STRNCPY
#endif
/*
* ashr_8 handles the following cases:
* (16 + (src offset - dest offset)) % 16 = 8
*
* Based on above operation, start from (%r9 + rsi) to the left of this cache
* bank, there is no null byte.
*/
.p2align 4
#ifdef USE_AS_STRNCPY
#endif
.p2align 4
#ifdef USE_AS_STRNCPY
#endif
#ifdef USE_AS_STRNCPY
#endif
#ifdef USE_AS_STRNCPY
#endif
#ifdef USE_AS_STRNCPY
#endif
.p2align 4
#ifdef USE_AS_STRNCPY
#endif
#ifdef USE_AS_STRNCPY
#endif
#ifdef USE_AS_STRNCPY
#endif
#ifdef USE_AS_STRNCPY
#endif
/*
* ashr_7 handles the following cases:
* (16 + (src offset - dest offset)) % 16 = 7
*
* Based on above operation, start from (%r9 + rsi) to the left of this cache
* bank, there is no null byte.
*/
.p2align 4
#ifdef USE_AS_STRNCPY
#endif
.p2align 4
#ifdef USE_AS_STRNCPY
#endif
#ifdef USE_AS_STRNCPY
#endif
#ifdef USE_AS_STRNCPY
#endif
#ifdef USE_AS_STRNCPY
#endif
.p2align 4
#ifdef USE_AS_STRNCPY
#endif
#ifdef USE_AS_STRNCPY
#endif
#ifdef USE_AS_STRNCPY
#endif
#ifdef USE_AS_STRNCPY
#endif
/*
* ashr_6 handles the following cases:
* (16 + (src offset - dest offset)) % 16 = 6
*
* Based on above operation, start from (%r9 + rsi) to the left of this cache
* bank, there is no null byte.
*/
.p2align 4
#ifdef USE_AS_STRNCPY
#endif
.p2align 4
#ifdef USE_AS_STRNCPY
#endif
#ifdef USE_AS_STRNCPY
#endif
#ifdef USE_AS_STRNCPY
#endif
#ifdef USE_AS_STRNCPY
#endif
.p2align 4
#ifdef USE_AS_STRNCPY
#endif
#ifdef USE_AS_STRNCPY
#endif
#ifdef USE_AS_STRNCPY
#endif
#ifdef USE_AS_STRNCPY
#endif
/*
* ashr_5 handles the following cases:
* (16 + (src offset - dest offset)) % 16 = 5
*
* Based on above operation, start from (%r9 + rsi) to the left of this cache
* bank, there is no null byte.
*/
.p2align 4
#ifdef USE_AS_STRNCPY
#endif
.p2align 4
#ifdef USE_AS_STRNCPY
#endif
#ifdef USE_AS_STRNCPY
#endif
#ifdef USE_AS_STRNCPY
#endif
#ifdef USE_AS_STRNCPY
#endif
.p2align 4
#ifdef USE_AS_STRNCPY
#endif
#ifdef USE_AS_STRNCPY
#endif
#ifdef USE_AS_STRNCPY
#endif
#ifdef USE_AS_STRNCPY
#endif
/*
* ashr_4 handles the following cases:
* (16 + (src offset - dest offset)) % 16 = 4
*
* Based on above operation, start from (%r9 + rsi) to the left of this cache
* bank, there is no null byte.
*/
.p2align 4
#ifdef USE_AS_STRNCPY
#endif
.p2align 4
#ifdef USE_AS_STRNCPY
#endif
#ifdef USE_AS_STRNCPY
#endif
#ifdef USE_AS_STRNCPY
#endif
#ifdef USE_AS_STRNCPY
#endif
.p2align 4
#ifdef USE_AS_STRNCPY
#endif
#ifdef USE_AS_STRNCPY
#endif
#ifdef USE_AS_STRNCPY
#endif
#ifdef USE_AS_STRNCPY
#endif
/*
* ashr_3 handles the following cases:
* (16 + (src offset - dest offset)) % 16 = 3
*
* Based on above operation, start from (%r9 + rsi) to the left of this cache
* bank, there is no null byte.
*/
.p2align 4
#ifdef USE_AS_STRNCPY
#endif
.p2align 4
#ifdef USE_AS_STRNCPY
#endif
#ifdef USE_AS_STRNCPY
#endif
#ifdef USE_AS_STRNCPY
#endif
#ifdef USE_AS_STRNCPY
#endif
.p2align 4
#ifdef USE_AS_STRNCPY
#endif
#ifdef USE_AS_STRNCPY
#endif
#ifdef USE_AS_STRNCPY
#endif
#ifdef USE_AS_STRNCPY
#endif
/*
* ashr_2 handles the following cases:
* (16 + (src offset - dest offset)) % 16 = 2
*
* Based on above operation, start from (%r9 + rsi) to the left of this cache
* bank, there is no null byte.
*/
.p2align 4
#ifdef USE_AS_STRNCPY
#endif
.p2align 4
#ifdef USE_AS_STRNCPY
#endif
#ifdef USE_AS_STRNCPY
#endif
#ifdef USE_AS_STRNCPY
#endif
#ifdef USE_AS_STRNCPY
#endif
.p2align 4
#ifdef USE_AS_STRNCPY
#endif
#ifdef USE_AS_STRNCPY
#endif
#ifdef USE_AS_STRNCPY
#endif
#ifdef USE_AS_STRNCPY
#endif
/*
* ashr_1 handles the following cases:
* (16 + (src offset - dest offset)) % 16 = 1
*
* Based on above operation, start from (%r9 + rsi) to the left of this cache
* bank, there is no null byte.
*/
.p2align 4
#ifdef USE_AS_STRNCPY
#endif
.p2align 4
#ifdef USE_AS_STRNCPY
#endif
#ifdef USE_AS_STRNCPY
#endif
#ifdef USE_AS_STRNCPY
#endif
#ifdef USE_AS_STRNCPY
#endif
.p2align 4
#ifdef USE_AS_STRNCPY
#endif
#ifdef USE_AS_STRNCPY
#endif
#ifdef USE_AS_STRNCPY
#endif
#ifdef USE_AS_STRNCPY
#endif
/*
* Exit tail code:
* Up to 32 bytes are copied in the case of strcpy.
*/
.p2align 4
.p2align 4
#ifdef USE_AS_STRNCPY
/*
* Null found in 16bytes checked. Set bit in bitmask corresponding to
* the strncpy count argument. We will copy to the null (inclusive)
* or count whichever comes first.
*/
#endif
/*
* Check to see if BSF is fast on this processor. If not, use a
* different exit tail.
*/
#ifdef USE_AS_STRNCPY
/*
* Count reached before null found.
*/
.p2align 4
.p2align 4
#endif
.p2align 4
.p2align 4
#ifdef USE_AS_STRNCPY
#endif
#ifdef USE_AS_STRNCPY
/*
* Null terminated src string shorter than count. Fill the rest of the
* destination with null chars.
*/
.p2align 4
#endif
.p2align 4
#ifdef USE_AS_STRNCPY
#endif
.p2align 4
#ifdef USE_AS_STRNCPY
#endif
.p2align 4
#ifdef USE_AS_STRNCPY
#endif
.p2align 4
#ifdef USE_AS_STRNCPY
#endif
.p2align 4
#ifdef USE_AS_STRNCPY
#endif
.p2align 4
#ifdef USE_AS_STRNCPY
#endif
.p2align 4
#ifdef USE_AS_STRNCPY
#endif
.p2align 4
#ifdef USE_AS_STRNCPY
#endif
.p2align 4
.p2align 4
#ifdef USE_AS_STRNCPY
#endif
.p2align 4
#ifdef USE_AS_STRNCPY
#endif
.p2align 4
#ifdef USE_AS_STRNCPY
#endif
.p2align 4
#ifdef USE_AS_STRNCPY
#endif
.p2align 4
#ifdef USE_AS_STRNCPY
#endif
.p2align 4
#ifdef USE_AS_STRNCPY
#endif
.p2align 4
#ifdef USE_AS_STRNCPY
#endif
.p2align 4
.p2align 4
#ifdef USE_AS_STRNCPY
#endif
.p2align 4
#ifdef USE_AS_STRNCPY
#endif
.p2align 4
#ifdef USE_AS_STRNCPY
#endif
.p2align 4
#ifdef USE_AS_STRNCPY
#endif
.p2align 4
#ifdef USE_AS_STRNCPY
#endif
.p2align 4
#ifdef USE_AS_STRNCPY
#endif
.p2align 4
#ifdef USE_AS_STRNCPY
#endif
.p2align 4
#ifdef USE_AS_STRNCPY
#endif
.p2align 4
.p2align 4
#ifdef USE_AS_STRNCPY
#endif
.p2align 4
#ifdef USE_AS_STRNCPY
#endif
.p2align 4
#ifdef USE_AS_STRNCPY
#endif
.p2align 4
#ifdef USE_AS_STRNCPY
#endif
.p2align 4
#ifdef USE_AS_STRNCPY
#endif
.p2align 4
#ifdef USE_AS_STRNCPY
#endif
.p2align 4
#ifdef USE_AS_STRNCPY
#endif
.p2align 4
#ifdef USE_AS_STRNCPY
#endif
.p2align 4
.p2align 4
#ifdef USE_AS_STRNCPY
#else
#endif