From 367d63691fe810c83979fee04b181338f96cfb50 Mon Sep 17 00:00:00 2001 From: bunnei Date: Thu, 15 May 2014 18:25:56 -0400 Subject: [PATCH] - added ThreadContext struct - cleaned up CreateThread svc --- src/core/hle/syscall.cpp | 20 ++++++++++++-------- src/core/hle/syscall.h | 14 ++++++++++++++ 2 files changed, 26 insertions(+), 8 deletions(-) diff --git a/src/core/hle/syscall.cpp b/src/core/hle/syscall.cpp index c697bc277c..0700d9e827 100644 --- a/src/core/hle/syscall.cpp +++ b/src/core/hle/syscall.cpp @@ -9,6 +9,7 @@ #include "core/hle/function_wrappers.h" #include "core/hle/syscall.h" #include "core/hle/service/service.h" +#include "core/hle/kernel/thread.h" #include "common/symbols.h" @@ -139,16 +140,19 @@ Result GetResourceLimitCurrentValues(void* _values, Handle resource_limit, void* return 0; } -Result CreateThread(void* thread, u32 threadpriority, u32 entrypoint, u32 arg, u32 stacktop, u32 processorid) { - std::string symbol_name = "unknown"; - if (Symbols::HasSymbol(entrypoint)) { - TSymbol symbol = Symbols::GetSymbol(entrypoint); - symbol_name = symbol.name; +Result CreateThread(void* thread, u32 thread_priority, u32 entry_point, u32 arg, u32 stack_top, u32 processor_id) { + std::string thread_name; + if (Symbols::HasSymbol(entry_point)) { + TSymbol symbol = Symbols::GetSymbol(entry_point); + thread_name = symbol.name; + } else { + char buff[100]; + sprintf(buff, "%s", "unk-%08X", entry_point); + thread_name = buff; } - // stack top: 0x0056A4A0 DEBUG_LOG(SVC, "(UNIMPLEMENTED) CreateThread called entrypoint=0x%08X (%s), arg=0x%08X, " - "stacktop=0x%08X, threadpriority=0x%08X, processorid=0x%08X", entrypoint, - symbol_name.c_str(), arg, stacktop, threadpriority, processorid); + "stacktop=0x%08X, threadpriority=0x%08X, processorid=0x%08X", entry_point, + thread_name.c_str(), arg, stack_top, thread_priority, processor_id); return 0; } diff --git a/src/core/hle/syscall.h b/src/core/hle/syscall.h index 7a94e01367..15af5e1384 100644 --- a/src/core/hle/syscall.h +++ b/src/core/hle/syscall.h @@ -6,6 +6,20 @@ #include "common/common_types.h" +//////////////////////////////////////////////////////////////////////////////////////////////////// +// SVC structures + +struct ThreadContext { + u32 cpu_registers[13]; + u32 sp; + u32 lr; + u32 pc; + u32 cpsr; + u32 fpu_registers[32]; + u32 fpscr; + u32 fpexc; +}; + //////////////////////////////////////////////////////////////////////////////////////////////////// // Namespace Syscall