diff options
-rw-r--r-- | include/lib/kmem.h | 1 | ||||
-rw-r--r-- | src/lib/kmem.c | 25 |
2 files changed, 0 insertions, 26 deletions
diff --git a/include/lib/kmem.h b/include/lib/kmem.h index 4e79c96..eb3eb28 100644 --- a/include/lib/kmem.h +++ b/include/lib/kmem.h @@ -3,7 +3,6 @@ void* kmalloc(unsigned int size); void* kcalloc(unsigned int size); -void* krealloc(void* old, unsigned int size); void kfree(void* ptr); #endif 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)) |