summaryrefslogtreecommitdiffstats
path: root/lib/libjove/include
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libjove/include')
-rw-r--r--lib/libjove/include/arch/x86_64/object-pagemap.h14
-rw-r--r--lib/libjove/include/arch/x86_64/syscall.h12
-rw-r--r--lib/libjove/include/jove.h13
-rw-r--r--lib/libjove/include/object-dir.h17
-rw-r--r--lib/libjove/include/object-message.h13
-rw-r--r--lib/libjove/include/object-typed.h15
-rw-r--r--lib/libjove/include/object-untyped.h39
-rw-r--r--lib/libjove/include/object.h11
-rw-r--r--lib/libjove/include/path-fromobj.h13
-rw-r--r--lib/libjove/include/syscall.h35
10 files changed, 182 insertions, 0 deletions
diff --git a/lib/libjove/include/arch/x86_64/object-pagemap.h b/lib/libjove/include/arch/x86_64/object-pagemap.h
new file mode 100644
index 0000000..55b0570
--- /dev/null
+++ b/lib/libjove/include/arch/x86_64/object-pagemap.h
@@ -0,0 +1,14 @@
+#ifndef _LIBJOVE_ARCH_x86_64_OBJECT_PAGEMAP_H
+#define _LIBJOVE_ARCH_x86_64_OBJECT_PAGEMAP_H 1
+
+#include <jove/object-typed.h>
+
+typedef struct KernelObjectPageMapping
+{
+ KernelObjectTyped typed;
+ uint8_t level;
+} KernelObjectPageMapping;
+
+
+
+#endif
diff --git a/lib/libjove/include/arch/x86_64/syscall.h b/lib/libjove/include/arch/x86_64/syscall.h
new file mode 100644
index 0000000..1d7df53
--- /dev/null
+++ b/lib/libjove/include/arch/x86_64/syscall.h
@@ -0,0 +1,12 @@
+#ifndef _LIBJOVE_ARCH_x86_64_SYSCALL_H
+#define _LIBJOVE_ARCH_x86_64_SYSCALL_H 1
+
+#include <stdint.h>
+
+#include <kernel/object.h>
+#include <jove/object-path.h>
+
+int _syscall_invoke_mapping_get(KernelObjectPath path, uint16_t pmli, KernelObjectPath destPath);
+
+
+#endif
diff --git a/lib/libjove/include/jove.h b/lib/libjove/include/jove.h
new file mode 100644
index 0000000..2efef3e
--- /dev/null
+++ b/lib/libjove/include/jove.h
@@ -0,0 +1,13 @@
+#ifndef _LIBJOVE_JOVE_H
+#define _LIBJOVE_JOVE_H 1
+
+#include <stdint.h>
+
+extern uintmax_t _syscall_message_box;
+extern void *_syscall_message_ptr;
+
+void libjove_init(uintmax_t box, void *boxptr);
+
+void jove_kprintf(const char *restrict fmt, ...);
+
+#endif
diff --git a/lib/libjove/include/object-dir.h b/lib/libjove/include/object-dir.h
new file mode 100644
index 0000000..f258089
--- /dev/null
+++ b/lib/libjove/include/object-dir.h
@@ -0,0 +1,17 @@
+#ifndef _LIBJOVE_OBJDIR_H
+#define _LIBJOVE_OBJDIR_H 1
+
+#include <stdint.h>
+#include <stddef.h>
+#include <kernel/object.h>
+
+#include <jove/object-typed.h>
+
+/**@STRUCT Represents a kobjdir.*/
+typedef struct _KernelObjectDirectory {
+ KernelObjectTyped typed;
+ KernelObjectTyped *children[256];
+} KernelObjectDirectory;
+extern KernelObjectDirectory __rootdir;
+
+#endif
diff --git a/lib/libjove/include/object-message.h b/lib/libjove/include/object-message.h
new file mode 100644
index 0000000..a4b7d35
--- /dev/null
+++ b/lib/libjove/include/object-message.h
@@ -0,0 +1,13 @@
+#ifndef _LIBJOVE_OBJECT_MESSAGE_H
+#define _LIBJOVE_OBJECT_MESSAGE_H 1
+
+#include <jove/object-typed.h>
+
+typedef struct _KernelObjectMessage
+{
+ KernelObjectTyped typed;
+ uint16_t pages;
+ void *data;
+} KernelObjectMessage;
+
+#endif
diff --git a/lib/libjove/include/object-typed.h b/lib/libjove/include/object-typed.h
new file mode 100644
index 0000000..750cf08
--- /dev/null
+++ b/lib/libjove/include/object-typed.h
@@ -0,0 +1,15 @@
+#ifndef _LIBJOVE_OBJPATH_H
+#define _LIBJOVE_OBJPATH_H 1
+
+#include <stddef.h>
+#include <stdint.h>
+#include <kernel/object.h>
+
+typedef struct KernelObjectTyped
+{
+ void *parent;
+ obj_type_t type;
+ uint8_t membi;
+} KernelObjectTyped;
+
+#endif
diff --git a/lib/libjove/include/object-untyped.h b/lib/libjove/include/object-untyped.h
new file mode 100644
index 0000000..ea1185d
--- /dev/null
+++ b/lib/libjove/include/object-untyped.h
@@ -0,0 +1,39 @@
+#ifndef _LIBJOVE_OBJECT_UNTYPED_H
+#define _LIBJOVE_OBJECT_UNTYPED_H 1
+
+#include <jove/object-typed.h>
+
+/**@STRUCT Represents a KO_MEMOY_UNTYPED*/
+typedef struct KernelObjectUntyped
+{
+ KernelObjectTyped typed;
+ size_t bytes, alignment;
+} KernelObjectUntyped;
+
+/**@FUNC Gets the size of the given untyped memory block.
+ * @PARAM untyped block of memory to get size of.
+ * @PARAM bytes address to put size variable into.
+ * @RETURN error code. 0 on success.*/
+int jove_untyped_size(KernelObjectUntyped *untyped, size_t *bytes);
+
+/**@FUNC Splits an untyped block of memory into a given size and the remainder.
+ * @PARAM untyped block of memory to split.
+ * @PARAM bytes number of bytes to split for.
+ * @PARAM dest destination slot to place the new block.
+ * @RETURN error code. 0 on success.*/
+int jove_untyped_split(KernelObjectUntyped *untyped, size_t bytes, KernelObjectUntyped *dest);
+
+/**@FUNC Merges two untyped memory blocks into a single memory block.
+ * The two blocks are expected to be adjacent.
+ * If successful, b is merged _into_ a and becomes empty.
+ * @PARAM a first block.
+ * @PARAM b second block.
+ * @RETURN error code. 0 on success.*/
+int jove_untyped_merge(KernelObjectUntyped *a, KernelObjectUntyped *b);
+
+/**@FUNC Gets the page alignment of the given untyped memory block.
+ * @PARAM untyped block of memory to get alignment of.
+ * @PARAM align pointer to returned value.
+ * @RETURN error code. 0 on success.*/
+int jove_untyped_alignment(KernelObjectUntyped *untyped, size_t *align);
+#endif
diff --git a/lib/libjove/include/object.h b/lib/libjove/include/object.h
new file mode 100644
index 0000000..5b0cc82
--- /dev/null
+++ b/lib/libjove/include/object.h
@@ -0,0 +1,11 @@
+#ifndef _LIBJOVE_OBJECT_H
+#define _LIBJOVE_OBJECT_H 1
+
+#include <jove/object-typed.h>
+#include <jove/object-dir.h>
+#include <jove/object-untyped.h>
+#include <jove/object-message.h>
+
+#define JOVE_OBJECT_TYPED(o) (KernelObjectTyped*)o
+
+#endif
diff --git a/lib/libjove/include/path-fromobj.h b/lib/libjove/include/path-fromobj.h
new file mode 100644
index 0000000..252be29
--- /dev/null
+++ b/lib/libjove/include/path-fromobj.h
@@ -0,0 +1,13 @@
+#ifndef _LIBJOVE_PATH_FROMOBJ_H
+#define _LIBJOVE_PATH_FROMOBJ_H 1
+
+#include <jove/object-typed.h>
+#include <kernel/object.h>
+
+int path_fromobj_s(KernelObjectTyped *obj, uint8_t *buffer, int size);
+inline int path_fromobj(KernelObjectTyped *obj, uint8_t *buffer)
+{ return path_fromobj_s(obj, buffer, -1); }
+
+int path_tobuf(KernelObjectTyped *obj, uint8_t *buffer, size_t at, size_t bufferw);
+
+#endif
diff --git a/lib/libjove/include/syscall.h b/lib/libjove/include/syscall.h
new file mode 100644
index 0000000..432be85
--- /dev/null
+++ b/lib/libjove/include/syscall.h
@@ -0,0 +1,35 @@
+#ifndef _LIBJOVE_SYSCALL_H
+#define _LIBJOVE_SYSCALL_H 1
+
+#include <stdint.h>
+
+#include <kernel/object.h>
+#include <jove/object.h>
+
+#define SYSCALL_PAYLOAD_PUTL(buf, at, v, type) \
+ if(at + sizeof(type) > KO_MESSAGE_BYTES) return -1; \
+ *((type*)(&buf[at])) = v; \
+ at += sizeof(type)
+
+#define SYSCALL_PAYLOAD_SAVEPTR(buf, at, type, val) \
+ if(at + sizeof(type) >= KO_MESSAGE_BYTES) return -1; \
+ val = (type*)(&buf[at]); \
+ at += sizeof(type)
+
+#define SYSCALL_PAYLOAD_PUTOBJ(buf, at, obj) \
+ at = path_tobuf(JOVE_OBJECT_TYPED(obj), buf, at, KO_MESSAGE_BYTES); \
+ if(at < 0) return at
+
+
+int _syscall_invoke(void);
+void _syscall_debug_putc(char c);
+
+int _syscall_invoke_objdir_nmemb(KernelObjectDirectory *dir, uint8_t *result);
+int _syscall_invoke_objdir_getmemb(KernelObjectDirectory *dir, uint8_t member, obj_type_t *result);
+
+int _syscall_invoke_untyped_size(KernelObjectUntyped *untyped, size_t *bytes);
+int _syscall_invoke_untyped_split(KernelObjectUntyped *path, size_t bytes, KernelObjectUntyped *dest);
+int _syscall_invoke_untyped_merge(KernelObjectUntyped *a, KernelObjectUntyped *b);
+int _syscall_invoke_untyped_alignment(KernelObjectUntyped *path, size_t *alignment);
+
+#endif