From nobody Tue May 14 06:34:12 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+97986+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+97986+1787277+3901457@groups.io ARC-Seal: i=1; a=rsa-sha256; t=1672919451; cv=none; d=zohomail.com; s=zohoarc; b=LAx1ZhX4MNULw101dOQ1ls4IyZvJCM3CHPsManGQlXnQuKJwA2FMvC4iEcFmcoUiX6GyDlw9gB/a05PFw7iOYMraXXYy5jVZFFfmhq4FYBM3U2FmM7POysZQ9nyvi7UwFBz42QWQauigfDuNLUuJv31SYq8ajXwl6tLMCgu0f5w= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1672919451; h=Content-Type:Cc:Date:From:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Sender:Subject:To; bh=2vRiiq0wvC9SOkhHvv+S7t7958TeeiUs2p5uXs63gSM=; b=iPbDGFHETfhnpfmfLE5Yg9nLVCZEQDcOI03UtXBcxT9BURV4mIKnTxGPdXZxdqMnpJUOmqPwCOWwqM1tnLZyaBmRoN+HYwPhNipBTVNphvaFnyxXJtQGGXMNUbPCZ4dfqn/chzBn8Q4WGwlc5m734yeusOXsSSOQWugDvZxiR2g= 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+97986+1787277+3901457@groups.io Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1672919451137989.8777551036983; Thu, 5 Jan 2023 03:50:51 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id KGK9YY1788612xEbXIQnVIQQ; Thu, 05 Jan 2023 03:50:50 -0800 X-Received: from smtp26.services.sfr.fr (smtp26.services.sfr.fr [93.17.128.212]) by mx.groups.io with SMTP id smtpd.web10.11164.1672919448868140685 for ; Thu, 05 Jan 2023 03:50:49 -0800 X-mail-filterd: {"version":"1.6.0","queueID":"4NnlCq0CZLz1LQL2p","contextId": "004876c1-d2f9-4cd3-bb72-793b9aca14c4"} X-Received: from cauchy.polynum.local (20.204.0.93.rev.sfr.net [93.0.204.20]) by msfrf2636.sfr.fr (SMTP Server) with ESMTP id 4NnlCq0CZLz1LQL2p; Thu, 5 Jan 2023 12:50:47 +0100 (CET) X-mail-filterd: {"version":"1.6.0","queueID":"4NnlCp4YgCz1LQL2X","contextId": "91f109ab-c7ae-4c7c-967d-34d5a2b4a1a4"} X-sfr-mailing: LEGIT X-sfr-spamrating: 36 X-sfr-spam: not-spam X-Received: from cauchy.polynum.local (20.204.0.93.rev.sfr.net [93.0.204.20]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: thierry.laronde@sfr.fr) by msfrf2636.sfr.fr (SMTP Server) with ESMTPSA id 4NnlCp4YgCz1LQL2X; Thu, 5 Jan 2023 12:50:46 +0100 (CET) X-Received: from cauchy.polynum.local (localhost [127.0.0.1]) by cauchy.polynum.local (8.15.2/8.15.2) with ESMTP id 305BoiOf003061; Thu, 5 Jan 2023 12:50:44 +0100 (CET) X-Received: (from tlaronde@localhost) by cauchy.polynum.local (8.15.2/8.14.9/Submit) id 305Boirm002986; Thu, 5 Jan 2023 12:50:44 +0100 (CET) X-Authentication-Warning: cauchy.polynum.local: tlaronde set sender to thierry.laronde@sfr.fr using -f Date: Thu, 5 Jan 2023 12:50:44 +0100 From: tlaronde@polynum.com To: devel@edk2.groups.io Cc: Andrew Fish , Ray Ni , Pedro Falcato Subject: [edk2-devel] PING [PATCH 1/1 v2] EmulatorPkg: fixes for NetBSD Message-ID: 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,tlaronde@polynum.com X-Gm-Message-State: LPZUbcFr88JPo07JCT13TIPVx1787277AA= Content-Type: multipart/mixed; boundary="r2P1afr46+Lv0hKG" Content-Disposition: inline DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1672919450; bh=8LSIx1EENNfuJSKtJZkH5qBVrOHJDGEBFo6LubfKq6w=; h=Cc:Content-Type:Date:From:Reply-To:Subject:To; b=JaOmMTQQVHXsW4PEzFz5EviMTmsc7hex4fm3TTgk7ZazUe5FLAew4WSkYiupR6X8X4a ZEc94v3ax4mKD+c/7T+nKwF+ENil5LT9yUmgXIRyV3iv82Y/xMKV14UEDG4MeESvqnOW6 sqjdGw3yXp9ruhVQ1Z0UiqZNCQ/2ony5z3E= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1672919452862100002 Content-Transfer-Encoding: quoted-printable --r2P1afr46+Lv0hKG Content-Disposition: inline MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: base64 SGVsbG8sCgpQaW5nJ2luZyBmb3IgdGhpcyBwYXRjaCBzZW50IG9uIE5vdmVtYmVyIDIwMjIuCgpU aGUgcGF0Y2ggaXMgdHJpdmlhbC4gQ2FuIHNvbWVvbmUgcmV2aWV3IGl0IG9yIGV2ZW50dWFsbHkg bWVyZ2UgaXQgaWYgT0s/CgpUSUEsCi0tPTIwCiAgICAgICAgVGhpZXJyeSBMYXJvbmRlIDx0bGFy b25kZSArQVQrIHBvbHludW0gK2RvdCsgY29tPgogICAgICAgICAgICAgICAgICAgICBodHRwOi8v d3d3Lmtlcmdpcy5jb20vCiAgICAgICAgICAgICAgICAgICAgaHR0cDovL2tlcnRleC5rZXJnaXMu Y29tLwpLZXkgZmluZ2VycHJpbnQgPTNEIDBGRjcgRTkwNiBGQkFGIEZFOTUgRkQ4OSAgMjUwRCA1 MkIxIEFFOTUgNjAwNiBGNDBDCgoKLT0zRC09M0QtPTNELT0zRC09M0QtPTNELT0zRC09M0QtPTNE LT0zRC09M0QtCkdyb3Vwcy5pbyBMaW5rczogWW91IHJlY2VpdmUgYWxsIG1lc3NhZ2VzIHNlbnQg dG8gdGhpcyBncm91cC4KVmlldy9SZXBseSBPbmxpbmUgKCM5Nzk4Nik6IGh0dHBzOi8vZWRrMi5n cm91cHMuaW8vZy9kZXZlbC9tZXNzYWdlLzk3OTg2Ck11dGUgVGhpcyBUb3BpYzogaHR0cHM6Ly9n cm91cHMuaW8vbXQvOTYwNzAxNDQvMTc4NzI3NwpHcm91cCBPd25lcjogZGV2ZWwrb3duZXJAZWRr Mi5ncm91cHMuaW8KVW5zdWJzY3JpYmU6IGh0dHBzOi8vZWRrMi5ncm91cHMuaW8vZy9kZXZlbC91 bnN1YiBbaW1wb3J0ZXJAcGF0Y2hldy5vcmddCi09M0QtPTNELT0zRC09M0QtPTNELT0zRC09M0Qt PTNELT0zRC09M0QtPTNELQoK --r2P1afr46+Lv0hKG Content-Type: message/rfc822 Content-Disposition: inline Return-Path: Received: from cauchy.polynum.local (localhost [127.0.0.1]) by cauchy.polynum.local (8.15.2/8.15.2) with ESMTP id 2AOElBWa001531 for ; Thu, 24 Nov 2022 15:47:11 +0100 (CET) MIME-Version: 1.0 Received: from SSL0.OVH.NET [193.70.18.144] by cauchy.polynum.local with IMAP (fetchmail-6.4.19) for (single-drop); Thu, 24 Nov 2022 15:47:11 +0100 (CET) Received: from DAG1EX2.mxp4.local (172.16.2.2) by DAG1EX1.mxp4.local (172.16.2.1) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.16 via Mailbox Transport; Thu, 24 Nov 2022 15:47:10 +0100 Received: from DAG2EX2.mxp4.local (172.16.2.4) by DAG1EX2.mxp4.local (172.16.2.2) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.16; Thu, 24 Nov 2022 15:47:10 +0100 Received: from output32.mail.ovh.net (164.132.34.32) by mxplan4.mail.ovh.net (172.16.2.4) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.16 via Frontend Transport; Thu, 24 Nov 2022 15:47:10 +0100 Received: from vr24.mail.ovh.net (unknown [10.101.8.24]) by out32.mail.ovh.net (Postfix) with ESMTP id 4NJ16k05b5zNCYL9R for ; Thu, 24 Nov 2022 14:47:10 +0000 (UTC) Received: from in55.mail.ovh.net (unknown [10.101.4.55]) by vr24.mail.ovh.net (Postfix) with ESMTP id 4NJ16j5Dypz33QnPZ for ; Thu, 24 Nov 2022 14:47:09 +0000 (UTC) Received-SPF: SoftFail (DAG1EX2.mxp4.local: domain of transitioning devel@edk2.groups.io discourages use of 164.132.34.32 as permitted sender) Received-SPF: Softfail (mailfrom) identity=mailfrom; client-ip=217.70.183.193; helo=relay1-d.mail.gandi.net; envelope-from=bounce+27952+96614+7312392+11838185@groups.io; receiver=tlaronde@kergis.com Authentication-Results: in55.mail.ovh.net; dkim=pass (1024-bit key; unprotected) header.d=groups.io header.i=@groups.io header.b="aM2XOHQI"; dkim-atps=neutral Received: from relay1-d.mail.gandi.net (relay1-d.mail.gandi.net [217.70.183.193]) by in55.mail.ovh.net (Postfix) with ESMTPS id 4NJ16j3gVzz1xCG3S for ; Thu, 24 Nov 2022 14:47:09 +0000 (UTC) Received: from spool.mail.gandi.net (spool3.mail.gandi.net [217.70.178.212]) by relay.mail.gandi.net (Postfix) with ESMTPS id DFE23240003 for ; Thu, 24 Nov 2022 14:47:08 +0000 (UTC) X-Envelope-To: tlaronde@polynum.com Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by spool.mail.gandi.net (Postfix) with ESMTPS id 4C751AC1694 for ; Thu, 24 Nov 2022 14:47:07 +0000 (UTC) X-Received: by 127.0.0.2 with SMTP id Ry2IYY7313727xtHAEnMC4Gm; Thu, 24 Nov 2022 06:47:05 -0800 X-Received: from smtp26.services.sfr.fr (smtp26.services.sfr.fr [93.17.128.215]) by mx.groups.io with SMTP id smtpd.web10.25464.1669301224363032998 for ; Thu, 24 Nov 2022 06:47:05 -0800 X-mail-filterd: {"version":"1.5.3","queueID":"4NJ16Z4wNFz1LQN0P","contextId": "ff74228a-d00c-4a65-b551-af3e4b007a19"} X-Received: from cauchy.polynum.local (20.204.0.93.rev.sfr.net [93.0.204.20]) by msfrf2639.sfr.fr (SMTP Server) with ESMTP id 4NJ16Z4wNFz1LQN0P; Thu, 24 Nov 2022 15:47:02 +0100 (CET) X-mail-filterd: {"version":"1.5.3","queueID":"4NJ16Z20Zlz1LQN15","contextId": "6c546a44-ff67-41ca-bbab-3601bb13a014"} X-sfr-mailing: LEGIT X-sfr-spamrating: 36 X-sfr-spam: not-spam X-Received: from cauchy.polynum.local (20.204.0.93.rev.sfr.net [93.0.204.20]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: thierry.laronde@sfr.fr) by msfrf2639.sfr.fr (SMTP Server) with ESMTPSA id 4NJ16Z20Zlz1LQN15; Thu, 24 Nov 2022 15:47:02 +0100 (CET) X-Received: from cauchy.polynum.local (localhost [127.0.0.1]) by cauchy.polynum.local (8.15.2/8.15.2) with ESMTP id 2AOEkxJg029715; Thu, 24 Nov 2022 15:46:59 +0100 (CET) X-Received: (from tlaronde@localhost) by cauchy.polynum.local (8.15.2/8.14.9/Submit) id 2AOEkxEU026977; Thu, 24 Nov 2022 15:46:59 +0100 (CET) X-Authentication-Warning: cauchy.polynum.local: tlaronde set sender to thierry.laronde@sfr.fr using -f Date: Thu, 24 Nov 2022 15:46:59 +0100 From: tlaronde@polynum.com To: devel@edk2.groups.io Cc: Andrew Fish , Ray Ni , Pedro Falcato Subject: [edk2-devel] [PATCH 1/1 v2] EmulatorPkg: fixes for NetBSD Message-ID: <172A8C9EBA34F9B4.368@groups.io> Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: Sender: List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Delivered-To: mailing list devel@edk2.groups.io Reply-To: devel@edk2.groups.io, tlaronde@polynum.com X-Orig-Message-Id: X-Gm-Message-State: xURXCcwJqu6BCbIz4aDwpjBux7312392AA= Content-Type: text/plain; charset=us-ascii Content-Disposition: inline DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1669301225; bh=cVWjYVY1GCWwYlKS2ZL/3FsOZLhttye6NYdPR2zCnWE=; h=Cc:Content-Type:Date:From:Reply-To:Subject:To; b=aM2XOHQIs9o5lWAgFIOLnk3Gi8RsBQnPkD5d9t9dgrL5mNbnj+Rf8Zj0VSoIYmj3xiK ICpPqvGGIPPCTUXN/CJMOR6GNO74iVGnGOqo0veQSIuCOQPsU5uz2C25Blp+b6laVSlCp M5DIPNDVaTbg5BqD7DjbNVT4OnbZMWvduAQ= Received-SPF: pass (spool3: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+96614+7312392+11838185@groups.io; helo=mail02.groups.io; Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20140610 header.b=aM2XOHQI; dmarc=none; spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce@groups.io X-OVH-Remote: 217.70.183.193 (relay1-d.mail.gandi.net) X-Ovh-Tracer-Id: 9506254392247693505 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedvgedrieefgdeilecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfqggfjpdevjffgvefmvefgnecuuegrihhlohhuthemucehtddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpeffhffvvefukfggphfjtdefshejrhgtugesthdtredttddtvdenucfhrhhomhepthhlrghrohhnuggvsehpohhlhihnuhhmrdgtohhmnecuggftrfgrthhtvghrnhepieefkedtteffveehhfevieefgeekueetveeigfehfedtleektdefkeeufeeuiedvnecuffhomhgrihhnpehkvghrghhishdrtghomhdpghhrohhuphhsrdhiohenucfkphepvddujedrjedtrddukeefrdduleefpdeiiedrudejhedrvddvvddruddtkeenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepihhnvghtpedvudejrdejtddrudekfedrudelfedpmhgrihhlfhhrohhmpeeosghouhhntggvoddvjeelhedvodelieeiudegodejfeduvdefledvodduudekfeekudekheesghhrohhuphhsrdhioheqpdhnsggprhgtphhtthhopedupdhrtghpthhtohepthhlrghrohhnuggvsehkvghrghhishdrtghomhdpoffvtefjohhsthepvhhrvdegpdgukhhimhepphgrshhspdhgvghokffrpefhtfdprhgvvhfkrfeprhgvlhgrhiduqdgurdhmrghilhdrghgrnhguihdrnhgvth X-Ovh-Spam-Status: OK X-Ovh-Spam-Reason: vr: OK; dkim: disabled; spf: disabled X-Ovh-Message-Type: OK X-MS-Exchange-Organization-Network-Message-Id: 2a45004d-1b41-40ea-fdf0-08dace2ac432 X-MS-Exchange-Organization-PRD: edk2.groups.io X-MS-Exchange-Organization-SenderIdResult: SoftFail X-MS-Exchange-Organization-AVStamp-Enterprise: 1.0 X-Ovh-Tracer-GUID: bca89cb5-eedc-4bc9-bbe2-4222bf8b1120 X-MS-Exchange-Organization-AuthSource: DAG2EX2.mxp4.local X-MS-Exchange-Organization-AuthAs: Anonymous X-MS-Exchange-Transport-EndToEndLatency: 00:00:00.5029582 X-MS-Exchange-Processed-By-BccFoldering: 15.01.2507.016 Signed-off-by: Thierry Laronde Fixes for compilation on NetBSD. --- EmulatorPkg/Unix/Host/BlockIo.c | 16 +++++++++++++++- EmulatorPkg/Unix/Host/Host.c | 7 +++++-- EmulatorPkg/Unix/Host/Host.h | 7 ++++++- 3 files changed, 26 insertions(+), 4 deletions(-) diff --git a/EmulatorPkg/Unix/Host/BlockIo.c b/EmulatorPkg/Unix/Host/BlockIo.c index cf2d6b4cda..57b4c8d3be 100644 --- a/EmulatorPkg/Unix/Host/BlockIo.c +++ b/EmulatorPkg/Unix/Host/BlockIo.c @@ -133,6 +133,20 @@ EmuBlockIoOpenDevice ( ioctl (Private->fd, DKIOCGETMAXBLOCKCOUNTWRITE, &Private->Media->OptimalTransferLengthGranularity); } + #elif _NETBSD_SOURCE + { + UINTN BlockSize; + off_t DiskSize; + + if (ioctl (Private->fd, DIOCGSECTORSIZE, &BlockSize) == 0) { + Private->Media->BlockSize = BlockSize; + } + + if (ioctl (Private->fd, DIOCGMEDIASIZE, &DiskSize) == 0) { + Private->NumberOfBlocks = DivU64x32 (DiskSize, (UINT32)BlockSize); + Private->Media->LastBlock = Private->NumberOfBlocks - 1; + } + } #else { size_t BlockSize; @@ -154,7 +168,7 @@ EmuBlockIoOpenDevice ( Private->Media->LastBlock = Private->NumberOfBlocks - 1; if (fstatfs (Private->fd, &buf) == 0) { - #if __APPLE__ + #if __APPLE__ || _NETBSD_SOURCE Private->Media->OptimalTransferLengthGranularity = buf.f_iosize/buf.f_bsize; #else Private->Media->OptimalTransferLengthGranularity = buf.f_bsize/buf.f_bsize; diff --git a/EmulatorPkg/Unix/Host/Host.c b/EmulatorPkg/Unix/Host/Host.c index 38c01c84af..1700a4b60f 100644 --- a/EmulatorPkg/Unix/Host/Host.c +++ b/EmulatorPkg/Unix/Host/Host.c @@ -12,6 +12,8 @@ SPDX-License-Identifier: BSD-2-Clause-Patent #define MAP_ANONYMOUS MAP_ANON #endif +#define MAP_ANON_FD_ (-1) + // // Globals // @@ -187,7 +189,7 @@ main ( // InitialStackMemorySize = STACK_SIZE; InitialStackMemory = (UINTN)MapMemory ( - 0, + MAP_ANON_FD_, (UINT32)InitialStackMemorySize, PROT_READ | PROT_WRITE | PROT_EXEC, MAP_ANONYMOUS | MAP_PRIVATE @@ -348,6 +350,7 @@ MapMemory ( while ((!isAligned) && (base != 0)) { res = mmap ((void *)base, length, prot, flags, fd, 0); if (res == MAP_FAILED) { + perror("MapMemory"); return NULL; } @@ -640,7 +643,7 @@ SecUnixPeiAutoScan ( *MemoryBase = 0; res = MapMemory ( - 0, + MAP_ANON_FD_, gSystemMemory[Index].Size, PROT_READ | PROT_WRITE | PROT_EXEC, MAP_PRIVATE | MAP_ANONYMOUS diff --git a/EmulatorPkg/Unix/Host/Host.h b/EmulatorPkg/Unix/Host/Host.h index 0c81cdfc01..0de925adaf 100644 --- a/EmulatorPkg/Unix/Host/Host.h +++ b/EmulatorPkg/Unix/Host/Host.h @@ -31,6 +31,8 @@ SPDX-License-Identifier: BSD-2-Clause-Patent #if __CYGWIN__ #include +#elif _NETBSD_SOURCE + #include #else #include #endif @@ -55,7 +57,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent #include #include -#ifdef __APPLE__ +#if defined(__APPLE__) #include #include #include @@ -65,6 +67,9 @@ SPDX-License-Identifier: BSD-2-Clause-Patent #ifndef _Bool #define _Bool char // for clang debug #endif +#elif defined(_NETBSD_SOURCE) + #define statfs statvfs + #define fstatfs fstatvfs #else #include #include -- 2.34.1 -- Thierry Laronde http://www.kergis.com/ http://kertex.kergis.com/ Key fingerprint = 0FF7 E906 FBAF FE95 FD89 250D 52B1 AE95 6006 F40C -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#96614): https://edk2.groups.io/g/devel/message/96614 Mute This Topic: https://groups.io/mt/95238792/7312392 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [tlaronde@polynum.com] -=-=-=-=-=-=-=-=-=-=-=- --r2P1afr46+Lv0hKG--