diff options
Diffstat (limited to 'src/common')
-rw-r--r-- | src/common/common_paths.h | 2 | ||||
-rw-r--r-- | src/common/file_util.cpp | 2 | ||||
-rw-r--r-- | src/common/file_util.h | 2 | ||||
-rw-r--r-- | src/common/logging/backend.cpp | 1 | ||||
-rw-r--r-- | src/common/logging/log.h | 1 | ||||
-rw-r--r-- | src/common/ring_buffer.h | 14 | ||||
-rw-r--r-- | src/common/thread.h | 8 |
7 files changed, 19 insertions, 11 deletions
diff --git a/src/common/common_paths.h b/src/common/common_paths.h index df2ce80b1..4f88de768 100644 --- a/src/common/common_paths.h +++ b/src/common/common_paths.h @@ -33,6 +33,8 @@ #define NAND_DIR "nand" #define SYSDATA_DIR "sysdata" #define KEYS_DIR "keys" +#define LOAD_DIR "load" +#define DUMP_DIR "dump" #define LOG_DIR "log" // Filenames diff --git a/src/common/file_util.cpp b/src/common/file_util.cpp index 21a0b9738..548463787 100644 --- a/src/common/file_util.cpp +++ b/src/common/file_util.cpp @@ -705,6 +705,8 @@ const std::string& GetUserPath(UserPath path, const std::string& new_path) { #endif paths.emplace(UserPath::SDMCDir, user_path + SDMC_DIR DIR_SEP); paths.emplace(UserPath::NANDDir, user_path + NAND_DIR DIR_SEP); + paths.emplace(UserPath::LoadDir, user_path + LOAD_DIR DIR_SEP); + paths.emplace(UserPath::DumpDir, user_path + DUMP_DIR DIR_SEP); paths.emplace(UserPath::SysDataDir, user_path + SYSDATA_DIR DIR_SEP); paths.emplace(UserPath::KeysDir, user_path + KEYS_DIR DIR_SEP); // TODO: Put the logs in a better location for each OS diff --git a/src/common/file_util.h b/src/common/file_util.h index 24c1e413c..3d8fe6264 100644 --- a/src/common/file_util.h +++ b/src/common/file_util.h @@ -29,6 +29,8 @@ enum class UserPath { NANDDir, RootDir, SDMCDir, + LoadDir, + DumpDir, SysDataDir, UserDir, }; diff --git a/src/common/logging/backend.cpp b/src/common/logging/backend.cpp index efd776db6..9f5918851 100644 --- a/src/common/logging/backend.cpp +++ b/src/common/logging/backend.cpp @@ -183,6 +183,7 @@ void FileBackend::Write(const Entry& entry) { SUB(Service, FS) \ SUB(Service, GRC) \ SUB(Service, HID) \ + SUB(Service, IRS) \ SUB(Service, LBL) \ SUB(Service, LDN) \ SUB(Service, LDR) \ diff --git a/src/common/logging/log.h b/src/common/logging/log.h index 4d577524f..abbd056ee 100644 --- a/src/common/logging/log.h +++ b/src/common/logging/log.h @@ -70,6 +70,7 @@ enum class Class : ClassType { Service_FS, ///< The FS (Filesystem) service Service_GRC, ///< The game recording service Service_HID, ///< The HID (Human interface device) service + Service_IRS, ///< The IRS service Service_LBL, ///< The LBL (LCD backlight) service Service_LDN, ///< The LDN (Local domain network) service Service_LDR, ///< The loader service diff --git a/src/common/ring_buffer.h b/src/common/ring_buffer.h index 45926c9ec..abe3b4dc2 100644 --- a/src/common/ring_buffer.h +++ b/src/common/ring_buffer.h @@ -9,6 +9,7 @@ #include <atomic> #include <cstddef> #include <cstring> +#include <new> #include <type_traits> #include <vector> #include "common/common_types.h" @@ -29,7 +30,7 @@ class RingBuffer { static_assert(capacity < std::numeric_limits<std::size_t>::max() / 2 / granularity); static_assert((capacity & (capacity - 1)) == 0, "capacity must be a power of two"); // Ensure lock-free. - static_assert(std::atomic<std::size_t>::is_always_lock_free); + static_assert(std::atomic_size_t::is_always_lock_free); public: /// Pushes slots into the ring buffer @@ -102,8 +103,15 @@ public: private: // It is important to align the below variables for performance reasons: // Having them on the same cache-line would result in false-sharing between them. - alignas(128) std::atomic<std::size_t> m_read_index{0}; - alignas(128) std::atomic<std::size_t> m_write_index{0}; + // TODO: Remove this ifdef whenever clang and GCC support + // std::hardware_destructive_interference_size. +#if defined(_MSC_VER) && _MSC_VER >= 1911 + alignas(std::hardware_destructive_interference_size) std::atomic_size_t m_read_index{0}; + alignas(std::hardware_destructive_interference_size) std::atomic_size_t m_write_index{0}; +#else + alignas(128) std::atomic_size_t m_read_index{0}; + alignas(128) std::atomic_size_t m_write_index{0}; +#endif std::array<T, granularity * capacity> m_data; }; diff --git a/src/common/thread.h b/src/common/thread.h index 12a1c095c..6cbdb96a3 100644 --- a/src/common/thread.h +++ b/src/common/thread.h @@ -87,14 +87,6 @@ private: void SleepCurrentThread(int ms); void SwitchCurrentThread(); // On Linux, this is equal to sleep 1ms - -// Use this function during a spin-wait to make the current thread -// relax while another thread is working. This may be more efficient -// than using events because event functions use kernel calls. -inline void YieldCPU() { - std::this_thread::yield(); -} - void SetCurrentThreadName(const char* name); } // namespace Common |