diff options
author | David Hildenbrand <david@redhat.com> | 2017-09-26 20:33:14 +0200 |
---|---|---|
committer | Cornelia Huck <cohuck@redhat.com> | 2017-10-06 10:53:02 +0200 |
commit | fb66944df92f4cf28b6f66232f82b9dd46ddcdb2 (patch) | |
tree | 3fe9b7de69a395e979920daa85742a28c50e5ca8 /target/s390x/mmu_helper.c | |
parent | 0bd695a960bf05f27ad6d710d2b64059037574ce (diff) | |
download | qemu-fb66944df92f4cf28b6f66232f82b9dd46ddcdb2.zip qemu-fb66944df92f4cf28b6f66232f82b9dd46ddcdb2.tar.gz qemu-fb66944df92f4cf28b6f66232f82b9dd46ddcdb2.tar.bz2 |
s390x/tcg: add MMU for real addresses
This makes it easy to access real addresses (prefix) and in addition
checks for valid memory addresses, which is missing when using e.g.
stl_phys().
We can later reuse it to implement low address protection checks (then
we might even decide to introduce yet another MMU for absolute
addresses, just for handling storage keys and low address protection).
Signed-off-by: David Hildenbrand <david@redhat.com>
Message-Id: <20170926183318.12995-3-david@redhat.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
Diffstat (limited to 'target/s390x/mmu_helper.c')
-rw-r--r-- | target/s390x/mmu_helper.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/target/s390x/mmu_helper.c b/target/s390x/mmu_helper.c index b528c59..9daa0fd 100644 --- a/target/s390x/mmu_helper.c +++ b/target/s390x/mmu_helper.c @@ -497,3 +497,22 @@ int s390_cpu_virt_mem_rw(S390CPU *cpu, vaddr laddr, uint8_t ar, void *hostbuf, g_free(pages); return ret; } + +/** + * Translate a real address into a physical (absolute) address. + * @param raddr the real address + * @param rw 0 = read, 1 = write, 2 = code fetch + * @param addr the translated address is stored to this pointer + * @param flags the PAGE_READ/WRITE/EXEC flags are stored to this pointer + * @return 0 if the translation was successful, < 0 if a fault occurred + */ +int mmu_translate_real(CPUS390XState *env, target_ulong raddr, int rw, + target_ulong *addr, int *flags) +{ + /* TODO: low address protection once we flush the tlb on cr changes */ + *flags = PAGE_READ | PAGE_WRITE; + *addr = mmu_real2abs(env, raddr); + + /* TODO: storage key handling */ + return 0; +} |