fix calling to binaries

used to be to the method, but we assemble the method to its own
position.
Throw in a test for binary calling
This commit is contained in:
Torsten Ruger
2018-03-28 13:00:03 +03:00
parent 7493d738e1
commit 606e3f8cb3
3 changed files with 11 additions and 5 deletions

View File

@ -15,6 +15,14 @@ module Arm
code = @machine.call( -4 ,{} )#this jumps to the next instruction
assert_code code , :call, [0xff,0xff,0xff,0xeb] #ea ff ff fe
end
def test_method_call
Risc.machine.boot
bin = Parfait::BinaryCode.new(1)
Positioned.set_position(bin , 0x20)
code = @machine.call( bin ,{} )#this jumps to the next instruction
Positioned.set_position(code , 0)
assert_code code , :call, [0x08,0x0,0x0,0xeb]
end
def test_swi
code = @machine.swi( 0x05 )
assert_code code , :swi , [0x05,0x00,0x00,0xef]#ef 00 00 05