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

[Xen-changelog] [xen-unstable] [IA64] privop_stat.c



# HG changeset patch
# User awilliam@xxxxxxxxxxx
# Node ID 550786d7d3528653f269bb3b598e8a0b15b3d976
# Parent  75b23b6a7cb7344a5605b18fdd676b2a0465aac8
[IA64] privop_stat.c

Cleanup: create privop_stat.[ch]
Move all stats function to privop_stat.c to depolute other files.

Signed-off-by: Tristan Gingold <tristan.gingold@xxxxxxxx>
---
 xen/arch/ia64/vmx/mmio.c           |    2 
 xen/arch/ia64/vmx/vmx_virt.c       |   15 -
 xen/arch/ia64/xen/Makefile         |    1 
 xen/arch/ia64/xen/dom_fw.c         |   78 +++++++
 xen/arch/ia64/xen/domain.c         |    3 
 xen/arch/ia64/xen/faults.c         |   37 ---
 xen/arch/ia64/xen/hypercall.c      |    7 
 xen/arch/ia64/xen/ivt.S            |    1 
 xen/arch/ia64/xen/privop.c         |  408 -------------------------------------
 xen/arch/ia64/xen/privop_stat.c    |  389 +++++++++++++++++++++++++++++++++++
 xen/arch/ia64/xen/vcpu.c           |   42 ---
 xen/include/asm-ia64/bundle.h      |  228 ++++++++++++++++++++
 xen/include/asm-ia64/dom_fw.h      |    4 
 xen/include/asm-ia64/privop.h      |  225 --------------------
 xen/include/asm-ia64/privop_stat.h |   66 +++++
 xen/include/asm-ia64/vcpu.h        |   19 -
 xen/include/asm-ia64/vhpt.h        |    2 
 17 files changed, 786 insertions(+), 741 deletions(-)

diff -r 75b23b6a7cb7 -r 550786d7d352 xen/arch/ia64/vmx/mmio.c
--- a/xen/arch/ia64/vmx/mmio.c  Mon Jul 03 07:42:17 2006 -0600
+++ b/xen/arch/ia64/vmx/mmio.c  Mon Jul 03 08:12:16 2006 -0600
@@ -27,7 +27,7 @@
 #include <asm/gcc_intrin.h>
 #include <linux/interrupt.h>
 #include <asm/vmx_vcpu.h>
-#include <asm/privop.h>
+#include <asm/bundle.h>
 #include <asm/types.h>
 #include <public/hvm/ioreq.h>
 #include <asm/mm.h>
diff -r 75b23b6a7cb7 -r 550786d7d352 xen/arch/ia64/vmx/vmx_virt.c
--- a/xen/arch/ia64/vmx/vmx_virt.c      Mon Jul 03 07:42:17 2006 -0600
+++ b/xen/arch/ia64/vmx/vmx_virt.c      Mon Jul 03 08:12:16 2006 -0600
@@ -20,10 +20,7 @@
  *  Shaofan Li (Susue Li) <susie.li@xxxxxxxxx>
  *  Xuefei Xu (Anthony Xu) (Anthony.xu@xxxxxxxxx)
  */
-
-
-
-#include <asm/privop.h>
+#include <asm/bundle.h>
 #include <asm/vmx_vcpu.h>
 #include <asm/processor.h>
 #include <asm/delay.h> // Debug only
@@ -33,7 +30,6 @@
 #include <asm/vmx.h>
 #include <asm/virt_event.h>
 #include <asm/vmx_phy_mode.h>
-extern UINT64 privop_trace;
 extern void vhpi_detection(VCPU *vcpu);//temporarily place here,need a header 
file.
 
 void
@@ -1381,15 +1377,6 @@ vmx_emulate(VCPU *vcpu, REGS *regs)
     cause = VMX(vcpu,cause);
     opcode = VMX(vcpu,opcode);
 
-/*
-    if (privop_trace) {
-        static long i = 400;
-        //if (i > 0) printf("privop @%p\n",iip);
-        if (i > 0) printf("priv_handle_op: @%p, itc=%lx, itm=%lx\n",
-            iip,ia64_get_itc(),ia64_get_itm());
-        i--;
-    }
-*/
 #ifdef  VTLB_DEBUG
     check_vtlb_sanity(vmx_vcpu_get_vtlb(vcpu));
     dump_vtlb(vmx_vcpu_get_vtlb(vcpu));
diff -r 75b23b6a7cb7 -r 550786d7d352 xen/arch/ia64/xen/Makefile
--- a/xen/arch/ia64/xen/Makefile        Mon Jul 03 07:42:17 2006 -0600
+++ b/xen/arch/ia64/xen/Makefile        Mon Jul 03 08:12:16 2006 -0600
@@ -24,5 +24,6 @@ obj-y += xensetup.o
 obj-y += xensetup.o
 obj-y += xentime.o
 obj-y += flushd.o
+obj-y += privop_stat.o
 
 obj-$(crash_debug) += gdbstub.o
diff -r 75b23b6a7cb7 -r 550786d7d352 xen/arch/ia64/xen/dom_fw.c
--- a/xen/arch/ia64/xen/dom_fw.c        Mon Jul 03 07:42:17 2006 -0600
+++ b/xen/arch/ia64/xen/dom_fw.c        Mon Jul 03 08:12:16 2006 -0600
@@ -23,6 +23,7 @@
 #include <xen/acpi.h>
 
 #include <asm/dom_fw.h>
+#include <asm/bundle.h>
 
 static struct ia64_boot_param *dom_fw_init(struct domain *, const char 
*,int,char *,int);
 extern struct domain *dom0;
@@ -81,6 +82,83 @@ dom_pa(unsigned long imva)
             assign_new_domain0_page((d), (mpaddr)); \
         }                                           \
     } while (0)
+
+/**************************************************************************
+Hypercall bundle creation
+**************************************************************************/
+
+static void build_hypercall_bundle(UINT64 *imva, UINT64 brkimm, UINT64 hypnum, 
UINT64 ret)
+{
+       INST64_A5 slot0;
+       INST64_I19 slot1;
+       INST64_B4 slot2;
+       IA64_BUNDLE bundle;
+
+       // slot1: mov r2 = hypnum (low 20 bits)
+       slot0.inst = 0;
+       slot0.qp = 0; slot0.r1 = 2; slot0.r3 = 0; slot0.major = 0x9;
+       slot0.imm7b = hypnum; slot0.imm9d = hypnum >> 7;
+       slot0.imm5c = hypnum >> 16; slot0.s = 0;
+       // slot1: break brkimm
+       slot1.inst = 0;
+       slot1.qp = 0; slot1.x6 = 0; slot1.x3 = 0; slot1.major = 0x0;
+       slot1.imm20 = brkimm; slot1.i = brkimm >> 20;
+       // if ret slot2: br.ret.sptk.many rp
+       // else slot2: br.cond.sptk.many rp
+       slot2.inst = 0; slot2.qp = 0; slot2.p = 1; slot2.b2 = 0;
+       slot2.wh = 0; slot2.d = 0; slot2.major = 0x0;
+       if (ret) {
+               slot2.btype = 4; slot2.x6 = 0x21;
+       }
+       else {
+               slot2.btype = 0; slot2.x6 = 0x20;
+       }
+       
+       bundle.i64[0] = 0; bundle.i64[1] = 0;
+       bundle.template = 0x11;
+       bundle.slot0 = slot0.inst; bundle.slot2 = slot2.inst;
+       bundle.slot1a = slot1.inst; bundle.slot1b = slot1.inst >> 18;
+       
+       imva[0] = bundle.i64[0]; imva[1] = bundle.i64[1];
+       ia64_fc(imva);
+       ia64_fc(imva + 1);
+}
+
+static void build_pal_hypercall_bundles(UINT64 *imva, UINT64 brkimm, UINT64 
hypnum)
+{
+       extern unsigned long pal_call_stub[];
+       IA64_BUNDLE bundle;
+       INST64_A5 slot_a5;
+       INST64_M37 slot_m37;
+
+       /* The source of the hypercall stub is the pal_call_stub function
+          defined in xenasm.S.  */
+
+       /* Copy the first bundle and patch the hypercall number.  */
+       bundle.i64[0] = pal_call_stub[0];
+       bundle.i64[1] = pal_call_stub[1];
+       slot_a5.inst = bundle.slot0;
+       slot_a5.imm7b = hypnum;
+       slot_a5.imm9d = hypnum >> 7;
+       slot_a5.imm5c = hypnum >> 16;
+       bundle.slot0 = slot_a5.inst;
+       imva[0] = bundle.i64[0];
+       imva[1] = bundle.i64[1];
+       ia64_fc(imva);
+       ia64_fc(imva + 1);
+       
+       /* Copy the second bundle and patch the hypercall vector.  */
+       bundle.i64[0] = pal_call_stub[2];
+       bundle.i64[1] = pal_call_stub[3];
+       slot_m37.inst = bundle.slot0;
+       slot_m37.imm20a = brkimm;
+       slot_m37.i = brkimm >> 20;
+       bundle.slot0 = slot_m37.inst;
+       imva[2] = bundle.i64[0];
+       imva[3] = bundle.i64[1];
+       ia64_fc(imva + 2);
+       ia64_fc(imva + 3);
+}
 
 // builds a hypercall bundle at domain physical address
 static void dom_fpswa_hypercall_patch(struct domain *d)
diff -r 75b23b6a7cb7 -r 550786d7d352 xen/arch/ia64/xen/domain.c
--- a/xen/arch/ia64/xen/domain.c        Mon Jul 03 07:42:17 2006 -0600
+++ b/xen/arch/ia64/xen/domain.c        Mon Jul 03 08:12:16 2006 -0600
@@ -59,6 +59,7 @@
 #include <asm/tlbflush.h>
 #include <asm/regionreg.h>
 #include <asm/dom_fw.h>
+#include <asm/privop_stat.h>
 
 #ifndef CONFIG_XEN_IA64_DOM0_VP
 #define CONFIG_DOMAIN0_CONTIGUOUS
