]> git.proxmox.com Git - qemu.git/commitdiff
target-openrisc: Correct handling of page faults.
authorSebastian Macke <sebastian@macke.de>
Thu, 3 Oct 2013 08:04:46 +0000 (16:04 +0800)
committerJia Liu <proljc@gmail.com>
Thu, 3 Oct 2013 08:24:24 +0000 (16:24 +0800)
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

index 57f5616e9ca77f33356ba208b111e70db605b3bc..323a173a822fa642ddb40ebc3966ddbb52f9ab8e 100644 (file)
@@ -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)) {