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-changelog

[Xen-changelog] read/write control-reg macros are now same in xenlinux a

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] read/write control-reg macros are now same in xenlinux as native linux.
From: BitKeeper Bot <riel@xxxxxxxxxxx>
Date: Wed, 08 Jun 2005 08:37:45 +0000
Delivery-date: Wed, 08 Jun 2005 10:02:03 +0000
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: Xen Development List <xen-devel@xxxxxxxxxxxxxxxxxxx>
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
ChangeSet 1.1693, 2005/06/08 09:37:45+01:00, kaf24@xxxxxxxxxxxxxxxxxxxx

        read/write control-reg macros are now same in xenlinux as native linux.
        Signed-oiff-by: Keir Fraser <keir@xxxxxxxxxxxxx>



 asm-i386/system.h   |   23 +++++++++++++++++------
 asm-x86_64/system.h |   18 +++++++++++++-----
 2 files changed, 30 insertions(+), 11 deletions(-)


diff -Nru a/linux-2.6.11-xen-sparse/include/asm-xen/asm-i386/system.h 
b/linux-2.6.11-xen-sparse/include/asm-xen/asm-i386/system.h
--- a/linux-2.6.11-xen-sparse/include/asm-xen/asm-i386/system.h 2005-06-08 
06:03:01 -04:00
+++ b/linux-2.6.11-xen-sparse/include/asm-xen/asm-i386/system.h 2005-06-08 
06:03:01 -04:00
@@ -107,14 +107,25 @@
  * Clear and set 'TS' bit respectively
  */
 #define clts() (HYPERVISOR_fpu_taskswitch(0))
-#define read_cr0() \
-       BUG();
+#define read_cr0() ({ \
+       unsigned int __dummy; \
+       __asm__( \
+               "movl %%cr0,%0\n\t" \
+               :"=r" (__dummy)); \
+       __dummy; \
+})
 #define write_cr0(x) \
-       BUG();
-#define read_cr4() \
-       BUG();
+       __asm__("movl %0,%%cr0": :"r" (x));
+
+#define read_cr4() ({ \
+       unsigned int __dummy; \
+       __asm__( \
+               "movl %%cr4,%0\n\t" \
+               :"=r" (__dummy)); \
+       __dummy; \
+})
 #define write_cr4(x) \
-       BUG();
+       __asm__("movl %0,%%cr4": :"r" (x));
 #define stts() (HYPERVISOR_fpu_taskswitch(1))
 
 #endif /* __KERNEL__ */
diff -Nru a/linux-2.6.11-xen-sparse/include/asm-xen/asm-x86_64/system.h 
b/linux-2.6.11-xen-sparse/include/asm-xen/asm-x86_64/system.h
--- a/linux-2.6.11-xen-sparse/include/asm-xen/asm-x86_64/system.h       
2005-06-08 06:03:01 -04:00
+++ b/linux-2.6.11-xen-sparse/include/asm-xen/asm-x86_64/system.h       
2005-06-08 06:03:01 -04:00
@@ -145,30 +145,38 @@
  * Clear and set 'TS' bit respectively
  */
 #define clts() (HYPERVISOR_fpu_taskswitch(0))
+
 static inline unsigned long read_cr0(void)
 { 
-       return 0;
+       unsigned long cr0;
+       asm volatile("movq %%cr0,%0" : "=r" (cr0));
+       return cr0;
 } 
 
 static inline void write_cr0(unsigned long val) 
 { 
-       /* Ignore, Linux tries to clear TS and EM */
+       asm volatile("movq %0,%%cr0" :: "r" (val));
 } 
 
 static inline unsigned long read_cr3(void)
 { 
-        BUG();
+       unsigned long cr3;
+       asm("movq %%cr3,%0" : "=r" (cr3));
+       return cr3;
 } 
 
 static inline unsigned long read_cr4(void)
 { 
-        BUG();
+       unsigned long cr4;
+       asm("movq %%cr4,%0" : "=r" (cr4));
+       return cr4;
 } 
 
 static inline void write_cr4(unsigned long val)
 { 
-        BUG();
+       asm volatile("movq %0,%%cr4" :: "r" (val));
 } 
+
 #define stts() (HYPERVISOR_fpu_taskswitch(1))
 
 #define wbinvd() \

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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] read/write control-reg macros are now same in xenlinux as native linux., BitKeeper Bot <=