From mboxrd@z Thu Jan 1 00:00:00 1970 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 Authentication-Results: mx.groups.io; dkim=fail reason="no key for verify" header.i=@polynum.com header.s=202006 header.b=f7JVZRtB; spf=pass (domain: sfr.fr, ip: 93.17.128.212, mailfrom: thierry.laronde@sfr.fr) X-mail-filterd: {"version":"1.6.0","queueID":"4NnlCq0CZLz1LQL2p","contextId": "004876c1-d2f9-4cd3-bb72-793b9aca14c4"} 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 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=polynum.com; s=202006; t=1672919447; h=Date:From:To:Cc:Subject; bh=YOQ7WDAVXv4KvDAM6/acnGmWVcRI0V2fW VUQ5xEgadA=; b=f7JVZRtBIFsQXqaToDzQBsvTuWogfvx/bYBc18VkVdL1QiPOMotc5Cufq/0F7 t/NjlOzRc+BWLPCZ9sGiGTgqhWWu+HuTju/J1uTHDeTK5V8DfYXL8oVUzuJk9kHGYxd2Od7+2kpv PXNXk0PxsGldTqlgjFp2GYzbXKCB9PashXQheHVY+SczNe/AVgSW7YZnPfaMx40Eq0T6mBHccuMA qWUM7j8js4Ibgzb2Md/Xe3JTGCshOd6xcYDdZEs+U67l4VQiFwTNVl7XyC1hmiFOx2evGl0VTVP3 /1GroomvVSzFBV/4T/yIbz63ctu3dKkeMP7tR4Jh7IDQGkgo2wdCQ== 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) Authentication-Results: sfr.fr; auth=pass (LOGIN) smtp.auth=thierry.laronde@sfr.fr 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) 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: PING [PATCH 1/1 v2] EmulatorPkg: fixes for NetBSD Message-ID: MIME-Version: 1.0 X-Groupsio-MsgNum: 97986 Content-Type: multipart/mixed; boundary="r2P1afr46+Lv0hKG" Content-Disposition: inline --r2P1afr46+Lv0hKG Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Hello, Ping'ing for this patch sent on November 2022. The patch is trivial. Can someone review it or eventually merge it if OK? TIA, -- Thierry Laronde http://www.kergis.com/ http://kertex.kergis.com/ Key fingerprint = 0FF7 E906 FBAF FE95 FD89 250D 52B1 AE95 6006 F40C --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--