aarch64: smccc: Use offset macros

Instead of relying on hardcoded offset in the assembly code, introduce
the offset macros to make the code more clear.

Signed-off-by: Carlo Caione <ccaione@baylibre.com>
This commit is contained in:
Carlo Caione 2021-02-03 12:07:49 +01:00 committed by Anas Nashif
parent 998856bacb
commit bc7cb75a82
3 changed files with 14 additions and 2 deletions

View file

@ -14,12 +14,13 @@
#include <toolchain.h>
#include <linker/sections.h>
#include <arch/cpu.h>
#include <offsets_short.h>
.macro SMCCC instr
\instr #0
ldr x4, [sp]
stp x0, x1, [x4]
stp x2, x3, [x4, #16]
stp x0, x1, [x4, __arm_smccc_res_t_a0_a1_OFFSET]
stp x2, x3, [x4, __arm_smccc_res_t_a2_a3_OFFSET]
ret
.endm

View file

@ -52,4 +52,13 @@ GEN_NAMED_OFFSET_SYM(_esf_t, x0, x0_x1);
GEN_ABSOLUTE_SYM(___esf_t_SIZEOF, sizeof(_esf_t));
#ifdef CONFIG_HAS_ARM_SMCCC
#include <arch/arm/arm-smccc.h>
GEN_NAMED_OFFSET_SYM(arm_smccc_res_t, a0, a0_a1);
GEN_NAMED_OFFSET_SYM(arm_smccc_res_t, a2, a2_a3);
#endif /* CONFIG_HAS_ARM_SMCCC */
#endif /* _ARM_OFFSETS_INC_ */

View file

@ -18,6 +18,8 @@ struct arm_smccc_res {
unsigned long a3;
};
typedef struct arm_smccc_res arm_smccc_res_t;
enum arm_smccc_conduit {
SMCCC_CONDUIT_NONE,
SMCCC_CONDUIT_SMC,