From 59188105baf11b1c81851c53b9f9e20ecca0581e Mon Sep 17 00:00:00 2001 From: Torsten Ruger Date: Wed, 24 Jun 2015 16:07:27 +0300 Subject: [PATCH] finish syscall works, even had to fix parfait bug to see --- lib/arm/arm_machine.rb | 1 + lib/arm/passes/syscall_implementation.rb | 11 ++++++----- lib/parfait/space.rb | 1 + 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/lib/arm/arm_machine.rb b/lib/arm/arm_machine.rb index 55dc5a53..e24fdb97 100644 --- a/lib/arm/arm_machine.rb +++ b/lib/arm/arm_machine.rb @@ -112,6 +112,7 @@ module Arm end Arm::ArmMachine.init require_relative "passes/call_implementation" +require_relative "passes/syscall_implementation" require_relative "passes/save_implementation" require_relative "passes/transfer_implementation" require_relative "passes/get_implementation" diff --git a/lib/arm/passes/syscall_implementation.rb b/lib/arm/passes/syscall_implementation.rb index 854af86c..1bdbb3d3 100644 --- a/lib/arm/passes/syscall_implementation.rb +++ b/lib/arm/passes/syscall_implementation.rb @@ -4,13 +4,14 @@ module Arm def run block block.codes.dup.each do |code| next unless code.is_a? Register::Syscall - new_codes = [] - load = ArmMachine.ldr( :r1 , code.constant ) - - store = ArmMachine.str( code.register , code.array , code.index ) + 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::SetImplementation" + Virtual.machine.add_pass "Arm::SyscallImplementation" end diff --git a/lib/parfait/space.rb b/lib/parfait/space.rb index a7e4bbc6..dd140b05 100644 --- a/lib/parfait/space.rb +++ b/lib/parfait/space.rb @@ -27,6 +27,7 @@ module Parfait super() Parfait::Space.set_object_space self @classes = Parfait::Dictionary.new_object + @syscall_message = nil # a hack sto store the message during syscall end attr_reader :classes , :frames, :messages, :next_message , :next_frame