1/* 2 * Copyright (c) 2019 Carlo Caione <ccaione@baylibre.com> 3 * 4 * SPDX-License-Identifier: Apache-2.0 5 */ 6 7/* 8 * This file implements the common calling mechanism to be used with the Secure 9 * Monitor Call (SMC) and Hypervisor Call (HVC). 10 * 11 * See https://developer.arm.com/docs/den0028/latest 12 */ 13 14#include <zephyr/toolchain.h> 15#include <zephyr/linker/sections.h> 16#include <zephyr/arch/cpu.h> 17#include <offsets_short.h> 18 19.macro SMCCC instr 20 \instr #0 21 ldr x4, [sp] 22 stp x0, x1, [x4, __arm_smccc_res_t_a0_a1_OFFSET] 23 stp x2, x3, [x4, __arm_smccc_res_t_a2_a3_OFFSET] 24 stp x4, x5, [x4, __arm_smccc_res_t_a4_a5_OFFSET] 25 stp x6, x7, [x4, __arm_smccc_res_t_a6_a7_OFFSET] 26 ret 27.endm 28 29/* 30 * The SMC instruction is used to generate a synchronous exception that is 31 * handled by Secure Monitor code running in EL3. 32 */ 33GTEXT(arm_smccc_smc) 34SECTION_FUNC(TEXT, arm_smccc_smc) 35 SMCCC smc 36 37/* 38 * The HVC instruction is used to generate a synchronous exception that is 39 * handled by a hypervisor running in EL2. 40 */ 41GTEXT(arm_smccc_hvc) 42SECTION_FUNC(TEXT, arm_smccc_hvc) 43 SMCCC hvc 44