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