summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJon Santmyer <jon@jonsantmyer.com>2025-09-18 13:52:58 -0400
committerJon Santmyer <jon@jonsantmyer.com>2025-09-18 13:52:58 -0400
commitddc4fbc15223e362896a9f42beca73f05f48e664 (patch)
tree30f8ffc989bc66d9d9e67c7321b3d7a9c46dc130
parentcfc793e204ba63d281e778a36992b8c86dd0ad88 (diff)
downloadjove-kernel-ddc4fbc15223e362896a9f42beca73f05f48e664.tar.gz
jove-kernel-ddc4fbc15223e362896a9f42beca73f05f48e664.tar.bz2
jove-kernel-ddc4fbc15223e362896a9f42beca73f05f48e664.zip
move usermode-critical info to include/api
-rw-r--r--arch/x86_64/lib/object.c2
-rw-r--r--arch/x86_64/memory/message.c8
-rw-r--r--arch/x86_64/memory/page-mapping.c2
-rw-r--r--arch/x86_64/memory/pml4.c2
-rw-r--r--arch/x86_64/syscall/invoke-mapping.c2
-rw-r--r--arch/x86_64/syscall/invoke-untyped-retype.c2
-rw-r--r--arch/x86_64/syscall/syscall.c4
-rw-r--r--include/api/error.h (renamed from include/error.h)4
-rw-r--r--include/api/object.h29
-rw-r--r--include/api/syscall.h (renamed from include/syscall.h)17
-rw-r--r--include/arch/x86_64/api/syscall.h (renamed from include/arch/x86_64/syscall.h)0
-rw-r--r--include/object.h27
-rw-r--r--lib/untyped-retype.c3
-rw-r--r--lib/untyped.c2
-rw-r--r--syscall/handler.c5
-rw-r--r--syscall/invoke-untyped.c4
-rw-r--r--syscall/invoke_objdir.c7
17 files changed, 57 insertions, 63 deletions
diff --git a/arch/x86_64/lib/object.c b/arch/x86_64/lib/object.c
index 43d490f..f028454 100644
--- a/arch/x86_64/lib/object.c
+++ b/arch/x86_64/lib/object.c
@@ -1,5 +1,5 @@
#include "object.h"
-#include "error.h"
+#include "api/error.h"
#include "device/processor.h"
#include "arch/x86_64/processor.h"
#include "arch/x86_64/page.h"
diff --git a/arch/x86_64/memory/message.c b/arch/x86_64/memory/message.c
deleted file mode 100644
index d5bedb7..0000000
--- a/arch/x86_64/memory/message.c
+++ /dev/null
@@ -1,8 +0,0 @@
-#include <object.h>
-#include <stddef.h>
-#include <error.h>
-#include <device/processor.h>
-#include "arch/x86_64/page.h"
-#include "arch/x86_64/page-mapping.h"
-#include "print.h"
-
diff --git a/arch/x86_64/memory/page-mapping.c b/arch/x86_64/memory/page-mapping.c
index bbf210a..58cf8fe 100644
--- a/arch/x86_64/memory/page-mapping.c
+++ b/arch/x86_64/memory/page-mapping.c
@@ -1,7 +1,7 @@
#include "arch/x86_64/page-mapping.h"
#include "arch/x86_64/page.h"
#include "memory.h"
-#include "error.h"
+#include "api/error.h"
#include <stddef.h>
#include "print.h"
diff --git a/arch/x86_64/memory/pml4.c b/arch/x86_64/memory/pml4.c
index b22bcfb..d5fb56b 100644
--- a/arch/x86_64/memory/pml4.c
+++ b/arch/x86_64/memory/pml4.c
@@ -7,7 +7,7 @@
#include "init.h"
#include "string.h"
#include "jove.h"
-#include "error.h"
+#include "api/error.h"
#include <stdint.h>
#define IDENTITY_BASE 0xFFFF800000000000
diff --git a/arch/x86_64/syscall/invoke-mapping.c b/arch/x86_64/syscall/invoke-mapping.c
index 5fde8be..186b420 100644
--- a/arch/x86_64/syscall/invoke-mapping.c
+++ b/arch/x86_64/syscall/invoke-mapping.c
@@ -2,7 +2,7 @@
#include "arch/x86_64/syscall.h"
#include "arch/x86_64/page.h"
#include <stddef.h>
-#include "error.h"
+#include "api/error.h"
#include "lock.h"
#include "string.h"
#include "memory.h"
diff --git a/arch/x86_64/syscall/invoke-untyped-retype.c b/arch/x86_64/syscall/invoke-untyped-retype.c
index 4db91b9..3057f25 100644
--- a/arch/x86_64/syscall/invoke-untyped-retype.c
+++ b/arch/x86_64/syscall/invoke-untyped-retype.c
@@ -1,5 +1,5 @@
#include <object.h>
-#include <error.h>
+#include "api/error.h"
int
ko_untyped_retype_memory_mapping(
diff --git a/arch/x86_64/syscall/syscall.c b/arch/x86_64/syscall/syscall.c
index 5582336..7ddd179 100644
--- a/arch/x86_64/syscall/syscall.c
+++ b/arch/x86_64/syscall/syscall.c
@@ -2,7 +2,7 @@
#include "syscall/handles.h"
#include "print.h"
#include "lock.h"
-#include "error.h"
+#include "api/error.h"
#include <stddef.h>
static inline int
@@ -27,7 +27,7 @@ _syscall_handler_arch(objdir_t *root_dir, objdir_entry_t *target, uint8_t *paylo
default:
klogf("Missing implementation of invoke for type %i\n", target->type);
mtx_release(&target->lock);
- return -KE_BADTYPE;
+ return KE_BADTYPE;
}
}
diff --git a/include/error.h b/include/api/error.h
index 40a39e2..da8093c 100644
--- a/include/error.h
+++ b/include/api/error.h
@@ -1,10 +1,6 @@
#ifndef _JOVE_ERROR_H
#define _JOVE_ERROR_H 1
-#define E_OK 0
-#define E_BADOBJ 1
-#define E_ARGUMENT 2
-
enum
{
KE_OK = 0,
diff --git a/include/api/object.h b/include/api/object.h
new file mode 100644
index 0000000..58a54b9
--- /dev/null
+++ b/include/api/object.h
@@ -0,0 +1,29 @@
+#ifndef _JOVE_API_OBJECT_H
+#define _JOVE_API_OBJECT_H 1
+
+#include <stdint.h>
+
+typedef uint16_t obj_type_t;
+
+enum
+{
+ /* Generic objects */
+ KO_NONE = 0,
+ KO_OBJECT_DIRECTORY,
+ KO_MEMORY_UNTYPED,
+ KO_MEMORY_MAPPING, //4KiB aligned fixed width
+ KO_INITRD_FILE,
+ KO_TCB,
+ KO_MESSAGE,
+ /* Device objects*/
+ KO_DEV_INVALID = 0x100,
+ KO_DEV_PROCESSOR,
+ KO_DEV_UART
+};
+
+#define KO_MESSAGE_BYTES 4096
+#define KO_MESSAGE_ALIGN 0x1000
+
+#define OBJECT_DIRECTORY_MAX_ENTRIES 256
+
+#endif
diff --git a/include/syscall.h b/include/api/syscall.h
index e04ff85..3ce5886 100644
--- a/include/syscall.h
+++ b/include/api/syscall.h
@@ -1,7 +1,5 @@
-#ifndef _JOVE_SYSCALL_H
-#define _JOVE_SYSCALL_H 1
-
-#include <stddef.h>
+#ifndef _JOVE_API_SYSCALL_H
+#define _JOVE_API_SYSCALL_H 1
enum
{
@@ -14,18 +12,18 @@ enum
};
/* Generic payload of SYSCALL_INVOKE:
- * [ n bytes ][ uint8_t ][ payload ]
- * target entry funcid
+ * [size_t n][ n bytes ][ uint8_t ][ payload ]
+ * target entry funcid
* */
/**@ENUM objdir invokes*/
enum
{
- /*[target path][u8 funcid][u8 memb][u16 ret]*/
+ /*[target path][u8 funcid][u8 memb]*/
INVOKE_OBJDIR_GETMEMB,
- /*[target path][u8 funcid][u8 ret]*/
+ /*[target path][u8 funcid]*/
INVOKE_OBJDIR_LASTMEMB,
- /*[target path][u8 funcid][u8 memb][dest path]*/
+ /*[target path][u8 funcid][u8 memb]*/
INVOKE_OBJDIR_MOVE
};
/**@ENUM untyped invokes*/
@@ -43,4 +41,5 @@ enum
INVOKE_UNTYPED_RETYPE,
};
+
#endif
diff --git a/include/arch/x86_64/syscall.h b/include/arch/x86_64/api/syscall.h
index e470537..e470537 100644
--- a/include/arch/x86_64/syscall.h
+++ b/include/arch/x86_64/api/syscall.h
diff --git a/include/object.h b/include/object.h
index 4cf5159..255cf98 100644
--- a/include/object.h
+++ b/include/object.h
@@ -3,30 +3,9 @@
#include <stdint.h>
#include <stddef.h>
-
-enum
-{
- /* Generic objects */
- KO_NONE = 0,
- KO_OBJECT_DIRECTORY,
- KO_MEMORY_UNTYPED,
- KO_MEMORY_MAPPING, //4KiB aligned fixed width
- KO_INITRD_FILE,
- KO_TCB,
- KO_MESSAGE,
- /* Device objects*/
- KO_DEV_INVALID = 0x100,
- KO_DEV_PROCESSOR,
- KO_DEV_UART
-};
-
-#define KO_MESSAGE_BYTES 4096
-#define KO_MESSAGE_ALIGN 0x1000
-
-#define KODE_EX_MESSAGE_MAPPED 0b1
+#include "api/object.h"
typedef uint8_t path_byte_t;
-typedef uint16_t obj_type_t;
typedef struct jove_ObjectDirectoryEntry
{
@@ -41,8 +20,6 @@ typedef struct jove_ObjectDirectoryEntry
uintmax_t data;
} objdir_entry_t;
-#define OBJECT_DIRECTORY_MAX_ENTRIES 256
-
typedef struct jove_ObjectDirectory
{
union {
@@ -51,6 +28,8 @@ typedef struct jove_ObjectDirectory
};
} objdir_t;
+#define KODE_EX_MESSAGE_MAPPED 0b1
+
objdir_entry_t *objdir_seek(objdir_t *dir, uint8_t *path, unsigned long pathw);
unsigned long objdir_pathw(objdir_t *dir, uint8_t *path);
diff --git a/lib/untyped-retype.c b/lib/untyped-retype.c
index 526f19e..ebc0424 100644
--- a/lib/untyped-retype.c
+++ b/lib/untyped-retype.c
@@ -1,7 +1,6 @@
#include "object.h"
-#include "memory.h"
#include <stddef.h>
-#include "error.h"
+#include "api/error.h"
#include "string.h"
int
diff --git a/lib/untyped.c b/lib/untyped.c
index 8a20f63..e6addbb 100644
--- a/lib/untyped.c
+++ b/lib/untyped.c
@@ -1,5 +1,5 @@
#include "include/object.h"
-#include "error.h"
+#include "api/error.h"
int
ko_untyped_split(objdir_entry_t *target, objdir_entry_t *dest, size_t bytes)
diff --git a/syscall/handler.c b/syscall/handler.c
index 5bc3c6f..da36e17 100644
--- a/syscall/handler.c
+++ b/syscall/handler.c
@@ -1,11 +1,10 @@
-#include "syscall.h"
+#include "api/syscall.h"
+#include "api/error.h"
#include "object.h"
#include "handles.h"
#include "device/processor.h"
#include "print.h"
-#include "error.h"
#include "lock.h"
-#include "memory.h"
#include <stdint.h>
#include <stddef.h>
diff --git a/syscall/invoke-untyped.c b/syscall/invoke-untyped.c
index 483d36f..ae9482f 100644
--- a/syscall/invoke-untyped.c
+++ b/syscall/invoke-untyped.c
@@ -1,7 +1,7 @@
#include "handles.h"
#include "object.h"
-#include "syscall.h"
-#include "error.h"
+#include "api/syscall.h"
+#include "api/error.h"
#include "memory.h"
#include "print.h"
diff --git a/syscall/invoke_objdir.c b/syscall/invoke_objdir.c
index 0cc5a44..8f0a923 100644
--- a/syscall/invoke_objdir.c
+++ b/syscall/invoke_objdir.c
@@ -1,6 +1,6 @@
#include "handles.h"
-#include "syscall.h"
-#include "error.h"
+#include "api/syscall.h"
+#include "api/error.h"
#include "lock.h"
#include "string.h"
#include "print.h"
@@ -15,8 +15,9 @@ s_handle_invoke_objdir_getmemb(
{
path_byte_t member;
obj_type_t *dest;
-
SYSCALL_PAYLOAD_TAKEL(payload, payload_at, member, uint8_t);
+
+ payload_at = 0;
SYSCALL_PAYLOAD_TAKEP(payload, payload_at, dest, obj_type_t);
*dest = target_dir->entries[member].type;