fix binary code offset when calling

in other words, remember the arm pipeline being 8
This commit is contained in:
Torsten Ruger 2018-05-29 17:03:20 +03:00
parent 4b34546c11
commit b81d9565de
3 changed files with 3 additions and 3 deletions

View File

@ -52,7 +52,7 @@ module Arm
# But, for methods, this happens to be the size of the object header, # But, for methods, this happens to be the size of the object header,
# so there it balances out, but not blocks # so there it balances out, but not blocks
# have to use the code, not the method object for methods # have to use the code, not the method object for methods
arg = Risc::Position.get(@first) - Risc::Position.get(self) + 4 arg = Risc::Position.get(@first) - Risc::Position.get(self)
else else
arg = @first arg = @first
end end

View File

@ -22,7 +22,7 @@ module Arm
Risc::Position.set(@binary , 0) Risc::Position.set(@binary , 0)
code = @machine.call( bin ,{} )#this jumps to the next instruction code = @machine.call( bin ,{} )#this jumps to the next instruction
Risc::Position.set(code , 0, @binary) Risc::Position.set(code , 0, @binary)
assert_code code , :call, [0x09,0x0,0x0,0xeb] assert_code code , :call, [0x08,0x0,0x0,0xeb]
end end
def test_swi def test_swi
code = @machine.swi( 0x05 ) code = @machine.swi( 0x05 )

View File

@ -12,7 +12,7 @@ class HelloTest < MiniTest::Test
end end
def test_string_put def test_string_put
@input = "'Hello'.putstring" @input = "return 'Hello'.putstring"
check check
end end
end end