]> git.ipfire.org Git - thirdparty/ipxe.git/commitdiff
[uaccess] Remove redundant virt_to_user() and userptr_t
authorMichael Brown <mcb30@ipxe.org>
Wed, 30 Apr 2025 15:07:04 +0000 (16:07 +0100)
committerMichael Brown <mcb30@ipxe.org>
Wed, 30 Apr 2025 15:26:16 +0000 (16:26 +0100)
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>
src/arch/x86/include/librm.h
src/arch/x86/transitions/librm_mgmt.c
src/core/uaccess.c
src/include/ipxe/linux/linux_uaccess.h
src/include/ipxe/uaccess.h
src/interface/linux/linux_uaccess.c

index 22b7e3933ad7bc8a15ef35e997682892fdd7cc61..4fce7e8c801ea24594dfc3a6cbfa4f6d415e62ed 100644 (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
index da5055cd817c31a7a50bba6b1c8450598f4f483d..14e00eda87c9b0135af261ecf162b2a241f66309 100644 (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 );
index bf922f66d49c4d614f4e620744c8044cebacdda8..e73f4d7fb19ff025f25ed973188be50fc225a57f 100644 (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 );
index 7d5f5f64266be8d5a49b012bd5cf56603292b823..a5d7d73f307c1ee7328254875881d8ea33c7a817 100644 (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 */
index 82f29f7939b29e235bb73a27928b8e5f25e0f4f7..8d93cbf4fba2d8106daacb496bcf51f021036fa9 100644 (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
  *
index 4367077577b1468392f9067f06aee7b2a6f81218..7f7f8931b4aeb17aa2478b5b3b7e2aac57fb3963 100644 (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);