⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 gpmcpu.inc

📁 AMI 主板的BIOS源码
💻 INC
📖 第 1 页 / 共 4 页
字号:
;---------------------------------------------------------------;

amd_func_00	proc	near
ibm_func_00	proc	near
umc_func_00	proc	near

	call	get_amd_ibm_gen_purpose_reg	;
	clc					; (cy) = 00 for no error
	ret

umc_func_00	endp
ibm_func_00	endp
amd_func_00	endp

;---------------------------------------------------------------;
;			    AMD_FUNC_01				;
;			    IBM_FUNC_01				;
;			    UMC_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 amd/ibm/umc cpu			;
;---------------------------------------------------------------;

amd_func_01	proc	near
ibm_func_01	proc	near
umc_func_01	proc	near

	call	set_amd_ibm_gen_purpose_reg	;
	clc					; (cy) = 00 for no error
	ret

umc_func_01	endp
ibm_func_01	endp
amd_func_01	endp

;---------------------------------------------------------------;
;		GET_AMD_IBM_GEN_PURPOSE_REG			;
;---------------------------------------------------------------;
;	Input : (DS) PM BIOS data segment			;
;	Output: NONE						;
;	Register destroyed : (EAX),(DI),(SI)			;
; NOTE :							;
;	Common routine for amd/ibm/umc cpu			;
;---------------------------------------------------------------;

get_amd_ibm_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:cpu_dump_eax_amd_ibm	; (eax) = on entry (EAX)
	stosd					;
	mov	eax,cs:cpu_dump_ebx_amd_ibm	; (eax) = on entry (EBX)
	stosd					;
	mov	eax,cs:cpu_dump_ecx_amd_ibm	; (eax) = on entry (ECX)
	stosd					;
	mov	eax,cs:cpu_dump_edx_amd_ibm	; (eax) = on entry (EDX)
	stosd					;
	mov	eax,cs:cpu_dump_esi_amd_ibm	; (eax) = on entry (ESI)
	stosd					;
	mov	eax,cs:cpu_dump_edi_amd_ibm	; (eax) = on entry (EDI)
	stosd					;
	mov	eax,cs:cpu_dump_ebp_amd_ibm	; (eax) = on entry (EBP)
	stosd					;
	mov	eax,cs:cpu_dump_eflags_amd_ibm	; (eax) = on entry EFLAG
	stosd					;
	mov	eax,cs:cpu_dump_cr0_amd_ibm	; (eax) = on entry CR0
	stosd					;

	pop	es				;

	ret

get_amd_ibm_gen_purpose_reg	endp

;---------------------------------------------------------------;
;		   SET_AMD_IBM_GEN_PURPOSE_REG			;
;---------------------------------------------------------------;
;	Input : (DS) PM BIOS data segment			;
;	Output: NONE						;
;	Register destroyed : (EAX),(SI)				;
; NOTE :							;
;	Common routine for amd/ibm/umc cpu			;
;---------------------------------------------------------------;

set_amd_ibm_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:cpu_dump_eax_amd_ibm,eax	;
	lodsd					; (eax) = on exit (EBX)
	mov	cs:cpu_dump_ebx_amd_ibm,eax	;
	lodsd					; (eax) = on exit (ECX)
	mov	cs:cpu_dump_ecx_amd_ibm,eax	;
	lodsd					; (eax) = on exit (EDX)
	mov	cs:cpu_dump_edx_amd_ibm,eax	;
	lodsd					; (eax) = on exit (ESI)
	mov	cs:cpu_dump_esi_amd_ibm,eax	;
	lodsd					; (eax) = on exit (EDI)
	mov	cs:cpu_dump_edi_amd_ibm,eax	;
	lodsd					; (eax) = on exit (EBP)
	mov	cs:cpu_dump_ebp_amd_ibm,eax	;
	lodsd					; (eax) = on exit EFLAG
	mov	cs:cpu_dump_eflags_amd_ibm,eax
	ret

set_amd_ibm_gen_purpose_reg	endp

;---------------------------------------------------------------;

amd_ibm_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

amd_ibm_cpu_dummy_smi_support_start	label	byte

;---------------------------------------------------------------;
;	   DUMMY SMI SUPPORT FOR AMD non-PLUS/IBM/UMC CPU	;
;---------------------------------------------------------------;
;			AMD_CPU_SMI_ENTRY_EXT			;
;			IBM_CPU_SMI_ENTRY_EXT			;
;			UMC_CPU_SMI_ENTRY_EXT			;
;---------------------------------------------------------------;
;	Input : NONE						;
;	Output: NONE						;
;	Register destroyed : ALL				;
;---------------------------------------------------------------;

amd_cpu_smi_entry_ext	proc	near
ibm_cpu_smi_entry_ext	proc	near
umc_cpu_smi_entry_ext	proc	near

;---------------------------------------------------------------;
;			AMD_CPU_SMI_EXIT			;
;			IBM_CPU_SMI_EXIT			;
;			UMC_CPU_SMI_EXIT			;
;---------------------------------------------------------------;
;	Input : NONE						;
;	Output: NONE						;
;---------------------------------------------------------------;

amd_cpu_smi_exit	proc	near
ibm_cpu_smi_exit	proc	near
umc_cpu_smi_exit	proc	near

	and	dword ptr cs:cpu_dump_dr6_amd_ibm,0ffffefffh; clear SMMS bit
	and	dword ptr cs:cpu_dump_dr7_amd_ibm,0ffffefffh; clear soft SMI enable (SMIE) bit as AMD CPU always sets this bit while entering SMI

	mov	ax,cs				; (ax) = (cs)
	mov	es,ax				; (es) = SMI segment
	xor	edi,edi				; (edi) = set at beginning of CPU save area
	amd_res3				; RES3 (resume from SMI)

