blob: 76416521e06b558953c55291fd28cdd3505527fa [file] [log] [blame]
b.liue9582032025-04-17 19:18:16 +08001/* SPDX-License-Identifier: GPL-2.0-only */
2/*
3 * Copyright (C) 2012 - Virtual Open Systems and Columbia University
4 * Author: Christoffer Dall <c.dall@virtualopensystems.com>
5 */
6
7#include <linux/linkage.h>
8
9 .text
10 .arch_extension virt
11
12/********************************************************************
13 * Call function in Hyp mode
14 *
15 *
16 * unsigned long kvm_call_hyp(void *hypfn, ...);
17 *
18 * This is not really a variadic function in the classic C-way and care must
19 * be taken when calling this to ensure parameters are passed in registers
20 * only, since the stack will change between the caller and the callee.
21 *
22 * Call the function with the first argument containing a pointer to the
23 * function you wish to call in Hyp mode, and subsequent arguments will be
24 * passed as r0, r1, and r2 (a maximum of 3 arguments in addition to the
25 * function pointer can be passed). The function being called must be mapped
26 * in Hyp mode (see init_hyp_mode in arch/arm/kvm/arm.c). Return values are
27 * passed in r0 (strictly 32bit).
28 *
29 * The calling convention follows the standard AAPCS:
30 * r0 - r3: caller save
31 * r12: caller save
32 * rest: callee save
33 */
34ENTRY(__kvm_call_hyp)
35 hvc #0
36 bx lr
37ENDPROC(__kvm_call_hyp)