Blame SOURCES/0004-Re-enable-support-for-big-endian-machines.patch

214d7a
From 16734feab4204d6930c1ede62e527920607daace Mon Sep 17 00:00:00 2001
214d7a
From: Al Stone <ahs3@redhat.com>
214d7a
Date: Wed, 16 Sep 2020 16:27:06 -0600
214d7a
Subject: [PATCH 04/45] Re-enable support for big-endian machines
214d7a
214d7a
First, disable the big-endian check and fail.  Then, make sure the
214d7a
namespace gets initialized properly (NB: needed even if we are only
214d7a
compiling/disassembling data tables).
214d7a
214d7a
Signed-off-by: Al Stone <ahs3@redhat.com>
214d7a
---
214d7a
 source/compiler/aslmain.c             | 12 ------------
214d7a
 source/components/namespace/nsutils.c |  7 +++++--
214d7a
 2 files changed, 5 insertions(+), 14 deletions(-)
214d7a
214d7a
Index: acpica-unix2-20210604/source/compiler/aslmain.c
214d7a
===================================================================
214d7a
--- acpica-unix2-20210604.orig/source/compiler/aslmain.c
214d7a
+++ acpica-unix2-20210604/source/compiler/aslmain.c
214d7a
@@ -101,18 +101,6 @@ main (
214d7a
 
214d7a
     signal (SIGINT, AslSignalHandler);
214d7a
 
214d7a
-    /*
214d7a
-     * Big-endian machines are not currently supported. ACPI tables must
214d7a
-     * be little-endian, and support for big-endian machines needs to
214d7a
-     * be implemented.
214d7a
-     */
214d7a
-    if (UtIsBigEndianMachine ())
214d7a
-    {
214d7a
-        fprintf (stderr,
214d7a
-            "iASL is not currently supported on big-endian machines.\n");
214d7a
-        return (-1);
214d7a
-    }
214d7a
-
214d7a
     AcpiOsInitialize ();
214d7a
     ACPI_DEBUG_INITIALIZE (); /* For debug version only */
214d7a
 
214d7a
Index: acpica-unix2-20210604/source/components/namespace/nsutils.c
214d7a
===================================================================
214d7a
--- acpica-unix2-20210604.orig/source/components/namespace/nsutils.c
214d7a
+++ acpica-unix2-20210604/source/components/namespace/nsutils.c
214d7a
@@ -272,6 +272,7 @@ AcpiNsBuildInternalName (
214d7a
     const char              *ExternalName = Info->NextExternalChar;
214d7a
     char                    *Result = NULL;
214d7a
     UINT32                  i;
214d7a
+    char                    TmpSeg[ACPI_NAMESEG_SIZE+1];
214d7a
 
214d7a
 
214d7a
     ACPI_FUNCTION_TRACE (NsBuildInternalName);
214d7a
@@ -335,6 +336,7 @@ AcpiNsBuildInternalName (
214d7a
 
214d7a
     for (; NumSegments; NumSegments--)
214d7a
     {
214d7a
+        memset (TmpSeg, 0, ACPI_NAMESEG_SIZE+1);
214d7a
         for (i = 0; i < ACPI_NAMESEG_SIZE; i++)
214d7a
         {
214d7a
             if (ACPI_IS_PATH_SEPARATOR (*ExternalName) ||
214d7a
@@ -342,16 +344,17 @@ AcpiNsBuildInternalName (
214d7a
             {
214d7a
                 /* Pad the segment with underscore(s) if segment is short */
214d7a
 
214d7a
-                Result[i] = '_';
214d7a
+                TmpSeg[i] = '_';
214d7a
             }
214d7a
             else
214d7a
             {
214d7a
                 /* Convert the character to uppercase and save it */
214d7a
 
214d7a
-                Result[i] = (char) toupper ((int) *ExternalName);
214d7a
+                TmpSeg[i] = (char) toupper ((int) *ExternalName);
214d7a
                 ExternalName++;
214d7a
             }
214d7a
         }
214d7a
+    AcpiUtWriteUint (Result, ACPI_NAMESEG_SIZE, TmpSeg, ACPI_NAMESEG_SIZE);
214d7a
 
214d7a
         /* Now we must have a path separator, or the pathname is bad */
214d7a