From 8ddb1024daaac88b4fbc04b26a6f5bfc4dfff6e2 Mon Sep 17 00:00:00 2001 From: dinosaure Date: Tue, 23 Mar 2021 04:36:55 +0100 Subject: [PATCH] Remove alloc_pages_stubs and use >= io-page.2.4.0 --- lib/bindings/Makefile | 2 +- lib/bindings/alloc_pages_stubs.c | 60 -------------------------------- mirage-solo5.opam | 2 +- 3 files changed, 2 insertions(+), 62 deletions(-) delete mode 100644 lib/bindings/alloc_pages_stubs.c diff --git a/lib/bindings/Makefile b/lib/bindings/Makefile index 0e2bea1..171001f 100644 --- a/lib/bindings/Makefile +++ b/lib/bindings/Makefile @@ -8,7 +8,7 @@ CFLAGS := $(FREESTANDING_CFLAGS) \ .PHONY: all clean all: libmirage-solo5_bindings.a -OBJS=alloc_pages_stubs.o clock_stubs.o mm_stubs.o atomic_stubs.o cstruct_stubs.o solo5_block_stubs.o barrier_stubs.o main.o solo5_console_stubs.o solo5_net_stubs.o +OBJS=clock_stubs.o mm_stubs.o atomic_stubs.o cstruct_stubs.o solo5_block_stubs.o barrier_stubs.o main.o solo5_console_stubs.o solo5_net_stubs.o libmirage-solo5_bindings.a: $(OBJS) $(AR) r $@ $^ diff --git a/lib/bindings/alloc_pages_stubs.c b/lib/bindings/alloc_pages_stubs.c deleted file mode 100644 index b657bce..0000000 --- a/lib/bindings/alloc_pages_stubs.c +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright (C) 2012-2013 Citrix Inc - * Copyright (c) 2010-2011 Anil Madhavapeddy - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#include -#include -#include -#define PAGE_SIZE 4096 - -#include -#include -#include -#include -#include - -/* Allocate a page-aligned bigarray of length [n_pages] pages. - Since CAML_BA_MANAGED is set the bigarray C finaliser will - call free() whenever all sub-bigarrays are unreachable. - */ -CAMLprim value -mirage_alloc_pages(value did_gc, value n_pages) -{ - CAMLparam2(did_gc, n_pages); - size_t len = Int_val(n_pages) * PAGE_SIZE; - /* If the allocation fails, return None. The ocaml layer will - be able to trigger a full GC which just might run finalizers - of unused bigarrays which will free some memory. */ - void* block = malloc(len); - if (block == NULL) { - if (Bool_val(did_gc)) - printf("ERROR: Io_page: memalign(%d, %zu) failed, even after GC.\n", PAGE_SIZE, len); - caml_raise_out_of_memory(); - } - /* Explicitly zero the page before returning it */ - memset(block, 0, len); - CAMLreturn(caml_ba_alloc_dims(CAML_BA_CHAR | CAML_BA_C_LAYOUT | CAML_BA_MANAGED, 1, block, len)); -} - -CAMLprim value -mirage_get_addr(value page) -{ - CAMLparam1(page); - CAMLlocal1(nativeint); - void *data = Caml_ba_data_val(page); - nativeint = caml_copy_nativeint((intnat) data); - CAMLreturn(nativeint); -} diff --git a/mirage-solo5.opam b/mirage-solo5.opam index fbabaf4..9eee92a 100644 --- a/mirage-solo5.opam +++ b/mirage-solo5.opam @@ -29,7 +29,7 @@ depends: [ ("solo5-bindings-hvt" {>= "0.6.0" & < "0.7.0"} | "solo5-bindings-spt" {>= "0.6.0" & < "0.7.0"} | "solo5-bindings-virtio" {>= "0.6.0" & < "0.7.0"} | "solo5-bindings-muen" {>= "0.6.0" & < "0.7.0"} | "solo5-bindings-genode" {>= "0.6.0" & < "0.7.0"}) ] conflicts: [ - "io-page" {< "2.0.0"} + "io-page" {< "2.4.0"} "solo5-kernel-ukvm" "solo5-kernel-virtio" "solo5-kernel-muen"