module Machery

Constants

PAGE_SIZE
VERSION

Public Class Methods

page_align_up( address ) click to toggle source
# File lib/machery/vm_methods.rb, line 60
def self.page_align_up( address )
  (((address)+((PAGE_SIZE)-1))&(~((PAGE_SIZE)-1)));
end
page_down( address ) click to toggle source
# File lib/machery/vm_methods.rb, line 56
def self.page_down( address )
  ((address)&(~((PAGE_SIZE)-1)))
end
read( pid, address, len ) click to toggle source
# File lib/machery/vm_methods.rb, line 42
def self.read( pid, address, len )
  bottom     = page_down( address )
  top        = page_align_up(address + len)
  new_length = top - bottom

  byte_ptr   = c_mach_vm_read(pid, bottom, new_length)
  
  return nil if byte_ptr.null?
  
  ret = byte_ptr.read_string(new_length)[address - bottom..-1]
  free(byte_ptr)
  ret
end