xref: /rk3399_rockchip-uboot/lib/optee_clientApi/tee_smc-arm64.S (revision abdd24375050db7ce121b48477cc332d6c8c40f6)
1*abdd2437Shisping/*
2*abdd2437Shisping * Copyright 2017, Rockchip Electronics Co., Ltd
3*abdd2437Shisping * hisping lin, <hisping.lin@rock-chips.com>
4*abdd2437Shisping *
5*abdd2437Shisping * SPDX-License-Identifier:	GPL-2.0+
6*abdd2437Shisping */
7*abdd2437Shisping
8*abdd2437Shisping#include <linux/linkage.h>
9*abdd2437Shisping
10*abdd2437Shisping#ifdef CONFIG_ARM64
11*abdd2437Shisping	.text
12*abdd2437Shisping
13*abdd2437Shisping#define SMC_PARAM_W0_OFFS	0
14*abdd2437Shisping#define SMC_PARAM_W2_OFFS	8
15*abdd2437Shisping#define SMC_PARAM_W4_OFFS	16
16*abdd2437Shisping#define SMC_PARAM_W6_OFFS	24
17*abdd2437Shisping
18*abdd2437Shisping	/* void tee_smc_call(struct smc_param *param); */
19*abdd2437Shisping	.globl	tee_smc_call
20*abdd2437ShispingENTRY(tee_smc_call)
21*abdd2437Shisping	stp	x28, x30, [sp, #-16]!
22*abdd2437Shisping	mov	x28, x0
23*abdd2437Shisping	ldp	w0, w1, [x28, #SMC_PARAM_W0_OFFS]
24*abdd2437Shisping	ldp	w2, w3, [x28, #SMC_PARAM_W2_OFFS]
25*abdd2437Shisping	ldp	w4, w5, [x28, #SMC_PARAM_W4_OFFS]
26*abdd2437Shisping	ldp	w6, w7, [x28, #SMC_PARAM_W6_OFFS]
27*abdd2437Shisping	smc	#0
28*abdd2437Shisping	stp	w0, w1, [x28, #SMC_PARAM_W0_OFFS]
29*abdd2437Shisping	stp	w2, w3, [x28, #SMC_PARAM_W2_OFFS]
30*abdd2437Shisping	ldp	x28, x30, [sp], #16
31*abdd2437Shisping	ret
32*abdd2437ShispingENDPROC(tee_smc_call)
33*abdd2437Shisping
34*abdd2437Shisping#else
35*abdd2437Shisping
36*abdd2437Shisping.text
37*abdd2437Shisping.balign 4
38*abdd2437Shisping.code 32
39*abdd2437Shisping
40*abdd2437Shisping	/* void tee_smc_call(struct smc_param *param); */
41*abdd2437Shisping	.globl	tee_smc_call
42*abdd2437ShispingENTRY(tee_smc_call)
43*abdd2437Shisping	push	{r4-r8, lr}
44*abdd2437Shisping	mov	r8, r0
45*abdd2437Shisping	ldm	r8, {r0-r7}
46*abdd2437Shisping.arch_extension sec
47*abdd2437Shisping	smc	#0
48*abdd2437Shisping	stm	r8, {r0-r7}
49*abdd2437Shisping	pop	{r4-r8, pc}
50*abdd2437ShispingENDPROC(tee_smc_call)
51*abdd2437Shisping#endif
52