]> git.proxmox.com Git - mirror_edk2.git/blob - CryptoPkg/Library/BaseCryptLib/SysCall/Ia32/MathReminderU64x64.S
Add CryptoPkg (from UDK2010.UP3)
[mirror_edk2.git] / CryptoPkg / Library / BaseCryptLib / SysCall / Ia32 / MathReminderU64x64.S
1 #------------------------------------------------------------------------------
2 #
3 # Copyright (c) 2009 - 2010, 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 # MathReminderU64x64.S
15 #
16 # Abstract:
17 #
18 # 64-bit Math Worker Function.
19 # Divides a 64-bit unsigned value by another 64-bit unsigned value and returns
20 # the 64-bit unsigned remainder
21 #
22 #------------------------------------------------------------------------------
23
24 .686:
25 .code:
26
27 ASM_GLOBAL ASM_PFX(__umoddi3), ASM_PFX(DivU64x64Remainder)
28
29 #------------------------------------------------------------------------------
30 #
31 # void __cdecl __umoddi3 (void)
32 #
33 #------------------------------------------------------------------------------
34 ASM_PFX(__umoddi3):
35 # Original local stack when calling __umoddi3
36 # -----------------
37 # | |
38 # |---------------|
39 # | |
40 # |-- Divisor --|
41 # | |
42 # |---------------|
43 # | |
44 # |-- Dividend --|
45 # | |
46 # |---------------|
47 # | ReturnAddr** |
48 # ESP---->|---------------|
49 #
50
51 #
52 # Set up the local stack for Reminder pointer
53 #
54 sub $8, %esp
55 push %esp
56
57 #
58 # Set up the local stack for Divisor parameter
59 #
60 movl 28(%esp), %eax
61 push %eax
62 movl 28(%esp), %eax
63 push %eax
64
65 #
66 # Set up the local stack for Dividend parameter
67 #
68 movl 28(%esp), %eax
69 push %eax
70 movl 28(%esp), %eax
71 push %eax
72
73 #
74 # Call native DivU64x64Remainder of BaseLib
75 #
76 jmp ASM_PFX(DivU64x64Remainder)
77
78 #
79 # Put the Reminder in EDX:EAX as return value
80 #
81 movl 20(%esp), %eax
82 movl 24(%esp), %edx
83
84 #
85 # Adjust stack
86 #
87 add $28, %esp
88
89 ret $16