mirror of https://github.com/xemu-project/xemu.git
target/arm: Fix validation of 32-bit address spaces for aa32
When tsz == 0, aarch32 selects the address space via exclusion,
and there are no "top_bits" remaining that require validation.
Fixes: ba97be9f4a
Reported-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20190125184913.5970-1-richard.henderson@linaro.org
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
parent
3a183e330d
commit
36d820af0e
|
@ -10447,7 +10447,7 @@ static bool get_phys_addr_lpae(CPUARMState *env, target_ulong address,
|
||||||
uint64_t ttbr;
|
uint64_t ttbr;
|
||||||
hwaddr descaddr, indexmask, indexmask_grainsize;
|
hwaddr descaddr, indexmask, indexmask_grainsize;
|
||||||
uint32_t tableattrs;
|
uint32_t tableattrs;
|
||||||
target_ulong page_size, top_bits;
|
target_ulong page_size;
|
||||||
uint32_t attrs;
|
uint32_t attrs;
|
||||||
int32_t stride;
|
int32_t stride;
|
||||||
int addrsize, inputsize;
|
int addrsize, inputsize;
|
||||||
|
@ -10487,12 +10487,19 @@ static bool get_phys_addr_lpae(CPUARMState *env, target_ulong address,
|
||||||
* We determined the region when collecting the parameters, but we
|
* We determined the region when collecting the parameters, but we
|
||||||
* have not yet validated that the address is valid for the region.
|
* have not yet validated that the address is valid for the region.
|
||||||
* Extract the top bits and verify that they all match select.
|
* Extract the top bits and verify that they all match select.
|
||||||
|
*
|
||||||
|
* For aa32, if inputsize == addrsize, then we have selected the
|
||||||
|
* region by exclusion in aa32_va_parameters and there is no more
|
||||||
|
* validation to do here.
|
||||||
*/
|
*/
|
||||||
top_bits = sextract64(address, inputsize, addrsize - inputsize);
|
if (inputsize < addrsize) {
|
||||||
if (-top_bits != param.select || (param.select && !ttbr1_valid)) {
|
target_ulong top_bits = sextract64(address, inputsize,
|
||||||
/* In the gap between the two regions, this is a Translation fault */
|
addrsize - inputsize);
|
||||||
fault_type = ARMFault_Translation;
|
if (-top_bits != param.select || (param.select && !ttbr1_valid)) {
|
||||||
goto do_fault;
|
/* The gap between the two regions is a Translation fault */
|
||||||
|
fault_type = ARMFault_Translation;
|
||||||
|
goto do_fault;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (param.using64k) {
|
if (param.using64k) {
|
||||||
|
|
Loading…
Reference in New Issue