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

📄 getpro~1.s

📁 操作系统源代码
💻 S
字号:
!	getprocessor() - determine processor type	Author: Kees J. Bot!								26 Jan 1994.sect .text; .sect .rom; .sect .data; .sect .bss.sect .text! int getprocessor(void);!	Return 386, 486, 586, ....define	_getprocessor_getprocessor:	push	ebp	mov	ebp, esp	and	esp, 0xFFFFFFFC	! Align stack to avoid AC fault	mov	ecx, 0x00040000	! Try to flip the AC bit introduced on the 486	call	flip	mov	eax, 386	! 386 if it didn't react to "flipping"	jz	gotprocessor	mov	ecx, 0x00200000	! Try to flip the ID bit introduced on the 586	call	flip	mov	eax, 486	! 486 if it didn't react	jz	gotprocessor	pushf	pusha			! Save the world	mov	eax, 1	.data1	0x0F, 0xA2	! CPUID instruction tells the processor type	andb	ah, 0x0F	! Extract the family (5, 6, ...)	movzxb	eax, ah	imul	eax, 100	! 500, 600, ...	add	eax, 86		! 586, 686, ...	mov	7*4(esp), eax	! Pass eax through	popa	popfgotprocessor:	leave	retflip:	pushf			! Push eflags	pop	eax		! eax = eflags	mov	edx, eax	! Save original eflags	xor	eax, ecx	! Flip the bit to test	push	eax		! Push modified eflags value	popf			! Load modified eflags register	pushf	pop	eax		! Get it again	push	edx	popf			! Restore original eflags register	xor	eax, edx	! See if the bit changed	test	eax, ecx	ret

⌨️ 快捷键说明

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