aboutsummaryrefslogtreecommitdiff
path: root/xen/common/dom0_ops.c
diff options
context:
space:
mode:
Diffstat (limited to 'xen/common/dom0_ops.c')
-rw-r--r--xen/common/dom0_ops.c57
1 files changed, 54 insertions, 3 deletions
diff --git a/xen/common/dom0_ops.c b/xen/common/dom0_ops.c
index 3ac6e72c0f..fb8d44429e 100644
--- a/xen/common/dom0_ops.c
+++ b/xen/common/dom0_ops.c
@@ -62,11 +62,19 @@ long do_dom0_op(dom0_op_t *u_dom0_op)
switch ( op.cmd )
{
- case DOM0_STARTDOM:
+ case DOM0_BUILDDOMAIN:
{
struct task_struct * p = find_domain_by_id(op.u.meminfo.domain);
if ( (ret = final_setup_guestos(p, &op.u.meminfo)) != 0 )
break;
+ ret = p->domain;
+ free_task_struct(p);
+ }
+ break;
+
+ case DOM0_STARTDOMAIN:
+ {
+ struct task_struct * p = find_domain_by_id(op.u.meminfo.domain);
wake_up(p);
reschedule(p);
ret = p->domain;
@@ -74,7 +82,13 @@ long do_dom0_op(dom0_op_t *u_dom0_op)
}
break;
- case DOM0_NEWDOMAIN:
+ case DOM0_STOPDOMAIN:
+ {
+ ret = stop_other_domain (op.u.meminfo.domain);
+ }
+ break;
+
+ case DOM0_CREATEDOMAIN:
{
struct task_struct *p;
static unsigned int pro = 0;
@@ -89,6 +103,11 @@ long do_dom0_op(dom0_op_t *u_dom0_op)
if ( p == NULL )
break;
+ if (op.u.newdomain.name[0]) {
+ strncpy (p -> name, op.u.newdomain.name, MAX_DOMAIN_NAME);
+ p -> name[MAX_DOMAIN_NAME - 1] = 0;
+ }
+
ret = alloc_new_dom_mem(p, op.u.newdomain.memory_kb);
if ( ret != 0 )
{
@@ -108,7 +127,7 @@ long do_dom0_op(dom0_op_t *u_dom0_op)
}
break;
- case DOM0_KILLDOMAIN:
+ case DOM0_DESTROYDOMAIN:
{
unsigned int dom = op.u.killdomain.domain;
int force = op.u.killdomain.force;
@@ -168,6 +187,38 @@ long do_dom0_op(dom0_op_t *u_dom0_op)
}
break;
+ case DOM0_GETDOMAININFO:
+ {
+ struct task_struct *p;
+ u_long flags;
+
+ p = idle0_task.next_task;
+ read_lock_irqsave (&tasklist_lock, flags);
+ do {
+ if ((!is_idle_task (p)) && (p -> domain >= op.u.getdominfo.domain)) {
+ break;
+ }
+ } while ((p = p -> next_task) != &idle0_task);
+
+ if (p == &idle0_task) {
+ ret = -ESRCH;
+ } else {
+ op.u.getdominfo.domain = p -> domain;
+ strcpy (op.u.getdominfo.name, p -> name);
+ op.u.getdominfo.processor = p -> processor;
+ op.u.getdominfo.has_cpu = p -> has_cpu;
+ op.u.getdominfo.state = p -> state;
+ op.u.getdominfo.hyp_events = p -> hyp_events;
+ op.u.getdominfo.mcu_advance = p -> mcu_advance;
+ op.u.getdominfo.pg_head = list_entry(p->pg_head.next,
+ struct pfn_info, list) - frame_table;
+ op.u.getdominfo.tot_pages = p -> tot_pages;
+ }
+ read_unlock_irqrestore (&tasklist_lock, flags);
+ copy_to_user(u_dom0_op, &op, sizeof(op));
+ break;
+ }
+
default:
ret = -ENOSYS;