summaryrefslogtreecommitdiff
path: root/sys/arch/i386
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2020-05-25 14:58:03 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2020-05-25 14:58:03 +0000
commitff3f064107f9b8aa872ca0a5986c2d7ec1ea1e24 (patch)
tree7f8740dca55e0810daf6f2e8f320a64ce3bd471b /sys/arch/i386
parent00d3e4ac379d76d6fdaacb288af1b76a4c4ed326 (diff)
Adjust mdrandom() to also return 0 for success, -1 for failure
Diffstat (limited to 'sys/arch/i386')
-rw-r--r--sys/arch/i386/stand/libsa/random_i386.S6
1 files changed, 5 insertions, 1 deletions
diff --git a/sys/arch/i386/stand/libsa/random_i386.S b/sys/arch/i386/stand/libsa/random_i386.S
index fb1de133be3..df97b0bd747 100644
--- a/sys/arch/i386/stand/libsa/random_i386.S
+++ b/sys/arch/i386/stand/libsa/random_i386.S
@@ -1,4 +1,4 @@
-/* $OpenBSD: random_i386.S,v 1.10 2016/02/12 21:36:33 naddy Exp $ */
+/* $OpenBSD: random_i386.S,v 1.11 2020/05/25 14:58:02 deraadt Exp $ */
/*
* Copyright (c) 2013 Joel Sing <jsing@openbsd.org>
@@ -40,6 +40,7 @@ ENTRY(mdrandom)
pushl %ecx
popfl
andl $PSL_ID, %eax
+ movl $-1, %eax
jz done
// CPUID leaf = 1, subleaf = 0
@@ -59,6 +60,7 @@ ENTRY(mdrandom)
andl $CPUID_TSC, %eax // See if we have rdtsc.
jnz usetsc
+ movl $-1, %eax
jmp done
userand:
@@ -69,6 +71,7 @@ userand:
incl %edi
cmpl %edi, %edx
jne 1b
+ movl $0, %eax
jmp done
usetsc:
@@ -99,6 +102,7 @@ usetsc:
incl %edi
cmpl %edi, %ecx
jne usetsc
+ movl $0, %eax
jmp done
done: