Add MUL (vector by element), fix FCVTN, make svcs use MakeError too
This commit is contained in:
10
Ryujinx.Core/OsHle/ErrorCode.cs
Normal file
10
Ryujinx.Core/OsHle/ErrorCode.cs
Normal file
@ -0,0 +1,10 @@
|
||||
namespace Ryujinx.Core.OsHle
|
||||
{
|
||||
static class ErrorCode
|
||||
{
|
||||
public static uint MakeError(ErrorModule Module, int Code)
|
||||
{
|
||||
return (uint)Module | ((uint)Code << 9);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
namespace Ryujinx.Core.OsHle.IpcServices
|
||||
namespace Ryujinx.Core.OsHle
|
||||
{
|
||||
enum ErrorModule
|
||||
{
|
11
Ryujinx.Core/OsHle/KernelErr.cs
Normal file
11
Ryujinx.Core/OsHle/KernelErr.cs
Normal file
@ -0,0 +1,11 @@
|
||||
namespace Ryujinx.Core.OsHle
|
||||
{
|
||||
static class KernelErr
|
||||
{
|
||||
public const int InvalidMemRange = 110;
|
||||
public const int InvalidHandle = 114;
|
||||
public const int Timeout = 117;
|
||||
public const int InvalidInfo = 120;
|
||||
public const int InvalidIpcReq = 123;
|
||||
}
|
||||
}
|
@ -1,10 +0,0 @@
|
||||
namespace Ryujinx.Core.OsHle.IpcServices
|
||||
{
|
||||
static class ErrorCode
|
||||
{
|
||||
public static long MakeError(ErrorModule Module, int Code)
|
||||
{
|
||||
return (int)Module | (Code << 9);
|
||||
}
|
||||
}
|
||||
}
|
@ -4,7 +4,7 @@ using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
|
||||
using static Ryujinx.Core.OsHle.IpcServices.ErrorCode;
|
||||
using static Ryujinx.Core.OsHle.ErrorCode;
|
||||
using static Ryujinx.Core.OsHle.IpcServices.ObjHelper;
|
||||
|
||||
namespace Ryujinx.Core.OsHle.IpcServices.FspSrv
|
||||
|
@ -2,6 +2,8 @@ using ChocolArm64.Memory;
|
||||
using ChocolArm64.State;
|
||||
using Ryujinx.Core.OsHle.Handles;
|
||||
|
||||
using static Ryujinx.Core.OsHle.ErrorCode;
|
||||
|
||||
namespace Ryujinx.Core.OsHle.Svc
|
||||
{
|
||||
partial class SvcHandler
|
||||
@ -23,7 +25,7 @@ namespace Ryujinx.Core.OsHle.Svc
|
||||
|
||||
CurrentHeapSize = Size;
|
||||
|
||||
ThreadState.X0 = (int)SvcResult.Success;
|
||||
ThreadState.X0 = 0;
|
||||
ThreadState.X1 = (ulong)Position;
|
||||
}
|
||||
|
||||
@ -44,7 +46,7 @@ namespace Ryujinx.Core.OsHle.Svc
|
||||
Memory.Manager.SetAttrBit(Position, Size, 3);
|
||||
}
|
||||
|
||||
ThreadState.X0 = (int)SvcResult.Success;
|
||||
ThreadState.X0 = 0;
|
||||
}
|
||||
|
||||
private void SvcMapMemory(AThreadState ThreadState)
|
||||
@ -61,7 +63,7 @@ namespace Ryujinx.Core.OsHle.Svc
|
||||
|
||||
Memory.Manager.SetAttrBit(Src, Size, 0);
|
||||
|
||||
ThreadState.X0 = (int)SvcResult.Success;
|
||||
ThreadState.X0 = 0;
|
||||
}
|
||||
|
||||
private void SvcUnmapMemory(AThreadState ThreadState)
|
||||
@ -78,7 +80,7 @@ namespace Ryujinx.Core.OsHle.Svc
|
||||
|
||||
Memory.Manager.ClearAttrBit(Src, Size, 0);
|
||||
|
||||
ThreadState.X0 = (int)SvcResult.Success;
|
||||
ThreadState.X0 = 0;
|
||||
}
|
||||
|
||||
private void SvcQueryMemory(AThreadState ThreadState)
|
||||
@ -86,12 +88,13 @@ namespace Ryujinx.Core.OsHle.Svc
|
||||
long InfoPtr = (long)ThreadState.X0;
|
||||
long Position = (long)ThreadState.X2;
|
||||
|
||||
Position &= uint.MaxValue;
|
||||
|
||||
AMemoryMapInfo MapInfo = Memory.Manager.GetMapInfo(Position);
|
||||
|
||||
if (MapInfo == null)
|
||||
{
|
||||
//TODO: Correct error code.
|
||||
ThreadState.X0 = ulong.MaxValue;
|
||||
ThreadState.X0 = MakeError(ErrorModule.Kernel, KernelErr.InvalidMemRange);
|
||||
|
||||
return;
|
||||
}
|
||||
@ -106,7 +109,7 @@ namespace Ryujinx.Core.OsHle.Svc
|
||||
Memory.WriteInt32(InfoPtr + 0x24, 0);
|
||||
//TODO: X1.
|
||||
|
||||
ThreadState.X0 = (int)SvcResult.Success;
|
||||
ThreadState.X0 = 0;
|
||||
ThreadState.X1 = 0;
|
||||
}
|
||||
|
||||
@ -127,7 +130,7 @@ namespace Ryujinx.Core.OsHle.Svc
|
||||
|
||||
Memory.Manager.Map(Src, Size, (int)MemoryType.SharedMemory, (AMemoryPerm)Perm);
|
||||
|
||||
ThreadState.X0 = (int)SvcResult.Success;
|
||||
ThreadState.X0 = 0;
|
||||
}
|
||||
|
||||
//TODO: Error codes.
|
||||
@ -143,7 +146,7 @@ namespace Ryujinx.Core.OsHle.Svc
|
||||
|
||||
if (HndData != null)
|
||||
{
|
||||
ThreadState.X0 = (int)SvcResult.Success;
|
||||
ThreadState.X0 = 0;
|
||||
}
|
||||
|
||||
//TODO: Error codes.
|
||||
@ -164,7 +167,7 @@ namespace Ryujinx.Core.OsHle.Svc
|
||||
int Handle = Ns.Os.Handles.GenerateId(HndData);
|
||||
|
||||
ThreadState.X1 = (ulong)Handle;
|
||||
ThreadState.X0 = (int)SvcResult.Success;
|
||||
ThreadState.X0 = 0;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,11 +0,0 @@
|
||||
namespace Ryujinx.Core.OsHle.Svc
|
||||
{
|
||||
enum SvcResult
|
||||
{
|
||||
Success = 0,
|
||||
ErrBadHandle = 0xe401,
|
||||
ErrTimeout = 0xea01,
|
||||
ErrBadInfo = 0xf001,
|
||||
ErrBadIpcReq = 0xf601
|
||||
}
|
||||
}
|
@ -7,6 +7,8 @@ using Ryujinx.Core.OsHle.IpcServices;
|
||||
using System;
|
||||
using System.Threading;
|
||||
|
||||
using static Ryujinx.Core.OsHle.ErrorCode;
|
||||
|
||||
namespace Ryujinx.Core.OsHle.Svc
|
||||
{
|
||||
partial class SvcHandler
|
||||
@ -26,7 +28,7 @@ namespace Ryujinx.Core.OsHle.Svc
|
||||
|
||||
//TODO: Implement events.
|
||||
|
||||
ThreadState.X0 = (int)SvcResult.Success;
|
||||
ThreadState.X0 = 0;
|
||||
}
|
||||
|
||||
private void SvcCloseHandle(AThreadState ThreadState)
|
||||
@ -35,7 +37,7 @@ namespace Ryujinx.Core.OsHle.Svc
|
||||
|
||||
Ns.Os.CloseHandle(Handle);
|
||||
|
||||
ThreadState.X0 = (int)SvcResult.Success;
|
||||
ThreadState.X0 = 0;
|
||||
}
|
||||
|
||||
private void SvcResetSignal(AThreadState ThreadState)
|
||||
@ -44,7 +46,7 @@ namespace Ryujinx.Core.OsHle.Svc
|
||||
|
||||
//TODO: Implement events.
|
||||
|
||||
ThreadState.X0 = (int)SvcResult.Success;
|
||||
ThreadState.X0 = 0;
|
||||
}
|
||||
|
||||
private void SvcWaitSynchronization(AThreadState ThreadState)
|
||||
@ -60,7 +62,7 @@ namespace Ryujinx.Core.OsHle.Svc
|
||||
Process.Scheduler.Suspend(CurrThread.ProcessorId);
|
||||
Process.Scheduler.Resume(CurrThread);
|
||||
|
||||
ThreadState.X0 = (int)SvcResult.Success;
|
||||
ThreadState.X0 = 0;
|
||||
}
|
||||
|
||||
private void SvcGetSystemTick(AThreadState ThreadState)
|
||||
@ -81,7 +83,7 @@ namespace Ryujinx.Core.OsHle.Svc
|
||||
HSession Session = new HSession(ServiceFactory.MakeService(Name));
|
||||
|
||||
ThreadState.X1 = (ulong)Ns.Os.Handles.GenerateId(Session);
|
||||
ThreadState.X0 = (int)SvcResult.Success;
|
||||
ThreadState.X0 = 0;
|
||||
}
|
||||
|
||||
private void SvcSendSyncRequest(AThreadState ThreadState)
|
||||
@ -127,11 +129,11 @@ namespace Ryujinx.Core.OsHle.Svc
|
||||
|
||||
byte[] Response = AMemoryHelper.ReadBytes(Memory, CmdPtr, (int)Size);
|
||||
|
||||
ThreadState.X0 = (int)SvcResult.Success;
|
||||
ThreadState.X0 = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
ThreadState.X0 = (int)SvcResult.ErrBadIpcReq;
|
||||
ThreadState.X0 = MakeError(ErrorModule.Kernel, KernelErr.InvalidIpcReq);
|
||||
}
|
||||
|
||||
Thread.Yield();
|
||||
@ -157,7 +159,7 @@ namespace Ryujinx.Core.OsHle.Svc
|
||||
|
||||
Logging.Info($"SvcOutputDebugString: {Str}");
|
||||
|
||||
ThreadState.X0 = (int)SvcResult.Success;
|
||||
ThreadState.X0 = 0;
|
||||
}
|
||||
|
||||
private void SvcGetInfo(AThreadState ThreadState)
|
||||
@ -171,7 +173,7 @@ namespace Ryujinx.Core.OsHle.Svc
|
||||
if (InfoType == 18 ||
|
||||
InfoType == 19)
|
||||
{
|
||||
ThreadState.X0 = (int)SvcResult.ErrBadInfo;
|
||||
ThreadState.X0 = MakeError(ErrorModule.Kernel, KernelErr.InvalidInfo);
|
||||
|
||||
return;
|
||||
}
|
||||
@ -233,7 +235,7 @@ namespace Ryujinx.Core.OsHle.Svc
|
||||
default: throw new NotImplementedException($"SvcGetInfo: {InfoType} {Handle} {InfoId}");
|
||||
}
|
||||
|
||||
ThreadState.X0 = (int)SvcResult.Success;
|
||||
ThreadState.X0 = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -28,7 +28,7 @@ namespace Ryujinx.Core.OsHle.Svc
|
||||
Priority,
|
||||
ProcessorId);
|
||||
|
||||
ThreadState.X0 = (int)SvcResult.Success;
|
||||
ThreadState.X0 = 0;
|
||||
ThreadState.X1 = (ulong)Handle;
|
||||
}
|
||||
|
||||
@ -45,7 +45,7 @@ namespace Ryujinx.Core.OsHle.Svc
|
||||
{
|
||||
Process.Scheduler.StartThread(Thread);
|
||||
|
||||
ThreadState.X0 = (int)SvcResult.Success;
|
||||
ThreadState.X0 = 0;
|
||||
}
|
||||
|
||||
//TODO: Error codes.
|
||||
@ -75,8 +75,8 @@ namespace Ryujinx.Core.OsHle.Svc
|
||||
|
||||
if (Thread != null)
|
||||
{
|
||||
ThreadState.X0 = 0;
|
||||
ThreadState.X1 = (ulong)Thread.Priority;
|
||||
ThreadState.X0 = (int)SvcResult.Success;
|
||||
}
|
||||
|
||||
//TODO: Error codes.
|
||||
@ -93,7 +93,7 @@ namespace Ryujinx.Core.OsHle.Svc
|
||||
{
|
||||
Thread.Priority = Prio;
|
||||
|
||||
ThreadState.X0 = (int)SvcResult.Success;
|
||||
ThreadState.X0 = 0;
|
||||
}
|
||||
|
||||
//TODO: Error codes.
|
||||
@ -101,7 +101,7 @@ namespace Ryujinx.Core.OsHle.Svc
|
||||
|
||||
private void SvcSetThreadCoreMask(AThreadState ThreadState)
|
||||
{
|
||||
ThreadState.X0 = (int)SvcResult.Success;
|
||||
ThreadState.X0 = 0;
|
||||
|
||||
//TODO: Error codes.
|
||||
}
|
||||
@ -114,8 +114,8 @@ namespace Ryujinx.Core.OsHle.Svc
|
||||
|
||||
if (Thread != null)
|
||||
{
|
||||
ThreadState.X0 = 0;
|
||||
ThreadState.X1 = (ulong)Thread.ThreadId;
|
||||
ThreadState.X0 = (int)SvcResult.Success;
|
||||
}
|
||||
|
||||
//TODO: Error codes.
|
||||
|
@ -1,6 +1,8 @@
|
||||
using ChocolArm64.State;
|
||||
using Ryujinx.Core.OsHle.Handles;
|
||||
|
||||
using static Ryujinx.Core.OsHle.ErrorCode;
|
||||
|
||||
namespace Ryujinx.Core.OsHle.Svc
|
||||
{
|
||||
partial class SvcHandler
|
||||
@ -19,7 +21,7 @@ namespace Ryujinx.Core.OsHle.Svc
|
||||
|
||||
M.WaitForLock(RequestingThread, RequestingThreadHandle);
|
||||
|
||||
ThreadState.X0 = (int)SvcResult.Success;
|
||||
ThreadState.X0 = 0;
|
||||
}
|
||||
|
||||
private void SvcArbitrateUnlock(AThreadState ThreadState)
|
||||
@ -31,7 +33,7 @@ namespace Ryujinx.Core.OsHle.Svc
|
||||
M.Unlock();
|
||||
}
|
||||
|
||||
ThreadState.X0 = (int)SvcResult.Success;
|
||||
ThreadState.X0 = 0;
|
||||
}
|
||||
|
||||
private void SvcWaitProcessWideKeyAtomic(AThreadState ThreadState)
|
||||
@ -55,14 +57,14 @@ namespace Ryujinx.Core.OsHle.Svc
|
||||
|
||||
if (!Cv.WaitForSignal(Thread))
|
||||
{
|
||||
ThreadState.X0 = (int)SvcResult.ErrTimeout;
|
||||
ThreadState.X0 = MakeError(ErrorModule.Kernel, KernelErr.Timeout);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
M.WaitForLock(Thread, ThreadHandle);
|
||||
|
||||
ThreadState.X0 = (int)SvcResult.Success;
|
||||
ThreadState.X0 = 0;
|
||||
}
|
||||
|
||||
private void SvcSignalProcessWideKey(AThreadState ThreadState)
|
||||
@ -77,7 +79,7 @@ namespace Ryujinx.Core.OsHle.Svc
|
||||
Cv.SetSignal(CurrThread, Count);
|
||||
}
|
||||
|
||||
ThreadState.X0 = (int)SvcResult.Success;
|
||||
ThreadState.X0 = 0;
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user