提交 57964855 编写于 作者: P Peter Maydell

linux-user/arm/nwfpe: Check coprocessor number for FPA emulation

Our copy of the nwfpe code for emulating of the old FPA11 floating
point unit doesn't check the coprocessor number in the instruction
when it emulates it.  This means that we might treat some
instructions which should really UNDEF as being FPA11 instructions by
accident.

The kernel's copy of the nwfpe code doesn't make this error; I suspect
the bug was noticed and fixed as part of the process of mainlining
the nwfpe code more than a decade ago.

Add a check that the coprocessor number (which is always in bits
[11:8] of the instruction) is either 1 or 2, which is where the
FPA11 lives.
Reported-by: NRichard Henderson <richard.henderson@linaro.org>
Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
上级 487b406a
......@@ -137,8 +137,17 @@ unsigned int EmulateAll(unsigned int opcode, FPA11* qfpa, CPUARMState* qregs)
unsigned int nRc = 0;
// unsigned long flags;
FPA11 *fpa11;
unsigned int cp;
// save_flags(flags); sti();
/* Check that this is really an FPA11 instruction: the coprocessor
* field in bits [11:8] must be 1 or 2.
*/
cp = (opcode >> 8) & 0xf;
if (cp != 1 && cp != 2) {
return 0;
}
qemufpa=qfpa;
user_registers=qregs;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册