2020-05-04 05:41:29 +02:00
|
|
|
|
using Ryujinx.HLE.HOS.Kernel.Common;
|
|
|
|
|
using Ryujinx.HLE.HOS.Kernel.Memory;
|
|
|
|
|
using Ryujinx.HLE.HOS.Kernel.Threading;
|
|
|
|
|
|
|
|
|
|
namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall
|
|
|
|
|
{
|
|
|
|
|
class Syscall32
|
|
|
|
|
{
|
|
|
|
|
private readonly Syscall _syscall;
|
|
|
|
|
|
|
|
|
|
public Syscall32(Syscall syscall)
|
|
|
|
|
{
|
|
|
|
|
_syscall = syscall;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// IPC
|
|
|
|
|
|
|
|
|
|
public KernelResult ConnectToNamedPort32([R(1)] uint namePtr, [R(1)] out int handle)
|
|
|
|
|
{
|
2022-01-29 22:18:03 +01:00
|
|
|
|
return _syscall.ConnectToNamedPort(out handle, namePtr);
|
2020-05-04 05:41:29 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public KernelResult SendSyncRequest32([R(0)] int handle)
|
|
|
|
|
{
|
2020-12-02 00:23:43 +01:00
|
|
|
|
return _syscall.SendSyncRequest(handle);
|
2020-05-04 05:41:29 +02:00
|
|
|
|
}
|
|
|
|
|
|
2020-07-17 06:19:07 +02:00
|
|
|
|
public KernelResult SendSyncRequestWithUserBuffer32([R(0)] uint messagePtr, [R(1)] uint messageSize, [R(2)] int handle)
|
2020-05-04 05:41:29 +02:00
|
|
|
|
{
|
2020-12-02 00:23:43 +01:00
|
|
|
|
return _syscall.SendSyncRequestWithUserBuffer(messagePtr, messageSize, handle);
|
2020-05-04 05:41:29 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public KernelResult CreateSession32(
|
|
|
|
|
[R(2)] bool isLight,
|
|
|
|
|
[R(3)] uint namePtr,
|
|
|
|
|
[R(1)] out int serverSessionHandle,
|
|
|
|
|
[R(2)] out int clientSessionHandle)
|
|
|
|
|
{
|
2022-01-29 22:18:03 +01:00
|
|
|
|
return _syscall.CreateSession(out serverSessionHandle, out clientSessionHandle, isLight, namePtr);
|
2020-05-04 05:41:29 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public KernelResult AcceptSession32([R(1)] int portHandle, [R(1)] out int sessionHandle)
|
|
|
|
|
{
|
2022-01-29 22:18:03 +01:00
|
|
|
|
return _syscall.AcceptSession(out sessionHandle, portHandle);
|
2020-05-04 05:41:29 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public KernelResult ReplyAndReceive32(
|
|
|
|
|
[R(0)] uint timeoutLow,
|
2022-01-29 22:18:03 +01:00
|
|
|
|
[R(1)] uint handlesPtr,
|
2020-05-04 05:41:29 +02:00
|
|
|
|
[R(2)] int handlesCount,
|
|
|
|
|
[R(3)] int replyTargetHandle,
|
|
|
|
|
[R(4)] uint timeoutHigh,
|
|
|
|
|
[R(1)] out int handleIndex)
|
|
|
|
|
{
|
|
|
|
|
long timeout = (long)(timeoutLow | ((ulong)timeoutHigh << 32));
|
|
|
|
|
|
2022-01-29 22:18:03 +01:00
|
|
|
|
return _syscall.ReplyAndReceive(out handleIndex, handlesPtr, handlesCount, replyTargetHandle, timeout);
|
2020-05-04 05:41:29 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public KernelResult CreatePort32(
|
|
|
|
|
[R(0)] uint namePtr,
|
|
|
|
|
[R(2)] int maxSessions,
|
|
|
|
|
[R(3)] bool isLight,
|
|
|
|
|
[R(1)] out int serverPortHandle,
|
|
|
|
|
[R(2)] out int clientPortHandle)
|
|
|
|
|
{
|
2022-01-29 22:18:03 +01:00
|
|
|
|
return _syscall.CreatePort(out serverPortHandle, out clientPortHandle, maxSessions, isLight, namePtr);
|
2020-05-04 05:41:29 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public KernelResult ManageNamedPort32([R(1)] uint namePtr, [R(2)] int maxSessions, [R(1)] out int handle)
|
|
|
|
|
{
|
2022-01-29 22:18:03 +01:00
|
|
|
|
return _syscall.ManageNamedPort(out handle, namePtr, maxSessions);
|
2020-05-04 05:41:29 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public KernelResult ConnectToPort32([R(1)] int clientPortHandle, [R(1)] out int clientSessionHandle)
|
|
|
|
|
{
|
2022-01-29 22:18:03 +01:00
|
|
|
|
return _syscall.ConnectToPort(out clientSessionHandle, clientPortHandle);
|
2020-05-04 05:41:29 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Memory
|
|
|
|
|
|
2022-01-29 22:18:03 +01:00
|
|
|
|
public KernelResult SetHeapSize32([R(1)] uint size, [R(1)] out uint address)
|
2020-05-04 05:41:29 +02:00
|
|
|
|
{
|
2022-01-29 22:18:03 +01:00
|
|
|
|
KernelResult result = _syscall.SetHeapSize(out ulong address64, size);
|
2020-05-04 05:41:29 +02:00
|
|
|
|
|
2022-01-29 22:18:03 +01:00
|
|
|
|
address = (uint)address64;
|
2020-05-04 05:41:29 +02:00
|
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
2021-10-24 01:24:49 +02:00
|
|
|
|
public KernelResult SetMemoryPermission32(
|
2022-01-29 22:18:03 +01:00
|
|
|
|
[R(0)] uint address,
|
|
|
|
|
[R(1)] uint size,
|
2021-10-24 01:24:49 +02:00
|
|
|
|
[R(2)] KMemoryPermission permission)
|
|
|
|
|
{
|
2022-01-29 22:18:03 +01:00
|
|
|
|
return _syscall.SetMemoryPermission(address, size, permission);
|
2021-10-24 01:24:49 +02:00
|
|
|
|
}
|
|
|
|
|
|
2020-05-04 05:41:29 +02:00
|
|
|
|
public KernelResult SetMemoryAttribute32(
|
2022-01-29 22:18:03 +01:00
|
|
|
|
[R(0)] uint address,
|
2020-05-04 05:41:29 +02:00
|
|
|
|
[R(1)] uint size,
|
|
|
|
|
[R(2)] MemoryAttribute attributeMask,
|
|
|
|
|
[R(3)] MemoryAttribute attributeValue)
|
|
|
|
|
{
|
2022-01-29 22:18:03 +01:00
|
|
|
|
return _syscall.SetMemoryAttribute(address, size, attributeMask, attributeValue);
|
2020-05-04 05:41:29 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public KernelResult MapMemory32([R(0)] uint dst, [R(1)] uint src, [R(2)] uint size)
|
|
|
|
|
{
|
|
|
|
|
return _syscall.MapMemory(dst, src, size);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public KernelResult UnmapMemory32([R(0)] uint dst, [R(1)] uint src, [R(2)] uint size)
|
|
|
|
|
{
|
|
|
|
|
return _syscall.UnmapMemory(dst, src, size);
|
|
|
|
|
}
|
|
|
|
|
|
2022-01-29 22:18:03 +01:00
|
|
|
|
public KernelResult QueryMemory32([R(0)] uint infoPtr, [R(1)] uint r1, [R(2)] uint address, [R(1)] out uint pageInfo)
|
2020-05-04 05:41:29 +02:00
|
|
|
|
{
|
2022-01-29 22:18:03 +01:00
|
|
|
|
KernelResult result = _syscall.QueryMemory(infoPtr, out ulong pageInfo64, address);
|
2020-05-04 05:41:29 +02:00
|
|
|
|
|
|
|
|
|
pageInfo = (uint)pageInfo64;
|
|
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
2020-12-02 00:23:43 +01:00
|
|
|
|
public KernelResult MapSharedMemory32([R(0)] int handle, [R(1)] uint address, [R(2)] uint size, [R(3)] KMemoryPermission permission)
|
2020-05-04 05:41:29 +02:00
|
|
|
|
{
|
|
|
|
|
return _syscall.MapSharedMemory(handle, address, size, permission);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public KernelResult UnmapSharedMemory32([R(0)] int handle, [R(1)] uint address, [R(2)] uint size)
|
|
|
|
|
{
|
|
|
|
|
return _syscall.UnmapSharedMemory(handle, address, size);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public KernelResult CreateTransferMemory32(
|
|
|
|
|
[R(1)] uint address,
|
|
|
|
|
[R(2)] uint size,
|
2020-12-02 00:23:43 +01:00
|
|
|
|
[R(3)] KMemoryPermission permission,
|
2020-05-04 05:41:29 +02:00
|
|
|
|
[R(1)] out int handle)
|
|
|
|
|
{
|
2022-01-29 22:18:03 +01:00
|
|
|
|
return _syscall.CreateTransferMemory(out handle, address, size, permission);
|
2020-05-04 05:41:29 +02:00
|
|
|
|
}
|
|
|
|
|
|
2022-05-03 13:16:31 +02:00
|
|
|
|
public KernelResult CreateCodeMemory32([R(1)] uint address, [R(2)] uint size, [R(1)] out int handle)
|
|
|
|
|
{
|
|
|
|
|
return _syscall.CreateCodeMemory(address, size, out handle);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public KernelResult ControlCodeMemory32(
|
|
|
|
|
[R(0)] int handle,
|
|
|
|
|
[R(1)] CodeMemoryOperation op,
|
|
|
|
|
[R(2)] uint addressLow,
|
|
|
|
|
[R(3)] uint addressHigh,
|
|
|
|
|
[R(4)] uint sizeLow,
|
|
|
|
|
[R(5)] uint sizeHigh,
|
|
|
|
|
[R(6)] KMemoryPermission permission)
|
|
|
|
|
{
|
|
|
|
|
ulong address = addressLow | ((ulong)addressHigh << 32);
|
|
|
|
|
ulong size = sizeLow | ((ulong)sizeHigh << 32);
|
|
|
|
|
|
|
|
|
|
return _syscall.ControlCodeMemory(handle, op, address, size, permission);
|
|
|
|
|
}
|
|
|
|
|
|
2021-06-23 21:52:11 +02:00
|
|
|
|
public KernelResult MapTransferMemory32([R(0)] int handle, [R(1)] uint address, [R(2)] uint size, [R(3)] KMemoryPermission permission)
|
|
|
|
|
{
|
|
|
|
|
return _syscall.MapTransferMemory(handle, address, size, permission);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public KernelResult UnmapTransferMemory32([R(0)] int handle, [R(1)] uint address, [R(2)] uint size)
|
|
|
|
|
{
|
|
|
|
|
return _syscall.UnmapTransferMemory(handle, address, size);
|
|
|
|
|
}
|
|
|
|
|
|
2020-05-04 05:41:29 +02:00
|
|
|
|
public KernelResult MapPhysicalMemory32([R(0)] uint address, [R(1)] uint size)
|
|
|
|
|
{
|
|
|
|
|
return _syscall.MapPhysicalMemory(address, size);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public KernelResult UnmapPhysicalMemory32([R(0)] uint address, [R(1)] uint size)
|
|
|
|
|
{
|
|
|
|
|
return _syscall.UnmapPhysicalMemory(address, size);
|
|
|
|
|
}
|
|
|
|
|
|
2022-05-03 13:16:31 +02:00
|
|
|
|
public KernelResult SetProcessMemoryPermission32(
|
|
|
|
|
[R(0)] int handle,
|
|
|
|
|
[R(1)] uint sizeLow,
|
|
|
|
|
[R(2)] uint srcLow,
|
|
|
|
|
[R(3)] uint srcHigh,
|
|
|
|
|
[R(4)] uint sizeHigh,
|
|
|
|
|
[R(5)] KMemoryPermission permission)
|
2020-05-04 05:41:29 +02:00
|
|
|
|
{
|
|
|
|
|
ulong src = srcLow | ((ulong)srcHigh << 32);
|
|
|
|
|
ulong size = sizeLow | ((ulong)sizeHigh << 32);
|
|
|
|
|
|
2022-05-03 13:16:31 +02:00
|
|
|
|
return _syscall.SetProcessMemoryPermission(handle, src, size, permission);
|
2020-05-04 05:41:29 +02:00
|
|
|
|
}
|
|
|
|
|
|
2022-05-03 13:16:31 +02:00
|
|
|
|
public KernelResult MapProcessMemory32([R(0)] uint dst, [R(1)] int handle, [R(2)] uint srcLow, [R(3)] uint srcHigh, [R(4)] uint size)
|
|
|
|
|
{
|
|
|
|
|
ulong src = srcLow | ((ulong)srcHigh << 32);
|
|
|
|
|
|
|
|
|
|
return _syscall.MapProcessMemory(dst, handle, src, size);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public KernelResult UnmapProcessMemory32([R(0)] uint dst, [R(1)] int handle, [R(2)] uint srcLow, [R(3)] uint srcHigh, [R(4)] uint size)
|
|
|
|
|
{
|
|
|
|
|
ulong src = srcLow | ((ulong)srcHigh << 32);
|
|
|
|
|
|
|
|
|
|
return _syscall.UnmapProcessMemory(dst, handle, src, size);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public KernelResult MapProcessCodeMemory32([R(0)] int handle, [R(1)] uint srcLow, [R(2)] uint dstLow, [R(3)] uint dstHigh, [R(4)] uint srcHigh, [R(5)] uint sizeLow, [R(6)] uint sizeHigh)
|
2020-05-04 05:41:29 +02:00
|
|
|
|
{
|
|
|
|
|
ulong src = srcLow | ((ulong)srcHigh << 32);
|
|
|
|
|
ulong dst = dstLow | ((ulong)dstHigh << 32);
|
|
|
|
|
ulong size = sizeLow | ((ulong)sizeHigh << 32);
|
|
|
|
|
|
2022-05-03 13:16:31 +02:00
|
|
|
|
return _syscall.MapProcessCodeMemory(handle, dst, src, size);
|
2020-05-04 05:41:29 +02:00
|
|
|
|
}
|
|
|
|
|
|
2022-05-03 13:16:31 +02:00
|
|
|
|
public KernelResult UnmapProcessCodeMemory32([R(0)] int handle, [R(1)] uint srcLow, [R(2)] uint dstLow, [R(3)] uint dstHigh, [R(4)] uint srcHigh, [R(5)] uint sizeLow, [R(6)] uint sizeHigh)
|
2020-05-04 05:41:29 +02:00
|
|
|
|
{
|
|
|
|
|
ulong src = srcLow | ((ulong)srcHigh << 32);
|
2022-05-03 13:16:31 +02:00
|
|
|
|
ulong dst = dstLow | ((ulong)dstHigh << 32);
|
2020-05-04 05:41:29 +02:00
|
|
|
|
ulong size = sizeLow | ((ulong)sizeHigh << 32);
|
|
|
|
|
|
2022-05-03 13:16:31 +02:00
|
|
|
|
return _syscall.UnmapProcessCodeMemory(handle, dst, src, size);
|
2020-05-04 05:41:29 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// System
|
|
|
|
|
|
|
|
|
|
public void ExitProcess32()
|
|
|
|
|
{
|
|
|
|
|
_syscall.ExitProcess();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public KernelResult TerminateProcess32([R(0)] int handle)
|
|
|
|
|
{
|
|
|
|
|
return _syscall.TerminateProcess(handle);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public KernelResult SignalEvent32([R(0)] int handle)
|
|
|
|
|
{
|
|
|
|
|
return _syscall.SignalEvent(handle);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public KernelResult ClearEvent32([R(0)] int handle)
|
|
|
|
|
{
|
|
|
|
|
return _syscall.ClearEvent(handle);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public KernelResult CloseHandle32([R(0)] int handle)
|
|
|
|
|
{
|
|
|
|
|
return _syscall.CloseHandle(handle);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public KernelResult ResetSignal32([R(0)] int handle)
|
|
|
|
|
{
|
|
|
|
|
return _syscall.ResetSignal(handle);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void GetSystemTick32([R(0)] out uint resultLow, [R(1)] out uint resultHigh)
|
|
|
|
|
{
|
|
|
|
|
ulong result = _syscall.GetSystemTick();
|
|
|
|
|
|
|
|
|
|
resultLow = (uint)(result & uint.MaxValue);
|
|
|
|
|
resultHigh = (uint)(result >> 32);
|
|
|
|
|
}
|
|
|
|
|
|
2022-02-09 21:18:07 +01:00
|
|
|
|
public KernelResult GetProcessId32([R(1)] int handle, [R(1)] out uint pidLow, [R(2)] out uint pidHigh)
|
2020-05-04 05:41:29 +02:00
|
|
|
|
{
|
2022-02-09 21:18:07 +01:00
|
|
|
|
KernelResult result = _syscall.GetProcessId(out ulong pid, handle);
|
2020-05-04 05:41:29 +02:00
|
|
|
|
|
2022-02-09 21:18:07 +01:00
|
|
|
|
pidLow = (uint)(pid & uint.MaxValue);
|
|
|
|
|
pidHigh = (uint)(pid >> 32);
|
2020-05-04 05:41:29 +02:00
|
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void Break32([R(0)] uint reason, [R(1)] uint r1, [R(2)] uint info)
|
|
|
|
|
{
|
|
|
|
|
_syscall.Break(reason);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void OutputDebugString32([R(0)] uint strPtr, [R(1)] uint size)
|
|
|
|
|
{
|
|
|
|
|
_syscall.OutputDebugString(strPtr, size);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public KernelResult GetInfo32(
|
|
|
|
|
[R(0)] uint subIdLow,
|
2021-12-05 00:23:26 +01:00
|
|
|
|
[R(1)] InfoType id,
|
2020-05-04 05:41:29 +02:00
|
|
|
|
[R(2)] int handle,
|
|
|
|
|
[R(3)] uint subIdHigh,
|
|
|
|
|
[R(1)] out uint valueLow,
|
|
|
|
|
[R(2)] out uint valueHigh)
|
|
|
|
|
{
|
|
|
|
|
long subId = (long)(subIdLow | ((ulong)subIdHigh << 32));
|
|
|
|
|
|
2022-01-29 22:18:03 +01:00
|
|
|
|
KernelResult result = _syscall.GetInfo(out ulong value, id, handle, subId);
|
2020-05-04 05:41:29 +02:00
|
|
|
|
|
|
|
|
|
valueHigh = (uint)(value >> 32);
|
|
|
|
|
valueLow = (uint)(value & uint.MaxValue);
|
|
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public KernelResult CreateEvent32([R(1)] out int wEventHandle, [R(2)] out int rEventHandle)
|
|
|
|
|
{
|
|
|
|
|
return _syscall.CreateEvent(out wEventHandle, out rEventHandle);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public KernelResult GetProcessList32([R(1)] ulong address, [R(2)] int maxCount, [R(1)] out int count)
|
|
|
|
|
{
|
2022-01-29 22:18:03 +01:00
|
|
|
|
return _syscall.GetProcessList(out count, address, maxCount);
|
2020-05-04 05:41:29 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public KernelResult GetSystemInfo32([R(1)] uint subIdLow, [R(2)] uint id, [R(3)] int handle, [R(3)] uint subIdHigh, [R(1)] out int valueLow, [R(2)] out int valueHigh)
|
|
|
|
|
{
|
|
|
|
|
long subId = (long)(subIdLow | ((ulong)subIdHigh << 32));
|
|
|
|
|
|
2022-01-29 22:18:03 +01:00
|
|
|
|
KernelResult result = _syscall.GetSystemInfo(out long value, id, handle, subId);
|
2020-05-04 05:41:29 +02:00
|
|
|
|
|
|
|
|
|
valueHigh = (int)(value >> 32);
|
|
|
|
|
valueLow = (int)(value & uint.MaxValue);
|
|
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
2021-10-24 01:40:13 +02:00
|
|
|
|
public KernelResult GetResourceLimitLimitValue32([R(1)] int handle, [R(2)] LimitableResource resource, [R(1)] out int limitValueLow, [R(2)] out int limitValueHigh)
|
|
|
|
|
{
|
2022-01-29 22:18:03 +01:00
|
|
|
|
KernelResult result = _syscall.GetResourceLimitLimitValue(out long limitValue, handle, resource);
|
2021-10-24 01:40:13 +02:00
|
|
|
|
|
|
|
|
|
limitValueHigh = (int)(limitValue >> 32);
|
|
|
|
|
limitValueLow = (int)(limitValue & uint.MaxValue);
|
|
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public KernelResult GetResourceLimitCurrentValue32([R(1)] int handle, [R(2)] LimitableResource resource, [R(1)] out int limitValueLow, [R(2)] out int limitValueHigh)
|
|
|
|
|
{
|
2022-01-29 22:18:03 +01:00
|
|
|
|
KernelResult result = _syscall.GetResourceLimitCurrentValue(out long limitValue, handle, resource);
|
2021-10-24 01:40:13 +02:00
|
|
|
|
|
|
|
|
|
limitValueHigh = (int)(limitValue >> 32);
|
|
|
|
|
limitValueLow = (int)(limitValue & uint.MaxValue);
|
|
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public KernelResult GetResourceLimitPeakValue32([R(1)] int handle, [R(2)] LimitableResource resource, [R(1)] out int peakLow, [R(2)] out int peakHigh)
|
|
|
|
|
{
|
2022-01-29 22:18:03 +01:00
|
|
|
|
KernelResult result = _syscall.GetResourceLimitPeakValue(out long peak, handle, resource);
|
2021-10-24 01:40:13 +02:00
|
|
|
|
|
|
|
|
|
peakHigh = (int)(peak >> 32);
|
|
|
|
|
peakLow = (int)(peak & uint.MaxValue);
|
|
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public KernelResult CreateResourceLimit32([R(1)] out int handle)
|
|
|
|
|
{
|
|
|
|
|
return _syscall.CreateResourceLimit(out handle);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public KernelResult SetResourceLimitLimitValue32([R(0)] int handle, [R(1)] LimitableResource resource, [R(2)] uint limitValueLow, [R(3)] uint limitValueHigh)
|
|
|
|
|
{
|
|
|
|
|
long limitValue = (long)(limitValueLow | ((ulong)limitValueHigh << 32));
|
|
|
|
|
|
|
|
|
|
return _syscall.SetResourceLimitLimitValue(handle, resource, limitValue);
|
|
|
|
|
}
|
|
|
|
|
|
2020-05-04 05:41:29 +02:00
|
|
|
|
public KernelResult FlushProcessDataCache32(
|
|
|
|
|
[R(0)] uint processHandle,
|
|
|
|
|
[R(2)] uint addressLow,
|
|
|
|
|
[R(3)] uint addressHigh,
|
|
|
|
|
[R(1)] uint sizeLow,
|
|
|
|
|
[R(4)] uint sizeHigh)
|
|
|
|
|
{
|
|
|
|
|
// FIXME: This needs to be implemented as ARMv7 doesn't have any way to do cache maintenance operations on EL0.
|
|
|
|
|
// As we don't support (and don't actually need) to flush the cache, this is stubbed.
|
|
|
|
|
return KernelResult.Success;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Thread
|
|
|
|
|
|
|
|
|
|
public KernelResult CreateThread32(
|
|
|
|
|
[R(1)] uint entrypoint,
|
|
|
|
|
[R(2)] uint argsPtr,
|
|
|
|
|
[R(3)] uint stackTop,
|
|
|
|
|
[R(0)] int priority,
|
|
|
|
|
[R(4)] int cpuCore,
|
|
|
|
|
[R(1)] out int handle)
|
|
|
|
|
{
|
2022-01-29 22:18:03 +01:00
|
|
|
|
return _syscall.CreateThread(out handle, entrypoint, argsPtr, stackTop, priority, cpuCore);
|
2020-05-04 05:41:29 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public KernelResult StartThread32([R(0)] int handle)
|
|
|
|
|
{
|
|
|
|
|
return _syscall.StartThread(handle);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void ExitThread32()
|
|
|
|
|
{
|
|
|
|
|
_syscall.ExitThread();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void SleepThread32([R(0)] uint timeoutLow, [R(1)] uint timeoutHigh)
|
|
|
|
|
{
|
|
|
|
|
long timeout = (long)(timeoutLow | ((ulong)timeoutHigh << 32));
|
|
|
|
|
|
|
|
|
|
_syscall.SleepThread(timeout);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public KernelResult GetThreadPriority32([R(1)] int handle, [R(1)] out int priority)
|
|
|
|
|
{
|
2022-01-29 22:18:03 +01:00
|
|
|
|
return _syscall.GetThreadPriority(out priority, handle);
|
2020-05-04 05:41:29 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public KernelResult SetThreadPriority32([R(0)] int handle, [R(1)] int priority)
|
|
|
|
|
{
|
|
|
|
|
return _syscall.SetThreadPriority(handle, priority);
|
|
|
|
|
}
|
|
|
|
|
|
2022-01-29 22:18:03 +01:00
|
|
|
|
public KernelResult GetThreadCoreMask32([R(2)] int handle, [R(1)] out int preferredCore, [R(2)] out uint affinityMaskLow, [R(3)] out uint affinityMaskHigh)
|
2020-05-04 05:41:29 +02:00
|
|
|
|
{
|
2022-01-29 22:18:03 +01:00
|
|
|
|
KernelResult result = _syscall.GetThreadCoreMask(out preferredCore, out ulong affinityMask, handle);
|
2020-05-04 05:41:29 +02:00
|
|
|
|
|
2022-01-29 22:18:03 +01:00
|
|
|
|
affinityMaskLow = (uint)(affinityMask & uint.MaxValue);
|
|
|
|
|
affinityMaskHigh = (uint)(affinityMask >> 32);
|
2020-05-04 05:41:29 +02:00
|
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public KernelResult SetThreadCoreMask32([R(0)] int handle, [R(1)] int preferredCore, [R(2)] uint affinityMaskLow, [R(3)] uint affinityMaskHigh)
|
|
|
|
|
{
|
2022-01-29 22:18:03 +01:00
|
|
|
|
ulong affinityMask = affinityMaskLow | ((ulong)affinityMaskHigh << 32);
|
2020-05-04 05:41:29 +02:00
|
|
|
|
|
|
|
|
|
return _syscall.SetThreadCoreMask(handle, preferredCore, affinityMask);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public int GetCurrentProcessorNumber32()
|
|
|
|
|
{
|
|
|
|
|
return _syscall.GetCurrentProcessorNumber();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public KernelResult GetThreadId32([R(1)] int handle, [R(1)] out uint threadUidLow, [R(2)] out uint threadUidHigh)
|
|
|
|
|
{
|
2022-02-09 21:18:07 +01:00
|
|
|
|
ulong threadUid;
|
2020-05-04 05:41:29 +02:00
|
|
|
|
|
2022-01-29 22:18:03 +01:00
|
|
|
|
KernelResult result = _syscall.GetThreadId(out threadUid, handle);
|
2020-05-04 05:41:29 +02:00
|
|
|
|
|
|
|
|
|
threadUidLow = (uint)(threadUid >> 32);
|
|
|
|
|
threadUidHigh = (uint)(threadUid & uint.MaxValue);
|
|
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public KernelResult SetThreadActivity32([R(0)] int handle, [R(1)] bool pause)
|
|
|
|
|
{
|
|
|
|
|
return _syscall.SetThreadActivity(handle, pause);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public KernelResult GetThreadContext332([R(0)] uint address, [R(1)] int handle)
|
|
|
|
|
{
|
|
|
|
|
return _syscall.GetThreadContext3(address, handle);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Thread synchronization
|
|
|
|
|
|
|
|
|
|
public KernelResult WaitSynchronization32(
|
|
|
|
|
[R(0)] uint timeoutLow,
|
|
|
|
|
[R(1)] uint handlesPtr,
|
|
|
|
|
[R(2)] int handlesCount,
|
|
|
|
|
[R(3)] uint timeoutHigh,
|
|
|
|
|
[R(1)] out int handleIndex)
|
|
|
|
|
{
|
|
|
|
|
long timeout = (long)(timeoutLow | ((ulong)timeoutHigh << 32));
|
|
|
|
|
|
2022-01-29 22:18:03 +01:00
|
|
|
|
return _syscall.WaitSynchronization(out handleIndex, handlesPtr, handlesCount, timeout);
|
2020-05-04 05:41:29 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public KernelResult CancelSynchronization32([R(0)] int handle)
|
|
|
|
|
{
|
|
|
|
|
return _syscall.CancelSynchronization(handle);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public KernelResult ArbitrateLock32([R(0)] int ownerHandle, [R(1)] uint mutexAddress, [R(2)] int requesterHandle)
|
|
|
|
|
{
|
|
|
|
|
return _syscall.ArbitrateLock(ownerHandle, mutexAddress, requesterHandle);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public KernelResult ArbitrateUnlock32([R(0)] uint mutexAddress)
|
|
|
|
|
{
|
|
|
|
|
return _syscall.ArbitrateUnlock(mutexAddress);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public KernelResult WaitProcessWideKeyAtomic32(
|
|
|
|
|
[R(0)] uint mutexAddress,
|
|
|
|
|
[R(1)] uint condVarAddress,
|
|
|
|
|
[R(2)] int handle,
|
|
|
|
|
[R(3)] uint timeoutLow,
|
|
|
|
|
[R(4)] uint timeoutHigh)
|
|
|
|
|
{
|
|
|
|
|
long timeout = (long)(timeoutLow | ((ulong)timeoutHigh << 32));
|
|
|
|
|
|
|
|
|
|
return _syscall.WaitProcessWideKeyAtomic(mutexAddress, condVarAddress, handle, timeout);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public KernelResult SignalProcessWideKey32([R(0)] uint address, [R(1)] int count)
|
|
|
|
|
{
|
|
|
|
|
return _syscall.SignalProcessWideKey(address, count);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public KernelResult WaitForAddress32([R(0)] uint address, [R(1)] ArbitrationType type, [R(2)] int value, [R(3)] uint timeoutLow, [R(4)] uint timeoutHigh)
|
|
|
|
|
{
|
|
|
|
|
long timeout = (long)(timeoutLow | ((ulong)timeoutHigh << 32));
|
|
|
|
|
|
|
|
|
|
return _syscall.WaitForAddress(address, type, value, timeout);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public KernelResult SignalToAddress32([R(0)] uint address, [R(1)] SignalType type, [R(2)] int value, [R(3)] int count)
|
|
|
|
|
{
|
|
|
|
|
return _syscall.SignalToAddress(address, type, value, count);
|
|
|
|
|
}
|
2021-12-30 10:55:06 +01:00
|
|
|
|
|
|
|
|
|
public KernelResult SynchronizePreemptionState32()
|
|
|
|
|
{
|
|
|
|
|
return _syscall.SynchronizePreemptionState();
|
|
|
|
|
}
|
2020-05-04 05:41:29 +02:00
|
|
|
|
}
|
|
|
|
|
}
|