OSDN Git Service

target-arm/translate.c: Handle non-executable page-straddling Thumb insns
authorPeter Maydell <peter.maydell@linaro.org>
Tue, 27 Oct 2015 12:00:50 +0000 (12:00 +0000)
committerPeter Maydell <peter.maydell@linaro.org>
Tue, 27 Oct 2015 12:00:50 +0000 (12:00 +0000)
commit541ebcd401ee47f3c1a3ce503ef5466b75e9d20a
tree20cf4ad710611285e1772545b7289afd57e3e2d8
parent7cd6de3bb1ca55dfa8f53fb9894803eb33f497b3
target-arm/translate.c: Handle non-executable page-straddling Thumb insns

When the memory we're trying to translate code from is not executable we have
to turn this into a guest fault. In order to report the correct PC for this
fault, and to make sure it is not reported until after any other possible
faults for instructions earlier in execution, we must terminate TBs at
the end of a page, in case the next instruction is in a non-executable page.
This is simple for T16, A32 and A64 instructions, which are always aligned
to their size. However T32 instructions may be 32-bits but only 16-aligned,
so they can straddle a page boundary.

Correct the condition that checks whether the next instruction will touch
the following page, to ensure that if we're 2 bytes before the boundary
and this insn is T32 then we end the TB.

Reported-by: Pavel Dovgalyuk <pavel.dovgaluk@ispras.ru>
Reviewed-by: Laurent Desnogues <laurent.desnogues@gmail.com>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
target-arm/translate.c