fixed that darn method address bug
This commit is contained in:
parent
9541712af8
commit
047c77e186
@ -44,7 +44,6 @@ module Arm
|
|||||||
# so there it balances out, but not blocks
|
# so there it balances out, but not blocks
|
||||||
# have to use the code, not the mthod object for methods
|
# have to use the code, not the mthod object for methods
|
||||||
diff = arg.code.position - self.position
|
diff = arg.code.position - self.position
|
||||||
diff -= 4 if diff > 0 # hmm, stil having troubles with this one. but it works :-)
|
|
||||||
end
|
end
|
||||||
arg = diff
|
arg = diff
|
||||||
end
|
end
|
||||||
|
@ -48,6 +48,7 @@ module Arm
|
|||||||
#TODO this is copied from MoveInstruction, should rework
|
#TODO this is copied from MoveInstruction, should rework
|
||||||
unless @extra
|
unless @extra
|
||||||
@extra = 1
|
@extra = 1
|
||||||
|
puts "RELINK L at #{self.position.to_s(16)}"
|
||||||
raise ::Register::LinkException.new("cannot fit numeric literal argument in operand #{right.inspect}")
|
raise ::Register::LinkException.new("cannot fit numeric literal argument in operand #{right.inspect}")
|
||||||
end
|
end
|
||||||
# now we can do the actual breaking of instruction, by splitting the operand
|
# now we can do the actual breaking of instruction, by splitting the operand
|
||||||
@ -87,7 +88,7 @@ module Arm
|
|||||||
val << by
|
val << by
|
||||||
end
|
end
|
||||||
|
|
||||||
def word_length
|
def byte_length
|
||||||
@extra ? 8 : 4
|
@extra ? 8 : 4
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -18,9 +18,6 @@ module Arm
|
|||||||
@immediate = 0
|
@immediate = 0
|
||||||
@rn = :r0 # register zero = zero bit pattern
|
@rn = :r0 # register zero = zero bit pattern
|
||||||
@extra = nil
|
@extra = nil
|
||||||
if @rn.is_a?(Numeric) and !@rn.fits_u8? and !calculate_u8_with_rr(@rn)
|
|
||||||
@extra = 1
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
attr_accessor :to , :from
|
attr_accessor :to , :from
|
||||||
|
|
||||||
@ -31,7 +28,7 @@ module Arm
|
|||||||
# alas, full transparency is not achieved as we only know when to use 2 instruction once we
|
# alas, full transparency is not achieved as we only know when to use 2 instruction once we
|
||||||
# know where the other object is, and that position is only set after code positions have been
|
# know where the other object is, and that position is only set after code positions have been
|
||||||
# determined (in link) and so see below in assemble
|
# determined (in link) and so see below in assemble
|
||||||
def word_length
|
def byte_length
|
||||||
@extra ? 8 : 4
|
@extra ? 8 : 4
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -65,6 +62,7 @@ module Arm
|
|||||||
# then on subsequent assemblies we can assemble
|
# then on subsequent assemblies we can assemble
|
||||||
unless @extra
|
unless @extra
|
||||||
@extra = 1
|
@extra = 1
|
||||||
|
puts "RELINK M at #{self.position.to_s(16)}"
|
||||||
raise ::Register::LinkException.new("cannot fit numeric literal argument in operand #{right.inspect}")
|
raise ::Register::LinkException.new("cannot fit numeric literal argument in operand #{right.inspect}")
|
||||||
end
|
end
|
||||||
# now we can do the actual breaking of instruction, by splitting the operand
|
# now we can do the actual breaking of instruction, by splitting the operand
|
||||||
|
@ -60,7 +60,6 @@ module Register
|
|||||||
begin
|
begin
|
||||||
return try_write
|
return try_write
|
||||||
rescue LinkException
|
rescue LinkException
|
||||||
puts "RELINK"
|
|
||||||
# knowing that we fix the problem, we hope to get away with retry.
|
# knowing that we fix the problem, we hope to get away with retry.
|
||||||
return try_write
|
return try_write
|
||||||
end
|
end
|
||||||
@ -123,7 +122,7 @@ module Register
|
|||||||
stream.rewind
|
stream.rewind
|
||||||
#puts "Assembled #{method.name} with length #{stream.length}"
|
#puts "Assembled #{method.name} with length #{stream.length}"
|
||||||
raise "length error #{method.code.length} != #{method.info.byte_length}" if method.code.length != method.info.byte_length
|
raise "length error #{method.code.length} != #{method.info.byte_length}" if method.code.length != method.info.byte_length
|
||||||
raise "length error #{stream.length} != #{method.info.byte_length}" if method.info.byte_length - stream.length > 6
|
raise "length error #{stream.length} != #{method.info.byte_length}" if method.info.byte_length != stream.length
|
||||||
stream.each_byte do |b|
|
stream.each_byte do |b|
|
||||||
method.code.set_char(index , b )
|
method.code.set_char(index , b )
|
||||||
index = index + 1
|
index = index + 1
|
||||||
|
@ -137,7 +137,7 @@ module Virtual
|
|||||||
end
|
end
|
||||||
|
|
||||||
def byte_length
|
def byte_length
|
||||||
@blocks.inject(0) { |c , block| c += block.byte_length } + 4
|
@blocks.inject(0) { |c , block| c += block.byte_length }
|
||||||
end
|
end
|
||||||
|
|
||||||
# position of the function is the position of the entry block, is where we call
|
# position of the function is the position of the entry block, is where we call
|
||||||
|
Loading…
x
Reference in New Issue
Block a user