Changeset 9502 in vbox for trunk/src/VBox/Runtime/common/string
- Timestamp:
- Jun 8, 2008 3:02:19 AM (17 years ago)
- svn:sync-xref-src-repo-rev:
- 31773
- Location:
- trunk/src/VBox/Runtime/common/string
- Files:
-
- 1 edited
- 2 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/common/string/strchr_alias.c
r8245 r9502 1 1 /* $Id$ */ 2 2 /** @file 3 * IPRT - No-CRT str chr() alias for gcc.3 * IPRT - No-CRT strlen() alias for gcc. 4 4 */ 5 5 6 6 /* 7 * Copyright (C) 2006-200 7Sun Microsystems, Inc.7 * Copyright (C) 2006-2008 Sun Microsystems, Inc. 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 34 34 *******************************************************************************/ 35 35 #include <iprt/nocrt/string.h> 36 #undef str chr36 #undef strlen 37 37 38 38 #if defined(RT_OS_DARWIN) || defined(RT_OS_WINDOWS) 39 39 # ifndef __MINGW32__ 40 # pragma weak str chr40 # pragma weak strlen 41 41 # endif 42 42 43 43 /* No alias support here (yet in the ming case). */ 44 extern char *(str chr)(const char *psz, int ch)44 extern char *(strlen)(const char *psz, int ch) 45 45 { 46 return RT_NOCRT(str chr)(psz, ch);46 return RT_NOCRT(strlen)(psz, ch); 47 47 } 48 48 49 49 #elif __GNUC__ >= 4 50 50 /* create a weak alias. */ 51 __asm__(".weak str chr\t\n"52 " .set str chr," RT_NOCRT_STR(strchr) "\t\n");51 __asm__(".weak strlen\t\n" 52 " .set strlen," RT_NOCRT_STR(strlen) "\t\n"); 53 53 #else 54 54 /* create a weak alias. */ 55 extern __typeof(RT_NOCRT(str chr)) strchr __attribute__((weak, alias(RT_NOCRT_STR(strchr))));55 extern __typeof(RT_NOCRT(strlen)) strlen __attribute__((weak, alias(RT_NOCRT_STR(strlen)))); 56 56 #endif 57 57 -
trunk/src/VBox/Runtime/common/string/strlen.asm
r9498 r9502 1 1 ; $Id$ 2 2 ;; @file 3 ; IPRT - No-CRT memchr- AMD64 & X86.3 ; IPRT - No-CRT strlen - AMD64 & X86. 4 4 ; 5 5 6 6 ; 7 ; Copyright (C) 2006-200 7Sun Microsystems, Inc.7 ; Copyright (C) 2006-2008 Sun Microsystems, Inc. 8 8 ; 9 9 ; This file is part of VirtualBox Open Source Edition (OSE), as … … 34 34 35 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] 39 BEGINPROC RT_NOCRT(memchr) 36 ; @param psz gcc: rdi msc: rcx x86: [esp+4] 37 BEGINPROC RT_NOCRT(strlen) 40 38 cld 41 39 %ifdef RT_ARCH_AMD64 42 40 %ifdef ASM_CALL64_MSC 43 or r8, r844 jz .not_found_early45 46 41 mov r9, rdi ; save rdi 47 mov eax, edx48 42 mov rdi, rcx 49 mov rcx, r850 %else51 mov rcx, rdx52 jrcxz .not_found_early53 54 mov eax, esi55 43 %endif 56 57 44 %else 58 mov ecx, [esp + 0ch]59 jecxz .not_found_early60 45 mov edx, edi ; save edi 61 mov eax, [esp + 8]62 46 mov edi, [esp + 4] 63 47 %endif 64 48 65 49 ; do the search 50 mov xCX, -1 51 xor eax, eax 66 52 repne scasb 67 jne .not_found68 53 69 54 ; found it 70 lea xAX, [xDI - 1] 55 neg xCX 56 lea xAX, [xCX - 2] 71 57 %ifdef ASM_CALL64_MSC 72 58 mov rdi, r9 … … 76 62 %endif 77 63 ret 64 ENDPROC RT_NOCRT(strlen) 78 65 79 .not_found:80 %ifdef ASM_CALL64_MSC81 mov rdi, r982 %endif83 %ifdef RT_ARCH_X8684 mov edi, edx85 %endif86 .not_found_early:87 xor eax, eax88 ret89 ENDPROC RT_NOCRT(memchr)90
Note:
See TracChangeset
for help on using the changeset viewer.