summaryrefslogtreecommitdiff
path: root/src/paging.c
blob: 0728178000352e00930675ea61c3b2123e509aec (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#include "aplos.h"

void
setup_paging(struct boot_info *info)
{
	print(u8"Setting up paging. All usable physical memory is mapped starting at %p\n", info->physbase);
	uint64_t cr3 = get_cr3();
	print(u8"CR3: %p\n", cr3);
}

bool
page_fault_handler(uint32_t code)
{
	int write = code&0x2;

	uint64_t addr = get_cr2();
	print(u8"Page fault trying to %s %p\n", write ? u8"write to" : u8"read from", addr);

	return false; /* We didn't actually handle it */
}