]>
Commit | Line | Data |
---|---|---|
97f98500 HT |
1 | /** @file\r |
2 | 64-bit Math Worker Function.\r | |
3 | The 32-bit versions of C compiler generate calls to library routines\r | |
4 | to handle 64-bit math. These functions use non-standard calling conventions.\r | |
5 | \r | |
6 | Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR>\r | |
7 | This program and the accompanying materials\r | |
8 | are licensed and made available under the terms and conditions of the BSD License\r | |
9 | which accompanies this distribution. The full text of the license may be found at\r | |
10 | http://opensource.org/licenses/bsd-license.php\r | |
11 | \r | |
12 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r | |
13 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r | |
14 | \r | |
15 | **/\r | |
16 | \r | |
17 | #include <Library/BaseLib.h>\r | |
18 | \r | |
19 | /*\r | |
20 | * Multiplies a 64-bit signed or unsigned value by a 64-bit signed or unsigned value\r | |
21 | * and returns a 64-bit result.\r | |
22 | */\r | |
23 | __declspec(naked) void __cdecl _allmul (void)\r | |
24 | {\r | |
25 | //\r | |
26 | // Wrapper Implementation over EDKII MultS64x64() routine\r | |
27 | // INT64\r | |
28 | // EFIAPI\r | |
29 | // MultS64x64 (\r | |
30 | // IN INT64 Multiplicand,\r | |
31 | // IN INT64 Multiplier\r | |
32 | // )\r | |
33 | //\r | |
34 | _asm {\r | |
35 | ; Original local stack when calling _allmul\r | |
36 | ; -----------------\r | |
37 | ; | |\r | |
38 | ; |---------------|\r | |
39 | ; | |\r | |
40 | ; |--Multiplier --|\r | |
41 | ; | |\r | |
42 | ; |---------------|\r | |
43 | ; | |\r | |
44 | ; |--Multiplicand-|\r | |
45 | ; | |\r | |
46 | ; |---------------|\r | |
47 | ; | ReturnAddr** |\r | |
48 | ; ESP---->|---------------|\r | |
49 | ;\r | |
50 | \r | |
51 | ;\r | |
52 | ; Set up the local stack for Multiplicand parameter\r | |
53 | ;\r | |
54 | mov eax, [esp + 16]\r | |
55 | push eax\r | |
56 | mov eax, [esp + 16]\r | |
57 | push eax\r | |
58 | \r | |
59 | ;\r | |
60 | ; Set up the local stack for Multiplier parameter\r | |
61 | ;\r | |
62 | mov eax, [esp + 16]\r | |
63 | push eax\r | |
64 | mov eax, [esp + 16]\r | |
65 | push eax\r | |
66 | \r | |
67 | ;\r | |
68 | ; Call native MulS64x64 of BaseLib\r | |
69 | ;\r | |
70 | call MultS64x64\r | |
71 | \r | |
72 | ;\r | |
73 | ; Adjust stack\r | |
74 | ;\r | |
75 | add esp, 16\r | |
76 | \r | |
77 | ret 16\r | |
78 | }\r | |
79 | } \r |