diff options
Diffstat (limited to 'src/util')
-rw-r--r-- | src/util/lock.c | 8 | ||||
-rw-r--r-- | src/util/mutex.c | 52 | ||||
-rw-r--r-- | src/util/status.c | 10 |
3 files changed, 0 insertions, 70 deletions
diff --git a/src/util/lock.c b/src/util/lock.c index 6c7d07e..95f93af 100644 --- a/src/util/lock.c +++ b/src/util/lock.c @@ -1,6 +1,5 @@ #include <cpu.h> #include <cpu/atomic/swap.h> -#include <lib/kmem.h> #include <util/lock.h> // TODO: Improve locking for system @@ -25,10 +24,3 @@ void unlock(struct Lock* l) atm_release((unsigned long*)l); } } - -struct Lock* create_lock(void) -{ - struct Lock* l = (struct Lock*)kmalloc(sizeof(struct Lock)); - l->pid = 0; - return l; -} diff --git a/src/util/mutex.c b/src/util/mutex.c index 995ef62..e69de29 100644 --- a/src/util/mutex.c +++ b/src/util/mutex.c @@ -1,52 +0,0 @@ -#include <cpu/atomic/swap.h> -#include <globals.h> -#include <lib/kmem.h> -#include <sys/schedule.h> -#include <util/mutex.h> - -///unsigned char lock_mutex(struct Mutex* m, unsigned long pid) -///{ -/// if (m->pid == NULL_PID) { -/// // Use currently running thread's PID if no pid given -/// if (pid == 0) { -/// struct Thread* thread = scheduler.rthread; -/// atm_lock(thread->pid, &m->pid); -/// } else { -/// atm_lock(pid, &m->pid); -/// } -/// return 0; -/// } -/// struct Thread* thread = scheduler.rthread; -/// thread->status = THREAD_MWAIT; -/// thread->mptr = m; -/// return 1; -///} -/// -///// Eventually, there will need to be a hook into the scheduling mechanism -///// that checks the currently running process and check that against the -///// mutex's pid lock -///unsigned char release_mutex(struct Mutex* m, unsigned long pid) -///{ -/// // Use current thread's PID if no pid -/// if (pid == 0) { -/// struct Thread* thread = scheduler.rthread; -/// if (m->pid == thread->pid) { -/// atm_release(&m->pid); -/// return 0; -/// } -/// } -/// else if (m->pid == pid) { -/// atm_release(&m->pid); -/// return 0; -/// } -/// return 1; -///} - -struct Mutex* create_mutex(void* addr) -{ - // Ensure aligned to word - Important for Atomic Swap - struct Mutex* m = (struct Mutex*)kmalloc(sizeof(struct Mutex)); - m->addr = addr; - m->pid = 0; - return m; -} diff --git a/src/util/status.c b/src/util/status.c index 5aef915..828dfa3 100644 --- a/src/util/status.c +++ b/src/util/status.c @@ -64,11 +64,6 @@ void status(void) draw_cstring(9, 0, "v", 0x00FFFF); draw_cstring(0, 0, os_name, 0xFF0000); draw_cstring(10, 0, os_info_v, 0x00FFFF); - draw_cstring(16, 0, "# TStacks:", 0xFFDF00); - draw_string(27, 0, " "); - char* st_str = u32_to_str(sched_stack_count); - draw_cstring(27, 0, st_str, 0xFFDF00); - kfree(st_str); // GPU IRQ Statuses output_irq_status(); @@ -81,7 +76,6 @@ void status(void) char* frq_str = u32_to_str(frq); unsigned long fs_len = strlen(frq_str)+1; draw_string(8, 3, frq_str); - kfree(frq_str); draw_string(8+fs_len, 3, "kHz"); // Output the value unsigned long v = read_cntv_tval(); @@ -89,7 +83,6 @@ void status(void) unsigned long vs_len = strlen(v_str) + 1; draw_string(8+fs_len+4, 3, v_str); draw_string(8+fs_len+4 +vs_len, 3, " "); - kfree(v_str); draw_letter(8+fs_len+4 +vs_len+1, 3, '|'); draw_hex32(8+fs_len+7+vs_len, 3, v); @@ -99,12 +92,10 @@ void status(void) gwidth_str = u32_to_str(gwidth); unsigned long gs_len = strlen(gwidth_str) + 1; draw_string(6, 4, gwidth_str); - kfree(gwidth_str); draw_letter(6+gs_len-1, 4, 'x'); gwidth_str = u32_to_str(gheight); unsigned long gs_len1 = strlen(gwidth_str) + 1; draw_string(6+gs_len, 4, gwidth_str); - kfree(gwidth_str); if(gisrgb) draw_string(6+gs_len+gs_len1, 4, "RGB"); else @@ -143,5 +134,4 @@ void status(void) draw_string(19+14+18, 8, " "); char* t_str = u32_to_str(((unsigned long)tval)/1000000); draw_string(19+14+18, 8, t_str); - kfree(t_str); } |