Print this page
update to acpica-unix2-20140114
acpica-unix2-20130823
PANKOVs restructure

@@ -3,11 +3,11 @@
  * Module Name: exoparg2 - AML execution - opcodes with 2 arguments
  *
  *****************************************************************************/
 
 /*
- * Copyright (C) 2000 - 2011, Intel Corp.
+ * Copyright (C) 2000 - 2014, Intel Corp.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * are met:

@@ -142,11 +142,10 @@
          * control methods.
          */
         Status = AcpiEvQueueNotifyRequest (Node, Value);
         break;
 
-
     default:
 
         ACPI_ERROR ((AE_INFO, "Unknown AML opcode 0x%X",
             WalkState->Opcode));
         Status = AE_AML_BAD_OPCODE;

@@ -215,11 +214,10 @@
         {
             goto Cleanup;
         }
         break;
 
-
     default:
 
         ACPI_ERROR ((AE_INFO, "Unknown AML opcode 0x%X",
             WalkState->Opcode));
         Status = AE_AML_BAD_OPCODE;

@@ -284,11 +282,11 @@
 {
     ACPI_OPERAND_OBJECT     **Operand = &WalkState->Operands[0];
     ACPI_OPERAND_OBJECT     *ReturnDesc = NULL;
     UINT64                  Index;
     ACPI_STATUS             Status = AE_OK;
-    ACPI_SIZE               Length;
+    ACPI_SIZE               Length = 0;
 
 
     ACPI_FUNCTION_TRACE_STR (ExOpcode_2A_1T_1R,
         AcpiPsGetOpcodeName (WalkState->Opcode));
 

@@ -329,20 +327,17 @@
                                Operand[1]->Integer.Value,
                                NULL,
                                &ReturnDesc->Integer.Value);
         break;
 
-
     case AML_CONCAT_OP: /* Concatenate (Data1, Data2, Result) */
 
         Status = AcpiExDoConcatenate (Operand[0], Operand[1],
                     &ReturnDesc, WalkState);
         break;
 
-
     case AML_TO_STRING_OP: /* ToString (Buffer, Length, Result) (ACPI 2.0) */
-
         /*
          * Input object is guaranteed to be a buffer at this point (it may have
          * been converted.)  Copy the raw buffer data to a new object of
          * type String.
          */

@@ -354,11 +349,10 @@
          * 3) Length of input buffer up to a zero byte (null terminator)
          *
          * NOTE: A length of zero is ok, and will create a zero-length, null
          *       terminated string.
          */
-        Length = 0;
         while ((Length < Operand[0]->Buffer.Length) &&
                (Length < Operand[1]->Integer.Value) &&
                (Operand[0]->Buffer.Pointer[Length]))
         {
             Length++;

@@ -379,20 +373,18 @@
          */
         ACPI_MEMCPY (ReturnDesc->String.Pointer,
             Operand[0]->Buffer.Pointer, Length);
         break;
 
-
     case AML_CONCAT_RES_OP:
 
         /* ConcatenateResTemplate (Buffer, Buffer, Result) (ACPI 2.0) */
 
         Status = AcpiExConcatTemplate (Operand[0], Operand[1],
                     &ReturnDesc, WalkState);
         break;
 
-
     case AML_INDEX_OP:              /* Index (Source Index Result) */
 
         /* Create the internal return object */
 
         ReturnDesc = AcpiUtCreateInternalObject (ACPI_TYPE_LOCAL_REFERENCE);

@@ -416,10 +408,11 @@
         {
         case ACPI_TYPE_STRING:
 
             if (Index >= Operand[0]->String.Length)
             {
+                Length = Operand[0]->String.Length;
                 Status = AE_AML_STRING_LIMIT;
             }
 
             ReturnDesc->Reference.TargetType = ACPI_TYPE_BUFFER_FIELD;
             break;

@@ -426,10 +419,11 @@
 
         case ACPI_TYPE_BUFFER:
 
             if (Index >= Operand[0]->Buffer.Length)
             {
+                Length = Operand[0]->Buffer.Length;
                 Status = AE_AML_BUFFER_LIMIT;
             }
 
             ReturnDesc->Reference.TargetType = ACPI_TYPE_BUFFER_FIELD;
             break;

@@ -436,10 +430,11 @@
 
         case ACPI_TYPE_PACKAGE:
 
             if (Index >= Operand[0]->Package.Count)
             {
+                Length = Operand[0]->Package.Count;
                 Status = AE_AML_PACKAGE_LIMIT;
             }
 
             ReturnDesc->Reference.TargetType = ACPI_TYPE_PACKAGE;
             ReturnDesc->Reference.Where = &Operand[0]->Package.Elements [Index];

@@ -454,12 +449,12 @@
         /* Failure means that the Index was beyond the end of the object */
 
         if (ACPI_FAILURE (Status))
         {
             ACPI_EXCEPTION ((AE_INFO, Status,
-                "Index (0x%8.8X%8.8X) is beyond end of object",
-                ACPI_FORMAT_UINT64 (Index)));
+                "Index (0x%X%8.8X) is beyond end of object (length 0x%X)",
+                ACPI_FORMAT_UINT64 (Index), (UINT32) Length));
             goto Cleanup;
         }
 
         /*
          * Save the target object and add a reference to it for the life

@@ -475,11 +470,10 @@
         /* Return the reference */
 
         WalkState->ResultObj = ReturnDesc;
         goto Cleanup;
 
-
     default:
 
         ACPI_ERROR ((AE_INFO, "Unknown AML opcode 0x%X",
             WalkState->Opcode));
         Status = AE_AML_BAD_OPCODE;

@@ -598,11 +592,10 @@
             LogicalResult = TRUE;       /* TRUE, Wait timed out */
             Status = AE_OK;
         }
         break;
 
-
     default:
 
         ACPI_ERROR ((AE_INFO, "Unknown AML opcode 0x%X",
             WalkState->Opcode));
         Status = AE_AML_BAD_OPCODE;

@@ -636,7 +629,5 @@
         WalkState->ResultObj = ReturnDesc;
     }
 
     return_ACPI_STATUS (Status);
 }
-
-