On 07/10/2025 04.10, Philippe Mathieu-Daudé wrote:
Break the loop and return an error if address_space_rw() ever failed.
Signed-off-by: Philippe Mathieu-Daudé <[email protected]>
---
Based-on: <[email protected]>
---
target/s390x/mmu_helper.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/target/s390x/mmu_helper.c b/target/s390x/mmu_helper.c
index 7bcf1810bca..643141e7847 100644
--- a/target/s390x/mmu_helper.c
+++ b/target/s390x/mmu_helper.c
@@ -544,12 +544,18 @@ int s390_cpu_virt_mem_rw(S390CPU *cpu, vaddr laddr,
uint8_t ar, void *hostbuf,
trigger_access_exception(&cpu->env, ret, tec);
} else if (hostbuf != NULL) {
AddressSpace *as = CPU(cpu)->as;
+ MemTxResult res;
/* Copy data by stepping through the area page by page */
for (i = 0; i < nr_pages; i++) {
currlen = MIN(len, TARGET_PAGE_SIZE - (laddr % TARGET_PAGE_SIZE));
- address_space_rw(as, pages[i] | (laddr & ~TARGET_PAGE_MASK),
- MEMTXATTRS_UNSPECIFIED, hostbuf, currlen,
is_write);
+ res = address_space_rw(as, pages[i] | (laddr & ~TARGET_PAGE_MASK),
+ MEMTXATTRS_UNSPECIFIED, hostbuf, currlen,
+ is_write);
+ if (res != MEMTX_OK) {
+ ret = 1;
I think you'd need to call trigger_access_exception() here like it is done
when translate_pages() failed earlier in this function. And I think I'd
rather use ret = PGM_ADDRESSING in this case.
Thomas
+ break;
+ }
laddr += currlen;
hostbuf += currlen;
len -= currlen;