31134 Commits

Author SHA1 Message Date
Marvin Häuser
8ab268389f BaseUefiImageLib: Fix segment logging 2023-05-09 18:24:30 +03:00
Marvin Häuser
6d772a4b8e MdePkg/BasePeCoffLib2: Fix uninitialized RtContext for RelocateImage() 2023-05-09 18:24:30 +03:00
Marvin Häuser
3a16df0e2d MdePkg/BasePeCoffLib2: Fix RuntimeRelocate sanity-check 2023-05-09 18:24:30 +03:00
Marvin Häuser
c790116e13 ImageTool: Relocate using the IR 2023-05-09 18:24:30 +03:00
Marvin Häuser
4fccfa0359 ImageTool: Always store the full image segment data, including padding 2023-05-09 18:24:30 +03:00
Marvin Häuser
108c0769ad ImageTool: Don't shrink segment DataSize during validation 2023-05-09 18:24:30 +03:00
Marvin Häuser
efc88fb685 MdePkg/PeCoffLib2: Expose ARM Thumb MOVW/MOVT relocation helpers 2023-05-09 18:24:30 +03:00
Marvin Häuser
98179a20bf BaseTools: Simplify ELF-to-PE build 2023-05-09 18:24:30 +03:00
Marvin Häuser
141a48425c ImageTool: Unify 32-bit and 64-bit tool variants 2023-05-09 18:24:30 +03:00
Marvin Häuser
270a038c4d ImageTool: Don't output errors for ElfScan() RETURN_UNSUPPORTED 2023-05-09 18:24:30 +03:00
Marvin Häuser
35049dd27c ImageTool: Remove ImageInfo global state 2023-05-09 18:24:30 +03:00
Marvin Häuser
49d174dd95 ImageTool: Remove global state from ELF scanning 2023-05-09 18:24:30 +03:00
Mikhail Krichanov
d6b9b3c21b Added .md file summarizing current states of packages. 2023-05-09 18:24:30 +03:00
Mikhail Krichanov
fb8bf205c3 Fixed compilation of all packages tracked by CI after rebasing upon edk2-stable202302. 2023-05-09 18:24:30 +03:00
Marvin Häuser
8f3ea92eda BaseTools/build_rule: Drop deprecated ASM16 definition 2023-05-09 18:24:30 +03:00
Mikhail Krichanov
c7edf90a16 Drop support for the TE format 2023-05-09 18:24:29 +03:00
Marvin Häuser
8d93295a77 ArmPkg/ArmMmuLib: ASSERT ArmReplaceLiveTranslationEntry alignment 2023-05-09 18:24:29 +03:00
Marvin Häuser
5e15fce5d3 MdeModulePkg/ExtendedFirmwarePerformance: Fix FPDT struct alignment 2023-05-09 18:24:29 +03:00
Marvin Häuser
319a83ad2b UefiPayloadPkg/UefiPayloadEntry: Return image destination size as UINT32 2023-05-09 18:24:29 +03:00
Mikhail Krichanov
e04de5db08 ArmPkg/ArmMmuLib: Fix ArmReplaceLiveTranslationEntry() alignment
As the ASM_FUNC() macro performs a section switch, the preceding
.balign directive applies the alignment constraint to the current
location in the previous section. As the linker may not merge the
sections in-order, ArmReplaceLiveTranslationEntry() may be left
unaligned.

Replace the explicit invocation of .balign with the ASM_FUNC_ALIGN()
macro, which guarantees the alignment constraint is applied correctly.
To make sure related issues are reliably caught in the future, align the
end of the function before checking the total occupied size. This
ensures crossing a 0x200 boundary will cause a compilation error.

Signed-off-by: Marvin Häuser <mhaeuser@posteo.de>
Reviewed-by: Leif Lindholm <quic_llindhol@quicinc.com>
Reviewed-by: Ard Biesheuvel <ardb@kernel.org>
2023-05-09 18:24:29 +03:00
Mikhail Krichanov
c16951f06e ArmPkg/AsmMacroIoLibV8: Introduce ASM_FUNC_ALIGN()
With the current ASM_FUNC() macro, there is no good way to declare an
alignment constraint for a function. As ASM_FUNC() switches sections,
declaring the constraint before the macro invocation applies it to the
current location in the previous section. Declaring the constraint after
the macro invocation lets the function label point to the location prior
to alignment. Depending on toolchain behaviour, this may cause the label
to point to alignment padding preceding the actual function definition.

