![]() |
|
|||
0001 /****************************************************************************** 0002 * hypercall.S 0003 * 0004 * Xen hypercall wrappers 0005 * 0006 * Stefano Stabellini <stefano.stabellini@eu.citrix.com>, Citrix, 2012 0007 * 0008 * This program is free software; you can redistribute it and/or 0009 * modify it under the terms of the GNU General Public License version 2 0010 * as published by the Free Software Foundation; or, when distributed 0011 * separately from the Linux kernel or incorporated into other 0012 * software packages, subject to the following license: 0013 * 0014 * Permission is hereby granted, free of charge, to any person obtaining a copy 0015 * of this source file (the "Software"), to deal in the Software without 0016 * restriction, including without limitation the rights to use, copy, modify, 0017 * merge, publish, distribute, sublicense, and/or sell copies of the Software, 0018 * and to permit persons to whom the Software is furnished to do so, subject to 0019 * the following conditions: 0020 * 0021 * The above copyright notice and this permission notice shall be included in 0022 * all copies or substantial portions of the Software. 0023 * 0024 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 0025 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 0026 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 0027 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 0028 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 0029 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 0030 * IN THE SOFTWARE. 0031 */ 0032 0033 /* 0034 * The Xen hypercall calling convention is very similar to the ARM 0035 * procedure calling convention: the first paramter is passed in r0, the 0036 * second in r1, the third in r2 and the fourth in r3. Considering that 0037 * Xen hypercalls have 5 arguments at most, the fifth paramter is passed 0038 * in r4, differently from the procedure calling convention of using the 0039 * stack for that case. 0040 * 0041 * The hypercall number is passed in r12. 0042 * 0043 * The return value is in r0. 0044 * 0045 * The hvc ISS is required to be 0xEA1, that is the Xen specific ARM 0046 * hypercall tag. 0047 */ 0048 0049 #include <linux/linkage.h> 0050 #include <asm/assembler.h> 0051 #include <asm/opcodes-virt.h> 0052 #include <xen/interface/xen.h> 0053 0054 0055 #define XEN_IMM 0xEA1 0056 0057 #define HYPERCALL_SIMPLE(hypercall) \ 0058 ENTRY(HYPERVISOR_##hypercall) \ 0059 mov r12, #__HYPERVISOR_##hypercall; \ 0060 __HVC(XEN_IMM); \ 0061 ret lr; \ 0062 ENDPROC(HYPERVISOR_##hypercall) 0063 0064 #define HYPERCALL0 HYPERCALL_SIMPLE 0065 #define HYPERCALL1 HYPERCALL_SIMPLE 0066 #define HYPERCALL2 HYPERCALL_SIMPLE 0067 #define HYPERCALL3 HYPERCALL_SIMPLE 0068 #define HYPERCALL4 HYPERCALL_SIMPLE 0069 0070 #define HYPERCALL5(hypercall) \ 0071 ENTRY(HYPERVISOR_##hypercall) \ 0072 stmdb sp!, {r4} \ 0073 ldr r4, [sp, #4] \ 0074 mov r12, #__HYPERVISOR_##hypercall; \ 0075 __HVC(XEN_IMM); \ 0076 ldm sp!, {r4} \ 0077 ret lr \ 0078 ENDPROC(HYPERVISOR_##hypercall) 0079 0080 .text 0081 0082 HYPERCALL2(xen_version); 0083 HYPERCALL3(console_io); 0084 HYPERCALL3(grant_table_op); 0085 HYPERCALL2(sched_op); 0086 HYPERCALL2(event_channel_op); 0087 HYPERCALL2(hvm_op); 0088 HYPERCALL2(memory_op); 0089 HYPERCALL2(physdev_op); 0090 HYPERCALL3(vcpu_op); 0091 HYPERCALL1(platform_op_raw); 0092 HYPERCALL2(multicall); 0093 HYPERCALL2(vm_assist); 0094 HYPERCALL3(dm_op); 0095 0096 ENTRY(privcmd_call) 0097 stmdb sp!, {r4} 0098 mov r12, r0 0099 mov r0, r1 0100 mov r1, r2 0101 mov r2, r3 0102 ldr r3, [sp, #8] 0103 /* 0104 * Privcmd calls are issued by the userspace. We need to allow the 0105 * kernel to access the userspace memory before issuing the hypercall. 0106 */ 0107 uaccess_enable r4 0108 0109 /* r4 is loaded now as we use it as scratch register before */ 0110 ldr r4, [sp, #4] 0111 __HVC(XEN_IMM) 0112 0113 /* 0114 * Disable userspace access from kernel. This is fine to do it 0115 * unconditionally as no set_fs(KERNEL_DS) is called before. 0116 */ 0117 uaccess_disable r4 0118 0119 ldm sp!, {r4} 0120 ret lr 0121 ENDPROC(privcmd_call);
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.1.0 LXR engine. The LXR team |
![]() ![]() |