]> git.proxmox.com Git - mirror_edk2.git/blame - CryptoPkg/Library/IntrinsicLib/Ia32/MathRShiftU64.S
CryptoPkg Updates to support RFC3161 timestamp signature verification.
[mirror_edk2.git] / CryptoPkg / Library / IntrinsicLib / Ia32 / MathRShiftU64.S
CommitLineData
97f98500
HT
1#------------------------------------------------------------------------------\r
2#\r
2ac68e8b 3# Copyright (c) 2014, Intel Corporation. All rights reserved.<BR>\r
97f98500
HT
4# This program and the accompanying materials\r
5# are licensed and made available under the terms and conditions of the BSD License\r
6# which accompanies this distribution. The full text of the license may be found at\r
7# http://opensource.org/licenses/bsd-license.php.\r
8#\r
9# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
10# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
11#\r
12# Module Name:\r
13#\r
14# MathRShiftU64.S\r
15#\r
16# Abstract:\r
17#\r
18# 64-bit Math Worker Function.\r
19# Shifts a 64-bit unsigned value right by a certain number of bits.\r
20#\r
21#------------------------------------------------------------------------------\r
22\r
23\r
24 .686:\r
25 .code:\r
26\r
27ASM_GLOBAL ASM_PFX(__ashrdi3)\r
28\r
29#------------------------------------------------------------------------------\r
30#\r
31# void __cdecl __ashrdi3 (void)\r
32#\r
33#------------------------------------------------------------------------------\r
34ASM_PFX(__ashrdi3):\r
35 #\r
36 # Checking: Only handle 64bit shifting or more\r
37 #\r
38 cmpb $64, %cl\r
39 jae _Exit\r
40\r
41 #\r
42 # Handle shifting between 0 and 31 bits\r
43 #\r
44 cmpb $32, %cl\r
45 jae More32\r
46 shrd %cl, %edx, %eax\r
47 shr %cl, %edx\r
48 ret\r
49\r
50 #\r
51 # Handle shifting of 32-63 bits\r
52 #\r
53More32:\r
54 movl %edx, %eax\r
55 xor %edx, %edx\r
38d91622 56 and $31, %cl\r
97f98500
HT
57 shr %cl, %eax\r
58 ret\r
59\r
60 #\r
61 # Invalid number (less then 32bits), return 0\r
62 #\r
63_Exit:\r
64 xor %eax, %eax\r
65 xor %edx, %edx\r
66 ret\r