From: Duje Mihanović Date: Mon, 27 Jun 2022 19:33:06 +0000 (+0200) Subject: Remove leftover paging.s from merge X-Git-Url: http://git.dujemihanovic.xyz/%22http:/www.sics.se/static/%7B%7B%20.Permalink%20%7D%7D?a=commitdiff_plain;h=1e4f7922ce4a13857474e457ca51f20d3555b707;p=nameless-os.git Remove leftover paging.s from merge --- diff --git a/boot/x86/stage3/loader.s b/boot/x86/stage3/loader.s index bd2fb9b..87598f4 100644 --- a/boot/x86/stage3/loader.s +++ b/boot/x86/stage3/loader.s @@ -210,5 +210,3 @@ ss_s: db "SS: ", 0 space: db " ", 0 hex_delm: db "0x", 0 newline: db 0xd, 0xa, 0 - -%include "paging.s" diff --git a/boot/x86/stage3/paging.s b/boot/x86/stage3/paging.s deleted file mode 100644 index 004da84..0000000 --- a/boot/x86/stage3/paging.s +++ /dev/null @@ -1,80 +0,0 @@ -; Code for enabling paging before calling the kernel -; Identity maps the VGA framebuffer memory and high-half maps the kernel memory -bits 32 - -section .text - -; The problem with this code is that it assumes that the kernel's various -; sections occupy a certain number of pages. As of writing it is correct, but as -; the kernel grows this code may fail to map those pages, which is not good. The -; solution to this is to use ELF instead of a flat binary. This was not done -; before because it would require paging, but now that paging works using ELF is -; a possibility which must be exploited. - -enable_paging: - push eax - mov eax, cr0 - or eax, 0x80000000 - mov cr0, eax - pop eax - ret - -load_paging_structs: - push eax - push ebx - xor ebx, ebx -.pt_low_loop: - mov eax, ebx - shl eax, 12 - or eax, 1|2 ; P and R/W flags - mov [page_table_low+ebx*4], eax - inc ebx - cmp ebx, 0x100 - jl .pt_low_loop - - xor ebx, ebx -.pt_high_ro_loop: - mov eax, ebx - add eax, 0x100 - shl eax, 12 - or eax, 1 ; P flag - mov [page_table_high+ebx*4], eax - inc ebx - cmp ebx, 0x2 - jl .pt_high_ro_loop - - mov ebx, 0x2 -.pt_high_rw_loop: - mov eax, ebx - add eax, 0x100 - shl eax, 12 - or eax, 1|2 ; P and R/W flags - mov [page_table_high+ebx*4], eax - inc ebx - cmp ebx, 0x9 - jl .pt_high_rw_loop - - mov eax, page_table_low - and eax, 0xfffff000 - or eax, 1|2 - mov [page_directory], eax - - mov eax, page_table_high - and eax, 0xfffff000 - or eax, 1|2 - mov [page_directory+768*4], eax - - mov eax, page_directory - mov cr3, eax - pop ebx - pop eax - ret - -section .data -align 4096 -page_table_low: - times 1024 dd 0 -page_table_high: - times 1024 dd 0 -page_directory: - times 1024 dd 0