From a16e8875d13d884ca203bfd83dffe8fae17405c4 Mon Sep 17 00:00:00 2001 From: Christian Cunningham Date: Fri, 4 Feb 2022 18:41:12 -0700 Subject: Remove realloc Make threads be explicit in their intentions --- src/lib/kmem.c | 25 ------------------------- 1 file changed, 25 deletions(-) (limited to 'src') diff --git a/src/lib/kmem.c b/src/lib/kmem.c index bc21abf..ce2f5fe 100644 --- a/src/lib/kmem.c +++ b/src/lib/kmem.c @@ -34,31 +34,6 @@ void* kcalloc(unsigned int size) return ptr; } -void* krealloc(void* old, unsigned int size) -{ - if (!((unsigned long)kmem_begin <= (unsigned long)old && (unsigned long)old < (unsigned long)kmem_begin + 0x200000)) - return 0; - unsigned long old_size = 1; - while (!((unsigned long)kmem_begin + 0x1000*(old_size/2) <= (unsigned long)old && (unsigned long)old < (unsigned long)kmem_begin + 0x1000*old_size)) - old_size *= 2; - if (size <= old_size) - return old; - void* new = kmalloc(size); - if (new == 0) - return 0; - void* base = (void*)((unsigned long)old - ((unsigned long)old % old_size)); - void* block_base = kmem_begin + 0x1000*(old_size/2); - unsigned int lookup_offset = (base - block_base)/old_size; - unsigned int exp = 0; - unsigned int tmp = old_size; - while (tmp != 0) { - exp++; - tmp = tmp >> 1; - } - kmem_lookup[0x1000*exp + lookup_offset] = 0; - return new; -} - void kfree(void* ptr) { if (!((unsigned long)kmem_begin <= (unsigned long)ptr && (unsigned long)ptr < (unsigned long)kmem_begin + 0x200000)) -- cgit v1.2.1