[ros-diffs] [tkreuzer] 35618: Add X86_MSR constants, implement __lgdt, __sgdt, __lldt, __sldt, __ldmxcsr, __stmxcsr, __ltr, __str intrinsics.

tkreuzer at svn.reactos.org tkreuzer at svn.reactos.org
Mon Aug 25 02:10:16 CEST 2008


Author: tkreuzer
Date: Sun Aug 24 19:10:15 2008
New Revision: 35618

URL: http://svn.reactos.org/svn/reactos?rev=35618&view=rev
Log:
Add X86_MSR constants, implement __lgdt, __sgdt, __lldt, __sldt, __ldmxcsr, __stmxcsr, __ltr, __str intrinsics.

Modified:
    branches/ros-amd64-bringup/reactos/ntoskrnl/include/internal/amd64/intrin_i.h
    branches/ros-amd64-bringup/reactos/ntoskrnl/include/internal/amd64/ke.h

Modified: branches/ros-amd64-bringup/reactos/ntoskrnl/include/internal/amd64/intrin_i.h
URL: http://svn.reactos.org/svn/reactos/branches/ros-amd64-bringup/reactos/ntoskrnl/include/internal/amd64/intrin_i.h?rev=35618&r1=35617&r2=35618&view=diff
==============================================================================
--- branches/ros-amd64-bringup/reactos/ntoskrnl/include/internal/amd64/intrin_i.h [iso-8859-1] (original)
+++ branches/ros-amd64-bringup/reactos/ntoskrnl/include/internal/amd64/intrin_i.h [iso-8859-1] Sun Aug 24 19:10:15 2008
@@ -11,25 +11,45 @@
 
 #if defined(__GNUC__)
 
-#define Ke386SetInterruptDescriptorTable(X) \
-    __asm__("lidt %0\n\t" \
-    : /* no outputs */ \
-    : "m" (X));
-
-#define Ke386GetInterruptDescriptorTable(X) \
-    __asm__("sidt %0\n\t" \
-    : /* no outputs */ \
-    : "m" (X));
-
-#define Ke386SetGlobalDescriptorTable(X) \
-    __asm__("lgdt %0\n\t" \
-    : /* no outputs */ \
-    : "m" (X));
-
-#define Ke386GetGlobalDescriptorTable(X) \
-    __asm__("sgdt %0\n\t" \
-    : /* no outputs */ \
-    : "m" (X));
+static __inline__ __attribute__((always_inline)) void __lgdt(void *Source)
+{
+	__asm__ __volatile__("lgdt %0" : : "m"(*(short*)Source));
+}
+
+static __inline__ __attribute__((always_inline)) void __sgdt(void *Destination)
+{
+	__asm__ __volatile__("sgdt %0" : : "m"(*(short*)Destination) : "memory");
+}
+
+static __inline__ __attribute__((always_inline)) void __lldt(void *Source)
+{
+	__asm__ __volatile__("lldt %0" : : "m"(*(short*)Source));
+}
+
+static __inline__ __attribute__((always_inline)) void __sldt(void *Destination)
+{
+	__asm__ __volatile__("sldt %0" : : "m"(*(short*)Destination) : "memory");
+}
+
+static __inline__ __attribute__((always_inline)) void __ldmxcsr(unsigned long *Source)
+{
+	__asm__ __volatile__("ldmxcsr %0" : : "m"(*Source));
+}
+
+static __inline__ __attribute__((always_inline)) void __stmxcsr(unsigned long *Destination)
+{
+	__asm__ __volatile__("stmxcsr %0" : : "m"(*Destination) : "memory");
+}
+
+static __inline__ __attribute__((always_inline)) void __ltr(unsigned short *Source)
+{
+	__asm__ __volatile__("ltr %0" : : "m"(*Source));
+}
+
+static __inline__ __attribute__((always_inline)) void __str(unsigned short *Destination)
+{
+	__asm__ __volatile__("str %0" : : "m"(*Destination) : "memory");
+}
 
 #define Ke386GetLocalDescriptorTable(X) \
     __asm__("sldt %0\n\t" \
@@ -61,7 +81,7 @@
 
 #define _Ke386GetDr(N)           ({ \
                                      unsigned int __d; \
-                                     __asm__("movl %%dr" #N ",%0\n\t" :"=r" (__d)); \
+                                     __asm__("movq %%dr" #N ",%0\n\t" :"=r" (__d)); \
                                      __d; \
                                  })
 

Modified: branches/ros-amd64-bringup/reactos/ntoskrnl/include/internal/amd64/ke.h
URL: http://svn.reactos.org/svn/reactos/branches/ros-amd64-bringup/reactos/ntoskrnl/include/internal/amd64/ke.h?rev=35618&r1=35617&r2=35618&view=diff
==============================================================================
--- branches/ros-amd64-bringup/reactos/ntoskrnl/include/internal/amd64/ke.h [iso-8859-1] (original)
+++ branches/ros-amd64-bringup/reactos/ntoskrnl/include/internal/amd64/ke.h [iso-8859-1] Sun Aug 24 19:10:15 2008
@@ -45,6 +45,10 @@
 
 #define X86_MSR_GSBASE          0xC0000101
 #define X86_MSR_KERNEL_GSBASE   0xC0000102
+#define X86_MSR_STAR            0xC0000081
+#define X86_MSR_LSTAR           0xC0000082
+#define X86_MSR_CSTAR           0xC0000083
+#define X86_MSR_SFMASK          0xC0000084
 
 #ifndef __ASM__
 



More information about the Ros-diffs mailing list