aboutsummaryrefslogtreecommitdiff
path: root/src/kernel/paging/paging.c
diff options
context:
space:
mode:
authorMarvin Borner2019-10-18 22:28:39 +0200
committerMarvin Borner2019-10-18 22:28:39 +0200
commit00761c54b2a41007e611a2470669b334618152b9 (patch)
tree8aecb5d5d7203af4aad819803280a239daf60c98 /src/kernel/paging/paging.c
parent17c6b30949ce7d4a293862ec8f9b873e17fe0cd8 (diff)
Improved error logging and debugging possibilities
Diffstat (limited to 'src/kernel/paging/paging.c')
-rw-r--r--src/kernel/paging/paging.c25
1 files changed, 1 insertions, 24 deletions
diff --git a/src/kernel/paging/paging.c b/src/kernel/paging/paging.c
index 1712f7e..0b7428e 100644
--- a/src/kernel/paging/paging.c
+++ b/src/kernel/paging/paging.c
@@ -98,11 +98,11 @@ void initialise_paging() {
for (i = KHEAP_START; i < KHEAP_START + KHEAP_INITIAL_SIZE; i += 0x1000)
alloc_frame(get_page(i, 1, kernel_directory), 0, 0);
- irq_install_handler(14, page_fault);
switch_page_directory(kernel_directory);
kheap = create_heap(KHEAP_START, KHEAP_START + KHEAP_INITIAL_SIZE, 0xCFFFF000, 0, 0);
current_directory = clone_directory(kernel_directory);
switch_page_directory(current_directory);
+ serial_write("Paging init successful!\n");
}
void disable_paging() {
@@ -143,29 +143,6 @@ page_t *get_page(uint32_t address, int make, page_directory_t *dir) {
}
}
-void page_fault(struct regs *r) {
- uint32_t faulting_address;
- asm volatile("mov %%cr2, %0" : "=r" (faulting_address));
-
- int present = !(r->err_code & 0x1);
- int rw = r->err_code & 0x2;
- int us = r->err_code & 0x4;
- int reserved = r->err_code & 0x8;
- // int id = r->err_code & 0x10;
-
- serial_write("Page fault! ( ");
- if (present) serial_write("present ");
- if (rw) serial_write("read-only ");
- if (us) serial_write("user-mode ");
- if (reserved) serial_write("reserved ");
- serial_write(") at 0x");
- serial_write_hex(faulting_address);
- serial_write(" - EIP: ");
- serial_write_hex(r->eip);
- serial_write("\n");
- panic("Page fault");
-}
-
static page_table_t *clone_table(page_table_t *src, uint32_t *physAddr) {
page_table_t *table = (page_table_t *) kmalloc_ap(sizeof(page_table_t), physAddr);
memory_set(table, 0, sizeof(page_directory_t));