summaryrefslogtreecommitdiff
path: root/kernel/includes
diff options
context:
space:
mode:
authorAnton Kling <anton@kling.gg>2024-12-09 18:35:54 +0100
committerAnton Kling <anton@kling.gg>2024-12-09 19:17:57 +0100
commite7272b29feb855f4678c5c510d331f297351d3a2 (patch)
treea1961628a7466af9320f14827cb528ac688ddb76 /kernel/includes
parent906923ad3f2ecb2c73d286924e2ac05f8f3ae502 (diff)
mmu: Make certain allocations physical and virtual mapping linear
Previously it was possible for fragmentation to occur and as a result certain allocations would have a linear virtual address space but not a linear physical address space. This is bad since a lot of calls to kmalloc_align rely upon both being linear, it has now been changed such that all allocations done by kmalloc_align now guarantee this mapping holds for both virtual and physical addresses. It was due to oversight and sheer luck that this had been working for so long.
Diffstat (limited to 'kernel/includes')
-rw-r--r--kernel/includes/mmu.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/kernel/includes/mmu.h b/kernel/includes/mmu.h
index 319169f..580b40e 100644
--- a/kernel/includes/mmu.h
+++ b/kernel/includes/mmu.h
@@ -42,6 +42,7 @@ int mmu_allocate_region(void *ptr, size_t n, mmu_flags flags,
PageDirectory *pd);
void mmu_free_pagedirectory(PageDirectory *pd);
int mmu_allocate_shared_kernel_region(void *rc, size_t n);
+int mmu_allocate_kernel_linear_virtual_to_physical_mapping(void *rc, size_t n);
void *mmu_find_unallocated_virtual_range(void *addr, size_t length);
void mmu_remove_virtual_physical_address_mapping(void *ptr, size_t length);
void mmu_free_address_range(void *ptr, size_t length, PageDirectory *pd);
@@ -60,7 +61,7 @@ PageDirectory *get_active_pagedirectory(void);
void switch_page_directory(PageDirectory *directory);
PageDirectory *clone_directory(PageDirectory *original);
void *virtual_to_physical(void *address, PageDirectory *directory);
-void *ksbrk(size_t s);
+void *ksbrk(size_t s, int enforce_linear);
void *ksbrk_physical(size_t s, void **physical);
int write_to_frame(u32 frame_address, u8 on);