<feed xmlns='http://www.w3.org/2005/Atom'>
<title>Tianocore/edk2.git/OvmfPkg/Library/SmmRelocationLib/InternalSmmRelocationLib.h, branch master</title>
<subtitle>EDK II (mirror)</subtitle>
<id>https://git.radix-linux.su/Tianocore/edk2.git/atom?h=master</id>
<link rel='self' href='https://git.radix-linux.su/Tianocore/edk2.git/atom?h=master'/>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/Tianocore/edk2.git/'/>
<updated>2026-09-29T09:12:40+00:00</updated>
<entry>
<title>OvmfPkg: SmmRelocationLib: Optimize SMI init 16-bit bootstrapping</title>
<updated>2026-09-29T09:12:40+00:00</updated>
<author>
<name>Kun Qin</name>
<email>kuqin@microsoft.com</email>
</author>
<published>2026-09-25T18:52:21+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/Tianocore/edk2.git/commit/?id=10f2053c2d769c6c1becef9dc313e786d5743117'/>
<id>urn:sha1:10f2053c2d769c6c1becef9dc313e786d5743117</id>
<content type='text'>
Every once in a while the SMM relocation routine would hang the system.

This is due to the 16-bit code after relocation could land at the end of
a 4K page boundary. Then the code fetching into the next page will trip
on QEMU block-exit handling logic, which will truncate the EIP with
0xFFFF, causing the code to read back garbage and fault.

This change short-circuits the jump by copying the entire 16-bit stub
over to the BASE + 0x8000 location. The GDTr is also moved to the same
location, otherwise we could risk reaching out to a different page
because it is marked in a different section inside this image.

Signed-off-by: Kun Qin &lt;kun.qin@microsoft.com&gt;
</content>
</entry>
<entry>
<title>OvmfPkg: Replace include guards with #pragma once</title>
<updated>2026-02-23T21:01:28+00:00</updated>
<author>
<name>Michael Kubacki</name>
<email>michael.kubacki@microsoft.com</email>
</author>
<published>2026-02-03T19:10:06+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/Tianocore/edk2.git/commit/?id=a536e5d6991ebb18cdc0a29e224ce5bd50ca9bc0'/>
<id>urn:sha1:a536e5d6991ebb18cdc0a29e224ce5bd50ca9bc0</id>
<content type='text'>
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.

Note: Headers taken directly from external projects, such as those
in OvmfPkg/Include/IndustryStandard/Xen/ were not modified since they
may be periodically re-synced and do not follow other edk2 coding
stadards.

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 &lt;michael.kubacki@microsoft.com&gt;
</content>
</entry>
<entry>
<title>OvmfPkg/SmmRelocationLib: Add library instance for OVMF</title>
<updated>2024-05-08T01:53:58+00:00</updated>
<author>
<name>Jiaxin Wu</name>
<email>jiaxin.wu@intel.com</email>
</author>
<published>2024-04-08T01:08:23+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/Tianocore/edk2.git/commit/?id=3dfd64305b7f46da6f98ae15c87227b0fb55f726'/>
<id>urn:sha1:3dfd64305b7f46da6f98ae15c87227b0fb55f726</id>
<content type='text'>
There are below 2 differences between AMD &amp; OVMF according
existing implementation:
1.The mode of the CPU check is different between the AMD &amp; OVMF.
OVMF:
CpuSaveState-&gt;x86.SMMRevId &amp; 0Xffff

AMD:
 LMAValue = (UINT32)AsmReadMsr64 (EFER_ADDRESS) &amp; LMA

2.Existing SmBase configuration is different between the
AMD &amp; OVMF.
OVMF:
 if ((CpuSaveState-&gt;x86.SMMRevId &amp; 0xFFFF) == 0) {
   CpuSaveState-&gt;x86.SMBASE = mSmBaseForAllCpus[CpuIndex];
 } else {
   CpuSaveState-&gt;x64.SMBASE = mSmBaseForAllCpus[CpuIndex];
 }

AMD:
 AmdCpuState-&gt;x64.SMBASE = mSmBaseForAllCpus[CpuIndex];

This patch provides the SmmRelocationLib library instance
for OVMF to handle the logic difference, and it won't change
the existing implementation code logic.

Cc: Ray Ni &lt;ray.ni@intel.com&gt;
Cc: Zeng Star &lt;star.zeng@intel.com&gt;
Cc: Ard Biesheuvel &lt;ardb+tianocore@kernel.org&gt;
Cc: Jiewen Yao &lt;jiewen.yao@intel.com&gt;
Cc: Gerd Hoffmann &lt;kraxel@redhat.com&gt;
Cc: Rahul Kumar &lt;rahul1.kumar@intel.com&gt;
Signed-off-by: Jiaxin Wu &lt;jiaxin.wu@intel.com&gt;
Tested-by: Gerd Hoffmann &lt;kraxel@redhat.com&gt;
Acked-by: Gerd Hoffmann &lt;kraxel@redhat.com&gt;
Acked-by: Jiewen Yao &lt;Jiewen.yao@intel.com&gt;
</content>
</entry>
</feed>
