On 05/08/2021 17.27, David Hildenbrand wrote:
Let's move address validation into mmu_translate() and
mmu_translate_real(). This allows for checking whether an absolute
address is valid before looking up the storage key. We can now get rid of
the ram_size check.
Interestingly, we're already handling LOAD REAL ADDRESS wrong, because
a) We're not supposed to touch storage keys
b) We're not supposed to convert to an absolute address
Let's use a fake, negative MMUAccessType to teach mmu_translate() to
fix that handling and to not perform address validation.
Signed-off-by: David Hildenbrand <da...@redhat.com>
---
target/s390x/mmu_helper.c | 36 ++++++++++++++++++++--------------
target/s390x/tcg/excp_helper.c | 13 ------------
target/s390x/tcg/mem_helper.c | 2 +-
3 files changed, 22 insertions(+), 29 deletions(-)
diff --git a/target/s390x/mmu_helper.c b/target/s390x/mmu_helper.c
index ca25dadb5b..36ab4e9c81 100644
--- a/target/s390x/mmu_helper.c
+++ b/target/s390x/mmu_helper.c
@@ -301,14 +301,13 @@ 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 >= ms->ram_size)) {
- return;
- }
-
+ /*
+ * We excpect to be called with an absolute address that has already been
s/excpect/expect/