summaryrefslogtreecommitdiffstats
path: root/hal/obj.h
diff options
context:
space:
mode:
authorJon Santmyer <jon@jonsantmyer.com>2026-09-15 10:03:20 -0400
committerJon Santmyer <jon@jonsantmyer.com>2026-09-15 10:03:20 -0400
commita783cc865f1f261c20f6ef55cb37d4839f519865 (patch)
treeeabd6992f3be7c0f4d778a9fba2bfe7173ed6c8c /hal/obj.h
parent1f4260648f02db1b4fe8c60fe36f936125042880 (diff)
downloadjove-kernel-a783cc865f1f261c20f6ef55cb37d4839f519865.tar.gz
jove-kernel-a783cc865f1f261c20f6ef55cb37d4839f519865.tar.bz2
jove-kernel-a783cc865f1f261c20f6ef55cb37d4839f519865.zip
move constants to api. centralize interrupts. fix rootdir lock hang
Diffstat (limited to 'hal/obj.h')
-rw-r--r--hal/obj.h37
1 files changed, 37 insertions, 0 deletions
diff --git a/hal/obj.h b/hal/obj.h
index 7a6ab76..151f4eb 100644
--- a/hal/obj.h
+++ b/hal/obj.h
@@ -9,4 +9,41 @@
#include "arch/x86_64/hal/obj.h"
#endif
+typedef struct jove_objdir
+{
+ jove_obj_t entries[JOVE_OBJDIR_ENTRIES];
+} jove_objdir_t;
+
+/*Locks the mutex of the kernel object provided. Returns the locked version. */
+jove_owned_obj_t *obj_take(jove_obj_t *obj);
+/*Unlocks the mutex of the kernel object provided. Returns the unlocked version. */
+jove_obj_t *obj_release(jove_owned_obj_t *obj);
+
+/*Converts the value pointer of the object into a pointer to kernel memory.*/
+void *obj_deref(jove_owned_obj_t *obj);
+
+/*Getters and setters for accessing the type field of the kernel object. */
+uint8_t obj_gettype(jove_owned_obj_t *obj);
+uint8_t obj_peektype(jove_obj_t obj);
+void obj_settype(jove_owned_obj_t *obj, uint8_t type);
+
+/*Getters and setters for accessing the value field of the kernel object. */
+uintmax_t obj_getvalue(jove_owned_obj_t *obj);
+void obj_setvalue(jove_owned_obj_t *obj, uintmax_t value);
+
+/*Returns the n'th entry of the object directory passed.
+ * If the passed object is not an objdir, returns NULL and sets errno to EBADOBJ.
+ * If the passed entry index is out of bounds, returns NULL and sets errno to EOOB.*/
+jove_owned_obj_t *objdir_getlocal(jove_owned_obj_t *objdir_obj, uint16_t entry);
+jove_obj_t objdir_peeklocal(jove_owned_obj_t *objdir_obj, uint16_t entry);
+
+/*Recursively seeks through an object directory for an object following the passed
+ * path variable.
+ * If the path length is zero, returns the passed object.
+ * If the passed object is not an objdir, returns NULL and sets errno to EBADOBJ.
+ * If any object excluding the object at the end of the path is not an objdir,
+ * returns NULL and sets errno to EBADOBJ.
+ * If any entry in the path is out of bounds, returns NULL and sets errno to EBADOBJ.*/
+jove_owned_obj_t *objdir_getobj(jove_owned_obj_t *objdir_obj, const uint16_t *path, size_t path_len);
+
#endif