ia64/xen-unstable

changeset 11299:c4ea8d4d2ae1

merge with xen-unstable.hg
author awilliam@xenbuild.aw
date Sun Aug 27 10:24:41 2006 -0600 (2006-08-27)
parents 3e0685ecfe64 5b9ff5e8653a
children 40f6fdb68fa9
files tools/debugger/libxendebug/Makefile tools/debugger/libxendebug/list.h tools/debugger/libxendebug/xendebug.c tools/debugger/libxendebug/xendebug.h tools/libxc/ia64/xc_ia64_hvm_build.c tools/libxc/ia64/xc_ia64_linux_save.c tools/libxc/xc_bvtsched.c tools/misc/cpuperf/Makefile tools/misc/cpuperf/README.txt tools/misc/cpuperf/cpuperf.c tools/misc/cpuperf/cpuperf_perfcntr.h tools/misc/cpuperf/cpuperf_xeno.h tools/misc/cpuperf/module/Makefile tools/misc/cpuperf/module/perfcntr.c tools/misc/cpuperf/p4perf.h xen/arch/ia64/xen/dom0_ops.c xen/arch/ia64/xen/domain.c xen/arch/ia64/xen/hypercall.c xen/arch/x86/dom0_ops.c xen/common/dom0_ops.c xen/common/sched_bvt.c xen/include/asm-ia64/domain.h xen/include/public/arch-ia64.h xen/include/public/sched_ctl.h
line diff
     1.1 --- a/.hgignore	Fri Aug 25 16:21:39 2006 -0600
     1.2 +++ b/.hgignore	Sun Aug 27 10:24:41 2006 -0600
     1.3 @@ -151,6 +151,7 @@
     1.4  ^tools/vtpm_manager/manager/vtpm_managerd$
     1.5  ^tools/xcutils/xc_restore$
     1.6  ^tools/xcutils/xc_save$
     1.7 +^tools/xcutils/readnotes$
     1.8  ^tools/xenmon/xentrace_setmask$
     1.9  ^tools/xenmon/xenbaked$
    1.10  ^tools/xenstat/xentop/xentop$
     2.1 --- a/docs/man/xm.pod.1	Fri Aug 25 16:21:39 2006 -0600
     2.2 +++ b/docs/man/xm.pod.1	Sun Aug 27 10:24:41 2006 -0600
     2.3 @@ -511,55 +511,6 @@ FIXME: we really need a scheduler expert
     2.4  
     2.5  =over 4
     2.6  
     2.7 -=item B<sched-bvt> I<mcuadv> I<warpback> I<warpvalue> I<warpl> I<warpu>
     2.8 -
     2.9 -Performs runtime adjustments to the default parameters for the
    2.10 -Borrowed Virtual Time (BVT) scheduler.  For full information on the
    2.11 -BVT concept, please consult the base paper listed in the B<SEE ALSO>
    2.12 -section.
    2.13 -
    2.14 -Set Borrowed Virtual Time (BVT) scheduler parameters. There are five
    2.15 -required parameters, which are given in order below.
    2.16 -
    2.17 -FIXME: what units are all the BVT params in?
    2.18 -
    2.19 -B<PARAMETERS>
    2.20 -
    2.21 -=over 4
    2.22 -
    2.23 -=item I<mcuadv>
    2.24 -
    2.25 -The MCU (Minimum Charging Unit) advance determines the proportional
    2.26 -share of the CPU that a domain receives. It is set inversely
    2.27 -proportionally to a domain's sharing weight.
    2.28 -
    2.29 -=item I<warpback>
    2.30 -
    2.31 -The amount of `virtual time' the domain is allowed to warp backwards.
    2.32 -
    2.33 -=item I<warpvalue>
    2.34 -
    2.35 -Warp value (FIXME: what does this really mean?)
    2.36 -
    2.37 -=item I<warpl>
    2.38 -
    2.39 -The warp limit is the maximum time a domain can run warped for.
    2.40 -
    2.41 -=item I<warpu>
    2.42 -
    2.43 -The unwarp requirement is the minimum time a domain must run unwarped
    2.44 -for before it can warp again.
    2.45 -
    2.46 -=back 
    2.47 -
    2.48 -=item B<sched-bvt-ctxallow> I<allow>
    2.49 -
    2.50 -Sets the BVT scheduler's context switch allowance. 
    2.51 -
    2.52 -The context switch allowance is similar to the ``quantum'' in
    2.53 -traditional schedulers. It is the minimum time that a scheduled domain
    2.54 -will be allowed to run before being preempted.
    2.55 -
    2.56  =item B<sched-sedf> I<period> I<slice> I<latency-hint> I<extratime> I<weight>
    2.57  
    2.58  Set Simple EDF (Earliest Deadline First) scheduler parameters.  This
    2.59 @@ -1126,12 +1077,6 @@ their binary identifiers (ssidrefs) used
    2.60  
    2.61  B<xmdomain.cfg>(5), B<xentop>(1)
    2.62  
    2.63 -BVT scheduling paper: K.J. Duda and D.R. Cheriton. Borrowed Virtual
    2.64 -Time (BVT) scheduling: supporting latency-sensitive threads in a
    2.65 -general purpose scheduler. In proceedings of the 17th ACM SIGOPS
    2.66 -Symposium on Operating Systems principles, volume 33(5) of ACM
    2.67 -Operating Systems Review, pages 261-267
    2.68 -
    2.69  =head1 AUTHOR
    2.70  
    2.71    Sean Dague <sean at dague dot net>
     3.1 --- a/docs/misc/xend.tex	Fri Aug 25 16:21:39 2006 -0600
     3.2 +++ b/docs/misc/xend.tex	Sun Aug 27 10:24:41 2006 -0600
     3.3 @@ -337,14 +337,6 @@ Python client interface in {\tt xen.xend
     3.4    {\tt xend\_domain\_pincpu(self, id, cpu)}\\:
     3.5    Pin a domain to a cpu.
     3.6  
     3.7 -\item {\tt POST /domain/[dom] bvt\_set(mcuadv, warp, warpl, warpu)},\\
     3.8 -  {\tt xend\_domain\_cpu\_bvt\_set(dom, mcuadv, warp, warpl, warpu)}:\\
     3.9 -  Set BVT scheduler parameters.
    3.10 -
    3.11 -\item {\tt POST /domain/[dom] atropos\_set(period, slice, latency, xtratime)},\\
    3.12 -  {\tt xend\_domain\_cpu\_atropos\_set(dom, period, slice, latency, xtratime)}:\\
    3.13 -  Set atropos scheduler parameters.
    3.14 -
    3.15  \item {\tt POST /domain/[dom] maxmem\_set(memory)},\\
    3.16    {\tt xend\_domain\_maxmem\_set(dom, memory)}:\\
    3.17    Set domain maximum memory limit.
     4.1 --- a/docs/src/interface.tex	Fri Aug 25 16:21:39 2006 -0600
     4.2 +++ b/docs/src/interface.tex	Sun Aug 27 10:24:41 2006 -0600
     4.3 @@ -209,8 +209,8 @@ implement timeout values when they block
     4.4  
     4.5  Xen offers a uniform API for CPU schedulers.  It is possible to choose
     4.6  from a number of schedulers at boot and it should be easy to add more.
     4.7 -The SEDF, BVT, and Credit schedulers are part of the normal Xen
     4.8 -distribution.  BVT and SEDF will be going away and their use should be
     4.9 +The SEDF and Credit schedulers are part of the normal Xen
    4.10 +distribution.  SEDF will be going away and its use should be
    4.11  avoided once the credit scheduler has stabilized and become the default.
    4.12  The Credit scheduler provides proportional fair shares of the
    4.13  host's CPUs to the running domains. It does this while transparently
     5.1 --- a/docs/src/user.tex	Fri Aug 25 16:21:39 2006 -0600
     5.2 +++ b/docs/src/user.tex	Sun Aug 27 10:24:41 2006 -0600
     5.3 @@ -3179,7 +3179,7 @@ editing \path{grub.conf}.
     5.4  \item [ tbuf\_size=xxx ] Set the size of the per-cpu trace buffers, in
     5.5    pages (default 0).  
     5.6  \item [ sched=xxx ] Select the CPU scheduler Xen should use.  The
     5.7 -  current possibilities are `credit' (default), `sedf', and `bvt'.
     5.8 +  current possibilities are `credit' (default), and `sedf'.
     5.9  \item [ apic\_verbosity=debug,verbose ] Print more detailed
    5.10    information about local APIC and IOAPIC configuration.
    5.11  \item [ lapic ] Force use of local APIC even when left disabled by
    5.12 @@ -4135,9 +4135,6 @@ as it will forward multicasts received f
    5.13  
    5.14  \begin{description}
    5.15  
    5.16 -\item[BVT] The BVT scheduler is used to give proportional fair shares
    5.17 -  of the CPU to domains.
    5.18 -
    5.19  \item[Domain] A domain is the execution context that contains a
    5.20    running {\bf virtual machine}.  The relationship between virtual
    5.21    machines and domains on Xen is similar to that between programs and
     6.1 --- a/linux-2.6-xen-sparse/arch/i386/kernel/head-xen.S	Fri Aug 25 16:21:39 2006 -0600
     6.2 +++ b/linux-2.6-xen-sparse/arch/i386/kernel/head-xen.S	Sun Aug 27 10:24:41 2006 -0600
     6.3 @@ -2,6 +2,7 @@
     6.4  
     6.5  .text
     6.6  #include <linux/config.h>
     6.7 +#include <linux/elfnote.h>
     6.8  #include <linux/threads.h>
     6.9  #include <linux/linkage.h>
    6.10  #include <asm/segment.h>
    6.11 @@ -9,6 +10,7 @@
    6.12  #include <asm/thread_info.h>
    6.13  #include <asm/asm-offsets.h>
    6.14  #include <xen/interface/arch-x86_32.h>
    6.15 +#include <xen/interface/elfnote.h>
    6.16  
    6.17  /*
    6.18   * References to members of the new_cpu_data structure.
    6.19 @@ -138,6 +140,7 @@ ENTRY(cpu_gdt_table)
    6.20  	.quad 0x0000000000000000	/* 0xf0 - unused */
    6.21  	.quad 0x0000000000000000	/* 0xf8 - GDT entry 31: double-fault TSS */
    6.22  
    6.23 +#ifdef CONFIG_XEN_COMPAT_030002
    6.24  /*
    6.25   * __xen_guest information
    6.26   */
    6.27 @@ -157,12 +160,8 @@ ENTRY(cpu_gdt_table)
    6.28  	.ascii	",XEN_VER=xen-3.0"
    6.29  	.ascii	",VIRT_BASE=0x"
    6.30  		utoa __PAGE_OFFSET
    6.31 -#ifdef CONFIG_XEN_COMPAT_030002
    6.32  	.ascii	",ELF_PADDR_OFFSET=0x"
    6.33  		utoa __PAGE_OFFSET
    6.34 -#else
    6.35 -	.ascii	",ELF_PADDR_OFFSET=0x0"
    6.36 -#endif /* !CONFIG_XEN_COMPAT_030002 */
    6.37  	.ascii	",VIRT_ENTRY=0x"
    6.38  		utoa (__PAGE_OFFSET + __PHYSICAL_START + VIRT_ENTRY_OFFSET)
    6.39  	.ascii	",HYPERCALL_PAGE=0x"
    6.40 @@ -179,3 +178,24 @@ ENTRY(cpu_gdt_table)
    6.41  #endif
    6.42  	.ascii	",LOADER=generic"
    6.43  	.byte	0
    6.44 +#endif /* CONFIG_XEN_COMPAT_030002 */
    6.45 +
    6.46 +
    6.47 +	ELFNOTE(Xen, XEN_ELFNOTE_GUEST_OS,       .asciz, "linux")	
    6.48 +	ELFNOTE(Xen, XEN_ELFNOTE_GUEST_VERSION,  .asciz, "2.6")
    6.49 +	ELFNOTE(Xen, XEN_ELFNOTE_XEN_VERSION,    .asciz, "xen-3.0")
    6.50 +	ELFNOTE(Xen, XEN_ELFNOTE_VIRT_BASE,      .long,  __PAGE_OFFSET)
    6.51 +#ifdef CONFIG_XEN_COMPAT_030002
    6.52 +	ELFNOTE(Xen, XEN_ELFNOTE_PADDR_OFFSET,   .long,  __PAGE_OFFSET)
    6.53 +#else
    6.54 +	ELFNOTE(Xen, XEN_ELFNOTE_PADDR_OFFSET,   .long,  0)
    6.55 +#endif /* !CONFIG_XEN_COMPAT_030002 */
    6.56 +	ELFNOTE(Xen, XEN_ELFNOTE_ENTRY,          .long,  startup_32)
    6.57 +	ELFNOTE(Xen, XEN_ELFNOTE_HYPERCALL_PAGE, .long,  hypercall_page)
    6.58 +	ELFNOTE(Xen, XEN_ELFNOTE_FEATURES,       .asciz, "writable_page_tables|writable_descriptor_tables|auto_translated_physmap|pae_pgdir_above_4gb|supervisor_mode_kernel")
    6.59 +#ifdef CONFIG_X86_PAE
    6.60 +	ELFNOTE(Xen, XEN_ELFNOTE_PAE_MODE,       .asciz, "yes")
    6.61 +#else
    6.62 +	ELFNOTE(Xen, XEN_ELFNOTE_PAE_MODE,       .asciz, "no")
    6.63 +#endif
    6.64 +	ELFNOTE(Xen, XEN_ELFNOTE_LOADER,         .asciz, "generic")
     7.1 --- a/linux-2.6-xen-sparse/arch/x86_64/kernel/head-xen.S	Fri Aug 25 16:21:39 2006 -0600
     7.2 +++ b/linux-2.6-xen-sparse/arch/x86_64/kernel/head-xen.S	Sun Aug 27 10:24:41 2006 -0600
     7.3 @@ -16,12 +16,15 @@
     7.4  #include <linux/linkage.h>
     7.5  #include <linux/threads.h>
     7.6  #include <linux/init.h>
     7.7 +#include <linux/elfnote.h>
     7.8  #include <asm/desc.h>
     7.9  #include <asm/segment.h>
    7.10  #include <asm/page.h>
    7.11  #include <asm/msr.h>
    7.12  #include <asm/cache.h>
    7.13  
    7.14 +#include <xen/interface/elfnote.h>
    7.15 +
    7.16  	.text
    7.17  	.code64
    7.18  #define VIRT_ENTRY_OFFSET 0x0
    7.19 @@ -131,6 +134,7 @@ gdt_end:
    7.20  	/* zero the remaining page */
    7.21  	.fill PAGE_SIZE / 8 - GDT_ENTRIES,8,0
    7.22  
    7.23 +#ifdef CONFIG_XEN_COMPAT_030002
    7.24  /*
    7.25   * __xen_guest information
    7.26   */
    7.27 @@ -150,12 +154,8 @@ gdt_end:
    7.28  	.ascii	",XEN_VER=xen-3.0"
    7.29  	.ascii	",VIRT_BASE=0x"
    7.30  		utoh __START_KERNEL_map
    7.31 -#ifdef CONFIG_XEN_COMPAT_030002
    7.32  	.ascii	",ELF_PADDR_OFFSET=0x"
    7.33  		utoh __START_KERNEL_map
    7.34 -#else
    7.35 -	.ascii	",ELF_PADDR_OFFSET=0x0"
    7.36 -#endif /* !CONFIG_XEN_COMPAT_030002 */
    7.37  	.ascii	",VIRT_ENTRY=0x"
    7.38  		utoh (__START_KERNEL_map + __PHYSICAL_START + VIRT_ENTRY_OFFSET)
    7.39  	.ascii	",HYPERCALL_PAGE=0x"
    7.40 @@ -166,3 +166,18 @@ gdt_end:
    7.41  	.ascii	         "|supervisor_mode_kernel"
    7.42  	.ascii	",LOADER=generic"
    7.43  	.byte	0
    7.44 +#endif /* CONFIG_XEN_COMPAT_030002 */
    7.45 +	
    7.46 +	ELFNOTE(Xen, XEN_ELFNOTE_GUEST_OS,       .asciz, "linux")
    7.47 +	ELFNOTE(Xen, XEN_ELFNOTE_GUEST_VERSION,  .asciz, "2.6")
    7.48 +	ELFNOTE(Xen, XEN_ELFNOTE_XEN_VERSION,    .asciz, "xen-3.0")
    7.49 +	ELFNOTE(Xen, XEN_ELFNOTE_VIRT_BASE,      .quad,  __START_KERNEL_map)
    7.50 +#ifdef CONFIG_XEN_COMPAT_030002
    7.51 +	ELFNOTE(Xen, XEN_ELFNOTE_PADDR_OFFSET,   .quad,  __START_KERNEL_map)
    7.52 +#else
    7.53 +	ELFNOTE(Xen, XEN_ELFNOTE_PADDR_OFFSET,   .quad,  0)
    7.54 +#endif /* !CONFIG_XEN_COMPAT_030002 */
    7.55 +	ELFNOTE(Xen, XEN_ELFNOTE_ENTRY,          .quad,  startup_64)
    7.56 +	ELFNOTE(Xen, XEN_ELFNOTE_HYPERCALL_PAGE, .quad,  hypercall_page)
    7.57 +	ELFNOTE(Xen, XEN_ELFNOTE_FEATURES,       .asciz, "writable_page_tables|writable_descriptor_tables|auto_translated_physmap|pae_pgdir_above_4gb|supervisor_mode_kernel")
    7.58 +	ELFNOTE(Xen, XEN_ELFNOTE_LOADER,         .asciz, "generic")
     8.1 --- a/linux-2.6-xen-sparse/drivers/xen/privcmd/privcmd.c	Fri Aug 25 16:21:39 2006 -0600
     8.2 +++ b/linux-2.6-xen-sparse/drivers/xen/privcmd/privcmd.c	Sun Aug 27 10:24:41 2006 -0600
     8.3 @@ -35,9 +35,6 @@
     8.4  static struct proc_dir_entry *privcmd_intf;
     8.5  static struct proc_dir_entry *capabilities_intf;
     8.6  
     8.7 -#define NR_HYPERCALLS 64
     8.8 -static DECLARE_BITMAP(hypercall_permission_map, NR_HYPERCALLS);
     8.9 -
    8.10  static int privcmd_ioctl(struct inode *inode, struct file *file,
    8.11  			 unsigned int cmd, unsigned long data)
    8.12  {
    8.13 @@ -51,12 +48,6 @@ static int privcmd_ioctl(struct inode *i
    8.14  		if (copy_from_user(&hypercall, udata, sizeof(hypercall)))
    8.15  			return -EFAULT;
    8.16  
    8.17 -		/* Check hypercall number for validity. */
    8.18 -		if (hypercall.op >= NR_HYPERCALLS)
    8.19 -			return -EINVAL;
    8.20 -		if (!test_bit(hypercall.op, hypercall_permission_map))
    8.21 -			return -EINVAL;
    8.22 -
    8.23  #if defined(__i386__)
    8.24  		__asm__ __volatile__ (
    8.25  			"pushl %%ebx; pushl %%ecx; pushl %%edx; "
    8.26 @@ -262,20 +253,6 @@ static int __init privcmd_init(void)
    8.27  	if (!is_running_on_xen())
    8.28  		return -ENODEV;
    8.29  
    8.30 -	/* Set of hypercalls that privileged applications may execute. */
    8.31 -	set_bit(__HYPERVISOR_acm_op,           hypercall_permission_map);
    8.32 -	set_bit(__HYPERVISOR_dom0_op,          hypercall_permission_map);
    8.33 -	set_bit(__HYPERVISOR_event_channel_op, hypercall_permission_map);
    8.34 -	set_bit(__HYPERVISOR_memory_op,        hypercall_permission_map);
    8.35 -	set_bit(__HYPERVISOR_mmu_update,       hypercall_permission_map);
    8.36 -	set_bit(__HYPERVISOR_mmuext_op,        hypercall_permission_map);
    8.37 -	set_bit(__HYPERVISOR_xen_version,      hypercall_permission_map);
    8.38 -	set_bit(__HYPERVISOR_sched_op,         hypercall_permission_map);
    8.39 -	set_bit(__HYPERVISOR_sched_op_compat,  hypercall_permission_map);
    8.40 -	set_bit(__HYPERVISOR_event_channel_op_compat,
    8.41 -		hypercall_permission_map);
    8.42 -	set_bit(__HYPERVISOR_hvm_op,           hypercall_permission_map);
    8.43 -
    8.44  	privcmd_intf = create_xen_proc_entry("privcmd", 0400);
    8.45  	if (privcmd_intf != NULL)
    8.46  		privcmd_intf->proc_fops = &privcmd_file_ops;
     9.1 --- a/patches/linux-2.6.16.13/series	Fri Aug 25 16:21:39 2006 -0600
     9.2 +++ b/patches/linux-2.6.16.13/series	Sun Aug 27 10:24:41 2006 -0600
     9.3 @@ -20,3 +20,4 @@ xen-hotplug.patch
     9.4  xenoprof-generic.patch
     9.5  x86-put-note-sections-into-a-pt_note-segment-in-vmlinux.patch
     9.6  x86_64-put-note-sections-into-a-pt_note-segment-in-vmlinux.patch
     9.7 +x86-elfnote-as-preprocessor-macro.patch
    10.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    10.2 +++ b/patches/linux-2.6.16.13/x86-elfnote-as-preprocessor-macro.patch	Sun Aug 27 10:24:41 2006 -0600
    10.3 @@ -0,0 +1,44 @@
    10.4 +
    10.5 +diff -r 4b7cd997c08f include/linux/elfnote.h
    10.6 +--- a/include/linux/elfnote.h	Wed Aug 23 11:48:46 2006 +0100
    10.7 ++++ b/include/linux/elfnote.h	Wed Aug 23 12:44:27 2006 +0100
    10.8 +@@ -31,22 +31,24 @@
    10.9 + /*
   10.10 +  * Generate a structure with the same shape as Elf{32,64}_Nhdr (which
   10.11 +  * turn out to be the same size and shape), followed by the name and
   10.12 +- * desc data with appropriate padding.  The 'desc' argument includes
   10.13 +- * the assembler pseudo op defining the type of the data: .asciz
   10.14 +- * "hello, world"
   10.15 ++ * desc data with appropriate padding.  The 'desctype' argument is the
   10.16 ++ * assembler pseudo op defining the type of the data e.g. .asciz while
   10.17 ++ * 'descdata' is the data itself e.g.  "hello, world".
   10.18 ++ *
   10.19 ++ * e.g. ELFNOTE(XYZCo, 42, .asciz, "forty-two")
   10.20 ++ *      ELFNOTE(XYZCo, 12, .long, 0xdeadbeef)
   10.21 +  */
   10.22 +-.macro ELFNOTE name type desc:vararg
   10.23 +-.pushsection ".note.\name"
   10.24 +-  .align 4
   10.25 +-  .long 2f - 1f			/* namesz */
   10.26 +-  .long 4f - 3f			/* descsz */
   10.27 +-  .long \type
   10.28 +-1:.asciz "\name"
   10.29 +-2:.align 4
   10.30 +-3:\desc
   10.31 +-4:.align 4
   10.32 +-.popsection
   10.33 +-.endm
   10.34 ++#define ELFNOTE(name, type, desctype, descdata)	\
   10.35 ++.pushsection .note.name			;	\
   10.36 ++  .align 4				;	\
   10.37 ++  .long 2f - 1f		/* namesz */	;	\
   10.38 ++  .long 4f - 3f		/* descsz */	;	\
   10.39 ++  .long type				;	\
   10.40 ++1:.asciz "name"				;	\
   10.41 ++2:.align 4				;	\
   10.42 ++3:desctype descdata			;	\
   10.43 ++4:.align 4				;	\
   10.44 ++.popsection				;
   10.45 + #else	/* !__ASSEMBLER__ */
   10.46 + #include <linux/elf.h>
   10.47 + /*
    11.1 --- a/tools/blktap/lib/xs_api.c	Fri Aug 25 16:21:39 2006 -0600
    11.2 +++ b/tools/blktap/lib/xs_api.c	Sun Aug 27 10:24:41 2006 -0600
    11.3 @@ -180,8 +180,7 @@ char *get_dom_domid(struct xs_handle *h,
    11.4  	
    11.5  	e = xs_directory(h, xth, "/local/domain", &num);
    11.6  	
    11.7 -	i = 0;
    11.8 -	while (i < num) {
    11.9 +	for (i = 0; (i < num) && (domid == NULL); i++) {
   11.10  		asprintf(&path, "/local/domain/%s/name", e[i]);
   11.11  		val = xs_read(h, xth, path, &len);
   11.12  		free(path);
   11.13 @@ -192,12 +191,9 @@ char *get_dom_domid(struct xs_handle *h,
   11.14  			/* match! */
   11.15  			asprintf(&path, "/local/domain/%s/domid", e[i]);
   11.16  			domid = xs_read(h, xth, path, &len);
   11.17 -			free(val);
   11.18  			free(path);
   11.19 -			break;
   11.20  		}
   11.21  		free(val);
   11.22 -		i++;
   11.23  	}
   11.24  	xs_transaction_end(h, xth, 0);
   11.25  	
    12.1 --- a/tools/debugger/gdb/gdb-6.2.1-xen-sparse/gdb/gdbserver/linux-xen-low.c	Fri Aug 25 16:21:39 2006 -0600
    12.2 +++ b/tools/debugger/gdb/gdb-6.2.1-xen-sparse/gdb/gdbserver/linux-xen-low.c	Sun Aug 27 10:24:41 2006 -0600
    12.3 @@ -54,15 +54,6 @@ curvcpuid()
    12.4  
    12.5  }
    12.6  
    12.7 -
    12.8 -#define DOMFLAGS_DYING     (1<<0) /* Domain is scheduled to die.             */
    12.9 -#define DOMFLAGS_SHUTDOWN  (1<<2) /* The guest OS has shut down.             */
   12.10 -#define DOMFLAGS_PAUSED    (1<<3) /* Currently paused by control software.   */
   12.11 -#define DOMFLAGS_BLOCKED   (1<<4) /* Currently blocked pending an event.     */
   12.12 -#define DOMFLAGS_RUNNING   (1<<5) /* Domain is currently running.            */
   12.13 -
   12.14 -
   12.15 -
   12.16  struct inferior_list all_processes;
   12.17  static int current_domid;
   12.18  static int expect_signal = 0;
    13.1 --- a/tools/debugger/libxendebug/Makefile	Fri Aug 25 16:21:39 2006 -0600
    13.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    13.3 @@ -1,75 +0,0 @@
    13.4 -
    13.5 -INSTALL		= install
    13.6 -INSTALL_PROG	= $(INSTALL) -m0755
    13.7 -INSTALL_DATA	= $(INSTALL) -m0644
    13.8 -INSTALL_DIR	= $(INSTALL) -d -m0755
    13.9 -
   13.10 -MAJOR    = 3.0
   13.11 -MINOR    = 0
   13.12 -
   13.13 -XEN_ROOT = ../../..
   13.14 -include $(XEN_ROOT)/tools/Rules.mk
   13.15 -
   13.16 -SRCS     := xendebug.c
   13.17 -
   13.18 -CFLAGS   += -Werror -fno-strict-aliasing
   13.19 -CFLAGS   += $(INCLUDES) -I. -I$(XEN_ROOT)/tools/libxc
   13.20 -# Get gcc to generate the dependencies for us.
   13.21 -CFLAGS   += -Wp,-MD,.$(@F).d
   13.22 -DEPS     = .*.d
   13.23 -
   13.24 -LDFLAGS  += -L$(XEN_ROOT)/tools/libxc -lxenctrl
   13.25 -
   13.26 -LIB_OBJS := $(patsubst %.c,%.o,$(SRCS))
   13.27 -PIC_OBJS := $(patsubst %.c,%.opic,$(SRCS))
   13.28 -
   13.29 -LIB      := libxendebug.a libxendebug.so
   13.30 -LIB      += libxendebug.so.$(MAJOR) libxendebug.so.$(MAJOR).$(MINOR)
   13.31 -
   13.32 -.PHONY: all
   13.33 -all: build
   13.34 -
   13.35 -.PHONY: build
   13.36 -build:
   13.37 -	$(MAKE) $(LIB)
   13.38 -
   13.39 -.PHONY: install
   13.40 -install: build
   13.41 -	[ -d $(DESTDIR)/usr/$(LIBDIR) ] || $(INSTALL_DIR) $(DESTDIR)/usr/$(LIBDIR)
   13.42 -	[ -d $(DESTDIR)/usr/include ] || $(INSTALL_DIR) $(DESTDIR)/usr/include
   13.43 -	$(INSTALL_PROG) libxendebug.so.$(MAJOR).$(MINOR) $(DESTDIR)/usr/$(LIBDIR)
   13.44 -	$(INSTALL_DATA) libxendebug.a $(DESTDIR)/usr/$(LIBDIR)
   13.45 -	ln -sf libxendebug.so.$(MAJOR).$(MINOR) $(DESTDIR)/usr/$(LIBDIR)/libxendebug.so.$(MAJOR)
   13.46 -	ln -sf libxendebug.so.$(MAJOR) $(DESTDIR)/usr/$(LIBDIR)/libxendebug.so
   13.47 -	$(INSTALL_DATA) xendebug.h $(DESTDIR)/usr/include
   13.48 -
   13.49 -.PHONY: TAGS
   13.50 -TAGS:
   13.51 -	etags -t $(SRCS) *.h
   13.52 -
   13.53 -.PHONY: clean
   13.54 -clean:
   13.55 -	rm -rf *.a *.so* *.o *.opic *.rpm $(LIB) *~ $(DEPS) xen
   13.56 -
   13.57 -.PHONY: rpm
   13.58 -rpm: build
   13.59 -	rm -rf staging
   13.60 -	mkdir staging
   13.61 -	mkdir staging/i386
   13.62 -	rpmbuild --define "staging$$PWD/staging" --define '_builddir.' \
   13.63 -		--define "_rpmdir$$PWD/staging" -bb rpm.spec
   13.64 -	mv staging/i386/*.rpm .
   13.65 -	rm -rf staging
   13.66 -
   13.67 -libxendebug.a: $(LIB_OBJS)
   13.68 -	$(AR) rc $@ $^
   13.69 -
   13.70 -libxendebug.so: libxendebug.so.$(MAJOR)
   13.71 -	ln -sf $< $@
   13.72 -libxendebug.so.$(MAJOR): libxendebug.so.$(MAJOR).$(MINOR)
   13.73 -	ln -sf $< $@
   13.74 -
   13.75 -libxendebug.so.$(MAJOR).$(MINOR): $(PIC_OBJS)
   13.76 -	$(CC) $(CFLAGS) $(LDFLAGS) -Wl,-soname -Wl,libxendebug.so.$(MAJOR) -shared -o $@ $^
   13.77 -
   13.78 --include $(DEPS)
    14.1 --- a/tools/debugger/libxendebug/list.h	Fri Aug 25 16:21:39 2006 -0600
    14.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    14.3 @@ -1,186 +0,0 @@
    14.4 -#ifndef _LINUX_LIST_H
    14.5 -#define _LINUX_LIST_H
    14.6 -
    14.7 -/*
    14.8 - * Simple doubly linked list implementation.
    14.9 - *
   14.10 - * Some of the internal functions ("__xxx") are useful when
   14.11 - * manipulating whole lists rather than single entries, as
   14.12 - * sometimes we already know the next/prev entries and we can
   14.13 - * generate better code by using them directly rather than
   14.14 - * using the generic single-entry routines.
   14.15 - */
   14.16 -
   14.17 -struct list_head {
   14.18 -	struct list_head *next, *prev;
   14.19 -};
   14.20 -
   14.21 -#define LIST_HEAD_INIT(name) { &(name), &(name) }
   14.22 -
   14.23 -#define LIST_HEAD(name) \
   14.24 -	struct list_head name = LIST_HEAD_INIT(name)
   14.25 -
   14.26 -#define INIT_LIST_HEAD(ptr) do { \
   14.27 -	(ptr)->next = (ptr); (ptr)->prev = (ptr); \
   14.28 -} while (0)
   14.29 -
   14.30 -/*
   14.31 - * Insert a new entry between two known consecutive entries. 
   14.32 - *
   14.33 - * This is only for internal list manipulation where we know
   14.34 - * the prev/next entries already!
   14.35 - */
   14.36 -static __inline__ void __list_add(struct list_head * new,
   14.37 -	struct list_head * prev,
   14.38 -	struct list_head * next)
   14.39 -{
   14.40 -	next->prev = new;
   14.41 -	new->next = next;
   14.42 -	new->prev = prev;
   14.43 -	prev->next = new;
   14.44 -}
   14.45 -
   14.46 -/**
   14.47 - * list_add - add a new entry
   14.48 - * @new: new entry to be added
   14.49 - * @head: list head to add it after
   14.50 - *
   14.51 - * Insert a new entry after the specified head.
   14.52 - * This is good for implementing stacks.
   14.53 - */
   14.54 -static __inline__ void list_add(struct list_head *new, struct list_head *head)
   14.55 -{
   14.56 -	__list_add(new, head, head->next);
   14.57 -}
   14.58 -
   14.59 -/**
   14.60 - * list_add_tail - add a new entry
   14.61 - * @new: new entry to be added
   14.62 - * @head: list head to add it before
   14.63 - *
   14.64 - * Insert a new entry before the specified head.
   14.65 - * This is useful for implementing queues.
   14.66 - */
   14.67 -static __inline__ void list_add_tail(struct list_head *new, struct list_head *head)
   14.68 -{
   14.69 -	__list_add(new, head->prev, head);
   14.70 -}
   14.71 -
   14.72 -/*
   14.73 - * Delete a list entry by making the prev/next entries
   14.74 - * point to each other.
   14.75 - *
   14.76 - * This is only for internal list manipulation where we know
   14.77 - * the prev/next entries already!
   14.78 - */
   14.79 -static __inline__ void __list_del(struct list_head * prev,
   14.80 -				  struct list_head * next)
   14.81 -{
   14.82 -	next->prev = prev;
   14.83 -	prev->next = next;
   14.84 -}
   14.85 -
   14.86 -/**
   14.87 - * list_del - deletes entry from list.
   14.88 - * @entry: the element to delete from the list.
   14.89 - * Note: list_empty on entry does not return true after this, the entry is in an undefined state.
   14.90 - */
   14.91 -static __inline__ void list_del(struct list_head *entry)
   14.92 -{
   14.93 -	__list_del(entry->prev, entry->next);
   14.94 -}
   14.95 -
   14.96 -/**
   14.97 - * list_del_init - deletes entry from list and reinitialize it.
   14.98 - * @entry: the element to delete from the list.
   14.99 - */
  14.100 -static __inline__ void list_del_init(struct list_head *entry)
  14.101 -{
  14.102 -	__list_del(entry->prev, entry->next);
  14.103 -	INIT_LIST_HEAD(entry); 
  14.104 -}
  14.105 -
  14.106 -/**
  14.107 - * list_empty - tests whether a list is empty
  14.108 - * @head: the list to test.
  14.109 - */
  14.110 -static __inline__ int list_empty(struct list_head *head)
  14.111 -{
  14.112 -	return head->next == head;
  14.113 -}
  14.114 -
  14.115 -/**
  14.116 - * list_splice - join two lists
  14.117 - * @list: the new list to add.
  14.118 - * @head: the place to add it in the first list.
  14.119 - */
  14.120 -static __inline__ void list_splice(struct list_head *list, struct list_head *head)
  14.121 -{
  14.122 -	struct list_head *first = list->next;
  14.123 -
  14.124 -	if (first != list) {
  14.125 -		struct list_head *last = list->prev;
  14.126 -		struct list_head *at = head->next;
  14.127 -
  14.128 -		first->prev = head;
  14.129 -		head->next = first;
  14.130 -
  14.131 -		last->next = at;
  14.132 -		at->prev = last;
  14.133 -	}
  14.134 -}
  14.135 -
  14.136 -/**
  14.137 - * list_entry - get the struct for this entry
  14.138 - * @ptr:	the &struct list_head pointer.
  14.139 - * @type:	the type of the struct this is embedded in.
  14.140 - * @member:	the name of the list_struct within the struct.
  14.141 - */
  14.142 -#define list_entry(ptr, type, member) \
  14.143 -	((type *)((char *)(ptr)-(unsigned long)(&((type *)0)->member)))
  14.144 -
  14.145 -/**
  14.146 - * list_for_each	-	iterate over a list
  14.147 - * @pos:	the &struct list_head to use as a loop counter.
  14.148 - * @head:	the head for your list.
  14.149 - */
  14.150 -#define list_for_each(pos, head) \
  14.151 -	for (pos = (head)->next; pos != (head); pos = pos->next)
  14.152 -        	
  14.153 -/**
  14.154 - * list_for_each_safe	-	iterate over a list safe against removal of list entry
  14.155 - * @pos:	the &struct list_head to use as a loop counter.
  14.156 - * @n:		another &struct list_head to use as temporary storage
  14.157 - * @head:	the head for your list.
  14.158 - */
  14.159 -#define list_for_each_safe(pos, n, head) \
  14.160 -	for (pos = (head)->next, n = pos->next; pos != (head); \
  14.161 -		pos = n, n = pos->next)
  14.162 -
  14.163 -/**
  14.164 - * list_for_each_entry	-	iterate over list of given type
  14.165 - * @pos:	the type * to use as a loop counter.
  14.166 - * @head:	the head for your list.
  14.167 - * @member:	the name of the list_struct within the struct.
  14.168 - */
  14.169 -#define list_for_each_entry(pos, head, member)				\
  14.170 -	for (pos = list_entry((head)->next, typeof(*pos), member),	\
  14.171 -		     prefetch(pos->member.next);			\
  14.172 -	     &pos->member != (head); 					\
  14.173 -	     pos = list_entry(pos->member.next, typeof(*pos), member),	\
  14.174 -		     prefetch(pos->member.next))
  14.175 -
  14.176 -/**
  14.177 - * list_for_each_entry_safe - iterate over list of given type safe against removal of list entry
  14.178 - * @pos:	the type * to use as a loop counter.
  14.179 - * @n:		another type * to use as temporary storage
  14.180 - * @head:	the head for your list.
  14.181 - * @member:	the name of the list_struct within the struct.
  14.182 - */
  14.183 -#define list_for_each_entry_safe(pos, n, head, member)			\
  14.184 -	for (pos = list_entry((head)->next, typeof(*pos), member),	\
  14.185 -		n = list_entry(pos->member.next, typeof(*pos), member);	\
  14.186 -	     &pos->member != (head); 					\
  14.187 -	     pos = n, n = list_entry(n->member.next, typeof(*n), member))
  14.188 -#endif /* _LINUX_LIST_H */
  14.189 -
    15.1 --- a/tools/debugger/libxendebug/xendebug.c	Fri Aug 25 16:21:39 2006 -0600
    15.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    15.3 @@ -1,599 +0,0 @@
    15.4 -/*
    15.5 - * xendebug.c
    15.6 - *
    15.7 - * alex ho
    15.8 - * http://www.cl.cam.ac.uk/netos/pdb
    15.9 - *
   15.10 - * xendebug_memory_page adapted from xc_ptrace.c
   15.11 - */
   15.12 -
   15.13 -#include <stdio.h>
   15.14 -#include <stdlib.h>
   15.15 -#include <string.h>
   15.16 -#include <errno.h>
   15.17 -#include <sys/mman.h>
   15.18 -#include <xenctrl.h>
   15.19 -#include "list.h"
   15.20 -
   15.21 -#if defined(__i386__)
   15.22 -#define L1_PAGETABLE_SHIFT       12
   15.23 -#define L2_PAGETABLE_SHIFT       22
   15.24 -#elif defined(__x86_64__)
   15.25 -#define L1_PAGETABLE_SHIFT      12
   15.26 -#define L2_PAGETABLE_SHIFT      21
   15.27 -#define L3_PAGETABLE_SHIFT      30
   15.28 -#define L4_PAGETABLE_SHIFT      39
   15.29 -#endif
   15.30 -
   15.31 -#define PAGE_SHIFT L1_PAGETABLE_SHIFT
   15.32 -#define PAGE_SIZE  (1UL<<PAGE_SHIFT)
   15.33 -#define PAGE_MASK  (~(PAGE_SIZE - 1))
   15.34 -
   15.35 -/* from xen/include/asm-x86/processor.h */
   15.36 -#define X86_EFLAGS_TF	0x00000100 /* Trap Flag */
   15.37 -
   15.38 -typedef int boolean;
   15.39 -#define true 1
   15.40 -#define false 0
   15.41 -
   15.42 -
   15.43 -typedef struct bwcpoint                           /* break/watch/catch point */
   15.44 -{
   15.45 -    struct list_head list;
   15.46 -    unsigned long address;
   15.47 -    uint32_t domain;
   15.48 -    uint8_t old_value;                             /* old value for software bkpt */
   15.49 -} bwcpoint_t, *bwcpoint_p;
   15.50 -
   15.51 -static bwcpoint_t bwcpoint_list;
   15.52 -
   15.53 -
   15.54 -
   15.55 -typedef struct domain_context                 /* local cache of domain state */
   15.56 -{
   15.57 -    struct list_head     list;
   15.58 -    uint32_t                  domid;
   15.59 -    boolean              valid[MAX_VIRT_CPUS];
   15.60 -    vcpu_guest_context_t context[MAX_VIRT_CPUS];
   15.61 -
   15.62 -    long            total_pages;
   15.63 -    xen_pfn_t      *page_array;
   15.64 -
   15.65 -    unsigned long   cr3_phys[MAX_VIRT_CPUS];
   15.66 -    unsigned long  *cr3_virt[MAX_VIRT_CPUS];
   15.67 -    unsigned long   pde_phys[MAX_VIRT_CPUS];     
   15.68 -    unsigned long  *pde_virt[MAX_VIRT_CPUS];
   15.69 -    unsigned long   page_phys[MAX_VIRT_CPUS];     
   15.70 -    unsigned long  *page_virt[MAX_VIRT_CPUS];
   15.71 -    int             page_perm[MAX_VIRT_CPUS];
   15.72 -} domain_context_t, *domain_context_p;
   15.73 -
   15.74 -static domain_context_t domain_context_list;
   15.75 -
   15.76 -/* initialization */
   15.77 -
   15.78 -static boolean xendebug_initialized = false;
   15.79 -
   15.80 -static __inline__ void
   15.81 -xendebug_initialize()
   15.82 -{
   15.83 -    if ( !xendebug_initialized )
   15.84 -    {
   15.85 -        memset((void *) &domain_context_list, 0, sizeof(domain_context_t));
   15.86 -        INIT_LIST_HEAD(&domain_context_list.list);
   15.87 -
   15.88 -        memset((void *) &bwcpoint_list, 0, sizeof(bwcpoint_t));
   15.89 -        INIT_LIST_HEAD(&bwcpoint_list.list);
   15.90 -
   15.91 -        xendebug_initialized = true;
   15.92 -    }
   15.93 -}
   15.94 -
   15.95 -/**************/
   15.96 -
   15.97 -static domain_context_p
   15.98 -xendebug_domain_context_search (uint32_t domid)
   15.99 -{
  15.100 -    struct list_head *entry;
  15.101 -    domain_context_p  ctxt;
  15.102 -
  15.103 -    list_for_each(entry, &domain_context_list.list)
  15.104 -    {
  15.105 -        ctxt = list_entry(entry, domain_context_t, list);
  15.106 -        if ( domid == ctxt->domid )
  15.107 -            return ctxt;
  15.108 -    }
  15.109 -    return (domain_context_p)NULL;
  15.110 -}
  15.111 -
  15.112 -static __inline__ domain_context_p
  15.113 -xendebug_get_context (int xc_handle, uint32_t domid, uint32_t vcpu)
  15.114 -{
  15.115 -    int rc;
  15.116 -    domain_context_p ctxt;
  15.117 -
  15.118 -    xendebug_initialize();
  15.119 -
  15.120 -    if ( (ctxt = xendebug_domain_context_search(domid)) == NULL)
  15.121 -        return NULL;
  15.122 -
  15.123 -    if ( !ctxt->valid[vcpu] )
  15.124 -    {
  15.125 -        if ( (rc = xc_vcpu_getcontext(xc_handle, domid, vcpu, 
  15.126 -                                      &ctxt->context[vcpu])) )
  15.127 -            return NULL;
  15.128 -
  15.129 -        ctxt->valid[vcpu] = true;
  15.130 -    }
  15.131 -
  15.132 -    return ctxt;
  15.133 -}
  15.134 -
  15.135 -static __inline__ int
  15.136 -xendebug_set_context (int xc_handle, domain_context_p ctxt, uint32_t vcpu)
  15.137 -{
  15.138 -    dom0_op_t op;
  15.139 -    int rc;
  15.140 -
  15.141 -    if ( !ctxt->valid[vcpu] )
  15.142 -        return -EINVAL;
  15.143 -
  15.144 -    op.interface_version = DOM0_INTERFACE_VERSION;
  15.145 -    op.cmd = DOM0_SETVCPUCONTEXT;
  15.146 -    op.u.setvcpucontext.domain = ctxt->domid;
  15.147 -    op.u.setvcpucontext.vcpu = vcpu;
  15.148 -    op.u.setvcpucontext.ctxt = &ctxt->context[vcpu];
  15.149 -
  15.150 -    if ( (rc = mlock(&ctxt->context[vcpu], sizeof(vcpu_guest_context_t))) )
  15.151 -        return rc;
  15.152 -
  15.153 -    rc = xc_dom0_op(xc_handle, &op);
  15.154 -    (void) munlock(&ctxt->context[vcpu], sizeof(vcpu_guest_context_t));
  15.155 -
  15.156 -    return rc;
  15.157 -}
  15.158 -
  15.159 -/**************/
  15.160 -
  15.161 -int
  15.162 -xendebug_attach(int xc_handle,
  15.163 -                uint32_t domid,
  15.164 -                uint32_t vcpu)
  15.165 -{
  15.166 -    domain_context_p ctxt;
  15.167 -
  15.168 -    xendebug_initialize();
  15.169 -
  15.170 -    if ( (ctxt = malloc(sizeof(domain_context_t))) == NULL )
  15.171 -        return -1;
  15.172 -    memset(ctxt, 0, sizeof(domain_context_t));
  15.173 -    
  15.174 -    ctxt->domid = domid;
  15.175 -    list_add(&ctxt->list, &domain_context_list.list);
  15.176 -
  15.177 -    return xc_domain_pause(xc_handle, domid);
  15.178 -}
  15.179 -
  15.180 -int
  15.181 -xendebug_detach(int xc_handle,
  15.182 -                uint32_t domid,
  15.183 -                uint32_t vcpu)
  15.184 -{
  15.185 -    domain_context_p ctxt;
  15.186 -    
  15.187 -    xendebug_initialize();
  15.188 -
  15.189 -    if ( (ctxt = xendebug_domain_context_search (domid)) == NULL)
  15.190 -        return -EINVAL;
  15.191 -
  15.192 -    list_del(&ctxt->list);
  15.193 -
  15.194 -    if ( ctxt->page_array ) free(ctxt->page_array);
  15.195 -
  15.196 -    free(ctxt);
  15.197 -
  15.198 -    return xc_domain_unpause(xc_handle, domid);
  15.199 -}
  15.200 -
  15.201 -int
  15.202 -xendebug_read_registers(int xc_handle,
  15.203 -                        uint32_t domid,
  15.204 -                        uint32_t vcpu,
  15.205 -                        cpu_user_regs_t **regs)
  15.206 -{
  15.207 -    domain_context_p ctxt;
  15.208 -    int rc = -1;
  15.209 -
  15.210 -    xendebug_initialize();
  15.211 -
  15.212 -    ctxt = xendebug_get_context(xc_handle, domid, vcpu);
  15.213 -    if (ctxt)
  15.214 -    {
  15.215 -        *regs = &ctxt->context[vcpu].user_regs;
  15.216 -        rc = 0;
  15.217 -    }
  15.218 -
  15.219 -    return rc;
  15.220 -}
  15.221 -
  15.222 -int
  15.223 -xendebug_read_fpregisters (int xc_handle,
  15.224 -                           uint32_t domid,
  15.225 -                           uint32_t vcpu,
  15.226 -                           char **regs)
  15.227 -{
  15.228 -    domain_context_p ctxt;
  15.229 -    int rc = -1;
  15.230 -
  15.231 -    xendebug_initialize();
  15.232 -
  15.233 -    ctxt = xendebug_get_context(xc_handle, domid, vcpu);
  15.234 -    if (ctxt)
  15.235 -    {
  15.236 -        *regs = ctxt->context[vcpu].fpu_ctxt.x;
  15.237 -        rc = 0;
  15.238 -    }
  15.239 -
  15.240 -    return rc;
  15.241 -}
  15.242 -
  15.243 -int
  15.244 -xendebug_write_registers(int xc_handle,
  15.245 -                         uint32_t domid,
  15.246 -                         uint32_t vcpu,
  15.247 -                         cpu_user_regs_t *regs)
  15.248 -{
  15.249 -    domain_context_p ctxt;
  15.250 -    int rc = -1;
  15.251 -
  15.252 -    xendebug_initialize();
  15.253 -
  15.254 -    ctxt = xendebug_get_context(xc_handle, domid, vcpu);
  15.255 -    if (ctxt)
  15.256 -    {
  15.257 -        memcpy(&ctxt->context[vcpu].user_regs, regs, sizeof(cpu_user_regs_t));
  15.258 -        rc = xendebug_set_context(xc_handle, ctxt, vcpu);
  15.259 -    }
  15.260 -    
  15.261 -    return rc;
  15.262 -}
  15.263 -
  15.264 -int
  15.265 -xendebug_step(int xc_handle,
  15.266 -              uint32_t domid,
  15.267 -              uint32_t vcpu)
  15.268 -{
  15.269 -    domain_context_p ctxt;
  15.270 -    int rc;
  15.271 -
  15.272 -    xendebug_initialize();
  15.273 -
  15.274 -    ctxt = xendebug_get_context(xc_handle, domid, vcpu);
  15.275 -    if (!ctxt) return -EINVAL;
  15.276 -
  15.277 -    ctxt->context[vcpu].user_regs.eflags |= X86_EFLAGS_TF;
  15.278 -
  15.279 -    if ( (rc = xendebug_set_context(xc_handle, ctxt, vcpu)) )
  15.280 -        return rc;
  15.281 -
  15.282 -    ctxt->valid[vcpu] = false;
  15.283 -    return xc_domain_unpause(xc_handle, domid);
  15.284 -}
  15.285 -
  15.286 -int
  15.287 -xendebug_continue(int xc_handle,
  15.288 -                  uint32_t domid,
  15.289 -                  uint32_t vcpu)
  15.290 -{
  15.291 -    domain_context_p ctxt;
  15.292 -    int rc;
  15.293 -
  15.294 -    xendebug_initialize();
  15.295 -
  15.296 -    ctxt = xendebug_get_context(xc_handle, domid, vcpu);
  15.297 -    if (!ctxt) return -EINVAL;
  15.298 -
  15.299 -    if ( ctxt->context[vcpu].user_regs.eflags & X86_EFLAGS_TF )
  15.300 -    {
  15.301 -        ctxt->context[vcpu].user_regs.eflags &= ~X86_EFLAGS_TF;
  15.302 -        if ( (rc = xendebug_set_context(xc_handle, ctxt, vcpu)) )
  15.303 -            return rc;
  15.304 -    }
  15.305 -    ctxt->valid[vcpu] = false;
  15.306 -    return xc_domain_unpause(xc_handle, domid);
  15.307 -}
  15.308 -
  15.309 -/*************************************************/
  15.310 -
  15.311 -#define vtopdi(va) ((va) >> L2_PAGETABLE_SHIFT)
  15.312 -#define vtopti(va) (((va) >> PAGE_SHIFT) & 0x3ff)
  15.313 -
  15.314 -/* access to one page */
  15.315 -static int
  15.316 -xendebug_memory_page (domain_context_p ctxt, int xc_handle, uint32_t vcpu,
  15.317 -                      int protection, unsigned long address, int length, uint8_t *buffer)
  15.318 -{
  15.319 -    vcpu_guest_context_t *vcpu_ctxt = &ctxt->context[vcpu];
  15.320 -    unsigned long pde, page;
  15.321 -    unsigned long va = (unsigned long)address;
  15.322 -    void *ptr;
  15.323 -    long pages;
  15.324 -
  15.325 -    pages = xc_get_tot_pages(xc_handle, ctxt->domid);
  15.326 -
  15.327 -    if ( ctxt->total_pages != pages )
  15.328 -    {
  15.329 -        if ( ctxt->total_pages > 0 ) free( ctxt->page_array );
  15.330 -        ctxt->total_pages = pages;
  15.331 -
  15.332 -        ctxt->page_array = malloc(pages * sizeof(unsigned long));
  15.333 -        if ( ctxt->page_array == NULL )
  15.334 -        {
  15.335 -            printf("Could not allocate memory\n");
  15.336 -            return 0;
  15.337 -        }
  15.338 -
  15.339 -        if ( xc_get_pfn_list(xc_handle, ctxt->domid, ctxt->page_array,pages) !=
  15.340 -                pages )
  15.341 -        {
  15.342 -            printf("Could not get the page frame list\n");
  15.343 -            return 0;
  15.344 -        }
  15.345 -    }
  15.346 -
  15.347 -    if ( vcpu_ctxt->ctrlreg[3] != ctxt->cr3_phys[vcpu]) 
  15.348 -    {
  15.349 -        ctxt->cr3_phys[vcpu] = vcpu_ctxt->ctrlreg[3];
  15.350 -        if ( ctxt->cr3_virt[vcpu] )
  15.351 -            munmap(ctxt->cr3_virt[vcpu], PAGE_SIZE);
  15.352 -        ctxt->cr3_virt[vcpu] = xc_map_foreign_range(
  15.353 -            xc_handle, ctxt->domid, PAGE_SIZE, PROT_READ,
  15.354 -            xen_cr3_to_pfn(ctxt->cr3_phys[vcpu]));
  15.355 -        if ( ctxt->cr3_virt[vcpu] == NULL )
  15.356 -            return 0;
  15.357 -    } 
  15.358 -
  15.359 -
  15.360 -    if ( (pde = ctxt->cr3_virt[vcpu][vtopdi(va)]) == 0) /* logical address */
  15.361 -        return 0;
  15.362 -    if (ctxt->context[vcpu].flags & VGCF_HVM_GUEST)
  15.363 -        pde = ctxt->page_array[pde >> PAGE_SHIFT] << PAGE_SHIFT;
  15.364 -    if (pde != ctxt->pde_phys[vcpu]) 
  15.365 -    {
  15.366 -        ctxt->pde_phys[vcpu] = pde;
  15.367 -        if ( ctxt->pde_virt[vcpu])
  15.368 -            munmap(ctxt->pde_virt[vcpu], PAGE_SIZE);
  15.369 -        ctxt->pde_virt[vcpu] = xc_map_foreign_range(xc_handle, ctxt->domid,
  15.370 -                    PAGE_SIZE, PROT_READ, ctxt->pde_phys[vcpu] >> PAGE_SHIFT);
  15.371 -        if ( ctxt->pde_virt[vcpu] == NULL )
  15.372 -            return 0;
  15.373 -    }
  15.374 -
  15.375 -    if ((page = ctxt->pde_virt[vcpu][vtopti(va)]) == 0) /* logical address */
  15.376 -        return 0;
  15.377 -    if (ctxt->context[vcpu].flags & VGCF_HVM_GUEST)
  15.378 -        page = ctxt->page_array[page >> PAGE_SHIFT] << PAGE_SHIFT;
  15.379 -    if (page != ctxt->page_phys[vcpu] || protection != ctxt->page_perm[vcpu]) 
  15.380 -    {
  15.381 -        ctxt->page_phys[vcpu] = page;
  15.382 -        if (ctxt->page_virt[vcpu])
  15.383 -            munmap(ctxt->page_virt[vcpu], PAGE_SIZE);
  15.384 -        ctxt->page_virt[vcpu] = xc_map_foreign_range(xc_handle, ctxt->domid, 
  15.385 -                  PAGE_SIZE, protection, ctxt->page_phys[vcpu] >> PAGE_SHIFT);
  15.386 -        if ( ctxt->page_virt[vcpu] == NULL )
  15.387 -        {
  15.388 -            printf("cr3 %lx pde %lx page %lx pti %lx\n", 
  15.389 -                   vcpu_ctxt->ctrlreg[3], pde, page, vtopti(va));
  15.390 -            ctxt->page_phys[vcpu] = 0;
  15.391 -            return 0;
  15.392 -        }
  15.393 -        ctxt->page_perm[vcpu] = protection;
  15.394 -    }	
  15.395 -
  15.396 -    ptr = (void *)( (unsigned long)ctxt->page_virt[vcpu] |
  15.397 -                    (va & ~PAGE_MASK) );
  15.398 -
  15.399 -    if ( protection & PROT_WRITE )
  15.400 -    {
  15.401 -        memcpy(ptr, buffer, length);
  15.402 -    }
  15.403 -    else
  15.404 -    {
  15.405 -        memcpy(buffer, ptr, length);
  15.406 -    }
  15.407 -
  15.408 -    return length;
  15.409 -}
  15.410 -
  15.411 -/* divide a memory operation into accesses to individual pages */
  15.412 -static int
  15.413 -xendebug_memory_op (domain_context_p ctxt, int xc_handle, uint32_t vcpu,
  15.414 -                    int protection, unsigned long address, int length, uint8_t *buffer)
  15.415 -{
  15.416 -    int      remain;              /* number of bytes to touch past this page */
  15.417 -    int      bytes   = 0;
  15.418 -
  15.419 -    while ( (remain = (address + length - 1) - (address | (PAGE_SIZE-1))) > 0)
  15.420 -    {
  15.421 -        bytes += xendebug_memory_page(ctxt, xc_handle, vcpu, protection,
  15.422 -                                      address, length - remain, buffer);
  15.423 -        buffer += (length - remain);
  15.424 -        length = remain;
  15.425 -        address = (address | (PAGE_SIZE - 1)) + 1;
  15.426 -    }
  15.427 -
  15.428 -    bytes += xendebug_memory_page(ctxt, xc_handle, vcpu, protection,
  15.429 -                                  address, length, buffer);
  15.430 -
  15.431 -    return bytes;
  15.432 -}
  15.433 -
  15.434 -int
  15.435 -xendebug_read_memory(int xc_handle,
  15.436 -                     uint32_t domid,
  15.437 -                     uint32_t vcpu,
  15.438 -                     unsigned long address,
  15.439 -                     uint32_t length,
  15.440 -                     uint8_t *data)
  15.441 -{
  15.442 -    domain_context_p ctxt;
  15.443 -
  15.444 -    xendebug_initialize();
  15.445 -
  15.446 -    ctxt = xendebug_get_context(xc_handle, domid, vcpu);
  15.447 -
  15.448 -    xendebug_memory_op(ctxt, xc_handle, vcpu, PROT_READ, 
  15.449 -                       address, length, data);
  15.450 -
  15.451 -    return 0;
  15.452 -}
  15.453 -
  15.454 -int
  15.455 -xendebug_write_memory(int xc_handle,
  15.456 -                      uint32_t domid,
  15.457 -                      uint32_t vcpu,
  15.458 -                      unsigned long address,
  15.459 -                      uint32_t length,
  15.460 -                      uint8_t *data)
  15.461 -{
  15.462 -    domain_context_p ctxt;
  15.463 -
  15.464 -    xendebug_initialize();
  15.465 -
  15.466 -    ctxt = xendebug_get_context(xc_handle, domid, vcpu);
  15.467 -    xendebug_memory_op(ctxt, xc_handle, vcpu, PROT_READ | PROT_WRITE,
  15.468 -
  15.469 -                       address, length, data);
  15.470 -
  15.471 -    return 0;
  15.472 -}
  15.473 -
  15.474 -int
  15.475 -xendebug_insert_memory_breakpoint(int xc_handle,
  15.476 -                                  uint32_t domid,
  15.477 -                                  uint32_t vcpu,
  15.478 -                                  unsigned long address,
  15.479 -                                  uint32_t length)
  15.480 -{
  15.481 -    bwcpoint_p bkpt;
  15.482 -    uint8_t breakpoint_opcode = 0xcc;
  15.483 -
  15.484 -    printf("insert breakpoint %d:%lx %d\n",
  15.485 -            domid, address, length);
  15.486 -
  15.487 -    xendebug_initialize();
  15.488 -
  15.489 -    bkpt = malloc(sizeof(bwcpoint_t));
  15.490 -    if ( bkpt == NULL )
  15.491 -    {
  15.492 -        printf("error: breakpoint length should be 1\n");
  15.493 -        return -1;
  15.494 -    }
  15.495 -
  15.496 -    if ( length != 1 )
  15.497 -    {
  15.498 -        printf("error: breakpoint length should be 1\n");
  15.499 -        free(bkpt);
  15.500 -        return -1;
  15.501 -    }
  15.502 -
  15.503 -    bkpt->address = address;
  15.504 -    bkpt->domain  = domid;
  15.505 -
  15.506 -    xendebug_read_memory(xc_handle, domid, vcpu, address, 1,
  15.507 -                         &bkpt->old_value);
  15.508 -
  15.509 -    xendebug_write_memory(xc_handle, domid, vcpu, address, 1, 
  15.510 -                          &breakpoint_opcode);
  15.511 -    
  15.512 -    list_add(&bkpt->list, &bwcpoint_list.list);
  15.513 -
  15.514 -    printf("breakpoint_set %d:%lx 0x%x\n",
  15.515 -           domid, address, bkpt->old_value);
  15.516 -
  15.517 -    return 0;
  15.518 -}
  15.519 -
  15.520 -int
  15.521 -xendebug_remove_memory_breakpoint(int xc_handle,
  15.522 -                                  uint32_t domid,
  15.523 -                                  uint32_t vcpu,
  15.524 -                                  unsigned long address,
  15.525 -                                  uint32_t length)
  15.526 -{
  15.527 -    bwcpoint_p bkpt = NULL;
  15.528 -
  15.529 -    printf ("remove breakpoint %d:%lx\n",
  15.530 -            domid, address);
  15.531 -
  15.532 -    struct list_head *entry;
  15.533 -    list_for_each(entry, &bwcpoint_list.list)
  15.534 -    {
  15.535 -        bkpt = list_entry(entry, bwcpoint_t, list);
  15.536 -        if ( domid == bkpt->domain && address == bkpt->address )
  15.537 -            break;
  15.538 -    }
  15.539 -    
  15.540 -    if (bkpt == &bwcpoint_list || bkpt == NULL)
  15.541 -    {
  15.542 -        printf ("error: no breakpoint found\n");
  15.543 -        return -1;
  15.544 -    }
  15.545 -
  15.546 -    list_del(&bkpt->list);
  15.547 -
  15.548 -    xendebug_write_memory(xc_handle, domid, vcpu, address, 1, 
  15.549 -                          &bkpt->old_value);
  15.550 -
  15.551 -    free(bkpt);
  15.552 -    return 0;
  15.553 -}
  15.554 -
  15.555 -int
  15.556 -xendebug_query_domain_stop(int xc_handle, int *dom_list, int dom_list_size)
  15.557 -{
  15.558 -    xc_dominfo_t *info;
  15.559 -    uint32_t first_dom = 0;
  15.560 -    int max_doms = 1024;
  15.561 -    int nr_doms, loop;
  15.562 -    int count = 0;
  15.563 -
  15.564 -    if ( (info = malloc(max_doms * sizeof(xc_dominfo_t))) == NULL )
  15.565 -        return -ENOMEM;
  15.566 -
  15.567 -    nr_doms = xc_domain_getinfo(xc_handle, first_dom, max_doms, info);
  15.568 -
  15.569 -    for (loop = 0; loop < nr_doms; loop++)
  15.570 -    {
  15.571 -        printf ("domid: %d", info[loop].domid);
  15.572 -        printf (" %c%c%c%c%c%c",
  15.573 -                info[loop].dying ? 'D' : '-',
  15.574 -                info[loop].crashed ? 'C' : '-',
  15.575 -                info[loop].shutdown ? 'S' : '-',
  15.576 -                info[loop].paused ? 'P' : '-',
  15.577 -                info[loop].blocked ? 'B' : '-',
  15.578 -                info[loop].running ? 'R' : '-');
  15.579 -        printf (" pages: %ld, vcpus %d", 
  15.580 -                info[loop].nr_pages, info[loop].vcpus);
  15.581 -        printf ("\n");
  15.582 -
  15.583 -        if ( info[loop].paused && count < dom_list_size)
  15.584 -        {
  15.585 -            dom_list[count++] = info[loop].domid;
  15.586 -        }
  15.587 -    }
  15.588 -
  15.589 -    free(info);
  15.590 -
  15.591 -    return count;
  15.592 -}
  15.593 -
  15.594 -/*
  15.595 - * Local variables:
  15.596 - * mode: C
  15.597 - * c-set-style: "BSD"
  15.598 - * c-basic-offset: 4
  15.599 - * tab-width: 4
  15.600 - * indent-tabs-mode: nil
  15.601 - * End:
  15.602 - */
    16.1 --- a/tools/debugger/libxendebug/xendebug.h	Fri Aug 25 16:21:39 2006 -0600
    16.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    16.3 @@ -1,78 +0,0 @@
    16.4 -/*
    16.5 - * xendebug.h
    16.6 - *
    16.7 - * alex ho
    16.8 - * http://www.cl.cam.ac.uk/netos/pdb
    16.9 - *
   16.10 - */
   16.11 -
   16.12 -#ifndef _XENDEBUG_H_DEFINED
   16.13 -#define _XENDEBUG_H_DEFINED
   16.14 -
   16.15 -#include <xenctrl.h>
   16.16 -
   16.17 -int xendebug_attach(int xc_handle,
   16.18 -		    uint32_t domid,
   16.19 -		    uint32_t vcpu);
   16.20 -
   16.21 -int xendebug_detach(int xc_handle,
   16.22 -		    uint32_t domid,
   16.23 -		    uint32_t vcpu);
   16.24 -
   16.25 -int xendebug_read_registers(int xc_handle,
   16.26 -			    uint32_t domid,
   16.27 -			    uint32_t vcpu,
   16.28 -			    cpu_user_regs_t **regs);
   16.29 -
   16.30 -int xendebug_read_fpregisters (int xc_handle,
   16.31 -			       uint32_t domid,
   16.32 -			       uint32_t vcpu,
   16.33 -			       char **regs);
   16.34 -
   16.35 -int xendebug_write_registers(int xc_handle,
   16.36 -			     uint32_t domid,
   16.37 -			     uint32_t vcpu,
   16.38 -			     cpu_user_regs_t *regs);
   16.39 -
   16.40 -int xendebug_step(int xc_handle,
   16.41 -		  uint32_t domid,
   16.42 -		  uint32_t vcpu);
   16.43 -
   16.44 -int xendebug_continue(int xc_handle,
   16.45 -		      uint32_t domid,
   16.46 -		      uint32_t vcpu);
   16.47 -
   16.48 -int xendebug_read_memory(int xc_handle,
   16.49 -			 uint32_t domid,
   16.50 -			 uint32_t vcpu,
   16.51 -			 unsigned long address,
   16.52 -			 uint32_t length,
   16.53 -			 uint8_t *data);
   16.54 -
   16.55 -
   16.56 -int xendebug_write_memory(int xc_handle,
   16.57 -			  uint32_t domid,
   16.58 -			  uint32_t vcpu,
   16.59 -			  unsigned long address,
   16.60 -			  uint32_t length,
   16.61 -			  uint8_t *data);
   16.62 -
   16.63 -
   16.64 -int xendebug_insert_memory_breakpoint(int xc_handle,
   16.65 -				      uint32_t domid,
   16.66 -				      uint32_t vcpu,
   16.67 -				      unsigned long address,
   16.68 -				      uint32_t length);
   16.69 -
   16.70 -int xendebug_remove_memory_breakpoint(int xc_handle,
   16.71 -				      uint32_t domid,
   16.72 -				      uint32_t vcpu,
   16.73 -				      unsigned long address,
   16.74 -				      uint32_t length);
   16.75 -
   16.76 -int xendebug_query_domain_stop(int xc_handle,
   16.77 -			       int *dom_list, 
   16.78 -			       int dom_list_size);
   16.79 -
   16.80 -
   16.81 -#endif /* _XENDEBUG_H_DEFINED */
    17.1 --- a/tools/examples/xen-backend.rules	Fri Aug 25 16:21:39 2006 -0600
    17.2 +++ b/tools/examples/xen-backend.rules	Sun Aug 27 10:24:41 2006 -0600
    17.3 @@ -4,3 +4,4 @@ SUBSYSTEM=="xen-backend", KERNEL=="vtpm*
    17.4  SUBSYSTEM=="xen-backend", KERNEL=="vif*", ACTION=="online", RUN+="$env{script} online"
    17.5  SUBSYSTEM=="xen-backend", KERNEL=="vif*", ACTION=="offline", RUN+="$env{script} offline"
    17.6  SUBSYSTEM=="xen-backend", ACTION=="remove", RUN+="/etc/xen/scripts/xen-hotplug-cleanup"
    17.7 +KERNEL=="evtchn", NAME="xen/%k"
    18.1 --- a/tools/firmware/acpi/acpi_dsdt.asl	Fri Aug 25 16:21:39 2006 -0600
    18.2 +++ b/tools/firmware/acpi/acpi_dsdt.asl	Sun Aug 27 10:24:41 2006 -0600
    18.3 @@ -111,31 +111,9 @@ DefinitionBlock ("DSDT.aml", "DSDT", 1, 
    18.4                      WordIO (ResourceProducer, MinFixed, MaxFixed, PosDecode, EntireRange,
    18.5                          0x0000,
    18.6                          0x0D00,
    18.7 -                        0x0FFF,
    18.8 -                        0x0000,
    18.9 -                        0x0300)
   18.10 -
   18.11 -                 /* reserve what device model consumed for IDE and acpi pci device            */
   18.12 -                     WordIO (ResourceConsumer, MinFixed, MaxFixed, PosDecode, EntireRange,
   18.13 -                        0x0000,
   18.14 -                        0xc000,
   18.15 -                        0xc01f,
   18.16 +                        0xFFFF,
   18.17                          0x0000,
   18.18 -                        0x0020)
   18.19 -                 /* reserve what device model consumed for Ethernet controller pci device        */
   18.20 -                     WordIO (ResourceConsumer, MinFixed, MaxFixed, PosDecode, EntireRange,
   18.21 -                        0x0000,
   18.22 -                        0xc020,
   18.23 -                        0xc03f,
   18.24 -                        0x0000,
   18.25 -                        0x0010)
   18.26 -
   18.27 -                    DWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed, Cacheable, ReadOnly,
   18.28 -                        0x00000000,
   18.29 -                        0x000c0000,
   18.30 -                        0x000FFFFF,
   18.31 -                        0x00000000,
   18.32 -                        0x00030000)
   18.33 +                        0xF300)
   18.34  
   18.35                  /* reserve what device model consumed for PCI VGA device        */
   18.36  
   18.37 @@ -151,13 +129,6 @@ DefinitionBlock ("DSDT.aml", "DSDT", 1, 
   18.38                          0xF2000FFF,
   18.39                          0x00000000,
   18.40                          0x00001000)
   18.41 -                 /* reserve what device model consumed for Ethernet controller pci device        */
   18.42 -                      DWordMemory (ResourceConsumer, PosDecode, MinFixed, MaxFixed, Cacheable, ReadWrite,
   18.43 -                        0x00000000,
   18.44 -                        0xF2001000,
   18.45 -                        0xF200101F,
   18.46 -                        0x00000000,
   18.47 -                        0x00000020) 
   18.48                  })
   18.49                  Return (PRT0)
   18.50              }
   18.51 @@ -528,9 +499,9 @@ DefinitionBlock ("DSDT.aml", "DSDT", 1, 
   18.52                      })
   18.53                  }
   18.54  
   18.55 -                Device (UAR2)
   18.56 +                Device (LTP1)
   18.57                  {
   18.58 -                    Name (_HID, EisaId ("PNP0501"))
   18.59 +                    Name (_HID, EisaId ("PNP0400"))
   18.60                      Name (_UID, 0x02)
   18.61                      Method (_STA, 0, NotSerialized)
   18.62                      {
   18.63 @@ -539,8 +510,8 @@ DefinitionBlock ("DSDT.aml", "DSDT", 1, 
   18.64  
   18.65                      Name (_CRS, ResourceTemplate()
   18.66                      {
   18.67 -                        IO (Decode16, 0x02F8, 0x02F8, 0x01, 0x08)
   18.68 -                        IRQNoFlags () {3}
   18.69 +                        IO (Decode16, 0x0378, 0x0378, 0x08, 0x08)
   18.70 +                        IRQNoFlags () {7}
   18.71                      })
   18.72                  } 
   18.73              }
    19.1 --- a/tools/firmware/acpi/acpi_dsdt.c	Fri Aug 25 16:21:39 2006 -0600
    19.2 +++ b/tools/firmware/acpi/acpi_dsdt.c	Sun Aug 27 10:24:41 2006 -0600
    19.3 @@ -5,15 +5,15 @@
    19.4   * Copyright (C) 2000 - 2005 Intel Corporation
    19.5   * Supports ACPI Specification Revision 3.0
    19.6   * 
    19.7 - * Compilation of "acpi_dsdt.asl" - Thu Aug  3 11:05:15 2006
    19.8 + * Compilation of "acpi_dsdt.asl" - Mon Aug 14 18:15:09 2006
    19.9   * 
   19.10   * C source code output
   19.11   *
   19.12   */
   19.13  unsigned char AmlCode[] = 
   19.14  {
   19.15 -    0x44,0x53,0x44,0x54,0x0E,0x09,0x00,0x00,  /* 00000000    "DSDT...." */
   19.16 -    0x01,0x03,0x49,0x4E,0x54,0x45,0x4C,0x00,  /* 00000008    "..INTEL." */
   19.17 +    0x44,0x53,0x44,0x54,0xBA,0x08,0x00,0x00,  /* 00000000    "DSDT...." */
   19.18 +    0x01,0x1D,0x49,0x4E,0x54,0x45,0x4C,0x00,  /* 00000008    "..INTEL." */
   19.19      0x69,0x6E,0x74,0x2D,0x78,0x65,0x6E,0x00,  /* 00000010    "int-xen." */
   19.20      0xD6,0x07,0x00,0x00,0x49,0x4E,0x54,0x4C,  /* 00000018    "....INTL" */
   19.21      0x13,0x05,0x05,0x20,0x08,0x50,0x4D,0x42,  /* 00000020    "... .PMB" */
   19.22 @@ -34,7 +34,7 @@ unsigned char AmlCode[] =
   19.23      0x12,0x08,0x04,0x0A,0x07,0x0A,0x07,0x00,  /* 00000098    "........" */
   19.24      0x00,0x08,0x50,0x49,0x43,0x44,0x00,0x14,  /* 000000A0    "..PICD.." */
   19.25      0x0C,0x5F,0x50,0x49,0x43,0x01,0x70,0x68,  /* 000000A8    "._PIC.ph" */
   19.26 -    0x50,0x49,0x43,0x44,0x10,0x49,0x85,0x5F,  /* 000000B0    "PICD.I._" */
   19.27 +    0x50,0x49,0x43,0x44,0x10,0x45,0x80,0x5F,  /* 000000B0    "PICD.E._" */
   19.28      0x53,0x42,0x5F,0x5B,0x82,0x49,0x04,0x4D,  /* 000000B8    "SB_[.I.M" */
   19.29      0x45,0x4D,0x30,0x08,0x5F,0x48,0x49,0x44,  /* 000000C0    "EM0._HID" */
   19.30      0x0C,0x41,0xD0,0x0C,0x02,0x08,0x5F,0x43,  /* 000000C8    ".A...._C" */
   19.31 @@ -45,7 +45,7 @@ unsigned char AmlCode[] =
   19.32      0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,  /* 000000F0    "........" */
   19.33      0x00,0x00,0x00,0x00,0x00,0x00,0x0A,0x00,  /* 000000F8    "........" */
   19.34      0x00,0x00,0x00,0x00,0x79,0x00,0x5B,0x82,  /* 00000100    "....y.[." */
   19.35 -    0x46,0x80,0x50,0x43,0x49,0x30,0x08,0x5F,  /* 00000108    "F.PCI0._" */
   19.36 +    0x42,0x7B,0x50,0x43,0x49,0x30,0x08,0x5F,  /* 00000108    "B{PCI0._" */
   19.37      0x48,0x49,0x44,0x0C,0x41,0xD0,0x0A,0x03,  /* 00000110    "HID.A..." */
   19.38      0x08,0x5F,0x55,0x49,0x44,0x00,0x08,0x5F,  /* 00000118    "._UID.._" */
   19.39      0x41,0x44,0x52,0x00,0x08,0x5F,0x42,0x42,  /* 00000120    "ADR.._BB" */
   19.40 @@ -55,252 +55,242 @@ unsigned char AmlCode[] =
   19.41      0x33,0x03,0x49,0x52,0x51,0x35,0x05,0x49,  /* 00000140    "3.IRQ5.I" */
   19.42      0x52,0x51,0x37,0x07,0x49,0x52,0x51,0x39,  /* 00000148    "RQ7.IRQ9" */
   19.43      0x09,0x49,0x52,0x51,0x41,0x0A,0x49,0x52,  /* 00000150    ".IRQA.IR" */
   19.44 -    0x51,0x42,0x0B,0x14,0x48,0x0D,0x5F,0x43,  /* 00000158    "QB..H._C" */
   19.45 +    0x51,0x42,0x0B,0x14,0x44,0x08,0x5F,0x43,  /* 00000158    "QB..D._C" */
   19.46      0x52,0x53,0x00,0x08,0x50,0x52,0x54,0x30,  /* 00000160    "RS..PRT0" */
   19.47 -    0x11,0x46,0x0C,0x0A,0xC2,0x88,0x0D,0x00,  /* 00000168    ".F......" */
   19.48 +    0x11,0x42,0x07,0x0A,0x6E,0x88,0x0D,0x00,  /* 00000168    ".B..n..." */
   19.49      0x02,0x0F,0x00,0x00,0x00,0x00,0x00,0xFF,  /* 00000170    "........" */
   19.50      0x00,0x00,0x00,0x00,0x01,0x47,0x01,0xF8,  /* 00000178    ".....G.." */
   19.51      0x0C,0xF8,0x0C,0x01,0x08,0x88,0x0D,0x00,  /* 00000180    "........" */
   19.52      0x01,0x0C,0x03,0x00,0x00,0x00,0x00,0xF7,  /* 00000188    "........" */
   19.53      0x0C,0x00,0x00,0xF8,0x0C,0x88,0x0D,0x00,  /* 00000190    "........" */
   19.54      0x01,0x0C,0x03,0x00,0x00,0x00,0x0D,0xFF,  /* 00000198    "........" */
   19.55 -    0x0F,0x00,0x00,0x00,0x03,0x88,0x0D,0x00,  /* 000001A0    "........" */
   19.56 -    0x01,0x0D,0x03,0x00,0x00,0x00,0xC0,0x1F,  /* 000001A8    "........" */
   19.57 -    0xC0,0x00,0x00,0x20,0x00,0x88,0x0D,0x00,  /* 000001B0    "... ...." */
   19.58 -    0x01,0x0D,0x03,0x00,0x00,0x20,0xC0,0x3F,  /* 000001B8    "..... .?" */
   19.59 -    0xC0,0x00,0x00,0x10,0x00,0x87,0x17,0x00,  /* 000001C0    "........" */
   19.60 -    0x00,0x0C,0x02,0x00,0x00,0x00,0x00,0x00,  /* 000001C8    "........" */
   19.61 -    0x00,0x0C,0x00,0xFF,0xFF,0x0F,0x00,0x00,  /* 000001D0    "........" */
   19.62 -    0x00,0x00,0x00,0x00,0x00,0x03,0x00,0x87,  /* 000001D8    "........" */
   19.63 -    0x17,0x00,0x00,0x0D,0x03,0x00,0x00,0x00,  /* 000001E0    "........" */
   19.64 -    0x00,0x00,0x00,0x00,0xF0,0xFF,0xFF,0xFF,  /* 000001E8    "........" */
   19.65 -    0xF1,0x00,0x00,0x00,0x00,0x00,0x00,0x00,  /* 000001F0    "........" */
   19.66 -    0x02,0x87,0x17,0x00,0x00,0x0D,0x03,0x00,  /* 000001F8    "........" */
   19.67 -    0x00,0x00,0x00,0x00,0x00,0x00,0xF2,0xFF,  /* 00000200    "........" */
   19.68 -    0x0F,0x00,0xF2,0x00,0x00,0x00,0x00,0x00,  /* 00000208    "........" */
   19.69 -    0x10,0x00,0x00,0x87,0x17,0x00,0x00,0x0D,  /* 00000210    "........" */
   19.70 -    0x03,0x00,0x00,0x00,0x00,0x00,0x10,0x00,  /* 00000218    "........" */
   19.71 -    0xF2,0x1F,0x10,0x00,0xF2,0x00,0x00,0x00,  /* 00000220    "........" */
   19.72 -    0x00,0x20,0x00,0x00,0x00,0x79,0x00,0xA4,  /* 00000228    ". ...y.." */
   19.73 -    0x50,0x52,0x54,0x30,0x08,0x42,0x55,0x46,  /* 00000230    "PRT0.BUF" */
   19.74 -    0x41,0x11,0x09,0x0A,0x06,0x23,0xF8,0xDC,  /* 00000238    "A....#.." */
   19.75 -    0x18,0x79,0x00,0x08,0x42,0x55,0x46,0x42,  /* 00000240    ".y..BUFB" */
   19.76 -    0x11,0x09,0x0A,0x06,0x23,0x00,0x00,0x18,  /* 00000248    "....#..." */
   19.77 -    0x79,0x00,0x8B,0x42,0x55,0x46,0x42,0x01,  /* 00000250    "y..BUFB." */
   19.78 -    0x49,0x52,0x51,0x56,0x08,0x42,0x55,0x46,  /* 00000258    "IRQV.BUF" */
   19.79 -    0x43,0x11,0x07,0x0A,0x04,0x05,0x07,0x0A,  /* 00000260    "C......." */
   19.80 -    0x0B,0x8C,0x42,0x55,0x46,0x43,0x01,0x50,  /* 00000268    "..BUFC.P" */
   19.81 -    0x49,0x51,0x41,0x8C,0x42,0x55,0x46,0x43,  /* 00000270    "IQA.BUFC" */
   19.82 -    0x01,0x50,0x49,0x51,0x42,0x8C,0x42,0x55,  /* 00000278    ".PIQB.BU" */
   19.83 -    0x46,0x43,0x01,0x50,0x49,0x51,0x43,0x8C,  /* 00000280    "FC.PIQC." */
   19.84 -    0x42,0x55,0x46,0x43,0x01,0x50,0x49,0x51,  /* 00000288    "BUFC.PIQ" */
   19.85 -    0x44,0x5B,0x82,0x48,0x08,0x4C,0x4E,0x4B,  /* 00000290    "D[.H.LNK" */
   19.86 -    0x41,0x08,0x5F,0x48,0x49,0x44,0x0C,0x41,  /* 00000298    "A._HID.A" */
   19.87 -    0xD0,0x0C,0x0F,0x08,0x5F,0x55,0x49,0x44,  /* 000002A0    "...._UID" */
   19.88 -    0x01,0x14,0x1C,0x5F,0x53,0x54,0x41,0x00,  /* 000002A8    "..._STA." */
   19.89 -    0x7B,0x50,0x49,0x52,0x41,0x0A,0x80,0x60,  /* 000002B0    "{PIRA..`" */
   19.90 -    0xA0,0x08,0x93,0x60,0x0A,0x80,0xA4,0x0A,  /* 000002B8    "...`...." */
   19.91 -    0x09,0xA1,0x04,0xA4,0x0A,0x0B,0x14,0x0B,  /* 000002C0    "........" */
   19.92 -    0x5F,0x50,0x52,0x53,0x00,0xA4,0x42,0x55,  /* 000002C8    "_PRS..BU" */
   19.93 -    0x46,0x41,0x14,0x11,0x5F,0x44,0x49,0x53,  /* 000002D0    "FA.._DIS" */
   19.94 -    0x00,0x7D,0x50,0x49,0x52,0x41,0x0A,0x80,  /* 000002D8    ".}PIRA.." */
   19.95 -    0x50,0x49,0x52,0x41,0x14,0x1A,0x5F,0x43,  /* 000002E0    "PIRA.._C" */
   19.96 -    0x52,0x53,0x00,0x7B,0x50,0x49,0x52,0x42,  /* 000002E8    "RS.{PIRB" */
   19.97 -    0x0A,0x0F,0x60,0x79,0x01,0x60,0x49,0x52,  /* 000002F0    "..`y.`IR" */
   19.98 -    0x51,0x56,0xA4,0x42,0x55,0x46,0x42,0x14,  /* 000002F8    "QV.BUFB." */
   19.99 -    0x1B,0x5F,0x53,0x52,0x53,0x01,0x8B,0x68,  /* 00000300    "._SRS..h" */
  19.100 -    0x01,0x49,0x52,0x51,0x31,0x82,0x49,0x52,  /* 00000308    ".IRQ1.IR" */
  19.101 -    0x51,0x31,0x60,0x76,0x60,0x70,0x60,0x50,  /* 00000310    "Q1`v`p`P" */
  19.102 -    0x49,0x52,0x41,0x5B,0x82,0x49,0x08,0x4C,  /* 00000318    "IRA[.I.L" */
  19.103 -    0x4E,0x4B,0x42,0x08,0x5F,0x48,0x49,0x44,  /* 00000320    "NKB._HID" */
  19.104 -    0x0C,0x41,0xD0,0x0C,0x0F,0x08,0x5F,0x55,  /* 00000328    ".A...._U" */
  19.105 -    0x49,0x44,0x0A,0x02,0x14,0x1C,0x5F,0x53,  /* 00000330    "ID...._S" */
  19.106 -    0x54,0x41,0x00,0x7B,0x50,0x49,0x52,0x42,  /* 00000338    "TA.{PIRB" */
  19.107 -    0x0A,0x80,0x60,0xA0,0x08,0x93,0x60,0x0A,  /* 00000340    "..`...`." */
  19.108 -    0x80,0xA4,0x0A,0x09,0xA1,0x04,0xA4,0x0A,  /* 00000348    "........" */
  19.109 -    0x0B,0x14,0x0B,0x5F,0x50,0x52,0x53,0x00,  /* 00000350    "..._PRS." */
  19.110 -    0xA4,0x42,0x55,0x46,0x41,0x14,0x11,0x5F,  /* 00000358    ".BUFA.._" */
  19.111 -    0x44,0x49,0x53,0x00,0x7D,0x50,0x49,0x52,  /* 00000360    "DIS.}PIR" */
  19.112 -    0x42,0x0A,0x80,0x50,0x49,0x52,0x42,0x14,  /* 00000368    "B..PIRB." */
  19.113 -    0x1A,0x5F,0x43,0x52,0x53,0x00,0x7B,0x50,  /* 00000370    "._CRS.{P" */
  19.114 -    0x49,0x52,0x42,0x0A,0x0F,0x60,0x79,0x01,  /* 00000378    "IRB..`y." */
  19.115 -    0x60,0x49,0x52,0x51,0x56,0xA4,0x42,0x55,  /* 00000380    "`IRQV.BU" */
  19.116 -    0x46,0x42,0x14,0x1B,0x5F,0x53,0x52,0x53,  /* 00000388    "FB.._SRS" */
  19.117 -    0x01,0x8B,0x68,0x01,0x49,0x52,0x51,0x31,  /* 00000390    "..h.IRQ1" */
  19.118 -    0x82,0x49,0x52,0x51,0x31,0x60,0x76,0x60,  /* 00000398    ".IRQ1`v`" */
  19.119 -    0x70,0x60,0x50,0x49,0x52,0x42,0x5B,0x82,  /* 000003A0    "p`PIRB[." */
  19.120 -    0x49,0x08,0x4C,0x4E,0x4B,0x43,0x08,0x5F,  /* 000003A8    "I.LNKC._" */
  19.121 -    0x48,0x49,0x44,0x0C,0x41,0xD0,0x0C,0x0F,  /* 000003B0    "HID.A..." */
  19.122 -    0x08,0x5F,0x55,0x49,0x44,0x0A,0x03,0x14,  /* 000003B8    "._UID..." */
  19.123 -    0x1C,0x5F,0x53,0x54,0x41,0x00,0x7B,0x50,  /* 000003C0    "._STA.{P" */
  19.124 -    0x49,0x52,0x43,0x0A,0x80,0x60,0xA0,0x08,  /* 000003C8    "IRC..`.." */
  19.125 -    0x93,0x60,0x0A,0x80,0xA4,0x0A,0x09,0xA1,  /* 000003D0    ".`......" */
  19.126 -    0x04,0xA4,0x0A,0x0B,0x14,0x0B,0x5F,0x50,  /* 000003D8    "......_P" */
  19.127 -    0x52,0x53,0x00,0xA4,0x42,0x55,0x46,0x41,  /* 000003E0    "RS..BUFA" */
  19.128 -    0x14,0x11,0x5F,0x44,0x49,0x53,0x00,0x7D,  /* 000003E8    ".._DIS.}" */
  19.129 -    0x50,0x49,0x52,0x43,0x0A,0x80,0x50,0x49,  /* 000003F0    "PIRC..PI" */
  19.130 -    0x52,0x43,0x14,0x1A,0x5F,0x43,0x52,0x53,  /* 000003F8    "RC.._CRS" */
  19.131 -    0x00,0x7B,0x50,0x49,0x52,0x43,0x0A,0x0F,  /* 00000400    ".{PIRC.." */
  19.132 -    0x60,0x79,0x01,0x60,0x49,0x52,0x51,0x56,  /* 00000408    "`y.`IRQV" */
  19.133 -    0xA4,0x42,0x55,0x46,0x42,0x14,0x1B,0x5F,  /* 00000410    ".BUFB.._" */
  19.134 -    0x53,0x52,0x53,0x01,0x8B,0x68,0x01,0x49,  /* 00000418    "SRS..h.I" */
  19.135 -    0x52,0x51,0x31,0x82,0x49,0x52,0x51,0x31,  /* 00000420    "RQ1.IRQ1" */
  19.136 -    0x60,0x76,0x60,0x70,0x60,0x50,0x49,0x52,  /* 00000428    "`v`p`PIR" */
  19.137 -    0x43,0x5B,0x82,0x49,0x08,0x4C,0x4E,0x4B,  /* 00000430    "C[.I.LNK" */
  19.138 -    0x44,0x08,0x5F,0x48,0x49,0x44,0x0C,0x41,  /* 00000438    "D._HID.A" */
  19.139 -    0xD0,0x0C,0x0F,0x08,0x5F,0x55,0x49,0x44,  /* 00000440    "...._UID" */
  19.140 -    0x0A,0x04,0x14,0x1C,0x5F,0x53,0x54,0x41,  /* 00000448    "...._STA" */
  19.141 -    0x00,0x7B,0x50,0x49,0x52,0x44,0x0A,0x80,  /* 00000450    ".{PIRD.." */
  19.142 -    0x60,0xA0,0x08,0x93,0x60,0x0A,0x80,0xA4,  /* 00000458    "`...`..." */
  19.143 -    0x0A,0x09,0xA1,0x04,0xA4,0x0A,0x0B,0x14,  /* 00000460    "........" */
  19.144 -    0x0B,0x5F,0x50,0x52,0x53,0x00,0xA4,0x42,  /* 00000468    "._PRS..B" */
  19.145 -    0x55,0x46,0x41,0x14,0x11,0x5F,0x44,0x49,  /* 00000470    "UFA.._DI" */
  19.146 -    0x53,0x00,0x7D,0x50,0x49,0x52,0x44,0x0A,  /* 00000478    "S.}PIRD." */
  19.147 -    0x80,0x50,0x49,0x52,0x44,0x14,0x1A,0x5F,  /* 00000480    ".PIRD.._" */
  19.148 -    0x43,0x52,0x53,0x00,0x7B,0x50,0x49,0x52,  /* 00000488    "CRS.{PIR" */
  19.149 -    0x44,0x0A,0x0F,0x60,0x79,0x01,0x60,0x49,  /* 00000490    "D..`y.`I" */
  19.150 -    0x52,0x51,0x56,0xA4,0x42,0x55,0x46,0x42,  /* 00000498    "RQV.BUFB" */
  19.151 -    0x14,0x1B,0x5F,0x53,0x52,0x53,0x01,0x8B,  /* 000004A0    ".._SRS.." */
  19.152 -    0x68,0x01,0x49,0x52,0x51,0x31,0x82,0x49,  /* 000004A8    "h.IRQ1.I" */
  19.153 -    0x52,0x51,0x31,0x60,0x76,0x60,0x70,0x60,  /* 000004B0    "RQ1`v`p`" */
  19.154 -    0x50,0x49,0x52,0x44,0x14,0x16,0x5F,0x50,  /* 000004B8    "PIRD.._P" */
  19.155 -    0x52,0x54,0x00,0xA0,0x0A,0x50,0x49,0x43,  /* 000004C0    "RT...PIC" */
  19.156 -    0x44,0xA4,0x50,0x52,0x54,0x41,0xA4,0x50,  /* 000004C8    "D.PRTA.P" */
  19.157 -    0x52,0x54,0x50,0x08,0x50,0x52,0x54,0x50,  /* 000004D0    "RTP.PRTP" */
  19.158 -    0x12,0x43,0x0E,0x10,0x12,0x0B,0x04,0x0B,  /* 000004D8    ".C......" */
  19.159 -    0xFF,0xFF,0x00,0x4C,0x4E,0x4B,0x41,0x00,  /* 000004E0    "...LNKA." */
  19.160 -    0x12,0x0B,0x04,0x0B,0xFF,0xFF,0x01,0x4C,  /* 000004E8    ".......L" */
  19.161 -    0x4E,0x4B,0x42,0x00,0x12,0x0C,0x04,0x0B,  /* 000004F0    "NKB....." */
  19.162 -    0xFF,0xFF,0x0A,0x02,0x4C,0x4E,0x4B,0x43,  /* 000004F8    "....LNKC" */
  19.163 -    0x00,0x12,0x0C,0x04,0x0B,0xFF,0xFF,0x0A,  /* 00000500    "........" */
  19.164 -    0x03,0x4C,0x4E,0x4B,0x44,0x00,0x12,0x0D,  /* 00000508    ".LNKD..." */
  19.165 -    0x04,0x0C,0xFF,0xFF,0x01,0x00,0x00,0x4C,  /* 00000510    ".......L" */
  19.166 -    0x4E,0x4B,0x42,0x00,0x12,0x0D,0x04,0x0C,  /* 00000518    "NKB....." */
  19.167 -    0xFF,0xFF,0x01,0x00,0x01,0x4C,0x4E,0x4B,  /* 00000520    ".....LNK" */
  19.168 -    0x43,0x00,0x12,0x0E,0x04,0x0C,0xFF,0xFF,  /* 00000528    "C......." */
  19.169 -    0x01,0x00,0x0A,0x02,0x4C,0x4E,0x4B,0x44,  /* 00000530    "....LNKD" */
  19.170 -    0x00,0x12,0x0E,0x04,0x0C,0xFF,0xFF,0x01,  /* 00000538    "........" */
  19.171 -    0x00,0x0A,0x03,0x4C,0x4E,0x4B,0x41,0x00,  /* 00000540    "...LNKA." */
  19.172 -    0x12,0x0D,0x04,0x0C,0xFF,0xFF,0x02,0x00,  /* 00000548    "........" */
  19.173 -    0x00,0x4C,0x4E,0x4B,0x43,0x00,0x12,0x0D,  /* 00000550    ".LNKC..." */
  19.174 -    0x04,0x0C,0xFF,0xFF,0x02,0x00,0x01,0x4C,  /* 00000558    ".......L" */
  19.175 -    0x4E,0x4B,0x44,0x00,0x12,0x0E,0x04,0x0C,  /* 00000560    "NKD....." */
  19.176 -    0xFF,0xFF,0x02,0x00,0x0A,0x02,0x4C,0x4E,  /* 00000568    "......LN" */
  19.177 -    0x4B,0x41,0x00,0x12,0x0E,0x04,0x0C,0xFF,  /* 00000570    "KA......" */
  19.178 -    0xFF,0x02,0x00,0x0A,0x03,0x4C,0x4E,0x4B,  /* 00000578    ".....LNK" */
  19.179 -    0x42,0x00,0x12,0x0D,0x04,0x0C,0xFF,0xFF,  /* 00000580    "B......." */
  19.180 -    0x03,0x00,0x00,0x4C,0x4E,0x4B,0x44,0x00,  /* 00000588    "...LNKD." */
  19.181 -    0x12,0x0D,0x04,0x0C,0xFF,0xFF,0x03,0x00,  /* 00000590    "........" */
  19.182 -    0x01,0x4C,0x4E,0x4B,0x41,0x00,0x12,0x0E,  /* 00000598    ".LNKA..." */
  19.183 -    0x04,0x0C,0xFF,0xFF,0x03,0x00,0x0A,0x02,  /* 000005A0    "........" */
  19.184 -    0x4C,0x4E,0x4B,0x42,0x00,0x12,0x0E,0x04,  /* 000005A8    "LNKB...." */
  19.185 -    0x0C,0xFF,0xFF,0x03,0x00,0x0A,0x03,0x4C,  /* 000005B0    ".......L" */
  19.186 -    0x4E,0x4B,0x43,0x00,0x08,0x50,0x52,0x54,  /* 000005B8    "NKC..PRT" */
  19.187 -    0x41,0x12,0x32,0x04,0x12,0x0B,0x04,0x0C,  /* 000005C0    "A.2....." */
  19.188 -    0xFF,0xFF,0x01,0x00,0x00,0x00,0x0A,0x05,  /* 000005C8    "........" */
  19.189 -    0x12,0x0B,0x04,0x0C,0xFF,0xFF,0x02,0x00,  /* 000005D0    "........" */
  19.190 -    0x00,0x00,0x0A,0x07,0x12,0x0B,0x04,0x0C,  /* 000005D8    "........" */
  19.191 -    0xFF,0xFF,0x03,0x00,0x00,0x00,0x0A,0x0A,  /* 000005E0    "........" */
  19.192 -    0x12,0x0B,0x04,0x0C,0xFF,0xFF,0x04,0x00,  /* 000005E8    "........" */
  19.193 -    0x00,0x00,0x0A,0x0B,0x5B,0x82,0x48,0x31,  /* 000005F0    "....[.H1" */
  19.194 -    0x49,0x53,0x41,0x5F,0x08,0x5F,0x41,0x44,  /* 000005F8    "ISA_._AD" */
  19.195 -    0x52,0x00,0x5B,0x80,0x50,0x49,0x52,0x51,  /* 00000600    "R.[.PIRQ" */
  19.196 -    0x02,0x0A,0x60,0x0A,0x04,0x10,0x2E,0x5C,  /* 00000608    "..`....\" */
  19.197 -    0x00,0x5B,0x81,0x29,0x5C,0x2F,0x04,0x5F,  /* 00000610    ".[.)\/._" */
  19.198 -    0x53,0x42,0x5F,0x50,0x43,0x49,0x30,0x49,  /* 00000618    "SB_PCI0I" */
  19.199 -    0x53,0x41,0x5F,0x50,0x49,0x52,0x51,0x01,  /* 00000620    "SA_PIRQ." */
  19.200 -    0x50,0x49,0x52,0x41,0x08,0x50,0x49,0x52,  /* 00000628    "PIRA.PIR" */
  19.201 -    0x42,0x08,0x50,0x49,0x52,0x43,0x08,0x50,  /* 00000630    "B.PIRC.P" */
  19.202 -    0x49,0x52,0x44,0x08,0x5B,0x82,0x46,0x0B,  /* 00000638    "IRD.[.F." */
  19.203 -    0x53,0x59,0x53,0x52,0x08,0x5F,0x48,0x49,  /* 00000640    "SYSR._HI" */
  19.204 -    0x44,0x0C,0x41,0xD0,0x0C,0x02,0x08,0x5F,  /* 00000648    "D.A...._" */
  19.205 -    0x55,0x49,0x44,0x01,0x08,0x43,0x52,0x53,  /* 00000650    "UID..CRS" */
  19.206 -    0x5F,0x11,0x4E,0x08,0x0A,0x8A,0x47,0x01,  /* 00000658    "_.N...G." */
  19.207 -    0x10,0x00,0x10,0x00,0x00,0x10,0x47,0x01,  /* 00000660    "......G." */
  19.208 -    0x22,0x00,0x22,0x00,0x00,0x0C,0x47,0x01,  /* 00000668    ""."...G." */
  19.209 -    0x30,0x00,0x30,0x00,0x00,0x10,0x47,0x01,  /* 00000670    "0.0...G." */
  19.210 -    0x44,0x00,0x44,0x00,0x00,0x1C,0x47,0x01,  /* 00000678    "D.D...G." */
  19.211 -    0x62,0x00,0x62,0x00,0x00,0x02,0x47,0x01,  /* 00000680    "b.b...G." */
  19.212 -    0x65,0x00,0x65,0x00,0x00,0x0B,0x47,0x01,  /* 00000688    "e.e...G." */
  19.213 -    0x72,0x00,0x72,0x00,0x00,0x0E,0x47,0x01,  /* 00000690    "r.r...G." */
  19.214 -    0x80,0x00,0x80,0x00,0x00,0x01,0x47,0x01,  /* 00000698    "......G." */
  19.215 -    0x84,0x00,0x84,0x00,0x00,0x03,0x47,0x01,  /* 000006A0    "......G." */
  19.216 -    0x88,0x00,0x88,0x00,0x00,0x01,0x47,0x01,  /* 000006A8    "......G." */
  19.217 -    0x8C,0x00,0x8C,0x00,0x00,0x03,0x47,0x01,  /* 000006B0    "......G." */
  19.218 -    0x90,0x00,0x90,0x00,0x00,0x10,0x47,0x01,  /* 000006B8    "......G." */
  19.219 -    0xA2,0x00,0xA2,0x00,0x00,0x1C,0x47,0x01,  /* 000006C0    "......G." */
  19.220 -    0xE0,0x00,0xE0,0x00,0x00,0x10,0x47,0x01,  /* 000006C8    "......G." */
  19.221 -    0xA0,0x08,0xA0,0x08,0x00,0x04,0x47,0x01,  /* 000006D0    "......G." */
  19.222 -    0xC0,0x0C,0xC0,0x0C,0x00,0x10,0x47,0x01,  /* 000006D8    "......G." */
  19.223 -    0xD0,0x04,0xD0,0x04,0x00,0x02,0x79,0x00,  /* 000006E0    "......y." */
  19.224 -    0x14,0x0B,0x5F,0x43,0x52,0x53,0x00,0xA4,  /* 000006E8    ".._CRS.." */
  19.225 -    0x43,0x52,0x53,0x5F,0x5B,0x82,0x2B,0x50,  /* 000006F0    "CRS_[.+P" */
  19.226 -    0x49,0x43,0x5F,0x08,0x5F,0x48,0x49,0x44,  /* 000006F8    "IC_._HID" */
  19.227 -    0x0B,0x41,0xD0,0x08,0x5F,0x43,0x52,0x53,  /* 00000700    ".A.._CRS" */
  19.228 -    0x11,0x18,0x0A,0x15,0x47,0x01,0x20,0x00,  /* 00000708    "....G. ." */
  19.229 -    0x20,0x00,0x01,0x02,0x47,0x01,0xA0,0x00,  /* 00000710    " ...G..." */
  19.230 -    0xA0,0x00,0x01,0x02,0x22,0x04,0x00,0x79,  /* 00000718    "...."..y" */
  19.231 -    0x00,0x5B,0x82,0x47,0x05,0x44,0x4D,0x41,  /* 00000720    ".[.G.DMA" */
  19.232 -    0x30,0x08,0x5F,0x48,0x49,0x44,0x0C,0x41,  /* 00000728    "0._HID.A" */
  19.233 -    0xD0,0x02,0x00,0x08,0x5F,0x43,0x52,0x53,  /* 00000730    "...._CRS" */
  19.234 -    0x11,0x41,0x04,0x0A,0x3D,0x2A,0x10,0x04,  /* 00000738    ".A..=*.." */
  19.235 -    0x47,0x01,0x00,0x00,0x00,0x00,0x00,0x10,  /* 00000740    "G......." */
  19.236 -    0x47,0x01,0x81,0x00,0x81,0x00,0x00,0x03,  /* 00000748    "G......." */
  19.237 -    0x47,0x01,0x87,0x00,0x87,0x00,0x00,0x01,  /* 00000750    "G......." */
  19.238 -    0x47,0x01,0x89,0x00,0x89,0x00,0x00,0x03,  /* 00000758    "G......." */
  19.239 -    0x47,0x01,0x8F,0x00,0x8F,0x00,0x00,0x01,  /* 00000760    "G......." */
  19.240 -    0x47,0x01,0xC0,0x00,0xC0,0x00,0x00,0x20,  /* 00000768    "G...... " */
  19.241 -    0x47,0x01,0x80,0x04,0x80,0x04,0x00,0x10,  /* 00000770    "G......." */
  19.242 -    0x79,0x00,0x5B,0x82,0x25,0x54,0x4D,0x52,  /* 00000778    "y.[.%TMR" */
  19.243 -    0x5F,0x08,0x5F,0x48,0x49,0x44,0x0C,0x41,  /* 00000780    "_._HID.A" */
  19.244 -    0xD0,0x01,0x00,0x08,0x5F,0x43,0x52,0x53,  /* 00000788    "...._CRS" */
  19.245 -    0x11,0x10,0x0A,0x0D,0x47,0x01,0x40,0x00,  /* 00000790    "....G.@." */
  19.246 -    0x40,0x00,0x00,0x04,0x22,0x01,0x00,0x79,  /* 00000798    "@..."..y" */
  19.247 -    0x00,0x5B,0x82,0x25,0x52,0x54,0x43,0x5F,  /* 000007A0    ".[.%RTC_" */
  19.248 -    0x08,0x5F,0x48,0x49,0x44,0x0C,0x41,0xD0,  /* 000007A8    "._HID.A." */
  19.249 -    0x0B,0x00,0x08,0x5F,0x43,0x52,0x53,0x11,  /* 000007B0    "..._CRS." */
  19.250 -    0x10,0x0A,0x0D,0x47,0x01,0x70,0x00,0x70,  /* 000007B8    "...G.p.p" */
  19.251 -    0x00,0x00,0x02,0x22,0x00,0x01,0x79,0x00,  /* 000007C0    "..."..y." */
  19.252 -    0x5B,0x82,0x22,0x53,0x50,0x4B,0x52,0x08,  /* 000007C8    "[."SPKR." */
  19.253 -    0x5F,0x48,0x49,0x44,0x0C,0x41,0xD0,0x08,  /* 000007D0    "_HID.A.." */
  19.254 -    0x00,0x08,0x5F,0x43,0x52,0x53,0x11,0x0D,  /* 000007D8    ".._CRS.." */
  19.255 -    0x0A,0x0A,0x47,0x01,0x61,0x00,0x61,0x00,  /* 000007E0    "..G.a.a." */
  19.256 -    0x00,0x01,0x79,0x00,0x5B,0x82,0x31,0x50,  /* 000007E8    "..y.[.1P" */
  19.257 -    0x53,0x32,0x4D,0x08,0x5F,0x48,0x49,0x44,  /* 000007F0    "S2M._HID" */
  19.258 -    0x0C,0x41,0xD0,0x0F,0x13,0x08,0x5F,0x43,  /* 000007F8    ".A...._C" */
  19.259 -    0x49,0x44,0x0C,0x41,0xD0,0x0F,0x13,0x14,  /* 00000800    "ID.A...." */
  19.260 -    0x09,0x5F,0x53,0x54,0x41,0x00,0xA4,0x0A,  /* 00000808    "._STA..." */
  19.261 -    0x0F,0x08,0x5F,0x43,0x52,0x53,0x11,0x08,  /* 00000810    ".._CRS.." */
  19.262 -    0x0A,0x05,0x22,0x00,0x10,0x79,0x00,0x5B,  /* 00000818    ".."..y.[" */
  19.263 -    0x82,0x42,0x04,0x50,0x53,0x32,0x4B,0x08,  /* 00000820    ".B.PS2K." */
  19.264 -    0x5F,0x48,0x49,0x44,0x0C,0x41,0xD0,0x03,  /* 00000828    "_HID.A.." */
  19.265 -    0x03,0x08,0x5F,0x43,0x49,0x44,0x0C,0x41,  /* 00000830    ".._CID.A" */
  19.266 -    0xD0,0x03,0x0B,0x14,0x09,0x5F,0x53,0x54,  /* 00000838    "....._ST" */
  19.267 -    0x41,0x00,0xA4,0x0A,0x0F,0x08,0x5F,0x43,  /* 00000840    "A....._C" */
  19.268 -    0x52,0x53,0x11,0x18,0x0A,0x15,0x47,0x01,  /* 00000848    "RS....G." */
  19.269 -    0x60,0x00,0x60,0x00,0x00,0x01,0x47,0x01,  /* 00000850    "`.`...G." */
  19.270 -    0x64,0x00,0x64,0x00,0x00,0x01,0x22,0x02,  /* 00000858    "d.d..."." */
  19.271 -    0x00,0x79,0x00,0x5B,0x82,0x3A,0x46,0x44,  /* 00000860    ".y.[.:FD" */
  19.272 -    0x43,0x30,0x08,0x5F,0x48,0x49,0x44,0x0C,  /* 00000868    "C0._HID." */
  19.273 -    0x41,0xD0,0x07,0x00,0x14,0x09,0x5F,0x53,  /* 00000870    "A....._S" */
  19.274 -    0x54,0x41,0x00,0xA4,0x0A,0x0F,0x08,0x5F,  /* 00000878    "TA....._" */
  19.275 -    0x43,0x52,0x53,0x11,0x1B,0x0A,0x18,0x47,  /* 00000880    "CRS....G" */
  19.276 -    0x01,0xF0,0x03,0xF0,0x03,0x01,0x06,0x47,  /* 00000888    ".......G" */
  19.277 -    0x01,0xF7,0x03,0xF7,0x03,0x01,0x01,0x22,  /* 00000890    "......."" */
  19.278 -    0x40,0x00,0x2A,0x04,0x00,0x79,0x00,0x5B,  /* 00000898    "@.*..y.[" */
  19.279 -    0x82,0x35,0x55,0x41,0x52,0x31,0x08,0x5F,  /* 000008A0    ".5UAR1._" */
  19.280 -    0x48,0x49,0x44,0x0C,0x41,0xD0,0x05,0x01,  /* 000008A8    "HID.A..." */
  19.281 -    0x08,0x5F,0x55,0x49,0x44,0x01,0x14,0x09,  /* 000008B0    "._UID..." */
  19.282 -    0x5F,0x53,0x54,0x41,0x00,0xA4,0x0A,0x0F,  /* 000008B8    "_STA...." */
  19.283 -    0x08,0x5F,0x43,0x52,0x53,0x11,0x10,0x0A,  /* 000008C0    "._CRS..." */
  19.284 -    0x0D,0x47,0x01,0xF8,0x03,0xF8,0x03,0x01,  /* 000008C8    ".G......" */
  19.285 -    0x08,0x22,0x10,0x00,0x79,0x00,0x5B,0x82,  /* 000008D0    "."..y.[." */
  19.286 -    0x36,0x55,0x41,0x52,0x32,0x08,0x5F,0x48,  /* 000008D8    "6UAR2._H" */
  19.287 -    0x49,0x44,0x0C,0x41,0xD0,0x05,0x01,0x08,  /* 000008E0    "ID.A...." */
  19.288 -    0x5F,0x55,0x49,0x44,0x0A,0x02,0x14,0x09,  /* 000008E8    "_UID...." */
  19.289 -    0x5F,0x53,0x54,0x41,0x00,0xA4,0x0A,0x0F,  /* 000008F0    "_STA...." */
  19.290 -    0x08,0x5F,0x43,0x52,0x53,0x11,0x10,0x0A,  /* 000008F8    "._CRS..." */
  19.291 -    0x0D,0x47,0x01,0xF8,0x02,0xF8,0x02,0x01,  /* 00000900    ".G......" */
  19.292 -    0x08,0x22,0x08,0x00,0x79,0x00,
  19.293 +    0xFF,0x00,0x00,0x00,0xF3,0x87,0x17,0x00,  /* 000001A0    "........" */
  19.294 +    0x00,0x0D,0x03,0x00,0x00,0x00,0x00,0x00,  /* 000001A8    "........" */
  19.295 +    0x00,0x00,0xF0,0xFF,0xFF,0xFF,0xF1,0x00,  /* 000001B0    "........" */
  19.296 +    0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x87,  /* 000001B8    "........" */
  19.297 +    0x17,0x00,0x00,0x0D,0x03,0x00,0x00,0x00,  /* 000001C0    "........" */
  19.298 +    0x00,0x00,0x00,0x00,0xF2,0xFF,0x0F,0x00,  /* 000001C8    "........" */
  19.299 +    0xF2,0x00,0x00,0x00,0x00,0x00,0x10,0x00,  /* 000001D0    "........" */
  19.300 +    0x00,0x79,0x00,0xA4,0x50,0x52,0x54,0x30,  /* 000001D8    ".y..PRT0" */
  19.301 +    0x08,0x42,0x55,0x46,0x41,0x11,0x09,0x0A,  /* 000001E0    ".BUFA..." */
  19.302 +    0x06,0x23,0xF8,0xDC,0x18,0x79,0x00,0x08,  /* 000001E8    ".#...y.." */
  19.303 +    0x42,0x55,0x46,0x42,0x11,0x09,0x0A,0x06,  /* 000001F0    "BUFB...." */
  19.304 +    0x23,0x00,0x00,0x18,0x79,0x00,0x8B,0x42,  /* 000001F8    "#...y..B" */
  19.305 +    0x55,0x46,0x42,0x01,0x49,0x52,0x51,0x56,  /* 00000200    "UFB.IRQV" */
  19.306 +    0x08,0x42,0x55,0x46,0x43,0x11,0x07,0x0A,  /* 00000208    ".BUFC..." */
  19.307 +    0x04,0x05,0x07,0x0A,0x0B,0x8C,0x42,0x55,  /* 00000210    "......BU" */
  19.308 +    0x46,0x43,0x01,0x50,0x49,0x51,0x41,0x8C,  /* 00000218    "FC.PIQA." */
  19.309 +    0x42,0x55,0x46,0x43,0x01,0x50,0x49,0x51,  /* 00000220    "BUFC.PIQ" */
  19.310 +    0x42,0x8C,0x42,0x55,0x46,0x43,0x01,0x50,  /* 00000228    "B.BUFC.P" */
  19.311 +    0x49,0x51,0x43,0x8C,0x42,0x55,0x46,0x43,  /* 00000230    "IQC.BUFC" */
  19.312 +    0x01,0x50,0x49,0x51,0x44,0x5B,0x82,0x48,  /* 00000238    ".PIQD[.H" */
  19.313 +    0x08,0x4C,0x4E,0x4B,0x41,0x08,0x5F,0x48,  /* 00000240    ".LNKA._H" */
  19.314 +    0x49,0x44,0x0C,0x41,0xD0,0x0C,0x0F,0x08,  /* 00000248    "ID.A...." */
  19.315 +    0x5F,0x55,0x49,0x44,0x01,0x14,0x1C,0x5F,  /* 00000250    "_UID..._" */
  19.316 +    0x53,0x54,0x41,0x00,0x7B,0x50,0x49,0x52,  /* 00000258    "STA.{PIR" */
  19.317 +    0x41,0x0A,0x80,0x60,0xA0,0x08,0x93,0x60,  /* 00000260    "A..`...`" */
  19.318 +    0x0A,0x80,0xA4,0x0A,0x09,0xA1,0x04,0xA4,  /* 00000268    "........" */
  19.319 +    0x0A,0x0B,0x14,0x0B,0x5F,0x50,0x52,0x53,  /* 00000270    "...._PRS" */
  19.320 +    0x00,0xA4,0x42,0x55,0x46,0x41,0x14,0x11,  /* 00000278    "..BUFA.." */
  19.321 +    0x5F,0x44,0x49,0x53,0x00,0x7D,0x50,0x49,  /* 00000280    "_DIS.}PI" */
  19.322 +    0x52,0x41,0x0A,0x80,0x50,0x49,0x52,0x41,  /* 00000288    "RA..PIRA" */
  19.323 +    0x14,0x1A,0x5F,0x43,0x52,0x53,0x00,0x7B,  /* 00000290    ".._CRS.{" */
  19.324 +    0x50,0x49,0x52,0x42,0x0A,0x0F,0x60,0x79,  /* 00000298    "PIRB..`y" */
  19.325 +    0x01,0x60,0x49,0x52,0x51,0x56,0xA4,0x42,  /* 000002A0    ".`IRQV.B" */
  19.326 +    0x55,0x46,0x42,0x14,0x1B,0x5F,0x53,0x52,  /* 000002A8    "UFB.._SR" */
  19.327 +    0x53,0x01,0x8B,0x68,0x01,0x49,0x52,0x51,  /* 000002B0    "S..h.IRQ" */
  19.328 +    0x31,0x82,0x49,0x52,0x51,0x31,0x60,0x76,  /* 000002B8    "1.IRQ1`v" */
  19.329 +    0x60,0x70,0x60,0x50,0x49,0x52,0x41,0x5B,  /* 000002C0    "`p`PIRA[" */
  19.330 +    0x82,0x49,0x08,0x4C,0x4E,0x4B,0x42,0x08,  /* 000002C8    ".I.LNKB." */
  19.331 +    0x5F,0x48,0x49,0x44,0x0C,0x41,0xD0,0x0C,  /* 000002D0    "_HID.A.." */
  19.332 +    0x0F,0x08,0x5F,0x55,0x49,0x44,0x0A,0x02,  /* 000002D8    ".._UID.." */
  19.333 +    0x14,0x1C,0x5F,0x53,0x54,0x41,0x00,0x7B,  /* 000002E0    ".._STA.{" */
  19.334 +    0x50,0x49,0x52,0x42,0x0A,0x80,0x60,0xA0,  /* 000002E8    "PIRB..`." */
  19.335 +    0x08,0x93,0x60,0x0A,0x80,0xA4,0x0A,0x09,  /* 000002F0    "..`....." */
  19.336 +    0xA1,0x04,0xA4,0x0A,0x0B,0x14,0x0B,0x5F,  /* 000002F8    "......._" */
  19.337 +    0x50,0x52,0x53,0x00,0xA4,0x42,0x55,0x46,  /* 00000300    "PRS..BUF" */
  19.338 +    0x41,0x14,0x11,0x5F,0x44,0x49,0x53,0x00,  /* 00000308    "A.._DIS." */
  19.339 +    0x7D,0x50,0x49,0x52,0x42,0x0A,0x80,0x50,  /* 00000310    "}PIRB..P" */
  19.340 +    0x49,0x52,0x42,0x14,0x1A,0x5F,0x43,0x52,  /* 00000318    "IRB.._CR" */
  19.341 +    0x53,0x00,0x7B,0x50,0x49,0x52,0x42,0x0A,  /* 00000320    "S.{PIRB." */
  19.342 +    0x0F,0x60,0x79,0x01,0x60,0x49,0x52,0x51,  /* 00000328    ".`y.`IRQ" */
  19.343 +    0x56,0xA4,0x42,0x55,0x46,0x42,0x14,0x1B,  /* 00000330    "V.BUFB.." */
  19.344 +    0x5F,0x53,0x52,0x53,0x01,0x8B,0x68,0x01,  /* 00000338    "_SRS..h." */
  19.345 +    0x49,0x52,0x51,0x31,0x82,0x49,0x52,0x51,  /* 00000340    "IRQ1.IRQ" */
  19.346 +    0x31,0x60,0x76,0x60,0x70,0x60,0x50,0x49,  /* 00000348    "1`v`p`PI" */
  19.347 +    0x52,0x42,0x5B,0x82,0x49,0x08,0x4C,0x4E,  /* 00000350    "RB[.I.LN" */
  19.348 +    0x4B,0x43,0x08,0x5F,0x48,0x49,0x44,0x0C,  /* 00000358    "KC._HID." */
  19.349 +    0x41,0xD0,0x0C,0x0F,0x08,0x5F,0x55,0x49,  /* 00000360    "A...._UI" */
  19.350 +    0x44,0x0A,0x03,0x14,0x1C,0x5F,0x53,0x54,  /* 00000368    "D...._ST" */
  19.351 +    0x41,0x00,0x7B,0x50,0x49,0x52,0x43,0x0A,  /* 00000370    "A.{PIRC." */
  19.352 +    0x80,0x60,0xA0,0x08,0x93,0x60,0x0A,0x80,  /* 00000378    ".`...`.." */
  19.353 +    0xA4,0x0A,0x09,0xA1,0x04,0xA4,0x0A,0x0B,  /* 00000380    "........" */
  19.354 +    0x14,0x0B,0x5F,0x50,0x52,0x53,0x00,0xA4,  /* 00000388    ".._PRS.." */
  19.355 +    0x42,0x55,0x46,0x41,0x14,0x11,0x5F,0x44,  /* 00000390    "BUFA.._D" */
  19.356 +    0x49,0x53,0x00,0x7D,0x50,0x49,0x52,0x43,  /* 00000398    "IS.}PIRC" */
  19.357 +    0x0A,0x80,0x50,0x49,0x52,0x43,0x14,0x1A,  /* 000003A0    "..PIRC.." */
  19.358 +    0x5F,0x43,0x52,0x53,0x00,0x7B,0x50,0x49,  /* 000003A8    "_CRS.{PI" */
  19.359 +    0x52,0x43,0x0A,0x0F,0x60,0x79,0x01,0x60,  /* 000003B0    "RC..`y.`" */
  19.360 +    0x49,0x52,0x51,0x56,0xA4,0x42,0x55,0x46,  /* 000003B8    "IRQV.BUF" */
  19.361 +    0x42,0x14,0x1B,0x5F,0x53,0x52,0x53,0x01,  /* 000003C0    "B.._SRS." */
  19.362 +    0x8B,0x68,0x01,0x49,0x52,0x51,0x31,0x82,  /* 000003C8    ".h.IRQ1." */
  19.363 +    0x49,0x52,0x51,0x31,0x60,0x76,0x60,0x70,  /* 000003D0    "IRQ1`v`p" */
  19.364 +    0x60,0x50,0x49,0x52,0x43,0x5B,0x82,0x49,  /* 000003D8    "`PIRC[.I" */
  19.365 +    0x08,0x4C,0x4E,0x4B,0x44,0x08,0x5F,0x48,  /* 000003E0    ".LNKD._H" */
  19.366 +    0x49,0x44,0x0C,0x41,0xD0,0x0C,0x0F,0x08,  /* 000003E8    "ID.A...." */
  19.367 +    0x5F,0x55,0x49,0x44,0x0A,0x04,0x14,0x1C,  /* 000003F0    "_UID...." */
  19.368 +    0x5F,0x53,0x54,0x41,0x00,0x7B,0x50,0x49,  /* 000003F8    "_STA.{PI" */
  19.369 +    0x52,0x44,0x0A,0x80,0x60,0xA0,0x08,0x93,  /* 00000400    "RD..`..." */
  19.370 +    0x60,0x0A,0x80,0xA4,0x0A,0x09,0xA1,0x04,  /* 00000408    "`......." */
  19.371 +    0xA4,0x0A,0x0B,0x14,0x0B,0x5F,0x50,0x52,  /* 00000410    "....._PR" */
  19.372 +    0x53,0x00,0xA4,0x42,0x55,0x46,0x41,0x14,  /* 00000418    "S..BUFA." */
  19.373 +    0x11,0x5F,0x44,0x49,0x53,0x00,0x7D,0x50,  /* 00000420    "._DIS.}P" */
  19.374 +    0x49,0x52,0x44,0x0A,0x80,0x50,0x49,0x52,  /* 00000428    "IRD..PIR" */
  19.375 +    0x44,0x14,0x1A,0x5F,0x43,0x52,0x53,0x00,  /* 00000430    "D.._CRS." */
  19.376 +    0x7B,0x50,0x49,0x52,0x44,0x0A,0x0F,0x60,  /* 00000438    "{PIRD..`" */
  19.377 +    0x79,0x01,0x60,0x49,0x52,0x51,0x56,0xA4,  /* 00000440    "y.`IRQV." */
  19.378 +    0x42,0x55,0x46,0x42,0x14,0x1B,0x5F,0x53,  /* 00000448    "BUFB.._S" */
  19.379 +    0x52,0x53,0x01,0x8B,0x68,0x01,0x49,0x52,  /* 00000450    "RS..h.IR" */
  19.380 +    0x51,0x31,0x82,0x49,0x52,0x51,0x31,0x60,  /* 00000458    "Q1.IRQ1`" */
  19.381 +    0x76,0x60,0x70,0x60,0x50,0x49,0x52,0x44,  /* 00000460    "v`p`PIRD" */
  19.382 +    0x14,0x16,0x5F,0x50,0x52,0x54,0x00,0xA0,  /* 00000468    ".._PRT.." */
  19.383 +    0x0A,0x50,0x49,0x43,0x44,0xA4,0x50,0x52,  /* 00000470    ".PICD.PR" */
  19.384 +    0x54,0x41,0xA4,0x50,0x52,0x54,0x50,0x08,  /* 00000478    "TA.PRTP." */
  19.385 +    0x50,0x52,0x54,0x50,0x12,0x43,0x0E,0x10,  /* 00000480    "PRTP.C.." */
  19.386 +    0x12,0x0B,0x04,0x0B,0xFF,0xFF,0x00,0x4C,  /* 00000488    ".......L" */
  19.387 +    0x4E,0x4B,0x41,0x00,0x12,0x0B,0x04,0x0B,  /* 00000490    "NKA....." */
  19.388 +    0xFF,0xFF,0x01,0x4C,0x4E,0x4B,0x42,0x00,  /* 00000498    "...LNKB." */
  19.389 +    0x12,0x0C,0x04,0x0B,0xFF,0xFF,0x0A,0x02,  /* 000004A0    "........" */
  19.390 +    0x4C,0x4E,0x4B,0x43,0x00,0x12,0x0C,0x04,  /* 000004A8    "LNKC...." */
  19.391 +    0x0B,0xFF,0xFF,0x0A,0x03,0x4C,0x4E,0x4B,  /* 000004B0    ".....LNK" */
  19.392 +    0x44,0x00,0x12,0x0D,0x04,0x0C,0xFF,0xFF,  /* 000004B8    "D......." */
  19.393 +    0x01,0x00,0x00,0x4C,0x4E,0x4B,0x42,0x00,  /* 000004C0    "...LNKB." */
  19.394 +    0x12,0x0D,0x04,0x0C,0xFF,0xFF,0x01,0x00,  /* 000004C8    "........" */
  19.395 +    0x01,0x4C,0x4E,0x4B,0x43,0x00,0x12,0x0E,  /* 000004D0    ".LNKC..." */
  19.396 +    0x04,0x0C,0xFF,0xFF,0x01,0x00,0x0A,0x02,  /* 000004D8    "........" */
  19.397 +    0x4C,0x4E,0x4B,0x44,0x00,0x12,0x0E,0x04,  /* 000004E0    "LNKD...." */
  19.398 +    0x0C,0xFF,0xFF,0x01,0x00,0x0A,0x03,0x4C,  /* 000004E8    ".......L" */
  19.399 +    0x4E,0x4B,0x41,0x00,0x12,0x0D,0x04,0x0C,  /* 000004F0    "NKA....." */
  19.400 +    0xFF,0xFF,0x02,0x00,0x00,0x4C,0x4E,0x4B,  /* 000004F8    ".....LNK" */
  19.401 +    0x43,0x00,0x12,0x0D,0x04,0x0C,0xFF,0xFF,  /* 00000500    "C......." */
  19.402 +    0x02,0x00,0x01,0x4C,0x4E,0x4B,0x44,0x00,  /* 00000508    "...LNKD." */
  19.403 +    0x12,0x0E,0x04,0x0C,0xFF,0xFF,0x02,0x00,  /* 00000510    "........" */
  19.404 +    0x0A,0x02,0x4C,0x4E,0x4B,0x41,0x00,0x12,  /* 00000518    "..LNKA.." */
  19.405 +    0x0E,0x04,0x0C,0xFF,0xFF,0x02,0x00,0x0A,  /* 00000520    "........" */
  19.406 +    0x03,0x4C,0x4E,0x4B,0x42,0x00,0x12,0x0D,  /* 00000528    ".LNKB..." */
  19.407 +    0x04,0x0C,0xFF,0xFF,0x03,0x00,0x00,0x4C,  /* 00000530    ".......L" */
  19.408 +    0x4E,0x4B,0x44,0x00,0x12,0x0D,0x04,0x0C,  /* 00000538    "NKD....." */
  19.409 +    0xFF,0xFF,0x03,0x00,0x01,0x4C,0x4E,0x4B,  /* 00000540    ".....LNK" */
  19.410 +    0x41,0x00,0x12,0x0E,0x04,0x0C,0xFF,0xFF,  /* 00000548    "A......." */
  19.411 +    0x03,0x00,0x0A,0x02,0x4C,0x4E,0x4B,0x42,  /* 00000550    "....LNKB" */
  19.412 +    0x00,0x12,0x0E,0x04,0x0C,0xFF,0xFF,0x03,  /* 00000558    "........" */
  19.413 +    0x00,0x0A,0x03,0x4C,0x4E,0x4B,0x43,0x00,  /* 00000560    "...LNKC." */
  19.414 +    0x08,0x50,0x52,0x54,0x41,0x12,0x32,0x04,  /* 00000568    ".PRTA.2." */
  19.415 +    0x12,0x0B,0x04,0x0C,0xFF,0xFF,0x01,0x00,  /* 00000570    "........" */
  19.416 +    0x00,0x00,0x0A,0x05,0x12,0x0B,0x04,0x0C,  /* 00000578    "........" */
  19.417 +    0xFF,0xFF,0x02,0x00,0x00,0x00,0x0A,0x07,  /* 00000580    "........" */
  19.418 +    0x12,0x0B,0x04,0x0C,0xFF,0xFF,0x03,0x00,  /* 00000588    "........" */
  19.419 +    0x00,0x00,0x0A,0x0A,0x12,0x0B,0x04,0x0C,  /* 00000590    "........" */
  19.420 +    0xFF,0xFF,0x04,0x00,0x00,0x00,0x0A,0x0B,  /* 00000598    "........" */
  19.421 +    0x5B,0x82,0x48,0x31,0x49,0x53,0x41,0x5F,  /* 000005A0    "[.H1ISA_" */
  19.422 +    0x08,0x5F,0x41,0x44,0x52,0x00,0x5B,0x80,  /* 000005A8    "._ADR.[." */
  19.423 +    0x50,0x49,0x52,0x51,0x02,0x0A,0x60,0x0A,  /* 000005B0    "PIRQ..`." */
  19.424 +    0x04,0x10,0x2E,0x5C,0x00,0x5B,0x81,0x29,  /* 000005B8    "...\.[.)" */
  19.425 +    0x5C,0x2F,0x04,0x5F,0x53,0x42,0x5F,0x50,  /* 000005C0    "\/._SB_P" */
  19.426 +    0x43,0x49,0x30,0x49,0x53,0x41,0x5F,0x50,  /* 000005C8    "CI0ISA_P" */
  19.427 +    0x49,0x52,0x51,0x01,0x50,0x49,0x52,0x41,  /* 000005D0    "IRQ.PIRA" */
  19.428 +    0x08,0x50,0x49,0x52,0x42,0x08,0x50,0x49,  /* 000005D8    ".PIRB.PI" */
  19.429 +    0x52,0x43,0x08,0x50,0x49,0x52,0x44,0x08,  /* 000005E0    "RC.PIRD." */
  19.430 +    0x5B,0x82,0x46,0x0B,0x53,0x59,0x53,0x52,  /* 000005E8    "[.F.SYSR" */
  19.431 +    0x08,0x5F,0x48,0x49,0x44,0x0C,0x41,0xD0,  /* 000005F0    "._HID.A." */
  19.432 +    0x0C,0x02,0x08,0x5F,0x55,0x49,0x44,0x01,  /* 000005F8    "..._UID." */
  19.433 +    0x08,0x43,0x52,0x53,0x5F,0x11,0x4E,0x08,  /* 00000600    ".CRS_.N." */
  19.434 +    0x0A,0x8A,0x47,0x01,0x10,0x00,0x10,0x00,  /* 00000608    "..G....." */
  19.435 +    0x00,0x10,0x47,0x01,0x22,0x00,0x22,0x00,  /* 00000610    "..G."."." */
  19.436 +    0x00,0x0C,0x47,0x01,0x30,0x00,0x30,0x00,  /* 00000618    "..G.0.0." */
  19.437 +    0x00,0x10,0x47,0x01,0x44,0x00,0x44,0x00,  /* 00000620    "..G.D.D." */
  19.438 +    0x00,0x1C,0x47,0x01,0x62,0x00,0x62,0x00,  /* 00000628    "..G.b.b." */
  19.439 +    0x00,0x02,0x47,0x01,0x65,0x00,0x65,0x00,  /* 00000630    "..G.e.e." */
  19.440 +    0x00,0x0B,0x47,0x01,0x72,0x00,0x72,0x00,  /* 00000638    "..G.r.r." */
  19.441 +    0x00,0x0E,0x47,0x01,0x80,0x00,0x80,0x00,  /* 00000640    "..G....." */
  19.442 +    0x00,0x01,0x47,0x01,0x84,0x00,0x84,0x00,  /* 00000648    "..G....." */
  19.443 +    0x00,0x03,0x47,0x01,0x88,0x00,0x88,0x00,  /* 00000650    "..G....." */
  19.444 +    0x00,0x01,0x47,0x01,0x8C,0x00,0x8C,0x00,  /* 00000658    "..G....." */
  19.445 +    0x00,0x03,0x47,0x01,0x90,0x00,0x90,0x00,  /* 00000660    "..G....." */
  19.446 +    0x00,0x10,0x47,0x01,0xA2,0x00,0xA2,0x00,  /* 00000668    "..G....." */
  19.447 +    0x00,0x1C,0x47,0x01,0xE0,0x00,0xE0,0x00,  /* 00000670    "..G....." */
  19.448 +    0x00,0x10,0x47,0x01,0xA0,0x08,0xA0,0x08,  /* 00000678    "..G....." */
  19.449 +    0x00,0x04,0x47,0x01,0xC0,0x0C,0xC0,0x0C,  /* 00000680    "..G....." */
  19.450 +    0x00,0x10,0x47,0x01,0xD0,0x04,0xD0,0x04,  /* 00000688    "..G....." */
  19.451 +    0x00,0x02,0x79,0x00,0x14,0x0B,0x5F,0x43,  /* 00000690    "..y..._C" */
  19.452 +    0x52,0x53,0x00,0xA4,0x43,0x52,0x53,0x5F,  /* 00000698    "RS..CRS_" */
  19.453 +    0x5B,0x82,0x2B,0x50,0x49,0x43,0x5F,0x08,  /* 000006A0    "[.+PIC_." */
  19.454 +    0x5F,0x48,0x49,0x44,0x0B,0x41,0xD0,0x08,  /* 000006A8    "_HID.A.." */
  19.455 +    0x5F,0x43,0x52,0x53,0x11,0x18,0x0A,0x15,  /* 000006B0    "_CRS...." */
  19.456 +    0x47,0x01,0x20,0x00,0x20,0x00,0x01,0x02,  /* 000006B8    "G. . ..." */
  19.457 +    0x47,0x01,0xA0,0x00,0xA0,0x00,0x01,0x02,  /* 000006C0    "G......." */
  19.458 +    0x22,0x04,0x00,0x79,0x00,0x5B,0x82,0x47,  /* 000006C8    ""..y.[.G" */
  19.459 +    0x05,0x44,0x4D,0x41,0x30,0x08,0x5F,0x48,  /* 000006D0    ".DMA0._H" */
  19.460 +    0x49,0x44,0x0C,0x41,0xD0,0x02,0x00,0x08,  /* 000006D8    "ID.A...." */
  19.461 +    0x5F,0x43,0x52,0x53,0x11,0x41,0x04,0x0A,  /* 000006E0    "_CRS.A.." */
  19.462 +    0x3D,0x2A,0x10,0x04,0x47,0x01,0x00,0x00,  /* 000006E8    "=*..G..." */
  19.463 +    0x00,0x00,0x00,0x10,0x47,0x01,0x81,0x00,  /* 000006F0    "....G..." */
  19.464 +    0x81,0x00,0x00,0x03,0x47,0x01,0x87,0x00,  /* 000006F8    "....G..." */
  19.465 +    0x87,0x00,0x00,0x01,0x47,0x01,0x89,0x00,  /* 00000700    "....G..." */
  19.466 +    0x89,0x00,0x00,0x03,0x47,0x01,0x8F,0x00,  /* 00000708    "....G..." */
  19.467 +    0x8F,0x00,0x00,0x01,0x47,0x01,0xC0,0x00,  /* 00000710    "....G..." */
  19.468 +    0xC0,0x00,0x00,0x20,0x47,0x01,0x80,0x04,  /* 00000718    "... G..." */
  19.469 +    0x80,0x04,0x00,0x10,0x79,0x00,0x5B,0x82,  /* 00000720    "....y.[." */
  19.470 +    0x25,0x54,0x4D,0x52,0x5F,0x08,0x5F,0x48,  /* 00000728    "%TMR_._H" */
  19.471 +    0x49,0x44,0x0C,0x41,0xD0,0x01,0x00,0x08,  /* 00000730    "ID.A...." */
  19.472 +    0x5F,0x43,0x52,0x53,0x11,0x10,0x0A,0x0D,  /* 00000738    "_CRS...." */
  19.473 +    0x47,0x01,0x40,0x00,0x40,0x00,0x00,0x04,  /* 00000740    "G.@.@..." */
  19.474 +    0x22,0x01,0x00,0x79,0x00,0x5B,0x82,0x25,  /* 00000748    ""..y.[.%" */
  19.475 +    0x52,0x54,0x43,0x5F,0x08,0x5F,0x48,0x49,  /* 00000750    "RTC_._HI" */
  19.476 +    0x44,0x0C,0x41,0xD0,0x0B,0x00,0x08,0x5F,  /* 00000758    "D.A...._" */
  19.477 +    0x43,0x52,0x53,0x11,0x10,0x0A,0x0D,0x47,  /* 00000760    "CRS....G" */
  19.478 +    0x01,0x70,0x00,0x70,0x00,0x00,0x02,0x22,  /* 00000768    ".p.p..."" */
  19.479 +    0x00,0x01,0x79,0x00,0x5B,0x82,0x22,0x53,  /* 00000770    "..y.[."S" */
  19.480 +    0x50,0x4B,0x52,0x08,0x5F,0x48,0x49,0x44,  /* 00000778    "PKR._HID" */
  19.481 +    0x0C,0x41,0xD0,0x08,0x00,0x08,0x5F,0x43,  /* 00000780    ".A...._C" */
  19.482 +    0x52,0x53,0x11,0x0D,0x0A,0x0A,0x47,0x01,  /* 00000788    "RS....G." */
  19.483 +    0x61,0x00,0x61,0x00,0x00,0x01,0x79,0x00,  /* 00000790    "a.a...y." */
  19.484 +    0x5B,0x82,0x31,0x50,0x53,0x32,0x4D,0x08,  /* 00000798    "[.1PS2M." */
  19.485 +    0x5F,0x48,0x49,0x44,0x0C,0x41,0xD0,0x0F,  /* 000007A0    "_HID.A.." */
  19.486 +    0x13,0x08,0x5F,0x43,0x49,0x44,0x0C,0x41,  /* 000007A8    ".._CID.A" */
  19.487 +    0xD0,0x0F,0x13,0x14,0x09,0x5F,0x53,0x54,  /* 000007B0    "....._ST" */
  19.488 +    0x41,0x00,0xA4,0x0A,0x0F,0x08,0x5F,0x43,  /* 000007B8    "A....._C" */
  19.489 +    0x52,0x53,0x11,0x08,0x0A,0x05,0x22,0x00,  /* 000007C0    "RS...."." */
  19.490 +    0x10,0x79,0x00,0x5B,0x82,0x42,0x04,0x50,  /* 000007C8    ".y.[.B.P" */
  19.491 +    0x53,0x32,0x4B,0x08,0x5F,0x48,0x49,0x44,  /* 000007D0    "S2K._HID" */
  19.492 +    0x0C,0x41,0xD0,0x03,0x03,0x08,0x5F,0x43,  /* 000007D8    ".A...._C" */
  19.493 +    0x49,0x44,0x0C,0x41,0xD0,0x03,0x0B,0x14,  /* 000007E0    "ID.A...." */
  19.494 +    0x09,0x5F,0x53,0x54,0x41,0x00,0xA4,0x0A,  /* 000007E8    "._STA..." */
  19.495 +    0x0F,0x08,0x5F,0x43,0x52,0x53,0x11,0x18,  /* 000007F0    ".._CRS.." */
  19.496 +    0x0A,0x15,0x47,0x01,0x60,0x00,0x60,0x00,  /* 000007F8    "..G.`.`." */
  19.497 +    0x00,0x01,0x47,0x01,0x64,0x00,0x64,0x00,  /* 00000800    "..G.d.d." */
  19.498 +    0x00,0x01,0x22,0x02,0x00,0x79,0x00,0x5B,  /* 00000808    ".."..y.[" */
  19.499 +    0x82,0x3A,0x46,0x44,0x43,0x30,0x08,0x5F,  /* 00000810    ".:FDC0._" */
  19.500 +    0x48,0x49,0x44,0x0C,0x41,0xD0,0x07,0x00,  /* 00000818    "HID.A..." */
  19.501 +    0x14,0x09,0x5F,0x53,0x54,0x41,0x00,0xA4,  /* 00000820    ".._STA.." */
  19.502 +    0x0A,0x0F,0x08,0x5F,0x43,0x52,0x53,0x11,  /* 00000828    "..._CRS." */
  19.503 +    0x1B,0x0A,0x18,0x47,0x01,0xF0,0x03,0xF0,  /* 00000830    "...G...." */
  19.504 +    0x03,0x01,0x06,0x47,0x01,0xF7,0x03,0xF7,  /* 00000838    "...G...." */
  19.505 +    0x03,0x01,0x01,0x22,0x40,0x00,0x2A,0x04,  /* 00000840    "..."@.*." */
  19.506 +    0x00,0x79,0x00,0x5B,0x82,0x35,0x55,0x41,  /* 00000848    ".y.[.5UA" */
  19.507 +    0x52,0x31,0x08,0x5F,0x48,0x49,0x44,0x0C,  /* 00000850    "R1._HID." */
  19.508 +    0x41,0xD0,0x05,0x01,0x08,0x5F,0x55,0x49,  /* 00000858    "A...._UI" */
  19.509 +    0x44,0x01,0x14,0x09,0x5F,0x53,0x54,0x41,  /* 00000860    "D..._STA" */
  19.510 +    0x00,0xA4,0x0A,0x0F,0x08,0x5F,0x43,0x52,  /* 00000868    "....._CR" */
  19.511 +    0x53,0x11,0x10,0x0A,0x0D,0x47,0x01,0xF8,  /* 00000870    "S....G.." */
  19.512 +    0x03,0xF8,0x03,0x01,0x08,0x22,0x10,0x00,  /* 00000878    ".....".." */
  19.513 +    0x79,0x00,0x5B,0x82,0x36,0x4C,0x54,0x50,  /* 00000880    "y.[.6LTP" */
  19.514 +    0x31,0x08,0x5F,0x48,0x49,0x44,0x0C,0x41,  /* 00000888    "1._HID.A" */
  19.515 +    0xD0,0x04,0x00,0x08,0x5F,0x55,0x49,0x44,  /* 00000890    "...._UID" */
  19.516 +    0x0A,0x02,0x14,0x09,0x5F,0x53,0x54,0x41,  /* 00000898    "...._STA" */
  19.517 +    0x00,0xA4,0x0A,0x0F,0x08,0x5F,0x43,0x52,  /* 000008A0    "....._CR" */
  19.518 +    0x53,0x11,0x10,0x0A,0x0D,0x47,0x01,0x78,  /* 000008A8    "S....G.x" */
  19.519 +    0x03,0x78,0x03,0x08,0x08,0x22,0x80,0x00,  /* 000008B0    ".x...".." */
  19.520 +    0x79,0x00,
  19.521  };
  19.522  int DsdtLen=sizeof(AmlCode);
    20.1 --- a/tools/libxc/Makefile	Fri Aug 25 16:21:39 2006 -0600
    20.2 +++ b/tools/libxc/Makefile	Sun Aug 27 10:24:41 2006 -0600
    20.3 @@ -11,7 +11,6 @@ XEN_ROOT = ../..
    20.4  include $(XEN_ROOT)/tools/Rules.mk
    20.5  
    20.6  CTRL_SRCS-y       :=
    20.7 -CTRL_SRCS-y       += xc_bvtsched.c
    20.8  CTRL_SRCS-y       += xc_core.c
    20.9  CTRL_SRCS-y       += xc_domain.c
   20.10  CTRL_SRCS-y       += xc_evtchn.c
    21.1 --- a/tools/libxc/ia64/xc_ia64_hvm_build.c	Fri Aug 25 16:21:39 2006 -0600
    21.2 +++ b/tools/libxc/ia64/xc_ia64_hvm_build.c	Sun Aug 27 10:24:41 2006 -0600
    21.3 @@ -554,7 +554,7 @@ setup_guest(int xc_handle, uint32_t dom,
    21.4      unsigned long page_array[2];
    21.5      shared_iopage_t *sp;
    21.6      unsigned long dom_memsize = (memsize << 20);
    21.7 -    DECLARE_DOM0_OP;
    21.8 +    DECLARE_DOMCTL;
    21.9  
   21.10      if ((image_size > 12 * MEM_M) || (image_size & (PAGE_SIZE - 1))) {
   21.11          PERROR("Guest firmware size is incorrect [%ld]?", image_size);
   21.12 @@ -562,13 +562,12 @@ setup_guest(int xc_handle, uint32_t dom,
   21.13      }
   21.14  
   21.15      /* This will creates the physmap.  */
   21.16 -    op.u.domain_setup.flags = XEN_DOMAINSETUP_hvm_guest;
   21.17 -    op.u.domain_setup.domain = (domid_t)dom;
   21.18 -    op.u.domain_setup.bp = 0;
   21.19 -    op.u.domain_setup.maxmem = 0;
   21.20 -    
   21.21 -    op.cmd = DOM0_DOMAIN_SETUP;
   21.22 -    if (xc_dom0_op(xc_handle, &op))
   21.23 +    domctl.u.arch_setup.flags = XEN_DOMAINSETUP_hvm_guest;
   21.24 +    domctl.u.arch_setup.bp = 0;
   21.25 +    domctl.u.arch_setup.maxmem = 0;
   21.26 +    domctl.cmd = XEN_DOMCTL_arch_setup;
   21.27 +    domctl.domain = (domid_t)dom;
   21.28 +    if (xc_domctl(xc_handle, &domctl))
   21.29          goto error_out;
   21.30  
   21.31      /* Load guest firmware */
   21.32 @@ -618,7 +617,7 @@ xc_hvm_build(int xc_handle, uint32_t dom
   21.33               unsigned int acpi, unsigned int apic, unsigned int store_evtchn,
   21.34               unsigned long *store_mfn)
   21.35  {
   21.36 -    dom0_op_t launch_op, op;
   21.37 +    struct xen_domctl launch_domctl, domctl;
   21.38      int rc;
   21.39      vcpu_guest_context_t st_ctxt, *ctxt = &st_ctxt;
   21.40      char *image = NULL;
   21.41 @@ -644,10 +643,10 @@ xc_hvm_build(int xc_handle, uint32_t dom
   21.42          return 1;
   21.43      }
   21.44  
   21.45 -    op.cmd = DOM0_GETDOMAININFO;
   21.46 -    op.u.getdomaininfo.domain = (domid_t)domid;
   21.47 -    if (do_dom0_op(xc_handle, &op) < 0 ||
   21.48 -        (uint16_t)op.u.getdomaininfo.domain != domid) {
   21.49 +    domctl.cmd = XEN_DOMCTL_getdomaininfo;
   21.50 +    domctl.domain = (domid_t)domid;
   21.51 +    if (do_domctl(xc_handle, &domctl) < 0 ||
   21.52 +        (uint16_t)domctl.domain != domid) {
   21.53          PERROR("Could not get info on domain");
   21.54          goto error_out;
   21.55      }
   21.56 @@ -664,14 +663,14 @@ xc_hvm_build(int xc_handle, uint32_t dom
   21.57  
   21.58      ctxt->user_regs.cr_iip = 0x80000000ffffffb0UL;
   21.59  
   21.60 -    memset(&launch_op, 0, sizeof(launch_op));
   21.61 +    memset(&launch_domctl, 0, sizeof(launch_domctl));
   21.62  
   21.63 -    launch_op.u.setvcpucontext.domain = (domid_t)domid;
   21.64 -    launch_op.u.setvcpucontext.vcpu = 0;
   21.65 -    set_xen_guest_handle(launch_op.u.setvcpucontext.ctxt, ctxt);
   21.66 +    launch_domctl.domain = (domid_t)domid;
   21.67 +    launch_domctl.u.vcpucontext.vcpu = 0;
   21.68 +    set_xen_guest_handle(launch_domctl.u.vcpucontext.ctxt, ctxt);
   21.69  
   21.70 -    launch_op.cmd = DOM0_SETVCPUCONTEXT;
   21.71 -    rc = do_dom0_op(xc_handle, &launch_op);
   21.72 +    launch_domctl.cmd = XEN_DOMCTL_setvcpucontext;
   21.73 +    rc = do_domctl(xc_handle, &launch_domctl);
   21.74      return rc;
   21.75  
   21.76  error_out:
    22.1 --- a/tools/libxc/ia64/xc_ia64_linux_restore.c	Fri Aug 25 16:21:39 2006 -0600
    22.2 +++ b/tools/libxc/ia64/xc_ia64_linux_restore.c	Sun Aug 27 10:24:41 2006 -0600
    22.3 @@ -61,7 +61,7 @@ xc_linux_restore(int xc_handle, int io_f
    22.4                   unsigned long *store_mfn, unsigned int console_evtchn,
    22.5                   unsigned long *console_mfn)
    22.6  {
    22.7 -    DECLARE_DOM0_OP;
    22.8 +    DECLARE_DOMCTL;
    22.9      int rc = 1, i;
   22.10      unsigned long mfn, pfn;
   22.11      unsigned long ver;
   22.12 @@ -94,19 +94,19 @@ xc_linux_restore(int xc_handle, int io_f
   22.13      }
   22.14  
   22.15      if (mlock(&ctxt, sizeof(ctxt))) {
   22.16 -        /* needed for build dom0 op, but might as well do early */
   22.17 +        /* needed for build domctl, but might as well do early */
   22.18          ERR("Unable to mlock ctxt");
   22.19          return 1;
   22.20      }
   22.21  
   22.22      /* Get the domain's shared-info frame. */
   22.23 -    op.cmd = DOM0_GETDOMAININFO;
   22.24 -    op.u.getdomaininfo.domain = (domid_t)dom;
   22.25 -    if (xc_dom0_op(xc_handle, &op) < 0) {
   22.26 +    domctl.cmd = XEN_DOMCTL_getdomaininfo;
   22.27 +    domctl.domain = (domid_t)dom;
   22.28 +    if (xc_domctl(xc_handle, &domctl) < 0) {
   22.29          ERR("Could not get information on new domain");
   22.30          goto out;
   22.31      }
   22.32 -    shared_info_frame = op.u.getdomaininfo.shared_info_frame;
   22.33 +    shared_info_frame = domctl.u.getdomaininfo.shared_info_frame;
   22.34  
   22.35      if (xc_domain_setmaxmem(xc_handle, dom, PFN_TO_KB(max_pfn)) != 0) {
   22.36          errno = ENOMEM;
   22.37 @@ -122,20 +122,20 @@ xc_linux_restore(int xc_handle, int io_f
   22.38  
   22.39      DPRINTF("Increased domain reservation by %ld KB\n", PFN_TO_KB(max_pfn));
   22.40  
   22.41 -    if (!read_exact(io_fd, &op.u.domain_setup, sizeof(op.u.domain_setup))) {
   22.42 +    if (!read_exact(io_fd, &domctl.u.arch_setup, sizeof(domctl.u.arch_setup))) {
   22.43          ERR("read: domain setup");
   22.44          goto out;
   22.45      }
   22.46  
   22.47      /* Build firmware (will be overwritten).  */
   22.48 -    op.u.domain_setup.domain = (domid_t)dom;
   22.49 -    op.u.domain_setup.flags &= ~XEN_DOMAINSETUP_query;
   22.50 -    op.u.domain_setup.bp = ((nr_pfns - 3) << PAGE_SHIFT)
   22.51 +    domctl.domain = (domid_t)dom;
   22.52 +    domctl.u.arch_setup.flags &= ~XEN_DOMAINSETUP_query;
   22.53 +    domctl.u.arch_setup.bp = ((nr_pfns - 3) << PAGE_SHIFT)
   22.54                             + sizeof (start_info_t);
   22.55 -    op.u.domain_setup.maxmem = (nr_pfns - 3) << PAGE_SHIFT;
   22.56 +    domctl.u.arch_setup.maxmem = (nr_pfns - 3) << PAGE_SHIFT;
   22.57      
   22.58 -    op.cmd = DOM0_DOMAIN_SETUP;
   22.59 -    if (xc_dom0_op(xc_handle, &op))
   22.60 +    domctl.cmd = XEN_DOMCTL_arch_setup;
   22.61 +    if (xc_domctl(xc_handle, &domctl))
   22.62          goto out;
   22.63  
   22.64      /* Get pages.  */
   22.65 @@ -226,22 +226,22 @@ xc_linux_restore(int xc_handle, int io_f
   22.66      }
   22.67  
   22.68      /* First to initialize.  */
   22.69 -    op.cmd = DOM0_SETVCPUCONTEXT;
   22.70 -    op.u.setvcpucontext.domain = (domid_t)dom;
   22.71 -    op.u.setvcpucontext.vcpu   = 0;
   22.72 -    set_xen_guest_handle(op.u.setvcpucontext.ctxt, &ctxt);
   22.73 -    if (xc_dom0_op(xc_handle, &op) != 0) {
   22.74 +    domctl.cmd = XEN_DOMCTL_setvcpucontext;
   22.75 +    domctl.domain = (domid_t)dom;
   22.76 +    domctl.u.vcpucontext.vcpu   = 0;
   22.77 +    set_xen_guest_handle(domctl.u.vcpucontext.ctxt, &ctxt);
   22.78 +    if (xc_domctl(xc_handle, &domctl) != 0) {
   22.79  	    ERR("Couldn't set vcpu context");
   22.80  	    goto out;
   22.81      }
   22.82  
   22.83      /* Second to set registers...  */
   22.84      ctxt.flags = VGCF_EXTRA_REGS;
   22.85 -    op.cmd = DOM0_SETVCPUCONTEXT;
   22.86 -    op.u.setvcpucontext.domain = (domid_t)dom;
   22.87 -    op.u.setvcpucontext.vcpu   = 0;
   22.88 -    set_xen_guest_handle(op.u.setvcpucontext.ctxt, &ctxt);
   22.89 -    if (xc_dom0_op(xc_handle, &op) != 0) {
   22.90 +    domctl.cmd = XEN_DOMCTL_setvcpucontext;
   22.91 +    domctl.domain = (domid_t)dom;
   22.92 +    domctl.u.vcpucontext.vcpu   = 0;
   22.93 +    set_xen_guest_handle(domctl.u.vcpucontext.ctxt, &ctxt);
   22.94 +    if (xc_domctl(xc_handle, &domctl) != 0) {
   22.95  	    ERR("Couldn't set vcpu context");
   22.96  	    goto out;
   22.97      }
    23.1 --- a/tools/libxc/ia64/xc_ia64_linux_save.c	Fri Aug 25 16:21:39 2006 -0600
    23.2 +++ b/tools/libxc/ia64/xc_ia64_linux_save.c	Sun Aug 27 10:24:41 2006 -0600
    23.3 @@ -60,7 +60,7 @@ static int xc_ia64_shadow_control(int xc
    23.4                                    unsigned int sop,
    23.5                                    unsigned long *dirty_bitmap,
    23.6                                    unsigned long pages,
    23.7 -                                  xc_shadow_control_stats_t *stats)
    23.8 +                                  xc_shadow_op_stats_t *stats)
    23.9  {
   23.10      if (dirty_bitmap != NULL && pages > 0) {
   23.11          int i;
   23.12 @@ -137,7 +137,7 @@ int
   23.13  xc_linux_save(int xc_handle, int io_fd, uint32_t dom, uint32_t max_iters,
   23.14                uint32_t max_factor, uint32_t flags, int (*suspend)(int))
   23.15  {
   23.16 -    DECLARE_DOM0_OP;
   23.17 +    DECLARE_DOMCTL;
   23.18      xc_dominfo_t info;
   23.19  
   23.20      int rc = 1;
   23.21 @@ -242,15 +242,15 @@ xc_linux_save(int xc_handle, int io_fd, 
   23.22          }
   23.23      }
   23.24  
   23.25 -    op.cmd = DOM0_DOMAIN_SETUP;
   23.26 -    op.u.domain_setup.domain = (domid_t)dom;
   23.27 -    op.u.domain_setup.flags = XEN_DOMAINSETUP_query;
   23.28 -    if (xc_dom0_op(xc_handle, &op) < 0) {
   23.29 +    domctl.cmd = XEN_DOMCTL_arch_setup;
   23.30 +    domctl.domain = (domid_t)dom;
   23.31 +    domctl.u.arch_setup.flags = XEN_DOMAINSETUP_query;
   23.32 +    if (xc_domctl(xc_handle, &domctl) < 0) {
   23.33          ERR("Could not get domain setup");
   23.34          goto out;
   23.35      }
   23.36 -    op.u.domain_setup.domain = 0;
   23.37 -    if (!write_exact(io_fd, &op.u.domain_setup, sizeof(op.u.domain_setup))) {
   23.38 +    if (!write_exact(io_fd, &domctl.u.arch_setup,
   23.39 +                     sizeof(domctl.u.arch_setup))) {
   23.40          ERR("write: domain setup");
   23.41          goto out;
   23.42      }
   23.43 @@ -259,7 +259,7 @@ xc_linux_save(int xc_handle, int io_fd, 
   23.44      if (live) {
   23.45  
   23.46          if (xc_ia64_shadow_control(xc_handle, dom,
   23.47 -                                   DOM0_SHADOW_CONTROL_OP_ENABLE_LOGDIRTY,
   23.48 +                                   XEN_DOMCTL_SHADOW_OP_ENABLE_LOGDIRTY,
   23.49                                     NULL, 0, NULL ) < 0) {
   23.50              ERR("Couldn't enable shadow mode");
   23.51              goto out;
   23.52 @@ -324,7 +324,7 @@ xc_linux_save(int xc_handle, int io_fd, 
   23.53             but this is fast enough for the moment. */
   23.54          if (!last_iter) {
   23.55              if (xc_ia64_shadow_control(xc_handle, dom,
   23.56 -                                       DOM0_SHADOW_CONTROL_OP_PEEK,
   23.57 +                                       XEN_DOMCTL_SHADOW_OP_PEEK,
   23.58                                         to_skip, max_pfn, NULL) != max_pfn) {
   23.59                  ERR("Error peeking shadow bitmap");
   23.60                  goto out;
   23.61 @@ -392,7 +392,7 @@ xc_linux_save(int xc_handle, int io_fd, 
   23.62  
   23.63              /* Pages to be sent are pages which were dirty.  */
   23.64              if (xc_ia64_shadow_control(xc_handle, dom,
   23.65 -                                       DOM0_SHADOW_CONTROL_OP_CLEAN,
   23.66 +                                       XEN_DOMCTL_SHADOW_OP_CLEAN,
   23.67                                         to_send, max_pfn, NULL ) != max_pfn) {
   23.68                  ERR("Error flushing shadow PT");
   23.69                  goto out;
   23.70 @@ -481,7 +481,7 @@ xc_linux_save(int xc_handle, int io_fd, 
   23.71   out:
   23.72  
   23.73      if (live) {
   23.74 -        if (xc_ia64_shadow_control(xc_handle, dom, DOM0_SHADOW_CONTROL_OP_OFF,
   23.75 +        if (xc_ia64_shadow_control(xc_handle, dom, XEN_DOMCTL_SHADOW_OP_OFF,
   23.76                                     NULL, 0, NULL ) < 0) {
   23.77              DPRINTF("Warning - couldn't disable shadow mode");
   23.78          }
    24.1 --- a/tools/libxc/ia64/xc_ia64_stubs.c	Fri Aug 25 16:21:39 2006 -0600
    24.2 +++ b/tools/libxc/ia64/xc_ia64_stubs.c	Sun Aug 27 10:24:41 2006 -0600
    24.3 @@ -33,7 +33,7 @@ int
    24.4  xc_ia64_get_pfn_list(int xc_handle, uint32_t domid, xen_pfn_t *pfn_buf,
    24.5                       unsigned int start_page, unsigned int nr_pages)
    24.6  {
    24.7 -    dom0_op_t op;
    24.8 +    struct xen_domctl domctl;
    24.9      int num_pfns,ret;
   24.10      unsigned int __start_page, __nr_pages;
   24.11      unsigned long max_pfns;
   24.12 @@ -45,11 +45,11 @@ xc_ia64_get_pfn_list(int xc_handle, uint
   24.13    
   24.14      while (__nr_pages) {
   24.15          max_pfns = ((unsigned long)__start_page << 32) | __nr_pages;
   24.16 -        op.cmd = DOM0_GETMEMLIST;
   24.17 -        op.u.getmemlist.domain   = (domid_t)domid;
   24.18 -        op.u.getmemlist.max_pfns = max_pfns;
   24.19 -        op.u.getmemlist.num_pfns = 0;
   24.20 -        set_xen_guest_handle(op.u.getmemlist.buffer, __pfn_buf);
   24.21 +        domctl.cmd = XEN_DOMCTL_getmemlist;
   24.22 +        domctl.domain   = (domid_t)domid;
   24.23 +        domctl.u.getmemlist.max_pfns = max_pfns;
   24.24 +        domctl.u.getmemlist.num_pfns = 0;
   24.25 +        set_xen_guest_handle(domctl.u.getmemlist.buffer, __pfn_buf);
   24.26  
   24.27          if ((max_pfns != -1UL)
   24.28              && mlock(__pfn_buf, __nr_pages * sizeof(xen_pfn_t)) != 0) {
   24.29 @@ -57,7 +57,7 @@ xc_ia64_get_pfn_list(int xc_handle, uint
   24.30              return -1;
   24.31          }
   24.32  
   24.33 -        ret = do_dom0_op(xc_handle, &op);
   24.34 +        ret = do_domctl(xc_handle, &domctl);
   24.35  
   24.36          if (max_pfns != -1UL)
   24.37              (void)munlock(__pfn_buf, __nr_pages * sizeof(xen_pfn_t));
   24.38 @@ -65,7 +65,7 @@ xc_ia64_get_pfn_list(int xc_handle, uint
   24.39          if (max_pfns == -1UL)
   24.40              return 0;
   24.41          
   24.42 -        num_pfns = op.u.getmemlist.num_pfns;
   24.43 +        num_pfns = domctl.u.getmemlist.num_pfns;
   24.44          __start_page += num_pfns;
   24.45          __nr_pages -= num_pfns;
   24.46          __pfn_buf += num_pfns;
   24.47 @@ -89,10 +89,10 @@ xc_get_pfn_list(int xc_handle, uint32_t 
   24.48  long
   24.49  xc_get_max_pages(int xc_handle, uint32_t domid)
   24.50  {
   24.51 -    dom0_op_t op;
   24.52 -    op.cmd = DOM0_GETDOMAININFO;
   24.53 -    op.u.getdomaininfo.domain = (domid_t)domid;
   24.54 -    return (do_dom0_op(xc_handle, &op) < 0) ? -1 : op.u.getdomaininfo.max_pages;
   24.55 +    struct xen_domctl domctl;
   24.56 +    domctl.cmd = XEN_DOMCTL_getdomaininfo;
   24.57 +    domctl.domain = (domid_t)domid;
   24.58 +    return (do_domctl(xc_handle, &domctl) < 0) ? -1 : domctl.u.getdomaininfo.max_pages;
   24.59  }
   24.60  
   24.61  /*
    25.1 --- a/tools/libxc/powerpc64/xc_linux_build.c	Fri Aug 25 16:21:39 2006 -0600
    25.2 +++ b/tools/libxc/powerpc64/xc_linux_build.c	Sun Aug 27 10:24:41 2006 -0600
    25.3 @@ -27,7 +27,6 @@
    25.4  #include <sys/types.h>
    25.5  #include <inttypes.h>
    25.6  
    25.7 -#include <xen/dom0_ops.h>
    25.8  #include <xen/memory.h>
    25.9  #include <xc_private.h>
   25.10  #include <xg_private.h>
    26.1 --- a/tools/libxc/xc_bvtsched.c	Fri Aug 25 16:21:39 2006 -0600
    26.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    26.3 @@ -1,92 +0,0 @@
    26.4 -/******************************************************************************
    26.5 - * xc_bvtsched.c
    26.6 - *
    26.7 - * API for manipulating parameters of the Borrowed Virtual Time scheduler.
    26.8 - *
    26.9 - * Copyright (c) 2003, K A Fraser.
   26.10 - */
   26.11 -
   26.12 -#include "xc_private.h"
   26.13 -
   26.14 -int xc_bvtsched_global_set(int xc_handle,
   26.15 -                           unsigned long ctx_allow)
   26.16 -{
   26.17 -    DECLARE_DOM0_OP;
   26.18 -
   26.19 -    op.cmd = DOM0_SCHEDCTL;
   26.20 -    op.u.schedctl.sched_id = SCHED_BVT;
   26.21 -    op.u.schedctl.direction = SCHED_INFO_PUT;
   26.22 -    op.u.schedctl.u.bvt.ctx_allow = ctx_allow;
   26.23 -
   26.24 -    return do_dom0_op(xc_handle, &op);
   26.25 -}
   26.26 -
   26.27 -int xc_bvtsched_global_get(int xc_handle,
   26.28 -                           unsigned long *ctx_allow)
   26.29 -{
   26.30 -    DECLARE_DOM0_OP;
   26.31 -    int ret;
   26.32 -
   26.33 -    op.cmd = DOM0_SCHEDCTL;
   26.34 -    op.u.schedctl.sched_id = SCHED_BVT;
   26.35 -    op.u.schedctl.direction = SCHED_INFO_GET;
   26.36 -
   26.37 -    ret = do_dom0_op(xc_handle, &op);
   26.38 -
   26.39 -    *ctx_allow = op.u.schedctl.u.bvt.ctx_allow;
   26.40 -
   26.41 -    return ret;
   26.42 -}
   26.43 -
   26.44 -int xc_bvtsched_domain_set(int xc_handle,
   26.45 -                           uint32_t domid,
   26.46 -                           uint32_t mcuadv,
   26.47 -                           int warpback,
   26.48 -                           int32_t warpvalue,
   26.49 -                           long long warpl,
   26.50 -                           long long warpu)
   26.51 -{
   26.52 -    DECLARE_DOM0_OP;
   26.53 -    struct bvt_adjdom *bvtadj = &op.u.adjustdom.u.bvt;
   26.54 -
   26.55 -    op.cmd = DOM0_ADJUSTDOM;
   26.56 -    op.u.adjustdom.domain  = (domid_t)domid;
   26.57 -    op.u.adjustdom.sched_id = SCHED_BVT;
   26.58 -    op.u.adjustdom.direction = SCHED_INFO_PUT;
   26.59 -
   26.60 -    bvtadj->mcu_adv     = mcuadv;
   26.61 -    bvtadj->warpback    = warpback;
   26.62 -    bvtadj->warpvalue   = warpvalue;
   26.63 -    bvtadj->warpl       = warpl;
   26.64 -    bvtadj->warpu       = warpu;
   26.65 -    return do_dom0_op(xc_handle, &op);
   26.66 -}
   26.67 -
   26.68 -
   26.69 -int xc_bvtsched_domain_get(int xc_handle,
   26.70 -                           uint32_t domid,
   26.71 -                           uint32_t *mcuadv,
   26.72 -                           int *warpback,
   26.73 -                           int32_t *warpvalue,
   26.74 -                           long long *warpl,
   26.75 -                           long long *warpu)
   26.76 -{
   26.77 -
   26.78 -    DECLARE_DOM0_OP;
   26.79 -    int ret;
   26.80 -    struct bvt_adjdom *adjptr = &op.u.adjustdom.u.bvt;
   26.81 -
   26.82 -    op.cmd = DOM0_ADJUSTDOM;
   26.83 -    op.u.adjustdom.domain  = (domid_t)domid;
   26.84 -    op.u.adjustdom.sched_id = SCHED_BVT;
   26.85 -    op.u.adjustdom.direction = SCHED_INFO_GET;
   26.86 -
   26.87 -    ret = do_dom0_op(xc_handle, &op);
   26.88 -
   26.89 -    *mcuadv     = adjptr->mcu_adv;
   26.90 -    *warpback   = adjptr->warpback;
   26.91 -    *warpvalue  = adjptr->warpvalue;
   26.92 -    *warpl      = adjptr->warpl;
   26.93 -    *warpu      = adjptr->warpu;
   26.94 -    return ret;
   26.95 -}
    27.1 --- a/tools/libxc/xc_csched.c	Fri Aug 25 16:21:39 2006 -0600
    27.2 +++ b/tools/libxc/xc_csched.c	Sun Aug 27 10:24:41 2006 -0600
    27.3 @@ -15,36 +15,36 @@ int
    27.4  xc_sched_credit_domain_set(
    27.5      int xc_handle,
    27.6      uint32_t domid,
    27.7 -    struct sched_credit_adjdom *sdom)
    27.8 +    struct xen_domctl_sched_credit *sdom)
    27.9  {
   27.10 -    DECLARE_DOM0_OP;
   27.11 +    DECLARE_DOMCTL;
   27.12  
   27.13 -    op.cmd = DOM0_ADJUSTDOM;    
   27.14 -    op.u.adjustdom.domain = (domid_t) domid;
   27.15 -    op.u.adjustdom.sched_id = SCHED_CREDIT;
   27.16 -    op.u.adjustdom.direction = SCHED_INFO_PUT;
   27.17 -    op.u.adjustdom.u.credit = *sdom;
   27.18 +    domctl.cmd = XEN_DOMCTL_scheduler_op;
   27.19 +    domctl.domain = (domid_t) domid;
   27.20 +    domctl.u.scheduler_op.sched_id = XEN_SCHEDULER_CREDIT;
   27.21 +    domctl.u.scheduler_op.cmd = XEN_DOMCTL_SCHEDOP_putinfo;
   27.22 +    domctl.u.scheduler_op.u.credit = *sdom;
   27.23  
   27.24 -    return do_dom0_op(xc_handle, &op);
   27.25 +    return do_domctl(xc_handle, &domctl);
   27.26  }
   27.27  
   27.28  int
   27.29  xc_sched_credit_domain_get(
   27.30      int xc_handle,
   27.31      uint32_t domid,
   27.32 -    struct sched_credit_adjdom *sdom)
   27.33 +    struct xen_domctl_sched_credit *sdom)
   27.34  {
   27.35 -    DECLARE_DOM0_OP;
   27.36 +    DECLARE_DOMCTL;
   27.37      int err;
   27.38  
   27.39 -    op.cmd = DOM0_ADJUSTDOM;    
   27.40 -    op.u.adjustdom.domain = (domid_t) domid;
   27.41 -    op.u.adjustdom.sched_id = SCHED_CREDIT;
   27.42 -    op.u.adjustdom.direction = SCHED_INFO_GET;
   27.43 +    domctl.cmd = XEN_DOMCTL_scheduler_op;
   27.44 +    domctl.domain = (domid_t) domid;
   27.45 +    domctl.u.scheduler_op.sched_id = XEN_SCHEDULER_CREDIT;
   27.46 +    domctl.u.scheduler_op.cmd = XEN_DOMCTL_SCHEDOP_getinfo;
   27.47  
   27.48 -    err = do_dom0_op(xc_handle, &op);
   27.49 +    err = do_domctl(xc_handle, &domctl);
   27.50      if ( err == 0 )
   27.51 -        *sdom = op.u.adjustdom.u.credit;
   27.52 +        *sdom = domctl.u.scheduler_op.u.credit;
   27.53  
   27.54      return err;
   27.55  }
    28.1 --- a/tools/libxc/xc_domain.c	Fri Aug 25 16:21:39 2006 -0600
    28.2 +++ b/tools/libxc/xc_domain.c	Sun Aug 27 10:24:41 2006 -0600
    28.3 @@ -15,16 +15,16 @@ int xc_domain_create(int xc_handle,
    28.4                       uint32_t *pdomid)
    28.5  {
    28.6      int err;
    28.7 -    DECLARE_DOM0_OP;
    28.8 +    DECLARE_DOMCTL;
    28.9  
   28.10 -    op.cmd = DOM0_CREATEDOMAIN;
   28.11 -    op.u.createdomain.domain = (domid_t)*pdomid;
   28.12 -    op.u.createdomain.ssidref = ssidref;
   28.13 -    memcpy(op.u.createdomain.handle, handle, sizeof(xen_domain_handle_t));
   28.14 -    if ( (err = do_dom0_op(xc_handle, &op)) != 0 )
   28.15 +    domctl.cmd = XEN_DOMCTL_createdomain;
   28.16 +    domctl.domain = (domid_t)*pdomid;
   28.17 +    domctl.u.createdomain.ssidref = ssidref;
   28.18 +    memcpy(domctl.u.createdomain.handle, handle, sizeof(xen_domain_handle_t));
   28.19 +    if ( (err = do_domctl(xc_handle, &domctl)) != 0 )
   28.20          return err;
   28.21  
   28.22 -    *pdomid = (uint16_t)op.u.createdomain.domain;
   28.23 +    *pdomid = (uint16_t)domctl.domain;
   28.24      return 0;
   28.25  }
   28.26  
   28.27 @@ -32,30 +32,30 @@ int xc_domain_create(int xc_handle,
   28.28  int xc_domain_pause(int xc_handle,
   28.29                      uint32_t domid)
   28.30  {
   28.31 -    DECLARE_DOM0_OP;
   28.32 -    op.cmd = DOM0_PAUSEDOMAIN;
   28.33 -    op.u.pausedomain.domain = (domid_t)domid;
   28.34 -    return do_dom0_op(xc_handle, &op);
   28.35 +    DECLARE_DOMCTL;
   28.36 +    domctl.cmd = XEN_DOMCTL_pausedomain;
   28.37 +    domctl.domain = (domid_t)domid;
   28.38 +    return do_domctl(xc_handle, &domctl);
   28.39  }
   28.40  
   28.41  
   28.42  int xc_domain_unpause(int xc_handle,
   28.43                        uint32_t domid)
   28.44  {
   28.45 -    DECLARE_DOM0_OP;
   28.46 -    op.cmd = DOM0_UNPAUSEDOMAIN;
   28.47 -    op.u.unpausedomain.domain = (domid_t)domid;
   28.48 -    return do_dom0_op(xc_handle, &op);
   28.49 +    DECLARE_DOMCTL;
   28.50 +    domctl.cmd = XEN_DOMCTL_unpausedomain;
   28.51 +    domctl.domain = (domid_t)domid;
   28.52 +    return do_domctl(xc_handle, &domctl);
   28.53  }
   28.54  
   28.55  
   28.56  int xc_domain_destroy(int xc_handle,
   28.57                        uint32_t domid)
   28.58  {
   28.59 -    DECLARE_DOM0_OP;
   28.60 -    op.cmd = DOM0_DESTROYDOMAIN;
   28.61 -    op.u.destroydomain.domain = (domid_t)domid;
   28.62 -    return do_dom0_op(xc_handle, &op);
   28.63 +    DECLARE_DOMCTL;
   28.64 +    domctl.cmd = XEN_DOMCTL_destroydomain;
   28.65 +    domctl.domain = (domid_t)domid;
   28.66 +    return do_domctl(xc_handle, &domctl);
   28.67  }
   28.68  
   28.69  int xc_domain_shutdown(int xc_handle,
   28.70 @@ -90,14 +90,62 @@ int xc_domain_shutdown(int xc_handle,
   28.71  int xc_vcpu_setaffinity(int xc_handle,
   28.72                          uint32_t domid,
   28.73                          int vcpu,
   28.74 -                        cpumap_t cpumap)
   28.75 +                        uint64_t cpumap)
   28.76  {
   28.77 -    DECLARE_DOM0_OP;
   28.78 -    op.cmd = DOM0_SETVCPUAFFINITY;
   28.79 -    op.u.setvcpuaffinity.domain  = (domid_t)domid;
   28.80 -    op.u.setvcpuaffinity.vcpu    = vcpu;
   28.81 -    op.u.setvcpuaffinity.cpumap  = cpumap;
   28.82 -    return do_dom0_op(xc_handle, &op);
   28.83 +    DECLARE_DOMCTL;
   28.84 +    int ret = -1;
   28.85 +
   28.86 +    domctl.cmd = XEN_DOMCTL_setvcpuaffinity;
   28.87 +    domctl.domain = (domid_t)domid;
   28.88 +    domctl.u.vcpuaffinity.vcpu    = vcpu;
   28.89 +
   28.90 +    set_xen_guest_handle(domctl.u.vcpuaffinity.cpumap.bitmap,
   28.91 +                         (uint8_t *)&cpumap);
   28.92 +    domctl.u.vcpuaffinity.cpumap.nr_cpus = sizeof(cpumap) * 8;
   28.93 +    
   28.94 +    if ( mlock(&cpumap, sizeof(cpumap)) != 0 )
   28.95 +    {
   28.96 +        PERROR("Could not lock memory for Xen hypercall");
   28.97 +        goto out;
   28.98 +    }
   28.99 +
  28.100 +    ret = do_domctl(xc_handle, &domctl);
  28.101 +
  28.102 +    safe_munlock(&cpumap, sizeof(cpumap));
  28.103 +
  28.104 + out:
  28.105 +    return ret;
  28.106 +}
  28.107 +
  28.108 +
  28.109 +int xc_vcpu_getaffinity(int xc_handle,
  28.110 +                        uint32_t domid,
  28.111 +                        int vcpu,
  28.112 +                        uint64_t *cpumap)
  28.113 +{
  28.114 +    DECLARE_DOMCTL;
  28.115 +    int ret = -1;
  28.116 +
  28.117 +    domctl.cmd = XEN_DOMCTL_getvcpuaffinity;
  28.118 +    domctl.domain = (domid_t)domid;
  28.119 +    domctl.u.vcpuaffinity.vcpu = vcpu;
  28.120 +
  28.121 +    set_xen_guest_handle(domctl.u.vcpuaffinity.cpumap.bitmap,
  28.122 +                         (uint8_t *)cpumap);
  28.123 +    domctl.u.vcpuaffinity.cpumap.nr_cpus = sizeof(*cpumap) * 8;
  28.124 +    
  28.125 +    if ( mlock(cpumap, sizeof(*cpumap)) != 0 )
  28.126 +    {
  28.127 +        PERROR("Could not lock memory for Xen hypercall");
  28.128 +        goto out;
  28.129 +    }
  28.130 +
  28.131 +    ret = do_domctl(xc_handle, &domctl);
  28.132 +
  28.133 +    safe_munlock(cpumap, sizeof(*cpumap));
  28.134 +
  28.135 + out:
  28.136 +    return ret;
  28.137  }
  28.138  
  28.139  
  28.140 @@ -108,27 +156,27 @@ int xc_domain_getinfo(int xc_handle,
  28.141  {
  28.142      unsigned int nr_doms;
  28.143      uint32_t next_domid = first_domid;
  28.144 -    DECLARE_DOM0_OP;
  28.145 +    DECLARE_DOMCTL;
  28.146      int rc = 0;
  28.147  
  28.148      memset(info, 0, max_doms*sizeof(xc_dominfo_t));
  28.149  
  28.150      for ( nr_doms = 0; nr_doms < max_doms; nr_doms++ )
  28.151      {
  28.152 -        op.cmd = DOM0_GETDOMAININFO;
  28.153 -        op.u.getdomaininfo.domain = (domid_t)next_domid;
  28.154 -        if ( (rc = do_dom0_op(xc_handle, &op)) < 0 )
  28.155 +        domctl.cmd = XEN_DOMCTL_getdomaininfo;
  28.156 +        domctl.domain = (domid_t)next_domid;
  28.157 +        if ( (rc = do_domctl(xc_handle, &domctl)) < 0 )
  28.158              break;
  28.159 -        info->domid      = (uint16_t)op.u.getdomaininfo.domain;
  28.160 +        info->domid      = (uint16_t)domctl.domain;
  28.161  
  28.162 -        info->dying    = !!(op.u.getdomaininfo.flags & DOMFLAGS_DYING);
  28.163 -        info->shutdown = !!(op.u.getdomaininfo.flags & DOMFLAGS_SHUTDOWN);
  28.164 -        info->paused   = !!(op.u.getdomaininfo.flags & DOMFLAGS_PAUSED);
  28.165 -        info->blocked  = !!(op.u.getdomaininfo.flags & DOMFLAGS_BLOCKED);
  28.166 -        info->running  = !!(op.u.getdomaininfo.flags & DOMFLAGS_RUNNING);
  28.167 +        info->dying    = !!(domctl.u.getdomaininfo.flags & DOMFLAGS_DYING);
  28.168 +        info->shutdown = !!(domctl.u.getdomaininfo.flags & DOMFLAGS_SHUTDOWN);
  28.169 +        info->paused   = !!(domctl.u.getdomaininfo.flags & DOMFLAGS_PAUSED);
  28.170 +        info->blocked  = !!(domctl.u.getdomaininfo.flags & DOMFLAGS_BLOCKED);
  28.171 +        info->running  = !!(domctl.u.getdomaininfo.flags & DOMFLAGS_RUNNING);
  28.172  
  28.173          info->shutdown_reason =
  28.174 -            (op.u.getdomaininfo.flags>>DOMFLAGS_SHUTDOWNSHIFT) &
  28.175 +            (domctl.u.getdomaininfo.flags>>DOMFLAGS_SHUTDOWNSHIFT) &
  28.176              DOMFLAGS_SHUTDOWNMASK;
  28.177  
  28.178          if ( info->shutdown && (info->shutdown_reason == SHUTDOWN_crash) )
  28.179 @@ -137,18 +185,18 @@ int xc_domain_getinfo(int xc_handle,
  28.180              info->crashed  = 1;
  28.181          }
  28.182  
  28.183 -        info->ssidref  = op.u.getdomaininfo.ssidref;
  28.184 -        info->nr_pages = op.u.getdomaininfo.tot_pages;
  28.185 -        info->max_memkb = op.u.getdomaininfo.max_pages << (PAGE_SHIFT - 10);
  28.186 -        info->shared_info_frame = op.u.getdomaininfo.shared_info_frame;
  28.187 -        info->cpu_time = op.u.getdomaininfo.cpu_time;
  28.188 -        info->nr_online_vcpus = op.u.getdomaininfo.nr_online_vcpus;
  28.189 -        info->max_vcpu_id = op.u.getdomaininfo.max_vcpu_id;
  28.190 +        info->ssidref  = domctl.u.getdomaininfo.ssidref;
  28.191 +        info->nr_pages = domctl.u.getdomaininfo.tot_pages;
  28.192 +        info->max_memkb = domctl.u.getdomaininfo.max_pages << (PAGE_SHIFT-10);
  28.193 +        info->shared_info_frame = domctl.u.getdomaininfo.shared_info_frame;
  28.194 +        info->cpu_time = domctl.u.getdomaininfo.cpu_time;
  28.195 +        info->nr_online_vcpus = domctl.u.getdomaininfo.nr_online_vcpus;
  28.196 +        info->max_vcpu_id = domctl.u.getdomaininfo.max_vcpu_id;
  28.197  
  28.198 -        memcpy(info->handle, op.u.getdomaininfo.handle,
  28.199 +        memcpy(info->handle, domctl.u.getdomaininfo.handle,
  28.200                 sizeof(xen_domain_handle_t));
  28.201  
  28.202 -        next_domid = (uint16_t)op.u.getdomaininfo.domain + 1;
  28.203 +        next_domid = (uint16_t)domctl.domain + 1;
  28.204          info++;
  28.205      }
  28.206  
  28.207 @@ -163,20 +211,20 @@ int xc_domain_getinfolist(int xc_handle,
  28.208                            xc_domaininfo_t *info)
  28.209  {
  28.210      int ret = 0;
  28.211 -    DECLARE_DOM0_OP;
  28.212 +    DECLARE_SYSCTL;
  28.213  
  28.214      if ( mlock(info, max_domains*sizeof(xc_domaininfo_t)) != 0 )
  28.215          return -1;
  28.216  
  28.217 -    op.cmd = DOM0_GETDOMAININFOLIST;
  28.218 -    op.u.getdomaininfolist.first_domain = first_domain;
  28.219 -    op.u.getdomaininfolist.max_domains  = max_domains;
  28.220 -    set_xen_guest_handle(op.u.getdomaininfolist.buffer, info);
  28.221 +    sysctl.cmd = XEN_SYSCTL_getdomaininfolist;
  28.222 +    sysctl.u.getdomaininfolist.first_domain = first_domain;
  28.223 +    sysctl.u.getdomaininfolist.max_domains  = max_domains;
  28.224 +    set_xen_guest_handle(sysctl.u.getdomaininfolist.buffer, info);
  28.225  
  28.226 -    if ( xc_dom0_op(xc_handle, &op) < 0 )
  28.227 +    if ( xc_sysctl(xc_handle, &sysctl) < 0 )
  28.228          ret = -1;
  28.229      else
  28.230 -        ret = op.u.getdomaininfolist.num_domains;
  28.231 +        ret = sysctl.u.getdomaininfolist.num_domains;
  28.232  
  28.233      if ( munlock(info, max_domains*sizeof(xc_domaininfo_t)) != 0 )
  28.234          ret = -1;
  28.235 @@ -190,17 +238,17 @@ int xc_vcpu_getcontext(int xc_handle,
  28.236                                 vcpu_guest_context_t *ctxt)
  28.237  {
  28.238      int rc;
  28.239 -    DECLARE_DOM0_OP;
  28.240 +    DECLARE_DOMCTL;
  28.241  
  28.242 -    op.cmd = DOM0_GETVCPUCONTEXT;
  28.243 -    op.u.getvcpucontext.domain = (domid_t)domid;
  28.244 -    op.u.getvcpucontext.vcpu   = (uint16_t)vcpu;
  28.245 -    set_xen_guest_handle(op.u.getvcpucontext.ctxt, ctxt);
  28.246 +    domctl.cmd = XEN_DOMCTL_getvcpucontext;
  28.247 +    domctl.domain = (domid_t)domid;
  28.248 +    domctl.u.vcpucontext.vcpu   = (uint16_t)vcpu;
  28.249 +    set_xen_guest_handle(domctl.u.vcpucontext.ctxt, ctxt);
  28.250  
  28.251      if ( (rc = mlock(ctxt, sizeof(*ctxt))) != 0 )
  28.252          return rc;
  28.253  
  28.254 -    rc = do_dom0_op(xc_handle, &op);
  28.255 +    rc = do_domctl(xc_handle, &domctl);
  28.256  
  28.257      safe_munlock(ctxt, sizeof(*ctxt));
  28.258  
  28.259 @@ -215,28 +263,28 @@ int xc_shadow_control(int xc_handle,
  28.260                        unsigned long pages,
  28.261                        unsigned long *mb,
  28.262                        uint32_t mode,
  28.263 -                      xc_shadow_control_stats_t *stats)
  28.264 +                      xc_shadow_op_stats_t *stats)
  28.265  {
  28.266      int rc;
  28.267 -    DECLARE_DOM0_OP;
  28.268 -    op.cmd = DOM0_SHADOW_CONTROL;
  28.269 -    op.u.shadow_control.domain = (domid_t)domid;
  28.270 -    op.u.shadow_control.op     = sop;
  28.271 -    op.u.shadow_control.pages  = pages;
  28.272 -    op.u.shadow_control.mb     = mb ? *mb : 0;
  28.273 -    op.u.shadow_control.mode   = mode;
  28.274 -    set_xen_guest_handle(op.u.shadow_control.dirty_bitmap, dirty_bitmap);
  28.275 +    DECLARE_DOMCTL;
  28.276 +    domctl.cmd = XEN_DOMCTL_shadow_op;
  28.277 +    domctl.domain = (domid_t)domid;
  28.278 +    domctl.u.shadow_op.op     = sop;
  28.279 +    domctl.u.shadow_op.pages  = pages;
  28.280 +    domctl.u.shadow_op.mb     = mb ? *mb : 0;
  28.281 +    domctl.u.shadow_op.mode   = mode;
  28.282 +    set_xen_guest_handle(domctl.u.shadow_op.dirty_bitmap, dirty_bitmap);
  28.283  
  28.284 -    rc = do_dom0_op(xc_handle, &op);
  28.285 +    rc = do_domctl(xc_handle, &domctl);
  28.286  
  28.287      if ( stats )
  28.288 -        memcpy(stats, &op.u.shadow_control.stats,
  28.289 -               sizeof(xc_shadow_control_stats_t));
  28.290 +        memcpy(stats, &domctl.u.shadow_op.stats,
  28.291 +               sizeof(xc_shadow_op_stats_t));
  28.292      
  28.293      if ( mb ) 
  28.294 -        *mb = op.u.shadow_control.mb;
  28.295 +        *mb = domctl.u.shadow_op.mb;
  28.296  
  28.297 -    return (rc == 0) ? op.u.shadow_control.pages : rc;
  28.298 +    return (rc == 0) ? domctl.u.shadow_op.pages : rc;
  28.299  }
  28.300  
  28.301  int xc_domain_setcpuweight(int xc_handle,
  28.302 @@ -250,58 +298,30 @@ int xc_domain_setcpuweight(int xc_handle
  28.303      if ( (ret = xc_sched_id(xc_handle, &sched_id)) != 0 )
  28.304          return ret;
  28.305  
  28.306 -    switch ( sched_id )
  28.307 -    {
  28.308 -        case SCHED_BVT:
  28.309 -        {
  28.310 -            uint32_t mcuadv;
  28.311 -            int warpback;
  28.312 -            int32_t warpvalue;
  28.313 -            long long warpl;
  28.314 -            long long warpu;
  28.315 -
  28.316 -            /* Preserve all the scheduling parameters apart
  28.317 -               of MCU advance. */
  28.318 -            if ( (ret = xc_bvtsched_domain_get(
  28.319 -                xc_handle, domid, &mcuadv,
  28.320 -                &warpback, &warpvalue, &warpl, &warpu)) != 0 )
  28.321 -                return ret;
  28.322 -
  28.323 -            /* The MCU advance is inverse of the weight.
  28.324 -               Default value of the weight is 1, default mcuadv 10.
  28.325 -               The scaling factor is therefore 10. */
  28.326 -            if ( weight > 0 )
  28.327 -                mcuadv = 10 / weight;
  28.328 -
  28.329 -            ret = xc_bvtsched_domain_set(xc_handle, domid, mcuadv,
  28.330 -                                         warpback, warpvalue, warpl, warpu);
  28.331 -            break;
  28.332 -        }
  28.333 -    }
  28.334 -
  28.335 -    return ret;
  28.336 +    /* No-op. */
  28.337 +    return 0;
  28.338  }
  28.339  
  28.340  int xc_domain_setmaxmem(int xc_handle,
  28.341                          uint32_t domid,
  28.342                          unsigned int max_memkb)
  28.343  {
  28.344 -    DECLARE_DOM0_OP;
  28.345 -    op.cmd = DOM0_SETDOMAINMAXMEM;
  28.346 -    op.u.setdomainmaxmem.domain = (domid_t)domid;
  28.347 -    op.u.setdomainmaxmem.max_memkb = max_memkb;
  28.348 -    return do_dom0_op(xc_handle, &op);
  28.349 +    DECLARE_DOMCTL;
  28.350 +    domctl.cmd = XEN_DOMCTL_max_mem;
  28.351 +    domctl.domain = (domid_t)domid;
  28.352 +    domctl.u.max_mem.max_memkb = max_memkb;
  28.353 +    return do_domctl(xc_handle, &domctl);
  28.354  }
  28.355  
  28.356  int xc_domain_set_time_offset(int xc_handle,
  28.357                                uint32_t domid,
  28.358                                int32_t time_offset_seconds)
  28.359  {
  28.360 -    DECLARE_DOM0_OP;
  28.361 -    op.cmd = DOM0_SETTIMEOFFSET;
  28.362 -    op.u.settimeoffset.domain = (domid_t)domid;
  28.363 -    op.u.settimeoffset.time_offset_seconds = time_offset_seconds;
  28.364 -    return do_dom0_op(xc_handle, &op);
  28.365 +    DECLARE_DOMCTL;
  28.366 +    domctl.cmd = XEN_DOMCTL_settimeoffset;
  28.367 +    domctl.domain = (domid_t)domid;
  28.368 +    domctl.u.settimeoffset.time_offset_seconds = time_offset_seconds;
  28.369 +    return do_domctl(xc_handle, &domctl);
  28.370  }
  28.371  
  28.372  int xc_domain_memory_increase_reservation(int xc_handle,
  28.373 @@ -425,21 +445,22 @@ int xc_domain_translate_gpfn_list(int xc
  28.374  
  28.375  int xc_domain_max_vcpus(int xc_handle, uint32_t domid, unsigned int max)
  28.376  {
  28.377 -    DECLARE_DOM0_OP;
  28.378 -    op.cmd = DOM0_MAX_VCPUS;
  28.379 -    op.u.max_vcpus.domain = (domid_t)domid;
  28.380 -    op.u.max_vcpus.max    = max;
  28.381 -    return do_dom0_op(xc_handle, &op);
  28.382 +    DECLARE_DOMCTL;
  28.383 +    domctl.cmd = XEN_DOMCTL_max_vcpus;
  28.384 +    domctl.domain = (domid_t)domid;
  28.385 +    domctl.u.max_vcpus.max    = max;
  28.386 +    return do_domctl(xc_handle, &domctl);
  28.387  }
  28.388  
  28.389  int xc_domain_sethandle(int xc_handle, uint32_t domid,
  28.390                          xen_domain_handle_t handle)
  28.391  {
  28.392 -    DECLARE_DOM0_OP;
  28.393 -    op.cmd = DOM0_SETDOMAINHANDLE;
  28.394 -    op.u.setdomainhandle.domain = (domid_t)domid;
  28.395 -    memcpy(op.u.setdomainhandle.handle, handle, sizeof(xen_domain_handle_t));
  28.396 -    return do_dom0_op(xc_handle, &op);
  28.397 +    DECLARE_DOMCTL;
  28.398 +    domctl.cmd = XEN_DOMCTL_setdomainhandle;
  28.399 +    domctl.domain = (domid_t)domid;
  28.400 +    memcpy(domctl.u.setdomainhandle.handle, handle,
  28.401 +           sizeof(xen_domain_handle_t));
  28.402 +    return do_domctl(xc_handle, &domctl);
  28.403  }
  28.404  
  28.405  int xc_vcpu_getinfo(int xc_handle,
  28.406 @@ -448,14 +469,15 @@ int xc_vcpu_getinfo(int xc_handle,
  28.407                      xc_vcpuinfo_t *info)
  28.408  {
  28.409      int rc;
  28.410 -    DECLARE_DOM0_OP;
  28.411 -    op.cmd = DOM0_GETVCPUINFO;
  28.412 -    op.u.getvcpuinfo.domain = (domid_t)domid;
  28.413 -    op.u.getvcpuinfo.vcpu   = (uint16_t)vcpu;
  28.414 +    DECLARE_DOMCTL;
  28.415  
  28.416 -    rc = do_dom0_op(xc_handle, &op);
  28.417 +    domctl.cmd = XEN_DOMCTL_getvcpuinfo;
  28.418 +    domctl.domain = (domid_t)domid;
  28.419 +    domctl.u.getvcpuinfo.vcpu   = (uint16_t)vcpu;
  28.420  
  28.421 -    memcpy(info, &op.u.getvcpuinfo, sizeof(*info));
  28.422 +    rc = do_domctl(xc_handle, &domctl);
  28.423 +
  28.424 +    memcpy(info, &domctl.u.getvcpuinfo, sizeof(*info));
  28.425  
  28.426      return rc;
  28.427  }
  28.428 @@ -466,15 +488,15 @@ int xc_domain_ioport_permission(int xc_h
  28.429                                  uint32_t nr_ports,
  28.430                                  uint32_t allow_access)
  28.431  {
  28.432 -    DECLARE_DOM0_OP;
  28.433 +    DECLARE_DOMCTL;
  28.434  
  28.435 -    op.cmd = DOM0_IOPORT_PERMISSION;
  28.436 -    op.u.ioport_permission.domain = (domid_t)domid;
  28.437 -    op.u.ioport_permission.first_port = first_port;
  28.438 -    op.u.ioport_permission.nr_ports = nr_ports;
  28.439 -    op.u.ioport_permission.allow_access = allow_access;
  28.440 +    domctl.cmd = XEN_DOMCTL_ioport_permission;
  28.441 +    domctl.domain = (domid_t)domid;
  28.442 +    domctl.u.ioport_permission.first_port = first_port;
  28.443 +    domctl.u.ioport_permission.nr_ports = nr_ports;
  28.444 +    domctl.u.ioport_permission.allow_access = allow_access;
  28.445  
  28.446 -    return do_dom0_op(xc_handle, &op);
  28.447 +    return do_domctl(xc_handle, &domctl);
  28.448  }
  28.449  
  28.450  int xc_vcpu_setcontext(int xc_handle,
  28.451 @@ -482,18 +504,18 @@ int xc_vcpu_setcontext(int xc_handle,
  28.452                         uint32_t vcpu,
  28.453                         vcpu_guest_context_t *ctxt)
  28.454  {
  28.455 -    dom0_op_t op;
  28.456 +    DECLARE_DOMCTL;
  28.457      int rc;
  28.458  
  28.459 -    op.cmd = DOM0_SETVCPUCONTEXT;
  28.460 -    op.u.setvcpucontext.domain = domid;
  28.461 -    op.u.setvcpucontext.vcpu = vcpu;
  28.462 -    set_xen_guest_handle(op.u.setvcpucontext.ctxt, ctxt);
  28.463 +    domctl.cmd = XEN_DOMCTL_setvcpucontext;
  28.464 +    domctl.domain = domid;
  28.465 +    domctl.u.vcpucontext.vcpu = vcpu;
  28.466 +    set_xen_guest_handle(domctl.u.vcpucontext.ctxt, ctxt);
  28.467  
  28.468      if ( (rc = mlock(ctxt, sizeof(*ctxt))) != 0 )
  28.469          return rc;
  28.470  
  28.471 -    rc = do_dom0_op(xc_handle, &op);
  28.472 +    rc = do_domctl(xc_handle, &domctl);
  28.473  
  28.474      safe_munlock(ctxt, sizeof(*ctxt));
  28.475  
  28.476 @@ -506,14 +528,14 @@ int xc_domain_irq_permission(int xc_hand
  28.477                               uint8_t pirq,
  28.478                               uint8_t allow_access)
  28.479  {
  28.480 -    dom0_op_t op;
  28.481 +    DECLARE_DOMCTL;
  28.482  
  28.483 -    op.cmd = DOM0_IRQ_PERMISSION;
  28.484 -    op.u.irq_permission.domain = domid;
  28.485 -    op.u.irq_permission.pirq = pirq;
  28.486 -    op.u.irq_permission.allow_access = allow_access;
  28.487 +    domctl.cmd = XEN_DOMCTL_irq_permission;
  28.488 +    domctl.domain = domid;
  28.489 +    domctl.u.irq_permission.pirq = pirq;
  28.490 +    domctl.u.irq_permission.allow_access = allow_access;
  28.491  
  28.492 -    return do_dom0_op(xc_handle, &op);
  28.493 +    return do_domctl(xc_handle, &domctl);
  28.494  }
  28.495  
  28.496  int xc_domain_iomem_permission(int xc_handle,
  28.497 @@ -522,15 +544,15 @@ int xc_domain_iomem_permission(int xc_ha
  28.498                                 unsigned long nr_mfns,
  28.499                                 uint8_t allow_access)
  28.500  {
  28.501 -    dom0_op_t op;
  28.502 +    DECLARE_DOMCTL;
  28.503  
  28.504 -    op.cmd = DOM0_IOMEM_PERMISSION;
  28.505 -    op.u.iomem_permission.domain = domid;
  28.506 -    op.u.iomem_permission.first_mfn = first_mfn;
  28.507 -    op.u.iomem_permission.nr_mfns = nr_mfns;
  28.508 -    op.u.iomem_permission.allow_access = allow_access;
  28.509 +    domctl.cmd = XEN_DOMCTL_iomem_permission;
  28.510 +    domctl.domain = domid;
  28.511 +    domctl.u.iomem_permission.first_mfn = first_mfn;
  28.512 +    domctl.u.iomem_permission.nr_mfns = nr_mfns;
  28.513 +    domctl.u.iomem_permission.allow_access = allow_access;
  28.514  
  28.515 -    return do_dom0_op(xc_handle, &op);
  28.516 +    return do_domctl(xc_handle, &domctl);
  28.517  }
  28.518  
  28.519  /*
    29.1 --- a/tools/libxc/xc_hvm_build.c	Fri Aug 25 16:21:39 2006 -0600
    29.2 +++ b/tools/libxc/xc_hvm_build.c	Sun Aug 27 10:24:41 2006 -0600
    29.3 @@ -395,7 +395,7 @@ static int xc_hvm_build_internal(int xc_
    29.4                                   unsigned int store_evtchn,
    29.5                                   unsigned long *store_mfn)
    29.6  {
    29.7 -    dom0_op_t launch_op, op;
    29.8 +    struct xen_domctl launch_domctl, domctl;
    29.9      int rc, i;
   29.10      vcpu_guest_context_t st_ctxt, *ctxt = &st_ctxt;
   29.11      unsigned long nr_pages;
   29.12 @@ -432,21 +432,21 @@ static int xc_hvm_build_internal(int xc_
   29.13          return 1;
   29.14      }
   29.15  
   29.16 -    op.cmd = DOM0_GETDOMAININFO;
   29.17 -    op.u.getdomaininfo.domain = (domid_t)domid;
   29.18 -    if ( (xc_dom0_op(xc_handle, &op) < 0) ||
   29.19 -         ((uint16_t)op.u.getdomaininfo.domain != domid) )
   29.20 +    domctl.cmd = XEN_DOMCTL_getdomaininfo;
   29.21 +    domctl.domain = (domid_t)domid;
   29.22 +    if ( (xc_domctl(xc_handle, &domctl) < 0) ||
   29.23 +         ((uint16_t)domctl.domain != domid) )
   29.24      {
   29.25          PERROR("Could not get info on domain");
   29.26          goto error_out;
   29.27      }
   29.28  
   29.29      /* HVM domains must be put into shadow2 mode at the start of day */
   29.30 -    if ( xc_shadow_control(xc_handle, domid, DOM0_SHADOW_CONTROL_OP_ENABLE,
   29.31 +    if ( xc_shadow_control(xc_handle, domid, XEN_DOMCTL_SHADOW_OP_ENABLE,
   29.32                             NULL, 0, NULL, 
   29.33 -                           DOM0_SHADOW_ENABLE_REFCOUNT  |
   29.34 -                           DOM0_SHADOW_ENABLE_TRANSLATE |
   29.35 -                           DOM0_SHADOW_ENABLE_EXTERNAL, 
   29.36 +                           XEN_DOMCTL_SHADOW_ENABLE_REFCOUNT  |
   29.37 +                           XEN_DOMCTL_SHADOW_ENABLE_TRANSLATE |
   29.38 +                           XEN_DOMCTL_SHADOW_ENABLE_EXTERNAL, 
   29.39                             NULL) )
   29.40      {
   29.41          PERROR("Could not enable shadow paging for domain.\n");
   29.42 @@ -457,7 +457,7 @@ static int xc_hvm_build_internal(int xc_
   29.43  
   29.44      ctxt->flags = VGCF_HVM_GUEST;
   29.45      if ( setup_guest(xc_handle, domid, memsize, image, image_size, nr_pages,
   29.46 -                     ctxt, op.u.getdomaininfo.shared_info_frame,
   29.47 +                     ctxt, domctl.u.getdomaininfo.shared_info_frame,
   29.48                       vcpus, pae, acpi, apic, store_evtchn, store_mfn) < 0)
   29.49      {
   29.50          ERROR("Error constructing guest OS");
   29.51 @@ -495,14 +495,14 @@ static int xc_hvm_build_internal(int xc_
   29.52      ctxt->syscall_callback_eip  = 0;
   29.53  #endif
   29.54  
   29.55 -    memset( &launch_op, 0, sizeof(launch_op) );
   29.56 +    memset(&launch_domctl, 0, sizeof(launch_domctl));
   29.57  
   29.58 -    launch_op.u.setvcpucontext.domain = (domid_t)domid;
   29.59 -    launch_op.u.setvcpucontext.vcpu   = 0;
   29.60 -    set_xen_guest_handle(launch_op.u.setvcpucontext.ctxt, ctxt);
   29.61 +    launch_domctl.domain = (domid_t)domid;
   29.62 +    launch_domctl.u.vcpucontext.vcpu   = 0;
   29.63 +    set_xen_guest_handle(launch_domctl.u.vcpucontext.ctxt, ctxt);
   29.64  
   29.65 -    launch_op.cmd = DOM0_SETVCPUCONTEXT;
   29.66 -    rc = xc_dom0_op(xc_handle, &launch_op);
   29.67 +    launch_domctl.cmd = XEN_DOMCTL_setvcpucontext;
   29.68 +    rc = xc_domctl(xc_handle, &launch_domctl);
   29.69  
   29.70      return rc;
   29.71  
    30.1 --- a/tools/libxc/xc_linux_build.c	Fri Aug 25 16:21:39 2006 -0600
    30.2 +++ b/tools/libxc/xc_linux_build.c	Sun Aug 27 10:24:41 2006 -0600
    30.3 @@ -474,7 +474,7 @@ static int setup_guest(int xc_handle,
    30.4      struct xen_ia64_boot_param *bp;
    30.5      shared_info_t *shared_info;
    30.6      int i;
    30.7 -    DECLARE_DOM0_OP;
    30.8 +    DECLARE_DOMCTL;
    30.9      int rc;
   30.10  
   30.11      rc = probeimageformat(image, image_size, &load_funcs);
   30.12 @@ -494,14 +494,13 @@ static int setup_guest(int xc_handle,
   30.13      start_info_mpa = (nr_pages - 3) << PAGE_SHIFT;
   30.14  
   30.15      /* Build firmware.  */
   30.16 -    memset(&op.u.domain_setup, 0, sizeof(op.u.domain_setup));
   30.17 -    op.u.domain_setup.flags = 0;
   30.18 -    op.u.domain_setup.domain = (domid_t)dom;
   30.19 -    op.u.domain_setup.bp = start_info_mpa + sizeof (start_info_t);
   30.20 -    op.u.domain_setup.maxmem = (nr_pages - 3) << PAGE_SHIFT;
   30.21 -    
   30.22 -    op.cmd = DOM0_DOMAIN_SETUP;
   30.23 -    if ( xc_dom0_op(xc_handle, &op) )
   30.24 +    memset(&domctl.u.arch_setup, 0, sizeof(domctl.u.arch_setup));
   30.25 +    domctl.u.arch_setup.flags = 0;
   30.26 +    domctl.u.arch_setup.bp = start_info_mpa + sizeof (start_info_t);
   30.27 +    domctl.u.arch_setup.maxmem = (nr_pages - 3) << PAGE_SHIFT;
   30.28 +    domctl.cmd = XEN_DOMCTL_arch_setup;
   30.29 +    domctl.domain = (domid_t)dom;
   30.30 +    if ( xc_domctl(xc_handle, &domctl) )
   30.31          goto error_out;
   30.32  
   30.33      start_page = dsi.v_start >> PAGE_SHIFT;
   30.34 @@ -655,12 +654,14 @@ static int setup_guest(int xc_handle,
   30.35                         uint32_t required_features[XENFEAT_NR_SUBMAPS])
   30.36  {
   30.37      xen_pfn_t *page_array = NULL;
   30.38 -    unsigned long count, i, hypercall_pfn;
   30.39 +    unsigned long count, i;
   30.40 +    unsigned long long hypercall_page;
   30.41 +    int hypercall_page_defined;
   30.42      start_info_t *start_info;
   30.43      shared_info_t *shared_info;
   30.44      xc_mmu_t *mmu = NULL;
   30.45 -    char *p;
   30.46 -    DECLARE_DOM0_OP;
   30.47 +    const char *p;
   30.48 +    DECLARE_DOMCTL;
   30.49      int rc;
   30.50  
   30.51      unsigned long nr_pt_pages;
   30.52 @@ -704,12 +705,9 @@ static int setup_guest(int xc_handle,
   30.53          goto error_out;
   30.54  
   30.55      /* Parse and validate kernel features. */
   30.56 -    p = strstr(dsi.xen_guest_string, "FEATURES=");
   30.57 -    if ( p != NULL )
   30.58 +    if ( (p = xen_elfnote_string(&dsi, XEN_ELFNOTE_FEATURES)) != NULL )
   30.59      {
   30.60 -        if ( !parse_features(p + strlen("FEATURES="),
   30.61 -                             supported_features,
   30.62 -                             required_features) )
   30.63 +        if ( !parse_features(p, supported_features, required_features) )
   30.64          {
   30.65              ERROR("Failed to parse guest kernel features.");
   30.66              goto error_out;
   30.67 @@ -967,7 +965,7 @@ static int setup_guest(int xc_handle,
   30.68  
   30.69          /* Enable shadow translate mode */
   30.70          if ( xc_shadow_control(xc_handle, dom,
   30.71 -                               DOM0_SHADOW_CONTROL_OP_ENABLE_TRANSLATE,
   30.72 +                               XEN_DOMCTL_SHADOW_OP_ENABLE_TRANSLATE,
   30.73                                 NULL, 0, NULL, 0, NULL) < 0 )
   30.74          {
   30.75              PERROR("Could not enable translation mode");
   30.76 @@ -1071,18 +1069,18 @@ static int setup_guest(int xc_handle,
   30.77      if ( xc_finish_mmu_updates(xc_handle, mmu) )
   30.78          goto error_out;
   30.79  
   30.80 -    p = strstr(dsi.xen_guest_string, "HYPERCALL_PAGE=");
   30.81 -    if ( p != NULL )
   30.82 +    hypercall_page = xen_elfnote_numeric(&dsi, XEN_ELFNOTE_HYPERCALL_PAGE,
   30.83 +                                         &hypercall_page_defined);
   30.84 +    if ( hypercall_page_defined )
   30.85      {
   30.86 -        p += strlen("HYPERCALL_PAGE=");
   30.87 -        hypercall_pfn = strtoul(p, NULL, 16);
   30.88 -        if ( hypercall_pfn >= nr_pages )
   30.89 +        unsigned long long pfn = (hypercall_page - dsi.v_start) >> PAGE_SHIFT;
   30.90 +        if ( pfn >= nr_pages )
   30.91              goto error_out;
   30.92 -        op.u.hypercall_init.domain = (domid_t)dom;
   30.93 -        op.u.hypercall_init.gmfn   = shadow_mode_enabled ?
   30.94 -            hypercall_pfn : page_array[hypercall_pfn];
   30.95 -        op.cmd = DOM0_HYPERCALL_INIT;
   30.96 -        if ( xc_dom0_op(xc_handle, &op) )
   30.97 +        domctl.domain = (domid_t)dom;
   30.98 +        domctl.u.hypercall_init.gmfn   = shadow_mode_enabled ?
   30.99 +            pfn : page_array[pfn];
  30.100 +        domctl.cmd = XEN_DOMCTL_hypercall_init;
  30.101 +        if ( xc_domctl(xc_handle, &domctl) )
  30.102              goto error_out;
  30.103      }
  30.104  
  30.105 @@ -1115,8 +1113,8 @@ static int xc_linux_build_internal(int x
  30.106                                     unsigned int console_evtchn,
  30.107                                     unsigned long *console_mfn)
  30.108  {
  30.109 -    dom0_op_t launch_op;
  30.110 -    DECLARE_DOM0_OP;
  30.111 +    struct xen_domctl launch_domctl;
  30.112 +    DECLARE_DOMCTL;
  30.113      int rc, i;
  30.114      vcpu_guest_context_t st_ctxt, *ctxt = &st_ctxt;
  30.115      unsigned long nr_pages;
  30.116 @@ -1148,10 +1146,10 @@ static int xc_linux_build_internal(int x
  30.117          return 1;
  30.118      }
  30.119  
  30.120 -    op.cmd = DOM0_GETDOMAININFO;
  30.121 -    op.u.getdomaininfo.domain = (domid_t)domid;
  30.122 -    if ( (xc_dom0_op(xc_handle, &op) < 0) ||
  30.123 -         ((uint16_t)op.u.getdomaininfo.domain != domid) )
  30.124 +    domctl.cmd = XEN_DOMCTL_getdomaininfo;
  30.125 +    domctl.domain = (domid_t)domid;
  30.126 +    if ( (xc_domctl(xc_handle, &domctl) < 0) ||
  30.127 +         ((uint16_t)domctl.domain != domid) )
  30.128      {
  30.129          PERROR("Could not get info on domain");
  30.130          goto error_out;
  30.131 @@ -1164,7 +1162,7 @@ static int xc_linux_build_internal(int x
  30.132                       nr_pages,
  30.133                       &vstartinfo_start, &vkern_entry,
  30.134                       &vstack_start, ctxt, cmdline,
  30.135 -                     op.u.getdomaininfo.shared_info_frame,
  30.136 +                     domctl.u.getdomaininfo.shared_info_frame,
  30.137                       flags, store_evtchn, store_mfn,
  30.138                       console_evtchn, console_mfn,
  30.139                       features_bitmap) < 0 )
  30.140 @@ -1240,14 +1238,14 @@ static int xc_linux_build_internal(int x
  30.141  #endif
  30.142  #endif /* x86 */
  30.143  
  30.144 -    memset( &launch_op, 0, sizeof(launch_op) );
  30.145 +    memset( &launch_domctl, 0, sizeof(launch_domctl) );
  30.146  
  30.147 -    launch_op.u.setvcpucontext.domain = (domid_t)domid;
  30.148 -    launch_op.u.setvcpucontext.vcpu   = 0;
  30.149 -    set_xen_guest_handle(launch_op.u.setvcpucontext.ctxt, ctxt);
  30.150 +    launch_domctl.domain = (domid_t)domid;
  30.151 +    launch_domctl.u.vcpucontext.vcpu   = 0;
  30.152 +    set_xen_guest_handle(launch_domctl.u.vcpucontext.ctxt, ctxt);
  30.153  
  30.154 -    launch_op.cmd = DOM0_SETVCPUCONTEXT;
  30.155 -    rc = xc_dom0_op(xc_handle, &launch_op);
  30.156 +    launch_domctl.cmd = XEN_DOMCTL_setvcpucontext;
  30.157 +    rc = xc_domctl(xc_handle, &launch_domctl);
  30.158  
  30.159      return rc;
  30.160  
    31.1 --- a/tools/libxc/xc_linux_restore.c	Fri Aug 25 16:21:39 2006 -0600
    31.2 +++ b/tools/libxc/xc_linux_restore.c	Sun Aug 27 10:24:41 2006 -0600
    31.3 @@ -107,7 +107,7 @@ int xc_linux_restore(int xc_handle, int 
    31.4                       unsigned int store_evtchn, unsigned long *store_mfn,
    31.5                       unsigned int console_evtchn, unsigned long *console_mfn)
    31.6  {
    31.7 -    DECLARE_DOM0_OP;
    31.8 +    DECLARE_DOMCTL;
    31.9      int rc = 1, i, n, pae_extended_cr3 = 0;
   31.10      unsigned long mfn, pfn;
   31.11      unsigned int prev_pc, this_pc;
   31.12 @@ -163,7 +163,7 @@ int xc_linux_restore(int xc_handle, int 
   31.13      }
   31.14  
   31.15      if (mlock(&ctxt, sizeof(ctxt))) {
   31.16 -        /* needed for build dom0 op, but might as well do early */
   31.17 +        /* needed for build domctl, but might as well do early */
   31.18          ERR("Unable to mlock ctxt");
   31.19          return 1;
   31.20      }
   31.21 @@ -257,13 +257,13 @@ int xc_linux_restore(int xc_handle, int 
   31.22      }
   31.23  
   31.24      /* Get the domain's shared-info frame. */
   31.25 -    op.cmd = DOM0_GETDOMAININFO;
   31.26 -    op.u.getdomaininfo.domain = (domid_t)dom;
   31.27 -    if (xc_dom0_op(xc_handle, &op) < 0) {
   31.28 +    domctl.cmd = XEN_DOMCTL_getdomaininfo;
   31.29 +    domctl.domain = (domid_t)dom;
   31.30 +    if (xc_domctl(xc_handle, &domctl) < 0) {
   31.31          ERR("Could not get information on new domain");
   31.32          goto out;
   31.33      }
   31.34 -    shared_info_frame = op.u.getdomaininfo.shared_info_frame;
   31.35 +    shared_info_frame = domctl.u.getdomaininfo.shared_info_frame;
   31.36  
   31.37      if(xc_domain_setmaxmem(xc_handle, dom, PFN_TO_KB(max_pfn)) != 0) {
   31.38          errno = ENOMEM;
   31.39 @@ -337,17 +337,22 @@ int xc_linux_restore(int xc_handle, int 
   31.40              goto out;
   31.41          }
   31.42  
   31.43 -        for (i = 0; i < j; i++) {
   31.44 +        for ( i = 0; i < j; i++ )
   31.45 +        {
   31.46 +            unsigned long pfn, pagetype;
   31.47 +            pfn      = region_pfn_type[i] & ~XEN_DOMCTL_PFINFO_LTAB_MASK;
   31.48 +            pagetype = region_pfn_type[i] &  XEN_DOMCTL_PFINFO_LTAB_MASK;
   31.49  
   31.50 -            if ((region_pfn_type[i] & LTAB_MASK) == XTAB)
   31.51 +            if ( pagetype == XEN_DOMCTL_PFINFO_XTAB)
   31.52                  region_mfn[i] = 0; /* we know map will fail, but don't care */
   31.53              else
   31.54 -                region_mfn[i] = p2m[region_pfn_type[i] & ~LTAB_MASK];
   31.55 -
   31.56 +                region_mfn[i] = p2m[pfn];
   31.57          }
   31.58  
   31.59 -        if (!(region_base = xc_map_foreign_batch(
   31.60 -                  xc_handle, dom, PROT_WRITE, region_mfn, j))) {
   31.61 +        region_base = xc_map_foreign_batch(
   31.62 +            xc_handle, dom, PROT_WRITE, region_mfn, j);
   31.63 +        if ( region_base == NULL )
   31.64 +        {
   31.65              ERR("map batch failed");
   31.66              goto out;
   31.67          }
   31.68 @@ -357,14 +362,15 @@ int xc_linux_restore(int xc_handle, int 
   31.69              void *page;
   31.70              unsigned long pagetype;
   31.71  
   31.72 -            pfn      = region_pfn_type[i] & ~LTAB_MASK;
   31.73 -            pagetype = region_pfn_type[i] & LTAB_MASK;
   31.74 +            pfn      = region_pfn_type[i] & ~XEN_DOMCTL_PFINFO_LTAB_MASK;
   31.75 +            pagetype = region_pfn_type[i] &  XEN_DOMCTL_PFINFO_LTAB_MASK;
   31.76  
   31.77 -            if (pagetype == XTAB)
   31.78 +            if ( pagetype == XEN_DOMCTL_PFINFO_XTAB )
   31.79                  /* a bogus/unmapped page: skip it */
   31.80                  continue;
   31.81  
   31.82 -            if (pfn > max_pfn) {
   31.83 +            if ( pfn > max_pfn )
   31.84 +            {
   31.85                  ERR("pfn out of range");
   31.86                  goto out;
   31.87              }
   31.88 @@ -381,10 +387,11 @@ int xc_linux_restore(int xc_handle, int 
   31.89                  goto out;
   31.90              }
   31.91  
   31.92 -            pagetype &= LTABTYPE_MASK;
   31.93 +            pagetype &= XEN_DOMCTL_PFINFO_LTABTYPE_MASK;
   31.94  
   31.95 -            if(pagetype >= L1TAB && pagetype <= L4TAB) {
   31.96 -
   31.97 +            if ( (pagetype >= XEN_DOMCTL_PFINFO_L1TAB) && 
   31.98 +                 (pagetype <= XEN_DOMCTL_PFINFO_L4TAB) )
   31.99 +            {
  31.100                  /*
  31.101                  ** A page table page - need to 'uncanonicalize' it, i.e.
  31.102                  ** replace all the references to pfns with the corresponding
  31.103 @@ -396,7 +403,7 @@ int xc_linux_restore(int xc_handle, int 
  31.104                  */
  31.105                  if ((pt_levels != 3) ||
  31.106                      pae_extended_cr3 ||
  31.107 -                    (pagetype != L1TAB)) {
  31.108 +                    (pagetype != XEN_DOMCTL_PFINFO_L1TAB)) {
  31.109  
  31.110                      if (!uncanonicalize_pagetable(pagetype, page)) {
  31.111                          /*
  31.112 @@ -412,8 +419,9 @@ int xc_linux_restore(int xc_handle, int 
  31.113  
  31.114                  }
  31.115  
  31.116 -            } else if(pagetype != NOTAB) {
  31.117 -
  31.118 +            }
  31.119 +            else if ( pagetype != XEN_DOMCTL_PFINFO_NOTAB )
  31.120 +            {
  31.121                  ERR("Bogus page type %lx page table is out of range: "
  31.122                      "i=%d max_pfn=%lu", pagetype, i, max_pfn);
  31.123                  goto out;
  31.124 @@ -484,10 +492,12 @@ int xc_linux_restore(int xc_handle, int 
  31.125          int j, k;
  31.126  
  31.127          /* First pass: find all L3TABs current in > 4G mfns and get new mfns */
  31.128 -        for (i = 0; i < max_pfn; i++) {
  31.129 -
  31.130 -            if (((pfn_type[i] & LTABTYPE_MASK)==L3TAB) && (p2m[i]>0xfffffUL)) {
  31.131 -
  31.132 +        for ( i = 0; i < max_pfn; i++ )
  31.133 +        {
  31.134 +            if ( ((pfn_type[i] & XEN_DOMCTL_PFINFO_LTABTYPE_MASK) ==
  31.135 +                  XEN_DOMCTL_PFINFO_L3TAB) &&
  31.136 +                 (p2m[i] > 0xfffffUL) )
  31.137 +            {
  31.138                  unsigned long new_mfn;
  31.139                  uint64_t l3ptes[4];
  31.140                  uint64_t *l3tab;
  31.141 @@ -530,9 +540,11 @@ int xc_linux_restore(int xc_handle, int 
  31.142          /* Second pass: find all L1TABs and uncanonicalize them */
  31.143          j = 0;
  31.144  
  31.145 -        for(i = 0; i < max_pfn; i++) {
  31.146 -
  31.147 -            if (((pfn_type[i] & LTABTYPE_MASK)==L1TAB)) {
  31.148 +        for ( i = 0; i < max_pfn; i++ )
  31.149 +        {
  31.150 +            if ( ((pfn_type[i] & XEN_DOMCTL_PFINFO_LTABTYPE_MASK) ==
  31.151 +                  XEN_DOMCTL_PFINFO_L1TAB) )
  31.152 +            {
  31.153                  region_mfn[j] = p2m[i];
  31.154                  j++;
  31.155              }
  31.156 @@ -547,7 +559,7 @@ int xc_linux_restore(int xc_handle, int 
  31.157                  }
  31.158  
  31.159                  for(k = 0; k < j; k++) {
  31.160 -                    if(!uncanonicalize_pagetable(L1TAB,
  31.161 +                    if(!uncanonicalize_pagetable(XEN_DOMCTL_PFINFO_L1TAB,
  31.162                                                   region_base + k*PAGE_SIZE)) {
  31.163                          ERR("failed uncanonicalize pt!");
  31.164                          goto out;
  31.165 @@ -570,26 +582,26 @@ int xc_linux_restore(int xc_handle, int 
  31.166       * will barf when doing the type-checking.
  31.167       */
  31.168      nr_pins = 0;
  31.169 -    for (i = 0; i < max_pfn; i++) {
  31.170 -
  31.171 -        if ( (pfn_type[i] & LPINTAB) == 0 )
  31.172 +    for ( i = 0; i < max_pfn; i++ )
  31.173 +    {
  31.174 +        if ( (pfn_type[i] & XEN_DOMCTL_PFINFO_LPINTAB) == 0 )
  31.175              continue;
  31.176  
  31.177 -        switch (pfn_type[i]) {
  31.178 -
  31.179 -        case (L1TAB|LPINTAB):
  31.180 +        switch ( pfn_type[i] & XEN_DOMCTL_PFINFO_LTABTYPE_MASK )
  31.181 +        {
  31.182 +        case XEN_DOMCTL_PFINFO_L1TAB:
  31.183              pin[nr_pins].cmd = MMUEXT_PIN_L1_TABLE;
  31.184              break;
  31.185  
  31.186 -        case (L2TAB|LPINTAB):
  31.187 +        case XEN_DOMCTL_PFINFO_L2TAB:
  31.188              pin[nr_pins].cmd = MMUEXT_PIN_L2_TABLE;
  31.189              break;
  31.190  
  31.191 -        case (L3TAB|LPINTAB):
  31.192 +        case XEN_DOMCTL_PFINFO_L3TAB:
  31.193              pin[nr_pins].cmd = MMUEXT_PIN_L3_TABLE;
  31.194              break;
  31.195  
  31.196 -        case (L4TAB|LPINTAB):
  31.197 +        case XEN_DOMCTL_PFINFO_L4TAB:
  31.198              pin[nr_pins].cmd = MMUEXT_PIN_L4_TABLE;
  31.199              break;
  31.200  
  31.201 @@ -678,7 +690,7 @@ int xc_linux_restore(int xc_handle, int 
  31.202  
  31.203      /* Uncanonicalise the suspend-record frame number and poke resume rec. */
  31.204      pfn = ctxt.user_regs.edx;
  31.205 -    if ((pfn >= max_pfn) || (pfn_type[pfn] != NOTAB)) {
  31.206 +    if ((pfn >= max_pfn) || (pfn_type[pfn] != XEN_DOMCTL_PFINFO_NOTAB)) {
  31.207          ERR("Suspend record frame number is bad");
  31.208          goto out;
  31.209      }
  31.210 @@ -703,7 +715,7 @@ int xc_linux_restore(int xc_handle, int 
  31.211  
  31.212      for (i = 0; i < ctxt.gdt_ents; i += 512) {
  31.213          pfn = ctxt.gdt_frames[i];
  31.214 -        if ((pfn >= max_pfn) || (pfn_type[pfn] != NOTAB)) {
  31.215 +        if ((pfn >= max_pfn) || (pfn_type[pfn] != XEN_DOMCTL_PFINFO_NOTAB)) {
  31.216              ERR("GDT frame number is bad");
  31.217              goto out;
  31.218          }
  31.219 @@ -719,11 +731,11 @@ int xc_linux_restore(int xc_handle, int 
  31.220          goto out;
  31.221      }
  31.222  
  31.223 -    if ( (pfn_type[pfn] & LTABTYPE_MASK) !=
  31.224 -         ((unsigned long)pt_levels<<LTAB_SHIFT) ) {
  31.225 +    if ( (pfn_type[pfn] & XEN_DOMCTL_PFINFO_LTABTYPE_MASK) !=
  31.226 +         ((unsigned long)pt_levels<<XEN_DOMCTL_PFINFO_LTAB_SHIFT) ) {
  31.227          ERR("PT base is bad. pfn=%lu nr=%lu type=%08lx %08lx",
  31.228              pfn, max_pfn, pfn_type[pfn],
  31.229 -            (unsigned long)pt_levels<<LTAB_SHIFT);
  31.230 +            (unsigned long)pt_levels<<XEN_DOMCTL_PFINFO_LTAB_SHIFT);
  31.231          goto out;
  31.232      }
  31.233  
  31.234 @@ -744,7 +756,7 @@ int xc_linux_restore(int xc_handle, int 
  31.235      /* Uncanonicalise the pfn-to-mfn table frame-number list. */
  31.236      for (i = 0; i < P2M_FL_ENTRIES; i++) {
  31.237          pfn = p2m_frame_list[i];
  31.238 -        if ((pfn >= max_pfn) || (pfn_type[pfn] != NOTAB)) {
  31.239 +        if ((pfn >= max_pfn) || (pfn_type[pfn] != XEN_DOMCTL_PFINFO_NOTAB)) {
  31.240              ERR("PFN-to-MFN frame number is bad");
  31.241              goto out;
  31.242          }
  31.243 @@ -797,11 +809,11 @@ int xc_linux_restore(int xc_handle, int 
  31.244  
  31.245      DPRINTF("Domain ready to be built.\n");
  31.246  
  31.247 -    op.cmd = DOM0_SETVCPUCONTEXT;
  31.248 -    op.u.setvcpucontext.domain = (domid_t)dom;
  31.249 -    op.u.setvcpucontext.vcpu   = 0;
  31.250 -    set_xen_guest_handle(op.u.setvcpucontext.ctxt, &ctxt);
  31.251 -    rc = xc_dom0_op(xc_handle, &op);
  31.252 +    domctl.cmd = XEN_DOMCTL_setvcpucontext;
  31.253 +    domctl.domain = (domid_t)dom;
  31.254 +    domctl.u.vcpucontext.vcpu   = 0;
  31.255 +    set_xen_guest_handle(domctl.u.vcpucontext.ctxt, &ctxt);
  31.256 +    rc = xc_domctl(xc_handle, &domctl);
  31.257  
  31.258      if (rc != 0) {
  31.259          ERR("Couldn't build the domain");
    32.1 --- a/tools/libxc/xc_linux_save.c	Fri Aug 25 16:21:39 2006 -0600
    32.2 +++ b/tools/libxc/xc_linux_save.c	Sun Aug 27 10:24:41 2006 -0600
    32.3 @@ -271,7 +271,7 @@ static inline ssize_t write_exact(int fd
    32.4  
    32.5  
    32.6  static int print_stats(int xc_handle, uint32_t domid, int pages_sent,
    32.7 -                       xc_shadow_control_stats_t *stats, int print)
    32.8 +                       xc_shadow_op_stats_t *stats, int print)
    32.9  {
   32.10      static struct timeval wall_last;
   32.11      static long long      d0_cpu_last;
   32.12 @@ -329,7 +329,7 @@ static int analysis_phase(int xc_handle,
   32.13                            unsigned long *arr, int runs)
   32.14  {
   32.15      long long start, now;
   32.16 -    xc_shadow_control_stats_t stats;
   32.17 +    xc_shadow_op_stats_t stats;
   32.18      int j;
   32.19  
   32.20      start = llgettimeofday();
   32.21 @@ -337,13 +337,13 @@ static int analysis_phase(int xc_handle,
   32.22      for (j = 0; j < runs; j++) {
   32.23          int i;
   32.24  
   32.25 -        xc_shadow_control(xc_handle, domid, DOM0_SHADOW_CONTROL_OP_CLEAN,
   32.26 +        xc_shadow_control(xc_handle, domid, XEN_DOMCTL_SHADOW_OP_CLEAN,
   32.27                            arr, max_pfn, NULL, 0, NULL);
   32.28          DPRINTF("#Flush\n");
   32.29          for ( i = 0; i < 40; i++ ) {
   32.30              usleep(50000);
   32.31              now = llgettimeofday();
   32.32 -            xc_shadow_control(xc_handle, domid, DOM0_SHADOW_CONTROL_OP_PEEK,
   32.33 +            xc_shadow_control(xc_handle, domid, XEN_DOMCTL_SHADOW_OP_PEEK,
   32.34                                NULL, 0, NULL, 0, &stats);
   32.35  
   32.36              DPRINTF("now= %lld faults= %"PRId32" dirty= %"PRId32"\n",
   32.37 @@ -427,10 +427,10 @@ int canonicalize_pagetable(unsigned long
   32.38      */
   32.39      xen_start = xen_end = pte_last = PAGE_SIZE / ((pt_levels == 2)? 4 : 8);
   32.40  
   32.41 -    if (pt_levels == 2 && type == L2TAB)
   32.42 +    if (pt_levels == 2 && type == XEN_DOMCTL_PFINFO_L2TAB)
   32.43          xen_start = (hvirt_start >> L2_PAGETABLE_SHIFT);
   32.44  
   32.45 -    if (pt_levels == 3 && type == L3TAB)
   32.46 +    if (pt_levels == 3 && type == XEN_DOMCTL_PFINFO_L3TAB)
   32.47          xen_start = L3_PAGETABLE_ENTRIES_PAE;
   32.48  
   32.49      /*
   32.50 @@ -439,7 +439,7 @@ int canonicalize_pagetable(unsigned long
   32.51      ** Xen always ensures is present in that L2. Guests must ensure
   32.52      ** that this check will fail for other L2s.
   32.53      */
   32.54 -    if (pt_levels == 3 && type == L2TAB) {
   32.55 +    if (pt_levels == 3 && type == XEN_DOMCTL_PFINFO_L2TAB) {
   32.56  
   32.57  /* XXX index of the L2 entry in PAE mode which holds the guest LPT */
   32.58  #define PAE_GLPT_L2ENTRY (495)
   32.59 @@ -449,7 +449,7 @@ int canonicalize_pagetable(unsigned long
   32.60              xen_start = (hvirt_start >> L2_PAGETABLE_SHIFT_PAE) & 0x1ff;
   32.61      }
   32.62  
   32.63 -    if (pt_levels == 4 && type == L4TAB) {
   32.64 +    if (pt_levels == 4 && type == XEN_DOMCTL_PFINFO_L4TAB) {
   32.65          /*
   32.66          ** XXX SMH: should compute these from hvirt_start (which we have)
   32.67          ** and hvirt_end (which we don't)
   32.68 @@ -603,7 +603,7 @@ int xc_linux_save(int xc_handle, int io_
   32.69         - to fixup by sending at the end if not already resent; */
   32.70      unsigned long *to_send = NULL, *to_skip = NULL, *to_fix = NULL;
   32.71  
   32.72 -    xc_shadow_control_stats_t stats;
   32.73 +    xc_shadow_op_stats_t stats;
   32.74  
   32.75      unsigned long needed_to_fix = 0;
   32.76      unsigned long total_sent    = 0;
   32.77 @@ -724,7 +724,7 @@ int xc_linux_save(int xc_handle, int io_
   32.78      if (live) {
   32.79  
   32.80          if (xc_shadow_control(xc_handle, dom,
   32.81 -                              DOM0_SHADOW_CONTROL_OP_ENABLE_LOGDIRTY,
   32.82 +                              XEN_DOMCTL_SHADOW_OP_ENABLE_LOGDIRTY,
   32.83                                NULL, 0, NULL, 0, NULL) < 0) {
   32.84              ERR("Couldn't enable shadow mode");
   32.85              goto out;
   32.86 @@ -781,8 +781,8 @@ int xc_linux_save(int xc_handle, int io_
   32.87      analysis_phase(xc_handle, dom, max_pfn, to_skip, 0);
   32.88  
   32.89      /* We want zeroed memory so use calloc rather than malloc. */
   32.90 -    pfn_type  = calloc(MAX_BATCH_SIZE, sizeof(unsigned long));
   32.91 -    pfn_batch = calloc(MAX_BATCH_SIZE, sizeof(unsigned long));
   32.92 +    pfn_type  = calloc(MAX_BATCH_SIZE, sizeof(*pfn_type));
   32.93 +    pfn_batch = calloc(MAX_BATCH_SIZE, sizeof(*pfn_batch));
   32.94  
   32.95      if ((pfn_type == NULL) || (pfn_batch == NULL)) {
   32.96          ERR("failed to alloc memory for pfn_type and/or pfn_batch arrays");
   32.97 @@ -790,12 +790,11 @@ int xc_linux_save(int xc_handle, int io_
   32.98          goto out;
   32.99      }
  32.100  
  32.101 -    if (mlock(pfn_type, MAX_BATCH_SIZE * sizeof(unsigned long))) {
  32.102 +    if (mlock(pfn_type, MAX_BATCH_SIZE * sizeof(*pfn_type))) {
  32.103          ERR("Unable to mlock");
  32.104          goto out;
  32.105      }
  32.106  
  32.107 -
  32.108      /*
  32.109       * Quick belt and braces sanity check.
  32.110       */
  32.111 @@ -876,7 +875,7 @@ int xc_linux_save(int xc_handle, int io_
  32.112              /* slightly wasteful to peek the whole array evey time,
  32.113                 but this is fast enough for the moment. */
  32.114              if (!last_iter && xc_shadow_control(
  32.115 -                    xc_handle, dom, DOM0_SHADOW_CONTROL_OP_PEEK,
  32.116 +                    xc_handle, dom, XEN_DOMCTL_SHADOW_OP_PEEK,
  32.117                      to_skip, max_pfn, NULL, 0, NULL) != max_pfn) {
  32.118                  ERR("Error peeking shadow bitmap");
  32.119                  goto out;
  32.120 @@ -930,7 +929,7 @@ int xc_linux_save(int xc_handle, int io_
  32.121                  if(last_iter && test_bit(n, to_fix) && !test_bit(n, to_send)) {
  32.122                      needed_to_fix++;
  32.123                      DPRINTF("Fix! iter %d, pfn %x. mfn %lx\n",
  32.124 -                            iter,n,pfn_type[batch]);
  32.125 +                            iter, n, pfn_type[batch]);
  32.126                  }
  32.127  
  32.128                  clear_bit(n, to_fix);
  32.129 @@ -952,9 +951,12 @@ int xc_linux_save(int xc_handle, int io_
  32.130                  goto out;
  32.131              }
  32.132  
  32.133 -            for (j = 0; j < batch; j++) {
  32.134 +            for ( j = 0; j < batch; j++ )
  32.135 +            {
  32.136  
  32.137 -                if ((pfn_type[j] & LTAB_MASK) == XTAB) {
  32.138 +                if ( (pfn_type[j] & XEN_DOMCTL_PFINFO_LTAB_MASK) ==
  32.139 +                     XEN_DOMCTL_PFINFO_XTAB )
  32.140 +                {
  32.141                      DPRINTF("type fail: page %i mfn %08lx\n", j, pfn_type[j]);
  32.142                      continue;
  32.143                  }
  32.144 @@ -963,13 +965,16 @@ int xc_linux_save(int xc_handle, int io_
  32.145                      DPRINTF("%d pfn= %08lx mfn= %08lx [mfn]= %08lx"
  32.146                              " sum= %08lx\n",
  32.147                              iter,
  32.148 -                            (pfn_type[j] & LTAB_MASK) | pfn_batch[j],
  32.149 +                            (pfn_type[j] & XEN_DOMCTL_PFINFO_LTAB_MASK) |
  32.150 +                            pfn_batch[j],
  32.151                              pfn_type[j],
  32.152 -                            mfn_to_pfn(pfn_type[j]&(~LTAB_MASK)),
  32.153 +                            mfn_to_pfn(pfn_type[j] &
  32.154 +                                       ~XEN_DOMCTL_PFINFO_LTAB_MASK),
  32.155                              csum_page(region_base + (PAGE_SIZE*j)));
  32.156  
  32.157                  /* canonicalise mfn->pfn */
  32.158 -                pfn_type[j] = (pfn_type[j] & LTAB_MASK) | pfn_batch[j];
  32.159 +                pfn_type[j] = (pfn_type[j] & XEN_DOMCTL_PFINFO_LTAB_MASK) |
  32.160 +                    pfn_batch[j];
  32.161              }
  32.162  
  32.163              if(!write_exact(io_fd, &batch, sizeof(unsigned int))) {
  32.164 @@ -983,21 +988,23 @@ int xc_linux_save(int xc_handle, int io_
  32.165              }
  32.166  
  32.167              /* entering this loop, pfn_type is now in pfns (Not mfns) */
  32.168 -            for (j = 0; j < batch; j++) {
  32.169 +            for ( j = 0; j < batch; j++ )
  32.170 +            {
  32.171 +                unsigned long pfn, pagetype;
  32.172 +                void *spage = (char *)region_base + (PAGE_SIZE*j);
  32.173  
  32.174 -                unsigned long pfn      = pfn_type[j] & ~LTAB_MASK;
  32.175 -                unsigned long pagetype = pfn_type[j] & LTAB_MASK;
  32.176 -                void *spage            = (void *) region_base + (PAGE_SIZE*j);
  32.177 -
  32.178 +                pfn      = pfn_type[j] & ~XEN_DOMCTL_PFINFO_LTAB_MASK;
  32.179 +                pagetype = pfn_type[j] &  XEN_DOMCTL_PFINFO_LTAB_MASK;
  32.180  
  32.181                  /* write out pages in batch */
  32.182 -                if (pagetype == XTAB)
  32.183 +                if ( pagetype == XEN_DOMCTL_PFINFO_XTAB )
  32.184                      continue;
  32.185  
  32.186 -                pagetype &= LTABTYPE_MASK;
  32.187 +                pagetype &= XEN_DOMCTL_PFINFO_LTABTYPE_MASK;
  32.188  
  32.189 -                if (pagetype >= L1TAB && pagetype <= L4TAB) {
  32.190 -
  32.191 +                if ( (pagetype >= XEN_DOMCTL_PFINFO_L1TAB) &&
  32.192 +                     (pagetype <= XEN_DOMCTL_PFINFO_L4TAB) )
  32.193 +                {
  32.194                      /* We have a pagetable page: need to rewrite it. */
  32.195                      race = 
  32.196                          canonicalize_pagetable(pagetype, pfn, spage, page); 
  32.197 @@ -1083,7 +1090,7 @@ int xc_linux_save(int xc_handle, int io_
  32.198              }
  32.199  
  32.200              if (xc_shadow_control(xc_handle, dom, 
  32.201 -                                  DOM0_SHADOW_CONTROL_OP_CLEAN, to_send, 
  32.202 +                                  XEN_DOMCTL_SHADOW_OP_CLEAN, to_send, 
  32.203                                    max_pfn, NULL, 0, &stats) != max_pfn) {
  32.204                  ERR("Error flushing shadow PT");
  32.205                  goto out;
  32.206 @@ -1174,7 +1181,7 @@ int xc_linux_save(int xc_handle, int io_
  32.207  
  32.208      if (live) {
  32.209          if(xc_shadow_control(xc_handle, dom, 
  32.210 -                             DOM0_SHADOW_CONTROL_OP_OFF,
  32.211 +                             XEN_DOMCTL_SHADOW_OP_OFF,
  32.212                               NULL, 0, NULL, 0, NULL) < 0) {
  32.213              DPRINTF("Warning - couldn't disable shadow mode");
  32.214          }
    33.1 --- a/tools/libxc/xc_load_bin.c	Fri Aug 25 16:21:39 2006 -0600
    33.2 +++ b/tools/libxc/xc_load_bin.c	Sun Aug 27 10:24:41 2006 -0600
    33.3 @@ -227,7 +227,7 @@ static int parsebinimage(const char *ima
    33.4      dsi->v_kernstart = dsi->v_start;
    33.5      dsi->v_kernend = dsi->v_end;
    33.6      dsi->v_kernentry = image_info->entry_addr;
    33.7 -    dsi->xen_guest_string = "";
    33.8 +    dsi->__xen_guest_string = NULL;
    33.9  
   33.10      return 0;
   33.11  }
    34.1 --- a/tools/libxc/xc_load_elf.c	Fri Aug 25 16:21:39 2006 -0600
    34.2 +++ b/tools/libxc/xc_load_elf.c	Sun Aug 27 10:24:41 2006 -0600
    34.3 @@ -5,6 +5,7 @@
    34.4  #include "xg_private.h"
    34.5  #include "xc_elf.h"
    34.6  #include <stdlib.h>
    34.7 +#include <inttypes.h>
    34.8  
    34.9  #define round_pgup(_p)    (((_p)+(PAGE_SIZE-1))&PAGE_MASK)
   34.10  #define round_pgdown(_p)  ((_p)&PAGE_MASK)
   34.11 @@ -65,17 +66,187 @@ static inline int is_loadable_phdr(Elf_P
   34.12              ((phdr->p_flags & (PF_W|PF_X)) != 0));
   34.13  }
   34.14  
   34.15 +/*
   34.16 + * Fallback for kernels containing only the legacy __xen_guest string
   34.17 + * and no ELF notes.
   34.18 + */
   34.19 +static int is_xen_guest_section(Elf_Shdr *shdr, const char *shstrtab)
   34.20 +{
   34.21 +    return strcmp(&shstrtab[shdr->sh_name], "__xen_guest") == 0;
   34.22 +}
   34.23 +
   34.24 +static const char *xen_guest_lookup(struct domain_setup_info *dsi, int type)
   34.25 +{
   34.26 +    const char *xenguest_fallbacks[] = {
   34.27 +        [XEN_ELFNOTE_ENTRY] = "VIRT_ENTRY=",
   34.28 +        [XEN_ELFNOTE_HYPERCALL_PAGE] = "HYPERCALL_PAGE=",
   34.29 +        [XEN_ELFNOTE_VIRT_BASE] = "VIRT_BASE=",
   34.30 +        [XEN_ELFNOTE_PADDR_OFFSET] = "ELF_PADDR_OFFSET=",
   34.31 +        [XEN_ELFNOTE_XEN_VERSION] = "XEN_VER=",
   34.32 +        [XEN_ELFNOTE_GUEST_OS] = "GUEST_OS=",
   34.33 +        [XEN_ELFNOTE_GUEST_VERSION] = "GUEST_VER=",
   34.34 +        [XEN_ELFNOTE_LOADER] = "LOADER=",
   34.35 +        [XEN_ELFNOTE_PAE_MODE] = "PAE=",
   34.36 +        [XEN_ELFNOTE_FEATURES] = "FEATURES=",
   34.37 +        [XEN_ELFNOTE_BSD_SYMTAB] = "BSD_SYMTAB=",
   34.38 +    };
   34.39 +    const char *fallback;
   34.40 +    const char *p;
   34.41 +
   34.42 +    if ( !dsi->__xen_guest_string )
   34.43 +        return NULL;
   34.44 +
   34.45 +    if ( type > sizeof(xenguest_fallbacks) )
   34.46 +        return NULL;
   34.47 +
   34.48 +    if ( (fallback = xenguest_fallbacks[type]) == NULL )
   34.49 +        return NULL;
   34.50 +
   34.51 +    if ( (p = strstr(dsi->__xen_guest_string,fallback)) == NULL )
   34.52 +        return NULL;
   34.53 +
   34.54 +    return p + strlen(fallback);
   34.55 +}
   34.56 +
   34.57 +static const char *xen_guest_string(struct domain_setup_info *dsi, int type)
   34.58 +{
   34.59 +    const char *p = xen_guest_lookup(dsi, type);
   34.60 +
   34.61 +    /*
   34.62 +     * We special case this since the __xen_guest_section treats the
   34.63 +     * mere precense of the BSD_SYMTAB string as true or false.
   34.64 +     */
   34.65 +    if ( type == XEN_ELFNOTE_BSD_SYMTAB )
   34.66 +        return p ? "yes" : "no";
   34.67 +
   34.68 +    return p;
   34.69 +}
   34.70 +
   34.71 +static unsigned long long xen_guest_numeric(struct domain_setup_info *dsi,
   34.72 +                                                   int type, int *defined)
   34.73 +{
   34.74 +    const char *p = xen_guest_lookup(dsi, type);
   34.75 +    unsigned long long value;
   34.76 +
   34.77 +    if ( p == NULL )
   34.78 +        return 0;
   34.79 +
   34.80 +    errno = 0;
   34.81 +    value = strtoull(p, NULL, 0);
   34.82 +    if ( errno < 0 )
   34.83 +        return 0;
   34.84 +
   34.85 +    /* We special case this since __xen_guest_section contains a PFN
   34.86 +     * for this field not a virtual address.
   34.87 +     */
   34.88 +    if (type == XEN_ELFNOTE_HYPERCALL_PAGE)
   34.89 +        value = dsi->v_start + (value<<PAGE_SHIFT);
   34.90 +
   34.91 +    *defined = 1;
   34.92 +    return value;
   34.93 +}
   34.94 +
   34.95 +/*
   34.96 + * Interface to the Xen ELF notes.
   34.97 + */
   34.98 +#define ELFNOTE_NAME(_n_)   ((void*)(_n_) + sizeof(*(_n_)))
   34.99 +#define ELFNOTE_DESC(_n_)   (ELFNOTE_NAME(_n_) + (((_n_)->namesz+3)&~3))
  34.100 +#define ELFNOTE_NEXT(_n_)   (ELFNOTE_DESC(_n_) + (((_n_)->descsz+3)&~3))
  34.101 +
  34.102 +static int is_xen_elfnote_section(const char *image, Elf_Shdr *shdr)
  34.103 +{
  34.104 +    Elf_Note *note;
  34.105 +
  34.106 +    if ( shdr->sh_type != SHT_NOTE )
  34.107 +        return 0;
  34.108 +
  34.109 +    for ( note = (Elf_Note *)(image + shdr->sh_offset);
  34.110 +          note < (Elf_Note *)(image + shdr->sh_offset + shdr->sh_size);
  34.111 +          note = ELFNOTE_NEXT(note) )
  34.112 +    {
  34.113 +        if ( !strncmp(ELFNOTE_NAME(note), "Xen", 4) )
  34.114 +            return 1;
  34.115 +    }
  34.116 +
  34.117 +    return 0;
  34.118 +}
  34.119 +
  34.120 +static Elf_Note *xen_elfnote_lookup(struct domain_setup_info *dsi, int type)
  34.121 +{
  34.122 +    Elf_Note *note;
  34.123 +
  34.124 +    if ( !dsi->__elfnote_section )
  34.125 +        return NULL;
  34.126 +
  34.127 +    for ( note = (Elf_Note *)dsi->__elfnote_section;
  34.128 +          note < (Elf_Note *)dsi->__elfnote_section_end;
  34.129 +          note = ELFNOTE_NEXT(note) )
  34.130 +    {
  34.131 +        if ( strncmp(ELFNOTE_NAME(note), "Xen", 4) )
  34.132 +            continue;
  34.133 +
  34.134 +        if ( note->type == type )
  34.135 +            return note;
  34.136 +    }
  34.137 +
  34.138 +    return NULL;
  34.139 +}
  34.140 +
  34.141 +const char *xen_elfnote_string(struct domain_setup_info *dsi, int type)
  34.142 +{
  34.143 +    Elf_Note *note;
  34.144 +
  34.145 +    if ( !dsi->__elfnote_section )
  34.146 +        return xen_guest_string(dsi, type);
  34.147 +
  34.148 +    note = xen_elfnote_lookup(dsi, type);
  34.149 +    if ( note == NULL )
  34.150 +        return NULL;
  34.151 +
  34.152 +    return (const char *)ELFNOTE_DESC(note);
  34.153 +}
  34.154 +
  34.155 +unsigned long long xen_elfnote_numeric(struct domain_setup_info *dsi,
  34.156 +                                       int type, int *defined)
  34.157 +{
  34.158 +    Elf_Note *note;
  34.159 +
  34.160 +    *defined = 0;
  34.161 +
  34.162 +    if ( !dsi->__elfnote_section )
  34.163 +        return xen_guest_numeric(dsi, type, defined);
  34.164 +
  34.165 +    note = xen_elfnote_lookup(dsi, type);
  34.166 +    if ( note == NULL )
  34.167 +    {
  34.168 +        return 0;
  34.169 +    }
  34.170 +
  34.171 +    switch ( note->descsz )
  34.172 +    {
  34.173 +    case 4:
  34.174 +        *defined = 1;
  34.175 +        return *(uint32_t*)ELFNOTE_DESC(note);
  34.176 +    case 8:
  34.177 +        *defined = 1;
  34.178 +        return *(uint64_t*)ELFNOTE_DESC(note);
  34.179 +    default:
  34.180 +        ERROR("elfnotes: unknown data size %#x for numeric type note %#x\n",
  34.181 +              note->descsz, type);
  34.182 +        return 0;
  34.183 +    }
  34.184 +}
  34.185 +
  34.186  static int parseelfimage(const char *image,
  34.187 -                         unsigned long elfsize,
  34.188 +                         unsigned long image_len,
  34.189                           struct domain_setup_info *dsi)
  34.190  {
  34.191      Elf_Ehdr *ehdr = (Elf_Ehdr *)image;
  34.192      Elf_Phdr *phdr;
  34.193      Elf_Shdr *shdr;
  34.194 -    Elf_Addr kernstart = ~0, kernend = 0, vaddr, virt_base, elf_pa_off;
  34.195 -    const char *shstrtab;
  34.196 -    char *guestinfo=NULL, *p;
  34.197 -    int h, virt_base_defined, elf_pa_off_defined;
  34.198 +    Elf_Addr kernstart = ~0, kernend = 0, vaddr, virt_entry;
  34.199 +    const char *shstrtab, *p;
  34.200 +    int h, virt_base_defined, elf_pa_off_defined, virt_entry_defined;
  34.201  
  34.202      if ( !IS_ELF(*ehdr) )
  34.203      {
  34.204 @@ -92,13 +263,13 @@ static int parseelfimage(const char *ima
  34.205          return -EINVAL;
  34.206      }
  34.207  
  34.208 -    if ( (ehdr->e_phoff + (ehdr->e_phnum * ehdr->e_phentsize)) > elfsize )
  34.209 +    if ( (ehdr->e_phoff + (ehdr->e_phnum*ehdr->e_phentsize)) > image_len )
  34.210      {
  34.211          ERROR("ELF program headers extend beyond end of image.");
  34.212          return -EINVAL;
  34.213      }
  34.214  
  34.215 -    if ( (ehdr->e_shoff + (ehdr->e_shnum * ehdr->e_shentsize)) > elfsize )
  34.216 +    if ( (ehdr->e_shoff + (ehdr->e_shnum*ehdr->e_shentsize)) > image_len )
  34.217      {
  34.218          ERROR("ELF section headers extend beyond end of image.");
  34.219          return -EINVAL;
  34.220 @@ -114,69 +285,119 @@ static int parseelfimage(const char *ima
  34.221                          (ehdr->e_shstrndx*ehdr->e_shentsize));
  34.222      shstrtab = image + shdr->sh_offset;
  34.223  
  34.224 -    /* Find the special '__xen_guest' section and check its contents. */
  34.225 +    dsi->__elfnote_section = NULL;
  34.226 +    dsi->__xen_guest_string = NULL;
  34.227 +
  34.228 +    /* Look for .notes segment containing at least one Xen note */
  34.229      for ( h = 0; h < ehdr->e_shnum; h++ )
  34.230      {
  34.231          shdr = (Elf_Shdr *)(image + ehdr->e_shoff + (h*ehdr->e_shentsize));
  34.232 -        if ( strcmp(&shstrtab[shdr->sh_name], "__xen_guest") != 0 )
  34.233 +        if ( !is_xen_elfnote_section(image, shdr) )
  34.234              continue;
  34.235 +        dsi->__elfnote_section = (void *)image + shdr->sh_offset;
  34.236 +        dsi->__elfnote_section_end =
  34.237 +            (void *)image + shdr->sh_offset + shdr->sh_size;
  34.238 +        break;
  34.239 +    }
  34.240  
  34.241 -        guestinfo = (char *)image + shdr->sh_offset;
  34.242 +    /* Fall back to looking for the special '__xen_guest' section. */
  34.243 +    if ( dsi->__elfnote_section == NULL )
  34.244 +    {
  34.245 +        for ( h = 0; h < ehdr->e_shnum; h++ )
  34.246 +        {
  34.247 +            shdr = (Elf_Shdr *)(image + ehdr->e_shoff + (h*ehdr->e_shentsize));
  34.248 +            if ( is_xen_guest_section(shdr, shstrtab) )
  34.249 +            {
  34.250 +                dsi->__xen_guest_string = (char *)image + shdr->sh_offset;
  34.251 +                break;
  34.252 +            }
  34.253 +        }
  34.254 +    }
  34.255  
  34.256 -        if ( (strstr(guestinfo, "LOADER=generic") == NULL) &&
  34.257 -             (strstr(guestinfo, "GUEST_OS=linux") == NULL) )
  34.258 +    /* Check the contents of the Xen notes or guest string. */
  34.259 +    if ( dsi->__elfnote_section || dsi->__xen_guest_string )
  34.260 +    {
  34.261 +        const char *loader = xen_elfnote_string(dsi, XEN_ELFNOTE_LOADER);
  34.262 +        const char *guest_os = xen_elfnote_string(dsi, XEN_ELFNOTE_GUEST_OS);
  34.263 +        const char *xen_version =
  34.264 +            xen_elfnote_string(dsi, XEN_ELFNOTE_XEN_VERSION);
  34.265 +
  34.266 +        if ( ( loader == NULL || strncmp(loader, "generic", 7) ) &&
  34.267 +             ( guest_os == NULL || strncmp(guest_os, "linux", 5) ) )
  34.268          {
  34.269              ERROR("Will only load images built for the generic loader "
  34.270                    "or Linux images");
  34.271 -            ERROR("Actually saw: '%s'", guestinfo);
  34.272              return -EINVAL;
  34.273          }
  34.274  
  34.275 -        if ( (strstr(guestinfo, "XEN_VER=xen-3.0") == NULL) )
  34.276 +        if ( xen_version == NULL || strncmp(xen_version, "xen-3.0", 7) )
  34.277          {
  34.278              ERROR("Will only load images built for Xen v3.0");
  34.279 -            ERROR("Actually saw: '%s'", guestinfo);
  34.280              return -EINVAL;
  34.281          }
  34.282 -
  34.283 -        dsi->pae_kernel = PAEKERN_no;
  34.284 -        p = strstr(guestinfo, "PAE=yes");
  34.285 -        if ( p != NULL )
  34.286 -        {
  34.287 -            dsi->pae_kernel = PAEKERN_yes;
  34.288 -            if ( !strncmp(p+7, "[extended-cr3]", 14) )
  34.289 -                dsi->pae_kernel = PAEKERN_extended_cr3;
  34.290 -        }
  34.291 -
  34.292 -        break;
  34.293      }
  34.294 -
  34.295 -    if ( guestinfo == NULL )
  34.296 +    else
  34.297      {
  34.298 -#ifdef __ia64__
  34.299 -        guestinfo = "";
  34.300 -#else
  34.301 -        ERROR("Not a Xen-ELF image: '__xen_guest' section not found.");
  34.302 +#if defined(__x86_64__) || defined(__i386__)
  34.303 +        ERROR("Not a Xen-ELF image: "
  34.304 +              "No ELF notes or '__xen_guest' section found.");
  34.305          return -EINVAL;
  34.306  #endif
  34.307      }
  34.308  
  34.309 -    dsi->xen_guest_string = guestinfo;
  34.310 +    /*
  34.311 +     * If we have ELF notes then PAE=yes implies that we must support
  34.312 +     * the extended cr3 syntax. Otherwise we need to find the
  34.313 +     * [extended-cr3] syntax in the __xen_guest string.
  34.314 +     */
  34.315 +    dsi->pae_kernel = PAEKERN_no;
  34.316 +    if ( dsi->__elfnote_section )
  34.317 +    {
  34.318 +        p = xen_elfnote_string(dsi, XEN_ELFNOTE_PAE_MODE);
  34.319 +        if ( p != NULL && strncmp(p, "yes", 3) == 0 )
  34.320 +            dsi->pae_kernel = PAEKERN_extended_cr3;
  34.321  
  34.322 -    /* Initial guess for virt_base is 0 if it is not explicitly defined. */
  34.323 -    p = strstr(guestinfo, "VIRT_BASE=");
  34.324 -    virt_base_defined = (p != NULL);
  34.325 -    virt_base = virt_base_defined ? strtoull(p+10, &p, 0) : 0;
  34.326 +    }
  34.327 +    else
  34.328 +    {
  34.329 +        p = xen_guest_lookup(dsi, XEN_ELFNOTE_PAE_MODE);
  34.330 +        if ( p != NULL && strncmp(p, "yes", 3) == 0 )
  34.331 +        {
  34.332 +            dsi->pae_kernel = PAEKERN_yes;
  34.333 +            if ( !strncmp(p+4, "[extended-cr3]", 14) )
  34.334 +                dsi->pae_kernel = PAEKERN_extended_cr3;
  34.335 +        }
  34.336 +    }
  34.337  
  34.338 -    /* Initial guess for elf_pa_off is virt_base if not explicitly defined. */
  34.339 -    p = strstr(guestinfo, "ELF_PADDR_OFFSET=");
  34.340 -    elf_pa_off_defined = (p != NULL);
  34.341 -    elf_pa_off = elf_pa_off_defined ? strtoull(p+17, &p, 0) : virt_base;
  34.342 +    /* Initial guess for v_start is 0 if it is not explicitly defined. */
  34.343 +    dsi->v_start =
  34.344 +        xen_elfnote_numeric(dsi, XEN_ELFNOTE_VIRT_BASE, &virt_base_defined);
  34.345 +    if ( !virt_base_defined )
  34.346 +        dsi->v_start = 0;
  34.347 +
  34.348 +    /*
  34.349 +     * If we are using the legacy __xen_guest section then elf_pa_off
  34.350 +     * defaults to v_start in order to maintain compatibility with
  34.351 +     * older hypervisors which set padd in the ELF header to
  34.352 +     * virt_base.
  34.353 +     *
  34.354 +     * If we are using the modern ELF notes interface then the default
  34.355 +     * is 0.
  34.356 +     */
  34.357 +    dsi->elf_paddr_offset =
  34.358 +        xen_elfnote_numeric(dsi, XEN_ELFNOTE_PADDR_OFFSET, &elf_pa_off_defined);
  34.359 +    if ( !elf_pa_off_defined )
  34.360 +    {
  34.361 +        if ( dsi->__elfnote_section )
  34.362 +            dsi->elf_paddr_offset = 0;
  34.363 +        else
  34.364 +            dsi->elf_paddr_offset = dsi->v_start;
  34.365 +    }
  34.366  
  34.367      if ( elf_pa_off_defined && !virt_base_defined )
  34.368      {
  34.369 -        ERROR("Neither ELF_PADDR_OFFSET nor VIRT_BASE found in __xen_guest"
  34.370 -              " section.");
  34.371 +        ERROR("Neither ELF_PADDR_OFFSET nor VIRT_BASE found in ELF "
  34.372 +              " notes or __xen_guest section.");
  34.373          return -EINVAL;
  34.374      }
  34.375  
  34.376 @@ -185,7 +406,7 @@ static int parseelfimage(const char *ima
  34.377          phdr = (Elf_Phdr *)(image + ehdr->e_phoff + (h*ehdr->e_phentsize));
  34.378          if ( !is_loadable_phdr(phdr) )
  34.379              continue;
  34.380 -        vaddr = phdr->p_paddr - elf_pa_off + virt_base;
  34.381 +        vaddr = phdr->p_paddr - dsi->elf_paddr_offset + dsi->v_start;
  34.382          if ( (vaddr + phdr->p_memsz) < vaddr )
  34.383          {
  34.384              ERROR("ELF program header %d is too large.", h);
  34.385 @@ -198,17 +419,12 @@ static int parseelfimage(const char *ima
  34.386              kernend = vaddr + phdr->p_memsz;
  34.387      }
  34.388  
  34.389 -    /*
  34.390 -     * Legacy compatibility and images with no __xen_guest section: assume
  34.391 -     * header addresses are virtual addresses, and that guest memory should be
  34.392 -     * mapped starting at kernel load address.
  34.393 -     */
  34.394 -    dsi->v_start          = virt_base_defined  ? virt_base  : kernstart;
  34.395 -    dsi->elf_paddr_offset = elf_pa_off_defined ? elf_pa_off : dsi->v_start;
  34.396 +    dsi->v_kernentry = ehdr->e_entry;
  34.397  
  34.398 -    dsi->v_kernentry = ehdr->e_entry;
  34.399 -    if ( (p = strstr(guestinfo, "VIRT_ENTRY=")) != NULL )
  34.400 -        dsi->v_kernentry = strtoull(p+11, &p, 0);
  34.401 +    virt_entry =
  34.402 +        xen_elfnote_numeric(dsi, XEN_ELFNOTE_ENTRY, &virt_entry_defined);
  34.403 +    if ( virt_entry_defined )
  34.404 +        dsi->v_kernentry = virt_entry;
  34.405  
  34.406      if ( (kernstart > kernend) ||
  34.407           (dsi->v_kernentry < kernstart) ||
  34.408 @@ -219,7 +435,8 @@ static int parseelfimage(const char *ima
  34.409          return -EINVAL;
  34.410      }
  34.411  
  34.412 -    if ( (p = strstr(guestinfo, "BSD_SYMTAB")) != NULL )
  34.413 +    p = xen_elfnote_string(dsi, XEN_ELFNOTE_BSD_SYMTAB);
  34.414 +    if ( p != NULL && strncmp(p, "yes", 3) == 0 )
  34.415          dsi->load_symtab = 1;
  34.416  
  34.417      dsi->v_kernstart = kernstart;
    35.1 --- a/tools/libxc/xc_misc.c	Fri Aug 25 16:21:39 2006 -0600
    35.2 +++ b/tools/libxc/xc_misc.c	Sun Aug 27 10:24:41 2006 -0600
    35.3 @@ -12,20 +12,20 @@ int xc_readconsolering(int xc_handle,
    35.4                         int clear)
    35.5  {
    35.6      int ret;
    35.7 -    DECLARE_DOM0_OP;
    35.8 +    DECLARE_SYSCTL;
    35.9      char *buffer = *pbuffer;
   35.10      unsigned int nr_chars = *pnr_chars;
   35.11  
   35.12 -    op.cmd = DOM0_READCONSOLE;
   35.13 -    set_xen_guest_handle(op.u.readconsole.buffer, buffer);
   35.14 -    op.u.readconsole.count  = nr_chars;
   35.15 -    op.u.readconsole.clear  = clear;
   35.16 +    sysctl.cmd = XEN_SYSCTL_readconsole;
   35.17 +    set_xen_guest_handle(sysctl.u.readconsole.buffer, buffer);
   35.18 +    sysctl.u.readconsole.count  = nr_chars;
   35.19 +    sysctl.u.readconsole.clear  = clear;
   35.20  
   35.21      if ( (ret = mlock(buffer, nr_chars)) != 0 )
   35.22          return ret;
   35.23  
   35.24 -    if ( (ret = do_dom0_op(xc_handle, &op)) == 0 )
   35.25 -        *pnr_chars = op.u.readconsole.count;
   35.26 +    if ( (ret = do_sysctl(xc_handle, &sysctl)) == 0 )
   35.27 +        *pnr_chars = sysctl.u.readconsole.count;
   35.28  
   35.29      safe_munlock(buffer, nr_chars);
   35.30  
   35.31 @@ -36,15 +36,14 @@ int xc_physinfo(int xc_handle,
   35.32                  xc_physinfo_t *put_info)
   35.33  {
   35.34      int ret;
   35.35 -    DECLARE_DOM0_OP;
   35.36 +    DECLARE_SYSCTL;
   35.37  
   35.38 -    op.cmd = DOM0_PHYSINFO;
   35.39 -    op.interface_version = DOM0_INTERFACE_VERSION;
   35.40 +    sysctl.cmd = XEN_SYSCTL_physinfo;
   35.41  
   35.42 -    if ( (ret = do_dom0_op(xc_handle, &op)) != 0 )
   35.43 +    if ( (ret = do_sysctl(xc_handle, &sysctl)) != 0 )
   35.44          return ret;
   35.45  
   35.46 -    memcpy(put_info, &op.u.physinfo, sizeof(*put_info));
   35.47 +    memcpy(put_info, &sysctl.u.physinfo, sizeof(*put_info));
   35.48  
   35.49      return 0;
   35.50  }
   35.51 @@ -53,15 +52,14 @@ int xc_sched_id(int xc_handle,
   35.52                  int *sched_id)
   35.53  {
   35.54      int ret;
   35.55 -    DECLARE_DOM0_OP;
   35.56 +    DECLARE_SYSCTL;
   35.57  
   35.58 -    op.cmd = DOM0_SCHED_ID;
   35.59 -    op.interface_version = DOM0_INTERFACE_VERSION;
   35.60 +    sysctl.cmd = XEN_SYSCTL_sched_id;
   35.61  
   35.62 -    if ( (ret = do_dom0_op(xc_handle, &op)) != 0 )
   35.63 +    if ( (ret = do_sysctl(xc_handle, &sysctl)) != 0 )
   35.64          return ret;
   35.65  
   35.66 -    *sched_id = op.u.sched_id.sched_id;
   35.67 +    *sched_id = sysctl.u.sched_id.sched_id;
   35.68  
   35.69      return 0;
   35.70  }
   35.71 @@ -74,57 +72,23 @@ int xc_perfc_control(int xc_handle,
   35.72                       int *nbr_val)
   35.73  {
   35.74      int rc;
   35.75 -    DECLARE_DOM0_OP;
   35.76 +    DECLARE_SYSCTL;
   35.77  
   35.78 -    op.cmd = DOM0_PERFCCONTROL;
   35.79 -    op.u.perfccontrol.op   = opcode;
   35.80 -    set_xen_guest_handle(op.u.perfccontrol.desc, desc);
   35.81 -    set_xen_guest_handle(op.u.perfccontrol.val, val);
   35.82 +    sysctl.cmd = XEN_SYSCTL_perfc_op;
   35.83 +    sysctl.u.perfc_op.cmd = opcode;
   35.84 +    set_xen_guest_handle(sysctl.u.perfc_op.desc, desc);
   35.85 +    set_xen_guest_handle(sysctl.u.perfc_op.val, val);
   35.86  
   35.87 -    rc = do_dom0_op(xc_handle, &op);
   35.88 +    rc = do_sysctl(xc_handle, &sysctl);
   35.89  
   35.90      if (nbr_desc)
   35.91 -        *nbr_desc = op.u.perfccontrol.nr_counters;
   35.92 +        *nbr_desc = sysctl.u.perfc_op.nr_counters;
   35.93      if (nbr_val)
   35.94 -        *nbr_val = op.u.perfccontrol.nr_vals;
   35.95 +        *nbr_val = sysctl.u.perfc_op.nr_vals;
   35.96  
   35.97      return rc;
   35.98  }
   35.99  
  35.100 -long long xc_msr_read(int xc_handle, int cpu_mask, int msr)
  35.101 -{
  35.102 -    int rc;
  35.103 -    DECLARE_DOM0_OP;
  35.104 -
  35.105 -    op.cmd = DOM0_MSR;
  35.106 -    op.u.msr.write = 0;
  35.107 -    op.u.msr.msr = msr;
  35.108 -    op.u.msr.cpu_mask = cpu_mask;
  35.109 -
  35.110 -    rc = do_dom0_op(xc_handle, &op);
  35.111 -
  35.112 -    return (((unsigned long long)op.u.msr.out2)<<32) | op.u.msr.out1 ;
  35.113 -}
  35.114 -
  35.115 -int xc_msr_write(int xc_handle, int cpu_mask, int msr, unsigned int low,
  35.116 -                  unsigned int high)
  35.117 -{
  35.118 -    int rc;
  35.119 -    DECLARE_DOM0_OP;
  35.120 -
  35.121 -    op.cmd = DOM0_MSR;
  35.122 -    op.u.msr.write = 1;
  35.123 -    op.u.msr.msr = msr;
  35.124 -    op.u.msr.cpu_mask = cpu_mask;
  35.125 -    op.u.msr.in1 = low;
  35.126 -    op.u.msr.in2 = high;
  35.127 -
  35.128 -    rc = do_dom0_op(xc_handle, &op);
  35.129 -
  35.130 -    return rc;
  35.131 -}
  35.132 -
  35.133 -
  35.134  /*
  35.135   * Local variables:
  35.136   * mode: C
    36.1 --- a/tools/libxc/xc_private.c	Fri Aug 25 16:21:39 2006 -0600
    36.2 +++ b/tools/libxc/xc_private.c	Sun Aug 27 10:24:41 2006 -0600
    36.3 @@ -11,12 +11,12 @@
    36.4  int xc_get_pfn_type_batch(int xc_handle,
    36.5                            uint32_t dom, int num, unsigned long *arr)
    36.6  {
    36.7 -    DECLARE_DOM0_OP;
    36.8 -    op.cmd = DOM0_GETPAGEFRAMEINFO2;
    36.9 -    op.u.getpageframeinfo2.domain = (domid_t)dom;
   36.10 -    op.u.getpageframeinfo2.num    = num;
   36.11 -    set_xen_guest_handle(op.u.getpageframeinfo2.array, arr);
   36.12 -    return do_dom0_op(xc_handle, &op);
   36.13 +    DECLARE_DOMCTL;
   36.14 +    domctl.cmd = XEN_DOMCTL_getpageframeinfo2;
   36.15 +    domctl.domain = (domid_t)dom;
   36.16 +    domctl.u.getpageframeinfo2.num    = num;
   36.17 +    set_xen_guest_handle(domctl.u.getpageframeinfo2.array, arr);
   36.18 +    return do_domctl(xc_handle, &domctl);
   36.19  }
   36.20  
   36.21  #define GETPFN_ERR (~0U)
   36.22 @@ -24,16 +24,16 @@ unsigned int get_pfn_type(int xc_handle,
   36.23                            unsigned long mfn,
   36.24                            uint32_t dom)
   36.25  {
   36.26 -    DECLARE_DOM0_OP;
   36.27 -    op.cmd = DOM0_GETPAGEFRAMEINFO;
   36.28 -    op.u.getpageframeinfo.gmfn   = mfn;
   36.29 -    op.u.getpageframeinfo.domain = (domid_t)dom;
   36.30 -    if ( do_dom0_op(xc_handle, &op) < 0 )
   36.31 +    DECLARE_DOMCTL;
   36.32 +    domctl.cmd = XEN_DOMCTL_getpageframeinfo;
   36.33 +    domctl.u.getpageframeinfo.gmfn   = mfn;
   36.34 +    domctl.domain = (domid_t)dom;
   36.35 +    if ( do_domctl(xc_handle, &domctl) < 0 )
   36.36      {
   36.37          PERROR("Unexpected failure when getting page frame info!");
   36.38          return GETPFN_ERR;
   36.39      }
   36.40 -    return op.u.getpageframeinfo.type;
   36.41 +    return domctl.u.getpageframeinfo.type;
   36.42  }
   36.43  
   36.44  int xc_mmuext_op(
   36.45 @@ -248,17 +248,17 @@ int xc_memory_op(int xc_handle,
   36.46  
   36.47  long long xc_domain_get_cpu_usage( int xc_handle, domid_t domid, int vcpu )
   36.48  {
   36.49 -    DECLARE_DOM0_OP;
   36.50 +    DECLARE_DOMCTL;
   36.51  
   36.52 -    op.cmd = DOM0_GETVCPUINFO;
   36.53 -    op.u.getvcpuinfo.domain = (domid_t)domid;
   36.54 -    op.u.getvcpuinfo.vcpu   = (uint16_t)vcpu;
   36.55 -    if ( (do_dom0_op(xc_handle, &op) < 0) )
   36.56 +    domctl.cmd = XEN_DOMCTL_getvcpuinfo;
   36.57 +    domctl.domain = (domid_t)domid;
   36.58 +    domctl.u.getvcpuinfo.vcpu   = (uint16_t)vcpu;
   36.59 +    if ( (do_domctl(xc_handle, &domctl) < 0) )
   36.60      {
   36.61          PERROR("Could not get info on domain");
   36.62          return -1;
   36.63      }
   36.64 -    return op.u.getvcpuinfo.cpu_time;
   36.65 +    return domctl.u.getvcpuinfo.cpu_time;
   36.66  }
   36.67  
   36.68  
   36.69 @@ -268,12 +268,12 @@ int xc_get_pfn_list(int xc_handle,
   36.70                      xen_pfn_t *pfn_buf,
   36.71                      unsigned long max_pfns)
   36.72  {
   36.73 -    DECLARE_DOM0_OP;
   36.74 +    DECLARE_DOMCTL;
   36.75      int ret;
   36.76 -    op.cmd = DOM0_GETMEMLIST;
   36.77 -    op.u.getmemlist.domain   = (domid_t)domid;
   36.78 -    op.u.getmemlist.max_pfns = max_pfns;
   36.79 -    set_xen_guest_handle(op.u.getmemlist.buffer, pfn_buf);
   36.80 +    domctl.cmd = XEN_DOMCTL_getmemlist;
   36.81 +    domctl.domain   = (domid_t)domid;
   36.82 +    domctl.u.getmemlist.max_pfns = max_pfns;
   36.83 +    set_xen_guest_handle(domctl.u.getmemlist.buffer, pfn_buf);
   36.84  
   36.85  #ifdef VALGRIND
   36.86      memset(pfn_buf, 0, max_pfns * sizeof(xen_pfn_t));
   36.87 @@ -285,7 +285,7 @@ int xc_get_pfn_list(int xc_handle,
   36.88          return -1;
   36.89      }
   36.90  
   36.91 -    ret = do_dom0_op(xc_handle, &op);
   36.92 +    ret = do_domctl(xc_handle, &domctl);
   36.93  
   36.94      safe_munlock(pfn_buf, max_pfns * sizeof(xen_pfn_t));
   36.95  
   36.96 @@ -294,7 +294,7 @@ int xc_get_pfn_list(int xc_handle,
   36.97      DPRINTF(("Ret for xc_get_pfn_list is %d\n", ret));
   36.98      if (ret >= 0) {
   36.99          int i, j;
  36.100 -        for (i = 0; i < op.u.getmemlist.num_pfns; i += 16) {
  36.101 +        for (i = 0; i < domctl.u.getmemlist.num_pfns; i += 16) {
  36.102              DPRINTF("0x%x: ", i);
  36.103              for (j = 0; j < 16; j++)
  36.104                  DPRINTF("0x%lx ", pfn_buf[i + j]);
  36.105 @@ -304,17 +304,17 @@ int xc_get_pfn_list(int xc_handle,
  36.106  #endif
  36.107  #endif
  36.108  
  36.109 -    return (ret < 0) ? -1 : op.u.getmemlist.num_pfns;
  36.110 +    return (ret < 0) ? -1 : domctl.u.getmemlist.num_pfns;
  36.111  }
  36.112  #endif
  36.113  
  36.114  long xc_get_tot_pages(int xc_handle, uint32_t domid)
  36.115  {
  36.116 -    DECLARE_DOM0_OP;
  36.117 -    op.cmd = DOM0_GETDOMAININFO;
  36.118 -    op.u.getdomaininfo.domain = (domid_t)domid;
  36.119 -    return (do_dom0_op(xc_handle, &op) < 0) ?
  36.120 -        -1 : op.u.getdomaininfo.tot_pages;
  36.121 +    DECLARE_DOMCTL;
  36.122 +    domctl.cmd = XEN_DOMCTL_getdomaininfo;
  36.123 +    domctl.domain = (domid_t)domid;
  36.124 +    return (do_domctl(xc_handle, &domctl) < 0) ?
  36.125 +        -1 : domctl.u.getdomaininfo.tot_pages;
  36.126  }
  36.127  
  36.128  int xc_copy_to_domain_page(int xc_handle,
  36.129 @@ -386,9 +386,14 @@ void xc_map_memcpy(unsigned long dst, co
  36.130      }
  36.131  }
  36.132  
  36.133 -int xc_dom0_op(int xc_handle, dom0_op_t *op)
  36.134 +int xc_domctl(int xc_handle, struct xen_domctl *domctl)
  36.135  {
  36.136 -    return do_dom0_op(xc_handle, op);
  36.137 +    return do_domctl(xc_handle, domctl);
  36.138 +}
  36.139 +
  36.140 +int xc_sysctl(int xc_handle, struct xen_sysctl *sysctl)
  36.141 +{
  36.142 +    return do_sysctl(xc_handle, sysctl);
  36.143  }
  36.144  
  36.145  int xc_version(int xc_handle, int cmd, void *arg)
    37.1 --- a/tools/libxc/xc_private.h	Fri Aug 25 16:21:39 2006 -0600
    37.2 +++ b/tools/libxc/xc_private.h	Sun Aug 27 10:24:41 2006 -0600
    37.3 @@ -18,14 +18,16 @@
    37.4  #include <xen/sys/privcmd.h>
    37.5  
    37.6  /* valgrind cannot see when a hypercall has filled in some values.  For this
    37.7 -   reason, we must zero the privcmd_hypercall_t or dom0_op_t instance before a
    37.8 -   call, if using valgrind.  */
    37.9 +   reason, we must zero the privcmd_hypercall_t or domctl/sysctl instance
   37.10 +   before a call, if using valgrind.  */
   37.11  #ifdef VALGRIND
   37.12  #define DECLARE_HYPERCALL privcmd_hypercall_t hypercall = { 0 }
   37.13 -#define DECLARE_DOM0_OP dom0_op_t op = { 0 }
   37.14 +#define DECLARE_DOMCTL struct xen_domctl domctl = { 0 }
   37.15 +#define DECLARE_SYSCTL struct xen_sysctl sysctl = { 0 }
   37.16  #else
   37.17  #define DECLARE_HYPERCALL privcmd_hypercall_t hypercall
   37.18 -#define DECLARE_DOM0_OP dom0_op_t op
   37.19 +#define DECLARE_DOMCTL struct xen_domctl domctl
   37.20 +#define DECLARE_SYSCTL struct xen_sysctl sysctl
   37.21  #endif
   37.22  
   37.23  #define PAGE_SHIFT              XC_PAGE_SHIFT
   37.24 @@ -94,17 +96,17 @@ static inline int do_xen_version(int xc_
   37.25      return do_xen_hypercall(xc_handle, &hypercall);
   37.26  }
   37.27  
   37.28 -static inline int do_dom0_op(int xc_handle, dom0_op_t *op)
   37.29 +static inline int do_domctl(int xc_handle, struct xen_domctl *domctl)
   37.30  {
   37.31      int ret = -1;
   37.32      DECLARE_HYPERCALL;
   37.33  
   37.34 -    op->interface_version = DOM0_INTERFACE_VERSION;
   37.35 +    domctl->interface_version = XEN_DOMCTL_INTERFACE_VERSION;
   37.36  
   37.37 -    hypercall.op     = __HYPERVISOR_dom0_op;
   37.38 -    hypercall.arg[0] = (unsigned long)op;
   37.39 +    hypercall.op     = __HYPERVISOR_domctl;
   37.40 +    hypercall.arg[0] = (unsigned long)domctl;
   37.41  
   37.42 -    if ( mlock(op, sizeof(*op)) != 0 )
   37.43 +    if ( mlock(domctl, sizeof(*domctl)) != 0 )
   37.44      {
   37.45          PERROR("Could not lock memory for Xen hypercall");
   37.46          goto out1;
   37.47 @@ -113,11 +115,40 @@ static inline int do_dom0_op(int xc_hand
   37.48      if ( (ret = do_xen_hypercall(xc_handle, &hypercall)) < 0 )
   37.49      {
   37.50          if ( errno == EACCES )
   37.51 -            DPRINTF("Dom0 operation failed -- need to"
   37.52 +            DPRINTF("domctl operation failed -- need to"
   37.53                      " rebuild the user-space tool set?\n");
   37.54      }
   37.55  
   37.56 -    safe_munlock(op, sizeof(*op));
   37.57 +    safe_munlock(domctl, sizeof(*domctl));
   37.58 +
   37.59 + out1:
   37.60 +    return ret;
   37.61 +}
   37.62 +
   37.63 +static inline int do_sysctl(int xc_handle, struct xen_sysctl *sysctl)
   37.64 +{
   37.65 +    int ret = -1;
   37.66 +    DECLARE_HYPERCALL;
   37.67 +
   37.68 +    sysctl->interface_version = XEN_SYSCTL_INTERFACE_VERSION;
   37.69 +
   37.70 +    hypercall.op     = __HYPERVISOR_sysctl;
   37.71 +    hypercall.arg[0] = (unsigned long)sysctl;
   37.72 +
   37.73 +    if ( mlock(sysctl, sizeof(*sysctl)) != 0 )
   37.74 +    {
   37.75 +        PERROR("Could not lock memory for Xen hypercall");
   37.76 +        goto out1;
   37.77 +    }
   37.78 +
   37.79 +    if ( (ret = do_xen_hypercall(xc_handle, &hypercall)) < 0 )
   37.80 +    {
   37.81 +        if ( errno == EACCES )
   37.82 +            DPRINTF("sysctl operation failed -- need to"
   37.83 +                    " rebuild the user-space tool set?\n");
   37.84 +    }
   37.85 +
   37.86 +    safe_munlock(sysctl, sizeof(*sysctl));
   37.87  
   37.88   out1:
   37.89      return ret;
    38.1 --- a/tools/libxc/xc_ptrace.c	Fri Aug 25 16:21:39 2006 -0600
    38.2 +++ b/tools/libxc/xc_ptrace.c	Sun Aug 27 10:24:41 2006 -0600
    38.3 @@ -41,8 +41,8 @@ static char *ptrace_names[] = {
    38.4  static int                      current_domid = -1;
    38.5  static int                      current_isfile;
    38.6  
    38.7 -static cpumap_t                 online_cpumap;
    38.8 -static cpumap_t                 regs_valid;
    38.9 +static uint64_t                 online_cpumap;
   38.10 +static uint64_t                 regs_valid;
   38.11  static vcpu_guest_context_t     ctxt[MAX_VIRT_CPUS];
   38.12  
   38.13  extern int ffsll(long long int);
   38.14 @@ -111,7 +111,8 @@ paging_enabled(vcpu_guest_context_t *v)
   38.15   */
   38.16  
   38.17  static int
   38.18 -get_online_cpumap(int xc_handle, dom0_getdomaininfo_t *d, cpumap_t *cpumap)
   38.19 +get_online_cpumap(int xc_handle, struct xen_domctl_getdomaininfo *d,
   38.20 +                  uint64_t *cpumap)
   38.21  {
   38.22      int i, online, retval;
   38.23  
   38.24 @@ -133,9 +134,9 @@ get_online_cpumap(int xc_handle, dom0_ge
   38.25   */
   38.26  
   38.27  static void
   38.28 -online_vcpus_changed(cpumap_t cpumap)
   38.29 +online_vcpus_changed(uint64_t cpumap)
   38.30  {
   38.31 -    cpumap_t changed_cpumap = cpumap ^ online_cpumap;
   38.32 +    uint64_t changed_cpumap = cpumap ^ online_cpumap;
   38.33      int index;
   38.34  
   38.35      while ( (index = ffsll(changed_cpumap)) ) {
   38.36 @@ -418,25 +419,25 @@ static int
   38.37      int *status,
   38.38      int options)
   38.39  {
   38.40 -    DECLARE_DOM0_OP;
   38.41 +    DECLARE_DOMCTL;
   38.42      int retval;
   38.43      struct timespec ts;
   38.44 -    cpumap_t cpumap;
   38.45 +    uint64_t cpumap;
   38.46  
   38.47      ts.tv_sec = 0;
   38.48      ts.tv_nsec = 10*1000*1000;
   38.49  
   38.50 -    op.cmd = DOM0_GETDOMAININFO;
   38.51 -    op.u.getdomaininfo.domain = domain;
   38.52 +    domctl.cmd = XEN_DOMCTL_getdomaininfo;
   38.53 +    domctl.domain = domain;
   38.54  
   38.55   retry:
   38.56 -    retval = do_dom0_op(xc_handle, &op);
   38.57 -    if ( retval || (op.u.getdomaininfo.domain != domain) )
   38.58 +    retval = do_domctl(xc_handle, &domctl);
   38.59 +    if ( retval || (domctl.domain != domain) )
   38.60      {
   38.61          IPRINTF("getdomaininfo failed\n");
   38.62          goto done;
   38.63      }
   38.64 -    *status = op.u.getdomaininfo.flags;
   38.65 +    *status = domctl.u.getdomaininfo.flags;
   38.66  
   38.67      if ( options & WNOHANG )
   38.68          goto done;
   38.69 @@ -447,13 +448,13 @@ static int
   38.70          goto done;
   38.71      }
   38.72  
   38.73 -    if ( !(op.u.getdomaininfo.flags & DOMFLAGS_PAUSED) )
   38.74 +    if ( !(domctl.u.getdomaininfo.flags & DOMFLAGS_PAUSED) )
   38.75      {
   38.76          nanosleep(&ts,NULL);
   38.77          goto retry;
   38.78      }
   38.79   done:
   38.80 -    if (get_online_cpumap(xc_handle, &op.u.getdomaininfo, &cpumap))
   38.81 +    if (get_online_cpumap(xc_handle, &domctl.u.getdomaininfo, &cpumap))
   38.82          IPRINTF("get_online_cpumap failed\n");
   38.83      if (online_cpumap != cpumap)
   38.84          online_vcpus_changed(cpumap);
   38.85 @@ -470,11 +471,11 @@ xc_ptrace(
   38.86      long eaddr,
   38.87      long edata)
   38.88  {
   38.89 -    DECLARE_DOM0_OP;
   38.90 +    DECLARE_DOMCTL;
   38.91      struct gdb_regs pt;
   38.92      long            retval = 0;
   38.93      unsigned long  *guest_va;
   38.94 -    cpumap_t        cpumap;
   38.95 +    uint64_t        cpumap;
   38.96      int             cpu, index;
   38.97      void           *addr = (char *)eaddr;
   38.98      void           *data = (char *)edata;
   38.99 @@ -535,7 +536,7 @@ xc_ptrace(
  38.100          SET_XC_REGS(((struct gdb_regs *)data), ctxt[cpu].user_regs);
  38.101          if ((retval = xc_vcpu_setcontext(xc_handle, current_domid, cpu,
  38.102                                  &ctxt[cpu])))
  38.103 -            goto out_error_dom0;
  38.104 +            goto out_error_domctl;
  38.105          break;
  38.106  
  38.107      case PTRACE_SINGLESTEP:
  38.108 @@ -547,7 +548,7 @@ xc_ptrace(
  38.109          ctxt[cpu].user_regs.eflags |= PSL_T;
  38.110          if ((retval = xc_vcpu_setcontext(xc_handle, current_domid, cpu,
  38.111                                  &ctxt[cpu])))
  38.112 -            goto out_error_dom0;
  38.113 +            goto out_error_domctl;
  38.114          /* FALLTHROUGH */
  38.115  
  38.116      case PTRACE_CONT:
  38.117 @@ -566,22 +567,22 @@ xc_ptrace(
  38.118                      ctxt[cpu].user_regs.eflags &= ~PSL_T;
  38.119                      if ((retval = xc_vcpu_setcontext(xc_handle, current_domid,
  38.120                                                  cpu, &ctxt[cpu])))
  38.121 -                        goto out_error_dom0;
  38.122 +                        goto out_error_domctl;
  38.123                  }
  38.124              }
  38.125          }
  38.126          if ( request == PTRACE_DETACH )
  38.127          {
  38.128 -            op.cmd = DOM0_SETDEBUGGING;
  38.129 -            op.u.setdebugging.domain = current_domid;
  38.130 -            op.u.setdebugging.enable = 0;
  38.131 -            if ((retval = do_dom0_op(xc_handle, &op)))
  38.132 -                goto out_error_dom0;
  38.133 +            domctl.cmd = XEN_DOMCTL_setdebugging;
  38.134 +            domctl.domain = current_domid;
  38.135 +            domctl.u.setdebugging.enable = 0;
  38.136 +            if ((retval = do_domctl(xc_handle, &domctl)))
  38.137 +                goto out_error_domctl;
  38.138          }
  38.139          regs_valid = 0;
  38.140          if ((retval = xc_domain_unpause(xc_handle, current_domid > 0 ?
  38.141                                  current_domid : -current_domid)))
  38.142 -            goto out_error_dom0;
  38.143 +            goto out_error_domctl;
  38.144          break;
  38.145  
  38.146      case PTRACE_ATTACH:
  38.147 @@ -589,22 +590,22 @@ xc_ptrace(
  38.148          current_isfile = (int)edata;
  38.149          if (current_isfile)
  38.150              break;
  38.151 -        op.cmd = DOM0_GETDOMAININFO;
  38.152 -        op.u.getdomaininfo.domain = current_domid;
  38.153 -        retval = do_dom0_op(xc_handle, &op);
  38.154 -        if ( retval || (op.u.getdomaininfo.domain != current_domid) )
  38.155 -            goto out_error_dom0;
  38.156 -        if ( op.u.getdomaininfo.flags & DOMFLAGS_PAUSED )
  38.157 +        domctl.cmd = XEN_DOMCTL_getdomaininfo;
  38.158 +        domctl.domain = current_domid;
  38.159 +        retval = do_domctl(xc_handle, &domctl);
  38.160 +        if ( retval || (domctl.domain != current_domid) )
  38.161 +            goto out_error_domctl;
  38.162 +        if ( domctl.u.getdomaininfo.flags & DOMFLAGS_PAUSED )
  38.163              IPRINTF("domain currently paused\n");
  38.164          else if ((retval = xc_domain_pause(xc_handle, current_domid)))
  38.165 -            goto out_error_dom0;
  38.166 -        op.cmd = DOM0_SETDEBUGGING;
  38.167 -        op.u.setdebugging.domain = current_domid;
  38.168 -        op.u.setdebugging.enable = 1;
  38.169 -        if ((retval = do_dom0_op(xc_handle, &op)))
  38.170 -            goto out_error_dom0;
  38.171 +            goto out_error_domctl;
  38.172 +        domctl.cmd = XEN_DOMCTL_setdebugging;
  38.173 +        domctl.domain = current_domid;
  38.174 +        domctl.u.setdebugging.enable = 1;
  38.175 +        if ((retval = do_domctl(xc_handle, &domctl)))
  38.176 +            goto out_error_domctl;
  38.177  
  38.178 -        if (get_online_cpumap(xc_handle, &op.u.getdomaininfo, &cpumap))
  38.179 +        if (get_online_cpumap(xc_handle, &domctl.u.getdomaininfo, &cpumap))
  38.180              IPRINTF("get_online_cpumap failed\n");
  38.181          if (online_cpumap != cpumap)
  38.182              online_vcpus_changed(cpumap);
  38.183 @@ -625,8 +626,8 @@ xc_ptrace(
  38.184  
  38.185      return retval;
  38.186  
  38.187 - out_error_dom0:
  38.188 -    perror("dom0 op failed");
  38.189 + out_error_domctl:
  38.190 +    perror("domctl failed");
  38.191   out_error:
  38.192      errno = EINVAL;
  38.193      return retval;
    39.1 --- a/tools/libxc/xc_sedf.c	Fri Aug 25 16:21:39 2006 -0600
    39.2 +++ b/tools/libxc/xc_sedf.c	Sun Aug 27 10:24:41 2006 -0600
    39.3 @@ -10,37 +10,50 @@
    39.4  
    39.5  #include "xc_private.h"
    39.6  
    39.7 -int xc_sedf_domain_set(int xc_handle,
    39.8 -                          uint32_t domid, uint64_t period, uint64_t slice,uint64_t latency, uint16_t extratime,uint16_t weight)
    39.9 +int xc_sedf_domain_set(
   39.10 +    int xc_handle,
   39.11 +    uint32_t domid,
   39.12 +    uint64_t period,
   39.13 +    uint64_t slice,
   39.14 +    uint64_t latency,
   39.15 +    uint16_t extratime,
   39.16 +    uint16_t weight)
   39.17  {
   39.18 -    DECLARE_DOM0_OP;
   39.19 -    struct sedf_adjdom *p = &op.u.adjustdom.u.sedf;
   39.20 +    DECLARE_DOMCTL;
   39.21 +    struct xen_domctl_sched_sedf *p = &domctl.u.scheduler_op.u.sedf;
   39.22  
   39.23 -    op.cmd = DOM0_ADJUSTDOM;
   39.24 -    op.u.adjustdom.domain  = (domid_t)domid;
   39.25 -    op.u.adjustdom.sched_id = SCHED_SEDF;
   39.26 -    op.u.adjustdom.direction = SCHED_INFO_PUT;
   39.27 +    domctl.cmd = XEN_DOMCTL_scheduler_op;
   39.28 +    domctl.domain  = (domid_t)domid;
   39.29 +    domctl.u.scheduler_op.sched_id = XEN_SCHEDULER_SEDF;
   39.30 +    domctl.u.scheduler_op.cmd = XEN_DOMCTL_SCHEDOP_putinfo;
   39.31  
   39.32      p->period    = period;
   39.33      p->slice     = slice;
   39.34      p->latency   = latency;
   39.35      p->extratime = extratime;
   39.36      p->weight    = weight;
   39.37 -    return do_dom0_op(xc_handle, &op);
   39.38 +    return do_domctl(xc_handle, &domctl);
   39.39  }
   39.40  
   39.41 -int xc_sedf_domain_get(int xc_handle, uint32_t domid, uint64_t *period, uint64_t *slice, uint64_t* latency, uint16_t* extratime, uint16_t* weight)
   39.42 +int xc_sedf_domain_get(
   39.43 +    int xc_handle,
   39.44 +    uint32_t domid,
   39.45 +    uint64_t *period,
   39.46 +    uint64_t *slice,
   39.47 +    uint64_t *latency,
   39.48 +    uint16_t *extratime,
   39.49 +    uint16_t *weight)
   39.50  {
   39.51 -    DECLARE_DOM0_OP;
   39.52 +    DECLARE_DOMCTL;
   39.53      int ret;
   39.54 -    struct sedf_adjdom *p = &op.u.adjustdom.u.sedf;
   39.55 +    struct xen_domctl_sched_sedf *p = &domctl.u.scheduler_op.u.sedf;
   39.56  
   39.57 -    op.cmd = DOM0_ADJUSTDOM;
   39.58 -    op.u.adjustdom.domain = (domid_t)domid;
   39.59 -    op.u.adjustdom.sched_id = SCHED_SEDF;
   39.60 -    op.u.adjustdom.direction = SCHED_INFO_GET;
   39.61 +    domctl.cmd = XEN_DOMCTL_scheduler_op;
   39.62 +    domctl.domain = (domid_t)domid;
   39.63 +    domctl.u.scheduler_op.sched_id = XEN_SCHEDULER_SEDF;
   39.64 +    domctl.u.scheduler_op.cmd = XEN_DOMCTL_SCHEDOP_getinfo;
   39.65  
   39.66 -    ret = do_dom0_op(xc_handle, &op);
   39.67 +    ret = do_domctl(xc_handle, &domctl);
   39.68  
   39.69      *period    = p->period;
   39.70      *slice     = p->slice;
    40.1 --- a/tools/libxc/xc_tbuf.c	Fri Aug 25 16:21:39 2006 -0600
    40.2 +++ b/tools/libxc/xc_tbuf.c	Sun Aug 27 10:24:41 2006 -0600
    40.3 @@ -18,49 +18,49 @@
    40.4  
    40.5  static int tbuf_enable(int xc_handle, int enable)
    40.6  {
    40.7 -    DECLARE_DOM0_OP;
    40.8 +    DECLARE_SYSCTL;
    40.9  
   40.10 -    op.cmd = DOM0_TBUFCONTROL;
   40.11 -    op.interface_version = DOM0_INTERFACE_VERSION;
   40.12 +    sysctl.cmd = XEN_SYSCTL_tbuf_op;
   40.13 +    sysctl.interface_version = XEN_SYSCTL_INTERFACE_VERSION;
   40.14      if (enable)
   40.15 -        op.u.tbufcontrol.op  = DOM0_TBUF_ENABLE;
   40.16 +        sysctl.u.tbuf_op.cmd  = XEN_SYSCTL_TBUFOP_enable;
   40.17      else
   40.18 -        op.u.tbufcontrol.op  = DOM0_TBUF_DISABLE;
   40.19 +        sysctl.u.tbuf_op.cmd  = XEN_SYSCTL_TBUFOP_disable;
   40.20  
   40.21 -    return xc_dom0_op(xc_handle, &op);
   40.22 +    return xc_sysctl(xc_handle, &sysctl);
   40.23  }
   40.24  
   40.25  int xc_tbuf_set_size(int xc_handle, unsigned long size)
   40.26  {
   40.27 -    DECLARE_DOM0_OP;
   40.28 +    DECLARE_SYSCTL;
   40.29  
   40.30 -    op.cmd = DOM0_TBUFCONTROL;
   40.31 -    op.interface_version = DOM0_INTERFACE_VERSION;
   40.32 -    op.u.tbufcontrol.op  = DOM0_TBUF_SET_SIZE;
   40.33 -    op.u.tbufcontrol.size = size;
   40.34 +    sysctl.cmd = XEN_SYSCTL_tbuf_op;
   40.35 +    sysctl.interface_version = XEN_SYSCTL_INTERFACE_VERSION;
   40.36 +    sysctl.u.tbuf_op.cmd  = XEN_SYSCTL_TBUFOP_set_size;
   40.37 +    sysctl.u.tbuf_op.size = size;
   40.38  
   40.39 -    return xc_dom0_op(xc_handle, &op);
   40.40 +    return xc_sysctl(xc_handle, &sysctl);
   40.41  }
   40.42  
   40.43  int xc_tbuf_get_size(int xc_handle, unsigned long *size)
   40.44  {
   40.45      int rc;
   40.46 -    DECLARE_DOM0_OP;
   40.47 +    DECLARE_SYSCTL;
   40.48  
   40.49 -    op.cmd = DOM0_TBUFCONTROL;
   40.50 -    op.interface_version = DOM0_INTERFACE_VERSION;
   40.51 -    op.u.tbufcontrol.op  = DOM0_TBUF_GET_INFO;
   40.52 +    sysctl.cmd = XEN_SYSCTL_tbuf_op;
   40.53 +    sysctl.interface_version = XEN_SYSCTL_INTERFACE_VERSION;
   40.54 +    sysctl.u.tbuf_op.cmd  = XEN_SYSCTL_TBUFOP_get_info;
   40.55  
   40.56 -    rc = xc_dom0_op(xc_handle, &op);
   40.57 +    rc = xc_sysctl(xc_handle, &sysctl);
   40.58      if (rc == 0)
   40.59 -        *size = op.u.tbufcontrol.size;
   40.60 +        *size = sysctl.u.tbuf_op.size;
   40.61      return rc;
   40.62  }
   40.63  
   40.64  int xc_tbuf_enable(int xc_handle, size_t cnt, unsigned long *mfn,
   40.65                     unsigned long *size)
   40.66  {
   40.67 -    DECLARE_DOM0_OP;
   40.68 +    DECLARE_SYSCTL;
   40.69      int rc;
   40.70  
   40.71      /*
   40.72 @@ -73,15 +73,15 @@ int xc_tbuf_enable(int xc_handle, size_t
   40.73      if ( tbuf_enable(xc_handle, 1) != 0 )
   40.74          return -1;
   40.75  
   40.76 -    op.cmd = DOM0_TBUFCONTROL;
   40.77 -    op.interface_version = DOM0_INTERFACE_VERSION;
   40.78 -    op.u.tbufcontrol.op  = DOM0_TBUF_GET_INFO;
   40.79 +    sysctl.cmd = XEN_SYSCTL_tbuf_op;
   40.80 +    sysctl.interface_version = XEN_SYSCTL_INTERFACE_VERSION;
   40.81 +    sysctl.u.tbuf_op.cmd  = XEN_SYSCTL_TBUFOP_get_info;
   40.82  
   40.83 -    rc = xc_dom0_op(xc_handle, &op);
   40.84 +    rc = xc_sysctl(xc_handle, &sysctl);
   40.85      if ( rc == 0 )
   40.86      {
   40.87 -        *size = op.u.tbufcontrol.size;
   40.88 -        *mfn = op.u.tbufcontrol.buffer_mfn;
   40.89 +        *size = sysctl.u.tbuf_op.size;
   40.90 +        *mfn = sysctl.u.tbuf_op.buffer_mfn;
   40.91      }
   40.92  
   40.93      return 0;
   40.94 @@ -94,25 +94,39 @@ int xc_tbuf_disable(int xc_handle)
   40.95  
   40.96  int xc_tbuf_set_cpu_mask(int xc_handle, uint32_t mask)
   40.97  {
   40.98 -    DECLARE_DOM0_OP;
   40.99 +    DECLARE_SYSCTL;
  40.100 +    int ret = -1;
  40.101  
  40.102 -    op.cmd = DOM0_TBUFCONTROL;
  40.103 -    op.interface_version = DOM0_INTERFACE_VERSION;
  40.104 -    op.u.tbufcontrol.op  = DOM0_TBUF_SET_CPU_MASK;
  40.105 -    op.u.tbufcontrol.cpu_mask = mask;
  40.106 +    sysctl.cmd = XEN_SYSCTL_tbuf_op;
  40.107 +    sysctl.interface_version = XEN_SYSCTL_INTERFACE_VERSION;
  40.108 +    sysctl.u.tbuf_op.cmd  = XEN_SYSCTL_TBUFOP_set_cpu_mask;
  40.109  
  40.110 -    return do_dom0_op(xc_handle, &op);
  40.111 +    set_xen_guest_handle(sysctl.u.tbuf_op.cpu_mask.bitmap, (uint8_t *)&mask);
  40.112 +    sysctl.u.tbuf_op.cpu_mask.nr_cpus = sizeof(mask) * 8;
  40.113 +
  40.114 +    if ( mlock(&mask, sizeof(mask)) != 0 )
  40.115 +    {
  40.116 +        PERROR("Could not lock memory for Xen hypercall");
  40.117 +        goto out;
  40.118 +    }
  40.119 +
  40.120 +    ret = do_sysctl(xc_handle, &sysctl);
  40.121 +
  40.122 +    safe_munlock(&mask, sizeof(mask));
  40.123 +
  40.124 + out:
  40.125 +    return ret;
  40.126  }
  40.127  
  40.128  int xc_tbuf_set_evt_mask(int xc_handle, uint32_t mask)
  40.129  {
  40.130 -    DECLARE_DOM0_OP;
  40.131 +    DECLARE_SYSCTL;
  40.132  
  40.133 -    op.cmd = DOM0_TBUFCONTROL;
  40.134 -    op.interface_version = DOM0_INTERFACE_VERSION;
  40.135 -    op.u.tbufcontrol.op  = DOM0_TBUF_SET_EVT_MASK;
  40.136 -    op.u.tbufcontrol.evt_mask = mask;
  40.137 +    sysctl.cmd = XEN_SYSCTL_tbuf_op;
  40.138 +    sysctl.interface_version = XEN_SYSCTL_INTERFACE_VERSION;
  40.139 +    sysctl.u.tbuf_op.cmd  = XEN_SYSCTL_TBUFOP_set_evt_mask;
  40.140 +    sysctl.u.tbuf_op.evt_mask = mask;
  40.141  
  40.142 -    return do_dom0_op(xc_handle, &op);
  40.143 +    return do_sysctl(xc_handle, &sysctl);
  40.144  }
  40.145  
    41.1 --- a/tools/libxc/xenctrl.h	Fri Aug 25 16:21:39 2006 -0600
    41.2 +++ b/tools/libxc/xenctrl.h	Sun Aug 27 10:24:41 2006 -0600
    41.3 @@ -13,11 +13,11 @@
    41.4  #include <stdint.h>
    41.5  #include <sys/ptrace.h>
    41.6  #include <xen/xen.h>
    41.7 -#include <xen/dom0_ops.h>
    41.8 +#include <xen/domctl.h>
    41.9 +#include <xen/sysctl.h>
   41.10  #include <xen/version.h>
   41.11  #include <xen/event_channel.h>
   41.12  #include <xen/sched.h>
   41.13 -#include <xen/sched_ctl.h>
   41.14  #include <xen/memory.h>
   41.15  #include <xen/acm.h>
   41.16  #include <xen/acm_ops.h>
   41.17 @@ -139,7 +139,7 @@ typedef struct {
   41.18      xen_domain_handle_t handle;
   41.19  } xc_dominfo_t;
   41.20  
   41.21 -typedef dom0_getdomaininfo_t xc_domaininfo_t;
   41.22 +typedef xen_domctl_getdomaininfo_t xc_domaininfo_t;
   41.23  int xc_domain_create(int xc_handle,
   41.24                       uint32_t ssidref,
   41.25                       xen_domain_handle_t handle,
   41.26 @@ -231,7 +231,11 @@ int xc_domain_shutdown(int xc_handle,
   41.27  int xc_vcpu_setaffinity(int xc_handle,
   41.28                          uint32_t domid,
   41.29                          int vcpu,
   41.30 -                        cpumap_t cpumap);
   41.31 +                        uint64_t cpumap);
   41.32 +int xc_vcpu_getaffinity(int xc_handle,
   41.33 +                        uint32_t domid,
   41.34 +                        int vcpu,
   41.35 +                        uint64_t *cpumap);
   41.36  
   41.37  /**
   41.38   * This function will return information about one or more domains. It is
   41.39 @@ -301,7 +305,7 @@ int xc_vcpu_getcontext(int xc_handle,
   41.40                                 uint32_t vcpu,
   41.41                                 vcpu_guest_context_t *ctxt);
   41.42  
   41.43 -typedef dom0_getvcpuinfo_t xc_vcpuinfo_t;
   41.44 +typedef xen_domctl_getvcpuinfo_t xc_vcpuinfo_t;
   41.45  int xc_vcpu_getinfo(int xc_handle,
   41.46                      uint32_t domid,
   41.47                      uint32_t vcpu,
   41.48 @@ -317,7 +321,7 @@ long long xc_domain_get_cpu_usage(int xc
   41.49  int xc_domain_sethandle(int xc_handle, uint32_t domid,
   41.50                          xen_domain_handle_t handle);
   41.51  
   41.52 -typedef dom0_shadow_control_stats_t xc_shadow_control_stats_t;
   41.53 +typedef xen_domctl_shadow_op_stats_t xc_shadow_op_stats_t;
   41.54  int xc_shadow_control(int xc_handle,
   41.55                        uint32_t domid,
   41.56                        unsigned int sop,
   41.57 @@ -325,29 +329,7 @@ int xc_shadow_control(int xc_handle,
   41.58                        unsigned long pages,
   41.59                        unsigned long *mb,
   41.60                        uint32_t mode,
   41.61 -                      xc_shadow_control_stats_t *stats);
   41.62 -
   41.63 -int xc_bvtsched_global_set(int xc_handle,
   41.64 -                           unsigned long ctx_allow);
   41.65 -
   41.66 -int xc_bvtsched_domain_set(int xc_handle,
   41.67 -                           uint32_t domid,
   41.68 -                           uint32_t mcuadv,
   41.69 -                           int warpback,
   41.70 -                           int32_t warpvalue,
   41.71 -                           long long warpl,
   41.72 -                           long long warpu);
   41.73 -
   41.74 -int xc_bvtsched_global_get(int xc_handle,
   41.75 -                           unsigned long *ctx_allow);
   41.76 -
   41.77 -int xc_bvtsched_domain_get(int xc_handle,
   41.78 -                           uint32_t domid,
   41.79 -                           uint32_t *mcuadv,
   41.80 -                           int *warpback,
   41.81 -                           int32_t *warpvalue,
   41.82 -                           long long *warpl,
   41.83 -                           long long *warpu);
   41.84 +                      xc_shadow_op_stats_t *stats);
   41.85  
   41.86  int xc_sedf_domain_set(int xc_handle,
   41.87                         uint32_t domid,
   41.88 @@ -363,11 +345,11 @@ int xc_sedf_domain_get(int xc_handle,
   41.89  
   41.90  int xc_sched_credit_domain_set(int xc_handle,
   41.91                                 uint32_t domid,
   41.92 -                               struct sched_credit_adjdom *sdom);
   41.93 +                               struct xen_domctl_sched_credit *sdom);
   41.94  
   41.95  int xc_sched_credit_domain_get(int xc_handle,
   41.96                                 uint32_t domid,
   41.97 -                               struct sched_credit_adjdom *sdom);
   41.98 +                               struct xen_domctl_sched_credit *sdom);
   41.99  
  41.100  /*
  41.101   * EVENT CHANNEL FUNCTIONS
  41.102 @@ -399,7 +381,7 @@ int xc_readconsolering(int xc_handle,
  41.103                         unsigned int *pnr_chars,
  41.104                         int clear);
  41.105  
  41.106 -typedef dom0_physinfo_t xc_physinfo_t;
  41.107 +typedef xen_sysctl_physinfo_t xc_physinfo_t;
  41.108  int xc_physinfo(int xc_handle,
  41.109                  xc_physinfo_t *info);
  41.110  
  41.111 @@ -460,8 +442,8 @@ int xc_domain_iomem_permission(int xc_ha
  41.112  unsigned long xc_make_page_below_4G(int xc_handle, uint32_t domid,
  41.113                                      unsigned long mfn);
  41.114  
  41.115 -typedef dom0_perfc_desc_t xc_perfc_desc_t;
  41.116 -typedef dom0_perfc_val_t xc_perfc_val_t;
  41.117 +typedef xen_sysctl_perfc_desc_t xc_perfc_desc_t;
  41.118 +typedef xen_sysctl_perfc_val_t xc_perfc_val_t;
  41.119  /* IMPORTANT: The caller is responsible for mlock()'ing the @desc and @val
  41.120     arrays. */
  41.121  int xc_perfc_control(int xc_handle,
  41.122 @@ -471,11 +453,6 @@ int xc_perfc_control(int xc_handle,
  41.123                       int *nbr_desc,
  41.124                       int *nbr_val);
  41.125  
  41.126 -/* read/write msr */
  41.127 -long long xc_msr_read(int xc_handle, int cpu_mask, int msr);
  41.128 -int xc_msr_write(int xc_handle, int cpu_mask, int msr, unsigned int low,
  41.129 -                  unsigned int high);
  41.130 -
  41.131  /**
  41.132   * Memory maps a range within one domain to a local address range.  Mappings
  41.133   * should be unmapped with munmap and should follow the same rules as mmap
  41.134 @@ -588,8 +565,8 @@ int xc_tbuf_set_cpu_mask(int xc_handle, 
  41.135  
  41.136  int xc_tbuf_set_evt_mask(int xc_handle, uint32_t mask);
  41.137  
  41.138 -/* Execute a privileged dom0 operation. */
  41.139 -int xc_dom0_op(int xc_handle, dom0_op_t *op);
  41.140 +int xc_domctl(int xc_handle, struct xen_domctl *domctl);
  41.141 +int xc_sysctl(int xc_handle, struct xen_sysctl *sysctl);
  41.142  
  41.143  int xc_version(int xc_handle, int cmd, void *arg);
  41.144  
    42.1 --- a/tools/libxc/xg_private.h	Fri Aug 25 16:21:39 2006 -0600
    42.2 +++ b/tools/libxc/xg_private.h	Sun Aug 27 10:24:41 2006 -0600
    42.3 @@ -5,6 +5,7 @@
    42.4  #include <errno.h>
    42.5  #include <fcntl.h>
    42.6  #include <stdio.h>
    42.7 +#include <stdlib.h>
    42.8  #include <string.h>
    42.9  #include <sys/mman.h>
   42.10  #include <sys/types.h>
   42.11 @@ -16,15 +17,7 @@
   42.12  
   42.13  #include <xen/sys/privcmd.h>
   42.14  #include <xen/memory.h>
   42.15 -
   42.16 -/* valgrind cannot see when a hypercall has filled in some values.  For this
   42.17 -   reason, we must zero the dom0_op_t instance before a call, if using
   42.18 -   valgrind.  */
   42.19 -#ifdef VALGRIND
   42.20 -#define DECLARE_DOM0_OP dom0_op_t op = { 0 }
   42.21 -#else
   42.22 -#define DECLARE_DOM0_OP dom0_op_t op
   42.23 -#endif
   42.24 +#include <xen/elfnote.h>
   42.25  
   42.26  #ifndef ELFSIZE
   42.27  #include <limits.h>
   42.28 @@ -149,8 +142,15 @@ struct domain_setup_info
   42.29      unsigned long symtab_addr;
   42.30      unsigned long symtab_len;
   42.31  
   42.32 -    /* __xen_guest info string for convenient loader parsing. */
   42.33 -    char *xen_guest_string;
   42.34 +    /*
   42.35 +     * Only one of __elfnote_* or __xen_guest_string will be
   42.36 +     * non-NULL.
   42.37 +     *
   42.38 +     * You should use the xen_elfnote_* accessors below in order to
   42.39 +     * pickup the correct one and retain backwards compatibility.
   42.40 +     */
   42.41 +    void *__elfnote_section, *__elfnote_section_end;
   42.42 +    const char *__xen_guest_string;
   42.43  };
   42.44  
   42.45  typedef int (*parseimagefunc)(const char *image, unsigned long image_size,
   42.46 @@ -160,6 +160,21 @@ typedef int (*loadimagefunc)(const char 
   42.47                               uint32_t dom, xen_pfn_t *parray,
   42.48                               struct domain_setup_info *dsi);
   42.49  
   42.50 +/*
   42.51 + * If an ELF note of the given type is found then the value contained
   42.52 + * in the note is returned and *defined is set to non-zero. If no such
   42.53 + * note is found then *defined is set to 0 and 0 is returned.
   42.54 + */
   42.55 +extern unsigned long long xen_elfnote_numeric(struct domain_setup_info *dsi,
   42.56 +					      int type, int *defined);
   42.57 +
   42.58 +/*
   42.59 + * If an ELF note of the given type is found then the string contained
   42.60 + * in the value is returned, otherwise NULL is returned.
   42.61 + */
   42.62 +extern const char * xen_elfnote_string(struct domain_setup_info *dsi,
   42.63 +				       int type);
   42.64 +
   42.65  struct load_funcs
   42.66  {
   42.67      parseimagefunc parseimage;
    43.1 --- a/tools/misc/Makefile	Fri Aug 25 16:21:39 2006 -0600
    43.2 +++ b/tools/misc/Makefile	Sun Aug 27 10:24:41 2006 -0600
    43.3 @@ -24,7 +24,6 @@ all: build
    43.4  .PHONY: build
    43.5  build: $(TARGETS)
    43.6  	$(MAKE) -C miniterm
    43.7 -	$(MAKE) -C cpuperf
    43.8  ifeq ($(CONFIG_MBOOTPACK),y)
    43.9  	$(MAKE) -C mbootpack
   43.10  endif
   43.11 @@ -36,7 +35,6 @@ install: build
   43.12  	[ -d $(DESTDIR)/usr/sbin ] || $(INSTALL_DIR) $(DESTDIR)/usr/sbin
   43.13  	$(INSTALL_PROG) $(INSTALL_BIN) $(DESTDIR)/usr/bin
   43.14  	$(INSTALL_PROG) $(INSTALL_SBIN) $(DESTDIR)/usr/sbin
   43.15 -	$(MAKE) -C cpuperf install
   43.16  	$(MAKE) -C lomount install
   43.17  #       No sense in installing miniterm on the Xen box.
   43.18  #	$(MAKE) -C miniterm install
   43.19 @@ -47,7 +45,6 @@ install: build
   43.20  clean:
   43.21  	$(RM) *.o $(TARGETS) *~
   43.22  	$(MAKE) -C miniterm clean
   43.23 -	$(MAKE) -C cpuperf clean
   43.24  	$(MAKE) -C mbootpack clean
   43.25  	$(MAKE) -C lomount clean
   43.26  
    44.1 --- a/tools/misc/cpuperf/Makefile	Fri Aug 25 16:21:39 2006 -0600
    44.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    44.3 @@ -1,51 +0,0 @@
    44.4 -#
    44.5 -# Make Performance counter tool
    44.6 -#
    44.7 -# $Id: Makefile,v 1.1 2003/10/13 16:49:44 jrb44 Exp $
    44.8 -#
    44.9 -# $Log: Makefile,v $
   44.10 -# Revision 1.1  2003/10/13 16:49:44  jrb44
   44.11 -# Initial revision
   44.12 -#
   44.13 -#
   44.14 -
   44.15 -INSTALL		= install
   44.16 -INSTALL_PROG	= $(INSTALL) -m0755
   44.17 -INSTALL_DIR	= $(INSTALL) -d -m0755
   44.18 -
   44.19 -# these are for Xen
   44.20 -XEN_ROOT=../../..
   44.21 -include $(XEN_ROOT)/tools/Rules.mk
   44.22 -
   44.23 -HDRS         = $(wildcard *.h)
   44.24 -SRCS         = $(wildcard *.c)
   44.25 -OBJS         = $(patsubst %.c,%.o,$(SRCS))
   44.26 -
   44.27 -TARGETS      = cpuperf-xen cpuperf-perfcntr
   44.28 -
   44.29 -INSTALL_BIN  = $(TARGETS)
   44.30 -
   44.31 -
   44.32 -.PHONY: all
   44.33 -all: $(TARGETS)
   44.34 -
   44.35 -.PHONY: clean
   44.36 -clean:
   44.37 -	$(RM) *.o $(TARGETS)
   44.38 -
   44.39 -%: %.c $(HDRS) Makefile
   44.40 -	$(CC) $(CFLAGS) -o $@ $<
   44.41 -
   44.42 -cpuperf-xen: cpuperf.c $(HDRS) Makefile
   44.43 -	$(CC) $(CFLAGS) -I $(XEN_LIBXC) -L$(XEN_LIBXC) -lxenctrl -DXENO -o $@ $<
   44.44 -
   44.45 -cpuperf-perfcntr: cpuperf.c $(HDRS) Makefile
   44.46 -	$(CC) $(CFLAGS) -DPERFCNTR -o $@ $<
   44.47 -
   44.48 -.PHONY: install
   44.49 -install: all
   44.50 -	$(INSTALL_PROG) $(INSTALL_BIN) $(DESTDIR)/usr/bin
   44.51 -
   44.52 -
   44.53 -# End of $RCSfile: Makefile,v $
   44.54 -
    45.1 --- a/tools/misc/cpuperf/README.txt	Fri Aug 25 16:21:39 2006 -0600
    45.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    45.3 @@ -1,371 +0,0 @@
    45.4 -Usage
    45.5 -=====
    45.6 -
    45.7 -Use either xen-cpuperf, cpuperf-perfcntr as appropriate to the system
    45.8 -in use.
    45.9 -
   45.10 -To write:
   45.11 -
   45.12 -    cpuperf -E <escr> -C <cccr> 
   45.13 -
   45.14 -        optional: all numbers in base 10 unless specified
   45.15 -
   45.16 -        -d             Debug mode
   45.17 -        -c <cpu>       CPU number
   45.18 -        -t <thread>    ESCR thread bits - default is 12 (Thread 0 all rings)
   45.19 -                         bit 0: Thread 1 in rings 1,2,3
   45.20 -                         bit 1: Thread 1 in ring 0
   45.21 -                         bit 2: Thread 0 in rings 1,2,3
   45.22 -                         bit 3: Thread 0 in ring 0
   45.23 -        -e <eventsel>  Event selection number
   45.24 -        -m <eventmask> Event mask bits
   45.25 -        -T <value>     ESCR tag value
   45.26 -        -k             Sets CCCR 'compare' bit
   45.27 -        -n             Sets CCCR 'complement' bit
   45.28 -        -g             Sets CCCR 'edge' bit
   45.29 -        -P <bit>       Set the specified bit in MSR_P4_PEBS_ENABLE
   45.30 -        -V <bit>       Set the specified bit in MSR_P4_PEBS_MATRIX_VERT
   45.31 -        (-V and -P may be used multiple times to set multiple bits.)
   45.32 -
   45.33 -To read:
   45.34 -
   45.35 -    cpuperf -r    
   45.36 -
   45.37 -        optional: all numbers in base 10 unless specified
   45.38 -    
   45.39 -        -c <cpu>       CPU number
   45.40 -
   45.41 -<cccr> values:
   45.42 -
   45.43 -    BPU_CCCR0
   45.44 -    BPU_CCCR1
   45.45 -    BPU_CCCR2
   45.46 -    BPU_CCCR3
   45.47 -    MS_CCCR0
   45.48 -    MS_CCCR1
   45.49 -    MS_CCCR2
   45.50 -    MS_CCCR3
   45.51 -    FLAME_CCCR0
   45.52 -    FLAME_CCCR1
   45.53 -    FLAME_CCCR2
   45.54 -    FLAME_CCCR3
   45.55 -    IQ_CCCR0
   45.56 -    IQ_CCCR1
   45.57 -    IQ_CCCR2
   45.58 -    IQ_CCCR3
   45.59 -    IQ_CCCR4
   45.60 -    IQ_CCCR5
   45.61 -    NONE - do not program any CCCR, used when setting up an ESCR for tagging
   45.62 -
   45.63 -<escr> values:
   45.64 -
   45.65 -    BSU_ESCR0
   45.66 -    BSU_ESCR1
   45.67 -    FSB_ESCR0
   45.68 -    FSB_ESCR1
   45.69 -    MOB_ESCR0
   45.70 -    MOB_ESCR1
   45.71 -    PMH_ESCR0
   45.72 -    PMH_ESCR1
   45.73 -    BPU_ESCR0
   45.74 -    BPU_ESCR1
   45.75 -    IS_ESCR0
   45.76 -    IS_ESCR1
   45.77 -    ITLB_ESCR0
   45.78 -    ITLB_ESCR1
   45.79 -    IX_ESCR0
   45.80 -    IX_ESCR1
   45.81 -    MS_ESCR0
   45.82 -    MS_ESCR1
   45.83 -    TBPU_ESCR0
   45.84 -    TBPU_ESCR1
   45.85 -    TC_ESCR0
   45.86 -    TC_ESCR1
   45.87 -    FIRM_ESCR0
   45.88 -    FIRM_ESCR1
   45.89 -    FLAME_ESCR0
   45.90 -    FLAME_ESCR1
   45.91 -    DAC_ESCR0
   45.92 -    DAC_ESCR1
   45.93 -    SAAT_ESCR0
   45.94 -    SAAT_ESCR1
   45.95 -    U2L_ESCR0
   45.96 -    U2L_ESCR1
   45.97 -    CRU_ESCR0
   45.98 -    CRU_ESCR1
   45.99 -    CRU_ESCR2
  45.100 -    CRU_ESCR3
  45.101 -    CRU_ESCR4
  45.102 -    CRU_ESCR5
  45.103 -    IQ_ESCR0
  45.104 -    IQ_ESCR1
  45.105 -    RAT_ESCR0
  45.106 -    RAT_ESCR1
  45.107 -    SSU_ESCR0
  45.108 -    SSU_ESCR1
  45.109 -    ALF_ESCR0
  45.110 -    ALF_ESCR1
  45.111 -
  45.112 -
  45.113 -Example configurations
  45.114 -======================
  45.115 -
  45.116 -Note than in most cases there is a choice of ESCRs and CCCRs for
  45.117 -each metric although not all combinations are allowed. Each ESCR and
  45.118 -counter/CCCR can be used only once.
  45.119 -
  45.120 -Mispredicted branches retired
  45.121 -=============================
  45.122 -
  45.123 -cpuperf -E CRU_ESCR0 -C IQ_CCCR0 -e 3 -m 1
  45.124 -cpuperf -E CRU_ESCR0 -C IQ_CCCR1 -e 3 -m 1
  45.125 -cpuperf -E CRU_ESCR0 -C IQ_CCCR4 -e 3 -m 1
  45.126 -cpuperf -E CRU_ESCR1 -C IQ_CCCR2 -e 3 -m 1
  45.127 -cpuperf -E CRU_ESCR1 -C IQ_CCCR3 -e 3 -m 1
  45.128 -cpuperf -E CRU_ESCR1 -C IQ_CCCR5 -e 3 -m 1
  45.129 -
  45.130 -Tracecache misses
  45.131 -=================
  45.132 -
  45.133 -cpuperf -E BPU_ESCR0 -C BPU_CCCR0 -e 3 -m 1
  45.134 -cpuperf -E BPU_ESCR0 -C BPU_CCCR1 -e 3 -m 1
  45.135 -cpuperf -E BPU_ESCR1 -C BPU_CCCR2 -e 3 -m 1
  45.136 -cpuperf -E BPU_ESCR1 -C BPU_CCCR3 -e 3 -m 1
  45.137 -
  45.138 -I-TLB
  45.139 -=====
  45.140 -
  45.141 -cpuperf -E ITLB_ESCR0 -C BPU_CCCR0 -e 24 
  45.142 -cpuperf -E ITLB_ESCR0 -C BPU_CCCR1 -e 24 
  45.143 -cpuperf -E ITLB_ESCR1 -C BPU_CCCR2 -e 24 
  45.144 -cpuperf -E ITLB_ESCR1 -C BPU_CCCR3 -e 24 
  45.145 -
  45.146 - -m <n> : bit 0 count HITS, bit 1 MISSES, bit 2 uncacheable hit
  45.147 -
  45.148 - e.g. all ITLB misses -m 2
  45.149 -
  45.150 -Load replays
  45.151 -============
  45.152 -
  45.153 -cpuperf -E MOB_ESCR0 -C BPU_CCCR0 -e 3
  45.154 -cpuperf -E MOB_ESCR0 -C BPU_CCCR1 -e 3
  45.155 -cpuperf -E MOB_ESCR1 -C BPU_CCCR2 -e 3
  45.156 -cpuperf -E MOB_ESCR1 -C BPU_CCCR3 -e 3
  45.157 -
  45.158 - -m <n> : bit mask, replay due to...
  45.159 -           1: unknown store address
  45.160 -           3: unknown store data
  45.161 -           4: partially overlapped data access between LD/ST
  45.162 -           5: unaligned address between LD/ST
  45.163 -
  45.164 -Page walks
  45.165 -==========
  45.166 -
  45.167 -cpuperf -E PMH_ESCR0 -C BPU_CCCR0 -e 1
  45.168 -cpuperf -E PMH_ESCR0 -C BPU_CCCR1 -e 1
  45.169 -cpuperf -E PMH_ESCR1 -C BPU_CCCR2 -e 1
  45.170 -cpuperf -E PMH_ESCR1 -C BPU_CCCR3 -e 1
  45.171 -
  45.172 - -m <n> : bit 0 counts walks for a D-TLB miss, bit 1 for I-TLB miss
  45.173 -
  45.174 -L2/L3 cache accesses
  45.175 -====================
  45.176 -
  45.177 -cpuperf -E BSU_ESCR0 -C BPU_CCCR0 -e 12
  45.178 -cpuperf -E BSU_ESCR0 -C BPU_CCCR1 -e 12
  45.179 -cpuperf -E BSU_ESCR1 -C BPU_CCCR2 -e 12
  45.180 -cpuperf -E BSU_ESCR1 -C BPU_CCCR3 -e 12
  45.181 -
  45.182 - -m <n> : where the bit mask is:
  45.183 -           0: Read L2 HITS Shared
  45.184 -           1: Read L2 HITS Exclusive
  45.185 -           2: Read L2 HITS Modified
  45.186 -           3: Read L3 HITS Shared
  45.187 -           4: Read L3 HITS Exclusive
  45.188 -           5: Read L3 HITS Modified
  45.189 -           8: Read L2 MISS
  45.190 -           9: Read L3 MISS
  45.191 -          10: Write L2 MISS
  45.192 -
  45.193 -Front side bus activity
  45.194 -=======================
  45.195 -
  45.196 -cpuperf -E FSB_ESCR0 -C BPU_CCCR0 -e 23 -k -g
  45.197 -cpuperf -E FSB_ESCR0 -C BPU_CCCR1 -e 23 -k -g
  45.198 -cpuperf -E FSB_ESCR1 -C BPU_CCCR2 -e 23 -k -g
  45.199 -cpuperf -E FSB_ESCR1 -C BPU_CCCR3 -e 23 -k -g
  45.200 -
  45.201 - -m <n> : where the bit mask is for bus events:
  45.202 -           0: DRDY_DRV    Processor drives bus
  45.203 -           1: DRDY_OWN    Processor reads bus
  45.204 -           2: DRDY_OTHER  Data on bus not being sampled by processor
  45.205 -           3: DBSY_DRV    Processor reserves bus for driving
  45.206 -           4: DBSY_OWN    Other entity reserves bus for sending to processor
  45.207 -           5: DBSY_OTHER  Other entity reserves bus for sending elsewhere
  45.208 -
  45.209 - e.g. -m 3 to get cycles bus actually in use.
  45.210 -
  45.211 -Pipeline clear (entire)
  45.212 -=======================
  45.213 -
  45.214 -cpuperf -E CRU_ESCR2 -C IQ_CCCR0 -e 2
  45.215 -cpuperf -E CRU_ESCR2 -C IQ_CCCR1 -e 2
  45.216 -cpuperf -E CRU_ESCR2 -C IQ_CCCR4 -e 2
  45.217 -cpuperf -E CRU_ESCR3 -C IQ_CCCR2 -e 2
  45.218 -cpuperf -E CRU_ESCR3 -C IQ_CCCR3 -e 2
  45.219 -cpuperf -E CRU_ESCR3 -C IQ_CCCR5 -e 2
  45.220 -
  45.221 - -m <n> : bit mask:
  45.222 -           0: counts a portion of cycles while clear (use -g for edge trigger)
  45.223 -           1: counts each time machine clears for memory ordering issues
  45.224 -           2: counts each time machine clears for self modifying code
  45.225 -
  45.226 -Instructions retired
  45.227 -====================
  45.228 -
  45.229 -cpuperf -E CRU_ESCR0 -C IQ_CCCR0 -e 2
  45.230 -cpuperf -E CRU_ESCR0 -C IQ_CCCR1 -e 2
  45.231 -cpuperf -E CRU_ESCR0 -C IQ_CCCR4 -e 2
  45.232 -cpuperf -E CRU_ESCR1 -C IQ_CCCR2 -e 2
  45.233 -cpuperf -E CRU_ESCR1 -C IQ_CCCR3 -e 2
  45.234 -cpuperf -E CRU_ESCR1 -C IQ_CCCR5 -e 2
  45.235 -
  45.236 - -m <n> : bit mask:
  45.237 -           0: counts non-bogus, not tagged instructions
  45.238 -           1: counts non-bogus, tagged instructions
  45.239 -           2: counts bogus, not tagged instructions
  45.240 -           3: counts bogus, tagged instructions
  45.241 -
  45.242 - e.g. -m 3 to count legit retirements
  45.243 -
  45.244 -Uops retired
  45.245 -============
  45.246 -
  45.247 -cpuperf -E CRU_ESCR0 -C IQ_CCCR0 -e 1
  45.248 -cpuperf -E CRU_ESCR0 -C IQ_CCCR1 -e 1
  45.249 -cpuperf -E CRU_ESCR0 -C IQ_CCCR4 -e 1
  45.250 -cpuperf -E CRU_ESCR1 -C IQ_CCCR2 -e 1
  45.251 -cpuperf -E CRU_ESCR1 -C IQ_CCCR3 -e 1
  45.252 -cpuperf -E CRU_ESCR1 -C IQ_CCCR5 -e 1
  45.253 -
  45.254 - -m <n> : bit mask:
  45.255 -           0: Non-bogus
  45.256 -           1: Bogus
  45.257 -
  45.258 -x87 FP uops
  45.259 -===========
  45.260 -
  45.261 -cpuperf -E FIRM_ESCR0 -C FLAME_CCCR0 -e 4 -m 32768
  45.262 -cpuperf -E FIRM_ESCR0 -C FLAME_CCCR1 -e 4 -m 32768
  45.263 -cpuperf -E FIRM_ESCR1 -C FLAME_CCCR2 -e 4 -m 32768
  45.264 -cpuperf -E FIRM_ESCR1 -C FLAME_CCCR3 -e 4 -m 32768
  45.265 -
  45.266 -Replay tagging mechanism
  45.267 -========================
  45.268 -
  45.269 -Counts retirement of uops tagged with the replay tagging mechanism
  45.270 -
  45.271 -cpuperf -E CRU_ESCR2 -C IQ_CCCR0 -e 9
  45.272 -cpuperf -E CRU_ESCR2 -C IQ_CCCR1 -e 9
  45.273 -cpuperf -E CRU_ESCR2 -C IQ_CCCR4 -e 9
  45.274 -cpuperf -E CRU_ESCR3 -C IQ_CCCR2 -e 9
  45.275 -cpuperf -E CRU_ESCR3 -C IQ_CCCR3 -e 9
  45.276 -cpuperf -E CRU_ESCR3 -C IQ_CCCR5 -e 9
  45.277 -
  45.278 - -m <n> : bit mask:
  45.279 -           0: Non-bogus (set this bit for all events listed below)
  45.280 -           1: Bogus
  45.281 -
  45.282 -Set replay tagging mechanism bits with -P and -V:
  45.283 -
  45.284 -  L1 cache load miss retired:      -P 0 -P 24 -P 25 -V 0
  45.285 -  L2 cache load miss retired:      -P 1 -P 24 -P 25 -V 0  (read manual)
  45.286 -  DTLB load miss retired:          -P 2 -P 24 -P 25 -V 0
  45.287 -  DTLB store miss retired:         -P 2 -P 24 -P 25 -V 1
  45.288 -  DTLB all miss retired:           -P 2 -P 24 -P 25 -V 0 -V 1
  45.289 -
  45.290 -e.g. to count all DTLB misses
  45.291 -
  45.292 - cpuperf -E CRU_ESCR2 -C IQ_CCCR0 -e 9 -m 1 P 2 -P 24 -P 25 -V 0 -V 1
  45.293 -
  45.294 -Front end event
  45.295 -===============
  45.296 -
  45.297 -To count tagged uops:
  45.298 -
  45.299 -cpuperf -E CRU_ESCR2 -C IQ_CCCR0 -e 8
  45.300 -cpuperf -E CRU_ESCR2 -C IQ_CCCR1 -e 8
  45.301 -cpuperf -E CRU_ESCR2 -C IQ_CCCR4 -e 8
  45.302 -cpuperf -E CRU_ESCR3 -C IQ_CCCR2 -e 8
  45.303 -cpuperf -E CRU_ESCR3 -C IQ_CCCR3 -e 8
  45.304 -cpuperf -E CRU_ESCR3 -C IQ_CCCR5 -e 8
  45.305 -
  45.306 - -m <n> : bit 0 for non-bogus uops, bit 1 for bogus uops
  45.307 -
  45.308 -Must have another ESCR programmed to tag uops as required
  45.309 -
  45.310 -cpuperf -E RAT_ESCR0 -C NONE -e 2
  45.311 -cpuperf -E RAT_ESCR1 -C NONE -e 2
  45.312 -
  45.313 - -m <n> : bit 1 for LOADs, bit 2 for STOREs
  45.314 -
  45.315 -An example set of counters
  45.316 -===========================
  45.317 -
  45.318 -# instructions retired
  45.319 -cpuperf -E CRU_ESCR0 -C IQ_CCCR0 -e 2 -m 3
  45.320 -
  45.321 -# trace cache misses
  45.322 -cpuperf -E BPU_ESCR0 -C BPU_CCCR0 -e 3 -m 1
  45.323 -
  45.324 -# L1 D cache misses (load misses retired)
  45.325 -cpuperf -E CRU_ESCR2 -C IQ_CCCR1 -e 9 -m 1 -P 0 -P 24 -P 25 -V 0
  45.326 -
  45.327 -# L2 misses (load and store)
  45.328 -cpuperf -E BSU_ESCR0 -C BPU_CCCR1 -e 12 -m 1280
  45.329 -
  45.330 -# I-TLB misses
  45.331 -cpuperf -E ITLB_ESCR1 -C BPU_CCCR2 -e 24 -m 2
  45.332 -
  45.333 -# D-TLB misses (as PT walks)
  45.334 -cpuperf -E PMH_ESCR1 -C BPU_CCCR3 -e 1 -m 1
  45.335 -
  45.336 -# Other 'bonus' counters would be:
  45.337 -#   number of loads executed - need both command lines
  45.338 -cpuperf -E RAT_ESCR0 -C NONE -e 2 -m 2
  45.339 -cpuperf -E CRU_ESCR3 -C IQ_CCCR3 -e 8 -m 3
  45.340 -
  45.341 -#   number of mispredicted branches
  45.342 -cpuperf -E CRU_ESCR1 -C IQ_CCCR2 -e 3 -m 1
  45.343 -
  45.344 -# x87 FP uOps
  45.345 -cpuperf -E FIRM_ESCR0 -C FLAME_CCCR0 -e 4 -m 32768
  45.346 -
  45.347 -The above has counter assignments
  45.348 -
  45.349 -0  Trace cache misses
  45.350 -1  L2 Misses
  45.351 -2  I-TLB misses
  45.352 -3  D-TLB misses
  45.353 -4  
  45.354 -5  
  45.355 -6  
  45.356 -7  
  45.357 -8  x87 FP uOps 
  45.358 -9  
  45.359 -10 
  45.360 -11 
  45.361 -12 Instructions retired
  45.362 -13 L1 D cache misses
  45.363 -14 Mispredicted branches
  45.364 -15 Loads executed
  45.365 -16 
  45.366 -17 
  45.367 -
  45.368 -Counting instructions retired on each logical CPU
  45.369 -=================================================
  45.370 -
  45.371 -cpuperf -E CRU_ESCR0 -C IQ_CCCR0 -e 2 -m 3 -t 12
  45.372 -cpuperf -E CRU_ESCR1 -C IQ_CCCR2 -e 2 -m 3 -t 3
  45.373 -
  45.374 -Cannot count mispred branches as well due to CRU_ESCR1 use.
    46.1 --- a/tools/misc/cpuperf/cpuperf.c	Fri Aug 25 16:21:39 2006 -0600
    46.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    46.3 @@ -1,296 +0,0 @@
    46.4 -/*
    46.5 - * User mode program to program performance counters.
    46.6 - *
    46.7 - * JRB/IAP October 2003.
    46.8 - *
    46.9 - * $Id: cpuperf.c,v 1.2 2003/10/14 11:00:59 jrb44 Exp $
   46.10 - *
   46.11 - * $Log: cpuperf.c,v $
   46.12 - * Revision 1.2  2003/10/14 11:00:59  jrb44
   46.13 - * Added dcefault CPU. Added NONE CCCR.
   46.14 - *
   46.15 - * Revision 1.1  2003/10/13 16:49:44  jrb44
   46.16 - * Initial revision
   46.17 - *
   46.18 - */
   46.19 -
   46.20 -#include <sys/types.h>
   46.21 -#include <sched.h>
   46.22 -#include <stdio.h>
   46.23 -#include <unistd.h>
   46.24 -#include <stdlib.h>
   46.25 -#include <string.h>
   46.26 -#include <errno.h>
   46.27 -
   46.28 -#include "p4perf.h"
   46.29 -
   46.30 -static inline void cpus_wrmsr(int cpu_mask,
   46.31 -                              int msr,
   46.32 -                              unsigned int low,
   46.33 -                              unsigned int high )
   46.34 -{
   46.35 -    fprintf(stderr, "No backend to write MSR 0x%x <= 0x%08x%08x on %08x\n",
   46.36 -            msr, high, low, cpu_mask);
   46.37 -}
   46.38 -
   46.39 -static inline unsigned long long cpus_rdmsr( int cpu_mask, int msr )
   46.40 -{
   46.41 -    fprintf(stderr, "No backend to read MSR 0x%x on %08x\n", msr, cpu_mask);
   46.42 -    return 0;
   46.43 -}
   46.44 -
   46.45 -#ifdef PERFCNTR
   46.46 -#include "cpuperf_perfcntr.h"
   46.47 -#define cpus_wrmsr perfcntr_wrmsr
   46.48 -#define cpus_rdmsr perfcntr_rdmsr
   46.49 -#endif
   46.50 -
   46.51 -#ifdef XENO
   46.52 -#include "cpuperf_xeno.h"
   46.53 -#define cpus_wrmsr dom0_wrmsr
   46.54 -#define cpus_rdmsr dom0_rdmsr
   46.55 -#endif
   46.56 -
   46.57 -struct macros {
   46.58 -    char         *name;
   46.59 -    unsigned long msr_addr;
   46.60 -    int           number;
   46.61 -};
   46.62 -
   46.63 -#define NO_CCCR 0xfffffffe
   46.64 -
   46.65 -struct macros msr[] = {
   46.66 -    {"BPU_COUNTER0", 0x300, 0},
   46.67 -    {"BPU_COUNTER1", 0x301, 1},
   46.68 -    {"BPU_COUNTER2", 0x302, 2},
   46.69 -    {"BPU_COUNTER3", 0x303, 3},
   46.70 -    {"MS_COUNTER0", 0x304, 4},
   46.71 -    {"MS_COUNTER1", 0x305, 5},
   46.72 -    {"MS_COUNTER2", 0x306, 6},
   46.73 -    {"MS_COUNTER3", 0x307, 7},
   46.74 -    {"FLAME_COUNTER0", 0x308, 8},
   46.75 -    {"FLAME_COUNTER1", 0x309, 9},
   46.76 -    {"FLAME_COUNTER2", 0x30a, 10},
   46.77 -    {"FLAME_COUNTER3", 0x30b, 11},
   46.78 -    {"IQ_COUNTER0", 0x30c, 12},
   46.79 -    {"IQ_COUNTER1", 0x30d, 13},
   46.80 -    {"IQ_COUNTER2", 0x30e, 14},
   46.81 -    {"IQ_COUNTER3", 0x30f, 15},
   46.82 -    {"IQ_COUNTER4", 0x310, 16},
   46.83 -    {"IQ_COUNTER5", 0x311, 17},
   46.84 -    {"BPU_CCCR0", 0x360, 0},
   46.85 -    {"BPU_CCCR1", 0x361, 1},
   46.86 -    {"BPU_CCCR2", 0x362, 2},
   46.87 -    {"BPU_CCCR3", 0x363, 3},
   46.88 -    {"MS_CCCR0", 0x364, 4},
   46.89 -    {"MS_CCCR1", 0x365, 5},
   46.90 -    {"MS_CCCR2", 0x366, 6},
   46.91 -    {"MS_CCCR3", 0x367, 7},
   46.92 -    {"FLAME_CCCR0", 0x368, 8},
   46.93 -    {"FLAME_CCCR1", 0x369, 9},
   46.94 -    {"FLAME_CCCR2", 0x36a, 10},
   46.95 -    {"FLAME_CCCR3", 0x36b, 11},
   46.96 -    {"IQ_CCCR0", 0x36c, 12},
   46.97 -    {"IQ_CCCR1", 0x36d, 13},
   46.98 -    {"IQ_CCCR2", 0x36e, 14},
   46.99 -    {"IQ_CCCR3", 0x36f, 15},
  46.100 -    {"IQ_CCCR4", 0x370, 16},
  46.101 -    {"IQ_CCCR5", 0x371, 17},
  46.102 -    {"BSU_ESCR0", 0x3a0, 7},
  46.103 -    {"BSU_ESCR1", 0x3a1, 7},
  46.104 -    {"FSB_ESCR0", 0x3a2, 6},
  46.105 -    {"FSB_ESCR1", 0x3a3, 6},
  46.106 -    {"MOB_ESCR0", 0x3aa, 2},
  46.107 -    {"MOB_ESCR1", 0x3ab, 2},
  46.108 -    {"PMH_ESCR0", 0x3ac, 4},
  46.109 -    {"PMH_ESCR1", 0x3ad, 4},
  46.110 -    {"BPU_ESCR0", 0x3b2, 0},
  46.111 -    {"BPU_ESCR1", 0x3b3, 0},
  46.112 -    {"IS_ESCR0", 0x3b4, 1},
  46.113 -    {"IS_ESCR1", 0x3b5, 1},
  46.114 -    {"ITLB_ESCR0", 0x3b6, 3},
  46.115 -    {"ITLB_ESCR1", 0x3b7, 3},
  46.116 -    {"IX_ESCR0", 0x3c8, 5},
  46.117 -    {"IX_ESCR1", 0x3c9, 5},
  46.118 -    {"MS_ESCR0", 0x3c0, 0},
  46.119 -    {"MS_ESCR1", 0x3c1, 0},
  46.120 -    {"TBPU_ESCR0", 0x3c2, 2},
  46.121 -    {"TBPU_ESCR1", 0x3c3, 2},
  46.122 -    {"TC_ESCR0", 0x3c4, 1},
  46.123 -    {"TC_ESCR1", 0x3c5, 1},
  46.124 -    {"FIRM_ESCR0", 0x3a4, 1},
  46.125 -    {"FIRM_ESCR1", 0x3a5, 1},
  46.126 -    {"FLAME_ESCR0", 0x3a6, 0},
  46.127 -    {"FLAME_ESCR1", 0x3a7, 0},
  46.128 -    {"DAC_ESCR0", 0x3a8, 5},
  46.129 -    {"DAC_ESCR1", 0x3a9, 5},
  46.130 -    {"SAAT_ESCR0", 0x3ae, 2},
  46.131 -    {"SAAT_ESCR1", 0x3af, 2},
  46.132 -    {"U2L_ESCR0", 0x3b0, 3},
  46.133 -    {"U2L_ESCR1", 0x3b1, 3},
  46.134 -    {"CRU_ESCR0", 0x3b8, 4},
  46.135 -    {"CRU_ESCR1", 0x3b9, 4},
  46.136 -    {"CRU_ESCR2", 0x3cc, 5},
  46.137 -    {"CRU_ESCR3", 0x3cd, 5},
  46.138 -    {"CRU_ESCR4", 0x3e0, 6},
  46.139 -    {"CRU_ESCR5", 0x3e1, 6},
  46.140 -    {"IQ_ESCR0", 0x3ba, 0},
  46.141 -    {"IQ_ESCR1", 0x3bb, 0},
  46.142 -    {"RAT_ESCR0", 0x3bc, 2},
  46.143 -    {"RAT_ESCR1", 0x3bd, 2},
  46.144 -    {"SSU_ESCR0", 0x3be, 3},
  46.145 -    {"SSU_ESCR1", 0x3bf, 3},
  46.146 -    {"ALF_ESCR0", 0x3ca, 1},
  46.147 -    {"ALF_ESCR1", 0x3cb, 1},
  46.148 -    {"PEBS_ENABLE", 0x3f1, 0},
  46.149 -    {"PEBS_MATRIX_VERT", 0x3f2, 0},
  46.150 -    {"NONE", NO_CCCR, 0},
  46.151 -    {NULL, 0, 0}
  46.152 -};
  46.153 -
  46.154 -struct macros *lookup_macro(char *str)
  46.155 -{
  46.156 -    struct macros *m;
  46.157 -
  46.158 -    m = msr;
  46.159 -    while (m->name) {
  46.160 -        if (strcmp(m->name, str) == 0)
  46.161 -            return m;
  46.162 -        m++;
  46.163 -    }
  46.164 -    return NULL;
  46.165 -}
  46.166 -
  46.167 -int main(int argc, char **argv)
  46.168 -{
  46.169 -    int c, t = 0xc, es = 0, em = 0, tv = 0, te = 0;
  46.170 -    unsigned int cpu_mask = 1;
  46.171 -    struct macros *escr = NULL, *cccr = NULL;
  46.172 -    unsigned long escr_val, cccr_val;
  46.173 -    int debug = 0;
  46.174 -    unsigned long pebs = 0, pebs_vert = 0;
  46.175 -    int pebs_x = 0, pebs_vert_x = 0;
  46.176 -    int read = 0;
  46.177 -    int compare = 0;
  46.178 -    int complement = 0;
  46.179 -    int edge = 0;
  46.180 -    
  46.181 -#ifdef XENO
  46.182 -    xen_init();
  46.183 -#endif
  46.184 -
  46.185 -
  46.186 -    while ((c = getopt(argc, argv, "dc:t:e:m:T:E:C:P:V:rkng")) != -1) {
  46.187 -        switch((char)c) {
  46.188 -        case 'P':
  46.189 -            pebs |= 1 << atoi(optarg);
  46.190 -            pebs_x = 1;
  46.191 -            break;
  46.192 -        case 'V':
  46.193 -            pebs_vert |= 1 << atoi(optarg);
  46.194 -            pebs_vert_x = 1;
  46.195 -            break;
  46.196 -        case 'd':
  46.197 -            debug = 1;
  46.198 -            break;
  46.199 -        case 'c':
  46.200 -            {
  46.201 -                int cpu = atoi(optarg);
  46.202 -                cpu_mask  = (cpu == -1)?(~0):(1<<cpu);
  46.203 -            }
  46.204 -            break;
  46.205 -        case 't': // ESCR thread bits
  46.206 -            t = atoi(optarg);
  46.207 -            break;
  46.208 -        case 'e': // eventsel
  46.209 -            es = atoi(optarg);
  46.210 -            break;
  46.211 -        case 'm': // eventmask
  46.212 -            em = atoi(optarg);
  46.213 -            break;
  46.214 -        case 'T': // tag value
  46.215 -            tv = atoi(optarg);
  46.216 -            te = 1;
  46.217 -            break;
  46.218 -        case 'E':
  46.219 -            escr = lookup_macro(optarg);
  46.220 -            if (!escr) {
  46.221 -                fprintf(stderr, "Macro '%s' not found.\n", optarg);
  46.222 -                exit(1);
  46.223 -            }
  46.224 -            break;
  46.225 -        case 'C':
  46.226 -            cccr = lookup_macro(optarg);
  46.227 -            if (!cccr) {
  46.228 -                fprintf(stderr, "Macro '%s' not found.\n", optarg);
  46.229 -                exit(1);
  46.230 -            }
  46.231 -            break;
  46.232 -        case 'r':
  46.233 -            read = 1;
  46.234 -            break;
  46.235 -        case 'k':
  46.236 -            compare = 1;
  46.237 -            break;
  46.238 -        case 'n':
  46.239 -            complement = 1;
  46.240 -            break;
  46.241 -        case 'g':
  46.242 -            edge = 1;
  46.243 -            break;
  46.244 -        }
  46.245 -    }
  46.246 -
  46.247 -    if (read) {
  46.248 -        int i;
  46.249 -        for (i=0x300;i<0x312;i++)
  46.250 -            printf("%010llu ",cpus_rdmsr( cpu_mask, i ) );
  46.251 -        printf("\n");
  46.252 -        exit(1);
  46.253 -    }
  46.254 -    
  46.255 -    if (!escr) {
  46.256 -        fprintf(stderr, "Need an ESCR.\n");
  46.257 -        exit(1);
  46.258 -    }
  46.259 -    if (!cccr) {
  46.260 -        fprintf(stderr, "Need a counter number.\n");
  46.261 -        exit(1);
  46.262 -    }
  46.263 -
  46.264 -    escr_val = P4_ESCR_THREADS(t) | P4_ESCR_EVNTSEL(es) |
  46.265 -        P4_ESCR_EVNTMASK(em) | P4_ESCR_TV(tv) | ((te)?P4_ESCR_TE:0);
  46.266 -    cccr_val = P4_CCCR_ENABLE | P4_CCCR_ESCR(escr->number) |
  46.267 -        ((compare)?P4_CCCR_COMPARE:0) |
  46.268 -        ((complement)?P4_CCCR_COMPLEMENT:0) |
  46.269 -        ((edge)?P4_CCCR_EDGE:0) |
  46.270 -        P4_CCCR_ACTIVE_THREAD(3)/*reserved*/;
  46.271 -
  46.272 -    if (debug) {
  46.273 -        fprintf(stderr, "ESCR 0x%lx <= 0x%08lx\n", escr->msr_addr, escr_val);
  46.274 -        if (cccr->msr_addr != NO_CCCR)
  46.275 -            fprintf(stderr, "CCCR 0x%lx <= 0x%08lx (%u)\n",
  46.276 -                    cccr->msr_addr, cccr_val, cccr->number);
  46.277 -        if (pebs_x)
  46.278 -            fprintf(stderr, "PEBS 0x%x <= 0x%08lx\n",
  46.279 -                    MSR_P4_PEBS_ENABLE, pebs);
  46.280 -        if (pebs_vert_x)
  46.281 -            fprintf(stderr, "PMV  0x%x <= 0x%08lx\n",
  46.282 -                    MSR_P4_PEBS_MATRIX_VERT, pebs_vert);
  46.283 -    }
  46.284 -    
  46.285 -    cpus_wrmsr( cpu_mask, escr->msr_addr, escr_val, 0 );
  46.286 -    if (cccr->msr_addr != NO_CCCR)
  46.287 -        cpus_wrmsr( cpu_mask, cccr->msr_addr, cccr_val, 0 );
  46.288 -    
  46.289 -    if (pebs_x)
  46.290 -        cpus_wrmsr( cpu_mask, MSR_P4_PEBS_ENABLE, pebs, 0 );
  46.291 -    
  46.292 -    if (pebs_vert_x)
  46.293 -        cpus_wrmsr( cpu_mask, MSR_P4_PEBS_MATRIX_VERT, pebs_vert, 0 );
  46.294 -    
  46.295 -    return 0;
  46.296 -}
  46.297 -
  46.298 -// End of $RCSfile: cpuperf.c,v $
  46.299 -
    47.1 --- a/tools/misc/cpuperf/cpuperf_perfcntr.h	Fri Aug 25 16:21:39 2006 -0600
    47.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    47.3 @@ -1,41 +0,0 @@
    47.4 -/*
    47.5 - * Interface to JRB44's /proc/perfcntr interface.
    47.6 - *
    47.7 - * $Id: cpuperf_perfcntr.h,v 1.1 2003/10/13 16:49:44 jrb44 Exp $
    47.8 - *
    47.9 - * $Log: cpuperf_perfcntr.h,v $
   47.10 - * Revision 1.1  2003/10/13 16:49:44  jrb44
   47.11 - * Initial revision
   47.12 - *
   47.13 - */
   47.14 -
   47.15 -#define  PROC_PERFCNTR "/proc/perfcntr"
   47.16 -
   47.17 -static inline void perfcntr_wrmsr(int cpu_mask,
   47.18 -                                  int msr,
   47.19 -                                  unsigned int low,
   47.20 -                                  unsigned int high )
   47.21 -{
   47.22 -    FILE *fd;
   47.23 -    unsigned long long value = low | (((unsigned long long)high) << 32);
   47.24 -
   47.25 -    fd = fopen(PROC_PERFCNTR, "w");
   47.26 -    if (fd == NULL)
   47.27 -    {
   47.28 -        perror("open " PROC_PERFCNTR);
   47.29 -        exit(1);
   47.30 -    }
   47.31 -    
   47.32 -    fprintf(fd, "%x %x %llx \n", cpu_mask, msr, value);
   47.33 -    fprintf(stderr, "%x %x %llx \n", cpu_mask, msr, value);
   47.34 -    fclose(fd);
   47.35 -}
   47.36 -
   47.37 -static inline unsigned long long perfcntr_rdmsr( int cpu_mask, int msr )
   47.38 -{
   47.39 -    fprintf(stderr, "WARNING: rdmsr not yet implemented for perfcntr.\n");
   47.40 -    return 0;
   47.41 -}
   47.42 -
   47.43 -// End of $RCSfile: cpuperf_perfcntr.h,v $
   47.44 -
    48.1 --- a/tools/misc/cpuperf/cpuperf_xeno.h	Fri Aug 25 16:21:39 2006 -0600
    48.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    48.3 @@ -1,38 +0,0 @@
    48.4 -/*
    48.5 - * Interface to Xen MSR hypercalls.
    48.6 - * 
    48.7 - * $Id: cpuperf_xeno.h,v 1.1 2003/10/13 16:49:44 jrb44 Exp $
    48.8 - * 
    48.9 - * $Log: cpuperf_xeno.h,v $
   48.10 - * Revision 1.1  2003/10/13 16:49:44  jrb44
   48.11 - * Initial revision
   48.12 - *
   48.13 - */
   48.14 -
   48.15 -#include <xenctrl.h>
   48.16 -
   48.17 -static int xc_handle;
   48.18 -
   48.19 -void xen_init(void)
   48.20 -{
   48.21 -    if ( (xc_handle = xc_interface_open()) == -1 )
   48.22 -    {
   48.23 -        fprintf(stderr, "Error opening xc interface: %d (%s)\n",
   48.24 -                errno, strerror(errno));
   48.25 -        exit(-1);
   48.26 -    }
   48.27 -
   48.28 -}
   48.29 -
   48.30 -void dom0_wrmsr(int cpu_mask, int msr, unsigned int low, unsigned int high)
   48.31 -{
   48.32 -    xc_msr_write (xc_handle, cpu_mask, msr, low, high);
   48.33 -}
   48.34 -
   48.35 -unsigned long long dom0_rdmsr(int cpu_mask, int msr)
   48.36 -{
   48.37 -    return xc_msr_read(xc_handle, cpu_mask, msr);
   48.38 -}
   48.39 -
   48.40 -// End of $RCSfile: cpuperf_xeno.h,v $
   48.41 -
    49.1 --- a/tools/misc/cpuperf/module/Makefile	Fri Aug 25 16:21:39 2006 -0600
    49.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    49.3 @@ -1,16 +0,0 @@
    49.4 -#############################################################################
    49.5 -# (C) 2005 - Rolf Neugebauer - Intel Research Cambridge
    49.6 -#############################################################################
    49.7 -#
    49.8 -#        File: Makefile
    49.9 -#      Author: Rolf Neugebauer (rolf.neugebauer@intel.com)
   49.10 -#        Date: Mar 2005
   49.11 -# 
   49.12 -# Environment: 
   49.13 -#
   49.14 -
   49.15 -# invoke:
   49.16 -# make -C /lib/modules/`uname -r`/build SUBDIRS=`pwd` modules_install
   49.17 -
   49.18 -obj-m    := perfcntr.o
   49.19 -
    50.1 --- a/tools/misc/cpuperf/module/perfcntr.c	Fri Aug 25 16:21:39 2006 -0600
    50.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    50.3 @@ -1,730 +0,0 @@
    50.4 -/*
    50.5 - * Linux loadable kernel module to use P4 performance counters.
    50.6 - *
    50.7 - * James Bulpin, Feb 2003.
    50.8 - *
    50.9 - * $Id$
   50.10 - *
   50.11 - * $Log$
   50.12 - */
   50.13 -
   50.14 -#define DRV_NAME        "perfcntr"
   50.15 -#define DRV_VERSION     "0.2"
   50.16 -#define DRV_RELDATE     "02 Jun 2004"
   50.17 -
   50.18 -
   50.19 -#include <linux/module.h>
   50.20 -#include <linux/kernel.h>
   50.21 -#include <linux/init.h>
   50.22 -#include <linux/types.h>
   50.23 -#include <linux/proc_fs.h>
   50.24 -#include <linux/seq_file.h>
   50.25 -
   50.26 -#include <asm/uaccess.h>
   50.27 -#include <asm/pgtable.h>
   50.28 -#include <asm/io.h>
   50.29 -#include <asm/processor.h>
   50.30 -
   50.31 -#define NOHT
   50.32 -
   50.33 -#include "../p4perf.h"
   50.34 -
   50.35 -#ifdef NOHT
   50.36 -# define CPUMASK 0x00000003
   50.37 -#else
   50.38 -# define CPUMASK 0x00000005
   50.39 -#endif
   50.40 -
   50.41 -/*****************************************************************************
   50.42 - * Module admin                                                              *
   50.43 - *****************************************************************************/
   50.44 -
   50.45 -MODULE_AUTHOR("James Bulpin <James.Bulpin@cl.cam.ac.uk>");
   50.46 -MODULE_DESCRIPTION("P4 Performance Counters access "
   50.47 -                   DRV_VERSION " " DRV_RELDATE);
   50.48 -MODULE_LICENSE("GPL");
   50.49 -
   50.50 -static char version[] __devinitdata =
   50.51 -DRV_NAME ": James Bulpin.\n";
   50.52 -
   50.53 -static unsigned char foobar[4];
   50.54 -
   50.55 -/* rpcc: get full 64-bit Pentium TSC value
   50.56 - */
   50.57 -static __inline__ unsigned long long int rpcc(void) 
   50.58 -{
   50.59 -    unsigned int __h, __l;
   50.60 -    __asm__ __volatile__ ("rdtsc" :"=a" (__l), "=d" (__h));
   50.61 -    return (((unsigned long long)__h) << 32) + __l;
   50.62 -}
   50.63 -
   50.64 -/*****************************************************************************
   50.65 - * Display the counters                                                      *
   50.66 - *****************************************************************************/
   50.67 -
   50.68 -//#define processor cpu // post 2.4.16
   50.69 -
   50.70 -typedef union {
   50.71 -    struct {
   50.72 -        unsigned long lo;
   50.73 -        unsigned long hi;
   50.74 -    };
   50.75 -    unsigned long long cnt;
   50.76 -} cpu_perfcntr_t;
   50.77 -
   50.78 -typedef struct counters_t_struct {
   50.79 -    int                processor;
   50.80 -    unsigned long long tsc;
   50.81 -    cpu_perfcntr_t     counters[18];
   50.82 -} counters_t;
   50.83 -
   50.84 -typedef struct perfcntr_t_struct {
   50.85 -    unsigned long cpu_mask;
   50.86 -    counters_t    cpus[4]; // Actually for each cpu in system
   50.87 -} perfcntr_t;
   50.88 -
   50.89 -#ifdef HUMAN_READABLE
   50.90 -# define SHOW_COUNTER(c) rdmsr (c, l, h);\
   50.91 -    seq_printf(m, "0x%03x: 0x%08x%08x\n", c, h, l)
   50.92 -#else
   50.93 -# define SHOW_COUNTER(c) rdmsr (c, l, h);\
   50.94 -    seq_printf(m, " %llu", \
   50.95 -               (unsigned long long)h << 32 | (unsigned long long)l)
   50.96 -#endif
   50.97 -
   50.98 -#if 0
   50.99 -static unsigned long last_l = 0, last_h = 0, last_msr = 0;
  50.100 -static int last_cpu = 0;
  50.101 -#endif
  50.102 -
  50.103 -#define READ_COUNTER(_i, _msr) rdmsr((_msr), l, h); c->counters[_i].lo = l; \
  50.104 -    c->counters[_i].hi = h;
  50.105 -
  50.106 -static perfcntr_t perfcntrs;
  50.107 -
  50.108 -static void show_perfcntr_for(void *v)
  50.109 -{
  50.110 -    unsigned int l, h;
  50.111 -
  50.112 -    perfcntr_t *p = &perfcntrs;
  50.113 -    counters_t *c;
  50.114 -
  50.115 -    if (!((1 << smp_processor_id()) & p->cpu_mask))
  50.116 -        return;
  50.117 -
  50.118 -    c = &p->cpus[smp_processor_id()];
  50.119 -
  50.120 -    c->processor = smp_processor_id();
  50.121 -    c->tsc = rpcc();
  50.122 -
  50.123 -    READ_COUNTER(0,  MSR_P4_BPU_COUNTER0);
  50.124 -    READ_COUNTER(1,  MSR_P4_BPU_COUNTER1);
  50.125 -    READ_COUNTER(2,  MSR_P4_BPU_COUNTER2);
  50.126 -    READ_COUNTER(3,  MSR_P4_BPU_COUNTER3);
  50.127 -
  50.128 -    READ_COUNTER(4,  MSR_P4_MS_COUNTER0);
  50.129 -    READ_COUNTER(5,  MSR_P4_MS_COUNTER1);
  50.130 -    READ_COUNTER(6,  MSR_P4_MS_COUNTER2);
  50.131 -    READ_COUNTER(7,  MSR_P4_MS_COUNTER3);
  50.132 -
  50.133 -    READ_COUNTER(8,  MSR_P4_FLAME_COUNTER0);
  50.134 -    READ_COUNTER(9,  MSR_P4_FLAME_COUNTER1);
  50.135 -    READ_COUNTER(10, MSR_P4_FLAME_COUNTER2);
  50.136 -    READ_COUNTER(11, MSR_P4_FLAME_COUNTER3);
  50.137 -
  50.138 -    READ_COUNTER(12, MSR_P4_IQ_COUNTER0);
  50.139 -    READ_COUNTER(13, MSR_P4_IQ_COUNTER1);
  50.140 -    READ_COUNTER(14, MSR_P4_IQ_COUNTER2);
  50.141 -    READ_COUNTER(15, MSR_P4_IQ_COUNTER3);
  50.142 -    READ_COUNTER(16, MSR_P4_IQ_COUNTER4);
  50.143 -    READ_COUNTER(17, MSR_P4_IQ_COUNTER5);
  50.144 -
  50.145 -    return;    
  50.146 -}
  50.147 -
  50.148 -static int show_perfcntr(struct seq_file *m, void *v)
  50.149 -{
  50.150 -    int i, j;
  50.151 -
  50.152 -    // Get each physical cpu to read counters
  50.153 -    perfcntrs.cpu_mask = CPUMASK;
  50.154 -
  50.155 -    smp_call_function(show_perfcntr_for, NULL, 1, 1);
  50.156 -    show_perfcntr_for(NULL);
  50.157 -
  50.158 -    for (i = 0; i < 32; i++) {
  50.159 -        if (((1 << i) & (perfcntrs.cpu_mask = CPUMASK))) {
  50.160 -            counters_t *c = &perfcntrs.cpus[i];
  50.161 -            seq_printf(m, "%u %llu", c->processor, c->tsc);
  50.162 -            for (j = 0; j < 18; j++) {
  50.163 -                seq_printf(m, " %llu", c->counters[j].cnt);
  50.164 -            }
  50.165 -            seq_printf(m, "\n");
  50.166 -        }
  50.167 -    }
  50.168 -
  50.169 -#if 0
  50.170 -    unsigned long long t;
  50.171 -    unsigned int l, h;
  50.172 -
  50.173 -    t = rpcc();
  50.174 -
  50.175 -
  50.176 -
  50.177 -#ifdef HUMAN_READABLE
  50.178 -    seq_printf(m,
  50.179 -               "show_perfcntr\nprocessor: %u\ntime: %llu\n"
  50.180 -               "last write: 0x%08lx%08lx -> 0x%lx (CPU%u)\n",
  50.181 -               smp_processor_id(),
  50.182 -               t,
  50.183 -               last_h,
  50.184 -               last_l,
  50.185 -               last_msr,
  50.186 -               last_cpu);
  50.187 -#else
  50.188 -    seq_printf(m, "%u %llu", smp_processor_id(), t);
  50.189 -#endif
  50.190 -
  50.191 -    SHOW_COUNTER(MSR_P4_BPU_COUNTER0);
  50.192 -    SHOW_COUNTER(MSR_P4_BPU_COUNTER1);
  50.193 -    SHOW_COUNTER(MSR_P4_BPU_COUNTER2);
  50.194 -    SHOW_COUNTER(MSR_P4_BPU_COUNTER3);
  50.195 -
  50.196 -    SHOW_COUNTER(MSR_P4_MS_COUNTER0);
  50.197 -    SHOW_COUNTER(MSR_P4_MS_COUNTER1);
  50.198 -    SHOW_COUNTER(MSR_P4_MS_COUNTER2);
  50.199 -    SHOW_COUNTER(MSR_P4_MS_COUNTER3);
  50.200 -
  50.201 -    SHOW_COUNTER(MSR_P4_FLAME_COUNTER0);
  50.202 -    SHOW_COUNTER(MSR_P4_FLAME_COUNTER1);
  50.203 -    SHOW_COUNTER(MSR_P4_FLAME_COUNTER2);
  50.204 -    SHOW_COUNTER(MSR_P4_FLAME_COUNTER3);
  50.205 -
  50.206 -    SHOW_COUNTER(MSR_P4_IQ_COUNTER0);
  50.207 -    SHOW_COUNTER(MSR_P4_IQ_COUNTER1);
  50.208 -    SHOW_COUNTER(MSR_P4_IQ_COUNTER2);
  50.209 -    SHOW_COUNTER(MSR_P4_IQ_COUNTER3);
  50.210 -    SHOW_COUNTER(MSR_P4_IQ_COUNTER4);
  50.211 -    SHOW_COUNTER(MSR_P4_IQ_COUNTER5);
  50.212 -
  50.213 -#ifndef HUMAN_READBLE
  50.214 -    seq_printf(m, "\n");
  50.215 -#endif
  50.216 -
  50.217 -#endif
  50.218 -
  50.219 -    return 0;
  50.220 -}
  50.221 -
  50.222 -/*****************************************************************************
  50.223 - * Show counter configuration                                                *
  50.224 - *****************************************************************************/
  50.225 -
  50.226 -typedef union {
  50.227 -    struct {
  50.228 -        unsigned long lo;
  50.229 -        unsigned long hi;
  50.230 -    };
  50.231 -    unsigned long long cnt;
  50.232 -} cpu_perfcfg_t;
  50.233 -
  50.234 -typedef struct configs_t_struct {
  50.235 -    int                processor;
  50.236 -    unsigned long long tsc;
  50.237 -    cpu_perfcfg_t      cccr[18];
  50.238 -    cpu_perfcfg_t      escr[0x42];
  50.239 -} configs_t;
  50.240 -
  50.241 -typedef struct perfcfg_t_struct {
  50.242 -    unsigned long cpu_mask;
  50.243 -    configs_t     cpus[4]; // Actually for each cpu in system
  50.244 -} perfcfg_t;
  50.245 -
  50.246 -static perfcfg_t perfcfgs;
  50.247 -
  50.248 -#define READ_CCCR(_i, _msr) rdmsr((_msr), l, h); c->cccr[_i].lo = l; \
  50.249 -    c->cccr[_i].hi = h;
  50.250 -#define READ_ESCR(_i, _msr) rdmsr((_msr), l, h); c->escr[_i].lo = l; \
  50.251 -    c->escr[_i].hi = h;
  50.252 -
  50.253 -static void show_perfcfg_for(void *v)
  50.254 -{
  50.255 -    unsigned int l, h;
  50.256 -
  50.257 -    perfcfg_t *p = &perfcfgs;
  50.258 -    configs_t *c;
  50.259 -
  50.260 -    if (!((1 << smp_processor_id()) & p->cpu_mask))
  50.261 -        return;
  50.262 -
  50.263 -    c = &p->cpus[smp_processor_id()];
  50.264 -
  50.265 -    c->processor = smp_processor_id();
  50.266 -    c->tsc = rpcc();
  50.267 -
  50.268 -    READ_CCCR(0,  MSR_P4_BPU_CCCR0);
  50.269 -    READ_CCCR(1,  MSR_P4_BPU_CCCR1);
  50.270 -    READ_CCCR(2,  MSR_P4_BPU_CCCR2);
  50.271 -    READ_CCCR(3,  MSR_P4_BPU_CCCR3);
  50.272 -
  50.273 -    READ_CCCR(4,  MSR_P4_MS_CCCR0);
  50.274 -    READ_CCCR(5,  MSR_P4_MS_CCCR1);
  50.275 -    READ_CCCR(6,  MSR_P4_MS_CCCR2);
  50.276 -    READ_CCCR(7,  MSR_P4_MS_CCCR3);
  50.277 -
  50.278 -    READ_CCCR(8,  MSR_P4_FLAME_CCCR0);
  50.279 -    READ_CCCR(9,  MSR_P4_FLAME_CCCR1);
  50.280 -    READ_CCCR(10, MSR_P4_FLAME_CCCR2);
  50.281 -    READ_CCCR(11, MSR_P4_FLAME_CCCR3);
  50.282 -
  50.283 -    READ_CCCR(12, MSR_P4_IQ_CCCR0);
  50.284 -    READ_CCCR(13, MSR_P4_IQ_CCCR1);
  50.285 -    READ_CCCR(14, MSR_P4_IQ_CCCR2);
  50.286 -    READ_CCCR(15, MSR_P4_IQ_CCCR3);
  50.287 -    READ_CCCR(16, MSR_P4_IQ_CCCR4);
  50.288 -    READ_CCCR(17, MSR_P4_IQ_CCCR5);
  50.289 -
  50.290 -    READ_ESCR(0x00, MSR_P4_BSU_ESCR0);
  50.291 -    READ_ESCR(0x02, MSR_P4_FSB_ESCR0);
  50.292 -    READ_ESCR(0x0a, MSR_P4_MOB_ESCR0);
  50.293 -    READ_ESCR(0x0c, MSR_P4_PMH_ESCR0);
  50.294 -    READ_ESCR(0x12, MSR_P4_BPU_ESCR0);
  50.295 -    READ_ESCR(0x14, MSR_P4_IS_ESCR0);
  50.296 -    READ_ESCR(0x16, MSR_P4_ITLB_ESCR0);
  50.297 -    READ_ESCR(0x28, MSR_P4_IX_ESCR0);
  50.298 -    READ_ESCR(0x01, MSR_P4_BSU_ESCR1);
  50.299 -    READ_ESCR(0x03, MSR_P4_FSB_ESCR1);
  50.300 -    READ_ESCR(0x0b, MSR_P4_MOB_ESCR1);
  50.301 -    READ_ESCR(0x0d, MSR_P4_PMH_ESCR1);
  50.302 -    READ_ESCR(0x13, MSR_P4_BPU_ESCR1);
  50.303 -    READ_ESCR(0x15, MSR_P4_IS_ESCR1);
  50.304 -    READ_ESCR(0x17, MSR_P4_ITLB_ESCR1);
  50.305 -    READ_ESCR(0x29, MSR_P4_IX_ESCR1);
  50.306 -    READ_ESCR(0x20, MSR_P4_MS_ESCR0);
  50.307 -    READ_ESCR(0x22, MSR_P4_TBPU_ESCR0);
  50.308 -    READ_ESCR(0x24, MSR_P4_TC_ESCR0);
  50.309 -    READ_ESCR(0x21, MSR_P4_MS_ESCR1);
  50.310 -    READ_ESCR(0x23, MSR_P4_TBPU_ESCR1);
  50.311 -    READ_ESCR(0x25, MSR_P4_TC_ESCR1);
  50.312 -    READ_ESCR(0x04, MSR_P4_FIRM_ESCR0);
  50.313 -    READ_ESCR(0x06, MSR_P4_FLAME_ESCR0);
  50.314 -    READ_ESCR(0x08, MSR_P4_DAC_ESCR0);
  50.315 -    READ_ESCR(0x0e, MSR_P4_SAAT_ESCR0);
  50.316 -    READ_ESCR(0x10, MSR_P4_U2L_ESCR0);
  50.317 -    READ_ESCR(0x05, MSR_P4_FIRM_ESCR1);
  50.318 -    READ_ESCR(0x07, MSR_P4_FLAME_ESCR1);
  50.319 -    READ_ESCR(0x09, MSR_P4_DAC_ESCR1);
  50.320 -    READ_ESCR(0x0f, MSR_P4_SAAT_ESCR1);
  50.321 -    READ_ESCR(0x11, MSR_P4_U2L_ESCR1);
  50.322 -    READ_ESCR(0x18, MSR_P4_CRU_ESCR0);
  50.323 -    READ_ESCR(0x2c, MSR_P4_CRU_ESCR2);
  50.324 -    READ_ESCR(0x40, MSR_P4_CRU_ESCR4);
  50.325 -    READ_ESCR(0x1a, MSR_P4_IQ_ESCR0);
  50.326 -    READ_ESCR(0x1c, MSR_P4_RAT_ESCR0);
  50.327 -    READ_ESCR(0x1e, MSR_P4_SSU_ESCR0);
  50.328 -    READ_ESCR(0x2a, MSR_P4_ALF_ESCR0);
  50.329 -    READ_ESCR(0x19, MSR_P4_CRU_ESCR1);
  50.330 -    READ_ESCR(0x2d, MSR_P4_CRU_ESCR3);
  50.331 -    READ_ESCR(0x41, MSR_P4_CRU_ESCR5);
  50.332 -    READ_ESCR(0x1b, MSR_P4_IQ_ESCR1);
  50.333 -    READ_ESCR(0x1d, MSR_P4_RAT_ESCR1);
  50.334 -    READ_ESCR(0x2b, MSR_P4_ALF_ESCR1);
  50.335 -
  50.336 -    return;    
  50.337 -}
  50.338 -
  50.339 -static char *escr_names[] = {
  50.340 -    "BSU_ESCR0",
  50.341 -    "BSU_ESCR1",
  50.342 -    "FSB_ESCR0",
  50.343 -    "FSB_ESCR1",
  50.344 -    "FIRM_ESCR0",
  50.345 -    "FIRM_ESCR1",
  50.346 -    "FLAME_ESCR0",
  50.347 -    "FLAME_ESCR1",
  50.348 -    "DAC_ESCR0",
  50.349 -    "DAC_ESCR1",
  50.350 -    "MOB_ESCR0",
  50.351 -    "MOB_ESCR1",
  50.352 -    "PMH_ESCR0",
  50.353 -    "PMH_ESCR1",
  50.354 -    "SAAT_ESCR0",
  50.355 -    "SAAT_ESCR1",
  50.356 -    "U2L_ESCR0",
  50.357 -    "U2L_ESCR1",
  50.358 -    "BPU_ESCR0",
  50.359 -    "BPU_ESCR1",
  50.360 -    "IS_ESCR0",
  50.361 -    "IS_ESCR1",
  50.362 -    "ITLB_ESCR0",
  50.363 -    "ITLB_ESCR1",
  50.364 -    "CRU_ESCR0",
  50.365 -    "CRU_ESCR1",
  50.366 -    "IQ_ESCR0",
  50.367 -    "IQ_ESCR1",
  50.368 -    "RAT_ESCR0",
  50.369 -    "RAT_ESCR1",
  50.370 -    "SSU_ESCR0",
  50.371 -    "SSU_ESCR1",
  50.372 -    "MS_ESCR0",
  50.373 -    "MS_ESCR1",
  50.374 -    "TBPU_ESCR0",
  50.375 -    "TBPU_ESCR1",
  50.376 -    "TC_ESCR0",
  50.377 -    "TC_ESCR1",
  50.378 -    "0x3c6",
  50.379 -    "0x3c7",
  50.380 -    "IX_ESCR0",
  50.381 -    "IX_ESCR1",
  50.382 -    "ALF_ESCR0",
  50.383 -    "ALF_ESCR1",
  50.384 -    "CRU_ESCR2",
  50.385 -    "CRU_ESCR3",
  50.386 -    "0x3ce",
  50.387 -    "0x3cf",
  50.388 -    "0x3d0",
  50.389 -    "0x3d1",
  50.390 -    "0x3d2",
  50.391 -    "0x3d3",
  50.392 -    "0x3d4",
  50.393 -    "0x3d5",
  50.394 -    "0x3d6",
  50.395 -    "0x3d7",
  50.396 -    "0x3d8",
  50.397 -    "0x3d9",
  50.398 -    "0x3da",
  50.399 -    "0x3db",
  50.400 -    "0x3dc",
  50.401 -    "0x3dd",
  50.402 -    "0x3de",
  50.403 -    "0x3df",
  50.404 -    "CRU_ESCR4",
  50.405 -    "CRU_ESCR5"
  50.406 -};
  50.407 -
  50.408 -static unsigned long escr_map_0[] = 
  50.409 -{MSR_P4_BPU_ESCR0, MSR_P4_IS_ESCR0,
  50.410 - MSR_P4_MOB_ESCR0, MSR_P4_ITLB_ESCR0,
  50.411 - MSR_P4_PMH_ESCR0, MSR_P4_IX_ESCR0,
  50.412 - MSR_P4_FSB_ESCR0, MSR_P4_BSU_ESCR0}; //BPU even
  50.413 -static unsigned long escr_map_1[] = 
  50.414 -    {MSR_P4_BPU_ESCR1, MSR_P4_IS_ESCR1,
  50.415 -     MSR_P4_MOB_ESCR1, MSR_P4_ITLB_ESCR1,
  50.416 -     MSR_P4_PMH_ESCR1, MSR_P4_IX_ESCR1,
  50.417 -     MSR_P4_FSB_ESCR1, MSR_P4_BSU_ESCR1}; //BPU odd
  50.418 -static unsigned long escr_map_2[] = 
  50.419 -    {MSR_P4_MS_ESCR0, MSR_P4_TC_ESCR0, MSR_P4_TBPU_ESCR0,
  50.420 -     0, 0, 0, 0, 0}; //MS even
  50.421 -static unsigned long escr_map_3[] = 
  50.422 -    {MSR_P4_MS_ESCR1, MSR_P4_TC_ESCR1, MSR_P4_TBPU_ESCR1,
  50.423 -     0, 0, 0, 0, 0}; //MS odd
  50.424 -static unsigned long escr_map_4[] = 
  50.425 -    {MSR_P4_FLAME_ESCR0, MSR_P4_FIRM_ESCR0, MSR_P4_SAAT_ESCR0,
  50.426 -     MSR_P4_U2L_ESCR0, 0, MSR_P4_DAC_ESCR0, 0, 0}; //FLAME even
  50.427 -static unsigned long escr_map_5[] = 
  50.428 -    {MSR_P4_FLAME_ESCR1, MSR_P4_FIRM_ESCR1, MSR_P4_SAAT_ESCR1,
  50.429 -     MSR_P4_U2L_ESCR1, 0, MSR_P4_DAC_ESCR1, 0, 0}; //FLAME odd
  50.430 -static unsigned long escr_map_6[] = 
  50.431 -    {MSR_P4_IQ_ESCR0, MSR_P4_ALF_ESCR0,
  50.432 -     MSR_P4_RAT_ESCR0, MSR_P4_SSU_ESCR0,
  50.433 -     MSR_P4_CRU_ESCR0, MSR_P4_CRU_ESCR2, MSR_P4_CRU_ESCR4, 0}; //IQ even
  50.434 -static unsigned long escr_map_7[] = 
  50.435 -    {MSR_P4_IQ_ESCR1, MSR_P4_ALF_ESCR1,
  50.436 -     MSR_P4_RAT_ESCR1, 0,
  50.437 -     MSR_P4_CRU_ESCR1, MSR_P4_CRU_ESCR3, MSR_P4_CRU_ESCR5, 0}; //IQ odd
  50.438 -
  50.439 -static unsigned long *escr_map[] = {
  50.440 -    escr_map_0,
  50.441 -    escr_map_1,
  50.442 -    escr_map_2,
  50.443 -    escr_map_3,
  50.444 -    escr_map_4,
  50.445 -    escr_map_5,
  50.446 -    escr_map_6,
  50.447 -    escr_map_7,
  50.448 -};
  50.449 -
  50.450 -unsigned long get_escr_msr(int c, int e)
  50.451 -{
  50.452 -    int index = -1;
  50.453 -
  50.454 -    // Get the ESCR MSR address from the counter number and the ESCR number.
  50.455 -    switch (c) {
  50.456 -    case P4_BPU_COUNTER0_NUMBER:
  50.457 -    case P4_BPU_COUNTER1_NUMBER:
  50.458 -	index = 0;
  50.459 -	break;
  50.460 -    case P4_BPU_COUNTER2_NUMBER:
  50.461 -    case P4_BPU_COUNTER3_NUMBER:	
  50.462 -	index = 1;
  50.463 -	break;
  50.464 -    case P4_MS_COUNTER0_NUMBER:
  50.465 -    case P4_MS_COUNTER1_NUMBER:
  50.466 -	index = 2; // probably !
  50.467 -	break;
  50.468 -    case P4_MS_COUNTER2_NUMBER:
  50.469 -    case P4_MS_COUNTER3_NUMBER:
  50.470 -	index = 3; // probably !
  50.471 -	break;
  50.472 -    case P4_FLAME_COUNTER0_NUMBER:
  50.473 -    case P4_FLAME_COUNTER1_NUMBER:
  50.474 -	index = 4; // probably !
  50.475 -	break;
  50.476 -    case P4_FLAME_COUNTER2_NUMBER:
  50.477 -    case P4_FLAME_COUNTER3_NUMBER:
  50.478 -	index = 5; // probably !
  50.479 -	break;
  50.480 -    case P4_IQ_COUNTER0_NUMBER:
  50.481 -    case P4_IQ_COUNTER1_NUMBER:
  50.482 -    case P4_IQ_COUNTER4_NUMBER:
  50.483 -	index = 6;
  50.484 -	break;
  50.485 -    case P4_IQ_COUNTER2_NUMBER:
  50.486 -    case P4_IQ_COUNTER3_NUMBER:
  50.487 -    case P4_IQ_COUNTER5_NUMBER:
  50.488 -	index = 7;
  50.489 -	break;
  50.490 -    }
  50.491 -
  50.492 -    if (index != -1) {
  50.493 -	return escr_map[index][e];
  50.494 -    }
  50.495 -
  50.496 -    return 0;
  50.497 -}
  50.498 -
  50.499 -static char null_string[] = "";
  50.500 -static char *get_escr(int c, int e)
  50.501 -{
  50.502 -    unsigned long msr = get_escr_msr(c, e);
  50.503 -
  50.504 -    if ((msr >= 0x3a0) && (msr <= 0x3e1))
  50.505 -	return escr_names[(int)(msr - 0x3a0)];
  50.506 -    return null_string;
  50.507 -}
  50.508 -
  50.509 -static int show_perfcfg(struct seq_file *m, void *v)
  50.510 -{
  50.511 -    int i, j;
  50.512 -
  50.513 -    // Get each physical cpu to read configs
  50.514 -    perfcfgs.cpu_mask = CPUMASK;
  50.515 -
  50.516 -    smp_call_function(show_perfcfg_for, NULL, 1, 1);
  50.517 -    show_perfcfg_for(NULL);
  50.518 -
  50.519 -    for (i = 0; i < 32; i++) {
  50.520 -        if (((1 << i) & (perfcfgs.cpu_mask = CPUMASK))) {
  50.521 -            configs_t *c = &perfcfgs.cpus[i];
  50.522 -            seq_printf(m, "----------------------------------------\n");
  50.523 -            seq_printf(m, "%u %llu\n", c->processor, c->tsc);
  50.524 -            for (j = 0; j < 18; j++) {
  50.525 -                seq_printf(m, "%08lx", c->cccr[j].lo);
  50.526 -
  50.527 -		if (!(c->cccr[j].lo & P4_CCCR_ENABLE))
  50.528 -		    seq_printf(m, " DISABLED");
  50.529 -		else {
  50.530 -		    unsigned long escr_msr =
  50.531 -			get_escr_msr(i, (int)((c->cccr[j].lo >> 13)&7));
  50.532 -		    seq_printf(m, " ESCR=%s",
  50.533 -			       get_escr(i, (int)((c->cccr[j].lo >> 13)&7)));
  50.534 -		    if ((escr_msr >= 0x3a0) && (escr_msr <= 0x3e1)) {
  50.535 -			unsigned long e = c->escr[(int)(escr_msr - 0x3a0)].lo;
  50.536 -			seq_printf(m, "(%08lx es=%lx mask=%lx", e,
  50.537 -				   (e >> 25) & 0x7f,
  50.538 -				   (e >> 9) & 0xffff);
  50.539 -			if ((e & P4_ESCR_T0_USR))
  50.540 -			    seq_printf(m, " T(0)USR");
  50.541 -			if ((e & P4_ESCR_T0_OS))
  50.542 -			    seq_printf(m, " T(0)OS");
  50.543 -			if ((e & P4_ESCR_T1_USR))
  50.544 -			    seq_printf(m, " T1USR");
  50.545 -			if ((e & P4_ESCR_T1_OS))
  50.546 -			    seq_printf(m, " T1OS");
  50.547 -			seq_printf(m, ")");
  50.548 -		    }
  50.549 -		    seq_printf(m, " AT=%u", (int)((c->cccr[j].lo >> 16)&3));
  50.550 -
  50.551 -		    if ((c->cccr[j].lo & P4_CCCR_OVF))
  50.552 -			seq_printf(m, " OVF");
  50.553 -		    if ((c->cccr[j].lo & P4_CCCR_CASCADE))
  50.554 -			seq_printf(m, " CASC");
  50.555 -		    if ((c->cccr[j].lo & P4_CCCR_FORCE_OVF))
  50.556 -			seq_printf(m, " F-OVF");
  50.557 -		    if ((c->cccr[j].lo & P4_CCCR_EDGE))
  50.558 -			seq_printf(m, " EDGE");
  50.559 -		    if ((c->cccr[j].lo & P4_CCCR_COMPLEMENT))
  50.560 -			seq_printf(m, " COMPL");
  50.561 -		    if ((c->cccr[j].lo & P4_CCCR_COMPARE))
  50.562 -			seq_printf(m, " CMP");
  50.563 -		    if ((c->cccr[j].lo & P4_CCCR_OVF_PMI_T0))
  50.564 -			seq_printf(m, " OVF_PMI(_T0)");
  50.565 -		    if ((c->cccr[j].lo & P4_CCCR_OVF_PMI_T1))
  50.566 -			seq_printf(m, " OVF_PMI_T1");
  50.567 -		}
  50.568 -		seq_printf(m, "\n");
  50.569 -            }
  50.570 -        }
  50.571 -    }
  50.572 -
  50.573 -    return 0;
  50.574 -}
  50.575 -
  50.576 -/*****************************************************************************
  50.577 - * Handle writes                                                             *
  50.578 - *****************************************************************************/
  50.579 -
  50.580 -static int set_msr_cpu_mask;
  50.581 -static unsigned long set_msr_addr;
  50.582 -static unsigned long set_msr_lo;
  50.583 -static unsigned long set_msr_hi;
  50.584 -
  50.585 -static void perfcntr_write_for(void *unused)
  50.586 -{
  50.587 -#ifdef NOHT
  50.588 -    if (((1 << smp_processor_id()) & set_msr_cpu_mask)) {
  50.589 -#endif
  50.590 -        //printk("perfcntr: wrmsr(%08lx, %08lx, %08lx)\n",
  50.591 -        //     set_msr_addr, set_msr_lo, set_msr_hi);
  50.592 -        wrmsr(set_msr_addr, set_msr_lo, set_msr_hi);
  50.593 -#ifdef NOHT
  50.594 -    }
  50.595 -#endif
  50.596 -}
  50.597 -
  50.598 -ssize_t perfcntr_write(struct file *f,
  50.599 -                       const  char *data,
  50.600 -                       size_t       size,
  50.601 -                       loff_t      *pos)
  50.602 -{
  50.603 -    char         *endp;
  50.604 -    ssize_t       ret = 0;
  50.605 -    //unsigned long l, h, msr;
  50.606 -    unsigned long long v;
  50.607 -
  50.608 -    set_msr_cpu_mask = (int)simple_strtoul(data, &endp, 16);
  50.609 -    endp++; // skip past space
  50.610 -    if ((endp - data) >= size) {
  50.611 -        ret = -EINVAL;
  50.612 -        goto out;
  50.613 -    }
  50.614 -
  50.615 -    set_msr_addr = simple_strtoul(endp, &endp, 16);
  50.616 -    endp++; // skip past space
  50.617 -    if ((endp - data) >= size) {
  50.618 -        ret = -EINVAL;
  50.619 -        goto out;
  50.620 -    }
  50.621 -    
  50.622 -    v = simple_strtoul(endp, &endp, 16);
  50.623 -    set_msr_lo = (unsigned long)(v & 0xffffffffULL);
  50.624 -    set_msr_hi = (unsigned long)(v >> 32);
  50.625 -
  50.626 -    smp_call_function(perfcntr_write_for, NULL, 1, 1);
  50.627 -    perfcntr_write_for(NULL);    
  50.628 -
  50.629 -#if 0
  50.630 -    wrmsr(msr, l, h);
  50.631 -    last_l   = l;
  50.632 -    last_h   = h;
  50.633 -    last_msr = msr;
  50.634 -    last_cpu = smp_processor_id();
  50.635 -#endif
  50.636 -    ret = size;
  50.637 -
  50.638 - out:
  50.639 -    return ret;
  50.640 -}
  50.641 -
  50.642 -/*****************************************************************************
  50.643 - * /proc stuff                                                               *
  50.644 - *****************************************************************************/
  50.645 -
  50.646 -static void *c_start(struct seq_file *m, loff_t *pos)
  50.647 -{
  50.648 -    //return *pos < NR_CPUS ? cpu_data + *pos : NULL;
  50.649 -    return *pos == 0 ? foobar : NULL;
  50.650 -}
  50.651 -
  50.652 -static void *c_next(struct seq_file *m, void *v, loff_t *pos)
  50.653 -{
  50.654 -    ++*pos;
  50.655 -    return c_start(m, pos);
  50.656 -}
  50.657 -
  50.658 -static void c_stop(struct seq_file *m, void *v)
  50.659 -{
  50.660 -}
  50.661 -
  50.662 -struct seq_operations perfcntr_op = {
  50.663 -    start:  c_start,
  50.664 -    next:   c_next,
  50.665 -    stop:   c_stop,
  50.666 -    show:   show_perfcntr,
  50.667 -};
  50.668 -
  50.669 -struct seq_operations perfcfg_op = {
  50.670 -    start:  c_start,
  50.671 -    next:   c_next,
  50.672 -    stop:   c_stop,
  50.673 -    show:   show_perfcfg,
  50.674 -};
  50.675 -
  50.676 -static int perfcntr_open(struct inode *inode, struct file *file)
  50.677 -{
  50.678 -    return seq_open(file, &perfcntr_op);
  50.679 -}
  50.680 -
  50.681 -static int perfcfg_open(struct inode *inode, struct file *file)
  50.682 -{
  50.683 -    return seq_open(file, &perfcfg_op);
  50.684 -}
  50.685 -
  50.686 -static struct file_operations proc_perfcntr_operations = {
  50.687 -    open:           perfcntr_open,
  50.688 -    read:           seq_read,
  50.689 -    write:          perfcntr_write,
  50.690 -    llseek:         seq_lseek,
  50.691 -    release:        seq_release,
  50.692 -};
  50.693 -
  50.694 -static struct file_operations proc_perfcfg_operations = {
  50.695 -    open:           perfcfg_open,
  50.696 -    read:           seq_read,
  50.697 -    write:          perfcntr_write,
  50.698 -    llseek:         seq_lseek,
  50.699 -    release:        seq_release,
  50.700 -};
  50.701 -
  50.702 -static void create_seq_entry(char *name, mode_t mode, struct file_operations *f)
  50.703 -{
  50.704 -    struct proc_dir_entry *entry;
  50.705 -    entry = create_proc_entry(name, mode, NULL);
  50.706 -    if (entry)
  50.707 -        entry->proc_fops = f;
  50.708 -}
  50.709 -
  50.710 -/*****************************************************************************
  50.711 - * Module init and cleanup                                                   *
  50.712 - *****************************************************************************/
  50.713 -
  50.714 -static int __init perfcntr_init(void)
  50.715 -{
  50.716 -    printk(version);
  50.717 -
  50.718 -    create_seq_entry("perfcntr", 0777, &proc_perfcntr_operations);
  50.719 -    create_seq_entry("perfcntr_config", 0777, &proc_perfcfg_operations);
  50.720 -
  50.721 -    return 0;
  50.722 -}
  50.723 -
  50.724 -static void __exit perfcntr_exit(void)
  50.725 -{
  50.726 -    remove_proc_entry("perfcntr", NULL);
  50.727 -    remove_proc_entry("perfcntr_config", NULL);
  50.728 -}
  50.729 -
  50.730 -module_init(perfcntr_init);
  50.731 -module_exit(perfcntr_exit);
  50.732 -
  50.733 -/* End of $RCSfile$ */
    51.1 --- a/tools/misc/cpuperf/p4perf.h	Fri Aug 25 16:21:39 2006 -0600
    51.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    51.3 @@ -1,382 +0,0 @@
    51.4 -/*
    51.5 - * P4 Performance counter stuff.
    51.6 - *
    51.7 - * P4 Xeon with Hyperthreading has counters per physical package which can
    51.8 - * count events from either logical CPU. However, in many cases more than
    51.9 - * ECSR and CCCR/counter can be used to count the same event. For instr or
   51.10 - * uops retired, use either ESCR0/IQ_CCCR0 ESCR1/IQ_CCCR2.
   51.11 - *
   51.12 - * $Id: p4perf.h,v 1.2 2003/10/13 16:51:41 jrb44 Exp $
   51.13 - *
   51.14 - * $Log: p4perf.h,v $
   51.15 - * Revision 1.2  2003/10/13 16:51:41  jrb44
   51.16 - * *** empty log message ***
   51.17 - *
   51.18 - */
   51.19 -
   51.20 -#ifndef P4PERF_H
   51.21 -#define P4PERF_H
   51.22 -
   51.23 -#ifdef __KERNEL__
   51.24 -#include <asm/msr.h>
   51.25 -#endif
   51.26 -
   51.27 -/*****************************************************************************
   51.28 - * Performance counter configuration.                                        *
   51.29 - *****************************************************************************/
   51.30 -
   51.31 -#ifndef P6_EVNTSEL_OS
   51.32 -# define P6_EVNTSEL_OS     (1 << 17)
   51.33 -# define P6_EVNTSEL_USR    (1 << 16)
   51.34 -# define P6_EVNTSEL_E      (1 << 18)
   51.35 -# define P6_EVNTSEL_EN     (1 << 22)
   51.36 -#endif
   51.37 -#define P6_PERF_INST_RETIRED 0xc0
   51.38 -#define P6_PERF_UOPS_RETIRED 0xc2
   51.39 -
   51.40 -#define P4_ESCR_USR                    (1 << 2)
   51.41 -#define P4_ESCR_OS                     (1 << 3)
   51.42 -#define P4_ESCR_T0_USR                 (1 << 2) /* First logical CPU  */
   51.43 -#define P4_ESCR_T0_OS                  (1 << 3)
   51.44 -#define P4_ESCR_T1_USR                 (1 << 0) /* Second logical CPU */
   51.45 -#define P4_ESCR_T1_OS                  (1 << 1)
   51.46 -#define P4_ESCR_TE                     (1 << 4)
   51.47 -#define P4_ESCR_THREADS(t)             (t)
   51.48 -#define P4_ESCR_TV(tag)                (tag << 5)
   51.49 -#define P4_ESCR_EVNTSEL(e)             (e << 25)
   51.50 -#define P4_ESCR_EVNTMASK(e)            (e << 9)
   51.51 -
   51.52 -#define P4_ESCR_EVNTSEL_FRONT_END      0x08
   51.53 -#define P4_ESCR_EVNTSEL_EXECUTION      0x0c
   51.54 -#define P4_ESCR_EVNTSEL_REPLAY         0x09
   51.55 -#define P4_ESCR_EVNTSEL_INSTR_RETIRED  0x02
   51.56 -#define P4_ESCR_EVNTSEL_UOPS_RETIRED   0x01
   51.57 -#define P4_ESCR_EVNTSEL_UOP_TYPE       0x02
   51.58 -#define P4_ESCR_EVNTSEL_RET_MBR_TYPE   0x05
   51.59 -//#define P4_ESCR_EVNTSEL_RET_MBR_TYPE   0x04
   51.60 -
   51.61 -#define P4_ESCR_EVNTMASK_FE_NBOGUS     0x01
   51.62 -#define P4_ESCR_EVNTMASK_FE_BOGUS      0x02
   51.63 -
   51.64 -#define P4_ESCR_EVNTMASK_EXEC_NBOGUS0  0x01
   51.65 -#define P4_ESCR_EVNTMASK_EXEC_NBOGUS1  0x02
   51.66 -#define P4_ESCR_EVNTMASK_EXEC_NBOGUS2  0x04
   51.67 -#define P4_ESCR_EVNTMASK_EXEC_NBOGUS3  0x08
   51.68 -#define P4_ESCR_EVNTMASK_EXEC_BOGUS0   0x10
   51.69 -#define P4_ESCR_EVNTMASK_EXEC_BOGUS1   0x20
   51.70 -#define P4_ESCR_EVNTMASK_EXEC_BOGUS2   0x40
   51.71 -#define P4_ESCR_EVNTMASK_EXEC_BOGUS3   0x80
   51.72 -
   51.73 -#define P4_ESCR_EVNTMASK_REPLAY_NBOGUS 0x01
   51.74 -#define P4_ESCR_EVNTMASK_REPLAY_BOGUS  0x02
   51.75 -
   51.76 -#define P4_ESCR_EVNTMASK_IRET_NB_NTAG  0x01
   51.77 -#define P4_ESCR_EVNTMASK_IRET_NB_TAG   0x02
   51.78 -#define P4_ESCR_EVNTMASK_IRET_B_NTAG   0x04
   51.79 -#define P4_ESCR_EVNTMASK_IRET_B_TAG    0x08
   51.80 -
   51.81 -#define P4_ESCR_EVNTMASK_URET_NBOGUS   0x01
   51.82 -#define P4_ESCR_EVNTMASK_URET_BOGUS    0x02
   51.83 -
   51.84 -#define P4_ESCR_EVNTMASK_UOP_LOADS     0x02
   51.85 -#define P4_ESCR_EVNTMASK_UOP_STORES    0x04
   51.86 -
   51.87 -#define P4_ESCR_EVNTMASK_RMBRT_COND    0x02
   51.88 -#define P4_ESCR_EVNTMASK_RMBRT_CALL    0x04
   51.89 -#define P4_ESCR_EVNTMASK_RMBRT_RETURN  0x08
   51.90 -#define P4_ESCR_EVNTMASK_RMBRT_INDIR   0x10
   51.91 -
   51.92 -#define P4_ESCR_EVNTMASK_RBRT_COND     0x02
   51.93 -#define P4_ESCR_EVNTMASK_RBRT_CALL     0x04
   51.94 -#define P4_ESCR_EVNTMASK_RBRT_RETURN   0x08
   51.95 -#define P4_ESCR_EVNTMASK_RBRT_INDIR    0x10
   51.96 -
   51.97 -//#define P4_ESCR_EVNTMASK_INSTR_RETIRED 0x01  /* Non bogus, not tagged */
   51.98 -//#define P4_ESCR_EVNTMASK_UOPS_RETIRED  0x01  /* Non bogus             */
   51.99 -
  51.100 -#define P4_CCCR_OVF                    (1 << 31)
  51.101 -#define P4_CCCR_CASCADE                (1 << 30)
  51.102 -#define P4_CCCR_FORCE_OVF              (1 << 25)
  51.103 -#define P4_CCCR_EDGE                   (1 << 24)
  51.104 -#define P4_CCCR_COMPLEMENT             (1 << 19)
  51.105 -#define P4_CCCR_COMPARE                (1 << 18)
  51.106 -#define P4_CCCR_THRESHOLD(t)           (t << 20)
  51.107 -#define P4_CCCR_ENABLE                 (1 << 12)
  51.108 -#define P4_CCCR_ESCR(escr)             (escr << 13)
  51.109 -#define P4_CCCR_ACTIVE_THREAD(t)       (t << 16)   /* Set to 11 */
  51.110 -#define P4_CCCR_OVF_PMI_T0             (1 << 26)
  51.111 -#define P4_CCCR_OVF_PMI_T1             (1 << 27)
  51.112 -#define P4_CCCR_RESERVED               (3 << 16)
  51.113 -#define P4_CCCR_OVF_PMI                (1 << 26)
  51.114 -
  51.115 -// BPU
  51.116 -#define MSR_P4_BPU_COUNTER0            0x300
  51.117 -#define MSR_P4_BPU_COUNTER1            0x301
  51.118 -#define MSR_P4_BPU_CCCR0               0x360
  51.119 -#define MSR_P4_BPU_CCCR1               0x361
  51.120 -
  51.121 -#define MSR_P4_BPU_COUNTER2            0x302
  51.122 -#define MSR_P4_BPU_COUNTER3            0x303
  51.123 -#define MSR_P4_BPU_CCCR2               0x362
  51.124 -#define MSR_P4_BPU_CCCR3               0x363
  51.125 -
  51.126 -#define MSR_P4_BSU_ESCR0               0x3a0
  51.127 -#define MSR_P4_FSB_ESCR0               0x3a2
  51.128 -#define MSR_P4_MOB_ESCR0               0x3aa
  51.129 -#define MSR_P4_PMH_ESCR0               0x3ac
  51.130 -#define MSR_P4_BPU_ESCR0               0x3b2
  51.131 -#define MSR_P4_IS_ESCR0                0x3b4
  51.132 -#define MSR_P4_ITLB_ESCR0              0x3b6
  51.133 -#define MSR_P4_IX_ESCR0                0x3c8
  51.134 -
  51.135 -#define P4_BSU_ESCR0_NUMBER            7
  51.136 -#define P4_FSB_ESCR0_NUMBER            6
  51.137 -#define P4_MOB_ESCR0_NUMBER            2
  51.138 -#define P4_PMH_ESCR0_NUMBER            4
  51.139 -#define P4_BPU_ESCR0_NUMBER            0
  51.140 -#define P4_IS_ESCR0_NUMBER             1
  51.141 -#define P4_ITLB_ESCR0_NUMBER           3
  51.142 -#define P4_IX_ESCR0_NUMBER             5
  51.143 -
  51.144 -#define MSR_P4_BSU_ESCR1               0x3a1
  51.145 -#define MSR_P4_FSB_ESCR1               0x3a3
  51.146 -#define MSR_P4_MOB_ESCR1               0x3ab
  51.147 -#define MSR_P4_PMH_ESCR1               0x3ad
  51.148 -#define MSR_P4_BPU_ESCR1               0x3b3
  51.149 -#define MSR_P4_IS_ESCR1                0x3b5
  51.150 -#define MSR_P4_ITLB_ESCR1              0x3b7
  51.151 -#define MSR_P4_IX_ESCR1                0x3c9
  51.152 -
  51.153 -#define P4_BSU_ESCR1_NUMBER            7
  51.154 -#define P4_FSB_ESCR1_NUMBER            6
  51.155 -#define P4_MOB_ESCR1_NUMBER            2
  51.156 -#define P4_PMH_ESCR1_NUMBER            4
  51.157 -#define P4_BPU_ESCR1_NUMBER            0
  51.158 -#define P4_IS_ESCR1_NUMBER             1
  51.159 -#define P4_ITLB_ESCR1_NUMBER           3
  51.160 -#define P4_IX_ESCR1_NUMBER             5
  51.161 -
  51.162 -// MS
  51.163 -#define MSR_P4_MS_COUNTER0             0x304
  51.164 -#define MSR_P4_MS_COUNTER1             0x305
  51.165 -#define MSR_P4_MS_CCCR0                0x364
  51.166 -#define MSR_P4_MS_CCCR1                0x365
  51.167 -
  51.168 -#define MSR_P4_MS_COUNTER2             0x306
  51.169 -#define MSR_P4_MS_COUNTER3             0x307
  51.170 -#define MSR_P4_MS_CCCR2                0x366
  51.171 -#define MSR_P4_MS_CCCR3                0x367
  51.172 -
  51.173 -#define MSR_P4_MS_ESCR0                0x3c0
  51.174 -#define MSR_P4_TBPU_ESCR0              0x3c2
  51.175 -#define MSR_P4_TC_ESCR0                0x3c4
  51.176 -
  51.177 -#define P4_MS_ESCR0_NUMBER             0
  51.178 -#define P4_TBPU_ESCR0_NUMBER           2
  51.179 -#define P4_TC_ESCR0_NUMBER             1
  51.180 -
  51.181 -#define MSR_P4_MS_ESCR1                0x3c1
  51.182 -#define MSR_P4_TBPU_ESCR1              0x3c3
  51.183 -#define MSR_P4_TC_ESCR1                0x3c5
  51.184 -
  51.185 -#define P4_MS_ESCR1_NUMBER             0
  51.186 -#define P4_TBPU_ESCR1_NUMBER           2
  51.187 -#define P4_TC_ESCR1_NUMBER             1
  51.188 -
  51.189 -// FLAME
  51.190 -#define MSR_P4_FLAME_COUNTER0          0x308
  51.191 -#define MSR_P4_FLAME_COUNTER1          0x309
  51.192 -#define MSR_P4_FLAME_CCCR0             0x368
  51.193 -#define MSR_P4_FLAME_CCCR1             0x369
  51.194 -
  51.195 -#define MSR_P4_FLAME_COUNTER2          0x30a
  51.196 -#define MSR_P4_FLAME_COUNTER3          0x30b
  51.197 -#define MSR_P4_FLAME_CCCR2             0x36a
  51.198 -#define MSR_P4_FLAME_CCCR3             0x36b
  51.199 -
  51.200 -#define MSR_P4_FIRM_ESCR0              0x3a4
  51.201 -#define MSR_P4_FLAME_ESCR0             0x3a6
  51.202 -#define MSR_P4_DAC_ESCR0               0x3a8
  51.203 -#define MSR_P4_SAAT_ESCR0              0x3ae
  51.204 -#define MSR_P4_U2L_ESCR0               0x3b0
  51.205 -
  51.206 -#define P4_FIRM_ESCR0_NUMBER           1
  51.207 -#define P4_FLAME_ESCR0_NUMBER          0
  51.208 -#define P4_DAC_ESCR0_NUMBER            5
  51.209 -#define P4_SAAT_ESCR0_NUMBER           2
  51.210 -#define P4_U2L_ESCR0_NUMBER            3
  51.211 -
  51.212 -#define MSR_P4_FIRM_ESCR1              0x3a5
  51.213 -#define MSR_P4_FLAME_ESCR1             0x3a7
  51.214 -#define MSR_P4_DAC_ESCR1               0x3a9
  51.215 -#define MSR_P4_SAAT_ESCR1              0x3af
  51.216 -#define MSR_P4_U2L_ESCR1               0x3b1
  51.217 -
  51.218 -#define P4_FIRM_ESCR1_NUMBER           1
  51.219 -#define P4_FLAME_ESCR1_NUMBER          0
  51.220 -#define P4_DAC_ESCR1_NUMBER            5
  51.221 -#define P4_SAAT_ESCR1_NUMBER           2
  51.222 -#define P4_U2L_ESCR1_NUMBER            3
  51.223 -
  51.224 -// IQ
  51.225 -#define MSR_P4_IQ_COUNTER0             0x30c
  51.226 -#define MSR_P4_IQ_COUNTER1             0x30d
  51.227 -#define MSR_P4_IQ_CCCR0                0x36c
  51.228 -#define MSR_P4_IQ_CCCR1                0x36d
  51.229 -
  51.230 -#define MSR_P4_IQ_COUNTER2             0x30e
  51.231 -#define MSR_P4_IQ_COUNTER3             0x30f
  51.232 -#define MSR_P4_IQ_CCCR2                0x36e
  51.233 -#define MSR_P4_IQ_CCCR3                0x36f
  51.234 -
  51.235 -#define MSR_P4_IQ_COUNTER4             0x310
  51.236 -#define MSR_P4_IQ_COUNTER5             0x311
  51.237 -#define MSR_P4_IQ_CCCR4                0x370
  51.238 -#define MSR_P4_IQ_CCCR5                0x371
  51.239 -
  51.240 -#define MSR_P4_CRU_ESCR0               0x3b8
  51.241 -#define MSR_P4_CRU_ESCR2               0x3cc
  51.242 -#define MSR_P4_CRU_ESCR4               0x3e0
  51.243 -#define MSR_P4_IQ_ESCR0                0x3ba
  51.244 -#define MSR_P4_RAT_ESCR0               0x3bc
  51.245 -#define MSR_P4_SSU_ESCR0               0x3be
  51.246 -#define MSR_P4_ALF_ESCR0               0x3ca
  51.247 -
  51.248 -#define P4_CRU_ESCR0_NUMBER            4
  51.249 -#define P4_CRU_ESCR2_NUMBER            5
  51.250 -#define P4_CRU_ESCR4_NUMBER            6
  51.251 -#define P4_IQ_ESCR0_NUMBER             0
  51.252 -#define P4_RAT_ESCR0_NUMBER            2
  51.253 -#define P4_SSU_ESCR0_NUMBER            3
  51.254 -#define P4_ALF_ESCR0_NUMBER            1
  51.255 -
  51.256 -#define MSR_P4_CRU_ESCR1               0x3b9
  51.257 -#define MSR_P4_CRU_ESCR3               0x3cd
  51.258 -#define MSR_P4_CRU_ESCR5               0x3e1
  51.259 -#define MSR_P4_IQ_ESCR1                0x3bb
  51.260 -#define MSR_P4_RAT_ESCR1               0x3bd
  51.261 -#define MSR_P4_ALF_ESCR1               0x3cb
  51.262 -
  51.263 -#define P4_CRU_ESCR1_NUMBER            4
  51.264 -#define P4_CRU_ESCR3_NUMBER            5
  51.265 -#define P4_CRU_ESCR5_NUMBER            6
  51.266 -#define P4_IQ_ESCR1_NUMBER             0
  51.267 -#define P4_RAT_ESCR1_NUMBER            2
  51.268 -#define P4_ALF_ESCR1_NUMBER            1
  51.269 -
  51.270 -#define P4_BPU_COUNTER0_NUMBER         0
  51.271 -#define P4_BPU_COUNTER1_NUMBER         1
  51.272 -#define P4_BPU_COUNTER2_NUMBER         2
  51.273 -#define P4_BPU_COUNTER3_NUMBER         3
  51.274 -
  51.275 -#define P4_MS_COUNTER0_NUMBER          4
  51.276 -#define P4_MS_COUNTER1_NUMBER          5
  51.277 -#define P4_MS_COUNTER2_NUMBER          6
  51.278 -#define P4_MS_COUNTER3_NUMBER          7
  51.279 -
  51.280 -#define P4_FLAME_COUNTER0_NUMBER       8
  51.281 -#define P4_FLAME_COUNTER1_NUMBER       9
  51.282 -#define P4_FLAME_COUNTER2_NUMBER       10
  51.283 -#define P4_FLAME_COUNTER3_NUMBER       11
  51.284 -
  51.285 -#define P4_IQ_COUNTER0_NUMBER          12
  51.286 -#define P4_IQ_COUNTER1_NUMBER          13
  51.287 -#define P4_IQ_COUNTER2_NUMBER          14
  51.288 -#define P4_IQ_COUNTER3_NUMBER          15
  51.289 -#define P4_IQ_COUNTER4_NUMBER          16
  51.290 -#define P4_IQ_COUNTER5_NUMBER          17
  51.291 -
  51.292 -/* PEBS
  51.293 - */
  51.294 -#define MSR_P4_PEBS_ENABLE             0x3F1
  51.295 -#define MSR_P4_PEBS_MATRIX_VERT        0x3F2
  51.296 -
  51.297 -#define P4_PEBS_ENABLE_MY_THR          (1 << 25)
  51.298 -#define P4_PEBS_ENABLE_OTH_THR         (1 << 26)
  51.299 -#define P4_PEBS_ENABLE                 (1 << 24)
  51.300 -#define P4_PEBS_BIT0                   (1 << 0)
  51.301 -#define P4_PEBS_BIT1                   (1 << 1)
  51.302 -#define P4_PEBS_BIT2                   (1 << 2)
  51.303 -
  51.304 -#define P4_PEBS_MATRIX_VERT_BIT0       (1 << 0)
  51.305 -#define P4_PEBS_MATRIX_VERT_BIT1       (1 << 1)
  51.306 -#define P4_PEBS_MATRIX_VERT_BIT2       (1 << 2)
  51.307 -
  51.308 -/* Replay tagging.
  51.309 - */
  51.310 -#define P4_REPLAY_TAGGING_PEBS_L1LMR   P4_PEBS_BIT0
  51.311 -#define P4_REPLAY_TAGGING_PEBS_L2LMR   P4_PEBS_BIT1
  51.312 -#define P4_REPLAY_TAGGING_PEBS_DTLMR   P4_PEBS_BIT2
  51.313 -#define P4_REPLAY_TAGGING_PEBS_DTSMR   P4_PEBS_BIT2
  51.314 -#define P4_REPLAY_TAGGING_PEBS_DTAMR   P4_PEBS_BIT2
  51.315 -
  51.316 -#define P4_REPLAY_TAGGING_VERT_L1LMR   P4_PEBS_MATRIX_VERT_BIT0
  51.317 -#define P4_REPLAY_TAGGING_VERT_L2LMR   P4_PEBS_MATRIX_VERT_BIT0
  51.318 -#define P4_REPLAY_TAGGING_VERT_DTLMR   P4_PEBS_MATRIX_VERT_BIT0
  51.319 -#define P4_REPLAY_TAGGING_VERT_DTSMR   P4_PEBS_MATRIX_VERT_BIT1
  51.320 -#define P4_REPLAY_TAGGING_VERT_DTAMR   P4_PEBS_MATRIX_VERT_BIT0 | P4_PEBS_MATRIX_VERT_BIT1
  51.321 -
  51.322 -
  51.323 -
  51.324 -
  51.325 -/*****************************************************************************
  51.326 - *                                                                           *
  51.327 - *****************************************************************************/
  51.328 -
  51.329 -// x87_FP_uop
  51.330 -#define EVENT_SEL_x87_FP_uop                0x04
  51.331 -#define EVENT_MASK_x87_FP_uop_ALL           (1 << 15)
  51.332 -
  51.333 -// execution event (at retirement)
  51.334 -#define EVENT_SEL_execution_event           0x0C
  51.335 -
  51.336 -// scalar_SP_uop
  51.337 -#define EVENT_SEL_scalar_SP_uop             0x0a
  51.338 -#define EVENT_MASK_scalar_SP_uop_ALL        (1 << 15)
  51.339 -
  51.340 -// scalar_DP_uop
  51.341 -#define EVENT_SEL_scalar_DP_uop             0x0e
  51.342 -#define EVENT_MASK_scalar_DP_uop_ALL        (1 << 15)
  51.343 -
  51.344 -// Instruction retired
  51.345 -#define EVENT_SEL_instr_retired             0x02
  51.346 -#define EVENT_MASK_instr_retired_ALL        0x0f
  51.347 -
  51.348 -// uOps retired
  51.349 -#define EVENT_SEL_uops_retired              0x01
  51.350 -#define EVENT_MASK_uops_retired_ALL         0x03
  51.351 -
  51.352 -// L1 misses retired
  51.353 -#define EVENT_SEL_replay_event              0x09
  51.354 -#define EVENT_MASK_replay_event_ALL         0x03
  51.355 -
  51.356 -// Trace cache
  51.357 -#define EVENT_SEL_BPU_fetch_request         0x03
  51.358 -#define EVENT_MASK_BPU_fetch_request_TCMISS 0x01
  51.359 -
  51.360 -// Bus activity
  51.361 -#define EVENT_SEL_FSB_data_activity               0x17
  51.362 -#define EVENT_MASK_FSB_data_activity_DRDY_DRV     0x01
  51.363 -#define EVENT_MASK_FSB_data_activity_DRDY_OWN     0x02
  51.364 -#define EVENT_MASK_FSB_data_activity_DRDY_OOTHER  0x04
  51.365 -#define EVENT_MASK_FSB_data_activity_DBSY_DRV     0x08
  51.366 -#define EVENT_MASK_FSB_data_activity_DBSY_OWN     0x10
  51.367 -#define EVENT_MASK_FSB_data_activity_DBSY_OOTHER  0x20
  51.368 -
  51.369 -// Cache L2
  51.370 -#define EVENT_SEL_BSQ_cache_reference             0x0c
  51.371 -#define EVENT_MASK_BSQ_cache_reference_RD_L2_HITS 0x001
  51.372 -#define EVENT_MASK_BSQ_cache_reference_RD_L2_HITE 0x002
  51.373 -#define EVENT_MASK_BSQ_cache_reference_RD_L2_HITM 0x004
  51.374 -
  51.375 -#define EVENT_MASK_BSQ_cache_reference_RD_L3_HITS 0x008
  51.376 -#define EVENT_MASK_BSQ_cache_reference_RD_L3_HITE 0x010
  51.377 -#define EVENT_MASK_BSQ_cache_reference_RD_L3_HITM 0x020
  51.378 -
  51.379 -#define EVENT_MASK_BSQ_cache_reference_RD_L2_MISS 0x100
  51.380 -#define EVENT_MASK_BSQ_cache_reference_RD_L3_MISS 0x200
  51.381 -#define EVENT_MASK_BSQ_cache_reference_WR_L2_MISS 0x400
  51.382 -
  51.383 -#endif
  51.384 -
  51.385 -/* End of $RCSfile: p4perf.h,v $ */
    52.1 --- a/tools/misc/xenperf.c	Fri Aug 25 16:21:39 2006 -0600
    52.2 +++ b/tools/misc/xenperf.c	Sun Aug 27 10:24:41 2006 -0600
    52.3 @@ -64,7 +64,7 @@ int main(int argc, char *argv[])
    52.4      
    52.5      if ( reset )
    52.6      {
    52.7 -        if ( xc_perfc_control(xc_handle, DOM0_PERFCCONTROL_OP_RESET,
    52.8 +        if ( xc_perfc_control(xc_handle, XEN_SYSCTL_PERFCOP_reset,
    52.9                                NULL, NULL, NULL, NULL) != 0 )
   52.10          {
   52.11              fprintf(stderr, "Error reseting performance counters: %d (%s)\n",
   52.12 @@ -75,7 +75,7 @@ int main(int argc, char *argv[])
   52.13          return 0;
   52.14      }
   52.15  
   52.16 -	if ( xc_perfc_control(xc_handle, DOM0_PERFCCONTROL_OP_QUERY,
   52.17 +	if ( xc_perfc_control(xc_handle, XEN_SYSCTL_PERFCOP_query,
   52.18  						  NULL, NULL, &num_desc, &num_val) != 0 )
   52.19          {
   52.20              fprintf(stderr, "Error getting number of perf counters: %d (%s)\n",
   52.21 @@ -96,7 +96,7 @@ int main(int argc, char *argv[])
   52.22          exit(-1);
   52.23      }
   52.24  
   52.25 -    if ( xc_perfc_control(xc_handle, DOM0_PERFCCONTROL_OP_QUERY,
   52.26 +    if ( xc_perfc_control(xc_handle, XEN_SYSCTL_PERFCOP_query,
   52.27  						  pcd, pcv, NULL, NULL) != 0 )
   52.28      {
   52.29          fprintf(stderr, "Error getting perf counter: %d (%s)\n",
    53.1 --- a/tools/python/xen/lowlevel/xc/xc.c	Fri Aug 25 16:21:39 2006 -0600
    53.2 +++ b/tools/python/xen/lowlevel/xc/xc.c	Sun Aug 27 10:24:41 2006 -0600
    53.3 @@ -141,7 +141,7 @@ static PyObject *pyxc_vcpu_setaffinity(X
    53.4  {
    53.5      uint32_t dom;
    53.6      int vcpu = 0, i;
    53.7 -    cpumap_t cpumap = ~0ULL;
    53.8 +    uint64_t  cpumap = ~0ULL;
    53.9      PyObject *cpulist = NULL;
   53.10  
   53.11      static char *kwd_list[] = { "dom", "vcpu", "cpumap", NULL };
   53.12 @@ -154,7 +154,7 @@ static PyObject *pyxc_vcpu_setaffinity(X
   53.13      {
   53.14          cpumap = 0ULL;
   53.15          for ( i = 0; i < PyList_Size(cpulist); i++ ) 
   53.16 -            cpumap |= (cpumap_t)1 << PyInt_AsLong(PyList_GetItem(cpulist, i));
   53.17 +            cpumap |= (uint64_t)1 << PyInt_AsLong(PyList_GetItem(cpulist, i));
   53.18      }
   53.19    
   53.20      if ( xc_vcpu_setaffinity(self->xc_handle, dom, vcpu, cpumap) != 0 )
   53.21 @@ -289,7 +289,7 @@ static PyObject *pyxc_vcpu_getinfo(XcObj
   53.22      uint32_t dom, vcpu = 0;
   53.23      xc_vcpuinfo_t info;
   53.24      int rc, i;
   53.25 -    cpumap_t cpumap;
   53.26 +    uint64_t cpumap;
   53.27  
   53.28      static char *kwd_list[] = { "dom", "vcpu", NULL };
   53.29      
   53.30 @@ -300,6 +300,9 @@ static PyObject *pyxc_vcpu_getinfo(XcObj
   53.31      rc = xc_vcpu_getinfo(self->xc_handle, dom, vcpu, &info);
   53.32      if ( rc < 0 )
   53.33          return PyErr_SetFromErrno(xc_error);
   53.34 +    rc = xc_vcpu_getaffinity(self->xc_handle, dom, vcpu, &cpumap);
   53.35 +    if ( rc < 0 )
   53.36 +        return PyErr_SetFromErrno(xc_error);
   53.37  
   53.38      info_dict = Py_BuildValue("{s:i,s:i,s:i,s:L,s:i}",
   53.39                                "online",   info.online,
   53.40 @@ -308,7 +311,6 @@ static PyObject *pyxc_vcpu_getinfo(XcObj
   53.41                                "cpu_time", info.cpu_time,
   53.42                                "cpu",      info.cpu);
   53.43  
   53.44 -    cpumap = info.cpumap;
   53.45      cpulist = PyList_New(0);
   53.46      for ( i = 0; cpumap != 0; i++ )
   53.47      {
   53.48 @@ -388,83 +390,6 @@ static PyObject *pyxc_hvm_build(XcObject
   53.49      return Py_BuildValue("{s:i}", "store_mfn", store_mfn);
   53.50  }
   53.51  
   53.52 -static PyObject *pyxc_bvtsched_global_set(XcObject *self, PyObject *args)
   53.53 -{
   53.54 -    unsigned long ctx_allow;
   53.55 -
   53.56 -    if (!PyArg_ParseTuple(args, "l", &ctx_allow))
   53.57 -        return NULL;
   53.58 -
   53.59 -    if (xc_bvtsched_global_set(self->xc_handle, ctx_allow) != 0)
   53.60 -        return PyErr_SetFromErrno(xc_error);
   53.61 -    
   53.62 -    Py_INCREF(zero);
   53.63 -    return zero;
   53.64 -}
   53.65 -
   53.66 -static PyObject *pyxc_bvtsched_global_get(XcObject *self)
   53.67 -{
   53.68 -    unsigned long ctx_allow;
   53.69 -    
   53.70 -    if (xc_bvtsched_global_get(self->xc_handle, &ctx_allow) != 0)
   53.71 -        return PyErr_SetFromErrno(xc_error);
   53.72 -    
   53.73 -    return Py_BuildValue("s:l", "ctx_allow", ctx_allow);
   53.74 -}
   53.75 -
   53.76 -static PyObject *pyxc_bvtsched_domain_set(XcObject *self,
   53.77 -                                          PyObject *args,
   53.78 -                                          PyObject *kwds)
   53.79 -{
   53.80 -    uint32_t dom;
   53.81 -    uint32_t mcuadv;
   53.82 -    int warpback; 
   53.83 -    int32_t warpvalue;
   53.84 -    long long warpl;
   53.85 -    long long warpu;
   53.86 -
   53.87 -    static char *kwd_list[] = { "dom", "mcuadv", "warpback", "warpvalue",
   53.88 -                                "warpl", "warpu", NULL };
   53.89 -
   53.90 -    if ( !PyArg_ParseTupleAndKeywords(args, kwds, "iiiiLL", kwd_list,
   53.91 -                                      &dom, &mcuadv, &warpback, &warpvalue, 
   53.92 -                                      &warpl, &warpu) )
   53.93 -        return NULL;
   53.94 -
   53.95 -    if ( xc_bvtsched_domain_set(self->xc_handle, dom, mcuadv, 
   53.96 -                                warpback, warpvalue, warpl, warpu) != 0 )
   53.97 -        return PyErr_SetFromErrno(xc_error);
   53.98 -    
   53.99 -    Py_INCREF(zero);
  53.100 -    return zero;
  53.101 -}
  53.102 -
  53.103 -static PyObject *pyxc_bvtsched_domain_get(XcObject *self,
  53.104 -                                          PyObject *args)
  53.105 -{
  53.106 -    uint32_t dom;
  53.107 -    uint32_t mcuadv;
  53.108 -    int warpback; 
  53.109 -    int32_t warpvalue;
  53.110 -    long long warpl;
  53.111 -    long long warpu;
  53.112 -    
  53.113 -    if (!PyArg_ParseTuple(args, "i", &dom))
  53.114 -        return NULL;
  53.115 -    
  53.116 -    if (xc_bvtsched_domain_get(self->xc_handle, dom, &mcuadv, &warpback,
  53.117 -                               &warpvalue, &warpl, &warpu) != 0)
  53.118 -        return PyErr_SetFromErrno(xc_error);
  53.119 -
  53.120 -    return Py_BuildValue("{s:i,s:l,s:l,s:l,s:l}",
  53.121 -                         "domain", dom,
  53.122 -                         "mcuadv", mcuadv,
  53.123 -                         "warpback", warpback,
  53.124 -                         "warpvalue", warpvalue,
  53.125 -                         "warpl", warpl,
  53.126 -                         "warpu", warpu);
  53.127 -}
  53.128 -
  53.129  static PyObject *pyxc_evtchn_alloc_unbound(XcObject *self,
  53.130                                             PyObject *args,
  53.131                                             PyObject *kwds)
  53.132 @@ -709,11 +634,11 @@ static PyObject *pyxc_shadow_mem_control
  53.133          return NULL;
  53.134      
  53.135      if ( mbarg < 0 ) 
  53.136 -        op = DOM0_SHADOW_CONTROL_OP_GET_ALLOCATION;
  53.137 +        op = XEN_DOMCTL_SHADOW_OP_GET_ALLOCATION;
  53.138      else 
  53.139      {
  53.140          mb = mbarg;
  53.141 -        op = DOM0_SHADOW_CONTROL_OP_SET_ALLOCATION;
  53.142 +        op = XEN_DOMCTL_SHADOW_OP_SET_ALLOCATION;
  53.143      }
  53.144      if ( xc_shadow_control(xc->xc_handle, dom, op, NULL, 0, &mb, 0, NULL) < 0 )
  53.145          return PyErr_SetFromErrno(xc_error);
  53.146 @@ -731,7 +656,7 @@ static PyObject *pyxc_sched_credit_domai
  53.147      uint16_t cap;
  53.148      static char *kwd_list[] = { "dom", "weight", "cap", NULL };
  53.149      static char kwd_type[] = "I|HH";
  53.150 -    struct sched_credit_adjdom sdom;
  53.151 +    struct xen_domctl_sched_credit sdom;
  53.152      
  53.153      weight = 0;
  53.154      cap = (uint16_t)~0U;
  53.155 @@ -752,7 +677,7 @@ static PyObject *pyxc_sched_credit_domai
  53.156  static PyObject *pyxc_sched_credit_domain_get(XcObject *self, PyObject *args)
  53.157  {
  53.158      uint32_t domid;
  53.159 -    struct sched_credit_adjdom sdom;
  53.160 +    struct xen_domctl_sched_credit sdom;
  53.161      
  53.162      if( !PyArg_ParseTuple(args, "I", &domid) )
  53.163          return NULL;
  53.164 @@ -1051,45 +976,6 @@ static PyMethodDef pyxc_methods[] = {
  53.165        " vcpus   [int, 1]:   Number of Virtual CPUS in domain.\n\n"
  53.166        "Returns: [int] 0 on success; -1 on error.\n" },
  53.167  
  53.168 -    { "bvtsched_global_set",
  53.169 -      (PyCFunction)pyxc_bvtsched_global_set,
  53.170 -      METH_VARARGS | METH_KEYWORDS, "\n"
  53.171 -      "Set global tuning parameters for Borrowed Virtual Time scheduler.\n"
  53.172 -      " ctx_allow [int]: Minimal guaranteed quantum.\n\n"
  53.173 -      "Returns: [int] 0 on success; -1 on error.\n" },
  53.174 -
  53.175 -    { "bvtsched_global_get",
  53.176 -      (PyCFunction)pyxc_bvtsched_global_get,
  53.177 -      METH_NOARGS, "\n"
  53.178 -      "Get global tuning parameters for BVT scheduler.\n"
  53.179 -      "Returns: [dict]:\n"
  53.180 -      " ctx_allow [int]: context switch allowance\n" },
  53.181 -
  53.182 -    { "bvtsched_domain_set",
  53.183 -      (PyCFunction)pyxc_bvtsched_domain_set,
  53.184 -      METH_VARARGS | METH_KEYWORDS, "\n"
  53.185 -      "Set per-domain tuning parameters for Borrowed Virtual Time scheduler.\n"
  53.186 -      " dom       [int]: Identifier of domain to be tuned.\n"
  53.187 -      " mcuadv    [int]: Proportional to the inverse of the domain's weight.\n"
  53.188 -      " warpback  [int]: Warp ? \n"
  53.189 -      " warpvalue [int]: How far to warp domain's EVT on unblock.\n"
  53.190 -      " warpl     [int]: How long the domain can run warped.\n"
  53.191 -      " warpu     [int]: How long before the domain can warp again.\n\n"
  53.192 -      "Returns:   [int] 0 on success; -1 on error.\n" },
  53.193 -
  53.194 -    { "bvtsched_domain_get",
  53.195 -      (PyCFunction)pyxc_bvtsched_domain_get,
  53.196 -      METH_VARARGS, "\n"
  53.197 -      "Get per-domain tuning parameters under the BVT scheduler.\n"
  53.198 -      " dom [int]: Identifier of domain to be queried.\n"
  53.199 -      "Returns [dict]:\n"
  53.200 -      " domain [int]:  Domain ID.\n"
  53.201 -      " mcuadv [long]: MCU Advance.\n"
  53.202 -      " warp   [long]: Warp.\n"
  53.203 -      " warpu  [long]: Unwarp requirement.\n"
  53.204 -      " warpl  [long]: Warp limit,\n"
  53.205 -    },
  53.206 -    
  53.207      { "sedf_domain_set",
  53.208        (PyCFunction)pyxc_sedf_domain_set,
  53.209        METH_KEYWORDS, "\n"
    54.1 --- a/tools/python/xen/xend/XendDomain.py	Fri Aug 25 16:21:39 2006 -0600
    54.2 +++ b/tools/python/xen/xend/XendDomain.py	Sun Aug 27 10:24:41 2006 -0600
    54.3 @@ -471,34 +471,6 @@ class XendDomain:
    54.4          except Exception, ex:
    54.5              raise XendError(str(ex))
    54.6  
    54.7 -    def domain_cpu_bvt_set(self, domid, mcuadv, warpback, warpvalue, warpl,
    54.8 -                           warpu):
    54.9 -        """Set BVT (Borrowed Virtual Time) scheduler parameters for a domain.
   54.10 -        """
   54.11 -        dominfo = self.domain_lookup_by_name_or_id_nr(domid)
   54.12 -        if not dominfo:
   54.13 -            raise XendInvalidDomain(str(domid))
   54.14 -        try:
   54.15 -            return xc.bvtsched_domain_set(dom=dominfo.getDomid(),
   54.16 -                                          mcuadv=mcuadv,
   54.17 -                                          warpback=warpback,
   54.18 -                                          warpvalue=warpvalue, 
   54.19 -                                          warpl=warpl, warpu=warpu)
   54.20 -        except Exception, ex:
   54.21 -            raise XendError(str(ex))
   54.22 -
   54.23 -    def domain_cpu_bvt_get(self, domid):
   54.24 -        """Get BVT (Borrowed Virtual Time) scheduler parameters for a domain.
   54.25 -        """
   54.26 -        dominfo = self.domain_lookup_by_name_or_id_nr(domid)
   54.27 -        if not dominfo:
   54.28 -            raise XendInvalidDomain(str(domid))
   54.29 -        try:
   54.30 -            return xc.bvtsched_domain_get(dominfo.getDomid())
   54.31 -        except Exception, ex:
   54.32 -            raise XendError(str(ex))
   54.33 -    
   54.34 -    
   54.35      def domain_cpu_sedf_set(self, domid, period, slice_, latency, extratime,
   54.36                              weight):
   54.37          """Set Simple EDF scheduler parameters for a domain.
    55.1 --- a/tools/python/xen/xend/XendNode.py	Fri Aug 25 16:21:39 2006 -0600
    55.2 +++ b/tools/python/xen/xend/XendNode.py	Sun Aug 27 10:24:41 2006 -0600
    55.3 @@ -39,12 +39,6 @@ class XendNode:
    55.4      def notify(self, _):
    55.5          return 0
    55.6      
    55.7 -    def cpu_bvt_slice_set(self, ctx_allow):
    55.8 -        return self.xc.bvtsched_global_set(ctx_allow)
    55.9 -
   55.10 -    def cpu_bvt_slice_get(self):
   55.11 -        return self.xc.bvtsched_global_get()
   55.12 -    
   55.13      def info(self):
   55.14          return (self.nodeinfo() + self.physinfo() + self.xeninfo() +
   55.15                  self.xendinfo())
    56.1 --- a/tools/python/xen/xend/server/SrvDomain.py	Fri Aug 25 16:21:39 2006 -0600
    56.2 +++ b/tools/python/xen/xend/server/SrvDomain.py	Sun Aug 27 10:24:41 2006 -0600
    56.3 @@ -102,18 +102,6 @@ class SrvDomain(SrvDir):
    56.4          val = fn(req.args, {'dom': self.dom.domid})
    56.5          return val
    56.6  
    56.7 -    def op_cpu_bvt_set(self, _, req):
    56.8 -        fn = FormFn(self.xd.domain_cpu_bvt_set,
    56.9 -                    [['dom',       'int'],
   56.10 -                     ['mcuadv',    'int'],
   56.11 -                     ['warpback',  'int'],
   56.12 -                     ['warpvalue', 'int'],
   56.13 -                     ['warpl',     'long'],
   56.14 -                     ['warpu',     'long']])
   56.15 -        val = fn(req.args, {'dom': self.dom.domid})
   56.16 -        return val
   56.17 -    
   56.18 -    
   56.19      def op_cpu_sedf_get(self, _, req):
   56.20          fn = FormFn(self.xd.domain_cpu_sedf_get,
   56.21                      [['dom', 'int']])
    57.1 --- a/tools/python/xen/xend/server/SrvNode.py	Fri Aug 25 16:21:39 2006 -0600
    57.2 +++ b/tools/python/xen/xend/server/SrvNode.py	Sun Aug 27 10:24:41 2006 -0600
    57.3 @@ -39,12 +39,6 @@ class SrvNode(SrvDir):
    57.4          val = self.xn.reboot()
    57.5          return val
    57.6  
    57.7 -    def op_cpu_bvt_slice_set(self, _, req):
    57.8 -        fn = FormFn(self.xn.cpu_bvt_slice_set,
    57.9 -                    [['ctx_allow', 'int']])
   57.10 -        val = fn(req.args, {})
   57.11 -        return val
   57.12 -    
   57.13      def render_POST(self, req):
   57.14          return self.perform(req)
   57.15  
    58.1 --- a/tools/python/xen/xend/server/XMLRPCServer.py	Fri Aug 25 16:21:39 2006 -0600
    58.2 +++ b/tools/python/xen/xend/server/XMLRPCServer.py	Sun Aug 27 10:24:41 2006 -0600
    58.3 @@ -109,7 +109,7 @@ class XMLRPCServer:
    58.4                      self.server.register_function(fn, "xend.domain.%s" % name[7:])
    58.5  
    58.6          # Functions in XendNode and XendDmesg
    58.7 -        for type, lst, n in [(XendNode, ['info', 'cpu_bvt_slice_set'], 'node'),
    58.8 +        for type, lst, n in [(XendNode, ['info'], 'node'),
    58.9                               (XendDmesg, ['info', 'clear'], 'node.dmesg')]:
   58.10              inst = type.instance()
   58.11              for name in lst:
    59.1 --- a/tools/python/xen/xm/main.py	Fri Aug 25 16:21:39 2006 -0600
    59.2 +++ b/tools/python/xen/xm/main.py	Sun Aug 27 10:24:41 2006 -0600
    59.3 @@ -89,10 +89,6 @@ dmesg_help =   "dmesg [-c|--clear]      
    59.4  info_help =    "info                             Get information about the xen host"
    59.5  rename_help =  "rename <DomId> <New Name>        Rename a domain"
    59.6  log_help =     "log                              Print the xend log"
    59.7 -sched_bvt_help = """sched-bvt <Parameters>           Set Borrowed Virtual Time scheduler
    59.8 -                                    parameters"""
    59.9 -sched_bvt_ctxallow_help = """sched-bvt-ctxallow <Allow>       Set the BVT scheduler context switch
   59.10 -                                    allowance"""
   59.11  sched_sedf_help = "sched-sedf [DOM] [OPTIONS]       Show|Set simple EDF parameters\n" + \
   59.12  "              -p, --period          Relative deadline(ms).\n\
   59.13                -s, --slice           Worst-case execution time(ms)\n\
   59.14 @@ -192,8 +188,6 @@ host_commands = [
   59.15  
   59.16  scheduler_commands = [
   59.17      "sched-credit",
   59.18 -    "sched-bvt",
   59.19 -    "sched-bvt-ctxallow",
   59.20      "sched-sedf",
   59.21      ]
   59.22  
   59.23 @@ -672,18 +666,6 @@ def xm_domname(args):
   59.24      dom = server.xend.domain(name)
   59.25      print sxp.child_value(dom, 'name')
   59.26  
   59.27 -def xm_sched_bvt(args):
   59.28 -    arg_check(args, "sched-bvt", 6)
   59.29 -    dom = args[0]
   59.30 -    v = map(long, args[1:6])
   59.31 -    server.xend.domain.cpu_bvt_set(dom, *v)
   59.32 -
   59.33 -def xm_sched_bvt_ctxallow(args):
   59.34 -    arg_check(args, "sched-bvt-ctxallow", 1)
   59.35 -
   59.36 -    slice = int(args[0])
   59.37 -    server.xend.node.cpu_bvt_slice_set(slice)
   59.38 -
   59.39  def xm_sched_sedf(args):
   59.40      def ns_to_ms(val):
   59.41          return float(val) * 0.000001
   59.42 @@ -1209,8 +1191,6 @@ commands = {
   59.43      "log": xm_log,
   59.44      "serve": xm_serve,
   59.45      # scheduler
   59.46 -    "sched-bvt": xm_sched_bvt,
   59.47 -    "sched-bvt-ctxallow": xm_sched_bvt_ctxallow,
   59.48      "sched-sedf": xm_sched_sedf,
   59.49      "sched-credit": xm_sched_credit,
   59.50      # block
    60.1 --- a/tools/tests/test_x86_emulator.c	Fri Aug 25 16:21:39 2006 -0600
    60.2 +++ b/tools/tests/test_x86_emulator.c	Sun Aug 27 10:24:41 2006 -0600
    60.3 @@ -15,6 +15,8 @@ typedef int64_t            s64;
    60.4  #include <asm-x86/x86_emulate.h>
    60.5  #include <sys/mman.h>
    60.6  
    60.7 +#define PFEC_write_access (1U<<1)
    60.8 +
    60.9  static int read_any(
   60.10      unsigned long addr,
   60.11      unsigned long *val,
   60.12 @@ -105,6 +107,7 @@ int main(int argc, char **argv)
   60.13      regs.eflags = 0x200;
   60.14      regs.eip    = (unsigned long)&instr[0];
   60.15      regs.ecx    = 0x12345678;
   60.16 +    regs.error_code = PFEC_write_access;
   60.17      ctxt.cr2    = (unsigned long)res;
   60.18      *res        = 0x7FFFFFFF;
   60.19      rc = x86_emulate_memop(&ctxt, &emulops);
   60.20 @@ -125,6 +128,7 @@ int main(int argc, char **argv)
   60.21      regs.ecx    = 0x12345678UL;
   60.22  #endif
   60.23      ctxt.cr2    = (unsigned long)res;
   60.24 +    regs.error_code = 0;
   60.25      rc = x86_emulate_memop(&ctxt, &emulops);
   60.26      if ( (rc != 0) || 
   60.27           (*res != 0x92345677) || 
   60.28 @@ -139,6 +143,7 @@ int main(int argc, char **argv)
   60.29      regs.eip    = (unsigned long)&instr[0];
   60.30      regs.ecx    = ~0UL;
   60.31      ctxt.cr2    = (unsigned long)res;
   60.32 +    regs.error_code = 0;
   60.33      rc = x86_emulate_memop(&ctxt, &emulops);
   60.34      if ( (rc != 0) || 
   60.35           (*res != 0x92345677) || 
   60.36 @@ -154,6 +159,7 @@ int main(int argc, char **argv)
   60.37      regs.eax    = 0x92345677UL;
   60.38      regs.ecx    = 0xAA;
   60.39      ctxt.cr2    = (unsigned long)res;
   60.40 +    regs.error_code = PFEC_write_access;
   60.41      rc = x86_emulate_memop(&ctxt, &emulops);
   60.42      if ( (rc != 0) || 
   60.43           (*res != 0x923456AA) || 
   60.44 @@ -170,6 +176,7 @@ int main(int argc, char **argv)
   60.45      regs.eax    = 0xAABBCC77UL;
   60.46      regs.ecx    = 0xFF;
   60.47      ctxt.cr2    = (unsigned long)res;
   60.48 +    regs.error_code = PFEC_write_access;
   60.49      rc = x86_emulate_memop(&ctxt, &emulops);
   60.50      if ( (rc != 0) || 
   60.51           (*res != 0x923456AA) || 
   60.52 @@ -186,6 +193,7 @@ int main(int argc, char **argv)
   60.53      regs.eip    = (unsigned long)&instr[0];
   60.54      regs.ecx    = 0x12345678;
   60.55      ctxt.cr2    = (unsigned long)res;
   60.56 +    regs.error_code = PFEC_write_access;
   60.57      rc = x86_emulate_memop(&ctxt, &emulops);
   60.58      if ( (rc != 0) || 
   60.59           (*res != 0x12345678) || 
   60.60 @@ -203,6 +211,7 @@ int main(int argc, char **argv)
   60.61      regs.eax    = 0x923456AAUL;
   60.62      regs.ecx    = 0xDDEEFF00L;
   60.63      ctxt.cr2    = (unsigned long)res;
   60.64 +    regs.error_code = PFEC_write_access;
   60.65      rc = x86_emulate_memop(&ctxt, &emulops);
   60.66      if ( (rc != 0) || 
   60.67           (*res != 0xDDEEFF00) || 
   60.68 @@ -240,6 +249,7 @@ int main(int argc, char **argv)
   60.69      regs.eip    = (unsigned long)&instr[0];
   60.70      regs.edi    = (unsigned long)res;
   60.71      ctxt.cr2    = regs.edi;
   60.72 +    regs.error_code = PFEC_write_access;
   60.73      rc = x86_emulate_memop(&ctxt, &emulops);
   60.74      if ( (rc != 0) || 
   60.75           (*res != 0x2233445D) ||
   60.76 @@ -261,6 +271,7 @@ int main(int argc, char **argv)
   60.77      regs.eip    = (unsigned long)&instr[0];
   60.78      regs.edi    = (unsigned long)res;
   60.79      ctxt.cr2    = regs.edi;
   60.80 +    regs.error_code = PFEC_write_access;
   60.81      rc = x86_emulate_memop(&ctxt, &emulops);
   60.82      if ( (rc != 0) || 
   60.83           (res[0] != 0x9999AAAA) ||
   60.84 @@ -275,6 +286,7 @@ int main(int argc, char **argv)
   60.85      regs.eip    = (unsigned long)&instr[0];
   60.86      regs.edi    = (unsigned long)res;
   60.87      ctxt.cr2    = regs.edi;
   60.88 +    regs.error_code = PFEC_write_access;
   60.89      rc = x86_emulate_memop(&ctxt, &emulops);
   60.90      if ( (rc != 0) || 
   60.91           (res[0] != 0x9999AAAA) ||
   60.92 @@ -292,6 +304,7 @@ int main(int argc, char **argv)
   60.93      regs.ecx    = 0x12345678;
   60.94      ctxt.cr2    = (unsigned long)res;
   60.95      *res        = 0x82;
   60.96 +    regs.error_code = 0;
   60.97      rc = x86_emulate_memop(&ctxt, &emulops);
   60.98      if ( (rc != 0) ||
   60.99           (*res != 0x82) ||
  60.100 @@ -307,6 +320,7 @@ int main(int argc, char **argv)
  60.101      regs.ecx    = 0x12345678;
  60.102      ctxt.cr2    = (unsigned long)res;
  60.103      *res        = 0x1234aa82;
  60.104 +    regs.error_code = 0;
  60.105      rc = x86_emulate_memop(&ctxt, &emulops);
  60.106      if ( (rc != 0) ||
  60.107           (*res != 0x1234aa82) ||
    61.1 --- a/tools/xcutils/Makefile	Fri Aug 25 16:21:39 2006 -0600
    61.2 +++ b/tools/xcutils/Makefile	Sun Aug 27 10:24:41 2006 -0600
    61.3 @@ -26,7 +26,7 @@ CFLAGS += $(INCLUDES)
    61.4  CFLAGS += -Wp,-MD,.$(@F).d
    61.5  PROG_DEP = .*.d
    61.6  
    61.7 -PROGRAMS		= xc_restore xc_save
    61.8 +PROGRAMS		= xc_restore xc_save readnotes
    61.9  
   61.10  LDLIBS			= -L$(XEN_LIBXC) -lxenguest -lxenctrl
   61.11  
    62.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    62.2 +++ b/tools/xcutils/readnotes.c	Sun Aug 27 10:24:41 2006 -0600
    62.3 @@ -0,0 +1,326 @@
    62.4 +#include <elf.h>
    62.5 +#include <errno.h>
    62.6 +#include <fcntl.h>
    62.7 +#include <inttypes.h>
    62.8 +#include <stdio.h>
    62.9 +#include <stdlib.h>
   62.10 +#include <string.h>
   62.11 +#include <unistd.h>
   62.12 +
   62.13 +#include <sys/types.h>
   62.14 +#include <sys/stat.h>
   62.15 +#include <sys/mman.h>
   62.16 +
   62.17 +#include <xen/elfnote.h>
   62.18 +
   62.19 +#define ELFNOTE_NAME(_n_) ((void*)(_n_) + sizeof(*(_n_)))
   62.20 +#define ELFNOTE_DESC(_n_) (ELFNOTE_NAME(_n_) + (((_n_)->n_namesz+3)&~3))
   62.21 +#define ELFNOTE_NEXT(_n_) (ELFNOTE_DESC(_n_) + (((_n_)->n_descsz+3)&~3))
   62.22 +
   62.23 +#ifndef ELFSIZE
   62.24 +#include <limits.h>
   62.25 +#if UINT_MAX == ULONG_MAX
   62.26 +#define ELFSIZE 32
   62.27 +#else
   62.28 +#define ELFSIZE 64
   62.29 +#endif
   62.30 +#endif
   62.31 +
   62.32 +#if (ELFSIZE == 32)
   62.33 +typedef Elf32_Nhdr Elf_Nhdr;
   62.34 +typedef Elf32_Half Elf_Half;
   62.35 +typedef Elf32_Word Elf_Word;
   62.36 +#elif (ELFSIZE == 64)
   62.37 +typedef Elf64_Nhdr Elf_Nhdr;
   62.38 +typedef Elf64_Half Elf_Half;
   62.39 +typedef Elf64_Word Elf_Word;
   62.40 +#else
   62.41 +#error "Unknown ELFSIZE"
   62.42 +#endif
   62.43 +
   62.44 +static void print_string_note(const char *prefix, Elf_Nhdr *note)
   62.45 +{
   62.46 +	printf("%s: %s\n", prefix, (const char *)ELFNOTE_DESC(note));
   62.47 +}
   62.48 +
   62.49 +static void print_numeric_note(const char *prefix,Elf_Nhdr *note)
   62.50 +{
   62.51 +	switch (note->n_descsz)
   62.52 +	{
   62.53 +	case 4:
   62.54 +		printf("%s: %#010" PRIx32 " (4 bytes)\n",
   62.55 +		       prefix, *(uint32_t *)ELFNOTE_DESC(note));
   62.56 +		break;
   62.57 +	case 8:
   62.58 +		printf("%s: %#018" PRIx64 " (8 bytes)\n",
   62.59 +		       prefix, *(uint64_t *)ELFNOTE_DESC(note));
   62.60 +		break;
   62.61 +	default:
   62.62 +		printf("%s: unknown data size %#x\n", prefix, note->n_descsz);
   62.63 +		break;
   62.64 +	}
   62.65 +}
   62.66 +
   62.67 +static inline int is_elf(void *image)
   62.68 +{
   62.69 +	/*
   62.70 +	 * Since we are only accessing the e_ident field we can
   62.71 +	 * acccess the bytes directly without needing to figure out
   62.72 +	 * which version of Elf*_Ehdr structure to use.
   62.73 +	 */
   62.74 +	const unsigned char *hdr = image;
   62.75 +	return ( hdr[EI_MAG0] == ELFMAG0 &&
   62.76 +		 hdr[EI_MAG1] == ELFMAG1 &&
   62.77 +		 hdr[EI_MAG2] == ELFMAG2 &&
   62.78 +		 hdr[EI_MAG3] == ELFMAG3 );
   62.79 +}
   62.80 +
   62.81 +static inline unsigned char ehdr_class(void *image)
   62.82 +{
   62.83 +	/*
   62.84 +	 * Since we are only accessing the e_ident field we can
   62.85 +	 * acccess the bytes directly without needing to figure out
   62.86 +	 * which version of Elf*_Ehdr structure to use.
   62.87 +	 */
   62.88 +	const unsigned char *hdr = image;
   62.89 +	switch (hdr[EI_CLASS])
   62.90 +	{
   62.91 +	case ELFCLASS32:
   62.92 +	case ELFCLASS64:
   62.93 +		return hdr[EI_CLASS];
   62.94 +	default:
   62.95 +		fprintf(stderr, "Unknown ELF class %d\n", hdr[EI_CLASS]);
   62.96 +		exit(1);
   62.97 +	}
   62.98 +}
   62.99 +
  62.100 +static inline Elf_Half ehdr_shnum(void *image)
  62.101 +{
  62.102 +	switch (ehdr_class(image))
  62.103 +	{
  62.104 +	case ELFCLASS32:
  62.105 +		return ((Elf32_Ehdr *)image)->e_shnum;
  62.106 +	case ELFCLASS64:
  62.107 +		return ((Elf64_Ehdr *)image)->e_shnum;
  62.108 +	default:
  62.109 +		exit(1);
  62.110 +	}
  62.111 +}
  62.112 +
  62.113 +static inline Elf_Word shdr_type(void *image, int shnum)
  62.114 +{
  62.115 +	switch (ehdr_class(image))
  62.116 +	{
  62.117 +	case ELFCLASS32:
  62.118 +	{
  62.119 +		Elf32_Ehdr *ehdr = (Elf32_Ehdr *)image;
  62.120 +		Elf32_Shdr *shdr = (Elf32_Shdr*)(image + ehdr->e_shoff +
  62.121 +						 (shnum*ehdr->e_shentsize));
  62.122 +		return shdr->sh_type;
  62.123 +	}
  62.124 +	case ELFCLASS64:
  62.125 +	{
  62.126 +		Elf64_Ehdr *ehdr = (Elf64_Ehdr *)image;
  62.127 +		Elf64_Shdr *shdr = (Elf64_Shdr*)(image + ehdr->e_shoff +
  62.128 +						 (shnum*ehdr->e_shentsize));
  62.129 +		return shdr->sh_type;
  62.130 +	}
  62.131 +	default:
  62.132 +		exit(1);
  62.133 +	}
  62.134 +}
  62.135 +
  62.136 +static inline const char *shdr_name(void *image, int shnum)
  62.137 +{
  62.138 +	const char *shstrtab;
  62.139 +
  62.140 +	switch (ehdr_class(image))
  62.141 +	{
  62.142 +	case ELFCLASS32:
  62.143 +	{
  62.144 +		Elf32_Ehdr *ehdr = (Elf32_Ehdr *)image;
  62.145 +		Elf32_Shdr *shdr;
  62.146 +		/* Find the section-header strings table. */
  62.147 +		if ( ehdr->e_shstrndx == SHN_UNDEF )
  62.148 +			return NULL;
  62.149 +		shdr = (Elf32_Shdr *)(image + ehdr->e_shoff +
  62.150 +				      (ehdr->e_shstrndx*ehdr->e_shentsize));
  62.151 +		shstrtab = image + shdr->sh_offset;
  62.152 +
  62.153 +		shdr= (Elf32_Shdr*)(image + ehdr->e_shoff +
  62.154 +				    (shnum*ehdr->e_shentsize));
  62.155 +		return &shstrtab[shdr->sh_name];
  62.156 +	}
  62.157 +	case ELFCLASS64:
  62.158 +	{
  62.159 +		Elf64_Ehdr *ehdr = (Elf64_Ehdr *)image;
  62.160 +		Elf64_Shdr *shdr;
  62.161 +		/* Find the section-header strings table. */
  62.162 +		if ( ehdr->e_shstrndx == SHN_UNDEF )
  62.163 +			return NULL;
  62.164 +		shdr = (Elf64_Shdr *)(image + ehdr->e_shoff +
  62.165 +				      (ehdr->e_shstrndx*ehdr->e_shentsize));
  62.166 +		shstrtab = image + shdr->sh_offset;
  62.167 +
  62.168 +		shdr= (Elf64_Shdr*)(image + ehdr->e_shoff +
  62.169 +				    (shnum*ehdr->e_shentsize));
  62.170 +		return &shstrtab[shdr->sh_name];
  62.171 +	}
  62.172 +	default:
  62.173 +		exit(1);
  62.174 +	}
  62.175 +}
  62.176 +static inline void *shdr_start(void *image, int shnum)
  62.177 +{
  62.178 +	switch (ehdr_class(image))
  62.179 +	{
  62.180 +	case ELFCLASS32:
  62.181 +	{
  62.182 +		Elf32_Ehdr *ehdr = (Elf32_Ehdr *)image;
  62.183 +		Elf32_Shdr *shdr = (Elf32_Shdr*)(image + ehdr->e_shoff +
  62.184 +						 (shnum*ehdr->e_shentsize));
  62.185 +		return image + shdr->sh_offset;
  62.186 +	}
  62.187 +	case ELFCLASS64:
  62.188 +	{
  62.189 +		Elf64_Ehdr *ehdr = (Elf64_Ehdr *)image;
  62.190 +		Elf64_Shdr *shdr = (Elf64_Shdr*)(image + ehdr->e_shoff +
  62.191 +						 (shnum*ehdr->e_shentsize));
  62.192 +		return image + shdr->sh_offset;
  62.193 +	}
  62.194 +	default:
  62.195 +		exit(1);
  62.196 +	}
  62.197 +}
  62.198 +
  62.199 +static inline void *shdr_end(void *image, int shnum)
  62.200 +{
  62.201 +	switch (ehdr_class(image))
  62.202 +	{
  62.203 +	case ELFCLASS32:
  62.204 +	{
  62.205 +		Elf32_Ehdr *ehdr = (Elf32_Ehdr *)image;
  62.206 +		Elf32_Shdr *shdr = (Elf32_Shdr*)(image + ehdr->e_shoff +
  62.207 +						 (shnum*ehdr->e_shentsize));
  62.208 +		return image + shdr->sh_offset + shdr->sh_size;
  62.209 +	}
  62.210 +	case ELFCLASS64:
  62.211 +	{
  62.212 +		Elf64_Ehdr *ehdr = (Elf64_Ehdr *)image;
  62.213 +		Elf64_Shdr *shdr = (Elf64_Shdr*)(image + ehdr->e_shoff +
  62.214 +						 (shnum*ehdr->e_shentsize));
  62.215 +		return image + shdr->sh_offset + shdr->sh_size;
  62.216 +	}
  62.217 +	default:
  62.218 +		exit(1);
  62.219 +	}
  62.220 +}
  62.221 +
  62.222 +int main(int argc, char **argv)
  62.223 +{
  62.224 +	const char *f;
  62.225 +	int fd,h;
  62.226 +	void *image;
  62.227 +	struct stat st;
  62.228 +	Elf_Nhdr *note;
  62.229 +
  62.230 +	if (argc != 2)
  62.231 +	{
  62.232 +		fprintf(stderr, "Usage: readnotes <elfimage>\n");
  62.233 +		return 1;
  62.234 +	}
  62.235 +	f = argv[1];
  62.236 +
  62.237 +	fd = open(f, O_RDONLY);
  62.238 +	if (fd == -1)
  62.239 +	{
  62.240 +		fprintf(stderr, "Unable to open %s: %s\n", f, strerror(errno));
  62.241 +		return 1;
  62.242 +	}
  62.243 +	if (fstat(fd, &st) == -1)
  62.244 +	{
  62.245 +		fprintf(stderr, "Unable to determine size of %s: %s\n",
  62.246 +			f, strerror(errno));
  62.247 +		return 1;
  62.248 +	}
  62.249 +
  62.250 +	image = mmap(0, st.st_size, PROT_READ, MAP_SHARED, fd, 0);
  62.251 +	if (image == MAP_FAILED)
  62.252 +	{
  62.253 +		fprintf(stderr, "Unable to map %s: %s\n", f, strerror(errno));
  62.254 +		return 1;
  62.255 +	}
  62.256 +
  62.257 +	if ( !is_elf(image) )
  62.258 +	{
  62.259 +		fprintf(stderr, "File %s is not an ELF image\n", f);
  62.260 +		return 1;
  62.261 +	}
  62.262 +
  62.263 +	for ( h=0; h < ehdr_shnum(image); h++)
  62.264 +	{
  62.265 +		if (shdr_type(image,h) != SHT_NOTE)
  62.266 +			continue;
  62.267 +		for (note = (Elf_Nhdr*)shdr_start(image,h);
  62.268 +		     note < (Elf_Nhdr*)shdr_end(image,h);
  62.269 +		     note = (Elf_Nhdr*)(ELFNOTE_NEXT(note)))
  62.270 +		{
  62.271 +			switch(note->n_type)
  62.272 +			{
  62.273 +			case XEN_ELFNOTE_INFO:
  62.274 +				print_string_note("INFO", note);
  62.275 +				break;
  62.276 +			case XEN_ELFNOTE_ENTRY:
  62.277 +				print_numeric_note("ENTRY", note);
  62.278 +				break;
  62.279 +			case XEN_ELFNOTE_HYPERCALL_PAGE:
  62.280 +				print_numeric_note("HYPERCALL_PAGE", note);
  62.281 +				break;
  62.282 +			case XEN_ELFNOTE_VIRT_BASE:
  62.283 +				print_numeric_note("VIRT_BASE", note);
  62.284 +				break;
  62.285 +			case XEN_ELFNOTE_PADDR_OFFSET:
  62.286 +				print_numeric_note("PADDR_OFFSET", note);
  62.287 +				break;
  62.288 +			case XEN_ELFNOTE_XEN_VERSION:
  62.289 +				print_string_note("XEN_VERSION", note);
  62.290 +				break;
  62.291 +			case XEN_ELFNOTE_GUEST_OS:
  62.292 +				print_string_note("GUEST_OS", note);
  62.293 +				break;
  62.294 +			case XEN_ELFNOTE_GUEST_VERSION:
  62.295 +				print_string_note("GUEST_VERSION", note);
  62.296 +				break;
  62.297 +			case XEN_ELFNOTE_LOADER:
  62.298 +				print_string_note("LOADER", note);
  62.299 +				break;
  62.300 +			case XEN_ELFNOTE_PAE_MODE:
  62.301 +				print_string_note("PAE_MODE", note);
  62.302 +				break;
  62.303 +			case XEN_ELFNOTE_FEATURES:
  62.304 +				print_string_note("FEATURES", note);
  62.305 +				break;
  62.306 +			default:
  62.307 +				printf("unknown note type %#x\n", note->n_type);
  62.308 +				break;
  62.309 +			}
  62.310 +		}
  62.311 +	}
  62.312 +
  62.313 +	for ( h=0; h < ehdr_shnum(image); h++)
  62.314 +	{
  62.315 +		const char *name = shdr_name(image,h);
  62.316 +
  62.317 +		if ( name == NULL )
  62.318 +			continue;
  62.319 +		if ( strcmp(name, "__xen_guest") != 0 )
  62.320 +			continue;
  62.321 +
  62.322 +		printf("__xen_guest: %s\n", (const char *)shdr_start(image, h));
  62.323 +		break;
  62.324 +	}
  62.325 +
  62.326 +	return 0;
  62.327 +}
  62.328 +
  62.329 +
    63.1 --- a/tools/xenmon/setmask.c	Fri Aug 25 16:21:39 2006 -0600
    63.2 +++ b/tools/xenmon/setmask.c	Sun Aug 27 10:24:41 2006 -0600
    63.3 @@ -40,15 +40,14 @@ typedef struct { int counter; } atomic_t
    63.4  
    63.5  int main(int argc, char * argv[])
    63.6  {
    63.7 -
    63.8 -    dom0_op_t op; 
    63.9 +    struct xen_sysctl sysctl;
   63.10      int ret;
   63.11  
   63.12      int xc_handle = xc_interface_open();
   63.13 -    op.cmd = DOM0_TBUFCONTROL;
   63.14 -    op.interface_version = DOM0_INTERFACE_VERSION;
   63.15 -    op.u.tbufcontrol.op  = DOM0_TBUF_GET_INFO;
   63.16 -    ret = xc_dom0_op(xc_handle, &op);
   63.17 +    sysctl.cmd = XEN_SYSCTL_tbuf_op;
   63.18 +    sysctl.interface_version = XEN_SYSCTL_INTERFACE_VERSION;
   63.19 +    sysctl.u.tbuf_op.cmd  = XEN_SYSCTL_TBUFOP_get_info;
   63.20 +    ret = xc_sysctl(xc_handle, &sysctl);
   63.21      if ( ret != 0 )
   63.22      {
   63.23          perror("Failure to get event mask from Xen");
   63.24 @@ -56,26 +55,26 @@ int main(int argc, char * argv[])
   63.25      }
   63.26      else
   63.27      {
   63.28 -        printf("Current event mask: 0x%.8x\n", op.u.tbufcontrol.evt_mask);
   63.29 +        printf("Current event mask: 0x%.8x\n", sysctl.u.tbuf_op.evt_mask);
   63.30      }
   63.31  
   63.32 -    op.cmd = DOM0_TBUFCONTROL;
   63.33 -    op.interface_version = DOM0_INTERFACE_VERSION;
   63.34 -    op.u.tbufcontrol.op  = DOM0_TBUF_SET_EVT_MASK;
   63.35 -    op.u.tbufcontrol.evt_mask = XENMON;
   63.36 +    sysctl.cmd = XEN_SYSCTL_tbuf_op;
   63.37 +    sysctl.interface_version = XEN_SYSCTL_INTERFACE_VERSION;
   63.38 +    sysctl.u.tbuf_op.cmd  = XEN_SYSCTL_TBUFOP_set_evt_mask;
   63.39 +    sysctl.u.tbuf_op.evt_mask = XENMON;
   63.40  
   63.41 -    ret = xc_dom0_op(xc_handle, &op);
   63.42 -    printf("Setting mask to 0x%.8x\n", op.u.tbufcontrol.evt_mask);
   63.43 +    ret = xc_sysctl(xc_handle, &sysctl);
   63.44 +    printf("Setting mask to 0x%.8x\n", sysctl.u.tbuf_op.evt_mask);
   63.45      if ( ret != 0 )
   63.46      {
   63.47          perror("Failure to get scheduler ID from Xen");
   63.48          exit(1);
   63.49      }
   63.50  
   63.51 -    op.cmd = DOM0_TBUFCONTROL;
   63.52 -    op.interface_version = DOM0_INTERFACE_VERSION;
   63.53 -    op.u.tbufcontrol.op  = DOM0_TBUF_GET_INFO;
   63.54 -    ret = xc_dom0_op(xc_handle, &op);
   63.55 +    sysctl.cmd = XEN_SYSCTL_tbuf_op;
   63.56 +    sysctl.interface_version = XEN_SYSCTL_INTERFACE_VERSION;
   63.57 +    sysctl.u.tbuf_op.cmd  = XEN_SYSCTL_TBUFOP_get_info;
   63.58 +    ret = xc_sysctl(xc_handle, &sysctl);
   63.59      if ( ret != 0 )
   63.60      {
   63.61          perror("Failure to get event mask from Xen");
   63.62 @@ -83,7 +82,7 @@ int main(int argc, char * argv[])
   63.63      }
   63.64      else
   63.65      {
   63.66 -        printf("Current event mask: 0x%.8x\n", op.u.tbufcontrol.evt_mask);
   63.67 +        printf("Current event mask: 0x%.8x\n", sysctl.u.tbuf_op.evt_mask);
   63.68      }
   63.69      xc_interface_close(xc_handle);
   63.70      return 0;
    64.1 --- a/tools/xenstat/libxenstat/src/xenstat.c	Fri Aug 25 16:21:39 2006 -0600
    64.2 +++ b/tools/xenstat/libxenstat/src/xenstat.c	Sun Aug 27 10:24:41 2006 -0600
    64.3 @@ -210,8 +210,8 @@ xenstat_node *xenstat_get_node(xenstat_h
    64.4  {
    64.5  #define DOMAIN_CHUNK_SIZE 256
    64.6  	xenstat_node *node;
    64.7 -	dom0_physinfo_t physinfo;
    64.8 -	dom0_getdomaininfo_t domaininfo[DOMAIN_CHUNK_SIZE];
    64.9 +	xc_physinfo_t physinfo;
   64.10 +	xc_domaininfo_t domaininfo[DOMAIN_CHUNK_SIZE];
   64.11  	unsigned int new_domains;
   64.12  	unsigned int i;
   64.13  
   64.14 @@ -530,7 +530,7 @@ static int xenstat_collect_vcpus(xenstat
   64.15  	
   64.16  		for (vcpu = 0; vcpu < node->domains[i].num_vcpus; vcpu++) {
   64.17  			/* FIXME: need to be using a more efficient mechanism*/
   64.18 -			dom0_getvcpuinfo_t info;
   64.19 +			xc_vcpuinfo_t info;
   64.20  
   64.21  			if (xc_vcpu_getinfo(node->handle->xc_handle,
   64.22  					    node->domains[i].id, vcpu, &info) != 0) {
    65.1 --- a/xen/acm/acm_simple_type_enforcement_hooks.c	Fri Aug 25 16:21:39 2006 -0600
    65.2 +++ b/xen/acm/acm_simple_type_enforcement_hooks.c	Sun Aug 27 10:24:41 2006 -0600
    65.3 @@ -353,7 +353,7 @@ ste_dump_stats(u8 *buf, u16 buf_len)
    65.4      stats.ec_cachehit_count = htonl(atomic_read(&ste_bin_pol.ec_cachehit_count));
    65.5      stats.gt_cachehit_count = htonl(atomic_read(&ste_bin_pol.gt_cachehit_count));
    65.6  
    65.7 -    if (buf_len < sizeof(struct acm_ste_stats_buffer)
    65.8 +    if (buf_len < sizeof(struct acm_ste_stats_buffer))
    65.9          return -ENOMEM;
   65.10  
   65.11      memcpy(buf, &stats, sizeof(struct acm_ste_stats_buffer));
    66.1 --- a/xen/arch/ia64/tools/xelilo/elilo.README	Fri Aug 25 16:21:39 2006 -0600
    66.2 +++ b/xen/arch/ia64/tools/xelilo/elilo.README	Sun Aug 27 10:24:41 2006 -0600
    66.3 @@ -17,4 +17,4 @@ 2. How to run with the new elilo.efi?
    66.4          		vmm=xen.gz
    66.5          		initrd=initrd-2.6.9-5.7.EL.img
    66.6          		read-only
    66.7 -        		append="com2=57600,8n1 console=com2 sched=bvt -- nomca console=ttyS1,57600 console=tty0 root=/dev/sda3"
    66.8 +        		append="com2=57600,8n1 console=com2 -- nomca console=ttyS1,57600 console=tty0 root=/dev/sda3"
    67.1 --- a/xen/arch/ia64/xen/dom0_ops.c	Fri Aug 25 16:21:39 2006 -0600
    67.2 +++ b/xen/arch/ia64/xen/dom0_ops.c	Sun Aug 27 10:24:41 2006 -0600
    67.3 @@ -10,14 +10,14 @@
    67.4  #include <xen/types.h>
    67.5  #include <xen/lib.h>
    67.6  #include <xen/mm.h>
    67.7 -#include <public/dom0_ops.h>
    67.8 +#include <public/domctl.h>
    67.9 +#include <public/sysctl.h>
   67.10  #include <xen/sched.h>
   67.11  #include <xen/event.h>
   67.12  #include <asm/pdb.h>
   67.13  #include <xen/trace.h>
   67.14  #include <xen/console.h>
   67.15  #include <xen/guest_access.h>
   67.16 -#include <public/sched_ctl.h>
   67.17  #include <asm/vmx.h>
   67.18  #include <asm/dom_fw.h>
   67.19  #include <xen/iocap.h>
   67.20 @@ -26,7 +26,8 @@
   67.21  void build_physmap_table(struct domain *d);
   67.22  
   67.23  extern unsigned long total_pages;
   67.24 -long arch_do_dom0_op(dom0_op_t *op, XEN_GUEST_HANDLE(dom0_op_t) u_dom0_op)
   67.25 +
   67.26 +long arch_do_domctl(xen_domctl_t *op, XEN_GUEST_HANDLE(xen_domctl_t) u_domctl)
   67.27  {
   67.28      long ret = 0;
   67.29  
   67.30 @@ -35,10 +36,10 @@ long arch_do_dom0_op(dom0_op_t *op, XEN_
   67.31  
   67.32      switch ( op->cmd )
   67.33      {
   67.34 -    case DOM0_GETMEMLIST:
   67.35 +    case XEN_DOMCTL_getmemlist:
   67.36      {
   67.37          unsigned long i;
   67.38 -        struct domain *d = find_domain_by_id(op->u.getmemlist.domain);
   67.39 +        struct domain *d = find_domain_by_id(op->domain);
   67.40          unsigned long start_page = op->u.getmemlist.max_pfns >> 32;
   67.41          unsigned long nr_pages = op->u.getmemlist.max_pfns & 0xffffffff;
   67.42          unsigned long mfn;
   67.43 @@ -64,39 +65,17 @@ long arch_do_dom0_op(dom0_op_t *op, XEN_
   67.44          }
   67.45  
   67.46          op->u.getmemlist.num_pfns = i;
   67.47 -        if (copy_to_guest(u_dom0_op, op, 1))
   67.48 +        if (copy_to_guest(u_domctl, op, 1))
   67.49              ret = -EFAULT;
   67.50  
   67.51          put_domain(d);
   67.52      }
   67.53      break;
   67.54  
   67.55 -    case DOM0_PHYSINFO:
   67.56 +    case XEN_DOMCTL_arch_setup:
   67.57      {
   67.58 -        dom0_physinfo_t *pi = &op->u.physinfo;
   67.59 -
   67.60 -        pi->threads_per_core =
   67.61 -            cpus_weight(cpu_sibling_map[0]);
   67.62 -        pi->cores_per_socket =
   67.63 -            cpus_weight(cpu_core_map[0]) / pi->threads_per_core;
   67.64 -        pi->sockets_per_node = 
   67.65 -            num_online_cpus() / cpus_weight(cpu_core_map[0]);
   67.66 -        pi->nr_nodes         = 1;
   67.67 -        pi->total_pages      = total_pages; 
   67.68 -        pi->free_pages       = avail_domheap_pages();
   67.69 -        pi->cpu_khz          = local_cpu_data->proc_freq / 1000;
   67.70 -        memset(pi->hw_cap, 0, sizeof(pi->hw_cap));
   67.71 -        //memcpy(pi->hw_cap, boot_cpu_data.x86_capability, NCAPINTS*4);
   67.72 -        ret = 0;
   67.73 -        if ( copy_to_guest(u_dom0_op, op, 1) )
   67.74 -            ret = -EFAULT;
   67.75 -    }
   67.76 -    break;
   67.77 -
   67.78 -    case DOM0_DOMAIN_SETUP:
   67.79 -    {
   67.80 -        dom0_domain_setup_t *ds = &op->u.domain_setup;
   67.81 -        struct domain *d = find_domain_by_id(ds->domain);
   67.82 +        xen_domctl_arch_setup_t *ds = &op->u.arch_setup;
   67.83 +        struct domain *d = find_domain_by_id(op->domain);
   67.84  
   67.85          if ( d == NULL) {
   67.86              ret = -EINVAL;
   67.87 @@ -113,7 +92,7 @@ long arch_do_dom0_op(dom0_op_t *op, XEN_
   67.88              ds->xsi_va = d->arch.shared_info_va;
   67.89              ds->hypercall_imm = d->arch.breakimm;
   67.90              /* Copy back.  */
   67.91 -            if ( copy_to_guest(u_dom0_op, op, 1) )
   67.92 +            if ( copy_to_guest(u_domctl, op, 1) )
   67.93                  ret = -EFAULT;
   67.94          }
   67.95          else {
   67.96 @@ -153,21 +132,21 @@ long arch_do_dom0_op(dom0_op_t *op, XEN_
   67.97      }
   67.98      break;
   67.99  
  67.100 -    case DOM0_SHADOW_CONTROL:
  67.101 +    case XEN_DOMCTL_shadow_op:
  67.102      {
  67.103          struct domain *d; 
  67.104          ret = -ESRCH;
  67.105 -        d = find_domain_by_id(op->u.shadow_control.domain);
  67.106 +        d = find_domain_by_id(op->domain);
  67.107          if ( d != NULL )
  67.108          {
  67.109 -            ret = shadow_mode_control(d, &op->u.shadow_control);
  67.110 +            ret = shadow_mode_control(d, &op->u.shadow_op);
  67.111              put_domain(d);
  67.112 -            copy_to_guest(u_dom0_op, op, 1);
  67.113 +            copy_to_guest(u_domctl, op, 1);
  67.114          } 
  67.115      }
  67.116      break;
  67.117  
  67.118 -    case DOM0_IOPORT_PERMISSION:
  67.119 +    case XEN_DOMCTL_ioport_permission:
  67.120      {
  67.121          struct domain *d;
  67.122          unsigned int fp = op->u.ioport_permission.first_port;
  67.123 @@ -175,7 +154,7 @@ long arch_do_dom0_op(dom0_op_t *op, XEN_
  67.124          unsigned int lp = fp + np - 1;
  67.125  
  67.126          ret = -ESRCH;
  67.127 -        d = find_domain_by_id(op->u.ioport_permission.domain);
  67.128 +        d = find_domain_by_id(op->domain);
  67.129          if (unlikely(d == NULL))
  67.130              break;
  67.131  
  67.132 @@ -192,7 +171,47 @@ long arch_do_dom0_op(dom0_op_t *op, XEN_
  67.133      }
  67.134      break;
  67.135      default:
  67.136 -        printf("arch_do_dom0_op: unrecognized dom0 op: %d!!!\n",op->cmd);
  67.137 +        printf("arch_do_domctl: unrecognized domctl: %d!!!\n",op->cmd);
  67.138 +        ret = -ENOSYS;
  67.139 +
  67.140 +    }
  67.141 +
  67.142 +    return ret;
  67.143 +}
  67.144 +
  67.145 +long arch_do_sysctl(xen_sysctl_t *op, XEN_GUEST_HANDLE(xen_sysctl_t) u_sysctl)
  67.146 +{
  67.147 +    long ret = 0;
  67.148 +
  67.149 +    if ( !IS_PRIV(current->domain) )
  67.150 +        return -EPERM;
  67.151 +
  67.152 +    switch ( op->cmd )
  67.153 +    {
  67.154 +    case XEN_SYSCTL_physinfo:
  67.155 +    {
  67.156 +        xen_sysctl_physinfo_t *pi = &op->u.physinfo;
  67.157 +
  67.158 +        pi->threads_per_core =
  67.159 +            cpus_weight(cpu_sibling_map[0]);
  67.160 +        pi->cores_per_socket =
  67.161 +            cpus_weight(cpu_core_map[0]) / pi->threads_per_core;
  67.162 +        pi->sockets_per_node = 
  67.163 +            num_online_cpus() / cpus_weight(cpu_core_map[0]);
  67.164 +        pi->nr_nodes         = 1;
  67.165 +        pi->total_pages      = total_pages; 
  67.166 +        pi->free_pages       = avail_domheap_pages();
  67.167 +        pi->cpu_khz          = local_cpu_data->proc_freq / 1000;
  67.168 +        memset(pi->hw_cap, 0, sizeof(pi->hw_cap));
  67.169 +        //memcpy(pi->hw_cap, boot_cpu_data.x86_capability, NCAPINTS*4);
  67.170 +        ret = 0;
  67.171 +        if ( copy_to_guest(u_sysctl, op, 1) )
  67.172 +            ret = -EFAULT;
  67.173 +    }
  67.174 +    break;
  67.175 +
  67.176 +    default:
  67.177 +        printf("arch_do_sysctl: unrecognized sysctl: %d!!!\n",op->cmd);
  67.178          ret = -ENOSYS;
  67.179  
  67.180      }
    68.1 --- a/xen/arch/ia64/xen/domain.c	Fri Aug 25 16:21:39 2006 -0600
    68.2 +++ b/xen/arch/ia64/xen/domain.c	Sun Aug 27 10:24:41 2006 -0600
    68.3 @@ -615,7 +615,7 @@ domain_set_shared_info_va (unsigned long
    68.4  /* Transfer and clear the shadow bitmap in 1kB chunks for L1 cache. */
    68.5  #define SHADOW_COPY_CHUNK (1024 / sizeof (unsigned long))
    68.6  
    68.7 -int shadow_mode_control(struct domain *d, dom0_shadow_control_t *sc)
    68.8 +int shadow_mode_control(struct domain *d, xen_domctl_shadow_ops_t *sc)
    68.9  {
   68.10  	unsigned int op = sc->op;
   68.11  	int          rc = 0;
   68.12 @@ -631,7 +631,7 @@ int shadow_mode_control(struct domain *d
   68.13  
   68.14  	switch (op)
   68.15  	{
   68.16 -	case DOM0_SHADOW_CONTROL_OP_OFF:
   68.17 +	case XEN_DOMCTL_SHADOW_OP_OFF:
   68.18  		if (shadow_mode_enabled (d)) {
   68.19  			u64 *bm = d->arch.shadow_bitmap;
   68.20  
   68.21 @@ -645,12 +645,12 @@ int shadow_mode_control(struct domain *d
   68.22  		}
   68.23  		break;
   68.24  
   68.25 -	case DOM0_SHADOW_CONTROL_OP_ENABLE_TEST:
   68.26 -	case DOM0_SHADOW_CONTROL_OP_ENABLE_TRANSLATE:
   68.27 +	case XEN_DOMCTL_SHADOW_OP_ENABLE_TEST:
   68.28 +	case XEN_DOMCTL_SHADOW_OP_ENABLE_TRANSLATE:
   68.29  		rc = -EINVAL;
   68.30  		break;
   68.31  
   68.32 -	case DOM0_SHADOW_CONTROL_OP_ENABLE_LOGDIRTY:
   68.33 +	case XEN_DOMCTL_SHADOW_OP_ENABLE_LOGDIRTY:
   68.34  		if (shadow_mode_enabled(d)) {
   68.35  			rc = -EINVAL;
   68.36  			break;
   68.37 @@ -677,7 +677,7 @@ int shadow_mode_control(struct domain *d
   68.38  		}
   68.39  		break;
   68.40  
   68.41 -	case DOM0_SHADOW_CONTROL_OP_CLEAN:
   68.42 +	case XEN_DOMCTL_SHADOW_OP_CLEAN:
   68.43  	  {
   68.44  		int nbr_longs;
   68.45  
   68.46 @@ -716,7 +716,7 @@ int shadow_mode_control(struct domain *d
   68.47  		break;
   68.48  	  }
   68.49  
   68.50 -	case DOM0_SHADOW_CONTROL_OP_PEEK:
   68.51 +	case XEN_DOMCTL_SHADOW_OP_PEEK:
   68.52  	{
   68.53  		unsigned long size;
   68.54  
    69.1 --- a/xen/arch/ia64/xen/hypercall.c	Fri Aug 25 16:21:39 2006 -0600
    69.2 +++ b/xen/arch/ia64/xen/hypercall.c	Sun Aug 27 10:24:41 2006 -0600
    69.3 @@ -19,7 +19,8 @@
    69.4  
    69.5  #include <asm/vcpu.h>
    69.6  #include <asm/dom_fw.h>
    69.7 -#include <public/dom0_ops.h>
    69.8 +#include <public/domctl.h>
    69.9 +#include <public/sysctl.h>
   69.10  #include <public/event_channel.h>
   69.11  #include <public/memory.h>
   69.12  #include <public/sched.h>
   69.13 @@ -44,7 +45,7 @@ const hypercall_t ia64_hypercall_table[N
   69.14  	(hypercall_t)do_ni_hypercall,		/* do_set_callbacks */
   69.15  	(hypercall_t)do_ni_hypercall,		/* do_fpu_taskswitch *//*  5 */
   69.16  	(hypercall_t)do_sched_op_compat,
   69.17 -	(hypercall_t)do_dom0_op,
   69.18 +	(hypercall_t)do_ni_hypercall,
   69.19  	(hypercall_t)do_ni_hypercall,		/* do_set_debugreg */
   69.20  	(hypercall_t)do_ni_hypercall,		/* do_get_debugreg */
   69.21  	(hypercall_t)do_ni_hypercall,		/* do_update_descriptor * 10 */
   69.22 @@ -72,8 +73,8 @@ const hypercall_t ia64_hypercall_table[N
   69.23  	(hypercall_t)do_event_channel_op,
   69.24  	(hypercall_t)do_physdev_op,
   69.25  	(hypercall_t)do_hvm_op,			/*  */
   69.26 -	(hypercall_t)do_ni_hypercall,		/*  */                 /* 35 */
   69.27 -	(hypercall_t)do_ni_hypercall,		/*  */
   69.28 +	(hypercall_t)do_sysctl,			/*  */                  /* 35 */
   69.29 +	(hypercall_t)do_domctl,			/*  */
   69.30  	(hypercall_t)do_ni_hypercall,		/*  */
   69.31  	(hypercall_t)do_ni_hypercall,		/*  */
   69.32  	(hypercall_t)do_ni_hypercall,		/*  */
    70.1 --- a/xen/arch/powerpc/dom0_ops.c	Fri Aug 25 16:21:39 2006 -0600
    70.2 +++ b/xen/arch/powerpc/dom0_ops.c	Sun Aug 27 10:24:41 2006 -0600
    70.3 @@ -24,10 +24,8 @@
    70.4  #include <xen/sched.h>
    70.5  #include <xen/guest_access.h>
    70.6  #include <public/xen.h>
    70.7 -#include <public/dom0_ops.h>
    70.8 -
    70.9 -extern void arch_getdomaininfo_ctxt(struct vcpu *v, vcpu_guest_context_t *c);
   70.10 -extern long arch_do_dom0_op(struct dom0_op *op, XEN_GUEST_HANDLE(dom0_op_t) u_dom0_op);
   70.11 +#include <public/domctl.h>
   70.12 +#include <public/sysctl.h>
   70.13  
   70.14  void arch_getdomaininfo_ctxt(struct vcpu *v, vcpu_guest_context_t *c)
   70.15  { 
   70.16 @@ -35,16 +33,17 @@ void arch_getdomaininfo_ctxt(struct vcpu
   70.17      /* XXX fill in rest of vcpu_guest_context_t */
   70.18  }
   70.19  
   70.20 -long arch_do_dom0_op(struct dom0_op *op, XEN_GUEST_HANDLE(dom0_op_t) u_dom0_op)
   70.21 +long arch_do_domctl(struct xen_domctl *domctl,
   70.22 +                    XEN_GUEST_HANDLE(xen_domctl_t) u_domctl)
   70.23  {
   70.24      long ret = 0;
   70.25  
   70.26 -    switch (op->cmd) {
   70.27 -    case DOM0_GETMEMLIST:
   70.28 +    switch (domctl->cmd) {
   70.29 +    case XEN_DOMCTL_getmemlist:
   70.30      {
   70.31          int i;
   70.32 -        struct domain *d = find_domain_by_id(op->u.getmemlist.domain);
   70.33 -        unsigned long max_pfns = op->u.getmemlist.max_pfns;
   70.34 +        struct domain *d = find_domain_by_id(domctl->domain);
   70.35 +        unsigned long max_pfns = domctl->u.getmemlist.max_pfns;
   70.36          xen_pfn_t mfn;
   70.37          struct list_head *list_ent;
   70.38  
   70.39 @@ -59,7 +58,7 @@ long arch_do_dom0_op(struct dom0_op *op,
   70.40              {
   70.41                  mfn = page_to_mfn(list_entry(
   70.42                      list_ent, struct page_info, list));
   70.43 -                if ( copy_to_guest_offset(op->u.getmemlist.buffer,
   70.44 +                if ( copy_to_guest_offset(domctl->u.getmemlist.buffer,
   70.45                                            i, &mfn, 1) )
   70.46                  {
   70.47                      ret = -EFAULT;
   70.48 @@ -69,17 +68,31 @@ long arch_do_dom0_op(struct dom0_op *op,
   70.49              }
   70.50              spin_unlock(&d->page_alloc_lock);
   70.51  
   70.52 -            op->u.getmemlist.num_pfns = i;
   70.53 -            copy_to_guest(u_dom0_op, op, 1);
   70.54 +            domctl->u.getmemlist.num_pfns = i;
   70.55 +            copy_to_guest(u_domctl, domctl, 1);
   70.56              
   70.57              put_domain(d);
   70.58          }
   70.59      }
   70.60      break;
   70.61  
   70.62 -    case DOM0_PHYSINFO:
   70.63 +    default:
   70.64 +        ret = -ENOSYS;
   70.65 +        break;
   70.66 +    }
   70.67 +
   70.68 +    return ret;
   70.69 +}
   70.70 +
   70.71 +long arch_do_sysctl(struct xen_sysctl *sysctl,
   70.72 +                    XEN_GUEST_HANDLE(xen_sysctl_t) u_sysctl)
   70.73 +{
   70.74 +    long ret = 0;
   70.75 +
   70.76 +    switch (sysctl->cmd) {
   70.77 +    case XEN_SYSCTL_physinfo:
   70.78      {
   70.79 -        dom0_physinfo_t *pi = &op->u.physinfo;
   70.80 +        xen_sysctl_physinfo_t *pi = &sysctl->u.physinfo;
   70.81  
   70.82          pi->threads_per_core = 1;
   70.83          pi->cores_per_socket = 1;
   70.84 @@ -90,7 +103,7 @@ long arch_do_dom0_op(struct dom0_op *op,
   70.85          pi->cpu_khz          = cpu_khz;
   70.86          memset(pi->hw_cap, 0, sizeof(pi->hw_cap));
   70.87          ret = 0;
   70.88 -        if ( copy_to_guest(u_dom0_op, op, 1) )
   70.89 +        if ( copy_to_guest(u_sysctl, sysctl, 1) )
   70.90              ret = -EFAULT;
   70.91      }
   70.92      break;
   70.93 @@ -102,3 +115,4 @@ long arch_do_dom0_op(struct dom0_op *op,
   70.94  
   70.95      return ret;
   70.96  }
   70.97 +
    71.1 --- a/xen/arch/powerpc/domain_build.c	Fri Aug 25 16:21:39 2006 -0600
    71.2 +++ b/xen/arch/powerpc/domain_build.c	Sun Aug 27 10:24:41 2006 -0600
    71.3 @@ -137,10 +137,6 @@ int construct_dom0(struct domain *d,
    71.4      dsi.v_kernend = RM_MASK(dsi.v_kernend, 42);
    71.5      dsi.v_kernentry = RM_MASK(dsi.v_kernentry, 42);
    71.6  
    71.7 -    if (dsi.xen_section_string == NULL) {
    71.8 -        printk("Not a Xen-ELF image: '__xen_guest' section not found.\n");
    71.9 -        return -EINVAL;
   71.10 -    }
   71.11      printk("*** LOADING DOMAIN 0 ***\n");
   71.12  
   71.13      /* By default DOM0 is allocated all available memory. */
    72.1 --- a/xen/arch/powerpc/powerpc64/hypercall_table.S	Fri Aug 25 16:21:39 2006 -0600
    72.2 +++ b/xen/arch/powerpc/powerpc64/hypercall_table.S	Sun Aug 27 10:24:41 2006 -0600
    72.3 @@ -11,7 +11,7 @@
    72.4          .quad 0 /* do_set_callbacks */
    72.5          .quad 0 /* do_fpu_taskswitch */     /*  5 */
    72.6          .quad do_sched_op
    72.7 -        .quad do_dom0_op
    72.8 +        .quad 0 /* do_platform_op */
    72.9          .quad 0 /* do_set_debugreg */
   72.10          .quad 0 /* do_get_debugreg */
   72.11          .quad 0 /* do_update_descriptor */  /* 10 */
   72.12 @@ -38,46 +38,9 @@
   72.13          .quad 0 /* do_xenoprof_op */
   72.14          .quad do_event_channel_op
   72.15          .quad do_physdev_op
   72.16 +        .quad 0 /* do_hvm_op */
   72.17 +        .quad do_sysctl             /* 35 */
   72.18 +        .quad do_domctl
   72.19          .rept NR_hypercalls-((.-__hypercall_table)/8)
   72.20          .quad do_ni_hypercall
   72.21          .endr
   72.22 -
   72.23 -        .globl hypercall_args_table
   72.24 -hypercall_args_table:	
   72.25 -        .byte 1 /* do_set_trap_table    */  /*  0 */
   72.26 -        .byte 4 /* do_mmu_update        */
   72.27 -        .byte 2 /* do_set_gdt           */
   72.28 -        .byte 2 /* do_stack_switch      */
   72.29 -        .byte 4 /* do_set_callbacks     */
   72.30 -        .byte 1 /* do_fpu_taskswitch    */  /*  5 */
   72.31 -        .byte 2 /* do_arch_sched_op     */
   72.32 -        .byte 1 /* do_dom0_op           */
   72.33 -        .byte 2 /* do_set_debugreg      */
   72.34 -        .byte 1 /* do_get_debugreg      */
   72.35 -        .byte 4 /* do_update_descriptor */  /* 10 */
   72.36 -        .byte 0 /* do_ni_hypercall      */
   72.37 -        .byte 2 /* do_memory_op         */
   72.38 -        .byte 2 /* do_multicall         */
   72.39 -        .byte 4 /* do_update_va_mapping */
   72.40 -        .byte 2 /* do_set_timer_op      */  /* 15 */
   72.41 -        .byte 1 /* do_event_channel_op  */
   72.42 -        .byte 2 /* do_xen_version       */
   72.43 -        .byte 3 /* do_console_io        */
   72.44 -        .byte 1 /* do_physdev_op        */
   72.45 -        .byte 3 /* do_grant_table_op    */  /* 20 */
   72.46 -        .byte 2 /* do_vm_assist         */
   72.47 -        .byte 5 /* do_update_va_mapping_otherdomain */
   72.48 -        .byte 0 /* do_switch_vm86       */
   72.49 -        .byte 2 /* do_boot_vcpu         */
   72.50 -        .byte 0 /* do_ni_hypercall      */  /* 25 */
   72.51 -        .byte 4 /* do_mmuext_op         */
   72.52 -        .byte 1 /* do_acm_op            */
   72.53 -        .byte 2 /* do_nmi_op            */
   72.54 -        .byte 2 /* do_arch_sched_op     */
   72.55 -        .byte 2 /* do_callback_op       */  /* 30 */
   72.56 -        .byte 2 /* do_xenoprof_op       */
   72.57 -        .byte 2 /* do_event_channel_op  */
   72.58 -        .byte 2 /* do_physdev_op        */
   72.59 -        .rept NR_hypercalls-(.-hypercall_args_table)
   72.60 -        .byte 0 /* do_ni_hypercall      */
   72.61 -        .endr
    73.1 --- a/xen/arch/x86/Makefile	Fri Aug 25 16:21:39 2006 -0600
    73.2 +++ b/xen/arch/x86/Makefile	Sun Aug 27 10:24:41 2006 -0600
    73.3 @@ -12,12 +12,13 @@ obj-y += bitops.o
    73.4  obj-y += compat.o
    73.5  obj-y += delay.o
    73.6  obj-y += dmi_scan.o
    73.7 -obj-y += dom0_ops.o
    73.8 +obj-y += domctl.o
    73.9  obj-y += domain.o
   73.10  obj-y += domain_build.o
   73.11  obj-y += e820.o
   73.12  obj-y += extable.o
   73.13  obj-y += flushtlb.o
   73.14 +obj-y += platform_hypercall.o
   73.15  obj-y += i387.o
   73.16  obj-y += i8259.o
   73.17  obj-y += io_apic.o
   73.18 @@ -33,6 +34,7 @@ obj-y += shutdown.o
   73.19  obj-y += smp.o
   73.20  obj-y += smpboot.o
   73.21  obj-y += string.o
   73.22 +obj-y += sysctl.o
   73.23  obj-y += time.o
   73.24  obj-y += trampoline.o
   73.25  obj-y += traps.o
    74.1 --- a/xen/arch/x86/dom0_ops.c	Fri Aug 25 16:21:39 2006 -0600
    74.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    74.3 @@ -1,486 +0,0 @@
    74.4 -/******************************************************************************
    74.5 - * Arch-specific dom0_ops.c
    74.6 - * 
    74.7 - * Process command requests from domain-0 guest OS.
    74.8 - * 
    74.9 - * Copyright (c) 2002, K A Fraser
   74.10 - */
   74.11 -
   74.12 -#include <xen/config.h>
   74.13 -#include <xen/types.h>
   74.14 -#include <xen/lib.h>
   74.15 -#include <xen/mm.h>
   74.16 -#include <xen/guest_access.h>
   74.17 -#include <public/dom0_ops.h>
   74.18 -#include <xen/sched.h>
   74.19 -#include <xen/event.h>
   74.20 -#include <xen/domain_page.h>
   74.21 -#include <asm/msr.h>
   74.22 -#include <xen/trace.h>
   74.23 -#include <xen/console.h>
   74.24 -#include <xen/iocap.h>
   74.25 -#include <asm/shadow.h>
   74.26 -#include <asm/irq.h>
   74.27 -#include <asm/hvm/hvm.h>
   74.28 -#include <asm/hvm/support.h>
   74.29 -#include <asm/processor.h>
   74.30 -#include <public/sched_ctl.h>
   74.31 -
   74.32 -#include <asm/mtrr.h>
   74.33 -#include "cpu/mtrr/mtrr.h"
   74.34 -
   74.35 -#define TRC_DOM0OP_ENTER_BASE  0x00020000
   74.36 -#define TRC_DOM0OP_LEAVE_BASE  0x00030000
   74.37 -
   74.38 -static int msr_cpu_mask;
   74.39 -static unsigned long msr_addr;
   74.40 -static unsigned long msr_lo;
   74.41 -static unsigned long msr_hi;
   74.42 -
   74.43 -static void write_msr_for(void *unused)
   74.44 -{
   74.45 -    if ( ((1 << smp_processor_id()) & msr_cpu_mask) )
   74.46 -        (void)wrmsr_safe(msr_addr, msr_lo, msr_hi);
   74.47 -}
   74.48 -
   74.49 -static void read_msr_for(void *unused)
   74.50 -{
   74.51 -    if ( ((1 << smp_processor_id()) & msr_cpu_mask) )
   74.52 -        (void)rdmsr_safe(msr_addr, msr_lo, msr_hi);
   74.53 -}
   74.54 -
   74.55 -long arch_do_dom0_op(struct dom0_op *op, XEN_GUEST_HANDLE(dom0_op_t) u_dom0_op)
   74.56 -{
   74.57 -    long ret = 0;
   74.58 -
   74.59 -    switch ( op->cmd )
   74.60 -    {
   74.61 -
   74.62 -    case DOM0_MSR:
   74.63 -    {
   74.64 -        if ( op->u.msr.write )
   74.65 -        {
   74.66 -            msr_cpu_mask = op->u.msr.cpu_mask;
   74.67 -            msr_addr = op->u.msr.msr;
   74.68 -            msr_lo = op->u.msr.in1;
   74.69 -            msr_hi = op->u.msr.in2;
   74.70 -            smp_call_function(write_msr_for, NULL, 1, 1);
   74.71 -            write_msr_for(NULL);
   74.72 -        }
   74.73 -        else
   74.74 -        {
   74.75 -            msr_cpu_mask = op->u.msr.cpu_mask;
   74.76 -            msr_addr = op->u.msr.msr;
   74.77 -            smp_call_function(read_msr_for, NULL, 1, 1);
   74.78 -            read_msr_for(NULL);
   74.79 -
   74.80 -            op->u.msr.out1 = msr_lo;
   74.81 -            op->u.msr.out2 = msr_hi;
   74.82 -            copy_to_guest(u_dom0_op, op, 1);
   74.83 -        }
   74.84 -        ret = 0;
   74.85 -    }
   74.86 -    break;
   74.87 -
   74.88 -    case DOM0_SHADOW_CONTROL:
   74.89 -    {
   74.90 -        struct domain *d;
   74.91 -        ret = -ESRCH;
   74.92 -        d = find_domain_by_id(op->u.shadow_control.domain);
   74.93 -        if ( d != NULL )
   74.94 -        {
   74.95 -            ret = shadow2_control_op(d, &op->u.shadow_control, u_dom0_op);
   74.96 -            put_domain(d);
   74.97 -            copy_to_guest(u_dom0_op, op, 1);
   74.98 -        } 
   74.99 -    }
  74.100 -    break;
  74.101 -
  74.102 -    case DOM0_ADD_MEMTYPE:
  74.103 -    {
  74.104 -        ret = mtrr_add_page(
  74.105 -            op->u.add_memtype.mfn,
  74.106 -            op->u.add_memtype.nr_mfns,
  74.107 -            op->u.add_memtype.type,
  74.108 -            1);
  74.109 -        if ( ret > 0 )
  74.110 -        {
  74.111 -            op->u.add_memtype.handle = 0;
  74.112 -            op->u.add_memtype.reg    = ret;
  74.113 -            (void)copy_to_guest(u_dom0_op, op, 1);
  74.114 -            ret = 0;
  74.115 -        }
  74.116 -    }
  74.117 -    break;
  74.118 -
  74.119 -    case DOM0_DEL_MEMTYPE:
  74.120 -    {
  74.121 -        if (op->u.del_memtype.handle == 0
  74.122 -            /* mtrr/main.c otherwise does a lookup */
  74.123 -            && (int)op->u.del_memtype.reg >= 0)
  74.124 -        {
  74.125 -            ret = mtrr_del_page(op->u.del_memtype.reg, 0, 0);
  74.126 -            if (ret > 0)
  74.127 -                ret = 0;
  74.128 -        }
  74.129 -        else
  74.130 -            ret = -EINVAL;
  74.131 -    }
  74.132 -    break;
  74.133 -
  74.134 -    case DOM0_READ_MEMTYPE:
  74.135 -    {
  74.136 -        unsigned long mfn;
  74.137 -        unsigned int  nr_mfns;
  74.138 -        mtrr_type     type;
  74.139 -
  74.140 -        ret = -EINVAL;
  74.141 -        if ( op->u.read_memtype.reg < num_var_ranges )
  74.142 -        {
  74.143 -            mtrr_if->get(op->u.read_memtype.reg, &mfn, &nr_mfns, &type);
  74.144 -            op->u.read_memtype.mfn     = mfn;
  74.145 -            op->u.read_memtype.nr_mfns = nr_mfns;
  74.146 -            op->u.read_memtype.type    = type;
  74.147 -            (void)copy_to_guest(u_dom0_op, op, 1);
  74.148 -            ret = 0;
  74.149 -        }
  74.150 -    }
  74.151 -    break;
  74.152 -
  74.153 -    case DOM0_MICROCODE:
  74.154 -    {
  74.155 -        extern int microcode_update(void *buf, unsigned long len);
  74.156 -        ret = microcode_update(op->u.microcode.data.p, op->u.microcode.length);
  74.157 -    }
  74.158 -    break;
  74.159 -
  74.160 -    case DOM0_IOPORT_PERMISSION:
  74.161 -    {
  74.162 -        struct domain *d;
  74.163 -        unsigned int fp = op->u.ioport_permission.first_port;
  74.164 -        unsigned int np = op->u.ioport_permission.nr_ports;
  74.165 -
  74.166 -        ret = -EINVAL;
  74.167 -        if ( (fp + np) > 65536 )
  74.168 -            break;
  74.169 -
  74.170 -        ret = -ESRCH;
  74.171 -        if ( unlikely((d = find_domain_by_id(
  74.172 -            op->u.ioport_permission.domain)) == NULL) )
  74.173 -            break;
  74.174 -
  74.175 -        if ( np == 0 )
  74.176 -            ret = 0;
  74.177 -        else if ( op->u.ioport_permission.allow_access )
  74.178 -            ret = ioports_permit_access(d, fp, fp + np - 1);
  74.179 -        else
  74.180 -            ret = ioports_deny_access(d, fp, fp + np - 1);
  74.181 -
  74.182 -        put_domain(d);
  74.183 -    }
  74.184 -    break;
  74.185 -
  74.186 -    case DOM0_PHYSINFO:
  74.187 -    {
  74.188 -        dom0_physinfo_t *pi = &op->u.physinfo;
  74.189 -
  74.190 -        pi->threads_per_core =
  74.191 -            cpus_weight(cpu_sibling_map[0]);
  74.192 -        pi->cores_per_socket =
  74.193 -            cpus_weight(cpu_core_map[0]) / pi->threads_per_core;
  74.194 -        pi->sockets_per_node = 
  74.195 -            num_online_cpus() / cpus_weight(cpu_core_map[0]);
  74.196 -
  74.197 -        pi->nr_nodes         = 1;
  74.198 -        pi->total_pages      = total_pages;
  74.199 -        pi->free_pages       = avail_domheap_pages();
  74.200 -        pi->scrub_pages      = avail_scrub_pages();
  74.201 -        pi->cpu_khz          = cpu_khz;
  74.202 -        memset(pi->hw_cap, 0, sizeof(pi->hw_cap));
  74.203 -        memcpy(pi->hw_cap, boot_cpu_data.x86_capability, NCAPINTS*4);
  74.204 -        ret = 0;
  74.205 -        if ( copy_to_guest(u_dom0_op, op, 1) )
  74.206 -            ret = -EFAULT;
  74.207 -    }
  74.208 -    break;
  74.209 -    
  74.210 -    case DOM0_GETPAGEFRAMEINFO:
  74.211 -    {
  74.212 -        struct page_info *page;
  74.213 -        unsigned long mfn = op->u.getpageframeinfo.gmfn;
  74.214 -        domid_t dom = op->u.getpageframeinfo.domain;
  74.215 -        struct domain *d;
  74.216 -
  74.217 -        ret = -EINVAL;
  74.218 -
  74.219 -        if ( unlikely(!mfn_valid(mfn)) ||
  74.220 -             unlikely((d = find_domain_by_id(dom)) == NULL) )
  74.221 -            break;
  74.222 -
  74.223 -        page = mfn_to_page(mfn);
  74.224 -
  74.225 -        if ( likely(get_page(page, d)) )
  74.226 -        {
  74.227 -            ret = 0;
  74.228 -
  74.229 -            op->u.getpageframeinfo.type = NOTAB;
  74.230 -
  74.231 -            if ( (page->u.inuse.type_info & PGT_count_mask) != 0 )
  74.232 -            {
  74.233 -                switch ( page->u.inuse.type_info & PGT_type_mask )
  74.234 -                {
  74.235 -                case PGT_l1_page_table:
  74.236 -                    op->u.getpageframeinfo.type = L1TAB;
  74.237 -                    break;
  74.238 -                case PGT_l2_page_table:
  74.239 -                    op->u.getpageframeinfo.type = L2TAB;
  74.240 -                    break;
  74.241 -                case PGT_l3_page_table:
  74.242 -                    op->u.getpageframeinfo.type = L3TAB;
  74.243 -                    break;
  74.244 -                case PGT_l4_page_table:
  74.245 -                    op->u.getpageframeinfo.type = L4TAB;
  74.246 -                    break;
  74.247 -                }
  74.248 -            }
  74.249 -            
  74.250 -            put_page(page);
  74.251 -        }
  74.252 -
  74.253 -        put_domain(d);
  74.254 -
  74.255 -        copy_to_guest(u_dom0_op, op, 1);
  74.256 -    }
  74.257 -    break;
  74.258 -
  74.259 -    case DOM0_GETPAGEFRAMEINFO2:
  74.260 -    {
  74.261 -#define GPF2_BATCH (PAGE_SIZE / sizeof(unsigned long)) 
  74.262 -        int n,j;
  74.263 -        int num = op->u.getpageframeinfo2.num;
  74.264 -        domid_t dom = op->u.getpageframeinfo2.domain;
  74.265 -        struct domain *d;
  74.266 -        unsigned long *l_arr;
  74.267 -        ret = -ESRCH;
  74.268 -
  74.269 -        if ( unlikely((d = find_domain_by_id(dom)) == NULL) )
  74.270 -            break;
  74.271 -
  74.272 -        if ( unlikely(num > 1024) )
  74.273 -        {
  74.274 -            ret = -E2BIG;
  74.275 -            put_domain(d);
  74.276 -            break;
  74.277 -        }
  74.278 -
  74.279 -        l_arr = alloc_xenheap_page();
  74.280 - 
  74.281 -        ret = 0;
  74.282 -        for( n = 0; n < num; )
  74.283 -        {
  74.284 -            int k = ((num-n)>GPF2_BATCH)?GPF2_BATCH:(num-n);
  74.285 -
  74.286 -            if ( copy_from_guest_offset(l_arr, op->u.getpageframeinfo2.array,
  74.287 -                                        n, k) )
  74.288 -            {
  74.289 -                ret = -EINVAL;
  74.290 -                break;
  74.291 -            }
  74.292 -     
  74.293 -            for( j = 0; j < k; j++ )
  74.294 -            {      
  74.295 -                struct page_info *page;
  74.296 -                unsigned long mfn = l_arr[j];
  74.297 -
  74.298 -                page = mfn_to_page(mfn);
  74.299 -
  74.300 -                if ( likely(mfn_valid(mfn) && get_page(page, d)) ) 
  74.301 -                {
  74.302 -                    unsigned long type = 0;
  74.303 -
  74.304 -                    switch( page->u.inuse.type_info & PGT_type_mask )
  74.305 -                    {
  74.306 -                    case PGT_l1_page_table:
  74.307 -                        type = L1TAB;
  74.308 -                        break;
  74.309 -                    case PGT_l2_page_table:
  74.310 -                        type = L2TAB;
  74.311 -                        break;
  74.312 -                    case PGT_l3_page_table:
  74.313 -                        type = L3TAB;
  74.314 -                        break;
  74.315 -                    case PGT_l4_page_table:
  74.316 -                        type = L4TAB;
  74.317 -                        break;
  74.318 -                    }
  74.319 -
  74.320 -                    if ( page->u.inuse.type_info & PGT_pinned )
  74.321 -                        type |= LPINTAB;
  74.322 -                    l_arr[j] |= type;
  74.323 -                    put_page(page);
  74.324 -                }
  74.325 -                else
  74.326 -                    l_arr[j] |= XTAB;
  74.327 -
  74.328 -            }
  74.329 -
  74.330 -            if ( copy_to_guest_offset(op->u.getpageframeinfo2.array,
  74.331 -                                      n, l_arr, k) )
  74.332 -            {
  74.333 -                ret = -EINVAL;
  74.334 -                break;
  74.335 -            }
  74.336 -
  74.337 -            n += k;
  74.338 -        }
  74.339 -
  74.340 -        free_xenheap_page(l_arr);
  74.341 -
  74.342 -        put_domain(d);
  74.343 -    }
  74.344 -    break;
  74.345 -
  74.346 -    case DOM0_GETMEMLIST:
  74.347 -    {
  74.348 -        int i;
  74.349 -        struct domain *d = find_domain_by_id(op->u.getmemlist.domain);
  74.350 -        unsigned long max_pfns = op->u.getmemlist.max_pfns;
  74.351 -        unsigned long mfn;
  74.352 -        struct list_head *list_ent;
  74.353 -
  74.354 -        ret = -EINVAL;
  74.355 -        if ( d != NULL )
  74.356 -        {
  74.357 -            ret = 0;
  74.358 -
  74.359 -            spin_lock(&d->page_alloc_lock);
  74.360 -            list_ent = d->page_list.next;
  74.361 -            for ( i = 0; (i < max_pfns) && (list_ent != &d->page_list); i++ )
  74.362 -            {
  74.363 -                mfn = page_to_mfn(list_entry(
  74.364 -                    list_ent, struct page_info, list));
  74.365 -                if ( copy_to_guest_offset(op->u.getmemlist.buffer,
  74.366 -                                          i, &mfn, 1) )
  74.367 -                {
  74.368 -                    ret = -EFAULT;
  74.369 -                    break;
  74.370 -                }
  74.371 -                list_ent = mfn_to_page(mfn)->list.next;
  74.372 -            }
  74.373 -            spin_unlock(&d->page_alloc_lock);
  74.374 -
  74.375 -            op->u.getmemlist.num_pfns = i;
  74.376 -            copy_to_guest(u_dom0_op, op, 1);
  74.377 -            
  74.378 -            put_domain(d);
  74.379 -        }
  74.380 -    }
  74.381 -    break;
  74.382 -
  74.383 -    case DOM0_PLATFORM_QUIRK:
  74.384 -    {
  74.385 -        extern int opt_noirqbalance;
  74.386 -        int quirk_id = op->u.platform_quirk.quirk_id;
  74.387 -        switch ( quirk_id )
  74.388 -        {
  74.389 -        case QUIRK_NOIRQBALANCING:
  74.390 -            printk("Platform quirk -- Disabling IRQ balancing/affinity.\n");
  74.391 -            opt_noirqbalance = 1;
  74.392 -            setup_ioapic_dest();
  74.393 -            break;
  74.394 -        case QUIRK_IOAPIC_BAD_REGSEL:
  74.395 -        case QUIRK_IOAPIC_GOOD_REGSEL:
  74.396 -#ifndef sis_apic_bug
  74.397 -            sis_apic_bug = (quirk_id == QUIRK_IOAPIC_BAD_REGSEL);
  74.398 -            DPRINTK("Domain 0 says that IO-APIC REGSEL is %s\n",
  74.399 -                    sis_apic_bug ? "bad" : "good");
  74.400 -#else
  74.401 -            BUG_ON(sis_apic_bug != (quirk_id == QUIRK_IOAPIC_BAD_REGSEL));
  74.402 -#endif
  74.403 -            break;
  74.404 -        default:
  74.405 -            ret = -EINVAL;
  74.406 -            break;
  74.407 -        }
  74.408 -    }
  74.409 -    break;
  74.410 -
  74.411 -    case DOM0_HYPERCALL_INIT:
  74.412 -    {
  74.413 -        struct domain *d = find_domain_by_id(op->u.hypercall_init.domain);
  74.414 -        unsigned long gmfn = op->u.hypercall_init.gmfn;
  74.415 -        unsigned long mfn;
  74.416 -        void *hypercall_page;
  74.417 -
  74.418 -        ret = -ESRCH;
  74.419 -        if ( unlikely(d == NULL) )
  74.420 -            break;
  74.421 -
  74.422 -        mfn = gmfn_to_mfn(d, gmfn);
  74.423 -
  74.424 -        ret = -EACCES;
  74.425 -        if ( !mfn_valid(mfn) ||
  74.426 -             !get_page_and_type(mfn_to_page(mfn), d, PGT_writable_page) )
  74.427 -        {
  74.428 -            put_domain(d);
  74.429 -            break;
  74.430 -        }
  74.431 -
  74.432 -        ret = 0;
  74.433 -
  74.434 -        hypercall_page = map_domain_page(mfn);
  74.435 -        hypercall_page_initialise(d, hypercall_page);
  74.436 -        unmap_domain_page(hypercall_page);
  74.437 -
  74.438 -        put_page_and_type(mfn_to_page(mfn));
  74.439 -
  74.440 -        put_domain(d);
  74.441 -    }
  74.442 -    break;
  74.443 -
  74.444 -    default:
  74.445 -        ret = -ENOSYS;
  74.446 -        break;
  74.447 -    }
  74.448 -
  74.449 -    return ret;
  74.450 -}
  74.451 -
  74.452 -void arch_getdomaininfo_ctxt(
  74.453 -    struct vcpu *v, struct vcpu_guest_context *c)
  74.454 -{
  74.455 -    memcpy(c, &v->arch.guest_context, sizeof(*c));
  74.456 -
  74.457 -    if ( hvm_guest(v) )
  74.458 -    {
  74.459 -        hvm_store_cpu_guest_regs(v, &c->user_regs, c->ctrlreg);
  74.460 -    }
  74.461 -    else
  74.462 -    {
  74.463 -        /* IOPL privileges are virtualised: merge back into returned eflags. */
  74.464 -        BUG_ON((c->user_regs.eflags & EF_IOPL) != 0);
  74.465 -        c->user_regs.eflags |= v->arch.iopl << 12;
  74.466 -    }
  74.467 -
  74.468 -    c->flags = 0;
  74.469 -    if ( test_bit(_VCPUF_fpu_initialised, &v->vcpu_flags) )
  74.470 -        c->flags |= VGCF_I387_VALID;
  74.471 -    if ( guest_kernel_mode(v, &v->arch.guest_context.user_regs) )
  74.472 -        c->flags |= VGCF_IN_KERNEL;
  74.473 -    if ( hvm_guest(v) )
  74.474 -        c->flags |= VGCF_HVM_GUEST;
  74.475 -
  74.476 -    c->ctrlreg[3] = xen_pfn_to_cr3(pagetable_get_pfn(v->arch.guest_table));
  74.477 -
  74.478 -    c->vm_assist = v->domain->vm_assist;
  74.479 -}
  74.480 -
  74.481 -/*
  74.482 - * Local variables:
  74.483 - * mode: C
  74.484 - * c-set-style: "BSD"
  74.485 - * c-basic-offset: 4
  74.486 - * tab-width: 4
  74.487 - * indent-tabs-mode: nil
  74.488 - * End:
  74.489 - */
    75.1 --- a/xen/arch/x86/domain_build.c	Fri Aug 25 16:21:39 2006 -0600
    75.2 +++ b/xen/arch/x86/domain_build.c	Sun Aug 27 10:24:41 2006 -0600
    75.3 @@ -28,6 +28,7 @@
    75.4  #include <asm/shadow.h>
    75.5  
    75.6  #include <public/version.h>
    75.7 +#include <public/elfnote.h>
    75.8  
    75.9  extern unsigned long initial_images_nrpages(void);
   75.10  extern void discard_initial_images(void);
   75.11 @@ -210,8 +211,9 @@ int construct_dom0(struct domain *d,
   75.12      struct page_info *page = NULL;
   75.13      start_info_t *si;
   75.14      struct vcpu *v = d->vcpu[0];
   75.15 -    char *p;
   75.16 +    const char *p;
   75.17      unsigned long hypercall_page;
   75.18 +    int hypercall_page_defined;
   75.19  #if defined(__i386__)
   75.20      char *image_start  = (char *)_image_start;  /* use lowmem mappings */
   75.21      char *initrd_start = (char *)_initrd_start; /* use lowmem mappings */
   75.22 @@ -288,13 +290,7 @@ int construct_dom0(struct domain *d,
   75.23      if ( (rc = parseelfimage(&dsi)) != 0 )
   75.24          return rc;
   75.25  
   75.26 -    if ( dsi.xen_section_string == NULL )
   75.27 -    {
   75.28 -        printk("Not a Xen-ELF image: '__xen_guest' section not found.\n");
   75.29 -        return -EINVAL;
   75.30 -    }
   75.31 -
   75.32 -    dom0_pae = !!strstr(dsi.xen_section_string, "PAE=yes");
   75.33 +    dom0_pae = (dsi.pae_kernel != PAEKERN_no);
   75.34      xen_pae  = (CONFIG_PAGING_LEVELS == 3);
   75.35      if ( dom0_pae != xen_pae )
   75.36      {
   75.37 @@ -303,15 +299,14 @@ int construct_dom0(struct domain *d,
   75.38          return -EINVAL;
   75.39      }
   75.40  
   75.41 -    if ( xen_pae && !!strstr(dsi.xen_section_string, "PAE=yes[extended-cr3]") )
   75.42 -        set_bit(VMASST_TYPE_pae_extended_cr3, &d->vm_assist);
   75.43 +    if ( xen_pae && dsi.pae_kernel == PAEKERN_extended_cr3 )
   75.44 +            set_bit(VMASST_TYPE_pae_extended_cr3, &d->vm_assist);
   75.45  
   75.46 -    if ( (p = strstr(dsi.xen_section_string, "FEATURES=")) != NULL )
   75.47 +    if ( (p = xen_elfnote_string(&dsi, XEN_ELFNOTE_FEATURES)) != NULL )
   75.48      {
   75.49 -        parse_features(
   75.50 -            p + strlen("FEATURES="),
   75.51 -            dom0_features_supported,
   75.52 -            dom0_features_required);
   75.53 +        parse_features(p,
   75.54 +                       dom0_features_supported,
   75.55 +                       dom0_features_required);
   75.56          printk("Domain 0 kernel supports features = { %08x }.\n",
   75.57                 dom0_features_supported[0]);
   75.58          printk("Domain 0 kernel requires features = { %08x }.\n",
   75.59 @@ -696,20 +691,17 @@ int construct_dom0(struct domain *d,
   75.60      /* Copy the OS image and free temporary buffer. */
   75.61      (void)loadelfimage(&dsi);
   75.62  
   75.63 -    p = strstr(dsi.xen_section_string, "HYPERCALL_PAGE=");
   75.64 -    if ( p != NULL )
   75.65 +    hypercall_page =
   75.66 +        xen_elfnote_numeric(&dsi, XEN_ELFNOTE_HYPERCALL_PAGE, &hypercall_page_defined);
   75.67 +    if ( hypercall_page_defined )
   75.68      {
   75.69 -        p += strlen("HYPERCALL_PAGE=");
   75.70 -        hypercall_page = simple_strtoul(p, NULL, 16);
   75.71 -        hypercall_page = dsi.v_start + (hypercall_page << PAGE_SHIFT);
   75.72          if ( (hypercall_page < dsi.v_start) || (hypercall_page >= v_end) )
   75.73          {
   75.74              write_ptbase(current);
   75.75              local_irq_enable();
   75.76 -            printk("Invalid HYPERCALL_PAGE field in guest header.\n");
   75.77 +            printk("Invalid HYPERCALL_PAGE field in ELF notes.\n");
   75.78              return -1;
   75.79          }
   75.80 -
   75.81          hypercall_page_initialise(d, (void *)hypercall_page);
   75.82      }
   75.83  
    76.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    76.2 +++ b/xen/arch/x86/domctl.c	Sun Aug 27 10:24:41 2006 -0600
    76.3 @@ -0,0 +1,326 @@
    76.4 +/******************************************************************************
    76.5 + * Arch-specific domctl.c
    76.6 + * 
    76.7 + * Copyright (c) 2002-2006, K A Fraser
    76.8 + */
    76.9 +
   76.10 +#include <xen/config.h>
   76.11 +#include <xen/types.h>
   76.12 +#include <xen/lib.h>
   76.13 +#include <xen/mm.h>
   76.14 +#include <xen/guest_access.h>
   76.15 +#include <public/domctl.h>
   76.16 +#include <xen/sched.h>
   76.17 +#include <xen/event.h>
   76.18 +#include <xen/domain_page.h>
   76.19 +#include <asm/msr.h>
   76.20 +#include <xen/trace.h>
   76.21 +#include <xen/console.h>
   76.22 +#include <xen/iocap.h>
   76.23 +#include <asm/shadow.h>
   76.24 +#include <asm/irq.h>
   76.25 +#include <asm/hvm/hvm.h>
   76.26 +#include <asm/hvm/support.h>
   76.27 +#include <asm/processor.h>
   76.28 +
   76.29 +long arch_do_domctl(
   76.30 +    struct xen_domctl *domctl,
   76.31 +    XEN_GUEST_HANDLE(xen_domctl_t) u_domctl)
   76.32 +{
   76.33 +    long ret = 0;
   76.34 +
   76.35 +    switch ( domctl->cmd )
   76.36 +    {
   76.37 +
   76.38 +    case XEN_DOMCTL_shadow_op:
   76.39 +    {
   76.40 +        struct domain *d;
   76.41 +        ret = -ESRCH;
   76.42 +        d = find_domain_by_id(domctl->domain);
   76.43 +        if ( d != NULL )
   76.44 +        {
   76.45 +            ret = shadow2_domctl(d, &domctl->u.shadow_op, u_domctl);
   76.46 +            put_domain(d);
   76.47 +            copy_to_guest(u_domctl, domctl, 1);
   76.48 +        } 
   76.49 +    }
   76.50 +    break;
   76.51 +
   76.52 +    case XEN_DOMCTL_ioport_permission:
   76.53 +    {
   76.54 +        struct domain *d;
   76.55 +        unsigned int fp = domctl->u.ioport_permission.first_port;
   76.56 +        unsigned int np = domctl->u.ioport_permission.nr_ports;
   76.57 +
   76.58 +        ret = -EINVAL;
   76.59 +        if ( (fp + np) > 65536 )
   76.60 +            break;
   76.61 +
   76.62 +        ret = -ESRCH;
   76.63 +        if ( unlikely((d = find_domain_by_id(domctl->domain)) == NULL) )
   76.64 +            break;
   76.65 +
   76.66 +        if ( np == 0 )
   76.67 +            ret = 0;
   76.68 +        else if ( domctl->u.ioport_permission.allow_access )
   76.69 +            ret = ioports_permit_access(d, fp, fp + np - 1);
   76.70 +        else
   76.71 +            ret = ioports_deny_access(d, fp, fp + np - 1);
   76.72 +
   76.73 +        put_domain(d);
   76.74 +    }
   76.75 +    break;
   76.76 +
   76.77 +    case XEN_DOMCTL_getpageframeinfo:
   76.78 +    {
   76.79 +        struct page_info *page;
   76.80 +        unsigned long mfn = domctl->u.getpageframeinfo.gmfn;
   76.81 +        domid_t dom = domctl->domain;
   76.82 +        struct domain *d;
   76.83 +
   76.84 +        ret = -EINVAL;
   76.85 +
   76.86 +        if ( unlikely(!mfn_valid(mfn)) ||
   76.87 +             unlikely((d = find_domain_by_id(dom)) == NULL) )
   76.88 +            break;
   76.89 +
   76.90 +        page = mfn_to_page(mfn);
   76.91 +
   76.92 +        if ( likely(get_page(page, d)) )
   76.93 +        {
   76.94 +            ret = 0;
   76.95 +
   76.96 +            domctl->u.getpageframeinfo.type = XEN_DOMCTL_PFINFO_NOTAB;
   76.97 +
   76.98 +            if ( (page->u.inuse.type_info & PGT_count_mask) != 0 )
   76.99 +            {
  76.100 +                switch ( page->u.inuse.type_info & PGT_type_mask )
  76.101 +                {
  76.102 +                case PGT_l1_page_table:
  76.103 +                    domctl->u.getpageframeinfo.type = XEN_DOMCTL_PFINFO_L1TAB;
  76.104 +                    break;
  76.105 +                case PGT_l2_page_table:
  76.106 +                    domctl->u.getpageframeinfo.type = XEN_DOMCTL_PFINFO_L2TAB;
  76.107 +                    break;
  76.108 +                case PGT_l3_page_table:
  76.109 +                    domctl->u.getpageframeinfo.type = XEN_DOMCTL_PFINFO_L3TAB;
  76.110 +                    break;
  76.111 +                case PGT_l4_page_table:
  76.112 +                    domctl->u.getpageframeinfo.type = XEN_DOMCTL_PFINFO_L4TAB;
  76.113 +                    break;
  76.114 +                }
  76.115 +            }
  76.116 +            
  76.117 +            put_page(page);
  76.118 +        }
  76.119 +
  76.120 +        put_domain(d);
  76.121 +
  76.122 +        copy_to_guest(u_domctl, domctl, 1);
  76.123 +    }
  76.124 +    break;
  76.125 +
  76.126 +    case XEN_DOMCTL_getpageframeinfo2:
  76.127 +    {
  76.128 +#define GPF2_BATCH (PAGE_SIZE / sizeof(long))
  76.129 +        int n,j;
  76.130 +        int num = domctl->u.getpageframeinfo2.num;
  76.131 +        domid_t dom = domctl->domain;
  76.132 +        struct domain *d;
  76.133 +        unsigned long *l_arr;
  76.134 +        ret = -ESRCH;
  76.135 +
  76.136 +        if ( unlikely((d = find_domain_by_id(dom)) == NULL) )
  76.137 +            break;
  76.138 +
  76.139 +        if ( unlikely(num > 1024) )
  76.140 +        {
  76.141 +            ret = -E2BIG;
  76.142 +            put_domain(d);
  76.143 +            break;
  76.144 +        }
  76.145 +
  76.146 +        l_arr = alloc_xenheap_page();
  76.147 + 
  76.148 +        ret = 0;
  76.149 +        for ( n = 0; n < num; )
  76.150 +        {
  76.151 +            int k = ((num-n)>GPF2_BATCH)?GPF2_BATCH:(num-n);
  76.152 +
  76.153 +            if ( copy_from_guest_offset(l_arr,
  76.154 +                                        domctl->u.getpageframeinfo2.array,
  76.155 +                                        n, k) )
  76.156 +            {
  76.157 +                ret = -EINVAL;
  76.158 +                break;
  76.159 +            }
  76.160 +     
  76.161 +            for ( j = 0; j < k; j++ )
  76.162 +            {      
  76.163 +                struct page_info *page;
  76.164 +                unsigned long mfn = l_arr[j];
  76.165 +
  76.166 +                page = mfn_to_page(mfn);
  76.167 +
  76.168 +                if ( likely(mfn_valid(mfn) && get_page(page, d)) ) 
  76.169 +                {
  76.170 +                    unsigned long type = 0;
  76.171 +
  76.172 +                    switch( page->u.inuse.type_info & PGT_type_mask )
  76.173 +                    {
  76.174 +                    case PGT_l1_page_table:
  76.175 +                        type = XEN_DOMCTL_PFINFO_L1TAB;
  76.176 +                        break;
  76.177 +                    case PGT_l2_page_table:
  76.178 +                        type = XEN_DOMCTL_PFINFO_L2TAB;
  76.179 +                        break;
  76.180 +                    case PGT_l3_page_table:
  76.181 +                        type = XEN_DOMCTL_PFINFO_L3TAB;
  76.182 +                        break;
  76.183 +                    case PGT_l4_page_table:
  76.184 +                        type = XEN_DOMCTL_PFINFO_L4TAB;
  76.185 +                        break;
  76.186 +                    }
  76.187 +
  76.188 +                    if ( page->u.inuse.type_info & PGT_pinned )
  76.189 +                        type |= XEN_DOMCTL_PFINFO_LPINTAB;
  76.190 +                    l_arr[j] |= type;
  76.191 +                    put_page(page);
  76.192 +                }
  76.193 +                else
  76.194 +                    l_arr[j] |= XEN_DOMCTL_PFINFO_XTAB;
  76.195 +
  76.196 +            }
  76.197 +
  76.198 +            if ( copy_to_guest_offset(domctl->u.getpageframeinfo2.array,
  76.199 +                                      n, l_arr, k) )
  76.200 +            {
  76.201 +                ret = -EINVAL;
  76.202 +                break;
  76.203 +            }
  76.204 +
  76.205 +            n += k;
  76.206 +        }
  76.207 +
  76.208 +        free_xenheap_page(l_arr);
  76.209 +
  76.210 +        put_domain(d);
  76.211 +    }
  76.212 +    break;
  76.213 +
  76.214 +    case XEN_DOMCTL_getmemlist:
  76.215 +    {
  76.216 +        int i;
  76.217 +        struct domain *d = find_domain_by_id(domctl->domain);
  76.218 +        unsigned long max_pfns = domctl->u.getmemlist.max_pfns;
  76.219 +        unsigned long mfn;
  76.220 +        struct list_head *list_ent;
  76.221 +
  76.222 +        ret = -EINVAL;
  76.223 +        if ( d != NULL )
  76.224 +        {
  76.225 +            ret = 0;
  76.226 +
  76.227 +            spin_lock(&d->page_alloc_lock);
  76.228 +            list_ent = d->page_list.next;
  76.229 +            for ( i = 0; (i < max_pfns) && (list_ent != &d->page_list); i++ )
  76.230 +            {
  76.231 +                mfn = page_to_mfn(list_entry(
  76.232 +                    list_ent, struct page_info, list));
  76.233 +                if ( copy_to_guest_offset(domctl->u.getmemlist.buffer,
  76.234 +                                          i, &mfn, 1) )
  76.235 +                {
  76.236 +                    ret = -EFAULT;
  76.237 +                    break;
  76.238 +                }
  76.239 +                list_ent = mfn_to_page(mfn)->list.next;
  76.240 +            }
  76.241 +            spin_unlock(&d->page_alloc_lock);
  76.242 +
  76.243 +            domctl->u.getmemlist.num_pfns = i;
  76.244 +            copy_to_guest(u_domctl, domctl, 1);
  76.245 +
  76.246 +            put_domain(d);
  76.247 +        }
  76.248 +    }
  76.249 +    break;
  76.250 +
  76.251 +    case XEN_DOMCTL_hypercall_init:
  76.252 +    {
  76.253 +        struct domain *d = find_domain_by_id(domctl->domain);
  76.254 +        unsigned long gmfn = domctl->u.hypercall_init.gmfn;
  76.255 +        unsigned long mfn;
  76.256 +        void *hypercall_page;
  76.257 +
  76.258 +        ret = -ESRCH;
  76.259 +        if ( unlikely(d == NULL) )
  76.260 +            break;
  76.261 +
  76.262 +        mfn = gmfn_to_mfn(d, gmfn);
  76.263 +
  76.264 +        ret = -EACCES;
  76.265 +        if ( !mfn_valid(mfn) ||
  76.266 +             !get_page_and_type(mfn_to_page(mfn), d, PGT_writable_page) )
  76.267 +        {
  76.268 +            put_domain(d);
  76.269 +            break;
  76.270 +        }
  76.271 +
  76.272 +        ret = 0;
  76.273 +
  76.274 +        hypercall_page = map_domain_page(mfn);
  76.275 +        hypercall_page_initialise(d, hypercall_page);
  76.276 +        unmap_domain_page(hypercall_page);
  76.277 +
  76.278 +        put_page_and_type(mfn_to_page(mfn));
  76.279 +
  76.280 +        put_domain(d);
  76.281 +    }
  76.282 +    break;
  76.283 +
  76.284 +    default:
  76.285 +        ret = -ENOSYS;
  76.286 +        break;
  76.287 +    }
  76.288 +
  76.289 +    return ret;
  76.290 +}
  76.291 +
  76.292 +void arch_getdomaininfo_ctxt(
  76.293 +    struct vcpu *v, struct vcpu_guest_context *c)
  76.294 +{
  76.295 +    memcpy(c, &v->arch.guest_context, sizeof(*c));
  76.296 +
  76.297 +    if ( hvm_guest(v) )
  76.298 +    {
  76.299 +        hvm_store_cpu_guest_regs(v, &c->user_regs, c->ctrlreg);
  76.300 +    }
  76.301 +    else
  76.302 +    {
  76.303 +        /* IOPL privileges are virtualised: merge back into returned eflags. */
  76.304 +        BUG_ON((c->user_regs.eflags & EF_IOPL) != 0);
  76.305 +        c->user_regs.eflags |= v->arch.iopl << 12;
  76.306 +    }
  76.307 +
  76.308 +    c->flags = 0;
  76.309 +    if ( test_bit(_VCPUF_fpu_initialised, &v->vcpu_flags) )
  76.310 +        c->flags |= VGCF_I387_VALID;
  76.311 +    if ( guest_kernel_mode(v, &v->arch.guest_context.user_regs) )
  76.312 +        c->flags |= VGCF_IN_KERNEL;
  76.313 +    if ( hvm_guest(v) )
  76.314 +        c->flags |= VGCF_HVM_GUEST;
  76.315 +
  76.316 +    c->ctrlreg[3] = xen_pfn_to_cr3(pagetable_get_pfn(v->arch.guest_table));
  76.317 +
  76.318 +    c->vm_assist = v->domain->vm_assist;
  76.319 +}
  76.320 +
  76.321 +/*
  76.322 + * Local variables:
  76.323 + * mode: C
  76.324 + * c-set-style: "BSD"
  76.325 + * c-basic-offset: 4
  76.326 + * tab-width: 4
  76.327 + * indent-tabs-mode: nil
  76.328 + * End:
  76.329 + */
    77.1 --- a/xen/arch/x86/mm.c	Fri Aug 25 16:21:39 2006 -0600
    77.2 +++ b/xen/arch/x86/mm.c	Sun Aug 27 10:24:41 2006 -0600
    77.3 @@ -2264,7 +2264,6 @@ int do_mmu_update(
    77.4  
    77.5      perfc_incrc(calls_to_mmu_update);
    77.6      perfc_addc(num_page_updates, count);
    77.7 -    perfc_incr_histo(bpt_updates, count, PT_UPDATES);
    77.8  
    77.9      if ( unlikely(!guest_handle_okay(ureqs, count)) )
   77.10      {
    78.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    78.2 +++ b/xen/arch/x86/platform_hypercall.c	Sun Aug 27 10:24:41 2006 -0600
    78.3 @@ -0,0 +1,159 @@
    78.4 +/******************************************************************************
    78.5 + * platform_hypercall.c
    78.6 + * 
    78.7 + * Hardware platform operations. Intended for use by domain-0 kernel.
    78.8 + * 
    78.9 + * Copyright (c) 2002-2006, K Fraser
   78.10 + */
   78.11 +
   78.12 +#include <xen/config.h>
   78.13 +#include <xen/types.h>
   78.14 +#include <xen/lib.h>
   78.15 +#include <xen/mm.h>
   78.16 +#include <xen/sched.h>
   78.17 +#include <xen/domain.h>
   78.18 +#include <xen/event.h>
   78.19 +#include <xen/domain_page.h>
   78.20 +#include <xen/trace.h>
   78.21 +#include <xen/console.h>
   78.22 +#include <xen/iocap.h>
   78.23 +#include <xen/guest_access.h>
   78.24 +#include <asm/current.h>
   78.25 +#include <public/platform.h>
   78.26 +#include <asm/mtrr.h>
   78.27 +#include "cpu/mtrr/mtrr.h"
   78.28 +
   78.29 +long do_platform_op(XEN_GUEST_HANDLE(xen_platform_op_t) u_xenpf_op)
   78.30 +{
   78.31 +    long ret = 0;
   78.32 +    struct xen_platform_op curop, *op = &curop;
   78.33 +    static DEFINE_SPINLOCK(xenpf_lock);
   78.34 +
   78.35 +    if ( !IS_PRIV(current->domain) )
   78.36 +        return -EPERM;
   78.37 +
   78.38 +    if ( copy_from_guest(op, u_xenpf_op, 1) )
   78.39 +        return -EFAULT;
   78.40 +
   78.41 +    if ( op->interface_version != XENPF_INTERFACE_VERSION )
   78.42 +        return -EACCES;
   78.43 +
   78.44 +    spin_lock(&xenpf_lock);
   78.45 +
   78.46 +    switch ( op->cmd )
   78.47 +    {
   78.48 +    case XENPF_settime:
   78.49 +    {
   78.50 +        do_settime(op->u.settime.secs, 
   78.51 +                   op->u.settime.nsecs, 
   78.52 +                   op->u.settime.system_time);
   78.53 +        ret = 0;
   78.54 +    }
   78.55 +    break;
   78.56 +
   78.57 +    case XENPF_add_memtype:
   78.58 +    {
   78.59 +        ret = mtrr_add_page(
   78.60 +            op->u.add_memtype.mfn,
   78.61 +            op->u.add_memtype.nr_mfns,
   78.62 +            op->u.add_memtype.type,
   78.63 +            1);
   78.64 +        if ( ret > 0 )
   78.65 +        {
   78.66 +            op->u.add_memtype.handle = 0;
   78.67 +            op->u.add_memtype.reg    = ret;
   78.68 +            (void)copy_to_guest(u_xenpf_op, op, 1);
   78.69 +            ret = 0;
   78.70 +        }
   78.71 +    }
   78.72 +    break;
   78.73 +
   78.74 +    case XENPF_del_memtype:
   78.75 +    {
   78.76 +        if (op->u.del_memtype.handle == 0
   78.77 +            /* mtrr/main.c otherwise does a lookup */
   78.78 +            && (int)op->u.del_memtype.reg >= 0)
   78.79 +        {
   78.80 +            ret = mtrr_del_page(op->u.del_memtype.reg, 0, 0);
   78.81 +            if (ret > 0)
   78.82 +                ret = 0;
   78.83 +        }
   78.84 +        else
   78.85 +            ret = -EINVAL;
   78.86 +    }
   78.87 +    break;
   78.88 +
   78.89 +    case XENPF_read_memtype:
   78.90 +    {
   78.91 +        unsigned long mfn;
   78.92 +        unsigned int  nr_mfns;
   78.93 +        mtrr_type     type;
   78.94 +
   78.95 +        ret = -EINVAL;
   78.96 +        if ( op->u.read_memtype.reg < num_var_ranges )
   78.97 +        {
   78.98 +            mtrr_if->get(op->u.read_memtype.reg, &mfn, &nr_mfns, &type);
   78.99 +            op->u.read_memtype.mfn     = mfn;
  78.100 +            op->u.read_memtype.nr_mfns = nr_mfns;
  78.101 +            op->u.read_memtype.type    = type;
  78.102 +            (void)copy_to_guest(u_xenpf_op, op, 1);
  78.103 +            ret = 0;
  78.104 +        }
  78.105 +    }
  78.106 +    break;
  78.107 +
  78.108 +    case XENPF_microcode_update:
  78.109 +    {
  78.110 +        extern int microcode_update(void *buf, unsigned long len);
  78.111 +        ret = microcode_update(op->u.microcode.data.p,
  78.112 +                               op->u.microcode.length);
  78.113 +    }
  78.114 +    break;
  78.115 +
  78.116 +    case XENPF_platform_quirk:
  78.117 +    {
  78.118 +        extern int opt_noirqbalance;
  78.119 +        int quirk_id = op->u.platform_quirk.quirk_id;
  78.120 +        switch ( quirk_id )
  78.121 +        {
  78.122 +        case QUIRK_NOIRQBALANCING:
  78.123 +            printk("Platform quirk -- Disabling IRQ balancing/affinity.\n");
  78.124 +            opt_noirqbalance = 1;
  78.125 +            setup_ioapic_dest();
  78.126 +            break;
  78.127 +        case QUIRK_IOAPIC_BAD_REGSEL:
  78.128 +        case QUIRK_IOAPIC_GOOD_REGSEL:
  78.129 +#ifndef sis_apic_bug
  78.130 +            sis_apic_bug = (quirk_id == QUIRK_IOAPIC_BAD_REGSEL);
  78.131 +            DPRINTK("Domain 0 says that IO-APIC REGSEL is %s\n",
  78.132 +                    sis_apic_bug ? "bad" : "good");
  78.133 +#else
  78.134 +            BUG_ON(sis_apic_bug != (quirk_id == QUIRK_IOAPIC_BAD_REGSEL));
  78.135 +#endif
  78.136 +            break;
  78.137 +        default:
  78.138 +            ret = -EINVAL;
  78.139 +            break;
  78.140 +        }
  78.141 +    }
  78.142 +    break;
  78.143 +
  78.144 +    default:
  78.145 +        ret = -ENOSYS;
  78.146 +        break;
  78.147 +    }
  78.148 +
  78.149 +    spin_unlock(&xenpf_lock);
  78.150 +
  78.151 +    return ret;
  78.152 +}
  78.153 +
  78.154 +/*
  78.155 + * Local variables:
  78.156 + * mode: C
  78.157 + * c-set-style: "BSD"
  78.158 + * c-basic-offset: 4
  78.159 + * tab-width: 4
  78.160 + * indent-tabs-mode: nil
  78.161 + * End:
  78.162 + */
    79.1 --- a/xen/arch/x86/setup.c	Fri Aug 25 16:21:39 2006 -0600
    79.2 +++ b/xen/arch/x86/setup.c	Sun Aug 27 10:24:41 2006 -0600
    79.3 @@ -15,6 +15,7 @@
    79.4  #include <xen/version.h>
    79.5  #include <xen/gdbstub.h>
    79.6  #include <xen/percpu.h>
    79.7 +#include <xen/hypercall.h>
    79.8  #include <public/version.h>
    79.9  #include <asm/bitops.h>
   79.10  #include <asm/smp.h>
   79.11 @@ -416,9 +417,13 @@ void __init __start_xen(multiboot_info_t
   79.12             nr_pages << (PAGE_SHIFT - 10));
   79.13      total_pages = nr_pages;
   79.14  
   79.15 -    /* Sanity check for unwanted bloat of dom0_op structure. */
   79.16 -    BUILD_BUG_ON(sizeof(((struct dom0_op *)0)->u) !=
   79.17 -                 sizeof(((struct dom0_op *)0)->u.pad));
   79.18 +    /* Sanity check for unwanted bloat of certain hypercall structures. */
   79.19 +    BUILD_BUG_ON(sizeof(((struct xen_platform_op *)0)->u) !=
   79.20 +                 sizeof(((struct xen_platform_op *)0)->u.pad));
   79.21 +    BUILD_BUG_ON(sizeof(((struct xen_domctl *)0)->u) !=
   79.22 +                 sizeof(((struct xen_domctl *)0)->u.pad));
   79.23 +    BUILD_BUG_ON(sizeof(((struct xen_sysctl *)0)->u) !=
   79.24 +                 sizeof(((struct xen_sysctl *)0)->u.pad));
   79.25  
   79.26      BUILD_BUG_ON(sizeof(start_info_t) > PAGE_SIZE);
   79.27      BUILD_BUG_ON(sizeof(shared_info_t) > PAGE_SIZE);
    80.1 --- a/xen/arch/x86/shadow2-common.c	Fri Aug 25 16:21:39 2006 -0600
    80.2 +++ b/xen/arch/x86/shadow2-common.c	Sun Aug 27 10:24:41 2006 -0600
    80.3 @@ -2951,14 +2951,15 @@ void shadow2_convert_to_log_dirty(struct
    80.4  
    80.5  /* Read a domain's log-dirty bitmap and stats.  
    80.6   * If the operation is a CLEAN, clear the bitmap and stats as well. */
    80.7 -static int shadow2_log_dirty_op(struct domain *d, dom0_shadow_control_t *sc)
    80.8 -{    
    80.9 +static int shadow2_log_dirty_op(
   80.10 +    struct domain *d, struct xen_domctl_shadow_op *sc)
   80.11 +{
   80.12      int i, rv = 0, clean = 0;
   80.13  
   80.14      domain_pause(d);
   80.15      shadow2_lock(d);
   80.16  
   80.17 -    clean = (sc->op == DOM0_SHADOW_CONTROL_OP_CLEAN);
   80.18 +    clean = (sc->op == XEN_DOMCTL_SHADOW_OP_CLEAN);
   80.19  
   80.20      SHADOW2_DEBUG(LOGDIRTY, "log-dirty %s: dom %u faults=%u dirty=%u\n", 
   80.21                    (clean) ? "clean" : "peek",
   80.22 @@ -3081,11 +3082,11 @@ void sh2_do_mark_dirty(struct domain *d,
   80.23  
   80.24  
   80.25  /**************************************************************************/
   80.26 -/* Shadow-control DOM0_OP dispatcher */
   80.27 -
   80.28 -int shadow2_control_op(struct domain *d, 
   80.29 -                       dom0_shadow_control_t *sc,
   80.30 -                       XEN_GUEST_HANDLE(dom0_op_t) u_dom0_op)
   80.31 +/* Shadow-control XEN_DOMCTL dispatcher */
   80.32 +
   80.33 +int shadow2_domctl(struct domain *d, 
   80.34 +                   xen_domctl_shadow_op_t *sc,
   80.35 +                   XEN_GUEST_HANDLE(xen_domctl_t) u_domctl)
   80.36  {
   80.37      int rc, preempted = 0;
   80.38  
   80.39 @@ -3097,7 +3098,7 @@ int shadow2_control_op(struct domain *d,
   80.40  
   80.41      switch ( sc->op )
   80.42      {
   80.43 -    case DOM0_SHADOW_CONTROL_OP_OFF:
   80.44 +    case XEN_DOMCTL_SHADOW_OP_OFF:
   80.45          if ( shadow2_mode_log_dirty(d) )
   80.46              if ( (rc = shadow2_log_dirty_disable(d)) != 0 ) 
   80.47                  return rc;
   80.48 @@ -3106,34 +3107,34 @@ int shadow2_control_op(struct domain *d,
   80.49                  return rc;
   80.50          return 0;
   80.51  
   80.52 -    case DOM0_SHADOW_CONTROL_OP_ENABLE_TEST:
   80.53 +    case XEN_DOMCTL_SHADOW_OP_ENABLE_TEST:
   80.54          return shadow2_test_enable(d);
   80.55  
   80.56 -    case DOM0_SHADOW_CONTROL_OP_ENABLE_LOGDIRTY:
   80.57 +    case XEN_DOMCTL_SHADOW_OP_ENABLE_LOGDIRTY:
   80.58          return shadow2_log_dirty_enable(d);
   80.59  
   80.60 -    case DOM0_SHADOW_CONTROL_OP_ENABLE_TRANSLATE:
   80.61 +    case XEN_DOMCTL_SHADOW_OP_ENABLE_TRANSLATE:
   80.62          return shadow2_enable(d, SHM2_refcounts|SHM2_translate);
   80.63  
   80.64 -    case DOM0_SHADOW_CONTROL_OP_CLEAN:
   80.65 -    case DOM0_SHADOW_CONTROL_OP_PEEK:
   80.66 +    case XEN_DOMCTL_SHADOW_OP_CLEAN:
   80.67 +    case XEN_DOMCTL_SHADOW_OP_PEEK:
   80.68          return shadow2_log_dirty_op(d, sc);
   80.69  
   80.70 -    case DOM0_SHADOW_CONTROL_OP_ENABLE:
   80.71 -        if ( sc->mode & DOM0_SHADOW_ENABLE_LOG_DIRTY )
   80.72 +    case XEN_DOMCTL_SHADOW_OP_ENABLE:
   80.73 +        if ( sc->mode & XEN_DOMCTL_SHADOW_ENABLE_LOG_DIRTY )
   80.74              return shadow2_log_dirty_enable(d);
   80.75          return shadow2_enable(d, sc->mode << SHM2_shift);
   80.76  
   80.77 -    case DOM0_SHADOW_CONTROL_OP_GET_ALLOCATION:
   80.78 +    case XEN_DOMCTL_SHADOW_OP_GET_ALLOCATION:
   80.79          sc->mb = shadow2_get_allocation(d);
   80.80          return 0;
   80.81  
   80.82 -    case DOM0_SHADOW_CONTROL_OP_SET_ALLOCATION:
   80.83 +    case XEN_DOMCTL_SHADOW_OP_SET_ALLOCATION:
   80.84          rc = shadow2_set_allocation(d, sc->mb, &preempted);
   80.85          if ( preempted )
   80.86              /* Not finished.  Set up to re-run the call. */
   80.87              rc = hypercall_create_continuation(
   80.88 -                __HYPERVISOR_dom0_op, "h", u_dom0_op);
   80.89 +                __HYPERVISOR_domctl, "h", u_domctl);
   80.90          else 
   80.91              /* Finished.  Return the new allocation */
   80.92              sc->mb = shadow2_get_allocation(d);
    81.1 --- a/xen/arch/x86/shadow2.c	Fri Aug 25 16:21:39 2006 -0600
    81.2 +++ b/xen/arch/x86/shadow2.c	Sun Aug 27 10:24:41 2006 -0600
    81.3 @@ -2893,7 +2893,7 @@ static int sh2_page_fault(struct vcpu *v
    81.4      // i.e. ring 3.  Such errors are not caused or dealt with by the shadow
    81.5      // code.
    81.6      //
    81.7 -    if ( (regs->error_code & X86_PFEC_SUPERVISOR_FAULT) &&
    81.8 +    if ( (regs->error_code & PFEC_user_mode) &&
    81.9           !(accumulated_gflags & _PAGE_USER) )
   81.10      {
   81.11          /* illegal user-mode access to supervisor-only page */
   81.12 @@ -2903,7 +2903,7 @@ static int sh2_page_fault(struct vcpu *v
   81.13  
   81.14      // Was it a write fault?
   81.15      //
   81.16 -    if ( regs->error_code & X86_PFEC_WRITE_FAULT )
   81.17 +    if ( regs->error_code & PFEC_write_access )
   81.18      {
   81.19          if ( unlikely(!(accumulated_gflags & _PAGE_RW)) )
   81.20          {
   81.21 @@ -2917,7 +2917,7 @@ static int sh2_page_fault(struct vcpu *v
   81.22          // marked "do not execute".  Such errors are not caused or dealt with
   81.23          // by the shadow code.
   81.24          //
   81.25 -        if ( regs->error_code & X86_PFEC_INSN_FETCH_FAULT )
   81.26 +        if ( regs->error_code & PFEC_insn_fetch )
   81.27          {
   81.28              if ( accumulated_gflags & _PAGE_NX_BIT )
   81.29              {
   81.30 @@ -2960,8 +2960,8 @@ static int sh2_page_fault(struct vcpu *v
   81.31       * for the shadow entry, since we might promote a page here. */
   81.32      // XXX -- this code will need to change somewhat if/when the shadow code
   81.33      // can directly map superpages...
   81.34 -    ft = ((regs->error_code & X86_PFEC_WRITE_FAULT) 
   81.35 -          ? ft_demand_write : ft_demand_read);
   81.36 +    ft = ((regs->error_code & PFEC_write_access) ?
   81.37 +          ft_demand_write : ft_demand_read);
   81.38      ptr_sl1e = shadow_get_and_create_l1e(v, &gw, &sl1mfn, ft);
   81.39      ASSERT(ptr_sl1e);
   81.40  
    82.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    82.2 +++ b/xen/arch/x86/sysctl.c	Sun Aug 27 10:24:41 2006 -0600
    82.3 @@ -0,0 +1,77 @@
    82.4 +/******************************************************************************
    82.5 + * Arch-specific sysctl.c
    82.6 + * 
    82.7 + * System management operations. For use by node control stack.
    82.8 + * 
    82.9 + * Copyright (c) 2002-2006, K Fraser
   82.10 + */
   82.11 +
   82.12 +#include <xen/config.h>
   82.13 +#include <xen/types.h>
   82.14 +#include <xen/lib.h>
   82.15 +#include <xen/mm.h>
   82.16 +#include <xen/guest_access.h>
   82.17 +#include <public/sysctl.h>
   82.18 +#include <xen/sched.h>
   82.19 +#include <xen/event.h>
   82.20 +#include <xen/domain_page.h>
   82.21 +#include <asm/msr.h>
   82.22 +#include <xen/trace.h>
   82.23 +#include <xen/console.h>
   82.24 +#include <xen/iocap.h>
   82.25 +#include <asm/shadow.h>
   82.26 +#include <asm/irq.h>
   82.27 +#include <asm/hvm/hvm.h>
   82.28 +#include <asm/hvm/support.h>
   82.29 +#include <asm/processor.h>
   82.30 +
   82.31 +long arch_do_sysctl(
   82.32 +    struct xen_sysctl *sysctl, XEN_GUEST_HANDLE(xen_sysctl_t) u_sysctl)
   82.33 +{
   82.34 +    long ret = 0;
   82.35 +
   82.36 +    switch ( sysctl->cmd )
   82.37 +    {
   82.38 +
   82.39 +    case XEN_SYSCTL_physinfo:
   82.40 +    {
   82.41 +        xen_sysctl_physinfo_t *pi = &sysctl->u.physinfo;
   82.42 +
   82.43 +        pi->threads_per_core =
   82.44 +            cpus_weight(cpu_sibling_map[0]);
   82.45 +        pi->cores_per_socket =
   82.46 +            cpus_weight(cpu_core_map[0]) / pi->threads_per_core;
   82.47 +        pi->sockets_per_node = 
   82.48 +            num_online_cpus() / cpus_weight(cpu_core_map[0]);
   82.49 +
   82.50 +        pi->nr_nodes         = 1;
   82.51 +        pi->total_pages      = total_pages;
   82.52 +        pi->free_pages       = avail_domheap_pages();
   82.53 +        pi->scrub_pages      = avail_scrub_pages();
   82.54 +        pi->cpu_khz          = cpu_khz;
   82.55 +        memset(pi->hw_cap, 0, sizeof(pi->hw_cap));
   82.56 +        memcpy(pi->hw_cap, boot_cpu_data.x86_capability, NCAPINTS*4);
   82.57 +        ret = 0;
   82.58 +        if ( copy_to_guest(u_sysctl, sysctl, 1) )
   82.59 +            ret = -EFAULT;
   82.60 +    }
   82.61 +    break;
   82.62 +    
   82.63 +
   82.64 +    default:
   82.65 +        ret = -ENOSYS;
   82.66 +        break;
   82.67 +    }
   82.68 +
   82.69 +    return ret;
   82.70 +}
   82.71 +
   82.72 +/*
   82.73 + * Local variables:
   82.74 + * mode: C
   82.75 + * c-set-style: "BSD"
   82.76 + * c-basic-offset: 4
   82.77 + * tab-width: 4
   82.78 + * indent-tabs-mode: nil
   82.79 + * End:
   82.80 + */
    83.1 --- a/xen/arch/x86/traps.c	Fri Aug 25 16:21:39 2006 -0600
    83.2 +++ b/xen/arch/x86/traps.c	Sun Aug 27 10:24:41 2006 -0600
    83.3 @@ -686,9 +686,9 @@ void propagate_page_fault(unsigned long 
    83.4      v->vcpu_info->arch.cr2           = addr;
    83.5  
    83.6      /* Re-set error_code.user flag appropriately for the guest. */
    83.7 -    error_code &= ~PGERR_user_mode;
    83.8 +    error_code &= ~PFEC_user_mode;
    83.9      if ( !guest_kernel_mode(v, guest_cpu_user_regs()) )
   83.10 -        error_code |= PGERR_user_mode;
   83.11 +        error_code |= PFEC_user_mode;
   83.12  
   83.13      ti = &v->arch.guest_context.trap_ctxt[TRAP_page_fault];
   83.14      tb->flags = TBF_EXCEPTION | TBF_EXCEPTION_ERRCODE;
   83.15 @@ -768,17 +768,17 @@ static int __spurious_page_fault(
   83.16      unsigned int required_flags, disallowed_flags;
   83.17  
   83.18      /* Reserved bit violations are never spurious faults. */
   83.19 -    if ( regs->error_code & PGERR_reserved_bit )
   83.20 +    if ( regs->error_code & PFEC_reserved_bit )
   83.21          return 0;
   83.22  
   83.23      required_flags  = _PAGE_PRESENT;
   83.24 -    if ( regs->error_code & PGERR_write_access )
   83.25 +    if ( regs->error_code & PFEC_write_access )
   83.26          required_flags |= _PAGE_RW;
   83.27 -    if ( regs->error_code & PGERR_user_mode )
   83.28 +    if ( regs->error_code & PFEC_user_mode )
   83.29          required_flags |= _PAGE_USER;
   83.30  
   83.31      disallowed_flags = 0;
   83.32 -    if ( regs->error_code & PGERR_instr_fetch )
   83.33 +    if ( regs->error_code & PFEC_insn_fetch )
   83.34          disallowed_flags |= _PAGE_NX;
   83.35  
   83.36      mfn = cr3 >> PAGE_SHIFT;
   83.37 @@ -886,7 +886,7 @@ static int fixup_page_fault(unsigned lon
   83.38           guest_kernel_mode(v, regs) &&
   83.39           /* Do not check if access-protection fault since the page may 
   83.40              legitimately be not present in shadow page tables */
   83.41 -         ((regs->error_code & PGERR_write_access) == PGERR_write_access) &&
   83.42 +         ((regs->error_code & PFEC_write_access) == PFEC_write_access) &&
   83.43           ptwr_do_page_fault(d, addr, regs) )
   83.44          return EXCRET_fault_fixed;
   83.45  
   83.46 @@ -1100,7 +1100,7 @@ static int emulate_privileged_op(struct 
   83.47              if ( (rc = copy_to_user((void *)regs->edi, &data, op_bytes)) != 0 )
   83.48              {
   83.49                  propagate_page_fault(regs->edi + op_bytes - rc,
   83.50 -                                     PGERR_write_access);
   83.51 +                                     PFEC_write_access);
   83.52                  return EXCRET_fault_fixed;
   83.53              }
   83.54              regs->edi += (int)((regs->eflags & EF_DF) ? -op_bytes : op_bytes);
    84.1 --- a/xen/arch/x86/x86_32/entry.S	Fri Aug 25 16:21:39 2006 -0600
    84.2 +++ b/xen/arch/x86/x86_32/entry.S	Sun Aug 27 10:24:41 2006 -0600
    84.3 @@ -630,7 +630,7 @@ ENTRY(hypercall_table)
    84.4          .long do_set_callbacks
    84.5          .long do_fpu_taskswitch     /*  5 */
    84.6          .long do_arch_sched_op_compat
    84.7 -        .long do_dom0_op
    84.8 +        .long do_platform_op
    84.9          .long do_set_debugreg
   84.10          .long do_get_debugreg
   84.11          .long do_update_descriptor  /* 10 */
   84.12 @@ -657,7 +657,9 @@ ENTRY(hypercall_table)
   84.13          .long do_xenoprof_op
   84.14          .long do_event_channel_op
   84.15          .long do_physdev_op
   84.16 -        .long do_hvm_op             /* 34 */
   84.17 +        .long do_hvm_op
   84.18 +        .long do_sysctl             /* 35 */
   84.19 +        .long do_domctl
   84.20          .rept NR_hypercalls-((.-hypercall_table)/4)
   84.21          .long do_ni_hypercall
   84.22          .endr
   84.23 @@ -670,7 +672,7 @@ ENTRY(hypercall_args_table)
   84.24          .byte 4 /* do_set_callbacks     */
   84.25          .byte 1 /* do_fpu_taskswitch    */  /*  5 */
   84.26          .byte 2 /* do_arch_sched_op_compat */
   84.27 -        .byte 1 /* do_dom0_op           */
   84.28 +        .byte 1 /* do_platform_op       */
   84.29          .byte 2 /* do_set_debugreg      */
   84.30          .byte 1 /* do_get_debugreg      */
   84.31          .byte 4 /* do_update_descriptor */  /* 10 */
   84.32 @@ -697,7 +699,9 @@ ENTRY(hypercall_args_table)
   84.33          .byte 2 /* do_xenoprof_op       */
   84.34          .byte 2 /* do_event_channel_op  */
   84.35          .byte 2 /* do_physdev_op        */
   84.36 -        .byte 2 /* do_hvm_op            */  /* 34 */
   84.37 +        .byte 2 /* do_hvm_op            */
   84.38 +        .byte 1 /* do_sysctl            */  /* 35 */
   84.39 +        .byte 1 /* do_domctl            */
   84.40          .rept NR_hypercalls-(.-hypercall_args_table)
   84.41          .byte 0 /* do_ni_hypercall      */
   84.42          .endr
    85.1 --- a/xen/arch/x86/x86_64/entry.S	Fri Aug 25 16:21:39 2006 -0600
    85.2 +++ b/xen/arch/x86/x86_64/entry.S	Sun Aug 27 10:24:41 2006 -0600
    85.3 @@ -543,7 +543,7 @@ ENTRY(hypercall_table)
    85.4          .quad do_set_callbacks
    85.5          .quad do_fpu_taskswitch     /*  5 */
    85.6          .quad do_arch_sched_op_compat
    85.7 -        .quad do_dom0_op
    85.8 +        .quad do_platform_op
    85.9          .quad do_set_debugreg
   85.10          .quad do_get_debugreg
   85.11          .quad do_update_descriptor  /* 10 */
   85.12 @@ -571,6 +571,8 @@ ENTRY(hypercall_table)
   85.13          .quad do_event_channel_op
   85.14          .quad do_physdev_op
   85.15          .quad do_hvm_op
   85.16 +        .quad do_sysctl             /* 35 */
   85.17 +        .quad do_domctl
   85.18          .rept NR_hypercalls-((.-hypercall_table)/8)
   85.19          .quad do_ni_hypercall
   85.20          .endr
   85.21 @@ -583,7 +585,7 @@ ENTRY(hypercall_args_table)
   85.22          .byte 3 /* do_set_callbacks     */
   85.23          .byte 1 /* do_fpu_taskswitch    */  /*  5 */
   85.24          .byte 2 /* do_arch_sched_op_compat */
   85.25 -        .byte 1 /* do_dom0_op           */
   85.26 +        .byte 1 /* do_platform_op           */
   85.27          .byte 2 /* do_set_debugreg      */
   85.28          .byte 1 /* do_get_debugreg      */
   85.29          .byte 2 /* do_update_descriptor */  /* 10 */
   85.30 @@ -611,6 +613,8 @@ ENTRY(hypercall_args_table)
   85.31          .byte 2 /* do_event_channel_op  */
   85.32          .byte 2 /* do_physdev_op        */
   85.33          .byte 2 /* do_hvm_op            */
   85.34 +        .byte 1 /* do_sysctl            */  /* 35 */
   85.35 +        .byte 1 /* do_domctl            */
   85.36          .rept NR_hypercalls-(.-hypercall_args_table)
   85.37          .byte 0 /* do_ni_hypercall      */
   85.38          .endr
    86.1 --- a/xen/arch/x86/x86_emulate.c	Fri Aug 25 16:21:39 2006 -0600
    86.2 +++ b/xen/arch/x86/x86_emulate.c	Sun Aug 27 10:24:41 2006 -0600
    86.3 @@ -21,6 +21,11 @@
    86.4  #endif
    86.5  #include <asm-x86/x86_emulate.h>
    86.6  
    86.7 +#ifndef PFEC_write_access
    86.8 +#define PFEC_write_access (1U<<1)
    86.9 +#define PFEC_insn_fetch   (1U<<4)
   86.10 +#endif
   86.11 +
   86.12  /*
   86.13   * Opcode effective-address decode tables.
   86.14   * Note that we only emulate instructions that have at least one memory
   86.15 @@ -444,6 +449,13 @@ x86_emulate_memop(
   86.16      /* Shadow copy of register state. Committed on successful emulation. */
   86.17      struct cpu_user_regs _regs = *ctxt->regs;
   86.18  
   86.19 +    /*
   86.20 +     * We do not emulate faults on instruction fetch. We assume that the
   86.21 +     * guest never executes out of a special memory area.
   86.22 +     */
   86.23 +    if ( _regs.error_code & PFEC_insn_fetch )
   86.24 +        return -1;
   86.25 +
   86.26      switch ( mode )
   86.27      {
   86.28      case X86EMUL_MODE_REAL:
   86.29 @@ -769,6 +781,13 @@ x86_emulate_memop(
   86.30          dst.val = src.val;
   86.31          break;
   86.32      case 0x8f: /* pop (sole member of Grp1a) */
   86.33 +        /*
   86.34 +         * If the faulting access was a read it means that the fault occurred
   86.35 +         * when accessing the implicit stack operand. We assume the guest never
   86.36 +         * uses special memory areas as stack space.
   86.37 +         */
   86.38 +        if ( !(_regs.error_code & PFEC_write_access) )
   86.39 +            goto cannot_emulate; /* fault on stack access: bail */
   86.40          /* 64-bit mode: POP always pops a 64-bit operand. */
   86.41          if ( mode == X86EMUL_MODE_PROT64 )
   86.42              dst.bytes = 8;
   86.43 @@ -846,6 +865,13 @@ x86_emulate_memop(
   86.44              emulate_1op("dec", dst, _regs.eflags);
   86.45              break;
   86.46          case 6: /* push */
   86.47 +            /*
   86.48 +             * If the faulting access was a write it means that the fault
   86.49 +             * occurred when accessing the implicit stack operand. We assume
   86.50 +             * the guest never uses special memory areas as stack space.
   86.51 +             */
   86.52 +            if ( _regs.error_code & PFEC_write_access )
   86.53 +                goto cannot_emulate; /* fault on stack access: bail */
   86.54              /* 64-bit mode: PUSH always pushes a 64-bit operand. */
   86.55              if ( mode == X86EMUL_MODE_PROT64 )
   86.56              {
   86.57 @@ -920,7 +946,7 @@ x86_emulate_memop(
   86.58      case 0xa4 ... 0xa5: /* movs */
   86.59          dst.type  = OP_MEM;
   86.60          dst.bytes = (d & ByteOp) ? 1 : op_bytes;
   86.61 -        if ( _regs.error_code & 2 )
   86.62 +        if ( _regs.error_code & PFEC_write_access )
   86.63          {
   86.64              /* Write fault: destination is special memory. */
   86.65              dst.ptr = (unsigned long *)cr2;
   86.66 @@ -1162,7 +1188,7 @@ x86_emulate_write_std(
   86.67  
   86.68      if ( (rc = copy_to_user((void *)addr, (void *)&val, bytes)) != 0 )
   86.69      {
   86.70 -        propagate_page_fault(addr + bytes - rc, PGERR_write_access);
   86.71 +        propagate_page_fault(addr + bytes - rc, PFEC_write_access);
   86.72          return X86EMUL_PROPAGATE_FAULT;
   86.73      }
   86.74  
    87.1 --- a/xen/common/Makefile	Fri Aug 25 16:21:39 2006 -0600
    87.2 +++ b/xen/common/Makefile	Sun Aug 27 10:24:41 2006 -0600
    87.3 @@ -1,6 +1,6 @@
    87.4  obj-y += acm_ops.o
    87.5  obj-y += bitmap.o
    87.6 -obj-y += dom0_ops.o
    87.7 +obj-y += domctl.o
    87.8  obj-y += domain.o
    87.9  obj-y += elf.o
   87.10  obj-y += event_channel.o
   87.11 @@ -12,7 +12,6 @@ obj-y += memory.o
   87.12  obj-y += multicall.o
   87.13  obj-y += page_alloc.o
   87.14  obj-y += rangeset.o
   87.15 -obj-y += sched_bvt.o
   87.16  obj-y += sched_credit.o
   87.17  obj-y += sched_sedf.o
   87.18  obj-y += schedule.o
   87.19 @@ -20,6 +19,7 @@ obj-y += shutdown.o
   87.20  obj-y += softirq.o
   87.21  obj-y += string.o
   87.22  obj-y += symbols.o
   87.23 +obj-y += sysctl.o
   87.24  obj-y += trace.o
   87.25  obj-y += timer.o
   87.26  obj-y += version.o
    88.1 --- a/xen/common/acm_ops.c	Fri Aug 25 16:21:39 2006 -0600
    88.2 +++ b/xen/common/acm_ops.c	Sun Aug 27 10:24:41 2006 -0600
    88.3 @@ -26,7 +26,6 @@
    88.4  #include <xen/trace.h>
    88.5  #include <xen/console.h>
    88.6  #include <xen/guest_access.h>
    88.7 -#include <public/sched_ctl.h>
    88.8  #include <acm/acm_hooks.h>
    88.9  
   88.10  #ifndef ACM_SECURITY
    89.1 --- a/xen/common/dom0_ops.c	Fri Aug 25 16:21:39 2006 -0600
    89.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    89.3 @@ -1,739 +0,0 @@
    89.4 -/******************************************************************************
    89.5 - * dom0_ops.c
    89.6 - * 
    89.7 - * Process command requests from domain-0 guest OS.
    89.8 - * 
    89.9 - * Copyright (c) 2002, K A Fraser