aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Brown <mcb30@ipxe.org>2022-03-23 14:41:36 +0000
committerMichael Brown <mcb30@ipxe.org>2022-03-24 12:58:52 +0000
commit1e1b9593e6f7d6026f2d6a2109e06a9629ef0ce0 (patch)
tree3390f790cd68f508d2daf3f13a3c236bbbe09f6d
parent27825e555746c379ac045466f692ed77686af2b5 (diff)
downloadipxe-1e1b9593e6f7d6026f2d6a2109e06a9629ef0ce0.zip
ipxe-1e1b9593e6f7d6026f2d6a2109e06a9629ef0ce0.tar.gz
ipxe-1e1b9593e6f7d6026f2d6a2109e06a9629ef0ce0.tar.bz2
[linux] Add stub phys_to_user() implementation
For symmetry with the stub user_to_phys() implementation, provide phys_to_user() with the same underlying assumption that virtual addresses are physical (since there is no way to know the real physical address when running as a Linux userspace executable). Signed-off-by: Michael Brown <mcb30@ipxe.org>
-rw-r--r--src/include/ipxe/linux/linux_uaccess.h15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/include/ipxe/linux/linux_uaccess.h b/src/include/ipxe/linux/linux_uaccess.h
index acd919a..a642b61 100644
--- a/src/include/ipxe/linux/linux_uaccess.h
+++ b/src/include/ipxe/linux/linux_uaccess.h
@@ -25,7 +25,7 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
#endif
/**
- * Convert user buffer to physical address
+ * Convert user pointer to physical address
*
* @v userptr User pointer
* @v offset Offset from user pointer
@@ -46,6 +46,19 @@ UACCESS_INLINE ( linux, user_to_phys ) ( userptr_t userptr, off_t offset ) {
return ( userptr + offset );
}
+/**
+ * Convert physical address to user pointer
+ *
+ * @v phys_addr Physical address
+ * @ret userptr User pointer
+ */
+static inline __always_inline userptr_t
+UACCESS_INLINE ( linux, phys_to_user ) ( physaddr_t phys_addr ) {
+
+ /* For symmetry with the stub user_to_phys() */
+ return phys_addr;
+}
+
static inline __always_inline userptr_t
UACCESS_INLINE ( linux, virt_to_user ) ( volatile const void *addr ) {
return trivial_virt_to_user ( addr );