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

📄 pidt.inc

📁 <BIOS研发技术剖析>书的源代码,包括完整的BIOS汇编语言源程序.
💻 INC
字号:
;-----------------------------------------------------------------------------;
;
; IDT POST routines
;
;-----------------------------------------------------------------------------;
; IDT P-Rating
;-----------------------------------------------------------------------------;
; Input:
;	DX	0
; Output:
;	DL	bit 0 = 1 Clock is PRxxx
;		bit 1 = 1 Append Clock to CPU string
;		bit 2 = 1 Don't display clock at checkpoint AA
;	DS:SI	offset of prating table if DL.3=0
;		bit 3 = 1 Get prating value directly from DS:SI
;	DH	ASCII charactor to be append
;		0 = nothing appended
;	CY	no prating
;-----------------------------------------------------------------------------;

idt_struct	struct
	clock		word	?
	multiplier	byte	?
	pr_clock	word	?
idt_struct	ends

idt_2x		equ	08h
idt_233x	equ	15h
idt_25x		equ	0ch
idt_266x	equ	19h
idt_3x		equ	10h
idt_333x	equ	21h
idt_35x		equ	14h
idt_4x		equ	18h
idt_45x		equ	1ch
idt_5x		equ	20h

if (CPU_586)
winchip_2a_pr_tbl:
	idt_struct	{ 200,idt_3x,	200  }
	idt_struct	{ 200,idt_2x,	233  }
	idt_struct	{ 208,idt_25x,	233  }
	idt_struct	{ 233,idt_35x,	233  }
	idt_struct	{ 233,idt_233x,	266  }
	idt_struct	{ 250,idt_3x,	266  }
	idt_struct	{ 250,idt_25x,	300  }
	idt_struct	{ 266,idt_4x,	266  }
	idt_struct	{ 266,idt_266x,	300  }
	dw	00

winchip_3_pr_tbl:
	idt_struct	{ 200,idt_3x,	233  }
	idt_struct	{ 233,idt_35x,	266  }
	idt_struct	{ 233,idt_233x,	300  }
	idt_struct	{ 250,idt_25x,	333  }	; (CPU0042+)
	idt_struct	{ 266,idt_4x,	300  }
	idt_struct	{ 266,idt_266x,	333  }
	idt_struct	{ 285,idt_3x,	350  }
	idt_struct	{ 300,idt_45x,	333  }
	idt_struct	{ 300,idt_3x,	366  }
	idt_struct	{ 316,idt_333x,	380  }
	idt_struct	{ 333,idt_5x,	366  }
	idt_struct	{ 333,idt_333x,	400  }
	dw	00
endif;	if (CPU_586)

idt_prating	proc
	push	cs
	pop	ds			; ds = cs
	mov	si,offset winchip_2a_pr_tbl
	call	check_winchip2ab
	jnc	check_prating
	mov	si,offset winchip_3_pr_tbl
	mov	ax,word ptr cpu_resetid
	and	al,0f0h			; keep model number
	cmp	al,090h			; WinChip 3 ?
	jne	ip_no_pr		; no..
check_prating:
;	mov	ecx,10ah		; FCR4
;	RD_MSR				; edx:eax = value returned
;	and	al,00111111b		; keep bit 5:0
	mov	ecx,147h		; FCR4 workaround in MSR 147h
	RD_MSR
	shr	eax,23-2		; [26:23] = FCR4[5:2]
	and	al,00111100b		; keep bit [5:2]
	push	ax
	mov	ecx,10ah		; FCR4
	RD_MSR				; edx:eax = value returned
	and	al,00000011b		; keep bit 1:0
	pop	bx			; restore [5:2] in BL
	or	al,bl
	mov	bx,word ptr cpu_freq
cmp_next:
	cmp	bx,(idt_struct ptr [si]).clock; clock match ?
	jne	next_entry		; no..
	cmp	al,(idt_struct ptr [si]).multiplier; multiplier match ?
	jne	next_entry		; no..
	add	si,idt_struct.pr_clock	; point to pr_clock
ip_done:
	or	dl,00001110b		; append to CPU string and do not display actual clock, DS:SI = prating value
	clc
	jmp	short ip_exit
next_entry:
	add	si,sizeof idt_struct
	cmp     (idt_struct ptr [si]).clock,0; end of table ?
	jne	cmp_next		; not yet..
	mov	si,offset cgroup:word ptr cpu_freq; DS:SI = pointed to detected CPU frequency
	or	dl,08h			; bit3=1, get prating value directly from DS:SI
	jmp	short ip_done		; if not found, get actual clock as prating
ip_no_pr:
	stc
ip_exit:
	ret
idt_prating	endp



;

⌨️ 快捷键说明

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