diff options
author | Iru Cai <mytbk920423@gmail.com> | 2018-12-26 10:48:30 +0800 |
---|---|---|
committer | Iru Cai <mytbk920423@gmail.com> | 2019-11-17 15:10:45 +0800 |
commit | dff63e35757d4ce9f89eda4fe0a2af003982d814 (patch) | |
tree | 62389f4d776b715fb4a5214be2f52008a53e0299 /src | |
parent | 4c10ac59b2ca8dd338a45c1853f251a5055576af (diff) | |
download | coreboot-dff63e35757d4ce9f89eda4fe0a2af003982d814.tar.xz |
check_data_structs
Diffstat (limited to 'src')
-rw-r--r-- | src/northbridge/intel/haswell/mrc.asm | 45 | ||||
-rw-r--r-- | src/northbridge/intel/haswell/mrc_frag_init_memory.c | 32 |
2 files changed, 28 insertions, 49 deletions
diff --git a/src/northbridge/intel/haswell/mrc.asm b/src/northbridge/intel/haswell/mrc.asm index c3ec17df43..4968426eba 100644 --- a/src/northbridge/intel/haswell/mrc.asm +++ b/src/northbridge/intel/haswell/mrc.asm @@ -61,7 +61,6 @@ extern mrc_init_memory global ref_fffcd4a4 global ref_fffcd4e4 -global fcn_fffa10df extern locate_hob global fcn_fffa1d20 global fcn_fffa56ac @@ -1408,50 +1407,6 @@ pop edi pop ebp ret -fcn_fffa10df: -push ebp -mov ebp, esp -push esi -push ebx -mov ebx, eax -lea eax, [ebp - 0xc] -lea esp, [esp - 0x10] -mov esi, dword [edx + 9] -call fcn_fffa9196 ; call 0xfffa9196 -mov edx, 0xc8 -mov eax, esi -call crc32 ; call 0xfffab210 -mov dl, byte [ebx + 0x9dc] -cmp byte [ebp - 0xc], dl -mov dl, 1 -jne short loc_fffa1154 ; jne 0xfffa1154 -mov cl, byte [ebx + 0x9dd] -cmp byte [ebp - 0xb], cl -jne short loc_fffa1154 ; jne 0xfffa1154 -mov cl, byte [ebx + 0x9de] -cmp byte [ebp - 0xa], cl -jne short loc_fffa1154 ; jne 0xfffa1154 -mov cl, byte [ebx + 0x9df] -cmp byte [ebp - 9], cl -jne short loc_fffa1154 ; jne 0xfffa1154 -mov ecx, dword [ebx + 0x9d8] -cmp dword [ebx + 0x1005], ecx -jne short loc_fffa1154 ; jne 0xfffa1154 -mov ecx, dword [ebx + 0x9d4] -cmp dword [ebx + 0x1001], ecx -jne short loc_fffa1154 ; jne 0xfffa1154 -cmp eax, dword [ebx + 0x9e0] -setne dl - -loc_fffa1154: -lea esp, [esp + 0x10] -mov al, dl -pop ebx -pop esi -pop ebp -ret - - fcn_fffa1d20: push ebp mov ebp, esp diff --git a/src/northbridge/intel/haswell/mrc_frag_init_memory.c b/src/northbridge/intel/haswell/mrc_frag_init_memory.c index 690deff726..7340481097 100644 --- a/src/northbridge/intel/haswell/mrc_frag_init_memory.c +++ b/src/northbridge/intel/haswell/mrc_frag_init_memory.c @@ -163,8 +163,32 @@ int frag_fffc1d5a(void *ppi, int t, void* dst) return 1; } -int __attribute((regparm(2))) -fcn_fffa10df(void *ram_data, void *ppi); +void __attribute((regparm(1))) fcn_fffa9196(void *a); +static int check_data_structs(void *ram_data, pei_raminit_ppi *ppi) +{ + uint32_t chk; + uint32_t crc; + + pei_ram_param *parm = ppi->ram_param; + fcn_fffa9196((void*)&chk); + crc = crc32((void*)parm, 0xc8); + + if (chk != *(uint32_t*)(ram_data + 0x9dc)) + return 1; + + if (*(uint32_t*)(ram_data + 0x9d8) + != *(uint32_t*)(ram_data + 0x1005)) + return 1; + + if (*(uint32_t*)(ram_data + 0x9d4) + != *(uint32_t*)(ram_data + 0x1001)) + return 1; + + if (*(uint32_t*)(ram_data + 0x9e0) != crc) + return 1; + + return 0; +} /* ram_data: ebp - 0x503a @@ -180,7 +204,7 @@ int frag_fffc1ea8(void *ram_data, pei_raminit_ppi *ppi, if (v50c4 - 1 > 1) { if (bl == 1) { if (ppi->ram_param->v2c[0x2a] != 0) { - if (fcn_fffa10df(ram_data, ppi) == 0) + if (check_data_structs(ram_data, ppi) == 0) return 3; } } @@ -191,7 +215,7 @@ int frag_fffc1ea8(void *ram_data, pei_raminit_ppi *ppi, mrc_zeromem(ram_data + 4, 0xfd4); return 0; } - if (fcn_fffa10df(ram_data, ppi) == 1) { + if (check_data_structs(ram_data, ppi) == 1) { mrc_zeromem(ram_data + 4, 0xfd4); return 0; } |