XamAlloc/XamFree. Fixes #153.
This commit is contained in:
parent
dbe9b25a65
commit
585e0b0e46
|
@ -100,6 +100,33 @@ SHIM_CALL XamLoaderTerminateTitle_shim(PPCContext* ppc_state,
|
|||
assert_always();
|
||||
}
|
||||
|
||||
SHIM_CALL XamAlloc_shim(PPCContext* ppc_state, KernelState* state) {
|
||||
uint32_t unk = SHIM_GET_ARG_32(0);
|
||||
uint32_t size = SHIM_GET_ARG_32(1);
|
||||
uint32_t out_ptr = SHIM_GET_ARG_32(2);
|
||||
|
||||
XELOGD("XamAlloc(%d, %d, %.8X)", unk, size, out_ptr);
|
||||
|
||||
assert_true(unk == 0);
|
||||
|
||||
// Allocate from the heap. Not sure why XAM does this specially, perhaps
|
||||
// it keeps stuff in a separate heap?
|
||||
uint64_t ptr = state->memory()->HeapAlloc(0, size, MEMORY_FLAG_ZERO);
|
||||
SHIM_SET_MEM_32(out_ptr, uint32_t(ptr));
|
||||
|
||||
SHIM_SET_RETURN_32(X_ERROR_SUCCESS);
|
||||
}
|
||||
|
||||
SHIM_CALL XamFree_shim(PPCContext* ppc_state, KernelState* state) {
|
||||
uint32_t ptr = SHIM_GET_ARG_32(0);
|
||||
|
||||
XELOGD("XamFree(%.8X)", ptr);
|
||||
|
||||
state->memory()->HeapFree(ptr, 0);
|
||||
|
||||
SHIM_SET_RETURN_32(X_ERROR_SUCCESS);
|
||||
}
|
||||
|
||||
SHIM_CALL XamEnumerate_shim(PPCContext* ppc_state, KernelState* state) {
|
||||
uint32_t handle = SHIM_GET_ARG_32(0);
|
||||
uint32_t zero = SHIM_GET_ARG_32(1);
|
||||
|
@ -154,5 +181,8 @@ void xe::kernel::xam::RegisterInfoExports(ExportResolver* export_resolver,
|
|||
SHIM_SET_MAPPING("xam.xex", XamLoaderLaunchTitle, state);
|
||||
SHIM_SET_MAPPING("xam.xex", XamLoaderTerminateTitle, state);
|
||||
|
||||
SHIM_SET_MAPPING("xam.xex", XamAlloc, state);
|
||||
SHIM_SET_MAPPING("xam.xex", XamFree, state);
|
||||
|
||||
SHIM_SET_MAPPING("xam.xex", XamEnumerate, state);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue