qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Jia Liu <proljc@gmail.com>
To: qemu-devel@nongnu.org
Cc: sebastian@macke.de, aliguori@us.ibm.com,
	stefan.kristiansson@saunalahti.fi
Subject: [Qemu-devel] [PULL 1/2] target-openrisc: Correct handling of page faults.
Date: Thu,  3 Oct 2013 16:41:41 +0800	[thread overview]
Message-ID: <1380789702-18935-2-git-send-email-proljc@gmail.com> (raw)
In-Reply-To: <1380789702-18935-1-git-send-email-proljc@gmail.com>

From: Sebastian Macke <sebastian@macke.de>

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 <sebastian@macke.de>
Reviewed-by: Jia Liu <proljc@gmail.com>
---
 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)

  reply	other threads:[~2013-10-03  8:42 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-03  8:41 [Qemu-devel] [PULL 0/2] Correction of the TLB handling of the OpenRISC target Jia Liu
2013-10-03  8:41 ` Jia Liu [this message]
2013-10-03  8:41 ` [Qemu-devel] [PULL 2/2] target-openrisc: Removes a non-conforming behavior for the first page of the memory Jia Liu
2013-10-03  9:00 ` [Qemu-devel] [PULL 0/2] Correction of the TLB handling of the OpenRISC target Peter Maydell
2013-10-03 12:06   ` Jia Liu
2013-10-14  9:06   ` Jia Liu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1380789702-18935-2-git-send-email-proljc@gmail.com \
    --to=proljc@gmail.com \
    --cc=aliguori@us.ibm.com \
    --cc=qemu-devel@nongnu.org \
    --cc=sebastian@macke.de \
    --cc=stefan.kristiansson@saunalahti.fi \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).