summaryrefslogtreecommitdiffstats
path: root/lib/libjove/memory.c
diff options
context:
space:
mode:
authorJon Santmyer <jon@jonsantmyer.com>2025-08-24 16:05:30 -0400
committerJon Santmyer <jon@jonsantmyer.com>2025-08-24 16:05:30 -0400
commitf0248ad1724f9fbdd372db4da8ee8f956ae6aacd (patch)
tree4d661f264a64c562b56a801d3b6a5373415e42d4 /lib/libjove/memory.c
parent18c389411a0f6283c1b6dffc78bbcfcb237e367b (diff)
downloadjove-os-f0248ad1724f9fbdd372db4da8ee8f956ae6aacd.tar.gz
jove-os-f0248ad1724f9fbdd372db4da8ee8f956ae6aacd.tar.bz2
jove-os-f0248ad1724f9fbdd372db4da8ee8f956ae6aacd.zip
libc heap impl
Diffstat (limited to 'lib/libjove/memory.c')
-rw-r--r--lib/libjove/memory.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/lib/libjove/memory.c b/lib/libjove/memory.c
new file mode 100644
index 0000000..db76528
--- /dev/null
+++ b/lib/libjove/memory.c
@@ -0,0 +1,23 @@
+#include <jove/memory.h>
+
+JoveError
+jove_mem_ensure_w(uintptr_t start, size_t pages)
+{
+ start &= ~0xFFFULL;
+ for(size_t i = 0; i < pages; i++) {
+ uintptr_t at = start + (i << 12);
+ JoveError e = jove_mem_ensure(at);
+ if(e) return e;
+ }
+ return EJOVE_OK;
+}
+
+JoveError
+jove_mem_ensure_range(uintptr_t start, uintptr_t end)
+{
+ start &= ~0xFFFULL;
+ if(end & 0xFFF)
+ end += 0x1000 - (end & 0xFFF);
+
+ return jove_mem_ensure_w(start, (end - start) >> 12);
+}