mirror of
https://git.naxdy.org/Mirror/Ryujinx.git
synced 2025-03-14 22:40:18 +00:00
T16: Implement PUSH, POP
This commit is contained in:
parent
dabb5f2449
commit
34290d38e2
5 changed files with 50 additions and 3 deletions
|
@ -9,5 +9,7 @@ namespace ARMeilleure.Decoders
|
||||||
int PostOffset { get; }
|
int PostOffset { get; }
|
||||||
|
|
||||||
bool IsLoad { get; }
|
bool IsLoad { get; }
|
||||||
|
|
||||||
|
int Offset { get; }
|
||||||
}
|
}
|
||||||
}
|
}
|
41
ARMeilleure/Decoders/OpCodeT16MemStack.cs
Normal file
41
ARMeilleure/Decoders/OpCodeT16MemStack.cs
Normal file
|
@ -0,0 +1,41 @@
|
||||||
|
using ARMeilleure.Instructions;
|
||||||
|
using System;
|
||||||
|
using System.Numerics;
|
||||||
|
|
||||||
|
namespace ARMeilleure.Decoders
|
||||||
|
{
|
||||||
|
class OpCodeT16MemStack : OpCodeT16, IOpCode32MemMult
|
||||||
|
{
|
||||||
|
public int Rn => 13;
|
||||||
|
public int RegisterMask { get; }
|
||||||
|
public int PostOffset { get; }
|
||||||
|
public bool IsLoad { get; }
|
||||||
|
public int Offset { get; }
|
||||||
|
|
||||||
|
public new static OpCode Create(InstDescriptor inst, ulong address, int opCode, bool inITBlock) => new OpCodeT16MemStack(inst, address, opCode, inITBlock);
|
||||||
|
|
||||||
|
public OpCodeT16MemStack(InstDescriptor inst, ulong address, int opCode, bool inITBlock) : base(inst, address, opCode, inITBlock)
|
||||||
|
{
|
||||||
|
int extra = (opCode >> 8) & 1;
|
||||||
|
int regCount = BitOperations.PopCount((uint)opCode & 0x1ff);
|
||||||
|
|
||||||
|
switch (inst.Name)
|
||||||
|
{
|
||||||
|
case InstName.Push:
|
||||||
|
RegisterMask = (opCode & 0xff) | (extra << 14);
|
||||||
|
IsLoad = false;
|
||||||
|
Offset = -4 * regCount;
|
||||||
|
PostOffset = -4 * regCount;
|
||||||
|
break;
|
||||||
|
case InstName.Pop:
|
||||||
|
RegisterMask = (opCode & 0xff) | (extra << 15);
|
||||||
|
IsLoad = true;
|
||||||
|
Offset = 0;
|
||||||
|
PostOffset = 4 * regCount;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
throw new InvalidOperationException();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -1030,8 +1030,10 @@ namespace ARMeilleure.Decoders
|
||||||
SetT16("1011001010xxxxxx", InstName.Uxth, InstEmit32.Uxth, OpCodeT16AluUx.Create);
|
SetT16("1011001010xxxxxx", InstName.Uxth, InstEmit32.Uxth, OpCodeT16AluUx.Create);
|
||||||
SetT16("1011001011xxxxxx", InstName.Uxtb, InstEmit32.Uxtb, OpCodeT16AluUx.Create);
|
SetT16("1011001011xxxxxx", InstName.Uxtb, InstEmit32.Uxtb, OpCodeT16AluUx.Create);
|
||||||
SetT16("101100x1xxxxxxxx", InstName.Cbz, InstEmit32.Cbz, OpCodeT16BImmCmp.Create);
|
SetT16("101100x1xxxxxxxx", InstName.Cbz, InstEmit32.Cbz, OpCodeT16BImmCmp.Create);
|
||||||
|
SetT16("1011010xxxxxxxxx", InstName.Push, InstEmit32.Stm, OpCodeT16MemStack.Create);
|
||||||
SetT16("101110x1xxxxxxxx", InstName.Cbnz, InstEmit32.Cbnz, OpCodeT16BImmCmp.Create);
|
SetT16("101110x1xxxxxxxx", InstName.Cbnz, InstEmit32.Cbnz, OpCodeT16BImmCmp.Create);
|
||||||
#endregion
|
SetT16("1011110xxxxxxxxx", InstName.Pop, InstEmit32.Ldm, OpCodeT16MemStack.Create);
|
||||||
|
#endregion
|
||||||
|
|
||||||
FillFastLookupTable(InstA32FastLookup, AllInstA32, ToFastLookupIndexA);
|
FillFastLookupTable(InstA32FastLookup, AllInstA32, ToFastLookupIndexA);
|
||||||
FillFastLookupTable(InstT32FastLookup, AllInstT32, ToFastLookupIndexT);
|
FillFastLookupTable(InstT32FastLookup, AllInstT32, ToFastLookupIndexT);
|
||||||
|
|
|
@ -32,7 +32,7 @@ namespace ARMeilleure.Instructions
|
||||||
|
|
||||||
public static void Ldm(ArmEmitterContext context)
|
public static void Ldm(ArmEmitterContext context)
|
||||||
{
|
{
|
||||||
OpCode32MemMult op = (OpCode32MemMult)context.CurrOp;
|
IOpCode32MemMult op = (IOpCode32MemMult)context.CurrOp;
|
||||||
|
|
||||||
Operand n = GetIntA32(context, op.Rn);
|
Operand n = GetIntA32(context, op.Rn);
|
||||||
|
|
||||||
|
@ -95,7 +95,7 @@ namespace ARMeilleure.Instructions
|
||||||
|
|
||||||
public static void Stm(ArmEmitterContext context)
|
public static void Stm(ArmEmitterContext context)
|
||||||
{
|
{
|
||||||
OpCode32MemMult op = (OpCode32MemMult)context.CurrOp;
|
IOpCode32MemMult op = (IOpCode32MemMult)context.CurrOp;
|
||||||
|
|
||||||
Operand n = context.Copy(GetIntA32(context, op.Rn));
|
Operand n = context.Copy(GetIntA32(context, op.Rn));
|
||||||
|
|
||||||
|
|
|
@ -512,6 +512,8 @@ namespace ARMeilleure.Instructions
|
||||||
Mvn,
|
Mvn,
|
||||||
Pkh,
|
Pkh,
|
||||||
Pld,
|
Pld,
|
||||||
|
Pop,
|
||||||
|
Push,
|
||||||
Rev,
|
Rev,
|
||||||
Revsh,
|
Revsh,
|
||||||
Rsb,
|
Rsb,
|
||||||
|
|
Loading…
Reference in a new issue