removed mutex kernel code

master
Anton Lydike 3 years ago
parent 76c5c3ba3a
commit 06f8cfd279

@ -30,10 +30,10 @@ ARCH = rv32im # here you
CFLAGS += -march=$(ARCH) CFLAGS += -march=$(ARCH)
# dependencies that need to be built: # dependencies that need to be built:
_DEPS = ecall.c csr.c mutex.c sched.c _DEPS = ecall.c csr.c sched.c
# dependencies as object files: # dependencies as object files:
_OBJ = ecall.o mutex.o sched.o boot.o csr.o _OBJ = ecall.o sched.o boot.o csr.o
DEPS = $(patsubst %,$(KLIBDIR)/%,$(_DEPS)) DEPS = $(patsubst %,$(KLIBDIR)/%,$(_DEPS))

@ -1,37 +0,0 @@
#include "mutex.h"
#include "../kernel.h"
// mutex lock structure:
// this is a dict describing which process instantiated the lock
// it maps mutex_id -> pid (or zero for unused locks)
int locks[MUTEX_COUNT];
int locks_bitfield[MUTEX_COUNT / XLEN]; // each bit representing if the lock is
// engaged
int mutex_is_locked(int mutex_id)
{
int offset = mutex_id % XLEN;
return locks[mutex_id / XLEN] & (1 << offset);
}
int mutex_create()
{
return 0;
}
void mutex_lock(int mutex_id)
{
}
void mutex_unlock(int mutex_id)
{
}
void mutex_destroy(int mutex_id)
{
}

@ -1,13 +0,0 @@
#ifndef H_MUTEX
#define H_MUTEX
// mutex operations (modifies data, no checks)
int mutex_create();
void mutex_lock(int mutex_id);
void mutex_unlock(int mutex_id);
void mutex_destroy(int mutex_id);
// mutex helpers
int mutex_is_locked(int mutex_id);
#endif

@ -1,6 +1,5 @@
#include "../kernel.h" #include "../kernel.h"
#include "sched.h" #include "sched.h"
#include "mutex.h"
#include "csr.h" #include "csr.h"
@ -48,20 +47,6 @@ int scheduler_select_free()
timeout_available = true; timeout_available = true;
} }
} }
if (pcb->status == PROC_WAIT_LOCK) {
if (pcb->asleep_until != 0) {
if (pcb->asleep_until < mtime) {
// set process return args!
return (current_process_index + i) % PROCESS_COUNT;
}
timeout_available = true;
}
if (!mutex_is_locked(pcb->requested_lock)) {
return (current_process_index + i) % PROCESS_COUNT;
}
}
} }
if (timeout_available == false) { if (timeout_available == false) {

Loading…
Cancel
Save