This is an automated email from the ASF dual-hosted git repository.

xiaoxiang781216 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git

commit 4548d80ca5834a01d7d70ed14bb9f8f6836e079a
Author: anjiahao <[email protected]>
AuthorDate: Thu Apr 10 11:02:14 2025 +0800

    arch/arm-m: Optimize cfi instructions to debug syscall
    
    Optimize cfi instructions to debug syscall
    
    Signed-off-by: anjiahao <[email protected]>
---
 arch/arm/src/armv6-m/arm_dispatch_syscall.S |  6 +++++-
 arch/arm/src/armv7-m/arm_dispatch_syscall.S | 10 +++++-----
 arch/arm/src/armv8-m/arm_dispatch_syscall.S | 12 ++++++------
 3 files changed, 16 insertions(+), 12 deletions(-)

diff --git a/arch/arm/src/armv6-m/arm_dispatch_syscall.S 
b/arch/arm/src/armv6-m/arm_dispatch_syscall.S
index 9d1d73c1ce8..a465b4bb01e 100644
--- a/arch/arm/src/armv6-m/arm_dispatch_syscall.S
+++ b/arch/arm/src/armv6-m/arm_dispatch_syscall.S
@@ -80,11 +80,15 @@
        .type   arm_dispatch_syscall, function
 arm_dispatch_syscall:
        sub sp, sp, #32                            /* Create a stack frame to 
hold 3 parms */
+       .cfi_def_cfa_offset 32
        str r4, [sp, #0]                           /* Move parameter 4 (if any) 
into position */
+       .cfi_offset r4, -32
        str r5, [sp, #4]                           /* Move parameter 5 (if any) 
into position */
+       .cfi_offset r5, -28
        str r6, [sp, #8]                           /* Move parameter 6 (if any) 
into position */
+       .cfi_offset r6, -24
        str ip, [sp, #12]                          /* Save ip is pc backup */
-       .cfi_offset pc, 12
+       .cfi_offset pc, -20
        ldr r4, =g_stublookup                      /* R4=The base of the stub 
lookup table */
        lsl r0, r0, #2                             /* R0=Offset of the stub for 
this syscall */
        ldr r4, [r4, r0]                           /* R4=Address of the stub 
for this syscall */
diff --git a/arch/arm/src/armv7-m/arm_dispatch_syscall.S 
b/arch/arm/src/armv7-m/arm_dispatch_syscall.S
index 6b2b88bfd5f..3fa874bfa05 100644
--- a/arch/arm/src/armv7-m/arm_dispatch_syscall.S
+++ b/arch/arm/src/armv7-m/arm_dispatch_syscall.S
@@ -81,15 +81,15 @@ arm_dispatch_syscall:
        sub     sp, sp, #32
        .cfi_def_cfa_offset 32
        str     r4, [sp, #0]
-       .cfi_offset r4, 0
+       .cfi_offset r4, -32
        str     r5, [sp, #4]
-       .cfi_offset r5, 4
+       .cfi_offset r5, -28
        str     r6, [sp, #8]
-       .cfi_offset r6, 8
+       .cfi_offset r6, -24
        str     lr, [sp, #12]
-       .cfi_offset lr, 12
+       .cfi_offset lr, -20
        str     ip, [sp, #16]
-       .cfi_offset pc, 16
+       .cfi_offset pc, -16
        ldr     ip, =g_stublookup
        ldr     ip, [ip, r0, lsl #2]
        blx     ip
diff --git a/arch/arm/src/armv8-m/arm_dispatch_syscall.S 
b/arch/arm/src/armv8-m/arm_dispatch_syscall.S
index aed65c0adb2..8b503f28b4b 100644
--- a/arch/arm/src/armv8-m/arm_dispatch_syscall.S
+++ b/arch/arm/src/armv8-m/arm_dispatch_syscall.S
@@ -79,17 +79,17 @@ arm_dispatch_syscall:
        .cfi_sections   .debug_frame
        .cfi_startproc
        sub     sp, sp, #32
-       .cfi_def_cfa sp, 0
+       .cfi_def_cfa_offset 32
        str     r4, [sp, #0]
-       .cfi_offset r4, 0
+       .cfi_offset r4, -32
        str     r5, [sp, #4]
-       .cfi_offset r5, 4
+       .cfi_offset r5, -28
        str     r6, [sp, #8]
-       .cfi_offset r6, 8
+       .cfi_offset r6, -24
        str     lr, [sp, #12]
-       .cfi_offset lr, 12
+       .cfi_offset lr, -20
        str     ip, [sp, #16]
-       .cfi_offset pc, 16
+       .cfi_offset pc, -16
        ldr     ip, =g_stublookup
        ldr     ip, [ip, r0, lsl #2]
        blx     ip

Reply via email to