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