testing/sig_sp_test: add test for SP context restore on signal return#3536
Open
cshung wants to merge 1 commit into
Open
testing/sig_sp_test: add test for SP context restore on signal return#3536cshung wants to merge 1 commit into
cshung wants to merge 1 commit into
Conversation
Add a test that verifies modifying REG_R13 (SP) in saved register context during a signal handler is honored on exception return. The test pushes values 1 and 2 onto the stack, waits for SIGALRM, then the handler advances SP by 4 (emulating unwinding past a trampoline frame) and redirects PC to a resume function that pops and verifies the value equals 1. Requires CONFIG_ARMV7M_SP_CONTEXT_RESTORE or CONFIG_ARMV8M_SP_CONTEXT_RESTORE to be enabled. Only available for flat builds on ARM (accesses nxsched_self for saved_regs). Signed-off-by: Andrew Au <cshung@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add a test application that verifies modifying
REG_R13(SP) in saved register context during a signal handler is honored on exception return.Test scenario (simulates a managed runtime unwinding past a trampoline):
SIGALRM(async delivery from timer interrupt)This exercises the HW exception frame relocation fix in
arm_exception.S.Dependencies:
CONFIG_ARMV7M_SP_CONTEXT_RESTORE=yorCONFIG_ARMV8M_SP_CONTEXT_RESTORE=yBUILD_FLAT) — accessesnxsched_self()forsaved_regsCompanion OS fix PR: apache/nuttx#19123
Impact
Testing
Host: Ubuntu 22.04 x86_64, arm-none-eabi-gcc 13.3, QEMU 8.2.2 (via Docker)
Targets tested:
lm3s6965-ek:qemu-flat(ARMv7-M, Cortex-M3)mps2-an521:nsh(ARMv8-M, Cortex-M33)Test log (ARMv7-M):
Test log (ARMv8-M):
Sanity check (without SP adjustment in handler):