| 407 | } |
| 408 | |
| 409 | static void _anon_page_write(struct rt_varea *varea, struct rt_aspace_io_msg *iomsg) |
| 410 | { |
| 411 | rt_aspace_t from_aspace = varea->aspace; |
| 412 | rt_aspace_t backup = _anon_obj_get_backup(varea->mem_obj); |
| 413 | |
| 414 | if (from_aspace != backup) |
| 415 | { |
| 416 | /* varea in guest aspace cannot modify the page */ |
| 417 | iomsg->response.status = MM_FAULT_STATUS_UNRECOVERABLE; |
| 418 | } |
| 419 | else if (rt_hw_mmu_v2p(from_aspace, iomsg->fault_vaddr) == ARCH_MAP_FAILED) |
| 420 | { |
| 421 | struct rt_aspace_fault_msg msg; |
| 422 | msg.fault_op = MM_FAULT_OP_WRITE; |
| 423 | msg.fault_type = MM_FAULT_TYPE_PAGE_FAULT; |
| 424 | msg.fault_vaddr = iomsg->fault_vaddr; |
| 425 | msg.off = iomsg->off; |
| 426 | rt_mm_fault_res_init(&msg.response); |
| 427 | |
| 428 | _fetch_page_for_varea(varea, &msg, RT_TRUE); |
| 429 | if (msg.response.status == MM_FAULT_STATUS_OK_MAPPED) |
| 430 | { |
| 431 | write_by_mte(backup, iomsg); |
| 432 | } |
| 433 | else |
| 434 | { |
| 435 | /* mapping failed, report an error */ |
| 436 | iomsg->response.status = MM_FAULT_STATUS_UNRECOVERABLE; |
| 437 | } |
| 438 | } |
| 439 | else |
| 440 | { |
| 441 | write_by_mte(backup, iomsg); |
| 442 | } |
| 443 | } |
| 444 | |
| 445 | static struct rt_private_ctx _priv_obj = { |
| 446 | .mem_obj.get_name = _anon_get_name, |
nothing calls this directly
no test coverage detected