aboutsummaryrefslogtreecommitdiff
path: root/src/kernel/memory/paging.h
diff options
context:
space:
mode:
authorMarvin Borner2020-01-20 23:12:54 +0100
committerMarvin Borner2020-01-20 23:12:54 +0100
commit391ed256d21a6ae2e2456d1809f357e6e96e15d1 (patch)
tree0fe9ffb3c59bbfeb3d8a04ab7fc6efba60d81e79 /src/kernel/memory/paging.h
parentd5d1749257ff8b9aa6b5ace4b4720b484a2860f3 (diff)
Added pure awesomeness
Actually quite some days of work but ok
Diffstat (limited to 'src/kernel/memory/paging.h')
-rw-r--r--src/kernel/memory/paging.h47
1 files changed, 47 insertions, 0 deletions
diff --git a/src/kernel/memory/paging.h b/src/kernel/memory/paging.h
new file mode 100644
index 0000000..285cb6f
--- /dev/null
+++ b/src/kernel/memory/paging.h
@@ -0,0 +1,47 @@
+#ifndef MELVIX_PAGING_H
+#define MELVIX_PAGING_H
+
+#include <stdint.h>
+#include <kernel/interrupts/interrupts.h>
+
+typedef struct page {
+ uint32_t present: 1;
+ uint32_t rw: 1;
+ uint32_t user: 1;
+ uint32_t accessed: 1;
+ uint32_t dirty: 1;
+ uint32_t unused: 7;
+ uint32_t frame: 20;
+} page_t;
+
+typedef struct page_table {
+ page_t pages[1024];
+} page_table_t;
+
+typedef struct page_directory {
+ page_table_t *tables[1024];
+ uint32_t tablesPhysical[1024];
+ uint32_t physicalAddr;
+} page_directory_t;
+
+int paging_enabled;
+
+void alloc_frame(page_t *page, int is_kernel, int is_writeable);
+
+void free_frame(page_t *page);
+
+void paging_install();
+
+void switch_page_directory(page_directory_t *new);
+
+void paging_enable();
+
+void paging_disable();
+
+page_t *get_page(uint32_t address, int make, page_directory_t *dir);
+
+void page_fault(struct regs *regs);
+
+page_directory_t *clone_directory(page_directory_t *src);
+
+#endif