diff options
| author | Simon Rettberg | 2020-02-24 14:46:41 +0100 |
|---|---|---|
| committer | Simon Rettberg | 2020-02-24 14:46:41 +0100 |
| commit | b7a5d1e66c47bf686736a9ef842c65b9bcc1bb75 (patch) | |
| tree | bbc3d91b6b2b1b764551226c9f9811f870ec4f37 | |
| parent | Merge branch 'master' into openslx (diff) | |
| download | ipxe-b7a5d1e66c47bf686736a9ef842c65b9bcc1bb75.tar.gz ipxe-b7a5d1e66c47bf686736a9ef842c65b9bcc1bb75.tar.xz ipxe-b7a5d1e66c47bf686736a9ef842c65b9bcc1bb75.zip | |
[efi] Consider RDRAND == -1 invalid, use TSC
| -rw-r--r-- | src/interface/efi/efi_entropy.c | 4 |
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; } |
