Instruction: vmcall
Hypercall code: RAX
-1. argument: RDI
-2. argument: RSI
-3. argument: RDX
-4. argument: RCX
+Argument: RDI
Return code: RAX
This hypercall can only be issued on CPUs belonging to the Linux cell.
-Arguments: none
+Argument: none
Return code: 0 on success, negative error code otherwise
This hypercall can only be issued on CPUs belonging to the Linux cell.
-Arguments: 1. Guest-physical address of cell configuration (see [2] for
- details)
+Argument: guest-physical address of cell configuration (see [2] for details)
Return code: positive cell ID or negative error code
This hypercall can only be issued on CPUs belonging to the root cell.
-Arguments: 1. ID of cell to be destroyed
+Argument: ID of cell to be destroyed
Return code: 0 on success, negative error code otherwise
Obtain information about specific hypervisor states.
-Arguments: 1. Information type:
+Argument: Information type:
0 - number of pages in hypervisor memory pool
1 - used pages of hypervisor memory pool
2 - number of pages in hypervisor remapping pool
Obtain information about the state of a specific cell.
-Arguments: 1. ID of cell to be queried
+Argument: ID of cell to be queried
This hypercall can only be issued on CPUs belonging to the root cell.
Obtain information about the state of a specific CPU.
-Arguments: 1. logical ID of CPU to be queried
+Argument: logical ID of CPU to be queried
Return code: CPU state (>=0) or negative error code
{
struct cell *cell = container_of(kobj, struct cell, kobj);
- switch (jailhouse_call1(JAILHOUSE_HC_CELL_GET_STATE, cell->id)) {
+ switch (jailhouse_call_arg(JAILHOUSE_HC_CELL_GET_STATE, cell->id)) {
case JAILHOUSE_CELL_RUNNING:
return sprintf(buffer, "running\n");
case JAILHOUSE_CELL_SHUT_DOWN:
return -ENOMEM;
for_each_cpu_mask(cpu, cell->cpus_assigned)
- if (jailhouse_call1(JAILHOUSE_HC_CPU_GET_STATE, cpu) ==
+ if (jailhouse_call_arg(JAILHOUSE_HC_CPU_GET_STATE, cpu) ==
JAILHOUSE_CPU_FAILED)
cpu_set(cpu, *cpus_failed);
readl(page);
/* either returns 0 or the same error code across all CPUs */
- err = jailhouse_call0(JAILHOUSE_HC_DISABLE);
+ err = jailhouse_call(JAILHOUSE_HC_DISABLE);
if (err)
error_code = err;
cpu_clear(cpu, root_cell->cpus_assigned);
}
- id = jailhouse_call1(JAILHOUSE_HC_CELL_CREATE, __pa(config));
+ id = jailhouse_call_arg(JAILHOUSE_HC_CELL_CREATE, __pa(config));
if (id < 0) {
err = id;
goto error_cpu_online;
goto unlock_out;
}
- err = jailhouse_call1(JAILHOUSE_HC_CELL_DESTROY, cell->id);
+ err = jailhouse_call_arg(JAILHOUSE_HC_CELL_DESTROY, cell->id);
if (err)
goto unlock_out;
return -EINTR;
if (enabled)
- val = jailhouse_call1(JAILHOUSE_HC_HYPERVISOR_GET_INFO, type);
+ val = jailhouse_call_arg(JAILHOUSE_HC_HYPERVISOR_GET_INFO,
+ type);
if (val >= 0)
result = sprintf(buffer, "%ld\n", val);
else
#define JAILHOUSE_CALL_INS ".arch_extension virt\n\t" \
"hvc #0x4a48"
#define JAILHOUSE_CALL_NUM_RESULT "r0"
-#define JAILHOUSE_CALL_ARG1 "r1"
-#define JAILHOUSE_CALL_ARG2 "r2"
-#define JAILHOUSE_CALL_ARG3 "r3"
-#define JAILHOUSE_CALL_ARG4 "r4"
+#define JAILHOUSE_CALL_ARG "r1"
#ifndef __asmeq
#define __asmeq(x, y) ".ifnc " x "," y " ; .err ; .endif\n\t"
#ifndef __ASSEMBLY__
-static inline __u32 jailhouse_call0(__u32 num)
+static inline __u32 jailhouse_call(__u32 num)
{
register __u32 num_result asm(JAILHOUSE_CALL_NUM_RESULT) = num;
return num_result;
}
-static inline __u32 jailhouse_call1(__u32 num, __u32 arg1)
+static inline __u32 jailhouse_call_arg(__u32 num, __u32 arg)
{
register __u32 num_result asm(JAILHOUSE_CALL_NUM_RESULT) = num;
- register __u32 __arg1 asm(JAILHOUSE_CALL_ARG1) = arg1;
+ register __u32 __arg asm(JAILHOUSE_CALL_ARG) = arg;
asm volatile(
__asmeq(JAILHOUSE_CALL_NUM_RESULT, "%0")
__asmeq(JAILHOUSE_CALL_NUM_RESULT, "%1")
- __asmeq(JAILHOUSE_CALL_ARG1, "%2")
+ __asmeq(JAILHOUSE_CALL_ARG, "%2")
JAILHOUSE_CALL_INS
: "=r" (num_result)
- : "r" (num_result), "r" (__arg1)
- : "memory");
- return num_result;
-}
-
-static inline __u32 jailhouse_call2(__u32 num, __u32 arg1, __u32 arg2)
-{
- register __u32 num_result asm(JAILHOUSE_CALL_NUM_RESULT) = num;
- register __u32 __arg1 asm(JAILHOUSE_CALL_ARG1) = arg1;
- register __u32 __arg2 asm(JAILHOUSE_CALL_ARG2) = arg2;
-
- asm volatile(
- __asmeq(JAILHOUSE_CALL_NUM_RESULT, "%0")
- __asmeq(JAILHOUSE_CALL_NUM_RESULT, "%1")
- __asmeq(JAILHOUSE_CALL_ARG1, "%2")
- __asmeq(JAILHOUSE_CALL_ARG2, "%3")
- JAILHOUSE_CALL_INS
- : "=r" (num_result)
- : "r" (num_result), "r" (__arg1), "r" (__arg2)
- : "memory");
- return num_result;
-}
-
-static inline __u32 jailhouse_call3(__u32 num, __u32 arg1, __u32 arg2,
- __u32 arg3)
-{
- register __u32 num_result asm(JAILHOUSE_CALL_NUM_RESULT) = num;
- register __u32 __arg1 asm(JAILHOUSE_CALL_ARG1) = arg1;
- register __u32 __arg2 asm(JAILHOUSE_CALL_ARG2) = arg2;
- register __u32 __arg3 asm(JAILHOUSE_CALL_ARG3) = arg3;
-
- asm volatile(
- __asmeq(JAILHOUSE_CALL_NUM_RESULT, "%0")
- __asmeq(JAILHOUSE_CALL_NUM_RESULT, "%1")
- __asmeq(JAILHOUSE_CALL_ARG1, "%2")
- __asmeq(JAILHOUSE_CALL_ARG2, "%3")
- __asmeq(JAILHOUSE_CALL_ARG3, "%4")
- JAILHOUSE_CALL_INS
- : "=r" (num_result)
- : "r" (num_result), "r" (__arg1), "r" (__arg2), "r" (__arg3)
- : "memory");
- return num_result;
-}
-
-static inline __u32 jailhouse_call4(__u32 num, __u32 arg1, __u32 arg2,
- __u32 arg3, __u32 arg4)
-{
- register __u32 num_result asm(JAILHOUSE_CALL_NUM_RESULT) = num;
- register __u32 __arg1 asm(JAILHOUSE_CALL_ARG1) = arg1;
- register __u32 __arg2 asm(JAILHOUSE_CALL_ARG2) = arg2;
- register __u32 __arg3 asm(JAILHOUSE_CALL_ARG3) = arg3;
- register __u32 __arg4 asm(JAILHOUSE_CALL_ARG4) = arg4;
-
- asm volatile(
- __asmeq(JAILHOUSE_CALL_NUM_RESULT, "%0")
- __asmeq(JAILHOUSE_CALL_NUM_RESULT, "%1")
- __asmeq(JAILHOUSE_CALL_ARG1, "%2")
- __asmeq(JAILHOUSE_CALL_ARG2, "%3")
- __asmeq(JAILHOUSE_CALL_ARG3, "%4")
- __asmeq(JAILHOUSE_CALL_ARG4, "%5")
- JAILHOUSE_CALL_INS
- : "=r" (num_result)
- : "r" (num_result), "r" (__arg1), "r" (__arg2), "r" (__arg3),
- "r" (__arg4)
+ : "r" (num_result), "r" (__arg)
: "memory");
return num_result;
}
#define JAILHOUSE_CALL_INS "vmcall"
#define JAILHOUSE_CALL_RESULT "=a" (result)
#define JAILHOUSE_CALL_NUM "a" (num)
-#define JAILHOUSE_CALL_ARG1 "D" (arg1)
-#define JAILHOUSE_CALL_ARG2 "S" (arg2)
-#define JAILHOUSE_CALL_ARG3 "d" (arg3)
-#define JAILHOUSE_CALL_ARG4 "c" (arg4)
+#define JAILHOUSE_CALL_ARG "D" (arg)
#ifndef __ASSEMBLY__
-static inline __u32 jailhouse_call0(__u32 num)
+static inline __u32 jailhouse_call(__u32 num)
{
__u32 result;
return result;
}
-static inline __u32 jailhouse_call1(__u32 num, __u32 arg1)
+static inline __u32 jailhouse_call_arg(__u32 num, __u32 arg)
{
__u32 result;
asm volatile(JAILHOUSE_CALL_INS
: JAILHOUSE_CALL_RESULT
- : JAILHOUSE_CALL_NUM, JAILHOUSE_CALL_ARG1
- : "memory");
- return result;
-}
-
-static inline __u32 jailhouse_call2(__u32 num, __u32 arg1, __u32 arg2)
-{
- __u32 result;
-
- asm volatile(JAILHOUSE_CALL_INS
- : JAILHOUSE_CALL_RESULT
- : JAILHOUSE_CALL_NUM, JAILHOUSE_CALL_ARG1, JAILHOUSE_CALL_ARG2
- : "memory");
- return result;
-}
-
-static inline __u32 jailhouse_call3(__u32 num, __u32 arg1, __u32 arg2,
- __u32 arg3)
-{
- __u32 result;
-
- asm volatile(JAILHOUSE_CALL_INS
- : JAILHOUSE_CALL_RESULT
- : JAILHOUSE_CALL_NUM, JAILHOUSE_CALL_ARG1, JAILHOUSE_CALL_ARG2,
- JAILHOUSE_CALL_ARG3
- : "memory");
- return result;
-}
-
-static inline __u32 jailhouse_call4(__u32 num, __u32 arg1, __u32 arg2,
- __u32 arg3, __u32 arg4)
-{
- __u32 result;
-
- asm volatile(JAILHOUSE_CALL_INS
- : JAILHOUSE_CALL_RESULT
- : JAILHOUSE_CALL_NUM, JAILHOUSE_CALL_ARG1, JAILHOUSE_CALL_ARG2,
- JAILHOUSE_CALL_ARG3, JAILHOUSE_CALL_ARG4
+ : JAILHOUSE_CALL_NUM, JAILHOUSE_CALL_ARG
: "memory");
return result;
}