Support for executable code at module level

date	2005.05.25.22.16.00;	author rmoore1;	state Exp;
This commit is contained in:
aystarik 2005-06-29 17:14:27 +00:00
parent b081330c69
commit 4eb674d6fe

View File

@ -1,7 +1,7 @@
/****************************************************************************** /******************************************************************************
* *
* Module Name: dswload - Dispatcher namespace load callbacks * Module Name: dswload - Dispatcher namespace load callbacks
* $Revision: 1.92 $ * $Revision: 1.93 $
* *
*****************************************************************************/ *****************************************************************************/
@ -222,16 +222,6 @@ AcpiDsLoad1BeginOp (
{ {
if (!(WalkState->OpInfo->Flags & AML_NAMED)) if (!(WalkState->OpInfo->Flags & AML_NAMED))
{ {
#if 0
if ((WalkState->OpInfo->Class == AML_CLASS_EXECUTE) ||
(WalkState->OpInfo->Class == AML_CLASS_CONTROL))
{
AcpiOsPrintf ("\n\n***EXECUTABLE OPCODE %s***\n\n",
WalkState->OpInfo->Name);
*OutOp = Op;
return (AE_CTRL_SKIP);
}
#endif
*OutOp = Op; *OutOp = Op;
return (AE_OK); return (AE_OK);
} }
@ -588,6 +578,17 @@ AcpiDsLoad2BeginOp (
if (Op) if (Op)
{ {
if ((AcpiGbl_EnableInterpreterSlack) &&
(WalkState->ControlState) &&
(WalkState->ControlState->Common.State ==
ACPI_CONTROL_CONDITIONAL_EXECUTING))
{
/* We are executing a while loop outside of a method */
Status = AcpiDsExecBeginOp (WalkState, OutOp);
return_ACPI_STATUS (Status);
}
/* We only care about Namespace opcodes here */ /* We only care about Namespace opcodes here */
if ((!(WalkState->OpInfo->Flags & AML_NSOPCODE) && if ((!(WalkState->OpInfo->Flags & AML_NSOPCODE) &&
@ -597,9 +598,23 @@ AcpiDsLoad2BeginOp (
if ((WalkState->OpInfo->Class == AML_CLASS_EXECUTE) || if ((WalkState->OpInfo->Class == AML_CLASS_EXECUTE) ||
(WalkState->OpInfo->Class == AML_CLASS_CONTROL)) (WalkState->OpInfo->Class == AML_CLASS_CONTROL))
{ {
ACPI_REPORT_WARNING (( if (!AcpiGbl_EnableInterpreterSlack)
"Encountered executable code at module level, [%s]\n", {
AcpiPsGetOpcodeName (WalkState->Opcode))); ACPI_REPORT_WARNING ((
"Encountered executable code at module level, [%s]\n",
AcpiPsGetOpcodeName (WalkState->Opcode)));
}
else
{
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
"Begin/EXEC: %s (fl %8.8X)\n", WalkState->OpInfo->Name,
WalkState->OpInfo->Flags));
/* Executing a type1 or type2 opcode outside of a method */
Status = AcpiDsExecBeginOp (WalkState, OutOp);
return_ACPI_STATUS (Status);
}
} }
return_ACPI_STATUS (AE_OK); return_ACPI_STATUS (AE_OK);
} }
@ -774,8 +789,10 @@ AcpiDsLoad2BeginOp (
break; break;
} }
/* Add new entry into namespace */
Status = AcpiNsLookup (WalkState->ScopeInfo, BufferPtr, ObjectType, Status = AcpiNsLookup (WalkState->ScopeInfo, BufferPtr, ObjectType,
ACPI_IMODE_EXECUTE, ACPI_NS_NO_UPSEARCH, ACPI_IMODE_LOAD_PASS2, ACPI_NS_NO_UPSEARCH,
WalkState, &(Node)); WalkState, &(Node));
break; break;
} }
@ -786,7 +803,6 @@ AcpiDsLoad2BeginOp (
return_ACPI_STATUS (Status); return_ACPI_STATUS (Status);
} }
if (!Op) if (!Op)
{ {
/* Create a new op */ /* Create a new op */
@ -803,10 +819,7 @@ AcpiDsLoad2BeginOp (
{ {
Op->Named.Name = Node->Name.Integer; Op->Named.Name = Node->Name.Integer;
} }
if (OutOp) *OutOp = Op;
{
*OutOp = Op;
}
} }
/* /*
@ -853,11 +866,30 @@ AcpiDsLoad2EndOp (
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Opcode [%s] Op %p State %p\n", ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Opcode [%s] Op %p State %p\n",
WalkState->OpInfo->Name, Op, WalkState)); WalkState->OpInfo->Name, Op, WalkState));
/* Only interested in opcodes that have namespace objects */ /* Check if opcode had an associated namespace object */
if (!(WalkState->OpInfo->Flags & AML_NSOBJECT)) if (!(WalkState->OpInfo->Flags & AML_NSOBJECT))
{ {
return_ACPI_STATUS (AE_OK); #ifndef ACPI_NO_METHOD_EXECUTION
/* No namespace object. Executable opcode? */
if ((WalkState->OpInfo->Class == AML_CLASS_EXECUTE) ||
(WalkState->OpInfo->Class == AML_CLASS_CONTROL))
{
if (AcpiGbl_EnableInterpreterSlack)
{
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
"End/EXEC: %s (fl %8.8X)\n", WalkState->OpInfo->Name,
WalkState->OpInfo->Flags));
/* Executing a type1 or type2 opcode outside of a method */
Status = AcpiDsExecEndOp (WalkState);
return_ACPI_STATUS (Status);
}
}
#endif
return_ACPI_STATUS (AE_OK);
} }
if (Op->Common.AmlOpcode == AML_SCOPE_OP) if (Op->Common.AmlOpcode == AML_SCOPE_OP)
@ -866,7 +898,6 @@ AcpiDsLoad2EndOp (
"Ending scope Op=%p State=%p\n", Op, WalkState)); "Ending scope Op=%p State=%p\n", Op, WalkState));
} }
ObjectType = WalkState->OpInfo->ObjectType; ObjectType = WalkState->OpInfo->ObjectType;
/* /*
@ -1137,3 +1168,9 @@ Cleanup:
} }