fix operator register usage
which makes inter math work surprise!
This commit is contained in:
parent
bc558d1f0d
commit
7572e27869
3
.gdbinit
Normal file
3
.gdbinit
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
set disassemble-next-line on
|
||||||
|
file a.out
|
||||||
|
break *0x10054
|
@ -72,7 +72,7 @@ module Arm
|
|||||||
codes << ArmMachine.mov( :pc , code.register)
|
codes << ArmMachine.mov( :pc , code.register)
|
||||||
codes
|
codes
|
||||||
end
|
end
|
||||||
|
|
||||||
def translate_DynamicJump(code)
|
def translate_DynamicJump(code)
|
||||||
index = Parfait.object_space.get_type_by_class_name(:CallableMethod).variable_index(:binary)
|
index = Parfait.object_space.get_type_by_class_name(:CallableMethod).variable_index(:binary)
|
||||||
codes = ArmMachine.ldr( code.register , code.register , arm_index(index) )
|
codes = ArmMachine.ldr( code.register , code.register , arm_index(index) )
|
||||||
@ -93,21 +93,22 @@ module Arm
|
|||||||
def translate_OperatorInstruction( code )
|
def translate_OperatorInstruction( code )
|
||||||
left = code.left
|
left = code.left
|
||||||
right = code.right
|
right = code.right
|
||||||
|
result = code.result
|
||||||
case code.operator.to_s
|
case code.operator.to_s
|
||||||
when "+"
|
when "+"
|
||||||
c = ArmMachine.add(left , left , right)
|
c = ArmMachine.add(result , left , right)
|
||||||
when "-"
|
when "-"
|
||||||
c = ArmMachine.sub(left , left , right)
|
c = ArmMachine.sub(result , left , right)
|
||||||
when "&"
|
when "&"
|
||||||
c = ArmMachine.and(left , left , right)
|
c = ArmMachine.and(result , left , right)
|
||||||
when "|"
|
when "|"
|
||||||
c = ArmMachine.orr(left , left , right)
|
c = ArmMachine.orr(result , left , right)
|
||||||
when "*"
|
when "*"
|
||||||
c = ArmMachine.mul(left , right , left) #arm rule about left not being result, lukily commutative
|
c = ArmMachine.mul(result , right , left) #arm rule about left not being result, lukily commutative
|
||||||
when ">>"
|
when ">>"
|
||||||
c = ArmMachine.mov(left , left , :shift_asr => right) #arm rule about left not being result, lukily commutative
|
c = ArmMachine.mov(result , left , :shift_asr => right) #arm rule about left not being result, lukily commutative
|
||||||
when "<<"
|
when "<<"
|
||||||
c = ArmMachine.mov(left , left , :shift_lsl => right) #arm rule about left not being result, lukily commutative
|
c = ArmMachine.mov(result , left , :shift_lsl => right) #arm rule about left not being result, lukily commutative
|
||||||
else
|
else
|
||||||
raise "unimplemented '#{code.operator}' #{code}"
|
raise "unimplemented '#{code.operator}' #{code}"
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user