Add .gitignore file for git.
[virt-mem.git] / lib / virt_mem_mmap.mli
index bdca7c5..0294efd 100644 (file)
 
     Mappings are stored in a segment tree for efficient access, but
     the segment tree has to be rebuilt from scratch each time you add
 
     Mappings are stored in a segment tree for efficient access, but
     the segment tree has to be rebuilt from scratch each time you add
-    a new mapping (it is not known if there is a more efficient way to
-    incrementally update a segment tree).
+    a new mapping.  It is not known if there is a more efficient way
+    to incrementally update a segment tree.  In any case, as long as
+    you are mainly doing lookups / searches / getting bytes, this is
+    very fast.
 *)
 
 (** {2 Types} *)
 *)
 
 (** {2 Types} *)
@@ -85,8 +87,14 @@ type ('ws,'e,'hm) t
     initializing certain parts of the memory map.  If you are not
     familiar with phantom types, you can just ignore them.
 
     initializing certain parts of the memory map.  If you are not
     familiar with phantom types, you can just ignore them.
 
-    See also:
-    [http://camltastic.blogspot.com/2008/05/phantom-types.html] *)
+    See also
+    {{:http://camltastic.blogspot.com/2008/05/phantom-types.html}this
+    posting about the phantom types used in virt-mem}.
+
+    The memory map structure is an example of a
+    {{:http://en.wikipedia.org/wiki/Purely_functional}persistent
+    data structure}.
+*)
 
 type addr = int64
 (** Virtual memory addresses (even on 32 bit machines). *)
 
 type addr = int64
 (** Virtual memory addresses (even on 32 bit machines). *)
@@ -131,7 +139,6 @@ val get_wordsize : ([`Wordsize], 'e, 'hm) t -> Virt_mem_utils.wordsize
 val get_endian : ('ws, [`Endian], 'hm) t -> Bitstring.endian
 (** Return the endianness previously set for this memory map. *)
 
 val get_endian : ('ws, [`Endian], 'hm) t -> Bitstring.endian
 (** Return the endianness previously set for this memory map. *)
 
-(*
 (** {2 Searching} *)
 
 val find : ('ws, 'e, [`HasMapping]) t -> ?start:addr -> string -> addr option
 (** {2 Searching} *)
 
 val find : ('ws, 'e, [`HasMapping]) t -> ?start:addr -> string -> addr option
@@ -171,7 +178,6 @@ val find_pointer_all : ([`Wordsize], [`Endian], [`HasMapping]) t ->
 (** Find all occurrences of a pointer in the memory map. *)
 
 (** {2 Get bytes and ranges of bytes} *)
 (** Find all occurrences of a pointer in the memory map. *)
 
 (** {2 Get bytes and ranges of bytes} *)
-*)
 
 val get_byte : ('ws, 'e, [`HasMapping]) t -> addr -> int
 (** Return the byte at the given address.
 
 val get_byte : ('ws, 'e, [`HasMapping]) t -> addr -> int
 (** Return the byte at the given address.
@@ -179,7 +185,6 @@ val get_byte : ('ws, 'e, [`HasMapping]) t -> addr -> int
     This will raise [Invalid_argument "get_byte"] if the address is
     a hole (not mapped). *)
 
     This will raise [Invalid_argument "get_byte"] if the address is
     a hole (not mapped). *)
 
-(*
 val get_bytes : ('ws, 'e, [`HasMapping]) t -> addr -> int -> string
 (** Return the sequence of bytes starting at the given address.
 
 val get_bytes : ('ws, 'e, [`HasMapping]) t -> addr -> int -> string
 (** Return the sequence of bytes starting at the given address.
 
@@ -216,9 +221,13 @@ val is_C_identifier : ('ws, 'e, [`HasMapping]) t -> addr -> bool
 (** Return true or false if the address contains a NUL-terminated
     C identifier. *)
 
 (** Return true or false if the address contains a NUL-terminated
     C identifier. *)
 
-val is_mapped : ('ws, 'e, [`HasMapping]) t -> addr -> bool
+val is_mapped : ('ws, 'e, 'hm) t -> addr -> bool
 (** Return true if the single address [addr] is mapped. *)
 
 (** Return true if the single address [addr] is mapped. *)
 
+val is_mapped_range : ('ws, 'e, 'hm) t -> addr -> int -> bool
+(** Return true if all addresses in the range [addr] to [addr+size-1]
+    are mapped. *)
+
 val follow_pointer : ([`Wordsize], [`Endian], [`HasMapping]) t -> addr -> addr
 (** Follow (dereference) the pointer at [addr] and return
     the address pointed to. *)
 val follow_pointer : ([`Wordsize], [`Endian], [`HasMapping]) t -> addr -> addr
 (** Follow (dereference) the pointer at [addr] and return
     the address pointed to. *)
@@ -242,4 +251,3 @@ val align : ([`Wordsize], 'e, [`HasMapping]) t -> addr -> addr
 (*val from_channel : in_channel -> ('?, '?, [`HasMapping]) t*)
 (** Read a previously saved memory map.  If the input channel does
     not contain a memory map, this raises [Invalid_argument]. *)
 (*val from_channel : in_channel -> ('?, '?, [`HasMapping]) t*)
 (** Read a previously saved memory map.  If the input channel does
     not contain a memory map, this raises [Invalid_argument]. *)
-*)