summaryrefslogtreecommitdiffstats
path: root/src/interface
diff options
context:
space:
mode:
authorSimon Rettberg2020-02-24 14:46:41 +0100
committerSimon Rettberg2020-02-24 14:46:41 +0100
commitb7a5d1e66c47bf686736a9ef842c65b9bcc1bb75 (patch)
treebbc3d91b6b2b1b764551226c9f9811f870ec4f37 /src/interface
parentMerge branch 'master' into openslx (diff)
downloadipxe-b7a5d1e66c47bf686736a9ef842c65b9bcc1bb75.tar.gz
ipxe-b7a5d1e66c47bf686736a9ef842c65b9bcc1bb75.tar.xz
ipxe-b7a5d1e66c47bf686736a9ef842c65b9bcc1bb75.zip
[efi] Consider RDRAND == -1 invalid, use TSC
Diffstat (limited to 'src/interface')
-rw-r--r--src/interface/efi/efi_entropy.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/interface/efi/efi_entropy.c b/src/interface/efi/efi_entropy.c
index a1dfaaa79..a865bad59 100644
--- a/src/interface/efi/efi_entropy.c
+++ b/src/interface/efi/efi_entropy.c
@@ -170,6 +170,10 @@ static int efi_get_noise_rdrand ( noise_sample_t *noise ) {
while ( --retries > 0 ) {
__asm__ volatile ( "rdrand %0; setc %1" : "=r" ( ret ), "=qm" ( ok ) );
if ( ok ) {
+ if ( ret == -1 ) {
+ /* Assume this is a broken AMD CPU, fall back to TSC */
+ ret = profile_timestamp();
+ }
*noise = ret;
return 0;
}