package mirage-xen
-
mirage-xen
Legend:
Library
Module
Module type
Parameter
Class
Class type
Library
Module
Module type
Parameter
Class
Class type
type t = {
domid : int;
foreign domain who is exporting memory
*)ref : Gntref.t;
id which identifies the specific export in the foreign domain
*)}
A foreign domain must explicitly "grant" us memory and send us the "reference". The pair of (foreign domain id, reference) uniquely identifies the block of memory. This pair ("grant") is transmitted to us out-of-band, usually either via xenstore during device setup or via a shared memory ring structure.
module Local_mapping : sig ... end
val map_exn : t -> writable:bool -> Local_mapping.t
map_exn grant ~writable
creates a single mapping from grant
that will be writable if writable
is true
.
val map :
t ->
writable:bool ->
(Local_mapping.t, [> `Msg of string ]) Stdlib.result
Like the above but wraps the result in a result
type instead of raising an exception.
val mapv_exn : t list -> writable:bool -> Local_mapping.t
mapv_exn grants ~writable
creates a single contiguous mapping from a list of grants that will be writable if writable
is true
. Note the grant list can involve grants from multiple domains. If the mapping fails (because at least one grant fails to be mapped), then all grants are unmapped.
val mapv :
t list ->
writable:bool ->
(Local_mapping.t, [> `Msg of string ]) Stdlib.result
Like the above but wraps the result in a result
type instead of raising an exception.
val with_mapping :
t ->
writable:bool ->
(Local_mapping.t -> 'a Lwt.t) ->
('a, [> `Msg of string ]) Stdlib.result Lwt.t
with_mapping grant ~writable f
maps grant
, calls f
on the result, and then unmaps it. Returns Error _
if the map
operation fails.