diff options
Diffstat (limited to 'src/core/hle/svc.cpp')
-rw-r--r-- | src/core/hle/svc.cpp | 80 |
1 files changed, 40 insertions, 40 deletions
diff --git a/src/core/hle/svc.cpp b/src/core/hle/svc.cpp index 1eda36c53..3a06d6765 100644 --- a/src/core/hle/svc.cpp +++ b/src/core/hle/svc.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> @@ -29,8 +29,8 @@ enum ControlMemoryOperation { }; /// Map application or GSP heap memory -Result ControlMemory(u32* out_addr, u32 operation, u32 addr0, u32 addr1, u32 size, u32 permissions) { - DEBUG_LOG(SVC,"called operation=0x%08X, addr0=0x%08X, addr1=0x%08X, size=%08X, permissions=0x%08X", +static Result ControlMemory(u32* out_addr, u32 operation, u32 addr0, u32 addr1, u32 size, u32 permissions) { + DEBUG_LOG(SVC,"called operation=0x%08X, addr0=0x%08X, addr1=0x%08X, size=%08X, permissions=0x%08X", operation, addr0, addr1, size, permissions); switch (operation) { @@ -53,8 +53,8 @@ Result ControlMemory(u32* out_addr, u32 operation, u32 addr0, u32 addr1, u32 siz } /// Maps a memory block to specified address -Result MapMemoryBlock(Handle handle, u32 addr, u32 permissions, u32 other_permissions) { - DEBUG_LOG(SVC, "called memblock=0x%08X, addr=0x%08X, mypermissions=0x%08X, otherpermission=%d", +static Result MapMemoryBlock(Handle handle, u32 addr, u32 permissions, u32 other_permissions) { + DEBUG_LOG(SVC, "called memblock=0x%08X, addr=0x%08X, mypermissions=0x%08X, otherpermission=%d", handle, addr, permissions, other_permissions); Kernel::MemoryPermission permissions_type = static_cast<Kernel::MemoryPermission>(permissions); @@ -63,7 +63,7 @@ Result MapMemoryBlock(Handle handle, u32 addr, u32 permissions, u32 other_permis case Kernel::MemoryPermission::Write: case Kernel::MemoryPermission::ReadWrite: case Kernel::MemoryPermission::DontCare: - Kernel::MapSharedMemory(handle, addr, permissions_type, + Kernel::MapSharedMemory(handle, addr, permissions_type, static_cast<Kernel::MemoryPermission>(other_permissions)); break; default: @@ -73,7 +73,7 @@ Result MapMemoryBlock(Handle handle, u32 addr, u32 permissions, u32 other_permis } /// Connect to an OS service given the port name, returns the handle to the port to out -Result ConnectToPort(Handle* out, const char* port_name) { +static Result ConnectToPort(Handle* out, const char* port_name) { Service::Interface* service = Service::g_manager->FetchFromPortName(port_name); DEBUG_LOG(SVC, "called port_name=%s", port_name); @@ -85,7 +85,7 @@ Result ConnectToPort(Handle* out, const char* port_name) { } /// Synchronize to an OS service -Result SendSyncRequest(Handle handle) { +static Result SendSyncRequest(Handle handle) { Kernel::Object* object = Kernel::g_object_pool.GetFast<Kernel::Object>(handle); _assert_msg_(KERNEL, (object != nullptr), "called, but kernel object is nullptr!"); @@ -101,21 +101,21 @@ Result SendSyncRequest(Handle handle) { } /// Close a handle -Result CloseHandle(Handle handle) { +static Result CloseHandle(Handle handle) { // ImplementMe ERROR_LOG(SVC, "(UNIMPLEMENTED) called handle=0x%08X", handle); return 0; } /// Wait for a handle to synchronize, timeout after the specified nanoseconds -Result WaitSynchronization1(Handle handle, s64 nano_seconds) { +static Result WaitSynchronization1(Handle handle, s64 nano_seconds) { // TODO(bunnei): Do something with nano_seconds, currently ignoring this bool wait = false; bool wait_infinite = (nano_seconds == -1); // Used to wait until a thread has terminated Kernel::Object* object = Kernel::g_object_pool.GetFast<Kernel::Object>(handle); - DEBUG_LOG(SVC, "called handle=0x%08X(%s:%s), nanoseconds=%lld", handle, object->GetTypeName().c_str(), + DEBUG_LOG(SVC, "called handle=0x%08X(%s:%s), nanoseconds=%lld", handle, object->GetTypeName().c_str(), object->GetName().c_str(), nano_seconds); _assert_msg_(KERNEL, (object != nullptr), "called, but kernel object is nullptr!"); @@ -132,13 +132,13 @@ Result WaitSynchronization1(Handle handle, s64 nano_seconds) { } /// Wait for the given handles to synchronize, timeout after the specified nanoseconds -Result WaitSynchronizationN(s32* out, Handle* handles, s32 handle_count, bool wait_all, +static Result WaitSynchronizationN(s32* out, Handle* handles, s32 handle_count, bool wait_all, s64 nano_seconds) { // TODO(bunnei): Do something with nano_seconds, currently ignoring this bool unlock_all = true; bool wait_infinite = (nano_seconds == -1); // Used to wait until a thread has terminated - DEBUG_LOG(SVC, "called handle_count=%d, wait_all=%s, nanoseconds=%lld", + DEBUG_LOG(SVC, "called handle_count=%d, wait_all=%s, nanoseconds=%lld", handle_count, (wait_all ? "true" : "false"), nano_seconds); // Iterate through each handle, synchronize kernel object @@ -149,7 +149,7 @@ Result WaitSynchronizationN(s32* out, Handle* handles, s32 handle_count, bool wa _assert_msg_(KERNEL, (object != nullptr), "called handle=0x%08X, but kernel object " "is nullptr!", handles[i]); - DEBUG_LOG(SVC, "\thandle[%d] = 0x%08X(%s:%s)", i, handles[i], object->GetTypeName().c_str(), + DEBUG_LOG(SVC, "\thandle[%d] = 0x%08X(%s:%s)", i, handles[i], object->GetTypeName().c_str(), object->GetName().c_str()); Result res = object->WaitSynchronization(&wait); @@ -174,7 +174,7 @@ Result WaitSynchronizationN(s32* out, Handle* handles, s32 handle_count, bool wa } /// Create an address arbiter (to allocate access to shared resources) -Result CreateAddressArbiter(u32* arbiter) { +static Result CreateAddressArbiter(u32* arbiter) { DEBUG_LOG(SVC, "called"); Handle handle = Kernel::CreateAddressArbiter(); *arbiter = handle; @@ -182,20 +182,20 @@ Result CreateAddressArbiter(u32* arbiter) { } /// Arbitrate address -Result ArbitrateAddress(Handle arbiter, u32 address, u32 type, u32 value, s64 nanoseconds) { - return Kernel::ArbitrateAddress(arbiter, static_cast<Kernel::ArbitrationType>(type), address, +static Result ArbitrateAddress(Handle arbiter, u32 address, u32 type, u32 value, s64 nanoseconds) { + return Kernel::ArbitrateAddress(arbiter, static_cast<Kernel::ArbitrationType>(type), address, value); } /// Used to output a message on a debug hardware unit - does nothing on a retail unit -void OutputDebugString(const char* string) { +static void OutputDebugString(const char* string) { OS_LOG(SVC, "%s", string); } /// Get resource limit -Result GetResourceLimit(Handle* resource_limit, Handle process) { +static Result GetResourceLimit(Handle* resource_limit, Handle process) { // With regards to proceess values: - // 0xFFFF8001 is a handle alias for the current KProcess, and 0xFFFF8000 is a handle alias for + // 0xFFFF8001 is a handle alias for the current KProcess, and 0xFFFF8000 is a handle alias for // the current KThread. *resource_limit = 0xDEADBEEF; ERROR_LOG(SVC, "(UNIMPLEMENTED) called process=0x%08X", process); @@ -203,7 +203,7 @@ Result GetResourceLimit(Handle* resource_limit, Handle process) { } /// Get resource limit current values -Result GetResourceLimitCurrentValues(s64* values, Handle resource_limit, void* names, +static Result GetResourceLimitCurrentValues(s64* values, Handle resource_limit, void* names, s32 name_count) { ERROR_LOG(SVC, "(UNIMPLEMENTED) called resource_limit=%08X, names=%s, name_count=%d", resource_limit, names, name_count); @@ -212,7 +212,7 @@ Result GetResourceLimitCurrentValues(s64* values, Handle resource_limit, void* n } /// Creates a new thread -Result CreateThread(u32 priority, u32 entry_point, u32 arg, u32 stack_top, u32 processor_id) { +static Result CreateThread(u32 priority, u32 entry_point, u32 arg, u32 stack_top, u32 processor_id) { std::string name; if (Symbols::HasSymbol(entry_point)) { TSymbol symbol = Symbols::GetSymbol(entry_point); @@ -227,14 +227,14 @@ Result CreateThread(u32 priority, u32 entry_point, u32 arg, u32 stack_top, u32 p Core::g_app_core->SetReg(1, thread); DEBUG_LOG(SVC, "called entrypoint=0x%08X (%s), arg=0x%08X, stacktop=0x%08X, " - "threadpriority=0x%08X, processorid=0x%08X : created handle=0x%08X", entry_point, + "threadpriority=0x%08X, processorid=0x%08X : created handle=0x%08X", entry_point, name.c_str(), arg, stack_top, priority, processor_id, thread); - + return 0; } /// Called when a thread exits -u32 ExitThread() { +static u32 ExitThread() { Handle thread = Kernel::GetCurrentThreadHandle(); DEBUG_LOG(SVC, "called, pc=0x%08X", Core::g_app_core->GetPC()); // PC = 0x0010545C @@ -245,26 +245,26 @@ u32 ExitThread() { } /// Gets the priority for the specified thread -Result GetThreadPriority(s32* priority, Handle handle) { +static Result GetThreadPriority(s32* priority, Handle handle) { *priority = Kernel::GetThreadPriority(handle); return 0; } /// Sets the priority for the specified thread -Result SetThreadPriority(Handle handle, s32 priority) { +static Result SetThreadPriority(Handle handle, s32 priority) { return Kernel::SetThreadPriority(handle, priority); } /// Create a mutex -Result CreateMutex(Handle* mutex, u32 initial_locked) { +static Result CreateMutex(Handle* mutex, u32 initial_locked) { *mutex = Kernel::CreateMutex((initial_locked != 0)); - DEBUG_LOG(SVC, "called initial_locked=%s : created handle=0x%08X", + DEBUG_LOG(SVC, "called initial_locked=%s : created handle=0x%08X", initial_locked ? "true" : "false", *mutex); return 0; } /// Release a mutex -Result ReleaseMutex(Handle handle) { +static Result ReleaseMutex(Handle handle) { DEBUG_LOG(SVC, "called handle=0x%08X", handle); _assert_msg_(KERNEL, (handle != 0), "called, but handle is nullptr!"); Kernel::ReleaseMutex(handle); @@ -272,27 +272,27 @@ Result ReleaseMutex(Handle handle) { } /// Get current thread ID -Result GetThreadId(u32* thread_id, Handle thread) { +static Result GetThreadId(u32* thread_id, Handle thread) { ERROR_LOG(SVC, "(UNIMPLEMENTED) called thread=0x%08X", thread); return 0; } /// Query memory -Result QueryMemory(void* info, void* out, u32 addr) { +static Result QueryMemory(void* info, void* out, u32 addr) { ERROR_LOG(SVC, "(UNIMPLEMENTED) called addr=0x%08X", addr); return 0; } /// Create an event -Result CreateEvent(Handle* evt, u32 reset_type) { +static Result CreateEvent(Handle* evt, u32 reset_type) { *evt = Kernel::CreateEvent((ResetType)reset_type); - DEBUG_LOG(SVC, "called reset_type=0x%08X : created handle=0x%08X", + DEBUG_LOG(SVC, "called reset_type=0x%08X : created handle=0x%08X", reset_type, *evt); return 0; } /// Duplicates a kernel handle -Result DuplicateHandle(Handle* out, Handle handle) { +static Result DuplicateHandle(Handle* out, Handle handle) { DEBUG_LOG(SVC, "called handle=0x%08X", handle); // Translate kernel handles -> real handles @@ -301,7 +301,7 @@ Result DuplicateHandle(Handle* out, Handle handle) { } _assert_msg_(KERNEL, (handle != Kernel::CurrentProcess), "(UNIMPLEMENTED) process handle duplication!"); - + // TODO(bunnei): FixMe - This is a hack to return the handle that we were asked to duplicate. *out = handle; @@ -309,26 +309,26 @@ Result DuplicateHandle(Handle* out, Handle handle) { } /// Signals an event -Result SignalEvent(Handle evt) { +static Result SignalEvent(Handle evt) { Result res = Kernel::SignalEvent(evt); DEBUG_LOG(SVC, "called event=0x%08X", evt); return res; } /// Clears an event -Result ClearEvent(Handle evt) { +static Result ClearEvent(Handle evt) { Result res = Kernel::ClearEvent(evt); DEBUG_LOG(SVC, "called event=0x%08X", evt); return res; } /// Sleep the current thread -void SleepThread(s64 nanoseconds) { +static void SleepThread(s64 nanoseconds) { DEBUG_LOG(SVC, "called nanoseconds=%lld", nanoseconds); } /// This returns the total CPU ticks elapsed since the CPU was powered-on -s64 GetSystemTick() { +static s64 GetSystemTick() { return (s64)Core::g_app_core->GetTicks(); } |