summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKun Qin <kuqin@microsoft.com>2025-01-02 14:44:40 -0800
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2025-04-02 16:25:45 +0000
commit47b793f38c8f0f227c89fccbf3fe7b329212fb40 (patch)
tree56170f2eb3aee3c84950f9c71effcf1cb24fae5b
parentc0ecd11e623a662e869f244c7230af9bb0f26e75 (diff)
downloadedk2-47b793f38c8f0f227c89fccbf3fe7b329212fb40.zip
edk2-47b793f38c8f0f227c89fccbf3fe7b329212fb40.tar.gz
edk2-47b793f38c8f0f227c89fccbf3fe7b329212fb40.tar.bz2
ArmPkg: ArmSvcLib: Support all 18 registers
This extends ARM_SVC_ARGS to support all x0-x17 registers use case for FF-A. The ArmCallSvc function is also updated to support 18-register usage. Co-authored-by: Olivier Deprez <Olivier.Deprez@arm.com> Signed-off-by: Kun Qin <kun.qin@microsoft.com>
-rw-r--r--ArmPkg/Include/Library/ArmSvcLib.h10
-rw-r--r--ArmPkg/Library/ArmSvcLib/AArch64/ArmSvc.S35
2 files changed, 31 insertions, 14 deletions
diff --git a/ArmPkg/Include/Library/ArmSvcLib.h b/ArmPkg/Include/Library/ArmSvcLib.h
index 71a640b..a514e0c 100644
--- a/ArmPkg/Include/Library/ArmSvcLib.h
+++ b/ArmPkg/Include/Library/ArmSvcLib.h
@@ -22,6 +22,16 @@ typedef struct {
UINTN Arg5;
UINTN Arg6;
UINTN Arg7;
+ UINTN Arg8;
+ UINTN Arg9;
+ UINTN Arg10;
+ UINTN Arg11;
+ UINTN Arg12;
+ UINTN Arg13;
+ UINTN Arg14;
+ UINTN Arg15;
+ UINTN Arg16;
+ UINTN Arg17;
} ARM_SVC_ARGS;
/**
diff --git a/ArmPkg/Library/ArmSvcLib/AArch64/ArmSvc.S b/ArmPkg/Library/ArmSvcLib/AArch64/ArmSvc.S
index 6bcb10e..814f831 100644
--- a/ArmPkg/Library/ArmSvcLib/AArch64/ArmSvc.S
+++ b/ArmPkg/Library/ArmSvcLib/AArch64/ArmSvc.S
@@ -12,13 +12,19 @@
ASM_FUNC(ArmCallSvc)
// Push frame pointer and return address on the stack
- stp x29, x30, [sp, #-32]!
+ stp x29, x30, [sp, #-16]!
mov x29, sp
- // Push x0 on the stack - The stack must always be quad-word aligned
- str x0, [sp, #16]
+ // x0 is the ARM_SVC_ARGS structure address
+ // x30 is used as a scratch register upon returning from SVC
+ mov x30, x0
// Load the SVC arguments values into the appropriate registers
+ ldp x16, x17, [x0, #128]
+ ldp x14, x15, [x0, #112]
+ ldp x12, x13, [x0, #96]
+ ldp x10, x11, [x0, #80]
+ ldp x8, x9, [x0, #64]
ldp x6, x7, [x0, #48]
ldp x4, x5, [x0, #32]
ldp x2, x3, [x0, #16]
@@ -29,17 +35,18 @@ ASM_FUNC(ArmCallSvc)
dsb nsh
isb
- // Pop the ARM_SVC_ARGS structure address from the stack into x9
- ldr x9, [sp, #16]
-
// Store the SVC returned values into the ARM_SVC_ARGS structure.
- // A SVC call can return up to 8 values
- stp x0, x1, [x9, #0]
- stp x2, x3, [x9, #16]
- stp x4, x5, [x9, #32]
- stp x6, x7, [x9, #48]
-
- mov x0, x9
+ // A SVC call can return up to 18 values
+ stp x16, x17, [x30, #128]
+ stp x14, x15, [x30, #112]
+ stp x12, x13, [x30, #96]
+ stp x10, x11, [x30, #80]
+ stp x8, x9, [x30, #64]
+ stp x6, x7, [x30, #48]
+ stp x4, x5, [x30, #32]
+ stp x2, x3, [x30, #16]
+ stp x0, x1, [x30, #0]
+
+ ldp x29, x30, [sp], #16
- ldp x29, x30, [sp], #32
ret