# HG changeset patch
# User sos22@xxxxxxxxxxxxxxxxxxxx
# Node ID 579d1e771025f8eb36ae537650499dd9a6b66e7b
# Parent 707fcf42a5ae8698c9ed1584f3be61bb3138dd14
# Parent eef23f57f20e931a75481c2e2bce05cf2e9a19c6
Merge.
diff -r 707fcf42a5ae -r 579d1e771025 Makefile
--- a/Makefile Fri Jul 8 12:22:18 2005
+++ b/Makefile Fri Jul 8 12:24:58 2005
@@ -177,10 +177,10 @@
# Legacy targets for compatibility
linux24:
- $(MAKE) 'KERNELS=linux-2.4*' dist
+ $(MAKE) 'KERNELS=linux-2.4*' kernels
linux26:
- $(MAKE) 'KERNELS=linux-2.6*' dist
+ $(MAKE) 'KERNELS=linux-2.6*' kernels
netbsd20:
$(MAKE) netbsd-2.0-xenU-build
diff -r 707fcf42a5ae -r 579d1e771025 tools/libxc/xc_domain.c
--- a/tools/libxc/xc_domain.c Fri Jul 8 12:22:18 2005
+++ b/tools/libxc/xc_domain.c Fri Jul 8 12:24:58 2005
@@ -123,6 +123,33 @@
if( !nr_doms ) return rc;
return nr_doms;
+}
+
+int xc_domain_getinfolist(int xc_handle,
+ u32 first_domain,
+ unsigned int max_domains,
+ xc_domaininfo_t *info)
+{
+ int ret = 0;
+ dom0_op_t op;
+
+ if(mlock(info, max_domains*sizeof(xc_domaininfo_t)) != 0)
+ return -1;
+
+ op.cmd = DOM0_GETDOMAININFOLIST;
+ op.u.getdomaininfolist.first_domain = first_domain;
+ op.u.getdomaininfolist.max_domains = max_domains;
+ op.u.getdomaininfolist.buffer = info;
+
+ if(xc_dom0_op(xc_handle, &op) < 0)
+ ret = -1;
+ else
+ ret = op.u.getdomaininfolist.num_domains;
+
+ if(munlock(info, max_domains*sizeof(xc_domaininfo_t)) != 0)
+ ret = -1;
+
+ return ret;
}
int xc_domain_get_vcpu_context(int xc_handle,
diff -r 707fcf42a5ae -r 579d1e771025 tools/libxc/xc.h
--- a/tools/libxc/xc.h Fri Jul 8 12:22:18 2005
+++ b/tools/libxc/xc.h Fri Jul 8 12:24:58 2005
@@ -192,6 +192,24 @@
xc_dominfo_t *info);
/**
+ * This function will return information about one or more domains, using a
+ * single hypercall. The domain information will be stored into the supplied
+ * array of xc_domaininfo_t structures.
+ *
+ * @parm xc_handle a handle to an open hypervisor interface
+ * @parm first_domain the first domain to enumerate information from.
+ * Domains are currently enumerate in order of creation.
+ * @parm max_domains the number of elements in info
+ * @parm info an array of max_doms size that will contain the information for
+ * the enumerated domains.
+ * @return the number of domains enumerated or -1 on error
+ */
+int xc_domain_getinfolist(int xc_handle,
+ u32 first_domain,
+ unsigned int max_domains,
+ xc_domaininfo_t *info);
+
+/**
* This function returns information about one domain. This information is
* more detailed than the information from xc_domain_getinfo().
*
diff -r 707fcf42a5ae -r 579d1e771025 xen/include/public/dom0_ops.h
--- a/xen/include/public/dom0_ops.h Fri Jul 8 12:22:18 2005
+++ b/xen/include/public/dom0_ops.h Fri Jul 8 12:24:58 2005
@@ -19,7 +19,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 0xAAAA100C
+#define DOM0_INTERFACE_VERSION 0xAAAA100D
/************************************************************************/
@@ -356,6 +356,16 @@
vcpu_guest_context_t *ctxt; /* NB. IN/OUT variable. */
u64 cpu_time;
} dom0_getvcpucontext_t;
+
+#define DOM0_GETDOMAININFOLIST 38
+typedef struct {
+ /* IN variables. */
+ domid_t first_domain;
+ memory_t max_domains;
+ dom0_getdomaininfo_t *buffer;
+ /* OUT variables. */
+ memory_t num_domains;
+} dom0_getdomaininfolist_t;
typedef struct {
u32 cmd;
@@ -389,6 +399,7 @@
dom0_microcode_t microcode;
dom0_ioport_permission_t ioport_permission;
dom0_getvcpucontext_t getvcpucontext;
+ dom0_getdomaininfolist_t getdomaininfolist;
} u;
} dom0_op_t;
diff -r 707fcf42a5ae -r 579d1e771025 xen/common/dom0_ops.c
--- a/xen/common/dom0_ops.c Fri Jul 8 12:22:18 2005
+++ b/xen/common/dom0_ops.c Fri Jul 8 12:24:58 2005
@@ -88,6 +88,60 @@
return err;
}
+static void getdomaininfo(struct domain *d, dom0_getdomaininfo_t *info)
+{
+ struct vcpu *v;
+ u64 cpu_time = 0;
+ int vcpu_count = 0;
+ int flags = DOMFLAGS_PAUSED | DOMFLAGS_BLOCKED;
+
+ info->domain = d->domain_id;
+
+ memset(&info->vcpu_to_cpu, -1, sizeof(info->vcpu_to_cpu));
+ memset(&info->cpumap, 0, sizeof(info->cpumap));
+
+ /*
+ * - domain is marked as paused or blocked only if all its vcpus
+ * are paused or blocked
+ * - domain is marked as running if any of its vcpus is running
+ * - only map vcpus that aren't down. Note, at some point we may
+ * wish to demux the -1 value to indicate down vs. not-ever-booted
+ *
+ */
+ for_each_vcpu ( d, v ) {
+ /* only map vcpus that are up */
+ if ( !(test_bit(_VCPUF_down, &v->vcpu_flags)) )
+ info->vcpu_to_cpu[v->vcpu_id] = v->processor;
+ info->cpumap[v->vcpu_id] = v->cpumap;
+ if ( !(v->vcpu_flags & VCPUF_ctrl_pause) )
+ flags &= ~DOMFLAGS_PAUSED;
+ if ( !(v->vcpu_flags & VCPUF_blocked) )
+ flags &= ~DOMFLAGS_BLOCKED;
+ if ( v->vcpu_flags & VCPUF_running )
+ flags |= DOMFLAGS_RUNNING;
+ if ( v->cpu_time > cpu_time )
+ cpu_time += v->cpu_time;
+ vcpu_count++;
+ }
+
+ info->cpu_time = cpu_time;
+ info->n_vcpu = vcpu_count;
+
+ info->flags = flags |
+ ((d->domain_flags & DOMF_dying) ? DOMFLAGS_DYING : 0) |
+ ((d->domain_flags & DOMF_shutdown) ? DOMFLAGS_SHUTDOWN : 0) |
+ d->shutdown_code << DOMFLAGS_SHUTDOWNSHIFT;
+
+ if (d->ssid != NULL)
+ info->ssidref = ((struct acm_ssid_domain *)d->ssid)->ssidref;
+ else
+ info->ssidref = ACM_DEFAULT_SSID;
+
+ info->tot_pages = d->tot_pages;
+ info->max_pages = d->max_pages;
+ info->shared_info_frame = __pa(d->shared_info) >> PAGE_SHIFT;
+}
+
long do_dom0_op(dom0_op_t *u_dom0_op)
{
long ret = 0;
@@ -306,10 +360,6 @@
case DOM0_GETDOMAININFO:
{
struct domain *d;
- struct vcpu *v;
- u64 cpu_time = 0;
- int vcpu_count = 0;
- int flags = DOMFLAGS_PAUSED | DOMFLAGS_BLOCKED;
read_lock(&domlist_lock);
@@ -328,59 +378,59 @@
read_unlock(&domlist_lock);
- op->u.getdomaininfo.domain = d->domain_id;
-
- memset(&op->u.getdomaininfo.vcpu_to_cpu, -1,
- sizeof(op->u.getdomaininfo.vcpu_to_cpu));
- memset(&op->u.getdomaininfo.cpumap, 0,
- sizeof(op->u.getdomaininfo.cpumap));
-
- /*
- * - domain is marked as paused or blocked only if all its vcpus
- * are paused or blocked
- * - domain is marked as running if any of its vcpus is running
- * - only map vcpus that aren't down. Note, at some point we may
- * wish to demux the -1 value to indicate down vs. not-ever-booted
- *
- */
- for_each_vcpu ( d, v ) {
- /* only map vcpus that are up */
- if ( !(test_bit(_VCPUF_down, &v->vcpu_flags)) )
- op->u.getdomaininfo.vcpu_to_cpu[v->vcpu_id] = v->processor;
- op->u.getdomaininfo.cpumap[v->vcpu_id] = v->cpumap;
- if ( !(v->vcpu_flags & VCPUF_ctrl_pause) )
- flags &= ~DOMFLAGS_PAUSED;
- if ( !(v->vcpu_flags & VCPUF_blocked) )
- flags &= ~DOMFLAGS_BLOCKED;
- if ( v->vcpu_flags & VCPUF_running )
- flags |= DOMFLAGS_RUNNING;
- if ( v->cpu_time > cpu_time )
- cpu_time += v->cpu_time;
- vcpu_count++;
- }
-
- op->u.getdomaininfo.cpu_time = cpu_time;
- op->u.getdomaininfo.n_vcpu = vcpu_count;
-
- op->u.getdomaininfo.flags = flags |
- ((d->domain_flags & DOMF_dying) ? DOMFLAGS_DYING : 0) |
- ((d->domain_flags & DOMF_shutdown) ? DOMFLAGS_SHUTDOWN : 0) |
- d->shutdown_code << DOMFLAGS_SHUTDOWNSHIFT;
-
- if (d->ssid != NULL)
- op->u.getdomaininfo.ssidref = ((struct acm_ssid_domain
*)d->ssid)->ssidref;
- else
- op->u.getdomaininfo.ssidref = ACM_DEFAULT_SSID;
-
- op->u.getdomaininfo.tot_pages = d->tot_pages;
- op->u.getdomaininfo.max_pages = d->max_pages;
- op->u.getdomaininfo.shared_info_frame =
- __pa(d->shared_info) >> PAGE_SHIFT;
+ getdomaininfo(d, &op->u.getdomaininfo);
if ( copy_to_user(u_dom0_op, op, sizeof(*op)) )
ret = -EINVAL;
put_domain(d);
+ }
+ break;
+
+ case DOM0_GETDOMAININFOLIST:
+ {
+ struct domain *d;
+ dom0_getdomaininfo_t info;
+ dom0_getdomaininfo_t *buffer = op->u.getdomaininfolist.buffer;
+ u32 num_domains = 0;
+
+ read_lock(&domlist_lock);
+
+ for_each_domain ( d )
+ {
+ if ( d->domain_id < op->u.getdomaininfolist.first_domain )
+ continue;
+ if ( num_domains == op->u.getdomaininfolist.max_domains )
+ break;
+ if ( (d == NULL) || !get_domain(d) )
+ {
+ ret = -ESRCH;
+ break;
+ }
+
+ getdomaininfo(d, &info);
+
+ put_domain(d);
+
+ if ( copy_to_user(buffer, &info, sizeof(dom0_getdomaininfo_t)) )
+ {
+ ret = -EINVAL;
+ break;
+ }
+
+ buffer++;
+ num_domains++;
+ }
+
+ read_unlock(&domlist_lock);
+
+ if ( ret != 0 )
+ break;
+
+ op->u.getdomaininfolist.num_domains = num_domains;
+
+ if ( copy_to_user(u_dom0_op, op, sizeof(*op)) )
+ ret = -EINVAL;
}
break;
diff -r 707fcf42a5ae -r 579d1e771025 xen/include/acm/acm_core.h
--- a/xen/include/acm/acm_core.h Fri Jul 8 12:22:18 2005
+++ b/xen/include/acm/acm_core.h Fri Jul 8 12:24:58 2005
@@ -20,6 +20,7 @@
#include <xen/spinlock.h>
#include <public/acm.h>
+#include <xen/acm_policy.h>
#include <public/policy_ops.h>
/* Xen-internal representation of the binary policy */
diff -r 707fcf42a5ae -r 579d1e771025 xen/arch/x86/traps.c
--- a/xen/arch/x86/traps.c Fri Jul 8 12:22:18 2005
+++ b/xen/arch/x86/traps.c Fri Jul 8 12:24:58 2005
@@ -94,6 +94,9 @@
DECLARE_TRAP_HANDLER(spurious_interrupt_bug);
DECLARE_TRAP_HANDLER(machine_check);
+long do_set_debugreg(int reg, unsigned long value);
+unsigned long do_get_debugreg(int reg);
+
static int debug_stack_lines = 20;
integer_param("debug_stack_lines", debug_stack_lines);
@@ -568,8 +571,8 @@
static int emulate_privileged_op(struct cpu_user_regs *regs)
{
struct vcpu *v = current;
- unsigned long *reg, eip = regs->eip;
- u8 opcode, modrm_reg = 0, rep_prefix = 0;
+ unsigned long *reg, eip = regs->eip, res;
+ u8 opcode, modrm_reg = 0, modrm_rm = 0, rep_prefix = 0;
unsigned int port, i, op_bytes = 4, data;
/* Legacy prefixes. */
@@ -604,7 +607,9 @@
if ( (opcode & 0xf0) == 0x40 )
{
modrm_reg = (opcode & 4) << 1; /* REX.R */
- /* REX.W, REX.B and REX.X do not need to be decoded. */
+ modrm_rm = (opcode & 1) << 3; /* REX.B */
+
+ /* REX.W and REX.X do not need to be decoded. */
opcode = insn_fetch(u8, 1, eip);
}
#endif
@@ -782,11 +787,10 @@
case 0x20: /* MOV CR?,<reg> */
opcode = insn_fetch(u8, 1, eip);
- if ( (opcode & 0xc0) != 0xc0 )
- goto fail;
- modrm_reg |= opcode & 7;
- reg = decode_register(modrm_reg, regs, 0);
- switch ( (opcode >> 3) & 7 )
+ modrm_reg |= (opcode >> 3) & 7;
+ modrm_rm |= (opcode >> 0) & 7;
+ reg = decode_register(modrm_rm, regs, 0);
+ switch ( modrm_reg )
{
case 0: /* Read CR0 */
*reg = v->arch.guest_context.ctrlreg[0];
@@ -805,13 +809,22 @@
}
break;
+ case 0x21: /* MOV DR?,<reg> */
+ opcode = insn_fetch(u8, 1, eip);
+ modrm_reg |= (opcode >> 3) & 7;
+ modrm_rm |= (opcode >> 0) & 7;
+ reg = decode_register(modrm_rm, regs, 0);
+ if ( (res = do_get_debugreg(modrm_reg)) > (unsigned long)-256 )
+ goto fail;
+ *reg = res;
+ break;
+
case 0x22: /* MOV <reg>,CR? */
opcode = insn_fetch(u8, 1, eip);
- if ( (opcode & 0xc0) != 0xc0 )
- goto fail;
- modrm_reg |= opcode & 7;
- reg = decode_register(modrm_reg, regs, 0);
- switch ( (opcode >> 3) & 7 )
+ modrm_reg |= (opcode >> 3) & 7;
+ modrm_rm |= (opcode >> 0) & 7;
+ reg = decode_register(modrm_rm, regs, 0);
+ switch ( modrm_reg )
{
case 0: /* Write CR0 */
(void)do_fpu_taskswitch(!!(*reg & X86_CR0_TS));
@@ -826,6 +839,15 @@
(void)new_guest_cr3(*reg);
UNLOCK_BIGLOCK(v->domain);
break;
+
+ case 0x23: /* MOV <reg>,DR? */
+ opcode = insn_fetch(u8, 1, eip);
+ modrm_reg |= (opcode >> 3) & 7;
+ modrm_rm |= (opcode >> 0) & 7;
+ reg = decode_register(modrm_rm, regs, 0);
+ if ( do_set_debugreg(modrm_reg, *reg) != 0 )
+ goto fail;
+ break;
default:
goto fail;
diff -r 707fcf42a5ae -r 579d1e771025 tools/python/xen/lowlevel/xc/xc.c
--- a/tools/python/xen/lowlevel/xc/xc.c Fri Jul 8 12:22:18 2005
+++ b/tools/python/xen/lowlevel/xc/xc.c Fri Jul 8 12:24:58 2005
@@ -688,7 +688,7 @@
if ( xc_physinfo(xc->xc_handle, &info) != 0 )
return PyErr_SetFromErrno(xc_error);
- return Py_BuildValue("{s:i,s:i,s:l,s:l,s:l}",
+ return Py_BuildValue("{s:i,s:i,s:i,s:i,s:l,s:l,s:i}",
"threads_per_core", info.threads_per_core,
"cores_per_socket", info.cores_per_socket,
"sockets_per_node", info.sockets_per_node,
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
|