fpscr 寄存器未更新且未生成 SIGFPE。这是在 NVidia Shield 平板电脑和第一代 Nexus 7 上测试的。
feenableexcept(FE_DIVBYZERO | FE_INVALID | FE_OVERFLOW);
实现调用代码,最终执行这个程序集:
asm _volatile__("vmsr fpscr,%0" : :"ri" (fpscr));
; disassembly follows
ldr r3, [r11, #-8]
vmsr fpscr, r3
vmsr fpscr
不更新。当它应该更新为 0x20000710 时,它仍然是 0x20000010。
使用 -mfloat-abi=soft
和 -mfloat-abi=softfp
进行测试。
我能得出什么结论?
最佳答案
ARM ARM 对 FPSCR 中的所有异常捕获位有这样的说法:
[...]. This bit is RW only if the implementation supports the trapping of floating-point exceptions. In an implementation that does not support floating-point exception trapping, this bit is RES0.
SHIELD 平板电脑中的 Tegra K1 SoC 具有 Cortex-A15 CPU,don't support VFP exception trapping .
原始 Nexus 7 中的 Tegra 3 SoC 具有 Cortex-A9 CPU(具有 VFP+NEON 实现),don't support VFP exception trapping
特别无益的是,您甚至无法从用户空间访问 MVFR0 功能寄存器以编程方式找到它。
我认为您只能得出结论,您没有任何支持捕获异常的硬件;)
关于debugging - 在 arm7 上启用浮点异常时 fpscr 寄存器未更新,未生成 SIGFPE,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30244857/