arm64/SMP: Fix FPU and exception handling for ARM64
Summary
Fix FPU and exception handling for ARM64 by:
- Saving and restoring FPU state on every exception / interrupt
- Switching to the interrupt stack, when executing the exception handler / interrupt service routine
This is a continuation of: https://github.com/apache/nuttx/pull/13520 @GUIDINGLI Did the initial patches, which are adapted for CONFIG_BUILD_KERNEL / CONFIG_LIB_SYSCALL, which were implemented by me. The goal is to merge this work without breaking either one.
Impact
Impact is on ARM64 platform only. The impacted parts are the exception and ISR handling.
Testing
qemu-armv8a:nsh qemu-armv8a:nsh_smp qemu-armv8a:knsh
@GUIDINGLI the adaptation with https://github.com/apache/nuttx/pull/13520 is almost done. Flat mode nsh and nsh_smp both work, knsh doesn't work yet due to how SP_EL0 handling was changed.
Can you please take a look that the SMP issue you mentioned is OK with these changes? I'll fix the kernel mode issue on Monday.
SP_EL0 handling is now also fixed. Tested with: qemu-armv8a:nsh qemu-armv8a:nsh_smp qemu-armv8a:knsh Downstream imx9 with both with flat and kernel mode, with ~50 processes + threads running