diff options
author | Iru Cai <mytbk920423@gmail.com> | 2019-11-13 19:42:57 +0800 |
---|---|---|
committer | Iru Cai <mytbk920423@gmail.com> | 2019-11-17 15:10:47 +0800 |
commit | 6a7f88b9d743aa7d3c38a8097dd97b03c19d2e9a (patch) | |
tree | da6d7415ca80d0a68b9c94ed11f84dbc0c34ca4a | |
parent | 32f66fe368ca7281c6fb617623248444eeb0eef3 (diff) | |
download | coreboot-6a7f88b9d743aa7d3c38a8097dd97b03c19d2e9a.tar.xz |
fcn_fffc91d0 is udiv64
-rw-r--r-- | src/northbridge/intel/haswell/Makefile.inc | 1 | ||||
-rw-r--r-- | src/northbridge/intel/haswell/mrc.asm | 177 | ||||
-rw-r--r-- | src/northbridge/intel/haswell/udiv.asm | 153 |
3 files changed, 167 insertions, 164 deletions
diff --git a/src/northbridge/intel/haswell/Makefile.inc b/src/northbridge/intel/haswell/Makefile.inc index d90c1945e2..65b60a7bad 100644 --- a/src/northbridge/intel/haswell/Makefile.inc +++ b/src/northbridge/intel/haswell/Makefile.inc @@ -37,6 +37,7 @@ romstage-libs += $(obj)/pei_cpuio.o romstage-libs += $(obj)/mrc_init_memory.o romstage-libs += $(obj)/mrc_end_of_pei.o romstage-libs += $(obj)/pei_smbus.o +romstage-libs += $(obj)/udiv.o $(obj)/%.o: $(src)/northbridge/intel/haswell/%.asm echo "NASM $@" nasm -f elf32 -o $@ $< diff --git a/src/northbridge/intel/haswell/mrc.asm b/src/northbridge/intel/haswell/mrc.asm index d7a77db2c9..f5bb715db7 100644 --- a/src/northbridge/intel/haswell/mrc.asm +++ b/src/northbridge/intel/haswell/mrc.asm @@ -191,6 +191,7 @@ global fcn_fffc8290 global fcn_fffa91af global fcn_fffa0020 extern do_smbus_op +extern udiv64 ;; @@ -2403,7 +2404,7 @@ push edi push ecx push edx push eax -call fcn_fffc91d0 ; call 0xfffc91d0 +call udiv64 ; call 0xfffc91d0 add eax, 0x1f4 mov ecx, 0x3e8 xor edx, edx @@ -4699,7 +4700,7 @@ push 0x107a4000 adc edx, 0x2d79 push edx push eax -call fcn_fffc91d0 ; call 0xfffc91d0 +call udiv64 ; call 0xfffc91d0 mov edi, eax add esp, 0x10 mov ecx, dword [ebp - 0x24] @@ -4727,7 +4728,7 @@ push 0x107a4000 adc edx, 0x2d79 push edx push eax -call fcn_fffc91d0 ; call 0xfffc91d0 +call udiv64 ; call 0xfffc91d0 add esp, 0x10 cmp dword [ebx + 0x1021], 0 je short loc_fffa79d1 ; je 0xfffa79d1 @@ -20509,7 +20510,7 @@ push edx push eax push 0x8ac72304 push 0x89e80000 -call fcn_fffc91d0 ; call 0xfffc91d0 +call udiv64 ; call 0xfffc91d0 mov ecx, eax add esp, 0x10 @@ -20555,7 +20556,7 @@ push 0x107a4000 adc edx, 0x2d79 push edx push eax -call fcn_fffc91d0 ; call 0xfffc91d0 +call udiv64 ; call 0xfffc91d0 add esp, 0x10 lea esp, [ebp - 0xc] pop ebx @@ -23612,7 +23613,7 @@ push edx push eax push 0x8ac72304 push 0x89e80000 -call fcn_fffc91d0 ; call 0xfffc91d0 +call udiv64 ; call 0xfffc91d0 mov ecx, eax add esp, 0x10 @@ -23797,7 +23798,7 @@ mov eax, dword [ebp - 0x2c] push eax push ebx push ecx -call fcn_fffc91d0 ; call 0xfffc91d0 +call udiv64 ; call 0xfffc91d0 add esp, 0x10 jmp short loc_fffb77c5 ; jmp 0xfffb77c5 @@ -34564,7 +34565,7 @@ push ebx push ecx push edx push eax -call fcn_fffc91d0 ; call 0xfffc91d0 +call udiv64 ; call 0xfffc91d0 mov ecx, dword [ebp - 0x370] add esp, 0x10 mov ebx, dword [ebp - 0x368] @@ -34615,7 +34616,7 @@ add edx, ecx push 0x64 push edx push eax -call fcn_fffc91d0 ; call 0xfffc91d0 +call udiv64 ; call 0xfffc91d0 add esp, 0x10 jmp short loc_fffc03a6 ; jmp 0xfffc03a6 @@ -40934,7 +40935,7 @@ push ebx push ecx push edx push eax -call fcn_fffc91d0 ; call 0xfffc91d0 +call udiv64 ; call 0xfffc91d0 add esp, 0x10 mov ebx, dword [ebp - 4] leave @@ -43299,7 +43300,7 @@ mov edi, esi sar edi, 0x1f push edi push esi -call fcn_fffc91d0 ; call 0xfffc91d0 +call udiv64 ; call 0xfffc91d0 add esp, 0x10 mov dword [ebp - 0x1c], eax push 0 @@ -43390,7 +43391,7 @@ mov edi, esi sar edi, 0x1f push edi push esi -call fcn_fffc91d0 ; call 0xfffc91d0 +call udiv64 ; call 0xfffc91d0 add esp, 0x10 mov word [ebx], ax push 0 @@ -43651,158 +43652,6 @@ loc_fffc91c8: dd 0x00000000 dd 0x00000000 -fcn_fffc91d0: -push ebp -mov ebp, esp -push edi -push esi -lea esp, [esp - 0x20] -mov eax, dword [ebp + 0x14] -mov edi, dword [ebp + 8] -mov ecx, dword [ebp + 0x10] -test eax, eax -mov dword [ebp - 0x10], edi -mov esi, dword [ebp + 0xc] -mov dword [ebp - 0xc], ecx -jne short loc_fffc9218 ; jne 0xfffc9218 -cmp ecx, esi -ja short loc_fffc9258 ; ja 0xfffc9258 -test ecx, ecx -jne short loc_fffc9202 ; jne 0xfffc9202 -mov eax, 1 -xor edx, edx -div ecx -mov ecx, eax - -loc_fffc9202: -mov eax, esi -xor edx, edx -div ecx -mov esi, eax -mov eax, edi -div ecx -mov edx, esi - -loc_fffc9210: -lea esp, [esp + 0x20] -pop esi -pop edi -pop ebp -ret - -loc_fffc9218: -cmp eax, esi -ja short loc_fffc9248 ; ja 0xfffc9248 -bsr ecx, eax -xor ecx, 0x1f -mov dword [ebp - 0x20], ecx -jne short loc_fffc9268 ; jne 0xfffc9268 -mov edi, dword [ebp - 0x10] -xor edx, edx -cmp dword [ebp - 0xc], edi -jbe loc_fffc92d8 ; jbe 0xfffc92d8 -cmp eax, esi -jb loc_fffc92d8 ; jb 0xfffc92d8 -xor eax, eax -jmp short loc_fffc9210 ; jmp 0xfffc9210 - -loc_fffc9241: -db 0x8d -db 0xb4 -db 0x26 -dd 0x00000000 - -loc_fffc9248: -xor edx, edx -xor eax, eax -lea esp, [esp + 0x20] -pop esi -pop edi -pop ebp -ret - -loc_fffc9254: -dd 0x0026748d - -loc_fffc9258: -mov eax, edi -mov edx, esi -div ecx -xor edx, edx -lea esp, [esp + 0x20] -pop esi -pop edi -pop ebp -ret - -loc_fffc9268: -movzx ecx, byte [ebp - 0x20] -mov edi, dword [ebp - 0xc] -mov edx, dword [ebp - 0xc] -shl eax, cl -mov dword [ebp - 0x18], eax -mov eax, 0x20 -sub eax, dword [ebp - 0x20] -mov ecx, eax -shr edi, cl -or edi, dword [ebp - 0x18] -movzx ecx, byte [ebp - 0x20] -shl edx, cl -mov ecx, eax -mov dword [ebp - 0x18], edx -mov edx, esi -shr edx, cl -movzx ecx, byte [ebp - 0x20] -mov dword [ebp - 0x1c], edx -mov edx, dword [ebp - 0x10] -shl esi, cl -mov ecx, eax -shr edx, cl -mov eax, edx -or eax, esi -mov esi, dword [ebp - 0x1c] -mov edx, esi -div edi -mov esi, edx -mov dword [ebp - 0xc], eax -mul dword [ebp - 0x18] -cmp esi, edx -jb short loc_fffc92e8 ; jb 0xfffc92e8 -movzx ecx, byte [ebp - 0x20] -mov edi, dword [ebp - 0x10] -shl edi, cl -cmp edi, eax -jae short loc_fffc92cd ; jae 0xfffc92cd -cmp esi, edx -je short loc_fffc92e8 ; je 0xfffc92e8 - -loc_fffc92cd: -mov eax, dword [ebp - 0xc] -xor edx, edx -jmp near loc_fffc9210 ; jmp 0xfffc9210 - -loc_fffc92d7: -db 0x90 - -loc_fffc92d8: -mov eax, 1 -jmp near loc_fffc9210 ; jmp 0xfffc9210 - -loc_fffc92e2: -db 0x8d -db 0xb6 -dd 0x00000000 - -loc_fffc92e8: -mov eax, dword [ebp - 0xc] -xor edx, edx -sub eax, 1 -lea esp, [esp + 0x20] -pop esi -pop edi -pop ebp -ret - loc_fffc92f8: dd 0x00000000 dd 0x00000000 diff --git a/src/northbridge/intel/haswell/udiv.asm b/src/northbridge/intel/haswell/udiv.asm new file mode 100644 index 0000000000..70b65cc600 --- /dev/null +++ b/src/northbridge/intel/haswell/udiv.asm @@ -0,0 +1,153 @@ +global udiv64 + +udiv64: +push ebp +mov ebp, esp +push edi +push esi +lea esp, [esp - 0x20] +mov eax, dword [ebp + 0x14] +mov edi, dword [ebp + 8] +mov ecx, dword [ebp + 0x10] +test eax, eax +mov dword [ebp - 0x10], edi +mov esi, dword [ebp + 0xc] +mov dword [ebp - 0xc], ecx +jne short loc_fffc9218 ; jne 0xfffc9218 +cmp ecx, esi +ja short loc_fffc9258 ; ja 0xfffc9258 +test ecx, ecx +jne short loc_fffc9202 ; jne 0xfffc9202 +mov eax, 1 +xor edx, edx +div ecx +mov ecx, eax + +loc_fffc9202: +mov eax, esi +xor edx, edx +div ecx +mov esi, eax +mov eax, edi +div ecx +mov edx, esi + +loc_fffc9210: +lea esp, [esp + 0x20] +pop esi +pop edi +pop ebp +ret + +loc_fffc9218: +cmp eax, esi +ja short loc_fffc9248 ; ja 0xfffc9248 +bsr ecx, eax +xor ecx, 0x1f +mov dword [ebp - 0x20], ecx +jne short loc_fffc9268 ; jne 0xfffc9268 +mov edi, dword [ebp - 0x10] +xor edx, edx +cmp dword [ebp - 0xc], edi +jbe loc_fffc92d8 ; jbe 0xfffc92d8 +cmp eax, esi +jb loc_fffc92d8 ; jb 0xfffc92d8 +xor eax, eax +jmp short loc_fffc9210 ; jmp 0xfffc9210 + +loc_fffc9241: +db 0x8d +db 0xb4 +db 0x26 +dd 0x00000000 + +loc_fffc9248: +xor edx, edx +xor eax, eax +lea esp, [esp + 0x20] +pop esi +pop edi +pop ebp +ret + +loc_fffc9254: +dd 0x0026748d + +loc_fffc9258: +mov eax, edi +mov edx, esi +div ecx +xor edx, edx +lea esp, [esp + 0x20] +pop esi +pop edi +pop ebp +ret + +loc_fffc9268: +movzx ecx, byte [ebp - 0x20] +mov edi, dword [ebp - 0xc] +mov edx, dword [ebp - 0xc] +shl eax, cl +mov dword [ebp - 0x18], eax +mov eax, 0x20 +sub eax, dword [ebp - 0x20] +mov ecx, eax +shr edi, cl +or edi, dword [ebp - 0x18] +movzx ecx, byte [ebp - 0x20] +shl edx, cl +mov ecx, eax +mov dword [ebp - 0x18], edx +mov edx, esi +shr edx, cl +movzx ecx, byte [ebp - 0x20] +mov dword [ebp - 0x1c], edx +mov edx, dword [ebp - 0x10] +shl esi, cl +mov ecx, eax +shr edx, cl +mov eax, edx +or eax, esi +mov esi, dword [ebp - 0x1c] +mov edx, esi +div edi +mov esi, edx +mov dword [ebp - 0xc], eax +mul dword [ebp - 0x18] +cmp esi, edx +jb short loc_fffc92e8 ; jb 0xfffc92e8 +movzx ecx, byte [ebp - 0x20] +mov edi, dword [ebp - 0x10] +shl edi, cl +cmp edi, eax +jae short loc_fffc92cd ; jae 0xfffc92cd +cmp esi, edx +je short loc_fffc92e8 ; je 0xfffc92e8 + +loc_fffc92cd: +mov eax, dword [ebp - 0xc] +xor edx, edx +jmp near loc_fffc9210 ; jmp 0xfffc9210 + +loc_fffc92d7: +db 0x90 + +loc_fffc92d8: +mov eax, 1 +jmp near loc_fffc9210 ; jmp 0xfffc9210 + +loc_fffc92e2: +db 0x8d +db 0xb6 +dd 0x00000000 + +loc_fffc92e8: +mov eax, dword [ebp - 0xc] +xor edx, edx +sub eax, 1 +lea esp, [esp + 0x20] +pop esi +pop edi +pop ebp +ret |