bitkeeper revision 1.717 (402a69d0603eYoV240buOqj3mgegjA)

Many files:
  Move everything except the Python toolset to 64-bit domain identifiers.
.del-block.c~add8486d96ee5b5f:
  Delete: xen/common/block.c
This commit is contained in:
kaf24@scramble.cl.cam.ac.uk committed 2004-02-11 17:43:44 +00:00
1 parent a5ba5d3f2b
commit f2cf789e7e
45 files changed
+524 -493

No files matched your search

-1
View File
@@ -126,7 +126,6 @@
3ddb79bcOMCu9-5mKpjIh5d0qqBDPg xen/arch/i386/xeno.lds
3ddb79bdff-gj-jFGKjOejeHLqL8Lg xen/common/Makefile
3e397e66AyyD5fYraAySWuwi9uqSXg xen/common/ac_timer.c
3ddb79bddEYJbcURvqqcx99Yl2iAhQ xen/common/block.c
3ddb79bdrqnW93GR9gZk1OJe1qK-iQ xen/common/brlock.c
3fb10d07GscSWPKxBqpvNfU-dYfa0g xen/common/console.c
4022a73c_BbDFd2YJ_NQYVvKX5Oz7w xen/common/debug-linux.c
+35 -24
View File
@@ -9,12 +9,21 @@
#ifndef __XC_H__
#define __XC_H__
typedef unsigned char u8;
typedef unsigned short u16;
typedef unsigned long u32;
typedef unsigned long long u64;
typedef signed char s8;
typedef signed short s16;
typedef signed long s32;
typedef signed long long s64;
/* Obtain or relinquish a handle on the 'xc' library. */
int xc_interface_open(void);
int xc_interface_close(int xc_handle);
typedef struct {
unsigned int domid;
u64 domid;
unsigned int cpu;
int has_cpu;
int stopped;
@@ -26,44 +35,46 @@ typedef struct {
int xc_domain_create(int xc_handle,
unsigned int mem_kb,
const char *name);
const char *name,
u64 *pdomid);
int xc_domain_start(int xc_handle,
unsigned int domid);
u64 domid);
int xc_domain_stop(int xc_handle,
unsigned int domid);
u64 domid);
int xc_domain_destroy(int xc_handle,
unsigned int domid,
u64 domid,
int force);
int xc_domain_pincpu(int xc_handle,
unsigned int domid,
u64 domid,
int cpu);
int xc_domain_getinfo(int xc_handle,
unsigned int first_domid,
u64 first_domid,
unsigned int max_doms,
xc_dominfo_t *info);
int xc_linux_save(int xc_handle,
unsigned int domid,
u64 domid,
const char *state_file,
int verbose);
int xc_linux_restore(int xc_handle,
const char *state_file,
int verbose);
int verbose,
u64 *pdomid);
int xc_linux_build(int xc_handle,
unsigned int domid,
u64 domid,
const char *image_name,
const char *ramdisk_name,
const char *cmdline);
int xc_netbsd_build(int xc_handle,
unsigned int domid,
u64 domid,
const char *image_name,
const char *cmdline);
int xc_bvtsched_global_set(int xc_handle,
unsigned long ctx_allow);
int xc_bvtsched_domain_set(int xc_handle,
unsigned int domid,
u64 domid,
unsigned long mcuadv,
unsigned long warp,
unsigned long warpl,
@@ -80,21 +91,21 @@ typedef struct {
} xc_vif_stats_t;
int xc_vif_scheduler_set(int xc_handle,
unsigned int domid,
u64 domid,
unsigned int vifid,
xc_vif_sched_params_t *params);
int xc_vif_scheduler_get(int xc_handle,
unsigned int domid,
u64 domid,
unsigned int vifid,
xc_vif_sched_params_t *params);
int xc_vif_stats_get(int xc_handle,
unsigned int domid,
u64 domid,
unsigned int vifid,
xc_vif_stats_t *stats);
typedef struct {
#define XC_VBDDOM_PROBE_ALL (~0U)
unsigned int domid;
#define XC_VBDDOM_PROBE_ALL (~0ULL)
u64 domid;
unsigned short vbdid;
#define XC_VBDF_WRITEABLE (1<<0)
unsigned long flags;
@@ -108,32 +119,32 @@ typedef struct {
} xc_vbdextent_t;
int xc_vbd_create(int xc_handle,
unsigned int domid,
u64 domid,
unsigned short vbdid,
int writeable);
int xc_vbd_destroy(int xc_handle,
unsigned int domid,
u64 domid,
unsigned short vbdid);
int xc_vbd_grow(int xc_handle,
unsigned int domid,
u64 domid,
unsigned short vbdid,
xc_vbdextent_t *extent);
int xc_vbd_shrink(int xc_handle,
unsigned int domid,
u64 domid,
unsigned short vbdid);
int xc_vbd_setextents(int xc_handle,
unsigned int domid,
u64 domid,
unsigned short vbdid,
unsigned int nr_extents,
xc_vbdextent_t *extents);
int xc_vbd_getextents(int xc_handle,
unsigned int domid,
u64 domid,
unsigned short vbdid,
unsigned int max_extents,
xc_vbdextent_t *extents,
int *writeable);
int xc_vbd_probe(int xc_handle,
unsigned int domid,
u64 domid,
unsigned int max_vbds,
xc_vbd_t *vbds);
+1 -1
View File
@@ -18,7 +18,7 @@ int xc_bvtsched_global_set(int xc_handle,
}
int xc_bvtsched_domain_set(int xc_handle,
unsigned int domid,
domid_t domid,
unsigned long mcuadv,
unsigned long warp,
unsigned long warpl,
+13 -10
View File
@@ -10,7 +10,8 @@
int xc_domain_create(int xc_handle,
unsigned int mem_kb,
const char *name)
const char *name,
domid_t *pdomid)
{
int err;
dom0_op_t op;
@@ -20,14 +21,15 @@ int xc_domain_create(int xc_handle,
strncpy(op.u.createdomain.name, name, MAX_DOMAIN_NAME);
op.u.createdomain.name[MAX_DOMAIN_NAME-1] = '\0';
err = do_dom0_op(xc_handle, &op);
if ( (err = do_dom0_op(xc_handle, &op)) == 0 )
*pdomid = op.u.createdomain.domain;
return (err < 0) ? err : op.u.createdomain.domain;
return err;
}
int xc_domain_start(int xc_handle,
unsigned int domid)
domid_t domid)
{
dom0_op_t op;
op.cmd = DOM0_STARTDOMAIN;
@@ -37,7 +39,7 @@ int xc_domain_start(int xc_handle,
int xc_domain_stop(int xc_handle,
unsigned int domid)
domid_t domid)
{
dom0_op_t op;
op.cmd = DOM0_STOPDOMAIN;
@@ -47,7 +49,7 @@ int xc_domain_stop(int xc_handle,
int xc_domain_destroy(int xc_handle,
unsigned int domid,
domid_t domid,
int force)
{
dom0_op_t op;
@@ -58,8 +60,8 @@ int xc_domain_destroy(int xc_handle,
}
int xc_domain_pincpu(int xc_handle,
unsigned int domid,
int cpu)
domid_t domid,
int cpu)
{
dom0_op_t op;
op.cmd = DOM0_PINCPUDOMAIN;
@@ -70,11 +72,12 @@ int xc_domain_pincpu(int xc_handle,
int xc_domain_getinfo(int xc_handle,
unsigned int first_domid,
domid_t first_domid,
unsigned int max_doms,
xc_dominfo_t *info)
{
unsigned int nr_doms, next_domid = first_domid;
unsigned int nr_doms;
domid_t next_domid = first_domid;
dom0_op_t op;
for ( nr_doms = 0; nr_doms < max_doms; nr_doms++ )
+4 -5
View File
@@ -12,7 +12,7 @@
#define L1_PROT (_PAGE_PRESENT|_PAGE_RW|_PAGE_ACCESSED)
#define L2_PROT (_PAGE_PRESENT|_PAGE_RW|_PAGE_ACCESSED|_PAGE_DIRTY|_PAGE_USER)
static long get_tot_pages(int xc_handle, int domid)
static long get_tot_pages(int xc_handle, domid_t domid)
{
dom0_op_t op;
op.cmd = DOM0_GETDOMAININFO;
@@ -22,7 +22,7 @@ static long get_tot_pages(int xc_handle, int domid)
}
static int get_pfn_list(int xc_handle,
int domid,
domid_t domid,
unsigned long *pfn_buf,
unsigned long max_pfns)
{
@@ -96,7 +96,7 @@ static int copy_to_domain_page(int pm_handle,
}
static int setup_guestos(int xc_handle,
int dom,
domid_t dom,
gzFile kernel_gfd,
gzFile initrd_gfd,
unsigned long tot_pages,
@@ -282,7 +282,6 @@ static int setup_guestos(int xc_handle,
start_info->mod_len = initrd_len;
start_info->nr_pages = tot_pages;
start_info->shared_info = shared_info_frame << PAGE_SHIFT;
start_info->dom_id = dom;
start_info->flags = 0;
strncpy(start_info->cmd_line, cmdline, MAX_CMD_LEN);
start_info->cmd_line[MAX_CMD_LEN-1] = '\0';
@@ -313,7 +312,7 @@ static int setup_guestos(int xc_handle,
}
int xc_linux_build(int xc_handle,
unsigned int domid,
domid_t domid,
const char *image_name,
const char *ramdisk_name,
const char *cmdline)
+10 -6
View File
@@ -19,7 +19,7 @@
} while ( 0 )
static int get_pfn_list(int xc_handle,
int domain_id,
domid_t domain_id,
unsigned long *pfn_buf,
unsigned long max_pfns)
{
@@ -103,11 +103,13 @@ static int checked_read(gzFile fd, void *buf, size_t count)
int xc_linux_restore(int xc_handle,
const char *state_file,
int verbose)
int verbose,
domid_t *pdomid)
{
dom0_op_t op;
int rc = 1, i, j;
unsigned long mfn, pfn, dom = 0;
unsigned long mfn, pfn;
domid_t dom = 0;
unsigned int prev_pc, this_pc;
/* Number of page frames in use by this XenoLinux session. */
@@ -370,7 +372,6 @@ int xc_linux_restore(int xc_handle,
p_srec = map_pfn(pm_handle, mfn);
p_srec->resume_info.nr_pages = nr_pfns;
p_srec->resume_info.shared_info = shared_info_frame << PAGE_SHIFT;
p_srec->resume_info.dom_id = dom;
p_srec->resume_info.flags = 0;
unmap_pfn(pm_handle, p_srec);
@@ -470,7 +471,7 @@ int xc_linux_restore(int xc_handle,
else
{
/* Success: print the domain id. */
verbose_printf("DOM=%ld\n", dom);
verbose_printf("DOM=%llu\n", dom);
}
if ( pm_handle >= 0 )
@@ -483,5 +484,8 @@ int xc_linux_restore(int xc_handle,
gzclose(gfd);
return (rc == 0) ? dom : rc;
if ( rc == 0 )
*pdomid = dom;
return rc;
}
+3 -3
View File
@@ -40,7 +40,7 @@
static int check_pfn_ownership(int xc_handle,
unsigned long mfn,
unsigned int dom)
domid_t dom)
{
dom0_op_t op;
op.cmd = DOM0_GETPAGEFRAMEINFO;
@@ -52,7 +52,7 @@ static int check_pfn_ownership(int xc_handle,
#define GETPFN_ERR (~0U)
static unsigned int get_pfn_type(int xc_handle,
unsigned long mfn,
unsigned int dom)
domid_t dom)
{
dom0_op_t op;
op.cmd = DOM0_GETPAGEFRAMEINFO;
@@ -75,7 +75,7 @@ static int checked_write(gzFile fd, void *buf, size_t count)
}
int xc_linux_save(int xc_handle,
unsigned int domid,
domid_t domid,
const char *state_file,
int verbose)
{
+4 -5
View File
@@ -22,7 +22,7 @@ static int loadelfimage(gzFile, int, unsigned long *, unsigned long,
#define L1_PROT (_PAGE_PRESENT|_PAGE_RW|_PAGE_ACCESSED)
#define L2_PROT (_PAGE_PRESENT|_PAGE_RW|_PAGE_ACCESSED|_PAGE_DIRTY|_PAGE_USER)
static long get_tot_pages(int xc_handle, int domid)
static long get_tot_pages(int xc_handle, domid_t domid)
{
dom0_op_t op;
op.cmd = DOM0_GETDOMAININFO;
@@ -32,7 +32,7 @@ static long get_tot_pages(int xc_handle, int domid)
}
static int get_pfn_list(int xc_handle,
int domid,
domid_t domid,
unsigned long *pfn_buf,
unsigned long max_pfns)
{
@@ -75,7 +75,7 @@ static int send_pgupdates(int xc_handle, mmu_update_t *updates, int nr_updates)
}
static int setup_guestos(int xc_handle,
int dom,
domid_t dom,
gzFile kernel_gfd,
unsigned long tot_pages,
unsigned long *virt_startinfo_addr,
@@ -218,7 +218,6 @@ static int setup_guestos(int xc_handle,
start_info->mod_len = symtab_len;
start_info->nr_pages = tot_pages;
start_info->shared_info = shared_info_frame << PAGE_SHIFT;
start_info->dom_id = dom;
start_info->flags = 0;
strncpy(start_info->cmd_line, cmdline, MAX_CMD_LEN);
start_info->cmd_line[MAX_CMD_LEN-1] = '\0';
@@ -249,7 +248,7 @@ static int setup_guestos(int xc_handle,
}
int xc_netbsd_build(int xc_handle,
unsigned int domid,
domid_t domid,
const char *image_name,
const char *cmdline)
{
-9
View File
@@ -2,15 +2,6 @@
#ifndef __XC_PRIVATE_H__
#define __XC_PRIVATE_H__
typedef unsigned char u8;
typedef unsigned short u16;
typedef unsigned long u32;
typedef unsigned long long u64;
typedef signed char s8;
typedef signed short s16;
typedef signed long s32;
typedef signed long long s64;
#include <unistd.h>
#include <stdio.h>
#include <errno.h>
+7 -7
View File
@@ -10,7 +10,7 @@
#include "xc_private.h"
int xc_vbd_create(int xc_handle,
unsigned int domid,
domid_t domid,
unsigned short vbdid,
int writeable)
{
@@ -24,7 +24,7 @@ int xc_vbd_create(int xc_handle,
int xc_vbd_destroy(int xc_handle,
unsigned int domid,
domid_t domid,
unsigned short vbdid)
{
block_io_op_t op;
@@ -36,7 +36,7 @@ int xc_vbd_destroy(int xc_handle,
int xc_vbd_grow(int xc_handle,
unsigned int domid,
domid_t domid,
unsigned short vbdid,
xc_vbdextent_t *extent)
{
@@ -52,7 +52,7 @@ int xc_vbd_grow(int xc_handle,
int xc_vbd_shrink(int xc_handle,
unsigned int domid,
domid_t domid,
unsigned short vbdid)
{
block_io_op_t op;
@@ -64,7 +64,7 @@ int xc_vbd_shrink(int xc_handle,
int xc_vbd_setextents(int xc_handle,
unsigned int domid,
domid_t domid,
unsigned short vbdid,
unsigned int nr_extents,
xc_vbdextent_t *extents)
@@ -110,7 +110,7 @@ int xc_vbd_setextents(int xc_handle,
int xc_vbd_getextents(int xc_handle,
unsigned int domid,
domid_t domid,
unsigned short vbdid,
unsigned int max_extents,
xc_vbdextent_t *extents,
@@ -159,7 +159,7 @@ int xc_vbd_getextents(int xc_handle,
int xc_vbd_probe(int xc_handle,
unsigned int domid,
domid_t domid,
unsigned int max_vbds,
xc_vbd_t *vbds)
{
+3 -3
View File
@@ -9,7 +9,7 @@
#include "xc_private.h"
int xc_vif_scheduler_set(int xc_handle,
unsigned int domid,
domid_t domid,
unsigned int vifid,
xc_vif_sched_params_t *params)
{
@@ -24,7 +24,7 @@ int xc_vif_scheduler_set(int xc_handle,
int xc_vif_scheduler_get(int xc_handle,
unsigned int domid,
domid_t domid,
unsigned int vifid,
xc_vif_sched_params_t *params)
{
@@ -46,7 +46,7 @@ int xc_vif_scheduler_get(int xc_handle,
int xc_vif_stats_get(int xc_handle,
unsigned int domid,
domid_t domid,
unsigned int vifid,
xc_vif_stats_t *stats)
{
+118 -103
View File
@@ -24,6 +24,7 @@ static PyObject *pyxc_domain_create(PyObject *self,
unsigned int mem_kb = 65536;
char *name = "(anon)";
u64 dom;
int ret;
static char *kwd_list[] = { "mem_kb", "name", NULL };
@@ -32,9 +33,10 @@ static PyObject *pyxc_domain_create(PyObject *self,
&mem_kb, &name) )
return NULL;
ret = xc_domain_create(xc->xc_handle, mem_kb, name);
return PyInt_FromLong(ret);
if ( (ret = xc_domain_create(xc->xc_handle, mem_kb, name, &dom)) < 0 )
return PyLong_FromLong(ret);
return PyLong_FromUnsignedLongLong(dom);
}
static PyObject *pyxc_domain_start(PyObject *self,
@@ -43,12 +45,12 @@ static PyObject *pyxc_domain_start(PyObject *self,
{
XcObject *xc = (XcObject *)self;
unsigned int dom;
int ret;
u64 dom;
int ret;
static char *kwd_list[] = { "dom", NULL };
if ( !PyArg_ParseTupleAndKeywords(args, kwds, "i", kwd_list, &dom) )
if ( !PyArg_ParseTupleAndKeywords(args, kwds, "L", kwd_list, &dom) )
return NULL;
ret = xc_domain_start(xc->xc_handle, dom);
@@ -62,12 +64,12 @@ static PyObject *pyxc_domain_stop(PyObject *self,
{
XcObject *xc = (XcObject *)self;
unsigned int dom;
int ret;
u64 dom;
int ret;
static char *kwd_list[] = { "dom", NULL };
if ( !PyArg_ParseTupleAndKeywords(args, kwds, "i", kwd_list, &dom) )
if ( !PyArg_ParseTupleAndKeywords(args, kwds, "L", kwd_list, &dom) )
return NULL;
ret = xc_domain_stop(xc->xc_handle, dom);
@@ -81,12 +83,12 @@ static PyObject *pyxc_domain_destroy(PyObject *self,
{
XcObject *xc = (XcObject *)self;
unsigned int dom;
int force = 0, ret;
u64 dom;
int force = 0, ret;
static char *kwd_list[] = { "dom", "force", NULL };
if ( !PyArg_ParseTupleAndKeywords(args, kwds, "i|i", kwd_list,
if ( !PyArg_ParseTupleAndKeywords(args, kwds, "L|i", kwd_list,
&dom, &force) )
return NULL;
@@ -101,12 +103,12 @@ static PyObject *pyxc_domain_pincpu(PyObject *self,
{
XcObject *xc = (XcObject *)self;
unsigned int dom;
int cpu, ret;
u64 dom;
int cpu = -1, ret;
static char *kwd_list[] = { "dom", "cpu", NULL };
if ( !PyArg_ParseTupleAndKeywords(args, kwds, "i|i", kwd_list,
if ( !PyArg_ParseTupleAndKeywords(args, kwds, "L|i", kwd_list,
&dom, &cpu) )
return NULL;
@@ -122,13 +124,13 @@ static PyObject *pyxc_domain_getinfo(PyObject *self,
XcObject *xc = (XcObject *)self;
PyObject *list;
unsigned int first_dom = 0, max_doms = 1024;
int nr_doms, i;
u64 first_dom = 0;
int max_doms = 1024, nr_doms, i;
xc_dominfo_t *info;
static char *kwd_list[] = { "first_dom", "max_doms", NULL };
if ( !PyArg_ParseTupleAndKeywords(args, kwds, "|ii", kwd_list,
if ( !PyArg_ParseTupleAndKeywords(args, kwds, "|Li", kwd_list,
&first_dom, &max_doms) )
return NULL;
@@ -143,7 +145,7 @@ static PyObject *pyxc_domain_getinfo(PyObject *self,
{
PyList_SetItem(
list, i,
Py_BuildValue("{s:i,s:i,s:i,s:i,s:l,s:L,s:s}",
Py_BuildValue("{s:L,s:i,s:i,s:i,s:l,s:L,s:s}",
"dom", info[i].domid,
"cpu", info[i].cpu,
"running", info[i].has_cpu,
@@ -165,13 +167,13 @@ static PyObject *pyxc_linux_save(PyObject *self,
{
XcObject *xc = (XcObject *)self;
unsigned int dom;
char *state_file;
int progress = 1, ret;
u64 dom;
char *state_file;
int progress = 1, ret;
static char *kwd_list[] = { "dom", "state_file", "progress", NULL };
if ( !PyArg_ParseTupleAndKeywords(args, kwds, "is|i", kwd_list,
if ( !PyArg_ParseTupleAndKeywords(args, kwds, "Ls|i", kwd_list,
&dom, &state_file, &progress) )
return NULL;
@@ -188,6 +190,7 @@ static PyObject *pyxc_linux_restore(PyObject *self,
char *state_file;
int progress = 1, ret;
u64 dom;
static char *kwd_list[] = { "state_file", "progress", NULL };
@@ -195,9 +198,11 @@ static PyObject *pyxc_linux_restore(PyObject *self,
&state_file, &progress) )
return NULL;
ret = xc_linux_restore(xc->xc_handle, state_file, progress);
return PyInt_FromLong(ret);
ret = xc_linux_restore(xc->xc_handle, state_file, progress, &dom);
if ( ret < 0 )
return PyLong_FromLong(ret);
return PyLong_FromUnsignedLongLong(dom);
}
static PyObject *pyxc_linux_build(PyObject *self,
@@ -206,13 +211,13 @@ static PyObject *pyxc_linux_build(PyObject *self,
{
XcObject *xc = (XcObject *)self;
unsigned int dom;
char *image, *ramdisk = NULL, *cmdline = "";
int ret;
u64 dom;
char *image, *ramdisk = NULL, *cmdline = "";
int ret;
static char *kwd_list[] = { "dom", "image", "ramdisk", "cmdline", NULL };
if ( !PyArg_ParseTupleAndKeywords(args, kwds, "is|ss", kwd_list,
if ( !PyArg_ParseTupleAndKeywords(args, kwds, "Ls|ss", kwd_list,
&dom, &image, &ramdisk, &cmdline) )
return NULL;
@@ -227,13 +232,13 @@ static PyObject *pyxc_netbsd_build(PyObject *self,
{
XcObject *xc = (XcObject *)self;
unsigned int dom;
char *image, *ramdisk = NULL, *cmdline = "";
int ret;
u64 dom;
char *image, *ramdisk = NULL, *cmdline = "";
int ret;
static char *kwd_list[] = { "dom", "image", "ramdisk", "cmdline", NULL };
if ( !PyArg_ParseTupleAndKeywords(args, kwds, "is|ss", kwd_list,
if ( !PyArg_ParseTupleAndKeywords(args, kwds, "Ls|ss", kwd_list,
&dom, &image, &ramdisk, &cmdline) )
return NULL;
@@ -267,14 +272,14 @@ static PyObject *pyxc_bvtsched_domain_set(PyObject *self,
{
XcObject *xc = (XcObject *)self;
unsigned int dom;
u64 dom;
unsigned long mcuadv, warp, warpl, warpu;
int ret;
static char *kwd_list[] = { "dom", "mcuadv", "warp", "warpl",
"warpu", NULL };
if ( !PyArg_ParseTupleAndKeywords(args, kwds, "illll", kwd_list,
if ( !PyArg_ParseTupleAndKeywords(args, kwds, "Lllll", kwd_list,
&dom, &mcuadv, &warp, &warpl, &warpu) )
return NULL;
@@ -290,14 +295,15 @@ static PyObject *pyxc_vif_scheduler_set(PyObject *self,
{
XcObject *xc = (XcObject *)self;
unsigned int dom, vif;
u64 dom;
unsigned int vif;
xc_vif_sched_params_t sched = { 0, 0 };
int ret;
static char *kwd_list[] = { "dom", "vif", "credit_bytes",
"credit_usecs", NULL };
if ( !PyArg_ParseTupleAndKeywords(args, kwds, "ii|ll", kwd_list,
if ( !PyArg_ParseTupleAndKeywords(args, kwds, "Li|ll", kwd_list,
&dom, &vif,
&sched.credit_bytes,
&sched.credit_usec) )
@@ -315,13 +321,14 @@ static PyObject *pyxc_vif_scheduler_get(PyObject *self,
XcObject *xc = (XcObject *)self;
PyObject *dict;
unsigned int dom, vif;
u64 dom;
unsigned int vif;
xc_vif_sched_params_t sched;
int ret;
static char *kwd_list[] = { "dom", "vif", NULL };
if ( !PyArg_ParseTupleAndKeywords(args, kwds, "ii", kwd_list,
if ( !PyArg_ParseTupleAndKeywords(args, kwds, "Li", kwd_list,
&dom, &vif) )
return NULL;
@@ -344,13 +351,14 @@ static PyObject *pyxc_vif_stats_get(PyObject *self,
XcObject *xc = (XcObject *)self;
PyObject *dict;
unsigned int dom, vif;
u64 dom;
unsigned int vif;
xc_vif_stats_t stats;
int ret;
int ret;
static char *kwd_list[] = { "dom", "vif", NULL };
if ( !PyArg_ParseTupleAndKeywords(args, kwds, "ii", kwd_list,
if ( !PyArg_ParseTupleAndKeywords(args, kwds, "Li", kwd_list,
&dom, &vif) )
return NULL;
@@ -374,12 +382,13 @@ static PyObject *pyxc_vbd_create(PyObject *self,
{
XcObject *xc = (XcObject *)self;
unsigned int dom, vbd;
u64 dom;
unsigned int vbd;
int writeable, ret;
static char *kwd_list[] = { "dom", "vbd", "writeable", NULL };
if ( !PyArg_ParseTupleAndKeywords(args, kwds, "iii", kwd_list,
if ( !PyArg_ParseTupleAndKeywords(args, kwds, "Lii", kwd_list,
&dom, &vbd, &writeable) )
return NULL;
@@ -394,12 +403,13 @@ static PyObject *pyxc_vbd_destroy(PyObject *self,
{
XcObject *xc = (XcObject *)self;
unsigned int dom, vbd;
u64 dom;
unsigned int vbd;
int ret;
static char *kwd_list[] = { "dom", "vbd", NULL };
if ( !PyArg_ParseTupleAndKeywords(args, kwds, "ii", kwd_list,
if ( !PyArg_ParseTupleAndKeywords(args, kwds, "Li", kwd_list,
&dom, &vbd) )
return NULL;
@@ -414,14 +424,15 @@ static PyObject *pyxc_vbd_grow(PyObject *self,
{
XcObject *xc = (XcObject *)self;
unsigned int dom, vbd;
u64 dom;
unsigned int vbd;
xc_vbdextent_t extent;
int ret;
static char *kwd_list[] = { "dom", "vbd", "device",
"start_sector", "nr_sectors", NULL };
if ( !PyArg_ParseTupleAndKeywords(args, kwds, "iiill", kwd_list,
if ( !PyArg_ParseTupleAndKeywords(args, kwds, "Liill", kwd_list,
&dom, &vbd,
&extent.real_device,
&extent.start_sector,
@@ -439,12 +450,13 @@ static PyObject *pyxc_vbd_shrink(PyObject *self,
{
XcObject *xc = (XcObject *)self;
unsigned int dom, vbd;
int ret;
u64 dom;
unsigned int vbd;
int ret;
static char *kwd_list[] = { "dom", "vbd", NULL };
if ( !PyArg_ParseTupleAndKeywords(args, kwds, "ii", kwd_list,
if ( !PyArg_ParseTupleAndKeywords(args, kwds, "Li", kwd_list,
&dom, &vbd) )
return NULL;
@@ -460,13 +472,14 @@ static PyObject *pyxc_vbd_setextents(PyObject *self,
XcObject *xc = (XcObject *)self;
PyObject *list, *dict, *obj;
unsigned int dom, vbd;
u64 dom;
unsigned int vbd;
xc_vbdextent_t *extents = NULL;
int ret, i, nr_extents;
static char *kwd_list[] = { "dom", "vbd", "extents", NULL };
if ( !PyArg_ParseTupleAndKeywords(args, kwds, "iiO", kwd_list,
if ( !PyArg_ParseTupleAndKeywords(args, kwds, "LiO", kwd_list,
&dom, &vbd, &list) )
goto fail;
@@ -520,13 +533,14 @@ static PyObject *pyxc_vbd_getextents(PyObject *self,
XcObject *xc = (XcObject *)self;
PyObject *list;
unsigned int dom, vbd;
u64 dom;
unsigned int vbd;
xc_vbdextent_t *extents;
int i, nr_extents, max_extents;
static char *kwd_list[] = { "dom", "vbd", NULL };
if ( !PyArg_ParseTupleAndKeywords(args, kwds, "ii", kwd_list,
if ( !PyArg_ParseTupleAndKeywords(args, kwds, "Li", kwd_list,
&dom, &vbd) )
return NULL;
@@ -570,13 +584,14 @@ static PyObject *pyxc_vbd_probe(PyObject *self,
XcObject *xc = (XcObject *)self;
PyObject *list;
unsigned int dom = XC_VBDDOM_PROBE_ALL, max_vbds = 1024;
u64 dom = XC_VBDDOM_PROBE_ALL;
unsigned int max_vbds = 1024;
xc_vbd_t *info;
int nr_vbds, i;
static char *kwd_list[] = { "dom", "max_vbds", NULL };
if ( !PyArg_ParseTupleAndKeywords(args, kwds, "|ii", kwd_list,
if ( !PyArg_ParseTupleAndKeywords(args, kwds, "|Li", kwd_list,
&dom, &max_vbds) )
return NULL;
@@ -591,7 +606,7 @@ static PyObject *pyxc_vbd_probe(PyObject *self,
{
PyList_SetItem(
list, i,
Py_BuildValue("{s:i,s:i,s:i,s:l}",
Py_BuildValue("{s:L,s:i,s:i,s:l}",
"dom", info[i].domid,
"vbd", info[i].vbdid,
"writeable", !!(info[i].flags & XC_VBDF_WRITEABLE),
@@ -631,27 +646,27 @@ static PyMethodDef pyxc_methods[] = {
"Create a new domain.\n"
" mem_kb [int, 65536]: Memory allocation, in kilobytes.\n"
" name [str, '(anon)']: Informative textual name.\n\n"
"Returns: [int] new domain identifier; -1 on error.\n" },
"Returns: [long] new domain identifier; -1 on error.\n" },
{ "domain_start",
(PyCFunction)pyxc_domain_start,
METH_VARARGS | METH_KEYWORDS, "\n"
"Start execution of a domain.\n"
" dom [int]: Identifier of domain to be started.\n\n"
" dom [long]: Identifier of domain to be started.\n\n"
"Returns: [int] 0 on success; -1 on error.\n" },
{ "domain_stop",
(PyCFunction)pyxc_domain_stop,
METH_VARARGS | METH_KEYWORDS, "\n"
"Stop execution of a domain.\n"
" dom [int]: Identifier of domain to be stopped.\n\n"
" dom [long]: Identifier of domain to be stopped.\n\n"
"Returns: [int] 0 on success; -1 on error.\n" },
{ "domain_destroy",
(PyCFunction)pyxc_domain_destroy,
METH_VARARGS | METH_KEYWORDS, "\n"
"Destroy a domain.\n"
" dom [int]: Identifier of domain to be destroyed.\n"
" dom [long]: Identifier of domain to be destroyed.\n"
" force [int, 0]: Bool - force immediate destruction?\n\n"
"Returns: [int] 0 on success; -1 on error.\n" },
@@ -659,21 +674,21 @@ static PyMethodDef pyxc_methods[] = {
(PyCFunction)pyxc_domain_pincpu,
METH_VARARGS | METH_KEYWORDS, "\n"
"Pin a domain to a specified CPU.\n"
" dom [int]: Identifier of domain to be destroyed.\n"
" force [int, -1]: CPU to pin to, or -1 to unpin\n\n"
" dom [long]: Identifier of domain to be destroyed.\n"
" cpu [int, -1]: CPU to pin to, or -1 to unpin\n\n"
"Returns: [int] 0 on success; -1 on error.\n" },
{ "domain_getinfo",
(PyCFunction)pyxc_domain_getinfo,
METH_VARARGS | METH_KEYWORDS, "\n"
"Get information regarding a set of domains, in increasing id order.\n"
" first_dom [int, 0]: First domain to retrieve info about.\n"
" first_dom [long, 0]: First domain to retrieve info about.\n"
" max_doms [int, 1024]: Maximum number of domains to retrieve info"
" about.\n\n"
"Returns: [list of dicts] if list length is less than 'max_doms'\n"
" parameter then there was an error, or the end of the\n"
" domain-id space was reached.\n"
" dom [int]: Identifier of domain to which this info pertains\n"
" dom [long]: Identifier of domain to which this info pertains\n"
" cpu [int]: CPU to which this domain is bound\n"
" running [int]: Bool - is the domain currently running?\n"
" stopped [int]: Bool - is the domain suspended?\n"
@@ -685,7 +700,7 @@ static PyMethodDef pyxc_methods[] = {
(PyCFunction)pyxc_linux_save,
METH_VARARGS | METH_KEYWORDS, "\n"
"Save the CPU and memory state of a Linux guest OS.\n"
" dom [int]: Identifier of domain to be saved.\n"
" dom [long]: Identifier of domain to be saved.\n"
" state_file [str]: Name of state file. Must not currently exist.\n"
" progress [int, 1]: Bool - display a running progress indication?\n\n"
"Returns: [int] 0 on success; -1 on error.\n" },
@@ -696,26 +711,26 @@ static PyMethodDef pyxc_methods[] = {
"Restore the CPU and memory state of a Linux guest OS.\n"
" state_file [str]: Name of state file. Must not currently exist.\n"
" progress [int, 1]: Bool - display a running progress indication?\n\n"
"Returns: [int] new domain identifier on success; -1 on error.\n" },
"Returns: [long] new domain identifier on success; -1 on error.\n" },
{ "linux_build",
(PyCFunction)pyxc_linux_build,
METH_VARARGS | METH_KEYWORDS, "\n"
"Build a new Linux guest OS.\n"
" dom [int]: Identifier of domain to build into.\n"
" dom [long]: Identifier of domain to build into.\n"
" image [str]: Name of kernel image file. May be gzipped.\n"
" ramdisk [str, n/a]: Name of ramdisk file, if any.\n"
" cmdline [str, n/a]: Kernel parameters, if any.\n\n"
"Returns: [int] new domain identifier on success; -1 on error.\n" },
"Returns: [int] 0 on success; -1 on error.\n" },
{ "netbsd_build",
(PyCFunction)pyxc_netbsd_build,
METH_VARARGS | METH_KEYWORDS, "\n"
"Build a new NetBSD guest OS.\n"
" dom [int]: Identifier of domain to build into.\n"
" dom [long]: Identifier of domain to build into.\n"
" image [str]: Name of kernel image file. May be gzipped.\n"
" cmdline [str, n/a]: Kernel parameters, if any.\n\n"
"Returns: [int] new domain identifier on success; -1 on error.\n" },
"Returns: [int] 0 on success; -1 on error.\n" },
{ "bvtsched_global_set",
(PyCFunction)pyxc_bvtsched_global_set,
@@ -728,18 +743,18 @@ static PyMethodDef pyxc_methods[] = {
(PyCFunction)pyxc_bvtsched_domain_set,
METH_VARARGS | METH_KEYWORDS, "\n"
"Set per-domain tuning parameters for Borrowed Virtual Time scheduler.\n"
" dom [int]: Identifier of domain to be tuned.\n"
" mcuadv [int]: Internal BVT parameter.\n"
" warp [int]: Internal BVT parameter.\n"
" warpl [int]: Internal BVT parameter.\n"
" warpu [int]: Internal BVT parameter.\n\n"
" dom [long]: Identifier of domain to be tuned.\n"
" mcuadv [int]: Internal BVT parameter.\n"
" warp [int]: Internal BVT parameter.\n"
" warpl [int]: Internal BVT parameter.\n"
" warpu [int]: Internal BVT parameter.\n\n"
"Returns: [int] 0 on success; -1 on error.\n" },
{ "vif_scheduler_set",
(PyCFunction)pyxc_vif_scheduler_set,
METH_VARARGS | METH_KEYWORDS, "\n"
"Set per-network-interface scheduling parameters.\n"
" dom [int]: Identifier of domain to be adjusted.\n"
" dom [long]: Identifier of domain to be adjusted.\n"
" vif [int]: Identifier of VIF to be adjusted.\n"
" credit_bytes [int, 0]: Tx bytes permitted each interval.\n"
" credit_usecs [int, 0]: Interval, in usecs. 0 == no scheduling.\n\n"
@@ -749,7 +764,7 @@ static PyMethodDef pyxc_methods[] = {
(PyCFunction)pyxc_vif_scheduler_get,
METH_VARARGS | METH_KEYWORDS, "\n"
"Query the per-network-interface scheduling parameters.\n"
" dom [int]: Identifier of domain to be queried.\n"
" dom [long]: Identifier of domain to be queried.\n"
" vif [int]: Identifier of VIF to be queried.\n\n"
"Returns: [dict] dictionary is empty on failure.\n"
" credit_bytes [int]: Tx bytes permitted each interval.\n"
@@ -759,8 +774,8 @@ static PyMethodDef pyxc_methods[] = {
(PyCFunction)pyxc_vif_stats_get,
METH_VARARGS | METH_KEYWORDS, "\n"
"Query the per-network-interface statistics.\n"
" dom [int]: Identifier of domain to be queried.\n"
" vif [int]: Identifier of VIF to be queried.\n\n"
" dom [long]: Identifier of domain to be queried.\n"
" vif [int]: Identifier of VIF to be queried.\n\n"
"Returns: [dict] dictionary is empty on failure.\n"
" tx_bytes [long]: Bytes transmitted.\n"
" tx_packets [long]: Packets transmitted.\n"
@@ -771,44 +786,44 @@ static PyMethodDef pyxc_methods[] = {
(PyCFunction)pyxc_vbd_create,
METH_VARARGS | METH_KEYWORDS, "\n"
"Create a new virtual block device associated with a given domain.\n"
" dom [int]: Identifier of domain to get a new VBD.\n"
" vbd [int]: Identifier for new VBD.\n"
" writeable [int]: Bool - is the new VBD writeable?\n\n"
" dom [long]: Identifier of domain to get a new VBD.\n"
" vbd [int]: Identifier for new VBD.\n"
" writeable [int]: Bool - is the new VBD writeable?\n\n"
"Returns: [int] 0 on success; -1 on error.\n" },
{ "vbd_destroy",
(PyCFunction)pyxc_vbd_destroy,
METH_VARARGS | METH_KEYWORDS, "\n"
"Destroy a virtual block device.\n"
" dom [int]: Identifier of domain containing the VBD.\n"
" vbd [int]: Identifier of the VBD.\n\n"
" dom [long]: Identifier of domain containing the VBD.\n"
" vbd [int]: Identifier of the VBD.\n\n"
"Returns: [int] 0 on success; -1 on error.\n" },
{ "vbd_grow",
(PyCFunction)pyxc_vbd_grow,
METH_VARARGS | METH_KEYWORDS, "\n"
"Grow a virtual block device by appending a new extent.\n"
" dom [int]: Identifier of domain containing the VBD.\n"
" vbd [int]: Identifier of the VBD.\n"
" device [int]: Identifier of the real underlying block device.\n"
" start_sector [int]: Real start sector of this extent.\n"
" nr_sectors [int]: Length, in sectors, of this extent.\n\n"
" dom [long]: Identifier of domain containing the VBD.\n"
" vbd [int]: Identifier of the VBD.\n"
" device [int]: Identifier of the real underlying block device.\n"
" start_sector [int]: Real start sector of this extent.\n"
" nr_sectors [int]: Length, in sectors, of this extent.\n\n"
"Returns: [int] 0 on success; -1 on error.\n" },
{ "vbd_shrink",
(PyCFunction)pyxc_vbd_shrink,
METH_VARARGS | METH_KEYWORDS, "\n"
"Shrink a virtual block device by deleting its final extent.\n"
" dom [int]: Identifier of domain containing the VBD.\n"
" vbd [int]: Identifier of the VBD.\n\n"
" dom [long]: Identifier of domain containing the VBD.\n"
" vbd [int]: Identifier of the VBD.\n\n"
"Returns: [int] 0 on success; -1 on error.\n" },
{ "vbd_setextents",
(PyCFunction)pyxc_vbd_setextents,
METH_VARARGS | METH_KEYWORDS, "\n"
"Set all the extent information for a virtual block device.\n"
" dom [int]: Identifier of domain containing the VBD.\n"
" vbd [int]: Identifier of the VBD.\n"
" dom [long]: Identifier of domain containing the VBD.\n"
" vbd [int]: Identifier of the VBD.\n"
" extents [list of dicts]: Per-extent information.\n"
" device [int]: Identifier of the real underlying block device.\n"
" start_sector [int]: Real start sector of this extent.\n"
@@ -819,8 +834,8 @@ static PyMethodDef pyxc_methods[] = {
(PyCFunction)pyxc_vbd_getextents,
METH_VARARGS | METH_KEYWORDS, "\n"
"Get info on all the extents in a virtual block device.\n"
" dom [int]: Identifier of domain containing the VBD.\n"
" vbd [int]: Identifier of the VBD.\n\n"
" dom [long]: Identifier of domain containing the VBD.\n"
" vbd [int]: Identifier of the VBD.\n\n"
"Returns: [list of dicts] per-extent information; empty on error.\n"
" device [int]: Identifier of the real underlying block device.\n"
" start_sector [int]: Real start sector of this extent.\n"
@@ -830,14 +845,14 @@ static PyMethodDef pyxc_methods[] = {
(PyCFunction)pyxc_vbd_probe,
METH_VARARGS | METH_KEYWORDS, "\n"
"Get information regarding extant virtual block devices.\n"
" dom [int, ALL]: Domain to query (default is to query all).\n"
" dom [long, ALL]: Domain to query (default is to query all).\n"
" max_vbds [int, 1024]: Maximum VBDs to query.\n\n"
"Returns: [list of dicts] if list length is less than 'max_vbds'\n"
" parameter then there was an error, or there were fewer vbds.\n"
" dom [int]: Domain containing this VBD.\n"
" vbd [int]: Domain-specific identifier of this VBD.\n"
" writeable [int]: Bool - is this VBD writeable?\n"
" nr_sectors [int]: Size of this VBD, in 512-byte sectors.\n" },
" dom [long]: Domain containing this VBD.\n"
" vbd [int]: Domain-specific identifier of this VBD.\n"
" writeable [int]: Bool - is this VBD writeable?\n"
" nr_sectors [int]: Size of this VBD, in 512-byte sectors.\n" },
{ "readconsolering",
(PyCFunction)pyxc_readconsolering,
+3 -3
View File
@@ -17,7 +17,7 @@ void init_fpu(void)
{
__asm__("fninit");
if ( cpu_has_xmm ) load_mxcsr(0x1f80);
current->flags |= PF_DONEFPUINIT;
set_bit(PF_DONEFPUINIT, &current->flags);
}
static inline void __save_init_fpu( struct task_struct *tsk )
@@ -29,7 +29,7 @@ static inline void __save_init_fpu( struct task_struct *tsk )
asm volatile( "fnsave %0 ; fwait"
: "=m" (tsk->thread.i387.fsave) );
}
tsk->flags &= ~PF_USEDFPU;
clear_bit(PF_USEDFPU, &tsk->flags);
}
void save_init_fpu( struct task_struct *tsk )
@@ -39,7 +39,7 @@ void save_init_fpu( struct task_struct *tsk )
* This causes us to set the real flag, so we'll need
* to temporarily clear it while saving f-p state.
*/
if ( tsk->flags & PF_GUEST_STTS ) clts();
if ( test_bit(PF_GUEST_STTS, &tsk->flags) ) clts();
__save_init_fpu(tsk);
stts();
}
+1 -1
View File
@@ -72,7 +72,7 @@ pdb_process_query (char *ptr)
pdb_out_buffer[buf_idx++] = 'm';
while ( (p = p->next_task) != &idle0_task )
{
int domain = p->domain + PDB_DOMAIN_OFFSET;
domid_t domain = p->domain + PDB_DOMAIN_OFFSET;
if (count > 0)
pdb_out_buffer[buf_idx++] = ',';
+1 -1
View File
@@ -289,7 +289,7 @@ void switch_to(struct task_struct *prev_p, struct task_struct *next_p)
/* XXX Currently the 'domain' field is ignored! XXX */
long do_iopl(unsigned int domain, unsigned int new_io_pl)
long do_iopl(domid_t domain, unsigned int new_io_pl)
{
execution_context_t *ec = get_execution_context();
ec->eflags = (ec->eflags & 0xffffcfff) | ((new_io_pl&3) << 12);
+3 -1
View File
@@ -673,7 +673,9 @@ static void __init do_boot_cpu (int apicid)
if ( (idle = do_createdomain(IDLE_DOMAIN_ID, cpu)) == NULL )
panic("failed 'createdomain' for CPU %d", cpu);
set_bit(PF_IDLETASK, &idle->flags);
idle->mm.pagetable = mk_pagetable(__pa(idle_pg_table));
map_cpu_to_boot_apicid(cpu, apicid);
+5 -6
View File
@@ -500,22 +500,21 @@ asmlinkage void math_state_restore(struct pt_regs *regs, long error_code)
/* Prevent recursion. */
clts();
if ( !(current->flags & PF_USEDFPU) )
if ( !test_bit(PF_USEDFPU, &current->flags) )
{
if ( current->flags & PF_DONEFPUINIT )
if ( test_bit(PF_DONEFPUINIT, &current->flags) )
restore_fpu(current);
else
init_fpu();
current->flags |= PF_USEDFPU; /* So we fnsave on switch_to() */
set_bit(PF_USEDFPU, &current->flags); /* so we fnsave on switch_to() */
}
if ( current->flags & PF_GUEST_STTS )
if ( test_and_clear_bit(PF_GUEST_STTS, &current->flags) )
{
struct guest_trap_bounce *gtb = guest_trap_bounce+smp_processor_id();
gtb->flags = GTBF_TRAP_NOCODE;
gtb->cs = current->thread.traps[7].cs;
gtb->eip = current->thread.traps[7].address;
current->flags &= ~PF_GUEST_STTS;
}
}
@@ -802,7 +801,7 @@ long do_set_fast_trap(int idx)
long do_fpu_taskswitch(void)
{
current->flags |= PF_GUEST_STTS;
set_bit(PF_GUEST_STTS, &current->flags);
stts();
return 0;
}
-22
View File
@@ -1,22 +0,0 @@
/* block.c
*
* ring data structures for buffering messages between hypervisor and
* guestos's.
*
*/
#include <hypervisor-ifs/block.h>
#include <xeno/lib.h>
/*
* create_block_ring
*
* domain:
*
* allocates space for a particular domain's block io ring.
*/
blk_ring_t *create_block_ring(int domain)
{
printk ("XEN create block ring <not implemented>");
return (blk_ring_t *)NULL;
}
+6 -4
View File
@@ -32,11 +32,13 @@
/* adapted from asm-xeno/page.h */
static inline unsigned long machine_to_phys(int domain, unsigned long machine)
static inline unsigned long machine_to_phys(domid_t domain,
unsigned long machine)
{
unsigned long phys;
pdb_get_values(domain, (u_char *) &phys,
(unsigned long) machine_to_phys_mapping + (machine >> PAGE_SHIFT) * 4,
(unsigned long) machine_to_phys_mapping +
(machine >> PAGE_SHIFT) * 4,
sizeof(phys));
phys = (phys << PAGE_SHIFT) | (machine & ~PAGE_MASK);
return phys;
@@ -61,7 +63,7 @@ static inline unsigned long machine_to_phys(int domain, unsigned long machine)
*/
/* read a byte from a process */
u_char pdb_linux_get_value (int domain, int pid, unsigned long addr)
u_char pdb_linux_get_value(domid_t domain, int pid, unsigned long addr)
{
u_char result = 0;
unsigned long task_struct_p, mm_p, pgd, task_struct_pid;
@@ -90,7 +92,7 @@ u_char pdb_linux_get_value (int domain, int pid, unsigned long addr)
if (task_struct_p == (unsigned long)NULL)
{
/* oops */
printk ("error: couldn't find process 0x%x in domain %d\n", pid, domain);
printk ("error: couldn't find process 0x%x in domain %llu\n", pid, domain);
return 0;
}
+12 -9
View File
@@ -23,9 +23,10 @@
/****************************************************************************/
extern int pdb_change_values (int domain, u_char *buffer, unsigned long addr,
int length, int rw);
extern u_char pdb_linux_get_value (int domain, int pid, unsigned long addr);
extern int pdb_change_values(domid_t domain,
u_char *buffer, unsigned long addr,
int length, int rw);
extern u_char pdb_linux_get_value(domid_t domain, int pid, unsigned long addr);
/*
* Set memory in a domain's address space
@@ -35,7 +36,8 @@ extern u_char pdb_linux_get_value (int domain, int pid, unsigned long addr);
* THIS WILL BECOME A MACRO
*/
int pdb_set_values (int domain, u_char *buffer, unsigned long addr, int length)
int pdb_set_values(domid_t domain,
u_char *buffer, unsigned long addr, int length)
{
int count = pdb_change_values(domain, buffer, addr, length, 2);
@@ -63,7 +65,8 @@ int pdb_set_values (int domain, u_char *buffer, unsigned long addr, int length)
* THIS WILL BECOME A MACRO
*/
int pdb_get_values (int domain, u_char *buffer, unsigned long addr, int length)
int pdb_get_values(domid_t domain,
u_char *buffer, unsigned long addr, int length)
{
return pdb_change_values(domain, buffer, addr, length, 1);
}
@@ -75,8 +78,8 @@ int pdb_get_values (int domain, u_char *buffer, unsigned long addr, int length)
* RW: 1 = read, 2 = write
*/
int pdb_change_values (int domain, u_char *buffer, unsigned long addr,
int length, int rw)
int pdb_change_values(domid_t domain, u_char *buffer, unsigned long addr,
int length, int rw)
{
struct task_struct *p;
l2_pgentry_t* l2_table = NULL;
@@ -166,7 +169,7 @@ void pdb_do_debug (dom0_op_t *op)
{
op->u.debug.status = 0;
TRC(printk("PDB: op:%c, dom:%x, in1:%x, in2:%x, in3:%x, in4:%x\n",
TRC(printk("PDB: op:%c, dom:%llu, in1:%x, in2:%x, in3:%x, in4:%x\n",
op->u.debug.opcode, op->u.debug.domain,
op->u.debug.in1, op->u.debug.in2,
op->u.debug.in3, op->u.debug.in4));
@@ -186,7 +189,7 @@ void pdb_do_debug (dom0_op_t *op)
struct task_struct * p = find_domain_by_id(op->u.debug.domain);
if ( p != NULL )
{
if ( (p->flags & PF_CONSTRUCTED) != 0 )
if ( test_bit(PF_CONSTRUCTED, &p->flags) )
{
wake_up(p);
reschedule(p);
+14 -25
View File
@@ -22,21 +22,10 @@ extern unsigned int alloc_new_dom_mem(struct task_struct *, unsigned int);
/* Basically used to protect the domain-id space. */
static spinlock_t create_dom_lock = SPIN_LOCK_UNLOCKED;
static unsigned int get_domnr(void)
static domid_t get_domnr(void)
{
static unsigned int domnr = 0;
struct task_struct *p;
int tries = 0;
for ( tries = 0; tries < 1024; tries++ )
{
domnr = (domnr+1) & ((1<<20)-1);
if ( (p = find_domain_by_id(domnr)) == NULL )
return domnr;
put_task_struct(p);
}
return 0;
static domid_t domnr = 0;
return ++domnr;
}
static int msr_cpu_mask;
@@ -101,7 +90,7 @@ long do_dom0_op(dom0_op_t *u_dom0_op)
ret = -EINVAL;
if ( p != NULL )
{
if ( (p->flags & PF_CONSTRUCTED) != 0 )
if ( test_bit(PF_CONSTRUCTED, &p->flags) )
{
wake_up(p);
reschedule(p);
@@ -122,7 +111,7 @@ long do_dom0_op(dom0_op_t *u_dom0_op)
{
struct task_struct *p;
static unsigned int pro = 0;
unsigned int dom;
domid_t dom;
ret = -ENOMEM;
spin_lock_irq(&create_dom_lock);
@@ -137,8 +126,8 @@ long do_dom0_op(dom0_op_t *u_dom0_op)
if ( op->u.createdomain.name[0] )
{
strncpy (p->name, op->u.createdomain.name, MAX_DOMAIN_NAME);
p->name[MAX_DOMAIN_NAME - 1] = 0;
strncpy(p->name, op->u.createdomain.name, MAX_DOMAIN_NAME);
p->name[MAX_DOMAIN_NAME - 1] = '\0';
}
ret = alloc_new_dom_mem(p, op->u.createdomain.memory_kb);
@@ -148,9 +137,9 @@ long do_dom0_op(dom0_op_t *u_dom0_op)
goto exit_create;
}
ret = p->domain;
ret = 0;
op->u.createdomain.domain = ret;
op->u.createdomain.domain = p->domain;
copy_to_user(u_dom0_op, op, sizeof(*op));
exit_create:
@@ -160,7 +149,7 @@ long do_dom0_op(dom0_op_t *u_dom0_op)
case DOM0_DESTROYDOMAIN:
{
unsigned int dom = op->u.destroydomain.domain;
domid_t dom = op->u.destroydomain.domain;
int force = op->u.destroydomain.force;
ret = (dom == IDLE_DOMAIN_ID) ? -EPERM : kill_other_domain(dom, force);
}
@@ -214,7 +203,7 @@ long do_dom0_op(dom0_op_t *u_dom0_op)
case DOM0_ADJUSTDOM:
{
unsigned int dom = op->u.adjustdom.domain;
domid_t dom = op->u.adjustdom.domain;
unsigned long mcu_adv = op->u.adjustdom.mcu_adv;
unsigned long warp = op->u.adjustdom.warp;
unsigned long warpl = op->u.adjustdom.warpl;
@@ -303,7 +292,7 @@ long do_dom0_op(dom0_op_t *u_dom0_op)
memcpy(&op->u.getdomaininfo.ctxt.i386_ctxt,
&p->shared_info->execution_context,
sizeof(p->shared_info->execution_context));
if ( p->flags & PF_DONEFPUINIT )
if ( test_bit(PF_DONEFPUINIT, &p->flags) )
op->u.getdomaininfo.ctxt.flags |= ECF_I387_VALID;
memcpy(&op->u.getdomaininfo.ctxt.i387_ctxt,
&p->thread.i387,
@@ -354,7 +343,7 @@ long do_dom0_op(dom0_op_t *u_dom0_op)
{
struct pfn_info *page;
unsigned long pfn = op->u.getpageframeinfo.pfn;
unsigned int dom = op->u.getpageframeinfo.domain;
domid_t dom = op->u.getpageframeinfo.domain;
struct task_struct *p;
ret = -EINVAL;
@@ -395,7 +384,7 @@ long do_dom0_op(dom0_op_t *u_dom0_op)
case DOM0_IOPL:
{
extern long do_iopl(unsigned int, unsigned int);
extern long do_iopl(domid_t, unsigned int);
ret = do_iopl(op->u.iopl.domain, op->u.iopl.iopl);
}
break;
+29 -32
View File
@@ -31,9 +31,10 @@
rwlock_t tasklist_lock __cacheline_aligned = RW_LOCK_UNLOCKED;
struct task_struct *task_hash[TASK_HASH_SIZE];
struct task_struct *do_createdomain(unsigned int dom_id, unsigned int cpu)
struct task_struct *do_createdomain(domid_t dom_id, unsigned int cpu)
{
int retval;
char buf[100];
struct task_struct *p = NULL;
unsigned long flags;
@@ -47,7 +48,10 @@ struct task_struct *do_createdomain(unsigned int dom_id, unsigned int cpu)
p->domain = dom_id;
p->processor = cpu;
sprintf(p->name, "Domain-%d", dom_id);
/* We use a large intermediate to avoid overflow in sprintf. */
sprintf(buf, "Domain-%llu", dom_id);
strncpy(p->name, buf, MAX_DOMAIN_NAME);
p->name[MAX_DOMAIN_NAME-1] = '\0';
spin_lock_init(&p->blk_ring_lock);
spin_lock_init(&p->event_channel_lock);
@@ -79,7 +83,7 @@ struct task_struct *do_createdomain(unsigned int dom_id, unsigned int cpu)
}
struct task_struct *find_domain_by_id(unsigned int dom)
struct task_struct *find_domain_by_id(domid_t dom)
{
struct task_struct *p;
unsigned long flags;
@@ -103,8 +107,7 @@ struct task_struct *find_domain_by_id(unsigned int dom)
void kill_domain_with_errmsg(const char *err)
{
printk("DOM%d FATAL ERROR: %s\n",
current->domain, err);
printk("DOM%llu FATAL ERROR: %s\n", current->domain, err);
kill_domain();
}
@@ -126,7 +129,7 @@ void __kill_domain(struct task_struct *p)
if ( !sched_rem_domain(p) )
return;
printk("Killing domain %d\n", p->domain);
printk("Killing domain %llu\n", p->domain);
unlink_blkdev_info(p);
@@ -162,7 +165,7 @@ void kill_domain(void)
}
long kill_other_domain(unsigned int dom, int force)
long kill_other_domain(domid_t dom, int force)
{
struct task_struct *p;
unsigned long cpu_mask = 0;
@@ -200,7 +203,7 @@ void stop_domain(void)
__enter_scheduler();
}
long stop_other_domain(unsigned int dom)
long stop_other_domain(domid_t dom)
{
unsigned long cpu_mask;
struct task_struct *p;
@@ -208,7 +211,7 @@ long stop_other_domain(unsigned int dom)
if ( dom == 0 )
return -EINVAL;
p = find_domain_by_id (dom);
p = find_domain_by_id(dom);
if ( p == NULL) return -ESRCH;
if ( p->state != TASK_STOPPED )
@@ -452,7 +455,7 @@ void release_task(struct task_struct *p)
ASSERT(p->state == TASK_DYING);
ASSERT(!p->has_cpu);
printk("Releasing task %d\n", p->domain);
printk("Releasing task %llu\n", p->domain);
/*
* This frees up blkdev rings and vbd-access lists. Totally safe since
@@ -480,12 +483,12 @@ int final_setup_guestos(struct task_struct *p, dom0_builddomain_t *builddomain)
unsigned long phys_l2tab;
int i;
if ( (p->flags & PF_CONSTRUCTED) )
if ( test_bit(PF_CONSTRUCTED, &p->flags) )
return -EINVAL;
p->flags &= ~PF_DONEFPUINIT;
clear_bit(PF_DONEFPUINIT, &p->flags);
if ( builddomain->ctxt.flags & ECF_I387_VALID )
p->flags |= PF_DONEFPUINIT;
set_bit(PF_DONEFPUINIT, &p->flags);
memcpy(&p->shared_info->execution_context,
&builddomain->ctxt.i386_ctxt,
sizeof(p->shared_info->execution_context));
@@ -526,7 +529,7 @@ int final_setup_guestos(struct task_struct *p, dom0_builddomain_t *builddomain)
while ( builddomain->num_vifs-- > 0 )
(void)create_net_vif(p->domain);
p->flags |= PF_CONSTRUCTED;
set_bit(PF_CONSTRUCTED, &p->flags);
return 0;
}
@@ -553,7 +556,8 @@ int setup_guestos(struct task_struct *p, dom0_createdomain_t *params,
{
struct list_head *list_ent;
char *src, *vsrc, *dst, *data_start;
int i, dom = p->domain;
int i;
domid_t dom = p->domain;
unsigned long phys_l1tab, phys_l2tab;
unsigned long cur_address, alloc_address;
unsigned long virt_load_address, virt_stack_address;
@@ -571,7 +575,7 @@ int setup_guestos(struct task_struct *p, dom0_createdomain_t *params,
/* Sanity! */
if ( p->domain != 0 ) BUG();
if ( (p->flags & PF_CONSTRUCTED) ) BUG();
if ( test_bit(PF_CONSTRUCTED, &p->flags) ) BUG();
/*
* This is all a bit grim. We've moved the modules to the "safe" physical
@@ -589,21 +593,21 @@ int setup_guestos(struct task_struct *p, dom0_createdomain_t *params,
if ( strncmp(data_start, "XenoGues", 8) )
{
printk("DOM%d: Invalid guest OS image\n", dom);
printk("DOM%llu: Invalid guest OS image\n", dom);
return -1;
}
virt_load_address = *(unsigned long *)(data_start + 8);
if ( (virt_load_address & (PAGE_SIZE-1)) )
{
printk("DOM%d: Guest OS load address not page-aligned (%08lx)\n",
printk("DOM%llu: Guest OS load address not page-aligned (%08lx)\n",
dom, virt_load_address);
return -1;
}
if ( alloc_new_dom_mem(p, params->memory_kb) )
{
printk("DOM%d: Not enough memory --- reduce dom0_mem ??\n", dom);
printk("DOM%llu: Not enough memory --- reduce dom0_mem ??\n", dom);
return -ENOMEM;
}
@@ -614,7 +618,7 @@ int setup_guestos(struct task_struct *p, dom0_createdomain_t *params,
if ( data_len > (params->memory_kb << 9) )
{
printk("DOM%d: Guest OS image is too large\n"
printk("DOM%llu: Guest OS image is too large\n"
" (%luMB is greater than %uMB limit for a\n"
" %uMB address space)\n",
dom, data_len>>20,
@@ -624,7 +628,7 @@ int setup_guestos(struct task_struct *p, dom0_createdomain_t *params,
return -1;
}
printk("DOM%d: Guest OS virtual load address is %08lx\n", dom,
printk("DOM%llu: Guest OS virtual load address is %08lx\n", dom,
virt_load_address);
SET_GDT_ENTRIES(p, DEFAULT_GDT_ENTRIES);
@@ -753,14 +757,11 @@ int setup_guestos(struct task_struct *p, dom0_createdomain_t *params,
virt_startinfo_address->pt_base = virt_load_address +
((p->tot_pages - 1) << PAGE_SHIFT);
virt_startinfo_address->dom_id = p->domain;
virt_startinfo_address->flags = 0;
if ( IS_PRIV(p) )
{
virt_startinfo_address->flags |= SIF_PRIVILEGED;
if ( CONSOLE_ISOWNER(p) )
virt_startinfo_address->flags |= SIF_CONSOLE;
}
if ( p->domain == 0 )
virt_startinfo_address->flags |= SIF_INITDOMAIN;
if ( initrd_len )
{
@@ -787,12 +788,8 @@ int setup_guestos(struct task_struct *p, dom0_createdomain_t *params,
*dst = '\0';
/* If this guy's getting the console we'd better let go. */
if ( virt_startinfo_address->flags & SIF_CONSOLE )
{
/* NB. Should reset the console here. */
if ( CONSOLE_ISOWNER(p) )
opt_console = 0;
}
/* Reinstate the caller's page tables. */
write_cr3_counted(pagetable_val(current->mm.pagetable));
@@ -819,7 +816,7 @@ int setup_guestos(struct task_struct *p, dom0_createdomain_t *params,
}
kfree(xd);
p->flags |= PF_CONSTRUCTED;
set_bit(PF_CONSTRUCTED, &p->flags);
new_thread(p,
(unsigned long)virt_load_address,
+4 -2
View File
@@ -222,6 +222,8 @@ void cmain (unsigned long magic, multiboot_info_t *mbi)
new_dom = do_createdomain(0, 0);
if ( new_dom == NULL ) panic("Error creating domain 0\n");
set_bit(PF_PRIVILEGED, &new_dom->flags);
/*
* We're going to setup domain0 using the module(s) that we stashed safely
* above our MAX_DIRECTMAP_ADDRESS in boot/Boot.S The second module, if
@@ -620,7 +622,7 @@ int console_export(char *str, int len)
unmap_domain_mem(skb_data);
skb->dst_vif = find_vif_by_id(0);
skb->dst_vif = find_net_vif(0, 0);
(void)netif_rx(skb);
return 1;
@@ -655,7 +657,7 @@ long do_console_write(char *str, unsigned int count)
spin_lock_irqsave(&console_lock, flags);
__putstr("DOM");
sprintf(dom_id, "%d", current->domain);
sprintf(dom_id, "%llu", current->domain);
__putstr(dom_id);
__putstr(": ");
+1 -1
View File
@@ -107,7 +107,7 @@ void do_task_queues(u_char key, void *dev_id, struct pt_regs *regs)
p = &idle0_task;
do {
printk("Xen: DOM %d, CPU %d [has=%c], state = %s, "
printk("Xen: DOM %llu, CPU %d [has=%c], state = %s, "
"hyp_events = %08x\n",
p->domain, p->processor, p->has_cpu ? 'T':'F',
task_states[p->state], p->hyp_events);
+123 -112
View File
@@ -1,4 +1,5 @@
/* network.c
/******************************************************************************
* network.c
*
* Network virtualization for Xen. Lower-level network interactions are in
* net/dev.c and in the drivers. This file contains routines to interact
@@ -6,6 +7,20 @@
* the use of rules.
*
* Copyright (c) 2002-2003, A K Warfield and K A Fraser
*
* 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 2 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, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <xeno/sched.h>
@@ -32,11 +47,11 @@ void print_net_rule_list();
/* ----[ VIF Functions ]----------------------------------------------------*/
net_vif_t *find_vif_by_id(unsigned long id)
net_vif_t *find_net_vif(domid_t dom, unsigned int idx)
{
struct task_struct *p;
net_vif_t *vif = NULL;
unsigned long flags, dom = id>>VIF_DOMAIN_SHIFT;
unsigned long flags;
read_lock_irqsave(&tasklist_lock, flags);
p = task_hash[TASK_HASH(dom)];
@@ -44,8 +59,9 @@ net_vif_t *find_vif_by_id(unsigned long id)
{
if ( p->domain == dom )
{
vif = p->net_vif_list[id&VIF_INDEX_MASK];
if ( vif != NULL ) get_vif(vif);
vif = p->net_vif_list[idx];
if ( vif != NULL )
get_vif(vif);
break;
}
p = p->next_hash;
@@ -56,30 +72,32 @@ net_vif_t *find_vif_by_id(unsigned long id)
}
/* create_net_vif - Create a new vif and append it to the specified domain.
/*
* create_net_vif - Create a new vif and append it to the specified domain.
*
* the domain is examined to determine how many vifs currently are allocated
* The domain is examined to determine how many vifs currently are allocated
* and the newly allocated vif is appended. The vif is also added to the
* global list.
*
*/
net_vif_t *create_net_vif(int domain)
net_vif_t *create_net_vif(domid_t dom)
{
int dom_vif_idx;
unsigned int idx;
net_vif_t *new_vif = NULL;
net_ring_t *new_ring = NULL;
struct task_struct *p = NULL;
unsigned long flags, vmac_hash;
unsigned char vmac_key[ETH_ALEN + 2 + MAX_DOMAIN_NAME];
if ( !(p = find_domain_by_id(domain)) )
if ( (p = find_domain_by_id(dom)) == NULL )
return NULL;
write_lock_irqsave(&tasklist_lock, flags);
for ( dom_vif_idx = 0; dom_vif_idx < MAX_DOMAIN_VIFS; dom_vif_idx++ )
if ( p->net_vif_list[dom_vif_idx] == NULL ) break;
if ( dom_vif_idx == MAX_DOMAIN_VIFS )
for ( idx = 0; idx < MAX_DOMAIN_VIFS; idx++ )
if ( p->net_vif_list[idx] == NULL )
break;
if ( idx == MAX_DOMAIN_VIFS )
goto fail;
if ( (new_vif = kmem_cache_alloc(net_vif_cache, GFP_KERNEL)) == NULL )
@@ -87,7 +105,8 @@ net_vif_t *create_net_vif(int domain)
memset(new_vif, 0, sizeof(*new_vif));
if ( sizeof(net_ring_t) > PAGE_SIZE ) BUG();
if ( sizeof(net_ring_t) > PAGE_SIZE )
BUG();
new_ring = (net_ring_t *)get_free_page(GFP_KERNEL);
clear_page(new_ring);
SHARE_PFN_WITH_DOMAIN(virt_to_page(new_ring), p);
@@ -98,9 +117,9 @@ net_vif_t *create_net_vif(int domain)
*/
atomic_set(&new_vif->refcnt, 1);
new_vif->shared_rings = new_ring;
new_vif->shared_idxs = &p->shared_info->net_idx[dom_vif_idx];
new_vif->shared_idxs = &p->shared_info->net_idx[idx];
new_vif->domain = p;
new_vif->idx = dom_vif_idx;
new_vif->idx = idx;
new_vif->list.next = NULL;
spin_lock_init(&new_vif->rx_lock);
spin_lock_init(&new_vif->tx_lock);
@@ -109,7 +128,7 @@ net_vif_t *create_net_vif(int domain)
new_vif->credit_usec = 0UL;
init_ac_timer(&new_vif->credit_timeout);
if ( (p->domain == 0) && (dom_vif_idx == 0) )
if ( (p->domain == 0) && (idx == 0) )
{
/*
* DOM0/VIF0 gets the real physical MAC address, so that users can
@@ -134,7 +153,7 @@ net_vif_t *create_net_vif(int domain)
* MAC addresses for some VIFs with no fear of clashes.
*/
memcpy(&vmac_key[0], the_dev->dev_addr, ETH_ALEN);
*(__u16 *)(&vmac_key[ETH_ALEN]) = htons(dom_vif_idx);
*(__u16 *)(&vmac_key[ETH_ALEN]) = htons(idx);
strcpy(&vmac_key[ETH_ALEN+2], p->name);
vmac_hash = hash(vmac_key, ETH_ALEN + 2 + strlen(p->name));
memcpy(new_vif->vmac, "\xaa\x00\x00", 3);
@@ -143,7 +162,7 @@ net_vif_t *create_net_vif(int domain)
new_vif->vmac[5] = (vmac_hash >> 0) & 0xff;
}
p->net_vif_list[dom_vif_idx] = new_vif;
p->net_vif_list[idx] = new_vif;
write_unlock_irqrestore(&tasklist_lock, flags);
return new_vif;
@@ -182,9 +201,6 @@ void unlink_net_vif(net_vif_t *vif)
}
/* vif_query - Call from the proc file system to get a list of indexes
* in use by a particular domain.
*/
int vif_query(vif_query_t *vq)
{
net_vif_t *vif;
@@ -193,7 +209,8 @@ int vif_query(vif_query_t *vq)
int i;
int count = 0;
if ( !(p = find_domain_by_id(vq->domain)) ) {
if ( (p = find_domain_by_id(vq->domain)) == NULL )
{
buf[0] = -1;
copy_to_user(vq->buf, buf, sizeof(int));
return -ESRCH;
@@ -215,15 +232,11 @@ int vif_query(vif_query_t *vq)
return 0;
}
/* vif_getinfo - Call from the proc file system to get info about a specific
* vif in use by a particular domain.
*/
int vif_getinfo(vif_getinfo_t *info)
{
net_vif_t *vif;
vif = find_vif_by_id((info->domain << VIF_DOMAIN_SHIFT) | info->vif);
if ( vif == NULL )
if ( (vif = find_net_vif(info->domain, info->vif)) == NULL )
return -ESRCH;
info->total_bytes_sent = vif->total_bytes_sent;
@@ -244,8 +257,7 @@ int vif_setparams(vif_setparams_t *params)
{
net_vif_t *vif;
vif = find_vif_by_id((params->domain << VIF_DOMAIN_SHIFT) | params->vif);
if ( vif == NULL )
if ( (vif = find_net_vif(params->domain, params->vif)) == NULL )
return -ESRCH;
/* Turning off rate limiting? */
@@ -263,9 +275,6 @@ int vif_setparams(vif_setparams_t *params)
/* ----[ Net Rule Functions ]-----------------------------------------------*/
/* add_net_rule - Add a new network filter rule.
*/
int add_net_rule(net_rule_t *rule)
{
net_rule_ent_t *new_ent;
@@ -283,83 +292,72 @@ int add_net_rule(net_rule_t *rule)
return 0;
}
/* delete_net_rule - Delete an existing network rule.
*/
int delete_net_rule(net_rule_t *rule)
{
net_rule_ent_t *ent = net_rule_list, *prev = NULL;
while ( (ent) && ((memcmp(rule, &ent->r, sizeof(net_rule_t))) != 0) )
net_rule_ent_t **pent, *ent;
write_lock(&net_rule_lock);
for ( pent = &net_rule_list; pent != NULL; pent = &ent->next )
{
prev = ent;
ent = ent->next;
ent = *pent;
if ( memcmp(rule, &ent->r, sizeof(net_rule_t)) == 0 )
{
*pent = ent->next;
kmem_cache_free(net_rule_cache, ent);
break;
}
}
if (ent != NULL)
{
write_lock(&net_rule_lock);
if (prev != NULL)
{
prev->next = ent->next;
}
else
{
net_rule_list = ent->next;
}
kmem_cache_free(net_rule_cache, ent);
write_unlock(&net_rule_lock);
}
write_unlock(&net_rule_lock);
return 0;
}
/* print_net_rule - Print a single net rule.
*/
static char *idx_to_name(unsigned int idx)
{
if ( idx == VIF_PHYSICAL_INTERFACE )
return "PHYSICAL";
if ( idx == VIF_ANY_INTERFACE )
return "ANY";
return "UNKNOWN";
}
static char *print_ip_addr(char *buf, unsigned long addr)
{
sprintf(buf, "%lu.%lu.%lu.%lu",
(addr>>24)&255, (addr>>16)&255, (addr>>8)&255, addr&255);
return buf;
}
void print_net_rule(net_rule_t *r)
{
char buf[20];
printk("===] NET RULE:\n");
printk("=] src_addr : %lu\n", (unsigned long) r->src_addr);
printk("=] src_addr_mask : %lu\n", (unsigned long) r->src_addr_mask);
printk("=] dst_addr : %lu\n", (unsigned long) r->dst_addr);
printk("=] dst_addr_mask : %lu\n", (unsigned long) r->dst_addr_mask);
printk("=] src_addr : %s\n", print_ip_addr(buf, r->src_addr));
printk("=] src_addr_mask : %s\n", print_ip_addr(buf, r->src_addr_mask));
printk("=] dst_addr : %s\n", print_ip_addr(buf, r->dst_addr));
printk("=] dst_addr_mask : %s\n", print_ip_addr(buf, r->dst_addr_mask));
printk("=] src_port : %u\n", r->src_port);
printk("=] src_port_mask : %u\n", r->src_port_mask);
printk("=] dst_port : %u\n", r->dst_port);
printk("=] dst_port_mask : %u\n", r->dst_port_mask);
printk("=] dst_proto : %u\n", r->proto);
switch ( r->src_vif )
{
case VIF_PHYSICAL_INTERFACE:
printk("=] src_dom/idx : PHYSICAL\n");
break;
case VIF_ANY_INTERFACE:
printk("=] src_dom/idx : ANY\n");
break;
default:
printk("=] src_dom/idx : %lu/%lu\n",
r->src_vif>>VIF_DOMAIN_SHIFT, r->src_vif&VIF_INDEX_MASK);
break;
}
switch ( r->dst_vif )
{
case VIF_PHYSICAL_INTERFACE:
printk("=] dst_dom/idx : PHYSICAL\n");
break;
case VIF_ANY_INTERFACE:
printk("=] dst_dom/idx : ANY\n");
break;
default:
printk("=] dst_dom/idx : %lu/%lu\n",
r->dst_vif>>VIF_DOMAIN_SHIFT, r->dst_vif&VIF_INDEX_MASK);
break;
}
if ( r->src_dom == VIF_SPECIAL )
printk("=] src_dom/idx : %s\n", idx_to_name(r->src_idx));
else
printk("=] src_dom/idx : %llu/%u\n", r->src_dom, r->src_idx);
if ( r->dst_dom == VIF_SPECIAL )
printk("=] dst_dom/idx : %s\n", idx_to_name(r->dst_idx));
else
printk("=] dst_dom/idx : %llu/%u\n", r->dst_dom, r->dst_idx);
printk("=] action : %u\n", r->action);
}
/* print_net_rule_list - Print the global rule table.
*/
void print_net_rule_list()
void print_net_rule_list(void)
{
net_rule_ent_t *ent;
int count = 0;
@@ -368,17 +366,19 @@ void print_net_rule_list()
ent = net_rule_list;
while (ent)
while ( ent != NULL )
{
print_net_rule(&ent->r);
ent = ent->next;
count++;
}
printk("\nTotal of %d rules.\n", count);
read_unlock(&net_rule_lock);
}
/* net_find_rule - Find the destination vif according to the current rules.
*
* Apply the rules to this skbuff and return the vif id that it is bound for.
@@ -386,10 +386,12 @@ void print_net_rule_list()
*/
static net_vif_t *net_find_rule(u8 nproto, u8 tproto, u32 src_addr,
u32 dst_addr, u16 src_port,
u16 dst_port, unsigned long src_vif)
u16 dst_port,
domid_t src_dom, unsigned int src_idx)
{
net_rule_ent_t *ent;
unsigned long dest = VIF_UNKNOWN_INTERFACE;
domid_t dst_dom = VIF_SPECIAL;
unsigned int dst_idx = VIF_UNKNOWN_INTERFACE;
read_lock(&net_rule_lock);
@@ -397,10 +399,13 @@ static net_vif_t *net_find_rule(u8 nproto, u8 tproto, u32 src_addr,
while ( ent != NULL )
{
if ( ((ent->r.src_vif == src_vif)
|| (ent->r.src_vif == VIF_ANY_INTERFACE)) &&
if ( (((ent->r.src_dom == src_dom) &&
(ent->r.src_idx == src_idx)) ||
((ent->r.src_dom == VIF_SPECIAL) &&
(ent->r.src_idx == VIF_ANY_INTERFACE))) &&
(src_vif != ent->r.dst_vif) &&
((src_dom != ent->r.dst_dom) ||
(src_idx != ent->r.dst_idx)) &&
(!((ent->r.src_addr ^ src_addr) & ent->r.src_addr_mask )) &&
(!((ent->r.dst_addr ^ dst_addr) & ent->r.dst_addr_mask )) &&
@@ -418,14 +423,14 @@ static net_vif_t *net_find_rule(u8 nproto, u8 tproto, u32 src_addr,
(tproto == IPPROTO_UDP)))
)
{
dst_dom = ent->r.dst_dom;
dst_idx = ent->r.dst_idx;
/*
* XXX FFS! We keep going to find the "best" rule. Where best
* corresponds to vaguely sane routing of a packet. We need a less
* shafted model for our "virtual firewall/router" methinks!
*/
if ( (dest & VIF_DOMAIN_MASK) == VIF_SPECIAL )
dest = ent->r.dst_vif;
if ( (dest & VIF_DOMAIN_MASK) != VIF_SPECIAL )
if ( dst_dom != VIF_SPECIAL )
break;
}
ent = ent->next;
@@ -433,12 +438,14 @@ static net_vif_t *net_find_rule(u8 nproto, u8 tproto, u32 src_addr,
read_unlock(&net_rule_lock);
if ( dest == VIF_PHYSICAL_INTERFACE )
return VIF_PHYS;
else if ( (dest & VIF_DOMAIN_MASK) == VIF_SPECIAL )
if ( dst_dom == VIF_SPECIAL )
{
if ( dst_idx == VIF_PHYSICAL_INTERFACE )
return VIF_PHYS;
return VIF_DROP;
else
return find_vif_by_id(dest);
}
return find_net_vif(dst_dom, dst_idx);
}
/* net_get_target_vif - Find the vif that the given sk_buff is bound for.
@@ -463,13 +470,17 @@ net_vif_t *net_get_target_vif(u8 *data, unsigned int len, net_vif_t *src_vif)
{
net_vif_t *target = VIF_DROP;
u8 *h_raw, *nh_raw;
unsigned long src_vif_val = VIF_PHYSICAL_INTERFACE;
domid_t src_dom = VIF_SPECIAL;
unsigned int src_idx = VIF_PHYSICAL_INTERFACE;
if ( src_vif != VIF_PHYS )
src_vif_val = (src_vif->domain->domain<<VIF_DOMAIN_SHIFT) |
src_vif->idx;
{
src_dom = src_vif->domain->domain;
src_idx = src_vif->idx;
}
if ( len < ETH_HLEN ) goto drop;
if ( len < ETH_HLEN )
goto drop;
nh_raw = data + ETH_HLEN;
switch ( ntohs(*(unsigned short *)(data + 12)) )
@@ -478,7 +489,7 @@ net_vif_t *net_get_target_vif(u8 *data, unsigned int len, net_vif_t *src_vif)
if ( len < (ETH_HLEN + 28) ) goto drop;
target = net_find_rule((u8)ETH_P_ARP, 0, ntohl(*(u32 *)(nh_raw + 14)),
ntohl(*(u32 *)(nh_raw + 24)), 0, 0,
src_vif_val);
src_dom, src_idx);
break;
case ETH_P_IP:
@@ -490,14 +501,14 @@ net_vif_t *net_get_target_vif(u8 *data, unsigned int len, net_vif_t *src_vif)
ntohl(*(u32 *)(nh_raw + 16)),
0,
0,
src_vif_val);
src_dom, src_idx);
break;
}
return target;
drop:
printk("VIF%lu/%lu: pkt to drop!\n",
src_vif_val>>VIF_DOMAIN_SHIFT, src_vif_val&VIF_INDEX_MASK);
printk("VIF%llu/%u: pkt to drop!\n",
src_dom, src_idx);
return VIF_DROP;
}
+4 -2
View File
@@ -306,7 +306,7 @@ long sched_bvtctl(unsigned long c_allow)
}
/* Adjust scheduling parameter for a given domain. */
long sched_adjdom(int dom, unsigned long mcu_adv, unsigned long warp,
long sched_adjdom(domid_t dom, unsigned long mcu_adv, unsigned long warp,
unsigned long warpl, unsigned long warpu)
{
struct task_struct *p;
@@ -512,6 +512,7 @@ asmlinkage void __enter_scheduler(void)
* 'next_prime's evt. Take context switch allowance into account.
*/
ASSERT(next_prime->evt >= next->evt);
r_time = ((next_prime->evt - next->evt)/next->mcu_advance) + ctx_allow;
sched_done:
@@ -697,7 +698,8 @@ static void dump_rqueue(struct list_head *queue, char *name)
(unsigned long) queue->next, (unsigned long) queue->prev);
list_for_each (list, queue) {
p = list_entry(list, struct task_struct, run_list);
printk("%3d: %3d has=%c mcua=0x%04lX ev=0x%08X av=0x%08X c=0x%X%08X\n",
printk("%3d: %llu has=%c mcua=0x%04lX"
" ev=0x%08X av=0x%08X c=0x%X%08X\n",
loop++, p->domain,
p->has_cpu ? 'T':'F',
p->mcu_advance, p->evt, p->avt,
+1 -1
View File
@@ -567,7 +567,7 @@ static void dump_blockq(u_char key, void *dev_id, struct pt_regs *regs)
do {
if ( !is_idle_task(p) )
{
printk("Domain: %d\n", p->domain);
printk("Domain: %llu\n", p->domain);
blk_ring = p->blk_ring_base;
printk(" req_prod:0x%08x, req_cons:0x%08x resp_prod:0x%08x/"
+2 -3
View File
@@ -19,14 +19,13 @@ extern void save_init_fpu( struct task_struct *tsk );
extern void restore_fpu( struct task_struct *tsk );
#define unlazy_fpu( tsk ) do { \
if ( tsk->flags & PF_USEDFPU ) \
if ( test_bit(PF_USEDFPU, &tsk->flags) ) \
save_init_fpu( tsk ); \
} while (0)
#define clear_fpu( tsk ) do { \
if ( tsk->flags & PF_USEDFPU ) { \
if ( test_and_clear_bit(PF_USEDFPU, &tsk->flags) ) { \
asm volatile("fwait"); \
tsk->flags &= ~PF_USEDFPU; \
stts(); \
} \
} while (0)
+4 -4
View File
@@ -21,10 +21,10 @@ extern int pdb_high_bit;
extern void initialize_pdb(void);
/* Get/set values from generic debug interface. */
extern int pdb_set_values (int domain, u_char *buffer,
unsigned long addr, int length);
extern int pdb_get_values (int domain, u_char *buffer,
unsigned long addr, int length);
extern int pdb_set_values(domid_t domain, u_char *buffer,
unsigned long addr, int length);
extern int pdb_get_values(domid_t domain, u_char *buffer,
unsigned long addr, int length);
/* External entry points. */
extern int pdb_handle_exception(int exceptionVector,
+1 -1
View File
@@ -98,7 +98,7 @@ typedef struct xen_disk
unsigned short device; /* device number (opaque 16 bit val) */
unsigned short info; /* device type and flags */
unsigned long capacity; /* size in terms of #512 byte sectors */
unsigned int domain; /* if a VBD, domain this 'belongs to' */
domid_t domain; /* if a VBD, domain this 'belongs to' */
} xen_disk_t;
typedef struct xen_disk_info
+15 -15
View File
@@ -17,7 +17,7 @@
* This makes sure that old versions of dom0 tools will stop working in a
* well-defined way (rather than crashing the machine, for instance).
*/
#define DOM0_INTERFACE_VERSION 0xAAAA0004
#define DOM0_INTERFACE_VERSION 0xAAAA0005
/*
@@ -51,30 +51,30 @@ typedef struct dom0_createdomain_st
{
/* IN parameters. */
unsigned int memory_kb;
char name[MAX_DOMAIN_NAME];
char name[MAX_DOMAIN_NAME];
/* OUT parameters. */
unsigned int domain;
domid_t domain;
} dom0_createdomain_t;
#define DOM0_STARTDOMAIN 10
typedef struct dom0_startdomain_st
{
/* IN parameters. */
unsigned int domain;
domid_t domain;
} dom0_startdomain_t;
#define DOM0_STOPDOMAIN 11
typedef struct dom0_stopdomain_st
{
/* IN parameters. */
unsigned int domain;
domid_t domain;
} dom0_stopdomain_t;
#define DOM0_DESTROYDOMAIN 9
typedef struct dom0_destroydomain_st
{
/* IN variables. */
unsigned int domain;
domid_t domain;
int force;
} dom0_destroydomain_t;
@@ -82,7 +82,7 @@ typedef struct dom0_destroydomain_st
typedef struct dom0_getmemlist_st
{
/* IN variables. */
unsigned int domain;
domid_t domain;
unsigned long max_pfns;
void *buffer;
/* OUT variables. */
@@ -93,8 +93,8 @@ typedef struct dom0_getmemlist_st
typedef struct dom0_builddomain_st
{
/* IN variables. */
unsigned int domain;
unsigned int num_vifs;
domid_t domain;
unsigned int num_vifs;
full_execution_context_t ctxt;
} dom0_builddomain_t;
@@ -109,7 +109,7 @@ typedef struct dom0_bvtctl_st
typedef struct dom0_adjustdom_st
{
/* IN variables. */
unsigned int domain; /* domain id */
domid_t domain; /* domain id */
unsigned long mcu_adv; /* mcu advance: inverse of weight */
unsigned long warp; /* time warp */
unsigned long warpl; /* warp limit */
@@ -120,7 +120,7 @@ typedef struct dom0_adjustdom_st
typedef struct dom0_getdomaininfo_st
{
/* IN variables. */
unsigned int domain;
domid_t domain;
/* OUT variables. */
char name[MAX_DOMAIN_NAME];
int processor;
@@ -141,7 +141,7 @@ typedef struct dom0_getpageframeinfo_st
{
/* IN variables. */
unsigned long pfn; /* Machine page frame number to query. */
unsigned int domain; /* To which domain does the frame belong? */
domid_t domain; /* To which domain does the frame belong? */
/* OUT variables. */
enum { NONE, L1TAB, L2TAB } type; /* Is the page PINNED to a type? */
} dom0_getpageframeinfo_t;
@@ -149,7 +149,7 @@ typedef struct dom0_getpageframeinfo_st
#define DOM0_IOPL 14
typedef struct dom0_iopl_st
{
unsigned int domain;
domid_t domain;
unsigned int iopl;
} dom0_iopl_t;
@@ -168,7 +168,7 @@ typedef struct dom0_debug_st
{
/* IN variables. */
char opcode;
unsigned int domain;
domid_t domain;
int in1, in2, in3, in4;
/* OUT variables. */
unsigned int status;
@@ -206,7 +206,7 @@ typedef struct dom0_readconsole_st
typedef struct dom0_pincpudomain_st
{
/* IN variables. */
unsigned int domain;
domid_t domain;
int cpu; /* -1 implies unpin */
} dom0_pincpudomain_t;
+5 -2
View File
@@ -185,6 +185,10 @@
#ifndef __ASSEMBLY__
typedef u64 domid_t;
/* DOMID_SELF is used in certain contexts to refer to oneself. */
#define DOMID_SELF (~1ULL)
#include "network.h"
#include "block.h"
@@ -334,7 +338,6 @@ typedef struct start_info_st {
/* THE FOLLOWING ARE FILLED IN BOTH ON INITIAL BOOT AND ON RESUME. */
unsigned long nr_pages; /* total pages allocated to this domain. */
unsigned long shared_info; /* MACHINE address of shared info struct.*/
unsigned long dom_id; /* Domain identifier. */
unsigned long flags; /* SIF_xxx flags. */
/* THE FOLLOWING ARE ONLY FILLED IN ON INITIAL BOOT (NOT RESUME). */
unsigned long pt_base; /* VIRTUAL address of page directory. */
@@ -345,7 +348,7 @@ typedef struct start_info_st {
/* These flags are passed in the 'flags' field of start_info_t. */
#define SIF_PRIVILEGED 1 /* Is the domain privileged? */
#define SIF_CONSOLE 2 /* Does the domain own the physical console? */
#define SIF_INITDOMAIN 2 /* Is thsi the initial control domain? */
/* For use in guest OSes. */
extern shared_info_t *HYPERVISOR_shared_info;
+10 -15
View File
@@ -135,31 +135,26 @@ typedef struct net_rule_st
u16 src_port_mask;
u16 dst_port_mask;
u16 proto;
unsigned long src_vif;
unsigned long dst_vif;
domid_t src_dom, dst_dom;
unsigned int src_idx, dst_idx;
u16 action;
} net_rule_t;
#define VIF_DOMAIN_MASK 0xfffff000UL
#define VIF_DOMAIN_SHIFT 12
#define VIF_INDEX_MASK 0x00000fffUL
#define VIF_INDEX_SHIFT 0
/* These are specified in the index if the dom is SPECIAL. */
#define VIF_SPECIAL 0xfffff000UL
#define VIF_UNKNOWN_INTERFACE (VIF_SPECIAL | 0)
#define VIF_PHYSICAL_INTERFACE (VIF_SPECIAL | 1)
#define VIF_ANY_INTERFACE (VIF_SPECIAL | 2)
/* These are specified in the 'idx' if the 'dom' is SPECIAL. */
#define VIF_SPECIAL (~0ULL)
#define VIF_UNKNOWN_INTERFACE 0
#define VIF_PHYSICAL_INTERFACE 1
#define VIF_ANY_INTERFACE 2
typedef struct vif_query_st
{
unsigned int domain;
domid_t domain;
int *buf; /* reply buffer -- guest virtual address */
} vif_query_t;
typedef struct vif_getinfo_st
{
unsigned int domain;
domid_t domain;
unsigned int vif;
/* domain & vif are supplied by dom0, the rest are response fields */
@@ -179,7 +174,7 @@ typedef struct vif_getinfo_st
*/
typedef struct vif_setparams_st
{
unsigned int domain;
domid_t domain;
unsigned int vif;
unsigned long credit_bytes;
unsigned long credit_usec;
+8 -8
View File
@@ -32,43 +32,43 @@ typedef struct _xen_extent {
typedef struct _vbd_create {
unsigned domain; /* create VBD for this domain */
domid_t domain; /* create VBD for this domain */
u16 vdevice; /* id by which dom will refer to VBD */
u16 mode; /* OR of { VBD_MODE_R , VBD_MODE_W } */
} vbd_create_t;
typedef struct _vbd_grow {
unsigned domain; /* domain in question */
domid_t domain; /* domain in question */
u16 vdevice; /* 16 bit id domain refers to VBD as */
xen_extent_t extent; /* the extent to add to this VBD */
} vbd_grow_t;
typedef struct _vbd_shrink {
unsigned domain; /* domain in question */
domid_t domain; /* domain in question */
u16 vdevice; /* 16 bit id domain refers to VBD as */
} vbd_shrink_t;
typedef struct _vbd_setextents {
unsigned domain; /* domain in question */
domid_t domain; /* domain in question */
u16 vdevice; /* 16 bit id domain refers to VBD as */
u16 nr_extents; /* number of extents in the list */
xen_extent_t *extents; /* the extents to add to this VBD */
} vbd_setextents_t;
typedef struct _vbd_delete {
unsigned domain; /* domain in question */
domid_t domain; /* domain in question */
u16 vdevice; /* 16 bit id domain refers to VBD as */
} vbd_delete_t;
#define VBD_PROBE_ALL 0xFFFFFFFF
#define VBD_PROBE_ALL (~0ULL)
typedef struct _vbd_probe {
unsigned domain; /* domain in question or VBD_PROBE_ALL */
domid_t domain; /* domain in question or VBD_PROBE_ALL */
xen_disk_info_t xdi; /* where's our space for VBD/disk info */
} vbd_probe_t;
typedef struct _vbd_info {
/* IN variables */
unsigned domain; /* domain in question */
domid_t domain; /* domain in question */
u16 vdevice; /* 16 bit id domain refers to VBD as */
u16 maxextents; /* max # of extents to return info for */
xen_extent_t *extents; /* pointer to space for extent list */
+19 -20
View File
@@ -33,19 +33,17 @@ extern struct mm_struct init_mm;
#define _HYP_EVENT_NEED_RESCHED 0
#define _HYP_EVENT_DIE 1
#define PF_DONEFPUINIT 0x1 /* Has the FPU been initialised for this task? */
#define PF_USEDFPU 0x2 /* Has this task used the FPU since last save? */
#define PF_GUEST_STTS 0x4 /* Has the guest OS requested 'stts'? */
#define PF_CONSTRUCTED 0x8 /* Has the guest OS been fully built yet? */
#define PF_DONEFPUINIT 0 /* Has the FPU been initialised for this task? */
#define PF_USEDFPU 1 /* Has this task used the FPU since last save? */
#define PF_GUEST_STTS 2 /* Has the guest OS requested 'stts'? */
#define PF_CONSTRUCTED 3 /* Has the guest OS been fully built yet? */
#define PF_IDLETASK 4 /* Is this one of the per-CPU idle domains? */
#define PF_PRIVILEGED 5 /* Is this domain privileged? */
#include <xeno/vif.h>
#include <xeno/vbd.h>
/* SMH: replace below when have explicit 'priv' flag or bitmask */
#define IS_PRIV(_p) ((_p)->domain == 0)
#define DOMAIN_ID_BITS (16)
#define MAX_DOMAIN_ID ((1<<(DOMAIN_ID_BITS))-1)
#define IS_PRIV(_p) (test_bit(PF_PRIVILEGED, &(_p)->flags))
typedef struct event_channel_st
{
@@ -92,8 +90,8 @@ struct task_struct
/*
* From here on things can be added and shuffled without special attention
*/
unsigned int domain; /* domain id */
domid_t domain;
spinlock_t page_list_lock;
struct list_head page_list;
@@ -185,14 +183,15 @@ struct task_struct
addr_limit: KERNEL_DS, \
thread: INIT_THREAD, \
prev_task: &(_t), \
next_task: &(_t) \
next_task: &(_t), \
flags: 1<<PF_IDLETASK \
}
extern struct task_struct idle0_task;
extern struct task_struct *idle_task[NR_CPUS];
#define IDLE_DOMAIN_ID (~0)
#define is_idle_task(_p) ((_p)->domain == IDLE_DOMAIN_ID)
#define IDLE_DOMAIN_ID (~0ULL)
#define is_idle_task(_p) (test_bit(PF_IDLETASK, &(_p)->flags))
#include <xeno/slab.h>
@@ -205,21 +204,21 @@ extern kmem_cache_t *task_struct_cachep;
atomic_inc(&(_p)->refcnt)
extern struct task_struct *do_createdomain(
unsigned int dom_id, unsigned int cpu);
domid_t dom_id, unsigned int cpu);
extern int setup_guestos(
struct task_struct *p, dom0_createdomain_t *params, unsigned int num_vifs,
char *data_start, unsigned long data_len,
char *cmdline, unsigned long initrd_len);
extern int final_setup_guestos(struct task_struct *p, dom0_builddomain_t *);
struct task_struct *find_domain_by_id(unsigned int dom);
struct task_struct *find_domain_by_id(domid_t dom);
extern void release_task(struct task_struct *);
extern void __kill_domain(struct task_struct *p);
extern void kill_domain(void);
extern void kill_domain_with_errmsg(const char *err);
extern long kill_other_domain(unsigned int dom, int force);
extern long kill_other_domain(domid_t dom, int force);
extern void stop_domain(void);
extern long stop_other_domain(unsigned int dom);
extern long stop_other_domain(domid_t dom);
/* arch/process.c */
void new_thread(struct task_struct *p,
@@ -247,7 +246,7 @@ void schedulers_start(void);
void sched_add_domain(struct task_struct *p);
int sched_rem_domain(struct task_struct *p);
long sched_bvtctl(unsigned long ctx_allow);
long sched_adjdom(int dom, unsigned long mcu_adv, unsigned long warp,
long sched_adjdom(domid_t dom, unsigned long mcu_adv, unsigned long warp,
unsigned long warpl, unsigned long warpu);
void init_idle_task(void);
void __wake_up(struct task_struct *p);
@@ -287,7 +286,7 @@ void continue_nonidle_task(void);
/* This hash table is protected by the tasklist_lock. */
#define TASK_HASH_SIZE 256
#define TASK_HASH(_id) ((_id)&(TASK_HASH_SIZE-1))
#define TASK_HASH(_id) ((int)(_id)&(TASK_HASH_SIZE-1))
extern struct task_struct *task_hash[TASK_HASH_SIZE];
#define REMOVE_LINKS(p) do { \
+2 -2
View File
@@ -94,11 +94,11 @@ do { \
} while (0) \
/* vif prototypes */
net_vif_t *create_net_vif(int domain);
net_vif_t *create_net_vif(domid_t dom);
void destroy_net_vif(net_vif_t *vif);
void unlink_net_vif(net_vif_t *vif);
net_vif_t *net_get_target_vif(u8 *data, unsigned int len, net_vif_t *src_vif);
net_vif_t *find_vif_by_id(unsigned long id);
net_vif_t *find_net_vif(domid_t dom, unsigned int idx);
/*
* Return values from net_get_target_vif:
+1 -1
View File
@@ -642,7 +642,7 @@ static void net_rx_action(struct softirq_action *h)
skb->data, skb->len, skb->src_vif);
if ( !VIF_LOCAL(skb->dst_vif) )
skb->dst_vif = find_vif_by_id(0);
skb->dst_vif = find_net_vif(0, 0);
if ( skb->dst_vif != NULL )
{
@@ -22,6 +22,7 @@ static unsigned char readbuf[1024];
/* Helpers, implemented at the bottom. */
u32 getipaddr(const char *buff, unsigned int len);
u16 antous(const char *buff, int len);
u64 antoull(const char *buff, int len);
int anton(const char *buff, int len);
static int vfr_read_proc(char *page, char **start, off_t off,
@@ -141,11 +142,14 @@ static int vfr_write_proc(struct file *file, const char *buffer,
/* NB. Prefix matches must go first! */
if (strncmp(&buffer[fs], "src", fl) == 0)
{
op.u.net_rule.src_vif = VIF_ANY_INTERFACE;
op.u.net_rule.src_dom = VIF_SPECIAL;
op.u.net_rule.src_idx = VIF_ANY_INTERFACE;
}
else if (strncmp(&buffer[fs], "dst", fl) == 0)
{
op.u.net_rule.dst_vif = VIF_PHYSICAL_INTERFACE;
op.u.net_rule.dst_dom = VIF_SPECIAL;
op.u.net_rule.dst_idx = VIF_PHYSICAL_INTERFACE;
}
else if (strncmp(&buffer[fs], "srcaddr", fl) == 0)
{
@@ -181,19 +185,19 @@ static int vfr_write_proc(struct file *file, const char *buffer,
}
else if (strncmp(&buffer[fs], "srcdom", fl) == 0)
{
op.u.net_rule.src_vif |= anton(&buffer[ts], tl)<<VIF_DOMAIN_SHIFT;
op.u.net_rule.src_dom = antoull(&buffer[ts], tl);
}
else if (strncmp(&buffer[fs], "srcidx", fl) == 0)
{
op.u.net_rule.src_vif |= anton(&buffer[ts], tl);
op.u.net_rule.src_idx = anton(&buffer[ts], tl);
}
else if (strncmp(&buffer[fs], "dstdom", fl) == 0)
{
op.u.net_rule.dst_vif |= anton(&buffer[ts], tl)<<VIF_DOMAIN_SHIFT;
op.u.net_rule.dst_dom = antoull(&buffer[ts], tl);
}
else if (strncmp(&buffer[fs], "dstidx", fl) == 0)
{
op.u.net_rule.dst_vif |= anton(&buffer[ts], tl);
op.u.net_rule.dst_idx = anton(&buffer[ts], tl);
}
else if ( (strncmp(&buffer[fs], "proto", fl) == 0))
{
@@ -289,6 +293,23 @@ u16 antous(const char *buff, int len)
return ret;
}
u64 antoull(const char *buff, int len)
{
u64 ret;
char c;
ret = 0;
while ( (len) && ((c = *buff) >= '0') && (c <= '9') )
{
ret *= 10;
ret += c - '0';
buff++; len--;
}
return ret;
}
u32 getipaddr(const char *buff, unsigned int len)
{
char c;
@@ -498,16 +498,20 @@ static int inetdev_notify(struct notifier_block *this,
else
goto out;
op.u.net_rule.src_vif = idx;
op.u.net_rule.dst_vif = VIF_PHYSICAL_INTERFACE;
op.u.net_rule.src_dom = 0;
op.u.net_rule.src_idx = idx;
op.u.net_rule.dst_dom = VIF_SPECIAL;
op.u.net_rule.dst_idx = VIF_PHYSICAL_INTERFACE;
op.u.net_rule.src_addr = ntohl(ifa->ifa_address);
op.u.net_rule.src_addr_mask = ~0UL;
op.u.net_rule.dst_addr = 0;
op.u.net_rule.dst_addr_mask = 0;
(void)HYPERVISOR_network_op(&op);
op.u.net_rule.src_vif = VIF_ANY_INTERFACE;
op.u.net_rule.dst_vif = idx;
op.u.net_rule.src_dom = VIF_SPECIAL;
op.u.net_rule.src_idx = VIF_ANY_INTERFACE;
op.u.net_rule.dst_dom = 0;
op.u.net_rule.dst_idx = idx;
op.u.net_rule.src_addr = 0;
op.u.net_rule.src_addr_mask = 0;
op.u.net_rule.dst_addr = ntohl(ifa->ifa_address);
@@ -539,7 +543,7 @@ int __init init_module(void)
* addresses. All other domains have a privileged "parent" to do this for
* them at start of day.
*/
if ( start_info.dom_id == 0 )
if ( start_info.flags & SIF_INITDOMAIN )
(void)register_inetaddr_notifier(&notifier_inetdev);
err = request_irq(NET_IRQ, network_interrupt,
@@ -619,7 +623,7 @@ static void cleanup_module(void)
kfree(dev);
}
if ( start_info.dom_id == 0 )
if ( start_info.flags & SIF_INITDOMAIN )
(void)unregister_inetaddr_notifier(&notifier_inetdev);
}
@@ -9,8 +9,8 @@
#include <asm/desc.h>
/* Offsets in start_info structure */
#define MOD_START 20
#define MOD_LEN 24
#define MOD_START 16
#define MOD_LEN 20
startup_32:
cld
@@ -30,7 +30,7 @@ asmlinkage int sys_iopl(unsigned int new_io_pl)
/* Force the change at ring 0. */
op.cmd = DOM0_IOPL;
op.u.iopl.domain = start_info.dom_id;
op.u.iopl.domain = DOMID_SELF;
op.u.iopl.iopl = new_io_pl;
HYPERVISOR_dom0_op(&op);
@@ -394,7 +394,7 @@ void __switch_to(struct task_struct *prev_p, struct task_struct *next_p)
{
dom0_op_t op;
op.cmd = DOM0_IOPL;
op.u.iopl.domain = start_info.dom_id;
op.u.iopl.domain = DOMID_SELF;
op.u.iopl.iopl = next->io_pl;
queue_multicall1(__HYPERVISOR_dom0_op, (unsigned long)&op);
}
@@ -318,14 +318,14 @@ void __init setup_arch(char **cmdline_p)
{
dom0_op_t op;
op.cmd = DOM0_IOPL;
op.u.iopl.domain = start_info.dom_id;
op.u.iopl.domain = DOMID_SELF;
op.u.iopl.iopl = 1;
if( HYPERVISOR_dom0_op(&op) != 0 )
panic("Unable to obtain IOPL, despite being SIF_PRIVILEGED");
current->thread.io_pl = 1;
}
if(start_info.flags & SIF_CONSOLE)
if ( start_info.flags & SIF_INITDOMAIN )
{
if( !(start_info.flags & SIF_PRIVILEGED) )
panic("Xen granted us console access but not privileged status");
@@ -297,7 +297,7 @@ void do_settimeofday(struct timeval *tv)
{
struct timeval newtv;
if ( !independent_wallclock && (start_info.dom_id != 0) )
if ( !independent_wallclock && !(start_info.flags & SIF_INITDOMAIN) )
return;
write_lock_irq(&xtime_lock);
@@ -333,7 +333,7 @@ void do_settimeofday(struct timeval *tv)
last_update_from_xen = 0;
#ifdef CONFIG_XENO_PRIV
if ( start_info.dom_id == 0 )
if ( start_info.flags & SIF_INITDOMAIN )
{
dom0_op_t op;
last_update_to_rtc = last_update_to_xen = 0;
@@ -445,7 +445,8 @@ static inline void do_timer_interrupt(int irq, void *dev_id,
}
#ifdef CONFIG_XENO_PRIV
if ( (start_info.dom_id == 0) && ((time_status & STA_UNSYNC) == 0) )
if ( (start_info.flags & SIF_INITDOMAIN) &&
((time_status & STA_UNSYNC) == 0) )
{
/* Send synchronised time to Xen approximately every minute. */
if ( xtime.tv_sec > (last_update_to_xen + 60) )
@@ -1,6 +1,9 @@
/* xenolinux/include/asm-xeno/keyboard.h */
/* Portions copyright (c) 2003 James Scott, Intel Research Cambridge */
/* Talks to hypervisor to get PS/2 keyboard and mouse events, and send keyboard and mouse commands */
/*
* Talks to hypervisor to get PS/2 keyboard and mouse events, and send keyboard
* and mouse commands
*/
/* Based on:
* linux/include/asm-i386/keyboard.h
@@ -50,7 +53,7 @@ extern unsigned char pckbd_sysrq_xlate[128];
static inline int xen_kbd_controller_present ()
{
return start_info.flags & SIF_CONSOLE;
return start_info.flags & SIF_INITDOMAIN;
}
/* resource allocation */
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.