summaryrefslogtreecommitdiff
path: root/sys/arch/i386/stand
diff options
context:
space:
mode:
authorJoel Sing <jsing@cvs.openbsd.org>2014-01-02 04:23:58 +0000
committerJoel Sing <jsing@cvs.openbsd.org>2014-01-02 04:23:58 +0000
commit5d1e919f595c95a96b8b11889a5f68e5f8e4477f (patch)
tree797b1711bd2ac63564c1c27661286a6350717d38 /sys/arch/i386/stand
parent156043cd032b89961b85034aea7c3b4bada5e344 (diff)
Ensure that we preserve callee-save registers.
Diffstat (limited to 'sys/arch/i386/stand')
-rw-r--r--sys/arch/i386/stand/libsa/random_i386.S11
1 files changed, 7 insertions, 4 deletions
diff --git a/sys/arch/i386/stand/libsa/random_i386.S b/sys/arch/i386/stand/libsa/random_i386.S
index e53e548e729..03c2f21a3be 100644
--- a/sys/arch/i386/stand/libsa/random_i386.S
+++ b/sys/arch/i386/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