MCPcopy Create free account
hub / github.com/RPCSX/rpcsx / sys_mmapper_allocate_shared_memory_ext

Function sys_mmapper_allocate_shared_memory_ext

kernel/cellos/src/sys_mmapper.cpp:287–375  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

285}
286
287error_code sys_mmapper_allocate_shared_memory_ext(
288 ppu_thread &ppu, u64 ipc_key, u64 size, u32 flags,
289 vm::ptr<mmapper_unk_entry_struct0> entries, s32 entry_count,
290 vm::ptr<u32> mem_id) {
291 ppu.state += cpu_flag::wait;
292
293 sys_mmapper.todo(
294 "sys_mmapper_allocate_shared_memory_ext(ipc_key=0x%x, size=0x%x, "
295 "flags=0x%x, entries=*0x%x, entry_count=0x%x, mem_id=*0x%x)",
296 ipc_key, size, flags, entries, entry_count, mem_id);
297
298 if (size == 0) {
299 return CELL_EALIGN;
300 }
301
302 switch (flags & SYS_MEMORY_GRANULARITY_MASK) {
303 case SYS_MEMORY_GRANULARITY_1M:
304 case 0: {
305 if (size % 0x100000) {
306 return CELL_EALIGN;
307 }
308
309 break;
310 }
311 case SYS_MEMORY_GRANULARITY_64K: {
312 if (size % 0x10000) {
313 return CELL_EALIGN;
314 }
315
316 break;
317 }
318 default: {
319 return CELL_EINVAL;
320 }
321 }
322
323 if (flags & ~SYS_MEMORY_PAGE_SIZE_MASK) {
324 return CELL_EINVAL;
325 }
326
327 if (entry_count <= 0 || entry_count > 0x10) {
328 return CELL_EINVAL;
329 }
330
331 if constexpr (bool to_perm_check = false; true) {
332 for (s32 i = 0; i < entry_count; i++) {
333 const u64 type = entries[i].type;
334
335 // The whole structure contents are unknown
336 sys_mmapper.todo(
337 "sys_mmapper_allocate_shared_memory_ext(): entry type = 0x%x", type);
338
339 switch (type) {
340 case 0:
341 case 1:
342 case 3: {
343 break;
344 }

Callers

nothing calls this directly

Calls 2

debug_or_rootMethod · 0.80
check_stateMethod · 0.45

Tested by

no test coverage detected