some reek assited coding on assembler
This commit is contained in:
parent
5cd05f6135
commit
e10fc3eedd
@ -51,7 +51,7 @@ module Elf
|
|||||||
ABI_SYSTEMV = 0
|
ABI_SYSTEMV = 0
|
||||||
ABI_ARM = 0x61
|
ABI_ARM = 0x61
|
||||||
|
|
||||||
ARM_INFLOOP = "\x08\xf0\x4f\xe2"
|
#ARM_INFLOOP = "\x08\xf0\x4f\xe2"
|
||||||
|
|
||||||
TARGET_ARM = [ELFCLASS32, Elf::DATA2LSB, ABI_ARM, EM_ARM]
|
TARGET_ARM = [ELFCLASS32, Elf::DATA2LSB, ABI_ARM, EM_ARM]
|
||||||
TARGET_X86 = [ELFCLASS32, Elf::DATA2LSB, ABI_SYSTEMV, EM_386]
|
TARGET_X86 = [ELFCLASS32, Elf::DATA2LSB, ABI_SYSTEMV, EM_386]
|
||||||
|
@ -32,12 +32,13 @@ module Register
|
|||||||
def asseble_code_from( at )
|
def asseble_code_from( at )
|
||||||
@machine.objects.each do |id , objekt|
|
@machine.objects.each do |id , objekt|
|
||||||
next unless objekt.is_a? Parfait::TypedMethod
|
next unless objekt.is_a? Parfait::TypedMethod
|
||||||
objekt.binary.position = at
|
binary = objekt.binary
|
||||||
|
binary.position = at
|
||||||
objekt.instructions.set_position at + 12 # BinaryCode header
|
objekt.instructions.set_position at + 12 # BinaryCode header
|
||||||
len = objekt.instructions.total_byte_length
|
len = objekt.instructions.total_byte_length
|
||||||
log.debug "CODE #{objekt.name} at #{objekt.binary.position} len: #{len}"
|
log.debug "CODE #{objekt.name} at #{binary.position} len: #{len}"
|
||||||
objekt.binary.set_length(len , 0)
|
binary.set_length(len , 0)
|
||||||
at += objekt.binary.padded_length
|
at += binary.padded_length
|
||||||
end
|
end
|
||||||
at
|
at
|
||||||
end
|
end
|
||||||
@ -141,9 +142,12 @@ module Register
|
|||||||
end
|
end
|
||||||
def write_binary_method_checks(method,stream)
|
def write_binary_method_checks(method,stream)
|
||||||
stream.rewind
|
stream.rewind
|
||||||
log.debug "Assembled code #{method.name} with length #{stream.length}"
|
length = stream.length
|
||||||
raise "length error #{method.binary.char_length} != #{method.instructions.total_byte_length}" if method.binary.char_length != method.instructions.total_byte_length
|
binary = method.binary
|
||||||
raise "length error #{stream.length} != #{method.instructions.total_byte_length}" if method.instructions.total_byte_length != stream.length
|
total_byte_length = method.instructions.total_byte_length
|
||||||
|
log.debug "Assembled code #{method.name} with length #{length}"
|
||||||
|
raise "length error #{binary.char_length} != #{total_byte_length}" if binary.char_length != total_byte_length
|
||||||
|
raise "length error #{length} != #{total_byte_length}" if total_byte_length != length
|
||||||
end
|
end
|
||||||
|
|
||||||
def write_any obj
|
def write_any obj
|
||||||
|
Loading…
Reference in New Issue
Block a user