| 1717 | } |
| 1718 | |
| 1719 | rt_err_t rt_aspace_page_put_phy(rt_aspace_t aspace, void *page_va, void *buffer) |
| 1720 | { |
| 1721 | rt_err_t rc = -RT_ERROR; |
| 1722 | |
| 1723 | char *frame_ka = rt_hw_mmu_v2p(aspace, page_va); |
| 1724 | if (frame_ka != ARCH_MAP_FAILED) |
| 1725 | { |
| 1726 | frame_ka = rt_kmem_p2v(frame_ka); |
| 1727 | if (frame_ka) |
| 1728 | { |
| 1729 | rt_memcpy(frame_ka, buffer, ARCH_PAGE_SIZE); |
| 1730 | rc = RT_EOK; |
| 1731 | } |
| 1732 | else if (aspace == _current_uspace() || aspace == &rt_kernel_space) |
| 1733 | { |
| 1734 | /* direct IO */ |
| 1735 | rt_memcpy(page_va, buffer, ARCH_PAGE_SIZE); |
| 1736 | rc = RT_EOK; |
| 1737 | } |
| 1738 | else |
| 1739 | { |
| 1740 | /* user memory region remap ? */ |
| 1741 | LOG_W("%s(aspace=0x%lx,va=%p): Operation not support", |
| 1742 | __func__, aspace, page_va); |
| 1743 | rc = -RT_ENOSYS; |
| 1744 | } |
| 1745 | } |
| 1746 | else |
| 1747 | { |
| 1748 | LOG_W("%s(aspace=0x%lx,va=%p): PTE not existed", |
| 1749 | __func__, aspace, page_va); |
| 1750 | rc = -RT_ENOENT; |
| 1751 | } |
| 1752 | |
| 1753 | return rc; |
| 1754 | } |
| 1755 | |
| 1756 | rt_err_t rt_aspace_page_put(rt_aspace_t aspace, void *page_va, void *buffer) |
| 1757 | { |
no test coverage detected