ReactOS Fundraising Campaign 2012
 
€ 4,410 / € 30,000

Information | Donate

Home | Info | Community | Development | myReactOS | Contact Us

  1. Home
  2. Community
  3. Development
  4. myReactOS
  5. Fundraiser 2012

  1. Main Page
  2. Alphabetical List
  3. Data Structures
  4. Directories
  5. File List
  6. Data Fields
  7. Globals
  8. Related Pages

ReactOS Development > Doxygen

ke.h
Go to the documentation of this file.
00001 $if (_WDMDDK_)
00004 /* Interrupt request levels */
00005 #define PASSIVE_LEVEL           0
00006 #define LOW_LEVEL               0
00007 #define APC_LEVEL               1
00008 #define DISPATCH_LEVEL          2
00009 #define CMCI_LEVEL              5
00010 #define CLOCK_LEVEL             13
00011 #define IPI_LEVEL               14
00012 #define DRS_LEVEL               14
00013 #define POWER_LEVEL             14
00014 #define PROFILE_LEVEL           15
00015 #define HIGH_LEVEL              15
00016 
00017 #define KI_USER_SHARED_DATA     0xFFFFF78000000000ULL
00018 #define SharedUserData          ((PKUSER_SHARED_DATA const)KI_USER_SHARED_DATA)
00019 #define SharedInterruptTime     (KI_USER_SHARED_DATA + 0x8)
00020 #define SharedSystemTime        (KI_USER_SHARED_DATA + 0x14)
00021 #define SharedTickCount         (KI_USER_SHARED_DATA + 0x320)
00022 
00023 #define PAGE_SIZE               0x1000
00024 #define PAGE_SHIFT              12L
00025 
00026 #define EFLAG_SIGN              0x8000
00027 #define EFLAG_ZERO              0x4000
00028 #define EFLAG_SELECT            (EFLAG_SIGN | EFLAG_ZERO)
00029 
00030 typedef struct _KFLOATING_SAVE {
00031   ULONG Dummy;
00032 } KFLOATING_SAVE, *PKFLOATING_SAVE;
00033 
00034 typedef XSAVE_FORMAT XMM_SAVE_AREA32, *PXMM_SAVE_AREA32;
00035 
00036 #define KeQueryInterruptTime() \
00037     (*(volatile ULONG64*)SharedInterruptTime)
00038 
00039 #define KeQuerySystemTime(CurrentCount) \
00040     *(ULONG64*)(CurrentCount) = *(volatile ULONG64*)SharedSystemTime
00041 
00042 #define KeQueryTickCount(CurrentCount) \
00043     *(ULONG64*)(CurrentCount) = *(volatile ULONG64*)SharedTickCount
00044 
00045 #define KeGetDcacheFillSize() 1L
00046 
00047 #define YieldProcessor _mm_pause
00048 #define FastFence __faststorefence
00049 #define LoadFence _mm_lfence
00050 #define MemoryFence _mm_mfence
00051 #define StoreFence _mm_sfence
00052 #define LFENCE_ACQUIRE() LoadFence()
00053 
00054 FORCEINLINE
00055 VOID
00056 KeMemoryBarrier(VOID)
00057 {
00058   // FIXME: Do we really need lfence after the __faststorefence ?
00059   FastFence();
00060   LFENCE_ACQUIRE();
00061 }
00062 
00063 #define KeMemoryBarrierWithoutFence() _ReadWriteBarrier()
00064 
00065 FORCEINLINE
00066 KIRQL
00067 KeGetCurrentIrql(VOID)
00068 {
00069   return (KIRQL)__readcr8();
00070 }
00071 
00072 FORCEINLINE
00073 VOID
00074 KeLowerIrql(IN KIRQL NewIrql)
00075 {
00076   ASSERT((KIRQL)__readcr8() >= NewIrql);
00077   __writecr8(NewIrql);
00078 }
00079 
00080 FORCEINLINE
00081 KIRQL
00082 KfRaiseIrql(IN KIRQL NewIrql)
00083 {
00084   KIRQL OldIrql;
00085 
00086   OldIrql = (KIRQL)__readcr8();
00087   ASSERT(OldIrql <= NewIrql);
00088   __writecr8(NewIrql);
00089   return OldIrql;
00090 }
00091 #define KeRaiseIrql(a,b) *(b) = KfRaiseIrql(a)
00092 
00093 FORCEINLINE
00094 KIRQL
00095 KeRaiseIrqlToDpcLevel(VOID)
00096 {
00097   return KfRaiseIrql(DISPATCH_LEVEL);
00098 }
00099 
00100 FORCEINLINE
00101 KIRQL
00102 KeRaiseIrqlToSynchLevel(VOID)
00103 {
00104   return KfRaiseIrql(12); // SYNCH_LEVEL = IPI_LEVEL - 2
00105 }
00106 
00107 FORCEINLINE
00108 PKTHREAD
00109 KeGetCurrentThread(VOID)
00110 {
00111   return (struct _KTHREAD *)__readgsqword(0x188);
00112 }
00113 
00114 FORCEINLINE
00115 NTSTATUS
00116 KeSaveFloatingPointState(PVOID FloatingState)
00117 {
00118   UNREFERENCED_PARAMETER(FloatingState);
00119   return STATUS_SUCCESS;
00120 }
00121 
00122 FORCEINLINE
00123 NTSTATUS
00124 KeRestoreFloatingPointState(PVOID FloatingState)
00125 {
00126   UNREFERENCED_PARAMETER(FloatingState);
00127   return STATUS_SUCCESS;
00128 }
00129 
00130 /* VOID
00131  * KeFlushIoBuffers(
00132  *   IN PMDL Mdl,
00133  *   IN BOOLEAN ReadOperation,
00134  *   IN BOOLEAN DmaOperation)
00135  */
00136 #define KeFlushIoBuffers(_Mdl, _ReadOperation, _DmaOperation)
00137 
00138 /* x86 and x64 performs a 0x2C interrupt */
00139 #define DbgRaiseAssertionFailure __int2c
00140 
00141 $endif /* _WDMDDK_ */
00142 $if (_NTDDK_)
00143 
00144 #define PAUSE_PROCESSOR YieldProcessor();
00145 
00146 #define KERNEL_STACK_SIZE 0x6000
00147 #define KERNEL_LARGE_STACK_SIZE 0x12000
00148 #define KERNEL_LARGE_STACK_COMMIT KERNEL_STACK_SIZE
00149 
00150 #define KERNEL_MCA_EXCEPTION_STACK_SIZE 0x2000
00151 
00152 #define EXCEPTION_READ_FAULT    0
00153 #define EXCEPTION_WRITE_FAULT   1
00154 #define EXCEPTION_EXECUTE_FAULT 8
00155 
00156 #if !defined(RC_INVOKED)
00157 
00158 #define CONTEXT_AMD64 0x100000
00159 
00160 #define CONTEXT_CONTROL (CONTEXT_AMD64 | 0x1L)
00161 #define CONTEXT_INTEGER (CONTEXT_AMD64 | 0x2L)
00162 #define CONTEXT_SEGMENTS (CONTEXT_AMD64 | 0x4L)
00163 #define CONTEXT_FLOATING_POINT (CONTEXT_AMD64 | 0x8L)
00164 #define CONTEXT_DEBUG_REGISTERS (CONTEXT_AMD64 | 0x10L)
00165 
00166 #define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_INTEGER | CONTEXT_FLOATING_POINT)
00167 #define CONTEXT_ALL (CONTEXT_CONTROL | CONTEXT_INTEGER | CONTEXT_SEGMENTS | CONTEXT_FLOATING_POINT | CONTEXT_DEBUG_REGISTERS)
00168 
00169 #define CONTEXT_XSTATE (CONTEXT_AMD64 | 0x20L)
00170 
00171 #define CONTEXT_EXCEPTION_ACTIVE 0x8000000
00172 #define CONTEXT_SERVICE_ACTIVE 0x10000000
00173 #define CONTEXT_EXCEPTION_REQUEST 0x40000000
00174 #define CONTEXT_EXCEPTION_REPORTING 0x80000000
00175 
00176 #endif /* !defined(RC_INVOKED) */
00177 
00178 #define INITIAL_MXCSR                  0x1f80
00179 #define INITIAL_FPCSR                  0x027f
00180 
00181 typedef struct DECLSPEC_ALIGN(16) _CONTEXT {
00182   ULONG64 P1Home;
00183   ULONG64 P2Home;
00184   ULONG64 P3Home;
00185   ULONG64 P4Home;
00186   ULONG64 P5Home;
00187   ULONG64 P6Home;
00188   ULONG ContextFlags;
00189   ULONG MxCsr;
00190   USHORT SegCs;
00191   USHORT SegDs;
00192   USHORT SegEs;
00193   USHORT SegFs;
00194   USHORT SegGs;
00195   USHORT SegSs;
00196   ULONG EFlags;
00197   ULONG64 Dr0;
00198   ULONG64 Dr1;
00199   ULONG64 Dr2;
00200   ULONG64 Dr3;
00201   ULONG64 Dr6;
00202   ULONG64 Dr7;
00203   ULONG64 Rax;
00204   ULONG64 Rcx;
00205   ULONG64 Rdx;
00206   ULONG64 Rbx;
00207   ULONG64 Rsp;
00208   ULONG64 Rbp;
00209   ULONG64 Rsi;
00210   ULONG64 Rdi;
00211   ULONG64 R8;
00212   ULONG64 R9;
00213   ULONG64 R10;
00214   ULONG64 R11;
00215   ULONG64 R12;
00216   ULONG64 R13;
00217   ULONG64 R14;
00218   ULONG64 R15;
00219   ULONG64 Rip;
00220   union {
00221     XMM_SAVE_AREA32 FltSave;
00222     struct {
00223       M128A Header[2];
00224       M128A Legacy[8];
00225       M128A Xmm0;
00226       M128A Xmm1;
00227       M128A Xmm2;
00228       M128A Xmm3;
00229       M128A Xmm4;
00230       M128A Xmm5;
00231       M128A Xmm6;
00232       M128A Xmm7;
00233       M128A Xmm8;
00234       M128A Xmm9;
00235       M128A Xmm10;
00236       M128A Xmm11;
00237       M128A Xmm12;
00238       M128A Xmm13;
00239       M128A Xmm14;
00240       M128A Xmm15;
00241     } DUMMYSTRUCTNAME;
00242   } DUMMYUNIONNAME;
00243   M128A VectorRegister[26];
00244   ULONG64 VectorControl;
00245   ULONG64 DebugControl;
00246   ULONG64 LastBranchToRip;
00247   ULONG64 LastBranchFromRip;
00248   ULONG64 LastExceptionToRip;
00249   ULONG64 LastExceptionFromRip;
00250 } CONTEXT;
00251 
00252 #define PCR_MINOR_VERSION 1
00253 #define PCR_MAJOR_VERSION 1
00254 
00255 typedef struct _KPCR
00256 {
00257     _ANONYMOUS_UNION union
00258     {
00259         NT_TIB NtTib;
00260         _ANONYMOUS_STRUCT struct
00261         {
00262             union _KGDTENTRY64 *GdtBase;
00263             struct _KTSS64 *TssBase;
00264             ULONG64 UserRsp;
00265             struct _KPCR *Self;
00266             struct _KPRCB *CurrentPrcb;
00267             PKSPIN_LOCK_QUEUE LockArray;
00268             PVOID Used_Self;
00269         };
00270     };
00271     union _KIDTENTRY64 *IdtBase;
00272     ULONG64 Unused[2];
00273     KIRQL Irql;
00274     UCHAR SecondLevelCacheAssociativity;
00275     UCHAR ObsoleteNumber;
00276     UCHAR Fill0;
00277     ULONG Unused0[3];
00278     USHORT MajorVersion;
00279     USHORT MinorVersion;
00280     ULONG StallScaleFactor;
00281     PVOID Unused1[3];
00282     ULONG KernelReserved[15];
00283     ULONG SecondLevelCacheSize;
00284     ULONG HalReserved[16];
00285     ULONG Unused2;
00286     PVOID KdVersionBlock;
00287     PVOID Unused3;
00288     ULONG PcrAlign1[24];
00289 } KPCR, *PKPCR;
00290 
00291 FORCEINLINE
00292 PKPCR
00293 KeGetPcr(VOID)
00294 {
00295     return (PKPCR)__readgsqword(FIELD_OFFSET(KPCR, Self));
00296 }
00297 
00298 FORCEINLINE
00299 ULONG
00300 KeGetCurrentProcessorNumber(VOID)
00301 {
00302     return (ULONG)__readgsword(0x184);
00303 }
00304 
00305 $endif /* _NTDDK_ */

Generated on Sat May 26 2012 04:32:13 for ReactOS by doxygen 1.7.6.1

ReactOS is a registered trademark or a trademark of ReactOS Foundation in the United States and other countries.