From: "Hervé Poussineau" <hpoussin@reactos.org>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH] MIPS: Fix tlbwi/tlbwr
Date: Sun, 07 Sep 2008 22:37:31 +0200 [thread overview]
Message-ID: <48C43B8B.1050407@reactos.org> (raw)
[-- Attachment #1: Type: text/plain, Size: 240 bytes --]
Hi,
In CP0 Index register, bit 31 means 'Probe Failure', while lowest bits
contain the TLB index.
In tlbwi and tlbwr instructions, this Probe Failure bit must be ignored
when reading the TLB index.
Attached patch fixes it.
Hervé
[-- Attachment #2: fix tlbwi tlbwr.diff --]
[-- Type: text/plain, Size: 1172 bytes --]
Index: target-mips/op_helper.c
===================================================================
--- target-mips/op_helper.c (revision 5162)
+++ target-mips/op_helper.c (working copy)
@@ -1572,13 +1572,17 @@
void r4k_do_tlbwi (void)
{
+ int idx;
+
+ idx = (env->CP0_Index & ~0x80000000) % env->tlb->nb_tlb;
+
/* Discard cached TLB entries. We could avoid doing this if the
tlbwi is just upgrading access permissions on the current entry;
that might be a further win. */
r4k_mips_tlb_flush_extra (env, env->tlb->nb_tlb);
- r4k_invalidate_tlb(env, env->CP0_Index % env->tlb->nb_tlb, 0);
- r4k_fill_tlb(env->CP0_Index % env->tlb->nb_tlb);
+ r4k_invalidate_tlb(env, idx, 0);
+ r4k_fill_tlb(idx);
}
void r4k_do_tlbwr (void)
@@ -1635,9 +1639,11 @@
{
r4k_tlb_t *tlb;
uint8_t ASID;
+ int idx;
ASID = env->CP0_EntryHi & 0xFF;
- tlb = &env->tlb->mmu.r4k.tlb[env->CP0_Index % env->tlb->nb_tlb];
+ idx = (env->CP0_Index & ~0x80000000) % env->tlb->nb_tlb;
+ tlb = &env->tlb->mmu.r4k.tlb[idx];
/* If this will change the current ASID, flush qemu's TLB. */
if (ASID != tlb->ASID)
next reply other threads:[~2008-09-07 20:37 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-09-07 20:37 Hervé Poussineau [this message]
2008-09-14 17:09 ` [Qemu-devel] [PATCH] MIPS: Fix tlbwi/tlbwr Aurelien Jarno
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=48C43B8B.1050407@reactos.org \
--to=hpoussin@reactos.org \
--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).