Commit 07028321 authored by Muktesh muktesh khole's avatar Muktesh muktesh khole

Adding the required but untracked files to repo

parent 4bef5e80
* This is a test hypercall interface for Xen-Cap.
#include <err.h>
#include <stdlib.h>
#include <stdint.h>
#include <stdio.h>
#include <xenctrl.h>
#include <xenguest.h>
#include <xc_private.h>
int main(int argc, char **argv)
xc_interface *xch;
int ret, input_number;
if ( (argc != 2) )
errx(1, "usage: %s input_number ", argv[0]);
xch = xc_interface_open(0,0,0);
if ( !xch ){
errx(1, "xcutils: xc_xen_cap.c: failed to open control interface");
input_number= atoi(argv[1]);
printf("input_number: %d\n", input_number);
ret = do_cap_op(xch, input_number);
printf("return value: %d\n", ret);
if ( ret == 0 )
errx(1, "ret == 0\n");
return ret;
This diff is collapsed.
* This file is a part of the Flux Xen Capabilities infrastructure.
* Capabilities Support for Xen
* Author: Yathindra Naik
* Date: September 2012
#ifndef __XEN_CAP_H__
#define __XEN_CAP_H__
#include "xen.h"
/* Capability tokens are random numbers for now. This implementation is taken from wikipedia.
* Source:
* 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;
/* 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;
/* We may need to encode the rights here too ? */
typedef struct capability xen_capability_t;
struct cap_boot_info
struct capability cap_hypercalls[NUM_HYPERCALLS];
extern struct cap_boot_info *CAP_BOOT_INFO;
/* Domains maintain their capabilities in 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;
#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__ */
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