59188105ba
works, even had to fix parfait bug to see
18 lines
561 B
Ruby
18 lines
561 B
Ruby
module Arm
|
|
|
|
class SyscallImplementation
|
|
def run block
|
|
block.codes.dup.each do |code|
|
|
next unless code.is_a? Register::Syscall
|
|
raise "uups" unless code.name == :putstring
|
|
new_codes = [ ArmMachine.mov( :r1 , 20 ) ]
|
|
new_codes << ArmMachine.ldr( :r0 , Virtual::Slot::MESSAGE_REGISTER, Virtual::SELF_INDEX)
|
|
new_codes << ArmMachine.mov( :r7 , 4 )
|
|
new_codes << ArmMachine.swi( 0 )
|
|
block.replace(code , new_codes )
|
|
end
|
|
end
|
|
end
|
|
Virtual.machine.add_pass "Arm::SyscallImplementation"
|
|
end
|