x86 asm: move rdrand from x86-assembly-cheat

This commit is contained in:
Ciro Santilli 六四事件 法轮功
2019-06-16 00:00:00 +00:00
parent 4ee1e06299
commit 4d4b82f248
3 changed files with 35 additions and 0 deletions

View File

@@ -12416,6 +12416,22 @@ link:userland/arch/x86_64/loop.S[LOOP]
Vs <<x86-jcc-instructions,Jcc>>: https://stackoverflow.com/questions/6805692/x86-assembly-programming-loops-with-ecx-and-loop-instruction-versus-jmp-jcond Holy CISC!
=== x86 random number generator instructions
<<intel-manual-1>> 5.1.15 Random Number Generator Instructions
Example: link:userland/arch/x86_64/rdrand.S[RDRAND]
If you run that executable multiple times, it prints a random number every time to stdout.
RDRAND is a true random number generator!
This Intel engineer says its based on quantum effects: https://stackoverflow.com/questions/17616960/true-random-numbers-with-c11-and-rdrand/18004959#18004959
Generated some polemic when kernel devs wanted to use it as part of `/dev/random`, because it could be used as a cryptographic backdoor by Intel since it is a black box.
RDRAND sets the carry flag when data is ready so we must loop if the carry flag isn't set.
=== x86 SIMD
History: