[Android] Add LoadArmRegPointerByteToArmReg

This commit is contained in:
zilmar 2016-10-01 07:20:51 +10:00
parent bf56f9f626
commit 46a724d9b7
2 changed files with 31 additions and 0 deletions

View File

@ -302,6 +302,36 @@ void CArmOps::CompareArmRegToArmReg(ArmReg Reg1, ArmReg Reg2)
AddCode16(op.Hex);
}
void CArmOps::LoadArmRegPointerByteToArmReg(ArmReg DestReg, ArmReg RegPointer, ArmReg RegPointer2, uint8_t shift)
{
if ((DestReg > 0x7 || RegPointer > 0x7 || RegPointer2 > 0x7) && (shift & ~3) == 0)
{
CPU_Message(" ldrb\t%s, [%s,%s]", ArmRegName(DestReg), ArmRegName(RegPointer), ArmRegName(RegPointer2));
Arm32Opcode op = {0};
op.uint16.rn = RegPointer;
op.uint16.opcode = 0xF81;
op.uint16.rm = RegPointer2;
op.uint16.imm2 = (shift & 3);
op.uint16.reserved = 0;
op.uint16.rt = DestReg;
AddCode32(op.Hex);
}
else if (shift == 0 && DestReg <= 0x7 && RegPointer <= 0x7 && RegPointer2 <= 0x7)
{
CPU_Message(" ldrb\t%s, [%s,%s]", ArmRegName(DestReg), ArmRegName(RegPointer), ArmRegName(RegPointer2));
ArmThumbOpcode op = {0};
op.Reg.rm = RegPointer2;
op.Reg.rt = DestReg;
op.Reg.rn = RegPointer;
op.Reg.opcode = 0x2E;
AddCode16(op.Hex);
}
else
{
g_Notify->BreakPoint(__FILE__,__LINE__);
}
}
void CArmOps::LoadArmRegPointerToArmReg(ArmReg DestReg, ArmReg RegPointer, uint8_t Offset)
{
if (DestReg > 0x7 || RegPointer > 0x7 || (Offset & (~0x7C)) != 0)

View File

@ -146,6 +146,7 @@ protected:
static void CallFunction(void * Function, const char * FunctionName);
static void CompareArmRegToConst(ArmReg Reg, uint32_t value);
static void CompareArmRegToArmReg(ArmReg Reg1, ArmReg Reg2);
static void LoadArmRegPointerByteToArmReg(ArmReg DestReg, ArmReg RegPointer, ArmReg RegPointer2, uint8_t shift);
static void LoadArmRegPointerToArmReg(ArmReg DestReg, ArmReg RegPointer, uint8_t Offset);
static void MoveArmRegArmReg(ArmReg DestReg, ArmReg SourceReg);
static void MoveConstToArmReg(ArmReg DestReg, uint16_t Const, const char * comment = NULL);