Один из вариантов SMI-обработчика.
SMI:0000 ; =========================================================================== SMI:0000 SMI:0000 ; Segment type: Pure code SMI:0000 SMI segment byte public 'CODE' use16 SMI:0000 assume cs:SMI SMI:0000 assume es:nothing, ss:nothing, ds:nothing, fs:nothing, gs:nothing SMI:0000 SMI_GDT dw 97h ; LIMIT SMI:0002 dw offset GDT0 SMI:0004 dw 0 SMI:0006 ; align SMI:0008 GDT0 DESCRIPTOR <0> ; DATA XREF: SMI:0002 SMI:0010 SMI:0010 DESCRIPTOR <0FFFFh, 0, 0DAh, 9Ah, 0, 0FEh> ; FEDA000:0, code_seg SMI:0018 DEF_desc_smi DESCRIPTOR <0FFFFh, 0, 0DAh, 92h, 0, 0FEh> SMI:0018 ; DATA XREF: sub_A2F26+4 SMI:0018 ; SMI_Handler:next ... SMI:0018 ; FEDA000:0 SMI:0020 stru_A0020 DESCRIPTOR <0FFFFh, 0, 0DAh, 92h, 0, 0FEh> ; DATA XREF: sub_AA7C6 SMI:0020 ; FEDA000:0 SMI:0028 SMI:0028 all_mem_seg DESCRIPTOR <0FFFFh, 0, 0, 92h, 0CFh, 0> SMI:0028 ; DATA XREF: TurnOff_Power+75 SMI:0028 ; Trap_Handler+5 ... SMI:0028 ; 0:0 SMI:0030 DESCRIPTOR <0FFFFh, 0, 0, 92h, 0, 0> ; 0:0 SMI:0038 DESCRIPTOR < 4FFh, 0, 0, 92h, 0, 0> ; 0:0 - 0:500 SMI:0040 SMI:0040 BDA_seg DESCRIPTOR < 0FFh, 400h, 0, 92h, 0, 0> SMI:0040 ; DATA XREF: USB_SMI+1B1 SMI:0040 ; 40:0 - 40:FF SMI:0048 SMI:0048 DESCRIPTOR <0FFFFh, 0, 0Eh, 9Ah, 0, 0> ; E000:0, code_seg SMI:0050 DESCRIPTOR <0FFFFh, 0, 0Eh, 92h, 0, 0> ; E000:0 SMI:0058 DESCRIPTOR <0FFFFh, 0, 0Bh, 92h, 0, 0> ; B000:0 SMI:0060 F000_seg_CODE DESCRIPTOR <0FFFFh, 0, 0Fh, 9Ah, 0, 0> SMI:0060 ; DATA XREF: Software_SMI_Handler+98 SMI:0060 ; Enable_PME_Event+26 ... SMI:0060 ; F000:0, code_seg SMI:0068 F000_seg DESCRIPTOR <0FFFFh, 0, 0Fh, 92h, 0, 0> SMI:0068 ; DATA XREF: Check_USB_Disabled+1 SMI:0068 ; Get_USBRAM_+1 ... SMI:0068 ; F000:0 SMI:0070 PM_RAM_seg DESCRIPTOR < 90h, 0DF70h, 0Fh, 92h, 0, 0> SMI:0070 ; DATA XREF: SMI_Handler+61 SMI:0070 ; SMI_Load_Timer+3 ... SMI:0070 ; F000:DF70 SMI:0078 SS_GDT_SMI DESCRIPTOR <0FFFFh, 0, 0Ah, 92h, 0, 0> SMI:0078 ; DATA XREF: SMI_Handler+4E SMI:0078 ; A000:0 SMI:0080 USB_RAM DESCRIPTOR < 7000h, 8000h, 0Ch, 92h, 0, 0> SMI:0080 ; DATA XREF: Get_USBRAM SMI:0080 ; C800:0 SMI:0088 stru_A0088 DESCRIPTOR <0FFFFh, 8000h, 0Ah, 92h, 0, 0> SMI:0088 ; DATA XREF: SMI:stru_A8FB3 SMI:0088 ; FlashSMI+3B ... SMI:0088 ; A800:0 SMI:0090 stru_A0090 DESCRIPTOR <0FFFFh, 9000h, 0Ah, 92h, 0, 0> SMI:0090 ; DATA XREF: SMI:8FB7 SMI:0090 ; FlashSMI+44 ... SMI:0090 ; A900:0 SMI:0098 stru_A0098 DESCRIPTOR <0FFFFh, 0A000h, 0Ah, 92h, 0, 0> SMI:0098 ; DATA XREF: SMI:8FBB SMI:0098 ; FlashSMI+4D ... SMI:0098 ; AA00:0 ... SMI:8000 ; --------------- S U B R O U T I N E --------------------------------------- SMI:8000 SMI:8000 SMI:8000 SMI_Handler proc near SMI:8000 mov al, 0C0h ; 'L' SMI:8002 out 70h, al ; CMOS Memory: SMI:8002 ; SMI:8004 out 0EBh, al SMI:8006 in al, 71h ; CMOS Memory SMI:8008 and al, 2 SMI:800A jnz short loc_A800E SMI:800C wbinvd SMI:800E SMI:800E loc_A800E: ; CODE XREF: SMI_Handler+A SMI:800E mov al, 0A5h ; 'a' SMI:8010 out 0B3h, al ; Interrupt Controller #2, 8259A SMI:8012 mov ax, 0F000h SMI:8015 mov es, ax SMI:8017 assume es:nothing SMI:8017 mov si, offset REAL_IDT_LOC SMI:801A lidt qword ptr es:[si] SMI:801E xor ax, ax SMI:8020 mov ds, ax SMI:8022 mov ebx, 0 SMI:8028 db 66h SMI:8028 lgdt qword ptr cs:[ebx] SMI:802E mov eax, cr0 SMI:8031 and eax, 9FFFFFFFh SMI:8037 or eax, 1 SMI:803B mov cr0, eax SMI:803B ; --------------------------------------------------------------------------- SMI:803E SMI_seg <0EAh, offset next, 8> ; SMI_GDT SMI:8043 ; --------------------------------------------------------------------------- SMI:8043 SMI:8043 next: ; DATA XREF: SMI_Handler+3E SMI:8043 mov ax, (offset DEF_desc_smi-8) ; SMI_GDT SMI:8046 mov ds, ax SMI:8048 assume ds:nothing SMI:8048 mov es, ax SMI:804A assume es:nothing SMI:804A mov fs, ax SMI:804C assume fs:nothing SMI:804C mov gs, ax SMI:804E assume gs:nothing SMI:804E mov ax, (offset SS_GDT_SMI-8) ; A000:0 SMI:8051 mov ss, ax SMI:8053 assume ss:nothing SMI:8053 mov esp, offset unk_AF800 ; Stack_SMI__ESP SMI:8059 pushad SMI:805B push ds SMI:805C push es SMI:805D push fs SMI:805F push gs SMI:8061 mov ax, (offset PM_RAM_seg-8) ; F000:DF70 SMI:8064 mov ds, ax SMI:8066 assume ds:nothing SMI:8066 cmp byte ptr ds:1Dh, 41h ; 'A' ; Software_SMI_Type: SMI:8066 ; SMI_0V_Resume EQU 5 ;Resume From 0V SMI:8066 ; SMI_BIOS_RSM EQU 6 ;Made real mode RSM SMI:8066 ; SMI_5V_Resume EQU 7 ;R23 SMI:8066 ; SMI_S4_Resume EQU 8 ;R36 SMI:8066 ; DISABLE_RESUME_RING EQU 10h SMI:8066 ; ENABLE_RESUME_RING EQU 11h SMI:8066 ; DISABLE_TIMER_REQ EQU 12h SMI:8066 ; ENABLE_TIMER_REQ EQU 13h SMI:8066 ; RESTORE_POWERON_D4_REQ EQU 14h SMI:8066 ; DISABLE_PM_REQ EQU 15h SMI:8066 ; ENABLE_PM_REQ EQU 16h SMI:8066 ; CRT_OFF_REQ EQU 17h SMI:8066 ; CRT_ON_REQ EQU 18h SMI:8066 ; DISABLE_RESUME_TIMER_REQ EQU 19h SMI:8066 ; ENABLE_RESUME_TIMER_REQ EQU 1Ah SMI:8066 ; SMI_SMB EQU 20h ; handle smart bus command SMI:8066 ; SMI:8066 ; SMI_FlashRead EQU 28h SMI:8066 ; ... SMI:8066 ; SMI_Auto_Flash EQU 2Fh SMI:8066 ; SMI:8066 ; APM_SMI EQU 30h SMI:8066 ; S2_RESTORE_REQ EQU 40h SMI:8066 ; S3_RESTORE_REQ EQU 41h SMI:806B jz short S3_RESTORE SMI:806D mov dx, 0CF8h SMI:8070 in eax, dx SMI:8072 push eax SMI:8074 push dx SMI:8075 call USB_SMI SMI:8078 pop dx SMI:8079 pop eax SMI:807B out dx, eax SMI:807D SMI:807D S3_RESTORE: ; CODE XREF: SMI_Handler+6B SMI:807D pop gs SMI:807F assume gs:nothing SMI:807F pop fs SMI:8081 assume fs:nothing SMI:8081 pop es SMI:8082 assume es:nothing SMI:8082 pop ds SMI:8083 assume ds:nothing SMI:8083 popad SMI:8085 mov dx, 0CF8h SMI:8088 in eax, dx SMI:808A push eax SMI:808C push dx SMI:808D call Shadow_WE__mb SMI:8090 call Run_Handler SMI:8093 call Shadow_RO__mb SMI:8096 pop dx SMI:8097 pop eax SMI:8099 out dx, eax SMI:809B call sub_AA01C SMI:809E mov ax, (offset DEF_desc_smi-8) ; FEDA000:0 SMI:80A1 mov ds, ax SMI:80A3 assume ds:nothing SMI:80A3 call nullsub_52 SMI:80A6 mov al, 0C0h ; 'L' SMI:80A8 out 70h, al ; CMOS Memory: SMI:80A8 ; SMI:80AA out 0EBh, al SMI:80AC in al, 71h ; CMOS Memory SMI:80AE and al, 2 SMI:80B0 jnz short exit SMI:80B2 wbinvd SMI:80B4 SMI:80B4 exit: ; CODE XREF: SMI_Handler+B0 SMI:80B4 rsm SMI:80B4 SMI_Handler endp
Отправить комментарий