1/*
2 * Copyright (c) 2017 ETH Zurich.
3 * All rights reserved.
4 *
5 * This file is distributed under the terms in the attached LICENSE file.
6 * If you do not find this file, copies can be found by writing to:
7 * ETH Zurich D-INFK, Universitaetstr. 6, CH-8092 Zurich. Attn: Systems Group.
8 */
9
10#include <asmoffsets.h>
11#include <offsets.h>
12
13
14.global invoke_arm_smc
15.global invoke_arm_hvc
16
17/*
18 * We use the firest 8 arguments to be passed through the registers and
19 * the address of the struct to hold the return values on the stack
20 */
21
22/*
23 * void invoke_arm_smc(uintptr_t a0, uintptr_t a1, uintptr_t a2,
24 *                     uintptr_t a3, uintptr_t a4, uintptr_t a5,
25 *                     uintptr_t a6, uintptr_t a7, struct arm_smc_hvc_retval *res);
26 */
27invoke_arm_smc:
28    smc  #0
29    ldr x4, [sp]
30    stp x0, x1, [x4]
31    ret
32
33/*
34 * void invoke_arm_hvc(uintptr_t a0, uintptr_t a1, uintptr_t a2,
35 *                     uintptr_t a3, uintptr_t a4, uintptr_t a5,
36 *                     uintptr_t a6, uintptr_t a7, struct arm_smc_hvc_retval *res,);
37 */
38invoke_arm_hvc:
39    hvc  #0
40    ldr x4, [sp]
41    stp x0, x1, [x4]
42    ret
43