Compare commits

...

2 commits

Author SHA1 Message Date
Megamouse
fcdf542c47 Update SDL to 3.2.12
Some checks are pending
Generate Translation Template / Generate Translation Template (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04 gcc (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04-arm clang (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04 clang (push) Waiting to run
Build RPCS3 / RPCS3 Windows (push) Waiting to run
2025-05-05 22:42:28 +02:00
Vestral
3cebfaa648
Atomic utils fixup after ASLR changes (#17168) 2025-05-05 21:48:07 +03:00
6 changed files with 24 additions and 20 deletions

@ -1 +1 @@
Subproject commit 877399b2b2cf21e67554ed9046410f268ce1d1b2
Subproject commit 5ac37a8ffcf89da390404c1016833d56e2d67ae4

View file

@ -532,8 +532,6 @@
<AdditionalIncludeDirectories>SDL\include;SDL\include\build_config;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<DebugInformationFormat Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">ProgramDatabase</DebugInformationFormat>
<Optimization Condition="'$(Configuration)|$(Platform)'=='Release|x64'">MaxSpeed</Optimization>
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">SDL_HIDAPI_DISABLED;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">SDL_HIDAPI_DISABLED;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
</ItemDefinitionGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />

View file

@ -384,7 +384,7 @@ public:
template <typename T>
class lf_queue final
{
public:
private:
struct fat_ptr
{
u64 ptr{};
@ -392,7 +392,6 @@ public:
u32 reserved{};
};
private:
atomic_t<fat_ptr> m_head{fat_ptr{}};
lf_queue_item<T>* load(fat_ptr value) const noexcept
@ -439,8 +438,7 @@ public:
return *this;
}
delete load(m_head);
m_head.release(other.m_head.exchange(fat_ptr{}));
delete load(m_head.exchange(other.m_head.exchange(fat_ptr{})));
return *this;
}
@ -453,10 +451,15 @@ public:
{
if (!operator bool())
{
utils::bless<atomic_t<u32>>(&m_head.raw().is_non_null)->wait(0);
get_wait_atomic().wait(0);
}
}
atomic_t<u32> &get_wait_atomic()
{
return *utils::bless<atomic_t<u32>>(&m_head.raw().is_non_null);
}
const volatile void* observe() const noexcept
{
return load(m_head);
@ -491,7 +494,7 @@ public:
{
if (force || operator bool())
{
utils::bless<atomic_t<u32>>(&m_head.raw().is_non_null)->notify_one();
get_wait_atomic().notify_one();
}
}

View file

@ -7376,7 +7376,7 @@ struct spu_llvm_worker
set_relax_flag = false;
}
thread_ctrl::wait_on(utils::bless<atomic_t<u32>>(&registered)[1], 0);
thread_ctrl::wait_on(registered.get_wait_atomic(), 0);
slice = registered.pop_all();
}())
{
@ -7491,7 +7491,7 @@ struct spu_llvm
while (!registered && thread_ctrl::state() != thread_state::aborting)
{
// Wait for the first SPU block before launching any thread
thread_ctrl::wait_on(utils::bless<atomic_t<u32>>(&registered)[1], 0);
thread_ctrl::wait_on(registered.get_wait_atomic(), 0);
}
if (thread_ctrl::state() == thread_state::aborting)
@ -7594,7 +7594,7 @@ struct spu_llvm
// Interrupt profiler thread and put it to sleep
static_cast<void>(prof_mutex.reset());
thread_ctrl::wait_on(utils::bless<atomic_t<u32>>(&registered)[1], 0);
thread_ctrl::wait_on(registered.get_wait_atomic(), 0);
std::fill(notify_compile.begin(), notify_compile.end(), 0); // Reset notification flags
notify_compile_count = 0;
compile_pending = 0;

View file

@ -207,7 +207,7 @@ namespace atomic_wait
static_assert(Index < Max);
static_assert(sizeof(var) == sizeof(uptr) * 2);
m_info[Index].data = reinterpret_cast<char*>(&var) + offsetof(typename lf_queue<T2>::fat_ptr, is_non_null);
m_info[Index].data = std::bit_cast<char*>(&var.get_wait_atomic().raw());
m_info[Index].old = 0;
}
@ -217,7 +217,7 @@ namespace atomic_wait
static_assert(Index < Max);
static_assert(sizeof(var) == sizeof(uptr) * 2);
m_info[Index].data = reinterpret_cast<char*>(&var) + offsetof(typename stx::atomic_ptr<T2>::fat_ptr, is_non_null);
m_info[Index].data = std::bit_cast<char*>(&var.get_wait_atomic().raw());
m_info[Index].old = 0;
}

View file

@ -576,7 +576,7 @@ namespace stx
template <typename T>
class atomic_ptr
{
public:
private:
struct fat_ptr
{
uptr ptr{};
@ -584,8 +584,6 @@ namespace stx
u32 ref_ctr{};
};
private:
mutable atomic_t<fat_ptr> m_val{fat_ptr{}};
static shared_counter* d(fat_ptr val) noexcept
@ -1117,19 +1115,24 @@ namespace stx
return static_cast<volatile const void*>(observe()) == r.get();
}
atomic_t<u32> &get_wait_atomic()
{
return *utils::bless<atomic_t<u32>>(&m_val.raw().is_non_null);
}
void wait(std::nullptr_t, atomic_wait_timeout timeout = atomic_wait_timeout::inf)
{
utils::bless<atomic_t<u32>>(&m_val.raw().is_non_null)->wait(0, timeout);
get_wait_atomic().wait(0, timeout);
}
void notify_one()
{
utils::bless<atomic_t<u32>>(&m_val.raw().is_non_null)->notify_one();
get_wait_atomic().notify_one();
}
void notify_all()
{
utils::bless<atomic_t<u32>>(&m_val.raw().is_non_null)->notify_all();
get_wait_atomic().notify_all();
}
};