Blob Blame Raw
Fixup the compiler/disassembler to support big-endian.

Signed-off-by: Al Stone <ahs3@redhat.com>

diff -Naur acpica-unix2-20160930/source/common/acfileio.c acpica-unix2-20160930-s390/source/common/acfileio.c
--- acpica-unix2-20160930/source/common/acfileio.c	2016-09-30 10:43:55.000000000 -0600
+++ acpica-unix2-20160930-s390/source/common/acfileio.c	2016-10-28 14:25:41.845397957 -0600
@@ -241,6 +241,7 @@
     ACPI_TABLE_HEADER       *Table;
     INT32                   Count;
     long                    TableOffset;
+    UINT32		    TableLen;
 
 
     *ReturnTable = NULL;
@@ -281,7 +282,8 @@
 
     /* Allocate a buffer for the entire table */
 
-    Table = AcpiOsAllocate ((ACPI_SIZE) TableHeader.Length);
+    ACPI_MOVE_32_TO_32(&TableLen, &TableHeader.Length);
+    Table = AcpiOsAllocate ((ACPI_SIZE) TableLen);
     if (!Table)
     {
         return (AE_NO_MEMORY);
@@ -291,8 +293,8 @@
 
     fseek (File, TableOffset, SEEK_SET);
 
-    Count = fread (Table, 1, TableHeader.Length, File);
-    if (Count != (INT32) TableHeader.Length)
+    Count = fread (Table, 1, TableLen, File);
+    if (Count != (INT32) TableLen)
     {
         Status = AE_ERROR;
         goto ErrorExit;
@@ -300,7 +302,7 @@
 
     /* Validate the checksum (just issue a warning) */
 
-    Status = AcpiTbVerifyChecksum (Table, TableHeader.Length);
+    Status = AcpiTbVerifyChecksum (Table, TableLen);
     if (ACPI_FAILURE (Status))
     {
         Status = AcCheckTextModeCorruption (Table);
@@ -392,6 +394,7 @@
     ACPI_SIZE               Actual;
     long                    OriginalOffset;
     UINT32                  FileSize;
+    UINT32                  TableLength;
     UINT32                  i;
 
 
@@ -423,11 +426,12 @@
     /* Validate table length against bytes remaining in the file */
 
     FileSize = CmGetFileSize (File);
-    if (TableHeader.Length > (UINT32) (FileSize - TableOffset))
+    ACPI_MOVE_32_TO_32(&TableLength, &TableHeader.Length);
+    if (TableLength > (UINT32) (FileSize - TableOffset))
     {
         fprintf (stderr, "Table [%4.4s] is too long for file - "
             "needs: 0x%.2X, remaining in file: 0x%.2X\n",
-            TableHeader.Signature, TableHeader.Length,
+            TableHeader.Signature, TableLength,
             (UINT32) (FileSize - TableOffset));
         return (AE_BAD_HEADER);
     }
diff -Naur acpica-unix2-20160930/source/common/ahpredef.c acpica-unix2-20160930-s390/source/common/ahpredef.c
--- acpica-unix2-20160930/source/common/ahpredef.c	2016-09-30 10:43:56.000000000 -0600
+++ acpica-unix2-20160930-s390/source/common/ahpredef.c	2016-10-28 14:25:41.844397962 -0600
@@ -358,7 +358,7 @@
     char                        *Nameseg)
 {
     const AH_PREDEFINED_NAME    *Info;
-
+  
 
     for (Info = AslPredefinedInfo; Info->Name; Info++)
     {
diff -Naur acpica-unix2-20160930/source/common/dmtable.c acpica-unix2-20160930-s390/source/common/dmtable.c
--- acpica-unix2-20160930/source/common/dmtable.c	2016-09-30 10:43:56.000000000 -0600
+++ acpica-unix2-20160930-s390/source/common/dmtable.c	2016-10-28 14:25:41.840397982 -0600
@@ -499,7 +499,7 @@
      */
     if (ACPI_COMPARE_NAME (Table->Signature, ACPI_SIG_FACS))
     {
-        Length = Table->Length;
+        ACPI_MOVE_32_TO_32(&Length, &Table->Length);
         Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoFacs);
         if (ACPI_FAILURE (Status))
         {
@@ -513,13 +513,14 @@
     else if (ACPI_COMPARE_NAME (Table->Signature, ACPI_SIG_S3PT))
     {
         Length = AcpiDmDumpS3pt (Table);
+        ACPI_MOVE_32_TO_32(&Length, &Table->Length);
     }
     else
     {
         /*
          * All other tables must use the common ACPI table header, dump it now
          */
-        Length = Table->Length;
+        ACPI_MOVE_32_TO_32(&Length, &Table->Length);
         Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoHeader);
         if (ACPI_FAILURE (Status))
         {
@@ -730,6 +731,7 @@
     BOOLEAN                 LastOutputBlankLine = FALSE;
     ACPI_STATUS             Status;
     char                    RepairedName[8];
+    UINT16		    Val16;
 
 
     if (!Info)
@@ -1097,8 +1099,9 @@
             /* Checksum, display and validate */
 
             AcpiOsPrintf ("%2.2X", *Target);
-            Temp8 = AcpiDmGenerateChecksum (Table,
-                ACPI_CAST_PTR (ACPI_TABLE_HEADER, Table)->Length,
+	    ACPI_MOVE_32_TO_32(&Temp32,
+			&ACPI_CAST_PTR (ACPI_TABLE_HEADER, Table)->Length);
+            Temp8 = AcpiDmGenerateChecksum (Table, Temp32,
                 ACPI_CAST_PTR (ACPI_TABLE_HEADER, Table)->Checksum);
 
             if (Temp8 != ACPI_CAST_PTR (ACPI_TABLE_HEADER, Table)->Checksum)
@@ -1163,14 +1166,14 @@
 
             /* DMAR subtable types */
 
-            Temp16 = ACPI_GET16 (Target);
+            Val16 = ACPI_GET16 (Target);
+	    ACPI_MOVE_16_TO_16(&Temp16, &Val16);
             if (Temp16 > ACPI_DMAR_TYPE_RESERVED)
             {
                 Temp16 = ACPI_DMAR_TYPE_RESERVED;
             }
 
-            AcpiOsPrintf (UINT16_FORMAT, ACPI_GET16 (Target),
-                AcpiDmDmarSubnames[Temp16]);
+            AcpiOsPrintf (UINT16_FORMAT, Temp16, AcpiDmDmarSubnames[Temp16]);
             break;
 
         case ACPI_DMT_DMAR_SCOPE:
@@ -1261,14 +1264,14 @@
 
             /* HEST subtable types */
 
-            Temp16 = ACPI_GET16 (Target);
+            Val16 = ACPI_GET16 (Target);
+	    ACPI_MOVE_16_TO_16(&Temp16, &Val16);
             if (Temp16 > ACPI_HEST_TYPE_RESERVED)
             {
                 Temp16 = ACPI_HEST_TYPE_RESERVED;
             }
 
-            AcpiOsPrintf (UINT16_FORMAT, ACPI_GET16 (Target),
-                AcpiDmHestSubnames[Temp16]);
+            AcpiOsPrintf (UINT16_FORMAT, Temp16, AcpiDmHestSubnames[Temp16]);
             break;
 
         case ACPI_DMT_HESTNTFY:
@@ -1334,13 +1337,14 @@
 
             /* NFIT subtable types */
 
-            Temp16 = ACPI_GET16 (Target);
+            Val16 = ACPI_GET16 (Target);
+            ACPI_MOVE_16_TO_16(&Temp16, &Val16);
             if (Temp16 > ACPI_NFIT_TYPE_RESERVED)
             {
                 Temp16 = ACPI_NFIT_TYPE_RESERVED;
             }
 
-            AcpiOsPrintf (UINT16_FORMAT, ACPI_GET16 (Target),
+            AcpiOsPrintf (UINT16_FORMAT, Temp16,
                 AcpiDmNfitSubnames[Temp16]);
             break;
 
diff -Naur acpica-unix2-20160930/source/common/dmtables.c acpica-unix2-20160930-s390/source/common/dmtables.c
--- acpica-unix2-20160930/source/common/dmtables.c	2016-09-30 10:43:56.000000000 -0600
+++ acpica-unix2-20160930-s390/source/common/dmtables.c	2016-10-28 14:25:41.844397962 -0600
@@ -140,7 +140,9 @@
     ACPI_TABLE_HEADER       *Table)
 {
     UINT8                   Checksum;
-
+    UINT32		    TableLen;
+    UINT32		    OemRev;
+    UINT32		    CompilerRev;
 
     /* Reset globals for External statements */
 
@@ -152,9 +154,10 @@
      */
     AdDisassemblerHeader (Filename, ACPI_IS_AML_TABLE);
 
+    ACPI_MOVE_32_TO_32(&TableLen, &Table->Length);
     AcpiOsPrintf (" * Original Table Header:\n");
     AcpiOsPrintf (" *     Signature        \"%4.4s\"\n",    Table->Signature);
-    AcpiOsPrintf (" *     Length           0x%8.8X (%u)\n", Table->Length, Table->Length);
+    AcpiOsPrintf (" *     Length           0x%8.8X (%u)\n", TableLen, TableLen);
 
     /* Print and validate the revision */
 
@@ -186,7 +189,7 @@
 
     AcpiOsPrintf ("\n *     Checksum         0x%2.2X",        Table->Checksum);
 
-    Checksum = AcpiTbChecksum (ACPI_CAST_PTR (UINT8, Table), Table->Length);
+    Checksum = AcpiTbChecksum (ACPI_CAST_PTR (UINT8, Table), TableLen);
     if (Checksum)
     {
         AcpiOsPrintf (" **** Incorrect checksum, should be 0x%2.2X",
@@ -196,9 +199,11 @@
     AcpiOsPrintf ("\n");
     AcpiOsPrintf (" *     OEM ID           \"%.6s\"\n",     Table->OemId);
     AcpiOsPrintf (" *     OEM Table ID     \"%.8s\"\n",     Table->OemTableId);
-    AcpiOsPrintf (" *     OEM Revision     0x%8.8X (%u)\n", Table->OemRevision, Table->OemRevision);
+    ACPI_MOVE_32_TO_32(&OemRev, &Table->OemRevision);
+    AcpiOsPrintf (" *     OEM Revision     0x%8.8X (%u)\n", OemRev, OemRev);
     AcpiOsPrintf (" *     Compiler ID      \"%.4s\"\n",     Table->AslCompilerId);
-    AcpiOsPrintf (" *     Compiler Version 0x%8.8X (%u)\n", Table->AslCompilerRevision, Table->AslCompilerRevision);
+    ACPI_MOVE_32_TO_32(&CompilerRev, &Table->AslCompilerRevision);
+    AcpiOsPrintf (" *     Compiler Version 0x%8.8X (%u)\n", CompilerRev, CompilerRev);
     AcpiOsPrintf (" */\n");
 
     /*
@@ -211,7 +216,7 @@
     AcpiOsPrintf (
         "DefinitionBlock (\"\", \"%4.4s\", %hu, \"%.6s\", \"%.8s\", 0x%8.8X)\n",
         Table->Signature, Table->Revision,
-        Table->OemId, Table->OemTableId, Table->OemRevision);
+        Table->OemId, Table->OemTableId, OemRev);
 }
 
 
@@ -386,7 +391,8 @@
 
     fprintf (stderr, "Pass 1 parse of [%4.4s]\n", (char *) Table->Signature);
 
-    AmlLength = Table->Length - sizeof (ACPI_TABLE_HEADER);
+    ACPI_MOVE_32_TO_32(&AmlLength, &Table->Length);
+    AmlLength -= sizeof (ACPI_TABLE_HEADER);
     AmlStart = ((UINT8 *) Table + sizeof (ACPI_TABLE_HEADER));
 
     /* Create the root object */
diff -Naur acpica-unix2-20160930/source/common/dmtbdump.c acpica-unix2-20160930-s390/source/common/dmtbdump.c
--- acpica-unix2-20160930/source/common/dmtbdump.c	2016-09-30 10:43:56.000000000 -0600
+++ acpica-unix2-20160930-s390/source/common/dmtbdump.c	2016-10-28 14:25:41.841397977 -0600
@@ -296,6 +296,8 @@
     UINT32                  Entries;
     UINT32                  Offset;
     UINT32                  i;
+    UINT32		    Length;
+    UINT32		    Address;
 
 
     /* Point to start of table pointer array */
@@ -305,12 +307,14 @@
 
     /* RSDT uses 32-bit pointers */
 
-    Entries = (Table->Length - sizeof (ACPI_TABLE_HEADER)) / sizeof (UINT32);
+    ACPI_MOVE_32_TO_32(&Length, &Table->Length);
+    Entries = (Length - sizeof (ACPI_TABLE_HEADER)) / sizeof (UINT32);
 
     for (i = 0; i < Entries; i++)
     {
         AcpiDmLineHeader2 (Offset, sizeof (UINT32), "ACPI Table Address", i);
-        AcpiOsPrintf ("%8.8X\n", Array[i]);
+	ACPI_MOVE_32_TO_32(&Address, &Array[i]);
+        AcpiOsPrintf ("%8.8X\n", Address);
         Offset += sizeof (UINT32);
     }
 }
@@ -336,6 +340,8 @@
     UINT32                  Entries;
     UINT32                  Offset;
     UINT32                  i;
+    UINT32                  Length;
+    UINT64		    Address;
 
 
     /* Point to start of table pointer array */
@@ -345,12 +351,14 @@
 
     /* XSDT uses 64-bit pointers */
 
-    Entries = (Table->Length - sizeof (ACPI_TABLE_HEADER)) / sizeof (UINT64);
+    ACPI_MOVE_32_TO_32(&Length, &Table->Length);
+    Entries = (Length - sizeof (ACPI_TABLE_HEADER)) / sizeof (UINT64);
 
     for (i = 0; i < Entries; i++)
     {
         AcpiDmLineHeader2 (Offset, sizeof (UINT64), "ACPI Table Address", i);
-        AcpiOsPrintf ("%8.8X%8.8X\n", ACPI_FORMAT_UINT64 (Array[i]));
+	ACPI_MOVE_64_TO_64(&Address, &Array[i]);
+        AcpiOsPrintf ("%8.8X%8.8X\n", ACPI_FORMAT_UINT64 (Address));
         Offset += sizeof (UINT64);
     }
 }
@@ -384,6 +392,7 @@
     ACPI_STATUS             Status;
     UINT8                   FadtRevision;
     UINT32                  ExpectedLength;
+    UINT32                  ActualLength;
     UINT32                  i;
 
 
@@ -400,6 +409,7 @@
         return;
     }
 
+    ACPI_MOVE_32_TO_32(&ActualLength, &Table->Length);
     if (FadtRevision > ACPI_FADT_MAX_VERSION)
     {
         AcpiOsPrintf ("// ACPI Warning: Revision %u is not fully supported, "
@@ -409,12 +419,12 @@
     else
     {
         ExpectedLength = FadtRevisionLength[FadtRevision];
-        if (Table->Length != ExpectedLength)
+        if (ActualLength != ExpectedLength)
         {
             AcpiOsPrintf (
                 "// ACPI Warning: Input FADT revision %X does not match "
                 "expected length: found 0x%X expected 0x%X\n",
-                FadtRevision, Table->Length, ExpectedLength);
+                FadtRevision, ActualLength, ExpectedLength);
         }
     }
 
@@ -432,14 +442,14 @@
 
         /* Dump the fields specific to FADT revision[i] */
 
-        Status = AcpiDmDumpTable (Table->Length, 0, Table, 0,
+        Status = AcpiDmDumpTable (ActualLength, 0, Table, 0,
             FadtRevisionInfo[i]);
         if (ACPI_FAILURE (Status))
         {
             return;
         }
 
-        if (Table->Length <= FadtRevisionLength[i])
+        if (ActualLength <= FadtRevisionLength[i])
         {
             break;  /* End of table */
         }
@@ -447,7 +457,7 @@
 
     /* Build a local FADT to test some FADT values */
 
-    AcpiTbCreateLocalFadt (Table, Table->Length);
+    AcpiTbCreateLocalFadt (Table, ActualLength);
 }
 
 
@@ -478,17 +488,21 @@
     UINT32                  DataOffset = 0;
     UINT32                  i;
     UINT8                   Type;
+    UINT32		    Len;
+    UINT16		    SubLen;
 
 
     /* No main table, only subtables */
 
+    ACPI_MOVE_32_TO_32(&Len, &Table->Length);
     SubTable = ACPI_ADD_PTR (ACPI_ASF_INFO, Table, Offset);
-    while (Offset < Table->Length)
+    while (Offset < Len)
     {
         /* Common subtable header */
 
-        Status = AcpiDmDumpTable (Table->Length, Offset, SubTable,
-            SubTable->Header.Length, AcpiDmTableInfoAsfHdr);
+	ACPI_MOVE_16_TO_16(&SubLen, &SubTable->Header.Length);
+        Status = AcpiDmDumpTable (Len, Offset, SubTable,
+            SubLen, AcpiDmTableInfoAsfHdr);
         if (ACPI_FAILURE (Status))
         {
             return;
@@ -545,8 +559,7 @@
             return;
         }
 
-        Status = AcpiDmDumpTable (Table->Length, Offset, SubTable,
-            SubTable->Header.Length, InfoTable);
+        Status = AcpiDmDumpTable (Len, Offset, SubTable, SubLen, InfoTable);
         if (ACPI_FAILURE (Status))
         {
             return;
@@ -562,7 +575,7 @@
             for (i = 0; i < DataCount; i++)
             {
                 AcpiOsPrintf ("\n");
-                Status = AcpiDmDumpTable (Table->Length, DataOffset,
+                Status = AcpiDmDumpTable (Len, DataOffset,
                     DataTable, DataLength, DataInfoTable);
                 if (ACPI_FAILURE (Status))
                 {
@@ -608,15 +621,14 @@
 
         /* Point to next subtable */
 
-        if (!SubTable->Header.Length)
+        if (!SubLen)
         {
             AcpiOsPrintf ("Invalid zero subtable header length\n");
             return;
         }
 
-        Offset += SubTable->Header.Length;
-        SubTable = ACPI_ADD_PTR (ACPI_ASF_INFO, SubTable,
-            SubTable->Header.Length);
+        Offset += SubLen;
+        SubTable = ACPI_ADD_PTR (ACPI_ASF_INFO, SubTable, SubLen);
     }
 }
 
@@ -640,12 +652,13 @@
 {
     ACPI_STATUS             Status;
     ACPI_CPEP_POLLING       *SubTable;
-    UINT32                  Length = Table->Length;
+    UINT32                  Length;
     UINT32                  Offset = sizeof (ACPI_TABLE_CPEP);
 
 
     /* Main table */
 
+    ACPI_MOVE_32_TO_32(&Length, &Table->Length);
     Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoCpep);
     if (ACPI_FAILURE (Status))
     {
@@ -655,7 +668,7 @@
     /* Subtables */
 
     SubTable = ACPI_ADD_PTR (ACPI_CPEP_POLLING, Table, Offset);
-    while (Offset < Table->Length)
+    while (Offset < Length)
     {
         AcpiOsPrintf ("\n");
         Status = AcpiDmDumpTable (Length, Offset, SubTable,
@@ -695,7 +708,10 @@
     ACPI_CSRT_GROUP         *SubTable;
     ACPI_CSRT_SHARED_INFO   *SharedInfoTable;
     ACPI_CSRT_DESCRIPTOR    *SubSubTable;
-    UINT32                  Length = Table->Length;
+    UINT32                  Length;
+    UINT32                  SubLength;
+    UINT32                  SubSubLength;
+    UINT32                  SharedInfoLength;
     UINT32                  Offset = sizeof (ACPI_TABLE_CSRT);
     UINT32                  SubOffset;
     UINT32                  SubSubOffset;
@@ -706,14 +722,16 @@
 
     /* Subtables (Resource Groups) */
 
+    ACPI_MOVE_32_TO_32(&Length, &Table->Length);
     SubTable = ACPI_ADD_PTR (ACPI_CSRT_GROUP, Table, Offset);
-    while (Offset < Table->Length)
+    while (Offset < Length)
     {
         /* Resource group subtable */
 
         AcpiOsPrintf ("\n");
+        ACPI_MOVE_32_TO_32(&SubLength, &SubTable->Length);
         Status = AcpiDmDumpTable (Length, Offset, SubTable,
-            SubTable->Length, AcpiDmTableInfoCsrt0);
+            SubLength, AcpiDmTableInfoCsrt0);
         if (ACPI_FAILURE (Status))
         {
             return;
@@ -733,19 +751,20 @@
             return;
         }
 
-        SubOffset += SubTable->SharedInfoLength;
+	ACPI_MOVE_32_TO_32(&SharedInfoLength, &SubTable->SharedInfoLength);
+        SubOffset += SharedInfoLength;
 
         /* Sub-Subtables (Resource Descriptors) */
 
         SubSubTable = ACPI_ADD_PTR (ACPI_CSRT_DESCRIPTOR, Table,
             Offset + SubOffset);
 
-        while ((SubOffset < SubTable->Length) &&
-              ((Offset + SubOffset) < Table->Length))
+        while ((SubOffset < SubLength) && ((Offset + SubOffset) < Length))
         {
             AcpiOsPrintf ("\n");
+	    ACPI_MOVE_32_TO_32(&SubSubLength, &SubSubTable->Length);
             Status = AcpiDmDumpTable (Length, Offset + SubOffset, SubSubTable,
-                SubSubTable->Length, AcpiDmTableInfoCsrt2);
+                SubSubLength, AcpiDmTableInfoCsrt2);
             if (ACPI_FAILURE (Status))
             {
                 return;
@@ -755,7 +774,7 @@
 
             /* Resource-specific info buffer */
 
-            InfoLength = SubSubTable->Length - SubSubOffset;
+            InfoLength = SubSubLength - SubSubOffset;
             if (InfoLength)
             {
                 Status = AcpiDmDumpTable (Length,
@@ -770,16 +789,15 @@
 
             /* Point to next sub-subtable */
 
-            SubOffset += SubSubTable->Length;
+            SubOffset += SubSubLength;
             SubSubTable = ACPI_ADD_PTR (ACPI_CSRT_DESCRIPTOR, SubSubTable,
-                SubSubTable->Length);
+                SubSubLength);
         }
 
         /* Point to next subtable */
 
-        Offset += SubTable->Length;
-        SubTable = ACPI_ADD_PTR (ACPI_CSRT_GROUP, SubTable,
-            SubTable->Length);
+        Offset += SubLength;
+        SubTable = ACPI_ADD_PTR (ACPI_CSRT_GROUP, SubTable, SubLength);
     }
 }
 
@@ -803,16 +821,20 @@
 {
     ACPI_STATUS             Status;
     ACPI_DBG2_DEVICE        *SubTable;
-    UINT32                  Length = Table->Length;
+    UINT32                  Length;
+    UINT16                  SubLength;
     UINT32                  Offset = sizeof (ACPI_TABLE_DBG2);
     UINT32                  i;
     UINT32                  ArrayOffset;
     UINT32                  AbsoluteOffset;
     UINT8                   *Array;
+    UINT16		    Tmp16;
+    UINT16		    AlsoTmp16;
 
 
     /* Main table */
 
+    ACPI_MOVE_32_TO_32(&Length, &Table->Length);
     Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoDbg2);
     if (ACPI_FAILURE (Status))
     {
@@ -822,11 +844,12 @@
     /* Subtables */
 
     SubTable = ACPI_ADD_PTR (ACPI_DBG2_DEVICE, Table, Offset);
-    while (Offset < Table->Length)
+    while (Offset < Length)
     {
         AcpiOsPrintf ("\n");
+        ACPI_MOVE_16_TO_16(&SubLength, &SubTable->Length);
         Status = AcpiDmDumpTable (Length, Offset, SubTable,
-            SubTable->Length, AcpiDmTableInfoDbg2Device);
+            SubLength, AcpiDmTableInfoDbg2Device);
         if (ACPI_FAILURE (Status))
         {
             return;
@@ -836,13 +859,13 @@
 
         for (i = 0; i < SubTable->RegisterCount; i++)
         {
-            ArrayOffset = SubTable->BaseAddressOffset +
-                (sizeof (ACPI_GENERIC_ADDRESS) * i);
+	    ACPI_MOVE_16_TO_16(&Tmp16, &SubTable->BaseAddressOffset);
+            ArrayOffset = Tmp16 + (sizeof (ACPI_GENERIC_ADDRESS) * i);
             AbsoluteOffset = Offset + ArrayOffset;
             Array = (UINT8 *) SubTable + ArrayOffset;
 
             Status = AcpiDmDumpTable (Length, AbsoluteOffset, Array,
-                SubTable->Length, AcpiDmTableInfoDbg2Addr);
+                SubLength, AcpiDmTableInfoDbg2Addr);
             if (ACPI_FAILURE (Status))
             {
                 return;
@@ -853,13 +876,13 @@
 
         for (i = 0; i < SubTable->RegisterCount; i++)
         {
-            ArrayOffset = SubTable->AddressSizeOffset +
-                (sizeof (UINT32) * i);
+	    ACPI_MOVE_16_TO_16(&Tmp16, &SubTable->AddressSizeOffset);
+            ArrayOffset = Tmp16 + (sizeof (UINT32) * i);
             AbsoluteOffset = Offset + ArrayOffset;
             Array = (UINT8 *) SubTable + ArrayOffset;
 
             Status = AcpiDmDumpTable (Length, AbsoluteOffset, Array,
-                SubTable->Length, AcpiDmTableInfoDbg2Size);
+                SubLength, AcpiDmTableInfoDbg2Size);
             if (ACPI_FAILURE (Status))
             {
                 return;
@@ -869,12 +892,13 @@
         /* Dump the Namestring (required) */
 
         AcpiOsPrintf ("\n");
-        ArrayOffset = SubTable->NamepathOffset;
+	ACPI_MOVE_16_TO_16(&Tmp16, &SubTable->NamepathOffset);
+        ArrayOffset = Tmp16;
         AbsoluteOffset = Offset + ArrayOffset;
         Array = (UINT8 *) SubTable + ArrayOffset;
 
         Status = AcpiDmDumpTable (Length, AbsoluteOffset, Array,
-            SubTable->Length, AcpiDmTableInfoDbg2Name);
+            SubLength, AcpiDmTableInfoDbg2Name);
         if (ACPI_FAILURE (Status))
         {
             return;
@@ -884,9 +908,10 @@
 
         if (SubTable->OemDataOffset)
         {
-            Status = AcpiDmDumpTable (Length, Offset + SubTable->OemDataOffset,
-                Table, SubTable->OemDataLength,
-                AcpiDmTableInfoDbg2OemData);
+	    ACPI_MOVE_16_TO_16(&Tmp16, &SubTable->OemDataOffset);
+	    ACPI_MOVE_16_TO_16(&AlsoTmp16, &SubTable->OemDataLength);
+            Status = AcpiDmDumpTable (Length, Offset + Tmp16,
+                Table, AlsoTmp16, AcpiDmTableInfoDbg2OemData);
             if (ACPI_FAILURE (Status))
             {
                 return;
@@ -895,9 +920,9 @@
 
         /* Point to next subtable */
 
-        Offset += SubTable->Length;
+        Offset += SubLength;
         SubTable = ACPI_ADD_PTR (ACPI_DBG2_DEVICE, SubTable,
-            SubTable->Length);
+            SubLength);
     }
 }
 
@@ -921,17 +946,20 @@
 {
     ACPI_STATUS             Status;
     ACPI_DMAR_HEADER        *SubTable;
-    UINT32                  Length = Table->Length;
+    UINT32                  Length;
+    UINT16                  SubLength;
     UINT32                  Offset = sizeof (ACPI_TABLE_DMAR);
     ACPI_DMTABLE_INFO       *InfoTable;
     ACPI_DMAR_DEVICE_SCOPE  *ScopeTable;
     UINT32                  ScopeOffset;
     UINT8                   *PciPath;
     UINT32                  PathOffset;
+    UINT16		    SubType;
 
 
     /* Main table */
 
+    ACPI_MOVE_32_TO_32(&Length, &Table->Length);
     Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoDmar);
     if (ACPI_FAILURE (Status))
     {
@@ -941,13 +969,14 @@
     /* Subtables */
 
     SubTable = ACPI_ADD_PTR (ACPI_DMAR_HEADER, Table, Offset);
-    while (Offset < Table->Length)
+    while (Offset < Length)
     {
         /* Common subtable header */
 
         AcpiOsPrintf ("\n");
+	ACPI_MOVE_16_TO_16(&SubLength, &SubTable->Length);
         Status = AcpiDmDumpTable (Length, Offset, SubTable,
-            SubTable->Length, AcpiDmTableInfoDmarHdr);
+            SubLength, AcpiDmTableInfoDmarHdr);
         if (ACPI_FAILURE (Status))
         {
             return;
@@ -955,7 +984,8 @@
 
         AcpiOsPrintf ("\n");
 
-        switch (SubTable->Type)
+	ACPI_MOVE_16_TO_16(&SubType, &SubTable->Type);
+        switch (SubType)
         {
         case ACPI_DMAR_TYPE_HARDWARE_UNIT:
 
@@ -990,12 +1020,12 @@
         default:
 
             AcpiOsPrintf ("\n**** Unknown DMAR subtable type 0x%X\n\n",
-                SubTable->Type);
+                SubType);
             return;
         }
 
         Status = AcpiDmDumpTable (Length, Offset, SubTable,
-            SubTable->Length, InfoTable);
+            SubLength, InfoTable);
         if (ACPI_FAILURE (Status))
         {
             return;
@@ -1004,8 +1034,8 @@
         /*
          * Dump the optional device scope entries
          */
-        if ((SubTable->Type == ACPI_DMAR_TYPE_HARDWARE_AFFINITY) ||
-            (SubTable->Type == ACPI_DMAR_TYPE_NAMESPACE))
+        if ((SubType == ACPI_DMAR_TYPE_HARDWARE_AFFINITY) ||
+            (SubType == ACPI_DMAR_TYPE_NAMESPACE))
         {
             /* These types do not support device scopes */
 
@@ -1013,7 +1043,7 @@
         }
 
         ScopeTable = ACPI_ADD_PTR (ACPI_DMAR_DEVICE_SCOPE, SubTable, ScopeOffset);
-        while (ScopeOffset < SubTable->Length)
+        while (ScopeOffset < SubLength)
         {
             AcpiOsPrintf ("\n");
             Status = AcpiDmDumpTable (Length, Offset + ScopeOffset, ScopeTable,
@@ -1054,9 +1084,8 @@
 NextSubtable:
         /* Point to next subtable */
 
-        Offset += SubTable->Length;
-        SubTable = ACPI_ADD_PTR (ACPI_DMAR_HEADER, SubTable,
-            SubTable->Length);
+        Offset += SubLength;
+        SubTable = ACPI_ADD_PTR (ACPI_DMAR_HEADER, SubTable, SubLength);
     }
 }
 
@@ -1083,12 +1112,15 @@
     ACPI_DRTM_RESOURCE_LIST *DrtmRl;
     ACPI_DRTM_DPS_ID        *DrtmDps;
     UINT32                  Count;
+    UINT32                  ValidatedCount;
+    UINT32                  ResourceCount;
+    UINT32		    Length;
 
 
     /* Main table */
 
-    Status = AcpiDmDumpTable (Table->Length, 0, Table, 0,
-        AcpiDmTableInfoDrtm);
+    ACPI_MOVE_32_TO_32(&Length, &Table->Length);
+    Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoDrtm);
     if (ACPI_FAILURE (Status))
     {
         return;
@@ -1102,7 +1134,7 @@
 
     DrtmVtl = ACPI_ADD_PTR (ACPI_DRTM_VTABLE_LIST, Table, Offset);
     AcpiOsPrintf ("\n");
-    Status = AcpiDmDumpTable (Table->Length, Offset,
+    Status = AcpiDmDumpTable (Length, Offset,
         DrtmVtl, ACPI_OFFSET (ACPI_DRTM_VTABLE_LIST, ValidatedTables),
         AcpiDmTableInfoDrtm0);
     if (ACPI_FAILURE (Status))
@@ -1115,10 +1147,11 @@
     /* Dump Validated table addresses */
 
     Count = 0;
-    while ((Offset < Table->Length) &&
-            (DrtmVtl->ValidatedTableCount > Count))
+    ACPI_MOVE_32_TO_32(&ValidatedCount, &DrtmVtl->ValidatedTableCount);
+    while ((Offset < Length) &&
+            (ValidatedCount > Count))
     {
-        Status = AcpiDmDumpTable (Table->Length, Offset,
+        Status = AcpiDmDumpTable (Length, Offset,
             ACPI_ADD_PTR (void, Table, Offset), sizeof (UINT64),
             AcpiDmTableInfoDrtm0a);
         if (ACPI_FAILURE (Status))
@@ -1134,7 +1167,7 @@
 
     DrtmRl = ACPI_ADD_PTR (ACPI_DRTM_RESOURCE_LIST, Table, Offset);
     AcpiOsPrintf ("\n");
-    Status = AcpiDmDumpTable (Table->Length, Offset,
+    Status = AcpiDmDumpTable (Length, Offset,
         DrtmRl, ACPI_OFFSET (ACPI_DRTM_RESOURCE_LIST, Resources),
         AcpiDmTableInfoDrtm1);
     if (ACPI_FAILURE (Status))
@@ -1147,10 +1180,11 @@
     /* Dump the Resource List */
 
     Count = 0;
-    while ((Offset < Table->Length) &&
-           (DrtmRl->ResourceCount > Count))
+    ACPI_MOVE_32_TO_32(&ResourceCount, &DrtmRl->ResourceCount);
+    while ((Offset < Length) &&
+           (ResourceCount > Count))
     {
-        Status = AcpiDmDumpTable (Table->Length, Offset,
+        Status = AcpiDmDumpTable (Length, Offset,
             ACPI_ADD_PTR (void, Table, Offset),
             sizeof (ACPI_DRTM_RESOURCE), AcpiDmTableInfoDrtm1a);
         if (ACPI_FAILURE (Status))
@@ -1166,7 +1200,7 @@
 
     DrtmDps = ACPI_ADD_PTR (ACPI_DRTM_DPS_ID, Table, Offset);
     AcpiOsPrintf ("\n");
-    (void) AcpiDmDumpTable (Table->Length, Offset,
+    (void) AcpiDmDumpTable (Length, Offset,
         DrtmDps, sizeof (ACPI_DRTM_DPS_ID), AcpiDmTableInfoDrtm2);
 }
 
@@ -1190,12 +1224,13 @@
 {
     ACPI_STATUS             Status;
     ACPI_WHEA_HEADER        *SubTable;
-    UINT32                  Length = Table->Length;
+    UINT32                  Length;
     UINT32                  Offset = sizeof (ACPI_TABLE_EINJ);
 
 
     /* Main table */
 
+    ACPI_MOVE_32_TO_32(&Length, &Table->Length);
     Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoEinj);
     if (ACPI_FAILURE (Status))
     {
@@ -1205,7 +1240,7 @@
     /* Subtables */
 
     SubTable = ACPI_ADD_PTR (ACPI_WHEA_HEADER, Table, Offset);
-    while (Offset < Table->Length)
+    while (Offset < Length)
     {
         AcpiOsPrintf ("\n");
         Status = AcpiDmDumpTable (Length, Offset, SubTable,
@@ -1243,12 +1278,13 @@
 {
     ACPI_STATUS             Status;
     ACPI_WHEA_HEADER        *SubTable;
-    UINT32                  Length = Table->Length;
+    UINT32                  Length;
     UINT32                  Offset = sizeof (ACPI_TABLE_ERST);
 
 
     /* Main table */
 
+    ACPI_MOVE_32_TO_32(&Length, &Table->Length);
     Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoErst);
     if (ACPI_FAILURE (Status))
     {
@@ -1258,7 +1294,7 @@
     /* Subtables */
 
     SubTable = ACPI_ADD_PTR (ACPI_WHEA_HEADER, Table, Offset);
-    while (Offset < Table->Length)
+    while (Offset < Length)
     {
         AcpiOsPrintf ("\n");
         Status = AcpiDmDumpTable (Length, Offset, SubTable,
@@ -1296,17 +1332,19 @@
 {
     ACPI_STATUS             Status;
     ACPI_FPDT_HEADER        *SubTable;
-    UINT32                  Length = Table->Length;
+    UINT32                  Length;
     UINT32                  Offset = sizeof (ACPI_TABLE_FPDT);
     ACPI_DMTABLE_INFO       *InfoTable;
+    UINT16		    Type;
 
 
     /* There is no main table (other than the standard ACPI header) */
 
     /* Subtables */
 
+    ACPI_MOVE_32_TO_32(&Length, &Table->Length);
     SubTable = ACPI_ADD_PTR (ACPI_FPDT_HEADER, Table, Offset);
-    while (Offset < Table->Length)
+    while (Offset < Length)
     {
         /* Common subtable header */
 
@@ -1318,7 +1356,8 @@
             return;
         }
 
-        switch (SubTable->Type)
+	ACPI_MOVE_16_TO_16(&Type, &SubTable->Type);
+        switch (Type)
         {
         case ACPI_FPDT_TYPE_BOOT:
 
@@ -1332,8 +1371,7 @@
 
         default:
 
-            AcpiOsPrintf ("\n**** Unknown FPDT subtable type 0x%X\n\n",
-                SubTable->Type);
+            AcpiOsPrintf ("\n**** Unknown FPDT subtable type 0x%X\n\n", Type);
 
             /* Attempt to continue */
 
@@ -1381,16 +1419,19 @@
 {
     ACPI_STATUS             Status;
     ACPI_GTDT_HEADER        *SubTable;
-    UINT32                  Length = Table->Length;
+    UINT32                  Length;
+    UINT16                  SubLength;
     UINT32                  Offset = sizeof (ACPI_TABLE_GTDT);
     ACPI_DMTABLE_INFO       *InfoTable;
     UINT32                  SubTableLength;
     UINT32                  GtCount;
+    UINT32                  Tmp32;
     ACPI_GTDT_TIMER_ENTRY   *GtxTable;
 
 
     /* Main table */
 
+    ACPI_MOVE_32_TO_32(&Length, &Table->Length);
     Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoGtdt);
     if (ACPI_FAILURE (Status))
     {
@@ -1400,7 +1441,7 @@
     /* Subtables */
 
     SubTable = ACPI_ADD_PTR (ACPI_GTDT_HEADER, Table, Offset);
-    while (Offset < Table->Length)
+    while (Offset < Length)
     {
         /* Common subtable header */
 
@@ -1418,8 +1459,9 @@
         case ACPI_GTDT_TYPE_TIMER_BLOCK:
 
             SubTableLength = sizeof (ACPI_GTDT_TIMER_BLOCK);
-            GtCount = (ACPI_CAST_PTR (ACPI_GTDT_TIMER_BLOCK,
+            Tmp32 = (ACPI_CAST_PTR (ACPI_GTDT_TIMER_BLOCK,
                 SubTable))->TimerCount;
+	    ACPI_MOVE_32_TO_32(&GtCount, &Tmp32);
 
             InfoTable = AcpiDmTableInfoGtdt0;
             break;
@@ -1440,8 +1482,9 @@
             return;
         }
 
+	ACPI_MOVE_16_TO_16(&SubLength, &SubTable->Length);
         Status = AcpiDmDumpTable (Length, Offset, SubTable,
-            SubTable->Length, InfoTable);
+            SubLength, InfoTable);
         if (ACPI_FAILURE (Status))
         {
             return;
@@ -1500,16 +1543,18 @@
 {
     ACPI_STATUS             Status;
     ACPI_HEST_HEADER        *SubTable;
-    UINT32                  Length = Table->Length;
+    UINT32                  Length;
     UINT32                  Offset = sizeof (ACPI_TABLE_HEST);
     ACPI_DMTABLE_INFO       *InfoTable;
     UINT32                  SubTableLength;
     UINT32                  BankCount;
     ACPI_HEST_IA_ERROR_BANK *BankTable;
+    UINT16		    SubType;
 
 
     /* Main table */
 
+    ACPI_MOVE_32_TO_32(&Length, &Table->Length);
     Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoHest);
     if (ACPI_FAILURE (Status))
     {
@@ -1519,10 +1564,11 @@
     /* Subtables */
 
     SubTable = ACPI_ADD_PTR (ACPI_HEST_HEADER, Table, Offset);
-    while (Offset < Table->Length)
+    while (Offset < Length)
     {
         BankCount = 0;
-        switch (SubTable->Type)
+	ACPI_MOVE_16_TO_16(&SubType, &SubTable->Type);
+        switch (SubType)
         {
         case ACPI_HEST_TYPE_IA32_CHECK:
 
@@ -1651,15 +1697,21 @@
     ACPI_IORT_SMMU          *IortSmmu = NULL;
     UINT32                  Offset;
     UINT32                  NodeOffset;
+    UINT16		    NodeLength;
     UINT32                  Length;
     ACPI_DMTABLE_INFO       *InfoTable;
     char                    *String;
     UINT32                  i;
-
+    UINT32		    TableLen;
+    UINT32		    ItsCount;
+    UINT32		    MappingCount;
+    UINT32		    CtxIntCount;
+    UINT32		    PmuIntCount;
 
     /* Main table */
 
-    Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoIort);
+    ACPI_MOVE_32_TO_32(&TableLen, &Table->Length);
+    Status = AcpiDmDumpTable (TableLen, 0, Table, 0, AcpiDmTableInfoIort);
     if (ACPI_FAILURE (Status))
     {
         return;
@@ -1670,18 +1722,19 @@
 
     /* Dump the OptionalPadding (optional) */
 
-    if (Iort->NodeOffset > Offset)
+    ACPI_MOVE_32_TO_32(&NodeOffset, &Iort->NodeOffset);
+    if (NodeOffset > Offset)
     {
-        Status = AcpiDmDumpTable (Table->Length, Offset, Table,
-            Iort->NodeOffset - Offset, AcpiDmTableInfoIortPad);
+        Status = AcpiDmDumpTable (TableLen, Offset, Table,
+            NodeOffset - Offset, AcpiDmTableInfoIortPad);
         if (ACPI_FAILURE (Status))
         {
             return;
         }
     }
 
-    Offset = Iort->NodeOffset;
-    while (Offset < Table->Length)
+    ACPI_MOVE_32_TO_32(&Offset, &Iort->NodeOffset);
+    while (Offset < TableLen)
     {
         /* Common subtable header */
 
@@ -1717,7 +1770,8 @@
         case ACPI_IORT_NODE_PCI_ROOT_COMPLEX:
 
             InfoTable = AcpiDmTableInfoIort2;
-            Length = IortNode->Length - NodeOffset;
+	    ACPI_MOVE_16_TO_16(&NodeLength, &IortNode->Length);
+            Length = NodeLength - NodeOffset;
             break;
 
         case ACPI_IORT_NODE_SMMU:
@@ -1730,7 +1784,8 @@
         case ACPI_IORT_NODE_SMMU_V3:
 
             InfoTable = AcpiDmTableInfoIort4;
-            Length = IortNode->Length - NodeOffset;
+	    ACPI_MOVE_16_TO_16(&NodeLength, &IortNode->Length);
+            Length = NodeLength - NodeOffset;
             break;
 
         default:
@@ -1740,7 +1795,8 @@
 
             /* Attempt to continue */
 
-            if (!IortNode->Length)
+	    ACPI_MOVE_16_TO_16(&NodeLength, &IortNode->Length);
+            if (!NodeLength)
             {
                 AcpiOsPrintf ("Invalid zero length IORT node\n");
                 return;
@@ -1751,7 +1807,7 @@
         /* Dump the node subtable header */
 
         AcpiOsPrintf ("\n");
-        Status = AcpiDmDumpTable (Table->Length, Offset + NodeOffset,
+        Status = AcpiDmDumpTable (TableLen, Offset + NodeOffset,
             ACPI_ADD_PTR (ACPI_IORT_NODE, IortNode, NodeOffset),
             Length, InfoTable);
         if (ACPI_FAILURE (Status))
@@ -1771,9 +1827,10 @@
 
             if (IortItsGroup)
             {
-                for (i = 0; i < IortItsGroup->ItsCount; i++)
+	        ACPI_MOVE_32_TO_32(&ItsCount, &IortItsGroup->ItsCount);
+                for (i = 0; i < ItsCount; i++)
                 {
-                    Status = AcpiDmDumpTable (Table->Length, Offset + NodeOffset,
+                    Status = AcpiDmDumpTable (TableLen, Offset + NodeOffset,
                         ACPI_ADD_PTR (ACPI_IORT_NODE, IortNode, NodeOffset),
                         4, AcpiDmTableInfoIort0a);
                     NodeOffset += 4;
@@ -1785,11 +1842,11 @@
 
             /* Dump the Padding (optional) */
 
-            if (IortNode->Length > NodeOffset)
+	    ACPI_MOVE_16_TO_16(&NodeLength, &IortNode->Length);
+            if (NodeLength > NodeOffset)
             {
-                Status = AcpiDmDumpTable (Table->Length, Offset + NodeOffset,
-                    Table, IortNode->Length - NodeOffset,
-                    AcpiDmTableInfoIort1a);
+                Status = AcpiDmDumpTable (TableLen, Offset + NodeOffset,
+                    Table, NodeLength - NodeOffset, AcpiDmTableInfoIort1a);
                 if (ACPI_FAILURE (Status))
                 {
                     return;
@@ -1806,8 +1863,8 @@
             if (IortSmmu)
             {
                 Length = 2 * sizeof (UINT64);
-                NodeOffset = IortSmmu->GlobalInterruptOffset;
-                Status = AcpiDmDumpTable (Table->Length, Offset + NodeOffset,
+                ACPI_MOVE_32_TO_32(&NodeOffset, &IortSmmu->GlobalInterruptOffset);
+                Status = AcpiDmDumpTable (TableLen, Offset + NodeOffset,
                     ACPI_ADD_PTR (ACPI_IORT_NODE, IortNode, NodeOffset),
                     Length, AcpiDmTableInfoIort3a);
                 if (ACPI_FAILURE (Status))
@@ -1815,10 +1872,11 @@
                     return;
                 }
 
-                NodeOffset = IortSmmu->ContextInterruptOffset;
-                for (i = 0; i < IortSmmu->ContextInterruptCount; i++)
+                ACPI_MOVE_32_TO_32(&NodeOffset, &IortSmmu->ContextInterruptOffset);
+                ACPI_MOVE_32_TO_32(&CtxIntCount, &IortSmmu->ContextInterruptCount);
+                for (i = 0; i < CtxIntCount; i++)
                 {
-                    Status = AcpiDmDumpTable (Table->Length, Offset + NodeOffset,
+                    Status = AcpiDmDumpTable (TableLen, Offset + NodeOffset,
                         ACPI_ADD_PTR (ACPI_IORT_NODE, IortNode, NodeOffset),
                         8, AcpiDmTableInfoIort3b);
                     if (ACPI_FAILURE (Status))
@@ -1829,10 +1887,11 @@
                     NodeOffset += 8;
                 }
 
-                NodeOffset = IortSmmu->PmuInterruptOffset;
-                for (i = 0; i < IortSmmu->PmuInterruptCount; i++)
+                ACPI_MOVE_32_TO_32(&NodeOffset, &IortSmmu->PmuInterruptOffset);
+                ACPI_MOVE_32_TO_32(&PmuIntCount, &IortSmmu->PmuInterruptCount);
+                for (i = 0; i < PmuIntCount; i++)
                 {
-                    Status = AcpiDmDumpTable (Table->Length, Offset + NodeOffset,
+                    Status = AcpiDmDumpTable (TableLen, Offset + NodeOffset,
                         ACPI_ADD_PTR (ACPI_IORT_NODE, IortNode, NodeOffset),
                         8, AcpiDmTableInfoIort3c);
                     if (ACPI_FAILURE (Status))
@@ -1852,12 +1911,13 @@
 
         /* Dump the ID mappings */
 
-        NodeOffset = IortNode->MappingOffset;
-        for (i = 0; i < IortNode->MappingCount; i++)
+        ACPI_MOVE_32_TO_32(&NodeOffset, &IortNode->MappingOffset);
+        ACPI_MOVE_32_TO_32(&MappingCount, &IortNode->MappingCount);
+        for (i = 0; i < MappingCount; i++)
         {
             AcpiOsPrintf ("\n");
             Length = sizeof (ACPI_IORT_ID_MAPPING);
-            Status = AcpiDmDumpTable (Table->Length, Offset + NodeOffset,
+            Status = AcpiDmDumpTable (TableLen, Offset + NodeOffset,
                 ACPI_ADD_PTR (ACPI_IORT_NODE, IortNode, NodeOffset),
                 Length, AcpiDmTableInfoIortMap);
             if (ACPI_FAILURE (Status))
@@ -1871,8 +1931,9 @@
 NextSubTable:
         /* Point to next node subtable */
 
-        Offset += IortNode->Length;
-        IortNode = ACPI_ADD_PTR (ACPI_IORT_NODE, IortNode, IortNode->Length);
+	ACPI_MOVE_16_TO_16(&NodeLength, &IortNode->Length);
+        Offset += NodeLength;
+        IortNode = ACPI_ADD_PTR (ACPI_IORT_NODE, IortNode, NodeLength);
     }
 }
 
@@ -1903,11 +1964,14 @@
     ACPI_IVRS_DE_HEADER     *DeviceEntry;
     ACPI_IVRS_HEADER        *SubTable;
     ACPI_DMTABLE_INFO       *InfoTable;
+    UINT32		    Length;
+    UINT16		    SubLength;
 
 
     /* Main table */
 
-    Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoIvrs);
+    ACPI_MOVE_32_TO_32(&Length, &Table->Length);
+    Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoIvrs);
     if (ACPI_FAILURE (Status))
     {
         return;
@@ -1916,13 +1980,14 @@
     /* Subtables */
 
     SubTable = ACPI_ADD_PTR (ACPI_IVRS_HEADER, Table, Offset);
-    while (Offset < Table->Length)
+    while (Offset < Length)
     {
         /* Common subtable header */
 
         AcpiOsPrintf ("\n");
-        Status = AcpiDmDumpTable (Table->Length, Offset, SubTable,
-            SubTable->Length, AcpiDmTableInfoIvrsHdr);
+        ACPI_MOVE_16_TO_16(&SubLength, &SubTable->Length);
+        Status = AcpiDmDumpTable (Length, Offset, SubTable,
+            SubLength, AcpiDmTableInfoIvrsHdr);
         if (ACPI_FAILURE (Status))
         {
             return;
@@ -1949,7 +2014,7 @@
 
             /* Attempt to continue */
 
-            if (!SubTable->Length)
+            if (!SubLength)
             {
                 AcpiOsPrintf ("Invalid zero length subtable\n");
                 return;
@@ -1960,8 +2025,8 @@
         /* Dump the subtable */
 
         AcpiOsPrintf ("\n");
-        Status = AcpiDmDumpTable (Table->Length, Offset, SubTable,
-            SubTable->Length, InfoTable);
+        Status = AcpiDmDumpTable (Length, Offset, SubTable,
+            SubLength, InfoTable);
         if (ACPI_FAILURE (Status))
         {
             return;
@@ -1975,7 +2040,7 @@
             DeviceEntry = ACPI_ADD_PTR (ACPI_IVRS_DE_HEADER, SubTable,
                 sizeof (ACPI_IVRS_HARDWARE));
 
-            while (EntryOffset < (Offset + SubTable->Length))
+            while (EntryOffset < (Offset + SubLength))
             {
                 AcpiOsPrintf ("\n");
                 /*
@@ -2037,7 +2102,7 @@
 
                 /* Dump the Device Entry */
 
-                Status = AcpiDmDumpTable (Table->Length, EntryOffset,
+                Status = AcpiDmDumpTable (Length, EntryOffset,
                     DeviceEntry, EntryLength, InfoTable);
                 if (ACPI_FAILURE (Status))
                 {
@@ -2053,8 +2118,8 @@
 NextSubTable:
         /* Point to next subtable */
 
-        Offset += SubTable->Length;
-        SubTable = ACPI_ADD_PTR (ACPI_IVRS_HEADER, SubTable, SubTable->Length);
+        Offset += SubLength;
+        SubTable = ACPI_ADD_PTR (ACPI_IVRS_HEADER, SubTable, SubLength);
     }
 }
 
@@ -2080,7 +2145,7 @@
 {
     ACPI_STATUS             Status;
     ACPI_LPIT_HEADER        *SubTable;
-    UINT32                  Length = Table->Length;
+    UINT32                  Length;
     UINT32                  Offset = sizeof (ACPI_TABLE_LPIT);
     ACPI_DMTABLE_INFO       *InfoTable;
     UINT32                  SubTableLength;
@@ -2088,8 +2153,9 @@
 
     /* Subtables */
 
+    ACPI_MOVE_32_TO_32(&Length, &Table->Length);
     SubTable = ACPI_ADD_PTR (ACPI_LPIT_HEADER, Table, Offset);
-    while (Offset < Table->Length)
+    while (Offset < Length)
     {
         /* Common subtable header */
 
@@ -2153,13 +2219,14 @@
 {
     ACPI_STATUS             Status;
     ACPI_SUBTABLE_HEADER    *SubTable;
-    UINT32                  Length = Table->Length;
+    UINT32                  Length;
     UINT32                  Offset = sizeof (ACPI_TABLE_MADT);
     ACPI_DMTABLE_INFO       *InfoTable;
 
 
     /* Main table */
 
+    ACPI_MOVE_32_TO_32(&Length, &Table->Length);
     Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoMadt);
     if (ACPI_FAILURE (Status))
     {
@@ -2169,7 +2236,7 @@
     /* Subtables */
 
     SubTable = ACPI_ADD_PTR (ACPI_SUBTABLE_HEADER, Table, Offset);
-    while (Offset < Table->Length)
+    while (Offset < Length)
     {
         /* Common subtable header */
 
@@ -2315,11 +2382,13 @@
     ACPI_STATUS             Status;
     UINT32                  Offset = sizeof (ACPI_TABLE_MCFG);
     ACPI_MCFG_ALLOCATION    *SubTable;
+    UINT32		    Len;
 
 
     /* Main table */
 
-    Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoMcfg);
+    ACPI_MOVE_32_TO_32(&Len, &Table->Length);
+    Status = AcpiDmDumpTable (Len, 0, Table, 0, AcpiDmTableInfoMcfg);
     if (ACPI_FAILURE (Status))
     {
         return;
@@ -2328,17 +2397,17 @@
     /* Subtables */
 
     SubTable = ACPI_ADD_PTR (ACPI_MCFG_ALLOCATION, Table, Offset);
-    while (Offset < Table->Length)
+    while (Offset < Len)
     {
-        if (Offset + sizeof (ACPI_MCFG_ALLOCATION) > Table->Length)
+        if (Offset + sizeof (ACPI_MCFG_ALLOCATION) > Len)
         {
             AcpiOsPrintf ("Warning: there are %u invalid trailing bytes\n",
-                sizeof (ACPI_MCFG_ALLOCATION) - (Offset - Table->Length));
+                sizeof (ACPI_MCFG_ALLOCATION) - (Offset - Len));
             return;
         }
 
         AcpiOsPrintf ("\n");
-        Status = AcpiDmDumpTable (Table->Length, Offset, SubTable,
+        Status = AcpiDmDumpTable (Len, Offset, SubTable,
             sizeof (ACPI_MCFG_ALLOCATION), AcpiDmTableInfoMcfg0);
         if (ACPI_FAILURE (Status))
         {
@@ -2372,6 +2441,7 @@
 {
     ACPI_STATUS             Status;
     UINT32                  Offset = sizeof (ACPI_TABLE_MPST);
+    ACPI_TABLE_MPST	    *Mpst;
     ACPI_MPST_POWER_NODE    *SubTable0;
     ACPI_MPST_POWER_STATE   *SubTable0A;
     ACPI_MPST_COMPONENT     *SubTable0B;
@@ -2380,11 +2450,13 @@
     UINT16                  SubtableCount;
     UINT32                  PowerStateCount;
     UINT32                  ComponentCount;
+    UINT32		    Length;
 
 
     /* Main table */
 
-    Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoMpst);
+    ACPI_MOVE_32_TO_32(&Length, &Table->Length);
+    Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoMpst);
     if (ACPI_FAILURE (Status))
     {
         return;
@@ -2392,13 +2464,14 @@
 
     /* Subtable: Memory Power Node(s) */
 
-    SubtableCount = (ACPI_CAST_PTR (ACPI_TABLE_MPST, Table))->PowerNodeCount;
+    Mpst = ACPI_CAST_PTR (ACPI_TABLE_MPST, Table);
+    ACPI_MOVE_16_TO_16(&SubtableCount, &Mpst->PowerNodeCount);
     SubTable0 = ACPI_ADD_PTR (ACPI_MPST_POWER_NODE, Table, Offset);
 
-    while ((Offset < Table->Length) && SubtableCount)
+    while ((Offset < Length) && SubtableCount)
     {
         AcpiOsPrintf ("\n");
-        Status = AcpiDmDumpTable (Table->Length, Offset, SubTable0,
+        Status = AcpiDmDumpTable (Length, Offset, SubTable0,
             sizeof (ACPI_MPST_POWER_NODE), AcpiDmTableInfoMpst0);
         if (ACPI_FAILURE (Status))
         {
@@ -2407,8 +2480,8 @@
 
         /* Extract the sub-subtable counts */
 
-        PowerStateCount = SubTable0->NumPowerStates;
-        ComponentCount = SubTable0->NumPhysicalComponents;
+        ACPI_MOVE_32_TO_32(&PowerStateCount, &SubTable0->NumPowerStates);
+        ACPI_MOVE_32_TO_32(&ComponentCount, &SubTable0->NumPhysicalComponents);
         Offset += sizeof (ACPI_MPST_POWER_NODE);
 
         /* Sub-subtables - Memory Power State Structure(s) */
@@ -2419,7 +2492,7 @@
         while (PowerStateCount)
         {
             AcpiOsPrintf ("\n");
-            Status = AcpiDmDumpTable (Table->Length, Offset, SubTable0A,
+            Status = AcpiDmDumpTable (Length, Offset, SubTable0A,
                 sizeof (ACPI_MPST_POWER_STATE), AcpiDmTableInfoMpst0A);
             if (ACPI_FAILURE (Status))
             {
@@ -2429,7 +2502,7 @@
             SubTable0A++;
             PowerStateCount--;
             Offset += sizeof (ACPI_MPST_POWER_STATE);
-       }
+        }
 
         /* Sub-subtables - Physical Component ID Structure(s) */
 
@@ -2442,7 +2515,7 @@
 
         while (ComponentCount)
         {
-            Status = AcpiDmDumpTable (Table->Length, Offset, SubTable0B,
+            Status = AcpiDmDumpTable (Length, Offset, SubTable0B,
                 sizeof (ACPI_MPST_COMPONENT), AcpiDmTableInfoMpst0B);
             if (ACPI_FAILURE (Status))
             {
@@ -2457,17 +2530,19 @@
         /* Point to next Memory Power Node subtable */
 
         SubtableCount--;
+        ACPI_MOVE_32_TO_32(&PowerStateCount, &SubTable0->NumPowerStates);
+        ACPI_MOVE_32_TO_32(&ComponentCount, &SubTable0->NumPhysicalComponents);
         SubTable0 = ACPI_ADD_PTR (ACPI_MPST_POWER_NODE, SubTable0,
             sizeof (ACPI_MPST_POWER_NODE) +
-            (sizeof (ACPI_MPST_POWER_STATE) * SubTable0->NumPowerStates) +
-            (sizeof (ACPI_MPST_COMPONENT) * SubTable0->NumPhysicalComponents));
+            (sizeof (ACPI_MPST_POWER_STATE) * PowerStateCount) +
+            (sizeof (ACPI_MPST_COMPONENT) * ComponentCount));
     }
 
     /* Subtable: Count of Memory Power State Characteristic structures */
 
     AcpiOsPrintf ("\n");
     SubTable1 = ACPI_CAST_PTR (ACPI_MPST_DATA_HDR, SubTable0);
-    Status = AcpiDmDumpTable (Table->Length, Offset, SubTable1,
+    Status = AcpiDmDumpTable (Length, Offset, SubTable1,
         sizeof (ACPI_MPST_DATA_HDR), AcpiDmTableInfoMpst1);
     if (ACPI_FAILURE (Status))
     {
@@ -2482,10 +2557,10 @@
     SubTable2 = ACPI_ADD_PTR (ACPI_MPST_POWER_DATA, SubTable1,
         sizeof (ACPI_MPST_DATA_HDR));
 
-    while ((Offset < Table->Length) && SubtableCount)
+    while ((Offset < Length) && SubtableCount)
     {
         AcpiOsPrintf ("\n");
-        Status = AcpiDmDumpTable (Table->Length, Offset, SubTable2,
+        Status = AcpiDmDumpTable (Length, Offset, SubTable2,
             sizeof (ACPI_MPST_POWER_DATA), AcpiDmTableInfoMpst2);
         if (ACPI_FAILURE (Status))
         {
@@ -2518,11 +2593,13 @@
     ACPI_STATUS             Status;
     UINT32                  Offset = sizeof (ACPI_TABLE_MSCT);
     ACPI_MSCT_PROXIMITY     *SubTable;
+    UINT32		    Length;
 
 
     /* Main table */
 
-    Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoMsct);
+    ACPI_MOVE_32_TO_32(&Length, &Table->Length);
+    Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoMsct);
     if (ACPI_FAILURE (Status))
     {
         return;
@@ -2531,12 +2608,12 @@
     /* Subtables */
 
     SubTable = ACPI_ADD_PTR (ACPI_MSCT_PROXIMITY, Table, Offset);
-    while (Offset < Table->Length)
+    while (Offset < Length)
     {
         /* Common subtable header */
 
         AcpiOsPrintf ("\n");
-        Status = AcpiDmDumpTable (Table->Length, Offset, SubTable,
+        Status = AcpiDmDumpTable (Length, Offset, SubTable,
             sizeof (ACPI_MSCT_PROXIMITY), AcpiDmTableInfoMsct0);
         if (ACPI_FAILURE (Status))
         {
@@ -2571,11 +2648,13 @@
     ACPI_STATUS             Status;
     UINT32                  Offset = sizeof (ACPI_TABLE_MTMR);
     ACPI_MTMR_ENTRY         *SubTable;
+    UINT32		    Length;
 
 
     /* Main table */
 
-    Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoMtmr);
+    ACPI_MOVE_32_TO_32(&Length, &Table->Length);
+    Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoMtmr);
     if (ACPI_FAILURE (Status))
     {
         return;
@@ -2584,12 +2663,12 @@
     /* Subtables */
 
     SubTable = ACPI_ADD_PTR (ACPI_MTMR_ENTRY, Table, Offset);
-    while (Offset < Table->Length)
+    while (Offset < Length)
     {
         /* Common subtable header */
 
         AcpiOsPrintf ("\n");
-        Status = AcpiDmDumpTable (Table->Length, Offset, SubTable,
+        Status = AcpiDmDumpTable (Length, Offset, SubTable,
             sizeof (ACPI_MTMR_ENTRY), AcpiDmTableInfoMtmr0);
         if (ACPI_FAILURE (Status))
         {
@@ -2631,11 +2710,17 @@
     ACPI_NFIT_SMBIOS        *SmbiosInfo = NULL;
     ACPI_NFIT_FLUSH_ADDRESS *Hint = NULL;
     UINT32                  i;
+    UINT32                  TableLength;
+    UINT16                  SubLength;
+    UINT16                  SubType;
+    UINT32                  Count;
+    UINT16                  Count16;
 
 
     /* Main table */
 
-    Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoNfit);
+    ACPI_MOVE_32_TO_32(&TableLength, &Table->Length);
+    Status = AcpiDmDumpTable (TableLength, 0, Table, 0, AcpiDmTableInfoNfit);
     if (ACPI_FAILURE (Status))
     {
         return;
@@ -2644,19 +2729,21 @@
     /* Subtables */
 
     SubTable = ACPI_ADD_PTR (ACPI_NFIT_HEADER, Table, Offset);
-    while (Offset < Table->Length)
+    while (Offset < TableLength)
     {
         /* NFIT subtable header */
 
         AcpiOsPrintf ("\n");
-        Status = AcpiDmDumpTable (Table->Length, Offset, SubTable,
-            SubTable->Length, AcpiDmTableInfoNfitHdr);
+	ACPI_MOVE_16_TO_16(&SubLength, &SubTable->Length);
+        Status = AcpiDmDumpTable (TableLength, Offset, SubTable,
+            SubLength, AcpiDmTableInfoNfitHdr);
         if (ACPI_FAILURE (Status))
         {
             return;
         }
 
-        switch (SubTable->Type)
+	ACPI_MOVE_16_TO_16(&SubType, &SubTable->Type);
+        switch (SubType)
         {
         case ACPI_NFIT_TYPE_SYSTEM_ADDRESS:
 
@@ -2708,7 +2795,7 @@
 
             /* Attempt to continue */
 
-            if (!SubTable->Length)
+            if (!SubLength)
             {
                 AcpiOsPrintf ("Invalid zero length subtable\n");
                 return;
@@ -2717,8 +2804,8 @@
         }
 
         AcpiOsPrintf ("\n");
-        Status = AcpiDmDumpTable (Table->Length, Offset, SubTable,
-            SubTable->Length, InfoTable);
+        Status = AcpiDmDumpTable (TableLength, Offset, SubTable,
+            SubLength, InfoTable);
         if (ACPI_FAILURE (Status))
         {
             return;
@@ -2726,13 +2813,14 @@
 
         /* Per-subtable variable-length fields */
 
-        switch (SubTable->Type)
+        switch (SubType)
         {
         case ACPI_NFIT_TYPE_INTERLEAVE:
 
-            for (i = 0; i < Interleave->LineCount; i++)
+	    ACPI_MOVE_32_TO_32(&Count, &Interleave->LineCount);
+            for (i = 0; i < Count; i++)
             {
-                Status = AcpiDmDumpTable (Table->Length, Offset + FieldOffset,
+                Status = AcpiDmDumpTable (TableLength, Offset + FieldOffset,
                     &Interleave->LineOffset[i],
                     sizeof (UINT32), AcpiDmTableInfoNfit2a);
                 if (ACPI_FAILURE (Status))
@@ -2746,12 +2834,11 @@
 
         case ACPI_NFIT_TYPE_SMBIOS:
 
-            Length = SubTable->Length -
-                sizeof (ACPI_NFIT_SMBIOS) + sizeof (UINT8);
+            Length = SubLength - sizeof (ACPI_NFIT_SMBIOS) + sizeof (UINT8);
 
             if (Length)
             {
-                Status = AcpiDmDumpTable (Table->Length,
+                Status = AcpiDmDumpTable (TableLength,
                     sizeof (ACPI_NFIT_SMBIOS) - sizeof (UINT8),
                     SmbiosInfo,
                     Length, AcpiDmTableInfoNfit3a);
@@ -2765,9 +2852,10 @@
 
         case ACPI_NFIT_TYPE_FLUSH_ADDRESS:
 
-            for (i = 0; i < Hint->HintCount; i++)
+	    ACPI_MOVE_16_TO_16(&Count16, &Hint->HintCount);
+            for (i = 0; i < Count16; i++)
             {
-                Status = AcpiDmDumpTable (Table->Length, Offset + FieldOffset,
+                Status = AcpiDmDumpTable (TableLength, Offset + FieldOffset,
                     &Hint->HintAddress[i],
                     sizeof (UINT64), AcpiDmTableInfoNfit6a);
                 if (ACPI_FAILURE (Status))
@@ -2786,8 +2874,8 @@
 NextSubTable:
         /* Point to next subtable */
 
-        Offset += SubTable->Length;
-        SubTable = ACPI_ADD_PTR (ACPI_NFIT_HEADER, SubTable, SubTable->Length);
+        Offset += SubLength;
+        SubTable = ACPI_ADD_PTR (ACPI_NFIT_HEADER, SubTable, SubLength);
     }
 }
 
@@ -2812,12 +2900,13 @@
     ACPI_STATUS             Status;
     ACPI_PCCT_SUBSPACE      *SubTable;
     ACPI_DMTABLE_INFO       *InfoTable;
-    UINT32                  Length = Table->Length;
+    UINT32                  Length;
     UINT32                  Offset = sizeof (ACPI_TABLE_PCCT);
 
 
     /* Main table */
 
+    ACPI_MOVE_32_TO_32(&Length, &Table->Length);
     Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoPcct);
     if (ACPI_FAILURE (Status))
     {
@@ -2827,7 +2916,7 @@
     /* Subtables */
 
     SubTable = ACPI_ADD_PTR (ACPI_PCCT_SUBSPACE, Table, Offset);
-    while (Offset < Table->Length)
+    while (Offset < Length)
     {
         /* Common subtable header */
 
@@ -2903,16 +2992,21 @@
     ACPI_PMTT_HEADER        *MemSubTable;
     ACPI_PMTT_HEADER        *DimmSubTable;
     ACPI_PMTT_DOMAIN        *DomainArray;
-    UINT32                  Length = Table->Length;
+    UINT32                  Length;
     UINT32                  Offset = sizeof (ACPI_TABLE_PMTT);
     UINT32                  MemOffset;
     UINT32                  DimmOffset;
     UINT32                  DomainOffset;
-    UINT32                  DomainCount;
+    UINT16                  DomainCount;
+    UINT16		    SubLength;
+    UINT16		    Tmp16;
+    UINT16		    MemLength;
+    UINT16		    DimmLength;
 
 
     /* Main table */
 
+    ACPI_MOVE_32_TO_32(&Length, &Table->Length);
     Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoPmtt);
     if (ACPI_FAILURE (Status))
     {
@@ -2922,13 +3016,14 @@
     /* Subtables */
 
     SubTable = ACPI_ADD_PTR (ACPI_PMTT_HEADER, Table, Offset);
-    while (Offset < Table->Length)
+    while (Offset < Length)
     {
         /* Common subtable header */
 
         AcpiOsPrintf ("\n");
+        ACPI_MOVE_16_TO_16(&SubLength, &SubTable->Length);
         Status = AcpiDmDumpTable (Length, Offset, SubTable,
-            SubTable->Length, AcpiDmTableInfoPmttHdr);
+            SubLength, AcpiDmTableInfoPmttHdr);
         if (ACPI_FAILURE (Status))
         {
             return;
@@ -2947,7 +3042,7 @@
         /* Dump the fixed-length portion of the subtable */
 
         Status = AcpiDmDumpTable (Length, Offset, SubTable,
-            SubTable->Length, AcpiDmTableInfoPmtt0);
+            SubLength, AcpiDmTableInfoPmtt0);
         if (ACPI_FAILURE (Status))
         {
             return;
@@ -2959,15 +3054,16 @@
         MemSubTable = ACPI_ADD_PTR (ACPI_PMTT_HEADER, SubTable,
             sizeof (ACPI_PMTT_SOCKET));
 
-        while (((Offset + MemOffset) < Table->Length) &&
-            (MemOffset < SubTable->Length))
+        while (((Offset + MemOffset) < Length) &&
+            (MemOffset < SubLength))
         {
             /* Common subtable header */
 
             AcpiOsPrintf ("\n");
+	    ACPI_MOVE_16_TO_16(&MemLength, &MemSubTable->Length);
             Status = AcpiDmDumpTable (Length,
                 Offset + MemOffset, MemSubTable,
-                MemSubTable->Length, AcpiDmTableInfoPmttHdr);
+                MemLength, AcpiDmTableInfoPmttHdr);
             if (ACPI_FAILURE (Status))
             {
                 return;
@@ -2987,7 +3083,7 @@
 
             Status = AcpiDmDumpTable (Length,
                 Offset + MemOffset, MemSubTable,
-                MemSubTable->Length, AcpiDmTableInfoPmtt1);
+                MemLength, AcpiDmTableInfoPmtt1);
             if (ACPI_FAILURE (Status))
             {
                 return;
@@ -2995,13 +3091,14 @@
 
             /* Walk the variable count of proximity domains */
 
-            DomainCount = ((ACPI_PMTT_CONTROLLER *) MemSubTable)->DomainCount;
+	    Tmp16 = ((ACPI_PMTT_CONTROLLER *) MemSubTable)->DomainCount;
+            ACPI_MOVE_16_TO_16(&DomainCount, &Tmp16);
             DomainOffset = sizeof (ACPI_PMTT_CONTROLLER);
             DomainArray = ACPI_ADD_PTR (ACPI_PMTT_DOMAIN, MemSubTable,
                 sizeof (ACPI_PMTT_CONTROLLER));
 
-            while (((Offset + MemOffset + DomainOffset) < Table->Length) &&
-                ((MemOffset + DomainOffset) < SubTable->Length) &&
+            while (((Offset + MemOffset + DomainOffset) < Length) &&
+                ((MemOffset + DomainOffset) < SubLength) &&
                 DomainCount)
             {
                 Status = AcpiDmDumpTable (Length,
@@ -3029,15 +3126,16 @@
             DimmSubTable = ACPI_ADD_PTR (ACPI_PMTT_HEADER, MemSubTable,
                 DomainOffset);
 
-            while (((Offset + MemOffset + DimmOffset) < Table->Length) &&
-                (DimmOffset < MemSubTable->Length))
+            while (((Offset + MemOffset + DimmOffset) < Length) &&
+                (DimmOffset < MemLength))
             {
                 /* Common subtable header */
 
                 AcpiOsPrintf ("\n");
+		ACPI_MOVE_16_TO_16(&DimmLength, &DimmSubTable->Length);
                 Status = AcpiDmDumpTable (Length,
                     Offset + MemOffset + DimmOffset, DimmSubTable,
-                    DimmSubTable->Length, AcpiDmTableInfoPmttHdr);
+                    DimmLength, AcpiDmTableInfoPmttHdr);
                 if (ACPI_FAILURE (Status))
                 {
                     return;
@@ -3057,7 +3155,7 @@
 
                 Status = AcpiDmDumpTable (Length,
                     Offset + MemOffset + DimmOffset, DimmSubTable,
-                    DimmSubTable->Length, AcpiDmTableInfoPmtt2);
+                    DimmLength, AcpiDmTableInfoPmtt2);
                 if (ACPI_FAILURE (Status))
                 {
                     return;
@@ -3065,23 +3163,22 @@
 
                 /* Point to next DIMM subtable */
 
-                DimmOffset += DimmSubTable->Length;
+                DimmOffset += DimmLength;
                 DimmSubTable = ACPI_ADD_PTR (ACPI_PMTT_HEADER,
-                    DimmSubTable, DimmSubTable->Length);
+                    DimmSubTable, DimmLength);
             }
 
             /* Point to next Controller subtable */
 
-            MemOffset += MemSubTable->Length;
+            MemOffset += MemLength;
             MemSubTable = ACPI_ADD_PTR (ACPI_PMTT_HEADER,
-                MemSubTable, MemSubTable->Length);
+                MemSubTable, MemLength);
         }
 
         /* Point to next Socket subtable */
 
-        Offset += SubTable->Length;
-        SubTable = ACPI_ADD_PTR (ACPI_PMTT_HEADER,
-            SubTable, SubTable->Length);
+        Offset += SubLength;
+        SubTable = ACPI_ADD_PTR (ACPI_PMTT_HEADER, SubTable, SubLength);
     }
 }
 
@@ -3107,6 +3204,8 @@
     ACPI_FPDT_HEADER        *SubTable;
     ACPI_DMTABLE_INFO       *InfoTable;
     ACPI_TABLE_S3PT         *S3ptTable = ACPI_CAST_PTR (ACPI_TABLE_S3PT, Tables);
+    UINT32		    Length;
+    UINT16                  SubType;
 
 
     /* Main table */
@@ -3117,20 +3216,22 @@
         return 0;
     }
 
+    ACPI_MOVE_32_TO_32(&Length, &S3ptTable->Length);
     SubTable = ACPI_ADD_PTR (ACPI_FPDT_HEADER, S3ptTable, Offset);
-    while (Offset < S3ptTable->Length)
+    while (Offset < Length)
     {
         /* Common subtable header */
 
         AcpiOsPrintf ("\n");
-        Status = AcpiDmDumpTable (S3ptTable->Length, Offset, SubTable,
+        Status = AcpiDmDumpTable (Length, Offset, SubTable,
             SubTable->Length, AcpiDmTableInfoS3ptHdr);
         if (ACPI_FAILURE (Status))
         {
             return 0;
         }
 
-        switch (SubTable->Type)
+        ACPI_MOVE_16_TO_16(&SubType, &SubTable->Type);
+        switch (SubType)
         {
         case ACPI_S3PT_TYPE_RESUME:
 
@@ -3145,7 +3246,7 @@
         default:
 
             AcpiOsPrintf ("\n**** Unknown S3PT subtable type 0x%X\n",
-                SubTable->Type);
+                SubType);
 
             /* Attempt to continue */
 
@@ -3158,7 +3259,7 @@
         }
 
         AcpiOsPrintf ("\n");
-        Status = AcpiDmDumpTable (S3ptTable->Length, Offset, SubTable,
+        Status = AcpiDmDumpTable (Length, Offset, SubTable,
             SubTable->Length, InfoTable);
         if (ACPI_FAILURE (Status))
         {
@@ -3192,9 +3293,11 @@
 AcpiDmDumpSlic (
     ACPI_TABLE_HEADER       *Table)
 {
+    UINT32	Length;
 
-    (void) AcpiDmDumpTable (Table->Length, sizeof (ACPI_TABLE_HEADER), Table,
-        Table->Length - sizeof (*Table), AcpiDmTableInfoSlic);
+    ACPI_MOVE_32_TO_32(&Length, &Table->Length);
+    (void) AcpiDmDumpTable (Length, sizeof (ACPI_TABLE_HEADER), Table,
+        Length - sizeof (*Table), AcpiDmTableInfoSlic);
 }
 
 
@@ -3217,14 +3320,17 @@
     ACPI_STATUS             Status;
     UINT32                  Offset;
     UINT8                   *Row;
-    UINT32                  Localities;
+    UINT64                  Localities;
     UINT32                  i;
     UINT32                  j;
+    UINT32		    Length;
+    UINT64                  Tmp64;
 
 
     /* Main table */
 
-    Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoSlit);
+    ACPI_MOVE_32_TO_32(&Length, &Table->Length);
+    Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoSlit);
     if (ACPI_FAILURE (Status))
     {
         return;
@@ -3232,7 +3338,8 @@
 
     /* Display the Locality NxN Matrix */
 
-    Localities = (UINT32) ACPI_CAST_PTR (ACPI_TABLE_SLIT, Table)->LocalityCount;
+    Tmp64 = (UINT64) ACPI_CAST_PTR (ACPI_TABLE_SLIT, Table)->LocalityCount;
+    ACPI_MOVE_64_TO_64(&Localities, &Tmp64);
     Offset = ACPI_OFFSET (ACPI_TABLE_SLIT, Entry[0]);
     Row = (UINT8 *) ACPI_CAST_PTR (ACPI_TABLE_SLIT, Table)->Entry;
 
@@ -3245,7 +3352,7 @@
         {
             /* Check for beyond EOT */
 
-            if (Offset >= Table->Length)
+            if (Offset >= Length)
             {
                 AcpiOsPrintf (
                     "\n**** Not enough room in table for all localities\n");
@@ -3297,11 +3404,13 @@
     UINT32                  Offset = sizeof (ACPI_TABLE_SRAT);
     ACPI_SUBTABLE_HEADER    *SubTable;
     ACPI_DMTABLE_INFO       *InfoTable;
+    UINT32		    Length;
 
 
     /* Main table */
 
-    Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoSrat);
+    ACPI_MOVE_32_TO_32(&Length, &Table->Length);
+    Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoSrat);
     if (ACPI_FAILURE (Status))
     {
         return;
@@ -3310,12 +3419,12 @@
     /* Subtables */
 
     SubTable = ACPI_ADD_PTR (ACPI_SUBTABLE_HEADER, Table, Offset);
-    while (Offset < Table->Length)
+    while (Offset < Length)
     {
         /* Common subtable header */
 
         AcpiOsPrintf ("\n");
-        Status = AcpiDmDumpTable (Table->Length, Offset, SubTable,
+        Status = AcpiDmDumpTable (Length, Offset, SubTable,
             SubTable->Length, AcpiDmTableInfoSratHdr);
         if (ACPI_FAILURE (Status))
         {
@@ -3359,7 +3468,7 @@
         }
 
         AcpiOsPrintf ("\n");
-        Status = AcpiDmDumpTable (Table->Length, Offset, SubTable,
+        Status = AcpiDmDumpTable (Length, Offset, SubTable,
             SubTable->Length, InfoTable);
         if (ACPI_FAILURE (Status))
         {
@@ -3396,13 +3505,14 @@
 {
     ACPI_STATUS             Status;
     char                    *Namepath;
-    UINT32                  Length = Table->Length;
+    UINT32                  Length;
     UINT32                  StringLength;
     UINT32                  Offset = sizeof (ACPI_TABLE_STAO);
 
 
     /* Main table */
 
+    ACPI_MOVE_32_TO_32(&Length, &Table->Length);
     Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoStao);
     if (ACPI_FAILURE (Status))
     {
@@ -3411,7 +3521,7 @@
 
     /* The rest of the table consists of Namepath strings */
 
-    while (Offset < Table->Length)
+    while (Offset < Length)
     {
         Namepath = ACPI_ADD_PTR (char, Table, Offset);
         StringLength = strlen (Namepath) + 1;
@@ -3453,11 +3563,14 @@
     ACPI_TABLE_TCPA_HDR     *SubTable = ACPI_ADD_PTR (
                                 ACPI_TABLE_TCPA_HDR, Table, Offset);
     ACPI_STATUS             Status;
+    UINT32		    Length;
+    UINT16		    PlatformClass;
 
 
     /* Main table */
 
-    Status = AcpiDmDumpTable (Table->Length, 0, Table,
+    ACPI_MOVE_32_TO_32(&Length, &Table->Length);
+    Status = AcpiDmDumpTable (Length, 0, Table,
         0, AcpiDmTableInfoTcpaHdr);
     if (ACPI_FAILURE (Status))
     {
@@ -3468,18 +3581,19 @@
      * Examine the PlatformClass field to determine the table type.
      * Either a client or server table. Only one.
      */
-    switch (CommonHeader->PlatformClass)
+    ACPI_MOVE_16_TO_16(&PlatformClass, &CommonHeader->PlatformClass);
+    switch (PlatformClass)
     {
     case ACPI_TCPA_CLIENT_TABLE:
 
-        Status = AcpiDmDumpTable (Table->Length, Offset, SubTable,
-            Table->Length - Offset, AcpiDmTableInfoTcpaClient);
+        Status = AcpiDmDumpTable (Length, Offset, SubTable,
+            Length - Offset, AcpiDmTableInfoTcpaClient);
         break;
 
     case ACPI_TCPA_SERVER_TABLE:
 
-        Status = AcpiDmDumpTable (Table->Length, Offset, SubTable,
-            Table->Length - Offset, AcpiDmTableInfoTcpaServer);
+        Status = AcpiDmDumpTable (Length, Offset, SubTable,
+            Length - Offset, AcpiDmTableInfoTcpaServer);
         break;
 
     default:
@@ -3516,11 +3630,13 @@
     ACPI_STATUS             Status;
     UINT32                  Offset = sizeof (ACPI_TABLE_VRTC);
     ACPI_VRTC_ENTRY         *SubTable;
+    UINT32		    Length;
 
 
     /* Main table */
 
-    Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoVrtc);
+    ACPI_MOVE_32_TO_32(&Length, &Table->Length);
+    Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoVrtc);
     if (ACPI_FAILURE (Status))
     {
         return;
@@ -3529,12 +3645,12 @@
     /* Subtables */
 
     SubTable = ACPI_ADD_PTR (ACPI_VRTC_ENTRY, Table, Offset);
-    while (Offset < Table->Length)
+    while (Offset < Length)
     {
         /* Common subtable header */
 
         AcpiOsPrintf ("\n");
-        Status = AcpiDmDumpTable (Table->Length, Offset, SubTable,
+        Status = AcpiDmDumpTable (Length, Offset, SubTable,
             sizeof (ACPI_VRTC_ENTRY), AcpiDmTableInfoVrtc0);
         if (ACPI_FAILURE (Status))
         {
@@ -3569,11 +3685,13 @@
     ACPI_STATUS             Status;
     UINT32                  Offset = sizeof (ACPI_TABLE_WDAT);
     ACPI_WDAT_ENTRY         *SubTable;
+    UINT32		    Length;
 
 
     /* Main table */
 
-    Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoWdat);
+    ACPI_MOVE_32_TO_32(&Length, &Table->Length);
+    Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoWdat);
     if (ACPI_FAILURE (Status))
     {
         return;
@@ -3582,12 +3700,12 @@
     /* Subtables */
 
     SubTable = ACPI_ADD_PTR (ACPI_WDAT_ENTRY, Table, Offset);
-    while (Offset < Table->Length)
+    while (Offset < Length)
     {
         /* Common subtable header */
 
         AcpiOsPrintf ("\n");
-        Status = AcpiDmDumpTable (Table->Length, Offset, SubTable,
+        Status = AcpiDmDumpTable (Length, Offset, SubTable,
             sizeof (ACPI_WDAT_ENTRY), AcpiDmTableInfoWdat0);
         if (ACPI_FAILURE (Status))
         {
@@ -3622,12 +3740,13 @@
 {
     ACPI_STATUS             Status;
     ACPI_TABLE_WPBT         *SubTable;
-    UINT32                  Length = Table->Length;
+    UINT32                  Length;
     UINT16                  ArgumentsLength;
 
 
     /* Dump the main table */
 
+    ACPI_MOVE_32_TO_32(&Length, &Table->Length);
     Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoWpbt);
     if (ACPI_FAILURE (Status))
     {
@@ -3637,10 +3756,10 @@
     /* Extract the arguments buffer length from the main table */
 
     SubTable = ACPI_CAST_PTR (ACPI_TABLE_WPBT, Table);
-    ArgumentsLength = SubTable->ArgumentsLength;
+    ACPI_MOVE_16_TO_16(&ArgumentsLength, &SubTable->ArgumentsLength);
 
     /* Dump the arguments buffer */
 
-    (void) AcpiDmDumpTable (Table->Length, 0, Table, ArgumentsLength,
+    (void) AcpiDmDumpTable (Length, 0, Table, ArgumentsLength,
         AcpiDmTableInfoWpbt0);
 }
diff -Naur acpica-unix2-20160930/source/components/disassembler/dmbuffer.c acpica-unix2-20160930-s390/source/components/disassembler/dmbuffer.c
--- acpica-unix2-20160930/source/components/disassembler/dmbuffer.c	2016-09-30 10:43:58.000000000 -0600
+++ acpica-unix2-20160930-s390/source/components/disassembler/dmbuffer.c	2016-10-28 14:25:41.876397798 -0600
@@ -204,7 +204,7 @@
 
 
     ByteData = Op->Named.Data;
-    ByteCount = (UINT32) Op->Common.Value.Integer;
+    ByteCount = (UINT32) Op->Common.Value.Size;
 
     /*
      * The byte list belongs to a buffer, and can be produced by either
@@ -304,7 +304,8 @@
     /* Extract the byte list info */
 
     ByteData = NextOp->Named.Data;
-    ByteCount = (UINT32) NextOp->Common.Value.Integer;
+    /* ByteCount = (UINT32) NextOp->Common.Value.Integer; */
+    ByteCount = (UINT32) NextOp->Common.Value.Size;
 
     /* Byte count must be exactly 16 */
 
@@ -954,16 +955,18 @@
     ACPI_PARSE_OBJECT       *Op)
 {
     UINT32                  Name;
+    UINT32                  TmpName;
     ACPI_PARSE_OBJECT       *NextOp;
 
 
     /* Get the NameSegment */
 
-    Name = AcpiPsGetName (Op);
-    if (!Name)
+    TmpName = AcpiPsGetName (Op);
+    if (!TmpName)
     {
         return;
     }
+    ACPI_MOVE_32_TO_32(&Name, &TmpName);
 
     NextOp = AcpiPsGetDepthNext (NULL, Op);
     if (!NextOp)
diff -Naur acpica-unix2-20160930/source/components/disassembler/dmopcode.c acpica-unix2-20160930-s390/source/components/disassembler/dmopcode.c
--- acpica-unix2-20160930/source/components/disassembler/dmopcode.c	2016-09-30 10:43:58.000000000 -0600
+++ acpica-unix2-20160930-s390/source/components/disassembler/dmopcode.c	2016-10-28 14:25:41.877397793 -0600
@@ -244,6 +244,7 @@
     char                        *NameString;
     int                         LastCharIsDigit;
     int                         LastCharsAreHex;
+    char			TmpName[ACPI_NAME_SIZE + 1];
 
 
     if (!Op)
@@ -261,7 +262,9 @@
 
     /* Predefined name must start with an underscore */
 
-    NameString = ACPI_CAST_PTR (char, &Op->Named.Name);
+    memset(TmpName, 0, ACPI_NAME_SIZE + 1);
+    ACPI_MOVE_32_TO_32(TmpName, &Op->Named.Name);
+    NameString = TmpName;
     if (NameString[0] != '_')
     {
         return;
@@ -871,21 +874,26 @@
         AcpiDmNamestring (Op->Common.Value.Name);
         break;
 
-    case AML_INT_NAMEDFIELD_OP:
+    case AML_INT_NAMEDFIELD_OP: {
 
-        Length = AcpiDmDumpName (Op->Named.Name);
+	UINT32 TmpName;
+
+	ACPI_MOVE_32_TO_32(&TmpName, &Op->Named.Name);
+        Length = AcpiDmDumpName (TmpName);
         AcpiOsPrintf (",%*.s  %u", (unsigned) (5 - Length), " ",
-            (UINT32) Op->Common.Value.Integer);
+            (UINT32) Op->Common.Value.Size);
         AcpiDmCommaIfFieldMember (Op);
 
-        Info->BitOffset += (UINT32) Op->Common.Value.Integer;
+        Info->BitOffset += (UINT32) Op->Common.Value.Size;
         break;
+    }
 
     case AML_INT_RESERVEDFIELD_OP:
 
         /* Offset() -- Must account for previous offsets */
 
-        Offset = (UINT32) Op->Common.Value.Integer;
+	//DEBUG
+        Offset = Op->Common.Value.Size;
         Info->BitOffset += Offset;
 
         if (Info->BitOffset % 8 == 0)
diff -Naur acpica-unix2-20160930/source/components/disassembler/dmresrc.c acpica-unix2-20160930-s390/source/components/disassembler/dmresrc.c
--- acpica-unix2-20160930/source/components/disassembler/dmresrc.c	2016-09-30 10:43:58.000000000 -0600
+++ acpica-unix2-20160930-s390/source/components/disassembler/dmresrc.c	2016-10-28 14:25:41.878397788 -0600
@@ -392,7 +392,7 @@
     ACPI_PARSE_OBJECT       *NextOp;
     UINT8                   *Aml;
     UINT8                   *EndAml;
-    ACPI_SIZE               Length;
+    UINT32                  Length;
 
 
     /* This op must be a buffer */
@@ -418,7 +418,7 @@
     }
 
     Aml = NextOp->Named.Data;
-    Length = (ACPI_SIZE) NextOp->Common.Value.Integer;
+    Length = NextOp->Common.Value.Size;
 
     /* Walk the byte list, abort on any invalid descriptor type or length */
 
diff -Naur acpica-unix2-20160930/source/components/disassembler/dmresrcl.c acpica-unix2-20160930-s390/source/components/disassembler/dmresrcl.c
--- acpica-unix2-20160930/source/components/disassembler/dmresrcl.c	2016-09-30 10:43:58.000000000 -0600
+++ acpica-unix2-20160930-s390/source/components/disassembler/dmresrcl.c	2016-10-28 14:25:41.876397798 -0600
@@ -141,7 +141,8 @@
     UINT32                  Level)
 {
     UINT32                  i;
-
+    UINT16		    Tmp16;
+    UINT32		    Tmp32;
 
     for (i = 0; i < 4; i++)
     {
@@ -151,14 +152,14 @@
         {
         case 16:
 
-            AcpiDmDumpInteger16 (ACPI_CAST_PTR (UINT16, Source)[i],
-                AcpiDmMemoryNames[i]);
+	    ACPI_MOVE_16_TO_16(&Tmp16, &(ACPI_CAST_PTR (UINT16, Source)[i]));
+            AcpiDmDumpInteger16 (Tmp16, AcpiDmMemoryNames[i]);
             break;
 
         case 32:
 
-            AcpiDmDumpInteger32 (ACPI_CAST_PTR (UINT32, Source)[i],
-                AcpiDmMemoryNames[i]);
+	    ACPI_MOVE_32_TO_32(&Tmp32, &(ACPI_CAST_PTR (UINT32, Source)[i]));
+            AcpiDmDumpInteger32 (Tmp32, AcpiDmMemoryNames[i]);
             break;
 
         default:
@@ -190,7 +191,9 @@
     UINT32                  Level)
 {
     UINT32                  i;
-
+    UINT16		    Tmp16;
+    UINT32		    Tmp32;
+    UINT64		    Tmp64;
 
     AcpiOsPrintf ("\n");
 
@@ -202,20 +205,20 @@
         {
         case 16:
 
-            AcpiDmDumpInteger16 (ACPI_CAST_PTR (UINT16, Source)[i],
-                AcpiDmAddressNames[i]);
+	    ACPI_MOVE_16_TO_16(&Tmp16, &(ACPI_CAST_PTR (UINT16, Source)[i]));
+            AcpiDmDumpInteger16 (Tmp16, AcpiDmAddressNames[i]);
             break;
 
         case 32:
 
-            AcpiDmDumpInteger32 (ACPI_CAST_PTR (UINT32, Source)[i],
-                AcpiDmAddressNames[i]);
+	    ACPI_MOVE_32_TO_32(&Tmp32, &(ACPI_CAST_PTR (UINT32, Source)[i]));
+            AcpiDmDumpInteger32 (Tmp32, AcpiDmAddressNames[i]);
             break;
 
         case 64:
 
-            AcpiDmDumpInteger64 (ACPI_CAST_PTR (UINT64, Source)[i],
-                AcpiDmAddressNames[i]);
+	    ACPI_MOVE_64_TO_64(&Tmp64, &(ACPI_CAST_PTR (UINT64, Source)[i]));
+            AcpiDmDumpInteger64 (Tmp64, AcpiDmAddressNames[i]);
             break;
 
         default:
@@ -868,6 +871,7 @@
     UINT32                  Length,
     UINT32                  Level)
 {
+    UINT32 Tmp;
 
     /* Dump name and read/write flag */
 
@@ -876,12 +880,12 @@
         AcpiGbl_RwDecode [ACPI_GET_1BIT_FLAG (Resource->FixedMemory32.Flags)]);
 
     AcpiDmIndent (Level + 1);
-    AcpiDmDumpInteger32 (Resource->FixedMemory32.Address,
-        "Address Base");
+    ACPI_MOVE_32_TO_32(&Tmp, &Resource->FixedMemory32.Address);
+    AcpiDmDumpInteger32 (Tmp, "Address Base");
 
     AcpiDmIndent (Level + 1);
-    AcpiDmDumpInteger32 (Resource->FixedMemory32.AddressLength,
-        "Address Length");
+    ACPI_MOVE_32_TO_32(&Tmp, &Resource->FixedMemory32.AddressLength);
+    AcpiDmDumpInteger32 (Tmp, "Address Length");
 
     /* Insert a descriptor name */
 
@@ -972,7 +976,7 @@
     UINT32                  Level)
 {
     UINT32                  i;
-
+    UINT16		    Tmp16;
 
     AcpiDmIndent (Level);
     AcpiOsPrintf ("Interrupt (%s, %s, %s, %s, ",
@@ -986,10 +990,11 @@
      * list. Must compute length based on length of the list. First xrupt
      * is included in the struct (reason for -1 below)
      */
+    ACPI_MOVE_16_TO_16(&Tmp16, &Resource->ExtendedIrq.ResourceLength);
     AcpiDmResourceSource (Resource,
         sizeof (AML_RESOURCE_EXTENDED_IRQ) +
             ((UINT32) Resource->ExtendedIrq.InterruptCount - 1) * sizeof (UINT32),
-        Resource->ExtendedIrq.ResourceLength);
+        Tmp16);
 
     /* Insert a descriptor name */
 
@@ -1002,9 +1007,12 @@
     AcpiOsPrintf ("{\n");
     for (i = 0; i < Resource->ExtendedIrq.InterruptCount; i++)
     {
+	UINT32 Tmp32, Val32;
+
         AcpiDmIndent (Level + 1);
-        AcpiOsPrintf ("0x%8.8X,\n",
-            (UINT32) Resource->ExtendedIrq.Interrupts[i]);
+	Val32 = (UINT32) Resource->ExtendedIrq.Interrupts[i];
+	ACPI_MOVE_32_TO_32(&Tmp32, &Val32);
+        AcpiOsPrintf ("0x%8.8X,\n", Tmp32);
     }
 
     AcpiDmIndent (Level);
diff -Naur acpica-unix2-20160930/source/components/disassembler/dmresrcs.c acpica-unix2-20160930-s390/source/components/disassembler/dmresrcs.c
--- acpica-unix2-20160930/source/components/disassembler/dmresrcs.c	2016-09-30 10:43:58.000000000 -0600
+++ acpica-unix2-20160930-s390/source/components/disassembler/dmresrcs.c	2016-10-28 14:25:41.876397798 -0600
@@ -72,6 +72,7 @@
     UINT32                  Length,
     UINT32                  Level)
 {
+    UINT16 Tmp;
 
     AcpiDmIndent (Level);
     AcpiOsPrintf ("%s (",
@@ -93,7 +94,8 @@
     AcpiOsPrintf (")\n");
 
     AcpiDmIndent (Level + 1);
-    AcpiDmBitList (Resource->Irq.IrqMask);
+    ACPI_MOVE_16_TO_16(&Tmp, &Resource->Irq.IrqMask);
+    AcpiDmBitList (Tmp);
 }
 
 
@@ -204,16 +206,19 @@
     UINT32                  Length,
     UINT32                  Level)
 {
+    UINT16 Tmp16;
 
     AcpiDmIndent (Level);
     AcpiOsPrintf ("IO (%s,\n",
         AcpiGbl_IoDecode [ACPI_GET_1BIT_FLAG (Resource->Io.Flags)]);
 
     AcpiDmIndent (Level + 1);
-    AcpiDmDumpInteger16 (Resource->Io.Minimum, "Range Minimum");
+    ACPI_MOVE_16_TO_16(&Tmp16, &Resource->Io.Minimum);
+    AcpiDmDumpInteger16 (Tmp16, "Range Minimum");
 
     AcpiDmIndent (Level + 1);
-    AcpiDmDumpInteger16 (Resource->Io.Maximum, "Range Maximum");
+    ACPI_MOVE_16_TO_16(&Tmp16, &Resource->Io.Maximum);
+    AcpiDmDumpInteger16 (Tmp16, "Range Maximum");
 
     AcpiDmIndent (Level + 1);
     AcpiDmDumpInteger8 (Resource->Io.Alignment, "Alignment");
diff -Naur acpica-unix2-20160930/source/components/dispatcher/dsfield.c acpica-unix2-20160930-s390/source/components/dispatcher/dsfield.c
--- acpica-unix2-20160930/source/components/dispatcher/dsfield.c	2016-09-30 10:43:58.000000000 -0600
+++ acpica-unix2-20160930-s390/source/components/dispatcher/dsfield.c	2016-10-28 14:25:41.879397782 -0600
@@ -318,6 +318,7 @@
     ACPI_STATUS             Status;
     UINT64                  Position;
     ACPI_PARSE_OBJECT       *Child;
+    UINT32 TmpName;
 
 
     ACPI_FUNCTION_TRACE_PTR (DsGetFieldNames, Info);
@@ -424,10 +425,17 @@
 
             /* Lookup the name, it should already exist */
 
+	    ACPI_MOVE_32_TO_32(&TmpName, &Arg->Named.Name);
+            Status = AcpiNsLookup (WalkState->ScopeInfo,
+                (char *) &TmpName, Info->FieldType,
+                ACPI_IMODE_EXECUTE, ACPI_NS_DONT_OPEN_SCOPE,
+                WalkState, &Info->FieldNode);
+	/*
             Status = AcpiNsLookup (WalkState->ScopeInfo,
                 (char *) &Arg->Named.Name, Info->FieldType,
                 ACPI_IMODE_EXECUTE, ACPI_NS_DONT_OPEN_SCOPE,
                 WalkState, &Info->FieldNode);
+	*/
             if (ACPI_FAILURE (Status))
             {
                 ACPI_ERROR_NAMESPACE ((char *) &Arg->Named.Name, Status);
@@ -652,9 +660,17 @@
          */
         if (Arg->Common.AmlOpcode == AML_INT_NAMEDFIELD_OP)
         {
+	    UINT32 TmpName;
+
+            ACPI_MOVE_32_TO_32(&TmpName, &Arg->Named.Name);
+            Status = AcpiNsLookup (WalkState->ScopeInfo,
+                (char *) &TmpName, Type, ACPI_IMODE_LOAD_PASS1,
+                Flags, WalkState, &Node);
+	/*
             Status = AcpiNsLookup (WalkState->ScopeInfo,
                 (char *) &Arg->Named.Name, Type, ACPI_IMODE_LOAD_PASS1,
                 Flags, WalkState, &Node);
+	*/
             if (ACPI_FAILURE (Status))
             {
                 ACPI_ERROR_NAMESPACE ((char *) &Arg->Named.Name, Status);
diff -Naur acpica-unix2-20160930/source/components/namespace/nsparse.c acpica-unix2-20160930-s390/source/components/namespace/nsparse.c
--- acpica-unix2-20160930/source/components/namespace/nsparse.c	2016-09-30 10:43:59.000000000 -0600
+++ acpica-unix2-20160930-s390/source/components/namespace/nsparse.c	2016-10-28 14:25:41.895397700 -0600
@@ -196,13 +196,14 @@
 
     /* Table must consist of at least a complete header */
 
-    if (Table->Length < sizeof (ACPI_TABLE_HEADER))
+    ACPI_MOVE_32_TO_32(&AmlLength, &Table->Length);
+    if (AmlLength < sizeof (ACPI_TABLE_HEADER))
     {
         return_ACPI_STATUS (AE_BAD_HEADER);
     }
 
     AmlStart = (UINT8 *) Table + sizeof (ACPI_TABLE_HEADER);
-    AmlLength = Table->Length - sizeof (ACPI_TABLE_HEADER);
+    AmlLength -= sizeof (ACPI_TABLE_HEADER);
 
     Status = AcpiTbGetOwnerId (TableIndex, &OwnerId);
     if (ACPI_FAILURE (Status))
diff -Naur acpica-unix2-20160930/source/components/tables/tbprint.c acpica-unix2-20160930-s390/source/components/tables/tbprint.c
--- acpica-unix2-20160930/source/components/tables/tbprint.c	2016-09-30 10:43:59.000000000 -0600
+++ acpica-unix2-20160930-s390/source/components/tables/tbprint.c	2016-10-28 14:25:41.902397665 -0600
@@ -143,15 +143,18 @@
     ACPI_TABLE_HEADER       *Header)
 {
     ACPI_TABLE_HEADER       LocalHeader;
+    UINT32		    Len;
+    UINT32		    OemRev;
+    UINT32		    CompilerRev;
 
 
     if (ACPI_COMPARE_NAME (Header->Signature, ACPI_SIG_FACS))
     {
         /* FACS only has signature and length fields */
 
+	ACPI_MOVE_32_TO_32(&Len, &Header->Length);
         ACPI_INFO (("%-4.4s 0x%8.8X%8.8X %06X",
-            Header->Signature, ACPI_FORMAT_UINT64 (Address),
-            Header->Length));
+            Header->Signature, ACPI_FORMAT_UINT64 (Address), Len));
     }
     else if (ACPI_VALIDATE_RSDP_SIG (Header->Signature))
     {
@@ -174,13 +177,16 @@
 
         AcpiTbCleanupTableHeader (&LocalHeader, Header);
 
+	ACPI_MOVE_32_TO_32(&Len, &LocalHeader.Length);
+	ACPI_MOVE_32_TO_32(&OemRev, &LocalHeader.OemRevision);
+	ACPI_MOVE_32_TO_32(&CompilerRev, &LocalHeader.AslCompilerRevision);
         ACPI_INFO ((
             "%-4.4s 0x%8.8X%8.8X"
             " %06X (v%.2d %-6.6s %-8.8s %08X %-4.4s %08X)",
             LocalHeader.Signature, ACPI_FORMAT_UINT64 (Address),
-            LocalHeader.Length, LocalHeader.Revision, LocalHeader.OemId,
-            LocalHeader.OemTableId, LocalHeader.OemRevision,
-            LocalHeader.AslCompilerId, LocalHeader.AslCompilerRevision));
+            Len, LocalHeader.Revision, LocalHeader.OemId,
+            LocalHeader.OemTableId, OemRev,
+            LocalHeader.AslCompilerId, CompilerRev));
     }
 }
 
diff -Naur acpica-unix2-20160930/source/include/platform/aclinux.h acpica-unix2-20160930-s390/source/include/platform/aclinux.h
--- acpica-unix2-20160930/source/include/platform/aclinux.h	2016-10-28 14:24:20.839813236 -0600
+++ acpica-unix2-20160930-s390/source/include/platform/aclinux.h	2016-10-28 14:25:41.909397629 -0600
@@ -210,6 +210,10 @@
 #define __cdecl
 #endif
 
+#if defined(__PPC64__) || defined(__s390x__)
+#define ACPI_BIG_ENDIAN
+#endif
+
 #endif /* __KERNEL__ */
 
 #endif /* __ACLINUX_H__ */