In ARMv7 ISA, how to determine that undefined instruction exception has occurred due to one of the floating point exceptions? Also I read that by default VFP units are disabled and when VFP instruction if used by an application for first time, then kernal will use the excpetion handling to enable the VFP unit and let the application continue. I suppose this exception will be undefined instruction exception.
I understand undefined instruction could be due to other cases also. I did some reading on undef handler in document ARM DUI 0471C
page 128 where it says
Examine the undefined instruction to see if it has to be emulated. This is similar to the way in which an SVC handler extracts the number of an SVC, but rather than extracting the bottom 24 bits, the emulator must extract bits [27:24]
If bits [27:24] = b1110 or b110x, the instruction is a coprocessor instruction
The bit field do not seem to give me acurate indication that instruction was a floating point instruction, for instance bit [27:24] of VADD =0010
. So this method dose not seem like best method to figure out.
From what i read in ARM ARM I could use FPEXC.DEX
bit to figure out it was a floating point instruction exception. But this is so after we enable VFP unit. I will need to do this check first thing in the undef handler. What is the most appropriate method to detect exception from floating point instruction?
if ((a || b) && c) then VFP else not VFP
? – Notlikethat