Code style fixes and nits on the HLE project (#355)

* Some style fixes and nits on ITimeZoneService

* Remove some unneeded usings

* Remove the Ryujinx.HLE.OsHle.Handles namespace

* Remove hbmenu automatic load on process exit

* Rename Ns to Device, rename Os to System, rename SystemState to State

* Move Exceptions and Utilities out of OsHle

* Rename OsHle to HOS

* Rename OsHle folder to HOS

* IManagerDisplayService and ISystemDisplayService style fixes

* BsdError shouldn't be public

* Add a empty new line before using static

* Remove unused file

* Some style fixes on NPDM

* Exit gracefully when the application is closed

* Code style fixes on IGeneralService

* Add 0x prefix on values printed as hex

* Small improvements on finalization code

* Move ProcessId and ThreadId out of AThreadState

* Rename VFs to FileSystem

* FsAccessHeader shouldn't be public. Also fix file names casing

* More case changes on NPDM

* Remove unused files

* Move using to the correct place on NPDM

* Use properties on KernelAccessControlMmio

* Address PR feedback
This commit is contained in:
gdkchan 2018-08-16 20:47:36 -03:00 committed by GitHub
parent 182d716867
commit 521751795a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
258 changed files with 1574 additions and 1546 deletions

View File

@ -18,8 +18,6 @@ namespace ChocolArm64
public event EventHandler WorkFinished;
public int ThreadId => ThreadState.ThreadId;
private int IsExecuting;
public AThread(ATranslator Translator, AMemory Memory, long EntryPoint)

View File

@ -41,7 +41,7 @@ namespace ChocolArm64.Memory
}
}
private Dictionary<int, ArmMonitor> Monitors;
private Dictionary<AThreadState, ArmMonitor> Monitors;
private ConcurrentDictionary<long, IntPtr> ObservedPages;
@ -53,7 +53,7 @@ namespace ChocolArm64.Memory
public AMemory(IntPtr Ram)
{
Monitors = new Dictionary<int, ArmMonitor>();
Monitors = new Dictionary<AThreadState, ArmMonitor>();
ObservedPages = new ConcurrentDictionary<long, IntPtr>();
@ -75,7 +75,7 @@ namespace ChocolArm64.Memory
{
ClearExclusive(State);
Monitors.Remove(State.ThreadId);
Monitors.Remove(State);
}
}
@ -93,11 +93,11 @@ namespace ChocolArm64.Memory
}
}
if (!Monitors.TryGetValue(ThreadState.ThreadId, out ArmMonitor ThreadMon))
if (!Monitors.TryGetValue(ThreadState, out ArmMonitor ThreadMon))
{
ThreadMon = new ArmMonitor();
Monitors.Add(ThreadState.ThreadId, ThreadMon);
Monitors.Add(ThreadState, ThreadMon);
}
ThreadMon.Position = Position;
@ -113,7 +113,7 @@ namespace ChocolArm64.Memory
Monitor.Enter(Monitors);
if (!Monitors.TryGetValue(ThreadState.ThreadId, out ArmMonitor ThreadMon))
if (!Monitors.TryGetValue(ThreadState, out ArmMonitor ThreadMon))
{
return false;
}
@ -130,7 +130,7 @@ namespace ChocolArm64.Memory
public void ClearExclusiveForStore(AThreadState ThreadState)
{
if (Monitors.TryGetValue(ThreadState.ThreadId, out ArmMonitor ThreadMon))
if (Monitors.TryGetValue(ThreadState, out ArmMonitor ThreadMon))
{
ThreadMon.ExState = false;
}
@ -142,7 +142,7 @@ namespace ChocolArm64.Memory
{
lock (Monitors)
{
if (Monitors.TryGetValue(ThreadState.ThreadId, out ArmMonitor ThreadMon))
if (Monitors.TryGetValue(ThreadState, out ArmMonitor ThreadMon))
{
ThreadMon.ExState = false;
}

View File

@ -40,9 +40,6 @@ namespace ChocolArm64.State
public bool Zero;
public bool Negative;
public int ProcessId;
public int ThreadId;
public bool Running { get; set; }
public long TpidrEl0 { get; set; }
@ -100,6 +97,11 @@ namespace ChocolArm64.State
TickCounter.Start();
}
internal bool Synchronize()
{
return Running;
}
internal void OnBreak(long Position, int Imm)
{
Break?.Invoke(this, new AInstExceptionEventArgs(Position, Imm));

View File

@ -110,6 +110,8 @@ namespace ChocolArm64.Translation
if (OpcIndex == 0)
{
MarkLabel(GetLabel(CurrBlock.Position));
EmitSynchronization();
}
CurrOp.Emitter(this);
@ -117,6 +119,25 @@ namespace ChocolArm64.Translation
ILBlock.Add(new AILBarrier());
}
private void EmitSynchronization()
{
EmitLdarg(ATranslatedSub.StateArgIdx);
EmitPrivateCall(typeof(AThreadState), nameof(AThreadState.Synchronize));
EmitLdc_I4(0);
AILLabel LblContinue = new AILLabel();
Emit(OpCodes.Bne_Un_S, LblContinue);
EmitLdc_I8(0);
Emit(OpCodes.Ret);
MarkLabel(LblContinue);
}
public bool TryOptEmitSubroutineCall()
{
if (CurrBlock.Next == null)

View File

@ -1,6 +1,8 @@
using System;
namespace Ryujinx.Audio
{
public interface IAalOutput
public interface IAalOutput : IDisposable
{
int OpenTrack(int SampleRate, int Channels, ReleaseCallback Callback);

View File

@ -8,7 +8,7 @@ using System.Threading;
namespace Ryujinx.Audio.OpenAL
{
public class OpenALAudioOut : IAalOutput
public class OpenALAudioOut : IAalOutput, IDisposable
{
private const int MaxTracks = 256;
@ -222,10 +222,17 @@ namespace Ryujinx.Audio.OpenAL
Td.CallReleaseCallbackIfNeeded();
}
//If it's not slept it will waste cycles
//If it's not slept it will waste cycles.
Thread.Sleep(10);
}
while (KeepPolling);
foreach (Track Td in Tracks.Values)
{
Td.Dispose();
}
Tracks.Clear();
}
public int OpenTrack(int SampleRate, int Channels, ReleaseCallback Callback)
@ -342,5 +349,18 @@ namespace Ryujinx.Audio.OpenAL
return PlaybackState.Stopped;
}
public void Dispose()
{
Dispose(true);
}
protected virtual void Dispose(bool Disposing)
{
if (Disposing)
{
KeepPolling = false;
}
}
}
}

View File

@ -1,4 +1,3 @@
using System;
using System.Collections.Generic;
namespace Ryujinx.Graphics.Gal

View File

@ -1,4 +1,3 @@
using OpenTK;
using OpenTK.Graphics.OpenGL;
using System;
using System.Collections.Generic;

View File

@ -1,6 +1,5 @@
using OpenTK.Graphics.OpenGL;
using System;
using System.Collections.Generic;
namespace Ryujinx.Graphics.Gal.OpenGL
{

View File

@ -1,7 +1,6 @@
using OpenTK.Graphics.OpenGL;
using System;
using System.Collections.Generic;
using System.Linq;
namespace Ryujinx.Graphics.Gal.OpenGL
{

View File

@ -1,6 +1,4 @@
using System;
using static Ryujinx.Graphics.Gal.Shader.ShaderDecodeHelper;
using static Ryujinx.Graphics.Gal.Shader.ShaderDecodeHelper;
namespace Ryujinx.Graphics.Gal.Shader
{

View File

@ -1,6 +1,6 @@
using System;
namespace Ryujinx.HLE.OsHle.Exceptions
namespace Ryujinx.HLE.Exceptions
{
public class GuestBrokeExecutionException : Exception
{

View File

@ -1,9 +1,9 @@
using System;
namespace Ryujinx.HLE.Loaders.Npdm
{
public class InvalidNpdmException : Exception
{
public InvalidNpdmException(string ExMsg) : base(ExMsg) { }
}
}
using System;
namespace Ryujinx.HLE.Exceptions
{
public class InvalidNpdmException : Exception
{
public InvalidNpdmException(string ExMsg) : base(ExMsg) { }
}
}

View File

@ -1,6 +1,6 @@
using System;
namespace Ryujinx.HLE.OsHle.Exceptions
namespace Ryujinx.HLE.Exceptions
{
public class UndefinedInstructionException : Exception
{

View File

@ -140,7 +140,7 @@ namespace Ryujinx.HLE.Gpu.Texture
}
}
throw new NotImplementedException(Texture.Format.ToString());
throw new NotImplementedException("0x" + Texture.Format.ToString("x2"));
}
public static int CompressedTextureSize(int TextureWidth, int TextureHeight, int BlockWidth, int BlockHeight, int Bpb)

View File

@ -47,7 +47,7 @@ namespace Ryujinx.HLE.Gpu.Texture
case GalTextureFormat.Astc2D10x6: return Read16BptCompressedTexture(Memory, Texture, 10, 6);
}
throw new NotImplementedException(Texture.Format.ToString());
throw new NotImplementedException("0x" + Texture.Format.ToString("x2"));
}
private unsafe static byte[] Read1Bpp(IAMemory Memory, TextureInfo Texture)

View File

@ -1,6 +1,4 @@
using ChocolArm64.Memory;
using Ryujinx.Graphics.Gal;
using System;
namespace Ryujinx.HLE.Gpu.Texture
{

View File

@ -2,7 +2,7 @@ using System;
using System.Collections.Generic;
using System.Linq;
namespace Ryujinx.HLE.OsHle.Diagnostics
namespace Ryujinx.HLE.HOS.Diagnostics
{
static class Demangler
{

View File

@ -1,4 +1,4 @@
namespace Ryujinx.HLE.OsHle
namespace Ryujinx.HLE.HOS
{
static class ErrorCode
{

View File

@ -1,4 +1,4 @@
namespace Ryujinx.HLE.OsHle
namespace Ryujinx.HLE.HOS
{
enum ErrorModule
{

View File

@ -1,10 +1,10 @@
using Ryujinx.HLE.Memory;
using Ryujinx.HLE.OsHle.Utilities;
using Ryujinx.HLE.Resource;
using Ryujinx.HLE.Utilities;
using System.Collections.Generic;
using System.IO;
namespace Ryujinx.HLE.OsHle.Font
namespace Ryujinx.HLE.HOS.Font
{
class SharedFontManager
{
@ -34,7 +34,7 @@ namespace Ryujinx.HLE.OsHle.Font
Memory = Device.Memory;
FontsPath = Path.Combine(Device.VFs.GetSystemPath(), "fonts");
FontsPath = Path.Combine(Device.FileSystem.GetSystemPath(), "fonts");
}
public void EnsureInitialized()

View File

@ -1,4 +1,4 @@
namespace Ryujinx.HLE.OsHle.Font
namespace Ryujinx.HLE.HOS.Font
{
public enum SharedFontType
{

View File

@ -1,7 +1,7 @@
using System.Collections.Concurrent;
using System.Collections.Generic;
namespace Ryujinx.HLE.OsHle
namespace Ryujinx.HLE.HOS
{
class GlobalStateTable
{

View File

@ -1,7 +1,7 @@
using ChocolArm64.Memory;
using System.Text;
namespace Ryujinx.HLE.OsHle
namespace Ryujinx.HLE.HOS
{
static class Homebrew
{

View File

@ -1,27 +1,27 @@
using Ryujinx.HLE.HOS.Font;
using Ryujinx.HLE.HOS.Kernel;
using Ryujinx.HLE.HOS.SystemState;
using Ryujinx.HLE.Loaders.Executables;
using Ryujinx.HLE.Loaders.Npdm;
using Ryujinx.HLE.Logging;
using Ryujinx.HLE.OsHle.Font;
using Ryujinx.HLE.OsHle.Handles;
using Ryujinx.HLE.OsHle.SystemState;
using System;
using System.Collections.Concurrent;
using System.IO;
namespace Ryujinx.HLE.OsHle
namespace Ryujinx.HLE.HOS
{
public class Horizon : IDisposable
{
internal const int HidSize = 0x40000;
internal const int FontSize = 0x1100000;
private Switch Ns;
private Switch Device;
private KProcessScheduler Scheduler;
private ConcurrentDictionary<int, Process> Processes;
public SystemStateMgr SystemState { get; private set; }
public SystemStateMgr State { get; private set; }
internal KSharedMemory HidSharedMem { get; private set; }
internal KSharedMemory FontSharedMem { get; private set; }
@ -30,18 +30,18 @@ namespace Ryujinx.HLE.OsHle
internal KEvent VsyncEvent { get; private set; }
public Horizon(Switch Ns)
public Horizon(Switch Device)
{
this.Ns = Ns;
this.Device = Device;
Scheduler = new KProcessScheduler(Ns.Log);
Scheduler = new KProcessScheduler(Device.Log);
Processes = new ConcurrentDictionary<int, Process>();
SystemState = new SystemStateMgr();
State = new SystemStateMgr();
if (!Ns.Memory.Allocator.TryAllocate(HidSize, out long HidPA) ||
!Ns.Memory.Allocator.TryAllocate(FontSize, out long FontPA))
if (!Device.Memory.Allocator.TryAllocate(HidSize, out long HidPA) ||
!Device.Memory.Allocator.TryAllocate(FontSize, out long FontPA))
{
throw new InvalidOperationException();
}
@ -49,7 +49,7 @@ namespace Ryujinx.HLE.OsHle
HidSharedMem = new KSharedMemory(HidPA, HidSize);
FontSharedMem = new KSharedMemory(FontPA, FontSize);
Font = new SharedFontManager(Ns, FontSharedMem.PA);
Font = new SharedFontManager(Device, FontSharedMem.PA);
VsyncEvent = new KEvent();
}
@ -58,7 +58,7 @@ namespace Ryujinx.HLE.OsHle
{
if (RomFsFile != null)
{
Ns.VFs.LoadRomFs(RomFsFile);
Device.FileSystem.LoadRomFs(RomFsFile);
}
string NpdmFileName = Path.Combine(ExeFsDir, "main.npdm");
@ -67,7 +67,7 @@ namespace Ryujinx.HLE.OsHle
if (File.Exists(NpdmFileName))
{
Ns.Log.PrintInfo(LogClass.Loader, $"Loading main.npdm...");
Device.Log.PrintInfo(LogClass.Loader, $"Loading main.npdm...");
using (FileStream Input = new FileStream(NpdmFileName, FileMode.Open))
{
@ -76,7 +76,7 @@ namespace Ryujinx.HLE.OsHle
}
else
{
Ns.Log.PrintWarning(LogClass.Loader, $"NPDM file not found, using default values!");
Device.Log.PrintWarning(LogClass.Loader, $"NPDM file not found, using default values!");
}
Process MainProcess = MakeProcess(MetaData);
@ -90,7 +90,7 @@ namespace Ryujinx.HLE.OsHle
continue;
}
Ns.Log.PrintInfo(LogClass.Loader, $"Loading {Path.GetFileNameWithoutExtension(File)}...");
Device.Log.PrintInfo(LogClass.Loader, $"Loading {Path.GetFileNameWithoutExtension(File)}...");
using (FileStream Input = new FileStream(File, FileMode.Open))
{
@ -124,18 +124,20 @@ namespace Ryujinx.HLE.OsHle
bool IsNro = Path.GetExtension(FilePath).ToLower() == ".nro";
string Name = Path.GetFileNameWithoutExtension(FilePath);
string SwitchFilePath = Ns.VFs.SystemPathToSwitchPath(FilePath);
string SwitchFilePath = Device.FileSystem.SystemPathToSwitchPath(FilePath);
if (IsNro && (SwitchFilePath == null || !SwitchFilePath.StartsWith("sdmc:/")))
{
string SwitchPath = $"sdmc:/switch/{Name}{Homebrew.TemporaryNroSuffix}";
string TempPath = Ns.VFs.SwitchPathToSystemPath(SwitchPath);
string TempPath = Device.FileSystem.SwitchPathToSystemPath(SwitchPath);
string SwitchDir = Path.GetDirectoryName(TempPath);
if (!Directory.Exists(SwitchDir))
{
Directory.CreateDirectory(SwitchDir);
}
File.Copy(FilePath, TempPath, true);
FilePath = TempPath;
@ -169,7 +171,7 @@ namespace Ryujinx.HLE.OsHle
ProcessId++;
}
Process = new Process(Ns, Scheduler, ProcessId, MetaData);
Process = new Process(Device, Scheduler, ProcessId, MetaData);
Processes.TryAdd(ProcessId, Process);
}
@ -186,42 +188,24 @@ namespace Ryujinx.HLE.OsHle
internal void ExitProcess(int ProcessId)
{
if (Processes.TryGetValue(ProcessId, out Process Process) && Process.NeedsHbAbi)
if (Processes.TryRemove(ProcessId, out Process Process))
{
string NextNro = Homebrew.ReadHbAbiNextLoadPath(Process.Memory, Process.HbAbiDataPosition);
Ns.Log.PrintInfo(LogClass.Loader, $"HbAbi NextLoadPath {NextNro}");
if (NextNro == string.Empty)
{
NextNro = "sdmc:/hbmenu.nro";
}
NextNro = NextNro.Replace("sdmc:", string.Empty);
NextNro = Ns.VFs.GetFullPath(Ns.VFs.GetSdCardPath(), NextNro);
if (File.Exists(NextNro))
{
LoadProgram(NextNro);
}
}
if (Processes.TryRemove(ProcessId, out Process))
{
Process.StopAllThreadsAsync();
Process.Dispose();
if (Processes.Count == 0)
{
Ns.OnFinish(EventArgs.Empty);
Unload();
Device.Unload();
}
}
}
internal bool TryGetProcess(int ProcessId, out Process Process)
private void Unload()
{
return Processes.TryGetValue(ProcessId, out Process);
VsyncEvent.Dispose();
Scheduler.Dispose();
}
public void Dispose()
@ -235,13 +219,8 @@ namespace Ryujinx.HLE.OsHle
{
foreach (Process Process in Processes.Values)
{
Process.StopAllThreadsAsync();
Process.Dispose();
}
VsyncEvent.Dispose();
Scheduler.Dispose();
}
}
}

View File

@ -2,7 +2,7 @@ using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
namespace Ryujinx.HLE.OsHle
namespace Ryujinx.HLE.HOS
{
class IdDictionary
{

View File

@ -1,6 +1,6 @@
using System.IO;
namespace Ryujinx.HLE.OsHle.Ipc
namespace Ryujinx.HLE.HOS.Ipc
{
struct IpcBuffDesc
{

View File

@ -1,7 +1,7 @@
using System;
using System.IO;
namespace Ryujinx.HLE.OsHle.Ipc
namespace Ryujinx.HLE.HOS.Ipc
{
class IpcHandleDesc
{

View File

@ -1,9 +1,9 @@
using ChocolArm64.Memory;
using Ryujinx.HLE.OsHle.Handles;
using Ryujinx.HLE.HOS.Kernel;
using System;
using System.IO;
namespace Ryujinx.HLE.OsHle.Ipc
namespace Ryujinx.HLE.HOS.Ipc
{
static class IpcHandler
{

View File

@ -1,4 +1,4 @@
namespace Ryujinx.HLE.OsHle.Ipc
namespace Ryujinx.HLE.HOS.Ipc
{
abstract class IpcMagic
{

View File

@ -1,7 +1,7 @@
using System.Collections.Generic;
using System.IO;
namespace Ryujinx.HLE.OsHle.Ipc
namespace Ryujinx.HLE.HOS.Ipc
{
class IpcMessage
{

View File

@ -1,4 +1,4 @@
namespace Ryujinx.HLE.OsHle.Ipc
namespace Ryujinx.HLE.HOS.Ipc
{
enum IpcMessageType
{

View File

@ -1,6 +1,6 @@
using System.IO;
namespace Ryujinx.HLE.OsHle.Ipc
namespace Ryujinx.HLE.HOS.Ipc
{
struct IpcPtrBuffDesc
{

View File

@ -1,6 +1,6 @@
using System.IO;
namespace Ryujinx.HLE.OsHle.Ipc
namespace Ryujinx.HLE.HOS.Ipc
{
struct IpcRecvListBuffDesc
{

View File

@ -1,4 +1,4 @@
namespace Ryujinx.HLE.OsHle.Ipc
namespace Ryujinx.HLE.HOS.Ipc
{
delegate long ServiceProcessRequest(ServiceCtx Context);
}

View File

@ -1,10 +1,9 @@
using ChocolArm64.Memory;
using ChocolArm64.State;
using Ryujinx.HLE.OsHle.Handles;
using static Ryujinx.HLE.OsHle.ErrorCode;
using static Ryujinx.HLE.HOS.ErrorCode;
namespace Ryujinx.HLE.OsHle.Kernel
namespace Ryujinx.HLE.HOS.Kernel
{
static class AddressArbiter
{
@ -27,12 +26,12 @@ namespace Ryujinx.HLE.OsHle.Kernel
return 0;
}
public static ulong WaitForAddressIfLessThan(Process Process,
AThreadState ThreadState,
AMemory Memory,
long Address,
int Value,
ulong Timeout,
public static ulong WaitForAddressIfLessThan(Process Process,
AThreadState ThreadState,
AMemory Memory,
long Address,
int Value,
ulong Timeout,
bool ShouldDecrement)
{
Memory.SetExclusive(ThreadState, Address);
@ -75,11 +74,11 @@ namespace Ryujinx.HLE.OsHle.Kernel
return WaitForAddress(Process, ThreadState, Address, Timeout);
}
public static ulong WaitForAddressIfEqual(Process Process,
AThreadState ThreadState,
AMemory Memory,
long Address,
int Value,
public static ulong WaitForAddressIfEqual(Process Process,
AThreadState ThreadState,
AMemory Memory,
long Address,
int Value,
ulong Timeout)
{
if (Memory.ReadInt32(Address) != Value)

View File

@ -1,4 +1,4 @@
namespace Ryujinx.HLE.OsHle.Handles
namespace Ryujinx.HLE.HOS.Kernel
{
enum AddressSpaceType
{

View File

@ -1,4 +1,4 @@
namespace Ryujinx.HLE.OsHle.Handles
namespace Ryujinx.HLE.HOS.Kernel
{
class KEvent : KSynchronizationObject { }
}

View File

@ -1,4 +1,4 @@
namespace Ryujinx.HLE.OsHle.Handles
namespace Ryujinx.HLE.HOS.Kernel
{
class KMemoryBlock
{

View File

@ -1,4 +1,4 @@
namespace Ryujinx.HLE.OsHle.Handles
namespace Ryujinx.HLE.HOS.Kernel
{
class KMemoryInfo
{

View File

@ -1,12 +1,11 @@
using ChocolArm64.Memory;
using Ryujinx.HLE.Memory;
using Ryujinx.HLE.OsHle.Kernel;
using System;
using System.Collections.Generic;
using static Ryujinx.HLE.OsHle.ErrorCode;
using static Ryujinx.HLE.HOS.ErrorCode;
namespace Ryujinx.HLE.OsHle.Handles
namespace Ryujinx.HLE.HOS.Kernel
{
class KMemoryManager
{
@ -43,7 +42,7 @@ namespace Ryujinx.HLE.OsHle.Handles
public KMemoryManager(Process Process)
{
CpuMemory = Process.Memory;
Allocator = Process.Ns.Memory.Allocator;
Allocator = Process.Device.Memory.Allocator;
long CodeRegionSize;
long MapRegionSize;

View File

@ -1,6 +1,6 @@
using System.Collections.Generic;
namespace Ryujinx.HLE.OsHle.Handles
namespace Ryujinx.HLE.HOS.Kernel
{
class KProcessHandleTable
{

View File

@ -3,7 +3,7 @@ using System;
using System.Collections.Concurrent;
using System.Threading;
namespace Ryujinx.HLE.OsHle.Handles
namespace Ryujinx.HLE.HOS.Kernel
{
class KProcessScheduler : IDisposable
{
@ -124,6 +124,16 @@ namespace Ryujinx.HLE.OsHle.Handles
AllThreads[Thread].WaitSync.Set();
}
public void ForceWakeUp(KThread Thread)
{
if (AllThreads.TryGetValue(Thread, out SchedulerThread SchedThread))
{
SchedThread.WaitSync.Set();
SchedThread.WaitActivity.Set();
SchedThread.WaitSched.Set();
}
}
public void ChangeCore(KThread Thread, int IdealCore, int CoreMask)
{
lock (SchedLock)

View File

@ -1,7 +1,7 @@
using Ryujinx.HLE.OsHle.Services;
using Ryujinx.HLE.HOS.Services;
using System;
namespace Ryujinx.HLE.OsHle.Handles
namespace Ryujinx.HLE.HOS.Kernel
{
class KSession : IDisposable
{

View File

@ -1,4 +1,4 @@
namespace Ryujinx.HLE.OsHle.Handles
namespace Ryujinx.HLE.HOS.Kernel
{
class KSharedMemory
{

View File

@ -1,7 +1,7 @@
using System;
using System.Threading;
namespace Ryujinx.HLE.OsHle.Handles
namespace Ryujinx.HLE.HOS.Kernel
{
class KSynchronizationObject : IDisposable
{

View File

@ -1,7 +1,7 @@
using ChocolArm64;
using System.Collections.Generic;
namespace Ryujinx.HLE.OsHle.Handles
namespace Ryujinx.HLE.HOS.Kernel
{
class KThread : KSynchronizationObject
{
@ -33,18 +33,20 @@ namespace Ryujinx.HLE.OsHle.Handles
public long LastPc { get; set; }
public int ThreadId => Thread.ThreadId;
public int ThreadId { get; private set; }
public KThread(
AThread Thread,
Process Process,
int ProcessorId,
int Priority)
int Priority,
int ThreadId)
{
this.Thread = Thread;
this.Process = Process;
this.ProcessorId = ProcessorId;
this.IdealCore = ProcessorId;
this.ThreadId = ThreadId;
MutexWaiters = new List<KThread>();

View File

@ -1,6 +1,6 @@
using System;
namespace Ryujinx.HLE.OsHle.Handles
namespace Ryujinx.HLE.HOS.Kernel
{
class KTlsPageManager
{

View File

@ -1,4 +1,4 @@
namespace Ryujinx.HLE.OsHle.Handles
namespace Ryujinx.HLE.HOS.Kernel
{
class KTransferMemory
{

View File

@ -1,4 +1,4 @@
namespace Ryujinx.HLE.OsHle.Kernel
namespace Ryujinx.HLE.HOS.Kernel
{
static class KernelErr
{

View File

@ -1,6 +1,6 @@
using System;
namespace Ryujinx.HLE.OsHle.Handles
namespace Ryujinx.HLE.HOS.Kernel
{
[Flags]
enum MemoryAttribute : byte

View File

@ -1,6 +1,6 @@
using System;
namespace Ryujinx.HLE.OsHle.Handles
namespace Ryujinx.HLE.HOS.Kernel
{
[Flags]
enum MemoryPermission : byte

View File

@ -1,6 +1,6 @@
using System;
namespace Ryujinx.HLE.OsHle
namespace Ryujinx.HLE.HOS.Kernel
{
[Flags]
enum MemoryState : uint

View File

@ -1,4 +1,4 @@
namespace Ryujinx.HLE.OsHle.Kernel
namespace Ryujinx.HLE.HOS.Kernel
{
static class NsTimeConverter
{

View File

@ -1,7 +1,7 @@
using System;
using System.Threading;
namespace Ryujinx.HLE.OsHle.Handles
namespace Ryujinx.HLE.HOS.Kernel
{
class SchedulerThread : IDisposable
{

View File

@ -2,13 +2,12 @@ using ChocolArm64.Events;
using ChocolArm64.Memory;
using ChocolArm64.State;
using Ryujinx.HLE.Logging;
using Ryujinx.HLE.OsHle.Handles;
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Threading;
namespace Ryujinx.HLE.OsHle.Kernel
namespace Ryujinx.HLE.HOS.Kernel
{
partial class SvcHandler
{
@ -16,7 +15,7 @@ namespace Ryujinx.HLE.OsHle.Kernel
private Dictionary<int, SvcFunc> SvcFuncs;
private Switch Ns;
private Switch Device;
private Process Process;
private AMemory Memory;
@ -27,7 +26,7 @@ namespace Ryujinx.HLE.OsHle.Kernel
private static Random Rng;
public SvcHandler(Switch Ns, Process Process)
public SvcHandler(Switch Device, Process Process)
{
SvcFuncs = new Dictionary<int, SvcFunc>()
{
@ -73,7 +72,7 @@ namespace Ryujinx.HLE.OsHle.Kernel
{ 0x34, SvcWaitForAddress }
};
this.Ns = Ns;
this.Device = Device;
this.Process = Process;
this.Memory = Process.Memory;
@ -93,19 +92,19 @@ namespace Ryujinx.HLE.OsHle.Kernel
if (SvcFuncs.TryGetValue(e.Id, out SvcFunc Func))
{
Ns.Log.PrintDebug(LogClass.KernelSvc, $"{Func.Method.Name} called.");
Device.Log.PrintDebug(LogClass.KernelSvc, $"{Func.Method.Name} called.");
Func(ThreadState);
Process.Scheduler.Reschedule(Process.GetThread(ThreadState.Tpidr));
Ns.Log.PrintDebug(LogClass.KernelSvc, $"{Func.Method.Name} ended.");
Device.Log.PrintDebug(LogClass.KernelSvc, $"{Func.Method.Name} ended.");
}
else
{
Process.PrintStackTrace(ThreadState);
throw new NotImplementedException(e.Id.ToString("x4"));
throw new NotImplementedException($"0x{e.Id:x4}");
}
}

View File

@ -1,10 +1,9 @@
using ChocolArm64.State;
using Ryujinx.HLE.Logging;
using Ryujinx.HLE.OsHle.Handles;
using static Ryujinx.HLE.OsHle.ErrorCode;
using static Ryujinx.HLE.HOS.ErrorCode;
namespace Ryujinx.HLE.OsHle.Kernel
namespace Ryujinx.HLE.HOS.Kernel
{
partial class SvcHandler
{
@ -14,7 +13,7 @@ namespace Ryujinx.HLE.OsHle.Kernel
if ((Size & 0x1fffff) != 0 || Size != (uint)Size)
{
Ns.Log.PrintWarning(LogClass.KernelSvc, $"Heap size 0x{Size:x16} is not aligned!");
Device.Log.PrintWarning(LogClass.KernelSvc, $"Heap size 0x{Size:x16} is not aligned!");
ThreadState.X0 = MakeError(ErrorModule.Kernel, KernelErr.InvalidSize);
@ -31,7 +30,7 @@ namespace Ryujinx.HLE.OsHle.Kernel
}
else
{
Ns.Log.PrintWarning(LogClass.KernelSvc, $"Operation failed with error 0x{Result:x}!");
Device.Log.PrintWarning(LogClass.KernelSvc, $"Operation failed with error 0x{Result:x}!");
}
}
@ -42,7 +41,7 @@ namespace Ryujinx.HLE.OsHle.Kernel
if (!PageAligned(Position))
{
Ns.Log.PrintWarning(LogClass.KernelSvc, $"Address 0x{Position:x16} is not page aligned!");
Device.Log.PrintWarning(LogClass.KernelSvc, $"Address 0x{Position:x16} is not page aligned!");
ThreadState.X0 = MakeError(ErrorModule.Kernel, KernelErr.InvalidAddress);
@ -51,7 +50,7 @@ namespace Ryujinx.HLE.OsHle.Kernel
if (!PageAligned(Size) || Size == 0)
{
Ns.Log.PrintWarning(LogClass.KernelSvc, $"Size 0x{Size:x16} is not page aligned or is zero!");
Device.Log.PrintWarning(LogClass.KernelSvc, $"Size 0x{Size:x16} is not page aligned or is zero!");
ThreadState.X0 = MakeError(ErrorModule.Kernel, KernelErr.InvalidSize);
@ -66,7 +65,7 @@ namespace Ryujinx.HLE.OsHle.Kernel
if (Attributes != AttributeMask ||
(Attributes | MemoryAttribute.Uncached) != MemoryAttribute.Uncached)
{
Ns.Log.PrintWarning(LogClass.KernelSvc, "Invalid memory attributes!");
Device.Log.PrintWarning(LogClass.KernelSvc, "Invalid memory attributes!");
ThreadState.X0 = MakeError(ErrorModule.Kernel, KernelErr.InvalidMaskValue);
@ -81,7 +80,7 @@ namespace Ryujinx.HLE.OsHle.Kernel
if (Result != 0)
{
Ns.Log.PrintWarning(LogClass.KernelSvc, $"Operation failed with error 0x{Result:x}!");
Device.Log.PrintWarning(LogClass.KernelSvc, $"Operation failed with error 0x{Result:x}!");
}
else
{
@ -99,7 +98,7 @@ namespace Ryujinx.HLE.OsHle.Kernel
if (!PageAligned(Src | Dst))
{
Ns.Log.PrintWarning(LogClass.KernelSvc, "Addresses are not page aligned!");
Device.Log.PrintWarning(LogClass.KernelSvc, "Addresses are not page aligned!");
ThreadState.X0 = MakeError(ErrorModule.Kernel, KernelErr.InvalidAddress);
@ -108,7 +107,7 @@ namespace Ryujinx.HLE.OsHle.Kernel
if (!PageAligned(Size) || Size == 0)
{
Ns.Log.PrintWarning(LogClass.KernelSvc, $"Size 0x{Size:x16} is not page aligned or is zero!");
Device.Log.PrintWarning(LogClass.KernelSvc, $"Size 0x{Size:x16} is not page aligned or is zero!");
ThreadState.X0 = MakeError(ErrorModule.Kernel, KernelErr.InvalidSize);
@ -117,7 +116,7 @@ namespace Ryujinx.HLE.OsHle.Kernel
if ((ulong)(Src + Size) <= (ulong)Src || (ulong)(Dst + Size) <= (ulong)Dst)
{
Ns.Log.PrintWarning(LogClass.KernelSvc, "Addresses outside of range!");
Device.Log.PrintWarning(LogClass.KernelSvc, "Addresses outside of range!");
ThreadState.X0 = MakeError(ErrorModule.Kernel, KernelErr.NoAccessPerm);
@ -126,7 +125,7 @@ namespace Ryujinx.HLE.OsHle.Kernel
if (!InsideAddrSpace(Src, Size))
{
Ns.Log.PrintWarning(LogClass.KernelSvc, $"Src address 0x{Src:x16} out of range!");
Device.Log.PrintWarning(LogClass.KernelSvc, $"Src address 0x{Src:x16} out of range!");
ThreadState.X0 = MakeError(ErrorModule.Kernel, KernelErr.NoAccessPerm);
@ -135,7 +134,7 @@ namespace Ryujinx.HLE.OsHle.Kernel
if (!InsideNewMapRegion(Dst, Size))
{
Ns.Log.PrintWarning(LogClass.KernelSvc, $"Dst address 0x{Dst:x16} out of range!");
Device.Log.PrintWarning(LogClass.KernelSvc, $"Dst address 0x{Dst:x16} out of range!");
ThreadState.X0 = MakeError(ErrorModule.Kernel, KernelErr.InvalidMemRange);
@ -146,7 +145,7 @@ namespace Ryujinx.HLE.OsHle.Kernel
if (Result != 0)
{
Ns.Log.PrintWarning(LogClass.KernelSvc, $"Operation failed with error 0x{Result:x}!");
Device.Log.PrintWarning(LogClass.KernelSvc, $"Operation failed with error 0x{Result:x}!");
}
ThreadState.X0 = (ulong)Result;
@ -160,7 +159,7 @@ namespace Ryujinx.HLE.OsHle.Kernel
if (!PageAligned(Src | Dst))
{
Ns.Log.PrintWarning(LogClass.KernelSvc, "Addresses are not page aligned!");
Device.Log.PrintWarning(LogClass.KernelSvc, "Addresses are not page aligned!");
ThreadState.X0 = MakeError(ErrorModule.Kernel, KernelErr.InvalidAddress);
@ -169,7 +168,7 @@ namespace Ryujinx.HLE.OsHle.Kernel
if (!PageAligned(Size) || Size == 0)
{
Ns.Log.PrintWarning(LogClass.KernelSvc, $"Size 0x{Size:x16} is not page aligned or is zero!");
Device.Log.PrintWarning(LogClass.KernelSvc, $"Size 0x{Size:x16} is not page aligned or is zero!");
ThreadState.X0 = MakeError(ErrorModule.Kernel, KernelErr.InvalidSize);
@ -178,7 +177,7 @@ namespace Ryujinx.HLE.OsHle.Kernel
if ((ulong)(Src + Size) <= (ulong)Src || (ulong)(Dst + Size) <= (ulong)Dst)
{
Ns.Log.PrintWarning(LogClass.KernelSvc, "Addresses outside of range!");
Device.Log.PrintWarning(LogClass.KernelSvc, "Addresses outside of range!");
ThreadState.X0 = MakeError(ErrorModule.Kernel, KernelErr.NoAccessPerm);
@ -187,7 +186,7 @@ namespace Ryujinx.HLE.OsHle.Kernel
if (!InsideAddrSpace(Src, Size))
{
Ns.Log.PrintWarning(LogClass.KernelSvc, $"Src address 0x{Src:x16} out of range!");
Device.Log.PrintWarning(LogClass.KernelSvc, $"Src address 0x{Src:x16} out of range!");
ThreadState.X0 = MakeError(ErrorModule.Kernel, KernelErr.NoAccessPerm);
@ -196,7 +195,7 @@ namespace Ryujinx.HLE.OsHle.Kernel
if (!InsideNewMapRegion(Dst, Size))
{
Ns.Log.PrintWarning(LogClass.KernelSvc, $"Dst address 0x{Dst:x16} out of range!");
Device.Log.PrintWarning(LogClass.KernelSvc, $"Dst address 0x{Dst:x16} out of range!");
ThreadState.X0 = MakeError(ErrorModule.Kernel, KernelErr.InvalidMemRange);
@ -207,7 +206,7 @@ namespace Ryujinx.HLE.OsHle.Kernel
if (Result != 0)
{
Ns.Log.PrintWarning(LogClass.KernelSvc, $"Operation failed with error 0x{Result:x}!");
Device.Log.PrintWarning(LogClass.KernelSvc, $"Operation failed with error 0x{Result:x}!");
}
ThreadState.X0 = (ulong)Result;
@ -241,7 +240,7 @@ namespace Ryujinx.HLE.OsHle.Kernel
if (!PageAligned(Position))
{
Ns.Log.PrintWarning(LogClass.KernelSvc, $"Address 0x{Position:x16} is not page aligned!");
Device.Log.PrintWarning(LogClass.KernelSvc, $"Address 0x{Position:x16} is not page aligned!");
ThreadState.X0 = MakeError(ErrorModule.Kernel, KernelErr.InvalidAddress);
@ -250,7 +249,7 @@ namespace Ryujinx.HLE.OsHle.Kernel
if (!PageAligned(Size) || Size == 0)
{
Ns.Log.PrintWarning(LogClass.KernelSvc, $"Size 0x{Size:x16} is not page aligned or is zero!");
Device.Log.PrintWarning(LogClass.KernelSvc, $"Size 0x{Size:x16} is not page aligned or is zero!");
ThreadState.X0 = MakeError(ErrorModule.Kernel, KernelErr.InvalidSize);
@ -259,7 +258,7 @@ namespace Ryujinx.HLE.OsHle.Kernel
if ((ulong)(Position + Size) <= (ulong)Position)
{
Ns.Log.PrintWarning(LogClass.KernelSvc, $"Invalid region address 0x{Position:x16} / size 0x{Size:x16}!");
Device.Log.PrintWarning(LogClass.KernelSvc, $"Invalid region address 0x{Position:x16} / size 0x{Size:x16}!");
ThreadState.X0 = MakeError(ErrorModule.Kernel, KernelErr.NoAccessPerm);
@ -270,7 +269,7 @@ namespace Ryujinx.HLE.OsHle.Kernel
if ((Permission | MemoryPermission.Write) != MemoryPermission.ReadAndWrite)
{
Ns.Log.PrintWarning(LogClass.KernelSvc, $"Invalid permission {Permission}!");
Device.Log.PrintWarning(LogClass.KernelSvc, $"Invalid permission {Permission}!");
ThreadState.X0 = MakeError(ErrorModule.Kernel, KernelErr.InvalidPermission);
@ -281,7 +280,7 @@ namespace Ryujinx.HLE.OsHle.Kernel
if (SharedMemory == null)
{
Ns.Log.PrintWarning(LogClass.KernelSvc, $"Invalid shared memory handle 0x{Handle:x8}!");
Device.Log.PrintWarning(LogClass.KernelSvc, $"Invalid shared memory handle 0x{Handle:x8}!");
ThreadState.X0 = MakeError(ErrorModule.Kernel, KernelErr.InvalidHandle);
@ -290,7 +289,7 @@ namespace Ryujinx.HLE.OsHle.Kernel
if (!InsideAddrSpace(Position, Size) || InsideMapRegion(Position, Size) || InsideHeapRegion(Position, Size))
{
Ns.Log.PrintWarning(LogClass.KernelSvc, $"Address 0x{Position:x16} out of range!");
Device.Log.PrintWarning(LogClass.KernelSvc, $"Address 0x{Position:x16} out of range!");
ThreadState.X0 = MakeError(ErrorModule.Kernel, KernelErr.NoAccessPerm);
@ -299,7 +298,7 @@ namespace Ryujinx.HLE.OsHle.Kernel
if (SharedMemory.Size != Size)
{
Ns.Log.PrintWarning(LogClass.KernelSvc, $"Size 0x{Size:x16} does not match shared memory size 0x{SharedMemory.Size:16}!");
Device.Log.PrintWarning(LogClass.KernelSvc, $"Size 0x{Size:x16} does not match shared memory size 0x{SharedMemory.Size:16}!");
ThreadState.X0 = MakeError(ErrorModule.Kernel, KernelErr.InvalidSize);
@ -310,7 +309,7 @@ namespace Ryujinx.HLE.OsHle.Kernel
if (Result != 0)
{
Ns.Log.PrintWarning(LogClass.KernelSvc, $"Operation failed with error 0x{Result:x}!");
Device.Log.PrintWarning(LogClass.KernelSvc, $"Operation failed with error 0x{Result:x}!");
}
ThreadState.X0 = (ulong)Result;
@ -324,7 +323,7 @@ namespace Ryujinx.HLE.OsHle.Kernel
if (!PageAligned(Position))
{
Ns.Log.PrintWarning(LogClass.KernelSvc, $"Address 0x{Position:x16} is not page aligned!");
Device.Log.PrintWarning(LogClass.KernelSvc, $"Address 0x{Position:x16} is not page aligned!");
ThreadState.X0 = MakeError(ErrorModule.Kernel, KernelErr.InvalidAddress);
@ -333,7 +332,7 @@ namespace Ryujinx.HLE.OsHle.Kernel
if (!PageAligned(Size) || Size == 0)
{
Ns.Log.PrintWarning(LogClass.KernelSvc, $"Size 0x{Size:x16} is not page aligned or is zero!");
Device.Log.PrintWarning(LogClass.KernelSvc, $"Size 0x{Size:x16} is not page aligned or is zero!");
ThreadState.X0 = MakeError(ErrorModule.Kernel, KernelErr.InvalidSize);
@ -342,7 +341,7 @@ namespace Ryujinx.HLE.OsHle.Kernel
if ((ulong)(Position + Size) <= (ulong)Position)
{
Ns.Log.PrintWarning(LogClass.KernelSvc, $"Invalid region address 0x{Position:x16} / size 0x{Size:x16}!");
Device.Log.PrintWarning(LogClass.KernelSvc, $"Invalid region address 0x{Position:x16} / size 0x{Size:x16}!");
ThreadState.X0 = MakeError(ErrorModule.Kernel, KernelErr.NoAccessPerm);
@ -353,7 +352,7 @@ namespace Ryujinx.HLE.OsHle.Kernel
if (SharedMemory == null)
{
Ns.Log.PrintWarning(LogClass.KernelSvc, $"Invalid shared memory handle 0x{Handle:x8}!");
Device.Log.PrintWarning(LogClass.KernelSvc, $"Invalid shared memory handle 0x{Handle:x8}!");
ThreadState.X0 = MakeError(ErrorModule.Kernel, KernelErr.InvalidHandle);
@ -362,7 +361,7 @@ namespace Ryujinx.HLE.OsHle.Kernel
if (!InsideAddrSpace(Position, Size) || InsideMapRegion(Position, Size) || InsideHeapRegion(Position, Size))
{
Ns.Log.PrintWarning(LogClass.KernelSvc, $"Address 0x{Position:x16} out of range!");
Device.Log.PrintWarning(LogClass.KernelSvc, $"Address 0x{Position:x16} out of range!");
ThreadState.X0 = MakeError(ErrorModule.Kernel, KernelErr.NoAccessPerm);
@ -373,7 +372,7 @@ namespace Ryujinx.HLE.OsHle.Kernel
if (Result != 0)
{
Ns.Log.PrintWarning(LogClass.KernelSvc, $"Operation failed with error 0x{Result:x}!");
Device.Log.PrintWarning(LogClass.KernelSvc, $"Operation failed with error 0x{Result:x}!");
}
ThreadState.X0 = (ulong)Result;
@ -386,7 +385,7 @@ namespace Ryujinx.HLE.OsHle.Kernel
if (!PageAligned(Position))
{
Ns.Log.PrintWarning(LogClass.KernelSvc, $"Address 0x{Position:x16} is not page aligned!");
Device.Log.PrintWarning(LogClass.KernelSvc, $"Address 0x{Position:x16} is not page aligned!");
ThreadState.X0 = MakeError(ErrorModule.Kernel, KernelErr.InvalidAddress);
@ -395,7 +394,7 @@ namespace Ryujinx.HLE.OsHle.Kernel
if (!PageAligned(Size) || Size == 0)
{
Ns.Log.PrintWarning(LogClass.KernelSvc, $"Size 0x{Size:x16} is not page aligned or is zero!");
Device.Log.PrintWarning(LogClass.KernelSvc, $"Size 0x{Size:x16} is not page aligned or is zero!");
ThreadState.X0 = MakeError(ErrorModule.Kernel, KernelErr.InvalidAddress);
@ -404,7 +403,7 @@ namespace Ryujinx.HLE.OsHle.Kernel
if ((ulong)(Position + Size) <= (ulong)Position)
{
Ns.Log.PrintWarning(LogClass.KernelSvc, $"Invalid region address 0x{Position:x16} / size 0x{Size:x16}!");
Device.Log.PrintWarning(LogClass.KernelSvc, $"Invalid region address 0x{Position:x16} / size 0x{Size:x16}!");
ThreadState.X0 = MakeError(ErrorModule.Kernel, KernelErr.NoAccessPerm);
@ -415,7 +414,7 @@ namespace Ryujinx.HLE.OsHle.Kernel
if (Permission > MemoryPermission.ReadAndWrite || Permission == MemoryPermission.Write)
{
Ns.Log.PrintWarning(LogClass.KernelSvc, $"Invalid permission {Permission}!");
Device.Log.PrintWarning(LogClass.KernelSvc, $"Invalid permission {Permission}!");
ThreadState.X0 = MakeError(ErrorModule.Kernel, KernelErr.InvalidPermission);
@ -439,7 +438,7 @@ namespace Ryujinx.HLE.OsHle.Kernel
if (!PageAligned(Position))
{
Ns.Log.PrintWarning(LogClass.KernelSvc, $"Address 0x{Position:x16} is not page aligned!");
Device.Log.PrintWarning(LogClass.KernelSvc, $"Address 0x{Position:x16} is not page aligned!");
ThreadState.X0 = MakeError(ErrorModule.Kernel, KernelErr.InvalidAddress);
@ -448,7 +447,7 @@ namespace Ryujinx.HLE.OsHle.Kernel
if (!PageAligned(Size) || Size == 0)
{
Ns.Log.PrintWarning(LogClass.KernelSvc, $"Size 0x{Size:x16} is not page aligned or is zero!");
Device.Log.PrintWarning(LogClass.KernelSvc, $"Size 0x{Size:x16} is not page aligned or is zero!");
ThreadState.X0 = MakeError(ErrorModule.Kernel, KernelErr.InvalidSize);
@ -457,7 +456,7 @@ namespace Ryujinx.HLE.OsHle.Kernel
if ((ulong)(Position + Size) <= (ulong)Position)
{
Ns.Log.PrintWarning(LogClass.KernelSvc, $"Invalid region address 0x{Position:x16} / size 0x{Size:x16}!");
Device.Log.PrintWarning(LogClass.KernelSvc, $"Invalid region address 0x{Position:x16} / size 0x{Size:x16}!");
ThreadState.X0 = MakeError(ErrorModule.Kernel, KernelErr.NoAccessPerm);
@ -466,7 +465,7 @@ namespace Ryujinx.HLE.OsHle.Kernel
if (!InsideAddrSpace(Position, Size))
{
Ns.Log.PrintWarning(LogClass.KernelSvc, $"Invalid address {Position:x16}!");
Device.Log.PrintWarning(LogClass.KernelSvc, $"Invalid address {Position:x16}!");
ThreadState.X0 = MakeError(ErrorModule.Kernel, KernelErr.NoAccessPerm);
@ -477,7 +476,7 @@ namespace Ryujinx.HLE.OsHle.Kernel
if (Result != 0)
{
Ns.Log.PrintWarning(LogClass.KernelSvc, $"Operation failed with error 0x{Result:x}!");
Device.Log.PrintWarning(LogClass.KernelSvc, $"Operation failed with error 0x{Result:x}!");
}
ThreadState.X0 = (ulong)Result;
@ -490,7 +489,7 @@ namespace Ryujinx.HLE.OsHle.Kernel
if (!PageAligned(Position))
{
Ns.Log.PrintWarning(LogClass.KernelSvc, $"Address 0x{Position:x16} is not page aligned!");
Device.Log.PrintWarning(LogClass.KernelSvc, $"Address 0x{Position:x16} is not page aligned!");
ThreadState.X0 = MakeError(ErrorModule.Kernel, KernelErr.InvalidAddress);
@ -499,7 +498,7 @@ namespace Ryujinx.HLE.OsHle.Kernel
if (!PageAligned(Size) || Size == 0)
{
Ns.Log.PrintWarning(LogClass.KernelSvc, $"Size 0x{Size:x16} is not page aligned or is zero!");
Device.Log.PrintWarning(LogClass.KernelSvc, $"Size 0x{Size:x16} is not page aligned or is zero!");
ThreadState.X0 = MakeError(ErrorModule.Kernel, KernelErr.InvalidSize);
@ -508,7 +507,7 @@ namespace Ryujinx.HLE.OsHle.Kernel
if ((ulong)(Position + Size) <= (ulong)Position)
{
Ns.Log.PrintWarning(LogClass.KernelSvc, $"Invalid region address 0x{Position:x16} / size 0x{Size:x16}!");
Device.Log.PrintWarning(LogClass.KernelSvc, $"Invalid region address 0x{Position:x16} / size 0x{Size:x16}!");
ThreadState.X0 = MakeError(ErrorModule.Kernel, KernelErr.NoAccessPerm);
@ -517,7 +516,7 @@ namespace Ryujinx.HLE.OsHle.Kernel
if (!InsideAddrSpace(Position, Size))
{
Ns.Log.PrintWarning(LogClass.KernelSvc, $"Invalid address {Position:x16}!");
Device.Log.PrintWarning(LogClass.KernelSvc, $"Invalid address {Position:x16}!");
ThreadState.X0 = MakeError(ErrorModule.Kernel, KernelErr.NoAccessPerm);
@ -528,7 +527,7 @@ namespace Ryujinx.HLE.OsHle.Kernel
if (Result != 0)
{
Ns.Log.PrintWarning(LogClass.KernelSvc, $"Operation failed with error 0x{Result:x}!");
Device.Log.PrintWarning(LogClass.KernelSvc, $"Operation failed with error 0x{Result:x}!");
}
ThreadState.X0 = (ulong)Result;

View File

@ -1,16 +1,15 @@
using ChocolArm64.Memory;
using ChocolArm64.State;
using Ryujinx.HLE.Exceptions;
using Ryujinx.HLE.HOS.Ipc;
using Ryujinx.HLE.HOS.Services;
using Ryujinx.HLE.Logging;
using Ryujinx.HLE.OsHle.Exceptions;
using Ryujinx.HLE.OsHle.Handles;
using Ryujinx.HLE.OsHle.Ipc;
using Ryujinx.HLE.OsHle.Services;
using System;
using System.Threading;
using static Ryujinx.HLE.OsHle.ErrorCode;
using static Ryujinx.HLE.HOS.ErrorCode;
namespace Ryujinx.HLE.OsHle.Kernel
namespace Ryujinx.HLE.HOS.Kernel
{
partial class SvcHandler
{
@ -20,7 +19,7 @@ namespace Ryujinx.HLE.OsHle.Kernel
private void SvcExitProcess(AThreadState ThreadState)
{
Ns.Os.ExitProcess(ThreadState.ProcessId);
Device.System.ExitProcess(Process.ProcessId);
}
private void SvcClearEvent(AThreadState ThreadState)
@ -40,7 +39,7 @@ namespace Ryujinx.HLE.OsHle.Kernel
if (Obj == null)
{
Ns.Log.PrintWarning(LogClass.KernelSvc, $"Invalid handle 0x{Handle:x8}!");
Device.Log.PrintWarning(LogClass.KernelSvc, $"Invalid handle 0x{Handle:x8}!");
ThreadState.X0 = MakeError(ErrorModule.Kernel, KernelErr.InvalidHandle);
@ -75,7 +74,7 @@ namespace Ryujinx.HLE.OsHle.Kernel
}
else
{
Ns.Log.PrintWarning(LogClass.KernelSvc, $"Invalid event handle 0x{Handle:x8}!");
Device.Log.PrintWarning(LogClass.KernelSvc, $"Invalid event handle 0x{Handle:x8}!");
ThreadState.X0 = MakeError(ErrorModule.Kernel, KernelErr.InvalidHandle);
}
@ -87,10 +86,10 @@ namespace Ryujinx.HLE.OsHle.Kernel
int HandlesCount = (int)ThreadState.X2;
ulong Timeout = ThreadState.X3;
Ns.Log.PrintDebug(LogClass.KernelSvc,
"HandlesPtr = " + HandlesPtr .ToString("x16") + ", " +
"HandlesCount = " + HandlesCount.ToString("x8") + ", " +
"Timeout = " + Timeout .ToString("x16"));
Device.Log.PrintDebug(LogClass.KernelSvc,
"HandlesPtr = 0x" + HandlesPtr .ToString("x16") + ", " +
"HandlesCount = 0x" + HandlesCount.ToString("x8") + ", " +
"Timeout = 0x" + Timeout .ToString("x16"));
if ((uint)HandlesCount > 0x40)
{
@ -111,7 +110,7 @@ namespace Ryujinx.HLE.OsHle.Kernel
if (SyncObj == null)
{
Ns.Log.PrintWarning(LogClass.KernelSvc, $"Invalid handle 0x{Handle:x8}!");
Device.Log.PrintWarning(LogClass.KernelSvc, $"Invalid handle 0x{Handle:x8}!");
ThreadState.X0 = MakeError(ErrorModule.Kernel, KernelErr.InvalidHandle);
@ -175,7 +174,7 @@ namespace Ryujinx.HLE.OsHle.Kernel
if (Thread == null)
{
Ns.Log.PrintWarning(LogClass.KernelSvc, $"Invalid thread handle 0x{ThreadHandle:x8}!");
Device.Log.PrintWarning(LogClass.KernelSvc, $"Invalid thread handle 0x{ThreadHandle:x8}!");
ThreadState.X0 = MakeError(ErrorModule.Kernel, KernelErr.InvalidHandle);
@ -240,7 +239,7 @@ namespace Ryujinx.HLE.OsHle.Kernel
IpcMessage Cmd = new IpcMessage(CmdData, CmdPtr);
long Result = IpcHandler.IpcCall(Ns, Process, Memory, Session, Cmd, CmdPtr);
long Result = IpcHandler.IpcCall(Device, Process, Memory, Session, Cmd, CmdPtr);
Thread.Yield();
@ -250,7 +249,7 @@ namespace Ryujinx.HLE.OsHle.Kernel
}
else
{
Ns.Log.PrintWarning(LogClass.KernelSvc, $"Invalid session handle 0x{Handle:x8}!");
Device.Log.PrintWarning(LogClass.KernelSvc, $"Invalid session handle 0x{Handle:x8}!");
ThreadState.X0 = MakeError(ErrorModule.Kernel, KernelErr.InvalidHandle);
}
@ -274,7 +273,7 @@ namespace Ryujinx.HLE.OsHle.Kernel
string Str = AMemoryHelper.ReadAsciiString(Memory, Position, Size);
Ns.Log.PrintWarning(LogClass.KernelSvc, Str);
Device.Log.PrintWarning(LogClass.KernelSvc, Str);
ThreadState.X0 = 0;
}
@ -321,11 +320,11 @@ namespace Ryujinx.HLE.OsHle.Kernel
break;
case 6:
ThreadState.X1 = (ulong)Process.Ns.Memory.Allocator.TotalAvailableSize;
ThreadState.X1 = (ulong)Process.Device.Memory.Allocator.TotalAvailableSize;
break;
case 7:
ThreadState.X1 = (ulong)Process.Ns.Memory.Allocator.TotalUsedSize;
ThreadState.X1 = (ulong)Process.Device.Memory.Allocator.TotalUsedSize;
break;
case 8:
@ -365,7 +364,7 @@ namespace Ryujinx.HLE.OsHle.Kernel
default:
Process.PrintStackTrace(ThreadState);
throw new NotImplementedException($"SvcGetInfo: {InfoType} {Handle:x8} {InfoId}");
throw new NotImplementedException($"SvcGetInfo: {InfoType} 0x{Handle:x8} {InfoId}");
}
ThreadState.X0 = 0;

View File

@ -1,11 +1,10 @@
using ChocolArm64.State;
using Ryujinx.HLE.Logging;
using Ryujinx.HLE.OsHle.Handles;
using System.Threading;
using static Ryujinx.HLE.OsHle.ErrorCode;
using static Ryujinx.HLE.HOS.ErrorCode;
namespace Ryujinx.HLE.OsHle.Kernel
namespace Ryujinx.HLE.HOS.Kernel
{
partial class SvcHandler
{
@ -19,7 +18,7 @@ namespace Ryujinx.HLE.OsHle.Kernel
if ((uint)Priority > 0x3f)
{
Ns.Log.PrintWarning(LogClass.KernelSvc, $"Invalid priority 0x{Priority:x8}!");
Device.Log.PrintWarning(LogClass.KernelSvc, $"Invalid priority 0x{Priority:x8}!");
ThreadState.X0 = MakeError(ErrorModule.Kernel, KernelErr.InvalidPriority);
@ -33,7 +32,7 @@ namespace Ryujinx.HLE.OsHle.Kernel
}
else if ((uint)ProcessorId > 3)
{
Ns.Log.PrintWarning(LogClass.KernelSvc, $"Invalid core id 0x{ProcessorId:x8}!");
Device.Log.PrintWarning(LogClass.KernelSvc, $"Invalid core id 0x{ProcessorId:x8}!");
ThreadState.X0 = MakeError(ErrorModule.Kernel, KernelErr.InvalidCoreId);
@ -66,7 +65,7 @@ namespace Ryujinx.HLE.OsHle.Kernel
}
else
{
Ns.Log.PrintWarning(LogClass.KernelSvc, $"Invalid thread handle 0x{Handle:x8}!");
Device.Log.PrintWarning(LogClass.KernelSvc, $"Invalid thread handle 0x{Handle:x8}!");
ThreadState.X0 = MakeError(ErrorModule.Kernel, KernelErr.InvalidHandle);
}
@ -83,7 +82,7 @@ namespace Ryujinx.HLE.OsHle.Kernel
{
ulong TimeoutNs = ThreadState.X0;
Ns.Log.PrintDebug(LogClass.KernelSvc, "Timeout = " + TimeoutNs.ToString("x16"));
Device.Log.PrintDebug(LogClass.KernelSvc, "Timeout = 0x" + TimeoutNs.ToString("x16"));
KThread CurrThread = Process.GetThread(ThreadState.Tpidr);
@ -114,7 +113,7 @@ namespace Ryujinx.HLE.OsHle.Kernel
}
else
{
Ns.Log.PrintWarning(LogClass.KernelSvc, $"Invalid thread handle 0x{Handle:x8}!");
Device.Log.PrintWarning(LogClass.KernelSvc, $"Invalid thread handle 0x{Handle:x8}!");
ThreadState.X0 = MakeError(ErrorModule.Kernel, KernelErr.InvalidHandle);
}
@ -125,9 +124,9 @@ namespace Ryujinx.HLE.OsHle.Kernel
int Handle = (int)ThreadState.X0;
int Priority = (int)ThreadState.X1;
Ns.Log.PrintDebug(LogClass.KernelSvc,
"Handle = " + Handle .ToString("x8") + ", " +
"Priority = " + Priority.ToString("x8"));
Device.Log.PrintDebug(LogClass.KernelSvc,
"Handle = 0x" + Handle .ToString("x8") + ", " +
"Priority = 0x" + Priority.ToString("x8"));
KThread Thread = GetThread(ThreadState.Tpidr, Handle);
@ -139,7 +138,7 @@ namespace Ryujinx.HLE.OsHle.Kernel
}
else
{
Ns.Log.PrintWarning(LogClass.KernelSvc, $"Invalid thread handle 0x{Handle:x8}!");
Device.Log.PrintWarning(LogClass.KernelSvc, $"Invalid thread handle 0x{Handle:x8}!");
ThreadState.X0 = MakeError(ErrorModule.Kernel, KernelErr.InvalidHandle);
}
@ -149,7 +148,7 @@ namespace Ryujinx.HLE.OsHle.Kernel
{
int Handle = (int)ThreadState.X2;
Ns.Log.PrintDebug(LogClass.KernelSvc, "Handle = " + Handle.ToString("x8"));
Device.Log.PrintDebug(LogClass.KernelSvc, "Handle = 0x" + Handle.ToString("x8"));
KThread Thread = GetThread(ThreadState.Tpidr, Handle);
@ -161,7 +160,7 @@ namespace Ryujinx.HLE.OsHle.Kernel
}
else
{
Ns.Log.PrintWarning(LogClass.KernelSvc, $"Invalid thread handle 0x{Handle:x8}!");
Device.Log.PrintWarning(LogClass.KernelSvc, $"Invalid thread handle 0x{Handle:x8}!");
ThreadState.X0 = MakeError(ErrorModule.Kernel, KernelErr.InvalidHandle);
}
@ -173,10 +172,10 @@ namespace Ryujinx.HLE.OsHle.Kernel
int IdealCore = (int)ThreadState.X1;
long CoreMask = (long)ThreadState.X2;
Ns.Log.PrintDebug(LogClass.KernelSvc,
"Handle = " + Handle .ToString("x8") + ", " +
"IdealCore = " + IdealCore.ToString("x8") + ", " +
"CoreMask = " + CoreMask .ToString("x16"));
Device.Log.PrintDebug(LogClass.KernelSvc,
"Handle = 0x" + Handle .ToString("x8") + ", " +
"IdealCore = 0x" + IdealCore.ToString("x8") + ", " +
"CoreMask = 0x" + CoreMask .ToString("x16"));
KThread Thread = GetThread(ThreadState.Tpidr, Handle);
@ -193,7 +192,7 @@ namespace Ryujinx.HLE.OsHle.Kernel
{
if ((IdealCore | 2) != -1)
{
Ns.Log.PrintWarning(LogClass.KernelSvc, $"Invalid core id 0x{IdealCore:x8}!");
Device.Log.PrintWarning(LogClass.KernelSvc, $"Invalid core id 0x{IdealCore:x8}!");
ThreadState.X0 = MakeError(ErrorModule.Kernel, KernelErr.InvalidCoreId);
@ -202,7 +201,7 @@ namespace Ryujinx.HLE.OsHle.Kernel
}
else if ((CoreMask & (1 << IdealCore)) == 0)
{
Ns.Log.PrintWarning(LogClass.KernelSvc, $"Invalid core mask 0x{CoreMask:x8}!");
Device.Log.PrintWarning(LogClass.KernelSvc, $"Invalid core mask 0x{CoreMask:x8}!");
ThreadState.X0 = MakeError(ErrorModule.Kernel, KernelErr.InvalidMaskValue);
@ -212,7 +211,7 @@ namespace Ryujinx.HLE.OsHle.Kernel
if (Thread == null)
{
Ns.Log.PrintWarning(LogClass.KernelSvc, $"Invalid thread handle 0x{Handle:x8}!");
Device.Log.PrintWarning(LogClass.KernelSvc, $"Invalid thread handle 0x{Handle:x8}!");
ThreadState.X0 = MakeError(ErrorModule.Kernel, KernelErr.InvalidHandle);
@ -224,7 +223,7 @@ namespace Ryujinx.HLE.OsHle.Kernel
//-3 is used as "don't update", the old IdealCore value is kept.
if (IdealCore == -3 && (CoreMask & (1 << Thread.IdealCore)) == 0)
{
Ns.Log.PrintWarning(LogClass.KernelSvc, $"Invalid core mask 0x{CoreMask:x8}!");
Device.Log.PrintWarning(LogClass.KernelSvc, $"Invalid core mask 0x{CoreMask:x8}!");
ThreadState.X0 = MakeError(ErrorModule.Kernel, KernelErr.InvalidMaskValue);
@ -254,7 +253,7 @@ namespace Ryujinx.HLE.OsHle.Kernel
}
else
{
Ns.Log.PrintWarning(LogClass.KernelSvc, $"Invalid thread handle 0x{Handle:x8}!");
Device.Log.PrintWarning(LogClass.KernelSvc, $"Invalid thread handle 0x{Handle:x8}!");
ThreadState.X0 = MakeError(ErrorModule.Kernel, KernelErr.InvalidHandle);
}
@ -275,7 +274,7 @@ namespace Ryujinx.HLE.OsHle.Kernel
}
else
{
Ns.Log.PrintWarning(LogClass.KernelSvc, $"Invalid thread handle 0x{Handle:x8}!");
Device.Log.PrintWarning(LogClass.KernelSvc, $"Invalid thread handle 0x{Handle:x8}!");
ThreadState.X0 = MakeError(ErrorModule.Kernel, KernelErr.InvalidHandle);
}
@ -290,7 +289,7 @@ namespace Ryujinx.HLE.OsHle.Kernel
if (Thread == null)
{
Ns.Log.PrintWarning(LogClass.KernelSvc, $"Invalid thread handle 0x{Handle:x8}!");
Device.Log.PrintWarning(LogClass.KernelSvc, $"Invalid thread handle 0x{Handle:x8}!");
ThreadState.X0 = MakeError(ErrorModule.Kernel, KernelErr.InvalidHandle);
@ -299,7 +298,7 @@ namespace Ryujinx.HLE.OsHle.Kernel
if (Process.GetThread(ThreadState.Tpidr) == Thread)
{
Ns.Log.PrintWarning(LogClass.KernelSvc, $"Thread handle 0x{Handle:x8} is current thread!");
Device.Log.PrintWarning(LogClass.KernelSvc, $"Thread handle 0x{Handle:x8} is current thread!");
ThreadState.X0 = MakeError(ErrorModule.Kernel, KernelErr.InvalidThread);

View File

@ -1,11 +1,10 @@
using ChocolArm64.State;
using Ryujinx.HLE.Logging;
using Ryujinx.HLE.OsHle.Handles;
using System;
using static Ryujinx.HLE.OsHle.ErrorCode;
using static Ryujinx.HLE.HOS.ErrorCode;
namespace Ryujinx.HLE.OsHle.Kernel
namespace Ryujinx.HLE.HOS.Kernel
{
partial class SvcHandler
{
@ -17,23 +16,23 @@ namespace Ryujinx.HLE.OsHle.Kernel
long MutexAddress = (long)ThreadState.X1;
int WaitThreadHandle = (int)ThreadState.X2;
Ns.Log.PrintDebug(LogClass.KernelSvc,
"OwnerThreadHandle = " + OwnerThreadHandle.ToString("x8") + ", " +
"MutexAddress = " + MutexAddress .ToString("x16") + ", " +
"WaitThreadHandle = " + WaitThreadHandle .ToString("x8"));
Device.Log.PrintDebug(LogClass.KernelSvc,
"OwnerThreadHandle = 0x" + OwnerThreadHandle.ToString("x8") + ", " +
"MutexAddress = 0x" + MutexAddress .ToString("x16") + ", " +
"WaitThreadHandle = 0x" + WaitThreadHandle .ToString("x8"));
if (IsPointingInsideKernel(MutexAddress))
{
Ns.Log.PrintWarning(LogClass.KernelSvc, $"Invalid mutex address 0x{MutexAddress:x16}!");
Device.Log.PrintWarning(LogClass.KernelSvc, $"Invalid mutex address 0x{MutexAddress:x16}!");
ThreadState.X0 = MakeError(ErrorModule.Kernel, KernelErr.NoAccessPerm);
return;
}
if (IsWordAddressUnaligned(MutexAddress))
if (IsAddressNotWordAligned(MutexAddress))
{
Ns.Log.PrintWarning(LogClass.KernelSvc, $"Unaligned mutex address 0x{MutexAddress:x16}!");
Device.Log.PrintWarning(LogClass.KernelSvc, $"Unaligned mutex address 0x{MutexAddress:x16}!");
ThreadState.X0 = MakeError(ErrorModule.Kernel, KernelErr.InvalidAddress);
@ -44,7 +43,7 @@ namespace Ryujinx.HLE.OsHle.Kernel
if (OwnerThread == null)
{
Ns.Log.PrintWarning(LogClass.KernelSvc, $"Invalid owner thread handle 0x{OwnerThreadHandle:x8}!");
Device.Log.PrintWarning(LogClass.KernelSvc, $"Invalid owner thread handle 0x{OwnerThreadHandle:x8}!");
ThreadState.X0 = MakeError(ErrorModule.Kernel, KernelErr.InvalidHandle);
@ -55,7 +54,7 @@ namespace Ryujinx.HLE.OsHle.Kernel
if (WaitThread == null)
{
Ns.Log.PrintWarning(LogClass.KernelSvc, $"Invalid requesting thread handle 0x{WaitThreadHandle:x8}!");
Device.Log.PrintWarning(LogClass.KernelSvc, $"Invalid requesting thread handle 0x{WaitThreadHandle:x8}!");
ThreadState.X0 = MakeError(ErrorModule.Kernel, KernelErr.InvalidHandle);
@ -73,20 +72,20 @@ namespace Ryujinx.HLE.OsHle.Kernel
{
long MutexAddress = (long)ThreadState.X0;
Ns.Log.PrintDebug(LogClass.KernelSvc, "MutexAddress = " + MutexAddress.ToString("x16"));
Device.Log.PrintDebug(LogClass.KernelSvc, "MutexAddress = 0x" + MutexAddress.ToString("x16"));
if (IsPointingInsideKernel(MutexAddress))
{
Ns.Log.PrintWarning(LogClass.KernelSvc, $"Invalid mutex address 0x{MutexAddress:x16}!");
Device.Log.PrintWarning(LogClass.KernelSvc, $"Invalid mutex address 0x{MutexAddress:x16}!");
ThreadState.X0 = MakeError(ErrorModule.Kernel, KernelErr.NoAccessPerm);
return;
}
if (IsWordAddressUnaligned(MutexAddress))
if (IsAddressNotWordAligned(MutexAddress))
{
Ns.Log.PrintWarning(LogClass.KernelSvc, $"Unaligned mutex address 0x{MutexAddress:x16}!");
Device.Log.PrintWarning(LogClass.KernelSvc, $"Unaligned mutex address 0x{MutexAddress:x16}!");
ThreadState.X0 = MakeError(ErrorModule.Kernel, KernelErr.InvalidAddress);
@ -105,24 +104,24 @@ namespace Ryujinx.HLE.OsHle.Kernel
int ThreadHandle = (int)ThreadState.X2;
ulong Timeout = ThreadState.X3;
Ns.Log.PrintDebug(LogClass.KernelSvc,
"MutexAddress = " + MutexAddress .ToString("x16") + ", " +
"CondVarAddress = " + CondVarAddress.ToString("x16") + ", " +
"ThreadHandle = " + ThreadHandle .ToString("x8") + ", " +
"Timeout = " + Timeout .ToString("x16"));
Device.Log.PrintDebug(LogClass.KernelSvc,
"MutexAddress = 0x" + MutexAddress .ToString("x16") + ", " +
"CondVarAddress = 0x" + CondVarAddress.ToString("x16") + ", " +
"ThreadHandle = 0x" + ThreadHandle .ToString("x8") + ", " +
"Timeout = 0x" + Timeout .ToString("x16"));
if (IsPointingInsideKernel(MutexAddress))
{
Ns.Log.PrintWarning(LogClass.KernelSvc, $"Invalid mutex address 0x{MutexAddress:x16}!");
Device.Log.PrintWarning(LogClass.KernelSvc, $"Invalid mutex address 0x{MutexAddress:x16}!");
ThreadState.X0 = MakeError(ErrorModule.Kernel, KernelErr.NoAccessPerm);
return;
}
if (IsWordAddressUnaligned(MutexAddress))
if (IsAddressNotWordAligned(MutexAddress))
{
Ns.Log.PrintWarning(LogClass.KernelSvc, $"Unaligned mutex address 0x{MutexAddress:x16}!");
Device.Log.PrintWarning(LogClass.KernelSvc, $"Unaligned mutex address 0x{MutexAddress:x16}!");
ThreadState.X0 = MakeError(ErrorModule.Kernel, KernelErr.InvalidAddress);
@ -133,7 +132,7 @@ namespace Ryujinx.HLE.OsHle.Kernel
if (Thread == null)
{
Ns.Log.PrintWarning(LogClass.KernelSvc, $"Invalid thread handle 0x{ThreadHandle:x8}!");
Device.Log.PrintWarning(LogClass.KernelSvc, $"Invalid thread handle 0x{ThreadHandle:x8}!");
ThreadState.X0 = MakeError(ErrorModule.Kernel, KernelErr.InvalidHandle);
@ -157,9 +156,9 @@ namespace Ryujinx.HLE.OsHle.Kernel
long CondVarAddress = (long)ThreadState.X0;
int Count = (int)ThreadState.X1;
Ns.Log.PrintDebug(LogClass.KernelSvc,
"CondVarAddress = " + CondVarAddress.ToString("x16") + ", " +
"Count = " + Count .ToString("x8"));
Device.Log.PrintDebug(LogClass.KernelSvc,
"CondVarAddress = 0x" + CondVarAddress.ToString("x16") + ", " +
"Count = 0x" + Count .ToString("x8"));
KThread CurrThread = Process.GetThread(ThreadState.Tpidr);
@ -179,7 +178,7 @@ namespace Ryujinx.HLE.OsHle.Kernel
{
int MutexValue = Memory.ReadInt32(MutexAddress);
Ns.Log.PrintDebug(LogClass.KernelSvc, "MutexValue = " + MutexValue.ToString("x8"));
Device.Log.PrintDebug(LogClass.KernelSvc, "MutexValue = 0x" + MutexValue.ToString("x8"));
if (MutexValue != (OwnerThreadHandle | MutexHasListenersMask))
{
@ -192,7 +191,7 @@ namespace Ryujinx.HLE.OsHle.Kernel
InsertWaitingMutexThreadUnsafe(OwnerThreadHandle, WaitThread);
}
Ns.Log.PrintDebug(LogClass.KernelSvc, "Entering wait state...");
Device.Log.PrintDebug(LogClass.KernelSvc, "Entering wait state...");
Process.Scheduler.EnterWait(CurrThread);
}
@ -204,24 +203,24 @@ namespace Ryujinx.HLE.OsHle.Kernel
int Value = (int)ThreadState.X2;
ulong Timeout = ThreadState.X3;
Ns.Log.PrintDebug(LogClass.KernelSvc,
"Address = " + Address.ToString("x16") + ", " +
"ArbitrationType = " + Type .ToString() + ", " +
"Value = " + Value .ToString("x8") + ", " +
"Timeout = " + Timeout.ToString("x16"));
Device.Log.PrintDebug(LogClass.KernelSvc,
"Address = 0x" + Address.ToString("x16") + ", " +
"ArbitrationType = 0x" + Type .ToString() + ", " +
"Value = 0x" + Value .ToString("x8") + ", " +
"Timeout = 0x" + Timeout.ToString("x16"));
if (IsPointingInsideKernel(Address))
{
Ns.Log.PrintWarning(LogClass.KernelSvc, $"Invalid address 0x{Address:x16}!");
Device.Log.PrintWarning(LogClass.KernelSvc, $"Invalid address 0x{Address:x16}!");
ThreadState.X0 = MakeError(ErrorModule.Kernel, KernelErr.NoAccessPerm);
return;
}
if (IsWordAddressUnaligned(Address))
if (IsAddressNotWordAligned(Address))
{
Ns.Log.PrintWarning(LogClass.KernelSvc, $"Unaligned address 0x{Address:x16}!");
Device.Log.PrintWarning(LogClass.KernelSvc, $"Unaligned address 0x{Address:x16}!");
ThreadState.X0 = MakeError(ErrorModule.Kernel, KernelErr.InvalidAddress);
@ -282,13 +281,13 @@ namespace Ryujinx.HLE.OsHle.Kernel
Process.Scheduler.WakeUp(OwnerThread);
Ns.Log.PrintDebug(LogClass.KernelSvc, "Gave mutex to thread id " + OwnerThread.ThreadId + "!");
Device.Log.PrintDebug(LogClass.KernelSvc, "Gave mutex to thread id " + OwnerThread.ThreadId + "!");
}
else
{
Memory.WriteInt32ToSharedAddr(MutexAddress, 0);
Ns.Log.PrintDebug(LogClass.KernelSvc, "No threads waiting mutex!");
Device.Log.PrintDebug(LogClass.KernelSvc, "No threads waiting mutex!");
}
}
}
@ -313,7 +312,7 @@ namespace Ryujinx.HLE.OsHle.Kernel
Process.ThreadArbiterList.Add(WaitThread);
}
Ns.Log.PrintDebug(LogClass.KernelSvc, "Entering wait state...");
Device.Log.PrintDebug(LogClass.KernelSvc, "Entering wait state...");
if (Timeout != ulong.MaxValue)
{
@ -333,7 +332,7 @@ namespace Ryujinx.HLE.OsHle.Kernel
Process.ThreadArbiterList.Remove(WaitThread);
Ns.Log.PrintDebug(LogClass.KernelSvc, "Timed out...");
Device.Log.PrintDebug(LogClass.KernelSvc, "Timed out...");
return false;
}
@ -361,7 +360,7 @@ namespace Ryujinx.HLE.OsHle.Kernel
if (WaitThread == null)
{
Ns.Log.PrintDebug(LogClass.KernelSvc, "No more threads to wake up!");
Device.Log.PrintDebug(LogClass.KernelSvc, "No more threads to wake up!");
break;
}
@ -393,7 +392,7 @@ namespace Ryujinx.HLE.OsHle.Kernel
MutexValue = Memory.ReadInt32(MutexAddress);
}
Ns.Log.PrintDebug(LogClass.KernelSvc, "MutexValue = " + MutexValue.ToString("x8"));
Device.Log.PrintDebug(LogClass.KernelSvc, "MutexValue = 0x" + MutexValue.ToString("x8"));
if (MutexValue == 0)
{
@ -437,7 +436,7 @@ namespace Ryujinx.HLE.OsHle.Kernel
if (OwnerThread == null)
{
Ns.Log.PrintWarning(LogClass.KernelSvc, $"Invalid thread handle 0x{OwnerThreadHandle:x8}!");
Device.Log.PrintWarning(LogClass.KernelSvc, $"Invalid thread handle 0x{OwnerThreadHandle:x8}!");
return;
}
@ -516,7 +515,7 @@ namespace Ryujinx.HLE.OsHle.Kernel
return ((ulong)Address + 0x1000000000) < 0xffffff000;
}
private bool IsWordAddressUnaligned(long Address)
private bool IsAddressNotWordAligned(long Address)
{
return (Address & 3) != 0;
}

View File

@ -1,4 +1,4 @@
namespace Ryujinx.HLE.OsHle.Handles
namespace Ryujinx.HLE.HOS.Kernel
{
class ThreadQueue
{

View File

@ -2,30 +2,29 @@ using ChocolArm64;
using ChocolArm64.Events;
using ChocolArm64.Memory;
using ChocolArm64.State;
using Ryujinx.HLE.Exceptions;
using Ryujinx.HLE.HOS.Diagnostics;
using Ryujinx.HLE.HOS.Kernel;
using Ryujinx.HLE.HOS.Services.Nv;
using Ryujinx.HLE.HOS.SystemState;
using Ryujinx.HLE.Loaders;
using Ryujinx.HLE.Loaders.Executables;
using Ryujinx.HLE.Loaders.Npdm;
using Ryujinx.HLE.Logging;
using Ryujinx.HLE.OsHle.Diagnostics;
using Ryujinx.HLE.OsHle.Exceptions;
using Ryujinx.HLE.OsHle.Handles;
using Ryujinx.HLE.OsHle.Kernel;
using Ryujinx.HLE.OsHle.Services.Nv;
using Ryujinx.HLE.OsHle.SystemState;
using Ryujinx.HLE.OsHle.Utilities;
using Ryujinx.HLE.Utilities;
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.IO;
using System.Text;
namespace Ryujinx.HLE.OsHle
namespace Ryujinx.HLE.HOS
{
class Process : IDisposable
{
private const int TickFreq = 19_200_000;
public Switch Ns { get; private set; }
public Switch Device { get; private set; }
public bool NeedsHbAbi { get; private set; }
@ -57,8 +56,6 @@ namespace Ryujinx.HLE.OsHle
private ConcurrentDictionary<long, KThread> Threads;
private KThread MainThread;
private List<Executable> Executables;
private Dictionary<long, string> SymbolTable;
@ -69,14 +66,14 @@ namespace Ryujinx.HLE.OsHle
private bool Disposed;
public Process(Switch Ns, KProcessScheduler Scheduler, int ProcessId, Npdm MetaData)
public Process(Switch Device, KProcessScheduler Scheduler, int ProcessId, Npdm MetaData)
{
this.Ns = Ns;
this.Device = Device;
this.Scheduler = Scheduler;
this.MetaData = MetaData;
this.ProcessId = ProcessId;
Memory = new AMemory(Ns.Memory.RamPointer);
Memory = new AMemory(Device.Memory.RamPointer);
MemoryManager = new KMemoryManager(this);
@ -90,7 +87,7 @@ namespace Ryujinx.HLE.OsHle
AppletState = new AppletStateMgr();
SvcHandler = new SvcHandler(Ns, this);
SvcHandler = new SvcHandler(Device, this);
Threads = new ConcurrentDictionary<long, KThread>();
@ -106,7 +103,7 @@ namespace Ryujinx.HLE.OsHle
throw new ObjectDisposedException(nameof(Process));
}
Ns.Log.PrintInfo(LogClass.Loader, $"Image base at 0x{ImageBase:x16}.");
Device.Log.PrintInfo(LogClass.Loader, $"Image base at 0x{ImageBase:x16}.");
Executable Executable = new Executable(Program, MemoryManager, Memory, ImageBase);
@ -156,7 +153,7 @@ namespace Ryujinx.HLE.OsHle
return false;
}
MainThread = HandleTable.GetData<KThread>(Handle);
KThread MainThread = HandleTable.GetData<KThread>(Handle);
if (NeedsHbAbi)
{
@ -170,7 +167,7 @@ namespace Ryujinx.HLE.OsHle
MemoryState.MappedMemory,
MemoryPermission.ReadAndWrite);
string SwitchPath = Ns.VFs.SystemPathToSwitchPath(Executables[0].FilePath);
string SwitchPath = Device.FileSystem.SystemPathToSwitchPath(Executables[0].FilePath);
Homebrew.WriteHbAbiData(Memory, HbAbiDataPosition, Handle, SwitchPath);
@ -183,24 +180,6 @@ namespace Ryujinx.HLE.OsHle
return true;
}
public void StopAllThreadsAsync()
{
if (Disposed)
{
throw new ObjectDisposedException(nameof(Process));
}
if (MainThread != null)
{
MainThread.Thread.StopExecution();
}
foreach (KThread Thread in Threads.Values)
{
Thread.Thread.StopExecution();
}
}
public int MakeThread(
long EntryPoint,
long StackTop,
@ -215,18 +194,16 @@ namespace Ryujinx.HLE.OsHle
AThread CpuThread = new AThread(GetTranslator(), Memory, EntryPoint);
KThread Thread = new KThread(CpuThread, this, ProcessorId, Priority);
long Tpidr = GetFreeTls();
int ThreadId = (int)((Tpidr - MemoryManager.TlsIoRegionStart) / 0x200) + 1;
KThread Thread = new KThread(CpuThread, this, ProcessorId, Priority, ThreadId);
Thread.LastPc = EntryPoint;
int Handle = HandleTable.OpenHandle(Thread);
long Tpidr = GetFreeTls();
int ThreadId = (int)((Tpidr - MemoryManager.TlsIoRegionStart) / 0x200) + 1;
CpuThread.ThreadState.ProcessId = ProcessId;
CpuThread.ThreadState.ThreadId = ThreadId;
CpuThread.ThreadState.CntfrqEl0 = TickFreq;
CpuThread.ThreadState.Tpidr = Tpidr;
@ -330,7 +307,7 @@ namespace Ryujinx.HLE.OsHle
}
}
Ns.Log.PrintDebug(LogClass.Cpu, $"Executing at 0x{e.Position:x16} {e.SubName} {NsoName}");
Device.Log.PrintDebug(LogClass.Cpu, $"Executing at 0x{e.Position:x16} {e.SubName} {NsoName}");
}
public void PrintStackTrace(AThreadState ThreadState)
@ -355,7 +332,7 @@ namespace Ryujinx.HLE.OsHle
Trace.AppendLine(" " + SubName + " (" + GetNsoNameAndAddress(Position) + ")");
}
Ns.Log.PrintInfo(LogClass.Cpu, Trace.ToString());
Device.Log.PrintInfo(LogClass.Cpu, Trace.ToString());
}
private string GetNsoNameAndAddress(long Position)
@ -390,12 +367,7 @@ namespace Ryujinx.HLE.OsHle
if (Threads.Count == 0)
{
if (ShouldDispose)
{
Dispose();
}
Ns.Os.ExitProcess(ProcessId);
Device.System.ExitProcess(ProcessId);
}
}
@ -409,6 +381,35 @@ namespace Ryujinx.HLE.OsHle
return Thread;
}
private void Unload()
{
if (Disposed || Threads.Count > 0)
{
return;
}
Disposed = true;
foreach (object Obj in HandleTable.Clear())
{
if (Obj is KSession Session)
{
Session.Dispose();
}
}
INvDrvServices.UnloadProcess(this);
AppletState.Dispose();
if (NeedsHbAbi && Executables.Count > 0 && Executables[0].FilePath.EndsWith(Homebrew.TemporaryNroSuffix))
{
File.Delete(Executables[0].FilePath);
}
Device.Log.PrintInfo(LogClass.Loader, $"Process {ProcessId} exiting...");
}
public void Dispose()
{
Dispose(true);
@ -416,41 +417,21 @@ namespace Ryujinx.HLE.OsHle
protected virtual void Dispose(bool Disposing)
{
if (Disposing && !Disposed)
if (Disposing)
{
//If there is still some thread running, disposing the objects is not
//safe as the thread may try to access those resources. Instead, we set
//the flag to have the Process disposed when all threads finishes.
//Note: This may not happen if the guest code gets stuck on a infinite loop.
if (Threads.Count > 0)
{
ShouldDispose = true;
Ns.Log.PrintInfo(LogClass.Loader, $"Process {ProcessId} waiting all threads terminate...");
return;
}
Disposed = true;
foreach (object Obj in HandleTable.Clear())
{
if (Obj is KSession Session)
foreach (KThread Thread in Threads.Values)
{
Session.Dispose();
Thread.Thread.StopExecution();
Scheduler.ForceWakeUp(Thread);
}
}
if (NeedsHbAbi && Executables.Count > 0 && Executables[0].FilePath.EndsWith(Homebrew.TemporaryNroSuffix))
else
{
File.Delete(Executables[0].FilePath);
Unload();
}
INvDrvServices.UnloadProcess(this);
AppletState.Dispose();
Ns.Log.PrintInfo(LogClass.Loader, $"Process {ProcessId} exiting...");
}
}
}

View File

@ -1,13 +1,13 @@
using ChocolArm64.Memory;
using Ryujinx.HLE.OsHle.Handles;
using Ryujinx.HLE.OsHle.Ipc;
using Ryujinx.HLE.HOS.Ipc;
using Ryujinx.HLE.HOS.Kernel;
using System.IO;
namespace Ryujinx.HLE.OsHle
namespace Ryujinx.HLE.HOS
{
class ServiceCtx
{
public Switch Ns { get; private set; }
public Switch Device { get; private set; }
public Process Process { get; private set; }
public AMemory Memory { get; private set; }
public KSession Session { get; private set; }
@ -17,7 +17,7 @@ namespace Ryujinx.HLE.OsHle
public BinaryWriter ResponseData { get; private set; }
public ServiceCtx(
Switch Ns,
Switch Device,
Process Process,
AMemory Memory,
KSession Session,
@ -26,7 +26,7 @@ namespace Ryujinx.HLE.OsHle
BinaryReader RequestData,
BinaryWriter ResponseData)
{
this.Ns = Ns;
this.Device = Device;
this.Process = Process;
this.Memory = Memory;
this.Session = Session;

View File

@ -1,4 +1,4 @@
namespace Ryujinx.HLE.OsHle.Services.Acc
namespace Ryujinx.HLE.HOS.Services.Acc
{
static class AccErr
{

View File

@ -1,12 +1,11 @@
using ChocolArm64.Memory;
using Ryujinx.HLE.HOS.Ipc;
using Ryujinx.HLE.HOS.SystemState;
using Ryujinx.HLE.Logging;
using Ryujinx.HLE.OsHle.Ipc;
using Ryujinx.HLE.OsHle.SystemState;
using System.Collections.Generic;
using static Ryujinx.HLE.OsHle.ErrorCode;
using static Ryujinx.HLE.HOS.ErrorCode;
namespace Ryujinx.HLE.OsHle.Services.Acc
namespace Ryujinx.HLE.HOS.Services.Acc
{
class IAccountServiceForApplication : IpcService
{
@ -31,7 +30,7 @@ namespace Ryujinx.HLE.OsHle.Services.Acc
public long GetUserCount(ServiceCtx Context)
{
Context.ResponseData.Write(Context.Ns.Os.SystemState.GetUserCount());
Context.ResponseData.Write(Context.Device.System.State.GetUserCount());
return 0;
}
@ -42,19 +41,19 @@ namespace Ryujinx.HLE.OsHle.Services.Acc
Context.RequestData.ReadInt64(),
Context.RequestData.ReadInt64());
Context.ResponseData.Write(Context.Ns.Os.SystemState.TryGetUser(Uuid, out _) ? 1 : 0);
Context.ResponseData.Write(Context.Device.System.State.TryGetUser(Uuid, out _) ? 1 : 0);
return 0;
}
public long ListAllUsers(ServiceCtx Context)
{
return WriteUserList(Context, Context.Ns.Os.SystemState.GetAllUsers());
return WriteUserList(Context, Context.Device.System.State.GetAllUsers());
}
public long ListOpenUsers(ServiceCtx Context)
{
return WriteUserList(Context, Context.Ns.Os.SystemState.GetOpenUsers());
return WriteUserList(Context, Context.Device.System.State.GetOpenUsers());
}
private long WriteUserList(ServiceCtx Context, IEnumerable<UserProfile> Profiles)
@ -84,7 +83,7 @@ namespace Ryujinx.HLE.OsHle.Services.Acc
public long GetLastOpenedUser(ServiceCtx Context)
{
UserProfile LastOpened = Context.Ns.Os.SystemState.LastOpenUser;
UserProfile LastOpened = Context.Device.System.State.LastOpenUser;
LastOpened.Uuid.Write(Context.ResponseData);
@ -97,9 +96,9 @@ namespace Ryujinx.HLE.OsHle.Services.Acc
Context.RequestData.ReadInt64(),
Context.RequestData.ReadInt64());
if (!Context.Ns.Os.SystemState.TryGetUser(Uuid, out UserProfile Profile))
if (!Context.Device.System.State.TryGetUser(Uuid, out UserProfile Profile))
{
Context.Ns.Log.PrintWarning(LogClass.ServiceAcc, $"User 0x{Uuid} not found!");
Context.Device.Log.PrintWarning(LogClass.ServiceAcc, $"User 0x{Uuid} not found!");
return MakeError(ErrorModule.Account, AccErr.UserNotFound);
}
@ -111,7 +110,7 @@ namespace Ryujinx.HLE.OsHle.Services.Acc
public long InitializeApplicationInfo(ServiceCtx Context)
{
Context.Ns.Log.PrintStub(LogClass.ServiceAcc, "Stubbed.");
Context.Device.Log.PrintStub(LogClass.ServiceAcc, "Stubbed.");
return 0;
}

View File

@ -1,8 +1,8 @@
using Ryujinx.HLE.HOS.Ipc;
using Ryujinx.HLE.Logging;
using Ryujinx.HLE.OsHle.Ipc;
using System.Collections.Generic;
namespace Ryujinx.HLE.OsHle.Services.Acc
namespace Ryujinx.HLE.HOS.Services.Acc
{
class IManagerForApplication : IpcService
{
@ -21,14 +21,14 @@ namespace Ryujinx.HLE.OsHle.Services.Acc
public long CheckAvailability(ServiceCtx Context)
{
Context.Ns.Log.PrintStub(LogClass.ServiceAcc, "Stubbed.");
Context.Device.Log.PrintStub(LogClass.ServiceAcc, "Stubbed.");
return 0;
}
public long GetAccountId(ServiceCtx Context)
{
Context.Ns.Log.PrintStub(LogClass.ServiceAcc, "Stubbed.");
Context.Device.Log.PrintStub(LogClass.ServiceAcc, "Stubbed.");
Context.ResponseData.Write(0xcafeL);

View File

@ -1,12 +1,12 @@
using ChocolArm64.Memory;
using Ryujinx.HLE.HOS.Ipc;
using Ryujinx.HLE.HOS.SystemState;
using Ryujinx.HLE.Logging;
using Ryujinx.HLE.OsHle.Ipc;
using Ryujinx.HLE.OsHle.SystemState;
using Ryujinx.HLE.OsHle.Utilities;
using Ryujinx.HLE.Utilities;
using System.Collections.Generic;
using System.Text;
namespace Ryujinx.HLE.OsHle.Services.Acc
namespace Ryujinx.HLE.HOS.Services.Acc
{
class IProfile : IpcService
{
@ -29,7 +29,7 @@ namespace Ryujinx.HLE.OsHle.Services.Acc
public long Get(ServiceCtx Context)
{
Context.Ns.Log.PrintStub(LogClass.ServiceAcc, "Stubbed.");
Context.Device.Log.PrintStub(LogClass.ServiceAcc, "Stubbed.");
long Position = Context.Request.ReceiveBuff[0].Position;

View File

@ -1,4 +1,4 @@
namespace Ryujinx.HLE.OsHle.Services.Am
namespace Ryujinx.HLE.HOS.Services.Am
{
static class AmErr
{

View File

@ -1,4 +1,4 @@
namespace Ryujinx.HLE.OsHle.Services.Am
namespace Ryujinx.HLE.HOS.Services.Am
{
enum FocusState
{

View File

@ -1,7 +1,7 @@
using Ryujinx.HLE.OsHle.Ipc;
using Ryujinx.HLE.HOS.Ipc;
using System.Collections.Generic;
namespace Ryujinx.HLE.OsHle.Services.Am
namespace Ryujinx.HLE.HOS.Services.Am
{
class IAllSystemAppletProxiesService : IpcService
{

View File

@ -1,7 +1,7 @@
using Ryujinx.HLE.OsHle.Ipc;
using Ryujinx.HLE.HOS.Ipc;
using System.Collections.Generic;
namespace Ryujinx.HLE.OsHle.Services.Am
namespace Ryujinx.HLE.HOS.Services.Am
{
class IApplicationCreator : IpcService
{

View File

@ -1,8 +1,8 @@
using Ryujinx.HLE.HOS.Ipc;
using Ryujinx.HLE.Logging;
using Ryujinx.HLE.OsHle.Ipc;
using System.Collections.Generic;
namespace Ryujinx.HLE.OsHle.Services.Am
namespace Ryujinx.HLE.HOS.Services.Am
{
class IApplicationFunctions : IpcService
{
@ -39,7 +39,7 @@ namespace Ryujinx.HLE.OsHle.Services.Am
long UIdLow = Context.RequestData.ReadInt64();
long UIdHigh = Context.RequestData.ReadInt64();
Context.Ns.Log.PrintStub(LogClass.ServiceAm, "Stubbed.");
Context.Device.Log.PrintStub(LogClass.ServiceAm, "Stubbed.");
Context.ResponseData.Write(0L);
@ -48,7 +48,7 @@ namespace Ryujinx.HLE.OsHle.Services.Am
public long GetDesiredLanguage(ServiceCtx Context)
{
Context.ResponseData.Write(Context.Ns.Os.SystemState.DesiredLanguageCode);
Context.ResponseData.Write(Context.Device.System.State.DesiredLanguageCode);
return 0;
}
@ -59,7 +59,7 @@ namespace Ryujinx.HLE.OsHle.Services.Am
string Result = GetFormattedErrorCode(ErrorCode);
Context.Ns.Log.PrintInfo(LogClass.ServiceAm, $"Result = 0x{ErrorCode:x8} ({Result}).");
Context.Device.Log.PrintInfo(LogClass.ServiceAm, $"Result = 0x{ErrorCode:x8} ({Result}).");
return 0;
}
@ -90,7 +90,7 @@ namespace Ryujinx.HLE.OsHle.Services.Am
public long GetPseudoDeviceId(ServiceCtx Context)
{
Context.Ns.Log.PrintStub(LogClass.ServiceAm, "Stubbed.");
Context.Device.Log.PrintStub(LogClass.ServiceAm, "Stubbed.");
Context.ResponseData.Write(0L);
Context.ResponseData.Write(0L);
@ -100,7 +100,7 @@ namespace Ryujinx.HLE.OsHle.Services.Am
public long InitializeGamePlayRecording(ServiceCtx Context)
{
Context.Ns.Log.PrintStub(LogClass.ServiceAm, "Stubbed.");
Context.Device.Log.PrintStub(LogClass.ServiceAm, "Stubbed.");
return 0;
}
@ -109,7 +109,7 @@ namespace Ryujinx.HLE.OsHle.Services.Am
{
int State = Context.RequestData.ReadInt32();
Context.Ns.Log.PrintStub(LogClass.ServiceAm, "Stubbed.");
Context.Device.Log.PrintStub(LogClass.ServiceAm, "Stubbed.");
return 0;
}

View File

@ -1,7 +1,7 @@
using Ryujinx.HLE.OsHle.Ipc;
using Ryujinx.HLE.HOS.Ipc;
using System.Collections.Generic;
namespace Ryujinx.HLE.OsHle.Services.Am
namespace Ryujinx.HLE.HOS.Services.Am
{
class IApplicationProxy : IpcService
{

View File

@ -1,7 +1,7 @@
using Ryujinx.HLE.OsHle.Ipc;
using Ryujinx.HLE.HOS.Ipc;
using System.Collections.Generic;
namespace Ryujinx.HLE.OsHle.Services.Am
namespace Ryujinx.HLE.HOS.Services.Am
{
class IApplicationProxyService : IpcService
{

View File

@ -1,8 +1,8 @@
using Ryujinx.HLE.HOS.Ipc;
using Ryujinx.HLE.Logging;
using Ryujinx.HLE.OsHle.Ipc;
using System.Collections.Generic;
namespace Ryujinx.HLE.OsHle.Services.Am
namespace Ryujinx.HLE.HOS.Services.Am
{
class IAudioController : IpcService
{
@ -27,7 +27,7 @@ namespace Ryujinx.HLE.OsHle.Services.Am
float AppletVolume = Context.RequestData.ReadSingle();
float LibraryAppletVolume = Context.RequestData.ReadSingle();
Context.Ns.Log.PrintStub(LogClass.ServiceAm, "Stubbed.");
Context.Device.Log.PrintStub(LogClass.ServiceAm, "Stubbed.");
return 0;
}
@ -36,7 +36,7 @@ namespace Ryujinx.HLE.OsHle.Services.Am
{
Context.ResponseData.Write(1f);
Context.Ns.Log.PrintStub(LogClass.ServiceAm, "Stubbed.");
Context.Device.Log.PrintStub(LogClass.ServiceAm, "Stubbed.");
return 0;
}
@ -45,7 +45,7 @@ namespace Ryujinx.HLE.OsHle.Services.Am
{
Context.ResponseData.Write(1f);
Context.Ns.Log.PrintStub(LogClass.ServiceAm, "Stubbed.");
Context.Device.Log.PrintStub(LogClass.ServiceAm, "Stubbed.");
return 0;
}
@ -55,7 +55,7 @@ namespace Ryujinx.HLE.OsHle.Services.Am
float Unknown0 = Context.RequestData.ReadSingle();
long Unknown1 = Context.RequestData.ReadInt64();
Context.Ns.Log.PrintStub(LogClass.ServiceAm, "Stubbed.");
Context.Device.Log.PrintStub(LogClass.ServiceAm, "Stubbed.");
return 0;
}
@ -64,7 +64,7 @@ namespace Ryujinx.HLE.OsHle.Services.Am
{
float Unknown0 = Context.RequestData.ReadSingle();
Context.Ns.Log.PrintStub(LogClass.ServiceAm, "Stubbed.");
Context.Device.Log.PrintStub(LogClass.ServiceAm, "Stubbed.");
return 0;
}

View File

@ -1,11 +1,11 @@
using Ryujinx.HLE.HOS.Ipc;
using Ryujinx.HLE.HOS.Kernel;
using Ryujinx.HLE.Logging;
using Ryujinx.HLE.OsHle.Handles;
using Ryujinx.HLE.OsHle.Ipc;
using System.Collections.Generic;
using static Ryujinx.HLE.OsHle.ErrorCode;
using static Ryujinx.HLE.HOS.ErrorCode;
namespace Ryujinx.HLE.OsHle.Services.Am
namespace Ryujinx.HLE.HOS.Services.Am
{
class ICommonStateGetter : IpcService
{
@ -57,7 +57,7 @@ namespace Ryujinx.HLE.OsHle.Services.Am
public long GetOperationMode(ServiceCtx Context)
{
OperationMode Mode = Context.Ns.Os.SystemState.DockedMode
OperationMode Mode = Context.Device.System.State.DockedMode
? OperationMode.Docked
: OperationMode.Handheld;
@ -68,7 +68,7 @@ namespace Ryujinx.HLE.OsHle.Services.Am
public long GetPerformanceMode(ServiceCtx Context)
{
Apm.PerformanceMode Mode = Context.Ns.Os.SystemState.DockedMode
Apm.PerformanceMode Mode = Context.Device.System.State.DockedMode
? Apm.PerformanceMode.Docked
: Apm.PerformanceMode.Handheld;
@ -81,7 +81,7 @@ namespace Ryujinx.HLE.OsHle.Services.Am
{
Context.ResponseData.Write((byte)0); //Unknown value.
Context.Ns.Log.PrintStub(LogClass.ServiceAm, "Stubbed.");
Context.Device.Log.PrintStub(LogClass.ServiceAm, "Stubbed.");
return 0;
}
@ -107,7 +107,7 @@ namespace Ryujinx.HLE.OsHle.Services.Am
Context.Response.HandleDesc = IpcHandleDesc.MakeCopy(Handle);
Context.Ns.Log.PrintStub(LogClass.ServiceAm, "Stubbed.");
Context.Device.Log.PrintStub(LogClass.ServiceAm, "Stubbed.");
return 0;
}

View File

@ -1,7 +1,7 @@
using Ryujinx.HLE.OsHle.Ipc;
using Ryujinx.HLE.HOS.Ipc;
using System.Collections.Generic;
namespace Ryujinx.HLE.OsHle.Services.Am
namespace Ryujinx.HLE.HOS.Services.Am
{
class IDebugFunctions : IpcService
{

View File

@ -1,7 +1,7 @@
using Ryujinx.HLE.OsHle.Ipc;
using Ryujinx.HLE.HOS.Ipc;
using System.Collections.Generic;
namespace Ryujinx.HLE.OsHle.Services.Am
namespace Ryujinx.HLE.HOS.Services.Am
{
class IDisplayController : IpcService
{

View File

@ -1,7 +1,7 @@
using Ryujinx.HLE.OsHle.Ipc;
using Ryujinx.HLE.HOS.Ipc;
using System.Collections.Generic;
namespace Ryujinx.HLE.OsHle.Services.Am
namespace Ryujinx.HLE.HOS.Services.Am
{
class IGlobalStateController : IpcService
{

View File

@ -1,9 +1,9 @@
using Ryujinx.HLE.HOS.Ipc;
using Ryujinx.HLE.HOS.Kernel;
using Ryujinx.HLE.Logging;
using Ryujinx.HLE.OsHle.Handles;
using Ryujinx.HLE.OsHle.Ipc;
using System.Collections.Generic;
namespace Ryujinx.HLE.OsHle.Services.Am
namespace Ryujinx.HLE.HOS.Services.Am
{
class IHomeMenuFunctions : IpcService
{
@ -27,7 +27,7 @@ namespace Ryujinx.HLE.OsHle.Services.Am
public long RequestToGetForeground(ServiceCtx Context)
{
Context.Ns.Log.PrintStub(LogClass.ServiceAm, "Stubbed.");
Context.Device.Log.PrintStub(LogClass.ServiceAm, "Stubbed.");
return 0;
}
@ -38,7 +38,7 @@ namespace Ryujinx.HLE.OsHle.Services.Am
Context.Response.HandleDesc = IpcHandleDesc.MakeCopy(Handle);
Context.Ns.Log.PrintStub(LogClass.ServiceAm, "Stubbed.");
Context.Device.Log.PrintStub(LogClass.ServiceAm, "Stubbed.");
return 0;
}

View File

@ -1,9 +1,9 @@
using Ryujinx.HLE.Logging;
using Ryujinx.HLE.OsHle.Handles;
using Ryujinx.HLE.OsHle.Ipc;
using Ryujinx.HLE.HOS.Ipc;
using Ryujinx.HLE.HOS.Kernel;
using Ryujinx.HLE.Logging;
using System.Collections.Generic;
namespace Ryujinx.HLE.OsHle.Services.Am
namespace Ryujinx.HLE.HOS.Services.Am
{
class ILibraryAppletAccessor : IpcService
{
@ -35,28 +35,28 @@ namespace Ryujinx.HLE.OsHle.Services.Am
Context.Response.HandleDesc = IpcHandleDesc.MakeCopy(Handle);
Context.Ns.Log.PrintStub(LogClass.ServiceAm, "Stubbed.");
Context.Device.Log.PrintStub(LogClass.ServiceAm, "Stubbed.");
return 0;
}
public long Start(ServiceCtx Context)
{
Context.Ns.Log.PrintStub(LogClass.ServiceAm, "Stubbed.");
Context.Device.Log.PrintStub(LogClass.ServiceAm, "Stubbed.");
return 0;
}
public long GetResult(ServiceCtx Context)
{
Context.Ns.Log.PrintStub(LogClass.ServiceAm, "Stubbed.");
Context.Device.Log.PrintStub(LogClass.ServiceAm, "Stubbed.");
return 0;
}
public long PushInData(ServiceCtx Context)
{
Context.Ns.Log.PrintStub(LogClass.ServiceAm, "Stubbed.");
Context.Device.Log.PrintStub(LogClass.ServiceAm, "Stubbed.");
return 0;
}

View File

@ -1,7 +1,7 @@
using Ryujinx.HLE.OsHle.Ipc;
using Ryujinx.HLE.HOS.Ipc;
using System.Collections.Generic;
namespace Ryujinx.HLE.OsHle.Services.Am
namespace Ryujinx.HLE.HOS.Services.Am
{
class ILibraryAppletCreator : IpcService
{

View File

@ -1,9 +1,9 @@
using Ryujinx.HLE.HOS.Ipc;
using Ryujinx.HLE.HOS.Kernel;
using Ryujinx.HLE.Logging;
using Ryujinx.HLE.OsHle.Handles;
using Ryujinx.HLE.OsHle.Ipc;
using System.Collections.Generic;
namespace Ryujinx.HLE.OsHle.Services.Am
namespace Ryujinx.HLE.HOS.Services.Am
{
class ISelfController : IpcService
{
@ -36,22 +36,22 @@ namespace Ryujinx.HLE.OsHle.Services.Am
public long Exit(ServiceCtx Context)
{
Context.Ns.Log.PrintStub(LogClass.ServiceAm, "Stubbed.");
Context.Device.Log.PrintStub(LogClass.ServiceAm, "Stubbed.");
return 0;
}
public long LockExit(ServiceCtx Context)
{
Context.Ns.Log.PrintStub(LogClass.ServiceAm, "Stubbed.");
Context.Device.Log.PrintStub(LogClass.ServiceAm, "Stubbed.");
return 0;
}
public long UnlockExit(ServiceCtx Context)
{
Context.Ns.Log.PrintStub(LogClass.ServiceAm, "Stubbed.");
Context.Device.Log.PrintStub(LogClass.ServiceAm, "Stubbed.");
return 0;
}
@ -63,7 +63,7 @@ namespace Ryujinx.HLE.OsHle.Services.Am
Context.Response.HandleDesc = IpcHandleDesc.MakeCopy(Handle);
Context.Ns.Log.PrintStub(LogClass.ServiceAm, "Stubbed.");
Context.Device.Log.PrintStub(LogClass.ServiceAm, "Stubbed.");
return 0;
}
@ -72,7 +72,7 @@ namespace Ryujinx.HLE.OsHle.Services.Am
{
bool Enable = Context.RequestData.ReadByte() != 0 ? true : false;
Context.Ns.Log.PrintStub(LogClass.ServiceAm, "Stubbed.");
Context.Device.Log.PrintStub(LogClass.ServiceAm, "Stubbed.");
return 0;
}
@ -81,7 +81,7 @@ namespace Ryujinx.HLE.OsHle.Services.Am
{
bool Enable = Context.RequestData.ReadByte() != 0 ? true : false;
Context.Ns.Log.PrintStub(LogClass.ServiceAm, "Stubbed.");
Context.Device.Log.PrintStub(LogClass.ServiceAm, "Stubbed.");
return 0;
}
@ -90,7 +90,7 @@ namespace Ryujinx.HLE.OsHle.Services.Am
{
bool Enable = Context.RequestData.ReadByte() != 0 ? true : false;
Context.Ns.Log.PrintStub(LogClass.ServiceAm, "Stubbed.");
Context.Device.Log.PrintStub(LogClass.ServiceAm, "Stubbed.");
return 0;
}
@ -101,7 +101,7 @@ namespace Ryujinx.HLE.OsHle.Services.Am
bool Flag2 = Context.RequestData.ReadByte() != 0 ? true : false;
bool Flag3 = Context.RequestData.ReadByte() != 0 ? true : false;
Context.Ns.Log.PrintStub(LogClass.ServiceAm, "Stubbed.");
Context.Device.Log.PrintStub(LogClass.ServiceAm, "Stubbed.");
return 0;
}
@ -110,7 +110,7 @@ namespace Ryujinx.HLE.OsHle.Services.Am
{
bool Enable = Context.RequestData.ReadByte() != 0 ? true : false;
Context.Ns.Log.PrintStub(LogClass.ServiceAm, "Stubbed.");
Context.Device.Log.PrintStub(LogClass.ServiceAm, "Stubbed.");
return 0;
}
@ -119,7 +119,7 @@ namespace Ryujinx.HLE.OsHle.Services.Am
{
bool Enable = Context.RequestData.ReadByte() != 0 ? true : false;
Context.Ns.Log.PrintStub(LogClass.ServiceAm, "Stubbed.");
Context.Device.Log.PrintStub(LogClass.ServiceAm, "Stubbed.");
return 0;
}
@ -127,8 +127,8 @@ namespace Ryujinx.HLE.OsHle.Services.Am
public long SetScreenShotImageOrientation(ServiceCtx Context)
{
int Orientation = Context.RequestData.ReadInt32();
Context.Ns.Log.PrintStub(LogClass.ServiceAm, "Stubbed.");
Context.Device.Log.PrintStub(LogClass.ServiceAm, "Stubbed.");
return 0;
}
@ -137,7 +137,7 @@ namespace Ryujinx.HLE.OsHle.Services.Am
{
bool Enable = Context.RequestData.ReadByte() != 0 ? true : false;
Context.Ns.Log.PrintStub(LogClass.ServiceAm, "Stubbed.");
Context.Device.Log.PrintStub(LogClass.ServiceAm, "Stubbed.");
return 0;
}

View File

@ -1,7 +1,7 @@
using Ryujinx.HLE.OsHle.Ipc;
using Ryujinx.HLE.HOS.Ipc;
using System.Collections.Generic;
namespace Ryujinx.HLE.OsHle.Services.Am
namespace Ryujinx.HLE.HOS.Services.Am
{
class IStorage : IpcService
{

View File

@ -1,8 +1,8 @@
using Ryujinx.HLE.OsHle.Ipc;
using Ryujinx.HLE.HOS.Ipc;
using System;
using System.Collections.Generic;
namespace Ryujinx.HLE.OsHle.Services.Am
namespace Ryujinx.HLE.HOS.Services.Am
{
class IStorageAccessor : IpcService
{

View File

@ -1,7 +1,7 @@
using Ryujinx.HLE.OsHle.Ipc;
using Ryujinx.HLE.HOS.Ipc;
using System.Collections.Generic;
namespace Ryujinx.HLE.OsHle.Services.Am
namespace Ryujinx.HLE.HOS.Services.Am
{
class ISystemAppletProxy : IpcService
{

View File

@ -1,8 +1,8 @@
using Ryujinx.HLE.HOS.Ipc;
using Ryujinx.HLE.Logging;
using Ryujinx.HLE.OsHle.Ipc;
using System.Collections.Generic;
namespace Ryujinx.HLE.OsHle.Services.Am
namespace Ryujinx.HLE.HOS.Services.Am
{
class IWindowController : IpcService
{
@ -21,7 +21,7 @@ namespace Ryujinx.HLE.OsHle.Services.Am
public long GetAppletResourceUserId(ServiceCtx Context)
{
Context.Ns.Log.PrintStub(LogClass.ServiceAm, "Stubbed.");
Context.Device.Log.PrintStub(LogClass.ServiceAm, "Stubbed.");
Context.ResponseData.Write(0L);
@ -30,7 +30,7 @@ namespace Ryujinx.HLE.OsHle.Services.Am
public long AcquireForegroundRights(ServiceCtx Context)
{
Context.Ns.Log.PrintStub(LogClass.ServiceAm, "Stubbed.");
Context.Device.Log.PrintStub(LogClass.ServiceAm, "Stubbed.");
return 0;
}

View File

@ -1,4 +1,4 @@
namespace Ryujinx.HLE.OsHle.Services.Am
namespace Ryujinx.HLE.HOS.Services.Am
{
enum MessageInfo
{

View File

@ -1,4 +1,4 @@
namespace Ryujinx.HLE.OsHle.Services.Am
namespace Ryujinx.HLE.HOS.Services.Am
{
enum OperationMode
{

View File

@ -1,6 +1,6 @@
using System.IO;
namespace Ryujinx.HLE.OsHle.Services.Am
namespace Ryujinx.HLE.HOS.Services.Am
{
class StorageHelper
{

View File

@ -1,7 +1,7 @@
using Ryujinx.HLE.OsHle.Ipc;
using Ryujinx.HLE.HOS.Ipc;
using System.Collections.Generic;
namespace Ryujinx.HLE.OsHle.Services.Apm
namespace Ryujinx.HLE.HOS.Services.Apm
{
class IManager : IpcService
{

View File

@ -1,8 +1,8 @@
using Ryujinx.HLE.HOS.Ipc;
using Ryujinx.HLE.Logging;
using Ryujinx.HLE.OsHle.Ipc;
using System.Collections.Generic;
namespace Ryujinx.HLE.OsHle.Services.Apm
namespace Ryujinx.HLE.HOS.Services.Apm
{
class ISession : IpcService
{
@ -33,7 +33,7 @@ namespace Ryujinx.HLE.OsHle.Services.Apm
Context.ResponseData.Write((uint)PerformanceConfiguration.PerformanceConfiguration1);
Context.Ns.Log.PrintStub(LogClass.ServiceApm, "Stubbed.");
Context.Device.Log.PrintStub(LogClass.ServiceApm, "Stubbed.");
return 0;
}

View File

@ -1,4 +1,4 @@
namespace Ryujinx.HLE.OsHle.Services.Apm
namespace Ryujinx.HLE.HOS.Services.Apm
{
enum PerformanceConfiguration : uint
{

View File

@ -1,4 +1,4 @@
namespace Ryujinx.HLE.OsHle.Services.Apm
namespace Ryujinx.HLE.HOS.Services.Apm
{
enum PerformanceMode
{

View File

@ -1,4 +1,4 @@
namespace Ryujinx.HLE.OsHle.Services.Aud
namespace Ryujinx.HLE.HOS.Services.Aud
{
static class AudErr
{

View File

@ -1,6 +1,6 @@
using System.Runtime.InteropServices;
namespace Ryujinx.HLE.OsHle.Services.Aud.AudioOut
namespace Ryujinx.HLE.HOS.Services.Aud.AudioOut
{
[StructLayout(LayoutKind.Sequential)]
struct AudioOutData

View File

@ -1,11 +1,11 @@
using ChocolArm64.Memory;
using Ryujinx.Audio;
using Ryujinx.HLE.OsHle.Handles;
using Ryujinx.HLE.OsHle.Ipc;
using Ryujinx.HLE.HOS.Ipc;
using Ryujinx.HLE.HOS.Kernel;
using System;
using System.Collections.Generic;
namespace Ryujinx.HLE.OsHle.Services.Aud.AudioOut
namespace Ryujinx.HLE.HOS.Services.Aud.AudioOut
{
class IAudioOut : IpcService, IDisposable
{

View File

@ -1,4 +1,4 @@
namespace Ryujinx.HLE.OsHle.Services.Aud.AudioRenderer
namespace Ryujinx.HLE.HOS.Services.Aud.AudioRenderer
{
static class AudioConsts
{

View File

@ -1,6 +1,6 @@
using System.Runtime.InteropServices;
namespace Ryujinx.HLE.OsHle.Services.Aud.AudioRenderer
namespace Ryujinx.HLE.HOS.Services.Aud.AudioRenderer
{
[StructLayout(LayoutKind.Sequential, Size = 0x10, Pack = 4)]
struct BehaviorIn

View File

@ -1,6 +1,6 @@
using System.Runtime.InteropServices;
namespace Ryujinx.HLE.OsHle.Services.Aud.AudioRenderer
namespace Ryujinx.HLE.HOS.Services.Aud.AudioRenderer
{
[StructLayout(LayoutKind.Sequential, Size = 0xc, Pack = 1)]
struct BiquadFilter

Some files were not shown because too many files have changed in this diff Show More