From f4540c27931d69c4f42bdc5f3c78395bdb3c27a7 Mon Sep 17 00:00:00 2001 From: Nekotekina Date: Tue, 21 Apr 2015 23:26:21 +0300 Subject: [PATCH] vm::null usage --- rpcs3/Emu/ARMv7/Modules/sceLibc.cpp | 2 +- rpcs3/Emu/SysCalls/Modules.h | 2 +- rpcs3/Emu/SysCalls/Modules/cellFiber.cpp | 2 +- rpcs3/Emu/SysCalls/Modules/cellGcmSys.cpp | 6 +-- rpcs3/Emu/SysCalls/Modules/cellPngDec.cpp | 16 ++++---- rpcs3/Emu/SysCalls/Modules/cellResc.cpp | 12 +++--- rpcs3/Emu/SysCalls/Modules/cellSpurs.cpp | 40 ++++++++++---------- rpcs3/Emu/SysCalls/Modules/cellSync.cpp | 12 +++--- rpcs3/Emu/SysCalls/Modules/sysPrxForUser.cpp | 2 +- rpcs3/Emu/SysCalls/Modules/sys_net.cpp | 4 +- rpcs3/Loader/ELF32.cpp | 2 +- 11 files changed, 50 insertions(+), 50 deletions(-) diff --git a/rpcs3/Emu/ARMv7/Modules/sceLibc.cpp b/rpcs3/Emu/ARMv7/Modules/sceLibc.cpp index 98fab490a0..0a8e2aa70d 100644 --- a/rpcs3/Emu/ARMv7/Modules/sceLibc.cpp +++ b/rpcs3/Emu/ARMv7/Modules/sceLibc.cpp @@ -258,7 +258,7 @@ namespace sce_libc_func psv_log_base sceLibc("SceLibc", []() { - g_dso.set(0); + g_dso = vm::null; g_atexit.clear(); sceLibc.on_load = nullptr; diff --git a/rpcs3/Emu/SysCalls/Modules.h b/rpcs3/Emu/SysCalls/Modules.h index 49d7b51322..bc1ffe66d4 100644 --- a/rpcs3/Emu/SysCalls/Modules.h +++ b/rpcs3/Emu/SysCalls/Modules.h @@ -33,7 +33,7 @@ struct ModuleFunc { } - ModuleFunc(u32 id, u32 flags, Module* module, const char* name, ppu_func_caller func, vm::ptr lle_func = vm::ptr::make(0)) + ModuleFunc(u32 id, u32 flags, Module* module, const char* name, ppu_func_caller func, vm::ptr lle_func = vm::null) : id(id) , flags(flags) , module(module) diff --git a/rpcs3/Emu/SysCalls/Modules/cellFiber.cpp b/rpcs3/Emu/SysCalls/Modules/cellFiber.cpp index 632f4b56aa..5b51c39312 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellFiber.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellFiber.cpp @@ -84,7 +84,7 @@ vm::ptr cellFiberPpuSelf() cellFiber.Log("cellFiberPpuSelf() -> nullptr"); // TODO // returns fiber structure (zero for simple PPU thread) - return vm::ptr::make(0); + return vm::null; } int cellFiberPpuSendSignal() diff --git a/rpcs3/Emu/SysCalls/Modules/cellGcmSys.cpp b/rpcs3/Emu/SysCalls/Modules/cellGcmSys.cpp index e3ff78e0f4..3541d12839 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellGcmSys.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellGcmSys.cpp @@ -86,7 +86,7 @@ vm::ptr cellGcmGetReportDataAddressLocation(u32 index, u32 lo if (location == CELL_GCM_LOCATION_LOCAL) { if (index >= 2048) { cellGcmSys.Error("cellGcmGetReportDataAddressLocation: Wrong local index (%d)", index); - return vm::ptr::make(0); + return vm::null; } return vm::ptr::make((u32)Memory.RSXFBMem.GetStartAddr() + index * 0x10); } @@ -94,14 +94,14 @@ vm::ptr cellGcmGetReportDataAddressLocation(u32 index, u32 lo if (location == CELL_GCM_LOCATION_MAIN) { if (index >= 1024 * 1024) { cellGcmSys.Error("cellGcmGetReportDataAddressLocation: Wrong main index (%d)", index); - return vm::ptr::make(0); + return vm::null; } // TODO: It seems m_report_main_addr is not initialized return vm::ptr::make(Emu.GetGSManager().GetRender().m_report_main_addr + index * 0x10); } cellGcmSys.Error("cellGcmGetReportDataAddressLocation: Wrong location (%d)", location); - return vm::ptr::make(0); + return vm::null; } u64 cellGcmGetTimeStamp(u32 index) diff --git a/rpcs3/Emu/SysCalls/Modules/cellPngDec.cpp b/rpcs3/Emu/SysCalls/Modules/cellPngDec.cpp index 9177e5b5ff..4f5ece6bfb 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellPngDec.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellPngDec.cpp @@ -20,7 +20,7 @@ extern Module cellPngDec; s32 pngDecCreate( vm::ptr mainHandle, vm::ptr param, - vm::ptr ext = vm::ptr::make(0)) + vm::ptr ext = vm::null) { // alloc memory (should probably use param->cbCtrlMallocFunc) auto dec = CellPngDecMainHandle::make(Memory.Alloc(sizeof(PngDecoder), 128)); @@ -61,8 +61,8 @@ s32 pngDecOpen( vm::ptr subHandle, vm::ptr src, vm::ptr openInfo, - vm::ptr cb = vm::ptr::make(0), - vm::ptr param = vm::ptr::make(0)) + vm::ptr cb = vm::null, + vm::ptr param = vm::null) { // alloc memory (should probably use dec->malloc) auto stream = CellPngDecSubHandle::make(Memory.Alloc(sizeof(PngStream), 128)); @@ -128,7 +128,7 @@ s32 pngDecClose(CellPngDecSubHandle stream) s32 pngReadHeader( CellPngDecSubHandle stream, vm::ptr info, - vm::ptr extInfo = vm::ptr::make(0)) + vm::ptr extInfo = vm::null) { CellPngDecInfo& current_info = stream->info; @@ -194,8 +194,8 @@ s32 pngDecSetParameter( CellPngDecSubHandle stream, vm::ptr inParam, vm::ptr outParam, - vm::ptr extInParam = vm::ptr::make(0), - vm::ptr extOutParam = vm::ptr::make(0)) + vm::ptr extInParam = vm::null, + vm::ptr extOutParam = vm::null) { CellPngDecInfo& current_info = stream->info; CellPngDecOutParam& current_outParam = stream->outParam; @@ -240,8 +240,8 @@ s32 pngDecodeData( vm::ptr data, vm::ptr dataCtrlParam, vm::ptr dataOutInfo, - vm::ptr cbCtrlDisp = vm::ptr::make(0), - vm::ptr dispParam = vm::ptr::make(0)) + vm::ptr cbCtrlDisp = vm::null, + vm::ptr dispParam = vm::null) { dataOutInfo->status = CELL_PNGDEC_DEC_STATUS_STOP; diff --git a/rpcs3/Emu/SysCalls/Modules/cellResc.cpp b/rpcs3/Emu/SysCalls/Modules/cellResc.cpp index c280f9374f..3cda3208f7 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellResc.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellResc.cpp @@ -603,7 +603,7 @@ void cellRescExit() if (IsPalTemporal()) { cellGcmSetSecondVFrequency(CELL_GCM_DISPLAY_FREQUENCY_DISABLE); - cellGcmSetVBlankHandler(vm::ptr::make(0)); + cellGcmSetVBlankHandler(vm::null); //GcmSysTypePrefix::cellGcmSetSecondVHandler(NULL); if (IsPalInterpolate()) @@ -770,7 +770,7 @@ int cellRescSetDisplayMode(u32 displayMode) videocfg->aspect = CELL_VIDEO_OUT_ASPECT_AUTO; videocfg->pitch = s_rescInternalInstance->m_dstPitch; - cellVideoOutConfigure(CELL_VIDEO_OUT_PRIMARY, videocfg, vm::ptr::make(0), 0); + cellVideoOutConfigure(CELL_VIDEO_OUT_PRIMARY, videocfg, vm::null, 0); if (IsPalInterpolate()) { @@ -780,20 +780,20 @@ int cellRescSetDisplayMode(u32 displayMode) cellGcmSetSecondVFrequency(CELL_GCM_DISPLAY_FREQUENCY_59_94HZ); //cellGcmSetVBlankHandler(IntrHandler50); //cellGcmSetSecondVHandler(IntrHandler60); - cellGcmSetFlipHandler(vm::ptr::make(0)); + cellGcmSetFlipHandler(vm::null); } else if (IsPalDrop()) { //InitLabels(); cellGcmSetSecondVFrequency(CELL_GCM_DISPLAY_FREQUENCY_59_94HZ); - cellGcmSetVBlankHandler(vm::ptr::make(0)); + cellGcmSetVBlankHandler(vm::null); //cellGcmSetSecondVHandler(IntrHandler60Drop); - cellGcmSetFlipHandler(vm::ptr::make(0)); + cellGcmSetFlipHandler(vm::null); } else if (IsPal60Hsync()) { cellGcmSetSecondVFrequency(CELL_GCM_DISPLAY_FREQUENCY_59_94HZ); - cellGcmSetVBlankHandler(vm::ptr::make(0)); + cellGcmSetVBlankHandler(vm::null); } if (s_rescInternalInstance->s_applicationVBlankHandler) SetVBlankHandler(s_rescInternalInstance->s_applicationVBlankHandler); diff --git a/rpcs3/Emu/SysCalls/Modules/cellSpurs.cpp b/rpcs3/Emu/SysCalls/Modules/cellSpurs.cpp index ffaf28c635..ec58d7034b 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellSpurs.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellSpurs.cpp @@ -306,7 +306,7 @@ s32 spursInit( { assert(!"sys_spu_thread_group_start() failed"); } - if (s32 res = sys_spu_thread_group_join(spurs->m.spuTG, vm::ptr::make(0), vm::ptr::make(0))) + if (s32 res = sys_spu_thread_group_join(spurs->m.spuTG, vm::null, vm::null)) { if (res == CELL_ESTAT) { @@ -1051,10 +1051,10 @@ s32 cellSpursAddWorkload( *priorityTable, minContention, maxContention, - vm::ptr::make(0), - vm::ptr::make(0), - vm::ptr::make(0), - vm::ptr::make(0)); + vm::null, + vm::null, + vm::null, + vm::null); } s32 _cellSpursWorkloadAttributeInitialize( @@ -1160,16 +1160,16 @@ s32 cellSpursAddWorkloadWithAttribute(vm::ptr spurs, const vm::ptr::make(attr->m.pm.addr()), + attr->m.pm, attr->m.size, attr->m.data, attr->m.priority, attr->m.minContention, attr->m.maxContention, - vm::ptr::make(attr->m.nameClass.addr()), - vm::ptr::make(attr->m.nameInstance.addr()), - vm::ptr::make(attr->m.hook.addr()), - vm::ptr::make(attr->m.hookArg.addr())); + attr->m.nameClass, + attr->m.nameInstance, + attr->m.hook, + attr->m.hookArg); } s32 cellSpursRemoveWorkload() @@ -2183,14 +2183,14 @@ s32 spursCreateTaskset(vm::ptr spurs, vm::ptr tasks taskset.addr(), priority, 8 /*min_contention*/, max_contention); // TODO: Check return code - cellSpursWorkloadAttributeSetName(wkl_attr, vm::ptr::make(0), name); + cellSpursWorkloadAttributeSetName(wkl_attr, vm::null, name); // TODO: Check return code // TODO: cellSpursWorkloadAttributeSetShutdownCompletionEventHook(wkl_attr, hook, taskset); // TODO: Check return code vm::var> wid; - cellSpursAddWorkloadWithAttribute(spurs, vm::ptr::make(wid.addr()), vm::ptr::make(wkl_attr.addr())); + cellSpursAddWorkloadWithAttribute(spurs, vm::ptr::make(wid.addr()), wkl_attr); // TODO: Check return code taskset->m.wkl_flag_wait_task = 0x80; @@ -2236,7 +2236,7 @@ s32 cellSpursCreateTaskset(vm::ptr spurs, vm::ptr t cellSpurs.Warning("cellSpursCreateTaskset(spurs_addr=0x%x, taskset_addr=0x%x, args=0x%llx, priority_addr=0x%x, maxContention=%d)", spurs.addr(), taskset.addr(), args, priority.addr(), maxContention); - return spursCreateTaskset(spurs, taskset, args, priority, maxContention, vm::ptr::make(0), 6400/*CellSpursTaskset::size*/, 0); + return spursCreateTaskset(spurs, taskset, args, priority, maxContention, vm::null, 6400/*CellSpursTaskset::size*/, 0); } s32 cellSpursJoinTaskset(vm::ptr taskset) @@ -2396,8 +2396,8 @@ s32 spursTaskStart(vm::ptr taskset, u32 taskId) pendingReady._bit[taskId] = true; taskset->m.pending_ready = pendingReady; - cellSpursSendWorkloadSignal(vm::ptr::make((u32)taskset->m.spurs.addr()), taskset->m.wid); - auto rc = cellSpursWakeUp(GetCurrentPPUThread(), vm::ptr::make((u32)taskset->m.spurs.addr())); + cellSpursSendWorkloadSignal(taskset->m.spurs, taskset->m.wid); + auto rc = cellSpursWakeUp(GetCurrentPPUThread(), taskset->m.spurs); if (rc != CELL_OK) { if (rc == CELL_SPURS_POLICY_MODULE_ERROR_STAT) @@ -2479,8 +2479,8 @@ s32 _cellSpursSendSignal(vm::ptr taskset, u32 taskId) taskset->m.signalled = signalled; if (shouldSignal) { - cellSpursSendWorkloadSignal(vm::ptr::make((u32)taskset->m.spurs.addr()), taskset->m.wid); - auto rc = cellSpursWakeUp(GetCurrentPPUThread(), vm::ptr::make((u32)taskset->m.spurs.addr())); + cellSpursSendWorkloadSignal(taskset->m.spurs, taskset->m.wid); + auto rc = cellSpursWakeUp(GetCurrentPPUThread(), taskset->m.spurs); if (rc == CELL_SPURS_POLICY_MODULE_ERROR_STAT) { return CELL_SPURS_TASK_ERROR_STAT; @@ -2566,7 +2566,7 @@ s32 _cellSpursTasksetAttribute2Initialize(vm::ptr at memset(attribute.get_ptr(), 0, CellSpursTasksetAttribute2::size); attribute->m.revision = revision; - attribute->m.name.set(0); + attribute->m.name = vm::null; attribute->m.args = 0; for (s32 i = 0; i < 8; i++) @@ -2666,7 +2666,7 @@ s32 cellSpursCreateTaskset2(vm::ptr spurs, vm::ptr auto rc = spursCreateTaskset(spurs, vm::ptr::make(taskset.addr()), attr->m.args, vm::ptr::make(attr.addr() + offsetof(CellSpursTasksetAttribute, m.priority)), - attr->m.max_contention, vm::ptr::make(attr->m.name.addr()), CellSpursTaskset2::size, (u8)attr->m.enable_clear_ls); + attr->m.max_contention, attr->m.name, CellSpursTaskset2::size, (u8)attr->m.enable_clear_ls); if (rc != CELL_OK) { return rc; @@ -2774,7 +2774,7 @@ s32 cellSpursLookUpTasksetAddress(vm::ptr spurs, vm::ptr> data; - auto rc = cellSpursGetWorkloadData(spurs, vm::ptr::make(data.addr()), id); + auto rc = cellSpursGetWorkloadData(spurs, data, id); if (rc != CELL_OK) { // Convert policy module error code to a task error code diff --git a/rpcs3/Emu/SysCalls/Modules/cellSync.cpp b/rpcs3/Emu/SysCalls/Modules/cellSync.cpp index d9d57da787..ad0fed3b11 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellSync.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellSync.cpp @@ -289,7 +289,7 @@ s32 syncRwmInitialize(vm::ptr rwm, vm::ptr buffer, u32 buffer } // prx: zeroize first u16 and second u16, write buffer_size in second u32, write buffer_addr in second u64 and sync - rwm->m_size = be_t::make(buffer_size); + rwm->m_size = buffer_size; rwm->m_buffer = buffer; rwm->data.exchange({}); @@ -488,9 +488,9 @@ s32 syncQueueInitialize(vm::ptr queue, vm::ptr buffer, u32 si } // prx: zeroize first u64, write size in third u32, write depth in fourth u32, write address in third u64 and sync - queue->m_size = be_t::make(size); - queue->m_depth = be_t::make(depth); - queue->m_buffer.set(buffer.addr()); + queue->m_size = size; + queue->m_depth = depth; + queue->m_buffer = buffer; queue->data.exchange({}); return CELL_OK; @@ -1104,7 +1104,7 @@ s32 syncLFQueueGetPushPointer(vm::ptr queue, s32& pointer, u32 } } - if (s32 res = sys_event_queue_receive(GetCurrentPPUThread(), queue->m_eq_id, vm::ptr::make(0), 0)) + if (s32 res = sys_event_queue_receive(GetCurrentPPUThread(), queue->m_eq_id, vm::null, 0)) { assert(!"sys_event_queue_receive() failed"); } @@ -1448,7 +1448,7 @@ s32 syncLFQueueGetPopPointer(vm::ptr queue, s32& pointer, u32 i } } - if (s32 res = sys_event_queue_receive(GetCurrentPPUThread(), queue->m_eq_id, vm::ptr::make(0), 0)) + if (s32 res = sys_event_queue_receive(GetCurrentPPUThread(), queue->m_eq_id, vm::null, 0)) { assert(!"sys_event_queue_receive() failed"); } diff --git a/rpcs3/Emu/SysCalls/Modules/sysPrxForUser.cpp b/rpcs3/Emu/SysCalls/Modules/sysPrxForUser.cpp index ec4f0a568e..b0d5761d15 100644 --- a/rpcs3/Emu/SysCalls/Modules/sysPrxForUser.cpp +++ b/rpcs3/Emu/SysCalls/Modules/sysPrxForUser.cpp @@ -1019,7 +1019,7 @@ vm::ptr _sys_strncpy(vm::ptr dest, vm::ptr source, u32 l if (!dest || !source) { - return vm::ptr::make(0); + return vm::null; } if (strncpy(dest.get_ptr(), source.get_ptr(), len) != dest.get_ptr()) diff --git a/rpcs3/Emu/SysCalls/Modules/sys_net.cpp b/rpcs3/Emu/SysCalls/Modules/sys_net.cpp index fe69ad6560..4dcfe97863 100644 --- a/rpcs3/Emu/SysCalls/Modules/sys_net.cpp +++ b/rpcs3/Emu/SysCalls/Modules/sys_net.cpp @@ -19,7 +19,7 @@ extern "C" extern Module sys_net; -vm::ptr g_lastError = vm::ptr::make(0); +vm::ptr g_lastError = vm::null; // Auxiliary Functions @@ -478,7 +478,7 @@ s32 sys_net_finalize_network() { sys_net.Warning("sys_net_initialize_network_ex()"); Memory.Free(g_lastError.addr()); - g_lastError = vm::ptr::make(0); + g_lastError = vm::null; #ifdef _WIN32 WSACleanup(); #endif diff --git a/rpcs3/Loader/ELF32.cpp b/rpcs3/Loader/ELF32.cpp index 58d990c33e..0135b3a0a5 100644 --- a/rpcs3/Loader/ELF32.cpp +++ b/rpcs3/Loader/ELF32.cpp @@ -144,7 +144,7 @@ namespace loader u32 vnid_addr = 0; std::unordered_map vnid_list; - auto proc_param = vm::psv::ptr::make(0); + vm::psv::ptr proc_param = vm::null; for (auto& shdr : m_shdrs) {