qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] AArch64 register SP value always appearing as zero in "info registers" (kvm control)
@ 2014-02-20 13:40 Claudio Fontana
  2014-02-20 13:46 ` Peter Maydell
  0 siblings, 1 reply; 3+ messages in thread
From: Claudio Fontana @ 2014-02-20 13:40 UTC (permalink / raw)
  To: Peter Maydell; +Cc: QEMU Developers

Hello,

I am running kvm controlled qemu using mach virt,

and I have this glitch where the SP value in "info registers" always
appears as zero to me:

(qemu) info registers
PC=00000000400b0044  SP=0000000000000000
X00=0000000040324000 X01=0000000040331000 X02=00000000400b0000
X03=0000000000000000
X04=0000000040080000 X05=0000000000000000 X06=0000000000000000
X07=0000000000000000
X08=0000000000000000 X09=0000000000000000 X10=0000000000000000
X11=0000000000000000
X12=0000000000000000 X13=0000000000000000 X14=0000000000000000
X15=0000000000000000
X16=0000000000000000 X17=0000000000000000 X18=0000000000000000
X19=0000000000000000
X20=0000000000000000 X21=0000000000000000 X22=0000000000000000
X23=0000000000000000
X24=0000000000000000 X25=0000000000000000 X26=0000000000000000
X27=0000000000000000
X28=0000000000000000 X29=0000000040324000 X30=00000000400b0014
PSTATE=600003c5 (flags -ZC-)

In the guest I am doing

adrp x0, something
mov sp, x0
mov x29, sp

and while I can see the x29 value (seen above), my SP still appears as zero..

I am at commit 91abb80b5f66e8387ae1a5ba85083e49b877938c (7th February)

Any idea about what could be wrong?

Thank you,

Claudio

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] AArch64 register SP value always appearing as zero in "info registers" (kvm control)
  2014-02-20 13:40 [Qemu-devel] AArch64 register SP value always appearing as zero in "info registers" (kvm control) Claudio Fontana
@ 2014-02-20 13:46 ` Peter Maydell
       [not found]   ` <CANv_3Ya7oye7fpt5cBsVpVxcKAjVpm4_yp5716nwiCOzgZqsdg@mail.gmail.com>
  0 siblings, 1 reply; 3+ messages in thread
From: Peter Maydell @ 2014-02-20 13:46 UTC (permalink / raw)
  To: Claudio Fontana; +Cc: QEMU Developers

On 20 February 2014 13:40, Claudio Fontana <hw.claudio@gmail.com> wrote:
> Hello,
>
> I am running kvm controlled qemu using mach virt,
>
> and I have this glitch where the SP value in "info registers" always
> appears as zero to me:
>
> (qemu) info registers
> PC=00000000400b0044  SP=0000000000000000
> X00=0000000040324000 X01=0000000040331000 X02=00000000400b0000
> X03=0000000000000000
> X04=0000000040080000 X05=0000000000000000 X06=0000000000000000
> X07=0000000000000000
> X08=0000000000000000 X09=0000000000000000 X10=0000000000000000
> X11=0000000000000000
> X12=0000000000000000 X13=0000000000000000 X14=0000000000000000
> X15=0000000000000000
> X16=0000000000000000 X17=0000000000000000 X18=0000000000000000
> X19=0000000000000000
> X20=0000000000000000 X21=0000000000000000 X22=0000000000000000
> X23=0000000000000000
> X24=0000000000000000 X25=0000000000000000 X26=0000000000000000
> X27=0000000000000000
> X28=0000000000000000 X29=0000000040324000 X30=00000000400b0014
> PSTATE=600003c5 (flags -ZC-)
>
> In the guest I am doing
>
> adrp x0, something
> mov sp, x0
> mov x29, sp
>
> and while I can see the x29 value (seen above), my SP still appears as zero..
>
> I am at commit 91abb80b5f66e8387ae1a5ba85083e49b877938c (7th February)
>
> Any idea about what could be wrong?

The code doesn't look obviously wrong; I suggest you stick
some debug printfs/breakpoints/etc in:
 target-arm/kvm64.c:kvm_arch_get_registers() where we ask
   the kernel for the value of SP and put it in xregs[31]
 target-arm/gdbstub64.c:aarch64_cpu_gdb_read_register()
   where we return xregs[31] when gdb asks for it

also enabling gdb's "debug all protocol packets" feature
may help.

thanks
-- PMM

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Qemu-devel] Fwd: AArch64 register SP value always appearing as zero in "info registers" (kvm control)
       [not found]     ` <CAFEAcA-gZx0nh9H62Xashah79A5Vpdj-SoG0_7zUJRJ2b7bZ2g@mail.gmail.com>
@ 2014-02-21  9:37       ` Claudio Fontana
  0 siblings, 0 replies; 3+ messages in thread
From: Claudio Fontana @ 2014-02-21  9:37 UTC (permalink / raw)
  To: QEMU Developers

I realized that I mistakenly stripped qemu-devel from the discussion;
forwarding to make the workaround and todo visible.

Claudio

---------- Forwarded message ----------
From: Peter Maydell <peter.maydell@linaro.org>
Date: 20 February 2014 16:18
Subject: Re: AArch64 register SP value always appearing as zero in
"info registers" (kvm control)
To: Claudio Fontana <hw.claudio@gmail.com>


On 20 February 2014 15:13, Claudio Fontana <hw.claudio@gmail.com> wrote:
> I got it to "work for me" by replacing AARCH64_CORE_REG(regs.sp)
> with AARCH64_CORE_REG(sp_el1), since I am at EL1.
>
> I read in kvm_arch_put_registers:
>
>     /* TODO:
>      * SP_EL1
>      * ELR_EL1
>      * SPSR[]
>      * FP state
>      * system registers
>      */
>
> So I think getting the SP at EL1 is not supported yet while running at
> EL1 and using SP_ELx.

Yeah. I guess we assumed regs.sp would be "current SP"...
I'll put it on my todo list to fix.

thanks
-- PMM

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-02-21  9:37 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-02-20 13:40 [Qemu-devel] AArch64 register SP value always appearing as zero in "info registers" (kvm control) Claudio Fontana
2014-02-20 13:46 ` Peter Maydell
     [not found]   ` <CANv_3Ya7oye7fpt5cBsVpVxcKAjVpm4_yp5716nwiCOzgZqsdg@mail.gmail.com>
     [not found]     ` <CAFEAcA-gZx0nh9H62Xashah79A5Vpdj-SoG0_7zUJRJ2b7bZ2g@mail.gmail.com>
2014-02-21  9:37       ` [Qemu-devel] Fwd: " Claudio Fontana

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).