Class: Ragweed::Wraposx::RegionBasicInfo

Inherits:
RegionInfo show all
Defined in:
lib/ragweed/wraposx/region_info.rb

Constant Summary collapse

FLAVOR =
Ragweed::Wraposx::Vm::REGION_BASIC_INFO

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from RegionInfo

#get, #initialize, #inspect, #refresh, #to_s

Constructor Details

This class inherits a constructor from Ragweed::Wraposx::RegionInfo

Class Method Details

.get(t, a) ⇒ Object



141
142
143
# File 'lib/ragweed/wraposx/region_info.rb', line 141

def self.get(t, a)
  self.new(Ragweed::Wraposx::vm_region_raw(t, a, FLAVOR))
end

Instance Method Details

#dump(&block) ⇒ Object



121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
# File 'lib/ragweed/wraposx/region_info.rb', line 121

def dump(&block)
  maybe_hex = lambda {|a| begin; "\n" + (" " * 9) + block.call(a, 16).hexdump(true)[10..-2]; rescue; ""; end }      
  maybe_dis = lambda {|a| begin; "\n" + block.call(a, 16).distorm.map {|i| "         " + i.mnem}.join("\n"); rescue; ""; end }

  string =<<EOM
  -----------------------------------------------------------------------
  INFO:
  protection:       #{self.protection.to_s(2).rjust(8, "0")} #{Ragweed::Wraposx::Vm::Pflags.flag_dump(self.protection)}
  max_protection:   #{self.max_protection.to_s(2).rjust(8, "0")} #{Ragweed::Wraposx::Vm::Pflags.flag_dump(self.max_protection)}
  inheritance:      #{self.inheritance.to_s(16).rjust(8, "0")} #{maybe_hex.call(self.inheritance)}
  shared:           #{self.shared.to_s(16).rjust(8, "0")} #{maybe_hex.call(self.shared)}
  reserved:         #{self.reserved.to_s(16).rjust(8, "0")} #{maybe_hex.call(self.reserved)}
  offset:           #{self.offset.to_s(16).rjust(8, "0")} #{maybe_hex.call(self.offset)}
  behavior:         #{self.behavior.to_s(16).rjust(8, "0")} #{maybe_hex.call(self.behavior)}
  user_wired_count: #{self.user_wired_count.to_s(16).rjust(8, "0")} #{maybe_hex.call(self.user_wired_count)}
  address:          #{self.address.to_s(16).rjust(8, "0")} #{maybe_hex.call(self.address)}
  size:             #{self.size.to_s(16).rjust(8, "0")} #{maybe_hex.call(self.size)}
EOM
end