Настройка MTRR:
_F000:19D8 ; =============== S U B R O U T I N E ======================================= _F000:19D8 _F000:19D8 _F000:19D8 MTRR_set proc near ; CODE XREF: sub_F18B7+8Ep _F000:19D8 ; sub_F18B7+ABp ... _F000:19D8 66 51 push ecx ; value _F000:19DA 66 52 push edx ; address _F000:19DA _F000:19DC _F000:19DC MTRR_set_loop: ; CODE XREF: MTRR_set+79j _F000:19DC 66 3D 0F 02 00 00 cmp eax, MTRRphysMask7 ; Compare Two Operands _F000:19E2 77 6F ja short return ; Jump if Above (CF=0 & ZF=0) _F000:19E2 _F000:19E4 66 0B FF or edi, edi ; Logical Inclusive OR _F000:19E7 74 6A jz short return ; Jump if Zero (ZF=1) _F000:19E7 _F000:19E9 66 8B CB mov ecx, ebx _F000:19EC 66 33 D2 xor edx, edx ; Logical Exclusive OR _F000:19EF 66 0F A4 CA 0A shld edx, ecx, 0Ah ; Double Precision Shift Left _F000:19F4 66 C1 E1 0A shl ecx, 0Ah ; Shift Logical Left _F000:19F8 0B CE or cx, si ; Logical Inclusive OR _F000:19FA E8 72 32 call MSR_write_caller_jmp ; Call Procedure _F000:19FA _F000:19FD 66 50 push eax _F000:19FF E8 BF FF call bits_check ; Call Procedure _F000:19FF _F000:1A02 66 B8 FF FF FF FF mov eax, 0FFFFFFFFh _F000:1A08 66 BA 0F 00 00 00 mov edx, 0Fh _F000:1A0E 80 C1 0A add cl, 0Ah ; Add _F000:1A11 80 F9 20 cmp cl, 32 ; Compare Two Operands _F000:1A14 72 0F jb short set_31_bit ; Jump if Below (CF=1) _F000:1A14 _F000:1A16 66 33 C0 xor eax, eax ; clear eax _F000:1A19 80 E9 20 sub cl, 20h ; ' ' ; Integer Subtraction _F000:1A1C 66 D3 E2 shl edx, cl ; Shift Logical Left _F000:1A1F 66 83 E2 0F and edx, 0Fh ; Logical AND _F000:1A23 EB 03 jmp short enable_MTRR_PhysMask ; Jump _F000:1A23 _F000:1A25 ; --------------------------------------------------------------------------- _F000:1A25 _F000:1A25 set_31_bit: ; CODE XREF: MTRR_set+3Cj _F000:1A25 66 D3 E0 shl eax, cl ; Shift Logical Left _F000:1A25 _F000:1A28 _F000:1A28 enable_MTRR_PhysMask: ; CODE XREF: MTRR_set+4Bj _F000:1A28 66 8B C8 mov ecx, eax _F000:1A2B 81 C9 00 08 or cx, 100000000000b ; set [11] bit _F000:1A2F 66 58 pop eax _F000:1A31 66 40 inc eax ; Increment by 1 _F000:1A33 E8 39 32 call MSR_write_caller_jmp ; Call Procedure _F000:1A33 _F000:1A36 66 8B D3 mov edx, ebx _F000:1A39 E8 85 FF call bits_check ; Call Procedure _F000:1A39 _F000:1A3C 66 BB 01 00 00 00 mov ebx, 1 _F000:1A42 66 D3 E3 shl ebx, cl ; Shift Logical Left _F000:1A45 66 53 push ebx _F000:1A47 66 03 DA add ebx, edx ; Add _F000:1A4A 66 5A pop edx _F000:1A4C 66 2B FA sub edi, edx ; Integer Subtraction _F000:1A4F 66 40 inc eax ; Increment by 1 _F000:1A51 EB 89 jmp short MTRR_set_loop ; Jump _F000:1A51 _F000:1A53 ; --------------------------------------------------------------------------- _F000:1A53 _F000:1A53 return: ; CODE XREF: MTRR_set+Aj _F000:1A53 ; MTRR_set+Fj _F000:1A53 66 5A pop edx _F000:1A55 66 59 pop ecx _F000:1A57 C3 retn ; Return Near from Procedure _F000:1A57 _F000:1A57 MTRR_set endp _F000:1A57
Сброс MTRR
F000:17E6 FF 02 50 02 58 02+MTRR_list struct_MTRR <2FFh, 250h, 258h, 259h, 268h, 269h, 26Ah, 26Bh, 26Ch, \ _F000:17E6 59 02 68 02 69 02+ ; DATA XREF: MTRR_clear+2o _F000:17E6 6A 02 6B 02 6C 02+ 26Dh, 26Eh, 26Fh, 200h, 201h, 202h, 203h, 204h, 205h, \ _F000:17E6 6D 02 6E 02 6F 02+ 206h, 207h, 208h, 209h, 20Ah, 20Bh, 20Ch, 20Dh, 20Eh, \ _F000:17E6 00 02 01 02 02 02+ 20Fh, 404h, 408h, 40Ch, 410h> _F000:1826 _F000:1826 ; =============== S U B R O U T I N E ======================================= _F000:1826 _F000:1826 _F000:1826 MTRR_clear proc near ; CODE XREF: _F000:1871j _F000:1826 B3 20 mov bl, 32 _F000:1828 BE E6 17 mov si, offset MTRR_list _F000:182B 66 33 C0 xor eax, eax ; Logical Exclusive OR _F000:182E 66 33 D2 xor edx, edx ; Logical Exclusive OR _F000:182E _F000:1831 _F000:1831 mtrr_clear_loop: ; CODE XREF: MTRR_clear+17j _F000:1831 66 2E 0F B7 0C movzx ecx, word ptr cs:[si] ; Move with Zero-Extend _F000:1836 0F 30 wrmsr ; Write Machine Status Register _F000:1838 83 C6 02 add si, 2 ; Add _F000:183B FE CB dec bl ; Decrement by 1 _F000:183D 75 F2 jnz short mtrr_clear_loop ; Jump if Not Zero (ZF=0) _F000:183D _F000:183F FF E7 jmp di ; Indirect Near Jump _F000:183F _F000:183F MTRR_clear endp
Отправить комментарий