| Age | Commit message (Collapse) | Author | Files | Lines |
|
The library instances in the package are not built in the components
section of the DSC file. Pre-existing issues related to not testing
the build were addressed in previous commits.
This change now adds the package library instances to the components
section of EmulatorPkg.dsc and enables the DscCompleteCheck plugin
in EmulatorPkg.ci.yaml to ensure that instances are built going
forward.
Three redfish-related library instances are excluded from the
DscCompleteCheck plugin because they are only built when
`REDFISH_ENABLE` is `TRUE`.
The `EmuThunkLib` library class overrride on DxeMain is removed since
it is already specified in the `LibraryClasses.common.DXE_CORE`
section.
Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
|
|
This library instance refers to a header file that does not exist,
is not built in the package DSC, and when built fails to compile.
There are no dependencies on the library instance and any potential
consumers would fail to build. It is simply removed in this commit.
Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
|
|
Compiling the library instance standalone leads to compilation
errors due to unused variables in `InternalAllocatePages()` and
`InternalAllocateAlignedPages()`.
Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
|
|
Fixes markdown formatting issues reported by the markdownlint plugin
and enables the check in EmulatorPkg.ci.yaml.
No substantial content changes are made other than modifying text
where necessary to fix the markdownlint violations.
The markdown files currently contain quite a bit of stale information.
Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
|
|
EmulatorPkg.dsc maps PeCoffExtraActionLib to DxeEmuPeCoffExtraActionLib
in a [LibraryClasses] section that explicitly includes UEFI_APPLICATION,
but the INF does not list UEFI_APPLICATION in its LIBRARY_CLASS. Any
UEFI_APPLICATION consuming PeCoffExtraActionLib fails to build.
This is not a recent regression. Fixed for internal consistency.
Signed-off-by: Doug Cook <idigdoug@gmail.com>
|
|
EmuThunkLib was recently updated (commit 143032958ea9, PR #13006) to
declare an explicit list of supported module types. The new list does
not include UEFI_APPLICATION.
This contradicts EmulatorPkg.dsc, which maps EmuThunkLib to DxeEmuLib in
a [LibraryClasses] section that explicitly includes UEFI_APPLICATION.
In addition, five EmulatorPkg libraries declare UEFI_APPLICATION support
and consume EmuThunkLib, so any UEFI_APPLICATION using one of them now
fails to build:
- DxeCoreTimerLib
- DxeEmuSerialPortLib
- DxeEmuStdErrSerialPortLib
- DxeTimerLib
- GuardUefiMemoryAllocationLib
Fix by adding UEFI_APPLICATION to the LIBRARY_CLASS of DxeEmuLib.inf.
Signed-off-by: Doug Cook <idigdoug@gmail.com>
|
|
Add multiple library class entries for libraries that multiple implement
library classes.
Signed-off-by: Khalid Ali <khaliidcaliy@gmail.com>
|
|
After SecTemporaryRamSupport restores its saved registers and moves RSP to
permanent memory, the stack is 16-byte aligned. The existing 0x28-byte
allocation for the ZeroMem call adds an unnecessary 8-byte padding slot
and leaves RSP misaligned immediately before the call.
Reserve only the 32-byte EFIAPI register spill area for ZeroMem. This
preserves 16-byte stack alignment at the call site while providing the
required home space to the callee.
https://github.com/tianocore/edk2/pull/12244 causes the X64 GCC and CLANG
tools to generate a prologue in InternalMemZeroMem() that requires a
16-byte aligned stack. With the previous stack allocation, that prologue
can execute with an incorrectly aligned stack. Without this change, a
seg fault is generated when SecTemporaryRamSupport calls ZeroMem.
The earlier CopyMem call continues to require its 0x28-byte allocation
because its preceding stack state differs.
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
|
|
In preparation for the MarkdownLintCheck plugin being added to the
repo, this change defaults the plugin to `AuditOnly` mode in each
package. This allows package maintainers to enable the plugin as they
see fit.
Continuous-integration-options: PatchCheck.ignore-multi-package
Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
|
|
This updates the VS2022 EmulatorPkg CI to VS2026.
Signed-off-by: Oliver Smith-Denny <osde@microsoft.com>
|
|
edk2 is moving to VS2026 for the MSVC toolchain.
Update the building instructions and DSC conditionals.
Signed-off-by: Oliver Smith-Denny <osde@microsoft.com>
|
|
GptLib is a new library class consumed both by PartitionDxe (built by
essentially every platform) and by DxeTpm2MeasureBootLib. Any platform DSC
that builds either module must resolve the GptLib library class, otherwise
the build fails with "Instance of library class [GptLib] is not found".
Resolve GptLib in EmulatorPkg/EmulatorPkg.dsc, which builds PartitionDxe.
Out-of-tree platforms consuming either module need the same one-line
resolution.
Signed-off-by: Richard Lyu <richard.lyu@suse.com>
|
|
VS2017 support is being removed from edk2. This Visual Studio solution
built the EmulatorPkg host with the VS2017 toolchain (`-t VS2017`),
which will no longer exist in tools_def.template. The EmulatorPkg
documentation and CI build with VS2022, so the VS2017 solution is
removed.
Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
|
|
Replace manual alignment checks with IS_ALIGNED() and
ADDRESS_IS_ALIGNED().
Convert the following bitmask and modulo forms:
- ((E & ((PowOf2Expr) - ONE)) == ZERO)
- ((E & ((PowOf2Expr) - ONE)) != ZERO)
- ((E % (PowOf2Expr)) == ZERO)
- ((E % (PowOf2Expr)) != ZERO)
to the corresponding helper macro forms:
+ IS_ALIGNED (E, PowOf2Expr)
+ !IS_ALIGNED (E, PowOf2Expr)
PowOf2Expr is limited to known power-of-two expressions, including
SIZE_* and BASE_* macros, EFI_PAGE_SIZE, CPU_STACK_ALIGNMENT,
RUNTIME_PAGE_ALLOCATION_GRANULARITY, sizeof() of UEFI integer types
(e.g. BOOLEAN, CHAR16, UINT32, UINTN) and pointer types, and 1 << E1
expressions.
Address checks that cast the checked value to UINTN are written with
ADDRESS_IS_ALIGNED().
The change was generated with the Coccinelle semantic patch below.
```smpl
@power_of_2_expr@
expression PowOf2Expr;
expression E1;
typedef BOOLEAN, CHAR8, CHAR16, INT8, UINT8, INT16, UINT16, INT32, UINT32, INT64, UINT64, INTN, UINTN;
type ScalarType = { BOOLEAN, CHAR8, CHAR16, INT8, UINT8, INT16, UINT16, INT32, UINT32, INT64, UINT64, INTN, UINTN };
type AnyType;
type PointerType = AnyType *;
idexpression ScalarType ScalarValue;
idexpression PointerType PointerValue;
constant SizeBase =~ "^(SIZE|BASE)_(1|2|4|8|16|32|64|128|256|512)[KMGTPE]B$";
constant NamedPowerOf2 =~ "^(EFI_PAGE_SIZE|CPU_STACK_ALIGNMENT|RUNTIME_PAGE_ALLOCATION_GRANULARITY)$";
constant ONE = {1, 1U, 1u};
@@
(
(
SizeBase
|
NamedPowerOf2
|
ONE << E1
|
sizeof (ScalarType)
|
sizeof (PointerType)
|
sizeof (ScalarValue)
|
sizeof (PointerValue)
)
&
PowOf2Expr
)
@aligned depends on power_of_2_expr disable is_zero,isnt_zero@
expression E;
expression power_of_2_expr.PowOf2Expr;
constant ONE = {1, 1U, 1u};
constant ZERO = {0, 0U, 0u};
@@
(
((E & (E - ONE)) == ZERO)
|
- ((E & ((PowOf2Expr) - ONE)) == ZERO)
+ IS_ALIGNED (E, PowOf2Expr)
|
((E & (E - ONE)) != ZERO)
|
- ((E & ((PowOf2Expr) - ONE)) != ZERO)
+ !IS_ALIGNED (E, PowOf2Expr)
|
- ((E % (PowOf2Expr)) == ZERO)
+ IS_ALIGNED (E, PowOf2Expr)
|
- ((E % (PowOf2Expr)) != ZERO)
+ !IS_ALIGNED (E, PowOf2Expr)
)
@address_is_aligned@
typedef UINTN;
expression *Address;
expression Alignment;
@@
- IS_ALIGNED ((UINTN) Address, Alignment)
+ ADDRESS_IS_ALIGNED (Address, Alignment)
@normalize_aligned disable paren expression@
expression E, SZ;
@@
(
- (IS_ALIGNED (E, SZ))
+ IS_ALIGNED (E, SZ)
|
- (!IS_ALIGNED (E, SZ))
+ !IS_ALIGNED (E, SZ)
)
@normalize_macro_args disable paren expression@
expression E, SZ;
@@
(
- IS_ALIGNED ((E), SZ)
+ IS_ALIGNED (E, SZ)
|
- IS_ALIGNED (E, (SZ))
+ IS_ALIGNED (E, SZ)
)
```
Signed-off-by: Mingjie Shen <shen497@purdue.edu>
|
|
In EmulatorPkg/Unix/Host driver, gEmuIoThunkProtocolGuid appears twice
in [Procotols] section, so remove the duplicate one.
Signed-off-by: Qihang Gao <gaoqihang@loongson.cn>
|
|
Symptom:Unsafe typecasting may lead to out‑of‑bound memory access
RootCause: FileSize, FileLength and SectionLength are declared as
UINT32 and masked with 0x00FFFFFF to store only the lower 24 bits.
Although this approach yields the correct result,
it introduces a potential risk due to unsafe typecasting and
dereferencing.
Solution: Using the predefined macro FFS_FILE_SIZE()
and SECTION_SIZE from MdePkg\Include\Pi\PiFirmwareFile.h,
which safely performs the same operation by reconstructing
the size using individual byte access.
This commit also addresses the fix for coverity issue "OVERRUN"
Cc: Sachin Ganesh <sachinganesh@ami.com>
Signed-off-by: Gowtham M <gowthamm@ami.com>
|
|
Clear DLINK_XIPFLAGS to disable use of alignment flags
for all tool chains. Setting alignment flags other than
the OS application defaults are not required for
EmulatorPkg builds.
Add and/or clarify comments to explain the overrides to
the default firmware build configurations required for
EmulatorPkg.dsc builds.
Align Mingw CLANGDWARF to GCC by moving the application
libraries into DLINK2_FLAGS.
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
|
|
CLANGPDB build of EmulatorPkg is supported on Windows, but not Linux.
In order to complete CLANGPDB CI, introduce an Azure pipelines file to
run this build. The file is a duplicate of current Windows-VS.yml in the
same directory simply with the toolchain changed, similar to the approach
taken in recent commits to add Ubuntu CLANGDWARF and CLANGPDB CI.
Signed-off-by: Mike Beaton <mjsbeaton@gmail.com>
|
|
EmulatorPkg currently fails to build under CLANGPDB with
link time errors. Since EmulatorPkg is a legacy package which
is currently not being built with CLANGPDB, it is considered
simpler to simply exclude this.
Signed-off-by: Mike Beaton <mjsbeaton@gmail.com>
|
|
Subsequent commits remove build steps which CLANGPDB
cannot build.
Continuous-integration-options: PatchCheck.ignore-multi-package
Signed-off-by: Mike Beaton <mjsbeaton@gmail.com>
|
|
See discussion in #11886.
Continuous-integration-options: PatchCheck.ignore-multi-package
Signed-off-by: Mike Beaton <mjsbeaton@gmail.com>
|
|
A subsequent commit removes build steps which CLANGDWARF
cannot build.
Continuous-integration-options: PatchCheck.ignore-multi-package
Signed-off-by: Mike Beaton <mjsbeaton@gmail.com>
|
|
Now that we have introduced default_linux_vm, the naming becomes
somewhat confusing, since there are two different images specified
for two different reasons.
By naming one of them _vm and the other _container
we surface their intended usage in their variable name.
Continuous-integration-options: PatchCheck.ignore-multi-package
Signed-off-by: Mike Beaton <mjsbeaton@gmail.com>
|
|
The pool vmImage for running Azure Pipelines jobs is always either
'windows-2022' or 'ubuntu-24.02'. Move these default values to
defaults.yml so they can be changed in one location in future.
Continuous-integration-options: PatchCheck.ignore-multi-package
Signed-off-by: Mike Beaton <mjsbeaton@gmail.com>
|
|
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
|
|
Note the GCC tool chain tag is currently intended to be compatible
with gcc releases 8 and higher.
Signed-off-by: Mike Beaton <mjsbeaton@gmail.com>
|
|
Replace traditional `#ifndef`/`#define`/`#endif` include guards with
`#pragma` once.
`#pragma once` is a widely supported preprocessor directive that
prevents header files from being included multiple times. It is
supported by all toolchains used to build edk2: GCC, Clang/LLVM, and
MSVC.
Compared to macro-based include guards, `#pragma once`:
- Eliminates the risk of macro name collisions or copy/paste errors
where two headers inadvertently use the same guard macro.
- Eliminate inconsistency in the way include guard macros are named
(e.g., some files use `__FILE_H__`, others use `FILE_H_`, etc.).
- Reduces boilerplate (three lines replaced by one).
- Avoids polluting the macro namespace with guard symbols.
- Can improve build times as the preprocessor can skip re-opening the
file entirely, rather than re-reading it to find the matching
`#endif` ("multiple-include optimization").
- Note that some compilers may already optimize traditional include
guards, by recognzining the idiomatic pattern.
This change is made acknowledging that overall portability of the
code will technically be reduced, as `#pragma once` is not part of the
C/C++ standards.
However, this is considered acceptable given:
1. edk2 already defines a subset of supported compilers in
BaseTools/Conf/tools_def.template, all of which have supported
`#pragma once` for over two decades.
2. There have been concerns raised to the project about inconsistent
include guard naming and potential macro collisions.
Approximate compiler support dates:
- MSVC: Supported since Visual C++ 4.2 (1996)
- GCC: Supported since 3.4 (2004)
(http://gnu.ist.utl.pt/software/gcc/gcc-3.4/changes.html)
- Clang (LLVM based): Since initial release in 2007
Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
|
|
As discussed in various forums, it has been agreed to remove
EmulatorPkg IA32 from PR gate CI runs. If there is community
interest, it can be run nightly and bugfixes accepted for it.
IA32 DXE platforms are considered legacy and not a first class
architecture in edk2.
Signed-off-by: Oliver Smith-Denny <osde@microsoft.com>
|
|
Remove Boot Manager and startup.nsh delays when running
EmulatorPkg as part of CI. This reduces CI agent job boot
times by 15 seconds for each EmulatorPkg --FLASHROM boot.
This includes an update to Azure Pipelines builds of
EmualtorPkg to always set BLD_*_NO_PLATFORM_BOOT_DELAYS
to reduce the EmulatorPkg boot time by 15 seconds.
This feature can also be used for developer boots of
EmulatorPkg for faster automated boots to the UEFI Shell.
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
|
|
Add logic to set WIN_MINGW32_BUILD to the same value
that is set in build.py. This is required because the
stuart DSC parser runs before build.py and this variable
is used in EmulatorPkg.dsc and the stuart DSC parser
must get the same result as build.py or the MINGW builds
using stuart do not work. This matches the same method
used for WIN_HOST_BUILD.
Remove the following settings that are set but never used:
* -D BUILD_32
* -D BUILD_64
* BLD_*_BUILD_IA32
* BLD_*_BUILD_X64
* HOST_DLINK_PATHS
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
|
|
Hash2DxeCrypto produces a protocol that is only used by
TcpDxe when NETWORK_ENABLE=TRUE. Hash2DxeCrypto is the
only module in EmulatorPkg platforms that depends on
BaseCryptLib and OpensslLib.
EmulatorPkg platform build times can be reduced when
NETWORK_ENABLE=FALSE by only including Hash2DxeCrypto.inf
if NETWORK_ENABLE=TRUE.
This reduces the time to build EmulatorPkg for CI and
local developer builds.
Add !if around PcdOpensslLibAssemblySourceStyleNasm settings
and CryptoPkg includes. When both NETWORK_ENABLE and
SECURE_BOOT_ENABLE are FALSE, the CryptoPkg libraries will
no longer be used at all. This means any references to
CryptoPkg PCDs must be removed when both NETWORK_ENABLE
and SECURE_BOOT_ENABLE are FALSE. Otherwise a build error
is generated.
Also remove use of NETWORK_SUPPORT from DSC/FDF file that
is never set and update build.sh to use default of
NETWORK_ENABLE=FALSE.
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
|
|
Pipelines currently run at two main points:
- Pushes to pull requests
- Post-merge (after a commit is merged to the master branch)
There are two main reasons this has historically been done:
1. To catch any issues that may have been missed during PR validation
due to timing related factors (e.g., merge order into master).
2. To separate a more extensive set of tests from the PR validation
to reduce the feedback time for contributors in PRs.
PRs are ordered in master with mergify's merge queue, which helps
reduce timing related issues for (1). For (2), the current
post-merge tests are not significantly different from the PR
validation tests, so the value is limited. The main differentiation
is that the PR eval tool is only run in PR triggered pipelines and
always runs in non-PR triggered runs:
For example:
```
- task: CmdLine@2
displayName: Check if ${{ parameters.build_pkgs }} need testing
inputs:
script: stuart_pr_eval ...
condition: eq(variables['Build.Reason'], 'PullRequest')
```
It is rare for an issue not be found in the PR eval run. Therefore,
we are moving post-merge runs to a daily schedule. This will
still provide regular testing of the master branch while reducing
overall resource usage lending more capacity to PR validation runs
and the introduction of Clang pipelines.
These pipelines are scheduled to run daily at 2AM UTC chosen to
minimize overlap with other scheduled pipelines.
Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
|
|
Currently, build fails with TLS in emulatorPkg due missing library
instance of TlsLib. Add library instance.
Also, uuse OpensslLib.inf as library instance for OpenSsl instead of
OpensslLibCrypto. OpensslLibCrypto is library instance where TLS
features are disabled, this causes in EmulatorPkg openssl library
symbols not get resolved.
Also, move Network.dsc.inc to the top of the file where other dsc.inc
files included.
Signed-off-by: Khalid Ali <khaliidcaliy@gmail.com>
|
|
Signed-off-by: Yang Gang <yanggang@byosoft.com.cn>
|
|
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
|
|
Like BaseTools, CLANGDWARF uses llvm-rc to prepare resources. In
environments where file paths begin with "/", this can cause issues,
as paths to resource files may be interpreted as command-line options
rather than positional arguments. For example, "/usr/..." can be
interpreted as "/u", "sr", "...". To prevent this behavior, an explicit
separation of options and arguments using double hyphens has been
added.
See: https://llvm.org/docs/CommandLine.html
Section: Specifying positional options with hyphens
Signed-off-by: Alexander Gryanko <xpahos@gmail.com>
|
|
* Update EmulatorPkg to use HOST_APPLICATION module type
instead of USER_DEFINED to align with UnitTestFrameworkPkg
that uses HOST_APPLICATION for all Host-based unit tests.
* Move [BuildOptions] from host module INFs files to EmulatorPkg
DSC file. This is required to have finer control over build
options for MINGW CLANG builds.
* Add support for MINGW CLANG builds.
* Use WIN_HOST_BUILD to simplify the selection of the Windows
host module or the Linux host module.
* Add missing StackCheckLib mapping
* Override PcdOpensslLibAssemblySourceStyleNasm to TRUE for
MINGW CLANG builds that use Windows calling convention.
* Add checks for support tool chains with error messages
* Set linker BASE to correct values for DLLs and Applications
for 32-bit and 64-bit Windows builds.
* Update DEBUG, RELEASE, and NOOPT profiles with correct
optimization settings and source level debug settings.
* Reduce Visual Studio support to VS2019 and VS2022
* Simplify linker settings for Visual Studio builds.
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
|
|
EmulatorPkg CLANGDWARF NOOPT built with SECURE_BOOT_ENABLE
is ~10MB. Increase size of FvRecovery and FD to ~12MB
so the FD and FvRecovery are ~80% full to allow headroom
for future size variations.
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
|
|
Update GdbRun.sh to load symbols as modules are loaded
and executed in the EmulatorPkg by executing a command
each time the function SecGdbScriptBreak is executed.
Set PcdEmulatorLazyLoadSymbols to FALSE to disable lazy
symbol loading.
With these changes, a break point can be set in any source
file that is part of the EmulatorPkg build before the
EmulatorPkg is executed.
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
|
|
Remove workarounds for older VS20xx/SDK versions that are no
longer supported. This simplifies the number of workarounds
required to mix windows and edk2 includes.
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
|
|
CLANG compiler does not support VS20xx specific #pragma
warning statements. Remove #pragma warning statements that
are no longer required for VS20xx/SDKs.
Add logic to correct case mismatch in the define value
for IMAGE_FILE_MACHINE_ARM64 between edk2, SDKs, and
Mingw ucrt includes.
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
|
|
Update call to GetProcessAffinityMask() to typecast parameters
to the types required by the Windows API. This type mismatch
was caught by the clang compiler.
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
|
|
Update call to Receive() in WinNtSnpReceive() to pass in
the correct 32-bit sized parameter for both IA32 and X64
builds. In X64 builds, the upper 32-bits of BufferSize
would not be cleared by Receive() and could result in
unexpected values return values. This type mismatch was
found by the clang compiler.
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
|
|
Update main() to have a return type of int to match Windows
console application requirements. Also update error paths
to consistently call exit(1) instead of returning an EFI_ERROR
status that does not match Windows console applications error
values. These issues were caught with clang compiler.
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
|
|
Fix uninitialized variable error for the local variable Status
in a WinNtOpenVolume() error path. This issue was caught by the
clang compiler.
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
|
|
Fix incorrect parameter type passed to WinNtBlockIoError()
caught by clang compiler.
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
|
|
Multiple defined symbols are reported by clang builds
for the symbol gPpiList. Change the name of the
variable gPpiList in Host.c to mPpiList to guarantee
unique symbols names within the Unit/Host component.
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
|
|
Fix symbol loading issues with clang compilers where
SecGdbSciptBreak() is optimized away and the gdb/lldb
breakpoint on that symbol is never hit and no symbols
are loaded for any modules.
Update the implementation of SecGdbScriptBreak() so it
is never inlined and add code to the implementation
of SecGdbScriptBreak() to guarantee that the entire
function is never optimized away by using a volatile
loop variable.
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
|
|
Update EmulatorPkg SEC to use NASM implementation of
SwitchRam and remove the .asm and .S implementations.
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
|
|
Following on from the previous commit upgrading the CI from GCC5 to GCC,
in this commit we make the same upgrade in additional locations where it
appears appropriate.
Potential candidates discovered by simple `grep -r GCC5` in the project.
Continuous-integration-options: PatchCheck.ignore-multi-package
Signed-off-by: Mike Beaton <mjsbeaton@gmail.com>
|