jingfei195887 opened a new pull request, #22499: URL: https://github.com/apache/nuttx/pull/22499
## Summary Preserve XIP subranges across mapping and tail unmapping. Apply the file offset to the direct address after checking negative offsets and pointer representability, and keep that address when shortening an XIP mapping's recorded length. These paths form one subrange behavior. Writable-private copy handling remains the independent PR #22498. ## Impact - Functionality: a direct XIP fallback mapping begins at the requested file offset; tail unmapping retains the prefix address and mapping metadata. - Compatibility: no public API, Kconfig, driver-specific mmap callback, hardware integration, or build-system change. Existing file reference handling is reused. - Size: identical small sim configurations retaining rammap have text/data/bss deltas of 48/0/0 bytes. The baseline is reused from the earlier 0c45a2fc48b9 / apps c621be657e measurement with unchanged consumer source. ## Testing I confirm that changes are verified on local setup and work as intended: - Linux x86_64, GCC 13.1.0; runtime sim:nsh, CONFIG_FS_RAMMAP, assertions, nuttx-apps c621be657e. - A bounded local XIP driver covers user/internal APIs, shared/read-only-private mappings, zero and nonzero offsets inside its backing array, negative-offset rejection, file position, data, mapping counts, and cleanup. Testing logs before change (0c45a2fc48b9): ```text XIPSUBRANGE BASIC checks=219 failures=32 XIPSUBRANGE CLEANUP ret=0 ``` Testing logs after change (6f44372a09b5), in both default and large-file/512 KiB FS heap configurations: ```text XIPSUBRANGE BASIC checks=215 failures=0 XIPSUBRANGE TAIL checks=105 failures=0 XIPSUBRANGE CLEANUP ret=0 ``` The basic check count drops by four because rejected negative-offset mappings no longer need the test's cleanup. The 105 tail checks are fixed-branch coverage only: several retained lengths, prefix data, mapping address/offset/length, close-before-unmap lifetime, and final removal. No baseline partial-unmap assertion is exercised. Full-file/commit checkpatch, Make/CMake, OSTest, and tested-HEAD gate pass. CONFIG_FS_RAMMAP-enabled protected qemu-armv7r:pnsh and kernel qemu-armv8a:knsh builds pass. No physical XIP hardware, protected/kernel runtime, pointer-overflow injection, SMP stress, or allocator-failure injection was tested. ## PR verification Self-Check - [x] This PR introduces only one functional change. - [x] I have updated all required description fields above. - [x] The commit has a component prefix, explanatory body, and my Signed-off-by; code style checks pass. - [ ] My PR is still work in progress (not ready for review). - [x] My PR is ready for review. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
