Merge pull request #525 from SchmErik/iasl-external-method

iASL: save parameter count of external control method calls for analysis
This commit is contained in:
Robert Moore 2019-11-21 07:14:25 -08:00 committed by GitHub
commit 63d51bf098
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 43 additions and 11 deletions

View File

@ -222,11 +222,11 @@
/* Misc */
#define ASL_EXTERNAL_METHOD 255
#define ASL_ABORT TRUE
#define ASL_NO_ABORT FALSE
#define ASL_EOF ACPI_UINT32_MAX
#define ASL_IGNORE_LINE (ACPI_UINT32_MAX -1)
#define ASL_EXTERNAL_METHOD_UNKNOWN_PARAMS 255
#define ASL_ABORT TRUE
#define ASL_NO_ABORT FALSE
#define ASL_EOF ACPI_UINT32_MAX
#define ASL_IGNORE_LINE (ACPI_UINT32_MAX -1)
/* Listings */

View File

@ -986,12 +986,19 @@ FinishNode:
Op->Asl.Node = Node;
Node->Op = Op;
/* Set the actual data type if appropriate (EXTERNAL term only) */
/*
* Set the actual data type if appropriate (EXTERNAL term only)
* As of 11/19/2019, ASL External() does not support parameter
* counts. When an External method is loaded, the parameter count is
* unknown setting Node->Value to ASL_EXTERNAL_METHOD_UNKNOWN_PARAMS
* indicates that the parameter count for this method is unknown.
* This information is used in ASL cross reference to help determine the
* parameter count through method calls.
*/
if (ActualObjectType != ACPI_TYPE_ANY)
{
Node->Type = (UINT8) ActualObjectType;
Node->Value = ASL_EXTERNAL_METHOD;
Node->Value = ASL_EXTERNAL_METHOD_UNKNOWN_PARAMS;
}
if (Op->Asl.ParseOpcode == PARSEOP_METHOD)

View File

@ -1055,7 +1055,7 @@ XfNamespaceLocateBegin (
NextOp = NextOp->Asl.Next;
}
if (Node->Value != ASL_EXTERNAL_METHOD &&
if (Node->Value != ASL_EXTERNAL_METHOD_UNKNOWN_PARAMS &&
Op->Asl.Parent->Asl.ParseOpcode != PARSEOP_EXTERNAL)
{
/*
@ -1064,8 +1064,17 @@ XfNamespaceLocateBegin (
*/
if (PassedArgs != Node->Value)
{
sprintf (AslGbl_MsgBuffer, "%s requires %u", Op->Asl.ExternalName,
Node->Value);
if (Node->Flags & ANOBJ_IS_EXTERNAL)
{
sprintf (AslGbl_MsgBuffer,
"according to previous use, %s requires %u",
Op->Asl.ExternalName, Node->Value);
}
else
{
sprintf (AslGbl_MsgBuffer, "%s requires %u", Op->Asl.ExternalName,
Node->Value);
}
if (PassedArgs < Node->Value)
{
@ -1077,6 +1086,22 @@ XfNamespaceLocateBegin (
}
}
}
/*
* At this point, a method call to an external method has been
* detected. As of 11/19/2019, iASL does not support parameter counts
* for methods declared as external. Therefore, save the parameter
* count of the first method call and use this count check other
* method calls to ensure that the methods are being called with the
* same amount of parameters.
*/
else if (Node->Type == ACPI_TYPE_METHOD &&
(Node->Flags & ANOBJ_IS_EXTERNAL) &&
Node->Value == ASL_EXTERNAL_METHOD_UNKNOWN_PARAMS &&
Op->Asl.Parent->Asl.ParseOpcode != PARSEOP_EXTERNAL)
{
Node->Value = PassedArgs;
}
}
/* 4) Check for an ASL Field definition */