MCPcopy Create free account
hub / github.com/Fable2Recomp/Fable2Recomp / PhysicalAllocCached_entry

Function PhysicalAllocCached_entry

src/heap.cpp:95–107  ·  view source on GitHub ↗

lh_PhysicalAllocCached replacement — redirects physical memory allocations to our native heap with proper alignment.

Source from the content-addressed store, hash-verified

93// lh_PhysicalAllocCached replacement — redirects physical memory allocations
94// to our native heap with proper alignment.
95ppc_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

Callers

nothing calls this directly

Calls 1

HostToGuestFunction · 0.85

Tested by

no test coverage detected