diff options
author | Iru Cai <mytbk920423@gmail.com> | 2019-11-17 18:23:05 +0800 |
---|---|---|
committer | Iru Cai <mytbk920423@gmail.com> | 2019-11-17 18:25:13 +0800 |
commit | 23367f7864b11ce17269fe5a01e7cfc74f73bbe2 (patch) | |
tree | 08ae5bff07d2bb2d794e030defc3b7a688b4cb51 | |
parent | 2a69a9132b2c2f1e4ab875890732cf94217c2853 (diff) | |
download | coreboot-23367f7864b11ce17269fe5a01e7cfc74f73bbe2.tar.xz |
fcn_fffab280 from ghidra
-rw-r--r-- | src/northbridge/intel/haswell/mrc.asm | 145 | ||||
-rw-r--r-- | src/northbridge/intel/haswell/mrc_misc.c | 60 | ||||
-rw-r--r-- | src/northbridge/intel/haswell/mrc_misc.h | 1 |
3 files changed, 61 insertions, 145 deletions
diff --git a/src/northbridge/intel/haswell/mrc.asm b/src/northbridge/intel/haswell/mrc.asm index 4a6cffcd6c..7a3f0bb994 100644 --- a/src/northbridge/intel/haswell/mrc.asm +++ b/src/northbridge/intel/haswell/mrc.asm @@ -8184,151 +8184,6 @@ pop esi pop ebp ret -fcn_fffab280: ; not directly referenced -push ebp -mov ebp, esp -push edi -push esi -push ebx -lea esp, [esp - 0x2c] -mov ebx, dword [ebp + 8] -mov dword [ebp - 0x1c], 0 -lea eax, [ebx + 8] -mov dword [ebp - 0x28], eax -mov al, byte [ebx + 0x297b] -lea edi, [ebx + 0x10b7] -mov byte [ebx + 0x9e8], al -mov eax, dword [ebx + 0x2974] -mov dword [ebp - 0x2c], edi -mov dword [ebx + 0x9e4], eax -lea edi, [ebx + 0x2974] -mov dword [ebp - 0x30], edi -lea edi, [ebx + 0x9e4] -mov dword [ebp - 0x34], edi - -loc_fffab2cd: ; not directly referenced -imul eax, dword [ebp - 0x1c], 0x2fa -imul edx, dword [ebp - 0x1c], 0x1347 -mov edi, dword [ebp - 0x2c] -add edx, dword [ebp - 0x30] -mov dword [ebp - 0x20], 0 -lea eax, [edi + eax + 5] -mov dword [ebp - 0x24], eax -imul eax, dword [ebp - 0x1c], 0x2e6 -add eax, dword [ebp - 0x34] -lea esi, [edx + 8] -mov ecx, dword [esi + 0xf5] -lea edi, [eax + 5] -mov dword [edi + 5], ecx -mov cl, byte [esi + 0x114f] -mov byte [edi + 9], cl -mov cl, byte [esi + 0xf0] -mov byte [edi + 4], cl -mov edx, dword [edx + 8] -mov dword [eax + 5], edx - -loc_fffab320: ; not directly referenced -imul eax, dword [ebp - 0x20], 0x2a -mov ecx, 0x2a -lea edx, [esi + eax + 8] -lea eax, [edi + eax + 0xa] -call mrc_memcpy -inc dword [ebp - 0x20] -cmp dword [ebp - 0x20], 4 -jne short loc_fffab320 ; jne 0xfffab320 -lea edx, [esi + 0x1151] -mov ecx, 0xfb -lea eax, [edi + 0xb2] -call mrc_memcpy -mov edx, dword [ebp - 0x24] -mov ecx, 0x1f -add edx, 0xa1 -lea eax, [edi + 0x2a8] -call mrc_memcpy -lea edx, [esi + 0x124c] -mov ecx, 0xfb -lea eax, [edi + 0x1ad] -call mrc_memcpy -mov edx, dword [ebp - 0x24] -lea eax, [edi + 0x2c7] -add edx, 0x1f0 -mov ecx, 0x1f -call mrc_memcpy -inc dword [ebp - 0x1c] -cmp dword [ebp - 0x1c], 2 -jne loc_fffab2cd ; jne 0xfffab2cd -mov eax, dword [ebx + 0x172c] -xor edx, edx -mov dword [ebx + 0xfc2], eax -mov eax, dword [ebx + 0x1730] -mov dword [ebx + 0xfc6], eax -mov eax, dword [ebx + 0x1734] -mov dword [ebx + 0xfca], eax -mov eax, dword [ebx + 0x1738] -mov dword [ebx + 0xfce], eax -lea eax, [ebx + 0x14] - -loc_fffab3df: ; not directly referenced -lea ecx, [edx*4 + ref_fffcb80c] ; lea ecx, [edx*4 - 0x347f4] -mov dword [ebp - 0x20], ecx -movzx ecx, word [edx*4 + ref_fffcb80c] ; movzx ecx, word [edx*4 - 0x347f4] -sub ecx, eax -jmp short loc_fffab402 ; jmp 0xfffab402 - -loc_fffab3f5: ; not directly referenced -add esi, dword [ebx + 0x103f] -mov esi, dword [esi] -mov dword [eax], esi -add eax, 4 - -loc_fffab402: ; not directly referenced -mov edi, dword [ebp - 0x20] -lea esi, [eax + ecx] -movzx edi, word [edi + 2] -cmp esi, edi -jbe short loc_fffab3f5 ; jbe 0xfffab3f5 -inc edx -cmp edx, 0x5d -jne short loc_fffab3df ; jne 0xfffab3df -lea eax, [ebx + 0x9dc] -call fcn_fffa9196 ; call 0xfffa9196 -mov eax, dword [ebx + 0x1005] -mov edx, dword [ebx + 0x1037] -mov dword [ebx + 0x9d8], eax -mov eax, dword [ebx + 0x1001] -mov dword [ebx + 0x9d4], eax -mov eax, dword [ebx + 0x16c6] -mov dword [ebx + 0xfb5], eax -mov eax, dword [ebx + 0x16ce] -mov dword [ebx + 0xfb9], eax -mov al, byte [ebx + 0x16d6] -mov byte [ebx + 0xfc1], al -mov eax, dword [ebx + 0x16d2] -mov dword [ebx + 0xfbd], eax -mov al, byte [ebx + 0x1740] -mov byte [ebx + 0xfd2], al -mov eax, dword [ebx + 0x1749] -mov dword [ebx + 0xfd3], eax -mov al, byte [ebx + 0x1746] -mov byte [ebx + 0xfd7], al -mov eax, dword [ebx + 0x1033] -call crc32 ; call 0xfffab210 -mov dword [ebx + 0x9e0], eax -mov edx, 0xfd0 -mov eax, dword [ebp - 0x28] -call crc32 ; call 0xfffab210 -mov dword [ebx + 4], eax -lea esp, [esp + 0x2c] -pop ebx -xor eax, eax -pop esi -pop edi -pop ebp -ret - -loc_fffab4bf: -db 0x00 - fcn_fffab4c0: ; not directly referenced push ebp mov ecx, 0x20 diff --git a/src/northbridge/intel/haswell/mrc_misc.c b/src/northbridge/intel/haswell/mrc_misc.c index 0adf671d38..8dafd0f179 100644 --- a/src/northbridge/intel/haswell/mrc_misc.c +++ b/src/northbridge/intel/haswell/mrc_misc.c @@ -1681,3 +1681,63 @@ int fcn_fffa948c(void *ramdata) } return 0; } + +int fcn_fffab280(void *ramdata) +{ + PRINT_FUNC; + + *(uint8_t *)(ramdata + 0x9e8) = *(uint8_t *)(ramdata + 0x297b); + *(uint32_t *)(ramdata + 0x9e4) = *(uint32_t *)(ramdata + 0x2974); + for (int i = 0; i < 2; i++) { + void *ptr0 = (ramdata + i * 0x1347 + 0x2974); + void *ptr1 = (ramdata + i * 0x2fa + 0x10bc); + void *ptr2 = (ramdata + i * 0x2e6 + 0x9e4); + *(uint32_t *)(ptr2 + 10) = *(uint32_t *)(ptr0 + 0xfd); + *(uint8_t *)(ptr2 + 0xe) = *(uint8_t *)(ptr0 + 0x1157); + *(uint8_t *)(ptr2 + 9) = *(uint8_t *)(ptr0 + 0xf8); + *(uint32_t *)(ptr2 + 5) = *(uint32_t *)(ptr0 + 8); + for (int j = 0; j < 4; j++) { + mrc_memcpy((ptr2 + j * 0x2a + 0xf), + (ptr0 + j * 0x2a + 0x10), 0x2a); + } + mrc_memcpy((ptr2 + 0xb7), (ptr0 + 0x1159), 0xfb); + mrc_memcpy((ptr2 + 0x2ad), (ptr1 + 0xa1), 0x1f); + mrc_memcpy((ptr2 + 0x1b2), (ptr0 + 0x1254), 0xfb); + mrc_memcpy((ptr2 + 0x2cc), (ptr1 + 0x1f0), 0x1f); + } + *(uint32_t *)(ramdata + 0xfc2) = *(uint32_t *)(ramdata + 0x172c); + *(uint32_t *)(ramdata + 0xfc6) = *(uint32_t *)(ramdata + 0x1730); + *(uint32_t *)(ramdata + 0xfca) = *(uint32_t *)(ramdata + 0x1734); + *(uint32_t *)(ramdata + 0xfce) = *(uint32_t *)(ramdata + 0x1738); + + void *saved_reg = ramdata + 0x14; + for (int i = 0; i < 0x5d; i++) { + uint32_t start = ref_fffcb80c[i * 2]; + uint32_t end = ref_fffcb80c[i * 2 + 1]; + while (start <= end) { + *(uint32_t*)(saved_reg) = MCHBAR32(start); + start += 4; + saved_reg = saved_reg + 4; + } + } + + void __attribute((regparm(1))) fcn_fffa9196(void *a); + fcn_fffa9196((ramdata + 0x9dc)); + + *(uint32_t *)(ramdata + 0x9d8) = *(uint32_t *)(ramdata + 0x1005); + *(uint32_t *)(ramdata + 0x9d4) = *(uint32_t *)(ramdata + 0x1001); + *(uint32_t *)(ramdata + 0xfb5) = *(uint32_t *)(ramdata + 0x16c6); + *(uint32_t *)(ramdata + 0xfb9) = *(uint32_t *)(ramdata + 0x16ce); + *(uint8_t *)(ramdata + 0xfc1) = *(uint8_t *)(ramdata + 0x16d6); + *(uint32_t *)(ramdata + 0xfbd) = *(uint32_t *)(ramdata + 0x16d2); + *(uint8_t *)(ramdata + 0xfd2) = *(uint8_t *)(ramdata + 0x1740); + *(uint32_t *)(ramdata + 0xfd3) = *(uint32_t *)(ramdata + 0x1749); + *(uint8_t *)(ramdata + 0xfd7) = *(uint8_t *)(ramdata + 0x1746); + + uint32_t crc = crc32(*(void **)(ramdata + 0x1033), *(size_t *)(ramdata + 0x1037)); + *(uint32_t *)(ramdata + 0x9e0) = crc; + crc = crc32((ramdata + 8), 0xfd0); + *(uint32_t *)(ramdata + 4) = crc; + + return 0; +} diff --git a/src/northbridge/intel/haswell/mrc_misc.h b/src/northbridge/intel/haswell/mrc_misc.h index 8cac26916b..fc94358407 100644 --- a/src/northbridge/intel/haswell/mrc_misc.h +++ b/src/northbridge/intel/haswell/mrc_misc.h @@ -60,3 +60,4 @@ int MRCABI wait_5030(void *ramdata); int MRCABI wait_5084(void *ramdata); int fcn_fffa7e78(void *ramdata); int fcn_fffa948c(void *ramdata); +int fcn_fffab280(void *ramdata); |