diff options
Diffstat (limited to 'utilities')
-rw-r--r-- | utilities/utcopy.c | 20 | ||||
-rw-r--r-- | utilities/utglobal.c | 4 | ||||
-rw-r--r-- | utilities/uttrack.c | 108 |
3 files changed, 91 insertions, 41 deletions
diff --git a/utilities/utcopy.c b/utilities/utcopy.c index fe44083c5983..c1fccaefe1ba 100644 --- a/utilities/utcopy.c +++ b/utilities/utcopy.c @@ -797,6 +797,7 @@ AcpiUtCopySimpleObject ( UINT16 ReferenceCount; ACPI_OPERAND_OBJECT *NextObject; ACPI_STATUS Status; + ACPI_SIZE CopySize; /* Save fields from destination that we don't want to overwrite */ @@ -804,10 +805,18 @@ AcpiUtCopySimpleObject ( ReferenceCount = DestDesc->Common.ReferenceCount; NextObject = DestDesc->Common.NextObject; - /* Copy the entire source object over the destination object*/ + /* + * Copy the entire source object over the destination object. + * Note: Source can be either an operand object or namespace node. + */ + CopySize = sizeof (ACPI_OPERAND_OBJECT); + if (ACPI_GET_DESCRIPTOR_TYPE (SourceDesc) == ACPI_DESC_TYPE_NAMED) + { + CopySize = sizeof (ACPI_NAMESPACE_NODE); + } - ACPI_MEMCPY ((char *) DestDesc, (char *) SourceDesc, - sizeof (ACPI_OPERAND_OBJECT)); + ACPI_MEMCPY (ACPI_CAST_PTR (char, DestDesc), + ACPI_CAST_PTR (char, SourceDesc), CopySize); /* Restore the saved fields */ @@ -841,8 +850,7 @@ AcpiUtCopySimpleObject ( /* Copy the actual buffer data */ ACPI_MEMCPY (DestDesc->Buffer.Pointer, - SourceDesc->Buffer.Pointer, - SourceDesc->Buffer.Length); + SourceDesc->Buffer.Pointer, SourceDesc->Buffer.Length); } break; @@ -864,7 +872,7 @@ AcpiUtCopySimpleObject ( /* Copy the actual string data */ ACPI_MEMCPY (DestDesc->String.Pointer, SourceDesc->String.Pointer, - (ACPI_SIZE) SourceDesc->String.Length + 1); + (ACPI_SIZE) SourceDesc->String.Length + 1); } break; diff --git a/utilities/utglobal.c b/utilities/utglobal.c index 986dbeb58d82..34af1f5fc507 100644 --- a/utilities/utglobal.c +++ b/utilities/utglobal.c @@ -625,7 +625,7 @@ AcpiUtGetNodeName ( static const char *AcpiGbl_DescTypeNames[] = { - /* 00 */ "Invalid", + /* 00 */ "Not a Descriptor", /* 01 */ "Cached", /* 02 */ "State-Generic", /* 03 */ "State-Update", @@ -656,7 +656,7 @@ AcpiUtGetDescriptorName ( if (ACPI_GET_DESCRIPTOR_TYPE (Object) > ACPI_DESC_TYPE_MAX) { - return (ACPI_CAST_PTR (char, AcpiGbl_BadType)); + return ("Not a Descriptor"); } return (ACPI_CAST_PTR (char, 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)); } |