/* Copy data by stepping through the area page by page */
for (i = 0; i < nr_pages; i++) {
+ MemTxResult res;
+
currlen = MIN(len, TARGET_PAGE_SIZE - (laddr % TARGET_PAGE_SIZE));
- address_space_rw(as, pages[i] | (laddr & ~TARGET_PAGE_MASK),
- attrs, hostbuf, currlen, is_write);
+ res = address_space_rw(as, pages[i] | (laddr & ~TARGET_PAGE_MASK),
+ attrs, hostbuf, currlen, is_write);
+ if (res != MEMTX_OK) {
+ ret = PGM_ADDRESSING;
+ break;
+ }
laddr += currlen;
hostbuf += currlen;
len -= currlen;