Implement random number generation with x86 rdrand
This commit is contained in:
13
kernel/hal/x86_64/randnum.S
Normal file
13
kernel/hal/x86_64/randnum.S
Normal file
@ -0,0 +1,13 @@
|
||||
.global hal_randnum
|
||||
hal_randnum:
|
||||
mov $100, %ecx
|
||||
xor %eax, %eax
|
||||
|
||||
.retry:
|
||||
rdrand %eax
|
||||
jc .done
|
||||
loop .retry
|
||||
.fail:
|
||||
mov $-1, %eax
|
||||
.done:
|
||||
ret
|
||||
Reference in New Issue
Block a user