blob: e264356640f985fbc53265c176442690e00b6d37 [file] [log] [blame]
swissChili825d46b2021-02-21 10:14:16 -08001#pragma once
2
3#include "kint.h"
4#include "registers.h"
5
swissChilie0a79bb2021-02-22 19:54:48 -08006#define VIRT_TO_PHYS(virt) ((uint)(virt) - 0xC0000000)
swissChili1e8b7562021-12-22 21:22:57 -08007#define PHYS_TO_VIRT(phys) ((void *)((uint)(phys) + 0xC0000000))
swissChilie0a79bb2021-02-22 19:54:48 -08008#define KERNEL_VIRTUAL_BASE 0xC0000000
9#define KERNEL_PAGE_NUMBER (KERNEL_VIRTUAL_BASE >> 22)
10
swissChili825d46b2021-02-21 10:14:16 -080011/* defined in switch_table.s */
12extern uint load_page_directory(uint table_address);
13extern void enable_paging();
swissChilie9289ee2021-03-20 21:54:28 -070014extern uint kernel_page_directory[1024];
swissChili825d46b2021-02-21 10:14:16 -080015
swissChilie0a79bb2021-02-22 19:54:48 -080016void init_paging();
swissChili825d46b2021-02-21 10:14:16 -080017
swissChilie9289ee2021-03-20 21:54:28 -070018void map_page_to(uint *dir, void *virt, void *frame_p, bool writable, bool user);
swissChilie4f01992021-02-25 15:38:12 -080019void alloc_frame(uint *page_table_entry, bool user, bool writable);
swissChilie9289ee2021-03-20 21:54:28 -070020void alloc_page(uint *dir, uint *page);
swissChilie4f01992021-02-25 15:38:12 -080021void alloc_kernel_page(uint *page);
swissChili825d46b2021-02-21 10:14:16 -080022void page_fault(struct registers *regs);
swissChili1e8b7562021-12-22 21:22:57 -080023uint *new_page_directory_v();