Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1299 lines
23 KiB

  1. /*++
  2. Copyright (c) 1993 Microsoft Corporation
  3. Module Name:
  4. kdexts.c
  5. Abstract:
  6. This file contains the generic routines and initialization code
  7. for the kernel debugger extensions dll.
  8. Author:
  9. Stephane Plante (splante)
  10. Environment:
  11. User Mode
  12. --*/
  13. #include "pch.h"
  14. #pragma hdrstop
  15. #include <ntverp.h>
  16. #include <imagehlp.h>
  17. //
  18. // globals
  19. //
  20. EXT_API_VERSION ApiVersion = { 5, 0, EXT_API_VERSION_NUMBER, 0 };
  21. WINDBG_EXTENSION_APIS ExtensionApis;
  22. USHORT SavedMajorVersion;
  23. USHORT SavedMinorVersion;
  24. ULONG_PTR AcpiExtAddress = 0;
  25. ULONG_PTR AcpiTreeAddress = 0;
  26. ULONG_PTR AcpiObjAddress = 0;
  27. ULONG_PTR AcpiFacsAddress = 0;
  28. ULONG_PTR AcpiFadtAddress = 0;
  29. ULONG_PTR AcpiHdrAddress = 0;
  30. ULONG_PTR AcpiMapicAddress = 0;
  31. ULONG_PTR AcpiRsdtAddress = 0;
  32. ULONG_PTR AcpiUnasmAddress = 0;
  33. ULONG AcpiUnasmLength = 0;
  34. DllInit(
  35. HANDLE hModule,
  36. DWORD dwReason,
  37. DWORD dwReserved
  38. )
  39. {
  40. switch (dwReason) {
  41. case DLL_THREAD_ATTACH:
  42. break;
  43. case DLL_THREAD_DETACH:
  44. break;
  45. case DLL_PROCESS_DETACH:
  46. break;
  47. case DLL_PROCESS_ATTACH:
  48. break;
  49. }
  50. return TRUE;
  51. }
  52. VOID
  53. WinDbgExtensionDllInit(
  54. PWINDBG_EXTENSION_APIS lpExtensionApis,
  55. USHORT MajorVersion,
  56. USHORT MinorVersion
  57. )
  58. {
  59. ExtensionApis = *lpExtensionApis;
  60. SavedMajorVersion = MajorVersion;
  61. SavedMinorVersion = MinorVersion;
  62. return;
  63. }
  64. BOOL
  65. GetUlong (
  66. IN PCHAR String,
  67. IN PULONG Value
  68. )
  69. {
  70. BOOL status;
  71. ULONG_PTR Location;
  72. ULONG result;
  73. Location = GetExpression( String );
  74. if (!Location) {
  75. dprintf("unable to get %s\n",String);
  76. return FALSE;
  77. }
  78. status = ReadMemory(
  79. Location,
  80. Value,
  81. sizeof(ULONG),
  82. &result
  83. );
  84. if (status == FALSE || result != sizeof(ULONG)) {
  85. return FALSE;
  86. }
  87. return TRUE;
  88. }
  89. BOOL
  90. GetUlongPtr (
  91. IN PCHAR String,
  92. IN PULONG_PTR Address
  93. )
  94. {
  95. BOOL status;
  96. ULONG_PTR Location;
  97. ULONG result;
  98. Location = GetExpression( String );
  99. if (!Location) {
  100. dprintf("unable to get %s\n",String);
  101. return FALSE;
  102. }
  103. status = ReadMemory(
  104. Location,
  105. Address,
  106. sizeof(ULONG_PTR),
  107. &result
  108. );
  109. if (status == FALSE || result != sizeof(ULONG)) {
  110. return FALSE;
  111. }
  112. return TRUE;
  113. }
  114. LPEXT_API_VERSION
  115. ExtensionApiVersion(
  116. VOID
  117. )
  118. {
  119. return &ApiVersion;
  120. }
  121. DECLARE_API( accfield )
  122. {
  123. ULONG_PTR fieldAddress = 0;
  124. if (args != NULL) {
  125. fieldAddress = GetExpression( args );
  126. }
  127. if (fieldAddress == 0) {
  128. dprintf("accfield: <address>\n");
  129. return;
  130. }
  131. dumpAccessFieldUnit(
  132. fieldAddress,
  133. (ULONG) -1,
  134. 0
  135. );
  136. }
  137. DECLARE_API( acpiext )
  138. {
  139. BOOL b;
  140. DEVICE_EXTENSION deviceExtension;
  141. DEVICE_OBJECT deviceObject;
  142. ULONG_PTR deviceExtensionAddress = 0;
  143. ULONG verbose = VERBOSE_ALL;
  144. //
  145. // Read the address of the device object
  146. //
  147. if ( args != NULL) {
  148. sscanf( args, "%lx %x", &deviceExtensionAddress, &verbose );
  149. }
  150. if (deviceExtensionAddress == 0) {
  151. if ( args != NULL) {
  152. deviceExtensionAddress = GetExpression( args );
  153. }
  154. if (deviceExtensionAddress == 0) {
  155. b = GetUlongPtr(
  156. "ACPI!RootDeviceExtension",
  157. &deviceExtensionAddress
  158. );
  159. if (!b) {
  160. deviceExtensionAddress = 0;
  161. }
  162. }
  163. if (deviceExtensionAddress == 0) {
  164. dprintf("acpiext <address>\n");
  165. return;
  166. }
  167. }
  168. //
  169. // Read the device object
  170. //
  171. b = ReadMemory(
  172. deviceExtensionAddress,
  173. &deviceExtension,
  174. sizeof(DEVICE_EXTENSION),
  175. NULL
  176. );
  177. if (!b || deviceExtension.Signature != ACPI_SIGNATURE) {
  178. //
  179. // Try to read a device object instead
  180. //
  181. b = ReadMemory(
  182. deviceExtensionAddress,
  183. &deviceObject,
  184. sizeof(DEVICE_OBJECT),
  185. NULL
  186. );
  187. if (!b) {
  188. dprintf("0x%08lx: Could not read DeviceObject\n", deviceExtensionAddress);
  189. return;
  190. }
  191. //
  192. // Try to read an extension now
  193. //
  194. deviceExtensionAddress = (ULONG_PTR) deviceObject.DeviceExtension;
  195. if (deviceExtensionAddress == 0) {
  196. dprintf("acpiext: Could not find ACPI Extension\n");
  197. return;
  198. }
  199. }
  200. dumpAcpiExtension(
  201. deviceExtensionAddress,
  202. verbose,
  203. 0
  204. );
  205. return;
  206. }
  207. DECLARE_API( buildlist )
  208. {
  209. UCHAR tempBuff[100];
  210. if (args != NULL && args[0] != 0) {
  211. _snprintf( tempBuff, 100, "ACPI!ACPIBuild%sList", args );
  212. dumpAcpiBuildList( tempBuff );
  213. } else {
  214. dumpAcpiBuildLists();
  215. }
  216. }
  217. DECLARE_API( call )
  218. {
  219. ULONG_PTR callAddress = 0;
  220. if (args != NULL) {
  221. callAddress = GetExpression( args );
  222. }
  223. if (callAddress == 0) {
  224. dprintf("call: <address>\n");
  225. return;
  226. }
  227. dumpCall(
  228. callAddress,
  229. (ULONG) -1,
  230. 0
  231. );
  232. }
  233. DECLARE_API( context )
  234. {
  235. BOOL b;
  236. ULONG_PTR contextAddress = 0;
  237. ULONG verbose = 0;
  238. //
  239. // If there are arguments, try to read them
  240. //
  241. if ( args != NULL) {
  242. sscanf( args, "%lx %x", &contextAddress, &verbose );
  243. }
  244. if (contextAddress == 0) {
  245. if (args != NULL) {
  246. contextAddress = GetExpression(args);
  247. }
  248. if (contextAddress == 0) {
  249. CTXT context;
  250. PLIST listEntry;
  251. ULONG resultLength;
  252. //
  253. // Try to read the default address
  254. //
  255. b = GetUlongPtr( "ACPI!gplistCtxtHead", &contextAddress );
  256. if (!b || contextAddress == 0) {
  257. dprintf("context: Could not read ACPI!gplistCtxtHead\n" );
  258. return;
  259. }
  260. //
  261. // Read the list and look at the first item
  262. //
  263. b = ReadMemory(
  264. contextAddress,
  265. &listEntry,
  266. sizeof(PLIST),
  267. &resultLength
  268. );
  269. if (!b || resultLength != sizeof(PLIST)) {
  270. dprintf(
  271. "context: Could not read PLIST @ 0x%08lx\n",
  272. contextAddress
  273. );
  274. return;
  275. }
  276. //
  277. // The first item in the list is the context that we are
  278. // interested in
  279. //
  280. contextAddress = (ULONG_PTR) listEntry -
  281. ( (ULONG_PTR) &(context.listCtxt) - (ULONG_PTR) &(context) );
  282. //
  283. // Is there a context there?
  284. //
  285. if (contextAddress == 0) {
  286. dprintf(
  287. "context: No current context\n"
  288. );
  289. }
  290. }
  291. }
  292. dumpContext( contextAddress, verbose );
  293. return;
  294. }
  295. DECLARE_API( dm )
  296. {
  297. ULONG_PTR address = 0;
  298. ULONG i;
  299. ULONG length = 0;
  300. PUCHAR name = NULL;
  301. PUCHAR tok = NULL;
  302. char sz[1000];
  303. if (args != NULL) {
  304. strcpy(sz, args);
  305. for (i = 0, tok = strtok( sz, " \t" );
  306. i < 3, tok != NULL;
  307. i +=1 ) {
  308. if (i == 0) {
  309. address = GetExpression( tok );
  310. tok = strtok( NULL, " Ll\t" );
  311. } else if (i == 1) {
  312. length = (ULONG)GetExpression ( tok );
  313. tok = strtok( NULL, " \t\n\r");
  314. } else if (i == 2) {
  315. name = tok;
  316. tok = strtok( NULL, " \t\n\r");
  317. }
  318. }
  319. }
  320. if (address == 0 || length == 0 || name == NULL) {
  321. dprintf("dm <address> L<length> <filename>\n");
  322. return;
  323. }
  324. dumpMemory( address, length, name );
  325. return;
  326. }
  327. #if 0
  328. DECLARE_API( dsdt )
  329. {
  330. ULONG_PTR address = 0;
  331. ULONG i;
  332. PUCHAR name = NULL;
  333. PUCHAR tok = NULL;
  334. UCHAR tempBuff[1000];
  335. if (args != NULL) {
  336. strcpy(tempBuff, args);
  337. for (i = 0, tok = strtok( tempBuff, " \t" );
  338. i < 2, tok != NULL;
  339. i +=1 ) {
  340. if (i == 0) {
  341. address = GetExpression( tok );
  342. tok = strtok( NULL, " \n\r\t" );
  343. } else if (i == 1) {
  344. name = tok;
  345. tok = strtok( NULL, " \t\n\r");
  346. }
  347. }
  348. }
  349. if (address == 0) {
  350. ACPIInformation acpiInformation;
  351. BOOL status;
  352. ULONG_PTR infAddress = 0;
  353. ULONG returnLength;
  354. status = GetUlongPtr("ACPI!AcpiInformation", &infAddress );
  355. if (status == TRUE) {
  356. status = ReadMemory(
  357. infAddress,
  358. &acpiInformation,
  359. sizeof(ACPIInformation),
  360. &returnLength
  361. );
  362. if (status && returnLength == sizeof(ACPIInformation)) {
  363. address = (ULONG_PTR) acpiInformation.DiffSystemDescTable;
  364. }
  365. }
  366. }
  367. if (address == 0) {
  368. dprintf("dsdt <address>\n");
  369. }
  370. dumpDSDT( address, name );
  371. return;
  372. }
  373. #endif
  374. DECLARE_API( facs )
  375. {
  376. if (args != NULL) {
  377. AcpiFacsAddress = GetExpression( args );
  378. }
  379. if (AcpiFacsAddress == 0) {
  380. ACPIInformation acpiInformation;
  381. BOOL status;
  382. ULONG_PTR address;
  383. ULONG returnLength;
  384. status = GetUlongPtr( "ACPI!AcpiInformation", &address );
  385. if (status == TRUE) {
  386. status = ReadMemory(
  387. address,
  388. &acpiInformation,
  389. sizeof(ACPIInformation),
  390. &returnLength
  391. );
  392. if (status && returnLength == sizeof(ACPIInformation)) {
  393. AcpiFacsAddress = (ULONG_PTR) acpiInformation.FirmwareACPIControlStructure;
  394. }
  395. }
  396. }
  397. if (AcpiFacsAddress == 0) {
  398. dprintf("facs <address>\n");
  399. return;
  400. }
  401. dumpFACS( AcpiFacsAddress );
  402. return;
  403. }
  404. DECLARE_API( fadt )
  405. {
  406. if (args != NULL && *args != '\0') {
  407. AcpiFadtAddress = GetExpression( args );
  408. }
  409. if (AcpiFadtAddress == 0) {
  410. ACPIInformation acpiInformation;
  411. BOOL status;
  412. ULONG_PTR address;
  413. ULONG returnLength;
  414. status = GetUlongPtr( "ACPI!AcpiInformation", &address );
  415. if (status == TRUE) {
  416. status = ReadMemory(
  417. address,
  418. &acpiInformation,
  419. sizeof(ACPIInformation),
  420. &returnLength
  421. );
  422. if (status && returnLength == sizeof(ACPIInformation)) {
  423. AcpiFadtAddress = (ULONG_PTR) acpiInformation.FixedACPIDescTable;
  424. }
  425. }
  426. }
  427. if (AcpiFadtAddress == 0) {
  428. dprintf("fadt <address>\n");
  429. return;
  430. }
  431. dumpFADT( AcpiFadtAddress );
  432. return;
  433. }
  434. DECLARE_API( gbl )
  435. {
  436. ULONG verbose = VERBOSE_1;
  437. if (args != NULL) {
  438. if (!strcmp(args, "-v")) {
  439. verbose |= VERBOSE_2;
  440. }
  441. }
  442. dumpGBL( verbose );
  443. }
  444. DECLARE_API ( gpe )
  445. {
  446. dumpAcpiGpeInformation( );
  447. return;
  448. }
  449. DECLARE_API( hdr )
  450. {
  451. BOOL b;
  452. BOOL virtualMemory = FALSE;
  453. DESCRIPTION_HEADER header;
  454. ULONG returnLength;
  455. if (args != NULL) {
  456. AcpiHdrAddress = GetExpression( args );
  457. }
  458. if (AcpiHdrAddress == 0) {
  459. dprintf("hdr <address>\n");
  460. return;
  461. }
  462. //
  463. // First check to see if we find the correct things
  464. //
  465. b = ReadPhysicalOrVirtual(
  466. AcpiHdrAddress,
  467. &header,
  468. sizeof(DESCRIPTION_HEADER),
  469. &returnLength,
  470. virtualMemory
  471. );
  472. if (!b) {
  473. //
  474. // Attempt to read a Virtual address
  475. //
  476. virtualMemory = !virtualMemory;
  477. b = ReadPhysicalOrVirtual(
  478. AcpiHdrAddress,
  479. &header,
  480. sizeof(DESCRIPTION_HEADER),
  481. &returnLength,
  482. virtualMemory
  483. );
  484. }
  485. //
  486. // Is the signature 'known'?
  487. //
  488. if (header.Signature != FADT_SIGNATURE &&
  489. header.Signature != FACS_SIGNATURE &&
  490. header.Signature != RSDT_SIGNATURE &&
  491. header.Signature != APIC_SIGNATURE &&
  492. header.Signature != DSDT_SIGNATURE &&
  493. header.Signature != SSDT_SIGNATURE &&
  494. header.Signature != PSDT_SIGNATURE &&
  495. header.Signature != SBST_SIGNATURE) {
  496. //
  497. // Unknown -- try again
  498. //
  499. virtualMemory = !virtualMemory;
  500. b = ReadPhysicalOrVirtual(
  501. AcpiHdrAddress,
  502. &header,
  503. sizeof(DESCRIPTION_HEADER),
  504. &returnLength,
  505. virtualMemory
  506. );
  507. if (!b) {
  508. virtualMemory = !virtualMemory;
  509. b = ReadPhysicalOrVirtual(
  510. AcpiHdrAddress,
  511. &header,
  512. sizeof(DESCRIPTION_HEADER),
  513. &returnLength,
  514. virtualMemory
  515. );
  516. }
  517. }
  518. dumpHeader( AcpiHdrAddress, &header, TRUE );
  519. return;
  520. }
  521. DECLARE_API( kb )
  522. {
  523. BOOL b;
  524. ULONG_PTR contextAddress = 0;
  525. ULONG verbose = 0;
  526. //
  527. // If there are arguments, try to read them
  528. //
  529. if (args != NULL) {
  530. contextAddress = GetExpression(args);
  531. }
  532. if (contextAddress == 0) {
  533. CTXT context;
  534. PLIST listEntry;
  535. ULONG resultLength;
  536. //
  537. // Try to read the default address
  538. //
  539. b = GetUlongPtr( "ACPI!gplistCtxtHead", &contextAddress );
  540. if (!b || contextAddress == 0) {
  541. dprintf("kb: Could not read ACPI!gplistCtxtHead\n" );
  542. return;
  543. }
  544. //
  545. // Read the list and look at the first item
  546. //
  547. b = ReadMemory(
  548. contextAddress,
  549. &listEntry,
  550. sizeof(PLIST),
  551. &resultLength
  552. );
  553. if (!b || resultLength != sizeof(PLIST)) {
  554. dprintf(
  555. "kb: Could not read PLIST @ 0x%08lx\n",
  556. contextAddress
  557. );
  558. return;
  559. }
  560. //
  561. // The first item in the list is the context that we are
  562. // interested in
  563. //
  564. contextAddress = (ULONG_PTR) listEntry -
  565. ( (ULONG_PTR) &(context.listCtxt) - (ULONG_PTR) &(context) );
  566. //
  567. // Is there a context there?
  568. //
  569. if (contextAddress == 0) {
  570. dprintf(
  571. "kb: No current context\n"
  572. );
  573. }
  574. }
  575. stackTrace( contextAddress, 0 );
  576. return;
  577. }
  578. DECLARE_API( kv )
  579. {
  580. BOOL b;
  581. ULONG_PTR contextAddress = 0;
  582. ULONG verbose = 0;
  583. //
  584. // If there are arguments, try to read them
  585. //
  586. if (args != NULL) {
  587. contextAddress = GetExpression(args);
  588. }
  589. if (contextAddress == 0) {
  590. CTXT context;
  591. PLIST listEntry;
  592. ULONG resultLength;
  593. //
  594. // Try to read the default address
  595. //
  596. b = GetUlongPtr( "ACPI!gplistCtxtHead", &contextAddress );
  597. if (!b || contextAddress == 0) {
  598. dprintf("kv: Could not read ACPI!gplistCtxtHead\n" );
  599. return;
  600. }
  601. //
  602. // Read the list and look at the first item
  603. //
  604. b = ReadMemory(
  605. contextAddress,
  606. &listEntry,
  607. sizeof(PLIST),
  608. &resultLength
  609. );
  610. if (!b || resultLength != sizeof(PLIST)) {
  611. dprintf(
  612. "kv: Could not read PLIST @ 0x%08lx\n",
  613. contextAddress
  614. );
  615. return;
  616. }
  617. //
  618. // The first item in the list is the context that we are
  619. // interested in
  620. //
  621. contextAddress = (ULONG_PTR) listEntry -
  622. ( (ULONG_PTR) &(context.listCtxt) - (ULONG_PTR) &(context) );
  623. //
  624. // Is there a context there?
  625. //
  626. if (contextAddress == 0) {
  627. dprintf(
  628. "kv: No current context\n"
  629. );
  630. }
  631. }
  632. stackTrace( contextAddress, 1 );
  633. return;
  634. }
  635. DECLARE_API( inf )
  636. {
  637. dumpAcpiInformation( );
  638. return;
  639. }
  640. DECLARE_API( mapic )
  641. {
  642. if (args != NULL) {
  643. AcpiMapicAddress = GetExpression( args );
  644. }
  645. if (AcpiMapicAddress == 0) {
  646. ACPIInformation acpiInformation;
  647. BOOL status;
  648. ULONG_PTR address;
  649. ULONG returnLength;
  650. status = GetUlongPtr( "ACPI!AcpiInformation", &address );
  651. if (status == TRUE) {
  652. status = ReadMemory(
  653. address,
  654. &acpiInformation,
  655. sizeof(ACPIInformation),
  656. &returnLength
  657. );
  658. if (status && returnLength == sizeof(ACPIInformation)) {
  659. AcpiMapicAddress = (ULONG_PTR) acpiInformation.MultipleApicTable;
  660. }
  661. }
  662. }
  663. if (AcpiMapicAddress == 0) {
  664. dprintf("mapic <address>");
  665. return;
  666. }
  667. dumpMAPIC( AcpiMapicAddress );
  668. return;
  669. }
  670. DECLARE_API( node )
  671. {
  672. ULONG_PTR nodeAddress;
  673. nodeAddress = GetExpression( args );
  674. if (nodeAddress == 0) {
  675. dprintf("node: Illegal Address (%s == NULL)\n", args );
  676. return;
  677. }
  678. dumpAcpiDeviceNodes( nodeAddress, VERBOSE_4, 0 );
  679. }
  680. DECLARE_API( nsobj )
  681. {
  682. ULONG_PTR address = 0;
  683. if (args != NULL) {
  684. address = GetExpression( args );
  685. }
  686. if (args == 0) {
  687. dprintf(
  688. "nsobj: Could not find %s\n",
  689. (args != NULL ? args : "null")
  690. );
  691. return;
  692. }
  693. dumpNSObject( address, 0xFFFF, 0 );
  694. }
  695. DECLARE_API( nstree )
  696. {
  697. ULONG_PTR address = 0;
  698. if ((args != NULL) && (*args != '\0')) {
  699. address = GetExpression( args );
  700. } else {
  701. address = GetExpression( "acpi!gpnsNameSpaceRoot" );
  702. }
  703. if (address == 0) {
  704. dprintf(
  705. "nstree: Could not find %s\n",
  706. (args != NULL ? args : "acpi!gpnsNameSpaceRoot" )
  707. );
  708. return;
  709. }
  710. dumpNSTree( address, 0 );
  711. }
  712. DECLARE_API( objdata )
  713. {
  714. BOOL b;
  715. ULONG address = 0;
  716. //
  717. // Read the address of the device object
  718. //
  719. if (args != NULL) {
  720. AcpiObjAddress = GetExpression( args );
  721. }
  722. if (AcpiObjAddress == 0) {
  723. dprintf("object <address>\n");
  724. return;
  725. }
  726. dumpPObject( AcpiObjAddress, 0xFFFF, 0);
  727. return;
  728. }
  729. DECLARE_API( pnpreslist )
  730. {
  731. ULONG_PTR address = 0;
  732. if (args != NULL) {
  733. address = GetExpression( args );
  734. }
  735. if (address == 0) {
  736. dprintf("pnpreslist <address>\n");
  737. return;
  738. }
  739. dumpPnPResources( address );
  740. }
  741. DECLARE_API( polist )
  742. {
  743. UCHAR tempBuff[100];
  744. if (args != NULL && args[0] != 0) {
  745. _snprintf( tempBuff, 100, "ACPI!ACPIPower%sList", args );
  746. dumpAcpiPowerList( tempBuff );
  747. } else {
  748. dumpAcpiPowerLists();
  749. }
  750. }
  751. DECLARE_API( ponodes )
  752. {
  753. dumpAcpiPowerNodes();
  754. }
  755. #if 0
  756. DECLARE_API( psdt )
  757. {
  758. ULONG_PTR address = 0;
  759. ULONG i;
  760. PUCHAR name = NULL;
  761. PUCHAR tok = NULL;
  762. UCHAR tempBuff[1000];
  763. if (args != NULL) {
  764. strcpy(tempBuff, args);
  765. for (i = 0, tok = strtok( tempBuff, " \t" );
  766. i < 2, tok != NULL;
  767. i +=1 ) {
  768. if (i == 0) {
  769. address = GetExpression( tok );
  770. tok = strtok( NULL, " Ll\t" );
  771. } else if (i == 1) {
  772. name = tok;
  773. tok = strtok( NULL, " \t\n\r");
  774. }
  775. }
  776. }
  777. if (address == 0) {
  778. dprintf("psdt <address>");
  779. return;
  780. }
  781. dumpDSDT( address, name );
  782. return;
  783. }
  784. #endif
  785. DECLARE_API( rsdt )
  786. {
  787. if (args != NULL) {
  788. AcpiRsdtAddress = GetExpression( args );
  789. }
  790. if (AcpiRsdtAddress == 0) {
  791. ACPIInformation acpiInformation;
  792. BOOL status;
  793. ULONG_PTR address;
  794. ULONG returnLength;
  795. status = GetUlongPtr( "ACPI!AcpiInformation", &address );
  796. if (status == TRUE) {
  797. status = ReadMemory(
  798. address,
  799. &acpiInformation,
  800. sizeof(ACPIInformation),
  801. &returnLength
  802. );
  803. if (status && returnLength == sizeof(ACPIInformation)) {
  804. AcpiRsdtAddress = (ULONG_PTR) acpiInformation.RootSystemDescTable;
  805. }
  806. }
  807. }
  808. if (AcpiRsdtAddress == 0) {
  809. if (!findRSDT( &AcpiRsdtAddress) ) {
  810. dprintf("Could not locate the RSDT pointer\n");
  811. return;
  812. }
  813. }
  814. dumpRSDT( AcpiRsdtAddress );
  815. return;
  816. }
  817. DECLARE_API( scope )
  818. {
  819. ULONG_PTR scopeAddress = 0;
  820. if (args != NULL) {
  821. scopeAddress = GetExpression( args );
  822. }
  823. if (scopeAddress == 0) {
  824. dprintf("scope: <address>\n");
  825. return;
  826. }
  827. dumpScope(
  828. scopeAddress,
  829. (ULONG) -1,
  830. 0
  831. );
  832. }
  833. #if 0
  834. DECLARE_API( ssdt )
  835. {
  836. ULONG_PTR address = 0;
  837. ULONG i;
  838. PUCHAR name = NULL;
  839. PUCHAR tok = NULL;
  840. UCHAR tempBuff[1000];
  841. if (args != NULL) {
  842. strcpy(tempBuff, args);
  843. for (i = 0, tok = strtok( tempBuff, " \t" );
  844. i < 2, tok != NULL;
  845. i +=1 ) {
  846. if (i == 0) {
  847. address = GetExpression( tok );
  848. tok = strtok( NULL, " Ll\t" );
  849. } else if (i == 1) {
  850. name = tok;
  851. tok = strtok( NULL, " \t\n\r");
  852. }
  853. }
  854. }
  855. if (address == 0) {
  856. dprintf("ssdt <address>");
  857. return;
  858. }
  859. dumpDSDT( address, name );
  860. return;
  861. }
  862. #endif
  863. DECLARE_API( term )
  864. {
  865. ULONG_PTR termAddress = 0;
  866. if (args != NULL) {
  867. termAddress = GetExpression( args );
  868. }
  869. if (termAddress == 0) {
  870. dprintf("term: <address>\n");
  871. return;
  872. }
  873. dumpTerm(
  874. termAddress,
  875. (ULONG) -1,
  876. 0
  877. );
  878. }
  879. DECLARE_API( version )
  880. {
  881. #if DBG
  882. PCHAR DebuggerType = "Checked";
  883. #else
  884. PCHAR DebuggerType = "Free";
  885. #endif
  886. dprintf(
  887. "%s Extension dll for Build %d debugging %s kernel for Build %d\n",
  888. DebuggerType,
  889. VER_PRODUCTBUILD,
  890. SavedMajorVersion == 0x0c ? "Checked" : "Free",
  891. SavedMinorVersion
  892. );
  893. }
  894. DECLARE_API( amli )
  895. /*++
  896. Routine Description:
  897. Invoke AMLI debugger
  898. Arguments:
  899. None
  900. Return Value:
  901. None
  902. --*/
  903. {
  904. if ((args == NULL) || (*args == '\0'))
  905. {
  906. dprintf("Usage: amli <cmd> [arguments ...]\n"
  907. "where <cmd> is one of the following:\n");
  908. AMLIDbgHelp(NULL, NULL, 0, 0);
  909. dprintf("\n");
  910. }
  911. else
  912. {
  913. AMLIDbgExecuteCmd((PSZ)args);
  914. dprintf("\n");
  915. }
  916. }
  917. DECLARE_API( irqarb )
  918. {
  919. dprintf("Moved to kdexts.dll Try '!acpiirqarb'\n");
  920. }