umc_cpu_smi_exit	endp
ibm_cpu_smi_exit	endp
amd_cpu_smi_exit	endp
umc_cpu_smi_entry_ext	endp
ibm_cpu_smi_entry_ext	endp
amd_cpu_smi_entry_ext	endp

;---------------------------------------------------------------;
;			   AMD_FUNC_00				;
;			   IBM_FUNC_00				;
;			   UMC_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 amd/ibm/umc cpu			;
;---------------------------------------------------------------;

amd_func_00	proc	near
ibm_func_00	proc	near
umc_func_00	proc	near

;---------------------------------------------------------------;
;			    AMD_FUNC_01				;
;			    IBM_FUNC_01				;
;			    UMC_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 amd/ibm/umc cpu			;
;---------------------------------------------------------------;

amd_func_01	proc	near
ibm_func_01	proc	near
umc_func_01	proc	near

	stc					; (cy) = 01 for function not supported
	ret

umc_func_01	endp
ibm_func_01	endp
amd_func_01	endp
umc_func_00	endp
ibm_func_00	endp
amd_func_00	endp

;---------------------------------------------------------------;

amd_ibm_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.	**;
;**								**;
;*****************************************************************;
;*****************************************************************;
;---------------------------------------------------------------;
;	  THIS PORTION OF CODE SUPPORTS CYRIX/TI CPU SMI	;
;---------------------------------------------------------------;
;	     Cx486SLCe,Cx486SLC2e,Cx486DLCe,Cx486DLC2e		;
;		Cx486Se,Cx486S2e,Cx486DX,Cx486DX2		;
;		 TI POTOMAC TI486SLCe,TI486SLC2e		;
;		 TI POTOMAC TI486DLCe,TI486DLC2e		;
;		     TI 486SXLCe,TI 486SXLC2e			;
;		      TI 486SXLe,TI 486SXL2e			;
;---------------------------------------------------------------;

IF	CYRIX_TI_SUPPORT

crx_ti_cpu_smi_support_start	label	byte

;---------------------------------------------------------------;
;	       ACTUAL SMI SUPPORT FOR CYRIX/TI CPU		;
;---------------------------------------------------------------;
;		TEMPORARY DESCRIPTOR STRUCTURE			;
;---------------------------------------------------------------;

;struc_temp_desc_crx_ti	struc

seg_limit_low_crx_ti	equ	00h			; 1 word..segment limit (low)
seg_base_low_crx_ti	equ	seg_limit_low_crx_ti+02h; 1 word..segment base (low)
seg_base_middle_crx_ti	equ	seg_base_low_crx_ti+02h ; 1 byte..segment base (middle)
seg_attribute_crx_ti	equ	seg_base_middle_crx_ti+01h; 1 byte..attribute
seg_limit_high_crx_ti	equ	seg_attribute_crx_ti+01h; 1 byte..segment limit (high) & attribute
seg_base_high_crx_ti	equ	seg_limit_high_crx_ti+01h; 1 byte..segment base (high)
seg_selector_crx_ti	equ	seg_base_high_crx_ti+01h; 1 word..segment selector

;struc_temp_desc_crx_ti	ends

;---------------------------------------------------------------;

;temp_desc_crx_ti	struc_temp_desc_crx_ti <0ffffh,0000h,00h,93h,30h,00h,0000h>
						; set for 64KB limit

temp_desc_crx_ti	dw	0ffffh		; segment limit (low)
			dw	00000h		; segment base (low)
			db	000h		; segment base (middle)
			db	093h		; attribute
;			db	030h		; segment limit (high) & attribute
			db	0bfh
			db	000h		; segment base (high)
			dw	00000h		; segment selector

;---------------------------------------------------------------;
;		    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

	cli					; disable interrupts
	cld					; clear direction flag

	mov	cs:temp_cpu_dump_eax_crx_ti,eax	; save (EAX) in temporary dump area
	mov	cs:temp_cpu_dump_ebx_crx_ti,ebx	; save (EBX) in temporary dump area
	mov	cs:temp_cpu_dump_ecx_crx_ti,ecx	; save (ECX) in temporary dump area
	mov	cs:temp_cpu_dump_edx_crx_ti,edx	; save (EDX) in temporary dump area
	mov	cs:temp_cpu_dump_esi_crx_ti,esi	; save (ESI) in temporary dump area
	mov	cs:temp_cpu_dump_edi_crx_ti,edi	; save (EDI) in temporary dump area
	mov	cs:temp_cpu_dump_ebp_crx_ti,ebp	; save (EBP) in temporary dump area
	mov	cs:temp_cpu_dump_esp_crx_ti,esp	; save (ESP) in temporary dump area

	ds_svdc_cseg	temp_cpu_dump_ds_desc_low_crx_ti ; save (DS & DS DESCRIPTOR) in temporary dump area
	es_svdc_cseg	temp_cpu_dump_es_desc_low_crx_ti ; save (ES & ES DESCRIPTOR) in temporary dump area
	ss_svdc_cseg	temp_cpu_dump_ss_desc_low_crx_ti ; save (SS & SS DESCRIPTOR) in temporary dump area

	sgdt	fword ptr cs:temp_cpu_dump_gdt_desc_low_crx_ti ; save (GDT) descriptor temporarily
	sidt	fword ptr cs:temp_cpu_dump_idt_desc_low_crx_ti ; save (IDT) descriptor temporarily

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -