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

ps_x.h
Go to the documentation of this file.
00001 /*
00002 * PROJECT:         ReactOS Kernel
00003 * LICENSE:         GPL - See COPYING in the top level directory
00004 * FILE:            ntoskrnl/include/ps_x.h
00005 * PURPOSE:         Intenral Inlined Functions for the Process Manager
00006 * PROGRAMMERS:     Alex Ionescu (alex.ionescu@reactos.org)
00007 *                  Thomas Weidenmueller (w3seek@reactos.org)
00008 */
00009 
00010 //
00011 // Extract Quantum Settings from the Priority Separation Mask
00012 //
00013 #define PspPrioritySeparationFromMask(Mask)                 \
00014     ((Mask) & 3)
00015 
00016 #define PspQuantumTypeFromMask(Mask)                        \
00017     ((Mask) & 12)
00018 
00019 #define PspQuantumLengthFromMask(Mask)                      \
00020     ((Mask) & 48)
00021 
00022 //
00023 // Cross Thread Flag routines
00024 //
00025 #define PspSetCrossThreadFlag(Thread, Flag)                 \
00026     InterlockedOr((PLONG)&Thread->CrossThreadFlags, Flag)
00027 #define PspClearCrossThreadFlag(Thread, Flag)               \
00028     InterlockedAnd((PLONG)&Thread->CrossThreadFlags, ~Flag)
00029 
00030 //
00031 // Process flag routines
00032 //
00033 #define PspSetProcessFlag(Process, Flag) \
00034     InterlockedOr((PLONG)&Process->Flags, Flag)
00035 #define PspClearProcessFlag(Process, Flag) \
00036     InterlockedAnd((PLONG)&Process->Flags, ~Flag)
00037 
00038 FORCEINLINE
00039 VOID
00040 PspRunCreateThreadNotifyRoutines(IN PETHREAD CurrentThread,
00041                                  IN BOOLEAN Create)
00042 {
00043     ULONG i;
00044 
00045     /* Check if we have registered routines */
00046     if (PspThreadNotifyRoutineCount)
00047     {
00048         /* Loop callbacks */
00049         for (i = 0; i < PSP_MAX_CREATE_THREAD_NOTIFY; i++)
00050         {
00051             /* Do the callback */
00052             ExDoCallBack(&PspThreadNotifyRoutine[i],
00053                          CurrentThread->Cid.UniqueProcess,
00054                          CurrentThread->Cid.UniqueThread,
00055                          (PVOID)(ULONG_PTR)Create);
00056         }
00057     }
00058 }
00059 
00060 FORCEINLINE
00061 VOID
00062 PspRunCreateProcessNotifyRoutines(IN PEPROCESS CurrentProcess,
00063                                   IN BOOLEAN Create)
00064 {
00065     ULONG i;
00066 
00067     /* Check if we have registered routines */
00068     if (PspProcessNotifyRoutineCount)
00069     {
00070         /* Loop callbacks */
00071         for (i = 0; i < PSP_MAX_CREATE_PROCESS_NOTIFY; i++)
00072         {
00073             /* Do the callback */
00074             ExDoCallBack(&PspProcessNotifyRoutine[i],
00075                          CurrentProcess->InheritedFromUniqueProcessId,
00076                          CurrentProcess->UniqueProcessId,
00077                          (PVOID)(ULONG_PTR)Create);
00078         }
00079     }
00080 }
00081 
00082 FORCEINLINE
00083 VOID
00084 PspRunLoadImageNotifyRoutines(PUNICODE_STRING FullImageName,
00085                               HANDLE ProcessId,
00086                               PIMAGE_INFO ImageInfo)
00087 {
00088     ULONG i;
00089 
00090     /* Loop the notify routines */
00091     for (i = 0; i < PSP_MAX_LOAD_IMAGE_NOTIFY; ++ i)
00092     {
00093         /* Do the callback */
00094         ExDoCallBack(&PspLoadImageNotifyRoutine[i],
00095                      FullImageName,
00096                      ProcessId,
00097                      ImageInfo);
00098     }
00099 }
00100 
00101 FORCEINLINE
00102 VOID
00103 PspRunLegoRoutine(IN PKTHREAD Thread)
00104 {
00105     /* Call it */
00106     if (PspLegoNotifyRoutine) PspLegoNotifyRoutine(Thread);
00107 }
00108 
00109 FORCEINLINE
00110 VOID
00111 PspLockProcessSecurityShared(IN PEPROCESS Process)
00112 {
00113     /* Enter a Critical Region */
00114     KeEnterCriticalRegion();
00115 
00116     /* Lock the Process */
00117     ExAcquirePushLockShared(&Process->ProcessLock);
00118 }
00119 
00120 FORCEINLINE
00121 VOID
00122 PspUnlockProcessSecurityShared(IN PEPROCESS Process)
00123 {
00124     /* Unlock the Process */
00125     ExReleasePushLockShared(&Process->ProcessLock);
00126 
00127     /* Leave Critical Region */
00128     KeLeaveCriticalRegion();
00129 }
00130 
00131 FORCEINLINE
00132 VOID
00133 PspLockProcessSecurityExclusive(IN PEPROCESS Process)
00134 {
00135     /* Enter a Critical Region */
00136     KeEnterCriticalRegion();
00137 
00138     /* Lock the Process */
00139     ExAcquirePushLockExclusive(&Process->ProcessLock);
00140 }
00141 
00142 FORCEINLINE
00143 VOID
00144 PspUnlockProcessSecurityExclusive(IN PEPROCESS Process)
00145 {
00146     /* Unlock the Process */
00147     ExReleasePushLockExclusive(&Process->ProcessLock);
00148 
00149     /* Leave Critical Region */
00150     KeLeaveCriticalRegion();
00151 }
00152 
00153 FORCEINLINE
00154 VOID
00155 PspLockThreadSecurityShared(IN PETHREAD Thread)
00156 {
00157     /* Enter a Critical Region */
00158     KeEnterCriticalRegion();
00159 
00160     /* Lock the Thread */
00161     ExAcquirePushLockShared(&Thread->ThreadLock);
00162 }
00163 
00164 FORCEINLINE
00165 VOID
00166 PspUnlockThreadSecurityShared(IN PETHREAD Thread)
00167 {
00168     /* Unlock the Thread */
00169     ExReleasePushLockShared(&Thread->ThreadLock);
00170 
00171     /* Leave Critical Region */
00172     KeLeaveCriticalRegion();
00173 }
00174 
00175 FORCEINLINE
00176 VOID
00177 PspLockThreadSecurityExclusive(IN PETHREAD Thread)
00178 {
00179     /* Enter a Critical Region */
00180     KeEnterCriticalRegion();
00181 
00182     /* Lock the Thread */
00183     ExAcquirePushLockExclusive(&Thread->ThreadLock);
00184 }
00185 
00186 FORCEINLINE
00187 VOID
00188 PspUnlockThreadSecurityExclusive(IN PETHREAD Thread)
00189 {
00190     /* Unlock the Process */
00191     ExReleasePushLockExclusive(&Thread->ThreadLock);
00192 
00193     /* Leave Critical Thread */
00194     KeLeaveCriticalRegion();
00195 }
00196 
00197 FORCEINLINE
00198 PEPROCESS
00199 _PsGetCurrentProcess(VOID)
00200 {
00201     /* Get the current process */
00202     return (PEPROCESS)KeGetCurrentThread()->ApcState.Process;
00203 }

Generated on Sun May 27 2012 04:37:15 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.