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

📄 mmupro32alib.s

📁 vxworks源码源码解读是学习vxworks的最佳途径
💻 S
字号:
/* mmuPro32ALib.s - mmu library for PentiumPro/II *//* Copyright 1984-1998 Wind River Systems, Inc. */#include "copyright_wrs.h"/*modification history--------------------01e,17sep98,hdn  renamed mmuEnabled to mmuPro32Enabled.01d,21apr98,hdn  updated a comment in the header.01c,13apr98,hdn  added support for PentiumPro's 32bit MMU.01b,02nov94,hdn  added a support for PCD and PWT bit for 486 and Pentium01a,26jul93,hdn  written.*//**/#define _ASMLANGUAGE#include "vxWorks.h"#include "asm.h"#include "regs.h"	/* exports */	.globl	_mmuPro32Enable	.globl	_mmuPro32On	.globl	_mmuPro32Off	.globl	_mmuPro32PdbrSet	.globl	_mmuPro32PdbrGet	.globl	_mmuPro32TLBFlush	/* imports */	.globl	_mmuPro32Enabled	.globl	_sysProcessor	.text	.align 4 /******************************************************************************** mmuEnable - turn mmu on or off** RETURNS: OK* STATUS mmuEnable *    (*    BOOL enable		/@ TRUE to enable, FALSE to disable MMU @/*    )*/_mmuPro32Enable:	cli				/* LOCK INTERRUPT */	movl	4(%esp),%edx        movl    %cr0,%eax        movl    %edx,_mmuPro32Enabled	cmpl	$0,%edx	je	mmuPro32Disable	orl     $0x80010000,%eax	/* set PG and WP */	jmp     mmuPro32Enable0mmuPro32Disable:	andl    $0x7ffeffff,%eax	/* clear PG and WP */mmuPro32Enable0:	movl    %eax,%cr0	jmp     mmuPro32Enable1		/* flush prefetch queue */mmuPro32Enable1:	movl	$0,%eax	sti				/* UNLOCK INTERRUPT */	ret/******************************************************************************** mmuOn - turn MMU on ** This routine assumes that interrupts are locked out.  It is called internally* to enable the mmu after it has been disabled for a short period of time* to access internal data structs.** NOMANUAL* void mmuOn (void)*/	.align 4_mmuPro32On:        movl    %cr0,%eax	orl     $0x80010000,%eax	/* set PG and WP */	movl    %eax,%cr0	jmp     mmuPro32On0		/* flush prefetch queue */mmuPro32On0:	ret/******************************************************************************** mmuOff - turn MMU off ** This routine assumes that interrupts are locked out.  It is called internally* to disable the mmu for a short period of time* to access internal data structs.** NOMANUAL* void mmuOff (void)*/	.align 4_mmuPro32Off:	movl    %cr0,%eax	andl    $0x7ffeffff,%eax	/* clear PG and WP */	movl    %eax,%cr0	jmp     mmuPro32Off0			/* flush prefetch queue */mmuPro32Off0:	ret/********************************************************************************* mmuPdbrSet - Set Page Directory Base Register** This routine Set Page Directory Base Register.** NOMANUAL* void mmuPdbrSet *	(*	void *transTbl;*	) */	.align 4_mmuPro32PdbrSet:	cli				/* LOCK INTERRUPT */	movl	4(%esp),%eax	movl	(%eax),%eax	movl	%cr3,%edx	movl	$0xfffff000,%ecx	/* upper 20 bits */	andl	$0x00000fff,%edx	cmpl	$ X86CPU_386,_sysProcessor	je	mmuPro32PdbrSet1	movl	$0xffffffe0,%ecx	/* upper 27 bits */	andl	$0x00000007,%edx	/* PCD=0 PWT=0 */mmuPro32PdbrSet1:	andl	%ecx,%eax	orl	%edx,%eax	movl	%eax,%cr3	jmp	mmuPro32PdbrSet0		/* flush prefetch queue */mmuPro32PdbrSet0:	sti				/* UNLOCK INTERRUPT */	ret/********************************************************************************* mmuPdbrGet - Get Page Directory Base Register** This routine Get Page Directory Base Register.** NOMANUAL* MMU_TRANS_TBL *mmuPdbrGet (void) */	.align 4_mmuPro32PdbrGet:	cli				/* LOCK INTERRUPT */	movl	%cr3,%eax	movl	$0xfffff000,%edx	/* upper 20 bits */	cmpl	$ X86CPU_386,_sysProcessor	je	mmuPro32PdbrGet1	movl	$0xffffffe0,%edx	/* upper 27 bits */mmuPro32PdbrGet1:	andl	%edx,%eax	jmp	mmuPro32PdbrGet0		/* flush prefetch queue */mmuPro32PdbrGet0:	sti				/* UNLOCK INTERRUPT */	ret/******************************************************************************** mmuTLBFlush - flush the Translation Lookaside Buffer.** NOMANUAL* void mmuTLBFlush (void)*/	.align 4_mmuPro32TLBFlush:	cli				/* LOCK INTERRUPT */	movl	%cr3,%eax	movl	%eax,%cr3	jmp	mmuPro32TLBFlush0		/* flush prefetch queue */mmuPro32TLBFlush0:	sti				/* UNLOCK INTERRUPT */	ret

⌨️ 快捷键说明

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