Changeset 194 in vbox for trunk/src/VBox/Runtime/string/memchr.asm
- Timestamp:
- Jan 19, 2007 9:56:57 PM (18 years ago)
- File:
-
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/string/memchr.asm
r79 r194 1 1 ; $Id$ 2 2 ;; @file 3 ; InnoTek Portable Runtime - No-CRT mem set- AMD64 & X86.3 ; InnoTek Portable Runtime - No-CRT memchr - AMD64 & X86. 4 4 ; 5 5 … … 23 23 24 24 ;; 25 ; @param pv Dstgcc: rdi msc: ecx x86:[esp+4]25 ; @param pv gcc: rdi msc: ecx x86:[esp+4] 26 26 ; @param ch gcc: esi msc: edx x86:[esp+8] 27 27 ; @param cb gcc: rdx msc: r8 x86:[esp+0ch] 28 BEGINPROC RT_NOCRT(mem set)28 BEGINPROC RT_NOCRT(memchr) 29 29 cld 30 30 %ifdef __AMD64__ 31 31 %ifdef ASM_CALL64_MSC 32 int3 33 %error "Port me" 32 or r8, r8 33 jz .not_found_early 34 35 mov r9, rdi ; save rdi 36 mov eax, edx 37 mov rdi, rcx 38 mov rcx, r8 34 39 %else 35 movzx eax, sil 36 cmp rdx, 32 37 jb .dobytes 40 mov rcx, rdx 41 jrcxz .not_found_early 38 42 39 ; eax = (al << 24) | (al << 16) | (al << 8) | al; 40 ; rdx = (eax << 32) | eax 41 movzx esi, sil 42 mov rax, qword 0101010101010101h 43 imul rax, rsi 44 45 ; todo: alignment. 46 47 mov rcx, rdx 48 shr rcx, 3 49 rep stosq 50 51 and rdx, 7 52 .dobytes: 53 mov rcx, rdx 54 rep stosb 43 mov eax, esi 55 44 %endif 56 45 57 46 %else 58 push edi 47 mov ecx, [esp + 0ch] 48 jecxz .not_found_early 49 mov edx, edi ; save edi 50 mov eax, [esp + 8] 51 mov edi, [esp + 4] 52 %endif 59 53 60 mov ecx, [esp + 0ch + 4] 61 movzx eax, byte [esp + 08h + 4] 62 mov edi, [esp + 04h + 4] 63 cmp ecx, 12 64 jb .dobytes 54 ; do the search 55 repne scasb 56 jne .not_found 65 57 66 ; eax = (al << 24) | (al << 16) | (al << 8) | al; 67 mov ah, al 68 mov edx, eax 69 shr edx, 16 70 or eax, edx 71 72 mov edx, ecx 73 shr ecx, 2 74 rep stosd 75 76 and edx, 3 77 mov ecx, edx 78 .dobytes: 79 rep stosb 80 81 pop edi 58 ; found it 59 lea xAX, [xDI - 1] 60 %ifdef ASM_CALL64_MSC 61 mov rdi, r9 62 %endif 63 %ifdef __X86__ 64 mov edi, edx 82 65 %endif 83 66 ret 84 ENDPROC RT_NOCRT(memset)85 67 68 .not_found: 69 %ifdef ASM_CALL64_MSC 70 mov rdi, r9 71 %endif 72 %ifdef __X86__ 73 mov edi, edx 74 %endif 75 .not_found_early: 76 xor eax, eax 77 ret 78 ENDPROC RT_NOCRT(memchr) 79
Note:
See TracChangeset
for help on using the changeset viewer.