diff options
author | Christian Cunningham <cc@localhost> | 2022-02-04 23:48:40 -0700 |
---|---|---|
committer | Christian Cunningham <cc@localhost> | 2022-02-04 23:48:40 -0700 |
commit | 465a630377b97cff92ce44e9a1f32115e7d1f557 (patch) | |
tree | 84b0955e5ea12da850dc777a94bef66c4a45b218 | |
parent | a16e8875d13d884ca203bfd83dffe8fae17405c4 (diff) |
Move to new mem
-rw-r--r-- | src/exceptions/svc.S | 2 | ||||
-rw-r--r-- | src/sys/schedule.c | 4 | ||||
-rw-r--r-- | 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 <globals.h> #include <graphics/lfb.h> #include <drivers/uart.h> +#include <lib/kmem.h> #include <sys/schedule.h> #include <util/mutex.h> @@ -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 <cpu/atomic/swap.h> #include <globals.h> -#include <lib/mem.h> +#include <lib/kmem.h> #include <sys/schedule.h> #include <util/mutex.h> @@ -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; |