summaryrefslogtreecommitdiffstats
path: root/source/components/disassembler/dmbuffer.c
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/dmbuffer.c
parent34dc9d28dcb64ffb397ae86712fcea0cce546203 (diff)
downloadFreeBSD-src-b4cfb84e01b0a37b535b69118259bb16e9614b0f.zip
FreeBSD-src-b4cfb84e01b0a37b535b69118259bb16e9614b0f.tar.gz
Import ACPICA 20140627.
Diffstat (limited to 'source/components/disassembler/dmbuffer.c')
-rw-r--r--source/components/disassembler/dmbuffer.c72
1 files changed, 53 insertions, 19 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");
}
}
OpenPOWER on IntegriCloud