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