2014-08-26 11:05:49 +02:00
|
|
|
module Register
|
|
|
|
class ReturnImplementation
|
|
|
|
def run block
|
|
|
|
block.codes.dup.each do |code|
|
|
|
|
next unless code.is_a? Virtual::MethodReturn
|
2014-09-11 18:00:14 +02:00
|
|
|
#load the return address into pc, affecting return. (other cpus have commands for this, but not arm)
|
|
|
|
message = RegisterReference.new(:r0)
|
2014-08-26 15:12:20 +02:00
|
|
|
pc = RegisterReference.new(:pc)
|
2014-09-11 20:30:40 +02:00
|
|
|
move1 = RegisterMachine.instance.ldr( pc ,message , Virtual::Slot::RETURN )
|
2014-09-11 18:00:14 +02:00
|
|
|
block.replace(code , [move1] )
|
2014-08-26 11:05:49 +02:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
Virtual::BootSpace.space.add_pass_after ReturnImplementation , CallImplementation
|
|
|
|
end
|