swissChili | 825d46b | 2021-02-21 10:14:16 -0800 | [diff] [blame] | 1 | #pragma once |
| 2 | |
| 3 | #include "kint.h" |
| 4 | #include "registers.h" |
| 5 | |
swissChili | e0a79bb | 2021-02-22 19:54:48 -0800 | [diff] [blame] | 6 | #define VIRT_TO_PHYS(virt) ((uint)(virt) - 0xC0000000) |
| 7 | #define PHYS_TO_VIRT(phys) ((uint)(phys) + 0xC0000000) |
| 8 | #define KERNEL_VIRTUAL_BASE 0xC0000000 |
| 9 | #define KERNEL_PAGE_NUMBER (KERNEL_VIRTUAL_BASE >> 22) |
| 10 | |
swissChili | 825d46b | 2021-02-21 10:14:16 -0800 | [diff] [blame] | 11 | /* defined in switch_table.s */ |
| 12 | extern uint load_page_directory(uint table_address); |
| 13 | extern void enable_paging(); |
| 14 | |
swissChili | e0a79bb | 2021-02-22 19:54:48 -0800 | [diff] [blame] | 15 | void init_paging(); |
swissChili | 825d46b | 2021-02-21 10:14:16 -0800 | [diff] [blame] | 16 | |
swissChili | e4f0199 | 2021-02-25 15:38:12 -0800 | [diff] [blame] | 17 | void alloc_frame(uint *page_table_entry, bool user, bool writable); |
| 18 | void alloc_kernel_page(uint *page); |
swissChili | 825d46b | 2021-02-21 10:14:16 -0800 | [diff] [blame] | 19 | void page_fault(struct registers *regs); |