mirror of
https://git.naxdy.org/Mirror/Ryujinx.git
synced 2025-02-12 04:21:30 +00:00
Remove interrupt counting and interrupt CPU immediately
This commit is contained in:
parent
1cca3e99ab
commit
5bd349e2c9
4 changed files with 15 additions and 33 deletions
|
@ -5,14 +5,10 @@ namespace ARMeilleure.State
|
|||
{
|
||||
public class ExecutionContext
|
||||
{
|
||||
private const int MinCountForCheck = 4000;
|
||||
|
||||
private NativeContext _nativeContext;
|
||||
|
||||
internal IntPtr NativeContextPtr => _nativeContext.BasePtr;
|
||||
|
||||
private bool _interrupted;
|
||||
|
||||
private readonly ICounter _counter;
|
||||
|
||||
public ulong Pc => _nativeContext.GetPc();
|
||||
|
@ -101,8 +97,7 @@ namespace ARMeilleure.State
|
|||
_undefinedCallback = undefinedCallback;
|
||||
|
||||
Running = true;
|
||||
|
||||
_nativeContext.SetCounter(MinCountForCheck);
|
||||
_nativeContext.SetInterruptState(0);
|
||||
}
|
||||
|
||||
public ulong GetX(int index) => _nativeContext.GetX(index);
|
||||
|
@ -119,19 +114,13 @@ namespace ARMeilleure.State
|
|||
|
||||
internal void CheckInterrupt()
|
||||
{
|
||||
if (_interrupted)
|
||||
{
|
||||
_interrupted = false;
|
||||
|
||||
_interruptCallback?.Invoke(this);
|
||||
}
|
||||
|
||||
_nativeContext.SetCounter(MinCountForCheck);
|
||||
_nativeContext.SetInterruptState(0);
|
||||
_interruptCallback?.Invoke(this);
|
||||
}
|
||||
|
||||
public void RequestInterrupt()
|
||||
{
|
||||
_interrupted = true;
|
||||
_nativeContext.SetInterruptState(1);
|
||||
}
|
||||
|
||||
internal void OnBreak(ulong address, int imm)
|
||||
|
@ -152,8 +141,7 @@ namespace ARMeilleure.State
|
|||
public void StopRunning()
|
||||
{
|
||||
Running = false;
|
||||
|
||||
_nativeContext.SetCounter(0);
|
||||
_nativeContext.SetInterruptState(1);
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
|
|
|
@ -13,7 +13,7 @@ namespace ARMeilleure.State
|
|||
public fixed ulong V[RegisterConsts.VecRegsCount * 2];
|
||||
public fixed uint Flags[RegisterConsts.FlagsCount];
|
||||
public fixed uint FpFlags[RegisterConsts.FpFlagsCount];
|
||||
public int Counter;
|
||||
public int InterruptState;
|
||||
public ulong DispatchAddress;
|
||||
public ulong ExclusiveAddress;
|
||||
public ulong ExclusiveValueLow;
|
||||
|
@ -168,8 +168,8 @@ namespace ARMeilleure.State
|
|||
}
|
||||
}
|
||||
|
||||
public int GetCounter() => GetStorage().Counter;
|
||||
public void SetCounter(int value) => GetStorage().Counter = value;
|
||||
public int GetInterruptState() => GetStorage().InterruptState;
|
||||
public void SetInterruptState(int value) => GetStorage().InterruptState = value;
|
||||
|
||||
public bool GetRunning() => GetStorage().Running != 0;
|
||||
public void SetRunning(bool value) => GetStorage().Running = value ? 1 : 0;
|
||||
|
@ -214,9 +214,9 @@ namespace ARMeilleure.State
|
|||
}
|
||||
}
|
||||
|
||||
public static int GetCounterOffset()
|
||||
public static int GetInterruptStateOffset()
|
||||
{
|
||||
return StorageOffset(ref _dummyStorage, ref _dummyStorage.Counter);
|
||||
return StorageOffset(ref _dummyStorage, ref _dummyStorage.InterruptState);
|
||||
}
|
||||
|
||||
public static int GetDispatchAddressOffset()
|
||||
|
|
|
@ -27,7 +27,7 @@ namespace ARMeilleure.Translation.PTC
|
|||
private const string OuterHeaderMagicString = "PTCohd\0\0";
|
||||
private const string InnerHeaderMagicString = "PTCihd\0\0";
|
||||
|
||||
private const uint InternalVersion = 4140; //! To be incremented manually for each change to the ARMeilleure project.
|
||||
private const int InternalVersion = 123; //! To be incremented manually for each change to the ARMeilleure project.
|
||||
|
||||
private const string ActualDir = "0";
|
||||
private const string BackupDir = "1";
|
||||
|
|
|
@ -432,24 +432,18 @@ namespace ARMeilleure.Translation
|
|||
|
||||
internal static void EmitSynchronization(EmitterContext context)
|
||||
{
|
||||
long countOffs = NativeContext.GetCounterOffset();
|
||||
long interruptedOffs = NativeContext.GetInterruptStateOffset();
|
||||
|
||||
Operand lblNonZero = Label();
|
||||
Operand interruptedAddr = context.Add(context.LoadArgument(OperandType.I64, 0), Const(interruptedOffs));
|
||||
Operand interrupted = context.Load(OperandType.I32, interruptedAddr);
|
||||
Operand lblExit = Label();
|
||||
|
||||
Operand countAddr = context.Add(context.LoadArgument(OperandType.I64, 0), Const(countOffs));
|
||||
Operand count = context.Load(OperandType.I32, countAddr);
|
||||
context.BranchIfTrue(lblNonZero, count, BasicBlockFrequency.Cold);
|
||||
context.BranchIfFalse(lblExit, interrupted, BasicBlockFrequency.Cold);
|
||||
|
||||
Operand running = context.Call(typeof(NativeInterface).GetMethod(nameof(NativeInterface.CheckSynchronization)));
|
||||
context.BranchIfTrue(lblExit, running, BasicBlockFrequency.Cold);
|
||||
|
||||
context.Return(Const(0L));
|
||||
|
||||
context.MarkLabel(lblNonZero);
|
||||
count = context.Subtract(count, Const(1));
|
||||
context.Store(countAddr, count);
|
||||
|
||||
context.MarkLabel(lblExit);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue