qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v1 07/12] s390x/mmu_helper: move address validation into mmu_


From: Thomas Huth
Subject: Re: [PATCH v1 07/12] s390x/mmu_helper: move address validation into mmu_translate*()
Date: Fri, 6 Aug 2021 10:20:23 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.12.0

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 <david@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/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]