8c2ae8
Patch carried over from the prior iasl package and updated.  This allows
8c2ae8
for builds on systems requiring aligned memory access. Please see
8c2ae8
http://lists.acpica.org/pipermail/devel/2010-July/000159.html.  Resolves
8c2ae8
BZ#865013 and BZ#856856.
8c2ae8
--
8c2ae8
8c2ae8
Add more platforms to the list of the ones requiring aligned memory access.
8c2ae8
Also fix callsites where wrong assumptions where made in terms of aligment.
8c2ae8
8c2ae8
Signed-off-by: Mattia Dongili <malattia@linux.it>
8c2ae8
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
8c2ae8
---
8c2ae8
 source/components/executer/exoparg2.c |   12 +++++++++---
8c2ae8
 source/include/actypes.h              |   26 +++++++++++++-------------
8c2ae8
 3 files changed, 32 insertions(+), 21 deletions(-)
8c2ae8
8c2ae8
Index: acpica-unix2-20170728/source/components/executer/exoparg2.c
8c2ae8
===================================================================
8c2ae8
--- acpica-unix2-20170728.orig/source/components/executer/exoparg2.c
8c2ae8
+++ acpica-unix2-20170728/source/components/executer/exoparg2.c
8c2ae8
@@ -172,6 +172,8 @@ AcpiExOpcode_2A_2T_1R (
8c2ae8
     ACPI_OPERAND_OBJECT     **Operand = &WalkState->Operands[0];
8c2ae8
     ACPI_OPERAND_OBJECT     *ReturnDesc1 = NULL;
8c2ae8
     ACPI_OPERAND_OBJECT     *ReturnDesc2 = NULL;
8c2ae8
+    UINT64                  ReturnValue1 = 0;
8c2ae8
+    UINT64                  ReturnValue2 = 0;
8c2ae8
     ACPI_STATUS             Status;
8c2ae8
 
8c2ae8
 
8c2ae8
@@ -206,8 +208,10 @@ AcpiExOpcode_2A_2T_1R (
8c2ae8
         Status = AcpiUtDivide (
8c2ae8
             Operand[0]->Integer.Value,
8c2ae8
             Operand[1]->Integer.Value,
8c2ae8
-            &ReturnDesc1->Integer.Value,
8c2ae8
-            &ReturnDesc2->Integer.Value);
8c2ae8
+            &ReturnValue1, &ReturnValue2);
8c2ae8
+        ReturnDesc1->Integer.Value = ReturnValue1;
8c2ae8
+        ReturnDesc2->Integer.Value = ReturnValue2;
8c2ae8
+
8c2ae8
         if (ACPI_FAILURE (Status))
8c2ae8
         {
8c2ae8
             goto Cleanup;
8c2ae8
@@ -282,6 +286,7 @@ AcpiExOpcode_2A_1T_1R (
8c2ae8
     ACPI_OPERAND_OBJECT     **Operand = &WalkState->Operands[0];
8c2ae8
     ACPI_OPERAND_OBJECT     *ReturnDesc = NULL;
8c2ae8
     UINT64                  Index;
8c2ae8
+    UINT64                  ReturnValue = 0;
8c2ae8
     ACPI_STATUS             Status = AE_OK;
8c2ae8
     ACPI_SIZE               Length = 0;
8c2ae8
 
8c2ae8
@@ -327,7 +332,8 @@ AcpiExOpcode_2A_1T_1R (
8c2ae8
             Operand[0]->Integer.Value,
8c2ae8
             Operand[1]->Integer.Value,
8c2ae8
             NULL,
8c2ae8
-            &ReturnDesc->Integer.Value);
8c2ae8
+            &ReturnValue);
8c2ae8
+        ReturnDesc->Integer.Value = ReturnValue;
8c2ae8
         break;
8c2ae8
 
8c2ae8
     case AML_CONCATENATE_OP: /* Concatenate (Data1, Data2, Result) */
8c2ae8
Index: acpica-unix2-20170728/source/include/actypes.h
8c2ae8
===================================================================
8c2ae8
--- acpica-unix2-20170728.orig/source/include/actypes.h
8c2ae8
+++ acpica-unix2-20170728/source/include/actypes.h
8c2ae8
@@ -143,6 +143,19 @@ typedef COMPILER_DEPENDENT_INT64
8c2ae8
  */
8c2ae8
 #define ACPI_THREAD_ID                  UINT64
8c2ae8
 
8c2ae8
+/*
8c2ae8
+ * In the case of the Itanium Processor Family (IPF), the hardware does not
8c2ae8
+ * support misaligned memory transfers. Set the MISALIGNMENT_NOT_SUPPORTED flag
8c2ae8
+ * to indicate that special precautions must be taken to avoid alignment faults.
8c2ae8
+ * (IA64 or ia64 is currently used by existing compilers to indicate IPF.)
8c2ae8
+ *
8c2ae8
+ * Note: EM64T and other X86-64 processors support misaligned transfers,
8c2ae8
+ * so there is no need to define this flag.
8c2ae8
+ */
8c2ae8
+#if defined (__IA64__) || defined (__ia64__) || defined(__alpha__) || defined(__sparc__) || defined(__hppa__) || defined(__arm__)
8c2ae8
+#define ACPI_MISALIGNMENT_NOT_SUPPORTED
8c2ae8
+#endif
8c2ae8
+
8c2ae8
 
8c2ae8
 /*******************************************************************************
8c2ae8
  *
8c2ae8
@@ -170,20 +183,6 @@ typedef UINT64
8c2ae8
 #define ACPI_USE_NATIVE_DIVIDE          /* Has native 64-bit integer support */
8c2ae8
 #define ACPI_USE_NATIVE_MATH64          /* Has native 64-bit integer support */
8c2ae8
 
8c2ae8
-/*
8c2ae8
- * In the case of the Itanium Processor Family (IPF), the hardware does not
8c2ae8
- * support misaligned memory transfers. Set the MISALIGNMENT_NOT_SUPPORTED
8c2ae8
- * flag to indicate that special precautions must be taken to avoid alignment
8c2ae8
- * faults. (IA64 or ia64 is currently used by existing compilers to indicate
8c2ae8
- * IPF.)
8c2ae8
- *
8c2ae8
- * Note: EM64T and other X86-64 processors support misaligned transfers,
8c2ae8
- * so there is no need to define this flag.
8c2ae8
- */
8c2ae8
-#if defined (__IA64__) || defined (__ia64__)
8c2ae8
-#define ACPI_MISALIGNMENT_NOT_SUPPORTED
8c2ae8
-#endif
8c2ae8
-
8c2ae8
 
8c2ae8
 /*******************************************************************************
8c2ae8
  *