+++ /dev/null
-/** @file\r
- 64-bit Math Worker Function.\r
- The 32-bit versions of C compiler generate calls to library routines\r
- to handle 64-bit math. These functions use non-standard calling conventions.\r
-\r
- Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.<BR>\r
- This program and the accompanying materials are licensed and made available\r
- under the terms and conditions of the BSD License which accompanies this\r
- distribution. The full text of the license may be found at\r
- http://opensource.org/licenses/bsd-license.php.\r
-\r
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-\r
-**/\r
-\r
-#include <Library/BaseLib.h>\r
-\r
-\r
-/*\r
- * Divides a 64-bit signed value by another 64-bit signed value and returns\r
- * the 64-bit signed result and the 64-bit signed remainder.\r
- */\r
-__declspec(naked) void __cdecl _alldvrm(void)\r
-{\r
- //\r
- // Wrapper Implementation over EDKII DivS64x64Remainder() routine\r
- // INT64\r
- // EFIAPI\r
- // DivS64x64Remainder (\r
- // IN INT64 Dividend,\r
- // IN INT64 Divisor,\r
- // OUT INT64 *Remainder\r
- // )\r
- //\r
- _asm {\r
- ; Original local stack when calling _alldvrm\r
- ; -----------------\r
- ; | |\r
- ; |---------------|\r
- ; | |\r
- ; |-- Divisor --|\r
- ; | |\r
- ; |---------------|\r
- ; | |\r
- ; |-- Dividend --|\r
- ; | |\r
- ; |---------------|\r
- ; | ReturnAddr** |\r
- ; ESP---->|---------------|\r
- ;\r
- ;\r
- ; On Exit:\r
- ; EDX:EAX contains the quotient (dividend/divisor)\r
- ; EBX:ECX contains the remainder (divided % divisor)\r
- ; NOTE: this routine removes the parameters from the stack.\r
- ;\r
-\r
- ;\r
- ; Set up the local stack for Reminder pointer\r
- ;\r
- sub esp, 8\r
- push esp\r
-\r
- ;\r
- ; Set up the local stack for Divisor parameter\r
- ;\r
- mov eax, [esp + 28]\r
- push eax\r
- mov eax, [esp + 28]\r
- push eax\r
-\r
- ;\r
- ; Set up the local stack for Dividend parameter\r
- ;\r
- mov eax, [esp + 28]\r
- push eax\r
- mov eax, [esp + 28]\r
- push eax\r
-\r
- ;\r
- ; Call native DivS64x64Remainder of BaseLib\r
- ;\r
- call DivS64x64Remainder\r
-\r
- ;\r
- ; EDX:EAX contains the quotient (dividend/divisor)\r
- ; Put the Remainder in EBX:ECX\r
- ;\r
- mov ecx, [esp + 20]\r
- mov ebx, [esp + 24]\r
-\r
- ;\r
- ; Adjust stack\r
- ;\r
- add esp, 28\r
-\r
- ret 16\r
- }\r
-}\r