From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46418) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VReU9-0006MJ-2r for qemu-devel@nongnu.org; Thu, 03 Oct 2013 04:42:20 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VReU2-0006Ck-H1 for qemu-devel@nongnu.org; Thu, 03 Oct 2013 04:42:13 -0400 Received: from mail-pd0-x233.google.com ([2607:f8b0:400e:c02::233]:40536) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VReU2-0006Cf-9F for qemu-devel@nongnu.org; Thu, 03 Oct 2013 04:42:06 -0400 Received: by mail-pd0-f179.google.com with SMTP id v10so2164902pde.10 for ; Thu, 03 Oct 2013 01:42:05 -0700 (PDT) From: Jia Liu Date: Thu, 3 Oct 2013 16:41:41 +0800 Message-Id: <1380789702-18935-2-git-send-email-proljc@gmail.com> In-Reply-To: <1380789702-18935-1-git-send-email-proljc@gmail.com> References: <1380789702-18935-1-git-send-email-proljc@gmail.com> Content-Type: text/plain; charset="utf-8" Subject: [Qemu-devel] [PULL 1/2] target-openrisc: Correct handling of page faults. List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: sebastian@macke.de, aliguori@us.ibm.com, stefan.kristiansson@saunalahti.fi From: Sebastian Macke The result of (rw & 0) is always zero and therefore a logic false. The whole comparison will therefore never be executed, it is a obvious bug, we should use !(rw & 1) here. Signed-off-by: Sebastian Macke Reviewed-by: Jia Liu --- target-openrisc/mmu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target-openrisc/mmu.c b/target-openrisc/mmu.c index 57f5616..323a173 100644 --- a/target-openrisc/mmu.c +++ b/target-openrisc/mmu.c @@ -102,7 +102,7 @@ int cpu_openrisc_get_phys_data(OpenRISCCPU *cpu, } } - if ((rw & 0) && ((right & PAGE_READ) == 0)) { + if (!(rw & 1) && ((right & PAGE_READ) == 0)) { return TLBRET_BADADDR; } if ((rw & 1) && ((right & PAGE_WRITE) == 0)) { -- 1.7.12.4 (Apple Git-37)