]> Git Repo - qemu.git/commit
target/arm: Introduce read_pc
authorRichard Henderson <[email protected]>
Thu, 15 Aug 2019 08:46:43 +0000 (09:46 +0100)
committerPeter Maydell <[email protected]>
Fri, 16 Aug 2019 13:02:49 +0000 (14:02 +0100)
commitfdbcf6329d0c2984c55d7019419a72bf8e583c36
tree9498811dafb764903aa7670486990ecc24454e2e
parent43722a6d4f0c92f7e7e1e291580039b0f9789df1
target/arm: Introduce read_pc

We currently have 3 different ways of computing the architectural
value of "PC" as seen in the ARM ARM.

The value of s->pc has been incremented past the current insn,
but that is all.  Thus for a32, PC = s->pc + 4; for t32, PC = s->pc;
for t16, PC = s->pc + 2.  These differing computations make it
impossible at present to unify the various code paths.

With the newly introduced s->pc_curr, we can compute the correct
value for all cases, using the formula given in the ARM ARM.

This changes the behaviour for load_reg() and load_reg_var()
when called with reg==15 from a 32-bit Thumb instruction:
previously they would have returned the incorrect value
of pc_curr + 6, and now they will return the architecturally
correct value of PC, which is pc_curr + 4. This will not
affect well-behaved guest software, because all of the places
we call these functions from T32 code are instructions where
using r15 is UNPREDICTABLE. Using the architectural PC value
here is more consistent with the T16 and A32 behaviour.

Signed-off-by: Richard Henderson <[email protected]>
Reviewed-by: Peter Maydell <[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Message-id: 20190807045335[email protected]
[PMM: added commit message note about UNPREDICTABLE T32 cases]
Signed-off-by: Peter Maydell <[email protected]>
target/arm/translate.c
This page took 0.025912 seconds and 4 git commands to generate.