blob: d10a8075409a78eb39c3805b27c2c0f86b070fe7 [file] [log] [blame]
Christoffer Dall749cf76c2013-01-20 18:28:06 -05001/*
2 * Copyright (C) 2012 - Virtual Open Systems and Columbia University
3 * Author: Christoffer Dall <c.dall@virtualopensystems.com>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License, version 2, as
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17 */
Christoffer Dall342cd0a2013-01-20 18:28:06 -050018
19#include <linux/linkage.h>
20#include <linux/const.h>
21#include <asm/unified.h>
22#include <asm/page.h>
Christoffer Dall749cf76c2013-01-20 18:28:06 -050023#include <asm/asm-offsets.h>
24#include <asm/kvm_asm.h>
Christoffer Dall342cd0a2013-01-20 18:28:06 -050025#include <asm/kvm_arm.h>
26
27 .text
28
29__kvm_hyp_code_start:
30 .globl __kvm_hyp_code_start
31
32/********************************************************************
33 * Flush per-VMID TLBs
34 */
35ENTRY(__kvm_flush_vm_context)
36 bx lr
37ENDPROC(__kvm_flush_vm_context)
38
39/********************************************************************
40 * Hypervisor world-switch code
41 */
42ENTRY(__kvm_vcpu_run)
43 bx lr
44
45/********************************************************************
46 * Call function in Hyp mode
47 *
48 *
49 * u64 kvm_call_hyp(void *hypfn, ...);
50 *
51 * This is not really a variadic function in the classic C-way and care must
52 * be taken when calling this to ensure parameters are passed in registers
53 * only, since the stack will change between the caller and the callee.
54 *
55 * Call the function with the first argument containing a pointer to the
56 * function you wish to call in Hyp mode, and subsequent arguments will be
57 * passed as r0, r1, and r2 (a maximum of 3 arguments in addition to the
58 * function pointer can be passed). The function being called must be mapped
59 * in Hyp mode (see init_hyp_mode in arch/arm/kvm/arm.c). Return values are
60 * passed in r0 and r1.
61 *
62 * The calling convention follows the standard AAPCS:
63 * r0 - r3: caller save
64 * r12: caller save
65 * rest: callee save
66 */
67ENTRY(kvm_call_hyp)
68 hvc #0
69 bx lr
70
71/********************************************************************
72 * Hypervisor exception vector and handlers
73 */
74
75 .align 5
76__kvm_hyp_vector:
77 .globl __kvm_hyp_vector
78 nop
79
80__kvm_hyp_code_end:
81 .globl __kvm_hyp_code_end