Skip to content

Commit 12c3653

Browse files
Joelle van Dynepm215
authored andcommitted
target/arm/hvf: sign extend the data for a load operation when SSE=1
In the syndrome value for a data abort, bit 21 is SSE, which is set to indicate that the abort was on a sign-extending load. When we handle the data abort from the guest via address_space_read(), we forgot to handle this and so would return the wrong value if the guest did a sign-extending load to an MMIO region. Add the sign-extension of the returned data. Cc: qemu-stable@nongnu.org Signed-off-by: Joelle van Dyne <j@getutm.app> Message-id: 20250224184123.50780-1-j@getutm.app [PMM: Drop an unnecessary check on 'len'; expand commit message] Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
1 parent fd20767 commit 12c3653

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

target/arm/hvf/hvf.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1983,6 +1983,7 @@ int hvf_vcpu_exec(CPUState *cpu)
19831983
bool isv = syndrome & ARM_EL_ISV;
19841984
bool iswrite = (syndrome >> 6) & 1;
19851985
bool s1ptw = (syndrome >> 7) & 1;
1986+
bool sse = (syndrome >> 21) & 1;
19861987
uint32_t sas = (syndrome >> 22) & 3;
19871988
uint32_t len = 1 << sas;
19881989
uint32_t srt = (syndrome >> 16) & 0x1f;
@@ -2010,6 +2011,9 @@ int hvf_vcpu_exec(CPUState *cpu)
20102011
address_space_read(&address_space_memory,
20112012
hvf_exit->exception.physical_address,
20122013
MEMTXATTRS_UNSPECIFIED, &val, len);
2014+
if (sse) {
2015+
val = sextract64(val, 0, len * 8);
2016+
}
20132017
hvf_set_reg(cpu, srt, val);
20142018
}
20152019

0 commit comments

Comments
 (0)