qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Sebastian Macke <sebastian@macke.de>
To: qemu-devel@nongnu.org
Cc: openrisc@lists.openrisc.net, openrisc@lists.opencores.org
Subject: [Qemu-devel] [PATCH] Correction of the TLB handling of the OpenRISC target
Date: Tue, 01 Oct 2013 22:12:10 -0700	[thread overview]
Message-ID: <524BAB2A.4050202@macke.de> (raw)

[-- Attachment #1: Type: text/plain, Size: 368 bytes --]

Hi,

this patch corrects two problems for the OpenRISC Target in QEMU. The 
first one corrects one obvious bug
concerning the handling of page faults while reading from a page. The 
second part removes a non-conforming behavior for the first page of the 
memory.

I have tested this patch with the newest Linux kernel and compared the 
output with or1ksim.

Sebastian

[-- Attachment #2: 0001-Correction-of-the-TLB-handling-of-the-OpenRISC-targe.patch --]
[-- Type: text/plain, Size: 1561 bytes --]

>From 4491bae7109e2b4de5a8de8a7e4b08d1f19ac70e Mon Sep 17 00:00:00 2001
From: Sebastian Macke <sebastian@macke.de>
Date: Tue, 1 Oct 2013 21:39:38 -0700
Subject: [PATCH] Correction of the TLB handling of the OpenRISC target

This patch correct two problems. The first one corrects one obvious bug
concerning the handling of page faults while reading from a page.
The second part removes a non-conforming behavior for the first page of
the memory.

I have tested this patch with the newest Linux kernel and compared the
output with or1ksim.

Signed-off-by: Sebastian Macke <sebastian@macke.de>
---
 target-openrisc/mmu.c |    9 +--------
 1 files changed, 1 insertions(+), 8 deletions(-)

diff --git a/target-openrisc/mmu.c b/target-openrisc/mmu.c
index 57f5616..22d7cbe 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)) {
@@ -122,13 +122,6 @@ static int cpu_openrisc_get_phys_addr(OpenRISCCPU *cpu,
 {
     int ret = TLBRET_MATCH;
 
-    /* [0x0000--0x2000]: unmapped */
-    if (address < 0x2000 && (cpu->env.sr & SR_SM)) {
-        *physical = address;
-        *prot = PAGE_READ | PAGE_WRITE;
-        return ret;
-    }
-
     if (rw == 2) {    /* ITLB */
        *physical = 0;
         ret = cpu->env.tlb->cpu_openrisc_map_address_code(cpu, physical,
-- 
1.7.9


             reply	other threads:[~2013-10-02  5:12 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-02  5:12 Sebastian Macke [this message]
2013-10-02  5:33 ` [Qemu-devel] [OpenRISC] [PATCH] Correction of the TLB handling of the OpenRISC target Jia Liu
2013-10-02  6:15   ` Stefan Kristiansson
2013-10-03  1:42     ` Jia Liu
2013-10-02  6:31   ` Sebastian Macke

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=524BAB2A.4050202@macke.de \
    --to=sebastian@macke.de \
    --cc=openrisc@lists.opencores.org \
    --cc=openrisc@lists.openrisc.net \
    --cc=qemu-devel@nongnu.org \
    /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).