qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Richard Henderson <rth@twiddle.net>
To: Bastian Koppelmann <kbastian@mail.uni-paderborn.de>,
	qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH 1/5] target-tricore: Add trap handling
Date: Sat, 13 Feb 2016 05:55:05 +1100	[thread overview]
Message-ID: <56BE2A89.6050905@twiddle.net> (raw)
In-Reply-To: <56BDBE2D.6020209@mail.uni-paderborn.de>

On 02/12/2016 10:12 PM, Bastian Koppelmann wrote:
> On 02/12/2016 03:39 AM, Richard Henderson wrote:
>> On 02/12/2016 03:01 AM, Bastian Koppelmann wrote:
>>> +void tricore_cpu_do_interrupt(CPUState *cs)
>>> +{
>>> +    TriCoreCPU *cpu = TRICORE_CPU(cs);
>>> +    CPUTriCoreState *env = &cpu->env;
>>> +
>>> +    /* The stack pointer in A[10] is set to the Interrupt Stack
>>> Pointer (ISP)
>>> +       when the processor was not previously using the interrupt stack
>>> +       (in case of PSW.IS = 0). The stack pointer bit is set for
>>> using the
>>> +       interrupt stack: PSW.IS = 1. */
>>> +    if ((env->PSW & MASK_PSW_IS) == 0) {
>>> +        env->gpr_a[10] = env->ISP;
>>> +    }
>>
>> You appear to have forgotten to save pre-interrupt state here.
>
> What do you mean by "pre-interrupt state"? The register context is saved
> by generate_trap() calls.

Because do_interrupt is normally for handling asynchronous interrupts.  Stuff 
that isn't related at all to the instruction stream.  Which therefore could not 
have saved anything at all.

It does get (ab)used on some targets for synchronous events, because the method 
by which kernel entry is made is the same and the author wanted to share code.

But if you have no external hardware devices, no timer interrupt or anything, 
let's not start by passing synchronous events through this function.  It sounds 
like the code here in do_interrupt more properly belongs at the end of 
generate_trap.

Err.. the generate_trap in op_helper I mean.  It's confusing that you have two 
(static) functions of the same name in different files.

I do wonder if these two functions ought to share more code.  For instance, 
op_helper.c places TIN into a_15, whereas translate.c places TIN into d_15.


r~

  reply	other threads:[~2016-02-12 18:55 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-11 16:01 [Qemu-devel] [PATCH 0/5] TriCore exception patches Bastian Koppelmann
2016-02-11 16:01 ` [Qemu-devel] [PATCH 1/5] target-tricore: Add trap handling Bastian Koppelmann
2016-02-12  2:39   ` Richard Henderson
2016-02-12 11:12     ` Bastian Koppelmann
2016-02-12 18:55       ` Richard Henderson [this message]
2016-02-12 20:08         ` Bastian Koppelmann
2016-02-12  2:44   ` Richard Henderson
2016-02-11 16:01 ` [Qemu-devel] [PATCH 2/5] target-tricore: Save the pc before CSA operations for exceptions Bastian Koppelmann
2016-02-11 16:01 ` [Qemu-devel] [PATCH 3/5] target-tricore: add context managment trap generation Bastian Koppelmann
2016-02-11 16:01 ` [Qemu-devel] [PATCH 4/5] target-tricore: add illegal opcode " Bastian Koppelmann
2016-02-11 16:02 ` [Qemu-devel] [PATCH 5/5] target-tricore: add opd " Bastian Koppelmann

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=56BE2A89.6050905@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 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).