mirror of
https://git.suyu.dev/suyu/suyu.git
synced 2024-11-26 05:16:24 -05:00
core: Mark some hle functions as static
These functions are not referred to by their linkage name outside of the translation unit, so they can be marked as static.
This commit is contained in:
parent
b66859714b
commit
72846c418e
6 changed files with 48 additions and 48 deletions
|
@ -18,7 +18,7 @@ namespace FS_User {
|
|||
// puts all the sections of the http://3dbrew.org/wiki/Error_codes to something non-zero, to make
|
||||
// sure we don't mislead the application into thinking something worked.
|
||||
|
||||
void Initialize(Service::Interface* self) {
|
||||
static void Initialize(Service::Interface* self) {
|
||||
u32* cmd_buff = Service::GetCommandBuffer();
|
||||
|
||||
// TODO(Link Mauve): check the behavior when cmd_buff[1] isn't 32, as per
|
||||
|
@ -44,7 +44,7 @@ void Initialize(Service::Interface* self) {
|
|||
* 1 : Result of function, 0 on success, otherwise error code
|
||||
* 3 : File handle
|
||||
*/
|
||||
void OpenFile(Service::Interface* self) {
|
||||
static void OpenFile(Service::Interface* self) {
|
||||
u32* cmd_buff = Service::GetCommandBuffer();
|
||||
|
||||
// TODO(Link Mauve): cmd_buff[2], aka archive handle lower word, isn't used according to
|
||||
|
@ -91,7 +91,7 @@ void OpenFile(Service::Interface* self) {
|
|||
* 1 : Result of function, 0 on success, otherwise error code
|
||||
* 3 : File handle
|
||||
*/
|
||||
void OpenFileDirectly(Service::Interface* self) {
|
||||
static void OpenFileDirectly(Service::Interface* self) {
|
||||
u32* cmd_buff = Service::GetCommandBuffer();
|
||||
|
||||
auto archive_id = static_cast<FileSys::Archive::IdCode>(cmd_buff[2]);
|
||||
|
@ -148,7 +148,7 @@ void OpenFileDirectly(Service::Interface* self) {
|
|||
* Outputs:
|
||||
* 1 : Result of function, 0 on success, otherwise error code
|
||||
*/
|
||||
void CreateDirectory(Service::Interface* self) {
|
||||
static void CreateDirectory(Service::Interface* self) {
|
||||
u32* cmd_buff = Service::GetCommandBuffer();
|
||||
|
||||
// TODO: cmd_buff[2], aka archive handle lower word, isn't used according to
|
||||
|
@ -177,7 +177,7 @@ void CreateDirectory(Service::Interface* self) {
|
|||
DEBUG_LOG(KERNEL, "called");
|
||||
}
|
||||
|
||||
void OpenDirectory(Service::Interface* self) {
|
||||
static void OpenDirectory(Service::Interface* self) {
|
||||
u32* cmd_buff = Service::GetCommandBuffer();
|
||||
|
||||
// TODO(Link Mauve): cmd_buff[2], aka archive handle lower word, isn't used according to
|
||||
|
@ -227,7 +227,7 @@ void OpenDirectory(Service::Interface* self) {
|
|||
* 2 : Archive handle lower word (unused)
|
||||
* 3 : Archive handle upper word (same as file handle)
|
||||
*/
|
||||
void OpenArchive(Service::Interface* self) {
|
||||
static void OpenArchive(Service::Interface* self) {
|
||||
u32* cmd_buff = Service::GetCommandBuffer();
|
||||
|
||||
auto archive_id = static_cast<FileSys::Archive::IdCode>(cmd_buff[1]);
|
||||
|
@ -264,7 +264,7 @@ void OpenArchive(Service::Interface* self) {
|
|||
* 1 : Result of function, 0 on success, otherwise error code
|
||||
* 2 : Whether the Sdmc could be detected
|
||||
*/
|
||||
void IsSdmcDetected(Service::Interface* self) {
|
||||
static void IsSdmcDetected(Service::Interface* self) {
|
||||
u32* cmd_buff = Service::GetCommandBuffer();
|
||||
|
||||
cmd_buff[1] = 0;
|
||||
|
|
|
@ -52,7 +52,7 @@ static inline InterruptRelayQueue* GetInterruptRelayQueue(u32 thread_id) {
|
|||
sizeof(InterruptRelayQueue) * thread_id);
|
||||
}
|
||||
|
||||
void WriteHWRegs(u32 base_address, u32 size_in_bytes, const u32* data) {
|
||||
static void WriteHWRegs(u32 base_address, u32 size_in_bytes, const u32* data) {
|
||||
// TODO: Return proper error codes
|
||||
if (base_address + size_in_bytes >= 0x420000) {
|
||||
ERROR_LOG(GPU, "Write address out of range! (address=0x%08x, size=0x%08x)",
|
||||
|
@ -76,7 +76,7 @@ void WriteHWRegs(u32 base_address, u32 size_in_bytes, const u32* data) {
|
|||
}
|
||||
|
||||
/// Write a GSP GPU hardware register
|
||||
void WriteHWRegs(Service::Interface* self) {
|
||||
static void WriteHWRegs(Service::Interface* self) {
|
||||
u32* cmd_buff = Service::GetCommandBuffer();
|
||||
u32 reg_addr = cmd_buff[1];
|
||||
u32 size = cmd_buff[2];
|
||||
|
@ -87,7 +87,7 @@ void WriteHWRegs(Service::Interface* self) {
|
|||
}
|
||||
|
||||
/// Read a GSP GPU hardware register
|
||||
void ReadHWRegs(Service::Interface* self) {
|
||||
static void ReadHWRegs(Service::Interface* self) {
|
||||
u32* cmd_buff = Service::GetCommandBuffer();
|
||||
u32 reg_addr = cmd_buff[1];
|
||||
u32 size = cmd_buff[2];
|
||||
|
@ -115,7 +115,7 @@ void ReadHWRegs(Service::Interface* self) {
|
|||
}
|
||||
}
|
||||
|
||||
void SetBufferSwap(u32 screen_id, const FrameBufferInfo& info) {
|
||||
static void SetBufferSwap(u32 screen_id, const FrameBufferInfo& info) {
|
||||
u32 base_address = 0x400000;
|
||||
if (info.active_fb == 0) {
|
||||
WriteHWRegs(base_address + 4 * GPU_REG_INDEX(framebuffer_config[screen_id].address_left1), 4, &info.address_left);
|
||||
|
@ -140,7 +140,7 @@ void SetBufferSwap(u32 screen_id, const FrameBufferInfo& info) {
|
|||
* Outputs:
|
||||
* 1: Result code
|
||||
*/
|
||||
void SetBufferSwap(Service::Interface* self) {
|
||||
static void SetBufferSwap(Service::Interface* self) {
|
||||
u32* cmd_buff = Service::GetCommandBuffer();
|
||||
u32 screen_id = cmd_buff[1];
|
||||
FrameBufferInfo* fb_info = (FrameBufferInfo*)&cmd_buff[2];
|
||||
|
@ -159,7 +159,7 @@ void SetBufferSwap(Service::Interface* self) {
|
|||
* 2 : Thread index into GSP command buffer
|
||||
* 4 : Handle to GSP shared memory
|
||||
*/
|
||||
void RegisterInterruptRelayQueue(Service::Interface* self) {
|
||||
static void RegisterInterruptRelayQueue(Service::Interface* self) {
|
||||
u32* cmd_buff = Service::GetCommandBuffer();
|
||||
u32 flags = cmd_buff[1];
|
||||
g_interrupt_event = cmd_buff[3];
|
||||
|
@ -202,7 +202,7 @@ void SignalInterrupt(InterruptId interrupt_id) {
|
|||
}
|
||||
|
||||
/// Executes the next GSP command
|
||||
void ExecuteCommand(const Command& command, u32 thread_id) {
|
||||
static void ExecuteCommand(const Command& command, u32 thread_id) {
|
||||
// Utility function to convert register ID to address
|
||||
auto WriteGPURegister = [](u32 id, u32 data) {
|
||||
GPU::Write<u32>(0x1EF00000 + 4 * id, data);
|
||||
|
@ -308,7 +308,7 @@ void ExecuteCommand(const Command& command, u32 thread_id) {
|
|||
}
|
||||
|
||||
/// This triggers handling of the GX command written to the command buffer in shared memory.
|
||||
void TriggerCmdReqQueue(Service::Interface* self) {
|
||||
static void TriggerCmdReqQueue(Service::Interface* self) {
|
||||
|
||||
// Iterate through each thread's command queue...
|
||||
for (unsigned thread_id = 0; thread_id < 0x4; ++thread_id) {
|
||||
|
|
|
@ -47,7 +47,7 @@ static inline PadData* GetPadData() {
|
|||
*
|
||||
* Indicate the circle pad is pushed completely to the edge in 1 of 8 directions.
|
||||
*/
|
||||
void UpdateNextCirclePadState() {
|
||||
static void UpdateNextCirclePadState() {
|
||||
static const s16 max_value = 0x9C;
|
||||
next_circle_x = next_state.circle_left ? -max_value : 0x0;
|
||||
next_circle_x += next_state.circle_right ? max_value : 0x0;
|
||||
|
@ -155,7 +155,7 @@ void PadUpdateComplete() {
|
|||
* 7 : Gyroscope event
|
||||
* 8 : Event signaled by HID_User
|
||||
*/
|
||||
void GetIPCHandles(Service::Interface* self) {
|
||||
static void GetIPCHandles(Service::Interface* self) {
|
||||
u32* cmd_buff = Service::GetCommandBuffer();
|
||||
|
||||
cmd_buff[1] = 0; // No error
|
||||
|
|
|
@ -13,7 +13,7 @@ namespace SRV {
|
|||
|
||||
Handle g_event_handle = 0;
|
||||
|
||||
void Initialize(Service::Interface* self) {
|
||||
static void Initialize(Service::Interface* self) {
|
||||
DEBUG_LOG(OSHLE, "called");
|
||||
|
||||
u32* cmd_buff = Service::GetCommandBuffer();
|
||||
|
@ -21,7 +21,7 @@ void Initialize(Service::Interface* self) {
|
|||
cmd_buff[1] = 0; // No error
|
||||
}
|
||||
|
||||
void GetProcSemaphore(Service::Interface* self) {
|
||||
static void GetProcSemaphore(Service::Interface* self) {
|
||||
DEBUG_LOG(OSHLE, "called");
|
||||
|
||||
u32* cmd_buff = Service::GetCommandBuffer();
|
||||
|
@ -34,7 +34,7 @@ void GetProcSemaphore(Service::Interface* self) {
|
|||
cmd_buff[3] = g_event_handle;
|
||||
}
|
||||
|
||||
void GetServiceHandle(Service::Interface* self) {
|
||||
static void GetServiceHandle(Service::Interface* self) {
|
||||
Result res = 0;
|
||||
u32* cmd_buff = Service::GetCommandBuffer();
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@ enum ControlMemoryOperation {
|
|||
};
|
||||
|
||||
/// Map application or GSP heap memory
|
||||
Result ControlMemory(u32* out_addr, u32 operation, u32 addr0, u32 addr1, u32 size, u32 permissions) {
|
||||
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);
|
||||
|
||||
|
@ -53,7 +53,7 @@ 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) {
|
||||
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);
|
||||
|
||||
|
@ -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,14 +101,14 @@ 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
|
||||
|
@ -132,7 +132,7 @@ 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;
|
||||
|
@ -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,18 +182,18 @@ Result CreateAddressArbiter(u32* arbiter) {
|
|||
}
|
||||
|
||||
/// Arbitrate address
|
||||
Result ArbitrateAddress(Handle arbiter, u32 address, u32 type, u32 value, s64 nanoseconds) {
|
||||
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
|
||||
// the current KThread.
|
||||
|
@ -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);
|
||||
|
@ -234,7 +234,7 @@ Result CreateThread(u32 priority, u32 entry_point, u32 arg, u32 stack_top, u32 p
|
|||
}
|
||||
|
||||
/// 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,18 +245,18 @@ 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",
|
||||
initial_locked ? "true" : "false", *mutex);
|
||||
|
@ -264,7 +264,7 @@ Result CreateMutex(Handle* mutex, u32 initial_locked) {
|
|||
}
|
||||
|
||||
/// 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,19 +272,19 @@ 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",
|
||||
reset_type, *evt);
|
||||
|
@ -292,7 +292,7 @@ Result CreateEvent(Handle* evt, u32 reset_type) {
|
|||
}
|
||||
|
||||
/// 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
|
||||
|
@ -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();
|
||||
}
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ static const int kBlockSize = 0x200; ///< Size of ExeFS blocks (in bytes)
|
|||
* @param size Size of compressed buffer
|
||||
* @return Size of decompressed buffer
|
||||
*/
|
||||
u32 LZSS_GetDecompressedSize(u8* buffer, u32 size) {
|
||||
static u32 LZSS_GetDecompressedSize(u8* buffer, u32 size) {
|
||||
u32 offset_size = *(u32*)(buffer + size - 4);
|
||||
return offset_size + size;
|
||||
}
|
||||
|
@ -37,7 +37,7 @@ u32 LZSS_GetDecompressedSize(u8* buffer, u32 size) {
|
|||
* @param decompressed_size Size of decompressed buffer
|
||||
* @return True on success, otherwise false
|
||||
*/
|
||||
bool LZSS_Decompress(u8* compressed, u32 compressed_size, u8* decompressed, u32 decompressed_size) {
|
||||
static bool LZSS_Decompress(u8* compressed, u32 compressed_size, u8* decompressed, u32 decompressed_size) {
|
||||
u8* footer = compressed + compressed_size - 8;
|
||||
u32 buffer_top_and_bottom = *(u32*)footer;
|
||||
u32 out = decompressed_size;
|
||||
|
|
Loading…
Reference in a new issue