From: Blue Swirl <blauwirbel@gmail.com>
To: Artyom Tarasenko <atar4qemu@googlemail.com>
Cc: qemu-devel@nongnu.org, Artyom Tarasenko <atar4qemu@gmail.com>
Subject: [Qemu-devel] Re: sparc32 do_unassigned_access overhaul v2
Date: Fri, 15 Jan 2010 21:34:40 +0000 [thread overview]
Message-ID: <f43fc5581001151334o745e56fajafcff5066c220882@mail.gmail.com> (raw)
In-Reply-To: <1263590936-17505-1-git-send-email-atar4qemu@google.com>
Thanks, applied.
On Fri, Jan 15, 2010 at 9:28 PM, Artyom Tarasenko
<atar4qemu@googlemail.com> wrote:
> According to pages 9-31 - 9-34 of "SuperSPARC & MultiCache Controller
> User's Manual":
>
> 1. "A lower priority fault may not overwrite the
> MFSR status of a higher priority fault."
> 2. The MFAR is overwritten according to the policy defined for the MFSR
> 3. The overwrite bit is asserted if the fault status register (MFSR)
> has been written more than once by faults of the same class
> 4. SuperSPARC will never place instruction fault addresses in the MFAR.
>
> Implementation of points 1-3 allows booting Solaris 2.6 and 2.5.1.
>
> v2: CODING_STYLE fixes
>
> Signed-off-by: Artyom Tarasenko <atar4qemu@gmail.com>
> ---
> diff --git a/target-sparc/op_helper.c b/target-sparc/op_helper.c
> index 381e6c4..3ff35d3 100644
> --- a/target-sparc/op_helper.c
> +++ b/target-sparc/op_helper.c
> @@ -3714,6 +3714,7 @@ void do_unassigned_access(target_phys_addr_t addr, int is_write, int is_exec,
> int is_asi, int size)
> {
> CPUState *saved_env;
> + int fault_type;
>
> /* XXX: hack to restore env in all cases, even if not called from
> generated code */
> @@ -3731,18 +3732,29 @@ void do_unassigned_access(target_phys_addr_t addr, int is_write, int is_exec,
> is_exec ? "exec" : is_write ? "write" : "read", size,
> size == 1 ? "" : "s", addr, env->pc);
> #endif
> - if (env->mmuregs[3]) /* Fault status register */
> - env->mmuregs[3] = 1; /* overflow (not read before another fault) */
> - if (is_asi)
> - env->mmuregs[3] |= 1 << 16;
> - if (env->psrs)
> - env->mmuregs[3] |= 1 << 5;
> - if (is_exec)
> - env->mmuregs[3] |= 1 << 6;
> - if (is_write)
> - env->mmuregs[3] |= 1 << 7;
> - env->mmuregs[3] |= (5 << 2) | 2;
> - env->mmuregs[4] = addr; /* Fault address register */
> + /* Don't overwrite translation and access faults */
> + fault_type = (env->mmuregs[3] & 0x1c) >> 2;
> + if ((fault_type > 4) || (fault_type == 0)) {
> + env->mmuregs[3] = 0; /* Fault status register */
> + if (is_asi)
> + env->mmuregs[3] |= 1 << 16;
> + if (env->psrs)
> + env->mmuregs[3] |= 1 << 5;
> + if (is_exec)
> + env->mmuregs[3] |= 1 << 6;
> + if (is_write)
> + env->mmuregs[3] |= 1 << 7;
> + env->mmuregs[3] |= (5 << 2) | 2;
> + /* SuperSPARC will never place instruction fault addresses in the FAR */
> + if (!is_exec) {
> + env->mmuregs[4] = addr; /* Fault address register */
> + }
> + }
> + /* overflow (same type fault was not read before another fault) */
> + if (fault_type == ((env->mmuregs[3] & 0x1c)) >> 2) {
> + env->mmuregs[3] |= 1;
> + }
> +
> if ((env->mmuregs[0] & MMU_E) && !(env->mmuregs[0] & MMU_NF)) {
> if (is_exec)
> raise_exception(TT_CODE_ACCESS);
> @@ -3750,6 +3762,12 @@ void do_unassigned_access(target_phys_addr_t addr, int is_write, int is_exec,
> raise_exception(TT_DATA_ACCESS);
> }
> env = saved_env;
> +
> + /* flush neverland mappings created during no-fault mode,
> + so the sequential MMU faults report proper fault types */
> + if (env->mmuregs[0] & MMU_NF) {
> + tlb_flush(env, 1);
> + }
> }
> #else
> void do_unassigned_access(target_phys_addr_t addr, int is_write, int is_exec,
>
next prev parent reply other threads:[~2010-01-15 21:35 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-01-15 21:28 [Qemu-devel] sparc32 do_unassigned_access overhaul v2 Artyom Tarasenko
2010-01-15 21:34 ` Blue Swirl [this message]
2010-01-18 16:17 ` [Qemu-devel] " Artyom Tarasenko
2010-01-18 17:38 ` Blue Swirl
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=f43fc5581001151334o745e56fajafcff5066c220882@mail.gmail.com \
--to=blauwirbel@gmail.com \
--cc=atar4qemu@gmail.com \
--cc=atar4qemu@googlemail.com \
--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).