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