10Sstevel@tonic-gate/* 20Sstevel@tonic-gate * CDDL HEADER START 30Sstevel@tonic-gate * 40Sstevel@tonic-gate * The contents of this file are subject to the terms of the 56812Sraf * Common Development and Distribution License (the "License"). 66812Sraf * You may not use this file except in compliance with the License. 70Sstevel@tonic-gate * 80Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 90Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 100Sstevel@tonic-gate * See the License for the specific language governing permissions 110Sstevel@tonic-gate * and limitations under the License. 120Sstevel@tonic-gate * 130Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 140Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 150Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 160Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 170Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 180Sstevel@tonic-gate * 190Sstevel@tonic-gate * CDDL HEADER END 200Sstevel@tonic-gate */ 216812Sraf 220Sstevel@tonic-gate/* 236812Sraf * Copyright 2008 Sun Microsystems, Inc. All rights reserved. 240Sstevel@tonic-gate * Use is subject to license terms. 250Sstevel@tonic-gate */ 260Sstevel@tonic-gate 27*7298SMark.J.Nelson@Sun.COM .file "wschr.s" 280Sstevel@tonic-gate 290Sstevel@tonic-gate/ 300Sstevel@tonic-gate/ Wide character wcschr() implementation 310Sstevel@tonic-gate/ 320Sstevel@tonic-gate/ Algorithm based on Solaris 2.6 gen/strchr.s implementation 330Sstevel@tonic-gate/ 340Sstevel@tonic-gate 350Sstevel@tonic-gate#include <sys/asm_linkage.h> 360Sstevel@tonic-gate 370Sstevel@tonic-gate ANSI_PRAGMA_WEAK(wcschr,function) 380Sstevel@tonic-gate ANSI_PRAGMA_WEAK(wschr,function) 390Sstevel@tonic-gate 400Sstevel@tonic-gate .align 8 / accounts for .loop alignment and prolog 410Sstevel@tonic-gate 426812Sraf ENTRY(wcschr) /* (wchar_t *s, wchar_t wc) */ 430Sstevel@tonic-gate movq %rdi,%rax 440Sstevel@tonic-gate.loop: 450Sstevel@tonic-gate movl (%rax),%edx / %edx = wchar of string 460Sstevel@tonic-gate cmpl %esi,%edx / find it? 470Sstevel@tonic-gate je .found / yes 480Sstevel@tonic-gate testl %edx,%edx / is it null? 490Sstevel@tonic-gate je .notfound 500Sstevel@tonic-gate 510Sstevel@tonic-gate movl 4(%rax),%edx / %edx = wchar of string 520Sstevel@tonic-gate cmpl %esi,%edx / find it? 530Sstevel@tonic-gate je .found1 / yes 540Sstevel@tonic-gate testl %edx,%edx / is it null? 550Sstevel@tonic-gate je .notfound 560Sstevel@tonic-gate 570Sstevel@tonic-gate movl 8(%rax),%edx / %edx = wchar of string 580Sstevel@tonic-gate cmpl %esi,%edx / find it? 590Sstevel@tonic-gate je .found2 / yes 600Sstevel@tonic-gate testl %edx,%edx / is it null? 610Sstevel@tonic-gate je .notfound 620Sstevel@tonic-gate 630Sstevel@tonic-gate movl 12(%rax),%edx / %edx = wchar of string 640Sstevel@tonic-gate cmpl %esi,%edx / find it? 650Sstevel@tonic-gate je .found3 / yes 660Sstevel@tonic-gate addq $16,%rax 670Sstevel@tonic-gate testl %edx,%edx / is it null? 680Sstevel@tonic-gate jne .loop 690Sstevel@tonic-gate 700Sstevel@tonic-gate.notfound: 710Sstevel@tonic-gate xorl %eax,%eax / %rax = NULL 720Sstevel@tonic-gate ret 730Sstevel@tonic-gate 740Sstevel@tonic-gate.found3: 750Sstevel@tonic-gate addq $12,%rax 760Sstevel@tonic-gate ret 770Sstevel@tonic-gate.found2: 780Sstevel@tonic-gate addq $8,%rax 790Sstevel@tonic-gate ret 800Sstevel@tonic-gate.found1: 810Sstevel@tonic-gate addq $4,%rax 820Sstevel@tonic-gate.found: 830Sstevel@tonic-gate ret 846812Sraf SET_SIZE(wcschr) 850Sstevel@tonic-gate 866812Sraf ENTRY(wschr) 876812Sraf jmp wcschr / tail call into wcschr 886812Sraf SET_SIZE(wschr) 89