Changeset 75129 in vbox for trunk/src/VBox/Runtime/common
- Timestamp:
- Oct 28, 2018 5:00:27 PM (6 years ago)
- Location:
- trunk/src/VBox/Runtime/common
- Files:
-
- 3 added
- 17 edited
- 19 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/common/math/watcom/I8D-x86-32.asm
r75123 r75129 1 1 ; $Id$ 2 2 ;; @file 3 ; BS3Kit - 32-bit Watcom C/C++, 64-bit unsigned integer division.3 ; BS3Kit - 32-bit Watcom C/C++, 64-bit signed integer division. 4 4 ; 5 5 … … 25 25 ; 26 26 27 %include " bs3kit-template-header.mac"27 %include "iprt/asmdefs.mac" 28 28 29 BS3_EXTERN_CMN Bs3UInt64Div 29 30 BEGINCODE 31 32 extern __U8D 30 33 31 34 32 35 ;; 33 ; 64-bit unsigned integer division.36 ; 64-bit signed integer division. 34 37 ; 35 38 ; @returns EDX:EAX Quotient, ECX:EBX Remainder. … … 37 40 ; @param ECX:EBX Divisor 38 41 ; 39 global $??U8D40 $??U8D:42 global __I8D 43 __I8D: 41 44 ; 42 ; Convert to a C __cdecl call - not doing this in assembly.45 ; We use __U8D to do the work, we take care of the signedness. 43 46 ; 47 or edx, edx 48 js .negative_dividend 44 49 45 ; Set up a frame, allocating 16 bytes for the result buffer. 46 push ebp 47 mov ebp, esp 48 sub esp, 10h 50 or ecx, ecx 51 js .negative_divisor_positive_dividend 52 jmp __U8D 49 53 50 ; Pointer to the return buffer.51 push esp52 54 53 ; The divisor. 54 push ecx 55 push ebx 55 .negative_divisor_positive_dividend: 56 ; negate the divisor, do unsigned division, and negate the quotient. 57 neg ecx 58 neg ebx 59 sbb ecx, 0 56 60 57 ; The dividend. 58 push edx 59 push eax 61 call __U8D 60 62 61 call Bs3UInt64Div 62 63 ; Load the result. 64 mov ecx, [ebp - 10h + 12] 65 mov ebx, [ebp - 10h + 8] 66 mov edx, [ebp - 10h + 4] 67 mov eax, [ebp - 10h] 68 69 leave 63 neg edx 64 neg eax 65 sbb edx, 0 70 66 ret 71 67 68 .negative_dividend: 69 neg edx 70 neg eax 71 sbb edx, 0 72 73 or ecx, ecx 74 js .negative_dividend_negative_divisor 75 76 .negative_dividend_positive_divisor: 77 ; negate the dividend (above), do unsigned division, and negate both quotient and remainder 78 call __U8D 79 80 neg edx 81 neg eax 82 sbb edx, 0 83 84 .return_negated_remainder: 85 neg ecx 86 neg ebx 87 sbb ecx, 0 88 ret 89 90 .negative_dividend_negative_divisor: 91 ; negate both dividend (above) and divisor, do unsigned division, and negate the remainder. 92 neg ecx 93 neg ebx 94 sbb ecx, 0 95 96 call __U8D 97 jmp .return_negated_remainder 98 -
trunk/src/VBox/Runtime/common/math/watcom/RTWatcomUInt64Div.c
r75123 r75129 29 29 * Header Files * 30 30 *********************************************************************************************************************************/ 31 #include <bs3kit.h>32 31 #include <iprt/uint64.h> 33 32 34 33 35 #undef Bs3UInt64Div 36 BS3_CMN_DEF(void, Bs3UInt64Div,(RTUINT64U uDividend, RTUINT64U uDivisor, RTUINT64U BS3_FAR *paQuotientReminder)) 34 DECLASM(void) RTWatcomUInt64Div(RTUINT64U uDividend, RTUINT64U uDivisor, RTUINT64U RT_FAR *paQuotientReminder) 37 35 { 38 36 RTUInt64DivRem(&paQuotientReminder[0], &paQuotientReminder[1], &uDividend, &uDivisor); -
trunk/src/VBox/Runtime/common/math/watcom/U8D-x86-32.asm
r75123 r75129 25 25 ; 26 26 27 %include " bs3kit-template-header.mac"27 %include "iprt/asmdefs.mac" 28 28 29 BS3_EXTERN_CMN Bs3UInt64Div 29 30 BEGINCODE 31 32 extern NAME(RTWatcomUInt64Div) 30 33 31 34 … … 37 40 ; @param ECX:EBX Divisor 38 41 ; 39 global $??U8D40 $??U8D:42 global __U8D 43 __U8D: 41 44 ; 42 45 ; Convert to a C __cdecl call - not doing this in assembly. … … 59 62 push eax 60 63 61 call Bs3UInt64Div64 call NAME(RTWatcomUInt64Div) 62 65 63 66 ; Load the result. -
trunk/src/VBox/Runtime/common/math/watcom/U8LS-x86-32.asm
r75123 r75129 25 25 ; 26 26 27 %include " bs3kit-template-header.mac"27 %include "iprt/asmdefs.mac" 28 28 29 30 BEGINCODE 29 31 30 32 ;; … … 35 37 ; @param BL Shift count (it's specified as ECX:EBX, but we only use BL). 36 38 ; 37 global $??U8LS38 $??U8LS:39 global $??I8LS40 $??I8LS:39 global __U8LS 40 __U8LS: 41 global __I8LS 42 __I8LS: 41 43 push ecx ; We're allowed to trash ECX, but why bother. 42 44 -
trunk/src/VBox/Runtime/common/math/watcom/U8RS-x86-32.asm
r75123 r75129 25 25 ; 26 26 27 %include "bs3kit-template-header.mac" 27 %include "iprt/asmdefs.mac" 28 29 30 BEGINCODE 28 31 29 32 … … 35 38 ; @param BL Shift count (it's specified as ECX:EBX, but we only use BL). 36 39 ; 37 global $??U8RS38 $??U8RS:40 global __U8RS 41 __U8RS: 39 42 push ecx ; We're allowed to trash ECX, but why bother. 40 43 -
trunk/src/VBox/Runtime/common/string/bzero.asm
r69111 r75129 30 30 31 31 ;; 32 ; @param pvDst gcc: rdi msc: rcx x86:[esp+4] 33 ; @param cb gcc: rsi msc: rdx x86:[esp+8] 32 ; @param pvDst gcc: rdi msc: rcx x86:[esp+4] wcall:eax 33 ; @param cb gcc: rsi msc: rdx x86:[esp+8] wcall:edx 34 34 RT_NOCRT_BEGINPROC bzero 35 35 %ifdef RT_OS_DARWIN … … 71 71 push edi 72 72 73 %ifdef ASM_CALL32_WATCOM 74 mov ecx, edx 75 mov edi, eax 76 %else 73 77 mov ecx, [ebp + 0ch] 74 78 mov edi, [ebp + 08h] 79 %endif 75 80 xor eax, eax 76 81 -
trunk/src/VBox/Runtime/common/string/memchr.asm
r69219 r75129 30 30 31 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] 32 ; @param pv gcc: rdi msc: ecx x86:[esp+4] wcall: eax 33 ; @param ch gcc: esi msc: edx x86:[esp+8] wcall: edx 34 ; @param cb gcc: rdx msc: r8 x86:[esp+0ch] wcall: ebx 35 35 RT_NOCRT_BEGINPROC memchr 36 36 cld … … 52 52 53 53 %else 54 %ifdef ASM_CALL32_WATCOM 55 mov ecx, ebx 56 jecxz .not_found_early 57 xchg eax, edx 58 xchg edi, edx ; load and save edi. 59 %else 54 60 mov ecx, [esp + 0ch] 55 61 jecxz .not_found_early … … 57 63 mov eax, [esp + 8] 58 64 mov edi, [esp + 4] 65 %endif 59 66 %endif 60 67 -
trunk/src/VBox/Runtime/common/string/memcmp.asm
r69219 r75129 30 30 31 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] 32 ; @param pv1 gcc: rdi msc: rcx x86:[esp+4] wcall: eax 33 ; @param pv2 gcc: rsi msc: rdx x86:[esp+8] wcall: edx 34 ; @param cb gcc: rdx msc: r8 x86:[esp+0ch] wcall: ebx 35 35 RT_NOCRT_BEGINPROC memcmp 36 36 cld … … 56 56 push esi 57 57 58 %ifdef ASM_CALL32_WATCOM 59 mov edi, eax 60 mov esi, edx 61 mov ecx, ebx 62 mov edx, ebx 63 %else 58 64 mov ecx, [esp + 0ch + 8] 59 65 mov edi, [esp + 04h + 8] 60 66 mov esi, [esp + 08h + 8] 61 67 mov edx, ecx 68 %endif 62 69 jecxz .done 63 70 shr ecx, 2 -
trunk/src/VBox/Runtime/common/string/memcpy.asm
r69219 r75129 30 30 31 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] 32 ; @param pvDst gcc: rdi msc: rcx x86:[esp+4] wcall: eax 33 ; @param pvSrc gcc: rsi msc: rdx x86:[esp+8] wcall: edx 34 ; @param cb gcc: rdx msc: r8 x86:[esp+0ch] wcall: ebx 35 35 RT_NOCRT_BEGINPROC memcpy 36 36 cld … … 55 55 push esi 56 56 57 %ifdef ASM_CALL32_WATCOM 58 mov edi, eax 59 mov esi, edx 60 mov ecx, ebx 61 mov edx, ebx 62 %else 57 63 mov ecx, [esp + 0ch + 8] 58 64 mov edi, [esp + 04h + 8] … … 60 66 mov edx, ecx 61 67 mov eax, edi ; save the return value 68 %endif 62 69 shr ecx, 2 63 70 rep movsd -
trunk/src/VBox/Runtime/common/string/memmove.asm
r69219 r75129 30 30 31 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] 32 ; @param pvDst gcc: rdi msc: rcx x86:[esp+4] wcall: eax 33 ; @param pvSrc gcc: rsi msc: rdx x86:[esp+8] wcall: edx 34 ; @param cb gcc: rdx msc: r8 x86:[esp+0ch] wcall: ebx 35 35 RT_NOCRT_BEGINPROC memmove 36 36 ; Prolog. … … 50 50 push edi 51 51 push esi 52 %ifdef ASM_CALL32_WATCOM 53 mov edi, eax 54 mov esi, edx 55 mov ecx, ebx 56 mov edx, ebx 57 %else 52 58 mov edi, [esp + 04h + 8] 53 59 mov esi, [esp + 08h + 8] … … 55 61 mov edx, ecx 56 62 mov eax, edi ; save the return value 63 %endif 57 64 %endif 58 65 -
trunk/src/VBox/Runtime/common/string/mempcpy.asm
r69219 r75129 30 30 31 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] 32 ; @param pvDst gcc: rdi msc: rcx x86:[esp+4] wcall: eax 33 ; @param pvSrc gcc: rsi msc: rdx x86:[esp+8] wcall: edx 34 ; @param cb gcc: rdx msc: r8 x86:[esp+0ch] wcall: ebx 35 35 RT_NOCRT_BEGINPROC mempcpy 36 36 cld ; paranoia … … 51 51 rep movsq 52 52 %else 53 %ifdef ASM_CALL32_WATCOM 54 xchg eax, edi ; saving edi in eax and loading it 55 push esi 56 mov esi, edx 57 mov ecx, ebx 58 mov edx, ebx 59 %else 53 60 mov eax, edi ; saving edi in eax 54 61 push esi 55 56 62 mov ecx, [esp + 0ch + 4] 57 63 mov edi, [esp + 04h + 4] 58 64 mov esi, [esp + 08h + 4] 59 65 mov edx, ecx 66 %endif 60 67 shr ecx, 2 61 68 rep movsd -
trunk/src/VBox/Runtime/common/string/memrchr.asm
r69219 r75129 30 30 31 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] 32 ; @param pv gcc: rdi msc: ecx x86:[esp+4] wcall: eax 33 ; @param ch gcc: esi msc: edx x86:[esp+8] wcall: edx 34 ; @param cb gcc: rdx msc: r8 x86:[esp+0ch] wcall: ebx 35 35 RT_NOCRT_BEGINPROC memrchr 36 36 std … … 53 53 54 54 %else 55 %ifdef ASM_CALL32_WATCOM 56 mov ecx, ebx 57 jecxz .not_found_early 58 xchg eax, edx 59 xchg edi, edx ; load + save edi 60 %else 55 61 mov ecx, [esp + 0ch] 56 62 jecxz .not_found_early … … 58 64 mov eax, [esp + 8] 59 65 mov edi, [esp + 4] 66 %endif 60 67 lea edi, [edi + ecx - 1] 61 68 %endif -
trunk/src/VBox/Runtime/common/string/memset.asm
r69219 r75129 30 30 31 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] 32 ; @param pvDst gcc: rdi msc: ecx x86:[esp+4] wcall: eax 33 ; @param ch gcc: esi msc: edx x86:[esp+8] wcall: edx 34 ; @param cb gcc: rdx msc: r8 x86:[esp+0ch] wcall: ebx 35 35 RT_NOCRT_BEGINPROC memset 36 36 cld … … 91 91 push edi 92 92 93 %ifdef ASM_CALL32_WATCOM 94 push eax 95 mov edi, eax 96 mov ecx, ebx 97 movzx eax, dl 98 %else 93 99 mov ecx, [esp + 0ch + 4] 94 100 movzx eax, byte [esp + 08h + 4] 95 101 mov edi, [esp + 04h + 4] 102 %endif 96 103 cmp ecx, 12 97 104 jb .dobytes … … 112 119 rep stosb 113 120 121 %ifdef ASM_CALL32_WATCOM 122 pop eax 123 pop edi 124 %else 114 125 pop edi 115 126 mov eax, [esp + 4] 127 %endif 116 128 %endif ; X86 117 129 ret -
trunk/src/VBox/Runtime/common/string/strchr.asm
r69219 r75129 30 30 31 31 ;; 32 ; @param psz gcc: rdi msc: rcx x86:[esp+4] 33 ; @param ch gcc: esi msc: edx x86:[esp+8] 32 ; @param psz gcc: rdi msc: rcx x86:[esp+4] wcall: eax 33 ; @param ch gcc: esi msc: edx x86:[esp+8] wcall: edx 34 34 RT_NOCRT_BEGINPROC strchr 35 35 cld … … 49 49 %endif 50 50 %else 51 %ifndef ASM_CALL32_WATCOM 51 52 mov edx, [esp + 8] 53 %endif 52 54 or dl, dl 53 55 jz near .strlen 54 56 mov ecx, esi ; save esi 57 %ifdef ASM_CALL32_WATCOM 58 mov esi, eax 59 %else 55 60 mov esi, [esp + 4] 61 %endif 56 62 %endif 57 63 … … 115 121 %else 116 122 mov edx, edi ; save edi 123 %ifdef ASM_CALL32_WATCOM 124 mov edi, eax 125 %else 117 126 mov edi, [esp + 4] 127 %endif 118 128 %endif 119 129 mov xCX, -1 -
trunk/src/VBox/Runtime/common/string/strcmp.asm
r69219 r75129 30 30 31 31 ;; 32 ; @param psz1 gcc: rdi msc: rcx x86:[esp+4] 33 ; @param psz2 gcc: rsi msc: rdx x86:[esp+8] 32 ; @param psz1 gcc: rdi msc: rcx x86:[esp+4] wcall: eax 33 ; @param psz2 gcc: rsi msc: rdx x86:[esp+8] wcall: edx 34 34 RT_NOCRT_BEGINPROC strcmp 35 35 ; input … … 43 43 %endif 44 44 %else 45 %ifdef ASM_CALL32_WATCOM 46 mov ecx, eax 47 %else 45 48 mov ecx, [esp + 4] 46 49 mov edx, [esp + 8] 47 %define psz1 ecx 48 %define psz2 edx 50 %endif 51 %define psz1 ecx 52 %define psz2 edx 49 53 %endif 50 54 -
trunk/src/VBox/Runtime/common/string/strcpy.asm
r69219 r75129 30 30 31 31 ;; 32 ; @param pszDst gcc: rdi msc: rcx x86:[esp+4] 33 ; @param pszSrc gcc: rsi msc: rdx x86:[esp+8] 32 ; @param pszDst gcc: rdi msc: rcx x86:[esp+4] wcall:eax 33 ; @param pszSrc gcc: rsi msc: rdx x86:[esp+8] wcall:edx 34 34 RT_NOCRT_BEGINPROC strcpy 35 35 ; input … … 44 44 mov r8, pszDst 45 45 %else 46 %ifdef ASM_CALL32_WATCOM 47 mov ecx, eax 48 %else 46 49 mov ecx, [esp + 4] 47 50 mov edx, [esp + 8] 48 %define pszDst ecx 49 %define pszSrc edx 51 %endif 52 %define pszDst ecx 53 %define pszSrc edx 50 54 push pszDst 51 55 %endif -
trunk/src/VBox/Runtime/common/string/strformatnum.cpp
r69111 r75129 249 249 if (pr80Value->s.uExponent == 0) 250 250 { 251 #ifdef RT_COMPILER_GROKS_64BIT_BITFIELDS 251 252 if ( !pr80Value->sj64.u63Fraction 252 253 && pr80Value->sj64.fInteger) 254 #else 255 if ( !pr80Value->sj.u32FractionLow 256 && !pr80Value->sj.u31FractionHigh 257 && pr80Value->sj.fInteger) 258 #endif 253 259 *pszTmp++ = '0'; 254 260 /* else: Denormal, handled way below. */ 255 261 } 262 #ifdef RT_COMPILER_GROKS_64BIT_BITFIELDS 256 263 else if (pr80Value->sj64.uExponent == UINT16_C(0x7fff)) 264 #else 265 else if (pr80Value->sj.uExponent == UINT16_C(0x7fff)) 266 #endif 257 267 { 258 268 /** @todo Figure out Pseudo inf/nan... */ 269 #ifdef RT_COMPILER_GROKS_64BIT_BITFIELDS 259 270 if (pr80Value->sj64.fInteger) 271 #else 272 if (pr80Value->sj.fInteger) 273 #endif 260 274 *pszTmp++ = 'P'; 275 #ifdef RT_COMPILER_GROKS_64BIT_BITFIELDS 261 276 if (pr80Value->sj64.u63Fraction == 0) 277 #else 278 if ( pr80Value->sj.u32FractionLow == 0 279 && pr80Value->sj.u31FractionHigh == 0) 280 #endif 262 281 { 263 282 *pszTmp++ = 'I'; … … 276 295 else 277 296 { 297 #ifdef RT_COMPILER_GROKS_64BIT_BITFIELDS 278 298 *pszTmp++ = pr80Value->sj64.fInteger ? '1' : '0'; 299 #else 300 *pszTmp++ = pr80Value->sj.fInteger ? '1' : '0'; 301 #endif 279 302 *pszTmp++ = 'm'; 303 #ifdef RT_COMPILER_GROKS_64BIT_BITFIELDS 280 304 pszTmp += RTStrFormatNumber(pszTmp, pr80Value->sj64.u63Fraction, 16, 2+16, 0, 281 305 RTSTR_F_SPECIAL | RTSTR_F_ZEROPAD | RTSTR_F_64BIT); 306 #else 307 pszTmp += RTStrFormatNumber(pszTmp, RT_MAKE_U64(pr80Value->sj.u32FractionLow, pr80Value->sj.u31FractionHigh), 16, 2+16, 0, 308 RTSTR_F_SPECIAL | RTSTR_F_ZEROPAD | RTSTR_F_64BIT); 309 #endif 282 310 283 311 *pszTmp++ = 'e'; 312 #ifdef RT_COMPILER_GROKS_64BIT_BITFIELDS 284 313 pszTmp += RTStrFormatNumber(pszTmp, (int32_t)pr80Value->sj64.uExponent - 16383, 10, 0, 0, 285 314 RTSTR_F_ZEROPAD | RTSTR_F_32BIT | RTSTR_F_VALSIGNED); 315 #else 316 pszTmp += RTStrFormatNumber(pszTmp, (int32_t)pr80Value->sj.uExponent - 16383, 10, 0, 0, 317 RTSTR_F_ZEROPAD | RTSTR_F_32BIT | RTSTR_F_VALSIGNED); 318 #endif 286 319 } 287 320 -
trunk/src/VBox/Runtime/common/string/strlen.asm
r69219 r75129 30 30 31 31 ;; 32 ; @param psz gcc: rdi msc: rcx x86: [esp+4] 32 ; @param psz gcc: rdi msc: rcx x86: [esp+4] wcall: eax 33 33 RT_NOCRT_BEGINPROC strlen 34 34 cld … … 40 40 %else 41 41 mov edx, edi ; save edi 42 %ifdef ASM_CALL32_WATCOM 43 mov edi, eax 44 %else 42 45 mov edi, [esp + 4] 46 %endif 43 47 %endif 44 48 -
trunk/src/VBox/Runtime/common/string/strncmp.asm
r69219 r75129 30 30 31 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] 32 ; @param psz1 gcc: rdi msc: rcx x86:[esp+4] wcall: eax 33 ; @param psz2 gcc: rsi msc: rdx x86:[esp+8] wcall: edx 34 ; @param cch gcc: rdx msc: r8 x86:[esp+12] wcall: ebx 35 35 RT_NOCRT_BEGINPROC strncmp 36 36 ; input … … 45 45 %define cch rdx 46 46 %endif 47 %elifdef ASM_CALL32_WATCOM 48 mov ecx, eax 49 %define psz1 ecx 50 %define psz2 edx 51 %define cch ebx 52 47 53 %elifdef RT_ARCH_X86 48 54 mov ecx, [esp + 4] … … 105 111 .equal: 106 112 xor eax, eax 107 %ifdef RT_ARCH_X86 113 %ifndef ASM_CALL32_WATCOM 114 %ifdef RT_ARCH_X86 108 115 pop ebx 116 %endif 109 117 %endif 110 118 ret … … 114 122 and eax, 0ffh 115 123 sub eax, ecx 116 %ifdef RT_ARCH_X86 124 %ifndef ASM_CALL32_WATCOM 125 %ifdef RT_ARCH_X86 117 126 pop ebx 127 %endif 118 128 %endif 119 129 ret -
trunk/src/VBox/Runtime/common/string/strncmp.cpp
r69111 r75129 29 29 #ifdef _MSC_VER 30 30 _CRTIMP int __cdecl strncmp 31 #elif defined(__WATCOMC__) 32 _WCRTLINK int std::strncmp 31 33 #else 32 34 int strncmp -
trunk/src/VBox/Runtime/common/string/strncpy.asm
r69219 r75129 30 30 31 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] 32 ; @param pszDst gcc: rdi msc: rcx x86:[esp+4] wcall: eax 33 ; @param pszSrc gcc: rsi msc: rdx x86:[esp+8] wcall: edx 34 ; @param cbMax gcc: rdx msc: r8 x86:[esp+12] wcall: ebx 35 35 RT_NOCRT_BEGINPROC strncpy 36 36 ; input … … 47 47 mov r9, pszDst 48 48 %else 49 %ifdef ASM_CALL32_WATCOM 50 mov ecx, eax 51 %define pszDst ecx 52 %define pszSrc edx 53 %define cbMax ebx 54 %else 49 55 mov ecx, [esp + 4] 50 56 mov edx, [esp + 8] … … 54 60 %define pszSrc edx 55 61 %define cbMax ebx 62 %endif 56 63 push pszDst 57 64 %endif … … 113 120 mov rax, r9 114 121 %else 122 %ifndef ASM_CALL32_WATCOM 115 123 pop ebx 124 %endif 116 125 pop eax 117 126 %endif -
trunk/src/VBox/Runtime/common/string/strpbrk.cpp
r69111 r75129 43 43 _CRTIMP char * __cdecl strpbrk(const char *pszStr, const char *pszChars) 44 44 # endif 45 #elif defined(__WATCOMC__) 46 _WCRTLINK char *std::strpbrk(const char *pszStr, const char *pszChars) 45 47 #else 46 48 char *strpbrk(const char *pszStr, const char *pszChars) -
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.