From: Richard Henderson <rth@twiddle.net>
To: Bastian Koppelmann <kbastian@mail.uni-paderborn.de>,
qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH v2 1/4] target-tricore: Add trap handling
Date: Tue, 16 Feb 2016 07:52:14 +1100 [thread overview]
Message-ID: <56C23A7E.3090706@twiddle.net> (raw)
In-Reply-To: <1455541846-19126-2-git-send-email-kbastian@mail.uni-paderborn.de>
On 02/16/2016 12:10 AM, Bastian Koppelmann wrote:
> +
> +void tricore_cpu_do_interrupt(CPUState *cs)
> +{
> + TriCoreCPU *cpu = TRICORE_CPU(cs);
> + CPUTriCoreState *env = &cpu->env;
> +
> + if (cs->exception_index <= TRAPC_NMI) {
> + /* The trap vector table is accessed to fetch the first instruction of
> + the trap handler. */
> + env->PC = env->BTV | (cs->exception_index << 5);
> + } else if (cs->exception_index == TRAPC_IRQ) {
> + /* The interrupt vector table is accessed to fetch the first instruction
> + of the interrupt handler. */
> + env->PC = env->BIV | ((env->ICR & MASK_ICR_PIPN) >> 10);
> + }
> +}
You've still got a path whereby you modify PC without saving the old one.
I don't think you want to add the do_interrupt hook at all until you're ready
to do real async interrupts.
> + /* PCXI.PCPN = ICR.CCPN */
> + env->PCXI = (env->PCXI & 0xffffff) +
> + ((env->ICR & MASK_ICR_CCPN) << 24);
> + cs->exception_index = class;
> + cpu_loop_exit(cs);
> +}
> +
There's no reason you can't modify PC here at the end of
raise_exception_sync_internal. If you omit the set of exception_index here,
you'll simply exit the cpu loop and immediately re-enter it at the new PC,
without having to go through the do_interrupt hook.
r~
next prev parent reply other threads:[~2016-02-15 20:52 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-15 13:10 [Qemu-devel] [PATCH v2 0/4] TriCore exception patches Bastian Koppelmann
2016-02-15 13:10 ` [Qemu-devel] [PATCH v2 1/4] target-tricore: Add trap handling Bastian Koppelmann
2016-02-15 20:52 ` Richard Henderson [this message]
2016-02-15 13:10 ` [Qemu-devel] [PATCH v2 2/4] target-tricore: add context managment trap generation Bastian Koppelmann
2016-02-15 13:10 ` [Qemu-devel] [PATCH v2 3/4] target-tricore: add illegal opcode " Bastian Koppelmann
2016-02-15 13:10 ` [Qemu-devel] [PATCH v2 4/4] target-tricore: add opd " Bastian Koppelmann
2016-02-15 20:52 ` [Qemu-devel] [PATCH v2 0/4] TriCore exception patches Richard Henderson
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=56C23A7E.3090706@twiddle.net \
--to=rth@twiddle.net \
--cc=kbastian@mail.uni-paderborn.de \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.