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/strchr.asm

    r75123 r75129  
    11; $Id$
    22;; @file
    3 ; IPRT - No-CRT strchr - AMD64 & X86.
     3; IPRT - No-CRT strchr - 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/strchr.asm"
    3032
    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 strchr
    35         cld
    36 
    37         ; check for ch == 0 and setup normal strchr.
    38 %ifdef RT_ARCH_AMD64
    39  %ifdef ASM_CALL64_MSC
    40         or      dl, dl
    41         jz near .strlen
    42         mov     r9, rsi                 ; save rsi
    43         mov     rsi, rcx
    44  %else
    45         or      sil, sil
    46         jz near .strlen
    47         mov     edx, esi
    48         mov     rsi, rdi
    49  %endif
    50 %else
    51         mov     edx, [esp + 8]
    52         or      dl, dl
    53         jz near .strlen
    54         mov     ecx, esi                ; save esi
    55         mov     esi, [esp + 4]
    56 %endif
    57 
    58         ; do the search
    59 .next:
    60         lodsb
    61         cmp     al, dl
    62         je      .found
    63         test    al, al
    64         jz      .not_found
    65 
    66         lodsb
    67         cmp     al, dl
    68         je      .found
    69         test    al, al
    70         jz      .not_found
    71 
    72         lodsb
    73         cmp     al, dl
    74         je      .found
    75         test    al, al
    76         jz      .not_found
    77 
    78         lodsb
    79         cmp     al, dl
    80         je      .found
    81         test    al, al
    82         jz      .not_found
    83         jmp .next
    84 
    85 .found:
    86         lea     xAX, [xSI - 1]
    87 %ifdef ASM_CALL64_MSC
    88         mov     rsi, r9
    89 %endif
    90 %ifdef RT_ARCH_X86
    91         mov     esi, ecx
    92 %endif
    93         ret
    94 
    95 .not_found:
    96 %ifdef ASM_CALL64_MSC
    97         mov     rsi, r9
    98 %endif
    99 %ifdef RT_ARCH_X86
    100         mov     esi, ecx
    101 %endif
    102         xor     eax, eax
    103         ret
    104 
    105 ;
    106 ; Special case: strchr(str, '\0');
    107 ;
    108 align 16
    109 .strlen:
    110 %ifdef RT_ARCH_AMD64
    111  %ifdef ASM_CALL64_MSC
    112         mov     r9, rdi                 ; save rdi
    113         mov     rdi, rcx
    114  %endif
    115 %else
    116         mov     edx, edi                ; save edi
    117         mov     edi, [esp + 4]
    118 %endif
    119         mov     xCX, -1
    120         xor     eax, eax
    121         repne scasb
    122 
    123         lea     xAX, [xDI - 1]
    124 %ifdef ASM_CALL64_MSC
    125         mov     rdi, r9
    126 %endif
    127 %ifdef RT_ARCH_X86
    128         mov     edi, edx
    129 %endif
    130         ret
    131 ENDPROC RT_NOCRT(strchr)
    132 
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