]> git.proxmox.com Git - mirror_edk2.git/blame - EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/DivU64x32Remainder.asm
Add in the 1st version of ECP.
[mirror_edk2.git] / EdkCompatibilityPkg / Foundation / Library / EdkIIGlueLib / Library / BaseLib / Ia32 / DivU64x32Remainder.asm
CommitLineData
3eb9473e 1; Copyright (c) 2004, Intel Corporation \r
2; All rights reserved. This program and the accompanying materials \r
3; are licensed and made available under the terms and conditions of the BSD License \r
4; which accompanies this distribution. The full text of the license may be found at \r
5; http://opensource.org/licenses/bsd-license.php \r
6; \r
7; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
8; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r
9;\r
10; Module Name:\r
11;\r
12; DivError.asm\r
13;\r
14; Abstract:\r
15;\r
16; Set error flag for all division functions\r
17;\r
18;------------------------------------------------------------------------------\r
19\r
20 .386\r
21 .model flat,C\r
22 .code\r
23\r
24;------------------------------------------------------------------------------\r
25; UINT64\r
26; EFIAPI\r
27; InternalMathDivRemU64x32 (\r
28; IN UINT64 Dividend,\r
29; IN UINT32 Divisor,\r
30; OUT UINT32 *Remainder\r
31; );\r
32;------------------------------------------------------------------------------\r
33InternalMathDivRemU64x32 PROC\r
34 mov ecx, [esp + 12] ; ecx <- divisor\r
35 mov eax, [esp + 8] ; eax <- dividend[32..63]\r
36 xor edx, edx\r
37 div ecx ; eax <- quotient[32..63], edx <- remainder\r
38 push eax\r
39 mov eax, [esp + 8] ; eax <- dividend[0..31]\r
40 div ecx ; eax <- quotient[0..31]\r
41 mov ecx, [esp + 20] ; ecx <- Remainder\r
42 jecxz @F ; abandon remainder if Remainder == NULL\r
43 mov [ecx], edx\r
44@@:\r
45 pop edx ; edx <- quotient[32..63]\r
46 ret\r
47InternalMathDivRemU64x32 ENDP\r
48\r
49 END\r