HLE: Move SVC handlers to the Kernel namespace

This commit is contained in:
Yuri Kunde Schlesner 2017-12-09 18:05:43 -08:00
parent ad71e23f23
commit 21188f5683
5 changed files with 209 additions and 281 deletions

View File

@ -54,7 +54,7 @@ static Dynarmic::UserCallbacks GetUserCallbacks(
Dynarmic::UserCallbacks user_callbacks{}; Dynarmic::UserCallbacks user_callbacks{};
user_callbacks.InterpreterFallback = &InterpreterFallback; user_callbacks.InterpreterFallback = &InterpreterFallback;
user_callbacks.user_arg = static_cast<void*>(interpreter_state.get()); user_callbacks.user_arg = static_cast<void*>(interpreter_state.get());
user_callbacks.CallSVC = &SVC::CallSVC; user_callbacks.CallSVC = &Kernel::CallSVC;
user_callbacks.memory.IsReadOnlyMemory = &IsReadOnlyMemory; user_callbacks.memory.IsReadOnlyMemory = &IsReadOnlyMemory;
user_callbacks.memory.ReadCode = &Memory::Read32; user_callbacks.memory.ReadCode = &Memory::Read32;
user_callbacks.memory.Read8 = &Memory::Read8; user_callbacks.memory.Read8 = &Memory::Read8;

View File

@ -3863,7 +3863,7 @@ SWI_INST : {
cpu->NumInstrsToExecute = cpu->NumInstrsToExecute =
num_instrs >= cpu->NumInstrsToExecute ? 0 : cpu->NumInstrsToExecute - num_instrs; num_instrs >= cpu->NumInstrsToExecute ? 0 : cpu->NumInstrsToExecute - num_instrs;
num_instrs = 0; num_instrs = 0;
SVC::CallSVC(inst_cream->num & 0xFFFF); Kernel::CallSVC(inst_cream->num & 0xFFFF);
} }
cpu->Reg[15] += cpu->GetInstructionSize(); cpu->Reg[15] += cpu->GetInstructionSize();

View File

@ -99,10 +99,10 @@ void Wrap() {
FuncReturn(retval); FuncReturn(retval);
} }
template <ResultCode func(MemoryInfo*, PageInfo*, u32)> template <ResultCode func(Kernel::MemoryInfo*, Kernel::PageInfo*, u32)>
void Wrap() { void Wrap() {
MemoryInfo memory_info = {}; Kernel::MemoryInfo memory_info = {};
PageInfo page_info = {}; Kernel::PageInfo page_info = {};
u32 retval = func(&memory_info, &page_info, PARAM(2)).raw; u32 retval = func(&memory_info, &page_info, PARAM(2)).raw;
Core::CPU().SetReg(1, memory_info.base_address); Core::CPU().SetReg(1, memory_info.base_address);
Core::CPU().SetReg(2, memory_info.size); Core::CPU().SetReg(2, memory_info.size);
@ -112,10 +112,10 @@ void Wrap() {
FuncReturn(retval); FuncReturn(retval);
} }
template <ResultCode func(MemoryInfo*, PageInfo*, Kernel::Handle, u32)> template <ResultCode func(Kernel::MemoryInfo*, Kernel::PageInfo*, Kernel::Handle, u32)>
void Wrap() { void Wrap() {
MemoryInfo memory_info = {}; Kernel::MemoryInfo memory_info = {};
PageInfo page_info = {}; Kernel::PageInfo page_info = {};
u32 retval = func(&memory_info, &page_info, PARAM(2), PARAM(3)).raw; u32 retval = func(&memory_info, &page_info, PARAM(2), PARAM(3)).raw;
Core::CPU().SetReg(1, memory_info.base_address); Core::CPU().SetReg(1, memory_info.base_address);
Core::CPU().SetReg(2, memory_info.size); Core::CPU().SetReg(2, memory_info.size);

File diff suppressed because it is too large Load Diff

View File

@ -6,8 +6,7 @@
#include "common/common_types.h" #include "common/common_types.h"
//////////////////////////////////////////////////////////////////////////////////////////////////// namespace Kernel {
// SVC types
struct MemoryInfo { struct MemoryInfo {
u32 base_address; u32 base_address;
@ -20,11 +19,6 @@ struct PageInfo {
u32 flags; u32 flags;
}; };
////////////////////////////////////////////////////////////////////////////////////////////////////
// Namespace SVC
namespace SVC {
/// Values accepted by svcGetSystemInfo's type parameter. /// Values accepted by svcGetSystemInfo's type parameter.
enum class SystemInfoType { enum class SystemInfoType {
/** /**
@ -56,4 +50,4 @@ enum class SystemInfoMemUsageRegion {
void CallSVC(u32 immediate); void CallSVC(u32 immediate);
} // namespace } // namespace Kernel