diff --git a/.travis.yml b/.travis.yml index a6def00..9e8e0a0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,8 +9,8 @@ env: - PINS="mirage-console:. mirage-console-xen:. mirage-console-unix:. mirage-console-xen-proto:. mirage-console-xen-backend:." - DISTRO=alpine matrix: - - OCAML_VERSION=4.06 PACKAGE="mirage-console" - - OCAML_VERSION=4.07 PACKAGE="mirage-console-xen-proto" - - OCAML_VERSION=4.07 PACKAGE="mirage-console-xen-backend" - - OCAML_VERSION=4.08 PACKAGE="mirage-console-xen" - - OCAML_VERSION=4.09 PACKAGE="mirage-console-unix" + - OCAML_VERSION=4.10 PACKAGE="mirage-console-unix" + - OCAML_VERSION=4.10 PACKAGE="mirage-console-xen" + - OCAML_VERSION=4.09 PACKAGE="mirage-console-xen-proto" + - OCAML_VERSION=4.09 PACKAGE="mirage-console-xen-backend" + - OCAML_VERSION=4.08 PACKAGE="mirage-console" diff --git a/mirage-console-unix.opam b/mirage-console-unix.opam index 9a7fdc5..3604fa6 100644 --- a/mirage-console-unix.opam +++ b/mirage-console-unix.opam @@ -7,7 +7,7 @@ homepage: "https://github.com/mirage/mirage-console" doc: "https://mirage.github.io/mirage-console/" bug-reports: "https://github.com/mirage/mirage-console/issues" depends: [ - "ocaml" {>= "4.06.0"} + "ocaml" {>= "4.08.0"} "dune" {>= "1.0"} "lwt" {>= "4.0.0"} "cstruct" {>= "4.0.0"} diff --git a/mirage-console-xen-backend.opam b/mirage-console-xen-backend.opam index fd4f1b1..c6a72e8 100644 --- a/mirage-console-xen-backend.opam +++ b/mirage-console-xen-backend.opam @@ -7,15 +7,14 @@ homepage: "https://github.com/mirage/mirage-console" doc: "https://mirage.github.io/mirage-console/" bug-reports: "https://github.com/mirage/mirage-console/issues" depends: [ - "ocaml" {>= "4.06.0"} + "ocaml" {>= "4.08.0"} "dune" {>= "1.0"} "mirage-console" {=version} "mirage-console-xen-proto" {=version} - "mirage-xen" {>= "5.0.0"} + "mirage-xen" {>= "6.0.0"} + "io-page" {>= "2.0.0"} "lwt" {>= "4.0.0"} - "io-page-xen" {>= "2.0.0"} "xenstore" - "xen-evtchn" "shared-memory-ring-lwt" ] build: [ diff --git a/mirage-console-xen-proto.opam b/mirage-console-xen-proto.opam index d394493..f9c1ae3 100644 --- a/mirage-console-xen-proto.opam +++ b/mirage-console-xen-proto.opam @@ -7,7 +7,7 @@ homepage: "https://github.com/mirage/mirage-console" doc: "https://mirage.github.io/mirage-console/" bug-reports: "https://github.com/mirage/mirage-console/issues" depends: [ - "ocaml" {>= "4.06.0"} + "ocaml" {>= "4.08.0"} "dune" {>= "1.0"} "mirage-console" {= version} "rresult" diff --git a/mirage-console-xen.opam b/mirage-console-xen.opam index d7c317d..3fad670 100644 --- a/mirage-console-xen.opam +++ b/mirage-console-xen.opam @@ -7,13 +7,12 @@ homepage: "https://github.com/mirage/mirage-console" doc: "https://mirage.github.io/mirage-console/" bug-reports: "https://github.com/mirage/mirage-console/issues" depends: [ - "ocaml" {>= "4.06.0"} + "ocaml" {>= "4.08.0"} "dune" {>= "1.0"} + "io-page" {>= "2.0.0"} "mirage-console" {=version} "mirage-console-xen-proto" {=version} - "xen-evtchn" - "io-page-xen" - "mirage-xen" {>= "5.0.0"} + "mirage-xen" {>= "6.0.0"} ] build: [ ["dune" "subst"] {pinned} diff --git a/mirage-console.opam b/mirage-console.opam index f30ca42..4356058 100644 --- a/mirage-console.opam +++ b/mirage-console.opam @@ -7,7 +7,7 @@ homepage: "https://github.com/mirage/mirage-console" doc: "https://mirage.github.io/mirage-console/" bug-reports: "https://github.com/mirage/mirage-console/issues" depends: [ - "ocaml" {>= "4.06.0"} + "ocaml" {>= "4.08.0"} "dune" {>= "1.0"} "mirage-device" {>= "2.0.0"} "mirage-flow" {>= "2.0.0"} diff --git a/xen/backend/conback.ml b/xen/backend/conback.ml index 99468ae..1d6dd1d 100644 --- a/xen/backend/conback.ml +++ b/xen/backend/conback.ml @@ -28,7 +28,7 @@ module type ACTIVATIONS = sig val program_start: event (** represents an event which 'fired' when the program started *) - val after: Eventchn.t -> event -> event Lwt.t + val after: OS.Eventchn.t -> event -> event Lwt.t (** [next channel event] blocks until the system receives an event newer than [event] on channel [channel]. If an event is received while we aren't looking then this will be remembered and the @@ -46,8 +46,8 @@ type stats = { type t = { domid: int; - xe: Eventchn.handle; - evtchn: Eventchn.t; + xe: OS.Eventchn.handle; + evtchn: OS.Eventchn.t; ring: Cstruct.t; } @@ -80,7 +80,7 @@ module Make(A: ACTIVATIONS)(X: Xs_client_lwt.S)(C: CONSOLE) = struct stats.total_read <- stats.total_read + n; let seq = Int32.(add seq (of_int n)) in Console_ring.Ring.Front.Reader.advance t.ring seq; - Eventchn.notify t.xe t.evtchn; + OS.Eventchn.notify t.xe t.evtchn; A.after t.evtchn after >>= fun next -> read_the_ring next in @@ -100,7 +100,7 @@ module Make(A: ACTIVATIONS)(X: Xs_client_lwt.S)(C: CONSOLE) = struct Cstruct.blit buffer 0 avail 0 n; let seq = Int32.(add seq (of_int n)) in Console_ring.Ring.Back.Writer.advance t.ring seq; - Eventchn.notify t.xe t.evtchn; + OS.Eventchn.notify t.xe t.evtchn; loop after (Cstruct.shift buffer n) end end in @@ -113,7 +113,7 @@ module Make(A: ACTIVATIONS)(X: Xs_client_lwt.S)(C: CONSOLE) = struct let init xe domid ring_info c = let evtchn = - Eventchn.bind_interdomain xe domid ring_info.RingInfo.event_channel + OS.Eventchn.bind_interdomain xe domid ring_info.RingInfo.event_channel in let grant = { OS.Xen.Import.domid = domid; ref = OS.Xen.Gntref.of_int32 ring_info.RingInfo.ref } @@ -197,7 +197,7 @@ module Make(A: ACTIVATIONS)(X: Xs_client_lwt.S)(C: CONSOLE) = struct let run (id: string) backend_name (domid,devid) = make () >>= fun client -> - let xe = Eventchn.init () in + let xe = OS.Eventchn.init () in C.connect id >>= fun t -> mk_backend_path client backend_name (domid,devid) >>= fun backend_path -> diff --git a/xen/backend/conback.mli b/xen/backend/conback.mli index 2019188..08c0015 100644 --- a/xen/backend/conback.mli +++ b/xen/backend/conback.mli @@ -25,7 +25,7 @@ module type ACTIVATIONS = sig val program_start: event (** represents an event which 'fired' when the program started *) - val after: Eventchn.t -> event -> event Lwt.t + val after: OS.Eventchn.t -> event -> event Lwt.t (** [next channel event] blocks until the system receives an event newer than [event] on channel [channel]. If an event is received while we aren't looking then this will be remembered and the diff --git a/xen/backend/dune b/xen/backend/dune index cc5a131..cd7ec13 100644 --- a/xen/backend/dune +++ b/xen/backend/dune @@ -1,6 +1,5 @@ (library (name mirage_console_xen_backend) (public_name mirage-console-xen-backend) - (libraries lwt mirage-xen xenstore xenstore.client xen-evtchn - shared-memory-ring mirage-console mirage-console-xen-proto io-page-xen) - (flags :standard -safe-string)) + (libraries lwt mirage-xen xenstore xenstore.client io-page + shared-memory-ring mirage-console mirage-console-xen-proto)) diff --git a/xen/console_xen.ml b/xen/console_xen.ml index 551d5de..843a32f 100644 --- a/xen/console_xen.ml +++ b/xen/console_xen.ml @@ -127,23 +127,30 @@ let names_to_ids ids = Lwt.return list) ) [] ids +type page = (char, Bigarray.int8_unsigned_elt, Bigarray.c_layout) + Bigarray.Array1.t + +external mirage_xen_get_console_evtchn: unit -> int = + "mirage_xen_get_console_evtchn" +external mirage_xen_get_console_page: unit -> page = + "mirage_xen_get_console_page" + +let get_console_evtchn () = Eventchn.of_int @@ + mirage_xen_get_console_evtchn () + +let get_console_page () = Cstruct.of_bigarray @@ + mirage_xen_get_console_page () + let get_initial_console () = (* The domain is created with a reserved grant entry already set up. We don't need to know who the backend domain is. *) - let page = Start_info.console_start_page () in + let page = get_console_page () in + let evtchn = get_console_evtchn () in let ring = page in - (* We don't need to zero the initial console ring, and doing so may lose boot - * messages from Mini-OS. *) - - let get_evtchn () = - let e = Eventchn.of_int Start_info.((get ()).console_evtchn) in - Eventchn.unmask h e; - e in - let evtchn = get_evtchn () in + (* We don't need to zero the initial console ring, doing so would lose + * initial messages from Solo5 / the OCaml runtime. *) let closed = false in let cons = { id = 0; backend_id = 0; gnt = Xen.console; ring; evtchn; closed } in - Sched.add_resume_hook (fun () -> cons.evtchn <- get_evtchn (); Lwt.return ()); - Eventchn.unmask h evtchn; Eventchn.notify h evtchn; cons diff --git a/xen/dune b/xen/dune index 3f181e2..ad4d9ac 100644 --- a/xen/dune +++ b/xen/dune @@ -1,8 +1,6 @@ (library (name mirage_console_xen) (public_name mirage-console-xen) - (libraries lwt xenstore xen-evtchn shared-memory-ring - mirage-console-xen-proto mirage-console mirage-flow mirage-xen - io-page-xen) - (wrapped false) - (flags :standard -safe-string)) + (libraries lwt xenstore shared-memory-ring io-page + mirage-console-xen-proto mirage-console mirage-flow mirage-xen) + (wrapped false)) diff --git a/xen/proto/dune b/xen/proto/dune index 6173da1..613121f 100644 --- a/xen/proto/dune +++ b/xen/proto/dune @@ -2,5 +2,4 @@ (name mirage_console_xen_proto) (public_name mirage-console-xen-proto) (libraries xenstore rresult) - (wrapped false) - (flags :standard -safe-string)) + (wrapped false))