From patchwork Mon May 7 16:41:21 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fabien Chouteau X-Patchwork-Id: 157351 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 82FAFB6FA7 for ; Tue, 8 May 2012 02:41:41 +1000 (EST) Received: from localhost ([::1]:34903 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SRR0E-00015i-0f for incoming@patchwork.ozlabs.org; Mon, 07 May 2012 12:41:38 -0400 Received: from eggs.gnu.org ([208.118.235.92]:40921) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SRR06-000158-DS for qemu-devel@nongnu.org; Mon, 07 May 2012 12:41:31 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SRR04-0001xR-D7 for qemu-devel@nongnu.org; Mon, 07 May 2012 12:41:29 -0400 Received: from mel.act-europe.fr ([194.98.77.210]:60795) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SRR04-0001x9-4B; Mon, 07 May 2012 12:41:28 -0400 Received: from localhost (localhost [127.0.0.1]) by filtered-smtp.eu.adacore.com (Postfix) with ESMTP id 98D9A290057; Mon, 7 May 2012 18:41:31 +0200 (CEST) X-Virus-Scanned: amavisd-new at eu.adacore.com Received: from mel.act-europe.fr ([127.0.0.1]) by localhost (smtp.eu.adacore.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id pwizXCtPIody; Mon, 7 May 2012 18:41:31 +0200 (CEST) Received: from PomPomGalli.act-europe.fr (pompomgalli.act-europe.fr [10.10.1.88]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mel.act-europe.fr (Postfix) with ESMTP id 7C580290013; Mon, 7 May 2012 18:41:31 +0200 (CEST) From: Fabien Chouteau To: qemu-devel@nongnu.org Date: Mon, 7 May 2012 18:41:21 +0200 Message-Id: <1336408881-3851-1-git-send-email-chouteau@adacore.com> X-Mailer: git-send-email 1.7.9.5 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 194.98.77.210 Cc: qemu-ppc@nongnu.org, agraf@suse.de Subject: [Qemu-devel] [PATCH] ppcmas_tlb_check: Fix effective address comparison 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 Use size mask in both operands of effective address comparison. This is the expected as the size of EPN field in MAS2 depends on page size. Definition of EPN field from e500v2 RM: EPN Effective page number: Depending on page size, only the bits associated with a page boundary are valid. Bits that represent offsets within a page are ignored and should be cleared. There is a similar (but more complicated) definition in PowerISA V2.06. Signed-off-by: Fabien Chouteau --- target-ppc/helper.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target-ppc/helper.c b/target-ppc/helper.c index e97e496..adb96a0 100644 --- a/target-ppc/helper.c +++ b/target-ppc/helper.c @@ -1320,7 +1320,7 @@ int ppcmas_tlb_check(CPUPPCState *env, ppcmas_tlb_t *tlb, } /* Check effective address */ - if ((address & mask) != (tlb->mas2 & MAS2_EPN_MASK)) { + if ((address & mask) != (tlb->mas2 & MAS2_EPN_MASK & mask)) { return -1; }