Commit 075fc6fe authored by Keir Fraser's avatar Keir Fraser

ocaml: NetBSD support and general CFLAGS cleanup

Signed-off-by: default avatarChristoph Egger <Christoph.Egger@amd.com>
Signed-off-by: default avatarKeir Fraser <keir.fraser@citrix.com>
parent 9eda3b08
......@@ -168,11 +168,7 @@ CONFIG_MINITERM ?= n
CONFIG_LOMOUNT ?= n
ifeq ($(OCAML_TOOLS),y)
ifeq ($(CONFIG_Linux),y)
OCAML_TOOLS := $(shell ocamlopt -v > /dev/null 2>&1 && echo "y" || echo "n")
else
OCAML_TOOLS := n
endif
endif
-include $(XEN_ROOT)/.config
include $(XEN_ROOT)/tools/Rules.mk
CC ?= gcc
OCAMLOPT ?= ocamlopt
OCAMLC ?= ocamlc
......@@ -6,10 +8,10 @@ OCAMLDEP ?= ocamldep
OCAMLLEX ?= ocamllex
OCAMLYACC ?= ocamlyacc
CFLAGS ?= -Wall -fPIC -O2 -Werror
CFLAGS += -fPIC -Werror
CFLAGS += -I$(TOPLEVEL)/../include -I$(TOPLEVEL)/../libxc
CFLAGS += -I/usr/lib64/ocaml -I/usr/lib/ocaml
CFLAGS-$(CONFIG_Linux) += -I/usr/lib64/ocaml -I/usr/lib/ocaml
CFLAGS-$(CONFIG_NetBSD) += -I/usr/pkg/lib/ocaml -fPIC
OCAMLOPTFLAG_G := $(shell $(OCAMLOPT) -h 2>&1 | sed -n 's/^ *\(-g\) .*/\1/p')
OCAMLOPTFLAGS = $(OCAMLOPTFLAG_G) -ccopt "$(LDFLAGS)" -dtypes $(OCAMLINCLUDE) -cc $(CC) -w F -warn-error F
......
TOPLEVEL=../..
XEN_ROOT=$(TOPLEVEL)/../..
include $(TOPLEVEL)/common.make
OBJS = eventchn
......
......@@ -20,20 +20,10 @@
#include <unistd.h>
#include <errno.h>
#include <stdint.h>
#include <sys/ioctl.h>
#define __XEN_TOOLS__
#include <xen/sysctl.h>
#if XEN_SYSCTL_INTERFACE_VERSION < 4
#include <xen/linux/evtchn.h>
#else
#include <xen/xen.h>
#include <xen/sys/evtchn.h>
#endif
#include <xenctrl.h>
#define CAML_NAME_SPACE
......
TOPLEVEL=../..
XEN_ROOT=$(TOPLEVEL)/../..
include $(TOPLEVEL)/common.make
OBJS = syslog log logs
......
TOPLEVEL=../..
XEN_ROOT=$(TOPLEVEL)/../..
include $(TOPLEVEL)/common.make
OBJS = mmap
......
TOPLEVEL=../..
XEN_ROOT=$(TOPLEVEL)/../..
include $(TOPLEVEL)/common.make
OBJS = uuid
......
TOPLEVEL=../..
XEN_ROOT=$(TOPLEVEL)/../..
include $(TOPLEVEL)/common.make
CFLAGS += -I../mmap
......
......@@ -27,10 +27,7 @@
#include <caml/fail.h>
#include <caml/callback.h>
#define __XEN_TOOLS__
#include <xenctrl.h>
#define u32 uint32_t
#include <xen/io/xs_wire.h>
CAMLprim value stub_header_size(void)
......
......@@ -21,10 +21,7 @@
#include <errno.h>
#include <string.h>
#define __XEN_TOOLS__
#include <xenctrl.h>
#define u32 uint32_t
#include <xen/io/xs_wire.h>
#include <caml/mlvalues.h>
......
TOPLEVEL=../..
XEN_ROOT=$(TOPLEVEL)/../..
include $(TOPLEVEL)/common.make
CFLAGS += -I../mmap -I./
......
......@@ -14,19 +14,13 @@
* GNU Lesser General Public License for more details.
*/
#define __XEN_TOOLS__
#include <xen/xen.h>
#include <xen/memory.h>
#include <xen/sysctl.h>
#include <xen/domctl.h>
#include <xen/sched.h>
#include <xen/sysctl.h>
#if XEN_SYSCTL_INTERFACE_VERSION < 4
#include <xen/linux/privcmd.h>
#else
#include <xen/sys/privcmd.h>
#endif
#include <xen/version.h>
#include <xen/foreign/x86_32.h>
#include <xen/foreign/x86_64.h>
......
......@@ -631,9 +631,9 @@ int xc_domain_getinfo(int handle, unsigned int domid, xc_domaininfo_t *info)
int xc_domain_setmaxmem(int handle, unsigned int domid, unsigned int max_memkb)
{
int ret;
DECLARE_DOMCTL(XEN_DOMCTL_max_mem, domid);
domctl.u.max_mem.max_memkb = max_memkb;
int ret;
ret = do_domctl(handle, &domctl);
if (ret < 0)
......@@ -682,9 +682,9 @@ int xc_domain_set_memmap_limit(int handle, unsigned int domid,
int xc_domain_set_time_offset(int handle, unsigned int domid, int time_offset)
{
int ret;
DECLARE_DOMCTL(XEN_DOMCTL_settimeoffset, domid);
domctl.u.settimeoffset.time_offset_seconds = time_offset;
int ret;
ret = do_domctl(handle, &domctl);
if (ret < 0)
......@@ -884,10 +884,10 @@ int xc_vcpu_setcontext(int handle, unsigned int domid,
int xc_domain_irq_permission(int handle, unsigned int domid,
unsigned char pirq, unsigned char allow_access)
{
int ret;
DECLARE_DOMCTL(XEN_DOMCTL_irq_permission, domid);
domctl.u.irq_permission.pirq = pirq;
domctl.u.irq_permission.allow_access = allow_access;
int ret;
ret = do_domctl(handle, &domctl);
if (ret)
......@@ -900,11 +900,11 @@ int xc_domain_iomem_permission(int handle, unsigned int domid,
unsigned long first_mfn, unsigned long nr_mfns,
unsigned char allow_access)
{
int ret;
DECLARE_DOMCTL(XEN_DOMCTL_iomem_permission, domid);
domctl.u.iomem_permission.first_mfn = first_mfn;
domctl.u.iomem_permission.nr_mfns = nr_mfns;
domctl.u.iomem_permission.allow_access = allow_access;
int ret;
ret = do_domctl(handle, &domctl);
if (ret)
......
......@@ -99,7 +99,7 @@ CAMLprim value stub_marshall_core_header(value header)
CAMLreturn(s);
}
CAMLprim value stub_xc_interface_open()
CAMLprim value stub_xc_interface_open(void)
{
int handle;
handle = xc_interface_open();
......@@ -109,12 +109,12 @@ CAMLprim value stub_xc_interface_open()
}
CAMLprim value stub_xc_interface_open_fake()
CAMLprim value stub_xc_interface_open_fake(void)
{
return Val_int(-1);
}
CAMLprim value stub_xc_using_injection()
CAMLprim value stub_xc_using_injection(void)
{
if (xc_using_injection ()){
return Val_int(1);
......@@ -312,7 +312,9 @@ CAMLprim value stub_xc_domain_getinfolist(value xc_handle, value first_domain, v
CAMLparam3(xc_handle, first_domain, nb);
CAMLlocal2(result, temp);
xc_domaininfo_t * info;
int i, ret, toalloc;
int i, ret, toalloc, c_xc_handle, retval;
unsigned int c_max_domains;
uint32_t c_first_domain;
/* get the minimum number of allocate byte we need and bump it up to page boundary */
toalloc = (sizeof(xc_domaininfo_t) * Int_val(nb)) | 0xfff;
......@@ -322,12 +324,12 @@ CAMLprim value stub_xc_domain_getinfolist(value xc_handle, value first_domain, v
result = temp = Val_emptylist;
int c_xc_handle = _H(xc_handle);
uint32_t c_first_domain = _D(first_domain);
unsigned int c_max_domains = Int_val(nb);
c_xc_handle = _H(xc_handle);
c_first_domain = _D(first_domain);
c_max_domains = Int_val(nb);
// caml_enter_blocking_section();
int retval = xc_domain_getinfolist(c_xc_handle, c_first_domain,
c_max_domains, info);
retval = xc_domain_getinfolist(c_xc_handle, c_first_domain,
c_max_domains, info);
// caml_leave_blocking_section();
if (retval < 0) {
......@@ -849,15 +851,18 @@ CAMLprim value stub_map_foreign_range(value xc_handle, value dom,
CAMLparam4(xc_handle, dom, size, mfn);
CAMLlocal1(result);
struct mmap_interface *intf;
int c_xc_handle;
uint32_t c_dom;
unsigned long c_mfn;
result = caml_alloc(sizeof(struct mmap_interface), Abstract_tag);
intf = (struct mmap_interface *) result;
intf->len = Int_val(size);
int c_xc_handle = _H(xc_handle);
uint32_t c_dom = _D(dom);
unsigned long c_mfn = Nativeint_val(mfn);
c_xc_handle = _H(xc_handle);
c_dom = _D(dom);
c_mfn = Nativeint_val(mfn);
// caml_enter_blocking_section();
intf->addr = xc_map_foreign_range(c_xc_handle, c_dom,
intf->len, PROT_READ|PROT_WRITE,
......
TOPLEVEL=../..
XEN_ROOT=$(TOPLEVEL)/../..
include $(TOPLEVEL)/common.make
OCAMLINCLUDE += -I ../xb/
......
XEN_ROOT = ../../..
OCAML_TOPLEVEL = ..
include $(OCAML_TOPLEVEL)/common.make
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment