Blame SOURCES/0007-Handle-dumping-Unicode-properly-when-big-endian.patch

214d7a
From 9a4a32c597fcdfa8a3bc33230c40a18e39c3449d Mon Sep 17 00:00:00 2001
214d7a
From: Al Stone <ahs3@redhat.com>
214d7a
Date: Thu, 1 Jul 2021 17:46:19 -0600
214d7a
Subject: [PATCH 07/45] Handle dumping Unicode properly when big-endian
214d7a
214d7a
Signed-off-by: Al Stone <ahs3@redhat.com>
214d7a
---
214d7a
 source/common/dmtbdump.c | 11 ++++++++---
214d7a
 1 file changed, 8 insertions(+), 3 deletions(-)
214d7a
214d7a
Index: acpica-unix2-20210604/source/common/dmtbdump.c
214d7a
===================================================================
214d7a
--- acpica-unix2-20210604.orig/source/common/dmtbdump.c
214d7a
+++ acpica-unix2-20210604/source/common/dmtbdump.c
214d7a
@@ -146,6 +146,8 @@ AcpiDmDumpUnicode (
214d7a
     UINT8                   *Buffer;
214d7a
     UINT32                  Length;
214d7a
     UINT32                  i;
214d7a
+    UINT16		    Tmp16;
214d7a
+    UINT32                  start;
214d7a
 
214d7a
 
214d7a
     Buffer = ((UINT8 *) Table) + BufferOffset;
214d7a
@@ -155,7 +157,8 @@ AcpiDmDumpUnicode (
214d7a
 
214d7a
     for (i = 0; i < Length; i += 2)
214d7a
     {
214d7a
-        if (!isprint (Buffer[i]))
214d7a
+        Tmp16 = AcpiUtReadUint16 (&Buffer[i]);
214d7a
+        if (!isprint (Tmp16))
214d7a
         {
214d7a
             goto DumpRawBuffer;
214d7a
         }
214d7a
@@ -163,7 +166,8 @@ AcpiDmDumpUnicode (
214d7a
 
214d7a
     /* Ensure all high bytes are zero */
214d7a
 
214d7a
-    for (i = 1; i < Length; i += 2)
214d7a
+    start = UtIsBigEndianMachine() ? 0 : 1;
214d7a
+    for (i = start; i < Length; i += 2)
214d7a
     {
214d7a
         if (Buffer[i])
214d7a
         {
214d7a
@@ -176,7 +180,8 @@ AcpiDmDumpUnicode (
214d7a
     AcpiOsPrintf ("\"");
214d7a
     for (i = 0; i < Length; i += 2)
214d7a
     {
214d7a
-        AcpiOsPrintf ("%c", Buffer[i]);
214d7a
+        Tmp16 = AcpiUtReadUint16 (&Buffer[i]);
214d7a
+        AcpiOsPrintf ("%c", Tmp16);
214d7a
     }
214d7a
 
214d7a
     AcpiOsPrintf ("\"\n");