From 2d1857ac186e6c7c65ed6aeabc8e8e76b14536d7 Mon Sep 17 00:00:00 2001 From: jsing Date: Thu, 2 Jan 2014 04:39:56 +0000 Subject: [PATCH] Simplify things slightly by using four byte indexing. --- sys/arch/amd64/stand/libsa/random_i386.S | 9 ++++----- sys/arch/i386/stand/libsa/random_i386.S | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/sys/arch/amd64/stand/libsa/random_i386.S b/sys/arch/amd64/stand/libsa/random_i386.S index 03c2f21a3be..568c8bb4daf 100644 --- a/sys/arch/amd64/stand/libsa/random_i386.S +++ b/sys/arch/amd64/stand/libsa/random_i386.S @@ -55,7 +55,6 @@ ENTRY(mdrandom) movl 36(%esp), %ebx movl 40(%esp), %edx shrl $2, %edx - shll $2, %edx xorl %edi, %edi andl $CPUIDECX_RDRAND, %ecx // See if we have rdrand. @@ -66,8 +65,8 @@ ENTRY(mdrandom) userand: rdrand %eax - xorl %eax, 0(%edi,%ebx) - addl $4, %edi + xorl %eax, (%ebx,%edi,4) + incl %edi cmpl %edi, %edx jne userand jmp done @@ -75,8 +74,8 @@ userand: usetsc: rdtsc // Populates edx:eax. mull %edx - xorl %eax, 0(%edi,%ebx) - addl $4, %edi + xorl %eax, (%ebx,%edi,4) + incl %edi cmpl %edi, %ecx jne usetsc jmp done diff --git a/sys/arch/i386/stand/libsa/random_i386.S b/sys/arch/i386/stand/libsa/random_i386.S index 03c2f21a3be..568c8bb4daf 100644 --- a/sys/arch/i386/stand/libsa/random_i386.S +++ b/sys/arch/i386/stand/libsa/random_i386.S @@ -55,7 +55,6 @@ ENTRY(mdrandom) movl 36(%esp), %ebx movl 40(%esp), %edx shrl $2, %edx - shll $2, %edx xorl %edi, %edi andl $CPUIDECX_RDRAND, %ecx // See if we have rdrand. @@ -66,8 +65,8 @@ ENTRY(mdrandom) userand: rdrand %eax - xorl %eax, 0(%edi,%ebx) - addl $4, %edi + xorl %eax, (%ebx,%edi,4) + incl %edi cmpl %edi, %edx jne userand jmp done @@ -75,8 +74,8 @@ userand: usetsc: rdtsc // Populates edx:eax. mull %edx - xorl %eax, 0(%edi,%ebx) - addl $4, %edi + xorl %eax, (%ebx,%edi,4) + incl %edi cmpl %edi, %ecx jne usetsc jmp done -- 2.20.1