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 5*7298SMark.J.Nelson@Sun.COM * Common Development and Distribution License (the "License"). 6*7298SMark.J.Nelson@Sun.COM * 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 */ 210Sstevel@tonic-gate/* 220Sstevel@tonic-gate * Copyright 2004 Sun Microsystems, Inc. All rights reserved. 230Sstevel@tonic-gate * Use is subject to license terms. 240Sstevel@tonic-gate */ 250Sstevel@tonic-gate 26*7298SMark.J.Nelson@Sun.COM .file "strchr.s" 270Sstevel@tonic-gate 280Sstevel@tonic-gate#include "SYS.h" 290Sstevel@tonic-gate 300Sstevel@tonic-gate ENTRY(strchr) /* (char *, char) */ 310Sstevel@tonic-gate.loop: 320Sstevel@tonic-gate movb (%rdi),%dl / %dl = byte of string 330Sstevel@tonic-gate cmpb %sil,%dl / find it? 340Sstevel@tonic-gate je .found / yes 350Sstevel@tonic-gate testb %dl,%dl / is it null? 360Sstevel@tonic-gate je .notfound 370Sstevel@tonic-gate 380Sstevel@tonic-gate movb 1(%rdi),%dl / %dl = byte of string 390Sstevel@tonic-gate cmpb %sil,%dl / find it? 400Sstevel@tonic-gate je .found1 / yes 410Sstevel@tonic-gate testb %dl,%dl / is it null? 420Sstevel@tonic-gate je .notfound 430Sstevel@tonic-gate 440Sstevel@tonic-gate movb 2(%rdi),%dl / %dl = byte of string 450Sstevel@tonic-gate cmpb %sil,%dl / find it? 460Sstevel@tonic-gate je .found2 / yes 470Sstevel@tonic-gate testb %dl,%dl / is it null? 480Sstevel@tonic-gate je .notfound 490Sstevel@tonic-gate 500Sstevel@tonic-gate movb 3(%rdi),%dl / %dl = byte of string 510Sstevel@tonic-gate cmpb %sil,%dl / find it? 520Sstevel@tonic-gate je .found3 / yes 530Sstevel@tonic-gate addq $4,%rdi 540Sstevel@tonic-gate testb %dl,%dl / is it null? 550Sstevel@tonic-gate jne .loop 560Sstevel@tonic-gate 570Sstevel@tonic-gate.notfound: 580Sstevel@tonic-gate xorl %eax,%eax / %rax = NULL 590Sstevel@tonic-gate ret 600Sstevel@tonic-gate 610Sstevel@tonic-gate.found3: 620Sstevel@tonic-gate incq %rdi 630Sstevel@tonic-gate.found2: 640Sstevel@tonic-gate incq %rdi 650Sstevel@tonic-gate.found1: 660Sstevel@tonic-gate incq %rdi 670Sstevel@tonic-gate.found: 680Sstevel@tonic-gate movq %rdi,%rax 690Sstevel@tonic-gate ret 700Sstevel@tonic-gate SET_SIZE(strchr) 71