1113103Stjr/*- 2113103Stjr * Copyright (c) 2003 Tim J. Robbins. 3113103Stjr * All rights reserved. 4113103Stjr * 5113103Stjr * Redistribution and use in source and binary forms, with or without 6113103Stjr * modification, are permitted provided that the following conditions 7113103Stjr * are met: 8113103Stjr * 1. Redistributions of source code must retain the above copyright 9113103Stjr * notice, this list of conditions and the following disclaimer. 10113103Stjr * 2. Redistributions in binary form must reproduce the above copyright 11113103Stjr * notice, this list of conditions and the following disclaimer in the 12113103Stjr * documentation and/or other materials provided with the distribution. 13113103Stjr * 14113103Stjr * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 15113103Stjr * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16113103Stjr * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 17113103Stjr * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 18113103Stjr * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19113103Stjr * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20113103Stjr * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21113103Stjr * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22113103Stjr * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23113103Stjr * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24113103Stjr * SUCH DAMAGE. 25113103Stjr */ 26113103Stjr 27113103Stjr#include <machine/asm.h> 28113103Stjr__FBSDID("$FreeBSD$"); 29113103Stjr 30113103Stjr/* 31113103Stjr * wchar_t * 32113103Stjr * wcschr(const wchar_t *s, wchar_t c) -- 33113103Stjr * Return pointer to first occurrence of the character `c' in the wide 34113103Stjr * character string `s', or NULL if not found. 35113103Stjr */ 36113103StjrENTRY(wcschr) 37113103Stjr movl 4(%esp),%ecx /* String */ 38113103Stjr movl 8(%esp),%eax /* Character */ 39113103Stjr pushl %ebx 40113103Stjr.p2align 4,0x90 41113103StjrL1: movl (%ecx),%ebx 42113103Stjr cmpl %eax,%ebx 43113103Stjr je found0 44113103Stjr testl %ebx,%ebx 45113103Stjr jz no 46113103Stjr movl 4(%ecx),%ebx 47113103Stjr cmpl %eax,%ebx 48113103Stjr je found1 49113103Stjr testl %ebx,%ebx 50113103Stjr jz no 51113103Stjr movl 8(%ecx),%ebx 52113103Stjr cmpl %eax,%ebx 53113103Stjr je found2 54113103Stjr testl %ebx,%ebx 55113103Stjr jz no 56113103Stjr movl 12(%ecx),%ebx 57113103Stjr cmpl %eax,%ebx 58113103Stjr je found3 59113103Stjr testl %ebx,%ebx 60113103Stjr jz no 61113103Stjr leal 16(%ecx),%ecx 62113103Stjr jmp L1 63113103Stjr.p2align 2,0x90 64113103Stjrfound3: leal 4(%ecx),%ecx 65113103Stjr.p2align 2,0x90 66113103Stjrfound2: leal 4(%ecx),%ecx 67113103Stjr.p2align 2,0x90 68113103Stjrfound1: leal 4(%ecx),%ecx 69113103Stjr.p2align 2,0x90 70113103Stjrfound0: popl %ebx 71113103Stjr movl %ecx,%eax 72113103Stjr ret 73113103Stjr.p2align 2,0x90 74113103Stjrno: popl %ebx 75113103Stjr xorl %eax,%eax 76113103Stjr ret 77184548SpeterEND(wcschr) 78217106Skib 79217106Skib .section .note.GNU-stack,"",%progbits 80