target/s390x/mmu_helper: Do not ignore address_space_rw() errors
PATCH 1/1 target/s390x/mmu_helper: Do not ignore address_space_rw() errors
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(-)
target/s390x/mmu_helper.c +8 -2
@@ -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 ; +break ; + } laddr += currlen; hostbuf += currlen; len -= currlen;
Signature · 1 line
2.51.0
Quoted 19 lines · Philippe Mathieu-Daudé
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(-)target/s390x/mmu_helper.c +1
-0@@ -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;
target/s390x/mmu_helper.c int s390_cpu_virt_mem_rw(S390CPU *cpu, vaddr laddr, uint8_t ar, void *hostbuf, · line 556
Quoted 10 lines
target/s390x/mmu_helper.c +5
-2/* 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
Quoted 5 lines
target/s390x/mmu_helper.c +2
-0+break ; + } laddr += currlen; hostbuf += currlen; len -= currlen;