From e7272b29feb855f4678c5c510d331f297351d3a2 Mon Sep 17 00:00:00 2001 From: Anton Kling Date: Mon, 9 Dec 2024 18:35:54 +0100 Subject: 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. --- kernel/drivers/ahci.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'kernel/drivers') diff --git a/kernel/drivers/ahci.c b/kernel/drivers/ahci.c index 1f3dcf4..9018df1 100644 --- a/kernel/drivers/ahci.c +++ b/kernel/drivers/ahci.c @@ -267,9 +267,9 @@ void ahci_sata_setup(volatile struct HBA_PORT *port) { // clb_address: size has to be 1024 and byte aligned to 1024 // fb_address: size has to be 256 and byte aligned to 256 // command_table_array: size has to be 256*32 - u32 clb_address = (u32)ksbrk(1024); - u32 fb_address = (u32)ksbrk(256); - u32 command_table_array = (u32)ksbrk(256 * 32); + u32 clb_address = (u32)kmalloc_align(1024, 0); + u32 fb_address = (u32)kmalloc_align(256, 0); + u32 command_table_array = (u32)kmalloc_align(256 * 32, 0); create_physical_to_virtual_mapping( virtual_to_physical((void *)clb_address, NULL), (void *)clb_address, 1024); -- cgit v1.2.3