blob: c2fdbadbb02583d6f4a1b6a7f084fd3ea8efa566 [file] [log] [blame]
Masahiro Yamadaa93297e2017-04-14 11:10:22 +09001/*
2 * Copyright (c) 2015, Linaro Limited
3 *
Masahiro Yamadae8ead732017-04-14 11:10:23 +09004 * SPDX-License-Identifier: GPL-2.0
Masahiro Yamadaa93297e2017-04-14 11:10:22 +09005 */
6#include <linux/linkage.h>
7
8#include <asm/opcodes-sec.h>
9#include <asm/opcodes-virt.h>
Masahiro Yamadaa93297e2017-04-14 11:10:22 +090010
Masahiro Yamadae8ead732017-04-14 11:10:23 +090011#define UNWIND(x...)
Masahiro Yamadaa93297e2017-04-14 11:10:22 +090012 /*
13 * Wrap c macros in asm macros to delay expansion until after the
14 * SMCCC asm macro is expanded.
15 */
16 .macro SMCCC_SMC
17 __SMC(0)
18 .endm
19
20 .macro SMCCC_HVC
21 __HVC(0)
22 .endm
23
24 .macro SMCCC instr
25UNWIND( .fnstart)
26 mov r12, sp
27 push {r4-r7}
28UNWIND( .save {r4-r7})
29 ldm r12, {r4-r7}
30 \instr
31 pop {r4-r7}
32 ldr r12, [sp, #(4 * 4)]
33 stm r12, {r0-r3}
34 bx lr
35UNWIND( .fnend)
36 .endm
37
38/*
39 * void smccc_smc(unsigned long a0, unsigned long a1, unsigned long a2,
40 * unsigned long a3, unsigned long a4, unsigned long a5,
41 * unsigned long a6, unsigned long a7, struct arm_smccc_res *res,
42 * struct arm_smccc_quirk *quirk)
43 */
44ENTRY(__arm_smccc_smc)
45 SMCCC SMCCC_SMC
46ENDPROC(__arm_smccc_smc)
47
48/*
49 * void smccc_hvc(unsigned long a0, unsigned long a1, unsigned long a2,
50 * unsigned long a3, unsigned long a4, unsigned long a5,
51 * unsigned long a6, unsigned long a7, struct arm_smccc_res *res,
52 * struct arm_smccc_quirk *quirk)
53 */
54ENTRY(__arm_smccc_hvc)
55 SMCCC SMCCC_HVC
56ENDPROC(__arm_smccc_hvc)