1/* SPDX-License-Identifier: BSD-2-Clause */
2/*
3 * Copyright (c) 2014, STMicroelectronics International N.V.
4 * Copyright (c) 2015, Linaro Limited
5 * Copyright (c) 2020, Arm Limited
6 */
7
8#include <asm.S>
9
10	.section .text
11	.balign 4
12	.code 32
13
14	.macro LDELF_SYSCALL name, scn, num_args
15	FUNC \name , :
16
17	.if \num_args > 8
18	.error "Too many arguments for syscall"
19	.endif
20
21	push	{r5-r7, lr}
22UNWIND(	.save	{r5-r7, lr})
23	mov	r7, #(\scn)
24
25	.if \num_args <= 4
26	@ No arguments passed on stack
27	mov	r6, #0
28	.else
29	@ Tell number of arguments passed on the stack
30	mov	r6, #(\num_args - 4)
31	@ Point just before the push (4 registers) above on the first argument
32	add	r5, sp, #(4 * 4)
33	.endif
34
35	svc	#0
36	pop	{r5-r7, pc}
37	END_FUNC \name
38	.endm
39
40	FUNC _ldelf_panic, :
41	push	{r0-r11, lr}
42UNWIND(	.save	{r0-r11, lr})
43	mov	lr, pc
44	push	{lr}
45UNWIND(	.save	{lr})
46	mov	r1, sp
47	bl	__ldelf_panic
48	/* Not reached */
49	END_FUNC _ldelf_panic
50
51#include "syscalls_asm.S"
52