Changeset 1174 in vbox for trunk/src/VBox/Runtime/string/strcmp.asm
- Timestamp:
- Mar 3, 2007 11:49:53 PM (18 years ago)
- File:
-
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/string/strcmp.asm
r1060 r1174 1 1 ; $Id$ 2 2 ;; @file 3 ; InnoTek Portable Runtime - No-CRT memcpy- AMD64 & X86.3 ; InnoTek Portable Runtime - No-CRT strcmp - AMD64 & X86. 4 4 ; 5 5 … … 22 22 %include "iprt/asmdefs.mac" 23 23 24 BEGINCODE 25 24 26 ;; 25 ; @param pvDst gcc: rdi msc: rcx x86:[esp+4] 26 ; @param pvSrc gcc: rsi msc: rdx x86:[esp+8] 27 ; @param cb gcc: rdx msc: r8 x86:[esp+0ch] 28 BEGINPROC RT_NOCRT(memcpy) 29 cld 30 31 ; Do the bulk of the work. 27 ; @param psz1 gcc: rdi msc: rcx x86:[esp+4] 28 ; @param psz2 gcc: rsi msc: rdx x86:[esp+8] 29 BEGINPROC RT_NOCRT(strcmp) 30 ; input 32 31 %ifdef __AMD64__ 33 32 %ifdef ASM_CALL64_MSC 34 mov r10, rdi ; save 35 mov r11, rsi ; save 36 mov rdi, rcx 37 mov rsi, rdx 38 mov rcx, r8 39 mov rdx, r8 33 %define psz1 rcx 34 %define psz2 rdx 40 35 %else 41 mov rcx, rdx 36 %define psz1 rdi 37 %define psz2 rsi 42 38 %endif 43 mov rax, rdi ; save the return value44 shr rcx, 345 rep movsq46 39 %else 47 push edi 48 push esi 49 50 mov ecx, [esp + 0ch + 8] 51 mov edi, [esp + 04h + 8] 52 mov esi, [esp + 08h + 8] 53 mov edx, ecx 54 mov eax, edi ; save the return value 55 shl ecx, 2 56 rep movsd 40 mov ecx, [esp + 4] 41 mov edx, [esp + 8] 42 %define psz1 ecx 43 %define psz2 edx 57 44 %endif 58 45 59 ; The remaining bytes. 60 %ifdef __AMD64__ 61 test dl, 4 62 jz .dont_move_dword 63 movsd 64 %endif 65 .dont_move_dword: 66 test dl, 2 67 jz .dont_move_word 68 movsw 69 .dont_move_word: 70 test dl, 1 71 jz .dont_move_byte 72 movsb 73 .dont_move_byte: 46 ; 47 ; The loop. 48 ; 49 .next: 50 mov al, [psz1] 51 mov ah, [psz2] 52 cmp al, ah 53 jne .not_equal 54 test al, al 55 jz .equal 74 56 75 %ifdef __AMD64__ 76 %ifdef ASM_CALL64_MSC 77 mov rdi, r10 78 mov rsi, r11 79 %endif 80 %else 81 pop esi 82 pop edi 83 %endif 57 mov al, [psz1 + 1] 58 mov ah, [psz2 + 1] 59 cmp al, ah 60 jne .not_equal 61 test al, al 62 jz .equal 63 inc psz1 64 inc psz2 65 66 mov al, [psz1 + 2] 67 mov ah, [psz2 + 2] 68 cmp al, ah 69 jne .not_equal 70 test al, al 71 jz .equal 72 inc psz1 73 inc psz2 74 75 mov al, [psz1 + 3] 76 mov ah, [psz2 + 3] 77 cmp al, ah 78 jne .not_equal 79 test al, al 80 jz .equal 81 82 add psz1, 4 83 add psz2, 4 84 jmp .next 85 86 .equal: 87 xor eax, eax 84 88 ret 85 ENDPROC RT_NOCRT(memcpy)86 89 90 .not_equal: 91 movzx ecx, ah 92 and eax, 0ffh 93 sub eax, ecx 94 ret 95 ENDPROC RT_NOCRT(strcmp) 96
Note:
See TracChangeset
for help on using the changeset viewer.