44a778
Patch carried over from the prior iasl package and updated.  This allows
44a778
for builds on systems requiring aligned memory access. Please see
44a778
http://lists.acpica.org/pipermail/devel/2010-July/000159.html.  Resolves
44a778
BZ#865013 and BZ#856856.
44a778
--
44a778
44a778
Add more platforms to the list of the ones requiring aligned memory access.
44a778
Also fix callsites where wrong assumptions where made in terms of aligment.
44a778
44a778
Signed-off-by: Mattia Dongili <malattia@linux.it>
44a778
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
44a778
---
44a778
 source/compiler/asltree.c             | 15 ++++++++++-----
44a778
 source/components/executer/exoparg2.c | 12 +++++++++---
44a778
 source/include/actypes.h              | 26 +++++++++++++-------------
44a778
 3 file modificati, 32 inserzioni(+), 21 rimozioni(-)
44a778
44a778
diff --git a/source/compiler/asltree.c b/source/compiler/asltree.c
44a778
index af67467..b7118b3 100644
44a778
--- a/source/compiler/asltree.c
44a778
+++ b/source/compiler/asltree.c
44a778
@@ -913,28 +913,31 @@ TrCreateValuedLeafNode (
44a778
         "Op %s  Value %8.8X%8.8X  ",
44a778
         Op->Asl.LineNumber, Op->Asl.Column, Op, UtGetOpName(ParseOpcode),
44a778
         ACPI_FORMAT_UINT64 (Value));
44a778
-    Op->Asl.Value.Integer = Value;
44a778
 
44a778
     switch (ParseOpcode)
