X-Git-Url: http://git.annexia.org/?a=blobdiff_plain;ds=sidebyside;f=lib%2Fvirt_mem_mmap.mli;h=0ed9176ea848bb9e3806cb1d5361b3c7368defef;hb=ad6a4e6f2d447878cd42a6aca37aa3b696106c78;hp=06de86aec183fdb2199493b51a2d0eaea16cfcc5;hpb=5ce06c3326a2672e82dc656b35eb7a3e6616539a;p=virt-mem.git diff --git a/lib/virt_mem_mmap.mli b/lib/virt_mem_mmap.mli index 06de86a..0ed9176 100644 --- a/lib/virt_mem_mmap.mli +++ b/lib/virt_mem_mmap.mli @@ -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 @@ -105,6 +124,9 @@ val is_C_identifier : ('a, 'b) t -> addr -> bool (** Return true or false if the address contains a NUL-terminated C identifier. *) +val is_mapped : ('a, 'b) t -> addr -> bool +(** Return true if the single address [addr] is mapped. *) + val follow_pointer : ([`Wordsize], [`Endian]) t -> addr -> addr (** Follow (dereference) the pointer at [addr] and return the address pointed to. *) @@ -114,3 +136,7 @@ val succ_long : ([`Wordsize], 'b) t -> addr -> addr val pred_long : ([`Wordsize], 'b) t -> addr -> addr (** Subtract wordsize bytes from [addr] and return it. *) + +val align : ([`Wordsize], 'b) t -> addr -> addr +(** Align the [addr] to the next wordsize boundary. If it already + aligned, this just returns [addr]. *)