1 #ifndef _IPXE_UACCESS_H 2 #define _IPXE_UACCESS_H 36 #define UNULL ( ( userptr_t ) 0 ) 70 return ( (
void * ) userptr +
offset );
82 return ( userptr +
offset );
185 return ( found ? ( found - (
void * )
buffer ) : -1 );
197 #define UACCESS_INLINE( _subsys, _api_func ) \ 198 SINGLE_API_INLINE ( UACCESS_PREFIX_ ## _subsys, _api_func ) 207 #define PROVIDE_UACCESS( _subsys, _api_func, _func ) \ 208 PROVIDE_SINGLE_API ( UACCESS_PREFIX_ ## _subsys, _api_func, _func ) 216 #define PROVIDE_UACCESS_INLINE( _subsys, _api_func ) \ 217 PROVIDE_SINGLE_API_INLINE ( UACCESS_PREFIX_ ## _subsys, _api_func ) 224 #include <bits/uaccess.h> static __always_inline int off_t userptr_t off_t second_off
static __always_inline size_t trivial_strlen_user(userptr_t buffer, off_t offset)
Find length of NUL-terminated string in user buffer.
static __always_inline void off_t int c
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.
uint32_t first
First block in range.
static __always_inline void * trivial_user_to_virt(userptr_t userptr, off_t offset)
Convert user pointer to virtual address.
off_t memchr_user(userptr_t userptr, off_t offset, int c, size_t len)
Find character in user buffer.
static __always_inline void copy_from_user(void *dest, userptr_t src, off_t src_off, size_t len)
Copy data from user buffer.
unsigned long user_to_phys(userptr_t userptr, off_t offset)
Convert user pointer to physical address.
iPXE user access API for Linux
static __always_inline int off_t first_off
static __always_inline userptr_t trivial_userptr_add(userptr_t userptr, off_t offset)
Add offset to user pointer.
userptr_t phys_to_user(unsigned long phys_addr)
Convert physical address to user pointer.
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.
uint32_t buffer
Buffer index (or NETVSC_RNDIS_NO_BUFFER)
static __always_inline unsigned long virt_to_phys(volatile const void *addr)
Convert virtual address to a physical address.
static __always_inline off_t trivial_memchr_user(userptr_t buffer, off_t offset, int c, size_t len)
Find character in user buffer.
void * memchr(const void *src, int character, size_t len)
Find character within a memory region.
off_t userptr_sub(userptr_t userptr, userptr_t subtrahend)
Subtract user pointers.
static __always_inline void * phys_to_virt(unsigned long phys_addr)
Convert physical address to a virtual address.
void memset_user(userptr_t userptr, off_t offset, int c, size_t len)
Fill user buffer with a constant byte.
userptr_t userptr_add(userptr_t userptr, off_t offset)
Add offset to user pointer.
void * memcpy(void *dest, const void *src, size_t len) __nonnull
uint32_t userptr_t
A pointer to a user buffer.
static __always_inline void off_t userptr_t off_t src_off
#define __always_inline
Declare a function to be always inline.
static __always_inline void copy_to_user(userptr_t dest, off_t dest_off, const void *src, size_t len)
Copy data to user buffer.
size_t strlen(const char *src)
Get length of string.
iPXE user access API for EFI
FILE_LICENCE(GPL2_OR_LATER_OR_UBDL)
void * memmove(void *dest, const void *src, size_t len) __nonnull
static __always_inline void off_t dest_off
static __always_inline off_t trivial_userptr_sub(userptr_t userptr, userptr_t subtrahend)
Subtract user pointers.
size_t strlen_user(userptr_t userptr, off_t offset)
Find length of NUL-terminated string in user buffer.
int memcmp_user(userptr_t first, off_t first_off, userptr_t second, off_t second_off, size_t len)
Compare data between user buffers.
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.
userptr_t virt_to_user(volatile const void *addr)
Convert virtual address to user pointer.
void * user_to_virt(userptr_t userptr, off_t offset)
Convert user pointer to virtual address.
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
void 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.
uint16_t offset
Offset to command line.
static __always_inline off_t userptr_t subtrahend
static __always_inline userptr_t trivial_virt_to_user(volatile const void *addr)
Convert virtual address to user pointer.
int memcmp(const void *first, const void *second, size_t len)
Compare memory regions.
static __always_inline int off_t userptr_t second
void memcpy_user(userptr_t dest, off_t dest_off, userptr_t src, off_t src_off, size_t len)
Copy data between user buffers.
unsigned long userptr_t
A pointer to a user buffer.
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.
void * memset(void *dest, int character, size_t len) __nonnull