From 32f63ffc96f7f7ec6c504b8f50292316f026dd21 Mon Sep 17 00:00:00 2001 From: Marvin Borner Date: Sat, 22 Aug 2020 21:58:07 +0200 Subject: Fixed events --- apps/wm.c | 2 +- kernel/features/load.c | 1 - kernel/features/proc.c | 6 ++---- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/apps/wm.c b/apps/wm.c index 5896e92..ffb1b4d 100644 --- a/apps/wm.c +++ b/apps/wm.c @@ -34,7 +34,7 @@ int main(int argc, char **argv) gui_init("/font/spleen-16x32.psfu"); gui_write(vbe, 50, 50, text, "hallo"); - //event_map(EVENT_KEYBOARD, onkey); // TODO: Fix events + event_map(EVENT_KEYBOARD, onkey); struct message *msg; while (1) { // TODO: Remove continuous polling? diff --git a/kernel/features/load.c b/kernel/features/load.c index 1f1c898..8aa28b8 100644 --- a/kernel/features/load.c +++ b/kernel/features/load.c @@ -18,7 +18,6 @@ int bin_load(char *path, struct proc *proc) u32 stack = (u32)malloc(0x2000) + 0x1000; proc->regs.ebp = (u32)stack; - proc->regs.esp = (u32)stack; proc->regs.useresp = (u32)stack; proc->regs.eip = (u32)data; strcpy(proc->name, path + 1); diff --git a/kernel/features/proc.c b/kernel/features/proc.c index 4d4a9f3..d1a2780 100644 --- a/kernel/features/proc.c +++ b/kernel/features/proc.c @@ -72,6 +72,7 @@ void scheduler(struct regs *regs) quantum = PROC_QUANTUM; proc->state = PROC_IN_EVENT; list_remove(proc->events, proc->events->head); + regs->useresp += 4; ((u32 *)regs->useresp)[1] = (u32)proc_event->data; // Huh } @@ -93,10 +94,7 @@ void proc_print() struct proc *proc_current() { - if (current) - return current->data; - else - return NULL; + return current ? current->data : NULL; } void proc_send(struct proc *src, struct proc *dest, enum message_type type, void *data) -- cgit v1.2.3