Chameleon

Chameleon Commit Details

Date:2015-05-23 12:06:31 (8 years 11 months ago)
Author:ErmaC
Commit:2699
Parents: 2698
Message:Switch order in pre-processors conditional directives.
Changes:
M/trunk/i386/libsaio/fake_efi.c

File differences

trunk/i386/libsaio/fake_efi.c
762762
763763
764764
765
765766
767
768
769
766770
767771
768772
769773
770774
771775
772
773
774
775776
776777
777778
......
819820
820821
821822
823
822824
825
826
827
828
829
830
831
832
823833
834
835
824836
825837
826838
......
831843
832844
833845
834
835
836
837
838
839
840
841
842
843
844
845846
846847
847848
//
UInt8 index = 0;
EFI_UINT16 PMTimerValue = 0;
#if RANDOMSEED
EFI_UINT32 randomValue = 0, cpuTick = 0;
EFI_UINT32 ecx = 0, edx = 0, esi = 0, edi = 0;
#else
EFI_UINT32 randomValue, tempValue, cpuTick;
EFI_UINT32 ecx, esi, edi = 0;
EFI_UINT32 rcx, rdx, rsi, rdi;
randomValue = tempValue = ecx = esi = edi = 0;// xor%ecx,%ecx
cpuTick = rcx = rdx = rsi = rdi = 0;
#else
EFI_UINT32 randomValue = 0, cpuTick = 0;
EFI_UINT32 ecx = 0, edx = 0, esi = 0, edi = 0;
#endif
// LEAF_1 - Feature Information (Function 01h).
if (Platform.CPU.CPUID[CPUID_1][2] & 0x40000000)// Checking ecx:bit-30
cpuTick = (EFI_UINT32) getCPUTick();// callq0x121a7
//printf("value: 0x%x\n", getCPUTick());
#if RANDOMSEED
ecx = (cpuTick >> 8);// mov%rax,%rcx
// shr$0x8,%rcx
edx = (cpuTick >> 0x10);// mov%rax,%rdx
// shr$0x10,%rdx
edi = esi;// mov%rsi,%rdi
edi = (edi ^ cpuTick);// xor%rax,%rdi
edi = (edi ^ ecx);// xor%rcx,%rdi
edi = (edi ^ edx);// xor%rdx,%rdi
seedBuffer[index] = (edi & 0xff);
#else
rcx = (cpuTick >> 8);// mov%rax,%rcx
// shr$0x8,%rcx
rdx = (cpuTick >> 0x10);// mov%rax,%rdx
rdi = (rdi ^ rdx);// xor%rdx,%rdi
seedBuffer[index] = (rdi & 0xff);// mov%dil,(%r15,%r12,1)
#else
ecx = (cpuTick >> 8);// mov%rax,%rcx
// shr$0x8,%rcx
edx = (cpuTick >> 0x10);// mov%rax,%rdx
// shr$0x10,%rdx
edi = esi;// mov%rsi,%rdi
edi = (edi ^ cpuTick);// xor%rax,%rdi
edi = (edi ^ ecx);// xor%rcx,%rdi
edi = (edi ^ edx);// xor%rdx,%rdi
seedBuffer[index] = (edi & 0xff);// mov%dil,(%r15,%r12,1)
#endif
edi = (edi & 0x2f);// and$0x2f,%edi
edi = (edi + esi);// add%esi,%edi

Archive Download the corresponding diff file

Revision: 2699