Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

361 lines
20 KiB

  1. /*** data.c - Global Data
  2. *
  3. * This module contains global data declaration.
  4. *
  5. * Copyright (c) 1996,1997 Microsoft Corporation
  6. * Author: Michael Tsang (MikeTs)
  7. * Created 08/14/96
  8. *
  9. * MODIFICATION HISTORY
  10. */
  11. #include "pch.h"
  12. #ifdef LOCKABLE_PRAGMA
  13. #pragma ACPI_LOCKABLE_DATA
  14. #pragma ACPI_LOCKABLE_CODE
  15. #endif
  16. #ifdef DEBUG
  17. ULONG gdwcMemObjs = 0;
  18. ULONG gdwcHPObjs = 0;
  19. ULONG gdwcODObjs = 0;
  20. ULONG gdwcNSObjs = 0;
  21. ULONG gdwcOOObjs = 0;
  22. ULONG gdwcBFObjs = 0;
  23. ULONG gdwcSDObjs = 0;
  24. ULONG gdwcBDObjs = 0;
  25. ULONG gdwcPKObjs = 0;
  26. ULONG gdwcFUObjs = 0;
  27. ULONG gdwcKFObjs = 0;
  28. ULONG gdwcFObjs = 0;
  29. ULONG gdwcIFObjs = 0;
  30. ULONG gdwcORObjs = 0;
  31. ULONG gdwcMTObjs = 0;
  32. ULONG gdwcEVObjs = 0;
  33. ULONG gdwcMEObjs = 0;
  34. ULONG gdwcPRObjs = 0;
  35. ULONG gdwcPCObjs = 0;
  36. ULONG gdwcRSObjs = 0;
  37. ULONG gdwcSYObjs = 0;
  38. ULONG gdwcPHObjs = 0;
  39. ULONG gdwcCRObjs = 0;
  40. ULONG gdwGlobalHeapSize = 0;
  41. ULONG gdwLocalHeapMax = 0;
  42. ULONG gdwLocalStackMax = 0;
  43. ULONG gdwGHeapSnapshot = 0;
  44. KSPIN_LOCK gdwGHeapSpinLock;
  45. #endif
  46. LONG gdwcCTObjs = 0;
  47. ULONG gdwcCTObjsMax = 0;
  48. KSPIN_LOCK gdwGContextSpinLock;
  49. NPAGED_LOOKASIDE_LIST AMLIContextLookAsideList;
  50. #ifdef TRACING
  51. PSZ gpszTrigPts = NULL;
  52. #endif
  53. ULONG gdwfAMLI = 0;
  54. ULONG gdwfAMLIInit = 0;
  55. ULONG gdwfHacks = 0;
  56. ULONG gdwCtxtBlkSize = DEF_CTXTBLK_SIZE;
  57. ULONG gdwGlobalHeapBlkSize = DEF_GLOBALHEAPBLK_SIZE;
  58. PNSOBJ gpnsNameSpaceRoot = NULL;
  59. PHEAP gpheapGlobal = NULL;
  60. PLIST gplistCtxtHead = NULL;
  61. PLIST gplistObjOwners = NULL;
  62. PLIST gplistDefuncNSObjs = NULL;
  63. PRSACCESS gpRSAccessHead = NULL;
  64. EVHANDLE ghNotify = {0};
  65. EVHANDLE ghValidateTable = {0};
  66. EVHANDLE ghFatal = {0};
  67. EVHANDLE ghGlobalLock = {0};
  68. EVHANDLE ghCreate = {0};
  69. EVHANDLE ghDestroyObj = {0};
  70. CTXTQ gReadyQueue = {0};
  71. MUTEX gmutCtxtList = {0};
  72. MUTEX gmutOwnerList = {0};
  73. MUTEX gmutHeap = {0};
  74. ULONG gdwHighestOSVerQueried = 0;
  75. PHAL_AMLI_BAD_IO_ADDRESS_LIST gpBadIOAddressList = NULL;
  76. PULONG gpBadIOErrorLogDoneList = NULL;
  77. ULONG gOverrideFlags = 0;
  78. BOOLEAN gInitTime = FALSE;
  79. //
  80. // Sleep specific data structures
  81. //
  82. MUTEX gmutSleep = {0};
  83. KDPC SleepDpc = {0};
  84. KTIMER SleepTimer = {0};
  85. LIST_ENTRY SleepQueue = {0};
  86. #define VL OF_VARIABLE_LIST
  87. #define AO OF_ARG_OBJECT
  88. #define LO OF_LOCAL_OBJECT
  89. #define DO OF_DATA_OBJECT
  90. #define SO OF_STRING_OBJECT
  91. #define BO OF_DEBUG_OBJECT
  92. #define NO OF_NAME_OBJECT
  93. #define RO OF_REF_OBJECT
  94. #define NS TC_NAMESPACE_MODIFIER
  95. #define OB TC_NAMED_OBJECT
  96. #define C1 TC_OPCODE_TYPE1
  97. #define C2 TC_OPCODE_TYPE2
  98. #define OT TC_OTHER
  99. AMLTERM
  100. //
  101. // Name Space Modifiers
  102. //
  103. atAlias = {"Alias", OP_ALIAS, "NN", NS, 0, NULL, 0, Alias},
  104. atName = {"Name", OP_NAME, "NO", NS, 0, NULL, 0, Name},
  105. atScope = {"Scope", OP_SCOPE, "N", NS, VL, NULL, 0, Scope},
  106. //
  107. // Named Object Creators
  108. //
  109. atBankField = {"BankField", OP_BANKFIELD, "NNCB", OB, VL, NULL, 0, BankField},
  110. atBitField = {"CreateBitField", OP_BITFIELD, "CCN", OB, 0, NULL, 0, CreateBitField},
  111. atByteField = {"CreateByteField", OP_BYTEFIELD, "CCN", OB, 0, NULL, 0, CreateByteField},
  112. atDWordField = {"CreateDWordField",OP_DWORDFIELD, "CCN", OB, 0, NULL, 0, CreateDWordField},
  113. atCreateField = {"CreateField", OP_CREATEFIELD, "CCCN", OB, 0, NULL, 0, CreateField},
  114. atWordField = {"CreateWordField", OP_WORDFIELD, "CCN", OB, 0, NULL, 0, CreateWordField},
  115. atDevice = {"Device", OP_DEVICE, "N", OB, VL, NULL, 0, Device},
  116. atEvent = {"Event", OP_EVENT, "N", OB, 0, NULL, 0, Event},
  117. atField = {"Field", OP_FIELD, "NB", OB, VL, NULL, 0, Field},
  118. atIndexField = {"IndexField", OP_IDXFIELD, "NNB", OB, VL, NULL, 0, IndexField},
  119. atMethod = {"Method", OP_METHOD, "NB", OB, VL, NULL, 0, Method},
  120. atMutex = {"Mutex", OP_MUTEX, "NB", OB, 0, NULL, 0, Mutex},
  121. atOpRegion = {"OperationRegion", OP_OPREGION, "NBCC", OB, 0, NULL, 0, OpRegion},
  122. atPowerRes = {"PowerResource", OP_POWERRES, "NBW", OB, VL, NULL, 0, PowerRes},
  123. atProcessor = {"Processor", OP_PROCESSOR, "NBDB", OB, VL, NULL, 0, Processor},
  124. atThermalZone = {"ThermalZone", OP_THERMALZONE, "N", OB, VL, NULL, 0, ThermalZone},
  125. //
  126. // Type 1 Opcodes
  127. //
  128. atBreak = {"Break", OP_BREAK, NULL, C1, 0, NULL, 0, Break},
  129. atBreakPoint = {"BreakPoint", OP_BREAKPOINT, NULL, C1, 0, NULL, 0, BreakPoint},
  130. atElse = {"Else", OP_ELSE, NULL, C1, VL, NULL, 0, IfElse},
  131. atFatal = {"Fatal", OP_FATAL, "BDC", C1, 0, NULL, 0, Fatal},
  132. atIf = {"If", OP_IF, "C", C1, VL, NULL, 0, IfElse},
  133. atLoad = {"Load", OP_LOAD, "NS", C1, 0, NULL, 0, Load},
  134. atNOP = {"NoOp", OP_NOP, NULL, C1, 0, NULL, 0, NULL},
  135. atNotify = {"Notify", OP_NOTIFY, "SC", C1, 0, NULL, 0, Notify},
  136. atRelease = {"Release", OP_RELEASE, "S", C1, 0, NULL, 0, ReleaseResetSignalUnload},
  137. atReset = {"Reset", OP_RESET, "S", C1, 0, NULL, 0, ReleaseResetSignalUnload},
  138. atReturn = {"Return", OP_RETURN, "C", C1, 0, NULL, 0, Return},
  139. atSignal = {"Signal", OP_SIGNAL, "S", C1, 0, NULL, 0, ReleaseResetSignalUnload},
  140. atSleep = {"Sleep", OP_SLEEP, "C", C1, 0, NULL, 0, SleepStall},
  141. atStall = {"Stall", OP_STALL, "C", C1, 0, NULL, 0, SleepStall},
  142. atUnload = {"Unload", OP_UNLOAD, "S", C1, 0, NULL, 0, ReleaseResetSignalUnload},
  143. atWhile = {"While", OP_WHILE, "C", C1, VL, NULL, 0, While},
  144. //
  145. // Type 2 Opcodes
  146. //
  147. atAcquire = {"Acquire", OP_ACQUIRE, "SW", C2, 0, NULL, 0, Acquire},
  148. atAdd = {"Add", OP_ADD, "CCS", C2, 0, NULL, 0, ExprOp2},
  149. atAnd = {"And", OP_AND, "CCS", C2, 0, NULL, 0, ExprOp2},
  150. atBuffer = {"Buffer", OP_BUFFER, "C", C2, VL, NULL, 0, Buffer},
  151. atConcat = {"Concatenate", OP_CONCAT, "CCS", C2, 0, NULL, 0, Concat},
  152. atCondRefOf = {"CondRefOf", OP_CONDREFOF, "sS", C1, 0, NULL, 0, CondRefOf},
  153. atDecrement = {"Decrement", OP_DECREMENT, "S", C2, 0, NULL, 0, IncDec},
  154. atDerefOf = {"DerefOf", OP_DEREFOF, "C", C2, 0, NULL, 0, DerefOf},
  155. atDivide = {"Divide", OP_DIVIDE, "CCSS", C2, 0, NULL, 0, Divide},
  156. atFindSetLBit = {"FindSetLeftBit", OP_FINDSETLBIT, "CS", C2, 0, NULL, 0, ExprOp1},
  157. atFindSetRBit = {"FindSetRightBit", OP_FINDSETRBIT, "CS", C2, 0, NULL, 0, ExprOp1},
  158. atFromBCD = {"FromBCD", OP_FROMBCD, "CS", C2, 0, NULL, 0, ExprOp1},
  159. atIncrement = {"Increment", OP_INCREMENT, "S", C2, 0, NULL, 0, IncDec},
  160. atIndex = {"Index", OP_INDEX, "CCS", C2, RO, NULL, 0, Index},
  161. atLAnd = {"LAnd", OP_LAND, "CC", C2, 0, NULL, 0, LogOp2},
  162. atLEq = {"LEqual", OP_LEQ, "CC", C2, 0, NULL, 0, LogOp2},
  163. atLG = {"LGreater", OP_LG, "CC", C2, 0, NULL, 0, LogOp2},
  164. atLL = {"LLess", OP_LL, "CC", C2, 0, NULL, 0, LogOp2},
  165. atLNot = {"LNot", OP_LNOT, "C", C2, 0, NULL, 0, LNot},
  166. atLOr = {"LOr", OP_LOR, "CC", C2, 0, NULL, 0, LogOp2},
  167. atMatch = {"Match", OP_MATCH, "CBCBCC",C2, 0, NULL, 0, Match},
  168. atMultiply = {"Multiply", OP_MULTIPLY, "CCS", C2, 0, NULL, 0, ExprOp2},
  169. atNAnd = {"NAnd", OP_NAND, "CCS", C2, 0, NULL, 0, ExprOp2},
  170. atNOr = {"NOr", OP_NOR, "CCS", C2, 0, NULL, 0, ExprOp2},
  171. atNot = {"Not", OP_NOT, "CS", C2, 0, NULL, 0, ExprOp1},
  172. atObjType = {"ObjectType", OP_OBJTYPE, "S", C2, 0, NULL, 0, ObjTypeSizeOf},
  173. atOr = {"Or", OP_OR, "CCS", C2, 0, NULL, 0, ExprOp2},
  174. atOSI = {"OSI", OP_OSI, "S", C2, 0, NULL, 0, OSInterface},
  175. atPackage = {"Package", OP_PACKAGE, "B", C2, VL, NULL, 0, Package},
  176. atRefOf = {"RefOf", OP_REFOF, "S", C2, 0, NULL, 0, RefOf},
  177. atShiftLeft = {"ShiftLeft", OP_SHIFTL, "CCS", C2, 0, NULL, 0, ExprOp2},
  178. atShiftRight = {"ShiftRight", OP_SHIFTR, "CCS", C2, 0, NULL, 0, ExprOp2},
  179. atSizeOf = {"SizeOf", OP_SIZEOF, "S", C2, 0, NULL, 0, ObjTypeSizeOf},
  180. atStore = {"Store", OP_STORE, "CS", C2, 0, NULL, 0, Store},
  181. atSubtract = {"Subtract", OP_SUBTRACT, "CCS", C2, 0, NULL, 0, ExprOp2},
  182. atToBCD = {"ToBCD", OP_TOBCD, "CS", C2, 0, NULL, 0, ExprOp1},
  183. atWait = {"Wait", OP_WAIT, "SC", C2, 0, NULL, 0, Wait},
  184. atXOr = {"XOr", OP_XOR, "CCS", C2, 0, NULL, 0, ExprOp2},
  185. //
  186. // Misc. Opcodes
  187. //
  188. atNameObj = {NULL, OP_NONE, NULL, OT, NO, NULL, 0, NULL},
  189. atDataObj = {NULL, OP_NONE, NULL, OT, DO, NULL, 0, NULL},
  190. atString = {NULL, OP_STRING, NULL, OT, SO, NULL, 0, NULL},
  191. atArgObj = {NULL, OP_NONE, NULL, OT, AO, NULL, 0, NULL},
  192. atLocalObj = {NULL, OP_NONE, NULL, OT, LO, NULL, 0, NULL},
  193. atDebugObj = {"Debug", OP_DEBUG, NULL, OT, BO, NULL, 0, NULL};
  194. PAMLTERM OpcodeTable[256] =
  195. { //0x00 0x01 0x02 0x03
  196. &atDataObj, &atDataObj, NULL, NULL,
  197. //0x04 0x05 0x06 0x07
  198. NULL, NULL, &atAlias, NULL,
  199. //0x08 0x09 0x0a 0x0b
  200. &atName, NULL, &atDataObj, &atDataObj,
  201. //0x0c 0x0d 0x0e 0x0f
  202. &atDataObj, &atString, NULL, NULL,
  203. //0x10 0x11 0x12 0x13
  204. &atScope, &atBuffer, &atPackage, NULL,
  205. //0x14 0x15 0x16 0x17
  206. &atMethod, NULL, NULL, NULL,
  207. //0x18 0x19 0x1a 0x1b
  208. NULL, NULL, NULL, NULL,
  209. //0x1c 0x1d 0x1e 0x1f
  210. NULL, NULL, NULL, NULL,
  211. //0x20 0x21 0x22 0x23
  212. NULL, NULL, NULL, NULL,
  213. //0x24 0x25 0x26 0x27
  214. NULL, NULL, NULL, NULL,
  215. //0x28 0x29 0x2a 0x2b
  216. NULL, NULL, NULL, NULL,
  217. //0x2c 0x2d 0x2e 0x2f
  218. NULL, NULL, &atNameObj, &atNameObj,
  219. //0x30 0x31 0x32 0x33
  220. NULL, NULL, NULL, NULL,
  221. //0x34 0x35 0x36 0x37
  222. NULL, NULL, NULL, NULL,
  223. //0x38 0x39 0x3a 0x3b
  224. NULL, NULL, NULL, NULL,
  225. //0x3c 0x3d 0x3e 0x3f
  226. NULL, NULL, NULL, NULL,
  227. //0x40 0x41 0x42 0x43
  228. NULL, &atNameObj, &atNameObj, &atNameObj,
  229. //0x44 0x45 0x46 0x47
  230. &atNameObj, &atNameObj, &atNameObj, &atNameObj,
  231. //0x48 0x49 0x4a 0x4b
  232. &atNameObj, &atNameObj, &atNameObj, &atNameObj,
  233. //0x4c 0x4d 0x4e 0x4f
  234. &atNameObj, &atNameObj, &atNameObj, &atNameObj,
  235. //0x50 0x51 0x52 0x53
  236. &atNameObj, &atNameObj, &atNameObj, &atNameObj,
  237. //0x54 0x55 0x56 0x57
  238. &atNameObj, &atNameObj, &atNameObj, &atNameObj,
  239. //0x58 0x59 0x5a 0x5b
  240. &atNameObj, &atNameObj, &atNameObj, NULL,
  241. //0x5c 0x5d 0x5e 0x5f
  242. &atNameObj, NULL, &atNameObj, &atNameObj,
  243. //0x60 0x61 0x62 0x63
  244. &atLocalObj, &atLocalObj, &atLocalObj, &atLocalObj,
  245. //0x64 0x65 0x66 0x67
  246. &atLocalObj, &atLocalObj, &atLocalObj, &atLocalObj,
  247. //0x68 0x69 0x6a 0x6b
  248. &atArgObj, &atArgObj, &atArgObj, &atArgObj,
  249. //0x6c 0x6d 0x6e 0x6f
  250. &atArgObj, &atArgObj, &atArgObj, NULL,
  251. //0x70 0x71 0x72 0x73
  252. &atStore, &atRefOf, &atAdd, &atConcat,
  253. //0x74 0x75 0x76 0x77
  254. &atSubtract, &atIncrement, &atDecrement, &atMultiply,
  255. //0x78 0x79 0x7a 0x7b
  256. &atDivide, &atShiftLeft, &atShiftRight, &atAnd,
  257. //0x7c 0x7d 0x7e 0x7f
  258. &atNAnd, &atOr, &atNOr, &atXOr,
  259. //0x80 0x81 0x82 0x83
  260. &atNot, &atFindSetLBit, &atFindSetRBit, &atDerefOf,
  261. //0x84 0x85 0x86 0x87
  262. NULL, NULL, &atNotify, &atSizeOf,
  263. //0x88 0x89 0x8a 0x8b
  264. &atIndex, &atMatch, &atDWordField, &atWordField,
  265. //0x8c 0x8d 0x8e 0x8f
  266. &atByteField, &atBitField, &atObjType, NULL,
  267. //0x90 0x91 0x92 0x93
  268. &atLAnd, &atLOr, &atLNot, &atLEq,
  269. //0x94 0x95 0x96 0x97
  270. &atLG, &atLL, NULL, NULL,
  271. //0x98 0x99 0x9a 0x9b
  272. NULL, NULL, NULL, NULL,
  273. //0x9c 0x9d 0x9e 0x9f
  274. NULL, NULL, NULL, NULL,
  275. //0xa0 0xa1 0xa2 0xa3
  276. &atIf, &atElse, &atWhile, &atNOP,
  277. //0xa4 0xa5 0xa6 0xa7
  278. &atReturn, &atBreak, NULL, NULL,
  279. //0xa8 0xa9 0xaa 0xab
  280. NULL, NULL, NULL, NULL,
  281. //0xac 0xad 0xae 0xaf
  282. NULL, NULL, NULL, NULL,
  283. //0xb0 0xb1 0xb2 0xb3
  284. NULL, NULL, NULL, NULL,
  285. //0xb4 0xb5 0xb6 0xb7
  286. NULL, NULL, NULL, NULL,
  287. //0xb8 0xb9 0xba 0xbb
  288. NULL, NULL, NULL, NULL,
  289. //0xbc 0xbd 0xbe 0xbf
  290. NULL, NULL, NULL, NULL,
  291. //0xc0 0xc1 0xc2 0xc3
  292. NULL, NULL, NULL, NULL,
  293. //0xc4 0xc5 0xc6 0xc7
  294. NULL, NULL, NULL, NULL,
  295. //0xc8 0xc9 0xca 0xcb
  296. NULL, NULL, &atOSI, NULL,
  297. //0xcc 0xcd 0xce 0xcf
  298. &atBreakPoint, NULL, NULL, NULL,
  299. //0xd0 0xd1 0xd2 0xd3
  300. NULL, NULL, NULL, NULL,
  301. //0xd4 0xd5 0xd6 0xd7
  302. NULL, NULL, NULL, NULL,
  303. //0xd8 0xd9 0xda 0xdb
  304. NULL, NULL, NULL, NULL,
  305. //0xdc 0xdd 0xde 0xdf
  306. NULL, NULL, NULL, NULL,
  307. //0xe0 0xe1 0xe2 0xe3
  308. NULL, NULL, NULL, NULL,
  309. //0xe4 0xe5 0xe6 0xe7
  310. NULL, NULL, NULL, NULL,
  311. //0xe8 0xe9 0xea 0xeb
  312. NULL, NULL, NULL, NULL,
  313. //0xec 0xed 0xee 0xef
  314. NULL, NULL, NULL, NULL,
  315. //0xf0 0xf1 0xf2 0xf3
  316. NULL, NULL, NULL, NULL,
  317. //0xf4 0xf5 0xf6 0xf7
  318. NULL, NULL, NULL, NULL,
  319. //0xf8 0xf9 0xfa 0xfb
  320. NULL, NULL, NULL, NULL,
  321. //0xfc 0xfd 0xfe 0xff
  322. NULL, NULL, NULL, &atDataObj
  323. };
  324. OPCODEMAP ExOpcodeTable[] =
  325. {
  326. EXOP_MUTEX, &atMutex,
  327. EXOP_EVENT, &atEvent,
  328. EXOP_CONDREFOF, &atCondRefOf,
  329. EXOP_CREATEFIELD, &atCreateField,
  330. EXOP_LOAD, &atLoad,
  331. EXOP_STALL, &atStall,
  332. EXOP_SLEEP, &atSleep,
  333. EXOP_ACQUIRE, &atAcquire,
  334. EXOP_SIGNAL, &atSignal,
  335. EXOP_WAIT, &atWait,
  336. EXOP_RESET, &atReset,
  337. EXOP_RELEASE, &atRelease,
  338. EXOP_FROMBCD, &atFromBCD,
  339. EXOP_TOBCD, &atToBCD,
  340. EXOP_UNLOAD, &atUnload,
  341. EXOP_REVISION, &atDataObj,
  342. EXOP_DEBUG, &atDebugObj,
  343. EXOP_FATAL, &atFatal,
  344. EXOP_OPREGION, &atOpRegion,
  345. EXOP_FIELD, &atField,
  346. EXOP_DEVICE, &atDevice,
  347. EXOP_PROCESSOR, &atProcessor,
  348. EXOP_POWERRES, &atPowerRes,
  349. EXOP_THERMALZONE, &atThermalZone,
  350. EXOP_IDXFIELD, &atIndexField,
  351. EXOP_BANKFIELD, &atBankField,
  352. 0, NULL
  353. };