[uaccess] Remove redundant virt_to_user() and userptr_t

Remove the last remaining traces of the concept of a user pointer,
leaving iPXE with a simpler and cleaner memory model that implicitly
assumes that all memory locations can be reached through pointer
dereferences.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
Michael Brown
2025-04-30 16:07:04 +01:00
parent a169d73593
commit 1534b0a6e9
6 changed files with 0 additions and 58 deletions

View File

@@ -5,9 +5,6 @@
*
* 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 virt_to_phys() since this is required by
@@ -57,9 +54,4 @@ UACCESS_INLINE ( linux, phys_to_virt ) ( physaddr_t phys ) {
return ( ( void * ) phys );
}
static inline __always_inline userptr_t
UACCESS_INLINE ( linux, virt_to_user ) ( volatile const void *addr ) {
return trivial_virt_to_user ( addr );
}
#endif /* _IPXE_LINUX_UACCESS_H */

View File

@@ -20,35 +20,6 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
#define UACCESS_PREFIX_flat __flat_
#endif
/**
* A pointer to a user buffer
*
*/
typedef void * userptr_t;
/**
* @defgroup uaccess_trivial Trivial user access API implementations
*
* User access API implementations that can be used by environments in
* which virtual addresses allow access to all of memory.
*
* @{
*
*/
/**
* Convert virtual address to user pointer
*
* @v addr Virtual address
* @ret userptr User pointer
*/
static inline __always_inline userptr_t
trivial_virt_to_user ( volatile const void *addr ) {
return ( ( userptr_t ) addr );
}
/** @} */
/**
* Calculate static inline user access API function name
*
@@ -88,25 +59,12 @@ UACCESS_INLINE ( flat, virt_to_phys ) ( volatile const void *virt ) {
return ( ( physaddr_t ) virt );
}
static inline __always_inline userptr_t
UACCESS_INLINE ( flat, virt_to_user ) ( volatile const void *addr ) {
return trivial_virt_to_user ( addr );
}
/* Include all architecture-independent user access API headers */
#include <ipxe/linux/linux_uaccess.h>
/* Include all architecture-dependent user access API headers */
#include <bits/uaccess.h>
/**
* Convert virtual address to user pointer
*
* @v addr Virtual address
* @ret userptr User pointer
*/
userptr_t virt_to_user ( volatile const void *addr );
/**
* Convert virtual address to a physical address
*