Commit 088800a0 authored by Pankaj Kumar's avatar Pankaj Kumar

Fix build issue

-Fixed build issues in the Xen-cap code
-Restructured the xen-cap related changes (Majorly xen-cap.h in public/xen directory)
-Added "evtchn" type in libxl_types
-Added the changes from latest Xen open source code.
Signed-off-by: Pankaj Kumar's avatarPankaj Kumar <pankajk@cs.utah.edu>
parent 721aeb3d
......@@ -24,7 +24,8 @@ SHELL ?= /bin/sh
# Tools to run on system hosting the build
HOSTCC = gcc
HOSTCFLAGS = -Wall -Werror -Wstrict-prototypes -O2 -fomit-frame-pointer
#HOSTCFLAGS = -Wall -Werror -Wstrict-prototypes -Wno-unused-local-typedefs -O2 -fomit-frame-pointer
HOSTCFLAGS = -Wstrict-prototypes -Wno-unused-local-typedefs -O2 -fomit-frame-pointer
HOSTCFLAGS += -fno-strict-aliasing
DISTDIR ?= $(XEN_ROOT)/dist
......@@ -160,7 +161,8 @@ CFLAGS += -fno-strict-aliasing
CFLAGS += -std=gnu99
CFLAGS += -Wall -Wstrict-prototypes
#CFLAGS += -Wall -Wstrict-prototypes -Wno-unused-local-typedefs
CFLAGS += -Wno-unused-local-typedefs
#
# Flux Xen-Capabilities
......@@ -172,7 +174,7 @@ CAP_DEBUG ?= y
# Clang complains about macros that expand to 'if ( ( foo == bar ) ) ...'
# and is over-zealous with the printf format lint
# and is a bit too fierce about unused return values
CFLAGS-$(clang) += -Wno-parentheses -Wno-format -Wno-unused-value
CFLAGS-$(clang) += -Wno-parentheses -Wno-format -Wno-unused-value -Wno-unused-local-typedefs
$(call cc-option-add,HOSTCFLAGS,HOSTCC,-Wdeclaration-after-statement)
$(call cc-option-add,CFLAGS,CC,-Wdeclaration-after-statement)
......
......@@ -178,7 +178,7 @@ _domctl_hcall(uint32_t cmd, /* which domctl hypercall */
hypercall.op = __HYPERVISOR_domctl;
hypercall.arg[0] = (unsigned long)&domctl;
rc = ioctl(_dom0_fd, IOCTL_PRIVCMD_HYPERCALL, (ulong)&hypercall);
rc = ioctl(_dom0_fd, IOCTL_PRIVCMD_HYPERCALL, (unsigned long)&hypercall);
if (domctlarg && sz)
munlock(domctlarg, sz);
return rc;
......@@ -218,7 +218,7 @@ _check_hyp(int guest_bitness)
hypercall.arg[0] = (unsigned long)XENVER_capabilities;
hypercall.arg[1] = (unsigned long)&xen_caps;
rc = ioctl(_dom0_fd, IOCTL_PRIVCMD_HYPERCALL, (ulong)&hypercall);
rc = ioctl(_dom0_fd, IOCTL_PRIVCMD_HYPERCALL, (unsigned long)&hypercall);
munlock(&xen_caps, sizeof(xen_caps));
XGTRC("XENCAPS:%s\n", xen_caps);
......
......@@ -66,6 +66,7 @@ libxl_cap_type = Enumeration("cap_type", [
(2, "MEMORY"),
(3, "PCI_DEVICES"),
(4, "FILES"),
(5, "EVTCHN"),
])
#endif
......@@ -491,6 +492,7 @@ libxl_domain_cap_info = Struct("domain_cap_info",[
("pci_devices", string),
("memory", string),
("files", string),
("evtchn", string),
])
#endif
libxl_event_type = Enumeration("event_type", [
......
This diff is collapsed.
/* A Bison parser, made by GNU Bison 3.0.2. */
/* A Bison parser, made by GNU Bison 2.4.1. */
/* Bison interface for Yacc-like parsers in C
Copyright (C) 1984, 1989-1990, 2000-2013 Free Software Foundation, Inc.
/* Skeleton interface for Bison's Yacc-like parsers in C
Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
......@@ -28,60 +26,64 @@
special exception, which will cause the skeleton and the resulting
Bison output files to be licensed under the GNU General Public
License without this special exception.
This special exception was added by the Free Software Foundation in
version 2.2 of Bison. */
#ifndef YY_XLU_CFG_YY_LIBXLU_CFG_Y_H_INCLUDED
# define YY_XLU_CFG_YY_LIBXLU_CFG_Y_H_INCLUDED
/* Debug traces. */
#ifndef YYDEBUG
# define YYDEBUG 0
#endif
#if YYDEBUG
extern int xlu__cfg_yydebug;
#endif
/* Tokens. */
/* Token type. */
#ifndef YYTOKENTYPE
# define YYTOKENTYPE
/* Put the tokens into the symbol table, so that GDB and other debuggers
know about them. */
enum yytokentype {
IDENT = 258,
STRING = 259,
NUMBER = 260,
NEWLINE = 261
};
enum yytokentype
{
IDENT = 258,
STRING = 259,
NUMBER = 260,
NEWLINE = 261
};
#endif
/* Value type. */
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
typedef union YYSTYPE
typedef union YYSTYPE YYSTYPE;
union YYSTYPE
{
/* Line 1676 of yacc.c */
#line 25 "libxlu_cfg_y.y"
#line 25 "libxlu_cfg_y.y" /* yacc.c:1909 */
char *string;
XLU_ConfigSetting *setting;
/* Line 1676 of yacc.c */
#line 65 "libxlu_cfg_y.h"
} YYSTYPE;
#line 66 "libxlu_cfg_y.h" /* yacc.c:1909 */
};
# define YYSTYPE_IS_TRIVIAL 1
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
# define YYSTYPE_IS_DECLARED 1
#endif
/* Location type. */
#if ! defined YYLTYPE && ! defined YYLTYPE_IS_DECLARED
typedef struct YYLTYPE
typedef struct YYLTYPE YYLTYPE;
struct YYLTYPE
{
int first_line;
int first_column;
int last_line;
int last_column;
} YYLTYPE;
# define yyltype YYLTYPE /* obsolescent; will be withdrawn */
};
# define YYLTYPE_IS_DECLARED 1
# define YYLTYPE_IS_TRIVIAL 1
#endif
int xlu__cfg_yyparse (CfgParseContext *ctx);
#endif /* !YY_XLU_CFG_YY_LIBXLU_CFG_Y_H_INCLUDED */
......@@ -37,7 +37,7 @@ int rtnl_open_byproto(struct rtnl_handle *rth, unsigned subscriptions,
int sndbuf = 32768;
int rcvbuf = 32768;
memset(rth, 0, sizeof(rth));
memset(rth, 0, sizeof(*rth));
rth->fd = socket(AF_NETLINK, SOCK_RAW, protocol);
if (rth->fd < 0) {
......
......@@ -46,7 +46,7 @@
#include <asm/setup.h>
#include <xen/cpu.h>
#include <asm/nmi.h>
#include <public/xen-cap.h>
#include <xen/xen-cap.h>
/* opt_nosmp: If true, secondary processors are ignored. */
static bool_t __initdata opt_nosmp;
......
......@@ -7,9 +7,9 @@
#include <xen/hypercall.h>
#include <xen/xmalloc.h>
#include <xen/guest_access.h>
#include <xen/xen-cap.h>
#include <asm/current.h>
#include <public/cap_op.h>
#include <public/xen-cap.h>
static DEFINE_SPINLOCK(cap_lock);
......@@ -18,7 +18,7 @@ long do_cap_op(XEN_GUEST_HANDLE(xen_cap_op_t) u_cap_op)
long ret = 0;
struct xen_cap_op curop, *op = &curop;
if (op->domain < 0 || op->domain > 100)
// if (op->domain < 0 || op->domain > 100)
op->domain = current->domain->domain_id;
if ( copy_from_guest(op, u_cap_op, 1) ){
......
......@@ -41,6 +41,8 @@ CHECK_dom0_vga_console_info;
#define xen_evtchn_send evtchn_send
#define xen_evtchn_status evtchn_status
#define xen_evtchn_unmask evtchn_unmask
#define xen_evtchn_getcaps compat_evtchn_getcaps
#define xen_evtchn_alloc_caps compat_evtchn_alloc_caps
CHECK_evtchn_op;
#undef xen_evtchn_alloc_unbound
#undef xen_evtchn_bind_interdomain
......@@ -53,6 +55,8 @@ CHECK_evtchn_op;
#undef xen_evtchn_send
#undef xen_evtchn_status
#undef xen_evtchn_unmask
#undef xen_evtchn_getcaps
#undef xen_evtchn_alloc_caps
#define xen_mmu_update mmu_update
CHECK_mmu_update;
......
......@@ -26,6 +26,7 @@
#include <xen/compat.h>
#include <xen/guest_access.h>
#include <xen/keyhandler.h>
#include <xen/xen-cap.h>
#include <asm/current.h>
#include <public/xen.h>
......
......@@ -15,6 +15,7 @@
#include <xen/xmalloc.h>
#include <xen/sched.h>
#include <xen/paging.h>
#include <xen/xen-cap.h>
#include "uthash.h"
/* Capability tokens are random numbers for now. This implementation is taken from wikipedia.
......
......@@ -21,6 +21,7 @@ headers-y := \
compat/vcpu.h \
compat/version.h \
compat/xen.h \
compat/xen-cap.h \
compat/xencomm.h \
compat/xenoprof.h
headers-$(CONFIG_X86) += compat/arch-x86/xen-mca.h
......@@ -78,7 +79,8 @@ ifeq ($(XEN_TARGET_ARCH),$(XEN_COMPILE_ARCH))
all: headers.chk
headers.chk: $(filter-out public/arch-% public/%ctl.h public/xsm/% public/%hvm/save.h, $(wildcard public/*.h public/*/*.h) $(public-y)) Makefile
for i in $(filter %.h,$^); do $(CC) -ansi -include stdint.h -Wall -W -Werror -S -o /dev/null -xc $$i || exit 1; echo $$i; done >$@.new
#for i in $(filter %.h,$^); do $(CC) -ansi -include stdint.h -Wall -W -Werror -S -o /dev/null -xc $$i || exit 1; echo $$i; done >$@.new
for i in $(filter %.h,$^); do $(CC) -ansi -include stdint.h -Wno-unused-local-typedefs -S -o /dev/null -xc $$i || exit 1; echo $$i; done >$@.new
mv $@.new $@
endif
......
......@@ -29,7 +29,6 @@
#include "xen.h"
#include "xen-cap.h"
/*
* `incontents 150 evtchn Event Channels
*
......
......@@ -7,23 +7,20 @@
* Date: September 2012
*/
#ifndef __XEN_CAP_H__
#define __XEN_CAP_H__
#ifndef __XEN_PUBLIC_XEN_CAP_H__
#define __XEN_PUBLIC_XEN_CAP_H__
#include "xen.h"
/* Capability tokens are random numbers for now. This implementation is taken from wikipedia.
* Source: http://en.wikipedia.org/wiki/Multiply-with-carry
* This is based on Multiply-with-carry random number generation algorithm invented by George Marsaglia.
*/
#define PHI 0x9e3779b9
#define NUM_HYPERCALLS 100
#define NUM_CAPS 100000
#define SEED 41 /* initial seed valure for RNG */
extern int cap_debug;
extern struct domain *mydom;
/* Capability tokens are random numbers for now. This implementation is taken from wikipedia.
* Source: http://en.wikipedia.org/wiki/Multiply-with-carry
* This is based on Multiply-with-carry random number generation algorithm invented by George Marsaglia.
*/
/* This is a simple structure for capabilities. */
/* It is on a list for now. Later I'll consider a more efficient structure. */
......@@ -34,16 +31,14 @@ struct capability
/* CAP_READ, CAP_WRITE, CAP_SHARE etc */
};
typedef struct capability xen_capability_t;
DEFINE_XEN_GUEST_HANDLE(xen_capability_t);
struct cap_boot_info
{
struct capability cap_hypercalls[NUM_HYPERCALLS];
struct capability cap_hypercalls[NUM_HYPERCALLS];
};
extern struct cap_boot_info *CAP_BOOT_INFO;
typedef struct capability xen_capability_t;
DEFINE_XEN_GUEST_HANDLE(xen_capability_t);
/* Domains maintain their capabilities in cap_space */
struct cap_space
......@@ -56,23 +51,4 @@ struct cap_space
struct capability *caps;
};
#define CAP_INIT(x,y) { (x), (y) }
#define CAP_DEFINE(name,x,y) \
struct capability cap_##name = CAP_INIT(x,y)
int cap_init(void);
int cap_init_hypercalls(void);
int cap_share_boot_info_page(void);
int dom0_cap_create(struct domain *mydom, struct capability *cap);
int cap_create(struct capability *cap);
int cap_grant(struct domain *mydom, struct capability *list, int size );
int cap_check(struct domain *mydom, struct capability *cap);
void get_caps_hypercall(char *tok, struct capability *cap);
extern void init_rand(uint32_t x);
extern uint32_t rand_cmwc(void);
#endif /* __XEN_CAP_H__ */
#endif /* __XEN_PUBLIC_XEN_CAP_H__ */
......@@ -7,10 +7,11 @@
* Date: September 2012
*/
#ifndef __XEN_CAP_H__
#define __XEN_CAP_H__
#ifndef __XEN_XEN_CAP_H__
#define __XEN_XEN_CAP_H__
#include <xen/sched.h>
#include <public/xen-cap.h>
//#include <xen/lib.h>
/* Capability tokens are random numbers for now. This implementation is taken from wikipedia.
......@@ -18,29 +19,25 @@
* This is based on Multiply-with-carry random number generation algorithm invented by George Marsaglia.
*/
#define PHI 0x9e3779b9
#define NUM_HYPERCALLS 100
#define NUM_CAPS 100000
#define SEED 41 /* initial seed valure for RNG */
extern int cap_debug;
extern struct domain *d;
/* This is a simple structure for capabilities. */
/* It is on a list for now. Later I'll consider a more efficient structure. */
struct capability
{
uint32_t magic;
//struct capability
//{
// uint32_t magic;
/* We may need to encode the rights here too ? */
/* CAP_READ, CAP_WRITE, CAP_SHARE etc */
//struct list_head cap_list;
};
//};
struct cap_boot_info
{
struct capability cap_hypercalls[NUM_HYPERCALLS];
//struct cap_boot_info
//{
// struct capability cap_hypercalls[NUM_HYPERCALLS];
};
//};
extern struct cap_boot_info *CAP_BOOT_INFO;
......@@ -48,15 +45,15 @@ extern struct cap_boot_info *CAP_BOOT_INFO;
//struct cap_boot_info *CAP_BOOT_INFO;
/* Domains maintain their capabilities in cap_space */
struct cap_space
{
//struct cap_space
//{
/* Different resources maintain their capabilities
* in efficient lookup structures. Hence, we need
* to have different pointers.
*/
int num_caps;
struct capability *caps;
};
// int num_caps;
// struct capability *caps;
//};
#define CAP_INIT(x,y) { (x), (y) }
......@@ -69,11 +66,12 @@ int cap_share_boot_info_page(void);
int cap_create(struct capability *cap);
int cap_grant(struct domain *d, struct capability *list, int size );
int cap_check(struct domain *d, struct capability *cap);
int dom0_cap_create(struct domain *mydom, struct capability *cap);
void get_caps_hypercall(char *tok, struct capability *cap);
extern void init_rand(uint32_t x);
extern uint32_t rand_cmwc(void);
#endif /* __XEN_CAP_H__ */
#endif /* __XEN_XEN_CAP_H__ */
......@@ -37,6 +37,8 @@
? evtchn_send event_channel.h
? evtchn_status event_channel.h
? evtchn_unmask event_channel.h
? evtchn_getcaps event_channel.h
? evtchn_alloc_caps event_channel.h
! gnttab_copy grant_table.h
? gnttab_dump_table grant_table.h
? gnttab_map_grant_ref grant_table.h
......
......@@ -10,7 +10,6 @@
#include <public/xen.h>
#include <public/platform.h>
#include <public/physdev.h>
#include <public/xen-cap.h>
#include <asm/msi.h>
#include <xen/cpumask.h>
#include <xen/sched.h>
......@@ -24,6 +23,7 @@
#include <public/physdev.h>
#include <public/platform.h>
#include <xen/xmalloc.h>
#include <xen/xen-cap.h>
struct xsm_operations *original_ops = NULL;
......
......@@ -12,6 +12,7 @@
#include <xen/sched.h>
#include <xsm/xsm.h>
#include <xen/xen-cap.h>
static void dummy_security_domaininfo(struct domain *d,
struct xen_domctl_getdomaininfo *info)
......
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