strcmp.asm revision 3bcc839f8b6f2046d31282cbd2d937760b56c5ac
dba6b8a60465a62d3e1ee74942535288802e2b79vboxsync; $Id$
dba6b8a60465a62d3e1ee74942535288802e2b79vboxsync;; @file
c97989161fbe75bc14cea477a5443bbf474dd3advboxsync; IPRT - No-CRT strcmp - AMD64 & X86.
dba6b8a60465a62d3e1ee74942535288802e2b79vboxsync;
dba6b8a60465a62d3e1ee74942535288802e2b79vboxsync
dba6b8a60465a62d3e1ee74942535288802e2b79vboxsync;
c97989161fbe75bc14cea477a5443bbf474dd3advboxsync; Copyright (C) 2006-2007 Sun Microsystems, Inc.
dba6b8a60465a62d3e1ee74942535288802e2b79vboxsync;
dba6b8a60465a62d3e1ee74942535288802e2b79vboxsync; This file is part of VirtualBox Open Source Edition (OSE), as
dba6b8a60465a62d3e1ee74942535288802e2b79vboxsync; available from http://www.virtualbox.org. This file is free software;
dba6b8a60465a62d3e1ee74942535288802e2b79vboxsync; you can redistribute it and/or modify it under the terms of the GNU
a16eb14ad7a4b5ef91ddc22d3e8e92d930f736fcvboxsync; General Public License (GPL) as published by the Free Software
a16eb14ad7a4b5ef91ddc22d3e8e92d930f736fcvboxsync; Foundation, in version 2 as it comes in the "COPYING" file of the
a16eb14ad7a4b5ef91ddc22d3e8e92d930f736fcvboxsync; VirtualBox OSE distribution. VirtualBox OSE is distributed in the
a16eb14ad7a4b5ef91ddc22d3e8e92d930f736fcvboxsync; hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
a16eb14ad7a4b5ef91ddc22d3e8e92d930f736fcvboxsync;
a16eb14ad7a4b5ef91ddc22d3e8e92d930f736fcvboxsync; The contents of this file may alternatively be used under the terms
a16eb14ad7a4b5ef91ddc22d3e8e92d930f736fcvboxsync; of the Common Development and Distribution License Version 1.0
a16eb14ad7a4b5ef91ddc22d3e8e92d930f736fcvboxsync; (CDDL) only, as it comes in the "COPYING.CDDL" file of the
a16eb14ad7a4b5ef91ddc22d3e8e92d930f736fcvboxsync; VirtualBox OSE distribution, in which case the provisions of the
a16eb14ad7a4b5ef91ddc22d3e8e92d930f736fcvboxsync; CDDL are applicable instead of those of the GPL.
a16eb14ad7a4b5ef91ddc22d3e8e92d930f736fcvboxsync;
a16eb14ad7a4b5ef91ddc22d3e8e92d930f736fcvboxsync; You may elect to license modified versions of this file under the
a16eb14ad7a4b5ef91ddc22d3e8e92d930f736fcvboxsync; terms and conditions of either the GPL or the CDDL or both.
dba6b8a60465a62d3e1ee74942535288802e2b79vboxsync;
dba6b8a60465a62d3e1ee74942535288802e2b79vboxsync; Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
dba6b8a60465a62d3e1ee74942535288802e2b79vboxsync; Clara, CA 95054 USA or visit http://www.sun.com if you need
dba6b8a60465a62d3e1ee74942535288802e2b79vboxsync; additional information or have any questions.
dba6b8a60465a62d3e1ee74942535288802e2b79vboxsync;
dba6b8a60465a62d3e1ee74942535288802e2b79vboxsync
dba6b8a60465a62d3e1ee74942535288802e2b79vboxsync%include "iprt/asmdefs.mac"
dba6b8a60465a62d3e1ee74942535288802e2b79vboxsync
dba6b8a60465a62d3e1ee74942535288802e2b79vboxsyncBEGINCODE
dba6b8a60465a62d3e1ee74942535288802e2b79vboxsync
dba6b8a60465a62d3e1ee74942535288802e2b79vboxsync;;
dba6b8a60465a62d3e1ee74942535288802e2b79vboxsync; @param psz1 gcc: rdi msc: rcx x86:[esp+4]
dba6b8a60465a62d3e1ee74942535288802e2b79vboxsync; @param psz2 gcc: rsi msc: rdx x86:[esp+8]
dba6b8a60465a62d3e1ee74942535288802e2b79vboxsyncBEGINPROC RT_NOCRT(strcmp)
dba6b8a60465a62d3e1ee74942535288802e2b79vboxsync ; input
dba6b8a60465a62d3e1ee74942535288802e2b79vboxsync%ifdef RT_ARCH_AMD64
dba6b8a60465a62d3e1ee74942535288802e2b79vboxsync %ifdef ASM_CALL64_MSC
dba6b8a60465a62d3e1ee74942535288802e2b79vboxsync %define psz1 rcx
dba6b8a60465a62d3e1ee74942535288802e2b79vboxsync %define psz2 rdx
dba6b8a60465a62d3e1ee74942535288802e2b79vboxsync %else
%define psz1 rdi
%define psz2 rsi
%endif
%else
mov ecx, [esp + 4]
mov edx, [esp + 8]
%define psz1 ecx
%define psz2 edx
%endif
;
; The loop.
;
.next:
mov al, [psz1]
mov ah, [psz2]
cmp al, ah
jne .not_equal
test al, al
jz .equal
mov al, [psz1 + 1]
mov ah, [psz2 + 1]
cmp al, ah
jne .not_equal
test al, al
jz .equal
mov al, [psz1 + 2]
mov ah, [psz2 + 2]
cmp al, ah
jne .not_equal
test al, al
jz .equal
mov al, [psz1 + 3]
mov ah, [psz2 + 3]
cmp al, ah
jne .not_equal
test al, al
jz .equal
add psz1, 4
add psz2, 4
jmp .next
.equal:
xor eax, eax
ret
.not_equal:
movzx ecx, ah
and eax, 0ffh
sub eax, ecx
ret
ENDPROC RT_NOCRT(strcmp)