diff options
author | dzwdz | 2021-09-11 18:04:57 +0200 |
---|---|---|
committer | dzwdz | 2021-09-11 18:04:57 +0200 |
commit | af2f9184e03015dc3b188ea437bbf496638000ce (patch) | |
tree | 4b4186d8df73bc1b96e14e5c8eadcf1a4f66692a /src/kernel/mem | |
parent | 0994192f6cab853f4a49ac73aa63f6820c886ec2 (diff) |
replace `user_ptr` with a linux-style `__user` annotation
Diffstat (limited to 'src/kernel/mem')
-rw-r--r-- | src/kernel/mem/virt.c | 14 | ||||
-rw-r--r-- | src/kernel/mem/virt.h | 8 |
2 files changed, 11 insertions, 11 deletions
diff --git a/src/kernel/mem/virt.c b/src/kernel/mem/virt.c index c3a1fca..e0d8e44 100644 --- a/src/kernel/mem/virt.c +++ b/src/kernel/mem/virt.c @@ -3,7 +3,7 @@ #include <kernel/util.h> void virt_iter_new( - struct virt_iter *iter, user_ptr virt, size_t length, + struct virt_iter *iter, void __user *virt, size_t length, struct pagedir *pages, bool user, bool writeable) { iter->frag = 0; @@ -29,8 +29,8 @@ bool virt_iter_next(struct virt_iter *iter) { if (iter->_pages) { // if iterating over virtual memory // don't read past the page - if ((iter->_virt & PAGE_MASK) + partial > PAGE_SIZE) - partial = PAGE_SIZE - (iter->_virt & PAGE_MASK); + if (((uintptr_t)iter->_virt & PAGE_MASK) + partial > PAGE_SIZE) + partial = PAGE_SIZE - ((uintptr_t)iter->_virt & PAGE_MASK); iter->frag = pagedir_virt2phys(iter->_pages, iter->_virt, iter->_user, iter->_writeable); @@ -51,14 +51,14 @@ bool virt_iter_next(struct virt_iter *iter) { } bool virt_cpy( - struct pagedir *dest_pages, user_ptr dest, - struct pagedir *src_pages, const user_ptr src, size_t length) + struct pagedir *dest_pages, void __user *dest, + struct pagedir *src_pages, const void __user *src, size_t length) { struct virt_iter dest_iter, src_iter; size_t min; - virt_iter_new(&dest_iter, dest, length, dest_pages, true, true); - virt_iter_new( &src_iter, src, length, src_pages, true, false); + virt_iter_new(&dest_iter, dest, length, dest_pages, true, true); + virt_iter_new( &src_iter, (userptr_t)src, length, src_pages, true, false); dest_iter.frag_len = 0; src_iter.frag_len = 0; diff --git a/src/kernel/mem/virt.h b/src/kernel/mem/virt.h index 38410fb..7dac887 100644 --- a/src/kernel/mem/virt.h +++ b/src/kernel/mem/virt.h @@ -10,7 +10,7 @@ struct virt_iter { size_t prior; // sum of all prior frag_lens bool error; - user_ptr _virt; + void __user *_virt; size_t _remaining; struct pagedir *_pages; bool _user; @@ -19,11 +19,11 @@ struct virt_iter { /* if pages == NULL, create an iterator over physical memory. */ void virt_iter_new( - struct virt_iter *iter, user_ptr virt, size_t length, + struct virt_iter *iter, void __user *virt, size_t length, struct pagedir *pages, bool user, bool writeable); bool virt_iter_next(struct virt_iter *); bool virt_cpy( - struct pagedir *dest_pages, user_ptr dest, - struct pagedir *src_pages, const user_ptr src, size_t length); + struct pagedir *dest_pages, void __user *dest, + struct pagedir *src_pages, const void __user *src, size_t length); |