Changeset 75129 in vbox for trunk/src/VBox/Runtime/common/string/watcom
- Timestamp:
- Oct 28, 2018 5:00:27 PM (6 years ago)
- Location:
- trunk/src/VBox/Runtime/common/string/watcom
- Files:
-
- 1 added
- 14 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/common/string/watcom/bzero.asm
r75123 r75129 1 1 ; $Id$ 2 2 ;; @file 3 ; IPRT - No-CRT bzero - AMD64 & X86.3 ; IPRT - No-CRT bzero - Watcom register calling convention. 4 4 ; 5 5 … … 27 27 %include "iprt/asmdefs.mac" 28 28 29 BEGINCODE 29 %define ASM_CALL32_WATCOM 30 %define NAME(name) name %+ _ 31 %include "common/string/bzero.asm" 30 32 31 ;;32 ; @param pvDst gcc: rdi msc: rcx x86:[esp+4]33 ; @param cb gcc: rsi msc: rdx x86:[esp+8]34 RT_NOCRT_BEGINPROC bzero35 %ifdef RT_OS_DARWIN36 GLOBALNAME __bzero37 %endif38 cld39 %ifdef RT_ARCH_AMD6440 xor eax, eax41 %ifdef ASM_CALL64_MSC42 mov r9, rdi ; save rdi in r943 mov rdi, rcx44 45 ; todo: alignment?46 mov rcx, rdx47 shr rcx, 348 rep stosq49 50 and rdx, 751 mov rcx, rdx52 rep stosb53 54 mov rdi, r9 ; restore rdi55 56 %else ; GCC57 ; todo: alignment?58 mov rcx, rsi59 shr rcx, 360 rep stosq61 62 and rsi, 763 mov rcx, rsi64 rep stosb65 66 %endif ; GCC67 68 %elif ARCH_BITS == 3269 push ebp70 mov ebp, esp71 push edi72 73 mov ecx, [ebp + 0ch]74 mov edi, [ebp + 08h]75 xor eax, eax76 77 mov edx, ecx78 shr ecx, 279 rep stosd80 81 and edx, 382 mov ecx, edx83 rep stosb84 85 pop edi86 leave87 88 %elif ARCH_BITS == 1689 push bp90 mov bp, sp91 push di92 93 mov cx, [bp + 0ch]94 mov di, [bp + 08h]95 xor ax, ax96 97 ; align di.98 test di, 199 jz .aligned100 jcxz .done101 stosb102 dec cx103 jz .done104 105 .aligned:106 mov dx, cx107 shr cx, 1108 rep stosw109 110 test dl, 1111 jz .done112 stosb113 114 .done:115 pop di116 pop bp117 %else118 %error ARCH_BITS119 %endif ; X86120 ret121 ENDPROC RT_NOCRT(bzero)122 -
trunk/src/VBox/Runtime/common/string/watcom/memchr.asm
r75123 r75129 1 1 ; $Id$ 2 2 ;; @file 3 ; IPRT - No-CRT memchr - AMD64 & X86.3 ; IPRT - No-CRT memchr - Watcom register calling convention. 4 4 ; 5 5 … … 27 27 %include "iprt/asmdefs.mac" 28 28 29 BEGINCODE 29 %define ASM_CALL32_WATCOM 30 %define NAME(name) name %+ _ 31 %include "common/string/memchr.asm" 30 32 31 ;;32 ; @param pv gcc: rdi msc: ecx x86:[esp+4]33 ; @param ch gcc: esi msc: edx x86:[esp+8]34 ; @param cb gcc: rdx msc: r8 x86:[esp+0ch]35 RT_NOCRT_BEGINPROC memchr36 cld37 %ifdef RT_ARCH_AMD6438 %ifdef ASM_CALL64_MSC39 or r8, r840 jz .not_found_early41 42 mov r9, rdi ; save rdi43 mov eax, edx44 mov rdi, rcx45 mov rcx, r846 %else47 mov rcx, rdx48 jrcxz .not_found_early49 50 mov eax, esi51 %endif52 53 %else54 mov ecx, [esp + 0ch]55 jecxz .not_found_early56 mov edx, edi ; save edi57 mov eax, [esp + 8]58 mov edi, [esp + 4]59 %endif60 61 ; do the search62 repne scasb63 jne .not_found64 65 ; found it66 lea xAX, [xDI - 1]67 %ifdef ASM_CALL64_MSC68 mov rdi, r969 %endif70 %ifdef RT_ARCH_X8671 mov edi, edx72 %endif73 ret74 75 .not_found:76 %ifdef ASM_CALL64_MSC77 mov rdi, r978 %endif79 %ifdef RT_ARCH_X8680 mov edi, edx81 %endif82 .not_found_early:83 xor eax, eax84 ret85 ENDPROC RT_NOCRT(memchr)86 -
trunk/src/VBox/Runtime/common/string/watcom/memcmp.asm
r75123 r75129 1 1 ; $Id$ 2 2 ;; @file 3 ; IPRT - No-CRT memcmp - AMD64 & X86.3 ; IPRT - No-CRT memcmp - Watcom register calling convention. 4 4 ; 5 5 … … 27 27 %include "iprt/asmdefs.mac" 28 28 29 BEGINCODE 29 %define ASM_CALL32_WATCOM 30 %define NAME(name) name %+ _ 31 %include "common/string/memcmp.asm" 30 32 31 ;;32 ; @param pv1 gcc: rdi msc: rcx x86:[esp+4]33 ; @param pv2 gcc: rsi msc: rdx x86:[esp+8]34 ; @param cb gcc: rdx msc: r8 x86:[esp+0ch]35 RT_NOCRT_BEGINPROC memcmp36 cld37 xor eax, eax38 39 ; Do the bulk of the work.40 %ifdef RT_ARCH_AMD6441 %ifdef ASM_CALL64_MSC42 mov r10, rdi ; save43 mov r11, rsi ; save44 mov rdi, rcx45 mov rsi, rdx46 mov rcx, r847 mov rdx, r848 %else49 mov rcx, rdx50 %endif51 shr rcx, 352 repe cmpsq53 jne .not_equal_qword54 %else55 push edi56 push esi57 58 mov ecx, [esp + 0ch + 8]59 mov edi, [esp + 04h + 8]60 mov esi, [esp + 08h + 8]61 mov edx, ecx62 jecxz .done63 shr ecx, 264 repe cmpsd65 jne .not_equal_dword66 %endif67 68 ; The remaining bytes.69 %ifdef RT_ARCH_AMD6470 test dl, 471 jz .dont_cmp_dword72 cmpsd73 jne .not_equal_dword74 %endif75 .dont_cmp_dword:76 test dl, 277 jz .dont_cmp_word78 cmpsw79 jne .not_equal_word80 .dont_cmp_word:81 test dl, 182 jz .dont_cmp_byte83 cmpsb84 jne .not_equal_byte85 .dont_cmp_byte:86 87 .done:88 %ifdef RT_ARCH_AMD6489 %ifdef ASM_CALL64_MSC90 mov rdi, r1091 mov rsi, r1192 %endif93 %else94 pop esi95 pop edi96 %endif97 ret98 99 ;100 ; Mismatches.101 ;102 %ifdef RT_ARCH_AMD64103 .not_equal_qword:104 mov ecx, 8105 sub rsi, 8106 sub rdi, 8107 repe cmpsb108 .not_equal_byte:109 mov al, [xDI-1]110 movzx ecx, byte [xSI-1]111 sub eax, ecx112 jmp .done113 %endif114 115 .not_equal_dword:116 mov ecx, 4117 sub xSI, 4118 sub xDI, 4119 repe cmpsb120 %ifdef RT_ARCH_AMD64121 jmp .not_equal_byte122 %else123 .not_equal_byte:124 mov al, [xDI-1]125 movzx ecx, byte [xSI-1]126 sub eax, ecx127 jmp .done128 %endif129 130 .not_equal_word:131 mov ecx, 2132 sub xSI, 2133 sub xDI, 2134 repe cmpsb135 jmp .not_equal_byte136 ENDPROC RT_NOCRT(memcmp)137 -
trunk/src/VBox/Runtime/common/string/watcom/memcpy.asm
r75123 r75129 1 1 ; $Id$ 2 2 ;; @file 3 ; IPRT - No-CRT memcpy - AMD64 & X86.3 ; IPRT - No-CRT memcpy - Watcom register calling convention. 4 4 ; 5 5 … … 27 27 %include "iprt/asmdefs.mac" 28 28 29 BEGINCODE 29 %define ASM_CALL32_WATCOM 30 %define NAME(name) name %+ _ 31 %include "common/string/memcpy.asm" 30 32 31 ;;32 ; @param pvDst gcc: rdi msc: rcx x86:[esp+4]33 ; @param pvSrc gcc: rsi msc: rdx x86:[esp+8]34 ; @param cb gcc: rdx msc: r8 x86:[esp+0ch]35 RT_NOCRT_BEGINPROC memcpy36 cld37 38 ; Do the bulk of the work.39 %ifdef RT_ARCH_AMD6440 %ifdef ASM_CALL64_MSC41 mov r10, rdi ; save42 mov r11, rsi ; save43 mov rdi, rcx44 mov rsi, rdx45 mov rcx, r846 mov rdx, r847 %else48 mov rcx, rdx49 %endif50 mov rax, rdi ; save the return value51 shr rcx, 352 rep movsq53 %else54 push edi55 push esi56 57 mov ecx, [esp + 0ch + 8]58 mov edi, [esp + 04h + 8]59 mov esi, [esp + 08h + 8]60 mov edx, ecx61 mov eax, edi ; save the return value62 shr ecx, 263 rep movsd64 %endif65 66 ; The remaining bytes.67 %ifdef RT_ARCH_AMD6468 test dl, 469 jz .dont_move_dword70 movsd71 %endif72 .dont_move_dword:73 test dl, 274 jz .dont_move_word75 movsw76 .dont_move_word:77 test dl, 178 jz .dont_move_byte79 movsb80 .dont_move_byte:81 82 %ifdef RT_ARCH_AMD6483 %ifdef ASM_CALL64_MSC84 mov rdi, r1085 mov rsi, r1186 %endif87 %else88 pop esi89 pop edi90 %endif91 ret92 ENDPROC RT_NOCRT(memcpy)93 -
trunk/src/VBox/Runtime/common/string/watcom/memmove.asm
r75123 r75129 1 1 ; $Id$ 2 2 ;; @file 3 ; IPRT - No-CRT memmove - AMD64 & X86.3 ; IPRT - No-CRT memmove - Watcom register calling convention. 4 4 ; 5 5 … … 27 27 %include "iprt/asmdefs.mac" 28 28 29 BEGINCODE 29 %define ASM_CALL32_WATCOM 30 %define NAME(name) name %+ _ 31 %include "common/string/memmove.asm" 30 32 31 ;;32 ; @param pvDst gcc: rdi msc: rcx x86:[esp+4]33 ; @param pvSrc gcc: rsi msc: rdx x86:[esp+8]34 ; @param cb gcc: rdx msc: r8 x86:[esp+0ch]35 RT_NOCRT_BEGINPROC memmove36 ; Prolog.37 %ifdef RT_ARCH_AMD6438 %ifdef ASM_CALL64_MSC39 mov r10, rdi ; save40 mov r11, rsi ; save41 mov rdi, rcx42 mov rsi, rdx43 mov rcx, r844 mov rdx, r845 %else46 mov rcx, rdx47 %endif48 mov rax, rdi ; save the return value49 %else50 push edi51 push esi52 mov edi, [esp + 04h + 8]53 mov esi, [esp + 08h + 8]54 mov ecx, [esp + 0ch + 8]55 mov edx, ecx56 mov eax, edi ; save the return value57 %endif58 59 ;60 ; Decide which direction to perform the copy in.61 ;62 %if 1 ; keep it simple for now.63 cmp xDI, xSI64 jnb .backward65 66 ;67 ; Slow/simple forward copy.68 ;69 cld70 rep movsb71 jmp .epilog72 73 %else ; disabled - it seems to work, but play safe for now.74 ;sub xAX, xSI75 ;jnb .backward76 cmp xDI, xSI77 jnb .backward78 79 ;80 ; Fast forward copy.81 ;82 .fast_forward:83 cld84 %ifdef RT_ARCH_AMD6485 shr rcx, 386 rep movsq87 %else88 shr ecx, 289 rep movsd90 %endif91 92 ; The remaining bytes.93 %ifdef RT_ARCH_AMD6494 test dl, 495 jz .forward_dont_move_dword96 movsd97 %endif98 .forward_dont_move_dword:99 test dl, 2100 jz .forward_dont_move_word101 movsw102 .forward_dont_move_word:103 test dl, 1104 jz .forward_dont_move_byte105 movsb106 .forward_dont_move_byte:107 108 %endif ; disabled109 110 ;111 ; The epilog.112 ;113 .epilog:114 %ifdef RT_ARCH_AMD64115 %ifdef ASM_CALL64_MSC116 mov rdi, r10117 mov rsi, r11118 %endif119 %else120 pop esi121 pop edi122 %endif123 ret124 125 ;126 ; Slow/simple backward copy.127 ;128 ALIGNCODE(16)129 .backward:130 ;; @todo check if they overlap.131 lea xDI, [xDI + xCX - 1]132 lea xSI, [xSI + xCX - 1]133 std134 rep movsb135 cld136 jmp .epilog137 ENDPROC RT_NOCRT(memmove)138 -
trunk/src/VBox/Runtime/common/string/watcom/mempcpy.asm
r75123 r75129 1 1 ; $Id$ 2 2 ;; @file 3 ; IPRT - No-CRT mempcpy - AMD64 & X86.3 ; IPRT - No-CRT mempcpy - Watcom register calling convention. 4 4 ; 5 5 … … 27 27 %include "iprt/asmdefs.mac" 28 28 29 BEGINCODE 29 %define ASM_CALL32_WATCOM 30 %define NAME(name) name %+ _ 31 %include "common/string/mempcpy.asm" 30 32 31 ;;32 ; @param pvDst gcc: rdi msc: rcx x86:[esp+4]33 ; @param pvSrc gcc: rsi msc: rdx x86:[esp+8]34 ; @param cb gcc: rdx msc: r8 x86:[esp+0ch]35 RT_NOCRT_BEGINPROC mempcpy36 cld ; paranoia37 38 ; Do the bulk of the work.39 %ifdef RT_ARCH_AMD6440 %ifdef ASM_CALL64_MSC41 mov r10, rdi ; save42 mov r11, rsi ; save43 mov rdi, rcx44 mov rsi, rdx45 mov rcx, r846 mov rdx, r847 %else48 mov rcx, rdx49 %endif50 shr rcx, 351 rep movsq52 %else53 mov eax, edi ; saving edi in eax54 push esi55 56 mov ecx, [esp + 0ch + 4]57 mov edi, [esp + 04h + 4]58 mov esi, [esp + 08h + 4]59 mov edx, ecx60 shr ecx, 261 rep movsd62 %endif63 64 ; The remaining bytes.65 %ifdef RT_ARCH_AMD6466 test dl, 467 jz .dont_move_dword68 movsd69 %endif70 .dont_move_dword:71 test dl, 272 jz .dont_move_word73 movsw74 .dont_move_word:75 test dl, 176 jz .dont_move_byte77 movsb78 .dont_move_byte:79 80 ; restore & return81 %ifdef RT_ARCH_AMD6482 mov rax, rdi83 %ifdef ASM_CALL64_MSC84 mov rsi, r1185 mov rdi, r1086 %endif87 %else88 pop esi89 xchg eax, edi90 %endif91 ret92 ENDPROC RT_NOCRT(mempcpy)93 -
trunk/src/VBox/Runtime/common/string/watcom/memrchr.asm
r75123 r75129 1 1 ; $Id$ 2 2 ;; @file 3 ; IPRT - No-CRT memrchr - AMD64 & X86.3 ; IPRT - No-CRT memrchr - Watcom register calling convention. 4 4 ; 5 5 … … 27 27 %include "iprt/asmdefs.mac" 28 28 29 BEGINCODE 29 %define ASM_CALL32_WATCOM 30 %define NAME(name) name %+ _ 31 %include "common/string/memrchr.asm" 30 32 31 ;;32 ; @param pv gcc: rdi msc: ecx x86:[esp+4]33 ; @param ch gcc: esi msc: edx x86:[esp+8]34 ; @param cb gcc: rdx msc: r8 x86:[esp+0ch]35 RT_NOCRT_BEGINPROC memrchr36 std37 %ifdef RT_ARCH_AMD6438 %ifdef ASM_CALL64_MSC39 or r8, r840 jz .not_found_early41 42 mov r9, rdi ; save rdi43 mov eax, edx44 lea rdi, [rcx + r8 - 1]45 mov rcx, r846 %else47 mov rcx, rdx48 jrcxz .not_found_early49 50 mov eax, esi51 lea rdi, [rdi + rcx - 1]52 %endif53 54 %else55 mov ecx, [esp + 0ch]56 jecxz .not_found_early57 mov edx, edi ; save edi58 mov eax, [esp + 8]59 mov edi, [esp + 4]60 lea edi, [edi + ecx - 1]61 %endif62 63 ; do the search64 repne scasb65 jne .not_found66 67 ; found it68 lea xAX, [xDI + 1]69 %ifdef ASM_CALL64_MSC70 mov rdi, r971 %endif72 %ifdef RT_ARCH_X8673 mov edi, edx74 %endif75 cld76 ret77 78 .not_found:79 %ifdef ASM_CALL64_MSC80 mov rdi, r981 %endif82 %ifdef RT_ARCH_X8683 mov edi, edx84 %endif85 .not_found_early:86 xor eax, eax87 cld88 ret89 ENDPROC RT_NOCRT(memrchr)90 -
trunk/src/VBox/Runtime/common/string/watcom/memset.asm
r75123 r75129 1 1 ; $Id$ 2 2 ;; @file 3 ; IPRT - No-CRT memset - AMD64 & X86.3 ; IPRT - No-CRT memset - Watcom register calling convention. 4 4 ; 5 5 … … 27 27 %include "iprt/asmdefs.mac" 28 28 29 BEGINCODE 29 %define ASM_CALL32_WATCOM 30 %define NAME(name) name %+ _ 31 %include "common/string/memset.asm" 30 32 31 ;;32 ; @param pvDst gcc: rdi msc: ecx x86:[esp+4]33 ; @param ch gcc: esi msc: edx x86:[esp+8]34 ; @param cb gcc: rdx msc: r8 x86:[esp+0ch]35 RT_NOCRT_BEGINPROC memset36 cld37 %ifdef RT_ARCH_AMD6438 %ifdef ASM_CALL64_MSC39 mov r9, rdi ; save rdi in r940 mov rdi, rcx41 mov r10, rcx ; the return value.42 movzx eax, dl43 cmp r8, 3244 jb .dobytes45 46 ; eax = (al << 24) | (al << 16) | (al << 8) | al;47 ; rdx = (eax << 32) | eax48 movzx edx, dl49 mov rax, qword 0101010101010101h50 imul rax, rdx51 52 ; todo: alignment.53 mov rcx, r854 shr rcx, 355 rep stosq56 57 and r8, 758 .dobytes:59 mov rcx, r860 rep stosb61 62 mov rdi, r9 ; restore rdi63 mov rax, r1064 65 %else ; GCC66 mov r10, rdi ; the return value.67 movzx eax, sil68 cmp rdx, 3269 jb .dobytes70 71 ; eax = (al << 24) | (al << 16) | (al << 8) | al;72 ; rdx = (eax << 32) | eax73 movzx esi, sil74 mov rax, qword 0101010101010101h75 imul rax, rsi76 77 ; todo: alignment.78 mov rcx, rdx79 shr rcx, 380 rep stosq81 82 and rdx, 783 .dobytes:84 mov rcx, rdx85 rep stosb86 87 mov rax, r1088 %endif ; GCC89 90 %else ; X8691 push edi92 93 mov ecx, [esp + 0ch + 4]94 movzx eax, byte [esp + 08h + 4]95 mov edi, [esp + 04h + 4]96 cmp ecx, 1297 jb .dobytes98 99 ; eax = (al << 24) | (al << 16) | (al << 8) | al;100 mov ah, al101 mov edx, eax102 shl edx, 16103 or eax, edx104 105 mov edx, ecx106 shr ecx, 2107 rep stosd108 109 and edx, 3110 mov ecx, edx111 .dobytes:112 rep stosb113 114 pop edi115 mov eax, [esp + 4]116 %endif ; X86117 ret118 ENDPROC RT_NOCRT(memset)119 -
trunk/src/VBox/Runtime/common/string/watcom/strchr.asm
r75123 r75129 1 1 ; $Id$ 2 2 ;; @file 3 ; IPRT - No-CRT strchr - AMD64 & X86.3 ; IPRT - No-CRT strchr - Watcom register calling convention. 4 4 ; 5 5 … … 27 27 %include "iprt/asmdefs.mac" 28 28 29 BEGINCODE 29 %define ASM_CALL32_WATCOM 30 %define NAME(name) name %+ _ 31 %include "common/string/strchr.asm" 30 32 31 ;;32 ; @param psz gcc: rdi msc: rcx x86:[esp+4]33 ; @param ch gcc: esi msc: edx x86:[esp+8]34 RT_NOCRT_BEGINPROC strchr35 cld36 37 ; check for ch == 0 and setup normal strchr.38 %ifdef RT_ARCH_AMD6439 %ifdef ASM_CALL64_MSC40 or dl, dl41 jz near .strlen42 mov r9, rsi ; save rsi43 mov rsi, rcx44 %else45 or sil, sil46 jz near .strlen47 mov edx, esi48 mov rsi, rdi49 %endif50 %else51 mov edx, [esp + 8]52 or dl, dl53 jz near .strlen54 mov ecx, esi ; save esi55 mov esi, [esp + 4]56 %endif57 58 ; do the search59 .next:60 lodsb61 cmp al, dl62 je .found63 test al, al64 jz .not_found65 66 lodsb67 cmp al, dl68 je .found69 test al, al70 jz .not_found71 72 lodsb73 cmp al, dl74 je .found75 test al, al76 jz .not_found77 78 lodsb79 cmp al, dl80 je .found81 test al, al82 jz .not_found83 jmp .next84 85 .found:86 lea xAX, [xSI - 1]87 %ifdef ASM_CALL64_MSC88 mov rsi, r989 %endif90 %ifdef RT_ARCH_X8691 mov esi, ecx92 %endif93 ret94 95 .not_found:96 %ifdef ASM_CALL64_MSC97 mov rsi, r998 %endif99 %ifdef RT_ARCH_X86100 mov esi, ecx101 %endif102 xor eax, eax103 ret104 105 ;106 ; Special case: strchr(str, '\0');107 ;108 align 16109 .strlen:110 %ifdef RT_ARCH_AMD64111 %ifdef ASM_CALL64_MSC112 mov r9, rdi ; save rdi113 mov rdi, rcx114 %endif115 %else116 mov edx, edi ; save edi117 mov edi, [esp + 4]118 %endif119 mov xCX, -1120 xor eax, eax121 repne scasb122 123 lea xAX, [xDI - 1]124 %ifdef ASM_CALL64_MSC125 mov rdi, r9126 %endif127 %ifdef RT_ARCH_X86128 mov edi, edx129 %endif130 ret131 ENDPROC RT_NOCRT(strchr)132 -
trunk/src/VBox/Runtime/common/string/watcom/strcmp.asm
r75123 r75129 1 1 ; $Id$ 2 2 ;; @file 3 ; IPRT - No-CRT strcmp - AMD64 & X86.3 ; IPRT - No-CRT strcmp - Watcom register calling convention. 4 4 ; 5 5 … … 27 27 %include "iprt/asmdefs.mac" 28 28 29 BEGINCODE 29 %define ASM_CALL32_WATCOM 30 %define NAME(name) name %+ _ 31 %include "common/string/strcmp.asm" 30 32 31 ;;32 ; @param psz1 gcc: rdi msc: rcx x86:[esp+4]33 ; @param psz2 gcc: rsi msc: rdx x86:[esp+8]34 RT_NOCRT_BEGINPROC strcmp35 ; input36 %ifdef RT_ARCH_AMD6437 %ifdef ASM_CALL64_MSC38 %define psz1 rcx39 %define psz2 rdx40 %else41 %define psz1 rdi42 %define psz2 rsi43 %endif44 %else45 mov ecx, [esp + 4]46 mov edx, [esp + 8]47 %define psz1 ecx48 %define psz2 edx49 %endif50 51 ;52 ; The loop.53 ;54 .next:55 mov al, [psz1]56 mov ah, [psz2]57 cmp al, ah58 jne .not_equal59 test al, al60 jz .equal61 62 mov al, [psz1 + 1]63 mov ah, [psz2 + 1]64 cmp al, ah65 jne .not_equal66 test al, al67 jz .equal68 69 mov al, [psz1 + 2]70 mov ah, [psz2 + 2]71 cmp al, ah72 jne .not_equal73 test al, al74 jz .equal75 76 mov al, [psz1 + 3]77 mov ah, [psz2 + 3]78 cmp al, ah79 jne .not_equal80 test al, al81 jz .equal82 83 add psz1, 484 add psz2, 485 jmp .next86 87 .equal:88 xor eax, eax89 ret90 91 .not_equal:92 movzx ecx, ah93 and eax, 0ffh94 sub eax, ecx95 ret96 ENDPROC RT_NOCRT(strcmp)97 -
trunk/src/VBox/Runtime/common/string/watcom/strcpy.asm
r75123 r75129 1 1 ; $Id$ 2 2 ;; @file 3 ; IPRT - No-CRT strcpy - AMD64 & X86.3 ; IPRT - No-CRT strcpy - Watcom register calling convention. 4 4 ; 5 5 … … 27 27 %include "iprt/asmdefs.mac" 28 28 29 BEGINCODE 29 %define ASM_CALL32_WATCOM 30 %define NAME(name) name %+ _ 31 %include "common/string/strcpy.asm" 30 32 31 ;;32 ; @param pszDst gcc: rdi msc: rcx x86:[esp+4]33 ; @param pszSrc gcc: rsi msc: rdx x86:[esp+8]34 RT_NOCRT_BEGINPROC strcpy35 ; input36 %ifdef RT_ARCH_AMD6437 %ifdef ASM_CALL64_MSC38 %define pszDst rcx39 %define pszSrc rdx40 %else41 %define pszDst rdi42 %define pszSrc rsi43 %endif44 mov r8, pszDst45 %else46 mov ecx, [esp + 4]47 mov edx, [esp + 8]48 %define pszDst ecx49 %define pszSrc edx50 push pszDst51 %endif52 53 ;54 ; The loop.55 ;56 .next:57 mov al, [pszSrc]58 mov [pszDst], al59 test al, al60 jz .done61 62 mov al, [pszSrc + 1]63 mov [pszDst + 1], al64 test al, al65 jz .done66 67 mov al, [pszSrc + 2]68 mov [pszDst + 2], al69 test al, al70 jz .done71 72 mov al, [pszSrc + 3]73 mov [pszDst + 3], al74 test al, al75 jz .done76 77 add pszDst, 478 add pszSrc, 479 jmp .next80 81 .done:82 %ifdef RT_ARCH_AMD6483 mov rax, r884 %else85 pop eax86 %endif87 ret88 ENDPROC RT_NOCRT(strcpy)89 -
trunk/src/VBox/Runtime/common/string/watcom/strlen.asm
r75123 r75129 1 1 ; $Id$ 2 2 ;; @file 3 ; IPRT - No-CRT strlen - AMD64 & X86.3 ; IPRT - No-CRT strlen - Watcom register calling convention. 4 4 ; 5 5 … … 27 27 %include "iprt/asmdefs.mac" 28 28 29 BEGINCODE 29 %define ASM_CALL32_WATCOM 30 %define NAME(name) name %+ _ 31 %include "common/string/strlen.asm" 30 32 31 ;;32 ; @param psz gcc: rdi msc: rcx x86: [esp+4]33 RT_NOCRT_BEGINPROC strlen34 cld35 %ifdef RT_ARCH_AMD6436 %ifdef ASM_CALL64_MSC37 mov r9, rdi ; save rdi38 mov rdi, rcx39 %endif40 %else41 mov edx, edi ; save edi42 mov edi, [esp + 4]43 %endif44 45 ; do the search46 mov xCX, -147 xor eax, eax48 repne scasb49 50 ; found it51 neg xCX52 lea xAX, [xCX - 2]53 %ifdef ASM_CALL64_MSC54 mov rdi, r955 %endif56 %ifdef RT_ARCH_X8657 mov edi, edx58 %endif59 ret60 ENDPROC RT_NOCRT(strlen)61 -
trunk/src/VBox/Runtime/common/string/watcom/strncmp.asm
r75123 r75129 1 1 ; $Id$ 2 2 ;; @file 3 ; IPRT - No-CRT strncmp - AMD64 & X86.3 ; IPRT - No-CRT strncmp - Watcom register calling convention. 4 4 ; 5 5 … … 27 27 %include "iprt/asmdefs.mac" 28 28 29 BEGINCODE 29 %define ASM_CALL32_WATCOM 30 %define NAME(name) name %+ _ 31 %include "common/string/strncmp.asm" 30 32 31 ;;32 ; @param psz1 gcc: rdi msc: rcx x86:[esp+4]33 ; @param psz2 gcc: rsi msc: rdx x86:[esp+8]34 ; @param cch gcc: rdx msc: r8 x86:[esp+12]35 RT_NOCRT_BEGINPROC strncmp36 ; input37 %ifdef RT_ARCH_AMD6438 %ifdef ASM_CALL64_MSC39 %define psz1 rcx40 %define psz2 rdx41 %define cch r842 %else43 %define psz1 rdi44 %define psz2 rsi45 %define cch rdx46 %endif47 %elifdef RT_ARCH_X8648 mov ecx, [esp + 4]49 mov edx, [esp + 8]50 push ebx51 mov ebx, [esp + 12+4]52 %define psz1 ecx53 %define psz2 edx54 %define cch ebx55 %else56 %error "Unknown arch"57 %endif58 59 ;60 ; The loop.61 ;62 test cch, cch63 jz .equal64 .next:65 mov al, [psz1]66 mov ah, [psz2]67 cmp al, ah68 jne .not_equal69 test al, al70 jz .equal71 dec cch72 jz .equal73 74 mov al, [psz1 + 1]75 mov ah, [psz2 + 1]76 cmp al, ah77 jne .not_equal78 test al, al79 jz .equal80 dec cch81 jz .equal82 83 mov al, [psz1 + 2]84 mov ah, [psz2 + 2]85 cmp al, ah86 jne .not_equal87 test al, al88 jz .equal89 dec cch90 jz .equal91 92 mov al, [psz1 + 3]93 mov ah, [psz2 + 3]94 cmp al, ah95 jne .not_equal96 test al, al97 jz .equal98 dec cch99 jz .equal100 101 add psz1, 4102 add psz2, 4103 jmp .next104 105 .equal:106 xor eax, eax107 %ifdef RT_ARCH_X86108 pop ebx109 %endif110 ret111 112 .not_equal:113 movzx ecx, ah114 and eax, 0ffh115 sub eax, ecx116 %ifdef RT_ARCH_X86117 pop ebx118 %endif119 ret120 ENDPROC RT_NOCRT(strncmp)121 -
trunk/src/VBox/Runtime/common/string/watcom/strncpy.asm
r75123 r75129 1 1 ; $Id$ 2 2 ;; @file 3 ; IPRT - No-CRT strncpy - AMD64 & X86.3 ; IPRT - No-CRT strncpy - Watcom register calling convention. 4 4 ; 5 5 … … 27 27 %include "iprt/asmdefs.mac" 28 28 29 BEGINCODE 29 %define ASM_CALL32_WATCOM 30 %define NAME(name) name %+ _ 31 %include "common/string/strncpy.asm" 30 32 31 ;;32 ; @param pszDst gcc: rdi msc: rcx x86:[esp+4]33 ; @param pszSrc gcc: rsi msc: rdx x86:[esp+8]34 ; @param cbMax gcc: rdx msc: r8 x86:[esp+12]35 RT_NOCRT_BEGINPROC strncpy36 ; input37 %ifdef RT_ARCH_AMD6438 %ifdef ASM_CALL64_MSC39 %define pszDst rcx40 %define pszSrc rdx41 %define cbMax r842 %else43 %define pszDst rdi44 %define pszSrc rsi45 %define cbMax rdx46 %endif47 mov r9, pszDst48 %else49 mov ecx, [esp + 4]50 mov edx, [esp + 8]51 push ebx52 mov ebx, [esp + 12 + 4]53 %define pszDst ecx54 %define pszSrc edx55 %define cbMax ebx56 push pszDst57 %endif58 59 ;60 ; The rolled out loop.61 ;62 .next:63 cmp cbMax, 464 jb .simple_intro65 66 mov al, [pszSrc]67 mov [pszDst], al68 test al, al69 jz .done70 71 mov al, [pszSrc + 1]72 mov [pszDst + 1], al73 test al, al74 jz .done75 76 mov al, [pszSrc + 2]77 mov [pszDst + 2], al78 test al, al79 jz .done80 81 mov al, [pszSrc + 3]82 mov [pszDst + 3], al83 test al, al84 jz .done85 86 add pszDst, 487 add pszSrc, 488 sub cbMax, 489 jmp .next90 91 ;92 ; Char by char.93 ;94 .simple_intro:95 test cbMax, cbMax96 jz .done97 98 .simple_next:99 mov al, [pszSrc]100 mov [pszDst], al101 test al, al102 jz .done103 104 dec cbMax105 jz .done106 107 inc pszSrc108 inc pszDst109 jmp .simple_next110 111 .done:112 %ifdef RT_ARCH_AMD64113 mov rax, r9114 %else115 pop ebx116 pop eax117 %endif118 ret119 ENDPROC RT_NOCRT(strncpy)120
Note:
See TracChangeset
for help on using the changeset viewer.