VirtualBox

source: vbox/trunk/src/VBox/Runtime/common/string/memchr.asm@ 8256

Last change on this file since 8256 was 8256, checked in by vboxsync, 17 years ago

rebranding, eol

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 2.4 KB
Line 
1; $Id: memchr.asm 8256 2008-04-21 20:53:28Z vboxsync $
2;; @file
3; IPRT - No-CRT memchr - AMD64 & X86.
4;
5
6;
7; Copyright (C) 2006-2007 Sun Microsystems, Inc.
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; Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
27; Clara, CA 95054 USA or visit http://www.sun.com if you need
28; additional information or have any questions.
29;
30
31%include "iprt/asmdefs.mac"
32
33BEGINCODE
34
35;;
36; @param pv gcc: rdi msc: ecx x86:[esp+4]
37; @param ch gcc: esi msc: edx x86:[esp+8]
38; @param cb gcc: rdx msc: r8 x86:[esp+0ch]
39BEGINPROC RT_NOCRT(memchr)
40 cld
41%ifdef RT_ARCH_AMD64
42 %ifdef ASM_CALL64_MSC
43 or r8, r8
44 jz .not_found_early
45
46 mov r9, rdi ; save rdi
47 mov eax, edx
48 mov rdi, rcx
49 mov rcx, r8
50 %else
51 mov rcx, rdx
52 jrcxz .not_found_early
53
54 mov eax, esi
55 %endif
56
57%else
58 mov ecx, [esp + 0ch]
59 jecxz .not_found_early
60 mov edx, edi ; save edi
61 mov eax, [esp + 8]
62 mov edi, [esp + 4]
63%endif
64
65 ; do the search
66 repne scasb
67 jne .not_found
68
69 ; found it
70 lea xAX, [xDI - 1]
71%ifdef ASM_CALL64_MSC
72 mov rdi, r9
73%endif
74%ifdef RT_ARCH_X86
75 mov edi, edx
76%endif
77 ret
78
79.not_found:
80%ifdef ASM_CALL64_MSC
81 mov rdi, r9
82%endif
83%ifdef RT_ARCH_X86
84 mov edi, edx
85%endif
86.not_found_early:
87 xor eax, eax
88 ret
89ENDPROC RT_NOCRT(memchr)
90
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