X-Git-Url: http://git.annexia.org/?p=virt-mem.git;a=blobdiff_plain;f=lib%2Fvirt_mem_mmap.mli;h=594f0cfa81826cf5988f7e77cf96713e3576be89;hp=68c7b2f7529da4bb40f52d7810f3001a7190bfd8;hb=e3b79ee907537feec9274b1bfab7e450fc97dbcf;hpb=46037cd89c23b0f94dc691006ee1d9cd0fec24f0;ds=sidebyside diff --git a/lib/virt_mem_mmap.mli b/lib/virt_mem_mmap.mli index 68c7b2f..594f0cf 100644 --- a/lib/virt_mem_mmap.mli +++ b/lib/virt_mem_mmap.mli @@ -34,7 +34,7 @@ val set_wordsize : ([`NoWordsize], 'b) t -> Virt_mem_utils.wordsize -> (** Set the natural wordsize of the memory map. This is used for matching pointers within the map and can be set only once. *) -val set_endian : ('a, [`NoEndian]) t -> Bitmatch.endian -> +val set_endian : ('a, [`NoEndian]) t -> Bitstring.endian -> ('a, [`Endian]) t (** Set the natural endianness of the memory map. This is used for matching pointers within the map and can be set only once. *) @@ -42,7 +42,7 @@ val set_endian : ('a, [`NoEndian]) t -> Bitmatch.endian -> val get_wordsize : ([`Wordsize], 'b) t -> Virt_mem_utils.wordsize (** Return the wordsize previously set for this memory map. *) -val get_endian : ('a, [`Endian]) t -> Bitmatch.endian +val get_endian : ('a, [`Endian]) t -> Bitstring.endian (** Return the endianness previously set for this memory map. *) val of_file : Unix.file_descr -> addr -> ([`NoWordsize], [`NoEndian]) t @@ -52,6 +52,13 @@ val add_file : ('a, 'b) t -> Unix.file_descr -> addr -> ('a, 'b) t (** Add file [fd] at address [addr] to an existing memory map. Behaviour is undefined if memory mappings overlap. *) +val of_string : string -> addr -> ([`NoWordsize], [`NoEndian]) t +(** Create a new memory map, mapping string at address [addr]. *) + +val add_string : ('a, 'b) t -> string -> addr -> ('a, 'b) t +(** Add string at address [addr] to an existing memory map. + Behaviour is undefined if memory mappings overlap. *) + val find : ('a, 'b) t -> ?start:addr -> string -> addr option (** Find string in a memory map and return its address (if found). You can pass an optional starting address. Any holes in @@ -87,6 +94,18 @@ val get_bytes : ('a, 'b) t -> addr -> int -> string This may raise [Invalid_argument "get_bytes"] if the address range is not fully mapped. *) +val get_int32 : ('a, [`Endian]) t -> addr -> int32 +(** Return the 32-bit int at [addr]. *) + +val get_int64 : ('a, [`Endian]) t -> addr -> int64 +(** Return the 64-bit int at [addr]. *) + +val get_C_int : ([`Wordsize], [`Endian]) t -> addr -> int32 +(** Return the C 32-bit int at [addr]. *) + +val get_C_long : ([`Wordsize], [`Endian]) t -> addr -> int64 +(** Return the C 32 or 64-bit long at [addr]. *) + val get_string : ('a, 'b) t -> addr -> string (** Return the sequence of bytes starting at [addr] up to (but not including) the first ASCII NUL character. In other words, this