#ifndef _VMWGFX_MSG_ARM64_H
#define _VMWGFX_MSG_ARM64_H
#if defined(__aarch64__)
#define VMWARE_HYPERVISOR_PORT …
#define VMWARE_HYPERVISOR_PORT_HB …
#define VMWARE_HYPERVISOR_HB …
#define VMWARE_HYPERVISOR_OUT …
#define VMWARE_HYPERVISOR_MAGIC …
#define X86_IO_MAGIC …
#define X86_IO_W7_SIZE_SHIFT …
#define X86_IO_W7_SIZE_MASK …
#define X86_IO_W7_DIR …
#define X86_IO_W7_WITH …
#define X86_IO_W7_STR …
#define X86_IO_W7_DF …
#define X86_IO_W7_IMM_SHIFT …
#define X86_IO_W7_IMM_MASK …
static inline
unsigned long vmware_hypercall1(unsigned long cmd, unsigned long in1)
{
register u64 x0 asm("x0") = VMWARE_HYPERVISOR_MAGIC;
register u64 x1 asm("x1") = in1;
register u64 x2 asm("x2") = cmd;
register u64 x3 asm("x3") = VMWARE_HYPERVISOR_PORT;
register u64 x7 asm("x7") = ((u64)X86_IO_MAGIC << 32) |
X86_IO_W7_WITH |
X86_IO_W7_DIR |
(2 << X86_IO_W7_SIZE_SHIFT);
asm_inline volatile (
"mrs xzr, mdccsr_el0; "
: "+r" (x0)
: "r" (x1), "r" (x2), "r" (x3), "r" (x7)
: "memory");
return x0;
}
static inline
unsigned long vmware_hypercall5(unsigned long cmd, unsigned long in1,
unsigned long in3, unsigned long in4,
unsigned long in5, u32 *out2)
{
register u64 x0 asm("x0") = VMWARE_HYPERVISOR_MAGIC;
register u64 x1 asm("x1") = in1;
register u64 x2 asm("x2") = cmd;
register u64 x3 asm("x3") = in3 | VMWARE_HYPERVISOR_PORT;
register u64 x4 asm("x4") = in4;
register u64 x5 asm("x5") = in5;
register u64 x7 asm("x7") = ((u64)X86_IO_MAGIC << 32) |
X86_IO_W7_WITH |
X86_IO_W7_DIR |
(2 << X86_IO_W7_SIZE_SHIFT);
asm_inline volatile (
"mrs xzr, mdccsr_el0; "
: "+r" (x0), "+r" (x2)
: "r" (x1), "r" (x3), "r" (x4), "r" (x5), "r" (x7)
: "memory");
*out2 = x2;
return x0;
}
static inline
unsigned long vmware_hypercall6(unsigned long cmd, unsigned long in1,
unsigned long in3, u32 *out2,
u32 *out3, u32 *out4, u32 *out5)
{
register u64 x0 asm("x0") = VMWARE_HYPERVISOR_MAGIC;
register u64 x1 asm("x1") = in1;
register u64 x2 asm("x2") = cmd;
register u64 x3 asm("x3") = in3 | VMWARE_HYPERVISOR_PORT;
register u64 x4 asm("x4");
register u64 x5 asm("x5");
register u64 x7 asm("x7") = ((u64)X86_IO_MAGIC << 32) |
X86_IO_W7_WITH |
X86_IO_W7_DIR |
(2 << X86_IO_W7_SIZE_SHIFT);
asm_inline volatile (
"mrs xzr, mdccsr_el0; "
: "+r" (x0), "+r" (x2), "+r" (x3), "=r" (x4), "=r" (x5)
: "r" (x1), "r" (x7)
: "memory");
*out2 = x2;
*out3 = x3;
*out4 = x4;
*out5 = x5;
return x0;
}
static inline
unsigned long vmware_hypercall7(unsigned long cmd, unsigned long in1,
unsigned long in3, unsigned long in4,
unsigned long in5, u32 *out1,
u32 *out2, u32 *out3)
{
register u64 x0 asm("x0") = VMWARE_HYPERVISOR_MAGIC;
register u64 x1 asm("x1") = in1;
register u64 x2 asm("x2") = cmd;
register u64 x3 asm("x3") = in3 | VMWARE_HYPERVISOR_PORT;
register u64 x4 asm("x4") = in4;
register u64 x5 asm("x5") = in5;
register u64 x7 asm("x7") = ((u64)X86_IO_MAGIC << 32) |
X86_IO_W7_WITH |
X86_IO_W7_DIR |
(2 << X86_IO_W7_SIZE_SHIFT);
asm_inline volatile (
"mrs xzr, mdccsr_el0; "
: "+r" (x0), "+r" (x1), "+r" (x2), "+r" (x3)
: "r" (x4), "r" (x5), "r" (x7)
: "memory");
*out1 = x1;
*out2 = x2;
*out3 = x3;
return x0;
}
static inline
unsigned long vmware_hypercall_hb(unsigned long cmd, unsigned long in2,
unsigned long in3, unsigned long in4,
unsigned long in5, unsigned long in6,
u32 *out1, int dir)
{
register u64 x0 asm("x0") = VMWARE_HYPERVISOR_MAGIC;
register u64 x1 asm("x1") = cmd;
register u64 x2 asm("x2") = in2;
register u64 x3 asm("x3") = in3 | VMWARE_HYPERVISOR_PORT_HB;
register u64 x4 asm("x4") = in4;
register u64 x5 asm("x5") = in5;
register u64 x6 asm("x6") = in6;
register u64 x7 asm("x7") = ((u64)X86_IO_MAGIC << 32) |
X86_IO_W7_STR |
X86_IO_W7_WITH |
dir;
asm_inline volatile (
"mrs xzr, mdccsr_el0; "
: "+r" (x0), "+r" (x1)
: "r" (x2), "r" (x3), "r" (x4), "r" (x5),
"r" (x6), "r" (x7)
: "memory");
*out1 = x1;
return x0;
}
static inline
unsigned long vmware_hypercall_hb_out(unsigned long cmd, unsigned long in2,
unsigned long in3, unsigned long in4,
unsigned long in5, unsigned long in6,
u32 *out1)
{
return vmware_hypercall_hb(cmd, in2, in3, in4, in5, in6, out1, 0);
}
static inline
unsigned long vmware_hypercall_hb_in(unsigned long cmd, unsigned long in2,
unsigned long in3, unsigned long in4,
unsigned long in5, unsigned long in6,
u32 *out1)
{
return vmware_hypercall_hb(cmd, in2, in3, in4, in5, in6, out1,
X86_IO_W7_DIR);
}
#endif
#endif