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 | |
| 15 | void *_kmalloc(size_t size, bool align, void **phys); |
| 16 | void *kmalloc(size_t size); |
| 17 | void *kmalloc_a(size_t size); |
| 18 | void *kmalloc_ap(size_t size, void **p); |
| 19 | |
swissChili | e0a79bb | 2021-02-22 19:54:48 -0800 | [diff] [blame^] | 20 | void init_paging(); |
swissChili | 825d46b | 2021-02-21 10:14:16 -0800 | [diff] [blame] | 21 | |
| 22 | void page_fault(struct registers *regs); |