LV2: Fixup reservation notifications

This commit is contained in:
Eladash 2023-08-17 12:35:20 +03:00 committed by Elad Ashkenazi
parent dacb0bd87f
commit c8f8ecc4d6
2 changed files with 15 additions and 4 deletions

View file

@ -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
{
@ -432,9 +437,15 @@ public:
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);
}
}
}

View file

@ -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;