/
utee_syscalls_a32.S
60 lines (54 loc) · 1.33 KB
/
utee_syscalls_a32.S
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
/* SPDX-License-Identifier: BSD-2-Clause */
/*
* Copyright (c) 2015, Linaro Limited
* Copyright (c) 2014, STMicroelectronics International N.V.
*/
#include <tee_syscall_numbers.h>
#include <asm.S>
.section .note.GNU-stack,"",%progbits
.section .text
.balign 4
.code 32
.macro UTEE_SYSCALL name, scn, num_args
FUNC \name , :
push {r5-r7,lr}
UNWIND( .save {r5-r7,lr})
#if defined(CFG_SYSCALL_WRAPPERS_MCOUNT) && !defined(__LDELF__)
.if \scn != TEE_SCN_RETURN
mov ip, sp
push {r0-r4, fp, ip}
add fp, ip, #16
push {lr}
bl __gnu_mcount_nc
pop {r0-r4, fp, ip}
mov sp, ip
.endif
#endif
mov r7, #(\scn)
.if \num_args > TEE_SVC_MAX_ARGS
.error "Too many arguments for syscall"
.endif
.if \num_args <= 4
@ No arguments passed on stack
mov r6, #0
.else
@ Tell number of arguments passed on the stack
mov r6, #(\num_args - 4)
@ Point just before the push (4 registers) above on the first argument
add r5, sp, #(4 * 4)
.endif
svc #0
pop {r5-r7,pc}
END_FUNC \name
.endm
FUNC _utee_panic, :
push {r0-r11, lr}
UNWIND( .save {r0-r11, lr})
mov lr, pc
push {lr}
UNWIND( .save {lr})
mov r1, sp
bl __utee_panic
/* Not reached */
END_FUNC _utee_panic
#include <utee_syscalls_asm.S>