2 RDRAND Support Routines for GCC environment.
4 Copyright (c) 2013, Intel Corporation. All rights reserved.<BR>
5 This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
16 Generates a 16-bit random number through RDRAND instruction.
18 @param[out] Rand Buffer pointer to store the random result.
20 @retval TRUE RDRAND call was successful.
21 @retval FALSE Failed attempts to call RDRAND.
33 // Uses byte code for RDRAND instruction,
34 // in case that GCC version has no direct support on RDRAND assembly.
36 __asm__
__volatile__ (
37 ".byte 0x66; .byte 0x0f; .byte 0xc7; .byte 0xf0; setc %1"
42 return (BOOLEAN
) Carry
;
46 Generates a 32-bit random number through RDRAND instruction.
48 @param[out] Rand Buffer pointer to store the random result.
50 @retval TRUE RDRAND call was successful.
51 @retval FALSE Failed attempts to call RDRAND.
62 __asm__
__volatile__ (
63 ".byte 0x0f; .byte 0xc7; .byte 0xf0; setc %1"
68 return (BOOLEAN
) Carry
;
72 Generates a 64-bit random number through RDRAND instruction.
74 @param[out] Rand Buffer pointer to store the random result.
76 @retval TRUE RDRAND call was successful.
77 @retval FALSE Failed attempts to call RDRAND.
88 __asm__
__volatile__ (
89 ".byte 0x48; .byte 0x0f; .byte 0xc7; .byte 0xf0; setc %1"
94 return (BOOLEAN
) Carry
;