mirror of
https://github.com/RPCS3/rpcs3.git
synced 2024-11-25 12:12:50 +01:00
Move busy_wait() to asm.hpp
This commit is contained in:
parent
908465b274
commit
4cfa9b11f3
@ -1,5 +1,7 @@
|
|||||||
#include "mutex.h"
|
#include "mutex.h"
|
||||||
|
|
||||||
|
#include "util/asm.hpp"
|
||||||
|
|
||||||
void shared_mutex::imp_lock_shared(u32 val)
|
void shared_mutex::imp_lock_shared(u32 val)
|
||||||
{
|
{
|
||||||
ensure(val < c_err); // "shared_mutex underflow"
|
ensure(val < c_err); // "shared_mutex underflow"
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
#include "sema.h"
|
#include "sema.h"
|
||||||
|
|
||||||
|
#include "util/asm.hpp"
|
||||||
|
|
||||||
void semaphore_base::imp_wait()
|
void semaphore_base::imp_wait()
|
||||||
{
|
{
|
||||||
for (int i = 0; i < 10; i++)
|
for (int i = 0; i < 10; i++)
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
#include "cellGcmSys.h"
|
#include "cellGcmSys.h"
|
||||||
#include "sysPrxForUser.h"
|
#include "sysPrxForUser.h"
|
||||||
|
|
||||||
#include <thread>
|
#include "util/asm.hpp"
|
||||||
|
|
||||||
LOG_CHANNEL(cellGcmSys);
|
LOG_CHANNEL(cellGcmSys);
|
||||||
|
|
||||||
|
@ -6,6 +6,8 @@
|
|||||||
#include "Emu/Cell/lv2/sys_mutex.h"
|
#include "Emu/Cell/lv2/sys_mutex.h"
|
||||||
#include "sysPrxForUser.h"
|
#include "sysPrxForUser.h"
|
||||||
|
|
||||||
|
#include "util/asm.hpp"
|
||||||
|
|
||||||
LOG_CHANNEL(sysPrxForUser);
|
LOG_CHANNEL(sysPrxForUser);
|
||||||
|
|
||||||
error_code sys_lwmutex_create(ppu_thread& ppu, vm::ptr<sys_lwmutex_t> lwmutex, vm::ptr<sys_lwmutex_attribute_t> attr)
|
error_code sys_lwmutex_create(ppu_thread& ppu, vm::ptr<sys_lwmutex_t> lwmutex, vm::ptr<sys_lwmutex_attribute_t> attr)
|
||||||
|
@ -21,6 +21,8 @@
|
|||||||
#include "sys_event.h"
|
#include "sys_event.h"
|
||||||
#include "sys_fs.h"
|
#include "sys_fs.h"
|
||||||
|
|
||||||
|
#include "util/asm.hpp"
|
||||||
|
|
||||||
LOG_CHANNEL(sys_spu);
|
LOG_CHANNEL(sys_spu);
|
||||||
|
|
||||||
extern u64 get_timebased_time();
|
extern u64 get_timebased_time();
|
||||||
|
@ -9,6 +9,8 @@
|
|||||||
#include "Emu/RSX/rsx_methods.h"
|
#include "Emu/RSX/rsx_methods.h"
|
||||||
#include "Emu/Memory/vm_locking.h"
|
#include "Emu/Memory/vm_locking.h"
|
||||||
|
|
||||||
|
#include "util/asm.hpp"
|
||||||
|
|
||||||
namespace vk
|
namespace vk
|
||||||
{
|
{
|
||||||
VkCompareOp get_compare_func(rsx::comparison_function op, bool reverse_direction = false);
|
VkCompareOp get_compare_func(rsx::comparison_function op, bool reverse_direction = false);
|
||||||
|
@ -284,4 +284,14 @@ namespace utils
|
|||||||
return std::countl_zero<u64>(arg) + 64;
|
return std::countl_zero<u64>(arg) + 64;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Synchronization helper (cache-friendly busy waiting)
|
||||||
|
inline void busy_wait(std::size_t cycles = 3000)
|
||||||
|
{
|
||||||
|
const u64 start = __rdtsc();
|
||||||
|
do _mm_pause();
|
||||||
|
while (__rdtsc() - start < cycles);
|
||||||
|
}
|
||||||
} // namespace utils
|
} // namespace utils
|
||||||
|
|
||||||
|
using utils::busy_wait;
|
||||||
|
@ -905,10 +905,3 @@ struct value_hash
|
|||||||
return static_cast<std::size_t>(value) >> Shift;
|
return static_cast<std::size_t>(value) >> Shift;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// Synchronization helper (cache-friendly busy waiting)
|
|
||||||
inline void busy_wait(std::size_t cycles = 3000)
|
|
||||||
{
|
|
||||||
const u64 s = __rdtsc();
|
|
||||||
do _mm_pause(); while (__rdtsc() - s < cycles);
|
|
||||||
}
|
|
||||||
|
Loading…
Reference in New Issue
Block a user