解决内存管理重构后的一些bug

This commit is contained in:
pointer-to-bios 2024-04-06 18:07:00 +08:00
parent 327c10963c
commit ad8cb92e78
1 changed files with 0 additions and 5 deletions

View File

@ -37,7 +37,6 @@ allocator_t *memm_allocator_new(void *start, usize length, usize type, usize pid
allocator_t *allocator = start; allocator_t *allocator = start;
allocator->magic = MEMM_ALLOCATOR_MAGIC; allocator->magic = MEMM_ALLOCATOR_MAGIC;
allocator->full = false; allocator->full = false;
allocator->pid = 0;
allocator->size = length; allocator->size = length;
allocator->type = type; allocator->type = type;
switch (type) switch (type)
@ -71,10 +70,6 @@ void memm_free(void *mem)
allocator_t *allocator = memory_manager.kernel_base_allocator; allocator_t *allocator = memory_manager.kernel_base_allocator;
if (allocator->magic != MEMM_ALLOCATOR_MAGIC) if (allocator->magic != MEMM_ALLOCATOR_MAGIC)
return; return;
if (is_user_address((u64)mem))
{
mem = mem - allocator->userspace + (void *)allocator;
}
allocator->free(allocator->allocator_instance, mem); allocator->free(allocator->allocator_instance, mem);
if (allocator->full) if (allocator->full)
allocator->full = false; allocator->full = false;