[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] read/write control-reg macros are now same in xenlinux as native linux.
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
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |