memory.cpp 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572
  1. // Copyright 2015 Citra Emulator Project
  2. // Licensed under GPLv2 or any later version
  3. // Refer to the license.txt file included.
  4. #include <algorithm>
  5. #include <array>
  6. #include <cstring>
  7. #include <utility>
  8. #include <boost/optional.hpp>
  9. #include "common/assert.h"
  10. #include "common/common_types.h"
  11. #include "common/logging/log.h"
  12. #include "common/swap.h"
  13. #include "core/arm/arm_interface.h"
  14. #include "core/core.h"
  15. #include "core/hle/kernel/process.h"
  16. #include "core/hle/lock.h"
  17. #include "core/memory.h"
  18. #include "core/memory_setup.h"
  19. #include "video_core/renderer_base.h"
  20. #include "video_core/video_core.h"
  21. namespace Memory {
  22. static PageTable* current_page_table = nullptr;
  23. void SetCurrentPageTable(PageTable* page_table) {
  24. current_page_table = page_table;
  25. auto& system = Core::System::GetInstance();
  26. if (system.IsPoweredOn()) {
  27. system.ArmInterface(0).PageTableChanged();
  28. system.ArmInterface(1).PageTableChanged();
  29. system.ArmInterface(2).PageTableChanged();
  30. system.ArmInterface(3).PageTableChanged();
  31. }
  32. }
  33. PageTable* GetCurrentPageTable() {
  34. return current_page_table;
  35. }
  36. static void MapPages(PageTable& page_table, VAddr base, u64 size, u8* memory, PageType type) {
  37. LOG_DEBUG(HW_Memory, "Mapping {} onto {:016X}-{:016X}", fmt::ptr(memory), base * PAGE_SIZE,
  38. (base + size) * PAGE_SIZE);
  39. RasterizerFlushVirtualRegion(base << PAGE_BITS, size * PAGE_SIZE,
  40. FlushMode::FlushAndInvalidate);
  41. VAddr end = base + size;
  42. while (base != end) {
  43. ASSERT_MSG(base < PAGE_TABLE_NUM_ENTRIES, "out of range mapping at {:016X}", base);
  44. page_table.attributes[base] = type;
  45. page_table.pointers[base] = memory;
  46. base += 1;
  47. if (memory != nullptr)
  48. memory += PAGE_SIZE;
  49. }
  50. }
  51. void MapMemoryRegion(PageTable& page_table, VAddr base, u64 size, u8* target) {
  52. ASSERT_MSG((size & PAGE_MASK) == 0, "non-page aligned size: {:016X}", size);
  53. ASSERT_MSG((base & PAGE_MASK) == 0, "non-page aligned base: {:016X}", base);
  54. MapPages(page_table, base / PAGE_SIZE, size / PAGE_SIZE, target, PageType::Memory);
  55. }
  56. void MapIoRegion(PageTable& page_table, VAddr base, u64 size, MemoryHookPointer mmio_handler) {
  57. ASSERT_MSG((size & PAGE_MASK) == 0, "non-page aligned size: {:016X}", size);
  58. ASSERT_MSG((base & PAGE_MASK) == 0, "non-page aligned base: {:016X}", base);
  59. MapPages(page_table, base / PAGE_SIZE, size / PAGE_SIZE, nullptr, PageType::Special);
  60. auto interval = boost::icl::discrete_interval<VAddr>::closed(base, base + size - 1);
  61. SpecialRegion region{SpecialRegion::Type::IODevice, std::move(mmio_handler)};
  62. page_table.special_regions.add(std::make_pair(interval, std::set<SpecialRegion>{region}));
  63. }
  64. void UnmapRegion(PageTable& page_table, VAddr base, u64 size) {
  65. ASSERT_MSG((size & PAGE_MASK) == 0, "non-page aligned size: {:016X}", size);
  66. ASSERT_MSG((base & PAGE_MASK) == 0, "non-page aligned base: {:016X}", base);
  67. MapPages(page_table, base / PAGE_SIZE, size / PAGE_SIZE, nullptr, PageType::Unmapped);
  68. auto interval = boost::icl::discrete_interval<VAddr>::closed(base, base + size - 1);
  69. page_table.special_regions.erase(interval);
  70. }
  71. void AddDebugHook(PageTable& page_table, VAddr base, u64 size, MemoryHookPointer hook) {
  72. auto interval = boost::icl::discrete_interval<VAddr>::closed(base, base + size - 1);
  73. SpecialRegion region{SpecialRegion::Type::DebugHook, std::move(hook)};
  74. page_table.special_regions.add(std::make_pair(interval, std::set<SpecialRegion>{region}));
  75. }
  76. void RemoveDebugHook(PageTable& page_table, VAddr base, u64 size, MemoryHookPointer hook) {
  77. auto interval = boost::icl::discrete_interval<VAddr>::closed(base, base + size - 1);
  78. SpecialRegion region{SpecialRegion::Type::DebugHook, std::move(hook)};
  79. page_table.special_regions.subtract(std::make_pair(interval, std::set<SpecialRegion>{region}));
  80. }
  81. /**
  82. * Gets a pointer to the exact memory at the virtual address (i.e. not page aligned)
  83. * using a VMA from the current process
  84. */
  85. static u8* GetPointerFromVMA(const Kernel::Process& process, VAddr vaddr) {
  86. u8* direct_pointer = nullptr;
  87. auto& vm_manager = process.vm_manager;
  88. auto it = vm_manager.FindVMA(vaddr);
  89. ASSERT(it != vm_manager.vma_map.end());
  90. auto& vma = it->second;
  91. switch (vma.type) {
  92. case Kernel::VMAType::AllocatedMemoryBlock:
  93. direct_pointer = vma.backing_block->data() + vma.offset;
  94. break;
  95. case Kernel::VMAType::BackingMemory:
  96. direct_pointer = vma.backing_memory;
  97. break;
  98. case Kernel::VMAType::Free:
  99. return nullptr;
  100. default:
  101. UNREACHABLE();
  102. }
  103. return direct_pointer + (vaddr - vma.base);
  104. }
  105. /**
  106. * Gets a pointer to the exact memory at the virtual address (i.e. not page aligned)
  107. * using a VMA from the current process.
  108. */
  109. static u8* GetPointerFromVMA(VAddr vaddr) {
  110. return GetPointerFromVMA(*Core::CurrentProcess(), vaddr);
  111. }
  112. template <typename T>
  113. T Read(const VAddr vaddr) {
  114. const u8* page_pointer = current_page_table->pointers[vaddr >> PAGE_BITS];
  115. if (page_pointer) {
  116. // NOTE: Avoid adding any extra logic to this fast-path block
  117. T value;
  118. std::memcpy(&value, &page_pointer[vaddr & PAGE_MASK], sizeof(T));
  119. return value;
  120. }
  121. // The memory access might do an MMIO or cached access, so we have to lock the HLE kernel state
  122. std::lock_guard<std::recursive_mutex> lock(HLE::g_hle_lock);
  123. PageType type = current_page_table->attributes[vaddr >> PAGE_BITS];
  124. switch (type) {
  125. case PageType::Unmapped:
  126. LOG_ERROR(HW_Memory, "Unmapped Read{} @ 0x{:08X}", sizeof(T) * 8, vaddr);
  127. return 0;
  128. case PageType::Memory:
  129. ASSERT_MSG(false, "Mapped memory page without a pointer @ {:016X}", vaddr);
  130. break;
  131. case PageType::RasterizerCachedMemory: {
  132. RasterizerFlushVirtualRegion(vaddr, sizeof(T), FlushMode::Flush);
  133. T value;
  134. std::memcpy(&value, GetPointerFromVMA(vaddr), sizeof(T));
  135. return value;
  136. }
  137. default:
  138. UNREACHABLE();
  139. }
  140. }
  141. template <typename T>
  142. void Write(const VAddr vaddr, const T data) {
  143. u8* page_pointer = current_page_table->pointers[vaddr >> PAGE_BITS];
  144. if (page_pointer) {
  145. // NOTE: Avoid adding any extra logic to this fast-path block
  146. std::memcpy(&page_pointer[vaddr & PAGE_MASK], &data, sizeof(T));
  147. return;
  148. }
  149. // The memory access might do an MMIO or cached access, so we have to lock the HLE kernel state
  150. std::lock_guard<std::recursive_mutex> lock(HLE::g_hle_lock);
  151. PageType type = current_page_table->attributes[vaddr >> PAGE_BITS];
  152. switch (type) {
  153. case PageType::Unmapped:
  154. LOG_ERROR(HW_Memory, "Unmapped Write{} 0x{:08X} @ 0x{:016X}", sizeof(data) * 8,
  155. static_cast<u32>(data), vaddr);
  156. return;
  157. case PageType::Memory:
  158. ASSERT_MSG(false, "Mapped memory page without a pointer @ {:016X}", vaddr);
  159. break;
  160. case PageType::RasterizerCachedMemory: {
  161. RasterizerFlushVirtualRegion(vaddr, sizeof(T), FlushMode::Invalidate);
  162. std::memcpy(GetPointerFromVMA(vaddr), &data, sizeof(T));
  163. break;
  164. }
  165. default:
  166. UNREACHABLE();
  167. }
  168. }
  169. bool IsValidVirtualAddress(const Kernel::Process& process, const VAddr vaddr) {
  170. auto& page_table = process.vm_manager.page_table;
  171. const u8* page_pointer = page_table.pointers[vaddr >> PAGE_BITS];
  172. if (page_pointer)
  173. return true;
  174. if (page_table.attributes[vaddr >> PAGE_BITS] == PageType::RasterizerCachedMemory)
  175. return true;
  176. if (page_table.attributes[vaddr >> PAGE_BITS] != PageType::Special)
  177. return false;
  178. return false;
  179. }
  180. bool IsValidVirtualAddress(const VAddr vaddr) {
  181. return IsValidVirtualAddress(*Core::CurrentProcess(), vaddr);
  182. }
  183. bool IsKernelVirtualAddress(const VAddr vaddr) {
  184. return KERNEL_REGION_VADDR <= vaddr && vaddr < KERNEL_REGION_END;
  185. }
  186. u8* GetPointer(const VAddr vaddr) {
  187. u8* page_pointer = current_page_table->pointers[vaddr >> PAGE_BITS];
  188. if (page_pointer) {
  189. return page_pointer + (vaddr & PAGE_MASK);
  190. }
  191. if (current_page_table->attributes[vaddr >> PAGE_BITS] == PageType::RasterizerCachedMemory) {
  192. return GetPointerFromVMA(vaddr);
  193. }
  194. LOG_ERROR(HW_Memory, "Unknown GetPointer @ 0x{:016X}", vaddr);
  195. return nullptr;
  196. }
  197. std::string ReadCString(VAddr vaddr, std::size_t max_length) {
  198. std::string string;
  199. string.reserve(max_length);
  200. for (std::size_t i = 0; i < max_length; ++i) {
  201. char c = Read8(vaddr);
  202. if (c == '\0')
  203. break;
  204. string.push_back(c);
  205. ++vaddr;
  206. }
  207. string.shrink_to_fit();
  208. return string;
  209. }
  210. void RasterizerMarkRegionCached(VAddr vaddr, u64 size, bool cached) {
  211. if (vaddr == 0) {
  212. return;
  213. }
  214. // Iterate over a contiguous CPU address space, which corresponds to the specified GPU address
  215. // space, marking the region as un/cached. The region is marked un/cached at a granularity of
  216. // CPU pages, hence why we iterate on a CPU page basis (note: GPU page size is different). This
  217. // assumes the specified GPU address region is contiguous as well.
  218. u64 num_pages = ((vaddr + size - 1) >> PAGE_BITS) - (vaddr >> PAGE_BITS) + 1;
  219. for (unsigned i = 0; i < num_pages; ++i, vaddr += PAGE_SIZE) {
  220. PageType& page_type = current_page_table->attributes[vaddr >> PAGE_BITS];
  221. if (cached) {
  222. // Switch page type to cached if now cached
  223. switch (page_type) {
  224. case PageType::Unmapped:
  225. // It is not necessary for a process to have this region mapped into its address
  226. // space, for example, a system module need not have a VRAM mapping.
  227. break;
  228. case PageType::Memory:
  229. page_type = PageType::RasterizerCachedMemory;
  230. current_page_table->pointers[vaddr >> PAGE_BITS] = nullptr;
  231. break;
  232. case PageType::RasterizerCachedMemory:
  233. // There can be more than one GPU region mapped per CPU region, so it's common that
  234. // this area is already marked as cached.
  235. break;
  236. default:
  237. UNREACHABLE();
  238. }
  239. } else {
  240. // Switch page type to uncached if now uncached
  241. switch (page_type) {
  242. case PageType::Unmapped:
  243. // It is not necessary for a process to have this region mapped into its address
  244. // space, for example, a system module need not have a VRAM mapping.
  245. break;
  246. case PageType::Memory:
  247. // There can be more than one GPU region mapped per CPU region, so it's common that
  248. // this area is already unmarked as cached.
  249. break;
  250. case PageType::RasterizerCachedMemory: {
  251. u8* pointer = GetPointerFromVMA(vaddr & ~PAGE_MASK);
  252. if (pointer == nullptr) {
  253. // It's possible that this function has been called while updating the pagetable
  254. // after unmapping a VMA. In that case the underlying VMA will no longer exist,
  255. // and we should just leave the pagetable entry blank.
  256. page_type = PageType::Unmapped;
  257. } else {
  258. page_type = PageType::Memory;
  259. current_page_table->pointers[vaddr >> PAGE_BITS] = pointer;
  260. }
  261. break;
  262. }
  263. default:
  264. UNREACHABLE();
  265. }
  266. }
  267. }
  268. }
  269. void RasterizerFlushVirtualRegion(VAddr start, u64 size, FlushMode mode) {
  270. auto& system_instance = Core::System::GetInstance();
  271. // Since pages are unmapped on shutdown after video core is shutdown, the renderer may be
  272. // null here
  273. if (!system_instance.IsPoweredOn()) {
  274. return;
  275. }
  276. VAddr end = start + size;
  277. const auto CheckRegion = [&](VAddr region_start, VAddr region_end) {
  278. if (start >= region_end || end <= region_start) {
  279. // No overlap with region
  280. return;
  281. }
  282. const VAddr overlap_start = std::max(start, region_start);
  283. const VAddr overlap_end = std::min(end, region_end);
  284. const u64 overlap_size = overlap_end - overlap_start;
  285. auto& rasterizer = system_instance.Renderer().Rasterizer();
  286. switch (mode) {
  287. case FlushMode::Flush:
  288. rasterizer.FlushRegion(overlap_start, overlap_size);
  289. break;
  290. case FlushMode::Invalidate:
  291. rasterizer.InvalidateRegion(overlap_start, overlap_size);
  292. break;
  293. case FlushMode::FlushAndInvalidate:
  294. rasterizer.FlushAndInvalidateRegion(overlap_start, overlap_size);
  295. break;
  296. }
  297. };
  298. CheckRegion(PROCESS_IMAGE_VADDR, PROCESS_IMAGE_VADDR_END);
  299. CheckRegion(HEAP_VADDR, HEAP_VADDR_END);
  300. }
  301. u8 Read8(const VAddr addr) {
  302. return Read<u8>(addr);
  303. }
  304. u16 Read16(const VAddr addr) {
  305. return Read<u16_le>(addr);
  306. }
  307. u32 Read32(const VAddr addr) {
  308. return Read<u32_le>(addr);
  309. }
  310. u64 Read64(const VAddr addr) {
  311. return Read<u64_le>(addr);
  312. }
  313. void ReadBlock(const Kernel::Process& process, const VAddr src_addr, void* dest_buffer,
  314. const size_t size) {
  315. auto& page_table = process.vm_manager.page_table;
  316. size_t remaining_size = size;
  317. size_t page_index = src_addr >> PAGE_BITS;
  318. size_t page_offset = src_addr & PAGE_MASK;
  319. while (remaining_size > 0) {
  320. const size_t copy_amount =
  321. std::min(static_cast<size_t>(PAGE_SIZE) - page_offset, remaining_size);
  322. const VAddr current_vaddr = static_cast<VAddr>((page_index << PAGE_BITS) + page_offset);
  323. switch (page_table.attributes[page_index]) {
  324. case PageType::Unmapped: {
  325. LOG_ERROR(HW_Memory,
  326. "Unmapped ReadBlock @ 0x{:016X} (start address = 0x{:016X}, size = {})",
  327. current_vaddr, src_addr, size);
  328. std::memset(dest_buffer, 0, copy_amount);
  329. break;
  330. }
  331. case PageType::Memory: {
  332. DEBUG_ASSERT(page_table.pointers[page_index]);
  333. const u8* src_ptr = page_table.pointers[page_index] + page_offset;
  334. std::memcpy(dest_buffer, src_ptr, copy_amount);
  335. break;
  336. }
  337. case PageType::RasterizerCachedMemory: {
  338. RasterizerFlushVirtualRegion(current_vaddr, static_cast<u32>(copy_amount),
  339. FlushMode::Flush);
  340. std::memcpy(dest_buffer, GetPointerFromVMA(process, current_vaddr), copy_amount);
  341. break;
  342. }
  343. default:
  344. UNREACHABLE();
  345. }
  346. page_index++;
  347. page_offset = 0;
  348. dest_buffer = static_cast<u8*>(dest_buffer) + copy_amount;
  349. remaining_size -= copy_amount;
  350. }
  351. }
  352. void ReadBlock(const VAddr src_addr, void* dest_buffer, const size_t size) {
  353. ReadBlock(*Core::CurrentProcess(), src_addr, dest_buffer, size);
  354. }
  355. void Write8(const VAddr addr, const u8 data) {
  356. Write<u8>(addr, data);
  357. }
  358. void Write16(const VAddr addr, const u16 data) {
  359. Write<u16_le>(addr, data);
  360. }
  361. void Write32(const VAddr addr, const u32 data) {
  362. Write<u32_le>(addr, data);
  363. }
  364. void Write64(const VAddr addr, const u64 data) {
  365. Write<u64_le>(addr, data);
  366. }
  367. void WriteBlock(const Kernel::Process& process, const VAddr dest_addr, const void* src_buffer,
  368. const size_t size) {
  369. auto& page_table = process.vm_manager.page_table;
  370. size_t remaining_size = size;
  371. size_t page_index = dest_addr >> PAGE_BITS;
  372. size_t page_offset = dest_addr & PAGE_MASK;
  373. while (remaining_size > 0) {
  374. const size_t copy_amount =
  375. std::min(static_cast<size_t>(PAGE_SIZE) - page_offset, remaining_size);
  376. const VAddr current_vaddr = static_cast<VAddr>((page_index << PAGE_BITS) + page_offset);
  377. switch (page_table.attributes[page_index]) {
  378. case PageType::Unmapped: {
  379. LOG_ERROR(HW_Memory,
  380. "Unmapped WriteBlock @ 0x{:016X} (start address = 0x{:016X}, size = {})",
  381. current_vaddr, dest_addr, size);
  382. break;
  383. }
  384. case PageType::Memory: {
  385. DEBUG_ASSERT(page_table.pointers[page_index]);
  386. u8* dest_ptr = page_table.pointers[page_index] + page_offset;
  387. std::memcpy(dest_ptr, src_buffer, copy_amount);
  388. break;
  389. }
  390. case PageType::RasterizerCachedMemory: {
  391. RasterizerFlushVirtualRegion(current_vaddr, static_cast<u32>(copy_amount),
  392. FlushMode::Invalidate);
  393. std::memcpy(GetPointerFromVMA(process, current_vaddr), src_buffer, copy_amount);
  394. break;
  395. }
  396. default:
  397. UNREACHABLE();
  398. }
  399. page_index++;
  400. page_offset = 0;
  401. src_buffer = static_cast<const u8*>(src_buffer) + copy_amount;
  402. remaining_size -= copy_amount;
  403. }
  404. }
  405. void WriteBlock(const VAddr dest_addr, const void* src_buffer, const size_t size) {
  406. WriteBlock(*Core::CurrentProcess(), dest_addr, src_buffer, size);
  407. }
  408. void ZeroBlock(const Kernel::Process& process, const VAddr dest_addr, const size_t size) {
  409. auto& page_table = process.vm_manager.page_table;
  410. size_t remaining_size = size;
  411. size_t page_index = dest_addr >> PAGE_BITS;
  412. size_t page_offset = dest_addr & PAGE_MASK;
  413. while (remaining_size > 0) {
  414. const size_t copy_amount =
  415. std::min(static_cast<size_t>(PAGE_SIZE) - page_offset, remaining_size);
  416. const VAddr current_vaddr = static_cast<VAddr>((page_index << PAGE_BITS) + page_offset);
  417. switch (page_table.attributes[page_index]) {
  418. case PageType::Unmapped: {
  419. LOG_ERROR(HW_Memory,
  420. "Unmapped ZeroBlock @ 0x{:016X} (start address = 0x{:016X}, size = {})",
  421. current_vaddr, dest_addr, size);
  422. break;
  423. }
  424. case PageType::Memory: {
  425. DEBUG_ASSERT(page_table.pointers[page_index]);
  426. u8* dest_ptr = page_table.pointers[page_index] + page_offset;
  427. std::memset(dest_ptr, 0, copy_amount);
  428. break;
  429. }
  430. case PageType::RasterizerCachedMemory: {
  431. RasterizerFlushVirtualRegion(current_vaddr, static_cast<u32>(copy_amount),
  432. FlushMode::Invalidate);
  433. std::memset(GetPointerFromVMA(process, current_vaddr), 0, copy_amount);
  434. break;
  435. }
  436. default:
  437. UNREACHABLE();
  438. }
  439. page_index++;
  440. page_offset = 0;
  441. remaining_size -= copy_amount;
  442. }
  443. }
  444. void CopyBlock(const Kernel::Process& process, VAddr dest_addr, VAddr src_addr, const size_t size) {
  445. auto& page_table = process.vm_manager.page_table;
  446. size_t remaining_size = size;
  447. size_t page_index = src_addr >> PAGE_BITS;
  448. size_t page_offset = src_addr & PAGE_MASK;
  449. while (remaining_size > 0) {
  450. const size_t copy_amount =
  451. std::min(static_cast<size_t>(PAGE_SIZE) - page_offset, remaining_size);
  452. const VAddr current_vaddr = static_cast<VAddr>((page_index << PAGE_BITS) + page_offset);
  453. switch (page_table.attributes[page_index]) {
  454. case PageType::Unmapped: {
  455. LOG_ERROR(HW_Memory,
  456. "Unmapped CopyBlock @ 0x{:016X} (start address = 0x{:016X}, size = {})",
  457. current_vaddr, src_addr, size);
  458. ZeroBlock(process, dest_addr, copy_amount);
  459. break;
  460. }
  461. case PageType::Memory: {
  462. DEBUG_ASSERT(page_table.pointers[page_index]);
  463. const u8* src_ptr = page_table.pointers[page_index] + page_offset;
  464. WriteBlock(process, dest_addr, src_ptr, copy_amount);
  465. break;
  466. }
  467. case PageType::RasterizerCachedMemory: {
  468. RasterizerFlushVirtualRegion(current_vaddr, static_cast<u32>(copy_amount),
  469. FlushMode::Flush);
  470. WriteBlock(process, dest_addr, GetPointerFromVMA(process, current_vaddr), copy_amount);
  471. break;
  472. }
  473. default:
  474. UNREACHABLE();
  475. }
  476. page_index++;
  477. page_offset = 0;
  478. dest_addr += static_cast<VAddr>(copy_amount);
  479. src_addr += static_cast<VAddr>(copy_amount);
  480. remaining_size -= copy_amount;
  481. }
  482. }
  483. void CopyBlock(VAddr dest_addr, VAddr src_addr, size_t size) {
  484. CopyBlock(*Core::CurrentProcess(), dest_addr, src_addr, size);
  485. }
  486. } // namespace Memory