]> git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Library/BaseLib/Ia32/DivU64x32Remainder.nasm
944ba73f1708a1b025be1f0ec17d4db3816106e3
[mirror_edk2.git] / MdePkg / Library / BaseLib / Ia32 / DivU64x32Remainder.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 ; DivError.asm
9 ;
10 ; Abstract:
11 ;
12 ; Set error flag for all division functions
13 ;
14 ;------------------------------------------------------------------------------
15
16 SECTION .text
17
18 ;------------------------------------------------------------------------------
19 ; UINT64
20 ; EFIAPI
21 ; InternalMathDivRemU64x32 (
22 ; IN UINT64 Dividend,
23 ; IN UINT32 Divisor,
24 ; OUT UINT32 *Remainder
25 ; );
26 ;------------------------------------------------------------------------------
27 global ASM_PFX(InternalMathDivRemU64x32)
28 ASM_PFX(InternalMathDivRemU64x32):
29 mov ecx, [esp + 12] ; ecx <- divisor
30 mov eax, [esp + 8] ; eax <- dividend[32..63]
31 xor edx, edx
32 div ecx ; eax <- quotient[32..63], edx <- remainder
33 push eax
34 mov eax, [esp + 8] ; eax <- dividend[0..31]
35 div ecx ; eax <- quotient[0..31]
36 mov ecx, [esp + 20] ; ecx <- Remainder
37 jecxz .0 ; abandon remainder if Remainder == NULL
38 mov [ecx], edx
39 .0:
40 pop edx ; edx <- quotient[32..63]
41 ret
42