aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarvin Borner2020-10-25 17:52:28 +0100
committerMarvin Borner2020-10-25 17:52:28 +0100
commit4ec7c19e1567f322b1622ad506290e8eb7a4956d (patch)
tree2fbd1e7f92973105d3dea8e55fd12c8b989050cf
parentc9f89174b9ce73ed93bfad14d57b8f1a43db6bf6 (diff)
Some fixes :)
-rw-r--r--kernel/features/proc.c13
-rw-r--r--kernel/features/syscall.c1
-rwxr-xr-xrun2
3 files changed, 13 insertions, 3 deletions
diff --git a/kernel/features/proc.c b/kernel/features/proc.c
index 7544b68..b6ed442 100644
--- a/kernel/features/proc.c
+++ b/kernel/features/proc.c
@@ -15,6 +15,7 @@
u32 pid = 0;
u32 quantum = 0;
struct proc *kernel_proc;
+struct proc *priority_proc;
struct list *proc_list;
struct node *current;
@@ -35,10 +36,15 @@ void scheduler(struct regs *regs)
memcpy(&((struct proc *)current->data)->regs, regs, sizeof(struct regs));
- if (current->next)
+ if (priority_proc) {
+ current = list_first_data(proc_list, priority_proc);
+ priority_proc = NULL;
+ assert(current);
+ } else if (current->next) {
current = current->next;
- else
+ } else {
current = proc_list->head;
+ }
memcpy(regs, &((struct proc *)current->data)->regs, sizeof(struct regs));
@@ -85,7 +91,7 @@ struct proc *proc_current()
void proc_send(struct proc *src, struct proc *dest, u32 type, void *data)
{
- // TODO: Use unique key instead of pid for IPC messaging
+ // TODO: Use unique key instead of pid for IPC
if (!src || !dest)
return;
struct proc_message *msg = malloc(sizeof(*msg));
@@ -96,6 +102,7 @@ void proc_send(struct proc *src, struct proc *dest, u32 type, void *data)
msg->msg->type = type;
msg->msg->data = data;
list_add(dest->messages, msg);
+ priority_proc = dest;
}
struct proc_message *proc_receive(struct proc *proc)
diff --git a/kernel/features/syscall.c b/kernel/features/syscall.c
index 73f31eb..798ca45 100644
--- a/kernel/features/syscall.c
+++ b/kernel/features/syscall.c
@@ -79,6 +79,7 @@ void syscall_handler(struct regs *r)
}
case SYS_SEND: {
proc_send(proc_current(), proc_from_pid(r->ebx), r->ecx, (void *)r->edx);
+ proc_yield(r);
break;
}
case SYS_RECEIVE: {
diff --git a/run b/run
index b18a550..cc5c405 100755
--- a/run
+++ b/run
@@ -244,8 +244,10 @@ elif [ "${mode}" = "again" ]; then
make_test
elif [ "${mode}" = "disasm" ]; then
make_cross
+ make_clean
make_build
make_disasm
+ make_clean
elif [ "${mode}" = "sync" ]; then
make_sync
elif [ "${mode}" = "disk" ]; then