summaryrefslogtreecommitdiffstats
path: root/source/components/disassembler
diff options
context:
space:
mode:
authorjkim <jkim@FreeBSD.org>2014-06-27 19:10:35 +0000
committerjkim <jkim@FreeBSD.org>2014-06-27 19:10:35 +0000
commitb4cfb84e01b0a37b535b69118259bb16e9614b0f (patch)
treeeeef1a6644e518893667349342fa66f9f0249fec /source/components/disassembler
parent34dc9d28dcb64ffb397ae86712fcea0cce546203 (diff)
downloadFreeBSD-src-b4cfb84e01b0a37b535b69118259bb16e9614b0f.zip
FreeBSD-src-b4cfb84e01b0a37b535b69118259bb16e9614b0f.tar.gz
Import ACPICA 20140627.
Diffstat (limited to 'source/components/disassembler')
-rw-r--r--source/components/disassembler/dmbuffer.c72
-rw-r--r--source/components/disassembler/dmwalk.c28
2 files changed, 70 insertions, 30 deletions
diff --git a/source/components/disassembler/dmbuffer.c b/source/components/disassembler/dmbuffer.c
index 85f0618..739fb44 100644
--- a/source/components/disassembler/dmbuffer.c
+++ b/source/components/disassembler/dmbuffer.c
@@ -71,6 +71,8 @@ AcpiDmPldBuffer (
UINT8 *ByteData,
UINT32 ByteCount);
+#define ACPI_BUFFER_BYTES_PER_LINE 8
+
/*******************************************************************************
*
@@ -94,6 +96,9 @@ AcpiDmDisasmByteList (
UINT32 ByteCount)
{
UINT32 i;
+ UINT32 j;
+ UINT32 CurrentIndex;
+ UINT8 BufChar;
if (!ByteCount)
@@ -101,39 +106,68 @@ AcpiDmDisasmByteList (
return;
}
- /* Dump the byte list */
-
- for (i = 0; i < ByteCount; i++)
+ for (i = 0; i < ByteCount; i += ACPI_BUFFER_BYTES_PER_LINE)
{
- /* New line every 8 bytes */
+ /* Line indent and offset prefix for each new line */
+
+ AcpiDmIndent (Level);
+ if (ByteCount > ACPI_BUFFER_BYTES_PER_LINE)
+ {
+ AcpiOsPrintf ("/* %04X */ ", i);
+ }
+
+ /* Dump the actual hex values */
- if (((i % 8) == 0) && (i < ByteCount))
+ for (j = 0; j < ACPI_BUFFER_BYTES_PER_LINE; j++)
{
- if (i > 0)
+ CurrentIndex = i + j;
+ if (CurrentIndex >= ByteCount)
{
- AcpiOsPrintf ("\n");
+ /* Dump fill spaces */
+
+ AcpiOsPrintf (" ");
+ continue;
}
- AcpiDmIndent (Level);
- if (ByteCount > 8)
+ AcpiOsPrintf (" 0x%2.2X", ByteData[CurrentIndex]);
+
+ /* Add comma if there are more bytes to display */
+
+ if (CurrentIndex < (ByteCount - 1))
{
- AcpiOsPrintf ("/* %04X */ ", i);
+ AcpiOsPrintf (",");
+ }
+ else
+ {
+ AcpiOsPrintf (" ");
}
}
- AcpiOsPrintf (" 0x%2.2X", (UINT32) ByteData[i]);
-
- /* Add comma if there are more bytes to display */
+ /* Dump the ASCII equivalents within a comment */
- if (i < (ByteCount -1))
+ AcpiOsPrintf (" /* ");
+ for (j = 0; j < ACPI_BUFFER_BYTES_PER_LINE; j++)
{
- AcpiOsPrintf (",");
+ CurrentIndex = i + j;
+ if (CurrentIndex >= ByteCount)
+ {
+ break;
+ }
+
+ BufChar = ByteData[CurrentIndex];
+ if (ACPI_IS_PRINT (BufChar))
+ {
+ AcpiOsPrintf ("%c", BufChar);
+ }
+ else
+ {
+ AcpiOsPrintf (".");
+ }
}
- }
- if (Level)
- {
- AcpiOsPrintf ("\n");
+ /* Finished with this line */
+
+ AcpiOsPrintf (" */\n");
}
}
diff --git a/source/components/disassembler/dmwalk.c b/source/components/disassembler/dmwalk.c
index 3cf74b3..0aa3052 100644
--- a/source/components/disassembler/dmwalk.c
+++ b/source/components/disassembler/dmwalk.c
@@ -958,6 +958,13 @@ AcpiDmAscendingOp (
}
/*
+ * The parent Op is guaranteed to be valid because of the flag
+ * ACPI_PARSEOP_PARAMLIST -- which means that this op is part of
+ * a parameter list and thus has a valid parent.
+ */
+ ParentOp = Op->Common.Parent;
+
+ /*
* Just completed a parameter node for something like "Buffer (param)".
* Close the paren and open up the term list block with a brace
*/
@@ -965,25 +972,24 @@ AcpiDmAscendingOp (
{
AcpiOsPrintf (")");
- /* Emit description comment for Name() with a predefined ACPI name */
-
- ParentOp = Op->Common.Parent;
- if (ParentOp)
+ /*
+ * Emit a description comment for a Name() operator that is a
+ * predefined ACPI name. Must check the grandparent.
+ */
+ ParentOp = ParentOp->Common.Parent;
+ if (ParentOp &&
+ (ParentOp->Asl.AmlOpcode == AML_NAME_OP))
{
- ParentOp = ParentOp->Common.Parent;
- if (ParentOp && ParentOp->Asl.AmlOpcode == AML_NAME_OP)
- {
- AcpiDmPredefinedDescription (ParentOp);
- }
+ AcpiDmPredefinedDescription (ParentOp);
}
+
AcpiOsPrintf ("\n");
AcpiDmIndent (Level - 1);
AcpiOsPrintf ("{\n");
}
else
{
- Op->Common.Parent->Common.DisasmFlags |=
- ACPI_PARSEOP_EMPTY_TERMLIST;
+ ParentOp->Common.DisasmFlags |= ACPI_PARSEOP_EMPTY_TERMLIST;
AcpiOsPrintf (") {");
}
}
OpenPOWER on IntegriCloud