Various sys_ fixes

This commit is contained in:
RipleyTom 2026-02-25 00:58:09 +01:00 committed by Elad
parent 260c986186
commit 064c006339
6 changed files with 9 additions and 6 deletions

View File

@ -59,6 +59,7 @@ CellError lv2_cond::on_id_create()
if (!mutex)
{
_mutex = static_cast<shared_ptr<lv2_obj>>(ensure(idm::get_unlocked<lv2_obj, lv2_mutex>(mtx_id)));
mutex = static_cast<lv2_mutex*>(_mutex.get());
}
// Defer function

View File

@ -621,7 +621,7 @@ error_code sys_event_port_create(cpu_thread& cpu, vm::ptr<u32> eport_id, s32 por
sys_event.warning("sys_event_port_create(eport_id=*0x%x, port_type=%d, name=0x%llx)", eport_id, port_type, name);
if (port_type != SYS_EVENT_PORT_LOCAL && port_type != 3)
if (port_type != SYS_EVENT_PORT_LOCAL && port_type != SYS_EVENT_PORT_IPC)
{
sys_event.error("sys_event_port_create(): unknown port type (%d)", port_type);
return CELL_EINVAL;
@ -675,8 +675,9 @@ error_code sys_event_port_connect_local(cpu_thread& cpu, u32 eport_id, u32 equeu
std::lock_guard lock(id_manager::g_mutex);
const auto port = idm::check_unlocked<lv2_obj, lv2_event_port>(eport_id);
auto queue = idm::get_unlocked<lv2_obj, lv2_event_queue>(equeue_id);
if (!port || !idm::check_unlocked<lv2_obj, lv2_event_queue>(equeue_id))
if (!port || !queue)
{
return CELL_ESRCH;
}
@ -691,7 +692,7 @@ error_code sys_event_port_connect_local(cpu_thread& cpu, u32 eport_id, u32 equeu
return CELL_EISCONN;
}
port->queue = idm::get_unlocked<lv2_obj, lv2_event_queue>(equeue_id);
port->queue = std::move(queue);
return CELL_OK;
}

View File

@ -7,7 +7,6 @@
#include <deque>
class cpu_thread;
class spu_thrread;
// Event Queue Type
enum : u32

View File

@ -487,6 +487,8 @@ error_code _sys_lwcond_queue_wait(ppu_thread& ppu, u32 lwcond_id, u32 lwmutex_id
{
ensure(cond.unqueue(cond.sq, &ppu));
ppu.state += cpu_flag::again;
cond.lwmutex_waiters--;
mutex->lwcond_waiters--;
return;
}

View File

@ -85,7 +85,7 @@ error_code sys_mutex_create(ppu_thread& ppu, vm::ptr<u32> mutex_id, vm::ptr<sys_
sys_mutex.todo("sys_mutex_create(): unexpected adaptive (0x%x)", _attr.adaptive);
}
if (auto error = lv2_obj::create<lv2_mutex>(_attr.pshared, _attr.ipc_key, _attr.flags, [&]()
if (auto error = lv2_obj::create<lv2_mutex>(_attr.pshared, ipc_key, _attr.flags, [&]()
{
return make_shared<lv2_mutex>(
_attr.protocol,

View File

@ -437,7 +437,7 @@ struct spu_limits_t
raw_spu_count += spu_thread::g_raw_spu_ctr;
// physical_spus_count >= spu_limit returns EBUSY, not EINVAL!
if (spu_limit + raw_limit > 6 || raw_spu_count > raw_limit || physical_spus_count >= spu_limit || physical_spus_count > spu_limit || controllable_spu_count > spu_limit)
if (spu_limit + raw_limit > 6 || raw_spu_count > raw_limit || physical_spus_count >= spu_limit || controllable_spu_count > spu_limit)
{
return false;
}