summaryrefslogtreecommitdiff
path: root/source/components/disassembler/dmbuffer.c
diff options
context:
space:
mode:
authorRobert Moore <Robert.Moore@intel.com>2014-11-03 10:27:10 -0800
committerRobert Moore <Robert.Moore@intel.com>2014-11-03 10:27:10 -0800
commit23eab8532929a5d16ce26843eb26610a5e5d7167 (patch)
tree23d1d417a63a30fc6287a7075541074208db5ad2 /source/components/disassembler/dmbuffer.c
parent21e59c41c401b4d55f3ce8f064925addc51fa61b (diff)
downloadacpica-23eab8532929a5d16ce26843eb26610a5e5d7167.tar.gz
Disassembler: Add escape-sequence support for Unicode macro.
When dumping a Unicode string, emit backslash as appropriate for the various symbols, as well as non-printable hex values.
Diffstat (limited to 'source/components/disassembler/dmbuffer.c')
-rw-r--r--source/components/disassembler/dmbuffer.c23
1 files changed, 20 insertions, 3 deletions
diff --git a/source/components/disassembler/dmbuffer.c b/source/components/disassembler/dmbuffer.c
index 6822aaa32..492b1a859 100644
--- a/source/components/disassembler/dmbuffer.c
+++ b/source/components/disassembler/dmbuffer.c
@@ -552,11 +552,11 @@ AcpiDmIsUnicodeBuffer (
return (FALSE);
}
- /* For each word, 1st byte must be ascii, 2nd byte must be zero */
+ /* For each word, 1st byte must be ascii (0-0x7F), 2nd byte must be zero */
for (i = 0; i < (ByteCount - 2); i += 2)
{
- if ((!ACPI_IS_PRINT (ByteData[i])) ||
+ if ((ByteData[i] > 0x7F) ||
(ByteData[(ACPI_SIZE) i + 1] != 0))
{
return (FALSE);
@@ -885,6 +885,7 @@ AcpiDmUnicode (
UINT16 *WordData;
UINT32 WordCount;
UINT32 i;
+ int OutputValue;
/* Extract the buffer info as a WORD buffer */
@@ -897,7 +898,23 @@ AcpiDmUnicode (
AcpiOsPrintf ("\"");
for (i = 0; i < (WordCount - 1); i++)
{
- AcpiOsPrintf ("%c", (int) WordData[i]);
+ OutputValue = (int) WordData[i];
+
+ /* Handle values that must be escaped */
+
+ if ((OutputValue == '\"') ||
+ (OutputValue == '\\'))
+ {
+ AcpiOsPrintf ("\\%c", OutputValue);
+ }
+ else if (!ACPI_IS_PRINT (OutputValue))
+ {
+ AcpiOsPrintf ("\\x%2.2X", OutputValue);
+ }
+ else
+ {
+ AcpiOsPrintf ("%c", OutputValue);
+ }
}
AcpiOsPrintf ("\")");