]> git.proxmox.com Git - mirror_edk2.git/blob - EdkCompatibilityPkg/Foundation/Library/EfiCommonLib/Ia32/MultU64x32.asm
Maintainers.txt: Remove EdkCompatibilityPkg information
[mirror_edk2.git] / EdkCompatibilityPkg / Foundation / Library / EfiCommonLib / Ia32 / MultU64x32.asm
1 ;/*++
2 ;
3 ;Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
4 ;This program and the accompanying materials
5 ;are licensed and made available under the terms and conditions of the BSD License
6 ;which accompanies this distribution. The full text of the license may be found at
7 ;http://opensource.org/licenses/bsd-license.php
8 ;
9 ;THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
10 ;WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
11 ;
12 ;Module Name:
13 ;
14 ; MultU64x32.c
15 ;
16 ;Abstract:
17 ;
18 ; 64-bit Multiplication function for IA-32
19 ;
20 ;--*/
21 ;---------------------------------------------------------------------------
22 .686
23 .model flat,C
24 .code
25
26 ;---------------------------------------------------------------------------
27
28 ;UINT64
29 ;MultU64x32 (
30 ; IN UINT64 Multiplicand,
31 ; IN UINTN Multiplier
32 ; )
33 ;/*++
34 ;
35 ;Routine Description:
36 ;
37 ; This routine allows a 64 bit value to be multiplied with a 32 bit
38 ; value returns 64bit result.
39 ; No checking if the result is greater than 64bits
40 ;
41 ;Arguments:
42 ;
43 ; Multiplicand - multiplicand
44 ; Multiplier - multiplier
45 ;
46 ;Returns:
47 ;
48 ; Multiplicand * Multiplier
49 ;
50 ;--*/
51 MultU64x32 PROC
52
53 mov eax, [esp + 4]; dword ptr Multiplicand[0]
54 mul dword ptr [esp + 0Ch] ; Multiplier
55 push eax
56 push edx
57 mov eax, [esp + 10h]; dword ptr Multiplicand[4]
58 mul dword ptr [esp + 14h]; Multiplier
59 ;
60 ; The value in edx stored by second multiplication overflows
61 ; the output and should be discarded. So here we overwrite it
62 ; with the edx value of first multiplication.
63 ;
64 pop edx
65 add edx, eax
66 pop eax
67
68 ret
69 MultU64x32 ENDP
70 END