2018-05-12 17:32:10 +02:00
|
|
|
module Risc
|
|
|
|
# A platform is (or will be) something like the linux tripple
|
|
|
|
#
|
|
|
|
# Currently it just provides a Translator and binary start point
|
|
|
|
#
|
|
|
|
class Platform
|
|
|
|
|
|
|
|
# return the translator instance that traslates risc intructions into
|
|
|
|
# platform specific ones
|
|
|
|
def translator
|
|
|
|
end
|
|
|
|
|
|
|
|
# return an integer where the binary is loaded
|
|
|
|
def loaded_at
|
|
|
|
end
|
|
|
|
# Factory method to create a Platform object according to the platform
|
|
|
|
# string given.
|
2018-05-17 08:31:36 +02:00
|
|
|
# Currently only "Arm" and "Interpreter"
|
2018-05-12 17:32:10 +02:00
|
|
|
def self.for( name )
|
|
|
|
case name
|
|
|
|
when "Arm"
|
|
|
|
return Arm::ArmPlatform.new
|
2018-05-17 08:31:36 +02:00
|
|
|
when "Interpreter"
|
|
|
|
return Risc::InterpreterPlatform.new
|
2018-05-12 17:32:10 +02:00
|
|
|
else
|
|
|
|
raise "not recignized platform #{name}"
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
2018-05-17 08:31:36 +02:00
|
|
|
require_relative "interpreter_platform"
|