target/arm: Fix 32-bit address truncation

Commit ("3b39d734141a target/arm: Handle page table walk load failures
correctly") modified both versions of the page table walking code (i.e.,
arm_ldl_ptw and arm_ldq_ptw) to record the result of the translation in
a temporary 'data' variable so that it can be inspected before being
returned. However, arm_ldq_ptw() returns an uint64_t, and using a
temporary uint32_t variable truncates the upper bits, corrupting the
result. This causes problems when using more than 4 GB of memory in
a TCG guest. So use a uint64_t instead.

Backports commit 9aea1ea31af25fe344a88da086ff913cca09c667 from qemu
This commit is contained in:
Ard Biesheuvel 2018-03-06 09:19:12 -05:00 committed by Lioncash
parent 02eee6d5f7
commit aeee985cc9
No known key found for this signature in database
GPG key ID: 4E3C3CC1031BA9C7

View file

@ -7551,7 +7551,7 @@ static uint64_t arm_ldq_ptw(CPUState *cs, hwaddr addr, bool is_secure,
MemTxAttrs attrs = {0};
MemTxResult result = MEMTX_OK;
AddressSpace *as;
uint32_t data;
uint64_t data;
attrs.secure = is_secure;
as = arm_addressspace(cs, attrs);