summaryrefslogtreecommitdiff
path: root/sys/arch/amd64/stand/libsa/random_i386.S
diff options
context:
space:
mode:
Diffstat (limited to 'sys/arch/amd64/stand/libsa/random_i386.S')
-rw-r--r--sys/arch/amd64/stand/libsa/random_i386.S11
1 files changed, 7 insertions, 4 deletions
diff --git a/sys/arch/amd64/stand/libsa/random_i386.S b/sys/arch/amd64/stand/libsa/random_i386.S
index e53e548e729..03c2f21a3be 100644
--- a/sys/arch/amd64/stand/libsa/random_i386.S
+++ b/sys/arch/amd64/stand/libsa/random_i386.S
@@ -20,6 +20,8 @@
#include <machine/specialreg.h>
ENTRY(mdrandom)
+ pushal
+
// See if we have CPU identification.
pushfl
popl %eax
@@ -50,8 +52,8 @@ ENTRY(mdrandom)
movl $0, %ecx
cpuid
- movl 4(%esp), %ebx
- movl 8(%esp), %edx
+ movl 36(%esp), %ebx
+ movl 40(%esp), %edx
shrl $2, %edx
shll $2, %edx
xorl %edi, %edi
@@ -68,7 +70,7 @@ userand:
addl $4, %edi
cmpl %edi, %edx
jne userand
- ret
+ jmp done
usetsc:
rdtsc // Populates edx:eax.
@@ -77,7 +79,8 @@ usetsc:
addl $4, %edi
cmpl %edi, %ecx
jne usetsc
- ret
+ jmp done
done:
+ popal
ret