From cb41bea732ae6319ebbc9ccfa940e7433aae7a18 Mon Sep 17 00:00:00 2001 From: vanjeff Date: Thu, 22 Mar 2007 03:03:32 +0000 Subject: [PATCH] 1. Removed AsmSwitchStackAndBackingStore from BaseLib.h 2. Modified SwitchStack definition update to MWG 0.60e. 3. Added BaseLib/Ipf/InternalSwitchStack.c and removed BaseLib/Ipf/Non-existing.c 4. Updated any references of AsmSwitchStackAndBackingStore to SwichStack on IPF. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@2499 6f19259b-4bc3-4df7-8a09-765794883524 --- .../Core/DxeIplPeim/Ipf/DxeLoadFunc.c | 4 +- EdkModulePkg/Core/Pei/Ipf/Stack.c | 4 +- MdePkg/Include/Library/BaseLib.h | 485 +++++++++--------- MdePkg/Library/BaseLib/BaseLib.msa | 2 +- MdePkg/Library/BaseLib/BaseLibInternals.h | 74 ++- MdePkg/Library/BaseLib/Ebc/SwitchStack.c | 28 +- .../BaseLib/Ia32/InternalSwitchStack.c | 29 +- .../Library/BaseLib/Ipf/InternalSwitchStack.c | 68 +++ MdePkg/Library/BaseLib/Ipf/Non-existing.c | 53 -- MdePkg/Library/BaseLib/SwitchStack.c | 32 +- 10 files changed, 422 insertions(+), 357 deletions(-) create mode 100644 MdePkg/Library/BaseLib/Ipf/InternalSwitchStack.c delete mode 100644 MdePkg/Library/BaseLib/Ipf/Non-existing.c diff --git a/EdkModulePkg/Core/DxeIplPeim/Ipf/DxeLoadFunc.c b/EdkModulePkg/Core/DxeIplPeim/Ipf/DxeLoadFunc.c index b7cdb9db45..34141ab9f6 100644 --- a/EdkModulePkg/Core/DxeIplPeim/Ipf/DxeLoadFunc.c +++ b/EdkModulePkg/Core/DxeIplPeim/Ipf/DxeLoadFunc.c @@ -1,6 +1,6 @@ /*++ -Copyright (c) 2006, Intel Corporation +Copyright (c) 2006 - 2007, Intel Corporation All rights reserved. This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at @@ -62,7 +62,7 @@ HandOffToDxeCore ( Status = PeiServicesInstallPpi (EndOfPeiSignal); ASSERT_EFI_ERROR (Status); - AsmSwitchStackAndBackingStore ( + SwitchStack ( (SWITCH_STACK_ENTRY_POINT)(UINTN)DxeCoreEntryPoint, HobList.Raw, NULL, diff --git a/EdkModulePkg/Core/Pei/Ipf/Stack.c b/EdkModulePkg/Core/Pei/Ipf/Stack.c index 57d04a27e5..56a876df15 100644 --- a/EdkModulePkg/Core/Pei/Ipf/Stack.c +++ b/EdkModulePkg/Core/Pei/Ipf/Stack.c @@ -1,7 +1,7 @@ /** @file PeiSwitchStacks() function for PEI dispatcher. - Copyright (c) 2006, Intel Corporation
+ Copyright (c) 2006 - 2007, Intel Corporation
All rights reserved. This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at @@ -48,7 +48,7 @@ PeiSwitchStacks ( IN VOID *NewBsp ) { - AsmSwitchStackAndBackingStore ( + SwitchStack ( EntryPoint, Context1, Context2, diff --git a/MdePkg/Include/Library/BaseLib.h b/MdePkg/Include/Library/BaseLib.h index bca5b735f8..f98b250402 100644 --- a/MdePkg/Include/Library/BaseLib.h +++ b/MdePkg/Include/Library/BaseLib.h @@ -395,22 +395,22 @@ StrnCat ( ); /** - Returns the first occurance of a Null-terminated Unicode sub-string + Returns the first occurance of a Null-terminated Unicode sub-string in a Null-terminated Unicode string. - This function scans the contents of the Null-terminated Unicode string - specified by String and returns the first occurrence of SearchString. - If SearchString is not found in String, then NULL is returned. If - the length of SearchString is zero, then String is + This function scans the contents of the Null-terminated Unicode string + specified by String and returns the first occurrence of SearchString. + If SearchString is not found in String, then NULL is returned. If + the length of SearchString is zero, then String is returned. - + If String is NULL, then ASSERT(). If String is not aligned on a 16-bit boundary, then ASSERT(). If SearchString is NULL, then ASSERT(). If SearchString is not aligned on a 16-bit boundary, then ASSERT(). - If PcdMaximumUnicodeStringLength is not zero, and SearchString - or String contains more than PcdMaximumUnicodeStringLength Unicode + If PcdMaximumUnicodeStringLength is not zero, and SearchString + or String contains more than PcdMaximumUnicodeStringLength Unicode characters not including the Null-terminator, then ASSERT(). @param String Pointer to a Null-terminated Unicode string. @@ -428,37 +428,37 @@ StrStr ( ); /** - Convert a Null-terminated Unicode decimal string to a value of + Convert a Null-terminated Unicode decimal string to a value of type UINTN. - This function returns a value of type UINTN by interpreting the contents - of the Unicode string specified by String as a decimal number. The format + This function returns a value of type UINTN by interpreting the contents + of the Unicode string specified by String as a decimal number. The format of the input Unicode string String is: - + [spaces] [decimal digits]. - - The valid decimal digit character is in the range [0-9]. The - function will ignore the pad space, which includes spaces or - tab characters, before [decimal digits]. The running zero in the - beginning of [decimal digits] will be ignored. Then, the function - stops at the first character that is a not a valid decimal character - or a Null-terminator, whichever one comes first. - + + The valid decimal digit character is in the range [0-9]. The + function will ignore the pad space, which includes spaces or + tab characters, before [decimal digits]. The running zero in the + beginning of [decimal digits] will be ignored. Then, the function + stops at the first character that is a not a valid decimal character + or a Null-terminator, whichever one comes first. + If String is NULL, then ASSERT(). - If String is not aligned in a 16-bit boundary, then ASSERT(). + If String is not aligned in a 16-bit boundary, then ASSERT(). If String has only pad spaces, then 0 is returned. - If String has no pad spaces or valid decimal digits, + If String has no pad spaces or valid decimal digits, then 0 is returned. - If the number represented by String overflows according + If the number represented by String overflows according to the range defined by UINTN, then ASSERT(). - - If PcdMaximumUnicodeStringLength is not zero, and String contains - more than PcdMaximumUnicodeStringLength Unicode characters not including + + If PcdMaximumUnicodeStringLength is not zero, and String contains + more than PcdMaximumUnicodeStringLength Unicode characters not including the Null-terminator, then ASSERT(). @param String Pointer to a Null-terminated Unicode string. - @retval UINTN + @retval UINTN **/ UINTN @@ -468,37 +468,37 @@ StrDecimalToUintn ( ); /** - Convert a Null-terminated Unicode decimal string to a value of + Convert a Null-terminated Unicode decimal string to a value of type UINT64. - This function returns a value of type UINT64 by interpreting the contents - of the Unicode string specified by String as a decimal number. The format + This function returns a value of type UINT64 by interpreting the contents + of the Unicode string specified by String as a decimal number. The format of the input Unicode string String is: - + [spaces] [decimal digits]. - - The valid decimal digit character is in the range [0-9]. The - function will ignore the pad space, which includes spaces or - tab characters, before [decimal digits]. The running zero in the - beginning of [decimal digits] will be ignored. Then, the function - stops at the first character that is a not a valid decimal character - or a Null-terminator, whichever one comes first. - + + The valid decimal digit character is in the range [0-9]. The + function will ignore the pad space, which includes spaces or + tab characters, before [decimal digits]. The running zero in the + beginning of [decimal digits] will be ignored. Then, the function + stops at the first character that is a not a valid decimal character + or a Null-terminator, whichever one comes first. + If String is NULL, then ASSERT(). - If String is not aligned in a 16-bit boundary, then ASSERT(). + If String is not aligned in a 16-bit boundary, then ASSERT(). If String has only pad spaces, then 0 is returned. - If String has no pad spaces or valid decimal digits, + If String has no pad spaces or valid decimal digits, then 0 is returned. - If the number represented by String overflows according + If the number represented by String overflows according to the range defined by UINT64, then ASSERT(). - - If PcdMaximumUnicodeStringLength is not zero, and String contains - more than PcdMaximumUnicodeStringLength Unicode characters not including + + If PcdMaximumUnicodeStringLength is not zero, and String contains + more than PcdMaximumUnicodeStringLength Unicode characters not including the Null-terminator, then ASSERT(). @param String Pointer to a Null-terminated Unicode string. - @retval UINT64 + @retval UINT64 **/ UINT64 @@ -510,31 +510,31 @@ StrDecimalToUint64 ( /** Convert a Null-terminated Unicode hexadecimal string to a value of type UINTN. - This function returns a value of type UINTN by interpreting the contents - of the Unicode string specified by String as a hexadecimal number. + This function returns a value of type UINTN by interpreting the contents + of the Unicode string specified by String as a hexadecimal number. The format of the input Unicode string String is: - - [spaces][zeros][x][hexadecimal digits]. - - The valid hexadecimal digit character is in the range [0-9], [a-f] and [A-F]. - The prefix "0x" is optional. Both "x" and "X" is allowed in "0x" prefix. - If "x" appears in the input string, it must be prefixed with at least one 0. - The function will ignore the pad space, which includes spaces or tab characters, - before [zeros], [x] or [hexadecimal digit]. The running zero before [x] or - [hexadecimal digit] will be ignored. Then, the decoding starts after [x] or the - first valid hexadecimal digit. Then, the function stops at the first character that is + + [spaces][zeros][x][hexadecimal digits]. + + The valid hexadecimal digit character is in the range [0-9], [a-f] and [A-F]. + The prefix "0x" is optional. Both "x" and "X" is allowed in "0x" prefix. + If "x" appears in the input string, it must be prefixed with at least one 0. + The function will ignore the pad space, which includes spaces or tab characters, + before [zeros], [x] or [hexadecimal digit]. The running zero before [x] or + [hexadecimal digit] will be ignored. Then, the decoding starts after [x] or the + first valid hexadecimal digit. Then, the function stops at the first character that is a not a valid hexadecimal character or NULL, whichever one comes first. If String is NULL, then ASSERT(). If String is not aligned in a 16-bit boundary, then ASSERT(). If String has only pad spaces, then zero is returned. - If String has no leading pad spaces, leading zeros or valid hexadecimal digits, + If String has no leading pad spaces, leading zeros or valid hexadecimal digits, then zero is returned. - If the number represented by String overflows according to the range defined by + If the number represented by String overflows according to the range defined by UINTN, then ASSERT(). - If PcdMaximumUnicodeStringLength is not zero, and String contains more than - PcdMaximumUnicodeStringLength Unicode characters not including the Null-terminator, + If PcdMaximumUnicodeStringLength is not zero, and String contains more than + PcdMaximumUnicodeStringLength Unicode characters not including the Null-terminator, then ASSERT(). @param String Pointer to a Null-terminated Unicode string. @@ -551,31 +551,31 @@ StrHexToUintn ( /** Convert a Null-terminated Unicode hexadecimal string to a value of type UINT64. - This function returns a value of type UINT64 by interpreting the contents - of the Unicode string specified by String as a hexadecimal number. - The format of the input Unicode string String is - - [spaces][zeros][x][hexadecimal digits]. - - The valid hexadecimal digit character is in the range [0-9], [a-f] and [A-F]. - The prefix "0x" is optional. Both "x" and "X" is allowed in "0x" prefix. - If "x" appears in the input string, it must be prefixed with at least one 0. - The function will ignore the pad space, which includes spaces or tab characters, - before [zeros], [x] or [hexadecimal digit]. The running zero before [x] or - [hexadecimal digit] will be ignored. Then, the decoding starts after [x] or the - first valid hexadecimal digit. Then, the function stops at the first character that is + This function returns a value of type UINT64 by interpreting the contents + of the Unicode string specified by String as a hexadecimal number. + The format of the input Unicode string String is + + [spaces][zeros][x][hexadecimal digits]. + + The valid hexadecimal digit character is in the range [0-9], [a-f] and [A-F]. + The prefix "0x" is optional. Both "x" and "X" is allowed in "0x" prefix. + If "x" appears in the input string, it must be prefixed with at least one 0. + The function will ignore the pad space, which includes spaces or tab characters, + before [zeros], [x] or [hexadecimal digit]. The running zero before [x] or + [hexadecimal digit] will be ignored. Then, the decoding starts after [x] or the + first valid hexadecimal digit. Then, the function stops at the first character that is a not a valid hexadecimal character or NULL, whichever one comes first. If String is NULL, then ASSERT(). If String is not aligned in a 16-bit boundary, then ASSERT(). If String has only pad spaces, then zero is returned. - If String has no leading pad spaces, leading zeros or valid hexadecimal digits, + If String has no leading pad spaces, leading zeros or valid hexadecimal digits, then zero is returned. - If the number represented by String overflows according to the range defined by + If the number represented by String overflows according to the range defined by UINT64, then ASSERT(). - If PcdMaximumUnicodeStringLength is not zero, and String contains more than - PcdMaximumUnicodeStringLength Unicode characters not including the Null-terminator, + If PcdMaximumUnicodeStringLength is not zero, and String contains more than + PcdMaximumUnicodeStringLength Unicode characters not including the Null-terminator, then ASSERT(). @param String Pointer to a Null-terminated Unicode string. @@ -590,27 +590,27 @@ StrHexToUint64 ( ); /** - Convert one Null-terminated Unicode string to a Null-terminated + Convert one Null-terminated Unicode string to a Null-terminated ASCII string and returns the ASCII string. - - This function converts the content of the Unicode string Source - to the ASCII string Destination by copying the lower 8 bits of - each Unicode character. It returns Destination. - If any Unicode characters in Source contain non-zero value in + This function converts the content of the Unicode string Source + to the ASCII string Destination by copying the lower 8 bits of + each Unicode character. It returns Destination. + + If any Unicode characters in Source contain non-zero value in the upper 8 bits, then ASSERT(). - + If Destination is NULL, then ASSERT(). If Source is NULL, then ASSERT(). If Source is not aligned on a 16-bit boundary, then ASSERT(). If Source and Destination overlap, then ASSERT(). - - If PcdMaximumUnicodeStringLength is not zero, and Source contains - more than PcdMaximumUnicodeStringLength Unicode characters not including + + If PcdMaximumUnicodeStringLength is not zero, and Source contains + more than PcdMaximumUnicodeStringLength Unicode characters not including the Null-terminator, then ASSERT(). - - If PcdMaximumAsciiStringLength is not zero, and Source contains more - than PcdMaximumAsciiStringLength Unicode characters not including the + + If PcdMaximumAsciiStringLength is not zero, and Source contains more + than PcdMaximumAsciiStringLength Unicode characters not including the Null-terminator, then ASSERT(). @param Source Pointer to a Null-terminated Unicode string. @@ -907,19 +907,19 @@ AsciiStrnCat ( ); /** - Returns the first occurance of a Null-terminated ASCII sub-string + Returns the first occurance of a Null-terminated ASCII sub-string in a Null-terminated ASCII string. - This function scans the contents of the ASCII string specified by String - and returns the first occurrence of SearchString. If SearchString is not - found in String, then NULL is returned. If the length of SearchString is zero, + This function scans the contents of the ASCII string specified by String + and returns the first occurrence of SearchString. If SearchString is not + found in String, then NULL is returned. If the length of SearchString is zero, then String is returned. - + If String is NULL, then ASSERT(). If SearchString is NULL, then ASSERT(). - If PcdMaximumAsciiStringLength is not zero, and SearchString or - String contains more than PcdMaximumAsciiStringLength Unicode characters + If PcdMaximumAsciiStringLength is not zero, and SearchString or + String contains more than PcdMaximumAsciiStringLength Unicode characters not including the Null-terminator, then ASSERT(). @param String Pointer to a Null-terminated ASCII string. @@ -937,33 +937,33 @@ AsciiStrStr ( ); /** - Convert a Null-terminated ASCII decimal string to a value of type + Convert a Null-terminated ASCII decimal string to a value of type UINTN. - This function returns a value of type UINTN by interpreting the contents - of the ASCII string String as a decimal number. The format of the input + This function returns a value of type UINTN by interpreting the contents + of the ASCII string String as a decimal number. The format of the input ASCII string String is: - + [spaces] [decimal digits]. - - The valid decimal digit character is in the range [0-9]. The function will - ignore the pad space, which includes spaces or tab characters, before the digits. - The running zero in the beginning of [decimal digits] will be ignored. Then, the - function stops at the first character that is a not a valid decimal character or + + The valid decimal digit character is in the range [0-9]. The function will + ignore the pad space, which includes spaces or tab characters, before the digits. + The running zero in the beginning of [decimal digits] will be ignored. Then, the + function stops at the first character that is a not a valid decimal character or Null-terminator, whichever on comes first. - + If String has only pad spaces, then 0 is returned. If String has no pad spaces or valid decimal digits, then 0 is returned. - If the number represented by String overflows according to the range defined by + If the number represented by String overflows according to the range defined by UINTN, then ASSERT(). If String is NULL, then ASSERT(). - If PcdMaximumAsciiStringLength is not zero, and String contains more than - PcdMaximumAsciiStringLength ASCII characters not including the Null-terminator, + If PcdMaximumAsciiStringLength is not zero, and String contains more than + PcdMaximumAsciiStringLength ASCII characters not including the Null-terminator, then ASSERT(). @param String Pointer to a Null-terminated ASCII string. - @retval UINTN + @retval UINTN **/ UINTN @@ -973,33 +973,33 @@ AsciiStrDecimalToUintn ( ); /** - Convert a Null-terminated ASCII decimal string to a value of type + Convert a Null-terminated ASCII decimal string to a value of type UINT64. - This function returns a value of type UINT64 by interpreting the contents - of the ASCII string String as a decimal number. The format of the input + This function returns a value of type UINT64 by interpreting the contents + of the ASCII string String as a decimal number. The format of the input ASCII string String is: - + [spaces] [decimal digits]. - - The valid decimal digit character is in the range [0-9]. The function will - ignore the pad space, which includes spaces or tab characters, before the digits. - The running zero in the beginning of [decimal digits] will be ignored. Then, the - function stops at the first character that is a not a valid decimal character or + + The valid decimal digit character is in the range [0-9]. The function will + ignore the pad space, which includes spaces or tab characters, before the digits. + The running zero in the beginning of [decimal digits] will be ignored. Then, the + function stops at the first character that is a not a valid decimal character or Null-terminator, whichever on comes first. - + If String has only pad spaces, then 0 is returned. If String has no pad spaces or valid decimal digits, then 0 is returned. - If the number represented by String overflows according to the range defined by + If the number represented by String overflows according to the range defined by UINT64, then ASSERT(). If String is NULL, then ASSERT(). - If PcdMaximumAsciiStringLength is not zero, and String contains more than - PcdMaximumAsciiStringLength ASCII characters not including the Null-terminator, + If PcdMaximumAsciiStringLength is not zero, and String contains more than + PcdMaximumAsciiStringLength ASCII characters not including the Null-terminator, then ASSERT(). @param String Pointer to a Null-terminated ASCII string. - @retval UINT64 + @retval UINT64 **/ UINT64 @@ -1011,30 +1011,30 @@ AsciiStrDecimalToUint64 ( /** Convert a Null-terminated ASCII hexadecimal string to a value of type UINTN. - This function returns a value of type UINTN by interpreting the contents of - the ASCII string String as a hexadecimal number. The format of the input ASCII + This function returns a value of type UINTN by interpreting the contents of + the ASCII string String as a hexadecimal number. The format of the input ASCII string String is: - + [spaces][zeros][x][hexadecimal digits]. - - The valid hexadecimal digit character is in the range [0-9], [a-f] and [A-F]. - The prefix "0x" is optional. Both "x" and "X" is allowed in "0x" prefix. If "x" - appears in the input string, it must be prefixed with at least one 0. The function - will ignore the pad space, which includes spaces or tab characters, before [zeros], - [x] or [hexadecimal digits]. The running zero before [x] or [hexadecimal digits] - will be ignored. Then, the decoding starts after [x] or the first valid hexadecimal - digit. Then, the function stops at the first character that is a not a valid + + The valid hexadecimal digit character is in the range [0-9], [a-f] and [A-F]. + The prefix "0x" is optional. Both "x" and "X" is allowed in "0x" prefix. If "x" + appears in the input string, it must be prefixed with at least one 0. The function + will ignore the pad space, which includes spaces or tab characters, before [zeros], + [x] or [hexadecimal digits]. The running zero before [x] or [hexadecimal digits] + will be ignored. Then, the decoding starts after [x] or the first valid hexadecimal + digit. Then, the function stops at the first character that is a not a valid hexadecimal character or Null-terminator, whichever on comes first. - + If String has only pad spaces, then 0 is returned. If String has no leading pad spaces, leading zeros or valid hexadecimal digits, then 0 is returned. - If the number represented by String overflows according to the range defined by UINTN, + If the number represented by String overflows according to the range defined by UINTN, then ASSERT(). If String is NULL, then ASSERT(). - If PcdMaximumAsciiStringLength is not zero, - and String contains more than PcdMaximumAsciiStringLength ASCII characters not including + If PcdMaximumAsciiStringLength is not zero, + and String contains more than PcdMaximumAsciiStringLength ASCII characters not including the Null-terminator, then ASSERT(). @param String Pointer to a Null-terminated ASCII string. @@ -1051,30 +1051,30 @@ AsciiStrHexToUintn ( /** Convert a Null-terminated ASCII hexadecimal string to a value of type UINT64. - This function returns a value of type UINT64 by interpreting the contents of - the ASCII string String as a hexadecimal number. The format of the input ASCII + This function returns a value of type UINT64 by interpreting the contents of + the ASCII string String as a hexadecimal number. The format of the input ASCII string String is: - + [spaces][zeros][x][hexadecimal digits]. - - The valid hexadecimal digit character is in the range [0-9], [a-f] and [A-F]. - The prefix "0x" is optional. Both "x" and "X" is allowed in "0x" prefix. If "x" - appears in the input string, it must be prefixed with at least one 0. The function - will ignore the pad space, which includes spaces or tab characters, before [zeros], - [x] or [hexadecimal digits]. The running zero before [x] or [hexadecimal digits] - will be ignored. Then, the decoding starts after [x] or the first valid hexadecimal - digit. Then, the function stops at the first character that is a not a valid + + The valid hexadecimal digit character is in the range [0-9], [a-f] and [A-F]. + The prefix "0x" is optional. Both "x" and "X" is allowed in "0x" prefix. If "x" + appears in the input string, it must be prefixed with at least one 0. The function + will ignore the pad space, which includes spaces or tab characters, before [zeros], + [x] or [hexadecimal digits]. The running zero before [x] or [hexadecimal digits] + will be ignored. Then, the decoding starts after [x] or the first valid hexadecimal + digit. Then, the function stops at the first character that is a not a valid hexadecimal character or Null-terminator, whichever on comes first. - + If String has only pad spaces, then 0 is returned. If String has no leading pad spaces, leading zeros or valid hexadecimal digits, then 0 is returned. - If the number represented by String overflows according to the range defined by UINT64, + If the number represented by String overflows according to the range defined by UINT64, then ASSERT(). If String is NULL, then ASSERT(). - If PcdMaximumAsciiStringLength is not zero, - and String contains more than PcdMaximumAsciiStringLength ASCII characters not including + If PcdMaximumAsciiStringLength is not zero, + and String contains more than PcdMaximumAsciiStringLength ASCII characters not including the Null-terminator, then ASSERT(). @param String Pointer to a Null-terminated ASCII string. @@ -1089,24 +1089,24 @@ AsciiStrHexToUint64 ( ); /** - Convert one Null-terminated ASCII string to a Null-terminated + Convert one Null-terminated ASCII string to a Null-terminated Unicode string and returns the Unicode string. - This function converts the contents of the ASCII string Source to the Unicode - string Destination, and returns Destination. The function terminates the - Unicode string Destination by appending a Null-terminator character at the end. - The caller is responsible to make sure Destination points to a buffer with size + This function converts the contents of the ASCII string Source to the Unicode + string Destination, and returns Destination. The function terminates the + Unicode string Destination by appending a Null-terminator character at the end. + The caller is responsible to make sure Destination points to a buffer with size equal or greater than ((AsciiStrLen (Source) + 1) * sizeof (CHAR16)) in bytes. - + If Destination is NULL, then ASSERT(). If Destination is not aligned on a 16-bit boundary, then ASSERT(). If Source is NULL, then ASSERT(). If Source and Destination overlap, then ASSERT(). - If PcdMaximumAsciiStringLength is not zero, and Source contains more than - PcdMaximumAsciiStringLength ASCII characters not including the Null-terminator, + If PcdMaximumAsciiStringLength is not zero, and Source contains more than + PcdMaximumAsciiStringLength ASCII characters not including the Null-terminator, then ASSERT(). - If PcdMaximumUnicodeStringLength is not zero, and Source contains more than - PcdMaximumUnicodeStringLength ASCII characters not including the + If PcdMaximumUnicodeStringLength is not zero, and Source contains more than + PcdMaximumUnicodeStringLength ASCII characters not including the Null-terminator, then ASSERT(). @param Source Pointer to a Null-terminated ASCII string. @@ -3018,16 +3018,16 @@ InterlockedCompareExchangePointer ( // /** - Calculate the sum of all elements in a buffer in unit of UINT8. + Calculate the sum of all elements in a buffer in unit of UINT8. During calculation, the carry bits are dropped. - This function calculates the sum of all elements in a buffer - in unit of UINT8. The carry bits in result of addition are dropped. - The result is returned as UINT8. If Length is Zero, then Zero is + This function calculates the sum of all elements in a buffer + in unit of UINT8. The carry bits in result of addition are dropped. + The result is returned as UINT8. If Length is Zero, then Zero is returned. - + If Buffer is NULL, then ASSERT(). - If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). + If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). @param Buffer Pointer to the buffer to carry out the sum operation. @param Length The size, in bytes, of Buffer . @@ -3044,14 +3044,14 @@ CalculateSum8 ( /** - Returns the two's complement checksum of all elements in a buffer + Returns the two's complement checksum of all elements in a buffer of 8-bit values. - This function first calculates the sum of the 8-bit values in the - buffer specified by Buffer and Length. The carry bits in the result - of addition are dropped. Then, the two's complement of the sum is + This function first calculates the sum of the 8-bit values in the + buffer specified by Buffer and Length. The carry bits in the result + of addition are dropped. Then, the two's complement of the sum is returned. If Length is 0, then 0 is returned. - + If Buffer is NULL, then ASSERT(). If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). @@ -3070,13 +3070,13 @@ CalculateCheckSum8 ( ); /** - Returns the sum of all elements in a buffer of 16-bit values. During + Returns the sum of all elements in a buffer of 16-bit values. During calculation, the carry bits are dropped. - This function calculates the sum of the 16-bit values in the buffer - specified by Buffer and Length. The carry bits in result of addition are dropped. - The 16-bit result is returned. If Length is 0, then 0 is returned. - + This function calculates the sum of the 16-bit values in the buffer + specified by Buffer and Length. The carry bits in result of addition are dropped. + The 16-bit result is returned. If Length is 0, then 0 is returned. + If Buffer is NULL, then ASSERT(). If Buffer is not aligned on a 16-bit boundary, then ASSERT(). If Length is not aligned on a 16-bit boundary, then ASSERT(). @@ -3096,18 +3096,18 @@ CalculateSum16 ( ); /** - Returns the two's complement checksum of all elements in a buffer of + Returns the two's complement checksum of all elements in a buffer of 16-bit values. - This function first calculates the sum of the 16-bit values in the buffer - specified by Buffer and Length. The carry bits in the result of addition - are dropped. Then, the two's complement of the sum is returned. If Length + This function first calculates the sum of the 16-bit values in the buffer + specified by Buffer and Length. The carry bits in the result of addition + are dropped. Then, the two's complement of the sum is returned. If Length is 0, then 0 is returned. - + If Buffer is NULL, then ASSERT(). If Buffer is not aligned on a 16-bit boundary, then ASSERT(). If Length is not aligned on a 16-bit boundary, then ASSERT(). - If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). + If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). @param Buffer Pointer to the buffer to carry out the checksum operation. @param Length The size, in bytes, of Buffer. @@ -3123,13 +3123,13 @@ CalculateCheckSum16 ( ); /** - Returns the sum of all elements in a buffer of 32-bit values. During + Returns the sum of all elements in a buffer of 32-bit values. During calculation, the carry bits are dropped. - This function calculates the sum of the 32-bit values in the buffer - specified by Buffer and Length. The carry bits in result of addition are dropped. - The 32-bit result is returned. If Length is 0, then 0 is returned. - + This function calculates the sum of the 32-bit values in the buffer + specified by Buffer and Length. The carry bits in result of addition are dropped. + The 32-bit result is returned. If Length is 0, then 0 is returned. + If Buffer is NULL, then ASSERT(). If Buffer is not aligned on a 32-bit boundary, then ASSERT(). If Length is not aligned on a 32-bit boundary, then ASSERT(). @@ -3149,18 +3149,18 @@ CalculateSum32 ( ); /** - Returns the two's complement checksum of all elements in a buffer of + Returns the two's complement checksum of all elements in a buffer of 32-bit values. - This function first calculates the sum of the 32-bit values in the buffer - specified by Buffer and Length. The carry bits in the result of addition - are dropped. Then, the two's complement of the sum is returned. If Length + This function first calculates the sum of the 32-bit values in the buffer + specified by Buffer and Length. The carry bits in the result of addition + are dropped. Then, the two's complement of the sum is returned. If Length is 0, then 0 is returned. - + If Buffer is NULL, then ASSERT(). If Buffer is not aligned on a 32-bit boundary, then ASSERT(). If Length is not aligned on a 32-bit boundary, then ASSERT(). - If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). + If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). @param Buffer Pointer to the buffer to carry out the checksum operation. @param Length The size, in bytes, of Buffer. @@ -3176,13 +3176,13 @@ CalculateCheckSum32 ( ); /** - Returns the sum of all elements in a buffer of 64-bit values. During + Returns the sum of all elements in a buffer of 64-bit values. During calculation, the carry bits are dropped. - This function calculates the sum of the 64-bit values in the buffer - specified by Buffer and Length. The carry bits in result of addition are dropped. - The 64-bit result is returned. If Length is 0, then 0 is returned. - + This function calculates the sum of the 64-bit values in the buffer + specified by Buffer and Length. The carry bits in result of addition are dropped. + The 64-bit result is returned. If Length is 0, then 0 is returned. + If Buffer is NULL, then ASSERT(). If Buffer is not aligned on a 64-bit boundary, then ASSERT(). If Length is not aligned on a 64-bit boundary, then ASSERT(). @@ -3202,18 +3202,18 @@ CalculateSum64 ( ); /** - Returns the two's complement checksum of all elements in a buffer of + Returns the two's complement checksum of all elements in a buffer of 64-bit values. - This function first calculates the sum of the 64-bit values in the buffer - specified by Buffer and Length. The carry bits in the result of addition - are dropped. Then, the two's complement of the sum is returned. If Length + This function first calculates the sum of the 64-bit values in the buffer + specified by Buffer and Length. The carry bits in the result of addition + are dropped. Then, the two's complement of the sum is returned. If Length is 0, then 0 is returned. - + If Buffer is NULL, then ASSERT(). If Buffer is not aligned on a 64-bit boundary, then ASSERT(). If Length is not aligned on a 64-bit boundary, then ASSERT(). - If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). + If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). @param Buffer Pointer to the buffer to carry out the checksum operation. @param Length The size, in bytes, of Buffer. @@ -3429,10 +3429,14 @@ CpuFlushTlb ( /** Transfers control to a function starting with a new stack. - Transfers control to the function specified by EntryPoint using the new stack - specified by NewStack and passing in the parameters specified by Context1 and - Context2. Context1 and Context2 are optional and may be NULL. The function - EntryPoint must never return. + Transfers control to the function specified by EntryPoint using the + new stack specified by NewStack and passing in the parameters specified + by Context1 and Context2. Context1 and Context2 are optional and may + be NULL. The function EntryPoint must never return. This function + supports a variable number of arguments following the NewStack parameter. + These additional arguments are ignored on IA-32, x64, and EBC. + IPF CPUs expect one additional parameter of type VOID * that specifies + the new backing store pointer. If EntryPoint is NULL, then ASSERT(). If NewStack is NULL, then ASSERT(). @@ -3452,7 +3456,8 @@ SwitchStack ( IN SWITCH_STACK_ENTRY_POINT EntryPoint, IN VOID *Context1, OPTIONAL IN VOID *Context2, OPTIONAL - IN VOID *NewStack + IN VOID *NewStack, + ... ); /** @@ -5666,38 +5671,6 @@ AsmPrepareAndThunk16 ( IN OUT THUNK_CONTEXT *ThunkContext ); -/** - Transfers control to a function starting with a new stack. - - Transfers control to the function specified by EntryPoint using the new stack - specified by NewStack and passing in the parameters specified by Context1 and - Context2. Context1 and Context2 are optional and may be NULL. The function - EntryPoint must never return. - - If EntryPoint is NULL, then ASSERT(). - If NewStack is NULL, then ASSERT(). - - @param EntryPoint A pointer to function to call with the new stack. - @param Context1 A pointer to the context to pass into the EntryPoint - function. - @param Context2 A pointer to the context to pass into the EntryPoint - function. - @param NewStack A pointer to the new stack to use for the EntryPoint - function. - @param NewBsp A pointer to the new memory location for RSE backing - store. - -**/ -VOID -EFIAPI -AsmSwitchStackAndBackingStore ( - IN SWITCH_STACK_ENTRY_POINT EntryPoint, - IN VOID *Context1, OPTIONAL - IN VOID *Context2, OPTIONAL - IN VOID *NewStack, - IN VOID *NewBsp - ); - typedef struct { UINT64 Status; UINT64 r9; @@ -5751,21 +5724,21 @@ IpfReadItc ( /** - Flush a range of cache lines in the cache coherency domain of the calling + Flush a range of cache lines in the cache coherency domain of the calling CPU. - Invalidates the cache lines specified by Address and Length. If Address is - not aligned on a cache line boundary, then entire cache line containing - Address is invalidated. If Address + Length is not aligned on a cache line + Invalidates the cache lines specified by Address and Length. If Address is + not aligned on a cache line boundary, then entire cache line containing + Address is invalidated. If Address + Length is not aligned on a cache line boundary, then the entire instruction cache line containing Address + Length - -1 is invalidated. This function may choose to invalidate the entire - instruction cache if that is more efficient than invalidating the specified - range. If Length is 0, the no instruction cache lines are invalidated. + -1 is invalidated. This function may choose to invalidate the entire + instruction cache if that is more efficient than invalidating the specified + range. If Length is 0, the no instruction cache lines are invalidated. Address is returned. If Length is greater than (MAX_ADDRESS - Address + 1), then ASSERT(). - @param Address The base address of the instruction lines to invalidate. If + @param Address The base address of the instruction lines to invalidate. If the CPU is in a physical addressing mode, then Address is a physical address. If the CPU is in a virtual addressing mode, then Address is a virtual address. diff --git a/MdePkg/Library/BaseLib/BaseLib.msa b/MdePkg/Library/BaseLib/BaseLib.msa index 185810f397..99ba05a870 100644 --- a/MdePkg/Library/BaseLib/BaseLib.msa +++ b/MdePkg/Library/BaseLib/BaseLib.msa @@ -499,7 +499,7 @@ Ipf/CpuPause.s Ipf/CpuFlushTlb.s Ipf/GetInterruptState.s - Ipf/Non-existing.c + Ipf/InternalSwitchStack.c Ipf/FlushCacheRange.s Ipf/ReadItc.s diff --git a/MdePkg/Library/BaseLib/BaseLibInternals.h b/MdePkg/Library/BaseLib/BaseLibInternals.h index 8c55cdc6a9..5160513033 100644 --- a/MdePkg/Library/BaseLib/BaseLibInternals.h +++ b/MdePkg/Library/BaseLib/BaseLibInternals.h @@ -314,10 +314,16 @@ InternalMathDivRemS64x64 ( /** Transfers control to a function starting with a new stack. - Transfers control to the function specified by EntryPoint using the new stack - specified by NewStack and passing in the parameters specified by Context1 and - Context2. Context1 and Context2 are optional and may be NULL. The function - EntryPoint must never return. + Transfers control to the function specified by EntryPoint using the + new stack specified by NewStack and passing in the parameters specified + by Context1 and Context2. Context1 and Context2 are optional and may + be NULL. The function EntryPoint must never return. + Marker will be ignored on IA-32, x64, and EBC. + IPF CPUs expect one additional parameter of type VOID * that specifies + the new backing store pointer. + + If EntryPoint is NULL, then ASSERT(). + If NewStack is NULL, then ASSERT(). @param EntryPoint A pointer to function to call with the new stack. @param Context1 A pointer to the context to pass into the EntryPoint @@ -326,15 +332,17 @@ InternalMathDivRemS64x64 ( function. @param NewStack A pointer to the new stack to use for the EntryPoint function. + @param Marker VA_LIST marker for the variable argument list. **/ VOID EFIAPI InternalSwitchStack ( IN SWITCH_STACK_ENTRY_POINT EntryPoint, - IN VOID *Context1, - IN VOID *Context2, - IN VOID *NewStack + IN VOID *Context1, OPTIONAL + IN VOID *Context2, OPTIONAL + IN VOID *NewStack, + IN VA_LIST Marker ); // @@ -656,9 +664,9 @@ InternalSyncDecrement ( Performs an atomic compare exchange operation on a 32-bit unsigned integer. Performs an atomic compare exchange operation on the 32-bit unsigned integer - specified by Value. If Value is equal to CompareValue, then Value is set to + specified by Value. If Value is equal to CompareValue, then Value is set to ExchangeValue and CompareValue is returned. If Value is not equal to CompareValue, - then Value is returned. The compare exchange operation must be performed using + then Value is returned. The compare exchange operation must be performed using MP safe mechanisms. @param Value A pointer to the 32-bit value for the compare exchange @@ -680,9 +688,9 @@ InternalSyncCompareExchange32 ( /** Performs an atomic compare exchange operation on a 64-bit unsigned integer. - Performs an atomic compare exchange operation on the 64-bit unsigned integer specified - by Value. If Value is equal to CompareValue, then Value is set to ExchangeValue and - CompareValue is returned. If Value is not equal to CompareValue, then Value is returned. + Performs an atomic compare exchange operation on the 64-bit unsigned integer specified + by Value. If Value is equal to CompareValue, then Value is set to ExchangeValue and + CompareValue is returned. If Value is not equal to CompareValue, then Value is returned. The compare exchange operation must be performed using MP safe mechanisms. @param Value A pointer to the 64-bit value for the compare exchange @@ -721,7 +729,7 @@ BitFieldReadUint ( ); /** - Worker function that reads a bit field from Operand, performs a bitwise OR, + Worker function that reads a bit field from Operand, performs a bitwise OR, and returns the result. Performs a bitwise OR between the bit field specified by StartBit and EndBit @@ -745,7 +753,7 @@ BitFieldOrUint ( ); /** - Worker function that reads a bit field from Operand, performs a bitwise AND, + Worker function that reads a bit field from Operand, performs a bitwise AND, and returns the result. Performs a bitwise AND between the bit field specified by StartBit and EndBit @@ -784,6 +792,7 @@ InternalAssertJumpBuffer ( IN BASE_LIBRARY_JUMP_BUFFER *JumpBuffer ); + /** Restores the CPU context that was saved with SetJump(). @@ -802,4 +811,41 @@ InternalLongJump ( IN UINTN Value ); + +// +// IPF specific functions +// + +/** + Transfers control to a function starting with a new stack. + + Transfers control to the function specified by EntryPoint using the new stack + specified by NewStack and passing in the parameters specified by Context1 and + Context2. Context1 and Context2 are optional and may be NULL. The function + EntryPoint must never return. + + If EntryPoint is NULL, then ASSERT(). + If NewStack is NULL, then ASSERT(). + + @param EntryPoint A pointer to function to call with the new stack. + @param Context1 A pointer to the context to pass into the EntryPoint + function. + @param Context2 A pointer to the context to pass into the EntryPoint + function. + @param NewStack A pointer to the new stack to use for the EntryPoint + function. + @param NewBsp A pointer to the new memory location for RSE backing + store. + +**/ +VOID +EFIAPI +AsmSwitchStackAndBackingStore ( + IN SWITCH_STACK_ENTRY_POINT EntryPoint, + IN VOID *Context1, OPTIONAL + IN VOID *Context2, OPTIONAL + IN VOID *NewStack, + IN VOID *NewBsp + ); + #endif diff --git a/MdePkg/Library/BaseLib/Ebc/SwitchStack.c b/MdePkg/Library/BaseLib/Ebc/SwitchStack.c index 8fadd4f384..d2861c4f85 100644 --- a/MdePkg/Library/BaseLib/Ebc/SwitchStack.c +++ b/MdePkg/Library/BaseLib/Ebc/SwitchStack.c @@ -1,7 +1,7 @@ /** @file Switch Stack functions. - Copyright (c) 2006, Intel Corporation
+ Copyright (c) 2006 - 2007, Intel Corporation
All rights reserved. This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at @@ -17,10 +17,13 @@ /** Transfers control to a function starting with a new stack. - Transfers control to the function specified by EntryPoint using the new stack - specified by NewStack and passing in the parameters specified by Context1 and - Context2. Context1 and Context2 are optional and may be NULL. The function - EntryPoint must never return. + Transfers control to the function specified by EntryPoint using the + new stack specified by NewStack and passing in the parameters specified + by Context1 and Context2. Context1 and Context2 are optional and may + be NULL. The function EntryPoint must never return. + Marker will be ignored on IA-32, x64, and EBC. + IPF CPUs expect one additional parameter of type VOID * that specifies + the new backing store pointer. If EntryPoint is NULL, then ASSERT(). If NewStack is NULL, then ASSERT(). @@ -32,21 +35,30 @@ function. @param NewStack A pointer to the new stack to use for the EntryPoint function. + @param Marker VA_LIST marker for the variable argument list. **/ VOID EFIAPI InternalSwitchStack ( IN SWITCH_STACK_ENTRY_POINT EntryPoint, - IN VOID *Context1, OPTIONAL - IN VOID *Context2, OPTIONAL - IN VOID *NewStack + IN VOID *Context1, OPTIONAL + IN VOID *Context2, OPTIONAL + IN VOID *NewStack, + IN VA_LIST Marker ) + { // // This version of this function does not actually change the stack pointer // This is to support compilation of CPU types that do not support assemblers // such as EBC // + + // + // Stack should be aligned with CPU_STACK_ALIGNMENT + // + ASSERT (((UINTN)NewStack & (CPU_STACK_ALIGNMENT - 1)) == 0); + EntryPoint (Context1, Context2); } diff --git a/MdePkg/Library/BaseLib/Ia32/InternalSwitchStack.c b/MdePkg/Library/BaseLib/Ia32/InternalSwitchStack.c index ab8116b4b5..c918f9f571 100644 --- a/MdePkg/Library/BaseLib/Ia32/InternalSwitchStack.c +++ b/MdePkg/Library/BaseLib/Ia32/InternalSwitchStack.c @@ -1,7 +1,7 @@ /** @file SwitchStack() function for IA-32. - Copyright (c) 2006, Intel Corporation
+ Copyright (c) 2006 - 2007, Intel Corporation
All rights reserved. This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at @@ -17,10 +17,16 @@ /** Transfers control to a function starting with a new stack. - Transfers control to the function specified by EntryPoint using the new stack - specified by NewStack and passing in the parameters specified by Context1 and - Context2. Context1 and Context2 are optional and may be NULL. The function - EntryPoint must never return. + Transfers control to the function specified by EntryPoint using the + new stack specified by NewStack and passing in the parameters specified + by Context1 and Context2. Context1 and Context2 are optional and may + be NULL. The function EntryPoint must never return. + Marker will be ignored on IA-32, x64, and EBC. + IPF CPUs expect one additional parameter of type VOID * that specifies + the new backing store pointer. + + If EntryPoint is NULL, then ASSERT(). + If NewStack is NULL, then ASSERT(). @param EntryPoint A pointer to function to call with the new stack. @param Context1 A pointer to the context to pass into the EntryPoint @@ -29,19 +35,26 @@ function. @param NewStack A pointer to the new stack to use for the EntryPoint function. + @param Marker VA_LIST marker for the variable argument list. **/ VOID EFIAPI InternalSwitchStack ( IN SWITCH_STACK_ENTRY_POINT EntryPoint, - IN VOID *Context1, - IN VOID *Context2, - IN VOID *NewStack + IN VOID *Context1, OPTIONAL + IN VOID *Context2, OPTIONAL + IN VOID *NewStack, + IN VA_LIST Marker ) { BASE_LIBRARY_JUMP_BUFFER JumpBuffer; + // + // Stack should be aligned with CPU_STACK_ALIGNMENT + // + ASSERT (((UINTN)NewStack & (CPU_STACK_ALIGNMENT - 1)) == 0); + JumpBuffer.Eip = (UINTN)EntryPoint; JumpBuffer.Esp = (UINTN)NewStack - sizeof (VOID*); JumpBuffer.Esp -= sizeof (Context1) + sizeof (Context2); diff --git a/MdePkg/Library/BaseLib/Ipf/InternalSwitchStack.c b/MdePkg/Library/BaseLib/Ipf/InternalSwitchStack.c new file mode 100644 index 0000000000..60d0a37562 --- /dev/null +++ b/MdePkg/Library/BaseLib/Ipf/InternalSwitchStack.c @@ -0,0 +1,68 @@ +/** @file + SwitchStack() function for IPF. + + Copyright (c) 2007, Intel Corporation
+ All rights reserved. This program and the accompanying materials + are licensed and made available under the terms and conditions of the BSD License + which accompanies this distribution. The full text of the license may be found at + http://opensource.org/licenses/bsd-license.php + + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, + WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. + + Module Name: InternalSwitchStack.c + +**/ + +#include + +/** + Transfers control to a function starting with a new stack. + + Transfers control to the function specified by EntryPoint using the + new stack specified by NewStack and passing in the parameters specified + by Context1 and Context2. Context1 and Context2 are optional and may + be NULL. The function EntryPoint must never return. + Marker will be ignored on IA-32, x64, and EBC. + IPF CPUs expect one additional parameter of type VOID * that specifies + the new backing store pointer. + + If EntryPoint is NULL, then ASSERT(). + If NewStack is NULL, then ASSERT(). + + @param EntryPoint A pointer to function to call with the new stack. + @param Context1 A pointer to the context to pass into the EntryPoint + function. + @param Context2 A pointer to the context to pass into the EntryPoint + function. + @param NewStack A pointer to the new stack to use for the EntryPoint + function. + @param Marker VA_LIST marker for the variable argument list. + +**/ +VOID +EFIAPI +InternalSwitchStack ( + IN SWITCH_STACK_ENTRY_POINT EntryPoint, + IN VOID *Context1, OPTIONAL + IN VOID *Context2, OPTIONAL + IN VOID *NewStack, + IN VA_LIST Marker + ) + +{ + VOID *NewBsp; + + // + // Get new backing store pointer from variable list + // + NewBsp = VA_ARG (Marker, VOID *); + + // + // Stack should be aligned with CPU_STACK_ALIGNMENT + // + ASSERT (((UINTN)NewStack & (CPU_STACK_ALIGNMENT - 1)) == 0); + ASSERT (((UINTN)NewBsp & (CPU_STACK_ALIGNMENT - 1)) == 0); + + AsmSwitchStackAndBackingStore (EntryPoint, Context1, Context2, NewStack, NewBsp); +} diff --git a/MdePkg/Library/BaseLib/Ipf/Non-existing.c b/MdePkg/Library/BaseLib/Ipf/Non-existing.c deleted file mode 100644 index bbb5bdf943..0000000000 --- a/MdePkg/Library/BaseLib/Ipf/Non-existing.c +++ /dev/null @@ -1,53 +0,0 @@ -/** @file - Non-existing BaseLib functions on Ipf - - Copyright (c) 2006, Intel Corporation - All rights reserved. This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - - Module Name: Non-existing.c - -**/ - -#include "../BaseLibInternals.h" -/** - Transfers control to a function starting with a new stack. - - Transfers control to the function specified by EntryPoint using the new stack - specified by NewStack and passing in the parameters specified by Context1 and - Context2. Context1 and Context2 are optional and may be NULL. The function - EntryPoint must never return. - - If EntryPoint is NULL, then ASSERT(). - If NewStack is NULL, then ASSERT(). - - @param EntryPoint A pointer to function to call with the new stack. - @param Context1 A pointer to the context to pass into the EntryPoint - function. - @param Context2 A pointer to the context to pass into the EntryPoint - function. - @param NewStack A pointer to the new stack to use for the EntryPoint - function. - -**/ -VOID -EFIAPI -InternalSwitchStack ( - IN SWITCH_STACK_ENTRY_POINT EntryPoint, - IN VOID *Context1, OPTIONAL - IN VOID *Context2, OPTIONAL - IN VOID *NewStack - ) -{ - // - // This version of this function does not actually change the stack pointer - // This is to support compilation of CPU types that do not support assemblers - // such as EBC - // - ASSERT (FALSE); -} diff --git a/MdePkg/Library/BaseLib/SwitchStack.c b/MdePkg/Library/BaseLib/SwitchStack.c index 98d832dfd6..6b8d7af4b6 100644 --- a/MdePkg/Library/BaseLib/SwitchStack.c +++ b/MdePkg/Library/BaseLib/SwitchStack.c @@ -1,7 +1,7 @@ /** @file Switch Stack functions. - Copyright (c) 2006, Intel Corporation
+ Copyright (c) 2006 - 2007, Intel Corporation
All rights reserved. This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at @@ -19,14 +19,17 @@ /** Transfers control to a function starting with a new stack. - Transfers control to the function specified by EntryPoint using the new stack - specified by NewStack and passing in the parameters specified by Context1 and - Context2. Context1 and Context2 are optional and may be NULL. The function - EntryPoint must never return. + Transfers control to the function specified by EntryPoint using the + new stack specified by NewStack and passing in the parameters specified + by Context1 and Context2. Context1 and Context2 are optional and may + be NULL. The function EntryPoint must never return. This function + supports a variable number of arguments following the NewStack parameter. + These additional arguments are ignored on IA-32, x64, and EBC. + IPF CPUs expect one additional parameter of type VOID * that specifies + the new backing store pointer. If EntryPoint is NULL, then ASSERT(). If NewStack is NULL, then ASSERT(). - For IPF CPUs, if NewStack is not aligned on a 16-byte boundary, then ASSERT(). @param EntryPoint A pointer to function to call with the new stack. @param Context1 A pointer to the context to pass into the EntryPoint @@ -41,16 +44,19 @@ VOID EFIAPI SwitchStack ( IN SWITCH_STACK_ENTRY_POINT EntryPoint, - IN VOID *Context1, - IN VOID *Context2, - IN VOID *NewStack + IN VOID *Context1, OPTIONAL + IN VOID *Context2, OPTIONAL + IN VOID *NewStack, + ... ) { + VA_LIST Marker; + ASSERT (EntryPoint != NULL && NewStack != NULL); -#ifdef MDE_CPU_IPF - ASSERT (((UINTN)NewStack & 0xf) == 0); -#endif + VA_START (Marker, NewStack); + + InternalSwitchStack (EntryPoint, Context1, Context2, NewStack, Marker); - InternalSwitchStack (EntryPoint, Context1, Context2, NewStack); + VA_END (Marker); } -- 2.39.2