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

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