svc: Implement SetHeapSize.
This commit is contained in:
parent
ad073846bc
commit
7618b5237d
|
@ -42,9 +42,17 @@ void Wrap() {
|
||||||
FuncReturn(func(PARAM(0), PARAM(1)).raw);
|
FuncReturn(func(PARAM(0), PARAM(1)).raw);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <ResultCode func(u64, u64, u64)>
|
template <ResultCode func(u64, u64, s64)>
|
||||||
void Wrap() {
|
void Wrap() {
|
||||||
FuncReturn(func(PARAM(0), PARAM(1), PARAM(2)).raw);
|
FuncReturn(func(PARAM(1), PARAM(2), (s64)PARAM(3)).raw);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <ResultCode func(u64*, u64)>
|
||||||
|
void Wrap() {
|
||||||
|
u64 param_1 = 0;
|
||||||
|
u32 retval = func(¶m_1, PARAM(1)).raw;
|
||||||
|
Core::CPU().SetReg(1, param_1);
|
||||||
|
FuncReturn(retval);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <ResultCode func(u64*, u64, u64, u64)>
|
template <ResultCode func(u64*, u64, u64, u64)>
|
||||||
|
|
|
@ -24,6 +24,14 @@ using Kernel::SharedPtr;
|
||||||
|
|
||||||
namespace SVC {
|
namespace SVC {
|
||||||
|
|
||||||
|
/// Set the process heap to a given Size. It can both extend and shrink the heap.
|
||||||
|
static ResultCode SetHeapSize(VAddr* heap_addr, u64 heap_size) {
|
||||||
|
LOG_TRACE(Kernel_SVC, "called, heap_size=%ull", heap_size);
|
||||||
|
auto& process = *Kernel::g_current_process;
|
||||||
|
CASCADE_RESULT(*heap_addr, process.HeapAllocate(Memory::HEAP_VADDR, heap_size, Kernel::VMAPermission::ReadWrite));
|
||||||
|
return RESULT_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
/// Connect to an OS service given the port name, returns the handle to the port to out
|
/// Connect to an OS service given the port name, returns the handle to the port to out
|
||||||
static ResultCode ConnectToPort(Kernel::Handle* out_handle, VAddr port_name_address) {
|
static ResultCode ConnectToPort(Kernel::Handle* out_handle, VAddr port_name_address) {
|
||||||
if (!Memory::IsValidVirtualAddress(port_name_address))
|
if (!Memory::IsValidVirtualAddress(port_name_address))
|
||||||
|
@ -205,7 +213,7 @@ struct FunctionDef {
|
||||||
|
|
||||||
static const FunctionDef SVC_Table[] = {
|
static const FunctionDef SVC_Table[] = {
|
||||||
{0x00, nullptr, "Unknown"},
|
{0x00, nullptr, "Unknown"},
|
||||||
{0x01, nullptr, "svcSetHeapSize"},
|
{0x01, HLE::Wrap<SetHeapSize>, "svcSetHeapSize"},
|
||||||
{0x02, nullptr, "svcSetMemoryPermission"},
|
{0x02, nullptr, "svcSetMemoryPermission"},
|
||||||
{0x03, nullptr, "svcSetMemoryAttribute"},
|
{0x03, nullptr, "svcSetMemoryAttribute"},
|
||||||
{0x04, nullptr, "svcMapMemory"},
|
{0x04, nullptr, "svcMapMemory"},
|
||||||
|
|
Loading…
Reference in a new issue