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

    r75123 r75129  
    11; $Id$
    22;; @file
    3 ; IPRT - No-CRT memset - AMD64 & X86.
     3; IPRT - No-CRT memset - 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/memset.asm"
    3032
    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 memset
    36         cld
    37 %ifdef RT_ARCH_AMD64
    38  %ifdef ASM_CALL64_MSC
    39         mov     r9, rdi                 ; save rdi in r9
    40         mov     rdi, rcx
    41         mov     r10, rcx                ; the return value.
    42         movzx   eax, dl
    43         cmp     r8, 32
    44         jb      .dobytes
    45 
    46         ; eax = (al << 24) | (al << 16) | (al << 8) | al;
    47         ; rdx = (eax << 32) | eax
    48         movzx   edx, dl
    49         mov     rax, qword 0101010101010101h
    50         imul    rax, rdx
    51 
    52         ; todo: alignment.
    53         mov     rcx, r8
    54         shr     rcx, 3
    55         rep stosq
    56 
    57         and     r8, 7
    58 .dobytes:
    59         mov     rcx, r8
    60         rep stosb
    61 
    62         mov     rdi, r9                 ; restore rdi
    63         mov     rax, r10
    64 
    65  %else ; GCC
    66         mov     r10, rdi                ; the return value.
    67         movzx   eax, sil
    68         cmp     rdx, 32
    69         jb      .dobytes
    70 
    71         ; eax = (al << 24) | (al << 16) | (al << 8) | al;
    72         ; rdx = (eax << 32) | eax
    73         movzx   esi, sil
    74         mov     rax, qword 0101010101010101h
    75         imul    rax, rsi
    76 
    77         ; todo: alignment.
    78         mov     rcx, rdx
    79         shr     rcx, 3
    80         rep stosq
    81 
    82         and     rdx, 7
    83 .dobytes:
    84         mov     rcx, rdx
    85         rep stosb
    86 
    87         mov     rax, r10
    88  %endif ; GCC
    89 
    90 %else ; X86
    91         push    edi
    92 
    93         mov     ecx, [esp + 0ch + 4]
    94         movzx   eax, byte [esp + 08h + 4]
    95         mov     edi, [esp + 04h + 4]
    96         cmp     ecx, 12
    97         jb      .dobytes
    98 
    99         ; eax = (al << 24) | (al << 16) | (al << 8) | al;
    100         mov     ah, al
    101         mov     edx, eax
    102         shl     edx, 16
    103         or      eax, edx
    104 
    105         mov     edx, ecx
    106         shr     ecx, 2
    107         rep stosd
    108 
    109         and     edx, 3
    110         mov     ecx, edx
    111 .dobytes:
    112         rep stosb
    113 
    114         pop     edi
    115         mov     eax, [esp + 4]
    116 %endif ; X86
    117         ret
    118 ENDPROC RT_NOCRT(memset)
    119 
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