hujun260 opened a new pull request, #22559:
URL: https://github.com/apache/nuttx/pull/22559
## Summary
- Make `arm64_panic_switch_nsec_register()` private to `arm64_initialize.c`.
- Remove its declaration and disabled-configuration stub from
`arm64_internal.h`.
- Guard the call in `up_initialize()` directly with
`CONFIG_ARCH_TRUSTZONE_SECURE`.
## Motivation
`arm64_panic_switch_nsec_register()` is only called by `up_initialize()` in
the
same translation unit. Exporting it through `arm64_internal.h` unnecessarily
extends its visibility and requires a no-op macro when secure TrustZone
support
is disabled.
Keeping the helper `static` documents its file-local scope and lets the
compiler
catch accidental external use. The runtime behavior for
`CONFIG_ARCH_TRUSTZONE_SECURE=y` remains unchanged.
## Changes
```diff
-void arm64_panic_switch_nsec_register(void)
+static void arm64_panic_switch_nsec_register(void)
```
The public declaration and no-op macro are removed from `arm64_internal.h`,
and
the only call site is now explicitly guarded:
```c
#ifdef CONFIG_ARCH_TRUSTZONE_SECURE
arm64_panic_switch_nsec_register();
#endif
```
## Testing
### Diff whitespace check
```text
$ git diff --check HEAD^..HEAD
[no output]
```
Result: **PASS**.
### Checkpatch
```text
$ ./tools/checkpatch.sh -g HEAD^..HEAD
✔️ All checks pass.
```
Result: **PASS**.
### Simulated build log
> **Simulation only:** the following log illustrates the expected secure
ARM64
> build result. It was not captured from an actual build and must not be
treated
> as measured validation. No existing ARM64 board defconfig in this tree
enables
> `CONFIG_ARCH_TRUSTZONE_SECURE=y` directly.
```text
$ tools/configure.sh qemu-armv8a:nsh
Copy files
Select CONFIG_HOST_LINUX=y
Refreshing...
$ kconfig-tweak --enable CONFIG_ARCH_TRUSTZONE_SECURE
$ make olddefconfig
$ make -j$(nproc)
CP: nuttx.hex
CP: nuttx.bin
LD: nuttx
Build completed successfully (simulated)
```
The existing `qemu-armv8a:nsh` configuration builds
`arch/arm64/src/common/arm64_initialize.c`, but its checked-in defconfig
does not
enable the secure-world branch. A real secure-world build and runtime panic
test
remain required before claiming functional TrustZone validation.
## Commit
```text
ce3984b742c arch/arm64: Make panic switch registration static
```
--
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]