1112059Stjr/*- 2112059Stjr * Copyright (c) 2003 Tim J. Robbins. 3112059Stjr * All rights reserved. 4112059Stjr * 5112059Stjr * Redistribution and use in source and binary forms, with or without 6112059Stjr * modification, are permitted provided that the following conditions 7112059Stjr * are met: 8112059Stjr * 1. Redistributions of source code must retain the above copyright 9112059Stjr * notice, this list of conditions and the following disclaimer. 10112059Stjr * 2. Redistributions in binary form must reproduce the above copyright 11112059Stjr * notice, this list of conditions and the following disclaimer in the 12112059Stjr * documentation and/or other materials provided with the distribution. 13112059Stjr * 14112059Stjr * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 15112059Stjr * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16112059Stjr * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 17112059Stjr * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 18112059Stjr * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19112059Stjr * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20112059Stjr * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21112059Stjr * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22112059Stjr * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23112059Stjr * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24112059Stjr * SUCH DAMAGE. 25112059Stjr */ 26112059Stjr 27112059Stjr#include <machine/asm.h> 28112059Stjr__FBSDID("$FreeBSD$"); 29112059Stjr 30112059Stjr/* 31112059Stjr * int 32112059Stjr * wcscmp(const wchar_t *s1, const wchar_t *s2) -- 33112059Stjr * Return an integer greater than, equal to, or less than 0, when 34112059Stjr * the string s1 is greater than, equal to, or less than the string s2. 35112059Stjr */ 36112059StjrENTRY(wcscmp) 37112059Stjr pushl %edi 38112059Stjr pushl %esi 39112059Stjr movl 12(%esp),%edi /* s1 */ 40112059Stjr movl 16(%esp),%esi /* s2 */ 41112059Stjr.p2align 4,0x90 42112059Stjrtop: movl (%edi),%eax 43112059Stjr cmpl %eax,(%esi) 44112059Stjr jne no0 45112059Stjr testl %eax,%eax 46112059Stjr jz same 47112059Stjr movl 4(%edi),%eax 48112059Stjr cmpl %eax,4(%esi) 49112059Stjr jne no4 50112059Stjr testl %eax,%eax 51112059Stjr jz same 52112059Stjr movl 8(%edi),%eax 53112059Stjr cmpl %eax,8(%esi) 54112059Stjr jne no8 55112059Stjr testl %eax,%eax 56112059Stjr jz same 57112059Stjr movl 12(%edi),%eax 58112059Stjr cmpl %eax,12(%esi) 59112059Stjr jne no12 60112059Stjr leal 16(%edi),%edi 61112059Stjr leal 16(%esi),%esi 62112059Stjr testl %eax,%eax 63112059Stjr jnz top 64112059Stjr.p2align 2,0x90 65112059Stjrsame: xorl %eax,%eax 66112059Stjr popl %esi 67112059Stjr popl %edi 68112059Stjr ret 69112059Stjr.p2align 2,0x90 70112059Stjrno12: leal 4(%esi),%esi 71112059Stjr.p2align 2,0x90 72112059Stjrno8: leal 4(%esi),%esi 73112059Stjr.p2align 2,0x90 74112059Stjrno4: leal 4(%esi),%esi 75112059Stjr.p2align 2,0x90 76112059Stjrno0: subl (%esi),%eax 77112059Stjr popl %esi 78112059Stjr popl %edi 79112059Stjr ret 80184548SpeterEND(wcscmp) 81217106Skib 82217106Skib .section .note.GNU-stack,"",%progbits 83