summaryrefslogtreecommitdiff
path: root/src/core/hle/kernel
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/hle/kernel')
-rw-r--r--src/core/hle/kernel/address_arbiter.cpp8
-rw-r--r--src/core/hle/kernel/archive.cpp50
-rw-r--r--src/core/hle/kernel/kernel.cpp8
-rw-r--r--src/core/hle/kernel/kernel.h17
-rw-r--r--src/core/hle/kernel/shared_memory.cpp10
-rw-r--r--src/core/hle/kernel/thread.cpp24
6 files changed, 45 insertions, 72 deletions
diff --git a/src/core/hle/kernel/address_arbiter.cpp b/src/core/hle/kernel/address_arbiter.cpp
index ce4f3c854..9a921108d 100644
--- a/src/core/hle/kernel/address_arbiter.cpp
+++ b/src/core/hle/kernel/address_arbiter.cpp
@@ -24,12 +24,6 @@ public:
24 Kernel::HandleType GetHandleType() const override { return HandleType::AddressArbiter; } 24 Kernel::HandleType GetHandleType() const override { return HandleType::AddressArbiter; }
25 25
26 std::string name; ///< Name of address arbiter object (optional) 26 std::string name; ///< Name of address arbiter object (optional)
27
28 ResultVal<bool> WaitSynchronization() override {
29 // TODO(bunnei): ImplementMe
30 ERROR_LOG(OSHLE, "(UNIMPLEMENTED)");
31 return UnimplementedFunction(ErrorModule::OS);
32 }
33}; 27};
34 28
35//////////////////////////////////////////////////////////////////////////////////////////////////// 29////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -59,7 +53,7 @@ ResultCode ArbitrateAddress(Handle handle, ArbitrationType type, u32 address, s3
59 break; 53 break;
60 54
61 default: 55 default:
62 ERROR_LOG(KERNEL, "unknown type=%d", type); 56 LOG_ERROR(Kernel, "unknown type=%d", type);
63 return ResultCode(ErrorDescription::InvalidEnumValue, ErrorModule::Kernel, ErrorSummary::WrongArgument, ErrorLevel::Usage); 57 return ResultCode(ErrorDescription::InvalidEnumValue, ErrorModule::Kernel, ErrorSummary::WrongArgument, ErrorLevel::Usage);
64 } 58 }
65 return RESULT_SUCCESS; 59 return RESULT_SUCCESS;
diff --git a/src/core/hle/kernel/archive.cpp b/src/core/hle/kernel/archive.cpp
index a875fa7ff..ddc09e13b 100644
--- a/src/core/hle/kernel/archive.cpp
+++ b/src/core/hle/kernel/archive.cpp
@@ -94,26 +94,20 @@ public:
94 } 94 }
95 case FileCommand::Close: 95 case FileCommand::Close:
96 { 96 {
97 DEBUG_LOG(KERNEL, "Close %s %s", GetTypeName().c_str(), GetName().c_str()); 97 LOG_TRACE(Service_FS, "Close %s %s", GetTypeName().c_str(), GetName().c_str());
98 CloseArchive(backend->GetIdCode()); 98 CloseArchive(backend->GetIdCode());
99 break; 99 break;
100 } 100 }
101 // Unknown command... 101 // Unknown command...
102 default: 102 default:
103 { 103 {
104 ERROR_LOG(KERNEL, "Unknown command=0x%08X!", cmd); 104 LOG_ERROR(Service_FS, "Unknown command=0x%08X", cmd);
105 return UnimplementedFunction(ErrorModule::FS); 105 return UnimplementedFunction(ErrorModule::FS);
106 } 106 }
107 } 107 }
108 cmd_buff[1] = 0; // No error 108 cmd_buff[1] = 0; // No error
109 return MakeResult<bool>(false); 109 return MakeResult<bool>(false);
110 } 110 }
111
112 ResultVal<bool> WaitSynchronization() override {
113 // TODO(bunnei): ImplementMe
114 ERROR_LOG(OSHLE, "(UNIMPLEMENTED)");
115 return UnimplementedFunction(ErrorModule::FS);
116 }
117}; 111};
118 112
119class File : public Object { 113class File : public Object {
@@ -138,7 +132,7 @@ public:
138 u64 offset = cmd_buff[1] | ((u64) cmd_buff[2]) << 32; 132 u64 offset = cmd_buff[1] | ((u64) cmd_buff[2]) << 32;
139 u32 length = cmd_buff[3]; 133 u32 length = cmd_buff[3];
140 u32 address = cmd_buff[5]; 134 u32 address = cmd_buff[5];
141 DEBUG_LOG(KERNEL, "Read %s %s: offset=0x%llx length=%d address=0x%x", 135 LOG_TRACE(Service_FS, "Read %s %s: offset=0x%llx length=%d address=0x%x",
142 GetTypeName().c_str(), GetName().c_str(), offset, length, address); 136 GetTypeName().c_str(), GetName().c_str(), offset, length, address);
143 cmd_buff[2] = backend->Read(offset, length, Memory::GetPointer(address)); 137 cmd_buff[2] = backend->Read(offset, length, Memory::GetPointer(address));
144 break; 138 break;
@@ -151,7 +145,7 @@ public:
151 u32 length = cmd_buff[3]; 145 u32 length = cmd_buff[3];
152 u32 flush = cmd_buff[4]; 146 u32 flush = cmd_buff[4];
153 u32 address = cmd_buff[6]; 147 u32 address = cmd_buff[6];
154 DEBUG_LOG(KERNEL, "Write %s %s: offset=0x%llx length=%d address=0x%x, flush=0x%x", 148 LOG_TRACE(Service_FS, "Write %s %s: offset=0x%llx length=%d address=0x%x, flush=0x%x",
155 GetTypeName().c_str(), GetName().c_str(), offset, length, address, flush); 149 GetTypeName().c_str(), GetName().c_str(), offset, length, address, flush);
156 cmd_buff[2] = backend->Write(offset, length, flush, Memory::GetPointer(address)); 150 cmd_buff[2] = backend->Write(offset, length, flush, Memory::GetPointer(address));
157 break; 151 break;
@@ -159,7 +153,7 @@ public:
159 153
160 case FileCommand::GetSize: 154 case FileCommand::GetSize:
161 { 155 {
162 DEBUG_LOG(KERNEL, "GetSize %s %s", GetTypeName().c_str(), GetName().c_str()); 156 LOG_TRACE(Service_FS, "GetSize %s %s", GetTypeName().c_str(), GetName().c_str());
163 u64 size = backend->GetSize(); 157 u64 size = backend->GetSize();
164 cmd_buff[2] = (u32)size; 158 cmd_buff[2] = (u32)size;
165 cmd_buff[3] = size >> 32; 159 cmd_buff[3] = size >> 32;
@@ -169,7 +163,7 @@ public:
169 case FileCommand::SetSize: 163 case FileCommand::SetSize:
170 { 164 {
171 u64 size = cmd_buff[1] | ((u64)cmd_buff[2] << 32); 165 u64 size = cmd_buff[1] | ((u64)cmd_buff[2] << 32);
172 DEBUG_LOG(KERNEL, "SetSize %s %s size=%llu", 166 LOG_TRACE(Service_FS, "SetSize %s %s size=%llu",
173 GetTypeName().c_str(), GetName().c_str(), size); 167 GetTypeName().c_str(), GetName().c_str(), size);
174 backend->SetSize(size); 168 backend->SetSize(size);
175 break; 169 break;
@@ -177,14 +171,14 @@ public:
177 171
178 case FileCommand::Close: 172 case FileCommand::Close:
179 { 173 {
180 DEBUG_LOG(KERNEL, "Close %s %s", GetTypeName().c_str(), GetName().c_str()); 174 LOG_TRACE(Service_FS, "Close %s %s", GetTypeName().c_str(), GetName().c_str());
181 Kernel::g_object_pool.Destroy<File>(GetHandle()); 175 Kernel::g_object_pool.Destroy<File>(GetHandle());
182 break; 176 break;
183 } 177 }
184 178
185 // Unknown command... 179 // Unknown command...
186 default: 180 default:
187 ERROR_LOG(KERNEL, "Unknown command=0x%08X!", cmd); 181 LOG_ERROR(Service_FS, "Unknown command=0x%08X!", cmd);
188 ResultCode error = UnimplementedFunction(ErrorModule::FS); 182 ResultCode error = UnimplementedFunction(ErrorModule::FS);
189 cmd_buff[1] = error.raw; // TODO(Link Mauve): use the correct error code for that. 183 cmd_buff[1] = error.raw; // TODO(Link Mauve): use the correct error code for that.
190 return error; 184 return error;
@@ -192,12 +186,6 @@ public:
192 cmd_buff[1] = 0; // No error 186 cmd_buff[1] = 0; // No error
193 return MakeResult<bool>(false); 187 return MakeResult<bool>(false);
194 } 188 }
195
196 ResultVal<bool> WaitSynchronization() override {
197 // TODO(bunnei): ImplementMe
198 ERROR_LOG(OSHLE, "(UNIMPLEMENTED)");
199 return UnimplementedFunction(ErrorModule::FS);
200 }
201}; 189};
202 190
203class Directory : public Object { 191class Directory : public Object {
@@ -222,7 +210,7 @@ public:
222 u32 count = cmd_buff[1]; 210 u32 count = cmd_buff[1];
223 u32 address = cmd_buff[3]; 211 u32 address = cmd_buff[3];
224 auto entries = reinterpret_cast<FileSys::Entry*>(Memory::GetPointer(address)); 212 auto entries = reinterpret_cast<FileSys::Entry*>(Memory::GetPointer(address));
225 DEBUG_LOG(KERNEL, "Read %s %s: count=%d", 213 LOG_TRACE(Service_FS, "Read %s %s: count=%d",
226 GetTypeName().c_str(), GetName().c_str(), count); 214 GetTypeName().c_str(), GetName().c_str(), count);
227 215
228 // Number of entries actually read 216 // Number of entries actually read
@@ -232,14 +220,14 @@ public:
232 220
233 case DirectoryCommand::Close: 221 case DirectoryCommand::Close:
234 { 222 {
235 DEBUG_LOG(KERNEL, "Close %s %s", GetTypeName().c_str(), GetName().c_str()); 223 LOG_TRACE(Service_FS, "Close %s %s", GetTypeName().c_str(), GetName().c_str());
236 Kernel::g_object_pool.Destroy<Directory>(GetHandle()); 224 Kernel::g_object_pool.Destroy<Directory>(GetHandle());
237 break; 225 break;
238 } 226 }
239 227
240 // Unknown command... 228 // Unknown command...
241 default: 229 default:
242 ERROR_LOG(KERNEL, "Unknown command=0x%08X!", cmd); 230 LOG_ERROR(Service_FS, "Unknown command=0x%08X!", cmd);
243 ResultCode error = UnimplementedFunction(ErrorModule::FS); 231 ResultCode error = UnimplementedFunction(ErrorModule::FS);
244 cmd_buff[1] = error.raw; // TODO(Link Mauve): use the correct error code for that. 232 cmd_buff[1] = error.raw; // TODO(Link Mauve): use the correct error code for that.
245 return error; 233 return error;
@@ -247,12 +235,6 @@ public:
247 cmd_buff[1] = 0; // No error 235 cmd_buff[1] = 0; // No error
248 return MakeResult<bool>(false); 236 return MakeResult<bool>(false);
249 } 237 }
250
251 ResultVal<bool> WaitSynchronization() override {
252 // TODO(bunnei): ImplementMe
253 ERROR_LOG(OSHLE, "(UNIMPLEMENTED)");
254 return UnimplementedFunction(ErrorModule::FS);
255 }
256}; 238};
257 239
258//////////////////////////////////////////////////////////////////////////////////////////////////// 240////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -272,11 +254,11 @@ ResultVal<Handle> OpenArchive(FileSys::Archive::IdCode id_code) {
272ResultCode CloseArchive(FileSys::Archive::IdCode id_code) { 254ResultCode CloseArchive(FileSys::Archive::IdCode id_code) {
273 auto itr = g_archive_map.find(id_code); 255 auto itr = g_archive_map.find(id_code);
274 if (itr == g_archive_map.end()) { 256 if (itr == g_archive_map.end()) {
275 ERROR_LOG(KERNEL, "Cannot close archive %d, does not exist!", (int)id_code); 257 LOG_ERROR(Service_FS, "Cannot close archive %d, does not exist!", (int)id_code);
276 return InvalidHandle(ErrorModule::FS); 258 return InvalidHandle(ErrorModule::FS);
277 } 259 }
278 260
279 INFO_LOG(KERNEL, "Closed archive %d", (int) id_code); 261 LOG_TRACE(Service_FS, "Closed archive %d", (int) id_code);
280 return RESULT_SUCCESS; 262 return RESULT_SUCCESS;
281} 263}
282 264
@@ -288,11 +270,11 @@ ResultCode MountArchive(Archive* archive) {
288 FileSys::Archive::IdCode id_code = archive->backend->GetIdCode(); 270 FileSys::Archive::IdCode id_code = archive->backend->GetIdCode();
289 ResultVal<Handle> archive_handle = OpenArchive(id_code); 271 ResultVal<Handle> archive_handle = OpenArchive(id_code);
290 if (archive_handle.Succeeded()) { 272 if (archive_handle.Succeeded()) {
291 ERROR_LOG(KERNEL, "Cannot mount two archives with the same ID code! (%d)", (int) id_code); 273 LOG_ERROR(Service_FS, "Cannot mount two archives with the same ID code! (%d)", (int) id_code);
292 return archive_handle.Code(); 274 return archive_handle.Code();
293 } 275 }
294 g_archive_map[id_code] = archive->GetHandle(); 276 g_archive_map[id_code] = archive->GetHandle();
295 INFO_LOG(KERNEL, "Mounted archive %s", archive->GetName().c_str()); 277 LOG_TRACE(Service_FS, "Mounted archive %s", archive->GetName().c_str());
296 return RESULT_SUCCESS; 278 return RESULT_SUCCESS;
297} 279}
298 280
@@ -442,7 +424,7 @@ void ArchiveInit() {
442 if (archive->Initialize()) 424 if (archive->Initialize())
443 CreateArchive(archive, "SDMC"); 425 CreateArchive(archive, "SDMC");
444 else 426 else
445 ERROR_LOG(KERNEL, "Can't instantiate SDMC archive with path %s", sdmc_directory.c_str()); 427 LOG_ERROR(Service_FS, "Can't instantiate SDMC archive with path %s", sdmc_directory.c_str());
446} 428}
447 429
448/// Shutdown archives 430/// Shutdown archives
diff --git a/src/core/hle/kernel/kernel.cpp b/src/core/hle/kernel/kernel.cpp
index 80a34c2d5..b38be0a49 100644
--- a/src/core/hle/kernel/kernel.cpp
+++ b/src/core/hle/kernel/kernel.cpp
@@ -35,7 +35,7 @@ Handle ObjectPool::Create(Object* obj, int range_bottom, int range_top) {
35 return i + HANDLE_OFFSET; 35 return i + HANDLE_OFFSET;
36 } 36 }
37 } 37 }
38 ERROR_LOG(HLE, "Unable to allocate kernel object, too many objects slots in use."); 38 LOG_ERROR(Kernel, "Unable to allocate kernel object, too many objects slots in use.");
39 return 0; 39 return 0;
40} 40}
41 41
@@ -62,7 +62,7 @@ void ObjectPool::Clear() {
62 62
63Object* &ObjectPool::operator [](Handle handle) 63Object* &ObjectPool::operator [](Handle handle)
64{ 64{
65 _dbg_assert_msg_(KERNEL, IsValid(handle), "GRABBING UNALLOCED KERNEL OBJ"); 65 _dbg_assert_msg_(Kernel, IsValid(handle), "GRABBING UNALLOCED KERNEL OBJ");
66 return pool[handle - HANDLE_OFFSET]; 66 return pool[handle - HANDLE_OFFSET];
67} 67}
68 68
@@ -70,7 +70,7 @@ void ObjectPool::List() {
70 for (int i = 0; i < MAX_COUNT; i++) { 70 for (int i = 0; i < MAX_COUNT; i++) {
71 if (occupied[i]) { 71 if (occupied[i]) {
72 if (pool[i]) { 72 if (pool[i]) {
73 INFO_LOG(KERNEL, "KO %i: %s \"%s\"", i + HANDLE_OFFSET, pool[i]->GetTypeName().c_str(), 73 LOG_DEBUG(Kernel, "KO %i: %s \"%s\"", i + HANDLE_OFFSET, pool[i]->GetTypeName().c_str(),
74 pool[i]->GetName().c_str()); 74 pool[i]->GetName().c_str());
75 } 75 }
76 } 76 }
@@ -82,7 +82,7 @@ int ObjectPool::GetCount() const {
82} 82}
83 83
84Object* ObjectPool::CreateByIDType(int type) { 84Object* ObjectPool::CreateByIDType(int type) {
85 ERROR_LOG(COMMON, "Unimplemented: %d.", type); 85 LOG_ERROR(Kernel, "Unimplemented: %d.", type);
86 return nullptr; 86 return nullptr;
87} 87}
88 88
diff --git a/src/core/hle/kernel/kernel.h b/src/core/hle/kernel/kernel.h
index 00a2228bf..00f9b57fc 100644
--- a/src/core/hle/kernel/kernel.h
+++ b/src/core/hle/kernel/kernel.h
@@ -57,7 +57,7 @@ public:
57 * @return True if the current thread should wait as a result of the sync 57 * @return True if the current thread should wait as a result of the sync
58 */ 58 */
59 virtual ResultVal<bool> SyncRequest() { 59 virtual ResultVal<bool> SyncRequest() {
60 ERROR_LOG(KERNEL, "(UNIMPLEMENTED)"); 60 LOG_ERROR(Kernel, "(UNIMPLEMENTED)");
61 return UnimplementedFunction(ErrorModule::Kernel); 61 return UnimplementedFunction(ErrorModule::Kernel);
62 } 62 }
63 63
@@ -65,7 +65,10 @@ public:
65 * Wait for kernel object to synchronize. 65 * Wait for kernel object to synchronize.
66 * @return True if the current thread should wait as a result of the wait 66 * @return True if the current thread should wait as a result of the wait
67 */ 67 */
68 virtual ResultVal<bool> WaitSynchronization() = 0; 68 virtual ResultVal<bool> WaitSynchronization() {
69 LOG_ERROR(Kernel, "(UNIMPLEMENTED)");
70 return UnimplementedFunction(ErrorModule::Kernel);
71 }
69}; 72};
70 73
71class ObjectPool : NonCopyable { 74class ObjectPool : NonCopyable {
@@ -92,13 +95,13 @@ public:
92 T* Get(Handle handle) { 95 T* Get(Handle handle) {
93 if (handle < HANDLE_OFFSET || handle >= HANDLE_OFFSET + MAX_COUNT || !occupied[handle - HANDLE_OFFSET]) { 96 if (handle < HANDLE_OFFSET || handle >= HANDLE_OFFSET + MAX_COUNT || !occupied[handle - HANDLE_OFFSET]) {
94 if (handle != 0) { 97 if (handle != 0) {
95 WARN_LOG(KERNEL, "Kernel: Bad object handle %i (%08x)", handle, handle); 98 LOG_ERROR(Kernel, "Bad object handle %08x", handle, handle);
96 } 99 }
97 return nullptr; 100 return nullptr;
98 } else { 101 } else {
99 Object* t = pool[handle - HANDLE_OFFSET]; 102 Object* t = pool[handle - HANDLE_OFFSET];
100 if (t->GetHandleType() != T::GetStaticHandleType()) { 103 if (t->GetHandleType() != T::GetStaticHandleType()) {
101 WARN_LOG(KERNEL, "Kernel: Wrong object type for %i (%08x)", handle, handle); 104 LOG_ERROR(Kernel, "Wrong object type for %08x", handle, handle);
102 return nullptr; 105 return nullptr;
103 } 106 }
104 return static_cast<T*>(t); 107 return static_cast<T*>(t);
@@ -109,7 +112,7 @@ public:
109 template <class T> 112 template <class T>
110 T *GetFast(Handle handle) { 113 T *GetFast(Handle handle) {
111 const Handle realHandle = handle - HANDLE_OFFSET; 114 const Handle realHandle = handle - HANDLE_OFFSET;
112 _dbg_assert_(KERNEL, realHandle >= 0 && realHandle < MAX_COUNT && occupied[realHandle]); 115 _dbg_assert_(Kernel, realHandle >= 0 && realHandle < MAX_COUNT && occupied[realHandle]);
113 return static_cast<T*>(pool[realHandle]); 116 return static_cast<T*>(pool[realHandle]);
114 } 117 }
115 118
@@ -130,8 +133,8 @@ public:
130 133
131 bool GetIDType(Handle handle, HandleType* type) const { 134 bool GetIDType(Handle handle, HandleType* type) const {
132 if ((handle < HANDLE_OFFSET) || (handle >= HANDLE_OFFSET + MAX_COUNT) || 135 if ((handle < HANDLE_OFFSET) || (handle >= HANDLE_OFFSET + MAX_COUNT) ||
133 !occupied[handle - HANDLE_OFFSET]) { 136 !occupied[handle - HANDLE_OFFSET]) {
134 ERROR_LOG(KERNEL, "Kernel: Bad object handle %i (%08x)", handle, handle); 137 LOG_ERROR(Kernel, "Bad object handle %08X", handle, handle);
135 return false; 138 return false;
136 } 139 }
137 Object* t = pool[handle - HANDLE_OFFSET]; 140 Object* t = pool[handle - HANDLE_OFFSET];
diff --git a/src/core/hle/kernel/shared_memory.cpp b/src/core/hle/kernel/shared_memory.cpp
index cfcc0e0b7..3c8c502c6 100644
--- a/src/core/hle/kernel/shared_memory.cpp
+++ b/src/core/hle/kernel/shared_memory.cpp
@@ -16,12 +16,6 @@ public:
16 static Kernel::HandleType GetStaticHandleType() { return Kernel::HandleType::SharedMemory; } 16 static Kernel::HandleType GetStaticHandleType() { return Kernel::HandleType::SharedMemory; }
17 Kernel::HandleType GetHandleType() const override { return Kernel::HandleType::SharedMemory; } 17 Kernel::HandleType GetHandleType() const override { return Kernel::HandleType::SharedMemory; }
18 18
19 ResultVal<bool> WaitSynchronization() override {
20 // TODO(bunnei): ImplementMe
21 ERROR_LOG(OSHLE, "(UNIMPLEMENTED)");
22 return UnimplementedFunction(ErrorModule::OS);
23 }
24
25 u32 base_address; ///< Address of shared memory block in RAM 19 u32 base_address; ///< Address of shared memory block in RAM
26 MemoryPermission permissions; ///< Permissions of shared memory block (SVC field) 20 MemoryPermission permissions; ///< Permissions of shared memory block (SVC field)
27 MemoryPermission other_permissions; ///< Other permissions of shared memory block (SVC field) 21 MemoryPermission other_permissions; ///< Other permissions of shared memory block (SVC field)
@@ -61,7 +55,7 @@ ResultCode MapSharedMemory(u32 handle, u32 address, MemoryPermission permissions
61 MemoryPermission other_permissions) { 55 MemoryPermission other_permissions) {
62 56
63 if (address < Memory::SHARED_MEMORY_VADDR || address >= Memory::SHARED_MEMORY_VADDR_END) { 57 if (address < Memory::SHARED_MEMORY_VADDR || address >= Memory::SHARED_MEMORY_VADDR_END) {
64 ERROR_LOG(KERNEL, "cannot map handle=0x%08X, address=0x%08X outside of shared mem bounds!", 58 LOG_ERROR(Kernel_SVC, "cannot map handle=0x%08X, address=0x%08X outside of shared mem bounds!",
65 handle, address); 59 handle, address);
66 return ResultCode(ErrorDescription::InvalidAddress, ErrorModule::Kernel, 60 return ResultCode(ErrorDescription::InvalidAddress, ErrorModule::Kernel,
67 ErrorSummary::InvalidArgument, ErrorLevel::Permanent); 61 ErrorSummary::InvalidArgument, ErrorLevel::Permanent);
@@ -83,7 +77,7 @@ ResultVal<u8*> GetSharedMemoryPointer(Handle handle, u32 offset) {
83 if (0 != shared_memory->base_address) 77 if (0 != shared_memory->base_address)
84 return MakeResult<u8*>(Memory::GetPointer(shared_memory->base_address + offset)); 78 return MakeResult<u8*>(Memory::GetPointer(shared_memory->base_address + offset));
85 79
86 ERROR_LOG(KERNEL, "memory block handle=0x%08X not mapped!", handle); 80 LOG_ERROR(Kernel_SVC, "memory block handle=0x%08X not mapped!", handle);
87 // TODO(yuriks): Verify error code. 81 // TODO(yuriks): Verify error code.
88 return ResultCode(ErrorDescription::InvalidAddress, ErrorModule::Kernel, 82 return ResultCode(ErrorDescription::InvalidAddress, ErrorModule::Kernel,
89 ErrorSummary::InvalidState, ErrorLevel::Permanent); 83 ErrorSummary::InvalidState, ErrorLevel::Permanent);
diff --git a/src/core/hle/kernel/thread.cpp b/src/core/hle/kernel/thread.cpp
index 492b917e1..1c04701de 100644
--- a/src/core/hle/kernel/thread.cpp
+++ b/src/core/hle/kernel/thread.cpp
@@ -150,13 +150,13 @@ void ChangeReadyState(Thread* t, bool ready) {
150 150
151/// Verify that a thread has not been released from waiting 151/// Verify that a thread has not been released from waiting
152static bool VerifyWait(const Thread* thread, WaitType type, Handle wait_handle) { 152static bool VerifyWait(const Thread* thread, WaitType type, Handle wait_handle) {
153 _dbg_assert_(KERNEL, thread != nullptr); 153 _dbg_assert_(Kernel, thread != nullptr);
154 return (type == thread->wait_type) && (wait_handle == thread->wait_handle) && (thread->IsWaiting()); 154 return (type == thread->wait_type) && (wait_handle == thread->wait_handle) && (thread->IsWaiting());
155} 155}
156 156
157/// Verify that a thread has not been released from waiting (with wait address) 157/// Verify that a thread has not been released from waiting (with wait address)
158static bool VerifyWait(const Thread* thread, WaitType type, Handle wait_handle, VAddr wait_address) { 158static bool VerifyWait(const Thread* thread, WaitType type, Handle wait_handle, VAddr wait_address) {
159 _dbg_assert_(KERNEL, thread != nullptr); 159 _dbg_assert_(Kernel, thread != nullptr);
160 return VerifyWait(thread, type, wait_handle) && (wait_address == thread->wait_address); 160 return VerifyWait(thread, type, wait_handle) && (wait_address == thread->wait_address);
161} 161}
162 162
@@ -196,7 +196,7 @@ void ChangeThreadState(Thread* t, ThreadStatus new_status) {
196 196
197 if (new_status == THREADSTATUS_WAIT) { 197 if (new_status == THREADSTATUS_WAIT) {
198 if (t->wait_type == WAITTYPE_NONE) { 198 if (t->wait_type == WAITTYPE_NONE) {
199 ERROR_LOG(KERNEL, "Waittype none not allowed"); 199 LOG_ERROR(Kernel, "Waittype none not allowed");
200 } 200 }
201 } 201 }
202} 202}
@@ -318,12 +318,12 @@ void DebugThreadQueue() {
318 if (!thread) { 318 if (!thread) {
319 return; 319 return;
320 } 320 }
321 INFO_LOG(KERNEL, "0x%02X 0x%08X (current)", thread->current_priority, GetCurrentThreadHandle()); 321 LOG_DEBUG(Kernel, "0x%02X 0x%08X (current)", thread->current_priority, GetCurrentThreadHandle());
322 for (u32 i = 0; i < thread_queue.size(); i++) { 322 for (u32 i = 0; i < thread_queue.size(); i++) {
323 Handle handle = thread_queue[i]; 323 Handle handle = thread_queue[i];
324 s32 priority = thread_ready_queue.contains(handle); 324 s32 priority = thread_ready_queue.contains(handle);
325 if (priority != -1) { 325 if (priority != -1) {
326 INFO_LOG(KERNEL, "0x%02X 0x%08X", priority, handle); 326 LOG_DEBUG(Kernel, "0x%02X 0x%08X", priority, handle);
327 } 327 }
328 } 328 }
329} 329}
@@ -333,7 +333,7 @@ Thread* CreateThread(Handle& handle, const char* name, u32 entry_point, s32 prio
333 s32 processor_id, u32 stack_top, int stack_size) { 333 s32 processor_id, u32 stack_top, int stack_size) {
334 334
335 _assert_msg_(KERNEL, (priority >= THREADPRIO_HIGHEST && priority <= THREADPRIO_LOWEST), 335 _assert_msg_(KERNEL, (priority >= THREADPRIO_HIGHEST && priority <= THREADPRIO_LOWEST),
336 "CreateThread priority=%d, outside of allowable range!", priority) 336 "priority=%d, outside of allowable range!", priority)
337 337
338 Thread* thread = new Thread; 338 Thread* thread = new Thread;
339 339
@@ -362,24 +362,24 @@ Handle CreateThread(const char* name, u32 entry_point, s32 priority, u32 arg, s3
362 u32 stack_top, int stack_size) { 362 u32 stack_top, int stack_size) {
363 363
364 if (name == nullptr) { 364 if (name == nullptr) {
365 ERROR_LOG(KERNEL, "CreateThread(): nullptr name"); 365 LOG_ERROR(Kernel_SVC, "nullptr name");
366 return -1; 366 return -1;
367 } 367 }
368 if ((u32)stack_size < 0x200) { 368 if ((u32)stack_size < 0x200) {
369 ERROR_LOG(KERNEL, "CreateThread(name=%s): invalid stack_size=0x%08X", name, 369 LOG_ERROR(Kernel_SVC, "(name=%s): invalid stack_size=0x%08X", name,
370 stack_size); 370 stack_size);
371 return -1; 371 return -1;
372 } 372 }
373 if (priority < THREADPRIO_HIGHEST || priority > THREADPRIO_LOWEST) { 373 if (priority < THREADPRIO_HIGHEST || priority > THREADPRIO_LOWEST) {
374 s32 new_priority = CLAMP(priority, THREADPRIO_HIGHEST, THREADPRIO_LOWEST); 374 s32 new_priority = CLAMP(priority, THREADPRIO_HIGHEST, THREADPRIO_LOWEST);
375 WARN_LOG(KERNEL, "CreateThread(name=%s): invalid priority=0x%08X, clamping to %08X", 375 LOG_WARNING(Kernel_SVC, "(name=%s): invalid priority=%d, clamping to %d",
376 name, priority, new_priority); 376 name, priority, new_priority);
377 // TODO(bunnei): Clamping to a valid priority is not necessarily correct behavior... Confirm 377 // TODO(bunnei): Clamping to a valid priority is not necessarily correct behavior... Confirm
378 // validity of this 378 // validity of this
379 priority = new_priority; 379 priority = new_priority;
380 } 380 }
381 if (!Memory::GetPointer(entry_point)) { 381 if (!Memory::GetPointer(entry_point)) {
382 ERROR_LOG(KERNEL, "CreateThread(name=%s): invalid entry %08x", name, entry_point); 382 LOG_ERROR(Kernel_SVC, "(name=%s): invalid entry %08x", name, entry_point);
383 return -1; 383 return -1;
384 } 384 }
385 Handle handle; 385 Handle handle;
@@ -416,7 +416,7 @@ ResultCode SetThreadPriority(Handle handle, s32 priority) {
416 // If priority is invalid, clamp to valid range 416 // If priority is invalid, clamp to valid range
417 if (priority < THREADPRIO_HIGHEST || priority > THREADPRIO_LOWEST) { 417 if (priority < THREADPRIO_HIGHEST || priority > THREADPRIO_LOWEST) {
418 s32 new_priority = CLAMP(priority, THREADPRIO_HIGHEST, THREADPRIO_LOWEST); 418 s32 new_priority = CLAMP(priority, THREADPRIO_HIGHEST, THREADPRIO_LOWEST);
419 WARN_LOG(KERNEL, "invalid priority=0x%08X, clamping to %08X", priority, new_priority); 419 LOG_WARNING(Kernel_SVC, "invalid priority=%d, clamping to %d", priority, new_priority);
420 // TODO(bunnei): Clamping to a valid priority is not necessarily correct behavior... Confirm 420 // TODO(bunnei): Clamping to a valid priority is not necessarily correct behavior... Confirm
421 // validity of this 421 // validity of this
422 priority = new_priority; 422 priority = new_priority;
@@ -470,7 +470,7 @@ void Reschedule() {
470 Thread* next = NextThread(); 470 Thread* next = NextThread();
471 HLE::g_reschedule = false; 471 HLE::g_reschedule = false;
472 if (next > 0) { 472 if (next > 0) {
473 INFO_LOG(KERNEL, "context switch 0x%08X -> 0x%08X", prev->GetHandle(), next->GetHandle()); 473 LOG_TRACE(Kernel, "context switch 0x%08X -> 0x%08X", prev->GetHandle(), next->GetHandle());
474 474
475 SwitchContext(next); 475 SwitchContext(next);
476 476