summaryrefslogtreecommitdiff
path: root/target-s390x/helper.c
diff options
context:
space:
mode:
authorCornelia Huck <cornelia.huck@de.ibm.com>2013-01-24 02:28:02 +0000
committerAlexander Graf <agraf@suse.de>2013-01-29 21:50:04 +0100
commit38322ed6518817066ce3a9037fd3795af57e1cdd (patch)
treef47c76067dcac4d414407b341e2b921e720bb10b /target-s390x/helper.c
parent4782a23b270ecbb9ce0ca6f3f1b60857a09cef0e (diff)
downloadqemu-38322ed6518817066ce3a9037fd3795af57e1cdd.tar.gz
qemu-38322ed6518817066ce3a9037fd3795af57e1cdd.tar.bz2
qemu-38322ed6518817066ce3a9037fd3795af57e1cdd.zip
s390: Add mapping helper functions.
Add s390_cpu_physical_memory_{map,unmap} with special handling for the lowcore. Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com> Signed-off-by: Alexander Graf <agraf@suse.de>
Diffstat (limited to 'target-s390x/helper.c')
-rw-r--r--target-s390x/helper.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/target-s390x/helper.c b/target-s390x/helper.c
index 023c074150..3109c77d98 100644
--- a/target-s390x/helper.c
+++ b/target-s390x/helper.c
@@ -490,6 +490,31 @@ static void cpu_unmap_lowcore(LowCore *lowcore)
cpu_physical_memory_unmap(lowcore, sizeof(LowCore), 1, sizeof(LowCore));
}
+void *s390_cpu_physical_memory_map(CPUS390XState *env, hwaddr addr, hwaddr *len,
+ int is_write)
+{
+ hwaddr start = addr;
+
+ /* Mind the prefix area. */
+ if (addr < 8192) {
+ /* Map the lowcore. */
+ start += env->psa;
+ *len = MIN(*len, 8192 - addr);
+ } else if ((addr >= env->psa) && (addr < env->psa + 8192)) {
+ /* Map the 0 page. */
+ start -= env->psa;
+ *len = MIN(*len, 8192 - start);
+ }
+
+ return cpu_physical_memory_map(start, len, is_write);
+}
+
+void s390_cpu_physical_memory_unmap(CPUS390XState *env, void *addr, hwaddr len,
+ int is_write)
+{
+ cpu_physical_memory_unmap(addr, len, is_write, len);
+}
+
static void do_svc_interrupt(CPUS390XState *env)
{
uint64_t mask, addr;