summaryrefslogtreecommitdiff
path: root/MdePkg/Library/BaseLib
diff options
context:
space:
mode:
authorvanjeff <vanjeff@6f19259b-4bc3-4df7-8a09-765794883524>2006-06-20 05:30:27 +0000
committervanjeff <vanjeff@6f19259b-4bc3-4df7-8a09-765794883524>2006-06-20 05:30:27 +0000
commit0ffa12863e9e60cfd1900e3a83b21f32f89afdf2 (patch)
treee586ef67e1638568fd150d15a77b55dc239d4c00 /MdePkg/Library/BaseLib
parent31a76725479ec06e1657fad04c93af5e8685930b (diff)
downloadedk2-0ffa12863e9e60cfd1900e3a83b21f32f89afdf2.zip
edk2-0ffa12863e9e60cfd1900e3a83b21f32f89afdf2.tar.gz
edk2-0ffa12863e9e60cfd1900e3a83b21f32f89afdf2.tar.bz2
1. Fixed bug for WriteUnaligned24() in Unaligned.c of BaseLib
2. Added assert() for AsmFxRestore() in x86LowLevel.c of BaseLib 3. Added assert() for LongJump() in LongJump.c of BaseLib 4. Changed parameter type of Value from "IN" to "IN OUT" for InterLockedComparedExchanged32/64/pointer() functions to sync with MWG-0.55a 5. Changed functions header of all BitField functions of BaseLib, BaseIoLibIntrinsic, BasePciCf8Lib, BasePciExpressLib, BasePciLibCf8, BasePciLibPciExpressLib DxeIoLibCpuIo, PeiIoLibCpuIo etc, to follow MWG-0.55a. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@565 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'MdePkg/Library/BaseLib')
-rw-r--r--MdePkg/Library/BaseLib/BitField.c40
-rw-r--r--MdePkg/Library/BaseLib/LongJump.c2
-rw-r--r--MdePkg/Library/BaseLib/Synchronization.c6
-rw-r--r--MdePkg/Library/BaseLib/Unaligned.c2
-rw-r--r--MdePkg/Library/BaseLib/x86LowLevel.c32
5 files changed, 48 insertions, 34 deletions
diff --git a/MdePkg/Library/BaseLib/BitField.c b/MdePkg/Library/BaseLib/BitField.c
index ad95339..9c1aff1 100644
--- a/MdePkg/Library/BaseLib/BitField.c
+++ b/MdePkg/Library/BaseLib/BitField.c
@@ -69,7 +69,7 @@ BitFieldAndUint (
If 8-bit operations are not supported, then ASSERT().
If StartBit is greater than 7, then ASSERT().
If EndBit is greater than 7, then ASSERT().
- If EndBit is less than or equal to StartBit, then ASSERT().
+ If EndBit is less than StartBit, then ASSERT().
@param Operand Operand on which to perform the bitfield operation.
@param StartBit The ordinal of the least significant bit in the bit field.
@@ -103,7 +103,7 @@ BitFieldRead8 (
If 8-bit operations are not supported, then ASSERT().
If StartBit is greater than 7, then ASSERT().
If EndBit is greater than 7, then ASSERT().
- If EndBit is less than or equal to StartBit, then ASSERT().
+ If EndBit is less than StartBit, then ASSERT().
@param Operand Operand on which to perform the bitfield operation.
@param StartBit The ordinal of the least significant bit in the bit field.
@@ -140,7 +140,7 @@ BitFieldWrite8 (
If 8-bit operations are not supported, then ASSERT().
If StartBit is greater than 7, then ASSERT().
If EndBit is greater than 7, then ASSERT().
- If EndBit is less than or equal to StartBit, then ASSERT().
+ If EndBit is less than StartBit, then ASSERT().
@param Operand Operand on which to perform the bitfield operation.
@param StartBit The ordinal of the least significant bit in the bit field.
@@ -177,7 +177,7 @@ BitFieldOr8 (
If 8-bit operations are not supported, then ASSERT().
If StartBit is greater than 7, then ASSERT().
If EndBit is greater than 7, then ASSERT().
- If EndBit is less than or equal to StartBit, then ASSERT().
+ If EndBit is less than StartBit, then ASSERT().
@param Operand Operand on which to perform the bitfield operation.
@param StartBit The ordinal of the least significant bit in the bit field.
@@ -215,7 +215,7 @@ BitFieldAnd8 (
If 8-bit operations are not supported, then ASSERT().
If StartBit is greater than 7, then ASSERT().
If EndBit is greater than 7, then ASSERT().
- If EndBit is less than or equal to StartBit, then ASSERT().
+ If EndBit is less than StartBit, then ASSERT().
@param Operand Operand on which to perform the bitfield operation.
@param StartBit The ordinal of the least significant bit in the bit field.
@@ -256,7 +256,7 @@ BitFieldAndThenOr8 (
If 16-bit operations are not supported, then ASSERT().
If StartBit is greater than 15, then ASSERT().
If EndBit is greater than 15, then ASSERT().
- If EndBit is less than or equal to StartBit, then ASSERT().
+ If EndBit is less than StartBit, then ASSERT().
@param Operand Operand on which to perform the bitfield operation.
@param StartBit The ordinal of the least significant bit in the bit field.
@@ -290,7 +290,7 @@ BitFieldRead16 (
If 16-bit operations are not supported, then ASSERT().
If StartBit is greater than 15, then ASSERT().
If EndBit is greater than 15, then ASSERT().
- If EndBit is less than or equal to StartBit, then ASSERT().
+ If EndBit is less than StartBit, then ASSERT().
@param Operand Operand on which to perform the bitfield operation.
@param StartBit The ordinal of the least significant bit in the bit field.
@@ -327,7 +327,7 @@ BitFieldWrite16 (
If 16-bit operations are not supported, then ASSERT().
If StartBit is greater than 15, then ASSERT().
If EndBit is greater than 15, then ASSERT().
- If EndBit is less than or equal to StartBit, then ASSERT().
+ If EndBit is less than StartBit, then ASSERT().
@param Operand Operand on which to perform the bitfield operation.
@param StartBit The ordinal of the least significant bit in the bit field.
@@ -364,7 +364,7 @@ BitFieldOr16 (
If 16-bit operations are not supported, then ASSERT().
If StartBit is greater than 15, then ASSERT().
If EndBit is greater than 15, then ASSERT().
- If EndBit is less than or equal to StartBit, then ASSERT().
+ If EndBit is less than StartBit, then ASSERT().
@param Operand Operand on which to perform the bitfield operation.
@param StartBit The ordinal of the least significant bit in the bit field.
@@ -402,7 +402,7 @@ BitFieldAnd16 (
If 16-bit operations are not supported, then ASSERT().
If StartBit is greater than 15, then ASSERT().
If EndBit is greater than 15, then ASSERT().
- If EndBit is less than or equal to StartBit, then ASSERT().
+ If EndBit is less than StartBit, then ASSERT().
@param Operand Operand on which to perform the bitfield operation.
@param StartBit The ordinal of the least significant bit in the bit field.
@@ -443,7 +443,7 @@ BitFieldAndThenOr16 (
If 32-bit operations are not supported, then ASSERT().
If StartBit is greater than 31, then ASSERT().
If EndBit is greater than 31, then ASSERT().
- If EndBit is less than or equal to StartBit, then ASSERT().
+ If EndBit is less than StartBit, then ASSERT().
@param Operand Operand on which to perform the bitfield operation.
@param StartBit The ordinal of the least significant bit in the bit field.
@@ -477,7 +477,7 @@ BitFieldRead32 (
If 32-bit operations are not supported, then ASSERT().
If StartBit is greater than 31, then ASSERT().
If EndBit is greater than 31, then ASSERT().
- If EndBit is less than or equal to StartBit, then ASSERT().
+ If EndBit is less than StartBit, then ASSERT().
@param Operand Operand on which to perform the bitfield operation.
@param StartBit The ordinal of the least significant bit in the bit field.
@@ -514,7 +514,7 @@ BitFieldWrite32 (
If 32-bit operations are not supported, then ASSERT().
If StartBit is greater than 31, then ASSERT().
If EndBit is greater than 31, then ASSERT().
- If EndBit is less than or equal to StartBit, then ASSERT().
+ If EndBit is less than StartBit, then ASSERT().
@param Operand Operand on which to perform the bitfield operation.
@param StartBit The ordinal of the least significant bit in the bit field.
@@ -551,7 +551,7 @@ BitFieldOr32 (
If 32-bit operations are not supported, then ASSERT().
If StartBit is greater than 31, then ASSERT().
If EndBit is greater than 31, then ASSERT().
- If EndBit is less than or equal to StartBit, then ASSERT().
+ If EndBit is less than StartBit, then ASSERT().
@param Operand Operand on which to perform the bitfield operation.
@param StartBit The ordinal of the least significant bit in the bit field.
@@ -589,7 +589,7 @@ BitFieldAnd32 (
If 32-bit operations are not supported, then ASSERT().
If StartBit is greater than 31, then ASSERT().
If EndBit is greater than 31, then ASSERT().
- If EndBit is less than or equal to StartBit, then ASSERT().
+ If EndBit is less than StartBit, then ASSERT().
@param Operand Operand on which to perform the bitfield operation.
@param StartBit The ordinal of the least significant bit in the bit field.
@@ -630,7 +630,7 @@ BitFieldAndThenOr32 (
If 64-bit operations are not supported, then ASSERT().
If StartBit is greater than 63, then ASSERT().
If EndBit is greater than 63, then ASSERT().
- If EndBit is less than or equal to StartBit, then ASSERT().
+ If EndBit is less than StartBit, then ASSERT().
@param Operand Operand on which to perform the bitfield operation.
@param StartBit The ordinal of the least significant bit in the bit field.
@@ -664,7 +664,7 @@ BitFieldRead64 (
If 64-bit operations are not supported, then ASSERT().
If StartBit is greater than 63, then ASSERT().
If EndBit is greater than 63, then ASSERT().
- If EndBit is less than or equal to StartBit, then ASSERT().
+ If EndBit is less than StartBit, then ASSERT().
@param Operand Operand on which to perform the bitfield operation.
@param StartBit The ordinal of the least significant bit in the bit field.
@@ -701,7 +701,7 @@ BitFieldWrite64 (
If 64-bit operations are not supported, then ASSERT().
If StartBit is greater than 63, then ASSERT().
If EndBit is greater than 63, then ASSERT().
- If EndBit is less than or equal to StartBit, then ASSERT().
+ If EndBit is less than StartBit, then ASSERT().
@param Operand Operand on which to perform the bitfield operation.
@param StartBit The ordinal of the least significant bit in the bit field.
@@ -739,7 +739,7 @@ BitFieldOr64 (
If 64-bit operations are not supported, then ASSERT().
If StartBit is greater than 63, then ASSERT().
If EndBit is greater than 63, then ASSERT().
- If EndBit is less than or equal to StartBit, then ASSERT().
+ If EndBit is less than StartBit, then ASSERT().
@param Operand Operand on which to perform the bitfield operation.
@param StartBit The ordinal of the least significant bit in the bit field.
@@ -778,7 +778,7 @@ BitFieldAnd64 (
If 64-bit operations are not supported, then ASSERT().
If StartBit is greater than 63, then ASSERT().
If EndBit is greater than 63, then ASSERT().
- If EndBit is less than or equal to StartBit, then ASSERT().
+ If EndBit is less than StartBit, then ASSERT().
@param Operand Operand on which to perform the bitfield operation.
@param StartBit The ordinal of the least significant bit in the bit field.
diff --git a/MdePkg/Library/BaseLib/LongJump.c b/MdePkg/Library/BaseLib/LongJump.c
index 302d4bd..85f091e 100644
--- a/MdePkg/Library/BaseLib/LongJump.c
+++ b/MdePkg/Library/BaseLib/LongJump.c
@@ -49,5 +49,7 @@ LongJump (
)
{
InternalAssertJumpBuffer (JumpBuffer);
+ ASSERT (Value != 0);
+
InternalLongJump (JumpBuffer, Value);
}
diff --git a/MdePkg/Library/BaseLib/Synchronization.c b/MdePkg/Library/BaseLib/Synchronization.c
index c04edfc..4c47345 100644
--- a/MdePkg/Library/BaseLib/Synchronization.c
+++ b/MdePkg/Library/BaseLib/Synchronization.c
@@ -278,7 +278,7 @@ InterlockedDecrement (
UINT32
EFIAPI
InterlockedCompareExchange32 (
- IN UINT32 *Value,
+ IN OUT UINT32 *Value,
IN UINT32 CompareValue,
IN UINT32 ExchangeValue
)
@@ -301,7 +301,7 @@ InterlockedCompareExchange32 (
UINT64
EFIAPI
InterlockedCompareExchange64 (
- IN UINT64 *Value,
+ IN OUT UINT64 *Value,
IN UINT64 CompareValue,
IN UINT64 ExchangeValue
)
@@ -330,7 +330,7 @@ InterlockedCompareExchange64 (
VOID *
EFIAPI
InterlockedCompareExchangePointer (
- IN VOID **Value,
+ IN OUT VOID **Value,
IN VOID *CompareValue,
IN VOID *ExchangeValue
)
diff --git a/MdePkg/Library/BaseLib/Unaligned.c b/MdePkg/Library/BaseLib/Unaligned.c
index 2ce8fc6..18c486d 100644
--- a/MdePkg/Library/BaseLib/Unaligned.c
+++ b/MdePkg/Library/BaseLib/Unaligned.c
@@ -113,7 +113,7 @@ WriteUnaligned24 (
{
ASSERT (Buffer != NULL);
- BitFieldWrite32 (*Buffer, 0, 23, Value);
+ *Buffer = BitFieldWrite32 (*Buffer, 0, 23, Value);
return Value;
}
diff --git a/MdePkg/Library/BaseLib/x86LowLevel.c b/MdePkg/Library/BaseLib/x86LowLevel.c
index c222c6c..391fbbf 100644
--- a/MdePkg/Library/BaseLib/x86LowLevel.c
+++ b/MdePkg/Library/BaseLib/x86LowLevel.c
@@ -122,7 +122,7 @@ AsmMsrAndThenOr32 (
If StartBit is greater than 31, then ASSERT().
If EndBit is greater than 31, then ASSERT().
- If EndBit is less than or equal to StartBit, then ASSERT().
+ If EndBit is less than StartBit, then ASSERT().
@param Index The 32-bit MSR index to read.
@param StartBit The ordinal of the least significant bit in the bit field.
@@ -157,7 +157,7 @@ AsmMsrBitFieldRead32 (
If StartBit is greater than 31, then ASSERT().
If EndBit is greater than 31, then ASSERT().
- If EndBit is less than or equal to StartBit, then ASSERT().
+ If EndBit is less than StartBit, then ASSERT().
@param Index The 32-bit MSR index to write.
@param StartBit The ordinal of the least significant bit in the bit field.
@@ -197,7 +197,7 @@ AsmMsrBitFieldWrite32 (
If StartBit is greater than 31, then ASSERT().
If EndBit is greater than 31, then ASSERT().
- If EndBit is less than or equal to StartBit, then ASSERT().
+ If EndBit is less than StartBit, then ASSERT().
@param Index The 32-bit MSR index to write.
@param StartBit The ordinal of the least significant bit in the bit field.
@@ -237,7 +237,7 @@ AsmMsrBitFieldOr32 (
If StartBit is greater than 31, then ASSERT().
If EndBit is greater than 31, then ASSERT().
- If EndBit is less than or equal to StartBit, then ASSERT().
+ If EndBit is less than StartBit, then ASSERT().
@param Index The 32-bit MSR index to write.
@param StartBit The ordinal of the least significant bit in the bit field.
@@ -279,7 +279,7 @@ AsmMsrBitFieldAnd32 (
If StartBit is greater than 31, then ASSERT().
If EndBit is greater than 31, then ASSERT().
- If EndBit is less than or equal to StartBit, then ASSERT().
+ If EndBit is less than StartBit, then ASSERT().
@param Index The 32-bit MSR index to write.
@param StartBit The ordinal of the least significant bit in the bit field.
@@ -412,7 +412,7 @@ AsmMsrAndThenOr64 (
If StartBit is greater than 63, then ASSERT().
If EndBit is greater than 63, then ASSERT().
- If EndBit is less than or equal to StartBit, then ASSERT().
+ If EndBit is less than StartBit, then ASSERT().
@param Index The 32-bit MSR index to read.
@param StartBit The ordinal of the least significant bit in the bit field.
@@ -446,7 +446,7 @@ AsmMsrBitFieldRead64 (
If StartBit is greater than 63, then ASSERT().
If EndBit is greater than 63, then ASSERT().
- If EndBit is less than or equal to StartBit, then ASSERT().
+ If EndBit is less than StartBit, then ASSERT().
@param Index The 32-bit MSR index to write.
@param StartBit The ordinal of the least significant bit in the bit field.
@@ -487,7 +487,7 @@ AsmMsrBitFieldWrite64 (
If StartBit is greater than 63, then ASSERT().
If EndBit is greater than 63, then ASSERT().
- If EndBit is less than or equal to StartBit, then ASSERT().
+ If EndBit is less than StartBit, then ASSERT().
@param Index The 32-bit MSR index to write.
@param StartBit The ordinal of the least significant bit in the bit field.
@@ -528,7 +528,7 @@ AsmMsrBitFieldOr64 (
If StartBit is greater than 63, then ASSERT().
If EndBit is greater than 63, then ASSERT().
- If EndBit is less than or equal to StartBit, then ASSERT().
+ If EndBit is less than StartBit, then ASSERT().
@param Index The 32-bit MSR index to write.
@param StartBit The ordinal of the least significant bit in the bit field.
@@ -570,7 +570,7 @@ AsmMsrBitFieldAnd64 (
If StartBit is greater than 63, then ASSERT().
If EndBit is greater than 63, then ASSERT().
- If EndBit is less than or equal to StartBit, then ASSERT().
+ If EndBit is less than StartBit, then ASSERT().
@param Index The 32-bit MSR index to write.
@param StartBit The ordinal of the least significant bit in the bit field.
@@ -740,7 +740,13 @@ AsmFxSave (
{
ASSERT (Buffer != NULL);
ASSERT (((UINTN)Buffer & 0xf) == 0);
+
InternalX86FxSave (Buffer);
+
+ //
+ // Mark one flag at end of Buffer, it will be check by AsmFxRestor()
+ //
+ *(UINT32 *) (&Buffer[sizeof (IA32_FX_BUFFER) - 4]) = 0xAA5555AA;
}
/**
@@ -765,6 +771,12 @@ AsmFxRestore (
{
ASSERT (Buffer != NULL);
ASSERT (((UINTN)Buffer & 0xf) == 0);
+
+ //
+ // Check the flag recorded by AsmFxSave()
+ //
+ ASSERT (*(UINT32 *) (&Buffer[sizeof (IA32_FX_BUFFER) - 4]) == 0xAA5555AA);
+
InternalX86FxRestore (Buffer);
}