--- /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) 2014, Intel Corporation. All rights reserved.<BR>\r
+This program and the accompanying materials\r
+are licensed and made available under the terms and conditions of the BSD License\r
+which accompanies this 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
+\r
+/*\r
+ * Shifts a 64-bit unsigned value right by a certain number of bits.\r
+ */\r
+__declspec(naked) void __cdecl _aullshr (void)\r
+{\r
+ _asm {\r
+ ;\r
+ ; Checking: Only handle 64bit shifting or more\r
+ ;\r
+ cmp cl, 64\r
+ jae _Exit\r
+\r
+ ;\r
+ ; Handle shifting between 0 and 31 bits\r
+ ;\r
+ cmp cl, 32\r
+ jae More32\r
+ shrd eax, edx, cl\r
+ shr edx, cl\r
+ ret\r
+\r
+ ;\r
+ ; Handle shifting of 32-63 bits\r
+ ;\r
+More32:\r
+ mov eax, edx\r
+ xor edx, edx\r
+ and cl, 31\r
+ shr eax, cl\r
+ ret\r
+\r
+ ;\r
+ ; Invalid number (less then 32bits), return 0\r
+ ;\r
+_Exit:\r
+ xor eax, eax\r
+ xor edx, edx\r
+ ret\r
+ }\r
+}\r