From 5d1e919f595c95a96b8b11889a5f68e5f8e4477f Mon Sep 17 00:00:00 2001 From: Joel Sing Date: Thu, 2 Jan 2014 04:23:58 +0000 Subject: Ensure that we preserve callee-save registers. --- sys/arch/i386/stand/libsa/random_i386.S | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'sys/arch/i386/stand') 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 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 -- cgit v1.2.3