diff mbox

exec: check offset_within_address_space for register subpage

Message ID 1377771676-6883-1-git-send-email-hutao@cn.fujitsu.com
State New
Headers show

Commit Message

Hu Tao Aug. 29, 2013, 10:21 a.m. UTC
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: 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>
---
 exec.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Paolo Bonzini Sept. 3, 2013, 10:54 a.m. UTC | #1
Il 29/08/2013 12:21, Hu Tao ha scritto:
> 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: 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>
> ---
>  exec.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/exec.c b/exec.c
> index 3ca9381..f1f9151 100644
> --- a/exec.c
> +++ b/exec.c
> @@ -869,7 +869,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 {
> 

Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
diff mbox

Patch

diff --git a/exec.c b/exec.c
index 3ca9381..f1f9151 100644
--- a/exec.c
+++ b/exec.c
@@ -869,7 +869,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 {