aboutsummaryrefslogtreecommitdiffstats
path: root/xen
diff options
context:
space:
mode:
authorStefano Stabellini <stefano.stabellini@eu.citrix.com>2012-03-13 16:04:05 +0000
committerStefano Stabellini <stefano.stabellini@eu.citrix.com>2012-03-13 16:04:05 +0000
commit40f20c4bfcd5d25c90f9419250ca8a229bf4c1e5 (patch)
tree874f1e9f8b886f87c0100149330199ff27c84a73 /xen
parentbf321201462ccf313c716e8067ed6795f405182d (diff)
downloadxen-40f20c4bfcd5d25c90f9419250ca8a229bf4c1e5.tar.gz
xen-40f20c4bfcd5d25c90f9419250ca8a229bf4c1e5.tar.bz2
xen-40f20c4bfcd5d25c90f9419250ca8a229bf4c1e5.zip
arm: use r12 to pass the hypercall number
** This is a guest visible ABI change which requires an updated guest kernel ** Use r12 to pass the hypercall number and r0-r4 for the hypercall arguments. Use the ISS to pass an hypervisor specific tag. Remove passing unused registers to arm_hypercall_table: we don't have 6 arguments hypercalls and we never use 64 bit values as hypercall arguments, 64 bit values are only contained within structs passed as arguments. Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com> [ use #ifndef NDEBUG, fix coding style, expand calling convention comment slightly and added a big fat note about ABI change - ijc ] Committed-by: Ian Campbell <ian.campbell@citrix.com>
Diffstat (limited to 'xen')
-rw-r--r--xen/arch/arm/traps.c33
-rw-r--r--xen/include/public/arch-arm.h23
2 files changed, 45 insertions, 11 deletions
diff --git a/xen/arch/arm/traps.c b/xen/arch/arm/traps.c
index 395d0af34e..acf8f6e2fc 100644
--- a/xen/arch/arm/traps.c
+++ b/xen/arch/arm/traps.c
@@ -367,7 +367,6 @@ unsigned long do_arch_0(unsigned int cmd, unsigned long long value)
}
typedef unsigned long arm_hypercall_t(
- unsigned int, unsigned int, unsigned int, unsigned int, unsigned int,
unsigned int, unsigned int, unsigned int, unsigned int, unsigned int);
#define HYPERCALL(x) \
@@ -407,18 +406,30 @@ static void do_debug_trap(struct cpu_user_regs *regs, unsigned int code)
static void do_trap_hypercall(struct cpu_user_regs *regs, unsigned long iss)
{
+ arm_hypercall_t *call = NULL;
local_irq_enable();
- regs->r0 = arm_hypercall_table[iss](regs->r0,
- regs->r1,
- regs->r2,
- regs->r3,
- regs->r4,
- regs->r5,
- regs->r6,
- regs->r7,
- regs->r8,
- regs->r9);
+ if ( iss != XEN_HYPERCALL_TAG )
+ {
+ printk("%s %d: received an alien hypercall iss=%lx\n", __func__ ,
+ __LINE__ , iss);
+ regs->r0 = -EINVAL;
+ return;
+ }
+
+ call = arm_hypercall_table[regs->r12];
+ if ( call == NULL )
+ {
+ regs->r0 = -ENOSYS;
+ return;
+ }
+
+ regs->r0 = call(regs->r0, regs->r1, regs->r2, regs->r3, regs->r4);
+
+#ifndef NDEBUG
+ /* clobber registers */
+ regs->r1 = regs->r2 = regs->r3 = regs->r4 = regs->r12 = 0xDEADBEEF;
+#endif
}
static void do_cp15_32(struct cpu_user_regs *regs,
diff --git a/xen/include/public/arch-arm.h b/xen/include/public/arch-arm.h
index edb78b488b..1b1bcf3235 100644
--- a/xen/include/public/arch-arm.h
+++ b/xen/include/public/arch-arm.h
@@ -27,6 +27,29 @@
#ifndef __XEN_PUBLIC_ARCH_ARM_H__
#define __XEN_PUBLIC_ARCH_ARM_H__
+/* hypercall calling convention
+ * ----------------------------
+ *
+ * A hypercall is issued using the ARM HVC instruction.
+ *
+ * A hypercall can take up to 5 arguments. These are passed in
+ * registers, the first argument in r0, the second argument in r1, the
+ * third in r2, the forth in r3 and the fifth in r4.
+ *
+ * The hypercall number is passed in r12.
+ *
+ * The HVC ISS must contain a Xen specific TAG: XEN_HYPERCALL_TAG.
+ *
+ * The return value is in r0.
+ *
+ * The hypercall will always clobber r0, r1, r2, r3, r4 and r12,
+ * regardless of how many arguments the particular hypercall takes.
+ *
+ */
+
+#define XEN_HYPERCALL_TAG 0XEA1
+
+
#ifndef __ASSEMBLY__
#define ___DEFINE_XEN_GUEST_HANDLE(name, type) \
typedef struct { type *p; } __guest_handle_ ## name