nuttx/arch/arm/src/armv8-m
chao an cf616fd619 arch/arm/armv8-m: stack pointer should be 8-byte aligned in signal context
Since the alignment of the signal context is affected by XCPTCONTEXT_SIZE in
different Kconfig,  sometimes the stack pointer is not aligned to 8 bytes, this
is not what the software and compiler expect, for example,  if va_list() obtains
wide data of type long long, the offset will be wrong, So in this commit, we set
stack-aligned the base offset so that the correct offset will be set during context
restoration.

1. test code:
|            void signal_handler(int signo, siginfo_t *info, void *context) {
|                long long ttt = 1024000;
|                printf("%lld\n", ttt);
|            }
|
|            struct itimerspec its = {   .it_value.tv_sec  = 1,
|                .it_value.tv_nsec = 0,
|                .it_interval.tv_sec  = 1,
|                .it_interval.tv_nsec = 0
|            };
|
|            int main(int argc, FAR char *argv[])
|            {
|                struct sigevent evp;
|                timer_t timer_id;
|
|                memset(&evp, 0, sizeof(evp));
|                evp.sigev_notify          = SIGEV_SIGNAL | SIGEV_THREAD_ID;
|                evp.sigev_signo           = SIGALRM;
|                evp.sigev_notify_thread_id = gettid();
|
|                timer_create(CLOCK_REALTIME, &evp, &timer_id);
|
|
|                struct sigaction sa;
|                memset(&sa, 0, sizeof(sa));
|                sa.sa_sigaction = signal_handler;
|                sa.sa_flags = SA_SIGINFO;
|                sigemptyset(&sa.sa_mask);
|
|                sigaction(SIGALRM, &sa, NULL);
|
|                timer_settime(timer_id, 0, &its, NULL);
|
|                while (1)
|                    sleep(1);
|
|                return 0;
|            }

2. before this change:

|            NuttShell (NSH) NuttX-12.10.0
|            nsh> hello
|            4398046527890440
|            4398046527890472
|            4398046527890504
|            4398046527890536

3. after this change:

|            NuttShell (NSH) NuttX-12.10.0
|            nsh> hello
|            1024000
|            1024000
|            1024000
|            1024000

