summaryrefslogtreecommitdiffstats
path: root/MdePkg/Library/BaseLib
diff options
context:
space:
mode:
Diffstat (limited to 'MdePkg/Library/BaseLib')
-rw-r--r--MdePkg/Library/BaseLib/ARShiftU64.c4
-rw-r--r--MdePkg/Library/BaseLib/Arm/InternalSwitchStack.c1
-rw-r--r--MdePkg/Library/BaseLib/Arm/Unaligned.c66
-rw-r--r--MdePkg/Library/BaseLib/BaseLibInternals.h140
-rw-r--r--MdePkg/Library/BaseLib/BitField.c215
-rw-r--r--MdePkg/Library/BaseLib/CheckSum.c104
-rw-r--r--MdePkg/Library/BaseLib/ChkStkGcc.c4
-rw-r--r--MdePkg/Library/BaseLib/Cpu.c6
-rw-r--r--MdePkg/Library/BaseLib/CpuDeadLoop.c4
-rw-r--r--MdePkg/Library/BaseLib/DivS64x64Remainder.c9
-rw-r--r--MdePkg/Library/BaseLib/DivU64x32.c7
-rw-r--r--MdePkg/Library/BaseLib/DivU64x32Remainder.c9
-rw-r--r--MdePkg/Library/BaseLib/DivU64x64Remainder.c9
-rw-r--r--MdePkg/Library/BaseLib/Ebc/CpuBreakpoint.c3
-rw-r--r--MdePkg/Library/BaseLib/Ebc/SpeculationBarrier.c1
-rw-r--r--MdePkg/Library/BaseLib/FilePaths.c39
-rw-r--r--MdePkg/Library/BaseLib/GetPowerOfTwo32.c5
-rw-r--r--MdePkg/Library/BaseLib/GetPowerOfTwo64.c7
-rw-r--r--MdePkg/Library/BaseLib/HighBitSet32.c14
-rw-r--r--MdePkg/Library/BaseLib/HighBitSet64.c7
-rw-r--r--MdePkg/Library/BaseLib/Ia32/ARShiftU64.c8
-rw-r--r--MdePkg/Library/BaseLib/Ia32/CpuBreakpoint.c9
-rw-r--r--MdePkg/Library/BaseLib/Ia32/CpuId.c10
-rw-r--r--MdePkg/Library/BaseLib/Ia32/CpuIdEx.c12
-rw-r--r--MdePkg/Library/BaseLib/Ia32/CpuPause.c4
-rw-r--r--MdePkg/Library/BaseLib/Ia32/DisableCache.c1
-rw-r--r--MdePkg/Library/BaseLib/Ia32/DisableInterrupts.c4
-rw-r--r--MdePkg/Library/BaseLib/Ia32/DisablePaging32.c2
-rw-r--r--MdePkg/Library/BaseLib/Ia32/DivS64x64Remainder.c17
-rw-r--r--MdePkg/Library/BaseLib/Ia32/DivU64x32.c8
-rw-r--r--MdePkg/Library/BaseLib/Ia32/DivU64x32Remainder.c7
-rw-r--r--MdePkg/Library/BaseLib/Ia32/EnableCache.c1
-rw-r--r--MdePkg/Library/BaseLib/Ia32/EnableDisableInterrupts.c4
-rw-r--r--MdePkg/Library/BaseLib/Ia32/EnableInterrupts.c4
-rw-r--r--MdePkg/Library/BaseLib/Ia32/EnablePaging32.c2
-rw-r--r--MdePkg/Library/BaseLib/Ia32/FlushCacheLine.c6
-rw-r--r--MdePkg/Library/BaseLib/Ia32/FxRestore.c5
-rw-r--r--MdePkg/Library/BaseLib/Ia32/FxSave.c5
-rw-r--r--MdePkg/Library/BaseLib/Ia32/GccInline.c81
-rw-r--r--MdePkg/Library/BaseLib/Ia32/GccInlinePriv.c173
-rw-r--r--MdePkg/Library/BaseLib/Ia32/InternalSwitchStack.c10
-rw-r--r--MdePkg/Library/BaseLib/Ia32/Invd.c4
-rw-r--r--MdePkg/Library/BaseLib/Ia32/LRotU64.c10
-rw-r--r--MdePkg/Library/BaseLib/Ia32/LShiftU64.c8
-rw-r--r--MdePkg/Library/BaseLib/Ia32/ModU64x32.c7
-rw-r--r--MdePkg/Library/BaseLib/Ia32/Monitor.c7
-rw-r--r--MdePkg/Library/BaseLib/Ia32/MultU64x32.c8
-rw-r--r--MdePkg/Library/BaseLib/Ia32/MultU64x64.c8
-rw-r--r--MdePkg/Library/BaseLib/Ia32/Mwait.c5
-rw-r--r--MdePkg/Library/BaseLib/Ia32/Non-existing.c10
-rw-r--r--MdePkg/Library/BaseLib/Ia32/RRotU64.c8
-rw-r--r--MdePkg/Library/BaseLib/Ia32/RShiftU64.c8
-rw-r--r--MdePkg/Library/BaseLib/Ia32/ReadCr0.c3
-rw-r--r--MdePkg/Library/BaseLib/Ia32/ReadCr2.c4
-rw-r--r--MdePkg/Library/BaseLib/Ia32/ReadCr3.c4
-rw-r--r--MdePkg/Library/BaseLib/Ia32/ReadCr4.c4
-rw-r--r--MdePkg/Library/BaseLib/Ia32/ReadCs.c4
-rw-r--r--MdePkg/Library/BaseLib/Ia32/ReadDr0.c4
-rw-r--r--MdePkg/Library/BaseLib/Ia32/ReadDr1.c4
-rw-r--r--MdePkg/Library/BaseLib/Ia32/ReadDr2.c4
-rw-r--r--MdePkg/Library/BaseLib/Ia32/ReadDr3.c4
-rw-r--r--MdePkg/Library/BaseLib/Ia32/ReadDr4.c4
-rw-r--r--MdePkg/Library/BaseLib/Ia32/ReadDr5.c4
-rw-r--r--MdePkg/Library/BaseLib/Ia32/ReadDr6.c4
-rw-r--r--MdePkg/Library/BaseLib/Ia32/ReadDr7.c4
-rw-r--r--MdePkg/Library/BaseLib/Ia32/ReadDs.c4
-rw-r--r--MdePkg/Library/BaseLib/Ia32/ReadEflags.c4
-rw-r--r--MdePkg/Library/BaseLib/Ia32/ReadEs.c4
-rw-r--r--MdePkg/Library/BaseLib/Ia32/ReadFs.c4
-rw-r--r--MdePkg/Library/BaseLib/Ia32/ReadGdtr.c3
-rw-r--r--MdePkg/Library/BaseLib/Ia32/ReadGs.c4
-rw-r--r--MdePkg/Library/BaseLib/Ia32/ReadIdtr.c4
-rw-r--r--MdePkg/Library/BaseLib/Ia32/ReadLdtr.c4
-rw-r--r--MdePkg/Library/BaseLib/Ia32/ReadMm0.c4
-rw-r--r--MdePkg/Library/BaseLib/Ia32/ReadMm1.c4
-rw-r--r--MdePkg/Library/BaseLib/Ia32/ReadMm2.c4
-rw-r--r--MdePkg/Library/BaseLib/Ia32/ReadMm3.c4
-rw-r--r--MdePkg/Library/BaseLib/Ia32/ReadMm4.c4
-rw-r--r--MdePkg/Library/BaseLib/Ia32/ReadMm5.c4
-rw-r--r--MdePkg/Library/BaseLib/Ia32/ReadMm6.c4
-rw-r--r--MdePkg/Library/BaseLib/Ia32/ReadMm7.c4
-rw-r--r--MdePkg/Library/BaseLib/Ia32/ReadMsr64.c6
-rw-r--r--MdePkg/Library/BaseLib/Ia32/ReadPmc.c3
-rw-r--r--MdePkg/Library/BaseLib/Ia32/ReadSs.c4
-rw-r--r--MdePkg/Library/BaseLib/Ia32/ReadTr.c4
-rw-r--r--MdePkg/Library/BaseLib/Ia32/ReadTsc.c4
-rw-r--r--MdePkg/Library/BaseLib/Ia32/SwapBytes64.c6
-rw-r--r--MdePkg/Library/BaseLib/Ia32/Wbinvd.c4
-rw-r--r--MdePkg/Library/BaseLib/Ia32/WriteCr0.c1
-rw-r--r--MdePkg/Library/BaseLib/Ia32/WriteCr2.c1
-rw-r--r--MdePkg/Library/BaseLib/Ia32/WriteCr3.c1
-rw-r--r--MdePkg/Library/BaseLib/Ia32/WriteCr4.c1
-rw-r--r--MdePkg/Library/BaseLib/Ia32/WriteDr0.c3
-rw-r--r--MdePkg/Library/BaseLib/Ia32/WriteDr1.c3
-rw-r--r--MdePkg/Library/BaseLib/Ia32/WriteDr2.c3
-rw-r--r--MdePkg/Library/BaseLib/Ia32/WriteDr3.c3
-rw-r--r--MdePkg/Library/BaseLib/Ia32/WriteDr4.c3
-rw-r--r--MdePkg/Library/BaseLib/Ia32/WriteDr5.c3
-rw-r--r--MdePkg/Library/BaseLib/Ia32/WriteDr6.c3
-rw-r--r--MdePkg/Library/BaseLib/Ia32/WriteDr7.c3
-rw-r--r--MdePkg/Library/BaseLib/Ia32/WriteGdtr.c5
-rw-r--r--MdePkg/Library/BaseLib/Ia32/WriteIdtr.c4
-rw-r--r--MdePkg/Library/BaseLib/Ia32/WriteLdtr.c6
-rw-r--r--MdePkg/Library/BaseLib/Ia32/WriteMm0.c6
-rw-r--r--MdePkg/Library/BaseLib/Ia32/WriteMm1.c6
-rw-r--r--MdePkg/Library/BaseLib/Ia32/WriteMm2.c6
-rw-r--r--MdePkg/Library/BaseLib/Ia32/WriteMm3.c6
-rw-r--r--MdePkg/Library/BaseLib/Ia32/WriteMm4.c5
-rw-r--r--MdePkg/Library/BaseLib/Ia32/WriteMm5.c5
-rw-r--r--MdePkg/Library/BaseLib/Ia32/WriteMm6.c6
-rw-r--r--MdePkg/Library/BaseLib/Ia32/WriteMm7.c6
-rw-r--r--MdePkg/Library/BaseLib/Ia32/WriteMsr64.c5
-rw-r--r--MdePkg/Library/BaseLib/LRotU32.c4
-rw-r--r--MdePkg/Library/BaseLib/LRotU64.c4
-rw-r--r--MdePkg/Library/BaseLib/LShiftU64.c4
-rw-r--r--MdePkg/Library/BaseLib/LinkedList.c60
-rw-r--r--MdePkg/Library/BaseLib/LongJump.c3
-rw-r--r--MdePkg/Library/BaseLib/LowBitSet32.c11
-rw-r--r--MdePkg/Library/BaseLib/LowBitSet64.c12
-rw-r--r--MdePkg/Library/BaseLib/Math64.c65
-rw-r--r--MdePkg/Library/BaseLib/ModU64x32.c7
-rw-r--r--MdePkg/Library/BaseLib/MultS64x64.c9
-rw-r--r--MdePkg/Library/BaseLib/MultU64x32.c9
-rw-r--r--MdePkg/Library/BaseLib/MultU64x64.c9
-rw-r--r--MdePkg/Library/BaseLib/QuickSort.c31
-rw-r--r--MdePkg/Library/BaseLib/RRotU32.c4
-rw-r--r--MdePkg/Library/BaseLib/RRotU64.c4
-rw-r--r--MdePkg/Library/BaseLib/RShiftU64.c4
-rw-r--r--MdePkg/Library/BaseLib/RiscV64/CpuBreakpoint.c5
-rw-r--r--MdePkg/Library/BaseLib/RiscV64/CpuPause.c7
-rw-r--r--MdePkg/Library/BaseLib/RiscV64/DisableInterrupts.c6
-rw-r--r--MdePkg/Library/BaseLib/RiscV64/EnableInterrupts.c6
-rw-r--r--MdePkg/Library/BaseLib/RiscV64/GetInterruptState.c11
-rw-r--r--MdePkg/Library/BaseLib/RiscV64/InternalSwitchStack.c12
-rw-r--r--MdePkg/Library/BaseLib/SafeString.c619
-rw-r--r--MdePkg/Library/BaseLib/SetJump.c3
-rw-r--r--MdePkg/Library/BaseLib/String.c330
-rw-r--r--MdePkg/Library/BaseLib/SwapBytes16.c7
-rw-r--r--MdePkg/Library/BaseLib/SwapBytes32.c9
-rw-r--r--MdePkg/Library/BaseLib/SwapBytes64.c5
-rw-r--r--MdePkg/Library/BaseLib/SwitchStack.c2
-rw-r--r--MdePkg/Library/BaseLib/Unaligned.c26
-rw-r--r--MdePkg/Library/BaseLib/UnitTestHost.c2
-rw-r--r--MdePkg/Library/BaseLib/X64/CpuBreakpoint.c7
-rw-r--r--MdePkg/Library/BaseLib/X64/GccInline.c87
-rw-r--r--MdePkg/Library/BaseLib/X64/GccInlinePriv.c198
-rw-r--r--MdePkg/Library/BaseLib/X64/Non-existing.c11
-rw-r--r--MdePkg/Library/BaseLib/X64/ReadMsr64.c11
-rw-r--r--MdePkg/Library/BaseLib/X64/WriteMsr64.c10
-rw-r--r--MdePkg/Library/BaseLib/X86DisablePaging32.c3
-rw-r--r--MdePkg/Library/BaseLib/X86DisablePaging64.c13
-rw-r--r--MdePkg/Library/BaseLib/X86EnablePaging32.c3
-rw-r--r--MdePkg/Library/BaseLib/X86EnablePaging64.c13
-rw-r--r--MdePkg/Library/BaseLib/X86FxRestore.c7
-rw-r--r--MdePkg/Library/BaseLib/X86FxSave.c7
-rw-r--r--MdePkg/Library/BaseLib/X86GetInterruptState.c6
-rw-r--r--MdePkg/Library/BaseLib/X86MemoryFence.c3
-rw-r--r--MdePkg/Library/BaseLib/X86Msr.c116
-rw-r--r--MdePkg/Library/BaseLib/X86PatchInstruction.c48
-rw-r--r--MdePkg/Library/BaseLib/X86RdRand.c6
-rw-r--r--MdePkg/Library/BaseLib/X86ReadGdtr.c5
-rw-r--r--MdePkg/Library/BaseLib/X86ReadIdtr.c5
-rw-r--r--MdePkg/Library/BaseLib/X86Thunk.c51
-rw-r--r--MdePkg/Library/BaseLib/X86UnitTestHost.c196
-rw-r--r--MdePkg/Library/BaseLib/X86WriteGdtr.c5
-rw-r--r--MdePkg/Library/BaseLib/X86WriteIdtr.c5
166 files changed, 1543 insertions, 1912 deletions
diff --git a/MdePkg/Library/BaseLib/ARShiftU64.c b/MdePkg/Library/BaseLib/ARShiftU64.c
index 9928854ddf..ce1dfe9496 100644
--- a/MdePkg/Library/BaseLib/ARShiftU64.c
+++ b/MdePkg/Library/BaseLib/ARShiftU64.c
@@ -26,8 +26,8 @@
UINT64
EFIAPI
ARShiftU64 (
- IN UINT64 Operand,
- IN UINTN Count
+ IN UINT64 Operand,
+ IN UINTN Count
)
{
ASSERT (Count < 64);
diff --git a/MdePkg/Library/BaseLib/Arm/InternalSwitchStack.c b/MdePkg/Library/BaseLib/Arm/InternalSwitchStack.c
index 034ee041f3..258e39732e 100644
--- a/MdePkg/Library/BaseLib/Arm/InternalSwitchStack.c
+++ b/MdePkg/Library/BaseLib/Arm/InternalSwitchStack.c
@@ -33,7 +33,6 @@ InternalSwitchStackAsm (
IN VOID *NewStack
);
-
/**
Transfers control to a function starting with a new stack.
diff --git a/MdePkg/Library/BaseLib/Arm/Unaligned.c b/MdePkg/Library/BaseLib/Arm/Unaligned.c
index e9934e7003..73b7a78f5b 100644
--- a/MdePkg/Library/BaseLib/Arm/Unaligned.c
+++ b/MdePkg/Library/BaseLib/Arm/Unaligned.c
@@ -27,16 +27,16 @@
UINT16
EFIAPI
ReadUnaligned16 (
- IN CONST UINT16 *Buffer
+ IN CONST UINT16 *Buffer
)
{
- volatile UINT8 LowerByte;
- volatile UINT8 HigherByte;
+ volatile UINT8 LowerByte;
+ volatile UINT8 HigherByte;
ASSERT (Buffer != NULL);
- LowerByte = ((UINT8*)Buffer)[0];
- HigherByte = ((UINT8*)Buffer)[1];
+ LowerByte = ((UINT8 *)Buffer)[0];
+ HigherByte = ((UINT8 *)Buffer)[1];
return (UINT16)(LowerByte | (HigherByte << 8));
}
@@ -59,14 +59,14 @@ ReadUnaligned16 (
UINT16
EFIAPI
WriteUnaligned16 (
- OUT UINT16 *Buffer,
- IN UINT16 Value
+ OUT UINT16 *Buffer,
+ IN UINT16 Value
)
{
ASSERT (Buffer != NULL);
- ((volatile UINT8*)Buffer)[0] = (UINT8)Value;
- ((volatile UINT8*)Buffer)[1] = (UINT8)(Value >> 8);
+ ((volatile UINT8 *)Buffer)[0] = (UINT8)Value;
+ ((volatile UINT8 *)Buffer)[1] = (UINT8)(Value >> 8);
return Value;
}
@@ -87,15 +87,15 @@ WriteUnaligned16 (
UINT32
EFIAPI
ReadUnaligned24 (
- IN CONST UINT32 *Buffer
+ IN CONST UINT32 *Buffer
)
{
ASSERT (Buffer != NULL);
return (UINT32)(
- ReadUnaligned16 ((UINT16*)Buffer) |
- (((UINT8*)Buffer)[2] << 16)
- );
+ ReadUnaligned16 ((UINT16 *)Buffer) |
+ (((UINT8 *)Buffer)[2] << 16)
+ );
}
/**
@@ -116,14 +116,14 @@ ReadUnaligned24 (
UINT32
EFIAPI
WriteUnaligned24 (
- OUT UINT32 *Buffer,
- IN UINT32 Value
+ OUT UINT32 *Buffer,
+ IN UINT32 Value
)
{
ASSERT (Buffer != NULL);
- WriteUnaligned16 ((UINT16*)Buffer, (UINT16)Value);
- *(UINT8*)((UINT16*)Buffer + 1) = (UINT8)(Value >> 16);
+ WriteUnaligned16 ((UINT16 *)Buffer, (UINT16)Value);
+ *(UINT8 *)((UINT16 *)Buffer + 1) = (UINT8)(Value >> 16);
return Value;
}
@@ -143,7 +143,7 @@ WriteUnaligned24 (
UINT32
EFIAPI
ReadUnaligned32 (
- IN CONST UINT32 *Buffer
+ IN CONST UINT32 *Buffer
)
{
UINT16 LowerBytes;
@@ -151,10 +151,10 @@ ReadUnaligned32 (
ASSERT (Buffer != NULL);
- LowerBytes = ReadUnaligned16 ((UINT16*) Buffer);
- HigherBytes = ReadUnaligned16 ((UINT16*) Buffer + 1);
+ LowerBytes = ReadUnaligned16 ((UINT16 *)Buffer);
+ HigherBytes = ReadUnaligned16 ((UINT16 *)Buffer + 1);
- return (UINT32) (LowerBytes | (HigherBytes << 16));
+ return (UINT32)(LowerBytes | (HigherBytes << 16));
}
/**
@@ -175,14 +175,14 @@ ReadUnaligned32 (
UINT32
EFIAPI
WriteUnaligned32 (
- OUT UINT32 *Buffer,
- IN UINT32 Value
+ OUT UINT32 *Buffer,
+ IN UINT32 Value
)
{
ASSERT (Buffer != NULL);
- WriteUnaligned16 ((UINT16*)Buffer, (UINT16)Value);
- WriteUnaligned16 ((UINT16*)Buffer + 1, (UINT16)(Value >> 16));
+ WriteUnaligned16 ((UINT16 *)Buffer, (UINT16)Value);
+ WriteUnaligned16 ((UINT16 *)Buffer + 1, (UINT16)(Value >> 16));
return Value;
}
@@ -202,7 +202,7 @@ WriteUnaligned32 (
UINT64
EFIAPI
ReadUnaligned64 (
- IN CONST UINT64 *Buffer
+ IN CONST UINT64 *Buffer
)
{
UINT32 LowerBytes;
@@ -210,10 +210,10 @@ ReadUnaligned64 (
ASSERT (Buffer != NULL);
- LowerBytes = ReadUnaligned32 ((UINT32*) Buffer);
- HigherBytes = ReadUnaligned32 ((UINT32*) Buffer + 1);
+ LowerBytes = ReadUnaligned32 ((UINT32 *)Buffer);
+ HigherBytes = ReadUnaligned32 ((UINT32 *)Buffer + 1);
- return (UINT64) (LowerBytes | LShiftU64 (HigherBytes, 32));
+ return (UINT64)(LowerBytes | LShiftU64 (HigherBytes, 32));
}
/**
@@ -234,13 +234,13 @@ ReadUnaligned64 (
UINT64
EFIAPI
WriteUnaligned64 (
- OUT UINT64 *Buffer,
- IN UINT64 Value
+ OUT UINT64 *Buffer,
+ IN UINT64 Value
)
{
ASSERT (Buffer != NULL);
- WriteUnaligned32 ((UINT32*)Buffer, (UINT32)Value);
- WriteUnaligned32 ((UINT32*)Buffer + 1, (UINT32)RShiftU64 (Value, 32));
+ WriteUnaligned32 ((UINT32 *)Buffer, (UINT32)Value);
+ WriteUnaligned32 ((UINT32 *)Buffer + 1, (UINT32)RShiftU64 (Value, 32));
return Value;
}
diff --git a/MdePkg/Library/BaseLib/BaseLibInternals.h b/MdePkg/Library/BaseLib/BaseLibInternals.h
index 13ac982e92..d61e604385 100644
--- a/MdePkg/Library/BaseLib/BaseLibInternals.h
+++ b/MdePkg/Library/BaseLib/BaseLibInternals.h
@@ -35,8 +35,8 @@
UINT64
EFIAPI
InternalMathLShiftU64 (
- IN UINT64 Operand,
- IN UINTN Count
+ IN UINT64 Operand,
+ IN UINTN Count
);
/**
@@ -55,8 +55,8 @@ InternalMathLShiftU64 (
UINT64
EFIAPI
InternalMathRShiftU64 (
- IN UINT64 Operand,
- IN UINTN Count
+ IN UINT64 Operand,
+ IN UINTN Count
);
/**
@@ -75,8 +75,8 @@ InternalMathRShiftU64 (
UINT64
EFIAPI
InternalMathARShiftU64 (
- IN UINT64 Operand,
- IN UINTN Count
+ IN UINT64 Operand,
+ IN UINTN Count
);
/**
@@ -96,8 +96,8 @@ InternalMathARShiftU64 (
UINT64
EFIAPI
InternalMathLRotU64 (
- IN UINT64 Operand,
- IN UINTN Count
+ IN UINT64 Operand,
+ IN UINTN Count
);
/**
@@ -117,8 +117,8 @@ InternalMathLRotU64 (
UINT64
EFIAPI
InternalMathRRotU64 (
- IN UINT64 Operand,
- IN UINTN Count
+ IN UINT64 Operand,
+ IN UINTN Count
);
/**
@@ -136,7 +136,7 @@ InternalMathRRotU64 (
UINT64
EFIAPI
InternalMathSwapBytes64 (
- IN UINT64 Operand
+ IN UINT64 Operand
);
/**
@@ -156,8 +156,8 @@ InternalMathSwapBytes64 (
UINT64
EFIAPI
InternalMathMultU64x32 (
- IN UINT64 Multiplicand,
- IN UINT32 Multiplier
+ IN UINT64 Multiplicand,
+ IN UINT32 Multiplier
);
/**
@@ -177,8 +177,8 @@ InternalMathMultU64x32 (
UINT64
EFIAPI
InternalMathMultU64x64 (
- IN UINT64 Multiplicand,
- IN UINT64 Multiplier
+ IN UINT64 Multiplicand,
+ IN UINT64 Multiplier
);
/**
@@ -198,8 +198,8 @@ InternalMathMultU64x64 (
UINT64
EFIAPI
InternalMathDivU64x32 (
- IN UINT64 Dividend,
- IN UINT32 Divisor
+ IN UINT64 Dividend,
+ IN UINT32 Divisor
);
/**
@@ -219,8 +219,8 @@ InternalMathDivU64x32 (
UINT32
EFIAPI
InternalMathModU64x32 (
- IN UINT64 Dividend,
- IN UINT32 Divisor
+ IN UINT64 Dividend,
+ IN UINT32 Divisor
);
/**
@@ -243,9 +243,9 @@ InternalMathModU64x32 (
UINT64
EFIAPI
InternalMathDivRemU64x32 (
- IN UINT64 Dividend,
- IN UINT32 Divisor,
- OUT UINT32 *Remainder OPTIONAL
+ IN UINT64 Dividend,
+ IN UINT32 Divisor,
+ OUT UINT32 *Remainder OPTIONAL
);
/**
@@ -268,9 +268,9 @@ InternalMathDivRemU64x32 (
UINT64
EFIAPI
InternalMathDivRemU64x64 (
- IN UINT64 Dividend,
- IN UINT64 Divisor,
- OUT UINT64 *Remainder OPTIONAL
+ IN UINT64 Dividend,
+ IN UINT64 Divisor,
+ OUT UINT64 *Remainder OPTIONAL
);
/**
@@ -293,9 +293,9 @@ InternalMathDivRemU64x64 (
INT64
EFIAPI
InternalMathDivRemS64x64 (
- IN INT64 Dividend,
- IN INT64 Divisor,
- OUT INT64 *Remainder OPTIONAL
+ IN INT64 Dividend,
+ IN INT64 Divisor,
+ OUT INT64 *Remainder OPTIONAL
);
/**
@@ -332,7 +332,6 @@ InternalSwitchStack (
IN VA_LIST Marker
);
-
/**
Worker function that returns a bit field from Operand.
@@ -348,12 +347,11 @@ InternalSwitchStack (
UINTN
EFIAPI
BitFieldReadUint (
- IN UINTN Operand,
- IN UINTN StartBit,
- IN UINTN EndBit
+ IN UINTN Operand,
+ IN UINTN StartBit,
+ IN UINTN EndBit
);
-
/**
Worker function that reads a bit field from Operand, performs a bitwise OR,
and returns the result.
@@ -373,13 +371,12 @@ BitFieldReadUint (
UINTN
EFIAPI
BitFieldOrUint (
- IN UINTN Operand,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINTN OrData
+ IN UINTN Operand,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINTN OrData
);
-
/**
Worker function that reads a bit field from Operand, performs a bitwise AND,
and returns the result.
@@ -399,13 +396,12 @@ BitFieldOrUint (
UINTN
EFIAPI
BitFieldAndUint (
- IN UINTN Operand,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINTN AndData
+ IN UINTN Operand,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINTN AndData
);
-
/**
Worker function that checks ASSERT condition for JumpBuffer
@@ -423,7 +419,6 @@ InternalAssertJumpBuffer (
IN BASE_LIBRARY_JUMP_BUFFER *JumpBuffer
);
-
/**
Restores the CPU context that was saved with SetJump().
@@ -442,7 +437,6 @@ InternalLongJump (
IN UINTN Value
);
-
/**
Check if a Unicode character is a decimal character.
@@ -459,10 +453,9 @@ InternalLongJump (
BOOLEAN
EFIAPI
InternalIsDecimalDigitCharacter (
- IN CHAR16 Char
+ IN CHAR16 Char
);
-
/**
Convert a Unicode character to numerical value.
@@ -479,10 +472,9 @@ InternalIsDecimalDigitCharacter (
UINTN
EFIAPI
InternalHexCharToUintn (
- IN CHAR16 Char
+ IN CHAR16 Char
);
-
/**
Check if a Unicode character is a hexadecimal character.
@@ -500,10 +492,9 @@ InternalHexCharToUintn (
BOOLEAN
EFIAPI
InternalIsHexaDecimalDigitCharacter (
- IN CHAR16 Char
+ IN CHAR16 Char
);
-
/**
Check if a ASCII character is a decimal character.
@@ -520,10 +511,9 @@ InternalIsHexaDecimalDigitCharacter (
BOOLEAN
EFIAPI
InternalAsciiIsDecimalDigitCharacter (
- IN CHAR8 Char
+ IN CHAR8 Char
);
-
/**
Check if a ASCII character is a hexadecimal character.
@@ -541,10 +531,9 @@ InternalAsciiIsDecimalDigitCharacter (
BOOLEAN
EFIAPI
InternalAsciiIsHexaDecimalDigitCharacter (
- IN CHAR8 Char
+ IN CHAR8 Char
);
-
/**
Convert a ASCII character to numerical value.
@@ -561,10 +550,9 @@ InternalAsciiIsHexaDecimalDigitCharacter (
UINTN
EFIAPI
InternalAsciiHexCharToUintn (
- IN CHAR8 Char
+ IN CHAR8 Char
);
-
//
// Ia32 and x64 specific functions
//
@@ -582,7 +570,7 @@ InternalAsciiHexCharToUintn (
VOID
EFIAPI
InternalX86ReadGdtr (
- OUT IA32_DESCRIPTOR *Gdtr
+ OUT IA32_DESCRIPTOR *Gdtr
);
/**
@@ -597,7 +585,7 @@ InternalX86ReadGdtr (
VOID
EFIAPI
InternalX86WriteGdtr (
- IN CONST IA32_DESCRIPTOR *Gdtr
+ IN CONST IA32_DESCRIPTOR *Gdtr
);
/**
@@ -612,7 +600,7 @@ InternalX86WriteGdtr (
VOID
EFIAPI
InternalX86ReadIdtr (
- OUT IA32_DESCRIPTOR *Idtr
+ OUT IA32_DESCRIPTOR *Idtr
);
/**
@@ -627,7 +615,7 @@ InternalX86ReadIdtr (
VOID
EFIAPI
InternalX86WriteIdtr (
- IN CONST IA32_DESCRIPTOR *Idtr
+ IN CONST IA32_DESCRIPTOR *Idtr
);
/**
@@ -643,7 +631,7 @@ InternalX86WriteIdtr (
VOID
EFIAPI
InternalX86FxSave (
- OUT IA32_FX_BUFFER *Buffer
+ OUT IA32_FX_BUFFER *Buffer
);
/**
@@ -659,7 +647,7 @@ InternalX86FxSave (
VOID
EFIAPI
InternalX86FxRestore (
- IN CONST IA32_FX_BUFFER *Buffer
+ IN CONST IA32_FX_BUFFER *Buffer
);
/**
@@ -773,11 +761,11 @@ InternalX86DisablePaging32 (
VOID
EFIAPI
InternalX86EnablePaging64 (
- IN UINT16 Cs,
- IN UINT64 EntryPoint,
- IN UINT64 Context1 OPTIONAL,
- IN UINT64 Context2 OPTIONAL,
- IN UINT64 NewStack
+ IN UINT16 Cs,
+ IN UINT64 EntryPoint,
+ IN UINT64 Context1 OPTIONAL,
+ IN UINT64 Context2 OPTIONAL,
+ IN UINT64 NewStack
);
/**
@@ -809,11 +797,11 @@ InternalX86EnablePaging64 (
VOID
EFIAPI
InternalX86DisablePaging64 (
- IN UINT16 Cs,
- IN UINT32 EntryPoint,
- IN UINT32 Context1 OPTIONAL,
- IN UINT32 Context2 OPTIONAL,
- IN UINT32 NewStack
+ IN UINT16 Cs,
+ IN UINT32 EntryPoint,
+ IN UINT32 Context1 OPTIONAL,
+ IN UINT32 Context2 OPTIONAL,
+ IN UINT32 NewStack
);
/**
@@ -828,7 +816,7 @@ InternalX86DisablePaging64 (
BOOLEAN
EFIAPI
InternalX86RdRand16 (
- OUT UINT16 *Rand
+ OUT UINT16 *Rand
);
/**
@@ -843,7 +831,7 @@ InternalX86RdRand16 (
BOOLEAN
EFIAPI
InternalX86RdRand32 (
- OUT UINT32 *Rand
+ OUT UINT32 *Rand
);
/**
@@ -859,7 +847,7 @@ InternalX86RdRand32 (
BOOLEAN
EFIAPI
InternalX86RdRand64 (
- OUT UINT64 *Rand
+ OUT UINT64 *Rand
);
#else
diff --git a/MdePkg/Library/BaseLib/BitField.c b/MdePkg/Library/BaseLib/BitField.c
index 0f48a036ba..862af53e9c 100644
--- a/MdePkg/Library/BaseLib/BitField.c
+++ b/MdePkg/Library/BaseLib/BitField.c
@@ -23,9 +23,9 @@
UINTN
EFIAPI
InternalBaseLibBitFieldReadUint (
- IN UINTN Operand,
- IN UINTN StartBit,
- IN UINTN EndBit
+ IN UINTN Operand,
+ IN UINTN StartBit,
+ IN UINTN EndBit
)
{
//
@@ -56,10 +56,10 @@ InternalBaseLibBitFieldReadUint (
UINTN
EFIAPI
InternalBaseLibBitFieldOrUint (
- IN UINTN Operand,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINTN OrData
+ IN UINTN Operand,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINTN OrData
)
{
//
@@ -74,7 +74,7 @@ InternalBaseLibBitFieldOrUint (
// ~((UINTN)-2 << EndBit) is a mask in which bit[0] thru bit[EndBit]
// are 1's while bit[EndBit + 1] thru the most significant bit are 0's.
//
- return Operand | ((OrData << StartBit) & ~((UINTN) -2 << EndBit));
+ return Operand | ((OrData << StartBit) & ~((UINTN)-2 << EndBit));
}
/**
@@ -98,10 +98,10 @@ InternalBaseLibBitFieldOrUint (
UINTN
EFIAPI
InternalBaseLibBitFieldAndUint (
- IN UINTN Operand,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINTN AndData
+ IN UINTN Operand,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINTN AndData
)
{
//
@@ -141,9 +141,9 @@ InternalBaseLibBitFieldAndUint (
UINT8
EFIAPI
BitFieldRead8 (
- IN UINT8 Operand,
- IN UINTN StartBit,
- IN UINTN EndBit
+ IN UINT8 Operand,
+ IN UINTN StartBit,
+ IN UINTN EndBit
)
{
ASSERT (EndBit < 8);
@@ -177,10 +177,10 @@ BitFieldRead8 (
UINT8
EFIAPI
BitFieldWrite8 (
- IN UINT8 Operand,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT8 Value
+ IN UINT8 Operand,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT8 Value
)
{
ASSERT (EndBit < 8);
@@ -215,10 +215,10 @@ BitFieldWrite8 (
UINT8
EFIAPI
BitFieldOr8 (
- IN UINT8 Operand,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT8 OrData
+ IN UINT8 Operand,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT8 OrData
)
{
ASSERT (EndBit < 8);
@@ -253,10 +253,10 @@ BitFieldOr8 (
UINT8
EFIAPI
BitFieldAnd8 (
- IN UINT8 Operand,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT8 AndData
+ IN UINT8 Operand,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT8 AndData
)
{
ASSERT (EndBit < 8);
@@ -294,11 +294,11 @@ BitFieldAnd8 (
UINT8
EFIAPI
BitFieldAndThenOr8 (
- IN UINT8 Operand,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT8 AndData,
- IN UINT8 OrData
+ IN UINT8 Operand,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT8 AndData,
+ IN UINT8 OrData
)
{
ASSERT (EndBit < 8);
@@ -333,9 +333,9 @@ BitFieldAndThenOr8 (
UINT16
EFIAPI
BitFieldRead16 (
- IN UINT16 Operand,
- IN UINTN StartBit,
- IN UINTN EndBit
+ IN UINT16 Operand,
+ IN UINTN StartBit,
+ IN UINTN EndBit
)
{
ASSERT (EndBit < 16);
@@ -369,10 +369,10 @@ BitFieldRead16 (
UINT16
EFIAPI
BitFieldWrite16 (
- IN UINT16 Operand,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT16 Value
+ IN UINT16 Operand,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT16 Value
)
{
ASSERT (EndBit < 16);
@@ -407,10 +407,10 @@ BitFieldWrite16 (
UINT16
EFIAPI
BitFieldOr16 (
- IN UINT16 Operand,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT16 OrData
+ IN UINT16 Operand,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT16 OrData
)
{
ASSERT (EndBit < 16);
@@ -445,10 +445,10 @@ BitFieldOr16 (
UINT16
EFIAPI
BitFieldAnd16 (
- IN UINT16 Operand,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT16 AndData
+ IN UINT16 Operand,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT16 AndData
)
{
ASSERT (EndBit < 16);
@@ -486,11 +486,11 @@ BitFieldAnd16 (
UINT16
EFIAPI
BitFieldAndThenOr16 (
- IN UINT16 Operand,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT16 AndData,
- IN UINT16 OrData
+ IN UINT16 Operand,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT16 AndData,
+ IN UINT16 OrData
)
{
ASSERT (EndBit < 16);
@@ -525,9 +525,9 @@ BitFieldAndThenOr16 (
UINT32
EFIAPI
BitFieldRead32 (
- IN UINT32 Operand,
- IN UINTN StartBit,
- IN UINTN EndBit
+ IN UINT32 Operand,
+ IN UINTN StartBit,
+ IN UINTN EndBit
)
{
ASSERT (EndBit < 32);
@@ -561,10 +561,10 @@ BitFieldRead32 (
UINT32
EFIAPI
BitFieldWrite32 (
- IN UINT32 Operand,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT32 Value
+ IN UINT32 Operand,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT32 Value
)
{
ASSERT (EndBit < 32);
@@ -599,10 +599,10 @@ BitFieldWrite32 (
UINT32
EFIAPI
BitFieldOr32 (
- IN UINT32 Operand,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT32 OrData
+ IN UINT32 Operand,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT32 OrData
)
{
ASSERT (EndBit < 32);
@@ -637,10 +637,10 @@ BitFieldOr32 (
UINT32
EFIAPI
BitFieldAnd32 (
- IN UINT32 Operand,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT32 AndData
+ IN UINT32 Operand,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT32 AndData
)
{
ASSERT (EndBit < 32);
@@ -678,11 +678,11 @@ BitFieldAnd32 (
UINT32
EFIAPI
BitFieldAndThenOr32 (
- IN UINT32 Operand,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT32 AndData,
- IN UINT32 OrData
+ IN UINT32 Operand,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT32 AndData,
+ IN UINT32 OrData
)
{
ASSERT (EndBit < 32);
@@ -717,9 +717,9 @@ BitFieldAndThenOr32 (
UINT64
EFIAPI
BitFieldRead64 (
- IN UINT64 Operand,
- IN UINTN StartBit,
- IN UINTN EndBit
+ IN UINT64 Operand,
+ IN UINTN StartBit,
+ IN UINTN EndBit
)
{
ASSERT (EndBit < 64);
@@ -753,10 +753,10 @@ BitFieldRead64 (
UINT64
EFIAPI
BitFieldWrite64 (
- IN UINT64 Operand,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT64 Value
+ IN UINT64 Operand,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT64 Value
)
{
ASSERT (EndBit < 64);
@@ -791,10 +791,10 @@ BitFieldWrite64 (
UINT64
EFIAPI
BitFieldOr64 (
- IN UINT64 Operand,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT64 OrData
+ IN UINT64 Operand,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT64 OrData
)
{
UINT64 Value1;
@@ -811,7 +811,7 @@ BitFieldOr64 (
ASSERT (RShiftU64 (OrData, EndBit - StartBit) == (RShiftU64 (OrData, EndBit - StartBit) & 1));
Value1 = LShiftU64 (OrData, StartBit);
- Value2 = LShiftU64 ((UINT64) - 2, EndBit);
+ Value2 = LShiftU64 ((UINT64)-2, EndBit);
return Operand | (Value1 & ~Value2);
}
@@ -843,10 +843,10 @@ BitFieldOr64 (
UINT64
EFIAPI
BitFieldAnd64 (
- IN UINT64 Operand,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT64 AndData
+ IN UINT64 Operand,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT64 AndData
)
{
UINT64 Value1;
@@ -898,11 +898,11 @@ BitFieldAnd64 (
UINT64
EFIAPI
BitFieldAndThenOr64 (
- IN UINT64 Operand,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT64 AndData,
- IN UINT64 OrData
+ IN UINT64 Operand,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT64 AndData,
+ IN UINT64 OrData
)
{
ASSERT (EndBit < 64);
@@ -938,25 +938,25 @@ BitFieldAndThenOr64 (
UINT8
EFIAPI
BitFieldCountOnes32 (
- IN UINT32 Operand,
- IN UINTN StartBit,
- IN UINTN EndBit
+ IN UINT32 Operand,
+ IN UINTN StartBit,
+ IN UINTN EndBit
)
{
- UINT32 Count;
+ UINT32 Count;
ASSERT (EndBit < 32);
ASSERT (StartBit <= EndBit);
- Count = BitFieldRead32 (Operand, StartBit, EndBit);
+ Count = BitFieldRead32 (Operand, StartBit, EndBit);
Count -= ((Count >> 1) & 0x55555555);
- Count = (Count & 0x33333333) + ((Count >> 2) & 0x33333333);
+ Count = (Count & 0x33333333) + ((Count >> 2) & 0x33333333);
Count += Count >> 4;
Count &= 0x0F0F0F0F;
Count += Count >> 8;
Count += Count >> 16;
- return (UINT8) Count & 0x3F;
+ return (UINT8)Count & 0x3F;
}
/**
@@ -982,21 +982,20 @@ BitFieldCountOnes32 (
UINT8
EFIAPI
BitFieldCountOnes64 (
- IN UINT64 Operand,
- IN UINTN StartBit,
- IN UINTN EndBit
+ IN UINT64 Operand,
+ IN UINTN StartBit,
+ IN UINTN EndBit
)
{
- UINT64 BitField;
- UINT8 Count;
+ UINT64 BitField;
+ UINT8 Count;
ASSERT (EndBit < 64);
ASSERT (StartBit <= EndBit);
BitField = BitFieldRead64 (Operand, StartBit, EndBit);
- Count = BitFieldCountOnes32 ((UINT32) BitField, 0, 31);
- Count += BitFieldCountOnes32 ((UINT32) RShiftU64(BitField, 32), 0, 31);
+ Count = BitFieldCountOnes32 ((UINT32)BitField, 0, 31);
+ Count += BitFieldCountOnes32 ((UINT32)RShiftU64 (BitField, 32), 0, 31);
return Count;
}
-
diff --git a/MdePkg/Library/BaseLib/CheckSum.c b/MdePkg/Library/BaseLib/CheckSum.c
index d91a7a07c7..28dee5ac6a 100644
--- a/MdePkg/Library/BaseLib/CheckSum.c
+++ b/MdePkg/Library/BaseLib/CheckSum.c
@@ -30,24 +30,23 @@
UINT8
EFIAPI
CalculateSum8 (
- IN CONST UINT8 *Buffer,
- IN UINTN Length
+ IN CONST UINT8 *Buffer,
+ IN UINTN Length
)
{
- UINT8 Sum;
- UINTN Count;
+ UINT8 Sum;
+ UINTN Count;
ASSERT (Buffer != NULL);
- ASSERT (Length <= (MAX_ADDRESS - ((UINTN) Buffer) + 1));
+ ASSERT (Length <= (MAX_ADDRESS - ((UINTN)Buffer) + 1));
for (Sum = 0, Count = 0; Count < Length; Count++) {
- Sum = (UINT8) (Sum + *(Buffer + Count));
+ Sum = (UINT8)(Sum + *(Buffer + Count));
}
return Sum;
}
-
/**
Returns the two's complement checksum of all elements in a buffer
of 8-bit values.
@@ -69,18 +68,18 @@ CalculateSum8 (
UINT8
EFIAPI
CalculateCheckSum8 (
- IN CONST UINT8 *Buffer,
- IN UINTN Length
+ IN CONST UINT8 *Buffer,
+ IN UINTN Length
)
{
- UINT8 CheckSum;
+ UINT8 CheckSum;
CheckSum = CalculateSum8 (Buffer, Length);
//
// Return the checksum based on 2's complement.
//
- return (UINT8) (0x100 - CheckSum);
+ return (UINT8)(0x100 - CheckSum);
}
/**
@@ -105,28 +104,27 @@ CalculateCheckSum8 (
UINT16
EFIAPI
CalculateSum16 (
- IN CONST UINT16 *Buffer,
- IN UINTN Length
+ IN CONST UINT16 *Buffer,
+ IN UINTN Length
)
{
- UINT16 Sum;
- UINTN Count;
- UINTN Total;
+ UINT16 Sum;
+ UINTN Count;
+ UINTN Total;
ASSERT (Buffer != NULL);
- ASSERT (((UINTN) Buffer & 0x1) == 0);
+ ASSERT (((UINTN)Buffer & 0x1) == 0);
ASSERT ((Length & 0x1) == 0);
- ASSERT (Length <= (MAX_ADDRESS - ((UINTN) Buffer) + 1));
+ ASSERT (Length <= (MAX_ADDRESS - ((UINTN)Buffer) + 1));
Total = Length / sizeof (*Buffer);
for (Sum = 0, Count = 0; Count < Total; Count++) {
- Sum = (UINT16) (Sum + *(Buffer + Count));
+ Sum = (UINT16)(Sum + *(Buffer + Count));
}
return Sum;
}
-
/**
Returns the two's complement checksum of all elements in a buffer of
16-bit values.
@@ -150,21 +148,20 @@ CalculateSum16 (
UINT16
EFIAPI
CalculateCheckSum16 (
- IN CONST UINT16 *Buffer,
- IN UINTN Length
+ IN CONST UINT16 *Buffer,
+ IN UINTN Length
)
{
- UINT16 CheckSum;
+ UINT16 CheckSum;
CheckSum = CalculateSum16 (Buffer, Length);
//
// Return the checksum based on 2's complement.
//
- return (UINT16) (0x10000 - CheckSum);
+ return (UINT16)(0x10000 - CheckSum);
}
-
/**
Returns the sum of all elements in a buffer of 32-bit values. During
calculation, the carry bits are dropped.
@@ -187,18 +184,18 @@ CalculateCheckSum16 (
UINT32
EFIAPI
CalculateSum32 (
- IN CONST UINT32 *Buffer,
- IN UINTN Length
+ IN CONST UINT32 *Buffer,
+ IN UINTN Length
)
{
- UINT32 Sum;
- UINTN Count;
- UINTN Total;
+ UINT32 Sum;
+ UINTN Count;
+ UINTN Total;
ASSERT (Buffer != NULL);
- ASSERT (((UINTN) Buffer & 0x3) == 0);
+ ASSERT (((UINTN)Buffer & 0x3) == 0);
ASSERT ((Length & 0x3) == 0);
- ASSERT (Length <= (MAX_ADDRESS - ((UINTN) Buffer) + 1));
+ ASSERT (Length <= (MAX_ADDRESS - ((UINTN)Buffer) + 1));
Total = Length / sizeof (*Buffer);
for (Sum = 0, Count = 0; Count < Total; Count++) {
@@ -208,7 +205,6 @@ CalculateSum32 (
return Sum;
}
-
/**
Returns the two's complement checksum of all elements in a buffer of
32-bit values.
@@ -232,21 +228,20 @@ CalculateSum32 (
UINT32
EFIAPI
CalculateCheckSum32 (
- IN CONST UINT32 *Buffer,
- IN UINTN Length
+ IN CONST UINT32 *Buffer,
+ IN UINTN Length
)
{
- UINT32 CheckSum;
+ UINT32 CheckSum;
CheckSum = CalculateSum32 (Buffer, Length);
//
// Return the checksum based on 2's complement.
//
- return (UINT32) ((UINT32)(-1) - CheckSum + 1);
+ return (UINT32)((UINT32)(-1) - CheckSum + 1);
}
-
/**
Returns the sum of all elements in a buffer of 64-bit values. During
calculation, the carry bits are dropped.
@@ -269,18 +264,18 @@ CalculateCheckSum32 (
UINT64
EFIAPI
CalculateSum64 (
- IN CONST UINT64 *Buffer,
- IN UINTN Length
+ IN CONST UINT64 *Buffer,
+ IN UINTN Length
)
{
- UINT64 Sum;
- UINTN Count;
- UINTN Total;
+ UINT64 Sum;
+ UINTN Count;
+ UINTN Total;
ASSERT (Buffer != NULL);
- ASSERT (((UINTN) Buffer & 0x7) == 0);
+ ASSERT (((UINTN)Buffer & 0x7) == 0);
ASSERT ((Length & 0x7) == 0);
- ASSERT (Length <= (MAX_ADDRESS - ((UINTN) Buffer) + 1));
+ ASSERT (Length <= (MAX_ADDRESS - ((UINTN)Buffer) + 1));
Total = Length / sizeof (*Buffer);
for (Sum = 0, Count = 0; Count < Total; Count++) {
@@ -290,7 +285,6 @@ CalculateSum64 (
return Sum;
}
-
/**
Returns the two's complement checksum of all elements in a buffer of
64-bit values.
@@ -314,18 +308,18 @@ CalculateSum64 (
UINT64
EFIAPI
CalculateCheckSum64 (
- IN CONST UINT64 *Buffer,
- IN UINTN Length
+ IN CONST UINT64 *Buffer,
+ IN UINTN Length
)
{
- UINT64 CheckSum;
+ UINT64 CheckSum;
CheckSum = CalculateSum64 (Buffer, Length);
//
// Return the checksum based on 2's complement.
//
- return (UINT64) ((UINT64)(-1) - CheckSum + 1);
+ return (UINT64)((UINT64)(-1) - CheckSum + 1);
}
GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT32 mCrcTable[256] = {
@@ -602,9 +596,9 @@ GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT32 mCrcTable[256] = {
**/
UINT32
EFIAPI
-CalculateCrc32(
- IN VOID *Buffer,
- IN UINTN Length
+CalculateCrc32 (
+ IN VOID *Buffer,
+ IN UINTN Length
)
{
UINTN Index;
@@ -612,14 +606,14 @@ CalculateCrc32(
UINT8 *Ptr;
ASSERT (Buffer != NULL);
- ASSERT (Length <= (MAX_ADDRESS - ((UINTN) Buffer) + 1));
+ ASSERT (Length <= (MAX_ADDRESS - ((UINTN)Buffer) + 1));
//
// Compute CRC
//
Crc = 0xffffffff;
for (Index = 0, Ptr = Buffer; Index < Length; Index++, Ptr++) {
- Crc = (Crc >> 8) ^ mCrcTable[(UINT8) Crc ^ *Ptr];
+ Crc = (Crc >> 8) ^ mCrcTable[(UINT8)Crc ^ *Ptr];
}
return Crc ^ 0xffffffff;
diff --git a/MdePkg/Library/BaseLib/ChkStkGcc.c b/MdePkg/Library/BaseLib/ChkStkGcc.c
index 7f07ba2d6f..9c74e36273 100644
--- a/MdePkg/Library/BaseLib/ChkStkGcc.c
+++ b/MdePkg/Library/BaseLib/ChkStkGcc.c
@@ -12,7 +12,7 @@
Hack function for passing GCC build.
**/
VOID
-__chkstk()
+__chkstk (
+ )
{
}
-
diff --git a/MdePkg/Library/BaseLib/Cpu.c b/MdePkg/Library/BaseLib/Cpu.c
index 689246f162..e3daf38f83 100644
--- a/MdePkg/Library/BaseLib/Cpu.c
+++ b/MdePkg/Library/BaseLib/Cpu.c
@@ -8,7 +8,6 @@
#include "BaseLibInternals.h"
-
/**
Disables CPU interrupts and returns the interrupt state prior to the disable
operation.
@@ -23,7 +22,7 @@ SaveAndDisableInterrupts (
VOID
)
{
- BOOLEAN InterruptState;
+ BOOLEAN InterruptState;
InterruptState = GetInterruptState ();
DisableInterrupts ();
@@ -47,7 +46,7 @@ SaveAndDisableInterrupts (
BOOLEAN
EFIAPI
SetInterruptState (
- IN BOOLEAN InterruptState
+ IN BOOLEAN InterruptState
)
{
if (InterruptState) {
@@ -55,5 +54,6 @@ SetInterruptState (
} else {
DisableInterrupts ();
}
+
return InterruptState;
}
diff --git a/MdePkg/Library/BaseLib/CpuDeadLoop.c b/MdePkg/Library/BaseLib/CpuDeadLoop.c
index 3cd304351a..b3b7548fa5 100644
--- a/MdePkg/Library/BaseLib/CpuDeadLoop.c
+++ b/MdePkg/Library/BaseLib/CpuDeadLoop.c
@@ -6,8 +6,6 @@
**/
-
-
#include <Base.h>
#include <Library/BaseLib.h>
@@ -29,6 +27,6 @@ CpuDeadLoop (
volatile UINTN Index;
for (Index = 0; Index == 0;) {
- CpuPause();
+ CpuPause ();
}
}
diff --git a/MdePkg/Library/BaseLib/DivS64x64Remainder.c b/MdePkg/Library/BaseLib/DivS64x64Remainder.c
index bdf25b8366..9d6ec958aa 100644
--- a/MdePkg/Library/BaseLib/DivS64x64Remainder.c
+++ b/MdePkg/Library/BaseLib/DivS64x64Remainder.c
@@ -6,9 +6,6 @@
**/
-
-
-
#include "BaseLibInternals.h"
/**
@@ -37,9 +34,9 @@
INT64
EFIAPI
DivS64x64Remainder (
- IN INT64 Dividend,
- IN INT64 Divisor,
- OUT INT64 *Remainder OPTIONAL
+ IN INT64 Dividend,
+ IN INT64 Divisor,
+ OUT INT64 *Remainder OPTIONAL
)
{
ASSERT (Divisor != 0);
diff --git a/MdePkg/Library/BaseLib/DivU64x32.c b/MdePkg/Library/BaseLib/DivU64x32.c
index fa377ec551..e505a50758 100644
--- a/MdePkg/Library/BaseLib/DivU64x32.c
+++ b/MdePkg/Library/BaseLib/DivU64x32.c
@@ -6,9 +6,6 @@
**/
-
-
-
#include "BaseLibInternals.h"
/**
@@ -30,8 +27,8 @@
UINT64
EFIAPI
DivU64x32 (
- IN UINT64 Dividend,
- IN UINT32 Divisor
+ IN UINT64 Dividend,
+ IN UINT32 Divisor
)
{
ASSERT (Divisor != 0);
diff --git a/MdePkg/Library/BaseLib/DivU64x32Remainder.c b/MdePkg/Library/BaseLib/DivU64x32Remainder.c
index df9d3310e8..6f86ed717f 100644
--- a/MdePkg/Library/BaseLib/DivU64x32Remainder.c
+++ b/MdePkg/Library/BaseLib/DivU64x32Remainder.c
@@ -6,9 +6,6 @@
**/
-
-
-
#include "BaseLibInternals.h"
/**
@@ -33,9 +30,9 @@
UINT64
EFIAPI
DivU64x32Remainder (
- IN UINT64 Dividend,
- IN UINT32 Divisor,
- OUT UINT32 *Remainder OPTIONAL
+ IN UINT64 Dividend,
+ IN UINT32 Divisor,
+ OUT UINT32 *Remainder OPTIONAL
)
{
ASSERT (Divisor != 0);
diff --git a/MdePkg/Library/BaseLib/DivU64x64Remainder.c b/MdePkg/Library/BaseLib/DivU64x64Remainder.c
index 94dc2b1a6a..e068e97f37 100644
--- a/MdePkg/Library/BaseLib/DivU64x64Remainder.c
+++ b/MdePkg/Library/BaseLib/DivU64x64Remainder.c
@@ -6,9 +6,6 @@
**/
-
-
-
#include "BaseLibInternals.h"
/**
@@ -33,9 +30,9 @@
UINT64
EFIAPI
DivU64x64Remainder (
- IN UINT64 Dividend,
- IN UINT64 Divisor,
- OUT UINT64 *Remainder OPTIONAL
+ IN UINT64 Dividend,
+ IN UINT64 Divisor,
+ OUT UINT64 *Remainder OPTIONAL
)
{
ASSERT (Divisor != 0);
diff --git a/MdePkg/Library/BaseLib/Ebc/CpuBreakpoint.c b/MdePkg/Library/BaseLib/Ebc/CpuBreakpoint.c
index d0debec30f..ec7df5ea47 100644
--- a/MdePkg/Library/BaseLib/Ebc/CpuBreakpoint.c
+++ b/MdePkg/Library/BaseLib/Ebc/CpuBreakpoint.c
@@ -11,7 +11,7 @@
extern
UINT64
_break (
- CHAR8 BreakCode
+ CHAR8 BreakCode
);
/**
@@ -120,4 +120,3 @@ CpuPause (
)
{
}
-
diff --git a/MdePkg/Library/BaseLib/Ebc/SpeculationBarrier.c b/MdePkg/Library/BaseLib/Ebc/SpeculationBarrier.c
index d4067a4a0b..e3e7579b51 100644
--- a/MdePkg/Library/BaseLib/Ebc/SpeculationBarrier.c
+++ b/MdePkg/Library/BaseLib/Ebc/SpeculationBarrier.c
@@ -7,7 +7,6 @@
**/
-
/**
Uses as a barrier to stop speculative execution.
diff --git a/MdePkg/Library/BaseLib/FilePaths.c b/MdePkg/Library/BaseLib/FilePaths.c
index c2c561ac64..43808075e8 100644
--- a/MdePkg/Library/BaseLib/FilePaths.c
+++ b/MdePkg/Library/BaseLib/FilePaths.c
@@ -19,29 +19,33 @@
**/
BOOLEAN
EFIAPI
-PathRemoveLastItem(
- IN OUT CHAR16 *Path
+PathRemoveLastItem (
+ IN OUT CHAR16 *Path
)
{
- CHAR16 *Walker;
- CHAR16 *LastSlash;
+ CHAR16 *Walker;
+ CHAR16 *LastSlash;
+
//
// get directory name from path... ('chop' off extra)
//
for ( Walker = Path, LastSlash = NULL
- ; Walker != NULL && *Walker != CHAR_NULL
- ; Walker++
- ){
- if (*Walker == L'\\' && *(Walker + 1) != CHAR_NULL) {
+ ; Walker != NULL && *Walker != CHAR_NULL
+ ; Walker++
+ )
+ {
+ if ((*Walker == L'\\') && (*(Walker + 1) != CHAR_NULL)) {
LastSlash = Walker+1;
- } else if (*Walker == L':' && *(Walker + 1) != L'\\' && *(Walker + 1) != CHAR_NULL) {
+ } else if ((*Walker == L':') && (*(Walker + 1) != L'\\') && (*(Walker + 1) != CHAR_NULL)) {
LastSlash = Walker+1;
}
}
+
if (LastSlash != NULL) {
*LastSlash = CHAR_NULL;
return (TRUE);
}
+
return (FALSE);
}
@@ -59,11 +63,11 @@ PathRemoveLastItem(
@return Returns Path, otherwise returns NULL to indicate that an error has occurred.
**/
-CHAR16*
+CHAR16 *
EFIAPI
-PathCleanUpDirectories(
- IN CHAR16 *Path
-)
+PathCleanUpDirectories (
+ IN CHAR16 *Path
+ )
{
CHAR16 *TempString;
@@ -93,6 +97,7 @@ PathCleanUpDirectories(
while ((TempString = StrStr (Path, L"\\.\\")) != NULL) {
CopyMem (TempString, TempString + 2, StrSize (TempString + 2));
}
+
if ((StrLen (Path) >= 2) && (StrCmp (Path + StrLen (Path) - 2, L"\\.") == 0)) {
Path[StrLen (Path) - 1] = CHAR_NULL;
}
@@ -100,11 +105,12 @@ PathCleanUpDirectories(
//
// Remove all the "\..". E.g.: fs0:\abc\..\def\..
//
- while (((TempString = StrStr(Path, L"\\..")) != NULL) &&
+ while (((TempString = StrStr (Path, L"\\..")) != NULL) &&
((*(TempString + 3) == L'\\') || (*(TempString + 3) == CHAR_NULL))
- ) {
+ )
+ {
*(TempString + 1) = CHAR_NULL;
- PathRemoveLastItem(Path);
+ PathRemoveLastItem (Path);
if (*(TempString + 3) != CHAR_NULL) {
CopyMem (Path + StrLen (Path), TempString + 4, StrSize (TempString + 4));
}
@@ -112,4 +118,3 @@ PathCleanUpDirectories(
return Path;
}
-
diff --git a/MdePkg/Library/BaseLib/GetPowerOfTwo32.c b/MdePkg/Library/BaseLib/GetPowerOfTwo32.c
index 76f5e3cfbd..8a86d39f3f 100644
--- a/MdePkg/Library/BaseLib/GetPowerOfTwo32.c
+++ b/MdePkg/Library/BaseLib/GetPowerOfTwo32.c
@@ -6,9 +6,6 @@
**/
-
-
-
#include "BaseLibInternals.h"
/**
@@ -27,7 +24,7 @@
UINT32
EFIAPI
GetPowerOfTwo32 (
- IN UINT32 Operand
+ IN UINT32 Operand
)
{
if (0 == Operand) {
diff --git a/MdePkg/Library/BaseLib/GetPowerOfTwo64.c b/MdePkg/Library/BaseLib/GetPowerOfTwo64.c
index 5033076f84..09a2c8a959 100644
--- a/MdePkg/Library/BaseLib/GetPowerOfTwo64.c
+++ b/MdePkg/Library/BaseLib/GetPowerOfTwo64.c
@@ -6,9 +6,6 @@
**/
-
-
-
#include "BaseLibInternals.h"
/**
@@ -27,12 +24,12 @@
UINT64
EFIAPI
GetPowerOfTwo64 (
- IN UINT64 Operand
+ IN UINT64 Operand
)
{
if (Operand == 0) {
return 0;
}
- return LShiftU64 (1, (UINTN) HighBitSet64 (Operand));
+ return LShiftU64 (1, (UINTN)HighBitSet64 (Operand));
}
diff --git a/MdePkg/Library/BaseLib/HighBitSet32.c b/MdePkg/Library/BaseLib/HighBitSet32.c
index b3c9ed158b..520511b7fe 100644
--- a/MdePkg/Library/BaseLib/HighBitSet32.c
+++ b/MdePkg/Library/BaseLib/HighBitSet32.c
@@ -6,9 +6,6 @@
**/
-
-
-
#include "BaseLibInternals.h"
/**
@@ -28,14 +25,17 @@
INTN
EFIAPI
HighBitSet32 (
- IN UINT32 Operand
+ IN UINT32 Operand
)
{
- INTN BitIndex;
+ INTN BitIndex;
if (Operand == 0) {
- return - 1;
+ return -1;
}
- for (BitIndex = 31; (INT32)Operand > 0; BitIndex--, Operand <<= 1);
+
+ for (BitIndex = 31; (INT32)Operand > 0; BitIndex--, Operand <<= 1) {
+ }
+
return BitIndex;
}
diff --git a/MdePkg/Library/BaseLib/HighBitSet64.c b/MdePkg/Library/BaseLib/HighBitSet64.c
index 4f06dfc883..ca64d88804 100644
--- a/MdePkg/Library/BaseLib/HighBitSet64.c
+++ b/MdePkg/Library/BaseLib/HighBitSet64.c
@@ -6,9 +6,6 @@
**/
-
-
-
#include "BaseLibInternals.h"
/**
@@ -28,7 +25,7 @@
INTN
EFIAPI
HighBitSet64 (
- IN UINT64 Operand
+ IN UINT64 Operand
)
{
if (Operand == (UINT32)Operand) {
@@ -42,7 +39,7 @@ HighBitSet64 (
// Operand is really a 64-bit integer
//
if (sizeof (UINTN) == sizeof (UINT32)) {
- return HighBitSet32 (((UINT32*)&Operand)[1]) + 32;
+ return HighBitSet32 (((UINT32 *)&Operand)[1]) + 32;
} else {
return HighBitSet32 ((UINT32)RShiftU64 (Operand, 32)) + 32;
}
diff --git a/MdePkg/Library/BaseLib/Ia32/ARShiftU64.c b/MdePkg/Library/BaseLib/Ia32/ARShiftU64.c
index 836108364d..251fa0e5b6 100644
--- a/MdePkg/Library/BaseLib/Ia32/ARShiftU64.c
+++ b/MdePkg/Library/BaseLib/Ia32/ARShiftU64.c
@@ -6,9 +6,6 @@
**/
-
-
-
/**
Shifts a 64-bit integer right between 0 and 63 bits. The high bits
are filled with original integer's bit 63. The shifted value is returned.
@@ -25,8 +22,8 @@
UINT64
EFIAPI
InternalMathARShiftU64 (
- IN UINT64 Operand,
- IN UINTN Count
+ IN UINT64 Operand,
+ IN UINTN Count
)
{
_asm {
@@ -42,4 +39,3 @@ L0:
sar edx, cl
}
}
-
diff --git a/MdePkg/Library/BaseLib/Ia32/CpuBreakpoint.c b/MdePkg/Library/BaseLib/Ia32/CpuBreakpoint.c
index a59da0ceef..8c03934ef5 100644
--- a/MdePkg/Library/BaseLib/Ia32/CpuBreakpoint.c
+++ b/MdePkg/Library/BaseLib/Ia32/CpuBreakpoint.c
@@ -6,14 +6,14 @@
**/
-
-
-
/**
Microsoft Visual Studio 7.1 Function Prototypes for I/O Intrinsics.
**/
-void __debugbreak (VOID);
+void
+__debugbreak (
+ VOID
+ );
#pragma intrinsic(__debugbreak)
@@ -32,4 +32,3 @@ CpuBreakpoint (
{
__debugbreak ();
}
-
diff --git a/MdePkg/Library/BaseLib/Ia32/CpuId.c b/MdePkg/Library/BaseLib/Ia32/CpuId.c
index c38b278dce..e1a7e8effb 100644
--- a/MdePkg/Library/BaseLib/Ia32/CpuId.c
+++ b/MdePkg/Library/BaseLib/Ia32/CpuId.c
@@ -34,11 +34,11 @@
UINT32
EFIAPI
AsmCpuid (
- IN UINT32 Index,
- OUT UINT32 *RegisterEax OPTIONAL,
- OUT UINT32 *RegisterEbx OPTIONAL,
- OUT UINT32 *RegisterEcx OPTIONAL,
- OUT UINT32 *RegisterEdx OPTIONAL
+ IN UINT32 Index,
+ OUT UINT32 *RegisterEax OPTIONAL,
+ OUT UINT32 *RegisterEbx OPTIONAL,
+ OUT UINT32 *RegisterEcx OPTIONAL,
+ OUT UINT32 *RegisterEdx OPTIONAL
)
{
_asm {
diff --git a/MdePkg/Library/BaseLib/Ia32/CpuIdEx.c b/MdePkg/Library/BaseLib/Ia32/CpuIdEx.c
index 7cd42eedbb..6eeb778231 100644
--- a/MdePkg/Library/BaseLib/Ia32/CpuIdEx.c
+++ b/MdePkg/Library/BaseLib/Ia32/CpuIdEx.c
@@ -41,12 +41,12 @@
UINT32
EFIAPI
AsmCpuidEx (
- IN UINT32 Index,
- IN UINT32 SubIndex,
- OUT UINT32 *RegisterEax OPTIONAL,
- OUT UINT32 *RegisterEbx OPTIONAL,
- OUT UINT32 *RegisterEcx OPTIONAL,
- OUT UINT32 *RegisterEdx OPTIONAL
+ IN UINT32 Index,
+ IN UINT32 SubIndex,
+ OUT UINT32 *RegisterEax OPTIONAL,
+ OUT UINT32 *RegisterEbx OPTIONAL,
+ OUT UINT32 *RegisterEcx OPTIONAL,
+ OUT UINT32 *RegisterEdx OPTIONAL
)
{
_asm {
diff --git a/MdePkg/Library/BaseLib/Ia32/CpuPause.c b/MdePkg/Library/BaseLib/Ia32/CpuPause.c
index 12dc896fe3..356b8ef994 100644
--- a/MdePkg/Library/BaseLib/Ia32/CpuPause.c
+++ b/MdePkg/Library/BaseLib/Ia32/CpuPause.c
@@ -6,9 +6,6 @@
**/
-
-
-
/**
Requests CPU to pause for a short period of time.
@@ -26,4 +23,3 @@ CpuPause (
pause
}
}
-
diff --git a/MdePkg/Library/BaseLib/Ia32/DisableCache.c b/MdePkg/Library/BaseLib/Ia32/DisableCache.c
index 6a8be4ef20..d1aca0ed9a 100644
--- a/MdePkg/Library/BaseLib/Ia32/DisableCache.c
+++ b/MdePkg/Library/BaseLib/Ia32/DisableCache.c
@@ -27,4 +27,3 @@ AsmDisableCache (
wbinvd
}
}
-
diff --git a/MdePkg/Library/BaseLib/Ia32/DisableInterrupts.c b/MdePkg/Library/BaseLib/Ia32/DisableInterrupts.c
index 4141ef7511..d59d552223 100644
--- a/MdePkg/Library/BaseLib/Ia32/DisableInterrupts.c
+++ b/MdePkg/Library/BaseLib/Ia32/DisableInterrupts.c
@@ -6,9 +6,6 @@
**/
-
-
-
/**
Disables CPU interrupts.
@@ -23,4 +20,3 @@ DisableInterrupts (
cli
}
}
-
diff --git a/MdePkg/Library/BaseLib/Ia32/DisablePaging32.c b/MdePkg/Library/BaseLib/Ia32/DisablePaging32.c
index 9bebd6d3f3..0e263c4509 100644
--- a/MdePkg/Library/BaseLib/Ia32/DisablePaging32.c
+++ b/MdePkg/Library/BaseLib/Ia32/DisablePaging32.c
@@ -38,7 +38,7 @@
function after paging is disabled.
**/
-__declspec (naked)
+__declspec(naked)
VOID
EFIAPI
InternalX86DisablePaging32 (
diff --git a/MdePkg/Library/BaseLib/Ia32/DivS64x64Remainder.c b/MdePkg/Library/BaseLib/Ia32/DivS64x64Remainder.c
index 4e64964042..4604208403 100644
--- a/MdePkg/Library/BaseLib/Ia32/DivS64x64Remainder.c
+++ b/MdePkg/Library/BaseLib/Ia32/DivS64x64Remainder.c
@@ -28,20 +28,21 @@
INT64
EFIAPI
InternalMathDivRemS64x64 (
- IN INT64 Dividend,
- IN INT64 Divisor,
- OUT INT64 *Remainder OPTIONAL
+ IN INT64 Dividend,
+ IN INT64 Divisor,
+ OUT INT64 *Remainder OPTIONAL
)
{
- INT64 Quot;
+ INT64 Quot;
Quot = InternalMathDivRemU64x64 (
- (UINT64) (Dividend >= 0 ? Dividend : -Dividend),
- (UINT64) (Divisor >= 0 ? Divisor : -Divisor),
- (UINT64 *) Remainder
+ (UINT64)(Dividend >= 0 ? Dividend : -Dividend),
+ (UINT64)(Divisor >= 0 ? Divisor : -Divisor),
+ (UINT64 *)Remainder
);
- if (Remainder != NULL && Dividend < 0) {
+ if ((Remainder != NULL) && (Dividend < 0)) {
*Remainder = -*Remainder;
}
+
return (Dividend ^ Divisor) >= 0 ? Quot : -Quot;
}
diff --git a/MdePkg/Library/BaseLib/Ia32/DivU64x32.c b/MdePkg/Library/BaseLib/Ia32/DivU64x32.c
index 538f77a83f..c46abba638 100644
--- a/MdePkg/Library/BaseLib/Ia32/DivU64x32.c
+++ b/MdePkg/Library/BaseLib/Ia32/DivU64x32.c
@@ -6,9 +6,6 @@
**/
-
-
-
/**
Divides a 64-bit unsigned integer by a 32-bit unsigned integer and
generates a 64-bit unsigned result.
@@ -26,8 +23,8 @@
UINT64
EFIAPI
InternalMathDivU64x32 (
- IN UINT64 Dividend,
- IN UINT32 Divisor
+ IN UINT64 Dividend,
+ IN UINT32 Divisor
)
{
_asm {
@@ -41,4 +38,3 @@ InternalMathDivU64x32 (
pop edx ; restore high-order dword of the quotient
}
}
-
diff --git a/MdePkg/Library/BaseLib/Ia32/DivU64x32Remainder.c b/MdePkg/Library/BaseLib/Ia32/DivU64x32Remainder.c
index 035d4340db..a32d627834 100644
--- a/MdePkg/Library/BaseLib/Ia32/DivU64x32Remainder.c
+++ b/MdePkg/Library/BaseLib/Ia32/DivU64x32Remainder.c
@@ -26,9 +26,9 @@
UINT64
EFIAPI
InternalMathDivRemU64x32 (
- IN UINT64 Dividend,
- IN UINT32 Divisor,
- OUT UINT32 *Remainder
+ IN UINT64 Dividend,
+ IN UINT32 Divisor,
+ OUT UINT32 *Remainder
)
{
_asm {
@@ -46,4 +46,3 @@ RemainderNull:
pop edx
}
}
-
diff --git a/MdePkg/Library/BaseLib/Ia32/EnableCache.c b/MdePkg/Library/BaseLib/Ia32/EnableCache.c
index 4f5c6e9ab3..3b354af178 100644
--- a/MdePkg/Library/BaseLib/Ia32/EnableCache.c
+++ b/MdePkg/Library/BaseLib/Ia32/EnableCache.c
@@ -27,4 +27,3 @@ AsmEnableCache (
mov cr0, eax
}
}
-
diff --git a/MdePkg/Library/BaseLib/Ia32/EnableDisableInterrupts.c b/MdePkg/Library/BaseLib/Ia32/EnableDisableInterrupts.c
index 7ec62147f2..88b9171463 100644
--- a/MdePkg/Library/BaseLib/Ia32/EnableDisableInterrupts.c
+++ b/MdePkg/Library/BaseLib/Ia32/EnableDisableInterrupts.c
@@ -6,9 +6,6 @@
**/
-
-
-
/**
Enables CPU interrupts for the smallest window required to capture any
pending interrupts.
@@ -27,4 +24,3 @@ EnableDisableInterrupts (
cli
}
}
-
diff --git a/MdePkg/Library/BaseLib/Ia32/EnableInterrupts.c b/MdePkg/Library/BaseLib/Ia32/EnableInterrupts.c
index bc03144c42..570c39db5b 100644
--- a/MdePkg/Library/BaseLib/Ia32/EnableInterrupts.c
+++ b/MdePkg/Library/BaseLib/Ia32/EnableInterrupts.c
@@ -6,9 +6,6 @@
**/
-
-
-
/**
Enables CPU interrupts.
@@ -23,4 +20,3 @@ EnableInterrupts (
sti
}
}
-
diff --git a/MdePkg/Library/BaseLib/Ia32/EnablePaging32.c b/MdePkg/Library/BaseLib/Ia32/EnablePaging32.c
index 7280c12f60..3c3e347d19 100644
--- a/MdePkg/Library/BaseLib/Ia32/EnablePaging32.c
+++ b/MdePkg/Library/BaseLib/Ia32/EnablePaging32.c
@@ -41,7 +41,7 @@
function after paging is enabled.
**/
-__declspec (naked)
+__declspec(naked)
VOID
EFIAPI
InternalX86EnablePaging32 (
diff --git a/MdePkg/Library/BaseLib/Ia32/FlushCacheLine.c b/MdePkg/Library/BaseLib/Ia32/FlushCacheLine.c
index 8fbda06707..d6466880be 100644
--- a/MdePkg/Library/BaseLib/Ia32/FlushCacheLine.c
+++ b/MdePkg/Library/BaseLib/Ia32/FlushCacheLine.c
@@ -6,9 +6,6 @@
**/
-
-
-
/**
Flushes a cache line from all the instruction and data caches within the
coherency domain of the CPU.
@@ -27,7 +24,7 @@
VOID *
EFIAPI
AsmFlushCacheLine (
- IN VOID *LinearAddress
+ IN VOID *LinearAddress
)
{
//
@@ -49,4 +46,3 @@ Done:
return LinearAddress;
}
-
diff --git a/MdePkg/Library/BaseLib/Ia32/FxRestore.c b/MdePkg/Library/BaseLib/Ia32/FxRestore.c
index ddd1e49037..5ebb281d14 100644
--- a/MdePkg/Library/BaseLib/Ia32/FxRestore.c
+++ b/MdePkg/Library/BaseLib/Ia32/FxRestore.c
@@ -6,10 +6,8 @@
**/
-
#include "BaseLibInternals.h"
-
/**
Restores the current floating point/SSE/SSE2 context from a buffer.
@@ -23,7 +21,7 @@
VOID
EFIAPI
InternalX86FxRestore (
- IN CONST IA32_FX_BUFFER *Buffer
+ IN CONST IA32_FX_BUFFER *Buffer
)
{
_asm {
@@ -31,4 +29,3 @@ InternalX86FxRestore (
fxrstor [eax]
}
}
-
diff --git a/MdePkg/Library/BaseLib/Ia32/FxSave.c b/MdePkg/Library/BaseLib/Ia32/FxSave.c
index a8c8882171..fc489c5f76 100644
--- a/MdePkg/Library/BaseLib/Ia32/FxSave.c
+++ b/MdePkg/Library/BaseLib/Ia32/FxSave.c
@@ -6,10 +6,8 @@
**/
-
#include "BaseLibInternals.h"
-
/**
Save the current floating point/SSE/SSE2 context to a buffer.
@@ -23,7 +21,7 @@
VOID
EFIAPI
InternalX86FxSave (
- OUT IA32_FX_BUFFER *Buffer
+ OUT IA32_FX_BUFFER *Buffer
)
{
_asm {
@@ -31,4 +29,3 @@ InternalX86FxSave (
fxsave [eax]
}
}
-
diff --git a/MdePkg/Library/BaseLib/Ia32/GccInline.c b/MdePkg/Library/BaseLib/Ia32/GccInline.c
index 6ed938187a..dab20c8aa2 100644
--- a/MdePkg/Library/BaseLib/Ia32/GccInline.c
+++ b/MdePkg/Library/BaseLib/Ia32/GccInline.c
@@ -7,7 +7,6 @@
**/
-
#include "BaseLibInternals.h"
/**
@@ -77,13 +76,13 @@ AsmReadEflags (
VOID
)
{
- UINTN Eflags;
+ UINTN Eflags;
__asm__ __volatile__ (
"pushfl \n\t"
"popl %0 "
: "=r" (Eflags)
- );
+ );
return Eflags;
}
@@ -101,17 +100,16 @@ AsmReadEflags (
VOID
EFIAPI
InternalX86FxSave (
- OUT IA32_FX_BUFFER *Buffer
+ OUT IA32_FX_BUFFER *Buffer
)
{
__asm__ __volatile__ (
"fxsave %0"
:
: "m" (*Buffer) // %0
- );
+ );
}
-
/**
Restores the current floating point/SSE/SSE2 context from a buffer.
@@ -125,17 +123,16 @@ InternalX86FxSave (
VOID
EFIAPI
InternalX86FxRestore (
- IN CONST IA32_FX_BUFFER *Buffer
+ IN CONST IA32_FX_BUFFER *Buffer
)
{
__asm__ __volatile__ (
"fxrstor %0"
:
: "m" (*Buffer) // %0
- );
+ );
}
-
/**
Reads the current value of 64-bit MMX Register #0 (MM0).
@@ -160,12 +157,11 @@ AsmReadMm0 (
"pop %%eax \n\t"
"pop %%edx \n\t"
: "=A" (Data) // %0
- );
+ );
return Data;
}
-
/**
Reads the current value of 64-bit MMX Register #1 (MM1).
@@ -190,12 +186,11 @@ AsmReadMm1 (
"pop %%eax \n\t"
"pop %%edx \n\t"
: "=A" (Data) // %0
- );
+ );
return Data;
}
-
/**
Reads the current value of 64-bit MMX Register #2 (MM2).
@@ -220,12 +215,11 @@ AsmReadMm2 (
"pop %%eax \n\t"
"pop %%edx \n\t"
: "=A" (Data) // %0
- );
+ );
return Data;
}
-
/**
Reads the current value of 64-bit MMX Register #3 (MM3).
@@ -250,12 +244,11 @@ AsmReadMm3 (
"pop %%eax \n\t"
"pop %%edx \n\t"
: "=A" (Data) // %0
- );
+ );
return Data;
}
-
/**
Reads the current value of 64-bit MMX Register #4 (MM4).
@@ -280,12 +273,11 @@ AsmReadMm4 (
"pop %%eax \n\t"
"pop %%edx \n\t"
: "=A" (Data) // %0
- );
+ );
return Data;
}
-
/**
Reads the current value of 64-bit MMX Register #5 (MM5).
@@ -310,12 +302,11 @@ AsmReadMm5 (
"pop %%eax \n\t"
"pop %%edx \n\t"
: "=A" (Data) // %0
- );
+ );
return Data;
}
-
/**
Reads the current value of 64-bit MMX Register #6 (MM6).
@@ -340,12 +331,11 @@ AsmReadMm6 (
"pop %%eax \n\t"
"pop %%edx \n\t"
: "=A" (Data) // %0
- );
+ );
return Data;
}
-
/**
Reads the current value of 64-bit MMX Register #7 (MM7).
@@ -370,12 +360,11 @@ AsmReadMm7 (
"pop %%eax \n\t"
"pop %%edx \n\t"
: "=A" (Data) // %0
- );
+ );
return Data;
}
-
/**
Writes the current value of 64-bit MMX Register #0 (MM0).
@@ -388,17 +377,16 @@ AsmReadMm7 (
VOID
EFIAPI
AsmWriteMm0 (
- IN UINT64 Value
+ IN UINT64 Value
)
{
__asm__ __volatile__ (
"movq %0, %%mm0" // %0
:
: "m" (Value)
- );
+ );
}
-
/**
Writes the current value of 64-bit MMX Register #1 (MM1).
@@ -411,17 +399,16 @@ AsmWriteMm0 (
VOID
EFIAPI
AsmWriteMm1 (
- IN UINT64 Value
+ IN UINT64 Value
)
{
__asm__ __volatile__ (
"movq %0, %%mm1" // %0
:
: "m" (Value)
- );
+ );
}
-
/**
Writes the current value of 64-bit MMX Register #2 (MM2).
@@ -434,17 +421,16 @@ AsmWriteMm1 (
VOID
EFIAPI
AsmWriteMm2 (
- IN UINT64 Value
+ IN UINT64 Value
)
{
__asm__ __volatile__ (
"movq %0, %%mm2" // %0
:
: "m" (Value)
- );
+ );
}
-
/**
Writes the current value of 64-bit MMX Register #3 (MM3).
@@ -457,17 +443,16 @@ AsmWriteMm2 (
VOID
EFIAPI
AsmWriteMm3 (
- IN UINT64 Value
+ IN UINT64 Value
)
{
__asm__ __volatile__ (
"movq %0, %%mm3" // %0
:
: "m" (Value)
- );
+ );
}
-
/**
Writes the current value of 64-bit MMX Register #4 (MM4).
@@ -480,17 +465,16 @@ AsmWriteMm3 (
VOID
EFIAPI
AsmWriteMm4 (
- IN UINT64 Value
+ IN UINT64 Value
)
{
__asm__ __volatile__ (
"movq %0, %%mm4" // %0
:
: "m" (Value)
- );
+ );
}
-
/**
Writes the current value of 64-bit MMX Register #5 (MM5).
@@ -503,17 +487,16 @@ AsmWriteMm4 (
VOID
EFIAPI
AsmWriteMm5 (
- IN UINT64 Value
+ IN UINT64 Value
)
{
__asm__ __volatile__ (
"movq %0, %%mm5" // %0
:
: "m" (Value)
- );
+ );
}
-
/**
Writes the current value of 64-bit MMX Register #6 (MM6).
@@ -526,17 +509,16 @@ AsmWriteMm5 (
VOID
EFIAPI
AsmWriteMm6 (
- IN UINT64 Value
+ IN UINT64 Value
)
{
__asm__ __volatile__ (
"movq %0, %%mm6" // %0
:
: "m" (Value)
- );
+ );
}
-
/**
Writes the current value of 64-bit MMX Register #7 (MM7).
@@ -549,17 +531,16 @@ AsmWriteMm6 (
VOID
EFIAPI
AsmWriteMm7 (
- IN UINT64 Value
+ IN UINT64 Value
)
{
__asm__ __volatile__ (
"movq %0, %%mm7" // %0
:
: "m" (Value)
- );
+ );
}
-
/**
Reads the current value of Time Stamp Counter (TSC).
@@ -580,7 +561,7 @@ AsmReadTsc (
__asm__ __volatile__ (
"rdtsc"
: "=A" (Data)
- );
+ );
return Data;
}
diff --git a/MdePkg/Library/BaseLib/Ia32/GccInlinePriv.c b/MdePkg/Library/BaseLib/Ia32/GccInlinePriv.c
index b8b5b85e73..df22a217ec 100644
--- a/MdePkg/Library/BaseLib/Ia32/GccInlinePriv.c
+++ b/MdePkg/Library/BaseLib/Ia32/GccInlinePriv.c
@@ -8,7 +8,6 @@
**/
-
#include "BaseLibInternals.h"
#include <Library/RegisterFilterLib.h>
@@ -27,7 +26,6 @@ EnableInterrupts (
__asm__ __volatile__ ("sti"::: "memory");
}
-
/**
Disables CPU interrupts.
@@ -60,11 +58,11 @@ DisableInterrupts (
UINT64
EFIAPI
AsmReadMsr64 (
- IN UINT32 Index
+ IN UINT32 Index
)
{
- UINT64 Data;
- BOOLEAN Flag;
+ UINT64 Data;
+ BOOLEAN Flag;
Flag = FilterBeforeMsrRead (Index, &Data);
if (Flag) {
@@ -72,8 +70,9 @@ AsmReadMsr64 (
"rdmsr"
: "=A" (Data) // %0
: "c" (Index) // %1
- );
+ );
}
+
FilterAfterMsrRead (Index, &Data);
return Data;
@@ -99,8 +98,8 @@ AsmReadMsr64 (
UINT64
EFIAPI
AsmWriteMsr64 (
- IN UINT32 Index,
- IN UINT64 Value
+ IN UINT32 Index,
+ IN UINT64 Value
)
{
BOOLEAN Flag;
@@ -112,8 +111,9 @@ AsmWriteMsr64 (
:
: "c" (Index),
"A" (Value)
- );
+ );
}
+
FilterAfterMsrWrite (Index, &Value);
return Value;
@@ -135,17 +135,16 @@ AsmReadCr0 (
VOID
)
{
- UINTN Data;
+ UINTN Data;
__asm__ __volatile__ (
"movl %%cr0,%0"
: "=a" (Data)
- );
+ );
return Data;
}
-
/**
Reads the current value of the Control Register 2 (CR2).
@@ -162,12 +161,12 @@ AsmReadCr2 (
VOID
)
{
- UINTN Data;
+ UINTN Data;
__asm__ __volatile__ (
"movl %%cr2, %0"
: "=r" (Data)
- );
+ );
return Data;
}
@@ -188,17 +187,16 @@ AsmReadCr3 (
VOID
)
{
- UINTN Data;
+ UINTN Data;
__asm__ __volatile__ (
"movl %%cr3, %0"
: "=r" (Data)
- );
+ );
return Data;
}
-
/**
Reads the current value of the Control Register 4 (CR4).
@@ -215,17 +213,16 @@ AsmReadCr4 (
VOID
)
{
- UINTN Data;
+ UINTN Data;
__asm__ __volatile__ (
"movl %%cr4, %0"
: "=a" (Data)
- );
+ );
return Data;
}
-
/**
Writes a value to Control Register 0 (CR0).
@@ -247,11 +244,10 @@ AsmWriteCr0 (
"movl %0, %%cr0"
:
: "r" (Cr0)
- );
+ );
return Cr0;
}
-
/**
Writes a value to Control Register 2 (CR2).
@@ -273,11 +269,10 @@ AsmWriteCr2 (
"movl %0, %%cr2"
:
: "r" (Cr2)
- );
+ );
return Cr2;
}
-
/**
Writes a value to Control Register 3 (CR3).
@@ -299,11 +294,10 @@ AsmWriteCr3 (
"movl %0, %%cr3"
:
: "r" (Cr3)
- );
+ );
return Cr3;
}
-
/**
Writes a value to Control Register 4 (CR4).
@@ -325,11 +319,10 @@ AsmWriteCr4 (
"movl %0, %%cr4"
:
: "r" (Cr4)
- );
+ );
return Cr4;
}
-
/**
Reads the current value of Debug Register 0 (DR0).
@@ -346,17 +339,16 @@ AsmReadDr0 (
VOID
)
{
- UINTN Data;
+ UINTN Data;
__asm__ __volatile__ (
"movl %%dr0, %0"
: "=r" (Data)
- );
+ );
return Data;
}
-
/**
Reads the current value of Debug Register 1 (DR1).
@@ -373,17 +365,16 @@ AsmReadDr1 (
VOID
)
{
- UINTN Data;
+ UINTN Data;
__asm__ __volatile__ (
"movl %%dr1, %0"
: "=r" (Data)
- );
+ );
return Data;
}
-
/**
Reads the current value of Debug Register 2 (DR2).
@@ -400,17 +391,16 @@ AsmReadDr2 (
VOID
)
{
- UINTN Data;
+ UINTN Data;
__asm__ __volatile__ (
"movl %%dr2, %0"
: "=r" (Data)
- );
+ );
return Data;
}
-
/**
Reads the current value of Debug Register 3 (DR3).
@@ -427,17 +417,16 @@ AsmReadDr3 (
VOID
)
{
- UINTN Data;
+ UINTN Data;
__asm__ __volatile__ (
"movl %%dr3, %0"
: "=r" (Data)
- );
+ );
return Data;
}
-
/**
Reads the current value of Debug Register 4 (DR4).
@@ -454,17 +443,16 @@ AsmReadDr4 (
VOID
)
{
- UINTN Data;
+ UINTN Data;
__asm__ __volatile__ (
"movl %%dr4, %0"
: "=r" (Data)
- );
+ );
return Data;
}
-
/**
Reads the current value of Debug Register 5 (DR5).
@@ -481,17 +469,16 @@ AsmReadDr5 (
VOID
)
{
- UINTN Data;
+ UINTN Data;
__asm__ __volatile__ (
"movl %%dr5, %0"
: "=r" (Data)
- );
+ );
return Data;
}
-
/**
Reads the current value of Debug Register 6 (DR6).
@@ -508,17 +495,16 @@ AsmReadDr6 (
VOID
)
{
- UINTN Data;
+ UINTN Data;
__asm__ __volatile__ (
"movl %%dr6, %0"
: "=r" (Data)
- );
+ );
return Data;
}
-
/**
Reads the current value of Debug Register 7 (DR7).
@@ -535,17 +521,16 @@ AsmReadDr7 (
VOID
)
{
- UINTN Data;
+ UINTN Data;
__asm__ __volatile__ (
"movl %%dr7, %0"
: "=r" (Data)
- );
+ );
return Data;
}
-
/**
Writes a value to Debug Register 0 (DR0).
@@ -567,11 +552,10 @@ AsmWriteDr0 (
"movl %0, %%dr0"
:
: "r" (Dr0)
- );
+ );
return Dr0;
}
-
/**
Writes a value to Debug Register 1 (DR1).
@@ -593,11 +577,10 @@ AsmWriteDr1 (
"movl %0, %%dr1"
:
: "r" (Dr1)
- );
+ );
return Dr1;
}
-
/**
Writes a value to Debug Register 2 (DR2).
@@ -619,11 +602,10 @@ AsmWriteDr2 (
"movl %0, %%dr2"
:
: "r" (Dr2)
- );
+ );
return Dr2;
}
-
/**
Writes a value to Debug Register 3 (DR3).
@@ -645,11 +627,10 @@ AsmWriteDr3 (
"movl %0, %%dr3"
:
: "r" (Dr3)
- );
+ );
return Dr3;
}
-
/**
Writes a value to Debug Register 4 (DR4).
@@ -671,11 +652,10 @@ AsmWriteDr4 (
"movl %0, %%dr4"
:
: "r" (Dr4)
- );
+ );
return Dr4;
}
-
/**
Writes a value to Debug Register 5 (DR5).
@@ -697,11 +677,10 @@ AsmWriteDr5 (
"movl %0, %%dr5"
:
: "r" (Dr5)
- );
+ );
return Dr5;
}
-
/**
Writes a value to Debug Register 6 (DR6).
@@ -723,11 +702,10 @@ AsmWriteDr6 (
"movl %0, %%dr6"
:
: "r" (Dr6)
- );
+ );
return Dr6;
}
-
/**
Writes a value to Debug Register 7 (DR7).
@@ -749,11 +727,10 @@ AsmWriteDr7 (
"movl %0, %%dr7"
:
: "r" (Dr7)
- );
+ );
return Dr7;
}
-
/**
Reads the current value of Code Segment Register (CS).
@@ -774,12 +751,11 @@ AsmReadCs (
__asm__ __volatile__ (
"mov %%cs, %0"
:"=a" (Data)
- );
+ );
return Data;
}
-
/**
Reads the current value of Data Segment Register (DS).
@@ -800,12 +776,11 @@ AsmReadDs (
__asm__ __volatile__ (
"mov %%ds, %0"
:"=a" (Data)
- );
+ );
return Data;
}
-
/**
Reads the current value of Extra Segment Register (ES).
@@ -826,12 +801,11 @@ AsmReadEs (
__asm__ __volatile__ (
"mov %%es, %0"
:"=a" (Data)
- );
+ );
return Data;
}
-
/**
Reads the current value of FS Data Segment Register (FS).
@@ -852,12 +826,11 @@ AsmReadFs (
__asm__ __volatile__ (
"mov %%fs, %0"
:"=a" (Data)
- );
+ );
return Data;
}
-
/**
Reads the current value of GS Data Segment Register (GS).
@@ -878,12 +851,11 @@ AsmReadGs (
__asm__ __volatile__ (
"mov %%gs, %0"
:"=a" (Data)
- );
+ );
return Data;
}
-
/**
Reads the current value of Stack Segment Register (SS).
@@ -904,12 +876,11 @@ AsmReadSs (
__asm__ __volatile__ (
"mov %%ss, %0"
:"=a" (Data)
- );
+ );
return Data;
}
-
/**
Reads the current value of Task Register (TR).
@@ -930,12 +901,11 @@ AsmReadTr (
__asm__ __volatile__ (
"str %0"
: "=a" (Data)
- );
+ );
return Data;
}
-
/**
Reads the current Global Descriptor Table Register(GDTR) descriptor.
@@ -948,16 +918,15 @@ AsmReadTr (
VOID
EFIAPI
InternalX86ReadGdtr (
- OUT IA32_DESCRIPTOR *Gdtr
+ OUT IA32_DESCRIPTOR *Gdtr
)
{
__asm__ __volatile__ (
"sgdt %0"
: "=m" (*Gdtr)
- );
+ );
}
-
/**
Writes the current Global Descriptor Table Register (GDTR) descriptor.
@@ -970,18 +939,16 @@ InternalX86ReadGdtr (
VOID
EFIAPI
InternalX86WriteGdtr (
- IN CONST IA32_DESCRIPTOR *Gdtr
+ IN CONST IA32_DESCRIPTOR *Gdtr
)
{
__asm__ __volatile__ (
"lgdt %0"
:
: "m" (*Gdtr)
- );
-
+ );
}
-
/**
Reads the current Interrupt Descriptor Table Register(GDTR) descriptor.
@@ -994,16 +961,15 @@ InternalX86WriteGdtr (
VOID
EFIAPI
InternalX86ReadIdtr (
- OUT IA32_DESCRIPTOR *Idtr
+ OUT IA32_DESCRIPTOR *Idtr
)
{
__asm__ __volatile__ (
"sidt %0"
: "=m" (*Idtr)
- );
+ );
}
-
/**
Writes the current Interrupt Descriptor Table Register(GDTR) descriptor.
@@ -1016,17 +982,16 @@ InternalX86ReadIdtr (
VOID
EFIAPI
InternalX86WriteIdtr (
- IN CONST IA32_DESCRIPTOR *Idtr
+ IN CONST IA32_DESCRIPTOR *Idtr
)
{
__asm__ __volatile__ (
"lidt %0"
:
: "m" (*Idtr)
- );
+ );
}
-
/**
Reads the current Local Descriptor Table Register(LDTR) selector.
@@ -1047,12 +1012,11 @@ AsmReadLdtr (
__asm__ __volatile__ (
"sldt %0"
: "=g" (Data) // %0
- );
+ );
return Data;
}
-
/**
Writes the current Local Descriptor Table Register (GDTR) selector.
@@ -1065,14 +1029,14 @@ AsmReadLdtr (
VOID
EFIAPI
AsmWriteLdtr (
- IN UINT16 Ldtr
+ IN UINT16 Ldtr
)
{
__asm__ __volatile__ (
"lldtw %0"
:
: "g" (Ldtr) // %0
- );
+ );
}
/**
@@ -1089,7 +1053,7 @@ AsmWriteLdtr (
UINT64
EFIAPI
AsmReadPmc (
- IN UINT32 Index
+ IN UINT32 Index
)
{
UINT64 Data;
@@ -1098,7 +1062,7 @@ AsmReadPmc (
"rdpmc"
: "=A" (Data)
: "c" (Index)
- );
+ );
return Data;
}
@@ -1133,10 +1097,8 @@ AsmInvd (
)
{
__asm__ __volatile__ ("invd":::"memory");
-
}
-
/**
Flushes a cache line from all the instruction and data caches within the
coherency domain of the CPU.
@@ -1155,7 +1117,7 @@ AsmInvd (
VOID *
EFIAPI
AsmFlushCacheLine (
- IN VOID *LinearAddress
+ IN VOID *LinearAddress
)
{
UINT32 RegEdx;
@@ -1170,13 +1132,12 @@ AsmFlushCacheLine (
return LinearAddress;
}
-
__asm__ __volatile__ (
"clflush (%0)"
: "+a" (LinearAddress)
:
: "memory"
- );
+ );
return LinearAddress;
}
diff --git a/MdePkg/Library/BaseLib/Ia32/InternalSwitchStack.c b/MdePkg/Library/BaseLib/Ia32/InternalSwitchStack.c
index 14647f22e5..9d586c38ee 100644
--- a/MdePkg/Library/BaseLib/Ia32/InternalSwitchStack.c
+++ b/MdePkg/Library/BaseLib/Ia32/InternalSwitchStack.c
@@ -44,11 +44,11 @@ InternalSwitchStack (
{
BASE_LIBRARY_JUMP_BUFFER JumpBuffer;
- JumpBuffer.Eip = (UINTN)EntryPoint;
- JumpBuffer.Esp = (UINTN)NewStack - sizeof (VOID*);
- JumpBuffer.Esp -= sizeof (Context1) + sizeof (Context2);
- ((VOID**)JumpBuffer.Esp)[1] = Context1;
- ((VOID**)JumpBuffer.Esp)[2] = Context2;
+ JumpBuffer.Eip = (UINTN)EntryPoint;
+ JumpBuffer.Esp = (UINTN)NewStack - sizeof (VOID *);
+ JumpBuffer.Esp -= sizeof (Context1) + sizeof (Context2);
+ ((VOID **)JumpBuffer.Esp)[1] = Context1;
+ ((VOID **)JumpBuffer.Esp)[2] = Context2;
LongJump (&JumpBuffer, (UINTN)-1);
}
diff --git a/MdePkg/Library/BaseLib/Ia32/Invd.c b/MdePkg/Library/BaseLib/Ia32/Invd.c
index 9870cf9c63..3c526b50ae 100644
--- a/MdePkg/Library/BaseLib/Ia32/Invd.c
+++ b/MdePkg/Library/BaseLib/Ia32/Invd.c
@@ -6,9 +6,6 @@
**/
-
-
-
/**
Executes a INVD instruction.
@@ -26,4 +23,3 @@ AsmInvd (
invd
}
}
-
diff --git a/MdePkg/Library/BaseLib/Ia32/LRotU64.c b/MdePkg/Library/BaseLib/Ia32/LRotU64.c
index 87d370c6f4..496b9de0bb 100644
--- a/MdePkg/Library/BaseLib/Ia32/LRotU64.c
+++ b/MdePkg/Library/BaseLib/Ia32/LRotU64.c
@@ -6,9 +6,6 @@
**/
-
-
-
/**
Rotates a 64-bit integer left between 0 and 63 bits, filling
the low bits with the high bits that were rotated.
@@ -26,8 +23,8 @@
UINT64
EFIAPI
InternalMathLRotU64 (
- IN UINT64 Operand,
- IN UINTN Count
+ IN UINT64 Operand,
+ IN UINTN Count
)
{
_asm {
@@ -43,7 +40,6 @@ InternalMathLRotU64 (
mov ecx, eax
mov eax, edx
mov edx, ecx
-L0:
+ L0 :
}
}
-
diff --git a/MdePkg/Library/BaseLib/Ia32/LShiftU64.c b/MdePkg/Library/BaseLib/Ia32/LShiftU64.c
index 1604e7e2f7..c8ee0df7e8 100644
--- a/MdePkg/Library/BaseLib/Ia32/LShiftU64.c
+++ b/MdePkg/Library/BaseLib/Ia32/LShiftU64.c
@@ -6,9 +6,6 @@
**/
-
-
-
/**
Shifts a 64-bit integer left between 0 and 63 bits. The low bits
are filled with zeros. The shifted value is returned.
@@ -25,8 +22,8 @@
UINT64
EFIAPI
InternalMathLShiftU64 (
- IN UINT64 Operand,
- IN UINTN Count
+ IN UINT64 Operand,
+ IN UINTN Count
)
{
_asm {
@@ -42,4 +39,3 @@ L0:
shl eax, cl
}
}
-
diff --git a/MdePkg/Library/BaseLib/Ia32/ModU64x32.c b/MdePkg/Library/BaseLib/Ia32/ModU64x32.c
index 26a19cbd93..d5f84e205d 100644
--- a/MdePkg/Library/BaseLib/Ia32/ModU64x32.c
+++ b/MdePkg/Library/BaseLib/Ia32/ModU64x32.c
@@ -6,9 +6,6 @@
**/
-
-
-
/**
Divides a 64-bit unsigned integer by a 32-bit unsigned integer and
generates a 32-bit unsigned remainder.
@@ -26,8 +23,8 @@
UINT32
EFIAPI
InternalMathModU64x32 (
- IN UINT64 Dividend,
- IN UINT32 Divisor
+ IN UINT64 Dividend,
+ IN UINT32 Divisor
)
{
_asm {
diff --git a/MdePkg/Library/BaseLib/Ia32/Monitor.c b/MdePkg/Library/BaseLib/Ia32/Monitor.c
index 966b128a3b..630bf0c5fe 100644
--- a/MdePkg/Library/BaseLib/Ia32/Monitor.c
+++ b/MdePkg/Library/BaseLib/Ia32/Monitor.c
@@ -25,9 +25,9 @@
UINTN
EFIAPI
AsmMonitor (
- IN UINTN RegisterEax,
- IN UINTN RegisterEcx,
- IN UINTN RegisterEdx
+ IN UINTN RegisterEax,
+ IN UINTN RegisterEcx,
+ IN UINTN RegisterEdx
)
{
_asm {
@@ -39,4 +39,3 @@ AsmMonitor (
_emit 0xc8
}
}
-
diff --git a/MdePkg/Library/BaseLib/Ia32/MultU64x32.c b/MdePkg/Library/BaseLib/Ia32/MultU64x32.c
index a728684648..e382effc2c 100644
--- a/MdePkg/Library/BaseLib/Ia32/MultU64x32.c
+++ b/MdePkg/Library/BaseLib/Ia32/MultU64x32.c
@@ -6,9 +6,6 @@
**/
-
-
-
/**
Multiples a 64-bit unsigned integer by a 32-bit unsigned integer
and generates a 64-bit unsigned result.
@@ -26,8 +23,8 @@
UINT64
EFIAPI
InternalMathMultU64x32 (
- IN UINT64 Multiplicand,
- IN UINT32 Multiplier
+ IN UINT64 Multiplicand,
+ IN UINT32 Multiplier
)
{
_asm {
@@ -38,4 +35,3 @@ InternalMathMultU64x32 (
add edx, ecx
}
}
-
diff --git a/MdePkg/Library/BaseLib/Ia32/MultU64x64.c b/MdePkg/Library/BaseLib/Ia32/MultU64x64.c
index 806cbd565a..d5aff3f181 100644
--- a/MdePkg/Library/BaseLib/Ia32/MultU64x64.c
+++ b/MdePkg/Library/BaseLib/Ia32/MultU64x64.c
@@ -6,9 +6,6 @@
**/
-
-
-
/**
Multiplies a 64-bit unsigned integer by a 64-bit unsigned integer
and generates a 64-bit unsigned result.
@@ -26,8 +23,8 @@
UINT64
EFIAPI
InternalMathMultU64x64 (
- IN UINT64 Multiplicand,
- IN UINT64 Multiplier
+ IN UINT64 Multiplicand,
+ IN UINT64 Multiplier
)
{
_asm {
@@ -42,4 +39,3 @@ InternalMathMultU64x64 (
add edx, ebx
}
}
-
diff --git a/MdePkg/Library/BaseLib/Ia32/Mwait.c b/MdePkg/Library/BaseLib/Ia32/Mwait.c
index 08c666f792..143082a6c2 100644
--- a/MdePkg/Library/BaseLib/Ia32/Mwait.c
+++ b/MdePkg/Library/BaseLib/Ia32/Mwait.c
@@ -23,8 +23,8 @@
UINTN
EFIAPI
AsmMwait (
- IN UINTN RegisterEax,
- IN UINTN RegisterEcx
+ IN UINTN RegisterEax,
+ IN UINTN RegisterEcx
)
{
_asm {
@@ -35,4 +35,3 @@ AsmMwait (
_emit 0xC9
}
}
-
diff --git a/MdePkg/Library/BaseLib/Ia32/Non-existing.c b/MdePkg/Library/BaseLib/Ia32/Non-existing.c
index 3854d904fe..7765f58bcd 100644
--- a/MdePkg/Library/BaseLib/Ia32/Non-existing.c
+++ b/MdePkg/Library/BaseLib/Ia32/Non-existing.c
@@ -37,11 +37,11 @@
VOID
EFIAPI
InternalX86DisablePaging64 (
- IN UINT16 CodeSelector,
- IN UINT32 EntryPoint,
- IN UINT32 Context1 OPTIONAL,
- IN UINT32 Context2 OPTIONAL,
- IN UINT32 NewStack
+ IN UINT16 CodeSelector,
+ IN UINT32 EntryPoint,
+ IN UINT32 Context1 OPTIONAL,
+ IN UINT32 Context2 OPTIONAL,
+ IN UINT32 NewStack
)
{
//
diff --git a/MdePkg/Library/BaseLib/Ia32/RRotU64.c b/MdePkg/Library/BaseLib/Ia32/RRotU64.c
index 82711a5f81..89477c280b 100644
--- a/MdePkg/Library/BaseLib/Ia32/RRotU64.c
+++ b/MdePkg/Library/BaseLib/Ia32/RRotU64.c
@@ -6,9 +6,6 @@
**/
-
-
-
/**
Rotates a 64-bit integer right between 0 and 63 bits, filling
the high bits with the high low bits that were rotated.
@@ -26,8 +23,8 @@
UINT64
EFIAPI
InternalMathRRotU64 (
- IN UINT64 Operand,
- IN UINTN Count
+ IN UINT64 Operand,
+ IN UINTN Count
)
{
_asm {
@@ -46,4 +43,3 @@ InternalMathRRotU64 (
L0:
}
}
-
diff --git a/MdePkg/Library/BaseLib/Ia32/RShiftU64.c b/MdePkg/Library/BaseLib/Ia32/RShiftU64.c
index 35d8437056..5aa7a856a0 100644
--- a/MdePkg/Library/BaseLib/Ia32/RShiftU64.c
+++ b/MdePkg/Library/BaseLib/Ia32/RShiftU64.c
@@ -6,9 +6,6 @@
**/
-
-
-
/**
Shifts a 64-bit integer right between 0 and 63 bits. This high bits
are filled with zeros. The shifted value is returned.
@@ -25,8 +22,8 @@
UINT64
EFIAPI
InternalMathRShiftU64 (
- IN UINT64 Operand,
- IN UINTN Count
+ IN UINT64 Operand,
+ IN UINTN Count
)
{
_asm {
@@ -42,4 +39,3 @@ L0:
shr edx, cl
}
}
-
diff --git a/MdePkg/Library/BaseLib/Ia32/ReadCr0.c b/MdePkg/Library/BaseLib/Ia32/ReadCr0.c
index 4a37c7b02c..7395218387 100644
--- a/MdePkg/Library/BaseLib/Ia32/ReadCr0.c
+++ b/MdePkg/Library/BaseLib/Ia32/ReadCr0.c
@@ -6,9 +6,6 @@
**/
-
-
-
/**
Reads the current value of the Control Register 0 (CR0).
diff --git a/MdePkg/Library/BaseLib/Ia32/ReadCr2.c b/MdePkg/Library/BaseLib/Ia32/ReadCr2.c
index feab380552..2de1c50380 100644
--- a/MdePkg/Library/BaseLib/Ia32/ReadCr2.c
+++ b/MdePkg/Library/BaseLib/Ia32/ReadCr2.c
@@ -6,9 +6,6 @@
**/
-
-
-
/**
Reads the current value of the Control Register 2 (CR2).
@@ -29,4 +26,3 @@ AsmReadCr2 (
mov eax, cr2
}
}
-
diff --git a/MdePkg/Library/BaseLib/Ia32/ReadCr3.c b/MdePkg/Library/BaseLib/Ia32/ReadCr3.c
index b00e324919..144b78057b 100644
--- a/MdePkg/Library/BaseLib/Ia32/ReadCr3.c
+++ b/MdePkg/Library/BaseLib/Ia32/ReadCr3.c
@@ -6,9 +6,6 @@
**/
-
-
-
/**
Reads the current value of the Control Register 3 (CR3).
@@ -29,4 +26,3 @@ AsmReadCr3 (
mov eax, cr3
}
}
-
diff --git a/MdePkg/Library/BaseLib/Ia32/ReadCr4.c b/MdePkg/Library/BaseLib/Ia32/ReadCr4.c
index f948f82b77..c0616618bd 100644
--- a/MdePkg/Library/BaseLib/Ia32/ReadCr4.c
+++ b/MdePkg/Library/BaseLib/Ia32/ReadCr4.c
@@ -6,9 +6,6 @@
**/
-
-
-
/**
Reads the current value of the Control Register 4 (CR4).
@@ -31,4 +28,3 @@ AsmReadCr4 (
_emit 0xE0
}
}
-
diff --git a/MdePkg/Library/BaseLib/Ia32/ReadCs.c b/MdePkg/Library/BaseLib/Ia32/ReadCs.c
index 02f23f5f1e..3a603f1aee 100644
--- a/MdePkg/Library/BaseLib/Ia32/ReadCs.c
+++ b/MdePkg/Library/BaseLib/Ia32/ReadCs.c
@@ -6,9 +6,6 @@
**/
-
-
-
/**
Reads the current value of Code Segment Register (CS).
@@ -29,4 +26,3 @@ AsmReadCs (
mov ax, cs
}
}
-
diff --git a/MdePkg/Library/BaseLib/Ia32/ReadDr0.c b/MdePkg/Library/BaseLib/Ia32/ReadDr0.c
index 5418f92a39..80bb9b7e53 100644
--- a/MdePkg/Library/BaseLib/Ia32/ReadDr0.c
+++ b/MdePkg/Library/BaseLib/Ia32/ReadDr0.c
@@ -6,9 +6,6 @@
**/
-
-
-
/**
Reads the current value of Debug Register 0 (DR0).
@@ -29,4 +26,3 @@ AsmReadDr0 (
mov eax, dr0
}
}
-
diff --git a/MdePkg/Library/BaseLib/Ia32/ReadDr1.c b/MdePkg/Library/BaseLib/Ia32/ReadDr1.c
index d72adaadb8..9ca51ce143 100644
--- a/MdePkg/Library/BaseLib/Ia32/ReadDr1.c
+++ b/MdePkg/Library/BaseLib/Ia32/ReadDr1.c
@@ -6,9 +6,6 @@
**/
-
-
-
/**
Reads the current value of Debug Register 1 (DR1).
@@ -29,4 +26,3 @@ AsmReadDr1 (
mov eax, dr1
}
}
-
diff --git a/MdePkg/Library/BaseLib/Ia32/ReadDr2.c b/MdePkg/Library/BaseLib/Ia32/ReadDr2.c
index fde799728f..1e8007d46b 100644
--- a/MdePkg/Library/BaseLib/Ia32/ReadDr2.c
+++ b/MdePkg/Library/BaseLib/Ia32/ReadDr2.c
@@ -6,9 +6,6 @@
**/
-
-
-
/**
Reads the current value of Debug Register 2 (DR2).
@@ -29,4 +26,3 @@ AsmReadDr2 (
mov eax, dr2
}
}
-
diff --git a/MdePkg/Library/BaseLib/Ia32/ReadDr3.c b/MdePkg/Library/BaseLib/Ia32/ReadDr3.c
index 9b899e79c7..3a2d7417fe 100644
--- a/MdePkg/Library/BaseLib/Ia32/ReadDr3.c
+++ b/MdePkg/Library/BaseLib/Ia32/ReadDr3.c
@@ -6,9 +6,6 @@
**/
-
-
-
/**
Reads the current value of Debug Register 3 (DR3).
@@ -29,4 +26,3 @@ AsmReadDr3 (
mov eax, dr3
}
}
-
diff --git a/MdePkg/Library/BaseLib/Ia32/ReadDr4.c b/MdePkg/Library/BaseLib/Ia32/ReadDr4.c
index 52293d335e..5d7e543823 100644
--- a/MdePkg/Library/BaseLib/Ia32/ReadDr4.c
+++ b/MdePkg/Library/BaseLib/Ia32/ReadDr4.c
@@ -6,9 +6,6 @@
**/
-
-
-
/**
Reads the current value of Debug Register 4 (DR4).
@@ -31,4 +28,3 @@ AsmReadDr4 (
_emit 0xe0
}
}
-
diff --git a/MdePkg/Library/BaseLib/Ia32/ReadDr5.c b/MdePkg/Library/BaseLib/Ia32/ReadDr5.c
index ecf6dc2d21..2418d222be 100644
--- a/MdePkg/Library/BaseLib/Ia32/ReadDr5.c
+++ b/MdePkg/Library/BaseLib/Ia32/ReadDr5.c
@@ -6,9 +6,6 @@
**/
-
-
-
/**
Reads the current value of Debug Register 5 (DR5).
@@ -31,4 +28,3 @@ AsmReadDr5 (
_emit 0xe8
}
}
-
diff --git a/MdePkg/Library/BaseLib/Ia32/ReadDr6.c b/MdePkg/Library/BaseLib/Ia32/ReadDr6.c
index 2b082970fc..43166828eb 100644
--- a/MdePkg/Library/BaseLib/Ia32/ReadDr6.c
+++ b/MdePkg/Library/BaseLib/Ia32/ReadDr6.c
@@ -6,9 +6,6 @@
**/
-
-
-
/**
Reads the current value of Debug Register 6 (DR6).
@@ -29,4 +26,3 @@ AsmReadDr6 (
mov eax, dr6
}
}
-
diff --git a/MdePkg/Library/BaseLib/Ia32/ReadDr7.c b/MdePkg/Library/BaseLib/Ia32/ReadDr7.c
index 8be80482f3..670c695638 100644
--- a/MdePkg/Library/BaseLib/Ia32/ReadDr7.c
+++ b/MdePkg/Library/BaseLib/Ia32/ReadDr7.c
@@ -6,9 +6,6 @@
**/
-
-
-
/**
Reads the current value of Debug Register 7 (DR7).
@@ -29,4 +26,3 @@ AsmReadDr7 (
mov eax, dr7
}
}
-
diff --git a/MdePkg/Library/BaseLib/Ia32/ReadDs.c b/MdePkg/Library/BaseLib/Ia32/ReadDs.c
index 3cdada3ac5..d293bcf591 100644
--- a/MdePkg/Library/BaseLib/Ia32/ReadDs.c
+++ b/MdePkg/Library/BaseLib/Ia32/ReadDs.c
@@ -6,9 +6,6 @@
**/
-
-
-
/**
Reads the current value of Data Segment Register (DS).
@@ -29,4 +26,3 @@ AsmReadDs (
mov ax, ds
}
}
-
diff --git a/MdePkg/Library/BaseLib/Ia32/ReadEflags.c b/MdePkg/Library/BaseLib/Ia32/ReadEflags.c
index 1cea323c55..af3375503f 100644
--- a/MdePkg/Library/BaseLib/Ia32/ReadEflags.c
+++ b/MdePkg/Library/BaseLib/Ia32/ReadEflags.c
@@ -6,9 +6,6 @@
**/
-
-
-
/**
Reads the current value of the EFLAGS register.
@@ -30,4 +27,3 @@ AsmReadEflags (
pop eax
}
}
-
diff --git a/MdePkg/Library/BaseLib/Ia32/ReadEs.c b/MdePkg/Library/BaseLib/Ia32/ReadEs.c
index 30953fdf3a..22c10bea55 100644
--- a/MdePkg/Library/BaseLib/Ia32/ReadEs.c
+++ b/MdePkg/Library/BaseLib/Ia32/ReadEs.c
@@ -6,9 +6,6 @@
**/
-
-
-
/**
Reads the current value of ES Data Segment Register (ES).
@@ -29,4 +26,3 @@ AsmReadEs (
mov ax, es
}
}
-
diff --git a/MdePkg/Library/BaseLib/Ia32/ReadFs.c b/MdePkg/Library/BaseLib/Ia32/ReadFs.c
index 51fb020b12..500058da18 100644
--- a/MdePkg/Library/BaseLib/Ia32/ReadFs.c
+++ b/MdePkg/Library/BaseLib/Ia32/ReadFs.c
@@ -6,9 +6,6 @@
**/
-
-
-
/**
Reads the current value of FS Data Segment Register (FS).
@@ -29,4 +26,3 @@ AsmReadFs (
mov ax, fs
}
}
-
diff --git a/MdePkg/Library/BaseLib/Ia32/ReadGdtr.c b/MdePkg/Library/BaseLib/Ia32/ReadGdtr.c
index 5b01300b4b..8f6d6122c4 100644
--- a/MdePkg/Library/BaseLib/Ia32/ReadGdtr.c
+++ b/MdePkg/Library/BaseLib/Ia32/ReadGdtr.c
@@ -6,10 +6,8 @@
**/
-
#include "BaseLibInternals.h"
-
/**
Reads the current Global Descriptor Table Register(GDTR) descriptor.
@@ -30,4 +28,3 @@ InternalX86ReadGdtr (
sgdt fword ptr [eax]
}
}
-
diff --git a/MdePkg/Library/BaseLib/Ia32/ReadGs.c b/MdePkg/Library/BaseLib/Ia32/ReadGs.c
index 6209a31ae9..6449447b87 100644
--- a/MdePkg/Library/BaseLib/Ia32/ReadGs.c
+++ b/MdePkg/Library/BaseLib/Ia32/ReadGs.c
@@ -6,9 +6,6 @@
**/
-
-
-
/**
Reads the current value of GS Data Segment Register (GS).
@@ -29,4 +26,3 @@ AsmReadGs (
mov ax, gs
}
}
-
diff --git a/MdePkg/Library/BaseLib/Ia32/ReadIdtr.c b/MdePkg/Library/BaseLib/Ia32/ReadIdtr.c
index 93f44535d3..4a717bbcf4 100644
--- a/MdePkg/Library/BaseLib/Ia32/ReadIdtr.c
+++ b/MdePkg/Library/BaseLib/Ia32/ReadIdtr.c
@@ -6,10 +6,8 @@
**/
-
#include "BaseLibInternals.h"
-
/**
Reads the current Interrupt Descriptor Table Register(GDTR) descriptor.
@@ -22,7 +20,7 @@
VOID
EFIAPI
InternalX86ReadIdtr (
- OUT IA32_DESCRIPTOR *Idtr
+ OUT IA32_DESCRIPTOR *Idtr
)
{
_asm {
diff --git a/MdePkg/Library/BaseLib/Ia32/ReadLdtr.c b/MdePkg/Library/BaseLib/Ia32/ReadLdtr.c
index 407676a465..31978ffaa7 100644
--- a/MdePkg/Library/BaseLib/Ia32/ReadLdtr.c
+++ b/MdePkg/Library/BaseLib/Ia32/ReadLdtr.c
@@ -6,9 +6,6 @@
**/
-
-
-
/**
Reads the current Local Descriptor Table Register(LDTR) selector.
@@ -28,4 +25,3 @@ AsmReadLdtr (
sldt ax
}
}
-
diff --git a/MdePkg/Library/BaseLib/Ia32/ReadMm0.c b/MdePkg/Library/BaseLib/Ia32/ReadMm0.c
index 00dfe05895..f54452ab8c 100644
--- a/MdePkg/Library/BaseLib/Ia32/ReadMm0.c
+++ b/MdePkg/Library/BaseLib/Ia32/ReadMm0.c
@@ -6,9 +6,6 @@
**/
-
-
-
/**
Reads the current value of 64-bit MMX Register #0 (MM0).
@@ -33,4 +30,3 @@ AsmReadMm0 (
emms
}
}
-
diff --git a/MdePkg/Library/BaseLib/Ia32/ReadMm1.c b/MdePkg/Library/BaseLib/Ia32/ReadMm1.c
index 0ed311e412..027cccc30b 100644
--- a/MdePkg/Library/BaseLib/Ia32/ReadMm1.c
+++ b/MdePkg/Library/BaseLib/Ia32/ReadMm1.c
@@ -6,9 +6,6 @@
**/
-
-
-
/**
Reads the current value of 64-bit MMX Register #1 (MM1).
@@ -33,4 +30,3 @@ AsmReadMm1 (
emms
}
}
-
diff --git a/MdePkg/Library/BaseLib/Ia32/ReadMm2.c b/MdePkg/Library/BaseLib/Ia32/ReadMm2.c
index bd830c557f..25c8caa858 100644
--- a/MdePkg/Library/BaseLib/Ia32/ReadMm2.c
+++ b/MdePkg/Library/BaseLib/Ia32/ReadMm2.c
@@ -6,9 +6,6 @@
**/
-
-
-
/**
Reads the current value of 64-bit MMX Register #2 (MM2).
@@ -33,4 +30,3 @@ AsmReadMm2 (
emms
}
}
-
diff --git a/MdePkg/Library/BaseLib/Ia32/ReadMm3.c b/MdePkg/Library/BaseLib/Ia32/ReadMm3.c
index c8967083ba..33aef907e5 100644
--- a/MdePkg/Library/BaseLib/Ia32/ReadMm3.c
+++ b/MdePkg/Library/BaseLib/Ia32/ReadMm3.c
@@ -6,9 +6,6 @@
**/
-
-
-
/**
Reads the current value of 64-bit MMX Register #3 (MM3).
@@ -33,4 +30,3 @@ AsmReadMm3 (
emms
}
}
-
diff --git a/MdePkg/Library/BaseLib/Ia32/ReadMm4.c b/MdePkg/Library/BaseLib/Ia32/ReadMm4.c
index 9e2794cd4d..c5a646ffd9 100644
--- a/MdePkg/Library/BaseLib/Ia32/ReadMm4.c
+++ b/MdePkg/Library/BaseLib/Ia32/ReadMm4.c
@@ -6,9 +6,6 @@
**/
-
-
-
/**
Reads the current value of 64-bit MMX Register #4 (MM4).
@@ -33,4 +30,3 @@ AsmReadMm4 (
emms
}
}
-
diff --git a/MdePkg/Library/BaseLib/Ia32/ReadMm5.c b/MdePkg/Library/BaseLib/Ia32/ReadMm5.c
index 93cad05a49..70b97b8bbb 100644
--- a/MdePkg/Library/BaseLib/Ia32/ReadMm5.c
+++ b/MdePkg/Library/BaseLib/Ia32/ReadMm5.c
@@ -6,9 +6,6 @@
**/
-
-
-
/**
Reads the current value of 64-bit MMX Register #5 (MM5).
@@ -33,4 +30,3 @@ AsmReadMm5 (
emms
}
}
-
diff --git a/MdePkg/Library/BaseLib/Ia32/ReadMm6.c b/MdePkg/Library/BaseLib/Ia32/ReadMm6.c
index d2c559163a..6b3055c4bc 100644
--- a/MdePkg/Library/BaseLib/Ia32/ReadMm6.c
+++ b/MdePkg/Library/BaseLib/Ia32/ReadMm6.c
@@ -6,9 +6,6 @@
**/
-
-
-
/**
Reads the current value of 64-bit MMX Register #6 (MM6).
@@ -33,4 +30,3 @@ AsmReadMm6 (
emms
}
}
-
diff --git a/MdePkg/Library/BaseLib/Ia32/ReadMm7.c b/MdePkg/Library/BaseLib/Ia32/ReadMm7.c
index 68cf039285..9ee911a199 100644
--- a/MdePkg/Library/BaseLib/Ia32/ReadMm7.c
+++ b/MdePkg/Library/BaseLib/Ia32/ReadMm7.c
@@ -6,9 +6,6 @@
**/
-
-
-
/**
Reads the current value of 64-bit MMX Register #7 (MM7).
@@ -33,4 +30,3 @@ AsmReadMm7 (
emms
}
}
-
diff --git a/MdePkg/Library/BaseLib/Ia32/ReadMsr64.c b/MdePkg/Library/BaseLib/Ia32/ReadMsr64.c
index afe3aa5bdc..837595c9b1 100644
--- a/MdePkg/Library/BaseLib/Ia32/ReadMsr64.c
+++ b/MdePkg/Library/BaseLib/Ia32/ReadMsr64.c
@@ -6,7 +6,6 @@
**/
-
#include <Library/RegisterFilterLib.h>
/**
@@ -54,13 +53,14 @@ AsmReadMsr64 (
IN UINT32 Index
)
{
- UINT64 Value;
- BOOLEAN Flag;
+ UINT64 Value;
+ BOOLEAN Flag;
Flag = FilterBeforeMsrRead (Index, &Value);
if (Flag) {
Value = AsmReadMsr64Internal (Index);
}
+
FilterAfterMsrRead (Index, &Value);
return Value;
diff --git a/MdePkg/Library/BaseLib/Ia32/ReadPmc.c b/MdePkg/Library/BaseLib/Ia32/ReadPmc.c
index cc09ed7005..0137fe8525 100644
--- a/MdePkg/Library/BaseLib/Ia32/ReadPmc.c
+++ b/MdePkg/Library/BaseLib/Ia32/ReadPmc.c
@@ -20,7 +20,7 @@
UINT64
EFIAPI
AsmReadPmc (
- IN UINT32 Index
+ IN UINT32 Index
)
{
_asm {
@@ -28,4 +28,3 @@ AsmReadPmc (
rdpmc
}
}
-
diff --git a/MdePkg/Library/BaseLib/Ia32/ReadSs.c b/MdePkg/Library/BaseLib/Ia32/ReadSs.c
index 9d7a6411a8..e5e2311a00 100644
--- a/MdePkg/Library/BaseLib/Ia32/ReadSs.c
+++ b/MdePkg/Library/BaseLib/Ia32/ReadSs.c
@@ -6,9 +6,6 @@
**/
-
-
-
/**
Reads the current value of Stack Segment Register (SS).
@@ -29,4 +26,3 @@ AsmReadSs (
mov ax, ss
}
}
-
diff --git a/MdePkg/Library/BaseLib/Ia32/ReadTr.c b/MdePkg/Library/BaseLib/Ia32/ReadTr.c
index b52f8f31d2..bfb5e6b0db 100644
--- a/MdePkg/Library/BaseLib/Ia32/ReadTr.c
+++ b/MdePkg/Library/BaseLib/Ia32/ReadTr.c
@@ -6,9 +6,6 @@
**/
-
-
-
/**
Reads the current value of Task Register (TR).
@@ -28,4 +25,3 @@ AsmReadTr (
str ax
}
}
-
diff --git a/MdePkg/Library/BaseLib/Ia32/ReadTsc.c b/MdePkg/Library/BaseLib/Ia32/ReadTsc.c
index a67b57a77d..4109b96d8b 100644
--- a/MdePkg/Library/BaseLib/Ia32/ReadTsc.c
+++ b/MdePkg/Library/BaseLib/Ia32/ReadTsc.c
@@ -6,9 +6,6 @@
**/
-
-
-
/**
Reads the current value of Time Stamp Counter (TSC).
@@ -28,4 +25,3 @@ AsmReadTsc (
rdtsc
}
}
-
diff --git a/MdePkg/Library/BaseLib/Ia32/SwapBytes64.c b/MdePkg/Library/BaseLib/Ia32/SwapBytes64.c
index 67587f1d27..42d4f66dd3 100644
--- a/MdePkg/Library/BaseLib/Ia32/SwapBytes64.c
+++ b/MdePkg/Library/BaseLib/Ia32/SwapBytes64.c
@@ -6,9 +6,6 @@
**/
-
-
-
/**
Switches the endianess of a 64-bit integer.
@@ -24,7 +21,7 @@
UINT64
EFIAPI
InternalMathSwapBytes64 (
- IN UINT64 Operand
+ IN UINT64 Operand
)
{
_asm {
@@ -34,4 +31,3 @@ InternalMathSwapBytes64 (
bswap edx
}
}
-
diff --git a/MdePkg/Library/BaseLib/Ia32/Wbinvd.c b/MdePkg/Library/BaseLib/Ia32/Wbinvd.c
index 87bd71f05d..f41cb4ee14 100644
--- a/MdePkg/Library/BaseLib/Ia32/Wbinvd.c
+++ b/MdePkg/Library/BaseLib/Ia32/Wbinvd.c
@@ -6,9 +6,6 @@
**/
-
-
-
/**
Executes a WBINVD instruction.
@@ -26,4 +23,3 @@ AsmWbinvd (
wbinvd
}
}
-
diff --git a/MdePkg/Library/BaseLib/Ia32/WriteCr0.c b/MdePkg/Library/BaseLib/Ia32/WriteCr0.c
index 46e49a678a..e20f769c77 100644
--- a/MdePkg/Library/BaseLib/Ia32/WriteCr0.c
+++ b/MdePkg/Library/BaseLib/Ia32/WriteCr0.c
@@ -28,4 +28,3 @@ AsmWriteCr0 (
mov cr0, eax
}
}
-
diff --git a/MdePkg/Library/BaseLib/Ia32/WriteCr2.c b/MdePkg/Library/BaseLib/Ia32/WriteCr2.c
index f437bfc8c8..4571ec9505 100644
--- a/MdePkg/Library/BaseLib/Ia32/WriteCr2.c
+++ b/MdePkg/Library/BaseLib/Ia32/WriteCr2.c
@@ -28,4 +28,3 @@ AsmWriteCr2 (
mov cr2, eax
}
}
-
diff --git a/MdePkg/Library/BaseLib/Ia32/WriteCr3.c b/MdePkg/Library/BaseLib/Ia32/WriteCr3.c
index 48cb8ad16f..29d0ae21f6 100644
--- a/MdePkg/Library/BaseLib/Ia32/WriteCr3.c
+++ b/MdePkg/Library/BaseLib/Ia32/WriteCr3.c
@@ -28,4 +28,3 @@ AsmWriteCr3 (
mov cr3, eax
}
}
-
diff --git a/MdePkg/Library/BaseLib/Ia32/WriteCr4.c b/MdePkg/Library/BaseLib/Ia32/WriteCr4.c
index 01f059ffaa..f152464a4a 100644
--- a/MdePkg/Library/BaseLib/Ia32/WriteCr4.c
+++ b/MdePkg/Library/BaseLib/Ia32/WriteCr4.c
@@ -30,4 +30,3 @@ AsmWriteCr4 (
_emit 0xE0
}
}
-
diff --git a/MdePkg/Library/BaseLib/Ia32/WriteDr0.c b/MdePkg/Library/BaseLib/Ia32/WriteDr0.c
index 80bb238184..027e1b458b 100644
--- a/MdePkg/Library/BaseLib/Ia32/WriteDr0.c
+++ b/MdePkg/Library/BaseLib/Ia32/WriteDr0.c
@@ -20,7 +20,7 @@
UINTN
EFIAPI
AsmWriteDr0 (
- IN UINTN Value
+ IN UINTN Value
)
{
_asm {
@@ -28,4 +28,3 @@ AsmWriteDr0 (
mov dr0, eax
}
}
-
diff --git a/MdePkg/Library/BaseLib/Ia32/WriteDr1.c b/MdePkg/Library/BaseLib/Ia32/WriteDr1.c
index f1c8f325e4..302c3491eb 100644
--- a/MdePkg/Library/BaseLib/Ia32/WriteDr1.c
+++ b/MdePkg/Library/BaseLib/Ia32/WriteDr1.c
@@ -20,7 +20,7 @@
UINTN
EFIAPI
AsmWriteDr1 (
- IN UINTN Value
+ IN UINTN Value
)
{
_asm {
@@ -28,4 +28,3 @@ AsmWriteDr1 (
mov dr1, eax
}
}
-
diff --git a/MdePkg/Library/BaseLib/Ia32/WriteDr2.c b/MdePkg/Library/BaseLib/Ia32/WriteDr2.c
index 6e1e7f2406..20b62246c0 100644
--- a/MdePkg/Library/BaseLib/Ia32/WriteDr2.c
+++ b/MdePkg/Library/BaseLib/Ia32/WriteDr2.c
@@ -20,7 +20,7 @@
UINTN
EFIAPI
AsmWriteDr2 (
- IN UINTN Value
+ IN UINTN Value
)
{
_asm {
@@ -28,4 +28,3 @@ AsmWriteDr2 (
mov dr2, eax
}
}
-
diff --git a/MdePkg/Library/BaseLib/Ia32/WriteDr3.c b/MdePkg/Library/BaseLib/Ia32/WriteDr3.c
index 7cb1d3724e..6eafe40dcf 100644
--- a/MdePkg/Library/BaseLib/Ia32/WriteDr3.c
+++ b/MdePkg/Library/BaseLib/Ia32/WriteDr3.c
@@ -20,7 +20,7 @@
UINTN
EFIAPI
AsmWriteDr3 (
- IN UINTN Value
+ IN UINTN Value
)
{
_asm {
@@ -28,4 +28,3 @@ AsmWriteDr3 (
mov dr3, eax
}
}
-
diff --git a/MdePkg/Library/BaseLib/Ia32/WriteDr4.c b/MdePkg/Library/BaseLib/Ia32/WriteDr4.c
index 778017f339..32815b28ff 100644
--- a/MdePkg/Library/BaseLib/Ia32/WriteDr4.c
+++ b/MdePkg/Library/BaseLib/Ia32/WriteDr4.c
@@ -20,7 +20,7 @@
UINTN
EFIAPI
AsmWriteDr4 (
- IN UINTN Value
+ IN UINTN Value
)
{
_asm {
@@ -30,4 +30,3 @@ AsmWriteDr4 (
_emit 0xe0
}
}
-
diff --git a/MdePkg/Library/BaseLib/Ia32/WriteDr5.c b/MdePkg/Library/BaseLib/Ia32/WriteDr5.c
index 2159813a35..4a0c384518 100644
--- a/MdePkg/Library/BaseLib/Ia32/WriteDr5.c
+++ b/MdePkg/Library/BaseLib/Ia32/WriteDr5.c
@@ -20,7 +20,7 @@
UINTN
EFIAPI
AsmWriteDr5 (
- IN UINTN Value
+ IN UINTN Value
)
{
_asm {
@@ -30,4 +30,3 @@ AsmWriteDr5 (
_emit 0xe8
}
}
-
diff --git a/MdePkg/Library/BaseLib/Ia32/WriteDr6.c b/MdePkg/Library/BaseLib/Ia32/WriteDr6.c
index c03d71643b..7cfc4bb282 100644
--- a/MdePkg/Library/BaseLib/Ia32/WriteDr6.c
+++ b/MdePkg/Library/BaseLib/Ia32/WriteDr6.c
@@ -20,7 +20,7 @@
UINTN
EFIAPI
AsmWriteDr6 (
- IN UINTN Value
+ IN UINTN Value
)
{
_asm {
@@ -28,4 +28,3 @@ AsmWriteDr6 (
mov dr6, eax
}
}
-
diff --git a/MdePkg/Library/BaseLib/Ia32/WriteDr7.c b/MdePkg/Library/BaseLib/Ia32/WriteDr7.c
index c4821e4cdf..78b0b72aeb 100644
--- a/MdePkg/Library/BaseLib/Ia32/WriteDr7.c
+++ b/MdePkg/Library/BaseLib/Ia32/WriteDr7.c
@@ -20,7 +20,7 @@
UINTN
EFIAPI
AsmWriteDr7 (
- IN UINTN Value
+ IN UINTN Value
)
{
_asm {
@@ -28,4 +28,3 @@ AsmWriteDr7 (
mov dr7, eax
}
}
-
diff --git a/MdePkg/Library/BaseLib/Ia32/WriteGdtr.c b/MdePkg/Library/BaseLib/Ia32/WriteGdtr.c
index 37ceae73ff..a542665375 100644
--- a/MdePkg/Library/BaseLib/Ia32/WriteGdtr.c
+++ b/MdePkg/Library/BaseLib/Ia32/WriteGdtr.c
@@ -6,10 +6,8 @@
**/
-
#include "BaseLibInternals.h"
-
/**
Writes the current Global Descriptor Table Register (GDTR) descriptor.
@@ -22,7 +20,7 @@
VOID
EFIAPI
InternalX86WriteGdtr (
- IN CONST IA32_DESCRIPTOR *Gdtr
+ IN CONST IA32_DESCRIPTOR *Gdtr
)
{
_asm {
@@ -30,4 +28,3 @@ InternalX86WriteGdtr (
lgdt fword ptr [eax]
}
}
-
diff --git a/MdePkg/Library/BaseLib/Ia32/WriteIdtr.c b/MdePkg/Library/BaseLib/Ia32/WriteIdtr.c
index 49ef22b997..aaa29b3d1e 100644
--- a/MdePkg/Library/BaseLib/Ia32/WriteIdtr.c
+++ b/MdePkg/Library/BaseLib/Ia32/WriteIdtr.c
@@ -6,7 +6,6 @@
**/
-
#include "BaseLibInternals.h"
/**
@@ -21,7 +20,7 @@
VOID
EFIAPI
InternalX86WriteIdtr (
- IN CONST IA32_DESCRIPTOR *Idtr
+ IN CONST IA32_DESCRIPTOR *Idtr
)
{
_asm {
@@ -32,4 +31,3 @@ InternalX86WriteIdtr (
popfd
}
}
-
diff --git a/MdePkg/Library/BaseLib/Ia32/WriteLdtr.c b/MdePkg/Library/BaseLib/Ia32/WriteLdtr.c
index 8e12f7840b..d45f0fe076 100644
--- a/MdePkg/Library/BaseLib/Ia32/WriteLdtr.c
+++ b/MdePkg/Library/BaseLib/Ia32/WriteLdtr.c
@@ -6,9 +6,6 @@
**/
-
-
-
/**
Writes the current Local Descriptor Table Register (GDTR) selector.
@@ -21,7 +18,7 @@
VOID
EFIAPI
AsmWriteLdtr (
- IN UINT16 Ldtr
+ IN UINT16 Ldtr
)
{
_asm {
@@ -30,4 +27,3 @@ AsmWriteLdtr (
lldt ax
}
}
-
diff --git a/MdePkg/Library/BaseLib/Ia32/WriteMm0.c b/MdePkg/Library/BaseLib/Ia32/WriteMm0.c
index ea26009a68..7807c3583a 100644
--- a/MdePkg/Library/BaseLib/Ia32/WriteMm0.c
+++ b/MdePkg/Library/BaseLib/Ia32/WriteMm0.c
@@ -6,9 +6,6 @@
**/
-
-
-
/**
Writes the current value of 64-bit MMX Register #0 (MM0).
@@ -21,7 +18,7 @@
VOID
EFIAPI
AsmWriteMm0 (
- IN UINT64 Value
+ IN UINT64 Value
)
{
_asm {
@@ -29,4 +26,3 @@ AsmWriteMm0 (
emms
}
}
-
diff --git a/MdePkg/Library/BaseLib/Ia32/WriteMm1.c b/MdePkg/Library/BaseLib/Ia32/WriteMm1.c
index b8da47329d..378aac289a 100644
--- a/MdePkg/Library/BaseLib/Ia32/WriteMm1.c
+++ b/MdePkg/Library/BaseLib/Ia32/WriteMm1.c
@@ -6,9 +6,6 @@
**/
-
-
-
/**
Writes the current value of 64-bit MMX Register #1 (MM1).
@@ -21,7 +18,7 @@
VOID
EFIAPI
AsmWriteMm1 (
- IN UINT64 Value
+ IN UINT64 Value
)
{
_asm {
@@ -29,4 +26,3 @@ AsmWriteMm1 (
emms
}
}
-
diff --git a/MdePkg/Library/BaseLib/Ia32/WriteMm2.c b/MdePkg/Library/BaseLib/Ia32/WriteMm2.c
index 6b77aed7a4..ebab66f239 100644
--- a/MdePkg/Library/BaseLib/Ia32/WriteMm2.c
+++ b/MdePkg/Library/BaseLib/Ia32/WriteMm2.c
@@ -6,9 +6,6 @@
**/
-
-
-
/**
Writes the current value of 64-bit MMX Register #2 (MM2).
@@ -21,7 +18,7 @@
VOID
EFIAPI
AsmWriteMm2 (
- IN UINT64 Value
+ IN UINT64 Value
)
{
_asm {
@@ -29,4 +26,3 @@ AsmWriteMm2 (
emms
}
}
-
diff --git a/MdePkg/Library/BaseLib/Ia32/WriteMm3.c b/MdePkg/Library/BaseLib/Ia32/WriteMm3.c
index 4fc7d7042b..645a14fc68 100644
--- a/MdePkg/Library/BaseLib/Ia32/WriteMm3.c
+++ b/MdePkg/Library/BaseLib/Ia32/WriteMm3.c
@@ -6,9 +6,6 @@
**/
-
-
-
/**
Writes the current value of 64-bit MMX Register #3 (MM3).
@@ -21,7 +18,7 @@
VOID
EFIAPI
AsmWriteMm3 (
- IN UINT64 Value
+ IN UINT64 Value
)
{
_asm {
@@ -29,4 +26,3 @@ AsmWriteMm3 (
emms
}
}
-
diff --git a/MdePkg/Library/BaseLib/Ia32/WriteMm4.c b/MdePkg/Library/BaseLib/Ia32/WriteMm4.c
index 2fce554974..8a4728e594 100644
--- a/MdePkg/Library/BaseLib/Ia32/WriteMm4.c
+++ b/MdePkg/Library/BaseLib/Ia32/WriteMm4.c
@@ -6,9 +6,6 @@
**/
-
-
-
/**
Writes the current value of 64-bit MMX Register #4 (MM4).
@@ -21,7 +18,7 @@
VOID
EFIAPI
AsmWriteMm4 (
- IN UINT64 Value
+ IN UINT64 Value
)
{
_asm {
diff --git a/MdePkg/Library/BaseLib/Ia32/WriteMm5.c b/MdePkg/Library/BaseLib/Ia32/WriteMm5.c
index a0ec714e30..1c4adc0feb 100644
--- a/MdePkg/Library/BaseLib/Ia32/WriteMm5.c
+++ b/MdePkg/Library/BaseLib/Ia32/WriteMm5.c
@@ -6,9 +6,6 @@
**/
-
-
-
/**
Writes the current value of 64-bit MMX Register #5 (MM5).
@@ -21,7 +18,7 @@
VOID
EFIAPI
AsmWriteMm5 (
- IN UINT64 Value
+ IN UINT64 Value
)
{
_asm {
diff --git a/MdePkg/Library/BaseLib/Ia32/WriteMm6.c b/MdePkg/Library/BaseLib/Ia32/WriteMm6.c
index c3b57b4b51..8023fc05d7 100644
--- a/MdePkg/Library/BaseLib/Ia32/WriteMm6.c
+++ b/MdePkg/Library/BaseLib/Ia32/WriteMm6.c
@@ -6,9 +6,6 @@
**/
-
-
-
/**
Writes the current value of 64-bit MMX Register #6 (MM6).
@@ -21,7 +18,7 @@
VOID
EFIAPI
AsmWriteMm6 (
- IN UINT64 Value
+ IN UINT64 Value
)
{
_asm {
@@ -29,4 +26,3 @@ AsmWriteMm6 (
emms
}
}
-
diff --git a/MdePkg/Library/BaseLib/Ia32/WriteMm7.c b/MdePkg/Library/BaseLib/Ia32/WriteMm7.c
index e1e8932458..0b0fc44c71 100644
--- a/MdePkg/Library/BaseLib/Ia32/WriteMm7.c
+++ b/MdePkg/Library/BaseLib/Ia32/WriteMm7.c
@@ -6,9 +6,6 @@
**/
-
-
-
/**
Writes the current value of 64-bit MMX Register #7 (MM7).
@@ -21,7 +18,7 @@
VOID
EFIAPI
AsmWriteMm7 (
- IN UINT64 Value
+ IN UINT64 Value
)
{
_asm {
@@ -29,4 +26,3 @@ AsmWriteMm7 (
emms
}
}
-
diff --git a/MdePkg/Library/BaseLib/Ia32/WriteMsr64.c b/MdePkg/Library/BaseLib/Ia32/WriteMsr64.c
index ba0cf3f74c..e8e49212f1 100644
--- a/MdePkg/Library/BaseLib/Ia32/WriteMsr64.c
+++ b/MdePkg/Library/BaseLib/Ia32/WriteMsr64.c
@@ -6,7 +6,6 @@
**/
-
#include <Library/RegisterFilterLib.h>
/**
@@ -33,7 +32,7 @@ AsmWriteMsr64 (
IN UINT64 Value
)
{
- BOOLEAN Flag;
+ BOOLEAN Flag;
Flag = FilterBeforeMsrWrite (Index, &Value);
if (Flag) {
@@ -44,8 +43,8 @@ AsmWriteMsr64 (
wrmsr
}
}
+
FilterAfterMsrWrite (Index, &Value);
return Value;
}
-
diff --git a/MdePkg/Library/BaseLib/LRotU32.c b/MdePkg/Library/BaseLib/LRotU32.c
index 4e671a320c..e9f4790d5b 100644
--- a/MdePkg/Library/BaseLib/LRotU32.c
+++ b/MdePkg/Library/BaseLib/LRotU32.c
@@ -27,8 +27,8 @@
UINT32
EFIAPI
LRotU32 (
- IN UINT32 Operand,
- IN UINTN Count
+ IN UINT32 Operand,
+ IN UINTN Count
)
{
ASSERT (Count < 32);
diff --git a/MdePkg/Library/BaseLib/LRotU64.c b/MdePkg/Library/BaseLib/LRotU64.c
index 48f35dc63a..aa6a9a2251 100644
--- a/MdePkg/Library/BaseLib/LRotU64.c
+++ b/MdePkg/Library/BaseLib/LRotU64.c
@@ -27,8 +27,8 @@
UINT64
EFIAPI
LRotU64 (
- IN UINT64 Operand,
- IN UINTN Count
+ IN UINT64 Operand,
+ IN UINTN Count
)
{
ASSERT (Count < 64);
diff --git a/MdePkg/Library/BaseLib/LShiftU64.c b/MdePkg/Library/BaseLib/LShiftU64.c
index 7b41a3efba..ce613c601b 100644
--- a/MdePkg/Library/BaseLib/LShiftU64.c
+++ b/MdePkg/Library/BaseLib/LShiftU64.c
@@ -26,8 +26,8 @@
UINT64
EFIAPI
LShiftU64 (
- IN UINT64 Operand,
- IN UINTN Count
+ IN UINT64 Operand,
+ IN UINTN Count
)
{
ASSERT (Count < 64);
diff --git a/MdePkg/Library/BaseLib/LinkedList.c b/MdePkg/Library/BaseLib/LinkedList.c
index 5648c18771..3aa20ef8a1 100644
--- a/MdePkg/Library/BaseLib/LinkedList.c
+++ b/MdePkg/Library/BaseLib/LinkedList.c
@@ -28,7 +28,7 @@
**/
#if !defined (MDEPKG_NDEBUG)
- #define ASSERT_VERIFY_NODE_IN_VALID_LIST(FirstEntry, SecondEntry, InList) \
+#define ASSERT_VERIFY_NODE_IN_VALID_LIST(FirstEntry, SecondEntry, InList) \
do { \
if (FeaturePcdGet (PcdVerifyNodeInList)) { \
ASSERT (InList == IsNodeInList ((FirstEntry), (SecondEntry))); \
@@ -37,7 +37,7 @@
} \
} while (FALSE)
#else
- #define ASSERT_VERIFY_NODE_IN_VALID_LIST(FirstEntry, SecondEntry, InList)
+#define ASSERT_VERIFY_NODE_IN_VALID_LIST(FirstEntry, SecondEntry, InList)
#endif
/**
@@ -119,8 +119,8 @@ InternalBaseLibIsListValid (
BOOLEAN
EFIAPI
IsNodeInList (
- IN CONST LIST_ENTRY *FirstEntry,
- IN CONST LIST_ENTRY *SecondEntry
+ IN CONST LIST_ENTRY *FirstEntry,
+ IN CONST LIST_ENTRY *SecondEntry
)
{
UINTN Count;
@@ -180,14 +180,14 @@ IsNodeInList (
LIST_ENTRY *
EFIAPI
InitializeListHead (
- IN OUT LIST_ENTRY *ListHead
+ IN OUT LIST_ENTRY *ListHead
)
{
ASSERT (ListHead != NULL);
ListHead->ForwardLink = ListHead;
- ListHead->BackLink = ListHead;
+ ListHead->BackLink = ListHead;
return ListHead;
}
@@ -216,8 +216,8 @@ InitializeListHead (
LIST_ENTRY *
EFIAPI
InsertHeadList (
- IN OUT LIST_ENTRY *ListHead,
- IN OUT LIST_ENTRY *Entry
+ IN OUT LIST_ENTRY *ListHead,
+ IN OUT LIST_ENTRY *Entry
)
{
//
@@ -225,10 +225,10 @@ InsertHeadList (
//
ASSERT_VERIFY_NODE_IN_VALID_LIST (ListHead, Entry, FALSE);
- Entry->ForwardLink = ListHead->ForwardLink;
- Entry->BackLink = ListHead;
+ Entry->ForwardLink = ListHead->ForwardLink;
+ Entry->BackLink = ListHead;
Entry->ForwardLink->BackLink = Entry;
- ListHead->ForwardLink = Entry;
+ ListHead->ForwardLink = Entry;
return ListHead;
}
@@ -257,8 +257,8 @@ InsertHeadList (
LIST_ENTRY *
EFIAPI
InsertTailList (
- IN OUT LIST_ENTRY *ListHead,
- IN OUT LIST_ENTRY *Entry
+ IN OUT LIST_ENTRY *ListHead,
+ IN OUT LIST_ENTRY *Entry
)
{
//
@@ -266,10 +266,10 @@ InsertTailList (
//
ASSERT_VERIFY_NODE_IN_VALID_LIST (ListHead, Entry, FALSE);
- Entry->ForwardLink = ListHead;
- Entry->BackLink = ListHead->BackLink;
+ Entry->ForwardLink = ListHead;
+ Entry->BackLink = ListHead->BackLink;
Entry->BackLink->ForwardLink = Entry;
- ListHead->BackLink = Entry;
+ ListHead->BackLink = Entry;
return ListHead;
}
@@ -296,7 +296,7 @@ InsertTailList (
LIST_ENTRY *
EFIAPI
GetFirstNode (
- IN CONST LIST_ENTRY *List
+ IN CONST LIST_ENTRY *List
)
{
//
@@ -331,8 +331,8 @@ GetFirstNode (
LIST_ENTRY *
EFIAPI
GetNextNode (
- IN CONST LIST_ENTRY *List,
- IN CONST LIST_ENTRY *Node
+ IN CONST LIST_ENTRY *List,
+ IN CONST LIST_ENTRY *Node
)
{
//
@@ -367,8 +367,8 @@ GetNextNode (
LIST_ENTRY *
EFIAPI
GetPreviousNode (
- IN CONST LIST_ENTRY *List,
- IN CONST LIST_ENTRY *Node
+ IN CONST LIST_ENTRY *List,
+ IN CONST LIST_ENTRY *Node
)
{
//
@@ -401,7 +401,7 @@ GetPreviousNode (
BOOLEAN
EFIAPI
IsListEmpty (
- IN CONST LIST_ENTRY *ListHead
+ IN CONST LIST_ENTRY *ListHead
)
{
//
@@ -441,8 +441,8 @@ IsListEmpty (
BOOLEAN
EFIAPI
IsNull (
- IN CONST LIST_ENTRY *List,
- IN CONST LIST_ENTRY *Node
+ IN CONST LIST_ENTRY *List,
+ IN CONST LIST_ENTRY *Node
)
{
//
@@ -479,8 +479,8 @@ IsNull (
BOOLEAN
EFIAPI
IsNodeAtEnd (
- IN CONST LIST_ENTRY *List,
- IN CONST LIST_ENTRY *Node
+ IN CONST LIST_ENTRY *List,
+ IN CONST LIST_ENTRY *Node
)
{
//
@@ -520,11 +520,11 @@ IsNodeAtEnd (
LIST_ENTRY *
EFIAPI
SwapListEntries (
- IN OUT LIST_ENTRY *FirstEntry,
- IN OUT LIST_ENTRY *SecondEntry
+ IN OUT LIST_ENTRY *FirstEntry,
+ IN OUT LIST_ENTRY *SecondEntry
)
{
- LIST_ENTRY *Ptr;
+ LIST_ENTRY *Ptr;
if (FirstEntry == SecondEntry) {
return SecondEntry;
@@ -588,7 +588,7 @@ SwapListEntries (
LIST_ENTRY *
EFIAPI
RemoveEntryList (
- IN CONST LIST_ENTRY *Entry
+ IN CONST LIST_ENTRY *Entry
)
{
ASSERT (!IsListEmpty (Entry));
diff --git a/MdePkg/Library/BaseLib/LongJump.c b/MdePkg/Library/BaseLib/LongJump.c
index 1d88e41213..a34f89e7a8 100644
--- a/MdePkg/Library/BaseLib/LongJump.c
+++ b/MdePkg/Library/BaseLib/LongJump.c
@@ -6,9 +6,6 @@
**/
-
-
-
#include "BaseLibInternals.h"
/**
diff --git a/MdePkg/Library/BaseLib/LowBitSet32.c b/MdePkg/Library/BaseLib/LowBitSet32.c
index 8383c7954c..52714314dd 100644
--- a/MdePkg/Library/BaseLib/LowBitSet32.c
+++ b/MdePkg/Library/BaseLib/LowBitSet32.c
@@ -6,9 +6,6 @@
**/
-
-
-
#include "BaseLibInternals.h"
/**
@@ -27,15 +24,17 @@
INTN
EFIAPI
LowBitSet32 (
- IN UINT32 Operand
+ IN UINT32 Operand
)
{
- INTN BitIndex;
+ INTN BitIndex;
if (Operand == 0) {
return -1;
}
- for (BitIndex = 0; 0 == (Operand & 1); BitIndex++, Operand >>= 1);
+ for (BitIndex = 0; 0 == (Operand & 1); BitIndex++, Operand >>= 1) {
+ }
+
return BitIndex;
}
diff --git a/MdePkg/Library/BaseLib/LowBitSet64.c b/MdePkg/Library/BaseLib/LowBitSet64.c
index 349ed526be..c1bc16c596 100644
--- a/MdePkg/Library/BaseLib/LowBitSet64.c
+++ b/MdePkg/Library/BaseLib/LowBitSet64.c
@@ -6,9 +6,6 @@
**/
-
-
-
#include "BaseLibInternals.h"
/**
@@ -28,10 +25,10 @@
INTN
EFIAPI
LowBitSet64 (
- IN UINT64 Operand
+ IN UINT64 Operand
)
{
- INTN BitIndex;
+ INTN BitIndex;
if (Operand == 0) {
return -1;
@@ -39,6 +36,9 @@ LowBitSet64 (
for (BitIndex = 0;
(Operand & 1) == 0;
- BitIndex++, Operand = RShiftU64 (Operand, 1));
+ BitIndex++, Operand = RShiftU64 (Operand, 1))
+ {
+ }
+
return BitIndex;
}
diff --git a/MdePkg/Library/BaseLib/Math64.c b/MdePkg/Library/BaseLib/Math64.c
index 154b97ae79..5756d0fe92 100644
--- a/MdePkg/Library/BaseLib/Math64.c
+++ b/MdePkg/Library/BaseLib/Math64.c
@@ -25,8 +25,8 @@
UINT64
EFIAPI
InternalMathLShiftU64 (
- IN UINT64 Operand,
- IN UINTN Count
+ IN UINT64 Operand,
+ IN UINTN Count
)
{
return Operand << Count;
@@ -48,8 +48,8 @@ InternalMathLShiftU64 (
UINT64
EFIAPI
InternalMathRShiftU64 (
- IN UINT64 Operand,
- IN UINTN Count
+ IN UINT64 Operand,
+ IN UINTN Count
)
{
return Operand >> Count;
@@ -71,8 +71,8 @@ InternalMathRShiftU64 (
UINT64
EFIAPI
InternalMathARShiftU64 (
- IN UINT64 Operand,
- IN UINTN Count
+ IN UINT64 Operand,
+ IN UINTN Count
)
{
INTN TestValue;
@@ -95,7 +95,6 @@ InternalMathARShiftU64 (
((INTN)Operand < 0 ? ~((UINTN)-1 >> Count) : 0);
}
-
/**
Rotates a 64-bit integer left between 0 and 63 bits, filling
the low bits with the high bits that were rotated.
@@ -113,8 +112,8 @@ InternalMathARShiftU64 (
UINT64
EFIAPI
InternalMathLRotU64 (
- IN UINT64 Operand,
- IN UINTN Count
+ IN UINT64 Operand,
+ IN UINTN Count
)
{
return (Operand << Count) | (Operand >> (64 - Count));
@@ -137,8 +136,8 @@ InternalMathLRotU64 (
UINT64
EFIAPI
InternalMathRRotU64 (
- IN UINT64 Operand,
- IN UINTN Count
+ IN UINT64 Operand,
+ IN UINTN Count
)
{
return (Operand >> Count) | (Operand << (64 - Count));
@@ -159,14 +158,14 @@ InternalMathRRotU64 (
UINT64
EFIAPI
InternalMathSwapBytes64 (
- IN UINT64 Operand
+ IN UINT64 Operand
)
{
UINT64 LowerBytes;
UINT64 HigherBytes;
- LowerBytes = (UINT64) SwapBytes32 ((UINT32) Operand);
- HigherBytes = (UINT64) SwapBytes32 ((UINT32) (Operand >> 32));
+ LowerBytes = (UINT64)SwapBytes32 ((UINT32)Operand);
+ HigherBytes = (UINT64)SwapBytes32 ((UINT32)(Operand >> 32));
return (LowerBytes << 32 | HigherBytes);
}
@@ -188,14 +187,13 @@ InternalMathSwapBytes64 (
UINT64
EFIAPI
InternalMathMultU64x32 (
- IN UINT64 Multiplicand,
- IN UINT32 Multiplier
+ IN UINT64 Multiplicand,
+ IN UINT32 Multiplier
)
{
return Multiplicand * Multiplier;
}
-
/**
Multiplies a 64-bit unsigned integer by a 64-bit unsigned integer
and generates a 64-bit unsigned result.
@@ -213,8 +211,8 @@ InternalMathMultU64x32 (
UINT64
EFIAPI
InternalMathMultU64x64 (
- IN UINT64 Multiplicand,
- IN UINT64 Multiplier
+ IN UINT64 Multiplicand,
+ IN UINT64 Multiplier
)
{
return Multiplicand * Multiplier;
@@ -237,8 +235,8 @@ InternalMathMultU64x64 (
UINT64
EFIAPI
InternalMathDivU64x32 (
- IN UINT64 Dividend,
- IN UINT32 Divisor
+ IN UINT64 Dividend,
+ IN UINT32 Divisor
)
{
return Dividend / Divisor;
@@ -261,8 +259,8 @@ InternalMathDivU64x32 (
UINT32
EFIAPI
InternalMathModU64x32 (
- IN UINT64 Dividend,
- IN UINT32 Divisor
+ IN UINT64 Dividend,
+ IN UINT32 Divisor
)
{
return (UINT32)(Dividend % Divisor);
@@ -288,14 +286,15 @@ InternalMathModU64x32 (
UINT64
EFIAPI
InternalMathDivRemU64x32 (
- IN UINT64 Dividend,
- IN UINT32 Divisor,
- OUT UINT32 *Remainder OPTIONAL
+ IN UINT64 Dividend,
+ IN UINT32 Divisor,
+ OUT UINT32 *Remainder OPTIONAL
)
{
if (Remainder != NULL) {
*Remainder = (UINT32)(Dividend % Divisor);
}
+
return Dividend / Divisor;
}
@@ -319,14 +318,15 @@ InternalMathDivRemU64x32 (
UINT64
EFIAPI
InternalMathDivRemU64x64 (
- IN UINT64 Dividend,
- IN UINT64 Divisor,
- OUT UINT64 *Remainder OPTIONAL
+ IN UINT64 Dividend,
+ IN UINT64 Divisor,
+ OUT UINT64 *Remainder OPTIONAL
)
{
if (Remainder != NULL) {
*Remainder = Dividend % Divisor;
}
+
return Dividend / Divisor;
}
@@ -350,13 +350,14 @@ InternalMathDivRemU64x64 (
INT64
EFIAPI
InternalMathDivRemS64x64 (
- IN INT64 Dividend,
- IN INT64 Divisor,
- OUT INT64 *Remainder OPTIONAL
+ IN INT64 Dividend,
+ IN INT64 Divisor,
+ OUT INT64 *Remainder OPTIONAL
)
{
if (Remainder != NULL) {
*Remainder = Dividend % Divisor;
}
+
return Dividend / Divisor;
}
diff --git a/MdePkg/Library/BaseLib/ModU64x32.c b/MdePkg/Library/BaseLib/ModU64x32.c
index ee99ab3223..bfdbf8bbed 100644
--- a/MdePkg/Library/BaseLib/ModU64x32.c
+++ b/MdePkg/Library/BaseLib/ModU64x32.c
@@ -6,9 +6,6 @@
**/
-
-
-
#include "BaseLibInternals.h"
/**
@@ -30,8 +27,8 @@
UINT32
EFIAPI
ModU64x32 (
- IN UINT64 Dividend,
- IN UINT32 Divisor
+ IN UINT64 Dividend,
+ IN UINT32 Divisor
)
{
ASSERT (Divisor != 0);
diff --git a/MdePkg/Library/BaseLib/MultS64x64.c b/MdePkg/Library/BaseLib/MultS64x64.c
index b5c745f7c5..e9db474974 100644
--- a/MdePkg/Library/BaseLib/MultS64x64.c
+++ b/MdePkg/Library/BaseLib/MultS64x64.c
@@ -6,9 +6,6 @@
**/
-
-
-
#include "BaseLibInternals.h"
/**
@@ -28,9 +25,9 @@
INT64
EFIAPI
MultS64x64 (
- IN INT64 Multiplicand,
- IN INT64 Multiplier
+ IN INT64 Multiplicand,
+ IN INT64 Multiplier
)
{
- return (INT64)MultU64x64 ((UINT64) Multiplicand, (UINT64) Multiplier);
+ return (INT64)MultU64x64 ((UINT64)Multiplicand, (UINT64)Multiplier);
}
diff --git a/MdePkg/Library/BaseLib/MultU64x32.c b/MdePkg/Library/BaseLib/MultU64x32.c
index 2bbff51c82..f4c65f8c73 100644
--- a/MdePkg/Library/BaseLib/MultU64x32.c
+++ b/MdePkg/Library/BaseLib/MultU64x32.c
@@ -6,9 +6,6 @@
**/
-
-
-
#include "BaseLibInternals.h"
/**
@@ -28,11 +25,11 @@
UINT64
EFIAPI
MultU64x32 (
- IN UINT64 Multiplicand,
- IN UINT32 Multiplier
+ IN UINT64 Multiplicand,
+ IN UINT32 Multiplier
)
{
- UINT64 Result;
+ UINT64 Result;
Result = InternalMathMultU64x32 (Multiplicand, Multiplier);
diff --git a/MdePkg/Library/BaseLib/MultU64x64.c b/MdePkg/Library/BaseLib/MultU64x64.c
index e1ee9f1c9c..90dea81856 100644
--- a/MdePkg/Library/BaseLib/MultU64x64.c
+++ b/MdePkg/Library/BaseLib/MultU64x64.c
@@ -6,9 +6,6 @@
**/
-
-
-
#include "BaseLibInternals.h"
/**
@@ -28,11 +25,11 @@
UINT64
EFIAPI
MultU64x64 (
- IN UINT64 Multiplicand,
- IN UINT64 Multiplier
+ IN UINT64 Multiplicand,
+ IN UINT64 Multiplier
)
{
- UINT64 Result;
+ UINT64 Result;
Result = InternalMathMultU64x64 (Multiplicand, Multiplier);
diff --git a/MdePkg/Library/BaseLib/QuickSort.c b/MdePkg/Library/BaseLib/QuickSort.c
index a825c072b0..d9f0e9a0f4 100644
--- a/MdePkg/Library/BaseLib/QuickSort.c
+++ b/MdePkg/Library/BaseLib/QuickSort.c
@@ -34,16 +34,16 @@
VOID
EFIAPI
QuickSort (
- IN OUT VOID *BufferToSort,
- IN CONST UINTN Count,
- IN CONST UINTN ElementSize,
- IN BASE_SORT_COMPARE CompareFunction,
- OUT VOID *BufferOneElement
+ IN OUT VOID *BufferToSort,
+ IN CONST UINTN Count,
+ IN CONST UINTN ElementSize,
+ IN BASE_SORT_COMPARE CompareFunction,
+ OUT VOID *BufferOneElement
)
{
- VOID *Pivot;
- UINTN LoopCount;
- UINTN NextSwapLocation;
+ VOID *Pivot;
+ UINTN LoopCount;
+ UINTN NextSwapLocation;
ASSERT (BufferToSort != NULL);
ASSERT (CompareFunction != NULL);
@@ -59,7 +59,7 @@ QuickSort (
//
// pick a pivot (we choose last element)
//
- Pivot = ((UINT8*) BufferToSort + ((Count - 1) * ElementSize));
+ Pivot = ((UINT8 *)BufferToSort + ((Count - 1) * ElementSize));
//
// Now get the pivot such that all on "left" are below it
@@ -69,13 +69,13 @@ QuickSort (
//
// if the element is less than or equal to the pivot
//
- if (CompareFunction ((VOID*) ((UINT8*) BufferToSort + ((LoopCount) * ElementSize)), Pivot) <= 0){
+ if (CompareFunction ((VOID *)((UINT8 *)BufferToSort + ((LoopCount) * ElementSize)), Pivot) <= 0) {
//
// swap
//
- CopyMem (BufferOneElement, (UINT8*) BufferToSort + (NextSwapLocation * ElementSize), ElementSize);
- CopyMem ((UINT8*) BufferToSort + (NextSwapLocation * ElementSize), (UINT8*) BufferToSort + ((LoopCount) * ElementSize), ElementSize);
- CopyMem ((UINT8*) BufferToSort + ((LoopCount)*ElementSize), BufferOneElement, ElementSize);
+ CopyMem (BufferOneElement, (UINT8 *)BufferToSort + (NextSwapLocation * ElementSize), ElementSize);
+ CopyMem ((UINT8 *)BufferToSort + (NextSwapLocation * ElementSize), (UINT8 *)BufferToSort + ((LoopCount) * ElementSize), ElementSize);
+ CopyMem ((UINT8 *)BufferToSort + ((LoopCount)*ElementSize), BufferOneElement, ElementSize);
//
// increment NextSwapLocation
@@ -83,12 +83,13 @@ QuickSort (
NextSwapLocation++;
}
}
+
//
// swap pivot to it's final position (NextSwapLocation)
//
CopyMem (BufferOneElement, Pivot, ElementSize);
- CopyMem (Pivot, (UINT8*) BufferToSort + (NextSwapLocation * ElementSize), ElementSize);
- CopyMem ((UINT8*) BufferToSort + (NextSwapLocation * ElementSize), BufferOneElement, ElementSize);
+ CopyMem (Pivot, (UINT8 *)BufferToSort + (NextSwapLocation * ElementSize), ElementSize);
+ CopyMem ((UINT8 *)BufferToSort + (NextSwapLocation * ElementSize), BufferOneElement, ElementSize);
//
// Now recurse on 2 partial lists. neither of these will have the 'pivot' element
diff --git a/MdePkg/Library/BaseLib/RRotU32.c b/MdePkg/Library/BaseLib/RRotU32.c
index 3956fadddd..909168fac4 100644
--- a/MdePkg/Library/BaseLib/RRotU32.c
+++ b/MdePkg/Library/BaseLib/RRotU32.c
@@ -27,8 +27,8 @@
UINT32
EFIAPI
RRotU32 (
- IN UINT32 Operand,
- IN UINTN Count
+ IN UINT32 Operand,
+ IN UINTN Count
)
{
ASSERT (Count < 32);
diff --git a/MdePkg/Library/BaseLib/RRotU64.c b/MdePkg/Library/BaseLib/RRotU64.c
index e07ffd656b..f75c7355c7 100644
--- a/MdePkg/Library/BaseLib/RRotU64.c
+++ b/MdePkg/Library/BaseLib/RRotU64.c
@@ -27,8 +27,8 @@
UINT64
EFIAPI
RRotU64 (
- IN UINT64 Operand,
- IN UINTN Count
+ IN UINT64 Operand,
+ IN UINTN Count
)
{
ASSERT (Count < 64);
diff --git a/MdePkg/Library/BaseLib/RShiftU64.c b/MdePkg/Library/BaseLib/RShiftU64.c
index 20f94f7741..2ae24b3fe8 100644
--- a/MdePkg/Library/BaseLib/RShiftU64.c
+++ b/MdePkg/Library/BaseLib/RShiftU64.c
@@ -26,8 +26,8 @@
UINT64
EFIAPI
RShiftU64 (
- IN UINT64 Operand,
- IN UINTN Count
+ IN UINT64 Operand,
+ IN UINTN Count
)
{
ASSERT (Count < 64);
diff --git a/MdePkg/Library/BaseLib/RiscV64/CpuBreakpoint.c b/MdePkg/Library/BaseLib/RiscV64/CpuBreakpoint.c
index 88d0877a2f..6274cbcfaa 100644
--- a/MdePkg/Library/BaseLib/RiscV64/CpuBreakpoint.c
+++ b/MdePkg/Library/BaseLib/RiscV64/CpuBreakpoint.c
@@ -8,7 +8,10 @@
#include "BaseLibInternals.h"
-extern VOID RiscVCpuBreakpoint (VOID);
+extern VOID
+RiscVCpuBreakpoint (
+ VOID
+ );
/**
Generates a breakpoint on the CPU.
diff --git a/MdePkg/Library/BaseLib/RiscV64/CpuPause.c b/MdePkg/Library/BaseLib/RiscV64/CpuPause.c
index 9931bad294..687d68e3ec 100644
--- a/MdePkg/Library/BaseLib/RiscV64/CpuPause.c
+++ b/MdePkg/Library/BaseLib/RiscV64/CpuPause.c
@@ -8,8 +8,10 @@
#include "BaseLibInternals.h"
-extern VOID RiscVCpuPause (VOID);
-
+extern VOID
+RiscVCpuPause (
+ VOID
+ );
/**
Requests CPU to pause for a short period of time.
@@ -26,4 +28,3 @@ CpuPause (
{
RiscVCpuPause ();
}
-
diff --git a/MdePkg/Library/BaseLib/RiscV64/DisableInterrupts.c b/MdePkg/Library/BaseLib/RiscV64/DisableInterrupts.c
index 867086c09c..47aab90547 100644
--- a/MdePkg/Library/BaseLib/RiscV64/DisableInterrupts.c
+++ b/MdePkg/Library/BaseLib/RiscV64/DisableInterrupts.c
@@ -7,7 +7,10 @@
**/
#include "BaseLibInternals.h"
-extern VOID RiscVDisableSupervisorModeInterrupts (VOID);
+extern VOID
+RiscVDisableSupervisorModeInterrupts (
+ VOID
+ );
/**
Disables CPU interrupts.
@@ -21,4 +24,3 @@ DisableInterrupts (
{
RiscVDisableSupervisorModeInterrupts ();
}
-
diff --git a/MdePkg/Library/BaseLib/RiscV64/EnableInterrupts.c b/MdePkg/Library/BaseLib/RiscV64/EnableInterrupts.c
index 22ef73067e..7514d31848 100644
--- a/MdePkg/Library/BaseLib/RiscV64/EnableInterrupts.c
+++ b/MdePkg/Library/BaseLib/RiscV64/EnableInterrupts.c
@@ -8,7 +8,10 @@
#include "BaseLibInternals.h"
-extern VOID RiscVEnableSupervisorModeInterrupt (VOID);
+extern VOID
+RiscVEnableSupervisorModeInterrupt (
+ VOID
+ );
/**
Enables CPU interrupts.
@@ -22,4 +25,3 @@ EnableInterrupts (
{
RiscVEnableSupervisorModeInterrupt ();
}
-
diff --git a/MdePkg/Library/BaseLib/RiscV64/GetInterruptState.c b/MdePkg/Library/BaseLib/RiscV64/GetInterruptState.c
index 292f1ec441..1aa863d145 100644
--- a/MdePkg/Library/BaseLib/RiscV64/GetInterruptState.c
+++ b/MdePkg/Library/BaseLib/RiscV64/GetInterruptState.c
@@ -8,7 +8,10 @@
#include "BaseLibInternals.h"
-extern UINT32 RiscVGetSupervisorModeInterrupts (VOID);
+extern UINT32
+RiscVGetSupervisorModeInterrupts (
+ VOID
+ );
/**
Retrieves the current CPU interrupt state.
@@ -26,10 +29,8 @@ GetInterruptState (
VOID
)
{
- unsigned long RetValue;
+ unsigned long RetValue;
RetValue = RiscVGetSupervisorModeInterrupts ();
- return RetValue? TRUE: FALSE;
+ return RetValue ? TRUE : FALSE;
}
-
-
diff --git a/MdePkg/Library/BaseLib/RiscV64/InternalSwitchStack.c b/MdePkg/Library/BaseLib/RiscV64/InternalSwitchStack.c
index ed84cdfa94..cf646e498a 100644
--- a/MdePkg/Library/BaseLib/RiscV64/InternalSwitchStack.c
+++ b/MdePkg/Library/BaseLib/RiscV64/InternalSwitchStack.c
@@ -44,12 +44,18 @@ InternalSwitchStack (
{
BASE_LIBRARY_JUMP_BUFFER JumpBuffer;
- DEBUG ((DEBUG_INFO, "RISC-V InternalSwitchStack Entry:%x Context1:%x Context2:%x NewStack%x\n", \
- EntryPoint, Context1, Context2, NewStack));
+ DEBUG ((
+ DEBUG_INFO,
+ "RISC-V InternalSwitchStack Entry:%x Context1:%x Context2:%x NewStack%x\n", \
+ EntryPoint,
+ Context1,
+ Context2,
+ NewStack
+ ));
JumpBuffer.RA = (UINTN)EntryPoint;
JumpBuffer.SP = (UINTN)NewStack - sizeof (VOID *);
JumpBuffer.S0 = (UINT64)(UINTN)Context1;
JumpBuffer.S1 = (UINT64)(UINTN)Context2;
LongJump (&JumpBuffer, (UINTN)-1);
- ASSERT(FALSE);
+ ASSERT (FALSE);
}
diff --git a/MdePkg/Library/BaseLib/SafeString.c b/MdePkg/Library/BaseLib/SafeString.c
index 149a9c04ba..f338a32a3a 100644
--- a/MdePkg/Library/BaseLib/SafeString.c
+++ b/MdePkg/Library/BaseLib/SafeString.c
@@ -35,16 +35,18 @@
**/
BOOLEAN
InternalSafeStringIsOverlap (
- IN VOID *Base1,
- IN UINTN Size1,
- IN VOID *Base2,
- IN UINTN Size2
+ IN VOID *Base1,
+ IN UINTN Size1,
+ IN VOID *Base2,
+ IN UINTN Size2
)
{
if ((((UINTN)Base1 >= (UINTN)Base2) && ((UINTN)Base1 < (UINTN)Base2 + Size2)) ||
- (((UINTN)Base2 >= (UINTN)Base1) && ((UINTN)Base2 < (UINTN)Base1 + Size1))) {
+ (((UINTN)Base2 >= (UINTN)Base1) && ((UINTN)Base2 < (UINTN)Base1 + Size1)))
+ {
return TRUE;
}
+
return FALSE;
}
@@ -69,7 +71,7 @@ InternalSafeStringNoStrOverlap (
IN UINTN Size2
)
{
- return !InternalSafeStringIsOverlap (Str1, Size1 * sizeof(CHAR16), Str2, Size2 * sizeof(CHAR16));
+ return !InternalSafeStringIsOverlap (Str1, Size1 * sizeof (CHAR16), Str2, Size2 * sizeof (CHAR16));
}
/**
@@ -87,10 +89,10 @@ InternalSafeStringNoStrOverlap (
**/
BOOLEAN
InternalSafeStringNoAsciiStrOverlap (
- IN CHAR8 *Str1,
- IN UINTN Size1,
- IN CHAR8 *Str2,
- IN UINTN Size2
+ IN CHAR8 *Str1,
+ IN UINTN Size1,
+ IN CHAR8 *Str2,
+ IN UINTN Size2
)
{
return !InternalSafeStringIsOverlap (Str1, Size1, Str2, Size2);
@@ -115,13 +117,13 @@ InternalSafeStringNoAsciiStrOverlap (
UINTN
EFIAPI
StrnLenS (
- IN CONST CHAR16 *String,
- IN UINTN MaxSize
+ IN CONST CHAR16 *String,
+ IN UINTN MaxSize
)
{
- UINTN Length;
+ UINTN Length;
- ASSERT (((UINTN) String & BIT0) == 0);
+ ASSERT (((UINTN)String & BIT0) == 0);
//
// If String is a null pointer or MaxSize is 0, then the StrnLenS function returns zero.
@@ -141,8 +143,10 @@ StrnLenS (
if (Length >= MaxSize - 1) {
return MaxSize;
}
+
Length++;
}
+
return Length;
}
@@ -170,8 +174,8 @@ StrnLenS (
UINTN
EFIAPI
StrnSizeS (
- IN CONST CHAR16 *String,
- IN UINTN MaxSize
+ IN CONST CHAR16 *String,
+ IN UINTN MaxSize
)
{
//
@@ -220,15 +224,15 @@ StrnSizeS (
RETURN_STATUS
EFIAPI
StrCpyS (
- OUT CHAR16 *Destination,
- IN UINTN DestMax,
- IN CONST CHAR16 *Source
+ OUT CHAR16 *Destination,
+ IN UINTN DestMax,
+ IN CONST CHAR16 *Source
)
{
- UINTN SourceLen;
+ UINTN SourceLen;
- ASSERT (((UINTN) Destination & BIT0) == 0);
- ASSERT (((UINTN) Source & BIT0) == 0);
+ ASSERT (((UINTN)Destination & BIT0) == 0);
+ ASSERT (((UINTN)Source & BIT0) == 0);
//
// 1. Neither Destination nor Source shall be a null pointer.
@@ -266,6 +270,7 @@ StrCpyS (
while (*Source != 0) {
*(Destination++) = *(Source++);
}
+
*Destination = 0;
return RETURN_SUCCESS;
@@ -303,16 +308,16 @@ StrCpyS (
RETURN_STATUS
EFIAPI
StrnCpyS (
- OUT CHAR16 *Destination,
- IN UINTN DestMax,
- IN CONST CHAR16 *Source,
- IN UINTN Length
+ OUT CHAR16 *Destination,
+ IN UINTN DestMax,
+ IN CONST CHAR16 *Source,
+ IN UINTN Length
)
{
- UINTN SourceLen;
+ UINTN SourceLen;
- ASSERT (((UINTN) Destination & BIT0) == 0);
- ASSERT (((UINTN) Source & BIT0) == 0);
+ ASSERT (((UINTN)Destination & BIT0) == 0);
+ ASSERT (((UINTN)Source & BIT0) == 0);
//
// 1. Neither Destination nor Source shall be a null pointer.
@@ -347,6 +352,7 @@ StrnCpyS (
if (SourceLen > Length) {
SourceLen = Length;
}
+
SAFE_STRING_CONSTRAINT_CHECK (InternalSafeStringNoStrOverlap (Destination, DestMax, (CHAR16 *)Source, SourceLen + 1), RETURN_ACCESS_DENIED);
//
@@ -359,6 +365,7 @@ StrnCpyS (
*(Destination++) = *(Source++);
SourceLen--;
}
+
*Destination = 0;
return RETURN_SUCCESS;
@@ -396,17 +403,17 @@ StrnCpyS (
RETURN_STATUS
EFIAPI
StrCatS (
- IN OUT CHAR16 *Destination,
- IN UINTN DestMax,
- IN CONST CHAR16 *Source
+ IN OUT CHAR16 *Destination,
+ IN UINTN DestMax,
+ IN CONST CHAR16 *Source
)
{
- UINTN DestLen;
- UINTN CopyLen;
- UINTN SourceLen;
+ UINTN DestLen;
+ UINTN CopyLen;
+ UINTN SourceLen;
- ASSERT (((UINTN) Destination & BIT0) == 0);
- ASSERT (((UINTN) Source & BIT0) == 0);
+ ASSERT (((UINTN)Destination & BIT0) == 0);
+ ASSERT (((UINTN)Source & BIT0) == 0);
//
// Let CopyLen denote the value DestMax - StrnLenS(Destination, DestMax) upon entry to StrCatS.
@@ -457,6 +464,7 @@ StrCatS (
while (*Source != 0) {
*(Destination++) = *(Source++);
}
+
*Destination = 0;
return RETURN_SUCCESS;
@@ -497,18 +505,18 @@ StrCatS (
RETURN_STATUS
EFIAPI
StrnCatS (
- IN OUT CHAR16 *Destination,
- IN UINTN DestMax,
- IN CONST CHAR16 *Source,
- IN UINTN Length
+ IN OUT CHAR16 *Destination,
+ IN UINTN DestMax,
+ IN CONST CHAR16 *Source,
+ IN UINTN Length
)
{
- UINTN DestLen;
- UINTN CopyLen;
- UINTN SourceLen;
+ UINTN DestLen;
+ UINTN CopyLen;
+ UINTN SourceLen;
- ASSERT (((UINTN) Destination & BIT0) == 0);
- ASSERT (((UINTN) Source & BIT0) == 0);
+ ASSERT (((UINTN)Destination & BIT0) == 0);
+ ASSERT (((UINTN)Source & BIT0) == 0);
//
// Let CopyLen denote the value DestMax - StrnLenS(Destination, DestMax) upon entry to StrnCatS.
@@ -554,6 +562,7 @@ StrnCatS (
if (SourceLen > Length) {
SourceLen = Length;
}
+
SAFE_STRING_CONSTRAINT_CHECK (InternalSafeStringNoStrOverlap (Destination, DestMax, (CHAR16 *)Source, SourceLen + 1), RETURN_ACCESS_DENIED);
//
@@ -568,6 +577,7 @@ StrnCatS (
*(Destination++) = *(Source++);
SourceLen--;
}
+
*Destination = 0;
return RETURN_SUCCESS;
@@ -619,12 +629,12 @@ StrnCatS (
RETURN_STATUS
EFIAPI
StrDecimalToUintnS (
- IN CONST CHAR16 *String,
- OUT CHAR16 **EndPointer OPTIONAL,
- OUT UINTN *Data
+ IN CONST CHAR16 *String,
+ OUT CHAR16 **EndPointer OPTIONAL,
+ OUT UINTN *Data
)
{
- ASSERT (((UINTN) String & BIT0) == 0);
+ ASSERT (((UINTN)String & BIT0) == 0);
//
// 1. Neither String nor Data shall be a null pointer.
@@ -640,7 +650,7 @@ StrDecimalToUintnS (
}
if (EndPointer != NULL) {
- *EndPointer = (CHAR16 *) String;
+ *EndPointer = (CHAR16 *)String;
}
//
@@ -668,8 +678,9 @@ StrDecimalToUintnS (
if (*Data > ((MAX_UINTN - (*String - L'0')) / 10)) {
*Data = MAX_UINTN;
if (EndPointer != NULL) {
- *EndPointer = (CHAR16 *) String;
+ *EndPointer = (CHAR16 *)String;
}
+
return RETURN_UNSUPPORTED;
}
@@ -678,8 +689,9 @@ StrDecimalToUintnS (
}
if (EndPointer != NULL) {
- *EndPointer = (CHAR16 *) String;
+ *EndPointer = (CHAR16 *)String;
}
+
return RETURN_SUCCESS;
}
@@ -729,12 +741,12 @@ StrDecimalToUintnS (
RETURN_STATUS
EFIAPI
StrDecimalToUint64S (
- IN CONST CHAR16 *String,
- OUT CHAR16 **EndPointer OPTIONAL,
- OUT UINT64 *Data
+ IN CONST CHAR16 *String,
+ OUT CHAR16 **EndPointer OPTIONAL,
+ OUT UINT64 *Data
)
{
- ASSERT (((UINTN) String & BIT0) == 0);
+ ASSERT (((UINTN)String & BIT0) == 0);
//
// 1. Neither String nor Data shall be a null pointer.
@@ -750,7 +762,7 @@ StrDecimalToUint64S (
}
if (EndPointer != NULL) {
- *EndPointer = (CHAR16 *) String;
+ *EndPointer = (CHAR16 *)String;
}
//
@@ -778,8 +790,9 @@ StrDecimalToUint64S (
if (*Data > DivU64x32 (MAX_UINT64 - (*String - L'0'), 10)) {
*Data = MAX_UINT64;
if (EndPointer != NULL) {
- *EndPointer = (CHAR16 *) String;
+ *EndPointer = (CHAR16 *)String;
}
+
return RETURN_UNSUPPORTED;
}
@@ -788,8 +801,9 @@ StrDecimalToUint64S (
}
if (EndPointer != NULL) {
- *EndPointer = (CHAR16 *) String;
+ *EndPointer = (CHAR16 *)String;
}
+
return RETURN_SUCCESS;
}
@@ -844,12 +858,12 @@ StrDecimalToUint64S (
RETURN_STATUS
EFIAPI
StrHexToUintnS (
- IN CONST CHAR16 *String,
- OUT CHAR16 **EndPointer OPTIONAL,
- OUT UINTN *Data
+ IN CONST CHAR16 *String,
+ OUT CHAR16 **EndPointer OPTIONAL,
+ OUT UINTN *Data
)
{
- ASSERT (((UINTN) String & BIT0) == 0);
+ ASSERT (((UINTN)String & BIT0) == 0);
//
// 1. Neither String nor Data shall be a null pointer.
@@ -865,7 +879,7 @@ StrHexToUintnS (
}
if (EndPointer != NULL) {
- *EndPointer = (CHAR16 *) String;
+ *EndPointer = (CHAR16 *)String;
}
//
@@ -887,6 +901,7 @@ StrHexToUintnS (
*Data = 0;
return RETURN_SUCCESS;
}
+
//
// Skip the 'X'
//
@@ -904,8 +919,9 @@ StrHexToUintnS (
if (*Data > ((MAX_UINTN - InternalHexCharToUintn (*String)) >> 4)) {
*Data = MAX_UINTN;
if (EndPointer != NULL) {
- *EndPointer = (CHAR16 *) String;
+ *EndPointer = (CHAR16 *)String;
}
+
return RETURN_UNSUPPORTED;
}
@@ -914,8 +930,9 @@ StrHexToUintnS (
}
if (EndPointer != NULL) {
- *EndPointer = (CHAR16 *) String;
+ *EndPointer = (CHAR16 *)String;
}
+
return RETURN_SUCCESS;
}
@@ -970,12 +987,12 @@ StrHexToUintnS (
RETURN_STATUS
EFIAPI
StrHexToUint64S (
- IN CONST CHAR16 *String,
- OUT CHAR16 **EndPointer OPTIONAL,
- OUT UINT64 *Data
+ IN CONST CHAR16 *String,
+ OUT CHAR16 **EndPointer OPTIONAL,
+ OUT UINT64 *Data
)
{
- ASSERT (((UINTN) String & BIT0) == 0);
+ ASSERT (((UINTN)String & BIT0) == 0);
//
// 1. Neither String nor Data shall be a null pointer.
@@ -991,7 +1008,7 @@ StrHexToUint64S (
}
if (EndPointer != NULL) {
- *EndPointer = (CHAR16 *) String;
+ *EndPointer = (CHAR16 *)String;
}
//
@@ -1013,6 +1030,7 @@ StrHexToUint64S (
*Data = 0;
return RETURN_SUCCESS;
}
+
//
// Skip the 'X'
//
@@ -1030,8 +1048,9 @@ StrHexToUint64S (
if (*Data > RShiftU64 (MAX_UINT64 - InternalHexCharToUintn (*String), 4)) {
*Data = MAX_UINT64;
if (EndPointer != NULL) {
- *EndPointer = (CHAR16 *) String;
+ *EndPointer = (CHAR16 *)String;
}
+
return RETURN_UNSUPPORTED;
}
@@ -1040,8 +1059,9 @@ StrHexToUint64S (
}
if (EndPointer != NULL) {
- *EndPointer = (CHAR16 *) String;
+ *EndPointer = (CHAR16 *)String;
}
+
return RETURN_SUCCESS;
}
@@ -1098,27 +1118,27 @@ StrHexToUint64S (
RETURN_STATUS
EFIAPI
StrToIpv6Address (
- IN CONST CHAR16 *String,
- OUT CHAR16 **EndPointer OPTIONAL,
- OUT IPv6_ADDRESS *Address,
- OUT UINT8 *PrefixLength OPTIONAL
+ IN CONST CHAR16 *String,
+ OUT CHAR16 **EndPointer OPTIONAL,
+ OUT IPv6_ADDRESS *Address,
+ OUT UINT8 *PrefixLength OPTIONAL
)
{
- RETURN_STATUS Status;
- UINTN AddressIndex;
- UINTN Uintn;
- IPv6_ADDRESS LocalAddress;
- UINT8 LocalPrefixLength;
- CONST CHAR16 *Pointer;
- CHAR16 *End;
- UINTN CompressStart;
- BOOLEAN ExpectPrefix;
+ RETURN_STATUS Status;
+ UINTN AddressIndex;
+ UINTN Uintn;
+ IPv6_ADDRESS LocalAddress;
+ UINT8 LocalPrefixLength;
+ CONST CHAR16 *Pointer;
+ CHAR16 *End;
+ UINTN CompressStart;
+ BOOLEAN ExpectPrefix;
LocalPrefixLength = MAX_UINT8;
CompressStart = ARRAY_SIZE (Address->Addr);
ExpectPrefix = FALSE;
- ASSERT (((UINTN) String & BIT0) == 0);
+ ASSERT (((UINTN)String & BIT0) == 0);
//
// 1. None of String or Guid shall be a null pointer.
@@ -1146,7 +1166,7 @@ StrToIpv6Address (
return RETURN_UNSUPPORTED;
}
- if (CompressStart != ARRAY_SIZE (Address->Addr) || AddressIndex == ARRAY_SIZE (Address->Addr)) {
+ if ((CompressStart != ARRAY_SIZE (Address->Addr)) || (AddressIndex == ARRAY_SIZE (Address->Addr))) {
//
// "::" can only appear once.
// "::" can only appear when address is not full length.
@@ -1166,6 +1186,7 @@ StrToIpv6Address (
//
return RETURN_UNSUPPORTED;
}
+
Pointer++;
}
}
@@ -1188,33 +1209,35 @@ StrToIpv6Address (
// Get X.
//
Status = StrHexToUintnS (Pointer, &End, &Uintn);
- if (RETURN_ERROR (Status) || End - Pointer > 4) {
+ if (RETURN_ERROR (Status) || (End - Pointer > 4)) {
//
// Number of hexadecimal digit characters is no more than 4.
//
return RETURN_UNSUPPORTED;
}
+
Pointer = End;
//
// Uintn won't exceed MAX_UINT16 if number of hexadecimal digit characters is no more than 4.
//
ASSERT (AddressIndex + 1 < ARRAY_SIZE (Address->Addr));
- LocalAddress.Addr[AddressIndex] = (UINT8) ((UINT16) Uintn >> 8);
- LocalAddress.Addr[AddressIndex + 1] = (UINT8) Uintn;
- AddressIndex += 2;
+ LocalAddress.Addr[AddressIndex] = (UINT8)((UINT16)Uintn >> 8);
+ LocalAddress.Addr[AddressIndex + 1] = (UINT8)Uintn;
+ AddressIndex += 2;
} else {
//
// Get P, then exit the loop.
//
Status = StrDecimalToUintnS (Pointer, &End, &Uintn);
- if (RETURN_ERROR (Status) || End == Pointer || Uintn > 128) {
+ if (RETURN_ERROR (Status) || (End == Pointer) || (Uintn > 128)) {
//
// Prefix length should not exceed 128.
//
return RETURN_UNSUPPORTED;
}
- LocalPrefixLength = (UINT8) Uintn;
- Pointer = End;
+
+ LocalPrefixLength = (UINT8)Uintn;
+ Pointer = End;
break;
}
}
@@ -1237,18 +1260,21 @@ StrToIpv6Address (
//
break;
}
+
Pointer++;
}
- if ((AddressIndex == ARRAY_SIZE (Address->Addr) && CompressStart != ARRAY_SIZE (Address->Addr)) ||
- (AddressIndex != ARRAY_SIZE (Address->Addr) && CompressStart == ARRAY_SIZE (Address->Addr))
- ) {
+ if (((AddressIndex == ARRAY_SIZE (Address->Addr)) && (CompressStart != ARRAY_SIZE (Address->Addr))) ||
+ ((AddressIndex != ARRAY_SIZE (Address->Addr)) && (CompressStart == ARRAY_SIZE (Address->Addr)))
+ )
+ {
//
// Full length of address shall not have compressing zeros.
// Non-full length of address shall have compressing zeros.
//
return RETURN_UNSUPPORTED;
}
+
CopyMem (&Address->Addr[0], &LocalAddress.Addr[0], CompressStart);
ZeroMem (&Address->Addr[CompressStart], ARRAY_SIZE (Address->Addr) - AddressIndex);
if (AddressIndex > CompressStart) {
@@ -1262,8 +1288,9 @@ StrToIpv6Address (
if (PrefixLength != NULL) {
*PrefixLength = LocalPrefixLength;
}
+
if (EndPointer != NULL) {
- *EndPointer = (CHAR16 *) Pointer;
+ *EndPointer = (CHAR16 *)Pointer;
}
return RETURN_SUCCESS;
@@ -1313,22 +1340,22 @@ StrToIpv6Address (
RETURN_STATUS
EFIAPI
StrToIpv4Address (
- IN CONST CHAR16 *String,
- OUT CHAR16 **EndPointer OPTIONAL,
- OUT IPv4_ADDRESS *Address,
- OUT UINT8 *PrefixLength OPTIONAL
+ IN CONST CHAR16 *String,
+ OUT CHAR16 **EndPointer OPTIONAL,
+ OUT IPv4_ADDRESS *Address,
+ OUT UINT8 *PrefixLength OPTIONAL
)
{
- RETURN_STATUS Status;
- UINTN AddressIndex;
- UINTN Uintn;
- IPv4_ADDRESS LocalAddress;
- UINT8 LocalPrefixLength;
- CHAR16 *Pointer;
+ RETURN_STATUS Status;
+ UINTN AddressIndex;
+ UINTN Uintn;
+ IPv4_ADDRESS LocalAddress;
+ UINT8 LocalPrefixLength;
+ CHAR16 *Pointer;
LocalPrefixLength = MAX_UINT8;
- ASSERT (((UINTN) String & BIT0) == 0);
+ ASSERT (((UINTN)String & BIT0) == 0);
//
// 1. None of String or Guid shall be a null pointer.
@@ -1336,7 +1363,7 @@ StrToIpv4Address (
SAFE_STRING_CONSTRAINT_CHECK ((String != NULL), RETURN_INVALID_PARAMETER);
SAFE_STRING_CONSTRAINT_CHECK ((Address != NULL), RETURN_INVALID_PARAMETER);
- for (Pointer = (CHAR16 *) String, AddressIndex = 0; AddressIndex < ARRAY_SIZE (Address->Addr) + 1;) {
+ for (Pointer = (CHAR16 *)String, AddressIndex = 0; AddressIndex < ARRAY_SIZE (Address->Addr) + 1;) {
if (!InternalIsDecimalDigitCharacter (*Pointer)) {
//
// D or P contains invalid characters.
@@ -1347,10 +1374,11 @@ StrToIpv4Address (
//
// Get D or P.
//
- Status = StrDecimalToUintnS ((CONST CHAR16 *) Pointer, &Pointer, &Uintn);
+ Status = StrDecimalToUintnS ((CONST CHAR16 *)Pointer, &Pointer, &Uintn);
if (RETURN_ERROR (Status)) {
return RETURN_UNSUPPORTED;
}
+
if (AddressIndex == ARRAY_SIZE (Address->Addr)) {
//
// It's P.
@@ -1358,7 +1386,8 @@ StrToIpv4Address (
if (Uintn > 32) {
return RETURN_UNSUPPORTED;
}
- LocalPrefixLength = (UINT8) Uintn;
+
+ LocalPrefixLength = (UINT8)Uintn;
} else {
//
// It's D.
@@ -1366,7 +1395,8 @@ StrToIpv4Address (
if (Uintn > MAX_UINT8) {
return RETURN_UNSUPPORTED;
}
- LocalAddress.Addr[AddressIndex] = (UINT8) Uintn;
+
+ LocalAddress.Addr[AddressIndex] = (UINT8)Uintn;
AddressIndex++;
}
@@ -1406,6 +1436,7 @@ StrToIpv4Address (
if (PrefixLength != NULL) {
*PrefixLength = LocalPrefixLength;
}
+
if (EndPointer != NULL) {
*EndPointer = Pointer;
}
@@ -1458,14 +1489,14 @@ StrToIpv4Address (
RETURN_STATUS
EFIAPI
StrToGuid (
- IN CONST CHAR16 *String,
- OUT GUID *Guid
+ IN CONST CHAR16 *String,
+ OUT GUID *Guid
)
{
- RETURN_STATUS Status;
- GUID LocalGuid;
+ RETURN_STATUS Status;
+ GUID LocalGuid;
- ASSERT (((UINTN) String & BIT0) == 0);
+ ASSERT (((UINTN)String & BIT0) == 0);
//
// 1. None of String or Guid shall be a null pointer.
@@ -1476,49 +1507,53 @@ StrToGuid (
//
// Get aabbccdd in big-endian.
//
- Status = StrHexToBytes (String, 2 * sizeof (LocalGuid.Data1), (UINT8 *) &LocalGuid.Data1, sizeof (LocalGuid.Data1));
- if (RETURN_ERROR (Status) || String[2 * sizeof (LocalGuid.Data1)] != L'-') {
+ Status = StrHexToBytes (String, 2 * sizeof (LocalGuid.Data1), (UINT8 *)&LocalGuid.Data1, sizeof (LocalGuid.Data1));
+ if (RETURN_ERROR (Status) || (String[2 * sizeof (LocalGuid.Data1)] != L'-')) {
return RETURN_UNSUPPORTED;
}
+
//
// Convert big-endian to little-endian.
//
LocalGuid.Data1 = SwapBytes32 (LocalGuid.Data1);
- String += 2 * sizeof (LocalGuid.Data1) + 1;
+ String += 2 * sizeof (LocalGuid.Data1) + 1;
//
// Get eeff in big-endian.
//
- Status = StrHexToBytes (String, 2 * sizeof (LocalGuid.Data2), (UINT8 *) &LocalGuid.Data2, sizeof (LocalGuid.Data2));
- if (RETURN_ERROR (Status) || String[2 * sizeof (LocalGuid.Data2)] != L'-') {
+ Status = StrHexToBytes (String, 2 * sizeof (LocalGuid.Data2), (UINT8 *)&LocalGuid.Data2, sizeof (LocalGuid.Data2));
+ if (RETURN_ERROR (Status) || (String[2 * sizeof (LocalGuid.Data2)] != L'-')) {
return RETURN_UNSUPPORTED;
}
+
//
// Convert big-endian to little-endian.
//
LocalGuid.Data2 = SwapBytes16 (LocalGuid.Data2);
- String += 2 * sizeof (LocalGuid.Data2) + 1;
+ String += 2 * sizeof (LocalGuid.Data2) + 1;
//
// Get gghh in big-endian.
//
- Status = StrHexToBytes (String, 2 * sizeof (LocalGuid.Data3), (UINT8 *) &LocalGuid.Data3, sizeof (LocalGuid.Data3));
- if (RETURN_ERROR (Status) || String[2 * sizeof (LocalGuid.Data3)] != L'-') {
+ Status = StrHexToBytes (String, 2 * sizeof (LocalGuid.Data3), (UINT8 *)&LocalGuid.Data3, sizeof (LocalGuid.Data3));
+ if (RETURN_ERROR (Status) || (String[2 * sizeof (LocalGuid.Data3)] != L'-')) {
return RETURN_UNSUPPORTED;
}
+
//
// Convert big-endian to little-endian.
//
LocalGuid.Data3 = SwapBytes16 (LocalGuid.Data3);
- String += 2 * sizeof (LocalGuid.Data3) + 1;
+ String += 2 * sizeof (LocalGuid.Data3) + 1;
//
// Get iijj.
//
Status = StrHexToBytes (String, 2 * 2, &LocalGuid.Data4[0], 2);
- if (RETURN_ERROR (Status) || String[2 * 2] != L'-') {
+ if (RETURN_ERROR (Status) || (String[2 * 2] != L'-')) {
return RETURN_UNSUPPORTED;
}
+
String += 2 * 2 + 1;
//
@@ -1569,15 +1604,15 @@ StrToGuid (
RETURN_STATUS
EFIAPI
StrHexToBytes (
- IN CONST CHAR16 *String,
- IN UINTN Length,
- OUT UINT8 *Buffer,
- IN UINTN MaxBufferSize
+ IN CONST CHAR16 *String,
+ IN UINTN Length,
+ OUT UINT8 *Buffer,
+ IN UINTN MaxBufferSize
)
{
- UINTN Index;
+ UINTN Index;
- ASSERT (((UINTN) String & BIT0) == 0);
+ ASSERT (((UINTN)String & BIT0) == 0);
//
// 1. None of String or Buffer shall be a null pointer.
@@ -1610,6 +1645,7 @@ StrHexToBytes (
break;
}
}
+
if (Index != Length) {
return RETURN_UNSUPPORTED;
}
@@ -1617,18 +1653,18 @@ StrHexToBytes (
//
// Convert the hex string to bytes.
//
- for(Index = 0; Index < Length; Index++) {
-
+ for (Index = 0; Index < Length; Index++) {
//
// For even characters, write the upper nibble for each buffer byte,
// and for even characters, the lower nibble.
//
if ((Index & BIT0) == 0) {
- Buffer[Index / 2] = (UINT8) InternalHexCharToUintn (String[Index]) << 4;
+ Buffer[Index / 2] = (UINT8)InternalHexCharToUintn (String[Index]) << 4;
} else {
- Buffer[Index / 2] |= (UINT8) InternalHexCharToUintn (String[Index]);
+ Buffer[Index / 2] |= (UINT8)InternalHexCharToUintn (String[Index]);
}
}
+
return RETURN_SUCCESS;
}
@@ -1649,11 +1685,11 @@ StrHexToBytes (
UINTN
EFIAPI
AsciiStrnLenS (
- IN CONST CHAR8 *String,
- IN UINTN MaxSize
+ IN CONST CHAR8 *String,
+ IN UINTN MaxSize
)
{
- UINTN Length;
+ UINTN Length;
//
// If String is a null pointer or MaxSize is 0, then the AsciiStrnLenS function returns zero.
@@ -1673,8 +1709,10 @@ AsciiStrnLenS (
if (Length >= MaxSize - 1) {
return MaxSize;
}
+
Length++;
}
+
return Length;
}
@@ -1700,8 +1738,8 @@ AsciiStrnLenS (
UINTN
EFIAPI
AsciiStrnSizeS (
- IN CONST CHAR8 *String,
- IN UINTN MaxSize
+ IN CONST CHAR8 *String,
+ IN UINTN MaxSize
)
{
//
@@ -1753,7 +1791,7 @@ AsciiStrCpyS (
IN CONST CHAR8 *Source
)
{
- UINTN SourceLen;
+ UINTN SourceLen;
//
// 1. Neither Destination nor Source shall be a null pointer.
@@ -1791,6 +1829,7 @@ AsciiStrCpyS (
while (*Source != 0) {
*(Destination++) = *(Source++);
}
+
*Destination = 0;
return RETURN_SUCCESS;
@@ -1831,7 +1870,7 @@ AsciiStrnCpyS (
IN UINTN Length
)
{
- UINTN SourceLen;
+ UINTN SourceLen;
//
// 1. Neither Destination nor Source shall be a null pointer.
@@ -1866,6 +1905,7 @@ AsciiStrnCpyS (
if (SourceLen > Length) {
SourceLen = Length;
}
+
SAFE_STRING_CONSTRAINT_CHECK (InternalSafeStringNoAsciiStrOverlap (Destination, DestMax, (CHAR8 *)Source, SourceLen + 1), RETURN_ACCESS_DENIED);
//
@@ -1878,6 +1918,7 @@ AsciiStrnCpyS (
*(Destination++) = *(Source++);
SourceLen--;
}
+
*Destination = 0;
return RETURN_SUCCESS;
@@ -1917,9 +1958,9 @@ AsciiStrCatS (
IN CONST CHAR8 *Source
)
{
- UINTN DestLen;
- UINTN CopyLen;
- UINTN SourceLen;
+ UINTN DestLen;
+ UINTN CopyLen;
+ UINTN SourceLen;
//
// Let CopyLen denote the value DestMax - AsciiStrnLenS(Destination, DestMax) upon entry to AsciiStrCatS.
@@ -1970,6 +2011,7 @@ AsciiStrCatS (
while (*Source != 0) {
*(Destination++) = *(Source++);
}
+
*Destination = 0;
return RETURN_SUCCESS;
@@ -2013,9 +2055,9 @@ AsciiStrnCatS (
IN UINTN Length
)
{
- UINTN DestLen;
- UINTN CopyLen;
- UINTN SourceLen;
+ UINTN DestLen;
+ UINTN CopyLen;
+ UINTN SourceLen;
//
// Let CopyLen denote the value DestMax - AsciiStrnLenS(Destination, DestMax) upon entry to AsciiStrnCatS.
@@ -2061,6 +2103,7 @@ AsciiStrnCatS (
if (SourceLen > Length) {
SourceLen = Length;
}
+
SAFE_STRING_CONSTRAINT_CHECK (InternalSafeStringNoAsciiStrOverlap (Destination, DestMax, (CHAR8 *)Source, SourceLen + 1), RETURN_ACCESS_DENIED);
//
@@ -2075,6 +2118,7 @@ AsciiStrnCatS (
*(Destination++) = *(Source++);
SourceLen--;
}
+
*Destination = 0;
return RETURN_SUCCESS;
@@ -2124,9 +2168,9 @@ AsciiStrnCatS (
RETURN_STATUS
EFIAPI
AsciiStrDecimalToUintnS (
- IN CONST CHAR8 *String,
- OUT CHAR8 **EndPointer OPTIONAL,
- OUT UINTN *Data
+ IN CONST CHAR8 *String,
+ OUT CHAR8 **EndPointer OPTIONAL,
+ OUT UINTN *Data
)
{
//
@@ -2143,7 +2187,7 @@ AsciiStrDecimalToUintnS (
}
if (EndPointer != NULL) {
- *EndPointer = (CHAR8 *) String;
+ *EndPointer = (CHAR8 *)String;
}
//
@@ -2171,8 +2215,9 @@ AsciiStrDecimalToUintnS (
if (*Data > ((MAX_UINTN - (*String - '0')) / 10)) {
*Data = MAX_UINTN;
if (EndPointer != NULL) {
- *EndPointer = (CHAR8 *) String;
+ *EndPointer = (CHAR8 *)String;
}
+
return RETURN_UNSUPPORTED;
}
@@ -2181,8 +2226,9 @@ AsciiStrDecimalToUintnS (
}
if (EndPointer != NULL) {
- *EndPointer = (CHAR8 *) String;
+ *EndPointer = (CHAR8 *)String;
}
+
return RETURN_SUCCESS;
}
@@ -2230,9 +2276,9 @@ AsciiStrDecimalToUintnS (
RETURN_STATUS
EFIAPI
AsciiStrDecimalToUint64S (
- IN CONST CHAR8 *String,
- OUT CHAR8 **EndPointer OPTIONAL,
- OUT UINT64 *Data
+ IN CONST CHAR8 *String,
+ OUT CHAR8 **EndPointer OPTIONAL,
+ OUT UINT64 *Data
)
{
//
@@ -2249,7 +2295,7 @@ AsciiStrDecimalToUint64S (
}
if (EndPointer != NULL) {
- *EndPointer = (CHAR8 *) String;
+ *EndPointer = (CHAR8 *)String;
}
//
@@ -2277,8 +2323,9 @@ AsciiStrDecimalToUint64S (
if (*Data > DivU64x32 (MAX_UINT64 - (*String - '0'), 10)) {
*Data = MAX_UINT64;
if (EndPointer != NULL) {
- *EndPointer = (CHAR8 *) String;
+ *EndPointer = (CHAR8 *)String;
}
+
return RETURN_UNSUPPORTED;
}
@@ -2287,8 +2334,9 @@ AsciiStrDecimalToUint64S (
}
if (EndPointer != NULL) {
- *EndPointer = (CHAR8 *) String;
+ *EndPointer = (CHAR8 *)String;
}
+
return RETURN_SUCCESS;
}
@@ -2340,9 +2388,9 @@ AsciiStrDecimalToUint64S (
RETURN_STATUS
EFIAPI
AsciiStrHexToUintnS (
- IN CONST CHAR8 *String,
- OUT CHAR8 **EndPointer OPTIONAL,
- OUT UINTN *Data
+ IN CONST CHAR8 *String,
+ OUT CHAR8 **EndPointer OPTIONAL,
+ OUT UINTN *Data
)
{
//
@@ -2359,7 +2407,7 @@ AsciiStrHexToUintnS (
}
if (EndPointer != NULL) {
- *EndPointer = (CHAR8 *) String;
+ *EndPointer = (CHAR8 *)String;
}
//
@@ -2381,6 +2429,7 @@ AsciiStrHexToUintnS (
*Data = 0;
return RETURN_SUCCESS;
}
+
//
// Skip the 'X'
//
@@ -2398,8 +2447,9 @@ AsciiStrHexToUintnS (
if (*Data > ((MAX_UINTN - InternalAsciiHexCharToUintn (*String)) >> 4)) {
*Data = MAX_UINTN;
if (EndPointer != NULL) {
- *EndPointer = (CHAR8 *) String;
+ *EndPointer = (CHAR8 *)String;
}
+
return RETURN_UNSUPPORTED;
}
@@ -2408,8 +2458,9 @@ AsciiStrHexToUintnS (
}
if (EndPointer != NULL) {
- *EndPointer = (CHAR8 *) String;
+ *EndPointer = (CHAR8 *)String;
}
+
return RETURN_SUCCESS;
}
@@ -2461,9 +2512,9 @@ AsciiStrHexToUintnS (
RETURN_STATUS
EFIAPI
AsciiStrHexToUint64S (
- IN CONST CHAR8 *String,
- OUT CHAR8 **EndPointer OPTIONAL,
- OUT UINT64 *Data
+ IN CONST CHAR8 *String,
+ OUT CHAR8 **EndPointer OPTIONAL,
+ OUT UINT64 *Data
)
{
//
@@ -2480,7 +2531,7 @@ AsciiStrHexToUint64S (
}
if (EndPointer != NULL) {
- *EndPointer = (CHAR8 *) String;
+ *EndPointer = (CHAR8 *)String;
}
//
@@ -2502,6 +2553,7 @@ AsciiStrHexToUint64S (
*Data = 0;
return RETURN_SUCCESS;
}
+
//
// Skip the 'X'
//
@@ -2519,8 +2571,9 @@ AsciiStrHexToUint64S (
if (*Data > RShiftU64 (MAX_UINT64 - InternalAsciiHexCharToUintn (*String), 4)) {
*Data = MAX_UINT64;
if (EndPointer != NULL) {
- *EndPointer = (CHAR8 *) String;
+ *EndPointer = (CHAR8 *)String;
}
+
return RETURN_UNSUPPORTED;
}
@@ -2529,8 +2582,9 @@ AsciiStrHexToUint64S (
}
if (EndPointer != NULL) {
- *EndPointer = (CHAR8 *) String;
+ *EndPointer = (CHAR8 *)String;
}
+
return RETURN_SUCCESS;
}
@@ -2577,14 +2631,14 @@ AsciiStrHexToUint64S (
RETURN_STATUS
EFIAPI
UnicodeStrToAsciiStrS (
- IN CONST CHAR16 *Source,
- OUT CHAR8 *Destination,
- IN UINTN DestMax
+ IN CONST CHAR16 *Source,
+ OUT CHAR8 *Destination,
+ IN UINTN DestMax
)
{
- UINTN SourceLen;
+ UINTN SourceLen;
- ASSERT (((UINTN) Source & BIT0) == 0);
+ ASSERT (((UINTN)Source & BIT0) == 0);
//
// 1. Neither Destination nor Source shall be a null pointer.
@@ -2598,6 +2652,7 @@ UnicodeStrToAsciiStrS (
if (ASCII_RSIZE_MAX != 0) {
SAFE_STRING_CONSTRAINT_CHECK ((DestMax <= ASCII_RSIZE_MAX), RETURN_INVALID_PARAMETER);
}
+
if (RSIZE_MAX != 0) {
SAFE_STRING_CONSTRAINT_CHECK ((DestMax <= RSIZE_MAX), RETURN_INVALID_PARAMETER);
}
@@ -2616,7 +2671,7 @@ UnicodeStrToAsciiStrS (
//
// 5. Copying shall not take place between objects that overlap.
//
- SAFE_STRING_CONSTRAINT_CHECK (!InternalSafeStringIsOverlap (Destination, DestMax, (VOID *)Source, (SourceLen + 1) * sizeof(CHAR16)), RETURN_ACCESS_DENIED);
+ SAFE_STRING_CONSTRAINT_CHECK (!InternalSafeStringIsOverlap (Destination, DestMax, (VOID *)Source, (SourceLen + 1) * sizeof (CHAR16)), RETURN_ACCESS_DENIED);
//
// convert string
@@ -2627,8 +2682,9 @@ UnicodeStrToAsciiStrS (
// non-zero value in the upper 8 bits, then ASSERT().
//
ASSERT (*Source < 0x100);
- *(Destination++) = (CHAR8) *(Source++);
+ *(Destination++) = (CHAR8)*(Source++);
}
+
*Destination = '\0';
return RETURN_SUCCESS;
@@ -2682,16 +2738,16 @@ UnicodeStrToAsciiStrS (
RETURN_STATUS
EFIAPI
UnicodeStrnToAsciiStrS (
- IN CONST CHAR16 *Source,
- IN UINTN Length,
- OUT CHAR8 *Destination,
- IN UINTN DestMax,
- OUT UINTN *DestinationLength
+ IN CONST CHAR16 *Source,
+ IN UINTN Length,
+ OUT CHAR8 *Destination,
+ IN UINTN DestMax,
+ OUT UINTN *DestinationLength
)
{
- UINTN SourceLen;
+ UINTN SourceLen;
- ASSERT (((UINTN) Source & BIT0) == 0);
+ ASSERT (((UINTN)Source & BIT0) == 0);
//
// 1. None of Destination, Source or DestinationLength shall be a null
@@ -2709,6 +2765,7 @@ UnicodeStrnToAsciiStrS (
SAFE_STRING_CONSTRAINT_CHECK ((Length <= ASCII_RSIZE_MAX), RETURN_INVALID_PARAMETER);
SAFE_STRING_CONSTRAINT_CHECK ((DestMax <= ASCII_RSIZE_MAX), RETURN_INVALID_PARAMETER);
}
+
if (RSIZE_MAX != 0) {
SAFE_STRING_CONSTRAINT_CHECK ((Length <= RSIZE_MAX), RETURN_INVALID_PARAMETER);
SAFE_STRING_CONSTRAINT_CHECK ((DestMax <= RSIZE_MAX), RETURN_INVALID_PARAMETER);
@@ -2734,7 +2791,8 @@ UnicodeStrnToAsciiStrS (
if (SourceLen > Length) {
SourceLen = Length;
}
- SAFE_STRING_CONSTRAINT_CHECK (!InternalSafeStringIsOverlap (Destination, DestMax, (VOID *)Source, (SourceLen + 1) * sizeof(CHAR16)), RETURN_ACCESS_DENIED);
+
+ SAFE_STRING_CONSTRAINT_CHECK (!InternalSafeStringIsOverlap (Destination, DestMax, (VOID *)Source, (SourceLen + 1) * sizeof (CHAR16)), RETURN_ACCESS_DENIED);
*DestinationLength = 0;
@@ -2747,10 +2805,11 @@ UnicodeStrnToAsciiStrS (
// 8 bits, then ASSERT().
//
ASSERT (*Source < 0x100);
- *(Destination++) = (CHAR8) *(Source++);
+ *(Destination++) = (CHAR8)*(Source++);
SourceLen--;
(*DestinationLength)++;
}
+
*Destination = 0;
return RETURN_SUCCESS;
@@ -2795,14 +2854,14 @@ UnicodeStrnToAsciiStrS (
RETURN_STATUS
EFIAPI
AsciiStrToUnicodeStrS (
- IN CONST CHAR8 *Source,
- OUT CHAR16 *Destination,
- IN UINTN DestMax
+ IN CONST CHAR8 *Source,
+ OUT CHAR16 *Destination,
+ IN UINTN DestMax
)
{
- UINTN SourceLen;
+ UINTN SourceLen;
- ASSERT (((UINTN) Destination & BIT0) == 0);
+ ASSERT (((UINTN)Destination & BIT0) == 0);
//
// 1. Neither Destination nor Source shall be a null pointer.
@@ -2816,6 +2875,7 @@ AsciiStrToUnicodeStrS (
if (RSIZE_MAX != 0) {
SAFE_STRING_CONSTRAINT_CHECK ((DestMax <= RSIZE_MAX), RETURN_INVALID_PARAMETER);
}
+
if (ASCII_RSIZE_MAX != 0) {
SAFE_STRING_CONSTRAINT_CHECK ((DestMax <= ASCII_RSIZE_MAX), RETURN_INVALID_PARAMETER);
}
@@ -2834,7 +2894,7 @@ AsciiStrToUnicodeStrS (
//
// 5. Copying shall not take place between objects that overlap.
//
- SAFE_STRING_CONSTRAINT_CHECK (!InternalSafeStringIsOverlap (Destination, DestMax * sizeof(CHAR16), (VOID *)Source, SourceLen + 1), RETURN_ACCESS_DENIED);
+ SAFE_STRING_CONSTRAINT_CHECK (!InternalSafeStringIsOverlap (Destination, DestMax * sizeof (CHAR16), (VOID *)Source, SourceLen + 1), RETURN_ACCESS_DENIED);
//
// Convert string
@@ -2842,6 +2902,7 @@ AsciiStrToUnicodeStrS (
while (*Source != '\0') {
*(Destination++) = (CHAR16)(UINT8)*(Source++);
}
+
*Destination = '\0';
return RETURN_SUCCESS;
@@ -2892,16 +2953,16 @@ AsciiStrToUnicodeStrS (
RETURN_STATUS
EFIAPI
AsciiStrnToUnicodeStrS (
- IN CONST CHAR8 *Source,
- IN UINTN Length,
- OUT CHAR16 *Destination,
- IN UINTN DestMax,
- OUT UINTN *DestinationLength
+ IN CONST CHAR8 *Source,
+ IN UINTN Length,
+ OUT CHAR16 *Destination,
+ IN UINTN DestMax,
+ OUT UINTN *DestinationLength
)
{
- UINTN SourceLen;
+ UINTN SourceLen;
- ASSERT (((UINTN) Destination & BIT0) == 0);
+ ASSERT (((UINTN)Destination & BIT0) == 0);
//
// 1. None of Destination, Source or DestinationLength shall be a null
@@ -2919,6 +2980,7 @@ AsciiStrnToUnicodeStrS (
SAFE_STRING_CONSTRAINT_CHECK ((Length <= RSIZE_MAX), RETURN_INVALID_PARAMETER);
SAFE_STRING_CONSTRAINT_CHECK ((DestMax <= RSIZE_MAX), RETURN_INVALID_PARAMETER);
}
+
if (ASCII_RSIZE_MAX != 0) {
SAFE_STRING_CONSTRAINT_CHECK ((Length <= ASCII_RSIZE_MAX), RETURN_INVALID_PARAMETER);
SAFE_STRING_CONSTRAINT_CHECK ((DestMax <= ASCII_RSIZE_MAX), RETURN_INVALID_PARAMETER);
@@ -2944,7 +3006,8 @@ AsciiStrnToUnicodeStrS (
if (SourceLen > Length) {
SourceLen = Length;
}
- SAFE_STRING_CONSTRAINT_CHECK (!InternalSafeStringIsOverlap (Destination, DestMax * sizeof(CHAR16), (VOID *)Source, SourceLen + 1), RETURN_ACCESS_DENIED);
+
+ SAFE_STRING_CONSTRAINT_CHECK (!InternalSafeStringIsOverlap (Destination, DestMax * sizeof (CHAR16), (VOID *)Source, SourceLen + 1), RETURN_ACCESS_DENIED);
*DestinationLength = 0;
@@ -2956,6 +3019,7 @@ AsciiStrnToUnicodeStrS (
SourceLen--;
(*DestinationLength)++;
}
+
*Destination = 0;
return RETURN_SUCCESS;
@@ -3012,21 +3076,21 @@ AsciiStrnToUnicodeStrS (
RETURN_STATUS
EFIAPI
AsciiStrToIpv6Address (
- IN CONST CHAR8 *String,
- OUT CHAR8 **EndPointer OPTIONAL,
- OUT IPv6_ADDRESS *Address,
- OUT UINT8 *PrefixLength OPTIONAL
+ IN CONST CHAR8 *String,
+ OUT CHAR8 **EndPointer OPTIONAL,
+ OUT IPv6_ADDRESS *Address,
+ OUT UINT8 *PrefixLength OPTIONAL
)
{
- RETURN_STATUS Status;
- UINTN AddressIndex;
- UINTN Uintn;
- IPv6_ADDRESS LocalAddress;
- UINT8 LocalPrefixLength;
- CONST CHAR8 *Pointer;
- CHAR8 *End;
- UINTN CompressStart;
- BOOLEAN ExpectPrefix;
+ RETURN_STATUS Status;
+ UINTN AddressIndex;
+ UINTN Uintn;
+ IPv6_ADDRESS LocalAddress;
+ UINT8 LocalPrefixLength;
+ CONST CHAR8 *Pointer;
+ CHAR8 *End;
+ UINTN CompressStart;
+ BOOLEAN ExpectPrefix;
LocalPrefixLength = MAX_UINT8;
CompressStart = ARRAY_SIZE (Address->Addr);
@@ -3058,7 +3122,7 @@ AsciiStrToIpv6Address (
return RETURN_UNSUPPORTED;
}
- if (CompressStart != ARRAY_SIZE (Address->Addr) || AddressIndex == ARRAY_SIZE (Address->Addr)) {
+ if ((CompressStart != ARRAY_SIZE (Address->Addr)) || (AddressIndex == ARRAY_SIZE (Address->Addr))) {
//
// "::" can only appear once.
// "::" can only appear when address is not full length.
@@ -3078,6 +3142,7 @@ AsciiStrToIpv6Address (
//
return RETURN_UNSUPPORTED;
}
+
Pointer++;
}
}
@@ -3100,33 +3165,35 @@ AsciiStrToIpv6Address (
// Get X.
//
Status = AsciiStrHexToUintnS (Pointer, &End, &Uintn);
- if (RETURN_ERROR (Status) || End - Pointer > 4) {
+ if (RETURN_ERROR (Status) || (End - Pointer > 4)) {
//
// Number of hexadecimal digit characters is no more than 4.
//
return RETURN_UNSUPPORTED;
}
+
Pointer = End;
//
// Uintn won't exceed MAX_UINT16 if number of hexadecimal digit characters is no more than 4.
//
ASSERT (AddressIndex + 1 < ARRAY_SIZE (Address->Addr));
- LocalAddress.Addr[AddressIndex] = (UINT8) ((UINT16) Uintn >> 8);
- LocalAddress.Addr[AddressIndex + 1] = (UINT8) Uintn;
- AddressIndex += 2;
+ LocalAddress.Addr[AddressIndex] = (UINT8)((UINT16)Uintn >> 8);
+ LocalAddress.Addr[AddressIndex + 1] = (UINT8)Uintn;
+ AddressIndex += 2;
} else {
//
// Get P, then exit the loop.
//
Status = AsciiStrDecimalToUintnS (Pointer, &End, &Uintn);
- if (RETURN_ERROR (Status) || End == Pointer || Uintn > 128) {
+ if (RETURN_ERROR (Status) || (End == Pointer) || (Uintn > 128)) {
//
// Prefix length should not exceed 128.
//
return RETURN_UNSUPPORTED;
}
- LocalPrefixLength = (UINT8) Uintn;
- Pointer = End;
+
+ LocalPrefixLength = (UINT8)Uintn;
+ Pointer = End;
break;
}
}
@@ -3149,18 +3216,21 @@ AsciiStrToIpv6Address (
//
break;
}
+
Pointer++;
}
- if ((AddressIndex == ARRAY_SIZE (Address->Addr) && CompressStart != ARRAY_SIZE (Address->Addr)) ||
- (AddressIndex != ARRAY_SIZE (Address->Addr) && CompressStart == ARRAY_SIZE (Address->Addr))
- ) {
+ if (((AddressIndex == ARRAY_SIZE (Address->Addr)) && (CompressStart != ARRAY_SIZE (Address->Addr))) ||
+ ((AddressIndex != ARRAY_SIZE (Address->Addr)) && (CompressStart == ARRAY_SIZE (Address->Addr)))
+ )
+ {
//
// Full length of address shall not have compressing zeros.
// Non-full length of address shall have compressing zeros.
//
return RETURN_UNSUPPORTED;
}
+
CopyMem (&Address->Addr[0], &LocalAddress.Addr[0], CompressStart);
ZeroMem (&Address->Addr[CompressStart], ARRAY_SIZE (Address->Addr) - AddressIndex);
if (AddressIndex > CompressStart) {
@@ -3169,14 +3239,14 @@ AsciiStrToIpv6Address (
&LocalAddress.Addr[CompressStart],
AddressIndex - CompressStart
);
-
}
if (PrefixLength != NULL) {
*PrefixLength = LocalPrefixLength;
}
+
if (EndPointer != NULL) {
- *EndPointer = (CHAR8 *) Pointer;
+ *EndPointer = (CHAR8 *)Pointer;
}
return RETURN_SUCCESS;
@@ -3224,18 +3294,18 @@ AsciiStrToIpv6Address (
RETURN_STATUS
EFIAPI
AsciiStrToIpv4Address (
- IN CONST CHAR8 *String,
- OUT CHAR8 **EndPointer OPTIONAL,
- OUT IPv4_ADDRESS *Address,
- OUT UINT8 *PrefixLength OPTIONAL
+ IN CONST CHAR8 *String,
+ OUT CHAR8 **EndPointer OPTIONAL,
+ OUT IPv4_ADDRESS *Address,
+ OUT UINT8 *PrefixLength OPTIONAL
)
{
- RETURN_STATUS Status;
- UINTN AddressIndex;
- UINTN Uintn;
- IPv4_ADDRESS LocalAddress;
- UINT8 LocalPrefixLength;
- CHAR8 *Pointer;
+ RETURN_STATUS Status;
+ UINTN AddressIndex;
+ UINTN Uintn;
+ IPv4_ADDRESS LocalAddress;
+ UINT8 LocalPrefixLength;
+ CHAR8 *Pointer;
LocalPrefixLength = MAX_UINT8;
@@ -3245,7 +3315,7 @@ AsciiStrToIpv4Address (
SAFE_STRING_CONSTRAINT_CHECK ((String != NULL), RETURN_INVALID_PARAMETER);
SAFE_STRING_CONSTRAINT_CHECK ((Address != NULL), RETURN_INVALID_PARAMETER);
- for (Pointer = (CHAR8 *) String, AddressIndex = 0; AddressIndex < ARRAY_SIZE (Address->Addr) + 1;) {
+ for (Pointer = (CHAR8 *)String, AddressIndex = 0; AddressIndex < ARRAY_SIZE (Address->Addr) + 1;) {
if (!InternalAsciiIsDecimalDigitCharacter (*Pointer)) {
//
// D or P contains invalid characters.
@@ -3256,10 +3326,11 @@ AsciiStrToIpv4Address (
//
// Get D or P.
//
- Status = AsciiStrDecimalToUintnS ((CONST CHAR8 *) Pointer, &Pointer, &Uintn);
+ Status = AsciiStrDecimalToUintnS ((CONST CHAR8 *)Pointer, &Pointer, &Uintn);
if (RETURN_ERROR (Status)) {
return RETURN_UNSUPPORTED;
}
+
if (AddressIndex == ARRAY_SIZE (Address->Addr)) {
//
// It's P.
@@ -3267,7 +3338,8 @@ AsciiStrToIpv4Address (
if (Uintn > 32) {
return RETURN_UNSUPPORTED;
}
- LocalPrefixLength = (UINT8) Uintn;
+
+ LocalPrefixLength = (UINT8)Uintn;
} else {
//
// It's D.
@@ -3275,7 +3347,8 @@ AsciiStrToIpv4Address (
if (Uintn > MAX_UINT8) {
return RETURN_UNSUPPORTED;
}
- LocalAddress.Addr[AddressIndex] = (UINT8) Uintn;
+
+ LocalAddress.Addr[AddressIndex] = (UINT8)Uintn;
AddressIndex++;
}
@@ -3315,6 +3388,7 @@ AsciiStrToIpv4Address (
if (PrefixLength != NULL) {
*PrefixLength = LocalPrefixLength;
}
+
if (EndPointer != NULL) {
*EndPointer = Pointer;
}
@@ -3365,12 +3439,12 @@ AsciiStrToIpv4Address (
RETURN_STATUS
EFIAPI
AsciiStrToGuid (
- IN CONST CHAR8 *String,
- OUT GUID *Guid
+ IN CONST CHAR8 *String,
+ OUT GUID *Guid
)
{
- RETURN_STATUS Status;
- GUID LocalGuid;
+ RETURN_STATUS Status;
+ GUID LocalGuid;
//
// None of String or Guid shall be a null pointer.
@@ -3381,49 +3455,53 @@ AsciiStrToGuid (
//
// Get aabbccdd in big-endian.
//
- Status = AsciiStrHexToBytes (String, 2 * sizeof (LocalGuid.Data1), (UINT8 *) &LocalGuid.Data1, sizeof (LocalGuid.Data1));
- if (RETURN_ERROR (Status) || String[2 * sizeof (LocalGuid.Data1)] != '-') {
+ Status = AsciiStrHexToBytes (String, 2 * sizeof (LocalGuid.Data1), (UINT8 *)&LocalGuid.Data1, sizeof (LocalGuid.Data1));
+ if (RETURN_ERROR (Status) || (String[2 * sizeof (LocalGuid.Data1)] != '-')) {
return RETURN_UNSUPPORTED;
}
+
//
// Convert big-endian to little-endian.
//
LocalGuid.Data1 = SwapBytes32 (LocalGuid.Data1);
- String += 2 * sizeof (LocalGuid.Data1) + 1;
+ String += 2 * sizeof (LocalGuid.Data1) + 1;
//
// Get eeff in big-endian.
//
- Status = AsciiStrHexToBytes (String, 2 * sizeof (LocalGuid.Data2), (UINT8 *) &LocalGuid.Data2, sizeof (LocalGuid.Data2));
- if (RETURN_ERROR (Status) || String[2 * sizeof (LocalGuid.Data2)] != '-') {
+ Status = AsciiStrHexToBytes (String, 2 * sizeof (LocalGuid.Data2), (UINT8 *)&LocalGuid.Data2, sizeof (LocalGuid.Data2));
+ if (RETURN_ERROR (Status) || (String[2 * sizeof (LocalGuid.Data2)] != '-')) {
return RETURN_UNSUPPORTED;
}
+
//
// Convert big-endian to little-endian.
//
LocalGuid.Data2 = SwapBytes16 (LocalGuid.Data2);
- String += 2 * sizeof (LocalGuid.Data2) + 1;
+ String += 2 * sizeof (LocalGuid.Data2) + 1;
//
// Get gghh in big-endian.
//
- Status = AsciiStrHexToBytes (String, 2 * sizeof (LocalGuid.Data3), (UINT8 *) &LocalGuid.Data3, sizeof (LocalGuid.Data3));
- if (RETURN_ERROR (Status) || String[2 * sizeof (LocalGuid.Data3)] != '-') {
+ Status = AsciiStrHexToBytes (String, 2 * sizeof (LocalGuid.Data3), (UINT8 *)&LocalGuid.Data3, sizeof (LocalGuid.Data3));
+ if (RETURN_ERROR (Status) || (String[2 * sizeof (LocalGuid.Data3)] != '-')) {
return RETURN_UNSUPPORTED;
}
+
//
// Convert big-endian to little-endian.
//
LocalGuid.Data3 = SwapBytes16 (LocalGuid.Data3);
- String += 2 * sizeof (LocalGuid.Data3) + 1;
+ String += 2 * sizeof (LocalGuid.Data3) + 1;
//
// Get iijj.
//
Status = AsciiStrHexToBytes (String, 2 * 2, &LocalGuid.Data4[0], 2);
- if (RETURN_ERROR (Status) || String[2 * 2] != '-') {
+ if (RETURN_ERROR (Status) || (String[2 * 2] != '-')) {
return RETURN_UNSUPPORTED;
}
+
String += 2 * 2 + 1;
//
@@ -3472,13 +3550,13 @@ AsciiStrToGuid (
RETURN_STATUS
EFIAPI
AsciiStrHexToBytes (
- IN CONST CHAR8 *String,
- IN UINTN Length,
- OUT UINT8 *Buffer,
- IN UINTN MaxBufferSize
+ IN CONST CHAR8 *String,
+ IN UINTN Length,
+ OUT UINT8 *Buffer,
+ IN UINTN MaxBufferSize
)
{
- UINTN Index;
+ UINTN Index;
//
// 1. None of String or Buffer shall be a null pointer.
@@ -3511,6 +3589,7 @@ AsciiStrHexToBytes (
break;
}
}
+
if (Index != Length) {
return RETURN_UNSUPPORTED;
}
@@ -3518,17 +3597,17 @@ AsciiStrHexToBytes (
//
// Convert the hex string to bytes.
//
- for(Index = 0; Index < Length; Index++) {
-
+ for (Index = 0; Index < Length; Index++) {
//
// For even characters, write the upper nibble for each buffer byte,
// and for even characters, the lower nibble.
//
if ((Index & BIT0) == 0) {
- Buffer[Index / 2] = (UINT8) InternalAsciiHexCharToUintn (String[Index]) << 4;
+ Buffer[Index / 2] = (UINT8)InternalAsciiHexCharToUintn (String[Index]) << 4;
} else {
- Buffer[Index / 2] |= (UINT8) InternalAsciiHexCharToUintn (String[Index]);
+ Buffer[Index / 2] |= (UINT8)InternalAsciiHexCharToUintn (String[Index]);
}
}
+
return RETURN_SUCCESS;
}
diff --git a/MdePkg/Library/BaseLib/SetJump.c b/MdePkg/Library/BaseLib/SetJump.c
index 516f92f28e..22345e9cf9 100644
--- a/MdePkg/Library/BaseLib/SetJump.c
+++ b/MdePkg/Library/BaseLib/SetJump.c
@@ -6,9 +6,6 @@
**/
-
-
-
#include "BaseLibInternals.h"
/**
diff --git a/MdePkg/Library/BaseLib/String.c b/MdePkg/Library/BaseLib/String.c
index f4854f357e..98e6d31463 100644
--- a/MdePkg/Library/BaseLib/String.c
+++ b/MdePkg/Library/BaseLib/String.c
@@ -8,7 +8,6 @@
#include "BaseLibInternals.h"
-
/**
Returns the length of a Null-terminated Unicode string.
@@ -29,13 +28,13 @@
UINTN
EFIAPI
StrLen (
- IN CONST CHAR16 *String
+ IN CONST CHAR16 *String
)
{
- UINTN Length;
+ UINTN Length;
ASSERT (String != NULL);
- ASSERT (((UINTN) String & BIT0) == 0);
+ ASSERT (((UINTN)String & BIT0) == 0);
for (Length = 0; *String != L'\0'; String++, Length++) {
//
@@ -46,6 +45,7 @@ StrLen (
ASSERT (Length < PcdGet32 (PcdMaximumUnicodeStringLength));
}
}
+
return Length;
}
@@ -70,7 +70,7 @@ StrLen (
UINTN
EFIAPI
StrSize (
- IN CONST CHAR16 *String
+ IN CONST CHAR16 *String
)
{
return (StrLen (String) + 1) * sizeof (*String);
@@ -107,8 +107,8 @@ StrSize (
INTN
EFIAPI
StrCmp (
- IN CONST CHAR16 *FirstString,
- IN CONST CHAR16 *SecondString
+ IN CONST CHAR16 *FirstString,
+ IN CONST CHAR16 *SecondString
)
{
//
@@ -121,6 +121,7 @@ StrCmp (
FirstString++;
SecondString++;
}
+
return *FirstString - *SecondString;
}
@@ -159,9 +160,9 @@ StrCmp (
INTN
EFIAPI
StrnCmp (
- IN CONST CHAR16 *FirstString,
- IN CONST CHAR16 *SecondString,
- IN UINTN Length
+ IN CONST CHAR16 *FirstString,
+ IN CONST CHAR16 *SecondString,
+ IN UINTN Length
)
{
if (Length == 0) {
@@ -182,7 +183,8 @@ StrnCmp (
while ((*FirstString != L'\0') &&
(*SecondString != L'\0') &&
(*FirstString == *SecondString) &&
- (Length > 1)) {
+ (Length > 1))
+ {
FirstString++;
SecondString++;
Length--;
@@ -191,7 +193,6 @@ StrnCmp (
return *FirstString - *SecondString;
}
-
/**
Returns the first occurrence of a Null-terminated Unicode sub-string
in a Null-terminated Unicode string.
@@ -221,12 +222,12 @@ StrnCmp (
CHAR16 *
EFIAPI
StrStr (
- IN CONST CHAR16 *String,
- IN CONST CHAR16 *SearchString
+ IN CONST CHAR16 *String,
+ IN CONST CHAR16 *SearchString
)
{
- CONST CHAR16 *FirstMatch;
- CONST CHAR16 *SearchStringTmp;
+ CONST CHAR16 *FirstMatch;
+ CONST CHAR16 *SearchStringTmp;
//
// ASSERT both strings are less long than PcdMaximumUnicodeStringLength.
@@ -236,21 +237,22 @@ StrStr (
ASSERT (StrSize (SearchString) != 0);
if (*SearchString == L'\0') {
- return (CHAR16 *) String;
+ return (CHAR16 *)String;
}
while (*String != L'\0') {
SearchStringTmp = SearchString;
- FirstMatch = String;
+ FirstMatch = String;
- while ((*String == *SearchStringTmp)
- && (*String != L'\0')) {
+ while ( (*String == *SearchStringTmp)
+ && (*String != L'\0'))
+ {
String++;
SearchStringTmp++;
}
if (*SearchStringTmp == L'\0') {
- return (CHAR16 *) FirstMatch;
+ return (CHAR16 *)FirstMatch;
}
if (*String == L'\0') {
@@ -279,10 +281,10 @@ StrStr (
BOOLEAN
EFIAPI
InternalIsDecimalDigitCharacter (
- IN CHAR16 Char
+ IN CHAR16 Char
)
{
- return (BOOLEAN) (Char >= L'0' && Char <= L'9');
+ return (BOOLEAN)(Char >= L'0' && Char <= L'9');
}
/**
@@ -303,11 +305,11 @@ InternalIsDecimalDigitCharacter (
CHAR16
EFIAPI
CharToUpper (
- IN CHAR16 Char
+ IN CHAR16 Char
)
{
- if (Char >= L'a' && Char <= L'z') {
- return (CHAR16) (Char - (L'a' - L'A'));
+ if ((Char >= L'a') && (Char <= L'z')) {
+ return (CHAR16)(Char - (L'a' - L'A'));
}
return Char;
@@ -329,7 +331,7 @@ CharToUpper (
UINTN
EFIAPI
InternalHexCharToUintn (
- IN CHAR16 Char
+ IN CHAR16 Char
)
{
if (InternalIsDecimalDigitCharacter (Char)) {
@@ -356,13 +358,12 @@ InternalHexCharToUintn (
BOOLEAN
EFIAPI
InternalIsHexaDecimalDigitCharacter (
- IN CHAR16 Char
+ IN CHAR16 Char
)
{
-
- return (BOOLEAN) (InternalIsDecimalDigitCharacter (Char) ||
- (Char >= L'A' && Char <= L'F') ||
- (Char >= L'a' && Char <= L'f'));
+ return (BOOLEAN)(InternalIsDecimalDigitCharacter (Char) ||
+ (Char >= L'A' && Char <= L'F') ||
+ (Char >= L'a' && Char <= L'f'));
}
/**
@@ -402,16 +403,15 @@ InternalIsHexaDecimalDigitCharacter (
UINTN
EFIAPI
StrDecimalToUintn (
- IN CONST CHAR16 *String
+ IN CONST CHAR16 *String
)
{
- UINTN Result;
+ UINTN Result;
- StrDecimalToUintnS (String, (CHAR16 **) NULL, &Result);
+ StrDecimalToUintnS (String, (CHAR16 **)NULL, &Result);
return Result;
}
-
/**
Convert a Null-terminated Unicode decimal string to a value of
type UINT64.
@@ -449,12 +449,12 @@ StrDecimalToUintn (
UINT64
EFIAPI
StrDecimalToUint64 (
- IN CONST CHAR16 *String
+ IN CONST CHAR16 *String
)
{
- UINT64 Result;
+ UINT64 Result;
- StrDecimalToUint64S (String, (CHAR16 **) NULL, &Result);
+ StrDecimalToUint64S (String, (CHAR16 **)NULL, &Result);
return Result;
}
@@ -496,16 +496,15 @@ StrDecimalToUint64 (
UINTN
EFIAPI
StrHexToUintn (
- IN CONST CHAR16 *String
+ IN CONST CHAR16 *String
)
{
- UINTN Result;
+ UINTN Result;
- StrHexToUintnS (String, (CHAR16 **) NULL, &Result);
+ StrHexToUintnS (String, (CHAR16 **)NULL, &Result);
return Result;
}
-
/**
Convert a Null-terminated Unicode hexadecimal string to a value of type UINT64.
@@ -544,12 +543,12 @@ StrHexToUintn (
UINT64
EFIAPI
StrHexToUint64 (
- IN CONST CHAR16 *String
+ IN CONST CHAR16 *String
)
{
- UINT64 Result;
+ UINT64 Result;
- StrHexToUint64S (String, (CHAR16 **) NULL, &Result);
+ StrHexToUint64S (String, (CHAR16 **)NULL, &Result);
return Result;
}
@@ -569,10 +568,10 @@ StrHexToUint64 (
BOOLEAN
EFIAPI
InternalAsciiIsDecimalDigitCharacter (
- IN CHAR8 Char
+ IN CHAR8 Char
)
{
- return (BOOLEAN) (Char >= '0' && Char <= '9');
+ return (BOOLEAN)(Char >= '0' && Char <= '9');
}
/**
@@ -592,16 +591,14 @@ InternalAsciiIsDecimalDigitCharacter (
BOOLEAN
EFIAPI
InternalAsciiIsHexaDecimalDigitCharacter (
- IN CHAR8 Char
+ IN CHAR8 Char
)
{
-
- return (BOOLEAN) (InternalAsciiIsDecimalDigitCharacter (Char) ||
- (Char >= 'A' && Char <= 'F') ||
- (Char >= 'a' && Char <= 'f'));
+ return (BOOLEAN)(InternalAsciiIsDecimalDigitCharacter (Char) ||
+ (Char >= 'A' && Char <= 'F') ||
+ (Char >= 'a' && Char <= 'f'));
}
-
/**
Returns the length of a Null-terminated ASCII string.
@@ -622,10 +619,10 @@ InternalAsciiIsHexaDecimalDigitCharacter (
UINTN
EFIAPI
AsciiStrLen (
- IN CONST CHAR8 *String
+ IN CONST CHAR8 *String
)
{
- UINTN Length;
+ UINTN Length;
ASSERT (String != NULL);
@@ -638,6 +635,7 @@ AsciiStrLen (
ASSERT (Length < PcdGet32 (PcdMaximumAsciiStringLength));
}
}
+
return Length;
}
@@ -661,7 +659,7 @@ AsciiStrLen (
UINTN
EFIAPI
AsciiStrSize (
- IN CONST CHAR8 *String
+ IN CONST CHAR8 *String
)
{
return (AsciiStrLen (String) + 1) * sizeof (*String);
@@ -696,8 +694,8 @@ AsciiStrSize (
INTN
EFIAPI
AsciiStrCmp (
- IN CONST CHAR8 *FirstString,
- IN CONST CHAR8 *SecondString
+ IN CONST CHAR8 *FirstString,
+ IN CONST CHAR8 *SecondString
)
{
//
@@ -730,10 +728,10 @@ AsciiStrCmp (
CHAR8
EFIAPI
AsciiCharToUpper (
- IN CHAR8 Chr
+ IN CHAR8 Chr
)
{
- return (UINT8) ((Chr >= 'a' && Chr <= 'z') ? Chr - ('a' - 'A') : Chr);
+ return (UINT8)((Chr >= 'a' && Chr <= 'z') ? Chr - ('a' - 'A') : Chr);
}
/**
@@ -752,7 +750,7 @@ AsciiCharToUpper (
UINTN
EFIAPI
InternalAsciiHexCharToUintn (
- IN CHAR8 Char
+ IN CHAR8 Char
)
{
if (InternalIsDecimalDigitCharacter (Char)) {
@@ -762,7 +760,6 @@ InternalAsciiHexCharToUintn (
return (10 + AsciiCharToUpper (Char) - 'A');
}
-
/**
Performs a case insensitive comparison of two Null-terminated ASCII strings,
and returns the difference between the first mismatched ASCII characters.
@@ -795,8 +792,8 @@ InternalAsciiHexCharToUintn (
INTN
EFIAPI
AsciiStriCmp (
- IN CONST CHAR8 *FirstString,
- IN CONST CHAR8 *SecondString
+ IN CONST CHAR8 *FirstString,
+ IN CONST CHAR8 *SecondString
)
{
CHAR8 UpperFirstString;
@@ -853,9 +850,9 @@ AsciiStriCmp (
INTN
EFIAPI
AsciiStrnCmp (
- IN CONST CHAR8 *FirstString,
- IN CONST CHAR8 *SecondString,
- IN UINTN Length
+ IN CONST CHAR8 *FirstString,
+ IN CONST CHAR8 *SecondString,
+ IN UINTN Length
)
{
if (Length == 0) {
@@ -875,15 +872,16 @@ AsciiStrnCmp (
while ((*FirstString != '\0') &&
(*SecondString != '\0') &&
(*FirstString == *SecondString) &&
- (Length > 1)) {
+ (Length > 1))
+ {
FirstString++;
SecondString++;
Length--;
}
+
return *FirstString - *SecondString;
}
-
/**
Returns the first occurrence of a Null-terminated ASCII sub-string
in a Null-terminated ASCII string.
@@ -911,12 +909,12 @@ AsciiStrnCmp (
CHAR8 *
EFIAPI
AsciiStrStr (
- IN CONST CHAR8 *String,
- IN CONST CHAR8 *SearchString
+ IN CONST CHAR8 *String,
+ IN CONST CHAR8 *SearchString
)
{
- CONST CHAR8 *FirstMatch;
- CONST CHAR8 *SearchStringTmp;
+ CONST CHAR8 *FirstMatch;
+ CONST CHAR8 *SearchStringTmp;
//
// ASSERT both strings are less long than PcdMaximumAsciiStringLength
@@ -925,21 +923,22 @@ AsciiStrStr (
ASSERT (AsciiStrSize (SearchString) != 0);
if (*SearchString == '\0') {
- return (CHAR8 *) String;
+ return (CHAR8 *)String;
}
while (*String != '\0') {
SearchStringTmp = SearchString;
- FirstMatch = String;
+ FirstMatch = String;
- while ((*String == *SearchStringTmp)
- && (*String != '\0')) {
+ while ( (*String == *SearchStringTmp)
+ && (*String != '\0'))
+ {
String++;
SearchStringTmp++;
}
if (*SearchStringTmp == '\0') {
- return (CHAR8 *) FirstMatch;
+ return (CHAR8 *)FirstMatch;
}
if (*String == '\0') {
@@ -985,16 +984,15 @@ AsciiStrStr (
UINTN
EFIAPI
AsciiStrDecimalToUintn (
- IN CONST CHAR8 *String
+ IN CONST CHAR8 *String
)
{
- UINTN Result;
+ UINTN Result;
- AsciiStrDecimalToUintnS (String, (CHAR8 **) NULL, &Result);
+ AsciiStrDecimalToUintnS (String, (CHAR8 **)NULL, &Result);
return Result;
}
-
/**
Convert a Null-terminated ASCII decimal string to a value of type
UINT64.
@@ -1028,12 +1026,12 @@ AsciiStrDecimalToUintn (
UINT64
EFIAPI
AsciiStrDecimalToUint64 (
- IN CONST CHAR8 *String
+ IN CONST CHAR8 *String
)
{
- UINT64 Result;
+ UINT64 Result;
- AsciiStrDecimalToUint64S (String, (CHAR8 **) NULL, &Result);
+ AsciiStrDecimalToUint64S (String, (CHAR8 **)NULL, &Result);
return Result;
}
@@ -1074,16 +1072,15 @@ AsciiStrDecimalToUint64 (
UINTN
EFIAPI
AsciiStrHexToUintn (
- IN CONST CHAR8 *String
+ IN CONST CHAR8 *String
)
{
- UINTN Result;
+ UINTN Result;
- AsciiStrHexToUintnS (String, (CHAR8 **) NULL, &Result);
+ AsciiStrHexToUintnS (String, (CHAR8 **)NULL, &Result);
return Result;
}
-
/**
Convert a Null-terminated ASCII hexadecimal string to a value of type UINT64.
@@ -1121,17 +1118,16 @@ AsciiStrHexToUintn (
UINT64
EFIAPI
AsciiStrHexToUint64 (
- IN CONST CHAR8 *String
+ IN CONST CHAR8 *String
)
{
- UINT64 Result;
+ UINT64 Result;
- AsciiStrHexToUint64S (String, (CHAR8 **) NULL, &Result);
+ AsciiStrHexToUint64S (String, (CHAR8 **)NULL, &Result);
return Result;
}
-
-STATIC CHAR8 EncodingTable[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
+STATIC CHAR8 EncodingTable[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
"abcdefghijklmnopqrstuvwxyz"
"0123456789+/";
@@ -1158,14 +1154,13 @@ RETURN_STATUS
EFIAPI
Base64Encode (
IN CONST UINT8 *Source,
- IN UINTN SourceLength,
+ IN UINTN SourceLength,
OUT CHAR8 *Destination OPTIONAL,
IN OUT UINTN *DestinationSize
)
{
-
- UINTN RequiredSize;
- UINTN Left;
+ UINTN RequiredSize;
+ UINTN Left;
//
// Check pointers, and SourceLength is valid
@@ -1182,15 +1177,16 @@ Base64Encode (
*DestinationSize = 1;
return RETURN_BUFFER_TOO_SMALL;
}
+
*DestinationSize = 1;
- *Destination = '\0';
+ *Destination = '\0';
return RETURN_SUCCESS;
}
//
// Check if SourceLength or DestinationSize is valid
//
- if ((SourceLength >= (MAX_ADDRESS - (UINTN)Source)) || (*DestinationSize >= (MAX_ADDRESS - (UINTN)Destination))){
+ if ((SourceLength >= (MAX_ADDRESS - (UINTN)Source)) || (*DestinationSize >= (MAX_ADDRESS - (UINTN)Destination))) {
return RETURN_INVALID_PARAMETER;
}
@@ -1198,7 +1194,7 @@ Base64Encode (
// 4 ascii per 3 bytes + NULL
//
RequiredSize = ((SourceLength + 2) / 3) * 4 + 1;
- if ((Destination == NULL) || *DestinationSize < RequiredSize) {
+ if ((Destination == NULL) || (*DestinationSize < RequiredSize)) {
*DestinationSize = RequiredSize;
return RETURN_BUFFER_TOO_SMALL;
}
@@ -1209,13 +1205,12 @@ Base64Encode (
// Encode 24 bits (three bytes) into 4 ascii characters
//
while (Left >= 3) {
-
- *Destination++ = EncodingTable[( Source[0] & 0xfc) >> 2 ];
+ *Destination++ = EncodingTable[(Source[0] & 0xfc) >> 2];
*Destination++ = EncodingTable[((Source[0] & 0x03) << 4) + ((Source[1] & 0xf0) >> 4)];
*Destination++ = EncodingTable[((Source[1] & 0x0f) << 2) + ((Source[2] & 0xc0) >> 6)];
- *Destination++ = EncodingTable[( Source[2] & 0x3f)];
- Left -= 3;
- Source += 3;
+ *Destination++ = EncodingTable[(Source[2] & 0x3f)];
+ Left -= 3;
+ Source += 3;
}
//
@@ -1233,7 +1228,7 @@ Base64Encode (
//
// One more data byte, two pad characters
//
- *Destination++ = EncodingTable[( Source[0] & 0xfc) >> 2];
+ *Destination++ = EncodingTable[(Source[0] & 0xfc) >> 2];
*Destination++ = EncodingTable[((Source[0] & 0x03) << 4)];
*Destination++ = '=';
*Destination++ = '=';
@@ -1243,12 +1238,13 @@ Base64Encode (
//
// Two more data bytes, and one pad character
//
- *Destination++ = EncodingTable[( Source[0] & 0xfc) >> 2];
+ *Destination++ = EncodingTable[(Source[0] & 0xfc) >> 2];
*Destination++ = EncodingTable[((Source[0] & 0x03) << 4) + ((Source[1] & 0xf0) >> 4)];
*Destination++ = EncodingTable[((Source[1] & 0x0f) << 2)];
*Destination++ = '=';
break;
- }
+ }
+
//
// Add terminating NULL
//
@@ -1341,20 +1337,20 @@ Base64Encode (
RETURN_STATUS
EFIAPI
Base64Decode (
- IN CONST CHAR8 *Source OPTIONAL,
- IN UINTN SourceSize,
- OUT UINT8 *Destination OPTIONAL,
- IN OUT UINTN *DestinationSize
+ IN CONST CHAR8 *Source OPTIONAL,
+ IN UINTN SourceSize,
+ OUT UINT8 *Destination OPTIONAL,
+ IN OUT UINTN *DestinationSize
)
{
- BOOLEAN PaddingMode;
- UINTN SixBitGroupsConsumed;
- UINT32 Accumulator;
- UINTN OriginalDestinationSize;
- UINTN SourceIndex;
- CHAR8 SourceChar;
- UINT32 Base64Value;
- UINT8 DestinationOctet;
+ BOOLEAN PaddingMode;
+ UINTN SixBitGroupsConsumed;
+ UINT32 Accumulator;
+ UINTN OriginalDestinationSize;
+ UINTN SourceIndex;
+ CHAR8 SourceChar;
+ UINT32 Base64Value;
+ UINT8 DestinationOctet;
if (DestinationSize == NULL) {
return RETURN_INVALID_PARAMETER;
@@ -1397,7 +1393,7 @@ Base64Decode (
//
// Check for overlap.
//
- if (Source != NULL && Destination != NULL) {
+ if ((Source != NULL) && (Destination != NULL)) {
//
// Both arrays have been provided, and we know from earlier that each array
// is valid in itself.
@@ -1436,8 +1432,9 @@ Base64Decode (
//
// Whitespace is ignored at all positions (regardless of padding mode).
//
- if (SourceChar == '\t' || SourceChar == '\n' || SourceChar == '\v' ||
- SourceChar == '\f' || SourceChar == '\r' || SourceChar == ' ') {
+ if ((SourceChar == '\t') || (SourceChar == '\n') || (SourceChar == '\v') ||
+ (SourceChar == '\f') || (SourceChar == '\r') || (SourceChar == ' '))
+ {
continue;
}
@@ -1451,10 +1448,11 @@ Base64Decode (
// "=" padding characters.
//
if (PaddingMode) {
- if (SourceChar == '=' && SixBitGroupsConsumed == 3) {
+ if ((SourceChar == '=') && (SixBitGroupsConsumed == 3)) {
SixBitGroupsConsumed = 0;
continue;
}
+
return RETURN_INVALID_PARAMETER;
}
@@ -1462,11 +1460,11 @@ Base64Decode (
// When not in padding mode, decode Base64Value based on RFC4648, "Table 1:
// The Base 64 Alphabet".
//
- if ('A' <= SourceChar && SourceChar <= 'Z') {
+ if (('A' <= SourceChar) && (SourceChar <= 'Z')) {
Base64Value = SourceChar - 'A';
- } else if ('a' <= SourceChar && SourceChar <= 'z') {
+ } else if (('a' <= SourceChar) && (SourceChar <= 'z')) {
Base64Value = 26 + (SourceChar - 'a');
- } else if ('0' <= SourceChar && SourceChar <= '9') {
+ } else if (('0' <= SourceChar) && (SourceChar <= '9')) {
Base64Value = 52 + (SourceChar - '0');
} else if (SourceChar == '+') {
Base64Value = 62;
@@ -1530,38 +1528,38 @@ Base64Decode (
Accumulator = (Accumulator << 6) | Base64Value;
SixBitGroupsConsumed++;
switch (SixBitGroupsConsumed) {
- case 1:
- //
- // No octet to spill after consuming the first 6-bit group of the
- // quantum; advance to the next source character.
- //
- continue;
- case 2:
- //
- // 12 bits accumulated (6 pending + 6 new); prepare for spilling an
- // octet. 4 bits remain pending.
- //
- DestinationOctet = (UINT8)(Accumulator >> 4);
- Accumulator &= 0xF;
- break;
- case 3:
- //
- // 10 bits accumulated (4 pending + 6 new); prepare for spilling an
- // octet. 2 bits remain pending.
- //
- DestinationOctet = (UINT8)(Accumulator >> 2);
- Accumulator &= 0x3;
- break;
- default:
- ASSERT (SixBitGroupsConsumed == 4);
- //
- // 8 bits accumulated (2 pending + 6 new); prepare for spilling an octet.
- // The quantum is complete, 0 bits remain pending.
- //
- DestinationOctet = (UINT8)Accumulator;
- Accumulator = 0;
- SixBitGroupsConsumed = 0;
- break;
+ case 1:
+ //
+ // No octet to spill after consuming the first 6-bit group of the
+ // quantum; advance to the next source character.
+ //
+ continue;
+ case 2:
+ //
+ // 12 bits accumulated (6 pending + 6 new); prepare for spilling an
+ // octet. 4 bits remain pending.
+ //
+ DestinationOctet = (UINT8)(Accumulator >> 4);
+ Accumulator &= 0xF;
+ break;
+ case 3:
+ //
+ // 10 bits accumulated (4 pending + 6 new); prepare for spilling an
+ // octet. 2 bits remain pending.
+ //
+ DestinationOctet = (UINT8)(Accumulator >> 2);
+ Accumulator &= 0x3;
+ break;
+ default:
+ ASSERT (SixBitGroupsConsumed == 4);
+ //
+ // 8 bits accumulated (2 pending + 6 new); prepare for spilling an octet.
+ // The quantum is complete, 0 bits remain pending.
+ //
+ DestinationOctet = (UINT8)Accumulator;
+ Accumulator = 0;
+ SixBitGroupsConsumed = 0;
+ break;
}
//
@@ -1572,6 +1570,7 @@ Base64Decode (
ASSERT (Destination != NULL);
Destination[*DestinationSize] = DestinationOctet;
}
+
(*DestinationSize)++;
//
@@ -1592,6 +1591,7 @@ Base64Decode (
if (*DestinationSize <= OriginalDestinationSize) {
return RETURN_SUCCESS;
}
+
return RETURN_BUFFER_TOO_SMALL;
}
@@ -1611,11 +1611,11 @@ Base64Decode (
UINT8
EFIAPI
DecimalToBcd8 (
- IN UINT8 Value
+ IN UINT8 Value
)
{
ASSERT (Value < 100);
- return (UINT8) (((Value / 10) << 4) | (Value % 10));
+ return (UINT8)(((Value / 10) << 4) | (Value % 10));
}
/**
@@ -1635,10 +1635,10 @@ DecimalToBcd8 (
UINT8
EFIAPI
BcdToDecimal8 (
- IN UINT8 Value
+ IN UINT8 Value
)
{
ASSERT (Value < 0xa0);
ASSERT ((Value & 0xf) < 0xa);
- return (UINT8) ((Value >> 4) * 10 + (Value & 0xf));
+ return (UINT8)((Value >> 4) * 10 + (Value & 0xf));
}
diff --git a/MdePkg/Library/BaseLib/SwapBytes16.c b/MdePkg/Library/BaseLib/SwapBytes16.c
index 52e7f71d25..12d452f891 100644
--- a/MdePkg/Library/BaseLib/SwapBytes16.c
+++ b/MdePkg/Library/BaseLib/SwapBytes16.c
@@ -6,9 +6,6 @@
**/
-
-
-
#include "BaseLibInternals.h"
/**
@@ -26,8 +23,8 @@
UINT16
EFIAPI
SwapBytes16 (
- IN UINT16 Value
+ IN UINT16 Value
)
{
- return (UINT16) ((Value<< 8) | (Value>> 8));
+ return (UINT16)((Value<< 8) | (Value>> 8));
}
diff --git a/MdePkg/Library/BaseLib/SwapBytes32.c b/MdePkg/Library/BaseLib/SwapBytes32.c
index 5109ad512e..206a846528 100644
--- a/MdePkg/Library/BaseLib/SwapBytes32.c
+++ b/MdePkg/Library/BaseLib/SwapBytes32.c
@@ -6,9 +6,6 @@
**/
-
-
-
#include "BaseLibInternals.h"
/**
@@ -26,14 +23,14 @@
UINT32
EFIAPI
SwapBytes32 (
- IN UINT32 Value
+ IN UINT32 Value
)
{
UINT32 LowerBytes;
UINT32 HigherBytes;
- LowerBytes = (UINT32) SwapBytes16 ((UINT16) Value);
- HigherBytes = (UINT32) SwapBytes16 ((UINT16) (Value >> 16));
+ LowerBytes = (UINT32)SwapBytes16 ((UINT16)Value);
+ HigherBytes = (UINT32)SwapBytes16 ((UINT16)(Value >> 16));
return (LowerBytes << 16 | HigherBytes);
}
diff --git a/MdePkg/Library/BaseLib/SwapBytes64.c b/MdePkg/Library/BaseLib/SwapBytes64.c
index 500f76d484..85102c42e6 100644
--- a/MdePkg/Library/BaseLib/SwapBytes64.c
+++ b/MdePkg/Library/BaseLib/SwapBytes64.c
@@ -6,9 +6,6 @@
**/
-
-
-
#include "BaseLibInternals.h"
/**
@@ -26,7 +23,7 @@
UINT64
EFIAPI
SwapBytes64 (
- IN UINT64 Value
+ IN UINT64 Value
)
{
return InternalMathSwapBytes64 (Value);
diff --git a/MdePkg/Library/BaseLib/SwitchStack.c b/MdePkg/Library/BaseLib/SwitchStack.c
index 3eb39d4d1d..954e863fc1 100644
--- a/MdePkg/Library/BaseLib/SwitchStack.c
+++ b/MdePkg/Library/BaseLib/SwitchStack.c
@@ -47,7 +47,7 @@ SwitchStack (
...
)
{
- VA_LIST Marker;
+ VA_LIST Marker;
ASSERT (EntryPoint != NULL);
ASSERT (NewStack != NULL);
diff --git a/MdePkg/Library/BaseLib/Unaligned.c b/MdePkg/Library/BaseLib/Unaligned.c
index a419cb85e5..74d76e8316 100644
--- a/MdePkg/Library/BaseLib/Unaligned.c
+++ b/MdePkg/Library/BaseLib/Unaligned.c
@@ -6,10 +6,8 @@
**/
-
#include "BaseLibInternals.h"
-
/**
Reads a 16-bit value from memory that may be unaligned.
@@ -26,7 +24,7 @@
UINT16
EFIAPI
ReadUnaligned16 (
- IN CONST UINT16 *Buffer
+ IN CONST UINT16 *Buffer
)
{
ASSERT (Buffer != NULL);
@@ -52,8 +50,8 @@ ReadUnaligned16 (
UINT16
EFIAPI
WriteUnaligned16 (
- OUT UINT16 *Buffer,
- IN UINT16 Value
+ OUT UINT16 *Buffer,
+ IN UINT16 Value
)
{
ASSERT (Buffer != NULL);
@@ -77,7 +75,7 @@ WriteUnaligned16 (
UINT32
EFIAPI
ReadUnaligned24 (
- IN CONST UINT32 *Buffer
+ IN CONST UINT32 *Buffer
)
{
ASSERT (Buffer != NULL);
@@ -103,8 +101,8 @@ ReadUnaligned24 (
UINT32
EFIAPI
WriteUnaligned24 (
- OUT UINT32 *Buffer,
- IN UINT32 Value
+ OUT UINT32 *Buffer,
+ IN UINT32 Value
)
{
ASSERT (Buffer != NULL);
@@ -129,7 +127,7 @@ WriteUnaligned24 (
UINT32
EFIAPI
ReadUnaligned32 (
- IN CONST UINT32 *Buffer
+ IN CONST UINT32 *Buffer
)
{
ASSERT (Buffer != NULL);
@@ -155,8 +153,8 @@ ReadUnaligned32 (
UINT32
EFIAPI
WriteUnaligned32 (
- OUT UINT32 *Buffer,
- IN UINT32 Value
+ OUT UINT32 *Buffer,
+ IN UINT32 Value
)
{
ASSERT (Buffer != NULL);
@@ -180,7 +178,7 @@ WriteUnaligned32 (
UINT64
EFIAPI
ReadUnaligned64 (
- IN CONST UINT64 *Buffer
+ IN CONST UINT64 *Buffer
)
{
ASSERT (Buffer != NULL);
@@ -206,8 +204,8 @@ ReadUnaligned64 (
UINT64
EFIAPI
WriteUnaligned64 (
- OUT UINT64 *Buffer,
- IN UINT64 Value
+ OUT UINT64 *Buffer,
+ IN UINT64 Value
)
{
ASSERT (Buffer != NULL);
diff --git a/MdePkg/Library/BaseLib/UnitTestHost.c b/MdePkg/Library/BaseLib/UnitTestHost.c
index 79eec7caca..b8831407f9 100644
--- a/MdePkg/Library/BaseLib/UnitTestHost.c
+++ b/MdePkg/Library/BaseLib/UnitTestHost.c
@@ -11,7 +11,7 @@
///
/// Module global variable for simple system emulation of interrupt state
///
-STATIC BOOLEAN mUnitTestHostBaseLibInterruptState;
+STATIC BOOLEAN mUnitTestHostBaseLibInterruptState;
/**
Enables CPU interrupts.
diff --git a/MdePkg/Library/BaseLib/X64/CpuBreakpoint.c b/MdePkg/Library/BaseLib/X64/CpuBreakpoint.c
index c626ef8ece..8c03934ef5 100644
--- a/MdePkg/Library/BaseLib/X64/CpuBreakpoint.c
+++ b/MdePkg/Library/BaseLib/X64/CpuBreakpoint.c
@@ -6,12 +6,14 @@
**/
-
/**
Microsoft Visual Studio 7.1 Function Prototypes for I/O Intrinsics.
**/
-void __debugbreak (VOID);
+void
+__debugbreak (
+ VOID
+ );
#pragma intrinsic(__debugbreak)
@@ -30,4 +32,3 @@ CpuBreakpoint (
{
__debugbreak ();
}
-
diff --git a/MdePkg/Library/BaseLib/X64/GccInline.c b/MdePkg/Library/BaseLib/X64/GccInline.c
index 40a208f198..c21eb0622e 100644
--- a/MdePkg/Library/BaseLib/X64/GccInline.c
+++ b/MdePkg/Library/BaseLib/X64/GccInline.c
@@ -7,12 +7,8 @@
**/
-
#include "BaseLibInternals.h"
-
-
-
/**
Used to serialize load and store operations.
@@ -32,7 +28,6 @@ MemoryFence (
__asm__ __volatile__ ("":::"memory");
}
-
/**
Requests CPU to pause for a short period of time.
@@ -49,7 +44,6 @@ CpuPause (
__asm__ __volatile__ ("pause");
}
-
/**
Generates a breakpoint on the CPU.
@@ -66,7 +60,6 @@ CpuBreakpoint (
__asm__ __volatile__ ("int $3");
}
-
/**
Reads the current value of the EFLAGS register.
@@ -83,13 +76,13 @@ AsmReadEflags (
VOID
)
{
- UINTN Eflags;
+ UINTN Eflags;
__asm__ __volatile__ (
"pushfq \n\t"
"pop %0 "
: "=r" (Eflags) // %0
- );
+ );
return Eflags;
}
@@ -107,17 +100,16 @@ AsmReadEflags (
VOID
EFIAPI
InternalX86FxSave (
- OUT IA32_FX_BUFFER *Buffer
+ OUT IA32_FX_BUFFER *Buffer
)
{
__asm__ __volatile__ (
"fxsave %0"
:
: "m" (*Buffer) // %0
- );
+ );
}
-
/**
Restores the current floating point/SSE/SSE2 context from a buffer.
@@ -131,17 +123,16 @@ InternalX86FxSave (
VOID
EFIAPI
InternalX86FxRestore (
- IN CONST IA32_FX_BUFFER *Buffer
+ IN CONST IA32_FX_BUFFER *Buffer
)
{
__asm__ __volatile__ (
"fxrstor %0"
:
: "m" (*Buffer) // %0
- );
+ );
}
-
/**
Reads the current value of 64-bit MMX Register #0 (MM0).
@@ -162,12 +153,11 @@ AsmReadMm0 (
__asm__ __volatile__ (
"movd %%mm0, %0 \n\t"
: "=r" (Data) // %0
- );
+ );
return Data;
}
-
/**
Reads the current value of 64-bit MMX Register #1 (MM1).
@@ -188,12 +178,11 @@ AsmReadMm1 (
__asm__ __volatile__ (
"movd %%mm1, %0 \n\t"
: "=r" (Data) // %0
- );
+ );
return Data;
}
-
/**
Reads the current value of 64-bit MMX Register #2 (MM2).
@@ -214,12 +203,11 @@ AsmReadMm2 (
__asm__ __volatile__ (
"movd %%mm2, %0 \n\t"
: "=r" (Data) // %0
- );
+ );
return Data;
}
-
/**
Reads the current value of 64-bit MMX Register #3 (MM3).
@@ -240,12 +228,11 @@ AsmReadMm3 (
__asm__ __volatile__ (
"movd %%mm3, %0 \n\t"
: "=r" (Data) // %0
- );
+ );
return Data;
}
-
/**
Reads the current value of 64-bit MMX Register #4 (MM4).
@@ -266,12 +253,11 @@ AsmReadMm4 (
__asm__ __volatile__ (
"movd %%mm4, %0 \n\t"
: "=r" (Data) // %0
- );
+ );
return Data;
}
-
/**
Reads the current value of 64-bit MMX Register #5 (MM5).
@@ -292,12 +278,11 @@ AsmReadMm5 (
__asm__ __volatile__ (
"movd %%mm5, %0 \n\t"
: "=r" (Data) // %0
- );
+ );
return Data;
}
-
/**
Reads the current value of 64-bit MMX Register #6 (MM6).
@@ -318,12 +303,11 @@ AsmReadMm6 (
__asm__ __volatile__ (
"movd %%mm6, %0 \n\t"
: "=r" (Data) // %0
- );
+ );
return Data;
}
-
/**
Reads the current value of 64-bit MMX Register #7 (MM7).
@@ -344,12 +328,11 @@ AsmReadMm7 (
__asm__ __volatile__ (
"movd %%mm7, %0 \n\t"
: "=r" (Data) // %0
- );
+ );
return Data;
}
-
/**
Writes the current value of 64-bit MMX Register #0 (MM0).
@@ -362,17 +345,16 @@ AsmReadMm7 (
VOID
EFIAPI
AsmWriteMm0 (
- IN UINT64 Value
+ IN UINT64 Value
)
{
__asm__ __volatile__ (
"movd %0, %%mm0" // %0
:
: "m" (Value)
- );
+ );
}
-
/**
Writes the current value of 64-bit MMX Register #1 (MM1).
@@ -385,17 +367,16 @@ AsmWriteMm0 (
VOID
EFIAPI
AsmWriteMm1 (
- IN UINT64 Value
+ IN UINT64 Value
)
{
__asm__ __volatile__ (
"movd %0, %%mm1" // %0
:
: "m" (Value)
- );
+ );
}
-
/**
Writes the current value of 64-bit MMX Register #2 (MM2).
@@ -408,17 +389,16 @@ AsmWriteMm1 (
VOID
EFIAPI
AsmWriteMm2 (
- IN UINT64 Value
+ IN UINT64 Value
)
{
__asm__ __volatile__ (
"movd %0, %%mm2" // %0
:
: "m" (Value)
- );
+ );
}
-
/**
Writes the current value of 64-bit MMX Register #3 (MM3).
@@ -431,17 +411,16 @@ AsmWriteMm2 (
VOID
EFIAPI
AsmWriteMm3 (
- IN UINT64 Value
+ IN UINT64 Value
)
{
__asm__ __volatile__ (
"movd %0, %%mm3" // %0
:
: "m" (Value)
- );
+ );
}
-
/**
Writes the current value of 64-bit MMX Register #4 (MM4).
@@ -454,17 +433,16 @@ AsmWriteMm3 (
VOID
EFIAPI
AsmWriteMm4 (
- IN UINT64 Value
+ IN UINT64 Value
)
{
__asm__ __volatile__ (
"movd %0, %%mm4" // %0
:
: "m" (Value)
- );
+ );
}
-
/**
Writes the current value of 64-bit MMX Register #5 (MM5).
@@ -477,17 +455,16 @@ AsmWriteMm4 (
VOID
EFIAPI
AsmWriteMm5 (
- IN UINT64 Value
+ IN UINT64 Value
)
{
__asm__ __volatile__ (
"movd %0, %%mm5" // %0
:
: "m" (Value)
- );
+ );
}
-
/**
Writes the current value of 64-bit MMX Register #6 (MM6).
@@ -500,17 +477,16 @@ AsmWriteMm5 (
VOID
EFIAPI
AsmWriteMm6 (
- IN UINT64 Value
+ IN UINT64 Value
)
{
__asm__ __volatile__ (
"movd %0, %%mm6" // %0
:
: "m" (Value)
- );
+ );
}
-
/**
Writes the current value of 64-bit MMX Register #7 (MM7).
@@ -523,17 +499,16 @@ AsmWriteMm6 (
VOID
EFIAPI
AsmWriteMm7 (
- IN UINT64 Value
+ IN UINT64 Value
)
{
__asm__ __volatile__ (
"movd %0, %%mm7" // %0
:
: "m" (Value)
- );
+ );
}
-
/**
Reads the current value of Time Stamp Counter (TSC).
@@ -556,7 +531,7 @@ AsmReadTsc (
"rdtsc"
: "=a" (LowData),
"=d" (HiData)
- );
+ );
return (((UINT64)HiData) << 32) | LowData;
}
diff --git a/MdePkg/Library/BaseLib/X64/GccInlinePriv.c b/MdePkg/Library/BaseLib/X64/GccInlinePriv.c
index c3feb9f922..f63e03e0c5 100644
--- a/MdePkg/Library/BaseLib/X64/GccInlinePriv.c
+++ b/MdePkg/Library/BaseLib/X64/GccInlinePriv.c
@@ -8,7 +8,6 @@
**/
-
#include "BaseLibInternals.h"
#include <Library/RegisterFilterLib.h>
@@ -27,7 +26,6 @@ EnableInterrupts (
__asm__ __volatile__ ("sti"::: "memory");
}
-
/**
Disables CPU interrupts.
@@ -60,13 +58,13 @@ DisableInterrupts (
UINT64
EFIAPI
AsmReadMsr64 (
- IN UINT32 Index
+ IN UINT32 Index
)
{
- UINT32 LowData;
- UINT32 HighData;
- UINT64 Value;
- BOOLEAN Flag;
+ UINT32 LowData;
+ UINT32 HighData;
+ UINT64 Value;
+ BOOLEAN Flag;
Flag = FilterBeforeMsrRead (Index, &Value);
if (Flag) {
@@ -75,9 +73,10 @@ AsmReadMsr64 (
: "=a" (LowData), // %0
"=d" (HighData) // %1
: "c" (Index) // %2
- );
+ );
Value = (((UINT64)HighData) << 32) | LowData;
}
+
FilterAfterMsrRead (Index, &Value);
return Value;
@@ -103,13 +102,13 @@ AsmReadMsr64 (
UINT64
EFIAPI
AsmWriteMsr64 (
- IN UINT32 Index,
- IN UINT64 Value
+ IN UINT32 Index,
+ IN UINT64 Value
)
{
- UINT32 LowData;
- UINT32 HighData;
- BOOLEAN Flag;
+ UINT32 LowData;
+ UINT32 HighData;
+ BOOLEAN Flag;
Flag = FilterBeforeMsrWrite (Index, &Value);
if (Flag) {
@@ -121,8 +120,9 @@ AsmWriteMsr64 (
: "c" (Index),
"a" (LowData),
"d" (HighData)
- );
+ );
}
+
FilterAfterMsrWrite (Index, &Value);
return Value;
@@ -144,17 +144,16 @@ AsmReadCr0 (
VOID
)
{
- UINTN Data;
+ UINTN Data;
__asm__ __volatile__ (
"mov %%cr0,%0"
: "=r" (Data) // %0
- );
+ );
return Data;
}
-
/**
Reads the current value of the Control Register 2 (CR2).
@@ -171,12 +170,12 @@ AsmReadCr2 (
VOID
)
{
- UINTN Data;
+ UINTN Data;
__asm__ __volatile__ (
"mov %%cr2, %0"
: "=r" (Data) // %0
- );
+ );
return Data;
}
@@ -197,17 +196,16 @@ AsmReadCr3 (
VOID
)
{
- UINTN Data;
+ UINTN Data;
__asm__ __volatile__ (
"mov %%cr3, %0"
: "=r" (Data) // %0
- );
+ );
return Data;
}
-
/**
Reads the current value of the Control Register 4 (CR4).
@@ -224,17 +222,16 @@ AsmReadCr4 (
VOID
)
{
- UINTN Data;
+ UINTN Data;
__asm__ __volatile__ (
"mov %%cr4, %0"
: "=r" (Data) // %0
- );
+ );
return Data;
}
-
/**
Writes a value to Control Register 0 (CR0).
@@ -256,11 +253,10 @@ AsmWriteCr0 (
"mov %0, %%cr0"
:
: "r" (Cr0)
- );
+ );
return Cr0;
}
-
/**
Writes a value to Control Register 2 (CR2).
@@ -282,11 +278,10 @@ AsmWriteCr2 (
"mov %0, %%cr2"
:
: "r" (Cr2)
- );
+ );
return Cr2;
}
-
/**
Writes a value to Control Register 3 (CR3).
@@ -308,11 +303,10 @@ AsmWriteCr3 (
"mov %0, %%cr3"
:
: "r" (Cr3)
- );
+ );
return Cr3;
}
-
/**
Writes a value to Control Register 4 (CR4).
@@ -334,11 +328,10 @@ AsmWriteCr4 (
"mov %0, %%cr4"
:
: "r" (Cr4)
- );
+ );
return Cr4;
}
-
/**
Reads the current value of Debug Register 0 (DR0).
@@ -355,17 +348,16 @@ AsmReadDr0 (
VOID
)
{
- UINTN Data;
+ UINTN Data;
__asm__ __volatile__ (
"mov %%dr0, %0"
: "=r" (Data)
- );
+ );
return Data;
}
-
/**
Reads the current value of Debug Register 1 (DR1).
@@ -382,17 +374,16 @@ AsmReadDr1 (
VOID
)
{
- UINTN Data;
+ UINTN Data;
__asm__ __volatile__ (
"mov %%dr1, %0"
: "=r" (Data)
- );
+ );
return Data;
}
-
/**
Reads the current value of Debug Register 2 (DR2).
@@ -409,17 +400,16 @@ AsmReadDr2 (
VOID
)
{
- UINTN Data;
+ UINTN Data;
__asm__ __volatile__ (
"mov %%dr2, %0"
: "=r" (Data)
- );
+ );
return Data;
}
-
/**
Reads the current value of Debug Register 3 (DR3).
@@ -436,17 +426,16 @@ AsmReadDr3 (
VOID
)
{
- UINTN Data;
+ UINTN Data;
__asm__ __volatile__ (
"mov %%dr3, %0"
: "=r" (Data)
- );
+ );
return Data;
}
-
/**
Reads the current value of Debug Register 4 (DR4).
@@ -463,17 +452,16 @@ AsmReadDr4 (
VOID
)
{
- UINTN Data;
+ UINTN Data;
__asm__ __volatile__ (
"mov %%dr4, %0"
: "=r" (Data)
- );
+ );
return Data;
}
-
/**
Reads the current value of Debug Register 5 (DR5).
@@ -490,17 +478,16 @@ AsmReadDr5 (
VOID
)
{
- UINTN Data;
+ UINTN Data;
__asm__ __volatile__ (
"mov %%dr5, %0"
: "=r" (Data)
- );
+ );
return Data;
}
-
/**
Reads the current value of Debug Register 6 (DR6).
@@ -517,17 +504,16 @@ AsmReadDr6 (
VOID
)
{
- UINTN Data;
+ UINTN Data;
__asm__ __volatile__ (
"mov %%dr6, %0"
: "=r" (Data)
- );
+ );
return Data;
}
-
/**
Reads the current value of Debug Register 7 (DR7).
@@ -544,17 +530,16 @@ AsmReadDr7 (
VOID
)
{
- UINTN Data;
+ UINTN Data;
__asm__ __volatile__ (
"mov %%dr7, %0"
: "=r" (Data)
- );
+ );
return Data;
}
-
/**
Writes a value to Debug Register 0 (DR0).
@@ -576,11 +561,10 @@ AsmWriteDr0 (
"mov %0, %%dr0"
:
: "r" (Dr0)
- );
+ );
return Dr0;
}
-
/**
Writes a value to Debug Register 1 (DR1).
@@ -602,11 +586,10 @@ AsmWriteDr1 (
"mov %0, %%dr1"
:
: "r" (Dr1)
- );
+ );
return Dr1;
}
-
/**
Writes a value to Debug Register 2 (DR2).
@@ -628,11 +611,10 @@ AsmWriteDr2 (
"mov %0, %%dr2"
:
: "r" (Dr2)
- );
+ );
return Dr2;
}
-
/**
Writes a value to Debug Register 3 (DR3).
@@ -654,11 +636,10 @@ AsmWriteDr3 (
"mov %0, %%dr3"
:
: "r" (Dr3)
- );
+ );
return Dr3;
}
-
/**
Writes a value to Debug Register 4 (DR4).
@@ -680,11 +661,10 @@ AsmWriteDr4 (
"mov %0, %%dr4"
:
: "r" (Dr4)
- );
+ );
return Dr4;
}
-
/**
Writes a value to Debug Register 5 (DR5).
@@ -706,11 +686,10 @@ AsmWriteDr5 (
"mov %0, %%dr5"
:
: "r" (Dr5)
- );
+ );
return Dr5;
}
-
/**
Writes a value to Debug Register 6 (DR6).
@@ -732,11 +711,10 @@ AsmWriteDr6 (
"mov %0, %%dr6"
:
: "r" (Dr6)
- );
+ );
return Dr6;
}
-
/**
Writes a value to Debug Register 7 (DR7).
@@ -758,11 +736,10 @@ AsmWriteDr7 (
"mov %0, %%dr7"
:
: "r" (Dr7)
- );
+ );
return Dr7;
}
-
/**
Reads the current value of Code Segment Register (CS).
@@ -783,12 +760,11 @@ AsmReadCs (
__asm__ __volatile__ (
"mov %%cs, %0"
:"=a" (Data)
- );
+ );
return Data;
}
-
/**
Reads the current value of Data Segment Register (DS).
@@ -809,12 +785,11 @@ AsmReadDs (
__asm__ __volatile__ (
"mov %%ds, %0"
:"=a" (Data)
- );
+ );
return Data;
}
-
/**
Reads the current value of Extra Segment Register (ES).
@@ -835,12 +810,11 @@ AsmReadEs (
__asm__ __volatile__ (
"mov %%es, %0"
:"=a" (Data)
- );
+ );
return Data;
}
-
/**
Reads the current value of FS Data Segment Register (FS).
@@ -861,12 +835,11 @@ AsmReadFs (
__asm__ __volatile__ (
"mov %%fs, %0"
:"=a" (Data)
- );
+ );
return Data;
}
-
/**
Reads the current value of GS Data Segment Register (GS).
@@ -887,12 +860,11 @@ AsmReadGs (
__asm__ __volatile__ (
"mov %%gs, %0"
:"=a" (Data)
- );
+ );
return Data;
}
-
/**
Reads the current value of Stack Segment Register (SS).
@@ -913,12 +885,11 @@ AsmReadSs (
__asm__ __volatile__ (
"mov %%ss, %0"
:"=a" (Data)
- );
+ );
return Data;
}
-
/**
Reads the current value of Task Register (TR).
@@ -939,12 +910,11 @@ AsmReadTr (
__asm__ __volatile__ (
"str %0"
: "=r" (Data)
- );
+ );
return Data;
}
-
/**
Reads the current Global Descriptor Table Register(GDTR) descriptor.
@@ -957,16 +927,15 @@ AsmReadTr (
VOID
EFIAPI
InternalX86ReadGdtr (
- OUT IA32_DESCRIPTOR *Gdtr
+ OUT IA32_DESCRIPTOR *Gdtr
)
{
__asm__ __volatile__ (
"sgdt %0"
: "=m" (*Gdtr)
- );
+ );
}
-
/**
Writes the current Global Descriptor Table Register (GDTR) descriptor.
@@ -979,18 +948,16 @@ InternalX86ReadGdtr (
VOID
EFIAPI
InternalX86WriteGdtr (
- IN CONST IA32_DESCRIPTOR *Gdtr
+ IN CONST IA32_DESCRIPTOR *Gdtr
)
{
__asm__ __volatile__ (
"lgdt %0"
:
: "m" (*Gdtr)
- );
-
+ );
}
-
/**
Reads the current Interrupt Descriptor Table Register(GDTR) descriptor.
@@ -1003,16 +970,15 @@ InternalX86WriteGdtr (
VOID
EFIAPI
InternalX86ReadIdtr (
- OUT IA32_DESCRIPTOR *Idtr
+ OUT IA32_DESCRIPTOR *Idtr
)
{
__asm__ __volatile__ (
"sidt %0"
: "=m" (*Idtr)
- );
+ );
}
-
/**
Writes the current Interrupt Descriptor Table Register(GDTR) descriptor.
@@ -1025,17 +991,16 @@ InternalX86ReadIdtr (
VOID
EFIAPI
InternalX86WriteIdtr (
- IN CONST IA32_DESCRIPTOR *Idtr
+ IN CONST IA32_DESCRIPTOR *Idtr
)
{
__asm__ __volatile__ (
"lidt %0"
:
: "m" (*Idtr)
- );
+ );
}
-
/**
Reads the current Local Descriptor Table Register(LDTR) selector.
@@ -1056,12 +1021,11 @@ AsmReadLdtr (
__asm__ __volatile__ (
"sldt %0"
: "=g" (Data) // %0
- );
+ );
return Data;
}
-
/**
Writes the current Local Descriptor Table Register (GDTR) selector.
@@ -1074,14 +1038,14 @@ AsmReadLdtr (
VOID
EFIAPI
AsmWriteLdtr (
- IN UINT16 Ldtr
+ IN UINT16 Ldtr
)
{
__asm__ __volatile__ (
"lldtw %0"
:
: "g" (Ldtr) // %0
- );
+ );
}
/**
@@ -1098,7 +1062,7 @@ AsmWriteLdtr (
UINT64
EFIAPI
AsmReadPmc (
- IN UINT32 Index
+ IN UINT32 Index
)
{
UINT32 LowData;
@@ -1109,7 +1073,7 @@ AsmReadPmc (
: "=a" (LowData),
"=d" (HiData)
: "c" (Index)
- );
+ );
return (((UINT64)HiData) << 32) | LowData;
}
@@ -1133,9 +1097,9 @@ AsmReadPmc (
UINTN
EFIAPI
AsmMonitor (
- IN UINTN Eax,
- IN UINTN Ecx,
- IN UINTN Edx
+ IN UINTN Eax,
+ IN UINTN Ecx,
+ IN UINTN Edx
)
{
__asm__ __volatile__ (
@@ -1144,7 +1108,7 @@ AsmMonitor (
: "a" (Eax),
"c" (Ecx),
"d" (Edx)
- );
+ );
return Eax;
}
@@ -1166,8 +1130,8 @@ AsmMonitor (
UINTN
EFIAPI
AsmMwait (
- IN UINTN Eax,
- IN UINTN Ecx
+ IN UINTN Eax,
+ IN UINTN Ecx
)
{
__asm__ __volatile__ (
@@ -1175,7 +1139,7 @@ AsmMwait (
:
: "a" (Eax),
"c" (Ecx)
- );
+ );
return Eax;
}
@@ -1210,10 +1174,8 @@ AsmInvd (
)
{
__asm__ __volatile__ ("invd":::"memory");
-
}
-
/**
Flushes a cache line from all the instruction and data caches within the
coherency domain of the CPU.
@@ -1232,7 +1194,7 @@ AsmInvd (
VOID *
EFIAPI
AsmFlushCacheLine (
- IN VOID *LinearAddress
+ IN VOID *LinearAddress
)
{
__asm__ __volatile__ (
@@ -1240,7 +1202,7 @@ AsmFlushCacheLine (
:
: "r" (LinearAddress)
: "memory"
- );
+ );
- return LinearAddress;
+ return LinearAddress;
}
diff --git a/MdePkg/Library/BaseLib/X64/Non-existing.c b/MdePkg/Library/BaseLib/X64/Non-existing.c
index 8f1eb4a4ce..a8c7226c47 100644
--- a/MdePkg/Library/BaseLib/X64/Non-existing.c
+++ b/MdePkg/Library/BaseLib/X64/Non-existing.c
@@ -102,7 +102,6 @@ InternalX86DisablePaging32 (
ASSERT (FALSE);
}
-
/**
Enables the 64-bit paging mode on the CPU.
@@ -133,11 +132,11 @@ InternalX86DisablePaging32 (
VOID
EFIAPI
InternalX86EnablePaging64 (
- IN UINT16 Cs,
- IN UINT64 EntryPoint,
- IN UINT64 Context1 OPTIONAL,
- IN UINT64 Context2 OPTIONAL,
- IN UINT64 NewStack
+ IN UINT16 Cs,
+ IN UINT64 EntryPoint,
+ IN UINT64 Context1 OPTIONAL,
+ IN UINT64 Context2 OPTIONAL,
+ IN UINT64 NewStack
)
{
//
diff --git a/MdePkg/Library/BaseLib/X64/ReadMsr64.c b/MdePkg/Library/BaseLib/X64/ReadMsr64.c
index 36a349432c..546bdc96b4 100644
--- a/MdePkg/Library/BaseLib/X64/ReadMsr64.c
+++ b/MdePkg/Library/BaseLib/X64/ReadMsr64.c
@@ -12,7 +12,10 @@
#include <Library/RegisterFilterLib.h>
-unsigned __int64 __readmsr (int register);
+unsigned __int64
+__readmsr (
+ int register
+ );
#pragma intrinsic(__readmsr)
@@ -30,15 +33,15 @@ AsmReadMsr64 (
IN UINT32 Index
)
{
- UINT64 Value;
- BOOLEAN Flag;
+ UINT64 Value;
+ BOOLEAN Flag;
Flag = FilterBeforeMsrRead (Index, &Value);
if (Flag) {
Value = __readmsr (Index);
}
+
FilterAfterMsrRead (Index, &Value);
return Value;
}
-
diff --git a/MdePkg/Library/BaseLib/X64/WriteMsr64.c b/MdePkg/Library/BaseLib/X64/WriteMsr64.c
index bb030832c4..1e48b71467 100644
--- a/MdePkg/Library/BaseLib/X64/WriteMsr64.c
+++ b/MdePkg/Library/BaseLib/X64/WriteMsr64.c
@@ -12,7 +12,11 @@
#include <Library/RegisterFilterLib.h>
-void __writemsr (unsigned long Register, unsigned __int64 Value);
+void
+__writemsr (
+ unsigned long Register,
+ unsigned __int64 Value
+ );
#pragma intrinsic(__writemsr)
@@ -32,14 +36,14 @@ AsmWriteMsr64 (
IN UINT64 Value
)
{
- BOOLEAN Flag;
+ BOOLEAN Flag;
Flag = FilterBeforeMsrWrite (Index, &Value);
if (Flag) {
__writemsr (Index, Value);
}
+
FilterAfterMsrWrite (Index, &Value);
return Value;
}
-
diff --git a/MdePkg/Library/BaseLib/X86DisablePaging32.c b/MdePkg/Library/BaseLib/X86DisablePaging32.c
index 7a6cb84c59..a82a502ff3 100644
--- a/MdePkg/Library/BaseLib/X86DisablePaging32.c
+++ b/MdePkg/Library/BaseLib/X86DisablePaging32.c
@@ -6,9 +6,6 @@
**/
-
-
-
#include "BaseLibInternals.h"
/**
diff --git a/MdePkg/Library/BaseLib/X86DisablePaging64.c b/MdePkg/Library/BaseLib/X86DisablePaging64.c
index 2879185817..59173a24e9 100644
--- a/MdePkg/Library/BaseLib/X86DisablePaging64.c
+++ b/MdePkg/Library/BaseLib/X86DisablePaging64.c
@@ -6,9 +6,6 @@
**/
-
-
-
#include "BaseLibInternals.h"
/**
@@ -44,11 +41,11 @@
VOID
EFIAPI
AsmDisablePaging64 (
- IN UINT16 Cs,
- IN UINT32 EntryPoint,
- IN UINT32 Context1 OPTIONAL,
- IN UINT32 Context2 OPTIONAL,
- IN UINT32 NewStack
+ IN UINT16 Cs,
+ IN UINT32 EntryPoint,
+ IN UINT32 Context1 OPTIONAL,
+ IN UINT32 Context2 OPTIONAL,
+ IN UINT32 NewStack
)
{
ASSERT (EntryPoint != 0);
diff --git a/MdePkg/Library/BaseLib/X86EnablePaging32.c b/MdePkg/Library/BaseLib/X86EnablePaging32.c
index 2f0c4078f1..c331cc96fe 100644
--- a/MdePkg/Library/BaseLib/X86EnablePaging32.c
+++ b/MdePkg/Library/BaseLib/X86EnablePaging32.c
@@ -6,9 +6,6 @@
**/
-
-
-
#include "BaseLibInternals.h"
/**
diff --git a/MdePkg/Library/BaseLib/X86EnablePaging64.c b/MdePkg/Library/BaseLib/X86EnablePaging64.c
index a09d079109..533ca7d426 100644
--- a/MdePkg/Library/BaseLib/X86EnablePaging64.c
+++ b/MdePkg/Library/BaseLib/X86EnablePaging64.c
@@ -6,9 +6,6 @@
**/
-
-
-
#include "BaseLibInternals.h"
/**
@@ -46,11 +43,11 @@
VOID
EFIAPI
AsmEnablePaging64 (
- IN UINT16 Cs,
- IN UINT64 EntryPoint,
- IN UINT64 Context1 OPTIONAL,
- IN UINT64 Context2 OPTIONAL,
- IN UINT64 NewStack
+ IN UINT16 Cs,
+ IN UINT64 EntryPoint,
+ IN UINT64 Context1 OPTIONAL,
+ IN UINT64 Context2 OPTIONAL,
+ IN UINT64 NewStack
)
{
ASSERT (EntryPoint != 0);
diff --git a/MdePkg/Library/BaseLib/X86FxRestore.c b/MdePkg/Library/BaseLib/X86FxRestore.c
index c4fa668568..b236f6d51f 100644
--- a/MdePkg/Library/BaseLib/X86FxRestore.c
+++ b/MdePkg/Library/BaseLib/X86FxRestore.c
@@ -6,9 +6,6 @@
**/
-
-
-
#include "BaseLibInternals.h"
/**
@@ -28,7 +25,7 @@
VOID
EFIAPI
AsmFxRestore (
- IN CONST IA32_FX_BUFFER *Buffer
+ IN CONST IA32_FX_BUFFER *Buffer
)
{
ASSERT (Buffer != NULL);
@@ -37,7 +34,7 @@ AsmFxRestore (
//
// Check the flag recorded by AsmFxSave()
//
- ASSERT (0xAA5555AA == *(UINT32 *) (&Buffer->Buffer[sizeof (Buffer->Buffer) - 4]));
+ ASSERT (0xAA5555AA == *(UINT32 *)(&Buffer->Buffer[sizeof (Buffer->Buffer) - 4]));
InternalX86FxRestore (Buffer);
}
diff --git a/MdePkg/Library/BaseLib/X86FxSave.c b/MdePkg/Library/BaseLib/X86FxSave.c
index 2621a08a30..a335d40611 100644
--- a/MdePkg/Library/BaseLib/X86FxSave.c
+++ b/MdePkg/Library/BaseLib/X86FxSave.c
@@ -6,9 +6,6 @@
**/
-
-
-
#include "BaseLibInternals.h"
/**
@@ -27,7 +24,7 @@
VOID
EFIAPI
AsmFxSave (
- OUT IA32_FX_BUFFER *Buffer
+ OUT IA32_FX_BUFFER *Buffer
)
{
ASSERT (Buffer != NULL);
@@ -38,5 +35,5 @@ AsmFxSave (
//
// Mark one flag at end of Buffer, it will be check by AsmFxRestor()
//
- *(UINT32 *) (&Buffer->Buffer[sizeof (Buffer->Buffer) - 4]) = 0xAA5555AA;
+ *(UINT32 *)(&Buffer->Buffer[sizeof (Buffer->Buffer) - 4]) = 0xAA5555AA;
}
diff --git a/MdePkg/Library/BaseLib/X86GetInterruptState.c b/MdePkg/Library/BaseLib/X86GetInterruptState.c
index 4363a7fdac..6e0cfbaf85 100644
--- a/MdePkg/Library/BaseLib/X86GetInterruptState.c
+++ b/MdePkg/Library/BaseLib/X86GetInterruptState.c
@@ -6,10 +6,8 @@
**/
-
#include "BaseLibInternals.h"
-
/**
Retrieves the current CPU interrupt state.
@@ -26,10 +24,8 @@ GetInterruptState (
VOID
)
{
- IA32_EFLAGS32 EFlags;
+ IA32_EFLAGS32 EFlags;
EFlags.UintN = AsmReadEflags ();
return (BOOLEAN)(1 == EFlags.Bits.IF);
}
-
-
diff --git a/MdePkg/Library/BaseLib/X86MemoryFence.c b/MdePkg/Library/BaseLib/X86MemoryFence.c
index 399b36b569..774d0034fa 100644
--- a/MdePkg/Library/BaseLib/X86MemoryFence.c
+++ b/MdePkg/Library/BaseLib/X86MemoryFence.c
@@ -6,9 +6,6 @@
**/
-
-
-
/**
Used to serialize load and store operations.
diff --git a/MdePkg/Library/BaseLib/X86Msr.c b/MdePkg/Library/BaseLib/X86Msr.c
index ea51ca9ada..1995cb8fd3 100644
--- a/MdePkg/Library/BaseLib/X86Msr.c
+++ b/MdePkg/Library/BaseLib/X86Msr.c
@@ -6,10 +6,8 @@
**/
-
#include "BaseLibInternals.h"
-
/**
Returns the lower 32-bits of a Machine Specific Register(MSR).
@@ -27,7 +25,7 @@
UINT32
EFIAPI
AsmReadMsr32 (
- IN UINT32 Index
+ IN UINT32 Index
)
{
return (UINT32)AsmReadMsr64 (Index);
@@ -53,8 +51,8 @@ AsmReadMsr32 (
UINT32
EFIAPI
AsmWriteMsr32 (
- IN UINT32 Index,
- IN UINT32 Value
+ IN UINT32 Index,
+ IN UINT32 Value
)
{
return (UINT32)AsmWriteMsr64 (Index, Value);
@@ -82,8 +80,8 @@ AsmWriteMsr32 (
UINT32
EFIAPI
AsmMsrOr32 (
- IN UINT32 Index,
- IN UINT32 OrData
+ IN UINT32 Index,
+ IN UINT32 OrData
)
{
return (UINT32)AsmMsrOr64 (Index, OrData);
@@ -111,8 +109,8 @@ AsmMsrOr32 (
UINT32
EFIAPI
AsmMsrAnd32 (
- IN UINT32 Index,
- IN UINT32 AndData
+ IN UINT32 Index,
+ IN UINT32 AndData
)
{
return (UINT32)AsmMsrAnd64 (Index, AndData);
@@ -143,9 +141,9 @@ AsmMsrAnd32 (
UINT32
EFIAPI
AsmMsrAndThenOr32 (
- IN UINT32 Index,
- IN UINT32 AndData,
- IN UINT32 OrData
+ IN UINT32 Index,
+ IN UINT32 AndData,
+ IN UINT32 OrData
)
{
return (UINT32)AsmMsrAndThenOr64 (Index, AndData, OrData);
@@ -176,9 +174,9 @@ AsmMsrAndThenOr32 (
UINT32
EFIAPI
AsmMsrBitFieldRead32 (
- IN UINT32 Index,
- IN UINTN StartBit,
- IN UINTN EndBit
+ IN UINT32 Index,
+ IN UINTN StartBit,
+ IN UINTN EndBit
)
{
return BitFieldRead32 (AsmReadMsr32 (Index), StartBit, EndBit);
@@ -212,10 +210,10 @@ AsmMsrBitFieldRead32 (
UINT32
EFIAPI
AsmMsrBitFieldWrite32 (
- IN UINT32 Index,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT32 Value
+ IN UINT32 Index,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT32 Value
)
{
ASSERT (EndBit < sizeof (Value) * 8);
@@ -253,10 +251,10 @@ AsmMsrBitFieldWrite32 (
UINT32
EFIAPI
AsmMsrBitFieldOr32 (
- IN UINT32 Index,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT32 OrData
+ IN UINT32 Index,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT32 OrData
)
{
ASSERT (EndBit < sizeof (OrData) * 8);
@@ -294,10 +292,10 @@ AsmMsrBitFieldOr32 (
UINT32
EFIAPI
AsmMsrBitFieldAnd32 (
- IN UINT32 Index,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT32 AndData
+ IN UINT32 Index,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT32 AndData
)
{
ASSERT (EndBit < sizeof (AndData) * 8);
@@ -339,11 +337,11 @@ AsmMsrBitFieldAnd32 (
UINT32
EFIAPI
AsmMsrBitFieldAndThenOr32 (
- IN UINT32 Index,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT32 AndData,
- IN UINT32 OrData
+ IN UINT32 Index,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT32 AndData,
+ IN UINT32 OrData
)
{
ASSERT (EndBit < sizeof (AndData) * 8);
@@ -378,8 +376,8 @@ AsmMsrBitFieldAndThenOr32 (
UINT64
EFIAPI
AsmMsrOr64 (
- IN UINT32 Index,
- IN UINT64 OrData
+ IN UINT32 Index,
+ IN UINT64 OrData
)
{
return AsmWriteMsr64 (Index, AsmReadMsr64 (Index) | OrData);
@@ -406,8 +404,8 @@ AsmMsrOr64 (
UINT64
EFIAPI
AsmMsrAnd64 (
- IN UINT32 Index,
- IN UINT64 AndData
+ IN UINT32 Index,
+ IN UINT64 AndData
)
{
return AsmWriteMsr64 (Index, AsmReadMsr64 (Index) & AndData);
@@ -437,9 +435,9 @@ AsmMsrAnd64 (
UINT64
EFIAPI
AsmMsrAndThenOr64 (
- IN UINT32 Index,
- IN UINT64 AndData,
- IN UINT64 OrData
+ IN UINT32 Index,
+ IN UINT64 AndData,
+ IN UINT64 OrData
)
{
return AsmWriteMsr64 (Index, (AsmReadMsr64 (Index) & AndData) | OrData);
@@ -470,9 +468,9 @@ AsmMsrAndThenOr64 (
UINT64
EFIAPI
AsmMsrBitFieldRead64 (
- IN UINT32 Index,
- IN UINTN StartBit,
- IN UINTN EndBit
+ IN UINT32 Index,
+ IN UINTN StartBit,
+ IN UINTN EndBit
)
{
return BitFieldRead64 (AsmReadMsr64 (Index), StartBit, EndBit);
@@ -505,10 +503,10 @@ AsmMsrBitFieldRead64 (
UINT64
EFIAPI
AsmMsrBitFieldWrite64 (
- IN UINT32 Index,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT64 Value
+ IN UINT32 Index,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT64 Value
)
{
return AsmWriteMsr64 (
@@ -547,10 +545,10 @@ AsmMsrBitFieldWrite64 (
UINT64
EFIAPI
AsmMsrBitFieldOr64 (
- IN UINT32 Index,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT64 OrData
+ IN UINT32 Index,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT64 OrData
)
{
return AsmWriteMsr64 (
@@ -589,10 +587,10 @@ AsmMsrBitFieldOr64 (
UINT64
EFIAPI
AsmMsrBitFieldAnd64 (
- IN UINT32 Index,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT64 AndData
+ IN UINT32 Index,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT64 AndData
)
{
return AsmWriteMsr64 (
@@ -634,11 +632,11 @@ AsmMsrBitFieldAnd64 (
UINT64
EFIAPI
AsmMsrBitFieldAndThenOr64 (
- IN UINT32 Index,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT64 AndData,
- IN UINT64 OrData
+ IN UINT32 Index,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT64 AndData,
+ IN UINT64 OrData
)
{
return AsmWriteMsr64 (
diff --git a/MdePkg/Library/BaseLib/X86PatchInstruction.c b/MdePkg/Library/BaseLib/X86PatchInstruction.c
index fc70a352d3..116a50199e 100644
--- a/MdePkg/Library/BaseLib/X86PatchInstruction.c
+++ b/MdePkg/Library/BaseLib/X86PatchInstruction.c
@@ -46,9 +46,9 @@
VOID
EFIAPI
PatchInstructionX86 (
- OUT X86_ASSEMBLY_PATCH_LABEL *InstructionEnd,
- IN UINT64 PatchValue,
- IN UINTN ValueSize
+ OUT X86_ASSEMBLY_PATCH_LABEL *InstructionEnd,
+ IN UINT64 PatchValue,
+ IN UINTN ValueSize
)
{
//
@@ -58,26 +58,26 @@ PatchInstructionX86 (
ASSERT ((UINTN)InstructionEnd > ValueSize);
switch (ValueSize) {
- case 1:
- ASSERT (PatchValue <= MAX_UINT8);
- *((UINT8 *)(UINTN)InstructionEnd - 1) = (UINT8)PatchValue;
- break;
-
- case 2:
- ASSERT (PatchValue <= MAX_UINT16);
- WriteUnaligned16 ((UINT16 *)(UINTN)InstructionEnd - 1, (UINT16)PatchValue);
- break;
-
- case 4:
- ASSERT (PatchValue <= MAX_UINT32);
- WriteUnaligned32 ((UINT32 *)(UINTN)InstructionEnd - 1, (UINT32)PatchValue);
- break;
-
- case 8:
- WriteUnaligned64 ((UINT64 *)(UINTN)InstructionEnd - 1, PatchValue);
- break;
-
- default:
- ASSERT (FALSE);
+ case 1:
+ ASSERT (PatchValue <= MAX_UINT8);
+ *((UINT8 *)(UINTN)InstructionEnd - 1) = (UINT8)PatchValue;
+ break;
+
+ case 2:
+ ASSERT (PatchValue <= MAX_UINT16);
+ WriteUnaligned16 ((UINT16 *)(UINTN)InstructionEnd - 1, (UINT16)PatchValue);
+ break;
+
+ case 4:
+ ASSERT (PatchValue <= MAX_UINT32);
+ WriteUnaligned32 ((UINT32 *)(UINTN)InstructionEnd - 1, (UINT32)PatchValue);
+ break;
+
+ case 8:
+ WriteUnaligned64 ((UINT64 *)(UINTN)InstructionEnd - 1, PatchValue);
+ break;
+
+ default:
+ ASSERT (FALSE);
}
}
diff --git a/MdePkg/Library/BaseLib/X86RdRand.c b/MdePkg/Library/BaseLib/X86RdRand.c
index dcbd969573..a78e8b177e 100644
--- a/MdePkg/Library/BaseLib/X86RdRand.c
+++ b/MdePkg/Library/BaseLib/X86RdRand.c
@@ -23,7 +23,7 @@
BOOLEAN
EFIAPI
AsmRdRand16 (
- OUT UINT16 *Rand
+ OUT UINT16 *Rand
)
{
ASSERT (Rand != NULL);
@@ -44,7 +44,7 @@ AsmRdRand16 (
BOOLEAN
EFIAPI
AsmRdRand32 (
- OUT UINT32 *Rand
+ OUT UINT32 *Rand
)
{
ASSERT (Rand != NULL);
@@ -65,7 +65,7 @@ AsmRdRand32 (
BOOLEAN
EFIAPI
AsmRdRand64 (
- OUT UINT64 *Rand
+ OUT UINT64 *Rand
)
{
ASSERT (Rand != NULL);
diff --git a/MdePkg/Library/BaseLib/X86ReadGdtr.c b/MdePkg/Library/BaseLib/X86ReadGdtr.c
index ca7c5de6a5..1989cd00ad 100644
--- a/MdePkg/Library/BaseLib/X86ReadGdtr.c
+++ b/MdePkg/Library/BaseLib/X86ReadGdtr.c
@@ -6,9 +6,6 @@
**/
-
-
-
#include "BaseLibInternals.h"
/**
@@ -25,7 +22,7 @@
VOID
EFIAPI
AsmReadGdtr (
- OUT IA32_DESCRIPTOR *Gdtr
+ OUT IA32_DESCRIPTOR *Gdtr
)
{
ASSERT (Gdtr != NULL);
diff --git a/MdePkg/Library/BaseLib/X86ReadIdtr.c b/MdePkg/Library/BaseLib/X86ReadIdtr.c
index f9133f9aa0..1b61ba243d 100644
--- a/MdePkg/Library/BaseLib/X86ReadIdtr.c
+++ b/MdePkg/Library/BaseLib/X86ReadIdtr.c
@@ -6,9 +6,6 @@
**/
-
-
-
#include "BaseLibInternals.h"
/**
@@ -25,7 +22,7 @@
VOID
EFIAPI
AsmReadIdtr (
- OUT IA32_DESCRIPTOR *Idtr
+ OUT IA32_DESCRIPTOR *Idtr
)
{
ASSERT (Idtr != NULL);
diff --git a/MdePkg/Library/BaseLib/X86Thunk.c b/MdePkg/Library/BaseLib/X86Thunk.c
index 5c8a039899..9940dca859 100644
--- a/MdePkg/Library/BaseLib/X86Thunk.c
+++ b/MdePkg/Library/BaseLib/X86Thunk.c
@@ -6,15 +6,14 @@
**/
-
#include "BaseLibInternals.h"
-extern CONST UINT8 m16Start;
-extern CONST UINT16 m16Size;
-extern CONST UINT16 mThunk16Attr;
-extern CONST UINT16 m16Gdt;
-extern CONST UINT16 m16GdtrBase;
-extern CONST UINT16 mTransition;
+extern CONST UINT8 m16Start;
+extern CONST UINT16 m16Size;
+extern CONST UINT16 mThunk16Attr;
+extern CONST UINT16 m16Gdt;
+extern CONST UINT16 m16GdtrBase;
+extern CONST UINT16 mTransition;
/**
Invokes 16-bit code in big real mode and returns the updated register set.
@@ -33,8 +32,8 @@ extern CONST UINT16 mTransition;
IA32_REGISTER_SET *
EFIAPI
InternalAsmThunk16 (
- IN IA32_REGISTER_SET *RegisterSet,
- IN OUT VOID *Transition
+ IN IA32_REGISTER_SET *RegisterSet,
+ IN OUT VOID *Transition
);
/**
@@ -61,8 +60,8 @@ InternalAsmThunk16 (
VOID
EFIAPI
AsmGetThunk16Properties (
- OUT UINT32 *RealModeBufferSize,
- OUT UINT32 *ExtraStackSize
+ OUT UINT32 *RealModeBufferSize,
+ OUT UINT32 *ExtraStackSize
)
{
ASSERT (RealModeBufferSize != NULL);
@@ -93,10 +92,10 @@ AsmGetThunk16Properties (
VOID
EFIAPI
AsmPrepareThunk16 (
- IN OUT THUNK_CONTEXT *ThunkContext
+ IN OUT THUNK_CONTEXT *ThunkContext
)
{
- IA32_SEGMENT_DESCRIPTOR *RealModeGdt;
+ IA32_SEGMENT_DESCRIPTOR *RealModeGdt;
ASSERT (ThunkContext != NULL);
ASSERT ((UINTN)ThunkContext->RealModeBuffer < 0x100000);
@@ -113,8 +112,8 @@ AsmPrepareThunk16 (
// RealModeGdt[2]: Data Segment
// RealModeGdt[3]: Call Gate
//
- RealModeGdt = (IA32_SEGMENT_DESCRIPTOR*)(
- (UINTN)ThunkContext->RealModeBuffer + m16Gdt);
+ RealModeGdt = (IA32_SEGMENT_DESCRIPTOR *)(
+ (UINTN)ThunkContext->RealModeBuffer + m16Gdt);
//
// Update Code & Data Segment Descriptor
@@ -127,7 +126,7 @@ AsmPrepareThunk16 (
//
// Update transition code entry point offset
//
- *(UINT32*)((UINTN)ThunkContext->RealModeBuffer + mTransition) +=
+ *(UINT32 *)((UINTN)ThunkContext->RealModeBuffer + mTransition) +=
(UINT32)(UINTN)ThunkContext->RealModeBuffer & 0xf;
//
@@ -138,20 +137,20 @@ AsmPrepareThunk16 (
// Set segment limits to 64KB
//
RealModeGdt[1].Bits.LimitHigh = 0;
- RealModeGdt[1].Bits.G = 0;
+ RealModeGdt[1].Bits.G = 0;
RealModeGdt[2].Bits.LimitHigh = 0;
- RealModeGdt[2].Bits.G = 0;
+ RealModeGdt[2].Bits.G = 0;
}
//
// Update GDTBASE for this thunk context
//
- *(VOID**)((UINTN)ThunkContext->RealModeBuffer + m16GdtrBase) = RealModeGdt;
+ *(VOID **)((UINTN)ThunkContext->RealModeBuffer + m16GdtrBase) = RealModeGdt;
//
// Update Thunk Attributes
//
- *(UINT32*)((UINTN)ThunkContext->RealModeBuffer + mThunk16Attr) =
+ *(UINT32 *)((UINTN)ThunkContext->RealModeBuffer + mThunk16Attr) =
ThunkContext->ThunkAttributes;
}
@@ -211,17 +210,19 @@ AsmPrepareThunk16 (
VOID
EFIAPI
AsmThunk16 (
- IN OUT THUNK_CONTEXT *ThunkContext
+ IN OUT THUNK_CONTEXT *ThunkContext
)
{
- IA32_REGISTER_SET *UpdatedRegs;
+ IA32_REGISTER_SET *UpdatedRegs;
ASSERT (ThunkContext != NULL);
ASSERT ((UINTN)ThunkContext->RealModeBuffer < 0x100000);
ASSERT (ThunkContext->RealModeBufferSize >= m16Size);
ASSERT ((UINTN)ThunkContext->RealModeBuffer + m16Size <= 0x100000);
- ASSERT (((ThunkContext->ThunkAttributes & (THUNK_ATTRIBUTE_DISABLE_A20_MASK_INT_15 | THUNK_ATTRIBUTE_DISABLE_A20_MASK_KBD_CTRL)) != \
- (THUNK_ATTRIBUTE_DISABLE_A20_MASK_INT_15 | THUNK_ATTRIBUTE_DISABLE_A20_MASK_KBD_CTRL)));
+ ASSERT (
+ ((ThunkContext->ThunkAttributes & (THUNK_ATTRIBUTE_DISABLE_A20_MASK_INT_15 | THUNK_ATTRIBUTE_DISABLE_A20_MASK_KBD_CTRL)) != \
+ (THUNK_ATTRIBUTE_DISABLE_A20_MASK_INT_15 | THUNK_ATTRIBUTE_DISABLE_A20_MASK_KBD_CTRL))
+ );
UpdatedRegs = InternalAsmThunk16 (
ThunkContext->RealModeState,
@@ -254,7 +255,7 @@ AsmThunk16 (
VOID
EFIAPI
AsmPrepareAndThunk16 (
- IN OUT THUNK_CONTEXT *ThunkContext
+ IN OUT THUNK_CONTEXT *ThunkContext
)
{
AsmPrepareThunk16 (ThunkContext);
diff --git a/MdePkg/Library/BaseLib/X86UnitTestHost.c b/MdePkg/Library/BaseLib/X86UnitTestHost.c
index 3730e2fe26..8ba4f54a38 100644
--- a/MdePkg/Library/BaseLib/X86UnitTestHost.c
+++ b/MdePkg/Library/BaseLib/X86UnitTestHost.c
@@ -59,25 +59,29 @@ STATIC IA32_DESCRIPTOR mUnitTestHostBaseLibIdtr;
UINT32
EFIAPI
UnitTestHostBaseLibAsmCpuid (
- IN UINT32 Index,
- OUT UINT32 *Eax OPTIONAL,
- OUT UINT32 *Ebx OPTIONAL,
- OUT UINT32 *Ecx OPTIONAL,
- OUT UINT32 *Edx OPTIONAL
+ IN UINT32 Index,
+ OUT UINT32 *Eax OPTIONAL,
+ OUT UINT32 *Ebx OPTIONAL,
+ OUT UINT32 *Ecx OPTIONAL,
+ OUT UINT32 *Edx OPTIONAL
)
{
if (Eax != NULL) {
*Eax = 0;
}
+
if (Ebx != NULL) {
*Ebx = 0;
}
+
if (Ecx != NULL) {
*Ecx = 0;
}
+
if (Edx != NULL) {
*Edx = 0;
}
+
return Index;
}
@@ -116,26 +120,30 @@ UnitTestHostBaseLibAsmCpuid (
UINT32
EFIAPI
UnitTestHostBaseLibAsmCpuidEx (
- IN UINT32 Index,
- IN UINT32 SubIndex,
- OUT UINT32 *Eax OPTIONAL,
- OUT UINT32 *Ebx OPTIONAL,
- OUT UINT32 *Ecx OPTIONAL,
- OUT UINT32 *Edx OPTIONAL
+ IN UINT32 Index,
+ IN UINT32 SubIndex,
+ OUT UINT32 *Eax OPTIONAL,
+ OUT UINT32 *Ebx OPTIONAL,
+ OUT UINT32 *Ecx OPTIONAL,
+ OUT UINT32 *Edx OPTIONAL
)
{
if (Eax != NULL) {
*Eax = 0;
}
+
if (Ebx != NULL) {
*Ebx = 0;
}
+
if (Ecx != NULL) {
*Ecx = 0;
}
+
if (Edx != NULL) {
*Edx = 0;
}
+
return Index;
}
@@ -186,15 +194,17 @@ UnitTestHostBaseLibAsmEnableCache (
UINT64
EFIAPI
UnitTestHostBaseLibAsmReadMsr64 (
- IN UINT32 Index
+ IN UINT32 Index
)
{
if (Index < 0x1000) {
return mUnitTestHostBaseLibMsr[0][Index];
}
- if (Index >= 0xC0000000 && Index < 0xC0001000) {
+
+ if ((Index >= 0xC0000000) && (Index < 0xC0001000)) {
return mUnitTestHostBaseLibMsr[1][Index];
}
+
return 0;
}
@@ -218,16 +228,18 @@ UnitTestHostBaseLibAsmReadMsr64 (
UINT64
EFIAPI
UnitTestHostBaseLibAsmWriteMsr64 (
- IN UINT32 Index,
- IN UINT64 Value
+ IN UINT32 Index,
+ IN UINT64 Value
)
{
if (Index < 0x1000) {
mUnitTestHostBaseLibMsr[0][Index] = Value;
}
- if (Index >= 0xC0000000 && Index < 0xC0001000) {
+
+ if ((Index >= 0xC0000000) && (Index < 0xC0001000)) {
mUnitTestHostBaseLibMsr[1][Index - 0xC00000000] = Value;
}
+
return Value;
}
@@ -851,7 +863,7 @@ UnitTestHostBaseLibAsmReadTr (
VOID
EFIAPI
UnitTestHostBaseLibAsmReadGdtr (
- OUT IA32_DESCRIPTOR *Gdtr
+ OUT IA32_DESCRIPTOR *Gdtr
)
{
Gdtr = &mUnitTestHostBaseLibGdtr;
@@ -871,7 +883,7 @@ UnitTestHostBaseLibAsmReadGdtr (
VOID
EFIAPI
UnitTestHostBaseLibAsmWriteGdtr (
- IN CONST IA32_DESCRIPTOR *Gdtr
+ IN CONST IA32_DESCRIPTOR *Gdtr
)
{
CopyMem (&mUnitTestHostBaseLibGdtr, Gdtr, sizeof (IA32_DESCRIPTOR));
@@ -891,7 +903,7 @@ UnitTestHostBaseLibAsmWriteGdtr (
VOID
EFIAPI
UnitTestHostBaseLibAsmReadIdtr (
- OUT IA32_DESCRIPTOR *Idtr
+ OUT IA32_DESCRIPTOR *Idtr
)
{
Idtr = &mUnitTestHostBaseLibIdtr;
@@ -911,7 +923,7 @@ UnitTestHostBaseLibAsmReadIdtr (
VOID
EFIAPI
UnitTestHostBaseLibAsmWriteIdtr (
- IN CONST IA32_DESCRIPTOR *Idtr
+ IN CONST IA32_DESCRIPTOR *Idtr
)
{
CopyMem (&mUnitTestHostBaseLibIdtr, Idtr, sizeof (IA32_DESCRIPTOR));
@@ -947,7 +959,7 @@ UnitTestHostBaseLibAsmReadLdtr (
VOID
EFIAPI
UnitTestHostBaseLibAsmWriteLdtr (
- IN UINT16 Ldtr
+ IN UINT16 Ldtr
)
{
mUnitTestHostBaseLibSegment[UNIT_TEST_HOST_BASE_LIB_SEGMENT_LDTR] = Ldtr;
@@ -967,7 +979,7 @@ UnitTestHostBaseLibAsmWriteLdtr (
UINT64
EFIAPI
UnitTestHostBaseLibAsmReadPmc (
- IN UINT32 Index
+ IN UINT32 Index
)
{
return 0;
@@ -992,9 +1004,9 @@ UnitTestHostBaseLibAsmReadPmc (
UINTN
EFIAPI
UnitTestHostBaseLibAsmMonitor (
- IN UINTN Eax,
- IN UINTN Ecx,
- IN UINTN Edx
+ IN UINTN Eax,
+ IN UINTN Ecx,
+ IN UINTN Edx
)
{
return Eax;
@@ -1017,8 +1029,8 @@ UnitTestHostBaseLibAsmMonitor (
UINTN
EFIAPI
UnitTestHostBaseLibAsmMwait (
- IN UINTN Eax,
- IN UINTN Ecx
+ IN UINTN Eax,
+ IN UINTN Ecx
)
{
return Eax;
@@ -1072,7 +1084,7 @@ UnitTestHostBaseLibAsmInvd (
VOID *
EFIAPI
UnitTestHostBaseLibAsmFlushCacheLine (
- IN VOID *LinearAddress
+ IN VOID *LinearAddress
)
{
return LinearAddress;
@@ -1208,11 +1220,11 @@ UnitTestHostBaseLibAsmDisablePaging32 (
VOID
EFIAPI
UnitTestHostBaseLibAsmEnablePaging64 (
- IN UINT16 Cs,
- IN UINT64 EntryPoint,
- IN UINT64 Context1 OPTIONAL,
- IN UINT64 Context2 OPTIONAL,
- IN UINT64 NewStack
+ IN UINT16 Cs,
+ IN UINT64 EntryPoint,
+ IN UINT64 Context1 OPTIONAL,
+ IN UINT64 Context2 OPTIONAL,
+ IN UINT64 NewStack
)
{
SWITCH_STACK_ENTRY_POINT NewEntryPoint;
@@ -1254,11 +1266,11 @@ UnitTestHostBaseLibAsmEnablePaging64 (
VOID
EFIAPI
UnitTestHostBaseLibAsmDisablePaging64 (
- IN UINT16 Cs,
- IN UINT32 EntryPoint,
- IN UINT32 Context1 OPTIONAL,
- IN UINT32 Context2 OPTIONAL,
- IN UINT32 NewStack
+ IN UINT16 Cs,
+ IN UINT32 EntryPoint,
+ IN UINT32 Context1 OPTIONAL,
+ IN UINT32 Context2 OPTIONAL,
+ IN UINT32 NewStack
)
{
SWITCH_STACK_ENTRY_POINT NewEntryPoint;
@@ -1291,8 +1303,8 @@ UnitTestHostBaseLibAsmDisablePaging64 (
VOID
EFIAPI
UnitTestHostBaseLibAsmGetThunk16Properties (
- OUT UINT32 *RealModeBufferSize,
- OUT UINT32 *ExtraStackSize
+ OUT UINT32 *RealModeBufferSize,
+ OUT UINT32 *ExtraStackSize
)
{
*RealModeBufferSize = 0;
@@ -1316,7 +1328,7 @@ UnitTestHostBaseLibAsmGetThunk16Properties (
VOID
EFIAPI
UnitTestHostBaseLibAsmPrepareThunk16 (
- IN OUT THUNK_CONTEXT *ThunkContext
+ IN OUT THUNK_CONTEXT *ThunkContext
)
{
}
@@ -1377,7 +1389,7 @@ UnitTestHostBaseLibAsmPrepareThunk16 (
VOID
EFIAPI
UnitTestHostBaseLibAsmThunk16 (
- IN OUT THUNK_CONTEXT *ThunkContext
+ IN OUT THUNK_CONTEXT *ThunkContext
)
{
}
@@ -1405,7 +1417,7 @@ UnitTestHostBaseLibAsmThunk16 (
VOID
EFIAPI
UnitTestHostBaseLibAsmPrepareAndThunk16 (
- IN OUT THUNK_CONTEXT *ThunkContext
+ IN OUT THUNK_CONTEXT *ThunkContext
)
{
}
@@ -1418,7 +1430,7 @@ UnitTestHostBaseLibAsmPrepareAndThunk16 (
VOID
EFIAPI
UnitTestHostBaseLibAsmWriteTr (
- IN UINT16 Selector
+ IN UINT16 Selector
)
{
mUnitTestHostBaseLibSegment[UNIT_TEST_HOST_BASE_LIB_SEGMENT_TR] = Selector;
@@ -1476,9 +1488,9 @@ UnitTestHostBaseLibAsmLfence (
VOID
EFIAPI
UnitTestHostBaseLibPatchInstructionX86 (
- OUT X86_ASSEMBLY_PATCH_LABEL *InstructionEnd,
- IN UINT64 PatchValue,
- IN UINTN ValueSize
+ OUT X86_ASSEMBLY_PATCH_LABEL *InstructionEnd,
+ IN UINT64 PatchValue,
+ IN UINTN ValueSize
)
{
}
@@ -1511,11 +1523,11 @@ UnitTestHostBaseLibPatchInstructionX86 (
UINT32
EFIAPI
AsmCpuid (
- IN UINT32 Index,
- OUT UINT32 *Eax OPTIONAL,
- OUT UINT32 *Ebx OPTIONAL,
- OUT UINT32 *Ecx OPTIONAL,
- OUT UINT32 *Edx OPTIONAL
+ IN UINT32 Index,
+ OUT UINT32 *Eax OPTIONAL,
+ OUT UINT32 *Ebx OPTIONAL,
+ OUT UINT32 *Ecx OPTIONAL,
+ OUT UINT32 *Edx OPTIONAL
)
{
return gUnitTestHostBaseLib.X86->AsmCpuid (Index, Eax, Ebx, Ecx, Edx);
@@ -1556,12 +1568,12 @@ AsmCpuid (
UINT32
EFIAPI
AsmCpuidEx (
- IN UINT32 Index,
- IN UINT32 SubIndex,
- OUT UINT32 *Eax OPTIONAL,
- OUT UINT32 *Ebx OPTIONAL,
- OUT UINT32 *Ecx OPTIONAL,
- OUT UINT32 *Edx OPTIONAL
+ IN UINT32 Index,
+ IN UINT32 SubIndex,
+ OUT UINT32 *Eax OPTIONAL,
+ OUT UINT32 *Ebx OPTIONAL,
+ OUT UINT32 *Ecx OPTIONAL,
+ OUT UINT32 *Edx OPTIONAL
)
{
return gUnitTestHostBaseLib.X86->AsmCpuidEx (Index, SubIndex, Eax, Ebx, Ecx, Edx);
@@ -1616,7 +1628,7 @@ AsmEnableCache (
UINT64
EFIAPI
AsmReadMsr64 (
- IN UINT32 Index
+ IN UINT32 Index
)
{
return gUnitTestHostBaseLib.X86->AsmReadMsr64 (Index);
@@ -1642,8 +1654,8 @@ AsmReadMsr64 (
UINT64
EFIAPI
AsmWriteMsr64 (
- IN UINT32 Index,
- IN UINT64 Value
+ IN UINT32 Index,
+ IN UINT64 Value
)
{
return gUnitTestHostBaseLib.X86->AsmWriteMsr64 (Index, Value);
@@ -2257,7 +2269,7 @@ AsmReadTr (
VOID
EFIAPI
AsmReadGdtr (
- OUT IA32_DESCRIPTOR *Gdtr
+ OUT IA32_DESCRIPTOR *Gdtr
)
{
gUnitTestHostBaseLib.X86->AsmReadGdtr (Gdtr);
@@ -2277,7 +2289,7 @@ AsmReadGdtr (
VOID
EFIAPI
AsmWriteGdtr (
- IN CONST IA32_DESCRIPTOR *Gdtr
+ IN CONST IA32_DESCRIPTOR *Gdtr
)
{
gUnitTestHostBaseLib.X86->AsmWriteGdtr (Gdtr);
@@ -2297,7 +2309,7 @@ AsmWriteGdtr (
VOID
EFIAPI
AsmReadIdtr (
- OUT IA32_DESCRIPTOR *Idtr
+ OUT IA32_DESCRIPTOR *Idtr
)
{
gUnitTestHostBaseLib.X86->AsmReadIdtr (Idtr);
@@ -2317,7 +2329,7 @@ AsmReadIdtr (
VOID
EFIAPI
AsmWriteIdtr (
- IN CONST IA32_DESCRIPTOR *Idtr
+ IN CONST IA32_DESCRIPTOR *Idtr
)
{
gUnitTestHostBaseLib.X86->AsmWriteIdtr (Idtr);
@@ -2353,7 +2365,7 @@ AsmReadLdtr (
VOID
EFIAPI
AsmWriteLdtr (
- IN UINT16 Ldtr
+ IN UINT16 Ldtr
)
{
gUnitTestHostBaseLib.X86->AsmWriteLdtr (Ldtr);
@@ -2373,7 +2385,7 @@ AsmWriteLdtr (
UINT64
EFIAPI
AsmReadPmc (
- IN UINT32 Index
+ IN UINT32 Index
)
{
return gUnitTestHostBaseLib.X86->AsmReadPmc (Index);
@@ -2398,9 +2410,9 @@ AsmReadPmc (
UINTN
EFIAPI
AsmMonitor (
- IN UINTN Eax,
- IN UINTN Ecx,
- IN UINTN Edx
+ IN UINTN Eax,
+ IN UINTN Ecx,
+ IN UINTN Edx
)
{
return gUnitTestHostBaseLib.X86->AsmMonitor (Eax, Ecx, Edx);
@@ -2423,8 +2435,8 @@ AsmMonitor (
UINTN
EFIAPI
AsmMwait (
- IN UINTN Eax,
- IN UINTN Ecx
+ IN UINTN Eax,
+ IN UINTN Ecx
)
{
return gUnitTestHostBaseLib.X86->AsmMwait (Eax, Ecx);
@@ -2480,7 +2492,7 @@ AsmInvd (
VOID *
EFIAPI
AsmFlushCacheLine (
- IN VOID *LinearAddress
+ IN VOID *LinearAddress
)
{
return gUnitTestHostBaseLib.X86->AsmFlushCacheLine (LinearAddress);
@@ -2616,11 +2628,11 @@ AsmDisablePaging32 (
VOID
EFIAPI
AsmEnablePaging64 (
- IN UINT16 Cs,
- IN UINT64 EntryPoint,
- IN UINT64 Context1 OPTIONAL,
- IN UINT64 Context2 OPTIONAL,
- IN UINT64 NewStack
+ IN UINT16 Cs,
+ IN UINT64 EntryPoint,
+ IN UINT64 Context1 OPTIONAL,
+ IN UINT64 Context2 OPTIONAL,
+ IN UINT64 NewStack
)
{
gUnitTestHostBaseLib.X86->AsmEnablePaging64 (Cs, EntryPoint, Context1, Context2, NewStack);
@@ -2659,11 +2671,11 @@ AsmEnablePaging64 (
VOID
EFIAPI
AsmDisablePaging64 (
- IN UINT16 Cs,
- IN UINT32 EntryPoint,
- IN UINT32 Context1 OPTIONAL,
- IN UINT32 Context2 OPTIONAL,
- IN UINT32 NewStack
+ IN UINT16 Cs,
+ IN UINT32 EntryPoint,
+ IN UINT32 Context1 OPTIONAL,
+ IN UINT32 Context2 OPTIONAL,
+ IN UINT32 NewStack
)
{
gUnitTestHostBaseLib.X86->AsmDisablePaging64 (Cs, EntryPoint, Context1, Context2, NewStack);
@@ -2693,8 +2705,8 @@ AsmDisablePaging64 (
VOID
EFIAPI
AsmGetThunk16Properties (
- OUT UINT32 *RealModeBufferSize,
- OUT UINT32 *ExtraStackSize
+ OUT UINT32 *RealModeBufferSize,
+ OUT UINT32 *ExtraStackSize
)
{
gUnitTestHostBaseLib.X86->AsmGetThunk16Properties (RealModeBufferSize, ExtraStackSize);
@@ -2717,7 +2729,7 @@ AsmGetThunk16Properties (
VOID
EFIAPI
AsmPrepareThunk16 (
- IN OUT THUNK_CONTEXT *ThunkContext
+ IN OUT THUNK_CONTEXT *ThunkContext
)
{
gUnitTestHostBaseLib.X86->AsmPrepareThunk16 (ThunkContext);
@@ -2779,7 +2791,7 @@ AsmPrepareThunk16 (
VOID
EFIAPI
AsmThunk16 (
- IN OUT THUNK_CONTEXT *ThunkContext
+ IN OUT THUNK_CONTEXT *ThunkContext
)
{
gUnitTestHostBaseLib.X86->AsmThunk16 (ThunkContext);
@@ -2808,7 +2820,7 @@ AsmThunk16 (
VOID
EFIAPI
AsmPrepareAndThunk16 (
- IN OUT THUNK_CONTEXT *ThunkContext
+ IN OUT THUNK_CONTEXT *ThunkContext
)
{
gUnitTestHostBaseLib.X86->AsmPrepareAndThunk16 (ThunkContext);
@@ -2822,7 +2834,7 @@ AsmPrepareAndThunk16 (
VOID
EFIAPI
AsmWriteTr (
- IN UINT16 Selector
+ IN UINT16 Selector
)
{
gUnitTestHostBaseLib.X86->AsmWriteTr (Selector);
@@ -2881,9 +2893,9 @@ AsmLfence (
VOID
EFIAPI
PatchInstructionX86 (
- OUT X86_ASSEMBLY_PATCH_LABEL *InstructionEnd,
- IN UINT64 PatchValue,
- IN UINTN ValueSize
+ OUT X86_ASSEMBLY_PATCH_LABEL *InstructionEnd,
+ IN UINT64 PatchValue,
+ IN UINTN ValueSize
)
{
gUnitTestHostBaseLib.X86->PatchInstructionX86 (InstructionEnd, PatchValue, ValueSize);
diff --git a/MdePkg/Library/BaseLib/X86WriteGdtr.c b/MdePkg/Library/BaseLib/X86WriteGdtr.c
index 1a570e3d9d..07ebb21959 100644
--- a/MdePkg/Library/BaseLib/X86WriteGdtr.c
+++ b/MdePkg/Library/BaseLib/X86WriteGdtr.c
@@ -6,9 +6,6 @@
**/
-
-
-
#include "BaseLibInternals.h"
/**
@@ -25,7 +22,7 @@
VOID
EFIAPI
AsmWriteGdtr (
- IN CONST IA32_DESCRIPTOR *Gdtr
+ IN CONST IA32_DESCRIPTOR *Gdtr
)
{
ASSERT (Gdtr != NULL);
diff --git a/MdePkg/Library/BaseLib/X86WriteIdtr.c b/MdePkg/Library/BaseLib/X86WriteIdtr.c
index 9ea979b76d..af8f8b3afc 100644
--- a/MdePkg/Library/BaseLib/X86WriteIdtr.c
+++ b/MdePkg/Library/BaseLib/X86WriteIdtr.c
@@ -6,9 +6,6 @@
**/
-
-
-
#include "BaseLibInternals.h"
/**
@@ -25,7 +22,7 @@
VOID
EFIAPI
AsmWriteIdtr (
- IN CONST IA32_DESCRIPTOR *Idtr
+ IN CONST IA32_DESCRIPTOR *Idtr
)
{
ASSERT (Idtr != NULL);