/*
         * Force FPU initialization:
         */
-       current_thread_info()->status = 0;
+       if (cpu_has_xsave)
+               current_thread_info()->status = TS_XSAVE;
+       else
+               current_thread_info()->status = 0;
        clear_used_math();
        mxcsr_feature_mask_init();
+ 
+       /*
+        * Boot processor to setup the FP and extended state context info.
+        */
+       if (!smp_processor_id())
+               init_thread_xstate();
+ 
+       xsave_init();
  }
  
 -#ifdef CONFIG_HOTPLUG_CPU
 -void __cpuinit cpu_uninit(void)
 -{
 -      int cpu = raw_smp_processor_id();
 -      cpu_clear(cpu, cpu_initialized);
 -
 -      /* lazy TLB state */
 -      per_cpu(cpu_tlbstate, cpu).state = 0;
 -      per_cpu(cpu_tlbstate, cpu).active_mm = &init_mm;
 -}
 -#endif
+ 
+ #endif
 
        },
  };
  
 -static void __init __xen_init_IRQ(void)
 -{
 -#ifdef CONFIG_X86_64
 -      int i;
 -
 -      /* Create identity vector->irq map */
 -      for(i = 0; i < NR_VECTORS; i++) {
 -              int cpu;
 -
 -              for_each_possible_cpu(cpu)
 -                      per_cpu(vector_irq, cpu)[i] = i;
 -      }
 -#endif        /* CONFIG_X86_64 */
 -
 -      xen_init_IRQ();
 -}
 -
 -static const struct pv_irq_ops xen_irq_ops __initdata = {
 -      .init_IRQ = __xen_init_IRQ,
 -      .save_fl = xen_save_fl,
 -      .restore_fl = xen_restore_fl,
 -      .irq_disable = xen_irq_disable,
 -      .irq_enable = xen_irq_enable,
 -      .safe_halt = xen_safe_halt,
 -      .halt = xen_halt,
 -#ifdef CONFIG_X86_64
 -      .adjust_exception_frame = xen_adjust_exception_frame,
 -#endif
 -};
 -
  static const struct pv_apic_ops xen_apic_ops __initdata = {
  #ifdef CONFIG_X86_LOCAL_APIC
-       .apic_write = xen_apic_write,
-       .apic_read = xen_apic_read,
        .setup_boot_clock = paravirt_nop,
        .setup_secondary_clock = paravirt_nop,
        .startup_ipi_hook = paravirt_nop,
        pv_apic_ops = xen_apic_ops;
        pv_mmu_ops = xen_mmu_ops;
  
 +      xen_init_irq_ops();
 +
+ #ifdef CONFIG_X86_LOCAL_APIC
+       /*
+        * set up the basic apic ops.
+        */
+       apic_ops = &xen_basic_apic_ops;
+ #endif
+ 
        if (xen_feature(XENFEAT_mmu_pt_update_preserve_ad)) {
                pv_mmu_ops.ptep_modify_prot_start = xen_ptep_modify_prot_start;
                pv_mmu_ops.ptep_modify_prot_commit = xen_ptep_modify_prot_commit;
 
  #define MULTI_UVMFLAGS_INDEX 3
  #define MULTI_UVMDOMID_INDEX 4
  
 -#define is_running_on_xen()   (xen_start_info ? 1 : 0)
 +enum xen_domain_type {
 +      XEN_NATIVE,
 +      XEN_PV_DOMAIN,
 +      XEN_HVM_DOMAIN,
 +};
 +
 +extern enum xen_domain_type xen_domain_type;
 +
 +#define xen_domain()          (xen_domain_type != XEN_NATIVE)
 +#define xen_pv_domain()               (xen_domain_type == XEN_PV_DOMAIN)
 +#define xen_initial_domain()  (xen_pv_domain() && xen_start_info->flags & SIF_INITDOMAIN)
 +#define xen_hvm_domain()      (xen_domain_type == XEN_HVM_DOMAIN)
  
- #endif /* __HYPERVISOR_H__ */
+ #endif /* ASM_X86__XEN__HYPERVISOR_H */