Message ID | 20210517115525.1088693-14-f4bug@amsat.org |
---|---|
State | New |
Headers | show |
Series | softmmu: Make various objects target agnostic | expand |
On 5/17/21 4:55 AM, Philippe Mathieu-Daudé wrote: > target_ulong is target-specific, while hwaddr isn't. > > memory_mapping_list_add_merge_sorted() uses hwaddr arguments > anyway, so use the hwaddr type for MemoryMapping::virt_addr. > > Remove the unnecessary "exec/cpu-defs.h" target-speficic header > from "memory_mapping.h" and use the target-agnostic "hw/core/cpu.h" > locally in memory_mapping.c. > > Signed-off-by: Philippe Mathieu-Daudé<f4bug@amsat.org> > --- > include/sysemu/memory_mapping.h | 3 +-- > softmmu/memory_mapping.c | 1 + > 2 files changed, 2 insertions(+), 2 deletions(-) Certainly hwaddr is now unconditionally 64-bit, so I think this would work fine. I just wonder if uint64_t wouldn't be better, since virt_addr is not a "hardware" aka physical address (as per hwaddr.h). Either way, Reviewed-by: Richard Henderson <richard.henderson@linaro.org> r~
diff --git a/include/sysemu/memory_mapping.h b/include/sysemu/memory_mapping.h index 4b20f1a639e..771dba21773 100644 --- a/include/sysemu/memory_mapping.h +++ b/include/sysemu/memory_mapping.h @@ -15,7 +15,6 @@ #define MEMORY_MAPPING_H #include "qemu/queue.h" -#include "exec/cpu-defs.h" #include "exec/memory.h" typedef struct GuestPhysBlock { @@ -43,7 +42,7 @@ typedef struct GuestPhysBlockList { /* The physical and virtual address in the memory mapping are contiguous. */ typedef struct MemoryMapping { hwaddr phys_addr; - target_ulong virt_addr; + hwaddr virt_addr; ram_addr_t length; QTAILQ_ENTRY(MemoryMapping) next; } MemoryMapping; diff --git a/softmmu/memory_mapping.c b/softmmu/memory_mapping.c index e7af2765466..7bb74df5a7a 100644 --- a/softmmu/memory_mapping.c +++ b/softmmu/memory_mapping.c @@ -17,6 +17,7 @@ #include "sysemu/memory_mapping.h" #include "exec/memory.h" #include "exec/address-spaces.h" +#include "hw/core/cpu.h" //#define DEBUG_GUEST_PHYS_REGION_ADD
target_ulong is target-specific, while hwaddr isn't. memory_mapping_list_add_merge_sorted() uses hwaddr arguments anyway, so use the hwaddr type for MemoryMapping::virt_addr. Remove the unnecessary "exec/cpu-defs.h" target-speficic header from "memory_mapping.h" and use the target-agnostic "hw/core/cpu.h" locally in memory_mapping.c. Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> --- include/sysemu/memory_mapping.h | 3 +-- softmmu/memory_mapping.c | 1 + 2 files changed, 2 insertions(+), 2 deletions(-)