From patchwork Thu Aug 29 10:21:16 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Hu Tao X-Patchwork-Id: 270775 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 71F9E2C00AC for ; Thu, 29 Aug 2013 20:23:13 +1000 (EST) Received: from localhost ([::1]:41818 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VEzNf-000847-5b for incoming@patchwork.ozlabs.org; Thu, 29 Aug 2013 06:23:11 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57524) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VEzNI-000808-0R for qemu-devel@nongnu.org; Thu, 29 Aug 2013 06:22:52 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VEzNE-0000vY-2G for qemu-devel@nongnu.org; Thu, 29 Aug 2013 06:22:47 -0400 Received: from [222.73.24.84] (port=44821 helo=song.cn.fujitsu.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VEzND-0000up-Md for qemu-devel@nongnu.org; Thu, 29 Aug 2013 06:22:43 -0400 X-IronPort-AV: E=Sophos;i="4.89,982,1367942400"; d="scan'208";a="8343479" Received: from unknown (HELO tang.cn.fujitsu.com) ([10.167.250.3]) by song.cn.fujitsu.com with ESMTP; 29 Aug 2013 18:19:31 +0800 Received: from fnstmail02.fnst.cn.fujitsu.com (tang.cn.fujitsu.com [127.0.0.1]) by tang.cn.fujitsu.com (8.14.3/8.13.1) with ESMTP id r7TAMav8004394; Thu, 29 Aug 2013 18:22:37 +0800 Received: from localhost.localdomain ([10.167.226.102]) by fnstmail02.fnst.cn.fujitsu.com (Lotus Domino Release 8.5.3) with ESMTP id 2013082918203890-1061188 ; Thu, 29 Aug 2013 18:20:38 +0800 From: Hu Tao To: qemu-devel@nongnu.org Date: Thu, 29 Aug 2013 18:21:16 +0800 Message-Id: <1377771676-6883-1-git-send-email-hutao@cn.fujitsu.com> X-Mailer: git-send-email 1.8.1.4 MIME-Version: 1.0 X-MIMETrack: Itemize by SMTP Server on mailserver/fnst(Release 8.5.3|September 15, 2011) at 2013/08/29 18:20:38, Serialize by Router on mailserver/fnst(Release 8.5.3|September 15, 2011) at 2013/08/29 18:20:39 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 222.73.24.84 Cc: Peter Maydell , Paolo Bonzini , =?UTF-8?q?Andreas=20F=C3=A4rber?= , Blue Swirl , Richard Henderson Subject: [Qemu-devel] [PATCH] exec: check offset_within_address_space for register subpage X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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 Cc: Richard Henderson Cc: "Andreas Färber" Cc: Peter Maydell Cc: Blue Swirl Signed-off-by: Hu Tao Reviewed-by: Paolo Bonzini --- 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 {