mirror of https://github.com/acidanthera/audk.git
ArmPkg/ArmMmuLib: Explicitly cast UINT32 data conversions
REF:https://bugzilla.tianocore.org/show_bug.cgi?id=2835 There's several occurrences of a UINT64 or an EFI_PHYSICAL_ADDRESS being assigned to a UINT32 value in ArmMmuLib. These result in warning C4244 in VS2019: warning C4244: '=': conversion from 'UINT64' to 'UINT32', possible loss of data warning C4244: '=': conversion from 'EFI_PHYSICAL_ADDRESS' to 'UINT32', possible loss of data This change explicitly casts the values to UINT32. These can be reproduced with the following build command: build -b DEBUG -a ARM -t VS2019 -p ArmPkg/ArmPkg.dsc -m ArmPkg/Library/ArmMmuLib/ArmMmuBaseLib.inf Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com> Reviewed-by: Ard Biesheuvel <ard.biesheuvel@arm.com>
This commit is contained in:
parent
24cf727265
commit
2bdc90429a
|
@ -225,7 +225,7 @@ FillTranslationTable (
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
PhysicalBase = MemoryRegion->PhysicalBase;
|
PhysicalBase = (UINT32)MemoryRegion->PhysicalBase;
|
||||||
RemainLength = MIN(MemoryRegion->Length, SIZE_4GB - PhysicalBase);
|
RemainLength = MIN(MemoryRegion->Length, SIZE_4GB - PhysicalBase);
|
||||||
|
|
||||||
switch (MemoryRegion->Attributes) {
|
switch (MemoryRegion->Attributes) {
|
||||||
|
@ -291,7 +291,7 @@ FillTranslationTable (
|
||||||
PhysicalBase += TT_DESCRIPTOR_SECTION_SIZE;
|
PhysicalBase += TT_DESCRIPTOR_SECTION_SIZE;
|
||||||
RemainLength -= TT_DESCRIPTOR_SECTION_SIZE;
|
RemainLength -= TT_DESCRIPTOR_SECTION_SIZE;
|
||||||
} else {
|
} else {
|
||||||
PageMapLength = MIN (RemainLength, TT_DESCRIPTOR_SECTION_SIZE -
|
PageMapLength = MIN ((UINT32)RemainLength, TT_DESCRIPTOR_SECTION_SIZE -
|
||||||
(PhysicalBase % TT_DESCRIPTOR_SECTION_SIZE));
|
(PhysicalBase % TT_DESCRIPTOR_SECTION_SIZE));
|
||||||
|
|
||||||
// Case: Physical address aligned on the Section Size (1MB) && the length
|
// Case: Physical address aligned on the Section Size (1MB) && the length
|
||||||
|
|
|
@ -152,7 +152,7 @@ UpdatePageEntries (
|
||||||
FirstLevelTable = (ARM_FIRST_LEVEL_DESCRIPTOR *)ArmGetTTBR0BaseAddress ();
|
FirstLevelTable = (ARM_FIRST_LEVEL_DESCRIPTOR *)ArmGetTTBR0BaseAddress ();
|
||||||
|
|
||||||
// Calculate number of 4KB page table entries to change
|
// Calculate number of 4KB page table entries to change
|
||||||
NumPageEntries = Length / TT_DESCRIPTOR_PAGE_SIZE;
|
NumPageEntries = (UINT32)(Length / TT_DESCRIPTOR_PAGE_SIZE);
|
||||||
|
|
||||||
// Iterate for the number of 4KB pages to change
|
// Iterate for the number of 4KB pages to change
|
||||||
Offset = 0;
|
Offset = 0;
|
||||||
|
@ -288,7 +288,7 @@ UpdateSectionEntries (
|
||||||
ASSERT (FirstLevelIdx < TRANSLATION_TABLE_SECTION_COUNT);
|
ASSERT (FirstLevelIdx < TRANSLATION_TABLE_SECTION_COUNT);
|
||||||
|
|
||||||
// calculate number of 1MB first level entries this applies to
|
// calculate number of 1MB first level entries this applies to
|
||||||
NumSections = Length / TT_DESCRIPTOR_SECTION_SIZE;
|
NumSections = (UINT32)(Length / TT_DESCRIPTOR_SECTION_SIZE);
|
||||||
|
|
||||||
// iterate through each descriptor
|
// iterate through each descriptor
|
||||||
for(i=0; i<NumSections; i++) {
|
for(i=0; i<NumSections; i++) {
|
||||||
|
|
Loading…
Reference in New Issue