summaryrefslogtreecommitdiff
path: root/security/tlk_driver/ote_asm.S
blob: 2c5563ba7ed893fc62cb58d98a914b7ffe4ce64e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
/*
 * Copyright (c) 2014, NVIDIA Corporation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
 * more details.
 */

#include <linux/linkage.h>
#include <linux/init.h>

#ifdef CONFIG_ARM64

ENTRY(tlk_irq_handler)
	mov	x0, #0x5
	movk	x0, #0x3200, lsl #16	// TE_SMC_NS_IRQ_DONE
	smc	#0
	ret
ENDPROC(tlk_irq_handler)

/* uint32_t tlk_generic_smc(uint32_t arg0, uint32_t arg1, uint32_t arg2) */
ENTRY(_tlk_generic_smc)
	smc	#0
	ret
ENDPROC(_tlk_generic_smc)

	/* allows MAX_EXT_SMC_ARGS (r0-r11) to be passed in registers */

/* uint32_t tlk_extended_smc(uint32_t *regs) */
ENTRY(_tlk_extended_smc)
	/*
	 * Allows MAX_EXT_SMC_ARGS (r0-r11) to be passed in registers
	 * (for aarch64, these are scratch, so no need to save them)
	 */
	mov	x12, x0
	ldp	x0, x1, [x12], #16
	ldp	x2, x3, [x12], #16
	ldp	x4, x5, [x12], #16
	ldp	x6, x7, [x12], #16
	ldp	x8, x9, [x12], #16
	ldp	x10, x11, [x12], #16
	smc	#0
	ret
ENDPROC(_tlk_extended_smc)

#else

ENTRY(tlk_irq_handler)
	movw	r0, #0x5
	movt	r0, #0x3200	@ TE_SMC_NS_IRQ_DONE
	mov	r1, #0
	mov	r2, #0
	smc	#0
ENDPROC(tlk_irq_handler)

ENTRY(_tlk_generic_smc)
	smc	#0
	mov	pc, lr
ENDPROC(_tlk_generic_smc)

ENTRY(_tlk_extended_smc)
	stmfd	sp!, {r4-r12}	@ save reg state
	mov	r12, r0		@ reg ptr to r12
	ldmia	r12, {r0-r11}	@ load arg regs
	smc	#0
	ldmfd	sp!, {r4-r12}	@ restore saved regs
ENDPROC(_tlk_extended_smc)

#endif