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;   DivError.asm
15;
16; Abstract:
17;
18;   Set error flag for all division functions
19;
20;------------------------------------------------------------------------------
21
22    .386
23    .model  flat,C
24    .code
25
26;------------------------------------------------------------------------------
27; UINT64
28; EFIAPI
29; InternalMathDivRemU64x32 (
30;   IN      UINT64                    Dividend,
31;   IN      UINT32                    Divisor,
32;   OUT     UINT32                    *Remainder
33;   );
34;------------------------------------------------------------------------------
35InternalMathDivRemU64x32    PROC
36    mov     ecx, [esp + 12]         ; ecx <- divisor
37    mov     eax, [esp + 8]          ; eax <- dividend[32..63]
38    xor     edx, edx
39    div     ecx                     ; eax <- quotient[32..63], edx <- remainder
40    push    eax
41    mov     eax, [esp + 8]          ; eax <- dividend[0..31]
42    div     ecx                     ; eax <- quotient[0..31]
43    mov     ecx, [esp + 20]         ; ecx <- Remainder
44    jecxz   @F                      ; abandon remainder if Remainder == NULL
45    mov     [ecx], edx
46@@:
47    pop     edx                     ; edx <- quotient[32..63]
48    ret
49InternalMathDivRemU64x32    ENDP
50
51    END
52