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