Skip to content

Commit

Permalink
LV2: Fixup reservation notifications
Browse files Browse the repository at this point in the history
  • Loading branch information
elad335 committed Aug 17, 2023
1 parent 19bfce4 commit c66961d
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
17 changes: 14 additions & 3 deletions rpcs3/Emu/Cell/lv2/sys_sync.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,11 @@ enum

enum ppu_thread_status : u32;

namespace vm
{
extern u8 g_reservations[65536 / 128 * 64];
}

// Base class for some kernel objects (shared set of 8192 objects).
struct lv2_obj
{
Expand Down Expand Up @@ -432,9 +437,15 @@ struct lv2_obj

if (cpu != &g_to_notify)
{
// Note: by the time of notification the thread could have been deallocated which is why the direct function is used
// TODO: Pass a narrower mask
atomic_wait_engine::notify_one(cpu);
if (cpu >= vm::g_reservations && cpu <= vm::g_reservations + (std::size(vm::g_reservations) - 1))
{
atomic_wait_engine::notify_all(cpu);
}
else
{
// Note: by the time of notification the thread could have been deallocated which is why the direct function is used
atomic_wait_engine::notify_one(cpu);
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion rpcs3/Emu/Memory/vm.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ namespace vm
extern u8* const g_exec_addr;
extern u8* const g_stat_addr;
extern u8* const g_free_addr;
extern u8 g_reservations[];
extern u8 g_reservations[65536 / 128 * 64];

struct writer_lock;

Expand Down

0 comments on commit c66961d

Please sign in to comment.