Moving the initialisation of the virtual boot information structure to
a different compilation unit results in the compiler generating very
different code that doesn't make use of the physical address offset
defined by phystokv.
---
 i386/i386at/biosmem.c   | 8 ++++++++
 i386/i386at/model_dep.c | 6 +++++-
 2 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/i386/i386at/biosmem.c b/i386/i386at/biosmem.c
index 5c788705..c6cf41ff 100644
--- a/i386/i386at/biosmem.c
+++ b/i386/i386at/biosmem.c
@@ -1167,3 +1167,11 @@ biosmem_addr_available(phys_addr_t addr)
     }
     return FALSE;
 }
+
+const struct multiboot2_raw_info * other_cu_mb2_raw_info(vm_offset_t bi);
+
+const struct multiboot2_raw_info *
+other_cu_mb2_raw_info(vm_offset_t bi)
+{
+  return (const struct multiboot2_raw_info *)phystokv(bi);
+}
diff --git a/i386/i386at/model_dep.c b/i386/i386at/model_dep.c
index 36773ae3..612c5678 100644
--- a/i386/i386at/model_dep.c
+++ b/i386/i386at/model_dep.c
@@ -818,7 +818,11 @@ void c_boot_entry(vm_offset_t bi)
               discarded. This translation cannot happen until after
               memory bootstrapping which means that we cannot
               immediately use 'boot_info'. */
-           mb2_info = (const struct multiboot2_raw_info *)phystokv(bi);
+
+           extern const struct multiboot2_raw_info *
+             other_cu_mb2_raw_info(vm_offset_t bi);
+
+           mb2_info = other_cu_mb2_raw_info(bi);
          }
        else if (magic != MULTIBOOT_LOADER_MAGIC)
          {
-- 
2.47.3


Reply via email to