From nobody Sat Feb 7 04:47:13 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+81473+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+81473+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1633405208; cv=none; d=zohomail.com; s=zohoarc; b=ULz5DMjuxTk5kpWActeKdW69DNU47qLRPw2QXO9uxZUoD7A3TOguBfd7GhJquLMNla74s4ew7mLAvrJL0ZohB4V/GGJEgiUq9fX+j6HDWwbVVEcYWYEXPUX2sB3u29iEoLU2KeWBRmq8LT7imnMa7p85dRh9LbqVxOl2iypw21I= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1633405208; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=/3k0LknmLshL+OajY8U64dvataCCSXnliYM8DKTqnf4=; b=Qi4Bp0XFO75IOusVCrVfCrNwj7F6EsoGy5lFT37BpALYBX0HxVwymMtQU3g/6S57ZnIWWLcmSYw+oQzCfKTuoU+JNRUEuifwrwBP0r4Pm2+pWoMeGc4RznCYT+NIBHmXxzbyQMuHphbYF70yY6qIpZlIs89/e4Hx3ob+nbYYfwk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+81473+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1633405208227812.39876186345; Mon, 4 Oct 2021 20:40:08 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id oIiyYY1788612xiSIDLFSsnc; Mon, 04 Oct 2021 20:40:07 -0700 X-Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by mx.groups.io with SMTP id smtpd.web10.20841.1633405206053665988 for ; Mon, 04 Oct 2021 20:40:07 -0700 X-IronPort-AV: E=McAfee;i="6200,9189,10127"; a="225958018" X-IronPort-AV: E=Sophos;i="5.85,347,1624345200"; d="scan'208";a="225958018" X-Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Oct 2021 20:40:05 -0700 X-IronPort-AV: E=Sophos;i="5.85,347,1624345200"; d="scan'208";a="487828408" X-Received: from mxu9-mobl1.ccr.corp.intel.com ([10.255.29.239]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Oct 2021 20:40:04 -0700 From: "Min Xu" To: devel@edk2.groups.io Cc: Min Xu Subject: [edk2-devel] [PATCH V2 01/28] OvmfPkg: Copy Main.asm from UefiCpuPkg to OvmfPkg's ResetVector Date: Tue, 5 Oct 2021 11:39:12 +0800 Message-Id: <70b957fb3ffa545aecf3108c8ac3e4b57d9d4034.1633401643.git.min.m.xu@intel.com> In-Reply-To: References: MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,min.m.xu@intel.com X-Gm-Message-State: XDQTRkTuTvg4rp4WM5DvLUPmx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1633405207; bh=rvLF3I4uHbtk/ZqE1Rorvxlpd4slB4k6ex05LD7kNRo=; h=Cc:Date:From:Reply-To:Subject:To; b=Rx3BbP/z6GHfhxyTyZvQa5833MRRvmXefl9Ri086JSJPg2UsWYJlZ0J2gSbPiUv8Oh1 IPID8TOhOzfitvQNEOynluZ+FsNG46qeqJ4Xs0VxH10gHz6/RR9RSNRqvoxHXcTOZ32U1 eKBGchwTytxdkyRHNmjTIFXMiqtCl1+dB6c= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1633405209545100001 Content-Type: text/plain; charset="utf-8" Signed-off-by: Min Xu --- OvmfPkg/ResetVector/Main.asm | 103 +++++++++++++++++++++++++++++++++++ 1 file changed, 103 insertions(+) create mode 100644 OvmfPkg/ResetVector/Main.asm diff --git a/OvmfPkg/ResetVector/Main.asm b/OvmfPkg/ResetVector/Main.asm new file mode 100644 index 000000000000..ae90a148fce7 --- /dev/null +++ b/OvmfPkg/ResetVector/Main.asm @@ -0,0 +1,103 @@ +;-------------------------------------------------------------------------= ----- +; @file +; Main routine of the pre-SEC code up through the jump into SEC +; +; Copyright (c) 2008 - 2009, Intel Corporation. All rights reserved.
+; SPDX-License-Identifier: BSD-2-Clause-Patent +; +;-------------------------------------------------------------------------= ----- + + +BITS 16 + +; +; Modified: EBX, ECX, EDX, EBP +; +; @param[in,out] RAX/EAX Initial value of the EAX register +; (BIST: Built-in Self Test) +; @param[in,out] DI 'BP': boot-strap processor, or +; 'AP': application processor +; @param[out] RBP/EBP Address of Boot Firmware Volume (BFV) +; @param[out] DS Selector allowing flat access to all addresses +; @param[out] ES Selector allowing flat access to all addresses +; @param[out] FS Selector allowing flat access to all addresses +; @param[out] GS Selector allowing flat access to all addresses +; @param[out] SS Selector allowing flat access to all addresses +; +; @return None This routine jumps to SEC and does not return +; +Main16: + OneTimeCall EarlyInit16 + + ; + ; Transition the processor from 16-bit real mode to 32-bit flat mode + ; + OneTimeCall TransitionFromReal16To32BitFlat + +BITS 32 + + ; + ; Search for the Boot Firmware Volume (BFV) + ; + OneTimeCall Flat32SearchForBfvBase + + ; + ; EBP - Start of BFV + ; + + ; + ; Search for the SEC entry point + ; + OneTimeCall Flat32SearchForSecEntryPoint + + ; + ; ESI - SEC Core entry point + ; EBP - Start of BFV + ; + +%ifdef ARCH_IA32 + + ; + ; Restore initial EAX value into the EAX register + ; + mov eax, esp + + ; + ; Jump to the 32-bit SEC entry point + ; + jmp esi + +%else + + ; + ; Transition the processor from 32-bit flat mode to 64-bit flat mode + ; + OneTimeCall Transition32FlatTo64Flat + +BITS 64 + + ; + ; Some values were calculated in 32-bit mode. Make sure the upper + ; 32-bits of 64-bit registers are zero for these values. + ; + mov rax, 0x00000000ffffffff + and rsi, rax + and rbp, rax + and rsp, rax + + ; + ; RSI - SEC Core entry point + ; RBP - Start of BFV + ; + + ; + ; Restore initial EAX value into the RAX register + ; + mov rax, rsp + + ; + ; Jump to the 64-bit SEC entry point + ; + jmp rsi + +%endif --=20 2.29.2.windows.2 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#81473): https://edk2.groups.io/g/devel/message/81473 Mute This Topic: https://groups.io/mt/86085721/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-