summaryrefslogtreecommitdiffstats
path: root/arch/x86_64/hal
diff options
context:
space:
mode:
authorJon Santmyer <jon@jonsantmyer.com>2026-09-11 11:16:36 -0400
committerJon Santmyer <jon@jonsantmyer.com>2026-09-11 11:16:36 -0400
commitbb08472a04127c994d3ea5a2cbc195f7116a03b8 (patch)
treec55910449fae5cc2a722c4b6619f4c8dde8d5b56 /arch/x86_64/hal
parent880dc3ee72809e74a5bde2275fc8f419a762b255 (diff)
downloadjove-kernel-bb08472a04127c994d3ea5a2cbc195f7116a03b8.tar.gz
jove-kernel-bb08472a04127c994d3ea5a2cbc195f7116a03b8.tar.bz2
jove-kernel-bb08472a04127c994d3ea5a2cbc195f7116a03b8.zip
preliminary object linking support. needs testing
Diffstat (limited to 'arch/x86_64/hal')
-rw-r--r--arch/x86_64/hal/obj.c15
-rw-r--r--arch/x86_64/hal/obj.h11
2 files changed, 11 insertions, 15 deletions
diff --git a/arch/x86_64/hal/obj.c b/arch/x86_64/hal/obj.c
index 8011347..c5d5c69 100644
--- a/arch/x86_64/hal/obj.c
+++ b/arch/x86_64/hal/obj.c
@@ -3,6 +3,7 @@
#include "paging.h"
#include "hal/obj.h"
#include "jove.h"
+#include "sys/link.h"
jove_owned_obj_t*
obj_take(jove_obj_t *obj)
@@ -20,7 +21,7 @@ obj_release(jove_owned_obj_t *obj)
if((uintptr_t)obj < IDENT_VIRT_BASE) {
reterr(EBADOBJ);
}
- release_mutex((atomic_flag*)&obj->lock);
+ release_mutex((atomic_flag*)&obj->locked.lock);
return (jove_obj_t*)obj;
}
@@ -33,25 +34,25 @@ obj_deref(jove_owned_obj_t *obj)
uint8_t
obj_gettype(jove_owned_obj_t *obj)
{
- return obj->type;
+ return obj->locked.type;
}
void
obj_settype(jove_owned_obj_t *obj, uint8_t type)
{
- obj->type = type;
+ obj->locked.type = type;
}
uintmax_t
obj_getvalue(jove_owned_obj_t *obj)
{
- return obj->value;
+ return obj->locked.value;
}
void
obj_setvalue(jove_owned_obj_t *obj, uintmax_t value)
{
- obj->value = value & 0x00007FFFFFFFFFFFULL;
+ obj->locked.value = value & 0x00007FFFFFFFFFFFULL;
}
jove_owned_obj_t*
@@ -59,14 +60,14 @@ objdir_getlocal(
jove_owned_obj_t *objdir_obj,
uint16_t entry)
{
- if(objdir_obj->type != JOVE_OBJ_OBJDIR) {
+ if(obj_gettype_linked(objdir_obj) != JOVE_OBJ_OBJDIR) {
reterr(EBADOBJ);
}
if(entry >= JOVE_OBJDIR_ENTRIES) {
reterr(EOOB);
}
- jove_objdir_t *objtab = obj_deref(objdir_obj);
+ jove_objdir_t *objtab = obj_deref_linked(objdir_obj);
return obj_take(&objtab->entries[entry]);
}
diff --git a/arch/x86_64/hal/obj.h b/arch/x86_64/hal/obj.h
index 78d7383..fcb7506 100644
--- a/arch/x86_64/hal/obj.h
+++ b/arch/x86_64/hal/obj.h
@@ -7,7 +7,7 @@
enum
{
- JOVE_OBJ_SERIAL_COM = 0x80,
+ JOVE_OBJ_SERIAL_COM = 0x40,
};
/*Represents a locked kernel object pointer inside of a object directory.*/
@@ -25,14 +25,9 @@ typedef union jove_obj
/*Represents an unlocked kernel object pointer.
*This object should only exist temporarily while accessing the underlying
*structure this object points to.*/
-typedef union jove_obj_locked
+typedef struct jove_locked_obj
{
- struct {
- uint8_t type;
- uint8_t lock;
- uint64_t value : 48;
- };
- uintmax_t data;
+ jove_obj_t locked;
} jove_owned_obj_t;
/*Object directories are always 1 page wide. Since an object inside the directory