Home | Info | Community | Development | myReactOS | Contact Us
ReactOS Development > Doxygenintrin_i.h
Go to the documentation of this file.
00001 #ifndef _INTRIN_INTERNAL_ 00002 #define _INTRIN_INTERNAL_ 00003 00004 VOID 00005 FORCEINLINE 00006 KeSetCurrentIrql(KIRQL Irql) 00007 { 00008 __writecr8(Irql); 00009 } 00010 00011 PKGDTENTRY64 00012 FORCEINLINE 00013 KiGetGdtEntry(PVOID pGdt, USHORT Selector) 00014 { 00015 return (PKGDTENTRY64)((ULONG64)pGdt + (Selector & ~RPL_MASK)); 00016 } 00017 00018 PVOID 00019 FORCEINLINE 00020 KiGetGdtDescriptorBase(PKGDTENTRY Entry) 00021 { 00022 return (PVOID)((ULONG64)Entry->BaseLow | 00023 (ULONG64)Entry->Bytes.BaseMiddle << 16 | 00024 (ULONG64)Entry->Bytes.BaseHigh << 24 | 00025 (ULONG64)Entry->BaseUpper << 32); 00026 } 00027 00028 VOID 00029 FORCEINLINE 00030 KiSetGdtDescriptorBase(PKGDTENTRY Entry, ULONG64 Base) 00031 { 00032 Entry->BaseLow = Base & 0xffff; 00033 Entry->Bits.BaseMiddle = (Base >> 16) & 0xff; 00034 Entry->Bits.BaseHigh = (Base >> 24) & 0xff; 00035 Entry->BaseUpper = Base >> 32; 00036 } 00037 00038 VOID 00039 FORCEINLINE 00040 KiSetGdtDescriptorLimit(PKGDTENTRY Entry, ULONG Limit) 00041 { 00042 Entry->LimitLow = Limit & 0xffff; 00043 Entry->Bits.LimitHigh = Limit >> 16; 00044 } 00045 00046 VOID 00047 FORCEINLINE 00048 KiInitGdtEntry(PKGDTENTRY64 Entry, ULONG64 Base, ULONG Size, UCHAR Type, UCHAR Dpl) 00049 { 00050 KiSetGdtDescriptorBase(Entry, Base); 00051 KiSetGdtDescriptorLimit(Entry, Size - 1); 00052 Entry->Bits.Type = Type; 00053 Entry->Bits.Dpl = Dpl; 00054 Entry->Bits.Present = 1; 00055 Entry->Bits.System = 0; 00056 Entry->Bits.LongMode = 0; 00057 Entry->Bits.DefaultBig = 0; 00058 Entry->Bits.Granularity = 0; 00059 Entry->MustBeZero = 0; 00060 } 00061 00062 #if defined(__GNUC__) 00063 00064 static __inline__ __attribute__((always_inline)) void __lgdt(void *Source) 00065 { 00066 __asm__ __volatile__("lgdt %0" : : "m"(*(short*)Source)); 00067 } 00068 00069 static __inline__ __attribute__((always_inline)) void __sgdt(void *Destination) 00070 { 00071 __asm__ __volatile__("sgdt %0" : : "m"(*(short*)Destination) : "memory"); 00072 } 00073 00074 static __inline__ __attribute__((always_inline)) void __lldt(unsigned short Value) 00075 { 00076 __asm__ __volatile__("lldt %0" : : "rm"(Value)); 00077 } 00078 00079 static __inline__ __attribute__((always_inline)) void __sldt(void *Destination) 00080 { 00081 __asm__ __volatile__("sldt %0" : : "m"(*(short*)Destination) : "memory"); 00082 } 00083 00084 static __inline__ __attribute__((always_inline)) void __ldmxcsr(unsigned long *Source) 00085 { 00086 __asm__ __volatile__("ldmxcsr %0" : : "m"(*Source)); 00087 } 00088 00089 static __inline__ __attribute__((always_inline)) void __stmxcsr(unsigned long *Destination) 00090 { 00091 __asm__ __volatile__("stmxcsr %0" : : "m"(*Destination) : "memory"); 00092 } 00093 00094 static __inline__ __attribute__((always_inline)) void __ltr(unsigned short Source) 00095 { 00096 __asm__ __volatile__("ltr %0" : : "rm"(Source)); 00097 } 00098 00099 static __inline__ __attribute__((always_inline)) void __str(unsigned short *Destination) 00100 { 00101 __asm__ __volatile__("str %0" : : "m"(*Destination) : "memory"); 00102 } 00103 00104 00105 #elif defined(_MSC_VER) 00106 00107 void __lgdt(void *Source); 00108 00109 void __sgdt(void *Destination); 00110 00111 void __lldt(unsigned short Value); 00112 00113 void __sldt(void *Destination); 00114 00115 void __ltr(unsigned short Source); 00116 00117 void __str(unsigned short *Destination); 00118 00119 00120 #else 00121 #error Unknown compiler for inline assembler 00122 #endif 00123 00124 #endif 00125 00126 /* EOF */ Generated on Sat May 26 2012 04:36:05 for ReactOS by
1.7.6.1
|