User access API implementations that can be used by environments in which virtual addresses allow access to all of memory.
More...
|
static __always_inline userptr_t | trivial_virt_to_user (volatile const void *addr) |
| Convert virtual address to user pointer. More...
|
|
static __always_inline void * | trivial_user_to_virt (userptr_t userptr, off_t offset) |
| Convert user pointer to virtual address. More...
|
|
static __always_inline userptr_t | trivial_userptr_add (userptr_t userptr, off_t offset) |
| Add offset to user pointer. More...
|
|
static __always_inline off_t | trivial_userptr_sub (userptr_t userptr, userptr_t subtrahend) |
| Subtract user pointers. More...
|
|
static __always_inline void | trivial_memcpy_user (userptr_t dest, off_t dest_off, userptr_t src, off_t src_off, size_t len) |
| Copy data between user buffers. More...
|
|
static __always_inline void | trivial_memmove_user (userptr_t dest, off_t dest_off, userptr_t src, off_t src_off, size_t len) |
| Copy data between user buffers, allowing for overlap. More...
|
|
static __always_inline int | trivial_memcmp_user (userptr_t first, off_t first_off, userptr_t second, off_t second_off, size_t len) |
| Compare data between user buffers. More...
|
|
static __always_inline void | trivial_memset_user (userptr_t buffer, off_t offset, int c, size_t len) |
| Fill user buffer with a constant byte. More...
|
|
static __always_inline size_t | trivial_strlen_user (userptr_t buffer, off_t offset) |
| Find length of NUL-terminated string in user buffer. More...
|
|
static __always_inline off_t | trivial_memchr_user (userptr_t buffer, off_t offset, int c, size_t len) |
| Find character in user buffer. More...
|
|
User access API implementations that can be used by environments in which virtual addresses allow access to all of memory.
◆ trivial_virt_to_user()
Convert virtual address to user pointer.
- Parameters
-
- Return values
-
Definition at line 61 of file uaccess.h.
uint32_t userptr_t
A pointer to a user buffer.
References addr.
Referenced by UACCESS_INLINE().
◆ trivial_user_to_virt()
Convert user pointer to virtual address.
- Parameters
-
userptr | User pointer |
offset | Offset from user pointer |
- Return values
-
This operation is not available under all memory models.
Definition at line 75 of file uaccess.h.
76 return ( (
void * ) userptr +
offset );
static __always_inline unsigned long off_t offset
References offset.
◆ trivial_userptr_add()
Add offset to user pointer.
- Parameters
-
userptr | User pointer |
offset | Offset |
- Return values
-
Definition at line 87 of file uaccess.h.
88 return ( userptr +
offset );
static __always_inline unsigned long off_t offset
References offset.
◆ trivial_userptr_sub()
Subtract user pointers.
- Parameters
-
userptr | User pointer |
subtrahend | User pointer to be subtracted |
- Return values
-
Definition at line 99 of file uaccess.h.
static __always_inline off_t userptr_t subtrahend
References subtrahend.
◆ trivial_memcpy_user()
Copy data between user buffers.
- Parameters
-
dest | Destination |
dest_off | Destination offset |
src | Source |
src_off | Source offset |
len | Length |
Definition at line 113 of file uaccess.h.
static __always_inline void off_t userptr_t off_t size_t len
static __always_inline void off_t userptr_t src
void * memcpy(void *dest, const void *src, size_t len) __nonnull
static __always_inline void off_t dest_off
static __always_inline void off_t userptr_t off_t src_off
if(len >=6 *4) __asm__ __volatile__("movsl" if(len >=5 *4) __asm__ __volatile__("movsl" if(len >=4 *4) __asm__ __volatile__("movsl" if(len >=3 *4) __asm__ __volatile__("movsl" if(len >=2 *4) __asm__ __volatile__("movsl" if(len >=1 *4) __asm__ __volatile__("movsl" if((len % 4) >=2) __asm__ __volatile__("movsw" if((len % 2) >=1) __asm__ __volatile__("movsb" return dest
References dest, dest_off, len, memcpy(), src, and src_off.
◆ trivial_memmove_user()
Copy data between user buffers, allowing for overlap.
- Parameters
-
dest | Destination |
dest_off | Destination offset |
src | Source |
src_off | Source offset |
len | Length |
Definition at line 129 of file uaccess.h.
static __always_inline void off_t userptr_t off_t size_t len
static __always_inline void off_t userptr_t src
static __always_inline void off_t dest_off
static __always_inline void off_t userptr_t off_t src_off
void * memmove(void *dest, const void *src, size_t len) __nonnull
if(len >=6 *4) __asm__ __volatile__("movsl" if(len >=5 *4) __asm__ __volatile__("movsl" if(len >=4 *4) __asm__ __volatile__("movsl" if(len >=3 *4) __asm__ __volatile__("movsl" if(len >=2 *4) __asm__ __volatile__("movsl" if(len >=1 *4) __asm__ __volatile__("movsl" if((len % 4) >=2) __asm__ __volatile__("movsw" if((len % 2) >=1) __asm__ __volatile__("movsb" return dest
References dest, dest_off, len, memmove(), src, and src_off.
◆ trivial_memcmp_user()
Compare data between user buffers.
- Parameters
-
first | First buffer |
first_off | First buffer offset |
second | Second buffer |
second_off | Second buffer offset |
len | Length |
- Return values
-
Definition at line 146 of file uaccess.h.
static __always_inline void off_t userptr_t off_t size_t len
uint32_t first
First block in range.
static __always_inline int off_t first_off
static __always_inline int off_t userptr_t second
static __always_inline int off_t userptr_t off_t second_off
int memcmp(const void *first, const void *second, size_t len)
Compare memory regions.
References first, first_off, len, memcmp(), second, and second_off.
◆ trivial_memset_user()
Fill user buffer with a constant byte.
- Parameters
-
buffer | User buffer |
offset | Offset within buffer |
c | Constant byte with which to fill |
len | Length |
Definition at line 161 of file uaccess.h.
static __always_inline void off_t userptr_t off_t size_t len
uint32_t buffer
Buffer index (or NETVSC_RNDIS_NO_BUFFER)
static __always_inline unsigned long off_t offset
static __always_inline void off_t int c
void * memset(void *dest, int character, size_t len) __nonnull
References buffer, c, len, memset(), and offset.
◆ trivial_strlen_user()
Find length of NUL-terminated string in user buffer.
- Parameters
-
buffer | User buffer |
offset | Offset within buffer |
- Return values
-
len | Length of string (excluding NUL) |
Definition at line 173 of file uaccess.h.
uint32_t buffer
Buffer index (or NETVSC_RNDIS_NO_BUFFER)
size_t strlen(const char *src)
Get length of string.
static __always_inline unsigned long off_t offset
References buffer, offset, and strlen().
◆ trivial_memchr_user()
Find character in user buffer.
- Parameters
-
buffer | User buffer |
offset | Starting offset within buffer |
c | Character to search for |
len | Length of user buffer |
- Return values
-
offset | Offset of character, or <0 if not found |
Definition at line 187 of file uaccess.h.
191 return ( found ? ( found - (
void * )
buffer ) : -1 );
static __always_inline void off_t userptr_t off_t size_t len
uint32_t buffer
Buffer index (or NETVSC_RNDIS_NO_BUFFER)
void * memchr(const void *src, int character, size_t len)
Find character within a memory region.
static __always_inline unsigned long off_t offset
static __always_inline void off_t int c
References buffer, c, len, memchr(), and offset.