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

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