summaryrefslogtreecommitdiff
path: root/src/common
diff options
context:
space:
mode:
Diffstat (limited to 'src/common')
-rw-r--r--src/common/bit_set.h2
-rw-r--r--src/common/chunk_file.h5
-rw-r--r--src/common/color.h2
-rw-r--r--src/common/file_util.cpp17
-rw-r--r--src/common/file_util.h2
-rw-r--r--src/common/logging/backend.cpp2
-rw-r--r--src/common/logging/backend.h2
-rw-r--r--src/common/logging/filter.cpp2
-rw-r--r--src/common/logging/filter.h2
-rw-r--r--src/common/logging/text_formatter.cpp2
-rw-r--r--src/common/logging/text_formatter.h2
-rw-r--r--src/common/memory_util.cpp7
-rw-r--r--src/common/quaternion.h2
-rw-r--r--src/common/scm_rev.h2
-rw-r--r--src/common/scope_exit.h2
-rw-r--r--src/common/string_util.cpp4
-rw-r--r--src/common/string_util.h2
-rw-r--r--src/common/thread_queue_list.h2
-rw-r--r--src/common/x64/xbyak_abi.h69
19 files changed, 87 insertions, 43 deletions
diff --git a/src/common/bit_set.h b/src/common/bit_set.h
index 9c2e6b28c..84e3cbe58 100644
--- a/src/common/bit_set.h
+++ b/src/common/bit_set.h
@@ -236,7 +236,7 @@ public:
236 IntTy m_val; 236 IntTy m_val;
237}; 237};
238 238
239} // Common 239} // namespace Common
240 240
241typedef Common::BitSet<u8> BitSet8; 241typedef Common::BitSet<u8> BitSet8;
242typedef Common::BitSet<u16> BitSet16; 242typedef Common::BitSet<u16> BitSet16;
diff --git a/src/common/chunk_file.h b/src/common/chunk_file.h
index 5145a3657..972ef9039 100644
--- a/src/common/chunk_file.h
+++ b/src/common/chunk_file.h
@@ -607,8 +607,9 @@ public:
607 u32 cookie = arbitraryNumber; 607 u32 cookie = arbitraryNumber;
608 Do(cookie); 608 Do(cookie);
609 if (mode == PointerWrap::MODE_READ && cookie != arbitraryNumber) { 609 if (mode == PointerWrap::MODE_READ && cookie != arbitraryNumber) {
610 LOG_ERROR(Common, "After \"%s\", found %d (0x%X) instead of save marker %d (0x%X). " 610 LOG_ERROR(Common,
611 "Aborting savestate load...", 611 "After \"%s\", found %d (0x%X) instead of save marker %d (0x%X). "
612 "Aborting savestate load...",
612 prevName, cookie, cookie, arbitraryNumber, arbitraryNumber); 613 prevName, cookie, cookie, arbitraryNumber, arbitraryNumber);
613 SetError(ERROR_FAILURE); 614 SetError(ERROR_FAILURE);
614 } 615 }
diff --git a/src/common/color.h b/src/common/color.h
index 4ebd4f3d0..24a445dac 100644
--- a/src/common/color.h
+++ b/src/common/color.h
@@ -256,4 +256,4 @@ inline void EncodeX24S8(u8 stencil, u8* bytes) {
256 bytes[3] = stencil; 256 bytes[3] = stencil;
257} 257}
258 258
259} // namespace 259} // namespace Color
diff --git a/src/common/file_util.cpp b/src/common/file_util.cpp
index 5ab036b34..4e1d702f7 100644
--- a/src/common/file_util.cpp
+++ b/src/common/file_util.cpp
@@ -873,20 +873,19 @@ bool IOFile::Flush() {
873} 873}
874 874
875bool IOFile::Resize(u64 size) { 875bool IOFile::Resize(u64 size) {
876 if (!IsOpen() || 876 if (!IsOpen() || 0 !=
877 0 !=
878#ifdef _WIN32 877#ifdef _WIN32
879 // ector: _chsize sucks, not 64-bit safe 878 // ector: _chsize sucks, not 64-bit safe
880 // F|RES: changed to _chsize_s. i think it is 64-bit safe 879 // F|RES: changed to _chsize_s. i think it is 64-bit safe
881 _chsize_s(_fileno(m_file), size) 880 _chsize_s(_fileno(m_file), size)
882#else 881#else
883 // TODO: handle 64bit and growing 882 // TODO: handle 64bit and growing
884 ftruncate(fileno(m_file), size) 883 ftruncate(fileno(m_file), size)
885#endif 884#endif
886 ) 885 )
887 m_good = false; 886 m_good = false;
888 887
889 return m_good; 888 return m_good;
890} 889}
891 890
892} // namespace 891} // namespace FileUtil
diff --git a/src/common/file_util.h b/src/common/file_util.h
index 94adfcd7e..630232a25 100644
--- a/src/common/file_util.h
+++ b/src/common/file_util.h
@@ -253,7 +253,7 @@ private:
253 bool m_good = true; 253 bool m_good = true;
254}; 254};
255 255
256} // namespace 256} // namespace FileUtil
257 257
258// To deal with Windows being dumb at unicode: 258// To deal with Windows being dumb at unicode:
259template <typename T> 259template <typename T>
diff --git a/src/common/logging/backend.cpp b/src/common/logging/backend.cpp
index ba0acfb72..e136482b6 100644
--- a/src/common/logging/backend.cpp
+++ b/src/common/logging/backend.cpp
@@ -132,4 +132,4 @@ void LogMessage(Class log_class, Level log_level, const char* filename, unsigned
132 132
133 PrintColoredMessage(entry); 133 PrintColoredMessage(entry);
134} 134}
135} 135} // namespace Log
diff --git a/src/common/logging/backend.h b/src/common/logging/backend.h
index c4fe2acbf..70744e3e5 100644
--- a/src/common/logging/backend.h
+++ b/src/common/logging/backend.h
@@ -47,4 +47,4 @@ Entry CreateEntry(Class log_class, Level log_level, const char* filename, unsign
47 const char* function, const char* format, va_list args); 47 const char* function, const char* format, va_list args);
48 48
49void SetFilter(Filter* filter); 49void SetFilter(Filter* filter);
50} 50} // namespace Log
diff --git a/src/common/logging/filter.cpp b/src/common/logging/filter.cpp
index 12e5bb45d..733247b51 100644
--- a/src/common/logging/filter.cpp
+++ b/src/common/logging/filter.cpp
@@ -94,4 +94,4 @@ bool Filter::ParseFilterRule(const std::string::const_iterator begin,
94bool Filter::CheckMessage(Class log_class, Level level) const { 94bool Filter::CheckMessage(Class log_class, Level level) const {
95 return static_cast<u8>(level) >= static_cast<u8>(class_levels[static_cast<size_t>(log_class)]); 95 return static_cast<u8>(level) >= static_cast<u8>(class_levels[static_cast<size_t>(log_class)]);
96} 96}
97} 97} // namespace Log
diff --git a/src/common/logging/filter.h b/src/common/logging/filter.h
index b51df61de..16fa72642 100644
--- a/src/common/logging/filter.h
+++ b/src/common/logging/filter.h
@@ -50,4 +50,4 @@ public:
50private: 50private:
51 std::array<Level, (size_t)Class::Count> class_levels; 51 std::array<Level, (size_t)Class::Count> class_levels;
52}; 52};
53} 53} // namespace Log
diff --git a/src/common/logging/text_formatter.cpp b/src/common/logging/text_formatter.cpp
index f71e748d1..e7e46c76b 100644
--- a/src/common/logging/text_formatter.cpp
+++ b/src/common/logging/text_formatter.cpp
@@ -129,4 +129,4 @@ void PrintColoredMessage(const Entry& entry) {
129#undef ESC 129#undef ESC
130#endif 130#endif
131} 131}
132} 132} // namespace Log
diff --git a/src/common/logging/text_formatter.h b/src/common/logging/text_formatter.h
index 749268310..66e86d9ec 100644
--- a/src/common/logging/text_formatter.h
+++ b/src/common/logging/text_formatter.h
@@ -28,4 +28,4 @@ void FormatLogMessage(const Entry& entry, char* out_text, size_t text_len);
28void PrintMessage(const Entry& entry); 28void PrintMessage(const Entry& entry);
29/// Prints the same message as `PrintMessage`, but colored acoording to the severity level. 29/// Prints the same message as `PrintMessage`, but colored acoording to the severity level.
30void PrintColoredMessage(const Entry& entry); 30void PrintColoredMessage(const Entry& entry);
31} 31} // namespace Log
diff --git a/src/common/memory_util.cpp b/src/common/memory_util.cpp
index c19729b21..759ad02ca 100644
--- a/src/common/memory_util.cpp
+++ b/src/common/memory_util.cpp
@@ -40,11 +40,12 @@ void* AllocateExecutableMemory(size_t size, bool low) {
40 if (low && (!map_hint)) 40 if (low && (!map_hint))
41 map_hint = (char*)round_page(512 * 1024 * 1024); /* 0.5 GB rounded up to the next page */ 41 map_hint = (char*)round_page(512 * 1024 * 1024); /* 0.5 GB rounded up to the next page */
42#endif 42#endif
43 void* ptr = mmap(map_hint, size, PROT_READ | PROT_WRITE | PROT_EXEC, MAP_ANON | MAP_PRIVATE 43 void* ptr = mmap(map_hint, size, PROT_READ | PROT_WRITE | PROT_EXEC,
44 MAP_ANON | MAP_PRIVATE
44#if defined(ARCHITECTURE_X64) && defined(MAP_32BIT) 45#if defined(ARCHITECTURE_X64) && defined(MAP_32BIT)
45 | (low ? MAP_32BIT : 0) 46 | (low ? MAP_32BIT : 0)
46#endif 47#endif
47 , 48 ,
48 -1, 0); 49 -1, 0);
49#endif /* defined(_WIN32) */ 50#endif /* defined(_WIN32) */
50 51
diff --git a/src/common/quaternion.h b/src/common/quaternion.h
index 77f626bcb..ea39298c1 100644
--- a/src/common/quaternion.h
+++ b/src/common/quaternion.h
@@ -46,4 +46,4 @@ inline Quaternion<float> MakeQuaternion(const Math::Vec3<float>& axis, float ang
46 return {axis * std::sin(angle / 2), std::cos(angle / 2)}; 46 return {axis * std::sin(angle / 2), std::cos(angle / 2)};
47} 47}
48 48
49} // namspace Math 49} // namespace Math
diff --git a/src/common/scm_rev.h b/src/common/scm_rev.h
index 18aaa1735..db0f4a947 100644
--- a/src/common/scm_rev.h
+++ b/src/common/scm_rev.h
@@ -12,4 +12,4 @@ extern const char g_scm_desc[];
12extern const char g_build_name[]; 12extern const char g_build_name[];
13extern const char g_build_date[]; 13extern const char g_build_date[];
14 14
15} // namespace 15} // namespace Common
diff --git a/src/common/scope_exit.h b/src/common/scope_exit.h
index 072ab285d..baf1f1c9e 100644
--- a/src/common/scope_exit.h
+++ b/src/common/scope_exit.h
@@ -22,7 +22,7 @@ template <typename Func>
22ScopeExitHelper<Func> ScopeExit(Func&& func) { 22ScopeExitHelper<Func> ScopeExit(Func&& func) {
23 return ScopeExitHelper<Func>(std::move(func)); 23 return ScopeExitHelper<Func>(std::move(func));
24} 24}
25} 25} // namespace detail
26 26
27/** 27/**
28 * This macro allows you to conveniently specify a block of code that will run on scope exit. Handy 28 * This macro allows you to conveniently specify a block of code that will run on scope exit. Handy
diff --git a/src/common/string_util.cpp b/src/common/string_util.cpp
index 6959915fa..e9a2a6b00 100644
--- a/src/common/string_util.cpp
+++ b/src/common/string_util.cpp
@@ -202,7 +202,7 @@ bool SplitPath(const std::string& full_path, std::string* _pPath, std::string* _
202#ifdef _WIN32 202#ifdef _WIN32
203 ":" 203 ":"
204#endif 204#endif
205 ); 205 );
206 if (std::string::npos == dir_end) 206 if (std::string::npos == dir_end)
207 dir_end = 0; 207 dir_end = 0;
208 else 208 else
@@ -462,4 +462,4 @@ std::string StringFromFixedZeroTerminatedBuffer(const char* buffer, size_t max_l
462 462
463 return std::string(buffer, len); 463 return std::string(buffer, len);
464} 464}
465} 465} // namespace Common
diff --git a/src/common/string_util.h b/src/common/string_util.h
index 259360aec..ceb8df48e 100644
--- a/src/common/string_util.h
+++ b/src/common/string_util.h
@@ -134,4 +134,4 @@ bool ComparePartialString(InIt begin, InIt end, const char* other) {
134 * NUL-terminated then the string ends at max_len characters. 134 * NUL-terminated then the string ends at max_len characters.
135 */ 135 */
136std::string StringFromFixedZeroTerminatedBuffer(const char* buffer, size_t max_len); 136std::string StringFromFixedZeroTerminatedBuffer(const char* buffer, size_t max_len);
137} 137} // namespace Common
diff --git a/src/common/thread_queue_list.h b/src/common/thread_queue_list.h
index edd0e4a3f..38a450d69 100644
--- a/src/common/thread_queue_list.h
+++ b/src/common/thread_queue_list.h
@@ -158,4 +158,4 @@ private:
158 std::array<Queue, NUM_QUEUES> queues; 158 std::array<Queue, NUM_QUEUES> queues;
159}; 159};
160 160
161} // namespace 161} // namespace Common
diff --git a/src/common/x64/xbyak_abi.h b/src/common/x64/xbyak_abi.h
index 6090d93e1..fd3fbdd4b 100644
--- a/src/common/x64/xbyak_abi.h
+++ b/src/common/x64/xbyak_abi.h
@@ -60,20 +60,41 @@ const Xbyak::Reg ABI_PARAM4 = Xbyak::util::r9;
60 60
61const BitSet32 ABI_ALL_CALLER_SAVED = BuildRegSet({ 61const BitSet32 ABI_ALL_CALLER_SAVED = BuildRegSet({
62 // GPRs 62 // GPRs
63 Xbyak::util::rcx, Xbyak::util::rdx, Xbyak::util::r8, Xbyak::util::r9, Xbyak::util::r10, 63 Xbyak::util::rcx,
64 Xbyak::util::rdx,
65 Xbyak::util::r8,
66 Xbyak::util::r9,
67 Xbyak::util::r10,
64 Xbyak::util::r11, 68 Xbyak::util::r11,
65 // XMMs 69 // XMMs
66 Xbyak::util::xmm0, Xbyak::util::xmm1, Xbyak::util::xmm2, Xbyak::util::xmm3, Xbyak::util::xmm4, 70 Xbyak::util::xmm0,
71 Xbyak::util::xmm1,
72 Xbyak::util::xmm2,
73 Xbyak::util::xmm3,
74 Xbyak::util::xmm4,
67 Xbyak::util::xmm5, 75 Xbyak::util::xmm5,
68}); 76});
69 77
70const BitSet32 ABI_ALL_CALLEE_SAVED = BuildRegSet({ 78const BitSet32 ABI_ALL_CALLEE_SAVED = BuildRegSet({
71 // GPRs 79 // GPRs
72 Xbyak::util::rbx, Xbyak::util::rsi, Xbyak::util::rdi, Xbyak::util::rbp, Xbyak::util::r12, 80 Xbyak::util::rbx,
73 Xbyak::util::r13, Xbyak::util::r14, Xbyak::util::r15, 81 Xbyak::util::rsi,
82 Xbyak::util::rdi,
83 Xbyak::util::rbp,
84 Xbyak::util::r12,
85 Xbyak::util::r13,
86 Xbyak::util::r14,
87 Xbyak::util::r15,
74 // XMMs 88 // XMMs
75 Xbyak::util::xmm6, Xbyak::util::xmm7, Xbyak::util::xmm8, Xbyak::util::xmm9, Xbyak::util::xmm10, 89 Xbyak::util::xmm6,
76 Xbyak::util::xmm11, Xbyak::util::xmm12, Xbyak::util::xmm13, Xbyak::util::xmm14, 90 Xbyak::util::xmm7,
91 Xbyak::util::xmm8,
92 Xbyak::util::xmm9,
93 Xbyak::util::xmm10,
94 Xbyak::util::xmm11,
95 Xbyak::util::xmm12,
96 Xbyak::util::xmm13,
97 Xbyak::util::xmm14,
77 Xbyak::util::xmm15, 98 Xbyak::util::xmm15,
78}); 99});
79 100
@@ -90,18 +111,40 @@ const Xbyak::Reg ABI_PARAM4 = Xbyak::util::rcx;
90 111
91const BitSet32 ABI_ALL_CALLER_SAVED = BuildRegSet({ 112const BitSet32 ABI_ALL_CALLER_SAVED = BuildRegSet({
92 // GPRs 113 // GPRs
93 Xbyak::util::rcx, Xbyak::util::rdx, Xbyak::util::rdi, Xbyak::util::rsi, Xbyak::util::r8, 114 Xbyak::util::rcx,
94 Xbyak::util::r9, Xbyak::util::r10, Xbyak::util::r11, 115 Xbyak::util::rdx,
116 Xbyak::util::rdi,
117 Xbyak::util::rsi,
118 Xbyak::util::r8,
119 Xbyak::util::r9,
120 Xbyak::util::r10,
121 Xbyak::util::r11,
95 // XMMs 122 // XMMs
96 Xbyak::util::xmm0, Xbyak::util::xmm1, Xbyak::util::xmm2, Xbyak::util::xmm3, Xbyak::util::xmm4, 123 Xbyak::util::xmm0,
97 Xbyak::util::xmm5, Xbyak::util::xmm6, Xbyak::util::xmm7, Xbyak::util::xmm8, Xbyak::util::xmm9, 124 Xbyak::util::xmm1,
98 Xbyak::util::xmm10, Xbyak::util::xmm11, Xbyak::util::xmm12, Xbyak::util::xmm13, 125 Xbyak::util::xmm2,
99 Xbyak::util::xmm14, Xbyak::util::xmm15, 126 Xbyak::util::xmm3,
127 Xbyak::util::xmm4,
128 Xbyak::util::xmm5,
129 Xbyak::util::xmm6,
130 Xbyak::util::xmm7,
131 Xbyak::util::xmm8,
132 Xbyak::util::xmm9,
133 Xbyak::util::xmm10,
134 Xbyak::util::xmm11,
135 Xbyak::util::xmm12,
136 Xbyak::util::xmm13,
137 Xbyak::util::xmm14,
138 Xbyak::util::xmm15,
100}); 139});
101 140
102const BitSet32 ABI_ALL_CALLEE_SAVED = BuildRegSet({ 141const BitSet32 ABI_ALL_CALLEE_SAVED = BuildRegSet({
103 // GPRs 142 // GPRs
104 Xbyak::util::rbx, Xbyak::util::rbp, Xbyak::util::r12, Xbyak::util::r13, Xbyak::util::r14, 143 Xbyak::util::rbx,
144 Xbyak::util::rbp,
145 Xbyak::util::r12,
146 Xbyak::util::r13,
147 Xbyak::util::r14,
105 Xbyak::util::r15, 148 Xbyak::util::r15,
106}); 149});
107 150