diff options
author | dzwdz | 2021-09-05 18:32:08 +0200 |
---|---|---|
committer | dzwdz | 2021-09-05 18:32:08 +0200 |
commit | 838b142b7374150df63ec02b02377c114a14b314 (patch) | |
tree | b5b22e5517da7a4ac96a47f0cfe6a4755d00da44 /src/kernel/mem/virt.h | |
parent | d6c1dceba2511fa2edf839942b237d3a27bb9535 (diff) |
move most of the memory stuff to kernel/mem/
Diffstat (limited to 'src/kernel/mem/virt.h')
-rw-r--r-- | src/kernel/mem/virt.h | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/src/kernel/mem/virt.h b/src/kernel/mem/virt.h new file mode 100644 index 0000000..98a7a16 --- /dev/null +++ b/src/kernel/mem/virt.h @@ -0,0 +1,28 @@ +/* contains utilities for interacting with virtual memory */ +#pragma once +#include <kernel/types.h> +#include <stdbool.h> +#include <stddef.h> + +struct virt_iter { + void *frag; + size_t frag_len; + size_t prior; // sum of all prior frag_lens + bool error; + + user_ptr _virt; + size_t _remaining; + struct pagedir *_pages; + bool _user; + bool _writeable; +}; + +void virt_iter_new( + struct virt_iter *iter, user_ptr virt, size_t length, + struct pagedir *pages, bool user, bool writeable); + +bool virt_iter_next(struct virt_iter *); + +bool virt_user_cpy( + struct pagedir *dest_pages, user_ptr dest, + struct pagedir *src_pages, const user_ptr src, size_t length); |