@@ -82,8 +83,6 @@ void build_physmap_table(struct domain *
 void build_physmap_table(struct domain *d);
 
 /* this belongs in include/asm, but there doesn't seem to be a suitable place 
*/
-unsigned long context_switch_count = 0;
-
 extern struct vcpu *ia64_switch_to (struct vcpu *next_task);
 
 /* Address of vpsr.i (in fact evtchn_upcall_mask) of current vcpu.
diff -r 75b23b6a7cb7 -r 550786d7d352 xen/arch/ia64/xen/faults.c
--- a/xen/arch/ia64/xen/faults.c        Mon Jul 03 07:42:17 2006 -0600
+++ b/xen/arch/ia64/xen/faults.c        Mon Jul 03 08:12:16 2006 -0600
@@ -26,6 +26,8 @@
 #include <asm/vhpt.h>
 #include <asm/debugger.h>
 #include <asm/fpswa.h>
+#include <asm/bundle.h>
+#include <asm/privop_stat.h>
 #include <asm/asm-xsi-offsets.h>
 
 extern void die_if_kernel(char *str, struct pt_regs *regs, long err);
@@ -49,41 +51,7 @@ extern IA64FAULT ia64_hypercall(struct p
 
 extern void do_ssc(unsigned long ssc, struct pt_regs *regs);
 
-unsigned long slow_reflect_count[0x80] = { 0 };
-unsigned long fast_reflect_count[0x80] = { 0 };
-
 #define inc_slow_reflect_count(vec) slow_reflect_count[vec>>8]++;
-
-void zero_reflect_counts(void)
-{
-       int i;
-       for (i=0; i<0x80; i++) slow_reflect_count[i] = 0;
-       for (i=0; i<0x80; i++) fast_reflect_count[i] = 0;
-}
-
-int dump_reflect_counts(char *buf)
-{
-       int i,j,cnt;
-       char *s = buf;
-
-       s += sprintf(s,"Slow reflections by vector:\n");
-       for (i = 0, j = 0; i < 0x80; i++) {
-               if ( (cnt = slow_reflect_count[i]) != 0 ) {
-                       s += sprintf(s,"0x%02x00:%10d, ",i,cnt);
-                       if ((j++ & 3) == 3) s += sprintf(s,"\n");
-               }
-       }
-       if (j & 3) s += sprintf(s,"\n");
-       s += sprintf(s,"Fast reflections by vector:\n");
-       for (i = 0, j = 0; i < 0x80; i++) {
-               if ( (cnt = fast_reflect_count[i]) != 0 ) {
-                       s += sprintf(s,"0x%02x00:%10d, ",i,cnt);
-                       if ((j++ & 3) == 3) s += sprintf(s,"\n");
-               }
-       }
-       if (j & 3) s += sprintf(s,"\n");
-       return s - buf;
-}
 
 // should never panic domain... if it does, stack may have been overrun
 void check_bad_nested_interruption(unsigned long isr, struct pt_regs *regs, 
unsigned long vector)
@@ -194,7 +162,6 @@ void deliver_pending_interrupt(struct pt
                        ++pending_false_positive;
        }
 }
-unsigned long lazy_cover_count = 0;
 
 static int
 handle_lazy_cover(struct vcpu *v, struct pt_regs *regs)
diff -r 75b23b6a7cb7 -r 550786d7d352 xen/arch/ia64/xen/hypercall.c
--- a/xen/arch/ia64/xen/hypercall.c     Mon Jul 03 07:42:17 2006 -0600
+++ b/xen/arch/ia64/xen/hypercall.c     Mon Jul 03 08:12:16 2006 -0600
@@ -28,16 +28,11 @@
 #include <xen/domain.h>
 #include <public/callback.h>
 #include <xen/event.h>
+#include <asm/privop_stat.h>
 
 static long do_physdev_op_compat(XEN_GUEST_HANDLE(physdev_op_t) uop);
 static long do_physdev_op(int cmd, XEN_GUEST_HANDLE(void) arg);
 static long do_callback_op(int cmd, XEN_GUEST_HANDLE(void) arg);
-/* FIXME: where these declarations should be there ? */
-extern int dump_privop_counts_to_user(char *, int);
-extern int zero_privop_counts_to_user(char *, int);
-
-unsigned long idle_when_pending = 0;
-unsigned long pal_halt_light_count = 0;
 
 hypercall_t ia64_hypercall_table[] =
        {
diff -r 75b23b6a7cb7 -r 550786d7d352 xen/arch/ia64/xen/ivt.S
--- a/xen/arch/ia64/xen/ivt.S   Mon Jul 03 07:42:17 2006 -0600
+++ b/xen/arch/ia64/xen/ivt.S   Mon Jul 03 08:12:16 2006 -0600
@@ -14,7 +14,6 @@
 #define ia64_trace_syscall 0
 #define sys_call_table 0
 #define sys_ni_syscall 0
-#include <asm/vhpt.h>
 #include <asm/debugger.h>
 #endif
 /*
diff -r 75b23b6a7cb7 -r 550786d7d352 xen/arch/ia64/xen/privop.c
--- a/xen/arch/ia64/xen/privop.c        Mon Jul 03 07:42:17 2006 -0600
+++ b/xen/arch/ia64/xen/privop.c        Mon Jul 03 08:12:16 2006 -0600
@@ -12,12 +12,11 @@
 #include <asm/delay.h> // Debug only
 #include <asm/dom_fw.h>
 #include <asm/vhpt.h>
-
-/* FIXME: where these declarations should be there ? */
-extern int dump_reflect_counts(char *);
-extern void zero_reflect_counts(void);
+#include <asm/bundle.h>
+#include <asm/privop_stat.h>
 
 long priv_verbose=0;
+unsigned long privop_trace = 0;
 
 /* Set to 1 to handle privified instructions from the privify tool. */
 #ifndef CONFIG_PRIVIFY
@@ -25,84 +24,6 @@ static const int privify_en = 0;
 #else
 static const int privify_en = 1;
 #endif
-
-/**************************************************************************
-Hypercall bundle creation
-**************************************************************************/
-
-void build_hypercall_bundle(UINT64 *imva, UINT64 brkimm, UINT64 hypnum, UINT64 
ret)
-{
-       INST64_A5 slot0;
-       INST64_I19 slot1;
-       INST64_B4 slot2;
-       IA64_BUNDLE bundle;
-
-       // slot1: mov r2 = hypnum (low 20 bits)
-       slot0.inst = 0;
-       slot0.qp = 0; slot0.r1 = 2; slot0.r3 = 0; slot0.major = 0x9;
-       slot0.imm7b = hypnum; slot0.imm9d = hypnum >> 7;
-       slot0.imm5c = hypnum >> 16; slot0.s = 0;
-       // slot1: break brkimm
-       slot1.inst = 0;
-       slot1.qp = 0; slot1.x6 = 0; slot1.x3 = 0; slot1.major = 0x0;
-       slot1.imm20 = brkimm; slot1.i = brkimm >> 20;
-       // if ret slot2: br.ret.sptk.many rp
-       // else slot2: br.cond.sptk.many rp
-       slot2.inst = 0; slot2.qp = 0; slot2.p = 1; slot2.b2 = 0;
-       slot2.wh = 0; slot2.d = 0; slot2.major = 0x0;
-       if (ret) {
-               slot2.btype = 4; slot2.x6 = 0x21;
-       }
-       else {
-               slot2.btype = 0; slot2.x6 = 0x20;
-       }
-       
-       bundle.i64[0] = 0; bundle.i64[1] = 0;
-       bundle.template = 0x11;
-       bundle.slot0 = slot0.inst; bundle.slot2 = slot2.inst;
-       bundle.slot1a = slot1.inst; bundle.slot1b = slot1.inst >> 18;
-       
-       imva[0] = bundle.i64[0]; imva[1] = bundle.i64[1];
-       ia64_fc (imva);
-       ia64_fc (imva + 1);
-}
-
-void build_pal_hypercall_bundles(UINT64 *imva, UINT64 brkimm, UINT64 hypnum)
-{
-       extern unsigned long pal_call_stub[];
-       IA64_BUNDLE bundle;
-       INST64_A5 slot_a5;
-       INST64_M37 slot_m37;
-
-       /* The source of the hypercall stub is the pal_call_stub function
-          defined in xenasm.S.  */
-
-       /* Copy the first bundle and patch the hypercall number.  */
-       bundle.i64[0] = pal_call_stub[0];
-       bundle.i64[1] = pal_call_stub[1];
-       slot_a5.inst = bundle.slot0;
-       slot_a5.imm7b = hypnum;
-       slot_a5.imm9d = hypnum >> 7;
-       slot_a5.imm5c = hypnum >> 16;
-       bundle.slot0 = slot_a5.inst;
-       imva[0] = bundle.i64[0];
-       imva[1] = bundle.i64[1];
-       ia64_fc (imva);
-       ia64_fc (imva + 1);
-       
-       /* Copy the second bundle and patch the hypercall vector.  */
-       bundle.i64[0] = pal_call_stub[2];
-       bundle.i64[1] = pal_call_stub[3];
-       slot_m37.inst = bundle.slot0;
-       slot_m37.imm20a = brkimm;
-       slot_m37.i = brkimm >> 20;
-       bundle.slot0 = slot_m37.inst;
-       imva[2] = bundle.i64[0];
-       imva[3] = bundle.i64[1];
-       ia64_fc (imva + 2);
-       ia64_fc (imva + 3);
-}
-
 
 /**************************************************************************
 Privileged operation emulation routines
@@ -351,12 +272,10 @@ static IA64FAULT priv_mov_to_pmd(VCPU *v
        return (vcpu_set_pmd(vcpu,r3,r2));
 }
 
-unsigned long to_cr_cnt[128] = { 0 };
-
 static IA64FAULT priv_mov_to_cr(VCPU *vcpu, INST64 inst)
 {
        UINT64 val = vcpu_get_gr(vcpu, inst.M32.r2);
-       to_cr_cnt[inst.M32.cr3]++;
+       privcnt.to_cr_cnt[inst.M32.cr3]++;
        switch (inst.M32.cr3) {
            case 0: return vcpu_set_dcr(vcpu,val);
            case 1: return vcpu_set_itm(vcpu,val);
@@ -488,8 +407,6 @@ static IA64FAULT priv_mov_from_pmc(VCPU 
        return fault;
 }
 
-unsigned long from_cr_cnt[128] = { 0 };
-
 #define cr_get(cr) \
        ((fault = vcpu_get_##cr(vcpu,&val)) == IA64_NO_FAULT) ? \
                vcpu_set_gr(vcpu, tgt, val, 0) : fault;
@@ -500,7 +417,7 @@ static IA64FAULT priv_mov_from_cr(VCPU *
        UINT64 val;
        IA64FAULT fault;
 
-       from_cr_cnt[inst.M33.cr3]++;
+       privcnt.from_cr_cnt[inst.M33.cr3]++;
        switch (inst.M33.cr3) {
            case 0: return cr_get(dcr);
            case 1: return cr_get(itm);
@@ -586,23 +503,6 @@ static const PPEFCN Mpriv_funcs[64] = {
   0, 0, 0, 0, 0, 0, 0, 0
 };
 
-struct {
-       unsigned long mov_to_ar_imm;
-       unsigned long mov_to_ar_reg;
-       unsigned long mov_from_ar;
-       unsigned long ssm;
-       unsigned long rsm;
-       unsigned long rfi;
-       unsigned long bsw0;
-       unsigned long bsw1;
-       unsigned long cover;
-       unsigned long fc;
-       unsigned long cpuid;
-       unsigned long Mpriv_cnt[64];
-} privcnt = { 0 };
-
-unsigned long privop_trace = 0;
-
 static IA64FAULT
 priv_handle_op(VCPU *vcpu, REGS *regs, int privlvl)
 {
@@ -791,15 +691,6 @@ priv_emulate(VCPU *vcpu, REGS *regs, UIN
        return fault;
 }
 
-static const char * const hyperpriv_str[HYPERPRIVOP_MAX+1] = {
-       0, "rfi", "rsm.dt", "ssm.dt", "cover", "itc.d", "itc.i", "ssm.i",
-       "=ivr", "=tpr", "tpr=", "eoi", "itm=", "thash", "ptc.ga", "itr.d",
-       "=rr", "rr=", "kr=", "fc", "=cpuid", "=pmd", "=ar.eflg", "ar.eflg="
-};
-
-unsigned long slow_hyperpriv_cnt[HYPERPRIVOP_MAX+1] = { 0 };
-unsigned long fast_hyperpriv_cnt[HYPERPRIVOP_MAX+1] = { 0 };
-
 /* hyperprivops are generally executed in assembly (with physical psr.ic off)
  * so this code is primarily used for debugging them */
 int
@@ -811,8 +702,8 @@ ia64_hyperprivop(unsigned long iim, REGS
 
 // FIXME: Handle faults appropriately for these
        if (!iim || iim > HYPERPRIVOP_MAX) {
-               printf("bad hyperprivop; ignored\n");
-               printf("iim=%lx, iip=0x%lx\n", iim, regs->cr_iip);
+               panic_domain(regs, "bad hyperprivop ignored; iim=%lx, "
+                            "iip=0x%lx\n", iim, regs->cr_iip);
                return 1;
        }
        slow_hyperpriv_cnt[iim]++;
@@ -904,288 +795,3 @@ ia64_hyperprivop(unsigned long iim, REGS
 }
 
 
-/**************************************************************************
-Privileged operation instrumentation routines
-**************************************************************************/
-
-static const char * const Mpriv_str[64] = {
-  "mov_to_rr", "mov_to_dbr", "mov_to_ibr", "mov_to_pkr",
-  "mov_to_pmc", "mov_to_pmd", "<0x06>", "<0x07>",
-  "<0x08>", "ptc_l", "ptc_g", "ptc_ga",
-  "ptr_d", "ptr_i", "itr_d", "itr_i",
-  "mov_from_rr", "mov_from_dbr", "mov_from_ibr", "mov_from_pkr",
-  "mov_from_pmc", "<0x15>", "<0x16>", "<0x17>",
-  "<0x18>", "<0x19>", "privified-thash", "privified-ttag",
-  "<0x1c>", "<0x1d>", "tpa", "tak",
-  "<0x20>", "<0x21>", "<0x22>", "<0x23>",
-  "mov_from_cr", "mov_from_psr", "<0x26>", "<0x27>",
-  "<0x28>", "<0x29>", "<0x2a>", "<0x2b>",
-  "mov_to_cr", "mov_to_psr", "itc_d", "itc_i",
-  "<0x30>", "<0x31>", "<0x32>", "<0x33>",
-  "ptc_e", "<0x35>", "<0x36>", "<0x37>",
-  "<0x38>", "<0x39>", "<0x3a>", "<0x3b>",
-  "<0x3c>", "<0x3d>", "<0x3e>", "<0x3f>"
-};
-
-#define RS "Rsvd"
-static const char * const cr_str[128] = {
-  "dcr","itm","iva",RS,RS,RS,RS,RS,
-  "pta",RS,RS,RS,RS,RS,RS,RS,
-  "ipsr","isr",RS,"iip","ifa","itir","iipa","ifs",
-  "iim","iha",RS,RS,RS,RS,RS,RS,
-  RS,RS,RS,RS,RS,RS,RS,RS, RS,RS,RS,RS,RS,RS,RS,RS,
-  RS,RS,RS,RS,RS,RS,RS,RS, RS,RS,RS,RS,RS,RS,RS,RS,
-  "lid","ivr","tpr","eoi","irr0","irr1","irr2","irr3",
-  "itv","pmv","cmcv",RS,RS,RS,RS,RS,
-  "lrr0","lrr1",RS,RS,RS,RS,RS,RS,
-  RS,RS,RS,RS,RS,RS,RS,RS, RS,RS,RS,RS,RS,RS,RS,RS,
-  RS,RS,RS,RS,RS,RS,RS,RS, RS,RS,RS,RS,RS,RS,RS,RS,
-  RS,RS,RS,RS,RS,RS,RS,RS
-};
-
-// FIXME: should use snprintf to ensure no buffer overflow
-static int dump_privop_counts(char *buf)
-{
-       int i, j;
-       UINT64 sum = 0;
-       char *s = buf;
-
-       // this is ugly and should probably produce sorted output
-       // but it will have to do for now
-       sum += privcnt.mov_to_ar_imm; sum += privcnt.mov_to_ar_reg;
-       sum += privcnt.ssm; sum += privcnt.rsm;
-       sum += privcnt.rfi; sum += privcnt.bsw0;
-       sum += privcnt.bsw1; sum += privcnt.cover;
-       for (i=0; i < 64; i++) sum += privcnt.Mpriv_cnt[i];
-       s += sprintf(s,"Privop statistics: (Total privops: %ld)\n",sum);
-       if (privcnt.mov_to_ar_imm)
-               s += sprintf(s,"%10ld  %s [%ld%%]\n", privcnt.mov_to_ar_imm,
-                       "mov_to_ar_imm", (privcnt.mov_to_ar_imm*100L)/sum);
-       if (privcnt.mov_to_ar_reg)
-               s += sprintf(s,"%10ld  %s [%ld%%]\n", privcnt.mov_to_ar_reg,
-                       "mov_to_ar_reg", (privcnt.mov_to_ar_reg*100L)/sum);
-       if (privcnt.mov_from_ar)
-               s += sprintf(s,"%10ld  %s [%ld%%]\n", privcnt.mov_from_ar,
-                       "privified-mov_from_ar", 
(privcnt.mov_from_ar*100L)/sum);
-       if (privcnt.ssm)
-               s += sprintf(s,"%10ld  %s [%ld%%]\n", privcnt.ssm,
-                       "ssm", (privcnt.ssm*100L)/sum);
-       if (privcnt.rsm)
-               s += sprintf(s,"%10ld  %s [%ld%%]\n", privcnt.rsm,
-                       "rsm", (privcnt.rsm*100L)/sum);
-       if (privcnt.rfi)
-               s += sprintf(s,"%10ld  %s [%ld%%]\n", privcnt.rfi,
-                       "rfi", (privcnt.rfi*100L)/sum);
-       if (privcnt.bsw0)
-               s += sprintf(s,"%10ld  %s [%ld%%]\n", privcnt.bsw0,
-                       "bsw0", (privcnt.bsw0*100L)/sum);
-       if (privcnt.bsw1)
-               s += sprintf(s,"%10ld  %s [%ld%%]\n", privcnt.bsw1,
-                       "bsw1", (privcnt.bsw1*100L)/sum);
-       if (privcnt.cover)
-               s += sprintf(s,"%10ld  %s [%ld%%]\n", privcnt.cover,
-                       "cover", (privcnt.cover*100L)/sum);
-       if (privcnt.fc)
-               s += sprintf(s,"%10ld  %s [%ld%%]\n", privcnt.fc,
-                       "privified-fc", (privcnt.fc*100L)/sum);
-       if (privcnt.cpuid)
-               s += sprintf(s,"%10ld  %s [%ld%%]\n", privcnt.cpuid,
-                       "privified-getcpuid", (privcnt.cpuid*100L)/sum);
-       for (i=0; i < 64; i++) if (privcnt.Mpriv_cnt[i]) {
-               if (!Mpriv_str[i]) s += sprintf(s,"PRIVSTRING NULL!!\n");
-               else s += sprintf(s,"%10ld  %s [%ld%%]\n", privcnt.Mpriv_cnt[i],
-                       Mpriv_str[i], (privcnt.Mpriv_cnt[i]*100L)/sum);
-               if (i == 0x24) { // mov from CR
-                       s += sprintf(s,"            [");
-                       for (j=0; j < 128; j++) if (from_cr_cnt[j]) {
-                               if (!cr_str[j])
-                                       s += sprintf(s,"PRIVSTRING NULL!!\n");
-                               s += 
sprintf(s,"%s(%ld),",cr_str[j],from_cr_cnt[j]);
-                       }
-                       s += sprintf(s,"]\n");
-               }
-               else if (i == 0x2c) { // mov to CR
-                       s += sprintf(s,"            [");
-                       for (j=0; j < 128; j++) if (to_cr_cnt[j]) {
-                               if (!cr_str[j])
-                                       s += sprintf(s,"PRIVSTRING NULL!!\n");
-                               s += 
sprintf(s,"%s(%ld),",cr_str[j],to_cr_cnt[j]);
-                       }
-                       s += sprintf(s,"]\n");
-               }
-       }
-       return s - buf;
-}
-
-static int zero_privop_counts(char *buf)
-{
-       int i, j;
-       char *s = buf;
-
-       // this is ugly and should probably produce sorted output
-       // but it will have to do for now
-       privcnt.mov_to_ar_imm = 0; privcnt.mov_to_ar_reg = 0;
-       privcnt.mov_from_ar = 0;
-       privcnt.ssm = 0; privcnt.rsm = 0;
-       privcnt.rfi = 0; privcnt.bsw0 = 0;
-       privcnt.bsw1 = 0; privcnt.cover = 0;
-       privcnt.fc = 0; privcnt.cpuid = 0;
-       for (i=0; i < 64; i++) privcnt.Mpriv_cnt[i] = 0;
-       for (j=0; j < 128; j++) from_cr_cnt[j] = 0;
-       for (j=0; j < 128; j++) to_cr_cnt[j] = 0;
-       s += sprintf(s,"All privop statistics zeroed\n");
-       return s - buf;
-}
-
-#ifdef PRIVOP_ADDR_COUNT
-
-extern struct privop_addr_count privop_addr_counter[];
-
-void privop_count_addr(unsigned long iip, int inst)
-{
-       struct privop_addr_count *v = &privop_addr_counter[inst];
-       int i;
-
-       for (i = 0; i < PRIVOP_COUNT_NADDRS; i++) {
-               if (!v->addr[i]) { v->addr[i] = iip; v->count[i]++; return; }
-               else if (v->addr[i] == iip)  { v->count[i]++; return; }
-       }
-       v->overflow++;;
-}
-
-static int dump_privop_addrs(char *buf)
-{
-       int i,j;
-       char *s = buf;
-       s += sprintf(s,"Privop addresses:\n");
-       for (i = 0; i < PRIVOP_COUNT_NINSTS; i++) {
-               struct privop_addr_count *v = &privop_addr_counter[i];
-               s += sprintf(s,"%s:\n",v->instname);
-               for (j = 0; j < PRIVOP_COUNT_NADDRS; j++) {
-                       if (!v->addr[j]) break;
-                       s += sprintf(s," at 0x%lx 
#%ld\n",v->addr[j],v->count[j]);
-               }
-               if (v->overflow) 
-                       s += sprintf(s," other #%ld\n",v->overflow);
-       }
-       return s - buf;
-}
-
-static void zero_privop_addrs(void)
-{
-       int i,j;
-       for (i = 0; i < PRIVOP_COUNT_NINSTS; i++) {
-               struct privop_addr_count *v = &privop_addr_counter[i];
-               for (j = 0; j < PRIVOP_COUNT_NADDRS; j++)
-                       v->addr[j] = v->count[j] = 0;
-               v->overflow = 0;
-       }
-}
-#endif
-
-extern unsigned long dtlb_translate_count;
-extern unsigned long tr_translate_count;
-extern unsigned long phys_translate_count;
-extern unsigned long vhpt_translate_count;
-extern unsigned long fast_vhpt_translate_count;
-extern unsigned long recover_to_page_fault_count;
-extern unsigned long recover_to_break_fault_count;
-extern unsigned long lazy_cover_count;
-extern unsigned long idle_when_pending;
-extern unsigned long pal_halt_light_count;
-extern unsigned long context_switch_count;
-
-static int dump_misc_stats(char *buf)
-{
-       char *s = buf;
-       s += sprintf(s,"Virtual TR translations: %ld\n",tr_translate_count);
-       s += sprintf(s,"Virtual VHPT slow translations: 
%ld\n",vhpt_translate_count);
-       s += sprintf(s,"Virtual VHPT fast translations: 
%ld\n",fast_vhpt_translate_count);
-       s += sprintf(s,"Virtual DTLB translations: %ld\n",dtlb_translate_count);
-       s += sprintf(s,"Physical translations: %ld\n",phys_translate_count);
-       s += sprintf(s,"Recoveries to page fault: 
%ld\n",recover_to_page_fault_count);
-       s += sprintf(s,"Recoveries to break fault: 
%ld\n",recover_to_break_fault_count);
-       s += sprintf(s,"Idle when pending: %ld\n",idle_when_pending);
-       s += sprintf(s,"PAL_HALT_LIGHT (no pending): 
%ld\n",pal_halt_light_count);
-       s += sprintf(s,"context switches: %ld\n",context_switch_count);
-       s += sprintf(s,"Lazy covers: %ld\n",lazy_cover_count);
-       return s - buf;
-}
-
-static void zero_misc_stats(void)
-{
-       dtlb_translate_count = 0;
-       tr_translate_count = 0;
-       phys_translate_count = 0;
-       vhpt_translate_count = 0;
-       fast_vhpt_translate_count = 0;
-       recover_to_page_fault_count = 0;
-       recover_to_break_fault_count = 0;
-       lazy_cover_count = 0;
-       pal_halt_light_count = 0;
-       idle_when_pending = 0;
-       context_switch_count = 0;
-}
-
-static int dump_hyperprivop_counts(char *buf)
-{
-       int i;
-       char *s = buf;
-       unsigned long total = 0;
-       for (i = 1; i <= HYPERPRIVOP_MAX; i++) total += slow_hyperpriv_cnt[i];
-       s += sprintf(s,"Slow hyperprivops (total %ld):\n",total);
-       for (i = 1; i <= HYPERPRIVOP_MAX; i++)
-               if (slow_hyperpriv_cnt[i])
-                       s += sprintf(s,"%10ld %s\n",
-                               slow_hyperpriv_cnt[i], hyperpriv_str[i]);
-       total = 0;
-       for (i = 1; i <= HYPERPRIVOP_MAX; i++) total += fast_hyperpriv_cnt[i];
-       s += sprintf(s,"Fast hyperprivops (total %ld):\n",total);
-       for (i = 1; i <= HYPERPRIVOP_MAX; i++)
-               if (fast_hyperpriv_cnt[i])
-                       s += sprintf(s,"%10ld %s\n",
-                               fast_hyperpriv_cnt[i], hyperpriv_str[i]);
-       return s - buf;
-}
-
-static void zero_hyperprivop_counts(void)
-{
-       int i;
-       for (i = 0; i <= HYPERPRIVOP_MAX; i++) slow_hyperpriv_cnt[i] = 0;
-       for (i = 0; i <= HYPERPRIVOP_MAX; i++) fast_hyperpriv_cnt[i] = 0;
-}
-
-#define TMPBUFLEN 8*1024
-int dump_privop_counts_to_user(char __user *ubuf, int len)
-{
-       char buf[TMPBUFLEN];
-       int n = dump_privop_counts(buf);
-
-       n += dump_hyperprivop_counts(buf + n);
-       n += dump_reflect_counts(buf + n);
-#ifdef PRIVOP_ADDR_COUNT
-       n += dump_privop_addrs(buf + n);
-#endif
-       n += dump_vhpt_stats(buf + n);
-       n += dump_misc_stats(buf + n);
-       if (len < TMPBUFLEN) return -1;
-       if (__copy_to_user(ubuf,buf,n)) return -1;
-       return n;
-}
-
-int zero_privop_counts_to_user(char __user *ubuf, int len)
-{
-       char buf[TMPBUFLEN];
-       int n = zero_privop_counts(buf);
-
-       zero_hyperprivop_counts();
-#ifdef PRIVOP_ADDR_COUNT
-       zero_privop_addrs();
-#endif
-       zero_vhpt_stats();
-       zero_misc_stats();
-       zero_reflect_counts();
-       if (len < TMPBUFLEN) return -1;
-       if (__copy_to_user(ubuf,buf,n)) return -1;
-       return n;
-}
diff -r 75b23b6a7cb7 -r 550786d7d352 xen/arch/ia64/xen/vcpu.c
--- a/xen/arch/ia64/xen/vcpu.c  Mon Jul 03 07:42:17 2006 -0600
+++ b/xen/arch/ia64/xen/vcpu.c  Mon Jul 03 08:12:16 2006 -0600
@@ -20,6 +20,8 @@
 #include <asm/privop.h>
 #include <xen/event.h>
 #include <asm/vmx_phy_mode.h>
+#include <asm/bundle.h>
+#include <asm/privop_stat.h>
 
 /* FIXME: where these declarations should be there ? */
 extern void getreg(unsigned long regnum, unsigned long *val, int *nat, struct 
pt_regs *regs);
@@ -46,24 +48,6 @@ typedef      union {
 #define        IA64_PTA_BASE_BIT       15
 #define        IA64_PTA_LFMT           (1UL << IA64_PTA_VF_BIT)
 #define        IA64_PTA_SZ(x)  (x##UL << IA64_PTA_SZ_BIT)
-
-#define STATIC
-
-#ifdef PRIVOP_ADDR_COUNT
-struct privop_addr_count privop_addr_counter[PRIVOP_COUNT_NINSTS+1] = {
-       { "=ifa",  { 0 }, { 0 }, 0 },
-       { "thash", { 0 }, { 0 }, 0 },
-       { 0,       { 0 }, { 0 }, 0 }
-};
-extern void privop_count_addr(unsigned long addr, int inst);
-#define        PRIVOP_COUNT_ADDR(regs,inst) 
privop_count_addr(regs->cr_iip,inst)
-#else
-#define        PRIVOP_COUNT_ADDR(x,y) do {} while (0)
-#endif
-
-unsigned long dtlb_translate_count = 0;
-unsigned long tr_translate_count = 0;
-unsigned long phys_translate_count = 0;
 
 unsigned long vcpu_verbose = 0;
 
@@ -446,8 +430,6 @@ UINT64 vcpu_get_ipsr_int_state(VCPU *vcp
 
 IA64FAULT vcpu_get_dcr(VCPU *vcpu, UINT64 *pval)
 {
-//extern unsigned long privop_trace;
-//privop_trace=0;
 //verbose("vcpu_get_dcr: called @%p\n",PSCB(vcpu,iip));
        // Reads of cr.dcr on Xen always have the sign bit set, so
        // a domain can differentiate whether it is running on SP or not
@@ -495,10 +477,8 @@ IA64FAULT vcpu_get_iip(VCPU *vcpu, UINT6
 
 IA64FAULT vcpu_get_ifa(VCPU *vcpu, UINT64 *pval)
 {
-       UINT64 val = PSCB(vcpu,ifa);
-       REGS *regs = vcpu_regs(vcpu);
-       PRIVOP_COUNT_ADDR(regs,_GET_IFA);
-       *pval = val;
+       PRIVOP_COUNT_ADDR(vcpu_regs(vcpu),_GET_IFA);
+       *pval = PSCB(vcpu,ifa);
        return (IA64_NO_FAULT);
 }
 
@@ -564,18 +544,13 @@ IA64FAULT vcpu_get_iim(VCPU *vcpu, UINT6
 
 IA64FAULT vcpu_get_iha(VCPU *vcpu, UINT64 *pval)
 {
-       //return vcpu_thash(vcpu,PSCB(vcpu,ifa),pval);
-       UINT64 val = PSCB(vcpu,iha);
-       REGS *regs = vcpu_regs(vcpu);
-       PRIVOP_COUNT_ADDR(regs,_THASH);
-       *pval = val;
+       PRIVOP_COUNT_ADDR(vcpu_regs(vcpu),_THASH);
+       *pval = PSCB(vcpu,iha);
        return (IA64_NO_FAULT);
 }
 
 IA64FAULT vcpu_set_dcr(VCPU *vcpu, UINT64 val)
 {
-//extern unsigned long privop_trace;
-//privop_trace=1;
        // Reads of cr.dcr on SP always have the sign bit set, so
        // a domain can differentiate whether it is running on SP or not
        // Thus, writes of DCR should ignore the sign bit
@@ -1331,11 +1306,6 @@ IA64FAULT vcpu_ttag(VCPU *vcpu, UINT64 v
        printf("vcpu_ttag: ttag instruction unsupported\n");
        return (IA64_ILLOP_FAULT);
 }
-
-unsigned long vhpt_translate_count = 0;
-unsigned long fast_vhpt_translate_count = 0;
-unsigned long recover_to_page_fault_count = 0;
-unsigned long recover_to_break_fault_count = 0;
 
 int warn_region0_address = 0; // FIXME later: tie to a boot parameter?
 
diff -r 75b23b6a7cb7 -r 550786d7d352 xen/include/asm-ia64/dom_fw.h
--- a/xen/include/asm-ia64/dom_fw.h     Mon Jul 03 07:42:17 2006 -0600
+++ b/xen/include/asm-ia64/dom_fw.h     Mon Jul 03 08:12:16 2006 -0600
@@ -166,8 +166,6 @@ extern struct ia64_pal_retval xen_pal_em
 extern struct ia64_pal_retval xen_pal_emulator(UINT64, u64, u64, u64);
 extern struct sal_ret_values sal_emulator (long index, unsigned long in1, 
unsigned long in2, unsigned long in3, unsigned long in4, unsigned long in5, 
unsigned long in6, unsigned long in7);
 extern struct ia64_pal_retval pal_emulator_static (unsigned long);
-extern unsigned long dom_fw_setup (struct domain *, const char *, int);
 extern efi_status_t efi_emulator (struct pt_regs *regs, unsigned long *fault);
 
-extern void build_pal_hypercall_bundles(unsigned long *imva, unsigned long 
brkimm, unsigned long hypnum);
-extern void build_hypercall_bundle(UINT64 *imva, UINT64 brkimm, UINT64 hypnum, 
UINT64 ret);
+extern unsigned long dom_fw_setup (struct domain *, const char *, int);
diff -r 75b23b6a7cb7 -r 550786d7d352 xen/include/asm-ia64/privop.h
--- a/xen/include/asm-ia64/privop.h     Mon Jul 03 07:42:17 2006 -0600
+++ b/xen/include/asm-ia64/privop.h     Mon Jul 03 08:12:16 2006 -0600
@@ -2,234 +2,9 @@
 #define _XEN_IA64_PRIVOP_H
 
 #include <asm/ia64_int.h>
-#include <asm/vmx_vcpu.h>
 #include <asm/vcpu.h>
 
-typedef unsigned long IA64_INST;
-
 extern IA64FAULT priv_emulate(VCPU *vcpu, REGS *regs, UINT64 isr);
-
-typedef union U_IA64_BUNDLE {
-    unsigned long i64[2];
-    struct { unsigned long template:5,slot0:41,slot1a:18,slot1b:23,slot2:41; };
-    // NOTE: following doesn't work because bitfields can't cross natural
-    // size boundaries
-    //struct { unsigned long template:5, slot0:41, slot1:41, slot2:41; };
-} IA64_BUNDLE;
-
-typedef enum E_IA64_SLOT_TYPE { I, M, F, B, L, ILLEGAL } IA64_SLOT_TYPE;
-
-typedef union U_INST64_A5 {
-    IA64_INST inst;
-    struct { unsigned long qp:6, r1:7, imm7b:7, r3:2, imm5c:5, imm9d:9, s:1, 
major:4; };
-} INST64_A5;
-
-typedef union U_INST64_B4 {
-    IA64_INST inst;
-    struct { unsigned long qp:6, btype:3, un3:3, p:1, b2:3, un11:11, x6:6, 
wh:2, d:1, un1:1, major:4; };
-} INST64_B4;
-
-typedef union U_INST64_B8 {
-    IA64_INST inst;
-    struct { unsigned long qp:6, un21:21, x6:6, un4:4, major:4; };
-} INST64_B8;
-
-typedef union U_INST64_B9 {
-    IA64_INST inst;
-    struct { unsigned long qp:6, imm20:20, :1, x6:6, :3, i:1, major:4; };
-} INST64_B9;
-
-typedef union U_INST64_I19 {
-    IA64_INST inst;
-    struct { unsigned long qp:6, imm20:20, :1, x6:6, x3:3, i:1, major:4; };
-} INST64_I19;
-
-typedef union U_INST64_I26 {
-    IA64_INST inst;
-    struct { unsigned long qp:6, :7, r2:7, ar3:7, x6:6, x3:3, :1, major:4;};
-} INST64_I26;
-
-typedef union U_INST64_I27 {
-    IA64_INST inst;
-    struct { unsigned long qp:6, :7, imm:7, ar3:7, x6:6, x3:3, s:1, major:4;};
-} INST64_I27;
-
-typedef union U_INST64_I28 { // not privileged (mov from AR)
-    IA64_INST inst;
-    struct { unsigned long qp:6, r1:7, :7, ar3:7, x6:6, x3:3, :1, major:4;};
-} INST64_I28;
-
-typedef union U_INST64_M28 {
-    IA64_INST inst;
-    struct { unsigned long qp:6, :14, r3:7, x6:6, x3:3, :1, major:4;};
-} INST64_M28;
-
-typedef union U_INST64_M29 {
-    IA64_INST inst;
-    struct { unsigned long qp:6, :7, r2:7, ar3:7, x6:6, x3:3, :1, major:4;};
-} INST64_M29;
-
-typedef union U_INST64_M30 {
-    IA64_INST inst;
-    struct { unsigned long qp:6, :7, imm:7, ar3:7,x4:4,x2:2,x3:3,s:1,major:4;};
-} INST64_M30;
-
-typedef union U_INST64_M31 {
-    IA64_INST inst;
-    struct { unsigned long qp:6, r1:7, :7, ar3:7, x6:6, x3:3, :1, major:4;};
-} INST64_M31;
-
-typedef union U_INST64_M32 {
-    IA64_INST inst;
-    struct { unsigned long qp:6, :7, r2:7, cr3:7, x6:6, x3:3, :1, major:4;};
-} INST64_M32;
-
-typedef union U_INST64_M33 {
-    IA64_INST inst;
-    struct { unsigned long qp:6, r1:7, :7, cr3:7, x6:6, x3:3, :1, major:4; };
-} INST64_M33;
-
-typedef union U_INST64_M35 {
-    IA64_INST inst;
-    struct { unsigned long qp:6, :7, r2:7, :7, x6:6, x3:3, :1, major:4; };
-   
-} INST64_M35;
-
-typedef union U_INST64_M36 {
-    IA64_INST inst;
-    struct { unsigned long qp:6, r1:7, :14, x6:6, x3:3, :1, major:4; }; 
-} INST64_M36;
-
-typedef union U_INST64_M37 {
-    IA64_INST inst;
-    struct { unsigned long qp:6, imm20a:20,:1, x4:4,x2:2,x3:3, i:1, major:4; };
-} INST64_M37;
-
-typedef union U_INST64_M41 {
-    IA64_INST inst;
-    struct { unsigned long qp:6, :7, r2:7, :7, x6:6, x3:3, :1, major:4; }; 
-} INST64_M41;
-
-typedef union U_INST64_M42 {
-    IA64_INST inst;
-    struct { unsigned long qp:6, :7, r2:7, r3:7, x6:6, x3:3, :1, major:4; };
-} INST64_M42;
-
-typedef union U_INST64_M43 {
-    IA64_INST inst;
-    struct { unsigned long qp:6, r1:7, :7, r3:7, x6:6, x3:3, :1, major:4; };
-} INST64_M43;
-
-typedef union U_INST64_M44 {
-    IA64_INST inst;
-    struct { unsigned long qp:6, imm:21, x4:4, i2:2, x3:3, i:1, major:4; };
-} INST64_M44;
-
-typedef union U_INST64_M45 {
-    IA64_INST inst;
-    struct { unsigned long qp:6, :7, r2:7, r3:7, x6:6, x3:3, :1, major:4; };
-} INST64_M45;
-
-typedef union U_INST64_M46 {
-    IA64_INST inst;
-    struct { unsigned long qp:6, r1:7, un7:7, r3:7, x6:6, x3:3, un1:1, 
major:4; };
-} INST64_M46;
-
-typedef union U_INST64_M47 {
-    IA64_INST inst;
-    struct { unsigned long qp:6, un14:14, r3:7, x6:6, x3:3, un1:1, major:4; };
-} INST64_M47;
-
-typedef union U_INST64_M1{
-    IA64_INST inst;
-    struct { unsigned long qp:6, r1:7, un7:7, r3:7, x:1, hint:2, x6:6, m:1, 
major:4; };
-} INST64_M1;
-
-typedef union U_INST64_M2{
-    IA64_INST inst;
-    struct { unsigned long qp:6, r1:7, r2:7, r3:7, x:1, hint:2, x6:6, m:1, 
major:4; };
-} INST64_M2;
-
-typedef union U_INST64_M3{
-    IA64_INST inst;
-    struct { unsigned long qp:6, r1:7, imm7:7, r3:7, i:1, hint:2, x6:6, s:1, 
major:4; };
-} INST64_M3;
-
-typedef union U_INST64_M4 {
-    IA64_INST inst;
-    struct { unsigned long qp:6, un7:7, r2:7, r3:7, x:1, hint:2, x6:6, m:1, 
major:4; };
-} INST64_M4;
-
-typedef union U_INST64_M5 {
-    IA64_INST inst;
-    struct { unsigned long qp:6, imm7:7, r2:7, r3:7, i:1, hint:2, x6:6, s:1, 
major:4; };
-} INST64_M5;
-
-typedef union U_INST64_M6 {
-    IA64_INST inst;
-    struct { unsigned long qp:6, f1:7, un7:7, r3:7, x:1, hint:2, x6:6, m:1, 
major:4; };
-} INST64_M6;
-
-typedef union U_INST64_M9 {
-    IA64_INST inst;
-    struct { unsigned long qp:6, :7, f2:7, r3:7, x:1, hint:2, x6:6, m:1, 
major:4; };
-} INST64_M9;
-
-typedef union U_INST64_M10 {
-    IA64_INST inst;
-    struct { unsigned long qp:6, imm7:7, f2:7, r3:7, i:1, hint:2, x6:6, s:1, 
major:4; };
-} INST64_M10;
-
-typedef union U_INST64_M12 {
-    IA64_INST inst;
-    struct { unsigned long qp:6, f1:7, f2:7, r3:7, x:1, hint:2, x6:6, m:1, 
major:4; };
-} INST64_M12;
-                        
-typedef union U_INST64_M15 {
-    IA64_INST inst;
-    struct { unsigned long qp:6, :7, imm7:7, r3:7, i:1, hint:2, x6:6, s:1, 
major:4; };
-} INST64_M15;
-
-typedef union U_INST64 {
-    IA64_INST inst;
-    struct { unsigned long :37, major:4; } generic;
-    INST64_A5 A5;      // used in build_hypercall_bundle only
-    INST64_B4 B4;      // used in build_hypercall_bundle only
-    INST64_B8 B8;      // rfi, bsw.[01]
-    INST64_B9 B9;      // break.b
-    INST64_I19 I19;    // used in build_hypercall_bundle only
-    INST64_I26 I26;    // mov register to ar (I unit)
-    INST64_I27 I27;    // mov immediate to ar (I unit)
-    INST64_I28 I28;    // mov from ar (I unit)
-    INST64_M1  M1;     // ld integer
-    INST64_M2  M2;
-    INST64_M3  M3;
-    INST64_M4  M4;     // st integer
-    INST64_M5  M5;
-    INST64_M6  M6;     // ldfd floating pointer
-    INST64_M9  M9;     // stfd floating pointer
-    INST64_M10 M10;    // stfd floating pointer
-    INST64_M12 M12;    // ldfd pair floating pointer
-    INST64_M15 M15;    // lfetch + imm update
-    INST64_M28 M28;    // purge translation cache entry
-    INST64_M29 M29;    // mov register to ar (M unit)
-    INST64_M30 M30;    // mov immediate to ar (M unit)
-    INST64_M31 M31;    // mov from ar (M unit)
-    INST64_M32 M32;    // mov reg to cr
-    INST64_M33 M33;    // mov from cr
-    INST64_M35 M35;    // mov to psr
-    INST64_M36 M36;    // mov from psr
-    INST64_M37 M37;    // break.m
-    INST64_M41 M41;    // translation cache insert
-    INST64_M42 M42;    // mov to indirect reg/translation reg insert
-    INST64_M43 M43;    // mov from indirect reg
-    INST64_M44 M44;    // set/reset system mask
-    INST64_M45 M45;    // translation purge
-    INST64_M46 M46;    // translation access (tpa,tak)
-    INST64_M47 M47;    // purge translation entry
-} INST64;
-
-#define MASK_41 ((UINT64)0x1ffffffffff)
 
 extern void privify_memory(void *start, UINT64 len);
 
diff -r 75b23b6a7cb7 -r 550786d7d352 xen/include/asm-ia64/vcpu.h
--- a/xen/include/asm-ia64/vcpu.h       Mon Jul 03 07:42:17 2006 -0600
+++ b/xen/include/asm-ia64/vcpu.h       Mon Jul 03 08:12:16 2006 -0600
@@ -4,7 +4,8 @@
 // TODO: Many (or perhaps most) of these should eventually be
 // static inline functions
 
-//#include "thread.h"
+#include <asm/fpu.h>
+#include <asm/tlb.h>
 #include <asm/ia64_int.h>
 #include <public/arch-ia64.h>
 typedef        unsigned long UINT64;
@@ -12,29 +13,13 @@ typedef     int BOOLEAN;
 typedef        int BOOLEAN;
 struct vcpu;
 typedef        struct vcpu VCPU;
-
 typedef cpu_user_regs_t REGS;
-
 
 /* Note: PSCB stands for Privilegied State Communication Block.  */
 #define VCPU(_v,_x)    (_v->arch.privregs->_x)
 #define PSCB(_v,_x) VCPU(_v,_x)
 #define PSCBX(_v,_x) (_v->arch._x)
 
-#define PRIVOP_ADDR_COUNT
-#ifdef PRIVOP_ADDR_COUNT
-#define _GET_IFA 0
-#define _THASH 1
-#define PRIVOP_COUNT_NINSTS 2
-#define PRIVOP_COUNT_NADDRS 30
-
-struct privop_addr_count {
-       char *instname;
-       unsigned long addr[PRIVOP_COUNT_NADDRS];
-       unsigned long count[PRIVOP_COUNT_NADDRS];
-       unsigned long overflow;
-};
-#endif
 
 /* general registers */
 extern UINT64 vcpu_get_gr(VCPU *vcpu, unsigned long reg);
diff -r 75b23b6a7cb7 -r 550786d7d352 xen/include/asm-ia64/vhpt.h
--- a/xen/include/asm-ia64/vhpt.h       Mon Jul 03 07:42:17 2006 -0600
+++ b/xen/include/asm-ia64/vhpt.h       Mon Jul 03 08:12:16 2006 -0600
@@ -21,6 +21,8 @@
 #define        VLE_CCHAIN_OFFSET               24
 
 #ifndef __ASSEMBLY__
+#include <xen/percpu.h>
+
 //
 // VHPT Long Format Entry (as recognized by hw)
 //
diff -r 75b23b6a7cb7 -r 550786d7d352 xen/arch/ia64/xen/privop_stat.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/arch/ia64/xen/privop_stat.c   Mon Jul 03 08:12:16 2006 -0600
@@ -0,0 +1,389 @@
+#include <asm/privop_stat.h>
+#include <asm/vhpt.h>
+#include <xen/lib.h>
+#include <asm/uaccess.h>
+
+unsigned long dtlb_translate_count = 0;
+unsigned long tr_translate_count = 0;
+unsigned long phys_translate_count = 0;
+unsigned long vhpt_translate_count = 0;
+unsigned long fast_vhpt_translate_count = 0;
+unsigned long recover_to_page_fault_count = 0;
+unsigned long recover_to_break_fault_count = 0;
+unsigned long idle_when_pending = 0;
+unsigned long pal_halt_light_count = 0;
+unsigned long context_switch_count = 0;
+unsigned long lazy_cover_count = 0;
+
+unsigned long slow_hyperpriv_cnt[HYPERPRIVOP_MAX+1] = { 0 };
+unsigned long fast_hyperpriv_cnt[HYPERPRIVOP_MAX+1] = { 0 };
+
+unsigned long slow_reflect_count[0x80] = { 0 };
+unsigned long fast_reflect_count[0x80] = { 0 };
+
+struct privop_counters privcnt;
+
+#ifdef PRIVOP_ADDR_COUNT
+#define PRIVOP_COUNT_NINSTS 2
+#define PRIVOP_COUNT_NADDRS 30
+
+struct privop_addr_count {
+       const char *instname;
+       unsigned long addr[PRIVOP_COUNT_NADDRS];
+       unsigned long count[PRIVOP_COUNT_NADDRS];
+       unsigned long overflow;
+};
+
+
+static struct privop_addr_count privop_addr_counter[PRIVOP_COUNT_NINSTS] = {
+       [_GET_IFA] = { "=ifa",  { 0 }, { 0 }, 0 },
+       [_THASH] = { "thash", { 0 }, { 0 }, 0 }
+};
+
+void privop_count_addr(unsigned long iip, int inst)
+{
+       struct privop_addr_count *v = &privop_addr_counter[inst];
+       int i;
+
+       if (inst >= PRIVOP_COUNT_NINSTS)
+               return;
+       for (i = 0; i < PRIVOP_COUNT_NADDRS; i++) {
+               if (!v->addr[i]) {
+                       v->addr[i] = iip;
+                       v->count[i]++;
+                       return;
+               }
+               else if (v->addr[i] == iip) {
+                       v->count[i]++;
+                       return;
+               }
+       }
+       v->overflow++;;
+}
+
+static int dump_privop_addrs(char *buf)
+{
+       int i, j;
+       char *s = buf;
+       s += sprintf(s, "Privop addresses:\n");
+       for (i = 0; i < PRIVOP_COUNT_NINSTS; i++) {
+               struct privop_addr_count *v = &privop_addr_counter[i];
+               s += sprintf(s, "%s:\n", v->instname);
+               for (j = 0; j < PRIVOP_COUNT_NADDRS; j++) {
+                       if (!v->addr[j])
+                               break;
+                       s += sprintf(s, " at 0x%lx #%ld\n",
+                                    v->addr[j], v->count[j]);
+               }
+               if (v->overflow) 
+                       s += sprintf(s, " other #%ld\n", v->overflow);
+       }
+       return s - buf;
+}
+
+static void zero_privop_addrs(void)
+{
+       int i,j;
+       for (i = 0; i < PRIVOP_COUNT_NINSTS; i++) {
+               struct privop_addr_count *v = &privop_addr_counter[i];
+               for (j = 0; j < PRIVOP_COUNT_NADDRS; j++)
+                       v->addr[j] = v->count[j] = 0;
+               v->overflow = 0;
+       }
+}
+#endif
+
+/**************************************************************************
+Privileged operation instrumentation routines
+**************************************************************************/
+
+static const char * const Mpriv_str[64] = {
+       "mov_to_rr", "mov_to_dbr", "mov_to_ibr", "mov_to_pkr",
+       "mov_to_pmc", "mov_to_pmd", "<0x06>", "<0x07>",
+       "<0x08>", "ptc_l", "ptc_g", "ptc_ga",
+       "ptr_d", "ptr_i", "itr_d", "itr_i",
+       "mov_from_rr", "mov_from_dbr", "mov_from_ibr", "mov_from_pkr",
+       "mov_from_pmc", "<0x15>", "<0x16>", "<0x17>",
+       "<0x18>", "<0x19>", "privified-thash", "privified-ttag",
+       "<0x1c>", "<0x1d>", "tpa", "tak",
+       "<0x20>", "<0x21>", "<0x22>", "<0x23>",
+       "mov_from_cr", "mov_from_psr", "<0x26>", "<0x27>",
+       "<0x28>", "<0x29>", "<0x2a>", "<0x2b>",
+       "mov_to_cr", "mov_to_psr", "itc_d", "itc_i",
+       "<0x30>", "<0x31>", "<0x32>", "<0x33>",
+       "ptc_e", "<0x35>", "<0x36>", "<0x37>",
+       "<0x38>", "<0x39>", "<0x3a>", "<0x3b>",
+       "<0x3c>", "<0x3d>", "<0x3e>", "<0x3f>"
+};
+
+#define RS "Rsvd"
+static const char * const cr_str[128] = {
+       "dcr","itm","iva",RS,RS,RS,RS,RS,
+       "pta",RS,RS,RS,RS,RS,RS,RS,
+       "ipsr","isr",RS,"iip","ifa","itir","iipa","ifs",
+       "iim","iha",RS,RS,RS,RS,RS,RS,
+       RS,RS,RS,RS,RS,RS,RS,RS, RS,RS,RS,RS,RS,RS,RS,RS,
+       RS,RS,RS,RS,RS,RS,RS,RS, RS,RS,RS,RS,RS,RS,RS,RS,
+       "lid","ivr","tpr","eoi","irr0","irr1","irr2","irr3",
+       "itv","pmv","cmcv",RS,RS,RS,RS,RS,
+       "lrr0","lrr1",RS,RS,RS,RS,RS,RS,
+       RS,RS,RS,RS,RS,RS,RS,RS, RS,RS,RS,RS,RS,RS,RS,RS,
+       RS,RS,RS,RS,RS,RS,RS,RS, RS,RS,RS,RS,RS,RS,RS,RS,
+       RS,RS,RS,RS,RS,RS,RS,RS
+};
+
+// FIXME: should use snprintf to ensure no buffer overflow
+static int dump_privop_counts(char *buf)
+{
+       int i, j;
+       unsigned long sum = 0;
+       char *s = buf;
+
+       // this is ugly and should probably produce sorted output
+       // but it will have to do for now
+       sum += privcnt.mov_to_ar_imm; sum += privcnt.mov_to_ar_reg;
+       sum += privcnt.ssm; sum += privcnt.rsm;
+       sum += privcnt.rfi; sum += privcnt.bsw0;
+       sum += privcnt.bsw1; sum += privcnt.cover;
+       for (i=0; i < 64; i++)
+               sum += privcnt.Mpriv_cnt[i];
+       s += sprintf(s,"Privop statistics: (Total privops: %ld)\n",sum);
+       if (privcnt.mov_to_ar_imm)
+               s += sprintf(s,"%10ld  %s [%ld%%]\n", privcnt.mov_to_ar_imm,
+                       "mov_to_ar_imm", (privcnt.mov_to_ar_imm*100L)/sum);
+       if (privcnt.mov_to_ar_reg)
+               s += sprintf(s,"%10ld  %s [%ld%%]\n", privcnt.mov_to_ar_reg,
+                       "mov_to_ar_reg", (privcnt.mov_to_ar_reg*100L)/sum);
+       if (privcnt.mov_from_ar)
+               s += sprintf(s,"%10ld  %s [%ld%%]\n", privcnt.mov_from_ar,
+                       "privified-mov_from_ar", 
(privcnt.mov_from_ar*100L)/sum);
+       if (privcnt.ssm)
+               s += sprintf(s,"%10ld  %s [%ld%%]\n", privcnt.ssm,
+                       "ssm", (privcnt.ssm*100L)/sum);
+       if (privcnt.rsm)
+               s += sprintf(s,"%10ld  %s [%ld%%]\n", privcnt.rsm,
+                       "rsm", (privcnt.rsm*100L)/sum);
+       if (privcnt.rfi)
+               s += sprintf(s,"%10ld  %s [%ld%%]\n", privcnt.rfi,
+                       "rfi", (privcnt.rfi*100L)/sum);
+       if (privcnt.bsw0)
+               s += sprintf(s,"%10ld  %s [%ld%%]\n", privcnt.bsw0,
+                       "bsw0", (privcnt.bsw0*100L)/sum);
+       if (privcnt.bsw1)
+               s += sprintf(s,"%10ld  %s [%ld%%]\n", privcnt.bsw1,
+                       "bsw1", (privcnt.bsw1*100L)/sum);
+       if (privcnt.cover)
+               s += sprintf(s,"%10ld  %s [%ld%%]\n", privcnt.cover,
+                       "cover", (privcnt.cover*100L)/sum);
+       if (privcnt.fc)
+               s += sprintf(s,"%10ld  %s [%ld%%]\n", privcnt.fc,
+                       "privified-fc", (privcnt.fc*100L)/sum);
+       if (privcnt.cpuid)
+               s += sprintf(s,"%10ld  %s [%ld%%]\n", privcnt.cpuid,
+                       "privified-getcpuid", (privcnt.cpuid*100L)/sum);
+       for (i=0; i < 64; i++) if (privcnt.Mpriv_cnt[i]) {
+               if (!Mpriv_str[i]) s += sprintf(s,"PRIVSTRING NULL!!\n");
+               else s += sprintf(s,"%10ld  %s [%ld%%]\n", privcnt.Mpriv_cnt[i],
+                       Mpriv_str[i], (privcnt.Mpriv_cnt[i]*100L)/sum);
+               if (i == 0x24) { // mov from CR
+                       s += sprintf(s,"            [");
+                       for (j=0; j < 128; j++) if (privcnt.from_cr_cnt[j]) {
+                               if (!cr_str[j])
+                                       s += sprintf(s,"PRIVSTRING NULL!!\n");
+                               else
+                                       s += sprintf(s,"%s(%ld),",cr_str[j],
+                                                    privcnt.from_cr_cnt[j]);
+                       }
+                       s += sprintf(s,"]\n");
+               }
+               else if (i == 0x2c) { // mov to CR
+                       s += sprintf(s,"            [");
+                       for (j=0; j < 128; j++) if (privcnt.to_cr_cnt[j]) {
+                               if (!cr_str[j])
+                                       s += sprintf(s,"PRIVSTRING NULL!!\n");
+                               else
+                                       s += sprintf(s,"%s(%ld),",cr_str[j],
+                                                    privcnt.to_cr_cnt[j]);
+                       }
+                       s += sprintf(s,"]\n");
+               }
+       }
+       return s - buf;
+}
+
+static int zero_privop_counts(char *buf)
+{
+       int i, j;
+       char *s = buf;
+
+       // this is ugly and should probably produce sorted output
+       // but it will have to do for now
+       privcnt.mov_to_ar_imm = 0;
+       privcnt.mov_to_ar_reg = 0;
+       privcnt.mov_from_ar = 0;
+       privcnt.ssm = 0; privcnt.rsm = 0;
+       privcnt.rfi = 0; privcnt.bsw0 = 0;
+       privcnt.bsw1 = 0; privcnt.cover = 0;
+       privcnt.fc = 0; privcnt.cpuid = 0;
+       for (i=0; i < 64; i++)
+               privcnt.Mpriv_cnt[i] = 0;
+       for (j=0; j < 128; j++)
+               privcnt.from_cr_cnt[j] = 0;
+       for (j=0; j < 128; j++)
+               privcnt.to_cr_cnt[j] = 0;
+       s += sprintf(s,"All privop statistics zeroed\n");
+       return s - buf;
+}
+
+static int dump_misc_stats(char *buf)
+{
+       char *s = buf;
+       s += sprintf(s,"Virtual TR translations: %ld\n",tr_translate_count);
+       s += sprintf(s,"Virtual VHPT slow translations: 
%ld\n",vhpt_translate_count);
+       s += sprintf(s,"Virtual VHPT fast translations: 
%ld\n",fast_vhpt_translate_count);
+       s += sprintf(s,"Virtual DTLB translations: %ld\n",dtlb_translate_count);
+       s += sprintf(s,"Physical translations: %ld\n",phys_translate_count);
+       s += sprintf(s,"Recoveries to page fault: 
%ld\n",recover_to_page_fault_count);
+       s += sprintf(s,"Recoveries to break fault: 
%ld\n",recover_to_break_fault_count);
+       s += sprintf(s,"Idle when pending: %ld\n",idle_when_pending);
+       s += sprintf(s,"PAL_HALT_LIGHT (no pending): 
%ld\n",pal_halt_light_count);
+       s += sprintf(s,"context switches: %ld\n",context_switch_count);
+       s += sprintf(s,"Lazy covers: %ld\n",lazy_cover_count);
+       return s - buf;
+}
+
+static void zero_misc_stats(void)
+{
+       dtlb_translate_count = 0;
+       tr_translate_count = 0;
+       phys_translate_count = 0;
+       vhpt_translate_count = 0;
+       fast_vhpt_translate_count = 0;
+       recover_to_page_fault_count = 0;
+       recover_to_break_fault_count = 0;
+       lazy_cover_count = 0;
+       pal_halt_light_count = 0;
+       idle_when_pending = 0;
+       context_switch_count = 0;
+}
+
+static const char * const hyperpriv_str[HYPERPRIVOP_MAX+1] = {
+       0, "rfi", "rsm.dt", "ssm.dt", "cover", "itc.d", "itc.i", "ssm.i",
+       "=ivr", "=tpr", "tpr=", "eoi", "itm=", "thash", "ptc.ga", "itr.d",
+       "=rr", "rr=", "kr=", "fc", "=cpuid", "=pmd", "=ar.eflg", "ar.eflg="
+};
+
+
+static int dump_hyperprivop_counts(char *buf)
+{
+       int i;
+       char *s = buf;
+       unsigned long total = 0;
+       for (i = 1; i <= HYPERPRIVOP_MAX; i++)
+               total += slow_hyperpriv_cnt[i];
+       s += sprintf(s,"Slow hyperprivops (total %ld):\n",total);
+       for (i = 1; i <= HYPERPRIVOP_MAX; i++)
+               if (slow_hyperpriv_cnt[i])
+                       s += sprintf(s,"%10ld %s\n",
+                               slow_hyperpriv_cnt[i], hyperpriv_str[i]);
+       total = 0;
+       for (i = 1; i <= HYPERPRIVOP_MAX; i++)
+               total += fast_hyperpriv_cnt[i];
+       s += sprintf(s,"Fast hyperprivops (total %ld):\n",total);
+       for (i = 1; i <= HYPERPRIVOP_MAX; i++)
+               if (fast_hyperpriv_cnt[i])
+                       s += sprintf(s,"%10ld %s\n",
+                               fast_hyperpriv_cnt[i], hyperpriv_str[i]);
+       return s - buf;
+}
+
+static void zero_hyperprivop_counts(void)
+{
+       int i;
+       for (i = 0; i <= HYPERPRIVOP_MAX; i++)
+               slow_hyperpriv_cnt[i] = 0;
+       for (i = 0; i <= HYPERPRIVOP_MAX; i++)
+               fast_hyperpriv_cnt[i] = 0;
+}
+
+static void zero_reflect_counts(void)
+{
+       int i;
+       for (i=0; i < 0x80; i++)
+               slow_reflect_count[i] = 0;
+       for (i=0; i < 0x80; i++)
+               fast_reflect_count[i] = 0;
+}
+
+static int dump_reflect_counts(char *buf)
+{
+       int i,j,cnt;
+       char *s = buf;
+
+       s += sprintf(s,"Slow reflections by vector:\n");
+       for (i = 0, j = 0; i < 0x80; i++) {
+               if ( (cnt = slow_reflect_count[i]) != 0 ) {
+                       s += sprintf(s,"0x%02x00:%10d, ",i,cnt);
+                       if ((j++ & 3) == 3)
+                               s += sprintf(s,"\n");
+               }
+       }
+       if (j & 3)
+               s += sprintf(s,"\n");
+       s += sprintf(s,"Fast reflections by vector:\n");
+       for (i = 0, j = 0; i < 0x80; i++) {
+               if ( (cnt = fast_reflect_count[i]) != 0 ) {
+                       s += sprintf(s,"0x%02x00:%10d, ",i,cnt);
+                       if ((j++ & 3) == 3)
+                               s += sprintf(s,"\n");
+               }
+       }
+       if (j & 3)
+               s += sprintf(s,"\n");
+       return s - buf;
+}
+
+
+#define TMPBUFLEN 8*1024
+int dump_privop_counts_to_user(char __user *ubuf, int len)
+{
+       char buf[TMPBUFLEN];
+       int n;
+
+       if (len < TMPBUFLEN)
+               return -1;
+
+       n = dump_privop_counts(buf);
+       n += dump_hyperprivop_counts(buf + n);
+       n += dump_reflect_counts(buf + n);
+#ifdef PRIVOP_ADDR_COUNT
+       n += dump_privop_addrs(buf + n);
+#endif
+       n += dump_vhpt_stats(buf + n);
+       n += dump_misc_stats(buf + n);
+       if (__copy_to_user(ubuf,buf,n))
+               return -1;
+       return n;
+}
+
+int zero_privop_counts_to_user(char __user *ubuf, int len)
+{
+       char buf[TMPBUFLEN];
+       int n;
+
+       if (len < TMPBUFLEN)
+               return -1;
+
+       n = zero_privop_counts(buf);
+
+       zero_hyperprivop_counts();
+#ifdef PRIVOP_ADDR_COUNT
+       zero_privop_addrs();
+#endif
+       zero_vhpt_stats();
+       zero_misc_stats();
+       zero_reflect_counts();
+       if (__copy_to_user(ubuf,buf,n))
+               return -1;
+       return n;
+}
diff -r 75b23b6a7cb7 -r 550786d7d352 xen/include/asm-ia64/bundle.h
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/include/asm-ia64/bundle.h     Mon Jul 03 08:12:16 2006 -0600
@@ -0,0 +1,228 @@
+#ifndef _XEN_IA64_BUNDLE_H
+#define _XEN_IA64_BUNDLE_H
+
+typedef unsigned long IA64_INST;
+
+typedef union U_IA64_BUNDLE {
+    unsigned long i64[2];
+    struct { unsigned long template:5,slot0:41,slot1a:18,slot1b:23,slot2:41; };
+    // NOTE: following doesn't work because bitfields can't cross natural
+    // size boundaries
+    //struct { unsigned long template:5, slot0:41, slot1:41, slot2:41; };
+} IA64_BUNDLE;
+
+typedef enum E_IA64_SLOT_TYPE { I, M, F, B, L, ILLEGAL } IA64_SLOT_TYPE;
+
+typedef union U_INST64_A5 {
+    IA64_INST inst;
+    struct { unsigned long qp:6, r1:7, imm7b:7, r3:2, imm5c:5, imm9d:9, s:1, 
major:4; };
+} INST64_A5;
+
+typedef union U_INST64_B4 {
+    IA64_INST inst;
+    struct { unsigned long qp:6, btype:3, un3:3, p:1, b2:3, un11:11, x6:6, 
wh:2, d:1, un1:1, major:4; };
+} INST64_B4;
+
+typedef union U_INST64_B8 {
+    IA64_INST inst;
+    struct { unsigned long qp:6, un21:21, x6:6, un4:4, major:4; };
+} INST64_B8;
+
+typedef union U_INST64_B9 {
+    IA64_INST inst;
+    struct { unsigned long qp:6, imm20:20, :1, x6:6, :3, i:1, major:4; };
+} INST64_B9;
+
+typedef union U_INST64_I19 {
+    IA64_INST inst;
+    struct { unsigned long qp:6, imm20:20, :1, x6:6, x3:3, i:1, major:4; };
+} INST64_I19;
+
+typedef union U_INST64_I26 {
+    IA64_INST inst;
+    struct { unsigned long qp:6, :7, r2:7, ar3:7, x6:6, x3:3, :1, major:4;};
+} INST64_I26;
+
+typedef union U_INST64_I27 {
+    IA64_INST inst;
+    struct { unsigned long qp:6, :7, imm:7, ar3:7, x6:6, x3:3, s:1, major:4;};
+} INST64_I27;
+
+typedef union U_INST64_I28 { // not privileged (mov from AR)
+    IA64_INST inst;
+    struct { unsigned long qp:6, r1:7, :7, ar3:7, x6:6, x3:3, :1, major:4;};
+} INST64_I28;
+
+typedef union U_INST64_M28 {
+    IA64_INST inst;
+    struct { unsigned long qp:6, :14, r3:7, x6:6, x3:3, :1, major:4;};
+} INST64_M28;
+
+typedef union U_INST64_M29 {
+    IA64_INST inst;
+    struct { unsigned long qp:6, :7, r2:7, ar3:7, x6:6, x3:3, :1, major:4;};
+} INST64_M29;
+
+typedef union U_INST64_M30 {
+    IA64_INST inst;
+    struct { unsigned long qp:6, :7, imm:7, ar3:7,x4:4,x2:2,x3:3,s:1,major:4;};
+} INST64_M30;
+
+typedef union U_INST64_M31 {
+    IA64_INST inst;
+    struct { unsigned long qp:6, r1:7, :7, ar3:7, x6:6, x3:3, :1, major:4;};
+} INST64_M31;
+
+typedef union U_INST64_M32 {
+    IA64_INST inst;
+    struct { unsigned long qp:6, :7, r2:7, cr3:7, x6:6, x3:3, :1, major:4;};
+} INST64_M32;
+
+typedef union U_INST64_M33 {
+    IA64_INST inst;
+    struct { unsigned long qp:6, r1:7, :7, cr3:7, x6:6, x3:3, :1, major:4; };
+} INST64_M33;
+
+typedef union U_INST64_M35 {
+    IA64_INST inst;
+    struct { unsigned long qp:6, :7, r2:7, :7, x6:6, x3:3, :1, major:4; };
+   
+} INST64_M35;
+
+typedef union U_INST64_M36 {
+    IA64_INST inst;
+    struct { unsigned long qp:6, r1:7, :14, x6:6, x3:3, :1, major:4; }; 
+} INST64_M36;
+
+typedef union U_INST64_M37 {
+    IA64_INST inst;
+    struct { unsigned long qp:6, imm20a:20,:1, x4:4,x2:2,x3:3, i:1, major:4; };
+} INST64_M37;
+
+typedef union U_INST64_M41 {
+    IA64_INST inst;
+    struct { unsigned long qp:6, :7, r2:7, :7, x6:6, x3:3, :1, major:4; }; 
+} INST64_M41;
+
+typedef union U_INST64_M42 {
+    IA64_INST inst;
+    struct { unsigned long qp:6, :7, r2:7, r3:7, x6:6, x3:3, :1, major:4; };
+} INST64_M42;
+
+typedef union U_INST64_M43 {
+    IA64_INST inst;
+    struct { unsigned long qp:6, r1:7, :7, r3:7, x6:6, x3:3, :1, major:4; };
+} INST64_M43;
+
+typedef union U_INST64_M44 {
+    IA64_INST inst;
+    struct { unsigned long qp:6, imm:21, x4:4, i2:2, x3:3, i:1, major:4; };
+} INST64_M44;
+
+typedef union U_INST64_M45 {
+    IA64_INST inst;
+    struct { unsigned long qp:6, :7, r2:7, r3:7, x6:6, x3:3, :1, major:4; };
+} INST64_M45;
+
+typedef union U_INST64_M46 {
+    IA64_INST inst;
+    struct { unsigned long qp:6, r1:7, un7:7, r3:7, x6:6, x3:3, un1:1, 
major:4; };
+} INST64_M46;
+
+typedef union U_INST64_M47 {
+    IA64_INST inst;
+    struct { unsigned long qp:6, un14:14, r3:7, x6:6, x3:3, un1:1, major:4; };
+} INST64_M47;
+
+typedef union U_INST64_M1{
+    IA64_INST inst;
+    struct { unsigned long qp:6, r1:7, un7:7, r3:7, x:1, hint:2, x6:6, m:1, 
major:4; };
+} INST64_M1;
+
+typedef union U_INST64_M2{
+    IA64_INST inst;
+    struct { unsigned long qp:6, r1:7, r2:7, r3:7, x:1, hint:2, x6:6, m:1, 
major:4; };
+} INST64_M2;
+
+typedef union U_INST64_M3{
+    IA64_INST inst;
+    struct { unsigned long qp:6, r1:7, imm7:7, r3:7, i:1, hint:2, x6:6, s:1, 
major:4; };
+} INST64_M3;
+
+typedef union U_INST64_M4 {
+    IA64_INST inst;
+    struct { unsigned long qp:6, un7:7, r2:7, r3:7, x:1, hint:2, x6:6, m:1, 
major:4; };
+} INST64_M4;
+
+typedef union U_INST64_M5 {
+    IA64_INST inst;
+    struct { unsigned long qp:6, imm7:7, r2:7, r3:7, i:1, hint:2, x6:6, s:1, 
major:4; };
+} INST64_M5;
+
+typedef union U_INST64_M6 {
+    IA64_INST inst;
+    struct { unsigned long qp:6, f1:7, un7:7, r3:7, x:1, hint:2, x6:6, m:1, 
major:4; };
+} INST64_M6;
+
+typedef union U_INST64_M9 {
+    IA64_INST inst;
+    struct { unsigned long qp:6, :7, f2:7, r3:7, x:1, hint:2, x6:6, m:1, 
major:4; };
+} INST64_M9;
+
+typedef union U_INST64_M10 {
+    IA64_INST inst;
+    struct { unsigned long qp:6, imm7:7, f2:7, r3:7, i:1, hint:2, x6:6, s:1, 
major:4; };
+} INST64_M10;
+
+typedef union U_INST64_M12 {
+    IA64_INST inst;
+    struct { unsigned long qp:6, f1:7, f2:7, r3:7, x:1, hint:2, x6:6, m:1, 
major:4; };
+} INST64_M12;
+                        
+typedef union U_INST64_M15 {
+    IA64_INST inst;
+    struct { unsigned long qp:6, :7, imm7:7, r3:7, i:1, hint:2, x6:6, s:1, 
major:4; };
+} INST64_M15;
+
+typedef union U_INST64 {
+    IA64_INST inst;
+    struct { unsigned long :37, major:4; } generic;
+    INST64_A5 A5;      // used in build_hypercall_bundle only
+    INST64_B4 B4;      // used in build_hypercall_bundle only
+    INST64_B8 B8;      // rfi, bsw.[01]
+    INST64_B9 B9;      // break.b
+    INST64_I19 I19;    // used in build_hypercall_bundle only
+    INST64_I26 I26;    // mov register to ar (I unit)
+    INST64_I27 I27;    // mov immediate to ar (I unit)
+    INST64_I28 I28;    // mov from ar (I unit)
+    INST64_M1  M1;     // ld integer
+    INST64_M2  M2;
+    INST64_M3  M3;
+    INST64_M4  M4;     // st integer
+    INST64_M5  M5;
+    INST64_M6  M6;     // ldfd floating pointer
+    INST64_M9  M9;     // stfd floating pointer
+    INST64_M10 M10;    // stfd floating pointer
+    INST64_M12 M12;    // ldfd pair floating pointer
+    INST64_M15 M15;    // lfetch + imm update
+    INST64_M28 M28;    // purge translation cache entry
+    INST64_M29 M29;    // mov register to ar (M unit)
+    INST64_M30 M30;    // mov immediate to ar (M unit)
+    INST64_M31 M31;    // mov from ar (M unit)
+    INST64_M32 M32;    // mov reg to cr
+    INST64_M33 M33;    // mov from cr
+    INST64_M35 M35;    // mov to psr
+    INST64_M36 M36;    // mov from psr
+    INST64_M37 M37;    // break.m
+    INST64_M41 M41;    // translation cache insert
+    INST64_M42 M42;    // mov to indirect reg/translation reg insert
+    INST64_M43 M43;    // mov from indirect reg
+    INST64_M44 M44;    // set/reset system mask
+    INST64_M45 M45;    // translation purge
+    INST64_M46 M46;    // translation access (tpa,tak)
+    INST64_M47 M47;    // purge translation entry
+} INST64;
+
+#define MASK_41 ((unsigned long)0x1ffffffffff)
+
+#endif /* _XEN_IA64_BUNDLE_H */
diff -r 75b23b6a7cb7 -r 550786d7d352 xen/include/asm-ia64/privop_stat.h
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/include/asm-ia64/privop_stat.h        Mon Jul 03 08:12:16 2006 -0600
@@ -0,0 +1,66 @@
+#ifndef _XEN_UA64_PRIVOP_STAT_H
+#define _XEN_UA64_PRIVOP_STAT_H
+#include <public/arch-ia64.h>
+
+extern int dump_privop_counts_to_user(char *, int);
+extern int zero_privop_counts_to_user(char *, int);
+
+#define PRIVOP_ADDR_COUNT
+
+/* vcpu_translate hit with dtlb.  */
+extern unsigned long dtlb_translate_count;
+
+/* vcpu_translate hit with tr.  */
+extern unsigned long tr_translate_count;
+
+/* vcpu_translate in metaphysical mode.  */
+extern unsigned long phys_translate_count;
+
+extern unsigned long vhpt_translate_count;
+extern unsigned long fast_vhpt_translate_count;
+extern unsigned long recover_to_page_fault_count;
+extern unsigned long recover_to_break_fault_count;
+extern unsigned long idle_when_pending;
+extern unsigned long pal_halt_light_count;
+extern unsigned long context_switch_count;
+extern unsigned long lazy_cover_count;
+
+extern unsigned long slow_hyperpriv_cnt[HYPERPRIVOP_MAX+1];
+extern unsigned long fast_hyperpriv_cnt[HYPERPRIVOP_MAX+1];
+
+extern unsigned long slow_reflect_count[0x80];
+extern unsigned long fast_reflect_count[0x80];
+
+struct privop_counters {
+       unsigned long mov_to_ar_imm;
+       unsigned long mov_to_ar_reg;
+       unsigned long mov_from_ar;
+       unsigned long ssm;
+       unsigned long rsm;
+       unsigned long rfi;
+       unsigned long bsw0;
+       unsigned long bsw1;
+       unsigned long cover;
+       unsigned long fc;
+       unsigned long cpuid;
+       unsigned long Mpriv_cnt[64];
+
+       unsigned long to_cr_cnt[128]; /* Number of mov to cr privop.  */
+       unsigned long from_cr_cnt[128]; /* Number of mov from cr privop.  */
+};
+
+extern struct privop_counters privcnt;
+
+#ifdef PRIVOP_ADDR_COUNT
+
+/* INST argument of PRIVOP_COUNT_ADDR.  */
+#define _GET_IFA 0
+#define _THASH 1
+#define        PRIVOP_COUNT_ADDR(regs,inst) 
privop_count_addr(regs->cr_iip,inst)
+extern void privop_count_addr(unsigned long addr, int inst);
+
+#else
+#define        PRIVOP_COUNT_ADDR(x,y) do {} while (0)
+#endif
+
+#endif /* _XEN_UA64_PRIVOP_STAT_H */

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

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