Signed-off-by: chao an <anchao.archer@bytedance.com>
2025-09-27 21:41:20 +08:00
..
arm_busfault.c arch/arm: migrate to SPDX identifier 2024-12-06 09:25:23 +08:00
arm_cache.c comments: update text typo pre-empted to preempted 2025-05-12 15:01:37 +08:00
arm_cpuinfo.c arch/arm: migrate to SPDX identifier 2024-12-06 09:25:23 +08:00
arm_dbgmonitor.c arch/arm: migrate to SPDX identifier 2024-12-06 09:25:23 +08:00
arm_doirq.c Revert "Reduce the size of tcb by four bytes." 2025-05-27 16:30:35 +08:00
arm_dumpnvic.c arch/arm: migrate to SPDX identifier 2024-12-06 09:25:23 +08:00
arm_exception.S style: fix spelling in code comments and strings 2025-05-23 10:48:41 +08:00
arm_fpucmp.c arch/arm: migrate to SPDX identifier 2024-12-06 09:25:23 +08:00
arm_fpuconfig.c arch/arm: migrate to SPDX identifier 2024-12-06 09:25:23 +08:00
arm_gen_nonsecfault.c style: fix spelling in code comments and strings 2025-05-23 10:48:41 +08:00
arm_hardfault.c armv7/8m: fix regresion from https://github.com/apache/nuttx/pull/14881 2024-12-09 12:20:13 +08:00
arm_initialstate.c armv7/8m: fix regresion from https://github.com/apache/nuttx/pull/14881 2024-12-09 12:20:13 +08:00
arm_itm.c
arm_itm_syslog.c arch/arm: migrate to SPDX identifier 2024-12-06 09:25:23 +08:00
arm_memfault.c arch/arm: migrate to SPDX identifier 2024-12-06 09:25:23 +08:00
arm_mpu.c arch/arm:use UP_DSB, UP_DMB, UP_ISB as barrier standard API 2025-01-20 20:13:07 +08:00
arm_perf.c arch: Flag all definitions of up_perf_* functions with CONFIG_ARCH_HAVE_PERF_EVENTS 2025-06-06 17:31:10 +08:00
arm_ramvec_attach.c style: fix spelling in code comments and strings 2025-05-23 10:48:41 +08:00
arm_ramvec_initialize.c arch/arm: migrate to SPDX identifier 2024-12-06 09:25:23 +08:00
arm_sau.c arch/arm: migrate to SPDX identifier 2024-12-06 09:25:23 +08:00
arm_saveusercontext.S armv7/8m: fix regresion from https://github.com/apache/nuttx/pull/14881 2024-12-09 12:20:13 +08:00
arm_schedulesigaction.c arch/arm/armv8-m: stack pointer should be 8-byte aligned in signal context 2025-09-27 21:41:20 +08:00
arm_secure_irq.c arch/arm: migrate to SPDX identifier 2024-12-06 09:25:23 +08:00
arm_securefault.c arch/arm: migrate to SPDX identifier 2024-12-06 09:25:23 +08:00
arm_sigdeliver.c arch/*/*_sigdeliver.c: Fix a race condition is signal delivery for SMP 2025-08-04 21:11:13 +08:00
arm_stackcheck.c arch/arm: migrate to SPDX identifier 2024-12-06 09:25:23 +08:00
arm_svcall.c arch/arm: migrate to SPDX identifier 2024-12-06 09:25:23 +08:00
arm_systemreset.c arch/arm: migrate to SPDX identifier 2024-12-06 09:25:23 +08:00
arm_systick.c arch/arm: migrate to SPDX identifier 2024-12-06 09:25:23 +08:00
arm_tcbinfo.c armv7/8m: fix regresion from https://github.com/apache/nuttx/pull/14881 2024-12-09 12:20:13 +08:00
arm_trigger_irq.c arch/arm: migrate to SPDX identifier 2024-12-06 09:25:23 +08:00
arm_usagefault.c arch/arm: migrate to SPDX identifier 2024-12-06 09:25:23 +08:00
arm_vectors.c arch/arm: migrate to SPDX identifier 2024-12-06 09:25:23 +08:00
CMakeLists.txt arch/arm: migrate to SPDX identifier 2024-12-06 09:25:23 +08:00
dwt.h arch/arm: migrate to SPDX identifier 2024-12-18 17:51:57 +08:00
etm.h style: fix spelling in code comments and strings 2025-05-23 10:48:41 +08:00
exc_return.h arch/arm: migrate to SPDX identifier 2024-12-06 09:25:23 +08:00
fpb.h arch/arm: migrate to SPDX identifier 2024-12-06 09:25:23 +08:00
itm.h arch/arm: migrate to SPDX identifier 2024-12-18 17:51:57 +08:00
itm_syslog.h arch/arm: migrate to SPDX identifier 2024-12-06 09:25:23 +08:00
Kconfig armv8m: Default open hardware stack check 2025-01-21 11:55:10 -03:00
Make.defs arch/arm: migrate to SPDX identifier 2024-12-06 09:25:23 +08:00
mpu.h arch/arm: migrate to SPDX identifier 2024-12-06 09:25:23 +08:00
nvic.h style: fix spelling in code comments and strings 2025-05-23 10:48:41 +08:00
pmu.h arch/arm: migrate to SPDX identifier 2024-12-06 09:25:23 +08:00
psr.h arch/arm: migrate to SPDX identifier 2024-12-06 09:25:23 +08:00
ram_vectors.h arch/arm: migrate to SPDX identifier 2024-12-06 09:25:23 +08:00
sau.h arch/arm: migrate to SPDX identifier 2024-12-06 09:25:23 +08:00
systick.h arch/arm: migrate to SPDX identifier 2024-12-06 09:25:23 +08:00
Toolchain.defs arm/clang: Fix crash caused by clang compiling with -mfpu=fpv5-d16 and -march=armv8.1-m.main+mve.fp+fp.dp 2025-07-11 20:36:35 +08:00
tpi.h arch/arm: migrate to SPDX identifier 2024-12-18 17:51:57 +08:00