package mirage-xen

  1. Overview
  2. Docs

Module Xen.ImportSource

Sourcetype t = {
  1. domid : int;
    (*

    foreign domain who is exporting memory

    *)
  2. 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.

Sourcemodule Local_mapping : sig ... end
Sourceval 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.

Sourceval map : t -> writable:bool -> (Local_mapping.t, [> `Msg of string ]) result

Like the above but wraps the result in a result type instead of raising an exception.

Sourceval 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.

Sourceval mapv : t list -> writable:bool -> (Local_mapping.t, [> `Msg of string ]) result

Like the above but wraps the result in a result type instead of raising an exception.

Sourceval with_mapping : t -> writable:bool -> (Local_mapping.t -> 'a Lwt.t) -> ('a, [> `Msg of string ]) 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.

OCaml

Innovation. Community. Security.