MdePkg/BaseLib: Add one wrapper on RdRand access for parameter check.

Add one wrapper implementation over assembly RdRand access to check
possible NULL parameter, for better alignment with comment description.

Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Qin Long <qin.long@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
This commit is contained in:
Qin Long
2016-11-04 15:31:28 +08:00
parent b3775af277
commit 9ec9a7a597
9 changed files with 188 additions and 61 deletions

View File

@@ -1,7 +1,7 @@
/** @file
Declaration of internal functions in BaseLib.
Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
@@ -728,6 +728,52 @@ InternalX86DisablePaging64 (
IN UINT32 NewStack
);
/**
Generates a 16-bit random number through RDRAND instruction.
@param[out] Rand Buffer pointer to store the random result.
@retval TRUE RDRAND call was successful.
@retval FALSE Failed attempts to call RDRAND.
**/
BOOLEAN
EFIAPI
InternalX86RdRand16 (
OUT UINT16 *Rand
);
/**
Generates a 32-bit random number through RDRAND instruction.
@param[out] Rand Buffer pointer to store the random result.
@retval TRUE RDRAND call was successful.
@retval FALSE Failed attempts to call RDRAND.
**/
BOOLEAN
EFIAPI
InternalX86RdRand32 (
OUT UINT32 *Rand
);
/**
Generates a 64-bit random number through RDRAND instruction.
@param[out] Rand Buffer pointer to store the random result.
@retval TRUE RDRAND call was successful.
@retval FALSE Failed attempts to call RDRAND.
**/
BOOLEAN
EFIAPI
InternalX86RdRand64 (
OUT UINT64 *Rand
);
#elif defined (MDE_CPU_IPF)
//