summaryrefslogtreecommitdiff
path: root/kernel/lib
diff options
context:
space:
mode:
authorAnton Kling <anton@kling.gg>2024-03-14 13:09:59 +0100
committerAnton Kling <anton@kling.gg>2024-03-14 13:09:59 +0100
commit2e8b474d4219e7faaac3823e73c8d528c2698a37 (patch)
tree7d93b5fd220e8b703ba69f9b55122d15c9d619fb /kernel/lib
parent051ac9f1941e8bc6ad87beccb61a2d53111ba8ea (diff)
random changes made
Diffstat (limited to 'kernel/lib')
-rw-r--r--kernel/lib/list.c5
-rw-r--r--kernel/lib/list.h2
-rw-r--r--kernel/lib/stack.c1
3 files changed, 6 insertions, 2 deletions
diff --git a/kernel/lib/list.c b/kernel/lib/list.c
index 12104d8..9cdcd01 100644
--- a/kernel/lib/list.c
+++ b/kernel/lib/list.c
@@ -16,13 +16,16 @@ void list_reset(struct list *list) {
list->tail_index = -1;
}
-int list_add(struct list *list, void *entry) {
+int list_add(struct list *list, void *entry, int *index) {
if (list->tail_index > 100 - 1) {
kprintf("Error: list has run out of space\n");
assert(0);
}
list->tail_index++;
list->entries[list->tail_index] = entry;
+ if(index) {
+ *index = list->tail_index;
+ }
return 1;
}
diff --git a/kernel/lib/list.h b/kernel/lib/list.h
index 8c3cce4..6ab9e0b 100644
--- a/kernel/lib/list.h
+++ b/kernel/lib/list.h
@@ -8,6 +8,6 @@ struct list {
int list_init(struct list *list);
void list_reset(struct list *list);
void list_free(struct list *list);
-int list_add(struct list *list, void *entry);
+int list_add(struct list *list, void *entry, int *index);
int list_get(const struct list *list, int index, void **out);
#endif
diff --git a/kernel/lib/stack.c b/kernel/lib/stack.c
index 7f31867..7283b35 100644
--- a/kernel/lib/stack.c
+++ b/kernel/lib/stack.c
@@ -1,3 +1,4 @@
+#include <interrupts.h>
#include <kmalloc.h>
#include <lib/stack.h>
#include <stddef.h>