Merge remote-tracking branch 'upstream/master' into issue-7-fix

This commit is contained in:
archshift 2014-05-16 23:21:03 -07:00
commit b8c8d0903e
61 changed files with 15072 additions and 494 deletions

View file

@ -0,0 +1,70 @@
// Copyright 2014 Citra Emulator Project
// Licensed under GPLv2
// Refer to the license.txt file included.
#include "common/common_types.h"
#include "common/log.h"
#include "core/hle/config_mem.h"
////////////////////////////////////////////////////////////////////////////////////////////////////
namespace ConfigMem {
enum {
KERNEL_VERSIONREVISION = 0x1FF80001,
KERNEL_VERSIONMINOR = 0x1FF80002,
KERNEL_VERSIONMAJOR = 0x1FF80003,
UPDATEFLAG = 0x1FF80004,
NSTID = 0x1FF80008,
SYSCOREVER = 0x1FF80010,
UNITINFO = 0x1FF80014,
KERNEL_CTRSDKVERSION = 0x1FF80018,
APPMEMTYPE = 0x1FF80030,
APPMEMALLOC = 0x1FF80040,
FIRM_VERSIONREVISION = 0x1FF80061,
FIRM_VERSIONMINOR = 0x1FF80062,
FIRM_VERSIONMAJOR = 0x1FF80063,
FIRM_SYSCOREVER = 0x1FF80064,
FIRM_CTRSDKVERSION = 0x1FF80068,
};
template <typename T>
inline void Read(T &var, const u32 addr) {
switch (addr) {
// Bit 0 set for Retail
case UNITINFO:
var = 0x00000001;
break;
// Set app memory size to 64MB?
case APPMEMALLOC:
var = 0x04000000;
break;
// Unknown - normally set to: 0x08000000 - (APPMEMALLOC + *0x1FF80048)
// (Total FCRAM size - APPMEMALLOC - *0x1FF80048)
case 0x1FF80044:
var = 0x08000000 - (0x04000000 + 0x1400000);
break;
// Unknown - normally set to: 0x1400000 (20MB)
case 0x1FF80048:
var = 0x1400000;
break;
default:
ERROR_LOG(HLE, "unknown ConfigMem::Read%d @ 0x%08X", sizeof(var) * 8, addr);
}
}
// Explicitly instantiate template functions because we aren't defining this in the header:
template void Read<u64>(u64 &var, const u32 addr);
template void Read<u32>(u32 &var, const u32 addr);
template void Read<u16>(u16 &var, const u32 addr);
template void Read<u8>(u8 &var, const u32 addr);
} // namespace

21
src/core/hle/config_mem.h Normal file
View file

@ -0,0 +1,21 @@
// Copyright 2014 Citra Emulator Project
// Licensed under GPLv2
// Refer to the license.txt file included.
#pragma once
// Configuration memory stores various hardware/kernel configuration settings. This memory page is
// read-only for ARM11 processes. I'm guessing this would normally be written to by the firmware/
// bootrom. Because we're not emulating this, and essentially just "stubbing" the functionality, I'm
// putting this as a subset of HLE for now.
#include "common/common_types.h"
////////////////////////////////////////////////////////////////////////////////////////////////////
namespace ConfigMem {
template <typename T>
inline void Read(T &var, const u32 addr);
} // namespace

View file

@ -0,0 +1,34 @@
// Copyright 2014 Citra Emulator Project
// Licensed under GPLv2
// Refer to the license.txt file included.
#include "core/hle/coprocessor.h"
#include "core/hle/hle.h"
#include "core/mem_map.h"
#include "core/core.h"
namespace HLE {
/// Returns the coprocessor (in this case, syscore) command buffer pointer
Addr GetThreadCommandBuffer() {
// Called on insruction: mrc p15, 0, r0, c13, c0, 3
return Memory::KERNEL_MEMORY_VADDR;
}
/// Call an MRC (move to ARM register from coprocessor) instruction in HLE
s32 CallMRC(u32 instruction) {
CoprocessorOperation operation = (CoprocessorOperation)((instruction >> 20) & 0xFF);
switch (operation) {
case CALL_GET_THREAD_COMMAND_BUFFER:
return GetThreadCommandBuffer();
default:
//DEBUG_LOG(OSHLE, "unknown MRC call 0x%08X", instruction);
break;
}
return -1;
}
} // namespace

View file