To address these issues, introduce the ASM_FUNC_ALIGN() macro, which
declares the alignment constraint right before the function label.

Signed-off-by: Marvin Häuser <mhaeuser@posteo.de>
Reviewed-by: Ard Biesheuvel <ardb@kernel.org>
2023-05-09 18:24:29 +03:00
Mikhail Krichanov
bef3e16d5d MdePkg/ProcessorBind AARCH64: Add asm macro to emit GNU BTI note
Implement a CPP macro that can be called from .S files to emit the .note
section carrying the annotation that informs the linker that the object
file is compatible with BTI control flow integrity checks.

Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
Reviewed-by: Leif Lindholm <quic_llindhol@quicinc.com>
Reviewed-by: Oliver Smith-Denny <osd@smith-denny.com>
2023-05-09 18:24:29 +03:00
Savva Mitrofanov
f3d158c6a0 ArmVirtPkg/ArmVirtQemu: Disable PcdPrePiProduceMemoryTypeInformationHob for ARM
The PcdPrePiProduceMemoryTypeInformationHob on ARM breaks Linux efistub
boot. The efistub for arm32 uncompresses Linux kernel into memory ranges
which occupied by DXE-phase drivers which leads to
'permission denied'-error during page write. So as a temporary solution
we use PcdPrePiProduceMemoryTypeInformationHob only for AARCH64

Signed-off-by: Savva Mitrofanov <savvamtr@gmail.com>
2023-05-09 18:24:29 +03:00
vit9696
b063a20c61 MdePkg: Fix uninitialised access in SafeString 2023-05-09 18:24:29 +03:00
Mikhail Krichanov
c2aa73cf3d UefiImageLib: Ensure consistently passing the full buffer size 2023-05-09 18:24:29 +03:00
Mikhail Krichanov
002702671a BaseTools/CommonLib: Consume MemoryAllocationLib 2023-05-09 18:24:29 +03:00
Marvin Häuser
2dcbc0591a EmbeddedPkg/PrePiLib: Deduplicate MemoryAllocationLib declarations 2023-05-09 18:24:29 +03:00
Marvin Häuser
5ac7f80191 EmbeddedPkg/NonCoherentDmaLib: Utilize AllocateAlignedPagesEx 2023-05-09 18:24:29 +03:00
Marvin Häuser
9ef906f695 MdePkg/UefiImageLib: Require callers to allocate aligned memory 2023-05-09 18:24:29 +03:00
Marvin Häuser
91f0ea84f1 MdePkg/MemoryAllocationLib: Add Allocate(Aligned)CodePages 2023-05-09 18:24:29 +03:00
Marvin Häuser
581e3aa89a EmulatorPkg/Host: Consume MemoryAllocationLib 2023-05-09 18:24:29 +03:00
Mikhail Krichanov
4c8f3ef802 MdePkg: Introduce CommonMemoryAllocationLib 2023-05-09 18:24:29 +03:00
Marvin Häuser
91775aef7f MdeModulePkg: Manage MemoryProfileLib separately 2023-05-09 18:24:29 +03:00
Marvin Häuser
dcce25f5f6 MdePkg/Base.h: Introduce ALIGN_VALUE_SUBTRAHEND 2023-05-09 18:24:29 +03:00
Marvin Häuser
1efda6d0c8 EmulatorPkg/Host: Remove orphaned GetImageReadFunction() 2023-05-09 18:24:29 +03:00
Marvin Häuser
365039693c MdeModulePkg/CorePei: Remove unused ShadowedImageRead member 2023-05-09 18:24:29 +03:00
Marvin Häuser
124e8a5ec2 BaseTools/GenFvInternalLib: Remove unused BaseOfCode parameter 2023-05-09 18:24:29 +03:00
Marvin Häuser
a521baefbd EmulatorPkg: Fix some image loader related issues 2023-05-09 18:24:29 +03:00
Marvin Häuser
d1ba5a8064 EmulatorPkg: Fix Thunk PPI/Protocol library types 2023-05-09 18:24:29 +03:00
Marvin Häuser
ca3235b347 EmulatorPkg/Host: Remove orphaned SecImageRead() 2023-05-09 18:24:29 +03:00
Marvin Häuser
ad21bf30bc BaseTools/GenFv: Remove duplicated alignment macros 2023-05-09 18:24:29 +03:00
Marvin Häuser
414fd1789b MdeModulePkg/PiSmmCore: Fix fixed address loading 2023-05-09 18:24:29 +03:00
Marvin Häuser
03b44331ec EmulatorPkg/Host: Fix XCODE5 build 2023-05-09 18:24:29 +03:00
Marvin Häuser
d67c631c7c UefiCpuPkg/CpuExceptionHandlerLib: Fix wrong use of relative addressing
HookAfterStubHeader is copied before execution. Thus, relative
addressing cannot safely be used for anything outside the copy range.
Fix the reference of HookAfterStubHeaderEnd to be absolute.

