diff options
author | Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> | 2014-11-19 09:49:13 +0100 |
---|---|---|
committer | Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> | 2014-11-19 10:03:07 +0100 |
commit | f5d38649c7ad6fedf9db95044e3ad91ce393b8df (patch) | |
tree | 57cd232d34d8f889315331a84f0812e705d2ea88 /src/core/hle/kernel | |
parent | Merge pull request #212 from archshift/idea (diff) | |
download | yuzu-f5d38649c7ad6fedf9db95044e3ad91ce393b8df.tar yuzu-f5d38649c7ad6fedf9db95044e3ad91ce393b8df.tar.gz yuzu-f5d38649c7ad6fedf9db95044e3ad91ce393b8df.tar.bz2 yuzu-f5d38649c7ad6fedf9db95044e3ad91ce393b8df.tar.lz yuzu-f5d38649c7ad6fedf9db95044e3ad91ce393b8df.tar.xz yuzu-f5d38649c7ad6fedf9db95044e3ad91ce393b8df.tar.zst yuzu-f5d38649c7ad6fedf9db95044e3ad91ce393b8df.zip |
Diffstat (limited to 'src/core/hle/kernel')
-rw-r--r-- | src/core/hle/kernel/address_arbiter.h | 2 | ||||
-rw-r--r-- | src/core/hle/kernel/archive.cpp | 6 | ||||
-rw-r--r-- | src/core/hle/kernel/event.cpp | 4 | ||||
-rw-r--r-- | src/core/hle/kernel/event.h | 2 | ||||
-rw-r--r-- | src/core/hle/kernel/kernel.cpp | 6 | ||||
-rw-r--r-- | src/core/hle/kernel/kernel.h | 10 | ||||
-rw-r--r-- | src/core/hle/kernel/mutex.cpp | 4 | ||||
-rw-r--r-- | src/core/hle/kernel/mutex.h | 2 | ||||
-rw-r--r-- | src/core/hle/kernel/shared_memory.cpp | 4 | ||||
-rw-r--r-- | src/core/hle/kernel/shared_memory.h | 4 | ||||
-rw-r--r-- | src/core/hle/kernel/thread.cpp | 38 | ||||
-rw-r--r-- | src/core/hle/kernel/thread.h | 2 |
12 files changed, 42 insertions, 42 deletions
diff --git a/src/core/hle/kernel/address_arbiter.h b/src/core/hle/kernel/address_arbiter.h index a483fe466..6886e479d 100644 --- a/src/core/hle/kernel/address_arbiter.h +++ b/src/core/hle/kernel/address_arbiter.h @@ -11,7 +11,7 @@ // Address arbiters are an underlying kernel synchronization object that can be created/used via // supervisor calls (SVCs). They function as sort of a global lock. Typically, games/other CTR // applications use them as an underlying mechanism to implement thread-safe barriers, events, and -// semphores. +// semphores. //////////////////////////////////////////////////////////////////////////////////////////////////// // Kernel namespace diff --git a/src/core/hle/kernel/archive.cpp b/src/core/hle/kernel/archive.cpp index 8f1c95d0f..d9ee4682a 100644 --- a/src/core/hle/kernel/archive.cpp +++ b/src/core/hle/kernel/archive.cpp @@ -52,14 +52,14 @@ public: FileSys::Archive* backend; ///< Archive backend interface /** - * Synchronize kernel object + * Synchronize kernel object * @param wait Boolean wait set if current thread should wait as a result of sync operation * @return Result of operation, 0 on success, otherwise error code */ Result SyncRequest(bool* wait) override { u32* cmd_buff = Service::GetCommandBuffer(); FileCommand cmd = static_cast<FileCommand>(cmd_buff[0]); - + switch (cmd) { // Read from archive... case FileCommand::Read: @@ -343,7 +343,7 @@ Archive* CreateArchive(Handle& handle, FileSys::Archive* backend, const std::str archive->backend = backend; MountArchive(archive); - + return archive; } diff --git a/src/core/hle/kernel/event.cpp b/src/core/hle/kernel/event.cpp index 45ed79be8..e0117c0bc 100644 --- a/src/core/hle/kernel/event.cpp +++ b/src/core/hle/kernel/event.cpp @@ -1,6 +1,6 @@ // Copyright 2014 Citra Emulator Project // Licensed under GPLv2 -// Refer to the license.txt file included. +// Refer to the license.txt file included. #include <map> #include <algorithm> @@ -95,7 +95,7 @@ Result SignalEvent(const Handle handle) { for (size_t i = 0; i < evt->waiting_threads.size(); ++i) { ResumeThreadFromWait( evt->waiting_threads[i]); - // If any thread is signalled awake by this event, assume the event was "caught" and reset + // If any thread is signalled awake by this event, assume the event was "caught" and reset // the event. This will result in the next thread waiting on the event to block. Otherwise, // the event will not be reset, and the next thread to call WaitSynchronization on it will // not block. Not sure if this is correct behavior, but it seems to work. diff --git a/src/core/hle/kernel/event.h b/src/core/hle/kernel/event.h index c39b33180..6add72897 100644 --- a/src/core/hle/kernel/event.h +++ b/src/core/hle/kernel/event.h @@ -1,6 +1,6 @@ // Copyright 2014 Citra Emulator Project // Licensed under GPLv2 -// Refer to the license.txt file included. +// Refer to the license.txt file included. #pragma once diff --git a/src/core/hle/kernel/kernel.cpp b/src/core/hle/kernel/kernel.cpp index 88cbc1af5..018000abd 100644 --- a/src/core/hle/kernel/kernel.cpp +++ b/src/core/hle/kernel/kernel.cpp @@ -1,6 +1,6 @@ // Copyright 2014 Citra Emulator Project / PPSSPP Project // Licensed under GPLv2 -// Refer to the license.txt file included. +// Refer to the license.txt file included. #include "common/common.h" @@ -68,7 +68,7 @@ void ObjectPool::List() { for (int i = 0; i < MAX_COUNT; i++) { if (occupied[i]) { if (pool[i]) { - INFO_LOG(KERNEL, "KO %i: %s \"%s\"", i + HANDLE_OFFSET, pool[i]->GetTypeName().c_str(), + INFO_LOG(KERNEL, "KO %i: %s \"%s\"", i + HANDLE_OFFSET, pool[i]->GetTypeName().c_str(), pool[i]->GetName().c_str()); } } @@ -110,7 +110,7 @@ void Shutdown() { */ bool LoadExec(u32 entry_point) { Init(); - + Core::g_app_core->SetPC(entry_point); // 0x30 is the typical main thread priority I've seen used so far diff --git a/src/core/hle/kernel/kernel.h b/src/core/hle/kernel/kernel.h index dd7c91d4f..e0c94f186 100644 --- a/src/core/hle/kernel/kernel.h +++ b/src/core/hle/kernel/kernel.h @@ -1,6 +1,6 @@ // Copyright 2014 Citra Emulator Project / PPSSPP Project // Licensed under GPLv2 -// Refer to the license.txt file included. +// Refer to the license.txt file included. #pragma once @@ -34,7 +34,7 @@ enum class HandleType : u32 { Archive = 12, Directory = 13, }; - + enum { DEFAULT_STACK_SIZE = 0x4000, }; @@ -52,7 +52,7 @@ public: virtual Kernel::HandleType GetHandleType() const = 0; /** - * Synchronize kernel object + * Synchronize kernel object * @param wait Boolean wait set if current thread should wait as a result of sync operation * @return Result of operation, 0 on success, otherwise error code */ @@ -139,7 +139,7 @@ public: } bool GetIDType(Handle handle, HandleType* type) const { - if ((handle < HANDLE_OFFSET) || (handle >= HANDLE_OFFSET + MAX_COUNT) || + if ((handle < HANDLE_OFFSET) || (handle >= HANDLE_OFFSET + MAX_COUNT) || !occupied[handle - HANDLE_OFFSET]) { ERROR_LOG(KERNEL, "Kernel: Bad object handle %i (%08x)", handle, handle); return false; @@ -155,7 +155,7 @@ public: int GetCount(); private: - + enum { MAX_COUNT = 0x1000, HANDLE_OFFSET = 0x100, diff --git a/src/core/hle/kernel/mutex.cpp b/src/core/hle/kernel/mutex.cpp index fcfd061ac..31129fd86 100644 --- a/src/core/hle/kernel/mutex.cpp +++ b/src/core/hle/kernel/mutex.cpp @@ -1,6 +1,6 @@ // Copyright 2014 Citra Emulator Project // Licensed under GPLv2 -// Refer to the license.txt file included. +// Refer to the license.txt file included. #include <map> #include <vector> @@ -28,7 +28,7 @@ public: std::string name; ///< Name of mutex (optional) /** - * Synchronize kernel object + * Synchronize kernel object * @param wait Boolean wait set if current thread should wait as a result of sync operation * @return Result of operation, 0 on success, otherwise error code */ diff --git a/src/core/hle/kernel/mutex.h b/src/core/hle/kernel/mutex.h index 7d7b5137e..313ba6fee 100644 --- a/src/core/hle/kernel/mutex.h +++ b/src/core/hle/kernel/mutex.h @@ -1,6 +1,6 @@ // Copyright 2014 Citra Emulator Project // Licensed under GPLv2 -// Refer to the license.txt file included. +// Refer to the license.txt file included. #pragma once diff --git a/src/core/hle/kernel/shared_memory.cpp b/src/core/hle/kernel/shared_memory.cpp index f538c6550..7ef3e54cc 100644 --- a/src/core/hle/kernel/shared_memory.cpp +++ b/src/core/hle/kernel/shared_memory.cpp @@ -1,6 +1,6 @@ // Copyright 2014 Citra Emulator Project // Licensed under GPLv2 -// Refer to the license.txt file included. +// Refer to the license.txt file included. #include "common/common.h" @@ -67,7 +67,7 @@ Handle CreateSharedMemory(const std::string& name) { * @param other_permissions Memory block map other permissions (specified by SVC field) * @return Result of operation, 0 on success, otherwise error code */ -Result MapSharedMemory(u32 handle, u32 address, MemoryPermission permissions, +Result MapSharedMemory(u32 handle, u32 address, MemoryPermission permissions, MemoryPermission other_permissions) { if (address < Memory::SHARED_MEMORY_VADDR || address >= Memory::SHARED_MEMORY_VADDR_END) { diff --git a/src/core/hle/kernel/shared_memory.h b/src/core/hle/kernel/shared_memory.h index 5312b8854..0aec03538 100644 --- a/src/core/hle/kernel/shared_memory.h +++ b/src/core/hle/kernel/shared_memory.h @@ -1,6 +1,6 @@ // Copyright 2014 Citra Emulator Project // Licensed under GPLv2 -// Refer to the license.txt file included. +// Refer to the license.txt file included. #pragma once @@ -34,7 +34,7 @@ Handle CreateSharedMemory(const std::string& name="Unknown"); * @param other_permissions Memory block map other permissions (specified by SVC field) * @return Result of operation, 0 on success, otherwise error code */ -Result MapSharedMemory(u32 handle, u32 address, MemoryPermission permissions, +Result MapSharedMemory(u32 handle, u32 address, MemoryPermission permissions, MemoryPermission other_permissions); /** diff --git a/src/core/hle/kernel/thread.cpp b/src/core/hle/kernel/thread.cpp index e15590c49..9e2e15c8e 100644 --- a/src/core/hle/kernel/thread.cpp +++ b/src/core/hle/kernel/thread.cpp @@ -1,6 +1,6 @@ // Copyright 2014 Citra Emulator Project / PPSSPP Project // Licensed under GPLv2 -// Refer to the license.txt file included. +// Refer to the license.txt file included. #include <algorithm> #include <list> @@ -113,7 +113,7 @@ void ResetThread(Thread* t, u32 arg, s32 lowest_priority) { t->context.pc = t->context.reg_15 = t->entry_point; t->context.sp = t->stack_top; t->context.cpsr = 0x1F; // Usermode - + // TODO(bunnei): This instructs the CPU core to start the execution as if it is "resuming" a // thread. This is somewhat Sky-Eye specific, and should be re-architected in the future to be // agnostic of the CPU core. @@ -148,7 +148,7 @@ inline bool VerifyWait(const Handle& handle, WaitType type, Handle wait_handle) Thread* thread = g_object_pool.GetFast<Thread>(handle); _assert_msg_(KERNEL, (thread != nullptr), "called, but thread is nullptr!"); - if (type != thread->wait_type || wait_handle != thread->wait_handle) + if (type != thread->wait_type || wait_handle != thread->wait_handle) return false; return true; @@ -158,7 +158,7 @@ inline bool VerifyWait(const Handle& handle, WaitType type, Handle wait_handle) void StopThread(Handle handle, const char* reason) { Thread* thread = g_object_pool.GetFast<Thread>(handle); _assert_msg_(KERNEL, (thread != nullptr), "called, but thread is nullptr!"); - + ChangeReadyState(thread, false); thread->status = THREADSTATUS_DORMANT; for (size_t i = 0; i < thread->waiting_threads.size(); ++i) { @@ -181,7 +181,7 @@ void ChangeThreadState(Thread* t, ThreadStatus new_status) { } ChangeReadyState(t, (new_status & THREADSTATUS_READY) != 0); t->status = new_status; - + if (new_status == THREADSTATUS_WAIT) { if (t->wait_type == WAITTYPE_NONE) { ERROR_LOG(KERNEL, "Waittype none not allowed"); @@ -216,7 +216,7 @@ Handle ArbitrateHighestPriorityThread(u32 arbiter, u32 address) { /// Arbitrate all threads currently waiting void ArbitrateAllThreads(u32 arbiter, u32 address) { - + // Iterate through threads, find highest priority thread that is waiting to be arbitrated... for (const auto& handle : g_thread_queue) { @@ -238,11 +238,11 @@ void CallThread(Thread* t) { /// Switches CPU context to that of the specified thread void SwitchContext(Thread* t) { Thread* cur = GetCurrentThread(); - + // Save context for current thread if (cur) { SaveContext(cur->context); - + if (cur->IsRunning()) { ChangeReadyState(cur, true); } @@ -263,7 +263,7 @@ void SwitchContext(Thread* t) { Thread* NextThread() { Handle next; Thread* cur = GetCurrentThread(); - + if (cur && cur->IsRunning()) { next = g_thread_ready_queue.pop_first_better(cur->current_priority); } else { @@ -319,7 +319,7 @@ void DebugThreadQueue() { Thread* CreateThread(Handle& handle, const char* name, u32 entry_point, s32 priority, s32 processor_id, u32 stack_top, int stack_size) { - _assert_msg_(KERNEL, (priority >= THREADPRIO_HIGHEST && priority <= THREADPRIO_LOWEST), + _assert_msg_(KERNEL, (priority >= THREADPRIO_HIGHEST && priority <= THREADPRIO_LOWEST), "CreateThread priority=%d, outside of allowable range!", priority) Thread* thread = new Thread; @@ -351,7 +351,7 @@ Handle CreateThread(const char* name, u32 entry_point, s32 priority, u32 arg, s3 return -1; } if ((u32)stack_size < 0x200) { - ERROR_LOG(KERNEL, "CreateThread(name=%s): invalid stack_size=0x%08X", name, + ERROR_LOG(KERNEL, "CreateThread(name=%s): invalid stack_size=0x%08X", name, stack_size); return -1; } @@ -368,7 +368,7 @@ Handle CreateThread(const char* name, u32 entry_point, s32 priority, u32 arg, s3 return -1; } Handle handle; - Thread* thread = CreateThread(handle, name, entry_point, priority, processor_id, stack_top, + Thread* thread = CreateThread(handle, name, entry_point, priority, processor_id, stack_top, stack_size); ResetThread(thread, arg, 0); @@ -423,19 +423,19 @@ Result SetThreadPriority(Handle handle, s32 priority) { /// Sets up the primary application thread Handle SetupMainThread(s32 priority, int stack_size) { Handle handle; - + // Initialize new "main" thread - Thread* thread = CreateThread(handle, "main", Core::g_app_core->GetPC(), priority, + Thread* thread = CreateThread(handle, "main", Core::g_app_core->GetPC(), priority, THREADPROCESSORID_0, Memory::SCRATCHPAD_VADDR_END, stack_size); - + ResetThread(thread, 0, 0); - + // If running another thread already, set it to "ready" state Thread* cur = GetCurrentThread(); if (cur && cur->IsRunning()) { ChangeReadyState(cur, true); } - + // Run new "main" thread SetCurrentThread(thread); thread->status = THREADSTATUS_RUNNING; @@ -452,12 +452,12 @@ void Reschedule() { HLE::g_reschedule = false; if (next > 0) { INFO_LOG(KERNEL, "context switch 0x%08X -> 0x%08X", prev->GetHandle(), next->GetHandle()); - + SwitchContext(next); // Hack - There is no mechanism yet to waken the primary thread if it has been put to sleep // by a simulated VBLANK thread switch. So, we'll just immediately set it to "ready" again. - // This results in the current thread yielding on a VBLANK once, and then it will be + // This results in the current thread yielding on a VBLANK once, and then it will be // immediately placed back in the queue for execution. if (prev->wait_type == WAITTYPE_VBLANK) { ResumeThreadFromWait(prev->GetHandle()); diff --git a/src/core/hle/kernel/thread.h b/src/core/hle/kernel/thread.h index 39fa38b75..2a43797ee 100644 --- a/src/core/hle/kernel/thread.h +++ b/src/core/hle/kernel/thread.h @@ -1,6 +1,6 @@ // Copyright 2014 Citra Emulator Project / PPSSPP Project // Licensed under GPLv2 -// Refer to the license.txt file included. +// Refer to the license.txt file included. #pragma once |