On 3/4/26 03:11, Anton Johansson wrote:
Reviewed-by: Helge Deller <[email protected]>
Signed-off-by: Anton Johansson <[email protected]>
---
target/hppa/cpu.h | 11 ++++++++---
hw/hppa/machine.c | 4 ++--
hw/pci-host/astro.c | 2 +-
target/hppa/cpu.c | 9 ++++++++-
target/hppa/mem_helper.c | 39 +++++++++++----------------------------
5 files changed, 30 insertions(+), 35 deletions(-)
diff --git a/target/hppa/cpu.h b/target/hppa/cpu.h
index 43b4882fb4..487f0f5e9e 100644
--- a/target/hppa/cpu.h
+++ b/target/hppa/cpu.h
@@ -320,6 +320,11 @@ static inline const HPPACPUDef *hppa_def(CPUHPPAState *env)
return HPPA_CPU_GET_CLASS(env_cpu(env))->def;
}
+static inline uint8_t hppa_phys_addr_bits(CPUHPPAState *env)
+{
+ return hppa_def(env)->phys_addr_bits;
+}
+
static inline bool hppa_is_pa20(CPUHPPAState *env)
{
return hppa_def(env)->is_pa20;
@@ -352,9 +357,9 @@ static inline vaddr hppa_form_gva(CPUHPPAState *env,
uint64_t spc,
return hppa_form_gva_mask(env->gva_offset_mask, spc, off);
}
-hwaddr hppa_abs_to_phys_pa1x(vaddr addr);
-hwaddr hppa_abs_to_phys_pa2_w0(vaddr addr);
-hwaddr hppa_abs_to_phys_pa2_w1(vaddr addr);
+hwaddr hppa_abs_to_phys_pa1x(CPUHPPAState *env, vaddr addr);
+hwaddr hppa_abs_to_phys_pa2_w0(CPUHPPAState *env, vaddr addr);
+hwaddr hppa_abs_to_phys_pa2_w1(CPUHPPAState *env, vaddr addr);
/*
* Since PSW_{I,CB} will never need to be in tb->flags, reuse them.
diff --git a/hw/hppa/machine.c b/hw/hppa/machine.c
index 5d0d4de09e..bb6b7dc76c 100644
--- a/hw/hppa/machine.c
+++ b/hw/hppa/machine.c
@@ -181,12 +181,12 @@ static uint64_t linux_kernel_virt_to_phys(void *opaque,
uint64_t addr)
static uint64_t translate_pa10(void *dummy, uint64_t addr)
{
- return hppa_abs_to_phys_pa1x(addr);
+ return hppa_abs_to_phys_pa1x(cpu_env(first_cpu), addr);
}
static uint64_t translate_pa20(void *dummy, uint64_t addr)
{
- return hppa_abs_to_phys_pa2_w0(addr);
+ return hppa_abs_to_phys_pa2_w0(cpu_env(first_cpu), addr);
}
static HPPACPU *cpu[HPPA_MAX_CPUS];
diff --git a/hw/pci-host/astro.c b/hw/pci-host/astro.c
index 00a904277c..d38f81e553 100644
--- a/hw/pci-host/astro.c
+++ b/hw/pci-host/astro.c
@@ -303,7 +303,7 @@ static IOMMUTLBEntry
astro_translate_iommu(IOMMUMemoryRegion *iommu,
* language which not-coincidentally matches the PSW.W=0 mapping.
*/
if (addr <= UINT32_MAX) {
- entry = hppa_abs_to_phys_pa2_w0(addr);
+ entry = hppa_abs_to_phys_pa2_w0(cpu_env(first_cpu), addr);
} else {
entry = addr;
}
diff --git a/target/hppa/cpu.c b/target/hppa/cpu.c
index cc755da8be..b04bcfa6a0 100644
--- a/target/hppa/cpu.c
+++ b/target/hppa/cpu.c
@@ -282,7 +282,14 @@ static void hppa_cpu_class_base_init(ObjectClass *oc,
const void *data)
HPPACPUClass *acc = HPPA_CPU_CLASS(oc);
/* Make sure all CPU models define a HPPACPUDef */
g_assert(!object_class_is_abstract(oc) && data != NULL);
- acc->def = data;
+ if (data) {
You just asserted data != NULL.
r~