qemu-ppc
[Top][All Lists]
Advanced

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

Re: [Qemu-ppc] [PATCH] hmp: fix "dump-quest-memory" segfault (ppc)


From: Miroslav Rezanina
Subject: Re: [Qemu-ppc] [PATCH] hmp: fix "dump-quest-memory" segfault (ppc)
Date: Tue, 12 Sep 2017 00:52:57 -0400 (EDT)


----- Original Message -----
> From: "Thomas Huth" <address@hidden>
> To: "Laurent Vivier" <address@hidden>, address@hidden
> Cc: "David Gibson" <address@hidden>, address@hidden, "Dr . David Alan Gilbert"
> <address@hidden>, "Miroslav Rezanina" <address@hidden>
> Sent: Monday, September 11, 2017 4:36:01 PM
> Subject: Re: [PATCH] hmp: fix "dump-quest-memory" segfault (ppc)
> 
> On 11.09.2017 13:00, Laurent Vivier wrote:
> > Commit fd5d23babf (hmp: fix "dump-quest-memory" segfault)
> > fixes the problem for i386, do the same for ppc.
> > 
> > Running QEMU with
> >     qemu-system-ppc64 -M none -nographic -m 256
> > and executing
> >     dump-guest-memory /dev/null 0 8192
> > results in segfault
> > 
> > Fix by checking if we have CPU.
> > 
> > Signed-off-by: Laurent Vivier <address@hidden>
> > ---
> >  target/ppc/arch_dump.c | 17 +++++++++++------
> >  1 file changed, 11 insertions(+), 6 deletions(-)
> > 
> > diff --git a/target/ppc/arch_dump.c b/target/ppc/arch_dump.c
> > index 8e9397aa58..dcb7b19950 100644
> > --- a/target/ppc/arch_dump.c
> > +++ b/target/ppc/arch_dump.c
> > @@ -224,17 +224,22 @@ typedef struct NoteFuncDescStruct NoteFuncDesc;
> >  int cpu_get_dump_info(ArchDumpInfo *info,
> >                        const struct GuestPhysBlockList *guest_phys_blocks)
> >  {
> > -    PowerPCCPU *cpu = POWERPC_CPU(first_cpu);
> > -    PowerPCCPUClass *pcc = POWERPC_CPU_GET_CLASS(cpu);
> > -
> >      info->d_machine = PPC_ELF_MACHINE;
> >      info->d_class = ELFCLASS;
> >  
> > -    if ((*pcc->interrupts_big_endian)(cpu)) {
> > -        info->d_endian = ELFDATA2MSB;
> > +    if (first_cpu) {
> > +        PowerPCCPU *cpu = POWERPC_CPU(first_cpu);
> > +        PowerPCCPUClass *pcc = POWERPC_CPU_GET_CLASS(cpu);
> > +
> > +        if ((*pcc->interrupts_big_endian)(cpu)) {
> > +            info->d_endian = ELFDATA2MSB;
> > +        } else {
> > +            info->d_endian = ELFDATA2LSB;
> > +        }
> >      } else {
> > -        info->d_endian = ELFDATA2LSB;
> > +        info->d_endian = ELFDATA2MSB;
> >      }
> > +
> >      /* 64KB is the max page size for pseries kernel */
> >      if (strncmp(object_get_typename(qdev_get_machine()),
> >                  "pseries-", 8) == 0) {
> > 
> 
> Reviewed-by: Thomas Huth <address@hidden>
> 

We need similar fix for aarch64 too.

Mirek
-- 
Miroslav Rezanina
Software Engineer - Virtualization Team




reply via email to

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