iPXE
Macros | Functions | Variables
linux_uaccess.h File Reference

iPXE user access API for Linux More...

Go to the source code of this file.

Macros

#define UACCESS_PREFIX_linux   __linux_
 

Functions

 FILE_LICENCE (GPL2_OR_LATER_OR_UBDL)
 
static __always_inline unsigned long UACCESS_INLINE (linux, user_to_phys)(userptr_t userptr
 Convert user buffer to physical address. More...
 
static __always_inline userptr_t UACCESS_INLINE (linux, virt_to_user)(volatile const void *addr)
 
static __always_inline void * UACCESS_INLINE (linux, user_to_virt)(userptr_t userptr
 
static __always_inline userptr_t UACCESS_INLINE (linux, userptr_add)(userptr_t userptr
 
static __always_inline off_t UACCESS_INLINE (linux, userptr_sub)(userptr_t userptr
 
static __always_inline void UACCESS_INLINE (linux, memcpy_user)(userptr_t dest
 
static __always_inline void UACCESS_INLINE (linux, memmove_user)(userptr_t dest
 
static __always_inline int UACCESS_INLINE (linux, memcmp_user)(userptr_t first
 
static __always_inline void UACCESS_INLINE (linux, memset_user)(userptr_t buffer
 
static __always_inline size_t UACCESS_INLINE (linux, strlen_user)(userptr_t buffer
 
static __always_inline off_t UACCESS_INLINE (linux, memchr_user)(userptr_t buffer
 

Variables

static __always_inline unsigned long off_t offset
 
static __always_inline off_t userptr_t subtrahend
 
static __always_inline void off_t dest_off
 
static __always_inline void off_t userptr_t src
 
static __always_inline void off_t userptr_t off_t src_off
 
static __always_inline void off_t userptr_t off_t size_t len
 
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
 
static __always_inline void off_t int c
 

Detailed Description

iPXE user access API for Linux

We run with no distinction between internal and external addresses, so can use trivial_virt_to_user() et al.

We have no concept of the underlying physical addresses, since these are not exposed to userspace. We provide a stub implementation of user_to_phys() since this is required by alloc_memblock(). We provide no implementation of phys_to_user(); any code attempting to access physical addresses will therefore (correctly) fail to link.

Definition in file linux_uaccess.h.

Macro Definition Documentation

◆ UACCESS_PREFIX_linux

#define UACCESS_PREFIX_linux   __linux_

Definition at line 24 of file linux_uaccess.h.

Function Documentation

◆ FILE_LICENCE()

FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL  )

◆ UACCESS_INLINE() [1/11]

static __always_inline unsigned long UACCESS_INLINE ( linux  ,
user_to_phys   
)
inlinestatic

Convert user buffer to physical address.

Parameters
userptrUser pointer
offsetOffset from user pointer
Return values
phys_addrPhysical address

◆ UACCESS_INLINE() [2/11]

static __always_inline userptr_t UACCESS_INLINE ( linux  ,
virt_to_user   
) const volatile
inlinestatic

Definition at line 50 of file linux_uaccess.h.

50  {
51  return trivial_virt_to_user ( addr );
52 }
u32 addr
Definition: sky2.h:8
static __always_inline userptr_t trivial_virt_to_user(volatile const void *addr)
Convert virtual address to user pointer.
Definition: uaccess.h:55

References addr, and trivial_virt_to_user().

◆ UACCESS_INLINE() [3/11]

static __always_inline void* UACCESS_INLINE ( linux  ,
user_to_virt   
)
inlinestatic

◆ UACCESS_INLINE() [4/11]

static __always_inline userptr_t UACCESS_INLINE ( linux  ,
userptr_add   
)
inlinestatic

◆ UACCESS_INLINE() [5/11]

static __always_inline off_t UACCESS_INLINE ( linux  ,
userptr_sub   
)
inlinestatic

◆ UACCESS_INLINE() [6/11]

static __always_inline void UACCESS_INLINE ( linux  ,
memcpy_user   
)
inlinestatic

◆ UACCESS_INLINE() [7/11]

static __always_inline void UACCESS_INLINE ( linux  ,
memmove_user   
)
inlinestatic

◆ UACCESS_INLINE() [8/11]

static __always_inline int UACCESS_INLINE ( linux  ,
memcmp_user   
)
inlinestatic

◆ UACCESS_INLINE() [9/11]

static __always_inline void UACCESS_INLINE ( linux  ,
memset_user   
)
inlinestatic

◆ UACCESS_INLINE() [10/11]

static __always_inline size_t UACCESS_INLINE ( linux  ,
strlen_user   
)
inlinestatic

◆ UACCESS_INLINE() [11/11]

static __always_inline off_t UACCESS_INLINE ( linux  ,
memchr_user   
)
inlinestatic

Variable Documentation

◆ offset

Initial value:
{
return ( userptr + offset )
static __always_inline unsigned long off_t offset
Definition: linux_uaccess.h:35

Definition at line 35 of file linux_uaccess.h.

◆ subtrahend

Initial value:
{
return trivial_userptr_sub ( userptr, subtrahend )
static __always_inline off_t trivial_userptr_sub(userptr_t userptr, userptr_t subtrahend)
Subtract user pointers.
Definition: uaccess.h:93
static __always_inline off_t userptr_t subtrahend
Definition: linux_uaccess.h:66

Definition at line 66 of file linux_uaccess.h.

◆ dest_off

__always_inline void off_t dest_off

Definition at line 71 of file linux_uaccess.h.

◆ src

Definition at line 71 of file linux_uaccess.h.

◆ src_off

Definition at line 71 of file linux_uaccess.h.

◆ len

Initial value:
{
static __always_inline void off_t userptr_t off_t src_off
Definition: linux_uaccess.h:71
static __always_inline void off_t dest_off
Definition: linux_uaccess.h:71
static __always_inline void off_t userptr_t off_t size_t len
Definition: linux_uaccess.h:73
static void * dest
Definition: strings.h:176
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.
Definition: uaccess.h:107
static __always_inline void off_t userptr_t src
Definition: linux_uaccess.h:71

Definition at line 73 of file linux_uaccess.h.

◆ first_off

__always_inline int off_t first_off

Definition at line 85 of file linux_uaccess.h.

◆ second

Definition at line 85 of file linux_uaccess.h.

◆ second_off

Definition at line 85 of file linux_uaccess.h.

◆ c

Definition at line 92 of file linux_uaccess.h.