lh_PhysicalAllocCached replacement — redirects physical memory allocations to our native heap with proper alignment.
| 93 | // lh_PhysicalAllocCached replacement — redirects physical memory allocations |
| 94 | // to our native heap with proper alignment. |
| 95 | ppc_u32_result_t PhysicalAllocCached_entry(ppc_u32_t size, ppc_u32_t alignment) { |
| 96 | uint32_t sz = static_cast<uint32_t>(size); |
| 97 | uint32_t align = static_cast<uint32_t>(alignment); |
| 98 | if (align < 16) align = 16; |
| 99 | |
| 100 | void* ptr = mspace_memalign(g_mspace, align, sz); |
| 101 | if (!ptr) { |
| 102 | REXLOG_WARN("PhysicalAllocCached: mspace_memalign({}, {}) failed", align, sz); |
| 103 | return 0; |
| 104 | } |
| 105 | std::memset(ptr, 0, sz); |
| 106 | return HostToGuest(ptr); |
| 107 | } |
| 108 | |
| 109 | } // namespace |
| 110 |
nothing calls this directly
no test coverage detected