qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Richard Henderson <richard.henderson@linaro.org>
To: Lucien Murray-Pitts <lucienmp.qemu@gmail.com>
Cc: Lucien Anti-Spam <lucienmp_antispam@yahoo.com>,
	qemu-devel@nongnu.org, Laurent Vivier <laurent@vivier.eu>
Subject: Re: [Qemu-devel] RFC: Why does target/m68k RTE insn. use gen_exception
Date: Sat, 29 Jun 2019 12:15:44 +0200	[thread overview]
Message-ID: <ea16a81c-5b94-8dd0-8339-2bd82733aed2@linaro.org> (raw)
In-Reply-To: <20190628155030.GA34320@localhost.localdomain>

On 6/28/19 5:50 PM, Lucien Murray-Pitts wrote:
>  op_helper.c
>    static void m68k_interrupt_all(CPUM68KState *env, int is_hw)
>    ...
>      if (cs->exception_index == EXCP_ACCESS) {
>       ...
>       do_stack_frame(env, &sp, 7, oldsr, 0, retaddr /*LMP: BROKEN - needs PC NEXT*/);
> 
> Actually according to the MC68000 manuals the "return address" (the PC saved on
> the stack) can be upto 5 instructions later due to prefetch. So some pc_next
> would best be used here.

The way I read it from the 68040 manual, it's "the pc of the instruction
executing at the time the fault was detected".  Well, we did in fact detect the
fault at "retaddr", so that seems to be the right answer.  The fact that real
hardware has a different pipeline and detects the fault later seems immaterial,
and largely irrelevant, since the programmer wasn't given any guarantees for
what sort of value appears in that slot.

> I am triggering this from inside my device by doing the following, since that memory address
> should dynamically cause a bus error (I hope this is the right way to do it)
>    cpuclass->do_unassigned_access( s->cpu, /*addr*/0x0, /*is_write*/1, /*is_exec*/0, opaque, /*size*/4);


For a device to raise a bus error, it should return MEMTX_ERROR (or something).
 This eventually reaches cpu_transaction_failed, which has all of the data that
you seem to be missing above.


r~


  reply	other threads:[~2019-06-29 10:18 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <2136180936.260219.1561641583358.ref@mail.yahoo.com>
2019-06-27 13:19 ` [Qemu-devel] RFC: Why does target/m68k RTE insn. use gen_exception Lucien Anti-Spam via Qemu-devel
2019-06-27 13:22   ` Lucien Anti-Spam via Qemu-devel
2019-06-27 17:09     ` Richard Henderson
2019-06-28  0:27       ` Lucien Murray-Pitts
2019-06-28  9:35         ` Richard Henderson
2019-06-28 15:50           ` Lucien Murray-Pitts
2019-06-29 10:15             ` Richard Henderson [this message]
2019-06-29 16:36               ` Lucien Murray-Pitts
2019-06-30  8:20                 ` Richard Henderson
2019-07-01  9:10                 ` Peter Maydell
2019-07-01 12:04                   ` Lucien Anti-Spam via Qemu-devel
2019-07-01 12:11                     ` Peter Maydell
2019-07-09 16:58                       ` Lucien Murray-Pitts
2019-07-09 17:06                         ` Peter Maydell
2019-07-09 19:04                         ` Richard Henderson
2019-07-10 13:35                           ` Lucien Murray-Pitts
2019-07-10 17:50                           ` Lucien Murray-Pitts
2019-07-10 18:15                             ` Alex Bennée
2019-07-11  9:00                               ` Peter Maydell
2019-07-11  9:18                             ` Richard Henderson
2019-07-12 20:55                           ` Lucien Murray-Pitts

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=ea16a81c-5b94-8dd0-8339-2bd82733aed2@linaro.org \
    --to=richard.henderson@linaro.org \
    --cc=laurent@vivier.eu \
    --cc=lucienmp.qemu@gmail.com \
    --cc=lucienmp_antispam@yahoo.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).