diff options
Diffstat (limited to 'kernel/features')
-rw-r--r-- | kernel/features/event.c | 14 | ||||
-rw-r--r-- | kernel/features/syscall.c | 6 |
2 files changed, 19 insertions, 1 deletions
diff --git a/kernel/features/event.c b/kernel/features/event.c index 320b45a..8bdba1a 100644 --- a/kernel/features/event.c +++ b/kernel/features/event.c @@ -19,6 +19,20 @@ u32 event_map(enum event id, u32 *func) return 0; } +// TODO: Fix unmap +void event_unmap(enum event id, u32 *func) +{ + struct list *list = ((struct list *)event_table[id]); + struct node *iterator = list->head; + while (iterator->data != (void *)func) { + iterator = iterator->next; + if (!iterator) + return; + } + + list_remove(list, iterator); +} + u32 event_trigger(enum event id, u32 *data) { assert(id < sizeof(event_table) / sizeof(*event_table)); diff --git a/kernel/features/syscall.c b/kernel/features/syscall.c index 2a01d8a..9d5ac82 100644 --- a/kernel/features/syscall.c +++ b/kernel/features/syscall.c @@ -53,7 +53,11 @@ void syscall_handler(struct regs *r) break; } case SYS_MAP: { - event_map(r->ebx, (u32(*)())r->ecx); + event_map(r->ebx, (u32 *)r->ecx); + break; + } + case SYS_UNMAP: { + event_unmap(r->ebx, (u32 *)r->ecx); break; } default: { |