WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-merge

[Xen-merge] [PATCH 14/23] processor subarch headers

To: xen-merge@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-merge] [PATCH 14/23] processor subarch headers
From: Chris Wright <chrisw@xxxxxxxx>
Date: Mon, 08 Aug 2005 00:02:50 -0700
Delivery-date: Mon, 08 Aug 2005 07:06:38 +0000
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-merge-request@lists.xensource.com?subject=help>
List-id: xen-merge <xen-merge.lists.xensource.com>
List-post: <mailto:xen-merge@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-merge>, <mailto:xen-merge-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-merge>, <mailto:xen-merge-request@lists.xensource.com?subject=unsubscribe>
References: <20050808070236.231405000@xxxxxxxxxxxxxxxxxxxxx>
Sender: xen-merge-bounces@xxxxxxxxxxxxxxxxxxx
--- linux-2.6.12-xen0-arch.orig/include/asm-i386/processor.h
+++ linux-2.6.12-xen0-arch/include/asm-i386/processor.h
@@ -203,10 +203,6 @@ static inline unsigned int cpuid_edx(uns
        return edx;
 }
 
-#define load_cr3(pgdir) \
-       asm volatile("movl %0,%%cr3": :"r" (__pa(pgdir)))
-
-
 /*
  * Intel CPU features in CR4
  */
@@ -230,15 +226,7 @@ static inline unsigned int cpuid_edx(uns
  */
 extern unsigned long mmu_cr4_features;
 
-static inline void set_in_cr4 (unsigned long mask)
-{
-       mmu_cr4_features |= mask;
-       __asm__("movl %%cr4,%%eax\n\t"
-               "orl %0,%%eax\n\t"
-               "movl %%eax,%%cr4\n"
-               : : "irg" (mask)
-               :"ax");
-}
+#include <mach_processor.h>
 
 static inline void clear_in_cr4 (unsigned long mask)
 {
@@ -453,6 +441,7 @@ struct thread_struct {
        unsigned long           v86flags, v86mask, saved_esp0;
        unsigned int            saved_fs, saved_gs;
 /* IO permissions */
+       unsigned long   io_pl;
        unsigned long   *io_bitmap_ptr;
 /* max allowed port in the bitmap, in bytes: */
        unsigned long   io_bitmap_max;
@@ -487,6 +476,7 @@ static inline void load_esp0(struct tss_
                tss->ss1 = thread->sysenter_cs;
                wrmsr(MSR_IA32_SYSENTER_CS, thread->sysenter_cs, 0);
        }
+       mach_load_esp0(tss, thread);
 }
 
 #define start_thread(regs, new_eip, new_esp) do {              \
@@ -500,14 +490,6 @@ static inline void load_esp0(struct tss_
        regs->esp = new_esp;                                    \
 } while (0)
 
-/*
- * This special macro can be used to load a debugging register
- */
-#define loaddebug(thread,register) \
-               __asm__("movl %0,%%db" #register  \
-                       : /* no output */ \
-                       :"r" ((thread)->debugreg[register]))
-
 /* Forward declaration, a strange C thing */
 struct task_struct;
 struct mm_struct;
--- /dev/null
+++ linux-2.6.12-xen0-arch/include/asm-i386/mach-default/mach_processor.h
@@ -0,0 +1,27 @@
+#ifndef __ASM_MACH_PROCESSOR_H
+#define __ASM_MACH_PROCESSOR_H
+
+#define load_cr3(pgdir) \
+       asm volatile("movl %0,%%cr3": :"r" (__pa(pgdir)))
+
+static inline void set_in_cr4 (unsigned long mask)
+{
+       mmu_cr4_features |= mask;
+       __asm__("movl %%cr4,%%eax\n\t"
+               "orl %0,%%eax\n\t"
+               "movl %%eax,%%cr4\n"
+               : : "irg" (mask)
+               :"ax");
+}
+
+#define mach_load_esp0(tss, thread) do {} while(0)
+
+/*
+ * This special macro can be used to load a debugging register
+ */
+#define loaddebug(thread,register) \
+               __asm__("movl %0,%%db" #register  \
+                       : /* no output */ \
+                       :"r" ((thread)->debugreg[register]))
+
+#endif
--- linux-2.6.12-xen0/include/asm-i386/mach-xen/mach_processor.h        
1969-12-31 16:00:00.000000000 -0800
+++ linux-2.6.12-xen0-arch/include/asm-i386/mach-xen/mach_processor.h   
2005-08-01 23:41:50.000000000 -0700
@@ -0,0 +1,35 @@
+#ifndef __ASM_MACH_PROCESSOR_H
+#define __ASM_MACH_PROCESSOR_H
+
+DECLARE_PER_CPU(pgd_t *, cur_pgd);
+
+#define load_cr3(pgdir) do {                           \
+       xen_pt_switch(__pa(pgdir));                     \
+       per_cpu(cur_pgd, smp_processor_id()) = pgdir;   \
+} while (/* CONSTCOND */0)
+
+static inline void set_in_cr4 (unsigned long mask)
+{
+       mmu_cr4_features |= mask;
+       switch (mask) {
+       case X86_CR4_OSFXSR:
+       case X86_CR4_OSXMMEXCPT:
+               break;
+       default:
+               do {
+                       const char msg[] = "Xen unsupported cr4 update\n";
+                       (void)HYPERVISOR_console_io(
+                               CONSOLEIO_write, sizeof(msg)-1,
+                               (char *)msg);
+                       BUG();
+               } while (0);
+       }
+}
+
+#define mach_load_esp0(_tss, _thread) HYPERVISOR_stack_switch(_tss->ss0, 
_tss->esp0);
+
+#define loaddebug(thread,register) \
+       HYPERVISOR_set_debugreg((register),     \
+                       ((thread)->debugreg[register]))
+
+#endif

--


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