Advertisement
Guest User

Untitled

a guest
Dec 18th, 2022
302
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 391.32 KB | None | 0 0
  1. diff --strip-trailing-cr -ur ./driver/acpisym/acpisym.c "c:\\ACPI\\ACPI_W2003\\Base\\busdrv\\acpi/driver/acpisym/acpisym.c"
  2. --- ./driver/acpisym/acpisym.c 2003-02-26 17:15:50.000000000 +0500
  3. +++ "c:\\ACPI\\ACPI_W2003\\Base\\busdrv\\acpi/driver/acpisym/acpisym.c" 2022-04-28 11:28:50.548828100 +0500
  4. @@ -42,6 +42,7 @@
  5. #include "acpiterm.h"
  6. #include "acpiirp.h"
  7. #include "acpilog.h"
  8. +#include "arblib.h"
  9. #include "acpiosnt.h"
  10. #include "..\nt\irqarb.h"
  11.  
  12. Only in c:\ACPI\ACPI_W2003\Base\busdrv\acpi/driver/acpisym: obj
  13. diff --strip-trailing-cr -ur ./driver/amlinew/acpins.c "c:\\ACPI\\ACPI_W2003\\Base\\busdrv\\acpi/driver/amlinew/acpins.c"
  14. --- ./driver/amlinew/acpins.c 2003-02-26 17:15:50.000000000 +0500
  15. +++ "c:\\ACPI\\ACPI_W2003\\Base\\busdrv\\acpi/driver/amlinew/acpins.c" 2022-04-04 04:05:08.000000000 +0500
  16. @@ -740,7 +740,7 @@
  17.  
  18. EXIT(3, ("EvalPackageElement=%x (Type=%s,Value=%x,Len=%d,Buff=%x)\n",
  19. rc, GetObjectTypeName(pdataResult->dwDataType),
  20. - pdataResult->uipDataValue, pdataResult->dwDataLen,
  21. + pdataResult->dwDataValue, pdataResult->dwDataLen,
  22. pdataResult->pbDataBuff));
  23. return rc;
  24. } //EvalPackageElement
  25. diff --strip-trailing-cr -ur ./driver/amlinew/amldebug.c "c:\\ACPI\\ACPI_W2003\\Base\\busdrv\\acpi/driver/amlinew/amldebug.c"
  26. --- ./driver/amlinew/amldebug.c 2003-02-26 17:15:50.000000000 +0500
  27. +++ "c:\\ACPI\\ACPI_W2003\\Base\\busdrv\\acpi/driver/amlinew/amldebug.c" 2022-04-06 03:31:36.000000000 +0500
  28. @@ -1915,7 +1915,7 @@
  29. else if (icArgs < MAX_NUM_ARGS)
  30. {
  31. MEMZERO(&Args[icArgs], sizeof(OBJDATA));
  32. - if (IsNumber(pszArg, 0, &Args[icArgs].uipDataValue))
  33. + if (IsNumber(pszArg, 0, (PULONG_PTR) &Args[icArgs].dwDataValue))
  34. {
  35. Args[icArgs].dwDataType = OBJTYPE_INTDATA;
  36. icArgs++;
  37. @@ -2230,7 +2230,7 @@
  38. switch (pdata->dwDataType)
  39. {
  40. case OBJTYPE_INTDATA:
  41. - PRINTF("0x%p", pdata->uipDataValue);
  42. + PRINTF("0x%p", pdata->dwDataValue);
  43. break;
  44.  
  45. case OBJTYPE_STRDATA:
  46. @@ -2260,7 +2260,7 @@
  47. default:
  48. PRINTF("<Obj=%p,Type=%s,Value=0x%p,Buff=%p,Len=%d>",
  49. pdata, GetObjectTypeName(pdata->dwDataType),
  50. - pdata->uipDataValue, pdata->pbDataBuff, pdata->dwDataLen);
  51. + pdata->dwDataValue, pdata->pbDataBuff, pdata->dwDataLen);
  52. }
  53.  
  54. EXIT(4, ("PrintObject!\n"));
  55. diff --strip-trailing-cr -ur ./driver/amlinew/amliapi.c "c:\\ACPI\\ACPI_W2003\\Base\\busdrv\\acpi/driver/amlinew/amliapi.c"
  56. --- ./driver/amlinew/amliapi.c 2003-02-26 17:15:50.000000000 +0500
  57. +++ "c:\\ACPI\\ACPI_W2003\\Base\\busdrv\\acpi/driver/amlinew/amliapi.c" 2022-04-04 04:02:00.000000000 +0500
  58. @@ -160,7 +160,7 @@
  59. &pns, 0)) == STATUS_SUCCESS))
  60. {
  61. pns->ObjData.dwDataType = OBJTYPE_INTDATA;
  62. - pns->ObjData.uipDataValue = AMLI_REVISION;
  63. + pns->ObjData.dwDataValue = AMLI_REVISION;
  64. }
  65.  
  66. if ((rc == STATUS_SUCCESS) &&
  67. diff --strip-trailing-cr -ur ./driver/amlinew/amlipriv.h "c:\\ACPI\\ACPI_W2003\\Base\\busdrv\\acpi/driver/amlinew/amlipriv.h"
  68. --- ./driver/amlinew/amlipriv.h 2003-02-26 17:15:50.000000000 +0500
  69. +++ "c:\\ACPI\\ACPI_W2003\\Base\\busdrv\\acpi/driver/amlinew/amlipriv.h" 2022-03-31 20:01:00.000000000 +0500
  70. @@ -285,6 +285,7 @@
  71. #define AMLISTA_CONTINUE 0x00008003
  72. #define AMLISTA_PENDING 0x00008004
  73. #define AMLISTA_TIMEOUT 0x00008005
  74. +#define AMLISTA_CONTINUEOP 0x00008006
  75.  
  76. // Global AMLI flags
  77. #define AMLIF_LOCKED 0x00000001
  78. @@ -331,6 +332,7 @@
  79. #define ARGOBJ_BASICDATA 'D' //INTDATA,STRDATA,BUFFDATA
  80. #define ARGOBJ_COMPLEXDATA 'C' //BUFFDATA,PKGDATA
  81. #define ARGOBJ_REFERENCE 'R' //OBJALIAS,DATAALIAS,BUFFFIELD
  82. +#define ARGOBJ_STRBUFDATA 'T' //OBJTYPE_STRDATA/OBJTYPE_BUFFDATA
  83.  
  84. #define MAX_BYTE 0xff
  85. #define MAX_WORD 0xffff
  86. diff --strip-trailing-cr -ur ./driver/amlinew/amlitest.c "c:\\ACPI\\ACPI_W2003\\Base\\busdrv\\acpi/driver/amlinew/amlitest.c"
  87. --- ./driver/amlinew/amlitest.c 2003-02-26 17:15:50.000000000 +0500
  88. +++ "c:\\ACPI\\ACPI_W2003\\Base\\busdrv\\acpi/driver/amlinew/amlitest.c" 2022-04-02 22:47:12.000000000 +0500
  89. @@ -52,6 +52,7 @@
  90. PCCHAR DebugMessage,
  91. ...)
  92. {
  93. + int index;
  94. va_list ap;
  95. va_start(ap, DebugMessage);
  96.  
  97. @@ -61,17 +62,16 @@
  98.  
  99.  
  100.  
  101. - if(_vsnprintf(AmliTestDebugBuffer,
  102. + index = _vsnprintf(AmliTestDebugBuffer,
  103. 200,
  104. DebugMessage,
  105. - ap) < 0)
  106. + ap);
  107. + if(index == -1)
  108. {
  109. - //
  110. - // _vsnprintf failed, don't print out anything.
  111. - //
  112. - AmliTestDebugBuffer[0] = '\0';
  113. + AmliTestDebugBuffer[0] = '\0';
  114. + } else {
  115. + AmliTestDebugBuffer[index] = '\0';
  116. }
  117. - AmliTestDebugBuffer[199] = '\0';
  118.  
  119. DbgPrint(AmliTestDebugBuffer);
  120. }
  121. diff --strip-trailing-cr -ur ./driver/amlinew/data.c "c:\\ACPI\\ACPI_W2003\\Base\\busdrv\\acpi/driver/amlinew/data.c"
  122. --- ./driver/amlinew/data.c 2003-02-26 17:15:50.000000000 +0500
  123. +++ "c:\\ACPI\\ACPI_W2003\\Base\\busdrv\\acpi/driver/amlinew/data.c" 2022-03-31 19:47:44.000000000 +0500
  124. @@ -188,6 +188,22 @@
  125. atToBCD = {"ToBCD", OP_TOBCD, "CS", C2, 0, NULL, 0, ExprOp1},
  126. atWait = {"Wait", OP_WAIT, "SC", C2, 0, NULL, 0, Wait},
  127. atXOr = {"XOr", OP_XOR, "CCS", C2, 0, NULL, 0, ExprOp2},
  128. +
  129. + // ACPI 2.0
  130. + atToBuffer = {"ToBuffer", OP_TOBUFFER, "CS", C2, 0, NULL, 0, ToBuffer},
  131. + atToDecString = {"ToDecimalString", OP_TODECSTRING, "CS", C2, 0, NULL, 0, ToDecimalString},
  132. + atToHexString = {"ToHexString", OP_TOHEXSTRING, "CS", C2, 0, NULL, 0, ToHexString},
  133. + atToInteger = {"ToInteger", OP_TOINTEGER, "CS", C2, 0, NULL, 0, ToInteger},
  134. + atQWordField = {"CreateQWordField", OP_QWORDFIELD, "CCN", OB, 0, NULL, 0, CreateQWordField},
  135. + atConcatRes = {"ConcatenateResTemplate", OP_CONCATRESTMPL, "CCS", C2, 0, NULL, 0, ConcatenateResTemplate},
  136. + atMod = {"Mod", OP_MOD, "CCS", C2, 0, NULL, 0, ExprOp2},
  137. + atToString = {"ToString", OP_TOSTRING, "CCS", C2, 0, NULL, 0, ToString},
  138. + atCopyObject = {"CopyObject", OP_COPYOBJECT, "CS", C2, 0, NULL, 0, CopyObject},
  139. + atMid = {"Mid", OP_MID, "CCCS", C2, 0, NULL, 0, MidString},
  140. + atContinue = {"Continue", OP_CONTINUE, NULL, C1, 0, NULL, 0, Continue},
  141. + atTimer = {"Timer", OP_TIMER , NULL, C2, 0, NULL, 0, Timer},
  142. + // OP_QWORD=0xE - see atDataObj
  143. +
  144. //
  145. // Misc. Opcodes
  146. //
  147. @@ -206,7 +222,7 @@
  148. //0x08 0x09 0x0a 0x0b
  149. &atName, NULL, &atDataObj, &atDataObj,
  150. //0x0c 0x0d 0x0e 0x0f
  151. - &atDataObj, &atString, NULL, NULL,
  152. + &atDataObj, &atString, &atDataObj, NULL,
  153. //0x10 0x11 0x12 0x13
  154. &atScope, &atBuffer, &atPackage, NULL,
  155. //0x14 0x15 0x16 0x17
  156. @@ -266,19 +282,19 @@
  157. //0x80 0x81 0x82 0x83
  158. &atNot, &atFindSetLBit, &atFindSetRBit, &atDerefOf,
  159. //0x84 0x85 0x86 0x87
  160. - NULL, NULL, &atNotify, &atSizeOf,
  161. + &atConcatRes, &atMod, &atNotify, &atSizeOf,
  162. //0x88 0x89 0x8a 0x8b
  163. &atIndex, &atMatch, &atDWordField, &atWordField,
  164. //0x8c 0x8d 0x8e 0x8f
  165. - &atByteField, &atBitField, &atObjType, NULL,
  166. + &atByteField, &atBitField, &atObjType, &atQWordField,
  167. //0x90 0x91 0x92 0x93
  168. &atLAnd, &atLOr, &atLNot, &atLEq,
  169. //0x94 0x95 0x96 0x97
  170. - &atLG, &atLL, NULL, NULL,
  171. + &atLG, &atLL, &atToBuffer, &atToDecString,
  172. //0x98 0x99 0x9a 0x9b
  173. - NULL, NULL, NULL, NULL,
  174. + &atToHexString, &atToInteger, NULL, NULL,
  175. //0x9c 0x9d 0x9e 0x9f
  176. - NULL, NULL, NULL, NULL,
  177. + &atToString, &atCopyObject, &atMid, &atContinue,
  178. //0xa0 0xa1 0xa2 0xa3
  179. &atIf, &atElse, &atWhile, &atNOP,
  180. //0xa4 0xa5 0xa6 0xa7
  181. @@ -349,6 +365,7 @@
  182. EXOP_REVISION, &atDataObj,
  183. EXOP_DEBUG, &atDebugObj,
  184. EXOP_FATAL, &atFatal,
  185. + EXOP_TIMER, &atTimer,
  186. EXOP_OPREGION, &atOpRegion,
  187. EXOP_FIELD, &atField,
  188. EXOP_DEVICE, &atDevice,
  189. diff --strip-trailing-cr -ur ./driver/amlinew/misc.c "c:\\ACPI\\ACPI_W2003\\Base\\busdrv\\acpi/driver/amlinew/misc.c"
  190. --- ./driver/amlinew/misc.c 2003-02-26 17:15:50.000000000 +0500
  191. +++ "c:\\ACPI\\ACPI_W2003\\Base\\busdrv\\acpi/driver/amlinew/misc.c" 2022-04-05 16:20:27.692382800 +0500
  192. @@ -597,7 +597,7 @@
  193.  
  194. MEMZERO(&data, sizeof(OBJDATA));
  195. data.dwDataType = OBJTYPE_INTDATA;
  196. - data.uipDataValue = (ULONG_PTR)dwData;
  197. + data.dwDataValue = (ULONG)dwData;
  198.  
  199. rc = WriteObject(pctxt, pdataObj, &data);
  200.  
  201. @@ -830,7 +830,7 @@
  202. switch (pdata->dwDataType)
  203. {
  204. case OBJTYPE_INTDATA:
  205. - pb = (PUCHAR)&pdata->uipDataValue;
  206. + pb = (PUCHAR)&pdata->dwDataValue;
  207. dwcb = sizeof(ULONG);
  208. break;
  209.  
  210. @@ -1334,6 +1334,17 @@
  211. i,
  212. GetObjectTypeName(pArgs[i].dwDataType)));
  213. }
  214. + break;
  215. +
  216. + case ARGOBJ_STRBUFDATA:
  217. + if ((pArgs[i].dwDataType != OBJTYPE_STRDATA) &&
  218. + (pArgs[i].dwDataType != OBJTYPE_BUFFDATA))
  219. + {
  220. + rc = AMLI_LOGERR(AMLIERR_UNEXPECTED_OBJTYPE,
  221. + ("ValidateArgTypes: expected Arg%d to be type str/buff (Type=%s)",
  222. + i,
  223. + GetObjectTypeName(pArgs[i].dwDataType)));
  224. + }
  225. break;
  226.  
  227. default:
  228. diff --strip-trailing-cr -ur ./driver/amlinew/namedobj.c "c:\\ACPI\\ACPI_W2003\\Base\\busdrv\\acpi/driver/amlinew/namedobj.c"
  229. --- ./driver/amlinew/namedobj.c 2003-02-26 17:15:50.000000000 +0500
  230. +++ "c:\\ACPI\\ACPI_W2003\\Base\\busdrv\\acpi/driver/amlinew/namedobj.c" 2022-12-18 13:45:02.173828100 +0500
  231. @@ -9,6 +9,141 @@
  232.  
  233. #include "pch.h"
  234.  
  235. +// AcpiInformation re-definition
  236. +///////////////////////////////////////////////////
  237. +typedef struct _ACPIInformation {
  238. +
  239. + //
  240. + // Linear address of Root System Description Table
  241. + //
  242. + PRSDT RootSystemDescTable;
  243. +
  244. + //
  245. + // Linear address of Fixed ACPI Description Table
  246. + //
  247. + PFADT FixedACPIDescTable;
  248. +
  249. + //
  250. + // Linear address of the FACS
  251. + //
  252. + PFACS FirmwareACPIControlStructure;
  253. +
  254. + //
  255. + // Linear address of Differentiated System Description Table
  256. + //
  257. + PDSDT DiffSystemDescTable;
  258. +
  259. + //
  260. + // Linear address of Mulitple APIC table
  261. + //
  262. + PMAPIC MultipleApicTable;
  263. +
  264. + //
  265. + // Linear address of GlobalLock ULONG_PTR (contained within Firmware ACPI control structure)
  266. + //
  267. + PULONG GlobalLock;
  268. +
  269. + //
  270. + // Queue used for waiting on release of the Global Lock. Also, queue
  271. + // lock and owner info.
  272. + //
  273. + LIST_ENTRY GlobalLockQueue;
  274. + KSPIN_LOCK GlobalLockQueueLock;
  275. + PVOID GlobalLockOwnerContext;
  276. + ULONG GlobalLockOwnerDepth;
  277. +
  278. + //
  279. + // Did we find SCI_EN set when we loaded ?
  280. + //
  281. + BOOLEAN ACPIOnly;
  282. +
  283. + //
  284. + // I/O address of PM1a_BLK
  285. + //
  286. + ULONG_PTR PM1a_BLK;
  287. +
  288. + //
  289. + // I/O address of PM1b_BLK
  290. + //
  291. + ULONG_PTR PM1b_BLK;
  292. +
  293. + //
  294. + // I/O address of PM1a_CNT_BLK
  295. + //
  296. + ULONG_PTR PM1a_CTRL_BLK;
  297. +
  298. + //
  299. + // I/O address of PM1b_CNT_BLK
  300. + //
  301. + ULONG_PTR PM1b_CTRL_BLK;
  302. +
  303. + //
  304. + // I/O address of PM2_CNT_BLK
  305. + //
  306. + ULONG_PTR PM2_CTRL_BLK;
  307. +
  308. + //
  309. + // I/O address of PM_TMR
  310. + //
  311. + ULONG_PTR PM_TMR;
  312. + ULONG_PTR GP0_BLK;
  313. + ULONG_PTR GP0_ENABLE;
  314. +
  315. + //
  316. + // Length of GP0 register block (Total, status+enable regs)
  317. + //
  318. + UCHAR GP0_LEN;
  319. +
  320. + //
  321. + // Number of GP0 logical registers
  322. + //
  323. + USHORT Gpe0Size;
  324. + ULONG_PTR GP1_BLK;
  325. + ULONG_PTR GP1_ENABLE;
  326. +
  327. + //
  328. + // Length of GP1 register block
  329. + //
  330. + UCHAR GP1_LEN;
  331. +
  332. + //
  333. + // Number of GP1 logical registers
  334. + //
  335. + USHORT Gpe1Size;
  336. + USHORT GP1_Base_Index;
  337. +
  338. + //
  339. + // Total number of GPE logical registers
  340. + //
  341. + USHORT GpeSize;
  342. +
  343. + //
  344. + // I/O address of SMI_CMD
  345. + //
  346. + ULONG_PTR SMI_CMD;
  347. +
  348. + //
  349. + // Bit mask of enabled PM1 events.
  350. + //
  351. + USHORT pm1_en_bits;
  352. + USHORT pm1_wake_mask;
  353. + USHORT pm1_wake_status;
  354. + USHORT c2_latency;
  355. + USHORT c3_latency;
  356. +
  357. + //
  358. + // see below for bit descriptions.
  359. + //
  360. + ULONG ACPI_Flags;
  361. + ULONG ACPI_Capabilities;
  362. +
  363. + BOOLEAN Dockable;
  364. +
  365. +} ACPIInformation, *PACPIInformation;
  366. +extern PACPIInformation AcpiInformation;
  367. +///////////////////////////////////////////////////
  368. +
  369. +
  370. #ifdef LOCKABLE_PRAGMA
  371. #pragma ACPI_LOCKABLE_DATA
  372. #pragma ACPI_LOCKABLE_CODE
  373. @@ -78,9 +213,9 @@
  374. pbf = (PBANKFIELDOBJ)pterm->pnsObj->ObjData.pbDataBuff;
  375. pbf->pnsBase = pnsBase;
  376. pbf->pnsBank = pnsBank;
  377. - pbf->dwBankValue = (ULONG)pterm->pdataArgs[2].uipDataValue;
  378. + pbf->dwBankValue = (ULONG)pterm->pdataArgs[2].dwDataValue;
  379. rc = ParseFieldList(pctxt, pterm->pbOpEnd, pterm->pnsObj,
  380. - (ULONG)pterm->pdataArgs[3].uipDataValue,
  381. + (ULONG)pterm->pdataArgs[3].dwDataValue,
  382. ((POPREGIONOBJ)pnsBase->ObjData.pbDataBuff)->dwLen);
  383. }
  384. }
  385. @@ -169,9 +304,9 @@
  386. STATUS_SUCCESS)
  387. {
  388. pbf->FieldDesc.dwByteOffset = (ULONG)
  389. - (pterm->pdataArgs[1].uipDataValue/8);
  390. + (pterm->pdataArgs[1].dwDataValue/8);
  391. pbf->FieldDesc.dwStartBitPos = (ULONG)
  392. - (pterm->pdataArgs[1].uipDataValue -
  393. + (pterm->pdataArgs[1].dwDataValue -
  394. pbf->FieldDesc.dwByteOffset*8);
  395. pbf->FieldDesc.dwNumBits = 1;
  396. pbf->FieldDesc.dwFieldFlags = ACCTYPE_BYTE;
  397. @@ -205,7 +340,7 @@
  398. if ((rc = CreateXField(pctxt, pterm, &pterm->pdataArgs[2], &pbf)) ==
  399. STATUS_SUCCESS)
  400. {
  401. - pbf->FieldDesc.dwByteOffset = (ULONG)pterm->pdataArgs[1].uipDataValue;
  402. + pbf->FieldDesc.dwByteOffset = (ULONG)pterm->pdataArgs[1].dwDataValue;
  403. pbf->FieldDesc.dwStartBitPos = 0;
  404. pbf->FieldDesc.dwNumBits = 8*sizeof(UCHAR);
  405. pbf->FieldDesc.dwFieldFlags = ACCTYPE_BYTE;
  406. @@ -239,7 +374,7 @@
  407. if ((rc = CreateXField(pctxt, pterm, &pterm->pdataArgs[2], &pbf)) ==
  408. STATUS_SUCCESS)
  409. {
  410. - pbf->FieldDesc.dwByteOffset = (ULONG)pterm->pdataArgs[1].uipDataValue;
  411. + pbf->FieldDesc.dwByteOffset = (ULONG)pterm->pdataArgs[1].dwDataValue;
  412. pbf->FieldDesc.dwStartBitPos = 0;
  413. pbf->FieldDesc.dwNumBits = 8*sizeof(USHORT);
  414. pbf->FieldDesc.dwFieldFlags = ACCTYPE_WORD;
  415. @@ -273,7 +408,7 @@
  416. if ((rc = CreateXField(pctxt, pterm, &pterm->pdataArgs[2], &pbf)) ==
  417. STATUS_SUCCESS)
  418. {
  419. - pbf->FieldDesc.dwByteOffset = (ULONG)pterm->pdataArgs[1].uipDataValue;
  420. + pbf->FieldDesc.dwByteOffset = (ULONG)pterm->pdataArgs[1].dwDataValue;
  421. pbf->FieldDesc.dwStartBitPos = 0;
  422. pbf->FieldDesc.dwNumBits = 8*sizeof(ULONG);
  423. pbf->FieldDesc.dwFieldFlags = ACCTYPE_DWORD;
  424. @@ -310,11 +445,11 @@
  425. STATUS_SUCCESS)
  426. {
  427. pbf->FieldDesc.dwByteOffset = (ULONG)
  428. - (pterm->pdataArgs[1].uipDataValue/8);
  429. + (pterm->pdataArgs[1].dwDataValue/8);
  430. pbf->FieldDesc.dwStartBitPos = (ULONG)
  431. - (pterm->pdataArgs[1].uipDataValue -
  432. + (pterm->pdataArgs[1].dwDataValue -
  433. pbf->FieldDesc.dwByteOffset*8);
  434. - pbf->FieldDesc.dwNumBits = (ULONG)pterm->pdataArgs[2].uipDataValue;
  435. + pbf->FieldDesc.dwNumBits = (ULONG)pterm->pdataArgs[2].dwDataValue;
  436. pbf->FieldDesc.dwFieldFlags = ACCTYPE_BYTE | FDF_BUFFER_TYPE;
  437. }
  438. }
  439. @@ -344,10 +479,119 @@
  440. {
  441. TRACENAME("DEVICE")
  442. NTSTATUS rc = STATUS_SUCCESS;
  443. + PUCHAR NextOp, OrigOp, OneByte, TwoByte, ThreeByte, FourByte;
  444. + PUCHAR DeviceDef;
  445. + ULONG ProcDefType = 0;
  446. + ULONG i, DeviceOpSize;
  447.  
  448. ENTER(2, ("Device(pctxt=%x,pbOp=%x,pterm=%x)\n",
  449. pctxt, pctxt->pbOp, pterm));
  450.  
  451. + // convert Device(HID=ACPI0007,...) to Processor(...) opcode
  452. +
  453. + // ACPI0007 Device definition #1:
  454. + // 5B 82 1A 43 30 30 30 Device (C000)
  455. + // 08 5F 48 49 44 0D 41 43 50 49 30 30 30 37 00 Name (_HID, "ACPI0007") <- OrigOp
  456. + // 08 5F 55 49 44 00 Name (_UID, Zero)
  457. + // 5B 82 1A XX XX XX XX 08 5F 48 49 44 0D 41 43 50 49 30 30 30 37 00 08 5F 55 49 44 YY
  458. +
  459. + // ACPI0007 Device definition #2:
  460. + // 5B 82 1B 43 30 30 30 Device (C000)
  461. + // 08 5F 48 49 44 0D 41 43 50 49 30 30 30 37 00 Name (_HID, "ACPI0007") <- OrigOp
  462. + // 08 5F 55 49 44 0A YY Name (_UID, 2)
  463. + // 5B 82 1B XX XX XX XX 08 5F 48 49 44 0D 41 43 50 49 30 30 30 37 00 08 5F 55 49 44 0A YY
  464. +
  465. +
  466. + NextOp = pctxt->pbOp; // next OP
  467. + DeviceDef = NextOp - 7 ; // 5B 82 1A / 5B 82 1B
  468. +
  469. + if (NextOp) { // next OP exist
  470. + if (DeviceDef[0] == 0x5B && // 5B 82 1A definition #1
  471. + DeviceDef[1] == 0x82 &&
  472. + DeviceDef[2] == 0x1A ) {
  473. + ProcDefType = 1;
  474. + DeviceOpSize = 28;
  475. + KdPrint(("Try ACPI0007 def #1 \n"));
  476. + } else
  477. + if (DeviceDef[0] == 0x5B && // 5B 82 1B definition #2
  478. + DeviceDef[1] == 0x82 &&
  479. + DeviceDef[2] == 0x1B ) {
  480. + ProcDefType = 2;
  481. + DeviceOpSize = 29;
  482. + KdPrint(("Try ACPI0007 def #2 \n"));
  483. + }
  484. + }
  485. +
  486. + if (ProcDefType == 0 ||
  487. + DeviceDef[13] != 'A' ||
  488. + DeviceDef[14] != 'C' ||
  489. + DeviceDef[15] != 'P' ||
  490. + DeviceDef[16] != 'I' ||
  491. + DeviceDef[17] != '0' ||
  492. + DeviceDef[18] != '0' ||
  493. + DeviceDef[19] != '0' ||
  494. + DeviceDef[20] != '7' )
  495. + ProcDefType = 0; // not ACPI0007
  496. +
  497. + if (ProcDefType != 0) {
  498. + CHAR ProcName[4];
  499. + UCHAR ProcEnum;
  500. + ULONG dwPBlk, dwPBlkLen;
  501. + UCHAR *pdwPBlk;
  502. +
  503. + ProcName[0] = DeviceDef[3]; // N
  504. + ProcName[1] = DeviceDef[4]; // A
  505. + ProcName[2] = DeviceDef[5]; // M
  506. + ProcName[3] = DeviceDef[6]; // E
  507. +
  508. + // FACP.PM1A_Event_Block + 0x10, https://www.tonymacx86.com/threads/cpu-wrapping-ssdt-cpu-wrap-ssdt-cpur-acpi0007.316894/
  509. + dwPBlk = (ULONG) AcpiInformation->FixedACPIDescTable->pm1a_evt_blk_io_port + 0x10;
  510. +
  511. + // 0 or 6 per ACPI spec
  512. + dwPBlkLen = (ULONG) 6;
  513. +
  514. + // Processor (CPU0, 0x01, 0x00001810, 0x06) (NAME, enum, addr, size)
  515. + // 5B 83 0B 43 50 55 30 01 10 18 00 00 06
  516. + DeviceDef[0] = 0x5B;
  517. + DeviceDef[1] = 0x83;
  518. + DeviceDef[2] = 0x0B;
  519. +
  520. + DeviceDef[3] = ProcName[0];
  521. + DeviceDef[4] = ProcName[1];
  522. + DeviceDef[5] = ProcName[2];
  523. + DeviceDef[6] = ProcName[3];
  524. +
  525. + if (ProcDefType == 1)
  526. + DeviceDef[7] = DeviceDef[27]; // YY
  527. + else
  528. + if (ProcDefType == 2)
  529. + DeviceDef[7] = DeviceDef[28]; // YY
  530. +
  531. + pdwPBlk = (UCHAR *) &dwPBlk;
  532. +
  533. + DeviceDef[8] = pdwPBlk[0];
  534. + DeviceDef[9] = pdwPBlk[1];
  535. + DeviceDef[10] = pdwPBlk[2];
  536. + DeviceDef[11] = pdwPBlk[3];
  537. +
  538. + DeviceDef[12] = (UCHAR) dwPBlkLen;
  539. +
  540. + for (i = 13; i < DeviceOpSize; i++) {
  541. + DeviceDef[i] = 0xA3; // Noop
  542. + }
  543. +
  544. + pctxt->pbOp = DeviceDef; // reverse OPcode back
  545. +
  546. + KdPrint(("ACPI0007 CPU=%x PBlk=%x NextOp=%X,%X,%X,%X \n",
  547. + DeviceDef[7],
  548. + dwPBlk,
  549. + DeviceDef[DeviceOpSize],
  550. + DeviceDef[DeviceOpSize+1],
  551. + DeviceDef[DeviceOpSize+2],
  552. + DeviceDef[DeviceOpSize+3]));
  553. + }
  554. + else
  555. + { // normal Device()
  556. if ((rc = CreateNameSpaceObject(pctxt->pheapCurrent,
  557. (PSZ)pterm->pdataArgs[0].pbDataBuff,
  558. pctxt->pnsScope, pctxt->powner,
  559. @@ -361,6 +605,35 @@
  560. rc = PushScope(pctxt, pctxt->pbOp, pterm->pbOpEnd, NULL, pterm->pnsObj,
  561. pctxt->powner, pctxt->pheapCurrent, pterm->pdataResult);
  562. }
  563. + else
  564. + if (rc == AMLIERR_OBJ_ALREADY_EXIST) {
  565. + // Doubled device definition workaround, change OpCode pointer to next object
  566. + NextOp = pctxt->pbOp; // next OP
  567. + OneByte = NextOp - 7 ; // 5B 82 (3F) NN AA MM EE
  568. + TwoByte = NextOp - 8 ; // 5B 82 (4F L2) NN AA MM EE
  569. + ThreeByte = NextOp - 9 ; // 5B 82 (8F L2 L3) NN AA MM EE
  570. + FourByte = NextOp - 10 ; // 5B 82 (CF L3 L3 L4) NN AA MM EE
  571. +
  572. + rc = STATUS_SUCCESS;
  573. +
  574. + if (NextOp) { // next OP exist
  575. + if (OneByte[0] == 0x5B && OneByte[1] == 0x82) { // 0x5B 0x82 Device() Opcode
  576. + pctxt->pbOp = OneByte + OneByte[2] + 2; // start + pkglength + opcodelength
  577. + } else
  578. + if (TwoByte[0] == 0x5B && TwoByte[1] == 0x82) {
  579. + pctxt->pbOp = TwoByte + (TwoByte[3] << 4) + (TwoByte[2] & 0x0F) + 2; // pkglength magic
  580. + } else
  581. + if (ThreeByte[0] == 0x5B && ThreeByte[1] == 0x82) {
  582. + pctxt->pbOp = ThreeByte + (ThreeByte[4] << (4+8)) + (ThreeByte[3] << 4) + (ThreeByte[2] & 0x0F) + 2;
  583. + } else
  584. + if (FourByte[0] == 0x5B && FourByte[1] == 0x82) {
  585. + pctxt->pbOp = FourByte + (FourByte[5] << (4+8+8)) + (FourByte[4] << (4+8)) + (FourByte[3] << 4) + (FourByte[2] & 0x0F) + 2;
  586. + }
  587. + else
  588. + rc = AMLIERR_OBJ_ALREADY_EXIST; // unknow Device() opcode coding
  589. + }
  590. + }
  591. + }
  592.  
  593. EXIT(2, ("Device=%x (pnsObj=%x)\n", rc, pterm->pnsObj));
  594. return rc;
  595. @@ -488,7 +761,7 @@
  596. pfd = (PFIELDOBJ)pterm->pnsObj->ObjData.pbDataBuff;
  597. pfd->pnsBase = pnsBase;
  598. rc = ParseFieldList(pctxt, pterm->pbOpEnd, pterm->pnsObj,
  599. - (ULONG)pterm->pdataArgs[1].uipDataValue,
  600. + (ULONG)pterm->pdataArgs[1].dwDataValue,
  601. ((POPREGIONOBJ)pnsBase->ObjData.pbDataBuff)->dwLen);
  602. }
  603. }
  604. @@ -563,7 +836,7 @@
  605. pif->pnsIndex = pnsIdx;
  606. pif->pnsData = pnsData;
  607. rc = ParseFieldList(pctxt, pterm->pbOpEnd, pterm->pnsObj,
  608. - (ULONG)pterm->pdataArgs[2].uipDataValue,
  609. + (ULONG)pterm->pdataArgs[2].dwDataValue,
  610. 0xffffffff);
  611. }
  612. }
  613. @@ -694,7 +967,7 @@
  614. &pterm->pnsObj, 0)) == STATUS_SUCCESS)
  615. {
  616. rc = InitMutex(pctxt->pheapCurrent, pterm->pnsObj,
  617. - (ULONG)pterm->pdataArgs[1].uipDataValue);
  618. + (ULONG)pterm->pdataArgs[1].dwDataValue);
  619. }
  620.  
  621. EXIT(2, ("Mutex=%x (pnsObj=%x)\n", rc, pterm->pnsObj));
  622. @@ -742,9 +1015,9 @@
  623. MEMZERO(pterm->pnsObj->ObjData.pbDataBuff,
  624. pterm->pnsObj->ObjData.dwDataLen);
  625. pop = (POPREGIONOBJ)pterm->pnsObj->ObjData.pbDataBuff;
  626. - pop->bRegionSpace = (UCHAR)pterm->pdataArgs[1].uipDataValue;
  627. - pop->uipOffset = pterm->pdataArgs[2].uipDataValue;
  628. - pop->dwLen = (ULONG)pterm->pdataArgs[3].uipDataValue;
  629. + pop->bRegionSpace = (UCHAR)pterm->pdataArgs[1].dwDataValue;
  630. + pop->uipOffset = pterm->pdataArgs[2].dwDataValue;
  631. + pop->dwLen = (ULONG)pterm->pdataArgs[3].dwDataValue;
  632. KeInitializeSpinLock(&pop->listLock);
  633. if (pop->bRegionSpace == REGSPACE_MEM)
  634. {
  635. @@ -831,8 +1104,8 @@
  636. MEMZERO(pterm->pnsObj->ObjData.pbDataBuff,
  637. pterm->pnsObj->ObjData.dwDataLen);
  638. ppr = (PPOWERRESOBJ)pterm->pnsObj->ObjData.pbDataBuff;
  639. - ppr->bSystemLevel = (UCHAR)pterm->pdataArgs[1].uipDataValue;
  640. - ppr->bResOrder = (UCHAR)pterm->pdataArgs[2].uipDataValue;
  641. + ppr->bSystemLevel = (UCHAR)pterm->pdataArgs[1].dwDataValue;
  642. + ppr->bResOrder = (UCHAR)pterm->pdataArgs[2].dwDataValue;
  643. if (ghCreate.pfnHandler != NULL)
  644. {
  645. ((PFNOO)ghCreate.pfnHandler)(OBJTYPE_POWERRES, pterm->pnsObj);
  646. @@ -890,9 +1163,9 @@
  647. MEMZERO(pterm->pnsObj->ObjData.pbDataBuff,
  648. pterm->pnsObj->ObjData.dwDataLen);
  649. pproc = (PPROCESSOROBJ)pterm->pnsObj->ObjData.pbDataBuff;
  650. - pproc->bApicID = (UCHAR)pterm->pdataArgs[1].uipDataValue;
  651. - pproc->dwPBlk = (ULONG)pterm->pdataArgs[2].uipDataValue;
  652. - pproc->dwPBlkLen = (ULONG)pterm->pdataArgs[3].uipDataValue;
  653. + pproc->bApicID = (UCHAR)pterm->pdataArgs[1].dwDataValue;
  654. + pproc->dwPBlk = (ULONG)pterm->pdataArgs[2].dwDataValue;
  655. + pproc->dwPBlkLen = (ULONG)pterm->pdataArgs[3].dwDataValue;
  656. if (ghCreate.pfnHandler != NULL)
  657. {
  658. ((PFNOO)ghCreate.pfnHandler)(OBJTYPE_PROCESSOR, pterm->pnsObj);
  659. diff --strip-trailing-cr -ur ./driver/amlinew/nsmod.c "c:\\ACPI\\ACPI_W2003\\Base\\busdrv\\acpi/driver/amlinew/nsmod.c"
  660. --- ./driver/amlinew/nsmod.c 2003-02-26 17:15:50.000000000 +0500
  661. +++ "c:\\ACPI\\ACPI_W2003\\Base\\busdrv\\acpi/driver/amlinew/nsmod.c" 2022-04-04 04:13:00.000000000 +0500
  662. @@ -45,7 +45,7 @@
  663. &pterm->pnsObj, 0)) == STATUS_SUCCESS))
  664. {
  665. pterm->pnsObj->ObjData.dwDataType = OBJTYPE_OBJALIAS;
  666. - pterm->pnsObj->ObjData.uipDataValue = (ULONG_PTR)pnsSrc;
  667. + pterm->pnsObj->ObjData.pnsAlias = pnsSrc;
  668. }
  669.  
  670. EXIT(2, ("Alias=%x (pnsObj=%x)\n", rc, pterm->pnsObj));
  671. Only in c:\ACPI\ACPI_W2003\Base\busdrv\acpi/driver/amlinew: obj
  672. diff --strip-trailing-cr -ur ./driver/amlinew/object.c "c:\\ACPI\\ACPI_W2003\\Base\\busdrv\\acpi/driver/amlinew/object.c"
  673. --- ./driver/amlinew/object.c 2003-02-26 17:15:50.000000000 +0500
  674. +++ "c:\\ACPI\\ACPI_W2003\\Base\\busdrv\\acpi/driver/amlinew/object.c" 2022-04-07 21:31:58.486328100 +0500
  675. @@ -71,7 +71,7 @@
  676.  
  677. EXIT(3, ("ReadObject=%x (Type=%s,Value=%x,Buff=%x)\n",
  678. rc, GetObjectTypeName(pdataResult->dwDataType),
  679. - pdataResult->uipDataValue, pdataResult->pbDataBuff));
  680. + pdataResult->dwDataValue, pdataResult->pbDataBuff));
  681. return rc;
  682. } //ReadObject
  683.  
  684. @@ -135,7 +135,7 @@
  685. break;
  686.  
  687. case OBJTYPE_INTDATA:
  688. - rc = CopyObjBuffer((PUCHAR)&pdataObj->uipDataValue, sizeof(ULONG),
  689. + rc = CopyObjBuffer((PUCHAR)&pdataObj->dwDataValue, sizeof(ULONG),
  690. pdataSrc);
  691. break;
  692.  
  693. @@ -157,7 +157,7 @@
  694.  
  695. EXIT(3, ("WriteObject=%x (ObjType=%s,DataType=%x,Value=%x,Buff=%x)\n",
  696. rc, GetObjectTypeName(pdataObj->dwDataType), pdataSrc->dwDataType,
  697. - pdataSrc->uipDataValue, pdataSrc->pbDataBuff));
  698. + pdataSrc->dwDataValue, pdataSrc->pbDataBuff));
  699. return rc;
  700. } //WriteObject
  701.  
  702. @@ -300,7 +300,7 @@
  703. ENTER(3, ("ReadField(pctxt=%x,pdataObj=%x,FieldDesc=%x,pdataResult=%x)\n",
  704. pctxt, pdataObj, pfd, pdataResult));
  705.  
  706. - if ((pfd->dwFieldFlags & ACCTYPE_MASK) <= ACCTYPE_DWORD)
  707. + if ((pfd->dwFieldFlags & ACCTYPE_MASK) <= ACCTYPE_QWORD)
  708. {
  709. PUCHAR pb;
  710. ULONG dwcb;
  711. @@ -309,10 +309,10 @@
  712. {
  713. case OBJTYPE_UNKNOWN:
  714. if (!(pfd->dwFieldFlags & FDF_BUFFER_TYPE) &&
  715. - (pfd->dwNumBits <= sizeof(ULONG)*8))
  716. + (pfd->dwNumBits <= sizeof(ULONG64)*8)) // dwNumBits = 64 for QWORD field
  717. {
  718. pdataResult->dwDataType = OBJTYPE_INTDATA;
  719. - pb = (PUCHAR)&pdataResult->uipDataValue;
  720. + pb = (PUCHAR)&pdataResult->dwDataValue;
  721. dwcb = sizeof(ULONG);
  722. }
  723. else
  724. @@ -340,8 +340,8 @@
  725. break;
  726.  
  727. case OBJTYPE_INTDATA:
  728. - pb = (PUCHAR)&pdataResult->uipDataValue;
  729. - dwcb = sizeof(ULONG);
  730. + pb = (PUCHAR)&pdataResult->dwDataValue;
  731. + dwcb = sizeof(ULONG); // acpi 2.0: sizeof(ULONG64)
  732. break;
  733.  
  734. case OBJTYPE_STRDATA:
  735. @@ -410,7 +410,7 @@
  736. ENTER(3, ("WriteField(pctxt=%x,pdataObj=%x,FieldDesc=%x,pdataSrc=%x)\n",
  737. pctxt, pdataObj, pfd, pdataSrc));
  738.  
  739. - if ((pfd->dwFieldFlags & ACCTYPE_MASK) <= ACCTYPE_DWORD)
  740. + if ((pfd->dwFieldFlags & ACCTYPE_MASK) <= ACCTYPE_QWORD)
  741. {
  742. PWRFIELDLOOP pwfl;
  743.  
  744. @@ -418,7 +418,7 @@
  745. {
  746. case OBJTYPE_INTDATA:
  747. dwBuffSize = MIN(sizeof(ULONG), dwDataInc);
  748. - pbBuff = (PUCHAR)&pdataSrc->uipDataValue;
  749. + pbBuff = (PUCHAR)&pdataSrc->dwDataValue;
  750. break;
  751.  
  752. case OBJTYPE_STRDATA:
  753. @@ -584,6 +584,8 @@
  754. * returns AMLIERR_ code
  755. */
  756.  
  757. +#ifdef _X86_
  758. +
  759. NTSTATUS LOCAL ReadFieldObj(PCTXT pctxt, PACCFIELDOBJ pafo, NTSTATUS rc)
  760. {
  761. TRACENAME("READFIELDOBJ")
  762. @@ -844,6 +846,8 @@
  763. return rc;
  764. } //WriteFieldObj
  765.  
  766. +#endif // _X86_
  767. +
  768. /***LP RawFieldAccess - Find and call the RawAccess handler for the RegionSpace
  769. *
  770. * ENTRY
  771. @@ -976,6 +980,7 @@
  772. * EXIT-FAILURE
  773. * returns AMLIERR_ code
  774. */
  775. +#ifdef _X86_
  776.  
  777. NTSTATUS LOCAL AccessFieldData(PCTXT pctxt, POBJDATA pdataObj, PFIELDDESC pfd,
  778. PULONG pdwData, BOOLEAN fRead)
  779. @@ -1051,6 +1056,8 @@
  780. return rc;
  781. } //AccessFieldData
  782.  
  783. +#endif // _X86_
  784. +
  785. /***LP PushPreserveWriteObj - Push a PreserveWrObj frame on the stack
  786. *
  787. * ENTRY
  788. @@ -1164,6 +1171,8 @@
  789. * If pdwData is NULL, it implies a read access.
  790. */
  791.  
  792. +#ifdef _X86_
  793. +
  794. NTSTATUS LOCAL AccessBaseField(PCTXT pctxt, PNSOBJ pnsBase, PFIELDDESC pfd,
  795. PULONG pdwData, BOOLEAN fRead)
  796. {
  797. @@ -1303,6 +1312,8 @@
  798. return rc;
  799. } //AccessBaseField
  800.  
  801. +#endif // _X86_
  802. +
  803. /***LP WriteCookAccess - do a region space write cook access
  804. *
  805. * ENTRY
  806. @@ -1500,6 +1511,8 @@
  807. * returns AMLIERR_ code
  808. */
  809.  
  810. +#ifdef _X86_
  811. +
  812. NTSTATUS LOCAL ReadBuffField(PBUFFFIELDOBJ pbf, PFIELDDESC pfd, PULONG pdwData)
  813. {
  814. TRACENAME("READBUFFFIELD")
  815. @@ -1568,6 +1581,7 @@
  816. return rc;
  817. } //WriteBuffField
  818.  
  819. +#endif // _X86_
  820.  
  821. /***LP ReadSystemMem - Read system memory
  822. *
  823. @@ -1579,6 +1593,7 @@
  824. * EXIT
  825. * return memory content
  826. */
  827. +#ifdef _X86_
  828.  
  829. ULONG LOCAL ReadSystemMem(ULONG_PTR uipAddr, ULONG dwSize, ULONG dwMask)
  830. {
  831. @@ -1748,7 +1763,7 @@
  832. EXIT(3, ("WriteSystemMem!\n"));
  833. } //WriteSystemMem
  834.  
  835. -
  836. +#endif // _X86_
  837.  
  838. /***LP ReadSystemIO - Read system IO
  839. *
  840. @@ -1909,7 +1924,7 @@
  841.  
  842. case OBJTYPE_INTDATA:
  843. PRINTF("Integer(%s:Value=0x%08x[%d])",
  844. - pszName, pdata->uipDataValue, pdata->uipDataValue);
  845. + pszName, pdata->dwDataValue, pdata->dwDataValue);
  846. break;
  847.  
  848. case OBJTYPE_STRDATA:
  849. diff --strip-trailing-cr -ur ./driver/amlinew/parser.c "c:\\ACPI\\ACPI_W2003\\Base\\busdrv\\acpi/driver/amlinew/parser.c"
  850. --- ./driver/amlinew/parser.c 2003-02-26 17:15:50.000000000 +0500
  851. +++ "c:\\ACPI\\ACPI_W2003\\Base\\busdrv\\acpi/driver/amlinew/parser.c" 2022-05-11 02:01:41.366210900 +0500
  852. @@ -30,7 +30,9 @@
  853. NTSTATUS LOCAL ParseScope(PCTXT pctxt, PSCOPE pscope, NTSTATUS rc)
  854. {
  855. TRACENAME("PARSESCOPE")
  856. - ULONG dwStage = ((rc == STATUS_SUCCESS) || (rc == AMLISTA_BREAK))?
  857. + ULONG dwStage = ((rc == STATUS_SUCCESS) ||
  858. + (rc == AMLISTA_BREAK) ||
  859. + (rc == AMLISTA_CONTINUEOP))?
  860. (pscope->FrameHdr.dwfFrame & FRAMEF_STAGE_MASK): 2;
  861.  
  862. ENTER(2, ("ParseScope(Stage=%d,pctxt=%p,pbOp=%p,pscope=%p,rc=%x)\n",
  863. @@ -67,9 +69,20 @@
  864. if (rc == AMLISTA_BREAK)
  865. {
  866. pctxt->pbOp = pscope->pbOpEnd;
  867. - rc = STATUS_SUCCESS;
  868. - }
  869. - else
  870. +
  871. + pscope->pbOpRet = pscope->pbOpEnd;
  872. + if (pscope->FrameHdr.dwfFrame & CALLF_ACQ_MUTEX) { // test byte ptr [esi+0Ah], 2
  873. + rc = STATUS_SUCCESS;
  874. + }
  875. + } else
  876. + if (rc == AMLISTA_CONTINUEOP)
  877. + {
  878. + pctxt->pbOp = pscope->pbOpEnd;
  879. +
  880. + if (pscope->FrameHdr.dwfFrame & CALLF_ACQ_MUTEX) { // test byte ptr [esi+0Ah], 2
  881. + rc = STATUS_SUCCESS;
  882. + }
  883. + } else
  884. {
  885. while (pctxt->pbOp < pscope->pbOpEnd)
  886. {
  887. @@ -113,7 +126,19 @@
  888. if (rc == AMLISTA_BREAK)
  889. {
  890. pctxt->pbOp = pscope->pbOpEnd;
  891. - rc = STATUS_SUCCESS;
  892. +
  893. + pscope->pbOpRet = pscope->pbOpEnd;
  894. + if (pscope->FrameHdr.dwfFrame & CALLF_ACQ_MUTEX) { // test byte ptr [esi+0Ah], 2
  895. + rc = STATUS_SUCCESS;
  896. + }
  897. + }
  898. + else if (rc == AMLISTA_CONTINUEOP)
  899. + {
  900. + pctxt->pbOp = pscope->pbOpEnd;
  901. +
  902. + if (pscope->FrameHdr.dwfFrame & CALLF_ACQ_MUTEX) { // test byte ptr [esi+0Ah], 2
  903. + rc = STATUS_SUCCESS;
  904. + }
  905. }
  906. else if ((rc == AMLISTA_PENDING) ||
  907. (&pscope->FrameHdr !=
  908. @@ -723,12 +748,12 @@
  909. pacq->pdataResult->dwDataType = OBJTYPE_INTDATA;
  910. if (rc == AMLISTA_TIMEOUT)
  911. {
  912. - pacq->pdataResult->uipDataValue = DATAVALUE_ONES;
  913. + pacq->pdataResult->dwDataValue = DATAVALUE_ONES;
  914. rc = STATUS_SUCCESS;
  915. }
  916. else
  917. {
  918. - pacq->pdataResult->uipDataValue = DATAVALUE_ZERO;
  919. + pacq->pdataResult->dwDataValue = DATAVALUE_ZERO;
  920. }
  921. }
  922. }
  923. @@ -1233,12 +1258,12 @@
  924. bOp = **ppbOp;
  925. (*ppbOp)++;
  926. pdataResult->dwDataType = OBJTYPE_INTDATA;
  927. - pdataResult->uipDataValue = 0;
  928. + pdataResult->dwDataValue = 0;
  929.  
  930. switch (bOp)
  931. {
  932. case OP_ZERO:
  933. - pdataResult->uipDataValue = DATAVALUE_ZERO;
  934. + pdataResult->dwDataValue = DATAVALUE_ZERO;
  935. #ifdef DEBUGGER
  936. if (gDebugger.dwfDebugger &
  937. (DBGF_AMLTRACE_ON | DBGF_STEP_MODES))
  938. @@ -1249,7 +1274,7 @@
  939. break;
  940.  
  941. case OP_ONE:
  942. - pdataResult->uipDataValue = DATAVALUE_ONE;
  943. + pdataResult->dwDataValue = DATAVALUE_ONE;
  944. #ifdef DEBUGGER
  945. if (gDebugger.dwfDebugger &
  946. (DBGF_AMLTRACE_ON | DBGF_STEP_MODES))
  947. @@ -1260,7 +1285,7 @@
  948. break;
  949.  
  950. case OP_ONES:
  951. - pdataResult->uipDataValue = DATAVALUE_ONES;
  952. + pdataResult->dwDataValue = DATAVALUE_ONES;
  953. #ifdef DEBUGGER
  954. if (gDebugger.dwfDebugger &
  955. (DBGF_AMLTRACE_ON | DBGF_STEP_MODES))
  956. @@ -1271,7 +1296,7 @@
  957. break;
  958.  
  959. case OP_REVISION:
  960. - pdataResult->uipDataValue = AMLI_REVISION;
  961. + pdataResult->dwDataValue = AMLI_REVISION;
  962. #ifdef DEBUGGER
  963. if (gDebugger.dwfDebugger &
  964. (DBGF_AMLTRACE_ON | DBGF_STEP_MODES))
  965. @@ -1282,37 +1307,49 @@
  966. break;
  967.  
  968. case OP_BYTE:
  969. - MEMCPY(&pdataResult->uipDataValue, *ppbOp, sizeof(UCHAR));
  970. + MEMCPY(&pdataResult->dwDataValue, *ppbOp, sizeof(UCHAR));
  971. (*ppbOp) += sizeof(UCHAR);
  972. #ifdef DEBUGGER
  973. if (gDebugger.dwfDebugger &
  974. (DBGF_AMLTRACE_ON | DBGF_STEP_MODES))
  975. {
  976. - PRINTF("0x%x", pdataResult->uipDataValue);
  977. + PRINTF("0x%x", pdataResult->dwDataValue);
  978. }
  979. #endif
  980. break;
  981.  
  982. case OP_WORD:
  983. - MEMCPY(&pdataResult->uipDataValue, *ppbOp, sizeof(USHORT));
  984. + MEMCPY(&pdataResult->dwDataValue, *ppbOp, sizeof(USHORT));
  985. (*ppbOp) += sizeof(USHORT);
  986. #ifdef DEBUGGER
  987. if (gDebugger.dwfDebugger &
  988. (DBGF_AMLTRACE_ON | DBGF_STEP_MODES))
  989. {
  990. - PRINTF("0x%x", pdataResult->uipDataValue);
  991. + PRINTF("0x%x", pdataResult->dwDataValue);
  992. }
  993. #endif
  994. break;
  995.  
  996. case OP_DWORD:
  997. - MEMCPY(&pdataResult->uipDataValue, *ppbOp, sizeof(ULONG));
  998. + MEMCPY(&pdataResult->dwDataValue, *ppbOp, sizeof(ULONG));
  999. (*ppbOp) += sizeof(ULONG);
  1000. #ifdef DEBUGGER
  1001. if (gDebugger.dwfDebugger &
  1002. (DBGF_AMLTRACE_ON | DBGF_STEP_MODES))
  1003. {
  1004. - PRINTF("0x%x", pdataResult->uipDataValue);
  1005. + PRINTF("0x%x", pdataResult->dwDataValue);
  1006. + }
  1007. + #endif
  1008. + break;
  1009. +
  1010. + case OP_QWORD:
  1011. + MEMCPY(&pdataResult->dwDataValue, *ppbOp, sizeof(ULONG)); // ignores high 4 bytes
  1012. + (*ppbOp) += sizeof(ULONG64);
  1013. + #ifdef DEBUGGER
  1014. + if (gDebugger.dwfDebugger &
  1015. + (DBGF_AMLTRACE_ON | DBGF_STEP_MODES))
  1016. + {
  1017. + PRINTF("0x%x", pdataResult->dwDataValue);
  1018. }
  1019. #endif
  1020. break;
  1021. @@ -1332,7 +1369,7 @@
  1022. }
  1023.  
  1024. EXIT(2, ("ParseIntObj=%x (pbOp=%x,Value=%x)\n",
  1025. - rc, *ppbOp, pdataResult->uipDataValue));
  1026. + rc, *ppbOp, pdataResult->dwDataValue));
  1027. return rc;
  1028. } //ParseIntObj
  1029.  
  1030. @@ -1650,8 +1687,8 @@
  1031.  
  1032. ASSERT(pdata != NULL);
  1033. pdata->dwDataType = OBJTYPE_INTDATA;
  1034. - pdata->uipDataValue = 0;
  1035. - MEMCPY(&pdata->uipDataValue, *ppbOp, dwDataLen);
  1036. + pdata->dwDataValue = 0;
  1037. + MEMCPY(&pdata->dwDataValue, *ppbOp, dwDataLen);
  1038. (*ppbOp) += dwDataLen;
  1039.  
  1040. #ifdef DEBUGGER
  1041. @@ -1660,12 +1697,12 @@
  1042. (DBGF_AMLTRACE_ON | DBGF_STEP_MODES)))
  1043.  
  1044. {
  1045. - PRINTF("0x%x", pdata->uipDataValue);
  1046. + PRINTF("0x%x", pdata->dwDataValue);
  1047. }
  1048. #endif
  1049.  
  1050. EXIT(2, ("ParseInteger=%x (Value=%x,pbOp=%x)\n",
  1051. - rc, pdata->uipDataValue, *ppbOp));
  1052. + rc, pdata->dwDataValue, *ppbOp));
  1053. return rc;
  1054. } //ParseInteger
  1055.  
  1056. @@ -1692,6 +1729,22 @@
  1057.  
  1058. ENTER(2, ("ParseField(pctxt=%x,pbOp=%x,pnsParent=%x,FieldFlags=%x,BitPos=%x)\n",
  1059. pctxt, pctxt->pbOp, pnsParent, *pdwFieldFlags, *pdwBitPos));
  1060. +
  1061. + // Connection Field, skip Connection() and jump to field definition
  1062. + if (*pctxt->pbOp == 0x02) {
  1063. + PUCHAR pbOp = pctxt->pbOp + 1;
  1064. +
  1065. + if (*pbOp == 0x11) { // BufferOp()
  1066. + ULONG dwcbBits;
  1067. + pbOp++;
  1068. + dwcbBits = ParsePackageLen(&pbOp, NULL);
  1069. + pctxt->pbOp += 2; // 0x02, 0x11, [Buffer]
  1070. + pctxt->pbOp += dwcbBits; // Buffer len
  1071. + } else { // NAMESEG
  1072. + pctxt->pbOp += 1; // 0x02, NAMESEG
  1073. + pctxt->pbOp += 4; // sizeof(NAMESEG)
  1074. + }
  1075. + }
  1076.  
  1077. if (*pctxt->pbOp == 0x01)
  1078. {
  1079. diff --strip-trailing-cr -ur ./driver/amlinew/pch.h "c:\\ACPI\\ACPI_W2003\\Base\\busdrv\\acpi/driver/amlinew/pch.h"
  1080. --- ./driver/amlinew/pch.h 2003-02-26 17:15:50.000000000 +0500
  1081. +++ "c:\\ACPI\\ACPI_W2003\\Base\\busdrv\\acpi/driver/amlinew/pch.h" 2022-04-04 00:10:34.000000000 +0500
  1082. @@ -18,7 +18,7 @@
  1083. //
  1084. #include <ntacpi.h>
  1085.  
  1086. -
  1087. +#include "arblib.h"
  1088. #include "amlipriv.h"
  1089. #include "ctxt.h"
  1090. #include "data.h"
  1091. diff --strip-trailing-cr -ur ./driver/amlinew/proto.h "c:\\ACPI\\ACPI_W2003\\Base\\busdrv\\acpi/driver/amlinew/proto.h"
  1092. --- ./driver/amlinew/proto.h 2003-02-26 17:15:50.000000000 +0500
  1093. +++ "c:\\ACPI\\ACPI_W2003\\Base\\busdrv\\acpi/driver/amlinew/proto.h" 2022-03-31 19:33:10.000000000 +0500
  1094. @@ -150,6 +150,20 @@
  1095. BOOLEAN LOCAL MatchData(ULONG dwPkgData, ULONG dwOp, ULONG dwData);
  1096. NTSTATUS LOCAL OSInterface(PCTXT pctxt, PTERM pterm);
  1097.  
  1098. +// ACPI 2.0
  1099. +NTSTATUS LOCAL ToInteger(PCTXT pctxt, PTERM pterm);
  1100. +NTSTATUS LOCAL ToHexString(PCTXT pctxt, PTERM pterm);
  1101. +NTSTATUS LOCAL ToDecimalString(PCTXT pctxt, PTERM pterm);
  1102. +NTSTATUS LOCAL ToBuffer(PCTXT pctxt, PTERM pterm);
  1103. +NTSTATUS LOCAL CreateQWordField(PCTXT pctxt, PTERM pterm);
  1104. +NTSTATUS LOCAL ConcatenateResTemplate(PCTXT pctxt, PTERM pterm);
  1105. +NTSTATUS LOCAL Mod(PCTXT pctxt, PTERM pterm);
  1106. +NTSTATUS LOCAL ToString(PCTXT pctxt, PTERM pterm);
  1107. +NTSTATUS LOCAL CopyObject(PCTXT pctxt, PTERM pterm);
  1108. +NTSTATUS LOCAL MidString(PCTXT pctxt, PTERM pterm);
  1109. +NTSTATUS LOCAL Continue(PCTXT pctxt, PTERM pterm);
  1110. +NTSTATUS LOCAL Timer(PCTXT pctxt, PTERM pterm);
  1111. +
  1112. //object.c
  1113. NTSTATUS LOCAL ReadObject(PCTXT pctxt, POBJDATA pdataObj, POBJDATA pdataResult);
  1114. NTSTATUS LOCAL WriteObject(PCTXT pctxt, POBJDATA pdataObj, POBJDATA pdataSrc);
  1115. diff --strip-trailing-cr -ur ./driver/amlinew/strlib.c "c:\\ACPI\\ACPI_W2003\\Base\\busdrv\\acpi/driver/amlinew/strlib.c"
  1116. --- ./driver/amlinew/strlib.c 2003-02-26 17:15:50.000000000 +0500
  1117. +++ "c:\\ACPI\\ACPI_W2003\\Base\\busdrv\\acpi/driver/amlinew/strlib.c" 2022-04-04 01:34:22.000000000 +0500
  1118. @@ -27,15 +27,20 @@
  1119. ULONG EXPORT StrLen(PSZ psz, ULONG n)
  1120. {
  1121. TRACENAME("STRLEN")
  1122. - ULONG dwLen;
  1123. + ULONG dwLen = 0;
  1124.  
  1125. ENTER(5, ("StrLen(str=%s,n=%d)\n", psz, n));
  1126. -
  1127. ASSERT(psz != NULL);
  1128. - if (n != (ULONG)-1)
  1129. - n++;
  1130. - for (dwLen = 0; (dwLen <= n) && (*psz != '\0'); psz++)
  1131. - dwLen++;
  1132. +
  1133. + if (n > 0) {
  1134. + do {
  1135. + if ( !(*psz) )
  1136. + break;
  1137. + ++dwLen;
  1138. + ++psz;
  1139. + }
  1140. + while (dwLen < n);
  1141. + }
  1142.  
  1143. EXIT(5, ("StrLen=%u\n", dwLen));
  1144. return dwLen;
  1145. @@ -62,9 +67,12 @@
  1146. ASSERT(pszDst != NULL);
  1147. ASSERT(pszSrc != NULL);
  1148.  
  1149. - dwSrcLen = StrLen(pszSrc, n);
  1150. - if ((n == (ULONG)(-1)) || (n > dwSrcLen))
  1151. - n = dwSrcLen;
  1152. + if (n == (ULONG)(-1)) {
  1153. + dwSrcLen = StrLen(pszSrc, (ULONG)(-1));
  1154. +
  1155. + if (dwSrcLen < (ULONG)(-1))
  1156. + n = dwSrcLen;
  1157. + }
  1158.  
  1159. MEMCPY(pszDst, pszSrc, n);
  1160. pszDst[n] = '\0';
  1161. diff --strip-trailing-cr -ur ./driver/amlinew/sync.c "c:\\ACPI\\ACPI_W2003\\Base\\busdrv\\acpi/driver/amlinew/sync.c"
  1162. --- ./driver/amlinew/sync.c 2003-02-26 17:15:50.000000000 +0500
  1163. +++ "c:\\ACPI\\ACPI_W2003\\Base\\busdrv\\acpi/driver/amlinew/sync.c" 2022-04-04 05:24:12.000000000 +0500
  1164. @@ -63,23 +63,22 @@
  1165. (ULONG_PTR)pvContext);
  1166. EvalMethodComplete(pctxt, rcCtxt, (PSYNCEVENT)pvContext);
  1167. }
  1168. - else if (pfnAsyncCallBack != NULL)
  1169. + else
  1170. + if (rcCtxt == AMLISTA_CONTINUE)
  1171. {
  1172. - if (rcCtxt == AMLISTA_CONTINUE)
  1173. - {
  1174. - //
  1175. - // We are not done yet, restart the AsyncEval context using
  1176. - // current thread.
  1177. - //
  1178. - ASSERT(pctxt->dwfCtxt & CTXTF_ASYNC_EVAL);
  1179. - RestartContext(pctxt, FALSE);
  1180. - }
  1181. - else
  1182. - {
  1183. - LOGSCHEDEVENT('ASCB', (ULONG_PTR)pnsObj, (ULONG_PTR)rcCtxt,
  1184. - (ULONG_PTR)pvContext);
  1185. - pfnAsyncCallBack(pnsObj, rcCtxt, pdataCallBack, pvContext);
  1186. - }
  1187. + //
  1188. + // We are not done yet, restart the AsyncEval context using
  1189. + // current thread.
  1190. + //
  1191. + ASSERT(pctxt->dwfCtxt & CTXTF_ASYNC_EVAL);
  1192. + RestartContext(pctxt, FALSE);
  1193. + }
  1194. + else
  1195. + if (pfnAsyncCallBack != NULL)
  1196. + {
  1197. + LOGSCHEDEVENT('ASCB', (ULONG_PTR)pnsObj, (ULONG_PTR)rcCtxt,
  1198. + (ULONG_PTR)pvContext);
  1199. + pfnAsyncCallBack(pnsObj, rcCtxt, pdataCallBack, pvContext);
  1200. }
  1201.  
  1202. EXIT(2, ("AsyncCallBack!\n"));
  1203. diff --strip-trailing-cr -ur ./driver/amlinew/trace.c "c:\\ACPI\\ACPI_W2003\\Base\\busdrv\\acpi/driver/amlinew/trace.c"
  1204. --- ./driver/amlinew/trace.c 2003-02-26 17:15:50.000000000 +0500
  1205. +++ "c:\\ACPI\\ACPI_W2003\\Base\\busdrv\\acpi/driver/amlinew/trace.c" 2022-04-06 04:46:41.037109300 +0500
  1206. @@ -43,6 +43,16 @@
  1207. {
  1208. BOOLEAN rc = FALSE;
  1209.  
  1210. + if (
  1211. + !_stricmp(pszProcName, "VALIDATEARGTYPES") ||
  1212. + !_stricmp(pszProcName, "VALIDATETARGET") ||
  1213. + !_stricmp(pszProcName, "xxx") ||
  1214. + !_stricmp(pszProcName, "yyy")
  1215. + )
  1216. + {
  1217. + rc = TRUE;
  1218. + }
  1219. +
  1220. if (!(gDebugger.dwfDebugger & (DBGF_IN_DEBUGGER | DBGF_CHECKING_TRACE)))
  1221. {
  1222. gDebugger.dwfDebugger |= DBGF_CHECKING_TRACE;
  1223. diff --strip-trailing-cr -ur ./driver/amlinew/type1op.c "c:\\ACPI\\ACPI_W2003\\Base\\busdrv\\acpi/driver/amlinew/type1op.c"
  1224. --- ./driver/amlinew/type1op.c 2003-02-26 17:15:50.000000000 +0500
  1225. +++ "c:\\ACPI\\ACPI_W2003\\Base\\busdrv\\acpi/driver/amlinew/type1op.c" 2022-04-04 04:02:00.000000000 +0500
  1226. @@ -93,9 +93,9 @@
  1227. {
  1228. if (ghFatal.pfnHandler != NULL)
  1229. {
  1230. - ((PFNFT)ghFatal.pfnHandler)((ULONG)pterm->pdataArgs[0].uipDataValue,
  1231. - (ULONG)pterm->pdataArgs[1].uipDataValue,
  1232. - (ULONG)pterm->pdataArgs[2].uipDataValue,
  1233. + ((PFNFT)ghFatal.pfnHandler)((ULONG)pterm->pdataArgs[0].dwDataValue,
  1234. + (ULONG)pterm->pdataArgs[1].dwDataValue,
  1235. + (ULONG)pterm->pdataArgs[2].dwDataValue,
  1236. (ULONG_PTR) pctxt,
  1237. ghFatal.uipParam);
  1238. }
  1239. @@ -133,7 +133,7 @@
  1240. {
  1241. if ((rc = ValidateArgTypes(pterm->pdataArgs, "I")) == STATUS_SUCCESS)
  1242. {
  1243. - if (pterm->pdataArgs[0].uipDataValue == 0)
  1244. + if (pterm->pdataArgs[0].dwDataValue == 0)
  1245. {
  1246. //
  1247. // FALSE case, we must skip TRUE scope.
  1248. @@ -187,7 +187,7 @@
  1249. ("IfElse: Else statement found without matching If"));
  1250. }
  1251.  
  1252. - EXIT(2, ("IfElse=%x (value=%x)\n", rc, pterm->pdataArgs[0].uipDataValue));
  1253. + EXIT(2, ("IfElse=%x (value=%x)\n", rc, pterm->pdataArgs[0].dwDataValue));
  1254. return rc;
  1255. } //IfElse
  1256.  
  1257. @@ -303,22 +303,22 @@
  1258. DEREF(pctxt);
  1259. if ((rc = ValidateArgTypes(pterm->pdataArgs, "OI")) == STATUS_SUCCESS)
  1260. {
  1261. - if (pterm->pdataArgs[1].uipDataValue > MAX_BYTE)
  1262. + if (pterm->pdataArgs[1].dwDataValue > MAX_BYTE)
  1263. {
  1264. rc = AMLI_LOGERR(AMLIERR_INVALID_DATA,
  1265. ("Notify: Notification value is greater than a byte value (Value=%x)",
  1266. - pterm->pdataArgs[1].uipDataValue));
  1267. + pterm->pdataArgs[1].dwDataValue));
  1268. }
  1269. else if (ghNotify.pfnHandler != NULL)
  1270. {
  1271. pterm->pnsObj = pterm->pdataArgs[0].pnsAlias;
  1272.  
  1273. ENTER(2, ("pfnNotify(Value=%x,Obj=%s,Param=%x)\n",
  1274. - pterm->pdataArgs[1].uipDataValue,
  1275. + pterm->pdataArgs[1].dwDataValue,
  1276. GetObjectPath(pterm->pnsObj), ghNotify.uipParam));
  1277.  
  1278. rc = ((PFNNH)ghNotify.pfnHandler)(EVTYPE_NOTIFY,
  1279. - (ULONG)pterm->pdataArgs[1].uipDataValue,
  1280. + (ULONG)pterm->pdataArgs[1].dwDataValue,
  1281. pterm->pnsObj, (ULONG)ghNotify.uipParam,
  1282. RestartCtxtCallback,
  1283. &(pctxt->CtxtData));
  1284. @@ -508,18 +508,18 @@
  1285. {
  1286. if (pterm->pamlterm->dwOpcode == OP_SLEEP)
  1287. {
  1288. - ENTER(2, ("Sleep(dwMS=%d)\n", pterm->pdataArgs[0].uipDataValue));
  1289. - if (pterm->pdataArgs[0].uipDataValue > MAX_WORD)
  1290. + ENTER(2, ("Sleep(dwMS=%d)\n", pterm->pdataArgs[0].dwDataValue));
  1291. + if (pterm->pdataArgs[0].dwDataValue > MAX_WORD)
  1292. {
  1293. rc = AMLI_LOGERR(AMLIERR_INVALID_DATA,
  1294. ("Sleep: sleep value is greater than a word value (Value=%x)",
  1295. - pterm->pdataArgs[0].uipDataValue));
  1296. + pterm->pdataArgs[0].dwDataValue));
  1297. }
  1298. - else if (pterm->pdataArgs[0].uipDataValue != 0)
  1299. + else if (pterm->pdataArgs[0].dwDataValue != 0)
  1300. {
  1301. if ((rc = SleepQueueRequest(
  1302. pctxt,
  1303. - (ULONG)pterm->pdataArgs[0].uipDataValue)) ==
  1304. + (ULONG)pterm->pdataArgs[0].dwDataValue)) ==
  1305. STATUS_SUCCESS)
  1306. {
  1307. rc = AMLISTA_PENDING;
  1308. @@ -527,16 +527,16 @@
  1309. }
  1310. EXIT(2, ("Sleep=%x\n", rc));
  1311. }
  1312. - else if (pterm->pdataArgs[0].uipDataValue > MAX_BYTE)
  1313. + else if (pterm->pdataArgs[0].dwDataValue > MAX_BYTE)
  1314. {
  1315. rc = AMLI_LOGERR(AMLIERR_INVALID_DATA,
  1316. ("Stall: stall value is greater than a byte value (Value=%x)",
  1317. - pterm->pdataArgs[0].uipDataValue));
  1318. + pterm->pdataArgs[0].dwDataValue));
  1319. }
  1320. else
  1321. {
  1322. - ENTER(2, ("Stall(dwUS=%d)\n", pterm->pdataArgs[0].uipDataValue));
  1323. - KeStallExecutionProcessor((ULONG)pterm->pdataArgs[0].uipDataValue);
  1324. + ENTER(2, ("Stall(dwUS=%d)\n", pterm->pdataArgs[0].dwDataValue));
  1325. + KeStallExecutionProcessor((ULONG)pterm->pdataArgs[0].dwDataValue);
  1326. EXIT(2, ("Stall=%x\n", rc));
  1327. }
  1328. }
  1329. @@ -566,7 +566,7 @@
  1330.  
  1331. if ((rc = ValidateArgTypes(pterm->pdataArgs, "I")) == STATUS_SUCCESS)
  1332. {
  1333. - if (pterm->pdataArgs[0].uipDataValue == 0)
  1334. + if (pterm->pdataArgs[0].dwDataValue == 0)
  1335. {
  1336. //
  1337. // FALSE case, skip the while scope.
  1338. @@ -581,9 +581,12 @@
  1339. rc = PushScope(pctxt, pctxt->pbOp, pterm->pbOpEnd, pterm->pbOpTerm,
  1340. pctxt->pnsScope, pctxt->powner, pctxt->pheapCurrent,
  1341. pterm->pdataResult);
  1342. + if (!rc) {
  1343. + ((PFRAMEHDR)pctxt->LocalHeap.pbHeapEnd)->dwfFrame |= CALLF_ACQ_MUTEX;
  1344. + }
  1345. }
  1346. }
  1347.  
  1348. - EXIT(2, ("While=%x (value=%x)\n", rc, pterm->pdataArgs[0].uipDataValue));
  1349. + EXIT(2, ("While=%x (value=%x)\n", rc, pterm->pdataArgs[0].dwDataValue));
  1350. return rc;
  1351. } //While
  1352. diff --strip-trailing-cr -ur ./driver/amlinew/type2op.c "c:\\ACPI\\ACPI_W2003\\Base\\busdrv\\acpi/driver/amlinew/type2op.c"
  1353. --- ./driver/amlinew/type2op.c 2003-02-26 17:15:50.000000000 +0500
  1354. +++ "c:\\ACPI\\ACPI_W2003\\Base\\busdrv\\acpi/driver/amlinew/type2op.c" 2022-12-03 18:28:01.590820300 +0500
  1355. @@ -28,6 +28,7 @@
  1356.  
  1357. NTSTATUS LOCAL Buffer(PCTXT pctxt, PTERM pterm)
  1358. {
  1359. + USHORT* wIOBuf;
  1360. TRACENAME("BUFFER")
  1361. NTSTATUS rc = STATUS_SUCCESS;
  1362. ULONG dwInitSize = (ULONG)(pterm->pbOpEnd - pctxt->pbOp);
  1363. @@ -44,35 +45,73 @@
  1364. }
  1365. #endif
  1366.  
  1367. - if ((ULONG)pterm->pdataArgs[0].uipDataValue < dwInitSize)
  1368. + if ((ULONG)pterm->pdataArgs[0].dwDataValue < dwInitSize)
  1369. {
  1370. rc = AMLI_LOGERR(AMLIERR_BUFF_TOOSMALL,
  1371. ("Buffer: too many initializers (buffsize=%d,InitSize=%d)",
  1372. - pterm->pdataArgs[0].uipDataValue, dwInitSize));
  1373. + pterm->pdataArgs[0].dwDataValue, dwInitSize));
  1374. }
  1375. - else if (pterm->pdataArgs[0].uipDataValue == 0)
  1376. + else if (pterm->pdataArgs[0].dwDataValue == 0)
  1377. {
  1378. rc = AMLI_LOGERR(AMLIERR_INVALID_BUFFSIZE,
  1379. ("Buffer: invalid buffer size (size=%d)",
  1380. - pterm->pdataArgs[0].uipDataValue));
  1381. + pterm->pdataArgs[0].dwDataValue));
  1382. +
  1383. + // Zero length buffer BSOD workaround
  1384. + pterm->pdataResult->pbDataBuff = NEWBDOBJ(gpheapGlobal, 1); // alloc 1 byte fake buffer
  1385. + pterm->pdataResult->dwDataType = OBJTYPE_BUFFDATA;
  1386. + pterm->pdataResult->dwDataLen = 1;
  1387. + MEMZERO(pterm->pdataResult->pbDataBuff, 1);
  1388. + pctxt->pbOp = pterm->pbOpEnd;
  1389. +
  1390. + rc = STATUS_SUCCESS;
  1391. +
  1392. }
  1393. else if ((pterm->pdataResult->pbDataBuff =
  1394. NEWBDOBJ(gpheapGlobal,
  1395. - (ULONG)pterm->pdataArgs[0].uipDataValue)) == NULL)
  1396. + (ULONG)pterm->pdataArgs[0].dwDataValue)) == NULL)
  1397. {
  1398. rc = AMLI_LOGERR(AMLIERR_OUT_OF_MEM,
  1399. ("Buffer: failed to allocate data buffer (size=%d)",
  1400. - pterm->pdataArgs[0].uipDataValue));
  1401. + pterm->pdataArgs[0].dwDataValue));
  1402. }
  1403. else
  1404. {
  1405. pterm->pdataResult->dwDataType = OBJTYPE_BUFFDATA;
  1406. pterm->pdataResult->dwDataLen = (ULONG)
  1407. - pterm->pdataArgs[0].uipDataValue;
  1408. + pterm->pdataArgs[0].dwDataValue;
  1409. MEMZERO(pterm->pdataResult->pbDataBuff,
  1410. pterm->pdataResult->dwDataLen);
  1411. MEMCPY(pterm->pdataResult->pbDataBuff, pctxt->pbOp, dwInitSize);
  1412. pctxt->pbOp = pterm->pbOpEnd;
  1413. +
  1414. + /* IOTRAPS range 0xFF00-0xFFFF vs VGA (10-bit decode!) conflict workaround
  1415. + Device (IOTR)
  1416. + {
  1417. + ...
  1418. + Name (BUF0, ResourceTemplate ()
  1419. + {
  1420. + IO (Decode16,
  1421. + 0x0000, // Range Minimum
  1422. + 0x0000, // Range Maximum
  1423. + 0x01, // Alignment
  1424. + 0xFF, // Length > 1
  1425. + _Y21)
  1426. + }) binary: 11 0D 0A _47 01 00 00 00 00 01 FF 79 00_
  1427. + ...
  1428. + }
  1429. + */
  1430. +
  1431. + if (dwInitSize == 10) {
  1432. + wIOBuf = (USHORT*) pterm->pdataResult->pbDataBuff;
  1433. + if (wIOBuf[0] == 0x0147 &&
  1434. + wIOBuf[1] == 0x0000 &&
  1435. + wIOBuf[2] == 0x0000 &&
  1436. + wIOBuf[3] == 0xFF01 &&
  1437. + wIOBuf[4] == 0x0079 ) {
  1438. + pterm->pdataResult->pbDataBuff[7] = 1; // limit range to one adress
  1439. + }
  1440. + }
  1441. }
  1442. }
  1443.  
  1444. @@ -107,7 +146,7 @@
  1445. pterm->pdataResult->dwDataLen = (ULONG)
  1446. (FIELD_OFFSET(PACKAGEOBJ, adata) +
  1447. sizeof(OBJDATA)*
  1448. - pterm->pdataArgs[0].uipDataValue);
  1449. + pterm->pdataArgs[0].dwDataValue);
  1450.  
  1451. if ((ppkgobj = (PPACKAGEOBJ)NEWPKOBJ(gpheapGlobal,
  1452. pterm->pdataResult->dwDataLen)) ==
  1453. @@ -124,7 +163,7 @@
  1454. pterm->pdataResult->dwDataType = OBJTYPE_PKGDATA;
  1455. MEMZERO(ppkgobj, pterm->pdataResult->dwDataLen);
  1456. pterm->pdataResult->pbDataBuff = (PUCHAR)ppkgobj;
  1457. - ppkgobj->dwcElements = (UCHAR)pterm->pdataArgs[0].uipDataValue;
  1458. + ppkgobj->dwcElements = (UCHAR)pterm->pdataArgs[0].dwDataValue;
  1459.  
  1460. if ((rc = PushFrame(pctxt, SIG_PACKAGE, sizeof(PACKAGE),
  1461. ParsePackage, &ppkg)) == STATUS_SUCCESS)
  1462. @@ -319,7 +358,7 @@
  1463. DATAF_GLOBAL_LOCK)?
  1464. ACQF_SET_RESULT | ACQF_NEED_GLOBALLOCK:
  1465. ACQF_SET_RESULT;
  1466. - pacq->wTimeout = (USHORT)pterm->pdataArgs[1].uipDataValue;
  1467. + pacq->wTimeout = (USHORT)pterm->pdataArgs[1].dwDataValue;
  1468. pacq->pdataResult = pterm->pdataResult;
  1469. }
  1470. }
  1471. @@ -392,9 +431,9 @@
  1472. else if (pterm->pdataArgs[0].dwDataType == OBJTYPE_INTDATA)
  1473. {
  1474. MEMCPY(pterm->pdataResult->pbDataBuff,
  1475. - &pterm->pdataArgs[0].uipDataValue, sizeof(ULONG));
  1476. + &pterm->pdataArgs[0].dwDataValue, sizeof(ULONG));
  1477. MEMCPY(pterm->pdataResult->pbDataBuff + sizeof(ULONG),
  1478. - &pterm->pdataArgs[1].uipDataValue, sizeof(ULONG));
  1479. + &pterm->pdataArgs[1].dwDataValue, sizeof(ULONG));
  1480. }
  1481. else if (pterm->pdataArgs[0].dwDataType == OBJTYPE_STRDATA)
  1482. {
  1483. @@ -463,7 +502,7 @@
  1484.  
  1485. EXIT(2, ("DerefOf=%x (type=%s,value=%x,len=%d,buff=%x)\n",
  1486. rc, GetObjectTypeName(pterm->pdataResult->dwDataType),
  1487. - pterm->pdataResult->uipDataValue, pterm->pdataResult->dwDataLen,
  1488. + pterm->pdataResult->dwDataValue, pterm->pdataResult->dwDataLen,
  1489. pterm->pdataResult->pbDataBuff));
  1490. return rc;
  1491. } //DerefOf
  1492. @@ -501,10 +540,10 @@
  1493. {
  1494. case OP_FINDSETLBIT:
  1495. ENTER(2, ("FindSetLeftBit(Value=%x)\n",
  1496. - pterm->pdataArgs[0].uipDataValue));
  1497. + pterm->pdataArgs[0].dwDataValue));
  1498. for (i = 31; i >= 0; --i)
  1499. {
  1500. - if (pterm->pdataArgs[0].uipDataValue & (1 << i))
  1501. + if (pterm->pdataArgs[0].dwDataValue & (1 << i))
  1502. {
  1503. dwResult = i + 1;
  1504. break;
  1505. @@ -515,10 +554,10 @@
  1506.  
  1507. case OP_FINDSETRBIT:
  1508. ENTER(2, ("FindSetRightBit(Value=%x)\n",
  1509. - pterm->pdataArgs[0].uipDataValue));
  1510. + pterm->pdataArgs[0].dwDataValue));
  1511. for (i = 0; i <= 31; ++i)
  1512. {
  1513. - if (pterm->pdataArgs[0].uipDataValue & (1 << i))
  1514. + if (pterm->pdataArgs[0].dwDataValue & (1 << i))
  1515. {
  1516. dwResult = i + 1;
  1517. break;
  1518. @@ -529,8 +568,8 @@
  1519.  
  1520. case OP_FROMBCD:
  1521. ENTER(2, ("FromBCD(Value=%x)\n",
  1522. - pterm->pdataArgs[0].uipDataValue));
  1523. - for (dwData1 = (ULONG)pterm->pdataArgs[0].uipDataValue,
  1524. + pterm->pdataArgs[0].dwDataValue));
  1525. + for (dwData1 = (ULONG)pterm->pdataArgs[0].dwDataValue,
  1526. dwData2 = 1;
  1527. dwData1 != 0;
  1528. dwData2 *= 10, dwData1 >>= 4)
  1529. @@ -542,8 +581,8 @@
  1530.  
  1531. case OP_TOBCD:
  1532. ENTER(2, ("ToBCD(Value=%x)\n",
  1533. - pterm->pdataArgs[0].uipDataValue));
  1534. - for (i = 0, dwData1 = (ULONG)pterm->pdataArgs[0].uipDataValue;
  1535. + pterm->pdataArgs[0].dwDataValue));
  1536. + for (i = 0, dwData1 = (ULONG)pterm->pdataArgs[0].dwDataValue;
  1537. dwData1 != 0;
  1538. ++i, dwData1 /= 10)
  1539. {
  1540. @@ -554,13 +593,13 @@
  1541.  
  1542. case OP_NOT:
  1543. ENTER(2, ("Not(Value=%x)\n",
  1544. - pterm->pdataArgs[0].uipDataValue));
  1545. - dwResult = ~(ULONG)pterm->pdataArgs[0].uipDataValue;
  1546. + pterm->pdataArgs[0].dwDataValue));
  1547. + dwResult = ~(ULONG)pterm->pdataArgs[0].dwDataValue;
  1548. EXIT(2, ("Not=%x (Result=%x)\n", rc, dwResult));
  1549. }
  1550.  
  1551. pterm->pdataResult->dwDataType = OBJTYPE_INTDATA;
  1552. - pterm->pdataResult->uipDataValue = (ULONG_PTR)dwResult;
  1553. + pterm->pdataResult->dwDataValue = (ULONG)dwResult;
  1554. rc = WriteObject(pctxt, pdata, pterm->pdataResult);
  1555. }
  1556.  
  1557. @@ -598,118 +637,129 @@
  1558. {
  1559. case OP_ADD:
  1560. ENTER(2, ("Add(Value1=%x,Value2=%x)\n",
  1561. - pterm->pdataArgs[0].uipDataValue,
  1562. - pterm->pdataArgs[1].uipDataValue));
  1563. - pterm->pdataResult->uipDataValue =
  1564. - pterm->pdataArgs[0].uipDataValue +
  1565. - pterm->pdataArgs[1].uipDataValue;
  1566. + pterm->pdataArgs[0].dwDataValue,
  1567. + pterm->pdataArgs[1].dwDataValue));
  1568. + pterm->pdataResult->dwDataValue =
  1569. + pterm->pdataArgs[0].dwDataValue +
  1570. + pterm->pdataArgs[1].dwDataValue;
  1571. EXIT(2, ("Add=%x (Result=%x)\n",
  1572. - rc, pterm->pdataResult->uipDataValue));
  1573. + rc, pterm->pdataResult->dwDataValue));
  1574. break;
  1575.  
  1576. case OP_AND:
  1577. ENTER(2, ("And(Value1=%x,Value2=%x)\n",
  1578. - pterm->pdataArgs[0].uipDataValue,
  1579. - pterm->pdataArgs[1].uipDataValue));
  1580. - pterm->pdataResult->uipDataValue =
  1581. - pterm->pdataArgs[0].uipDataValue &
  1582. - pterm->pdataArgs[1].uipDataValue;
  1583. + pterm->pdataArgs[0].dwDataValue,
  1584. + pterm->pdataArgs[1].dwDataValue));
  1585. + pterm->pdataResult->dwDataValue =
  1586. + pterm->pdataArgs[0].dwDataValue &
  1587. + pterm->pdataArgs[1].dwDataValue;
  1588. EXIT(2, ("And=%x (Result=%x)\n",
  1589. - rc, pterm->pdataResult->uipDataValue));
  1590. + rc, pterm->pdataResult->dwDataValue));
  1591. break;
  1592.  
  1593. case OP_MULTIPLY:
  1594. ENTER(2, ("Multiply(Value1=%x,Value2=%x)\n",
  1595. - pterm->pdataArgs[0].uipDataValue,
  1596. - pterm->pdataArgs[1].uipDataValue));
  1597. - pterm->pdataResult->uipDataValue =
  1598. - pterm->pdataArgs[0].uipDataValue *
  1599. - pterm->pdataArgs[1].uipDataValue;
  1600. + pterm->pdataArgs[0].dwDataValue,
  1601. + pterm->pdataArgs[1].dwDataValue));
  1602. + pterm->pdataResult->dwDataValue =
  1603. + pterm->pdataArgs[0].dwDataValue *
  1604. + pterm->pdataArgs[1].dwDataValue;
  1605. EXIT(2, ("Multiply=%x (Result=%x)\n",
  1606. - rc, pterm->pdataResult->uipDataValue));
  1607. + rc, pterm->pdataResult->dwDataValue));
  1608. break;
  1609.  
  1610. case OP_NAND:
  1611. ENTER(2, ("NAnd(Value1=%x,Value2=%x)\n",
  1612. - pterm->pdataArgs[0].uipDataValue,
  1613. - pterm->pdataArgs[1].uipDataValue));
  1614. - pterm->pdataResult->uipDataValue =
  1615. - ~(pterm->pdataArgs[0].uipDataValue &
  1616. - pterm->pdataArgs[1].uipDataValue);
  1617. + pterm->pdataArgs[0].dwDataValue,
  1618. + pterm->pdataArgs[1].dwDataValue));
  1619. + pterm->pdataResult->dwDataValue =
  1620. + ~(pterm->pdataArgs[0].dwDataValue &
  1621. + pterm->pdataArgs[1].dwDataValue);
  1622. EXIT(2, ("NAnd=%x (Result=%x)\n",
  1623. - rc, pterm->pdataResult->uipDataValue));
  1624. + rc, pterm->pdataResult->dwDataValue));
  1625. break;
  1626.  
  1627. case OP_NOR:
  1628. ENTER(2, ("NOr(Value1=%x,Value2=%x)\n",
  1629. - pterm->pdataArgs[0].uipDataValue,
  1630. - pterm->pdataArgs[1].uipDataValue));
  1631. - pterm->pdataResult->uipDataValue =
  1632. - ~(pterm->pdataArgs[0].uipDataValue |
  1633. - pterm->pdataArgs[1].uipDataValue);
  1634. + pterm->pdataArgs[0].dwDataValue,
  1635. + pterm->pdataArgs[1].dwDataValue));
  1636. + pterm->pdataResult->dwDataValue =
  1637. + ~(pterm->pdataArgs[0].dwDataValue |
  1638. + pterm->pdataArgs[1].dwDataValue);
  1639. EXIT(2, ("NOr=%x (Result=%x)\n",
  1640. - rc, pterm->pdataResult->uipDataValue));
  1641. + rc, pterm->pdataResult->dwDataValue));
  1642. break;
  1643.  
  1644. case OP_OR:
  1645. ENTER(2, ("Or(Value1=%x,Value2=%x)\n",
  1646. - pterm->pdataArgs[0].uipDataValue,
  1647. - pterm->pdataArgs[1].uipDataValue));
  1648. - pterm->pdataResult->uipDataValue =
  1649. - pterm->pdataArgs[0].uipDataValue |
  1650. - pterm->pdataArgs[1].uipDataValue;
  1651. + pterm->pdataArgs[0].dwDataValue,
  1652. + pterm->pdataArgs[1].dwDataValue));
  1653. + pterm->pdataResult->dwDataValue =
  1654. + pterm->pdataArgs[0].dwDataValue |
  1655. + pterm->pdataArgs[1].dwDataValue;
  1656. EXIT(2, ("Or=%x (Result=%x)\n",
  1657. - rc, pterm->pdataResult->uipDataValue));
  1658. + rc, pterm->pdataResult->dwDataValue));
  1659. break;
  1660.  
  1661. case OP_SHIFTL:
  1662. ENTER(2, ("ShiftLeft(Value1=%x,Value2=%x)\n",
  1663. - pterm->pdataArgs[0].uipDataValue,
  1664. - pterm->pdataArgs[1].uipDataValue));
  1665. - pterm->pdataResult->uipDataValue =
  1666. - SHIFTLEFT(pterm->pdataArgs[0].uipDataValue,
  1667. - pterm->pdataArgs[1].uipDataValue);
  1668. + pterm->pdataArgs[0].dwDataValue,
  1669. + pterm->pdataArgs[1].dwDataValue));
  1670. + pterm->pdataResult->dwDataValue =
  1671. + SHIFTLEFT(pterm->pdataArgs[0].dwDataValue,
  1672. + pterm->pdataArgs[1].dwDataValue);
  1673. EXIT(2, ("ShiftLeft=%x (Result=%x)\n",
  1674. - rc, pterm->pdataResult->uipDataValue));
  1675. + rc, pterm->pdataResult->dwDataValue));
  1676. break;
  1677.  
  1678. case OP_SHIFTR:
  1679. ENTER(2, ("ShiftRight(Value1=%x,Value2=%x)\n",
  1680. - pterm->pdataArgs[0].uipDataValue,
  1681. - pterm->pdataArgs[1].uipDataValue));
  1682. - pterm->pdataResult->uipDataValue =
  1683. - SHIFTRIGHT(pterm->pdataArgs[0].uipDataValue,
  1684. - pterm->pdataArgs[1].uipDataValue);
  1685. + pterm->pdataArgs[0].dwDataValue,
  1686. + pterm->pdataArgs[1].dwDataValue));
  1687. + pterm->pdataResult->dwDataValue =
  1688. + SHIFTRIGHT(pterm->pdataArgs[0].dwDataValue,
  1689. + pterm->pdataArgs[1].dwDataValue);
  1690. EXIT(2, ("ShiftRight=%x (Result=%x)\n",
  1691. - rc, pterm->pdataResult->uipDataValue));
  1692. + rc, pterm->pdataResult->dwDataValue));
  1693. break;
  1694.  
  1695. case OP_SUBTRACT:
  1696. ENTER(2, ("Subtract(Value1=%x,Value2=%x)\n",
  1697. - pterm->pdataArgs[0].uipDataValue,
  1698. - pterm->pdataArgs[1].uipDataValue));
  1699. - pterm->pdataResult->uipDataValue =
  1700. - pterm->pdataArgs[0].uipDataValue -
  1701. - pterm->pdataArgs[1].uipDataValue;
  1702. + pterm->pdataArgs[0].dwDataValue,
  1703. + pterm->pdataArgs[1].dwDataValue));
  1704. + pterm->pdataResult->dwDataValue =
  1705. + pterm->pdataArgs[0].dwDataValue -
  1706. + pterm->pdataArgs[1].dwDataValue;
  1707. EXIT(2, ("Subtract=%x (Result=%x)\n",
  1708. - rc, pterm->pdataResult->uipDataValue));
  1709. + rc, pterm->pdataResult->dwDataValue));
  1710. break;
  1711.  
  1712. case OP_XOR:
  1713. ENTER(2, ("XOr(Value1=%x,Value2=%x)\n",
  1714. - pterm->pdataArgs[0].uipDataValue,
  1715. - pterm->pdataArgs[1].uipDataValue));
  1716. - pterm->pdataResult->uipDataValue =
  1717. - pterm->pdataArgs[0].uipDataValue ^
  1718. - pterm->pdataArgs[1].uipDataValue;
  1719. + pterm->pdataArgs[0].dwDataValue,
  1720. + pterm->pdataArgs[1].dwDataValue));
  1721. + pterm->pdataResult->dwDataValue =
  1722. + pterm->pdataArgs[0].dwDataValue ^
  1723. + pterm->pdataArgs[1].dwDataValue;
  1724. EXIT(2, ("XOr=%x (Result=%x)\n",
  1725. - rc, pterm->pdataResult->uipDataValue));
  1726. + rc, pterm->pdataResult->dwDataValue));
  1727. + break;
  1728. +
  1729. + case OP_MOD:
  1730. + ENTER(2, ("Mod(Value1=%x,Value2=%x)\n",
  1731. + pterm->pdataArgs[0].dwDataValue,
  1732. + pterm->pdataArgs[1].dwDataValue));
  1733. + pterm->pdataResult->dwDataValue =
  1734. + pterm->pdataArgs[0].dwDataValue %
  1735. + pterm->pdataArgs[1].dwDataValue;
  1736. + EXIT(2, ("Mod=%x (Result=%x)\n",
  1737. + rc, pterm->pdataResult->dwDataValue));
  1738. }
  1739.  
  1740. rc = WriteObject(pctxt, pdata, pterm->pdataResult);
  1741. }
  1742.  
  1743. - EXIT(2, ("ExprOp2=%x (value=%x)\n", rc, pterm->pdataResult->uipDataValue));
  1744. + EXIT(2, ("ExprOp2=%x (value=%x)\n", rc, pterm->pdataResult->dwDataValue));
  1745. return rc;
  1746. } //ExprOp2
  1747.  
  1748. @@ -741,17 +791,17 @@
  1749. == STATUS_SUCCESS))
  1750. {
  1751. ENTER(2, ("Divide(Value1=%x,Value2=%x)\n",
  1752. - pterm->pdataArgs[0].uipDataValue,
  1753. - pterm->pdataArgs[1].uipDataValue));
  1754. + pterm->pdataArgs[0].dwDataValue,
  1755. + pterm->pdataArgs[1].dwDataValue));
  1756. //
  1757. // Check for divide by zero case.
  1758. //
  1759. - if(pterm->pdataArgs[1].uipDataValue != 0)
  1760. + if(pterm->pdataArgs[1].dwDataValue != 0)
  1761. {
  1762. - dwDividend = (ULONG)(pterm->pdataArgs[0].uipDataValue /
  1763. - pterm->pdataArgs[1].uipDataValue);
  1764. - dwRemainder = (ULONG)(pterm->pdataArgs[0].uipDataValue %
  1765. - pterm->pdataArgs[1].uipDataValue);
  1766. + dwDividend = (ULONG)(pterm->pdataArgs[0].dwDataValue /
  1767. + pterm->pdataArgs[1].dwDataValue);
  1768. + dwRemainder = (ULONG)(pterm->pdataArgs[0].dwDataValue %
  1769. + pterm->pdataArgs[1].dwDataValue);
  1770. }
  1771. else
  1772. {
  1773. @@ -764,7 +814,7 @@
  1774. rc, dwDividend, dwRemainder));
  1775.  
  1776. pterm->pdataResult->dwDataType = OBJTYPE_INTDATA;
  1777. - pterm->pdataResult->uipDataValue = (ULONG_PTR)dwDividend;
  1778. + pterm->pdataResult->dwDataValue = (ULONG)dwDividend;
  1779.  
  1780. if ((rc = PushPost(pctxt, ProcessDivide, (ULONG_PTR)pdata2, 0,
  1781. pterm->pdataResult)) == STATUS_SUCCESS)
  1782. @@ -826,7 +876,7 @@
  1783. }
  1784.  
  1785. EXIT(2, ("ProcessDivide=%x (value=%x)\n",
  1786. - rc, ppost->pdataResult->uipDataValue));
  1787. + rc, ppost->pdataResult->dwDataValue));
  1788. return rc;
  1789. } //ProcessDivide
  1790.  
  1791. @@ -904,18 +954,18 @@
  1792. else if (ppost->uipData1 == OP_INCREMENT)
  1793. {
  1794. ENTER(2, ("Increment(Value=%x)\n",
  1795. - ppost->pdataResult->uipDataValue));
  1796. - ppost->pdataResult->uipDataValue++;
  1797. + ppost->pdataResult->dwDataValue));
  1798. + ppost->pdataResult->dwDataValue++;
  1799. EXIT(2, ("Increment=%x (Value=%x)\n",
  1800. - rc, ppost->pdataResult->uipDataValue));
  1801. + rc, ppost->pdataResult->dwDataValue));
  1802. }
  1803. else
  1804. {
  1805. ENTER(2, ("Decrement(Value=%x)\n",
  1806. - ppost->pdataResult->uipDataValue));
  1807. - ppost->pdataResult->uipDataValue--;
  1808. + ppost->pdataResult->dwDataValue));
  1809. + ppost->pdataResult->dwDataValue--;
  1810. EXIT(2, ("Decrement=%x (Value=%x)\n",
  1811. - rc, ppost->pdataResult->uipDataValue));
  1812. + rc, ppost->pdataResult->dwDataValue));
  1813. }
  1814.  
  1815. if (rc == STATUS_SUCCESS)
  1816. @@ -938,7 +988,7 @@
  1817. }
  1818.  
  1819. EXIT(2, ("ProcessIncDec=%x (value=%x)\n",
  1820. - rc, ppost->pdataResult->uipDataValue));
  1821. + rc, ppost->pdataResult->dwDataValue));
  1822. return rc;
  1823. } //ProcessIncDec
  1824.  
  1825. @@ -970,24 +1020,24 @@
  1826. {
  1827. PPACKAGEOBJ ppkg = (PPACKAGEOBJ)pterm->pdataArgs[0].pbDataBuff;
  1828.  
  1829. - if ((ULONG)pterm->pdataArgs[1].uipDataValue < ppkg->dwcElements)
  1830. + if ((ULONG)pterm->pdataArgs[1].dwDataValue < ppkg->dwcElements)
  1831. {
  1832. pterm->pdataResult->dwDataType = OBJTYPE_DATAALIAS;
  1833. pterm->pdataResult->pdataAlias =
  1834. - &ppkg->adata[pterm->pdataArgs[1].uipDataValue];
  1835. + &ppkg->adata[pterm->pdataArgs[1].dwDataValue];
  1836. }
  1837. else
  1838. {
  1839. rc = AMLI_LOGERR(AMLIERR_INDEX_TOO_BIG,
  1840. ("Index: index out-of-bound (index=%d,max=%d)",
  1841. - pterm->pdataArgs[1].uipDataValue,
  1842. + pterm->pdataArgs[1].dwDataValue,
  1843. ppkg->dwcElements));
  1844. }
  1845. }
  1846. else
  1847. {
  1848. ASSERT(pterm->pdataArgs[0].dwDataType == OBJTYPE_BUFFDATA);
  1849. - if ((ULONG)pterm->pdataArgs[1].uipDataValue <
  1850. + if ((ULONG)pterm->pdataArgs[1].dwDataValue <
  1851. pterm->pdataArgs[0].dwDataLen)
  1852. {
  1853. pterm->pdataResult->dwDataType = OBJTYPE_BUFFFIELD;
  1854. @@ -1004,7 +1054,7 @@
  1855. PBUFFFIELDOBJ pbf = (PBUFFFIELDOBJ)pterm->pdataResult->pbDataBuff;
  1856.  
  1857. pbf->FieldDesc.dwByteOffset =
  1858. - (ULONG)pterm->pdataArgs[1].uipDataValue;
  1859. + (ULONG)pterm->pdataArgs[1].dwDataValue;
  1860. pbf->FieldDesc.dwStartBitPos = 0;
  1861. pbf->FieldDesc.dwNumBits = 8;
  1862. pbf->pbDataBuff = pterm->pdataArgs[0].pbDataBuff;
  1863. @@ -1015,7 +1065,7 @@
  1864. {
  1865. rc = AMLI_LOGERR(AMLIERR_INDEX_TOO_BIG,
  1866. ("Index: index out-of-bound (index=%d,max=%d)",
  1867. - pterm->pdataArgs[1].uipDataValue,
  1868. + pterm->pdataArgs[1].dwDataValue,
  1869. pterm->pdataArgs[0].dwDataLen));
  1870. }
  1871. }
  1872. @@ -1028,7 +1078,7 @@
  1873.  
  1874. EXIT(2, ("Index=%x (Type=%s,Value=%x,Len=%x,Buff=%x)\n",
  1875. rc, GetObjectTypeName(pterm->pdataResult->dwDataType),
  1876. - pterm->pdataResult->uipDataValue, pterm->pdataResult->dwDataLen,
  1877. + pterm->pdataResult->dwDataValue, pterm->pdataResult->dwDataLen,
  1878. pterm->pdataResult->pbDataBuff));
  1879. return rc;
  1880. } //Index
  1881. @@ -1055,16 +1105,16 @@
  1882. DEREF(pctxt);
  1883. if ((rc = ValidateArgTypes(pterm->pdataArgs, "I")) == STATUS_SUCCESS)
  1884. {
  1885. - ENTER(2, ("LNot(Value=%x)\n", pterm->pdataArgs[0].uipDataValue));
  1886. + ENTER(2, ("LNot(Value=%x)\n", pterm->pdataArgs[0].dwDataValue));
  1887. pterm->pdataResult->dwDataType = OBJTYPE_INTDATA;
  1888. - if (pterm->pdataArgs[0].uipDataValue == 0)
  1889. - pterm->pdataResult->uipDataValue = DATAVALUE_ONES;
  1890. + if (pterm->pdataArgs[0].dwDataValue == 0)
  1891. + pterm->pdataResult->dwDataValue = DATAVALUE_ONES;
  1892. else
  1893. - pterm->pdataResult->uipDataValue = DATAVALUE_ZERO;
  1894. - EXIT(2, ("LNot=%x (Value=%x)\n", rc, pterm->pdataResult->uipDataValue));
  1895. + pterm->pdataResult->dwDataValue = DATAVALUE_ZERO;
  1896. + EXIT(2, ("LNot=%x (Value=%x)\n", rc, pterm->pdataResult->dwDataValue));
  1897. }
  1898.  
  1899. - EXIT(2, ("LNot=%x (value=%x)\n", rc, pterm->pdataResult->uipDataValue));
  1900. + EXIT(2, ("LNot=%x (value=%x)\n", rc, pterm->pdataResult->dwDataValue));
  1901. return rc;
  1902. } //LNot
  1903.  
  1904. @@ -1097,54 +1147,54 @@
  1905. {
  1906. case OP_LAND:
  1907. ENTER(2, ("LAnd(Value1=%x,Value2=%x)\n",
  1908. - pterm->pdataArgs[0].uipDataValue,
  1909. - pterm->pdataArgs[1].uipDataValue));
  1910. - fResult = (BOOLEAN)(pterm->pdataArgs[0].uipDataValue &&
  1911. - pterm->pdataArgs[1].uipDataValue);
  1912. + pterm->pdataArgs[0].dwDataValue,
  1913. + pterm->pdataArgs[1].dwDataValue));
  1914. + fResult = (BOOLEAN)(pterm->pdataArgs[0].dwDataValue &&
  1915. + pterm->pdataArgs[1].dwDataValue);
  1916. EXIT(2, ("LAnd=%x (Result=%x)\n", rc, fResult));
  1917. break;
  1918.  
  1919. case OP_LOR:
  1920. ENTER(2, ("LOr(Value1=%x,Value2=%x)\n",
  1921. - pterm->pdataArgs[0].uipDataValue,
  1922. - pterm->pdataArgs[1].uipDataValue));
  1923. - fResult = (BOOLEAN)(pterm->pdataArgs[0].uipDataValue ||
  1924. - pterm->pdataArgs[1].uipDataValue);
  1925. + pterm->pdataArgs[0].dwDataValue,
  1926. + pterm->pdataArgs[1].dwDataValue));
  1927. + fResult = (BOOLEAN)(pterm->pdataArgs[0].dwDataValue ||
  1928. + pterm->pdataArgs[1].dwDataValue);
  1929. EXIT(2, ("LOr=%x (Result=%x)\n", rc, fResult));
  1930. break;
  1931.  
  1932. case OP_LG:
  1933. ENTER(2, ("LGreater(Value1=%x,Value2=%x)\n",
  1934. - pterm->pdataArgs[0].uipDataValue,
  1935. - pterm->pdataArgs[1].uipDataValue));
  1936. - fResult = (BOOLEAN)(pterm->pdataArgs[0].uipDataValue >
  1937. - pterm->pdataArgs[1].uipDataValue);
  1938. + pterm->pdataArgs[0].dwDataValue,
  1939. + pterm->pdataArgs[1].dwDataValue));
  1940. + fResult = (BOOLEAN)(pterm->pdataArgs[0].dwDataValue >
  1941. + pterm->pdataArgs[1].dwDataValue);
  1942. EXIT(2, ("LGreater=%x (Result=%x)\n", rc, fResult));
  1943. break;
  1944.  
  1945. case OP_LL:
  1946. ENTER(2, ("LLess(Value1=%x,Value2=%x)\n",
  1947. - pterm->pdataArgs[0].uipDataValue,
  1948. - pterm->pdataArgs[1].uipDataValue));
  1949. - fResult = (BOOLEAN)(pterm->pdataArgs[0].uipDataValue <
  1950. - pterm->pdataArgs[1].uipDataValue);
  1951. + pterm->pdataArgs[0].dwDataValue,
  1952. + pterm->pdataArgs[1].dwDataValue));
  1953. + fResult = (BOOLEAN)(pterm->pdataArgs[0].dwDataValue <
  1954. + pterm->pdataArgs[1].dwDataValue);
  1955. EXIT(2, ("LLess=%x (Result=%x)\n", rc, fResult));
  1956. break;
  1957.  
  1958. case OP_LEQ:
  1959. ENTER(2, ("LEqual(Value1=%x,Value2=%x)\n",
  1960. - pterm->pdataArgs[0].uipDataValue,
  1961. - pterm->pdataArgs[1].uipDataValue));
  1962. - fResult = (BOOLEAN)(pterm->pdataArgs[0].uipDataValue ==
  1963. - pterm->pdataArgs[1].uipDataValue);
  1964. + pterm->pdataArgs[0].dwDataValue,
  1965. + pterm->pdataArgs[1].dwDataValue));
  1966. + fResult = (BOOLEAN)(pterm->pdataArgs[0].dwDataValue ==
  1967. + pterm->pdataArgs[1].dwDataValue);
  1968. EXIT(2, ("LEqual=%x (Result=%x)\n", rc, fResult));
  1969. }
  1970. pterm->pdataResult->dwDataType = OBJTYPE_INTDATA;
  1971. - pterm->pdataResult->uipDataValue = fResult?
  1972. + pterm->pdataResult->dwDataValue = fResult?
  1973. DATAVALUE_ONES: DATAVALUE_ZERO;
  1974. }
  1975.  
  1976. - EXIT(2, ("LogOp2=%x (value=%x)\n", rc, pterm->pdataResult->uipDataValue));
  1977. + EXIT(2, ("LogOp2=%x (value=%x)\n", rc, pterm->pdataResult->dwDataValue));
  1978. return rc;
  1979. } //LogOp2
  1980.  
  1981. @@ -1175,7 +1225,7 @@
  1982. if (pterm->pamlterm->dwOpcode == OP_OBJTYPE)
  1983. {
  1984. ENTER(2, ("ObjectType(pdataObj=%x)\n", pdata));
  1985. - pterm->pdataResult->uipDataValue = (ULONG_PTR)pdata->dwDataType;
  1986. + pterm->pdataResult->dwDataValue = (ULONG)pdata->dwDataType;
  1987. EXIT(2, ("ObjectType=%x (Type=%s)\n",
  1988. rc, GetObjectTypeName(pdata->dwDataType)));
  1989. }
  1990. @@ -1185,16 +1235,16 @@
  1991. switch (pdata->dwDataType)
  1992. {
  1993. case OBJTYPE_BUFFDATA:
  1994. - pterm->pdataResult->uipDataValue = (ULONG_PTR)pdata->dwDataLen;
  1995. + pterm->pdataResult->dwDataValue = (ULONG)pdata->dwDataLen;
  1996. break;
  1997.  
  1998. case OBJTYPE_STRDATA:
  1999. - pterm->pdataResult->uipDataValue = (ULONG_PTR)
  2000. + pterm->pdataResult->dwDataValue = (ULONG)
  2001. (pdata->dwDataLen - 1);
  2002. break;
  2003.  
  2004. case OBJTYPE_PKGDATA:
  2005. - pterm->pdataResult->uipDataValue = (ULONG_PTR)
  2006. + pterm->pdataResult->dwDataValue = (ULONG)
  2007. ((PPACKAGEOBJ)pdata->pbDataBuff)->dwcElements;
  2008. break;
  2009.  
  2010. @@ -1203,11 +1253,11 @@
  2011. ("SizeOf: expected argument type string/buffer/package (type=%s)",
  2012. GetObjectTypeName(pdata->dwDataType)));
  2013. }
  2014. - EXIT(2, ("Sizeof=%x (Size=%d)\n", rc, pterm->pdataResult->uipDataValue));
  2015. + EXIT(2, ("Sizeof=%x (Size=%d)\n", rc, pterm->pdataResult->dwDataValue));
  2016. }
  2017.  
  2018. EXIT(2, ("ObjTypeSizeOf=%x (value=%x)\n",
  2019. - rc, pterm->pdataResult->uipDataValue));
  2020. + rc, pterm->pdataResult->dwDataValue));
  2021. return rc;
  2022. } //ObjTypeSizeOf
  2023.  
  2024. @@ -1233,7 +1283,7 @@
  2025. DEREF(pctxt);
  2026. MoveObjData(pterm->pdataResult, &pterm->pdataArgs[0]);
  2027.  
  2028. - EXIT(2, ("RefOf=%x (ObjAlias=%x)\n", rc, pterm->pdataResult->uipDataValue));
  2029. + EXIT(2, ("RefOf=%x (ObjAlias=%x)\n", rc, pterm->pdataResult->dwDataValue));
  2030. return rc;
  2031. } //RefOf
  2032.  
  2033. @@ -1265,17 +1315,17 @@
  2034. if ((pterm->pdataArgs[0].dwDataType == OBJTYPE_OBJALIAS) ||
  2035. (pterm->pdataArgs[0].dwDataType == OBJTYPE_DATAALIAS))
  2036. {
  2037. - pterm->pdataResult->uipDataValue = DATAVALUE_ONES;
  2038. + pterm->pdataResult->dwDataValue = DATAVALUE_ONES;
  2039. rc = WriteObject(pctxt, pdata, &pterm->pdataArgs[0]);
  2040. }
  2041. else
  2042. {
  2043. - pterm->pdataResult->uipDataValue = DATAVALUE_ZERO;
  2044. + pterm->pdataResult->dwDataValue = DATAVALUE_ZERO;
  2045. }
  2046. }
  2047.  
  2048. EXIT(2, ("CondRefOf=%x (ObjAlias=%x)\n",
  2049. - rc, pterm->pdataResult->uipDataValue));
  2050. + rc, pterm->pdataResult->dwDataValue));
  2051. return rc;
  2052. } //CondRefOf
  2053.  
  2054. @@ -1308,7 +1358,7 @@
  2055.  
  2056. EXIT(2, ("Store=%x (type=%s,value=%x,buff=%x,len=%x)\n",
  2057. rc, GetObjectTypeName(pterm->pdataArgs[0].dwDataType),
  2058. - pterm->pdataArgs[0].uipDataValue, pterm->pdataArgs[0].pbDataBuff,
  2059. + pterm->pdataArgs[0].dwDataValue, pterm->pdataArgs[0].pbDataBuff,
  2060. pterm->pdataArgs[0].dwDataLen));
  2061. return rc;
  2062. } //Store
  2063. @@ -1347,11 +1397,11 @@
  2064. {
  2065. rc = WaitASLEvent(pctxt,
  2066. (PEVENTOBJ)pterm->pnsObj->ObjData.pbDataBuff,
  2067. - (USHORT)pterm->pdataArgs[1].uipDataValue);
  2068. + (USHORT)pterm->pdataArgs[1].dwDataValue);
  2069. }
  2070. }
  2071.  
  2072. - EXIT(2, ("Wait=%x (value=%x)\n", rc, pterm->pdataResult->uipDataValue));
  2073. + EXIT(2, ("Wait=%x (value=%x)\n", rc, pterm->pdataResult->dwDataValue));
  2074. return rc;
  2075. } //Wait
  2076.  
  2077. @@ -1379,17 +1429,17 @@
  2078. ppost->pdataResult->dwDataType = OBJTYPE_INTDATA;
  2079. if (rc == AMLISTA_TIMEOUT)
  2080. {
  2081. - ppost->pdataResult->uipDataValue = DATAVALUE_ONES;
  2082. + ppost->pdataResult->dwDataValue = DATAVALUE_ONES;
  2083. rc = STATUS_SUCCESS;
  2084. }
  2085. else
  2086. {
  2087. - ppost->pdataResult->uipDataValue = DATAVALUE_ZERO;
  2088. + ppost->pdataResult->dwDataValue = DATAVALUE_ZERO;
  2089. }
  2090. PopFrame(pctxt);
  2091.  
  2092. EXIT(2, ("ProcessWait=%x (value=%x)\n",
  2093. - rc, ppost->pdataResult->uipDataValue));
  2094. + rc, ppost->pdataResult->dwDataValue));
  2095. return rc;
  2096. } //ProcessWait
  2097.  
  2098. @@ -1420,7 +1470,7 @@
  2099. int i;
  2100.  
  2101. MEMZERO(&data, sizeof(data));
  2102. - for (i = (int)pterm->pdataArgs[5].uipDataValue;
  2103. + for (i = (int)pterm->pdataArgs[5].dwDataValue;
  2104. rc == STATUS_SUCCESS;
  2105. ++i)
  2106. {
  2107. @@ -1432,12 +1482,12 @@
  2108. if (((rc = EvalPackageElement(ppkgobj, i, &data)) ==
  2109. STATUS_SUCCESS) &&
  2110. (data.dwDataType == OBJTYPE_INTDATA) &&
  2111. - MatchData((ULONG)data.uipDataValue,
  2112. - (ULONG)pterm->pdataArgs[1].uipDataValue,
  2113. - (ULONG)pterm->pdataArgs[2].uipDataValue) &&
  2114. - MatchData((ULONG)data.uipDataValue,
  2115. - (ULONG)pterm->pdataArgs[3].uipDataValue,
  2116. - (ULONG)pterm->pdataArgs[4].uipDataValue))
  2117. + MatchData((ULONG)data.dwDataValue,
  2118. + (ULONG)pterm->pdataArgs[1].dwDataValue,
  2119. + (ULONG)pterm->pdataArgs[2].dwDataValue) &&
  2120. + MatchData((ULONG)data.dwDataValue,
  2121. + (ULONG)pterm->pdataArgs[3].dwDataValue,
  2122. + (ULONG)pterm->pdataArgs[4].dwDataValue))
  2123. {
  2124. break;
  2125. }
  2126. @@ -1446,12 +1496,12 @@
  2127. if (rc == STATUS_SUCCESS)
  2128. {
  2129. pterm->pdataResult->dwDataType = OBJTYPE_INTDATA;
  2130. - pterm->pdataResult->uipDataValue = (ULONG_PTR)i;
  2131. + pterm->pdataResult->dwDataValue = (ULONG)i;
  2132. }
  2133. else if (rc == AMLIERR_INDEX_TOO_BIG)
  2134. {
  2135. pterm->pdataResult->dwDataType = OBJTYPE_INTDATA;
  2136. - pterm->pdataResult->uipDataValue = DATAVALUE_ONES;
  2137. + pterm->pdataResult->dwDataValue = DATAVALUE_ONES;
  2138. rc = STATUS_SUCCESS;
  2139. }
  2140.  
  2141. @@ -1538,16 +1588,20 @@
  2142. TRACENAME("OSInterface")
  2143. NTSTATUS rc;
  2144. // Add future OS strings here.
  2145. - char Win2000[] = "Windows 2000";
  2146. - char Win2001[] = "Windows 2001";
  2147. - char Win2001SP1[] = "Windows 2001 SP1";
  2148. - char Win2001_1[] = "Windows 2001.1";
  2149. + char Win2000[] = "Windows 2000";
  2150. + char Win2001[] = "Windows 2001";
  2151. + char Win2001SP1[] = "Windows 2001 SP1";
  2152. + char Win2001_1[] = "Windows 2001.1";
  2153. + char Win2001SP2[] = "Windows 2001 SP2";
  2154. + char Win2001_1SP1[] = "Windows 2001.1 SP1";
  2155.  
  2156. char* SupportedOSList[] = {
  2157. Win2000,
  2158. Win2001,
  2159. Win2001SP1,
  2160. - Win2001_1
  2161. + Win2001_1,
  2162. + Win2001SP2,
  2163. + Win2001_1SP1
  2164. };
  2165. ULONG ListSize = sizeof(SupportedOSList) / sizeof(char*);
  2166. ULONG i = 0;
  2167. @@ -1560,13 +1614,13 @@
  2168. if ((rc = ValidateArgTypes((pterm->pdataArgs)->pdataAlias, "Z")) == STATUS_SUCCESS)
  2169. {
  2170. pterm->pdataResult->dwDataType = OBJTYPE_INTDATA;
  2171. - pterm->pdataResult->uipDataValue = DATAVALUE_ZERO;
  2172. + pterm->pdataResult->dwDataValue = DATAVALUE_ZERO;
  2173.  
  2174. for(i=0; i<ListSize; i++)
  2175. {
  2176. if(STRCMPI(SupportedOSList[i], (pterm->pdataArgs)->pdataAlias->pbDataBuff) == 0)
  2177. {
  2178. - pterm->pdataResult->uipDataValue = DATAVALUE_ONES;
  2179. + pterm->pdataResult->dwDataValue = DATAVALUE_ONES;
  2180. rc = STATUS_SUCCESS;
  2181.  
  2182. //
  2183. @@ -1575,8 +1629,8 @@
  2184. // 1 == Windows 2001
  2185. // 2 == Windows 2001 SP1
  2186. // 3 == Windows 2001.1
  2187. - // .
  2188. - // .
  2189. + // 4 == Windows 2001 SP2
  2190. + // 5 == Windows 2001.1 SP1
  2191. //
  2192. if(gdwHighestOSVerQueried < i)
  2193. {
  2194. @@ -1594,3 +1648,842 @@
  2195. } //OSInterface
  2196.  
  2197.  
  2198. +
  2199. +///////////////////////////////////////////////
  2200. +// ACPI 2.0
  2201. +
  2202. +NTSTATUS LOCAL ConvertToInteger(POBJDATA In, POBJDATA Out) {
  2203. + ULONG dwDataLen;
  2204. + OBJDATA data;
  2205. +
  2206. + MEMZERO(&data, sizeof(data));
  2207. + data.dwDataType = OBJTYPE_INTDATA;
  2208. + switch (In->dwDataType) {
  2209. + case OBJTYPE_INTDATA:
  2210. + data.dwDataValue = In->dwDataValue;
  2211. +
  2212. + FreeDataBuffs(Out, 1);
  2213. + MEMCPY(Out, &data, sizeof(data));
  2214. + return STATUS_SUCCESS;
  2215. + break;
  2216. + case OBJTYPE_STRDATA:
  2217. + data.dwDataValue = StrToUL((PSZ)In->pbDataBuff, NULL, 0);
  2218. +
  2219. + FreeDataBuffs(Out, 1);
  2220. + MEMCPY(Out, &data, sizeof(data));
  2221. + return STATUS_SUCCESS;
  2222. + break;
  2223. + case OBJTYPE_BUFFDATA:
  2224. + dwDataLen = In->dwDataLen;
  2225. + if (dwDataLen > 4) // 8 - int64
  2226. + dwDataLen = 4;
  2227. + MEMCPY(&data.dwDataValue, In->pbDataBuff, dwDataLen);
  2228. +
  2229. + FreeDataBuffs(Out, 1);
  2230. + MEMCPY(Out, &data, sizeof(data));
  2231. + return STATUS_SUCCESS;
  2232. + break;
  2233. + default:
  2234. + return AMLIERR_UNEXPECTED_OBJTYPE;
  2235. + break;
  2236. + }
  2237. +}
  2238. +
  2239. +
  2240. +NTSTATUS LOCAL ToInteger(PCTXT pctxt, PTERM pterm)
  2241. +{
  2242. + NTSTATUS rc = STATUS_SUCCESS;
  2243. + POBJDATA pdata;
  2244. + TRACENAME("TOINTEGER")
  2245. + ENTER(2, ("ToInteger(pctxt=%x,pbOp=%x,pterm=%x)\n", pctxt, pctxt->pbOp, pterm));
  2246. +
  2247. + if (((rc = ValidateArgTypes(pterm->pdataArgs, "D")) == STATUS_SUCCESS) &&
  2248. + ((rc = ValidateTarget(&pterm->pdataArgs[1], OBJTYPE_DATAOBJ, &pdata)) == STATUS_SUCCESS)) {
  2249. + if ((rc = ConvertToInteger(pterm->pdataArgs, pterm->pdataResult)) == STATUS_SUCCESS)
  2250. + rc = WriteObject(pctxt, pdata, pterm->pdataResult);
  2251. + }
  2252. +
  2253. + EXIT(2, ("ToInteger=%x (Result=%x)\n", rc, pterm->pdataResult));
  2254. + return rc;
  2255. +}
  2256. +
  2257. +
  2258. +char HTOALookupTable[]="0123456789ABCDEF";
  2259. +
  2260. +
  2261. +NTSTATUS LOCAL ToHexString(PCTXT pctxt, PTERM pterm)
  2262. +{
  2263. + NTSTATUS rc = STATUS_SUCCESS;
  2264. + POBJDATA pdata;
  2265. + int StrLen;
  2266. + POBJDATA In = pterm->pdataArgs;
  2267. + POBJDATA Out = pterm->pdataResult;
  2268. + ULONG int32;
  2269. + ULONG SrcIdx;
  2270. + int i;
  2271. + UCHAR pair;
  2272. + TRACENAME("TOHEXSTRING")
  2273. + ENTER(2, ("ToHexString(pctxt=%x,pbOp=%x,pterm=%x)\n", pctxt, pctxt->pbOp, pterm));
  2274. +
  2275. + if (((rc = ValidateArgTypes(pterm->pdataArgs, "D")) == STATUS_SUCCESS) &&
  2276. + ((rc = ValidateTarget(&pterm->pdataArgs[1], OBJTYPE_DATAOBJ, &pdata)) == STATUS_SUCCESS)) {
  2277. + StrLen = 2;
  2278. + Out->dwDataType = OBJTYPE_STRDATA;
  2279. + switch (In->dwDataType) {
  2280. + case OBJTYPE_INTDATA:
  2281. + int32 = In->dwDataValue;
  2282. + do {
  2283. + int32 >>= 4;
  2284. + ++StrLen;
  2285. + } while (int32);
  2286. +
  2287. + Out->dwDataLen = StrLen + 1;
  2288. + Out->pbDataBuff = (PUCHAR) NEWSDOBJ(gpheapGlobal, Out->dwDataLen);
  2289. +
  2290. + if (Out->pbDataBuff == NULL) {
  2291. + rc = AMLI_LOGERR(AMLIERR_OUT_OF_MEM,
  2292. + ("ToHexString: failed to allocate target buffer"));
  2293. + } else {
  2294. + Out->pbDataBuff[0] = '0';
  2295. + Out->pbDataBuff[1] = 'x';
  2296. + int32 = In->dwDataValue;
  2297. + for (i = StrLen - 1; i >= 2; --i) {
  2298. + Out->pbDataBuff[i] = HTOALookupTable[int32 & 0xF];
  2299. + int32 >>= 4;
  2300. + }
  2301. +
  2302. + Out->pbDataBuff[Out->dwDataLen - 1] = '\0'; // ending zero
  2303. + rc = WriteObject(pctxt, pdata, pterm->pdataResult);
  2304. + }
  2305. + break;
  2306. + case OBJTYPE_STRDATA:
  2307. + Out->dwDataLen = In->dwDataLen;
  2308. + Out->pbDataBuff = (PUCHAR) NEWSDOBJ(gpheapGlobal, Out->dwDataLen);
  2309. +
  2310. + if (Out->pbDataBuff == NULL) {
  2311. + rc = AMLI_LOGERR(AMLIERR_OUT_OF_MEM,
  2312. + ("ToHexString: failed to allocate target buffer"));
  2313. + } else {
  2314. + MEMCPY(Out->pbDataBuff, In->pbDataBuff, Out->dwDataLen);
  2315. + rc = WriteObject(pctxt, pdata, pterm->pdataResult);
  2316. + }
  2317. + break;
  2318. + case OBJTYPE_BUFFDATA:
  2319. + Out->dwDataLen = 5 * In->dwDataLen;
  2320. + Out->pbDataBuff = (PUCHAR) NEWSDOBJ(gpheapGlobal, Out->dwDataLen);
  2321. +
  2322. + if (Out->pbDataBuff == NULL) {
  2323. + rc = AMLI_LOGERR(AMLIERR_OUT_OF_MEM,
  2324. + ("ToHexString: failed to allocate target buffer"));
  2325. + } else {
  2326. + i = 0;
  2327. + if (In->dwDataLen) {
  2328. + for (SrcIdx = 0; SrcIdx < In->dwDataLen; SrcIdx++) {
  2329. + Out->pbDataBuff[i] = '0';
  2330. + Out->pbDataBuff[i+1] = 'x';
  2331. + pair = In->pbDataBuff[SrcIdx];
  2332. + Out->pbDataBuff[i+2] = HTOALookupTable[pair >> 4];
  2333. + Out->pbDataBuff[i+3] = HTOALookupTable[pair & 0xF];
  2334. + Out->pbDataBuff[i+4] = ',';
  2335. + i += 5;
  2336. + }
  2337. + }
  2338. +
  2339. + Out->pbDataBuff[Out->dwDataLen - 1] = '\0'; // ending zero
  2340. + rc = WriteObject(pctxt, pdata, pterm->pdataResult);
  2341. + }
  2342. + break;
  2343. + default:
  2344. + rc = AMLI_LOGERR(AMLIERR_FATAL,
  2345. + ("ToHexString: invalid arg0 type"));
  2346. + break;
  2347. + }
  2348. + }
  2349. +
  2350. + EXIT(2, ("ToHexString=%x (Result=%x)\n", rc, pterm->pdataResult));
  2351. + return rc;
  2352. +}
  2353. +
  2354. +
  2355. +NTSTATUS LOCAL ConvertToBuffer(POBJDATA In, POBJDATA Out) {
  2356. + OBJDATA data;
  2357. + int Len;
  2358. + int i;
  2359. + ULONG int32;
  2360. + NTSTATUS rc = STATUS_SUCCESS;
  2361. +
  2362. + MEMZERO(&data, sizeof(data));
  2363. + data.dwDataType = OBJTYPE_BUFFDATA;
  2364. + switch (In->dwDataType) {
  2365. + case OBJTYPE_INTDATA:
  2366. + int32 = In->dwDataValue;
  2367. + Len = 4;
  2368. +
  2369. + data.dwDataLen = Len;
  2370. + data.pbDataBuff = (PUCHAR) NEWSDOBJ(gpheapGlobal, Len);
  2371. + if (data.pbDataBuff == NULL) {
  2372. + rc = AMLIERR_OUT_OF_MEM;
  2373. + } else {
  2374. + for (i = 0; i < Len; i++) {
  2375. + data.pbDataBuff[i] = (UCHAR) int32;
  2376. + int32 >>= 8;
  2377. + }
  2378. +
  2379. + FreeDataBuffs(Out, 1);
  2380. + MEMCPY(Out, &data, sizeof(data));
  2381. + }
  2382. + break;
  2383. + case OBJTYPE_STRDATA:
  2384. + case OBJTYPE_BUFFDATA:
  2385. + Len = In->dwDataLen;
  2386. + data.dwDataLen = Len;
  2387. +
  2388. + data.pbDataBuff = (PUCHAR) NEWSDOBJ(gpheapGlobal, Len);
  2389. + if (data.pbDataBuff == NULL) {
  2390. + rc = AMLIERR_OUT_OF_MEM;
  2391. + } else {
  2392. + MEMCPY(data.pbDataBuff, In->pbDataBuff, Len);
  2393. +
  2394. + FreeDataBuffs(Out, 1);
  2395. + MEMCPY(Out, &data, sizeof(data));
  2396. + }
  2397. + break;
  2398. + default:
  2399. + rc = AMLIERR_UNEXPECTED_OBJTYPE;
  2400. + break;
  2401. + }
  2402. +
  2403. + return rc;
  2404. +}
  2405. +
  2406. +
  2407. +NTSTATUS LOCAL ToBuffer(PCTXT pctxt, PTERM pterm)
  2408. +{
  2409. + NTSTATUS rc = STATUS_SUCCESS;
  2410. + POBJDATA pdata;
  2411. + TRACENAME("TOBUFFER")
  2412. + ENTER(2, ("ToBuffer(pctxt=%x,pbOp=%x,pterm=%x)\n", pctxt, pctxt->pbOp, pterm));
  2413. +
  2414. + if (((rc = ValidateArgTypes(pterm->pdataArgs, "D")) == STATUS_SUCCESS) &&
  2415. + ((rc = ValidateTarget(&pterm->pdataArgs[1], OBJTYPE_DATAOBJ, &pdata)) == STATUS_SUCCESS)) {
  2416. + if ((rc = ConvertToBuffer(pterm->pdataArgs, pterm->pdataResult)) == STATUS_SUCCESS)
  2417. + rc = WriteObject(pctxt, pdata, pterm->pdataResult);
  2418. + }
  2419. +
  2420. + EXIT(2, ("ToBuffer=%x (Result=%x)\n", rc, pterm->pdataResult));
  2421. + return rc;
  2422. +}
  2423. +
  2424. +
  2425. +NTSTATUS LOCAL ToDecimalString(PCTXT pctxt, PTERM pterm)
  2426. +{
  2427. + NTSTATUS rc = STATUS_SUCCESS;
  2428. + POBJDATA pdata;
  2429. + POBJDATA In = pterm->pdataArgs;
  2430. + POBJDATA Out = pterm->pdataResult;
  2431. + ULONG int32;
  2432. + ULONG StrLen;
  2433. + int SrcBufLen;
  2434. + ULONG SrcIdx;
  2435. + int i;
  2436. + int j;
  2437. + UCHAR number;
  2438. + TRACENAME("TODECSTRING")
  2439. + ENTER(2, ("ToDecimalString(pctxt=%x,pbOp=%x,pterm=%x)\n", pctxt, pctxt->pbOp, pterm));
  2440. +
  2441. + if (((rc = ValidateArgTypes(pterm->pdataArgs, "D")) == STATUS_SUCCESS) &&
  2442. + ((rc = ValidateTarget(&pterm->pdataArgs[1], OBJTYPE_DATAOBJ, &pdata)) == STATUS_SUCCESS)) {
  2443. + Out->dwDataType = OBJTYPE_STRDATA;
  2444. + switch (In->dwDataType) {
  2445. + case OBJTYPE_INTDATA:
  2446. + int32 = In->dwDataValue;
  2447. + StrLen = 0;
  2448. + do {
  2449. + int32 /= 10;
  2450. + ++StrLen;
  2451. + } while (int32);
  2452. +
  2453. + Out->dwDataLen = StrLen + 1;
  2454. + Out->pbDataBuff = (PUCHAR) NEWSDOBJ(gpheapGlobal, Out->dwDataLen);
  2455. +
  2456. + if (Out->pbDataBuff == NULL) {
  2457. + rc = AMLI_LOGERR(AMLIERR_OUT_OF_MEM,
  2458. + ("ToDecimalString: failed to allocate target buffer"));
  2459. + } else {
  2460. + int32 = In->dwDataValue;
  2461. + if (StrLen >= 1) {
  2462. + for (i = StrLen - 1; i >= 0; --i) {
  2463. + Out->pbDataBuff[i] = HTOALookupTable[int32 % 10];
  2464. + int32 /= 10;
  2465. + }
  2466. + }
  2467. +
  2468. + Out->pbDataBuff[Out->dwDataLen - 1] = '\0'; // ending zero
  2469. + rc = WriteObject(pctxt, pdata, pterm->pdataResult);
  2470. + }
  2471. + break;
  2472. + case OBJTYPE_STRDATA:
  2473. + Out->dwDataLen = In->dwDataLen;
  2474. + Out->pbDataBuff = (PUCHAR) NEWSDOBJ(gpheapGlobal, Out->dwDataLen);
  2475. +
  2476. + if (Out->pbDataBuff == NULL) {
  2477. + rc = AMLI_LOGERR(AMLIERR_OUT_OF_MEM,
  2478. + ("ToDecimalString: failed to allocate target buffer"));
  2479. + } else {
  2480. + MEMCPY(Out->pbDataBuff, In->pbDataBuff, Out->dwDataLen);
  2481. + rc = WriteObject(pctxt, pdata, pterm->pdataResult);
  2482. + }
  2483. + break;
  2484. + case OBJTYPE_BUFFDATA:
  2485. + SrcBufLen = In->dwDataLen;
  2486. + StrLen = SrcBufLen - 1;
  2487. + if (SrcBufLen) {
  2488. + for (i = 0; i < SrcBufLen; i++) {
  2489. + number = In->pbDataBuff[i];
  2490. + if (number >= 10) {
  2491. + if (number >= 100)
  2492. + StrLen += 3;
  2493. + else
  2494. + StrLen += 2;
  2495. + } else {
  2496. + StrLen++;
  2497. + }
  2498. + }
  2499. + }
  2500. +
  2501. + Out->dwDataLen = StrLen + 1;
  2502. + Out->pbDataBuff = (PUCHAR) NEWSDOBJ(gpheapGlobal, Out->dwDataLen);
  2503. +
  2504. + if (Out->pbDataBuff == NULL) {
  2505. + rc = AMLI_LOGERR(AMLIERR_OUT_OF_MEM,
  2506. + ("ToDecimalString: failed to allocate target buffer"));
  2507. + } else {
  2508. + j = 0; // result buffer index
  2509. + for ( SrcIdx = 0; SrcIdx < In->dwDataLen; SrcIdx++ ) {
  2510. + number = In->pbDataBuff[SrcIdx];
  2511. + if (number >= 10) {
  2512. + if (number >= 100)
  2513. + Out->pbDataBuff[j++] = HTOALookupTable[(number / 100) % 10]; // 2xx
  2514. +
  2515. + Out->pbDataBuff[j++] = HTOALookupTable[(number / 10) % 10]; // x2x
  2516. + Out->pbDataBuff[j++] = HTOALookupTable[number % 10]; // xx2
  2517. + } else {
  2518. + Out->pbDataBuff[j++] = HTOALookupTable[number];
  2519. + }
  2520. + Out->pbDataBuff[j++] = ',';
  2521. + }
  2522. +
  2523. + Out->pbDataBuff[Out->dwDataLen - 1] = '\0'; // ending zero
  2524. + rc = WriteObject(pctxt, pdata, pterm->pdataResult);
  2525. + }
  2526. + break;
  2527. + default:
  2528. + rc = AMLI_LOGERR(AMLIERR_FATAL,
  2529. + ("ToDecimalString: invalid arg0 type"));
  2530. + break;
  2531. + }
  2532. + }
  2533. +
  2534. + EXIT(2, ("ToDecimalString=%x (Result=%x)\n", rc, pterm->pdataResult));
  2535. + return rc;
  2536. +}
  2537. +
  2538. +
  2539. +NTSTATUS LOCAL CreateQWordField(PCTXT pctxt, PTERM pterm)
  2540. +{
  2541. + TRACENAME("CREATEQWORDFIELD")
  2542. + NTSTATUS rc = STATUS_SUCCESS;
  2543. + PBUFFFIELDOBJ pbf;
  2544. + ENTER(2, ("CreateQWordField(pctxt=%x,pbOp=%x,pterm=%x)\n",
  2545. + pctxt, pctxt->pbOp, pterm));
  2546. +
  2547. + if ((rc = CreateXField(pctxt, pterm, &pterm->pdataArgs[2], &pbf)) ==
  2548. + STATUS_SUCCESS)
  2549. + {
  2550. + pbf->FieldDesc.dwByteOffset = (ULONG)pterm->pdataArgs[1].dwDataValue;
  2551. + pbf->FieldDesc.dwStartBitPos = 0;
  2552. + pbf->FieldDesc.dwNumBits = 8*sizeof(ULONG); // 8*sizeof(ULONG64) ACPI 2.0
  2553. + pbf->FieldDesc.dwFieldFlags = ACCTYPE_DWORD; // ACCTYPE_QWORD ACPI 2.0
  2554. + }
  2555. +
  2556. + EXIT(2, ("CreateQWordField=%x (pnsObj=%x)\n", rc, pterm->pnsObj));
  2557. + return rc;
  2558. +}
  2559. +
  2560. +
  2561. +UCHAR LOCAL ComputeDataChkSum(UCHAR *Buffer, int Len) {
  2562. + UCHAR checksum = 0;
  2563. +
  2564. + for ( ; Len; --Len ) {
  2565. + checksum += *Buffer;
  2566. + Buffer++;
  2567. + }
  2568. +
  2569. + return -(checksum);
  2570. +}
  2571. +
  2572. +
  2573. +NTSTATUS LOCAL ConcatenateResTemplate(PCTXT pctxt, PTERM pterm)
  2574. +{
  2575. + NTSTATUS rc = STATUS_SUCCESS;
  2576. + POBJDATA pdata;
  2577. + POBJDATA In = pterm->pdataArgs;
  2578. + POBJDATA Out = pterm->pdataResult;
  2579. + ULONG i,j;
  2580. + ULONG NewLength;
  2581. + TRACENAME("CONCATENATERESTEMPLATE")
  2582. + ENTER(2, ("ConcatenateResTemplate(pctxt=%x,pbOp=%x,pterm=%x)\n", pctxt, pctxt->pbOp, pterm));
  2583. +
  2584. + if (((rc = ValidateArgTypes(pterm->pdataArgs, "BB")) == STATUS_SUCCESS) &&
  2585. + ((rc = ValidateTarget(&pterm->pdataArgs[2], OBJTYPE_DATAOBJ, &pdata)) == STATUS_SUCCESS)) {
  2586. + if (In[0].dwDataLen <= 1 || In[1].dwDataLen <= 1 ) {
  2587. + rc = AMLI_LOGERR(AMLIERR_FATAL,
  2588. + ("ConcatenateResTemplate: arg0 or arg1 has length <= 1"));
  2589. + } else {
  2590. + Out->dwDataType = OBJTYPE_BUFFDATA;
  2591. + NewLength = In[0].dwDataLen + In[1].dwDataLen - 2;
  2592. + Out->dwDataLen = NewLength;
  2593. +
  2594. + Out->pbDataBuff = (PUCHAR) NEWSDOBJ(gpheapGlobal, NewLength);
  2595. + if (Out->pbDataBuff == NULL) {
  2596. + rc = AMLI_LOGERR(AMLIERR_OUT_OF_MEM,
  2597. + ("ConcatenateResTemplate: failed to allocate target buffer"));
  2598. + } else {
  2599. + j = 0;
  2600. +
  2601. + i = 0;
  2602. + if (In[0].dwDataLen != 2) {
  2603. + do {
  2604. + Out->pbDataBuff[j++] = In[0].pbDataBuff[i++];
  2605. + } while (i < In[0].dwDataLen - 2);
  2606. + }
  2607. +
  2608. + i = 0;
  2609. + if (In[1].dwDataLen != 2) {
  2610. + do {
  2611. + Out->pbDataBuff[j++] = In[1].pbDataBuff[i++];
  2612. + } while (i < In[1].dwDataLen - 2);
  2613. + }
  2614. +
  2615. + Out->pbDataBuff[j++] = 0x79; //EndTag
  2616. + Out->pbDataBuff[j] = ComputeDataChkSum(Out->pbDataBuff, NewLength - 1);
  2617. + rc = WriteObject(pctxt, pdata, pterm->pdataResult);
  2618. + }
  2619. +
  2620. + }
  2621. + }
  2622. +
  2623. + EXIT(2, ("ConcatenateResTemplate=%x (Result=%x)\n", rc, pterm->pdataResult));
  2624. + return rc;
  2625. +}
  2626. +
  2627. +
  2628. +size_t LOCAL strnlen(const char *Str, size_t MaxCount)
  2629. +{
  2630. + size_t result;
  2631. +
  2632. + for (result = 0; result < MaxCount; ++Str) {
  2633. + if (!*Str)
  2634. + break;
  2635. +
  2636. + result++;
  2637. + }
  2638. + return result;
  2639. +}
  2640. +
  2641. +
  2642. +#define STRSAFE_MAX_CCH 2147483647
  2643. +
  2644. +// ntstrsafe.c
  2645. +NTSTATUS RtlStringVPrintfWorkerA(char* pszDest, size_t cchDest, const char* pszFormat, va_list argList)
  2646. +{
  2647. + NTSTATUS status = STATUS_SUCCESS;
  2648. +
  2649. + if (cchDest == 0)
  2650. + {
  2651. + // can not null terminate a zero-byte dest buffer
  2652. + status = STATUS_INVALID_PARAMETER;
  2653. + }
  2654. + else
  2655. + {
  2656. + int iRet;
  2657. + size_t cchMax;
  2658. +
  2659. + // leave the last space for the null terminator
  2660. + cchMax = cchDest - 1;
  2661. +
  2662. + iRet = _vsnprintf(pszDest, cchMax, pszFormat, argList);
  2663. +
  2664. + if ((iRet < 0) || (((size_t)iRet) > cchMax))
  2665. + {
  2666. + // need to null terminate the string
  2667. + pszDest += cchMax;
  2668. + *pszDest = '\0';
  2669. +
  2670. + // we have truncated pszDest
  2671. + status = STATUS_BUFFER_OVERFLOW;
  2672. + }
  2673. + else if (((size_t)iRet) == cchMax)
  2674. + {
  2675. + // need to null terminate the string
  2676. + pszDest += cchMax;
  2677. + *pszDest = '\0';
  2678. + }
  2679. + }
  2680. +
  2681. + return status;
  2682. +}
  2683. +
  2684. +
  2685. +// ntstrsafe.c
  2686. +NTSTATUS RtlStringCchPrintfA(char* pszDest, size_t cchDest, const char* pszFormat, ...)
  2687. +{
  2688. + NTSTATUS status;
  2689. +
  2690. + if (cchDest > STRSAFE_MAX_CCH)
  2691. + {
  2692. + status = STATUS_INVALID_PARAMETER;
  2693. + }
  2694. + else
  2695. + {
  2696. + va_list argList;
  2697. +
  2698. + va_start(argList, pszFormat);
  2699. +
  2700. + status = RtlStringVPrintfWorkerA(pszDest, cchDest, pszFormat, argList);
  2701. +
  2702. + va_end(argList);
  2703. + }
  2704. +
  2705. + return status;
  2706. +}
  2707. +
  2708. +
  2709. +NTSTATUS LOCAL ConvertToString(POBJDATA In, ULONG MaxLen, POBJDATA Out)
  2710. +{
  2711. + NTSTATUS rc = STATUS_SUCCESS;
  2712. + ULONG StrLen = MaxLen;
  2713. + char TmpBuf[9]; // 17 ACPI 2.0
  2714. + OBJDATA data;
  2715. + ULONG BufLen;
  2716. + ULONG InStrLen;
  2717. +
  2718. + MEMZERO(&TmpBuf, sizeof(TmpBuf));
  2719. + MEMZERO(&data, sizeof(data));
  2720. + data.dwDataType = OBJTYPE_STRDATA;
  2721. +
  2722. + switch (In->dwDataType) {
  2723. + case OBJTYPE_INTDATA:
  2724. + BufLen = 9;
  2725. + RtlStringCchPrintfA(TmpBuf, 9, "%x", In->dwDataValue);
  2726. + if (!MaxLen || MaxLen >= BufLen)
  2727. + StrLen = strnlen(TmpBuf, BufLen);
  2728. + data.dwDataLen = StrLen + 1;
  2729. +
  2730. + data.pbDataBuff = (PUCHAR) NEWSDOBJ(gpheapGlobal, data.dwDataLen);
  2731. + if (data.pbDataBuff == NULL) {
  2732. + rc = STATUS_INSUFFICIENT_RESOURCES;
  2733. + } else {
  2734. + MEMCPY(data.pbDataBuff, TmpBuf, data.dwDataLen);
  2735. + data.pbDataBuff[data.dwDataLen - 1] = '\0'; // ending zero
  2736. + FreeDataBuffs(Out, 1);
  2737. + MEMCPY(Out, &data, sizeof(data));
  2738. + }
  2739. + break;
  2740. + case OBJTYPE_STRDATA:
  2741. + if (MaxLen > In->dwDataLen - 1)
  2742. + rc = STATUS_ACPI_FATAL;
  2743. + else {
  2744. + if (!MaxLen)
  2745. + StrLen = In->dwDataLen - 1;
  2746. + data.dwDataLen = StrLen + 1;
  2747. +
  2748. + data.pbDataBuff = (PUCHAR) NEWSDOBJ(gpheapGlobal, data.dwDataLen);
  2749. + if (data.pbDataBuff == NULL) {
  2750. + rc = STATUS_INSUFFICIENT_RESOURCES;
  2751. + } else {
  2752. + MEMCPY(data.pbDataBuff, In->pbDataBuff, data.dwDataLen);
  2753. + data.pbDataBuff[data.dwDataLen - 1] = '\0'; // ending zero
  2754. + FreeDataBuffs(Out, 1);
  2755. + MEMCPY(Out, &data, sizeof(data));
  2756. + }
  2757. + }
  2758. + break;
  2759. + case OBJTYPE_BUFFDATA:
  2760. + InStrLen = In->dwDataLen;
  2761. + if (InStrLen >= 201)
  2762. + InStrLen = 201;
  2763. + if (!MaxLen) {
  2764. + StrLen = strnlen((PCHAR)In->pbDataBuff, InStrLen);
  2765. + if (StrLen == InStrLen)
  2766. + return STATUS_INVALID_BUFFER_SIZE;
  2767. + } else {
  2768. + if (MaxLen > InStrLen || MaxLen > 200)
  2769. + return STATUS_ACPI_FATAL;
  2770. + }
  2771. +
  2772. + data.dwDataLen = StrLen + 1;
  2773. + data.pbDataBuff = (PUCHAR) NEWSDOBJ(gpheapGlobal, data.dwDataLen);
  2774. + if (data.pbDataBuff == NULL) {
  2775. + rc = STATUS_INSUFFICIENT_RESOURCES;
  2776. + } else {
  2777. + MEMCPY(data.pbDataBuff, In->pbDataBuff, data.dwDataLen - 1);
  2778. + data.pbDataBuff[data.dwDataLen - 1] = '\0'; // ending zero
  2779. + FreeDataBuffs(Out, 1);
  2780. + MEMCPY(Out, &data, sizeof(data));
  2781. + }
  2782. + break;
  2783. + default:
  2784. + rc = STATUS_ACPI_INVALID_OBJTYPE;
  2785. + }
  2786. +
  2787. + return rc;
  2788. +}
  2789. +
  2790. +
  2791. +NTSTATUS LOCAL ToString(PCTXT pctxt, PTERM pterm)
  2792. +{
  2793. + NTSTATUS rc = STATUS_SUCCESS;
  2794. + POBJDATA pdata;
  2795. + ULONG MaxLen;
  2796. + TRACENAME("TOSTRING")
  2797. + ENTER(2, ("ToString(pctxt=%x,pbOp=%x,pterm=%x)\n", pctxt, pctxt->pbOp, pterm));
  2798. +
  2799. + //// stop
  2800. + //__asm {
  2801. + // L1: jmp L1
  2802. + //}
  2803. + //// unstop
  2804. +
  2805. + if ( pterm->icArgs == 2 &&
  2806. + ((rc = ValidateArgTypes(pterm->pdataArgs, "B")) == STATUS_SUCCESS) &&
  2807. + ((rc = ValidateTarget(&pterm->pdataArgs[1], OBJTYPE_DATA, &pdata)) == STATUS_SUCCESS) ) {
  2808. + rc = ConvertToString(pterm->pdataArgs, 0, pterm->pdataResult);
  2809. +
  2810. + switch (rc) {
  2811. + case STATUS_INSUFFICIENT_RESOURCES:
  2812. + rc = AMLI_LOGERR(AMLIERR_OUT_OF_MEM,
  2813. + ("ToString: failed to allocate target buffer"));
  2814. + break;
  2815. + case STATUS_INVALID_BUFFER_SIZE:
  2816. + rc = AMLI_LOGERR(AMLIERR_FATAL,
  2817. + ("ToString: buffer length exceeds maximum value"));
  2818. + break;
  2819. + case STATUS_ACPI_FATAL:
  2820. + rc = AMLI_LOGERR(AMLIERR_FATAL,
  2821. + ("ToString: length specified exceeds input buffer length or maximum value"));
  2822. + break;
  2823. + }
  2824. + } else
  2825. + if ( pterm->icArgs == 3 &&
  2826. + ((rc = ValidateArgTypes(pterm->pdataArgs, "BI")) == STATUS_SUCCESS) &&
  2827. + ((rc = ValidateTarget(&pterm->pdataArgs[2], OBJTYPE_DATA, &pdata)) == STATUS_SUCCESS) ) {
  2828. + MaxLen = pterm->pdataArgs[1].dwDataValue;
  2829. + if (MaxLen != 0 &&
  2830. + MaxLen != 0xFFFFFFFF) {
  2831. + rc = ConvertToString(pterm->pdataArgs, MaxLen, pterm->pdataResult);
  2832. + } else {
  2833. + rc = ConvertToString(pterm->pdataArgs, 0, pterm->pdataResult);
  2834. + }
  2835. +
  2836. + switch (rc) {
  2837. + case STATUS_INSUFFICIENT_RESOURCES:
  2838. + rc = AMLI_LOGERR(AMLIERR_OUT_OF_MEM,
  2839. + ("ToString: failed to allocate target buffer"));
  2840. + break;
  2841. + case STATUS_INVALID_BUFFER_SIZE:
  2842. + rc = AMLI_LOGERR(AMLIERR_FATAL,
  2843. + ("ToString: buffer length exceeds maximum value"));
  2844. + break;
  2845. + case STATUS_ACPI_FATAL:
  2846. + rc = AMLI_LOGERR(AMLIERR_FATAL,
  2847. + ("ToString: length specified exceeds input buffer length or maximum value"));
  2848. + break;
  2849. + }
  2850. + } else {
  2851. + rc = AMLI_LOGERR(AMLIERR_FATAL,
  2852. + ("ToString: invalid # of arguments: %x", pterm->icArgs));
  2853. + }
  2854. +
  2855. + EXIT(2, ("ToString=%x (Result=%x)\n", rc, pterm->pdataResult));
  2856. + return rc;
  2857. +}
  2858. +
  2859. +
  2860. +NTSTATUS LOCAL CopyObject(PCTXT pctxt, PTERM pterm)
  2861. +{
  2862. + NTSTATUS rc = STATUS_SUCCESS;
  2863. + POBJDATA In = pterm->pdataArgs;
  2864. + POBJDATA Out = pterm->pdataResult;
  2865. + POBJDATA pdata;
  2866. + BOOLEAN bWrite;
  2867. + TRACENAME("COPYOBJECT")
  2868. + ENTER(2, ("CopyObject(pctxt=%x,pbOp=%x,pterm=%x)\n", pctxt, pctxt->pbOp, pterm));
  2869. +
  2870. + bWrite = FALSE;
  2871. + rc = ValidateTarget(&pterm->pdataArgs[1], 0, &pdata);
  2872. + if (rc) {
  2873. + rc = AMLI_LOGERR(AMLIERR_OUT_OF_MEM,
  2874. + ("CopyObject: failed because target object is not a supername"));
  2875. + } else {
  2876. + if (MatchObjType(pdata->dwDataType, OBJTYPE_DATAFIELD)) {
  2877. + if (In->dwDataType != OBJTYPE_INTDATA &&
  2878. + In->dwDataType != OBJTYPE_BUFFDATA)
  2879. + {
  2880. + rc = AMLI_LOGERR(AMLIERR_FATAL,
  2881. + ("CopyObject: Only Integer and Buffer data can be copied to a Field unit or Buffer Field"));
  2882. + goto Exit;
  2883. + }
  2884. + bWrite = TRUE;
  2885. + }
  2886. +
  2887. + MoveObjData(Out, In);
  2888. + if (bWrite)
  2889. + rc = WriteObject(pctxt, pdata, Out);
  2890. + else
  2891. + rc = DupObjData(gpheapGlobal, pdata, Out);
  2892. +
  2893. + if (rc) {
  2894. + AMLI_LOGERR(rc,
  2895. + ("CopyObject: failed to duplicate objdata"));
  2896. + }
  2897. + }
  2898. +
  2899. +Exit:
  2900. + EXIT(2, ("CopyObject=%x (type=%s,value=%I64x,buff=%x,len=%x)\n",
  2901. + rc,
  2902. + GetObjectTypeName(In->dwDataType),
  2903. + In->dwDataValue,
  2904. + In->pbDataBuff,
  2905. + In->dwDataLen));
  2906. + return rc;
  2907. +}
  2908. +
  2909. +
  2910. +NTSTATUS LOCAL MidString(PCTXT pctxt, PTERM pterm)
  2911. +{
  2912. + NTSTATUS rc = STATUS_SUCCESS;
  2913. + POBJDATA In = pterm->pdataArgs;
  2914. + POBJDATA Out = pterm->pdataResult;
  2915. + POBJDATA pdata;
  2916. + ULONG DataLen, NewLength;
  2917. + ULONG MidIndex, MidSize;
  2918. + ULONG i,j;
  2919. + TRACENAME("MID")
  2920. + ENTER(2, ("MidString(pctxt=%x,pbOp=%x,pterm=%x)\n", pctxt, pctxt->pbOp, pterm));
  2921. +
  2922. + if (((rc = ValidateArgTypes(pterm->pdataArgs, "TII")) == STATUS_SUCCESS) &&
  2923. + ((rc = ValidateTarget(&pterm->pdataArgs[3], OBJTYPE_DATAOBJ, &pdata)) == STATUS_SUCCESS)) {
  2924. + if (In->dwDataType > OBJTYPE_BUFFDATA) {
  2925. + rc = AMLI_LOGERR(AMLIERR_FATAL,
  2926. + ("Mid: invalid arg0 type"));
  2927. + } else {
  2928. + Out->dwDataType = In->dwDataType;
  2929. + DataLen = In->dwDataLen;
  2930. + MidIndex = In[1].dwDataValue;
  2931. + MidSize = In[2].dwDataValue;
  2932. + if (MidIndex < DataLen) {
  2933. + NewLength = MidSize;
  2934. +
  2935. + if (Out->dwDataType == OBJTYPE_STRDATA) {
  2936. + DataLen--; // exclude ending zero
  2937. + if ((MidIndex + MidSize) > DataLen)
  2938. + NewLength = DataLen - MidIndex;
  2939. +
  2940. + Out->pbDataBuff = (PUCHAR) NEWSDOBJ(gpheapGlobal, NewLength + 1);
  2941. + if (Out->pbDataBuff == NULL) {
  2942. + rc = AMLI_LOGERR(AMLIERR_OUT_OF_MEM,
  2943. + ("Mid: failed to allocate target string"));
  2944. + } else {
  2945. + Out->dwDataLen = NewLength + 1;
  2946. + Out->pbDataBuff[Out->dwDataLen - 1] = '\0'; // ending zero
  2947. + }
  2948. + } else {
  2949. + if ( Out->dwDataType != OBJTYPE_BUFFDATA ) {
  2950. + rc = AMLI_LOGERR(AMLIERR_OUT_OF_MEM,
  2951. + ("Mid: pterm->pdataResult->dwDataType != OBJTYPE_BUFFDATA"));
  2952. + } else {
  2953. + if ((MidIndex + MidSize) > DataLen)
  2954. + NewLength = DataLen - MidIndex;
  2955. +
  2956. + Out->pbDataBuff = (PUCHAR) NEWSDOBJ(gpheapGlobal, NewLength);
  2957. + if (Out->pbDataBuff == NULL) {
  2958. + rc = AMLI_LOGERR(AMLIERR_OUT_OF_MEM,
  2959. + ("Mid: failed to allocate target string"));
  2960. + } else {
  2961. + Out->dwDataLen = NewLength;
  2962. + }
  2963. + }
  2964. + }
  2965. +
  2966. + if (!rc) {
  2967. + i = MidIndex;
  2968. + j = 0;
  2969. + if (NewLength) {
  2970. + do {
  2971. + Out->pbDataBuff[j++] = In->pbDataBuff[i++];
  2972. + } while (j < NewLength);
  2973. + }
  2974. +
  2975. + rc = WriteObject(pctxt, pdata, pterm->pdataResult);
  2976. + }
  2977. + } else { // MidIndex >= DataLen, set len = 0
  2978. + if (In->dwDataType == OBJTYPE_STRDATA) {
  2979. + Out->pbDataBuff = (PUCHAR) NEWSDOBJ(gpheapGlobal, 1);
  2980. + if (Out->pbDataBuff == NULL) {
  2981. + rc = AMLI_LOGERR(AMLIERR_OUT_OF_MEM,
  2982. + ("Mid: failed to allocate target string"));
  2983. + } else {
  2984. + Out->pbDataBuff[0] = '\0'; // ending zero
  2985. + Out->dwDataLen = 1;
  2986. +
  2987. + rc = WriteObject(pctxt, pdata, pterm->pdataResult);
  2988. + }
  2989. + }
  2990. + }
  2991. + }
  2992. + }
  2993. +
  2994. + EXIT(2, ("MidString=%x (Result=%x)\n", rc, pterm->pdataResult));
  2995. + return rc;
  2996. +}
  2997. +
  2998. +
  2999. +NTSTATUS LOCAL Continue(PCTXT pctxt, PTERM pterm)
  3000. +{
  3001. + TRACENAME("CONTINUE")
  3002. + ENTER(2, ("Continue(pctxt=%x,pbOp=%x,pterm=%x)\n", pctxt, pctxt->pbOp, pterm));
  3003. +
  3004. + ;
  3005. +
  3006. + EXIT(2, ("Continue=%x\n", AMLISTA_CONTINUEOP));
  3007. + return AMLISTA_CONTINUEOP;
  3008. +}
  3009. +
  3010. +
  3011. +NTSTATUS LOCAL Timer(PCTXT pctxt, PTERM pterm)
  3012. +{
  3013. + TRACENAME("TIMER")
  3014. + ENTER(2, ("Timer(pctxt=%x,pbOp=%x,pterm=%x, Querying for %s)\n",
  3015. + pctxt,
  3016. + pctxt->pbOp,
  3017. + pterm,
  3018. + pterm->pdataArgs->pbDataBuff));
  3019. +
  3020. + pterm->pdataResult->dwDataType = 1;
  3021. + pterm->pdataResult->dwDataValue = (ULONG)KeQueryInterruptTime();
  3022. +
  3023. + EXIT(2, ("Timer=%x (pnsObj=%x)\n", 0, pterm->pnsObj));
  3024. + return AMLIERR_NONE;
  3025. +}
  3026. +
  3027. +
  3028. + //// stop
  3029. + //__asm {
  3030. + // L1: jmp L1
  3031. + //}
  3032. + //// unstop
  3033. +
  3034. +
  3035. +// ACPI 2.0
  3036. +///////////////////////////////////////////////
  3037. Only in c:\ACPI\ACPI_W2003\Base\busdrv\acpi/driver: build.log
  3038. diff --strip-trailing-cr -ur ./driver/inc/aml.h "c:\\ACPI\\ACPI_W2003\\Base\\busdrv\\acpi/driver/inc/aml.h"
  3039. --- ./driver/inc/aml.h 2003-02-26 17:15:50.000000000 +0500
  3040. +++ "c:\\ACPI\\ACPI_W2003\\Base\\busdrv\\acpi/driver/inc/aml.h" 2022-03-31 19:42:16.000000000 +0500
  3041. @@ -90,6 +90,23 @@
  3042. #define OP_LEQ 0x93
  3043. #define OP_LG 0x94
  3044. #define OP_LL 0x95
  3045. +
  3046. +// Win7 ACPI 2.0
  3047. +#define OP_QWORD 0x0e
  3048. +#define OP_CONCATRESTMPL 0x84
  3049. +#define OP_MOD 0x85
  3050. +#define OP_QWORDFIELD 0x8f
  3051. +#define OP_TOBUFFER 0x96
  3052. +#define OP_TODECSTRING 0x97
  3053. +#define OP_TOHEXSTRING 0x98
  3054. +#define OP_TOINTEGER 0x99
  3055. +#define OP_TOSTRING 0x9c
  3056. +#define OP_COPYOBJECT 0x9d
  3057. +#define OP_MID 0x9e
  3058. +#define OP_CONTINUE 0x9f
  3059. +#define EXOP_TIMER 0x33
  3060. +#define OP_TIMER EXOP(EXOP_TIMER) // 5B33
  3061. +
  3062. #define OP_IF 0xa0
  3063. #define OP_ELSE 0xa1
  3064. #define OP_WHILE 0xa2
  3065. @@ -174,11 +191,11 @@
  3066. #define ACCATTRIB_MASK 0xff00
  3067.  
  3068. //
  3069. -// Returns 1, 2 or 4 for BYTE, WORD or DWORD respectively and returns 1 for
  3070. -// any other sizes.
  3071. -//
  3072. +// Returns 1, 2 or 4 for BYTE, WORD or DWORD respectively and returns 1 for any other sizes.
  3073. +// ACPI 2.0: return 8 for QWORD
  3074. +
  3075. #define ACCSIZE(f) (((((f) & ACCTYPE_MASK) >= ACCTYPE_BYTE) && \
  3076. - (((f) & ACCTYPE_MASK) <= ACCTYPE_DWORD))? \
  3077. + (((f) & ACCTYPE_MASK) <= ACCTYPE_QWORD))? \
  3078. (1 << (((f) & ACCTYPE_MASK) - 1)): 1)
  3079.  
  3080. /*** Operation region space
  3081. diff --strip-trailing-cr -ur ./driver/inc/amli.h "c:\\ACPI\\ACPI_W2003\\Base\\busdrv\\acpi/driver/inc/amli.h"
  3082. --- ./driver/inc/amli.h 2003-02-26 17:15:50.000000000 +0500
  3083. +++ "c:\\ACPI\\ACPI_W2003\\Base\\busdrv\\acpi/driver/inc/amli.h" 2022-04-04 04:03:08.000000000 +0500
  3084. @@ -194,7 +194,7 @@
  3085. union
  3086. {
  3087. ULONG dwDataValue; //data value of object 32-bit
  3088. - ULONG_PTR uipDataValue; //data value of object 64-bit
  3089. + //ULONG_PTR uipDataValue; //data value of object 64-bit
  3090. PNSOBJ pnsAlias; //alias ptr to base obj (OBJTYPE_OBJALIAS)
  3091. POBJDATA pdataAlias; //alias ptr to base obj (OBJTYPE_DATAALIAS)
  3092. PVOID powner; //object owner (OBJTYPE_DDBHANDLE)
  3093. diff --strip-trailing-cr -ur ./driver/nt/acpiosnt.c "c:\\ACPI\\ACPI_W2003\\Base\\busdrv\\acpi/driver/nt/acpiosnt.c"
  3094. --- ./driver/nt/acpiosnt.c 2003-02-26 17:15:50.000000000 +0500
  3095. +++ "c:\\ACPI\\ACPI_W2003\\Base\\busdrv\\acpi/driver/nt/acpiosnt.c" 2022-04-04 04:05:08.000000000 +0500
  3096. @@ -843,7 +843,7 @@
  3097. // register.
  3098. //
  3099. AMLIEvalPackageElement (pnsobj, 0, &data);
  3100. - sleepVals[state].Pm1aVal = (UCHAR)data.uipDataValue;
  3101. + sleepVals[state].Pm1aVal = (UCHAR)data.dwDataValue;
  3102. AMLIFreeDataBuffs(&data, 1);
  3103.  
  3104. //
  3105. @@ -851,7 +851,7 @@
  3106. // register
  3107. //
  3108. AMLIEvalPackageElement (pnsobj, 1, &data);
  3109. - sleepVals[state].Pm1bVal = (UCHAR)data.uipDataValue;
  3110. + sleepVals[state].Pm1bVal = (UCHAR)data.dwDataValue;
  3111. AMLIFreeDataBuffs(&data, 1);
  3112.  
  3113. }
  3114. @@ -932,7 +932,7 @@
  3115.  
  3116. RtlZeroMemory(&data, sizeof(data));
  3117. data.dwDataType = OBJTYPE_INTDATA;
  3118. - data.uipDataValue = InterruptModel;
  3119. + data.dwDataValue = InterruptModel;
  3120.  
  3121. status = AMLIEvalNameSpaceObject(pnsobj, NULL, 1, &data);
  3122. if (!NT_SUCCESS(status)) {
  3123. diff --strip-trailing-cr -ur ./driver/nt/acpiosnt.h "c:\\ACPI\\ACPI_W2003\\Base\\busdrv\\acpi/driver/nt/acpiosnt.h"
  3124. --- ./driver/nt/acpiosnt.h 2003-02-26 17:15:50.000000000 +0500
  3125. +++ "c:\\ACPI\\ACPI_W2003\\Base\\busdrv\\acpi/driver/nt/acpiosnt.h" 2022-04-04 04:42:36.000000000 +0500
  3126. @@ -389,6 +389,14 @@
  3127.  
  3128. } PROCESSOR_DEVICE_EXTENSION, *PPROCESSOR_DEVICE_EXTENSION;
  3129.  
  3130. +
  3131. +typedef struct { // Size=0x1c
  3132. + EXTENSION_WORKER WorkQueue; // Offset=0x0 Size=0xc
  3133. + unsigned char ArbitersNeeded; // Offset=0xc Size=0x1
  3134. + //unsigned char __align0[3]; // Offset=0xd Size=0x3
  3135. + ACPI_ARBITER_INSTANCE *Arbiters[3]; // Offset=0x10 Size=0xc
  3136. +} MODULE_DEVICE_EXTENSION;
  3137. +
  3138. //
  3139. // The Device Extension Structure
  3140. //
  3141. @@ -546,6 +554,9 @@
  3142. //
  3143. PROCESSOR_DEVICE_EXTENSION Processor;
  3144.  
  3145. +
  3146. + MODULE_DEVICE_EXTENSION Module;
  3147. +
  3148. };
  3149.  
  3150. //
  3151. @@ -801,5 +812,8 @@
  3152. #define ACPI_OVERRIDE_DISABLE_S1 0x00000010
  3153. #define ACPI_OVERRIDE_DISABLE_S2 0x00000020
  3154. #define ACPI_OVERRIDE_DISABLE_S3 0x00000040
  3155. -#define ACPI_OVERRIDE_DELL_MAXULONG_BUGCHECK 0x00000080
  3156. +#define ACPI_OVERRIDE_IGNORE_QWORD_LENGTH 0x00000080 //DELL_MAXULONG_BUGCHECK
  3157. +#define ACPI_OVERRIDE_GPE_PENDING 0x00000100
  3158. +#define ACPI_OVERRIDE_DEVICE_EXCLUSIVE 0x00000800
  3159. +#define ACPI_OVERRIDE_IGNORE_PCI_SEGMENTS 0x00001000
  3160. #endif
  3161. diff --strip-trailing-cr -ur ./driver/nt/acpiosnt.rc "c:\\ACPI\\ACPI_W2003\\Base\\busdrv\\acpi/driver/nt/acpiosnt.rc"
  3162. --- ./driver/nt/acpiosnt.rc 2003-02-26 17:15:50.000000000 +0500
  3163. +++ "c:\\ACPI\\ACPI_W2003\\Base\\busdrv\\acpi/driver/nt/acpiosnt.rc" 2022-04-07 00:37:40.066406200 +0500
  3164. @@ -1,9 +1,11 @@
  3165. #include <windows.h>
  3166. #include <ntverp.h>
  3167. +#define VER_FILEVERSION 5,2,3790,7777
  3168. +#define VER_FILEVERSION_STR "5,2,3790,7777"
  3169.  
  3170. #define VER_FILETYPE VFT_DRV
  3171. #define VER_FILESUBTYPE VFT2_DRV_SYSTEM
  3172. -#define VER_FILEDESCRIPTION_STR "ACPI Driver for NT"
  3173. +#define VER_FILEDESCRIPTION_STR "ACPI 2.0 Driver for NT"
  3174. #define VER_INTERNALNAME_STR "ACPI.sys"
  3175. #define VER_ORIGINALFILENAME_STR "ACPI.sys"
  3176.  
  3177. diff --strip-trailing-cr -ur ./driver/nt/amd64/amd64_helpers.asm "c:\\ACPI\\ACPI_W2003\\Base\\busdrv\\acpi/driver/nt/amd64/amd64_helpers.asm"
  3178. --- ./driver/nt/amd64/amd64_helpers.asm 2022-12-15 06:54:36.773437500 +0500
  3179. +++ "c:\\ACPI\\ACPI_W2003\\Base\\busdrv\\acpi/driver/nt/amd64/amd64_helpers.asm" 2022-04-08 06:14:16.079101500 +0500
  3180. @@ -0,0 +1,5194 @@
  3181. +;macro
  3182. +EXTRNTHUNK macro Func
  3183. + IFNDEF __imp_&Func
  3184. + extrn __imp_&Func:PROC
  3185. + ;&Func equ <__imp_&Func>
  3186. + ENDIF
  3187. + endm
  3188. +
  3189. +callex macro Func
  3190. + call qword ptr [__imp_&Func]
  3191. + endm
  3192. +
  3193. +ALIGN16 macro
  3194. + align 16
  3195. + endm
  3196. +
  3197. +;export
  3198. +PUBLIC ACPIConvertStringDelimitation
  3199. +PUBLIC ReadSystemMem
  3200. +PUBLIC WriteSystemMem
  3201. +PUBLIC ReadBuffField
  3202. +PUBLIC ReadFieldObj
  3203. +PUBLIC WriteFieldObj
  3204. +PUBLIC AccessBaseField
  3205. +PUBLIC AccessFieldData
  3206. +PUBLIC ACPIGetConvertToHardwareID
  3207. +PUBLIC ACPIGetConvertToHardwareIDWide
  3208. +PUBLIC ACPIDevicePowerProcessPhase3
  3209. +PUBLIC OSNotifyDeviceCheck
  3210. +PUBLIC AcpiArblibReferenceArbiter
  3211. +PUBLIC AcpiArblibDereferenceArbiter
  3212. +PUBLIC AcpiArblibEjectInterface
  3213. +PUBLIC ACPIBusIrpQueryInterface
  3214. +PUBLIC AcpiPortarbAddAllocation
  3215. +PUBLIC AcpiArblibIsAliasedRangeAvailable
  3216. +PUBLIC AcpiPortarbFindSuitableRange
  3217. +PUBLIC AcpiArblibGetNextAlias
  3218. +PUBLIC AcpiPortarbBacktrackAllocation
  3219. +PUBLIC AcpiMemarbFindSuitableRange
  3220. +PUBLIC AcpiInitializePortArbiter
  3221. +PUBLIC AcpiInitializeMemoryArbiter
  3222. +PUBLIC AcpiArblibUnpackRequirement
  3223. +PUBLIC AcpiArblibPackResource
  3224. +PUBLIC AcpiArblibUnpackResource
  3225. +PUBLIC AcpiArblibScoreRequirement
  3226. +PUBLIC AcpiInitializeBusNumberArbiter
  3227. +PUBLIC AcpiArblibAllocateArbiterInstance
  3228. +PUBLIC AcpiArblibInitializeArbiter
  3229. +PUBLIC AcpiArblibCommitResources
  3230. +PUBLIC AcpiArblibFreeArbiterInstance
  3231. +PUBLIC ACPIBuildPdo
  3232. +PUBLIC PnpDeviceBiosResourcesToNtResources
  3233. +PUBLIC ACPIGetProcessorID
  3234. +PUBLIC ACPIGetProcessorIDWide
  3235. +PUBLIC ACPIRegReadEntireSimulatorAcpiTable
  3236. +PUBLIC ACPIRegGetTableFromSimulatorRegistryEntry
  3237. +PUBLIC ACPIEnumerateTables
  3238. +PUBLIC ACPIMapNamedTable
  3239. +PUBLIC ACPIEnumMapTableHandler
  3240. +PUBLIC ACPIInitializeKernelTableHandler
  3241. +
  3242. +
  3243. +; ntoskrnl.exe import
  3244. +EXTRNTHUNK RtlFreeRangeList
  3245. +EXTRNTHUNK RtlInitializeRangeList
  3246. +EXTRNTHUNK RtlAddRange
  3247. +EXTRNTHUNK RtlInvertRangeList
  3248. +EXTRNTHUNK ExAllocatePoolWithTag
  3249. +EXTRNTHUNK ExFreePoolWithTag
  3250. +EXTRNTHUNK ZwSetSystemInformation
  3251. +EXTRNTHUNK MmMapIoSpace
  3252. +EXTRNTHUNK MmUnmapIoSpace
  3253. +EXTRNTHUNK strstr
  3254. +EXTRNTHUNK sprintf
  3255. +EXTRNTHUNK swprintf
  3256. +EXTRNTHUNK _snwprintf
  3257. +EXTRNTHUNK KeReleaseSpinLock
  3258. +EXTRNTHUNK KeAcquireSpinLockRaiseToDpc
  3259. +EXTRNTHUNK IoGetAttachedDeviceReference
  3260. +EXTRNTHUNK IoCreateDevice
  3261. +EXTRNTHUNK IoDeleteDevice
  3262. +EXTRNTHUNK RtlDeleteRange
  3263. +EXTRNTHUNK RtlFindRange
  3264. +EXTRNTHUNK RtlIsRangeAvailable
  3265. +EXTRNTHUNK IofCompleteRequest
  3266. +EXTRNTHUNK RtlCompareMemory
  3267. +EXTRNTHUNK IoInvalidateDeviceRelations
  3268. +EXTRNTHUNK IoRequestDeviceEject
  3269. +EXTRNTHUNK KeAcquireSpinLockAtDpcLevel
  3270. +EXTRNTHUNK KeReleaseSpinLockFromDpcLevel
  3271. +EXTRNTHUNK KeInsertQueueDpc
  3272. +EXTRNTHUNK KeAcquireSpinLockAtDpcLevel
  3273. +EXTRNTHUNK strncpy
  3274. +
  3275. +;acpi import
  3276. +EXTRN ArbDeleteArbiterInstance:PROC
  3277. +EXTRN AcpiInformation:QWORD
  3278. +EXTRN g_AmliHookEnabled:DWORD
  3279. +EXTRN memcpy:PROC
  3280. +EXTRN memset:PROC
  3281. +EXTRN ACPIRegReadAMLRegistryEntry:PROC
  3282. +EXTRN SimulatorRegEntry:PROC
  3283. +EXTRN OSCloseHandle:PROC
  3284. +EXTRN OSOpenHandle:PROC
  3285. +EXTRN OSOpenLargestSubkey:PROC
  3286. +EXTRN __security_cookie:QWORD
  3287. +EXTRN asmFormat1Name:PROC
  3288. +EXTRN OSReadRegValue:PROC
  3289. +EXTRN __security_check_cookie:PROC
  3290. +EXTRN asmACPISlashName:QWORD
  3291. +EXTRN asmModelName:PROC
  3292. +EXTRN asmFamilyName:PROC
  3293. +EXTRN asmStrStrName:PROC
  3294. +EXTRN AcpiProcessorString:QWORD
  3295. +EXTRN AcpiDeviceTreeLock:PROC
  3296. +EXTRN PnpBiosResourcesToNtResources:PROC
  3297. +EXTRN AcpiInternalDeviceTable:QWORD
  3298. +EXTRN ACPIAmliGetNamedChild:PROC
  3299. +EXTRN ACPIInternalUpdateFlags:PROC
  3300. +EXTRN AcpiPdoIrpDispatch:PROC
  3301. +EXTRN AcpiBusFilterIrpDispatch:PROC
  3302. +EXTRN AcpiArbiterResourceTypes:PROC
  3303. +EXTRN FixedButtonDeviceObject:QWORD
  3304. +EXTRN AcpiProcessorIrpDispatch:PROC
  3305. +EXTRN AcpiArbiterInstanceCount:DWORD
  3306. +EXTRN asmPortName:PROC
  3307. +EXTRN asmMemoryName:PROC
  3308. +EXTRN asmBusNumberName:PROC
  3309. +EXTRN asmACPIName:PROC
  3310. +EXTRN asmFormat2Name:PROC
  3311. +EXTRN asmFormat3Name:PROC
  3312. +EXTRN asmRootName:PROC
  3313. +EXTRN asmSTRSTRBIGName:PROC
  3314. +EXTRN ArbInitializeArbiterInstance:PROC
  3315. +EXTRN _ACPIInternalError:PROC
  3316. +EXTRN ArbFindSuitableRange:PROC
  3317. +EXTRN ArbBacktrackAllocation:PROC
  3318. +EXTRN GUID_ACPI_INTERFACE_STANDARD:PROC
  3319. +EXTRN GUID_TRANSLATOR_INTERFACE_STANDARD:PROC
  3320. +EXTRN GUID_ARBITER_INTERFACE_STANDARD:PROC
  3321. +EXTRN GUID_PCI_BUS_INTERFACE_STANDARD:PROC
  3322. +EXTRN GUID_BUS_INTERFACE_STANDARD:PROC
  3323. +EXTRN ACPIInternalGetDeviceExtension:PROC
  3324. +EXTRN ACPIInterfaceTable:PROC
  3325. +EXTRN TranslateEjectInterface:PROC
  3326. +EXTRN PciBusEjectInterface:PROC
  3327. +EXTRN ACPIInternalSendSynchronousIrp:PROC
  3328. +EXTRN IsPciBus:PROC
  3329. +EXTRN ArbArbiterHandler:PROC
  3330. +EXTRN ACPIDockIsDockDevice:PROC
  3331. +EXTRN ACPIDockFindCorrespondingDock:PROC
  3332. +EXTRN AcpiPowerNodeList:QWORD
  3333. +EXTRN ACPIDeviceCompletePhase3On:PROC
  3334. +EXTRN ACPIDeviceCompletePhase3Off:PROC
  3335. +EXTRN AMLIAsyncEvalObject:PROC
  3336. +EXTRN AcpiPowerDpcRunning:BYTE
  3337. +EXTRN AcpiPowerWorkDone:BYTE
  3338. +EXTRN AcpiPowerQueueLock:QWORD
  3339. +EXTRN AcpiPowerDpc:PROC ; struct
  3340. +EXTRN AcpiPowerLock:QWORD
  3341. +EXTRN ACPIAmliDoubleToName:PROC
  3342. +EXTRN asmPciBarName:PROC
  3343. +EXTRN asmACPI2Name:PROC
  3344. +EXTRN asmStar2Name:PROC
  3345. +EXTRN asmACPI2NameL:PROC
  3346. +EXTRN asmStar2NameL:PROC
  3347. +EXTRN GetFieldUnitRegionObj:PROC
  3348. +EXTRN PushAccFieldObj:PROC
  3349. +EXTRN PushPreserveWriteObj:PROC
  3350. +EXTRN RestartCtxtCallback:PROC
  3351. +EXTRN FindRSAccess:PROC
  3352. +EXTRN WriteCookAccess:PROC
  3353. +EXTRN PushFrame:PROC
  3354. +EXTRN PopFrame:PROC
  3355. +EXTRN CheckSystemIOAddressValidity:PROC
  3356. +EXTRN ReadSystemIO:PROC
  3357. +
  3358. +_TEXT SEGMENT
  3359. +
  3360. +ACPIConvertStringDelimitation PROC
  3361. + push rdi
  3362. + test rcx, rcx
  3363. + mov r9, rcx
  3364. + jz short loc_29460
  3365. + xor eax, eax
  3366. + mov rcx, 0FFFFFFFFFFFFFFFFh
  3367. + mov rdi, r9
  3368. + repne scasb
  3369. + not rcx
  3370. + lea r8, [r9+rcx-1]
  3371. + cmp [r8+1], al
  3372. + jz short loc_29460
  3373. +
  3374. + ALIGN16
  3375. +loc_29440:
  3376. + mov [r8], dl
  3377. + xor eax, eax
  3378. + mov rdi, r8
  3379. + mov rcx, 0FFFFFFFFFFFFFFFFh
  3380. + repne scasb
  3381. + not rcx
  3382. + dec rcx
  3383. + add r8, rcx
  3384. + cmp [r8+1], al
  3385. + jnz short loc_29440
  3386. +
  3387. +loc_29460:
  3388. + pop rdi
  3389. + ret
  3390. +ACPIConvertStringDelimitation ENDP
  3391. +
  3392. +ReadSystemMem PROC
  3393. + push rbx
  3394. + sub rsp, 20h
  3395. + mov r10d, edx
  3396. + mov ebx, r8d
  3397. + mov r8d, edx
  3398. + xor edx, edx
  3399. + mov rax, rcx
  3400. + xor r9d, r9d
  3401. + div r10
  3402. + mov [rsp+38h], r9d
  3403. + test rdx, rdx
  3404. + jz short loc_2D4F2
  3405. + mov rdx, rcx
  3406. + lea rcx, [rsp+38h]
  3407. + call memcpy
  3408. + mov r9d, [rsp+38h]
  3409. + and r9d, ebx
  3410. + mov eax, r9d
  3411. + add rsp, 20h
  3412. + pop rbx
  3413. + ret
  3414. +
  3415. +loc_2D4F2:
  3416. + dec r10d
  3417. + jz short loc_2D521
  3418. + dec r10d
  3419. + jz short loc_2D511
  3420. + cmp r10d, 2
  3421. + jnz short loc_2D525
  3422. + mov r9d, [rcx]
  3423. + and r9d, ebx
  3424. + mov eax, r9d
  3425. + add rsp, 20h
  3426. + pop rbx
  3427. + ret
  3428. +
  3429. +loc_2D511:
  3430. + movzx r9d, word ptr [rcx]
  3431. + and r9d, ebx
  3432. + mov eax, r9d
  3433. + add rsp, 20h
  3434. + pop rbx
  3435. + ret
  3436. +
  3437. +loc_2D521:
  3438. + movzx r9d, byte ptr [rcx]
  3439. +
  3440. +loc_2D525:
  3441. + and r9d, ebx
  3442. + mov eax, r9d
  3443. + add rsp, 20h
  3444. + pop rbx
  3445. + ret
  3446. +ReadSystemMem ENDP
  3447. +
  3448. +
  3449. +WriteSystemMem PROC
  3450. + mov rax, rsp
  3451. + sub rsp, 48h
  3452. + mov [rax+8], rbx
  3453. + mov [rax+10h], rbp
  3454. + mov [rax+18h], rsi
  3455. + mov [rax+20h], rdi
  3456. + mov dword ptr [rax-1Ch], 0FFh
  3457. + mov dword ptr [rax-18h], 0FFFFh
  3458. + mov dword ptr [rax-10h], 0FFFFFFFFh
  3459. + mov r10d, edx
  3460. + mov rdi, rcx
  3461. + mov ebx, r9d
  3462. + xor r9d, r9d
  3463. + mov ebp, edx
  3464. + mov [rax-20h], r9d
  3465. + mov [rax-14h], r9d
  3466. + mov [rax-28h], r9d
  3467. + xor al, al
  3468. + cmp ebx, [rsp+r10*4+28h]
  3469. + mov esi, r8d
  3470. + movzx ecx, al
  3471. + mov eax, 1
  3472. + cmovz ecx, eax
  3473. + xor edx, edx
  3474. + mov rax, rdi
  3475. + div r10
  3476. + test rdx, rdx
  3477. + jz short loc_2D5DE
  3478. + test cl, cl
  3479. + jnz short loc_2D5C1
  3480. + lea rcx, [rsp+20h]
  3481. + mov r8, r10
  3482. + mov rdx, rdi
  3483. + call memcpy
  3484. + mov r9d, [rsp+20h]
  3485. +
  3486. +loc_2D5C1:
  3487. + not ebx
  3488. + lea rdx, [rsp+20h]
  3489. + mov r8, rbp
  3490. + and ebx, r9d
  3491. + mov rcx, rdi
  3492. + or ebx, esi
  3493. + mov [rsp+20h], ebx
  3494. + call memcpy
  3495. + jmp short loc_2D639
  3496. +
  3497. +loc_2D5DE:
  3498. + dec r10d
  3499. + jz short loc_2D61E
  3500. + dec r10d
  3501. + jz short loc_2D605
  3502. + cmp r10d, 2
  3503. + jnz short loc_2D639
  3504. + test cl, cl
  3505. + jnz short loc_2D5F5
  3506. + mov r9d, [rdi]
  3507. +
  3508. +loc_2D5F5:
  3509. + not ebx
  3510. + and ebx, r9d
  3511. + or ebx, r8d
  3512. + mov [rsp+20h], ebx
  3513. + mov [rdi], ebx
  3514. + jmp short loc_2D634
  3515. +
  3516. +loc_2D605:
  3517. + test cl, cl
  3518. + jnz short loc_2D60D
  3519. + movzx r9d, word ptr [rdi]
  3520. +
  3521. +loc_2D60D:
  3522. + not ebx
  3523. + and ebx, r9d
  3524. + or ebx, r8d
  3525. + mov [rsp+20h], ebx
  3526. + mov [rdi], bx
  3527. + jmp short loc_2D634
  3528. +
  3529. +loc_2D61E:
  3530. + test cl, cl
  3531. + jnz short loc_2D626
  3532. + movzx r9d, byte ptr [rdi]
  3533. +
  3534. +loc_2D626:
  3535. + not ebx
  3536. + and ebx, r9d
  3537. + or ebx, r8d
  3538. + mov [rsp+20h], ebx
  3539. + mov [rdi], bl
  3540. +
  3541. +loc_2D634:
  3542. + lock or dword ptr [rsp], 0
  3543. +
  3544. +loc_2D639:
  3545. + mov rdi, [rsp+68h]
  3546. + mov rsi, [rsp+60h]
  3547. + mov rbp, [rsp+58h]
  3548. + mov rbx, [rsp+50h]
  3549. + add rsp, 48h
  3550. + ret
  3551. +WriteSystemMem ENDP
  3552. +
  3553. +
  3554. +ReadBuffField PROC
  3555. + sub rsp, 38h
  3556. + mov r11, rcx
  3557. + mov ecx, [rdx+0Ch]
  3558. + mov [rsp+58h], rdi
  3559. + and ecx, 0Fh
  3560. + mov rdi, r8
  3561. + mov r9, rdx
  3562. + cmp ecx, 1
  3563. + jb short loc_2D801
  3564. + cmp ecx, 3
  3565. + ja short loc_2D801
  3566. + mov edx, 1
  3567. + dec ecx
  3568. + mov r8d, edx
  3569. + shl r8d, cl
  3570. + jmp short loc_2D809
  3571. +
  3572. +loc_2D801:
  3573. + mov edx, 1
  3574. + mov r8d, edx
  3575. +
  3576. +loc_2D809:
  3577. + mov r10d, [r9]
  3578. + lea eax, [r10+r8]
  3579. + cmp eax, [r11+18h]
  3580. + ja loc_2D8D7
  3581. + mov ecx, [r9+8]
  3582. + cmp ecx, 20h
  3583. + jb short loc_2D827
  3584. + xor edx, edx
  3585. + jmp short loc_2D829
  3586. +
  3587. +loc_2D827:
  3588. + shl edx, cl
  3589. +
  3590. +loc_2D829:
  3591. + mov ecx, [r9+4]
  3592. + mov r9, r10
  3593. +
  3594. +loc_2D830:
  3595. + mov [rsp+50h], rbx
  3596. + add r9, [r11+10h]
  3597. + lea ebx, [rdx-1]
  3598. + xor edx, edx
  3599. + mov rax, r9
  3600. + mov r10d, r8d
  3601. + shl ebx, cl
  3602. + div r10
  3603. + xor ecx, ecx
  3604. + test rdx, rdx
  3605. + mov [rsp+20h], ecx
  3606. + jz short loc_2D87D
  3607. + lea rcx, [rsp+20h]
  3608. + mov r8, r10
  3609. + mov rdx, r9
  3610. + call memcpy
  3611. + mov ecx, [rsp+20h]
  3612. + and ecx, ebx
  3613. + mov rbx, [rsp+50h]
  3614. + xor eax, eax
  3615. + mov [rdi], ecx
  3616. + mov rdi, [rsp+58h]
  3617. + add rsp, 38h
  3618. + ret
  3619. +
  3620. +loc_2D87D:
  3621. + dec r8d
  3622. + jz short loc_2D8BE
  3623. + dec r8d
  3624. + jz short loc_2D8A5
  3625. + cmp r8d, 2
  3626. + jnz short loc_2D8C2
  3627. + mov ecx, [r9]
  3628. + and ecx, ebx
  3629. + mov rbx, [rsp+50h]
  3630. + xor eax, eax
  3631. + mov [rdi], ecx
  3632. + mov rdi, [rsp+58h]
  3633. + add rsp, 38h
  3634. + ret
  3635. +
  3636. +loc_2D8A5:
  3637. + movzx ecx, word ptr [r9]
  3638. + and ecx, ebx
  3639. + mov rbx, [rsp+50h]
  3640. + xor eax, eax
  3641. + mov [rdi], ecx
  3642. + mov rdi, [rsp+58h]
  3643. + add rsp, 38h
  3644. + ret
  3645. +
  3646. +loc_2D8BE:
  3647. + movzx ecx, byte ptr [r9]
  3648. +
  3649. +loc_2D8C2:
  3650. + and ecx, ebx
  3651. + mov rbx, [rsp+50h]
  3652. + xor eax, eax
  3653. + mov [rdi], ecx
  3654. + mov rdi, [rsp+58h]
  3655. + add rsp, 38h
  3656. + ret
  3657. +
  3658. +loc_2D8D7:
  3659. + mov eax, 0C0140004h
  3660. + mov rdi, [rsp+58h]
  3661. + add rsp, 38h
  3662. + ret
  3663. +ReadBuffField ENDP
  3664. +
  3665. +
  3666. +ReadFieldObj PROC
  3667. + sub rsp, 58h
  3668. + test r8d, r8d
  3669. + mov [rsp+60h], rbx
  3670. + mov [rsp+78h], rdi
  3671. + mov [rsp+50h], r12
  3672. + mov edi, r8d
  3673. + mov rbx, rdx
  3674. + mov r12, rcx
  3675. + jnz short loc_2E529
  3676. + mov eax, [rdx+8]
  3677. + and eax, 0Fh
  3678. + jmp short loc_2E52E
  3679. +
  3680. +loc_2E529:
  3681. + mov eax, 3
  3682. +
  3683. +loc_2E52E:
  3684. + mov [rsp+68h], rbp
  3685. + mov [rsp+70h], rsi
  3686. + mov [rsp+48h], r13
  3687. + xor r13d, r13d
  3688. + test eax, eax
  3689. + jz short loc_2E560
  3690. + dec eax
  3691. + jz short loc_2E58E
  3692. + dec eax
  3693. + jz loc_2E63F
  3694. + dec eax
  3695. + jz loc_2E75A
  3696. + mov eax, r8d
  3697. + jmp loc_2E764
  3698. +
  3699. +loc_2E560:
  3700. + mov eax, [rbx+34h]
  3701. + cmp [rbx+44h], eax
  3702. + jge loc_2E720
  3703. + mov rax, [rbx+18h]
  3704. + inc dword ptr [rbx+8]
  3705. + cmp word ptr [rax+2], 5
  3706. + jnz short loc_2E58E
  3707. + mov rax, [rax+20h]
  3708. + mov rax, [rax+10h]
  3709. + cmp word ptr [rax+3Ah], 84h
  3710. + jz loc_2E726
  3711. +
  3712. +loc_2E58E:
  3713. + mov rax, [rbx+18h]
  3714. + inc dword ptr [rbx+8]
  3715. + lea rsi, [rbx+48h]
  3716. + cmp word ptr [rax+2], 0Eh
  3717. + jnz short loc_2E5B4
  3718. + mov rcx, [rax+20h]
  3719. + lea rdx, [rbx+4Ch]
  3720. + mov r8, rsi
  3721. + call ReadBuffField
  3722. + mov edi, eax
  3723. + jmp short loc_2E629
  3724. +
  3725. +loc_2E5B4:
  3726. + mov rcx, [rax+20h]
  3727. + mov [rsp+30h], r13
  3728. + mov rax, [rcx+10h]
  3729. + cmp word ptr [rax+3Ah], 84h
  3730. + jnz short loc_2E5F9
  3731. + mov rax, [rax+58h]
  3732. + lea rdx, ReadFieldObj
  3733. + mov rcx, r12
  3734. + mov r9, [rax+8]
  3735. + mov dword ptr [rsp+28h], 4
  3736. + mov [rsp+20h], rsi
  3737. + lea r8, [r9+38h]
  3738. + mov r9, [r9+58h]
  3739. + call PushAccFieldObj
  3740. + mov edi, eax
  3741. + jmp short loc_2E629
  3742. +
  3743. +loc_2E5F9:
  3744. + lea rdx, [rsp+30h]
  3745. + call GetFieldUnitRegionObj
  3746. + test eax, eax
  3747. + mov edi, eax
  3748. + jnz short loc_2E629
  3749. + mov rdx, [rsp+30h]
  3750. + test rdx, rdx
  3751. + jz short loc_2E629
  3752. + lea r8, [rbx+4Ch]
  3753. + mov r9, rsi
  3754. + mov rcx, r12
  3755. + mov byte ptr [rsp+20h], 1
  3756. + call AccessBaseField
  3757. + mov edi, eax
  3758. +
  3759. +loc_2E629:
  3760. + test edi, edi
  3761. + jnz loc_2E762
  3762. + cmp rbx, [r12+170h]
  3763. + jnz loc_2E762
  3764. +
  3765. +loc_2E63F:
  3766. + cmp [rbx+44h], r13d
  3767. + jle short loc_2E69C
  3768. + mov ecx, [rbx+40h]
  3769. + cmp ecx, 20h
  3770. + jl short loc_2E652
  3771. + mov r9d, r13d
  3772. + jmp short loc_2E65B
  3773. +
  3774. +loc_2E652:
  3775. + mov r9d, 1
  3776. + shl r9d, cl
  3777. +
  3778. +loc_2E65B:
  3779. + mov ecx, [rbx+3Ch]
  3780. + cmp ecx, 20h
  3781. + jl short loc_2E668
  3782. + mov eax, r13d
  3783. + jmp short loc_2E66D
  3784. +
  3785. +loc_2E668:
  3786. + mov eax, [rbx+48h]
  3787. + shl eax, cl
  3788. +
  3789. +loc_2E66D:
  3790. + mov r8d, [rbx+38h]
  3791. + mov edx, [rbx+30h]
  3792. + dec r9d
  3793. + shl r9d, cl
  3794. + mov rcx, [rbx+20h]
  3795. + and r8d, eax
  3796. + call WriteSystemMem
  3797. + mov r11d, [rbx+30h]
  3798. + add [rbx+20h], r11
  3799. + mov rax, [rbx+20h]
  3800. + cmp rax, [rbx+28h]
  3801. + jnb loc_2E757
  3802. +
  3803. +loc_2E69C:
  3804. + mov r8d, [rbx+40h]
  3805. + mov edx, [rbx+3Ch]
  3806. + mov ecx, r8d
  3807. + shr dword ptr [rbx+48h], cl
  3808. + mov ecx, [rbx+54h]
  3809. + cmp ecx, edx
  3810. + jge short loc_2E6C9
  3811. + cmp ecx, 20h
  3812. + jb short loc_2E6BA
  3813. + mov eax, r13d
  3814. + jmp short loc_2E6C1
  3815. +
  3816. +loc_2E6BA:
  3817. + mov eax, 1
  3818. + shl eax, cl
  3819. +
  3820. +loc_2E6C1:
  3821. + dec eax
  3822. + and eax, [rbx+48h]
  3823. + mov [rbx+48h], eax
  3824. +
  3825. +loc_2E6C9:
  3826. + cmp edx, 20h
  3827. + jl short loc_2E6D3
  3828. + mov r9d, r13d
  3829. + jmp short loc_2E6DE
  3830. +
  3831. +loc_2E6D3:
  3832. + mov ecx, edx
  3833. + mov r9d, 1
  3834. + shl r9d, cl
  3835. +
  3836. +loc_2E6DE:
  3837. + mov edx, [rbx+30h]
  3838. + mov ecx, r8d
  3839. + mov r8d, [rbx+48h]
  3840. + dec r9d
  3841. + sar r9d, cl
  3842. + mov rcx, [rbx+20h]
  3843. + call WriteSystemMem
  3844. + mov eax, [rbx+30h]
  3845. + mov ecx, [rbx+50h]
  3846. + add [rbx+4Ch], eax
  3847. + inc dword ptr [rbx+44h]
  3848. + shl eax, 3
  3849. + sub ecx, eax
  3850. + mov eax, [rbx+44h]
  3851. + mov [rbx+50h], r13d
  3852. + add [rbx+54h], ecx
  3853. + cmp eax, [rbx+34h]
  3854. + jge short loc_2E757
  3855. + add dword ptr [rbx+8], 0FFFFFFFEh
  3856. + jmp loc_2E560
  3857. +
  3858. +loc_2E720:
  3859. + add dword ptr [rbx+8], 3
  3860. + jmp short loc_2E75A
  3861. +
  3862. +loc_2E726:
  3863. + mov rax, [rax+58h]
  3864. + lea rdx, WriteFieldObj
  3865. + mov rcx, r12
  3866. + mov r9, [rax]
  3867. + lea rax, [rbx+4Ch]
  3868. + mov dword ptr [rsp+28h], 4
  3869. + lea r8, [r9+38h]
  3870. + mov r9, [r9+58h]
  3871. + mov [rsp+20h], rax
  3872. + call PushAccFieldObj
  3873. + jmp short loc_2E764
  3874. +
  3875. +loc_2E757:
  3876. + inc dword ptr [rbx+8]
  3877. +
  3878. +loc_2E75A:
  3879. + mov rcx, r12
  3880. + call PopFrame
  3881. +
  3882. +loc_2E762:
  3883. + mov eax, edi
  3884. +
  3885. +loc_2E764:
  3886. + mov r13, [rsp+48h]
  3887. + mov r12, [rsp+50h]
  3888. + mov rdi, [rsp+78h]
  3889. + mov rsi, [rsp+70h]
  3890. + mov rbp, [rsp+68h]
  3891. + mov rbx, [rsp+60h]
  3892. + add rsp, 58h
  3893. + ret
  3894. +ReadFieldObj ENDP
  3895. +
  3896. +
  3897. +WriteFieldObj PROC
  3898. + sub rsp, 48h
  3899. + test r8d, r8d
  3900. + mov [rsp+50h], rbx
  3901. + mov [rsp+58h], rbp
  3902. + mov [rsp+68h], rdi
  3903. + mov rbx, rdx
  3904. + mov rbp, rcx
  3905. + mov edi, r8d
  3906. + jnz short loc_2E239
  3907. + mov eax, [rdx+8]
  3908. + and eax, 0Fh
  3909. + jmp short loc_2E23E
  3910. +
  3911. +loc_2E239:
  3912. + mov eax, 3
  3913. +
  3914. +loc_2E23E:
  3915. + mov [rsp+60h], rsi
  3916. + mov [rsp+40h], r12
  3917. + xor r12d, r12d
  3918. + test eax, eax
  3919. + jz short loc_2E26B
  3920. + dec eax
  3921. + jz short loc_2E299
  3922. + dec eax
  3923. + jz loc_2E3B1
  3924. + dec eax
  3925. + jz loc_2E414
  3926. + mov eax, r8d
  3927. + jmp loc_2E41E
  3928. +
  3929. +loc_2E26B:
  3930. + mov eax, [rbx+34h]
  3931. + cmp [rbx+44h], eax
  3932. + jge loc_2E3DA
  3933. + mov rax, [rbx+18h]
  3934. + inc dword ptr [rbx+8]
  3935. + cmp word ptr [rax+2], 5
  3936. + jnz short loc_2E299
  3937. + mov rax, [rax+20h]
  3938. + mov rax, [rax+10h]
  3939. + cmp word ptr [rax+3Ah], 84h
  3940. + jz loc_2E3E0
  3941. +
  3942. +loc_2E299:
  3943. + mov ecx, [rbx+30h]
  3944. + mov r10, [rbx+20h]
  3945. + inc dword ptr [rbx+8]
  3946. + mov edi, [rbx+38h]
  3947. + xor edx, edx
  3948. + mov rax, r10
  3949. + div rcx
  3950. + mov r9d, r12d
  3951. + mov [rsp+30h], r12d
  3952. + test rdx, rdx
  3953. + mov r8, rcx
  3954. + jz short loc_2E2D2
  3955. + lea rcx, [rsp+30h]
  3956. + mov rdx, r10
  3957. + call memcpy
  3958. + mov r9d, [rsp+30h]
  3959. + jmp short loc_2E2EE
  3960. +
  3961. +loc_2E2D2:
  3962. + dec ecx
  3963. + jz short loc_2E2EA
  3964. + dec ecx
  3965. + jz short loc_2E2E4
  3966. + cmp ecx, 2
  3967. + jnz short loc_2E2EE
  3968. + mov r9d, [r10]
  3969. + jmp short loc_2E2EE
  3970. +
  3971. +loc_2E2E4:
  3972. + movzx r9d, word ptr [r10]
  3973. + jmp short loc_2E2EE
  3974. +
  3975. +loc_2E2EA:
  3976. + movzx r9d, byte ptr [r10]
  3977. +
  3978. +loc_2E2EE:
  3979. + and r9d, edi
  3980. + cmp [rbx+44h], r12d
  3981. + jle short loc_2E373
  3982. + mov ecx, [rbx+3Ch]
  3983. + lea rdi, [rbx+48h]
  3984. + shr r9d, cl
  3985. + mov ecx, [rbx+30h]
  3986. + add [rbx+20h], rcx
  3987. + mov r10, [rbx+20h]
  3988. + mov [rdi], r9d
  3989. + cmp r10, [rbx+28h]
  3990. + jb short loc_2E31A
  3991. + mov r9d, r12d
  3992. + jmp short loc_2E37A
  3993. +
  3994. +loc_2E31A:
  3995. + mov esi, [rbx+38h]
  3996. + xor edx, edx
  3997. + mov rax, r10
  3998. + div rcx
  3999. + mov r9d, r12d
  4000. + mov [rsp+34h], r12d
  4001. + test rdx, rdx
  4002. + mov r8, rcx
  4003. + jz short loc_2E34C
  4004. + lea rcx, [rsp+34h]
  4005. + mov rdx, r10
  4006. + call memcpy
  4007. + mov r9d, [rsp+34h]
  4008. + and r9d, esi
  4009. + jmp short loc_2E37A
  4010. +
  4011. +loc_2E34C:
  4012. + dec ecx
  4013. + jz short loc_2E36A
  4014. + dec ecx
  4015. + jz short loc_2E361
  4016. + cmp ecx, 2
  4017. + jnz short loc_2E36E
  4018. + mov r9d, [r10]
  4019. + and r9d, esi
  4020. + jmp short loc_2E37A
  4021. +
  4022. +loc_2E361:
  4023. + movzx r9d, word ptr [r10]
  4024. + and r9d, esi
  4025. + jmp short loc_2E37A
  4026. +
  4027. +loc_2E36A:
  4028. + movzx r9d, byte ptr [r10]
  4029. +
  4030. +loc_2E36E:
  4031. + and r9d, esi
  4032. + jmp short loc_2E37A
  4033. +
  4034. +loc_2E373:
  4035. + lea rdi, [rbx+48h]
  4036. + mov [rdi], r12d
  4037. +
  4038. +loc_2E37A:
  4039. + mov ecx, [rbx+40h]
  4040. + mov rdx, [rbx+18h]
  4041. + lea r8, [rbx+4Ch]
  4042. + shl r9d, cl
  4043. + mov rcx, rbp
  4044. + mov [rsp+20h], r12b
  4045. + and r9d, [rbx+38h]
  4046. + or [rdi], r9d
  4047. + mov r9, rdi
  4048. + call AccessFieldData
  4049. + cmp eax, 8004h
  4050. + mov edi, eax
  4051. + jz short loc_2E41E
  4052. + cmp rbx, [rbp+170h]
  4053. + jnz short loc_2E41E
  4054. +
  4055. +loc_2E3B1:
  4056. + mov eax, [rbx+30h]
  4057. + mov ecx, [rbx+50h]
  4058. + inc dword ptr [rbx+44h]
  4059. + add [rbx+4Ch], eax
  4060. + shl eax, 3
  4061. + mov [rbx+50h], r12d
  4062. + sub ecx, eax
  4063. + mov eax, [rbx+44h]
  4064. + add [rbx+54h], ecx
  4065. + cmp eax, [rbx+34h]
  4066. + jge short loc_2E411
  4067. + add dword ptr [rbx+8], 0FFFFFFFEh
  4068. + jmp loc_2E26B
  4069. +
  4070. +loc_2E3DA:
  4071. + add dword ptr [rbx+8], 3
  4072. + jmp short loc_2E414
  4073. +
  4074. +loc_2E3E0:
  4075. + mov rax, [rax+58h]
  4076. + lea rdx, WriteFieldObj
  4077. + mov rcx, rbp
  4078. + mov r9, [rax]
  4079. + lea rax, [rbx+4Ch]
  4080. + mov dword ptr [rsp+28h], 4
  4081. + lea r8, [r9+38h]
  4082. + mov r9, [r9+58h]
  4083. + mov [rsp+20h], rax
  4084. + call PushAccFieldObj
  4085. + jmp short loc_2E41E
  4086. +
  4087. +loc_2E411:
  4088. + inc dword ptr [rbx+8]
  4089. +
  4090. +loc_2E414:
  4091. + mov rcx, rbp
  4092. + call PopFrame
  4093. + mov eax, edi
  4094. +
  4095. +loc_2E41E:
  4096. + mov r12, [rsp+40h]
  4097. + mov rdi, [rsp+68h]
  4098. + mov rsi, [rsp+60h]
  4099. + mov rbp, [rsp+58h]
  4100. + mov rbx, [rsp+50h]
  4101. + add rsp, 48h
  4102. + ret
  4103. +WriteFieldObj ENDP
  4104. +
  4105. +
  4106. +AccessBaseField PROC
  4107. + mov [rsp+10h], rdx
  4108. + mov [rsp+8], rcx
  4109. + mov rax, rsp
  4110. + sub rsp, 88h
  4111. + mov r10, [rdx+58h]
  4112. + mov [rax-8], rbx
  4113. + mov [rax-18h], rsi
  4114. + mov [rax-20h], rdi
  4115. + mov edi, [r8]
  4116. + mov [rax-28h], r12
  4117. + add rdi, [r10]
  4118. + mov r12, r9
  4119. + mov r9d, [r8+0Ch]
  4120. + mov ecx, r9d
  4121. + xor esi, esi
  4122. + and ecx, 0Fh
  4123. + cmp ecx, 1
  4124. + jb short loc_2DC44
  4125. + cmp ecx, 3
  4126. + ja short loc_2DC44
  4127. + mov eax, 1
  4128. + dec ecx
  4129. + mov ebx, eax
  4130. + shl ebx, cl
  4131. + jmp short loc_2DC4B
  4132. +
  4133. +loc_2DC44:
  4134. + mov eax, 1
  4135. + mov ebx, eax
  4136. +
  4137. +loc_2DC4B:
  4138. + mov ecx, [r8+8]
  4139. + mov [rsp+78h], rbp
  4140. + cmp ecx, 20h
  4141. + jb short loc_2DC5D
  4142. + mov ebp, esi
  4143. + jmp short loc_2DC61
  4144. +
  4145. +loc_2DC5D:
  4146. + mov ebp, eax
  4147. + shl ebp, cl
  4148. +
  4149. +loc_2DC61:
  4150. + mov ecx, [r8+4]
  4151. + dec ebp
  4152. + shl ebp, cl
  4153. + lea ecx, [rbx*8]
  4154. + cmp ecx, 20h
  4155. + jb short loc_2DC79
  4156. + mov eax, esi
  4157. + jmp short loc_2DC7B
  4158. +
  4159. +loc_2DC79:
  4160. + shl eax, cl
  4161. +
  4162. +loc_2DC7B:
  4163. + test r9b, 60h
  4164. + mov [rsp+50h], r14
  4165. + mov [rsp+48h], r15
  4166. + lea r14d, [rax-1]
  4167. + jnz short loc_2DC9D
  4168. + mov eax, ebp
  4169. + not eax
  4170. + test r14d, eax
  4171. + jz short loc_2DC9D
  4172. + mov r15b, 1
  4173. + jmp short loc_2DCA0
  4174. +
  4175. +loc_2DC9D:
  4176. + xor r15b, r15b
  4177. +
  4178. +loc_2DCA0:
  4179. + and [r12], ebp
  4180. + mov [rsp+58h], r13
  4181. + movzx r13d, byte ptr [rsp+0B0h]
  4182. + test r13b, r13b
  4183. + jnz short loc_2DCCD
  4184. + mov eax, [r8+0Ch]
  4185. + and al, 60h
  4186. + cmp al, 20h
  4187. + jnz short loc_2DCCD
  4188. + mov eax, ebp
  4189. + not eax
  4190. + or eax, [r12]
  4191. + mov [r12], eax
  4192. +
  4193. +loc_2DCCD:
  4194. + movzx ecx, byte ptr [r10+0Ch]
  4195. + test ecx, ecx
  4196. + mov edx, ecx
  4197. + jz loc_2DF06
  4198. + dec edx
  4199. + jz loc_2DE0D
  4200. + call FindRSAccess
  4201. + test rax, rax
  4202. + mov r14, rax
  4203. + jz loc_2DE03
  4204. + mov r10, [rax+10h]
  4205. + test r10, r10
  4206. + jz loc_2DE03
  4207. + test r13b, r13b
  4208. + jz short loc_2DD6C
  4209. + mov rax, [rsp+90h]
  4210. + mov rdx, [rsp+98h]
  4211. + mov r9d, ebx
  4212. + add rax, 148h
  4213. + mov r8, rdi
  4214. + xor ecx, ecx
  4215. + mov [rsp+38h], rax
  4216. + lea rax, RestartCtxtCallback
  4217. + mov [rsp+30h], rax
  4218. + mov rax, [r14+18h]
  4219. + mov [rsp+28h], rax
  4220. + mov [rsp+20h], r12
  4221. + call r10
  4222. + cmp eax, 103h
  4223. + mov esi, eax
  4224. + jnz short loc_2DD5A
  4225. + mov esi, 8004h
  4226. + jmp loc_2DF99
  4227. +
  4228. +loc_2DD5A:
  4229. + test eax, eax
  4230. + jz loc_2DF99
  4231. + mov esi, 0C0140018h
  4232. + jmp loc_2DF99
  4233. +
  4234. +loc_2DD6C:
  4235. + mov rcx, [rsp+90h]
  4236. + lea rax, [rsp+0A8h]
  4237. + lea r9, WriteCookAccess
  4238. + mov edx, 41435257h
  4239. + mov r8d, 40h
  4240. + mov [rsp+20h], rax
  4241. + call PushFrame
  4242. + test eax, eax
  4243. + mov esi, eax
  4244. + jnz loc_2DF99
  4245. + mov rax, [rsp+0A8h]
  4246. + mov rcx, [rsp+98h]
  4247. + mov [rax+18h], rcx
  4248. + mov rax, [rsp+0A8h]
  4249. + mov [rax+20h], r14
  4250. + mov rax, [rsp+0A8h]
  4251. + mov [rax+28h], edi
  4252. + mov rax, [rsp+0A8h]
  4253. + mov [rax+2Ch], ebx
  4254. + mov rax, [rsp+0A8h]
  4255. + mov ecx, [r12]
  4256. + mov [rax+30h], ecx
  4257. + mov rax, [rsp+0A8h]
  4258. + mov [rax+34h], ebp
  4259. + mov rax, [rsp+0A8h]
  4260. + mov [rax+3Ch], r15b
  4261. + jmp loc_2DF99
  4262. +
  4263. +loc_2DE03:
  4264. + mov esi, 0C0140010h
  4265. + jmp loc_2DF99
  4266. +
  4267. +loc_2DE0D:
  4268. + test r13b, r13b
  4269. + jz short loc_2DE84
  4270. + lea r9, [rsp+98h]
  4271. + mov r8d, ebx
  4272. + mov edx, edi
  4273. + mov cl, 1
  4274. + mov [rsp+98h], esi
  4275. + call CheckSystemIOAddressValidity
  4276. + test al, al
  4277. + jz short loc_2DE72
  4278. + dec ebx
  4279. + jz short loc_2DE60
  4280. + dec ebx
  4281. + jz short loc_2DE4D
  4282. + cmp ebx, 2
  4283. + jnz short loc_2DE72
  4284. + movzx edx, di
  4285. + in eax, dx
  4286. + and eax, ebp
  4287. + mov [r12], eax
  4288. + jmp loc_2DF99
  4289. +
  4290. +loc_2DE4D:
  4291. + movzx edx, di
  4292. + in ax, dx
  4293. + movzx eax, ax
  4294. + and eax, ebp
  4295. + mov [r12], eax
  4296. + jmp loc_2DF99
  4297. +
  4298. +loc_2DE60:
  4299. + movzx edx, di
  4300. + in al, dx
  4301. + movzx eax, al
  4302. + and eax, ebp
  4303. + mov [r12], eax
  4304. + jmp loc_2DF99
  4305. +
  4306. +loc_2DE72:
  4307. + mov eax, [rsp+98h]
  4308. + and eax, ebp
  4309. + mov [r12], eax
  4310. + jmp loc_2DF99
  4311. +
  4312. +loc_2DE84:
  4313. + test r15b, r15b
  4314. + jz short loc_2DE9B
  4315. + not ebp
  4316. + mov edx, ebx
  4317. + mov ecx, edi
  4318. + mov r8d, ebp
  4319. + call ReadSystemIO
  4320. + or [r12], eax
  4321. +
  4322. +loc_2DE9B:
  4323. + mov eax, [r12]
  4324. + lea r9, [rsp+0B0h]
  4325. + mov r8d, ebx
  4326. + mov edx, edi
  4327. + xor ecx, ecx
  4328. + mov [rsp+0B0h], eax
  4329. + call CheckSystemIOAddressValidity
  4330. + test al, al
  4331. + jz loc_2DF99
  4332. + dec ebx
  4333. + jz short loc_2DEF5
  4334. + dec ebx
  4335. + jz short loc_2DEE3
  4336. + cmp ebx, 2
  4337. + jnz loc_2DF99
  4338. + mov eax, [rsp+0B0h]
  4339. + movzx edx, di
  4340. + out dx, eax
  4341. + jmp loc_2DF99
  4342. +
  4343. +loc_2DEE3:
  4344. + movzx eax, word ptr [rsp+0B0h]
  4345. + movzx edx, di
  4346. + out dx, ax
  4347. + jmp loc_2DF99
  4348. +
  4349. +loc_2DEF5:
  4350. + movzx eax, byte ptr [rsp+0B0h]
  4351. + movzx edx, di
  4352. + out dx, al
  4353. + jmp loc_2DF99
  4354. +
  4355. +loc_2DF06:
  4356. + test r13b, r13b
  4357. + jz short loc_2DF70
  4358. + xor edx, edx
  4359. + mov r8d, ebx
  4360. + mov rax, rdi
  4361. + div r8
  4362. + mov ecx, esi
  4363. + mov [rsp+0A0h], esi
  4364. + test rdx, rdx
  4365. + jz short loc_2DF43
  4366. + lea rcx, [rsp+0A0h]
  4367. + mov rdx, rdi
  4368. + call memcpy
  4369. + mov ecx, [rsp+0A0h]
  4370. + and ecx, ebp
  4371. + mov [r12], ecx
  4372. + jmp short loc_2DF99
  4373. +
  4374. +loc_2DF43:
  4375. + dec ebx
  4376. + jz short loc_2DF65
  4377. + dec ebx
  4378. + jz short loc_2DF5A
  4379. + cmp ebx, 2
  4380. + jnz short loc_2DF68
  4381. + mov ecx, [rdi]
  4382. + and ecx, ebp
  4383. + mov [r12], ecx
  4384. + jmp short loc_2DF99
  4385. +
  4386. +loc_2DF5A:
  4387. + movzx ecx, word ptr [rdi]
  4388. + and ecx, ebp
  4389. + mov [r12], ecx
  4390. + jmp short loc_2DF99
  4391. +
  4392. +loc_2DF65:
  4393. + movzx ecx, byte ptr [rdi]
  4394. +
  4395. +loc_2DF68:
  4396. + and ecx, ebp
  4397. + mov [r12], ecx
  4398. + jmp short loc_2DF99
  4399. +
  4400. +loc_2DF70:
  4401. + test r15b, r15b
  4402. + jz short loc_2DF88
  4403. + not ebp
  4404. + mov edx, ebx
  4405. + mov rcx, rdi
  4406. + mov r8d, ebp
  4407. + call ReadSystemMem
  4408. + or [r12], eax
  4409. +
  4410. +loc_2DF88:
  4411. + mov r8d, [r12]
  4412. + mov r9d, r14d
  4413. + mov edx, ebx
  4414. + mov rcx, rdi
  4415. + call WriteSystemMem
  4416. +
  4417. +loc_2DF99:
  4418. + mov r15, [rsp+48h]
  4419. + mov r14, [rsp+50h]
  4420. + mov r13, [rsp+58h]
  4421. + mov r12, [rsp+60h]
  4422. + mov rdi, [rsp+68h]
  4423. + mov rbp, [rsp+78h]
  4424. + mov rbx, [rsp+80h]
  4425. + mov eax, esi
  4426. + mov rsi, [rsp+70h]
  4427. + add rsp, 88h
  4428. + ret
  4429. +AccessBaseField ENDP
  4430. +
  4431. +
  4432. +AccessFieldData PROC
  4433. + sub rsp, 58h
  4434. + cmp word ptr [rdx+2], 0Eh
  4435. + mov [rsp+50h], rbx
  4436. + mov [rsp+48h], rbp
  4437. + mov [rsp+40h], rsi
  4438. + mov [rsp+38h], rdi
  4439. + mov rax, rdx
  4440. + mov rdi, r8
  4441. + mov rsi, r9
  4442. + mov rbp, rcx
  4443. + jnz loc_2E0A9
  4444. + cmp byte ptr [rsp+80h], 0
  4445. + jz short loc_2E02D
  4446. + mov rcx, [rax+20h]
  4447. + mov r8, r9
  4448. + mov rdx, rdi
  4449. + call ReadBuffField
  4450. + jmp loc_2E1ED
  4451. +
  4452. +loc_2E02D:
  4453. + mov ecx, [r8+0Ch]
  4454. + mov rbp, [rdx+20h]
  4455. + xor ebx, ebx
  4456. + and ecx, 0Fh
  4457. + cmp ecx, 1
  4458. + jb short loc_2E053
  4459. + cmp ecx, 3
  4460. + ja short loc_2E053
  4461. + mov edx, 1
  4462. + dec ecx
  4463. + mov r10d, edx
  4464. + shl r10d, cl
  4465. + jmp short loc_2E05B
  4466. +
  4467. +loc_2E053:
  4468. + mov edx, 1
  4469. + mov r10d, edx
  4470. +
  4471. +loc_2E05B:
  4472. + mov r11d, [r8]
  4473. + lea eax, [r11+r10]
  4474. + cmp eax, [rbp+18h]
  4475. + ja short loc_2E09D
  4476. + mov ecx, [r8+8]
  4477. + cmp ecx, 20h
  4478. + jb short loc_2E074
  4479. + mov edx, ebx
  4480. + jmp short loc_2E076
  4481. +
  4482. +loc_2E074:
  4483. + shl edx, cl
  4484. +
  4485. +loc_2E076:
  4486. + mov ecx, [r8+4]
  4487. + lea r9d, [rdx-1]
  4488. + mov edx, r10d
  4489. + shl r9d, cl
  4490. + mov rcx, r11
  4491. + add rcx, [rbp+10h]
  4492. + mov r8d, r9d
  4493. + and r8d, [rsi]
  4494. + call WriteSystemMem
  4495. + mov eax, ebx
  4496. + jmp loc_2E1ED
  4497. +
  4498. +loc_2E09D:
  4499. + mov ebx, 0C0140004h
  4500. + mov eax, ebx
  4501. + jmp loc_2E1ED
  4502. +
  4503. +loc_2E0A9:
  4504. + mov rcx, [rdx+20h]
  4505. + xor ebx, ebx
  4506. + mov [rsp+68h], rbx
  4507. + mov rax, [rcx+10h]
  4508. + cmp word ptr [rax+3Ah], 84h
  4509. + jnz loc_2E1BB
  4510. + cmp [rsp+80h], bl
  4511. + mov r10, [rax+58h]
  4512. + jz short loc_2E0FE
  4513. + mov r9, [r10+8]
  4514. + lea rdx, ReadFieldObj
  4515. + mov rcx, rbp
  4516. + lea r8, [r9+38h]
  4517. + mov r9, [r9+58h]
  4518. + mov dword ptr [rsp+28h], 4
  4519. + mov [rsp+20h], rsi
  4520. + call PushAccFieldObj
  4521. + jmp loc_2E1ED
  4522. +
  4523. +loc_2E0FE:
  4524. + mov ecx, [r8+8]
  4525. + mov edx, 1
  4526. + cmp ecx, 20h
  4527. + jb short loc_2E110
  4528. + mov eax, ebx
  4529. + jmp short loc_2E114
  4530. +
  4531. +loc_2E110:
  4532. + mov eax, edx
  4533. + shl eax, cl
  4534. +
  4535. +loc_2E114:
  4536. + mov ecx, [r8+4]
  4537. + mov r11d, [r8+0Ch]
  4538. + lea r9d, [rax-1]
  4539. + shl r9d, cl
  4540. + mov r8d, r11d
  4541. + and r8d, 0Fh
  4542. + not r9d
  4543. + cmp r8d, edx
  4544. + jb short loc_2E142
  4545. + cmp r8d, 3
  4546. + ja short loc_2E142
  4547. + lea ecx, [r8-1]
  4548. + mov eax, edx
  4549. + shl eax, cl
  4550. + jmp short loc_2E144
  4551. +
  4552. +loc_2E142:
  4553. + mov eax, edx
  4554. +
  4555. +loc_2E144:
  4556. + shl eax, 3
  4557. + cmp eax, 20h
  4558. + jge short loc_2E16E
  4559. + cmp r8d, edx
  4560. + jb short loc_2E161
  4561. + cmp r8d, 3
  4562. + ja short loc_2E161
  4563. + lea ecx, [r8-1]
  4564. + mov eax, edx
  4565. + shl eax, cl
  4566. + jmp short loc_2E163
  4567. +
  4568. +loc_2E161:
  4569. + mov eax, edx
  4570. +
  4571. +loc_2E163:
  4572. + lea ecx, [rax*8]
  4573. + shl edx, cl
  4574. + mov ebx, edx
  4575. +
  4576. +loc_2E16E:
  4577. + test r11b, 60h
  4578. + jnz short loc_2E191
  4579. + lea eax, [rbx-1]
  4580. + test r9d, eax
  4581. + jz short loc_2E191
  4582. + mov rdx, [r10+8]
  4583. + mov r8d, [rsi]
  4584. + mov rcx, rbp
  4585. + add rdx, 38h
  4586. + call PushPreserveWriteObj
  4587. + jmp short loc_2E1ED
  4588. +
  4589. +loc_2E191:
  4590. + mov r9, [r10+8]
  4591. + lea rdx, WriteFieldObj
  4592. + mov rcx, rbp
  4593. + lea r8, [r9+38h]
  4594. + mov r9, [r9+58h]
  4595. + mov dword ptr [rsp+28h], 4
  4596. + mov [rsp+20h], rsi
  4597. + call PushAccFieldObj
  4598. + jmp short loc_2E1ED
  4599. +
  4600. +loc_2E1BB:
  4601. + lea rdx, [rsp+68h]
  4602. + call GetFieldUnitRegionObj
  4603. + test eax, eax
  4604. + jnz short loc_2E1ED
  4605. + mov rdx, [rsp+68h]
  4606. + test rdx, rdx
  4607. + jz short loc_2E1ED
  4608. + movzx eax, byte ptr [rsp+80h]
  4609. + mov r9, rsi
  4610. + mov r8, rdi
  4611. + mov rcx, rbp
  4612. + mov [rsp+20h], al
  4613. + call AccessBaseField
  4614. +
  4615. +loc_2E1ED:
  4616. + mov rdi, [rsp+38h]
  4617. + mov rsi, [rsp+40h]
  4618. + mov rbp, [rsp+48h]
  4619. + mov rbx, [rsp+50h]
  4620. + add rsp, 58h
  4621. + ret
  4622. +AccessFieldData ENDP
  4623. +
  4624. +ACPIGetConvertToHardwareID PROC
  4625. + mov r11, rsp
  4626. + sub rsp, 78h
  4627. + mov [r11-8], rbx
  4628. + mov [r11-10h], rbp
  4629. + mov [r11-18h], rsi
  4630. + mov [r11-20h], rdi
  4631. + mov [r11-28h], r12
  4632. + mov [r11-30h], r13
  4633. + mov eax, r9d
  4634. + xor r13b, r13b
  4635. + mov [r11-38h], r14
  4636. + and eax, 8000000h
  4637. + mov esi, r9d
  4638. + mov rdi, r8
  4639. + mov rbp, rcx
  4640. + jnz loc_1FAE7
  4641. + mov rcx, 1000000000h
  4642. + test [rbp+0], rcx
  4643. + jz loc_1FAE7
  4644. + lea rax, [r11+10h]
  4645. + mov rcx, rbp
  4646. + mov [r11-50h], rax
  4647. + lea rax, [r11-48h]
  4648. + mov [r11-58h], rax
  4649. + call ACPIGetProcessorID
  4650. + test eax, eax
  4651. + mov edi, eax
  4652. + js short loc_1FABD
  4653. + mov ebp, [rsp+88h]
  4654. + mov rdi, [rsp+30h]
  4655. + mov rbx, [rsp+30h]
  4656. +
  4657. +loc_1FA90:
  4658. + mov rax, [rsp+0A0h]
  4659. + mov [rax], rdi
  4660. + mov rax, [rsp+0A8h]
  4661. + test rax, rax
  4662. + jz short loc_1FAAA
  4663. + mov [rax], ebp
  4664. +
  4665. +loc_1FAAA:
  4666. + xor edi, edi
  4667. +
  4668. +loc_1FAAC:
  4669. + cmp r13b, 1
  4670. + jnz short loc_1FABD
  4671. + xor edx, edx
  4672. + mov rcx, rbx
  4673. + callex ExFreePoolWithTag
  4674. +
  4675. +loc_1FABD:
  4676. + mov eax, edi
  4677. +
  4678. +loc_1FABF:
  4679. + mov r14, [rsp+40h]
  4680. + mov r13, [rsp+48h]
  4681. + mov r12, [rsp+50h]
  4682. + mov rdi, [rsp+58h]
  4683. + mov rsi, [rsp+60h]
  4684. + mov rbp, [rsp+68h]
  4685. + mov rbx, [rsp+70h]
  4686. + add rsp, 78h
  4687. + ret
  4688. +
  4689. +loc_1FAE7:
  4690. + test eax, eax
  4691. + jnz loc_1FB71
  4692. + mov rcx, 800000000000h
  4693. + test [rbp+0], rcx
  4694. + jz short loc_1FB71
  4695. + mov rdi, [rbp+1B0h]
  4696. + mov rcx, 0FFFFFFFFFFFFFFFFh
  4697. + mov r8d, 53706341h
  4698. + repne scasb
  4699. + not rcx
  4700. + lea r12, [rcx-1]
  4701. + mov ecx, r9d
  4702. + shr ecx, 1Ch
  4703. + add r12d, 0FFFFFFFCh
  4704. + not ecx
  4705. + mov edx, r12d
  4706. + mov edi, r12d
  4707. + and ecx, 1
  4708. + callex ExAllocatePoolWithTag
  4709. + test rax, rax
  4710. + mov rbx, rax
  4711. + jz loc_1FC4A
  4712. + mov r8, rdi
  4713. + xor edx, edx
  4714. + mov rcx, rax
  4715. + call memset
  4716. + mov rdx, [rbp+1B0h]
  4717. + lea r8d, [r12-1]
  4718. + add rdx, 5
  4719. + mov rcx, rbx
  4720. + mov r13b, 1
  4721. + callex strncpy
  4722. + jmp loc_1FC6A
  4723. +
  4724. +loc_1FB71:
  4725. + test eax, eax
  4726. + jnz short loc_1FBDE
  4727. + mov rax, 4000000000h
  4728. + test [rbp+0], rax
  4729. + jz short loc_1FBDE
  4730. + mov ecx, r9d
  4731. + mov r12d, 0Dh
  4732. + mov r8d, 53706341h
  4733. + shr ecx, 1Ch
  4734. + mov rdx, r12
  4735. + not ecx
  4736. + and ecx, 1
  4737. + callex ExAllocatePoolWithTag
  4738. + test rax, rax
  4739. + mov rbx, rax
  4740. + jnz short loc_1FBB7
  4741. + mov eax, 0C000009Ah
  4742. + jmp loc_1FABF
  4743. +
  4744. +loc_1FBB7:
  4745. + xor eax, eax
  4746. + lea rdx, asmPciBarName
  4747. + mov rcx, rbx
  4748. + mov [rbx], rax
  4749. + mov [rbx+8], eax
  4750. + lea r8d, [rax+0Ch]
  4751. + mov [rbx+0Ch], al
  4752. + mov r13b, 1
  4753. + callex strncpy
  4754. + jmp loc_1FC6A
  4755. +
  4756. +loc_1FBDE:
  4757. + test edx, edx
  4758. + jns short loc_1FBE9
  4759. + mov eax, edx
  4760. + jmp loc_1FABF
  4761. +
  4762. +loc_1FBE9:
  4763. + movzx ecx, word ptr [r8+2]
  4764. + dec ecx
  4765. + jz short loc_1FC22
  4766. + dec ecx
  4767. + jz short loc_1FC00
  4768. + mov eax, 0C014000Fh
  4769. + jmp loc_1FABF
  4770. +
  4771. +loc_1FC00:
  4772. + mov rbx, [r8+20h]
  4773. + cmp byte ptr [rbx], 2Ah
  4774. + jnz short loc_1FC0C
  4775. + inc rbx
  4776. +
  4777. +loc_1FC0C:
  4778. + xor eax, eax
  4779. + mov rcx, 0FFFFFFFFFFFFFFFFh
  4780. + mov rdi, rbx
  4781. + repne scasb
  4782. + not rcx
  4783. + mov r12d, ecx
  4784. + jmp short loc_1FC6A
  4785. +
  4786. +loc_1FC22:
  4787. + mov ecx, r9d
  4788. + mov r12d, 8
  4789. + mov r8d, 53706341h
  4790. + shr ecx, 1Ch
  4791. + mov rdx, r12
  4792. + not ecx
  4793. + and ecx, 1
  4794. + callex ExAllocatePoolWithTag
  4795. + test rax, rax
  4796. + mov rbx, rax
  4797. + jnz short loc_1FC54
  4798. +
  4799. +loc_1FC4A:
  4800. + mov edi, 0C000009Ah
  4801. + jmp loc_1FABD
  4802. +
  4803. +loc_1FC54:
  4804. + xor eax, eax
  4805. + xor r8d, r8d
  4806. + mov rcx, rbx
  4807. + mov [rbx], rax
  4808. + mov edx, [rdi+10h]
  4809. + mov r13b, 1
  4810. + call ACPIAmliDoubleToName
  4811. +
  4812. +loc_1FC6A:
  4813. + shr esi, 1Ch
  4814. + lea ebp, [r12+r12+7]
  4815. + mov r8d, 53706341h
  4816. + not esi
  4817. + mov edx, ebp
  4818. + mov r14d, ebp
  4819. + and esi, 1
  4820. + mov ecx, esi
  4821. + callex ExAllocatePoolWithTag
  4822. + test rax, rax
  4823. + mov rdi, rax
  4824. + jnz short loc_1FC9C
  4825. + mov edi, 0C000009Ah
  4826. + jmp loc_1FAAC
  4827. +
  4828. +loc_1FC9C:
  4829. + mov r8, r14
  4830. + xor edx, edx
  4831. + mov rcx, rax
  4832. +
  4833. +loc_1FCA4:
  4834. + call memset
  4835. + lea rdx, asmACPI2Name
  4836. + mov r8, rbx
  4837. + mov rcx, rdi
  4838. + callex sprintf
  4839. + lea ecx, [r12+5]
  4840. + lea rdx, asmStar2Name
  4841. + add rcx, rdi
  4842. + mov r8, rbx
  4843. + callex sprintf
  4844. + jmp loc_1FA90
  4845. +ACPIGetConvertToHardwareID ENDP
  4846. +
  4847. +
  4848. +ACPIGetConvertToHardwareIDWide PROC
  4849. + mov r11, rsp
  4850. + sub rsp, 78h
  4851. + mov [r11-8], rbx
  4852. + mov [r11-10h], rbp
  4853. + mov [r11-18h], rsi
  4854. + mov [r11-20h], rdi
  4855. + mov [r11-28h], r12
  4856. + mov [r11-30h], r13
  4857. + mov eax, r9d
  4858. + xor r13b, r13b
  4859. + mov [r11-38h], r14
  4860. + and eax, 8000000h
  4861. + mov esi, r9d
  4862. + mov rdi, r8
  4863. + mov rbp, rcx
  4864. + jnz loc_1FDBB
  4865. + mov rcx, 1000000000h
  4866. + test [rbp+0], rcx
  4867. + jz loc_1FDBB
  4868. + lea rax, [r11+10h]
  4869. + mov rcx, rbp
  4870. + mov [r11-50h], rax
  4871. + lea rax, [r11-48h]
  4872. + mov [r11-58h], rax
  4873. + call ACPIGetProcessorIDWide
  4874. + test eax, eax
  4875. + mov edi, eax
  4876. + js short loc_1FD91
  4877. + mov ebp, [rsp+88h]
  4878. + mov rdi, [rsp+30h]
  4879. + mov rbx, [rsp+30h]
  4880. +
  4881. +loc_1FD60:
  4882. + mov rax, [rsp+0A0h]
  4883. + mov rcx, [rsp+0A8h]
  4884. + test rcx, rcx
  4885. + mov [rax], rdi
  4886. + jz short loc_1FD7E
  4887. + lea eax, [rbp+rbp+0]
  4888. + mov [rcx], eax
  4889. +
  4890. +loc_1FD7E:
  4891. + xor edi, edi
  4892. +
  4893. +loc_1FD80:
  4894. + cmp r13b, 1
  4895. + jnz short loc_1FD91
  4896. + xor edx, edx
  4897. + mov rcx, rbx
  4898. + callex ExFreePoolWithTag
  4899. +
  4900. +loc_1FD91:
  4901. + mov eax, edi
  4902. +
  4903. +loc_1FD93:
  4904. + mov r14, [rsp+40h]
  4905. + mov r13, [rsp+48h]
  4906. + mov r12, [rsp+50h]
  4907. + mov rdi, [rsp+58h]
  4908. + mov rsi, [rsp+60h]
  4909. + mov rbp, [rsp+68h]
  4910. + mov rbx, [rsp+70h]
  4911. + add rsp, 78h
  4912. + ret
  4913. +
  4914. +loc_1FDBB:
  4915. + test eax, eax
  4916. + jnz loc_1FE45
  4917. + mov rcx, 800000000000h
  4918. + test [rbp+0], rcx
  4919. + jz short loc_1FE45
  4920. + mov rdi, [rbp+1B0h]
  4921. + mov rcx, 0FFFFFFFFFFFFFFFFh
  4922. + mov r8d, 53706341h
  4923. + repne scasb
  4924. + not rcx
  4925. + lea r12, [rcx-1]
  4926. + mov ecx, r9d
  4927. + shr ecx, 1Ch
  4928. + add r12d, 0FFFFFFFCh
  4929. + not ecx
  4930. + mov edx, r12d
  4931. + mov edi, r12d
  4932. + and ecx, 1
  4933. + callex ExAllocatePoolWithTag
  4934. + test rax, rax
  4935. + mov rbx, rax
  4936. + jz loc_1FF1E
  4937. + mov r8, rdi
  4938. + xor edx, edx
  4939. + mov rcx, rax
  4940. + call memset
  4941. + mov rdx, [rbp+1B0h]
  4942. + lea r8d, [r12-1]
  4943. + add rdx, 5
  4944. + mov rcx, rbx
  4945. + mov r13b, 1
  4946. + callex strncpy
  4947. + jmp loc_1FF3E
  4948. +
  4949. +loc_1FE45:
  4950. + test eax, eax
  4951. + jnz short loc_1FEB2
  4952. + mov rax, 4000000000h
  4953. + test [rbp+0], rax
  4954. + jz short loc_1FEB2
  4955. + mov ecx, r9d
  4956. + mov r12d, 0Dh
  4957. + mov r8d, 53706341h
  4958. + shr ecx, 1Ch
  4959. + mov rdx, r12
  4960. + not ecx
  4961. + and ecx, 1
  4962. + callex ExAllocatePoolWithTag
  4963. + test rax, rax
  4964. + mov rbx, rax
  4965. + jnz short loc_1FE8B
  4966. + mov eax, 0C000009Ah
  4967. + jmp loc_1FD93
  4968. +
  4969. +loc_1FE8B:
  4970. + xor eax, eax
  4971. + lea rdx, asmPciBarName
  4972. + mov rcx, rbx
  4973. + mov [rbx], rax
  4974. + mov [rbx+8], eax
  4975. + lea r8d, [rax+0Ch]
  4976. + mov [rbx+0Ch], al
  4977. + mov r13b, 1
  4978. + callex strncpy
  4979. + jmp loc_1FF3E
  4980. +
  4981. +loc_1FEB2:
  4982. + test edx, edx
  4983. + jns short loc_1FEBD
  4984. + mov eax, edx
  4985. + jmp loc_1FD93
  4986. +
  4987. +loc_1FEBD:
  4988. + movzx ecx, word ptr [r8+2]
  4989. + dec ecx
  4990. + jz short loc_1FEF6
  4991. + dec ecx
  4992. + jz short loc_1FED4
  4993. + mov eax, 0C014000Fh
  4994. + jmp loc_1FD93
  4995. +
  4996. +loc_1FED4:
  4997. + mov rbx, [r8+20h]
  4998. + cmp byte ptr [rbx], 2Ah
  4999. + jnz short loc_1FEE0
  5000. + inc rbx
  5001. +
  5002. +loc_1FEE0:
  5003. + xor eax, eax
  5004. + mov rcx, 0FFFFFFFFFFFFFFFFh
  5005. + mov rdi, rbx
  5006. + repne scasb
  5007. + not rcx
  5008. + mov r12d, ecx
  5009. + jmp short loc_1FF3E
  5010. +
  5011. +loc_1FEF6:
  5012. + mov ecx, r9d
  5013. + mov r12d, 8
  5014. + mov r8d, 53706341h
  5015. + shr ecx, 1Ch
  5016. + mov rdx, r12
  5017. + not ecx
  5018. + and ecx, 1
  5019. + callex ExAllocatePoolWithTag
  5020. + test rax, rax
  5021. + mov rbx, rax
  5022. + jnz short loc_1FF28
  5023. +
  5024. +loc_1FF1E:
  5025. + mov edi, 0C000009Ah
  5026. + jmp loc_1FD91
  5027. +
  5028. +loc_1FF28:
  5029. + xor eax, eax
  5030. + xor r8d, r8d
  5031. + mov rcx, rbx
  5032. + mov [rbx], rax
  5033. + mov edx, [rdi+10h]
  5034. + mov r13b, 1
  5035. + call ACPIAmliDoubleToName
  5036. +
  5037. +loc_1FF3E:
  5038. + shr esi, 1Ch
  5039. + lea ebp, [r12+r12+7]
  5040. + mov r8d, 53706341h
  5041. + mov r14d, ebp
  5042. + not esi
  5043. + add r14, r14
  5044. + and esi, 1
  5045. + mov rdx, r14
  5046. + mov ecx, esi
  5047. + callex ExAllocatePoolWithTag
  5048. + test rax, rax
  5049. + mov rdi, rax
  5050. + jnz short loc_1FF74
  5051. + mov edi, 0C000009Ah
  5052. + jmp loc_1FD80
  5053. +
  5054. +loc_1FF74:
  5055. + mov r8, r14
  5056. + xor edx, edx
  5057. + mov rcx, rax
  5058. + call memset
  5059. + lea rdx, asmACPI2NameL
  5060. + mov r8, rbx
  5061. + mov rcx, rdi
  5062. + callex swprintf
  5063. + lea edx, [r12+5]
  5064. + mov r8, rbx
  5065. + lea rcx, [rdi+rdx*2]
  5066. + lea rdx, asmStar2NameL
  5067. + callex swprintf
  5068. + jmp loc_1FD60
  5069. +ACPIGetConvertToHardwareIDWide ENDP
  5070. +
  5071. +
  5072. +ACPIDevicePowerProcessPhase3 PROC
  5073. + mov rax, rsp
  5074. + sub rsp, 68h
  5075. + mov [rax+8], rbx
  5076. + mov [rax+10h], rbp
  5077. + mov [rax+18h], rsi
  5078. + mov [rax+20h], rdi
  5079. + mov [rax-8], r12
  5080. + mov [rax-10h], r13
  5081. + mov [rax-18h], r14
  5082. + lea rcx, AcpiPowerLock
  5083. + xor r13b, r13b
  5084. + mov [rax-20h], r15
  5085. + callex KeAcquireSpinLockAtDpcLevel
  5086. + mov r12, [AcpiPowerNodeList]
  5087. + lea rdi, AcpiPowerNodeList
  5088. + mov r9d, 4
  5089. + xor r15d, r15d
  5090. + cmp r12, rdi
  5091. + lea edx, [r9-3]
  5092. + jz loc_194F3
  5093. + lea r14, ACPIDeviceCompletePhase3On
  5094. +
  5095. +loc_19352:
  5096. + mov rsi, r12
  5097. + mov r12, [r12]
  5098. + test byte ptr [rsi+10h], 2
  5099. + jz loc_194E1
  5100. + mov eax, 3
  5101. + lock cmpxchg [rsi+40h], r9d
  5102. + jnz loc_194E1
  5103. + mov r10, [rsi+30h]
  5104. + lea r11, [rsi+30h]
  5105. + mov r8d, r15d
  5106. + cmp r10, r11
  5107. + jz short loc_193CD
  5108. +
  5109. + ALIGN16
  5110. +loc_19390:
  5111. + mov rdx, [r10-8]
  5112. + lea r9, [r10-28h]
  5113. + mov r10, [r10]
  5114. + xor eax, eax
  5115. + lock cmpxchg [rdx+17Ch], r15d
  5116. + mov ecx, [r9+14h]
  5117. + cmp [rdx+178h], ecx
  5118. + jz short loc_193BC
  5119. + test eax, eax
  5120. + jz short loc_193BF
  5121. + cmp [r9+18h], r15b
  5122. + jz short loc_193BF
  5123. +
  5124. +loc_193BC:
  5125. + inc r8d
  5126. +
  5127. +loc_193BF:
  5128. + cmp r10, r11
  5129. + jnz short loc_19390
  5130. + mov edx, 1
  5131. + lea r9d, [rdx+3]
  5132. +
  5133. +loc_193CD:
  5134. + mov eax, r8d
  5135. + xchg eax, [rsi+18h]
  5136. + mov rcx, [rsi+10h]
  5137. + test rcx, 440h
  5138. + jnz loc_194E1
  5139. + test rcx, 220h
  5140. + jnz short loc_193F6
  5141. + test r8d, r8d
  5142. + jz loc_194E1
  5143. +
  5144. +loc_193F6:
  5145. + mov eax, r9d
  5146. + lock cmpxchg [rsi+40h], edx
  5147. + lea rcx, AcpiPowerLock
  5148. + callex KeReleaseSpinLockFromDpcLevel
  5149. + mov rcx, [rsi+48h]
  5150. + xor r9d, r9d
  5151. + xor r8d, r8d
  5152. + xor edx, edx
  5153. + mov [rsp+28h], rsi
  5154. + mov [rsp+20h], r14
  5155. + call AMLIAsyncEvalObject
  5156. + cmp eax, 103h
  5157. + mov ebx, eax
  5158. + jz loc_194D1
  5159. + lea rcx, AcpiPowerLock
  5160. + callex KeAcquireSpinLockRaiseToDpc
  5161. + test ebx, ebx
  5162. + movzx edi, al
  5163. + js short loc_19459
  5164. + xor r8d, r8d
  5165. + lea rcx, [rsi+10h]
  5166. + lea edx, [r8+10h]
  5167. + call ACPIInternalUpdateFlags
  5168. + jmp short loc_1946A
  5169. +
  5170. +loc_19459:
  5171. + lea rcx, [rsi+10h]
  5172. + xor r8d, r8d
  5173. + mov edx, 10000h
  5174. + call ACPIInternalUpdateFlags
  5175. +
  5176. +loc_1946A:
  5177. + lea rcx, AcpiPowerLock
  5178. + movzx edx, dil
  5179. + callex KeReleaseSpinLock
  5180. + mov eax, 1
  5181. + lock cmpxchg [rsi+40h], r15d
  5182. + lea rcx, AcpiPowerQueueLock
  5183. + callex KeAcquireSpinLockRaiseToDpc
  5184. + cmp [AcpiPowerDpcRunning], r15b
  5185. + mov [AcpiPowerWorkDone], 1
  5186. + movzx ebx, al
  5187. + jnz short loc_194B8
  5188. + lea rcx, AcpiPowerDpc
  5189. + xor r8d, r8d
  5190. + xor edx, edx
  5191. + callex KeInsertQueueDpc
  5192. +
  5193. +loc_194B8:
  5194. + lea rcx, AcpiPowerQueueLock
  5195. + movzx edx, bl
  5196. + callex KeReleaseSpinLock
  5197. + lea rdi, AcpiPowerNodeList
  5198. + jmp short loc_194D4
  5199. +
  5200. +loc_194D1:
  5201. + mov r13b, 1
  5202. +
  5203. +loc_194D4:
  5204. + lea rcx, AcpiPowerLock
  5205. + callex KeAcquireSpinLockAtDpcLevel
  5206. +
  5207. +loc_194E1:
  5208. + cmp r12, rdi
  5209. + mov edx, 1
  5210. + lea r9d, [rdx+3]
  5211. + jnz loc_19352
  5212. +
  5213. +loc_194F3:
  5214. + mov rsi, [AcpiPowerNodeList+8] ; Blink
  5215. + cmp rsi, rdi
  5216. + jz loc_19643
  5217. + lea r14, ACPIDeviceCompletePhase3Off
  5218. + lea rax, AcpiPowerNodeList
  5219. +
  5220. +loc_19511:
  5221. + mov rbx, rsi
  5222. + mov rsi, [rsi+8]
  5223. + test byte ptr [rbx+10h], 2
  5224. + jz loc_19631
  5225. + mov eax, r9d
  5226. + lock cmpxchg [rbx+40h], edx
  5227. + jz short loc_19543
  5228. + test eax, eax
  5229. + jz loc_1962A
  5230. + mov r13b, 1
  5231. + lea rax, AcpiPowerNodeList
  5232. + jmp loc_19631
  5233. +
  5234. +loc_19543:
  5235. + lea rcx, AcpiPowerLock
  5236. + callex KeReleaseSpinLockFromDpcLevel
  5237. + mov rcx, [rbx+50h]
  5238. + xor r9d, r9d
  5239. + xor r8d, r8d
  5240. + xor edx, edx
  5241. + mov [rsp+28h], rbx
  5242. + mov [rsp+20h], r14
  5243. + call AMLIAsyncEvalObject
  5244. + cmp eax, 103h
  5245. + mov ebp, eax
  5246. + jz loc_19611
  5247. + lea rcx, AcpiPowerLock
  5248. + callex KeAcquireSpinLockRaiseToDpc
  5249. + test ebp, ebp
  5250. + movzx r12d, al
  5251. + js short loc_195A0
  5252. + lea rcx, [rbx+10h]
  5253. + mov r8b, 1
  5254. + mov edx, 10h
  5255. + call ACPIInternalUpdateFlags
  5256. + jmp short loc_195B1
  5257. +
  5258. +loc_195A0:
  5259. + lea rcx, [rbx+10h]
  5260. + xor r8d, r8d
  5261. + mov edx, 10000h
  5262. + call ACPIInternalUpdateFlags
  5263. +
  5264. +loc_195B1:
  5265. + lea rcx, AcpiPowerLock
  5266. + movzx edx, r12b
  5267. + callex KeReleaseSpinLock
  5268. + mov eax, 1
  5269. + lock cmpxchg [rbx+40h], r15d
  5270. + lea rcx, AcpiPowerQueueLock
  5271. + callex KeAcquireSpinLockRaiseToDpc
  5272. + cmp [AcpiPowerDpcRunning], r15b
  5273. + mov [AcpiPowerWorkDone], 1
  5274. + movzx ebx, al
  5275. + jnz short loc_195FF
  5276. + lea rcx, AcpiPowerDpc
  5277. + xor r8d, r8d
  5278. + xor edx, edx
  5279. + callex KeInsertQueueDpc
  5280. +
  5281. +loc_195FF:
  5282. + lea rcx, AcpiPowerQueueLock
  5283. + movzx edx, bl
  5284. + callex KeReleaseSpinLock
  5285. + jmp short loc_19614
  5286. +
  5287. +loc_19611:
  5288. + mov r13b, 1
  5289. +
  5290. +loc_19614:
  5291. + lea rcx, AcpiPowerLock
  5292. + callex KeAcquireSpinLockAtDpcLevel
  5293. + lea rax, AcpiPowerNodeList
  5294. + jmp short loc_19631
  5295. +
  5296. +loc_1962A:
  5297. + lea rax, AcpiPowerNodeList
  5298. +
  5299. +loc_19631:
  5300. + cmp rsi, rax
  5301. + mov edx, 1
  5302. + lea r9d, [rdx+3]
  5303. + jnz loc_19511
  5304. +
  5305. +loc_19643:
  5306. + lea rcx, AcpiPowerLock
  5307. + callex KeReleaseSpinLockFromDpcLevel
  5308. + mov r15, [rsp+48h]
  5309. + mov r14, [rsp+50h]
  5310. + mov r12, [rsp+60h]
  5311. + mov rdi, [rsp+88h]
  5312. + mov rsi, [rsp+80h]
  5313. + mov rbp, [rsp+78h]
  5314. + mov rbx, [rsp+70h]
  5315. + neg r13b
  5316. + mov r13, [rsp+58h]
  5317. + sbb eax, eax
  5318. + and eax, 103h
  5319. + add rsp, 68h
  5320. + ret
  5321. +ACPIDevicePowerProcessPhase3 ENDP
  5322. +
  5323. +
  5324. +OSNotifyDeviceCheck PROC
  5325. + sub rsp, 28h
  5326. + mov [rsp+40h], rbx
  5327. + mov [rsp+48h], rdi
  5328. + mov rbx, rcx
  5329. + call ACPIDockIsDockDevice
  5330. + test al, al
  5331. + jz short loc_24C89
  5332. + mov rdi, [rbx+60h]
  5333. + mov rcx, rbx
  5334. + call ACPIDockIsDockDevice
  5335. + test al, al
  5336. + jz short loc_24C59
  5337. + mov rcx, rdi
  5338. + call ACPIDockFindCorrespondingDock
  5339. + test rax, rax
  5340. + mov rdi, rax
  5341. + jnz short loc_24C62
  5342. + mov rdi, [rsp+48h]
  5343. + mov rbx, [rsp+40h]
  5344. + add rsp, 28h
  5345. + ret
  5346. +
  5347. +loc_24C59:
  5348. + test rdi, rdi
  5349. + jz loc_24D03
  5350. +
  5351. +loc_24C62:
  5352. + test byte ptr [rdi], 8
  5353. + jnz loc_24D03
  5354. + mov rcx, [rdi+200h]
  5355. + callex IoRequestDeviceEject
  5356. + xor eax, eax
  5357. + mov rdi, [rsp+48h]
  5358. + mov rbx, [rsp+40h]
  5359. + add rsp, 28h
  5360. + ret
  5361. +
  5362. +loc_24C89:
  5363. + lea rcx, AcpiDeviceTreeLock
  5364. + callex KeAcquireSpinLockRaiseToDpc
  5365. + movzx edi, al
  5366. +
  5367. + ALIGN16
  5368. +loc_24CA0:
  5369. + mov rcx, [rbx+60h]
  5370. + mov rbx, [rbx+10h]
  5371. + test rcx, rcx
  5372. + jz short loc_24CB8
  5373. + cmp dword ptr [rcx+8], 5F534750h
  5374. + jz short loc_24CC2
  5375. + xor ecx, ecx
  5376. +
  5377. +loc_24CB8:
  5378. + test rbx, rbx
  5379. + jnz short loc_24CA0
  5380. + test rcx, rcx
  5381. + jz short loc_24CF2
  5382. +
  5383. +loc_24CC2:
  5384. + mov rcx, [rcx+208h]
  5385. + test rcx, rcx
  5386. + jz short loc_24CF2
  5387. + xchg ax, ax
  5388. +
  5389. +loc_24CD0:
  5390. + test byte ptr [rcx], 8
  5391. + jz short loc_24CE3
  5392. + mov rcx, [rcx+208h]
  5393. + test rcx, rcx
  5394. + jnz short loc_24CD0
  5395. + jmp short loc_24CF2
  5396. +
  5397. +loc_24CE3:
  5398. + mov rcx, [rcx+200h]
  5399. + xor edx, edx
  5400. + callex IoInvalidateDeviceRelations
  5401. +
  5402. +loc_24CF2:
  5403. + lea rcx, AcpiDeviceTreeLock
  5404. + movzx edx, dil
  5405. + callex KeReleaseSpinLock
  5406. +
  5407. +loc_24D03:
  5408. + mov rdi, [rsp+48h]
  5409. + mov rbx, [rsp+40h]
  5410. + xor eax, eax
  5411. + add rsp, 28h
  5412. + ret
  5413. +OSNotifyDeviceCheck ENDP
  5414. +
  5415. +
  5416. +AcpiArblibReferenceArbiter PROC
  5417. + lock inc dword ptr [rcx+50h]
  5418. + ret
  5419. +AcpiArblibReferenceArbiter ENDP
  5420. +
  5421. +
  5422. +AcpiArblibDereferenceArbiter PROC
  5423. + lock dec dword ptr [rcx+50h]
  5424. + ret
  5425. +AcpiArblibDereferenceArbiter ENDP
  5426. +
  5427. +
  5428. +AcpiArblibEjectInterface PROC
  5429. + push rbx
  5430. + sub rsp, 20h
  5431. + mov rbx, rdx
  5432. + call ACPIInternalGetDeviceExtension
  5433. + mov r8, [rbx+0B8h]
  5434. + cmp word ptr [r8+12h], 0
  5435. + mov ecx, [r8+20h]
  5436. + mov rdx, [r8+18h]
  5437. + jnz loc_4E068
  5438. + cmp word ptr [r8+10h], 30h
  5439. + jnb short loc_4DFEC
  5440. + mov eax, 0C000000Dh
  5441. + add rsp, 20h
  5442. + pop rbx
  5443. + ret
  5444. +
  5445. +loc_4DFEC:
  5446. + cmp ecx, 1
  5447. + jnz short loc_4DFFA
  5448. + mov rcx, [rax+0C0h]
  5449. + jmp short loc_4E014
  5450. +
  5451. +loc_4DFFA:
  5452. + cmp ecx, 3
  5453. + jnz short loc_4E008
  5454. + mov rcx, [rax+0B8h]
  5455. + jmp short loc_4E014
  5456. +
  5457. +loc_4E008:
  5458. + cmp ecx, 6
  5459. + jnz short loc_4E068
  5460. + mov rcx, [rax+0C8h]
  5461. +
  5462. +loc_4E014:
  5463. + cmp byte ptr [rcx+82h], 1
  5464. + jnz short loc_4E068
  5465. + lea rax, AcpiArblibReferenceArbiter
  5466. + add rcx, 88h
  5467. + mov word ptr [rdx], 30h
  5468. + mov [rdx+10h], rax
  5469. + lea rax, AcpiArblibDereferenceArbiter
  5470. + mov word ptr [rdx+2], 0
  5471. + mov [rdx+18h], rax
  5472. + lea rax, ArbArbiterHandler
  5473. + mov [rdx+8], rcx
  5474. + mov [rdx+20h], rax
  5475. + mov dword ptr [rdx+28h], 0
  5476. + call AcpiArblibReferenceArbiter
  5477. + xor eax, eax
  5478. + add rsp, 20h
  5479. + pop rbx
  5480. + ret
  5481. +
  5482. +loc_4E068:
  5483. + mov eax, 0C00000BBh
  5484. + add rsp, 20h
  5485. + pop rbx
  5486. + ret
  5487. +AcpiArblibEjectInterface ENDP
  5488. +
  5489. +
  5490. +ACPIBusIrpQueryInterface PROC
  5491. + mov rax, rsp
  5492. + sub rsp, 38h
  5493. + mov [rax+8], rbx
  5494. + mov [rax+10h], rbp
  5495. + mov [rax+18h], rsi
  5496. + mov [rax+20h], rdi
  5497. + mov [rax-8], r12
  5498. + mov [rax-10h], r13
  5499. + mov [rax-18h], r14
  5500. + mov r14, [rdx+0B8h]
  5501. + mov rbx, rdx
  5502. + mov rsi, rcx
  5503. + call ACPIInternalGetDeviceExtension
  5504. + mov rbp, [r14+8]
  5505. + mov r12d, [r14+20h]
  5506. + lea rdx, GUID_ACPI_INTERFACE_STANDARD
  5507. + xor edi, edi
  5508. + cmp rbp, rdx
  5509. + mov r13, rax
  5510. + jz short loc_4F4F8
  5511. + lea r8d, [rdi+10h]
  5512. + mov rcx, rbp
  5513. + callex RtlCompareMemory
  5514. + mov ecx, edi
  5515. + cmp rax, 10h
  5516. + setz cl
  5517. + test ecx, ecx
  5518. + jz short loc_4F536
  5519. +
  5520. +loc_4F4F8:
  5521. + movzx eax, word ptr [r14+10h]
  5522. + cmp ax, 58h
  5523. + jbe short loc_4F50A
  5524. + mov ebp, 58h
  5525. + jmp short loc_4F50D
  5526. +
  5527. +loc_4F50A:
  5528. + movzx ebp, ax
  5529. +
  5530. +loc_4F50D:
  5531. + mov r12, [r14+18h]
  5532. + lea rdx, ACPIInterfaceTable
  5533. + mov r8d, ebp
  5534. + mov rcx, r12
  5535. + call memcpy
  5536. + cmp ebp, 10h
  5537. + jbe loc_4F70A
  5538. + mov [r12+8], rsi
  5539. + mov [rbx+30h], edi
  5540. + jmp short loc_4F596
  5541. +
  5542. +loc_4F536:
  5543. + lea rdx, GUID_TRANSLATOR_INTERFACE_STANDARD
  5544. + cmp rbp, rdx
  5545. + jz short loc_4F562
  5546. + mov r8d, 10h
  5547. + mov rcx, rbp
  5548. + callex RtlCompareMemory
  5549. + mov ecx, edi
  5550. + cmp rax, 10h
  5551. + setz cl
  5552. + test ecx, ecx
  5553. + jz loc_4F5F5
  5554. +
  5555. +loc_4F562:
  5556. + cmp r12d, 2
  5557. + jnz short loc_4F5CB
  5558. + mov rcx, rsi
  5559. + call IsPciBus
  5560. + test al, al
  5561. + jz short loc_4F593
  5562. + mov rax, [rbx+0B8h]
  5563. + xor edx, edx
  5564. + mov rcx, [rax+8]
  5565. + mov [rcx], edx
  5566. + mov [rcx+4], edx
  5567. + mov [rcx+8], edx
  5568. + mov [rcx+0Ch], edx
  5569. + mov dword ptr [rbx+30h], 0C00000BBh
  5570. +
  5571. +loc_4F593:
  5572. + mov edi, [rbx+30h]
  5573. +
  5574. +loc_4F596:
  5575. + xor edx, edx
  5576. + mov rcx, rbx
  5577. + callex IofCompleteRequest
  5578. + mov r14, [rsp+20h]
  5579. + mov r13, [rsp+28h]
  5580. + mov r12, [rsp+30h]
  5581. + mov rsi, [rsp+50h]
  5582. + mov rbp, [rsp+48h]
  5583. + mov rbx, [rsp+40h]
  5584. + mov eax, edi
  5585. + mov rdi, [rsp+58h]
  5586. + add rsp, 38h
  5587. + ret
  5588. +
  5589. +loc_4F5CB:
  5590. + cmp r12d, 1
  5591. + jz short loc_4F5D7
  5592. + cmp r12d, 3
  5593. + jnz short loc_4F593
  5594. +
  5595. +loc_4F5D7:
  5596. + mov rcx, rsi
  5597. + call IsPciBus
  5598. + test al, al
  5599. + jz short loc_4F593
  5600. + mov rdx, rbx
  5601. + mov rcx, rsi
  5602. + call TranslateEjectInterface
  5603. + mov edi, eax
  5604. + jmp loc_4F6FE
  5605. +
  5606. +loc_4F5F5:
  5607. + lea rdx, GUID_PCI_BUS_INTERFACE_STANDARD
  5608. + cmp rbp, rdx
  5609. + jz short loc_4F61D
  5610. + mov r8d, 10h
  5611. + mov rcx, rbp
  5612. + callex RtlCompareMemory
  5613. + mov ecx, edi
  5614. + cmp rax, 10h
  5615. + setz cl
  5616. + test ecx, ecx
  5617. + jz short loc_4F63F
  5618. +
  5619. +loc_4F61D:
  5620. + mov rcx, rsi
  5621. + call IsPciBus
  5622. + test al, al
  5623. + jz loc_4F593
  5624. + mov rdx, rbx
  5625. + mov rcx, rsi
  5626. + call PciBusEjectInterface
  5627. + mov edi, eax
  5628. + jmp loc_4F6FE
  5629. +
  5630. +loc_4F63F:
  5631. + lea rdx, GUID_BUS_INTERFACE_STANDARD
  5632. + cmp rbp, rdx
  5633. + jz short loc_4F667
  5634. + mov r8d, 10h
  5635. + mov rcx, rbp
  5636. + callex RtlCompareMemory
  5637. + mov ecx, edi
  5638. + cmp rax, 10h
  5639. + setz cl
  5640. + test ecx, ecx
  5641. + jz short loc_4F6A1
  5642. +
  5643. +loc_4F667:
  5644. + mov dword ptr [rbx+30h], 0C00002B9h
  5645. + mov rax, [r13+208h]
  5646. + test rax, rax
  5647. + jz loc_4F593
  5648. + mov rcx, [rax+1F0h]
  5649. + test rcx, rcx
  5650. + jz loc_4F593
  5651. + xor r8d, r8d
  5652. + mov rdx, r14
  5653. + call ACPIInternalSendSynchronousIrp
  5654. + mov [rbx+30h], eax
  5655. + jmp loc_4F593
  5656. +
  5657. +loc_4F6A1:
  5658. + lea rdx, GUID_ARBITER_INTERFACE_STANDARD
  5659. + cmp rbp, rdx
  5660. + jz short loc_4F6CC
  5661. + mov r8d, 10h
  5662. + mov rcx, rbp
  5663. + callex RtlCompareMemory
  5664. + cmp rax, 10h
  5665. + setz dil
  5666. + test edi, edi
  5667. + jz loc_4F593
  5668. +
  5669. +loc_4F6CC:
  5670. + mov rax, 2000000000h
  5671. + test [r13+0], rax
  5672. + jz loc_4F593
  5673. + cmp byte ptr [r13+0B0h], 0
  5674. + jz loc_4F593
  5675. + mov rdx, rbx
  5676. + mov rcx, rsi
  5677. + call AcpiArblibEjectInterface
  5678. + mov edi, eax
  5679. + mov [rbx+30h], eax
  5680. +
  5681. +loc_4F6FE:
  5682. + cmp edi, 0C00000BBh
  5683. + jz loc_4F593
  5684. +
  5685. +loc_4F70A:
  5686. + mov [rbx+30h], edi
  5687. + jmp loc_4F596
  5688. +ACPIBusIrpQueryInterface ENDP
  5689. +
  5690. +
  5691. +AcpiPortarbAddAllocation PROC
  5692. + mov r11, rsp
  5693. + sub rsp, 68h
  5694. + mov rax, [rdx+28h]
  5695. + movzx r9d, byte ptr [rdx+42h]
  5696. + mov r8, [rdx+8]
  5697. + mov [r11+8], rbx
  5698. + mov [r11+10h], rbp
  5699. + mov [r11+18h], rsi
  5700. + mov [r11+20h], rdi
  5701. + mov rbp, rcx
  5702. + mov edi, 1
  5703. + test [rax+1Ch], dil
  5704. + mov eax, 3
  5705. + mov [r11-8], r12
  5706. + cmovnz edi, eax
  5707. + mov rax, [rdx+20h]
  5708. + mov rbx, rdx
  5709. + mov rcx, [rax+20h]
  5710. + mov rdx, [rdx]
  5711. + mov [r11-10h], r13
  5712. + mov [r11-38h], rcx
  5713. + mov rcx, [rbp+28h]
  5714. + xor r13d, r13d
  5715. + mov [r11-40h], r13
  5716. + mov [rsp+20h], edi
  5717. + callex RtlAddRange
  5718. + mov rdx, [rbx]
  5719. + mov rax, [rbx+28h]
  5720. + movzx esi, byte ptr [rbx+42h]
  5721. + mov [rsp+40h], rdx
  5722. + mov rcx, [rax+20h]
  5723. + lea r8, [rsp+40h]
  5724. + movzx r12d, word ptr [rcx+4]
  5725. + or sil, 10h
  5726. + mov ecx, r12d
  5727. + call AcpiArblibGetNextAlias
  5728. + test al, al
  5729. + jz short loc_5438B
  5730. +
  5731. + ALIGN16
  5732. +loc_54340:
  5733. + mov rax, [rbx+28h]
  5734. + mov r9, [rbx+20h]
  5735. + mov rdx, [rsp+40h]
  5736. + mov ecx, [rax+10h]
  5737. + mov rax, [r9+20h]
  5738. + movzx r9d, sil
  5739. + mov [rsp+30h], rax
  5740. + lea r8, [rcx+rdx-1]
  5741. + mov rcx, [rbp+28h]
  5742. + mov [rsp+28h], r13
  5743. + mov [rsp+20h], edi
  5744. + callex RtlAddRange
  5745. + mov rdx, [rsp+40h]
  5746. + lea r8, [rsp+40h]
  5747. + mov ecx, r12d
  5748. + call AcpiArblibGetNextAlias
  5749. + test al, al
  5750. + jnz short loc_54340
  5751. +
  5752. +loc_5438B:
  5753. + mov r13, [rsp+58h]
  5754. + mov r12, [rsp+60h]
  5755. + mov rdi, [rsp+88h]
  5756. + mov rsi, [rsp+80h]
  5757. + mov rbp, [rsp+78h]
  5758. + mov rbx, [rsp+70h]
  5759. + add rsp, 68h
  5760. + ret
  5761. +AcpiPortarbAddAllocation ENDP
  5762. +
  5763. +
  5764. +AcpiArblibIsAliasedRangeAvailable PROC
  5765. + mov rax, rsp
  5766. + sub rsp, 0B8h
  5767. + mov [rax+10h], rbp
  5768. + mov [rax+18h], rsi
  5769. + mov [rax-10h], r13
  5770. + mov rsi, rcx
  5771. + mov rcx, [rdx+20h]
  5772. + xor r13b, r13b
  5773. + mov eax, [rcx+28h]
  5774. + mov rbp, rdx
  5775. + test eax, eax
  5776. + jz short loc_4D8D5
  5777. + cmp eax, 2
  5778. + jz short loc_4D8D5
  5779. + test byte ptr [rcx+2Ch], 1
  5780. + jz short loc_4D8D8
  5781. +
  5782. +loc_4D8D5:
  5783. + mov r13b, 1
  5784. +
  5785. +loc_4D8D8:
  5786. + mov [rsp+0C0h], rbx
  5787. + mov rbx, [rdx+28h]
  5788. + mov [rsp+0D8h], rdi
  5789. + mov rax, [rbx+20h]
  5790. + mov rdi, [rdx]
  5791. + mov [rsp+0B0h], r12
  5792. + movzx r12d, word ptr [rax+4]
  5793. + lea rcx, [rsp+50h]
  5794. + mov r8d, 50h
  5795. + mov [rsp+0A0h], r14
  5796. + call memcpy
  5797. + test byte ptr [rbx+1Ch], 1
  5798. + mov r14d, 2
  5799. + mov eax, 3
  5800. + mov ebx, r12d
  5801. + cmovnz r14d, eax
  5802. + and ebx, 4
  5803. +
  5804. +loc_4D931:
  5805. + test ebx, ebx
  5806. + jz short loc_4D93E
  5807. + add rdi, 400h
  5808. + jmp short loc_4D94F
  5809. +
  5810. +loc_4D93E:
  5811. + test r12b, 8
  5812. + jz loc_4D9D0
  5813. + add rdi, 1000h
  5814. +
  5815. +loc_4D94F:
  5816. + cmp rdi, 0FFFFh
  5817. + ja short loc_4D9D0
  5818. + mov rax, [rbp+28h]
  5819. + mov r9d, r14d
  5820. + mov rdx, rdi
  5821. + mov ecx, [rax+10h]
  5822. + lea rax, [rsp+40h]
  5823. + mov [rsp+38h], rax
  5824. + mov rax, [rsi+130h]
  5825. + lea r8, [rcx+rdi-1]
  5826. + mov rcx, [rsi+28h]
  5827. + mov [rsp+30h], rax
  5828. + mov rax, [rsi+128h]
  5829. + mov [rsp+28h], rax
  5830. + mov [rsp+20h], r13b
  5831. + callex RtlIsRangeAvailable
  5832. + cmp byte ptr [rsp+40h], 1
  5833. + jz short loc_4D931
  5834. + mov rax, [rbp+28h]
  5835. + mov [rsp+60h], rdi
  5836. + lea rdx, [rsp+50h]
  5837. + mov ecx, [rax+10h]
  5838. + lea rax, [rcx+rdi-1]
  5839. + mov rcx, rsi
  5840. + mov [rsp+68h], rax
  5841. + call qword ptr [rsi+108h]
  5842. + test al, al
  5843. + jnz loc_4D931
  5844. + jmp short loc_4D9D2
  5845. +
  5846. +loc_4D9D0:
  5847. + mov al, 1
  5848. +
  5849. +loc_4D9D2:
  5850. + mov r14, [rsp+0A0h]
  5851. + mov r13, [rsp+0A8h]
  5852. + mov r12, [rsp+0B0h]
  5853. + mov rdi, [rsp+0D8h]
  5854. + mov rsi, [rsp+0D0h]
  5855. + mov rbp, [rsp+0C8h]
  5856. + mov rbx, [rsp+0C0h]
  5857. + add rsp, 0B8h
  5858. + ret
  5859. +AcpiArblibIsAliasedRangeAvailable ENDP
  5860. +
  5861. +
  5862. +AcpiPortarbFindSuitableRange PROC
  5863. + sub rsp, 58h
  5864. + mov [rsp+60h], rbx
  5865. + mov rbx, rdx
  5866. + mov rdx, [rdx+28h]
  5867. + cmp dword ptr [rdx+10h], 0
  5868. + mov [rsp+78h], rdi
  5869. + mov rdi, rcx
  5870. + jnz short loc_541A6
  5871. + mov rax, [rbx]
  5872. + mov [rbx+8], rax
  5873. + mov al, 1
  5874. + mov rdi, [rsp+78h]
  5875. + mov rbx, [rsp+60h]
  5876. + add rsp, 58h
  5877. + ret
  5878. +
  5879. +loc_541A6:
  5880. + mov rcx, [rbx+20h]
  5881. +
  5882. +loc_541AA:
  5883. + mov [rsp+68h], rbp
  5884. + xor bpl, bpl
  5885. + mov eax, [rcx+28h]
  5886. + test eax, eax
  5887. + jz short loc_541C4
  5888. + cmp eax, 2
  5889. + jz short loc_541C4
  5890. + test byte ptr [rcx+2Ch], 1
  5891. + jz short loc_541C7
  5892. +
  5893. +loc_541C4:
  5894. + mov bpl, 1
  5895. +
  5896. +loc_541C7:
  5897. + mov rax, [rbx+18h]
  5898. + mov [rsp+70h], rsi
  5899. + movzx esi, byte ptr [rdx+1Ch]
  5900. + and esi, 1
  5901. + cmp [rbx+10h], rax
  5902. + ja loc_54272
  5903. +
  5904. +loc_541E1:
  5905. + mov rax, [rdi+130h]
  5906. + mov r9d, [rdx+10h]
  5907. + mov r8, [rbx+18h]
  5908. + mov rcx, [rdi+28h]
  5909. + mov [rsp+48h], rbx
  5910. + mov [rsp+40h], rax
  5911. + mov rax, [rdi+128h]
  5912. + mov [rsp+38h], rax
  5913. + mov eax, [rdx+14h]
  5914. + mov rdx, [rbx+10h]
  5915. + mov [rsp+30h], bpl
  5916. + mov [rsp+28h], esi
  5917. + mov [rsp+20h], eax
  5918. + callex RtlFindRange
  5919. + test eax, eax
  5920. + jns short loc_54238
  5921. + mov rdx, rbx
  5922. + mov rcx, rdi
  5923. + call qword ptr [rdi+108h]
  5924. + test al, al
  5925. + jz short loc_54272
  5926. +
  5927. +loc_54238:
  5928. + mov rax, [rbx+28h]
  5929. + mov rdx, rbx
  5930. + mov ecx, [rax+10h]
  5931. + mov rax, [rbx]
  5932. + lea rcx, [rcx+rax-1]
  5933. + mov [rbx+8], rcx
  5934. + mov rcx, rdi
  5935. + call AcpiArblibIsAliasedRangeAvailable
  5936. + test al, al
  5937. + jnz short loc_5428D
  5938. + mov rdx, [rbx+28h]
  5939. + mov eax, [rdx+10h]
  5940. + add [rbx], rax
  5941. + mov rax, [rbx+18h]
  5942. + cmp [rbx+10h], rax
  5943. + jbe loc_541E1
  5944. +
  5945. +loc_54272:
  5946. + xor al, al
  5947. +
  5948. +loc_54274:
  5949. + mov rsi, [rsp+70h]
  5950. + mov rbp, [rsp+68h]
  5951. + mov rdi, [rsp+78h]
  5952. + mov rbx, [rsp+60h]
  5953. + add rsp, 58h
  5954. + ret
  5955. +
  5956. +loc_5428D:
  5957. + mov al, 1
  5958. + jmp short loc_54274
  5959. +AcpiPortarbFindSuitableRange ENDP
  5960. +
  5961. +
  5962. +AcpiArblibGetNextAlias PROC
  5963. + test cl, 4
  5964. + jz short loc_4D86E
  5965. + lea rax, [rdx+400h]
  5966. + jmp short loc_4D87A
  5967. +
  5968. +loc_4D86E:
  5969. + test cl, 8
  5970. + jz short loc_4D888
  5971. + lea rax, [rdx+1000h]
  5972. +
  5973. +loc_4D87A:
  5974. + cmp rax, 0FFFFh
  5975. + ja short loc_4D888
  5976. + mov [r8], rax
  5977. + mov al, 1
  5978. + ret
  5979. +
  5980. +loc_4D888:
  5981. + xor al, al
  5982. + ret
  5983. +AcpiArblibGetNextAlias ENDP
  5984. +
  5985. +
  5986. +AcpiPortarbBacktrackAllocation PROC
  5987. + sub rsp, 38h
  5988. + mov [rsp+48h], rbx
  5989. + mov rbx, rdx
  5990. + mov rdx, [rdx]
  5991. + mov rax, [rbx+28h]
  5992. + mov [rsp+50h], rsi
  5993. + mov [rsp+20h], rdx
  5994. + mov esi, [rax+1Ch]
  5995. + mov [rsp+58h], rdi
  5996. + mov rdi, rcx
  5997. + lea r8, [rsp+20h]
  5998. + mov ecx, esi
  5999. + call AcpiArblibGetNextAlias
  6000. + test al, al
  6001. + jz short loc_54148
  6002. +
  6003. + ALIGN16
  6004. +loc_54110:
  6005. + mov rax, [rbx+28h]
  6006. + mov rdx, [rsp+20h]
  6007. + mov r9, [rbx+20h]
  6008. + mov ecx, [rax+10h]
  6009. + mov r9, [r9+20h]
  6010. + lea r8, [rcx+rdx-1]
  6011. + mov rcx, [rdi+28h]
  6012. + callex RtlDeleteRange
  6013. + mov rdx, [rsp+20h]
  6014. + lea r8, [rsp+20h]
  6015. + mov ecx, esi
  6016. + call AcpiArblibGetNextAlias
  6017. + test al, al
  6018. + jnz short loc_54110
  6019. +
  6020. +loc_54148:
  6021. + mov rdx, rbx
  6022. + mov rcx, rdi
  6023. + call ArbBacktrackAllocation
  6024. + mov rdi, [rsp+58h]
  6025. + mov rsi, [rsp+50h]
  6026. + mov rbx, [rsp+48h]
  6027. + add rsp, 38h
  6028. + ret
  6029. +AcpiPortarbBacktrackAllocation ENDP
  6030. +
  6031. +
  6032. +AcpiMemarbFindSuitableRange PROC
  6033. + mov rax, [rdx+20h]
  6034. + test byte ptr [rax+2Ch], 1
  6035. + jz short loc_5382E
  6036. + or byte ptr [rdx+43h], 1
  6037. +
  6038. +loc_5382E:
  6039. + jmp ArbFindSuitableRange
  6040. +AcpiMemarbFindSuitableRange ENDP
  6041. +
  6042. +
  6043. +AcpiInitializePortArbiter PROC
  6044. + sub rsp, 38h
  6045. + lea r8, AcpiArblibUnpackRequirement
  6046. + mov r9, rcx
  6047. + mov qword ptr [rsp+28h], 0
  6048. + mov [rcx+0F8h], r8
  6049. + lea r8, AcpiArblibPackResource
  6050. + add rcx, 88h
  6051. + mov [rcx+78h], r8
  6052. + lea r8, AcpiArblibUnpackResource
  6053. + mov [rcx+80h], r8
  6054. + lea r8, AcpiArblibScoreRequirement
  6055. + mov [rcx+88h], r8
  6056. + lea r8, AcpiPortarbFindSuitableRange
  6057. + mov [rcx+0F0h], r8
  6058. + lea r8, AcpiPortarbAddAllocation
  6059. + mov [rcx+0F8h], r8
  6060. + lea r8, AcpiPortarbBacktrackAllocation
  6061. + mov [rcx+100h], r8
  6062. + mov rdx, [rdx+1F0h]
  6063. + lea r8, asmRootName
  6064. + mov [rsp+20h], r8
  6065. + mov r8d, 1
  6066. + call ArbInitializeArbiterInstance
  6067. + add rsp, 38h
  6068. + ret
  6069. +AcpiInitializePortArbiter ENDP
  6070. +
  6071. +
  6072. +AcpiInitializeMemoryArbiter PROC
  6073. + sub rsp, 38h
  6074. + lea r8, AcpiArblibUnpackRequirement
  6075. + mov r9, rcx
  6076. + mov qword ptr [rsp+28h], 0
  6077. + mov [rcx+0F8h], r8
  6078. + lea r8, AcpiArblibPackResource
  6079. + add rcx, 88h
  6080. + mov [rcx+78h], r8
  6081. + lea r8, AcpiArblibUnpackResource
  6082. + mov [rcx+80h], r8
  6083. + lea r8, AcpiArblibScoreRequirement
  6084. + mov [rcx+88h], r8
  6085. + lea r8, AcpiMemarbFindSuitableRange
  6086. + mov [rcx+0F0h], r8
  6087. + mov rdx, [rdx+1F0h]
  6088. + lea r8, asmRootName
  6089. + mov [rsp+20h], r8
  6090. + mov r8d, 3
  6091. + call ArbInitializeArbiterInstance
  6092. + add rsp, 38h
  6093. + ret
  6094. +AcpiInitializeMemoryArbiter ENDP
  6095. +
  6096. +
  6097. +AcpiArblibUnpackRequirement PROC
  6098. + movzx eax, byte ptr [rcx+1]
  6099. + cmp al, 3
  6100. + jz short loc_4D6A5
  6101. + cmp al, 1
  6102. + jz short loc_4D6A5
  6103. + cmp al, 6
  6104. + jnz short loc_4D69F
  6105. + mov eax, [rcx+0Ch]
  6106. + mov [rdx], rax
  6107. + mov eax, [rcx+10h]
  6108. + mov [r8], rax
  6109. + mov eax, [rcx+8]
  6110. + mov [r9], eax
  6111. + mov rax, [rsp+28h]
  6112. + mov dword ptr [rax], 1
  6113. + jmp short loc_4D6CD
  6114. +
  6115. +loc_4D69F:
  6116. + mov eax, 0C0000024h
  6117. + ret
  6118. +
  6119. +loc_4D6A5:
  6120. + mov rax, [rcx+10h]
  6121. + mov [rdx], rax
  6122. + mov rax, [rcx+18h]
  6123. + mov rdx, [rsp+28h]
  6124. + mov [r8], rax
  6125. + mov eax, [rcx+8]
  6126. + mov [r9], eax
  6127. + mov eax, [rcx+0Ch]
  6128. + test eax, eax
  6129. + mov [rdx], eax
  6130. + jnz short loc_4D6CD
  6131. + mov dword ptr [rdx], 1
  6132. +
  6133. +loc_4D6CD:
  6134. + cmp byte ptr [rcx+1], 3
  6135. + jnz short loc_4D6EA
  6136. + test byte ptr [rcx+4], 10h
  6137. + jz short loc_4D6EA
  6138. + cmp qword ptr [rcx+18h], 0FFFFFFh
  6139. + jle short loc_4D6EA
  6140. + mov qword ptr [r8], 0FFFFFFh
  6141. +
  6142. +loc_4D6EA:
  6143. + xor eax, eax
  6144. + ret
  6145. +AcpiArblibUnpackRequirement ENDP
  6146. +
  6147. +
  6148. +AcpiArblibPackResource PROC
  6149. + movzx eax, byte ptr [rcx+1]
  6150. + mov [r8], al
  6151. + movzx eax, word ptr [rcx+4]
  6152. + mov [r8+2], ax
  6153. + movzx eax, byte ptr [rcx+2]
  6154. + mov [r8+1], al
  6155. + cmp byte ptr [rcx+1], 3
  6156. + jz short loc_4D808
  6157. + movzx eax, byte ptr [rcx+1]
  6158. + cmp al, 1
  6159. + jz short loc_4D808
  6160. + cmp al, 6
  6161. + jnz short loc_4D813
  6162. + mov [r8+4], edx
  6163. + mov eax, [rcx+8]
  6164. + mov [r8+8], eax
  6165. + xor eax, eax
  6166. + ret
  6167. +
  6168. +loc_4D808:
  6169. + mov [r8+4], rdx
  6170. + mov eax, [rcx+8]
  6171. + mov [r8+0Ch], eax
  6172. +
  6173. +loc_4D813:
  6174. + xor eax, eax
  6175. + ret
  6176. +AcpiArblibPackResource ENDP
  6177. +
  6178. +
  6179. +AcpiArblibUnpackResource PROC
  6180. + movzx eax, byte ptr [rcx]
  6181. + cmp al, 3
  6182. + jz short loc_4D83E
  6183. + cmp al, 1
  6184. + jz short loc_4D83E
  6185. + cmp al, 6
  6186. + jnz short loc_4D84B
  6187. + mov eax, [rcx+4]
  6188. + mov [rdx], rax
  6189. + mov eax, [rcx+8]
  6190. + mov [r8], eax
  6191. + xor eax, eax
  6192. + ret
  6193. +
  6194. +loc_4D83E:
  6195. + mov rax, [rcx+4]
  6196. + mov [rdx], rax
  6197. + mov eax, [rcx+0Ch]
  6198. + mov [r8], eax
  6199. +
  6200. +loc_4D84B:
  6201. + xor eax, eax
  6202. + ret
  6203. +AcpiArblibUnpackResource ENDP
  6204. +
  6205. +
  6206. +AcpiArblibScoreRequirement PROC
  6207. + push rbx
  6208. + sub rsp, 20h
  6209. + movzx eax, byte ptr [rcx+1]
  6210. + mov ebx, 1
  6211. + cmp al, 3
  6212. + jz short loc_4D727
  6213. + cmp al, bl
  6214. + jz short loc_4D727
  6215. + cmp al, 6
  6216. + jnz short loc_4D78F
  6217. + mov r10d, [rcx+0Ch]
  6218. + mov r9d, [rcx+10h]
  6219. + mov edx, ebx
  6220. + jmp short loc_4D737
  6221. +
  6222. +loc_4D727:
  6223. + mov edx, [rcx+0Ch]
  6224. + mov r10, [rcx+10h]
  6225. + mov r9, [rcx+18h]
  6226. + test edx, edx
  6227. + cmovz edx, ebx
  6228. +
  6229. +loc_4D737:
  6230. + cmp al, 3
  6231. + mov r11d, [rcx+8]
  6232. + jnz short loc_4D755
  6233. + test byte ptr [rcx+4], 10h
  6234. + jz short loc_4D755
  6235. + cmp qword ptr [rcx+18h], 0FFFFFFh
  6236. + jle short loc_4D755
  6237. + mov r9d, 0FFFFFFh
  6238. +
  6239. +loc_4D755:
  6240. + test edx, edx
  6241. + jnz short loc_4D75B
  6242. +
  6243. +loc_4D759:
  6244. + mov edx, ebx
  6245. +
  6246. +loc_4D75B:
  6247. + mov r8d, edx
  6248. + lea rcx, [r8-1]
  6249. + lea rdx, [r8+r10-1]
  6250. + not rcx
  6251. + and rdx, rcx
  6252. + mov ecx, r11d
  6253. + sub r9, rdx
  6254. + sub r9, rcx
  6255. + lea rax, [r9+1]
  6256. + cqo
  6257. + idiv r8
  6258. + test rax, rax
  6259. + jns short loc_4D7AA
  6260. + mov eax, 0FFFFFFFFh
  6261. + add rsp, 20h
  6262. + pop rbx
  6263. + ret
  6264. +
  6265. +loc_4D78F:
  6266. + mov ecx, 50109h
  6267. + call _ACPIInternalError
  6268. + mov r11d, [rsp+30h]
  6269. + mov r9, [rsp+30h]
  6270. + mov r10, [rsp+30h]
  6271. + jmp short loc_4D759
  6272. +
  6273. +loc_4D7AA:
  6274. + mov ecx, 7FFFFFFFh
  6275. + cmp rax, rcx
  6276. + cmovg eax, ecx
  6277. + add rsp, 20h
  6278. + pop rbx
  6279. + ret
  6280. +AcpiArblibScoreRequirement ENDP
  6281. +
  6282. +
  6283. +AcpiInitializeBusNumberArbiter PROC
  6284. + sub rsp, 38h
  6285. + lea r8, AcpiArblibUnpackRequirement
  6286. + mov r9, rcx
  6287. + mov qword ptr [rsp+28h], 0
  6288. + mov [rcx+0F8h], r8
  6289. + lea r8, AcpiArblibPackResource
  6290. + add rcx, 88h
  6291. + mov [rcx+78h], r8
  6292. + lea r8, AcpiArblibUnpackResource
  6293. + mov [rcx+80h], r8
  6294. + lea r8, AcpiArblibScoreRequirement
  6295. + mov [rcx+88h], r8
  6296. + mov rdx, [rdx+1F0h]
  6297. + lea r8, asmRootName
  6298. + mov [rsp+20h], r8
  6299. + mov r8d, 6
  6300. + call ArbInitializeArbiterInstance
  6301. + add rsp, 38h
  6302. + ret
  6303. +AcpiInitializeBusNumberArbiter ENDP
  6304. +
  6305. +
  6306. +AcpiArblibAllocateArbiterInstance PROC
  6307. + sub rsp, 58h
  6308. + cmp edx, 1
  6309. + mov [rsp+60h], rbx
  6310. + mov [rsp+70h], rsi
  6311. + mov rsi, rcx
  6312. + mov ebx, edx
  6313. + jz short loc_4DA53
  6314. + cmp edx, 3
  6315. + jz short loc_4DA53
  6316. + cmp edx, 6
  6317. + jz short loc_4DA53
  6318. + xor eax, eax
  6319. + mov rsi, [rsp+70h]
  6320. + mov rbx, [rsp+60h]
  6321. + add rsp, 58h
  6322. + ret
  6323. +
  6324. +loc_4DA53:
  6325. + mov edx, 1C0h
  6326. + mov ecx, 101h
  6327. + mov r8d, 69706341h
  6328. +
  6329. +loc_4DA63:
  6330. + mov [rsp+50h], r12
  6331. + callex ExAllocatePoolWithTag
  6332. + test rax, rax
  6333. + mov r12, rax
  6334. + jnz short loc_4DA8A
  6335. + mov r12, [rsp+50h]
  6336. + mov rsi, [rsp+70h]
  6337. + mov rbx, [rsp+60h]
  6338. + add rsp, 58h
  6339. + ret
  6340. +
  6341. +loc_4DA8A:
  6342. + xor edx, edx
  6343. + mov r8d, 1C0h
  6344. + mov rcx, rax
  6345. + call memset
  6346. + lock inc [AcpiArbiterInstanceCount]
  6347. + cmp ebx, 1
  6348. + jnz short loc_4DAAF
  6349. + lea r9, asmPortName
  6350. + jmp short loc_4DAC4
  6351. +
  6352. +loc_4DAAF:
  6353. + lea r9, asmMemoryName
  6354. + lea rax, asmBusNumberName
  6355. + cmp ebx, 3
  6356. + cmovnz r9, rax
  6357. +
  6358. +loc_4DAC4:
  6359. + mov [rsp+78h], rdi
  6360. + mov edi, 40h
  6361. + lea r8, asmACPIName
  6362. + mov rdx, rdi
  6363. + mov rcx, r12
  6364. + callex _snwprintf
  6365. + test eax, eax
  6366. + movsxd r11, eax
  6367. + jns short loc_4DAFA
  6368. + xor edx, edx
  6369. + mov rcx, r12
  6370. + callex ExFreePoolWithTag
  6371. + xor eax, eax
  6372. + jmp loc_4DCA5
  6373. +
  6374. +loc_4DAFA:
  6375. + mov rbx, [rsi+1E8h]
  6376. +
  6377. +loc_4DB01:
  6378. + mov [rsp+68h], rbp
  6379. + sub edi, r11d
  6380. + test rbx, rbx
  6381. + mov [rsp+48h], r13
  6382. + mov rax, r11
  6383. + lea rbp, [r12+r11*2]
  6384. + jz loc_4DC73
  6385. + cmp qword ptr [rbx+10h], 0
  6386. + jz loc_4DC73
  6387. + cmp edi, 5
  6388. + jb loc_4DC73
  6389. + movzx eax, byte ptr [rbx+23h]
  6390. + test al, al
  6391. + jnz short loc_4DB42
  6392. + mov r8d, 2Ah
  6393. + jmp short loc_4DB46
  6394. +
  6395. +loc_4DB42:
  6396. + movsx r8d, al
  6397. +
  6398. +loc_4DB46:
  6399. + movzx eax, byte ptr [rbx+22h]
  6400. + test al, al
  6401. + jnz short loc_4DB55
  6402. + mov edx, 2Ah
  6403. + jmp short loc_4DB58
  6404. +
  6405. +loc_4DB55:
  6406. + movsx edx, al
  6407. +
  6408. +loc_4DB58:
  6409. + movzx eax, byte ptr [rbx+21h]
  6410. + test al, al
  6411. + jnz short loc_4DB67
  6412. + mov ecx, 2Ah
  6413. + jmp short loc_4DB6A
  6414. +
  6415. +loc_4DB67:
  6416. + movsx ecx, al
  6417. +
  6418. +loc_4DB6A:
  6419. + movzx eax, byte ptr [rbx+20h]
  6420. + test al, al
  6421. + jnz short loc_4DB7A
  6422. + mov r9d, 2Ah
  6423. + jmp short loc_4DB7E
  6424. +
  6425. +loc_4DB7A:
  6426. + movsx r9d, al
  6427. +
  6428. +loc_4DB7E:
  6429. + mov [rsp+30h], r8d
  6430. + mov [rsp+28h], edx
  6431. + mov [rsp+20h], ecx
  6432. + lea r8, asmFormat2Name
  6433. + mov rcx, rbp
  6434. + mov edx, 4
  6435. + callex _snwprintf
  6436. + mov rbx, [rbx+10h]
  6437. + add edi, 0FFFFFFFCh
  6438. + cmp qword ptr [rbx+10h], 0
  6439. + lea r13, [rbx+10h]
  6440. + mov esi, 4
  6441. + jz loc_4DC68
  6442. +
  6443. + ALIGN16
  6444. +loc_4DBC0:
  6445. + cmp edi, 6
  6446. + jb loc_4DC73
  6447. + mov r8d, esi
  6448. + lea rcx, [rbp+0Ah]
  6449. + mov rdx, rbp
  6450. + add r8, r8
  6451. + call memcpy
  6452. + mov word ptr [rbp+8], 2Eh
  6453. + movzx eax, byte ptr [rbx+23h]
  6454. + add esi, 5
  6455. + add edi, 0FFFFFFFBh
  6456. + test al, al
  6457. + jnz short loc_4DBF7
  6458. + mov r8d, 2Ah
  6459. + jmp short loc_4DBFB
  6460. +
  6461. +loc_4DBF7:
  6462. + movsx r8d, al
  6463. +
  6464. +loc_4DBFB:
  6465. + movzx eax, byte ptr [rbx+22h]
  6466. + test al, al
  6467. + jnz short loc_4DC0A
  6468. + mov edx, 2Ah
  6469. + jmp short loc_4DC0D
  6470. +
  6471. +loc_4DC0A:
  6472. + movsx edx, al
  6473. +
  6474. +loc_4DC0D:
  6475. + movzx eax, byte ptr [rbx+21h]
  6476. + test al, al
  6477. + jnz short loc_4DC1C
  6478. + mov ecx, 2Ah
  6479. + jmp short loc_4DC1F
  6480. +
  6481. +loc_4DC1C:
  6482. + movsx ecx, al
  6483. +
  6484. +loc_4DC1F:
  6485. + movzx eax, byte ptr [rbx+20h]
  6486. + test al, al
  6487. + jnz short loc_4DC2F
  6488. + mov r9d, 2Ah
  6489. + jmp short loc_4DC33
  6490. +
  6491. +loc_4DC2F:
  6492. + movsx r9d, al
  6493. +
  6494. +loc_4DC33:
  6495. + mov [rsp+30h], r8d
  6496. + mov [rsp+28h], edx
  6497. + mov [rsp+20h], ecx
  6498. + lea r8, asmFormat2Name
  6499. + mov rcx, rbp
  6500. + mov edx, 4
  6501. + callex _snwprintf
  6502. + mov rbx, [r13+0]
  6503. + cmp qword ptr [rbx+10h], 0
  6504. + lea r13, [rbx+10h]
  6505. + jnz loc_4DBC0
  6506. +
  6507. +loc_4DC68:
  6508. + mov eax, esi
  6509. + mov word ptr [rbp+rax*2+0], 0
  6510. + jmp short loc_4DC98
  6511. +
  6512. +loc_4DC73:
  6513. + mov r9d, [AcpiArbiterInstanceCount]
  6514. + lea r8, asmFormat3Name
  6515. + mov edx, edi
  6516. + mov rcx, rbp
  6517. + callex _snwprintf
  6518. + lea r11d, [rdi-1]
  6519. + mov word ptr [rbp+r11*2+0], 0
  6520. +
  6521. +loc_4DC98:
  6522. + mov rbp, [rsp+68h]
  6523. + mov r13, [rsp+48h]
  6524. + mov rax, r12
  6525. +
  6526. +loc_4DCA5:
  6527. + mov rdi, [rsp+78h]
  6528. + mov r12, [rsp+50h]
  6529. + mov rsi, [rsp+70h]
  6530. + mov rbx, [rsp+60h]
  6531. + add rsp, 58h
  6532. + ret
  6533. +AcpiArblibAllocateArbiterInstance ENDP
  6534. +
  6535. +
  6536. +AcpiArblibInitializeArbiter PROC
  6537. + sub rsp, 28h
  6538. + cmp edx, 1
  6539. + mov [rsp+38h], rbp
  6540. + mov [rsp+40h], rsi
  6541. + mov [rsp+48h], rdi
  6542. + mov rbp, r8
  6543. + mov rsi, rcx
  6544. + mov edi, edx
  6545. + jz short loc_4DD53
  6546. + cmp edx, 3
  6547. + jz short loc_4DD53
  6548. + cmp edx, 6
  6549. + jz short loc_4DD53
  6550. + mov eax, 0C000000Dh
  6551. + mov rdi, [rsp+48h]
  6552. + mov rsi, [rsp+40h]
  6553. + mov rbp, [rsp+38h]
  6554. + add rsp, 28h
  6555. + ret
  6556. +
  6557. +loc_4DD53:
  6558. + mov [rsp+30h], rbx
  6559. + call AcpiArblibAllocateArbiterInstance
  6560. + test rax, rax
  6561. + mov rbx, rax
  6562. + jnz short loc_4DD6C
  6563. + mov eax, 0C000009Ah
  6564. + jmp short loc_4DDD6
  6565. +
  6566. +loc_4DD6C:
  6567. + cmp edi, 1
  6568. + jnz short loc_4DD80
  6569. + mov rdx, rsi
  6570. + mov rcx, rax
  6571. + call AcpiInitializePortArbiter
  6572. + mov edi, eax
  6573. + jmp short loc_4DDA1
  6574. +
  6575. +loc_4DD80:
  6576. + cmp edi, 3
  6577. + jnz short loc_4DD94
  6578. + mov rdx, rsi
  6579. + mov rcx, rax
  6580. + call AcpiInitializeMemoryArbiter
  6581. + mov edi, eax
  6582. + jmp short loc_4DDA1
  6583. +
  6584. +loc_4DD94:
  6585. + mov rdx, rsi
  6586. + mov rcx, rax
  6587. + call AcpiInitializeBusNumberArbiter
  6588. + mov edi, eax
  6589. +
  6590. +loc_4DDA1:
  6591. + test edi, edi
  6592. + jns short loc_4DDC9
  6593. + cmp byte ptr [rbx+80h], 0
  6594. + jz short loc_4DDBA
  6595. + lea rcx, [rbx+88h]
  6596. + call ArbDeleteArbiterInstance
  6597. +
  6598. +loc_4DDBA:
  6599. + xor edx, edx
  6600. + mov rcx, rbx
  6601. + callex ExFreePoolWithTag
  6602. + mov eax, edi
  6603. + jmp short loc_4DDD6
  6604. +
  6605. +loc_4DDC9:
  6606. + mov byte ptr [rbx+80h], 1
  6607. + xor eax, eax
  6608. + mov [rbp+0], rbx
  6609. +
  6610. +loc_4DDD6:
  6611. + mov rbx, [rsp+30h]
  6612. + mov rdi, [rsp+48h]
  6613. + mov rsi, [rsp+40h]
  6614. + mov rbp, [rsp+38h]
  6615. + add rsp, 28h
  6616. + ret
  6617. +AcpiArblibInitializeArbiter ENDP
  6618. +
  6619. +
  6620. +ACPIBuildPdo PROC
  6621. + mov r11, rsp
  6622. + sub rsp, 78h
  6623. + mov [r11+8], rbx
  6624. + mov [r11+10h], rbp
  6625. + mov [r11+20h], rdi
  6626. + xor ebp, ebp
  6627. + mov [r11-10h], r13
  6628. + lea rax, [r11-38h]
  6629. + mov [r11-48h], rax
  6630. + mov [r11-18h], r14
  6631. + movzx r14d, r9b
  6632. + mov rbx, r8
  6633. + mov rdi, rdx
  6634. + lea r9d, [rbp+32h]
  6635. + xor r8d, r8d
  6636. + xor edx, edx
  6637. + mov [rsp+28h], bpl
  6638. + mov r13, rbp
  6639. + mov [r11-38h], rbp
  6640. + mov dword ptr [rsp+20h], 80h
  6641. + callex IoCreateDevice
  6642. + test eax, eax
  6643. + js loc_11C58
  6644. + test r14b, r14b
  6645. + jz short loc_119E1
  6646. + mov eax, [rdi]
  6647. + bt rax, 14h
  6648. + jb short loc_119DE
  6649. + mov rcx, rbx
  6650. + callex IoGetAttachedDeviceReference
  6651. + test rax, rax
  6652. + mov r13, rax
  6653. + jnz short loc_119E1
  6654. + mov rcx, [rsp+40h]
  6655. + callex IoDeleteDevice
  6656. + mov eax, 0C000000Eh
  6657. + jmp loc_11C58
  6658. +
  6659. +loc_119DE:
  6660. + xor r14b, r14b
  6661. +
  6662. +loc_119E1:
  6663. + mov [rsp+90h], rsi
  6664. + mov rax, 2000000000h
  6665. + mov [rsp+70h], r12
  6666. + test [rdi], rax
  6667. + mov [rsp+58h], r15
  6668. + jz short loc_11A23
  6669. + mov rcx, [rdi+1E8h]
  6670. + mov edx, 5352435Fh
  6671. + call ACPIAmliGetNamedChild
  6672. + test rax, rax
  6673. + jnz loc_11B13
  6674. + mov [rdi+0B0h], bpl
  6675. +
  6676. +loc_11A23:
  6677. + lea rcx, AcpiDeviceTreeLock
  6678. + callex KeAcquireSpinLockRaiseToDpc
  6679. + mov rcx, [rsp+40h]
  6680. + mov [rcx+40h], rdi
  6681. + mov rcx, [rsp+40h]
  6682. + movzx esi, al
  6683. + mov [rdi+1F0h], rcx
  6684. + mov [rdi+200h], rcx
  6685. + lock inc dword ptr [rdi+1D4h]
  6686. + mov r8b, 1
  6687. + mov edx, 1FFh
  6688. + mov rcx, rdi
  6689. + call ACPIInternalUpdateFlags
  6690. + xor r8d, r8d
  6691. + mov rcx, rdi
  6692. + lea edx, [r8+20h]
  6693. + call ACPIInternalUpdateFlags
  6694. + test r14b, r14b
  6695. + mov eax, [rdi+0E0h]
  6696. + mov [rdi+0E4h], eax
  6697. + lea rax, AcpiPdoIrpDispatch
  6698. + mov [rdi+0E0h], ebp
  6699. + mov [rdi+10h], rax
  6700. + jz short loc_11AED
  6701. + xor r8d, r8d
  6702. + mov rcx, rdi
  6703. + mov [rdi+1F8h], r13
  6704. + lea edx, [r8+40h]
  6705. + call ACPIInternalUpdateFlags
  6706. + mov rax, [rsp+40h]
  6707. + lea r11, AcpiBusFilterIrpDispatch
  6708. + mov [rdi+10h], r11
  6709. + movzx ecx, byte ptr [r13+4Ch]
  6710. + inc cl
  6711. + mov [rax+4Ch], cl
  6712. + mov rax, [rsp+40h]
  6713. + mov ecx, [r13+98h]
  6714. + mov [rax+98h], ecx
  6715. + bt dword ptr [r13+30h], 0Dh
  6716. + jnb short loc_11AED
  6717. + mov rax, [rsp+40h]
  6718. + or dword ptr [rax+30h], 2000h
  6719. +
  6720. +loc_11AED:
  6721. + mov rax, [rdi]
  6722. + mov rcx, 1000000000h
  6723. + test rcx, rax
  6724. + jz loc_11B85
  6725. + lea rax, AcpiProcessorIrpDispatch
  6726. + mov [rdi+10h], rax
  6727. + jmp loc_11BE3
  6728. +
  6729. +loc_11B13:
  6730. + mov byte ptr [rdi+0B0h], 1
  6731. + mov ebx, ebp
  6732. + mov rsi, rbp
  6733. + lea r15, AcpiArbiterResourceTypes
  6734. +
  6735. +loc_11B26:
  6736. + mov edx, [r15+rsi*4]
  6737. + mov eax, ebx
  6738. + mov rcx, rdi
  6739. + lea r8, [rdi+rax*8+0B8h]
  6740. + call AcpiArblibInitializeArbiter
  6741. + test eax, eax
  6742. + mov r12d, eax
  6743. + js short loc_11B52
  6744. + inc ebx
  6745. + inc rsi
  6746. + cmp ebx, 3
  6747. + jb short loc_11B26
  6748. + jmp loc_11A23
  6749. +
  6750. +loc_11B52:
  6751. + test ebx, ebx
  6752. + jz short loc_11B72
  6753. + lea rdi, [rdi+rsi*8+0B8h]
  6754. + xchg ax, ax
  6755. +
  6756. +loc_11B60:
  6757. + mov rcx, [rdi-8]
  6758. + sub rdi, 8
  6759. + call AcpiArblibFreeArbiterInstance
  6760. + add ebx, 0FFFFFFFFh
  6761. + jnz short loc_11B60
  6762. +
  6763. +loc_11B72:
  6764. + mov rcx, [rsp+40h]
  6765. + callex IoDeleteDevice
  6766. + mov eax, r12d
  6767. + jmp loc_11C46
  6768. +
  6769. +loc_11B85:
  6770. + mov rcx, 200000000000h
  6771. + test rcx, rax
  6772. + jz short loc_11BE3
  6773. + cmp [AcpiInternalDeviceTable], rbp
  6774. + jz short loc_11BE3
  6775. + lea r12, AcpiInternalDeviceTable
  6776. + mov rdx, r12
  6777. + mov rbx, r12
  6778. +
  6779. + ALIGN16
  6780. +loc_11BB0:
  6781. + mov rdx, [rdx]
  6782. + mov rcx, [rdi+1B0h]
  6783. + callex strstr
  6784. + test rax, rax
  6785. + jnz short loc_11BD5
  6786. + add rbx, 10h
  6787. + inc ebp
  6788. + cmp [rbx], rax
  6789. + mov rdx, rbx
  6790. + jnz short loc_11BB0
  6791. + jmp short loc_11BE3
  6792. +
  6793. +loc_11BD5:
  6794. + mov eax, ebp
  6795. + add rax, rax
  6796. + mov rax, [r12+rax*8+8]
  6797. + mov [rdi+10h], rax
  6798. +
  6799. +loc_11BE3:
  6800. + mov rax, [rdi]
  6801. + bt rax, 12h
  6802. + jnb short loc_11C0E
  6803. + mov rdx, 8000000000000h
  6804. + test rdx, rax
  6805. + mov rax, [FixedButtonDeviceObject]
  6806. + cmovnz rax, [rsp+40h]
  6807. + mov [FixedButtonDeviceObject], rax
  6808. +
  6809. +loc_11C0E:
  6810. + lea rcx, AcpiDeviceTreeLock
  6811. + movzx edx, sil
  6812. + callex KeReleaseSpinLock
  6813. + mov r11, [rsp+40h]
  6814. + mov rax, 10000000000000h
  6815. + and dword ptr [r11+30h], 0FFFFFF7Fh
  6816. + test [rdi], rax
  6817. + jz short loc_11C44
  6818. + mov rax, [rsp+40h]
  6819. + or dword ptr [rax+30h], 8
  6820. +
  6821. +loc_11C44:
  6822. + xor eax, eax
  6823. +
  6824. +loc_11C46:
  6825. + mov r12, [rsp+70h]
  6826. + mov rsi, [rsp+90h]
  6827. + mov r15, [rsp+58h]
  6828. +
  6829. +loc_11C58:
  6830. + mov r14, [rsp+60h]
  6831. + mov r13, [rsp+68h]
  6832. + mov rdi, [rsp+98h]
  6833. + mov rbp, [rsp+88h]
  6834. + mov rbx, [rsp+80h]
  6835. + add rsp, 78h
  6836. + ret
  6837. +ACPIBuildPdo ENDP
  6838. +
  6839. +
  6840. +PnpDeviceBiosResourcesToNtResources PROC
  6841. + sub rsp, 28h
  6842. + mov eax, r8d
  6843. + mov r10, rdx
  6844. + mov [rsp+30h], rbx
  6845. + mov rbx, rcx
  6846. + mov [rsp+38h], rbp
  6847. + mov r8, r9
  6848. + mov edx, eax
  6849. + mov rcx, r10
  6850. + mov [rsp+40h], rsi
  6851. + mov rsi, r9
  6852. + call PnpBiosResourcesToNtResources
  6853. + test eax, eax
  6854. + mov ebp, eax
  6855. + js loc_27080
  6856. + cmp qword ptr [rsi], 0
  6857. + jz loc_27080
  6858. + lea rcx, AcpiDeviceTreeLock
  6859. +
  6860. +loc_26FD7:
  6861. + mov [rsp+48h], rdi
  6862. + xor dil, dil
  6863. + callex KeAcquireSpinLockRaiseToDpc
  6864. + test rbx, rbx
  6865. + jz short loc_2700A
  6866. + mov rcx, 2000000000h
  6867. +
  6868. +loc_26FF4:
  6869. + test [rbx], rcx
  6870. + jnz short loc_27007
  6871. + mov rbx, [rbx+208h]
  6872. + test rbx, rbx
  6873. + jnz short loc_26FF4
  6874. + jmp short loc_2700A
  6875. +
  6876. +loc_27007:
  6877. + mov dil, 1
  6878. +
  6879. +loc_2700A:
  6880. + lea rcx, AcpiDeviceTreeLock
  6881. + movzx edx, al
  6882. + callex KeReleaseSpinLock
  6883. + test dil, dil
  6884. + mov rdi, [rsp+48h]
  6885. + jz short loc_2707E
  6886. +
  6887. +loc_27024:
  6888. + mov rax, [rsi]
  6889. + mov ecx, [rax+1Ch]
  6890. + lea r8, [rax+20h]
  6891. + test ecx, ecx
  6892. + jz short loc_2707E
  6893. + mov r9, rcx
  6894. +
  6895. + ALIGN16
  6896. +loc_27040:
  6897. + lea rdx, [r8+8]
  6898. + mov r8d, [r8+4]
  6899. + shl r8, 5
  6900. + add r8, rdx
  6901. + cmp rdx, r8
  6902. + jnb short loc_27079
  6903. +
  6904. +loc_27054:
  6905. + movzx ecx, byte ptr [rdx+1]
  6906. + dec ecx
  6907. + jz short loc_27066
  6908. + sub ecx, 2
  6909. + jz short loc_27066
  6910. + cmp ecx, 3
  6911. + jnz short loc_27070
  6912. +
  6913. +loc_27066:
  6914. + cmp byte ptr [rdx+2], 3
  6915. + jnz short loc_27070
  6916. + mov byte ptr [rdx+2], 1
  6917. +
  6918. +loc_27070:
  6919. + add rdx, 20h
  6920. + cmp rdx, r8
  6921. + jb short loc_27054
  6922. +
  6923. +loc_27079:
  6924. + dec r9
  6925. + jnz short loc_27040
  6926. +
  6927. +loc_2707E:
  6928. + mov eax, ebp
  6929. +
  6930. +loc_27080:
  6931. + mov rsi, [rsp+40h]
  6932. + mov rbp, [rsp+38h]
  6933. + mov rbx, [rsp+30h]
  6934. + add rsp, 28h
  6935. + ret
  6936. +PnpDeviceBiosResourcesToNtResources ENDP
  6937. +
  6938. +
  6939. +ACPIGetProcessorID PROC
  6940. + mov r11, rsp
  6941. + sub rsp, 88h
  6942. + mov rax, [__security_cookie]
  6943. + mov [rsp+38h], rax
  6944. + mov rax, [rsp+0B0h]
  6945. + mov [r11-8], rbx
  6946. + mov [r11-10h], rbp
  6947. + mov [r11-20h], rdi
  6948. + mov rdi, [AcpiProcessorString+8]
  6949. + mov [rsp+28h], rax
  6950. + mov eax, dword ptr [asmACPISlashName]
  6951. + lea rcx, [r11-58h]
  6952. + mov [r11-28h], r12
  6953. + mov r12, [rsp+0B8h]
  6954. + mov [rcx], eax
  6955. + movzx eax, word ptr [asmACPISlashName+4]
  6956. + mov [rcx+4], ax
  6957. + xor eax, eax
  6958. + mov [r11-30h], r13
  6959. + mov rcx, 0FFFFFFFFFFFFFFFFh
  6960. + mov word ptr [rsp+20h], 2Ah
  6961. + mov [r11-38h], r14
  6962. + repne scasb
  6963. + mov [r11-40h], r15
  6964. + lea rdi, [r11-58h]
  6965. + not rcx
  6966. + mov r15d, r9d
  6967. + xor ebx, ebx
  6968. + lea rbp, [rcx-1]
  6969. + mov rcx, 0FFFFFFFFFFFFFFFFh
  6970. + xor r13d, r13d
  6971. + repne scasb
  6972. + mov r14d, r9d
  6973. + not rcx
  6974. + add ebp, ecx
  6975. + and r15d, 40h
  6976. + jz loc_1E198
  6977. + mov r8d, 53706341h
  6978. + mov edx, ebp
  6979. + xor ecx, ecx
  6980. + mov edi, ebp
  6981. + callex ExAllocatePoolWithTag
  6982. + test rax, rax
  6983. + mov rbx, rax
  6984. + jnz short loc_1E0D9
  6985. + mov eax, 0C000009Ah
  6986. + jmp loc_1E320
  6987. +
  6988. +loc_1E0D9:
  6989. + mov r8, rdi
  6990. + xor edx, edx
  6991. + mov rcx, rax
  6992. + call memset
  6993. + mov rdx, [AcpiProcessorString+8]
  6994. + mov rcx, rbx
  6995. +
  6996. +loc_1E0F0:
  6997. + movzx eax, byte ptr [rdx]
  6998. + inc rcx
  6999. + inc rdx
  7000. + test al, al
  7001. + mov [rcx-1], al
  7002. + jnz short loc_1E0F0
  7003. + lea rdx, asmModelName
  7004. + mov rcx, rbx
  7005. + callex strstr
  7006. + lea rdx, asmFamilyName
  7007. + mov rcx, rbx
  7008. + mov r13, rax
  7009. + callex strstr
  7010. + test r13, r13
  7011. + mov r11, rax
  7012. + jz loc_1E1ED
  7013. + test rax, rax
  7014. + jz loc_1E1ED
  7015. + xor eax, eax
  7016. + lea rdi, [rsp+20h]
  7017. + mov rcx, 0FFFFFFFFFFFFFFFFh
  7018. + repne scasb
  7019. + lea rdi, [rsp+30h]
  7020. + not rcx
  7021. + lea rdx, [rcx-1]
  7022. + mov rcx, 0FFFFFFFFFFFFFFFFh
  7023. + repne scasb
  7024. + mov rdi, r11
  7025. + not rcx
  7026. + dec rcx
  7027. + add edx, ecx
  7028. + mov rcx, 0FFFFFFFFFFFFFFFFh
  7029. + lea eax, [rdx+rbp*2]
  7030. + lea ebp, [rax+rax*2]
  7031. + xor eax, eax
  7032. + repne scasb
  7033. + mov rdi, r13
  7034. + not rcx
  7035. + lea rdx, [rcx-1]
  7036. + mov rcx, 0FFFFFFFFFFFFFFFFh
  7037. + repne scasb
  7038. + not rcx
  7039. + dec rcx
  7040. + add edx, ecx
  7041. + add edx, edx
  7042. + sub ebp, edx
  7043. +
  7044. +loc_1E198:
  7045. + mov ecx, r14d
  7046. + mov r8d, 53706341h
  7047. + mov edx, ebp
  7048. + shr ecx, 1Ch
  7049. +
  7050. +loc_1E1A6:
  7051. + mov [rsp+70h], rsi
  7052. + mov edi, ebp
  7053. + not ecx
  7054. + and ecx, 1
  7055. + callex ExAllocatePoolWithTag
  7056. + test rax, rax
  7057. + mov rsi, rax
  7058. + jnz short loc_1E202
  7059. + mov rax, [rsp+28h]
  7060. + xor ecx, ecx
  7061. + test r12, r12
  7062. + mov [rax], rcx
  7063. + jz short loc_1E1D3
  7064. + mov [r12], ecx
  7065. +
  7066. +loc_1E1D3:
  7067. + test rbx, rbx
  7068. + jz short loc_1E1E3
  7069. + xor edx, edx
  7070. + mov rcx, rbx
  7071. + callex ExFreePoolWithTag
  7072. +
  7073. +loc_1E1E3:
  7074. + mov eax, 0C000009Ah
  7075. + jmp loc_1E31B
  7076. +
  7077. +loc_1E1ED:
  7078. + xor edx, edx
  7079. + mov rcx, rbx
  7080. + callex ExFreePoolWithTag
  7081. + mov eax, 0C0000001h
  7082. + jmp loc_1E320
  7083. +
  7084. +loc_1E202:
  7085. + mov r8, rdi
  7086. + xor edx, edx
  7087. + mov rcx, rax
  7088. + call memset
  7089. + test r14b, 20h
  7090. + jz short loc_1E236
  7091. + mov r9, [AcpiProcessorString+8]
  7092. + lea r8, [rsp+30h]
  7093. + lea rdx, asmStrStrName
  7094. + mov rcx, rsi
  7095. + callex sprintf
  7096. + jmp loc_1E2F4
  7097. +
  7098. +loc_1E236:
  7099. + test r15d, r15d
  7100. + jz loc_1E2F4
  7101. + lea r8, [rsp+30h]
  7102. + lea rdx, asmStrStrName
  7103. + mov r9, rbx
  7104. + mov rcx, rsi
  7105. + callex sprintf
  7106. + lea r8, [rsp+20h]
  7107. + lea rdx, asmStrStrName
  7108. + lea edi, [rax+1]
  7109. + mov r9, rbx
  7110. + mov ecx, edi
  7111. + add rcx, rsi
  7112. + callex sprintf
  7113. + lea r8, [rsp+30h]
  7114. + lea rdx, asmStrStrName
  7115. + add edi, eax
  7116. + mov r9, rbx
  7117. + mov byte ptr [r13-1], 0
  7118. + inc edi
  7119. + mov ecx, edi
  7120. + add rcx, rsi
  7121. + callex sprintf
  7122. + lea r8, [rsp+20h]
  7123. + lea rdx, asmStrStrName
  7124. + lea edi, [rdi+rax+1]
  7125. + mov r9, rbx
  7126. + mov ecx, edi
  7127. + add rcx, rsi
  7128. + callex sprintf
  7129. + lea r8, [rsp+30h]
  7130. + lea rdx, asmStrStrName
  7131. + add edi, eax
  7132. + mov r9, rbx
  7133. + mov byte ptr [r13-1], 0
  7134. + inc edi
  7135. + mov ecx, edi
  7136. + add rcx, rsi
  7137. + callex sprintf
  7138. + lea r8, [rsp+20h]
  7139. + lea rdx, asmStrStrName
  7140. + lea ecx, [rdi+rax+1]
  7141. + mov r9, rbx
  7142. + add rcx, rsi
  7143. + callex sprintf
  7144. +
  7145. +loc_1E2F4:
  7146. + test rbx, rbx
  7147. + jz short loc_1E304
  7148. + xor edx, edx
  7149. + mov rcx, rbx
  7150. + callex ExFreePoolWithTag
  7151. +
  7152. +loc_1E304:
  7153. + test r12, r12
  7154. + mov rax, [rsp+28h]
  7155. + mov [rax], rsi
  7156. + jz short loc_1E319
  7157. + lea eax, [rbp+rbp+0]
  7158. + mov [r12], eax
  7159. +
  7160. +loc_1E319:
  7161. + xor eax, eax
  7162. +
  7163. +loc_1E31B:
  7164. + mov rsi, [rsp+70h]
  7165. +
  7166. +loc_1E320:
  7167. + mov r15, [rsp+48h]
  7168. + mov r14, [rsp+50h]
  7169. + mov r13, [rsp+58h]
  7170. + mov r12, [rsp+60h]
  7171. + mov rdi, [rsp+68h]
  7172. + mov rbp, [rsp+78h]
  7173. + mov rbx, [rsp+80h]
  7174. + mov rcx, [rsp+38h]
  7175. + call __security_check_cookie
  7176. + add rsp, 88h
  7177. + ret
  7178. +ACPIGetProcessorID ENDP
  7179. +
  7180. +
  7181. +ACPIGetProcessorIDWide PROC
  7182. + mov r11, rsp
  7183. + sub rsp, 88h
  7184. + mov rax, [__security_cookie]
  7185. + mov [rsp+38h], rax
  7186. + mov rax, [rsp+0B0h]
  7187. + mov [r11-8], rbx
  7188. + mov [r11-10h], rbp
  7189. + mov [r11-20h], rdi
  7190. + mov rdi, [AcpiProcessorString+8]
  7191. + mov [rsp+28h], rax
  7192. + mov eax, dword ptr [asmACPISlashName]
  7193. + lea rcx, [r11-58h]
  7194. + mov [r11-28h], r12
  7195. + mov r12, [rsp+0B8h]
  7196. + mov [rcx], eax
  7197. + movzx eax, word ptr [asmACPISlashName+4]
  7198. + mov [rcx+4], ax
  7199. + xor eax, eax
  7200. + mov [r11-30h], r13
  7201. + mov rcx, 0FFFFFFFFFFFFFFFFh
  7202. + mov word ptr [rsp+20h], 2Ah
  7203. + mov [r11-38h], r14
  7204. + repne scasb
  7205. + lea rdi, [r11-58h]
  7206. + xor ebx, ebx
  7207. + not rcx
  7208. + xor r14d, r14d
  7209. + xor r13d, r13d
  7210. + lea rbp, [rcx-1]
  7211. + mov rcx, 0FFFFFFFFFFFFFFFFh
  7212. + mov [r11-40h], r15
  7213. + repne scasb
  7214. + mov eax, r9d
  7215. + mov r15d, r9d
  7216. + not rcx
  7217. + add ebp, ecx
  7218. + and eax, 40h
  7219. + mov [rsp+24h], eax
  7220. + jz loc_1E4F8
  7221. + mov r8d, 53706341h
  7222. + mov edx, ebp
  7223. + xor ecx, ecx
  7224. + mov edi, ebp
  7225. + callex ExAllocatePoolWithTag
  7226. + test rax, rax
  7227. + mov rbx, rax
  7228. + jnz short loc_1E42F
  7229. + mov eax, 0C000009Ah
  7230. + jmp loc_1E683
  7231. +
  7232. +loc_1E42F:
  7233. + mov r8, rdi
  7234. + xor edx, edx
  7235. + mov rcx, rax
  7236. + call memset
  7237. + mov rdx, [AcpiProcessorString+8]
  7238. + mov rcx, rbx
  7239. +
  7240. + ALIGN16
  7241. +loc_1E450:
  7242. + movzx eax, byte ptr [rdx]
  7243. + inc rcx
  7244. + inc rdx
  7245. + test al, al
  7246. + mov [rcx-1], al
  7247. + jnz short loc_1E450
  7248. + lea rdx, asmModelName
  7249. + mov rcx, rbx
  7250. + callex strstr
  7251. + lea rdx, asmFamilyName
  7252. + mov rcx, rbx
  7253. + mov r14, rax
  7254. + callex strstr
  7255. + test r14, r14
  7256. + mov r13, rax
  7257. + jz loc_1E551
  7258. + test rax, rax
  7259. + jz loc_1E551
  7260. + xor eax, eax
  7261. + lea rdi, [rsp+20h]
  7262. + mov rcx, 0FFFFFFFFFFFFFFFFh
  7263. + repne scasb
  7264. + lea rdi, [rsp+30h]
  7265. + not rcx
  7266. + lea rdx, [rcx-1]
  7267. + mov rcx, 0FFFFFFFFFFFFFFFFh
  7268. + repne scasb
  7269. + mov rdi, r13
  7270. + not rcx
  7271. + dec rcx
  7272. + add edx, ecx
  7273. + mov rcx, 0FFFFFFFFFFFFFFFFh
  7274. + lea eax, [rdx+rbp*2]
  7275. + lea ebp, [rax+rax*2]
  7276. + xor eax, eax
  7277. + repne scasb
  7278. + mov rdi, r14
  7279. + not rcx
  7280. + lea rdx, [rcx-1]
  7281. + mov rcx, 0FFFFFFFFFFFFFFFFh
  7282. + repne scasb
  7283. + not rcx
  7284. + dec rcx
  7285. + add edx, ecx
  7286. + add edx, edx
  7287. + sub ebp, edx
  7288. +
  7289. +loc_1E4F8:
  7290. + mov ecx, r15d
  7291. + mov edi, ebp
  7292. + mov r8d, 53706341h
  7293. + shr ecx, 1Ch
  7294. + add rdi, rdi
  7295. +
  7296. +loc_1E509:
  7297. + mov [rsp+70h], rsi
  7298. + not ecx
  7299. + mov rdx, rdi
  7300. + and ecx, 1
  7301. + callex ExAllocatePoolWithTag
  7302. + test rax, rax
  7303. + mov rsi, rax
  7304. + jnz short loc_1E566
  7305. + mov rax, [rsp+28h]
  7306. + xor ecx, ecx
  7307. + test r12, r12
  7308. + mov [rax], rcx
  7309. + jz short loc_1E537
  7310. + mov [r12], ecx
  7311. +
  7312. +loc_1E537:
  7313. + test rbx, rbx
  7314. + jz short loc_1E547
  7315. + xor edx, edx
  7316. + mov rcx, rbx
  7317. + callex ExFreePoolWithTag
  7318. +
  7319. +loc_1E547:
  7320. + mov eax, 0C000009Ah
  7321. + jmp loc_1E67E
  7322. +
  7323. +loc_1E551:
  7324. + xor edx, edx
  7325. + mov rcx, rbx
  7326. + callex ExFreePoolWithTag
  7327. + mov eax, 0C0000001h
  7328. + jmp loc_1E683
  7329. +
  7330. +loc_1E566:
  7331. + mov r8, rdi
  7332. + xor edx, edx
  7333. + mov rcx, rax
  7334. + call memset
  7335. + test r15b, 20h
  7336. + jz short loc_1E59A
  7337. + mov r9, [AcpiProcessorString+8]
  7338. + lea r8, [rsp+30h]
  7339. + lea rdx, asmSTRSTRBIGName
  7340. + mov rcx, rsi
  7341. + callex swprintf
  7342. + jmp loc_1E657
  7343. +
  7344. +loc_1E59A:
  7345. + cmp dword ptr [rsp+24h], 0
  7346. + jz loc_1E657
  7347. + lea r8, [rsp+30h]
  7348. + lea rdx, asmSTRSTRBIGName
  7349. + mov r9, rbx
  7350. + mov rcx, rsi
  7351. + callex swprintf
  7352. + lea r8, [rsp+20h]
  7353. + lea rdx, asmSTRSTRBIGName
  7354. + lea edi, [rax+1]
  7355. + mov r9, rbx
  7356. + lea rcx, [rsi+rdi*2]
  7357. + callex swprintf
  7358. + lea r8, [rsp+30h]
  7359. + lea rdx, asmSTRSTRBIGName
  7360. + add edi, eax
  7361. + mov r9, rbx
  7362. + mov byte ptr [r14-1], 0
  7363. + inc edi
  7364. + lea rcx, [rsi+rdi*2]
  7365. + callex swprintf
  7366. + lea r8, [rsp+20h]
  7367. + lea rdx, asmSTRSTRBIGName
  7368. + lea edi, [rdi+rax+1]
  7369. + mov r9, rbx
  7370. + lea rcx, [rsi+rdi*2]
  7371. + callex swprintf
  7372. + lea r8, [rsp+30h]
  7373. + lea rdx, asmSTRSTRBIGName
  7374. + add edi, eax
  7375. + mov r9, rbx
  7376. + mov byte ptr [r13-1], 0
  7377. + inc edi
  7378. + lea rcx, [rsi+rdi*2]
  7379. + callex swprintf
  7380. + lea r8, [rsp+20h]
  7381. + lea rdx, asmSTRSTRBIGName
  7382. + lea ecx, [rdi+rax+1]
  7383. + mov r9, rbx
  7384. + lea rcx, [rsi+rcx*2]
  7385. + callex swprintf
  7386. +
  7387. +loc_1E657:
  7388. + test rbx, rbx
  7389. + jz short loc_1E667
  7390. + xor edx, edx
  7391. + mov rcx, rbx
  7392. + callex ExFreePoolWithTag
  7393. +
  7394. +loc_1E667:
  7395. + test r12, r12
  7396. + mov rax, [rsp+28h]
  7397. + mov [rax], rsi
  7398. + jz short loc_1E67C
  7399. + lea eax, [rbp+rbp+0]
  7400. + mov [r12], eax
  7401. +
  7402. +loc_1E67C:
  7403. + xor eax, eax
  7404. +
  7405. +loc_1E67E:
  7406. + mov rsi, [rsp+70h]
  7407. +
  7408. +loc_1E683:
  7409. + mov r15, [rsp+48h]
  7410. + mov r14, [rsp+50h]
  7411. + mov r13, [rsp+58h]
  7412. + mov r12, [rsp+60h]
  7413. + mov rdi, [rsp+68h]
  7414. + mov rbp, [rsp+78h]
  7415. + mov rbx, [rsp+80h]
  7416. + mov rcx, [rsp+38h]
  7417. + call __security_check_cookie
  7418. + add rsp, 88h
  7419. + ret
  7420. +ACPIGetProcessorIDWide ENDP
  7421. +
  7422. +
  7423. +ACPIRegReadEntireSimulatorAcpiTable PROC
  7424. + sub rsp, 78h
  7425. + mov rax, [__security_cookie]
  7426. + mov [rsp+38h], rax
  7427. + mov [rsp+70h], rsi
  7428. + mov rsi, [rdx]
  7429. + mov [rsp+60h], r12
  7430. + mov r12, rdx
  7431. + mov [rsp+58h], r13
  7432. + mov [rsp+48h], r15
  7433. + mov r15, rcx
  7434. + mov edx, 2000h
  7435. + mov r8d, 53637041h
  7436. + mov ecx, 1
  7437. + callex ExAllocatePoolWithTag
  7438. + test rax, rax
  7439. + mov r13, rax
  7440. + jnz short loc_3B2F5
  7441. + mov eax, 0C000009Ah
  7442. + jmp loc_3B473
  7443. +
  7444. +loc_3B2F5:
  7445. + mov [rsp+90h], rbx
  7446. + mov [rsp+98h], rbp
  7447. + lea rdx, asmFormat1Name
  7448. + lea rcx, [rsp+28h]
  7449. + mov [rsp+68h], rdi
  7450. + xor r8d, r8d
  7451. + mov [rsp+50h], r14
  7452. + xor r14d, r14d
  7453. + callex sprintf
  7454. + lea r9, [rsp+20h]
  7455. + lea rcx, [rsp+28h]
  7456. + mov r8, r13
  7457. + mov rdx, r15
  7458. + mov dword ptr [rsp+20h], 2000h
  7459. + call OSReadRegValue
  7460. + test eax, eax
  7461. + js loc_3B433
  7462. +
  7463. + ALIGN16
  7464. +loc_3B350:
  7465. + mov eax, [rsp+20h]
  7466. + cmp eax, 8
  7467. + jb loc_3B442
  7468. + xor edi, edi
  7469. + test eax, eax
  7470. + jz loc_3B3F7
  7471. +
  7472. + ALIGN16
  7473. +loc_3B370:
  7474. + mov ebx, edi
  7475. + add rbx, r13
  7476. + mov eax, [rbx+4]
  7477. + test eax, eax
  7478. + jnz short loc_3B3D4
  7479. + mov eax, [rbx]
  7480. + lea rbp, [rsi+4]
  7481. + cmp eax, [rbp+0]
  7482. + jz short loc_3B3E6
  7483. + mov rdx, rax
  7484. + xor ecx, ecx
  7485. + mov r8d, 74706341h
  7486. + callex ExAllocatePoolWithTag
  7487. + test rax, rax
  7488. + mov rsi, rax
  7489. + jz loc_3B449
  7490. + mov ecx, [rbx]
  7491. + mov edx, [rbp+0]
  7492. + cmp ecx, edx
  7493. + cmovb edx, ecx
  7494. + mov rcx, rax
  7495. + mov r8d, edx
  7496. + mov rdx, [r12]
  7497. + call memcpy
  7498. + mov rcx, [r12]
  7499. + test rcx, rcx
  7500. + jz short loc_3B3CE
  7501. + xor edx, edx
  7502. + callex ExFreePoolWithTag
  7503. +
  7504. +loc_3B3CE:
  7505. + mov [r12], rsi
  7506. + jmp short loc_3B3E6
  7507. +
  7508. +loc_3B3D4:
  7509. + mov ecx, [rbx]
  7510. + lea rdx, [rbx+8]
  7511. + mov r8, rax
  7512. + add rcx, [r12]
  7513. + call memcpy
  7514. +
  7515. +loc_3B3E6:
  7516. + mov eax, [rbx+4]
  7517. + lea edi, [rdi+rax+8]
  7518. + cmp edi, [rsp+20h]
  7519. + jb loc_3B370
  7520. +
  7521. +loc_3B3F7:
  7522. + inc r14d
  7523. + lea rdx, asmFormat1Name
  7524. + lea rcx, [rsp+28h]
  7525. + mov r8d, r14d
  7526. + callex sprintf
  7527. + lea r9, [rsp+20h]
  7528. + lea rcx, [rsp+28h]
  7529. + mov r8, r13
  7530. + mov rdx, r15
  7531. + mov dword ptr [rsp+20h], 2000h
  7532. + call OSReadRegValue
  7533. + test eax, eax
  7534. + jns loc_3B350
  7535. +
  7536. +loc_3B433:
  7537. + xor edx, edx
  7538. + mov rcx, r13
  7539. + callex ExFreePoolWithTag
  7540. + xor eax, eax
  7541. + jmp short loc_3B459
  7542. +
  7543. +loc_3B442:
  7544. + mov eax, 0C0000001h
  7545. + jmp short loc_3B459
  7546. +
  7547. +loc_3B449:
  7548. + xor edx, edx
  7549. + mov rcx, r13
  7550. + callex ExFreePoolWithTag
  7551. + mov eax, 0C000009Ah
  7552. +
  7553. +loc_3B459:
  7554. + mov rdi, [rsp+68h]
  7555. + mov rbp, [rsp+98h]
  7556. + mov rbx, [rsp+90h]
  7557. + mov r14, [rsp+50h]
  7558. +
  7559. +loc_3B473:
  7560. + mov r15, [rsp+48h]
  7561. + mov r13, [rsp+58h]
  7562. + mov r12, [rsp+60h]
  7563. + mov rsi, [rsp+70h]
  7564. + mov rcx, [rsp+38h]
  7565. + call __security_check_cookie
  7566. + add rsp, 78h
  7567. + ret
  7568. +ACPIRegReadEntireSimulatorAcpiTable ENDP
  7569. +
  7570. +
  7571. +ACPIRegGetTableFromSimulatorRegistryEntry PROC
  7572. + mov rax, rsp
  7573. + sub rsp, 48h
  7574. + mov [rax+8], rbx
  7575. + mov [rax+10h], rbp
  7576. + mov rbp, [rcx]
  7577. + mov [rax+18h], rsi
  7578. + mov [rax+20h], rdi
  7579. + xor ebx, ebx
  7580. + mov [rax-8], r12
  7581. + mov [rax-18h], r14
  7582. + mov r12, rcx
  7583. + mov r14d, 1
  7584. + lea edx, [rbx+6Ah]
  7585. + mov r8d, 53637041h
  7586. + mov ecx, r14d
  7587. + xor dil, dil
  7588. + mov [rax-20h], rbx
  7589. + mov [rax-28h], rbx
  7590. + callex ExAllocatePoolWithTag
  7591. + test rax, rax
  7592. + mov rsi, rax
  7593. + jz loc_3B8E5
  7594. + xor edx, edx
  7595. + mov rcx, rax
  7596. +
  7597. +loc_3B78B:
  7598. + mov [rsp+38h], r13
  7599. + lea r8d, [rdx+6Ah]
  7600. + call memset
  7601. + lea rdx, SimulatorRegEntry
  7602. + mov r8d, 54h
  7603. + mov rcx, rsi
  7604. + call memcpy
  7605. + lea r11, [rsi+54h]
  7606. + mov r8d, ebx
  7607. + inc r11
  7608. + mov byte ptr [r11-1], 5Ch
  7609. + mov rdx, rbp
  7610. + mov r9, r11
  7611. + mov r13d, 5Fh
  7612. + sub r9, rbp
  7613. +
  7614. + ALIGN16
  7615. +loc_3B7D0:
  7616. + movzx ecx, byte ptr [rdx]
  7617. + test cl, cl
  7618. + jz short loc_3B7F2
  7619. + cmp cl, 20h
  7620. + movzx eax, cl
  7621. + cmovz eax, r13d
  7622. + inc r8d
  7623. + inc rdx
  7624. + cmp r8d, 4
  7625. + mov [r9+rdx-1], al
  7626. + jb short loc_3B7D0
  7627. +
  7628. +loc_3B7F2:
  7629. + mov r10d, r8d
  7630. + lea rdx, [rbp+0Ah]
  7631. + mov r8d, ebx
  7632. + add r10, r11
  7633. + inc r10
  7634. + mov byte ptr [r10-1], 5Ch
  7635. + mov r9, r10
  7636. + sub r9, rdx
  7637. +
  7638. + ALIGN16
  7639. +loc_3B810:
  7640. + movzx ecx, byte ptr [rdx]
  7641. + test cl, cl
  7642. + jz short loc_3B832
  7643. + cmp cl, 20h
  7644. + movzx eax, cl
  7645. + cmovz eax, r13d
  7646. + inc r8d
  7647. + inc rdx
  7648. + cmp r8d, 6
  7649. + mov [r9+rdx-1], al
  7650. + jb short loc_3B810
  7651. +
  7652. +loc_3B832:
  7653. + mov r9d, r8d
  7654. + lea rdx, [rbp+10h]
  7655. + add r9, r10
  7656. + lea r8, [r9+1]
  7657. + mov byte ptr [r9], 5Ch
  7658. + sub r8, rdx
  7659. +
  7660. +loc_3B847:
  7661. + movzx ecx, byte ptr [rdx]
  7662. + test cl, cl
  7663. + jz short loc_3B867
  7664. + cmp cl, 20h
  7665. + movzx eax, cl
  7666. + cmovz eax, r13d
  7667. + inc ebx
  7668. + inc rdx
  7669. + cmp ebx, 8
  7670. + mov [r8+rdx-1], al
  7671. + jb short loc_3B847
  7672. +
  7673. +loc_3B867:
  7674. + mov byte ptr [rbx+r9+1], 0
  7675. + lea r8, [rsp+20h]
  7676. + xor edx, edx
  7677. + mov rcx, rsi
  7678. + mov byte ptr [rbx+r9+1], 0
  7679. + call OSOpenHandle
  7680. + mov r13, [rsp+38h]
  7681. + test eax, eax
  7682. + js short loc_3B8B9
  7683. +
  7684. +loc_3B88B:
  7685. + mov r8d, [rbp+18h]
  7686. + mov rcx, [rsp+20h]
  7687. + lea rdx, [rsp+28h]
  7688. + call OSOpenLargestSubkey
  7689. + test eax, eax
  7690. + js short loc_3B8B9
  7691. + mov rcx, [rsp+28h]
  7692. + mov rdx, r12
  7693. + call ACPIRegReadEntireSimulatorAcpiTable
  7694. + movzx edi, dil
  7695. + test eax, eax
  7696. + cmovns edi, r14d
  7697. +
  7698. +loc_3B8B9:
  7699. + xor edx, edx
  7700. + mov rcx, rsi
  7701. + callex ExFreePoolWithTag
  7702. + mov rcx, [rsp+20h]
  7703. + test rcx, rcx
  7704. + jz short loc_3B8D3
  7705. + call OSCloseHandle
  7706. +
  7707. +loc_3B8D3:
  7708. + mov rcx, [rsp+28h]
  7709. + test rcx, rcx
  7710. + jz short loc_3B8E2
  7711. + call OSCloseHandle
  7712. +
  7713. +loc_3B8E2:
  7714. + mov al, dil
  7715. +
  7716. +loc_3B8E5:
  7717. + mov r14, [rsp+30h]
  7718. + mov r12, [rsp+40h]
  7719. + mov rdi, [rsp+68h]
  7720. + mov rsi, [rsp+60h]
  7721. + mov rbp, [rsp+58h]
  7722. + mov rbx, [rsp+50h]
  7723. + add rsp, 48h
  7724. + ret
  7725. +ACPIRegGetTableFromSimulatorRegistryEntry ENDP
  7726. +
  7727. +
  7728. +ACPIEnumerateTables PROC
  7729. + sub rsp, 58h
  7730. + mov rax, AcpiInformation
  7731. + mov [rsp+60h], rbx
  7732. + mov [rsp+70h], rsi
  7733. + mov r8, [rax]
  7734. + mov [rsp+78h], rdi
  7735. + xor ebx, ebx
  7736. + mov [rsp+48h], r13
  7737. + xor r13b, r13b
  7738. + cmp dword ptr [r8], 54445358h
  7739. + mov [rsp+38h], r15
  7740. + mov rsi, rcx
  7741. + mov [rsp+20h], ebx
  7742. + mov r15, rdx
  7743. + jnz short loc_3AC0E
  7744. + mov eax, [r8+4]
  7745. + cmp eax, 24h
  7746. + jnb short loc_3ABFA
  7747. + mov rdi, rax
  7748. + mov rcx, rax
  7749. + mov r13b, 1
  7750. + sub rdi, rax
  7751. + shr rdi, 3
  7752. + jmp short loc_3AC2B
  7753. +
  7754. +loc_3ABFA:
  7755. + mov ecx, 24h
  7756. + mov rdi, rax
  7757. + mov r13b, 1
  7758. + sub rdi, rcx
  7759. + shr rdi, 3
  7760. + jmp short loc_3AC2B
  7761. +
  7762. +loc_3AC0E:
  7763. + mov eax, [r8+4]
  7764. + cmp eax, 24h
  7765. + jnb short loc_3AC1C
  7766. + mov rcx, rax
  7767. + jmp short loc_3AC21
  7768. +
  7769. +
  7770. +loc_3AC1C:
  7771. + mov ecx, 24h
  7772. +
  7773. +loc_3AC21:
  7774. + mov rdi, rax
  7775. + sub rdi, rcx
  7776. + shr rdi, 2
  7777. +
  7778. +loc_3AC2B:
  7779. + test edi, edi
  7780. + mov [rsp+68h], rbp
  7781. + mov [rsp+50h], r12
  7782. + mov [rsp+40h], r14
  7783. + jz loc_3ACE3
  7784. + test rdx, rdx
  7785. + lea ecx, [rdi*4]
  7786. + mov [rsp+20h], ecx
  7787. + jz loc_3ACEA
  7788. + mov eax, [rdx]
  7789. + cmp eax, ecx
  7790. + jnb short loc_3AC66
  7791. + mov ebx, 0C0000023h
  7792. + jmp loc_3ACEF
  7793. +
  7794. +loc_3AC66:
  7795. + mov r8, rax
  7796. + xor edx, edx
  7797. + mov rcx, rsi
  7798. + call memset
  7799. + test edi, edi
  7800. + mov r12d, ebx
  7801. + jz short loc_3ACEF
  7802. + mov r14d, 24h
  7803. + mov rbp, rbx
  7804. + sub r14, rsi
  7805. +
  7806. +loc_3AC86:
  7807. + test r13b, r13b
  7808. + jz short loc_3AC9C
  7809. + mov rax, AcpiInformation
  7810. + mov rcx, [rax]
  7811. + mov rcx, [rcx+rbp+24h]
  7812. + jmp short loc_3ACAD
  7813. +
  7814. +loc_3AC9C:
  7815. + mov rax, AcpiInformation
  7816. + lea rdx, [r14+rsi]
  7817. + mov rcx, [rax]
  7818. + mov ecx, [rdx+rcx]
  7819. +
  7820. +loc_3ACAD:
  7821. + xor r8d, r8d
  7822. + lea edx, [r8+24h]
  7823. + callex MmMapIoSpace
  7824. + test rax, rax
  7825. + mov rcx, rax
  7826. + jz short loc_3ACE3
  7827. + mov eax, [rax]
  7828. + mov edx, 24h
  7829. + mov [rsi], eax
  7830. + callex MmUnmapIoSpace
  7831. + inc r12d
  7832. + add rbp, 8
  7833. + add rsi, 4
  7834. + cmp r12d, edi
  7835. + jb short loc_3AC86
  7836. + jmp short loc_3ACEF
  7837. +
  7838. +loc_3ACE3:
  7839. + mov ebx, 0C0140019h
  7840. + jmp short loc_3ACEF
  7841. +
  7842. +loc_3ACEA:
  7843. + mov ebx, 0C000000Dh
  7844. +
  7845. +loc_3ACEF:
  7846. + mov edi, [rsp+20h]
  7847. + mov r14, [rsp+40h]
  7848. + mov r13, [rsp+48h]
  7849. + mov r12, [rsp+50h]
  7850. + mov rsi, [rsp+70h]
  7851. + mov rbp, [rsp+68h]
  7852. + mov [r15], edi
  7853. + mov r15, [rsp+38h]
  7854. + mov rdi, [rsp+78h]
  7855. + mov eax, ebx
  7856. + mov rbx, [rsp+60h]
  7857. + add rsp, 58h
  7858. + ret
  7859. +ACPIEnumerateTables ENDP
  7860. +
  7861. +
  7862. +AcpiArblibFreeArbiterInstance PROC
  7863. + push rbx
  7864. + sub rsp, 20h
  7865. + cmp byte ptr [rcx+80h], 0
  7866. + mov rbx, rcx
  7867. + jz short loc_4DCEE
  7868. + add rcx, 88h
  7869. + call ArbDeleteArbiterInstance
  7870. +
  7871. +loc_4DCEE:
  7872. + xor edx, edx
  7873. + mov rcx, rbx
  7874. + add rsp, 20h
  7875. + pop rbx
  7876. + jmp qword ptr [__imp_ExFreePoolWithTag]
  7877. +AcpiArblibFreeArbiterInstance ENDP
  7878. +
  7879. +
  7880. +ACPIMapNamedTable PROC
  7881. + mov [rsp+20h], r9
  7882. + mov [rsp+18h], r8
  7883. + mov [rsp+10h], rdx
  7884. + mov [rsp+8], ecx
  7885. + mov rax, rsp
  7886. + sub rsp, 88h
  7887. + mov r10, AcpiInformation
  7888. + mov [rax-8], rbx
  7889. + mov [rax-10h], rbp
  7890. + mov [rax-18h], rsi
  7891. + mov [rax-28h], r12
  7892. + xor ebp, ebp
  7893. + mov [rax-30h], r13
  7894. + mov [rax-38h], r14
  7895. + mov [rax-40h], r15
  7896. + xor r15b, r15b
  7897. + mov [rax-58h], rbp
  7898. + mov rax, [r10]
  7899. + xor r12b, r12b
  7900. + cmp dword ptr [rax], 54445358h
  7901. + mov rbx, r8
  7902. + mov r14, rdx
  7903. + mov [rsp+21h], r15b
  7904. + mov [rsp+20h], r15b
  7905. + mov rsi, rbp
  7906. + mov [rsp+24h], ebp
  7907. + jnz short loc_3A850
  7908. + mov eax, [rax+4]
  7909. + cmp eax, 24h
  7910. + jnb short loc_3A83A
  7911. + mov r13, rax
  7912. + mov rcx, rax
  7913. + mov byte ptr [rsp+20h], 1
  7914. + sub r13, rax
  7915. + shr r13, 3
  7916. + jmp short loc_3A86C
  7917. +
  7918. +loc_3A83A:
  7919. + mov ecx, 24h
  7920. + mov r13, rax
  7921. + mov byte ptr [rsp+20h], 1
  7922. + sub r13, rcx
  7923. + shr r13, 3
  7924. + jmp short loc_3A86C
  7925. +
  7926. +loc_3A850:
  7927. + mov ecx, [rax+4]
  7928. + cmp ecx, 24h
  7929. + jnb short loc_3A85D
  7930. + mov rdx, rcx
  7931. + jmp short loc_3A862
  7932. +
  7933. +loc_3A85D:
  7934. + mov edx, 24h
  7935. +
  7936. +loc_3A862:
  7937. + mov r13, rcx
  7938. + sub r13, rdx
  7939. + shr r13, 2
  7940. +
  7941. +loc_3A86C:
  7942. + test r13d, r13d
  7943. + jnz short loc_3A87B
  7944. + mov eax, 0C0140019h
  7945. + jmp loc_3AB61
  7946. +
  7947. +loc_3A87B:
  7948. + test r13d, r13d
  7949. +
  7950. +loc_3A87E:
  7951. + mov [rsp+68h], rdi
  7952. + mov [rsp+28h], ebp
  7953. + jz loc_3AA28
  7954. + mov rdi, [rsp+30h]
  7955. + mov r14, rbp
  7956. + mov r15d, 24h
  7957. + jmp short loc_3A8A7
  7958. +
  7959. + ALIGN16
  7960. +loc_3A8A0:
  7961. + mov r10, AcpiInformation
  7962. +
  7963. +loc_3A8A7:
  7964. + cmp [rsp+20h], bpl
  7965. + jz short loc_3A8B8
  7966. + mov rbx, [r10]
  7967. + mov rbx, [r14+rbx+24h]
  7968. + jmp short loc_3A8BF
  7969. +
  7970. +loc_3A8B8:
  7971. + mov rax, [r10]
  7972. + mov ebx, [r15+rax]
  7973. +
  7974. +loc_3A8BF:
  7975. + xor r8d, r8d
  7976. + mov rcx, rbx
  7977. + lea edx, [r8+24h]
  7978. + callex MmMapIoSpace
  7979. + test rax, rax
  7980. + mov rsi, rax
  7981. + mov [rsp+30h], rax
  7982. + jz loc_3A9A0
  7983. + mov eax, [rsp+90h]
  7984. + cmp [rsi], eax
  7985. + jnz short loc_3A94F
  7986. + mov rax, [rsp+98h]
  7987. + mov r12b, 1
  7988. + test rax, rax
  7989. + jz short loc_3A91F
  7990. + lea r8, [rsi+0Ah]
  7991. + sub r8, rax
  7992. +
  7993. +loc_3A902:
  7994. + movzx edx, byte ptr [rax]
  7995. + movzx ecx, byte ptr [rax+r8]
  7996. + sub edx, ecx
  7997. + jnz short loc_3A915
  7998. + inc rax
  7999. + test ecx, ecx
  8000. + jnz short loc_3A902
  8001. +
  8002. +loc_3A915:
  8003. + movzx r12d, r12b
  8004. + test edx, edx
  8005. + cmovnz r12d, ebp
  8006. +
  8007. +loc_3A91F:
  8008. + mov rax, [rsp+0A0h]
  8009. + test rax, rax
  8010. + jz short loc_3A94F
  8011. + lea r8, [rsi+10h]
  8012. + sub r8, rax
  8013. +
  8014. +loc_3A933:
  8015. + movzx edx, byte ptr [rax]
  8016. + movzx ecx, byte ptr [rax+r8]
  8017. + sub edx, ecx
  8018. + jnz short loc_3A946
  8019. + inc rax
  8020. + test ecx, ecx
  8021. + jnz short loc_3A933
  8022. +
  8023. +loc_3A946:
  8024. + test edx, edx
  8025. + jz short loc_3A94F
  8026. + xor r12b, r12b
  8027. + jmp short loc_3A954
  8028. +
  8029. +loc_3A94F:
  8030. + test r12b, r12b
  8031. + jnz short loc_3A9B5
  8032. +
  8033. +loc_3A954:
  8034. + mov edx, 24h
  8035. + mov rcx, rsi
  8036. + callex MmUnmapIoSpace
  8037. + mov eax, [rsp+28h]
  8038. + add r15, 4
  8039. + inc eax
  8040. + add r14, 8
  8041. + mov rdi, rbp
  8042. + cmp eax, r13d
  8043. + mov rsi, rbp
  8044. + mov [rsp+30h], rbp
  8045. + mov [rsp+28h], eax
  8046. + jb loc_3A8A0
  8047. + mov rbx, [rsp+0A0h]
  8048. + mov r14, [rsp+98h]
  8049. + xor r12b, r12b
  8050. + jmp loc_3AA39
  8051. +
  8052. +loc_3A9A0:
  8053. + mov r14d, [rsp+24h]
  8054. + xor r15b, r15b
  8055. + mov ebp, 0C0140019h
  8056. + xor r12b, r12b
  8057. + jmp loc_3AB22
  8058. +
  8059. +loc_3A9B5:
  8060. + mov r14d, [rsi+4]
  8061. + mov edx, 24h
  8062. + mov rcx, rsi
  8063. + mov [rsp+24h], r14d
  8064. + callex MmUnmapIoSpace
  8065. + mov rdx, r14
  8066. + xor r8d, r8d
  8067. + mov rcx, rbx
  8068. + mov rdi, rbp
  8069. + callex MmMapIoSpace
  8070. + test rax, rax
  8071. + mov rsi, rax
  8072. + mov [rsp+30h], rax
  8073. + jnz short loc_3A9FB
  8074. + xor r15b, r15b
  8075. + mov ebp, 0C0140019h
  8076. + xor r12b, r12b
  8077. + jmp loc_3AB22
  8078. +
  8079. +loc_3A9FB:
  8080. + lea rcx, [rsp+30h]
  8081. + mov dl, 1
  8082. + call ACPIRegReadAMLRegistryEntry
  8083. + mov rsi, [rsp+30h]
  8084. + mov rbx, [rsp+0A0h]
  8085. + mov r14, [rsp+98h]
  8086. + mov rdi, rsi
  8087. + movzx r12d, al
  8088. + xor r15b, r15b
  8089. + jmp short loc_3AA30
  8090. +
  8091. +loc_3AA28:
  8092. + mov rdi, [rsp+30h]
  8093. + xor r12b, r12b
  8094. +
  8095. +loc_3AA30:
  8096. + test rdi, rdi
  8097. + jnz loc_3AAF1
  8098. +
  8099. +loc_3AA39:
  8100. + cmp [g_AmliHookEnabled], ebp
  8101. + jz loc_3AADB
  8102. + mov edx, 24h
  8103. + xor ecx, ecx
  8104. + mov r8d, 74706341h
  8105. + mov [rsp+28h], rbp
  8106. + callex ExAllocatePoolWithTag
  8107. + test rax, rax
  8108. + mov [rsp+28h], rax
  8109. + jz short loc_3AAD6
  8110. + xor ecx, ecx
  8111. + test r14, r14
  8112. + mov [rax], rcx
  8113. + mov [rax+8], rcx
  8114. + mov [rax+10h], rcx
  8115. + mov [rax+18h], rcx
  8116. + mov [rax+20h], ecx
  8117. + mov rax, [rsp+28h]
  8118. + mov ecx, [rsp+90h]
  8119. + mov [rax], ecx
  8120. + mov rax, [rsp+28h]
  8121. + mov dword ptr [rax+4], 24h
  8122. + jz short loc_3AAA5
  8123. + mov rax, [rsp+28h]
  8124. + mov ecx, [r14]
  8125. + mov [rax+0Ah], ecx
  8126. +
  8127. +loc_3AAA5:
  8128. + test rbx, rbx
  8129. + jz short loc_3AAB6
  8130. + mov rax, [rsp+28h]
  8131. + mov rcx, [rbx]
  8132. + mov [rax+10h], rcx
  8133. +
  8134. +loc_3AAB6:
  8135. + lea rcx, [rsp+28h]
  8136. + call ACPIRegGetTableFromSimulatorRegistryEntry
  8137. + test al, al
  8138. + movzx r15d, al
  8139. + mov [rsp+21h], al
  8140. + jz short loc_3AAD6
  8141. + mov rdi, [rsp+28h]
  8142. + test rdi, rdi
  8143. + jnz short loc_3AAEC
  8144. +
  8145. +loc_3AAD6:
  8146. + mov rsi, [rsp+30h]
  8147. +
  8148. +loc_3AADB:
  8149. + mov r14d, [rsp+24h]
  8150. + mov r15b, [rsp+21h]
  8151. + mov ebp, 0C0000225h
  8152. + jmp short loc_3AB22
  8153. +
  8154. +loc_3AAEC:
  8155. + mov rsi, [rsp+30h]
  8156. +
  8157. +loc_3AAF1:
  8158. + mov rbx, [rsp+0B0h]
  8159. + mov r14d, [rdi+4]
  8160. + cmp [rbx], r14d
  8161. + jnb short loc_3AB0C
  8162. + mov [rbx], r14d
  8163. + mov ebp, 0C0000023h
  8164. + jmp short loc_3AB22
  8165. +
  8166. +loc_3AB0C:
  8167. + mov rcx, [rsp+0A8h]
  8168. + mov r8, r14
  8169. + mov rdx, rdi
  8170. + call memcpy
  8171. + mov [rbx], r14d
  8172. +
  8173. +loc_3AB22:
  8174. + test rsi, rsi
  8175. + jz short loc_3AB45
  8176. + test r12b, r12b
  8177. + jz short loc_3AB39
  8178. + xor edx, edx
  8179. + mov rcx, rsi
  8180. + callex ExFreePoolWithTag
  8181. + jmp short loc_3AB45
  8182. +
  8183. +loc_3AB39:
  8184. + mov edx, r14d
  8185. + mov rcx, rsi
  8186. + callex MmUnmapIoSpace
  8187. +
  8188. +loc_3AB45:
  8189. + test r15b, r15b
  8190. + jz short loc_3AB5A
  8191. + test rdi, rdi
  8192. + jz short loc_3AB5A
  8193. + xor edx, edx
  8194. + mov rcx, rdi
  8195. + callex ExFreePoolWithTag
  8196. +
  8197. +loc_3AB5A:
  8198. + mov rdi, [rsp+68h]
  8199. + mov eax, ebp
  8200. +
  8201. +loc_3AB61:
  8202. + mov r15, [rsp+48h]
  8203. + mov r14, [rsp+50h]
  8204. + mov r13, [rsp+58h]
  8205. + mov r12, [rsp+60h]
  8206. + mov rsi, [rsp+70h]
  8207. + mov rbp, [rsp+78h]
  8208. + mov rbx, [rsp+80h]
  8209. + add rsp, 88h
  8210. + ret
  8211. +ACPIMapNamedTable ENDP
  8212. +
  8213. +
  8214. +ACPIEnumMapTableHandler PROC
  8215. + sub rsp, 38h
  8216. + mov edx, [rcx+4]
  8217. + test edx, edx
  8218. + jz short loc_3AD68
  8219. + dec edx
  8220. + jz short loc_3AD49
  8221. + mov eax, 0C0000002h
  8222. + add rsp, 38h
  8223. + ret
  8224. +
  8225. +loc_3AD49:
  8226. + lea rax, [rcx+0Ch]
  8227. + lea r9, [rcx+10h]
  8228. + mov ecx, [rcx+8]
  8229. + xor r8d, r8d
  8230. + xor edx, edx
  8231. + mov [rsp+20h], rax
  8232. + call ACPIMapNamedTable
  8233. + add rsp, 38h
  8234. + ret
  8235. +
  8236. +loc_3AD68:
  8237. + lea rdx, [rcx+0Ch]
  8238. + add rcx, 10h
  8239. + add rsp, 38h
  8240. + jmp ACPIEnumerateTables
  8241. +ACPIEnumMapTableHandler ENDP
  8242. +
  8243. +
  8244. +ACPIInitializeKernelTableHandler PROC
  8245. + sub rsp, 48h
  8246. + mov r8d, 18h
  8247. + mov [rsp+24h], cl
  8248. + lea rax, ACPIEnumMapTableHandler
  8249. + mov [rsp+30h], rdx
  8250. + lea ecx, [r8+33h]
  8251. + lea rdx, [rsp+20h]
  8252. + mov dword ptr [rsp+20h], 41435049h
  8253. + mov [rsp+28h], rax
  8254. + callex ZwSetSystemInformation
  8255. + add rsp, 48h
  8256. + ret
  8257. +ACPIInitializeKernelTableHandler ENDP
  8258. +
  8259. +
  8260. +AcpiArblibCommitResources PROC
  8261. + mov rax, rsp
  8262. + sub rsp, 88h
  8263. + cmp byte ptr [rcx+81h], 0
  8264. + mov [rax+8], rbx
  8265. + mov [rax+10h], rbp
  8266. + mov [rax-10h], r13
  8267. + mov r13d, [rcx+0A0h]
  8268. + mov rbx, rdx
  8269. + mov rbp, rcx
  8270. + jz short loc_4DE47
  8271. + mov rcx, [rcx+0A8h]
  8272. + callex RtlFreeRangeList
  8273. + mov byte ptr [rbp+83h], 0
  8274. + mov byte ptr [rbp+81h], 0
  8275. +
  8276. +loc_4DE47:
  8277. + mov [rsp+0A0h], rsi
  8278. + mov [rsp+0A8h], rdi
  8279. + mov [rsp+80h], r12
  8280. + mov [rsp+70h], r14
  8281. + xor r14d, r14d
  8282. + test rbx, rbx
  8283. + mov r12d, r14d
  8284. + jnz short loc_4DE7F
  8285. + lea rcx, [rsp+50h]
  8286. + callex RtlInitializeRangeList
  8287. + jmp loc_4DF2B
  8288. +
  8289. +loc_4DE7F:
  8290. + lea rcx, [rsp+50h]
  8291. + callex RtlInitializeRangeList
  8292. + mov eax, [rbx+10h]
  8293. + lea rdi, [rbx+14h]
  8294. + lea rcx, [rax+rax*4]
  8295. + lea rbx, [rdi+rcx*4]
  8296. + cmp rdi, rbx
  8297. + jnb loc_4DF2B
  8298. +
  8299. +loc_4DEA2:
  8300. + movzx eax, byte ptr [rdi]
  8301. + cmp eax, r13d
  8302. + jnz short loc_4DF1E
  8303. + lea rax, [rdi+14h]
  8304. + cmp rax, rbx
  8305. + jnb short loc_4DF1E
  8306. +
  8307. +loc_4DEB3:
  8308. + cmp byte ptr [rax], 81h
  8309. + jnz short loc_4DF1E
  8310. + cmp word ptr [rax+2], 1
  8311. + jz short loc_4DECA
  8312. + add rax, 14h
  8313. + cmp rax, rbx
  8314. + jb short loc_4DEB3
  8315. + jmp short loc_4DF1E
  8316. +
  8317. +loc_4DECA:
  8318. + lea r8, [rsp+40h]
  8319. + lea rdx, [rsp+48h]
  8320. + mov rcx, rdi
  8321. + call qword ptr [rbp+108h]
  8322. + test eax, eax
  8323. + mov esi, eax
  8324. + js short loc_4DF56
  8325. + mov eax, [rsp+40h]
  8326. + test eax, eax
  8327. + jz short loc_4DF1E
  8328. + mov rdx, [rsp+48h]
  8329. + mov [rsp+30h], r14
  8330. + lea rcx, [rsp+50h]
  8331. + lea r8, [rax+rdx-1]
  8332. + xor r9d, r9d
  8333. + mov [rsp+28h], r14
  8334. + mov dword ptr [rsp+20h], 3
  8335. + callex RtlAddRange
  8336. + test eax, eax
  8337. + mov esi, eax
  8338. + js short loc_4DF56
  8339. + inc r12d
  8340. +
  8341. +loc_4DF1E:
  8342. + add rdi, 14h
  8343. + cmp rdi, rbx
  8344. + jb loc_4DEA2
  8345. +
  8346. +loc_4DF2B:
  8347. + mov rcx, [rbp+0A8h]
  8348. + lea rdx, [rsp+50h]
  8349. + callex RtlInvertRangeList
  8350. + test eax, eax
  8351. + mov esi, eax
  8352. + js short loc_4DF56
  8353. + test r12d, r12d
  8354. + mov byte ptr [rbp+81h], 1
  8355. + jnz short loc_4DF56
  8356. + mov byte ptr [rbp+83h], 1
  8357. +
  8358. +loc_4DF56:
  8359. + lea rcx, [rsp+50h]
  8360. + callex RtlFreeRangeList
  8361. + mov r14, [rsp+70h]
  8362. + mov r13, [rsp+78h]
  8363. + mov r12, [rsp+80h]
  8364. + mov rdi, [rsp+0A8h]
  8365. + mov rbp, [rsp+98h]
  8366. + mov rbx, [rsp+90h]
  8367. + mov eax, esi
  8368. + mov rsi, [rsp+0A0h]
  8369. + add rsp, 88h
  8370. + ret
  8371. +AcpiArblibCommitResources ENDP
  8372. +
  8373. +_TEXT ends
  8374. + END
  8375. \ No newline at end of file
  8376. diff --strip-trailing-cr -ur ./driver/nt/arblib.c "c:\\ACPI\\ACPI_W2003\\Base\\busdrv\\acpi/driver/nt/arblib.c"
  8377. --- ./driver/nt/arblib.c 2022-12-15 06:55:55.852539000 +0500
  8378. +++ "c:\\ACPI\\ACPI_W2003\\Base\\busdrv\\acpi/driver/nt/arblib.c" 2022-04-06 22:47:01.715820300 +0500
  8379. @@ -0,0 +1,1423 @@
  8380. +#include "pch.h"
  8381. +
  8382. +WCHAR asmRootName[] = L"Root";
  8383. +WCHAR asmPortName[] = L"Port";
  8384. +WCHAR asmMemoryName[] = L"Memory";
  8385. +WCHAR asmBusNumberName[] = L"Bus Number";
  8386. +WCHAR asmACPIName[] = L"ACPI %s ";
  8387. +WCHAR asmFormat2Name[] = L"%C%C%C%C";
  8388. +WCHAR asmFormat3Name[] = L"%x";
  8389. +CHAR asmPciBarName[] = "PciBarTarget";
  8390. +CHAR asmACPI2Name[] = "ACPI\\%s";
  8391. +CHAR asmStar2Name[] = "*%s";
  8392. +WCHAR asmACPI2NameL[] = L"ACPI\\%S";
  8393. +WCHAR asmStar2NameL[] = L"*%S";
  8394. +
  8395. +
  8396. +ULONG AcpiArbiterInstanceCount;
  8397. +
  8398. +#ifdef _X86_
  8399. +
  8400. +extern VOID __cdecl _alldiv(VOID); // ntoskrnl.lib
  8401. +
  8402. +
  8403. +void __declspec(naked)
  8404. +ACPIConvertStringDelimitation(char *psIn, char Char) {
  8405. +_asm {
  8406. + mov edi, edi
  8407. + push ebp
  8408. + mov ebp, esp
  8409. + mov ecx, [ebp+8]
  8410. + test ecx, ecx
  8411. + jz short loc_28165
  8412. + mov eax, ecx
  8413. + push esi
  8414. + lea esi, [eax+1]
  8415. +
  8416. +loc_2813E:
  8417. + mov dl, [eax]
  8418. + inc eax
  8419. + test dl, dl
  8420. + jnz short loc_2813E
  8421. + sub eax, esi
  8422. + jmp short loc_2815C
  8423. +
  8424. +loc_28149:
  8425. + mov cl, [ebp+0Ch]
  8426. + mov [eax], cl
  8427. + mov ecx, eax
  8428. + lea esi, [ecx+1]
  8429. +
  8430. +loc_28153:
  8431. + mov dl, [ecx]
  8432. + inc ecx
  8433. + test dl, dl
  8434. + jnz short loc_28153
  8435. + sub ecx, esi
  8436. +
  8437. +loc_2815C:
  8438. + add eax, ecx
  8439. + cmp byte ptr [eax+1], 0
  8440. + jnz short loc_28149
  8441. + pop esi
  8442. +
  8443. +loc_28165:
  8444. + pop ebp
  8445. + retn 8
  8446. +}
  8447. +}
  8448. +
  8449. +
  8450. +VOID __declspec(naked)
  8451. +AcpiArblibReferenceArbiter() {
  8452. +_asm {
  8453. + push ebp
  8454. + mov ebp, esp
  8455. + mov ecx, [ebp+8]
  8456. + add ecx, 28h
  8457. + call dword ptr [InterlockedIncrement]
  8458. + pop ebp
  8459. + retn 4
  8460. +}
  8461. +}
  8462. +
  8463. +
  8464. +VOID __declspec(naked)
  8465. +AcpiArblibDereferenceArbiter() {
  8466. +_asm {
  8467. + push ebp
  8468. + mov ebp, esp
  8469. + mov ecx, [ebp+8]
  8470. + add ecx, 28h
  8471. + call dword ptr [InterlockedDecrement]
  8472. + pop ebp
  8473. + retn 4
  8474. +}
  8475. +}
  8476. +
  8477. +
  8478. +VOID __declspec(naked)
  8479. +AcpiArblibEjectInterface(VOID) {
  8480. +_asm {
  8481. + push ebp
  8482. + mov ebp, esp
  8483. + push esi
  8484. + push dword ptr [ebp+8]
  8485. + call ACPIInternalGetDeviceExtension
  8486. + mov ecx, [ebp+0Ch]
  8487. + mov edx, [ecx+60h]
  8488. + cmp word ptr [edx+0Ah], 0
  8489. + mov esi, [edx+10h]
  8490. + mov ecx, [edx+0Ch]
  8491. + jnz short loc_31C63
  8492. + cmp word ptr [edx+8], 18h
  8493. + jnb short loc_31C09
  8494. + mov eax, 0C000000Dh
  8495. + jmp short loc_31C68
  8496. +
  8497. +loc_31C09:
  8498. + cmp esi, 1
  8499. + jnz short loc_31C13
  8500. + mov eax, [eax+6Ch]
  8501. + jmp short loc_31C25
  8502. +
  8503. +loc_31C13:
  8504. + cmp esi, 3
  8505. + jnz short loc_31C1D
  8506. + mov eax, [eax+68h]
  8507. + jmp short loc_31C25
  8508. +
  8509. +loc_31C1D:
  8510. + cmp esi, 6
  8511. + jnz short loc_31C63
  8512. + mov eax, [eax+70h]
  8513. +
  8514. +loc_31C25:
  8515. + cmp byte ptr [eax+82h], 1
  8516. + jnz short loc_31C63
  8517. + and word ptr [ecx+2], 0
  8518. + and dword ptr [ecx+14h], 0
  8519. + add eax, 84h
  8520. + push eax
  8521. + mov word ptr [ecx], 18h
  8522. + mov [ecx+4], eax
  8523. + mov dword ptr [ecx+8], offset AcpiArblibReferenceArbiter
  8524. + mov dword ptr [ecx+0Ch], offset AcpiArblibDereferenceArbiter
  8525. + mov dword ptr [ecx+10h], offset ArbArbiterHandler
  8526. + call AcpiArblibReferenceArbiter
  8527. + xor eax, eax
  8528. + jmp short loc_31C68
  8529. +
  8530. +loc_31C63:
  8531. + mov eax, 0C00000BBh
  8532. +
  8533. +loc_31C68:
  8534. + pop esi
  8535. + pop ebp
  8536. + retn 8
  8537. +}
  8538. +}
  8539. +
  8540. +
  8541. +VOID __declspec(naked)
  8542. +AcpiArblibFreeArbiterInstance (ACPI_ARBITER_INSTANCE *CommonInstance) {
  8543. +__asm {
  8544. + push ebp
  8545. + mov ebp, esp
  8546. + push esi
  8547. + mov esi, [ebp+8]
  8548. + cmp byte ptr [esi+80h], 0
  8549. + jz short loc_31A24
  8550. + lea eax, [esi+84h]
  8551. + push eax
  8552. + call ArbDeleteArbiterInstance
  8553. +
  8554. +loc_31A24:
  8555. + push 0
  8556. + push esi
  8557. + call dword ptr[ExFreePoolWithTag]
  8558. + pop esi
  8559. + pop ebp
  8560. + retn 4
  8561. +}
  8562. +}
  8563. +
  8564. +
  8565. +NTSTATUS __declspec(naked)
  8566. +AcpiArblibCommitResources (ACPI_ARBITER_INSTANCE *CommonInstance, PVOID IrpStuff) {
  8567. +__asm {
  8568. + push ebp
  8569. + mov ebp, esp
  8570. + sub esp, 24h
  8571. + push ebx
  8572. + push esi
  8573. + mov esi, [ebp+8]
  8574. + cmp byte ptr [esi+81h], 0
  8575. + mov eax, [esi+90h]
  8576. + push edi
  8577. + mov [ebp-4], eax
  8578. + jz short loc_31AF4
  8579. + push dword ptr [esi+94h]
  8580. + call dword ptr[RtlFreeRangeList]
  8581. + mov byte ptr [esi+83h], 0
  8582. + mov byte ptr [esi+81h], 0
  8583. +
  8584. +loc_31AF4:
  8585. + and dword ptr [ebp+8], 0
  8586. + mov edi, [ebp+0Ch]
  8587. + lea eax, [ebp-24h]
  8588. + push eax
  8589. + call dword ptr[RtlInitializeRangeList]
  8590. + test edi, edi
  8591. + jz loc_31B97
  8592. + lea eax, [edi+14h]
  8593. + mov edi, [edi+10h]
  8594. + shl edi, 4
  8595. + add edi, eax
  8596. + mov ecx, eax
  8597. + cmp eax, edi
  8598. + jmp short loc_31B92
  8599. +
  8600. +loc_31B1E:
  8601. + movzx eax, byte ptr [ecx]
  8602. + cmp eax, [ebp-4]
  8603. + jnz short loc_31B8A
  8604. + lea eax, [ecx+10h]
  8605. + jmp short loc_31B3A
  8606. +
  8607. +loc_31B2B:
  8608. + cmp byte ptr [eax], 81h
  8609. + jnz short loc_31B8A
  8610. + cmp word ptr [eax+2], 1
  8611. + jz short loc_31B40
  8612. + add eax, 10h
  8613. +
  8614. +loc_31B3A:
  8615. + cmp eax, edi
  8616. + jb short loc_31B2B
  8617. + jmp short loc_31B8A
  8618. +
  8619. +loc_31B40:
  8620. + lea eax, [ebp-8]
  8621. + push eax
  8622. + lea eax, [ebp-10h]
  8623. + push eax
  8624. + push ecx
  8625. + call dword ptr [esi+0C4h]
  8626. + mov ebx, eax
  8627. + test ebx, ebx
  8628. + jl short loc_31BC1
  8629. + mov eax, [ebp-8]
  8630. + test eax, eax
  8631. + jbe short loc_31B8A
  8632. + xor ecx, ecx
  8633. + add eax, [ebp-10h]
  8634. + push ecx
  8635. + push ecx
  8636. + push 3
  8637. + push ecx
  8638. + adc ecx, [ebp-0Ch]
  8639. + add eax, 0FFFFFFFFh
  8640. + adc ecx, 0FFFFFFFFh
  8641. + push ecx
  8642. + push eax
  8643. + push dword ptr [ebp-0Ch]
  8644. + lea eax, [ebp-24h]
  8645. + push dword ptr [ebp-10h]
  8646. + push eax
  8647. + call dword ptr[RtlAddRange]
  8648. + mov ebx, eax
  8649. + test ebx, ebx
  8650. + jl short loc_31BC1
  8651. + inc dword ptr [ebp+8]
  8652. +
  8653. +loc_31B8A:
  8654. + mov ecx, [ebp+0Ch]
  8655. + add ecx, 10h
  8656. + cmp ecx, edi
  8657. +
  8658. +loc_31B92:
  8659. + mov [ebp+0Ch], ecx
  8660. + jb short loc_31B1E
  8661. +
  8662. +loc_31B97:
  8663. + lea eax, [ebp-24h]
  8664. + push eax
  8665. + push dword ptr [esi+94h]
  8666. + call dword ptr[RtlInvertRangeList]
  8667. + mov ebx, eax
  8668. + test ebx, ebx
  8669. + jl short loc_31BC1
  8670. + cmp dword ptr [ebp+8], 0
  8671. + mov byte ptr [esi+81h], 1
  8672. + jnz short loc_31BC1
  8673. + mov byte ptr [esi+83h], 1
  8674. +
  8675. +loc_31BC1:
  8676. + lea eax, [ebp-24h]
  8677. + push eax
  8678. + call dword ptr[RtlFreeRangeList]
  8679. + pop edi
  8680. + pop esi
  8681. + mov eax, ebx
  8682. + pop ebx
  8683. + _emit 0xc9 ; "leave" opcode
  8684. + retn 8
  8685. +}
  8686. +}
  8687. +
  8688. +
  8689. +VOID __declspec(naked)
  8690. +AcpiArblibUnpackRequirement() {
  8691. +_asm {
  8692. + push ebp
  8693. + mov ebp, esp
  8694. + mov eax, [ebp+8]
  8695. + mov cl, [eax+1]
  8696. + push ebx
  8697. + xor ebx, ebx
  8698. + inc ebx
  8699. + cmp cl, 3
  8700. + push esi
  8701. + jz short loc_3147C
  8702. + cmp cl, bl
  8703. + jz short loc_3147C
  8704. + cmp cl, 6
  8705. + jnz short loc_31475
  8706. + mov edx, [eax+0Ch]
  8707. + mov ecx, [ebp+0Ch]
  8708. + and dword ptr [ecx+4], 0
  8709. + mov esi, [ebp+14h]
  8710. + mov [ecx], edx
  8711. + mov edx, [eax+10h]
  8712. + mov ecx, [ebp+10h]
  8713. + and dword ptr [ecx+4], 0
  8714. + mov [ecx], edx
  8715. + mov edx, [eax+8]
  8716. + mov [esi], edx
  8717. + mov edx, [ebp+18h]
  8718. + mov [edx], ebx
  8719. + jmp short loc_314AE
  8720. +
  8721. +loc_31475:
  8722. + mov eax, 0C0000024h
  8723. + jmp short loc_314D4
  8724. +
  8725. +loc_3147C:
  8726. + mov edx, [eax+10h]
  8727. + mov ecx, [ebp+0Ch]
  8728. + mov esi, [ebp+14h]
  8729. + mov [ecx], edx
  8730. + mov edx, [eax+14h]
  8731. + mov [ecx+4], edx
  8732. + mov edx, [eax+18h]
  8733. + mov ecx, [ebp+10h]
  8734. + mov [ecx], edx
  8735. + mov edx, [eax+1Ch]
  8736. + mov [ecx+4], edx
  8737. + mov edx, [eax+8]
  8738. + mov [esi], edx
  8739. + mov edx, [eax+0Ch]
  8740. + test edx, edx
  8741. + mov esi, [ebp+18h]
  8742. + mov [esi], edx
  8743. + jnz short loc_314AE
  8744. + mov [esi], ebx
  8745. +
  8746. +loc_314AE:
  8747. + cmp byte ptr [eax+1], 3
  8748. + jnz short loc_314D2
  8749. + test byte ptr [eax+4], 10h
  8750. + jz short loc_314D2
  8751. + cmp dword ptr [eax+1Ch], 0
  8752. + jl short loc_314D2
  8753. + mov edx, 0FFFFFFh
  8754. + jg short loc_314CC
  8755. + cmp [eax+18h], edx
  8756. + jbe short loc_314D2
  8757. +
  8758. +loc_314CC:
  8759. + and dword ptr [ecx+4], 0
  8760. + mov [ecx], edx
  8761. +
  8762. +loc_314D2:
  8763. + xor eax, eax
  8764. +
  8765. +loc_314D4:
  8766. + pop esi
  8767. + pop ebx
  8768. + pop ebp
  8769. + retn 14h
  8770. +}
  8771. +}
  8772. +
  8773. +
  8774. +VOID __declspec(naked)
  8775. +AcpiArblibScoreRequirement() {
  8776. +_asm {
  8777. + push ebp
  8778. + mov ebp, esp
  8779. + sub esp, 14h
  8780. + and dword ptr [ebp-4], 0
  8781. + lea eax, [ebp-4]
  8782. + push eax
  8783. + lea eax, [ebp+8]
  8784. + push eax
  8785. + lea eax, [ebp-14h]
  8786. + push eax
  8787. + lea eax, [ebp-0Ch]
  8788. + push eax
  8789. + push dword ptr [ebp+8]
  8790. + call AcpiArblibUnpackRequirement
  8791. + test eax, eax
  8792. + jge short loc_31512
  8793. + push 50109h
  8794. + call _ACPIInternalError
  8795. +
  8796. +loc_31512:
  8797. + mov ecx, [ebp-4]
  8798. + test ecx, ecx
  8799. + jnz short loc_3151A
  8800. + inc ecx
  8801. +
  8802. +loc_3151A:
  8803. + push ebx
  8804. + xor eax, eax
  8805. + push esi
  8806. + push edi
  8807. + mov edx, ecx
  8808. + add edx, [ebp-0Ch]
  8809. + mov esi, eax
  8810. + adc esi, [ebp-8]
  8811. + sub edx, 1
  8812. + sbb esi, eax
  8813. + mov edi, ecx
  8814. + sub edi, 1
  8815. + not edi
  8816. + mov ebx, eax
  8817. + sbb ebx, eax
  8818. + and edx, edi
  8819. + mov edi, [ebp-14h]
  8820. + not ebx
  8821. + and esi, ebx
  8822. + sub edi, edx
  8823. + mov edx, [ebp-10h]
  8824. + sbb edx, esi
  8825. + mov esi, [ebp+8]
  8826. + xor ebx, ebx
  8827. + sub edi, esi
  8828. + sbb edx, ebx
  8829. + push eax
  8830. + add edi, 1
  8831. + push ecx
  8832. + adc edx, ebx
  8833. + push edx
  8834. + push edi
  8835. + call dword ptr [_alldiv]
  8836. + test edx, edx
  8837. + pop edi
  8838. + pop esi
  8839. + pop ebx
  8840. + jg short loc_31576
  8841. + jl short loc_3156D
  8842. + test eax, eax
  8843. + jnb short loc_31572
  8844. +
  8845. +loc_3156D:
  8846. + or eax, 0FFFFFFFFh
  8847. + jmp short locret_31583
  8848. +
  8849. +
  8850. +loc_31572:
  8851. + test edx, edx
  8852. + jl short locret_31583
  8853. +
  8854. +loc_31576:
  8855. + mov ecx, 7FFFFFFFh
  8856. + jg short loc_31581
  8857. + cmp eax, ecx
  8858. + jbe short locret_31583
  8859. +
  8860. +loc_31581:
  8861. + mov eax, ecx
  8862. +
  8863. +locret_31583:
  8864. + _emit 0xc9 ; "leave" opcode
  8865. + retn 4
  8866. +}
  8867. +}
  8868. +
  8869. +
  8870. +VOID __declspec(naked)
  8871. +AcpiArblibUnpackResource() {
  8872. +_asm {
  8873. + push ebp
  8874. + mov ebp, esp
  8875. + mov eax, [ebp+8]
  8876. + mov cl, [eax]
  8877. + cmp cl, 3
  8878. + jz short loc_31612
  8879. + cmp cl, 1
  8880. + jz short loc_31612
  8881. + cmp cl, 6
  8882. + jnz short loc_31628
  8883. + mov edx, [eax+4]
  8884. + mov ecx, [ebp+0Ch]
  8885. + and dword ptr [ecx+4], 0
  8886. + mov [ecx], edx
  8887. + mov eax, [eax+8]
  8888. + jmp short loc_31623
  8889. +
  8890. +loc_31612:
  8891. + mov edx, [eax+4]
  8892. + mov ecx, [ebp+0Ch]
  8893. + mov [ecx], edx
  8894. + mov edx, [eax+8]
  8895. + mov [ecx+4], edx
  8896. + mov eax, [eax+0Ch]
  8897. +
  8898. +loc_31623:
  8899. + mov ecx, [ebp+10h]
  8900. + mov [ecx], eax
  8901. +
  8902. +loc_31628:
  8903. + xor eax, eax
  8904. + pop ebp
  8905. + retn 0Ch
  8906. +}
  8907. +}
  8908. +
  8909. +
  8910. +VOID __declspec(naked)
  8911. +AcpiArblibPackResource() {
  8912. +_asm {
  8913. + push ebp
  8914. + mov ebp, esp
  8915. + mov ecx, [ebp+8]
  8916. + mov dl, [ecx+1]
  8917. + mov eax, [ebp+14h]
  8918. + mov [eax], dl
  8919. + mov dx, [ecx+4]
  8920. + mov [eax+2], dx
  8921. + mov dl, [ecx+2]
  8922. + mov [eax+1], dl
  8923. + cmp byte ptr [ecx+1], 3
  8924. + jz short loc_315CB
  8925. + mov dl, [ecx+1]
  8926. + cmp dl, 1
  8927. + jz short loc_315CB
  8928. + cmp dl, 6
  8929. + jnz short loc_315DD
  8930. + mov edx, [ebp+0Ch]
  8931. + mov [eax+4], edx
  8932. + mov ecx, [ecx+8]
  8933. + mov [eax+8], ecx
  8934. + jmp short loc_315DD
  8935. +
  8936. +loc_315CB:
  8937. + mov edx, [ebp+0Ch]
  8938. + mov [eax+4], edx
  8939. + mov edx, [ebp+10h]
  8940. + mov [eax+8], edx
  8941. + mov ecx, [ecx+8]
  8942. + mov [eax+0Ch], ecx
  8943. +
  8944. +loc_315DD:
  8945. + xor eax, eax
  8946. + pop ebp
  8947. + retn 10h
  8948. +}
  8949. +}
  8950. +
  8951. +
  8952. +VOID __declspec(naked)
  8953. +AcpiMemarbFindSuitableRange() {
  8954. +_asm {
  8955. + push ebp
  8956. + mov ebp, esp
  8957. + mov eax, [ebp+0Ch]
  8958. + mov ecx, [eax+20h]
  8959. + test byte ptr [ecx+18h], 1
  8960. + jz short loc_35469
  8961. + or byte ptr [eax+33h], 1
  8962. +
  8963. +loc_35469:
  8964. + push eax
  8965. + push dword ptr [ebp+8]
  8966. + call ArbFindSuitableRange
  8967. + pop ebp
  8968. + retn 8
  8969. +}
  8970. +}
  8971. +
  8972. +
  8973. +VOID __declspec(naked)
  8974. +AcpiArblibGetNextAlias() {
  8975. +_asm {
  8976. + push ebp
  8977. + mov ebp, esp
  8978. + test byte ptr [ebp+8], 4
  8979. + jz short loc_3164A
  8980. + mov ecx, [ebp+0Ch]
  8981. + add ecx, 400h
  8982. + jmp short loc_31659
  8983. +
  8984. +loc_3164A:
  8985. + test byte ptr [ebp+8], 8
  8986. + jz short loc_31677
  8987. + mov ecx, [ebp+0Ch]
  8988. + add ecx, 1000h
  8989. +
  8990. +loc_31659:
  8991. + mov eax, [ebp+10h]
  8992. + adc eax, 0
  8993. + test eax, eax
  8994. + ja short loc_31677
  8995. + cmp ecx, 0FFFFh
  8996. + ja short loc_31677
  8997. + mov edx, [ebp+14h]
  8998. + mov [edx+4], eax
  8999. + mov [edx], ecx
  9000. + mov al, 1
  9001. + jmp short loc_31679
  9002. +
  9003. +loc_31677:
  9004. + xor al, al
  9005. +
  9006. +loc_31679:
  9007. + pop ebp
  9008. + retn 10h
  9009. +}
  9010. +}
  9011. +
  9012. +
  9013. +VOID __declspec(naked)
  9014. +AcpiPortarbBacktrackAllocation() {
  9015. +_asm {
  9016. + push ebp
  9017. + mov ebp, esp
  9018. + push ecx
  9019. + push ecx
  9020. + push ebx
  9021. + push esi
  9022. + mov esi, [ebp+0Ch]
  9023. + mov eax, [esi]
  9024. + mov ecx, [esi+4]
  9025. + mov edx, [esi+24h]
  9026. + push edi
  9027. + mov [ebp-8], eax
  9028. + mov [ebp-4], ecx
  9029. + mov edi, [edx+1Ch]
  9030. + lea edx, [ebp-8]
  9031. + push edx
  9032. + push ecx
  9033. + push eax
  9034. + push edi
  9035. + call AcpiArblibGetNextAlias
  9036. + mov ebx, [ebp+8]
  9037. + jmp short loc_3597A
  9038. +
  9039. +loc_3593F:
  9040. + mov eax, [esi+20h]
  9041. + push dword ptr [eax+10h]
  9042. + mov eax, [esi+24h]
  9043. + mov eax, [eax+10h]
  9044. + xor ecx, ecx
  9045. + add eax, [ebp-8]
  9046. + adc ecx, [ebp-4]
  9047. + add eax, 0FFFFFFFFh
  9048. + adc ecx, 0FFFFFFFFh
  9049. + push ecx
  9050. + push eax
  9051. + push dword ptr [ebp-4]
  9052. + push dword ptr [ebp-8]
  9053. + push dword ptr [ebx+14h]
  9054. + call dword ptr [RtlDeleteRange]
  9055. + lea eax, [ebp-8]
  9056. + push eax
  9057. + push dword ptr [ebp-4]
  9058. + push dword ptr [ebp-8]
  9059. + push edi
  9060. + call AcpiArblibGetNextAlias
  9061. +
  9062. +loc_3597A:
  9063. + test al, al
  9064. + jnz short loc_3593F
  9065. + push esi
  9066. + push ebx
  9067. + call ArbBacktrackAllocation
  9068. + pop edi
  9069. + pop esi
  9070. + pop ebx
  9071. + _emit 0xc9 ; "leave" opcode
  9072. + retn 8
  9073. +
  9074. +}
  9075. +}
  9076. +
  9077. +
  9078. +VOID __declspec(naked)
  9079. +AcpiPortarbAddAllocation() {
  9080. +_asm {
  9081. + push ebp
  9082. + mov ebp, esp
  9083. + sub esp, 0Ch
  9084. + push ebx
  9085. + push esi
  9086. + mov esi, [ebp+0Ch]
  9087. + mov ecx, [esi+24h]
  9088. + xor eax, eax
  9089. + inc eax
  9090. + test [ecx+1Ch], al
  9091. + push edi
  9092. + mov [ebp-4], eax
  9093. + jz short loc_35AAD
  9094. + mov dword ptr [ebp-4], 3
  9095. +
  9096. +loc_35AAD:
  9097. + mov eax, [esi+20h]
  9098. + push dword ptr [eax+10h]
  9099. + mov ebx, [ebp+8]
  9100. + mov edi, dword ptr [RtlAddRange]
  9101. + push 0
  9102. + push dword ptr [ebp-4]
  9103. + xor eax, eax
  9104. + mov al, [esi+32h]
  9105. + push eax
  9106. + push dword ptr [esi+0Ch]
  9107. + push dword ptr [esi+8]
  9108. + push dword ptr [esi+4]
  9109. + push dword ptr [esi]
  9110. + push dword ptr [ebx+14h]
  9111. + call edi ;
  9112. + mov eax, [esi]
  9113. + mov ecx, [esi+4]
  9114. + mov edx, [esi+24h]
  9115. + mov [ebp-0Ch], eax
  9116. + mov [ebp-8], ecx
  9117. + mov edx, [edx+20h]
  9118. + movzx edx, word ptr [edx+4]
  9119. + mov [ebp+0Ch], edx
  9120. + mov dl, [esi+32h]
  9121. + or dl, 10h
  9122. + mov [ebp+8], dl
  9123. + lea edx, [ebp-0Ch]
  9124. + push edx
  9125. + push ecx
  9126. + push eax
  9127. + jmp short loc_35B39
  9128. +
  9129. +loc_35B00:
  9130. + mov eax, [esi+20h]
  9131. + push dword ptr [eax+10h]
  9132. + mov eax, [esi+24h]
  9133. + mov eax, [eax+10h]
  9134. + push 0
  9135. + push dword ptr [ebp-4]
  9136. + xor ecx, ecx
  9137. + add eax, [ebp-0Ch]
  9138. + push dword ptr [ebp+8]
  9139. + adc ecx, [ebp-8]
  9140. + add eax, 0FFFFFFFFh
  9141. + adc ecx, 0FFFFFFFFh
  9142. + push ecx
  9143. + push eax
  9144. + push dword ptr [ebp-8]
  9145. + push dword ptr [ebp-0Ch]
  9146. + push dword ptr [ebx+14h]
  9147. + call edi
  9148. + lea eax, [ebp-0Ch]
  9149. + push eax
  9150. + push dword ptr [ebp-8]
  9151. + push dword ptr [ebp-0Ch]
  9152. +
  9153. +loc_35B39:
  9154. + push dword ptr [ebp+0Ch]
  9155. + call AcpiArblibGetNextAlias
  9156. + test al, al
  9157. + jnz short loc_35B00
  9158. + pop edi
  9159. + pop esi
  9160. + pop ebx
  9161. + _emit 0xc9 ; "leave" opcode
  9162. + retn 8
  9163. +}
  9164. +}
  9165. +
  9166. +
  9167. +VOID __declspec(naked)
  9168. +AcpiArblibIsAliasedRangeAvailable() {
  9169. +_asm {
  9170. + push ebp
  9171. + mov ebp, esp
  9172. + sub esp, 4Ch
  9173. + push ebx
  9174. + mov ebx, [ebp+0Ch]
  9175. + mov eax, [ebx+20h]
  9176. + mov ecx, [eax+14h]
  9177. + test ecx, ecx
  9178. + push esi
  9179. + push edi
  9180. + mov byte ptr [ebp-4], 0
  9181. + jz short loc_316A9
  9182. + cmp ecx, 2
  9183. + jz short loc_316A9
  9184. + test byte ptr [eax+18h], 1
  9185. + jz short loc_316AD
  9186. +
  9187. +loc_316A9:
  9188. + mov byte ptr [ebp-4], 1
  9189. +
  9190. +loc_316AD:
  9191. + mov eax, [ebx+4]
  9192. + mov edx, [ebx]
  9193. + mov [ebp-10h], eax
  9194. + mov eax, [ebx+24h]
  9195. + mov ecx, [eax+20h]
  9196. + movzx ecx, word ptr [ecx+4]
  9197. + mov [ebp-0Ch], ecx
  9198. + push 0Eh
  9199. + pop ecx
  9200. + mov esi, ebx
  9201. + lea edi, [ebp-4Ch]
  9202. + rep movsd
  9203. + test byte ptr [eax+1Ch], 1
  9204. + mov [ebp-14h], edx
  9205. + mov dword ptr [ebp-8], 2
  9206. + jz short loc_316E3
  9207. + mov dword ptr [ebp-8], 3
  9208. +
  9209. +loc_316E3:
  9210. + lea eax, [ebp-14h]
  9211. + push eax
  9212. + push dword ptr [ebp-10h]
  9213. + push edx
  9214. + push dword ptr [ebp-0Ch]
  9215. + call AcpiArblibGetNextAlias
  9216. + test al, al
  9217. + jz loc_31787
  9218. + mov esi, [ebp+8]
  9219. +
  9220. +loc_316FE:
  9221. + mov edi, [ebp-14h]
  9222. + lea eax, [ebp+0Fh]
  9223. + push eax
  9224. + push dword ptr [esi+98h]
  9225. + mov eax, [ebx+24h]
  9226. + push dword ptr [esi+94h]
  9227. + mov eax, [eax+10h]
  9228. + push dword ptr [ebp-4]
  9229. + xor ecx, ecx
  9230. + push dword ptr [ebp-8]
  9231. + add eax, edi
  9232. + adc ecx, [ebp-10h]
  9233. + add eax, 0FFFFFFFFh
  9234. + adc ecx, 0FFFFFFFFh
  9235. + push ecx
  9236. + push eax
  9237. + push dword ptr [ebp-10h]
  9238. + push edi
  9239. + push dword ptr [esi+14h]
  9240. + call dword ptr [RtlIsRangeAvailable]
  9241. + cmp byte ptr [ebp+0Fh], 1
  9242. + jz short loc_3176F
  9243. + mov eax, [ebp-10h]
  9244. + mov ecx, [ebx+24h]
  9245. + mov [ebp-38h], eax
  9246. + xor edx, edx
  9247. + mov [ebp-3Ch], edi
  9248. + mov ecx, [ecx+10h]
  9249. + add ecx, edi
  9250. + adc edx, eax
  9251. + add ecx, 0FFFFFFFFh
  9252. + lea eax, [ebp-4Ch]
  9253. + push eax
  9254. + adc edx, 0FFFFFFFFh
  9255. + push esi
  9256. + mov [ebp-34h], ecx
  9257. + mov [ebp-30h], edx
  9258. + call dword ptr [esi+84h]
  9259. + test al, al
  9260. + jz short loc_31790
  9261. +
  9262. +loc_3176F:
  9263. + lea eax, [ebp-14h]
  9264. + push eax
  9265. + push dword ptr [ebp-10h]
  9266. + push edi
  9267. + push dword ptr [ebp-0Ch]
  9268. + call AcpiArblibGetNextAlias
  9269. + test al, al
  9270. + jnz loc_316FE
  9271. +
  9272. +loc_31787:
  9273. + mov al, 1
  9274. +
  9275. +loc_31789:
  9276. + pop edi
  9277. + pop esi
  9278. + pop ebx
  9279. + _emit 0xc9 ; "leave" opcode
  9280. + retn 8
  9281. +; ---------------------------------------------------------------------------
  9282. +
  9283. +loc_31790:
  9284. + xor al, al
  9285. + jmp short loc_31789
  9286. +}
  9287. +}
  9288. +
  9289. +
  9290. +VOID __declspec(naked)
  9291. +AcpiPortarbFindSuitableRange() {
  9292. +_asm {
  9293. + push ebp
  9294. + mov ebp, esp
  9295. + push esi
  9296. + mov esi, [ebp+0Ch]
  9297. + mov eax, [esi+24h]
  9298. + cmp dword ptr [eax+10h], 0
  9299. + jnz short loc_359B6
  9300. + mov eax, [esi]
  9301. + mov [esi+8], eax
  9302. + mov eax, [esi+4]
  9303. + mov [esi+0Ch], eax
  9304. + mov al, 1
  9305. + jmp loc_35A7B
  9306. +
  9307. +loc_359B6:
  9308. + mov ecx, [esi+20h]
  9309. + mov edx, [ecx+14h]
  9310. + test edx, edx
  9311. + mov byte ptr [ebp+0Ch], 0
  9312. + jz short loc_359CF
  9313. + cmp edx, 2
  9314. + jz short loc_359CF
  9315. + test byte ptr [ecx+18h], 1
  9316. + jz short loc_359D3
  9317. +
  9318. +loc_359CF:
  9319. + mov byte ptr [ebp+0Ch], 1
  9320. +
  9321. +loc_359D3:
  9322. + mov ecx, [esi+14h]
  9323. + push ebx
  9324. + movzx ebx, byte ptr [eax+1Ch]
  9325. + and ebx, 1
  9326. + cmp ecx, [esi+1Ch]
  9327. + push edi
  9328. + ja loc_35A77
  9329. + jb short loc_359F6
  9330. + mov ecx, [esi+10h]
  9331. + cmp ecx, [esi+18h]
  9332. + ja loc_35A77
  9333. +
  9334. +loc_359F6:
  9335. + mov edi, [ebp+8]
  9336. +
  9337. +loc_359F9:
  9338. + push esi
  9339. + push dword ptr [edi+98h]
  9340. + push dword ptr [edi+94h]
  9341. + push dword ptr [ebp+0Ch]
  9342. + push ebx
  9343. + push dword ptr [eax+14h]
  9344. + push dword ptr [eax+10h]
  9345. + push dword ptr [esi+1Ch]
  9346. + push dword ptr [esi+18h]
  9347. + push dword ptr [esi+14h]
  9348. + push dword ptr [esi+10h]
  9349. + push dword ptr [edi+14h]
  9350. + call dword ptr [RtlFindRange]
  9351. + test eax, eax
  9352. + jge short loc_35A35
  9353. + push esi
  9354. + push edi
  9355. + call dword ptr [edi+84h]
  9356. + test al, al
  9357. + jz short loc_35A77
  9358. +
  9359. +loc_35A35:
  9360. + mov eax, [esi+24h]
  9361. + mov eax, [eax+10h]
  9362. + xor ecx, ecx
  9363. + add eax, [esi]
  9364. + push esi
  9365. + adc ecx, [esi+4]
  9366. + add eax, 0FFFFFFFFh
  9367. + adc ecx, 0FFFFFFFFh
  9368. + push edi
  9369. + mov [esi+8], eax
  9370. + mov [esi+0Ch], ecx
  9371. + call AcpiArblibIsAliasedRangeAvailable
  9372. + test al, al
  9373. + jnz short loc_35A80
  9374. + mov eax, [esi+24h]
  9375. + mov ecx, [eax+10h]
  9376. + add [esi], ecx
  9377. + adc dword ptr [esi+4], 0
  9378. + mov ecx, [esi+14h]
  9379. + cmp ecx, [esi+1Ch]
  9380. + jb short loc_359F9
  9381. + ja short loc_35A77
  9382. + mov ecx, [esi+10h]
  9383. + cmp ecx, [esi+18h]
  9384. + jbe short loc_359F9
  9385. +
  9386. +loc_35A77:
  9387. + xor al, al
  9388. +
  9389. +loc_35A79:
  9390. + pop edi
  9391. + pop ebx
  9392. +
  9393. +loc_35A7B:
  9394. + pop esi
  9395. + pop ebp
  9396. + retn 8
  9397. +; ---------------------------------------------------------------------------
  9398. +
  9399. +loc_35A80:
  9400. + mov al, 1
  9401. + jmp short loc_35A79
  9402. +}
  9403. +}
  9404. +
  9405. +
  9406. +VOID __declspec(naked)
  9407. +AcpiInitializeBusNumberArbiter() {
  9408. +_asm {
  9409. + push ebp
  9410. + mov ebp, esp
  9411. + mov ecx, [ebp+8]
  9412. + push 0
  9413. + push offset asmRootName
  9414. + lea eax, [ecx+84h]
  9415. + push ecx
  9416. + mov ecx, [ebp+0Ch]
  9417. + push 6
  9418. + mov dword ptr [eax+38h], offset AcpiArblibUnpackRequirement
  9419. + mov dword ptr [eax+3Ch], offset AcpiArblibPackResource
  9420. + mov dword ptr [eax+40h], offset AcpiArblibUnpackResource
  9421. + mov dword ptr [eax+44h], offset AcpiArblibScoreRequirement
  9422. + push dword ptr [ecx+130h]
  9423. + push eax
  9424. + call ArbInitializeArbiterInstance
  9425. + pop ebp
  9426. + retn 8
  9427. +}
  9428. +}
  9429. +
  9430. +
  9431. +VOID __declspec(naked)
  9432. +AcpiInitializeMemoryArbiter() {
  9433. +_asm {
  9434. + push ebp
  9435. + mov ebp, esp
  9436. + mov ecx, [ebp+8]
  9437. + push 0
  9438. + lea eax, [ecx+84h]
  9439. + push offset asmRootName
  9440. + push ecx
  9441. + mov ecx, [ebp+0Ch]
  9442. + push 3
  9443. + mov dword ptr [eax+38h], offset AcpiArblibUnpackRequirement
  9444. + mov dword ptr [eax+3Ch], offset AcpiArblibPackResource
  9445. + mov dword ptr [eax+40h], offset AcpiArblibUnpackResource
  9446. + mov dword ptr [eax+44h], offset AcpiArblibScoreRequirement
  9447. + mov dword ptr [eax+78h], offset AcpiMemarbFindSuitableRange
  9448. + push dword ptr [ecx+130h]
  9449. + push eax
  9450. + call ArbInitializeArbiterInstance
  9451. + pop ebp
  9452. + retn 8
  9453. +}
  9454. +}
  9455. +
  9456. +
  9457. +VOID __declspec(naked)
  9458. +AcpiInitializePortArbiter() {
  9459. +_asm {
  9460. + push ebp
  9461. + mov ebp, esp
  9462. + mov ecx, [ebp+8]
  9463. + push 0
  9464. + lea eax, [ecx+84h]
  9465. + push offset asmRootName
  9466. + push ecx
  9467. + mov ecx, [ebp+0Ch]
  9468. + push 1
  9469. + mov dword ptr [eax+38h], offset AcpiArblibUnpackRequirement
  9470. + mov dword ptr [eax+3Ch], offset AcpiArblibPackResource
  9471. + mov dword ptr [eax+40h], offset AcpiArblibUnpackResource
  9472. + mov dword ptr [eax+44h], offset AcpiArblibScoreRequirement
  9473. + mov dword ptr [eax+78h], offset AcpiPortarbFindSuitableRange
  9474. + mov dword ptr [eax+7Ch], offset AcpiPortarbAddAllocation
  9475. + mov dword ptr [eax+80h], offset AcpiPortarbBacktrackAllocation
  9476. + push dword ptr [ecx+130h]
  9477. + push eax
  9478. + call ArbInitializeArbiterInstance
  9479. + pop ebp
  9480. + retn 8
  9481. +}
  9482. +}
  9483. +
  9484. +
  9485. +VOID __declspec(naked)
  9486. +AcpiArblibAllocateArbiterInstance() {
  9487. +_asm {
  9488. + push ebp
  9489. + mov ebp, esp
  9490. + push ecx
  9491. + push ecx
  9492. + push ebx
  9493. + mov ebx, [ebp+0Ch]
  9494. + cmp ebx, 1
  9495. + jz short loc_31831
  9496. + cmp ebx, 3
  9497. + jz short loc_31831
  9498. + cmp ebx, 6
  9499. + jz short loc_31831
  9500. + xor eax, eax
  9501. + jmp loc_319FB
  9502. +
  9503. +loc_31831:
  9504. + push esi
  9505. + push 69706341h
  9506. + push 120h
  9507. + push 101h
  9508. + call dword ptr [ExAllocatePoolWithTag]
  9509. + mov esi, eax
  9510. + xor eax, eax
  9511. + test esi, esi
  9512. + mov [ebp-8], esi
  9513. + jz loc_319FA
  9514. + push edi
  9515. + push 48h
  9516. + pop ecx
  9517. + mov edi, esi
  9518. + rep stosd
  9519. + mov ecx, offset AcpiArbiterInstanceCount
  9520. + call dword ptr [InterlockedIncrement]
  9521. + cmp ebx, 1
  9522. + jnz short loc_31875
  9523. + mov eax, offset asmPortName
  9524. + jmp short loc_31884
  9525. +
  9526. +loc_31875:
  9527. + cmp ebx, 3
  9528. + mov eax, offset asmMemoryName
  9529. + jz short loc_31884
  9530. + mov eax, offset asmBusNumberName
  9531. +
  9532. +loc_31884:
  9533. + mov ebx, dword ptr [_snwprintf]
  9534. + push eax
  9535. + push offset asmACPIName
  9536. + push 40h
  9537. + push esi
  9538. + call ebx
  9539. + add esp, 10h
  9540. + test eax, eax
  9541. + jge short loc_318AC
  9542. + push 0
  9543. + push esi
  9544. + call dword ptr [ExFreePoolWithTag]
  9545. + xor eax, eax
  9546. + jmp loc_319F9
  9547. +
  9548. +loc_318AC:
  9549. + push 40h
  9550. + pop ecx
  9551. + sub ecx, eax
  9552. + lea edi, [esi+eax*2]
  9553. + mov eax, [ebp+8]
  9554. + mov esi, [eax+12Ch]
  9555. + test esi, esi
  9556. + mov [ebp+0Ch], ecx
  9557. + jz loc_319DB
  9558. + cmp dword ptr [esi+8], 0
  9559. + jz loc_319DB
  9560. + cmp ecx, 5
  9561. + jb loc_319DB
  9562. + mov al, [esi+13h]
  9563. + test al, al
  9564. + jnz short loc_318E7
  9565. + push 2Ah
  9566. + pop edx
  9567. + jmp short loc_318EA
  9568. +
  9569. +loc_318E7:
  9570. + movsx edx, al
  9571. +
  9572. +loc_318EA:
  9573. + mov al, [esi+12h]
  9574. + test al, al
  9575. + jnz short loc_318FA
  9576. + mov dword ptr [ebp+8], 2Ah
  9577. + jmp short loc_31900
  9578. +
  9579. +loc_318FA:
  9580. + movsx eax, al
  9581. + mov [ebp+8], eax
  9582. +
  9583. +loc_31900:
  9584. + mov al, [esi+11h]
  9585. + test al, al
  9586. + jnz short loc_3190C
  9587. + push 2Ah
  9588. + pop ecx
  9589. + jmp short loc_3190F
  9590. +
  9591. +loc_3190C:
  9592. + movsx ecx, al
  9593. +
  9594. +loc_3190F:
  9595. + mov al, [esi+10h]
  9596. + test al, al
  9597. + jnz short loc_3191B
  9598. + push 2Ah
  9599. + pop eax
  9600. + jmp short loc_3191E
  9601. +
  9602. +loc_3191B:
  9603. + movsx eax, al
  9604. +
  9605. +loc_3191E:
  9606. + push edx
  9607. + push dword ptr [ebp+8]
  9608. + push ecx
  9609. + push eax
  9610. + push offset asmFormat2Name
  9611. + push 4
  9612. + push edi
  9613. + call ebx
  9614. + add esp, 1Ch
  9615. + push 4
  9616. + pop eax
  9617. + sub [ebp+0Ch], eax
  9618. + mov [ebp+8], eax
  9619. + jmp loc_319C1
  9620. +
  9621. +loc_3193F:
  9622. + cmp dword ptr [ebp+0Ch], 6
  9623. + jb loc_319D8
  9624. + mov eax, [ebp+8]
  9625. + add eax, eax
  9626. + push eax
  9627. + lea eax, [edi+0Ah]
  9628. + push edi
  9629. + push eax
  9630. + call dword ptr [memmove]
  9631. + add dword ptr [ebp+8], 5
  9632. + sub dword ptr [ebp+0Ch], 5
  9633. + mov word ptr [edi+8], 2Eh
  9634. + mov al, [esi+13h]
  9635. + add esp, 0Ch
  9636. + test al, al
  9637. + jnz short loc_31977
  9638. + push 2Ah
  9639. + pop edx
  9640. + jmp short loc_3197A
  9641. +
  9642. +loc_31977:
  9643. + movsx edx, al
  9644. +
  9645. +loc_3197A:
  9646. + mov al, [esi+12h]
  9647. + test al, al
  9648. + jnz short loc_3198A
  9649. + mov dword ptr [ebp-4], 2Ah
  9650. + jmp short loc_31990
  9651. +
  9652. +loc_3198A:
  9653. + movsx eax, al
  9654. + mov [ebp-4], eax
  9655. +
  9656. +loc_31990:
  9657. + mov al, [esi+11h]
  9658. + test al, al
  9659. + jnz short loc_3199C
  9660. + push 2Ah
  9661. + pop ecx
  9662. + jmp short loc_3199F
  9663. +
  9664. +loc_3199C:
  9665. + movsx ecx, al
  9666. +
  9667. +loc_3199F:
  9668. + mov al, [esi+10h]
  9669. + test al, al
  9670. + jnz short loc_319AB
  9671. + push 2Ah
  9672. + pop eax
  9673. + jmp short loc_319AE
  9674. +
  9675. +loc_319AB:
  9676. + movsx eax, al
  9677. +
  9678. +loc_319AE:
  9679. + push edx
  9680. + push dword ptr [ebp-4]
  9681. + push ecx
  9682. + push eax
  9683. + push offset asmFormat2Name
  9684. + push 4
  9685. + push edi
  9686. + call ebx
  9687. + add esp, 1Ch
  9688. +
  9689. +loc_319C1:
  9690. + mov esi, [esi+8]
  9691. + cmp dword ptr [esi+8], 0
  9692. + jnz loc_3193F
  9693. + mov eax, [ebp+8]
  9694. + and word ptr [edi+eax*2], 0
  9695. + jmp short loc_319F6
  9696. +
  9697. +loc_319D8:
  9698. + mov ecx, [ebp+0Ch]
  9699. +
  9700. +loc_319DB:
  9701. + push AcpiArbiterInstanceCount
  9702. + push offset asmFormat3Name
  9703. + push ecx
  9704. + push edi
  9705. + call ebx
  9706. + mov eax, [ebp+0Ch]
  9707. + add esp, 10h
  9708. + and word ptr [edi+eax*2-2], 0
  9709. +
  9710. +loc_319F6:
  9711. + mov eax, [ebp-8]
  9712. +
  9713. +loc_319F9:
  9714. + pop edi
  9715. +
  9716. +loc_319FA:
  9717. + pop esi
  9718. +
  9719. +loc_319FB:
  9720. + pop ebx
  9721. + _emit 0xc9 ; "leave" opcode
  9722. + retn 8
  9723. +}
  9724. +}
  9725. +
  9726. +
  9727. +VOID __declspec(naked)
  9728. +AcpiArblibInitializeArbiter() {
  9729. +_asm {
  9730. + push ebp
  9731. + mov ebp, esp
  9732. + push edi
  9733. + mov edi, [ebp+0Ch]
  9734. + cmp edi, 1
  9735. + jz short loc_31A57
  9736. + cmp edi, 3
  9737. + jz short loc_31A57
  9738. + cmp edi, 6
  9739. + jz short loc_31A57
  9740. + mov eax, 0C000000Dh
  9741. + jmp short loc_31AAF
  9742. +
  9743. +loc_31A57:
  9744. + push ebx
  9745. + mov ebx, [ebp+8]
  9746. + push esi
  9747. + push edi
  9748. + push ebx
  9749. + call AcpiArblibAllocateArbiterInstance
  9750. + mov esi, eax
  9751. + test esi, esi
  9752. + jnz short loc_31A70
  9753. + mov eax, 0C000009Ah
  9754. + jmp short loc_31AAD
  9755. +
  9756. +loc_31A70:
  9757. + cmp edi, 1
  9758. + push ebx
  9759. + push esi
  9760. + jnz short loc_31A7E
  9761. + call AcpiInitializePortArbiter
  9762. + jmp short loc_31A8F
  9763. +
  9764. +
  9765. +loc_31A7E:
  9766. + cmp edi, 3
  9767. + jnz short loc_31A8A
  9768. + call AcpiInitializeMemoryArbiter
  9769. + jmp short loc_31A8F
  9770. +
  9771. +loc_31A8A:
  9772. + call AcpiInitializeBusNumberArbiter
  9773. +
  9774. +loc_31A8F:
  9775. + mov edi, eax
  9776. + test edi, edi
  9777. + jge short loc_31A9F
  9778. + push esi
  9779. + call AcpiArblibFreeArbiterInstance
  9780. + mov eax, edi
  9781. + jmp short loc_31AAD
  9782. +
  9783. +loc_31A9F:
  9784. + mov eax, [ebp+10h]
  9785. + mov byte ptr [esi+80h], 1
  9786. + mov [eax], esi
  9787. + xor eax, eax
  9788. +
  9789. +loc_31AAD:
  9790. + pop esi
  9791. + pop ebx
  9792. +
  9793. +loc_31AAF:
  9794. + pop edi
  9795. + pop ebp
  9796. + retn 0Ch
  9797. +}
  9798. +}
  9799. +
  9800. +
  9801. +
  9802. +#endif // _X86_
  9803. diff --strip-trailing-cr -ur ./driver/nt/arblib.h "c:\\ACPI\\ACPI_W2003\\Base\\busdrv\\acpi/driver/nt/arblib.h"
  9804. --- ./driver/nt/arblib.h 2022-12-15 06:55:50.332031200 +0500
  9805. +++ "c:\\ACPI\\ACPI_W2003\\Base\\busdrv\\acpi/driver/nt/arblib.h" 2022-04-06 22:57:00.252929600 +0500
  9806. @@ -0,0 +1,27 @@
  9807. +#ifndef _ARBLIB_H_
  9808. +#define _ARBLIB_H_
  9809. +
  9810. +extern UINT_PTR __security_cookie;
  9811. +extern void __fastcall __security_check_cookie(UINT_PTR cookie);
  9812. +
  9813. +typedef struct { // Size=0x0
  9814. + CHAR UnknowData[0x82];
  9815. + BOOLEAN SomeField; // x32&x64 have same 0x82 offset
  9816. +} ACPI_ARBITER_INSTANCE;
  9817. +
  9818. +VOID
  9819. +AcpiArblibFreeArbiterInstance (ACPI_ARBITER_INSTANCE *CommonInstance);
  9820. +
  9821. +VOID
  9822. +AcpiArblibEjectInterface(VOID);
  9823. +
  9824. +VOID
  9825. +AcpiArblibInitializeArbiter(VOID);
  9826. +
  9827. +NTSTATUS
  9828. +AcpiArblibCommitResources (ACPI_ARBITER_INSTANCE *CommonInstance, PVOID IrpStuff);
  9829. +
  9830. +void
  9831. +ACPIConvertStringDelimitation(char *psIn, char Char);
  9832. +
  9833. +#endif
  9834. diff --strip-trailing-cr -ur ./driver/nt/buildsrc.c "c:\\ACPI\\ACPI_W2003\\Base\\busdrv\\acpi/driver/nt/buildsrc.c"
  9835. --- ./driver/nt/buildsrc.c 2003-02-26 17:15:50.000000000 +0500
  9836. +++ "c:\\ACPI\\ACPI_W2003\\Base\\busdrv\\acpi/driver/nt/buildsrc.c" 2022-04-06 23:47:17.153320300 +0500
  9837. @@ -733,7 +733,7 @@
  9838. //
  9839. KeAcquireSpinLockAtDpcLevel( &AcpiBuildQueueLock );
  9840.  
  9841. - } while ( AcpiBuildWorkDone );
  9842. + } while ( AcpiBuildWorkDone || !IsListEmpty( &AcpiBuildQueueList ));
  9843.  
  9844. //
  9845. // The DPC is no longer running
  9846. @@ -1419,6 +1419,12 @@
  9847.  
  9848. }
  9849.  
  9850. + if (targetDeviceObject->Flags & DO_BUFFERED_IO) {
  9851. +
  9852. + newDeviceObject->Flags |= DO_BUFFERED_IO;
  9853. +
  9854. + }
  9855. +
  9856. //
  9857. // Done with the device lock
  9858. //
  9859. @@ -2025,7 +2031,7 @@
  9860. }
  9861. NTSTATUS
  9862. -ACPIBuildPdo(
  9863. +ACPIBuildPdo_rtm(
  9864. IN PDRIVER_OBJECT DriverObject,
  9865. IN PDEVICE_EXTENSION DeviceExtension,
  9866. IN PDEVICE_OBJECT ParentPdoObject,
  9867. @@ -2240,6 +2246,248 @@
  9868. return STATUS_SUCCESS;
  9869. }
  9870. +ULONG AcpiArbiterResourceTypes[3] = {3,1,6};
  9871. +
  9872. +#ifdef _X86_
  9873. +
  9874. +NTSTATUS __declspec(naked)
  9875. +ACPIBuildPdo(
  9876. + IN PDRIVER_OBJECT DriverObject,
  9877. + IN PDEVICE_EXTENSION DeviceExtension,
  9878. + IN PDEVICE_OBJECT ParentPdoObject,
  9879. + IN BOOLEAN CreateAsFilter
  9880. + ) {
  9881. +_asm {
  9882. + push ebp
  9883. + mov ebp, esp
  9884. + sub esp, 0Ch
  9885. + push ebx
  9886. + xor ebx, ebx
  9887. + lea eax, [ebp-4]
  9888. + push eax
  9889. + push ebx
  9890. + push 80h
  9891. + push 32h
  9892. + push ebx
  9893. + push ebx
  9894. + push dword ptr [ebp+8]
  9895. + mov [ebp-8], ebx
  9896. + mov [ebp-4], ebx
  9897. + call dword ptr [IoCreateDevice]
  9898. + cmp eax, ebx
  9899. + jl loc_11973
  9900. + cmp [ebp+14h], bl
  9901. + push esi
  9902. + mov esi, [ebp+0Ch]
  9903. + push edi
  9904. + jz short loc_11794
  9905. + mov eax, [esi]
  9906. + and eax, 100000h
  9907. + or eax, ebx
  9908. + jnz short loc_11791
  9909. + push dword ptr [ebp+10h]
  9910. + call dword ptr [IoGetAttachedDeviceReference]
  9911. + cmp eax, ebx
  9912. + mov [ebp-8], eax
  9913. + jnz short loc_11794
  9914. + mov esi, 0C000000Eh
  9915. + jmp loc_118C9
  9916. +
  9917. +loc_11791:
  9918. + mov [ebp+14h], bl
  9919. +
  9920. +loc_11794:
  9921. + mov ecx, [esi+4]
  9922. + and ecx, 20h
  9923. + xor eax, eax
  9924. + or eax, ecx
  9925. + jz short loc_117BC
  9926. + mov eax, [esi+12Ch]
  9927. + push 5352435Fh
  9928. + push eax
  9929. + call ACPIAmliGetNamedChild
  9930. + test eax, eax
  9931. + jnz loc_1187F
  9932. + mov [esi+64h], bl
  9933. +
  9934. +loc_117BC:
  9935. + mov ecx, offset AcpiDeviceTreeLock
  9936. + call dword ptr [KfAcquireSpinLock]
  9937. + mov [ebp+0Bh], al
  9938. + mov eax, [ebp-4]
  9939. + mov [eax+28h], esi
  9940. + mov eax, [ebp-4]
  9941. + lea ecx, [esi+120h]
  9942. + mov [esi+130h], eax
  9943. + mov [esi+138h], eax
  9944. + call dword ptr [InterlockedIncrement]
  9945. + push 1
  9946. + push ebx
  9947. + push 1FFh
  9948. + push esi
  9949. + call ACPIInternalUpdateFlags
  9950. + push ebx
  9951. + push ebx
  9952. + push 20h
  9953. + push esi
  9954. + call ACPIInternalUpdateFlags
  9955. + cmp [ebp+14h], bl
  9956. + lea eax, [esi+88h]
  9957. + mov ecx, [eax]
  9958. + mov [esi+8Ch], ecx
  9959. + mov [eax], ebx
  9960. + mov dword ptr [esi+10h], offset AcpiPdoIrpDispatch
  9961. + mov edi, 2000h
  9962. + jz short loc_11860
  9963. + mov eax, [ebp-8]
  9964. + push ebx
  9965. + push ebx
  9966. + push 40h
  9967. + push esi
  9968. + mov [esi+134h], eax
  9969. + call ACPIInternalUpdateFlags
  9970. + mov eax, [ebp-8]
  9971. + mov edx, [ebp-4]
  9972. + mov dword ptr [esi+10h], offset AcpiBusFilterIrpDispatch
  9973. + mov cl, [eax+30h]
  9974. + inc cl
  9975. + mov [edx+30h], cl
  9976. + mov ecx, [eax+5Ch]
  9977. + mov edx, [ebp-4]
  9978. + mov [edx+5Ch], ecx
  9979. + test [eax+1Ch], edi
  9980. + jz short loc_11860
  9981. + mov eax, [ebp-4]
  9982. + or [eax+1Ch], edi
  9983. +
  9984. +loc_11860:
  9985. + mov eax, [esi]
  9986. + mov ecx, [esi+4]
  9987. + mov [ebp-0Ch], eax
  9988. + mov edx, ecx
  9989. + and edx, 10h
  9990. + xor eax, eax
  9991. + or eax, edx
  9992. + jz short loc_118D9
  9993. + mov dword ptr [esi+10h], offset AcpiProcessorIrpDispatch
  9994. + jmp loc_11922
  9995. +
  9996. +loc_1187F:
  9997. + lea eax, [esi+68h]
  9998. + mov byte ptr [esi+64h], 1
  9999. + xor edi, edi
  10000. + mov [ebp+8], eax
  10001. +
  10002. +loc_1188B:
  10003. + push dword ptr [ebp+8]
  10004. + push AcpiArbiterResourceTypes[edi*4]
  10005. + push esi
  10006. + call AcpiArblibInitializeArbiter
  10007. + cmp eax, ebx
  10008. + mov [ebp+0Ch], eax
  10009. + jl short loc_118B1
  10010. + add dword ptr [ebp+8], 4
  10011. + inc edi
  10012. + cmp edi, 3
  10013. + jb short loc_1188B
  10014. + jmp loc_117BC
  10015. +
  10016. +loc_118B1:
  10017. + cmp edi, ebx
  10018. + jz short loc_118C6
  10019. + lea esi, [esi+edi*4+68h]
  10020. +
  10021. +loc_118B9:
  10022. + sub esi, 4
  10023. + push dword ptr [esi]
  10024. + call AcpiArblibFreeArbiterInstance
  10025. + dec edi
  10026. + jnz short loc_118B9
  10027. +
  10028. +loc_118C6:
  10029. + mov esi, [ebp+0Ch]
  10030. +
  10031. +loc_118C9:
  10032. + push dword ptr [ebp-4]
  10033. + call dword ptr [IoDeleteDevice]
  10034. + mov eax, esi
  10035. + jmp loc_11971
  10036. +
  10037. +loc_118D9:
  10038. + and ecx, edi
  10039. + xor eax, eax
  10040. + or eax, ecx
  10041. + jz short loc_11922
  10042. + cmp dword ptr [AcpiInternalDeviceTable], ebx
  10043. + mov [ebp+14h], ebx
  10044. + jz short loc_11922
  10045. + mov edi, offset AcpiInternalDeviceTable
  10046. + mov eax, edi
  10047. +
  10048. +loc_118F3:
  10049. + push dword ptr [eax]
  10050. + push dword ptr [esi+10Ch]
  10051. + call dword ptr [strstr]
  10052. + test eax, eax
  10053. + pop ecx
  10054. + pop ecx
  10055. + jnz short loc_11915
  10056. + inc dword ptr [ebp+14h]
  10057. + add edi, 8
  10058. + cmp [edi], ebx
  10059. + mov eax, edi
  10060. + jnz short loc_118F3
  10061. + jmp short loc_11922
  10062. +
  10063. +loc_11915:
  10064. + mov eax, [ebp+14h]
  10065. + mov eax, dword ptr (AcpiInternalDeviceTable+4)[eax*8]
  10066. + mov [esi+10h], eax
  10067. +
  10068. +loc_11922:
  10069. + mov eax, [esi]
  10070. + mov ecx, [esi+4]
  10071. + and eax, 40000h
  10072. + or eax, ebx
  10073. + jz short loc_11944
  10074. + and ecx, 80000h
  10075. + xor eax, eax
  10076. + or eax, ecx
  10077. + jz short loc_11944
  10078. + mov eax, [ebp-4]
  10079. + mov FixedButtonDeviceObject, eax
  10080. +
  10081. +loc_11944:
  10082. + mov dl, [ebp+0Bh]
  10083. + mov ecx, offset AcpiDeviceTreeLock
  10084. + call dword ptr [KfReleaseSpinLock]
  10085. + mov eax, [ebp-4]
  10086. + and byte ptr [eax+1Ch], 7Fh
  10087. + mov esi, [esi+4]
  10088. + and esi, 100000h
  10089. + xor eax, eax
  10090. + or eax, esi
  10091. + jz short loc_1196F
  10092. + mov eax, [ebp-4]
  10093. + or dword ptr [eax+1Ch], 8
  10094. +
  10095. +loc_1196F:
  10096. + xor eax, eax
  10097. +
  10098. +loc_11971:
  10099. + pop edi
  10100. + pop esi
  10101. +
  10102. +loc_11973:
  10103. + pop ebx
  10104. + _emit 0xc9 ; "leave" opcode
  10105. + retn 10h
  10106. +}
  10107. +}
  10108. +
  10109. +#endif // _X86_
  10110. +
  10111. +
  10112. NTSTATUS
  10113. ACPIBuildPowerResourceExtension(
  10114. IN PNSOBJ PowerResource,
  10115. @@ -3022,54 +3270,55 @@
  10116. PUCHAR tempPtr = BuildRequest->String;
  10117. ULONG i;
  10118.  
  10119. + ACPIConvertStringDelimitation(tempPtr, ' ');
  10120. +
  10121. //
  10122. // Walk the CID, trying to find the double NULL
  10123. //
  10124. - for ( ;tempPtr != NULL && *tempPtr != '\0'; ) {
  10125. + //for ( ;tempPtr != NULL && *tempPtr != '\0'; ) {
  10126.  
  10127. - tempPtr += strlen(tempPtr);
  10128. - if (*(tempPtr+1) == '\0') {
  10129. + // tempPtr += strlen(tempPtr);
  10130. + // if (*(tempPtr+1) == '\0') {
  10131.  
  10132. - //
  10133. - // Found the double null, so we can break
  10134. - //
  10135. - break;
  10136. + // //
  10137. + // // Found the double null, so we can break
  10138. + // //
  10139. + // break;
  10140.  
  10141. - }
  10142. + // }
  10143.  
  10144. + // //
  10145. + // // Set the character to be a 'space'
  10146. + // //
  10147. + // *tempPtr = ' ';
  10148. +
  10149. + //}
  10150. + //tempPtr = BuildRequest->String;
  10151. +
  10152. + if (tempPtr != NULL) {
  10153. //
  10154. - // Set the character to be a 'space'
  10155. + // Set any special flags associated with this device id
  10156. //
  10157. - *tempPtr = ' ';
  10158. + for (i = 0; AcpiInternalDeviceFlagTable[i].PnPId != NULL; i++) {
  10159.  
  10160. - }
  10161. - tempPtr = BuildRequest->String;
  10162. -
  10163. - //
  10164. - // Set any special flags associated with this device id
  10165. - //
  10166. - for (i = 0; AcpiInternalDeviceFlagTable[i].PnPId != NULL; i++) {
  10167. + if (strstr( tempPtr, AcpiInternalDeviceFlagTable[i].PnPId ) ) {
  10168.  
  10169. - if (strstr( tempPtr, AcpiInternalDeviceFlagTable[i].PnPId ) ) {
  10170. + ACPIInternalUpdateFlags(
  10171. + &(deviceExtension->Flags),
  10172. + AcpiInternalDeviceFlagTable[i].Flags,
  10173. + FALSE
  10174. + );
  10175. + break;
  10176.  
  10177. - ACPIInternalUpdateFlags(
  10178. - &(deviceExtension->Flags),
  10179. - AcpiInternalDeviceFlagTable[i].Flags,
  10180. - FALSE
  10181. - );
  10182. - break;
  10183. + }
  10184.  
  10185. }
  10186.  
  10187. - }
  10188. -
  10189. - //
  10190. - // Done with the string
  10191. - //
  10192. - if (tempPtr != NULL) {
  10193. + //
  10194. + // Done with the string
  10195. + //
  10196.  
  10197. ExFreePool( tempPtr );
  10198. -
  10199. }
  10200.  
  10201. //
  10202. @@ -4056,13 +4305,13 @@
  10203. //
  10204. // First, store the pin that we use as the wakeup signal
  10205. //
  10206. - deviceExtension->PowerInfo.WakeBit = (ULONG)pinObject->uipDataValue;
  10207. + deviceExtension->PowerInfo.WakeBit = (ULONG)pinObject->dwDataValue;
  10208.  
  10209. //
  10210. // Next, store the system state that we can wake up from
  10211. //
  10212. deviceExtension->PowerInfo.SystemWakeLevel = ACPIDeviceMapSystemState(
  10213. - stateObject->uipDataValue
  10214. + stateObject->dwDataValue
  10215. );
  10216.  
  10217. //
  10218. @@ -4080,8 +4329,8 @@
  10219. //
  10220. // Calculate the correct register and mask
  10221. //
  10222. - gpeRegister = ( (UCHAR) (pinObject->uipDataValue) / 8);
  10223. - gpeMask = 1 << ( (UCHAR) (pinObject->uipDataValue) % 8);
  10224. + gpeRegister = ( (UCHAR) (pinObject->dwDataValue) / 8);
  10225. + gpeMask = 1 << ( (UCHAR) (pinObject->dwDataValue) % 8);
  10226.  
  10227. //
  10228. // We need access to the table lock for this
  10229. @@ -4159,7 +4408,7 @@
  10230. //
  10231. RtlZeroMemory( &argData, sizeof(OBJDATA) );
  10232. argData.dwDataType = OBJTYPE_INTDATA;
  10233. - argData.uipDataValue = 0;
  10234. + argData.dwDataValue = 0;
  10235.  
  10236. //
  10237. // Run the method. Note that we don't specify a callback because we
  10238. @@ -4409,7 +4658,7 @@
  10239. //
  10240. // Turn the power state into something that we can understand
  10241. //
  10242. - i = ACPIDeviceMapPowerState( result->uipDataValue );
  10243. + i = ACPIDeviceMapPowerState( result->dwDataValue );
  10244.  
  10245. //
  10246. // No longer need the buffer
  10247. @@ -5461,7 +5710,7 @@
  10248. ACPIInternalUpdateFlags(
  10249. &(powerNode->Flags),
  10250. DEVICE_NODE_PRESENT,
  10251. - (BOOLEAN) ((result->uipDataValue & STA_STATUS_PRESENT) ? FALSE : TRUE)
  10252. + (BOOLEAN) ((result->dwDataValue & STA_STATUS_PRESENT) ? FALSE : TRUE)
  10253. );
  10254.  
  10255. //
  10256. @@ -5956,7 +6205,7 @@
  10257. // Setup the arguments that we will pass to the method
  10258. //
  10259. RtlZeroMemory( objData, sizeof(OBJDATA) );
  10260. - objData[0].uipDataValue = DATAVALUE_ONE;
  10261. + objData[0].dwDataValue = DATAVALUE_ONE;
  10262. objData[0].dwDataType = OBJTYPE_INTDATA;
  10263.  
  10264. //
  10265. @@ -5980,16 +6229,16 @@
  10266. // pass in a REGSPACE_PCIFCFG registration
  10267. //
  10268. RtlZeroMemory( objData, sizeof(objData) );
  10269. - objData[0].uipDataValue = REGSPACE_PCICFG;
  10270. + objData[0].dwDataValue = REGSPACE_PCICFG;
  10271. objData[0].dwDataType = OBJTYPE_INTDATA;
  10272. objData[1].dwDataType = OBJTYPE_INTDATA;
  10273. if (BuildRequest->RunRequest.Flags & RUN_REQUEST_REG_METHOD_ON) {
  10274.  
  10275. - objData[1].uipDataValue = 1;
  10276. + objData[1].dwDataValue = 1;
  10277.  
  10278. } else {
  10279.  
  10280. - objData[1].uipDataValue = 0;
  10281. + objData[1].dwDataValue = 0;
  10282.  
  10283. }
  10284.  
  10285. diff --strip-trailing-cr -ur ./driver/nt/bus.c "c:\\ACPI\\ACPI_W2003\\Base\\busdrv\\acpi/driver/nt/bus.c"
  10286. --- ./driver/nt/bus.c 2003-02-26 17:15:50.000000000 +0500
  10287. +++ "c:\\ACPI\\ACPI_W2003\\Base\\busdrv\\acpi/driver/nt/bus.c" 2022-04-04 21:17:08.000000000 +0500
  10288. @@ -1675,7 +1675,7 @@
  10289. }
  10290. NTSTATUS
  10291. -ACPIBusIrpQueryInterface(
  10292. +ACPIBusIrpQueryInterface_rtm(
  10293. IN PDEVICE_OBJECT DeviceObject,
  10294. IN PIRP Irp
  10295. )
  10296. @@ -1904,7 +1904,238 @@
  10297.  
  10298. return status;
  10299. }
  10300. +
  10301. +#ifdef _X86_
  10302. +
  10303. +NTSTATUS __declspec(naked)
  10304. +ACPIBusIrpQueryInterface(
  10305. + IN PDEVICE_OBJECT DeviceObject,
  10306. + IN PIRP Irp
  10307. + ) {
  10308. +_asm {
  10309. + push ebp
  10310. + mov ebp, esp
  10311. + sub esp, 0Ch
  10312. + mov eax, [ebp+0Ch]
  10313. + push ebx
  10314. + mov ebx, [eax+60h]
  10315. + push esi
  10316. + push edi
  10317. + push dword ptr [ebp+8]
  10318. + call ACPIInternalGetDeviceExtension
  10319. + mov edi, [ebx+4]
  10320. + mov [ebp-8], eax
  10321. + mov eax, [ebx+10h]
  10322. + mov [ebp-4], eax
  10323. + mov eax, offset GUID_ACPI_INTERFACE_STANDARD
  10324. + cmp edi, eax
  10325. + jz short loc_32A77
  10326. + mov esi, dword ptr[RtlCompareMemory]
  10327. + push 10h
  10328. + push eax
  10329. + push edi
  10330. + call esi
  10331. + sub eax, 10h
  10332. + neg eax
  10333. + sbb eax, eax
  10334. + inc eax
  10335. + mov [ebp-0Ch], eax
  10336. + jz short loc_32AB5
  10337. +
  10338. +loc_32A77:
  10339. + mov ax, [ebx+8]
  10340. + cmp ax, 2Ch
  10341. + jbe short loc_32A86
  10342. + push 2Ch
  10343. + pop eax
  10344. + jmp short loc_32A89
  10345. +
  10346. +loc_32A86:
  10347. + movzx eax, ax
  10348. +
  10349. +loc_32A89:
  10350. + mov ebx, [ebx+0Ch]
  10351. + mov ecx, eax
  10352. + mov edx, ecx
  10353. + shr ecx, 2
  10354. + mov esi, offset ACPIInterfaceTable
  10355. + mov edi, ebx
  10356. + rep movsd
  10357. + mov ecx, edx
  10358. + and ecx, 3
  10359. + cmp eax, 8
  10360. + rep movsb
  10361. + jbe short loc_32AAE
  10362. + mov eax, [ebp+8]
  10363. + mov [ebx+4], eax
  10364. +
  10365. +loc_32AAE:
  10366. + xor esi, esi
  10367. + jmp loc_32C17
  10368. +
  10369. +loc_32AB5:
  10370. + mov eax, offset GUID_TRANSLATOR_INTERFACE_STANDARD
  10371. + cmp edi, eax
  10372. + jz short loc_32AD1
  10373. + push 10h
  10374. + push eax
  10375. + push edi
  10376. + call esi
  10377. + sub eax, 10h
  10378. + neg eax
  10379. + sbb eax, eax
  10380. + inc eax
  10381. + mov [ebp-0Ch], eax
  10382. + jz short loc_32B2F
  10383. +
  10384. +loc_32AD1:
  10385. + cmp dword ptr [ebp-4], 2
  10386. + jnz short loc_32B05
  10387. + push dword ptr [ebp+8]
  10388. + call IsPciBus
  10389. + test al, al
  10390. + jz short loc_32AEB
  10391. + push dword ptr [ebp+0Ch]
  10392. + call SmashInterfaceQuery
  10393. +
  10394. +loc_32AEB:
  10395. + mov eax, [ebp+0Ch]
  10396. + mov esi, [eax+18h]
  10397. +
  10398. +loc_32AF1:
  10399. + mov ecx, [ebp+0Ch]
  10400. + xor dl, dl
  10401. + call dword ptr[IofCompleteRequest]
  10402. + pop edi
  10403. + mov eax, esi
  10404. + pop esi
  10405. + pop ebx
  10406. + _emit 0xc9 ; "leave" opcode
  10407. + retn 8
  10408. +; ---------------------------------------------------------------------------
  10409. +
  10410. +loc_32B05:
  10411. + cmp dword ptr [ebp-4], 1
  10412. + jz short loc_32B11
  10413. + cmp dword ptr [ebp-4], 3
  10414. + jnz short loc_32AEB
  10415. +
  10416. +loc_32B11:
  10417. + push dword ptr [ebp+8]
  10418. + call IsPciBus
  10419. + test al, al
  10420. + jz short loc_32AEB
  10421. + push dword ptr [ebp+0Ch]
  10422. + push dword ptr [ebp+8]
  10423. + call TranslateEjectInterface
  10424. +
  10425. +loc_32B28:
  10426. + mov esi, eax
  10427. + jmp loc_32C0B
  10428. +
  10429. +loc_32B2F:
  10430. + mov eax, offset GUID_PCI_BUS_INTERFACE_STANDARD
  10431. + cmp edi, eax
  10432. + jz short loc_32B4B
  10433. + push 10h
  10434. + push eax
  10435. + push edi
  10436. + call esi
  10437. + sub eax, 10h
  10438. + neg eax
  10439. + sbb eax, eax
  10440. + inc eax
  10441. + mov [ebp-0Ch], eax
  10442. + jz short loc_32B64
  10443. +
  10444. +loc_32B4B:
  10445. + push dword ptr [ebp+8]
  10446. + call IsPciBus
  10447. + test al, al
  10448. + jz short loc_32AEB
  10449. + push dword ptr [ebp+0Ch]
  10450. + push dword ptr [ebp+8]
  10451. + call PciBusEjectInterface
  10452. + jmp short loc_32B28
  10453. +
  10454. +loc_32B64:
  10455. + mov eax, offset GUID_BUS_INTERFACE_STANDARD
  10456. + cmp edi, eax
  10457. + jz short loc_32B80
  10458. + push 10h
  10459. + push eax
  10460. + push edi
  10461. + call esi
  10462. + sub eax, 10h
  10463. + neg eax
  10464. + sbb eax, eax
  10465. + inc eax
  10466. + mov [ebp-0Ch], eax
  10467. + jz short loc_32BBD
  10468. +
  10469. +loc_32B80:
  10470. + mov eax, [ebp+0Ch]
  10471. + mov dword ptr [eax+18h], 0C00002B9h
  10472. + mov eax, [ebp-8]
  10473. + mov eax, [eax+13Ch]
  10474. + test eax, eax
  10475. + jz loc_32AEB
  10476. + mov eax, [eax+130h]
  10477. + test eax, eax
  10478. + jz loc_32AEB
  10479. + push 0
  10480. + push ebx
  10481. + push eax
  10482. + call ACPIInternalSendSynchronousIrp
  10483. + mov ecx, [ebp+0Ch]
  10484. + mov [ecx+18h], eax
  10485. + jmp loc_32AEB
  10486. +
  10487. +loc_32BBD:
  10488. + mov eax, offset GUID_ARBITER_INTERFACE_STANDARD
  10489. + cmp edi, eax
  10490. + jz short loc_32BDD
  10491. + push 10h
  10492. + push eax
  10493. + push edi
  10494. + call esi
  10495. + sub eax, 10h
  10496. + neg eax
  10497. + sbb eax, eax
  10498. + inc eax
  10499. + mov [ebp-0Ch], eax
  10500. + jz loc_32AEB
  10501. +
  10502. +loc_32BDD:
  10503. + mov edx, [ebp-8]
  10504. + mov ecx, [edx+4]
  10505. + and ecx, 20h
  10506. + xor eax, eax
  10507. + or eax, ecx
  10508. + jz loc_32AEB
  10509. + cmp byte ptr [edx+64h], 0
  10510. + jz loc_32AEB
  10511. + mov edi, [ebp+0Ch]
  10512. + push edi
  10513. + push dword ptr [ebp+8]
  10514. + call AcpiArblibEjectInterface
  10515. + mov esi, eax
  10516. + mov [edi+18h], esi
  10517. +
  10518. +loc_32C0B:
  10519. + cmp esi, 0C00000BBh
  10520. + jz loc_32AEB
  10521. +
  10522. +loc_32C17:
  10523. + mov eax, [ebp+0Ch]
  10524. + mov [eax+18h], esi
  10525. + jmp loc_32AF1
  10526. +}
  10527. +}
  10528. +
  10529. +#endif
  10530. +
  10531. NTSTATUS
  10532. ACPIBusIrpQueryPnpDeviceState(
  10533. IN PDEVICE_OBJECT DeviceObject,
  10534. @@ -2206,28 +2437,27 @@
  10535. // Container objects do not claim resources. So, don't even bother
  10536. // trying to obtain a _CRS
  10537. //
  10538. - if (!(deviceExtension->Flags & DEV_CAP_CONTAINER)) {
  10539. -
  10540. - //
  10541. - // Here we try to find the current resource set
  10542. - //
  10543. - status = ACPIGetBufferSync(
  10544. - deviceExtension,
  10545. - PACKED_CRS,
  10546. - &crsBuf,
  10547. - &crsBufSize
  10548. - );
  10549. + //if (!(deviceExtension->Flags & DEV_CAP_CONTAINER)) {
  10550.  
  10551. - } else {
  10552. + //
  10553. + // Here we try to find the current resource set
  10554. + //
  10555. + status = ACPIGetBufferSync(
  10556. + deviceExtension,
  10557. + PACKED_CRS,
  10558. + &crsBuf,
  10559. + &crsBufSize
  10560. + );
  10561.  
  10562. - //
  10563. - // This is the status code returned if there is no _CRS. It actually
  10564. - // doesn't matter what code we use since in the failure case, we
  10565. - // should return whatever code was already present in the IRP
  10566. - //
  10567. - status = STATUS_OBJECT_NAME_NOT_FOUND;
  10568. + //} else {
  10569. + // //
  10570. + // // This is the status code returned if there is no _CRS. It actually
  10571. + // // doesn't matter what code we use since in the failure case, we
  10572. + // // should return whatever code was already present in the IRP
  10573. + // //
  10574. + // status = STATUS_OBJECT_NAME_NOT_FOUND;
  10575. + //}
  10576.  
  10577. - }
  10578. if (!NT_SUCCESS(status)) {
  10579.  
  10580. //
  10581. @@ -2249,7 +2479,8 @@
  10582. //
  10583. // Build a IO_RESOURCE_REQUIREMENT_LISTS
  10584. //
  10585. - status = PnpBiosResourcesToNtResources(
  10586. + status = PnpDeviceBiosResourcesToNtResources(
  10587. + deviceExtension,
  10588. crsBuf,
  10589. (deviceExtension->Flags & DEV_CAP_PCI ?
  10590. PNP_BIOS_TO_IO_NO_CONSUMED_RESOURCES : 0),
  10591. @@ -2460,33 +2691,33 @@
  10592. // claim resources. Rather, they are used to specify a resource
  10593. // translation
  10594. //
  10595. - if (!(deviceExtension->Flags & DEV_CAP_CONTAINER)) {
  10596. + //if (!(deviceExtension->Flags & DEV_CAP_CONTAINER)) {
  10597.  
  10598. - //
  10599. - // Fetch the buffers, as appropriate
  10600. - //
  10601. - crsStat = ACPIGetBufferSync(
  10602. - deviceExtension,
  10603. - PACKED_CRS,
  10604. - &crsBuf,
  10605. - &crsBufSize
  10606. - );
  10607. - prsStat = ACPIGetBufferSync(
  10608. - deviceExtension,
  10609. - PACKED_PRS,
  10610. - &prsBuf,
  10611. - &prsBufSize
  10612. - );
  10613. + //
  10614. + // Fetch the buffers, as appropriate
  10615. + //
  10616. + crsStat = ACPIGetBufferSync(
  10617. + deviceExtension,
  10618. + PACKED_CRS,
  10619. + &crsBuf,
  10620. + &crsBufSize
  10621. + );
  10622. + prsStat = ACPIGetBufferSync(
  10623. + deviceExtension,
  10624. + PACKED_PRS,
  10625. + &prsBuf,
  10626. + &prsBufSize
  10627. + );
  10628.  
  10629. - } else {
  10630. + //} else {
  10631.  
  10632. - //
  10633. - // Pretend that there is no _CRS/_PRS present
  10634. - //
  10635. - crsStat = STATUS_OBJECT_NAME_NOT_FOUND;
  10636. - prsStat = STATUS_OBJECT_NAME_NOT_FOUND;
  10637. + // //
  10638. + // // Pretend that there is no _CRS/_PRS present
  10639. + // //
  10640. + // crsStat = STATUS_OBJECT_NAME_NOT_FOUND;
  10641. + // prsStat = STATUS_OBJECT_NAME_NOT_FOUND;
  10642.  
  10643. - }
  10644. + //}
  10645.  
  10646. //
  10647. // If there is a _CRS, then remember to clear the irp-generated status
  10648. @@ -2524,7 +2755,8 @@
  10649. // Our first step is to try to use these resources to build the
  10650. // information...
  10651. //
  10652. - status = PnpBiosResourcesToNtResources(
  10653. + status = PnpDeviceBiosResourcesToNtResources(
  10654. + deviceExtension,
  10655. prsBuf,
  10656. 0,
  10657. &resList
  10658. @@ -2560,7 +2792,8 @@
  10659. //
  10660. if (!NT_SUCCESS(status) && NT_SUCCESS(crsStat) ) {
  10661.  
  10662. - status = PnpBiosResourcesToNtResources(
  10663. + status = PnpDeviceBiosResourcesToNtResources(
  10664. + deviceExtension,
  10665. crsBuf,
  10666. (deviceExtension->Flags & DEV_CAP_PCI ?
  10667. PNP_BIOS_TO_IO_NO_CONSUMED_RESOURCES : 0),
  10668. @@ -3374,6 +3607,9 @@
  10669. PDEVICE_EXTENSION deviceExtension;
  10670. PIO_STACK_LOCATION irpStack = IoGetCurrentIrpStackLocation( Irp );
  10671. UCHAR minorFunction = irpStack->MinorFunction;
  10672. + ACPI_ARBITER_INSTANCE **arbiter;
  10673. + ULONG i;
  10674. + PDEVICE_CAPABILITIES capabilities;
  10675.  
  10676. PAGED_CODE();
  10677.  
  10678. @@ -3411,6 +3647,20 @@
  10679.  
  10680. }
  10681.  
  10682. + if (deviceExtension->Flags & DEV_CAP_CONTAINER &&
  10683. + deviceExtension->Module.ArbitersNeeded) {
  10684. + capabilities = irpStack->Parameters.DeviceCapabilities.Capabilities; // unknow union, set to random
  10685. + arbiter = deviceExtension->Module.Arbiters;
  10686. + for (i = 0; i < 3; i++) {
  10687. + status = AcpiArblibCommitResources(*arbiter, (PVOID) capabilities);
  10688. + if (!NT_SUCCESS(status))
  10689. + return status;
  10690. +
  10691. + (*arbiter)->SomeField = TRUE;
  10692. + arbiter++;
  10693. + }
  10694. + }
  10695. +
  10696. //
  10697. // Pass the real work off to this function
  10698. //
  10699. @@ -3421,6 +3671,7 @@
  10700. Irp,
  10701. Irp
  10702. );
  10703. +
  10704. if (NT_SUCCESS(status)) {
  10705.  
  10706. return STATUS_PENDING;
  10707. diff --strip-trailing-cr -ur ./driver/nt/dat.c "c:\\ACPI\\ACPI_W2003\\Base\\busdrv\\acpi/driver/nt/dat.c"
  10708. --- ./driver/nt/dat.c 2003-02-26 17:15:50.000000000 +0500
  10709. +++ "c:\\ACPI\\ACPI_W2003\\Base\\busdrv\\acpi/driver/nt/dat.c" 2022-04-16 11:16:57.427734300 +0500
  10710. @@ -657,7 +657,7 @@
  10711. // Any device in this table is considered to be 'special'
  10712. //
  10713. INTERNAL_DEVICE_TABLE AcpiInternalDeviceTable[] = {
  10714. - "ACPI0006", &AcpiGenericBusIrpDispatch,
  10715. + "ACPI0004", &AcpiGenericBusIrpDispatch,
  10716. "FixedButton", &AcpiFixedButtonIrpDispatch,
  10717. "PNP0000", &AcpiRawDeviceIrpDispatch,
  10718. "PNP0001", &AcpiRawDeviceIrpDispatch,
  10719. @@ -703,7 +703,7 @@
  10720. INTERNAL_DEVICE_FLAG_TABLE AcpiInternalDeviceFlagTable[] = {
  10721. "CPQB01D", DEV_CAP_START_IN_D3,
  10722. "IBM3760", DEV_CAP_START_IN_D3,
  10723. - "ACPI0006", DEV_MASK_INTERNAL_BUS | DEV_CAP_CONTAINER,
  10724. + "ACPI0004", DEV_MASK_INTERNAL_BUS | DEV_CAP_CONTAINER,
  10725. "PNP0000", DEV_CAP_PIC_DEVICE | DEV_MASK_INTERNAL_DEVICE,
  10726. "PNP0001", DEV_CAP_PIC_DEVICE | DEV_MASK_INTERNAL_DEVICE,
  10727. "PNP0002", DEV_MASK_INTERNAL_DEVICE,
  10728. diff --strip-trailing-cr -ur ./driver/nt/debug.c "c:\\ACPI\\ACPI_W2003\\Base\\busdrv\\acpi/driver/nt/debug.c"
  10729. --- ./driver/nt/debug.c 2003-02-26 17:15:50.000000000 +0500
  10730. +++ "c:\\ACPI\\ACPI_W2003\\Base\\busdrv\\acpi/driver/nt/debug.c" 2022-04-03 20:19:40.000000000 +0500
  10731. @@ -81,6 +81,16 @@
  10732. KeBugCheckEx (ACPI_DRIVER_INTERNAL, 0x1, Bugcode, 0, 0);
  10733. }
  10734. +VOID
  10735. +_ACPIInternalErrorEx(
  10736. + IN ULONG Bugcode0,
  10737. + IN ULONG_PTR Bugcode1,
  10738. + IN ULONG_PTR Bugcode2
  10739. + )
  10740. +{
  10741. + KeBugCheckEx (ACPI_DRIVER_INTERNAL, 0x2, Bugcode0, Bugcode1, Bugcode2);
  10742. +}
  10743. +
  10744. #if DBG
  10745. VOID
  10746. ACPIDebugPrint(
  10747. diff --strip-trailing-cr -ur ./driver/nt/debug.h "c:\\ACPI\\ACPI_W2003\\Base\\busdrv\\acpi/driver/nt/debug.h"
  10748. --- ./driver/nt/debug.h 2003-02-26 17:15:50.000000000 +0500
  10749. +++ "c:\\ACPI\\ACPI_W2003\\Base\\busdrv\\acpi/driver/nt/debug.h" 2022-04-03 20:18:58.000000000 +0500
  10750. @@ -53,6 +53,13 @@
  10751. IN ULONG Bugcode
  10752. );
  10753.  
  10754. + VOID
  10755. + _ACPIInternalErrorEx(
  10756. + IN ULONG Bugcode0,
  10757. + IN ULONG_PTR Bugcode1,
  10758. + IN ULONG_PTR Bugcode2
  10759. + );
  10760. +
  10761. #if DBG
  10762. VOID
  10763. ACPIDebugResourceDescriptor(
  10764. diff --strip-trailing-cr -ur ./driver/nt/detect.c "c:\\ACPI\\ACPI_W2003\\Base\\busdrv\\acpi/driver/nt/detect.c"
  10765. --- ./driver/nt/detect.c 2003-02-26 17:15:50.000000000 +0500
  10766. +++ "c:\\ACPI\\ACPI_W2003\\Base\\busdrv\\acpi/driver/nt/detect.c" 2022-05-09 18:24:10.759765600 +0500
  10767. @@ -955,13 +955,14 @@
  10768. "ACPIDetectDuplicateHID - matches with %08lx\n",
  10769. childExtension
  10770. ) );
  10771. - KeBugCheckEx(
  10772. - ACPI_BIOS_ERROR,
  10773. - ACPI_REQUIRED_METHOD_NOT_PRESENT,
  10774. - (ULONG_PTR) DeviceExtension,
  10775. - PACKED_UID,
  10776. - 0
  10777. - );
  10778. +
  10779. + //KeBugCheckEx(
  10780. + // ACPI_BIOS_ERROR,
  10781. + // ACPI_REQUIRED_METHOD_NOT_PRESENT,
  10782. + // (ULONG_PTR) DeviceExtension,
  10783. + // PACKED_UID,
  10784. + // 0
  10785. + // );
  10786.  
  10787. //
  10788. // Make sure to only muck with the DeviceExtension UID if it doesn't
  10789. @@ -974,7 +975,7 @@
  10790. //
  10791. DeviceExtension->InstanceID = ExAllocatePoolWithTag(
  10792. NonPagedPool,
  10793. - 9 * sizeof(UCHAR),
  10794. + 5 * sizeof(UCHAR),
  10795. ACPI_STRING_POOLTAG
  10796. );
  10797. if (DeviceExtension->InstanceID == NULL) {
  10798. @@ -987,8 +988,8 @@
  10799. ACPIInternalError( ACPI_DETECT );
  10800.  
  10801. }
  10802. - RtlZeroMemory( DeviceExtension->InstanceID, 9 * sizeof(UCHAR) );
  10803. - sprintf( DeviceExtension->InstanceID, "%lx", DeviceExtension->AcpiObject->dwNameSeg );
  10804. + RtlZeroMemory( DeviceExtension->InstanceID, 5 * sizeof(UCHAR) );
  10805. + sprintf( DeviceExtension->InstanceID, "%.4s", DeviceExtension->AcpiObject->dwNameSeg );
  10806.  
  10807. //
  10808. // Remember that we have a fixed uid
  10809. @@ -1012,7 +1013,7 @@
  10810. //
  10811. childExtension->InstanceID = ExAllocatePoolWithTag(
  10812. NonPagedPool,
  10813. - 9 * sizeof(UCHAR),
  10814. + 5 * sizeof(UCHAR),
  10815. ACPI_STRING_POOLTAG
  10816. );
  10817. if (childExtension->InstanceID == NULL) {
  10818. @@ -1025,8 +1026,8 @@
  10819. ACPIInternalError( ACPI_DETECT );
  10820.  
  10821. }
  10822. - RtlZeroMemory( childExtension->InstanceID, 9 * sizeof(UCHAR) );
  10823. - sprintf( childExtension->InstanceID, "%lx", childExtension->AcpiObject->dwNameSeg );
  10824. + RtlZeroMemory( childExtension->InstanceID, 5 * sizeof(UCHAR) );
  10825. + sprintf( childExtension->InstanceID, "%.4s", childExtension->AcpiObject->dwNameSeg );
  10826.  
  10827. //
  10828. // Update the flags for both devices to indicate the fixed UID
  10829. diff --strip-trailing-cr -ur ./driver/nt/devpower.c "c:\\ACPI\\ACPI_W2003\\Base\\busdrv\\acpi/driver/nt/devpower.c"
  10830. --- ./driver/nt/devpower.c 2003-02-26 17:15:50.000000000 +0500
  10831. +++ "c:\\ACPI\\ACPI_W2003\\Base\\busdrv\\acpi/driver/nt/devpower.c" 2022-04-04 20:23:40.000000000 +0500
  10832. @@ -1170,7 +1170,7 @@
  10833. );
  10834.  
  10835. }
  10836. - return STATUS_INSUFFICIENT_RESOURCES;
  10837. + return STATUS_MORE_PROCESSING_REQUIRED;
  10838.  
  10839. }
  10840.  
  10841. @@ -3547,7 +3547,7 @@
  10842. deviceExtension,
  10843. ACPIDeviceCompleteGenericPhase,
  10844. PowerRequest,
  10845. - &(resultData->uipDataValue),
  10846. + &(resultData->dwDataValue),
  10847. &(resultData->dwDataLen)
  10848. );
  10849. ACPIDevPrint( (
  10850. @@ -3613,7 +3613,7 @@
  10851. // If the bit isn't set as being present, then we must abort this
  10852. // request
  10853. //
  10854. - if (!(resultData->uipDataValue & STA_STATUS_PRESENT) ) {
  10855. + if (!(resultData->dwDataValue & STA_STATUS_PRESENT) ) {
  10856.  
  10857. //
  10858. // The next work done phase is WORK_DONE_FAILURE. This allows the
  10859. @@ -3753,7 +3753,7 @@
  10860. //
  10861. RtlZeroMemory( &(PowerRequest->ResultData), sizeof(OBJDATA) );
  10862. PowerRequest->ResultData.dwDataType = OBJTYPE_INTDATA;
  10863. - PowerRequest->ResultData.uipDataValue = 0;
  10864. + PowerRequest->ResultData.dwDataValue = 0;
  10865.  
  10866.  
  10867. //
  10868. @@ -4006,7 +4006,7 @@
  10869. // case we want to approximate the behaviour of the real _STA...
  10870. //
  10871. resultData->dwDataType = OBJTYPE_INTDATA;
  10872. - resultData->uipDataValue = STA_STATUS_PRESENT;
  10873. + resultData->dwDataValue = STA_STATUS_PRESENT;
  10874. status = STATUS_SUCCESS;
  10875.  
  10876. }
  10877. @@ -4285,7 +4285,7 @@
  10878. POWER_ACTION systemAction;
  10879. SYSTEM_POWER_STATE systemState;
  10880. SYSTEM_POWER_STATE wakeFromState;
  10881. - ULONG hibernateCount = 0;
  10882. + ULONG hibernateCount; // = 0;
  10883.  
  10884. //
  10885. // The next stage after this one is STEP_1
  10886. @@ -4503,7 +4503,7 @@
  10887. //
  10888. RtlZeroMemory( &objData, sizeof(OBJDATA) );
  10889. objData.dwDataType = OBJTYPE_INTDATA;
  10890. - objData.uipDataValue = ACPIDeviceMapACPIPowerState(
  10891. + objData.dwDataValue = ACPIDeviceMapACPIPowerState(
  10892. wakeFromState
  10893. );
  10894.  
  10895. @@ -4712,7 +4712,7 @@
  10896. } // ACPIDevicePowerProcessPhase2SystemSubPhase3
  10897. NTSTATUS
  10898. -ACPIDevicePowerProcessPhase3(
  10899. +ACPIDevicePowerProcessPhase3_rtm(
  10900. VOID
  10901. )
  10902. /*++
  10903. @@ -5059,6 +5059,214 @@
  10904.  
  10905. } // ACPIPowerProcessPhase3
  10906. +
  10907. +#ifdef _X86_
  10908. +
  10909. +NTSTATUS __declspec(naked)
  10910. +ACPIDevicePowerProcessPhase3(
  10911. + VOID
  10912. + ) {
  10913. +_asm {
  10914. + push ebp
  10915. + mov ebp, esp
  10916. + sub esp, 18h
  10917. + push ebx
  10918. + push esi
  10919. + mov ebx, offset AcpiPowerLock
  10920. + push edi
  10921. + mov ecx, ebx
  10922. + mov byte ptr [ebp-1], 0
  10923. + call dword ptr [KefAcquireSpinLockAtDpcLevel]
  10924. + mov esi, dword ptr [AcpiPowerNodeList]
  10925. + mov eax, offset AcpiPowerNodeList
  10926. + cmp esi, eax
  10927. + jz loc_160F6
  10928. + jmp short loc_15FEC
  10929. +
  10930. +loc_15FE9:
  10931. + mov esi, [ebp-0Ch]
  10932. +
  10933. +loc_15FEC:
  10934. + mov eax, [esi]
  10935. + mov [ebp-0Ch], eax
  10936. + mov eax, [esi+8]
  10937. + and eax, 2
  10938. + xor ecx, ecx
  10939. + or eax, ecx
  10940. + jz loc_160E8
  10941. + push 3
  10942. + push 4
  10943. + lea ecx, [esi+28h]
  10944. + pop edx
  10945. + call dword ptr [InterlockedCompareExchange]
  10946. + cmp eax, 3
  10947. + jnz loc_160E8
  10948. + and dword ptr [ebp-8], 0
  10949. + lea eax, [esi+20h]
  10950. + mov edi, [eax]
  10951. + jmp short loc_16062
  10952. +
  10953. +loc_16023:
  10954. + lea eax, [edi-18h]
  10955. + mov edi, [edi]
  10956. + mov [ebp-14h], eax
  10957. + mov eax, [eax+14h]
  10958. + push 0
  10959. + lea ecx, [eax+0F0h]
  10960. + xor edx, edx
  10961. + mov [ebp-10h], eax
  10962. + call dword ptr [InterlockedCompareExchange]
  10963. + mov ecx, [ebp-10h]
  10964. + mov edx, [ecx+0ECh]
  10965. + mov ecx, [ebp-14h]
  10966. + cmp edx, [ecx+0Ch]
  10967. + jz short loc_1605C
  10968. + test eax, eax
  10969. + jz short loc_1605F
  10970. + cmp byte ptr [ecx+10h], 0
  10971. + jz short loc_1605F
  10972. +
  10973. +loc_1605C:
  10974. + inc dword ptr [ebp-8]
  10975. +
  10976. +loc_1605F:
  10977. + lea eax, [esi+20h]
  10978. +
  10979. +loc_16062:
  10980. + cmp edi, eax
  10981. + jnz short loc_16023
  10982. + mov edx, [ebp-8]
  10983. + lea ecx, [esi+10h]
  10984. + call dword ptr [InterlockedExchange]
  10985. + mov eax, [esi+0Ch]
  10986. + mov ecx, [esi+8]
  10987. + mov [ebp-14h], eax
  10988. + mov eax, ecx
  10989. + and eax, 440h
  10990. + xor edx, edx
  10991. + or eax, edx
  10992. + jnz short loc_160E8
  10993. + and ecx, 220h
  10994. + xor eax, eax
  10995. + xor edi, edi
  10996. + or ecx, eax
  10997. + jnz short loc_1609B
  10998. + cmp [ebp-8], edi
  10999. + jz short loc_160E8
  11000. +
  11001. +loc_1609B:
  11002. + xor edx, edx
  11003. + push 4
  11004. + inc edx
  11005. + lea ecx, [esi+28h]
  11006. + call dword ptr [InterlockedCompareExchange]
  11007. + mov ecx, ebx
  11008. + call dword ptr [KefReleaseSpinLockFromDpcLevel]
  11009. + push esi
  11010. + push offset ACPIDeviceCompletePhase3On
  11011. + push edi
  11012. + push edi
  11013. + push edi
  11014. + push dword ptr [esi+2Ch]
  11015. + call AMLIAsyncEvalObject
  11016. + add esp, 18h
  11017. + cmp eax, 103h
  11018. + jz short loc_160DC
  11019. + push esi
  11020. + push edi
  11021. + push eax
  11022. + push dword ptr [esi+2Ch]
  11023. + call ACPIDeviceCompletePhase3On
  11024. + add esp, 10h
  11025. + jmp short loc_160E0
  11026. +
  11027. +loc_160DC:
  11028. + mov byte ptr [ebp-1], 1
  11029. +
  11030. +loc_160E0:
  11031. + mov ecx, ebx
  11032. + call dword ptr [KefAcquireSpinLockAtDpcLevel]
  11033. +
  11034. +loc_160E8:
  11035. + mov eax, offset AcpiPowerNodeList
  11036. + cmp [ebp-0Ch], eax
  11037. + jnz loc_15FE9
  11038. +
  11039. +loc_160F6:
  11040. + mov edi, dword ptr [AcpiPowerNodeList+4] ; Blink
  11041. + cmp edi, eax
  11042. + jz short loc_16178
  11043. +
  11044. +loc_16100:
  11045. + mov esi, edi
  11046. + mov eax, [esi+8]
  11047. + mov edi, [edi+4]
  11048. + and eax, 2
  11049. + xor ecx, ecx
  11050. + or eax, ecx
  11051. + jz short loc_16170
  11052. + xor edx, edx
  11053. + push 4
  11054. + lea ecx, [esi+28h]
  11055. + inc edx
  11056. + call dword ptr [InterlockedCompareExchange]
  11057. + cmp eax, 4
  11058. + jz short loc_1612E
  11059. + test eax, eax
  11060. + jz short loc_16170
  11061. + mov byte ptr [ebp-1], 1
  11062. + jmp short loc_16170
  11063. +
  11064. +loc_1612E:
  11065. + mov ecx, ebx
  11066. + call dword ptr [KefReleaseSpinLockFromDpcLevel]
  11067. + push esi
  11068. + push offset ACPIDeviceCompletePhase3Off
  11069. + xor eax, eax
  11070. + push eax
  11071. + push eax
  11072. + push eax
  11073. + push dword ptr [esi+30h]
  11074. + call AMLIAsyncEvalObject
  11075. + add esp, 18h
  11076. + cmp eax, 103h
  11077. + jz short loc_16164
  11078. + push esi
  11079. + push 0
  11080. + push eax
  11081. + push dword ptr [esi+30h]
  11082. + call ACPIDeviceCompletePhase3Off
  11083. + add esp, 10h
  11084. + jmp short loc_16168
  11085. +
  11086. +loc_16164:
  11087. + mov byte ptr [ebp-1], 1
  11088. +
  11089. +loc_16168:
  11090. + mov ecx, ebx
  11091. + call dword ptr [KefAcquireSpinLockAtDpcLevel]
  11092. +
  11093. +loc_16170:
  11094. + cmp edi, offset AcpiPowerNodeList
  11095. + jnz short loc_16100
  11096. +
  11097. +loc_16178:
  11098. + mov ecx, ebx
  11099. + call dword ptr [KefReleaseSpinLockFromDpcLevel]
  11100. + mov al, [ebp-1]
  11101. + neg al
  11102. + pop edi
  11103. + pop esi
  11104. + pop ebx
  11105. + sbb eax, eax
  11106. + and eax, 103h
  11107. + _emit 0xc9 ; "leave" opcode
  11108. + retn
  11109. +}
  11110. +}
  11111. +
  11112. +#endif
  11113. +
  11114. NTSTATUS
  11115. ACPIDevicePowerProcessPhase4(
  11116. VOID
  11117. @@ -5578,11 +5786,11 @@
  11118. //
  11119. if (flags & DEVICE_REQUEST_LOCK_DEVICE) {
  11120.  
  11121. - objData.uipDataValue = 1; // Lock the device
  11122. + objData.dwDataValue = 1; // Lock the device
  11123.  
  11124. } else if (flags & DEVICE_REQUEST_UNLOCK_DEVICE) {
  11125.  
  11126. - objData.uipDataValue = 0; // Unlock the device
  11127. + objData.dwDataValue = 0; // Unlock the device
  11128.  
  11129. } else {
  11130.  
  11131. @@ -5682,7 +5890,7 @@
  11132. deviceExtension,
  11133. ACPIDeviceCompleteGenericPhase,
  11134. PowerRequest,
  11135. - &(resultData->uipDataValue),
  11136. + &(resultData->dwDataValue),
  11137. &(resultData->dwDataLen)
  11138. );
  11139. ACPIDevPrint( (
  11140. @@ -5754,9 +5962,9 @@
  11141. // First things first --- we just ran _STA (or faked it), so we
  11142. // must check the return data
  11143. //
  11144. - if (!(resultData->uipDataValue & STA_STATUS_PRESENT) ||
  11145. - !(resultData->uipDataValue & STA_STATUS_WORKING_OK) ||
  11146. - ( !(resultData->uipDataValue & STA_STATUS_ENABLED) &&
  11147. + if (!(resultData->dwDataValue & STA_STATUS_PRESENT) ||
  11148. + !(resultData->dwDataValue & STA_STATUS_WORKING_OK) ||
  11149. + ( !(resultData->dwDataValue & STA_STATUS_ENABLED) &&
  11150. !(deviceExtension->Flags & DEV_TYPE_FILTER) ) ) {
  11151.  
  11152. //
  11153. @@ -5958,7 +6166,7 @@
  11154. // Remember that AMLI doesn't use our definitions, so we will
  11155. // have to normalize the S value
  11156. //
  11157. - objData.uipDataValue = ACPIDeviceMapACPIPowerState( systemState );
  11158. + objData.dwDataValue = ACPIDeviceMapACPIPowerState( systemState );
  11159.  
  11160. //
  11161. // Safely run the control method
  11162. @@ -6070,21 +6278,21 @@
  11163.  
  11164. switch (systemState) {
  11165. case PowerSystemWorking:
  11166. - objData.uipDataValue = 1;
  11167. + objData.dwDataValue = 1;
  11168. break;
  11169.  
  11170. case PowerSystemHibernate:
  11171. - objData.uipDataValue = 4;
  11172. + objData.dwDataValue = 4;
  11173. break;
  11174.  
  11175. case PowerSystemSleeping1:
  11176. case PowerSystemSleeping2:
  11177. case PowerSystemSleeping3:
  11178. - objData.uipDataValue = 3;
  11179. + objData.dwDataValue = 3;
  11180. break;
  11181.  
  11182. default:
  11183. - objData.uipDataValue = 0;
  11184. + objData.dwDataValue = 0;
  11185.  
  11186. }
  11187.  
  11188. diff --strip-trailing-cr -ur ./driver/nt/get.c "c:\\ACPI\\ACPI_W2003\\Base\\busdrv\\acpi/driver/nt/get.c"
  11189. --- ./driver/nt/get.c 2003-02-26 17:15:50.000000000 +0500
  11190. +++ "c:\\ACPI\\ACPI_W2003\\Base\\busdrv\\acpi/driver/nt/get.c" 2022-04-06 12:42:32.000000000 +0500
  11191. @@ -160,7 +160,7 @@
  11192. if ( (Flags & GET_EVAL_SIMPLE_INTEGER) ) {
  11193.  
  11194. argument.dwDataType = OBJTYPE_INTDATA;
  11195. - argument.uipDataValue = ( (ULONG_PTR) SimpleArgument );
  11196. + argument.dwDataValue = ( (ULONG)(ULONG_PTR) SimpleArgument );
  11197.  
  11198. } else if ( (Flags & GET_EVAL_SIMPLE_STRING) ) {
  11199.  
  11200. @@ -410,7 +410,7 @@
  11201. //
  11202. // Set the value for the address
  11203. //
  11204. - *( (PULONG) Buffer) = (ULONG)Result->uipDataValue;
  11205. + *( (PULONG) Buffer) = (ULONG)Result->dwDataValue;
  11206.  
  11207. }
  11208.  
  11209. @@ -1371,7 +1371,7 @@
  11210. //
  11211. // Convert the packed string
  11212. //
  11213. - ACPIAmliDoubleToName( buffer+5, (ULONG)Result->uipDataValue, FALSE );
  11214. + ACPIAmliDoubleToName( buffer+5, (ULONG)Result->dwDataValue, FALSE );
  11215.  
  11216. //
  11217. // Done
  11218. @@ -1635,7 +1635,7 @@
  11219. //
  11220. // Convert the packed string
  11221. //
  11222. - ACPIAmliDoubleToNameWide( buffer+5, (ULONG)Result->uipDataValue, FALSE );
  11223. + ACPIAmliDoubleToNameWide( buffer+5, (ULONG)Result->dwDataValue, FALSE );
  11224.  
  11225. //
  11226. // Done
  11227. @@ -1858,7 +1858,7 @@
  11228. //
  11229. // Get the real result
  11230. //
  11231. - deviceStatus = (ULONG)Result->uipDataValue;
  11232. + deviceStatus = (ULONG)Result->dwDataValue;
  11233.  
  11234. } else {
  11235.  
  11236. @@ -1888,7 +1888,7 @@
  11237. //
  11238. // Get the real result
  11239. //
  11240. - deviceStatus = (ULONG)Result->uipDataValue;
  11241. + deviceStatus = (ULONG)Result->dwDataValue;
  11242. goto ACPIGetConvertToDevicePresenceExit2;
  11243.  
  11244. }
  11245. @@ -1937,7 +1937,8 @@
  11246. return STATUS_SUCCESS;
  11247.  
  11248. }
  11249. -
  11250. +
  11251. +#ifdef _X86_
  11252. NTSTATUS
  11253. ACPIGetConvertToHardwareID(
  11254. IN PDEVICE_EXTENSION DeviceExtension,
  11255. @@ -1995,6 +1996,11 @@
  11256. &buffer,
  11257. &memSize
  11258. );
  11259. +
  11260. + if (!NT_SUCCESS(status)) {
  11261. + return status;
  11262. + }
  11263. +
  11264. goto ACPIGetConvertToHardwareIDSuccessExit;
  11265.  
  11266. } else if (!(Flags & GET_PROP_NSOBJ_INTERFACE) &&
  11267. @@ -2112,7 +2118,7 @@
  11268. //
  11269. // Convert the packed string for the PNP ID
  11270. //
  11271. - ACPIAmliDoubleToName( tempString, (ULONG)Result->uipDataValue, FALSE );
  11272. + ACPIAmliDoubleToName( tempString, (ULONG)Result->dwDataValue, FALSE );
  11273.  
  11274. //
  11275. // Done
  11276. @@ -2279,6 +2285,11 @@
  11277. &buffer,
  11278. &memSize
  11279. );
  11280. +
  11281. + if (!NT_SUCCESS(status)) {
  11282. + return status;
  11283. + }
  11284. +
  11285. goto ACPIGetConvertToHardwareIDWideSuccessExit;
  11286.  
  11287. } else if (!(Flags & GET_PROP_NSOBJ_INTERFACE) &&
  11288. @@ -2396,7 +2407,7 @@
  11289. //
  11290. // Convert the packed string for the PNP ID
  11291. //
  11292. - ACPIAmliDoubleToName( tempString, (ULONG)Result->uipDataValue, FALSE );
  11293. + ACPIAmliDoubleToName( tempString, (ULONG)Result->dwDataValue, FALSE );
  11294.  
  11295. //
  11296. // Done
  11297. @@ -2507,6 +2518,8 @@
  11298. return status;
  11299. }
  11300. +#endif // _X86_
  11301. +
  11302. NTSTATUS
  11303. ACPIGetConvertToInstanceID(
  11304. IN PDEVICE_EXTENSION DeviceExtension,
  11305. @@ -2664,7 +2677,7 @@
  11306. //
  11307. // Print the string
  11308. //
  11309. - sprintf( buffer, "%lx", Result->uipDataValue );
  11310. + sprintf( buffer, "%lx", Result->dwDataValue );
  11311.  
  11312. //
  11313. // Done
  11314. @@ -2836,7 +2849,7 @@
  11315. //
  11316. // Print the string
  11317. //
  11318. - swprintf( buffer, L"%lx", Result->uipDataValue );
  11319. + swprintf( buffer, L"%lx", Result->dwDataValue );
  11320.  
  11321. //
  11322. // Done
  11323. @@ -2885,7 +2898,7 @@
  11324. //
  11325. // Print the string
  11326. //
  11327. - swprintf( buffer, L"%lx", Result->uipDataValue );
  11328. + swprintf( buffer, L"%lx", Result->dwDataValue );
  11329.  
  11330. //
  11331. // Done
  11332. @@ -3108,7 +3121,7 @@
  11333. //
  11334. // Convert the packed string
  11335. //
  11336. - ACPIAmliDoubleToName( buffer, (ULONG)Result->uipDataValue, TRUE );
  11337. + ACPIAmliDoubleToName( buffer, (ULONG)Result->dwDataValue, TRUE );
  11338.  
  11339. //
  11340. // Done
  11341. @@ -3347,7 +3360,7 @@
  11342. //
  11343. // Convert the packed string
  11344. //
  11345. - ACPIAmliDoubleToNameWide( buffer, (ULONG)Result->uipDataValue, TRUE );
  11346. + ACPIAmliDoubleToNameWide( buffer, (ULONG)Result->dwDataValue, TRUE );
  11347.  
  11348. //
  11349. // Done
  11350. @@ -3487,7 +3500,7 @@
  11351. //
  11352. // Convert to string
  11353. //
  11354. - swprintf( buffer, L"%X", (ULONG)Result->uipDataValue );
  11355. + swprintf( buffer, L"%X", (ULONG)Result->dwDataValue );
  11356.  
  11357. *(Buffer) = buffer;
  11358. if (BufferSize != NULL) {
  11359. @@ -3712,7 +3725,7 @@
  11360. }
  11361. NTSTATUS
  11362. -ACPIGetProcessorID(
  11363. +ACPIGetProcessorID_rtm(
  11364. IN PDEVICE_EXTENSION DeviceExtension,
  11365. IN NTSTATUS Status,
  11366. IN POBJDATA Result,
  11367. @@ -3933,9 +3946,10 @@
  11368. return STATUS_SUCCESS;
  11369.  
  11370. }
  11371. -
  11372. +
  11373. +
  11374. NTSTATUS
  11375. -ACPIGetProcessorIDWide(
  11376. +ACPIGetProcessorIDWide_rtm(
  11377. IN PDEVICE_EXTENSION DeviceExtension,
  11378. IN NTSTATUS Status,
  11379. IN POBJDATA Result,
  11380. @@ -4154,6 +4168,607 @@
  11381. //
  11382. return STATUS_SUCCESS;
  11383. }
  11384. +
  11385. +char asmStrStrName[] = "%s%s";
  11386. +WCHAR asmSTRSTRBIGName[] = L"%S%S";
  11387. +char asmModelName[] = "Model";
  11388. +char asmFamilyName[] = "Family";
  11389. +char asmACPISlashName[] = "ACPI\\\0\0\0";
  11390. +char asmStarName[] = "*\0\0\0";
  11391. +
  11392. +#ifdef _X86_
  11393. +
  11394. +NTSTATUS __declspec(naked)
  11395. +ACPIGetProcessorID(
  11396. + IN PDEVICE_EXTENSION DeviceExtension,
  11397. + IN NTSTATUS Status,
  11398. + IN POBJDATA Result,
  11399. + IN ULONG Flags,
  11400. + OUT PVOID *Buffer,
  11401. + OUT ULONG *BufferSize
  11402. + ){
  11403. +_asm {
  11404. + push ebp
  11405. + mov ebp, esp
  11406. + sub esp, 28h
  11407. + mov eax, __security_cookie
  11408. + push ebx
  11409. + push esi
  11410. + mov [ebp-4], eax
  11411. + mov eax, [ebp+18h]
  11412. + push edi
  11413. + mov [ebp-24h], eax
  11414. + mov eax, [ebp+1Ch]
  11415. + mov esi, offset asmACPISlashName
  11416. + lea edi, [ebp-0Ch]
  11417. + movsd
  11418. + mov [ebp-20h], eax
  11419. + mov ax, word ptr [asmStarName]
  11420. + movsw
  11421. + mov [ebp-14h], ax
  11422. + mov eax, dword ptr[AcpiProcessorString+4] ; AcpiProcessorString.Buffer
  11423. + xor edi, edi
  11424. + mov [ebp-10h], edi
  11425. + mov [ebp-1Ch], edi
  11426. + lea ecx, [eax+1]
  11427. +
  11428. +loc_18D6C:
  11429. + mov dl, [eax]
  11430. + inc eax
  11431. + test dl, dl
  11432. + jnz short loc_18D6C
  11433. + sub eax, ecx
  11434. + mov ecx, eax
  11435. + lea eax, [ebp-0Ch]
  11436. + lea esi, [eax+1]
  11437. +
  11438. +loc_18D7D:
  11439. + mov dl, [eax]
  11440. + inc eax
  11441. + test dl, dl
  11442. + jnz short loc_18D7D
  11443. + sub eax, esi
  11444. + lea esi, [eax+ecx+1]
  11445. + mov eax, [ebp+14h]
  11446. + and eax, 40h
  11447. + mov [ebp-18h], esi
  11448. + mov [ebp-28h], eax
  11449. + jz loc_18E5D
  11450. + push 53706341h
  11451. + push esi
  11452. + push edi
  11453. + call dword ptr [ExAllocatePoolWithTag]
  11454. + mov ebx, eax
  11455. + cmp ebx, edi
  11456. + mov [ebp-10h], ebx
  11457. + jz loc_18E98
  11458. + mov ecx, esi
  11459. + mov edx, ecx
  11460. + shr ecx, 2
  11461. + xor eax, eax
  11462. + mov edi, ebx
  11463. + rep stosd
  11464. + mov ecx, edx
  11465. + and ecx, 3
  11466. + rep stosb
  11467. + mov eax, dword ptr[AcpiProcessorString+4] ; AcpiProcessorString.Buffer
  11468. + mov edx, ebx
  11469. +
  11470. +loc_18DD1:
  11471. + mov cl, [eax]
  11472. + inc eax
  11473. + mov [edx], cl
  11474. + inc edx
  11475. + test cl, cl
  11476. + jnz short loc_18DD1
  11477. + mov edi, dword ptr [strstr]
  11478. + push offset asmModelName
  11479. + push ebx
  11480. + call edi
  11481. + push offset asmFamilyName
  11482. + push ebx
  11483. + mov [ebp-1Ch], eax
  11484. + call edi
  11485. + add esp, 10h
  11486. + cmp dword ptr [ebp-1Ch], 0
  11487. + jz loc_18EA2
  11488. + test eax, eax
  11489. + jz loc_18EA2
  11490. + lea ecx, [ebp-0Ch]
  11491. + lea edi, [ecx+1]
  11492. +
  11493. +loc_18E0F:
  11494. + mov dl, [ecx]
  11495. + inc ecx
  11496. + test dl, dl
  11497. + jnz short loc_18E0F
  11498. + sub ecx, edi
  11499. + mov [ebp-18h], ecx
  11500. + lea ecx, [ebp-14h]
  11501. + lea edx, [ecx+1]
  11502. +
  11503. +loc_18E21:
  11504. + mov bl, [ecx]
  11505. + inc ecx
  11506. + test bl, bl
  11507. + jnz short loc_18E21
  11508. + sub ecx, edx
  11509. + mov edx, [ebp-1Ch]
  11510. + lea edi, [edx+1]
  11511. +
  11512. +loc_18E30:
  11513. + mov bl, [edx]
  11514. + inc edx
  11515. + test bl, bl
  11516. + jnz short loc_18E30
  11517. + sub edx, edi
  11518. + lea edi, [eax+1]
  11519. +
  11520. +loc_18E3C:
  11521. + mov bl, [eax]
  11522. + inc eax
  11523. + test bl, bl
  11524. + jnz short loc_18E3C
  11525. + sub eax, edi
  11526. + mov edi, eax
  11527. + lea eax, [ecx+esi*2]
  11528. + add eax, [ebp-18h]
  11529. + add edi, edx
  11530. + shl edi, 1
  11531. + lea eax, [eax+eax*2]
  11532. + sub eax, edi
  11533. + mov [ebp-18h], eax
  11534. + mov esi, eax
  11535. + xor edi, edi
  11536. +
  11537. +loc_18E5D:
  11538. + mov eax, [ebp+14h]
  11539. + shr eax, 1Ch
  11540. + push 53706341h
  11541. + not eax
  11542. + push esi
  11543. + and eax, 1
  11544. + push eax
  11545. + call dword ptr [ExAllocatePoolWithTag]
  11546. + mov ebx, eax
  11547. + cmp ebx, edi
  11548. + jnz short loc_18EB5
  11549. + mov eax, [ebp-24h]
  11550. + mov [eax], edi
  11551. + mov eax, [ebp-20h]
  11552. + cmp eax, edi
  11553. + jz short loc_18E89
  11554. + mov [eax], edi
  11555. +
  11556. +loc_18E89:
  11557. + cmp [ebp-10h], edi
  11558. + jz short loc_18E98
  11559. + push edi
  11560. + push dword ptr [ebp-10h]
  11561. + call dword ptr [ExFreePoolWithTag]
  11562. +
  11563. +loc_18E98:
  11564. + mov eax, 0C000009Ah
  11565. + jmp loc_18FB1
  11566. +
  11567. +loc_18EA2:
  11568. + push 0
  11569. + push ebx
  11570. + call dword ptr [ExFreePoolWithTag]
  11571. + mov eax, 0C0000001h
  11572. + jmp loc_18FB1
  11573. +
  11574. +loc_18EB5: ; ACPIGetProcessorID(x,x,x,x,x,x)+151j
  11575. + mov ecx, esi
  11576. + mov edx, ecx
  11577. + shr ecx, 2
  11578. + xor eax, eax
  11579. + mov edi, ebx
  11580. + rep stosd
  11581. + mov ecx, edx
  11582. + and ecx, 3
  11583. + test byte ptr [ebp+14h], 20h
  11584. + rep stosb
  11585. + jz short loc_18EED
  11586. + push dword ptr[AcpiProcessorString+4] ; AcpiProcessorString.Buffer
  11587. + lea eax, [ebp-0Ch]
  11588. + push eax
  11589. + push offset asmStrStrName
  11590. + push ebx
  11591. + call dword ptr [sprintf]
  11592. + add esp, 10h
  11593. + jmp loc_18F8D
  11594. +
  11595. +loc_18EED:
  11596. + cmp dword ptr [ebp-28h], 0
  11597. + jz loc_18F8D
  11598. + push dword ptr [ebp-10h]
  11599. + mov esi, dword ptr [sprintf]
  11600. + lea eax, [ebp-0Ch]
  11601. + push eax
  11602. + push offset asmStrStrName
  11603. + push ebx
  11604. + call esi
  11605. + push dword ptr [ebp-10h]
  11606. + mov edi, eax
  11607. + lea eax, [ebp-14h]
  11608. + push eax
  11609. + inc edi
  11610. + lea eax, [ebx+edi]
  11611. + push offset asmStrStrName
  11612. + push eax
  11613. + call esi
  11614. + push dword ptr [ebp-10h]
  11615. + add edi, eax
  11616. + mov eax, [ebp-1Ch]
  11617. + mov byte ptr [eax-1], 0
  11618. + lea eax, [ebp-0Ch]
  11619. + push eax
  11620. + inc edi
  11621. + lea eax, [ebx+edi]
  11622. + push offset asmStrStrName
  11623. + push eax
  11624. + call esi
  11625. + push dword ptr [ebp-10h]
  11626. + lea edi, [edi+eax+1]
  11627. + lea eax, [ebp-14h]
  11628. + push eax
  11629. + lea eax, [ebx+edi]
  11630. + push offset asmStrStrName
  11631. + push eax
  11632. + call esi
  11633. + add edi, eax
  11634. + mov eax, [ebp-1Ch]
  11635. + add esp, 40h
  11636. + push dword ptr [ebp-10h]
  11637. + mov byte ptr [eax-1], 0
  11638. + lea eax, [ebp-0Ch]
  11639. + push eax
  11640. + inc edi
  11641. + lea eax, [ebx+edi]
  11642. + push offset asmStrStrName
  11643. + push eax
  11644. + call esi
  11645. + push dword ptr [ebp-10h]
  11646. + lea ecx, [ebp-14h]
  11647. + push ecx
  11648. + lea eax, [edi+eax+1]
  11649. + add eax, ebx
  11650. + push offset asmStrStrName
  11651. + push eax
  11652. + call esi
  11653. + mov esi, [ebp-18h]
  11654. + add esp, 20h
  11655. +
  11656. +loc_18F8D:
  11657. + cmp dword ptr [ebp-10h], 0
  11658. + jz short loc_18F9E
  11659. + push 0
  11660. + push dword ptr [ebp-10h]
  11661. + call dword ptr [ExFreePoolWithTag]
  11662. +
  11663. +loc_18F9E:
  11664. + mov eax, [ebp-24h]
  11665. + mov [eax], ebx
  11666. + mov eax, [ebp-20h]
  11667. + test eax, eax
  11668. + jz short loc_18FAF
  11669. + lea ecx, [esi+esi]
  11670. + mov [eax], ecx
  11671. +
  11672. +loc_18FAF:
  11673. + xor eax, eax
  11674. +
  11675. +loc_18FB1:
  11676. + mov ecx, [ebp-4]
  11677. + pop edi
  11678. + pop esi
  11679. + pop ebx
  11680. + call __security_check_cookie
  11681. + _emit 0xc9 ; "leave" opcode
  11682. + retn 18h
  11683. +}
  11684. +}
  11685. +
  11686. +
  11687. +NTSTATUS __declspec(naked)
  11688. +ACPIGetProcessorIDWide(
  11689. + IN PDEVICE_EXTENSION DeviceExtension,
  11690. + IN NTSTATUS Status,
  11691. + IN POBJDATA Result,
  11692. + IN ULONG Flags,
  11693. + OUT PVOID *Buffer,
  11694. + OUT ULONG *BufferSize
  11695. + ){
  11696. +_asm {
  11697. + push ebp
  11698. + mov ebp, esp
  11699. + sub esp, 2Ch
  11700. + mov eax, __security_cookie
  11701. + push ebx
  11702. + push esi
  11703. + mov [ebp-4], eax
  11704. + mov eax, [ebp+18h]
  11705. + push edi
  11706. + mov [ebp-24h], eax
  11707. + mov eax, [ebp+1Ch]
  11708. + mov esi, offset asmACPISlashName
  11709. + lea edi, [ebp-0Ch]
  11710. + movsd
  11711. + mov [ebp-28h], eax
  11712. + mov ax, word ptr [asmStarName]
  11713. + movsw
  11714. + xor edi, edi
  11715. + mov [ebp-14h], ax
  11716. + mov eax, dword ptr[AcpiProcessorString+4] ; AcpiProcessorString.Buffer
  11717. + mov [ebp-10h], edi
  11718. + mov [ebp-18h], edi
  11719. + mov [ebp-1Ch], edi
  11720. + lea ecx, [eax+1]
  11721. +
  11722. +loc_1907B:
  11723. + mov dl, [eax]
  11724. + inc eax
  11725. + test dl, dl
  11726. + jnz short loc_1907B
  11727. + sub eax, ecx
  11728. + mov ecx, eax
  11729. + lea eax, [ebp-0Ch]
  11730. + lea esi, [eax+1]
  11731. +
  11732. +loc_1908C:
  11733. + mov dl, [eax]
  11734. + inc eax
  11735. + test dl, dl
  11736. + jnz short loc_1908C
  11737. + sub eax, esi
  11738. + lea ebx, [eax+ecx+1]
  11739. + mov eax, [ebp+14h]
  11740. + and eax, 40h
  11741. + mov [ebp-2Ch], eax
  11742. + jz loc_19172
  11743. + push 53706341h
  11744. + push ebx
  11745. + push edi
  11746. + call dword ptr [ExAllocatePoolWithTag]
  11747. + mov esi, eax
  11748. + cmp esi, edi
  11749. + mov [ebp-10h], esi
  11750. + jz loc_191B3
  11751. + mov ecx, ebx
  11752. + mov edx, ecx
  11753. + shr ecx, 2
  11754. + xor eax, eax
  11755. + mov edi, esi
  11756. + rep stosd
  11757. + mov ecx, edx
  11758. + and ecx, 3
  11759. + rep stosb
  11760. + mov eax, dword ptr[AcpiProcessorString+4] ; AcpiProcessorString.Buffer
  11761. + mov edx, esi
  11762. +
  11763. +loc_190DD:
  11764. + mov cl, [eax]
  11765. + inc eax
  11766. + mov [edx], cl
  11767. + inc edx
  11768. + test cl, cl
  11769. + jnz short loc_190DD
  11770. + mov edi, dword ptr [strstr]
  11771. + push offset asmModelName
  11772. + push esi
  11773. + call edi
  11774. + push offset asmFamilyName
  11775. + push esi
  11776. + mov [ebp-18h], eax
  11777. + call edi
  11778. + mov [ebp-1Ch], eax
  11779. + xor eax, eax
  11780. + add esp, 10h
  11781. + cmp [ebp-18h], eax
  11782. + jz loc_191BD
  11783. + cmp [ebp-1Ch], eax
  11784. + jz loc_191BD
  11785. + lea eax, [ebp-0Ch]
  11786. + lea edx, [eax+1]
  11787. +
  11788. +loc_19120:
  11789. + mov cl, [eax]
  11790. + inc eax
  11791. + test cl, cl
  11792. + jnz short loc_19120
  11793. + sub eax, edx
  11794. + mov [ebp-20h], eax
  11795. + lea eax, [ebp-14h]
  11796. + lea esi, [eax+1]
  11797. +
  11798. +loc_19132:
  11799. + mov cl, [eax]
  11800. + inc eax
  11801. + test cl, cl
  11802. + jnz short loc_19132
  11803. + sub eax, esi
  11804. + mov edx, eax
  11805. + mov eax, [ebp-18h]
  11806. + lea esi, [eax+1]
  11807. +
  11808. +loc_19143:
  11809. + mov cl, [eax]
  11810. + inc eax
  11811. + test cl, cl
  11812. + jnz short loc_19143
  11813. + sub eax, esi
  11814. + mov esi, eax
  11815. + mov eax, [ebp-1Ch]
  11816. + lea edi, [eax+1]
  11817. +
  11818. +loc_19154:
  11819. + mov cl, [eax]
  11820. + inc eax
  11821. + test cl, cl
  11822. + jnz short loc_19154
  11823. + sub eax, edi
  11824. + mov ecx, eax
  11825. + lea eax, [edx+ebx*2]
  11826. + add eax, [ebp-20h]
  11827. + add ecx, esi
  11828. + lea eax, [eax+eax*2]
  11829. + shl ecx, 1
  11830. + mov ebx, eax
  11831. + sub ebx, ecx
  11832. + xor edi, edi
  11833. +
  11834. +loc_19172:
  11835. + mov eax, [ebp+14h]
  11836. + shr eax, 1Ch
  11837. + push 53706341h
  11838. + lea esi, [ebx+ebx]
  11839. + not eax
  11840. + push esi
  11841. + and eax, 1
  11842. + push eax
  11843. + mov [ebp-20h], esi
  11844. + call dword ptr [ExAllocatePoolWithTag]
  11845. + mov ebx, eax
  11846. + cmp ebx, edi
  11847. + jnz short loc_191CF
  11848. + mov eax, [ebp-24h]
  11849. + mov [eax], edi
  11850. + mov eax, [ebp-28h]
  11851. + cmp eax, edi
  11852. + jz short loc_191A4
  11853. + mov [eax], edi
  11854. +
  11855. +loc_191A4:
  11856. + cmp [ebp-10h], edi
  11857. + jz short loc_191B3
  11858. + push edi
  11859. + push dword ptr [ebp-10h]
  11860. + call dword ptr [ExFreePoolWithTag]
  11861. +
  11862. +loc_191B3:
  11863. + mov eax, 0C000009Ah
  11864. + jmp loc_192C9
  11865. +
  11866. +loc_191BD:
  11867. + push eax
  11868. + push esi
  11869. + call dword ptr [ExFreePoolWithTag]
  11870. + mov eax, 0C0000001h
  11871. + jmp loc_192C9
  11872. +
  11873. +loc_191CF:
  11874. + mov ecx, esi
  11875. + mov edx, ecx
  11876. + shr ecx, 2
  11877. + xor eax, eax
  11878. + mov edi, ebx
  11879. + rep stosd
  11880. + mov ecx, edx
  11881. + and ecx, 3
  11882. + test byte ptr [ebp+14h], 20h
  11883. + rep stosb
  11884. + jz short loc_19207
  11885. + push dword ptr[AcpiProcessorString+4] ; AcpiProcessorString.Buffer
  11886. + lea eax, [ebp-0Ch]
  11887. + push eax
  11888. + push offset asmSTRSTRBIGName
  11889. + push ebx
  11890. + call dword ptr [swprintf]
  11891. + add esp, 10h
  11892. + jmp loc_192A8
  11893. +
  11894. +loc_19207:
  11895. + cmp dword ptr [ebp-2Ch], 0
  11896. + jz loc_192A8
  11897. + push dword ptr [ebp-10h]
  11898. + mov esi, dword ptr [swprintf]
  11899. + lea eax, [ebp-0Ch]
  11900. + push eax
  11901. + push offset asmSTRSTRBIGName
  11902. + push ebx
  11903. + call esi
  11904. + push dword ptr [ebp-10h]
  11905. + mov edi, eax
  11906. + lea eax, [ebp-14h]
  11907. + push eax
  11908. + inc edi
  11909. + lea eax, [ebx+edi*2]
  11910. + push offset asmSTRSTRBIGName
  11911. + push eax
  11912. + call esi
  11913. + push dword ptr [ebp-10h]
  11914. + add edi, eax
  11915. + mov eax, [ebp-18h]
  11916. + mov byte ptr [eax-1], 0
  11917. + lea eax, [ebp-0Ch]
  11918. + push eax
  11919. + inc edi
  11920. + lea eax, [ebx+edi*2]
  11921. + push offset asmSTRSTRBIGName
  11922. + push eax
  11923. + call esi
  11924. + push dword ptr [ebp-10h]
  11925. + lea edi, [edi+eax+1]
  11926. + lea eax, [ebp-14h]
  11927. + push eax
  11928. + lea eax, [ebx+edi*2]
  11929. + push offset asmSTRSTRBIGName
  11930. + push eax
  11931. + call esi
  11932. + add edi, eax
  11933. + mov eax, [ebp-1Ch]
  11934. + add esp, 40h
  11935. + push dword ptr [ebp-10h]
  11936. + mov byte ptr [eax-1], 0
  11937. + lea eax, [ebp-0Ch]
  11938. + push eax
  11939. + inc edi
  11940. + lea eax, [ebx+edi*2]
  11941. + push offset asmSTRSTRBIGName
  11942. + push eax
  11943. + call esi ;
  11944. + push dword ptr [ebp-10h]
  11945. + lea ecx, [ebp-14h]
  11946. + push ecx
  11947. + lea eax, [edi+eax+1]
  11948. + lea eax, [ebx+eax*2]
  11949. + push offset asmSTRSTRBIGName
  11950. + push eax
  11951. + call esi ;
  11952. + mov esi, [ebp-20h]
  11953. + add esp, 20h
  11954. +
  11955. +loc_192A8:
  11956. + cmp dword ptr [ebp-10h], 0
  11957. + jz short loc_192B9
  11958. + push 0
  11959. + push dword ptr [ebp-10h]
  11960. + call dword ptr [ExFreePoolWithTag]
  11961. +
  11962. +loc_192B9:
  11963. + mov eax, [ebp-24h]
  11964. + mov [eax], ebx
  11965. + mov eax, [ebp-28h]
  11966. + test eax, eax
  11967. + jz short loc_192C7
  11968. + mov [eax], esi
  11969. +
  11970. +loc_192C7:
  11971. + xor eax, eax
  11972. +
  11973. +loc_192C9:
  11974. + mov ecx, [ebp-4]
  11975. + pop edi
  11976. + pop esi
  11977. + pop ebx
  11978. + call __security_check_cookie
  11979. + _emit 0xc9 ; "leave" opcode
  11980. + retn 18h
  11981. +}
  11982. +}
  11983. +
  11984. +#endif // _X86_
  11985. NTSTATUS
  11986. ACPIGetProcessorStatus(
  11987. @@ -4768,7 +5383,7 @@
  11988. //
  11989. // Set the value to what we should return
  11990. //
  11991. - *( (PULONG) (request->Buffer) ) = (ULONG)Result->uipDataValue;
  11992. + *( (PULONG) (request->Buffer) ) = (ULONG)Result->dwDataValue;
  11993. if (request->BufferSize != NULL) {
  11994.  
  11995. *(request->BufferSize) = sizeof(ULONG);
  11996. diff --strip-trailing-cr -ur ./driver/nt/init.c "c:\\ACPI\\ACPI_W2003\\Base\\busdrv\\acpi/driver/nt/init.c"
  11997. --- ./driver/nt/init.c 2003-02-26 17:15:50.000000000 +0500
  11998. +++ "c:\\ACPI\\ACPI_W2003\\Base\\busdrv\\acpi/driver/nt/init.c" 2022-04-03 00:32:28.000000000 +0500
  11999. @@ -1013,6 +1013,8 @@
  12000. PCM_RESOURCE_LIST cmResourceList;
  12001. PDEVICE_OBJECT deviceObject = NULL;
  12002. PDEVICE_OBJECT targetObject = NULL;
  12003. + ACPI_ARBITER_INSTANCE **arbiter;
  12004. + ULONG i;
  12005.  
  12006. //
  12007. // We require the spinlock for parts of this
  12008. @@ -1069,6 +1071,16 @@
  12009. deviceObject->DeviceExtension = NULL;
  12010. DeviceExtension->DeviceObject = NULL;
  12011.  
  12012. + if (DeviceExtension->Flags & DEV_CAP_CONTAINER &&
  12013. + DeviceExtension->Module.ArbitersNeeded) {
  12014. + arbiter = DeviceExtension->Module.Arbiters;
  12015. + for (i = 0; i < 3; i++) {
  12016. + AcpiArblibFreeArbiterInstance(*arbiter);
  12017. + *arbiter = NULL;
  12018. + arbiter++;
  12019. + }
  12020. + }
  12021. +
  12022. //
  12023. // The reference count should have value > 0
  12024. //
  12025. @@ -1628,7 +1640,8 @@
  12026. PNSOBJ workObject;
  12027. POWER_STATE state;
  12028. ULONG deviceStatus;
  12029. -
  12030. + ACPI_ARBITER_INSTANCE **arbiter;
  12031. + int i;
  12032. PAGED_CODE();
  12033.  
  12034. //
  12035. @@ -1663,6 +1676,16 @@
  12036.  
  12037. }
  12038.  
  12039. + if (DeviceExtension->Flags & DEV_CAP_CONTAINER &&
  12040. + DeviceExtension->Module.ArbitersNeeded) {
  12041. + arbiter = DeviceExtension->Module.Arbiters;
  12042. + for (i = 0; i < 3; i++) {
  12043. + (*arbiter)->SomeField = FALSE;
  12044. + arbiter++;
  12045. + }
  12046. + }
  12047. +
  12048. +
  12049. //
  12050. // Nothing to stop...
  12051. //
  12052. diff --strip-trailing-cr -ur ./driver/nt/internal.c "c:\\ACPI\\ACPI_W2003\\Base\\busdrv\\acpi/driver/nt/internal.c"
  12053. --- ./driver/nt/internal.c 2003-02-26 17:15:52.000000000 +0500
  12054. +++ "c:\\ACPI\\ACPI_W2003\\Base\\busdrv\\acpi/driver/nt/internal.c" 2022-04-03 20:18:42.000000000 +0500
  12055. @@ -304,6 +304,14 @@
  12056. //
  12057. deviceExtension = DeviceObject->DeviceExtension;
  12058.  
  12059. + if ( deviceExtension &&
  12060. + deviceExtension->Signature != '_SGP' ) {
  12061. + _ACPIInternalErrorEx(0x00090147,
  12062. + (ULONG_PTR)DeviceObject,
  12063. + (ULONG_PTR)deviceExtension);
  12064. + }
  12065. +
  12066. +
  12067. #if 0
  12068. //
  12069. // Is this a surprise removed device extension?
  12070. diff --strip-trailing-cr -ur ./driver/nt/interupt.c "c:\\ACPI\\ACPI_W2003\\Base\\busdrv\\acpi/driver/nt/interupt.c"
  12071. --- ./driver/nt/interupt.c 2003-02-26 17:15:52.000000000 +0500
  12072. +++ "c:\\ACPI\\ACPI_W2003\\Base\\busdrv\\acpi/driver/nt/interupt.c" 2022-04-04 04:51:50.000000000 +0500
  12073. @@ -711,7 +711,7 @@
  12074. // behind our back. The way that we can correct this problem is by
  12075. // forcing a check of the GPEs...
  12076. //
  12077. - if (!IntStatus) {
  12078. + if ( !(AcpiOverrideAttributes & ACPI_OVERRIDE_GPE_PENDING) && !IntStatus ) {
  12079.  
  12080. IntStatus |= PM1_GPE_PENDING;
  12081.  
  12082. diff --strip-trailing-cr -ur ./driver/nt/irqarb.c "c:\\ACPI\\ACPI_W2003\\Base\\busdrv\\acpi/driver/nt/irqarb.c"
  12083. --- ./driver/nt/irqarb.c 2003-02-26 17:15:52.000000000 +0500
  12084. +++ "c:\\ACPI\\ACPI_W2003\\Base\\busdrv\\acpi/driver/nt/irqarb.c" 2022-04-16 10:26:14.839843700 +0500
  12085. @@ -3531,8 +3531,24 @@
  12086. }
  12087. }
  12088.  
  12089. - ASSERT(PciInterfacesInstantiated);
  12090. + // BSOD 0x7E(c0000005, ...) AcpiArbCrackPRT() two workarounds:
  12091. + // 1) pci.sys presence check
  12092. + // 2) not PCI device type check
  12093. + if (0) {
  12094. + if (!PciInterfacesInstantiated) {
  12095. + return STATUS_NOT_FOUND;
  12096. + }
  12097. + } else {
  12098. + if (Pdo->DriverObject == AcpiDriverObject) {
  12099. + status = ACPIInternalIsPci(Pdo);
  12100. + if (NT_SUCCESS(status))
  12101. + if ( (((PDEVICE_EXTENSION)Pdo->DeviceExtension)->Flags & DEV_CAP_PCI_DEVICE) == 0 )
  12102. + return STATUS_NOT_FOUND;
  12103. + }
  12104. + }
  12105.  
  12106. + ASSERT(PciInterfacesInstantiated);
  12107. +
  12108. *LinkNode = NULL;
  12109.  
  12110. pciInterface = ((PARBITER_EXTENSION)AcpiArbiter.ArbiterState.Extension)->InterruptRouting;
  12111. @@ -3750,9 +3766,9 @@
  12112. 0,
  12113. &adrData))) {
  12114.  
  12115. - if (pciSlot.u.bits.DeviceNumber == (adrData.uipDataValue >> 16)) {
  12116. + if (pciSlot.u.bits.DeviceNumber == (adrData.dwDataValue >> 16)) {
  12117.  
  12118. - if ((adrData.uipDataValue & 0xffff) != 0xffff) {
  12119. + if ((adrData.dwDataValue & 0xffff) != 0xffff) {
  12120. ////
  12121. //// An _ADR in a _PRT must be of the form xxxxFFFF,
  12122. //// which means that the PCI Device Number is specified,
  12123. @@ -3766,14 +3782,14 @@
  12124. // ACPI_PRT_HAS_INVALID_FUNCTION_NUMBERS,
  12125. // (ULONG_PTR)prtObj,
  12126. // prtElement,
  12127. - // adrData.uipDataValue);
  12128. + // adrData.dwDataValue);
  12129.  
  12130.  
  12131. - DEBUG_PRINT(0, ("PRT entry has ambiguous address %x\n", adrData.uipDataValue));
  12132. + DEBUG_PRINT(0, ("PRT entry has ambiguous address %x\n", adrData.dwDataValue));
  12133.  
  12134. status = STATUS_INVALID_PARAMETER;
  12135. - pciSlot.u.bits.DeviceNumber = (ULONG)(adrData.uipDataValue >> 16) & 0xffff;
  12136. - pciSlot.u.bits.FunctionNumber = (ULONG)(adrData.uipDataValue & 0xffff);
  12137. + pciSlot.u.bits.DeviceNumber = (ULONG)(adrData.dwDataValue >> 16) & 0xffff;
  12138. + pciSlot.u.bits.FunctionNumber = (ULONG)(adrData.dwDataValue & 0xffff);
  12139. AMLIFreeDataBuffs(&adrData, 1);
  12140. AMLIFreeDataBuffs(&prtData, 1);
  12141. goto AcpiArbCrackPRTError;
  12142. @@ -3795,7 +3811,7 @@
  12143. 1,
  12144. &pinData))) {
  12145.  
  12146. - if (pinData.uipDataValue == interruptPin) {
  12147. + if (pinData.dwDataValue == interruptPin) {
  12148. //
  12149. // This is the package that describes the link node we
  12150. // are interested in. Get the name of the link node.
  12151. @@ -3868,7 +3884,7 @@
  12152. // We have an integer which describes the "Global System Interrupt Vector"
  12153. // that this PCI device will trigger.
  12154. //
  12155. - *Vector = (ULONG)indexData.uipDataValue;
  12156. + *Vector = (ULONG)indexData.dwDataValue;
  12157.  
  12158. status = STATUS_SUCCESS;
  12159.  
  12160. @@ -4993,7 +5009,7 @@
  12161. }
  12162.  
  12163. } else {
  12164. -
  12165. + if (0) { // BSOD 0xA5 (0x10006, ...) workaround, missing _DIS method for "PNP0C0F" (PCI Interrupt Link Devices)
  12166. //
  12167. // Link nodes must be disablable.
  12168. //
  12169. @@ -5003,6 +5019,7 @@
  12170. (ULONG_PTR)context->RootDevice,
  12171. 0,
  12172. 0);
  12173. + }
  12174. }
  12175. }
  12176. }
  12177. diff --strip-trailing-cr -ur ./driver/nt/match.c "c:\\ACPI\\ACPI_W2003\\Base\\busdrv\\acpi/driver/nt/match.c"
  12178. --- ./driver/nt/match.c 2003-02-26 17:15:52.000000000 +0500
  12179. +++ "c:\\ACPI\\ACPI_W2003\\Base\\busdrv\\acpi/driver/nt/match.c" 2022-04-04 21:11:12.000000000 +0500
  12180. @@ -501,7 +501,7 @@
  12181. //
  12182. // Does the minimum address match?
  12183. //
  12184. - if (((KdComPortInUse != NULL) && (baseAddress == kdBaseAddr)) ||
  12185. + if (((kdBaseAddr != NULL) && (baseAddress == kdBaseAddr)) ||
  12186. ((headlessBaseAddress != NULL) && (baseAddress == headlessBaseAddress))) {
  12187.  
  12188. //
  12189. Only in c:\ACPI\ACPI_W2003\Base\busdrv\acpi/driver/nt: obj
  12190. diff --strip-trailing-cr -ur ./driver/nt/osnotify.c "c:\\ACPI\\ACPI_W2003\\Base\\busdrv\\acpi/driver/nt/osnotify.c"
  12191. --- ./driver/nt/osnotify.c 2003-02-26 17:15:52.000000000 +0500
  12192. +++ "c:\\ACPI\\ACPI_W2003\\Base\\busdrv\\acpi/driver/nt/osnotify.c" 2022-04-04 02:40:34.000000000 +0500
  12193. @@ -723,7 +723,7 @@
  12194. NTSTATUS
  12195. EXPORT
  12196. -OSNotifyDeviceCheck(
  12197. +OSNotifyDeviceCheck_rtm(
  12198. IN PNSOBJ AcpiObject
  12199. )
  12200. /*++
  12201. @@ -828,6 +828,88 @@
  12202. return STATUS_SUCCESS;
  12203. }
  12204. +
  12205. +#ifdef _X86_
  12206. +
  12207. +NTSTATUS __declspec(naked)
  12208. +EXPORT
  12209. +OSNotifyDeviceCheck(
  12210. + IN PNSOBJ AcpiObject
  12211. + ) {
  12212. +_asm {
  12213. + push ebp
  12214. + mov ebp, esp
  12215. + push dword ptr [ebp+8]
  12216. + call ACPIDockIsDockDevice
  12217. + test al, al
  12218. + jz short loc_1DACB
  12219. + pop ebp
  12220. + jmp OSNotifyDeviceEject
  12221. +
  12222. +loc_1DACB:
  12223. + push ebx
  12224. + push esi
  12225. + mov esi, offset AcpiDeviceTreeLock
  12226. + mov ecx, esi
  12227. + call dword ptr [KfAcquireSpinLock]
  12228. + mov ecx, [ebp+8]
  12229. + mov bl, al
  12230. + xor edx, edx
  12231. +
  12232. +loc_1DAE1:
  12233. + mov eax, [ecx+30h]
  12234. + cmp eax, edx
  12235. + mov ecx, [ecx+8]
  12236. + jz short loc_1DAFA
  12237. + cmp dword ptr [eax+8], 5F534750h
  12238. + jz short loc_1DAF6
  12239. + xor eax, eax
  12240. +
  12241. +loc_1DAF6:
  12242. + cmp eax, edx
  12243. + jnz short loc_1DB02
  12244. +
  12245. +loc_1DAFA:
  12246. + cmp ecx, edx
  12247. + jnz short loc_1DAE1
  12248. + cmp eax, edx
  12249. + jz short loc_1DB2C
  12250. +
  12251. +loc_1DB02:
  12252. + mov ecx, [eax+13Ch]
  12253. + jmp short loc_1DB19
  12254. +
  12255. +loc_1DB0A:
  12256. + mov eax, [ecx]
  12257. + and eax, 8
  12258. + or eax, edx
  12259. + jz short loc_1DB1F
  12260. + mov ecx, [ecx+13Ch]
  12261. +
  12262. +loc_1DB19:
  12263. + cmp ecx, edx
  12264. + jnz short loc_1DB0A
  12265. + jmp short loc_1DB2C
  12266. +
  12267. +loc_1DB1F:
  12268. + push edx
  12269. + push dword ptr [ecx+138h]
  12270. + call dword ptr [IoInvalidateDeviceRelations]
  12271. +
  12272. +loc_1DB2C:
  12273. + mov ecx, esi
  12274. + mov dl, bl
  12275. + call dword ptr [KfReleaseSpinLock]
  12276. + pop esi
  12277. + xor eax, eax
  12278. + pop ebx
  12279. + pop ebp
  12280. + retn
  12281. +}
  12282. +}
  12283. +
  12284. +#endif
  12285. +
  12286. NTSTATUS
  12287. EXPORT
  12288. OSNotifyDeviceEnum(
  12289. diff --strip-trailing-cr -ur ./driver/nt/pch.h "c:\\ACPI\\ACPI_W2003\\Base\\busdrv\\acpi/driver/nt/pch.h"
  12290. --- ./driver/nt/pch.h 2003-02-26 17:15:52.000000000 +0500
  12291. +++ "c:\\ACPI\\ACPI_W2003\\Base\\busdrv\\acpi/driver/nt/pch.h" 2022-04-16 10:41:03.298828100 +0500
  12292. @@ -59,6 +59,7 @@
  12293. //
  12294. // These are the global include files for this project
  12295. //
  12296. +#include "arblib.h"
  12297. #include "acpitabl.h"
  12298. #include "amli.h"
  12299. #include "aml.h"
  12300. @@ -127,12 +128,11 @@
  12301. #include "wmilog.h"
  12302. #include "worker.h"
  12303.  
  12304. -
  12305. //
  12306. // Make sure to have the correct tag
  12307. //
  12308. #ifdef ExAllocatePool
  12309. #undef ExAllocatePool
  12310. -#endif
  12311. + #endif
  12312. #define ExAllocatePool(a,b) ExAllocatePoolWithTag(a,b,'ipcA')
  12313.  
  12314. diff --strip-trailing-cr -ur ./driver/nt/pciopregion.c "c:\\ACPI\\ACPI_W2003\\Base\\busdrv\\acpi/driver/nt/pciopregion.c"
  12315. --- ./driver/nt/pciopregion.c 2003-02-26 17:15:52.000000000 +0500
  12316. +++ "c:\\ACPI\\ACPI_W2003\\Base\\busdrv\\acpi/driver/nt/pciopregion.c" 2022-04-07 00:15:50.944335900 +0500
  12317. @@ -1119,8 +1119,8 @@
  12318.  
  12319. pciConfig = (PPCI_COMMON_CONFIG)buffer;
  12320.  
  12321. - if (pciConfig->HeaderType != PCI_BRIDGE_TYPE) {
  12322. -
  12323. + if ((PCI_CONFIGURATION_TYPE(pciConfig) != PCI_BRIDGE_TYPE) &&
  12324. + (PCI_CONFIGURATION_TYPE(pciConfig) != PCI_CARDBUS_BRIDGE_TYPE)) {
  12325. //
  12326. // Make a guess that the bus number was 0.
  12327. //
  12328. @@ -1133,6 +1133,7 @@
  12329. // the secondary PCI bus and exit.
  12330. //
  12331. *state->Bus = pciConfig->u.type1.SecondaryBus;
  12332. + HalSetMaxLegacyPciBusNumber(*state->Bus);
  12333.  
  12334. status = STATUS_SUCCESS;
  12335. goto GetPciAddressWorkerExit;
  12336. @@ -1253,6 +1254,17 @@
  12337. {
  12338. PIS_PCI_DEVICE_STATE state;
  12339. NTSTATUS status;
  12340. + PDEVICE_EXTENSION DeviceExtension;
  12341. +
  12342. + DeviceExtension = (PDEVICE_EXTENSION) AcpiObject->Context;
  12343. +
  12344. + if ( DeviceExtension &&
  12345. + ((DeviceExtension->Flags & DEV_CAP_PCI_DEVICE) ||
  12346. + (DeviceExtension->Flags & DEV_CAP_PCI)) ) {
  12347. + *Result = TRUE;
  12348. + return STATUS_SUCCESS;
  12349. + }
  12350. +
  12351.  
  12352. state = ExAllocatePoolWithTag(NonPagedPool, sizeof(IS_PCI_DEVICE_STATE), ACPI_INTERFACE_POOLTAG);
  12353.  
  12354. @@ -1431,6 +1443,7 @@
  12355. }
  12356.  
  12357. if (state->Cid) {
  12358. + ACPIConvertStringDelimitation(state->Cid, ' ');
  12359.  
  12360. if (strstr(state->Cid, PCI_PNP_ID)) {
  12361. //
  12362. @@ -1540,6 +1553,7 @@
  12363.  
  12364. } IS_PCI_BUS_STATE, *PIS_PCI_BUS_STATE;
  12365.  
  12366. +#pragma auto_inline (off) // disable IsPciBusAsyncc inlinig to match x64 5.2.3790.3959 (srv03_sp2_rtm.070216-1710)
  12367. NTSTATUS
  12368. IsPciBusAsync(
  12369. IN PNSOBJ AcpiObject,
  12370. @@ -1570,6 +1584,15 @@
  12371. --*/
  12372. {
  12373. PIS_PCI_BUS_STATE state;
  12374. + PDEVICE_EXTENSION DeviceExtension;
  12375. +
  12376. + DeviceExtension = (PDEVICE_EXTENSION) AcpiObject->Context;
  12377. +
  12378. + if (DeviceExtension &&
  12379. + (DeviceExtension->Flags & DEV_CAP_PCI)) {
  12380. + *Result = TRUE;
  12381. + return STATUS_SUCCESS;
  12382. + }
  12383.  
  12384. state = ExAllocatePoolWithTag(NonPagedPool, sizeof(IS_PCI_BUS_STATE), ACPI_INTERFACE_POOLTAG);
  12385.  
  12386. @@ -1579,11 +1602,11 @@
  12387.  
  12388. RtlZeroMemory(state, sizeof(IS_PCI_BUS_STATE));
  12389.  
  12390. - state->AcpiObject = AcpiObject;
  12391. + state->RunCompletion = INITIAL_RUN_COMPLETION;
  12392. state->CompletionHandler = CompletionHandler;
  12393. state->CompletionContext = CompletionContext;
  12394. + state->AcpiObject = AcpiObject;
  12395. state->Result = Result;
  12396. - state->RunCompletion = INITIAL_RUN_COMPLETION;
  12397.  
  12398. *Result = FALSE;
  12399.  
  12400. @@ -1592,6 +1615,7 @@
  12401. NULL,
  12402. (PVOID)state);
  12403. }
  12404. +#pragma auto_inline (on)
  12405.  
  12406. NTSTATUS
  12407. EXPORT
  12408. @@ -1710,6 +1734,7 @@
  12409. }
  12410.  
  12411. if (state->Cid) {
  12412. + ACPIConvertStringDelimitation(state->Cid, ' ');
  12413.  
  12414. if (strstr(state->Cid, PCI_PNP_ID)) {
  12415. //
  12416. @@ -1843,38 +1868,48 @@
  12417. Notes:
  12418.  
  12419. --*/
  12420. +
  12421. {
  12422. +#ifdef _X86_ // match x32 5.2.3790.3959 (srv03_sp2_rtm.070216-1710)
  12423. + return IsPciBusExtension(ACPIInternalGetDeviceExtension(DeviceObject));
  12424. +
  12425. +#else // match x64 5.2.3790.3959 (srv03_sp2_rtm.070216-1710)
  12426. AMLISUPP_CONTEXT_PASSIVE getDataContext;
  12427. - PDEVICE_EXTENSION devExt = ACPIInternalGetDeviceExtension(DeviceObject);
  12428. - NTSTATUS status;
  12429. - BOOLEAN result = FALSE;
  12430. + PNSOBJ AcpiObject = ACPIInternalGetDeviceExtension(DeviceObject)->AcpiObject;
  12431. + NTSTATUS status;
  12432. + BOOLEAN result = FALSE;
  12433. + PDEVICE_EXTENSION devExt2;
  12434.  
  12435. PAGED_CODE();
  12436. +
  12437. + devExt2 = (PDEVICE_EXTENSION)AcpiObject->Context;
  12438.  
  12439. - ASSERT(devExt->Signature == ACPI_SIGNATURE);
  12440. + if (devExt2 &&
  12441. + (devExt2->Flags & DEV_CAP_PCI)) {
  12442. + return TRUE;
  12443. + }
  12444.  
  12445. KeInitializeEvent(&getDataContext.Event, SynchronizationEvent, FALSE);
  12446. getDataContext.Status = STATUS_NOT_FOUND;
  12447.  
  12448. - if (!(devExt->Flags & DEV_PROP_NO_OBJECT) ) {
  12449. -
  12450. - status = IsPciBusAsync( devExt->AcpiObject,
  12451. - AmlisuppCompletePassive,
  12452. - (PVOID)&getDataContext,
  12453. - &result );
  12454. -
  12455. - if (status == STATUS_PENDING) {
  12456. + status = IsPciBusAsync( AcpiObject,
  12457. + AmlisuppCompletePassive,
  12458. + (PVOID)&getDataContext,
  12459. + &result );
  12460.  
  12461. - KeWaitForSingleObject(&getDataContext.Event,
  12462. - Executive,
  12463. - KernelMode,
  12464. - FALSE,
  12465. - NULL);
  12466. - }
  12467. + if (status == STATUS_PENDING) {
  12468.  
  12469. + KeWaitForSingleObject(&getDataContext.Event,
  12470. + Executive,
  12471. + KernelMode,
  12472. + FALSE,
  12473. + NULL);
  12474. }
  12475. +
  12476. return result;
  12477. +#endif
  12478. }
  12479. +
  12480. BOOLEAN
  12481. IsPciBusExtension(
  12482. @@ -1899,6 +1934,10 @@
  12483.  
  12484. --*/
  12485. {
  12486. + return IsNsobjPciBus(DeviceExtension->AcpiObject);
  12487. +}
  12488. +
  12489. +/*
  12490. AMLISUPP_CONTEXT_PASSIVE getDataContext;
  12491. NTSTATUS status;
  12492. BOOLEAN result = FALSE;
  12493. @@ -1935,6 +1974,7 @@
  12494. }
  12495. return result;
  12496. }
  12497. +*/
  12498. BOOLEAN
  12499. IsNsobjPciBus(
  12500. @@ -1962,9 +2002,17 @@
  12501. AMLISUPP_CONTEXT_PASSIVE getDataContext;
  12502. NTSTATUS status;
  12503. BOOLEAN result = FALSE;
  12504. + PDEVICE_EXTENSION DeviceExtension;
  12505.  
  12506. PAGED_CODE();
  12507.  
  12508. + DeviceExtension = (PDEVICE_EXTENSION) Device->Context;
  12509. +
  12510. + if (DeviceExtension &&
  12511. + (DeviceExtension->Flags & DEV_CAP_PCI)) {
  12512. + return TRUE;
  12513. + }
  12514. +
  12515. KeInitializeEvent(&getDataContext.Event, SynchronizationEvent, FALSE);
  12516. getDataContext.Status = STATUS_NOT_FOUND;
  12517.  
  12518. @@ -1981,7 +2029,7 @@
  12519. FALSE,
  12520. NULL);
  12521.  
  12522. - status = getDataContext.Status;
  12523. + //status = getDataContext.Status;
  12524. }
  12525.  
  12526. return result;
  12527. @@ -2193,9 +2241,9 @@
  12528. RtlZeroMemory(objdata, sizeof(objdata));
  12529.  
  12530. objdata[0].dwDataType = OBJTYPE_INTDATA;
  12531. - objdata[0].uipDataValue = REGSPACE_PCICFG;
  12532. + objdata[0].dwDataValue = REGSPACE_PCICFG;
  12533. objdata[1].dwDataType = OBJTYPE_INTDATA;
  12534. - objdata[1].uipDataValue = (Enable ? CONNECT_HANDLER : DISCONNECT_HANDLER );
  12535. + objdata[1].dwDataValue = (Enable ? CONNECT_HANDLER : DISCONNECT_HANDLER );
  12536.  
  12537. status = AMLIEvalNameSpaceObject(
  12538. regMethod,
  12539. diff --strip-trailing-cr -ur ./driver/nt/rangesup.c "c:\\ACPI\\ACPI_W2003\\Base\\busdrv\\acpi/driver/nt/rangesup.c"
  12540. --- ./driver/nt/rangesup.c 2003-02-26 17:15:52.000000000 +0500
  12541. +++ "c:\\ACPI\\ACPI_W2003\\Base\\busdrv\\acpi/driver/nt/rangesup.c" 2022-04-04 01:40:00.000000000 +0500
  12542. @@ -2325,8 +2325,9 @@
  12543. //
  12544. // Do we errors?
  12545. //
  12546. - if (bugCheck) {
  12547.  
  12548. + if (0) { // BSOD 0xA5 (0x02, ...) workaround, ACPI vs E820 mem ranges conflict
  12549. + //if (bugCheck) {
  12550. ACPIPrint( (
  12551. ACPI_PRINT_CRITICAL,
  12552. "ACPI:\n"
  12553. diff --strip-trailing-cr -ur ./driver/nt/res_bios.c "c:\\ACPI\\ACPI_W2003\\Base\\busdrv\\acpi/driver/nt/res_bios.c"
  12554. --- ./driver/nt/res_bios.c 2003-02-26 17:15:52.000000000 +0500
  12555. +++ "c:\\ACPI\\ACPI_W2003\\Base\\busdrv\\acpi/driver/nt/res_bios.c" 2022-04-27 21:40:32.335937500 +0500
  12556. @@ -53,6 +53,7 @@
  12557. #pragma alloc_text(PAGE,PnpiUpdateResourceList)
  12558. #pragma alloc_text(PAGE,PnpBiosResourcesToNtResources)
  12559. #pragma alloc_text(PAGE,PnpIoResourceListToCmResourceList)
  12560. +#pragma alloc_text(PAGE,PnpDeviceBiosResourcesToNtResources)
  12561. #endif
  12562.  
  12563. @@ -85,11 +86,18 @@
  12564. ASSERT(Descriptor->u.BusNumber.Length > 0);
  12565. }
  12566. -VOID
  12567. -PnpiBiosAddressHandleGlobalFlags(
  12568. - IN PVOID Buffer,
  12569. - IN PIO_RESOURCE_DESCRIPTOR Descriptor
  12570. - )
  12571. +//VOID
  12572. +//PnpiBiosAddressHandleGlobalFlags(
  12573. +// IN PVOID Buffer,
  12574. +// IN PIO_RESOURCE_DESCRIPTOR Descriptor
  12575. +// )
  12576. +NTSTATUS
  12577. + PnpiBiosAddressHandleGlobalFlags(
  12578. + IN PVOID Buffer,
  12579. + IN PIO_RESOURCE_LIST Array[],
  12580. + IN ULONG ArrayIndex,
  12581. + IN PIO_RESOURCE_DESCRIPTOR Descriptor
  12582. + )
  12583. /*++
  12584.  
  12585. Routine Descriptoin:
  12586. @@ -112,13 +120,15 @@
  12587. ULONG newValue;
  12588. ULONG oldValue;
  12589. ULONG bound;
  12590. + NTSTATUS status;
  12591. PAGED_CODE();
  12592.  
  12593. //
  12594. // If the resource is marked as being consumed only, then it is
  12595. // exclusive, otherwise, it is shared
  12596. //
  12597. - if (buffer->GFlag & PNP_ADDRESS_FLAG_CONSUMED_ONLY) {
  12598. + if ((AcpiOverrideAttributes & ACPI_OVERRIDE_DEVICE_EXCLUSIVE) ||
  12599. + buffer->GFlag & PNP_ADDRESS_FLAG_CONSUMED_ONLY) {
  12600.  
  12601. Descriptor->ShareDisposition = CmResourceShareDeviceExclusive;
  12602.  
  12603. @@ -192,6 +202,19 @@
  12604.  
  12605. }
  12606.  
  12607. + if (!(buffer->GFlag & PNP_ADDRESS_FLAG_CONSUMED_ONLY)) {
  12608. + status = PnpiUpdateResourceList( & (Array[ArrayIndex]), &Descriptor );
  12609. +
  12610. + if (!NT_SUCCESS(status)) {
  12611. + return status;
  12612. + }
  12613. +
  12614. + RtlZeroMemory(Descriptor, sizeof(IO_RESOURCE_DESCRIPTOR));
  12615. + Descriptor->Type = CmResourceTypeDevicePrivate;
  12616. + Descriptor->Flags = CM_RESOURCE_MEMORY_READ_ONLY;
  12617. + }
  12618. +
  12619. + return STATUS_SUCCESS;
  12620. }
  12621. VOID
  12622. @@ -633,7 +656,11 @@
  12623. //
  12624. // Handle global flags
  12625. //
  12626. - PnpiBiosAddressHandleGlobalFlags( buffer, rangeDescriptor );
  12627. + //PnpiBiosAddressHandleGlobalFlags( buffer, rangeDescriptor );
  12628. + status = PnpiBiosAddressHandleGlobalFlags(buffer, Array, ArrayIndex, rangeDescriptor);
  12629. + if (!NT_SUCCESS(status)) {
  12630. + return status;
  12631. + }
  12632. return STATUS_SUCCESS;
  12633. }
  12634. @@ -976,7 +1003,11 @@
  12635. //
  12636. // Handle global flags
  12637. //
  12638. - PnpiBiosAddressHandleGlobalFlags( buffer, rangeDescriptor );
  12639. + //PnpiBiosAddressHandleGlobalFlags( buffer, rangeDescriptor );
  12640. + status = PnpiBiosAddressHandleGlobalFlags(buffer, Array, ArrayIndex, rangeDescriptor);
  12641. + if (!NT_SUCCESS(status)) {
  12642. + return status;
  12643. + }
  12644. return STATUS_SUCCESS;
  12645. }
  12646. @@ -1164,7 +1195,8 @@
  12647. }
  12648.  
  12649.  
  12650. - if (length > MAXULONG) {
  12651. + if (length > MAXULONG &&
  12652. + (buffer->RFlag != PNP_ADDRESS_MEMORY_TYPE)) { // BSOD A5(0x14,...) workaround, Win7 fix
  12653.  
  12654. ACPIPrint( (
  12655. ACPI_PRINT_CRITICAL,
  12656. @@ -1172,7 +1204,7 @@
  12657. length
  12658. ) );
  12659.  
  12660. - if ((!(AcpiOverrideAttributes & ACPI_OVERRIDE_DELL_MAXULONG_BUGCHECK)) || (childMin < MAXULONG)) {
  12661. + if ((!(AcpiOverrideAttributes & ACPI_OVERRIDE_IGNORE_QWORD_LENGTH)) || (childMin < MAXULONG)) {
  12662. //
  12663. // We can go no further
  12664. //
  12665. @@ -1323,7 +1355,11 @@
  12666. //
  12667. // Handle global flags
  12668. //
  12669. - PnpiBiosAddressHandleGlobalFlags( buffer, rangeDescriptor );
  12670. + //PnpiBiosAddressHandleGlobalFlags( buffer, rangeDescriptor );
  12671. + status = PnpiBiosAddressHandleGlobalFlags(buffer, Array, ArrayIndex, rangeDescriptor);
  12672. + if (!NT_SUCCESS(status)) {
  12673. + return status;
  12674. + }
  12675. return STATUS_SUCCESS;
  12676. }
  12677. @@ -2911,7 +2947,112 @@
  12678.  
  12679. return STATUS_SUCCESS;
  12680. }
  12681. -
  12682. +
  12683. +#ifdef _X86_
  12684. +NTSTATUS __declspec(naked)
  12685. +PnpDeviceBiosResourcesToNtResources (
  12686. + IN PDEVICE_EXTENSION DeviceExtension,
  12687. + IN PUCHAR BiosData,
  12688. + IN ULONG Flags,
  12689. + OUT PIO_RESOURCE_REQUIREMENTS_LIST *List
  12690. + ) {
  12691. +__asm {
  12692. + push ebp
  12693. + mov ebp, esp
  12694. + push esi
  12695. + mov esi, [ebp+14h]
  12696. + push esi
  12697. + push dword ptr [ebp+10h]
  12698. + push dword ptr [ebp+0Ch]
  12699. + call PnpBiosResourcesToNtResources
  12700. + test eax, eax
  12701. + mov [ebp+0Ch], eax
  12702. + jl loc_1F482
  12703. + cmp dword ptr [esi], 0
  12704. + jz loc_1F482
  12705. + push ebx
  12706. + mov ebx, [ebp+8]
  12707. + push edi
  12708. + mov edi, offset AcpiDeviceTreeLock
  12709. + mov ecx, edi
  12710. + mov byte ptr [ebp+13h], 0
  12711. + call dword ptr [KfAcquireSpinLock]
  12712. + jmp short loc_1F421
  12713. +
  12714. +loc_1F40F:
  12715. + mov esi, [ebx+4]
  12716. + and esi, 20h
  12717. + xor ecx, ecx
  12718. + or ecx, esi
  12719. + jnz short loc_1F427
  12720. + mov ebx, [ebx+13Ch]
  12721. +
  12722. +loc_1F421:
  12723. + test ebx, ebx
  12724. + jnz short loc_1F40F
  12725. + jmp short loc_1F42B
  12726. +
  12727. +loc_1F427:
  12728. + mov byte ptr [ebp+13h], 1
  12729. +
  12730. +loc_1F42B:
  12731. + mov dl, al
  12732. + mov ecx, edi
  12733. + call dword ptr [KfReleaseSpinLock]
  12734. + cmp byte ptr [ebp+13h], 0
  12735. + pop edi
  12736. + pop ebx
  12737. + jz short loc_1F47F
  12738. + mov eax, [ebp+14h]
  12739. + mov eax, [eax]
  12740. + mov ecx, [eax+1Ch]
  12741. + add eax, 20h
  12742. + test ecx, ecx
  12743. + jbe short loc_1F47F
  12744. + mov esi, ecx
  12745. +
  12746. +loc_1F44E:
  12747. + lea ecx, [eax+8]
  12748. + mov eax, [eax+4]
  12749. + shl eax, 5
  12750. + add eax, ecx
  12751. + jmp short loc_1F478
  12752. +
  12753. +loc_1F45B:
  12754. + movzx edx, byte ptr [ecx+1]
  12755. + dec edx
  12756. + jz short loc_1F46B
  12757. + dec edx
  12758. + dec edx
  12759. + jz short loc_1F46B
  12760. + sub edx, 3
  12761. + jnz short loc_1F475
  12762. +
  12763. +loc_1F46B:
  12764. + cmp byte ptr [ecx+2], 3
  12765. + jnz short loc_1F475
  12766. + mov byte ptr [ecx+2], 1
  12767. +
  12768. +loc_1F475:
  12769. + add ecx, 20h
  12770. +
  12771. +loc_1F478:
  12772. + cmp ecx, eax
  12773. + jb short loc_1F45B
  12774. + dec esi
  12775. + jnz short loc_1F44E
  12776. +
  12777. +loc_1F47F:
  12778. + mov eax, [ebp+0Ch]
  12779. +
  12780. +loc_1F482:
  12781. + pop esi
  12782. + pop ebp
  12783. + retn 10h
  12784. +}
  12785. +}
  12786. +#endif
  12787. +
  12788. NTSTATUS
  12789. PnpIoResourceListToCmResourceList(
  12790. IN PIO_RESOURCE_REQUIREMENTS_LIST IoList,
  12791. diff --strip-trailing-cr -ur ./driver/nt/res_bios.h "c:\\ACPI\\ACPI_W2003\\Base\\busdrv\\acpi/driver/nt/res_bios.h"
  12792. --- ./driver/nt/res_bios.h 2003-02-26 17:15:52.000000000 +0500
  12793. +++ "c:\\ACPI\\ACPI_W2003\\Base\\busdrv\\acpi/driver/nt/res_bios.h" 2022-04-02 17:50:00.000000000 +0500
  12794. @@ -294,9 +294,16 @@
  12795. IN PIO_RESOURCE_DESCRIPTOR Descriptor
  12796. );
  12797.  
  12798. - VOID
  12799. + /*VOID
  12800. + PnpiBiosAddressHandleGlobalFlags(
  12801. + IN PVOID Buffer,
  12802. + IN PIO_RESOURCE_DESCRIPTOR Descriptor
  12803. + );*/
  12804. + NTSTATUS
  12805. PnpiBiosAddressHandleGlobalFlags(
  12806. IN PVOID Buffer,
  12807. + IN PIO_RESOURCE_LIST Array[],
  12808. + IN ULONG ArrayIndex,
  12809. IN PIO_RESOURCE_DESCRIPTOR Descriptor
  12810. );
  12811.  
  12812. @@ -417,7 +424,15 @@
  12813. PnpBiosResourcesToNtResources (
  12814. IN PUCHAR BiosData,
  12815. IN ULONG Flags,
  12816. - OUT PIO_RESOURCE_REQUIREMENTS_LIST *List
  12817. + OUT PIO_RESOURCE_REQUIREMENTS_LIST *List
  12818. + );
  12819. +
  12820. + NTSTATUS
  12821. + PnpDeviceBiosResourcesToNtResources (
  12822. + IN PDEVICE_EXTENSION DeviceExtension,
  12823. + IN PUCHAR BiosData,
  12824. + IN ULONG Flags,
  12825. + OUT PIO_RESOURCE_REQUIREMENTS_LIST *List
  12826. );
  12827.  
  12828. NTSTATUS
  12829. diff --strip-trailing-cr -ur ./driver/nt/root.c "c:\\ACPI\\ACPI_W2003\\Base\\busdrv\\acpi/driver/nt/root.c"
  12830. --- ./driver/nt/root.c 2003-02-26 17:15:52.000000000 +0500
  12831. +++ "c:\\ACPI\\ACPI_W2003\\Base\\busdrv\\acpi/driver/nt/root.c" 2022-04-03 20:12:30.000000000 +0500
  12832. @@ -142,8 +142,9 @@
  12833. --*/
  12834. {
  12835. PKEVENT event = (PKEVENT) Context;
  12836. -#if DBG
  12837. PDEVICE_EXTENSION deviceExtension = ACPIInternalGetDeviceExtension(DeviceObject);
  12838. +
  12839. +#if DBG
  12840. PIO_STACK_LOCATION irpStack = IoGetCurrentIrpStackLocation( Irp );
  12841.  
  12842. if (deviceExtension != NULL) {
  12843. @@ -1031,6 +1032,8 @@
  12844. ACPIWmiUnRegisterLog(DeviceObject);
  12845. #endif // WMI_TRACING
  12846.  
  12847. + ACPIInitializeKernelTableHandler(0, DeviceObject->DriverObject);
  12848. +
  12849. //
  12850. // Delete the useless set of resources
  12851. //
  12852. diff --strip-trailing-cr -ur ./driver/nt/sources "c:\\ACPI\\ACPI_W2003\\Base\\busdrv\\acpi/driver/nt/sources"
  12853. --- ./driver/nt/sources 2003-02-26 17:15:52.000000000 +0500
  12854. +++ "c:\\ACPI\\ACPI_W2003\\Base\\busdrv\\acpi/driver/nt/sources" 2022-04-04 02:58:04.000000000 +0500
  12855. @@ -74,4 +74,7 @@
  12856. wake.c \
  12857. wmilog.c \
  12858. wmilog.mof \
  12859. - worker.c
  12860. + worker.c \
  12861. + arblib.c
  12862. +
  12863. +AMD64_SOURCES= amd64\amd64_helpers.asm
  12864. \ No newline at end of file
  12865. diff --strip-trailing-cr -ur ./driver/nt/thermal.c "c:\\ACPI\\ACPI_W2003\\Base\\busdrv\\acpi/driver/nt/thermal.c"
  12866. --- ./driver/nt/thermal.c 2003-02-26 17:15:52.000000000 +0500
  12867. +++ "c:\\ACPI\\ACPI_W2003\\Base\\busdrv\\acpi/driver/nt/thermal.c" 2022-04-04 04:02:02.000000000 +0500
  12868. @@ -1044,7 +1044,18 @@
  12869.  
  12870. // NOTE - Synchronize with thread getting this data
  12871. *InstanceLengthArray = sizeNeeded;
  12872. - RtlCopyMemory(wmiThermalInfo, thermalInfo, sizeNeeded);
  12873. + wmiThermalInfo->ThermalStamp = info->Info.ThermalStamp;
  12874. + wmiThermalInfo->ThermalConstant1 = info->Info.ThermalConstant1;
  12875. + wmiThermalInfo->ThermalConstant2 = info->Info.ThermalConstant2;
  12876. + wmiThermalInfo->Processors = 0;
  12877. + wmiThermalInfo->SamplingPeriod = info->Info.SamplingPeriod;
  12878. + wmiThermalInfo->CurrentTemperature = info->Info.CurrentTemperature;
  12879. + wmiThermalInfo->PassiveTripPoint = info->Info.PassiveTripPoint;
  12880. + wmiThermalInfo->CriticalTripPoint = info->Info.CriticalTripPoint;
  12881. + wmiThermalInfo->ActiveTripPointCount = info->Info.ActiveTripPointCount;
  12882. + RtlCopyMemory(&wmiThermalInfo->ActiveTripPoint,
  12883. + &thermalInfo->ActiveTripPoint,
  12884. + sizeof(wmiThermalInfo->ActiveTripPoint));
  12885. status = STATUS_SUCCESS;
  12886.  
  12887. } else {
  12888. @@ -1312,7 +1323,7 @@
  12889.  
  12890. ASSERT (Result->dwDataType == OBJTYPE_INTDATA);
  12891. Thrm = deviceExtension->Thermal.Info;
  12892. - Thrm->Info.CurrentTemperature = (ULONG)Result->uipDataValue;
  12893. + Thrm->Info.CurrentTemperature = (ULONG)Result->dwDataValue;
  12894. AMLIFreeDataBuffs (Result, 1);
  12895.  
  12896. ACPIThermalPrint( (
  12897. diff --strip-trailing-cr -ur ./driver/nt/wake.c "c:\\ACPI\\ACPI_W2003\\Base\\busdrv\\acpi/driver/nt/wake.c"
  12898. --- ./driver/nt/wake.c 2003-02-26 17:15:52.000000000 +0500
  12899. +++ "c:\\ACPI\\ACPI_W2003\\Base\\busdrv\\acpi/driver/nt/wake.c" 2022-04-04 04:02:02.000000000 +0500
  12900. @@ -297,7 +297,7 @@
  12901. //
  12902. RtlZeroMemory( &pswData, sizeof(OBJDATA) );
  12903. pswData.dwDataType = OBJTYPE_INTDATA;
  12904. - pswData.uipDataValue = 0;
  12905. + pswData.dwDataValue = 0;
  12906.  
  12907. //
  12908. // Run the control method
  12909. @@ -648,7 +648,7 @@
  12910. //
  12911. RtlZeroMemory( &pswData, sizeof(OBJDATA) );
  12912. pswData.dwDataType = OBJTYPE_INTDATA;
  12913. - pswData.uipDataValue = (Enable ? 1 : 0);
  12914. + pswData.dwDataValue = (Enable ? 1 : 0);
  12915.  
  12916. //
  12917. // Run the control method
  12918. @@ -811,6 +811,11 @@
  12919. }
  12920.  
  12921. //
  12922. + // We can release the lock now
  12923. + //
  12924. + KeReleaseSpinLock( &AcpiPowerLock, oldIrql );
  12925. +
  12926. + //
  12927. // If we own the PCI PME pin for this device, the make sure to clear the
  12928. // status and either enable it --- we enable the PME pin after we have
  12929. // turned on the _PSW, and we disable the PME pin before we turn off
  12930. @@ -827,6 +832,11 @@
  12931. }
  12932.  
  12933. //
  12934. + // Acquire the spinlock
  12935. + //
  12936. + KeAcquireSpinLock( &AcpiPowerLock, &oldIrql );
  12937. +
  12938. + //
  12939. // Are the any items on the list?
  12940. //
  12941. if (!IsListEmpty( &(deviceExtension->PowerInfo.WakeSupportList) ) ) {
  12942. @@ -873,7 +883,7 @@
  12943.  
  12944. RtlZeroMemory( &pswData, sizeof(OBJDATA) );
  12945. pswData.dwDataType = OBJTYPE_INTDATA;
  12946. - pswData.uipDataValue = (nextContext->Enable ? 1 : 0);
  12947. + pswData.dwDataValue = (nextContext->Enable ? 1 : 0);
  12948.  
  12949. //
  12950. // If we own the PCI PME pin for this device, the make sure to clear the
  12951. diff --strip-trailing-cr -ur ./driver/shared/acpictl.c "c:\\ACPI\\ACPI_W2003\\Base\\busdrv\\acpi/driver/shared/acpictl.c"
  12952. --- ./driver/shared/acpictl.c 2003-02-26 17:15:52.000000000 +0500
  12953. +++ "c:\\ACPI\\ACPI_W2003\\Base\\busdrv\\acpi/driver/shared/acpictl.c" 2022-04-04 04:05:08.000000000 +0500
  12954. @@ -357,7 +357,7 @@
  12955.  
  12956. Argument->Type = ACPI_METHOD_ARGUMENT_INTEGER;
  12957. Argument->DataLength = sizeof(ULONG);
  12958. - Argument->Argument = (ULONG) ObjectData->uipDataValue;
  12959. + Argument->Argument = (ULONG) ObjectData->dwDataValue;
  12960.  
  12961. } else if (ObjectData->dwDataType == OBJTYPE_STRDATA ||
  12962. ObjectData->dwDataType == OBJTYPE_BUFFDATA) {
  12963. @@ -956,7 +956,7 @@
  12964. integerBuffer = (PACPI_EVAL_INPUT_BUFFER_SIMPLE_INTEGER) inputBuffer;
  12965.  
  12966. argumentData->dwDataType = OBJTYPE_INTDATA;
  12967. - argumentData->uipDataValue = integerBuffer->IntegerArgument;
  12968. + argumentData->dwDataValue = integerBuffer->IntegerArgument;
  12969.  
  12970. } else {
  12971.  
  12972. @@ -1010,7 +1010,7 @@
  12973. if (methodArgument->Type == ACPI_METHOD_ARGUMENT_INTEGER) {
  12974.  
  12975. (argumentData[i]).dwDataType = OBJTYPE_INTDATA;
  12976. - (argumentData[i]).uipDataValue = methodArgument->Argument;
  12977. + (argumentData[i]).dwDataValue = methodArgument->Argument;
  12978.  
  12979. } else {
  12980.  
  12981. diff --strip-trailing-cr -ur ./driver/shared/acpiinit.c "c:\\ACPI\\ACPI_W2003\\Base\\busdrv\\acpi/driver/shared/acpiinit.c"
  12982. --- ./driver/shared/acpiinit.c 2003-02-26 17:15:52.000000000 +0500
  12983. +++ "c:\\ACPI\\ACPI_W2003\\Base\\busdrv\\acpi/driver/shared/acpiinit.c" 2022-04-04 00:03:48.000000000 +0500
  12984. @@ -54,7 +54,820 @@
  12985. //
  12986. ULONG AMLIMaxCTObjs;
  12987.  
  12988. -
  12989. +extern ULONG g_AmliHookEnabled;
  12990. +
  12991. +char SimulatorRegEntry[]="\\Registry\\Machine\\System\\CurrentControlSet\\Services\\ACPI\\Parameters\\Simulator\\Tables";
  12992. +char asmFormat1Name[] = "%08lx";
  12993. +
  12994. +
  12995. +#ifdef _X86_
  12996. +
  12997. +VOID __declspec(naked)
  12998. +ACPIRegReadEntireSimulatorAcpiTable() {
  12999. +_asm {
  13000. + push ebp
  13001. + mov ebp, esp
  13002. + sub esp, 2Ch
  13003. + mov eax, __security_cookie
  13004. + push ebx
  13005. + push esi
  13006. + mov esi, [ebp+8]
  13007. + push edi
  13008. + mov edi, [ebp+0Ch]
  13009. + push 53637041h
  13010. + mov ebx, 2000h
  13011. + mov [ebp-4], eax
  13012. + mov eax, [edi]
  13013. + push ebx
  13014. + push 1
  13015. + mov [ebp-2Ch], esi
  13016. + mov [ebp-28h], edi
  13017. + mov [ebp-1Ch], eax
  13018. + call dword ptr[ExAllocatePoolWithTag]
  13019. + test eax, eax
  13020. + mov [ebp-18h], eax
  13021. + jnz short loc_2C89C
  13022. + mov eax, 0C000009Ah
  13023. + jmp loc_2C9CA
  13024. +
  13025. +loc_2C89C:
  13026. + and dword ptr [ebp-24h], 0
  13027. + push 0
  13028. + lea eax, [ebp-10h]
  13029. + push offset asmFormat1Name
  13030. + push eax
  13031. + call sprintf
  13032. + add esp, 0Ch
  13033. + lea eax, [ebp-14h]
  13034. + push eax
  13035. + push dword ptr [ebp-18h]
  13036. + mov [ebp-14h], ebx
  13037. + push esi
  13038. + jmp loc_2C99C
  13039. +
  13040. +loc_2C8C3:
  13041. + cmp dword ptr [ebp-14h], 8
  13042. + jb loc_2C9B1
  13043. + and dword ptr [ebp-20h], 0
  13044. + cmp dword ptr [ebp-14h], 0
  13045. + jbe loc_2C974
  13046. +
  13047. +loc_2C8DB:
  13048. + mov ecx, [ebp-18h]
  13049. + mov eax, [ebp-20h]
  13050. + lea ebx, [eax+ecx]
  13051. + mov ecx, [ebx+4]
  13052. + test ecx, ecx
  13053. + jnz short loc_2C946
  13054. + mov eax, [ebx]
  13055. + mov esi, [ebp-1Ch]
  13056. + cmp eax, [esi+4]
  13057. + jz short loc_2C95E
  13058. + push 74706341h
  13059. + push eax
  13060. + push ecx
  13061. + call dword ptr[ExAllocatePoolWithTag]
  13062. + test eax, eax
  13063. + mov [ebp-1Ch], eax
  13064. + jz loc_2C9B8
  13065. + mov ecx, [ebx]
  13066. + mov edx, [esi+4]
  13067. + cmp ecx, edx
  13068. + jb short loc_2C918
  13069. + mov ecx, edx
  13070. +
  13071. +loc_2C918:
  13072. + mov esi, [edi]
  13073. + mov edx, ecx
  13074. + shr ecx, 2
  13075. + mov edi, eax
  13076. + rep movsd
  13077. + mov ecx, edx
  13078. + and ecx, 3
  13079. + rep movsb
  13080. + mov esi, [ebp-28h]
  13081. + mov ecx, [esi]
  13082. + test ecx, ecx
  13083. + jz short loc_2C93F
  13084. + push 0
  13085. + push ecx
  13086. + call dword ptr[ExFreePoolWithTag]
  13087. + mov eax, [ebp-1Ch]
  13088. +
  13089. +loc_2C93F:
  13090. + mov [esi], eax
  13091. + mov [ebp-1Ch], eax
  13092. + jmp short loc_2C95B
  13093. +
  13094. +loc_2C946:
  13095. + mov edi, [edi]
  13096. + add edi, [ebx]
  13097. + mov eax, ecx
  13098. + shr ecx, 2
  13099. + lea esi, [ebx+8]
  13100. + rep movsd
  13101. + mov ecx, eax
  13102. + and ecx, 3
  13103. + rep movsb
  13104. +
  13105. +loc_2C95B:
  13106. + mov edi, [ebp-28h]
  13107. +
  13108. +loc_2C95E:
  13109. + mov ecx, [ebp-20h]
  13110. + mov eax, [ebx+4]
  13111. + lea eax, [ecx+eax+8]
  13112. + cmp eax, [ebp-14h]
  13113. + mov [ebp-20h], eax
  13114. + jb loc_2C8DB
  13115. +
  13116. +loc_2C974:
  13117. + inc dword ptr [ebp-24h]
  13118. + push dword ptr [ebp-24h]
  13119. + lea eax, [ebp-10h]
  13120. + push offset asmFormat1Name
  13121. + push eax
  13122. + call sprintf
  13123. + add esp, 0Ch
  13124. + lea eax, [ebp-14h]
  13125. + push eax
  13126. + push dword ptr [ebp-18h]
  13127. + mov dword ptr [ebp-14h], 2000h
  13128. + push dword ptr [ebp-2Ch]
  13129. +
  13130. +loc_2C99C:
  13131. + lea eax, [ebp-10h]
  13132. + push eax
  13133. + call OSReadRegValue
  13134. + test eax, eax
  13135. + jge loc_2C8C3
  13136. + xor esi, esi
  13137. + jmp short loc_2C9BD
  13138. +
  13139. +loc_2C9B1:
  13140. + mov eax, 0C0000001h
  13141. + jmp short loc_2C9CA
  13142. +
  13143. +loc_2C9B8:
  13144. + mov esi, 0C000009Ah
  13145. +
  13146. +loc_2C9BD:
  13147. + push 0
  13148. + push dword ptr [ebp-18h]
  13149. + call dword ptr[ExFreePoolWithTag]
  13150. + mov eax, esi
  13151. +
  13152. +loc_2C9CA:
  13153. + mov ecx, [ebp-4]
  13154. + pop edi
  13155. + pop esi
  13156. + pop ebx
  13157. + call __security_check_cookie
  13158. + _emit 0xc9 ; "leave" opcode
  13159. + retn 8
  13160. +}
  13161. +}
  13162. +
  13163. +
  13164. +VOID __declspec(naked)
  13165. +ACPIRegGetTableFromSimulatorRegistryEntry() {
  13166. +_asm {
  13167. + push ebp
  13168. + mov ebp, esp
  13169. + sub esp, 10h
  13170. + mov eax, [ebp+8]
  13171. + mov eax, [eax]
  13172. + and dword ptr [ebp-0Ch], 0
  13173. + and dword ptr [ebp-8], 0
  13174. + push ebx
  13175. + push 53637041h
  13176. + push 6Ah
  13177. + push 1
  13178. + mov byte ptr [ebp-1], 0
  13179. + mov [ebp-10h], eax
  13180. + call dword ptr[ExAllocatePoolWithTag]
  13181. + mov ebx, eax
  13182. + test ebx, ebx
  13183. + jnz short loc_2CBD9
  13184. + xor al, al
  13185. + jmp loc_2CC86
  13186. +
  13187. +loc_2CBD9:
  13188. + push esi
  13189. + push edi
  13190. + push 1Ah
  13191. + pop ecx
  13192. + xor eax, eax
  13193. + mov edi, ebx
  13194. + rep stosd
  13195. + push 15h
  13196. + stosw
  13197. + pop ecx
  13198. + mov esi, offset SimulatorRegEntry
  13199. + mov edi, ebx
  13200. + rep movsd
  13201. + mov esi, [ebp-10h]
  13202. + push 4
  13203. + push esi
  13204. + lea eax, [ebx+55h]
  13205. + push eax
  13206. + mov byte ptr [ebx+54h], 5Ch
  13207. + call ACPIRegLocalCopyString
  13208. + push 6
  13209. + lea ecx, [esi+0Ah]
  13210. + mov byte ptr [eax], 5Ch
  13211. + push ecx
  13212. + inc eax
  13213. + push eax
  13214. + call ACPIRegLocalCopyString
  13215. + push 8
  13216. + lea ecx, [esi+10h]
  13217. + mov byte ptr [eax], 5Ch
  13218. + push ecx
  13219. + inc eax
  13220. + push eax
  13221. + call ACPIRegLocalCopyString
  13222. + mov byte ptr [eax], 0
  13223. + lea eax, [ebp-8]
  13224. + push eax
  13225. + xor edi, edi
  13226. + push edi
  13227. + push ebx
  13228. + call OSOpenHandle
  13229. + test eax, eax
  13230. + jl short loc_2CC5F
  13231. + push dword ptr [esi+18h]
  13232. + lea eax, [ebp-0Ch]
  13233. + push eax
  13234. + push dword ptr [ebp-8]
  13235. + call OSOpenLargestSubkey
  13236. + test eax, eax
  13237. + jl short loc_2CC5F
  13238. + push dword ptr [ebp+8]
  13239. + push dword ptr [ebp-0Ch]
  13240. + call ACPIRegReadEntireSimulatorAcpiTable
  13241. + test eax, eax
  13242. + jl short loc_2CC5F
  13243. + mov byte ptr [ebp-1], 1
  13244. +
  13245. +loc_2CC5F:
  13246. + push edi
  13247. + push ebx
  13248. + call dword ptr[ExFreePoolWithTag]
  13249. + cmp [ebp-8], edi
  13250. + jz short loc_2CC74
  13251. + push dword ptr [ebp-8]
  13252. + call OSCloseHandle
  13253. +
  13254. +loc_2CC74:
  13255. + cmp [ebp-0Ch], edi
  13256. + pop edi
  13257. + pop esi
  13258. + jz short loc_2CC83
  13259. + push dword ptr [ebp-0Ch]
  13260. + call OSCloseHandle
  13261. +
  13262. +loc_2CC83:
  13263. + mov al, [ebp-1]
  13264. +
  13265. +loc_2CC86:
  13266. + pop ebx
  13267. + _emit 0xc9 ; "leave" opcode
  13268. + retn 4
  13269. +}
  13270. +}
  13271. +
  13272. +
  13273. +VOID __declspec(naked)
  13274. +ACPIMapNamedTable() {
  13275. +_asm {
  13276. + push ebp
  13277. + mov ebp, esp
  13278. + sub esp, 28h
  13279. + mov edx, AcpiInformation
  13280. + xor eax, eax
  13281. + push esi
  13282. + mov [ebp-0Ch], eax
  13283. + mov ecx, [edx]
  13284. + cmp dword ptr [ecx], 54445358h
  13285. + mov ecx, [ecx+4]
  13286. + push edi
  13287. + push 24h
  13288. + mov byte ptr [ebp-3], 0
  13289. + mov byte ptr [ebp-4], 0
  13290. + mov byte ptr [ebp-2], 0
  13291. + mov [ebp-14h], eax
  13292. + mov [ebp-20h], eax
  13293. + pop esi
  13294. + jnz short loc_2C0A0
  13295. + cmp ecx, esi
  13296. + jnb short loc_2C095
  13297. + mov esi, ecx
  13298. +
  13299. +loc_2C095:
  13300. + sub ecx, esi
  13301. + shr ecx, 3
  13302. + mov byte ptr [ebp-2], 1
  13303. + jmp short loc_2C0AB
  13304. +
  13305. +loc_2C0A0:
  13306. + cmp ecx, esi
  13307. + jnb short loc_2C0A6
  13308. + mov esi, ecx
  13309. +
  13310. +loc_2C0A6:
  13311. + sub ecx, esi
  13312. + shr ecx, 2
  13313. +
  13314. +loc_2C0AB:
  13315. + cmp ecx, eax
  13316. + mov [ebp-8], ecx
  13317. + jnz short loc_2C0BC
  13318. + mov edi, 0C0140019h
  13319. + jmp loc_2C2F7
  13320. +
  13321. +loc_2C0BC:
  13322. + xor ecx, ecx
  13323. + cmp [ebp-8], eax
  13324. + push ebx
  13325. + mov [ebp-1Ch], ecx
  13326. + jbe loc_2C201
  13327. + mov dword ptr [ebp-18h], 24h
  13328. + jmp short loc_2C0DA
  13329. +
  13330. +loc_2C0D4:
  13331. + mov edx, AcpiInformation
  13332. +
  13333. +loc_2C0DA:
  13334. + cmp byte ptr [ebp-2], 0
  13335. + mov eax, [edx]
  13336. + jz short loc_2C0EF
  13337. + mov ebx, [eax+ecx*8+24h]
  13338. + mov eax, [eax+ecx*8+28h]
  13339. + mov [ebp-24h], eax
  13340. + jmp short loc_2C0F9
  13341. +
  13342. +loc_2C0EF:
  13343. + mov ecx, [ebp-18h]
  13344. + mov ebx, [ecx+eax]
  13345. + and dword ptr [ebp-24h], 0
  13346. +
  13347. +loc_2C0F9:
  13348. + push 0
  13349. + push 24h
  13350. + push dword ptr [ebp-24h]
  13351. + push ebx
  13352. + call dword ptr[MmMapIoSpace]
  13353. + test eax, eax
  13354. + mov [ebp-0Ch], eax
  13355. + jz loc_2C1E3
  13356. + mov ecx, [ebp+8]
  13357. + cmp [eax], ecx
  13358. + jnz short loc_2C195
  13359. + mov edi, [ebp+0Ch]
  13360. + test edi, edi
  13361. + mov byte ptr [ebp-1], 1
  13362. + jz short loc_2C156
  13363. + lea esi, [eax+0Ah]
  13364. +
  13365. +loc_2C127:
  13366. + mov dl, [edi]
  13367. + mov cl, dl
  13368. + cmp dl, [esi]
  13369. + jnz short loc_2C149
  13370. + test cl, cl
  13371. + jz short loc_2C145
  13372. + mov dl, [edi+1]
  13373. + mov cl, dl
  13374. + cmp dl, [esi+1]
  13375. + jnz short loc_2C149
  13376. + inc edi
  13377. + inc edi
  13378. + inc esi
  13379. + inc esi
  13380. + test cl, cl
  13381. + jnz short loc_2C127
  13382. +
  13383. +loc_2C145:
  13384. + xor ecx, ecx
  13385. + jmp short loc_2C14E
  13386. +
  13387. +loc_2C149:
  13388. + sbb ecx, ecx
  13389. + sbb ecx, 0FFFFFFFFh
  13390. +
  13391. +loc_2C14E:
  13392. + test ecx, ecx
  13393. + jz short loc_2C156
  13394. + mov byte ptr [ebp-1], 0
  13395. +
  13396. +loc_2C156:
  13397. + mov edi, [ebp+10h]
  13398. + test edi, edi
  13399. + jz short loc_2C18F
  13400. + lea esi, [eax+10h]
  13401. +
  13402. +loc_2C160:
  13403. + mov dl, [edi]
  13404. + mov cl, dl
  13405. + cmp dl, [esi]
  13406. + jnz short loc_2C182
  13407. + test cl, cl
  13408. + jz short loc_2C17E
  13409. + mov dl, [edi+1]
  13410. + mov cl, dl
  13411. + cmp dl, [esi+1]
  13412. + jnz short loc_2C182
  13413. + inc edi
  13414. + inc edi
  13415. + inc esi
  13416. + inc esi
  13417. + test cl, cl
  13418. + jnz short loc_2C160
  13419. +
  13420. +loc_2C17E:
  13421. + xor ecx, ecx
  13422. + jmp short loc_2C187
  13423. +
  13424. +loc_2C182:
  13425. + sbb ecx, ecx
  13426. + sbb ecx, 0FFFFFFFFh
  13427. +
  13428. +loc_2C187:
  13429. + test ecx, ecx
  13430. + jz short loc_2C18F
  13431. + mov byte ptr [ebp-1], 0
  13432. +
  13433. +loc_2C18F:
  13434. + cmp byte ptr [ebp-1], 0
  13435. + jnz short loc_2C1BC
  13436. +
  13437. +loc_2C195:
  13438. + push 24h
  13439. + push eax
  13440. + call dword ptr[MmUnmapIoSpace]
  13441. + mov ecx, [ebp-1Ch]
  13442. + add dword ptr [ebp-18h], 4
  13443. + xor eax, eax
  13444. + inc ecx
  13445. + cmp ecx, [ebp-8]
  13446. + mov [ebp-10h], eax
  13447. + mov [ebp-0Ch], eax
  13448. + mov [ebp-1Ch], ecx
  13449. + jb loc_2C0D4
  13450. + jmp short loc_2C20B
  13451. +
  13452. +loc_2C1BC:
  13453. + mov esi, [eax+4]
  13454. + push 24h
  13455. + push eax
  13456. + mov [ebp-14h], esi
  13457. + call dword ptr[MmUnmapIoSpace]
  13458. + and dword ptr [ebp-10h], 0
  13459. + push 0
  13460. + push esi
  13461. + push dword ptr [ebp-24h]
  13462. + push ebx
  13463. + call dword ptr[MmMapIoSpace]
  13464. + test eax, eax
  13465. + mov [ebp-0Ch], eax
  13466. + jnz short loc_2C1ED
  13467. +
  13468. +loc_2C1E3:
  13469. + mov edi, 0C0140019h
  13470. + jmp loc_2C2C4
  13471. +
  13472. +loc_2C1ED:
  13473. + push 1
  13474. + lea eax, [ebp-0Ch]
  13475. + push eax
  13476. + call ACPIRegReadAMLRegistryEntry
  13477. + mov [ebp-3], al
  13478. + mov eax, [ebp-0Ch]
  13479. + mov [ebp-10h], eax
  13480. +
  13481. +loc_2C201:
  13482. + cmp dword ptr [ebp-10h], 0
  13483. + jnz loc_2C294
  13484. +
  13485. +loc_2C20B:
  13486. + xor ebx, ebx
  13487. + cmp g_AmliHookEnabled, ebx
  13488. + jz short loc_2C28A
  13489. + push 74706341h
  13490. + push 24h
  13491. + pop esi
  13492. + push esi
  13493. + push ebx
  13494. + mov [ebp-8], ebx
  13495. + call dword ptr[ExAllocatePoolWithTag]
  13496. + mov edi, eax
  13497. + cmp edi, ebx
  13498. + mov [ebp-8], edi
  13499. + jz short loc_2C287
  13500. + xor eax, eax
  13501. + push 9
  13502. + pop ecx
  13503. + rep stosd
  13504. + mov eax, [ebp-8]
  13505. + mov ecx, [ebp+8]
  13506. + mov [eax], ecx
  13507. + mov eax, [ebp-8]
  13508. + mov [eax+4], esi
  13509. + mov eax, [ebp+0Ch]
  13510. + cmp eax, ebx
  13511. + jz short loc_2C255
  13512. + mov eax, [eax]
  13513. + mov ecx, [ebp-8]
  13514. + mov [ecx+0Ah], eax
  13515. +
  13516. +loc_2C255:
  13517. + mov eax, [ebp+10h]
  13518. + cmp eax, ebx
  13519. + jz short loc_2C26D
  13520. + mov ecx, [eax]
  13521. + mov edx, [ebp-8]
  13522. + mov [edx+10h], ecx
  13523. + mov eax, [eax+4]
  13524. + mov ecx, [ebp-8]
  13525. + mov [ecx+14h], eax
  13526. +
  13527. +loc_2C26D:
  13528. + lea eax, [ebp-8]
  13529. + push eax
  13530. + call ACPIRegGetTableFromSimulatorRegistryEntry
  13531. + test al, al
  13532. + mov [ebp-4], al
  13533. + jz short loc_2C287
  13534. + mov eax, [ebp-8]
  13535. + cmp eax, ebx
  13536. + mov [ebp-10h], eax
  13537. + jnz short loc_2C291
  13538. +
  13539. +loc_2C287:
  13540. + mov eax, [ebp-0Ch]
  13541. +
  13542. +loc_2C28A:
  13543. + mov edi, 0C0000225h
  13544. + jmp short loc_2C2C4
  13545. +
  13546. +loc_2C291:
  13547. + mov eax, [ebp-0Ch]
  13548. +
  13549. +loc_2C294:
  13550. + mov esi, [ebp-10h]
  13551. + mov ecx, [esi+4]
  13552. + mov edx, [ebp+18h]
  13553. + cmp [edx], ecx
  13554. + mov [ebp-14h], ecx
  13555. + jnb short loc_2C2AB
  13556. + mov edi, 0C0000023h
  13557. + jmp short loc_2C2C2
  13558. +
  13559. +loc_2C2AB:
  13560. + mov edi, [ebp+14h]
  13561. + mov ebx, ecx
  13562. + shr ecx, 2
  13563. + rep movsd
  13564. + mov ecx, ebx
  13565. + and ecx, 3
  13566. + rep movsb
  13567. + mov ecx, [ebp-14h]
  13568. + mov edi, [ebp-20h]
  13569. +
  13570. +loc_2C2C2:
  13571. + mov [edx], ecx
  13572. +
  13573. +loc_2C2C4:
  13574. + mov esi, dword ptr[ExFreePoolWithTag]
  13575. + xor ebx, ebx
  13576. + cmp eax, ebx
  13577. + jz short loc_2C2E5
  13578. + cmp [ebp-3], bl
  13579. + jz short loc_2C2DB
  13580. + push ebx
  13581. + push eax
  13582. + call esi
  13583. + jmp short loc_2C2E5
  13584. +
  13585. +loc_2C2DB:
  13586. + push dword ptr [ebp-14h]
  13587. + push eax
  13588. + call dword ptr[MmUnmapIoSpace]
  13589. +
  13590. +loc_2C2E5:
  13591. + cmp byte ptr [ebp-4], 0
  13592. + jz short loc_2C2F6
  13593. + cmp [ebp-10h], ebx
  13594. + jz short loc_2C2F6
  13595. + push ebx
  13596. + push dword ptr [ebp-10h]
  13597. + call esi
  13598. +
  13599. +loc_2C2F6:
  13600. + pop ebx
  13601. +
  13602. +loc_2C2F7:
  13603. + mov eax, edi
  13604. + pop edi
  13605. + pop esi
  13606. + _emit 0xc9 ; "leave" opcode
  13607. + retn 14h
  13608. +}
  13609. +}
  13610. +
  13611. +
  13612. +VOID __declspec(naked)
  13613. +ACPIEnumerateTables() {
  13614. +_asm {
  13615. + push ebp
  13616. + mov ebp, esp
  13617. + sub esp, 0Ch
  13618. + mov eax, AcpiInformation
  13619. + mov eax, [eax]
  13620. + and dword ptr [ebp-0Ch], 0
  13621. + and dword ptr [ebp-8], 0
  13622. + cmp dword ptr [eax], 54445358h
  13623. + mov eax, [eax+4]
  13624. + push ebx
  13625. + push esi
  13626. + push edi
  13627. + push 24h
  13628. + mov byte ptr [ebp-1], 0
  13629. + pop ecx
  13630. + jnz short loc_2C341
  13631. + cmp eax, ecx
  13632. + jnb short loc_2C336
  13633. + mov ecx, eax
  13634. +
  13635. +loc_2C336:
  13636. + sub eax, ecx
  13637. + shr eax, 3
  13638. + mov byte ptr [ebp-1], 1
  13639. + jmp short loc_2C34C
  13640. +
  13641. +loc_2C341:
  13642. + cmp eax, ecx
  13643. + jnb short loc_2C347
  13644. + mov ecx, eax
  13645. +
  13646. +loc_2C347:
  13647. + sub eax, ecx
  13648. + shr eax, 2
  13649. +
  13650. +loc_2C34C:
  13651. + mov ebx, eax
  13652. + test ebx, ebx
  13653. + jz loc_2C3EE
  13654. + mov ecx, [ebp+0Ch]
  13655. + shl eax, 2
  13656. + test ecx, ecx
  13657. + mov [ebp-0Ch], eax
  13658. + jz loc_2C3F7
  13659. + mov ecx, [ecx]
  13660. + cmp ecx, eax
  13661. + jnb short loc_2C379
  13662. + mov dword ptr [ebp-8], 0C0000023h
  13663. + jmp loc_2C3FE
  13664. +
  13665. +loc_2C379:
  13666. + mov esi, [ebp+8]
  13667. + mov edx, ecx
  13668. + shr ecx, 2
  13669. + xor eax, eax
  13670. + mov edi, esi
  13671. + rep stosd
  13672. + mov ecx, edx
  13673. + and ecx, 3
  13674. + rep stosb
  13675. + xor edi, edi
  13676. + test ebx, ebx
  13677. + jbe short loc_2C3FE
  13678. + mov dword ptr [ebp+8], 24h
  13679. + sub [ebp+8], esi
  13680. +
  13681. +loc_2C39E:
  13682. + cmp byte ptr [ebp-1], 0
  13683. + jz short loc_2C3B5
  13684. + mov eax, AcpiInformation
  13685. + mov ecx, [eax]
  13686. + mov eax, [ecx+edi*8+24h]
  13687. + mov ecx, [ecx+edi*8+28h]
  13688. + jmp short loc_2C3C7
  13689. +
  13690. +loc_2C3B5:
  13691. + mov eax, [ebp+8]
  13692. + mov ecx, AcpiInformation
  13693. + mov ecx, [ecx]
  13694. + add eax, esi
  13695. + mov eax, [eax+ecx]
  13696. + xor ecx, ecx
  13697. +
  13698. +loc_2C3C7:
  13699. + push 0
  13700. + push 24h
  13701. + push ecx
  13702. + push eax
  13703. + call dword ptr[MmMapIoSpace]
  13704. + test eax, eax
  13705. + jz short loc_2C3EE
  13706. + mov ecx, [eax]
  13707. + push 24h
  13708. + push eax
  13709. + mov [esi], ecx
  13710. + call dword ptr[MmUnmapIoSpace]
  13711. + inc edi
  13712. + add esi, 4
  13713. + cmp edi, ebx
  13714. + jb short loc_2C39E
  13715. + jmp short loc_2C3FE
  13716. +
  13717. +loc_2C3EE:
  13718. + mov dword ptr [ebp-8], 0C0140019h
  13719. + jmp short loc_2C3FE
  13720. +
  13721. +loc_2C3F7:
  13722. + mov dword ptr [ebp-8], 0C000000Dh
  13723. +
  13724. +loc_2C3FE:
  13725. + mov eax, [ebp-0Ch]
  13726. + mov ecx, [ebp+0Ch]
  13727. + pop edi
  13728. + pop esi
  13729. + mov [ecx], eax
  13730. + mov eax, [ebp-8]
  13731. + pop ebx
  13732. + _emit 0xc9 ; "leave" opcode
  13733. + retn 8
  13734. +}
  13735. +}
  13736. +
  13737. +
  13738. +VOID __declspec(naked)
  13739. +ACPIEnumMapTableHandler() {
  13740. +_asm {
  13741. + push ebp
  13742. + mov ebp, esp
  13743. + mov eax, [ebp+8]
  13744. + mov ecx, [eax+4]
  13745. + xor edx, edx
  13746. + sub ecx, edx
  13747. + jz short loc_2C445
  13748. + dec ecx
  13749. + jz short loc_2C431
  13750. + mov eax, 0C0000002h
  13751. + pop ebp
  13752. + retn
  13753. +
  13754. +loc_2C431:
  13755. + lea ecx, [eax+0Ch]
  13756. + push ecx
  13757. + lea ecx, [eax+10h]
  13758. + push ecx
  13759. + push edx
  13760. + push edx
  13761. + push dword ptr [eax+8]
  13762. + call ACPIMapNamedTable
  13763. + pop ebp
  13764. + retn
  13765. +
  13766. +loc_2C445:
  13767. + lea ecx, [eax+0Ch]
  13768. + push ecx
  13769. + add eax, 10h
  13770. + push eax
  13771. + call ACPIEnumerateTables
  13772. + pop ebp
  13773. + retn
  13774. +}
  13775. +}
  13776. +
  13777. +
  13778. +VOID __declspec(naked)
  13779. +ACPIInitializeKernelTableHandler(BOOLEAN mode, PDRIVER_OBJECT DrvObj) {
  13780. +_asm {
  13781. + push ebp
  13782. + mov ebp, esp
  13783. + sub esp, 10h
  13784. + mov al, [ebp+8]
  13785. + mov [ebp-0Ch], al
  13786. + mov eax, [ebp+0Ch]
  13787. + mov [ebp-4], eax
  13788. + push 010h
  13789. + lea eax, [ebp-10h]
  13790. + push eax
  13791. + push 04Bh
  13792. + mov dword ptr [ebp-10h], 'ACPI'
  13793. + mov dword ptr [ebp-8], offset ACPIEnumMapTableHandler
  13794. + call DWORD PTR [ZwSetSystemInformation]
  13795. + _emit 0xc9 ; "leave" opcode
  13796. + retn 8
  13797. +}
  13798. +}
  13799. +
  13800. +#endif // _X86_
  13801. +
  13802. +
  13803. BOOLEAN
  13804. ACPIInitialize(
  13805. PVOID Context
  13806. @@ -299,6 +1112,7 @@
  13807.  
  13808. }
  13809.  
  13810. + ACPIInitializeKernelTableHandler(TRUE, ((PDEVICE_OBJECT)Context)->DriverObject);
  13811. return (TRUE);
  13812. }
  13813. @@ -677,4 +1491,3 @@
  13814.  
  13815. return (pblk);
  13816. }
  13817. -
  13818. diff --strip-trailing-cr -ur ./driver/shared/acpiinit.h "c:\\ACPI\\ACPI_W2003\\Base\\busdrv\\acpi/driver/shared/acpiinit.h"
  13819. --- ./driver/shared/acpiinit.h 2003-02-26 17:15:52.000000000 +0500
  13820. +++ "c:\\ACPI\\ACPI_W2003\\Base\\busdrv\\acpi/driver/shared/acpiinit.h" 2022-04-02 19:19:42.000000000 +0500
  13821. @@ -55,4 +55,9 @@
  13822. IN UCHAR Processor
  13823. );
  13824.  
  13825. + VOID
  13826. + ACPIInitializeKernelTableHandler(
  13827. + IN BOOLEAN mode,
  13828. + IN PDRIVER_OBJECT DrvObj
  13829. + );
  13830. #endif
  13831. diff --strip-trailing-cr -ur ./driver/shared/acpioprg.c "c:\\ACPI\\ACPI_W2003\\Base\\busdrv\\acpi/driver/shared/acpioprg.c"
  13832. --- ./driver/shared/acpioprg.c 2003-02-26 17:15:52.000000000 +0500
  13833. +++ "c:\\ACPI\\ACPI_W2003\\Base\\busdrv\\acpi/driver/shared/acpioprg.c" 2022-04-06 23:35:48.739257800 +0500
  13834. @@ -119,6 +119,10 @@
  13835.  
  13836. HostDevice = NSGETPARENT(pnsOpRegion);
  13837.  
  13838. + while (HostDevice && NSGETOBJTYPE(HostDevice) == OBJTYPE_METHOD) {
  13839. + HostDevice = NSGETPARENT(HostDevice);
  13840. + }
  13841. +
  13842. ACPIPrint( (
  13843. ACPI_PRINT_IO,
  13844. "OpRegion Access on region %x device %x\n",
  13845. @@ -298,9 +302,9 @@
  13846. //
  13847. RtlZeroMemory( regArgs, sizeof(OBJDATA) * 2 );
  13848. regArgs[0].dwDataType = OBJTYPE_INTDATA;
  13849. - regArgs[0].uipDataValue = RegionSpace;
  13850. + regArgs[0].dwDataValue = RegionSpace;
  13851. regArgs[1].dwDataType = OBJTYPE_INTDATA;
  13852. - regArgs[1].uipDataValue = 1;
  13853. + regArgs[1].dwDataValue = 1;
  13854.  
  13855. //
  13856. // Eval the request. We can do this asynchronously since we don't actually
  13857. @@ -357,9 +361,9 @@
  13858. //
  13859. RtlZeroMemory( regArgs, sizeof(OBJDATA) * 2 );
  13860. regArgs[0].dwDataType = OBJTYPE_INTDATA;
  13861. - regArgs[0].uipDataValue = HandlerNode->RegionSpace;
  13862. + regArgs[0].dwDataValue = HandlerNode->RegionSpace;
  13863. regArgs[1].dwDataType = OBJTYPE_INTDATA;
  13864. - regArgs[1].uipDataValue = 0;
  13865. + regArgs[1].dwDataValue = 0;
  13866.  
  13867. //
  13868. // Eval the request. We don't care what it returns, but we must do
  13869. diff --strip-trailing-cr -ur ./driver/shared/acpisi.c "c:\\ACPI\\ACPI_W2003\\Base\\busdrv\\acpi/driver/shared/acpisi.c"
  13870. --- ./driver/shared/acpisi.c 2003-02-26 17:15:52.000000000 +0500
  13871. +++ "c:\\ACPI\\ACPI_W2003\\Base\\busdrv\\acpi/driver/shared/acpisi.c" 2022-04-04 04:05:08.000000000 +0500
  13872. @@ -41,7 +41,7 @@
  13873. ) );
  13874.  
  13875. Arg0.dwfData = 0;
  13876. - Arg0.uipDataValue = Value;
  13877. + Arg0.dwDataValue = Value;
  13878. Arg0.dwDataType = OBJTYPE_INTDATA;
  13879. Arg0.dwDataLen = 0;
  13880. Arg0.pbDataBuff = NULL;
  13881. @@ -60,7 +60,7 @@
  13882. ) );
  13883.  
  13884. Arg0.dwfData = 0;
  13885. - Arg0.uipDataValue = Value;
  13886. + Arg0.dwDataValue = Value;
  13887. Arg0.dwDataType = OBJTYPE_INTDATA;
  13888. Arg0.dwDataLen = 0;
  13889. Arg0.pbDataBuff = NULL;
  13890. diff --strip-trailing-cr -ur ./driver/shared/loaddsdt.c "c:\\ACPI\\ACPI_W2003\\Base\\busdrv\\acpi/driver/shared/loaddsdt.c"
  13891. --- ./driver/shared/loaddsdt.c 2003-02-26 17:15:52.000000000 +0500
  13892. +++ "c:\\ACPI\\ACPI_W2003\\Base\\busdrv\\acpi/driver/shared/loaddsdt.c" 2022-04-02 20:10:24.000000000 +0500
  13893. @@ -131,8 +131,13 @@
  13894. rsdtPointer
  13895. ) );
  13896. ACPIBreakPoint();
  13897. - goto RsdtDone;
  13898.  
  13899. + //
  13900. + // Give back a PTE now that we're done with the rsdtPointer.
  13901. + //
  13902. + MmUnmapIoSpace(rsdtPointer, sizeof(DESCRIPTION_HEADER));
  13903. +
  13904. + goto RsdtDone;
  13905. }
  13906.  
  13907. //
  13908. @@ -152,17 +157,17 @@
  13909. //
  13910. // did we find the right rsdt buffer?
  13911. //
  13912. - if (rsdtBuffer == NULL) {
  13913. + //if (rsdtBuffer == NULL) {
  13914.  
  13915. - ACPIPrint( (
  13916. - ACPI_PRINT_CRITICAL,
  13917. - "ACPILoadFindRsdt: Cannot Map RSDT Pointer 0x%08lx\n",
  13918. - rsdpMulti->RsdtAddress.LowPart
  13919. - ) );
  13920. - ACPIBreakPoint();
  13921. - goto RsdtDone;
  13922. + // ACPIPrint( (
  13923. + // ACPI_PRINT_CRITICAL,
  13924. + // "ACPILoadFindRsdt: Cannot Map RSDT Pointer 0x%08lx\n",
  13925. + // rsdpMulti->RsdtAddress.LowPart
  13926. + // ) );
  13927. + // ACPIBreakPoint();
  13928. + // goto RsdtDone;
  13929.  
  13930. - }
  13931. + //}
  13932.  
  13933. RsdtDone:
  13934. //
  13935. Only in c:\ACPI\ACPI_W2003\Base\busdrv\acpi/driver/shared: obj
  13936. diff --strip-trailing-cr -ur ./driver/shared/pch.h "c:\\ACPI\\ACPI_W2003\\Base\\busdrv\\acpi/driver/shared/pch.h"
  13937. --- ./driver/shared/pch.h 2003-02-26 17:15:52.000000000 +0500
  13938. +++ "c:\\ACPI\\ACPI_W2003\\Base\\busdrv\\acpi/driver/shared/pch.h" 2022-04-04 00:11:14.000000000 +0500
  13939. @@ -57,6 +57,7 @@
  13940. //
  13941. // These are the global include files for this project
  13942. //
  13943. +#include "arblib.h"
  13944. #include "acpitabl.h"
  13945. #include "amli.h"
  13946. #include "aml.h"
  13947.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement