mirror of
https://github.com/acpica/acpica/
synced 2025-03-19 12:42:57 +03:00
iASL/DTC: Do not abort compiler on fatal errors.
We do not want to completely abort the compiler on "fatal" errors, simply should abort the current compile. This allows multiple compiles with a single (possibly wildcard) compiler invocation.
This commit is contained in:
parent
b26103533f
commit
67c2cd6f79
@ -292,9 +292,10 @@ DtGetParentSubtable (
|
||||
|
||||
/* dtexpress - Integer expressions and labels */
|
||||
|
||||
UINT64
|
||||
ACPI_STATUS
|
||||
DtResolveIntegerExpression (
|
||||
DT_FIELD *Field);
|
||||
DT_FIELD *Field,
|
||||
UINT64 *ReturnValue);
|
||||
|
||||
void
|
||||
DtDetectAllLabels (
|
||||
|
@ -124,10 +124,11 @@
|
||||
|
||||
/* Local prototypes */
|
||||
|
||||
static UINT64
|
||||
static ACPI_STATUS
|
||||
DtResolveInteger (
|
||||
DT_FIELD *Field,
|
||||
char *IntegerString);
|
||||
char *IntegerString,
|
||||
UINT64 *ReturnValue);
|
||||
|
||||
static void
|
||||
DtInsertLabelField (
|
||||
@ -143,8 +144,9 @@ DtLookupLabel (
|
||||
* FUNCTION: DtResolveIntegerExpression
|
||||
*
|
||||
* PARAMETERS: Field - Field object with Integer expression
|
||||
* ReturnValue - Where the integer is returned
|
||||
*
|
||||
* RETURN: A 64-bit integer value
|
||||
* RETURN: Status, and the resolved 64-bit integer value
|
||||
*
|
||||
* DESCRIPTION: Resolve an integer expression to a single value. Supports
|
||||
* both integer constants and labels. Supported operators are:
|
||||
@ -152,14 +154,16 @@ DtLookupLabel (
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
UINT64
|
||||
ACPI_STATUS
|
||||
DtResolveIntegerExpression (
|
||||
DT_FIELD *Field)
|
||||
DT_FIELD *Field,
|
||||
UINT64 *ReturnValue)
|
||||
{
|
||||
char *IntegerString;
|
||||
char *Operator;
|
||||
UINT64 Value;
|
||||
UINT64 Value2;
|
||||
ACPI_STATUS Status;
|
||||
|
||||
|
||||
DbgPrint (ASL_DEBUG_OUTPUT, "Full Integer expression: %s\n",
|
||||
@ -176,7 +180,12 @@ DtResolveIntegerExpression (
|
||||
return (0);
|
||||
}
|
||||
|
||||
Value = DtResolveInteger (Field, IntegerString);
|
||||
Status = DtResolveInteger (Field, IntegerString, &Value);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
return (Status);
|
||||
}
|
||||
|
||||
DbgPrint (ASL_DEBUG_OUTPUT, "Integer resolved to V1: %8.8X%8.8X\n",
|
||||
ACPI_FORMAT_UINT64 (Value));
|
||||
|
||||
@ -195,7 +204,8 @@ DtResolveIntegerExpression (
|
||||
DbgPrint (ASL_DEBUG_OUTPUT, "Expression Resolved to: %8.8X%8.8X\n",
|
||||
ACPI_FORMAT_UINT64 (Value));
|
||||
|
||||
return (Value);
|
||||
*ReturnValue = Value;
|
||||
return (AE_OK);
|
||||
}
|
||||
|
||||
IntegerString = strtok (NULL, " ");
|
||||
@ -205,10 +215,15 @@ DtResolveIntegerExpression (
|
||||
/* No corresponding operand for operator or invalid operator */
|
||||
|
||||
DtError (ASL_ERROR, ASL_MSG_INVALID_EXPRESSION, Field, Field->Value);
|
||||
return (0);
|
||||
return (AE_BAD_VALUE);
|
||||
}
|
||||
|
||||
Status = DtResolveInteger (Field, IntegerString, &Value2);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
return (Status);
|
||||
}
|
||||
|
||||
Value2 = DtResolveInteger (Field, IntegerString);
|
||||
DbgPrint (ASL_DEBUG_OUTPUT, "Integer resolved to V2: %8.8X%8.8X\n",
|
||||
ACPI_FORMAT_UINT64 (Value2));
|
||||
|
||||
@ -244,7 +259,7 @@ DtResolveIntegerExpression (
|
||||
if (!Value2)
|
||||
{
|
||||
DtError (ASL_ERROR, ASL_MSG_DIVIDE_BY_ZERO, Field, Field->Value);
|
||||
return (0);
|
||||
return (AE_BAD_VALUE);
|
||||
}
|
||||
Value /= Value2;
|
||||
break;
|
||||
@ -253,7 +268,7 @@ DtResolveIntegerExpression (
|
||||
if (!Value2)
|
||||
{
|
||||
DtError (ASL_ERROR, ASL_MSG_DIVIDE_BY_ZERO, Field, Field->Value);
|
||||
return (0);
|
||||
return (AE_BAD_VALUE);
|
||||
}
|
||||
Value %= Value2;
|
||||
break;
|
||||
@ -263,11 +278,11 @@ DtResolveIntegerExpression (
|
||||
/* Unknown operator */
|
||||
|
||||
DtFatal (ASL_MSG_INVALID_EXPRESSION, Field, Field->Value);
|
||||
break;
|
||||
return (AE_BAD_VALUE);
|
||||
}
|
||||
}
|
||||
|
||||
return (Value);
|
||||
return (AE_ERROR); /* Should never get here */
|
||||
}
|
||||
|
||||
|
||||
@ -277,8 +292,9 @@ DtResolveIntegerExpression (
|
||||
*
|
||||
* PARAMETERS: Field - Field object with string to be resolved
|
||||
* IntegerString - Integer to be resolved
|
||||
* ReturnValue - Where the resolved integer is returned
|
||||
*
|
||||
* RETURN: A 64-bit integer value
|
||||
* RETURN: Status, and the resolved 64-bit integer value
|
||||
*
|
||||
* DESCRIPTION: Resolve a single integer string to a value. Supports both
|
||||
* integer constants and labels.
|
||||
@ -287,10 +303,11 @@ DtResolveIntegerExpression (
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
static UINT64
|
||||
static ACPI_STATUS
|
||||
DtResolveInteger (
|
||||
DT_FIELD *Field,
|
||||
char *IntegerString)
|
||||
char *IntegerString,
|
||||
UINT64 *ReturnValue)
|
||||
{
|
||||
DT_FIELD *LabelField;
|
||||
UINT64 Value = 0;
|
||||
@ -308,13 +325,13 @@ DtResolveInteger (
|
||||
if (!LabelField)
|
||||
{
|
||||
DtError (ASL_ERROR, ASL_MSG_UNKNOWN_LABEL, Field, IntegerString);
|
||||
return (0);
|
||||
return (AE_NOT_FOUND);
|
||||
}
|
||||
|
||||
/* All we need from the label is the offset in the table */
|
||||
|
||||
Value = LabelField->TableOffset;
|
||||
return (Value);
|
||||
*ReturnValue = LabelField->TableOffset;
|
||||
return (AE_OK);
|
||||
}
|
||||
|
||||
/* Convert string to an actual integer */
|
||||
@ -332,9 +349,11 @@ DtResolveInteger (
|
||||
}
|
||||
|
||||
DtError (ASL_ERROR, ASL_MSG_INVALID_HEX_INTEGER, Field, Message);
|
||||
return (Status);
|
||||
}
|
||||
|
||||
return (Value);
|
||||
*ReturnValue = Value;
|
||||
return (AE_OK);
|
||||
}
|
||||
|
||||
|
||||
|
@ -356,6 +356,7 @@ DtCompileInteger (
|
||||
{
|
||||
UINT64 Value;
|
||||
UINT64 MaxValue;
|
||||
ACPI_STATUS Status;
|
||||
|
||||
|
||||
/* Output buffer byte length must be in range 1-8 */
|
||||
@ -369,7 +370,11 @@ DtCompileInteger (
|
||||
|
||||
/* Resolve integer expression to a single integer value */
|
||||
|
||||
Value = DtResolveIntegerExpression (Field);
|
||||
Status = DtResolveIntegerExpression (Field, &Value);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
/* Ensure that reserved fields are set to zero */
|
||||
/* TBD: should we set to zero, or just make this an ERROR? */
|
||||
|
@ -261,8 +261,16 @@ DtFatal (
|
||||
|
||||
DtError (ASL_ERROR, MessageId, FieldObject, ExtraMessage);
|
||||
|
||||
/*
|
||||
* TBD: remove this entire function, DtFatal
|
||||
*
|
||||
* We cannot abort the compiler on error, because we may be compiling a
|
||||
* list of files. We must move on to the next file.
|
||||
*/
|
||||
#ifdef __OBSOLETE
|
||||
CmCleanupAndExit ();
|
||||
exit (1);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@ -649,6 +657,7 @@ DtGetFieldLength (
|
||||
|
||||
sprintf (MsgBuffer, "Expected \"%s\"", Info->Name);
|
||||
DtFatal (ASL_MSG_COMPILER_INTERNAL, NULL, MsgBuffer);
|
||||
return (0);
|
||||
}
|
||||
break;
|
||||
|
||||
@ -671,6 +680,7 @@ DtGetFieldLength (
|
||||
|
||||
sprintf (MsgBuffer, "Expected \"%s\"", Info->Name);
|
||||
DtFatal (ASL_MSG_COMPILER_INTERNAL, NULL, MsgBuffer);
|
||||
return (0);
|
||||
}
|
||||
break;
|
||||
|
||||
@ -693,7 +703,7 @@ DtGetFieldLength (
|
||||
|
||||
default:
|
||||
DtFatal (ASL_MSG_COMPILER_INTERNAL, Field, "Invalid table opcode");
|
||||
break;
|
||||
return (0);
|
||||
}
|
||||
|
||||
return (ByteLength);
|
||||
|
Loading…
x
Reference in New Issue
Block a user