From e599b42ef5047e5546af949d87d2cfd2e17062b0 Mon Sep 17 00:00:00 2001 From: Jung-uk Kim Date: Fri, 27 Jun 2014 19:10:35 +0000 Subject: Import ACPICA 20140627. --- source/components/disassembler/dmbuffer.c | 72 +++++++++++++++++++++++-------- 1 file changed, 53 insertions(+), 19 deletions(-) (limited to 'source/components/disassembler/dmbuffer.c') diff --git a/source/components/disassembler/dmbuffer.c b/source/components/disassembler/dmbuffer.c index 85f0618bbdf16..739fb44a18906 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"); } } -- cgit v1.2.3