introduce platform to abstract cpu and load address

This commit is contained in:
Torsten Ruger
2018-05-12 18:32:10 +03:00
parent 776a97986d
commit 232fe67c09
5 changed files with 69 additions and 1 deletions

28
lib/risc/platform.rb Normal file
View File

@ -0,0 +1,28 @@
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.
# Currently only "Arm"
def self.for( name )
case name
when "Arm"
return Arm::ArmPlatform.new
else
raise "not recignized platform #{name}"
end
end
end
end