From: Tamas K Lengyel <tamas@tklengyel.com>
To: xen-devel@lists.xenproject.org
Cc: Wei Liu <wei.liu2@citrix.com>,
Tamas K Lengyel <tamas@tklengyel.com>,
Ian Jackson <ian.jackson@eu.citrix.com>
Subject: [PATCH v4 7/8] tools/xen-access: add test-case for ARM SMC
Date: Sun, 29 May 2016 16:37:09 -0600 [thread overview]
Message-ID: <1464561430-13465-7-git-send-email-tamas@tklengyel.com> (raw)
In-Reply-To: <1464561430-13465-1-git-send-email-tamas@tklengyel.com>
Signed-off-by: Tamas K Lengyel <tamas@tklengyel.com>
Acked-by: Razvan Cojocaru <rcojocaru@bitdefender.com>
---
Cc: Ian Jackson <ian.jackson@eu.citrix.com>
Cc: Wei Liu <wei.liu2@citrix.com>
---
tools/tests/xen-access/xen-access.c | 48 ++++++++++++++++++++++++++++++++++---
1 file changed, 45 insertions(+), 3 deletions(-)
diff --git a/tools/tests/xen-access/xen-access.c b/tools/tests/xen-access/xen-access.c
index f26e723..1b2b3fd 100644
--- a/tools/tests/xen-access/xen-access.c
+++ b/tools/tests/xen-access/xen-access.c
@@ -1,5 +1,4 @@
-/*
- * xen-access.c
+/* xen-access.c
*
* Exercises the basic per-page access mechanisms
*
@@ -334,6 +333,8 @@ void usage(char* progname)
fprintf(stderr, "Usage: %s [-m] <domain_id> write|exec", progname);
#if defined(__i386__) || defined(__x86_64__)
fprintf(stderr, "|breakpoint|altp2m_write|altp2m_exec");
+#elif defined(__arm__) || defined(__aarch64__)
+ fprintf(stderr, "|privcall");
#endif
fprintf(stderr,
"\n"
@@ -357,6 +358,7 @@ int main(int argc, char *argv[])
int required = 0;
int breakpoint = 0;
int shutting_down = 0;
+ int privcall = 0;
int altp2m = 0;
uint16_t altp2m_view_id = 0;
@@ -412,6 +414,11 @@ int main(int argc, char *argv[])
default_access = XENMEM_access_rw;
altp2m = 1;
}
+#elif defined(__arm__) || defined(__aarch64__)
+ else if ( !strcmp(argv[0], "privcall") )
+ {
+ privcall = 1;
+ }
#endif
else
{
@@ -524,6 +531,16 @@ int main(int argc, char *argv[])
}
}
+ if ( privcall )
+ {
+ rc = xc_monitor_privileged_call(xch, domain_id, 1);
+ if ( rc < 0 )
+ {
+ ERROR("Error %d setting privileged call trapping with vm_event\n", rc);
+ goto exit;
+ }
+ }
+
/* Wait for access */
for (;;)
{
@@ -535,6 +552,9 @@ int main(int argc, char *argv[])
if ( breakpoint )
rc = xc_monitor_software_breakpoint(xch, domain_id, 0);
+ if ( privcall )
+ rc = xc_monitor_privileged_call(xch, domain_id, 0);
+
if ( altp2m )
{
rc = xc_altp2m_switch_to_view( xch, domain_id, 0 );
@@ -635,7 +655,7 @@ int main(int argc, char *argv[])
rsp.u.mem_access = req.u.mem_access;
break;
case VM_EVENT_REASON_SOFTWARE_BREAKPOINT:
- printf("Breakpoint: rip=%016"PRIx64", gfn=%"PRIx64" (vcpu %d)\n",
+ printf("Breakpoint: rip=%016"PRIx64" gfn=%"PRIx64" (vcpu %d)\n",
req.data.regs.x86.rip,
req.u.software_breakpoint.gfn,
req.vcpu_id);
@@ -650,7 +670,29 @@ int main(int argc, char *argv[])
interrupted = -1;
continue;
}
+ break;
+ case VM_EVENT_REASON_PRIVILEGED_CALL:
+ {
+ const struct vm_event_regs_arm *in_regs = &req.data.regs.arm;
+ struct vm_event_regs_arm *out_regs = &rsp.data.regs.arm;
+ bool is32bit = !!(in_regs->cpsr & PSR_MODE_BIT);
+ uint64_t pc;
+
+ *out_regs = *in_regs;
+
+ if ( is32bit ) {
+ pc = in_regs->arch.arm32.pc;
+ out_regs->arch.arm32.pc += 4;
+ } else {
+ pc = in_regs->arch.arm64.pc;
+ out_regs->arch.arm64.pc += 8;
+ }
+ printf("Privileged call: pc=%016"PRIx64" (vcpu %d)\n",
+ pc, req.vcpu_id);
+
+ rsp.flags |= VM_EVENT_FLAG_SET_REGISTERS;
+ }
break;
case VM_EVENT_REASON_SINGLESTEP:
printf("Singlestep: rip=%016"PRIx64", vcpu %d, altp2m %u\n",
--
2.8.1
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel
next prev parent reply other threads:[~2016-05-29 22:38 UTC|newest]
Thread overview: 56+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-05-29 22:37 [PATCH v4 1/8] monitor: Rename vm_event_monitor_get_capabilities Tamas K Lengyel
2016-05-29 22:37 ` [PATCH v4 2/8] monitor: Rename vm_event_monitor_guest_request Tamas K Lengyel
2016-05-30 7:05 ` Razvan Cojocaru
2016-05-30 13:51 ` Jan Beulich
2016-05-29 22:37 ` [PATCH v4 3/8] monitor: Rename hvm/event to hvm/monitor Tamas K Lengyel
2016-05-30 7:08 ` Razvan Cojocaru
2016-05-30 13:53 ` Jan Beulich
2016-05-29 22:37 ` [PATCH v4 4/8] monitor: ARM SMC events Tamas K Lengyel
2016-06-01 11:37 ` Julien Grall
[not found] ` <CABfawhmO9tUG3-OcorfwqdOgZTkjoUk+u=dHySGonBDvobqyKw@mail.gmail.com>
[not found] ` <CABfawhmK2GAmQqZMhrgjYzeUZ_XaoyRUPuJxyPK5LJEHwsp5SA@mail.gmail.com>
[not found] ` <CABfawh=J1fwinTYKGvJNrFPOsGLSXz6U3GE8fxPz3-KsXSWfbQ@mail.gmail.com>
[not found] ` <CABfawhn7zvE=hn0hq1ryH+sW-jdkAXgZM1C2KxwZVUE8pbp8cQ@mail.gmail.com>
2016-06-01 15:41 ` Tamas K Lengyel
2016-06-02 14:23 ` Julien Grall
2016-06-02 22:31 ` Tamas K Lengyel
2016-07-04 19:13 ` Tamas K Lengyel
2016-07-04 20:02 ` Julien Grall
2016-07-04 21:05 ` Tamas K Lengyel
2016-07-05 9:58 ` Julien Grall
2016-05-29 22:37 ` [PATCH v4 5/8] arm/vm_event: get/set registers Tamas K Lengyel
2016-05-30 7:09 ` Razvan Cojocaru
2016-05-30 11:50 ` Jan Beulich
2016-05-30 19:47 ` Tamas K Lengyel
2016-05-30 20:20 ` Julien Grall
2016-05-30 20:37 ` Tamas K Lengyel
2016-05-30 20:46 ` Razvan Cojocaru
2016-05-30 20:53 ` Tamas K Lengyel
2016-05-30 21:35 ` Julien Grall
2016-05-30 21:41 ` Tamas K Lengyel
2016-05-31 7:54 ` Jan Beulich
2016-05-31 8:06 ` Razvan Cojocaru
2016-05-31 8:30 ` Jan Beulich
2016-05-31 16:20 ` Tamas K Lengyel
2016-05-31 7:48 ` Jan Beulich
2016-05-31 16:28 ` Tamas K Lengyel
2016-06-01 8:41 ` Jan Beulich
2016-06-01 11:24 ` Julien Grall
2016-06-01 18:21 ` Tamas K Lengyel
2016-06-01 19:34 ` Razvan Cojocaru
2016-06-01 19:43 ` Julien Grall
2016-06-02 7:35 ` Jan Beulich
2016-06-02 8:26 ` Razvan Cojocaru
2016-06-02 9:38 ` Jan Beulich
2016-06-02 9:42 ` Razvan Cojocaru
2016-06-01 19:38 ` Julien Grall
2016-06-01 19:49 ` Julien Grall
2016-06-01 19:50 ` Tamas K Lengyel
2016-05-29 22:37 ` [PATCH v4 6/8] tools/libxc: add xc_monitor_privileged_call Tamas K Lengyel
2016-05-29 22:37 ` Tamas K Lengyel [this message]
2016-05-30 9:56 ` [PATCH v4 7/8] tools/xen-access: add test-case for ARM SMC Wei Liu
2016-05-29 22:37 ` [PATCH v4 8/8] x86/vm_event: Add HVM debug exception vm_events Tamas K Lengyel
2016-05-30 7:29 ` Razvan Cojocaru
2016-05-30 14:16 ` Jan Beulich
2016-05-30 20:13 ` Tamas K Lengyel
2016-05-30 20:58 ` Andrew Cooper
2016-05-31 7:59 ` Jan Beulich
2016-06-01 21:46 ` Tamas K Lengyel
2016-06-01 22:17 ` Andrew Cooper
2016-06-02 0:01 ` Tamas K Lengyel
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=1464561430-13465-7-git-send-email-tamas@tklengyel.com \
--to=tamas@tklengyel.com \
--cc=ian.jackson@eu.citrix.com \
--cc=wei.liu2@citrix.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).