diff options
author | dzwdz | 2021-09-11 18:22:21 +0200 |
---|---|---|
committer | dzwdz | 2021-09-11 18:22:21 +0200 |
commit | e1789ffa14826e0c7378f974ac68c2c04ba8640c (patch) | |
tree | 933b920fd11ebcae1787be5efb1f062a5c2289bb /src/kernel/mem/virt.h | |
parent | af2f9184e03015dc3b188ea437bbf496638000ce (diff) |
add some helper functions for copying between virtual and physical memory
this was already possible, but now it's slightly safer
Diffstat (limited to 'src/kernel/mem/virt.h')
-rw-r--r-- | src/kernel/mem/virt.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/kernel/mem/virt.h b/src/kernel/mem/virt.h index 7dac887..78d0cb3 100644 --- a/src/kernel/mem/virt.h +++ b/src/kernel/mem/virt.h @@ -27,3 +27,14 @@ bool virt_iter_next(struct virt_iter *); bool virt_cpy( struct pagedir *dest_pages, void __user *dest, struct pagedir *src_pages, const void __user *src, size_t length); + + +inline bool virt_cpy_to(struct pagedir *dest_pages, // physical -> virtual + void __user *dest, const void *src, size_t length) { + return virt_cpy(dest_pages, dest, NULL, (userptr_t)src, length); +} + +inline bool virt_cpy_from(struct pagedir *src_pages, // virtual -> physical + void *dest, const void __user *src, size_t length) { + return virt_cpy(NULL, (userptr_t)dest, src_pages, src, length); +} |