summaryrefslogtreecommitdiff
path: root/target/s390x/internal.h
diff options
context:
space:
mode:
authorDavid Hildenbrand <david@redhat.com>2017-09-20 17:30:15 +0200
committerCornelia Huck <cohuck@redhat.com>2017-10-06 10:53:01 +0200
commit7634d658e601714a917d91367a27340ffa77c3db (patch)
treeaae188774ca7bee1c70d32894fe8b7d657ad80af /target/s390x/internal.h
parent6b257354c4912d536b999ef32968b1cbb8add4f2 (diff)
downloadqemu-7634d658e601714a917d91367a27340ffa77c3db.tar.gz
s390x/tcg: move wrap_address() to internal.h
We want to use it in another file. Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Signed-off-by: David Hildenbrand <david@redhat.com> Message-Id: <20170920153016.3858-3-david@redhat.com> Signed-off-by: Cornelia Huck <cohuck@redhat.com>
Diffstat (limited to 'target/s390x/internal.h')
-rw-r--r--target/s390x/internal.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/target/s390x/internal.h b/target/s390x/internal.h
index bc8f83129a..70d2b87e55 100644
--- a/target/s390x/internal.h
+++ b/target/s390x/internal.h
@@ -162,6 +162,20 @@ static inline uint8_t get_per_atmid(CPUS390XState *env)
((env->psw.mask & PSW_ASC_ACCREG) ? (1 << 2) : 0);
}
+static inline uint64_t wrap_address(CPUS390XState *env, uint64_t a)
+{
+ if (!(env->psw.mask & PSW_MASK_64)) {
+ if (!(env->psw.mask & PSW_MASK_32)) {
+ /* 24-Bit mode */
+ a &= 0x00ffffff;
+ } else {
+ /* 31-Bit mode */
+ a &= 0x7fffffff;
+ }
+ }
+ return a;
+}
+
/* CC optimization */
/* Instead of computing the condition codes after each x86 instruction,