exec: check offset_within_address_space for register subpage
authorHu Tao <hutao@cn.fujitsu.com>
Thu, 29 Aug 2013 10:21:16 +0000 (18:21 +0800)
committerSeokYeon Hwang <syeon.hwang@samsung.com>
Tue, 29 Oct 2013 02:18:12 +0000 (11:18 +0900)
If offset_within_address_space falls in a page, then we register a
subpage. So check offset_within_address_space rather than
offset_within_region.

Cc: qemu-stable@nongnu.org
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Richard Henderson <rth@twiddle.net>
Cc: "Andreas Färber" <afaerber@suse.de>
Cc: Peter Maydell <peter.maydell@linaro.org>
Cc: Blue Swirl <blauwirbel@gmail.com>
Signed-off-by: Hu Tao <hutao@cn.fujitsu.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
(cherry picked from commit 88266249701032211c1d7449460d063fbc01bf12)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
exec.c

diff --git a/exec.c b/exec.c
index d9ca4dfdfdf70e88f9985d082043f1fd6fe99b43..f78239f1dc68898d2c72bb90fbd83f6517bdcd97 100644 (file)
--- a/exec.c
+++ b/exec.c
@@ -870,7 +870,7 @@ static void mem_add(MemoryListener *listener, MemoryRegionSection *section)
         now = remain;
         if (int128_lt(remain.size, page_size)) {
             register_subpage(d, &now);
-        } else if (remain.offset_within_region & ~TARGET_PAGE_MASK) {
+        } else if (remain.offset_within_address_space & ~TARGET_PAGE_MASK) {
             now.size = page_size;
             register_subpage(d, &now);
         } else {