1 ; Code for enabling paging before calling the kernel
2 ; Identity maps the VGA framebuffer memory and high-half maps the kernel memory
7 ; The problem with this code is that it assumes that the kernel's various
8 ; sections occupy a certain number of pages. As of writing it is correct, but as
9 ; the kernel grows this code may fail to map those pages, which is not good. The
10 ; solution to this is to use ELF instead of a flat binary. This was not done
11 ; before because it would require paging, but now that paging works using ELF is
12 ; a possibility which must be exploited.
29 or eax, 1|2 ; P and R/W flags
30 mov [page_table_low+ebx*4], eax
41 mov [page_table_high+ebx*4], eax
51 or eax, 1|2 ; P and R/W flags
52 mov [page_table_high+ebx*4], eax
57 mov eax, page_table_low
60 mov [page_directory], eax
62 mov eax, page_table_high
65 mov [page_directory+768*4], eax
67 mov eax, page_directory