[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] Merge firebug.cl.cam.ac.uk:/local/scratch/kaf24/xen-2.0-testing.bk



ChangeSet 1.1352, 2005/03/23 09:08:07+00:00, kaf24@xxxxxxxxxxxxxxxxxxxx

        Merge firebug.cl.cam.ac.uk:/local/scratch/kaf24/xen-2.0-testing.bk
        into firebug.cl.cam.ac.uk:/local/scratch/kaf24/xen-unstable.bk



 tools/libxc/xc_private.h |   13 ++++
 xen/common/domain.c      |  144 +++++++++++++++++++++++++++++++++++++----------
 2 files changed, 129 insertions(+), 28 deletions(-)


diff -Nru a/tools/libxc/xc_private.h b/tools/libxc/xc_private.h
--- a/tools/libxc/xc_private.h  2005-03-23 05:03:38 -05:00
+++ b/tools/libxc/xc_private.h  2005-03-23 05:03:38 -05:00
@@ -199,4 +199,17 @@
 
 unsigned long xc_get_m2p_start_mfn ( int xc_handle );
 
+long xc_get_tot_pages(int xc_handle, u32 domid);
+
+int xc_copy_to_domain_page(int xc_handle, u32 domid,
+                            unsigned long dst_pfn, void *src_page);
+
+unsigned long xc_get_filesz(int fd);
+
+char *xc_read_kernel_image(const char *filename, unsigned long *size);
+
+void xc_map_memcpy(unsigned long dst, char *src, unsigned long size,
+                   int xch, u32 dom, unsigned long *parray,
+                   unsigned long vstart);
+
 #endif /* __XC_PRIVATE_H__ */
diff -Nru a/xen/common/domain.c b/xen/common/domain.c
--- a/xen/common/domain.c       2005-03-23 05:03:38 -05:00
+++ b/xen/common/domain.c       2005-03-23 05:03:38 -05:00
@@ -7,6 +7,7 @@
 #include <xen/config.h>
 #include <xen/init.h>
 #include <xen/lib.h>
+#include <xen/sched.h>
 #include <xen/errno.h>
 #include <xen/sched.h>
 #include <xen/mm.h>
@@ -16,7 +17,7 @@
 #include <asm/shadow.h>
 #include <public/dom0_ops.h>
 #include <asm/domain_page.h>
-#include <public/io/domain_controller.h>
+#include <asm/debugger.h>
 
 /* Both these structures are protected by the domlist_lock. */
 rwlock_t domlist_lock = RW_LOCK_UNLOCKED;
@@ -28,20 +29,23 @@
 struct domain *do_createdomain(domid_t dom_id, unsigned int cpu)
 {
     struct domain *d, **pd;
+    struct exec_domain *ed;
 
     if ( (d = alloc_domain_struct()) == NULL )
         return NULL;
 
-    atomic_set(&d->refcnt, 1);
-    atomic_set(&d->pausecnt, 0);
+    ed = d->exec_domain[0];
 
-    shadow_lock_init(d);
+    atomic_set(&d->refcnt, 1);
+    atomic_set(&ed->pausecnt, 0);
 
     d->id          = dom_id;
-    d->processor   = cpu;
+    ed->processor  = cpu;
     d->create_time = NOW();
  
-    memcpy(&d->thread, &idle0_task.thread, sizeof(d->thread));
+    spin_lock_init(&d->time_lock);
+
+    spin_lock_init(&d->big_lock);
 
     spin_lock_init(&d->page_alloc_lock);
     INIT_LIST_HEAD(&d->page_list);
@@ -59,9 +63,9 @@
         return NULL;
     }
     
-    arch_do_createdomain(d);
+    arch_do_createdomain(ed);
     
