aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChristian Cunningham <cc@localhost>2022-02-04 18:41:12 -0700
committerChristian Cunningham <cc@localhost>2022-02-04 18:41:12 -0700
commita16e8875d13d884ca203bfd83dffe8fae17405c4 (patch)
treee39feded4bd5e980e86f6d521a8c9612b8c7ef85 /src
parentab59732b5384d34edc06a9191b00bf32ad53865d (diff)
Remove realloc
Make threads be explicit in their intentions
Diffstat (limited to 'src')
-rw-r--r--src/lib/kmem.c25
1 files changed, 0 insertions, 25 deletions
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))