]> git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Library/BaseLib/Ia32/ModU64x32.c
UefiCpuPkg: Move AsmRelocateApLoopStart from Mpfuncs.nasm to AmdSev.nasm
[mirror_edk2.git] / MdePkg / Library / BaseLib / Ia32 / ModU64x32.c
1 /** @file
2 Calculate the remainder of a 64-bit integer by a 32-bit integer
3
4 Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
5 SPDX-License-Identifier: BSD-2-Clause-Patent
6
7 **/
8
9 /**
10 Divides a 64-bit unsigned integer by a 32-bit unsigned integer and
11 generates a 32-bit unsigned remainder.
12
13 This function divides the 64-bit unsigned value Dividend by the 32-bit
14 unsigned value Divisor and generates a 32-bit remainder. This function
15 returns the 32-bit unsigned remainder.
16
17 @param Dividend A 64-bit unsigned value.
18 @param Divisor A 32-bit unsigned value.
19
20 @return Dividend % Divisor
21
22 **/
23 UINT32
24 EFIAPI
25 InternalMathModU64x32 (
26 IN UINT64 Dividend,
27 IN UINT32 Divisor
28 )
29 {
30 _asm {
31 mov eax, dword ptr [Dividend + 4]
32 mov ecx, Divisor
33 xor edx, edx
34 div ecx
35 mov eax, dword ptr [Dividend + 0]
36 div ecx
37 mov eax, edx
38 }
39 }