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

📄 pagetabl.asm

📁 Windows 95 系統程式設計大奧秘书籍源码
💻 ASM
字号:
;==================================
; WIN95UNI - Matt Pietrek 1995
; FILE: WIN95UNI.C
;==================================

.386
.model small

.code

public __GetPhysicalAddrFromLinear

__GetPhysicalAddrFromLinear proc
    push    ebp
    mov     ebp, esp

	mov		eax, [ebp+0Ch]

	shr		eax,22
	test	DWORD PTR [0FFBFE000h + eax*4], 1		;; Verify that the Page
	jz		fail									;; Directory is OK

	mov		eax,[ebp+0Ch]
	mov		ebx, eax
	shr		eax,12
	mov		eax, DWORD PTR [0FF800000h + eax * 4]	;; Get Page Table entry
	test	eax,1									;; is it present?
	jz		fail

	and		EAX, 0FFFFF000h			;; Get physical page
	and		ebx, 000000FFFh			;; combine with low order 12 bytes of
	or		eax, ebx				;; the linear address
	jmp		done

fail:
	mov		eax, -1

done:
    pop     ebp

	retf 4		;; NOTE! This is a 16:32 RETF, since we're in a 32 bit seg
__GetPhysicalAddrFromLinear endp

public __GetPageAttributes

__GetPageAttributes proc
    push    ebp
    mov     ebp, esp

	mov		eax, [ebp+0Ch]

	shr		eax,22
	test	DWORD PTR [0FFBFE000h + eax*4], 1		;; Verify that the Page
	jz		fail									;; Directory is OK

	mov		eax,[ebp+0Ch]
	mov		ebx, eax
	shr		eax,12
	mov		eax, DWORD PTR [0FF800000h + eax * 4]	;; Get Page Table entry
	test	eax,1									;; is it present?
	jz		fail

	and		eax, 000000FFFh
	jmp		done

fail:
	mov		eax, -1

done:
    pop     ebp

	retf 4		;; NOTE! This is a 16:32 RETF, since we're in a 32 bit seg
__GetPageAttributes endp

END

⌨️ 快捷键说明

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