qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH qom-cpu 27/59] cpu: Turn cpu_unassigned_access()


From: Stefano Stabellini
Subject: Re: [Qemu-devel] [PATCH qom-cpu 27/59] cpu: Turn cpu_unassigned_access() into a CPUState hook
Date: Tue, 11 Jun 2013 12:51:22 +0100
User-agent: Alpine 2.02 (DEB 1266 2009-07-14)

On Tue, 11 Jun 2013, Andreas Färber wrote:
> Am 09.06.2013 21:12, schrieb Andreas Färber:
> > diff --git a/include/qom/cpu.h b/include/qom/cpu.h
> > index a69c09c..814d067 100644
> > --- a/include/qom/cpu.h
> > +++ b/include/qom/cpu.h
> [...]
> > @@ -383,6 +401,21 @@ void cpu_interrupt(CPUState *cpu, int mask);
> >  
> >  #endif /* USER_ONLY */
> >  
> > +#ifndef CONFIG_USER_ONLY
> > +
> > +static inline void cpu_unassigned_access(CPUState *cpu, hwaddr addr,
> > +                                         bool is_write, bool is_exec,
> > +                                         int opaque, unsigned size)
> > +{
> > +    CPUClass *cc = CPU_GET_CLASS(cpu);
> > +
> > +    if (cc->do_unassigned_access) {
> > +        cc->do_unassigned_access(cpu, addr, is_write, is_exec, opaque, 
> > size);
> > +    }
> > +}
> > +
> > +#endif
> > +
> >  /**
> >   * cpu_reset_interrupt:
> >   * @cpu: The CPU to clear the interrupt on.
> > diff --git a/memory.c b/memory.c
> > index 5cb8f4a..74daf03 100644
> > --- a/memory.c
> > +++ b/memory.c
> > @@ -857,9 +857,8 @@ static uint64_t unassigned_mem_read(void *opaque, 
> > hwaddr addr,
> >  #ifdef DEBUG_UNASSIGNED
> >      printf("Unassigned mem read " TARGET_FMT_plx "\n", addr);
> >  #endif
> > -#if defined(TARGET_ALPHA) || defined(TARGET_SPARC) || 
> > defined(TARGET_MICROBLAZE)
> > -    cpu_unassigned_access(cpu_single_env, addr, 0, 0, 0, size);
> > -#endif
> > +    cpu_unassigned_access(ENV_GET_CPU(cpu_single_env), addr, false, false, 
> > 0,
> > +                          size);
> >      return 0;
> >  }
> >  
> > @@ -869,9 +868,8 @@ static void unassigned_mem_write(void *opaque, hwaddr 
> > addr,
> >  #ifdef DEBUG_UNASSIGNED
> >      printf("Unassigned mem write " TARGET_FMT_plx " = 0x%"PRIx64"\n", 
> > addr, val);
> >  #endif
> > -#if defined(TARGET_ALPHA) || defined(TARGET_SPARC) || 
> > defined(TARGET_MICROBLAZE)
> > -    cpu_unassigned_access(cpu_single_env, addr, 1, 0, 0, size);
> > -#endif
> > +    cpu_unassigned_access(ENV_GET_CPU(cpu_single_env), addr, true, false, 
> > 0,
> > +                          size);
> >  }
> >  
> >  static bool unassigned_mem_accepts(void *opaque, hwaddr addr,
> 
> Taking a wild guess here, could it be that cpu_single_env is NULL in the
> Xen case, and we're tripping over cpu_unassigned_access() trying
> CPU_GET_CLASS(ENV_GET_CPU(NULL)) and asserting?

Good guess! cpu_single_env is NULL and removing the two calls to
cpu_unassigned_access "fixes" the problem.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]