mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-03 21:41:26 +12:00
Rename vm::reservation_light_op -> light_op
Rename vm::reservation_peek_op -> peek_op Also remove overkill assertion for cpu_flag::temp.
This commit is contained in:
parent
2cee26c3e7
commit
ba26e16411
4 changed files with 29 additions and 30 deletions
|
@ -671,7 +671,6 @@ bool cpu_thread::check_state() noexcept
|
||||||
}
|
}
|
||||||
|
|
||||||
verify(HERE), cpu_can_stop || !retval;
|
verify(HERE), cpu_can_stop || !retval;
|
||||||
verify(HERE), cpu_can_stop || Emu.IsStopped() || !(state & cpu_flag::wait);
|
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1749,7 +1749,7 @@ s32 cellSpursSetMaxContention(vm::ptr<CellSpurs> spurs, u32 wid, u32 maxContenti
|
||||||
maxContention = CELL_SPURS_MAX_SPU;
|
maxContention = CELL_SPURS_MAX_SPU;
|
||||||
}
|
}
|
||||||
|
|
||||||
vm::reservation_light_op(spurs->wklMaxContention[wid % CELL_SPURS_MAX_WORKLOAD], [&](atomic_t<u8>& value)
|
vm::light_op(spurs->wklMaxContention[wid % CELL_SPURS_MAX_WORKLOAD], [&](atomic_t<u8>& value)
|
||||||
{
|
{
|
||||||
value &= wid < CELL_SPURS_MAX_WORKLOAD ? 0xF0 : 0x0F;
|
value &= wid < CELL_SPURS_MAX_WORKLOAD ? 0xF0 : 0x0F;
|
||||||
value |= wid < CELL_SPURS_MAX_WORKLOAD ? maxContention : maxContention << 4;
|
value |= wid < CELL_SPURS_MAX_WORKLOAD ? maxContention : maxContention << 4;
|
||||||
|
@ -1801,9 +1801,9 @@ s32 cellSpursSetPriorities(vm::ptr<CellSpurs> spurs, u32 wid, vm::cptr<u8[8]> pr
|
||||||
return CELL_SPURS_CORE_ERROR_INVAL;
|
return CELL_SPURS_CORE_ERROR_INVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
vm::reservation_light_op(spurs->wklInfo(wid).prio64, [&](atomic_t<u64>& v){ v.release(prio); });
|
vm::light_op(spurs->wklInfo(wid).prio64, [&](atomic_t<u64>& v){ v.release(prio); });
|
||||||
vm::reservation_light_op(spurs->sysSrvMsgUpdateWorkload, [](atomic_t<u8>& v){ v.release(0xff); });
|
vm::light_op(spurs->sysSrvMsgUpdateWorkload, [](atomic_t<u8>& v){ v.release(0xff); });
|
||||||
vm::reservation_light_op(spurs->sysSrvMessage, [](atomic_t<u8>& v){ v.release(0xff); });
|
vm::light_op(spurs->sysSrvMessage, [](atomic_t<u8>& v){ v.release(0xff); });
|
||||||
return CELL_OK;
|
return CELL_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1830,9 +1830,9 @@ s32 cellSpursSetPriority(vm::ptr<CellSpurs> spurs, u32 wid, u32 spuId, u32 prior
|
||||||
if (spurs->exception)
|
if (spurs->exception)
|
||||||
return CELL_SPURS_CORE_ERROR_STAT;
|
return CELL_SPURS_CORE_ERROR_STAT;
|
||||||
|
|
||||||
vm::reservation_light_op(spurs->wklInfo(wid).priority[spuId], [&](u8& v){ atomic_storage<u8>::release(v, priority); });
|
vm::light_op(spurs->wklInfo(wid).priority[spuId], [&](u8& v){ atomic_storage<u8>::release(v, priority); });
|
||||||
vm::reservation_light_op(spurs->sysSrvMsgUpdateWorkload, [&](atomic_t<u8>& v){ v.bts(spuId); });
|
vm::light_op(spurs->sysSrvMsgUpdateWorkload, [&](atomic_t<u8>& v){ v.bts(spuId); });
|
||||||
vm::reservation_light_op(spurs->sysSrvMessage, [&](atomic_t<u8>& v){ v.bts(spuId); });
|
vm::light_op(spurs->sysSrvMessage, [&](atomic_t<u8>& v){ v.bts(spuId); });
|
||||||
return CELL_OK;
|
return CELL_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2319,7 +2319,7 @@ s32 _spurs::add_workload(vm::ptr<CellSpurs> spurs, vm::ptr<u32> wid, vm::cptr<vo
|
||||||
|
|
||||||
u32 wnum;
|
u32 wnum;
|
||||||
const u32 wmax = spurs->flags1 & SF1_32_WORKLOADS ? CELL_SPURS_MAX_WORKLOAD2 : CELL_SPURS_MAX_WORKLOAD; // TODO: check if can be changed
|
const u32 wmax = spurs->flags1 & SF1_32_WORKLOADS ? CELL_SPURS_MAX_WORKLOAD2 : CELL_SPURS_MAX_WORKLOAD; // TODO: check if can be changed
|
||||||
vm::reservation_light_op(spurs->wklEnabled, [&](atomic_be_t<u32>& value)
|
vm::light_op(spurs->wklEnabled, [&](atomic_be_t<u32>& value)
|
||||||
{
|
{
|
||||||
wnum = std::countl_one<u32>(value); // found empty position
|
wnum = std::countl_one<u32>(value); // found empty position
|
||||||
if (wnum < wmax)
|
if (wnum < wmax)
|
||||||
|
@ -2402,7 +2402,7 @@ s32 _spurs::add_workload(vm::ptr<CellSpurs> spurs, vm::ptr<u32> wid, vm::cptr<vo
|
||||||
spurs->wklIdleSpuCountOrReadyCount2[wnum] = 0;
|
spurs->wklIdleSpuCountOrReadyCount2[wnum] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
vm::reservation_light_op(spurs->wklMaxContention[index], [&](atomic_t<u8>& data)
|
vm::light_op(spurs->wklMaxContention[index], [&](atomic_t<u8>& data)
|
||||||
{
|
{
|
||||||
data.atomic_op([&](u8& v)
|
data.atomic_op([&](u8& v)
|
||||||
{
|
{
|
||||||
|
@ -2411,7 +2411,7 @@ s32 _spurs::add_workload(vm::ptr<CellSpurs> spurs, vm::ptr<u32> wid, vm::cptr<vo
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
vm::reservation_light_op<true>((wnum <= 15 ? spurs->wklSignal1 : spurs->wklSignal2), [&](atomic_be_t<u16>& data)
|
vm::light_op<true>((wnum <= 15 ? spurs->wklSignal1 : spurs->wklSignal2), [&](atomic_be_t<u16>& data)
|
||||||
{
|
{
|
||||||
data &= ~(0x8000 >> index);
|
data &= ~(0x8000 >> index);
|
||||||
});
|
});
|
||||||
|
@ -2450,8 +2450,8 @@ s32 _spurs::add_workload(vm::ptr<CellSpurs> spurs, vm::ptr<u32> wid, vm::cptr<vo
|
||||||
});
|
});
|
||||||
|
|
||||||
verify(HERE), (res_wkl <= 31);
|
verify(HERE), (res_wkl <= 31);
|
||||||
vm::reservation_light_op(spurs->sysSrvMsgUpdateWorkload, [](atomic_t<u8>& v){ v.release(0xff); });
|
vm::light_op(spurs->sysSrvMsgUpdateWorkload, [](atomic_t<u8>& v){ v.release(0xff); });
|
||||||
vm::reservation_light_op(spurs->sysSrvMessage, [](atomic_t<u8>& v){ v.release(0xff); });
|
vm::light_op(spurs->sysSrvMessage, [](atomic_t<u8>& v){ v.release(0xff); });
|
||||||
return CELL_OK;
|
return CELL_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2545,7 +2545,7 @@ s32 cellSpursShutdownWorkload(ppu_thread& ppu, vm::ptr<CellSpurs> spurs, u32 wid
|
||||||
|
|
||||||
if (old_state == SPURS_WKL_STATE_SHUTTING_DOWN)
|
if (old_state == SPURS_WKL_STATE_SHUTTING_DOWN)
|
||||||
{
|
{
|
||||||
vm::reservation_light_op(spurs->sysSrvMessage, [&](atomic_t<u8>& v){ v.release(0xff); });
|
vm::light_op(spurs->sysSrvMessage, [&](atomic_t<u8>& v){ v.release(0xff); });
|
||||||
return CELL_OK;
|
return CELL_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2579,7 +2579,7 @@ s32 cellSpursWaitForWorkloadShutdown(ppu_thread& ppu, vm::ptr<CellSpurs> spurs,
|
||||||
|
|
||||||
auto& info = spurs->wklSyncInfo(wid);
|
auto& info = spurs->wklSyncInfo(wid);
|
||||||
|
|
||||||
const bool ok = vm::reservation_light_op(info.x28, [](atomic_be_t<u32>& state)
|
const bool ok = vm::light_op(info.x28, [](atomic_be_t<u32>& state)
|
||||||
{
|
{
|
||||||
return state.fetch_op([](be_t<u32>& val)
|
return state.fetch_op([](be_t<u32>& val)
|
||||||
{
|
{
|
||||||
|
@ -2598,7 +2598,7 @@ s32 cellSpursWaitForWorkloadShutdown(ppu_thread& ppu, vm::ptr<CellSpurs> spurs,
|
||||||
return CELL_SPURS_POLICY_MODULE_ERROR_STAT;
|
return CELL_SPURS_POLICY_MODULE_ERROR_STAT;
|
||||||
}
|
}
|
||||||
|
|
||||||
const bool wait_sema = vm::reservation_light_op<true>(spurs->wklEvent(wid), [](atomic_t<u8>& event)
|
const bool wait_sema = vm::light_op<true>(spurs->wklEvent(wid), [](atomic_t<u8>& event)
|
||||||
{
|
{
|
||||||
return event.fetch_op([](u8& event)
|
return event.fetch_op([](u8& event)
|
||||||
{
|
{
|
||||||
|
@ -2750,7 +2750,7 @@ s32 cellSpursSendWorkloadSignal(ppu_thread& ppu, vm::ptr<CellSpurs> spurs, u32 w
|
||||||
return CELL_SPURS_POLICY_MODULE_ERROR_STAT;
|
return CELL_SPURS_POLICY_MODULE_ERROR_STAT;
|
||||||
}
|
}
|
||||||
|
|
||||||
vm::reservation_light_op<true>(wid < CELL_SPURS_MAX_WORKLOAD ? spurs->wklSignal1 : spurs->wklSignal2, [&](atomic_be_t<u16>& sig)
|
vm::light_op<true>(wid < CELL_SPURS_MAX_WORKLOAD ? spurs->wklSignal1 : spurs->wklSignal2, [&](atomic_be_t<u16>& sig)
|
||||||
{
|
{
|
||||||
sig |= 0x8000 >> (wid % 16);
|
sig |= 0x8000 >> (wid % 16);
|
||||||
});
|
});
|
||||||
|
@ -2807,7 +2807,7 @@ s32 cellSpursReadyCountStore(ppu_thread& ppu, vm::ptr<CellSpurs> spurs, u32 wid,
|
||||||
return CELL_SPURS_POLICY_MODULE_ERROR_STAT;
|
return CELL_SPURS_POLICY_MODULE_ERROR_STAT;
|
||||||
}
|
}
|
||||||
|
|
||||||
vm::reservation_light_op(spurs->readyCount(wid), [&](atomic_t<u8>& v)
|
vm::light_op(spurs->readyCount(wid), [&](atomic_t<u8>& v)
|
||||||
{
|
{
|
||||||
v.release(static_cast<u8>(value));
|
v.release(static_cast<u8>(value));
|
||||||
});
|
});
|
||||||
|
@ -2845,7 +2845,7 @@ s32 cellSpursReadyCountSwap(ppu_thread& ppu, vm::ptr<CellSpurs> spurs, u32 wid,
|
||||||
return CELL_SPURS_POLICY_MODULE_ERROR_STAT;
|
return CELL_SPURS_POLICY_MODULE_ERROR_STAT;
|
||||||
}
|
}
|
||||||
|
|
||||||
*old = vm::reservation_light_op(spurs->readyCount(wid), [&](atomic_t<u8>& v)
|
*old = vm::light_op(spurs->readyCount(wid), [&](atomic_t<u8>& v)
|
||||||
{
|
{
|
||||||
return v.exchange(static_cast<u8>(swap));
|
return v.exchange(static_cast<u8>(swap));
|
||||||
});
|
});
|
||||||
|
@ -2885,7 +2885,7 @@ s32 cellSpursReadyCountCompareAndSwap(ppu_thread& ppu, vm::ptr<CellSpurs> spurs,
|
||||||
|
|
||||||
u8 temp = static_cast<u8>(compare);
|
u8 temp = static_cast<u8>(compare);
|
||||||
|
|
||||||
vm::reservation_light_op(spurs->readyCount(wid), [&](atomic_t<u8>& v)
|
vm::light_op(spurs->readyCount(wid), [&](atomic_t<u8>& v)
|
||||||
{
|
{
|
||||||
v.compare_exchange(temp, static_cast<u8>(swap));
|
v.compare_exchange(temp, static_cast<u8>(swap));
|
||||||
});
|
});
|
||||||
|
@ -2924,7 +2924,7 @@ s32 cellSpursReadyCountAdd(ppu_thread& ppu, vm::ptr<CellSpurs> spurs, u32 wid, v
|
||||||
return CELL_SPURS_POLICY_MODULE_ERROR_STAT;
|
return CELL_SPURS_POLICY_MODULE_ERROR_STAT;
|
||||||
}
|
}
|
||||||
|
|
||||||
*old = vm::reservation_light_op(spurs->readyCount(wid), [&](atomic_t<u8>& v)
|
*old = vm::light_op(spurs->readyCount(wid), [&](atomic_t<u8>& v)
|
||||||
{
|
{
|
||||||
return v.fetch_op([&](u8& val)
|
return v.fetch_op([&](u8& val)
|
||||||
{
|
{
|
||||||
|
@ -3960,7 +3960,7 @@ s32 _spurs::create_task(vm::ptr<CellSpursTaskset> taskset, vm::ptr<u32> task_id,
|
||||||
|
|
||||||
u32 tmp_task_id;
|
u32 tmp_task_id;
|
||||||
|
|
||||||
vm::reservation_light_op(vm::_ref<atomic_be_t<v128>>(taskset.ptr(&CellSpursTaskset::enabled).addr()), [&](atomic_be_t<v128>& ptr)
|
vm::light_op(vm::_ref<atomic_be_t<v128>>(taskset.ptr(&CellSpursTaskset::enabled).addr()), [&](atomic_be_t<v128>& ptr)
|
||||||
{
|
{
|
||||||
// NOTE: Realfw processes this using 4 32-bits atomic loops
|
// NOTE: Realfw processes this using 4 32-bits atomic loops
|
||||||
// But here its processed within a single 128-bit atomic op
|
// But here its processed within a single 128-bit atomic op
|
||||||
|
@ -4008,7 +4008,7 @@ s32 _spurs::create_task(vm::ptr<CellSpursTaskset> taskset, vm::ptr<u32> task_id,
|
||||||
|
|
||||||
s32 _spurs::task_start(ppu_thread& ppu, vm::ptr<CellSpursTaskset> taskset, u32 taskId)
|
s32 _spurs::task_start(ppu_thread& ppu, vm::ptr<CellSpursTaskset> taskset, u32 taskId)
|
||||||
{
|
{
|
||||||
vm::reservation_light_op(taskset->pending_ready, [&](CellSpursTaskset::atomic_tasks_bitset& v)
|
vm::light_op(taskset->pending_ready, [&](CellSpursTaskset::atomic_tasks_bitset& v)
|
||||||
{
|
{
|
||||||
v.values[taskId / 32] |= (1u << 31) >> (taskId % 32);
|
v.values[taskId / 32] |= (1u << 31) >> (taskId % 32);
|
||||||
});
|
});
|
||||||
|
@ -4831,7 +4831,7 @@ s32 cellSpursGetJobChainInfo(ppu_thread& ppu, vm::ptr<CellSpursJobChain> jobChai
|
||||||
|
|
||||||
// Read the commands queue atomically
|
// Read the commands queue atomically
|
||||||
CellSpursJobChain data;
|
CellSpursJobChain data;
|
||||||
vm::reservation_peek(ppu, vm::unsafe_ptr_cast<CellSpursJobChain_x00>(jobChain), [&](const CellSpursJobChain_x00& jch)
|
vm::peek_op(ppu, vm::unsafe_ptr_cast<CellSpursJobChain_x00>(jobChain), [&](const CellSpursJobChain_x00& jch)
|
||||||
{
|
{
|
||||||
std::memcpy(&data, &jch, sizeof(jch));
|
std::memcpy(&data, &jch, sizeof(jch));
|
||||||
});
|
});
|
||||||
|
@ -5020,7 +5020,7 @@ s32 cellSpursJobGuardReset(vm::ptr<CellSpursJobGuard> jobGuard)
|
||||||
if (!jobGuard.aligned())
|
if (!jobGuard.aligned())
|
||||||
return CELL_SPURS_JOB_ERROR_ALIGN;
|
return CELL_SPURS_JOB_ERROR_ALIGN;
|
||||||
|
|
||||||
vm::reservation_light_op(jobGuard->ncount0, [&](atomic_be_t<u32>& ncount0)
|
vm::light_op(jobGuard->ncount0, [&](atomic_be_t<u32>& ncount0)
|
||||||
{
|
{
|
||||||
ncount0 = jobGuard->ncount1;
|
ncount0 = jobGuard->ncount1;
|
||||||
});
|
});
|
||||||
|
@ -5107,7 +5107,7 @@ s32 cellSpursJobSetMaxGrab(vm::ptr<CellSpursJobChain> jobChain, u32 maxGrabbedJo
|
||||||
if ((spurs->wklEnabled & (0x80000000u >> wid)) == 0u)
|
if ((spurs->wklEnabled & (0x80000000u >> wid)) == 0u)
|
||||||
return CELL_SPURS_JOB_ERROR_STAT;
|
return CELL_SPURS_JOB_ERROR_STAT;
|
||||||
|
|
||||||
vm::reservation_light_op(jobChain->maxGrabbedJob, [&](atomic_be_t<u16>& v)
|
vm::light_op(jobChain->maxGrabbedJob, [&](atomic_be_t<u16>& v)
|
||||||
{
|
{
|
||||||
v.release(static_cast<u16>(maxGrabbedJob));
|
v.release(static_cast<u16>(maxGrabbedJob));
|
||||||
});
|
});
|
||||||
|
|
|
@ -1603,7 +1603,7 @@ s32 spursTasksetProcessRequest(spu_thread& spu, s32 request, u32* taskId, u32* i
|
||||||
{
|
{
|
||||||
auto spurs = kernelCtxt->spurs;
|
auto spurs = kernelCtxt->spurs;
|
||||||
|
|
||||||
vm::reservation_light_op(spurs->readyCount(kernelCtxt->wklCurrentId), [&](atomic_t<u8>& val)
|
vm::light_op(spurs->readyCount(kernelCtxt->wklCurrentId), [&](atomic_t<u8>& val)
|
||||||
{
|
{
|
||||||
val.fetch_op([&](u8& val)
|
val.fetch_op([&](u8& val)
|
||||||
{
|
{
|
||||||
|
|
|
@ -309,10 +309,10 @@ namespace vm
|
||||||
|
|
||||||
// Read memory value in pseudo-atomic manner
|
// Read memory value in pseudo-atomic manner
|
||||||
template <typename CPU, typename T, typename AT = u32, typename F>
|
template <typename CPU, typename T, typename AT = u32, typename F>
|
||||||
SAFE_BUFFERS inline auto reservation_peek(CPU&& cpu, _ptr_base<T, AT> ptr, F op)
|
SAFE_BUFFERS inline auto peek_op(CPU&& cpu, _ptr_base<T, AT> ptr, F op)
|
||||||
{
|
{
|
||||||
// Atomic operation will be performed on aligned 128 bytes of data, so the data size and alignment must comply
|
// Atomic operation will be performed on aligned 128 bytes of data, so the data size and alignment must comply
|
||||||
static_assert(sizeof(T) <= 128 && alignof(T) == sizeof(T), "vm::reservation_peek: unsupported type");
|
static_assert(sizeof(T) <= 128 && alignof(T) == sizeof(T), "vm::peek_op: unsupported type");
|
||||||
|
|
||||||
// Use 128-byte aligned addr
|
// Use 128-byte aligned addr
|
||||||
const u32 addr = static_cast<u32>(ptr.addr()) & -128;
|
const u32 addr = static_cast<u32>(ptr.addr()) & -128;
|
||||||
|
@ -357,7 +357,7 @@ namespace vm
|
||||||
}
|
}
|
||||||
|
|
||||||
template <bool Ack = false, typename T, typename F>
|
template <bool Ack = false, typename T, typename F>
|
||||||
SAFE_BUFFERS inline auto reservation_light_op(T& data, F op)
|
SAFE_BUFFERS inline auto light_op(T& data, F op)
|
||||||
{
|
{
|
||||||
// Optimized real ptr -> vm ptr conversion, simply UB if out of range
|
// Optimized real ptr -> vm ptr conversion, simply UB if out of range
|
||||||
const u32 addr = static_cast<u32>(reinterpret_cast<const u8*>(&data) - g_base_addr);
|
const u32 addr = static_cast<u32>(reinterpret_cast<const u8*>(&data) - g_base_addr);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue