Pagingggggggg! (identity mapped low 4M)
This commit is contained in:
parent
d542ed42d6
commit
148634efff
1 changed files with 42 additions and 2 deletions
|
@ -17,7 +17,7 @@ multiboot:
|
||||||
dd MULTIBOOT_CHECKSUM
|
dd MULTIBOOT_CHECKSUM
|
||||||
dd multiboot ; header address
|
dd multiboot ; header address
|
||||||
dd 0x100000 ; load address
|
dd 0x100000 ; load address
|
||||||
dd stack_bottom ; load end address
|
dd bss ; load end address
|
||||||
dd stack_top ; bss end address
|
dd stack_top ; bss end address
|
||||||
dd start ; entry address
|
dd start ; entry address
|
||||||
dd 0 ; video mode_type (0:fb, 1:txt) (set flags[2]!)
|
dd 0 ; video mode_type (0:fb, 1:txt) (set flags[2]!)
|
||||||
|
@ -99,6 +99,39 @@ start:
|
||||||
|
|
||||||
add esp, 36 ;Clean reserved uitoa return string from stack
|
add esp, 36 ;Clean reserved uitoa return string from stack
|
||||||
|
|
||||||
|
|
||||||
|
;; Setup paging
|
||||||
|
;; Clear pagedir
|
||||||
|
cld
|
||||||
|
mov eax, 0x00000002 ;Supervisor only, Write enabled, Not present
|
||||||
|
mov ecx, 1024
|
||||||
|
mov edi, pagedir
|
||||||
|
rep stosd
|
||||||
|
|
||||||
|
;; Clear pagetable1
|
||||||
|
mov edi, pagetable1
|
||||||
|
mov cx, 0
|
||||||
|
.clearpt1loop:
|
||||||
|
mov eax, 0x00001000
|
||||||
|
mul ecx
|
||||||
|
or eax, 011b ;supervisor, rw, present
|
||||||
|
stosd
|
||||||
|
inc cx
|
||||||
|
cmp cx, 1024
|
||||||
|
jne .clearpt1loop
|
||||||
|
|
||||||
|
;; put table1 in dir
|
||||||
|
mov eax, pagetable1
|
||||||
|
or eax, 011b ;supervisor, rw, present
|
||||||
|
mov [pagedir], eax
|
||||||
|
|
||||||
|
;; Enable paging
|
||||||
|
mov eax, pagedir
|
||||||
|
mov cr3, eax
|
||||||
|
mov eax, cr0
|
||||||
|
or eax, 0x80000000
|
||||||
|
mov cr0, eax
|
||||||
|
|
||||||
jmp hang
|
jmp hang
|
||||||
|
|
||||||
hang:
|
hang:
|
||||||
|
@ -120,7 +153,14 @@ stuff:
|
||||||
.fbdimensionsmsgpfx db 10, "Framebuffer dimensions: ", 0
|
.fbdimensionsmsgpfx db 10, "Framebuffer dimensions: ", 0
|
||||||
.x db "x", 0
|
.x db "x", 0
|
||||||
|
|
||||||
|
bss:
|
||||||
|
align 4096
|
||||||
|
pagedir:
|
||||||
|
rb 4096
|
||||||
|
align 4096
|
||||||
|
pagetable1:
|
||||||
|
rb 4096
|
||||||
|
align 4096
|
||||||
stack_bottom:
|
stack_bottom:
|
||||||
rb 16384
|
rb 16384
|
||||||
stack_top:
|
stack_top:
|
||||||
|
|
Loading…
Reference in a new issue