VirtualBox

Changeset 60485 in vbox


Ignore:
Timestamp:
Apr 14, 2016 9:38:28 AM (8 years ago)
Author:
vboxsync
Message:

bs3kit: 8086 friendly 32-bit and 64-bit unsigned integer division.

Location:
trunk
Files:
2 added
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/iprt/uint32.h

    r60484 r60485  
    929929DECLINLINE(bool) RTUInt32BitAreAllSet(PRTUINT32U pValue)
    930930{
    931     return pValue->s.Hi == UINT32_MAX
    932         && pValue->s.Lo == UINT32_MAX;
     931    return pValue->s.Hi == UINT16_MAX
     932        && pValue->s.Lo == UINT16_MAX;
    933933}
    934934
  • trunk/include/iprt/uint64.h

    r60484 r60485  
    799799    {
    800800        /* (left shift) */
    801         cBits &= 31
     801        cBits &= 31;
    802802        if (cBits >= 32)
    803803        {
     
    816816        /* (right shift) */
    817817        cBits = -cBits;
    818         cBits &= 31
     818        cBits &= 31;
    819819        if (cBits >= 32)
    820820        {
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/Makefile.kmk

    r60439 r60485  
    165165        bs3-cmn-PerCpuData.c \
    166166        bs3-cmn-ConvertRMStackToP16UsingCxReturnToAx.asm \
     167        bs3-cmn-UInt64Div.c \
     168        bs3-cmn-UInt32Div.c \
    167169        bs3-wc16-U8DR.asm \
    168170        bs3-wc16-U8DQ.asm \
     
    175177        bs3-wc16-I4D.asm \
    176178       bs3-c16-Trap16Generic.asm
     179bs3kit-common-16_bs3-cmn-UInt64Div.c_CFLAGS = -oh -d0 # -d1+ vs -d0 saves 0x6a3-0x577 = 0x12C (300)!
    177180
    178181# The 32-bit BS3Kit library.
     
    183186bs3kit-common-32_ASDEFS   = RT_ASMDEFS_INC_FIRST_FILE
    184187bs3kit-common-32_SOURCES  = $(VBOX_BS3KIT_COMMON_SOURCES) \
     188        bs3-cmn-UInt64Div.c \
    185189        bs3-wc32-U8D.asm \
    186190        bs3-wc32-I8D.asm \
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-wc16-U4D.asm

    r58809 r60485  
    2828
    2929
     30
    3031;;
    3132; 32-bit unsigned integer division.
     
    3940global $_?U4D
    4041$_?U4D:
     42%if TMPL_BITS >= 32
    4143        ; Move dividend into EDX:EAX
    4244        shl     eax, 10h
     
    5961        mov     edx, eax
    6062        shr     edx, 10h
     63%else
     64        push    ds
     65        push    es
    6166
     67        ;
     68        ; Convert to a C __cdecl call - too lazy to do this in assembly.
     69        ;
     70
     71        ; Set up a frame of sorts, allocating 8 bytes for the result buffer.
     72        push    bp
     73        sub     sp, 08h
     74        mov     bp, sp
     75
     76        ; Pointer to the return buffer.
     77        push    ss
     78        push    bp
     79        add     bp, 08h                 ; Correct bp.
     80
     81        ; The divisor.
     82        push    cx
     83        push    bx
     84
     85        ; The dividend.
     86        push    dx
     87        push    ax
     88
     89        BS3_EXTERN_CMN Bs3UInt32Div
     90        call    Bs3UInt32Div
     91
     92        ; Load the reminder.
     93        mov     cx, [bp - 08h + 6]
     94        mov     bx, [bp - 08h + 4]
     95        ; Load the quotient.
     96        mov     dx, [bp - 08h + 2]
     97        mov     ax, [bp - 08h]
     98
     99        mov     sp, bp
     100        pop     bp
     101        pop     es
     102        pop     ds
     103
     104%endif
    62105        ret
    63106
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-wc16-U8DQ.asm

    r58809 r60485  
    7777
    7878        ; The divisor.
    79         push    dword [es:si + 4]
    80         push    dword [es:si]
     79        push    word [es:si + 6]
     80        push    word [es:si + 4]
     81        push    word [es:si + 2]
     82        push    word [es:si]
    8183
    8284        ; The dividend.
     
    8991
    9092        ; Load the quotient.
    91         mov     ax, [bp - 10h + 8 + 6]
    92         mov     bx, [bp - 10h + 8 + 4]
    93         mov     cx, [bp - 10h + 8 + 2]
    94         mov     dx, [bp - 10h + 8]
     93        mov     ax, [bp - 10h + 6]
     94        mov     bx, [bp - 10h + 4]
     95        mov     cx, [bp - 10h + 2]
     96        mov     dx, [bp - 10h]
    9597
    96         leave
     98        mov     sp, bp
     99        pop     bp
    97100        pop     es
    98101        pop     ds
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-wc16-U8DR.asm

    r58809 r60485  
    7777
    7878        ; The divisor.
    79         push    dword [es:si + 4]
    80         push    dword [es:si]
     79        push    word [es:si + 6]
     80        push    word [es:si + 4]
     81        push    word [es:si + 2]
     82        push    word [es:si]
    8183
    8284        ; The dividend.
     
    9496        mov     dx, [bp - 10h + 8]
    9597
    96         leave
     98        mov     sp, bp
     99        pop     bp
    97100        pop     es
    98101        pop     ds
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-wc32-U8D.asm

    r58809 r60485  
    5151        push    esp
    5252
    53         ; The dividend.
     53        ; The divisor.
    5454        push    ecx
    5555        push    ebx
Note: See TracChangeset for help on using the changeset viewer.

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