Acidanthera UEFI Development Kit based on EDK II edk2-stable202311
Go to file
Heyi Guo 41f890164b ArmPkg/Mmu: Fix literal number left shift bug
There is a hidden bug for below code:

(1 << BaseAddressAlignment) & *BlockEntrySize

From disassembly code, we can see the literal number 1 will be treated
as INT32 by compiler by default, and we'll get 0xFFFFFFFF80000000 when
BaseAddressAlignment is equal to 31. So we will always get 31 when
alignment is larger than 31.

    if ((1 << BaseAddressAlignment) & *BlockEntrySize) {
5224: f9404be0  ldr x0, [sp,#144]
5228: 2a0003e1  mov w1, w0
522c: 52800020  mov w0, #0x1                    // #1
5230: 1ac12000  lsl w0, w0, w1
5234: 93407c01  sxtw  x1, w0

The bug can be replayed on QEMU AARCH64; by adding some debug print,
we can see lots of level 1 tables created (for block of 1GB) even
when the region is large enough to use 512GB block size.

Use LowBitSet64() in BaseLib instead to fix the bug.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Heyi Guo <heyi.guo@linaro.org>
Cc: Leif Lindholm <leif.lindholm@linaro.org>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18423 6f19259b-4bc3-4df7-8a09-765794883524
2015-09-09 13:37:33 +00:00
AppPkg */Contributions.txt: Update example email address 2015-02-03 17:29:14 +00:00
ArmPkg ArmPkg/Mmu: Fix literal number left shift bug 2015-09-09 13:37:33 +00:00
ArmPlatformPkg ArmPlatformPkg/HdLcd: add missing LcdIdentify() 2015-09-04 10:02:43 +00:00
ArmVirtPkg ArmVirtPkg: revert unintended change to ArmVirt.dsc.inc 2015-08-26 12:09:39 +00:00
BaseTools Revert the change in r18404. 2015-09-06 08:58:25 +00:00
BeagleBoardPkg BeagleBoardPkg: remove outdated build scripts and instructions 2015-08-12 05:25:41 +00:00
Conf EDK II: Add .gitignore 2014-10-14 16:08:15 +00:00
CorebootModulePkg CorebootModulePkg:Removing EFI_RESOURCE_ATTRIBUTE_TESTED 2015-08-18 16:08:22 +00:00
CorebootPayloadPkg CorebootPayloadPkgIa32: Don't specify X64 architecture 2015-07-27 06:43:29 +00:00
CryptoPkg CryptoPkg: Fix one wrong parameter for weak key checking 2015-09-02 08:44:46 +00:00
DuetPkg DuetPkg: Use the new PCDs defined in MdePkg. 2015-05-06 03:26:49 +00:00
EdkCompatibilityPkg EdkCompatibilityPkg: Remove gZeroGuid def in FrameworkHiiOnUefiHiiThunk 2015-07-07 03:05:18 +00:00
EdkShellBinPkg */Contributions.txt: Update example email address 2015-02-03 17:29:14 +00:00
EdkShellPkg */Contributions.txt: Update example email address 2015-02-03 17:29:14 +00:00
EmbeddedPkg EmbeddedPkg: remove mention of ARMGCC 2015-08-12 05:25:19 +00:00
EmulatorPkg EmulatorPkg: Link separated VarCheckUefiLib NULL class library instance 2015-08-25 03:03:05 +00:00
FatBinPkg FatBinPkg: Update EBC/IA32/X64/IPF binaries 2015-08-28 03:14:25 +00:00
IntelFrameworkModulePkg IntelFrameworkModulePkg: Ad the missing module UNI files. 2015-08-28 02:47:31 +00:00
IntelFrameworkPkg IntelFrameworkPkg: Update DEC and DSC version from 0.94 to 0.96 2015-08-20 08:45:45 +00:00
IntelFspPkg Handle extra module patchable PCD variable in Linux map. 2015-09-06 22:36:43 +00:00
IntelFspWrapperPkg FspNotifyDxe need handle >4G memory. 2015-07-28 07:26:57 +00:00
MdeModulePkg Fixed GCC tool chain build fail. 2015-09-09 06:29:14 +00:00
MdePkg MdePkg: Correct Protocol usages in UefiDebugLibDebugPortProtocol 2015-09-08 08:28:56 +00:00
NetworkPkg NetworkPkg: Fix suspicious dereference of pointer 'FieldCount' 2015-09-08 02:01:05 +00:00
Nt32Pkg Nt32Pkg: Keep boot behavior using new BDS almost same as that using old BDS 2015-08-25 09:51:07 +00:00
Omap35xxPkg */Contributions.txt: Update example email address 2015-02-03 17:29:14 +00:00
OptionRomPkg OptionRomPkg: Remove redundant included header file defintion in Ax88772.h and Ax88772b.h files 2015-07-08 02:56:54 +00:00
OvmfPkg OvmfPkg: PlatformPei: force 32-bit MMIO aperture above 3 GB on Q35 2015-09-02 18:45:44 +00:00
PcAtChipsetPkg PcAtChipsetPkg/PciHostBridgeDxe/PciRootBridgeIo.c: rewrap code, strip trailing ws 2015-07-14 12:01:30 +00:00
PerformancePkg PerformancePkg Dp_App: Fix ASSERT in GetNameFromHandle 2015-07-13 01:24:44 +00:00
SecurityPkg SecurityPkg: Use pointer instead of array to make code readable. 2015-09-06 06:22:24 +00:00
ShellBinPkg ShellBinPkg: Ia32/X64 Shell binary update. 2015-08-28 04:51:21 +00:00
ShellPkg ShellPkg: Fix 'for' command fail with multiple fields. 2015-09-09 04:57:05 +00:00
SourceLevelDebugPkg SourceLevelDebugPkg/DebugTimer: Timer count value 0 not calculated 2015-08-27 02:08:56 +00:00
StdLib StdLib: remove mention of ARMGCC 2015-08-12 05:25:12 +00:00
StdLibPrivateInternalFiles */Contributions.txt: Update example email address 2015-02-03 17:29:14 +00:00
UefiCpuPkg UefiCpuPkg/MtrrLib: MtrrValidBitsMask and MtrrValidAddressMask wrong 2015-09-05 02:07:02 +00:00
UnixPkg UnixPkg: Remove UnixPkg files (It is replaced by EmulatorPkg) 2013-07-29 21:09:55 +00:00
Vlv2DeviceRefCodePkg Fixed C-State issue of CPU1 of dual core. 2015-09-01 01:22:49 +00:00
Vlv2TbltDevicePkg Vlv2TbltDevicePkg: Link separated VarCheckUefiLib NULL class library instance 2015-08-25 03:04:18 +00:00
.gitignore EDK II: Add .gitignore 2014-10-14 16:08:15 +00:00
BuildNotes2.txt Update to new SVN URL in readme.txt 2013-06-08 05:26:39 +00:00
Edk2Setup.bat Edk2: Update Edk2Setup.bat 2015-06-16 07:23:45 +00:00
Maintainers.txt Maintainers.txt: Add Daryl's new email address 2015-07-26 08:06:05 +00:00
edksetup.bat Update edksetup.bat to support Microsoft Visual Studio 2013 when building the Nt32Pkg emulation platform (enabled using the --nt32 flag). 2014-10-30 17:09:25 +00:00
edksetup.sh edksetup.sh: Ensure that WORKSPACE points to the top of an edk2 checkout 2014-07-28 17:37:40 +00:00