diff --git a/Cpp2IL.Core/InstructionSets/NewArmV8InstructionSet.cs b/Cpp2IL.Core/InstructionSets/NewArmV8InstructionSet.cs index 6ff0e2da..03b9b072 100644 --- a/Cpp2IL.Core/InstructionSets/NewArmV8InstructionSet.cs +++ b/Cpp2IL.Core/InstructionSets/NewArmV8InstructionSet.cs @@ -73,22 +73,18 @@ private void ConvertInstructionStatement(Arm64Instruction instruction, IsilBuild var operate= ConvertOperand(instruction, 1); if (operate.Data is IsilMemoryOperand operand) { - var register= operand.Base.Value; + var register= operand.Base!.Value; // X19= X19, #0x30 - builder.Move(instruction.Address,register,operate); - //X8 = X19 - builder.Move(instruction.Address,ConvertOperand(instruction,0),register); - } - else - { - // use default - builder.Move(instruction.Address, ConvertOperand(instruction, 0), operate); + builder.Add(instruction.Address,register,register, InstructionSetIndependentOperand.MakeImmediate(operand.Addend)); + //X8 = [X19] + builder.Move(instruction.Address,ConvertOperand(instruction,0),InstructionSetIndependentOperand.MakeMemory(new IsilMemoryOperand( + InstructionSetIndependentOperand.MakeRegister(register.ToString()!.ToUpperInvariant()), + 0))); + break; } + } - else - { - builder.Move(instruction.Address, ConvertOperand(instruction, 0), ConvertOperand(instruction, 1)); - } + builder.Move(instruction.Address, ConvertOperand(instruction, 0), ConvertOperand(instruction, 1)); break; case Arm64Mnemonic.MOVN: { @@ -350,7 +346,7 @@ private InstructionSetIndependentOperand ConvertOperand(Arm64Instruction instruc if(reg == Arm64Register.INVALID) //Offset only return InstructionSetIndependentOperand.MakeMemory(new IsilMemoryOperand(offset)); - + //TODO Handle more stuff here return InstructionSetIndependentOperand.MakeMemory(new IsilMemoryOperand( InstructionSetIndependentOperand.MakeRegister(reg.ToString().ToUpperInvariant()),