summaryrefslogtreecommitdiff
path: root/payloads/libpayload/arch/x86/boot_media.c
diff options
context:
space:
mode:
Diffstat (limited to 'payloads/libpayload/arch/x86/boot_media.c')
-rw-r--r--payloads/libpayload/arch/x86/boot_media.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/payloads/libpayload/arch/x86/boot_media.c b/payloads/libpayload/arch/x86/boot_media.c
index ce0283273d..99fb4e3c2a 100644
--- a/payloads/libpayload/arch/x86/boot_media.c
+++ b/payloads/libpayload/arch/x86/boot_media.c
@@ -1,5 +1,6 @@
/* SPDX-License-Identifier: BSD-3-Clause */
+#include <arch/virtual.h>
#include <boot_device.h>
#include <commonlib/bsd/cb_err.h>
#include <stddef.h>
@@ -11,7 +12,7 @@ __attribute__((weak)) ssize_t boot_device_read(void *buf, size_t offset, size_t
/* Memory-mapping usually only works for the top 16MB. */
if (!lib_sysinfo.boot_media_size || lib_sysinfo.boot_media_size - offset > 16 * MiB)
return CB_ERR_ARG;
- void *ptr = (void *)(uintptr_t)(0 - lib_sysinfo.boot_media_size + offset);
+ const void *const ptr = phys_to_virt(0 - lib_sysinfo.boot_media_size + offset);
memcpy(buf, ptr, size);
return size;
}