Thomas Gleixner | d94d71c | 2019-05-29 07:12:40 -0700 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
Christoffer Dall | 749cf76c | 2013-01-20 18:28:06 -0500 | [diff] [blame] | 2 | /* |
| 3 | * Copyright (C) 2012 - Virtual Open Systems and Columbia University |
| 4 | * Author: Christoffer Dall <c.dall@virtualopensystems.com> |
Christoffer Dall | 749cf76c | 2013-01-20 18:28:06 -0500 | [diff] [blame] | 5 | */ |
Christoffer Dall | 342cd0a | 2013-01-20 18:28:06 -0500 | [diff] [blame] | 6 | |
| 7 | #include <linux/linkage.h> |
Christoffer Dall | 342cd0a | 2013-01-20 18:28:06 -0500 | [diff] [blame] | 8 | |
| 9 | .text |
Christoffer Dall | 342cd0a | 2013-01-20 18:28:06 -0500 | [diff] [blame] | 10 | |
| 11 | /******************************************************************** |
| 12 | * Call function in Hyp mode |
| 13 | * |
| 14 | * |
Marc Zyngier | b57cd6f | 2016-01-06 12:10:58 +0000 | [diff] [blame] | 15 | * unsigned long kvm_call_hyp(void *hypfn, ...); |
Christoffer Dall | 342cd0a | 2013-01-20 18:28:06 -0500 | [diff] [blame] | 16 | * |
| 17 | * This is not really a variadic function in the classic C-way and care must |
| 18 | * be taken when calling this to ensure parameters are passed in registers |
| 19 | * only, since the stack will change between the caller and the callee. |
| 20 | * |
| 21 | * Call the function with the first argument containing a pointer to the |
| 22 | * function you wish to call in Hyp mode, and subsequent arguments will be |
| 23 | * passed as r0, r1, and r2 (a maximum of 3 arguments in addition to the |
| 24 | * function pointer can be passed). The function being called must be mapped |
| 25 | * 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] | 26 | * passed in r0 (strictly 32bit). |
Christoffer Dall | 342cd0a | 2013-01-20 18:28:06 -0500 | [diff] [blame] | 27 | * |
| 28 | * The calling convention follows the standard AAPCS: |
| 29 | * r0 - r3: caller save |
| 30 | * r12: caller save |
| 31 | * rest: callee save |
| 32 | */ |
Marc Zyngier | d18232e | 2019-01-11 14:57:58 +0000 | [diff] [blame] | 33 | ENTRY(__kvm_call_hyp) |
Christoffer Dall | 342cd0a | 2013-01-20 18:28:06 -0500 | [diff] [blame] | 34 | hvc #0 |
| 35 | bx lr |
Marc Zyngier | d18232e | 2019-01-11 14:57:58 +0000 | [diff] [blame] | 36 | ENDPROC(__kvm_call_hyp) |