VirtualBox

source: vbox/trunk/src/VBox/Runtime/common/string/strcmp.asm@ 72778

Last change on this file since 72778 was 69219, checked in by vboxsync, 7 years ago

Runtime: scm cleanups

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id Revision
File size: 2.3 KB
Line 
1; $Id: strcmp.asm 69219 2017-10-24 15:01:30Z vboxsync $
2;; @file
3; IPRT - No-CRT strcmp - AMD64 & X86.
4;
5
6;
7; Copyright (C) 2006-2017 Oracle Corporation
8;
9; This file is part of VirtualBox Open Source Edition (OSE), as
10; available from http://www.virtualbox.org. This file is free software;
11; you can redistribute it and/or modify it under the terms of the GNU
12; General Public License (GPL) as published by the Free Software
13; Foundation, in version 2 as it comes in the "COPYING" file of the
14; VirtualBox OSE distribution. VirtualBox OSE is distributed in the
15; hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
16;
17; The contents of this file may alternatively be used under the terms
18; of the Common Development and Distribution License Version 1.0
19; (CDDL) only, as it comes in the "COPYING.CDDL" file of the
20; VirtualBox OSE distribution, in which case the provisions of the
21; CDDL are applicable instead of those of the GPL.
22;
23; You may elect to license modified versions of this file under the
24; terms and conditions of either the GPL or the CDDL or both.
25;
26
27%include "iprt/asmdefs.mac"
28
29BEGINCODE
30
31;;
32; @param psz1 gcc: rdi msc: rcx x86:[esp+4]
33; @param psz2 gcc: rsi msc: rdx x86:[esp+8]
34RT_NOCRT_BEGINPROC strcmp
35 ; input
36%ifdef RT_ARCH_AMD64
37 %ifdef ASM_CALL64_MSC
38 %define psz1 rcx
39 %define psz2 rdx
40 %else
41 %define psz1 rdi
42 %define psz2 rsi
43 %endif
44%else
45 mov ecx, [esp + 4]
46 mov edx, [esp + 8]
47 %define psz1 ecx
48 %define psz2 edx
49%endif
50
51 ;
52 ; The loop.
53 ;
54.next:
55 mov al, [psz1]
56 mov ah, [psz2]
57 cmp al, ah
58 jne .not_equal
59 test al, al
60 jz .equal
61
62 mov al, [psz1 + 1]
63 mov ah, [psz2 + 1]
64 cmp al, ah
65 jne .not_equal
66 test al, al
67 jz .equal
68
69 mov al, [psz1 + 2]
70 mov ah, [psz2 + 2]
71 cmp al, ah
72 jne .not_equal
73 test al, al
74 jz .equal
75
76 mov al, [psz1 + 3]
77 mov ah, [psz2 + 3]
78 cmp al, ah
79 jne .not_equal
80 test al, al
81 jz .equal
82
83 add psz1, 4
84 add psz2, 4
85 jmp .next
86
87.equal:
88 xor eax, eax
89 ret
90
91.not_equal:
92 movzx ecx, ah
93 and eax, 0ffh
94 sub eax, ecx
95 ret
96ENDPROC RT_NOCRT(strcmp)
97
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette