aboutsummaryrefslogtreecommitdiff
path: root/utilities/uttrack.c
diff options
context:
space:
mode:
Diffstat (limited to 'utilities/uttrack.c')
-rw-r--r--utilities/uttrack.c108
1 files changed, 75 insertions, 33 deletions
diff --git a/utilities/uttrack.c b/utilities/uttrack.c
index 37fdba1c446c..ac45e9a3d88c 100644
--- a/utilities/uttrack.c
+++ b/utilities/uttrack.c
@@ -644,6 +644,7 @@ AcpiUtDumpAllocations (
ACPI_DEBUG_MEM_BLOCK *Element;
ACPI_DESCRIPTOR *Descriptor;
UINT32 NumOutstanding = 0;
+ UINT8 DescriptorType;
ACPI_FUNCTION_TRACE (UtDumpAllocations);
@@ -663,43 +664,86 @@ AcpiUtDumpAllocations (
if ((Element->Component & Component) &&
((Module == NULL) || (0 == ACPI_STRCMP (Module, Element->Module))))
{
- /* Ignore allocated objects that are in a cache */
-
Descriptor = ACPI_CAST_PTR (ACPI_DESCRIPTOR, &Element->UserSpace);
- if (ACPI_GET_DESCRIPTOR_TYPE (Descriptor) != ACPI_DESC_TYPE_CACHED)
+
+ if (Element->Size < sizeof (ACPI_COMMON_DESCRIPTOR))
{
- AcpiOsPrintf ("%p Len %04X %9.9s-%d [%s] ",
+ AcpiOsPrintf ("%p Length 0x%04X %9.9s-%d "
+ "[Not a Descriptor - too small]\n",
Descriptor, Element->Size, Element->Module,
- Element->Line, AcpiUtGetDescriptorName (Descriptor));
-
- /* Most of the elements will be Operand objects. */
+ Element->Line);
+ }
+ else
+ {
+ /* Ignore allocated objects that are in a cache */
- switch (ACPI_GET_DESCRIPTOR_TYPE (Descriptor))
+ if (ACPI_GET_DESCRIPTOR_TYPE (Descriptor) != ACPI_DESC_TYPE_CACHED)
{
- case ACPI_DESC_TYPE_OPERAND:
- AcpiOsPrintf ("%12.12s R%hd",
- AcpiUtGetTypeName (Descriptor->Object.Common.Type),
- Descriptor->Object.Common.ReferenceCount);
- break;
-
- case ACPI_DESC_TYPE_PARSER:
- AcpiOsPrintf ("AmlOpcode %04hX",
- Descriptor->Op.Asl.AmlOpcode);
- break;
-
- case ACPI_DESC_TYPE_NAMED:
- AcpiOsPrintf ("%4.4s",
- AcpiUtGetNodeName (&Descriptor->Node));
- break;
-
- default:
- break;
+ AcpiOsPrintf ("%p Length 0x%04X %9.9s-%d [%s] ",
+ Descriptor, Element->Size, Element->Module,
+ Element->Line, AcpiUtGetDescriptorName (Descriptor));
+
+ /* Validate the descriptor type using Type field and length */
+
+ DescriptorType = 0; /* Not a valid descriptor type */
+
+ switch (ACPI_GET_DESCRIPTOR_TYPE (Descriptor))
+ {
+ case ACPI_DESC_TYPE_OPERAND:
+ if (Element->Size == sizeof (ACPI_DESC_TYPE_OPERAND))
+ {
+ DescriptorType = ACPI_DESC_TYPE_OPERAND;
+ }
+ break;
+
+ case ACPI_DESC_TYPE_PARSER:
+ if (Element->Size == sizeof (ACPI_DESC_TYPE_PARSER))
+ {
+ DescriptorType = ACPI_DESC_TYPE_PARSER;
+ }
+ break;
+
+ case ACPI_DESC_TYPE_NAMED:
+ if (Element->Size == sizeof (ACPI_DESC_TYPE_NAMED))
+ {
+ DescriptorType = ACPI_DESC_TYPE_NAMED;
+ }
+ break;
+
+ default:
+ break;
+ }
+
+ /* Display additional info for the major descriptor types */
+
+ switch (DescriptorType)
+ {
+ case ACPI_DESC_TYPE_OPERAND:
+ AcpiOsPrintf ("%12.12s RefCount 0x%04X\n",
+ AcpiUtGetTypeName (Descriptor->Object.Common.Type),
+ Descriptor->Object.Common.ReferenceCount);
+ break;
+
+ case ACPI_DESC_TYPE_PARSER:
+ AcpiOsPrintf ("AmlOpcode 0x%04hX\n",
+ Descriptor->Op.Asl.AmlOpcode);
+ break;
+
+ case ACPI_DESC_TYPE_NAMED:
+ AcpiOsPrintf ("%4.4s\n",
+ AcpiUtGetNodeName (&Descriptor->Node));
+ break;
+
+ default:
+ AcpiOsPrintf ( "\n");
+ break;
+ }
}
-
- AcpiOsPrintf ( "\n");
- NumOutstanding++;
}
+
+ NumOutstanding++;
}
+
Element = Element->Next;
}
@@ -709,13 +753,11 @@ AcpiUtDumpAllocations (
if (!NumOutstanding)
{
- ACPI_INFO ((AE_INFO,
- "No outstanding allocations"));
+ ACPI_INFO ((AE_INFO, "No outstanding allocations"));
}
else
{
- ACPI_ERROR ((AE_INFO,
- "%d(0x%X) Outstanding allocations",
+ ACPI_ERROR ((AE_INFO, "%d(0x%X) Outstanding allocations",
NumOutstanding, NumOutstanding));
}