Changeset 98495 in vbox for trunk/src/VBox/Runtime/common
- Timestamp:
- Feb 7, 2023 3:56:13 PM (2 years ago)
- Location:
- trunk/src/VBox/Runtime/common/compiler/vcc
- Files:
-
- 1 added
- 1 edited
- 2 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/common/compiler/vcc/x86-alldiv.asm
r98493 r98495 45 45 ;* External Symbols * 46 46 ;********************************************************************************************************************************* 47 extern __aulld vrm47 extern __aulldiv 48 48 49 49 … … 51 51 ; Division of signed 64-bit values, returning both the quotient and reminder. 52 52 ; 53 ; @returns EDX:EAX Quotient , EBX:ECX Remainder.53 ; @returns EDX:EAX Quotient. 54 54 ; @param [esp+04h] [ebp+08h] Dividend (64-bit) 55 55 ; @param [esp+0ch] [ebp+10h] Divisor (64-bit) … … 57 57 ; @note The remainder registers are swapped compared to Watcom's I8D and U8D. 58 58 ; 59 BEGINPROC_RAW __alld vrm59 BEGINPROC_RAW __alldiv 60 60 ; 61 61 ; Load high parts so we can examine them for negativity. … … 65 65 66 66 ; 67 ; We use __aull remto do the work, we take care of the signedness.67 ; We use __aulldiv to do the work, we take care of the signedness. 68 68 ; 69 69 or edx, edx … … 74 74 75 75 ; Both positive, so same as unsigned division. 76 jmp __aulld vrm76 jmp __aulldiv 77 77 78 78 … … 88 88 ; Load the low values to as we will be pushing them and probably negating them. 89 89 mov eax, dword [ebp + 08h] ; dividend_lo 90 mov ebx, dword [ebp + 10h] ; divisor_lo90 ;mov ebx, dword [ebp + 10h] ; divisor_lo 91 91 92 ; negate the divisor, do unsigned division (, and negate the quotient).92 ; negate the divisor, do unsigned division, and negate the quotient. 93 93 neg ecx 94 neg ebx94 neg dword [ebp + 10h] 95 95 sbb ecx, 0 96 96 97 97 push ecx 98 push ebx98 push dword [ebp + 10h] 99 99 push edx 100 100 push eax 101 call __aulld vrm; cleans up the the stack.101 call __aulldiv ; cleans up the the stack. 102 102 103 103 neg edx … … 114 114 ; Load the low values to as we will be pushing them and probably negating them. 115 115 mov eax, dword [ebp + 08h] ; dividend_lo 116 mov ebx, dword [ebp + 10h] ; divisor_lo116 ;mov ebx, dword [ebp + 10h] ; divisor_lo 117 117 118 118 neg edx … … 124 124 125 125 .negative_dividend_positive_divisor: 126 ; negate the dividend (above), do unsigned division, and negate both quotient and remainder126 ; negate the dividend (above), do unsigned division, and negate (both) quotient (and remainder) 127 127 128 128 push ecx 129 push ebx129 push dword [ebp + 10h] 130 130 push edx 131 131 push eax 132 call __aulld vrm; cleans up the the stack.132 call __aulldiv ; cleans up the the stack. 133 133 134 134 neg edx … … 136 136 sbb edx, 0 137 137 138 .return_negated_remainder:139 neg ebx140 neg ecx141 sbb ebx, 0142 143 138 leave 144 139 ret 10h 145 140 146 141 .negative_dividend_negative_divisor: 147 ; negate both dividend (above) and divisor, do unsigned division , and negate the remainder.142 ; negate both dividend (above) and divisor, do unsigned division(, and negate the remainder). 148 143 neg ecx 149 neg ebx144 neg dword [ebp + 10h] 150 145 sbb ecx, 0 151 146 152 147 push ecx 153 push ebx148 push dword [ebp + 10h] 154 149 push edx 155 150 push eax 156 call __aulld vrm; cleans up the the stack.151 call __aulldiv ; cleans up the the stack. 157 152 158 jmp .return_negated_remainder 159 ENDPROC_RAW __alldvrm 153 leave 154 ret 10h 155 ENDPROC_RAW __alldiv 160 156 -
trunk/src/VBox/Runtime/common/compiler/vcc/x86-alldvrm.asm
r98493 r98495 65 65 66 66 ; 67 ; We use __aull rem to do the work, we take care of the signedness.67 ; We use __aulldvrm to do the work, we take care of the signedness. 68 68 ; 69 69 or edx, edx … … 90 90 mov ebx, dword [ebp + 10h] ; divisor_lo 91 91 92 ; negate the divisor, do unsigned division (, and negate the quotient).92 ; negate the divisor, do unsigned division, and negate the quotient. 93 93 neg ecx 94 94 neg ebx -
trunk/src/VBox/Runtime/common/compiler/vcc/x86-allrem.asm
r98493 r98495 45 45 ;* External Symbols * 46 46 ;********************************************************************************************************************************* 47 extern __aull dvrm47 extern __aullrem 48 48 49 49 50 50 ;; 51 ; Division of signed 64-bit values, returning both the quotient andreminder.51 ; Division of signed 64-bit values, returning the reminder. 52 52 ; 53 ; @returns EDX:EAX Quotient, EBX:ECXRemainder.53 ; @returns EDX:EAX Remainder. 54 54 ; @param [esp+04h] [ebp+08h] Dividend (64-bit) 55 55 ; @param [esp+0ch] [ebp+10h] Divisor (64-bit) … … 57 57 ; @note The remainder registers are swapped compared to Watcom's I8D and U8D. 58 58 ; 59 BEGINPROC_RAW __all dvrm59 BEGINPROC_RAW __allrem 60 60 ; 61 61 ; Load high parts so we can examine them for negativity. … … 74 74 75 75 ; Both positive, so same as unsigned division. 76 jmp __aulldvrm 76 jmp __aullrem 77 78 79 .negative_divisor_positive_dividend: 80 ; negate the divisor, do unsigned division(, and negate the quotient). 81 neg ecx 82 neg dword [esp + 0ch] 83 sbb ecx, 0 84 mov [esp + 0ch+4], ecx 85 86 jmp __aullrem 77 87 78 88 … … 82 92 ; 83 93 84 .negative_divisor_positive_dividend:85 push ebp86 mov ebp, esp87 88 ; Load the low values to as we will be pushing them and probably negating them.89 mov eax, dword [ebp + 08h] ; dividend_lo90 mov ebx, dword [ebp + 10h] ; divisor_lo91 92 ; negate the divisor, do unsigned division(, and negate the quotient).93 neg ecx94 neg ebx95 sbb ecx, 096 97 push ecx98 push ebx99 push edx100 push eax101 call __aulldvrm ; cleans up the the stack.102 103 neg edx104 neg eax105 sbb edx, 0106 107 leave108 ret 10h109 110 94 .negative_dividend: 111 95 push ebp … … 114 98 ; Load the low values to as we will be pushing them and probably negating them. 115 99 mov eax, dword [ebp + 08h] ; dividend_lo 116 mov ebx, dword [ebp + 10h] ; divisor_lo100 ;mov ebx, dword [ebp + 10h] ; divisor_lo 117 101 118 102 neg edx … … 124 108 125 109 .negative_dividend_positive_divisor: 126 ; negate the dividend (above), do unsigned division, and negate both quotient andremainder110 ; negate the dividend (above), do unsigned division, and negate (both quotient and) remainder 127 111 128 112 push ecx 129 push ebx113 push dword [ebp + 10h] 130 114 push edx 131 115 push eax 132 call __aull dvrm; cleans up the the stack.116 call __aullrem ; cleans up the the stack. 133 117 118 .return_negated_remainder: 134 119 neg edx 135 120 neg eax 136 121 sbb edx, 0 137 138 .return_negated_remainder:139 neg ebx140 neg ecx141 sbb ebx, 0142 122 143 123 leave … … 147 127 ; negate both dividend (above) and divisor, do unsigned division, and negate the remainder. 148 128 neg ecx 149 neg ebx129 neg dword [ebp + 10h] 150 130 sbb ecx, 0 151 131 152 push ecx 153 push ebx 154 push edx 155 push eax 156 call __aulldvrm ; cleans up the the stack. 132 jmp .negative_dividend_positive_divisor 133 ENDPROC_RAW __allrem 157 134 158 jmp .return_negated_remainder159 ENDPROC_RAW __alldvrm160
Note:
See TracChangeset
for help on using the changeset viewer.