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