]> git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Library/BaseLib/Ia32/MultU64x64.nasm
MdePkg: Replace Opcode with the corresponding instructions.
[mirror_edk2.git] / MdePkg / Library / BaseLib / Ia32 / MultU64x64.nasm
1 ;------------------------------------------------------------------------------
2 ;
3 ; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
4 ; SPDX-License-Identifier: BSD-2-Clause-Patent
5 ;
6 ; Module Name:
7 ;
8 ; MultU64x64.nasm
9 ;
10 ; Abstract:
11 ;
12 ; Calculate the product of a 64-bit integer and another 64-bit integer
13 ;
14 ;------------------------------------------------------------------------------
15
16 SECTION .text
17
18 ;------------------------------------------------------------------------------
19 ; UINT64
20 ; EFIAPI
21 ; InternalMathMultU64x64 (
22 ; IN UINT64 Multiplicand,
23 ; IN UINT64 Multiplier
24 ; );
25 ;------------------------------------------------------------------------------
26 global ASM_PFX(InternalMathMultU64x64)
27 ASM_PFX(InternalMathMultU64x64):
28 push ebx
29 mov ebx, [esp + 8] ; ebx <- M1[0..31]
30 mov edx, [esp + 16] ; edx <- M2[0..31]
31 mov ecx, ebx
32 mov eax, edx
33 imul ebx, [esp + 20] ; ebx <- M1[0..31] * M2[32..63]
34 imul edx, [esp + 12] ; edx <- M1[32..63] * M2[0..31]
35 add ebx, edx ; carries are abandoned
36 mul ecx ; edx:eax <- M1[0..31] * M2[0..31]
37 add edx, ebx ; carries are abandoned
38 pop ebx
39 ret
40