This change alone violates an undocumented requirement that
HookAfterStubHeader and AsmIdtVector are structurally equivalent (their
respective sizes in particular). Resolve this by treating them (and in
particular their sizes) independently.
2023-05-09 18:24:28 +03:00
Marvin Häuser
52aff92912 BaseTools/DevicePath: Consume MdePkg/UefiDevicePathLib
BaseTools has been duplicating and adapting code that is defined in
MdePkg and MdeModulePkg. This leads to desync issues where the same
symbols may be backed by different functions with slightly different
semantics and also fixes that apply only to BaseTools or only to MdePkg
and MdeModulePkg.

To address these issues, update BaseTools/Source/C to utilize the code
from MdePkg and MdeModulePkg.

Signed-off-by: Marvin Häuser <mhaeuser@posteo.de>
2023-05-09 18:24:28 +03:00
Marvin Häuser
e21683c782 BaseTools/CommonLib: Consume MdePkg and MdeModulePkg
BaseTools has been duplicating and adapting code that is defined in
MdePkg and MdeModulePkg. This leads to desync issues where the same
symbols may be backed by different functions with slightly different
semantics and also fixes that apply only to BaseTools or only to MdePkg
and MdeModulePkg.

To address these issues, update BaseTools/Source/C to utilize the code
from MdePkg and MdeModulePkg.

Signed-off-by: Marvin Häuser <mhaeuser@posteo.de>
2023-05-09 18:24:28 +03:00
Marvin Häuser
1aae1df13e UefiCpuPkg/MtrrLib: Add missing PcdLib.h include
MtrrLib does not include PcdLib.h despite explicitly using its
definitions. Add the include to fix compilation for modules that do not
utilize AutoGen.

Signed-off-by: Marvin Häuser <mhaeuser@posteo.de>
2023-05-09 18:24:28 +03:00
Marvin Häuser
1ae00e9036 MdePkg/Base.h: Add support for C++ alignof
In preparation of including Base.h in C++ BaseTools programs, support
the C++ 11 alignof operator. The C _Alignof operator is not universally
supported in C++ mode across compiler toolchains and thus the current
definition may lead to compilation errors with said programs.

Signed-off-by: Marvin Häuser <mhaeuser@posteo.de>
2023-05-09 18:24:28 +03:00
Marvin Häuser
cfee123a4e MdePkg/Base.h: Only use C++ static_assert when supported
To support GoogleTest, 933b4c3 added support for C++ static_assert.
However, this is not a mandatory or universally supported C++ feature.
Guard its usage by the __cpp_static_assert support flag.

Signed-off-by: Marvin Häuser <mhaeuser@posteo.de>
2023-05-09 18:24:28 +03:00
Mikhail Krichanov
360279542d FatPkg: Adds support for read-only mode
Implements gEfiFatPkgTokenSpaceGuid token space and adds token which
disables write operations. By default driver still supports read-write
mode

Signed-off-by: Savva Mitrofanov <savvamtr@gmail.com>
2023-05-09 18:24:28 +03:00