On 11/4/21 3:10 AM, Gerd Hoffmann wrote:
On Wed, Nov 03, 2021 at 12:57:37PM +0000, Xu, Min M wrote:
On November 3, 2021 2:09 PM, Gerd Hoffmann wrote:
+++ b/UefiCpuPkg/Library/MpInitLib/X64/IntelTdcall.nasm
@@ -0,0 +1,120 @@
+;--------------------------------------------------------------------
+----------
+;*
+;* Copyright (c) 2020 - 2021, Intel Corporation. All rights
+reserved.<BR>
+;* SPDX-License-Identifier: BSD-2-Clause-Patent
+;*
+;*
+;--------------------------------------------------------------------
+----------
+
+DEFAULT REL
+SECTION .text
+
+%macro tdcall 0
+    db 0x66,0x0f,0x01,0xcc
+%endmacro

Hmm, could you just use TdxLib instead of bringing your own copy of the
assembler code?

My initial thought was to include TdxLib in the .dsc as little as
possible. For example, DxeMpInitLib is included in
OvmfPkg/Microvm/MicrovmX64.dsc. If TdxLib is used by DxeMpInitLib,
then it has to be included in MicrovmX64.dsc as well.

Hmm, yes.  Adding a TdxLib dependency has its downsides indeed.

So I copy the assemble code in MpInitLib.

The problem with copying code is that long-term maintenance becomes
harder.  When a bug is found you have to find and fix all the copies of
that code.  That's why I strongly prefer to avoid code copy&paste.
Sometimes there is no easy way around creating a copy though.

Can't you create something in MdePkg/Library/Baselib and then use it everywhere it's needed?

Thanks,
Tom


take care,
   Gerd



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#83349): https://edk2.groups.io/g/devel/message/83349
Mute This Topic: https://groups.io/mt/86739862/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-


Reply via email to