]> git.dujemihanovic.xyz Git - nameless-os.git/blob - kernel/arch/x86/mm/paging.c
9a4bc06b49cb71ec55da300122b799257a8df7f8
[nameless-os.git] / kernel / arch / x86 / mm / paging.c
1 #include <mm/paging.h>
2
3 inline void slice_linear_addr(void *address, short *pde, short *pte, short *offset)
4 {
5 *pde = (int) address >> 22;
6 *pte = ((int) address >> 12) & 0x3ff;
7 *offset = (int) address & 0xfff;
8 }
9
10 inline void enable_paging(struct page_directory_entry page_dir)
11 {
12 asm ("mov %0, %%eax; mov %%eax, %%cr3; mov %%cr0, %%eax; or $0x80000000, %%eax; mov %%eax, %%cr0": : "m" (page_dir) : "eax" );
13 }