This commit is contained in:
parent
aa2ff7b2f0
commit
2f3113f55d
11742 changed files with 1223940 additions and 0 deletions
7
unikernel/duniverse/mirage-mtime/unikraft/dune
Normal file
7
unikernel/duniverse/mirage-mtime/unikraft/dune
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
(library
|
||||
(name mirage_mtime_unikraft)
|
||||
(public_name mirage-mtime.unikraft)
|
||||
(implements mirage-mtime)
|
||||
(foreign_stubs
|
||||
(language c)
|
||||
(names stubs)))
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
(* C stub implemented in mirage-unikraft *)
|
||||
external elapsed_ns : unit -> int64 = "caml_get_monotonic_time"
|
||||
external uk_time_tick_ns : unit -> int64 = "uk_time_tick_ns"
|
||||
|
||||
let elapsed_ns () = elapsed_ns ()
|
||||
let period_ns () = Some (uk_time_tick_ns ())
|
||||
15
unikernel/duniverse/mirage-mtime/unikraft/stubs.c
Normal file
15
unikernel/duniverse/mirage-mtime/unikraft/stubs.c
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
#ifdef __Unikraft__
|
||||
|
||||
#include <caml/alloc.h>
|
||||
#include <caml/mlvalues.h>
|
||||
#include <caml/memory.h>
|
||||
#include <uk/plat/time.h>
|
||||
|
||||
value uk_time_tick_ns(void)
|
||||
{
|
||||
CAMLparam0();
|
||||
|
||||
CAMLreturn(caml_copy_int64(UKPLAT_TIME_TICK_NSEC));
|
||||
}
|
||||
|
||||
#endif
|
||||
Loading…
Add table
Add a link
Reference in a new issue