44a778
     {
44a778
     case PARSEOP_STRING_LITERAL:
44a778
 
44a778
-        DbgPrint (ASL_PARSE_OUTPUT, "STRING->%s", Value);
44a778
+        Op->Asl.Value.String = (ACPI_STRING) (ACPI_SIZE) Value;
44a778
+        DbgPrint (ASL_PARSE_OUTPUT, "STRING->%s", Op->Asl.Value.String);
44a778
         break;
44a778
 
44a778
     case PARSEOP_NAMESEG:
44a778
 
44a778
-        DbgPrint (ASL_PARSE_OUTPUT, "NAMESEG->%s", Value);
44a778
+        Op->Asl.Value.String = (ACPI_STRING) (ACPI_SIZE) Value;
44a778
+        DbgPrint (ASL_PARSE_OUTPUT, "NAMESEG->%s", Op->Asl.Value.String);
44a778
         break;
44a778
 
44a778
     case PARSEOP_NAMESTRING:
44a778
 
44a778
-        DbgPrint (ASL_PARSE_OUTPUT, "NAMESTRING->%s", Value);
44a778
+        Op->Asl.Value.String = (ACPI_STRING) (ACPI_SIZE) Value;
44a778
+        DbgPrint (ASL_PARSE_OUTPUT, "NAMESTRING->%s", Op->Asl.Value.String);
44a778
         break;
44a778
 
44a778
     case PARSEOP_EISAID:
44a778
 
44a778
-        DbgPrint (ASL_PARSE_OUTPUT, "EISAID->%s", Value);
44a778
+        Op->Asl.Value.String = (ACPI_STRING) (ACPI_SIZE) Value;
44a778
+        DbgPrint (ASL_PARSE_OUTPUT, "EISAID->%s", Op->Asl.Value.String);
44a778
         break;
44a778
 
44a778
     case PARSEOP_METHOD:
44a778
@@ -944,12 +947,14 @@ TrCreateValuedLeafNode (
44a778
 
44a778
     case PARSEOP_INTEGER:
44a778
 
44a778
+        Op->Asl.Value.Integer = Value;
44a778
         DbgPrint (ASL_PARSE_OUTPUT, "INTEGER->%8.8X%8.8X",
44a778
             ACPI_FORMAT_UINT64 (Value));
44a778
         break;
44a778
 
44a778
     default:
44a778
 
44a778
+        Op->Asl.Value.Integer = Value;
44a778
         break;
44a778
     }
44a778
 
44a778
diff --git a/source/components/executer/exoparg2.c b/source/components/executer/exoparg2.c
44a778
index 7fe91a8..5c6af04 100644
44a778
--- a/source/components/executer/exoparg2.c
44a778
+++ b/source/components/executer/exoparg2.c
44a778
@@ -172,6 +172,8 @@ AcpiExOpcode_2A_2T_1R (
44a778
     ACPI_OPERAND_OBJECT     **Operand = &WalkState->Operands[0];
44a778
     ACPI_OPERAND_OBJECT     *ReturnDesc1 = NULL;
44a778
     ACPI_OPERAND_OBJECT     *ReturnDesc2 = NULL;
44a778
+    UINT64                  ReturnValue1 = 0;
44a778
+    UINT64                  ReturnValue2 = 0;
44a778
     ACPI_STATUS             Status;
44a778
 
44a778
 
44a778
@@ -206,8 +208,10 @@ AcpiExOpcode_2A_2T_1R (
44a778
         Status = AcpiUtDivide (
44a778
             Operand[0]->Integer.Value,
44a778
             Operand[1]->Integer.Value,
44a778
-            &ReturnDesc1->Integer.Value,
44a778
-            &ReturnDesc2->Integer.Value);
44a778
+            &ReturnValue1, &ReturnValue2);
44a778
+        ReturnDesc1->Integer.Value = ReturnValue1;
44a778
+        ReturnDesc2->Integer.Value = ReturnValue2;
44a778
+
44a778
         if (ACPI_FAILURE (Status))
44a778
         {
44a778
             goto Cleanup;
44a778
@@ -282,6 +286,7 @@ AcpiExOpcode_2A_1T_1R (
44a778
     ACPI_OPERAND_OBJECT     **Operand = &WalkState->Operands[0];
44a778
     ACPI_OPERAND_OBJECT     *ReturnDesc = NULL;
44a778
     UINT64                  Index;
44a778
+    UINT64                  ReturnValue = 0;
44a778
     ACPI_STATUS             Status = AE_OK;
44a778
     ACPI_SIZE               Length = 0;
44a778
 
44a778
@@ -327,7 +332,8 @@ AcpiExOpcode_2A_1T_1R (
44a778
             Operand[0]->Integer.Value,
44a778
             Operand[1]->Integer.Value,
44a778
             NULL,
44a778
-            &ReturnDesc->Integer.Value);
44a778
+            &ReturnValue);
44a778
+        ReturnDesc->Integer.Value = ReturnValue;
44a778
         break;
44a778
 
44a778
     case AML_CONCAT_OP: /* Concatenate (Data1, Data2, Result) */
44a778
diff --git a/source/include/actypes.h b/source/include/actypes.h
44a778
index 395b915..137d93f 100644
44a778
--- a/source/include/actypes.h
44a778
+++ b/source/include/actypes.h
44a778
@@ -143,6 +143,19 @@ typedef COMPILER_DEPENDENT_INT64        INT64;
44a778
  */
44a778
 #define ACPI_THREAD_ID                  UINT64
44a778
 
44a778
+/*
44a778
+ * In the case of the Itanium Processor Family (IPF), the hardware does not
44a778
+ * support misaligned memory transfers. Set the MISALIGNMENT_NOT_SUPPORTED flag
44a778
+ * to indicate that special precautions must be taken to avoid alignment faults.
44a778
+ * (IA64 or ia64 is currently used by existing compilers to indicate IPF.)
44a778
+ *
44a778
+ * Note: EM64T and other X86-64 processors support misaligned transfers,
44a778
+ * so there is no need to define this flag.
44a778
+ */
44a778
+#if defined (__IA64__) || defined (__ia64__) || defined(__alpha__) || defined(__sparc__) || defined(__hppa__) || defined(__arm__)
44a778
+#define ACPI_MISALIGNMENT_NOT_SUPPORTED
44a778
+#endif
44a778
+
44a778
 
44a778
 /*******************************************************************************
44a778
  *
44a778
@@ -169,19 +182,6 @@ typedef UINT64                          ACPI_PHYSICAL_ADDRESS;
44a778
 #define ACPI_SIZE_MAX                   ACPI_UINT64_MAX
44a778
 #define ACPI_USE_NATIVE_DIVIDE          /* Has native 64-bit integer support */
44a778
 
44a778
-/*
44a778
- * In the case of the Itanium Processor Family (IPF), the hardware does not
44a778
- * support misaligned memory transfers. Set the MISALIGNMENT_NOT_SUPPORTED flag
44a778
- * to indicate that special precautions must be taken to avoid alignment faults.
44a778
- * (IA64 or ia64 is currently used by existing compilers to indicate IPF.)
44a778
- *
44a778
- * Note: EM64T and other X86-64 processors support misaligned transfers,
44a778
- * so there is no need to define this flag.
44a778
- */
44a778
-#if defined (__IA64__) || defined (__ia64__)
44a778
-#define ACPI_MISALIGNMENT_NOT_SUPPORTED
44a778
-#endif
44a778
-
44a778
 
44a778
 /*******************************************************************************
44a778
  *