]> git.proxmox.com Git - mirror_edk2.git/blob - CryptoPkg/Library/IntrinsicLib/Ia32/MathLShiftS64.c
UefiCpuPkg: Move AsmRelocateApLoopStart from Mpfuncs.nasm to AmdSev.nasm
[mirror_edk2.git] / CryptoPkg / Library / IntrinsicLib / Ia32 / MathLShiftS64.c
1 /** @file
2 64-bit Math Worker Function.
3 The 32-bit versions of C compiler generate calls to library routines
4 to handle 64-bit math. These functions use non-standard calling conventions.
5
6 Copyright (c) 2014, Intel Corporation. All rights reserved.<BR>
7 SPDX-License-Identifier: BSD-2-Clause-Patent
8
9 **/
10
11 /*
12 * Shifts a 64-bit signed value left by a particular number of bits.
13 */
14 __declspec(naked) void __cdecl
15 _allshl (
16 void
17 )
18 {
19 _asm {
20 ;
21 ; Handle shifting of 64 or more bits (return 0)
22 ;
23
24 cmp cl, 64
25 jae short ReturnZero
26
27 ;
28 ; Handle shifting of between 0 and 31 bits
29 ;
30 cmp cl, 32
31 jae short More32
32 shld edx, eax, cl
33 shl eax, cl
34 ret
35
36 ;
37 ; Handle shifting of between 32 and 63 bits
38 ;
39 More32:
40 mov edx, eax
41 xor eax, eax
42 and cl, 31
43 shl edx, cl
44 ret
45
46 ReturnZero:
47 xor eax,eax
48 xor edx,edx
49 ret
50 }
51 }