Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion rpcs3/Emu/CPU/CPUThread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1373,7 +1373,7 @@ std::vector<std::pair<u32, u32>> cpu_thread::dump_callstack_list() const

std::string cpu_thread::dump_misc() const
{
return fmt::format("Type: %s; State: %s\n", get_class() == thread_class::ppu ? "PPU" : get_class() == thread_class::spu ? "SPU" : "RSX", state.load());
return fmt::format("%s[0x%x]; State: %s\n", get_class() == thread_class::ppu ? "PPU" : get_class() == thread_class::spu ? "SPU" : "RSX", id, state.load());
}

bool cpu_thread::suspend_work::push(cpu_thread* _this) noexcept
Expand Down
22 changes: 22 additions & 0 deletions rpcs3/Emu/Cell/lv2/lv2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2219,6 +2219,28 @@ void lv2_obj::prepare_for_sleep(cpu_thread& cpu)
cpu_counter::remove(&cpu);
}

ppu_thread* lv2_obj::get_running_ppu(u32 index)
{
usz thread_count = g_cfg.core.ppu_threads;

if (index >= thread_count)
{
return nullptr;
}

auto target = atomic_storage<ppu_thread*>::load(g_ppu);

for (usz cur = 0; target; target = atomic_storage<ppu_thread*>::load(target->next_ppu), cur++)
{
if (cur == index)
{
return target;
}
}

return nullptr;
}

void lv2_obj::notify_all() noexcept
{
for (auto cpu : g_to_notify)
Expand Down
30 changes: 28 additions & 2 deletions rpcs3/Emu/Cell/lv2/sys_memory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,18 @@ LOG_CHANNEL(sys_memory);
//
static shared_mutex s_memstats_mtx;

// This struct is for reduced logging repetition
struct last_reported_memory_stats
{
struct inner_body
{
u32 prev_total = umax;
u32 prev_avail = umax;
};

atomic_t<inner_body> body{};
};

lv2_memory_container::lv2_memory_container(u32 size, bool from_idm) noexcept
: size(size)
, id{from_idm ? idm::last_id() : SYS_MEMORY_CONTAINER_ID_INVALID}
Expand Down Expand Up @@ -313,8 +325,6 @@ error_code sys_memory_get_user_memory_size(cpu_thread& cpu, vm::ptr<sys_memory_i
{
cpu.state += cpu_flag::wait;

sys_memory.warning("sys_memory_get_user_memory_size(mem_info=*0x%x)", mem_info);

// Get "default" memory container
auto& dct = g_fxo->get<lv2_memory_container>();

Expand All @@ -332,6 +342,22 @@ error_code sys_memory_get_user_memory_size(cpu_thread& cpu, vm::ptr<sys_memory_i
});
}

typename last_reported_memory_stats::inner_body now;
now.prev_total = out.total_user_memory;
now.prev_avail = out.available_user_memory;

now = g_fxo->get<last_reported_memory_stats>().body.exchange(now);

if (now.prev_total != out.total_user_memory || now.prev_avail != out.available_user_memory)
{
// Log on change
sys_memory.warning("sys_memory_get_user_memory_size(mem_info=*0x%x): Avail=0x%x, Total=0x%x", mem_info, out.available_user_memory, out.total_user_memory);
}
else
{
sys_memory.trace("sys_memory_get_user_memory_size(mem_info=*0x%x): Avail=0x%x, Total=0x%x", mem_info, out.available_user_memory, out.total_user_memory);
}

cpu.check_state();
*mem_info = out;
return CELL_OK;
Expand Down
1 change: 1 addition & 0 deletions rpcs3/Emu/Cell/lv2/sys_sync.h
Original file line number Diff line number Diff line change
Expand Up @@ -453,6 +453,7 @@ struct lv2_obj

// Can be called before the actual sleep call in order to move it out of mutex scope
static void prepare_for_sleep(cpu_thread& cpu);
static ppu_thread* get_running_ppu(u32 index);

struct notify_all_t
{
Expand Down
13 changes: 11 additions & 2 deletions rpcs3/Emu/savestate_utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ struct serial_ver_t
std::set<u16> compatible_versions;
};

static std::array<serial_ver_t, 28> s_serial_versions;
static std::array<serial_ver_t, 34> s_serial_versions;

#define SERIALIZATION_VER(name, identifier, ...) \
\
Expand All @@ -40,7 +40,7 @@ static std::array<serial_ver_t, 28> s_serial_versions;
return ::s_serial_versions[identifier].current_version;\
}

SERIALIZATION_VER(global_version, 0, 19) // For stuff not listed here
SERIALIZATION_VER(global_version, 0, 20) // For stuff not listed here
SERIALIZATION_VER(ppu, 1, 1, 2/*PPU sleep order*/, 3/*PPU FNID and module*/)
SERIALIZATION_VER(spu, 2, 1)
SERIALIZATION_VER(lv2_sync, 3, 1)
Expand Down Expand Up @@ -87,6 +87,15 @@ SERIALIZATION_VER(HLE, 25, 1)
SERIALIZATION_VER(cellSysutil, 26, 1, 2/*AVC2 Muting,Volume*/)
SERIALIZATION_VER(cellDmuxPamf, 27, 1)

// For future modules
SERIALIZATION_VER(cellReserved1, 27, 1)
SERIALIZATION_VER(cellReserved2, 28, 1)
SERIALIZATION_VER(cellReserved3, 29, 1)
SERIALIZATION_VER(cellReserved4, 30, 1)
SERIALIZATION_VER(cellReserved6, 31, 1)
SERIALIZATION_VER(cellReserved7, 32, 1)
SERIALIZATION_VER(cellReserved8, 33, 1)

template <>
void fmt_class_string<std::remove_cvref_t<decltype(s_serial_versions)>>::format(std::string& out, u64 arg)
{
Expand Down
Loading