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

[Xen-changelog] Ensure percpu data area not used before the TR is set.



# HG changeset patch
# User fred@xxxxxxxxxxxxxxxxxxxxx
# Node ID 5f1ed597f1072b86d5c59a588c3ac2aefd0b7450
# Parent  1ec2225aa8c696ca4e96e0fc27b4eafe36a9633f
Ensure percpu data area not used before the TR is set.

diff -r 1ec2225aa8c6 -r 5f1ed597f107 xen/arch/ia64/ivt.S
--- a/xen/arch/ia64/ivt.S       Sat Aug 20 05:19:39 2005
+++ b/xen/arch/ia64/ivt.S       Wed Aug 24 02:43:18 2005
@@ -136,7 +136,11 @@
        ;;
        rsm psr.dt                              // use physical addressing for 
data
        mov r31=pr                              // save the predicate registers
+#ifdef XEN
+       movl r19=THIS_CPU(cpu_kr)+IA64_KR_PT_BASE_OFFSET;;
+#else
        mov r19=IA64_KR(PT_BASE)                // get page table base address
+#endif
        shl r21=r16,3                           // shift bit 60 into sign bit
        shr.u r17=r16,61                        // get the region number into 
r17
        ;;
@@ -503,7 +507,11 @@
         * Clobbered:   b0, r18, r19, r21, psr.dt (cleared)
         */
        rsm psr.dt                              // switch to using physical 
data addressing
+#ifdef XEN
+       movl r19=THIS_CPU(cpu_kr)+IA64_KR_PT_BASE_OFFSET;;
+#else
        mov r19=IA64_KR(PT_BASE)                // get the page table base 
address
+#endif
        shl r21=r16,3                           // shift bit 60 into sign bit
        ;;
        shr.u r17=r16,61                        // get the region number into 
r17
diff -r 1ec2225aa8c6 -r 5f1ed597f107 xen/arch/ia64/linux-xen/head.S
--- a/xen/arch/ia64/linux-xen/head.S    Sat Aug 20 05:19:39 2005
+++ b/xen/arch/ia64/linux-xen/head.S    Wed Aug 24 02:43:18 2005
@@ -226,6 +226,8 @@
        bsw.1
        ;;
 #else // CONFIG_VTI
+       mov IA64_KR(CURRENT)=r2
+       mov IA64_KR(CURRENT_STACK)=r16
 #endif // CONFIG_VTI
        mov r13=r2
        /*
diff -r 1ec2225aa8c6 -r 5f1ed597f107 xen/arch/ia64/linux-xen/setup.c
--- a/xen/arch/ia64/linux-xen/setup.c   Sat Aug 20 05:19:39 2005
+++ b/xen/arch/ia64/linux-xen/setup.c   Wed Aug 24 02:43:18 2005
@@ -260,9 +260,9 @@
        phys_iobase = efi_get_iobase();
        if (phys_iobase)
                /* set AR.KR0 since this is all we use it for anyway */
-               __get_cpu_var(cpu_kr)._kr[IA64_KR_IO_BASE]=phys_iobase;
+               ia64_set_kr(IA64_KR_IO_BASE, phys_iobase);
        else {
-               phys_iobase=__get_cpu_var(cpu_kr)._kr[IA64_KR_IO_BASE];
+               phys_iobase = ia64_get_kr(IA64_KR_IO_BASE);
                printk(KERN_INFO "No I/O port range found in EFI memory map, 
falling back "
                       "to AR.KR0\n");
                printk(KERN_INFO "I/O port base = 0x%lx\n", phys_iobase);
@@ -609,8 +609,6 @@
 setup_per_cpu_areas (void)
 {
        /* start_kernel() requires this... */
-       __get_cpu_var(cpu_kr)._kr[IA64_KR_CURRENT] = current;
-       __get_cpu_var(cpu_kr)._kr[IA64_KR_CURRENT_STACK] = -1;
 }
 
 static void
@@ -668,8 +666,8 @@
         * physical addresses of per cpu variables with a simple:
         *   phys = ar.k3 + &per_cpu_var
         */
-//     ia64_set_kr(IA64_KR_PER_CPU_DATA,
-//                 ia64_tpa(cpu_data) - (long) __per_cpu_start);
+       ia64_set_kr(IA64_KR_PER_CPU_DATA,
+                   ia64_tpa(cpu_data) - (long) __per_cpu_start);
 
        get_max_cacheline_size();
 
@@ -699,7 +697,7 @@
        /* Clear the stack memory reserved for pt_regs: */
        memset(ia64_task_regs(current), 0, sizeof(struct pt_regs));
 
-       __get_cpu_var(cpu_kr)._kr[IA64_KR_FPU_OWNER] = 0;
+       ia64_set_kr(IA64_KR_FPU_OWNER, 0);
 
        /*
         * Initialize default control register to defer all speculative faults. 
 The
diff -r 1ec2225aa8c6 -r 5f1ed597f107 xen/arch/ia64/xensetup.c
--- a/xen/arch/ia64/xensetup.c  Sat Aug 20 05:19:39 2005
+++ b/xen/arch/ia64/xensetup.c  Wed Aug 24 02:43:18 2005
@@ -260,6 +260,14 @@
     do_initcalls();
 printk("About to call sort_main_extable()\n");
     sort_main_extable();
+
+    /* surrender usage of kernel registers to domain, use percpu area instead 
*/
+    __get_cpu_var(cpu_kr)._kr[IA64_KR_IO_BASE] = ia64_get_kr(IA64_KR_IO_BASE);
+    __get_cpu_var(cpu_kr)._kr[IA64_KR_PER_CPU_DATA] = 
ia64_get_kr(IA64_KR_PER_CPU_DATA);
+    __get_cpu_var(cpu_kr)._kr[IA64_KR_CURRENT_STACK] = 
ia64_get_kr(IA64_KR_CURRENT_STACK);
+    __get_cpu_var(cpu_kr)._kr[IA64_KR_FPU_OWNER] = 
ia64_get_kr(IA64_KR_FPU_OWNER);
+    __get_cpu_var(cpu_kr)._kr[IA64_KR_CURRENT] = ia64_get_kr(IA64_KR_CURRENT);
+    __get_cpu_var(cpu_kr)._kr[IA64_KR_PT_BASE] = ia64_get_kr(IA64_KR_PT_BASE);
 
     /* Create initial domain 0. */
 printk("About to call do_createdomain()\n");

_______________________________________________
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®.