-    sched_add_domain(d);
+    sched_add_domain(ed);
 
     if ( d->id != IDLE_DOMAIN_ID )
     {
@@ -127,10 +131,13 @@
 
 void domain_kill(struct domain *d)
 {
+    struct exec_domain *ed;
+
     domain_pause(d);
-    if ( !test_and_set_bit(DF_DYING, &d->flags) )
+    if ( !test_and_set_bit(DF_DYING, &d->d_flags) )
     {
-        sched_rem_domain(d);
+        for_each_exec_domain(d, ed)
+            sched_rem_domain(ed);
         domain_relinquish_memory(d);
         put_domain(d);
     }
@@ -139,24 +146,32 @@
 
 void domain_crash(void)
 {
-    if ( current->id == 0 )
+    struct domain *d = current->domain;
+
+    if ( d->id == 0 )
         BUG();
 
-    set_bit(DF_CRASHED, &current->flags);
+    set_bit(DF_CRASHED, &d->d_flags);
 
-    send_guest_virq(dom0, VIRQ_DOM_EXC);
+    send_guest_virq(dom0->exec_domain[0], VIRQ_DOM_EXC);
     
     __enter_scheduler();
     BUG();
 }
 
+extern void trap_to_xendbg(void);
+
 void domain_shutdown(u8 reason)
 {
-    if ( current->id == 0 )
+    struct domain *d = current->domain;
+
+    if ( d->id == 0 )
     {
         extern void machine_restart(char *);
         extern void machine_halt(void);
 
+        debugger_trap_immediate();
+
         if ( reason == SHUTDOWN_poweroff ) 
         {
             printk("Domain 0 halted: halting machine.\n");
@@ -175,10 +190,10 @@
         BUG();
     }
 
-    current->shutdown_code = reason;
-    set_bit(DF_SHUTDOWN, &current->flags);
+    d->shutdown_code = reason;
+    set_bit(DF_SHUTDOWN, &d->d_flags);
 
-    send_guest_virq(dom0, VIRQ_DOM_EXC);
+    send_guest_virq(dom0->exec_domain[0], VIRQ_DOM_EXC);
 
     __enter_scheduler();
 }
@@ -214,7 +229,7 @@
     struct domain **pd;
     atomic_t      old, new;
 
-    if ( !test_bit(DF_DYING, &d->flags) )
+    if ( !test_bit(DF_DYING, &d->d_flags) )
         BUG();
 
     /* May be already destructed, or get_domain() can race us. */
@@ -247,38 +262,101 @@
 
 
 /*
- * final_setup_guestos is used for final setup and launching of domains other
+ * set_info_guest is used for final setup, launching, and state modification 
+ * of domains other than domain 0. ie. the domains that are being built by 
+ * the userspace dom0 domain builder.
+ */
+int set_info_guest(struct domain *p, dom0_setdomaininfo_t *setdomaininfo)
+{
+    int rc = 0;
+    full_execution_context_t *c = NULL;
+    unsigned long vcpu = setdomaininfo->exec_domain;
+    struct exec_domain *ed; 
+
+    if ( (vcpu >= MAX_VIRT_CPUS) || ((ed = p->exec_domain[vcpu]) == NULL) )
+        return -EINVAL;
+    
+    if (test_bit(DF_CONSTRUCTED, &p->d_flags) && 
+        !test_bit(EDF_CTRLPAUSE, &ed->ed_flags))
+        return -EINVAL;
+
+    if ( (c = xmalloc(full_execution_context_t)) == NULL )
+        return -ENOMEM;
+
+    if ( copy_from_user(c, setdomaininfo->ctxt, sizeof(*c)) )
+    {
+        rc = -EFAULT;
+        goto out;
+    }
+    
+    if ( (rc = arch_set_info_guest(ed, c)) != 0 )
+        goto out;
+
+    set_bit(DF_CONSTRUCTED, &p->d_flags);
+
+ out:    
+    if ( c != NULL )
+        xfree(c);
+    return rc;
+}
+
+/*
+ * final_setup_guest is used for final setup and launching of domains other
  * than domain 0. ie. the domains that are being built by the userspace dom0
  * domain builder.
  */
-int final_setup_guestos(struct domain *p, dom0_builddomain_t *builddomain)
+long do_boot_vcpu(unsigned long vcpu, full_execution_context_t *ctxt) 
 {
+    struct domain *d = current->domain;
+    struct exec_domain *ed;
     int rc = 0;
     full_execution_context_t *c;
 
-    if ( (c = xmalloc(sizeof(*c))) == NULL )
+    if ( (vcpu >= MAX_VIRT_CPUS) || (d->exec_domain[vcpu] != NULL) )
+        return -EINVAL;
+
+    if ( alloc_exec_domain_struct(d, vcpu) == NULL )
         return -ENOMEM;
 
-    if ( test_bit(DF_CONSTRUCTED, &p->flags) )
+    if ( (c = xmalloc(full_execution_context_t)) == NULL )
     {
-        rc = -EINVAL;
+        rc = -ENOMEM;
         goto out;
     }
 
-    if ( copy_from_user(c, builddomain->ctxt, sizeof(*c)) )
+    if ( copy_from_user(c, ctxt, sizeof(*c)) )
     {
         rc = -EFAULT;
         goto out;
     }
-    
-    if ( (rc = arch_final_setup_guestos(p,c)) != 0 )
+
+    ed = d->exec_domain[vcpu];
+
+    atomic_set(&ed->pausecnt, 0);
+
+    memcpy(&ed->arch, &idle0_exec_domain.arch, sizeof(ed->arch));
+
+    arch_do_boot_vcpu(ed);
+
+    sched_add_domain(ed);
+
+    if ( (rc = arch_set_info_guest(ed, c)) != 0 ) {
+        sched_rem_domain(ed);


-------------------------------------------------------
This SF.net email is sponsored by: 2005 Windows Mobile Application Contest
Submit applications for Windows Mobile(tm)-based Pocket PCs or Smartphones
for the chance to win $25,000 and application distribution. Enter today at
http://ads.osdn.com/?ad_id=6882&alloc_id=15148&op=click
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxxxx
https://lists.sourceforge.net/lists/listinfo/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.