Commit af26f94d authored by Yathindra Naik's avatar Yathindra Naik

Changes includes

- Debugging printk since boot fails.
- Xen properly builds now. Still need to see why boot fails.
parent ebdaf7b2
......@@ -188,7 +188,7 @@ EMBEDDED_EXTRA_CFLAGS := -nopie -fno-stack-protector -fno-stack-protector-all
EMBEDDED_EXTRA_CFLAGS += -fno-exceptions
# Enable XSM security module (by default, Flask).
XSM_ENABLE ?= n
XSM_ENABLE ?= y
FLASK_ENABLE ?= n #$(XSM_ENABLE)
XEN_EXTFILES_URL=http://xenbits.xen.org/xen-extfiles
......
......@@ -32,7 +32,7 @@ SUBDIRS-y += libfsimage
SUBDIRS-$(LIBXENAPI_BINDINGS) += libxen
SUBDIRS-$(CONFIG_Linux) += libvchan
# Flux Xen Capabilities
SUBDIRS-$(CONFIG_XENCAP) += xen-cap
#SUBDIRS-$(CONFIG_XENCAP) += xen-cap
# do not recurse in to a dir we are about to delete
ifneq "$(MAKECMDGOALS)" "distclean"
......
......@@ -221,12 +221,12 @@ int xc_domain_getinfo(xc_interface *xch,
info->running = !!(domctl.u.getdomaininfo.flags&XEN_DOMINF_running);
info->hvm = !!(domctl.u.getdomaininfo.flags&XEN_DOMINF_hvm_guest);
info->debugged = !!(domctl.u.getdomaininfo.flags&XEN_DOMINF_debugged);
#if 0
#ifdef CONFIG_XENCAP
info->cap_flag = !!(domctl.u.getdomaininfo.flags&XEN_DOMINF_cap_flag);
PPRINTF("cap_flag:%d\n",info->cap_flag);
#endif
#endif
info->shutdown_reason =
(domctl.u.getdomaininfo.flags>>XEN_DOMINF_shutdownshift) &
XEN_DOMINF_shutdownmask;
......@@ -1527,15 +1527,14 @@ int xc_cap_create(xc_interface *xch, uint32_t domid, struct capability *cap)
domctl.cmd = XEN_DOMCTL_cap_create;
domctl.domain = (domid_t)domid;
domctl.u.cap_create.d = (domid_t)domid;
domctl.u.cap_create.cap = cap;
return do_domctl(xch, &domctl);
}
int xc_cap_grant(xc_interface *xch,
int from_domid,
int to_domid,
uint32_t from_domid,
uint32_t to_domid,
int type,
void *list,
int size)
......@@ -1565,7 +1564,6 @@ int xc_cap_check(xc_interface *xch,
domctl.cmd = XEN_DOMCTL_cap_check;
domctl.domain = (domid_t)domid;
domctl.u.cap_check.d = (domid_t)domid;
domctl.u.cap_check.type = type;
domctl.u.cap_check.cap = cap;
......
......@@ -47,6 +47,10 @@
#include <xen/xsm/flask_op.h>
#include <xen/tmem.h>
#ifdef CONFIG_XENCAP
//#include <xen/xen-cap.h>
#endif
#include "xentoollog.h"
#if defined(__i386__) || defined(__x86_64__)
......@@ -2232,13 +2236,6 @@ int xc_compression_uncompress_page(xc_interface *xch, char *compbuf,
*/
#ifdef CONFIG_XENCAP
/**
* Parse the user level capabality specfication.
*
*/
int xc_cap_hypercalls(xc_interface *xch, uint32_t domid, uint32_t cap_flag,
char **hypercalls);
/**
* Creates a capability and inserts it into the
* capability space of the calling VM.
......@@ -2252,8 +2249,8 @@ int xc_cap_create(xc_interface *xch, uint32_t domid, struct capability *cap);
* Returns success - 1 or failure - 0.
*/
int xc_cap_grant(xc_interface *xch,
int from_domid,
int to_domid,
uint32_t from_domid,
uint32_t to_domid,
int type,
void *list,
int size);
......
......@@ -179,29 +179,15 @@ static PyObject *pyxc_domain_unpause(XcObject *self, PyObject *args)
#ifdef CONFIG_XENCAP
static PyObject *pyxc_cap_set_flag(XcObject *self, PyObject *args)
{
uint32_t dom, cap_flag;
if ( !PyArg_ParseTuple(args, "ii", &dom, &cap_flag) )
return NULL;
if ( xc_cap_set_flag(self->xc_handle, dom, cap_flag) != 0 )
return pyxc_error_to_exception();
Py_INCREF(zero);
return zero;
}
/* This function is parsing a list of strings from args.
* Ex: "cap_hypercalls='timer, foo, blah, ...'"
* We need individual stings from this list to process.
*/
static PyObject *pyxc_cap_hypercalls(XcObject *self, PyObject *args)
{
uint32_t dom, cap_flag;
uint32_t from_dom, to_dom, dom, cap_flag;
PyObject* cap_hypercalls = NULL;
int hypercalls_list[NR_hypercalls];
int hypercalls_list[64];
char *str;
if ( !PyArg_ParseTuple(args, "iiO", &dom, &cap_flag, &cap_hypercalls) )
......@@ -209,7 +195,7 @@ static PyObject *pyxc_cap_hypercalls(XcObject *self, PyObject *args)
// Making sure its type is a list.
if ( !PyList_Check(cap_hypercalls) )
return pyxc_error_to_exception();
return pyxc_error_to_exception(self->xc_handle);
// Scan all elements on that list, make sure they are string objects and print them:
for (int i = 0; i < PyList_Size(cap_hypercalls); i++)
......@@ -217,7 +203,7 @@ static PyObject *pyxc_cap_hypercalls(XcObject *self, PyObject *args)
PyObject* p = PyList_GetItem(cap_hypercalls, i);
if ( NULL == (str = PyBytes_AsString(p)) )
return pyxc_error_to_exception();
return pyxc_error_to_exception(self->xc_handle);
/* Map hypercall names to hypercall numbers */
if ( strcmp(str,"foo") == 0 )
......@@ -226,8 +212,11 @@ static PyObject *pyxc_cap_hypercalls(XcObject *self, PyObject *args)
hypercalls_list[i] = 10;
}
if ( xc_cap_grant(from_dom, to_dom, 1, hypercalls_list, NR_hypercalls ) != 0 )
return pyxc_error_to_exception();
from_dom = 0;
to_dom = dom;
if ( xc_cap_grant(self->xc_handle, from_dom, to_dom, 1, hypercalls_list, 64 ) != 0 )
return pyxc_error_to_exception(self->xc_handle);
Py_INCREF(Py_None);
return zero;
......@@ -2408,14 +2397,6 @@ static PyMethodDef pyxc_methods[] = {
"Returns: [int] 0 on success; -1 on error.\n" },
#ifdef CONFIG_XENCAP
{ "cap_set_flag",
(PyCFunction)pyxc_cap_set_flag,
METH_VARARGS, "\n"
"Notifies Xen that this domain is in capability mode.\n"
" dom [int]: Identifier of domain to be unpaused.\n\n"
" cap_flag [int]: Is this in capability mode ?\n\n"
"Returns: [int] 0 on success; -1 on error.\n" },
{ "cap_hypercalls",
(PyCFunction)pyxc_cap_hypercalls,
METH_VARARGS, "\n"
......
......@@ -11,14 +11,14 @@
#include <stdio.h>
#include <xenctrl.h>
#include <stdlib.h>
int test_xen_cap_create(void)
{
uint32_t domain_id = 0;
uint32_t domain_id = 2;
int ret;
xc_interface *xch;
int captype = 0;
struct capability cap;
xch = xc_interface_open(0,0,0);
......@@ -27,9 +27,9 @@ int test_xen_cap_create(void)
printf("\nxc_interface_open failed to get xc_handle!\n");
return 0;
}
printf("\nApplication test_cap_create:Domain %d, captype:0x%x\n", domain_id, captype);
ret = xc_cap_create(xch, domain_id, captype);
ret = xc_cap_create(xch, domain_id, cap);
printf("\nApplication test_cap_create:Domain %d, captype:0x%x\n", domain_id, cap->magic);
return ret;
......
......@@ -620,18 +620,18 @@ int arch_domain_create(struct domain *d, unsigned int domcr_flags)
void arch_domain_destroy(struct domain *d)
{
unsigned int i;
printk("In arch_domain_destroy()\n");
if ( is_hvm_domain(d) )
hvm_domain_destroy(d);
else
xfree(d->arch.pv_domain.e820);
printk("after hvm_domain_destroy()\n");
free_domain_pirqs(d);
if ( !is_idle_domain(d) )
iommu_domain_destroy(d);
printk("After iommu_domain_destroy()\n");
paging_final_teardown(d);
printk("After paging_final_teardown()\n");
for ( i = 0; i < PDPT_L2_ENTRIES; ++i )
{
if ( perdomain_pt_page(d, i) )
......
......@@ -596,11 +596,13 @@ void hvm_domain_relinquish_resources(struct domain *d)
void hvm_domain_destroy(struct domain *d)
{
printk("In hvm_domain_destroy()\n");
hvm_funcs.domain_destroy(d);
rtc_deinit(d);
stdvga_deinit(d);
vioapic_deinit(d);
hvm_destroy_cacheattr_region_list(d);
printk("Leaving hvm_domain_destory()\n");
}
static int hvm_save_tsc_adjust(struct domain *d, hvm_domain_context_t *h)
......
......@@ -1771,6 +1771,7 @@ static int pirq_guest_force_unbind(struct domain *d, struct pirq *pirq)
irq_guest_action_t *action, *oldaction = NULL;
int i, bound = 0;
printk("In pirq_guest_force_unbind()\n");
WARN_ON(!spin_is_locked(&d->event_lock));
BUG_ON(!local_irq_is_enabled());
......@@ -1805,7 +1806,7 @@ static int pirq_guest_force_unbind(struct domain *d, struct pirq *pirq)
free_cpumask_var(oldaction->cpu_eoi_map);
xfree(oldaction);
}
printk("Leaving pirq_guest_force_unbind()\n");
return bound;
}
......@@ -2028,16 +2029,17 @@ int unmap_domain_pirq(struct domain *d, int pirq)
void free_domain_pirqs(struct domain *d)
{
int i;
printk("In free_domain_pirqs()\n");
spin_lock(&pcidevs_lock);
spin_lock(&d->event_lock);
printk("Got the spin lock in free_domain_pirqs()\n");
for ( i = 0; i < d->nr_pirqs; i++ )
if ( domain_pirq_to_irq(d, i) > 0 )
unmap_domain_pirq(d, i);
printk("After unmap_domain_pirq()\n");
spin_unlock(&d->event_lock);
spin_unlock(&pcidevs_lock);
printk("Leaving free_domain_pirqs()\n");
}
static void dump_irqs(unsigned char key)
......@@ -2269,7 +2271,8 @@ int unmap_domain_pirq_emuirq(struct domain *d, int pirq)
{
int emuirq, ret = 0;
struct pirq *info;
printk("In unmap_domain_pirq_emuirq()\n");
if ( !is_hvm_domain(d) )
return -EINVAL;
......@@ -2297,6 +2300,7 @@ int unmap_domain_pirq_emuirq(struct domain *d, int pirq)
radix_tree_delete(&d->arch.hvm_domain.emuirq_pirq, emuirq);
done:
printk("Leaving unmap_domain_pirq_emuirq()\n");
return ret;
}
......
......@@ -436,7 +436,7 @@ void p2m_teardown(struct p2m_domain *p2m)
static void p2m_teardown_nestedp2m(struct domain *d)
{
uint8_t i;
printk("In p2m_teardown_nestedp2m()\n");
for (i = 0; i < MAX_NESTEDP2M; i++) {
if ( !d->arch.nested_p2m[i] )
continue;
......@@ -444,10 +444,12 @@ static void p2m_teardown_nestedp2m(struct domain *d)
xfree(d->arch.nested_p2m[i]);
d->arch.nested_p2m[i] = NULL;
}
printk("Leaving p2m_teardown_nestedp2m()\n");
}
void p2m_final_teardown(struct domain *d)
{
printk("In p2m_final_teardown(0\n");
/* Iterate over all p2m tables per domain */
if ( d->arch.p2m )
{
......@@ -460,6 +462,7 @@ void p2m_final_teardown(struct domain *d)
* we initialise them unconditionally.
*/
p2m_teardown_nestedp2m(d);
printk("Leaving p2m_final_teardown()\n");
}
......
......@@ -737,12 +737,14 @@ void paging_teardown(struct domain *d)
/* Call once all of the references to the domain have gone away */
void paging_final_teardown(struct domain *d)
{
printk("In paging_final_teardown()\n");
if ( hap_enabled(d) )
hap_final_teardown(d);
else
shadow_final_teardown(d);
p2m_final_teardown(d);
printk("Leaving paging_final_teardown()\n");
}
/* Enable an arbitrary paging-assistance mode. Call once at domain
......
......@@ -1167,9 +1167,11 @@ void __init __start_xen(unsigned long mbi_p)
xsm_init(module_map, mbi, bootstrap_map);
printk("Before cap_init()\n");
#ifdef CONFIG_XENCAP
cap_init();
#endif
printk("After cap_init()\n");
microcode_grab_module(module_map, mbi, bootstrap_map);
......
......@@ -204,12 +204,6 @@ struct domain *domain_create(
d->domain_id = domid;
#ifdef CONFIG_XENCAP
if ( cap_flag & DOMCRF_cap_flag ) {
d->cap_flag = 1;
}
#endif
lock_profile_register_struct(LOCKPROF_TYPE_PERDOM, d, domid, "Domain");
if ( (err = xsm_alloc_security_domain(d)) != 0 )
......@@ -256,8 +250,18 @@ struct domain *domain_create(
if ( domcr_flags & DOMCRF_dummy )
return d;
printk("In struct domain_create()\n");
printk(" -domcr_flags & DOMCRF_cap_flag\n");
#ifdef CONFIG_XENCAP
if ( domcr_flags & DOMCRF_cap_flag ) {
printk("setting d->cap_flag\n");
d->cap_flag = 1;
}
#endif
printk("Before is_idle_domain()\n");
if ( !is_idle_domain(d) )
{
printk(" -xsm_domain_create()\n");
if ( (err = xsm_domain_create(d, ssidref)) != 0 )
goto fail;
......@@ -288,17 +292,17 @@ struct domain *domain_create(
if ( !d->mem_event )
goto fail;
}
printk("After is_idle_domain\n");
if ( (err = arch_domain_create(d, domcr_flags)) != 0 )
goto fail;
init_status |= INIT_arch;
printk("After arch_domain_create()\n");
if ( (err = cpupool_add_domain(d, poolid)) != 0 )
goto fail;
printk("After cpupool_add_domain()\n");
if ( (err = sched_init_domain(d)) != 0 )
goto fail;
printk("After sched_init_domain()\n");
if ( !is_idle_domain(d) )
{
spin_lock(&domlist_update_lock);
......@@ -312,15 +316,18 @@ struct domain *domain_create(
rcu_assign_pointer(domain_hash[DOMAIN_HASH(domid)], d);
spin_unlock(&domlist_update_lock);
}
printk("After is_idle_domain()\n");
fail:
printk("In fail\n");
d->is_dying = DOMDYING_dead;
atomic_set(&d->refcnt, DOMAIN_DESTROYED);
xfree(d->mem_event);
if ( init_status & INIT_arch )
arch_domain_destroy(d);
printk("After arch_domain_destroy()\n");
if ( init_status & INIT_gnttab )
grant_table_destroy(d);
printk("After grant_table_destroy()\n");
if ( init_status & INIT_evtchn )
{
evtchn_destroy(d);
......@@ -329,12 +336,16 @@ struct domain *domain_create(
}
if ( init_status & INIT_rangeset )
rangeset_domain_destroy(d);
printk("After rangeset_domain_destroy()\n");
if ( init_status & INIT_watchdog )
watchdog_domain_destroy(d);
printk("After watchdog_domain_destroy()\n");
if ( init_status & INIT_xsm )
xsm_free_security_domain(d);
printk("After xsm_free_security_domain()\n");
free_cpumask_var(d->domain_dirty_cpumask);
free_domain_struct(d);
printk("Error is %d\n",err);
return ERR_PTR(err);
}
......
......@@ -421,9 +421,16 @@ long do_domctl(XEN_GUEST_HANDLE(xen_domctl_t) u_domctl)
ret = -EINVAL;
if ( supervisor_mode_kernel ||
#ifdef CONFIG_XENCAP
(op->u.createdomain.flags &
~(XEN_DOMCTL_CDF_hvm_guest | XEN_DOMCTL_CDF_hap |
XEN_DOMCTL_CDF_s3_integrity | XEN_DOMCTL_CDF_oos_off)) )
XEN_DOMCTL_CDF_s3_integrity | XEN_DOMCTL_CDF_oos_off |
XEN_DOMCTL_CDF_cap_flag )))
#else
(op->u.createdomain.flags &
~(XEN_DOMCTL_CDF_hvm_guest | XEN_DOMCTL_CDF_hap |
XEN_DOMCTL_CDF_s3_integrity | XEN_DOMCTL_CDF_oos_off ))
#endif
break;
dom = op->domain;
......@@ -459,7 +466,12 @@ long do_domctl(XEN_GUEST_HANDLE(xen_domctl_t) u_domctl)
domcr_flags |= DOMCRF_s3_integrity;
if ( op->u.createdomain.flags & XEN_DOMCTL_CDF_oos_off )
domcr_flags |= DOMCRF_oos_off;
#ifdef CONFIG_XENCAP
if ( op->u.createdomain.flags & XEN_DOMCTL_CDF_cap_flag ) {
TT_DBG("Setting cap-flag for the new domain\n");
domcr_flags |= DOMCRF_cap_flag;
}
#endif
d = domain_create(dom, domcr_flags, op->u.createdomain.ssidref);
if ( IS_ERR(d) )
{
......@@ -1043,15 +1055,11 @@ long do_domctl(XEN_GUEST_HANDLE(xen_domctl_t) u_domctl)
break;
#ifdef CONFIG_XENCAP
case XEN_DOMCTL_xen_cap_create:
case XEN_DOMCTL_cap_create:
{
struct domain *d;
CAP_T T;
if ( op->u.xen_cap_create.capid == 1 )
{
CAP_DEFINE(T, 0xcafebabe, 0x12314123, 0xdefaddef, 0x123defed);
}
struct capability *cap;
ret = -ESRCH;
d = rcu_lock_domain_by_id(op->domain);
if ( d == NULL )
......@@ -1059,56 +1067,62 @@ long do_domctl(XEN_GUEST_HANDLE(xen_domctl_t) u_domctl)
TT_ERR("Failed to rcu_lock_dom_by_id:%d\n", op->domain);
break;
}
cap = op->u.cap_create.cap;
TT_DBG(TXT_FG_GREEN "Adding xen_cap_create: Domain %d, Type: %d"TXT_FG_WHITE"\n",
d->domain_id, op->u.xen_cap_create.capid);
xen_cap_create(d, T);
ret = cap_create(d, cap);
rcu_unlock_domain(d);
ret = 0;
}
break;
case XEN_DOMCTL_xen_cap_grant:
case XEN_DOMCTL_cap_grant:
{
struct domain *d;
CAP_T T;
if ( op->u.xen_cap_create.capid == 1 )
{
CAP_DEFINE(T, 0xcafebabe, 0x12314123, 0xdefaddef, 0x123defed);
}
struct domain *to;
struct domain *from;
int type;
void *list;
int size;
ret = -ESRCH;
d = rcu_lock_domain_by_id(op->domain);
if ( d == NULL )
{
TT_ERR("Failed to rcu_lock_dom_by_id:%d\n", op->domain);
break;
}
from = rcu_lock_domain_by_id(op->u.cap_grant.from);
if ( from == NULL )
{
TT_ERR("Failed to rcu_lock_dom_by_id:%d\n", op->domain);
break;
}
to = rcu_lock_domain_by_id(op->u.cap_grant.to);
if ( to == NULL )
{
TT_ERR("Failed to rcu_lock_dom_by_id:%d\n", op->domain);
break;
}
TT_DBG(TXT_FG_GREEN "Adding xen_cap_grant: Domain %d, Type: %d"TXT_FG_WHITE"\n",
d->domain_id, op->u.xen_cap_grant.capid);
type = op->u.cap_grant.type;
list = op->u.cap_grant.list;
size = op->u.cap_grant.size;
xen_cap_grant(d, T);
ret = cap_grant(from,to,type,list,size);
rcu_unlock_domain(d);
ret = 0;
}
break;
case XEN_DOMCTL_xen_cap_check:
case XEN_DOMCTL_cap_check:
{
struct domain *d;
CAP_T T;
if ( op->u.xen_cap_create.capid == 1 )
{
CAP_DEFINE(T, 0xcafebabe, 0x12314123, 0xdefaddef, 0x123defed);
}
int type;
struct capability *cap;
ret = -ESRCH;
d = rcu_lock_domain_by_id(op->domain);
......@@ -1117,15 +1131,14 @@ long do_domctl(XEN_GUEST_HANDLE(xen_domctl_t) u_domctl)
TT_ERR("Failed to rcu_lock_dom_by_id:%d\n", op->domain);
break;
}
cap = op->u.cap_check.cap;
type = op->u.cap_check.type;
TT_DBG(TXT_FG_GREEN "Adding xen_cap_check: Domain %d, Type: %d"TXT_FG_WHITE"\n",
d->domain_id, op->u.xen_cap_check.capid);
xen_cap_check(d, T);
ret = cap_check(d,type,cap);
rcu_unlock_domain(d);
ret = 0;
}
break;
#endif /* CONFIG_XENCAP */
......
......@@ -9,45 +9,46 @@
* Date: September 2012
*/
#include <xen/config.h>
#include <xen/types.h>
#include <xen/lib.h>
#include <xen/err.h>
#include <xen/mm.h>
#include <xen/sched.h>
#include <xen/sched-if.h>
#include <xen/domain.h>
#include <xen/event.h>
#include <xen/domain_page.h>
#include <xen/trace.h>
#include <xen/console.h>
#include <xen/xmalloc.h>
#include <xen/iocap.h>
#include <xen/rcupdate.h>
#include <xen/guest_access.h>
#include <xen/bitmap.h>
//#include <xen/xmalloc.h>
#include <xen/paging.h>
#include <xen/hypercall.h>
#include <asm/current.h>
#include <asm/page.h>
#include <public/domctl.h>
#include <xen/xen-cap.h>
#include <xen/init.h>
#include <xen/lib.h>
#include <public/xen.h>
#include <public/platform.h>
#include <public/physdev.h>
#include <xen/xen-cap.h>
#include <asm/msi.h>
#include <xen/cpumask.h>
#include <xen/sched.h>
#include <xen/cpumask.h>
#include <xen/errno.h>
#include <xen/guest_access.h>
#include <xen/xenoprof.h>
#include <asm/msi.h>
#include <public/xen.h>
#include <xen/mm.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.
*/
struct cap_boot_info *CAP_BOOT_INFO;
uint32_t RNGQ[4096], RNG_CARRY = 362436;
void init_rand(uint32_t x)
{
int i;
RNGQ[0] = x;
RNGQ[1] = x + PHI;
RNGQ[2] = x + PHI + PHI;
for (i = 3; i < 4096; i++)
RNGQ[i] = RNGQ[i - 3] ^ RNGQ[i - 2] ^ PHI ^ i;
}
uint32_t rand_cmwc(void)
{
uint64_t t, a = 18782LL;
static uint32_t i = 4095;
uint32_t x, r = 0xfffffffe;
i = (i + 1) & 4095;
t = a * RNGQ[i] + RNG_CARRY;
RNG_CARRY = (t >> 32);
x = t + RNG_CARRY;
if (x < RNG_CARRY) {
x++;
RNG_CARRY++;
}
return (RNGQ[i] = r - x);
}
/*
......@@ -56,15 +57,21 @@
* DomU has to be granted capabilities.
*/
static int cap_init(void)
int cap_init(void)
{
int ret = 0;
printk("In cap_init()\n");
printk(" -cap_share_boot_info_page()\n");
/* Initialize the boot info page. */
ret = cap_share_boot_info_page();
if ( ret == -1 )
return ret; /* Failed */
printk(" -cap_init_hypercalls()\n");
/* Initialize the capabilities for hypercalls */
ret = cap_init_hypercalls();
......@@ -72,71 +79,87 @@ static int cap_init(void)
/* TO-DO: Initialize other resources here with
* capabilities.
*/
printk("Leaving cap_init()\n");
return ret;
}
static int cap_share_boot_info_page()
int cap_share_boot_info_page()
{
unsigned long order, cap_boot_info_size;
int i, ret = 0;
printk("In cap_share_boot_info_page()\n");
printk(" - get_order_from_bytes()\n");
order = get_order_from_bytes(sizeof(struct cap_boot_info));
printk(" - alloc_xenheap_pages()\n");
/* Allocate page for cap_boot_info */
if ( (CAP_BOOT_INFO = alloc_xenheap_pages(order)) == NULL ) {
if ( (CAP_BOOT_INFO = alloc_xenheap_pages(order,0)) == NULL ) {
TT_ERR("Capability boot info: memory allocation failed\n");
ret = -1; goto cleanup;
}
cap_boot_info_size = 1 << order;
printk(" - share_xen_page_with_privileged_guests()\n");
/* Share cap_boot_info with the hypervisor */
for ( i = 0; i < cap_boot_info_size; ++i )
{
share_xen_page_with_privileged_guests(
virt_to_page(CAP_BOOT_INFO) + i, XENSHARE_readable);
virt_to_page(CAP_BOOT_INFO) + i, XENSHARE_readonly);
}