Christoffer Dall | 749cf76c | 2013-01-20 18:28:06 -0500 | [diff] [blame] | 1 | /* |
| 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 Dall | 342cd0a | 2013-01-20 18:28:06 -0500 | [diff] [blame] | 18 | |
| 19 | #include <linux/linkage.h> |
Christoffer Dall | 342cd0a | 2013-01-20 18:28:06 -0500 | [diff] [blame] | 20 | |
| 21 | .text |
Christoffer Dall | 342cd0a | 2013-01-20 18:28:06 -0500 | [diff] [blame] | 22 | |
| 23 | /******************************************************************** |
| 24 | * Call function in Hyp mode |
| 25 | * |
| 26 | * |
Marc Zyngier | b57cd6f | 2016-01-06 12:10:58 +0000 | [diff] [blame] | 27 | * unsigned long kvm_call_hyp(void *hypfn, ...); |
Christoffer Dall | 342cd0a | 2013-01-20 18:28:06 -0500 | [diff] [blame] | 28 | * |
| 29 | * This is not really a variadic function in the classic C-way and care must |
| 30 | * be taken when calling this to ensure parameters are passed in registers |
| 31 | * only, since the stack will change between the caller and the callee. |
| 32 | * |
| 33 | * Call the function with the first argument containing a pointer to the |
| 34 | * function you wish to call in Hyp mode, and subsequent arguments will be |
| 35 | * passed as r0, r1, and r2 (a maximum of 3 arguments in addition to the |
| 36 | * function pointer can be passed). The function being called must be mapped |
| 37 | * in Hyp mode (see init_hyp_mode in arch/arm/kvm/arm.c). Return values are |
Marc Zyngier | b57cd6f | 2016-01-06 12:10:58 +0000 | [diff] [blame] | 38 | * passed in r0 (strictly 32bit). |
Christoffer Dall | 342cd0a | 2013-01-20 18:28:06 -0500 | [diff] [blame] | 39 | * |
Marc Zyngier | b20c9f2 | 2014-02-26 18:47:36 +0000 | [diff] [blame] | 40 | * A function pointer with a value of 0xffffffff has a special meaning, |
| 41 | * and is used to implement __hyp_get_vectors in the same way as in |
| 42 | * arch/arm/kernel/hyp_stub.S. |
| 43 | * |
Christoffer Dall | 342cd0a | 2013-01-20 18:28:06 -0500 | [diff] [blame] | 44 | * The calling convention follows the standard AAPCS: |
| 45 | * r0 - r3: caller save |
| 46 | * r12: caller save |
| 47 | * rest: callee save |
| 48 | */ |
| 49 | ENTRY(kvm_call_hyp) |
| 50 | hvc #0 |
| 51 | bx lr |
Marc Zyngier | b98e2e7 | 2016-01-05 18:45:17 +0000 | [diff] [blame] | 52 | ENDPROC(kvm_call_hyp) |