]> Git Repo - qemu.git/commitdiff
plugins: fix-up handling of internal hostaddr for 32 bit
authorAlex Bennée <[email protected]>
Fri, 9 Jul 2021 14:29:52 +0000 (15:29 +0100)
committerAlex Bennée <[email protected]>
Wed, 14 Jul 2021 13:33:53 +0000 (14:33 +0100)
The compiler rightly complains when we build on 32 bit that casting
uint64_t into a void is a bad idea. We are really dealing with a host
pointer at this point so treat it as such. This does involve
a uintptr_t cast of the result of the TLB addend as we know that has
to point to the host memory.

Signed-off-by: Alex Bennée <[email protected]>
Reviewed-by: Richard Henderson <[email protected]>
Message-Id: <20210709143005[email protected]>

accel/tcg/cputlb.c
include/qemu/plugin-memory.h
plugins/api.c

index b6d5fc6326fe2f4c75bb596cce9f3fd942011ba7..b4e15b6aad43525615c7245f8af18e4fc8d5b09d 100644 (file)
@@ -1728,7 +1728,7 @@ bool tlb_plugin_lookup(CPUState *cpu, target_ulong addr, int mmu_idx,
             data->v.io.offset = (iotlbentry->addr & TARGET_PAGE_MASK) + addr;
         } else {
             data->is_io = false;
-            data->v.ram.hostaddr = addr + tlbe->addend;
+            data->v.ram.hostaddr = (void *)((uintptr_t)addr + tlbe->addend);
         }
         return true;
     } else {
index b36def27d71b6c93d5239c718e0a4165c9995b1e..0f592267279da874653308e15a4105442b4cf698 100644 (file)
@@ -18,7 +18,7 @@ struct qemu_plugin_hwaddr {
             hwaddr    offset;
         } io;
         struct {
-            uint64_t hostaddr;
+            void *hostaddr;
         } ram;
     } v;
 };
index 332e2c60e291723a273bc8e76bb1497237c7896b..78b563c5c51a78c29f6699c1897e8e775d589ea8 100644 (file)
@@ -308,11 +308,11 @@ uint64_t qemu_plugin_hwaddr_phys_addr(const struct qemu_plugin_hwaddr *haddr)
         if (!haddr->is_io) {
             RAMBlock *block;
             ram_addr_t offset;
-            void *hostaddr = (void *) haddr->v.ram.hostaddr;
+            void *hostaddr = haddr->v.ram.hostaddr;
 
             block = qemu_ram_block_from_host(hostaddr, false, &offset);
             if (!block) {
-                error_report("Bad ram pointer %"PRIx64"", haddr->v.ram.hostaddr);
+                error_report("Bad host ram pointer %p", haddr->v.ram.hostaddr);
                 abort();
             }
 
This page took 0.030686 seconds and 4 git commands to generate.