1 /********************************************* 2 * hypercall.S 3 * 4 * Xen hypercall wrappers 5 * 6 * Stefano Stabellini <stefano.stabellini@eu.ci 7 * 8 * This program is free software; you can redi 9 * modify it under the terms of the GNU Genera 10 * as published by the Free Software Foundatio 11 * separately from the Linux kernel or incorpo 12 * software packages, subject to the following 13 * 14 * Permission is hereby granted, free of charg 15 * of this source file (the "Software"), to de 16 * restriction, including without limitation t 17 * merge, publish, distribute, sublicense, and 18 * and to permit persons to whom the Software 19 * the following conditions: 20 * 21 * The above copyright notice and this permiss 22 * all copies or substantial portions of the S 23 * 24 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT W 25 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE W 26 * FITNESS FOR A PARTICULAR PURPOSE AND NONINF 27 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR 28 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT 29 * FROM, OUT OF OR IN CONNECTION WITH THE SOFT 30 * IN THE SOFTWARE. 31 */ 32 33 /* 34 * The Xen hypercall calling convention is ver 35 * call standard for the ARM 64-bit architectu 36 * passed in x0, the second in x1, the third i 37 * the fifth in x4. 38 * 39 * The hypercall number is passed in x16. 40 * 41 * The return value is in x0. 42 * 43 * The hvc ISS is required to be 0xEA1, that i 44 * hypercall tag. 45 * 46 * Parameter structs passed to hypercalls are 47 * the ARM 64-bit EABI standard. 48 */ 49 50 #include <linux/linkage.h> 51 #include <asm/assembler.h> 52 #include <asm/asm-uaccess.h> 53 #include <xen/interface/xen.h> 54 55 56 #define XEN_IMM 0xEA1 57 58 #define HYPERCALL_SIMPLE(hypercall) 59 SYM_FUNC_START(HYPERVISOR_##hypercall) 60 mov x16, #__HYPERVISOR_##hypercall; 61 hvc XEN_IMM; 62 ret; 63 SYM_FUNC_END(HYPERVISOR_##hypercall) 64 65 #define HYPERCALL0 HYPERCALL_SIMPLE 66 #define HYPERCALL1 HYPERCALL_SIMPLE 67 #define HYPERCALL2 HYPERCALL_SIMPLE 68 #define HYPERCALL3 HYPERCALL_SIMPLE 69 #define HYPERCALL4 HYPERCALL_SIMPLE 70 #define HYPERCALL5 HYPERCALL_SIMPLE 71 72 .text 73 74 HYPERCALL2(xen_version); 75 HYPERCALL3(console_io); 76 HYPERCALL3(grant_table_op); 77 HYPERCALL2(sched_op); 78 HYPERCALL2(event_channel_op); 79 HYPERCALL2(hvm_op); 80 HYPERCALL2(memory_op); 81 HYPERCALL2(physdev_op); 82 HYPERCALL3(vcpu_op); 83 HYPERCALL1(platform_op_raw); 84 HYPERCALL2(multicall); 85 HYPERCALL2(vm_assist); 86 HYPERCALL3(dm_op); 87 88 SYM_FUNC_START(privcmd_call) 89 mov x16, x0 90 mov x0, x1 91 mov x1, x2 92 mov x2, x3 93 mov x3, x4 94 mov x4, x5 95 /* 96 * Privcmd calls are issued by the use 97 * enable access to TTBR0_EL1 as the h 98 * translations to user memory via AT 99 * instructions are not affected by th 100 * need the explicit uaccess_enable/di 101 * is enabled (it implies that hardwar 102 */ 103 uaccess_ttbr0_enable x6, x7, x8 104 hvc XEN_IMM 105 106 /* 107 * Disable userspace access from kerne 108 */ 109 uaccess_ttbr0_disable x6, x7 110 ret 111 SYM_FUNC_END(privcmd_call);
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.