mirror of
https://git.eden-emu.dev/eden-emu/eden
synced 2026-05-26 21:47:06 +02:00
dfgdfgdfgd
This commit is contained in:
parent
b8bf558994
commit
fe256f276e
1 changed files with 8 additions and 30 deletions
|
|
@ -15,10 +15,11 @@
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#endif
|
#elif defined(__DragonFly__) || defined(__FreeBSD__)
|
||||||
#if defined(__DragonFly__) || defined(__FreeBSD__)
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <machine/cpufunc.h>
|
#include <machine/cpufunc.h>
|
||||||
|
#elif defined(__ANDROID__)
|
||||||
|
#include <sys/system_properties.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "common/steady_clock.h"
|
#include "common/steady_clock.h"
|
||||||
|
|
@ -31,24 +32,8 @@
|
||||||
#include "common/x64/rdtsc.h"
|
#include "common/x64/rdtsc.h"
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
#include <intrin.h>
|
#include <intrin.h>
|
||||||
static inline u64 xgetbv(u32 index) {
|
static inline u64 xgetbv(u32 index) { return _xgetbv(index); }
|
||||||
return _xgetbv(index);
|
|
||||||
}
|
|
||||||
#else
|
#else
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef __ANDROID__
|
|
||||||
#include <sys/system_properties.h>
|
|
||||||
#endif
|
|
||||||
#ifdef ARCHITECTURE_x86_64
|
|
||||||
#include "common/x64/rdtsc.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
namespace Common {
|
|
||||||
|
|
||||||
#ifdef ARCHITECTURE_x86_64
|
|
||||||
|
|
||||||
namespace {
|
|
||||||
static inline void __cpuidex(int info[4], u32 function_id, u32 subfunction_id) {
|
static inline void __cpuidex(int info[4], u32 function_id, u32 subfunction_id) {
|
||||||
#if defined(__DragonFly__) || defined(__FreeBSD__)
|
#if defined(__DragonFly__) || defined(__FreeBSD__)
|
||||||
// Despite the name, this is just do_cpuid() with ECX as second input.
|
// Despite the name, this is just do_cpuid() with ECX as second input.
|
||||||
|
|
@ -61,11 +46,7 @@ static inline void __cpuidex(int info[4], u32 function_id, u32 subfunction_id) {
|
||||||
: "a"(function_id), "c"(subfunction_id));
|
: "a"(function_id), "c"(subfunction_id));
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
static inline void __cpuid(int info[4], u32 function_id) { return __cpuidex(info, function_id, 0); }
|
||||||
static inline void __cpuid(int info[4], u32 function_id) {
|
|
||||||
return __cpuidex(info, function_id, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
#define _XCR_XFEATURE_ENABLED_MASK 0
|
#define _XCR_XFEATURE_ENABLED_MASK 0
|
||||||
static inline u64 xgetbv(u32 index) {
|
static inline u64 xgetbv(u32 index) {
|
||||||
u32 eax, edx;
|
u32 eax, edx;
|
||||||
|
|
@ -73,8 +54,10 @@ static inline u64 xgetbv(u32 index) {
|
||||||
return ((u64)edx << 32) | eax;
|
return ((u64)edx << 32) | eax;
|
||||||
}
|
}
|
||||||
#endif // _MSC_VER
|
#endif // _MSC_VER
|
||||||
}
|
#endif
|
||||||
|
|
||||||
|
namespace Common {
|
||||||
|
#ifdef ARCHITECTURE_x86_64
|
||||||
CPUCaps::Manufacturer CPUCaps::ParseManufacturer(std::string_view brand_string) {
|
CPUCaps::Manufacturer CPUCaps::ParseManufacturer(std::string_view brand_string) {
|
||||||
if (brand_string == "GenuineIntel") {
|
if (brand_string == "GenuineIntel") {
|
||||||
return Manufacturer::Intel;
|
return Manufacturer::Intel;
|
||||||
|
|
@ -310,15 +293,12 @@ u64 WallClock::NsToTicks(std::chrono::nanoseconds ns) const {
|
||||||
}
|
}
|
||||||
#elif defined(HAS_NCE)
|
#elif defined(HAS_NCE)
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
[[nodiscard]] Common::WallClock::FactorType GetFixedPointFactor(u64 num, u64 den) noexcept {
|
[[nodiscard]] Common::WallClock::FactorType GetFixedPointFactor(u64 num, u64 den) noexcept {
|
||||||
return (Common::WallClock::FactorType(num) << 64) / den;
|
return (Common::WallClock::FactorType(num) << 64) / den;
|
||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard]] u64 MultiplyHigh(u64 m, Common::WallClock::FactorType factor) noexcept {
|
[[nodiscard]] u64 MultiplyHigh(u64 m, Common::WallClock::FactorType factor) noexcept {
|
||||||
return static_cast<u64>((m * factor) >> 64);
|
return static_cast<u64>((m * factor) >> 64);
|
||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard]] s64 GetHostCNTFRQ() noexcept {
|
[[nodiscard]] s64 GetHostCNTFRQ() noexcept {
|
||||||
u64 cntfrq_el0 = 0;
|
u64 cntfrq_el0 = 0;
|
||||||
#ifdef ANDROID
|
#ifdef ANDROID
|
||||||
|
|
@ -343,7 +323,6 @@ namespace {
|
||||||
return cntfrq_el0;
|
return cntfrq_el0;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
WallClock::WallClock(bool invariant_, u64 rdtsc_frequency_) noexcept {
|
WallClock::WallClock(bool invariant_, u64 rdtsc_frequency_) noexcept {
|
||||||
|
|
@ -442,5 +421,4 @@ const WallClock g_wall_clock = [] {
|
||||||
return WallClock(true, 1);
|
return WallClock(true, 1);
|
||||||
#endif
|
#endif
|
||||||
}();
|
}();
|
||||||
|
|
||||||
} // namespace Common
|
} // namespace Common
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue