1 /* 2 * COPYRIGHT: See COPYING in the top level directory 3 * PROJECT: ReactOS System Libraries 4 * FILE: lib/rtl/rtlp.h 5 * PURPOSE: Run-Time Libary Internal Header 6 * PROGRAMMER: Alex Ionescu 7 */ 8 9 /* INCLUDES ******************************************************************/ 10 11 /* PAGED_CODE equivalent for user-mode RTL */ 12 #if DBG 13 extern VOID FASTCALL CHECK_PAGED_CODE_RTL(char *file, int line); 14 #define PAGED_CODE_RTL() CHECK_PAGED_CODE_RTL(__FILE__, __LINE__) 15 #else 16 #define PAGED_CODE_RTL() 17 #endif 18 19 #ifdef _PPC_ 20 #define SWAPD(x) ((((x)&0xff)<<24)|(((x)&0xff00)<<8)|(((x)>>8)&0xff00)|(((x)>>24)&0xff)) 21 #define SWAPW(x) ((((x)&0xff)<<8)|(((x)>>8)&0xff)) 22 #define SWAPQ(x) ((SWAPD((x)&0xffffffff) << 32) | (SWAPD((x)>>32))) 23 #else 24 #define SWAPD(x) (x) 25 #define SWAPW(x) (x) 26 #define SWAPQ(x) (x) 27 #endif 28 29 #define ROUND_DOWN(n, align) \ 30 (((ULONG)(n)) & ~((align) - 1l)) 31 32 #define ROUND_UP(n, align) \ 33 ROUND_DOWN(((ULONG)(n)) + (align) - 1, (align)) 34 35 #define RVA(m, b) ((PVOID)((ULONG_PTR)(b) + (ULONG_PTR)(m))) 36 37 extern PVOID MmHighestUserAddress; 38 39 NTSTATUS 40 NTAPI 41 RtlpSafeCopyMemory( 42 _Out_writes_bytes_all_(Length) VOID UNALIGNED *Destination, 43 _In_reads_bytes_(Length) CONST VOID UNALIGNED *Source, 44 _In_ SIZE_T Length); 45 46 VOID 47 NTAPI 48 RtlpGetStackLimits(PULONG_PTR LowLimit, 49 PULONG_PTR HighLimit); 50 51 PEXCEPTION_REGISTRATION_RECORD 52 NTAPI 53 RtlpGetExceptionList(VOID); 54 55 VOID 56 NTAPI 57 RtlpSetHeapParameters(IN PRTL_HEAP_PARAMETERS Parameters); 58 59 VOID 60 NTAPI 61 RtlpSetExceptionList(PEXCEPTION_REGISTRATION_RECORD NewExceptionList); 62 63 BOOLEAN 64 NTAPI 65 RtlCallVectoredExceptionHandlers( 66 IN PEXCEPTION_RECORD ExceptionRecord, 67 IN PCONTEXT Context 68 ); 69 70 VOID 71 NTAPI 72 RtlCallVectoredContinueHandlers( 73 IN PEXCEPTION_RECORD ExceptionRecord, 74 IN PCONTEXT Context 75 ); 76 77 typedef struct _DISPATCHER_CONTEXT 78 { 79 PEXCEPTION_REGISTRATION_RECORD RegistrationPointer; 80 } DISPATCHER_CONTEXT, *PDISPATCHER_CONTEXT; 81 82 /* These provide support for sharing code between User and Kernel RTL */ 83 PVOID 84 NTAPI 85 RtlpAllocateMemory( 86 SIZE_T Bytes, 87 ULONG Tag); 88 89 VOID 90 NTAPI 91 RtlpFreeMemory( 92 PVOID Mem, 93 ULONG Tag); 94 95 KPROCESSOR_MODE 96 NTAPI 97 RtlpGetMode(VOID); 98 99 BOOLEAN 100 NTAPI 101 RtlpCaptureStackLimits( 102 IN ULONG_PTR Ebp, 103 IN ULONG_PTR *StackBegin, 104 IN ULONG_PTR *StackEnd 105 ); 106 107 NTSTATUS 108 NTAPI 109 RtlDeleteHeapLock(IN OUT PHEAP_LOCK Lock); 110 111 NTSTATUS 112 NTAPI 113 RtlEnterHeapLock(IN OUT PHEAP_LOCK Lock, IN BOOLEAN Exclusive); 114 115 BOOLEAN 116 NTAPI 117 RtlTryEnterHeapLock(IN OUT PHEAP_LOCK Lock, IN BOOLEAN Exclusive); 118 119 NTSTATUS 120 NTAPI 121 RtlInitializeHeapLock(IN OUT PHEAP_LOCK *Lock); 122 123 NTSTATUS 124 NTAPI 125 RtlLeaveHeapLock(IN OUT PHEAP_LOCK Lock); 126 127 BOOLEAN 128 NTAPI 129 RtlpCheckForActiveDebugger(VOID); 130 131 BOOLEAN 132 NTAPI 133 RtlpHandleDpcStackException(IN PEXCEPTION_REGISTRATION_RECORD RegistrationFrame, 134 IN ULONG_PTR RegistrationFrameEnd, 135 IN OUT PULONG_PTR StackLow, 136 IN OUT PULONG_PTR StackHigh); 137 138 #define RtlpAllocateStringMemory RtlpAllocateMemory 139 #define RtlpFreeStringMemory RtlpFreeMemory 140 141 ULONG 142 NTAPI 143 RtlGetTickCount(VOID); 144 #define NtGetTickCount RtlGetTickCount 145 146 BOOLEAN 147 NTAPI 148 RtlpSetInDbgPrint( 149 VOID 150 ); 151 152 VOID 153 NTAPI 154 RtlpClearInDbgPrint( 155 VOID 156 ); 157 158 /* i386/except.S */ 159 160 EXCEPTION_DISPOSITION 161 NTAPI 162 RtlpExecuteHandlerForException(PEXCEPTION_RECORD ExceptionRecord, 163 PEXCEPTION_REGISTRATION_RECORD RegistrationFrame, 164 PCONTEXT Context, 165 PVOID DispatcherContext, 166 PEXCEPTION_ROUTINE ExceptionHandler); 167 168 EXCEPTION_DISPOSITION 169 NTAPI 170 RtlpExecuteHandlerForUnwind(PEXCEPTION_RECORD ExceptionRecord, 171 PEXCEPTION_REGISTRATION_RECORD RegistrationFrame, 172 PCONTEXT Context, 173 PVOID DispatcherContext, 174 PEXCEPTION_ROUTINE ExceptionHandler); 175 176 VOID 177 NTAPI 178 RtlpCheckLogException(IN PEXCEPTION_RECORD ExceptionRecord, 179 IN PCONTEXT ContextRecord, 180 IN PVOID ContextData, 181 IN ULONG Size); 182 183 VOID 184 NTAPI 185 RtlpCaptureContext(OUT PCONTEXT ContextRecord); 186 187 // 188 // Debug Service calls 189 // 190 ULONG 191 NTAPI 192 DebugService( 193 IN ULONG Service, 194 IN PVOID Argument1, 195 IN PVOID Argument2, 196 IN PVOID Argument3, 197 IN PVOID Argument4 198 ); 199 200 VOID 201 NTAPI 202 DebugService2( 203 IN PVOID Argument1, 204 IN PVOID Argument2, 205 IN ULONG Service 206 ); 207 208 /* Tags for the String Allocators */ 209 #define TAG_USTR 'RTSU' 210 #define TAG_ASTR 'RTSA' 211 #define TAG_OSTR 'RTSO' 212 213 /* Timer Queue */ 214 215 extern HANDLE TimerThreadHandle; 216 217 NTSTATUS 218 RtlpInitializeTimerThread(VOID); 219 220 /* bitmap64.c */ 221 typedef struct _RTL_BITMAP64 222 { 223 ULONG64 SizeOfBitMap; 224 PULONG64 Buffer; 225 } RTL_BITMAP64, *PRTL_BITMAP64; 226 227 typedef struct _RTL_BITMAP_RUN64 228 { 229 ULONG64 StartingIndex; 230 ULONG64 NumberOfBits; 231 } RTL_BITMAP_RUN64, *PRTL_BITMAP_RUN64; 232 233 /* nls.c */ 234 WCHAR 235 NTAPI 236 RtlpUpcaseUnicodeChar(IN WCHAR Source); 237 238 WCHAR 239 NTAPI 240 RtlpDowncaseUnicodeChar(IN WCHAR Source); 241 242 /* EOF */ 243