📄 gpmcpu.inc
字号:
;-----------------------------------------------;
mov ax,cs ; (ax) = data segment for SMI execution
;-----------------------------------------------;
mov di,(offset cgroup:temp_desc_crx_ti - offset cgroup:smi_code_begin + orgbase); (di) = temporary descriptor
movzx eax,ax ; (eax) = PM BIOS data segment
mov cgroup:[di+seg_selector_crx_ti],ax; set selector
shl eax,4 ; (eax) = PM BIOS data segment (absolute)
mov cgroup:[di+seg_base_low_crx_ti],ax; set segment base (low)
shr eax,16 ;
mov cgroup:[di+seg_base_middle_crx_ti],al; set segment base (middle)
;-----------------------------------------------;
temp_desc_crx_ti_relocate equ temp_desc_crx_ti - smi_code_begin + orgbase
ds_rsdc_cseg temp_desc_crx_ti_relocate; set (DS) as PM BIOS data segment
es_rsdc_cseg temp_desc_crx_ti_relocate; set (ES) as PM BIOS data segment
ss_rsdc_cseg temp_desc_crx_ti_relocate; set (SS) as PM BIOS data segment
;-----------------------------------------------;
mov ax,cs ; (ax) = PM BIOS data segment
mov ds,ax ; set (DS) as PM BIOS data segment
mov es,ax ; set (ES) as PM BIOS data segment
mov ss,ax ; set (SS) as PM BIOS data segment
mov sp,pm_bios_global_stack_ptr ; set (SP) for GLOBAL stack pointer
mov word ptr ds:cpu_vendor,cyrix_cpu_bit or ti_cpu_bit; set for CYRIX CPU/TI CPU
;-----------------------------------------------;
mov dword ptr ds:smi_idt_descriptor,000003ffh
mov dword ptr ds:smi_idt_descriptor+4,00000000h
lidt fword ptr ds:smi_idt_descriptor ;
;-----------------------------------------------;
call actual_smi_handler ; handle the SMI source
;---------------------------------------------------------------;
; CRX_CPU_SMI_EXIT ;
; TI_CPU_SMI_EXIT ;
;---------------------------------------------------------------;
; Input : NONE ;
; Output: NONE ;
;---------------------------------------------------------------;
crx_cpu_smi_exit proc near
ti_cpu_smi_exit proc near
mov eax,cs:temp_cpu_dump_eax_crx_ti ; restore (EAX)
mov ebx,cs:temp_cpu_dump_ebx_crx_ti ; restore (EBX)
mov ecx,cs:temp_cpu_dump_ecx_crx_ti ; restore (ECX)
mov edx,cs:temp_cpu_dump_edx_crx_ti ; restore (EDX)
mov esi,cs:temp_cpu_dump_esi_crx_ti ; restore (ESI)
mov edi,cs:temp_cpu_dump_edi_crx_ti ; restore (EDI)
mov ebp,cs:temp_cpu_dump_ebp_crx_ti ; restore (EBP)
mov esp,cs:temp_cpu_dump_esp_crx_ti ; restore (ESP)
ds_rsdc_cseg temp_cpu_dump_ds_desc_low_crx_ti ; restore (DS & DS DESCRIPTOR) from temporary dump area
es_rsdc_cseg temp_cpu_dump_es_desc_low_crx_ti ; restore (ES & ES DESCRIPTOR) from temporary dump area
ss_rsdc_cseg temp_cpu_dump_ss_desc_low_crx_ti ; restore (SS & SS DESCRIPTOR) from temporary dump area
db 066h ; USE 32 BIT OPERAND for LGDT
lgdt fword ptr cs:temp_cpu_dump_gdt_desc_low_crx_ti ; restore (GDT) descriptor temporarily
db 066h ; USE 32 BIT OPERAND for LIDT
lidt fword ptr cs:temp_cpu_dump_idt_desc_low_crx_ti ; restore (IDT) descriptor temporarily
;-----------------------------------------------;
crx_rsm ; RSM (resume from SMI)
ti_cpu_smi_exit endp
crx_cpu_smi_exit endp
ti_cpu_smi_entry_ext endp
crx_cpu_smi_entry_ext endp
;---------------------------------------------------------------;
; CRX_FUNC_00 ;
; TI_FUNC_00 ;
;---------------------------------------------------------------;
; Input : (DS) PM BIOS data segment ;
; Output: (CY) 00 for no error ;
; (CY) 01 for CPU not supported ;
; Register destroyed : (EAX),(DI) ;
; NOTE : ;
; Sets up cpu_gen_purpose_reg_entry with on entry smi ;
; values from cpu dump area for (EAX),(EBX),(ECX),(EDX), ;
; (ESI),(EDI),(EBP) & (EFLAGS) ;
; NOTE : ;
; Common routine for cyrix/ti cpu ;
;---------------------------------------------------------------;
crx_func_00 proc near
ti_func_00 proc near
call get_crx_ti_gen_purpose_reg ;
clc ; (cy) = 00 for no error
ret
ti_func_00 endp
crx_func_00 endp
;---------------------------------------------------------------;
; CRX_FUNC_01 ;
; TI_FUNC_01 ;
;---------------------------------------------------------------;
; Input : (DS) PM BIOS data segment ;
; Output: (CY) 00 for no error ;
; (CY) 01 for CPU not supported ;
; Register destroyed : (EAX),(SI) ;
; NOTE : ;
; Sets up cpu dump area for (EAX),(EBX),(ECX),(EDX),(ESI),;
; (EDI),(EBP),(EFLAGS) with on exit smi values from cpu_ ;
; gen_purpose_reg_entry ;
; NOTE : ;
; Common routine for cyrix/ti cpu ;
;---------------------------------------------------------------;
crx_func_01 proc near
ti_func_01 proc near
call set_crx_ti_gen_purpose_reg ;
clc ; (cy) = 00 for no error
ret
ti_func_01 endp
crx_func_01 endp
;---------------------------------------------------------------;
; GET_CRX_TI_GEN_PURPOSE_REG ;
; Input : (DS) PM BIOS data segment ;
; Output: NONE ;
; Register destroyed : (EAX),(DI) ;
; NOTE : ;
; Common routine for cyrix/ti cpu ;
;---------------------------------------------------------------;
get_crx_ti_gen_purpose_reg proc near
mov di,cpu_gen_purpose_reg_entry ; (di) = pointer to on entry general purpose reg values structure
push es ;
push ds ;
pop es ; (ds) = (es)
mov eax,cs:temp_cpu_dump_eax_crx_ti ; (eax) = on entry (EAX)
stosd ;
mov eax,cs:temp_cpu_dump_ebx_crx_ti ; (eax) = on entry (EBX)
stosd ;
mov eax,cs:temp_cpu_dump_ecx_crx_ti ; (eax) = on entry (ECX)
stosd ;
mov eax,cs:temp_cpu_dump_edx_crx_ti ; (eax) = on entry (EDX)
stosd ;
mov eax,cs:temp_cpu_dump_esi_crx_ti ; (eax) = on entry (ESI)
stosd ;
mov eax,cs:temp_cpu_dump_edi_crx_ti ; (eax) = on entry (EDI)
stosd ;
mov eax,cs:temp_cpu_dump_ebp_crx_ti ; (eax) = on entry (EBP)
stosd ;
mov eax,cs:cpu_dump_eflags_crx_ti ; (eax) = on entry EFLAG
stosd ;
mov eax,cs:cpu_dump_cr0_crx_ti ; (eax) = on entry CR0
stosd ;
pop es ;
ret
get_crx_ti_gen_purpose_reg endp
;---------------------------------------------------------------;
; SET_CRX_TI_GEN_PURPOSE_REG ;
;---------------------------------------------------------------;
; Input : (DS) PM BIOS data segment ;
; Output: NONE ;
; Register destroyed : (EAX),(SI) ;
; NOTE : ;
; Common routine for cyrix/ti cpu ;
;---------------------------------------------------------------;
set_crx_ti_gen_purpose_reg proc near
mov si,cpu_gen_purpose_reg_entry ; (di) = pointer to reg values structure on exit
lodsd ; (eax) = on exit (EAX)
mov cs:temp_cpu_dump_eax_crx_ti,eax ; save temporarily in dump area
lodsd ; (eax) = on exit (EBX)
mov cs:temp_cpu_dump_ebx_crx_ti,eax ; save temporarily in dump area
lodsd ; (eax) = on exit (ECX)
mov cs:temp_cpu_dump_ecx_crx_ti,eax ; save temporarily in dump area
lodsd ; (eax) = on exit (EDX)
mov cs:temp_cpu_dump_edx_crx_ti,eax ; save temporarily in dump area
lodsd ; (eax) = on exit (ESI)
mov cs:temp_cpu_dump_esi_crx_ti,eax ; save temporarily in dump area
lodsd ; (eax) = on exit (EDI)
mov cs:temp_cpu_dump_edi_crx_ti,eax ; save temporarily in dump area
lodsd ; (eax) = on exit (EBP)
mov cs:temp_cpu_dump_ebp_crx_ti,eax ; save temporarily in dump area
lodsd ; (eax) = on exit EFLAG
mov cs:cpu_dump_eflags_crx_ti,eax ;
ret
set_crx_ti_gen_purpose_reg endp
;---------------------------------------------------------------;
crx_ti_cpu_smi_support_end label byte
;---------------------------------------------------------------;
;*****************************************************************;
;*****************************************************************;
;** **;
;** (C)Copyright 1985-1996, American Megatrends Inc. **;
;** **;
;** All Rights Reserved. **;
;** **;
;** 6145-F, Northbelt Parkway, Norcross, **;
;** **;
;** Georgia - 30071, USA. Phone-(770)-246-8600. **;
;** **;
;*****************************************************************;
;*****************************************************************;
;---------------------------------------------------------------;
ELSE
crx_ti_cpu_dummy_smi_support_start label byte
;---------------------------------------------------------------;
; DUMMY SMI SUPPORT FOR CYRIX/TI CPU ;
;---------------------------------------------------------------;
; CRX_CPU_SMI_ENTRY_EXT ;
; TI_CPU_SMI_ENTRY_EXT ;
;---------------------------------------------------------------;
; Input : NONE ;
; Output: NONE ;
; Register destroyed : ALL ;
;---------------------------------------------------------------;
crx_cpu_smi_entry_ext proc near
ti_cpu_smi_entry_ext proc near
;---------------------------------------------------------------;
; CRX_CPU_SMI_EXIT ;
; TI_CPU_SMI_EXIT ;
;---------------------------------------------------------------;
; Input : NONE ;
; Output: NONE ;
;---------------------------------------------------------------;
crx_cpu_smi_exit proc near
ti_cpu_smi_exit proc near
crx_rsm ; RSM (resume from SMI)
ti_cpu_smi_exit endp
crx_cpu_smi_exit endp
ti_cpu_smi_entry_ext endp
crx_cpu_smi_entry_ext endp
;---------------------------------------------------------------;
; CRX_FUNC_00 ;
; TI_FUNC_00 ;
;---------------------------------------------------------------;
; Input : (DS) PM BIOS data segment ;
; Output: (CY) 00 for no error ;
; (CY) 01 for CPU not supported ;
; Register destroyed : (EAX),(DI),(SI) ;
; NOTE : ;
; Sets up cpu_gen_purpose_reg_entry with on entry smi ;
; values from cpu dump area for (EAX),(EBX),(ECX),(EDX), ;
; (ESI),(EDI),(EBP) & (EFLAGS) ;
; NOTE : ;
; Common routine for cyrix/ti cpu ;
;---------------------------------------------------------------;
crx_func_00 proc near
ti_func_00 proc near
;---------------------------------------------------------------;
; CRX_FUNC_01 ;
; TI_FUNC_01 ;
;---------------------------------------------------------------;
; Input : (DS) PM BIOS data segment ;
; Output: (CY) 00 for no error ;
; (CY) 01 for CPU not supported ;
; Register destroyed : (EAX),(DI) ;
; NOTE : ;
; Sets up cpu dump area for (EAX),(EBX),(ECX),(EDX),(ESI),;
; (EDI),(EBP),(EFLAGS) with on exit smi values from cpu_ ;
; gen_purpose_reg_entry ;
; NOTE : ;
; Common routine for cyrix/ti cpu ;
;---------------------------------------------------------------;
crx_func_01 proc near
ti_func_01 proc near
stc ; (cy) = 01 for function not supported
ret
ti_func_01 endp
crx_func_01 endp
ti_func_00 endp
crx_func_00 endp
;---------------------------------------------------------------;
crx_ti_cpu_dummy_smi_support_end label byte
ENDIF
;---------------------------------------------------------------;
;*****************************************************************;
;*****************************************************************;
;** **;
;** (C)Copyright 1985-1996, American Megatrends Inc. **;
;** **;
;** All Rights Reserved. **;
;** **;
;** 6145-F, Northbelt Parkway, Norcross, **;
;** **;
;** Georgia - 30071, USA. Phone-(770)-246-8600. **;
;** **;
;*****************************************************************;
;*****************************************************************;
;---------------------------------------------------------------;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -