xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Julien Grall <julien.grall@arm.com>
To: Tamas K Lengyel <tamas.lengyel@zentific.com>,
	xen-devel@lists.xenproject.org
Cc: Stefano Stabellini <sstabellini@kernel.org>
Subject: Re: [PATCH v8 4/6] arm/vm_event: get/set registers
Date: Wed, 6 Jul 2016 19:04:58 +0100	[thread overview]
Message-ID: <577D484A.3030906@arm.com> (raw)
In-Reply-To: <1467743871-9644-4-git-send-email-tamas.lengyel@zentific.com>



On 05/07/16 19:37, Tamas K Lengyel wrote:
> +void vm_event_fill_regs(vm_event_request_t *req)
> +{
> +    const struct cpu_user_regs *regs = guest_cpu_user_regs();
> +
> +    req->data.regs.arm.cpsr = regs->cpsr;
> +    req->data.regs.arm.ttbr0 = READ_SYSREG64(TTBR0_EL1);
> +    req->data.regs.arm.ttbr1 = READ_SYSREG64(TTBR1_EL1);
> +
> +    if ( psr_mode_is_32bit(regs->cpsr) )
> +    {
> +        req->data.regs.arm.arch.arm32.r0 = regs->r0;
> +        req->data.regs.arm.arch.arm32.r1 = regs->r1;
> +        req->data.regs.arm.arch.arm32.r2 = regs->r2;
> +        req->data.regs.arm.arch.arm32.r3 = regs->r3;
> +        req->data.regs.arm.arch.arm32.r4 = regs->r4;
> +        req->data.regs.arm.arch.arm32.r5 = regs->r5;
> +        req->data.regs.arm.arch.arm32.r6 = regs->r6;
> +        req->data.regs.arm.arch.arm32.r7 = regs->r7;
> +        req->data.regs.arm.arch.arm32.r8 = regs->r8;
> +        req->data.regs.arm.arch.arm32.r9 = regs->r9;
> +        req->data.regs.arm.arch.arm32.r10 = regs->r10;
> +        req->data.regs.arm.arch.arm32.r11 = regs->fp;
> +        req->data.regs.arm.arch.arm32.r12 = regs->r12;
> +        req->data.regs.arm.arch.arm32.r13 = regs->sp;

Please look at the description of "sp" in cpu_user_regs. You will notice 
this is only valid for the hypervisor.

There are multiple stack pointers for the guest depending on the running 
mode (see B9.2.1 in ARM DDI 0406C.c), so you may want to pass all of them.

> +        req->data.regs.arm.arch.arm32.r14 = regs->lr;

Whilst lr is an union with lr_usr on ARM32 port, for the ARM64 port they 
are distinct (see cpu_users). So you would use the wrong register here.

However, as for sp, there are multiple lr pointers for the guest 
depending on the running mode. So you will pass the wrong lr if the 
guest is running in another mode than user.

Regards,

-- 
Julien Grall

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

  parent reply	other threads:[~2016-07-06 18:05 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-05 18:37 [PATCH v8 1/6] monitor: rename and relocate vm_event_monitor_traps Tamas K Lengyel
2016-07-05 18:37 ` [PATCH v8 2/6] arm: filter SMC exceptions with failed condition checks Tamas K Lengyel
2016-07-06 17:31   ` Julien Grall
2016-07-06 18:52     ` Tamas K Lengyel
2016-07-05 18:37 ` [PATCH v8 3/6] monitor: ARM SMC events Tamas K Lengyel
2016-07-05 18:37 ` [PATCH v8 4/6] arm/vm_event: get/set registers Tamas K Lengyel
2016-07-06  7:43   ` Jan Beulich
2016-07-06  7:59     ` Razvan Cojocaru
2016-07-06 17:39     ` Julien Grall
2016-07-06 19:23     ` Tamas K Lengyel
2016-07-06 21:12       ` Julien Grall
2016-07-06 22:01         ` Tamas K Lengyel
2016-07-06 18:04   ` Julien Grall [this message]
2016-07-06 19:12     ` Tamas K Lengyel
2016-07-07  8:23       ` Jan Beulich
2016-07-07  9:46         ` Julien Grall
2016-07-07  9:57           ` Jan Beulich
2016-07-07 10:09             ` Julien Grall
2016-07-07 15:53               ` Tamas K Lengyel
2016-07-05 18:37 ` [PATCH v8 5/6] tools/libxc: add xc_monitor_privileged_call Tamas K Lengyel
2016-07-05 18:37 ` [PATCH v8 6/6] tools/xen-access: add test-case for ARM SMC Tamas K Lengyel
2016-07-07 10:05   ` Julien Grall
2016-07-07 15:54     ` Tamas K Lengyel
2016-07-05 19:15 ` [PATCH v8 1/6] monitor: rename and relocate vm_event_monitor_traps Razvan Cojocaru

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=577D484A.3030906@arm.com \
    --to=julien.grall@arm.com \
    --cc=sstabellini@kernel.org \
    --cc=tamas.lengyel@zentific.com \
    --cc=xen-devel@lists.xenproject.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).