From nobody Sat Apr 27 02:06:11 2024 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+81720+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+81720+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1633801532; cv=none; d=zohomail.com; s=zohoarc; b=bJ2b/CPkgpTrnKfAAer7QpkWXpB7rBWOZ5+HbnmmuP9xoc9tG00VUXguyn5AMGIw6/paFvmEhOugg+A0ITuPhVFsUCzxoh/dddaFy/HjxRv4UDslcAc4QmXFSxJxb8gsXnqfAAXod7lqE3Z0K8h/Dw77zNdJbeFt7PjFb80nAfI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1633801532; 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=V01LaFpcXvipqIK18NBBe4unzB9zhLeJCGYGmzOfpCo=; b=kd5j2BhtIWY8DjluRzytT8SKjQpaiMdJqcYuAB05ctpjOzIZncwjtS3HAORVXdZkBgsX7aYWNQ8cuXgy/FLd9QCnS6L0RKASIVScQSl96a8D3zoJMUcPRlXk8E1xccrp3BQ1xF54oYhn9Sv9JZ9EXvQwdfuj+8Zs7LdOCkP4BdU= 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+81720+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 163380153218416.635067475411915; Sat, 9 Oct 2021 10:45:32 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id FFSaYY1788612xI2F7SJe5M5; Sat, 09 Oct 2021 10:45:31 -0700 X-Received: from mail-pj1-f44.google.com (mail-pj1-f44.google.com [209.85.216.44]) by mx.groups.io with SMTP id smtpd.web08.8093.1633794637130177179 for ; Sat, 09 Oct 2021 08:50:37 -0700 X-Received: by mail-pj1-f44.google.com with SMTP id ls18-20020a17090b351200b001a00250584aso10975541pjb.4 for ; Sat, 09 Oct 2021 08:50:37 -0700 (PDT) X-Gm-Message-State: flrKzaLpf0IzgupCVcWqtCtwx1787277AA= X-Google-Smtp-Source: ABdhPJz6jFWX4iuPVEcT3cLKddMiWBoPy6n50XE9epn5xFtIWqg7syW48LSC0r/jN2zikApRKAE2hA== X-Received: by 2002:a17:903:1103:b0:13e:ec6d:524a with SMTP id n3-20020a170903110300b0013eec6d524amr14950277plh.85.1633794636722; Sat, 09 Oct 2021 08:50:36 -0700 (PDT) X-Received: from localhost.localdomain ([240d:1a:ada:4400:d496:915d:ba15:739a]) by smtp.gmail.com with ESMTPSA id z2sm2633255pfe.210.2021.10.09.08.50.35 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 09 Oct 2021 08:50:36 -0700 (PDT) From: "Akira Moroo" To: devel@edk2.groups.io Cc: afish@apple.com, ray.ni@intel.com, Akira Moroo Subject: [edk2-devel] [RFC PATCH 1/4] EmulatorPkg/Unix/Host: Fix typo Date: Sun, 10 Oct 2021 00:49:15 +0900 Message-Id: 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,retrage01@gmail.com Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1633801531; bh=oK2tTUuzZ+MadryASdhvFV3QZUmbSWMEFAfiwH5FrUU=; h=Cc:Date:From:Reply-To:Subject:To; b=JsMXyvLRGynP+Ip/SGBkYrjCSM8hOjHNNzfbPvZ5xgIFrLfkt72y4rSLSXOxm/JE6On YnB1nu2kTSEKEGwn8CqDZb+JXv2LrdSAPqUmQFdprfMXNILMbdCmUHDL5OXkQVZJEnJ5M TSgUusSa5WKrAPrs/jRHmyCJTl4ucnFawHs= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1633801533118100004 Content-Type: text/plain; charset="utf-8" The function name should be `SecPeCoffUnloadImageExtraAction`. Signed-off-by: Akira Moroo --- EmulatorPkg/Unix/Host/Host.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/EmulatorPkg/Unix/Host/Host.h b/EmulatorPkg/Unix/Host/Host.h index 9791cf8c37..3841a91db8 100644 --- a/EmulatorPkg/Unix/Host/Host.h +++ b/EmulatorPkg/Unix/Host/Host.h @@ -292,8 +292,8 @@ SecPeCoffRelocateImageExtraAction ( =20 VOID EFIAPI -SecPeCoffLoaderUnloadImageExtraAction ( - IN OUT PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext +SecPeCoffUnloadImageExtraAction ( + IN PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext ); =20 =20 --=20 2.33.0 -=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 (#81720): https://edk2.groups.io/g/devel/message/81720 Mute This Topic: https://groups.io/mt/86198793/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- From nobody Sat Apr 27 02:06:11 2024 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+81721+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+81721+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1633801532; cv=none; d=zohomail.com; s=zohoarc; b=HN1TxsHkQJswhvxy+z+imyPXotMRQJrISbNeJm2F3R+8u+QL+UFF0fUMnSuYdwW67OnKtyTn40UIXwn9fbk2b2xz6FEjv83V/uwy2RRTvzd5YqB6QQEtCiaLnOoIM7R3iJGqbQOexZu3uZuqgrmeIZefSNrEEqDuHC/7UbHrsWI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1633801532; 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=zOd2Fn6eMkrnP+HXuJ/tphRxgHUd4AXlOWXKUkqhr9I=; b=Lp7NL5q+5gNEBUleL2njyrBeqeqDLS77TK6tS9YHUmw2Yjtl0fywxl3eHusXWMSEKJfO2rA3NNzq3QDXVMzslCL82a6r1xq6sWfxHhleY9jekSa/3iRV2lgatkjkfQs8ZU5g0j1MSLqAwTUWFEJ87+mV+/mzHSSQOM+Z6NWolCM= 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+81721+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 1633801532208909.730353972931; Sat, 9 Oct 2021 10:45:32 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id hdl0YY1788612xieAnKWREU7; Sat, 09 Oct 2021 10:45:31 -0700 X-Received: from mail-pl1-f181.google.com (mail-pl1-f181.google.com [209.85.214.181]) by mx.groups.io with SMTP id smtpd.web09.8107.1633794638978202275 for ; Sat, 09 Oct 2021 08:50:39 -0700 X-Received: by mail-pl1-f181.google.com with SMTP id t11so8132003plq.11 for ; Sat, 09 Oct 2021 08:50:38 -0700 (PDT) X-Gm-Message-State: BLyNjeroang1HqI88i9cJkMex1787277AA= X-Google-Smtp-Source: ABdhPJz+I8eg+bpTb27AJVpn/8cWsFNCZWcI4a6116t+HbUOkLofK7AUm6J2mY1SiduHNlZKI3J04w== X-Received: by 2002:a17:90a:fb4a:: with SMTP id iq10mr4378177pjb.117.1633794638591; Sat, 09 Oct 2021 08:50:38 -0700 (PDT) X-Received: from localhost.localdomain ([240d:1a:ada:4400:d496:915d:ba15:739a]) by smtp.gmail.com with ESMTPSA id z2sm2633255pfe.210.2021.10.09.08.50.37 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 09 Oct 2021 08:50:38 -0700 (PDT) From: "Akira Moroo" To: devel@edk2.groups.io Cc: afish@apple.com, ray.ni@intel.com, Akira Moroo Subject: [edk2-devel] [RFC PATCH 2/4] EmulatorPkg/Sec: Add AArch64 support Date: Sun, 10 Oct 2021 00:49:16 +0900 Message-Id: <963e9d53c9011af94afeeea1ddb39ec171329ab5.1633789833.git.retrage01@gmail.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,retrage01@gmail.com Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1633801531; bh=mNuK0y0thnMBXnHaphFoG4Rsy8Gj9K/ci7y/ZQJwfp0=; h=Cc:Date:From:Reply-To:Subject:To; b=rM7Hs2J0E9r38MOQ5HseMQUHDJGlryJmHHCYfYwh31pDThYqTgZfSY4Twyzy0oGZFpG WOhQfP2LQEPB1Sgb7Z8WSlbXqem0os1wQjevXKmtOLdNlZ817oFlUW9pNjTqdD3I7WPXn mBfEcfQ+ICe7xoaUbMooae43zdNz6bBPwMs= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1633801533136100005 Content-Type: text/plain; charset="utf-8" This commit adds AArch64 support to EmulatorPkg/Sec. The architecture specific part is switching stack from temporary to permanent. Signed-off-by: Akira Moroo --- EmulatorPkg/Sec/AArch64/SwitchRam.S | 22 +++++++++++ EmulatorPkg/Sec/AArch64/TempRam.c | 58 +++++++++++++++++++++++++++++ EmulatorPkg/Sec/Sec.inf | 4 ++ 3 files changed, 84 insertions(+) create mode 100644 EmulatorPkg/Sec/AArch64/SwitchRam.S create mode 100644 EmulatorPkg/Sec/AArch64/TempRam.c diff --git a/EmulatorPkg/Sec/AArch64/SwitchRam.S b/EmulatorPkg/Sec/AArch64/= SwitchRam.S new file mode 100644 index 0000000000..9ec8ddd627 --- /dev/null +++ b/EmulatorPkg/Sec/AArch64/SwitchRam.S @@ -0,0 +1,22 @@ +#-------------------------------------------------------------------------= ----- +# +# Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.
+# Portions copyright (c) 2011, Apple Inc. All rights reserved. +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +#-------------------------------------------------------------------------= ----- + + +// VOID +// EFIAPI +// SecSwitchStack ( +// VOID *StackDelta +// ) +// +ASM_GLOBAL ASM_PFX(SecSwitchStack) +ASM_PFX(SecSwitchStack): + mov x1, sp + add x1, x0, x1 + mov sp, x1 + ret + diff --git a/EmulatorPkg/Sec/AArch64/TempRam.c b/EmulatorPkg/Sec/AArch64/Te= mpRam.c new file mode 100644 index 0000000000..cce1dc559a --- /dev/null +++ b/EmulatorPkg/Sec/AArch64/TempRam.c @@ -0,0 +1,58 @@ +/*++ @file + Temp RAM PPI + +Copyright (c) 2011, Apple Inc. All rights reserved.
+SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include +#include +#include + +#include + +VOID +EFIAPI +SecSwitchStack ( + VOID *StackDelta + ); + + +EFI_STATUS +EFIAPI +SecTemporaryRamSupport ( + IN CONST EFI_PEI_SERVICES **PeiServices, + IN EFI_PHYSICAL_ADDRESS TemporaryMemoryBase, + IN EFI_PHYSICAL_ADDRESS PermanentMemoryBase, + IN UINTN CopySize + ) +{ + // + // Migrate the whole temporary memory to permanent memory. + // + CopyMem ( + (VOID*)(UINTN)PermanentMemoryBase, + (VOID*)(UINTN)TemporaryMemoryBase, + CopySize + ); + + // + // SecSwitchStack function must be invoked after the memory migration + // immediately, also we need fixup the stack change caused by new call i= nto + // permanent memory. + // + SecSwitchStack ((VOID *)(PermanentMemoryBase - TemporaryMemoryBase)); + + // + // We need *not* fix the return address because currently, + // The PeiCore is executed in flash. + // + + // + // Simulate to invalid temporary memory, terminate temporary memory + // + ZeroMem ((VOID*)(UINTN)TemporaryMemoryBase, CopySize); + + return EFI_SUCCESS; +} diff --git a/EmulatorPkg/Sec/Sec.inf b/EmulatorPkg/Sec/Sec.inf index 2f9e3d4780..83248fbaca 100644 --- a/EmulatorPkg/Sec/Sec.inf +++ b/EmulatorPkg/Sec/Sec.inf @@ -30,6 +30,10 @@ Ia32/SwitchRam.asm Ia32/SwitchRam.S =20 +[Sources.AARCH64] + AArch64/TempRam.c + AArch64/SwitchRam.S + [Packages] MdePkg/MdePkg.dec EmulatorPkg/EmulatorPkg.dec --=20 2.33.0 -=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 (#81721): https://edk2.groups.io/g/devel/message/81721 Mute This Topic: https://groups.io/mt/86198794/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- From nobody Sat Apr 27 02:06:11 2024 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+81722+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+81722+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1633801533; cv=none; d=zohomail.com; s=zohoarc; b=TDeVXS0vhe7epuujmmZac2gDvzZ+Hd2ulp0tf83HxAAzvjPJqlAVsXD7+2jyyZVTSQZtRpIFUFiTElrLGJjPZtb2z7RTO8rrxm58jXiNab286HL/PUr7W7rjEJMgf0WtkJvQ7jt4ph5xDzLHLHBLpHDIVDb9EWOU7YI6xq75lcU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1633801533; 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=RYlNTTkaHQGXgzdGKqOnKUC/UF9xt0i+ij3TlObqMKE=; b=hh9C1i62aiNp5V6mKnbmYTupl5f3mWOJGBlVpxOc8V8CSwrPQRLh4YN45uxBwe3Foyp1Fo5fulBmw77pkbA/2vg1aHJ9mTOfxbQHEcpxvbxobaLE8/QYiWJF4LMvb+JLUuPP9K0PZYH0oXb+taMERC9aTnf6qoJst6E3wrbuQsE= 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+81722+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 1633801533010378.0235341995342; Sat, 9 Oct 2021 10:45:33 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id YZaKYY1788612x4zuljKKQ7R; Sat, 09 Oct 2021 10:45:32 -0700 X-Received: from mail-pl1-f177.google.com (mail-pl1-f177.google.com [209.85.214.177]) by mx.groups.io with SMTP id smtpd.web11.7995.1633794641012591516 for ; Sat, 09 Oct 2021 08:50:41 -0700 X-Received: by mail-pl1-f177.google.com with SMTP id x4so8189106pln.5 for ; Sat, 09 Oct 2021 08:50:40 -0700 (PDT) X-Gm-Message-State: 9r6qpKq1wzcyDMsnT5NAT5FMx1787277AA= X-Google-Smtp-Source: ABdhPJyslnFNQ63d0uChjCeXdRKgtKkbpiSXpbTDyVNTXWVqpd60gP8rtF/E85QMqgwentkTablaQw== X-Received: by 2002:a17:90a:9509:: with SMTP id t9mr18890349pjo.149.1633794640459; Sat, 09 Oct 2021 08:50:40 -0700 (PDT) X-Received: from localhost.localdomain ([240d:1a:ada:4400:d496:915d:ba15:739a]) by smtp.gmail.com with ESMTPSA id z2sm2633255pfe.210.2021.10.09.08.50.38 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 09 Oct 2021 08:50:40 -0700 (PDT) From: "Akira Moroo" To: devel@edk2.groups.io Cc: afish@apple.com, ray.ni@intel.com, Akira Moroo Subject: [edk2-devel] [RFC PATCH 3/4] EmulatorPkg/Unix/Host: Add AArch64 support Date: Sun, 10 Oct 2021 00:49:17 +0900 Message-Id: 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,retrage01@gmail.com Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1633801532; bh=h4Lv6B2uyd2s5dh2jBrR1qBMgjW1FoWiffB0yuCoYNU=; h=Cc:Date:From:Reply-To:Subject:To; b=PHq3L5VLvwSZIgTRYLvVSq26Kpd45HElc7fKdaexGK5O4sncG7R1Im5DuRx7ewiZI2o JnhqkoMv/oepzs0vJ/+kBSPKWPAW9igPsokn2iuiRqzPUCzXPEa/paiblCfg9glQAlX9B rJjqsFq/Ji6iDfPzzhPQTWx5To2ryd734mI= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1633802435840100001 Content-Type: text/plain; charset="utf-8" Since there is no difference in calling convention between the Unix host and the UEFI environment on AArch64, it does not require gaskets. In this commit, it defines EmulatorPkg protocols that calls the host functions without gaskets and adds AArch64 specific stack switch logic. Signed-off-by: Akira Moroo --- EmulatorPkg/Unix/Host/AArch64/Gasket.c | 50 +++++++++++ EmulatorPkg/Unix/Host/AArch64/SwitchStack.S | 42 +++++++++ EmulatorPkg/Unix/Host/BerkeleyPacketFilter.c | 37 ++++++++ EmulatorPkg/Unix/Host/BlockIo.c | 26 ++++++ EmulatorPkg/Unix/Host/EmuThunk.c | 29 ++++++ EmulatorPkg/Unix/Host/Host.c | 32 +++++++ EmulatorPkg/Unix/Host/Host.inf | 5 +- EmulatorPkg/Unix/Host/LinuxPacketFilter.c | 38 ++++++++ EmulatorPkg/Unix/Host/PosixFileSystem.c | 94 +++++++++++++++++++- EmulatorPkg/Unix/Host/Pthreads.c | 30 ++++++- EmulatorPkg/Unix/Host/X11GraphicsWindow.c | 26 +++++- 11 files changed, 405 insertions(+), 4 deletions(-) create mode 100644 EmulatorPkg/Unix/Host/AArch64/Gasket.c create mode 100644 EmulatorPkg/Unix/Host/AArch64/SwitchStack.S diff --git a/EmulatorPkg/Unix/Host/AArch64/Gasket.c b/EmulatorPkg/Unix/Host= /AArch64/Gasket.c new file mode 100644 index 0000000000..69a728d408 --- /dev/null +++ b/EmulatorPkg/Unix/Host/AArch64/Gasket.c @@ -0,0 +1,50 @@ +/** @file + + Copyright (c) 2008 - 2011, Apple Inc. All rights reserved.
+ Copyright (c) 2011 - 2019, Intel Corporation. All rights reserved.
+ + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include "Host.h" + +// +// Reverse (UNIX to EFIAPI) gaskets +// + +typedef +UINTN +(EFIAPI *CALL_BACK_1) ( + UINT64 Delta + ); + +UINTN +ReverseGasketUint64 ( + UINTN CallBack, + UINT64 a + ) +{ + return ((CALL_BACK_1) CallBack) (a); +} + +// +// UNIX ABI to EFI ABI call +// + +typedef +UINTN +(EFIAPI *CALL_BACK_2) ( + VOID *Context, + VOID *Key + ); + +UINTN +ReverseGasketUint64Uint64 ( + VOID *CallBack, + VOID *Context, + VOID *Key + ) +{ + return ((CALL_BACK_2) CallBack) (Context, Key); +} diff --git a/EmulatorPkg/Unix/Host/AArch64/SwitchStack.S b/EmulatorPkg/Unix= /Host/AArch64/SwitchStack.S new file mode 100644 index 0000000000..6e903b94ef --- /dev/null +++ b/EmulatorPkg/Unix/Host/AArch64/SwitchStack.S @@ -0,0 +1,42 @@ +#-------------------------------------------------------------------------= ----- +# +# Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.
+# Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.
+# Portions copyright (c) 2011 - 2013, ARM Limited. All rights reserved.
+# SPDX-License-Identifier: BSD-2-Clause-Patent +# +#-------------------------------------------------------------------------= ----- + +.text +.align 5 + +GCC_ASM_EXPORT(PeiSwitchStacks) + +#/** +# +# This allows the caller to switch the stack and goes to the new entry po= int +# +# @param EntryPoint The pointer to the location to enter +# @param Context Parameter to pass in +# @param Context2 Parameter2 to pass in +# @param NewStack New Location of the stack +# +# @return Nothing. Goes to the Entry Point passing in the new paramete= rs +# +#**/ +#VOID +#EFIAPI +#PeiSwitchStacks ( +# SWITCH_STACK_ENTRY_POINT EntryPoint, +# VOID *Context, +# VOID *Context2, +# VOID *NewStack +# ); +# +ASM_PFX(PeiSwitchStacks): + mov x29, #0 + mov x30, x0 + mov sp, x3 + mov x0, x1 + mov x1, x2 + ret diff --git a/EmulatorPkg/Unix/Host/BerkeleyPacketFilter.c b/EmulatorPkg/Uni= x/Host/BerkeleyPacketFilter.c index 441f1e8d0a..f591d94f4e 100644 --- a/EmulatorPkg/Unix/Host/BerkeleyPacketFilter.c +++ b/EmulatorPkg/Unix/Host/BerkeleyPacketFilter.c @@ -972,6 +972,26 @@ EmuSnpReceive ( return EFI_SUCCESS; } =20 +#if defined(__aarch64__) + +EMU_SNP_PROTOCOL gEmuSnpProtocol =3D { + EmuSnpCreateMapping, + EmuSnpStart, + EmuSnpStop, + EmuSnpInitialize, + EmuSnpReset, + EmuSnpShutdown, + EmuSnpReceiveFilters, + EmuSnpStationAddress, + EmuSnpStatistics, + EmuSnpMCastIpToMac, + EmuSnpNvData, + EmuSnpGetStatus, + EmuSnpTransmit, + EmuSnpReceive +}; + +#else =20 EMU_SNP_PROTOCOL gEmuSnpProtocol =3D { GasketSnpCreateMapping, @@ -990,6 +1010,8 @@ EMU_SNP_PROTOCOL gEmuSnpProtocol =3D { GasketSnpReceive }; =20 +#endif + EFI_STATUS GetInterfaceMacAddr ( EMU_SNP_PRIVATE *Private @@ -1092,6 +1114,19 @@ EmuSnpThunkClose ( } =20 =20 +#if defined(__aarch64__) + +EMU_IO_THUNK_PROTOCOL gSnpThunkIo =3D { + &gEmuSnpProtocolGuid, + NULL, + NULL, + 0, + EmuSnpThunkOpen, + EmuSnpThunkClose, + NULL +}; + +#else =20 EMU_IO_THUNK_PROTOCOL gSnpThunkIo =3D { &gEmuSnpProtocolGuid, @@ -1104,3 +1139,5 @@ EMU_IO_THUNK_PROTOCOL gSnpThunkIo =3D { }; =20 #endif + +#endif diff --git a/EmulatorPkg/Unix/Host/BlockIo.c b/EmulatorPkg/Unix/Host/BlockI= o.c index 18368060d5..b335db192e 100644 --- a/EmulatorPkg/Unix/Host/BlockIo.c +++ b/EmulatorPkg/Unix/Host/BlockIo.c @@ -594,6 +594,17 @@ StdDupUnicodeToAscii ( return Ascii; } =20 +#if defined(__aarch64__) + +EMU_BLOCK_IO_PROTOCOL gEmuBlockIoProtocol =3D { + EmuBlockIoReset, + EmuBlockIoReadBlocks, + EmuBlockIoWriteBlocks, + EmuBlockIoFlushBlocks, + EmuBlockIoCreateMapping +}; + +#else =20 EMU_BLOCK_IO_PROTOCOL gEmuBlockIoProtocol =3D { GasketEmuBlockIoReset, @@ -603,6 +614,8 @@ EMU_BLOCK_IO_PROTOCOL gEmuBlockIoProtocol =3D { GasketEmuBlockIoCreateMapping }; =20 +#endif + EFI_STATUS EmuBlockIoThunkOpen ( IN EMU_IO_THUNK_PROTOCOL *This @@ -687,7 +700,19 @@ EmuBlockIoThunkClose ( return EFI_SUCCESS; } =20 +#if defined(__aarch64__) =20 +EMU_IO_THUNK_PROTOCOL gBlockIoThunkIo =3D { + &gEmuBlockIoProtocolGuid, + NULL, + NULL, + 0, + EmuBlockIoThunkOpen, + EmuBlockIoThunkClose, + NULL +}; + +#else =20 EMU_IO_THUNK_PROTOCOL gBlockIoThunkIo =3D { &gEmuBlockIoProtocolGuid, @@ -699,4 +724,5 @@ EMU_IO_THUNK_PROTOCOL gBlockIoThunkIo =3D { NULL }; =20 +#endif =20 diff --git a/EmulatorPkg/Unix/Host/EmuThunk.c b/EmulatorPkg/Unix/Host/EmuTh= unk.c index b8b0651c6a..bd78232f9c 100644 --- a/EmulatorPkg/Unix/Host/EmuThunk.c +++ b/EmulatorPkg/Unix/Host/EmuThunk.c @@ -396,6 +396,34 @@ SecGetNextProtocol ( return GetNextThunkProtocol (EmuBusDriver, Instance); } =20 +#if defined(__aarch64__) + +EMU_THUNK_PROTOCOL gEmuThunkProtocol =3D { + SecWriteStdErr, + SecConfigStdIn, + SecWriteStdOut, + SecReadStdIn, + SecPollStdIn, + SecMalloc, + SecValloc, + SecFree, + SecPeCoffGetEntryPoint, + SecPeCoffRelocateImageExtraAction, + SecPeCoffUnloadImageExtraAction, + SecEnableInterrupt, + SecDisableInterrupt, + QueryPerformanceFrequency, + QueryPerformanceCounter, + SecSleep, + SecCpuSleep, + SecExit, + SecGetTime, + SecSetTime, + SecSetTimer, + SecGetNextProtocol +}; + +#else =20 EMU_THUNK_PROTOCOL gEmuThunkProtocol =3D { GasketSecWriteStdErr, @@ -422,6 +450,7 @@ EMU_THUNK_PROTOCOL gEmuThunkProtocol =3D { GasketSecGetNextProtocol }; =20 +#endif =20 VOID SecInitThunkProtocol ( diff --git a/EmulatorPkg/Unix/Host/Host.c b/EmulatorPkg/Unix/Host/Host.c index b4e5510613..bba6282738 100644 --- a/EmulatorPkg/Unix/Host/Host.c +++ b/EmulatorPkg/Unix/Host/Host.c @@ -12,17 +12,49 @@ SPDX-License-Identifier: BSD-2-Clause-Patent #define MAP_ANONYMOUS MAP_ANON #endif =20 +EFI_STATUS +SecUnixPeiAutoScan ( + IN UINTN Index, + OUT EFI_PHYSICAL_ADDRESS *MemoryBase, + OUT UINT64 *MemorySize + ); + +EFI_STATUS +SecUnixFdAddress ( + IN UINTN Index, + IN OUT EFI_PHYSICAL_ADDRESS *FdBase, + IN OUT UINT64 *FdSize, + IN OUT EFI_PHYSICAL_ADDRESS *FixUp + ); + +VOID * +SecEmuThunkAddress ( + VOID + ); + =20 // // Globals // =20 +#if defined(__aarch64__) + +EMU_THUNK_PPI mSecEmuThunkPpi =3D { + SecUnixPeiAutoScan, + SecUnixFdAddress, + SecEmuThunkAddress +}; + +#else + EMU_THUNK_PPI mSecEmuThunkPpi =3D { GasketSecUnixPeiAutoScan, GasketSecUnixFdAddress, GasketSecEmuThunkAddress }; =20 +#endif + char *gGdbWorkingFileName =3D NULL; unsigned int mScriptSymbolChangesCount =3D 0; =20 diff --git a/EmulatorPkg/Unix/Host/Host.inf b/EmulatorPkg/Unix/Host/Host.inf index c479d2b7d0..43cb55aa21 100644 --- a/EmulatorPkg/Unix/Host/Host.inf +++ b/EmulatorPkg/Unix/Host/Host.inf @@ -20,7 +20,7 @@ # # The following information is for reference only and not required by the = build tools. # -# VALID_ARCHITECTURES =3D IA32 X64 EBC +# VALID_ARCHITECTURES =3D IA32 X64 AARCH64 EBC # =20 [Sources] @@ -42,6 +42,9 @@ Ia32/Gasket.S # enforce 16-byte stack alignment for Mac OS X Ia32/SwitchStack.c =20 +[Sources.AARCH64] + AArch64/Gasket.c + AArch64/SwitchStack.S =20 [Packages] MdePkg/MdePkg.dec diff --git a/EmulatorPkg/Unix/Host/LinuxPacketFilter.c b/EmulatorPkg/Unix/H= ost/LinuxPacketFilter.c index 2b772ab884..9c696a8774 100644 --- a/EmulatorPkg/Unix/Host/LinuxPacketFilter.c +++ b/EmulatorPkg/Unix/Host/LinuxPacketFilter.c @@ -518,6 +518,27 @@ EmuSnpReceive ( } =20 =20 +#if defined(__aarch64__) + +EMU_SNP_PROTOCOL gEmuSnpProtocol =3D { + EmuSnpCreateMapping, + EmuSnpStart, + EmuSnpStop, + EmuSnpInitialize, + EmuSnpReset, + EmuSnpShutdown, + EmuSnpReceiveFilters, + EmuSnpStationAddress, + EmuSnpStatistics, + EmuSnpMCastIpToMac, + EmuSnpNvData, + EmuSnpGetStatus, + EmuSnpTransmit, + EmuSnpReceive +}; + +#else + EMU_SNP_PROTOCOL gEmuSnpProtocol =3D { GasketSnpCreateMapping, GasketSnpStart, @@ -535,6 +556,8 @@ EMU_SNP_PROTOCOL gEmuSnpProtocol =3D { GasketSnpReceive }; =20 +#endif + EFI_STATUS EmuSnpThunkOpen ( IN EMU_IO_THUNK_PROTOCOL *This @@ -584,6 +607,19 @@ EmuSnpThunkClose ( } =20 =20 +#if defined(__aarch64__) + +EMU_IO_THUNK_PROTOCOL gSnpThunkIo =3D { + &gEmuSnpProtocolGuid, + NULL, + NULL, + 0, + EmuSnpThunkOpen, + EmuSnpThunkClose, + NULL +}; + +#else =20 EMU_IO_THUNK_PROTOCOL gSnpThunkIo =3D { &gEmuSnpProtocolGuid, @@ -596,3 +632,5 @@ EMU_IO_THUNK_PROTOCOL gSnpThunkIo =3D { }; =20 #endif + +#endif diff --git a/EmulatorPkg/Unix/Host/PosixFileSystem.c b/EmulatorPkg/Unix/Hos= t/PosixFileSystem.c index 0a618abcd8..4676f2f933 100644 --- a/EmulatorPkg/Unix/Host/PosixFileSystem.c +++ b/EmulatorPkg/Unix/Host/PosixFileSystem.c @@ -53,6 +53,51 @@ typedef struct { EMU_EFI_FILE_PRIVATE_SIGNATURE \ ) =20 +EFI_STATUS +PosixFileOpen ( + IN EFI_FILE_PROTOCOL *This, + OUT EFI_FILE_PROTOCOL **NewHandle, + IN CHAR16 *FileName, + IN UINT64 OpenMode, + IN UINT64 Attributes + ); + +EFI_STATUS +PosixFileCLose ( + IN EFI_FILE_PROTOCOL *This + ); + +EFI_STATUS +PosixFileDelete ( + IN EFI_FILE_PROTOCOL *This + ); + +EFI_STATUS +PosixFileRead ( + IN EFI_FILE_PROTOCOL *This, + IN OUT UINTN *BufferSize, + OUT VOID *Buffer + ); + +EFI_STATUS +PosixFileWrite ( + IN EFI_FILE_PROTOCOL *This, + IN OUT UINTN *BufferSize, + IN VOID *Buffer + ); + +EFI_STATUS +PosixFileGetPossition ( + IN EFI_FILE_PROTOCOL *This, + OUT UINT64 *Position + ); + +EFI_STATUS +PosixFileSetPossition ( + IN EFI_FILE_PROTOCOL *This, + IN UINT64 Position + ); + EFI_STATUS PosixFileGetInfo ( IN EFI_FILE_PROTOCOL *This, @@ -69,6 +114,39 @@ PosixFileSetInfo ( IN VOID *Buffer ); =20 +EFI_STATUS +PosixFileFlush ( + IN EFI_FILE_PROTOCOL *This + ); + +EFI_STATUS +PosixOpenVolume ( + IN EFI_SIMPLE_FILE_SYSTEM_PROTOCOL *This, + OUT EFI_FILE_PROTOCOL **Root + ); + +#if defined(__aarch64__) + +EFI_FILE_PROTOCOL gPosixFileProtocol =3D { + EFI_FILE_REVISION, + PosixFileOpen, + PosixFileCLose, + PosixFileDelete, + PosixFileRead, + PosixFileWrite, + PosixFileGetPossition, + PosixFileSetPossition, + PosixFileGetInfo, + PosixFileSetInfo, + PosixFileFlush +}; + +EFI_SIMPLE_FILE_SYSTEM_PROTOCOL gPosixFileSystemProtocol =3D { + EFI_SIMPLE_FILE_SYSTEM_PROTOCOL_REVISION, + PosixOpenVolume, +}; + +#else =20 EFI_FILE_PROTOCOL gPosixFileProtocol =3D { EFI_FILE_REVISION, @@ -89,6 +167,7 @@ EFI_SIMPLE_FILE_SYSTEM_PROTOCOL gPosixFileSystemProtocol= =3D { GasketPosixOpenVolume, }; =20 +#endif =20 /** Open the root directory on a volume. @@ -1573,6 +1652,19 @@ PosixFileSystmeThunkClose ( return EFI_SUCCESS; } =20 +#if defined(__aarch64__) + +EMU_IO_THUNK_PROTOCOL gPosixFileSystemThunkIo =3D { + &gEfiSimpleFileSystemProtocolGuid, + NULL, + NULL, + 0, + PosixFileSystmeThunkOpen, + PosixFileSystmeThunkClose, + NULL +}; + +#else =20 EMU_IO_THUNK_PROTOCOL gPosixFileSystemThunkIo =3D { &gEfiSimpleFileSystemProtocolGuid, @@ -1584,4 +1676,4 @@ EMU_IO_THUNK_PROTOCOL gPosixFileSystemThunkIo =3D { NULL }; =20 - +#endif diff --git a/EmulatorPkg/Unix/Host/Pthreads.c b/EmulatorPkg/Unix/Host/Pthre= ads.c index 025687c356..3613e4cf60 100644 --- a/EmulatorPkg/Unix/Host/Pthreads.c +++ b/EmulatorPkg/Unix/Host/Pthreads.c @@ -173,6 +173,20 @@ PthreadSelf ( return (UINTN)pthread_self (); } =20 +#if defined(__aarch64__) + +EMU_THREAD_THUNK_PROTOCOL gPthreadThunk =3D { + PthreadMutexLock, + PthreadMutexUnLock, + PthreadMutexTryLock, + PthreadMutexInit, + PthreadMutexDestroy, + PthreadCreate, + PthreadExit, + PthreadSelf +}; + +#else =20 EMU_THREAD_THUNK_PROTOCOL gPthreadThunk =3D { GasketPthreadMutexLock, @@ -185,6 +199,7 @@ EMU_THREAD_THUNK_PROTOCOL gPthreadThunk =3D { GasketPthreadSelf }; =20 +#endif =20 EFI_STATUS PthreadOpen ( @@ -215,6 +230,19 @@ PthreadClose ( return EFI_SUCCESS; } =20 +#if defined(__aarch64__) + +EMU_IO_THUNK_PROTOCOL gPthreadThunkIo =3D { + &gEmuThreadThunkProtocolGuid, + NULL, + NULL, + 0, + PthreadOpen, + PthreadClose, + NULL +}; + +#else =20 EMU_IO_THUNK_PROTOCOL gPthreadThunkIo =3D { &gEmuThreadThunkProtocolGuid, @@ -226,4 +254,4 @@ EMU_IO_THUNK_PROTOCOL gPthreadThunkIo =3D { NULL }; =20 - +#endif diff --git a/EmulatorPkg/Unix/Host/X11GraphicsWindow.c b/EmulatorPkg/Unix/H= ost/X11GraphicsWindow.c index 5325a0e35b..cff8a6f7b9 100644 --- a/EmulatorPkg/Unix/Host/X11GraphicsWindow.c +++ b/EmulatorPkg/Unix/Host/X11GraphicsWindow.c @@ -918,6 +918,16 @@ X11GraphicsWindowOpen ( return EFI_OUT_OF_RESOURCES; } =20 +#if defined(__aarch64__) + Drv->GraphicsIo.Size =3D X11Size; + Drv->GraphicsIo.CheckKey =3D X11CheckKey; + Drv->GraphicsIo.GetKey =3D X11GetKey; + Drv->GraphicsIo.KeySetState =3D X11KeySetState; + Drv->GraphicsIo.RegisterKeyNotify =3D X11RegisterKeyNotify; + Drv->GraphicsIo.Blt =3D X11Blt; + Drv->GraphicsIo.CheckPointer =3D X11CheckPointer; + Drv->GraphicsIo.GetPointerState =3D X11GetPointerState; +#else Drv->GraphicsIo.Size =3D GasketX11Size; Drv->GraphicsIo.CheckKey =3D GasketX11CheckKey; Drv->GraphicsIo.GetKey =3D GasketX11GetKey; @@ -926,6 +936,7 @@ X11GraphicsWindowOpen ( Drv->GraphicsIo.Blt =3D GasketX11Blt; Drv->GraphicsIo.CheckPointer =3D GasketX11CheckPointer; Drv->GraphicsIo.GetPointerState =3D GasketX11GetPointerState; +#endif =20 =20 Drv->key_count =3D 0; @@ -1008,6 +1019,19 @@ X11GraphicsWindowClose ( return EFI_SUCCESS; } =20 +#if defined(__aarch64__) + +EMU_IO_THUNK_PROTOCOL gX11ThunkIo =3D { + &gEmuGraphicsWindowProtocolGuid, + NULL, + NULL, + 0, + X11GraphicsWindowOpen, + X11GraphicsWindowClose, + NULL +}; + +#else =20 EMU_IO_THUNK_PROTOCOL gX11ThunkIo =3D { &gEmuGraphicsWindowProtocolGuid, @@ -1019,4 +1043,4 @@ EMU_IO_THUNK_PROTOCOL gX11ThunkIo =3D { NULL }; =20 - +#endif --=20 2.33.0 -=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 (#81722): https://edk2.groups.io/g/devel/message/81722 Mute This Topic: https://groups.io/mt/86198795/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- From nobody Sat Apr 27 02:06:11 2024 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+81723+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+81723+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1633801533; cv=none; d=zohomail.com; s=zohoarc; b=MrwQWQzVJ1V+IwYFnfrkBBMMqiNtZ7L+7ejeojlFyDO5Ij1oZknDeOykmJKSZC7ty1ErmQpxO7utECMByS356xQY1kN7x7qj22DR9+VqAp2Mp8Nkj8DUb8ubjfVNwL/jcSDpbHfyd24q7QdR7rIP6ImhqQrku7eIsK4xm2bzBvw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1633801533; 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=MSGBE61xUJV70Sto+tQmVneheUz8z23ERebsX2XgSVM=; b=MYpJQJnwaN0yVZCvJIUj9LySxyVtj8CIw5QLgC0YVxWN1ughCBz1deorPz0ZTVslgSfoK9MoUUewalTfuweBm6l2GsurAOTwtCysiqfz/XaNv+GVQOAQRNh2PoB+mRtLNXHZDJFFXVqeynIefH8Xu5pATDO1pyBckMq2y3JUUmY= 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+81723+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 1633801533127243.49949254596345; Sat, 9 Oct 2021 10:45:33 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id q0ggYY1788612xrRfY1UWgt0; Sat, 09 Oct 2021 10:45:32 -0700 X-Received: from mail-pl1-f178.google.com (mail-pl1-f178.google.com [209.85.214.178]) by mx.groups.io with SMTP id smtpd.web12.8267.1633794642684585043 for ; Sat, 09 Oct 2021 08:50:42 -0700 X-Received: by mail-pl1-f178.google.com with SMTP id v20so1071581plo.7 for ; Sat, 09 Oct 2021 08:50:42 -0700 (PDT) X-Gm-Message-State: lFwCCaV9EoaqKZ8q59DFrrnPx1787277AA= X-Google-Smtp-Source: ABdhPJwMBDPOzU2V+e52lgkJMP2LM6yXzT8dEfCbRNnHyP0GQdy0q5BFHl8fwbH/KP8p9lLfHTcABw== X-Received: by 2002:a17:90a:9d81:: with SMTP id k1mr10612582pjp.153.1633794642299; Sat, 09 Oct 2021 08:50:42 -0700 (PDT) X-Received: from localhost.localdomain ([240d:1a:ada:4400:d496:915d:ba15:739a]) by smtp.gmail.com with ESMTPSA id z2sm2633255pfe.210.2021.10.09.08.50.40 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 09 Oct 2021 08:50:41 -0700 (PDT) From: "Akira Moroo" To: devel@edk2.groups.io Cc: afish@apple.com, ray.ni@intel.com, Akira Moroo Subject: [edk2-devel] [RFC PATCH 4/4] EmulatorPkg: Add AArch64 Unix host build support Date: Sun, 10 Oct 2021 00:49:18 +0900 Message-Id: <7d717f2a0250a073f8738a200f1a95970e9ea1fd.1633789833.git.retrage01@gmail.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,retrage01@gmail.com Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1633801532; bh=FN8hBUwqI/97wJcuClFhVIwbwx0/8gULiO34Az5QoXo=; h=Cc:Date:From:Reply-To:Subject:To; b=vCsxJQiwvJQwzzOlIEFfccv2e8TelQGnZLAgKaQ1YlwjuAX34ggDsfWbxKPT3euCZOw yy8ldjFOavOakj5+93a4wujU9OboqHgkuIssWvOhjqJD/qsuUKLRRnnkhXPVbexkUOegM r5FS3vSJzFUFcRSEKBQCTdgNk44Jv8iTMSM= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1633801535184100015 Content-Type: text/plain; charset="utf-8" This commit adds AArch64 Unix host build support for EmulatorPkg. Signed-off-by: Akira Moroo --- EmulatorPkg/EmulatorPkg.dsc | 15 ++++++++++++--- EmulatorPkg/Readme.md | 8 ++++++++ EmulatorPkg/Unix/Host/Host.inf | 5 +++++ EmulatorPkg/build.sh | 8 ++++++++ 4 files changed, 33 insertions(+), 3 deletions(-) diff --git a/EmulatorPkg/EmulatorPkg.dsc b/EmulatorPkg/EmulatorPkg.dsc index 554c13ddb5..91d0176fc7 100644 --- a/EmulatorPkg/EmulatorPkg.dsc +++ b/EmulatorPkg/EmulatorPkg.dsc @@ -19,7 +19,7 @@ DSC_SPECIFICATION =3D 0x00010005 OUTPUT_DIRECTORY =3D Build/Emulator$(ARCH) =20 - SUPPORTED_ARCHITECTURES =3D X64|IA32 + SUPPORTED_ARCHITECTURES =3D X64|IA32|AARCH64 BUILD_TARGETS =3D DEBUG|RELEASE|NOOPT SKUID_IDENTIFIER =3D DEFAULT FLASH_DEFINITION =3D EmulatorPkg/EmulatorPkg.fdf @@ -138,6 +138,13 @@ AuthVariableLib|MdeModulePkg/Library/AuthVariableLibNull/AuthVariableLib= Null.inf !endif =20 +[LibraryClasses.AARCH64] + ArmLib|ArmPkg/Library/ArmLib/ArmBaseLib.inf + ArmMmuLib|ArmPkg/Library/ArmMmuLib/ArmMmuBaseLib.inf + CacheMaintenanceLib|ArmPkg/Library/ArmCacheMaintenanceLib/ArmCacheMainte= nanceLib.inf + NULL|ArmPkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf + NULL|MdePkg/Library/BaseStackCheckLib/BaseStackCheckLib.inf + [LibraryClasses.common.SEC] PeiServicesLib|EmulatorPkg/Library/SecPeiServicesLib/SecPeiServicesLib.i= nf PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf @@ -209,8 +216,10 @@ TimerLib|EmulatorPkg/Library/DxeTimerLib/DxeTimerLib.inf =20 [PcdsFeatureFlag] - gEfiMdeModulePkgTokenSpaceGuid.PcdDxeIplSwitchToLongMode|FALSE gEfiMdeModulePkgTokenSpaceGuid.PcdPeiCoreImageLoaderSearchTeSectionFirst= |FALSE + +[PcdsFeatureFlag.IA32,PcdsFeatureFlag.X64] + gEfiMdeModulePkgTokenSpaceGuid.PcdDxeIplSwitchToLongMode|FALSE gEfiMdeModulePkgTokenSpaceGuid.PcdDxeIplBuildPageTables|FALSE =20 [PcdsFixedAtBuild] @@ -288,7 +297,7 @@ gEfiMdePkgTokenSpaceGuid.PcdPlatformBootTimeOut|L"Timeout"|gEfiGlobalVar= iableGuid|0x0|10 =20 [Components] -!if "IA32" in $(ARCH) || "X64" in $(ARCH) +!if "IA32" in $(ARCH) || "X64" in $(ARCH) || "AARCH64" in $(ARCH) !if "MSFT" in $(FAMILY) || $(WIN_HOST_BUILD) =3D=3D TRUE ## # Emulator, OS WIN application diff --git a/EmulatorPkg/Readme.md b/EmulatorPkg/Readme.md index 0c2eea6a9a..e3d0b58578 100644 --- a/EmulatorPkg/Readme.md +++ b/EmulatorPkg/Readme.md @@ -35,6 +35,10 @@ https://github.com/tianocore/tianocore.github.io/wiki/Em= ulatorPkg =20 `build -p EmulatorPkg\EmulatorPkg.dsc -t GCC5 -a X64` =20 + * AArch64 emulator in Linux: + + `build -p EmulatorPkg\EmulatorPkg.dsc -t GCC5 -a AARCH64` + **You can start/run the emulator using the following command:** * 32bit emulator in Windows: =20 @@ -52,6 +56,10 @@ https://github.com/tianocore/tianocore.github.io/wiki/Em= ulatorPkg =20 `cd Build/EmulatorX64/DEBUG_GCC5/X64/ && ./Host` =20 + * AArch64 emulator in Linux: + + `cd Build/EmulatorAARCH64/DEBUG_GCC5/AARCH64/ && ./Host` + **On posix-like environment with the bash shell you can use EmulatorPkg/bu= ild.sh to simplify building and running emulator.** =20 diff --git a/EmulatorPkg/Unix/Host/Host.inf b/EmulatorPkg/Unix/Host/Host.inf index 43cb55aa21..fe4c6d511c 100644 --- a/EmulatorPkg/Unix/Host/Host.inf +++ b/EmulatorPkg/Unix/Host/Host.inf @@ -129,6 +129,11 @@ GCC:*_*_X64_PP_FLAGS =3D=3D -m64 -E -x assembler-with-cpp -include $(DE= ST_DIR_DEBUG)/AutoGen.h GCC:*_*_X64_ASM_FLAGS =3D=3D -m64 -c -x assembler -imacros $(DEST_DIR_D= EBUG)/AutoGen.h =20 + GCC:*_*_AARCH64_DLINK_FLAGS =3D=3D -fPIC -flto -o $(BIN_DIR)/Host -L/us= r/X11R6/lib + GCC:*_*_AARCH64_ASM_FLAGS =3D=3D -g -c -x assembler -imacros $(DEST_DIR= _DEBUG)/AutoGen.h + GCC:*_*_AARCH64_PP_FLAGS =3D=3D -E -x assembler-with-cpp -include $(DES= T_DIR_DEBUG)/AutoGen.h + GCC:*_*_AARCH64_CC_FLAGS =3D=3D -c -O0 -g -fPIC -fshort-wchar -fno-stri= ct-aliasing -idirafter/usr/include -include $(DEST_DIR_DEBUG)/AutoGen.h -DU= SING_LTO -DSTRING_ARRAY_NAME=3D$(BASE_NAME)Strings + GCC:*_*_*_DLINK2_FLAGS =3D=3D -lpthread -ldl -lXext -lX11 =20 # diff --git a/EmulatorPkg/build.sh b/EmulatorPkg/build.sh index 76c22dfaf8..e2ce1b8e18 100755 --- a/EmulatorPkg/build.sh +++ b/EmulatorPkg/build.sh @@ -83,6 +83,9 @@ case `uname` in x86_64) HOST_PROCESSOR=3DX64 ;; + aarch64) + HOST_PROCESSOR=3DAARCH64 + ;; esac =20 gcc_version=3D$(gcc -v 2>&1 | tail -1 | awk '{print $3}') @@ -174,6 +177,11 @@ case $PROCESSOR in LIB_NAMES=3D"ld-linux-x86-64.so.2 libdl.so.2 crt1.o crti.o crtn.o" LIB_SEARCH_PATHS=3D"/usr/lib/x86_64-linux-gnu /usr/lib64 /lib64 /usr/l= ib /lib" ;; + AARCH64) + ARCH_SIZE=3D64 + LIB_NAMES=3D"ld-linux-aarch64.so.1 libdl.so.2 crt1.o crti.o crtn.o" + LIB_SEARCH_PATHS=3D"/usr/lib/aarch64-linux-gnu /usr/lib /lib" + ;; esac =20 for libname in $LIB_NAMES --=20 2.33.0 -=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 (#81723): https://edk2.groups.io/g/devel/message/81723 Mute This Topic: https://groups.io/mt/86198796/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-