aboutsummaryrefslogtreecommitdiff
path: root/target
diff options
context:
space:
mode:
authorAurelien Jarno <aurelien@aurel32.net>2017-06-01 00:01:18 +0200
committerRichard Henderson <rth@twiddle.net>2017-06-06 15:20:43 -0700
commit22f04c31980c63c6f842135679b104f0d87d4613 (patch)
tree678056f29804def1e3896ea83b5a7ac476b30150 /target
parent5c2b48a8f0d02acfcb577abdbd5f3040d61455d9 (diff)
target/s390x: fix adj_len_to_page
adj_len_to_page doesn't return the correct result when the address is already page aligned and the length is bigger than a page. Fix that. Reviewed-by: Richard Henderson <rth@twiddle.net> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net> Message-Id: <20170531220129.27724-20-aurelien@aurel32.net> Signed-off-by: Richard Henderson <rth@twiddle.net>
Diffstat (limited to 'target')
-rw-r--r--target/s390x/mem_helper.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/target/s390x/mem_helper.c b/target/s390x/mem_helper.c
index 4ed0b65751..2326f0bdb9 100644
--- a/target/s390x/mem_helper.c
+++ b/target/s390x/mem_helper.c
@@ -61,7 +61,7 @@ static inline uint32_t adj_len_to_page(uint32_t len, uint64_t addr)
{
#ifndef CONFIG_USER_ONLY
if ((addr & ~TARGET_PAGE_MASK) + len - 1 >= TARGET_PAGE_SIZE) {
- return -addr & ~TARGET_PAGE_MASK;
+ return -(addr | TARGET_PAGE_MASK);
}
#endif
return len;