diff options
author | Gerd Hoffmann <kraxel@redhat.com> | 2024-06-14 11:45:53 +0200 |
---|---|---|
committer | mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> | 2024-06-14 13:31:12 +0000 |
commit | 5e776299a2604b336a947e68593012ab2cc16eb4 (patch) | |
tree | 09ed08e0c2a830d4a16386e4b001a302680684e2 | |
parent | 94961b8817eec6f8d0434555ac50a7aa51c22201 (diff) | |
download | edk2-5e776299a2604b336a947e68593012ab2cc16eb4.tar.gz edk2-5e776299a2604b336a947e68593012ab2cc16eb4.tar.bz2 edk2-5e776299a2604b336a947e68593012ab2cc16eb4.zip |
MdePkg/X86UnitTestHost: set rdrand cpuid bit
Set the rdrand feature bit when faking cpuid for host test cases.
Needed to make the CryptoPkg test cases work.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
-rw-r--r-- | MdePkg/Library/BaseLib/X86UnitTestHost.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/MdePkg/Library/BaseLib/X86UnitTestHost.c b/MdePkg/Library/BaseLib/X86UnitTestHost.c index 8ba4f54a38..7f7276f7f4 100644 --- a/MdePkg/Library/BaseLib/X86UnitTestHost.c +++ b/MdePkg/Library/BaseLib/X86UnitTestHost.c @@ -66,6 +66,15 @@ UnitTestHostBaseLibAsmCpuid ( OUT UINT32 *Edx OPTIONAL
)
{
+ UINT32 RetEcx;
+
+ RetEcx = 0;
+ switch (Index) {
+ case 1:
+ RetEcx |= BIT30; /* RdRand */
+ break;
+ }
+
if (Eax != NULL) {
*Eax = 0;
}
@@ -75,7 +84,7 @@ UnitTestHostBaseLibAsmCpuid ( }
if (Ecx != NULL) {
- *Ecx = 0;
+ *Ecx = RetEcx;
}
if (Edx != NULL) {
|