]> git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Library/BaseLib/Ia32/MultU64x64.c
UefiCpuPkg: Move AsmRelocateApLoopStart from Mpfuncs.nasm to AmdSev.nasm
[mirror_edk2.git] / MdePkg / Library / BaseLib / Ia32 / MultU64x64.c
1 /** @file
2 Calculate the product of a 64-bit integer and another 64-bit integer
3
4 Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
5 SPDX-License-Identifier: BSD-2-Clause-Patent
6
7 **/
8
9 /**
10 Multiplies a 64-bit unsigned integer by a 64-bit unsigned integer
11 and generates a 64-bit unsigned result.
12
13 This function multiplies the 64-bit unsigned value Multiplicand by the 64-bit
14 unsigned value Multiplier and generates a 64-bit unsigned result. This 64-
15 bit unsigned result is returned.
16
17 @param Multiplicand A 64-bit unsigned value.
18 @param Multiplier A 64-bit unsigned value.
19
20 @return Multiplicand * Multiplier
21
22 **/
23 UINT64
24 EFIAPI
25 InternalMathMultU64x64 (
26 IN UINT64 Multiplicand,
27 IN UINT64 Multiplier
28 )
29 {
30 _asm {
31 mov ebx, dword ptr [Multiplicand + 0]
32 mov edx, dword ptr [Multiplier + 0]
33 mov ecx, ebx
34 mov eax, edx
35 imul ebx, dword ptr [Multiplier + 4]
36 imul edx, dword ptr [Multiplicand + 4]
37 add ebx, edx
38 mul ecx
39 add edx, ebx
40 }
41 }