OSDN Git Service

target/arm: Use signed quantity to represent VMSAv8-64 translation level
authorArd Biesheuvel <ardb@kernel.org>
Tue, 22 Nov 2022 15:55:15 +0000 (16:55 +0100)
committerPeter Maydell <peter.maydell@linaro.org>
Tue, 22 Nov 2022 16:10:25 +0000 (16:10 +0000)
commit15f8f4671afd22491ce99d28a296514717fead4f
tree6f1ef41980c05fa2d08e9bbe1a091c086c5c585f
parent26ba00cf58e9f21b08fff4c691ce7e9bb21dd123
target/arm: Use signed quantity to represent VMSAv8-64 translation level

The LPA2 extension implements 52-bit virtual addressing for 4k and 16k
translation granules, and for the former, this means an additional level
of translation is needed. This means we start counting at -1 instead of
0 when doing a walk, and so 'level' is now a signed quantity, and should
be typed as such. So turn it from uint32_t into int32_t.

This avoids a level of -1 getting misinterpreted as being >= 3, and
terminating a page table walk prematurely with a bogus output address.

Cc: Peter Maydell <peter.maydell@linaro.org>
Cc: Philippe Mathieu-Daudé <f4bug@amsat.org>
Cc: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
target/arm/ptw.c