Chameleon

Chameleon Commit Details

Date:2015-05-22 22:40:31 (5 years 6 months ago)
Author:ErmaC
Commit:2696
Parents: 2695
Message:Conditional # @build time for random-seed algo, partial rollback. fix boot hang for some old motherboard. (Thx crazybirdy)
Changes:
M/branches/ErmaC/Enoch/i386/libsaio/fake_efi.c

File differences

branches/ErmaC/Enoch/i386/libsaio/fake_efi.c
2222
2323
2424
25
26
27
28
2529
2630
2731
......
757761
758762
759763
764
765
766
767
768
769
770
771
760772
761773
762
774
763775
764776
765777
......
804816
805817
806818
807
819
808820
821
822
823
824
825
826
827
828
829
830
831
832
833
809834
810835
811836
......
816841
817842
818843
819
844
820845
821846
822847
#define DEBUG_EFI 0
#endif
#ifndef RANDOMSEED
#define RANDOMSEED 0
#endif
#if DEBUG_EFI
#define DBG(x...)printf(x)
#else
//
UInt8 index = 0;
EFI_UINT16 PMTimerValue = 0;
#if RANDOMSEED
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
{
continue;// jb0x17e55(retry)
}
cpuTick = (EFI_UINT32) getCPUTick();// callq0x121a7
cpuTick = (EFI_UINT32) getCPUTick();// callq0x121a7
//printf("value: 0x%x\n", getCPUTick());
#if RANDOMSEED
rcx = (cpuTick >> 8);// mov%rax,%rcx
// shr$0x8,%rcx
rdx = (cpuTick >> 0x10);// mov%rax,%rdx
// shr$0x10,%rdx
rdi = rsi;// mov%rsi,%rdi
rdi = (rdi ^ cpuTick);// xor%rax,%rdi
rdi = (rdi ^ rcx);// xor%rcx,%rdi
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
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
index++;// incr12

Archive Download the corresponding diff file

Revision: 2696