From 465a630377b97cff92ce44e9a1f32115e7d1f557 Mon Sep 17 00:00:00 2001 From: Christian Cunningham Date: Fri, 4 Feb 2022 23:48:40 -0700 Subject: Move to new mem --- src/exceptions/svc.S | 2 +- src/sys/schedule.c | 4 +++- src/util/mutex.c | 4 ++-- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/exceptions/svc.S b/src/exceptions/svc.S index 7e6a327..48d03a5 100644 --- a/src/exceptions/svc.S +++ b/src/exceptions/svc.S @@ -40,7 +40,7 @@ svc_000003: // Clean task stack strb r0, [r3, r1] // Free the thread after freeing the stack mov r0, r2 - bl free + bl kfree b svc_exit svc_exit: ldmfd sp!, {r0-r12,pc}^ diff --git a/src/sys/schedule.c b/src/sys/schedule.c index 70aebb9..acd6098 100644 --- a/src/sys/schedule.c +++ b/src/sys/schedule.c @@ -2,6 +2,7 @@ #include #include #include +#include #include #include @@ -71,7 +72,8 @@ void add_thread(void* pc, void* arg, unsigned char priority) { //void* sp = get_stack(); struct RStack r = get_stack(); - struct Thread* thread = (struct Thread*)malloca(sizeof(struct Thread), 4); + //struct Thread* thread = (struct Thread*)malloca(sizeof(struct Thread), 4); + struct Thread* thread = (struct Thread*)kmalloc(sizeof(struct Thread)); thread->pc = pc; if (r.sp) { thread->sp_base = r.idx; diff --git a/src/util/mutex.c b/src/util/mutex.c index 52173af..5583d09 100644 --- a/src/util/mutex.c +++ b/src/util/mutex.c @@ -1,6 +1,6 @@ #include #include -#include +#include #include #include @@ -45,7 +45,7 @@ unsigned char release_mutex(struct Mutex* m, unsigned long pid) struct Mutex* create_mutex(void* addr) { // Ensure aligned to word - Important for Atomic Swap - struct Mutex* m = (struct Mutex*)malloca(sizeof(struct Mutex), 4); + struct Mutex* m = (struct Mutex*)kmalloc(sizeof(struct Mutex)); m->addr = addr; m->pid = 0; return m; -- cgit v1.2.1