VirtualBox

Ignore:
Timestamp:
Oct 28, 2018 5:00:27 PM (6 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
126206
Message:

IPRT: Make Watcom C an alterntive for compiling the OS/2 kernel code (GA mainly), governed by VBOX_USE_WATCOM_FOR_OS2.

Location:
trunk/src/VBox/Runtime/common/string/watcom
Files:
1 added
1 copied

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/common/string/watcom/memcmp.asm

    r75123 r75129  
    11; $Id$
    22;; @file
    3 ; IPRT - No-CRT memcmp - AMD64 & X86.
     3; IPRT - No-CRT memcmp - Watcom register calling convention.
    44;
    55
     
    2727%include "iprt/asmdefs.mac"
    2828
    29 BEGINCODE
     29%define ASM_CALL32_WATCOM
     30%define NAME(name) name %+ _
     31%include "common/string/memcmp.asm"
    3032
    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 memcmp
    36         cld
    37         xor     eax, eax
    38 
    39         ; Do the bulk of the work.
    40 %ifdef RT_ARCH_AMD64
    41  %ifdef ASM_CALL64_MSC
    42         mov     r10, rdi                ; save
    43         mov     r11, rsi                ; save
    44         mov     rdi, rcx
    45         mov     rsi, rdx
    46         mov     rcx, r8
    47         mov     rdx, r8
    48  %else
    49         mov     rcx, rdx
    50  %endif
    51         shr     rcx, 3
    52         repe cmpsq
    53         jne     .not_equal_qword
    54 %else
    55         push    edi
    56         push    esi
    57 
    58         mov     ecx, [esp + 0ch + 8]
    59         mov     edi, [esp + 04h + 8]
    60         mov     esi, [esp + 08h + 8]
    61         mov     edx, ecx
    62         jecxz   .done
    63         shr     ecx, 2
    64         repe cmpsd
    65         jne     .not_equal_dword
    66 %endif
    67 
    68         ; The remaining bytes.
    69 %ifdef RT_ARCH_AMD64
    70         test    dl, 4
    71         jz      .dont_cmp_dword
    72         cmpsd
    73         jne     .not_equal_dword
    74 %endif
    75 .dont_cmp_dword:
    76         test    dl, 2
    77         jz      .dont_cmp_word
    78         cmpsw
    79         jne     .not_equal_word
    80 .dont_cmp_word:
    81         test    dl, 1
    82         jz      .dont_cmp_byte
    83         cmpsb
    84         jne     .not_equal_byte
    85 .dont_cmp_byte:
    86 
    87 .done:
    88 %ifdef RT_ARCH_AMD64
    89  %ifdef ASM_CALL64_MSC
    90         mov     rdi, r10
    91         mov     rsi, r11
    92  %endif
    93 %else
    94         pop     esi
    95         pop     edi
    96 %endif
    97         ret
    98 
    99 ;
    100 ; Mismatches.
    101 ;
    102 %ifdef RT_ARCH_AMD64
    103 .not_equal_qword:
    104         mov     ecx, 8
    105         sub     rsi, 8
    106         sub     rdi, 8
    107         repe cmpsb
    108 .not_equal_byte:
    109         mov     al, [xDI-1]
    110         movzx   ecx, byte [xSI-1]
    111         sub     eax, ecx
    112         jmp     .done
    113 %endif
    114 
    115 .not_equal_dword:
    116         mov     ecx, 4
    117         sub     xSI, 4
    118         sub     xDI, 4
    119         repe cmpsb
    120 %ifdef RT_ARCH_AMD64
    121         jmp     .not_equal_byte
    122 %else
    123 .not_equal_byte:
    124         mov     al, [xDI-1]
    125         movzx   ecx, byte [xSI-1]
    126         sub     eax, ecx
    127         jmp     .done
    128 %endif
    129 
    130 .not_equal_word:
    131         mov     ecx, 2
    132         sub     xSI, 2
    133         sub     xDI, 2
    134         repe cmpsb
    135         jmp     .not_equal_byte
    136 ENDPROC RT_NOCRT(memcmp)
    137 
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette