From cd6b20886ad80112c1589bdabd46e39b1876a162 Mon Sep 17 00:00:00 2001 From: Marvin Borner Date: Sat, 22 Aug 2020 01:26:54 +0200 Subject: Small fixes --- apps/wm.c | 1 - kernel/features/event.c | 2 ++ kernel/features/proc.c | 4 ++++ 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/apps/wm.c b/apps/wm.c index fa7f6de..88c0451 100644 --- a/apps/wm.c +++ b/apps/wm.c @@ -33,7 +33,6 @@ int main(int argc, char **argv) printf("onkey: %x\n", onkey); map(EVENT_KEYBOARD, onkey); - map(EVENT_KEYBOARD, onkey); while (1) { }; diff --git a/kernel/features/event.c b/kernel/features/event.c index 8a2c904..9bcce6d 100644 --- a/kernel/features/event.c +++ b/kernel/features/event.c @@ -13,6 +13,7 @@ struct list *event_table[] = { [EVENT_KEYBOARD] = NULL, [EVENT_MOUSE] = NULL }; u32 event_map(enum event id, struct proc *proc, u32 *func) { assert(id < sizeof(event_table) / sizeof(*event_table)); + assert(func); if (event_table[id] == NULL) event_table[id] = (struct list *)list_new(); @@ -33,6 +34,7 @@ u32 event_map(enum event id, struct proc *proc, u32 *func) void event_unmap(enum event id, struct proc *proc, u32 *func) { assert(id < sizeof(event_table) / sizeof(*event_table)); + assert(func); struct list *list = ((struct list *)event_table[id]); diff --git a/kernel/features/proc.c b/kernel/features/proc.c index e4219b0..a56a0c4 100644 --- a/kernel/features/proc.c +++ b/kernel/features/proc.c @@ -84,6 +84,7 @@ struct proc *proc_current() void proc_exit(struct proc *proc, int status) { + assert(proc); printf("Process %d exited with status %d\n", proc->pid, status); proc->state = status == 0 ? PROC_ASLEEP : PROC_ERROR; @@ -94,6 +95,9 @@ void proc_exit(struct proc *proc, int status) break; } } while ((iterator = iterator->next) != NULL); + + sti(); + hlt(); } struct proc *proc_make() -- cgit v1.2.3