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 a1f57a281d54ac74eb25e6741f0410c0831a80e9 Author: buxiasen <[email protected]> AuthorDate: Sun Nov 30 19:35:36 2025 +0800 arch/arm_m: merge arm_dispatch_syscall.S We should merge all similar arm_m arch to decrese the maintain cost. Signed-off-by: buxiasen <[email protected]> --- arch/arm/src/arm_m/CMakeLists.txt | 4 + arch/arm/src/arm_m/Make.defs | 5 + .../src/{armv6-m => arm_m}/arm_dispatch_syscall.S | 14 ++- arch/arm/src/armv6-m/CMakeLists.txt | 4 - arch/arm/src/armv6-m/Make.defs | 4 - arch/arm/src/armv7-m/CMakeLists.txt | 4 - arch/arm/src/armv7-m/Make.defs | 4 - arch/arm/src/armv7-m/arm_dispatch_syscall.S | 103 --------------------- arch/arm/src/armv8-m/CMakeLists.txt | 4 - arch/arm/src/armv8-m/Make.defs | 4 - arch/arm/src/armv8-m/arm_dispatch_syscall.S | 103 --------------------- 11 files changed, 19 insertions(+), 234 deletions(-) diff --git a/arch/arm/src/arm_m/CMakeLists.txt b/arch/arm/src/arm_m/CMakeLists.txt index 62b41467a85..46ae880a6b7 100644 --- a/arch/arm/src/arm_m/CMakeLists.txt +++ b/arch/arm/src/arm_m/CMakeLists.txt @@ -21,3 +21,7 @@ list(APPEND CSRCS arm_tcbinfo.c) target_sources(arch PRIVATE ${CSRCS}) + +if(CONFIG_LIB_SYSCALL) + list(APPEND SRCS arm_dispatch_syscall.S) +endif() diff --git a/arch/arm/src/arm_m/Make.defs b/arch/arm/src/arm_m/Make.defs index 7baa18f1abc..7806de8a1ae 100644 --- a/arch/arm/src/arm_m/Make.defs +++ b/arch/arm/src/arm_m/Make.defs @@ -21,3 +21,8 @@ # Common ARM_M files CMN_CSRCS += arm_tcbinfo.c + +ifeq ($(CONFIG_LIB_SYSCALL),y) + CMN_ASRCS += arm_dispatch_syscall.S +endif + diff --git a/arch/arm/src/armv6-m/arm_dispatch_syscall.S b/arch/arm/src/arm_m/arm_dispatch_syscall.S similarity index 92% rename from arch/arm/src/armv6-m/arm_dispatch_syscall.S rename to arch/arm/src/arm_m/arm_dispatch_syscall.S index a465b4bb01e..ed9fb2a900e 100644 --- a/arch/arm/src/armv6-m/arm_dispatch_syscall.S +++ b/arch/arm/src/arm_m/arm_dispatch_syscall.S @@ -1,5 +1,5 @@ /**************************************************************************** - * arch/arm/src/armv6-m/arm_dispatch_syscall.S + * arch/arm/src/arm_m/arm_dispatch_syscall.S * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with @@ -79,7 +79,9 @@ .thumb_func .type arm_dispatch_syscall, function arm_dispatch_syscall: - sub sp, sp, #32 /* Create a stack frame to hold 3 parms */ + .cfi_sections .debug_frame + .cfi_startproc + sub sp, sp, #32 /* Create a stack frame to hold params */ .cfi_def_cfa_offset 32 str r4, [sp, #0] /* Move parameter 4 (if any) into position */ .cfi_offset r4, -32 @@ -87,16 +89,20 @@ arm_dispatch_syscall: .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, -20 + str lr, [sp, #12] /* Save lr and make able to find by CFI */ + .cfi_offset lr, -20 + str ip, [sp, #16] /* Save ip is pc backup */ + .cfi_offset pc, -16 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 */ blx r4 /* Call the stub (modifies lr) */ ldr r4, [sp, #0] /* Restore r4 */ + ldr lr, [sp, #12] add sp, sp, #32 /* Destroy the stack frame */ mov r2, r0 /* R2=Save return value in R2 */ mov r0, SYS_syscall_return /* R0=SYS_syscall_return */ svc SYS_syscall /* Return from the SYSCALL */ + .cfi_endproc .size arm_dispatch_syscall, .-arm_dispatch_syscall .end diff --git a/arch/arm/src/armv6-m/CMakeLists.txt b/arch/arm/src/armv6-m/CMakeLists.txt index 3defd55cf3e..56ef81723d9 100644 --- a/arch/arm/src/armv6-m/CMakeLists.txt +++ b/arch/arm/src/armv6-m/CMakeLists.txt @@ -48,8 +48,4 @@ if(CONFIG_ARCH_RAMVECTORS) list(APPEND SRCS arm_ramvec_initialize.c arm_ramvec_attach.c) endif() -if(CONFIG_LIB_SYSCALL) - list(APPEND SRCS arm_dispatch_syscall.S) -endif() - target_sources(arch PRIVATE ${SRCS}) diff --git a/arch/arm/src/armv6-m/Make.defs b/arch/arm/src/armv6-m/Make.defs index 372f9290ae5..152b71dbc22 100644 --- a/arch/arm/src/armv6-m/Make.defs +++ b/arch/arm/src/armv6-m/Make.defs @@ -46,8 +46,4 @@ ifeq ($(CONFIG_ARCH_RAMVECTORS),y) CMN_CSRCS += arm_ramvec_initialize.c arm_ramvec_attach.c endif -ifeq ($(CONFIG_LIB_SYSCALL),y) - CMN_ASRCS += arm_dispatch_syscall.S -endif - VPATH += arm_m diff --git a/arch/arm/src/armv7-m/CMakeLists.txt b/arch/arm/src/armv7-m/CMakeLists.txt index 34a120292a5..fd0c99e9f15 100644 --- a/arch/arm/src/armv7-m/CMakeLists.txt +++ b/arch/arm/src/armv7-m/CMakeLists.txt @@ -76,8 +76,4 @@ if(CONFIG_ARM_COREDUMP_REGION) list(APPEND SRCS arm_dumpnvic.c) endif() -if(CONFIG_LIB_SYSCALL) - list(APPEND SRCS arm_dispatch_syscall.S) -endif() - target_sources(arch PRIVATE ${SRCS}) diff --git a/arch/arm/src/armv7-m/Make.defs b/arch/arm/src/armv7-m/Make.defs index ea6e01e6575..f78f40c224d 100644 --- a/arch/arm/src/armv7-m/Make.defs +++ b/arch/arm/src/armv7-m/Make.defs @@ -70,8 +70,4 @@ ifeq ($(CONFIG_ARM_COREDUMP_REGION),y) CMN_CSRCS += arm_dumpnvic.c endif -ifeq ($(CONFIG_LIB_SYSCALL),y) - CMN_ASRCS += arm_dispatch_syscall.S -endif - VPATH += arm_m diff --git a/arch/arm/src/armv7-m/arm_dispatch_syscall.S b/arch/arm/src/armv7-m/arm_dispatch_syscall.S deleted file mode 100644 index 3fa874bfa05..00000000000 --- a/arch/arm/src/armv7-m/arm_dispatch_syscall.S +++ /dev/null @@ -1,103 +0,0 @@ -/**************************************************************************** - * arch/arm/src/armv7-m/arm_dispatch_syscall.S - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. The - * ASF licenses this file to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance with the - * License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations - * under the License. - * - ****************************************************************************/ - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include <nuttx/config.h> - -#include <syscall.h> - -#include "arm_internal.h" - -/**************************************************************************** - * Public Symbols - ****************************************************************************/ - - .globl arm_dispatch_syscall - - .syntax unified - .thumb - .file "arm_dispatch_syscall.S" - -/**************************************************************************** - * .text - ****************************************************************************/ - -/**************************************************************************** - * Call the stub function corresponding to the system call. NOTE the non- - * standard parameter passing: - * - * R0 = SYS_ call number - * R1 = parm0 - * R2 = parm1 - * R3 = parm2 - * R4 = parm3 - * R5 = parm4 - * R6 = parm5 - * - * The values of R4-R5 may be preserved in the proxy called by the user - * code if they are used (but otherwise will not be). - * - * Register usage: - * - * R0 - Need not be preserved. - * R1-R3 - Need to be preserved until the stub is called. The values of - * R0 and R1 returned by the stub must be preserved. - * R4-R11 must be preserved to support the expectations of the user-space - * callee. R4-R6 may have been preserved by the proxy, but don't know - * for sure. - * R12 - Need not be preserved - * R13 - (stack pointer) - * R14 - Need not be preserved - * R15 - (PC) - * - ****************************************************************************/ - - .text - .thumb_func - .type arm_dispatch_syscall, function -arm_dispatch_syscall: - .cfi_sections .debug_frame - .cfi_startproc - sub sp, sp, #32 - .cfi_def_cfa_offset 32 - str r4, [sp, #0] - .cfi_offset r4, -32 - str r5, [sp, #4] - .cfi_offset r5, -28 - str r6, [sp, #8] - .cfi_offset r6, -24 - str lr, [sp, #12] - .cfi_offset lr, -20 - str ip, [sp, #16] - .cfi_offset pc, -16 - ldr ip, =g_stublookup - ldr ip, [ip, r0, lsl #2] - blx ip - ldr lr, [sp, #12] - add sp, sp, #32 - mov r2, r0 - mov r0, SYS_syscall_return - svc SYS_syscall - .cfi_endproc - .size arm_dispatch_syscall, .-arm_dispatch_syscall - .end diff --git a/arch/arm/src/armv8-m/CMakeLists.txt b/arch/arm/src/armv8-m/CMakeLists.txt index ded07ffa3e8..8c4fe5a9fb0 100644 --- a/arch/arm/src/armv8-m/CMakeLists.txt +++ b/arch/arm/src/armv8-m/CMakeLists.txt @@ -85,8 +85,4 @@ if(CONFIG_ARM_COREDUMP_REGION) list(APPEND SRCS arm_dumpnvic.c) endif() -if(CONFIG_LIB_SYSCALL) - list(APPEND SRCS arm_dispatch_syscall.S) -endif() - target_sources(arch PRIVATE ${SRCS}) diff --git a/arch/arm/src/armv8-m/Make.defs b/arch/arm/src/armv8-m/Make.defs index 7c5b94e7a8f..9f349dfd3cc 100644 --- a/arch/arm/src/armv8-m/Make.defs +++ b/arch/arm/src/armv8-m/Make.defs @@ -80,8 +80,4 @@ ifeq ($(CONFIG_ARM_COREDUMP_REGION),y) CMN_CSRCS += arm_dumpnvic.c endif -ifeq ($(CONFIG_LIB_SYSCALL),y) - CMN_ASRCS += arm_dispatch_syscall.S -endif - VPATH += arm_m diff --git a/arch/arm/src/armv8-m/arm_dispatch_syscall.S b/arch/arm/src/armv8-m/arm_dispatch_syscall.S deleted file mode 100644 index 8b503f28b4b..00000000000 --- a/arch/arm/src/armv8-m/arm_dispatch_syscall.S +++ /dev/null @@ -1,103 +0,0 @@ -/**************************************************************************** - * arch/arm/src/armv8-m/arm_dispatch_syscall.S - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. The - * ASF licenses this file to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance with the - * License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations - * under the License. - * - ****************************************************************************/ - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include <nuttx/config.h> - -#include <syscall.h> - -#include "arm_internal.h" - -/**************************************************************************** - * Public Symbols - ****************************************************************************/ - - .globl arm_dispatch_syscall - - .syntax unified - .thumb - .file "arm_dispatch_syscall.S" - -/**************************************************************************** - * .text - ****************************************************************************/ - -/**************************************************************************** - * Call the stub function corresponding to the system call. NOTE the non- - * standard parameter passing: - * - * R0 = SYS_ call number - * R1 = parm0 - * R2 = parm1 - * R3 = parm2 - * R4 = parm3 - * R5 = parm4 - * R6 = parm5 - * - * The values of R4-R5 may be preserved in the proxy called by the user - * code if they are used (but otherwise will not be). - * - * Register usage: - * - * R0 - Need not be preserved. - * R1-R3 - Need to be preserved until the stub is called. The values of - * R0 and R1 returned by the stub must be preserved. - * R4-R11 must be preserved to support the expectations of the user-space - * callee. R4-R6 may have been preserved by the proxy, but don't know - * for sure. - * R12 - Need not be preserved - * R13 - (stack pointer) - * R14 - Need not be preserved - * R15 - (PC) - * - ****************************************************************************/ - - .text - .thumb_func - .type arm_dispatch_syscall, function -arm_dispatch_syscall: - .cfi_sections .debug_frame - .cfi_startproc - sub sp, sp, #32 - .cfi_def_cfa_offset 32 - str r4, [sp, #0] - .cfi_offset r4, -32 - str r5, [sp, #4] - .cfi_offset r5, -28 - str r6, [sp, #8] - .cfi_offset r6, -24 - str lr, [sp, #12] - .cfi_offset lr, -20 - str ip, [sp, #16] - .cfi_offset pc, -16 - ldr ip, =g_stublookup - ldr ip, [ip, r0, lsl #2] - blx ip - ldr lr, [sp, #12] - add sp, sp, #32 - mov r2, r0 - mov r0, SYS_syscall_return - svc SYS_syscall - .cfi_endproc - .size arm_dispatch_syscall, .-arm_dispatch_syscall - .end
