简体   繁体   English

臂; VFP; 浮点扩展; 未定义的指令;

[英]arm; VFP; Floating-point Extension; Undefined Instructions;

I have a device on ARM cortex-a9 and trying to implement "lazy float switching" for OS for this device. 我在ARM cortex-a9上有一个设备,并试图为此设备的OS实现“延迟浮动切换”。 "lazy switching" is when “延迟切换”是什么时候

  • VFP support is disabled, VFP支持被禁用,
  • thread tries to execute any VFP instruction and generates exception, 线程尝试执行任何VFP指令并生成异常,
  • exception handler turn on VFP, manage thread context & return so the same instruction will be tried again, 异常处理程序打开VFP,管理线程上下文并返回,因此将再次尝试相同的指令,
  • scheduler turns off VFP before switching threads. 调度程序在切换线程之前先关闭VFP。

The problem is that almost all VFP instructions generate synchronous exception when VFP is enabled. 问题在于,启用VFP时,几乎所有VFP指令都会生成同步异常。 Simply speaking 简而言之

vadd.f32    s19, s19, s17

at first exception handler enables VFP and returns to retry vadd.f32 s19, s19, s17 , the user-space code generates another exception 首先,异常处理程序启用VFP并返回以重试vadd.f32 s19, s19, s17vadd.f32 s19, s19, s17 ,用户空间代码生成另一个异常

at second time generate synchronous exception. 在第二次生成同步异常。
Exception Register, FPEXC is FPEXC.EX == 0, FPEXC.EN == 1, FPEXC.DEX == 1 异常寄存器,FPEXC为FPEXC.EX == 0, FPEXC.EN == 1, FPEXC.DEX == 1

And I could not understand what is the reason for this synchronous exception. 而且我不明白此同步异常的原因是什么。 I checked that 我检查了

  • Interrupts are disabled FPSCR[15, 12-8] == 0 ; 禁止中断FPSCR[15, 12-8] == 0 ;
  • VFPv3 is presented and implements full hardware FPU instruction set; 介绍了VFPv3,它实现了完整的硬件FPU指令集;
  • MVFR0 & MVFR1 are also indicate that all features are implemented and software simulation is not required. MVFR0MVFR1还指示已实现所有功能,并且不需要软件仿真。

Any ideas what could be the reason of these extra exceptions? 任何想法可能是这些额外异常的原因吗?


PS: PS:

apps are build w/ -mcpu=cortex-a9 -marm -mfpu=vfpv3-fp16 -mfloat-abi=hard -ffast-math ; 应用是通过-mcpu=cortex-a9 -marm -mfpu=vfpv3-fp16 -mfloat-abi=hard -ffast-math

vpush... , vldr... generate exception only when VFP is off (behave as expected) vpush...vldr...仅在关闭VFP时才生成异常(行为符合预期)

According to the Cortex-A9 FPU docs , the only reason for FPEXC.DEX to be set is if the thing was incorrectly configured to attempt short vector operations. 根据Cortex-A9 FPU文档 ,设置FPEXC.DEX的唯一原因是,是否已将事物正确配置为尝试短向量操作。 The "V" in VFP has been deprecated since NEON came about, and isn't supported at all on anything newer than Cortex-A8. 自NEON出现以来,VFP中的“ V”已被弃用,并且在所有比Cortex-A8更高的版本上均不受支持。

You need to make sure that FPSCR.Len and FPSCR.Stride * are set to 0. 您需要确保FPSCR.Len和FPSCR.Stride *设置为0。

* OK, so strictly the value of Stride shouldn't matter when Len == 0, but hey, there's no good reason not to... *确定,因此严格地说,Len == 0时Stride的值无关紧要,但是,没有充分的理由 ...

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM