diff options
-rwxr-xr-x | generate/msvc2017/AcpiBin.vcxproj | 1 | ||||
-rwxr-xr-x | generate/msvc2017/AcpiDump.vcxproj | 1 | ||||
-rwxr-xr-x | generate/msvc2017/AcpiExec.vcxproj | 1 | ||||
-rwxr-xr-x | generate/msvc2017/AcpiHelp.vcxproj | 1 | ||||
-rwxr-xr-x | generate/msvc2017/AcpiSrc.vcxproj | 1 | ||||
-rwxr-xr-x | generate/msvc2017/AcpiXtract.vcxproj | 1 | ||||
-rwxr-xr-x | generate/msvc2017/AslCompiler.vcxproj | 1 | ||||
-rwxr-xr-x | generate/msvc2017/AslCompiler.vcxproj.user | 5 | ||||
-rwxr-xr-x | generate/msvc2017/Examples.vcxproj | 1 | ||||
-rw-r--r-- | source/common/adisasm.c | 1 | ||||
-rw-r--r-- | source/compiler/aslallocate.c | 6 | ||||
-rw-r--r-- | source/compiler/aslbtypes.c | 1 | ||||
-rw-r--r-- | source/compiler/aslparseop.c | 2 | ||||
-rw-r--r-- | source/compiler/asltree.c | 1 | ||||
-rw-r--r-- | source/compiler/dtexpress.c | 1 | ||||
-rw-r--r-- | source/compiler/preprocess.h | 9 | ||||
-rw-r--r-- | source/compiler/prmacros.c | 48 | ||||
-rw-r--r-- | source/compiler/prscan.c | 7 | ||||
-rw-r--r-- | source/compiler/prutils.c | 238 | ||||
-rw-r--r-- | source/include/actbl2.h | 1 |
20 files changed, 297 insertions, 31 deletions
diff --git a/generate/msvc2017/AcpiBin.vcxproj b/generate/msvc2017/AcpiBin.vcxproj index 42d0f8c7c..1de38d074 100755 --- a/generate/msvc2017/AcpiBin.vcxproj +++ b/generate/msvc2017/AcpiBin.vcxproj @@ -98,7 +98,6 @@ <IgnoreSpecificDefaultLibraries>advapi32.lib;%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries> <OutputFile>.\AcpiBin\AcpiBin.exe</OutputFile> <AdditionalDependencies>kernel32.lib;%(AdditionalDependencies)</AdditionalDependencies> - <AdditionalOptions>/INTEGRITYCHECK %(AdditionalOptions)</AdditionalOptions> <GenerateDebugInformation>false</GenerateDebugInformation> </Link> </ItemDefinitionGroup> diff --git a/generate/msvc2017/AcpiDump.vcxproj b/generate/msvc2017/AcpiDump.vcxproj index 80e3bb804..5c57dc55a 100755 --- a/generate/msvc2017/AcpiDump.vcxproj +++ b/generate/msvc2017/AcpiDump.vcxproj @@ -108,7 +108,6 @@ <SubSystem>Console</SubSystem> <OutputFile>.\AcpiDump\AcpiDump.exe</OutputFile> <AdditionalDependencies>kernel32.lib;advapi32.lib;%(AdditionalDependencies)</AdditionalDependencies> - <AdditionalOptions>/INTEGRITYCHECK %(AdditionalOptions)</AdditionalOptions> <GenerateDebugInformation>false</GenerateDebugInformation> </Link> </ItemDefinitionGroup> diff --git a/generate/msvc2017/AcpiExec.vcxproj b/generate/msvc2017/AcpiExec.vcxproj index 38d408a80..34b166992 100755 --- a/generate/msvc2017/AcpiExec.vcxproj +++ b/generate/msvc2017/AcpiExec.vcxproj @@ -114,7 +114,6 @@ <SubSystem>Console</SubSystem> <OutputFile>.\AcpiExec\AcpiExec.exe</OutputFile> <AdditionalDependencies>setargv.obj;%(AdditionalDependencies)</AdditionalDependencies> - <AdditionalOptions>/INTEGRITYCHECK %(AdditionalOptions)</AdditionalOptions> <GenerateDebugInformation>false</GenerateDebugInformation> </Link> </ItemDefinitionGroup> diff --git a/generate/msvc2017/AcpiHelp.vcxproj b/generate/msvc2017/AcpiHelp.vcxproj index 215392bb6..6eac63453 100755 --- a/generate/msvc2017/AcpiHelp.vcxproj +++ b/generate/msvc2017/AcpiHelp.vcxproj @@ -157,7 +157,6 @@ <SubSystem>Console</SubSystem> <OutputFile>.\AcpiHelp\AcpiHelp.exe</OutputFile> <AdditionalDependencies>kernel32.lib;advapi32.lib;%(AdditionalDependencies)</AdditionalDependencies> - <AdditionalOptions>/INTEGRITYCHECK %(AdditionalOptions)</AdditionalOptions> <GenerateDebugInformation>false</GenerateDebugInformation> </Link> </ItemDefinitionGroup> diff --git a/generate/msvc2017/AcpiSrc.vcxproj b/generate/msvc2017/AcpiSrc.vcxproj index 8a58687f4..075493a85 100755 --- a/generate/msvc2017/AcpiSrc.vcxproj +++ b/generate/msvc2017/AcpiSrc.vcxproj @@ -108,7 +108,6 @@ <SubSystem>Console</SubSystem> <OutputFile>.\AcpiSrc\AcpiSrc.exe</OutputFile> <AdditionalDependencies>kernel32.lib;advapi32.lib;%(AdditionalDependencies)</AdditionalDependencies> - <AdditionalOptions>/INTEGRITYCHECK %(AdditionalOptions)</AdditionalOptions> <GenerateDebugInformation>false</GenerateDebugInformation> </Link> </ItemDefinitionGroup> diff --git a/generate/msvc2017/AcpiXtract.vcxproj b/generate/msvc2017/AcpiXtract.vcxproj index a6cd5f713..8cd341366 100755 --- a/generate/msvc2017/AcpiXtract.vcxproj +++ b/generate/msvc2017/AcpiXtract.vcxproj @@ -156,7 +156,6 @@ <OutputFile>.\AcpiXtract\AcpiXtract.exe</OutputFile> <AdditionalDependencies>kernel32.lib;advapi32.lib;%(AdditionalDependencies)</AdditionalDependencies> <GenerateDebugInformation>false</GenerateDebugInformation> - <AdditionalOptions>/INTEGRITYCHECK %(AdditionalOptions)</AdditionalOptions> </Link> </ItemDefinitionGroup> <ItemGroup> diff --git a/generate/msvc2017/AslCompiler.vcxproj b/generate/msvc2017/AslCompiler.vcxproj index 5738c630b..6dfa860f0 100755 --- a/generate/msvc2017/AslCompiler.vcxproj +++ b/generate/msvc2017/AslCompiler.vcxproj @@ -121,7 +121,6 @@ <AdditionalDependencies>setargv.obj;%(AdditionalDependencies)</AdditionalDependencies> <ProgramDatabaseFile>$(OutDir)$(TargetName).pdb</ProgramDatabaseFile> <GenerateDebugInformation>false</GenerateDebugInformation> - <AdditionalOptions>/INTEGRITYCHECK %(AdditionalOptions)</AdditionalOptions> </Link> </ItemDefinitionGroup> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> diff --git a/generate/msvc2017/AslCompiler.vcxproj.user b/generate/msvc2017/AslCompiler.vcxproj.user index c6140842d..6b58a03dc 100755 --- a/generate/msvc2017/AslCompiler.vcxproj.user +++ b/generate/msvc2017/AslCompiler.vcxproj.user @@ -5,4 +5,9 @@ <LocalDebuggerWorkingDirectory>C:\0acpi-bugs\CDAT</LocalDebuggerWorkingDirectory> <DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor> </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <LocalDebuggerCommandArguments>dsdt.asl</LocalDebuggerCommandArguments> + <LocalDebuggerWorkingDirectory>C:\0acpi-features\macros</LocalDebuggerWorkingDirectory> + <DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor> + </PropertyGroup> </Project>
\ No newline at end of file diff --git a/generate/msvc2017/Examples.vcxproj b/generate/msvc2017/Examples.vcxproj index 8977e41cd..d34e0d81f 100755 --- a/generate/msvc2017/Examples.vcxproj +++ b/generate/msvc2017/Examples.vcxproj @@ -104,7 +104,6 @@ <IgnoreSpecificDefaultLibraries>LIBCMTD;%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries> <OutputFile>.\Examples\Examples.exe</OutputFile> <AdditionalDependencies>odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies> - <AdditionalOptions>/INTEGRITYCHECK %(AdditionalOptions)</AdditionalOptions> <GenerateDebugInformation>false</GenerateDebugInformation> </Link> </ItemDefinitionGroup> diff --git a/source/common/adisasm.c b/source/common/adisasm.c index 5feb501a7..ccb98bfe0 100644 --- a/source/common/adisasm.c +++ b/source/common/adisasm.c @@ -789,6 +789,7 @@ AdDoExternalFileList ( AcpiDmFinishNamespaceLoad (AcpiGbl_ParseOpRoot, AcpiGbl_RootNode, OwnerId); AcpiPsDeleteParseTree (AcpiGbl_ParseOpRoot); + AcpiGbl_ParseOpRoot = NULL; ExternalListHead = ExternalListHead->Next; } diff --git a/source/compiler/aslallocate.c b/source/compiler/aslallocate.c index 97b7e2311..d86b5f39b 100644 --- a/source/compiler/aslallocate.c +++ b/source/compiler/aslallocate.c @@ -295,9 +295,13 @@ void UtFreeLineBuffers ( void) { - free (AslGbl_CurrentLineBuffer); + free (AslGbl_MainTokenBuffer); + free (AslGbl_MacroTokenBuffer); + + free (AslGbl_MacroTokenReplaceBuffer); + free (AslGbl_ExpressionTokenBuffer); } diff --git a/source/compiler/aslbtypes.c b/source/compiler/aslbtypes.c index 4faba97ff..e2f72d882 100644 --- a/source/compiler/aslbtypes.c +++ b/source/compiler/aslbtypes.c @@ -501,6 +501,7 @@ AnGetBtype ( ACPI_PARSE_OBJECT *ReferencedNode; UINT32 ThisNodeBtype = 0; + ACPI_FUNCTION_NAME (AnGetBtype); if (!Op) { diff --git a/source/compiler/aslparseop.c b/source/compiler/aslparseop.c index c2f6f3de7..38169fee2 100644 --- a/source/compiler/aslparseop.c +++ b/source/compiler/aslparseop.c @@ -817,6 +817,8 @@ TrAllocateOp ( ACPI_PARSE_OBJECT *Op; ACPI_PARSE_OBJECT *LatestOp; + ACPI_FUNCTION_NAME (TrAllocateOp); + Op = UtParseOpCacheCalloc (); diff --git a/source/compiler/asltree.c b/source/compiler/asltree.c index 41811f5da..f390c4f6c 100644 --- a/source/compiler/asltree.c +++ b/source/compiler/asltree.c @@ -467,6 +467,7 @@ TrLinkOpChildren ( UINT32 i; BOOLEAN FirstChild; + ACPI_FUNCTION_NAME (TrLinkOpChildren); va_start (ap, NumChildren); diff --git a/source/compiler/dtexpress.c b/source/compiler/dtexpress.c index b2664bc4d..7d614729e 100644 --- a/source/compiler/dtexpress.c +++ b/source/compiler/dtexpress.c @@ -480,6 +480,7 @@ static void DtInsertLabelField ( DT_FIELD *Field) { + ACPI_FUNCTION_NAME (DtInsertLabelField); DbgPrint (ASL_DEBUG_OUTPUT, "%s: Found Label : %s at output table offset %X\n", diff --git a/source/compiler/preprocess.h b/source/compiler/preprocess.h index 3ad4d16d0..818eac263 100644 --- a/source/compiler/preprocess.h +++ b/source/compiler/preprocess.h @@ -249,6 +249,7 @@ typedef struct directive_info */ PR_EXTERN char PR_INIT_GLOBAL (*AslGbl_MainTokenBuffer, NULL); /* [ASL_LINE_BUFFER_SIZE]; */ PR_EXTERN char PR_INIT_GLOBAL (*AslGbl_MacroTokenBuffer, NULL); /* [ASL_LINE_BUFFER_SIZE]; */ +PR_EXTERN char PR_INIT_GLOBAL (*AslGbl_MacroTokenReplaceBuffer, NULL); /* [ASL_LINE_BUFFER_SIZE]; */ PR_EXTERN char PR_INIT_GLOBAL (*AslGbl_ExpressionTokenBuffer, NULL); /* [ASL_LINE_BUFFER_SIZE]; */ PR_EXTERN UINT32 AslGbl_PreprocessorLineNumber; @@ -370,6 +371,14 @@ PrError ( UINT32 Column); void +PrReplaceResizeSubstring( + PR_MACRO_ARG *Args, + UINT32 Diff1, + UINT32 Diff2, + UINT32 i, + char *Token); + +char * PrReplaceData ( char *Buffer, UINT32 LengthToRemove, diff --git a/source/compiler/prmacros.c b/source/compiler/prmacros.c index 8a1049331..6414867b9 100644 --- a/source/compiler/prmacros.c +++ b/source/compiler/prmacros.c @@ -393,10 +393,10 @@ PrAddMacro ( UINT16 UseCount = 0; UINT16 ArgCount = 0; UINT32 Depth = 1; + /*UINT32 Depth = 1;*/ UINT32 EndOfArgList; char BufferChar; - /* Find the end of the arguments list */ TokenOffset = Name - AslGbl_MainTokenBuffer + strlen (Name) + 1; @@ -437,6 +437,7 @@ PrAddMacro ( for (i = 0; i < PR_MAX_MACRO_ARGS; i++) { Token = PrGetNextToken (NULL, PR_MACRO_SEPARATORS, Next); + if (!Token) { /* This is the case for a NULL macro body */ @@ -454,14 +455,13 @@ PrAddMacro ( } DbgPrint (ASL_DEBUG_OUTPUT, PR_PREFIX_ID - "Macro arg: %s \n", + "Macro param: %s \n", AslGbl_CurrentLineNumber, Token); Args[i].Name = UtLocalCalloc (strlen (Token) + 1); strcpy (Args[i].Name, Token); Args[i].UseCount = 0; - ArgCount++; if (ArgCount >= PR_MAX_MACRO_ARGS) { @@ -476,7 +476,6 @@ PrAddMacro ( /* Match each method arg in the macro body for later use */ - Token = PrGetNextToken (NULL, PR_MACRO_SEPARATORS, Next); while (Token) { /* Search the macro arg list for matching arg */ @@ -496,12 +495,14 @@ PrAddMacro ( Args[i].Offset[UseCount] = (Token - AslGbl_MainTokenBuffer) - MacroBodyOffset; + DbgPrint (ASL_DEBUG_OUTPUT, PR_PREFIX_ID "Macro Arg #%u: %s UseCount %u Offset %u \n", AslGbl_CurrentLineNumber, i, Token, UseCount+1, Args[i].Offset[UseCount]); Args[i].UseCount++; + if (Args[i].UseCount >= PR_MAX_ARG_INSTANCES) { PrError (ASL_ERROR, ASL_MSG_TOO_MANY_ARGUMENTS, @@ -596,7 +597,8 @@ PrDoMacroInvocation ( UINT32 TokenOffset; UINT32 Length; UINT32 i; - + UINT32 Diff1; + UINT32 Diff2; /* Take a copy of the macro body for expansion */ @@ -610,6 +612,7 @@ PrDoMacroInvocation ( /* This macro has no arguments */ Token = PrGetNextToken (NULL, PR_MACRO_ARGUMENTS, Next); + if (!Token) { goto BadInvocation; @@ -634,21 +637,35 @@ PrDoMacroInvocation ( goto BadInvocation; } + /* + * Avoid optimizing using just 1 signed int due to specific + * non-portable implementations of signed ints + */ + Diff1 = strlen (Args->Name) > strlen (Token) ? strlen (Args->Name) - + strlen (Token) : 0; + + Diff2 = strlen (Args->Name) < strlen (Token) ? strlen (Token) - + strlen (Args->Name) : 0; + /* Replace all instances of this argument */ for (i = 0; i < Args->UseCount; i++) { - /* Offset zero indicates "arg not used" */ - /* TBD: Not really needed now, with UseCount available */ + /* + * To test the output of the preprocessed macro function that + * is passed to the compiler + */ - if (Args->Offset[i] == 0) - { - break; - } + /* + * fprintf (stderr, "Current token = %s \t Current arg_name = %s \ + * \t strlen (Token) = %u \t strlen (Args->Name) = %u \t Offset = %u \ + * \t UseCount = %u \t", Token, Args->Name, strlen (Token), \ + * strlen (Args->Name), Args->Offset[i], Args->UseCount); + */ + + AslGbl_MacroTokenReplaceBuffer = (char *) calloc ((strlen (AslGbl_MacroTokenBuffer)), sizeof (char)); - PrReplaceData ( - &AslGbl_MacroTokenBuffer[Args->Offset[i]], strlen (Args->Name), - Token, strlen (Token)); + PrReplaceResizeSubstring (Args, Diff1, Diff2, i, Token); DbgPrint (ASL_DEBUG_OUTPUT, PR_PREFIX_ID "ExpandArg: %s \n", @@ -658,8 +675,6 @@ PrDoMacroInvocation ( Args++; } - /* TBD: need to make sure macro was not invoked with too many arguments */ - if (!Token) { return; @@ -676,7 +691,6 @@ PrDoMacroInvocation ( return; - BadInvocation: PrError (ASL_ERROR, ASL_MSG_INVALID_INVOCATION, THIS_TOKEN_OFFSET (MacroStart)); diff --git a/source/compiler/prscan.c b/source/compiler/prscan.c index 7ca364e23..d29f4e90d 100644 --- a/source/compiler/prscan.c +++ b/source/compiler/prscan.c @@ -780,8 +780,9 @@ PrDoDirective ( TokenOffset = Token - AslGbl_MainTokenBuffer + strlen (Token); if (*(&AslGbl_CurrentLineBuffer[TokenOffset]) == '(') { -#ifndef MACROS_SUPPORTED - AcpiOsPrintf ( + +#ifdef MACROS_SUPPORTED + AcpiOsPrintf( "%s ERROR - line %u: #define macros are not supported yet\n", AslGbl_CurrentLineBuffer, AslGbl_LogicalLineNumber); exit(1); @@ -789,6 +790,8 @@ PrDoDirective ( PrAddMacro (Token, Next); #endif } + + else { /* Use the remainder of the line for the #define */ diff --git a/source/compiler/prutils.c b/source/compiler/prutils.c index 907ca3ae9..2eb91a6c0 100644 --- a/source/compiler/prutils.c +++ b/source/compiler/prutils.c @@ -284,6 +284,238 @@ PrError ( /******************************************************************************* * + * FUNCTION: PrReplaceResizeSubstring + * + * PARAMETERS: Args - Struct containing name, offset & usecount + * Diff1 - Difference in lengths when new < old + * Diff2 - Difference in lengths when new > old +* i - The curr. no. of iteration of replacement + * Token - Substring that replaces Args->Name + * + * RETURN: None + * + * DESCRIPTION: Advanced substring replacement in a string using resized buffer. + * + ******************************************************************************/ + +void +PrReplaceResizeSubstring( + PR_MACRO_ARG *Args, + UINT32 Diff1, + UINT32 Diff2, + UINT32 i, + char *Token) +{ + UINT32 b, PrevOffset; + char *temp; + char macro_sep[64]; + + + AslGbl_MacroTokenReplaceBuffer = (char *) realloc (AslGbl_MacroTokenReplaceBuffer, + (2 * (strlen (AslGbl_MacroTokenBuffer)))); + + strcpy (macro_sep, "~,() {}!*/%+-<>=&^|\"\t\n"); + + /* + * When the replacement argument (during invocation) length + * < replaced parameter (in the macro function definition + * and its expansion) length + */ + if (Diff1 != 0) + { + /* + * We save the offset value to reset it after replacing each + * instance of each arg and setting the offset value to + * the start of the arg to be replaced since it changes + * with each iteration when arg length != token length + */ + PrevOffset = Args->Offset[i]; + temp = strstr (AslGbl_MacroTokenBuffer, Args->Name); + +ResetHere1: + temp = strstr (temp, Args->Name); + Args->Offset[i] = strlen (AslGbl_MacroTokenBuffer) - + strlen (temp); + if (Args->Offset[i] == 0) + { + goto JumpHere1; + } + if ((strchr (macro_sep, AslGbl_MacroTokenBuffer[(Args->Offset[i] - 1)])) && + (strchr (macro_sep, AslGbl_MacroTokenBuffer[(Args->Offset[i] + strlen (Args->Name))]))) + { + Args->Offset[i] += 0; + } + else + { + temp += strlen (Args->Name); + goto ResetHere1; + } + + /* + * For now, we simply set the extra char positions (generated + * due to longer name replaced by shorter name) to whitespace + * chars so it will be ignored during compilation + */ +JumpHere1: + b = strlen (Token) + Args->Offset[i]; + memset (&AslGbl_MacroTokenBuffer[b], ' ', Diff1); + +# if 0 + + /* Work in progress as of 03/08/2023 - experimental 'if' block + * to test code for removing extra whitespaces from the macro + * replacement when replacement arg < replaced param + */ + char Buff[8192]; + /* char* Replace; */ + /* Replace = Buff; */ + + for (j = 0; j < strlen (AslGbl_MacroTokenBuffer); j++) + { + Buff[j] = AslGbl_MacroTokenBuffer[j]; + } + Buff[strlen (AslGbl_MacroTokenBuffer)] = '\0'; + //fprintf (stderr, "Buff: %s\n", Buff); + + UINT32 len = strlen (Buff); + + for (j = 0; j < len; j++) + { + if (Buff[0] == ' ') + { + for (j = 0; j < (len - 1); j++) + { + Buff[j] = Buff[j + 1]; + } + Buff[j] = '\0'; + len--; + j = -1; + continue; + } + + if (Buff[j] == ' ' && Buff[j + 1] == ' ') + { + for (k = 0; k < (len - 1); k++) + { + Buff[j] = Buff[j + 1]; + } + Buff[j] = '\0'; + len--; + j--; + } + } + //fprintf(stderr, "Buff: %s\n", Buff); + + for (k = 0; k < strlen (Buff); k++) + { + AslGbl_MacroTokenBuffer[k] = Buff[k]; + } +#endif + + PrReplaceData ( + &AslGbl_MacroTokenBuffer[Args->Offset[i]], + strlen (Token), Token, strlen (Token)); + + temp = NULL; + Args->Offset[i] = PrevOffset; + } + + /* + * When the replacement argument (during invocation) length + * > replaced parameter (in the macro function definition + * and its expansion) length + */ + else if (Diff2 != 0) + { + /* Doing the same thing with offset value as for prev case */ + + PrevOffset = Args->Offset[i]; + temp = strstr (AslGbl_MacroTokenBuffer, Args->Name); + +ResetHere2: + temp = strstr (temp, Args->Name); + Args->Offset[i] = strlen (AslGbl_MacroTokenBuffer) - + strlen (temp); + if (Args->Offset[i] == 0) + { + goto JumpHere2; + } + if ((strchr (macro_sep, AslGbl_MacroTokenBuffer[(Args->Offset[i] - 1)])) && + (strchr (macro_sep, AslGbl_MacroTokenBuffer[(Args->Offset[i] + strlen (Args->Name))]))) + { + Args->Offset[i] += 0; + } + else + { + temp+= strlen (Args->Name); + goto ResetHere2; + } + + /* + * We will need to allocate some extra space in our buffer to + * accommodate the increase in the replacement string length + * over the shorter outgoing arg string and do the replacement + * at the correct offset value which is resetted every iteration + */ +JumpHere2: + strncpy (AslGbl_MacroTokenReplaceBuffer, AslGbl_MacroTokenBuffer, Args->Offset[i]); + strcat (AslGbl_MacroTokenReplaceBuffer, Token); + strcat (AslGbl_MacroTokenReplaceBuffer, (AslGbl_MacroTokenBuffer + + (Args->Offset[i] + strlen (Args->Name)))); + + strcpy (AslGbl_MacroTokenBuffer, AslGbl_MacroTokenReplaceBuffer); + + temp = NULL; + Args->Offset[i] = PrevOffset; + } + + /* + * When the replacement argument (during invocation) length = + * replaced parameter (in the macro function definition and + * its expansion) length + */ + else + { + + /* + * We still need to reset the offset for each iteration even when + * arg and param lengths are same since any macro func invocation + * could use various cases for each separate arg-param pair + */ + PrevOffset = Args->Offset[i]; + temp = strstr (AslGbl_MacroTokenBuffer, Args->Name); + +ResetHere3: + temp = strstr (temp, Args->Name); + Args->Offset[i] = strlen (AslGbl_MacroTokenBuffer) - + strlen (temp); + if (Args->Offset[i] == 0) + { + goto JumpHere3; + } + if ((strchr (macro_sep, AslGbl_MacroTokenBuffer[(Args->Offset[i] - 1)])) && + (strchr (macro_sep, AslGbl_MacroTokenBuffer[(Args->Offset[i] + strlen (Args->Name))]))) + { + Args->Offset[i] += 0; + } + else + { + temp += strlen (Args->Name); + goto ResetHere3; + } + +JumpHere3: + PrReplaceData ( + &AslGbl_MacroTokenBuffer[Args->Offset[i]], + strlen (Args->Name), Token, strlen (Token)); + temp = NULL; + Args->Offset[i] = PrevOffset; + } +} + + +/******************************************************************************* + * * FUNCTION: PrReplaceData * * PARAMETERS: Buffer - Original(target) buffer pointer @@ -291,13 +523,13 @@ PrError ( * BufferToAdd - Data to be inserted into target buffer * LengthToAdd - Length of BufferToAdd * - * RETURN: None + * RETURN: Pointer to where the buffer is replaced with data * * DESCRIPTION: Generic buffer data replacement. * ******************************************************************************/ -void +char * PrReplaceData ( char *Buffer, UINT32 LengthToRemove, @@ -325,12 +557,14 @@ PrReplaceData ( } } + /* Now we can move in the new data */ if (LengthToAdd > 0) { memmove (Buffer, BufferToAdd, LengthToAdd); } + return (Buffer + LengthToAdd); } diff --git a/source/include/actbl2.h b/source/include/actbl2.h index 6dc2efd0c..b0a70be70 100644 --- a/source/include/actbl2.h +++ b/source/include/actbl2.h @@ -230,7 +230,6 @@ typedef struct acpi_table_aest { ACPI_TABLE_HEADER Header; - void *NodeArray[]; } ACPI_TABLE_AEST; |