summaryrefslogtreecommitdiffstats
path: root/lib/libjove/include/arch
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libjove/include/arch')
-rw-r--r--lib/libjove/include/arch/x86_64/object-pagemap.h44
-rw-r--r--lib/libjove/include/arch/x86_64/syscall.h12
2 files changed, 51 insertions, 5 deletions
diff --git a/lib/libjove/include/arch/x86_64/object-pagemap.h b/lib/libjove/include/arch/x86_64/object-pagemap.h
index 55b0570..48e959e 100644
--- a/lib/libjove/include/arch/x86_64/object-pagemap.h
+++ b/lib/libjove/include/arch/x86_64/object-pagemap.h
@@ -2,13 +2,51 @@
#define _LIBJOVE_ARCH_x86_64_OBJECT_PAGEMAP_H 1
#include <jove/object-typed.h>
+#include <jove/object-dir.h>
+#include <jove/object-untyped.h>
-typedef struct KernelObjectPageMapping
+typedef struct KernelObjectPageMap
{
KernelObjectTyped typed;
- uint8_t level;
-} KernelObjectPageMapping;
+} KernelObjectPageMap;
+KernelObjectPageMap *jove_object_as_pagemap(KernelObjectTyped *typed);
+/**@FUNC Populates a given region of memory for a page map value.
+ * @PARAM pagemap address of pagemap cache object.
+ * @PARAM dir directory this memory is a member of.
+ * @PARAM memb index into directory to place object.*/
+void _jove_alloc_pagemap_inplace(
+ KernelObjectPageMap *pagemap,
+ KernelObjectDirectory *dir,
+ uint8_t memb);
+
+/**@FUNC Allocates a region of memory to represent a page map.
+ * @PARAM dir directory to place new value in.
+ * @PARAM memb index into directory to place object.
+ * @RETURN newly allocated object. NULL on failure.
+ * Possible failures:
+ * EJOVE_FULL: Slot is already taken by an existing object.
+ * EJOVE_NOALLOC: libjove does not have an allocator yet.*/
+KernelObjectPageMap* _jove_alloc_pagemap(
+ KernelObjectDirectory *dir,
+ uint8_t memb);
+
+int jove_pagemap_exists(
+ KernelObjectPageMap *map,
+ uint8_t depth,
+ uint16_t *path);
+
+JoveError jove_pagemap_map(
+ KernelObjectPageMap *map,
+ uint8_t depth,
+ uint16_t *path,
+ KernelObjectUntyped *page);
+
+JoveError jove_pagemap_map_unmap(
+ KernelObjectPageMap *map,
+ uint8_t depth,
+ uint16_t *path,
+ KernelObjectUntyped *dest);
#endif
diff --git a/lib/libjove/include/arch/x86_64/syscall.h b/lib/libjove/include/arch/x86_64/syscall.h
index 1d7df53..74fb389 100644
--- a/lib/libjove/include/arch/x86_64/syscall.h
+++ b/lib/libjove/include/arch/x86_64/syscall.h
@@ -4,9 +4,17 @@
#include <stdint.h>
#include <kernel/object.h>
-#include <jove/object-path.h>
+#include <jove/arch/x86_64/object-pagemap.h>
+#include <jove/syscall.h>
-int _syscall_invoke_mapping_get(KernelObjectPath path, uint16_t pmli, KernelObjectPath destPath);
+#define SYSCALL_PAYLOAD_PUTPML(payload, payload_at, depth, path) \
+ if(payload_at + 1 + ((depth + 1) * sizeof(uint16_t)) > KO_MESSAGE_BYTES) return -1; \
+ *((uint8_t*)&payload[payload_at++]) = depth; \
+ for(uint8_t i = 0; i < depth + 1; i++) *((uint16_t*)&payload[payload_at + (i * 2)]) = path[i]; \
+ payload_at += (depth + 1) * 2
+int _syscall_invoke_mapping_exists(KernelObjectPageMap *map, uint8_t depth, uint16_t *path);
+int _syscall_invoke_mapping_map(KernelObjectPageMap *map, uint8_t depth, uint16_t *path, KernelObjectUntyped *untyped);
+int _syscall_invoke_mapping_unmap(KernelObjectPageMap *map, uint8_t depth, uint16_t *path, KernelObjectUntyped *dest);
#endif