diff options
author | qhuang8 <qhuang8@6f19259b-4bc3-4df7-8a09-765794883524> | 2008-02-01 15:05:08 +0000 |
---|---|---|
committer | qhuang8 <qhuang8@6f19259b-4bc3-4df7-8a09-765794883524> | 2008-02-01 15:05:08 +0000 |
commit | 41c7f55141662cefa6d00fa6f0c5654705ea1c9e (patch) | |
tree | 8647bd1830c92d3b7e4409706bc79e9dc30b65aa | |
parent | 4df26661c7f7925c6e563e6bfb7d7d5b70de9165 (diff) | |
download | edk2-platforms-41c7f55141662cefa6d00fa6f0c5654705ea1c9e.tar.xz |
Remove the DivU64x64Remainder.c (embedded asm version)for IA32 architecture. It cannot handle the case when divisor is less than 4G.
Make MSFT tool chain uses the ASM version, which can handle the case in an size efficient way.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@4654 6f19259b-4bc3-4df7-8a09-765794883524
-rw-r--r-- | MdePkg/Library/BaseLib/BaseLib.inf | 2 | ||||
-rw-r--r-- | MdePkg/Library/BaseLib/Ia32/DivU64x64Remainder.c | 71 |
2 files changed, 1 insertions, 72 deletions
diff --git a/MdePkg/Library/BaseLib/BaseLib.inf b/MdePkg/Library/BaseLib/BaseLib.inf index 324bf9d4db..b474857eee 100644 --- a/MdePkg/Library/BaseLib/BaseLib.inf +++ b/MdePkg/Library/BaseLib/BaseLib.inf @@ -148,7 +148,7 @@ Ia32/EnablePaging32.c | MSFT
Ia32/EnableInterrupts.c | MSFT
Ia32/EnableDisableInterrupts.c | MSFT
- Ia32/DivU64x64Remainder.c | MSFT
+ Ia32/DivU64x64Remainder.asm | MSFT
Ia32/DivU64x32Remainder.c | MSFT
Ia32/DivU64x32.c | MSFT
Ia32/DisablePaging32.c | MSFT
diff --git a/MdePkg/Library/BaseLib/Ia32/DivU64x64Remainder.c b/MdePkg/Library/BaseLib/Ia32/DivU64x64Remainder.c deleted file mode 100644 index 46ef12b204..0000000000 --- a/MdePkg/Library/BaseLib/Ia32/DivU64x64Remainder.c +++ /dev/null @@ -1,71 +0,0 @@ -/** @file
- Calculate the quotient of a 64-bit integer by a 64-bit integer and returns
- both the quotient and the remainderSet error flag for all division functions
-
- Copyright (c) 2006 - 2007, Intel Corporation<BR>
- All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-**/
-
-//
-// Include common header file for this module.
-//
-
-
-UINT64
-EFIAPI
-InternalMathDivRemU64x64 (
- IN UINT64 Dividend,
- IN UINT64 Divisor,
- OUT UINT64 *Remainder OPTIONAL
- )
-{
- _asm {
- mov edx, dword ptr [Dividend + 4]
- mov eax, dword ptr [Dividend + 0] // edx:eax <- dividend
- mov edi, edx
- mov esi, eax // edi:esi <- dividend
- mov ecx, dword ptr [Divisor + 4]
- mov ebx, dword ptr [Divisor + 0] // ecx:ebx <- divisor
-BitLoop:
- shr edx, 1
- rcr eax, 1
- shrd ebx, ecx, 1
- shr ecx, 1
- jnz BitLoop
- div ebx
- mov ebx, eax // ebx <- quotient
- mov ecx, dword ptr [Divisor + 4]
- mul dword ptr [Divisor]
- imul ecx, ebx
- add edx, ecx
- mov ecx, Remainder
- jc TooLarge // product > 2^64
- cmp edi, edx // compare high 32 bits
- ja Correct
- jb TooLarge // product > dividend
- cmp esi, eax
- jae Correct // product <= dividend
-TooLarge:
- dec ebx // adjust quotient by -1
- jecxz Return // return if Remainder == NULL
- sub eax, dword ptr [Divisor + 0]
- sbb edx, dword ptr [Divisor + 4]
-Correct:
- jecxz Return
- sub esi, eax
- sbb edi, edx // edi:esi <- remainder
- mov [ecx], esi
- mov [ecx + 4], edi
-Return:
- mov eax, ebx // eax <- quotient
- xor edx, edx
- }
-}
-
|