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

Function cellSyncLFQueueInitialize

ps3fw/cellSync.cpp:767–875  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

765}
766
767error_code cellSyncLFQueueInitialize(vm::ptr<CellSyncLFQueue> queue, vm::cptr<void> buffer, u32 size, u32 depth, u32 direction, vm::ptr<void> eaSignal)
768{
769 cellSync.warning("cellSyncLFQueueInitialize(queue=*0x%x, buffer=*0x%x, size=0x%x, depth=0x%x, direction=%d, eaSignal=*0x%x)", queue, buffer, size, depth, direction, eaSignal);
770
771 if (!queue) [[unlikely]]
772 {
773 return CELL_SYNC_ERROR_NULL_POINTER;
774 }
775
776 if (size)
777 {
778 if (!buffer) [[unlikely]]
779 {
780 return CELL_SYNC_ERROR_NULL_POINTER;
781 }
782
783 if (size > 0x4000 || size % 16) [[unlikely]]
784 {
785 return CELL_SYNC_ERROR_INVAL;
786 }
787 }
788
789 if (!depth || depth > 0x7fff || direction > 3) [[unlikely]]
790 {
791 return CELL_SYNC_ERROR_INVAL;
792 }
793
794 if (!queue.aligned() || !buffer.aligned(16)) [[unlikely]]
795 {
796 return CELL_SYNC_ERROR_ALIGN;
797 }
798
799 // get sdk version of current process
800 s32 sdk_ver;
801
802 if (s32 ret = process_get_sdk_version(process_getpid(), sdk_ver))
803 {
804 return not_an_error(ret);
805 }
806
807 if (sdk_ver == -1)
808 {
809 sdk_ver = 0x460000;
810 }
811
812 // reserve `init`
813 u32 old_value;
814
815 while (true)
816 {
817 const auto old = queue->init.load();
818 auto init = old;
819
820 if (old)
821 {
822 if (sdk_ver > 0x17ffff && old != 2) [[unlikely]]
823 {
824 return CELL_SYNC_ERROR_STAT;

Callers 1

Calls 9

process_get_sdk_versionFunction · 0.85
process_getpidFunction · 0.85
atomic_fence_acq_relFunction · 0.85
syncLFQueueInitializeFunction · 0.85
alignedMethod · 0.80
loadMethod · 0.45
addrMethod · 0.45
compare_and_swap_testMethod · 0.45
exchangeMethod · 0.45

Tested by

no test coverage detected