]> git.proxmox.com Git - mirror_edk2.git/blame - ArmPkg/Library/ArmSvcLib/Arm/ArmSvc.asm
ArmPkg/ArmSvcLib: prevent speculative execution beyond svc
[mirror_edk2.git] / ArmPkg / Library / ArmSvcLib / Arm / ArmSvc.asm
CommitLineData
f8f0e454 1//\r
8035edbe 2// Copyright (c) 2016 - 2020, ARM Limited. All rights reserved.\r
f8f0e454 3//\r
4059386c 4// SPDX-License-Identifier: BSD-2-Clause-Patent\r
f8f0e454
SV
5//\r
6//\r
7\r
8\r
9 INCLUDE AsmMacroExport.inc\r
10\r
11 RVCT_ASM_EXPORT ArmCallSvc\r
12 // r0 will be popped just after the SVC call\r
13 push {r0, r4-r8}\r
14\r
15 // Load the SVC arguments values into the appropriate registers\r
16 ldm r0, {r0-r7}\r
17\r
18 svc #0\r
8035edbe
VS
19 // Prevent speculative execution beyond svc instruction\r
20 dsb nsh\r
21 isb\r
f8f0e454
SV
22\r
23 // Load the ARM_SVC_ARGS structure address from the stack into r8\r
24 ldr r8, [sp]\r
25\r
26 // Load the SVC returned values into the appropriate registers\r
27 // A SVC call can return up to 4 values - we do not need to store back r4-r7.\r
28 stm r8, {r0-r3}\r
29\r
30 mov r0, r8\r
31\r
32 // Restore the registers r4-r8\r
33 pop {r1, r4-r8}\r
34 bx lr\r
35\r
36 END\r