All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Andreas Färber" <afaerber@suse.de>
To: Dunrong Huang <huangdr@cloud-times.com>,
	Anthony Green <green@moxielogic.com>
Cc: Blue Swirl <blauwirbel@gmail.com>, qemu-devel <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] [PATCH] target-moxie: set do_interrupt to a target-specific helper function
Date: Sun, 31 Mar 2013 19:01:04 +0200	[thread overview]
Message-ID: <51586BD0.6000207@suse.de> (raw)
In-Reply-To: <1364693753-3311-1-git-send-email-huangdr@cloud-times.com>

Am 31.03.2013 03:35, schrieb Dunrong Huang:
> The value of "do_interrupt" member of CPUClass shoule be set to a
> target-specific function, or it will lead to a segfault like below:
> 
> $ moxie-softmmu/qemu-system-moxie -M moxiesim
> Segmentation fault
> 
> Cc: Anthony Green <green@moxielogic.com>
> Cc: Blue Swirl <blauwirbel@gmail.com>
> Cc: Andreas Färber <afaerber@suse.de>
> Signed-off-by: Dunrong Huang <huangdr@cloud-times.com>
> ---
>  target-moxie/cpu.c    | 1 +
>  target-moxie/cpu.h    | 2 +-
>  target-moxie/helper.c | 7 +++++--
>  3 files changed, 7 insertions(+), 3 deletions(-)
> 
> diff --git a/target-moxie/cpu.c b/target-moxie/cpu.c
> index c17d3f0..c0855f0 100644
> --- a/target-moxie/cpu.c
> +++ b/target-moxie/cpu.c
> @@ -98,6 +98,7 @@ static void moxie_cpu_class_init(ObjectClass *oc, void *data)
>      cc->class_by_name = moxie_cpu_class_by_name;
>  
>      dc->vmsd = &vmstate_moxie_cpu;
> +    cc->do_interrupt = moxie_cpu_do_interrupt;
>  }
>  
>  static void moxielite_initfn(Object *obj)
> diff --git a/target-moxie/cpu.h b/target-moxie/cpu.h
> index b96236f..988729a 100644
> --- a/target-moxie/cpu.h
> +++ b/target-moxie/cpu.h
> @@ -117,7 +117,7 @@ static inline MoxieCPU *moxie_env_get_cpu(CPUMoxieState *env)
>  
>  MoxieCPU *cpu_moxie_init(const char *cpu_model);
>  int cpu_moxie_exec(CPUMoxieState *s);
> -void do_interrupt(CPUMoxieState *env);
> +void moxie_cpu_do_interrupt(CPUState *cs);
>  void moxie_translate_init(void);
>  int cpu_moxie_signal_handler(int host_signum, void *pinfo,
>                               void *puc);
> diff --git a/target-moxie/helper.c b/target-moxie/helper.c
> index 8604ce8..6e0ac2a 100644
> --- a/target-moxie/helper.c
> +++ b/target-moxie/helper.c
> @@ -102,7 +102,7 @@ void helper_debug(CPUMoxieState *env)
>  
>  #if defined(CONFIG_USER_ONLY)
>  
> -void do_interrupt(CPUState *env)
> +void moxie_cpu_do_interrupt(CPUState *env)
>  {
>      env->exception_index = -1;
>  }

Anthony, CPUState should not be named "env" but rather "cs" (to reserve
"cpu" for MoxieCPU). That's unrelated to this patch though.

> @@ -147,8 +147,11 @@ int cpu_moxie_handle_mmu_fault(CPUMoxieState *env, target_ulong address,
>  }
>  
>  
> -void do_interrupt(CPUMoxieState *env)
> +void moxie_cpu_do_interrupt(CPUState *cs)
>  {
> +    MoxieCPU *cpu = MOXIE_CPU(cs);
> +    CPUMoxieState *env = &cpu->env;
> +
>      switch (env->exception_index) {
>      case MOXIE_EX_BREAK:
>          break;

That exception_index is used once from CPUMoxieState and once from
CPUState is telling me something is fishy here...

Are any test images available?

Hooking up cc->do_interrupt is the correct thing to do though, so that
could be sorted out later,

Reviewed-by: Andreas Färber <afaerber@suse.de>

Andreas

-- 
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg

  parent reply	other threads:[~2013-03-31 17:01 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-31  1:35 [Qemu-devel] [PATCH] target-moxie: set do_interrupt to a target-specific helper function Dunrong Huang
2013-03-31 12:33 ` Anthony Green
2013-03-31 13:43   ` 黄敦荣
2013-03-31 17:01 ` Andreas Färber [this message]
2013-03-31 23:18   ` Anthony Green
2013-03-31 18:54 ` 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=51586BD0.6000207@suse.de \
    --to=afaerber@suse.de \
    --cc=blauwirbel@gmail.com \
    --cc=green@moxielogic.com \
    --cc=huangdr@cloud-times.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 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.