@ -8,13 +8,13 @@
namespace HLE {
/// MRC operations (ARM register from coprocessor), decoded as instr[20:27]
enum ARM11_MRC_OPERATION {
/// Coprocessor operations
enum CoprocessorOperation {
DATA_SYNCHRONIZATION_BARRIER = 0xE0,
CALL_GET_THREAD_COMMAND_BUFFER = 0xE1,
};
/// Call an MRC operation in HLE
u32 CallMRC(ARM11_MRC_OPERATION operation);
/// Call an MRC (move to ARM register from coprocessor) instruction in HLE
s32 CallMRC(u32 instruction);
} // namespace

View file

@ -143,8 +143,8 @@ template<int func(u32, u32, u32, u32, u32)> void WrapI_UUUUU() {
RETURN(retval);
}
template<int func()> void WrapI_V() {
int retval = func();
template<int func(void*)> void WrapI_V() {
u32 retval = func(Memory::GetPointer(PARAM(0)));
RETURN(retval);
}
@ -623,6 +623,10 @@ template<u32 func(const char *, const char *)> void WrapU_CC() {
RETURN(retval);
}
template<void func(const char*)> void WrapV_C() {
func(Memory::GetCharPointer(PARAM(0)));
}
template<void func(const char *, int)> void WrapV_CI() {
func(Memory::GetCharPointer(PARAM(0)), PARAM(1));
}
@ -701,18 +705,28 @@ template <int func(int, const char *, int)> void WrapI_ICI() {
}
template<int func(int, void *, void *, void *, void *, u32, int)> void WrapI_IVVVVUI(){
u32 retval = func(PARAM(0), Memory::GetPointer(PARAM(1)), Memory::GetPointer(PARAM(2)), Memory::GetPointer(PARAM(3)), Memory::GetPointer(PARAM(4)), PARAM(5), PARAM(6) );
RETURN(retval);
u32 retval = func(PARAM(0), Memory::GetPointer(PARAM(1)), Memory::GetPointer(PARAM(2)), Memory::GetPointer(PARAM(3)), Memory::GetPointer(PARAM(4)), PARAM(5), PARAM(6) );
RETURN(retval);
}
template<int func(int, const char *, u32, void *, int, int, int)> void WrapI_ICUVIII(){
u32 retval = func(PARAM(0), Memory::GetCharPointer(PARAM(1)), PARAM(2), Memory::GetPointer(PARAM(3)), PARAM(4), PARAM(5), PARAM(6));
RETURN(retval);
u32 retval = func(PARAM(0), Memory::GetCharPointer(PARAM(1)), PARAM(2), Memory::GetPointer(PARAM(3)), PARAM(4), PARAM(5), PARAM(6));
RETURN(retval);
}
template<int func(void *, u32, u32, u32, u32, u32)> void WrapI_VUUUUU(){
u32 retval = func(Memory::GetPointer(PARAM(0)), PARAM(1), PARAM(2), PARAM(3), PARAM(4), PARAM(5));
RETURN(retval);
template<int func(void*, u32)> void WrapI_VU(){
u32 retval = func(Memory::GetPointer(PARAM(0)), PARAM(1));
RETURN(retval);
}
template<int func(void*, u32, void*, int)> void WrapI_VUVI(){
u32 retval = func(Memory::GetPointer(PARAM(0)), PARAM(1), Memory::GetPointer(PARAM(2)), PARAM(3));
RETURN(retval);
}
template<int func(void*, u32, u32, u32, u32, u32)> void WrapI_VUUUUU(){
u32 retval = func(Memory::GetPointer(PARAM(0)), PARAM(1), PARAM(2), PARAM(3), PARAM(4), PARAM(5));
RETURN(retval);
}
template<int func(u32, s64)> void WrapI_US64() {

View file

@ -15,49 +15,6 @@ namespace HLE {
static std::vector<ModuleDef> g_module_db;
u8* g_command_buffer = NULL; ///< Command buffer used for sharing between appcore and syscore
// Read from memory used by CTROS HLE functions
template <typename T>
inline void Read(T &var, const u32 addr) {
if (addr >= HLE::CMD_BUFFER_ADDR && addr < HLE::CMD_BUFFER_ADDR_END) {
var = *((const T*)&g_command_buffer[addr & CMD_BUFFER_MASK]);
} else {
ERROR_LOG(HLE, "unknown read from address %08X", addr);
}
}
// Write to memory used by CTROS HLE functions
template <typename T>
inline void Write(u32 addr, const T data) {
if (addr >= HLE::CMD_BUFFER_ADDR && addr < HLE::CMD_BUFFER_ADDR_END) {
*(T*)&g_command_buffer[addr & CMD_BUFFER_MASK] = data;
} else {
ERROR_LOG(HLE, "unknown write to address %08X", addr);
}
}
u8 *GetPointer(const u32 addr) {
if (addr >= HLE::CMD_BUFFER_ADDR && addr < HLE::CMD_BUFFER_ADDR_END) {
return g_command_buffer + (addr & CMD_BUFFER_MASK);
} else {
ERROR_LOG(HLE, "unknown pointer from address %08X", addr);
return 0;
}
}
// Explicitly instantiate template functions because we aren't defining this in the header:
template void Read<u64>(u64 &var, const u32 addr);
template void Read<u32>(u32 &var, const u32 addr);
template void Read<u16>(u16 &var, const u32 addr);
template void Read<u8>(u8 &var, const u32 addr);
template void Write<u64>(u32 addr, const u64 data);
template void Write<u32>(u32 addr, const u32 data);
template void Write<u16>(u32 addr, const u16 data);
template void Write<u8>(u32 addr, const u8 data);
const FunctionDef* GetSyscallInfo(u32 opcode) {
u32 func_num = opcode & 0xFFFFFF; // 8 bits
if (func_num > 0xFF) {
@ -91,8 +48,6 @@ void RegisterAllModules() {
void Init() {
Service::Init();
g_command_buffer = new u8[CMD_BUFFER_SIZE];
RegisterAllModules();
@ -102,8 +57,6 @@ void Init() {
void Shutdown() {
Service::Shutdown();
delete g_command_buffer;
g_module_db.clear();
NOTICE_LOG(HLE, "shutdown OK");

View file

@ -17,13 +17,6 @@
namespace HLE {
enum {
CMD_BUFFER_ADDR = 0xA0010000, ///< Totally arbitrary unused address space
CMD_BUFFER_SIZE = 0x10000,
CMD_BUFFER_MASK = (CMD_BUFFER_SIZE - 1),
CMD_BUFFER_ADDR_END = (CMD_BUFFER_ADDR + CMD_BUFFER_SIZE),
};
typedef u32 Addr;
typedef void (*Func)();
@ -39,20 +32,6 @@ struct ModuleDef {
const FunctionDef* func_table;
};
// Read from memory used by CTROS HLE functions
template <typename T>
inline void Read(T &var, const u32 addr);
// Write to memory used by CTROS HLE functions
template <typename T>
inline void Write(u32 addr, const T data);
u8* GetPointer(const u32 Address);
inline const char* GetCharPointer(const u32 address) {
return (const char *)GetPointer(address);
}
void RegisterModule(std::string name, int num_functions, const FunctionDef *func_table);
void CallSyscall(u32 opcode);

View file

@ -1,64 +0,0 @@
// Copyright 2014 Citra Emulator Project
// Licensed under GPLv2
// Refer to the license.txt file included.
#include "core/hle/mrc.h"
#include "core/hle/hle.h"
#include "core/mem_map.h"
#include "core/core.h"
namespace HLE {
enum {
CMD_GX_REQUEST_DMA = 0x00000000,
};
/// Data synchronization barrier
u32 DataSynchronizationBarrier(u32* command_buffer) {
u32 command = command_buffer[0];
switch (command) {
case CMD_GX_REQUEST_DMA:
{
u32* src = (u32*)Memory::GetPointer(command_buffer[1]);
u32* dst = (u32*)Memory::GetPointer(command_buffer[2]);
u32 size = command_buffer[3];
memcpy(dst, src, size);
}
break;
default:
ERROR_LOG(OSHLE, "MRC::DataSynchronizationBarrier unknown command 0x%08X", command);
return -1;
}
return 0;
}
/// Returns the coprocessor (in this case, syscore) command buffer pointer
Addr GetThreadCommandBuffer() {
// Called on insruction: mrc p15, 0, r0, c13, c0, 3
// Returns an address in OSHLE memory for the CPU to read/write to
RETURN(CMD_BUFFER_ADDR);
return CMD_BUFFER_ADDR;
}
/// Call an MRC operation in HLE
u32 CallMRC(ARM11_MRC_OPERATION operation) {
switch (operation) {
case DATA_SYNCHRONIZATION_BARRIER:
return DataSynchronizationBarrier((u32*)Memory::GetPointer(PARAM(0)));
case CALL_GET_THREAD_COMMAND_BUFFER:
return GetThreadCommandBuffer();
default:
ERROR_LOG(OSHLE, "unimplemented MRC operation 0x%02X", operation);
break;
}
return -1;
}
} // namespace

View file

@ -18,7 +18,7 @@ void Initialize(Service::Interface* self) {
}
void GetLockHandle(Service::Interface* self) {
u32* cmd_buff = (u32*)HLE::GetPointer(HLE::CMD_BUFFER_ADDR + Service::kCommandHeaderOffset);
u32* cmd_buff = Service::GetCommandBuffer();
cmd_buff[5] = 0x00000000; // TODO: This should be an actual mutex handle
}

View file

@ -4,6 +4,7 @@
#include "common/log.h"
#include "common/bit_field.h"
#include "core/mem_map.h"
#include "core/hle/hle.h"
@ -11,11 +12,52 @@
#include "core/hw/lcd.h"
////////////////////////////////////////////////////////////////////////////////////////////////////
/// GSP shared memory GX command buffer header
union GX_CmdBufferHeader {
u32 hex;
// Current command index. This index is updated by GSP module after loading the command data,
// right before the command is processed. When this index is updated by GSP module, the total
// commands field is decreased by one as well.
BitField<0,8,u32> index;
// Total commands to process, must not be value 0 when GSP module handles commands. This must be
// <=15 when writing a command to shared memory. This is incremented by the application when
// writing a command to shared memory, after increasing this value TriggerCmdReqQueue is only
// used if this field is value 1.
BitField<8,8,u32> number_commands;
};
/// Gets the address of the start (header) of a command buffer in GSP shared memory
static inline u32 GX_GetCmdBufferAddress(u32 thread_id) {
return (0x10002000 + 0x800 + (thread_id * 0x200));
}
/// Gets a pointer to the start (header) of a command buffer in GSP shared memory
static inline u8* GX_GetCmdBufferPointer(u32 thread_id, u32 offset=0) {
return Memory::GetPointer(GX_GetCmdBufferAddress(thread_id) + offset);
}
/// Finishes execution of a GSP command
void GX_FinishCommand(u32 thread_id) {
GX_CmdBufferHeader* header = (GX_CmdBufferHeader*)GX_GetCmdBufferPointer(thread_id);
header->number_commands = header->number_commands - 1;
}
////////////////////////////////////////////////////////////////////////////////////////////////////
// Namespace GSP_GPU
namespace GSP_GPU {
u32 g_thread_id = 0;
enum {
CMD_GX_REQUEST_DMA = 0x00000000,
};
enum {
REG_FRAMEBUFFER_1 = 0x00400468,
REG_FRAMEBUFFER_2 = 0x00400494,
@ -26,7 +68,7 @@ void ReadHWRegs(Service::Interface* self) {
static const u32 framebuffer_1[] = {LCD::PADDR_VRAM_TOP_LEFT_FRAME1, LCD::PADDR_VRAM_TOP_RIGHT_FRAME1};
static const u32 framebuffer_2[] = {LCD::PADDR_VRAM_TOP_LEFT_FRAME2, LCD::PADDR_VRAM_TOP_RIGHT_FRAME2};
u32* cmd_buff = (u32*)HLE::GetPointer(HLE::CMD_BUFFER_ADDR + Service::kCommandHeaderOffset);
u32* cmd_buff = Service::GetCommandBuffer();
u32 reg_addr = cmd_buff[1];
u32 size = cmd_buff[2];
u32* dst = (u32*)Memory::GetPointer(cmd_buff[0x41]);
@ -50,18 +92,37 @@ void ReadHWRegs(Service::Interface* self) {
break;
default:
ERROR_LOG(OSHLE, "GSP_GPU::ReadHWRegs unknown register read at address %08X", reg_addr);
ERROR_LOG(GSP, "ReadHWRegs unknown register read at address %08X", reg_addr);
}
}
void RegisterInterruptRelayQueue(Service::Interface* self) {
u32* cmd_buff = (u32*)HLE::GetPointer(HLE::CMD_BUFFER_ADDR + Service::kCommandHeaderOffset);
u32* cmd_buff = Service::GetCommandBuffer();
u32 flags = cmd_buff[1];
u32 event_handle = cmd_buff[3]; // TODO(bunnei): Implement event handling
cmd_buff[2] = g_thread_id; // ThreadID
cmd_buff[4] = self->NewHandle();
}
return;
/// This triggers handling of the GX command written to the command buffer in shared memory.
void TriggerCmdReqQueue(Service::Interface* self) {
GX_CmdBufferHeader* header = (GX_CmdBufferHeader*)GX_GetCmdBufferPointer(g_thread_id);
u32* cmd_buff = (u32*)GX_GetCmdBufferPointer(g_thread_id, 0x20 + (header->index * 0x20));
switch (cmd_buff[0]) {
// GX request DMA - typically used for copying memory from GSP heap to VRAM
case CMD_GX_REQUEST_DMA:
memcpy(Memory::GetPointer(cmd_buff[2]), Memory::GetPointer(cmd_buff[1]), cmd_buff[3]);
break;
default:
ERROR_LOG(GSP, "TriggerCmdReqQueue unknown command 0x%08X", cmd_buff[0]);
}
GX_FinishCommand(g_thread_id);
}
const Interface::FunctionInfo FunctionTable[] = {
@ -76,7 +137,7 @@ const Interface::FunctionInfo FunctionTable[] = {
{0x00090082, NULL, "InvalidateDataCache"},
{0x000A0044, NULL, "RegisterInterruptEvents"},
{0x000B0040, NULL, "SetLcdForceBlack"},
{0x000C0000, NULL, "TriggerCmdReqQueue"},
{0x000C0000, TriggerCmdReqQueue, "TriggerCmdReqQueue"},
{0x000D0140, NULL, "SetDisplayTransfer"},
{0x000E0180, NULL, "SetTextureCopy"},
{0x000F0200, NULL, "SetMemoryFill"},

View file

@ -10,6 +10,7 @@
#include "common/common.h"
#include "common/common_types.h"
#include "core/mem_map.h"
#include "core/hle/syscall.h"
////////////////////////////////////////////////////////////////////////////////////////////////////
@ -22,6 +23,15 @@ typedef s32 NativeUID; ///< Native handle for a service
static const int kMaxPortSize = 0x08; ///< Maximum size of a port name (8 characters)
static const int kCommandHeaderOffset = 0x80; ///< Offset into command buffer of header
/**
* Returns a pointer to the command buffer in kernel memory
* @param offset Optional offset into command buffer
* @return Pointer to command buffer
*/
inline static u32* GetCommandBuffer(const int offset=0) {
return (u32*)Memory::GetPointer(Memory::KERNEL_MEMORY_VADDR + kCommandHeaderOffset + offset);
}
class Manager;
/// Interface to a CTROS service
@ -81,7 +91,7 @@ public:
* @return Return result of svcSendSyncRequest passed back to user app
*/
Syscall::Result Sync() {
u32* cmd_buff = (u32*)HLE::GetPointer(HLE::CMD_BUFFER_ADDR + kCommandHeaderOffset);
u32* cmd_buff = GetCommandBuffer();
auto itr = m_functions.find(cmd_buff[0]);
if (itr == m_functions.end()) {

View file

@ -18,7 +18,7 @@ void Initialize(Service::Interface* self) {
void GetServiceHandle(Service::Interface* self) {
Syscall::Result res = 0;
u32* cmd_buff = (u32*)HLE::GetPointer(HLE::CMD_BUFFER_ADDR + Service::kCommandHeaderOffset);
u32* cmd_buff = Service::GetCommandBuffer();
std::string port_name = std::string((const char*)&cmd_buff[1], 0, Service::kMaxPortSize);
Service::Interface* service = Service::g_manager->FetchFromPortName(port_name);

View file

@ -29,6 +29,9 @@ enum MapMemoryPermission {
Result ControlMemory(u32 operation, u32 addr0, u32 addr1, u32 size, u32 permissions) {
u32 virtual_address = 0x00000000;
DEBUG_LOG(SVC, "ControlMemory called operation=0x%08X, addr0=0x%08X, addr1=0x%08X, size=%08X, permissions=0x%08X",
operation, addr0, addr1, size, permissions);
switch (operation) {
// Map normal heap memory
@ -43,16 +46,18 @@ Result ControlMemory(u32 operation, u32 addr0, u32 addr1, u32 size, u32 permissi
// Unknown ControlMemory operation
default:
ERROR_LOG(OSHLE, "Unknown ControlMemory operation %08X", operation);
ERROR_LOG(SVC, "ControlMemory unknown operation=0x%08X", operation);
}
Core::g_app_core->SetReg(1, virtual_address);
return 0;
}
/// Maps a memory block to specified address
Result MapMemoryBlock(Handle memblock, u32 addr, u32 mypermissions, u32 otherpermission) {
int x = 0;
DEBUG_LOG(SVC, "MapMemoryBlock called memblock=0x08X, addr=0x%08X, mypermissions=0x%08X, otherpermission=%d",
memblock, addr, mypermissions, otherpermission);
switch (mypermissions) {
case MEMORY_PERMISSION_NORMAL:
case MEMORY_PERMISSION_NORMAL + 1:
@ -60,20 +65,23 @@ Result MapMemoryBlock(Handle memblock, u32 addr, u32 mypermissions, u32 otherper
Memory::MapBlock_Shared(memblock, addr, mypermissions);
break;
default:
ERROR_LOG(OSHLE, "Unknown MapMemoryBlock permissions %08X", mypermissions);
ERROR_LOG(OSHLE, "MapMemoryBlock unknown permissions=0x%08X", mypermissions);
}
return 0;
}
/// Connect to an OS service given the port name, returns the handle to the port to out
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());
DEBUG_LOG(SVC, "ConnectToPort called port_name=%s", port_name);
return 0;
}
/// Synchronize to an OS service
Result SendSyncRequest(Handle session) {
DEBUG_LOG(SVC, "SendSyncRequest called session=0x%08X");
Service::Interface* service = Service::g_manager->FetchFromUID(session);
service->Sync();
return 0;
@ -82,142 +90,177 @@ Result SendSyncRequest(Handle session) {
/// Close a handle
Result CloseHandle(Handle handle) {
// ImplementMe
DEBUG_LOG(SVC, "(UNIMPLEMENTED) CloseHandle called handle=0x%08X", handle);
return 0;
}
/// Wait for a handle to synchronize, timeout after the specified nanoseconds
Result WaitSynchronization1(Handle handle, s64 nanoseconds) {
// ImplementMe
DEBUG_LOG(SVC, "(UNIMPLEMENTED) WaitSynchronization1 called handle=0x%08X, nanoseconds=%d",
handle, nanoseconds);
return 0;
}
/// Create an address arbiter (to allocate access to shared resources)
Result CreateAddressArbiter(void* arbiter) {
// ImplementMe
DEBUG_LOG(SVC, "(UNIMPLEMENTED) CreateAddressArbiter called");
Core::g_app_core->SetReg(1, 0xDEADBEEF);
return 0;
}
/// Used to output a message on a debug hardware unit - does nothing on a retail unit
void OutputDebugString(const char* string) {
NOTICE_LOG(SVC, "## OSDEBUG: %08X %s", Core::g_app_core->GetPC(), string);
}
/// Get resource limit
Result GetResourceLimit(void* 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.
DEBUG_LOG(SVC, "(UNIMPLEMENTED) GetResourceLimit called process=0x%08X", process);
Core::g_app_core->SetReg(1, 0xDEADBEEF);
return 0;
}
/// Get resource limit current values
Result GetResourceLimitCurrentValues(void* _values, Handle resource_limit, void* names, s32 name_count) {
//s64* values = (s64*)_values;
DEBUG_LOG(SVC, "(UNIMPLEMENTED) GetResourceLimitCurrentValues called resource_limit=%08X, names=%s, name_count=%d",
resource_limit, names, name_count);
Memory::Write32(Core::g_app_core->GetReg(0), 0); // Normmatt: Set used memory to 0 for now
return 0;
}
const HLE::FunctionDef Syscall_Table[] = {
{0x00, NULL, "Unknown"},
{0x01, WrapI_UUUUU<ControlMemory>, "ControlMemory"},
{0x02, NULL, "QueryMemory"},
{0x03, NULL, "ExitProcess"},
{0x04, NULL, "GetProcessAffinityMask"},
{0x05, NULL, "SetProcessAffinityMask"},
{0x06, NULL, "GetProcessIdealProcessor"},
{0x07, NULL, "SetProcessIdealProcessor"},
{0x08, NULL, "CreateThread"},
{0x09, NULL, "ExitThread"},
{0x0A, NULL, "SleepThread"},
{0x0B, NULL, "GetThreadPriority"},
{0x0C, NULL, "SetThreadPriority"},
{0x0D, NULL, "GetThreadAffinityMask"},
{0x0E, NULL, "SetThreadAffinityMask"},
{0x0F, NULL, "GetThreadIdealProcessor"},
{0x10, NULL, "SetThreadIdealProcessor"},
{0x11, NULL, "GetCurrentProcessorNumber"},
{0x12, NULL, "Run"},
{0x13, NULL, "CreateMutex"},
{0x14, NULL, "ReleaseMutex"},
{0x15, NULL, "CreateSemaphore"},
{0x16, NULL, "ReleaseSemaphore"},
{0x17, NULL, "CreateEvent"},
{0x18, NULL, "SignalEvent"},
{0x19, NULL, "ClearEvent"},
{0x1A, NULL, "CreateTimer"},
{0x1B, NULL, "SetTimer"},
{0x1C, NULL, "CancelTimer"},
{0x1D, NULL, "ClearTimer"},
{0x1E, NULL, "CreateMemoryBlock"},
{0x1F, WrapI_UUUU<MapMemoryBlock>, "MapMemoryBlock"},
{0x20, NULL, "UnmapMemoryBlock"},
{0x21, NULL, "CreateAddressArbiter"},
{0x22, NULL, "ArbitrateAddress"},
{0x23, WrapI_U<CloseHandle>, "CloseHandle"},
{0x24, WrapI_US64<WaitSynchronization1>, "WaitSynchronization1"},
{0x25, NULL, "WaitSynchronizationN"},
{0x26, NULL, "SignalAndWait"},
{0x27, NULL, "DuplicateHandle"},
{0x28, NULL, "GetSystemTick"},
{0x29, NULL, "GetHandleInfo"},
{0x2A, NULL, "GetSystemInfo"},
{0x2B, NULL, "GetProcessInfo"},
{0x2C, NULL, "GetThreadInfo"},
{0x2D, WrapI_VC<ConnectToPort>, "ConnectToPort"},
{0x2E, NULL, "SendSyncRequest1"},
{0x2F, NULL, "SendSyncRequest2"},
{0x30, NULL, "SendSyncRequest3"},
{0x31, NULL, "SendSyncRequest4"},
{0x32, WrapI_U<SendSyncRequest>, "SendSyncRequest"},
{0x33, NULL, "OpenProcess"},
{0x34, NULL, "OpenThread"},
{0x35, NULL, "GetProcessId"},
{0x36, NULL, "GetProcessIdOfThread"},
{0x37, NULL, "GetThreadId"},
{0x38, NULL, "GetResourceLimit"},
{0x39, NULL, "GetResourceLimitLimitValues"},
{0x3A, NULL, "GetResourceLimitCurrentValues"},
{0x3B, NULL, "GetThreadContext"},
{0x3C, NULL, "Break"},
{0x3D, NULL, "OutputDebugString"},
{0x3E, NULL, "ControlPerformanceCounter"},
{0x3F, NULL, "Unknown"},
{0x40, NULL, "Unknown"},
{0x41, NULL, "Unknown"},
{0x42, NULL, "Unknown"},
{0x43, NULL, "Unknown"},
{0x44, NULL, "Unknown"},
{0x45, NULL, "Unknown"},
{0x46, NULL, "Unknown"},
{0x47, NULL, "CreatePort"},
{0x48, NULL, "CreateSessionToPort"},
{0x49, NULL, "CreateSession"},
{0x4A, NULL, "AcceptSession"},
{0x4B, NULL, "ReplyAndReceive1"},
{0x4C, NULL, "ReplyAndReceive2"},
{0x4D, NULL, "ReplyAndReceive3"},
{0x4E, NULL, "ReplyAndReceive4"},
{0x4F, NULL, "ReplyAndReceive"},
{0x50, NULL, "BindInterrupt"},
{0x51, NULL, "UnbindInterrupt"},
{0x52, NULL, "InvalidateProcessDataCache"},
{0x53, NULL, "StoreProcessDataCache"},
{0x54, NULL, "FlushProcessDataCache"},
{0x55, NULL, "StartInterProcessDma"},
{0x56, NULL, "StopDma"},
{0x57, NULL, "GetDmaState"},
{0x58, NULL, "RestartDma"},
{0x59, NULL, "Unknown"},
{0x5A, NULL, "Unknown"},
{0x5B, NULL, "Unknown"},
{0x5C, NULL, "Unknown"},
{0x5D, NULL, "Unknown"},
{0x5E, NULL, "Unknown"},
{0x5F, NULL, "Unknown"},
{0x60, NULL, "DebugActiveProcess"},
{0x61, NULL, "BreakDebugProcess"},
{0x62, NULL, "TerminateDebugProcess"},
{0x63, NULL, "GetProcessDebugEvent"},
{0x64, NULL, "ContinueDebugEvent"},
{0x65, NULL, "GetProcessList"},
{0x66, NULL, "GetThreadList"},
{0x67, NULL, "GetDebugThreadContext"},
{0x68, NULL, "SetDebugThreadContext"},
{0x69, NULL, "QueryDebugProcessMemory"},
{0x6A, NULL, "ReadProcessMemory"},
{0x6B, NULL, "WriteProcessMemory"},
{0x6C, NULL, "SetHardwareBreakPoint"},
{0x6D, NULL, "GetDebugThreadParam"},
{0x6E, NULL, "Unknown"},
{0x6F, NULL, "Unknown"},
{0x70, NULL, "ControlProcessMemory"},
{0x71, NULL, "MapProcessMemory"},
{0x72, NULL, "UnmapProcessMemory"},
{0x73, NULL, "Unknown"},
{0x74, NULL, "Unknown"},
{0x75, NULL, "Unknown"},
{0x76, NULL, "TerminateProcess"},
{0x77, NULL, "Unknown"},
{0x78, NULL, "CreateResourceLimit"},
{0x79, NULL, "Unknown"},
{0x7A, NULL, "Unknown"},
{0x7B, NULL, "Unknown"},
{0x7C, NULL, "KernelSetState"},
{0x7D, NULL, "QueryProcessMemory"},
{0x00, NULL, "Unknown"},
{0x01, WrapI_UUUUU<ControlMemory>, "ControlMemory"},
{0x02, NULL, "QueryMemory"},
{0x03, NULL, "ExitProcess"},
{0x04, NULL, "GetProcessAffinityMask"},
{0x05, NULL, "SetProcessAffinityMask"},
{0x06, NULL, "GetProcessIdealProcessor"},
{0x07, NULL, "SetProcessIdealProcessor"},
{0x08, NULL, "CreateThread"},
{0x09, NULL, "ExitThread"},
{0x0A, NULL, "SleepThread"},
{0x0B, NULL, "GetThreadPriority"},
{0x0C, NULL, "SetThreadPriority"},
{0x0D, NULL, "GetThreadAffinityMask"},
{0x0E, NULL, "SetThreadAffinityMask"},
{0x0F, NULL, "GetThreadIdealProcessor"},
{0x10, NULL, "SetThreadIdealProcessor"},
{0x11, NULL, "GetCurrentProcessorNumber"},
{0x12, NULL, "Run"},
{0x13, NULL, "CreateMutex"},
{0x14, NULL, "ReleaseMutex"},
{0x15, NULL, "CreateSemaphore"},
{0x16, NULL, "ReleaseSemaphore"},
{0x17, NULL, "CreateEvent"},
{0x18, NULL, "SignalEvent"},
{0x19, NULL, "ClearEvent"},
{0x1A, NULL, "CreateTimer"},
{0x1B, NULL, "SetTimer"},
{0x1C, NULL, "CancelTimer"},
{0x1D, NULL, "ClearTimer"},
{0x1E, NULL, "CreateMemoryBlock"},
{0x1F, WrapI_UUUU<MapMemoryBlock>, "MapMemoryBlock"},
{0x20, NULL, "UnmapMemoryBlock"},
{0x21, WrapI_V<CreateAddressArbiter>, "CreateAddressArbiter"},
{0x22, NULL, "ArbitrateAddress"},
{0x23, WrapI_U<CloseHandle>, "CloseHandle"},
{0x24, WrapI_US64<WaitSynchronization1>, "WaitSynchronization1"},
{0x25, NULL, "WaitSynchronizationN"},
{0x26, NULL, "SignalAndWait"},
{0x27, NULL, "DuplicateHandle"},
{0x28, NULL, "GetSystemTick"},
{0x29, NULL, "GetHandleInfo"},
{0x2A, NULL, "GetSystemInfo"},
{0x2B, NULL, "GetProcessInfo"},
{0x2C, NULL, "GetThreadInfo"},
{0x2D, WrapI_VC<ConnectToPort>, "ConnectToPort"},
{0x2E, NULL, "SendSyncRequest1"},
{0x2F, NULL, "SendSyncRequest2"},
{0x30, NULL, "SendSyncRequest3"},
{0x31, NULL, "SendSyncRequest4"},
{0x32, WrapI_U<SendSyncRequest>, "SendSyncRequest"},
{0x33, NULL, "OpenProcess"},
{0x34, NULL, "OpenThread"},
{0x35, NULL, "GetProcessId"},
{0x36, NULL, "GetProcessIdOfThread"},
{0x37, NULL, "GetThreadId"},
{0x38, WrapI_VU<GetResourceLimit>, "GetResourceLimit"},
{0x39, NULL, "GetResourceLimitLimitValues"},
{0x3A, WrapI_VUVI<GetResourceLimitCurrentValues>, "GetResourceLimitCurrentValues"},
{0x3B, NULL, "GetThreadContext"},
{0x3C, NULL, "Break"},
{0x3D, WrapV_C<OutputDebugString>, "OutputDebugString"},
{0x3E, NULL, "ControlPerformanceCounter"},
{0x3F, NULL, "Unknown"},
{0x40, NULL, "Unknown"},
{0x41, NULL, "Unknown"},
{0x42, NULL, "Unknown"},
{0x43, NULL, "Unknown"},
{0x44, NULL, "Unknown"},
{0x45, NULL, "Unknown"},
{0x46, NULL, "Unknown"},
{0x47, NULL, "CreatePort"},
{0x48, NULL, "CreateSessionToPort"},
{0x49, NULL, "CreateSession"},
{0x4A, NULL, "AcceptSession"},
{0x4B, NULL, "ReplyAndReceive1"},
{0x4C, NULL, "ReplyAndReceive2"},
{0x4D, NULL, "ReplyAndReceive3"},
{0x4E, NULL, "ReplyAndReceive4"},
{0x4F, NULL, "ReplyAndReceive"},
{0x50, NULL, "BindInterrupt"},
{0x51, NULL, "UnbindInterrupt"},
{0x52, NULL, "InvalidateProcessDataCache"},
{0x53, NULL, "StoreProcessDataCache"},
{0x54, NULL, "FlushProcessDataCache"},
{0x55, NULL, "StartInterProcessDma"},
{0x56, NULL, "StopDma"},
{0x57, NULL, "GetDmaState"},
{0x58, NULL, "RestartDma"},
{0x59, NULL, "Unknown"},
{0x5A, NULL, "Unknown"},
{0x5B, NULL, "Unknown"},
{0x5C, NULL, "Unknown"},
{0x5D, NULL, "Unknown"},
{0x5E, NULL, "Unknown"},
{0x5F, NULL, "Unknown"},
{0x60, NULL, "DebugActiveProcess"},
{0x61, NULL, "BreakDebugProcess"},
{0x62, NULL, "TerminateDebugProcess"},
{0x63, NULL, "GetProcessDebugEvent"},
{0x64, NULL, "ContinueDebugEvent"},
{0x65, NULL, "GetProcessList"},
{0x66, NULL, "GetThreadList"},
{0x67, NULL, "GetDebugThreadContext"},
{0x68, NULL, "SetDebugThreadContext"},
{0x69, NULL, "QueryDebugProcessMemory"},
{0x6A, NULL, "ReadProcessMemory"},
{0x6B, NULL, "WriteProcessMemory"},
{0x6C, NULL, "SetHardwareBreakPoint"},
{0x6D, NULL, "GetDebugThreadParam"},
{0x6E, NULL, "Unknown"},
{0x6F, NULL, "Unknown"},
{0x70, NULL, "ControlProcessMemory"},
{0x71, NULL, "MapProcessMemory"},
{0x72, NULL, "UnmapProcessMemory"},
{0x73, NULL, "Unknown"},
{0x74, NULL, "Unknown"},
{0x75, NULL, "Unknown"},
{0x76, NULL, "TerminateProcess"},
{0x77, NULL, "Unknown"},
{0x78, NULL, "CreateResourceLimit"},
{0x79, NULL, "Unknown"},
{0x7A, NULL, "Unknown"},
{0x7B, NULL, "Unknown"},
{0x7C, NULL, "KernelSetState"},
{0x7D, NULL, "QueryProcessMemory"},
};
void Register() {