aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Cunningham <cc@localhost>2022-02-04 18:29:31 -0700
committerChristian Cunningham <cc@localhost>2022-02-04 18:29:31 -0700
commitce24526da5c66f1840721707023ae4ecab51486e (patch)
treedb46359b61ccefab0f165a35d5f5b415fd90975c
parent13b2bf797bdf4fab0115675c4d2541fff05e285c (diff)
Implemented new Real-Time friendly Memory Allocation Scheme
-rw-r--r--src/lib/kmem.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/lib/kmem.c b/src/lib/kmem.c
index fc91fc4..5fda56a 100644
--- a/src/lib/kmem.c
+++ b/src/lib/kmem.c
@@ -36,6 +36,8 @@ void* kcalloc(unsigned int size)
void* krealloc(void* old, unsigned int size)
{
+ if (!(kmem_begin <= old && old < 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;