From 382a04afa075927d843f11e9fb8c450a084bbfa8 Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Wed, 28 Oct 2020 06:17:07 -0400 Subject: s390x: do not use ram_size global Use the machine properties instead. Cc: Cornelia Huck Signed-off-by: Paolo Bonzini --- target/s390x/excp_helper.c | 3 ++- target/s390x/mem_helper.c | 10 +++++++--- target/s390x/mmu_helper.c | 4 +++- 3 files changed, 12 insertions(+), 5 deletions(-) (limited to 'target/s390x') diff --git a/target/s390x/excp_helper.c b/target/s390x/excp_helper.c index 0adfbbda27..9cf66d3690 100644 --- a/target/s390x/excp_helper.c +++ b/target/s390x/excp_helper.c @@ -156,9 +156,10 @@ bool s390_cpu_tlb_fill(CPUState *cs, vaddr address, int size, !address_space_access_valid(&address_space_memory, raddr, TARGET_PAGE_SIZE, access_type, MEMTXATTRS_UNSPECIFIED)) { + MachineState *ms = MACHINE(qdev_get_machine()); qemu_log_mask(CPU_LOG_MMU, "%s: raddr %" PRIx64 " > ram_size %" PRIx64 "\n", - __func__, (uint64_t)raddr, (uint64_t)ram_size); + __func__, (uint64_t)raddr, (uint64_t)ms->ram_size); excp = PGM_ADDRESSING; tec = 0; /* unused */ } diff --git a/target/s390x/mem_helper.c b/target/s390x/mem_helper.c index bd25eed3e8..0108611cc9 100644 --- a/target/s390x/mem_helper.c +++ b/target/s390x/mem_helper.c @@ -31,6 +31,7 @@ #if !defined(CONFIG_USER_ONLY) #include "hw/s390x/storage-keys.h" +#include "hw/boards.h" #endif /*****************************************************************************/ @@ -2075,12 +2076,13 @@ uint32_t HELPER(tprot)(CPUS390XState *env, uint64_t a1, uint64_t a2) /* insert storage key extended */ uint64_t HELPER(iske)(CPUS390XState *env, uint64_t r2) { + MachineState *ms = MACHINE(qdev_get_machine()); static S390SKeysState *ss; static S390SKeysClass *skeyclass; uint64_t addr = wrap_address(env, r2); uint8_t key; - if (addr > ram_size) { + if (addr > ms->ram_size) { return 0; } @@ -2098,12 +2100,13 @@ uint64_t HELPER(iske)(CPUS390XState *env, uint64_t r2) /* set storage key extended */ void HELPER(sske)(CPUS390XState *env, uint64_t r1, uint64_t r2) { + MachineState *ms = MACHINE(qdev_get_machine()); static S390SKeysState *ss; static S390SKeysClass *skeyclass; uint64_t addr = wrap_address(env, r2); uint8_t key; - if (addr > ram_size) { + if (addr > ms->ram_size) { return; } @@ -2124,11 +2127,12 @@ void HELPER(sske)(CPUS390XState *env, uint64_t r1, uint64_t r2) /* reset reference bit extended */ uint32_t HELPER(rrbe)(CPUS390XState *env, uint64_t r2) { + MachineState *ms = MACHINE(qdev_get_machine()); static S390SKeysState *ss; static S390SKeysClass *skeyclass; uint8_t re, key; - if (r2 > ram_size) { + if (r2 > ms->ram_size) { return 0; } diff --git a/target/s390x/mmu_helper.c b/target/s390x/mmu_helper.c index 7d9f3059cd..d492b23a17 100644 --- a/target/s390x/mmu_helper.c +++ b/target/s390x/mmu_helper.c @@ -27,6 +27,7 @@ #include "trace.h" #include "hw/hw.h" #include "hw/s390x/storage-keys.h" +#include "hw/boards.h" /* Fetch/store bits in the translation exception code: */ #define FS_READ 0x800 @@ -292,10 +293,11 @@ static void mmu_handle_skey(target_ulong addr, int rw, int *flags) { static S390SKeysClass *skeyclass; static S390SKeysState *ss; + MachineState *ms = MACHINE(qdev_get_machine()); uint8_t key; int rc; - if (unlikely(addr >= ram_size)) { + if (unlikely(addr >= ms->ram_size)) { return; } -- cgit v1.2.3