[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

@@ -126,11 +126,6 @@ UACCESS_INLINE ( librm, virt_to_phys ) ( volatile const void *virt ) {
return ( addr + virt_offset );
}
static inline __always_inline userptr_t
UACCESS_INLINE ( librm, virt_to_user ) ( volatile const void *addr ) {
return trivial_virt_to_user ( addr );
}
/******************************************************************************
*
* Access to variables in .data16 and .text16

View File

@@ -431,7 +431,6 @@ void setup_sipi ( unsigned int vector, uint32_t handler,
PROVIDE_UACCESS_INLINE ( librm, phys_to_virt );
PROVIDE_UACCESS_INLINE ( librm, virt_to_phys );
PROVIDE_UACCESS_INLINE ( librm, virt_to_user );
PROVIDE_IOMAP_INLINE ( pages, io_to_bus );
PROVIDE_IOMAP ( pages, ioremap, ioremap_pages );
PROVIDE_IOMAP ( pages, iounmap, iounmap_pages );

View File

@@ -34,4 +34,3 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
/* Flat address space user access API */
PROVIDE_UACCESS_INLINE ( flat, phys_to_virt );
PROVIDE_UACCESS_INLINE ( flat, virt_to_phys );
PROVIDE_UACCESS_INLINE ( flat, virt_to_user );

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
*

View File

@@ -29,4 +29,3 @@ FILE_LICENCE(GPL2_OR_LATER);
PROVIDE_UACCESS_INLINE(linux, phys_to_virt);
PROVIDE_UACCESS_INLINE(linux, virt_to_phys);
PROVIDE_UACCESS_INLINE(linux, virt_to_user);