From 7634d658e601714a917d91367a27340ffa77c3db Mon Sep 17 00:00:00 2001 From: David Hildenbrand Date: Wed, 20 Sep 2017 17:30:15 +0200 Subject: s390x/tcg: move wrap_address() to internal.h MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We want to use it in another file. Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson Signed-off-by: David Hildenbrand Message-Id: <20170920153016.3858-3-david@redhat.com> Signed-off-by: Cornelia Huck --- target/s390x/internal.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'target/s390x/internal.h') 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, -- cgit v1.2.1