1
2/*
3 * Copyright (c) 2017 ETH Zurich.
4 * All rights reserved.
5 *
6 * This file is distributed under the terms in the attached LICENSE file.
7 * If you do not find this file, copies can be found by writing to:
8 * ETH Zurich D-INFK, Universitaetsstrasse 6, CH-8092 Zurich. Attn: Systems Group.
9 */
10
11#ifndef ARM_SMC_H_
12#define ARM_SMC_H_
13
14/**
15 * @brief struct to hold the result values for the SMC instruction on arm
16 */
17struct arm_smc_hvc_retval
18{
19    uintptr_t a0;   ///< register x0 / r0
20    uintptr_t a1;   ///< register x1 / r1
21    uintptr_t a2;   ///< register x2 / r2
22    uintptr_t a3;   ///< register x3 / r3
23};
24
25/**
26 * @brief invokes the secure monitor instruction on ARM
27 *
28 * @param a0    Argument 0 (the SMC function to call)
29 * @param a1..7 Arguments for the SMC function
30 * @param res   Pointer to the struct to hold the return values
31 */
32void invoke_arm_smc(uintptr_t a0, uintptr_t a1, uintptr_t a2,
33                    uintptr_t a3, uintptr_t a4, uintptr_t a5,
34                    uintptr_t a6, uintptr_t a7, struct arm_smc_hvc_retval *res);
35
36
37/**
38 * @brief invokes the hypervisor call instruction on ARM
39 *
40 * @param a0    Argument 0 (the HVC function to call)
41 * @param a1..7 Arguments for the HVC function
42 * @param res   Pointer to the struct to hold the return values
43 */
44void invoke_arm_hvc(uintptr_t a0, uintptr_t a1, uintptr_t a2,
45                    uintptr_t a3, uintptr_t a4, uintptr_t a5,
46                    uintptr_t a6, uintptr_t a7, struct arm_smc_hvc_retval *res);
47
48
49#endif /* ARM_SMC_H_ */
50