2 * Jailhouse, a Linux-based partitioning hypervisor
4 * Copyright (c) Siemens AG, 2013
7 * Jan Kiszka <jan.kiszka@siemens.com>
9 * This work is licensed under the terms of the GNU GPL, version 2. See
10 * the COPYING file in the top-level directory.
13 #define JAILHOUSE_BASE 0xf0000000
15 #define JAILHOUSE_CALL_INS ".arch_extension virt\n\t" \
17 #define JAILHOUSE_CALL_NUM_RESULT "r0"
18 #define JAILHOUSE_CALL_ARG "r1"
21 #define __asmeq(x, y) ".ifnc " x "," y " ; .err ; .endif\n\t"
26 static inline __u32 jailhouse_call(__u32 num)
28 register __u32 num_result asm(JAILHOUSE_CALL_NUM_RESULT) = num;
31 __asmeq(JAILHOUSE_CALL_NUM_RESULT, "%0")
32 __asmeq(JAILHOUSE_CALL_NUM_RESULT, "%1")
40 static inline __u32 jailhouse_call_arg(__u32 num, __u32 arg)
42 register __u32 num_result asm(JAILHOUSE_CALL_NUM_RESULT) = num;
43 register __u32 __arg asm(JAILHOUSE_CALL_ARG) = arg;
46 __asmeq(JAILHOUSE_CALL_NUM_RESULT, "%0")
47 __asmeq(JAILHOUSE_CALL_NUM_RESULT, "%1")
48 __asmeq(JAILHOUSE_CALL_ARG, "%2")
51 : "r" (num_result), "r" (__arg)
57 jailhouse_send_msg_to_cell(struct jailhouse_comm_region *comm_region,
60 comm_region->reply_from_cell = JAILHOUSE_MSG_NONE;
61 /* ensure reply was cleared before sending new message */
62 asm volatile("dmb ishst" : : : "memory");
63 comm_region->msg_to_cell = msg;
67 jailhouse_send_reply_from_cell(struct jailhouse_comm_region *comm_region,
70 comm_region->msg_to_cell = JAILHOUSE_MSG_NONE;
71 /* ensure message was cleared before sending reply */
72 asm volatile("dmb ishst" : : : "memory");
73 comm_region->reply_from_cell = reply;
76 #endif /* !__ASSEMBLY__ */