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