2014-12-14 22:49:33 -08:00
|
|
|
// Copyright 2014 Citra Emulator Project
|
2014-12-16 21:38:14 -08:00
|
|
|
// Licensed under GPLv2 or any later version
|
2014-12-14 22:49:33 -08:00
|
|
|
// Refer to the license.txt file included.
|
|
|
|
|
2015-05-06 00:06:12 -07:00
|
|
|
#include "common/logging/log.h"
|
|
|
|
|
2014-12-14 22:49:33 -08:00
|
|
|
#include "core/hle/hle.h"
|
|
|
|
#include "core/hle/service/ldr_ro.h"
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Namespace LDR_RO
|
|
|
|
|
|
|
|
namespace LDR_RO {
|
|
|
|
|
2015-01-31 15:11:51 -08:00
|
|
|
/**
|
|
|
|
* LDR_RO::Initialize service function
|
|
|
|
* Inputs:
|
|
|
|
* 1 : CRS buffer pointer
|
|
|
|
* 2 : CRS Size
|
|
|
|
* 3 : Process memory address where the CRS will be mapped
|
|
|
|
* 4 : Value, must be zero
|
|
|
|
* 5 : KProcess handle
|
|
|
|
* Outputs:
|
|
|
|
* 0 : Return header
|
|
|
|
* 1 : Result of function, 0 on success, otherwise error code
|
|
|
|
*/
|
|
|
|
static void Initialize(Service::Interface* self) {
|
|
|
|
u32* cmd_buff = Kernel::GetCommandBuffer();
|
|
|
|
u32 crs_buffer_ptr = cmd_buff[1];
|
|
|
|
u32 crs_size = cmd_buff[2];
|
|
|
|
u32 address = cmd_buff[3];
|
|
|
|
u32 value = cmd_buff[4];
|
|
|
|
u32 process = cmd_buff[5];
|
|
|
|
|
|
|
|
if (value != 0) {
|
|
|
|
LOG_ERROR(Service_LDR, "This value should be zero, but is actually %u!", value);
|
|
|
|
}
|
|
|
|
|
|
|
|
// TODO(purpasmart96): Verify return header on HW
|
|
|
|
|
|
|
|
cmd_buff[1] = RESULT_SUCCESS.raw; // No error
|
|
|
|
|
|
|
|
LOG_WARNING(Service_LDR, "(STUBBED) called");
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* LDR_RO::LoadCRR service function
|
|
|
|
* Inputs:
|
|
|
|
* 1 : CRS buffer pointer
|
|
|
|
* 2 : CRS Size
|
|
|
|
* 3 : Value, must be zero
|
|
|
|
* 4 : KProcess handle
|
|
|
|
* Outputs:
|
|
|
|
* 0 : Return header
|
|
|
|
* 1 : Result of function, 0 on success, otherwise error code
|
|
|
|
*/
|
|
|
|
static void LoadCRR(Service::Interface* self) {
|
|
|
|
u32* cmd_buff = Kernel::GetCommandBuffer();
|
|
|
|
u32 crs_buffer_ptr = cmd_buff[1];
|
|
|
|
u32 crs_size = cmd_buff[2];
|
|
|
|
u32 value = cmd_buff[3];
|
|
|
|
u32 process = cmd_buff[4];
|
|
|
|
|
|
|
|
if (value != 0) {
|
|
|
|
LOG_ERROR(Service_LDR, "This value should be zero, but is actually %u!", value);
|
|
|
|
}
|
|
|
|
|
|
|
|
// TODO(purpasmart96): Verify return header on HW
|
|
|
|
|
|
|
|
cmd_buff[1] = RESULT_SUCCESS.raw; // No error
|
|
|
|
|
|
|
|
LOG_WARNING(Service_LDR, "(STUBBED) called");
|
|
|
|
}
|
|
|
|
|
2014-12-14 22:49:33 -08:00
|
|
|
const Interface::FunctionInfo FunctionTable[] = {
|
2015-01-31 15:11:51 -08:00
|
|
|
{0x000100C2, Initialize, "Initialize"},
|
|
|
|
{0x00020082, LoadCRR, "LoadCRR"},
|
2015-01-01 16:58:27 -08:00
|
|
|
{0x00030042, nullptr, "UnloadCCR"},
|
|
|
|
{0x000402C2, nullptr, "LoadExeCRO"},
|
|
|
|
{0x000500C2, nullptr, "LoadCROSymbols"},
|
|
|
|
{0x00060042, nullptr, "CRO_Load?"},
|
|
|
|
{0x00070042, nullptr, "LoadCROSymbols"},
|
|
|
|
{0x00080042, nullptr, "Shutdown"},
|
|
|
|
{0x000902C2, nullptr, "LoadExeCRO_New?"},
|
2014-12-14 22:49:33 -08:00
|
|
|
};
|
2014-12-21 11:52:10 -08:00
|
|
|
|
2014-12-14 22:49:33 -08:00
|
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Interface class
|
|
|
|
|
|
|
|
Interface::Interface() {
|
2015-01-30 10:56:49 -08:00
|
|
|
Register(FunctionTable);
|
2014-12-14 22:49:33 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace
|