summaryrefslogtreecommitdiff
path: root/src/kernel/include/paging.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/kernel/include/paging.h')
-rw-r--r--src/kernel/include/paging.h27
1 files changed, 19 insertions, 8 deletions
diff --git a/src/kernel/include/paging.h b/src/kernel/include/paging.h
index 3b89af9..267da43 100644
--- a/src/kernel/include/paging.h
+++ b/src/kernel/include/paging.h
@@ -24,7 +24,7 @@ typedef struct __attribute__((packed)) {
unsigned int software_marks : 3; // available for our own use, I doubt we'll use it in such a simple thing
uintptr_t base_ptr : 40;
- unsigned int available:11;
+ unsigned int sign:11;
} page_entry;
@@ -35,11 +35,11 @@ typedef struct __attribute__((packed)) {
page_entry pte[512];
} page_table;
-#define MEM_AVAILABLE 0
-#define MEM_RESERVED 1
-#define MEM_APCI_RECLAIMABLE 2
-#define MEM_APCI_NVS 3
-#define MEM_BAD 4
+#define MEM_AVAILABLE 1
+#define MEM_RESERVED 2
+#define MEM_APCI_RECLAIMABLE 3
+#define MEM_APCI_NVS 4
+#define MEM_BAD 5
#define PAGE_SIZE_4K 12
#define PAGE_SIZE_2M 21
@@ -49,12 +49,23 @@ struct memory_table {
uint64_t base;
uint64_t length;
uint32_t type;
- uint32_t ACPI; //we'll never use this
+ uint32_t ACPI;
+} __attribute__((packed));
+
+struct phys_map {
+ uint64_t map_size; //this way we won't have to calculate it every time
+ void *chunk_start;
+ uint64_t chunk_size;
+ uint64_t *buddies;
} __attribute__((packed));
extern void* _meminfo_loc;
+extern void* _stage2_pagetable;
-bool map_page(uintptr_t virtual_addr, uintptr_t physical_addr, uint8_t PAGE_SIZE);
+bool map_page(void *virtual_addr, void *physical_addr, uint8_t PAGE_SIZE);
void debug_print_memory();
+void create_pagetable_stage2(uint64_t free_mem);
+void init_memory();
#endif
+