📄 init_p.asm
字号:
page 60,132
title PROTECTED MODE INITIALIZATION MOUDLE
;******************************************************************************
;******************************************************************************
;** **
;** init_p.asm **
;** **
;** Copyright (C) 2005-2006 Universe Corporation **
;** **
;** All Rights Reserved **
;** **
;** Lanzhou University Of Tecnology **
;** **
;** (0931)-2975931 **
;** **
;******************************************************************************
;******************************************************************************
;+ includes +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
include asm\equates.inc
include asm\macros.inc
include asm\structs.inc
;+ code segment +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
.486p
startup group _init_p
_init_p segment word public use32 'CODE'
assume cs:startup
;------------------------------------------------------------------------------
public _INIT_P_STARTS
_INIT_P_STARTS label byte ; marks start of module
;------------------------------------------------------------------------------
; re-initialize register
mov ax,DS_SEL
mov ds,ax
mov es,ax
mov fs,ax
mov gs,ax
mov ss,ax
mov esp,ESP_INIT_P
; initialize page directory
mov eax,00002007h
mov edi,PAGE_DIR_START
mov ecx,PAGE_TBLS_NR
next_page_dir:
stosd
add eax,00001000h
loop next_page_dir
; initialize page table
mov eax,00000007h
mov di,PAGE_TBL_START
mov ecx,PAGE_TBLS_NR * 1024
next_page_tbl:
stosd
add eax,00001000h
loop next_page_tbl
; make CR3 point to the page directory
mov eax,00001000h
mov cr3,eax
; enable paging
mov eax,cr0
or eax,8000000h
mov cr0,eax
jmp short $ ; system halt
;- data -----------------------------------------------------------------------
org INIT_P_SECS_NR * 512 - 2
word 5a5ah
;------------------------------------------------------------------------------
public _INIT_P_ENDS
_INIT_P_ENDS label byte ; marks end of module
;------------------------------------------------------------------------------
_init_p ends
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -