mirror of
https://github.com/Lime3DS/Lime3DS.git
synced 2024-12-25 17:21:55 +01:00
- added HLE to connect to "srv:" service
- added a manager for keeping track of services/ports - added a memory mapped region for memory accessed by HLE - added HLE for GetThreadCommandBuffer function
This commit is contained in:
parent
4d88318903
commit
68e198476f
@ -19,6 +19,8 @@
|
|||||||
#include "armemu.h"
|
#include "armemu.h"
|
||||||
//#include "ansidecl.h"
|
//#include "ansidecl.h"
|
||||||
#include "skyeye_defs.h"
|
#include "skyeye_defs.h"
|
||||||
|
#include "core/hle/hle.h"
|
||||||
|
|
||||||
unsigned xscale_cp15_cp_access_allowed (ARMul_State * state, unsigned reg,
|
unsigned xscale_cp15_cp_access_allowed (ARMul_State * state, unsigned reg,
|
||||||
unsigned cpnum);
|
unsigned cpnum);
|
||||||
//extern int skyeye_instr_debug;
|
//extern int skyeye_instr_debug;
|
||||||
@ -734,39 +736,39 @@ ARMword
|
|||||||
ARMul_MRC (ARMul_State * state, ARMword instr)
|
ARMul_MRC (ARMul_State * state, ARMword instr)
|
||||||
{
|
{
|
||||||
unsigned cpab;
|
unsigned cpab;
|
||||||
ARMword result = 0;
|
ARMword result = HLE::CallGetThreadCommandBuffer();
|
||||||
|
|
||||||
//printf("SKYEYE ARMul_MRC, CPnum is %x, instr %x\n",CPNum, instr);
|
////printf("SKYEYE ARMul_MRC, CPnum is %x, instr %x\n",CPNum, instr);
|
||||||
if (!CP_ACCESS_ALLOWED (state, CPNum)) {
|
//if (!CP_ACCESS_ALLOWED (state, CPNum)) {
|
||||||
//chy 2004-07-19 should fix in the future????!!!!
|
// //chy 2004-07-19 should fix in the future????!!!!
|
||||||
//printf("SKYEYE ARMul_MRC,NOT ALLOWed UndefInstr CPnum is %x, instr %x\n",CPNum, instr);
|
// //printf("SKYEYE ARMul_MRC,NOT ALLOWed UndefInstr CPnum is %x, instr %x\n",CPNum, instr);
|
||||||
ARMul_UndefInstr (state, instr);
|
// ARMul_UndefInstr (state, instr);
|
||||||
return -1;
|
// return -1;
|
||||||
}
|
//}
|
||||||
|
|
||||||
cpab = (state->MRC[CPNum]) (state, ARMul_FIRST, instr, &result);
|
//cpab = (state->MRC[CPNum]) (state, ARMul_FIRST, instr, &result);
|
||||||
while (cpab == ARMul_BUSY) {
|
//while (cpab == ARMul_BUSY) {
|
||||||
ARMul_Icycles (state, 1, 0);
|
// ARMul_Icycles (state, 1, 0);
|
||||||
if (IntPending (state)) {
|
// if (IntPending (state)) {
|
||||||
cpab = (state->MRC[CPNum]) (state, ARMul_INTERRUPT,
|
// cpab = (state->MRC[CPNum]) (state, ARMul_INTERRUPT,
|
||||||
instr, 0);
|
// instr, 0);
|
||||||
return (0);
|
// return (0);
|
||||||
}
|
// }
|
||||||
else
|
// else
|
||||||
cpab = (state->MRC[CPNum]) (state, ARMul_BUSY, instr,
|
// cpab = (state->MRC[CPNum]) (state, ARMul_BUSY, instr,
|
||||||
&result);
|
// &result);
|
||||||
}
|
//}
|
||||||
if (cpab == ARMul_CANT) {
|
//if (cpab == ARMul_CANT) {
|
||||||
printf ("SKYEYE ARMul_MRC,CANT UndefInstr CPnum is %x, instr %x\n", CPNum, instr);
|
// printf ("SKYEYE ARMul_MRC,CANT UndefInstr CPnum is %x, instr %x\n", CPNum, instr);
|
||||||
ARMul_Abort (state, ARMul_UndefinedInstrV);
|
// ARMul_Abort (state, ARMul_UndefinedInstrV);
|
||||||
/* Parent will destroy the flags otherwise. */
|
// /* Parent will destroy the flags otherwise. */
|
||||||
result = ECC;
|
// result = ECC;
|
||||||
}
|
//}
|
||||||
else {
|
//else {
|
||||||
BUSUSEDINCPCN;
|
// BUSUSEDINCPCN;
|
||||||
ARMul_Ccycles (state, 1, 0);
|
// ARMul_Ccycles (state, 1, 0);
|
||||||
ARMul_Icycles (state, 1, 0);
|
// ARMul_Icycles (state, 1, 0);
|
||||||
}
|
//}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -153,6 +153,7 @@
|
|||||||
<ClCompile Include="file_sys\directory_file_system.cpp" />
|
<ClCompile Include="file_sys\directory_file_system.cpp" />
|
||||||
<ClCompile Include="file_sys\meta_file_system.cpp" />
|
<ClCompile Include="file_sys\meta_file_system.cpp" />
|
||||||
<ClCompile Include="hle\hle.cpp" />
|
<ClCompile Include="hle\hle.cpp" />
|
||||||
|
<ClCompile Include="hle\service\service.cpp" />
|
||||||
<ClCompile Include="hle\syscall.cpp" />
|
<ClCompile Include="hle\syscall.cpp" />
|
||||||
<ClCompile Include="hw\hw.cpp" />
|
<ClCompile Include="hw\hw.cpp" />
|
||||||
<ClCompile Include="hw\hw_lcd.cpp" />
|
<ClCompile Include="hw\hw_lcd.cpp" />
|
||||||
|
@ -87,6 +87,9 @@
|
|||||||
<ClCompile Include="hle\syscall.cpp">
|
<ClCompile Include="hle\syscall.cpp">
|
||||||
<Filter>hle</Filter>
|
<Filter>hle</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
<ClCompile Include="hle\service\service.cpp">
|
||||||
|
<Filter>hle\service</Filter>
|
||||||
|
</ClCompile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClInclude Include="arm\disassembler\arm_disasm.h">
|
<ClInclude Include="arm\disassembler\arm_disasm.h">
|
||||||
|
@ -4,8 +4,10 @@
|
|||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
#include "core/mem_map.h"
|
||||||
#include "core/hle/hle.h"
|
#include "core/hle/hle.h"
|
||||||
#include "core/hle/syscall.h"
|
#include "core/hle/syscall.h"
|
||||||
|
#include "core/hle/service/service.h"
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
@ -35,6 +37,14 @@ void CallSyscall(u32 opcode) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Returns the coprocessor (in this case, syscore) command buffer pointer
|
||||||
|
Addr CallGetThreadCommandBuffer() {
|
||||||
|
// Called on insruction: mrc p15, 0, r0, c13, c0, 3
|
||||||
|
// Returns an address in OSHLE memory for the CPU to read/write to
|
||||||
|
RETURN(OS_THREAD_COMMAND_BUFFER_ADDR);
|
||||||
|
return OS_THREAD_COMMAND_BUFFER_ADDR;
|
||||||
|
}
|
||||||
|
|
||||||
void RegisterModule(std::string name, int num_functions, const FunctionDef* func_table) {
|
void RegisterModule(std::string name, int num_functions, const FunctionDef* func_table) {
|
||||||
ModuleDef module = {name, num_functions, func_table};
|
ModuleDef module = {name, num_functions, func_table};
|
||||||
g_module_db.push_back(module);
|
g_module_db.push_back(module);
|
||||||
@ -45,7 +55,10 @@ void RegisterAllModules() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Init() {
|
void Init() {
|
||||||
|
Service::Init();
|
||||||
|
|
||||||
RegisterAllModules();
|
RegisterAllModules();
|
||||||
|
|
||||||
NOTICE_LOG(HLE, "initialized OK");
|
NOTICE_LOG(HLE, "initialized OK");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -16,6 +16,11 @@
|
|||||||
|
|
||||||
namespace HLE {
|
namespace HLE {
|
||||||
|
|
||||||
|
enum {
|
||||||
|
OS_THREAD_COMMAND_BUFFER_ADDR = 0xA0004000,
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef u32 Addr;
|
||||||
typedef void (*Func)();
|
typedef void (*Func)();
|
||||||
|
|
||||||
struct FunctionDef {
|
struct FunctionDef {
|
||||||
@ -34,6 +39,8 @@ void RegisterModule(std::string name, int num_functions, const FunctionDef *func
|
|||||||
|
|
||||||
void CallSyscall(u32 opcode);
|
void CallSyscall(u32 opcode);
|
||||||
|
|
||||||
|
Addr CallGetThreadCommandBuffer();
|
||||||
|
|
||||||
void Init();
|
void Init();
|
||||||
|
|
||||||
void Shutdown();
|
void Shutdown();
|
||||||
|
115
src/core/hle/service/service.cpp
Normal file
115
src/core/hle/service/service.cpp
Normal file
@ -0,0 +1,115 @@
|
|||||||
|
// Copyright 2014 Citra Emulator Project
|
||||||
|
// Licensed under GPLv2
|
||||||
|
// Refer to the license.txt file included.
|
||||||
|
|
||||||
|
#include "common/common.h"
|
||||||
|
#include "common/log.h"
|
||||||
|
|
||||||
|
#include "core/hle/service/service.h"
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Namespace Service
|
||||||
|
|
||||||
|
namespace Service {
|
||||||
|
|
||||||
|
Manager* g_manager = NULL; ///< Service manager
|
||||||
|
|
||||||
|
Manager::Manager() {
|
||||||
|
}
|
||||||
|
|
||||||
|
Manager::~Manager() {
|
||||||
|
for(Interface* service : m_services) {
|
||||||
|
DeleteService(service->GetPortName());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Add a service to the manager (does not create it though)
|
||||||
|
void Manager::AddService(Interface* service) {
|
||||||
|
int index = m_services.size();
|
||||||
|
u32 new_uid = GetUIDFromIndex(index);
|
||||||
|
|
||||||
|
m_services.push_back(service);
|
||||||
|
|
||||||
|
m_port_map[service->GetPortName()] = new_uid;
|
||||||
|
service->m_uid = new_uid;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Removes a service from the manager, also frees memory
|
||||||
|
void Manager::DeleteService(std::string port_name) {
|
||||||
|
auto service = FetchFromPortName(port_name);
|
||||||
|
|
||||||
|
m_services.erase(m_services.begin() + GetIndexFromUID(service->m_uid));
|
||||||
|
m_port_map.erase(port_name);
|
||||||
|
|
||||||
|
delete service;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Get a Service Interface from its UID
|
||||||
|
Interface* Manager::FetchFromUID(u32 uid) {
|
||||||
|
int index = GetIndexFromUID(uid);
|
||||||
|
if (index < (int)m_services.size()) {
|
||||||
|
return m_services[index];
|
||||||
|
}
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Get a Service Interface from its port
|
||||||
|
Interface* Manager::FetchFromPortName(std::string port_name) {
|
||||||
|
auto itr = m_port_map.find(port_name);
|
||||||
|
if (itr == m_port_map.end()) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
return FetchFromUID(itr->second);
|
||||||
|
}
|
||||||
|
|
||||||
|
class Interface_SRV : public Interface {
|
||||||
|
public:
|
||||||
|
|
||||||
|
Interface_SRV() {
|
||||||
|
}
|
||||||
|
|
||||||
|
~Interface_SRV() {
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the string name used by CTROS for a service
|
||||||
|
* @return String name of service
|
||||||
|
*/
|
||||||
|
std::string GetName() {
|
||||||
|
return "ServiceManager";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the string name used by CTROS for a service
|
||||||
|
* @return Port name of service
|
||||||
|
*/
|
||||||
|
std::string GetPortName() {
|
||||||
|
return "srv:";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called when svcSendSyncRequest is called, loads command buffer and executes comand
|
||||||
|
* @return Return result of svcSendSyncRequest passed back to user app
|
||||||
|
*/
|
||||||
|
Syscall::Result Sync() {
|
||||||
|
ERROR_LOG(HLE, "Unimplemented function ServiceManager::Sync");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
/// Initialize ServiceManager
|
||||||
|
void Init() {
|
||||||
|
g_manager = new Manager;
|
||||||
|
g_manager->AddService(new Interface_SRV);
|
||||||
|
NOTICE_LOG(HLE, "ServiceManager initialized OK");
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Shutdown ServiceManager
|
||||||
|
void Shutdown() {
|
||||||
|
delete g_manager;
|
||||||
|
NOTICE_LOG(HLE, "ServiceManager shutdown OK");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -4,6 +4,8 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <vector>
|
||||||
|
#include <map>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include "common/common_types.h"
|
#include "common/common_types.h"
|
||||||
@ -14,10 +16,13 @@
|
|||||||
|
|
||||||
namespace Service {
|
namespace Service {
|
||||||
|
|
||||||
typedef s32 NativeUID;
|
typedef s32 NativeUID; ///< Native handle for a service
|
||||||
|
|
||||||
|
class Manager;
|
||||||
|
|
||||||
/// Interface to a CTROS service
|
/// Interface to a CTROS service
|
||||||
class Interface {
|
class Interface {
|
||||||
|
friend class Manager;
|
||||||
public:
|
public:
|
||||||
|
|
||||||
virtual ~Interface() {
|
virtual ~Interface() {
|
||||||
@ -43,7 +48,7 @@ public:
|
|||||||
* Gets the string name used by CTROS for a service
|
* Gets the string name used by CTROS for a service
|
||||||
* @return Port name of service
|
* @return Port name of service
|
||||||
*/
|
*/
|
||||||
virtual std::string GetPort() {
|
virtual std::string GetPortName() {
|
||||||
return "[UNKNOWN SERVICE PORT]";
|
return "[UNKNOWN SERVICE PORT]";
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -57,4 +62,52 @@ private:
|
|||||||
u32 m_uid;
|
u32 m_uid;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/// Simple class to manage accessing services from ports and UID handles
|
||||||
|
class Manager {
|
||||||
|
|
||||||
|
public:
|
||||||
|
Manager();
|
||||||
|
|
||||||
|
~Manager();
|
||||||
|
|
||||||
|
/// Add a service to the manager (does not create it though)
|
||||||
|
void AddService(Interface* service);
|
||||||
|
|
||||||
|
/// Removes a service from the manager (does not delete it though)
|
||||||
|
void DeleteService(std::string port_name);
|
||||||
|
|
||||||
|
/// Get a Service Interface from its UID
|
||||||
|
Interface* FetchFromUID(u32 uid);
|
||||||
|
|
||||||
|
/// Get a Service Interface from its port
|
||||||
|
Interface* FetchFromPortName(std::string port_name);
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
/// Convert an index into m_services vector into a UID
|
||||||
|
static u32 GetUIDFromIndex(const int index) {
|
||||||
|
return index | 0x10000000;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Convert a UID into an index into m_services
|
||||||
|
static int GetIndexFromUID(const u32 uid) {
|
||||||
|
return uid & 0x0FFFFFFF;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::vector<Interface*> m_services;
|
||||||
|
std::map<std::string, u32> m_port_map;
|
||||||
|
|
||||||
|
DISALLOW_COPY_AND_ASSIGN(Manager);
|
||||||
|
};
|
||||||
|
|
||||||
|
/// Initialize ServiceManager
|
||||||
|
void Init();
|
||||||
|
|
||||||
|
/// Shutdown ServiceManager
|
||||||
|
void Shutdown();
|
||||||
|
|
||||||
|
|
||||||
|
extern Manager* g_manager; ///< Service manager
|
||||||
|
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
@ -6,81 +6,91 @@
|
|||||||
|
|
||||||
#include "core/hle/function_wrappers.h"
|
#include "core/hle/function_wrappers.h"
|
||||||
#include "core/hle/syscall.h"
|
#include "core/hle/syscall.h"
|
||||||
|
#include "core/hle/service/service.h"
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
// Namespace Syscall
|
// Namespace Syscall
|
||||||
|
|
||||||
namespace Syscall {
|
namespace Syscall {
|
||||||
|
|
||||||
Result SVC_ConnectToPort(void* out, const char* port_name) {
|
/// Connect to an OS service given the port name, returns the handle to the port to out
|
||||||
NOTICE_LOG(OSHLE, "svcConnectToPort called, port_name: %s", port_name);
|
Result ConnectToPort(void* out, const char* port_name) {
|
||||||
|
Service::Interface* service = Service::g_manager->FetchFromPortName(port_name);
|
||||||
|
Core::g_app_core->SetReg(1, service->GetUID());
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Synchronize to an OS service
|
||||||
|
Result SendSyncRequest(Handle session) {
|
||||||
|
Service::Interface* service = Service::g_manager->FetchFromUID(session);
|
||||||
|
service->Sync();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
const HLE::FunctionDef Syscall_Table[] = {
|
const HLE::FunctionDef Syscall_Table[] = {
|
||||||
{0x00, NULL, "Unknown"},
|
{0x00, NULL, "Unknown"},
|
||||||
{0x01, NULL, "svcControlMemory"},
|
{0x01, NULL, "ControlMemory"},
|
||||||
{0x02, NULL, "svcQueryMemory"},
|
{0x02, NULL, "QueryMemory"},
|
||||||
{0x03, NULL, "svcExitProcess"},
|
{0x03, NULL, "ExitProcess"},
|
||||||
{0x04, NULL, "svcGetProcessAffinityMask"},
|
{0x04, NULL, "GetProcessAffinityMask"},
|
||||||
{0x05, NULL, "svcSetProcessAffinityMask"},
|
{0x05, NULL, "SetProcessAffinityMask"},
|
||||||
{0x06, NULL, "svcGetProcessIdealProcessor"},
|
{0x06, NULL, "GetProcessIdealProcessor"},
|
||||||
{0x07, NULL, "svcSetProcessIdealProcessor"},
|
{0x07, NULL, "SetProcessIdealProcessor"},
|
||||||
{0x08, NULL, "svcCreateThread"},
|
{0x08, NULL, "CreateThread"},
|
||||||
{0x09, NULL, "svcExitThread"},
|
{0x09, NULL, "ExitThread"},
|
||||||
{0x0A, NULL, "svcSleepThread"},
|
{0x0A, NULL, "SleepThread"},
|
||||||
{0x0B, NULL, "svcGetThreadPriority"},
|
{0x0B, NULL, "GetThreadPriority"},
|
||||||
{0x0C, NULL, "svcSetThreadPriority"},
|
{0x0C, NULL, "SetThreadPriority"},
|
||||||
{0x0D, NULL, "svcGetThreadAffinityMask"},
|
{0x0D, NULL, "GetThreadAffinityMask"},
|
||||||
{0x0E, NULL, "svcSetThreadAffinityMask"},
|
{0x0E, NULL, "SetThreadAffinityMask"},
|
||||||
{0x0F, NULL, "svcGetThreadIdealProcessor"},
|
{0x0F, NULL, "GetThreadIdealProcessor"},
|
||||||
{0x10, NULL, "svcSetThreadIdealProcessor"},
|
{0x10, NULL, "SetThreadIdealProcessor"},
|
||||||
{0x11, NULL, "svcGetCurrentProcessorNumber"},
|
{0x11, NULL, "GetCurrentProcessorNumber"},
|
||||||
{0x12, NULL, "svcRun"},
|
{0x12, NULL, "Run"},
|
||||||
{0x13, NULL, "svcCreateMutex"},
|
{0x13, NULL, "CreateMutex"},
|
||||||
{0x14, NULL, "svcReleaseMutex"},
|
{0x14, NULL, "ReleaseMutex"},
|
||||||
{0x15, NULL, "svcCreateSemaphore"},
|
{0x15, NULL, "CreateSemaphore"},
|
||||||
{0x16, NULL, "svcReleaseSemaphore"},
|
{0x16, NULL, "ReleaseSemaphore"},
|
||||||
{0x17, NULL, "svcCreateEvent"},
|
{0x17, NULL, "CreateEvent"},
|
||||||
{0x18, NULL, "svcSignalEvent"},
|
{0x18, NULL, "SignalEvent"},
|
||||||
{0x19, NULL, "svcClearEvent"},
|
{0x19, NULL, "ClearEvent"},
|
||||||
{0x1A, NULL, "svcCreateTimer"},
|
{0x1A, NULL, "CreateTimer"},
|
||||||
{0x1B, NULL, "svcSetTimer"},
|
{0x1B, NULL, "SetTimer"},
|
||||||
{0x1C, NULL, "svcCancelTimer"},
|
{0x1C, NULL, "CancelTimer"},
|
||||||
{0x1D, NULL, "svcClearTimer"},
|
{0x1D, NULL, "ClearTimer"},
|
||||||
{0x1E, NULL, "svcCreateMemoryBlock"},
|
{0x1E, NULL, "CreateMemoryBlock"},
|
||||||
{0x1F, NULL, "svcMapMemoryBlock"},
|
{0x1F, NULL, "MapMemoryBlock"},
|
||||||
{0x20, NULL, "svcUnmapMemoryBlock"},
|
{0x20, NULL, "UnmapMemoryBlock"},
|
||||||
{0x21, NULL, "svcCreateAddressArbiter"},
|
{0x21, NULL, "CreateAddressArbiter"},
|
||||||
{0x22, NULL, "svcArbitrateAddress"},
|
{0x22, NULL, "ArbitrateAddress"},
|
||||||
{0x23, NULL, "svcCloseHandle"},
|
{0x23, NULL, "CloseHandle"},
|
||||||
{0x24, NULL, "svcWaitSynchronization1"},
|
{0x24, NULL, "WaitSynchronization1"},
|
||||||
{0x25, NULL, "svcWaitSynchronizationN"},
|
{0x25, NULL, "WaitSynchronizationN"},
|
||||||
{0x26, NULL, "svcSignalAndWait"},
|
{0x26, NULL, "SignalAndWait"},
|
||||||
{0x27, NULL, "svcDuplicateHandle"},
|
{0x27, NULL, "DuplicateHandle"},
|
||||||
{0x28, NULL, "svcGetSystemTick"},
|
{0x28, NULL, "GetSystemTick"},
|
||||||
{0x29, NULL, "svcGetHandleInfo"},
|
{0x29, NULL, "GetHandleInfo"},
|
||||||
{0x2A, NULL, "svcGetSystemInfo"},
|
{0x2A, NULL, "GetSystemInfo"},
|
||||||
{0x2B, NULL, "svcGetProcessInfo"},
|
{0x2B, NULL, "GetProcessInfo"},
|
||||||
{0x2C, NULL, "svcGetThreadInfo"},
|
{0x2C, NULL, "GetThreadInfo"},
|
||||||
{0x2D, WrapI_VC<SVC_ConnectToPort>, "svcConnectToPort"},
|
{0x2D, WrapI_VC<ConnectToPort>, "ConnectToPort"},
|
||||||
{0x2E, NULL, "svcSendSyncRequest1"},
|
{0x2E, NULL, "SendSyncRequest1"},
|
||||||
{0x2F, NULL, "svcSendSyncRequest2"},
|
{0x2F, NULL, "SendSyncRequest2"},
|
||||||
{0x30, NULL, "svcSendSyncRequest3"},
|
{0x30, NULL, "SendSyncRequest3"},
|
||||||
{0x31, NULL, "svcSendSyncRequest4"},
|
{0x31, NULL, "SendSyncRequest4"},
|
||||||
{0x32, NULL, "svcSendSyncRequest"},
|
{0x32, WrapI_U<SendSyncRequest>, "SendSyncRequest"},
|
||||||
{0x33, NULL, "svcOpenProcess"},
|
{0x33, NULL, "OpenProcess"},
|
||||||
{0x34, NULL, "svcOpenThread"},
|
{0x34, NULL, "OpenThread"},
|
||||||
{0x35, NULL, "svcGetProcessId"},
|
{0x35, NULL, "GetProcessId"},
|
||||||
{0x36, NULL, "svcGetProcessIdOfThread"},
|
{0x36, NULL, "GetProcessIdOfThread"},
|
||||||
{0x37, NULL, "svcGetThreadId"},
|
{0x37, NULL, "GetThreadId"},
|
||||||
{0x38, NULL, "svcGetResourceLimit"},
|
{0x38, NULL, "GetResourceLimit"},
|
||||||
{0x39, NULL, "svcGetResourceLimitLimitValues"},
|
{0x39, NULL, "GetResourceLimitLimitValues"},
|
||||||
{0x3A, NULL, "svcGetResourceLimitCurrentValues"},
|
{0x3A, NULL, "GetResourceLimitCurrentValues"},
|
||||||
{0x3B, NULL, "svcGetThreadContext"},
|
{0x3B, NULL, "GetThreadContext"},
|
||||||
{0x3C, NULL, "svcBreak"},
|
{0x3C, NULL, "Break"},
|
||||||
{0x3D, NULL, "svcOutputDebugString"},
|
{0x3D, NULL, "OutputDebugString"},
|
||||||
{0x3E, NULL, "svcControlPerformanceCounter"},
|
{0x3E, NULL, "ControlPerformanceCounter"},
|
||||||
{0x3F, NULL, "Unknown"},
|
{0x3F, NULL, "Unknown"},
|
||||||
{0x40, NULL, "Unknown"},
|
{0x40, NULL, "Unknown"},
|
||||||
{0x41, NULL, "Unknown"},
|
{0x41, NULL, "Unknown"},
|
||||||
@ -89,24 +99,24 @@ const HLE::FunctionDef Syscall_Table[] = {
|
|||||||
{0x44, NULL, "Unknown"},
|
{0x44, NULL, "Unknown"},
|
||||||
{0x45, NULL, "Unknown"},
|
{0x45, NULL, "Unknown"},
|
||||||
{0x46, NULL, "Unknown"},
|
{0x46, NULL, "Unknown"},
|
||||||
{0x47, NULL, "svcCreatePort"},
|
{0x47, NULL, "CreatePort"},
|
||||||
{0x48, NULL, "svcCreateSessionToPort"},
|
{0x48, NULL, "CreateSessionToPort"},
|
||||||
{0x49, NULL, "svcCreateSession"},
|
{0x49, NULL, "CreateSession"},
|
||||||
{0x4A, NULL, "svcAcceptSession"},
|
{0x4A, NULL, "AcceptSession"},
|
||||||
{0x4B, NULL, "svcReplyAndReceive1"},
|
{0x4B, NULL, "ReplyAndReceive1"},
|
||||||
{0x4C, NULL, "svcReplyAndReceive2"},
|
{0x4C, NULL, "ReplyAndReceive2"},
|
||||||
{0x4D, NULL, "svcReplyAndReceive3"},
|
{0x4D, NULL, "ReplyAndReceive3"},
|
||||||
{0x4E, NULL, "svcReplyAndReceive4"},
|
{0x4E, NULL, "ReplyAndReceive4"},
|
||||||
{0x4F, NULL, "svcReplyAndReceive"},
|
{0x4F, NULL, "ReplyAndReceive"},
|
||||||
{0x50, NULL, "svcBindInterrupt"},
|
{0x50, NULL, "BindInterrupt"},
|
||||||
{0x51, NULL, "svcUnbindInterrupt"},
|
{0x51, NULL, "UnbindInterrupt"},
|
||||||
{0x52, NULL, "svcInvalidateProcessDataCache"},
|
{0x52, NULL, "InvalidateProcessDataCache"},
|
||||||
{0x53, NULL, "svcStoreProcessDataCache"},
|
{0x53, NULL, "StoreProcessDataCache"},
|
||||||
{0x54, NULL, "svcFlushProcessDataCache"},
|
{0x54, NULL, "FlushProcessDataCache"},
|
||||||
{0x55, NULL, "svcStartInterProcessDma"},
|
{0x55, NULL, "StartInterProcessDma"},
|
||||||
{0x56, NULL, "svcStopDma"},
|
{0x56, NULL, "StopDma"},
|
||||||
{0x57, NULL, "svcGetDmaState"},
|
{0x57, NULL, "GetDmaState"},
|
||||||
{0x58, NULL, "svcRestartDma"},
|
{0x58, NULL, "RestartDma"},
|
||||||
{0x59, NULL, "Unknown"},
|
{0x59, NULL, "Unknown"},
|
||||||
{0x5A, NULL, "Unknown"},
|
{0x5A, NULL, "Unknown"},
|
||||||
{0x5B, NULL, "Unknown"},
|
{0x5B, NULL, "Unknown"},
|
||||||
@ -114,36 +124,36 @@ const HLE::FunctionDef Syscall_Table[] = {
|
|||||||
{0x5D, NULL, "Unknown"},
|
{0x5D, NULL, "Unknown"},
|
||||||
{0x5E, NULL, "Unknown"},
|
{0x5E, NULL, "Unknown"},
|
||||||
{0x5F, NULL, "Unknown"},
|
{0x5F, NULL, "Unknown"},
|
||||||
{0x60, NULL, "svcDebugActiveProcess"},
|
{0x60, NULL, "DebugActiveProcess"},
|
||||||
{0x61, NULL, "svcBreakDebugProcess"},
|
{0x61, NULL, "BreakDebugProcess"},
|
||||||
{0x62, NULL, "svcTerminateDebugProcess"},
|
{0x62, NULL, "TerminateDebugProcess"},
|
||||||
{0x63, NULL, "svcGetProcessDebugEvent"},
|
{0x63, NULL, "GetProcessDebugEvent"},
|
||||||
{0x64, NULL, "svcContinueDebugEvent"},
|
{0x64, NULL, "ContinueDebugEvent"},
|
||||||
{0x65, NULL, "svcGetProcessList"},
|
{0x65, NULL, "GetProcessList"},
|
||||||
{0x66, NULL, "svcGetThreadList"},
|
{0x66, NULL, "GetThreadList"},
|
||||||
{0x67, NULL, "svcGetDebugThreadContext"},
|
{0x67, NULL, "GetDebugThreadContext"},
|
||||||
{0x68, NULL, "svcSetDebugThreadContext"},
|
{0x68, NULL, "SetDebugThreadContext"},
|
||||||
{0x69, NULL, "svcQueryDebugProcessMemory"},
|
{0x69, NULL, "QueryDebugProcessMemory"},
|
||||||
{0x6A, NULL, "svcReadProcessMemory"},
|
{0x6A, NULL, "ReadProcessMemory"},
|
||||||
{0x6B, NULL, "svcWriteProcessMemory"},
|
{0x6B, NULL, "WriteProcessMemory"},
|
||||||
{0x6C, NULL, "svcSetHardwareBreakPoint"},
|
{0x6C, NULL, "SetHardwareBreakPoint"},
|
||||||
{0x6D, NULL, "svcGetDebugThreadParam"},
|
{0x6D, NULL, "GetDebugThreadParam"},
|
||||||
{0x6E, NULL, "Unknown"},
|
{0x6E, NULL, "Unknown"},
|
||||||
{0x6F, NULL, "Unknown"},
|
{0x6F, NULL, "Unknown"},
|
||||||
{0x70, NULL, "svcControlProcessMemory"},
|
{0x70, NULL, "ControlProcessMemory"},
|
||||||
{0x71, NULL, "svcMapProcessMemory"},
|
{0x71, NULL, "MapProcessMemory"},
|
||||||
{0x72, NULL, "svcUnmapProcessMemory"},
|
{0x72, NULL, "UnmapProcessMemory"},
|
||||||
{0x73, NULL, "Unknown"},
|
{0x73, NULL, "Unknown"},
|
||||||
{0x74, NULL, "Unknown"},
|
{0x74, NULL, "Unknown"},
|
||||||
{0x75, NULL, "Unknown"},
|
{0x75, NULL, "Unknown"},
|
||||||
{0x76, NULL, "svcTerminateProcess"},
|
{0x76, NULL, "TerminateProcess"},
|
||||||
{0x77, NULL, "Unknown"},
|
{0x77, NULL, "Unknown"},
|
||||||
{0x78, NULL, "svcCreateResourceLimit"},
|
{0x78, NULL, "CreateResourceLimit"},
|
||||||
{0x79, NULL, "Unknown"},
|
{0x79, NULL, "Unknown"},
|
||||||
{0x7A, NULL, "Unknown"},
|
{0x7A, NULL, "Unknown"},
|
||||||
{0x7B, NULL, "Unknown"},
|
{0x7B, NULL, "Unknown"},
|
||||||
{0x7C, NULL, "svcKernelSetState"},
|
{0x7C, NULL, "KernelSetState"},
|
||||||
{0x7D, NULL, "svcQueryProcessMemory"},
|
{0x7D, NULL, "QueryProcessMemory"},
|
||||||
};
|
};
|
||||||
|
|
||||||
void Register() {
|
void Register() {
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// Copyright 2014 Citra Emulator Project
|
// Copyright 2014 Citra Emulator Project
|
||||||
// Licensed under GPLv2
|
// Licensed under GPLv2
|
||||||
// Refer to the license.txt file included.
|
// Refer to the license.txt file included.
|
||||||
|
|
||||||
@ -12,7 +12,6 @@
|
|||||||
|
|
||||||
namespace Memory {
|
namespace Memory {
|
||||||
|
|
||||||
|
|
||||||
u8* g_base = NULL; ///< The base pointer to the auto-mirrored arena.
|
u8* g_base = NULL; ///< The base pointer to the auto-mirrored arena.
|
||||||
|
|
||||||
MemArena g_arena; ///< The MemArena class
|
MemArena g_arena; ///< The MemArena class
|
||||||
|
@ -33,8 +33,9 @@ enum {
|
|||||||
MEM_VRAM_VADDR = 0x1F000000,
|
MEM_VRAM_VADDR = 0x1F000000,
|
||||||
MEM_SCRATCHPAD_VADDR = (0x10000000 - MEM_SCRATCHPAD_SIZE), ///< Scratchpad virtual address
|
MEM_SCRATCHPAD_VADDR = (0x10000000 - MEM_SCRATCHPAD_SIZE), ///< Scratchpad virtual address
|
||||||
|
|
||||||
MEM_OSHLE_VADDR = 0xC0000000, ///< Memory for use by OSHLE accessible by appcore CPU
|
|
||||||
MEM_OSHLE_SIZE = 0x08000000, ///< ...Same size as FCRAM for now
|
MEM_OSHLE_SIZE = 0x08000000, ///< ...Same size as FCRAM for now
|
||||||
|
MEM_OSHLE_VADDR = 0xA0000000, ///< Memory for use by OSHLE accessible by appcore CPU
|
||||||
|
MEM_OSHLE_VADDR_END = (MEM_OSHLE_VADDR + MEM_OSHLE_SIZE),
|
||||||
};
|
};
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
|
|
||||||
#include "core/mem_map.h"
|
#include "core/mem_map.h"
|
||||||
#include "core/hw/hw.h"
|
#include "core/hw/hw.h"
|
||||||
|
#include "hle/hle.h"
|
||||||
|
|
||||||
namespace Memory {
|
namespace Memory {
|
||||||
|
|
||||||
@ -15,9 +16,16 @@ inline void _Read(T &var, const u32 addr) {
|
|||||||
// TODO: Make sure this represents the mirrors in a correct way.
|
// TODO: Make sure this represents the mirrors in a correct way.
|
||||||
// Could just do a base-relative read, too.... TODO
|
// Could just do a base-relative read, too.... TODO
|
||||||
|
|
||||||
|
|
||||||
|
// Memory allocated for HLE use that can be addressed from the emulated application
|
||||||
|
// The primary use of this is sharing a commandbuffer between the HLE OS (syscore) and the LLE
|
||||||
|
// core running the user application (appcore)
|
||||||
|
if (addr >= MEM_OSHLE_VADDR && addr < MEM_OSHLE_VADDR_END) {
|
||||||
|
NOTICE_LOG(MEMMAP, "OSHLE read @ 0x%08X", addr);
|
||||||
|
|
||||||
// Hardware I/O register reads
|
// Hardware I/O register reads
|
||||||
// 0x10XXXXXX- is physical address space, 0x1EXXXXXX is virtual address space
|
// 0x10XXXXXX- is physical address space, 0x1EXXXXXX is virtual address space
|
||||||
if ((addr & 0xFF000000) == 0x10000000 || (addr & 0xFF000000) == 0x1E000000) {
|
} else if ((addr & 0xFF000000) == 0x10000000 || (addr & 0xFF000000) == 0x1E000000) {
|
||||||
HW::Read<T>(var, addr);
|
HW::Read<T>(var, addr);
|
||||||
|
|
||||||
// FCRAM virtual address reads
|
// FCRAM virtual address reads
|
||||||
@ -47,9 +55,15 @@ inline void _Read(T &var, const u32 addr) {
|
|||||||
template <typename T>
|
template <typename T>
|
||||||
inline void _Write(u32 addr, const T data) {
|
inline void _Write(u32 addr, const T data) {
|
||||||
|
|
||||||
|
// Memory allocated for HLE use that can be addressed from the emulated application
|
||||||
|
// The primary use of this is sharing a commandbuffer between the HLE OS (syscore) and the LLE
|
||||||
|
// core running the user application (appcore)
|
||||||
|
if (addr >= MEM_OSHLE_VADDR && addr < MEM_OSHLE_VADDR_END) {
|
||||||
|
NOTICE_LOG(MEMMAP, "OSHLE write @ 0x%08X", addr);
|
||||||
|
|
||||||
// Hardware I/O register writes
|
// Hardware I/O register writes
|
||||||
// 0x10XXXXXX- is physical address space, 0x1EXXXXXX is virtual address space
|
// 0x10XXXXXX- is physical address space, 0x1EXXXXXX is virtual address space
|
||||||
if ((addr & 0xFF000000) == 0x10000000 || (addr & 0xFF000000) == 0x1E000000) {
|
} else if ((addr & 0xFF000000) == 0x10000000 || (addr & 0xFF000000) == 0x1E000000) {
|
||||||
HW::Write<const T>(addr, data);
|
HW::Write<const T>(addr, data);
|
||||||
|
|
||||||
// ExeFS:/.code is loaded here:
|
// ExeFS:/.code is loaded here:
|
||||||
|
Loading…
Reference in New Issue
Block a user