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