From minios-devel-bounces@lists.xenproject.org Mon Aug 03 14:06:18 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Mon, 03 Aug 2020 14:06:18 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1k2b6U-0000h7-9m; Mon, 03 Aug 2020 14:06:14 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=PJxW=BN=upb.ro=vlad_andrei.badoiu@srs-us1.protection.inumbo.net>)
 id 1k2b6T-0000h2-8n
 for minios-devel@lists.xen.org; Mon, 03 Aug 2020 14:06:13 +0000
X-Inumbo-ID: 7aa49ee9-d592-11ea-9092-bc764e2007e4
Received: from mx.upb.ro (unknown [141.85.13.210])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 7aa49ee9-d592-11ea-9092-bc764e2007e4;
 Mon, 03 Aug 2020 14:06:09 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
 by mx.upb.ro (Postfix) with ESMTP id AD98AB561CBD;
 Mon,  3 Aug 2020 17:06:08 +0300 (EEST)
Received: from mx.upb.ro ([127.0.0.1])
 by localhost (mx.upb.ro [127.0.0.1]) (amavisd-new, port 10032)
 with ESMTP id XMbEoiM5T9v2; Mon,  3 Aug 2020 17:06:06 +0300 (EEST)
Received: from localhost (localhost [127.0.0.1])
 by mx.upb.ro (Postfix) with ESMTP id C1D80B561CCA;
 Mon,  3 Aug 2020 17:06:06 +0300 (EEST)
DKIM-Filter: OpenDKIM Filter v2.10.3 mx.upb.ro C1D80B561CCA
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=upb.ro;
 s=96342B8A-77E4-11E5-BA93-D93D0963A2DF; t=1596463566;
 bh=N6q2HbZ8W9Uzerb2Crm9JnriybbOFdSqWUmY33yU0Gg=;
 h=From:To:Date:Message-Id:MIME-Version;
 b=Ej/xKs17MOkQ/k35xv8omt/n9TYuRjCRpX7zcYE5n8jIVYewwBplb07hNfqLqjVqB
 +P8/KyTzqGwnZBWSBI2qcXycM8f6oTTC717neCRNhL9pQk1a8qVAUQF+onveo94Psl
 yHdzKxczAAR0mMx8UmUMcdgplexfw2TugTgvmpdg=
X-Virus-Scanned: amavisd-new at upb.ro
Received: from mx.upb.ro ([127.0.0.1])
 by localhost (mx.upb.ro [127.0.0.1]) (amavisd-new, port 10026)
 with ESMTP id XjEqMMvBf-sc; Mon,  3 Aug 2020 17:06:06 +0300 (EEST)
Received: from localhost.localdomain (unknown [188.25.55.184])
 by mx.upb.ro (Postfix) with ESMTPSA id 62223B561A48;
 Mon,  3 Aug 2020 17:06:06 +0300 (EEST)
From: Vlad-Andrei Badoiu <vlad_andrei.badoiu@upb.ro>
To: minios-devel@lists.xen.org
Subject: [UNIKRAFT PATCH v6 2/3] build: Add option to toggle the stack
 protection
Date: Mon,  3 Aug 2020 16:58:34 +0300
Message-Id: <20200803135836.10392-3-vlad_andrei.badoiu@upb.ro>
X-Mailer: git-send-email 2.25.1
In-Reply-To: <20200803135836.10392-1-vlad_andrei.badoiu@upb.ro>
References: <20200803135836.10392-1-vlad_andrei.badoiu@upb.ro>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
X-BeenThere: minios-devel@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Mini-os development list <minios-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:minios-devel@lists.xenproject.org>
List-Help: <mailto:minios-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=subscribe>
Cc: =?UTF-8?q?Vlad-Andrei=20B=C4=82DOIU=20=2878692=29?=
 <vlad_andrei.badoiu@stud.acs.upb.ro>, simon.kuenzer@neclab.eu,
 alicesuiu17@gmail.com, Vlad-Andrei Badoiu <vlad_andrei.badoiu@upb.ro>
Errors-To: minios-devel-bounces@lists.xenproject.org
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>

From: Vlad-Andrei B=C4=82DOIU (78692) <vlad_andrei.badoiu@stud.acs.upb.ro=
>

This patch adds build option to select different stack protection
levels.

Signed-off-by: Vlad-Andrei Badoiu <vlad_andrei.badoiu@stud.acs.upb.ro>
Signed-off-by: Vlad-Andrei Badoiu <vlad_andrei.badoiu@upb.ro>
---
 Makefile.uk | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/Makefile.uk b/Makefile.uk
index 2c102989..4f1c7642 100644
--- a/Makefile.uk
+++ b/Makefile.uk
@@ -6,7 +6,10 @@
=20
 COMPFLAGS    +=3D -nostdinc -nostdlib
 COMPFLAGS    +=3D -U __linux__ -U __FreeBSD__ -U __sun__
-COMPFLAGS    +=3D -fno-stack-protector -fno-omit-frame-pointer -fno-tree=
-sra -fno-split-stack
+COMPFLAGS    +=3D -fno-omit-frame-pointer -fno-tree-sra -fno-split-stack
+ifneq ($(HAVE_STACKPROTECTOR),y)
+COMPFLAGS    +=3D -fno-stack-protector
+endif
 COMPFLAGS    +=3D -Wall -Wextra
=20
 ASFLAGS      +=3D -D__ASSEMBLY__
--=20
2.25.1



From minios-devel-bounces@lists.xenproject.org Mon Aug 03 14:06:19 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Mon, 03 Aug 2020 14:06:19 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1k2b6Z-0000hU-BN; Mon, 03 Aug 2020 14:06:19 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=PJxW=BN=upb.ro=vlad_andrei.badoiu@srs-us1.protection.inumbo.net>)
 id 1k2b6X-0000h2-VW
 for minios-devel@lists.xen.org; Mon, 03 Aug 2020 14:06:18 +0000
X-Inumbo-ID: 7aa49eea-d592-11ea-9092-bc764e2007e4
Received: from mx.upb.ro (unknown [141.85.13.200])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 7aa49eea-d592-11ea-9092-bc764e2007e4;
 Mon, 03 Aug 2020 14:06:12 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
 by mx.upb.ro (Postfix) with ESMTP id 0C8D8B561CCA;
 Mon,  3 Aug 2020 17:06:09 +0300 (EEST)
Received: from mx.upb.ro ([127.0.0.1])
 by localhost (mx.upb.ro [127.0.0.1]) (amavisd-new, port 10032)
 with ESMTP id SujQM47Nqp7W; Mon,  3 Aug 2020 17:06:07 +0300 (EEST)
Received: from localhost (localhost [127.0.0.1])
 by mx.upb.ro (Postfix) with ESMTP id 2A03EB561A48;
 Mon,  3 Aug 2020 17:06:07 +0300 (EEST)
DKIM-Filter: OpenDKIM Filter v2.10.3 mx.upb.ro 2A03EB561A48
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=upb.ro;
 s=96342B8A-77E4-11E5-BA93-D93D0963A2DF; t=1596463567;
 bh=Hcb3xHEHjld+YsLEcjmcX8WVedZ166EHdJhbU3QJTF4=;
 h=From:To:Date:Message-Id:MIME-Version;
 b=D+KHPmY4VXsRnJqrankKG3mJKONbAe7zVZG90S7ZfabjRFnnJDiUmdtWX2B7hz33r
 1Kwy89ARiuXRMMsMumX3lW/O8Rpp9sVhPZHnHNeIgfteK7jeb+4C2rT7iejU/vEJXW
 UA72ZmhtRQqgVJiFzNisiFsDeLObT2kdfx77KboU=
X-Virus-Scanned: amavisd-new at upb.ro
Received: from mx.upb.ro ([127.0.0.1])
 by localhost (mx.upb.ro [127.0.0.1]) (amavisd-new, port 10026)
 with ESMTP id cgosopnQ0cjs; Mon,  3 Aug 2020 17:06:07 +0300 (EEST)
Received: from localhost.localdomain (unknown [188.25.55.184])
 by mx.upb.ro (Postfix) with ESMTPSA id C1979B561C89;
 Mon,  3 Aug 2020 17:06:06 +0300 (EEST)
From: Vlad-Andrei Badoiu <vlad_andrei.badoiu@upb.ro>
To: minios-devel@lists.xen.org
Subject: [UNIKRAFT PATCH v6 3/3] lib/ukboot: Initialize the canary value at
 boot
Date: Mon,  3 Aug 2020 16:58:35 +0300
Message-Id: <20200803135836.10392-4-vlad_andrei.badoiu@upb.ro>
X-Mailer: git-send-email 2.25.1
In-Reply-To: <20200803135836.10392-1-vlad_andrei.badoiu@upb.ro>
References: <20200803135836.10392-1-vlad_andrei.badoiu@upb.ro>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
X-BeenThere: minios-devel@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Mini-os development list <minios-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:minios-devel@lists.xenproject.org>
List-Help: <mailto:minios-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=subscribe>
Cc: =?UTF-8?q?Vlad-Andrei=20B=C4=82DOIU=20=2878692=29?=
 <vlad_andrei.badoiu@stud.acs.upb.ro>, simon.kuenzer@neclab.eu,
 alicesuiu17@gmail.com, Vlad-Andrei Badoiu <vlad_andrei.badoiu@upb.ro>
Errors-To: minios-devel-bounces@lists.xenproject.org
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>

From: Vlad-Andrei B=C4=82DOIU (78692) <vlad_andrei.badoiu@stud.acs.upb.ro=
>

We initialize the canary value right after all the internal libraries
have loaded.

Signed-off-by: Vlad-Andrei Badoiu <vlad_andrei.badoiu@stud.acs.upb.ro>
Signed-off-by: Vlad-Andrei Badoiu <vlad_andrei.badoiu@upb.ro>
---
 lib/ukboot/boot.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/lib/ukboot/boot.c b/lib/ukboot/boot.c
index 4e749aa5..3e92812d 100644
--- a/lib/ukboot/boot.c
+++ b/lib/ukboot/boot.c
@@ -63,6 +63,9 @@
 #ifdef CONFIG_LIBUKLIBPARAM
 #include <uk/libparam.h>
 #endif /* CONFIG_LIBUKLIBPARAM */
+#if CONFIG_LIBUKSP
+#include <uk/sp.h>
+#endif
=20
 int main(int argc, char *argv[]) __weak;
=20
@@ -187,6 +190,14 @@ void ukplat_entry(int argc, char *argv[])
 	struct uk_sched *s =3D NULL;
 	struct uk_thread *main_thread =3D NULL;
 #endif
+
+	/* We use a macro because if we were to use a function we
+	 * would not be able to return from the function if we have
+	 * changed the stack protector inside the function */
+#if CONFIG_LIBUKSP
+	UKSP_INIT_CANARY();
+#endif
+
 	uk_ctor_func_t *ctorfn;
=20
 	uk_pr_info("Unikraft constructor table at %p - %p\n",
--=20
2.25.1



From minios-devel-bounces@lists.xenproject.org Mon Aug 03 14:06:24 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Mon, 03 Aug 2020 14:06:24 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1k2b6e-0000iv-DA; Mon, 03 Aug 2020 14:06:24 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=PJxW=BN=upb.ro=vlad_andrei.badoiu@srs-us1.protection.inumbo.net>)
 id 1k2b6c-0000h2-Vj
 for minios-devel@lists.xen.org; Mon, 03 Aug 2020 14:06:23 +0000
X-Inumbo-ID: 7aa49ee8-d592-11ea-9092-bc764e2007e4
Received: from mx.upb.ro (unknown [141.85.13.200])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 7aa49ee8-d592-11ea-9092-bc764e2007e4;
 Mon, 03 Aug 2020 14:06:09 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
 by mx.upb.ro (Postfix) with ESMTP id 46B36B561C89;
 Mon,  3 Aug 2020 17:06:08 +0300 (EEST)
Received: from mx.upb.ro ([127.0.0.1])
 by localhost (mx.upb.ro [127.0.0.1]) (amavisd-new, port 10032)
 with ESMTP id j7jQpfPxiEkx; Mon,  3 Aug 2020 17:06:06 +0300 (EEST)
Received: from localhost (localhost [127.0.0.1])
 by mx.upb.ro (Postfix) with ESMTP id 1FB4AB561CBD;
 Mon,  3 Aug 2020 17:06:06 +0300 (EEST)
DKIM-Filter: OpenDKIM Filter v2.10.3 mx.upb.ro 1FB4AB561CBD
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=upb.ro;
 s=96342B8A-77E4-11E5-BA93-D93D0963A2DF; t=1596463566;
 bh=0UHdbNLkuL7C7oP0ecprFtzDsrPa+tjc+1wZyVjXV3U=;
 h=From:To:Date:Message-Id:MIME-Version;
 b=U8jVL0gQjGRj2G4UbSH+Zwhsq1JBx0iEV8GAk3UMvEXy75S98tfr9Rup5c1ETf1sR
 jQz88gzlRntU/RwcCG4+9hGYYuZXnYiusKgkJHnlyT3u8nf8GR8YR7V8CQmfvS3JOH
 sz/vo34LDHwp9NBu6NlN3fob1LpnI/bMd3suVAWI=
X-Virus-Scanned: amavisd-new at upb.ro
Received: from mx.upb.ro ([127.0.0.1])
 by localhost (mx.upb.ro [127.0.0.1]) (amavisd-new, port 10026)
 with ESMTP id wktP_ejoOrGG; Mon,  3 Aug 2020 17:06:05 +0300 (EEST)
Received: from localhost.localdomain (unknown [188.25.55.184])
 by mx.upb.ro (Postfix) with ESMTPSA id ACA7BB561A48;
 Mon,  3 Aug 2020 17:06:05 +0300 (EEST)
From: Vlad-Andrei Badoiu <vlad_andrei.badoiu@upb.ro>
To: minios-devel@lists.xen.org
Subject: [UNIKRAFT PATCH v6 0/3] lib/uksp: Introduce uksp library
Date: Mon,  3 Aug 2020 16:58:32 +0300
Message-Id: <20200803135836.10392-1-vlad_andrei.badoiu@upb.ro>
X-Mailer: git-send-email 2.25.1
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
X-BeenThere: minios-devel@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Mini-os development list <minios-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:minios-devel@lists.xenproject.org>
List-Help: <mailto:minios-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=subscribe>
Cc: simon.kuenzer@neclab.eu, alicesuiu17@gmail.com,
 Vlad-Andrei Badoiu <vlad_andrei.badoiu@upb.ro>
Errors-To: minios-devel-bounces@lists.xenproject.org
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>

Currently, we provide a basic implementation of stack smashing
protection that has a global value for all threads. The value
can be either be randomly initialized at boot or precompiled.

Changes since v1:
* We now use a choice based config option for the stack protector level.
* Since
the last version we added the regulat and strong stack protector
options.

Changes since v2:
* Renamed the library to uksp

Changes since v3:
* Added config option for constant value/random source for the canary.
* Updated the config
* Updated library title
* Moved uksp/stackprotector.h to uk/sp.h
* Added current stack pointer to the crash message


Changes since v4:
* rebased over staging
* removed STACKPROTECTOR_NONE
* removed type on license
* __stack_chk_guard is now a const, we use the DECONST macro to change
its value
* renamed INIT_STACK_CANARY to UKSP_INIT_CANARY
* ukarch_read_sp() is now used to get the sp
* fixed several typos
* moved makefile build flags to patch 1
* added added a comment on why do we use a macro for initialization

Changes since v5:
* Rebased on staging
* Added guards when including swrand.h

Vlad-Andrei B=C4=82DOIU (78692) (3):
  lib/uksp: Introduce uksp library
  build: Add option to toggle the stack protection
  lib/ukboot: Initialize the canary value at boot

 Makefile.uk              |  5 +++-
 lib/Makefile.uk          |  1 +
 lib/ukboot/boot.c        | 11 ++++++++
 lib/uksp/Config.uk       | 46 +++++++++++++++++++++++++++++++
 lib/uksp/Makefile.uk     |  9 +++++++
 lib/uksp/exportsyms.uk   |  2 ++
 lib/uksp/include/uk/sp.h | 58 ++++++++++++++++++++++++++++++++++++++++
 lib/uksp/ssp.c           | 51 +++++++++++++++++++++++++++++++++++
 8 files changed, 182 insertions(+), 1 deletion(-)
 create mode 100644 lib/uksp/Config.uk
 create mode 100644 lib/uksp/Makefile.uk
 create mode 100644 lib/uksp/exportsyms.uk
 create mode 100644 lib/uksp/include/uk/sp.h
 create mode 100644 lib/uksp/ssp.c

--=20
2.25.1



From minios-devel-bounces@lists.xenproject.org Mon Aug 03 14:06:29 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Mon, 03 Aug 2020 14:06:29 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1k2b6j-0000jp-Ey; Mon, 03 Aug 2020 14:06:29 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=PJxW=BN=upb.ro=vlad_andrei.badoiu@srs-us1.protection.inumbo.net>)
 id 1k2b6h-0000h2-Vv
 for minios-devel@lists.xen.org; Mon, 03 Aug 2020 14:06:28 +0000
X-Inumbo-ID: 7b379aae-d592-11ea-9092-bc764e2007e4
Received: from mx.upb.ro (unknown [141.85.13.230])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 7b379aae-d592-11ea-9092-bc764e2007e4;
 Mon, 03 Aug 2020 14:06:10 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
 by mx.upb.ro (Postfix) with ESMTP id 7F1AFB561A48;
 Mon,  3 Aug 2020 17:06:09 +0300 (EEST)
Received: from mx.upb.ro ([127.0.0.1])
 by localhost (mx.upb.ro [127.0.0.1]) (amavisd-new, port 10032)
 with ESMTP id KNALWecOIwiG; Mon,  3 Aug 2020 17:06:06 +0300 (EEST)
Received: from localhost (localhost [127.0.0.1])
 by mx.upb.ro (Postfix) with ESMTP id 710DAB561CBF;
 Mon,  3 Aug 2020 17:06:06 +0300 (EEST)
DKIM-Filter: OpenDKIM Filter v2.10.3 mx.upb.ro 710DAB561CBF
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=upb.ro;
 s=96342B8A-77E4-11E5-BA93-D93D0963A2DF; t=1596463566;
 bh=ValmE49TsMnsVGhs2X3BPGyqsf3Tu74LYeXBSioDZQA=;
 h=From:To:Date:Message-Id:MIME-Version;
 b=Hr/6l3ltyu3BEAdpMWp88krgvEBzuHSLLAgWcHDSjJrXR7RVgwFGptKFQI0M2vCpz
 l2lWv192/Ry9Aey+v52X2QRnKQRsgH1sCkngn/Zw93PQFPNn11PPwYG32jPeg+Dpcw
 OP4fOdUoNuYBUboJUQNmFIg9ywP430KHZn4XWTlI=
X-Virus-Scanned: amavisd-new at upb.ro
Received: from mx.upb.ro ([127.0.0.1])
 by localhost (mx.upb.ro [127.0.0.1]) (amavisd-new, port 10026)
 with ESMTP id Nd91YoTmW72K; Mon,  3 Aug 2020 17:06:06 +0300 (EEST)
Received: from localhost.localdomain (unknown [188.25.55.184])
 by mx.upb.ro (Postfix) with ESMTPSA id 0D2D7B561C89;
 Mon,  3 Aug 2020 17:06:05 +0300 (EEST)
From: Vlad-Andrei Badoiu <vlad_andrei.badoiu@upb.ro>
To: minios-devel@lists.xen.org
Subject: [UNIKRAFT PATCH v6 1/3] lib/uksp: Introduce uksp library
Date: Mon,  3 Aug 2020 16:58:33 +0300
Message-Id: <20200803135836.10392-2-vlad_andrei.badoiu@upb.ro>
X-Mailer: git-send-email 2.25.1
In-Reply-To: <20200803135836.10392-1-vlad_andrei.badoiu@upb.ro>
References: <20200803135836.10392-1-vlad_andrei.badoiu@upb.ro>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
X-BeenThere: minios-devel@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Mini-os development list <minios-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:minios-devel@lists.xenproject.org>
List-Help: <mailto:minios-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=subscribe>
Cc: =?UTF-8?q?Vlad-Andrei=20B=C4=82DOIU=20=2878692=29?=
 <vlad_andrei.badoiu@stud.acs.upb.ro>, simon.kuenzer@neclab.eu,
 alicesuiu17@gmail.com, Vlad-Andrei Badoiu <vlad_andrei.badoiu@upb.ro>
Errors-To: minios-devel-bounces@lists.xenproject.org
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>

From: Vlad-Andrei B=C4=82DOIU (78692) <vlad_andrei.badoiu@stud.acs.upb.ro=
>

This library provides the necessary functionalities for the stack
protector.

A make clean is required when toggling the stack smashing protection
option.

Signed-off-by: Vlad-Andrei Badoiu <vlad_andrei.badoiu@stud.acs.upb.ro>
Signed-off-by: Vlad-Andrei Badoiu <vlad_andrei.badoiu@upb.ro>
---
 lib/Makefile.uk          |  1 +
 lib/uksp/Config.uk       | 46 +++++++++++++++++++++++++++++++
 lib/uksp/Makefile.uk     |  9 +++++++
 lib/uksp/exportsyms.uk   |  2 ++
 lib/uksp/include/uk/sp.h | 58 ++++++++++++++++++++++++++++++++++++++++
 lib/uksp/ssp.c           | 51 +++++++++++++++++++++++++++++++++++
 6 files changed, 167 insertions(+)
 create mode 100644 lib/uksp/Config.uk
 create mode 100644 lib/uksp/Makefile.uk
 create mode 100644 lib/uksp/exportsyms.uk
 create mode 100644 lib/uksp/include/uk/sp.h
 create mode 100644 lib/uksp/ssp.c

diff --git a/lib/Makefile.uk b/lib/Makefile.uk
index 9261533c..07e8a295 100644
--- a/lib/Makefile.uk
+++ b/lib/Makefile.uk
@@ -36,3 +36,4 @@ $(eval $(call _import_lib,$(CONFIG_UK_BASE)/lib/uktime)=
)
 $(eval $(call _import_lib,$(CONFIG_UK_BASE)/lib/ukmmap))
 $(eval $(call _import_lib,$(CONFIG_UK_BASE)/lib/ukblkdev))
 $(eval $(call _import_lib,$(CONFIG_UK_BASE)/lib/posix-process))
+$(eval $(call _import_lib,$(CONFIG_UK_BASE)/lib/uksp))
diff --git a/lib/uksp/Config.uk b/lib/uksp/Config.uk
new file mode 100644
index 00000000..0881ddec
--- /dev/null
+++ b/lib/uksp/Config.uk
@@ -0,0 +1,46 @@
+config LIBUKSP
+	bool "uksp: Stack protector"
+	select HAVE_STACKPROTECTOR
+	default n
+
+if LIBUKSP
+choice
+	prompt "Stack protector level"
+	default STACKPROTECTOR_REGULAR
+	help
+	  Set the stack protector level
+
+config STACKPROTECTOR_REGULAR
+	bool "Regular"
+	help
+		Regular stack protector, use -fstack-protector.
+
+config STACKPROTECTOR_STRONG
+	bool "Strong"
+	help
+		Strong stack protector, use -fstack-protector-strong.
+
+config STACKPROTECTOR_ALL
+	bool "All"
+	help
+		Protect all functions, use -fstack-protector-all.
+endchoice
+
+choice
+	prompt "Canary Value"
+	default LIBUKSP_VALUE_USECONSTANT
+
+config LIBUKSP_VALUE_USECONSTANT
+	bool "Compiled-in constant"
+
+config LIBUKSP_VALUE_RANDOM
+	bool "Random variable"
+	select LIBUKSWRAND
+endchoice
+
+config LIBUKSP_VALUE_CONSTANT
+	int "Canary value"
+	depends on LIBUKSP_VALUE_USECONSTANT
+	default 42
+
+endif
diff --git a/lib/uksp/Makefile.uk b/lib/uksp/Makefile.uk
new file mode 100644
index 00000000..4e591231
--- /dev/null
+++ b/lib/uksp/Makefile.uk
@@ -0,0 +1,9 @@
+$(eval $(call addlib_s,libuksp,$(CONFIG_LIBUKSP)))
+
+CINCLUDES-y +=3D -I$(LIBUKSP_BASE)/include
+
+LIBUKSP_SRCS-y +=3D $(LIBUKSP_BASE)/ssp.c
+
+COMPFLAGS-$(CONFIG_STACKPROTECTOR_REGULAR)	+=3D -fstack-protector -mstac=
k-protector-guard=3Dglobal
+COMPFLAGS-$(CONFIG_STACKPROTECTOR_STRONG)	+=3D -fstack-protector-strong =
-mstack-protector-guard=3Dglobal
+COMPFLAGS-$(CONFIG_STACKPROTECTOR_ALL)		+=3D -fstack-protector-all -msta=
ck-protector-guard=3Dglobal
diff --git a/lib/uksp/exportsyms.uk b/lib/uksp/exportsyms.uk
new file mode 100644
index 00000000..fbc319e7
--- /dev/null
+++ b/lib/uksp/exportsyms.uk
@@ -0,0 +1,2 @@
+__stack_chk_fail
+__stack_chk_guard
diff --git a/lib/uksp/include/uk/sp.h b/lib/uksp/include/uk/sp.h
new file mode 100644
index 00000000..ab8b4177
--- /dev/null
+++ b/lib/uksp/include/uk/sp.h
@@ -0,0 +1,58 @@
+/* SPDX-License-Identifier: BSD-3-Clause */
+/*
+ * Authors: Vlad-Andrei Badoiu <vlad_andrei.badoiu@stud.acs.upb.ro>
+ *
+ * Copyright (c) 2019, University Politehnica of Bucharest. All rights r=
eserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in th=
e
+ *    documentation and/or other materials provided with the distributio=
n.
+ * 3. Neither the name of the copyright holder nor the names of its
+ *    contributors may be used to endorse or promote products derived fr=
om
+ *    this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "=
AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,=
 THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PU=
RPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTOR=
S BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSIN=
ESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER =
IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWIS=
E)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED O=
F THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef __UK_STACKPROTECTOR_H__
+#define __UK_STACKPROTECTOR_H__
+
+#ifdef CONFIG_LIBUKSP_VALUE_RANDOM
+#include <uk/swrand.h>
+#endif
+#include <uk/config.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+extern const unsigned long __stack_chk_guard;
+
+#ifdef CONFIG_LIBUKSP_VALUE_RANDOM
+#define UKSP_INIT_CANARY() (*(DECONST(unsigned long *, &__stack_chk_guar=
d)) \
+		=3D uk_swrand_randr())
+#else
+#define UKSP_INIT_CANARY()
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __UK_STACKPROTECTOR_H__ */
diff --git a/lib/uksp/ssp.c b/lib/uksp/ssp.c
new file mode 100644
index 00000000..8a847f5c
--- /dev/null
+++ b/lib/uksp/ssp.c
@@ -0,0 +1,51 @@
+/* SPDX-License-Identifier: BSD-3-Clause */
+/*
+ * Authors: Badoiu Vlad-Andrei <vlad_andrei.badoiu@stud.acs.upb.ro>
+ *
+ * Copyright (c) 2019, University Politehnica of Bucharest. All rights r=
eserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in th=
e
+ *    documentation and/or other materials provided with the distributio=
n.
+ * 3. Neither the name of the copyright holder nor the names of its
+ *    contributors may be used to endorse or promote products derived fr=
om
+ *    this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "=
AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,=
 THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PU=
RPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTOR=
S BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSIN=
ESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER =
IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWIS=
E)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED O=
F THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <uk/assert.h>
+#include <uk/config.h>
+#include <uk/ctors.h>
+#include <uk/thread.h>
+
+#ifdef CONFIG_LIBUKSP_VALUE_USECONSTANT
+const unsigned long __stack_chk_guard =3D CONFIG_LIBUKSP_VALUE_CONSTANT;
+#else
+const unsigned long __stack_chk_guard =3D 0xDEADBEEF;
+#endif
+
+__attribute__((noreturn))
+void __stack_chk_fail(void)
+{
+	unsigned long sp;
+
+	sp =3D ukarch_read_sp() & STACK_MASK_TOP;
+	UK_CRASH("Stack smashing detected. SP %p\n", (void *) sp);
+}
--=20
2.25.1



From minios-devel-bounces@lists.xenproject.org Mon Aug 03 16:25:37 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Mon, 03 Aug 2020 16:25:37 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1k2dHK-0005zo-M7; Mon, 03 Aug 2020 16:25:34 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <SRS0=W0W1=BN=owl.eu.com=hle@srs-us1.protection.inumbo.net>)
 id 1k2dHJ-0005zj-Ix
 for minios-devel@lists.xenproject.org; Mon, 03 Aug 2020 16:25:33 +0000
X-Inumbo-ID: f240a344-d5a5-11ea-90aa-bc764e2007e4
Received: from relay1-d.mail.gandi.net (unknown [217.70.183.193])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id f240a344-d5a5-11ea-90aa-bc764e2007e4;
 Mon, 03 Aug 2020 16:25:30 +0000 (UTC)
X-Originating-IP: 141.70.45.131
Received: from localhost (hadi-gate-vlan-851.hadiko.whka.de [141.70.45.131])
 (Authenticated sender: hle@owl.eu.com)
 by relay1-d.mail.gandi.net (Postfix) with ESMTPSA id 0FE38240004;
 Mon,  3 Aug 2020 16:25:28 +0000 (UTC)
From: Hugo Lefeuvre <hle@owl.eu.com>
To: minios-devel@lists.xenproject.org
Subject: [UNIKRAFT PATCH v3] lib/ukalloc: add ifmalloc compatibility interface
Date: Mon,  3 Aug 2020 18:25:24 +0200
Message-Id: <20200803162524.225134-1-hle@owl.eu.com>
X-Mailer: git-send-email 2.27.0
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-BeenThere: minios-devel@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Mini-os development list <minios-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:minios-devel@lists.xenproject.org>
List-Help: <mailto:minios-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=subscribe>
Cc: Hugo Lefeuvre <hle@owl.eu.com>
Errors-To: minios-devel-bounces@lists.xenproject.org
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>

Add ifmalloc, the malloc compatibility interface. This interface
implements a POSIX compliant allocation interface on top of a simple
malloc() and free() interface. This interface is similar to ifpages,
which does the same for palloc() and pfree().

ifmalloc will be used for the port of TLSF and tinyalloc which do not
support (posix_)memalign().

In order to keep implementations consistent, this patch also addresses
a bug in uk_posix_memalign_ifpages() which did not handle size = 0
correctly. The function previously returned an error code and set
memptr to NULL, but POSIX allows only one of the two.  Both
implementations now return EINVAL and leave memptr untouched.

Signed-off-by: Hugo Lefeuvre <hle@owl.eu.com>
---
Changes since v2:
 - keep memptr untouched on size = 0 in uk_posix_memalign_if{malloc,pages}
 - return ENOMEM instead of NULL on overflow in uk_posix_memalign_ifmalloc
 - minor style changes to make checkpatch.pl happy

 lib/ukalloc/Config.uk               |   5 +
 lib/ukalloc/alloc.c                 | 154 +++++++++++++++++++++++++++-
 lib/ukalloc/exportsyms.uk           |   4 +
 lib/ukalloc/include/uk/alloc.h      |   5 +
 lib/ukalloc/include/uk/alloc_impl.h |  27 +++++
 5 files changed, 191 insertions(+), 4 deletions(-)

diff --git a/lib/ukalloc/Config.uk b/lib/ukalloc/Config.uk
index 0de7464..c965d08 100644
--- a/lib/ukalloc/Config.uk
+++ b/lib/ukalloc/Config.uk
@@ -5,6 +5,11 @@ menuconfig LIBUKALLOC
 	select LIBUKDEBUG
 
 if LIBUKALLOC
+	config LIBUKALLOC_IFMALLOC
+		bool "Malloc compatibility interface"
+		default n
+		help
+			Provide helpers for allocators defining exclusively malloc and free
 	config LIBUKALLOC_IFSTATS
 		bool "Statistics interface"
 		default n
diff --git a/lib/ukalloc/alloc.c b/lib/ukalloc/alloc.c
index 127bc6f..7cdba5e 100644
--- a/lib/ukalloc/alloc.c
+++ b/lib/ukalloc/alloc.c
@@ -1,8 +1,10 @@
 /* SPDX-License-Identifier: BSD-3-Clause */
 /*
  * Authors: Florian Schmidt <florian.schmidt@neclab.eu>
+ *          Hugo Lefeuvre <hugo.lefeuvre@neclab.eu>
  *
- * Copyright (c) 2017, NEC Europe Ltd., NEC Corporation. All rights reserved.
+ * Copyright (c) 2017-2020, NEC Laboratories Europe GmbH, NEC Corporation,
+ *                          All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -28,8 +30,6 @@
  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  * POSSIBILITY OF SUCH DAMAGE.
- *
- * THIS HEADER MAY NOT BE EXTRACTED OR MODIFIED IN ANY WAY.
  */
 
 /* This is a very simple, naive implementation of malloc.
@@ -52,6 +52,7 @@
 #include <uk/essentials.h>
 #include <uk/assert.h>
 #include <uk/arch/limits.h>
+#include <uk/arch/lcpu.h>
 
 #define size_to_num_pages(size) \
 	(ALIGN_UP((unsigned long)(size), __PAGE_SIZE) / __PAGE_SIZE)
@@ -206,8 +207,12 @@ int uk_posix_memalign_ifpages(struct uk_alloc *a,
 	    || (align % sizeof(void *)) != 0)
 		return EINVAL;
 
+	/* According to POSIX, calling posix_memalign with a size of zero can
+	 * be handled by (1) setting memptr to NULL and returning 0 (success),
+	 * OR (2) leaving memptr untouched and returning an error code. We
+	 * implement (2).
+	 */
 	if (!size) {
-		*memptr = NULL;
 		return EINVAL;
 	}
 
@@ -267,6 +272,147 @@ int uk_posix_memalign_ifpages(struct uk_alloc *a,
 	return 0;
 }
 
+#if CONFIG_LIBUKALLOC_IFMALLOC
+
+struct metadata_ifmalloc {
+	size_t	size;
+	void	*base;
+};
+
+#define METADATA_IFMALLOC_SIZE_POW2 16
+UK_CTASSERT(!(sizeof(struct metadata_ifmalloc) > METADATA_IFMALLOC_SIZE_POW2));
+
+static struct metadata_ifmalloc *uk_get_metadata_ifmalloc(const void *ptr)
+{
+	return (struct metadata_ifmalloc *)((uintptr_t) ptr -
+		METADATA_IFMALLOC_SIZE_POW2);
+}
+
+static size_t uk_getmallocsize_ifmalloc(const void *ptr)
+{
+	struct metadata_ifmalloc *metadata = uk_get_metadata_ifmalloc(ptr);
+
+	return (size_t) ((uintptr_t) metadata->base + metadata->size -
+			 (uintptr_t) ptr);
+}
+
+void uk_free_ifmalloc(struct uk_alloc *a, void *ptr)
+{
+	struct metadata_ifmalloc *metadata;
+
+	UK_ASSERT(a);
+	UK_ASSERT(a->free_backend);
+	if (!ptr)
+		return;
+
+	metadata = uk_get_metadata_ifmalloc(ptr);
+	a->free_backend(a, metadata->base);
+}
+
+void *uk_malloc_ifmalloc(struct uk_alloc *a, size_t size)
+{
+	struct metadata_ifmalloc *metadata;
+	size_t realsize = size + METADATA_IFMALLOC_SIZE_POW2;
+	void *ptr;
+
+	UK_ASSERT(a);
+	UK_ASSERT(a->malloc_backend);
+
+	/* check for overflow */
+	if (unlikely(realsize < size))
+		return NULL;
+
+	ptr = a->malloc_backend(a, realsize);
+	if (!ptr)
+		return NULL;
+
+	metadata = ptr;
+	metadata->size = realsize;
+	metadata->base = ptr;
+
+	return (void *) ((uintptr_t) ptr + METADATA_IFMALLOC_SIZE_POW2);
+}
+
+void *uk_realloc_ifmalloc(struct uk_alloc *a, void *ptr, size_t size)
+{
+	void *retptr;
+	size_t mallocsize;
+
+	UK_ASSERT(a);
+	if (!ptr)
+		return uk_malloc_ifmalloc(a, size);
+
+	if (ptr && !size) {
+		uk_free_ifmalloc(a, ptr);
+		return NULL;
+	}
+
+	retptr = uk_malloc_ifmalloc(a, size);
+	if (!retptr)
+		return NULL;
+
+	mallocsize = uk_getmallocsize_ifmalloc(ptr);
+
+	memcpy(retptr, ptr, MIN(size, mallocsize));
+
+	uk_free_ifmalloc(a, ptr);
+	return retptr;
+}
+
+int uk_posix_memalign_ifmalloc(struct uk_alloc *a,
+				     void **memptr, size_t align, size_t size)
+{
+	struct metadata_ifmalloc *metadata;
+	size_t realsize, padding;
+	uintptr_t intptr;
+
+	UK_ASSERT(a);
+	if (((align - 1) & align) != 0
+	    || align < sizeof(void *))
+		return EINVAL;
+
+	/* Leave memptr untouched. See comment in uk_posix_memalign_ifpages. */
+	if (!size)
+		return EINVAL;
+
+	/* Store size information preceding the memory block. Since we return
+	 * pointers aligned at `align` we need to reserve at least that much
+	 * space for the size information.
+	 */
+	if (align < METADATA_IFMALLOC_SIZE_POW2) {
+		align = METADATA_IFMALLOC_SIZE_POW2;
+		padding = 0;
+	} else {
+		padding = METADATA_IFMALLOC_SIZE_POW2;
+	}
+
+	realsize = size + padding + align;
+
+	/* check for overflow */
+	if (unlikely(realsize < size))
+		return ENOMEM;
+
+	intptr = (uintptr_t) a->malloc_backend(a, realsize);
+
+	if (!intptr)
+		return ENOMEM;
+
+	*memptr = (void *) ALIGN_UP(intptr + METADATA_IFMALLOC_SIZE_POW2,
+				    (uintptr_t) align);
+
+	metadata = uk_get_metadata_ifmalloc(*memptr);
+
+	/* check for underflow */
+	UK_ASSERT(intptr <= (uintptr_t) metadata);
+
+	metadata->size = realsize;
+	metadata->base = (void *) intptr;
+
+	return 0;
+}
+
+#endif
+
 void uk_pfree_compat(struct uk_alloc *a, void *ptr,
 		     unsigned long num_pages __unused)
 {
diff --git a/lib/ukalloc/exportsyms.uk b/lib/ukalloc/exportsyms.uk
index 2c8a90f..21c1996 100644
--- a/lib/ukalloc/exportsyms.uk
+++ b/lib/ukalloc/exportsyms.uk
@@ -4,6 +4,10 @@ uk_malloc_ifpages
 uk_free_ifpages
 uk_realloc_ifpages
 uk_posix_memalign_ifpages
+uk_malloc_ifmalloc
+uk_realloc_ifmalloc
+uk_posix_memalign_ifmalloc
+uk_free_ifmalloc
 uk_calloc_compat
 uk_memalign_compat
 uk_realloc_compat
diff --git a/lib/ukalloc/include/uk/alloc.h b/lib/ukalloc/include/uk/alloc.h
index 5bfa2f2..1457922 100644
--- a/lib/ukalloc/include/uk/alloc.h
+++ b/lib/ukalloc/include/uk/alloc.h
@@ -85,6 +85,11 @@ struct uk_alloc {
 	uk_alloc_memalign_func_t memalign;
 	uk_alloc_free_func_t free;
 
+#if CONFIG_LIBUKALLOC_IFMALLOC
+	uk_alloc_free_func_t free_backend;
+	uk_alloc_malloc_func_t malloc_backend;
+#endif
+
 	/* page allocation interface */
 	uk_alloc_palloc_func_t palloc;
 	uk_alloc_pfree_func_t pfree;
diff --git a/lib/ukalloc/include/uk/alloc_impl.h b/lib/ukalloc/include/uk/alloc_impl.h
index 8bcca94..b15f49e 100644
--- a/lib/ukalloc/include/uk/alloc_impl.h
+++ b/lib/ukalloc/include/uk/alloc_impl.h
@@ -62,6 +62,14 @@ int uk_posix_memalign_ifpages(struct uk_alloc *a, void **memptr,
 				size_t align, size_t size);
 void uk_free_ifpages(struct uk_alloc *a, void *ptr);
 
+#if CONFIG_LIBUKALLOC_IFMALLOC
+void *uk_malloc_ifmalloc(struct uk_alloc *a, size_t size);
+void *uk_realloc_ifmalloc(struct uk_alloc *a, void *ptr, size_t size);
+int uk_posix_memalign_ifmalloc(struct uk_alloc *a, void **memptr,
+				     size_t align, size_t size);
+void uk_free_ifmalloc(struct uk_alloc *a, void *ptr);
+#endif
+
 /* Functionality that is provided based on malloc() and posix_memalign() */
 void *uk_calloc_compat(struct uk_alloc *a, size_t num, size_t len);
 void *uk_realloc_compat(struct uk_alloc *a, void *ptr, size_t size);
@@ -88,6 +96,25 @@ void uk_pfree_compat(struct uk_alloc *a, void *ptr, unsigned long num_pages);
 		uk_alloc_register((a));					\
 	} while (0)
 
+#if CONFIG_LIBUKALLOC_IFMALLOC
+#define uk_alloc_init_malloc_ifmalloc(a, malloc_f, free_f, addmem_f) 	\
+	do {								\
+		(a)->malloc         = uk_malloc_ifmalloc;		\
+		(a)->calloc         = uk_calloc_compat;			\
+		(a)->realloc        = uk_realloc_ifmalloc;		\
+		(a)->posix_memalign = uk_posix_memalign_ifmalloc;	\
+		(a)->memalign       = uk_memalign_compat;		\
+		(a)->malloc_backend = (malloc_f);			\
+		(a)->free_backend   = (free_f);				\
+		(a)->free           = uk_free_ifmalloc;			\
+		(a)->palloc         = uk_palloc_compat;			\
+		(a)->pfree          = uk_pfree_compat;			\
+		(a)->addmem         = (addmem_f);			\
+									\
+		uk_alloc_register((a));					\
+	} while (0)
+#endif
+
 /* Shortcut for doing a registration of an allocator that only
  * implements palloc(), pfree(), addmem()
  */
-- 
2.27.0



From minios-devel-bounces@lists.xenproject.org Tue Aug 04 08:14:08 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Tue, 04 Aug 2020 08:14:08 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1k2s5F-00047N-Tm; Tue, 04 Aug 2020 08:14:05 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=PwQf=BO=gmail.com=alicesuiu17@srs-us1.protection.inumbo.net>)
 id 1k2s5F-00047I-4Y
 for minios-devel@lists.xen.org; Tue, 04 Aug 2020 08:14:05 +0000
X-Inumbo-ID: 75251676-d62a-11ea-9137-bc764e2007e4
Received: from mail-vs1-xe43.google.com (unknown [2607:f8b0:4864:20::e43])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 75251676-d62a-11ea-9137-bc764e2007e4;
 Tue, 04 Aug 2020 08:14:03 +0000 (UTC)
Received: by mail-vs1-xe43.google.com with SMTP id n25so6967880vsq.6
 for <minios-devel@lists.xen.org>; Tue, 04 Aug 2020 01:14:03 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=mime-version:references:in-reply-to:from:date:message-id:subject:to
 :cc; bh=9e9L8htdybsZ+GoNEwbifGvppbFwYwOEU1hzyduodHA=;
 b=pD8CxXvCDY+y5sN7CBvCndCnv7XnWH6tvdP2lU+VsBTMOuikVqbl8VhwQ6svDprBrA
 YlXuJmnRv0jBXbNFi/i9BFS5tCyY0xCH1HO5SsLarDD/+7EdTdtZjJGfQ2V0JpfzGSCV
 92BSni+k4Uf4rKt9HftB+rd4BfxkuZjlJUw1PEj1/7KzBwr5JvluSAE3y/OYyKl1QeVz
 WZwf/Imr5uP0r+3x3zP0BqZSuPGwrVLShN4diDbZb3fatP0CRUz35xQU5uhyFvMLoeB2
 qFVy+IiPBW2nvs/SZcKcWtdyD5gNBOw7oDBj7HiAHpPy+B2Hz+/QqJ9Ek2q7cafi6Snp
 JEjA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:mime-version:references:in-reply-to:from:date
 :message-id:subject:to:cc;
 bh=9e9L8htdybsZ+GoNEwbifGvppbFwYwOEU1hzyduodHA=;
 b=OAEVx4y1ZNcangcDy3BULfW7WyRdZwacWFPC3jVWJJUdKErHdoveu1PGxqteRPR/M3
 3WC/ykSXKjYdY0XDzLy55d7UHiaJnZBHI0UsHCjrAlRhJFgIu1t+aNxOmntXMzDgRYmD
 a+dMhAWG5tbeam+L0+XL/mYrnaYhC3BTLHhcPswegl80LxePUIcvl8n353qryYbrK4hI
 KVliGHqptqaa1i/Rqi4r296Ht87YyhaTXR3NcLAd7xcB6ydzbDkkJHHgAtx7q/akLuad
 nxcDaIGpnvOUmCVENMQtJzTzD/kOgEB0vv5gNT046uYqzmcAGpBz5fepvEJ3MitBMCbu
 XjyA==
X-Gm-Message-State: AOAM532MNkk5EVbyyKCzoHnK6hFpmgcz3Z0fxd+plpYsEOrJu5K/n+UT
 92dFMGXzfQ/TIrTJxxJGYJVAE+aJMHTU7ezV49Y=
X-Google-Smtp-Source: ABdhPJw/QTXU7ZbCkEf5y/MOho5I2VGNxWckXoxfRqD+yZ9usIlorHyk5GvNFH4gqus07imZQZe1rHXZj2JSaodb99s=
X-Received: by 2002:a67:8084:: with SMTP id
 b126mr14393756vsd.163.1596528842679; 
 Tue, 04 Aug 2020 01:14:02 -0700 (PDT)
MIME-Version: 1.0
References: <20200803135836.10392-1-vlad_andrei.badoiu@upb.ro>
 <20200803135836.10392-2-vlad_andrei.badoiu@upb.ro>
In-Reply-To: <20200803135836.10392-2-vlad_andrei.badoiu@upb.ro>
From: Alice Suiu <alicesuiu17@gmail.com>
Date: Tue, 4 Aug 2020 11:13:51 +0300
Message-ID: <CAD2TrnAPLZXqtn6a+y_Mu8gBsLexrtmk_A_Yy+J4OVvC1Yrz=g@mail.gmail.com>
Subject: Re: [UNIKRAFT PATCH v6 1/3] lib/uksp: Introduce uksp library
To: Vlad-Andrei Badoiu <vlad_andrei.badoiu@upb.ro>
Content-Type: multipart/alternative; boundary="0000000000008aa9f905ac08d693"
X-BeenThere: minios-devel@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Mini-os development list <minios-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:minios-devel@lists.xenproject.org>
List-Help: <mailto:minios-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=subscribe>
Cc: =?UTF-8?B?VmxhZC1BbmRyZWkgQsSCRE9JVSAoNzg2OTIp?=
 <vlad_andrei.badoiu@stud.acs.upb.ro>, Simon Kuenzer <simon.kuenzer@neclab.eu>,
 minios-devel@lists.xen.org
Errors-To: minios-devel-bounces@lists.xenproject.org
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>

--0000000000008aa9f905ac08d693
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

Reviewed-by: Alice Suiu <alicesuiu17@gmail.com> <alicesuiu17@gmail.com>

=C3=8En lun., 3 aug. 2020 la 17:06, Vlad-Andrei Badoiu <vlad_andrei.badoiu@=
upb.ro>
a scris:

> From: Vlad-Andrei B=C4=82DOIU (78692) <vlad_andrei.badoiu@stud.acs.upb.ro=
>
>
> This library provides the necessary functionalities for the stack
> protector.
>
> A make clean is required when toggling the stack smashing protection
> option.
>
> Signed-off-by: Vlad-Andrei Badoiu <vlad_andrei.badoiu@stud.acs.upb.ro>
> Signed-off-by: Vlad-Andrei Badoiu <vlad_andrei.badoiu@upb.ro>
> ---
>  lib/Makefile.uk          |  1 +
>  lib/uksp/Config.uk       | 46 +++++++++++++++++++++++++++++++
>  lib/uksp/Makefile.uk     |  9 +++++++
>  lib/uksp/exportsyms.uk   |  2 ++
>  lib/uksp/include/uk/sp.h | 58 ++++++++++++++++++++++++++++++++++++++++
>  lib/uksp/ssp.c           | 51 +++++++++++++++++++++++++++++++++++
>  6 files changed, 167 insertions(+)
>  create mode 100644 lib/uksp/Config.uk
>  create mode 100644 lib/uksp/Makefile.uk
>  create mode 100644 lib/uksp/exportsyms.uk
>  create mode 100644 lib/uksp/include/uk/sp.h
>  create mode 100644 lib/uksp/ssp.c
>
> diff --git a/lib/Makefile.uk b/lib/Makefile.uk
> index 9261533c..07e8a295 100644
> --- a/lib/Makefile.uk
> +++ b/lib/Makefile.uk
> @@ -36,3 +36,4 @@ $(eval $(call _import_lib,$(CONFIG_UK_BASE)/lib/uktime)=
)
>  $(eval $(call _import_lib,$(CONFIG_UK_BASE)/lib/ukmmap))
>  $(eval $(call _import_lib,$(CONFIG_UK_BASE)/lib/ukblkdev))
>  $(eval $(call _import_lib,$(CONFIG_UK_BASE)/lib/posix-process))
> +$(eval $(call _import_lib,$(CONFIG_UK_BASE)/lib/uksp))
> diff --git a/lib/uksp/Config.uk b/lib/uksp/Config.uk
> new file mode 100644
> index 00000000..0881ddec
> --- /dev/null
> +++ b/lib/uksp/Config.uk
> @@ -0,0 +1,46 @@
> +config LIBUKSP
> +       bool "uksp: Stack protector"
> +       select HAVE_STACKPROTECTOR
> +       default n
> +
> +if LIBUKSP
> +choice
> +       prompt "Stack protector level"
> +       default STACKPROTECTOR_REGULAR
> +       help
> +         Set the stack protector level
> +
> +config STACKPROTECTOR_REGULAR
> +       bool "Regular"
> +       help
> +               Regular stack protector, use -fstack-protector.
> +
> +config STACKPROTECTOR_STRONG
> +       bool "Strong"
> +       help
> +               Strong stack protector, use -fstack-protector-strong.
> +
> +config STACKPROTECTOR_ALL
> +       bool "All"
> +       help
> +               Protect all functions, use -fstack-protector-all.
> +endchoice
> +
> +choice
> +       prompt "Canary Value"
> +       default LIBUKSP_VALUE_USECONSTANT
> +
> +config LIBUKSP_VALUE_USECONSTANT
> +       bool "Compiled-in constant"
> +
> +config LIBUKSP_VALUE_RANDOM
> +       bool "Random variable"
> +       select LIBUKSWRAND
> +endchoice
> +
> +config LIBUKSP_VALUE_CONSTANT
> +       int "Canary value"
> +       depends on LIBUKSP_VALUE_USECONSTANT
> +       default 42
> +
> +endif
> diff --git a/lib/uksp/Makefile.uk b/lib/uksp/Makefile.uk
> new file mode 100644
> index 00000000..4e591231
> --- /dev/null
> +++ b/lib/uksp/Makefile.uk
> @@ -0,0 +1,9 @@
> +$(eval $(call addlib_s,libuksp,$(CONFIG_LIBUKSP)))
> +
> +CINCLUDES-y +=3D -I$(LIBUKSP_BASE)/include
> +
> +LIBUKSP_SRCS-y +=3D $(LIBUKSP_BASE)/ssp.c
> +
> +COMPFLAGS-$(CONFIG_STACKPROTECTOR_REGULAR)     +=3D -fstack-protector
> -mstack-protector-guard=3Dglobal
> +COMPFLAGS-$(CONFIG_STACKPROTECTOR_STRONG)      +=3D
> -fstack-protector-strong -mstack-protector-guard=3Dglobal
> +COMPFLAGS-$(CONFIG_STACKPROTECTOR_ALL)         +=3D -fstack-protector-al=
l
> -mstack-protector-guard=3Dglobal
> diff --git a/lib/uksp/exportsyms.uk b/lib/uksp/exportsyms.uk
> new file mode 100644
> index 00000000..fbc319e7
> --- /dev/null
> +++ b/lib/uksp/exportsyms.uk
> @@ -0,0 +1,2 @@
> +__stack_chk_fail
> +__stack_chk_guard
> diff --git a/lib/uksp/include/uk/sp.h b/lib/uksp/include/uk/sp.h
> new file mode 100644
> index 00000000..ab8b4177
> --- /dev/null
> +++ b/lib/uksp/include/uk/sp.h
> @@ -0,0 +1,58 @@
> +/* SPDX-License-Identifier: BSD-3-Clause */
> +/*
> + * Authors: Vlad-Andrei Badoiu <vlad_andrei.badoiu@stud.acs.upb.ro>
> + *
> + * Copyright (c) 2019, University Politehnica of Bucharest. All rights
> reserved.
> + *
> + * Redistribution and use in source and binary forms, with or without
> + * modification, are permitted provided that the following conditions
> + * are met:
> + *
> + * 1. Redistributions of source code must retain the above copyright
> + *    notice, this list of conditions and the following disclaimer.
> + * 2. Redistributions in binary form must reproduce the above copyright
> + *    notice, this list of conditions and the following disclaimer in th=
e
> + *    documentation and/or other materials provided with the distributio=
n.
> + * 3. Neither the name of the copyright holder nor the names of its
> + *    contributors may be used to endorse or promote products derived fr=
om
> + *    this software without specific prior written permission.
> + *
> + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
> "AS IS"
> + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
> THE
> + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
> PURPOSE
> + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTOR=
S
> BE
> + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
> + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
> + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
> BUSINESS
> + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER =
IN
> + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWIS=
E)
> + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED O=
F
> THE
> + * POSSIBILITY OF SUCH DAMAGE.
> + */
> +
> +#ifndef __UK_STACKPROTECTOR_H__
> +#define __UK_STACKPROTECTOR_H__
> +
> +#ifdef CONFIG_LIBUKSP_VALUE_RANDOM
> +#include <uk/swrand.h>
> +#endif
> +#include <uk/config.h>
> +
> +#ifdef __cplusplus
> +extern "C" {
> +#endif
> +
> +extern const unsigned long __stack_chk_guard;
> +
> +#ifdef CONFIG_LIBUKSP_VALUE_RANDOM
> +#define UKSP_INIT_CANARY() (*(DECONST(unsigned long *,
> &__stack_chk_guard)) \
> +               =3D uk_swrand_randr())
> +#else
> +#define UKSP_INIT_CANARY()
> +#endif
> +
> +#ifdef __cplusplus
> +}
> +#endif
> +
> +#endif /* __UK_STACKPROTECTOR_H__ */
> diff --git a/lib/uksp/ssp.c b/lib/uksp/ssp.c
> new file mode 100644
> index 00000000..8a847f5c
> --- /dev/null
> +++ b/lib/uksp/ssp.c
> @@ -0,0 +1,51 @@
> +/* SPDX-License-Identifier: BSD-3-Clause */
> +/*
> + * Authors: Badoiu Vlad-Andrei <vlad_andrei.badoiu@stud.acs.upb.ro>
> + *
> + * Copyright (c) 2019, University Politehnica of Bucharest. All rights
> reserved.
> + *
> + * Redistribution and use in source and binary forms, with or without
> + * modification, are permitted provided that the following conditions
> + * are met:
> + *
> + * 1. Redistributions of source code must retain the above copyright
> + *    notice, this list of conditions and the following disclaimer.
> + * 2. Redistributions in binary form must reproduce the above copyright
> + *    notice, this list of conditions and the following disclaimer in th=
e
> + *    documentation and/or other materials provided with the distributio=
n.
> + * 3. Neither the name of the copyright holder nor the names of its
> + *    contributors may be used to endorse or promote products derived fr=
om
> + *    this software without specific prior written permission.
> + *
> + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
> "AS IS"
> + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
> THE
> + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
> PURPOSE
> + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTOR=
S
> BE
> + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
> + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
> + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
> BUSINESS
> + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER =
IN
> + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWIS=
E)
> + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED O=
F
> THE
> + * POSSIBILITY OF SUCH DAMAGE.
> + */
> +
> +#include <uk/assert.h>
> +#include <uk/config.h>
> +#include <uk/ctors.h>
> +#include <uk/thread.h>
> +
> +#ifdef CONFIG_LIBUKSP_VALUE_USECONSTANT
> +const unsigned long __stack_chk_guard =3D CONFIG_LIBUKSP_VALUE_CONSTANT;
> +#else
> +const unsigned long __stack_chk_guard =3D 0xDEADBEEF;
> +#endif
> +
> +__attribute__((noreturn))
> +void __stack_chk_fail(void)
> +{
> +       unsigned long sp;
> +
> +       sp =3D ukarch_read_sp() & STACK_MASK_TOP;
> +       UK_CRASH("Stack smashing detected. SP %p\n", (void *) sp);
> +}
> --
> 2.25.1
>
>

--0000000000008aa9f905ac08d693
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">Reviewed-by: Alice Suiu <a href=3D"mailto:alicesuiu17@gmai=
l.com" target=3D"_blank">&lt;alicesuiu17@gmail.com&gt;</a></div><br><div cl=
ass=3D"gmail_quote"><div dir=3D"ltr" class=3D"gmail_attr">=C3=8En lun., 3 a=
ug. 2020 la 17:06, Vlad-Andrei Badoiu &lt;<a href=3D"mailto:vlad_andrei.bad=
oiu@upb.ro">vlad_andrei.badoiu@upb.ro</a>&gt; a scris:<br></div><blockquote=
 class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px so=
lid rgb(204,204,204);padding-left:1ex">From: Vlad-Andrei B=C4=82DOIU (78692=
) &lt;<a href=3D"mailto:vlad_andrei.badoiu@stud.acs.upb.ro" target=3D"_blan=
k">vlad_andrei.badoiu@stud.acs.upb.ro</a>&gt;<br>
<br>
This library provides the necessary functionalities for the stack<br>
protector.<br>
<br>
A make clean is required when toggling the stack smashing protection<br>
option.<br>
<br>
Signed-off-by: Vlad-Andrei Badoiu &lt;<a href=3D"mailto:vlad_andrei.badoiu@=
stud.acs.upb.ro" target=3D"_blank">vlad_andrei.badoiu@stud.acs.upb.ro</a>&g=
t;<br>
Signed-off-by: Vlad-Andrei Badoiu &lt;<a href=3D"mailto:vlad_andrei.badoiu@=
upb.ro" target=3D"_blank">vlad_andrei.badoiu@upb.ro</a>&gt;<br>
---<br>
=C2=A0lib/Makefile.uk=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 |=C2=A0 1 +<br>
=C2=A0lib/uksp/Config.uk=C2=A0 =C2=A0 =C2=A0 =C2=A0| 46 +++++++++++++++++++=
++++++++++++<br>
=C2=A0lib/uksp/Makefile.uk=C2=A0 =C2=A0 =C2=A0|=C2=A0 9 +++++++<br>
=C2=A0lib/uksp/<a href=3D"http://exportsyms.uk" rel=3D"noreferrer" target=
=3D"_blank">exportsyms.uk</a>=C2=A0 =C2=A0|=C2=A0 2 ++<br>
=C2=A0lib/uksp/include/uk/sp.h | 58 +++++++++++++++++++++++++++++++++++++++=
+<br>
=C2=A0lib/uksp/ssp.c=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0| 51 +++++++++=
++++++++++++++++++++++++++<br>
=C2=A06 files changed, 167 insertions(+)<br>
=C2=A0create mode 100644 lib/uksp/Config.uk<br>
=C2=A0create mode 100644 lib/uksp/Makefile.uk<br>
=C2=A0create mode 100644 lib/uksp/<a href=3D"http://exportsyms.uk" rel=3D"n=
oreferrer" target=3D"_blank">exportsyms.uk</a><br>
=C2=A0create mode 100644 lib/uksp/include/uk/sp.h<br>
=C2=A0create mode 100644 lib/uksp/ssp.c<br>
<br>
diff --git a/lib/Makefile.uk b/lib/Makefile.uk<br>
index 9261533c..07e8a295 100644<br>
--- a/lib/Makefile.uk<br>
+++ b/lib/Makefile.uk<br>
@@ -36,3 +36,4 @@ $(eval $(call _import_lib,$(CONFIG_UK_BASE)/lib/uktime))<=
br>
=C2=A0$(eval $(call _import_lib,$(CONFIG_UK_BASE)/lib/ukmmap))<br>
=C2=A0$(eval $(call _import_lib,$(CONFIG_UK_BASE)/lib/ukblkdev))<br>
=C2=A0$(eval $(call _import_lib,$(CONFIG_UK_BASE)/lib/posix-process))<br>
+$(eval $(call _import_lib,$(CONFIG_UK_BASE)/lib/uksp))<br>
diff --git a/lib/uksp/Config.uk b/lib/uksp/Config.uk<br>
new file mode 100644<br>
index 00000000..0881ddec<br>
--- /dev/null<br>
+++ b/lib/uksp/Config.uk<br>
@@ -0,0 +1,46 @@<br>
+config LIBUKSP<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0bool &quot;uksp: Stack protector&quot;<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0select HAVE_STACKPROTECTOR<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0default n<br>
+<br>
+if LIBUKSP<br>
+choice<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0prompt &quot;Stack protector level&quot;<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0default STACKPROTECTOR_REGULAR<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0help<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0Set the stack protector level<br>
+<br>
+config STACKPROTECTOR_REGULAR<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0bool &quot;Regular&quot;<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0help<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0Regular stack prote=
ctor, use -fstack-protector.<br>
+<br>
+config STACKPROTECTOR_STRONG<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0bool &quot;Strong&quot;<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0help<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0Strong stack protec=
tor, use -fstack-protector-strong.<br>
+<br>
+config STACKPROTECTOR_ALL<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0bool &quot;All&quot;<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0help<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0Protect all functio=
ns, use -fstack-protector-all.<br>
+endchoice<br>
+<br>
+choice<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0prompt &quot;Canary Value&quot;<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0default LIBUKSP_VALUE_USECONSTANT<br>
+<br>
+config LIBUKSP_VALUE_USECONSTANT<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0bool &quot;Compiled-in constant&quot;<br>
+<br>
+config LIBUKSP_VALUE_RANDOM<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0bool &quot;Random variable&quot;<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0select LIBUKSWRAND<br>
+endchoice<br>
+<br>
+config LIBUKSP_VALUE_CONSTANT<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0int &quot;Canary value&quot;<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0depends on LIBUKSP_VALUE_USECONSTANT<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0default 42<br>
+<br>
+endif<br>
diff --git a/lib/uksp/Makefile.uk b/lib/uksp/Makefile.uk<br>
new file mode 100644<br>
index 00000000..4e591231<br>
--- /dev/null<br>
+++ b/lib/uksp/Makefile.uk<br>
@@ -0,0 +1,9 @@<br>
+$(eval $(call addlib_s,libuksp,$(CONFIG_LIBUKSP)))<br>
+<br>
+CINCLUDES-y +=3D -I$(LIBUKSP_BASE)/include<br>
+<br>
+LIBUKSP_SRCS-y +=3D $(LIBUKSP_BASE)/ssp.c<br>
+<br>
+COMPFLAGS-$(CONFIG_STACKPROTECTOR_REGULAR)=C2=A0 =C2=A0 =C2=A0+=3D -fstack=
-protector -mstack-protector-guard=3Dglobal<br>
+COMPFLAGS-$(CONFIG_STACKPROTECTOR_STRONG)=C2=A0 =C2=A0 =C2=A0 +=3D -fstack=
-protector-strong -mstack-protector-guard=3Dglobal<br>
+COMPFLAGS-$(CONFIG_STACKPROTECTOR_ALL)=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0+=
=3D -fstack-protector-all -mstack-protector-guard=3Dglobal<br>
diff --git a/lib/uksp/<a href=3D"http://exportsyms.uk" rel=3D"noreferrer" t=
arget=3D"_blank">exportsyms.uk</a> b/lib/uksp/<a href=3D"http://exportsyms.=
uk" rel=3D"noreferrer" target=3D"_blank">exportsyms.uk</a><br>
new file mode 100644<br>
index 00000000..fbc319e7<br>
--- /dev/null<br>
+++ b/lib/uksp/<a href=3D"http://exportsyms.uk" rel=3D"noreferrer" target=
=3D"_blank">exportsyms.uk</a><br>
@@ -0,0 +1,2 @@<br>
+__stack_chk_fail<br>
+__stack_chk_guard<br>
diff --git a/lib/uksp/include/uk/sp.h b/lib/uksp/include/uk/sp.h<br>
new file mode 100644<br>
index 00000000..ab8b4177<br>
--- /dev/null<br>
+++ b/lib/uksp/include/uk/sp.h<br>
@@ -0,0 +1,58 @@<br>
+/* SPDX-License-Identifier: BSD-3-Clause */<br>
+/*<br>
+ * Authors: Vlad-Andrei Badoiu &lt;<a href=3D"mailto:vlad_andrei.badoiu@st=
ud.acs.upb.ro" target=3D"_blank">vlad_andrei.badoiu@stud.acs.upb.ro</a>&gt;=
<br>
+ *<br>
+ * Copyright (c) 2019, University Politehnica of Bucharest. All rights res=
erved.<br>
+ *<br>
+ * Redistribution and use in source and binary forms, with or without<br>
+ * modification, are permitted provided that the following conditions<br>
+ * are met:<br>
+ *<br>
+ * 1. Redistributions of source code must retain the above copyright<br>
+ *=C2=A0 =C2=A0 notice, this list of conditions and the following disclaim=
er.<br>
+ * 2. Redistributions in binary form must reproduce the above copyright<br=
>
+ *=C2=A0 =C2=A0 notice, this list of conditions and the following disclaim=
er in the<br>
+ *=C2=A0 =C2=A0 documentation and/or other materials provided with the dis=
tribution.<br>
+ * 3. Neither the name of the copyright holder nor the names of its<br>
+ *=C2=A0 =C2=A0 contributors may be used to endorse or promote products de=
rived from<br>
+ *=C2=A0 =C2=A0 this software without specific prior written permission.<b=
r>
+ *<br>
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS &qu=
ot;AS IS&quot;<br>
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, T=
HE<br>
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURP=
OSE<br>
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS =
BE<br>
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR<br>
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF<br=
>
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINES=
S<br>
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN=
<br>
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)=
<br>
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF =
THE<br>
+ * POSSIBILITY OF SUCH DAMAGE.<br>
+ */<br>
+<br>
+#ifndef __UK_STACKPROTECTOR_H__<br>
+#define __UK_STACKPROTECTOR_H__<br>
+<br>
+#ifdef CONFIG_LIBUKSP_VALUE_RANDOM<br>
+#include &lt;uk/swrand.h&gt;<br>
+#endif<br>
+#include &lt;uk/config.h&gt;<br>
+<br>
+#ifdef __cplusplus<br>
+extern &quot;C&quot; {<br>
+#endif<br>
+<br>
+extern const unsigned long __stack_chk_guard;<br>
+<br>
+#ifdef CONFIG_LIBUKSP_VALUE_RANDOM<br>
+#define UKSP_INIT_CANARY() (*(DECONST(unsigned long *, &amp;__stack_chk_gu=
ard)) \<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0=3D uk_swrand_randr=
())<br>
+#else<br>
+#define UKSP_INIT_CANARY()<br>
+#endif<br>
+<br>
+#ifdef __cplusplus<br>
+}<br>
+#endif<br>
+<br>
+#endif /* __UK_STACKPROTECTOR_H__ */<br>
diff --git a/lib/uksp/ssp.c b/lib/uksp/ssp.c<br>
new file mode 100644<br>
index 00000000..8a847f5c<br>
--- /dev/null<br>
+++ b/lib/uksp/ssp.c<br>
@@ -0,0 +1,51 @@<br>
+/* SPDX-License-Identifier: BSD-3-Clause */<br>
+/*<br>
+ * Authors: Badoiu Vlad-Andrei &lt;<a href=3D"mailto:vlad_andrei.badoiu@st=
ud.acs.upb.ro" target=3D"_blank">vlad_andrei.badoiu@stud.acs.upb.ro</a>&gt;=
<br>
+ *<br>
+ * Copyright (c) 2019, University Politehnica of Bucharest. All rights res=
erved.<br>
+ *<br>
+ * Redistribution and use in source and binary forms, with or without<br>
+ * modification, are permitted provided that the following conditions<br>
+ * are met:<br>
+ *<br>
+ * 1. Redistributions of source code must retain the above copyright<br>
+ *=C2=A0 =C2=A0 notice, this list of conditions and the following disclaim=
er.<br>
+ * 2. Redistributions in binary form must reproduce the above copyright<br=
>
+ *=C2=A0 =C2=A0 notice, this list of conditions and the following disclaim=
er in the<br>
+ *=C2=A0 =C2=A0 documentation and/or other materials provided with the dis=
tribution.<br>
+ * 3. Neither the name of the copyright holder nor the names of its<br>
+ *=C2=A0 =C2=A0 contributors may be used to endorse or promote products de=
rived from<br>
+ *=C2=A0 =C2=A0 this software without specific prior written permission.<b=
r>
+ *<br>
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS &qu=
ot;AS IS&quot;<br>
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, T=
HE<br>
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURP=
OSE<br>
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS =
BE<br>
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR<br>
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF<br=
>
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINES=
S<br>
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN=
<br>
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)=
<br>
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF =
THE<br>
+ * POSSIBILITY OF SUCH DAMAGE.<br>
+ */<br>
+<br>
+#include &lt;uk/assert.h&gt;<br>
+#include &lt;uk/config.h&gt;<br>
+#include &lt;uk/ctors.h&gt;<br>
+#include &lt;uk/thread.h&gt;<br>
+<br>
+#ifdef CONFIG_LIBUKSP_VALUE_USECONSTANT<br>
+const unsigned long __stack_chk_guard =3D CONFIG_LIBUKSP_VALUE_CONSTANT;<b=
r>
+#else<br>
+const unsigned long __stack_chk_guard =3D 0xDEADBEEF;<br>
+#endif<br>
+<br>
+__attribute__((noreturn))<br>
+void __stack_chk_fail(void)<br>
+{<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0unsigned long sp;<br>
+<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0sp =3D ukarch_read_sp() &amp; STACK_MASK_TOP;<b=
r>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0UK_CRASH(&quot;Stack smashing detected. SP %p\n=
&quot;, (void *) sp);<br>
+}<br>
-- <br>
2.25.1<br>
<br>
</blockquote></div>

--0000000000008aa9f905ac08d693--


From minios-devel-bounces@lists.xenproject.org Tue Aug 04 08:16:03 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Tue, 04 Aug 2020 08:16:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1k2s79-0004Bs-3b; Tue, 04 Aug 2020 08:16:03 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=PwQf=BO=gmail.com=alicesuiu17@srs-us1.protection.inumbo.net>)
 id 1k2s78-0004Bn-GY
 for minios-devel@lists.xen.org; Tue, 04 Aug 2020 08:16:02 +0000
X-Inumbo-ID: bbe19454-d62a-11ea-9137-bc764e2007e4
Received: from mail-ua1-x944.google.com (unknown [2607:f8b0:4864:20::944])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id bbe19454-d62a-11ea-9137-bc764e2007e4;
 Tue, 04 Aug 2020 08:16:01 +0000 (UTC)
Received: by mail-ua1-x944.google.com with SMTP id o25so12644864uar.1
 for <minios-devel@lists.xen.org>; Tue, 04 Aug 2020 01:16:01 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=mime-version:references:in-reply-to:from:date:message-id:subject:to
 :cc; bh=x6Xnxrn4WbmoqHNl/nqS1nqhtIBOlqxDNmFsrkXw0kE=;
 b=EtZ3n4zpedcxghGMaMf12CW0zjo0UBScyfKgAVCWRiZhEpx7qPQJ9eLLE3LaRVG5yw
 xSeWELVbCZnguQZjHBv0IAEHvM+IkCs6zjOU8mmr+oQZrFu5NOVC/iENYN6QDQOvw9GF
 bf2VGrmy4lcb9W+YLfyaBPv+vDRc9YbXk2htwtqgKzm24Z6ZTCghIFDv3D7CTOOcErfn
 VcrtSCuJWhe/5yXXXE5g8jPCOsnhjXvTvCeb4VFATQ4szI1SZHR34+yMmoZjkJ+EBvxY
 MzQDVhIUwrXrYzofwHAJiS/o9+l6y1D9B0zSGxkvlRtCLbCpVtYYsVCbpUJOG5SS7SXV
 tUEA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:mime-version:references:in-reply-to:from:date
 :message-id:subject:to:cc;
 bh=x6Xnxrn4WbmoqHNl/nqS1nqhtIBOlqxDNmFsrkXw0kE=;
 b=PahaXUXvxQirK4lXvq9kTW26/ngWgHhAnTSBvjDemNeAgLGjtU85Iful28jam2jRvr
 PIxFLIn4Tjieakg1VOLU7yLl7I/CzCV5DBWMIxflWvvmpbqHk3wsvSeYn61KCfdGnNUu
 bJ6ZjlwXbUa3QeaBBAeUgUzIVO70R49/VKYvoZXT+eAnm47pWaZ6i5B9ESrX+b0sz30m
 a0he1Zuxu5WVuWho66SL7KO6goZFQiA4ZbmKpKPJxK9cDjrIE3w4pb7fCIzTDRarV9co
 FOlepCvbWUCD2x4C8t0wgGyLoxqDAkzih+ffEHim8DDSwsOoy69jRc3MWpTc3XqCozn+
 cTSQ==
X-Gm-Message-State: AOAM530JyJebI47IwpYM0pUvO0h/VftgGC3sgOq94FoPE/kzAdv+m6Jv
 ezkTeLEptLIFNhPGXosq8WyisH17vczSw8L+awk=
X-Google-Smtp-Source: ABdhPJxBkm+1v7IGshAk35uI8eWEZUulPvVA6hbB24sUInJYxkmDzbVBnzBCF2DmhYqzZZzfJRS8jP/DkMbKhO5mBUA=
X-Received: by 2002:ab0:4946:: with SMTP id a6mr7184763uad.40.1596528961509;
 Tue, 04 Aug 2020 01:16:01 -0700 (PDT)
MIME-Version: 1.0
References: <20200803135836.10392-1-vlad_andrei.badoiu@upb.ro>
 <20200803135836.10392-3-vlad_andrei.badoiu@upb.ro>
In-Reply-To: <20200803135836.10392-3-vlad_andrei.badoiu@upb.ro>
From: Alice Suiu <alicesuiu17@gmail.com>
Date: Tue, 4 Aug 2020 11:15:50 +0300
Message-ID: <CAD2TrnDGgFzba1JRnhTRQa_z-=2KZ6oc+8wDEmYQYC3rgMEW0g@mail.gmail.com>
Subject: Re: [UNIKRAFT PATCH v6 2/3] build: Add option to toggle the stack
 protection
To: Vlad-Andrei Badoiu <vlad_andrei.badoiu@upb.ro>
Content-Type: multipart/alternative; boundary="0000000000009fdb4405ac08dd6d"
X-BeenThere: minios-devel@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Mini-os development list <minios-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:minios-devel@lists.xenproject.org>
List-Help: <mailto:minios-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=subscribe>
Cc: =?UTF-8?B?VmxhZC1BbmRyZWkgQsSCRE9JVSAoNzg2OTIp?=
 <vlad_andrei.badoiu@stud.acs.upb.ro>, Simon Kuenzer <simon.kuenzer@neclab.eu>,
 minios-devel@lists.xen.org
Errors-To: minios-devel-bounces@lists.xenproject.org
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>

--0000000000009fdb4405ac08dd6d
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

Reviewed-by: Alice Suiu <alicesuiu17@gmail.com> <alicesuiu17@gmail.com>

=C3=8En lun., 3 aug. 2020 la 17:06, Vlad-Andrei Badoiu <vlad_andrei.badoiu@=
upb.ro>
a scris:

> From: Vlad-Andrei B=C4=82DOIU (78692) <vlad_andrei.badoiu@stud.acs.upb.ro=
>
>
> This patch adds build option to select different stack protection
> levels.
>
> Signed-off-by: Vlad-Andrei Badoiu <vlad_andrei.badoiu@stud.acs.upb.ro>
> Signed-off-by: Vlad-Andrei Badoiu <vlad_andrei.badoiu@upb.ro>
> ---
>  Makefile.uk | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/Makefile.uk b/Makefile.uk
> index 2c102989..4f1c7642 100644
> --- a/Makefile.uk
> +++ b/Makefile.uk
> @@ -6,7 +6,10 @@
>
>  COMPFLAGS    +=3D -nostdinc -nostdlib
>  COMPFLAGS    +=3D -U __linux__ -U __FreeBSD__ -U __sun__
> -COMPFLAGS    +=3D -fno-stack-protector -fno-omit-frame-pointer
> -fno-tree-sra -fno-split-stack
> +COMPFLAGS    +=3D -fno-omit-frame-pointer -fno-tree-sra -fno-split-stack
> +ifneq ($(HAVE_STACKPROTECTOR),y)
> +COMPFLAGS    +=3D -fno-stack-protector
> +endif
>  COMPFLAGS    +=3D -Wall -Wextra
>
>  ASFLAGS      +=3D -D__ASSEMBLY__
> --
> 2.25.1
>
>

--0000000000009fdb4405ac08dd6d
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div dir=3D"ltr">Reviewed-by: Alice Suiu <a href=3D"mailto=
:alicesuiu17@gmail.com" target=3D"_blank">&lt;alicesuiu17@gmail.com&gt;</a>=
</div><div class=3D"gmail-yj6qo gmail-ajU"><div id=3D"gmail-:1ww" class=3D"=
gmail-ajR" tabindex=3D"0"><img class=3D"gmail-ajT" src=3D"https://ssl.gstat=
ic.com/ui/v1/icons/mail/images/cleardot.gif"></div></div></div><br><div cla=
ss=3D"gmail_quote"><div dir=3D"ltr" class=3D"gmail_attr">=C3=8En lun., 3 au=
g. 2020 la 17:06, Vlad-Andrei Badoiu &lt;<a href=3D"mailto:vlad_andrei.bado=
iu@upb.ro">vlad_andrei.badoiu@upb.ro</a>&gt; a scris:<br></div><blockquote =
class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px sol=
id rgb(204,204,204);padding-left:1ex">From: Vlad-Andrei B=C4=82DOIU (78692)=
 &lt;<a href=3D"mailto:vlad_andrei.badoiu@stud.acs.upb.ro" target=3D"_blank=
">vlad_andrei.badoiu@stud.acs.upb.ro</a>&gt;<br>
<br>
This patch adds build option to select different stack protection<br>
levels.<br>
<br>
Signed-off-by: Vlad-Andrei Badoiu &lt;<a href=3D"mailto:vlad_andrei.badoiu@=
stud.acs.upb.ro" target=3D"_blank">vlad_andrei.badoiu@stud.acs.upb.ro</a>&g=
t;<br>
Signed-off-by: Vlad-Andrei Badoiu &lt;<a href=3D"mailto:vlad_andrei.badoiu@=
upb.ro" target=3D"_blank">vlad_andrei.badoiu@upb.ro</a>&gt;<br>
---<br>
=C2=A0Makefile.uk | 5 ++++-<br>
=C2=A01 file changed, 4 insertions(+), 1 deletion(-)<br>
<br>
diff --git a/Makefile.uk b/Makefile.uk<br>
index 2c102989..4f1c7642 100644<br>
--- a/Makefile.uk<br>
+++ b/Makefile.uk<br>
@@ -6,7 +6,10 @@<br>
<br>
=C2=A0COMPFLAGS=C2=A0 =C2=A0 +=3D -nostdinc -nostdlib<br>
=C2=A0COMPFLAGS=C2=A0 =C2=A0 +=3D -U __linux__ -U __FreeBSD__ -U __sun__<br=
>
-COMPFLAGS=C2=A0 =C2=A0 +=3D -fno-stack-protector -fno-omit-frame-pointer -=
fno-tree-sra -fno-split-stack<br>
+COMPFLAGS=C2=A0 =C2=A0 +=3D -fno-omit-frame-pointer -fno-tree-sra -fno-spl=
it-stack<br>
+ifneq ($(HAVE_STACKPROTECTOR),y)<br>
+COMPFLAGS=C2=A0 =C2=A0 +=3D -fno-stack-protector<br>
+endif<br>
=C2=A0COMPFLAGS=C2=A0 =C2=A0 +=3D -Wall -Wextra<br>
<br>
=C2=A0ASFLAGS=C2=A0 =C2=A0 =C2=A0 +=3D -D__ASSEMBLY__<br>
-- <br>
2.25.1<br>
<br>
</blockquote></div>

--0000000000009fdb4405ac08dd6d--


From minios-devel-bounces@lists.xenproject.org Tue Aug 04 08:17:30 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Tue, 04 Aug 2020 08:17:30 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1k2s8Y-0004Df-9K; Tue, 04 Aug 2020 08:17:30 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=PwQf=BO=gmail.com=alicesuiu17@srs-us1.protection.inumbo.net>)
 id 1k2s8X-0004Da-EH
 for minios-devel@lists.xen.org; Tue, 04 Aug 2020 08:17:29 +0000
X-Inumbo-ID: efaf9b82-d62a-11ea-9137-bc764e2007e4
Received: from mail-vs1-xe44.google.com (unknown [2607:f8b0:4864:20::e44])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id efaf9b82-d62a-11ea-9137-bc764e2007e4;
 Tue, 04 Aug 2020 08:17:28 +0000 (UTC)
Received: by mail-vs1-xe44.google.com with SMTP id b26so16065068vsa.13
 for <minios-devel@lists.xen.org>; Tue, 04 Aug 2020 01:17:28 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=mime-version:references:in-reply-to:from:date:message-id:subject:to
 :cc; bh=kuI2GTBaaZS9A1dxDkfH6GszjdxWu/c3AV4J7hOuMQw=;
 b=ILCoCnyfQPSOtC7vTx4gLkq9Dt0LNbfhzvv2pMu9oBC0xtRSGQphnHdbPaHxFtm4DL
 Mxw+3w7Ij2tHytS0P3jLpH+TbJ2CvE3e5IAwAPmRG30Wlj7XyF0124Jqi1q9Gq/8Hpji
 Ocfo9MhJdXA5FjXSDTiD4qFM4xbM8X7h6vUtfLJFLMOKYyOSDzz+2i3o7CQ+6qOmlXtV
 lW5SYx1hLHbIgjpodpPrXyVfrDUkJ+JSHa9rOflrVQMwOilfB+gcyYsJbzKI/gyfT+le
 Ogk5cAhVwMjvXqg9qzcw9hGzvIS9PjPZIWMIElZBYuABEgyJtGO+h43w0dV6afLT7EQ8
 g4oA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:mime-version:references:in-reply-to:from:date
 :message-id:subject:to:cc;
 bh=kuI2GTBaaZS9A1dxDkfH6GszjdxWu/c3AV4J7hOuMQw=;
 b=l/jrOwVg0029FjGdjhsaxTtrdo9dwM8WftQbXZmZAU9GC9TWRL3nWyysiIEh4gQ/K0
 vjNXbOVlKJ2kcsbbNBHtlV3tLPilrfJipzBoCkAX9NEYKRbDpaV5kHbmHaercks31uTC
 T0gEO5UlHKNONibhiejP+cFIO2tPQn+LmBdzTQq0elOmmgNGP6BkOjRvrbAAHTNN0pP0
 AkKZPusJwtOWBXRgol0YTC/1AmPU4TklhPkqRZFacEdErliXls4dRc/301OXAQtthHFX
 wdte0Ug/pmr6b3Kox778H0bRtARUEd/M4gPUmUiv1Bhf5FM0E64H/wRCP0gDixLUDdEW
 Aagg==
X-Gm-Message-State: AOAM530bUksaA3E5AQtix0KELBNTFURpevDVoUEtXzA6Kyarxyzk20ir
 4ToFFiHmytK2r5lGvZIP1QAQIcM2vfVZPHsc7Iw=
X-Google-Smtp-Source: ABdhPJxAFmp+mM6BSisxiht770IJeEqQ03cP8bb6LfyCtqVai5mPbX9T2J0QRMRzc8OkaxJDGLNljFIJl0LX09iygiE=
X-Received: by 2002:a67:8084:: with SMTP id
 b126mr14400027vsd.163.1596529048435; 
 Tue, 04 Aug 2020 01:17:28 -0700 (PDT)
MIME-Version: 1.0
References: <20200803135836.10392-1-vlad_andrei.badoiu@upb.ro>
 <20200803135836.10392-4-vlad_andrei.badoiu@upb.ro>
In-Reply-To: <20200803135836.10392-4-vlad_andrei.badoiu@upb.ro>
From: Alice Suiu <alicesuiu17@gmail.com>
Date: Tue, 4 Aug 2020 11:17:17 +0300
Message-ID: <CAD2TrnCYL0RAuU9xxyMOyZZKEWzMR6++DGYWmqD6AUPfF6ku+Q@mail.gmail.com>
Subject: Re: [UNIKRAFT PATCH v6 3/3] lib/ukboot: Initialize the canary value
 at boot
To: Vlad-Andrei Badoiu <vlad_andrei.badoiu@upb.ro>
Content-Type: multipart/alternative; boundary="000000000000ce401905ac08e2fa"
X-BeenThere: minios-devel@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Mini-os development list <minios-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:minios-devel@lists.xenproject.org>
List-Help: <mailto:minios-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=subscribe>
Cc: =?UTF-8?B?VmxhZC1BbmRyZWkgQsSCRE9JVSAoNzg2OTIp?=
 <vlad_andrei.badoiu@stud.acs.upb.ro>, Simon Kuenzer <simon.kuenzer@neclab.eu>,
 minios-devel@lists.xen.org
Errors-To: minios-devel-bounces@lists.xenproject.org
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>

--000000000000ce401905ac08e2fa
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

Reviewed-by: Alice Suiu <alicesuiu17@gmail.com> <alicesuiu17@gmail.com>


=C3=8En lun., 3 aug. 2020 la 17:06, Vlad-Andrei Badoiu <vlad_andrei.badoiu@=
upb.ro>
a scris:

> From: Vlad-Andrei B=C4=82DOIU (78692) <vlad_andrei.badoiu@stud.acs.upb.ro=
>
>
> We initialize the canary value right after all the internal libraries
> have loaded.
>
> Signed-off-by: Vlad-Andrei Badoiu <vlad_andrei.badoiu@stud.acs.upb.ro>
> Signed-off-by: Vlad-Andrei Badoiu <vlad_andrei.badoiu@upb.ro>
> ---
>  lib/ukboot/boot.c | 11 +++++++++++
>  1 file changed, 11 insertions(+)
>
> diff --git a/lib/ukboot/boot.c b/lib/ukboot/boot.c
> index 4e749aa5..3e92812d 100644
> --- a/lib/ukboot/boot.c
> +++ b/lib/ukboot/boot.c
> @@ -63,6 +63,9 @@
>  #ifdef CONFIG_LIBUKLIBPARAM
>  #include <uk/libparam.h>
>  #endif /* CONFIG_LIBUKLIBPARAM */
> +#if CONFIG_LIBUKSP
> +#include <uk/sp.h>
> +#endif
>
>  int main(int argc, char *argv[]) __weak;
>
> @@ -187,6 +190,14 @@ void ukplat_entry(int argc, char *argv[])
>         struct uk_sched *s =3D NULL;
>         struct uk_thread *main_thread =3D NULL;
>  #endif
> +
> +       /* We use a macro because if we were to use a function we
> +        * would not be able to return from the function if we have
> +        * changed the stack protector inside the function */
> +#if CONFIG_LIBUKSP
> +       UKSP_INIT_CANARY();
> +#endif
> +
>         uk_ctor_func_t *ctorfn;
>
>         uk_pr_info("Unikraft constructor table at %p - %p\n",
> --
> 2.25.1
>
>

--000000000000ce401905ac08e2fa
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div dir=3D"ltr">Reviewed-by: Alice Suiu <a href=3D"mailto=
:alicesuiu17@gmail.com" target=3D"_blank">&lt;alicesuiu17@gmail.com&gt;</a>=
</div><div class=3D"gmail-yj6qo gmail-ajU"><div id=3D"gmail-:1ww" class=3D"=
gmail-ajR" tabindex=3D"0"><br></div></div></div><br><div class=3D"gmail_quo=
te"><div dir=3D"ltr" class=3D"gmail_attr">=C3=8En lun., 3 aug. 2020 la 17:0=
6, Vlad-Andrei Badoiu &lt;<a href=3D"mailto:vlad_andrei.badoiu@upb.ro">vlad=
_andrei.badoiu@upb.ro</a>&gt; a scris:<br></div><blockquote class=3D"gmail_=
quote" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,=
204);padding-left:1ex">From: Vlad-Andrei B=C4=82DOIU (78692) &lt;<a href=3D=
"mailto:vlad_andrei.badoiu@stud.acs.upb.ro" target=3D"_blank">vlad_andrei.b=
adoiu@stud.acs.upb.ro</a>&gt;<br>
<br>
We initialize the canary value right after all the internal libraries<br>
have loaded.<br>
<br>
Signed-off-by: Vlad-Andrei Badoiu &lt;<a href=3D"mailto:vlad_andrei.badoiu@=
stud.acs.upb.ro" target=3D"_blank">vlad_andrei.badoiu@stud.acs.upb.ro</a>&g=
t;<br>
Signed-off-by: Vlad-Andrei Badoiu &lt;<a href=3D"mailto:vlad_andrei.badoiu@=
upb.ro" target=3D"_blank">vlad_andrei.badoiu@upb.ro</a>&gt;<br>
---<br>
=C2=A0lib/ukboot/boot.c | 11 +++++++++++<br>
=C2=A01 file changed, 11 insertions(+)<br>
<br>
diff --git a/lib/ukboot/boot.c b/lib/ukboot/boot.c<br>
index 4e749aa5..3e92812d 100644<br>
--- a/lib/ukboot/boot.c<br>
+++ b/lib/ukboot/boot.c<br>
@@ -63,6 +63,9 @@<br>
=C2=A0#ifdef CONFIG_LIBUKLIBPARAM<br>
=C2=A0#include &lt;uk/libparam.h&gt;<br>
=C2=A0#endif /* CONFIG_LIBUKLIBPARAM */<br>
+#if CONFIG_LIBUKSP<br>
+#include &lt;uk/sp.h&gt;<br>
+#endif<br>
<br>
=C2=A0int main(int argc, char *argv[]) __weak;<br>
<br>
@@ -187,6 +190,14 @@ void ukplat_entry(int argc, char *argv[])<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 struct uk_sched *s =3D NULL;<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 struct uk_thread *main_thread =3D NULL;<br>
=C2=A0#endif<br>
+<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0/* We use a macro because if we were to use a f=
unction we<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 * would not be able to return from the functio=
n if we have<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 * changed the stack protector inside the funct=
ion */<br>
+#if CONFIG_LIBUKSP<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0UKSP_INIT_CANARY();<br>
+#endif<br>
+<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 uk_ctor_func_t *ctorfn;<br>
<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 uk_pr_info(&quot;Unikraft constructor table at =
%p - %p\n&quot;,<br>
-- <br>
2.25.1<br>
<br>
</blockquote></div>

--000000000000ce401905ac08e2fa--


From minios-devel-bounces@lists.xenproject.org Wed Aug 05 13:15:00 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Wed, 05 Aug 2020 13:15:00 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1k3JFw-0005GA-5k; Wed, 05 Aug 2020 13:14:56 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=MzF+=BP=neclab.eu=simon.kuenzer@srs-us1.protection.inumbo.net>)
 id 1k3JFu-0005G5-JR
 for minios-devel@lists.xen.org; Wed, 05 Aug 2020 13:14:54 +0000
X-Inumbo-ID: b76d0bea-a41a-403d-8cd9-8ab75e31d8bb
Received: from mailer2.neclab.eu (unknown [195.37.70.41])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id b76d0bea-a41a-403d-8cd9-8ab75e31d8bb;
 Wed, 05 Aug 2020 13:14:51 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
 by mailer2.neclab.eu (Postfix) with ESMTP id 150EBF203B;
 Wed,  5 Aug 2020 15:14:50 +0200 (CEST)
X-Virus-Scanned: Amavisd on Debian GNU/Linux (atlas-b.office.hd)
Received: from mailer2.neclab.eu ([127.0.0.1])
 by localhost (atlas-b.office.hd [127.0.0.1]) (amavisd-new, port 10024)
 with ESMTP id rpw8lT1iV0Bf; Wed,  5 Aug 2020 15:14:49 +0200 (CEST)
X-ENC: Last-Hop-TLS-encrypted
X-ENC: Last-Hop-TLS-encrypted
Received: from puck.office.hd (puck.office.hd [192.168.24.91])
 (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
 (No client certificate requested)
 by mailer2.neclab.eu (Postfix) with ESMTPS id CB31BF2006
 for <minios-devel@lists.xen.org>; Wed,  5 Aug 2020 15:14:47 +0200 (CEST)
Received: from [10.7.1.42] (192.168.24.96) by puck.office.hd (192.168.24.91)
 with Microsoft SMTP Server (version=TLS1_2,
 cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1979.3; Wed, 5 Aug 2020
 15:14:47 +0200
Subject: Re: [UNIKRAFT PATCH v4 1/3] build: Enable secondary expansion
To: Sharan Santhanam <sharan.santhanam@neclab.eu>, <minios-devel@lists.xen.org>
References: <1595321449-30403-1-git-send-email-sharan.santhanam@neclab.eu>
 <1595321449-30403-2-git-send-email-sharan.santhanam@neclab.eu>
From: Simon Kuenzer <simon.kuenzer@neclab.eu>
Message-ID: <be16cd91-be6e-48b0-d8c7-c2bf269da9f7@neclab.eu>
Date: Wed, 5 Aug 2020 15:14:46 +0200
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:68.0)
 Gecko/20100101 Thunderbird/68.11.0
MIME-Version: 1.0
In-Reply-To: <1595321449-30403-2-git-send-email-sharan.santhanam@neclab.eu>
Content-Type: text/plain; charset="utf-8"; format=flowed
Content-Language: en-US
Content-Transfer-Encoding: 7bit
X-Originating-IP: [192.168.24.96]
X-ClientProxiedBy: puck.office.hd (192.168.24.91) To puck.office.hd
 (192.168.24.91)
X-BeenThere: minios-devel@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Mini-os development list <minios-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:minios-devel@lists.xenproject.org>
List-Help: <mailto:minios-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: minios-devel-bounces@lists.xenproject.org
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>

Thanks a lot for the changes!

Reviewed-by: Simon Kuenzer <simon.kuenzer@neclab.eu>

On 21.07.20 10:50, Sharan Santhanam wrote:
> Enable second expansion of the make variables. The build variables
> are expanded on execution of the Make rule.
> 
> Signed-off-by: Sharan Santhanam <sharan.santhanam@neclab.eu>
> ---
>   Makefile                     |   3 ++
>   support/build/Makefile.rules | 112 +++++++++++++++++++++----------------------
>   2 files changed, 59 insertions(+), 56 deletions(-)
> 
> diff --git a/Makefile b/Makefile
> index be8fa8c..1f309b7 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -40,6 +40,9 @@ all:
>   # Disable built-in rules
>   .SUFFIXES:
>   
> +# Enable secondary expansion
> +.SECONDEXPANSION:
> +
>   # Save running make version
>   RUNNING_MAKE_VERSION := $(MAKE_VERSION)
>   
> diff --git a/support/build/Makefile.rules b/support/build/Makefile.rules
> index 8c096fa..9a5963f 100644
> --- a/support/build/Makefile.rules
> +++ b/support/build/Makefile.rules
> @@ -392,17 +392,17 @@ endef
>   define buildrule_S_ =
>   $(4): $(2) | prepare
>   	$(call build_cmd_fixdep,AS,$(1),$(4),\
> -		$(AS)  $(COMPFLAGS) $(COMPFLAGS-y) \
> -		       $($(call vprefix_lib,$(1),COMPFLAGS)) $($(call vprefix_lib,$(1),COMPFLAGS-y)) \
> -		       $(ASINCLUDES) $(ASINCLUDES-y) \
> -		       $($(call vprefix_lib,$(1),ASINCLUDES)) $($(call vprefix_lib,$(1),ASINCLUDES-y)) \
> -		       $($(call vprefix_src,$(1),$(2),$(3),INCLUDES)) $($(call vprefix_src,$(1),$(2),$(3),INCLUDES-y)) \
> -		       $($(call vprefix_glb,$(3),ARCHFLAGS)) $($(call vprefix_glb,$(3),ARCHFLAGS-y)) \
> -		       $(ASFLAGS) $(ASFLAGS-y) \
> -		       $($(call vprefix_lib,$(1),ASFLAGS)) $($(call vprefix_lib,$(1),ASFLAGS-y)) \
> -		       $($(call vprefix_src,$(1),$(2),$(3),FLAGS)) $($(call vprefix_src,$(1),$(2),$(3),FLAGS-y)) \
> +		$(AS)  $$(COMPFLAGS) $$(COMPFLAGS-y) \
> +		       $$($(call vprefix_lib,$(1),COMPFLAGS)) $$($(call vprefix_lib,$(1),COMPFLAGS-y)) \
> +		       $$(ASINCLUDES) $$(ASINCLUDES-y) \
> +		       $$($(call vprefix_lib,$(1),ASINCLUDES)) $$($(call vprefix_lib,$(1),ASINCLUDES-y)) \
> +		       $$($(call vprefix_src,$(1),$(2),$(3),INCLUDES)) $$($(call vprefix_src,$(1),$(2),$(3),INCLUDES-y)) \
> +		       $$($(call vprefix_glb,$(3),ARCHFLAGS)) $$($(call vprefix_glb,$(3),ARCHFLAGS-y)) \
> +		       $$(ASFLAGS) $$(ASFLAGS-y) \
> +		       $$($(call vprefix_lib,$(1),ASFLAGS)) $$($(call vprefix_lib,$(1),ASFLAGS-y)) \
> +		       $$($(call vprefix_src,$(1),$(2),$(3),FLAGS)) $$($(call vprefix_src,$(1),$(2),$(3),FLAGS-y)) \
>   		       $(5) \
> -		       $(DBGFLAGS) $(DBGFLAGS-y) \
> +		       $$(DBGFLAGS) $$(DBGFLAGS-y) \
>   		       -D__LIBNAME__=$(1) -D__BASENAME__=$(notdir $(2)) $(if $(3),-D__VARIANT__=$(3)) \
>   		       -c $(2) -o $(4) $(call depflags,$(4))
>   	)
> @@ -419,17 +419,17 @@ buildrule_sx = $(call buildrule_S_,$(1),$(2),$(3),$(4))
>   define buildrule_s =
>   $(4): $(2) | prepare
>   	$(call build_cmd,AS,$(1),$(4),\
> -		$(AS)  $(COMPFLAGS) $(COMPFLAGS-y) \
> -		       $($(call vprefix_lib,$(1),COMPFLAGS)) $($(call vprefix_lib,$(1),COMPFLAGS-y)) \
> -		       $(ASINCLUDES) $(ASINCLUDES-y) \
> -		       $($(call vprefix_lib,$(1),ASINCLUDES)) $($(call vprefix_lib,$(1),ASINCLUDES-y)) \
> -		       $($(call vprefix_src,$(1),$(2),$(3),INCLUDES)) $($(call vprefix_src,$(1),$(2),$(3),INCLUDES-y)) \
> -		       $($(call vprefix_glb,$(3),ARCHFLAGS)) $($(call vprefix_glb,$(3),ARCHFLAGS-y)) \
> -		       $(ASFLAGS) $(ASFLAGS-y) \
> -		       $($(call vprefix_lib,$(1),ASFLAGS)) $($(call vprefix_lib,$(1),ASFLAGS-y)) \
> -		       $($(call vprefix_src,$(1),$(2),$(3),FLAGS)) $($(call vprefix_src,$(1),$(2),$(3),FLAGS-y)) \
> +		$(AS)  $$(COMPFLAGS) $$(COMPFLAGS-y) \
> +		       $$($(call vprefix_lib,$(1),COMPFLAGS)) $$($(call vprefix_lib,$(1),COMPFLAGS-y)) \
> +		       $$(ASINCLUDES) $$(ASINCLUDES-y) \
> +		       $$($(call vprefix_lib,$(1),ASINCLUDES)) $$($(call vprefix_lib,$(1),ASINCLUDES-y)) \
> +		       $$($(call vprefix_src,$(1),$(2),$(3),INCLUDES)) $$($(call vprefix_src,$(1),$(2),$(3),INCLUDES-y)) \
> +		       $$($(call vprefix_glb,$(3),ARCHFLAGS)) $$($(call vprefix_glb,$(3),ARCHFLAGS-y)) \
> +		       $$(ASFLAGS) $$(ASFLAGS-y) \
> +		       $$($(call vprefix_lib,$(1),ASFLAGS)) $$($(call vprefix_lib,$(1),ASFLAGS-y)) \
> +		       $$($(call vprefix_src,$(1),$(2),$(3),FLAGS)) $$($(call vprefix_src,$(1),$(2),$(3),FLAGS-y)) \
>   		       $(5) \
> -		       $(DBGFLAGS) $(DBGFLAGS-y) \
> +		       $$(DBGFLAGS) $$(DBGFLAGS-y) \
>   		       -D__LIBNAME__=$(1) -D__BASENAME__=$(notdir $(2)) $(if $(3),-D__VARIANT__=$(3)) \
>   		       -c $(2) -o $(4)
>   	)
> @@ -444,17 +444,17 @@ endef
>   define buildrule_c =
>   $(4): $(2) | prepare
>   	$(call build_cmd_fixdep,CC,$(1),$(4),\
> -		$(CC)  $(COMPFLAGS) $(COMPFLAGS-y) \
> -		       $($(call vprefix_lib,$(1),COMPFLAGS)) $($(call vprefix_lib,$(1),COMPFLAGS-y)) \
> -		       $(CINCLUDES) $(CINCLUDES-y) \
> -		       $($(call vprefix_lib,$(1),CINCLUDES)) $($(call vprefix_lib,$(1),CINCLUDES-y)) \
> -		       $($(call vprefix_src,$(1),$(2),$(3),INCLUDES)) $($(call vprefix_src,$(1),$(2),$(3),INCLUDES-y)) \
> -		       $($(call vprefix_glb,$(3),ARCHFLAGS)) $($(call vprefix_glb,$(3),ARCHFLAGS-y)) \
> -		       $(CFLAGS) $(CFLAGS-y) \
> -		       $($(call vprefix_lib,$(1),CFLAGS)) $($(call vprefix_lib,$(1),CFLAGS-y)) \
> -		       $($(call vprefix_src,$(1),$(2),$(3),FLAGS)) $($(call vprefix_src,$(1),$(2),$(3),FLAGS-y)) \
> +		$(CC)  $$(COMPFLAGS) $$(COMPFLAGS-y) \
> +		       $$($(call vprefix_lib,$(1),COMPFLAGS)) $$($(call vprefix_lib,$(1),COMPFLAGS-y)) \
> +		       $$(CINCLUDES) $$(CINCLUDES-y) \
> +		       $$($(call vprefix_lib,$(1),CINCLUDES)) $$($(call vprefix_lib,$(1),CINCLUDES-y)) \
> +		       $$($(call vprefix_src,$(1),$(2),$(3),INCLUDES)) $$($(call vprefix_src,$(1),$(2),$(3),INCLUDES-y)) \
> +		       $$($(call vprefix_glb,$(3),ARCHFLAGS)) $$($(call vprefix_glb,$(3),ARCHFLAGS-y)) \
> +		       $$(CFLAGS) $$(CFLAGS-y) \
> +		       $$($(call vprefix_lib,$(1),CFLAGS)) $$($(call vprefix_lib,$(1),CFLAGS-y)) \
> +		       $$($(call vprefix_src,$(1),$(2),$(3),FLAGS)) $$($(call vprefix_src,$(1),$(2),$(3),FLAGS-y)) \
>   		       $(5) \
> -		       $(DBGFLAGS) $(DBGFLAGS-y) \
> +		       $$(DBGFLAGS) $$(DBGFLAGS-y) \
>   		       -D__LIBNAME__=$(1) -D__BASENAME__=$(notdir $(2)) $(if $(3),-D__VARIANT__=$(3)) \
>   		       -c $(2) -o $(4) $(call depflags,$(4))
>   )
> @@ -469,16 +469,16 @@ endef
>   define buildrule_cxx =
>   $(4): $(2) | prepare
>   	$(call build_cmd_fixdep,CXX,$(1),$(4),\
> -		$(CXX) $(COMPFLAGS) $(COMPFLAGS-y) \
> -		       $(CXXINCLUDES) $(CXXINCLUDES-y) \
> -		       $($(call vprefix_lib,$(1),CXXINCLUDES)) $($(call vprefix_lib,$(1),CXXINCLUDES-y)) \
> -		       $($(call vprefix_src,$(1),$(2),$(3),INCLUDES)) $($(call vprefix_src,$(1),$(2),$(3),INCLUDES-y)) \
> -		       $($(call vprefix_glb,$(3),ARCHFLAGS)) $($(call vprefix_glb,$(3),ARCHFLAGS-y)) \
> -		       $(CXXFLAGS) $(CXXFLAGS-y) \
> -		       $($(call vprefix_lib,$(1),CXXFLAGS)) $($(call vprefix_lib,$(1),CXXFLAGS-y)) \
> -		       $($(call vprefix_src,$(1),$(2),$(3),FLAGS)) $($(call vprefix_src,$(1),$(2),$(3),FLAGS-y)) \
> +		$(CXX) $$(COMPFLAGS) $$(COMPFLAGS-y) \
> +		       $$(CXXINCLUDES) $$(CXXINCLUDES-y) \
> +		       $$($(call vprefix_lib,$(1),CXXINCLUDES)) $$($(call vprefix_lib,$(1),CXXINCLUDES-y)) \
> +		       $$($(call vprefix_src,$(1),$(2),$(3),INCLUDES)) $$($(call vprefix_src,$(1),$(2),$(3),INCLUDES-y)) \
> +		       $$($(call vprefix_glb,$(3),ARCHFLAGS)) $$($(call vprefix_glb,$(3),ARCHFLAGS-y)) \
> +		       $$(CXXFLAGS) $$(CXXFLAGS-y) \
> +		       $$($(call vprefix_lib,$(1),CXXFLAGS)) $$($(call vprefix_lib,$(1),CXXFLAGS-y)) \
> +		       $$($(call vprefix_src,$(1),$(2),$(3),FLAGS)) $$($(call vprefix_src,$(1),$(2),$(3),FLAGS-y)) \
>   		       $(5) \
> -		       $(DBGFLAGS) $(DBGFLAGS-y) \
> +		       $$(DBGFLAGS) $$(DBGFLAGS-y) \
>   		       -D__LIBNAME__=$(1) -D__BASENAME__=$(notdir $(2)) $(if $(3),-D__VARIANT__=$(3)) \
>   		       -c $(2) -o $(4) $(call depflags,$(4))
>   	)
> @@ -501,16 +501,16 @@ buildrule_c$(plus)$(plus) = $(call buildrule_cxx,$(1),$(2),$(3),$(4))
>   define buildrule_go =
>   $(4): $(2) | prepare
>   	$(call build_cmd,GOC,$(1),$(4),\
> -		$(GOC) $(COMPFLAGS) $(COMPFLAGS-y) \
> -		       $(GOCINCLUDES) $(GOCINCLUDES-y) \
> -		       $($(call vprefix_lib,$(1),GOCINCLUDES)) $($(call vprefix_lib,$(1),GOCINCLUDES-y)) \
> -		       $($(call vprefix_src,$(1),$(2),$(3),INCLUDES)) $($(call vprefix_src,$(1),$(2),$(3),INCLUDES-y)) \
> -		       $($(call vprefix_glb,$(3),ARCHFLAGS)) $($(call vprefix_glb,$(3),ARCHFLAGS-y)) \
> -		       $(GOCFLAGS) $(GOCFLAGS-y) \
> -		       $($(call vprefix_lib,$(1),GOCFLAGS)) $($(call vprefix_lib,$(1),GOCFLAGS-y)) \
> -		       $($(call vprefix_src,$(1),$(2),$(3),FLAGS)) $($(call vprefix_src,$(1),$(2),$(3),FLAGS-y)) \
> +		$(GOC) $$(COMPFLAGS) $$(COMPFLAGS-y) \
> +		       $$(GOCINCLUDES) $$(GOCINCLUDES-y) \
> +		       $$($(call vprefix_lib,$(1),GOCINCLUDES)) $$($(call vprefix_lib,$(1),GOCINCLUDES-y)) \
> +		       $$($(call vprefix_src,$(1),$(2),$(3),INCLUDES)) $$($(call vprefix_src,$(1),$(2),$(3),INCLUDES-y)) \
> +		       $$($(call vprefix_glb,$(3),ARCHFLAGS)) $$($(call vprefix_glb,$(3),ARCHFLAGS-y)) \
> +		       $$(GOCFLAGS) $$(GOCFLAGS-y) \
> +		       $$($(call vprefix_lib,$(1),GOCFLAGS)) $$($(call vprefix_lib,$(1),GOCFLAGS-y)) \
> +		       $$($(call vprefix_src,$(1),$(2),$(3),FLAGS)) $$($(call vprefix_src,$(1),$(2),$(3),FLAGS-y)) \
>   		       $(5) \
> -		       $(DBGFLAGS) $(DBGFLAGS-y) \
> +		       $$(DBGFLAGS) $$(DBGFLAGS-y) \
>   		       -D__LIBNAME__=$(1) -D__BASENAME__=$(notdir $(2)) $(if $(3),-D__VARIANT__=$(3)) \
>   		       -c $(2) -o $(4) $(call depflags,$(4))
>   	)
> @@ -533,14 +533,14 @@ endef
>   define buildrule_S_lds =
>   $(4): $(2) | prepare
>   	$(call build_cmd_fixdep,LDS,$(1),$(4),\
> -		$(AS)  -E -P -x assembler-with-cpp $(COMPFLAGS) $(COMPFLAGS-y) \
> -		       $(ASINCLUDES) $(ASINCLUDES-y) \
> -		       $($(call vprefix_lib,$(1),ASINCLUDES)) $($(call vprefix_lib,$(1),ASINCLUDES-y)) \
> -		       $($(call vprefix_src,$(1),$(2),$(3),INCLUDES)) $($(call vprefix_src,$(1),$(2),$(3),INCLUDES-y)) \
> -		       $(ARCHFLAGS) $(ARCHFLAGS-y) \
> -		       $(ASFLAGS) $(ASFLAGS-y) \
> -		       $($(call vprefix_lib,$(1),ASFLAGS)) $($(call vprefix_lib,$(1),ASFLAGS-y)) \
> -		       $($(call vprefix_src,$(1),$(2),$(3),FLAGS)) $($(call vprefix_src,$(1),$(2),$(3),FLAGS-y)) \
> +		$(AS)  -E -P -x assembler-with-cpp $$(COMPFLAGS) $$(COMPFLAGS-y) \
> +		       $$(ASINCLUDES) $$(ASINCLUDES-y) \
> +		       $$($(call vprefix_lib,$(1),ASINCLUDES)) $$($(call vprefix_lib,$(1),ASINCLUDES-y)) \
> +		       $$($(call vprefix_src,$(1),$(2),$(3),INCLUDES)) $$($(call vprefix_src,$(1),$(2),$(3),INCLUDES-y)) \
> +		       $$(ARCHFLAGS) $$(ARCHFLAGS-y) \
> +		       $$(ASFLAGS) $$(ASFLAGS-y) \
> +		       $$($(call vprefix_lib,$(1),ASFLAGS)) $$($(call vprefix_lib,$(1),ASFLAGS-y)) \
> +		       $$($(call vprefix_src,$(1),$(2),$(3),FLAGS)) $$($(call vprefix_src,$(1),$(2),$(3),FLAGS-y)) \
>   		       $(5) \
>   		       $(2) -o $(4) $(call depflags,$(4))
>   	)
> 


From minios-devel-bounces@lists.xenproject.org Wed Aug 05 13:15:22 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Wed, 05 Aug 2020 13:15:22 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1k3JGM-0005Gw-8C; Wed, 05 Aug 2020 13:15:22 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=MzF+=BP=neclab.eu=simon.kuenzer@srs-us1.protection.inumbo.net>)
 id 1k3JGK-0005Go-TK
 for minios-devel@lists.xen.org; Wed, 05 Aug 2020 13:15:20 +0000
X-Inumbo-ID: 415ec453-cc16-4dee-8320-d22917a974d5
Received: from mailer1.neclab.eu (unknown [195.37.70.40])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 415ec453-cc16-4dee-8320-d22917a974d5;
 Wed, 05 Aug 2020 13:15:19 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
 by mailer1.neclab.eu (Postfix) with ESMTP id 321FC104F73;
 Wed,  5 Aug 2020 15:15:18 +0200 (CEST)
X-Virus-Scanned: Amavisd on Debian GNU/Linux (atlas-a.office.hd)
Received: from mailer1.neclab.eu ([127.0.0.1])
 by localhost (atlas-a.office.hd [127.0.0.1]) (amavisd-new, port 10024)
 with ESMTP id 2KrUmdIF6sCd; Wed,  5 Aug 2020 15:15:18 +0200 (CEST)
X-ENC: Last-Hop-TLS-encrypted
X-ENC: Last-Hop-TLS-encrypted
Received: from puck.office.hd (puck.office.hd [192.168.24.91])
 (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
 (No client certificate requested)
 by mailer1.neclab.eu (Postfix) with ESMTPS id 0D7D1104F5C
 for <minios-devel@lists.xen.org>; Wed,  5 Aug 2020 15:15:18 +0200 (CEST)
Received: from [10.7.1.42] (192.168.24.96) by puck.office.hd (192.168.24.91)
 with Microsoft SMTP Server (version=TLS1_2,
 cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1979.3; Wed, 5 Aug 2020
 15:15:17 +0200
Subject: Re: [UNIKRAFT PATCH v4 3/3] lib/uknetdev: Get feature supported on
 uk_netdev
To: Sharan Santhanam <sharan.santhanam@neclab.eu>, <minios-devel@lists.xen.org>
References: <1595321449-30403-1-git-send-email-sharan.santhanam@neclab.eu>
 <1595321449-30403-4-git-send-email-sharan.santhanam@neclab.eu>
From: Simon Kuenzer <simon.kuenzer@neclab.eu>
Message-ID: <00e56002-b3f8-592e-5c0b-43b865a38d45@neclab.eu>
Date: Wed, 5 Aug 2020 15:15:16 +0200
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:68.0)
 Gecko/20100101 Thunderbird/68.11.0
MIME-Version: 1.0
In-Reply-To: <1595321449-30403-4-git-send-email-sharan.santhanam@neclab.eu>
Content-Type: text/plain; charset="utf-8"; format=flowed
Content-Language: en-US
Content-Transfer-Encoding: 7bit
X-Originating-IP: [192.168.24.96]
X-ClientProxiedBy: titania.office.hd (192.168.24.89) To puck.office.hd
 (192.168.24.91)
X-BeenThere: minios-devel@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Mini-os development list <minios-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:minios-devel@lists.xenproject.org>
List-Help: <mailto:minios-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: minios-devel-bounces@lists.xenproject.org
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>

Great! Thanks!

Reviewed-by: Simon Kuenzer <simon.kuenzer@neclab.eu>

On 21.07.20 10:50, Sharan Santhanam wrote:
> The uk_netdev_info provides a way to forward information on netdevice
> to the network stack. We extend this with a bitmap of the features
> supported on device. The bit 0,1 of the bitmap indicates if the
> device supports interrupt.
> 
> Signed-off-by: Sharan Santhanam <sharan.santhanam@neclab.eu>
> ---
>   lib/uknetdev/include/uk/netdev_core.h | 12 ++++++++++++
>   plat/drivers/virtio/virtio_net.c      |  1 +
>   2 files changed, 13 insertions(+)
> 
> diff --git a/lib/uknetdev/include/uk/netdev_core.h b/lib/uknetdev/include/uk/netdev_core.h
> index e9d9113..c170696 100644
> --- a/lib/uknetdev/include/uk/netdev_core.h
> +++ b/lib/uknetdev/include/uk/netdev_core.h
> @@ -77,6 +77,17 @@ UK_TAILQ_HEAD(uk_netdev_list, struct uk_netdev);
>    */
>   #define UK_NETDEV_HWADDR_LEN 6 /**< Length of Ethernet address. */
>   
> +/**
> + * The netdevice support rx/tx interrupt.
> + */
> +#define UK_FEATURE_RXQ_INTR_BIT		    0
> +#define UK_FEATURE_RXQ_INTR_AVAILABLE  (1UL << UK_FEATURE_RXQ_INTR_BIT)
> +#define UK_FEATURE_TXQ_INTR_BIT		    1
> +#define UK_FEATURE_TXQ_INTR_AVAILABLE  (1UL << UK_FEATURE_TXQ_INTR_BIT)
> +
> +#define uk_netdev_rxintr_supported(feature)	\
> +	(feature & (UK_FEATURE_RXQ_INTR_AVAILABLE))
> +
>   struct uk_hwaddr {
>   	uint8_t addr_bytes[UK_NETDEV_HWADDR_LEN];
>   } __packed;
> @@ -91,6 +102,7 @@ struct uk_netdev_info {
>   	uint16_t max_mtu;   /**< Maximum supported MTU size. */
>   	uint16_t nb_encap_tx;  /**< Number of bytes required as headroom for tx. */
>   	uint16_t nb_encap_rx;  /**< Number of bytes required as headroom for rx. */
> +	uint32_t features; /**< bitmap of the features supported */
>   };
>   
>   /**
> diff --git a/plat/drivers/virtio/virtio_net.c b/plat/drivers/virtio/virtio_net.c
> index 3025ed3..0a8312d 100644
> --- a/plat/drivers/virtio/virtio_net.c
> +++ b/plat/drivers/virtio/virtio_net.c
> @@ -1052,6 +1052,7 @@ static void virtio_net_info_get(struct uk_netdev *dev,
>   	dev_info->max_tx_queues = vndev->max_vqueue_pairs;
>   	dev_info->nb_encap_tx = sizeof(struct virtio_net_hdr_padded);
>   	dev_info->nb_encap_rx = sizeof(struct virtio_net_hdr_padded);
> +	dev_info->features = UK_FEATURE_RXQ_INTR_AVAILABLE;
>   }
>   
>   static int virtio_net_start(struct uk_netdev *n)
> 


From minios-devel-bounces@lists.xenproject.org Wed Aug 05 16:11:04 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Wed, 05 Aug 2020 16:11:04 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1k3M0L-0005nq-W4; Wed, 05 Aug 2020 16:11:01 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=QGQH=BP=lancs.ac.uk=a.jung@srs-us1.protection.inumbo.net>)
 id 1k3M0L-0005nh-EI
 for minios-devel@lists.xen.org; Wed, 05 Aug 2020 16:11:01 +0000
X-Inumbo-ID: e753c4ed-c222-46a1-a08b-beedc7508733
Received: from mh-fa-1.lancs.ac.uk (unknown [148.88.65.131])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id e753c4ed-c222-46a1-a08b-beedc7508733;
 Wed, 05 Aug 2020 16:10:59 +0000 (UTC)
Received: from x4db5a9ad.dyn.telefonica.de ([77.181.169.173]
 helo=localhost.localdomain)
 by mh-fa-1.lancs.ac.uk with esmtpsa (TLSv1.2:ECDHE-RSA-AES128-GCM-SHA256:128)
 (Exim 4.92.3) (envelope-from <a.jung@lancs.ac.uk>)
 id 1k3M0H-003S0A-Ax; Wed, 05 Aug 2020 17:10:58 +0100
From: Alexander Jung <a.jung@lancs.ac.uk>
To: minios-devel@lists.xen.org
Subject: [UNIKRAFT PATCH 1/3] lib/vfscore: Reduce pread() and pwrite() to
 their -v() counterparts.
Date: Wed,  5 Aug 2020 18:10:44 +0200
Message-Id: <20200805161046.30662-1-a.jung@lancs.ac.uk>
X-Mailer: git-send-email 2.26.2
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-Spam-Score: -1.0 (-)
X-Spam-Bar: -
X-Spam-Report: Spam detection software, running on the system
 "mh-fa-1.lancs.ac.uk", has processed this message.
 The results are shown below. .
 Content analysis details:   (-1.0 points, 4.1 required) .
 pts rule name              description
 ---- ---------------------- --------------------------------------------------
 -1.0 ALL_TRUSTED            Passed through trusted hosts only via SMTP
X-BeenThere: minios-devel@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Mini-os development list <minios-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:minios-devel@lists.xenproject.org>
List-Help: <mailto:minios-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=subscribe>
Cc: Felipe Huici <felipe.huici@neclab.eu>,
 Simon Kuenzer <simon.kuenzer@neclab.eu>,
 Alexander Jung <alexander.jung@neclab.eu>,
 Sharan Santhanam <sharan.santhanam@neclab.eu>,
 Alexander Jung <a.jung@lancs.ac.uk>
Errors-To: minios-devel-bounces@lists.xenproject.org
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>

This commit reorganizes the pread() and pwrite() method such that they rely on 
preadv() and pwritev(), respectively.  This is due the overlap in 
functionality, where pread() and pwrite() simply create a struct iovec method 
which is to be passed in their relevant sys_ method.

Signed-off-by: Alexander Jung <alexander.jung@neclab.eu>
---
 lib/vfscore/main.c | 37 ++++++++++---------------------------
 1 file changed, 10 insertions(+), 27 deletions(-)

diff --git a/lib/vfscore/main.c b/lib/vfscore/main.c
index 846e2ef..3dcbd51 100644
--- a/lib/vfscore/main.c
+++ b/lib/vfscore/main.c
@@ -307,7 +307,6 @@ static inline int has_error(int error, int bytes)
 			(error != EWOULDBLOCK && error != EINTR));
 }
 
-
 ssize_t pread(int fd, void *buf, size_t count, off_t offset)
 {
 	trace_vfs_pread(fd, buf, count, offset);
@@ -315,25 +314,17 @@ ssize_t pread(int fd, void *buf, size_t count, off_t offset)
 			.iov_base	= buf,
 			.iov_len	= count,
 	};
-	struct vfscore_file *fp;
-	size_t bytes;
 	int error;
 
-	error = fget(fd, &fp);
-	if (error)
+	error = preadv(fd, &iov, 1, offset);
+	if (error < 0)
 		goto out_errno;
 
-	error = sys_read(fp, &iov, 1, offset, &bytes);
-	fdrop(fp);
-
-	if (has_error(error, bytes))
-		goto out_errno;
-	trace_vfs_pread_ret(bytes);
-	return bytes;
+	trace_vfs_pread_ret(error);
+	return error;
 
-	out_errno:
+out_errno:
 	trace_vfs_pread_err(error);
-	errno = error;
 	return -1;
 }
 
@@ -356,25 +347,17 @@ ssize_t pwrite(int fd, const void *buf, size_t count, off_t offset)
 			.iov_base	= (void *)buf,
 			.iov_len	= count,
 	};
-	struct vfscore_file *fp;
-	size_t bytes;
 	int error;
 
-	error = fget(fd, &fp);
-	if (error)
+	error = pwritev(fd, &iov, 1, offset);
+	if (error < 0)
 		goto out_errno;
 
-	error = sys_write(fp, &iov, 1, offset, &bytes);
-	fdrop(fp);
-
-	if (has_error(error, bytes))
-		goto out_errno;
-	trace_vfs_pwrite_ret(bytes);
-	return bytes;
+	trace_vfs_pwrite_ret(error);
+	return error;
 
-	out_errno:
+out_errno:
 	trace_vfs_pwrite_err(error);
-	errno = error;
 	return -1;
 }
 
-- 
2.11.0



From minios-devel-bounces@lists.xenproject.org Wed Aug 05 16:11:04 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Wed, 05 Aug 2020 16:11:04 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1k3M0O-0005o2-1Q; Wed, 05 Aug 2020 16:11:04 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=QGQH=BP=lancs.ac.uk=a.jung@srs-us1.protection.inumbo.net>)
 id 1k3M0N-0005nx-Kj
 for minios-devel@lists.xen.org; Wed, 05 Aug 2020 16:11:03 +0000
X-Inumbo-ID: 8507710f-b08e-4130-b219-31d4ffe69be7
Received: from mh-fa-1.lancs.ac.uk (unknown [148.88.65.131])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 8507710f-b08e-4130-b219-31d4ffe69be7;
 Wed, 05 Aug 2020 16:11:02 +0000 (UTC)
Received: from x4db5a9ad.dyn.telefonica.de ([77.181.169.173]
 helo=localhost.localdomain)
 by mh-fa-1.lancs.ac.uk with esmtpsa (TLSv1.2:ECDHE-RSA-AES128-GCM-SHA256:128)
 (Exim 4.92.3) (envelope-from <a.jung@lancs.ac.uk>)
 id 1k3M0K-003S0A-AU; Wed, 05 Aug 2020 17:11:01 +0100
From: Alexander Jung <a.jung@lancs.ac.uk>
To: minios-devel@lists.xen.org
Subject: [UNIKRAFT PATCH 2/3] lib/vfscore: Change preadv and pwritev fd error
 handling.
Date: Wed,  5 Aug 2020 18:10:45 +0200
Message-Id: <20200805161046.30662-2-a.jung@lancs.ac.uk>
X-Mailer: git-send-email 2.26.2
In-Reply-To: <20200805161046.30662-1-a.jung@lancs.ac.uk>
References: <20200805161046.30662-1-a.jung@lancs.ac.uk>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-Spam-Score: -1.0 (-)
X-Spam-Bar: -
X-Spam-Report: Spam detection software, running on the system
 "mh-fa-1.lancs.ac.uk", has processed this message.
 The results are shown below. .
 Content analysis details:   (-1.0 points, 4.1 required) .
 pts rule name              description
 ---- ---------------------- --------------------------------------------------
 -1.0 ALL_TRUSTED            Passed through trusted hosts only via SMTP
X-BeenThere: minios-devel@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Mini-os development list <minios-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:minios-devel@lists.xenproject.org>
List-Help: <mailto:minios-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=subscribe>
Cc: Felipe Huici <felipe.huici@neclab.eu>,
 Simon Kuenzer <simon.kuenzer@neclab.eu>,
 Alexander Jung <alexander.jung@neclab.eu>,
 Sharan Santhanam <sharan.santhanam@neclab.eu>,
 Alexander Jung <a.jung@lancs.ac.uk>
Errors-To: minios-devel-bounces@lists.xenproject.org
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>

This commit discards the `has_error` method in favour of in-line checks against 
the file descriptor.  In BSD's internal implementation, the error is simply 
passed upwards from `dofilewrite` and `dofileread.  Additionally, the 
`has_error` method would return a false positive in the circumstance where an
error was non-zero and did not constitute a EWOULDBLOCK or EINTR and the number 
of bytes read was greater than zero.  This scenario was discovered when a 
buffer greater than the number of bytes available was read from a vnop read op 
which returns the number of bytes read (as per POSIX requirements).

Additional checks inline with FreeBSD's[0][1] implementation are for whether 
the fd is seekable; the offset of the file is non-zero; and, the file type is 
not a character device.

[0]: https://github.com/freebsd/freebsd/blob/6af4a8cb884975f65a51b3b6d766e084faf55d4f/sys/kern/sys_generic.c#L320
[1]: https://github.com/freebsd/freebsd/blob/6af4a8cb884975f65a51b3b6d766e084faf55d4f/sys/kern/sys_generic.c#L522

Signed-off-by: Alexander Jung <alexander.jung@neclab.eu>
---
 lib/vfscore/main.c | 61 +++++++++++++++++++++++++++++++++++-------------------
 1 file changed, 40 insertions(+), 21 deletions(-)

diff --git a/lib/vfscore/main.c b/lib/vfscore/main.c
index 3dcbd51..0cbcd21 100644
--- a/lib/vfscore/main.c
+++ b/lib/vfscore/main.c
@@ -294,19 +294,6 @@ UK_TRACEPOINT(trace_vfs_pread, "%d %p 0x%x 0x%x", int, void*, size_t, off_t);
 UK_TRACEPOINT(trace_vfs_pread_ret, "0x%x", ssize_t);
 UK_TRACEPOINT(trace_vfs_pread_err, "%d", int);
 
-// In BSD's internal implementation of read() and write() code, for example
-// sosend_generic(), a partial read or write returns both an EWOULDBLOCK error
-// *and* a non-zero number of written bytes. In that case, we need to zero the
-// error, so the system call appear a successful partial read/write.
-// In FreeBSD, dofilewrite() and dofileread() (sys_generic.c) do this too.
-static inline int has_error(int error, int bytes)
-{
-	/* TODO: OSv checks also for ERESTART */
-	return error && (
-			(bytes == 0) ||
-			(error != EWOULDBLOCK && error != EINTR));
-}
-
 ssize_t pread(int fd, void *buf, size_t count, off_t offset)
 {
 	trace_vfs_pread(fd, buf, count, offset);
@@ -378,14 +365,30 @@ ssize_t preadv(int fd, const struct iovec *iov, int iovcnt, off_t offset)
 	if (error)
 		goto out_errno;
 
+	/* Check if the file is indeed seekable. */
+	if (!(fp->f_vfs_flags & UK_VFSCORE_NOPOS)) {
+		error = ESPIPE;
+		goto out_errno_fdrop;
+	}
+	/* Check if the file has not already been read and that is not a
+	 * character device. */
+	else if (fp->f_offset < 0 && \
+		(fp->f_dentry == NULL || fp->f_dentry->d_vnode->v_type != VCHR)) {
+		error = EINVAL;
+		goto out_errno_fdrop;
+	}
+	/* Otherwise, try to read the file. */
 	error = sys_read(fp, iov, iovcnt, offset, &bytes);
-	fdrop(fp);
+	if (error < 0)
+		goto out_errno_fdrop;
 
-	if (has_error(error, bytes))
-		goto out_errno;
+	fdrop(fp);
 	return bytes;
 
-	out_errno:
+out_errno_fdrop:
+	fdrop(fp);
+
+out_errno:
 	errno = error;
 	return -1;
 }
@@ -414,15 +417,31 @@ ssize_t pwritev(int fd, const struct iovec *iov, int iovcnt, off_t offset)
 	if (error)
 		goto out_errno;
 
+	/* Check if the file is indeed seekable. */
+	if (!(fp->f_vfs_flags & UK_VFSCORE_NOPOS)) {
+		error = ESPIPE;
+		goto out_errno_fdrop;
+	}
+	/* Check if the file has not already been written to and that it is not a
+	 * character device. */
+	else if (fp->f_offset < 0 && \
+		(fp->f_dentry == NULL || fp->f_dentry->d_vnode->v_type != VCHR)) {
+		error = EINVAL;
+		goto out_errno_fdrop;
+	}
+	/* Otherwise, try to read the file. */
 	error = sys_write(fp, iov, iovcnt, offset, &bytes);
-	fdrop(fp);
+	if (error < 0)
+		goto out_errno_fdrop;
 
-	if (has_error(error, bytes))
-		goto out_errno;
+	fdrop(fp);
 	trace_vfs_pwritev_ret(bytes);
 	return bytes;
 
-	out_errno:
+out_errno_fdrop:
+	fdrop(fp);
+
+out_errno:
 	trace_vfs_pwritev_err(error);
 	errno = error;
 	return -1;
-- 
2.11.0



From minios-devel-bounces@lists.xenproject.org Wed Aug 05 16:11:07 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Wed, 05 Aug 2020 16:11:07 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1k3M0R-0005pJ-40; Wed, 05 Aug 2020 16:11:07 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=QGQH=BP=lancs.ac.uk=a.jung@srs-us1.protection.inumbo.net>)
 id 1k3M0Q-0005nh-CJ
 for minios-devel@lists.xen.org; Wed, 05 Aug 2020 16:11:06 +0000
X-Inumbo-ID: 3e155c58-f63d-46d1-a9ae-2aa9a1790c83
Received: from mh-fa-1.lancs.ac.uk (unknown [148.88.65.131])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 3e155c58-f63d-46d1-a9ae-2aa9a1790c83;
 Wed, 05 Aug 2020 16:11:04 +0000 (UTC)
Received: from x4db5a9ad.dyn.telefonica.de ([77.181.169.173]
 helo=localhost.localdomain)
 by mh-fa-1.lancs.ac.uk with esmtpsa (TLSv1.2:ECDHE-RSA-AES128-GCM-SHA256:128)
 (Exim 4.92.3) (envelope-from <a.jung@lancs.ac.uk>)
 id 1k3M0N-003S0A-A5; Wed, 05 Aug 2020 17:11:04 +0100
From: Alexander Jung <a.jung@lancs.ac.uk>
To: minios-devel@lists.xen.org
Subject: [UNIKRAFT PATCH 3/3] lib/vfscore: Add preadv tracepoints
Date: Wed,  5 Aug 2020 18:10:46 +0200
Message-Id: <20200805161046.30662-3-a.jung@lancs.ac.uk>
X-Mailer: git-send-email 2.26.2
In-Reply-To: <20200805161046.30662-1-a.jung@lancs.ac.uk>
References: <20200805161046.30662-1-a.jung@lancs.ac.uk>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-Spam-Score: -1.0 (-)
X-Spam-Bar: -
X-Spam-Report: Spam detection software, running on the system
 "mh-fa-1.lancs.ac.uk", has processed this message.
 The results are shown below. .
 Content analysis details:   (-1.0 points, 4.1 required) .
 pts rule name              description
 ---- ---------------------- --------------------------------------------------
 -1.0 ALL_TRUSTED            Passed through trusted hosts only via SMTP
X-BeenThere: minios-devel@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Mini-os development list <minios-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:minios-devel@lists.xenproject.org>
List-Help: <mailto:minios-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=subscribe>
Cc: Felipe Huici <felipe.huici@neclab.eu>,
 Simon Kuenzer <simon.kuenzer@neclab.eu>,
 Alexander Jung <alexander.jung@neclab.eu>,
 Sharan Santhanam <sharan.santhanam@neclab.eu>,
 Alexander Jung <a.jung@lancs.ac.uk>
Errors-To: minios-devel-bounces@lists.xenproject.org
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>

Signed-off-by: Alexander Jung <alexander.jung@neclab.eu>
---
 lib/vfscore/main.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/lib/vfscore/main.c b/lib/vfscore/main.c
index 0cbcd21..13697b8 100644
--- a/lib/vfscore/main.c
+++ b/lib/vfscore/main.c
@@ -355,12 +355,18 @@ UK_SYSCALL_DEFINE(ssize_t, write, int, fd, const void *, buf, size_t, count)
 	return pwrite(fd, buf, count, -1);
 }
 
+UK_TRACEPOINT(trace_vfs_preadv, "%d %p 0x%x 0x%x", int, const struct iovec*,
+	      int, off_t);
+UK_TRACEPOINT(trace_vfs_preadv_ret, "0x%x", ssize_t);
+UK_TRACEPOINT(trace_vfs_preadv_err, "%d", int);
+
 ssize_t preadv(int fd, const struct iovec *iov, int iovcnt, off_t offset)
 {
 	struct vfscore_file *fp;
 	size_t bytes;
 	int error;
 
+	trace_vfs_preadv(fd, iov, iovcnt, offset);
 	error = fget(fd, &fp);
 	if (error)
 		goto out_errno;
@@ -383,6 +389,7 @@ ssize_t preadv(int fd, const struct iovec *iov, int iovcnt, off_t offset)
 		goto out_errno_fdrop;
 
 	fdrop(fp);
+	trace_vfs_preadv_ret(bytes);
 	return bytes;
 
 out_errno_fdrop:
@@ -390,6 +397,7 @@ out_errno_fdrop:
 
 out_errno:
 	errno = error;
+	trace_vfs_preadv_err(error);
 	return -1;
 }
 
-- 
2.11.0



From minios-devel-bounces@lists.xenproject.org Thu Aug 06 18:01:50 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Thu, 06 Aug 2020 18:01:50 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1k3kD5-0000Gn-1t; Thu, 06 Aug 2020 18:01:47 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <SRS0=igPe=BQ=gmail.com=razvand@srs-us1.protection.inumbo.net>)
 id 1k3kD3-0000Gi-Nv
 for minios-devel@lists.xenproject.org; Thu, 06 Aug 2020 18:01:45 +0000
X-Inumbo-ID: 6b0e4aa8-f047-4902-838f-4f1204f0f4d1
Received: from mail-wm1-x342.google.com (unknown [2a00:1450:4864:20::342])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 6b0e4aa8-f047-4902-838f-4f1204f0f4d1;
 Thu, 06 Aug 2020 18:01:43 +0000 (UTC)
Received: by mail-wm1-x342.google.com with SMTP id d190so9597244wmd.4
 for <minios-devel@lists.xenproject.org>; Thu, 06 Aug 2020 11:01:43 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=sender:from:to:cc:subject:references:date:in-reply-to:message-id
 :user-agent:mime-version;
 bh=zZidEgOqPXzmrVG/n7PE9XCXbwqSI2Auu/U1CcZetX8=;
 b=ddmYyb2S7OqK2g/RPOYMHlLpsT+Zuf7tcquUUybirrEGESMRrS5VfdOk7fBKgCVcrA
 55H4AYQqmNFYO/Eoy42GFPQwtTaXrEOyhlXzEuaSL3xsRM6pqSWqB3JIvedF/Q9D+Q0U
 el0+hUcDZtKIEFFrva9J+Vac+lIAH+7Stz3HQcXwy+CAqKg+XJs7tFFa32eHe0DDxl2J
 tvf7OOlPmdzzwdkbNldFbi5Q1DoGEmzVul/b1WuLiocyXvgL5dnq4zpzUZt7NJhADEP8
 Sh5Ph9Ap0vwB4o6bYDaZKoGtMgp58wcdATYSn5ttNoWMv7K3Lrj1I5ppd7aZcOtYCkJe
 SBxg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:sender:from:to:cc:subject:references:date
 :in-reply-to:message-id:user-agent:mime-version;
 bh=zZidEgOqPXzmrVG/n7PE9XCXbwqSI2Auu/U1CcZetX8=;
 b=Q8hRelYWkZZzoh7Ej3Sy++kWkTYip8zAch5+xv6diA5H6yUncDQw3QMGa+N/LWhXvW
 4iu9JXs6ftM/azwrVtsqjINo4M5XIkekUjcroZRzYyDvNjg5YPN36wmfMWhbj7pXoSBE
 QfM4PoYFy1n5l/qgKWoWF9W1Gtfg+srJnt4bFHT998ElOgHMyb2OvA0BiGq08x3FWAN8
 /pVI0gRSdd3o2k74DnySVcYHkZTrf0jok2kzBc7huhjAaSbviZsDZLqA21tAopP+GcOm
 hSzL8+ffOz6jVXN6lua0LvdNFrx3Mms1G2etEk/IrgPiiLoOy+0ZnLhY/RU119/XoDnh
 UhJA==
X-Gm-Message-State: AOAM532zqwzuBr80ECyclybhStuK0hDUV2tups0XZ00P+MOdn8YSkz/0
 2oJbLJ5kB70R+SHjrEEAexE=
X-Google-Smtp-Source: ABdhPJym/nOwD5SDOnIVP7+zLvGFSoXKYYu6bvpiiYRUbjpuB/gZgC42SoIXrB+DslLR+Qyj8JLMCQ==
X-Received: by 2002:a05:600c:2215:: with SMTP id
 z21mr9668645wml.159.1596736902459; 
 Thu, 06 Aug 2020 11:01:42 -0700 (PDT)
Received: from localhost ([141.85.233.147])
 by smtp.gmail.com with ESMTPSA id s19sm8212495wrb.54.2020.08.06.11.01.41
 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256);
 Thu, 06 Aug 2020 11:01:41 -0700 (PDT)
From: Razvan Deaconescu <razvan.deaconescu@cs.pub.ro>
To: Jia He <justin.he@arm.com>
Subject: Re: [[UNIKRAFT PATCH] lib/uk9p,
 9pfs: Change file mode from uint8_t to uint32_t
References: <20200520095205.55288-1-justin.he@arm.com>
Date: Thu, 06 Aug 2020 21:01:41 +0300
In-Reply-To: <20200520095205.55288-1-justin.he@arm.com> (Jia He's message of
 "Wed, 20 May 2020 17:52:05 +0800")
Message-ID: <86r1sjzm9m.fsf@drone.cs.pub.ro>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-BeenThere: minios-devel@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Mini-os development list <minios-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:minios-devel@lists.xenproject.org>
List-Help: <mailto:minios-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=subscribe>
Cc: Felipe Huici <felipe.huici@neclab.eu>, minios-devel@lists.xenproject.org,
 Kaly Xin <Kaly.Xin@arm.com>, Sharan.Santhanam@neclab.eu,
 Cristian Banu <cristb@gmail.com>, Simon Kuenzer <simon.kuenzer@neclab.eu>
Errors-To: minios-devel-bounces@lists.xenproject.org
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>

All good.

Reviewed-by: Razvan Deaconescu <razvan.deaconescu@cs.pub.ro>

Jia He <justin.he@arm.com> writes:
> At least UK_9P_OEXCL(0x1000) is uint8_t overflowed. To avoid potential
> file mode undesigned truncating, change it uint8_t to uint32_t.
>
> Signed-off-by: Jia He <justin.he@arm.com>
> ---
>  lib/9pfs/9pfs_vnops.c    | 6 +++---
>  lib/uk9p/9p.c            | 4 ++--
>  lib/uk9p/include/uk/9p.h | 4 ++--
>  3 files changed, 7 insertions(+), 7 deletions(-)
>
> diff --git a/lib/9pfs/9pfs_vnops.c b/lib/9pfs/9pfs_vnops.c
> index c81c82a..5a0700c 100644
> --- a/lib/9pfs/9pfs_vnops.c
> +++ b/lib/9pfs/9pfs_vnops.c
> @@ -47,10 +47,10 @@
>  
>  #include "9pfs.h"
>  
> -static uint8_t uk_9pfs_open_mode_from_posix_flags(unsigned long flags)
> +static uint32_t uk_9pfs_open_mode_from_posix_flags(int flags)
>  {
> -	uint8_t mode = 0;
> -	uint8_t flags_rw = flags & (UK_FREAD | UK_FWRITE);
> +	uint32_t mode = 0;
> +	uint32_t flags_rw = flags & (UK_FREAD | UK_FWRITE);
>  
>  	if (flags_rw == UK_FREAD)
>  		mode = UK_9P_OREAD;
> diff --git a/lib/uk9p/9p.c b/lib/uk9p/9p.c
> index 9ac7e8a..abddb60 100644
> --- a/lib/uk9p/9p.c
> +++ b/lib/uk9p/9p.c
> @@ -266,7 +266,7 @@ out:
>  	return newfid;
>  }
>  
> -int uk_9p_open(struct uk_9pdev *dev, struct uk_9pfid *fid, uint8_t mode)
> +int uk_9p_open(struct uk_9pdev *dev, struct uk_9pfid *fid, uint32_t mode)
>  {
>  	struct uk_9preq *req;
>  	int rc = 0;
> @@ -294,7 +294,7 @@ out:
>  }
>  
>  int uk_9p_create(struct uk_9pdev *dev, struct uk_9pfid *fid,
> -		const char *name, uint32_t perm, uint8_t mode,
> +		const char *name, uint32_t perm, uint32_t mode,
>  		const char *extension)
>  {
>  	struct uk_9preq *req;
> diff --git a/lib/uk9p/include/uk/9p.h b/lib/uk9p/include/uk/9p.h
> index 59d18d9..e91b147 100644
> --- a/lib/uk9p/include/uk/9p.h
> +++ b/lib/uk9p/include/uk/9p.h
> @@ -129,7 +129,7 @@ struct uk_9pfid *uk_9p_walk(struct uk_9pdev *dev, struct uk_9pfid *fid,
>   *   - 0: Successful.
>   *   - (< 0): An error occurred.
>   */
> -int uk_9p_open(struct uk_9pdev *dev, struct uk_9pfid *fid, uint8_t mode);
> +int uk_9p_open(struct uk_9pdev *dev, struct uk_9pfid *fid, uint32_t mode);
>  
>  /**
>   * Creates a new file with the given name in the directory associated with fid,
> @@ -153,7 +153,7 @@ int uk_9p_open(struct uk_9pdev *dev, struct uk_9pfid *fid, uint8_t mode);
>   *   - (< 0): An error occurred.
>   */
>  int uk_9p_create(struct uk_9pdev *dev, struct uk_9pfid *fid,
> -		const char *name, uint32_t perm, uint8_t mode,
> +		const char *name, uint32_t perm, uint32_t mode,
>  		const char *extension);
>  
>  /**


From minios-devel-bounces@lists.xenproject.org Thu Aug 06 18:22:36 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Thu, 06 Aug 2020 18:22:36 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1k3kXD-00028D-3s; Thu, 06 Aug 2020 18:22:35 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <SRS0=igPe=BQ=gmail.com=razvand@srs-us1.protection.inumbo.net>)
 id 1k3kXC-000288-HV
 for minios-devel@lists.xen.org; Thu, 06 Aug 2020 18:22:34 +0000
X-Inumbo-ID: 95ead61c-4262-419a-afdb-67ca73045789
Received: from mail-wm1-x343.google.com (unknown [2a00:1450:4864:20::343])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 95ead61c-4262-419a-afdb-67ca73045789;
 Thu, 06 Aug 2020 18:22:32 +0000 (UTC)
Received: by mail-wm1-x343.google.com with SMTP id k20so10575172wmi.5
 for <minios-devel@lists.xen.org>; Thu, 06 Aug 2020 11:22:32 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=sender:from:to:cc:subject:references:date:in-reply-to:message-id
 :user-agent:mime-version;
 bh=GAesT1EMQNH/hPRvBDUaOSq+oGe22TJ4faJqllxMKGs=;
 b=M3J03vEgD9ntFdsoYtDsSE/3Kxn9Q8wgqo8r0nfIWYykuZQvki/eusnN5SqWM+o7aX
 fGygl0v0faIELDaNJs4PYB6zV9y3OXFMGzr7OC5+XKMW8ETgg++NwLmtGC1Qlpr9JLWl
 Kitrgxk59T0I2RsrdKpy10c6RXNbKGfig1lqNKfjUivb02IeZnD9h9XMN2M32DpmfHPr
 3K0ynqI0iP1gbzkUSbaaY4Cmu4XiKqirLpl8MG+NM7ijvL9Jc3OkO0E4zJDWqtXvDEvs
 ososWgkJGosnsTFfTkTiyfRw1fu92RFrKKuZwsgZqAM2rIJVsAjvbo5Kb4jhfv+s6fa8
 /ZGw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:sender:from:to:cc:subject:references:date
 :in-reply-to:message-id:user-agent:mime-version;
 bh=GAesT1EMQNH/hPRvBDUaOSq+oGe22TJ4faJqllxMKGs=;
 b=HQgoNbVdfsRHMEmwtg8iJ4j2TCF1ZjY2niMDS0gtepbkPtlPLVTM7of0utHQqwWold
 JjQwF6iwdSD2ONUUkT8LUAt8v8/upguvbI/bLxms+wrphPIdiMD91hv0yiBsXDhLuXjt
 Bcj9Hdo/dJ29IhUw4SWP3XhZqttzpKHs2lgZ7F3GeAY4VdhOOQGgOfcYzOW3THb7Fp1v
 AgHmx6ymIU7G351NI2x842aGbHbL2+z3YkuqWSM6XDPNKhvHq2/tEnLqV7oS34rGB8Q5
 LG1zxRHgR6WYqGe6TUyNDoOmbpwbW92HgNMqXoNlkWiTZsETukH3qKMvNb27CCP0PJWF
 PSPg==
X-Gm-Message-State: AOAM532C1r3R1X0UgoM33A32k/Y25+rWbHHBohG4qBmTqvJImolGJu0c
 QE/5cWNLiAQlG9OgPdaOqio=
X-Google-Smtp-Source: ABdhPJyNFfBOSwdc2fBkFoC6sUxNewzxnw9A5S8qo4t2WHBzBhtnGVEHrNuuNqlLIRxaY6o0boUPsA==
X-Received: by 2002:a1c:bc54:: with SMTP id m81mr8965171wmf.60.1596738151157; 
 Thu, 06 Aug 2020 11:22:31 -0700 (PDT)
Received: from localhost ([141.85.233.147])
 by smtp.gmail.com with ESMTPSA id d23sm7372411wmd.27.2020.08.06.11.22.29
 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256);
 Thu, 06 Aug 2020 11:22:30 -0700 (PDT)
From: Razvan Deaconescu <razvan.deaconescu@cs.pub.ro>
To: Alexander Jung <a.jung@lancs.ac.uk>
Subject: Re: [UNIKRAFT PATCH] lib/uksched: Add to error message for stack
 alloc failure.
References: <20200714125930.91234-1-a.jung@lancs.ac.uk>
Date: Thu, 06 Aug 2020 21:22:29 +0300
In-Reply-To: <20200714125930.91234-1-a.jung@lancs.ac.uk> (Alexander Jung's
 message of "Tue, 14 Jul 2020 14:59:18 +0200")
Message-ID: <86mu37zlay.fsf@drone.cs.pub.ro>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-BeenThere: minios-devel@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Mini-os development list <minios-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:minios-devel@lists.xenproject.org>
List-Help: <mailto:minios-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=subscribe>
Cc: Felipe Huici <felipe.huici@neclab.eu>,
 Simon Kuenzer <simon.kuenzer@neclab.eu>,
 Alexander Jung <alexander.jung@neclab.eu>, minios-devel@lists.xen.org,
 Sharan Santhanam <sharan.santhanam@neclab.eu>
Errors-To: minios-devel-bounces@lists.xenproject.org
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>

All good.

Reviewed-by: Razvan Deaconescu <razvan.deaconescu@cs.pub.ro>

Alexander Jung <a.jung@lancs.ac.uk> writes:
> From: Alexander Jung <alexander.jung@neclab.eu>
>
> The reason for failing to allocate the stack is caused by lack of
> memory.  This patch adds this information to this error message in
> order to ease usage of Unikraft as it is a common question which
> requires troubleshooting.
>
> Signed-off-by: Alexander Jung <alexander.jung@neclab.eu>
> ---
>  lib/uksched/sched.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/lib/uksched/sched.c b/lib/uksched/sched.c
> index ef195c3..4b8e149 100644
> --- a/lib/uksched/sched.c
> +++ b/lib/uksched/sched.c
> @@ -143,7 +143,7 @@ static void *create_stack(struct uk_alloc *allocator)
>  
>  	if (uk_posix_memalign(allocator, &stack,
>  			      STACK_SIZE, STACK_SIZE) != 0) {
> -		uk_pr_err("Failed to allocate thread stack\n");
> +		uk_pr_err("Failed to allocate thread stack: Not enough memory\n");
>  		return NULL;
>  	}


From minios-devel-bounces@lists.xenproject.org Fri Aug 07 05:59:26 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Fri, 07 Aug 2020 05:59:26 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1k3vPX-00019m-4K; Fri, 07 Aug 2020 05:59:23 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=tQ05=BR=gmail.com=2309bmcristi@srs-us1.protection.inumbo.net>)
 id 1k3vPV-00019h-1z
 for minios-devel@lists.xen.org; Fri, 07 Aug 2020 05:59:21 +0000
X-Inumbo-ID: ea611af0-0609-44f5-9225-14bef0dfccc8
Received: from mail-pg1-x542.google.com (unknown [2607:f8b0:4864:20::542])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id ea611af0-0609-44f5-9225-14bef0dfccc8;
 Fri, 07 Aug 2020 05:59:19 +0000 (UTC)
Received: by mail-pg1-x542.google.com with SMTP id j21so379992pgi.9
 for <minios-devel@lists.xen.org>; Thu, 06 Aug 2020 22:59:19 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=date:from:reply-to:to:cc:message-id:in-reply-to:references:subject
 :mime-version; bh=qmt+AWMZ9e2uFyXOpHr+3CzbPk8ZjynkdemYcbfdtC8=;
 b=O6rpdEaGyNVKtfTkqfB3eD/E7NN4BGg8IcrK4LAEwsBDNyez+DaOLRTT0slr8cRbPe
 gQLtVWnQAktDWqM/R0qhwXJupaYjHYpJhjBinCP/0x3qWl9HvdP5eYj1I+7N5M2SU9wO
 0/PGHnXk+Sq6oUsjYbqIUfmAd9MSThYniTLuBrDIP6yE8F9QpnGiwZ8xJmTcNbCWaWb9
 s7K+JhJc4ByaY/b+olDKhqHPZbynNbRw0at8W4GZ/vGLQxybSxCTgZENoTpzbV9qGVpZ
 fcuMvcqc8bLJ7mxckiD9dWbHEfr3/pSkzwU4K9IEAzxRMJOY++w9+uaITh2nzgqRuent
 YlrQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:date:from:reply-to:to:cc:message-id:in-reply-to
 :references:subject:mime-version;
 bh=qmt+AWMZ9e2uFyXOpHr+3CzbPk8ZjynkdemYcbfdtC8=;
 b=IRpZ68iGwCfSXIYdtbKRXAkXypNYeDGaQgbOAO1uXGqAkhqI2n3o9LBT2pb2VIdgT4
 xiB/cIP3IQf3awSf+2Oj+xt7hNU2xQaMN9+cELeKrs8u0ZdFfBgj8rHqTaSqNo+n9230
 vKuR6xL0beJkbwjSFRNsaQGz4N3tI/g0zP0+/VwkkoOHORYdFRdAw9AHg7lEnW3EfO4t
 1cG0XWgKxoQNg6hbErP8s+ly3l9OPaXUQ2sVmCZCqVOh8IEZIUHFdrHBhYuUj7pQbr5a
 g1N/ELWkOxG6E1Efc3MV4UlGFVBDLHMplneSuXdq5LeLKmC8o7Tj/mKhG2Md2ZODCG6f
 n+MQ==
X-Gm-Message-State: AOAM530PeqO5waNfjajBEil4//yQgyj0OwnzE+Jyq+Id0gIEgwnqsFdH
 h4rsbG5OFywP0LYWXpzljT0Ou3/run8=
X-Google-Smtp-Source: ABdhPJz60+OLHQeEBEDzsmYm21gj0qrFWmOEbJXSmlkyUu+5BrGEg014i0lUgVroAc/SkrV/nPX2Jg==
X-Received: by 2002:a63:1211:: with SMTP id h17mr8954846pgl.265.1596779958778; 
 Thu, 06 Aug 2020 22:59:18 -0700 (PDT)
Received: from sonic302-20.consmr.mail.gq1.yahoo.com
 (sonic302-20.consmr.mail.gq1.yahoo.com. [98.137.68.146])
 by smtp.gmail.com with ESMTPSA id a2sm11989000pfh.152.2020.08.06.22.59.17
 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
 Thu, 06 Aug 2020 22:59:18 -0700 (PDT)
X-YMail-OSG: TaNqKuYVM1kzWW8naID3iUtSzeipL8_QMG32QmLO8JVuDbtyiZjmCnWP1w10YAv
 b_uIrbXcEinqJL8lg.M4HhMZ5LnBm9hO7Sjvp6ndCLwyqzzLhS8NGnZz27DOyBtTSkEPRAd9na0v
 cq.NZkUy2ZGmxCx7AnFZ6Ge0NXksaGMyVFDRDruzyi8xeGdXQ7zfX5I8skIJgS7SY_qsI0lMUw.p
 wRyWjUL13oV2Kc0vPkCPARFiTH8aD599J13PNAYnUwChRw68WjuTKctso06h2MrYkJZAArK1UTFS
 LpF9bgofCcfM6DNHmoN4gTN4cBAzI1GZ4ALjd8j8o2eWYy5oKId39Qrve2VBWV77ONIw_a5O3nQ6
 TSmunb6AkjSUA4JcHZI.W0ytYNW6dJkd7sINxPqOlHlWe04zzxzNP_KQ2jmDcFJuf1DPeexwlcdC
 VFH.TyiWCC589I29UxfIXsaZ7jhicc4MPnMa4DPtfi0O9hkR38FqADdtZDk_0sfeu3MQqAJbVShf
 1HQ.ZKr9OkrwV4mHDx7g0NX5MtpWuXyHrNvEnGfiGCgAvZyY1VBNvGjnAqIKP6.8tvx6joDWQkil
 8a9B5UBInfBGRU1ymuq9GUzoLXvXVAu1yf8P98cPCIhyqwSmWnhdXAyubXKvDN94p0YI5GeIDAEN
 Js4AIbxeSILi3bdE0Ni62rDKZqJrc8I7XVLHANYSxXtc3LyuPZayYQyTbgsLM1qMpzqtIxQBHOER
 s2v7goQzoNOZHI499SA829EKdMxNzFvboWnxeQUVK.9obiVtU.fi_C0DrqrjFFAMuhD6OKOvWT_8
 6ysy8vDUAeRZV0by75KmcZWXOVf1jfiat8fJuToRd69uJw_IhvyAQ9FoCXHkUAWxhSBuEVWhrNQs
 867hPoTXrTv4iBMhX08OxDKAB9iF4_eAqS_Hp54xdxslJs9r2OPQiKyfjnGhtq7pDoYWGWYA8Tai
 JQVZICi46smD9qAdzE30e7kuSKKrYY4.HS3d8Y5_ON4eQinyT4E_cLS74xMUa2xHXTU1dIzesHat
 HtrWtdmKS3OOz7.VjAJDeO37vobP581oSj_IrwP4IBo8ZCDlOTtPTV9n2IOY4eGXIjZth2505BW7
 zmvvMBYYl9lth0_3rVMRy_L1hZNUM0o8RGL9Irtzg8_yIoJ69qQzIgeATU_bXk4rm2qmHRnMYdZs
 g9n30sTHJ_d_vQkZOqoHxRr07FrSloWNSVd8R2aB6qbfOgvBehlaQ.RMYjpa00_4DCou8ffkmwlA
 6eqaFcOdQiSULdKqHJIrM85OSOfSuAyCeccLQwfAFRIPBbBQiYbAfzupCUVs4V.gHyaNOMePY0BJ
 CkUhuv1AeLixdZTXvlbTMvfzhc_pdAS_2UEwXvzChU84.zdTVyg542HOiMM5Ke5qAPZJkJVHNLY4
 -
Received: from sonic.gate.mail.ne1.yahoo.com by
 sonic302.consmr.mail.gq1.yahoo.com with HTTP; Fri, 7 Aug 2020 05:59:17 +0000
Date: Fri, 7 Aug 2020 05:58:58 +0000 (UTC)
From: "2309bmcristi@gmail.com" <2309bmcristi@gmail.com>
To: minios-devel@lists.xen.org, Alexander Jung <a.jung@lancs.ac.uk>
Message-ID: <37506022.1044983.1596779938856@mail.yahoo.com>
In-Reply-To: <20200730094100.1473-1-a.jung@lancs.ac.uk>
References: <20200730094100.1473-1-a.jung@lancs.ac.uk>
Subject: Re: [UNIKRAFT PATCH] include: Move UK_NARGS into essentials.h
MIME-Version: 1.0
Content-Type: multipart/alternative; 
 boundary="----=_Part_1044982_243321884.1596779938853"
X-Mailer: WebService/1.1.16436 YMailNorrin Mozilla/5.0 (X11;
 Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko)
 Chrome/77.0.3865.120 Safari/537.36
Content-Length: 5972
X-BeenThere: minios-devel@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Mini-os development list <minios-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:minios-devel@lists.xenproject.org>
List-Help: <mailto:minios-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=subscribe>
Reply-To: "2309bmcristi@gmail.com" <2309bmcristi@gmail.com>
Cc: Felipe Huici <felipe.huici@neclab.eu>,
 Simon Kuenzer <simon.kuenzer@neclab.eu>,
 Alexander Jung <alexander.jung@neclab.eu>,
 Sharan Santhanam <sharan.santhanam@neclab.eu>
Errors-To: minios-devel-bounces@lists.xenproject.org
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>

------=_Part_1044982_243321884.1596779938853
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

 All good.

Reviewed-by: Marius-Cristian Baciu <marius.baciu@stud.acs.upb.ro>

    On Thursday, July 30, 2020, 12:41:39 PM GMT+3, Alexander Jung <a.jung@l=
ancs.ac.uk> wrote: =20
=20
 This macro counts the number of arguments passed into a macro and
is useful outside of the ukdebug library.

Signed-off-by: Alexander Jung <alexander.jung@neclab.eu>
---
 include/uk/essentials.h=C2=A0 =C2=A0 =C2=A0 =C2=A0 | 5 +++++
 lib/ukdebug/include/uk/trace.h | 3 ---
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/include/uk/essentials.h b/include/uk/essentials.h
index 6989c97..6bcee2e 100644
--- a/include/uk/essentials.h
+++ b/include/uk/essentials.h
@@ -291,6 +291,11 @@ extern "C" {
 =C2=A0=C2=A0=C2=A0 char __assert_ ## y [(x) ? 1 : -1]
 #endif /* UK_CTASSERT */
=20
+#ifndef UK_NARGS
+#define __UK_NARGS_X(a, b, c, d, e, f, g, h, n, ...) n
+#define UK_NARGS(...)=C2=A0 __UK_NARGS_X(, ##__VA_ARGS__, 7, 6, 5, 4, 3, 2=
, 1, 0)
+#endif /* UK_NARGS */
+
 #ifdef __cplusplus
 }
 #endif
diff --git a/lib/ukdebug/include/uk/trace.h b/lib/ukdebug/include/uk/trace.=
h
index 8745382..bc8da43 100644
--- a/lib/ukdebug/include/uk/trace.h
+++ b/lib/ukdebug/include/uk/trace.h
@@ -66,9 +66,6 @@ struct uk_tracepoint_header {
 extern size_t uk_trace_buffer_free;
 extern char *uk_trace_buffer_writep;
=20
-#define __UK_NARGS_X(a, b, c, d, e, f, g, h, n, ...) n
-#define UK_NARGS(...)=C2=A0 __UK_NARGS_X(, ##__VA_ARGS__, 7, 6, 5, 4, 3, 2=
, 1, 0)
-
=20
 static inline void __uk_trace_save_arg(char **pbuff,
 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=
=A0 =C2=A0 =C2=A0 =C2=A0 size_t *pfree,
--=20
2.11.0


 =20
------=_Part_1044982_243321884.1596779938853
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<html><head></head><body><div class=3D"ydp4d5916deyahoo-style-wrap" style=
=3D"font-family:Helvetica Neue, Helvetica, Arial, sans-serif;font-size:16px=
;"><div></div>
        <div dir=3D"ltr" data-setdir=3D"false">All good.<br><br></div><div =
dir=3D"ltr" data-setdir=3D"false"><span><span style=3D"font-family: Helveti=
ca Neue, Helvetica, Arial, sans-serif;">Reviewed-by: Marius-Cristian Baciu =
&lt;marius.baciu</span><a href=3D"mailto:razvan.deaconescu@cs.pub.ro" style=
=3D"color: rgb(25, 106, 212); text-decoration-line: underline; font-family:=
 Helvetica Neue, Helvetica, Arial, sans-serif;" rel=3D"nofollow" target=3D"=
_blank">@stud.acs.upb.ro</a><span style=3D"font-family: Helvetica Neue, Hel=
vetica, Arial, sans-serif;">&gt;</span></span><br></div><div><br></div>
       =20
        </div><div id=3D"yahoo_quoted_7609862562" class=3D"yahoo_quoted">
            <div style=3D"font-family:'Helvetica Neue', Helvetica, Arial, s=
ans-serif;font-size:13px;color:#26282a;">
               =20
                <div>
                    On Thursday, July 30, 2020, 12:41:39 PM GMT+3, Alexande=
r Jung &lt;a.jung@lancs.ac.uk&gt; wrote:
                </div>
                <div><br></div>
                <div><br></div>
                <div><div dir=3D"ltr">This macro counts the number of argum=
ents passed into a macro and<br></div><div dir=3D"ltr">is useful outside of=
 the ukdebug library.<br></div><div dir=3D"ltr"><br></div><div dir=3D"ltr">=
Signed-off-by: Alexander Jung &lt;<a ymailto=3D"mailto:alexander.jung@necla=
b.eu" href=3D"mailto:alexander.jung@neclab.eu">alexander.jung@neclab.eu</a>=
&gt;<br></div><div dir=3D"ltr">---<br></div><div dir=3D"ltr"> include/uk/es=
sentials.h&nbsp; &nbsp; &nbsp; &nbsp; | 5 +++++<br></div><div dir=3D"ltr"> =
lib/ukdebug/include/uk/trace.h | 3 ---<br></div><div dir=3D"ltr"> 2 files c=
hanged, 5 insertions(+), 3 deletions(-)<br></div><div dir=3D"ltr"><br></div=
><div dir=3D"ltr">diff --git a/include/uk/essentials.h b/include/uk/essenti=
als.h<br></div><div dir=3D"ltr">index 6989c97..6bcee2e 100644<br></div><div=
 dir=3D"ltr">--- a/include/uk/essentials.h<br></div><div dir=3D"ltr">+++ b/=
include/uk/essentials.h<br></div><div dir=3D"ltr">@@ -291,6 +291,11 @@ exte=
rn "C" {<br></div><div dir=3D"ltr"> &nbsp;&nbsp;&nbsp; char __assert_ ## y =
[(x) ? 1 : -1]<br></div><div dir=3D"ltr"> #endif /* UK_CTASSERT */<br></div=
><div dir=3D"ltr"> <br></div><div dir=3D"ltr">+#ifndef UK_NARGS<br></div><d=
iv dir=3D"ltr">+#define __UK_NARGS_X(a, b, c, d, e, f, g, h, n, ...) n<br><=
/div><div dir=3D"ltr">+#define UK_NARGS(...)&nbsp; __UK_NARGS_X(, ##__VA_AR=
GS__, 7, 6, 5, 4, 3, 2, 1, 0)<br></div><div dir=3D"ltr">+#endif /* UK_NARGS=
 */<br></div><div dir=3D"ltr">+<br></div><div dir=3D"ltr"> #ifdef __cpluspl=
us<br></div><div dir=3D"ltr"> }<br></div><div dir=3D"ltr"> #endif<br></div>=
<div dir=3D"ltr">diff --git a/lib/ukdebug/include/uk/trace.h b/lib/ukdebug/=
include/uk/trace.h<br></div><div dir=3D"ltr">index 8745382..bc8da43 100644<=
br></div><div dir=3D"ltr">--- a/lib/ukdebug/include/uk/trace.h<br></div><di=
v dir=3D"ltr">+++ b/lib/ukdebug/include/uk/trace.h<br></div><div dir=3D"ltr=
">@@ -66,9 +66,6 @@ struct uk_tracepoint_header {<br></div><div dir=3D"ltr"=
> extern size_t uk_trace_buffer_free;<br></div><div dir=3D"ltr"> extern cha=
r *uk_trace_buffer_writep;<br></div><div dir=3D"ltr"> <br></div><div dir=3D=
"ltr">-#define __UK_NARGS_X(a, b, c, d, e, f, g, h, n, ...) n<br></div><div=
 dir=3D"ltr">-#define UK_NARGS(...)&nbsp; __UK_NARGS_X(, ##__VA_ARGS__, 7, =
6, 5, 4, 3, 2, 1, 0)<br></div><div dir=3D"ltr">-<br></div><div dir=3D"ltr">=
 <br></div><div dir=3D"ltr"> static inline void __uk_trace_save_arg(char **=
pbuff,<br></div><div dir=3D"ltr"> &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nb=
sp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; size_t *pfree,<br><=
/div><div dir=3D"ltr">-- <br></div><div dir=3D"ltr">2.11.0<br></div><div di=
r=3D"ltr"><br></div><div dir=3D"ltr"><br></div></div>
            </div>
        </div></body></html>
------=_Part_1044982_243321884.1596779938853--


From minios-devel-bounces@lists.xenproject.org Fri Aug 07 10:31:45 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Fri, 07 Aug 2020 10:31:45 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1k3zf4-0001se-6s; Fri, 07 Aug 2020 10:31:42 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <SRS0=7ZkA=BR=gmail.com=razvand@srs-us1.protection.inumbo.net>)
 id 1k3zf3-0001sZ-Bx
 for minios-devel@lists.xenproject.org; Fri, 07 Aug 2020 10:31:41 +0000
X-Inumbo-ID: 8286fc4e-74fa-45a0-b4cc-9695cc688ec5
Received: from mail-wr1-f68.google.com (unknown [209.85.221.68])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 8286fc4e-74fa-45a0-b4cc-9695cc688ec5;
 Fri, 07 Aug 2020 10:31:34 +0000 (UTC)
Received: by mail-wr1-f68.google.com with SMTP id z18so1188305wrm.12
 for <minios-devel@lists.xenproject.org>; Fri, 07 Aug 2020 03:31:34 -0700 (PDT)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:mime-version:references:in-reply-to:from:date
 :message-id:subject:to:cc;
 bh=mfJU0lkwQ+mE+A7t3aTd0I7JD2tFy5YPG0yujlMGSZM=;
 b=YTDp5TffGdUHrtBL6tEmlh7XzUthIGTjKHmOsKEhhYjqMZo/kx+abTcitGowIOn0tx
 W58eQQcnZU3sLSlNdTFhz7V7sxm1AG0SOLCxCtk83gYumDGif7aIAlGHWxpYyHhq0Cy4
 2Pbiho821cAK8Jvrk0/RsKF6n28RzsTqta3fwaF2I6oIYKBmFCIMX0U4B4qIx3Dh/X6X
 NWRHglwvq/fIEB4KPm1xihTfU8owFqYAkvDdB7ixy/r6Ef/FHQ4WQlA3ue7Diqm8cD9b
 q0KrkQv8uZiuNw22ccWKBg0rdZKl3E4gz0U/tWCBDSqm9q4Wu9yiVPqquHGOS1EkrkmT
 /1TA==
X-Gm-Message-State: AOAM530CnX7PBcZeoG6JrG5hd5QdoT8GXCgzq34efbCDwWtsrH0zf49a
 9hKSkivEuxNGE0iZgRsdFAnveRisOFzuXCmtlrA=
X-Google-Smtp-Source: ABdhPJxjrZ4f0hGI0axMqDzo4K7W89/2jpMukifHJyVYZp8/flu/mOAiLUPF7pfIRpHHOk8ce2XjbLCNinuVkB6+u8w=
X-Received: by 2002:adf:bb0a:: with SMTP id r10mr10973780wrg.23.1596796293882; 
 Fri, 07 Aug 2020 03:31:33 -0700 (PDT)
MIME-Version: 1.0
References: <cover.1592893765.git.hugo.lefeuvre@neclab.eu>
In-Reply-To: <cover.1592893765.git.hugo.lefeuvre@neclab.eu>
From: Razvan Deaconescu <razvan.deaconescu@cs.pub.ro>
Date: Fri, 7 Aug 2020 13:31:22 +0300
Message-ID: <CALe3bMV+D71c9=EnJjdxEMx0UBqUmLF-z1ROeND_OB1Rk00=xQ@mail.gmail.com>
Subject: Re: [UNIKRAFT PATCH 0/2] plat/kvm/x86/tscclock: minor fixes in the
 tsc subsystem
To: Hugo Lefeuvre <hugo.lefeuvre@neclab.eu>
Content-Type: text/plain; charset="UTF-8"
X-BeenThere: minios-devel@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Mini-os development list <minios-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:minios-devel@lists.xenproject.org>
List-Help: <mailto:minios-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=subscribe>
Cc: minios-devel@lists.xenproject.org
Errors-To: minios-devel-bounces@lists.xenproject.org
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>

All good.

Reviewed-by: Razvan Deaconescu <razvan.deaconescu@cs.pub.ro>

On Tue, Jun 23, 2020 at 9:36 AM Hugo Lefeuvre <hugo.lefeuvre@neclab.eu> wrote:
>
> Hi,
>
> these two patches provide somewhat minor fixes to the kvm/x86 tsc
> subsystem.  Both are related to the initial value of the monotonic clock
> and where part of my early clock initialization series which will be
> submitted soon.
>
> These patches belong together and should be applied in order.
>
> Hugo Lefeuvre (2):
>   plat/kvm/x86/tscclock: fix potentially uninitialized tsc_base
>   plat/kvm/x86/tscclock: start from zero
>
>  plat/kvm/x86/tscclock.c | 19 ++++++++++++++-----
>  1 file changed, 14 insertions(+), 5 deletions(-)
>
> --
> 2.7.4
>
>


From minios-devel-bounces@lists.xenproject.org Fri Aug 07 11:32:16 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Fri, 07 Aug 2020 11:32:16 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1k40bf-0007HY-79; Fri, 07 Aug 2020 11:32:15 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <SRS0=7ZkA=BR=gmail.com=razvand@srs-us1.protection.inumbo.net>)
 id 1k40be-0007HM-9N
 for minios-devel@lists.xenproject.org; Fri, 07 Aug 2020 11:32:14 +0000
X-Inumbo-ID: b68c9dc7-9976-4e43-a8fb-bbf755eb6579
Received: from mail-wm1-f68.google.com (unknown [209.85.128.68])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id b68c9dc7-9976-4e43-a8fb-bbf755eb6579;
 Fri, 07 Aug 2020 11:32:12 +0000 (UTC)
Received: by mail-wm1-f68.google.com with SMTP id x5so1438888wmi.2
 for <minios-devel@lists.xenproject.org>; Fri, 07 Aug 2020 04:32:12 -0700 (PDT)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:mime-version:references:in-reply-to:from:date
 :message-id:subject:to:cc;
 bh=j4IuwJJHv4M5uc/1cCHkX6WRH2CzbTbIb16BMOfZnFU=;
 b=PQqYabffRvXmJv2UX8Uf11rpbNtu82svUCXIzW3e9+qybyIvZCea3GnKsjk4UPYP0Z
 Rs+9i8/0OQhgHvxyRlWSTcyMxSBz24iORNdT/moux8S6aqpm1BQtS3hlpiglr3kbmMCf
 94iHrFsAwaBEF2I8RI8g1La2NKWGIwVOLrmbpZvXXU6r15izQHlmCLX/hkzgdrp8szT9
 W1Ge2vwdwrzaZwpZEE/iowrVIpb4Ts5Vpra6tZlZ18/jskxoH/8AVMvqQtZ3Zs27anPX
 5dMIv36jEjAr2zKjtlAOHiIGfExFN98Sk4aRR7KQtwAQeRh7XDR41yYI0Da4dB+Tht5Y
 QdGg==
X-Gm-Message-State: AOAM532B7AGCfaWeZQQfDooU0bxJJNbsoMseqvv0ZmH1Lr2lNjZqmTsT
 1MApmugwLtOjVUe582fWw+0WAMmcM3Yu5UCH7xc=
X-Google-Smtp-Source: ABdhPJwo/n3ZxdLNoKCC8kkbEf1Q6iq/Z3fOi9PIQxbMOr5Gj/r/AwxjUKzwXdTE+AdlULdPg9jhRm2Y6ESMlQXtP+4=
X-Received: by 2002:a7b:cd09:: with SMTP id f9mr11734192wmj.184.1596799931433; 
 Fri, 07 Aug 2020 04:32:11 -0700 (PDT)
MIME-Version: 1.0
References: <cover.1592894086.git.hugo.lefeuvre@neclab.eu>
 <9e2392ef21a2cd06e0e17740748ca2341535c69f.1592894086.git.hugo.lefeuvre@neclab.eu>
In-Reply-To: <9e2392ef21a2cd06e0e17740748ca2341535c69f.1592894086.git.hugo.lefeuvre@neclab.eu>
From: Razvan Deaconescu <razvan.deaconescu@cs.pub.ro>
Date: Fri, 7 Aug 2020 14:31:59 +0300
Message-ID: <CALe3bMWLpZj-LfP+TN3FPBc0L2LEDCUfdCDR_5W=q1k_9UnefQ@mail.gmail.com>
Subject: Re: [UNIKRAFT PATCH 1/2] plat/kvm/x86/tscclock: fix potentially
 uninitialized tsc_base
To: Hugo Lefeuvre <hugo.lefeuvre@neclab.eu>
Content-Type: text/plain; charset="UTF-8"
X-BeenThere: minios-devel@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Mini-os development list <minios-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:minios-devel@lists.xenproject.org>
List-Help: <mailto:minios-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=subscribe>
Cc: minios-devel@lists.xenproject.org
Errors-To: minios-devel-bounces@lists.xenproject.org
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>

All good.

Reviewed-by: Razvan Deaconescu <razvan.deaconescu@cs.pub.ro>

On Tue, Jun 23, 2020 at 9:36 AM Hugo Lefeuvre <hugo.lefeuvre@neclab.eu> wrote:
>
> tsc_base might remain uninitialized if the TSC clock frequency is retrieved
> from the hypervisor. This can potentially result in a small delay in the
> clock starting point.
>
> Make sure to initialize tsc_base when retrieving TSC clock frequency from
> the hypervisor.
>
> Signed-off-by: Hugo Lefeuvre <hugo.lefeuvre@neclab.eu>
> ---
>  plat/kvm/x86/tscclock.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/plat/kvm/x86/tscclock.c b/plat/kvm/x86/tscclock.c
> index 727164a..e477088 100644
> --- a/plat/kvm/x86/tscclock.c
> +++ b/plat/kvm/x86/tscclock.c
> @@ -194,7 +194,7 @@ static __u64 rtc_gettimeofday(void)
>  }
>
>  /*
> - * Beturn monotonic time using TSC clock.
> + * Return monotonic time using TSC clock.
>   */
>  __u64 tscclock_monotonic(void)
>  {
> @@ -239,6 +239,7 @@ int tscclock_init(void)
>         cpuid(0x40000000, 0, &eax, &ebx, &ecx, &edx);
>         if (eax >= 0x40000010) {
>                 uk_pr_info("Retrieving TSC clock frequency from hypervisor\n");
> +               tsc_base = rdtsc();
>                 cpuid(0x40000010, 0, &eax, &ebx, &ecx, &edx);
>                 tsc_freq = eax * 1000;
>         }
> @@ -262,6 +263,9 @@ int tscclock_init(void)
>          * Calculate TSC scaling multiplier.
>          *
>          * (0.32) tsc_mult = UKARCH_NSEC_PER_SEC (32.32) / tsc_freq (32.0)
> +        *
> +        * FIXME: this will overflow with small TSC frequencies. We should
> +        * probably calculate the TSC shift dynamically like solo5/hvt does.
>          */
>         tsc_mult = (UKARCH_NSEC_PER_SEC << 32) / tsc_freq;
>
> --
> 2.7.4
>
>


From minios-devel-bounces@lists.xenproject.org Fri Aug 07 11:32:43 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Fri, 07 Aug 2020 11:32:43 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1k40c7-0007LY-Hx; Fri, 07 Aug 2020 11:32:43 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <SRS0=7ZkA=BR=gmail.com=razvand@srs-us1.protection.inumbo.net>)
 id 1k40c6-0007KB-Fz
 for minios-devel@lists.xenproject.org; Fri, 07 Aug 2020 11:32:42 +0000
X-Inumbo-ID: e595c6d7-a625-470c-99e5-7f6b991eb372
Received: from mail-wm1-f67.google.com (unknown [209.85.128.67])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id e595c6d7-a625-470c-99e5-7f6b991eb372;
 Fri, 07 Aug 2020 11:32:37 +0000 (UTC)
Received: by mail-wm1-f67.google.com with SMTP id t14so1528547wmi.3
 for <minios-devel@lists.xenproject.org>; Fri, 07 Aug 2020 04:32:37 -0700 (PDT)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:mime-version:references:in-reply-to:from:date
 :message-id:subject:to:cc;
 bh=d0BnVfFZClJCx8MqBlOUVyoYwzYeFpUN3pWORujpjS0=;
 b=fMLh7VHtiRZRrefJyv2+fOshpTUKKVR1DT31UcGIucf75IFBqc8Fdw9FM5gGHyYOuf
 P+g+Wz81ODcJL0tD+H+uk42eLSVPYodzQU9LskMvgrWsmP6USXkmDbjdUtubDDSbYP1R
 er2xXRhhSqgLp9cGZf3AIADs6DC/CGb/7ork/viswj0ZVmosJXO2oZ059pL0sKrO7viX
 Nmc9bJ2NvWvRjsx8bkHNRjpgGC+4dS5tMmH6ai0nRsK6hc1Aat6R4f2hWWNjUzZJWT6M
 GVWK+THg+LV8dS5ATkG4rzS+q9wZuC65bXnQcynQr6y5oM8WS1iXbqrFVBqEwc93t9V4
 F4gw==
X-Gm-Message-State: AOAM531kkkos1QhZnPdS/Z6ocwAdQYXyOtTn4iz0znZQFRL6ZkK2lBeO
 wAPy3FV1roVM4gVqPi0Qb9c0stJq197Gd1lGIamNMekXCmo=
X-Google-Smtp-Source: ABdhPJy1uODjFK5y20qTgKJ8J8v2rz56L6LkoIdk4z22Q2JBBUuWboCFXRumhNw58QJ36WoYb6sxpPHL16EhHOj9tv4=
X-Received: by 2002:a1c:ed15:: with SMTP id l21mr11774855wmh.37.1596799956812; 
 Fri, 07 Aug 2020 04:32:36 -0700 (PDT)
MIME-Version: 1.0
References: <cover.1592894086.git.hugo.lefeuvre@neclab.eu>
 <ed49760e9c9a391af9b1f82cb3d68ba4abca421f.1592894086.git.hugo.lefeuvre@neclab.eu>
In-Reply-To: <ed49760e9c9a391af9b1f82cb3d68ba4abca421f.1592894086.git.hugo.lefeuvre@neclab.eu>
From: Razvan Deaconescu <razvan.deaconescu@cs.pub.ro>
Date: Fri, 7 Aug 2020 14:32:24 +0300
Message-ID: <CALe3bMWeYbLtm0CEO7Hug=G6_=LwkoZd_GdxOv-5aAB7s77iqA@mail.gmail.com>
Subject: Re: [UNIKRAFT PATCH 2/2] plat/kvm/x86/tscclock: start from zero
To: Hugo Lefeuvre <hugo.lefeuvre@neclab.eu>
Content-Type: text/plain; charset="UTF-8"
X-BeenThere: minios-devel@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Mini-os development list <minios-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:minios-devel@lists.xenproject.org>
List-Help: <mailto:minios-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=subscribe>
Cc: minios-devel@lists.xenproject.org
Errors-To: minios-devel-bounces@lists.xenproject.org
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>

All good.

Reviewed-by: Razvan Deaconescu <razvan.deaconescu@cs.pub.ro>

On Tue, Jun 23, 2020 at 9:36 AM Hugo Lefeuvre <hugo.lefeuvre@neclab.eu> wrote:
>
> The starting point of our monotonic clock is currently the initial value
> of the TSC, converted to nanoseconds.
>
> Start from zero instead: this allows for easier interpretation of
> timestamps in debug messages.
>
> Signed-off-by: Hugo Lefeuvre <hugo.lefeuvre@neclab.eu>
> ---
>  plat/kvm/x86/tscclock.c | 13 +++++++++----
>  1 file changed, 9 insertions(+), 4 deletions(-)
>
> diff --git a/plat/kvm/x86/tscclock.c b/plat/kvm/x86/tscclock.c
> index e477088..bfe801c 100644
> --- a/plat/kvm/x86/tscclock.c
> +++ b/plat/kvm/x86/tscclock.c
> @@ -256,24 +256,29 @@ int tscclock_init(void)
>                 tsc_freq = (rdtsc() - tsc_base) * 10;
>         }
>
> -       uk_pr_info("Clock source: TSC, frequency estimate is %llu Hz\n",
> -                  (unsigned long long) tsc_freq);
> -
>         /*
>          * Calculate TSC scaling multiplier.
>          *
>          * (0.32) tsc_mult = UKARCH_NSEC_PER_SEC (32.32) / tsc_freq (32.0)
>          *
> +        * Warning, do not print anything between TSC calibration and the
> +        * setting of tsc_mult: if CONFIG_LIBUKDEBUG_PRINT_TIME is enabled
> +        * this will trigger a reset of tsc_base via tscclock_monotonic
> +        * and delay the clock starting point.
> +        *
>          * FIXME: this will overflow with small TSC frequencies. We should
>          * probably calculate the TSC shift dynamically like solo5/hvt does.
>          */
>         tsc_mult = (UKARCH_NSEC_PER_SEC << 32) / tsc_freq;
>
> +       uk_pr_info("Clock source: TSC, frequency estimate is %llu Hz\n",
> +                  (unsigned long long) tsc_freq);
> +
>         /*
>          * Monotonic time begins at tsc_base (first read of TSC before
>          * calibration).
>          */
> -       time_base = mul64_32(tsc_base, tsc_mult);
> +       tscclock_monotonic();
>
>         /*
>          * Compute RTC epoch offset by subtracting monotonic time_base from RTC
> --
> 2.7.4
>
>


From minios-devel-bounces@lists.xenproject.org Fri Aug 07 16:08:23 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Fri, 07 Aug 2020 16:08:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1k44ur-00088w-2a; Fri, 07 Aug 2020 16:08:21 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=vDsm=BR=neclab.eu=simon.kuenzer@srs-us1.protection.inumbo.net>)
 id 1k44up-00088r-Uo
 for minios-devel@lists.xenproject.org; Fri, 07 Aug 2020 16:08:19 +0000
X-Inumbo-ID: d6525eed-0482-4bbd-8b6b-506bfce111e6
Received: from mailer2.neclab.eu (unknown [195.37.70.41])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id d6525eed-0482-4bbd-8b6b-506bfce111e6;
 Fri, 07 Aug 2020 16:08:17 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
 by mailer2.neclab.eu (Postfix) with ESMTP id 7EC57F2041;
 Fri,  7 Aug 2020 18:08:16 +0200 (CEST)
X-Virus-Scanned: Amavisd on Debian GNU/Linux (atlas-b.office.hd)
Received: from mailer2.neclab.eu ([127.0.0.1])
 by localhost (atlas-b.office.hd [127.0.0.1]) (amavisd-new, port 10024)
 with ESMTP id AJtIbte7-tIF; Fri,  7 Aug 2020 18:08:16 +0200 (CEST)
X-ENC: Last-Hop-TLS-encrypted
X-ENC: Last-Hop-TLS-encrypted
Received: from puck.office.hd (puck.office.hd [192.168.24.91])
 (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
 (No client certificate requested)
 by mailer2.neclab.eu (Postfix) with ESMTPS id 46415F2003;
 Fri,  7 Aug 2020 18:08:12 +0200 (CEST)
Received: from [10.7.1.42] (192.168.24.96) by puck.office.hd (192.168.24.91)
 with Microsoft SMTP Server (version=TLS1_2,
 cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1979.3; Fri, 7 Aug 2020
 18:08:11 +0200
Subject: Re: [UNIKRAFT PATCH v3] lib/ukalloc: add ifmalloc compatibility
 interface
To: Hugo Lefeuvre <hle@owl.eu.com>, <minios-devel@lists.xenproject.org>
References: <20200803162524.225134-1-hle@owl.eu.com>
From: Simon Kuenzer <simon.kuenzer@neclab.eu>
Message-ID: <e1465ded-6cf7-68df-c9e0-0bc991af5c97@neclab.eu>
Date: Fri, 7 Aug 2020 18:08:10 +0200
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:68.0)
 Gecko/20100101 Thunderbird/68.11.0
MIME-Version: 1.0
In-Reply-To: <20200803162524.225134-1-hle@owl.eu.com>
Content-Type: text/plain; charset="utf-8"; format=flowed
Content-Language: en-US
Content-Transfer-Encoding: 7bit
X-Originating-IP: [192.168.24.96]
X-ClientProxiedBy: oberon.office.hd (192.168.24.90) To puck.office.hd
 (192.168.24.91)
X-BeenThere: minios-devel@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Mini-os development list <minios-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:minios-devel@lists.xenproject.org>
List-Help: <mailto:minios-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: minios-devel-bounces@lists.xenproject.org
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>

Thanks a lot for the changes!

Reviewed-by: Simon Kuenzer <simon.kuenzer@neclab.eu>

On 03.08.20 18:25, Hugo Lefeuvre wrote:
> Add ifmalloc, the malloc compatibility interface. This interface
> implements a POSIX compliant allocation interface on top of a simple
> malloc() and free() interface. This interface is similar to ifpages,
> which does the same for palloc() and pfree().
> 
> ifmalloc will be used for the port of TLSF and tinyalloc which do not
> support (posix_)memalign().
> 
> In order to keep implementations consistent, this patch also addresses
> a bug in uk_posix_memalign_ifpages() which did not handle size = 0
> correctly. The function previously returned an error code and set
> memptr to NULL, but POSIX allows only one of the two.  Both
> implementations now return EINVAL and leave memptr untouched.
> 
> Signed-off-by: Hugo Lefeuvre <hle@owl.eu.com>
> ---
> Changes since v2:
>   - keep memptr untouched on size = 0 in uk_posix_memalign_if{malloc,pages}
>   - return ENOMEM instead of NULL on overflow in uk_posix_memalign_ifmalloc
>   - minor style changes to make checkpatch.pl happy
> 
>   lib/ukalloc/Config.uk               |   5 +
>   lib/ukalloc/alloc.c                 | 154 +++++++++++++++++++++++++++-
>   lib/ukalloc/exportsyms.uk           |   4 +
>   lib/ukalloc/include/uk/alloc.h      |   5 +
>   lib/ukalloc/include/uk/alloc_impl.h |  27 +++++
>   5 files changed, 191 insertions(+), 4 deletions(-)
> 
> diff --git a/lib/ukalloc/Config.uk b/lib/ukalloc/Config.uk
> index 0de7464..c965d08 100644
> --- a/lib/ukalloc/Config.uk
> +++ b/lib/ukalloc/Config.uk
> @@ -5,6 +5,11 @@ menuconfig LIBUKALLOC
>   	select LIBUKDEBUG
>   
>   if LIBUKALLOC
> +	config LIBUKALLOC_IFMALLOC
> +		bool "Malloc compatibility interface"
> +		default n
> +		help
> +			Provide helpers for allocators defining exclusively malloc and free
>   	config LIBUKALLOC_IFSTATS
>   		bool "Statistics interface"
>   		default n
> diff --git a/lib/ukalloc/alloc.c b/lib/ukalloc/alloc.c
> index 127bc6f..7cdba5e 100644
> --- a/lib/ukalloc/alloc.c
> +++ b/lib/ukalloc/alloc.c
> @@ -1,8 +1,10 @@
>   /* SPDX-License-Identifier: BSD-3-Clause */
>   /*
>    * Authors: Florian Schmidt <florian.schmidt@neclab.eu>
> + *          Hugo Lefeuvre <hugo.lefeuvre@neclab.eu>
>    *
> - * Copyright (c) 2017, NEC Europe Ltd., NEC Corporation. All rights reserved.
> + * Copyright (c) 2017-2020, NEC Laboratories Europe GmbH, NEC Corporation,
> + *                          All rights reserved.
>    *
>    * Redistribution and use in source and binary forms, with or without
>    * modification, are permitted provided that the following conditions
> @@ -28,8 +30,6 @@
>    * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
>    * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
>    * POSSIBILITY OF SUCH DAMAGE.
> - *
> - * THIS HEADER MAY NOT BE EXTRACTED OR MODIFIED IN ANY WAY.
>    */
>   
>   /* This is a very simple, naive implementation of malloc.
> @@ -52,6 +52,7 @@
>   #include <uk/essentials.h>
>   #include <uk/assert.h>
>   #include <uk/arch/limits.h>
> +#include <uk/arch/lcpu.h>
>   
>   #define size_to_num_pages(size) \
>   	(ALIGN_UP((unsigned long)(size), __PAGE_SIZE) / __PAGE_SIZE)
> @@ -206,8 +207,12 @@ int uk_posix_memalign_ifpages(struct uk_alloc *a,
>   	    || (align % sizeof(void *)) != 0)
>   		return EINVAL;
>   
> +	/* According to POSIX, calling posix_memalign with a size of zero can
> +	 * be handled by (1) setting memptr to NULL and returning 0 (success),
> +	 * OR (2) leaving memptr untouched and returning an error code. We
> +	 * implement (2).
> +	 */
>   	if (!size) {
> -		*memptr = NULL;
>   		return EINVAL;
>   	}
>   
> @@ -267,6 +272,147 @@ int uk_posix_memalign_ifpages(struct uk_alloc *a,
>   	return 0;
>   }
>   
> +#if CONFIG_LIBUKALLOC_IFMALLOC
> +
> +struct metadata_ifmalloc {
> +	size_t	size;
> +	void	*base;
> +};
> +
> +#define METADATA_IFMALLOC_SIZE_POW2 16
> +UK_CTASSERT(!(sizeof(struct metadata_ifmalloc) > METADATA_IFMALLOC_SIZE_POW2));
> +
> +static struct metadata_ifmalloc *uk_get_metadata_ifmalloc(const void *ptr)
> +{
> +	return (struct metadata_ifmalloc *)((uintptr_t) ptr -
> +		METADATA_IFMALLOC_SIZE_POW2);
> +}
> +
> +static size_t uk_getmallocsize_ifmalloc(const void *ptr)
> +{
> +	struct metadata_ifmalloc *metadata = uk_get_metadata_ifmalloc(ptr);
> +
> +	return (size_t) ((uintptr_t) metadata->base + metadata->size -
> +			 (uintptr_t) ptr);
> +}
> +
> +void uk_free_ifmalloc(struct uk_alloc *a, void *ptr)
> +{
> +	struct metadata_ifmalloc *metadata;
> +
> +	UK_ASSERT(a);
> +	UK_ASSERT(a->free_backend);
> +	if (!ptr)
> +		return;
> +
> +	metadata = uk_get_metadata_ifmalloc(ptr);
> +	a->free_backend(a, metadata->base);
> +}
> +
> +void *uk_malloc_ifmalloc(struct uk_alloc *a, size_t size)
> +{
> +	struct metadata_ifmalloc *metadata;
> +	size_t realsize = size + METADATA_IFMALLOC_SIZE_POW2;
> +	void *ptr;
> +
> +	UK_ASSERT(a);
> +	UK_ASSERT(a->malloc_backend);
> +
> +	/* check for overflow */
> +	if (unlikely(realsize < size))
> +		return NULL;
> +
> +	ptr = a->malloc_backend(a, realsize);
> +	if (!ptr)
> +		return NULL;
> +
> +	metadata = ptr;
> +	metadata->size = realsize;
> +	metadata->base = ptr;
> +
> +	return (void *) ((uintptr_t) ptr + METADATA_IFMALLOC_SIZE_POW2);
> +}
> +
> +void *uk_realloc_ifmalloc(struct uk_alloc *a, void *ptr, size_t size)
> +{
> +	void *retptr;
> +	size_t mallocsize;
> +
> +	UK_ASSERT(a);
> +	if (!ptr)
> +		return uk_malloc_ifmalloc(a, size);
> +
> +	if (ptr && !size) {
> +		uk_free_ifmalloc(a, ptr);
> +		return NULL;
> +	}
> +
> +	retptr = uk_malloc_ifmalloc(a, size);
> +	if (!retptr)
> +		return NULL;
> +
> +	mallocsize = uk_getmallocsize_ifmalloc(ptr);
> +
> +	memcpy(retptr, ptr, MIN(size, mallocsize));
> +
> +	uk_free_ifmalloc(a, ptr);
> +	return retptr;
> +}
> +
> +int uk_posix_memalign_ifmalloc(struct uk_alloc *a,
> +				     void **memptr, size_t align, size_t size)
> +{
> +	struct metadata_ifmalloc *metadata;
> +	size_t realsize, padding;
> +	uintptr_t intptr;
> +
> +	UK_ASSERT(a);
> +	if (((align - 1) & align) != 0
> +	    || align < sizeof(void *))
> +		return EINVAL;
> +
> +	/* Leave memptr untouched. See comment in uk_posix_memalign_ifpages. */
> +	if (!size)
> +		return EINVAL;
> +
> +	/* Store size information preceding the memory block. Since we return
> +	 * pointers aligned at `align` we need to reserve at least that much
> +	 * space for the size information.
> +	 */
> +	if (align < METADATA_IFMALLOC_SIZE_POW2) {
> +		align = METADATA_IFMALLOC_SIZE_POW2;
> +		padding = 0;
> +	} else {
> +		padding = METADATA_IFMALLOC_SIZE_POW2;
> +	}
> +
> +	realsize = size + padding + align;
> +
> +	/* check for overflow */
> +	if (unlikely(realsize < size))
> +		return ENOMEM;
> +
> +	intptr = (uintptr_t) a->malloc_backend(a, realsize);
> +
> +	if (!intptr)
> +		return ENOMEM;
> +
> +	*memptr = (void *) ALIGN_UP(intptr + METADATA_IFMALLOC_SIZE_POW2,
> +				    (uintptr_t) align);
> +
> +	metadata = uk_get_metadata_ifmalloc(*memptr);
> +
> +	/* check for underflow */
> +	UK_ASSERT(intptr <= (uintptr_t) metadata);
> +
> +	metadata->size = realsize;
> +	metadata->base = (void *) intptr;
> +
> +	return 0;
> +}
> +
> +#endif
> +
>   void uk_pfree_compat(struct uk_alloc *a, void *ptr,
>   		     unsigned long num_pages __unused)
>   {
> diff --git a/lib/ukalloc/exportsyms.uk b/lib/ukalloc/exportsyms.uk
> index 2c8a90f..21c1996 100644
> --- a/lib/ukalloc/exportsyms.uk
> +++ b/lib/ukalloc/exportsyms.uk
> @@ -4,6 +4,10 @@ uk_malloc_ifpages
>   uk_free_ifpages
>   uk_realloc_ifpages
>   uk_posix_memalign_ifpages
> +uk_malloc_ifmalloc
> +uk_realloc_ifmalloc
> +uk_posix_memalign_ifmalloc
> +uk_free_ifmalloc
>   uk_calloc_compat
>   uk_memalign_compat
>   uk_realloc_compat
> diff --git a/lib/ukalloc/include/uk/alloc.h b/lib/ukalloc/include/uk/alloc.h
> index 5bfa2f2..1457922 100644
> --- a/lib/ukalloc/include/uk/alloc.h
> +++ b/lib/ukalloc/include/uk/alloc.h
> @@ -85,6 +85,11 @@ struct uk_alloc {
>   	uk_alloc_memalign_func_t memalign;
>   	uk_alloc_free_func_t free;
>   
> +#if CONFIG_LIBUKALLOC_IFMALLOC
> +	uk_alloc_free_func_t free_backend;
> +	uk_alloc_malloc_func_t malloc_backend;
> +#endif
> +
>   	/* page allocation interface */
>   	uk_alloc_palloc_func_t palloc;
>   	uk_alloc_pfree_func_t pfree;
> diff --git a/lib/ukalloc/include/uk/alloc_impl.h b/lib/ukalloc/include/uk/alloc_impl.h
> index 8bcca94..b15f49e 100644
> --- a/lib/ukalloc/include/uk/alloc_impl.h
> +++ b/lib/ukalloc/include/uk/alloc_impl.h
> @@ -62,6 +62,14 @@ int uk_posix_memalign_ifpages(struct uk_alloc *a, void **memptr,
>   				size_t align, size_t size);
>   void uk_free_ifpages(struct uk_alloc *a, void *ptr);
>   
> +#if CONFIG_LIBUKALLOC_IFMALLOC
> +void *uk_malloc_ifmalloc(struct uk_alloc *a, size_t size);
> +void *uk_realloc_ifmalloc(struct uk_alloc *a, void *ptr, size_t size);
> +int uk_posix_memalign_ifmalloc(struct uk_alloc *a, void **memptr,
> +				     size_t align, size_t size);
> +void uk_free_ifmalloc(struct uk_alloc *a, void *ptr);
> +#endif
> +
>   /* Functionality that is provided based on malloc() and posix_memalign() */
>   void *uk_calloc_compat(struct uk_alloc *a, size_t num, size_t len);
>   void *uk_realloc_compat(struct uk_alloc *a, void *ptr, size_t size);
> @@ -88,6 +96,25 @@ void uk_pfree_compat(struct uk_alloc *a, void *ptr, unsigned long num_pages);
>   		uk_alloc_register((a));					\
>   	} while (0)
>   
> +#if CONFIG_LIBUKALLOC_IFMALLOC
> +#define uk_alloc_init_malloc_ifmalloc(a, malloc_f, free_f, addmem_f) 	\
> +	do {								\
> +		(a)->malloc         = uk_malloc_ifmalloc;		\
> +		(a)->calloc         = uk_calloc_compat;			\
> +		(a)->realloc        = uk_realloc_ifmalloc;		\
> +		(a)->posix_memalign = uk_posix_memalign_ifmalloc;	\
> +		(a)->memalign       = uk_memalign_compat;		\
> +		(a)->malloc_backend = (malloc_f);			\
> +		(a)->free_backend   = (free_f);				\
> +		(a)->free           = uk_free_ifmalloc;			\
> +		(a)->palloc         = uk_palloc_compat;			\
> +		(a)->pfree          = uk_pfree_compat;			\
> +		(a)->addmem         = (addmem_f);			\
> +									\
> +		uk_alloc_register((a));					\
> +	} while (0)
> +#endif
> +
>   /* Shortcut for doing a registration of an allocator that only
>    * implements palloc(), pfree(), addmem()
>    */
> 


From minios-devel-bounces@lists.xenproject.org Fri Aug 07 17:17:31 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Fri, 07 Aug 2020 17:17:31 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1k45zl-0005wF-Cq; Fri, 07 Aug 2020 17:17:29 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=vDsm=BR=neclab.eu=simon.kuenzer@srs-us1.protection.inumbo.net>)
 id 1k45zj-0005wA-NM
 for minios-devel@lists.xenproject.org; Fri, 07 Aug 2020 17:17:27 +0000
X-Inumbo-ID: a861f0d7-3abf-48de-b5c8-9247e060b977
Received: from mailer1.neclab.eu (unknown [195.37.70.40])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id a861f0d7-3abf-48de-b5c8-9247e060b977;
 Fri, 07 Aug 2020 17:17:23 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
 by mailer1.neclab.eu (Postfix) with ESMTP id 54CE510532C;
 Fri,  7 Aug 2020 19:17:22 +0200 (CEST)
X-Virus-Scanned: Amavisd on Debian GNU/Linux (atlas-a.office.hd)
Received: from mailer1.neclab.eu ([127.0.0.1])
 by localhost (atlas-a.office.hd [127.0.0.1]) (amavisd-new, port 10024)
 with ESMTP id A2bQbOsaIZSb; Fri,  7 Aug 2020 19:17:22 +0200 (CEST)
X-ENC: Last-Hop-TLS-encrypted
X-ENC: Last-Hop-TLS-encrypted
Received: from puck.office.hd (puck.office.hd [192.168.24.91])
 (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
 (No client certificate requested)
 by mailer1.neclab.eu (Postfix) with ESMTPS id 26194103AE3;
 Fri,  7 Aug 2020 19:17:22 +0200 (CEST)
Received: from [10.7.1.42] (192.168.24.96) by puck.office.hd (192.168.24.91)
 with Microsoft SMTP Server (version=TLS1_2,
 cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1979.3; Fri, 7 Aug 2020
 19:17:21 +0200
Subject: Re: [UNIKRAFT RFC PATCH] Added the irq-safe (I hope) memcpy in isrlibc
To: cristian-vijelie <cristianvijelie@gmail.com>,
 <minios-devel@lists.xenproject.org>
References: <20200731110527.51514-1-cristianvijelie@gmail.com>
From: Simon Kuenzer <simon.kuenzer@neclab.eu>
Message-ID: <cb044983-7dc1-ca72-d5ee-64e99e42d5b3@neclab.eu>
Date: Fri, 7 Aug 2020 19:17:20 +0200
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:68.0)
 Gecko/20100101 Thunderbird/68.11.0
MIME-Version: 1.0
In-Reply-To: <20200731110527.51514-1-cristianvijelie@gmail.com>
Content-Type: text/plain; charset="utf-8"; format=flowed
Content-Language: en-US
Content-Transfer-Encoding: 7bit
X-Originating-IP: [192.168.24.96]
X-ClientProxiedBy: puck.office.hd (192.168.24.91) To puck.office.hd
 (192.168.24.91)
X-BeenThere: minios-devel@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Mini-os development list <minios-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:minios-devel@lists.xenproject.org>
List-Help: <mailto:minios-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: minios-devel-bounces@lists.xenproject.org
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>

Hi Christian,

thanks a lot for this RFC regarding issue to have IRQ-safe libc 
functions for interrupts. It is a really important component that we are 
going to need. First of all, thanks a lot for your work!

I understand that you copied nolibc as base but I do not think we need 
all defintions and all provided functionality for driving interrupt 
contexts. The `isrlib` should not stay in conflict to any libc (nolibc, 
newlib, or musl). It will always be used together with one of them.
I would not copy everything from nolibc, it is better to start the 
library from scratch and add functions as they come and get needed. This 
makes the patch also much smaller.

I add some more comments inline.
I am looking forward to your next RPC.

Thanks a lot,

Simon

On 31.07.20 13:05, cristian-vijelie wrote:
> ---
>   lib/Makefile.uk                               |   1 +
>   lib/isrlibc/Config.uk                         |  16 ++
>   lib/isrlibc/Makefile.uk                       |  28 ++++
>   lib/isrlibc/arch/arm/bits/fcntl.h             |  40 +++++
>   lib/isrlibc/arch/arm64/bits/fcntl.h           |  38 +++++
>   lib/isrlibc/arch/x86_64/bits/fcntl.h          |  40 +++++
>   lib/isrlibc/exportsyms.uk                     |   2 +
>   .../include/isrlibc-internal/shareddefs.h     | 146 ++++++++++++++++++
>   lib/isrlibc/include/string.h                  |  53 +++++++
>   lib/isrlibc/include/sys/file.h                |  21 +++
>   lib/isrlibc/include/sys/mount.h               | 109 +++++++++++++
>   lib/isrlibc/include/sys/param.h               |  38 +++++
>   lib/isrlibc/include/sys/select.h              |  82 ++++++++++
>   lib/isrlibc/include/sys/stat.h                | 135 ++++++++++++++++
>   lib/isrlibc/include/sys/statfs.h              |  36 +++++
>   lib/isrlibc/include/sys/statvfs.h             |  54 +++++++
>   lib/isrlibc/include/sys/types.h               |  69 +++++++++
>   lib/isrlibc/include/sys/uio.h                 |  76 +++++++++
>   lib/isrlibc/string.c                          |  16 ++
>   19 files changed, 1000 insertions(+)
>   create mode 100644 lib/isrlibc/Config.uk
>   create mode 100644 lib/isrlibc/Makefile.uk
>   create mode 100644 lib/isrlibc/arch/arm/bits/fcntl.h
>   create mode 100644 lib/isrlibc/arch/arm64/bits/fcntl.h
>   create mode 100644 lib/isrlibc/arch/x86_64/bits/fcntl.h
>   create mode 100644 lib/isrlibc/exportsyms.uk
>   create mode 100644 lib/isrlibc/include/isrlibc-internal/shareddefs.h
>   create mode 100644 lib/isrlibc/include/string.h
>   create mode 100644 lib/isrlibc/include/sys/file.h
>   create mode 100644 lib/isrlibc/include/sys/mount.h
>   create mode 100644 lib/isrlibc/include/sys/param.h
>   create mode 100644 lib/isrlibc/include/sys/select.h
>   create mode 100644 lib/isrlibc/include/sys/stat.h
>   create mode 100644 lib/isrlibc/include/sys/statfs.h
>   create mode 100644 lib/isrlibc/include/sys/statvfs.h
>   create mode 100644 lib/isrlibc/include/sys/types.h
>   create mode 100644 lib/isrlibc/include/sys/uio.h
>   create mode 100644 lib/isrlibc/string.c
> 
> diff --git a/lib/Makefile.uk b/lib/Makefile.uk
> index aa7e730..b43234b 100644
> --- a/lib/Makefile.uk
> +++ b/lib/Makefile.uk
> @@ -11,6 +11,7 @@ $(eval $(call _import_lib,$(CONFIG_UK_BASE)/lib/posix-sysinfo))
>   $(eval $(call _import_lib,$(CONFIG_UK_BASE)/lib/ukdebug))
>   $(eval $(call _import_lib,$(CONFIG_UK_BASE)/lib/ukargparse))
>   $(eval $(call _import_lib,$(CONFIG_UK_BASE)/lib/uktimeconv))
> +$(eval $(call _import_lib,$(CONFIG_UK_BASE)/lib/isrlibc))
>   $(eval $(call _import_lib,$(CONFIG_UK_BASE)/lib/nolibc))
>   $(eval $(call _import_lib,$(CONFIG_UK_BASE)/lib/ukalloc))
>   $(eval $(call _import_lib,$(CONFIG_UK_BASE)/lib/ukallocbbuddy))
> diff --git a/lib/isrlibc/Config.uk b/lib/isrlibc/Config.uk
> new file mode 100644
> index 0000000..b4d4b5a
> --- /dev/null
> +++ b/lib/isrlibc/Config.uk
> @@ -0,0 +1,16 @@
> +menuconfig LIBISRLIBC
> +	bool "isrlibc: IRQ-safe subset of libc functionality"

I remember we briefly discussed to call it `isrlibc`. In the meantime, I 
think naming it just `isrlib` would fit better since it is not a libc 
anymore. It provides helpers for developing isr handlers. What do you think?

> +	depends on !HAVE_LIBC
> +	default y if !HAVE_LIBC
> +	imply LIBUKTIME
> +
> +if LIBISRLIBC
> +	config LIBISRLIBC_UKDEBUG_ASSERT
> +		bool "Implement assertions with libukdebug"
> +		default y if LIBUKDEBUG
> +		default n
> +		help
> +			Assertions (`assert()` defined in `<assert.h>`) are mapped to `UK_ASSERT()`.
> +			If selected, please note that libc assertions are also removed from the code
> +			when assertions are disabled in libukdebug.
> +endif
> diff --git a/lib/isrlibc/Makefile.uk b/lib/isrlibc/Makefile.uk
> new file mode 100644
> index 0000000..42e0e85
> --- /dev/null
> +++ b/lib/isrlibc/Makefile.uk
> @@ -0,0 +1,28 @@
> +$(eval $(call addlib_s,libisrlibc,$(CONFIG_LIBISRLIBC)))
> +
> +LIBISRLIBC_NO_EXTENDED          += -mno-mmx
> +LIBISRLIBC_NO_EXTENDED          += -mno-sse
> +LIBISRLIBC_NO_EXTENDED          += -mno-sse2
> +LIBISRLIBC_NO_EXTENDED          += -mno-sse3
> +LIBISRLIBC_NO_EXTENDED          += -mno-ssse3
> +LIBISRLIBC_NO_EXTENDED          += -mno-sse4
> +LIBISRLIBC_NO_EXTENDED          += -mno-sse4a
> +LIBISRLIBC_NO_EXTENDED          += -mno-sse4.1
> +LIBISRLIBC_NO_EXTENDED          += -mno-sse4.2
> +LIBISRLIBC_NO_EXTENDED          += -mno-avx
> +LIBISRLIBC_NO_EXTENDED          += -mfpmath=387

Instead of defining the flags by the library, assign the source files to 
the extra `|isr` variant. Depending on the target architecture, you are 
going to have different flags to disable extended registers. The 
architectures already define those for the special ISR variant. You can 
read about the "special" ISR variant here:
http://docs.unikraft.org/developers-app.html#makefile-uk

> +
> +CFLAGS-$(CONFIG_LIBISRLIBC)		+= $(LIBISRLIBC_NO_EXTENDED)
> +CXXFLAGS-$(CONFIG_LIBISRLIBC)	+= $(LIBISRLIBC_NO_EXTENDED)
> +
> +LIBISRLIBC_GLOBAL_INCLUDES-y     += -I$(LIBISRLIBC_BASE)/include
> +LIBISRLIBC_GLOBAL_INCLUDES-y     += -I$(LIBISRLIBC_BASE)/arch/$(ARCH)
> +LIBISRLIBC_GLOBAL_INCLUDES-y     += -I$(LIBISRLIBC_BASE)/musl-imported/include
> +LIBISRLIBC_GLOBAL_INCLUDES-y     += -I$(LIBISRLIBC_BASE)/musl-imported/arch/generic
> +CINCLUDES-$(CONFIG_LIBISRLIBC)   += $(LIBISRLIBC_GLOBAL_INCLUDES-y)
> +CXXINCLUDES-$(CONFIG_LIBISRLIBC) += $(LIBISRLIBC_GLOBAL_INCLUDES-y)
I think the first version of the library will have just the following 
includes:

 > +CINCLUDES-$(CONFIG_LIBISRLIBC)   += -I$(LIBISRLIBC_BASE)/include
 > +CXXINCLUDES-$(CONFIG_LIBISRLIBC) += -I$(LIBISRLIBC_BASE)/include
> +
> +LIBISRLIBC_SRCS-y += $(LIBISRLIBC_BASE)/string.c

To compile the file with the ISR-safe variant would look like:

LIBISRLIBC_SRCS-y += $(LIBISRLIBC_BASE)/string.c|isr

> +
> +# Localize internal symbols (starting with __*)
> +LIBISRLIBC_OBJCFLAGS-y += -w -L __*
> diff --git a/lib/isrlibc/arch/arm/bits/fcntl.h b/lib/isrlibc/arch/arm/bits/fcntl.h
> new file mode 100644
> index 0000000..4cb1753
> --- /dev/null
> +++ b/lib/isrlibc/arch/arm/bits/fcntl.h
> @@ -0,0 +1,40 @@
> +#define O_CREAT        0100
> +#define O_EXCL         0200
> +#define O_NOCTTY       0400
> +#define O_TRUNC       01000
> +#define O_APPEND      02000
> +#define O_NONBLOCK    04000
> +#define O_DSYNC      010000
> +#define O_SYNC     04010000
> +#define O_RSYNC    04010000
> +#define O_DIRECTORY  040000
> +#define O_NOFOLLOW  0100000
> +#define O_CLOEXEC  02000000
> +
> +#define O_ASYNC      020000
> +#define O_DIRECT    0200000
> +#define O_LARGEFILE 0400000
> +#define O_NOATIME  01000000
> +#define O_PATH    010000000
> +#define O_TMPFILE 020040000
> +#define O_NDELAY O_NONBLOCK
> +
> +#define F_DUPFD  0
> +#define F_GETFD  1
> +#define F_SETFD  2
> +#define F_GETFL  3
> +#define F_SETFL  4
> +
> +#define F_SETOWN 8
> +#define F_GETOWN 9
> +#define F_SETSIG 10
> +#define F_GETSIG 11
> +
> +#define F_GETLK 12
> +#define F_SETLK 13
> +#define F_SETLKW 14
> +
> +#define F_SETOWN_EX 15
> +#define F_GETOWN_EX 16
> +
> +#define F_GETOWNER_UIDS 17
> diff --git a/lib/isrlibc/arch/arm64/bits/fcntl.h b/lib/isrlibc/arch/arm64/bits/fcntl.h
> new file mode 100644
> index 0000000..9278797
> --- /dev/null
> +++ b/lib/isrlibc/arch/arm64/bits/fcntl.h
> @@ -0,0 +1,38 @@
> +#define O_CREAT        0100
> +#define O_EXCL         0200
> +#define O_NOCTTY       0400
> +#define O_TRUNC       01000
> +#define O_APPEND      02000
> +#define O_NONBLOCK    04000
> +#define O_DSYNC      010000
> +#define O_SYNC     04010000
> +#define O_RSYNC    04010000
> +#define O_DIRECTORY  040000
> +#define O_NOFOLLOW  0100000
> +#define O_CLOEXEC  02000000
> +
> +#define O_ASYNC      020000
> +#define O_DIRECT    0200000
> +#define O_LARGEFILE 0400000
> +#define O_NOATIME  01000000
> +#define O_PATH    010000000
> +#define O_TMPFILE 020040000
> +#define O_NDELAY O_NONBLOCK
> +
> +#define F_DUPFD  0
> +#define F_GETFD  1
> +#define F_SETFD  2
> +#define F_GETFL  3
> +#define F_SETFL  4
> +#define F_GETLK  5
> +#define F_SETLK  6
> +#define F_SETLKW 7
> +#define F_SETOWN 8
> +#define F_GETOWN 9
> +#define F_SETSIG 10
> +#define F_GETSIG 11
> +
> +#define F_SETOWN_EX 15
> +#define F_GETOWN_EX 16
> +
> +#define F_GETOWNER_UIDS 17
> diff --git a/lib/isrlibc/arch/x86_64/bits/fcntl.h b/lib/isrlibc/arch/x86_64/bits/fcntl.h
> new file mode 100644
> index 0000000..1b88ad3
> --- /dev/null
> +++ b/lib/isrlibc/arch/x86_64/bits/fcntl.h
> @@ -0,0 +1,40 @@
> +#define O_CREAT        0100
> +#define O_EXCL         0200
> +#define O_NOCTTY       0400
> +#define O_TRUNC       01000
> +#define O_APPEND      02000
> +#define O_NONBLOCK    04000
> +#define O_DSYNC      010000
> +#define O_SYNC     04010000
> +#define O_RSYNC    04010000
> +#define O_DIRECTORY 0200000
> +#define O_NOFOLLOW  0400000
> +#define O_CLOEXEC  02000000
> +
> +#define O_ASYNC      020000
> +#define O_DIRECT     040000
> +#define O_LARGEFILE       0
> +#define O_NOATIME  01000000
> +#define O_PATH    010000000
> +#define O_TMPFILE 020200000
> +#define O_NDELAY O_NONBLOCK
> +
> +#define F_DUPFD  0
> +#define F_GETFD  1
> +#define F_SETFD  2
> +#define F_GETFL  3
> +#define F_SETFL  4
> +
> +#define F_SETOWN 8
> +#define F_GETOWN 9
> +#define F_SETSIG 10
> +#define F_GETSIG 11
> +
> +#define F_GETLK 5
> +#define F_SETLK 6
> +#define F_SETLKW 7
> +
> +#define F_SETOWN_EX 15
> +#define F_GETOWN_EX 16
> +
> +#define F_GETOWNER_UIDS 17
> diff --git a/lib/isrlibc/exportsyms.uk b/lib/isrlibc/exportsyms.uk
> new file mode 100644
> index 0000000..5986f7e
> --- /dev/null
> +++ b/lib/isrlibc/exportsyms.uk
> @@ -0,0 +1,2 @@
> +# string
> +isr_memcpy

I saw that you named the symbol memcpy_isr.

> diff --git a/lib/isrlibc/include/isrlibc-internal/shareddefs.h b/lib/isrlibc/include/isrlibc-internal/shareddefs.h
> new file mode 100644
> index 0000000..d386820
> --- /dev/null
> +++ b/lib/isrlibc/include/isrlibc-internal/shareddefs.h
> @@ -0,0 +1,146 @@
> +/* SPDX-License-Identifier: BSD-3-Clause */
> +/*
> + * Authors: Florian Schmidt <florian.schmidt@neclab.eu>
> + *
> + * Copyright (c) 2018, NEC Labs Europe, NEC Corporation. All rights reserved.
> + *
> + * Redistribution and use in source and binary forms, with or without
> + * modification, are permitted provided that the following conditions
> + * are met:
> + *
> + * 1. Redistributions of source code must retain the above copyright
> + *    notice, this list of conditions and the following disclaimer.
> + * 2. Redistributions in binary form must reproduce the above copyright
> + *    notice, this list of conditions and the following disclaimer in the
> + *    documentation and/or other materials provided with the distribution.
> + * 3. Neither the name of the copyright holder nor the names of its
> + *    contributors may be used to endorse or promote products derived from
> + *    this software without specific prior written permission.
> + *
> + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
> + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
> + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
> + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
> + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
> + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
> + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
> + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
> + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
> + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
> + * POSSIBILITY OF SUCH DAMAGE.
> + *
> + * THIS HEADER MAY NOT BE EXTRACTED OR MODIFIED IN ANY WAY.
> + */
> +
> +/* This header does by design not have include guards, so that it can be
> + * included from multiple files. The __NEED_x macros instead make sure that
> + * only those definitions are included that are required by that specific
> + * file, and only if they haven't been defined on a previous pass through
> + * this file.
> + */
> +
> +#include <uk/config.h>
> +#include <uk/arch/types.h>
> +
> +#if (defined __NEED_NULL && !defined __DEFINED_NULL)
> +#ifdef __cplusplus
> +#define NULL 0L
> +#else
> +#define NULL ((void *) 0)
> +#endif
> +#define __DEFINED__NULL
> +#endif
> +
> +#if (defined __NEED_size_t && !defined __DEFINED_size_t)
> +typedef __sz size_t;
> +#define __DEFINED_size_t
> +#endif
> +
> +#if (defined __NEED_ssize_t && !defined __DEFINED_ssize_t)
> +typedef __ssz ssize_t;
> +#define __DEFINED_ssize_t
> +#endif
> +
> +#if (defined __NEED_off_t && !defined __DEFINED_off_t)
> +typedef __off off_t;
> +#define __DEFINED_off_t
> +#endif
> +
> +#if CONFIG_HAVE_TIME
> +#include <uk/time_types.h>
> +#endif
> +
> +#if (defined __NEED_mode_t && !defined __DEFINED_mode_t)
> +typedef unsigned mode_t;
> +#define __DEFINED_mode_t
> +#endif
> +
> +#if defined(__NEED_uid_t) && !defined(__DEFINED_uid_t)
> +typedef unsigned uid_t;
> +#define __DEFINED_uid_t
> +#endif
> +
> +#if defined(__NEED_gid_t) && !defined(__DEFINED_gid_t)
> +typedef unsigned gid_t;
> +#define __DEFINED_gid_t
> +#endif
> +
> +#if defined(__NEED_useconds_t) && !defined(__DEFINED_useconds_t)
> +typedef unsigned useconds_t;
> +#define __DEFINED_useconds_t
> +#endif
> +
> +#if defined(__NEED_pid_t) && !defined(__DEFINED_pid_t)
> +typedef int pid_t;
> +#define __DEFINED_pid_t
> +#endif
> +
> +#if defined(__NEED_id_t) && !defined(__DEFINED_id_t)
> +typedef unsigned id_t;
> +#define __DEFINED_id_t
> +#endif
> +
> +#if defined(__NEED_dev_t) && !defined(__DEFINED_dev_t)
> +typedef __u64 dev_t;
> +#define __DEFINED_dev_t
> +#endif
> +
> +#if defined(__NEED_ino_t) && !defined(__DEFINED_ino_t)
> +typedef __u64 ino_t;
> +#define __DEFINED_ino_t
> +#endif
> +
> +#if defined(__NEED_nlink_t) && !defined(__DEFINED_nlink_t)
> +typedef __u32 nlink_t;
> +#define __DEFINED_nlink_t
> +#endif
> +
> +#if defined(__NEED_blkcnt_t) && !defined(__DEFINED_blkcnt_t)
> +typedef __s64 blkcnt_t;
> +#define __DEFINED_blkcnt_t
> +#endif
> +
> +#if defined(__NEED_blksize_t) && !defined(__DEFINED_blksize_t)
> +typedef long blksize_t;
> +#define __DEFINED_blksize_t
> +#endif
> +
> +#if defined(__NEED_locale_t) && !defined(__DEFINED_locale_t)
> +typedef struct __locale_struct *locale_t;
> +#define __DEFINED_locale_t
> +#endif
> +
> +#if defined(__NEED_struct_iovec) && !defined(__DEFINED_struct_iovec)
> +struct iovec { void *iov_base; size_t iov_len; };
> +#define __DEFINED_struct_iovec
> +#endif
> +
> +#if defined(__NEED_fsblkcnt_t) && !defined(__DEFINED_fsblkcnt_t)
> +typedef unsigned long long fsblkcnt_t;
> +#define __DEFINED_fsblkcnt_t
> +#endif
> +
> +#if defined(__NEED_fsfilcnt_t) && !defined(__DEFINED_fsfilcnt_t)
> +typedef unsigned long long fsfilcnt_t;
> +#define __DEFINED_fsfilcnt_t
> +#endif
> diff --git a/lib/isrlibc/include/string.h b/lib/isrlibc/include/string.h
> new file mode 100644
> index 0000000..84e4acf
> --- /dev/null
> +++ b/lib/isrlibc/include/string.h
> @@ -0,0 +1,53 @@
> +/* SPDX-License-Identifier: BSD-3-Clause */
> +/*
> + * Authors: Simon Kuenzer <simon.kuenzer@neclab.eu>
> + *
> + *
> + * Copyright (c) 2017, NEC Europe Ltd., NEC Corporation. All rights reserved.
> + *
> + * Redistribution and use in source and binary forms, with or without
> + * modification, are permitted provided that the following conditions
> + * are met:
> + *
> + * 1. Redistributions of source code must retain the above copyright
> + *    notice, this list of conditions and the following disclaimer.
> + * 2. Redistributions in binary form must reproduce the above copyright
> + *    notice, this list of conditions and the following disclaimer in the
> + *    documentation and/or other materials provided with the distribution.
> + * 3. Neither the name of the copyright holder nor the names of its
> + *    contributors may be used to endorse or promote products derived from
> + *    this software without specific prior written permission.
> + *
> + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
> + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
> + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
> + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
> + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
> + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
> + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
> + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
> + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
> + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
> + * POSSIBILITY OF SUCH DAMAGE.
> + *
> + * THIS HEADER MAY NOT BE EXTRACTED OR MODIFIED IN ANY WAY.
> + */
> +
> +#ifndef __STRING_H__
> +#define __STRING_H__
> +
> +#ifdef __cplusplus
> +extern "C" {
> +#endif
> +
> +#define __NEED_NULL
> +#define __NEED_size_t
> +#include <isrlibc-internal/shareddefs.h>
> +
> +void *memcpy_isr(void *dst, const void *src, size_t len);
> +
> +#ifdef __cplusplus
> +}
> +#endif
> +
> +#endif /* __STRING_H__ */

You should create a new header. Especially the inlcude guard 
__STRING_H__ conflicts here with nolibc's string.h. You risk that only 
one of your both defintions get defined.

Actually, since this is a Unikraft-specific (non-generic) lib, I would 
put the header under uk/isr/ subdirectory. How about: <uk/isr/string.h>? 
The include guard could then be called __UK_ISR_STRING_H__ . Any other 
suggestion is also fine. You do not have to follow the string.h name 
scheme. It just makes it easier to grasp where a developer finds what if 
we follow a bit the libc scheme.

If you need type definitions, just include them from the libc. Use the 
standard libc provided headers (e.g., <stdint.h>). This way we are 
making sure that `isrlib` works together with any libc that is selected 
to the build.

> diff --git a/lib/isrlibc/include/sys/file.h b/lib/isrlibc/include/sys/file.h
> new file mode 100644
> index 0000000..4fc83b9
> --- /dev/null
> +++ b/lib/isrlibc/include/sys/file.h
> @@ -0,0 +1,21 @@
> +#ifndef _SYS_FILE_H
> +#define _SYS_FILE_H
> +#ifdef __cplusplus
> +extern "C" {
> +#endif
> +
> +#define LOCK_SH	1
> +#define LOCK_EX	2
> +#define LOCK_NB	4
> +#define LOCK_UN	8
> +
> +#define L_SET 0
> +#define L_INCR 1
> +#define L_XTND 2
> +
> +int flock(int, int);
> +
> +#ifdef __cplusplus
> +}
> +#endif
> +#endif
> diff --git a/lib/isrlibc/include/sys/mount.h b/lib/isrlibc/include/sys/mount.h
> new file mode 100644
> index 0000000..c8b1fe2
> --- /dev/null
> +++ b/lib/isrlibc/include/sys/mount.h
> @@ -0,0 +1,109 @@
> +/* SPDX-License-Identifier: BSD-3-Clause */
> +/*
> + * Copyright (C) 2013 Cloudius Systems, Ltd.
> + * Copyright (c) 2019, NEC Europe Ltd., NEC Corporation.
> + *
> + * All rights reserved.
> + *
> + * Redistribution and use in source and binary forms, with or without
> + * modification, are permitted provided that the following conditions
> + * are met:
> + *
> + * 1. Redistributions of source code must retain the above copyright
> + *    notice, this list of conditions and the following disclaimer.
> + * 2. Redistributions in binary form must reproduce the above copyright
> + *    notice, this list of conditions and the following disclaimer in the
> + *    documentation and/or other materials provided with the distribution.
> + * 3. Neither the name of the copyright holder nor the names of its
> + *    contributors may be used to endorse or promote products derived from
> + *    this software without specific prior written permission.
> + *
> + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
> + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
> + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
> + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
> + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
> + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
> + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
> + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
> + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
> + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
> + * POSSIBILITY OF SUCH DAMAGE.
> + *
> + * THIS HEADER MAY NOT BE EXTRACTED OR MODIFIED IN ANY WAY.
> + */
> +
> +#ifndef _SYS_MOUNT_H
> +#define _SYS_MOUNT_H
> +
> +#ifdef __cplusplus
> +extern "C" {
> +#endif
> +
> +
> +#define BLKROSET      _IO(0x12,  93)
> +#define BLKROGET      _IO(0x12,  94)
> +#define BLKRRPART     _IO(0x12,  95)
> +#define BLKGETSIZE    _IO(0x12,  96)
> +#define BLKFLSBUF     _IO(0x12,  97)
> +#define BLKRASET      _IO(0x12,  98)
> +#define BLKRAGET      _IO(0x12,  99)
> +#define BLKFRASET     _IO(0x12, 100)
> +#define BLKFRAGET     _IO(0x12, 101)
> +#define BLKSECTSET    _IO(0x12, 102)
> +#define BLKSECTGET    _IO(0x12, 103)
> +#define BLKSSZGET     _IO(0x12, 104)
> +#define BLKBSZGET    _IOR(0x12, 112, size_t)
> +#define BLKBSZSET    _IOW(0x12, 113, size_t)
> +#define BLKGETSIZE64 _IOR(0x12, 114, size_t)
> +
> +#define MS_RDONLY      1
> +#define MS_NOSUID      2
> +#define MS_NODEV       4
> +#define MS_NOEXEC      8
> +#define MS_SYNCHRONOUS 16
> +#define MS_REMOUNT     32
> +#define MS_MANDLOCK    64
> +#define MS_DIRSYNC     128
> +#define MS_NOATIME     1024
> +#define MS_NODIRATIME  2048
> +#define MS_BIND        4096
> +#define MS_MOVE        8192
> +#define MS_REC         16384
> +#define MS_SILENT      32768
> +#define MS_POSIXACL    (1<<16)
> +#define MS_UNBINDABLE  (1<<17)
> +#define MS_PRIVATE     (1<<18)
> +#define MS_SLAVE       (1<<19)
> +#define MS_SHARED      (1<<20)
> +#define MS_RELATIME    (1<<21)
> +#define MS_KERNMOUNT   (1<<22)
> +#define MS_I_VERSION   (1<<23)
> +#define MS_STRICTATIME (1<<24)
> +#define MS_LAZYTIME    (1<<25)
> +#define MS_NOREMOTELOCK (1<<27)
> +#define MS_NOSEC       (1<<28)
> +#define MS_BORN        (1<<29)
> +#define MS_ACTIVE      (1<<30)
> +#define MS_NOUSER      (1U<<31)
> +
> +#define MS_RMT_MASK (MS_RDONLY|MS_SYNCHRONOUS|MS_MANDLOCK|MS_I_VERSION|MS_LAZYTIME)
> +
> +#define MS_MGC_VAL 0xc0ed0000
> +#define MS_MGC_MSK 0xffff0000
> +
> +#define MNT_FORCE       0x00000001
> +#define MNT_DETACH      0x00000002
> +#define MNT_EXPIRE      0x00000004
> +#define UMOUNT_NOFOLLOW 0x00000008
> +
> +int mount(const char *dev, const char *dir, const char *fsname,
> +	  unsigned long flags, const void *data);
> +int umount(const char *path);
> +int umount2(const char *path, int flags);
> +
> +#ifdef __cplusplus
> +}
> +#endif
> +
> +#endif
> diff --git a/lib/isrlibc/include/sys/param.h b/lib/isrlibc/include/sys/param.h
> new file mode 100644
> index 0000000..f5928d0
> --- /dev/null
> +++ b/lib/isrlibc/include/sys/param.h
> @@ -0,0 +1,38 @@
> +#ifndef _SYS_PARAM_H
> +#define _SYS_PARAM_H
> +
> +#define MAXSYMLINKS 20
> +#define MAXHOSTNAMELEN 64
> +#define MAXNAMLEN 255
> +#define MAXPATHLEN 4096
> +#define NBBY 8
> +#define NGROUPS 32
> +#define CANBSIZ 255
> +#define NOFILE 256
> +#define NCARGS 131072
> +#define DEV_BSIZE 512
> +#define NOGROUP (-1)
> +
> +#undef MIN
> +#undef MAX
> +#define MIN(a, b) (((a) < (b)) ? (a) : (b))
> +#define MAX(a, b) (((a) > (b)) ? (a) : (b))
> +
> +#define __bitop(x, i, o) ((x)[(i) / 8] o(1 << (i) % 8))
> +#define setbit(x, i) __bitop(x, i, |=)
> +#define clrbit(x, i) __bitop(x, i, &= ~)
> +#define isset(x, i) __bitop(x, i, &)
> +#define isclr(x, i) !isset(x, i)
> +
> +#define howmany(n, d) (((n) + ((d) - 1)) / (d))
> +#define roundup(n, d) (howmany(n, d) * (d))
> +#define powerof2(n) !(((n) - 1) & (n))
> +
> +/* TODO: This includes are not needed currently. Lets leave them
> + * commented out as a reminder
> + */
> +/* #include <sys/resource.h> */
> +/* #include <endian.h> */
> +#include <limits.h>
> +
> +#endif
> diff --git a/lib/isrlibc/include/sys/select.h b/lib/isrlibc/include/sys/select.h
> new file mode 100644
> index 0000000..e981b7c
> --- /dev/null
> +++ b/lib/isrlibc/include/sys/select.h
> @@ -0,0 +1,82 @@
> +/* SPDX-License-Identifier: BSD-3-Clause */
> +/*
> + * Copyright (c) 1992, 1993
> + * The Regents of the University of California.  All rights reserved.
> + * Copyright (c) 2017, NEC Europe Ltd., NEC Corporation. All rights reserved.
> + *
> + * Redistribution and use in source and binary forms, with or without
> + * modification, are permitted provided that the following conditions
> + * are met:
> + * 1. Redistributions of source code must retain the above copyright
> + *    notice, this list of conditions and the following disclaimer.
> + * 2. Redistributions in binary form must reproduce the above copyright
> + *    notice, this list of conditions and the following disclaimer in the
> + *    documentation and/or other materials provided with the distribution.
> + * 3. Neither the name of the University nor the names of its contributors
> + *    may be used to endorse or promote products derived from this software
> + *    without specific prior written permission.
> + *
> + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
> + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
> + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
> + * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
> + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
> + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
> + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
> + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
> + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
> + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
> + * SUCH DAMAGE.
> + */
> +/* Derived from FreeBSD commit 4736ccf (Nov 20, 2017) */
> +
> +#ifndef __SYS_SELECT_H__
> +#define __SYS_SELECT_H__
> +
> +#include <sys/param.h>
> +#ifdef __cplusplus
> +extern "C" {
> +#endif
> +
> +#define __NEED_time_t
> +#define __NEED_suseconds_t
> +#define __NEED_struct_timespec
> +#include <nolibc-internal/shareddefs.h>
> +
> +typedef unsigned long __fd_mask;
> +
> +/*
> + * Select uses bit masks of file descriptors in longs. These macros
> + * manipulate such bit fields (the filesystem macros use chars).
> + * FD_SETSIZE may be defined by the user, but the default here should
> + * be enough for most uses.
> + */
> +#ifndef FD_SETSIZE
> +#define FD_SETSIZE 64
> +#endif
> +
> +#define _NFDBITS (sizeof(__fd_mask) * 8) /* bits per mask */
> +
> +typedef struct fd_set {
> +	__fd_mask __fds_bits[howmany(FD_SETSIZE, _NFDBITS)];
> +} fd_set;
> +
> +#define	__fdset_mask(n)	((__fd_mask)1 << ((n) % _NFDBITS))
> +#define	FD_CLR(n, p)	((p)->__fds_bits[(n)/_NFDBITS] &= ~__fdset_mask(n))
> +#define	FD_ISSET(n, p)	(((p)->__fds_bits[(n)/_NFDBITS] & __fdset_mask(n)) != 0)
> +#define	FD_SET(n, p)	((p)->__fds_bits[(n)/_NFDBITS] |= __fdset_mask(n))
> +#define	FD_ZERO(p) do {					\
> +	fd_set *_p;					\
> +	__ssz _n;					\
> +							\
> +	_p = (p);					\
> +	_n = howmany(FD_SETSIZE, _NFDBITS);		\
> +	while (_n > 0)					\
> +		_p->__fds_bits[--_n] = 0;		\
> +} while (0)
> +
> +#ifdef __cplusplus
> +}
> +#endif
> +
> +#endif /* __SYS_SELECT_H__ */
> diff --git a/lib/isrlibc/include/sys/stat.h b/lib/isrlibc/include/sys/stat.h
> new file mode 100644
> index 0000000..407bc20
> --- /dev/null
> +++ b/lib/isrlibc/include/sys/stat.h
> @@ -0,0 +1,135 @@
> +#ifndef	_SYS_STAT_H
> +#define	_SYS_STAT_H
> +#ifdef __cplusplus
> +extern "C" {
> +#endif
> +
> +/* #include <features.h> */
> +
> +#define __NEED_dev_t
> +#define __NEED_ino_t
> +#define __NEED_mode_t
> +#define __NEED_nlink_t
> +#define __NEED_uid_t
> +#define __NEED_gid_t
> +#define __NEED_off_t
> +#define __NEED_time_t
> +#define __NEED_blksize_t
> +#define __NEED_blkcnt_t
> +#define __NEED_struct_timespec
> +
> +#include <nolibc-internal/shareddefs.h>
> +
> +struct stat {
> +	dev_t st_dev;
> +	ino_t st_ino;
> +	nlink_t st_nlink;
> +
> +	mode_t st_mode;
> +	uid_t st_uid;
> +	gid_t st_gid;
> +	unsigned int    __pad0;
> +	dev_t st_rdev;
> +	off_t st_size;
> +	blksize_t st_blksize;
> +	blkcnt_t st_blocks;
> +
> +	struct timespec st_atim;
> +	struct timespec st_mtim;
> +	struct timespec st_ctim;
> +};
> +
> +#define st_atime st_atim.tv_sec
> +#define st_mtime st_mtim.tv_sec
> +#define st_ctime st_ctim.tv_sec
> +
> +#define S_IFMT  0170000
> +
> +#define S_IFDIR 0040000
> +#define S_IFCHR 0020000
> +#define S_IFBLK 0060000
> +#define S_IFREG 0100000
> +#define S_IFIFO 0010000
> +#define S_IFLNK 0120000
> +#define S_IFSOCK 0140000
> +
> +#define S_TYPEISMQ(buf)  0
> +#define S_TYPEISSEM(buf) 0
> +#define S_TYPEISSHM(buf) 0
> +#define S_TYPEISTMO(buf) 0
> +
> +#define S_ISDIR(mode)  (((mode) & S_IFMT) == S_IFDIR)
> +#define S_ISCHR(mode)  (((mode) & S_IFMT) == S_IFCHR)
> +#define S_ISBLK(mode)  (((mode) & S_IFMT) == S_IFBLK)
> +#define S_ISREG(mode)  (((mode) & S_IFMT) == S_IFREG)
> +#define S_ISFIFO(mode) (((mode) & S_IFMT) == S_IFIFO)
> +#define S_ISLNK(mode)  (((mode) & S_IFMT) == S_IFLNK)
> +#define S_ISSOCK(mode) (((mode) & S_IFMT) == S_IFSOCK)
> +
> +#ifndef S_IRUSR
> +#define S_ISUID 04000
> +#define S_ISGID 02000
> +#define S_ISVTX 01000
> +#define S_IRUSR 0400
> +#define S_IWUSR 0200
> +#define S_IXUSR 0100
> +#define S_IRWXU 0700
> +#define S_IRGRP 0040
> +#define S_IWGRP 0020
> +#define S_IXGRP 0010
> +#define S_IRWXG 0070
> +#define S_IROTH 0004
> +#define S_IWOTH 0002
> +#define S_IXOTH 0001
> +#define S_IRWXO 0007
> +#endif
> +
> +#define UTIME_NOW  0x3fffffff
> +#define UTIME_OMIT 0x3ffffffe
> +
> +int stat(const char *__restrict, struct stat *__restrict);
> +int fstat(int, struct stat *);
> +int lstat(const char *__restrict, struct stat *__restrict);
> +int fstatat(int, const char *__restrict, struct stat *__restrict, int);
> +int chmod(const char *, mode_t);
> +int fchmod(int, mode_t);
> +int fchmodat(int, const char *, mode_t, int);
> +mode_t umask(mode_t);
> +int mkdir(const char *, mode_t);
> +int mkfifo(const char *, mode_t);
> +int mkdirat(int, const char *, mode_t);
> +int mkfifoat(int, const char *, mode_t);
> +
> +#if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
> +int mknod(const char *, mode_t, dev_t);
> +int mknodat(int, const char *, mode_t, dev_t);
> +#endif
> +
> +int futimens(int, const struct timespec [2]);
> +int utimensat(int, const char *, const struct timespec [2], int);
> +
> +#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
> +int lchmod(const char *, mode_t);
> +#define S_IREAD S_IRUSR
> +#define S_IWRITE S_IWUSR
> +#define S_IEXEC S_IXUSR
> +#endif
> +
> +#if defined(_LARGEFILE64_SOURCE) || defined(_GNU_SOURCE)
> +#define stat64 stat
> +#define fstat64 fstat
> +#define lstat64 lstat
> +#define fstatat64 fstatat
> +#define blkcnt64_t blkcnt_t
> +#define fsblkcnt64_t fsblkcnt_t
> +#define fsfilcnt64_t fsfilcnt_t
> +#define ino64_t ino_t
> +#define off64_t off_t
> +#endif
> +
> +#ifdef __cplusplus
> +}
> +#endif
> +#endif
> +
> +
> diff --git a/lib/isrlibc/include/sys/statfs.h b/lib/isrlibc/include/sys/statfs.h
> new file mode 100644
> index 0000000..59de629
> --- /dev/null
> +++ b/lib/isrlibc/include/sys/statfs.h
> @@ -0,0 +1,36 @@
> +#ifndef	_SYS_STATFS_H
> +#define	_SYS_STATFS_H
> +
> +#ifdef __cplusplus
> +extern "C" {
> +#endif
> +
> +#include <sys/statvfs.h>
> +
> +typedef struct __fsid_t {
> +	int __val[2];
> +} fsid_t;
> +
> +struct statfs {
> +	unsigned long f_type, f_bsize;
> +	fsblkcnt_t f_blocks, f_bfree, f_bavail;
> +	fsfilcnt_t f_files, f_ffree;
> +	fsid_t f_fsid;
> +	unsigned long f_namelen, f_frsize, f_flags, f_spare[4];
> +};
> +
> +int statfs(const char *path, struct statfs *buf);
> +int fstatfs(int fd, struct statfs *buf);
> +
> +#if defined(_LARGEFILE64_SOURCE) || defined(_GNU_SOURCE)
> +#define statfs64 statfs
> +#define fstatfs64 fstatfs
> +#define fsblkcnt64_t fsblkcnt_t
> +#define fsfilcnt64_t fsfilcnt_t
> +#endif
> +
> +#ifdef __cplusplus
> +}
> +#endif
> +
> +#endif
> diff --git a/lib/isrlibc/include/sys/statvfs.h b/lib/isrlibc/include/sys/statvfs.h
> new file mode 100644
> index 0000000..85a2ff9
> --- /dev/null
> +++ b/lib/isrlibc/include/sys/statvfs.h
> @@ -0,0 +1,54 @@
> +#ifndef	_SYS_STATVFS_H
> +#define	_SYS_STATVFS_H
> +
> +#ifdef __cplusplus
> +extern "C" {
> +#endif
> +
> +#define __NEED_fsblkcnt_t
> +#define __NEED_fsfilcnt_t
> +#include <nolibc-internal/shareddefs.h>
> +
> +struct statvfs {
> +	unsigned long f_bsize, f_frsize;
> +	fsblkcnt_t f_blocks, f_bfree, f_bavail;
> +	fsfilcnt_t f_files, f_ffree, f_favail;
> +#if __BYTE_ORDER == __LITTLE_ENDIAN
> +	unsigned long f_fsid;
> +	unsigned :8*(2*sizeof(int)-sizeof(long));
> +#else
> +	unsigned :8*(2*sizeof(int)-sizeof(long));
> +	unsigned long f_fsid;
> +#endif
> +	unsigned long f_flag, f_namemax;
> +	int __reserved[6];
> +};
> +
> +int statvfs (const char *__restrict, struct statvfs *__restrict);
> +int fstatvfs (int, struct statvfs *);
> +
> +#define ST_RDONLY 1
> +#define ST_NOSUID 2
> +#define ST_NODEV  4
> +#define ST_NOEXEC 8
> +#define ST_SYNCHRONOUS 16
> +#define ST_MANDLOCK    64
> +#define ST_WRITE       128
> +#define ST_APPEND      256
> +#define ST_IMMUTABLE   512
> +#define ST_NOATIME     1024
> +#define ST_NODIRATIME  2048
> +#define ST_RELATIME    4096
> +
> +#if defined(_LARGEFILE64_SOURCE) || defined(_GNU_SOURCE)
> +#define statvfs64 statvfs
> +#define fstatvfs64 fstatvfs
> +#define fsblkcnt64_t fsblkcnt_t
> +#define fsfilcnt64_t fsfilcnt_t
> +#endif
> +
> +#ifdef __cplusplus
> +}
> +#endif
> +
> +#endif
> diff --git a/lib/isrlibc/include/sys/types.h b/lib/isrlibc/include/sys/types.h
> new file mode 100644
> index 0000000..4da777c
> --- /dev/null
> +++ b/lib/isrlibc/include/sys/types.h
> @@ -0,0 +1,69 @@
> +/* SPDX-License-Identifier: BSD-3-Clause */
> +/*
> + * Authors: Simon Kuenzer <simon.kuenzer@neclab.eu>
> + *
> + *
> + * Copyright (c) 2017, NEC Europe Ltd., NEC Corporation. All rights reserved.
> + *
> + * Redistribution and use in source and binary forms, with or without
> + * modification, are permitted provided that the following conditions
> + * are met:
> + *
> + * 1. Redistributions of source code must retain the above copyright
> + *    notice, this list of conditions and the following disclaimer.
> + * 2. Redistributions in binary form must reproduce the above copyright
> + *    notice, this list of conditions and the following disclaimer in the
> + *    documentation and/or other materials provided with the distribution.
> + * 3. Neither the name of the copyright holder nor the names of its
> + *    contributors may be used to endorse or promote products derived from
> + *    this software without specific prior written permission.
> + *
> + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
> + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
> + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
> + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
> + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
> + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
> + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
> + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
> + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
> + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
> + * POSSIBILITY OF SUCH DAMAGE.
> + *
> + * THIS HEADER MAY NOT BE EXTRACTED OR MODIFIED IN ANY WAY.
> + */
> +
> +
> +#ifndef __SYS_TYPES_H__
> +#define __SYS_TYPES_H__
> +
> +#include <uk/arch/types.h>
> +
> +#ifdef __cplusplus
> +extern "C" {
> +#endif
> +
> +#define __NEED_size_t
> +#define __NEED_ssize_t
> +#define __NEED_off_t
> +#define __NEED_time_t
> +#define __NEED_timer_t
> +#define __NEED_suseconds_t
> +#define __NEED_clock_t
> +#define __NEED_clockid_t
> +#define __NEED_locale_t
> +#define __NEED_mode_t
> +#define __NEED_uid_t
> +#define __NEED_gid_t
> +#define __NEED_pid_t
> +#define __NEED_id_t
> +#define __NEED_dev_t
> +#define __NEED_ino_t
> +#define __NEED_nlink_t
> +#include <nolibc-internal/shareddefs.h>
> +
> +#ifdef __cplusplus
> +}
> +#endif
> +
> +#endif /* __SYS_TYPES_H__ */
> diff --git a/lib/isrlibc/include/sys/uio.h b/lib/isrlibc/include/sys/uio.h
> new file mode 100644
> index 0000000..d1a4b48
> --- /dev/null
> +++ b/lib/isrlibc/include/sys/uio.h
> @@ -0,0 +1,76 @@
> +/* SPDX-License-Identifier: BSD-3-Clause */
> +/*
> + * Copyright (C) 2013 Cloudius Systems, Ltd.
> + * Copyright (c) 2019, NEC Europe Ltd., NEC Corporation.
> + *
> + * All rights reserved.
> + *
> + * Redistribution and use in source and binary forms, with or without
> + * modification, are permitted provided that the following conditions
> + * are met:
> + *
> + * 1. Redistributions of source code must retain the above copyright
> + *    notice, this list of conditions and the following disclaimer.
> + * 2. Redistributions in binary form must reproduce the above copyright
> + *    notice, this list of conditions and the following disclaimer in the
> + *    documentation and/or other materials provided with the distribution.
> + * 3. Neither the name of the copyright holder nor the names of its
> + *    contributors may be used to endorse or promote products derived from
> + *    this software without specific prior written permission.
> + *
> + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
> + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
> + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
> + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
> + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
> + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
> + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
> + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
> + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
> + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
> + * POSSIBILITY OF SUCH DAMAGE.
> + *
> + * THIS HEADER MAY NOT BE EXTRACTED OR MODIFIED IN ANY WAY.
> + */
> +
> +#ifndef _SYS_UIO_H
> +#define _SYS_UIO_H
> +
> +#ifdef __cplusplus
> +extern "C" {
> +#endif
> +
> +#define __NEED_size_t
> +#define __NEED_ssize_t
> +#define __NEED_struct_iovec
> +
> +#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
> +#define __NEED_off_t
> +#endif
> +
> +#ifdef _GNU_SOURCE
> +#define __NEED_pid_t
> +#endif
> +
> +#include <nolibc-internal/shareddefs.h>
> +
> +#define UIO_MAXIOV 1024
> +
> +ssize_t readv(int fd, const struct iovec *iov, int iovcnt);
> +ssize_t writev(int fd, const struct iovec *iov, int iovcnt);
> +
> +#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
> +ssize_t preadv(int fd, const struct iovec *iov, int iovcnt, off_t offset);
> +ssize_t pwritev(int fd, const struct iovec *iov, int iovcnt, off_t offset);
> +#if defined(_LARGEFILE64_SOURCE) || defined(_GNU_SOURCE)
> +#define preadv64 preadv
> +#define pwritev64 pwritev
> +#define off64_t off_t
> +#endif
> +#endif
> +
> +#ifdef __cplusplus
> +}
> +#endif
> +
> +#endif
> diff --git a/lib/isrlibc/string.c b/lib/isrlibc/string.c
> new file mode 100644
> index 0000000..8425202
> --- /dev/null
> +++ b/lib/isrlibc/string.c
> @@ -0,0 +1,16 @@
> +#include <stdlib.h>
> +#include <stdint.h>
> +#include <string.h>
> +#include <limits.h>
> +#include <errno.h>
> +#include <stdio.h>
> +

This makes sense. I would start with a lib that just has this memcpy 
function and a minimal skeleton. We continue from there then...

> +void *memcpy_isr(void *dst, const void *src, size_t len)
> +{
> +	size_t p;
> +
> +	for (p = 0; p < len; ++p)
> +		*((__u8 *)(((__uptr)dst) + p)) = *((__u8 *)(((__uptr)src) + p));
> +
> +	return dst;
> +}
> \ No newline at end of file

Make sure you have a ending newline in your files in order to avoid this 
warning.

> 



From minios-devel-bounces@lists.xenproject.org Fri Aug 07 17:27:24 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Fri, 07 Aug 2020 17:27:24 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1k469K-0006p8-72; Fri, 07 Aug 2020 17:27:22 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=vDsm=BR=neclab.eu=simon.kuenzer@srs-us1.protection.inumbo.net>)
 id 1k469I-0006p3-C9
 for minios-devel@lists.xen.org; Fri, 07 Aug 2020 17:27:20 +0000
X-Inumbo-ID: bbd52918-89fd-44d0-8e90-fd439649eb0e
Received: from mailer1.neclab.eu (unknown [195.37.70.40])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id bbd52918-89fd-44d0-8e90-fd439649eb0e;
 Fri, 07 Aug 2020 17:27:16 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
 by mailer1.neclab.eu (Postfix) with ESMTP id 8372A105566;
 Fri,  7 Aug 2020 19:27:15 +0200 (CEST)
X-Virus-Scanned: Amavisd on Debian GNU/Linux (atlas-a.office.hd)
Received: from mailer1.neclab.eu ([127.0.0.1])
 by localhost (atlas-a.office.hd [127.0.0.1]) (amavisd-new, port 10024)
 with ESMTP id kyrqHZOb0ohP; Fri,  7 Aug 2020 19:27:15 +0200 (CEST)
X-ENC: Last-Hop-TLS-encrypted
X-ENC: Last-Hop-TLS-encrypted
Received: from puck.office.hd (puck.office.hd [192.168.24.91])
 (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
 (No client certificate requested)
 by mailer1.neclab.eu (Postfix) with ESMTPS id 573B4103AE3;
 Fri,  7 Aug 2020 19:27:15 +0200 (CEST)
Received: from [10.7.1.42] (192.168.24.96) by puck.office.hd (192.168.24.91)
 with Microsoft SMTP Server (version=TLS1_2,
 cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1979.3; Fri, 7 Aug 2020
 19:27:14 +0200
Subject: Re: [UNIKRAFT PATCH v6 1/3] lib/uksp: Introduce uksp library
To: Alice Suiu <alicesuiu17@gmail.com>, Vlad-Andrei Badoiu
 <vlad_andrei.badoiu@upb.ro>
References: <20200803135836.10392-1-vlad_andrei.badoiu@upb.ro>
 <20200803135836.10392-2-vlad_andrei.badoiu@upb.ro>
 <CAD2TrnAPLZXqtn6a+y_Mu8gBsLexrtmk_A_Yy+J4OVvC1Yrz=g@mail.gmail.com>
From: Simon Kuenzer <simon.kuenzer@neclab.eu>
Message-ID: <e0ddfef8-efaa-c515-f19a-323a6e17dd5a@neclab.eu>
Date: Fri, 7 Aug 2020 19:27:13 +0200
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:68.0)
 Gecko/20100101 Thunderbird/68.11.0
MIME-Version: 1.0
In-Reply-To: <CAD2TrnAPLZXqtn6a+y_Mu8gBsLexrtmk_A_Yy+J4OVvC1Yrz=g@mail.gmail.com>
Content-Type: text/plain; charset="utf-8"; format=flowed
Content-Language: en-US
Content-Transfer-Encoding: 8bit
X-Originating-IP: [192.168.24.96]
X-ClientProxiedBy: titania.office.hd (192.168.24.89) To puck.office.hd
 (192.168.24.91)
X-BeenThere: minios-devel@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Mini-os development list <minios-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:minios-devel@lists.xenproject.org>
List-Help: <mailto:minios-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=subscribe>
Cc: =?UTF-8?Q?Vlad-Andrei_B=c4=82DOIU_=2878692=29?=
 <vlad_andrei.badoiu@stud.acs.upb.ro>, minios-devel@lists.xen.org
Errors-To: minios-devel-bounces@lists.xenproject.org
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>

On 04.08.20 10:13, Alice Suiu wrote:
> Reviewed-by: Alice Suiu <alicesuiu17@gmail.com> <alicesuiu17@gmail.com>
> 
> ÃŽn lun., 3 aug. 2020 la 17:06, Vlad-Andrei Badoiu <vlad_andrei.badoiu@upb.ro>
> a scris:
> 
>> From: Vlad-Andrei BÄ‚DOIU (78692) <vlad_andrei.badoiu@stud.acs.upb.ro>
>>
>> This library provides the necessary functionalities for the stack
>> protector.
>>
>> A make clean is required when toggling the stack smashing protection
>> option.
>>
>> Signed-off-by: Vlad-Andrei Badoiu <vlad_andrei.badoiu@stud.acs.upb.ro>
>> Signed-off-by: Vlad-Andrei Badoiu <vlad_andrei.badoiu@upb.ro>
>> ---
>>   lib/Makefile.uk          |  1 +
>>   lib/uksp/Config.uk       | 46 +++++++++++++++++++++++++++++++
>>   lib/uksp/Makefile.uk     |  9 +++++++
>>   lib/uksp/exportsyms.uk   |  2 ++
>>   lib/uksp/include/uk/sp.h | 58 ++++++++++++++++++++++++++++++++++++++++
>>   lib/uksp/ssp.c           | 51 +++++++++++++++++++++++++++++++++++
>>   6 files changed, 167 insertions(+)
>>   create mode 100644 lib/uksp/Config.uk
>>   create mode 100644 lib/uksp/Makefile.uk
>>   create mode 100644 lib/uksp/exportsyms.uk
>>   create mode 100644 lib/uksp/include/uk/sp.h
>>   create mode 100644 lib/uksp/ssp.c
>>
>> diff --git a/lib/Makefile.uk b/lib/Makefile.uk
>> index 9261533c..07e8a295 100644
>> --- a/lib/Makefile.uk
>> +++ b/lib/Makefile.uk
>> @@ -36,3 +36,4 @@ $(eval $(call _import_lib,$(CONFIG_UK_BASE)/lib/uktime))
>>   $(eval $(call _import_lib,$(CONFIG_UK_BASE)/lib/ukmmap))
>>   $(eval $(call _import_lib,$(CONFIG_UK_BASE)/lib/ukblkdev))
>>   $(eval $(call _import_lib,$(CONFIG_UK_BASE)/lib/posix-process))
>> +$(eval $(call _import_lib,$(CONFIG_UK_BASE)/lib/uksp))
>> diff --git a/lib/uksp/Config.uk b/lib/uksp/Config.uk
>> new file mode 100644
>> index 00000000..0881ddec
>> --- /dev/null
>> +++ b/lib/uksp/Config.uk
>> @@ -0,0 +1,46 @@
>> +config LIBUKSP

Hey Alice, hey Vlad,

I changed `config` to `menuconfig` while upstreaming. This should be 
used to create sub menus.

Thanks,

Simon

>> +       bool "uksp: Stack protector"
>> +       select HAVE_STACKPROTECTOR
>> +       default n
>> +
>> +if LIBUKSP
>> +choice >> +       prompt "Stack protector level"
>> +       default STACKPROTECTOR_REGULAR
>> +       help
>> +         Set the stack protector level
>> +
>> +config STACKPROTECTOR_REGULAR
>> +       bool "Regular"
>> +       help
>> +               Regular stack protector, use -fstack-protector.
>> +
>> +config STACKPROTECTOR_STRONG
>> +       bool "Strong"
>> +       help
>> +               Strong stack protector, use -fstack-protector-strong.
>> +
>> +config STACKPROTECTOR_ALL
>> +       bool "All"
>> +       help
>> +               Protect all functions, use -fstack-protector-all.
>> +endchoice
>> +
>> +choice
>> +       prompt "Canary Value"
>> +       default LIBUKSP_VALUE_USECONSTANT
>> +
>> +config LIBUKSP_VALUE_USECONSTANT
>> +       bool "Compiled-in constant"
>> +
>> +config LIBUKSP_VALUE_RANDOM
>> +       bool "Random variable"
>> +       select LIBUKSWRAND
>> +endchoice
>> +
>> +config LIBUKSP_VALUE_CONSTANT
>> +       int "Canary value"
>> +       depends on LIBUKSP_VALUE_USECONSTANT
>> +       default 42
>> +
>> +endif
>> diff --git a/lib/uksp/Makefile.uk b/lib/uksp/Makefile.uk
>> new file mode 100644
>> index 00000000..4e591231
>> --- /dev/null
>> +++ b/lib/uksp/Makefile.uk
>> @@ -0,0 +1,9 @@
>> +$(eval $(call addlib_s,libuksp,$(CONFIG_LIBUKSP)))
>> +
>> +CINCLUDES-y += -I$(LIBUKSP_BASE)/include
>> +
>> +LIBUKSP_SRCS-y += $(LIBUKSP_BASE)/ssp.c
>> +
>> +COMPFLAGS-$(CONFIG_STACKPROTECTOR_REGULAR)     += -fstack-protector
>> -mstack-protector-guard=global
>> +COMPFLAGS-$(CONFIG_STACKPROTECTOR_STRONG)      +=
>> -fstack-protector-strong -mstack-protector-guard=global
>> +COMPFLAGS-$(CONFIG_STACKPROTECTOR_ALL)         += -fstack-protector-all
>> -mstack-protector-guard=global
>> diff --git a/lib/uksp/exportsyms.uk b/lib/uksp/exportsyms.uk
>> new file mode 100644
>> index 00000000..fbc319e7
>> --- /dev/null
>> +++ b/lib/uksp/exportsyms.uk
>> @@ -0,0 +1,2 @@
>> +__stack_chk_fail
>> +__stack_chk_guard
>> diff --git a/lib/uksp/include/uk/sp.h b/lib/uksp/include/uk/sp.h
>> new file mode 100644
>> index 00000000..ab8b4177
>> --- /dev/null
>> +++ b/lib/uksp/include/uk/sp.h
>> @@ -0,0 +1,58 @@
>> +/* SPDX-License-Identifier: BSD-3-Clause */
>> +/*
>> + * Authors: Vlad-Andrei Badoiu <vlad_andrei.badoiu@stud.acs.upb.ro>
>> + *
>> + * Copyright (c) 2019, University Politehnica of Bucharest. All rights
>> reserved.
>> + *
>> + * Redistribution and use in source and binary forms, with or without
>> + * modification, are permitted provided that the following conditions
>> + * are met:
>> + *
>> + * 1. Redistributions of source code must retain the above copyright
>> + *    notice, this list of conditions and the following disclaimer.
>> + * 2. Redistributions in binary form must reproduce the above copyright
>> + *    notice, this list of conditions and the following disclaimer in the
>> + *    documentation and/or other materials provided with the distribution.
>> + * 3. Neither the name of the copyright holder nor the names of its
>> + *    contributors may be used to endorse or promote products derived from
>> + *    this software without specific prior written permission.
>> + *
>> + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
>> "AS IS"
>> + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
>> THE
>> + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
>> PURPOSE
>> + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS
>> BE
>> + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
>> + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
>> + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
>> BUSINESS
>> + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
>> + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
>> + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
>> THE
>> + * POSSIBILITY OF SUCH DAMAGE.
>> + */
>> +
>> +#ifndef __UK_STACKPROTECTOR_H__
>> +#define __UK_STACKPROTECTOR_H__
>> +
>> +#ifdef CONFIG_LIBUKSP_VALUE_RANDOM
>> +#include <uk/swrand.h>
>> +#endif
>> +#include <uk/config.h>
>> +
>> +#ifdef __cplusplus
>> +extern "C" {
>> +#endif
>> +
>> +extern const unsigned long __stack_chk_guard;
>> +
>> +#ifdef CONFIG_LIBUKSP_VALUE_RANDOM
>> +#define UKSP_INIT_CANARY() (*(DECONST(unsigned long *,
>> &__stack_chk_guard)) \
>> +               = uk_swrand_randr())
>> +#else
>> +#define UKSP_INIT_CANARY()
>> +#endif
>> +
>> +#ifdef __cplusplus
>> +}
>> +#endif
>> +
>> +#endif /* __UK_STACKPROTECTOR_H__ */
>> diff --git a/lib/uksp/ssp.c b/lib/uksp/ssp.c
>> new file mode 100644
>> index 00000000..8a847f5c
>> --- /dev/null
>> +++ b/lib/uksp/ssp.c
>> @@ -0,0 +1,51 @@
>> +/* SPDX-License-Identifier: BSD-3-Clause */
>> +/*
>> + * Authors: Badoiu Vlad-Andrei <vlad_andrei.badoiu@stud.acs.upb.ro>
>> + *
>> + * Copyright (c) 2019, University Politehnica of Bucharest. All rights
>> reserved.
>> + *
>> + * Redistribution and use in source and binary forms, with or without
>> + * modification, are permitted provided that the following conditions
>> + * are met:
>> + *
>> + * 1. Redistributions of source code must retain the above copyright
>> + *    notice, this list of conditions and the following disclaimer.
>> + * 2. Redistributions in binary form must reproduce the above copyright
>> + *    notice, this list of conditions and the following disclaimer in the
>> + *    documentation and/or other materials provided with the distribution.
>> + * 3. Neither the name of the copyright holder nor the names of its
>> + *    contributors may be used to endorse or promote products derived from
>> + *    this software without specific prior written permission.
>> + *
>> + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
>> "AS IS"
>> + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
>> THE
>> + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
>> PURPOSE
>> + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS
>> BE
>> + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
>> + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
>> + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
>> BUSINESS
>> + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
>> + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
>> + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
>> THE
>> + * POSSIBILITY OF SUCH DAMAGE.
>> + */
>> +
>> +#include <uk/assert.h>
>> +#include <uk/config.h>
>> +#include <uk/ctors.h>
>> +#include <uk/thread.h>
>> +
>> +#ifdef CONFIG_LIBUKSP_VALUE_USECONSTANT
>> +const unsigned long __stack_chk_guard = CONFIG_LIBUKSP_VALUE_CONSTANT;
>> +#else
>> +const unsigned long __stack_chk_guard = 0xDEADBEEF;
>> +#endif
>> +
>> +__attribute__((noreturn))
>> +void __stack_chk_fail(void)
>> +{
>> +       unsigned long sp;
>> +
>> +       sp = ukarch_read_sp() & STACK_MASK_TOP;
>> +       UK_CRASH("Stack smashing detected. SP %p\n", (void *) sp);
>> +}
>> --
>> 2.25.1
>>
>>
> 


From minios-devel-bounces@lists.xenproject.org Fri Aug 07 18:06:30 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Fri, 07 Aug 2020 18:06:30 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1k46lA-0002Ea-LB; Fri, 07 Aug 2020 18:06:28 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=hX4I=BR=upb.ro=vlad_andrei.badoiu@srs-us1.protection.inumbo.net>)
 id 1k46l9-0002EV-CT
 for minios-devel@lists.xen.org; Fri, 07 Aug 2020 18:06:27 +0000
X-Inumbo-ID: 2b148827-5564-4bab-a755-8a84566e65b2
Received: from mx.upb.ro (unknown [141.85.13.220])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 2b148827-5564-4bab-a755-8a84566e65b2;
 Fri, 07 Aug 2020 18:06:23 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
 by mx.upb.ro (Postfix) with ESMTP id B0E16B561D3A;
 Fri,  7 Aug 2020 21:06:22 +0300 (EEST)
Received: from mx.upb.ro ([127.0.0.1])
 by localhost (mx.upb.ro [127.0.0.1]) (amavisd-new, port 10032)
 with ESMTP id V2V16ZuIr-y2; Fri,  7 Aug 2020 21:06:19 +0300 (EEST)
Received: from localhost (localhost [127.0.0.1])
 by mx.upb.ro (Postfix) with ESMTP id E6798B561D4A;
 Fri,  7 Aug 2020 21:06:18 +0300 (EEST)
DKIM-Filter: OpenDKIM Filter v2.10.3 mx.upb.ro E6798B561D4A
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=upb.ro;
 s=96342B8A-77E4-11E5-BA93-D93D0963A2DF; t=1596823579;
 bh=94XhrgXy4PCrdhP0Ynqkae3dXKyBl/Bktf+iAhGJ/IA=;
 h=Date:From:To:Message-ID:MIME-Version;
 b=nLmN6yAH7Npc7x2t14mx9YPi52Fq2726p6wjhgvWUJyQcWc/4fSdbAM6qAp5XUXpG
 gGjtopk4WGMWrluWKQzeRyeelY7REirSQXaIoryJsZXH5Hf84JsBgnDvbZr35mDr6w
 1dU1hg8Ha1A1DAHt3sxoKYw3IrEeV2PNKN81kRBk=
X-Virus-Scanned: amavisd-new at upb.ro
Received: from mx.upb.ro ([127.0.0.1])
 by localhost (mx.upb.ro [127.0.0.1]) (amavisd-new, port 10026)
 with ESMTP id qPm0UdiDaWzk; Fri,  7 Aug 2020 21:06:18 +0300 (EEST)
Received: from mx.upb.ro (localhost [127.0.0.1])
 by mx.upb.ro (Postfix) with ESMTP id C51C7B561CED;
 Fri,  7 Aug 2020 21:06:18 +0300 (EEST)
Date: Fri, 7 Aug 2020 21:06:18 +0300 (EEST)
From: Vlad-Andrei =?utf-8?Q?B=C4=82DOIU?= <vlad_andrei.badoiu@upb.ro>
To: Simon Kuenzer <simon.kuenzer@neclab.eu>
Message-ID: <734900292.53247.1596823578499.JavaMail.zimbra@upb.ro>
In-Reply-To: <e0ddfef8-efaa-c515-f19a-323a6e17dd5a@neclab.eu>
References: <20200803135836.10392-1-vlad_andrei.badoiu@upb.ro>
 <20200803135836.10392-2-vlad_andrei.badoiu@upb.ro>
 <CAD2TrnAPLZXqtn6a+y_Mu8gBsLexrtmk_A_Yy+J4OVvC1Yrz=g@mail.gmail.com>
 <e0ddfef8-efaa-c515-f19a-323a6e17dd5a@neclab.eu>
Subject: Re: [UNIKRAFT PATCH v6 1/3] lib/uksp: Introduce uksp library
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Mailer: Zimbra 8.8.12_GA_3794 (ZimbraWebClient - FF79 (Linux)/8.8.12_GA_3794)
Thread-Topic: lib/uksp: Introduce uksp library
Thread-Index: qACEeaFhXY5Nhd46wzXd4PLJczw2og==
X-BeenThere: minios-devel@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Mini-os development list <minios-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:minios-devel@lists.xenproject.org>
List-Help: <mailto:minios-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=subscribe>
Cc: minios-devel@lists.xen.org, Vlad-Andrei =?utf-8?Q?B=C4=82DOIU_=2878692=29?=
 <vlad_andrei.badoiu@stud.acs.upb.ro>, Alice Suiu <alicesuiu17@gmail.com>
Errors-To: minios-devel-bounces@lists.xenproject.org
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>

Sounds good. Thanks!

Vlad

----- Original Message -----
From: "Simon Kuenzer" <simon.kuenzer@neclab.eu>
To: "Alice Suiu" <alicesuiu17@gmail.com>, "Vlad-Andrei Badoiu" <vlad_andrei=
.badoiu@upb.ro>
Cc: minios-devel@lists.xen.org, "Vlad-Andrei B=C4=82DOIU (78692)" <vlad_and=
rei.badoiu@stud.acs.upb.ro>
Sent: Friday, August 7, 2020 8:27:13 PM
Subject: Re: [UNIKRAFT PATCH v6 1/3] lib/uksp: Introduce uksp library

On 04.08.20 10:13, Alice Suiu wrote:
> Reviewed-by: Alice Suiu <alicesuiu17@gmail.com> <alicesuiu17@gmail.com>
>=20
> =C3=8En lun., 3 aug. 2020 la 17:06, Vlad-Andrei Badoiu <vlad_andrei.badoi=
u@upb.ro>
> a scris:
>=20
>> From: Vlad-Andrei B=C4=82DOIU (78692) <vlad_andrei.badoiu@stud.acs.upb.r=
o>
>>
>> This library provides the necessary functionalities for the stack
>> protector.
>>
>> A make clean is required when toggling the stack smashing protection
>> option.
>>
>> Signed-off-by: Vlad-Andrei Badoiu <vlad_andrei.badoiu@stud.acs.upb.ro>
>> Signed-off-by: Vlad-Andrei Badoiu <vlad_andrei.badoiu@upb.ro>
>> ---
>>   lib/Makefile.uk          |  1 +
>>   lib/uksp/Config.uk       | 46 +++++++++++++++++++++++++++++++
>>   lib/uksp/Makefile.uk     |  9 +++++++
>>   lib/uksp/exportsyms.uk   |  2 ++
>>   lib/uksp/include/uk/sp.h | 58 ++++++++++++++++++++++++++++++++++++++++
>>   lib/uksp/ssp.c           | 51 +++++++++++++++++++++++++++++++++++
>>   6 files changed, 167 insertions(+)
>>   create mode 100644 lib/uksp/Config.uk
>>   create mode 100644 lib/uksp/Makefile.uk
>>   create mode 100644 lib/uksp/exportsyms.uk
>>   create mode 100644 lib/uksp/include/uk/sp.h
>>   create mode 100644 lib/uksp/ssp.c
>>
>> diff --git a/lib/Makefile.uk b/lib/Makefile.uk
>> index 9261533c..07e8a295 100644
>> --- a/lib/Makefile.uk
>> +++ b/lib/Makefile.uk
>> @@ -36,3 +36,4 @@ $(eval $(call _import_lib,$(CONFIG_UK_BASE)/lib/uktime=
))
>>   $(eval $(call _import_lib,$(CONFIG_UK_BASE)/lib/ukmmap))
>>   $(eval $(call _import_lib,$(CONFIG_UK_BASE)/lib/ukblkdev))
>>   $(eval $(call _import_lib,$(CONFIG_UK_BASE)/lib/posix-process))
>> +$(eval $(call _import_lib,$(CONFIG_UK_BASE)/lib/uksp))
>> diff --git a/lib/uksp/Config.uk b/lib/uksp/Config.uk
>> new file mode 100644
>> index 00000000..0881ddec
>> --- /dev/null
>> +++ b/lib/uksp/Config.uk
>> @@ -0,0 +1,46 @@
>> +config LIBUKSP

Hey Alice, hey Vlad,

I changed `config` to `menuconfig` while upstreaming. This should be=20
used to create sub menus.

Thanks,

Simon

>> +       bool "uksp: Stack protector"
>> +       select HAVE_STACKPROTECTOR
>> +       default n
>> +
>> +if LIBUKSP
>> +choice >> +       prompt "Stack protector level"
>> +       default STACKPROTECTOR_REGULAR
>> +       help
>> +         Set the stack protector level
>> +
>> +config STACKPROTECTOR_REGULAR
>> +       bool "Regular"
>> +       help
>> +               Regular stack protector, use -fstack-protector.
>> +
>> +config STACKPROTECTOR_STRONG
>> +       bool "Strong"
>> +       help
>> +               Strong stack protector, use -fstack-protector-strong.
>> +
>> +config STACKPROTECTOR_ALL
>> +       bool "All"
>> +       help
>> +               Protect all functions, use -fstack-protector-all.
>> +endchoice
>> +
>> +choice
>> +       prompt "Canary Value"
>> +       default LIBUKSP_VALUE_USECONSTANT
>> +
>> +config LIBUKSP_VALUE_USECONSTANT
>> +       bool "Compiled-in constant"
>> +
>> +config LIBUKSP_VALUE_RANDOM
>> +       bool "Random variable"
>> +       select LIBUKSWRAND
>> +endchoice
>> +
>> +config LIBUKSP_VALUE_CONSTANT
>> +       int "Canary value"
>> +       depends on LIBUKSP_VALUE_USECONSTANT
>> +       default 42
>> +
>> +endif
>> diff --git a/lib/uksp/Makefile.uk b/lib/uksp/Makefile.uk
>> new file mode 100644
>> index 00000000..4e591231
>> --- /dev/null
>> +++ b/lib/uksp/Makefile.uk
>> @@ -0,0 +1,9 @@
>> +$(eval $(call addlib_s,libuksp,$(CONFIG_LIBUKSP)))
>> +
>> +CINCLUDES-y +=3D -I$(LIBUKSP_BASE)/include
>> +
>> +LIBUKSP_SRCS-y +=3D $(LIBUKSP_BASE)/ssp.c
>> +
>> +COMPFLAGS-$(CONFIG_STACKPROTECTOR_REGULAR)     +=3D -fstack-protector
>> -mstack-protector-guard=3Dglobal
>> +COMPFLAGS-$(CONFIG_STACKPROTECTOR_STRONG)      +=3D
>> -fstack-protector-strong -mstack-protector-guard=3Dglobal
>> +COMPFLAGS-$(CONFIG_STACKPROTECTOR_ALL)         +=3D -fstack-protector-a=
ll
>> -mstack-protector-guard=3Dglobal
>> diff --git a/lib/uksp/exportsyms.uk b/lib/uksp/exportsyms.uk
>> new file mode 100644
>> index 00000000..fbc319e7
>> --- /dev/null
>> +++ b/lib/uksp/exportsyms.uk
>> @@ -0,0 +1,2 @@
>> +__stack_chk_fail
>> +__stack_chk_guard
>> diff --git a/lib/uksp/include/uk/sp.h b/lib/uksp/include/uk/sp.h
>> new file mode 100644
>> index 00000000..ab8b4177
>> --- /dev/null
>> +++ b/lib/uksp/include/uk/sp.h
>> @@ -0,0 +1,58 @@
>> +/* SPDX-License-Identifier: BSD-3-Clause */
>> +/*
>> + * Authors: Vlad-Andrei Badoiu <vlad_andrei.badoiu@stud.acs.upb.ro>
>> + *
>> + * Copyright (c) 2019, University Politehnica of Bucharest. All rights
>> reserved.
>> + *
>> + * Redistribution and use in source and binary forms, with or without
>> + * modification, are permitted provided that the following conditions
>> + * are met:
>> + *
>> + * 1. Redistributions of source code must retain the above copyright
>> + *    notice, this list of conditions and the following disclaimer.
>> + * 2. Redistributions in binary form must reproduce the above copyright
>> + *    notice, this list of conditions and the following disclaimer in t=
he
>> + *    documentation and/or other materials provided with the distributi=
on.
>> + * 3. Neither the name of the copyright holder nor the names of its
>> + *    contributors may be used to endorse or promote products derived f=
rom
>> + *    this software without specific prior written permission.
>> + *
>> + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
>> "AS IS"
>> + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO=
,
>> THE
>> + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
>> PURPOSE
>> + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTO=
RS
>> BE
>> + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
>> + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
>> + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
>> BUSINESS
>> + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER=
 IN
>> + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWI=
SE)
>> + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED =
OF
>> THE
>> + * POSSIBILITY OF SUCH DAMAGE.
>> + */
>> +
>> +#ifndef __UK_STACKPROTECTOR_H__
>> +#define __UK_STACKPROTECTOR_H__
>> +
>> +#ifdef CONFIG_LIBUKSP_VALUE_RANDOM
>> +#include <uk/swrand.h>
>> +#endif
>> +#include <uk/config.h>
>> +
>> +#ifdef __cplusplus
>> +extern "C" {
>> +#endif
>> +
>> +extern const unsigned long __stack_chk_guard;
>> +
>> +#ifdef CONFIG_LIBUKSP_VALUE_RANDOM
>> +#define UKSP_INIT_CANARY() (*(DECONST(unsigned long *,
>> &__stack_chk_guard)) \
>> +               =3D uk_swrand_randr())
>> +#else
>> +#define UKSP_INIT_CANARY()
>> +#endif
>> +
>> +#ifdef __cplusplus
>> +}
>> +#endif
>> +
>> +#endif /* __UK_STACKPROTECTOR_H__ */
>> diff --git a/lib/uksp/ssp.c b/lib/uksp/ssp.c
>> new file mode 100644
>> index 00000000..8a847f5c
>> --- /dev/null
>> +++ b/lib/uksp/ssp.c
>> @@ -0,0 +1,51 @@
>> +/* SPDX-License-Identifier: BSD-3-Clause */
>> +/*
>> + * Authors: Badoiu Vlad-Andrei <vlad_andrei.badoiu@stud.acs.upb.ro>
>> + *
>> + * Copyright (c) 2019, University Politehnica of Bucharest. All rights
>> reserved.
>> + *
>> + * Redistribution and use in source and binary forms, with or without
>> + * modification, are permitted provided that the following conditions
>> + * are met:
>> + *
>> + * 1. Redistributions of source code must retain the above copyright
>> + *    notice, this list of conditions and the following disclaimer.
>> + * 2. Redistributions in binary form must reproduce the above copyright
>> + *    notice, this list of conditions and the following disclaimer in t=
he
>> + *    documentation and/or other materials provided with the distributi=
on.
>> + * 3. Neither the name of the copyright holder nor the names of its
>> + *    contributors may be used to endorse or promote products derived f=
rom
>> + *    this software without specific prior written permission.
>> + *
>> + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
>> "AS IS"
>> + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO=
,
>> THE
>> + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
>> PURPOSE
>> + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTO=
RS
>> BE
>> + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
>> + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
>> + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
>> BUSINESS
>> + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER=
 IN
>> + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWI=
SE)
>> + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED =
OF
>> THE
>> + * POSSIBILITY OF SUCH DAMAGE.
>> + */
>> +
>> +#include <uk/assert.h>
>> +#include <uk/config.h>
>> +#include <uk/ctors.h>
>> +#include <uk/thread.h>
>> +
>> +#ifdef CONFIG_LIBUKSP_VALUE_USECONSTANT
>> +const unsigned long __stack_chk_guard =3D CONFIG_LIBUKSP_VALUE_CONSTANT=
;
>> +#else
>> +const unsigned long __stack_chk_guard =3D 0xDEADBEEF;
>> +#endif
>> +
>> +__attribute__((noreturn))
>> +void __stack_chk_fail(void)
>> +{
>> +       unsigned long sp;
>> +
>> +       sp =3D ukarch_read_sp() & STACK_MASK_TOP;
>> +       UK_CRASH("Stack smashing detected. SP %p\n", (void *) sp);
>> +}
>> --
>> 2.25.1
>>
>>
>


From minios-devel-bounces@lists.xenproject.org Sun Aug 09 21:14:57 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Sun, 09 Aug 2020 21:14:57 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1k4seb-0000AU-NB; Sun, 09 Aug 2020 21:14:53 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=zzd8=BT=gmail.com=dincadaniel97@srs-us1.protection.inumbo.net>)
 id 1k4sea-0000AP-H1
 for minios-devel@lists.xen.org; Sun, 09 Aug 2020 21:14:52 +0000
X-Inumbo-ID: 08033579-34a0-4f55-9b05-9f573fab622f
Received: from mail-ed1-x544.google.com (unknown [2a00:1450:4864:20::544])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 08033579-34a0-4f55-9b05-9f573fab622f;
 Sun, 09 Aug 2020 21:14:51 +0000 (UTC)
Received: by mail-ed1-x544.google.com with SMTP id c10so4985955edk.6
 for <minios-devel@lists.xen.org>; Sun, 09 Aug 2020 14:14:50 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=from:to:cc:subject:date:message-id;
 bh=S/8l6wSfYW2KWZ+VeauFsxFMx3YFxGgH4rcTbSquTuc=;
 b=p01ScgHOybFtOwQ1HGLElUER7gbPfjBDpeq0j0LmMHKJrkdzIoTajBXzA/ZKR7hmR8
 6sQhPbHuvCu4HlVWRRWfV+F5iNsaY5YqYLNyDhP0XTzZUZOtjKJBzm6XYS4UM+1/D6qt
 b9r4JWH8DgTcV5SUe+l+ScCD/tQp6+YuomEqUDoyiI5hrGTlhZkm9gSzYCCAMEhSuTXS
 l4LvXhT7LgQ5l96L2s7PXGZyLm2f9OxIjBP3Es0GQJM+cpt4BzSD/pw9W29V5wRzo6EQ
 FLRXr6JFNGbhuTDguXeQz3v5XiDyimBL9qQ+OYvEA0F+iF3DHWlqsOKz1CHs4hA9M4dT
 TahA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:to:cc:subject:date:message-id;
 bh=S/8l6wSfYW2KWZ+VeauFsxFMx3YFxGgH4rcTbSquTuc=;
 b=Kk7O29Ge611ux+AA0aMhGb2I25iTfmSWl0VsFKlcZkGLvoQN7ZAg0KLKFYPoIGMXPb
 qZ+qLwONHiOCiaYxIOf36KwpygE0HWi6gToWVlumxDUJuVvHYsfhneX2kYXT1tcjM/q6
 aUIV3vcYY1LiZV+9xEg9sO0S46JzueBUz7aBlrZE4ta4uFKvVaxKmxz9b1DVjsd3xusS
 aetaR+/2mMbDVn38vN2OUMR0tn/vQDCAeCwNNQ0go+nvK1J2SdqpYcN8byUDtT5lyuRW
 CX1tyW1gDFWmCvyO2ZHSFk3p8MtIrCZkP4ax0Y/r6CYqhstF/p6wMhGKu4ehBlStseWi
 e84g==
X-Gm-Message-State: AOAM533xASp7V0TWCfF8WaD/SyUiQHNkHzjJRdarGUmqb7Zq2L3YrLMi
 BMfUNrZJupVfkmR3eZ8IbGcCn6+ANfA=
X-Google-Smtp-Source: ABdhPJyTIo0/W28LCdQsvBCPlfc9R+ZFKJJBhen4HECElaBnQx/thWlv0ItlKGfeSummKu09S0+0Qg==
X-Received: by 2002:a05:6402:b45:: with SMTP id
 bx5mr18699056edb.22.1597007689679; 
 Sun, 09 Aug 2020 14:14:49 -0700 (PDT)
Received: from localhost.localdomain ([86.124.237.96])
 by smtp.gmail.com with ESMTPSA id u6sm10581083ejf.98.2020.08.09.14.14.48
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Sun, 09 Aug 2020 14:14:49 -0700 (PDT)
From: Daniel Dinca <dincadaniel97@gmail.com>
To: minios-devel@lists.xen.org
Subject: [UNIKRAFT PATCH] build: Add the option to compile the unikernel as PIE
Date: Mon, 10 Aug 2020 00:14:33 +0300
Message-Id: <20200809211433.3489-1-dincadaniel97@gmail.com>
X-Mailer: git-send-email 2.17.1
X-BeenThere: minios-devel@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Mini-os development list <minios-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:minios-devel@lists.xenproject.org>
List-Help: <mailto:minios-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=subscribe>
Cc: DanielD1234 <danieldinca97@yahoo.com>, simon.kuenzer@neclab.eu
Errors-To: minios-devel-bounces@lists.xenproject.org
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>

From: DanielD1234 <danieldinca97@yahoo.com>

This patch adds the option to compile the unikernel as
a position-independent executable so we can have ASLR.
If the unikernel is compiled as PIE, it cannot run on it's
own. A bootloader will be needed that will come in future patches.

Signed-off-by: DanielD1234 <danieldinca97@yahoo.com>
---
 Config.uk                      |  9 +++++++++
 Makefile.uk                    | 14 +++++++++++---
 plat/common/x86/thread_start.S |  7 ++++---
 plat/kvm/x86/entry64.S         |  3 +++
 plat/kvm/x86/setup.c           |  8 ++++++++
 5 files changed, 35 insertions(+), 6 deletions(-)

diff --git a/Config.uk b/Config.uk
index 1d4143e..b18caf9 100644
--- a/Config.uk
+++ b/Config.uk
@@ -86,6 +86,15 @@ config OPTIMIZE_LTO
 		will increase overall building time but creates more efficient
 		Unikraft binaries.
 
+config ENABLE_PIE
+	bool "PIE - Postition-Independent Executable"
+	default n
+	help
+		Enables the unikernel to be compiled as a position-independent executable.
+		Note that certain parts of the entry64.S file will be eliminated, and the unikernel
+		will need to be loaded into memory from initrd by the bootloader (which will be compiled
+		separately).
+
 choice
 	prompt "Debug information level"
 	default DEBUG_SYMBOLS_LVL3
diff --git a/Makefile.uk b/Makefile.uk
index 4f1c764..76b6fc3 100644
--- a/Makefile.uk
+++ b/Makefile.uk
@@ -22,8 +22,8 @@ GOCINCLUDES  += -I$(CONFIG_UK_BASE)/include
 # Set the text and data sections to be readable and writable. Also,
 # do not page-align the data segment. If the output format supports
 # Unix style magic numbers, mark the output as OMAGIC.
-LIBLDFLAGS  += -nostdinc -nostdlib -Wl,--omagic -Wl,-r -Wl,-d -Wl,--build-id=none
-LDFLAGS     += -nostdinc -nostdlib -Wl,--omagic -Wl,--build-id=none
+LIBLDFLAGS  += -nostdinc -nostdlib -Wl,-r -Wl,-d -Wl,--build-id=none -no-pie
+LDFLAGS     += -nostdinc -nostdlib -Wl,--build-id=none
 
 COMPFLAGS-$(CONFIG_OPTIMIZE_NONE)         += -O0 -fno-optimize-sibling-calls -fno-tree-vectorize
 COMPFLAGS-$(CONFIG_OPTIMIZE_SIZE)         += -Os
@@ -50,9 +50,17 @@ ISR_ARCHFLAGS += -D__INTERRUPTSAFE__
 M4FLAGS      += -D __Unikraft__ -DUK_CODENAME="$(UK_CODENAME)"
 M4FLAGS      += -DUK_VERSION=$(UK_VERSION).$(UK_SUBVERSION)
 
+ifeq ($(CONFIG_ENABLE_PIE),y)
+COMPFLAGS-$(call gcc_version_ge,6,1)	+= -fPIC
+LDFLAGS-$(call gcc_version_ge,6,1)	+= -static-pie
+else
 # If GCC supports "-no-pie" flag, we will add this flag to link flags to
 # override "pie" option, because some distributions will set
 # "--enable-default-pie" by default.
 COMPFLAGS-$(call gcc_version_ge,6,1)	+= -no-pie
-LIBLDFLAGS-$(call gcc_version_ge,6,1)	+= -no-pie
 LDFLAGS-$(call gcc_version_ge,6,1)	+= -no-pie
+# --omagic option is incompatible with the -pie option, so add them when -pie
+# is not enabled
+LIBLDFLAGS  += -Wl,--omagic
+LDFLAGS     += -Wl,--omagic
+endif
diff --git a/plat/common/x86/thread_start.S b/plat/common/x86/thread_start.S
index b23666a..360ca91 100644
--- a/plat/common/x86/thread_start.S
+++ b/plat/common/x86/thread_start.S
@@ -36,7 +36,7 @@ ENTRY(asm_thread_starter)
 	pushq $0
 	xorq %rbp,%rbp
 	call *%rbx
-	call uk_sched_thread_exit
+	call *uk_sched_thread_exit@GOTPCREL(%rip)
 
 ENTRY(asm_ctx_start)
 	mov %rdi, %rsp      /* set SP */
@@ -52,10 +52,11 @@ ENTRY(asm_sw_ctx_switch)
 	pushq %r15
 	movq %rsp, OFFSETOF_SW_CTX_SP(%rdi)       /* save ESP */
 	movq OFFSETOF_SW_CTX_SP(%rsi), %rsp       /* restore ESP */
-	movq $1f, OFFSETOF_SW_CTX_IP(%rdi)        /* save EIP */
+	lea .Lreturn(%rip), %rbx
+	movq %rbx, OFFSETOF_SW_CTX_IP(%rdi)       /* save EIP */
 	pushq OFFSETOF_SW_CTX_IP(%rsi)            /* restore EIP */
 	ret
-1:
+.Lreturn:
 	popq %r15
 	popq %r14
 	popq %r13
diff --git a/plat/kvm/x86/entry64.S b/plat/kvm/x86/entry64.S
index 274ab0b..70b23e5 100644
--- a/plat/kvm/x86/entry64.S
+++ b/plat/kvm/x86/entry64.S
@@ -30,6 +30,7 @@
 #include <x86/cpu_defs.h>
 #include <kvm-x86/traps.h>
 #include <kvm-x86/multiboot_defs.h>
+#include <uk/config.h>
 
 #define ENTRY(x) .globl x; .type x,%function; x:
 #define END(x)   .size x, . - x
@@ -37,6 +38,7 @@
 #define MYMULTIBOOT_FLAGS \
     (MULTIBOOT_PAGE_ALIGN | MULTIBOOT_MEMORY_INFO | MULTIBOOT_AOUT_KLUDGE)
 
+#ifndef CONFIG_ENABLE_PIE
 .section .data.boot
 
 .align 4
@@ -236,6 +238,7 @@ nofsgsbase:
 	cli
 	hlt
 END(_libkvmplat_start64)
+#endif
 
 .text
 ENTRY(_libkvmplat_newstack)
diff --git a/plat/kvm/x86/setup.c b/plat/kvm/x86/setup.c
index 9c7a93a..c8ee841 100644
--- a/plat/kvm/x86/setup.c
+++ b/plat/kvm/x86/setup.c
@@ -40,6 +40,7 @@
 #include <uk/plat/console.h>
 #include <uk/assert.h>
 #include <uk/essentials.h>
+#include <uk/config.h>
 
 #define PLATFORM_MEM_START 0x100000
 #define PLATFORM_MAX_MEM_ADDR 0x40000000
@@ -274,7 +275,14 @@ void _libkvmplat_entry(void *arg)
 	 */
 	_mb_get_cmdline(mi);
 	_mb_init_mem(mi);
+	/*
+	 * If the unikernel is compiled as PIE and we want to run it with ASLR, the
+	 * unikernel code will first be placed in the initrd section and then will be
+	 * relocated by the bootloader. After the relocation we will not have an initrd.
+	 */
+	#ifndef CONFIG_ENABLE_PIE
 	_mb_init_initrd(mi);
+	#endif
 
 	if (_libkvmplat_cfg.initrd.len)
 		uk_pr_info("        initrd: %p\n",
-- 
2.17.1



From minios-devel-bounces@lists.xenproject.org Mon Aug 10 15:21:08 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Mon, 10 Aug 2020 15:21:08 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1k59bl-00045C-Sj; Mon, 10 Aug 2020 15:21:05 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=gd2F=BU=uliege.be=gaulthier.gain@srs-us1.protection.inumbo.net>)
 id 1k59bk-000457-9y
 for minios-devel@lists.xenproject.org; Mon, 10 Aug 2020 15:21:04 +0000
X-Inumbo-ID: 1b2a40c9-560f-4d36-9fcd-7928ea5b618b
Received: from serv108.segi.ulg.ac.be (unknown [139.165.32.111])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 1b2a40c9-560f-4d36-9fcd-7928ea5b618b;
 Mon, 10 Aug 2020 15:21:00 +0000 (UTC)
Received: from sauron.run.montefiore.ulg.ac.be
 (sauron.run.montefiore.ulg.ac.be [139.165.223.31])
 (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
 (No client certificate requested)
 by serv108.segi.ulg.ac.be (Postfix) with ESMTPSA id 48CFE201035D;
 Mon, 10 Aug 2020 17:20:59 +0200 (CEST)
DKIM-Filter: OpenDKIM Filter v2.11.0 serv108.segi.ulg.ac.be 48CFE201035D
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=uliege.be;
 s=ulg20190529; t=1597072859;
 bh=iQoR48AVcYAcJvfOxDBDhjqI+zzhR9NIlatLUvgV/6U=;
 h=From:To:Cc:Subject:Date:From;
 b=p46g/cDtBJ7U8Ykczjl+deDFGg1YPbNlp+YMFuDxLbkQ//mRarG4PhkwJYrW0Nxhj
 rFT1KPnoHCabuR10q63Oc3UmOAWNqF8hiU8UI4YD7+1ekw3wFfTR8kqLtmCs0+wRkg
 +yaA1Cl6HxkvNeib49l7AB8DwEesErOE5wujalyu7uOjRLIZ5R9QM3TdL6UZMM3Oxs
 fnSC6IXv4rChlcU+Su+YQYnJRqOy7MOTT46GDsK3RU2vJXqkx/BMr/Dk3vKTj3+N0C
 Og5HmLRsdthFldhpcgFjWBznLewJXqVhbUF/bZlRca2tHq1v4vyAcqLk0apM0IBwXe
 MXfhfF/+fXRkA==
From: gaulthier.gain@uliege.be
To: minios-devel@lists.xenproject.org
Subject: [UNIKRAFT/NEWLIB PATCH] Add patch to support Libevent
Date: Mon, 10 Aug 2020 15:20:52 +0000
Message-Id: <20200810152052.45802-1-gaulthier.gain@uliege.be>
X-Mailer: git-send-email 2.17.1
X-BeenThere: minios-devel@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Mini-os development list <minios-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:minios-devel@lists.xenproject.org>
List-Help: <mailto:minios-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=subscribe>
Cc: gaulthier gain <gaulthier.gain@uliege.be>
Errors-To: minios-devel-bounces@lists.xenproject.org
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>

From: gaulthier gain <gaulthier.gain@uliege.be>

This patch allows to add the `LIST_END` macro in newlib which is
required by libevent. Libevent patches will be sent in a separated
patch series.

Signed-off-by: gaulthier gain <gaulthier.gain@uliege.be>
---
 .../0010-Add-LIST-END-macro-in-queue.patch    | 29 +++++++++++++++++++
 1 file changed, 29 insertions(+)
 create mode 100644 patches/0010-Add-LIST-END-macro-in-queue.patch

diff --git a/patches/0010-Add-LIST-END-macro-in-queue.patch b/patches/0010-Add-LIST-END-macro-in-queue.patch
new file mode 100644
index 0000000..5691079
--- /dev/null
+++ b/patches/0010-Add-LIST-END-macro-in-queue.patch
@@ -0,0 +1,29 @@
+From 0209323f663c827513033419b49bfb5a8c0c5b2a Mon Sep 17 00:00:00 2001
+From: gaulthier gain <gaulthier.gain@uliege.be>
+Date: Mon, 10 Aug 2020 09:32:55 +0000
+Subject: [PATCH] Add LIST_END macro in queue.h
+
+This patch adds the LIST_END macro in `sys/queue.h` which is required
+by liblibevent.
+
+Signed-off-by: gaulthier gain <gaulthier.gain@uliege.be>
+---
+ newlib/libc/include/sys/queue.h | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/newlib/libc/include/sys/queue.h b/newlib/libc/include/sys/queue.h
+index 491bdde..f1959f5 100644
+--- a/newlib/libc/include/sys/queue.h
++++ b/newlib/libc/include/sys/queue.h
+@@ -539,6 +539,8 @@ struct {								\
+ 
+ #define	LIST_FIRST(head)	((head)->lh_first)
+ 
++#define	LIST_END(head)          NULL
++
+ #define	LIST_FOREACH(var, head, field)					\
+ 	for ((var) = LIST_FIRST((head));				\
+ 	    (var);							\
+-- 
+2.17.1
+
-- 
2.17.1



From minios-devel-bounces@lists.xenproject.org Mon Aug 10 15:24:37 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Mon, 10 Aug 2020 15:24:37 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1k59fB-0004Af-Cv; Mon, 10 Aug 2020 15:24:37 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=gd2F=BU=uliege.be=gaulthier.gain@srs-us1.protection.inumbo.net>)
 id 1k59fA-0004AX-Jb
 for minios-devel@lists.xenproject.org; Mon, 10 Aug 2020 15:24:36 +0000
X-Inumbo-ID: 76be8fa4-3a51-4d4b-8a88-8fa549d2d211
Received: from serv108.segi.ulg.ac.be (unknown [139.165.32.111])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 76be8fa4-3a51-4d4b-8a88-8fa549d2d211;
 Mon, 10 Aug 2020 15:24:35 +0000 (UTC)
Received: from sauron.run.montefiore.ulg.ac.be
 (sauron.run.montefiore.ulg.ac.be [139.165.223.31])
 (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
 (No client certificate requested)
 by serv108.segi.ulg.ac.be (Postfix) with ESMTPSA id CB91B200DFA6;
 Mon, 10 Aug 2020 17:24:34 +0200 (CEST)
DKIM-Filter: OpenDKIM Filter v2.11.0 serv108.segi.ulg.ac.be CB91B200DFA6
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=uliege.be;
 s=ulg20190529; t=1597073074;
 bh=JzvaU+OVcOhfoZWS4/c3JddEVqiHt7jmLO2VoYYp13M=;
 h=From:To:Cc:Subject:Date:From;
 b=s4JgNPj2aaFA0NMUloFX/odkIKdQ+IwvnWurRrPrqOA6KBDxWVyX69yFoHfjqDJFA
 sU6YR3LNvZPKcuk6GMuJKp8ciBAzTSP+v7Gy9egl3Hgj3/oVkMVPzMX8fOYkTyX15F
 9SUU6ChHT9bFEqnDrhNwFG9I566YWDq7d8TxtDY+J/w++dgs+J087AwCmP7pmwFyky
 TGCD+dEL3XrPXYmbjT2RPupkppFYs1GFg30f01HVJ6s7VN8TjnkY6KaYJpPCKOaKkd
 3E1eIYvPkNkmd4Oih4x4oGsrF/O+BLjvLlAPGA1EXzBHZkvKfB95WlTO/fafKfW2Nm
 PiVOV/smJIh+g==
From: gaulthier.gain@uliege.be
To: minios-devel@lists.xenproject.org
Subject: [UNIKRAFT/LIBLIBEVENT PATCH 0/6] Libevent port on Unikraft
Date: Mon, 10 Aug 2020 15:24:19 +0000
Message-Id: <20200810152425.46150-1-gaulthier.gain@uliege.be>
X-Mailer: git-send-email 2.17.1
X-BeenThere: minios-devel@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Mini-os development list <minios-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:minios-devel@lists.xenproject.org>
List-Help: <mailto:minios-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=subscribe>
Cc: felipe.huici@neclab.eu, gaulthier gain <gaulthier.gain@uliege.be>
Errors-To: minios-devel-bounces@lists.xenproject.org
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>

From: gaulthier gain <gaulthier.gain@uliege.be>

This patch series is the initial port of Libevent on unikraft. This
library is required by other applications (e.g., memcached). The port
of memcached will come in future patches.

Note: The patch `Add-LIST-END-macro-in-queue.patch` from newlib
(https://patchwork.unikraft.org/patch/737951/) must be applied
before using this library.

gaulthier gain (6):
  Introduce library skeleton
  Add Makefile.uk
  Add Libevent auto-generated headers
  Disable features that are not available on Unikraft
  Add patches folder
  README.md: Update with info about building and running

-- 
2.17.1



From minios-devel-bounces@lists.xenproject.org Mon Aug 10 15:24:42 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Mon, 10 Aug 2020 15:24:42 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1k59fG-0004BW-EX; Mon, 10 Aug 2020 15:24:42 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=gd2F=BU=uliege.be=gaulthier.gain@srs-us1.protection.inumbo.net>)
 id 1k59fF-0004AX-Iw
 for minios-devel@lists.xenproject.org; Mon, 10 Aug 2020 15:24:41 +0000
X-Inumbo-ID: 6615a93b-549e-4706-adb3-0bdd76c0429e
Received: from serv108.segi.ulg.ac.be (unknown [139.165.32.111])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 6615a93b-549e-4706-adb3-0bdd76c0429e;
 Mon, 10 Aug 2020 15:24:38 +0000 (UTC)
Received: from sauron.run.montefiore.ulg.ac.be
 (sauron.run.montefiore.ulg.ac.be [139.165.223.31])
 (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
 (No client certificate requested)
 by serv108.segi.ulg.ac.be (Postfix) with ESMTPSA id 2AC63200DFA7;
 Mon, 10 Aug 2020 17:24:38 +0200 (CEST)
DKIM-Filter: OpenDKIM Filter v2.11.0 serv108.segi.ulg.ac.be 2AC63200DFA7
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=uliege.be;
 s=ulg20190529; t=1597073078;
 bh=10S9U5FzJ4GZk9FWgPYgNmXBg3rgYSpRSj9nO9MRYLU=;
 h=From:To:Cc:Subject:Date:In-Reply-To:References:From;
 b=cu4iGpv4KoQRc9t/31aO+aM+eRbizfaGEkLZvDlh0H9HCa5BxJXRarWVjw9pywNex
 6kamUuOyc/JNisERIZKOz2tGLau0zNWBangf19r+DVpiBLQu4+LG1wNAL81DFdNbxf
 UcaBb6Kd5Abt8QXlYNN6TRXPImC7lrGQD/g+jX5GeE1hso7FBUfFXTZiqHkGJRxFjf
 zmYg6wAlKtiLkCZE+9tBcyGmXOigIjIX3Vfe5GJNgZr+Q93WDd0Kx/ozibvV2RUWKT
 NUjubctNdBKKbNn5g7f51WZKBVZAQ/iNZIzDWvFUjHL8NWZtp5KTvP6E3jx21fsFqG
 US1GY18evhMoA==
From: gaulthier.gain@uliege.be
To: minios-devel@lists.xenproject.org
Subject: [UNIKRAFT/LIBLIBEVENT PATCH 1/6] Introduce library skeleton
Date: Mon, 10 Aug 2020 15:24:20 +0000
Message-Id: <20200810152425.46150-2-gaulthier.gain@uliege.be>
X-Mailer: git-send-email 2.17.1
In-Reply-To: <20200810152425.46150-1-gaulthier.gain@uliege.be>
References: <20200810152425.46150-1-gaulthier.gain@uliege.be>
X-BeenThere: minios-devel@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Mini-os development list <minios-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:minios-devel@lists.xenproject.org>
List-Help: <mailto:minios-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=subscribe>
Cc: felipe.huici@neclab.eu, gaulthier gain <gaulthier.gain@uliege.be>
Errors-To: minios-devel-bounces@lists.xenproject.org
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>

From: gaulthier gain <gaulthier.gain@uliege.be>

We use the BSD-3-Clause license for this library glue code.

Signed-off-by: gaulthier gain <gaulthier.gain@uliege.be>
---
 .gitignore      | 27 +++++++++++++++++++++++++++
 CODING_STYLE.md |  4 ++++
 CONTRIBUTING.md |  4 ++++
 COPYING.md      | 38 ++++++++++++++++++++++++++++++++++++++
 Config.uk       | 13 +++++++++++++
 MAINTAINERS.md  | 11 +++++++++++
 README.md       |  7 +++++++
 7 files changed, 104 insertions(+)
 create mode 100644 .gitignore
 create mode 100644 CODING_STYLE.md
 create mode 100644 CONTRIBUTING.md
 create mode 100644 COPYING.md
 create mode 100644 Config.uk
 create mode 100644 MAINTAINERS.md
 create mode 100644 README.md

diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..75d2fd3
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,27 @@
+*.depend
+*.o
+*.a
+*.d
+*.so
+*.orig
+*.rej
+*.bak
+*.swp
+*~
+,*
+\#*\#
+.\#*
+\#_*\#
+.\#_*
+!.gitignore
+.*
+
+# gnu global files
+GPATH
+GRTAGS
+GSYMS
+GTAGS
+
+# cscope files
+cscope.*
+ncscope.*
diff --git a/CODING_STYLE.md b/CODING_STYLE.md
new file mode 100644
index 0000000..5730041
--- /dev/null
+++ b/CODING_STYLE.md
@@ -0,0 +1,4 @@
+Coding Style
+============
+
+Please refer to the `CODING_STYLE.md` file in the main Unikraft repository.
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
new file mode 100644
index 0000000..14f6ac6
--- /dev/null
+++ b/CONTRIBUTING.md
@@ -0,0 +1,4 @@
+Contributing to Unikraft
+========================
+
+Please refer to the `CONTRIBUTING.md` file in the main Unikraft repository.
diff --git a/COPYING.md b/COPYING.md
new file mode 100644
index 0000000..9f22ae1
--- /dev/null
+++ b/COPYING.md
@@ -0,0 +1,38 @@
+License
+=======
+
+Unikraft Libevent wrappers
+----------------------------------
+
+This repository contains wrapper code to build Libevent with Unikraft.
+Each C code file in this repository should declare who is the
+copyright owner and under which terms and conditions the code is
+licensed. If such a licence note is missing, the following copyright
+notice will apply:
+
+	Copyright (c) Year, Institution. All rights reserved.
+
+	Redistribution and use in source and binary forms, with or without
+	modification, are permitted provided that the following conditions
+	are met:
+
+	1. Redistributions of source code must retain the above copyright
+	   notice, this list of conditions and the following disclaimer.
+	2. Redistributions in binary form must reproduce the above copyright
+	   notice, this list of conditions and the following disclaimer in the
+	   documentation and/or other materials provided with the distribution.
+	3. Neither the name of the copyright holder nor the names of its
+	   contributors may be used to endorse or promote products derived from
+	   this software without specific prior written permission.
+
+	THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+	AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+	IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+	ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+	LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+	CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+	SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+	INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+	CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+	ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+	POSSIBILITY OF SUCH DAMAGE.
diff --git a/Config.uk b/Config.uk
new file mode 100644
index 0000000..0b0559f
--- /dev/null
+++ b/Config.uk
@@ -0,0 +1,13 @@
+config LIBLIBEVENT
+	   bool "libevent - an event notification library"
+	   default y
+	   select LIBUKMMAP
+	   select LIBPOSIX_SYSINFO
+	   select LIBNEWLIBC
+	   select LIBLWIP
+	   select LWIP_TCP
+           select LWIP_IPV4
+           select LWIP_IPV6
+	   select LWIP_SOCKET
+           select LWIP_DNS
+           select LIBPTHREAD_EMBEDDED
diff --git a/MAINTAINERS.md b/MAINTAINERS.md
new file mode 100644
index 0000000..5280e80
--- /dev/null
+++ b/MAINTAINERS.md
@@ -0,0 +1,11 @@
+Maintainers List
+================
+
+For notes on how to read this information, please refer to `MAINTAINERS.md` in
+the main Unikraft repository.
+
+	LIBLIBEVENT-UNIKRAFT
+	M:  Gaulthier Gain <gaulthier.gain@uliege.be>
+	M:  Felipe Huici <felipe.huici@neclab.eu>
+	L:  minios-devel@lists.xen.org
+	F: *
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..438d109
--- /dev/null
+++ b/README.md
@@ -0,0 +1,7 @@
+Libevent for Unikraft
+=============================
+
+This is the port of Libevent for Unikraft as external library.
+
+Please refer to the `README.md` as well as the documentation in the
+`doc/` subdirectory of the main unikraft repository.
-- 
2.17.1



From minios-devel-bounces@lists.xenproject.org Mon Aug 10 15:24:43 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Mon, 10 Aug 2020 15:24:43 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1k59fH-0004Bw-G4; Mon, 10 Aug 2020 15:24:43 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=gd2F=BU=uliege.be=gaulthier.gain@srs-us1.protection.inumbo.net>)
 id 1k59fG-0004BP-1P
 for minios-devel@lists.xenproject.org; Mon, 10 Aug 2020 15:24:42 +0000
X-Inumbo-ID: b55ab8b9-fd46-48e3-990f-34d733994c94
Received: from serv108.segi.ulg.ac.be (unknown [139.165.32.111])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id b55ab8b9-fd46-48e3-990f-34d733994c94;
 Mon, 10 Aug 2020 15:24:40 +0000 (UTC)
Received: from sauron.run.montefiore.ulg.ac.be
 (sauron.run.montefiore.ulg.ac.be [139.165.223.31])
 (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
 (No client certificate requested)
 by serv108.segi.ulg.ac.be (Postfix) with ESMTPSA id 6B2D5200E2DC;
 Mon, 10 Aug 2020 17:24:39 +0200 (CEST)
DKIM-Filter: OpenDKIM Filter v2.11.0 serv108.segi.ulg.ac.be 6B2D5200E2DC
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=uliege.be;
 s=ulg20190529; t=1597073079;
 bh=abyL/GWhL1SoxXefpPEClUMe6cFST+izY5Kzz9iCVgo=;
 h=From:To:Cc:Subject:Date:In-Reply-To:References:From;
 b=rAoRaOjcZvUfGihNP4OPG0HqLGaYhFQoRJLGxDCEftB911yu2SIqm4geQe34vYm0A
 mrks3s06QUZwrmivtzjeZbs8j8shrT3AA65L3Y0nJgaL2SlM9hv3tu9ZyRWgDXjm4l
 Rv2gyqma+xPaqmSDjIP8VGMxoZBT8bWmJG5AdUo7BAx+sxnHY2glVP15c4yccw4Xjp
 r3uyv/swC7KDzb6XKiVQ9LHRvZLg1k1HrhgoQZ5ZzKXxTgB1UdyL1bB98yTsFgBWqa
 stXDwdR9GfFzyE7PmoQDgzLnL9BB+KHWiz1xzi7prdxzR7xKskkKHUj+smN/9PnYMq
 qge9VeRySOkhQ==
From: gaulthier.gain@uliege.be
To: minios-devel@lists.xenproject.org
Subject: [UNIKRAFT/LIBLIBEVENT PATCH 2/6] Add Makefile.uk
Date: Mon, 10 Aug 2020 15:24:21 +0000
Message-Id: <20200810152425.46150-3-gaulthier.gain@uliege.be>
X-Mailer: git-send-email 2.17.1
In-Reply-To: <20200810152425.46150-1-gaulthier.gain@uliege.be>
References: <20200810152425.46150-1-gaulthier.gain@uliege.be>
X-BeenThere: minios-devel@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Mini-os development list <minios-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:minios-devel@lists.xenproject.org>
List-Help: <mailto:minios-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=subscribe>
Cc: felipe.huici@neclab.eu, gaulthier gain <gaulthier.gain@uliege.be>
Errors-To: minios-devel-bounces@lists.xenproject.org
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>

From: gaulthier gain <gaulthier.gain@uliege.be>

Add Libevent port Makefile.uk.

Signed-off-by: gaulthier gain <gaulthier.gain@uliege.be>
---
 Makefile.uk | 98 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 98 insertions(+)
 create mode 100644 Makefile.uk

diff --git a/Makefile.uk b/Makefile.uk
new file mode 100644
index 0000000..f1e2e8a
--- /dev/null
+++ b/Makefile.uk
@@ -0,0 +1,98 @@
+#  SPDX-License-Identifier: BSD-3-Clause
+#
+#  Liblibevent Makefile.uk
+#
+#  Authors: Felipe Huici <felipe.huici@neclab.eu>
+#	    Gaulthier Gain <gaulthier.gain@uliege.be>
+#
+#  Copyright (c) 2017, NEC Europe Ltd., NEC Corporation. All rights reserved.
+#
+#  Redistribution and use in source and binary forms, with or without
+#  modification, are permitted provided that the following conditions
+#  are met:
+#
+#  1. Redistributions of source code must retain the above copyright
+#     notice, this list of conditions and the following disclaimer.
+#  2. Redistributions in binary form must reproduce the above copyright
+#     notice, this list of conditions and the following disclaimer in the
+#     documentation and/or other materials provided with the distribution.
+#  3. Neither the name of the copyright holder nor the names of its
+#     contributors may be used to endorse or promote products derived from
+#     this software without specific prior written permission.
+#
+#  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+#  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+#  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+#  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+#  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+#  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+#  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+#  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+#  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+#  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+#  POSSIBILITY OF SUCH DAMAGE.
+#
+#  THIS HEADER MAY NOT BE EXTRACTED OR MODIFIED IN ANY WAY.
+#
+
+################################################################################
+# Library registration
+################################################################################
+$(eval $(call addlib_s,liblibevent,$(CONFIG_LIBLIBEVENT)))
+
+################################################################################
+# Sources
+################################################################################
+LIBLIBEVENT_VERSION=2.1.12-stable
+LIBLIBEVENT_URL=https://github.com/libevent/libevent/releases/download/release-2.1.12-stable/libevent-$(LIBLIBEVENT_VERSION).tar.gz
+LIBLIBEVENT_DIR=libevent-$(LIBLIBEVENT_VERSION)
+
+LIBLIBEVENT_PATCHDIR=$(LIBLIBEVENT_BASE)/patches
+$(eval $(call fetch,liblibevent,$(LIBLIBEVENT_URL),$(LIBLIBEVENT_VERSION).zip))
+$(eval $(call patch,liblibevent,$(LIBLIBEVENT_PATCHDIR),$(LIBLIBEVENT_DIR)))
+
+################################################################################
+# Helpers
+################################################################################
+LIBLIBEVENT=$(LIBLIBEVENT_ORIGIN)/$(LIBLIBEVENT_DIR)
+
+################################################################################
+# Library includes
+################################################################################
+LIBLIBEVENT_CINCLUDES-$(CONFIG_LIBLIBEVENT) += -I$(LIBLIBEVENT_BASE)/include   \
+                                               -I$(LIBLIBEVENT)                \
+                                               -I$(LIBLIBEVENT)/compat         \
+                                               -I$(LIBLIBEVENT)/include        \
+
+################################################################################
+# Global flags
+################################################################################
+LIBLIBEVENT_CFLAGS-y += -DHAVE_CONFIG_H
+
+################################################################################
+# Sources
+################################################################################
+LIBLIBEVENT_SRCS-y += $(LIBLIBEVENT)/buffer.c
+LIBLIBEVENT_SRCS-y += $(LIBLIBEVENT)/bufferevent.c
+LIBLIBEVENT_SRCS-y += $(LIBLIBEVENT)/bufferevent_filter.c
+LIBLIBEVENT_SRCS-y += $(LIBLIBEVENT)/bufferevent_pair.c
+LIBLIBEVENT_SRCS-y += $(LIBLIBEVENT)/bufferevent_ratelim.c
+LIBLIBEVENT_SRCS-y += $(LIBLIBEVENT)/bufferevent_sock.c
+LIBLIBEVENT_SRCS-y += $(LIBLIBEVENT)/epoll.c
+LIBLIBEVENT_SRCS-y += $(LIBLIBEVENT)/evdns.c
+LIBLIBEVENT_SRCS-y += $(LIBLIBEVENT)/event.c
+LIBLIBEVENT_SRCS-y += $(LIBLIBEVENT)/event_tagging.c
+LIBLIBEVENT_SRCS-y += $(LIBLIBEVENT)/evmap.c
+LIBLIBEVENT_SRCS-y += $(LIBLIBEVENT)/evrpc.c
+LIBLIBEVENT_SRCS-y += $(LIBLIBEVENT)/evthread.c
+LIBLIBEVENT_SRCS-y += $(LIBLIBEVENT)/evthread_pthread.c
+LIBLIBEVENT_SRCS-y += $(LIBLIBEVENT)/evutil.c
+LIBLIBEVENT_SRCS-y += $(LIBLIBEVENT)/evutil_rand.c
+LIBLIBEVENT_SRCS-y += $(LIBLIBEVENT)/evutil_time.c
+LIBLIBEVENT_SRCS-y += $(LIBLIBEVENT)/http.c
+LIBLIBEVENT_SRCS-y += $(LIBLIBEVENT)/listener.c
+LIBLIBEVENT_SRCS-y += $(LIBLIBEVENT)/log.c
+LIBLIBEVENT_SRCS-y += $(LIBLIBEVENT)/poll.c
+LIBLIBEVENT_SRCS-y += $(LIBLIBEVENT)/select.c
+LIBLIBEVENT_SRCS-y += $(LIBLIBEVENT)/signal.c
+LIBLIBEVENT_SRCS-y += $(LIBLIBEVENT)/strlcpy.c
-- 
2.17.1



From minios-devel-bounces@lists.xenproject.org Mon Aug 10 15:24:47 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Mon, 10 Aug 2020 15:24:47 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1k59fL-0004D3-Hc; Mon, 10 Aug 2020 15:24:47 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=gd2F=BU=uliege.be=gaulthier.gain@srs-us1.protection.inumbo.net>)
 id 1k59fK-0004AX-IU
 for minios-devel@lists.xenproject.org; Mon, 10 Aug 2020 15:24:46 +0000
X-Inumbo-ID: 5dbdeb61-1272-4fd0-9334-16c217589696
Received: from serv108.segi.ulg.ac.be (unknown [139.165.32.111])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 5dbdeb61-1272-4fd0-9334-16c217589696;
 Mon, 10 Aug 2020 15:24:43 +0000 (UTC)
Received: from sauron.run.montefiore.ulg.ac.be
 (sauron.run.montefiore.ulg.ac.be [139.165.223.31])
 (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
 (No client certificate requested)
 by serv108.segi.ulg.ac.be (Postfix) with ESMTPSA id EFB19200EED2;
 Mon, 10 Aug 2020 17:24:42 +0200 (CEST)
DKIM-Filter: OpenDKIM Filter v2.11.0 serv108.segi.ulg.ac.be EFB19200EED2
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=uliege.be;
 s=ulg20190529; t=1597073083;
 bh=tidM5s8ezeOBAc7G6dkwBEK4KsTDhYBh/dIc9vPUVP4=;
 h=From:To:Cc:Subject:Date:In-Reply-To:References:From;
 b=frP10xiF/1NlRTqa8RPrDgJrDjQpSDGYA6Rd3lllTSUV8p7BNXJ+PLvoleJEfRB9R
 +p+7/Ax5x1RaWU4SpAMo2Gn32fcf10Htw10bQqcEVCRhrI9Kt7vwd3NuuXao4yKW5G
 unhQFItHD8nxKXYP+e5JNYCmMUK+qbEloZnE4ITJ0I6gIQK1cCFVKlDj/zB5THOKaD
 TfRgRg10e8hg0QJzg3mJAeHch3adXPVACwFGVLMig2YCX54cLfnL4un8QWV01sx2Wc
 m7viGEeEA0QX70JK8x/sHLcuV3byOMiguIF0/326YJVivj1zgEOCxZrVOAjgGdvVeu
 5SGk2PL2RlOFw==
From: gaulthier.gain@uliege.be
To: minios-devel@lists.xenproject.org
Subject: [UNIKRAFT/LIBLIBEVENT PATCH 5/6] Add patches folder
Date: Mon, 10 Aug 2020 15:24:24 +0000
Message-Id: <20200810152425.46150-6-gaulthier.gain@uliege.be>
X-Mailer: git-send-email 2.17.1
In-Reply-To: <20200810152425.46150-1-gaulthier.gain@uliege.be>
References: <20200810152425.46150-1-gaulthier.gain@uliege.be>
X-BeenThere: minios-devel@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Mini-os development list <minios-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:minios-devel@lists.xenproject.org>
List-Help: <mailto:minios-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=subscribe>
Cc: felipe.huici@neclab.eu, gaulthier gain <gaulthier.gain@uliege.be>
Errors-To: minios-devel-bounces@lists.xenproject.org
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>

From: gaulthier gain <gaulthier.gain@uliege.be>

The first patch avoid a static declaration conflicts with the
`arc4random_buf` function due to newlib. The second patch avoids a
warning during the compilation.

Signed-off-by: gaulthier gain <gaulthier.gain@uliege.be>
---
 .../0001-avoid-arc4random_buf-conflicts.patch | 38 +++++++++++++++++++
 ...date-if_nametoindex-with-lwip-prefix.patch | 29 ++++++++++++++
 2 files changed, 67 insertions(+)
 create mode 100644 patches/0001-avoid-arc4random_buf-conflicts.patch
 create mode 100644 patches/0002-update-if_nametoindex-with-lwip-prefix.patch

diff --git a/patches/0001-avoid-arc4random_buf-conflicts.patch b/patches/0001-avoid-arc4random_buf-conflicts.patch
new file mode 100644
index 0000000..1baa249
--- /dev/null
+++ b/patches/0001-avoid-arc4random_buf-conflicts.patch
@@ -0,0 +1,38 @@
+From 4b609315b31391d85b6391106d53fa4b3b940508 Mon Sep 17 00:00:00 2001
+From: gaulthier gain <gaulthier.gain@uliege.be>
+Date: Fri, 7 Aug 2020 15:29:24 +0000
+Subject: [PATCH] Add macro to avoid conflicts with arc4random
+
+This patch adds the `EVENT__HAVE_ARC4RANDOM_BUF` macro which is
+defined in the `config.h` of the libevent repository in order
+to avoid conflicts with libc (musl/newlib) since `arc4random_buf`
+is already defined.
+
+Signed-off-by: gaulthier gain <gaulthier.gain@uliege.be>
+---
+ arc4random.c | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/arc4random.c b/arc4random.c
+index a2338e6..7b29923 100644
+--- a/arc4random.c
++++ b/arc4random.c
+@@ -494,6 +494,7 @@ arc4random(void)
+ }
+ #endif
+ 
++#ifndef EVENT__HAVE_ARC4RANDOM_BUF
+ ARC4RANDOM_EXPORT void
+ arc4random_buf(void *buf_, size_t n)
+ {
+@@ -507,6 +508,7 @@ arc4random_buf(void *buf_, size_t n)
+ 	}
+ 	ARC4_UNLOCK_();
+ }
++#endif
+ 
+ #ifndef ARC4RANDOM_NOUNIFORM
+ /*
+-- 
+2.17.1
+
diff --git a/patches/0002-update-if_nametoindex-with-lwip-prefix.patch b/patches/0002-update-if_nametoindex-with-lwip-prefix.patch
new file mode 100644
index 0000000..7a8e7ca
--- /dev/null
+++ b/patches/0002-update-if_nametoindex-with-lwip-prefix.patch
@@ -0,0 +1,29 @@
+From cd469df5ae915282bc1cc633c895fc7c4b601aef Mon Sep 17 00:00:00 2001
+From: gaulthier gain <gaulthier.gain@uliege.be>
+Date: Mon, 10 Aug 2020 11:28:45 +0000
+Subject: [PATCH] Update if_nametoindex with lwip prefix
+
+This patch updates the definition of the `if_nametoindex` function to
+`lwip_if_nametoindex` which avoids warning during building.
+
+Signed-off-by: gaulthier gain <gaulthier.gain@uliege.be>
+---
+ evutil.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/evutil.c b/evutil.c
+index 9817f08..957c301 100644
+--- a/evutil.c
++++ b/evutil.c
+@@ -2007,7 +2007,7 @@ evutil_inet_pton_scope(int af, const char *src, void *dst, unsigned *indexp)
+ 	if (cp == NULL)
+ 		return evutil_inet_pton(af, src, dst);
+ 
+-	if_index = if_nametoindex(cp + 1);
++	if_index = lwip_if_nametoindex(cp + 1);
+ 	if (if_index == 0) {
+ 		/* Could be numeric */
+ 		if_index = strtoul(cp + 1, &check, 10);
+-- 
+2.17.1
+
-- 
2.17.1



From minios-devel-bounces@lists.xenproject.org Mon Aug 10 15:24:47 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Mon, 10 Aug 2020 15:24:47 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1k59fL-0004DH-Iz; Mon, 10 Aug 2020 15:24:47 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=gd2F=BU=uliege.be=gaulthier.gain@srs-us1.protection.inumbo.net>)
 id 1k59fK-0004BP-Sm
 for minios-devel@lists.xenproject.org; Mon, 10 Aug 2020 15:24:46 +0000
X-Inumbo-ID: e7ad2a74-2465-4e0c-8271-d26b737f5fed
Received: from serv108.segi.ulg.ac.be (unknown [139.165.32.111])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id e7ad2a74-2465-4e0c-8271-d26b737f5fed;
 Mon, 10 Aug 2020 15:24:42 +0000 (UTC)
Received: from sauron.run.montefiore.ulg.ac.be
 (sauron.run.montefiore.ulg.ac.be [139.165.223.31])
 (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
 (No client certificate requested)
 by serv108.segi.ulg.ac.be (Postfix) with ESMTPSA id D8792200E7DD;
 Mon, 10 Aug 2020 17:24:41 +0200 (CEST)
DKIM-Filter: OpenDKIM Filter v2.11.0 serv108.segi.ulg.ac.be D8792200E7DD
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=uliege.be;
 s=ulg20190529; t=1597073081;
 bh=m0tXt8fCcWlega8OKk+h0u5odUdOm8NozEOhXpBkGNQ=;
 h=From:To:Cc:Subject:Date:In-Reply-To:References:From;
 b=zJfZwiUcZUsQsZhHMoD/mZK/EmfzA2Iq1Ivn7Z14GnSos/fw+12JUZfsLs1uZzqYH
 D6Kn6qnq8vXWbH8WxveDGAWTKZW/YOyazMnS2T+H+C0WupkpOCaeeSxmXwWLwdduIs
 EZiiih0Dhn1Dq8WCrXN35ng7O131gJhBrT17OSliP8zDQ5xcAXGt8T9ppTBtBgHDwB
 TlsWFXDi45rPZ6OeKDoily+bZPe6cU+3fLw7gizjNzvViqtAmD5Hplm6k+H2EBmp2f
 TuVVxqNFvi2cE6oPkR3CBWXdbf/GZ/wItq5r9hsX0XjZI6YY7DQla7flmQG8rPobgf
 lEsEGjkb8TRJw==
From: gaulthier.gain@uliege.be
To: minios-devel@lists.xenproject.org
Subject: [UNIKRAFT/LIBLIBEVENT PATCH 4/6] Disable features that are not
 available on Unikraft
Date: Mon, 10 Aug 2020 15:24:23 +0000
Message-Id: <20200810152425.46150-5-gaulthier.gain@uliege.be>
X-Mailer: git-send-email 2.17.1
In-Reply-To: <20200810152425.46150-1-gaulthier.gain@uliege.be>
References: <20200810152425.46150-1-gaulthier.gain@uliege.be>
X-BeenThere: minios-devel@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Mini-os development list <minios-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:minios-devel@lists.xenproject.org>
List-Help: <mailto:minios-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=subscribe>
Cc: felipe.huici@neclab.eu, gaulthier gain <gaulthier.gain@uliege.be>
Errors-To: minios-devel-bounces@lists.xenproject.org
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>

From: gaulthier gain <gaulthier.gain@uliege.be>

Some of these features have to be enable back when we will support
them.

Signed-off-by: gaulthier gain <gaulthier.gain@uliege.be>
---
 include/event2/event-config.h | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/include/event2/event-config.h b/include/event2/event-config.h
index 646a8a2..f60eb37 100644
--- a/include/event2/event-config.h
+++ b/include/event2/event-config.h
@@ -11,7 +11,7 @@
 /* #undef DISABLE_THREAD_SUPPORT */
 
 /* Define to 1 if you have the `accept4' function. */
-#define EVENT__HAVE_ACCEPT4 1
+/* #undef EVENT__HAVE_ACCEPT4 */
 
 /* Define to 1 if you have the <afunix.h> header file. */
 /* #undef EVENT__HAVE_AFUNIX_H */
@@ -23,7 +23,7 @@
 /* #undef EVENT__HAVE_ARC4RANDOM_ADDRANDOM */
 
 /* Define to 1 if you have the `arc4random_buf' function. */
-/* #undef EVENT__HAVE_ARC4RANDOM_BUF */
+#define EVENT__HAVE_ARC4RANDOM_BUF 1
 
 /* Define to 1 if you have the <arpa/inet.h> header file. */
 #define EVENT__HAVE_ARPA_INET_H 1
@@ -46,13 +46,13 @@
 #define EVENT__HAVE_DLFCN_H 1
 
 /* Define if your system supports the epoll system calls */
-#define EVENT__HAVE_EPOLL 1
+/* #undef EVENT__HAVE_EPOLL */
 
 /* Define to 1 if you have the `epoll_create1' function. */
-#define EVENT__HAVE_EPOLL_CREATE1 1
+/* #undef EVENT__HAVE_EPOLL_CREATE1 */
 
 /* Define to 1 if you have the `epoll_ctl' function. */
-#define EVENT__HAVE_EPOLL_CTL 1
+/* #undef EVENT__HAVE_EPOLL_CTL */
 
 /* Define to 1 if you have the <errno.h> header file. */
 #define EVENT__HAVE_ERRNO_H 1
@@ -94,7 +94,7 @@
 /* #undef EVENT__HAVE_GETHOSTBYNAME_R_6_ARG */
 
 /* Define to 1 if you have the `getifaddrs' function. */
-#define EVENT__HAVE_GETIFADDRS 1
+/* #undef EVENT__HAVE_GETIFADDRS */
 
 /* Define to 1 if you have the `getnameinfo' function. */
 #define EVENT__HAVE_GETNAMEINFO 1
@@ -217,7 +217,7 @@
 #define EVENT__HAVE_SETRLIMIT 1
 
 /* Define to 1 if you have the `sigaction' function. */
-#define EVENT__HAVE_SIGACTION 1
+/* #undef EVENT__HAVE_SIGACTION */
 
 /* Define to 1 if you have the `signal' function. */
 #define EVENT__HAVE_SIGNAL 1
@@ -340,7 +340,7 @@
 /* #undef EVENT__HAVE_SYS_SYSCTL_H */
 
 /* Define to 1 if you have the <sys/timerfd.h> header file. */
-#define EVENT__HAVE_SYS_TIMERFD_H 1
+/* #undef EVENT__HAVE_SYS_TIMERFD_H */
 
 /* Define to 1 if you have the <sys/time.h> header file. */
 #define EVENT__HAVE_SYS_TIME_H 1
-- 
2.17.1



From minios-devel-bounces@lists.xenproject.org Mon Aug 10 15:24:52 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Mon, 10 Aug 2020 15:24:52 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1k59fQ-0004FI-LN; Mon, 10 Aug 2020 15:24:52 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=gd2F=BU=uliege.be=gaulthier.gain@srs-us1.protection.inumbo.net>)
 id 1k59fP-0004AX-Ie
 for minios-devel@lists.xenproject.org; Mon, 10 Aug 2020 15:24:51 +0000
X-Inumbo-ID: 0cb305ce-fd60-486d-800c-393f341950a2
Received: from serv108.segi.ulg.ac.be (unknown [139.165.32.111])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 0cb305ce-fd60-486d-800c-393f341950a2;
 Mon, 10 Aug 2020 15:24:44 +0000 (UTC)
Received: from sauron.run.montefiore.ulg.ac.be
 (sauron.run.montefiore.ulg.ac.be [139.165.223.31])
 (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
 (No client certificate requested)
 by serv108.segi.ulg.ac.be (Postfix) with ESMTPSA id 06EFF200F83B;
 Mon, 10 Aug 2020 17:24:44 +0200 (CEST)
DKIM-Filter: OpenDKIM Filter v2.11.0 serv108.segi.ulg.ac.be 06EFF200F83B
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=uliege.be;
 s=ulg20190529; t=1597073084;
 bh=i1nkEQh2qBDUJj3ABtJb2KgYk+6W+P7i0tZ/YLwsWco=;
 h=From:To:Cc:Subject:Date:In-Reply-To:References:From;
 b=culFx81jrHwNaRHq9yx2u2XTfFWBRpolFlauHyx2LvjNeRQaZeTlD1o8JwA5c94JU
 vbcvl/R3TRBfMOSLEegnHMkzXz3ZL6kaFyvf/b4WkhbLVRAXHkIlgwJkb+PX8b4h2f
 LlTmnnMzNr5zr8uIdR35pju44Fi6FTmyPgH3WSbu+KJTCUDOq/7FikllxhRsKiYLyw
 vgXxssdSmoyfxqst7K0bKiZMZ9zDPs8zV4qrQeEh8T7lxbkQEi0GxT0+GZtjR+DA9P
 zUwaD5/VlLQ2J9bwRUyS8clVFwLgtNCC00nnAIdIbO5RCHVuJZy4T0EWZb9zZBJ8G9
 G8y0s3+nbw3Zw==
From: gaulthier.gain@uliege.be
To: minios-devel@lists.xenproject.org
Subject: [UNIKRAFT/LIBLIBEVENT PATCH 6/6] README.md: Update with info about
 building and running
Date: Mon, 10 Aug 2020 15:24:25 +0000
Message-Id: <20200810152425.46150-7-gaulthier.gain@uliege.be>
X-Mailer: git-send-email 2.17.1
In-Reply-To: <20200810152425.46150-1-gaulthier.gain@uliege.be>
References: <20200810152425.46150-1-gaulthier.gain@uliege.be>
X-BeenThere: minios-devel@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Mini-os development list <minios-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:minios-devel@lists.xenproject.org>
List-Help: <mailto:minios-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=subscribe>
Cc: felipe.huici@neclab.eu, gaulthier gain <gaulthier.gain@uliege.be>
Errors-To: minios-devel-bounces@lists.xenproject.org
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>

From: gaulthier gain <gaulthier.gain@uliege.be>

Signed-off-by: gaulthier gain <gaulthier.gain@uliege.be>
---
 README.md | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/README.md b/README.md
index 438d109..da6e07b 100644
--- a/README.md
+++ b/README.md
@@ -1,7 +1,14 @@
-Libevent for Unikraft
-=============================
-
+# Libevent for Unikraft
 This is the port of Libevent for Unikraft as external library.
 
+## Build
+Libevent depends on the following libraries, that need to be added to
+`Makefile` in this order:
+
+* `pthreads`, e.g. `pthread-embedded`
+* network stack, e.g. `lwip`
+* `libc`, e.g. `newlib`
+
+## Further information
 Please refer to the `README.md` as well as the documentation in the
 `doc/` subdirectory of the main unikraft repository.
-- 
2.17.1



From minios-devel-bounces@lists.xenproject.org Mon Aug 10 15:24:52 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Mon, 10 Aug 2020 15:24:52 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1k59fQ-0004FT-Md; Mon, 10 Aug 2020 15:24:52 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=gd2F=BU=uliege.be=gaulthier.gain@srs-us1.protection.inumbo.net>)
 id 1k59fP-0004BP-TM
 for minios-devel@lists.xenproject.org; Mon, 10 Aug 2020 15:24:51 +0000
X-Inumbo-ID: f92eb2eb-2f29-47f1-8df0-1ee64a12318c
Received: from serv108.segi.ulg.ac.be (unknown [139.165.32.111])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id f92eb2eb-2f29-47f1-8df0-1ee64a12318c;
 Mon, 10 Aug 2020 15:24:41 +0000 (UTC)
Received: from sauron.run.montefiore.ulg.ac.be
 (sauron.run.montefiore.ulg.ac.be [139.165.223.31])
 (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
 (No client certificate requested)
 by serv108.segi.ulg.ac.be (Postfix) with ESMTPSA id A50E3200E2C7;
 Mon, 10 Aug 2020 17:24:40 +0200 (CEST)
DKIM-Filter: OpenDKIM Filter v2.11.0 serv108.segi.ulg.ac.be A50E3200E2C7
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=uliege.be;
 s=ulg20190529; t=1597073080;
 bh=OkL9jdo0Y6l868JPYn4pj9FKGd/5vclx8PMwO6Q+ebs=;
 h=From:To:Cc:Subject:Date:In-Reply-To:References:From;
 b=sPfVVORlcpoon9uvH+B33LCESSAnzawGk6kMHmNXlz7GBOb8KpZkfajb5ePrDmdxa
 Rap1foBy82JzD+fHO4ZWZepe0gjtyfuR3cEC3RgZV2tOEk9rObDOMWxpapbdmdljQC
 uiaSxKkc+Qt7Sgsc3NfA+UEmklC6/MqfV89eYUl0GEFbtfvmf1u9oR5Eb2gXOus9CA
 nTdGoYsF+wFUiysPBPRkzqISL8Tdbqk6M8SgBrolBsVmTjkwZZuhsptQ+LIHNR965O
 /4vD6uZQLVBtsPn8c9WrA1Q3I6C1JLOI1T0UigwdBvZ/Kb5FLRqIuO6qjsWwo5kd1m
 2VnAV8an5++RA==
From: gaulthier.gain@uliege.be
To: minios-devel@lists.xenproject.org
Subject: [UNIKRAFT/LIBLIBEVENT PATCH 3/6] Add Libevent auto-generated headers
Date: Mon, 10 Aug 2020 15:24:22 +0000
Message-Id: <20200810152425.46150-4-gaulthier.gain@uliege.be>
X-Mailer: git-send-email 2.17.1
In-Reply-To: <20200810152425.46150-1-gaulthier.gain@uliege.be>
References: <20200810152425.46150-1-gaulthier.gain@uliege.be>
X-BeenThere: minios-devel@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Mini-os development list <minios-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:minios-devel@lists.xenproject.org>
List-Help: <mailto:minios-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=subscribe>
Cc: felipe.huici@neclab.eu, gaulthier gain <gaulthier.gain@uliege.be>
Errors-To: minios-devel-bounces@lists.xenproject.org
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>

From: gaulthier gain <gaulthier.gain@uliege.be>

The `event-config.h` and `evconfig-private.h` headers are generated
when running ./configure and it contains the features that are
available on the build machine. This is copied from a local build.

Signed-off-by: gaulthier gain <gaulthier.gain@uliege.be>
---
 include/evconfig-private.h    |  56 ++++
 include/event2/event-config.h | 555 ++++++++++++++++++++++++++++++++++
 2 files changed, 611 insertions(+)
 create mode 100644 include/evconfig-private.h
 create mode 100644 include/event2/event-config.h

diff --git a/include/evconfig-private.h b/include/evconfig-private.h
new file mode 100644
index 0000000..31e6100
--- /dev/null
+++ b/include/evconfig-private.h
@@ -0,0 +1,56 @@
+/* evconfig-private.h.  Generated from evconfig-private.h.in by configure.  */
+/* evconfig-private.h template - see "Configuration Header Templates" */
+/* in AC manual.  Kevin Bowling <kevin.bowling@kev009.com */
+#ifndef EVCONFIG_PRIVATE_H_INCLUDED_
+#define EVCONFIG_PRIVATE_H_INCLUDED_
+
+/* Enable extensions on AIX 3, Interix.  */
+#ifndef _ALL_SOURCE
+# define _ALL_SOURCE 1
+#endif
+/* Enable GNU extensions on systems that have them.  */
+#ifndef _GNU_SOURCE
+# define _GNU_SOURCE 1
+#endif
+/* Enable threading extensions on Solaris.  */
+#ifndef _POSIX_PTHREAD_SEMANTICS
+# define _POSIX_PTHREAD_SEMANTICS 1
+#endif
+/* Enable extensions on HP NonStop.  */
+#ifndef _TANDEM_SOURCE
+# define _TANDEM_SOURCE 1
+#endif
+/* Enable general extensions on Solaris.  */
+#ifndef __EXTENSIONS__
+# define __EXTENSIONS__ 1
+#endif
+
+/* Number of bits in a file offset, on hosts where this is settable. */
+/* #undef _FILE_OFFSET_BITS */
+/* Define for large files, on AIX-style hosts. */
+/* #undef _LARGE_FILES */
+
+/* Define to 1 if on MINIX. */
+#ifndef _MINIX
+/* #undef _MINIX */
+#endif
+
+/* Define to 2 if the system does not provide POSIX.1 features except with
+   this defined. */
+#ifndef _POSIX_1_SOURCE
+/* #undef _POSIX_1_SOURCE */
+#endif
+
+/* Define to 1 if you need to in order for `stat' and other things to work. */
+#ifndef _POSIX_SOURCE
+/* #undef _POSIX_SOURCE */
+#endif
+
+/* Enable POSIX.2 extensions on QNX for getopt */
+#ifdef __QNX__
+# ifndef __EXT_POSIX2
+#  define __EXT_POSIX2
+# endif
+#endif
+
+#endif
diff --git a/include/event2/event-config.h b/include/event2/event-config.h
new file mode 100644
index 0000000..646a8a2
--- /dev/null
+++ b/include/event2/event-config.h
@@ -0,0 +1,555 @@
+/* config.h.  Generated from config.h.in by configure.  */
+/* config.h.in.  Generated from configure.ac by autoheader.  */
+
+/* Define if libevent should build without support for a debug mode */
+/* #undef DISABLE_DEBUG_MODE */
+
+/* Define if libevent should not allow replacing the mm functions */
+/* #undef DISABLE_MM_REPLACEMENT */
+
+/* Define if libevent should not be compiled with thread support */
+/* #undef DISABLE_THREAD_SUPPORT */
+
+/* Define to 1 if you have the `accept4' function. */
+#define EVENT__HAVE_ACCEPT4 1
+
+/* Define to 1 if you have the <afunix.h> header file. */
+/* #undef EVENT__HAVE_AFUNIX_H */
+
+/* Define to 1 if you have the `arc4random' function. */
+/* #undef EVENT__HAVE_ARC4RANDOM */
+
+/* Define to 1 if you have the `arc4random_addrandom' function. */
+/* #undef EVENT__HAVE_ARC4RANDOM_ADDRANDOM */
+
+/* Define to 1 if you have the `arc4random_buf' function. */
+/* #undef EVENT__HAVE_ARC4RANDOM_BUF */
+
+/* Define to 1 if you have the <arpa/inet.h> header file. */
+#define EVENT__HAVE_ARPA_INET_H 1
+
+/* Define to 1 if you have the `clock_gettime' function. */
+#define EVENT__HAVE_CLOCK_GETTIME 1
+
+/* Define to 1 if you have the declaration of `CTL_KERN', and to 0 if you
+   don't. */
+/* #undef EVENT__HAVE_DECL_CTL_KERN */
+
+/* Define to 1 if you have the declaration of `KERN_ARND', and to 0 if you
+   don't. */
+/* #undef EVENT__HAVE_DECL_KERN_ARND */
+
+/* Define if /dev/poll is available */
+/* #undef EVENT__HAVE_DEVPOLL */
+
+/* Define to 1 if you have the <dlfcn.h> header file. */
+#define EVENT__HAVE_DLFCN_H 1
+
+/* Define if your system supports the epoll system calls */
+#define EVENT__HAVE_EPOLL 1
+
+/* Define to 1 if you have the `epoll_create1' function. */
+#define EVENT__HAVE_EPOLL_CREATE1 1
+
+/* Define to 1 if you have the `epoll_ctl' function. */
+#define EVENT__HAVE_EPOLL_CTL 1
+
+/* Define to 1 if you have the <errno.h> header file. */
+#define EVENT__HAVE_ERRNO_H 1
+
+/* Define to 1 if you have the `eventfd' function. */
+#define EVENT__HAVE_EVENTFD 1
+
+/* Define if your system supports event ports */
+/* #undef EVENT__HAVE_EVENT_PORTS */
+
+/* Define to 1 if you have the `fcntl' function. */
+#define EVENT__HAVE_FCNTL 1
+
+/* Define to 1 if you have the <fcntl.h> header file. */
+#define EVENT__HAVE_FCNTL_H 1
+
+/* Define to 1 if the system has the type `fd_mask'. */
+#define EVENT__HAVE_FD_MASK 1
+
+/* Do we have getaddrinfo()? */
+#define EVENT__HAVE_GETADDRINFO 1
+
+/* Define to 1 if you have the `getegid' function. */
+#define EVENT__HAVE_GETEGID 1
+
+/* Define to 1 if you have the `geteuid' function. */
+#define EVENT__HAVE_GETEUID 1
+
+/* Define this if you have any gethostbyname_r() */
+/* #undef EVENT__HAVE_GETHOSTBYNAME_R */
+
+/* Define this if gethostbyname_r takes 3 arguments */
+/* #undef EVENT__HAVE_GETHOSTBYNAME_R_3_ARG */
+
+/* Define this if gethostbyname_r takes 5 arguments */
+/* #undef EVENT__HAVE_GETHOSTBYNAME_R_5_ARG */
+
+/* Define this if gethostbyname_r takes 6 arguments */
+/* #undef EVENT__HAVE_GETHOSTBYNAME_R_6_ARG */
+
+/* Define to 1 if you have the `getifaddrs' function. */
+#define EVENT__HAVE_GETIFADDRS 1
+
+/* Define to 1 if you have the `getnameinfo' function. */
+#define EVENT__HAVE_GETNAMEINFO 1
+
+/* Define to 1 if you have the `getprotobynumber' function. */
+#define EVENT__HAVE_GETPROTOBYNUMBER 1
+
+/* Define to 1 if you have the `getrandom' function. */
+#define EVENT__HAVE_GETRANDOM 1
+
+/* Define to 1 if you have the `getservbyname' function. */
+#define EVENT__HAVE_GETSERVBYNAME 1
+
+/* Define to 1 if you have the `gettimeofday' function. */
+#define EVENT__HAVE_GETTIMEOFDAY 1
+
+/* Define to 1 if you have the <ifaddrs.h> header file. */
+#define EVENT__HAVE_IFADDRS_H 1
+
+/* Define to 1 if you have the `inet_ntop' function. */
+#define EVENT__HAVE_INET_NTOP 1
+
+/* Define to 1 if you have the `inet_pton' function. */
+#define EVENT__HAVE_INET_PTON 1
+
+/* Define to 1 if you have the <inttypes.h> header file. */
+#define EVENT__HAVE_INTTYPES_H 1
+
+/* Define to 1 if you have the `issetugid' function. */
+/* #undef EVENT__HAVE_ISSETUGID */
+
+/* Define to 1 if you have the `kqueue' function. */
+/* #undef EVENT__HAVE_KQUEUE */
+
+/* Define to 1 if you have the `ws2_32' library (-lws2_32). */
+/* #undef EVENT__HAVE_LIBWS2_32 */
+
+/* Define if the system has zlib */
+#define EVENT__HAVE_LIBZ 1
+
+/* Define to 1 if you have the `mach_absolute_time' function. */
+/* #undef EVENT__HAVE_MACH_ABSOLUTE_TIME */
+
+/* Define to 1 if you have the <mach/mach.h> header file. */
+/* #undef EVENT__HAVE_MACH_MACH_H */
+
+/* Define to 1 if you have the <mach/mach_time.h> header file. */
+/* #undef EVENT__HAVE_MACH_MACH_TIME_H */
+
+/* Define to 1 if you have the <memory.h> header file. */
+#define EVENT__HAVE_MEMORY_H 1
+
+/* Define to 1 if you have the `mmap' function. */
+#define EVENT__HAVE_MMAP 1
+
+/* Define to 1 if you have the `nanosleep' function. */
+#define EVENT__HAVE_NANOSLEEP 1
+
+/* Define to 1 if you have the <netdb.h> header file. */
+#define EVENT__HAVE_NETDB_H 1
+
+/* Define to 1 if you have the <netinet/in6.h> header file. */
+/* #undef EVENT__HAVE_NETINET_IN6_H */
+
+/* Define to 1 if you have the <netinet/in.h> header file. */
+#define EVENT__HAVE_NETINET_IN_H 1
+
+/* Define to 1 if you have the <netinet/tcp.h> header file. */
+#define EVENT__HAVE_NETINET_TCP_H 1
+
+/* Define if the system has openssl */
+#define EVENT__HAVE_OPENSSL 1
+
+/* Define to 1 if you have the <openssl/ssl.h> header file. */
+#define EVENT__HAVE_OPENSSL_SSL_H 1
+
+/* Define to 1 if you have the `pipe' function. */
+#define EVENT__HAVE_PIPE 1
+
+/* Define to 1 if you have the `pipe2' function. */
+#define EVENT__HAVE_PIPE2 1
+
+/* Define to 1 if you have the `poll' function. */
+#define EVENT__HAVE_POLL 1
+
+/* Define to 1 if you have the <poll.h> header file. */
+#define EVENT__HAVE_POLL_H 1
+
+/* Define to 1 if you have the `port_create' function. */
+/* #undef EVENT__HAVE_PORT_CREATE */
+
+/* Define to 1 if you have the <port.h> header file. */
+/* #undef EVENT__HAVE_PORT_H */
+
+/* Define if you have POSIX threads libraries and header files. */
+/* #undef EVENT__HAVE_PTHREAD */
+
+/* Define if we have pthreads on this system */
+#define EVENT__HAVE_PTHREADS 1
+
+/* Define to 1 if you have the `putenv' function. */
+#define EVENT__HAVE_PUTENV 1
+
+/* Define to 1 if the system has the type `sa_family_t'. */
+#define EVENT__HAVE_SA_FAMILY_T 1
+
+/* Define to 1 if you have the `select' function. */
+#define EVENT__HAVE_SELECT 1
+
+/* Define to 1 if you have the `sendfile' function. */
+#define EVENT__HAVE_SENDFILE 1
+
+/* Define to 1 if you have the `setenv' function. */
+#define EVENT__HAVE_SETENV 1
+
+/* Define if F_SETFD is defined in <fcntl.h> */
+#define EVENT__HAVE_SETFD 1
+
+/* Define to 1 if you have the `setrlimit' function. */
+#define EVENT__HAVE_SETRLIMIT 1
+
+/* Define to 1 if you have the `sigaction' function. */
+#define EVENT__HAVE_SIGACTION 1
+
+/* Define to 1 if you have the `signal' function. */
+#define EVENT__HAVE_SIGNAL 1
+
+/* Define to 1 if you have the `splice' function. */
+#define EVENT__HAVE_SPLICE 1
+
+/* Define to 1 if you have the <stdarg.h> header file. */
+#define EVENT__HAVE_STDARG_H 1
+
+/* Define to 1 if you have the <stddef.h> header file. */
+#define EVENT__HAVE_STDDEF_H 1
+
+/* Define to 1 if you have the <stdint.h> header file. */
+#define EVENT__HAVE_STDINT_H 1
+
+/* Define to 1 if you have the <stdlib.h> header file. */
+#define EVENT__HAVE_STDLIB_H 1
+
+/* Define to 1 if you have the <strings.h> header file. */
+#define EVENT__HAVE_STRINGS_H 1
+
+/* Define to 1 if you have the <string.h> header file. */
+#define EVENT__HAVE_STRING_H 1
+
+/* Define to 1 if you have the `strlcpy' function. */
+/* #undef EVENT__HAVE_STRLCPY */
+
+/* Define to 1 if you have the `strsep' function. */
+#define EVENT__HAVE_STRSEP 1
+
+/* Define to 1 if you have the `strtok_r' function. */
+#define EVENT__HAVE_STRTOK_R 1
+
+/* Define to 1 if you have the `strtoll' function. */
+#define EVENT__HAVE_STRTOLL 1
+
+/* Define to 1 if the system has the type `struct addrinfo'. */
+#define EVENT__HAVE_STRUCT_ADDRINFO 1
+
+/* Define to 1 if the system has the type `struct in6_addr'. */
+#define EVENT__HAVE_STRUCT_IN6_ADDR 1
+
+/* Define to 1 if `s6_addr16' is a member of `struct in6_addr'. */
+#define EVENT__HAVE_STRUCT_IN6_ADDR_S6_ADDR16 1
+
+/* Define to 1 if `s6_addr32' is a member of `struct in6_addr'. */
+#define EVENT__HAVE_STRUCT_IN6_ADDR_S6_ADDR32 1
+
+/* Define to 1 if the system has the type `struct linger'. */
+#define EVENT__HAVE_STRUCT_LINGER 1
+
+/* Define to 1 if the system has the type `struct sockaddr_in6'. */
+#define EVENT__HAVE_STRUCT_SOCKADDR_IN6 1
+
+/* Define to 1 if `sin6_len' is a member of `struct sockaddr_in6'. */
+/* #undef EVENT__HAVE_STRUCT_SOCKADDR_IN6_SIN6_LEN */
+
+/* Define to 1 if `sin_len' is a member of `struct sockaddr_in'. */
+/* #undef EVENT__HAVE_STRUCT_SOCKADDR_IN_SIN_LEN */
+
+/* Define to 1 if the system has the type `struct sockaddr_storage'. */
+#define EVENT__HAVE_STRUCT_SOCKADDR_STORAGE 1
+
+/* Define to 1 if `ss_family' is a member of `struct sockaddr_storage'. */
+#define EVENT__HAVE_STRUCT_SOCKADDR_STORAGE_SS_FAMILY 1
+
+/* Define to 1 if `__ss_family' is a member of `struct sockaddr_storage'. */
+/* #undef EVENT__HAVE_STRUCT_SOCKADDR_STORAGE___SS_FAMILY */
+
+/* Define to 1 if the system has the type `struct sockaddr_un'. */
+#define EVENT__HAVE_STRUCT_SOCKADDR_UN 1
+
+/* Define to 1 if you have the `sysctl' function. */
+#define EVENT__HAVE_SYSCTL 1
+
+/* Define to 1 if you have the <sys/devpoll.h> header file. */
+/* #undef EVENT__HAVE_SYS_DEVPOLL_H */
+
+/* Define to 1 if you have the <sys/epoll.h> header file. */
+#define EVENT__HAVE_SYS_EPOLL_H 1
+
+/* Define to 1 if you have the <sys/eventfd.h> header file. */
+#define EVENT__HAVE_SYS_EVENTFD_H 1
+
+/* Define to 1 if you have the <sys/event.h> header file. */
+/* #undef EVENT__HAVE_SYS_EVENT_H */
+
+/* Define to 1 if you have the <sys/ioctl.h> header file. */
+#define EVENT__HAVE_SYS_IOCTL_H 1
+
+/* Define to 1 if you have the <sys/mman.h> header file. */
+#define EVENT__HAVE_SYS_MMAN_H 1
+
+/* Define to 1 if you have the <sys/param.h> header file. */
+#define EVENT__HAVE_SYS_PARAM_H 1
+
+/* Define to 1 if you have the <sys/queue.h> header file. */
+#define EVENT__HAVE_SYS_QUEUE_H 1
+
+/* Define to 1 if you have the <sys/random.h> header file. */
+#define EVENT__HAVE_SYS_RANDOM_H 1
+
+/* Define to 1 if you have the <sys/resource.h> header file. */
+#define EVENT__HAVE_SYS_RESOURCE_H 1
+
+/* Define to 1 if you have the <sys/select.h> header file. */
+#define EVENT__HAVE_SYS_SELECT_H 1
+
+/* Define to 1 if you have the <sys/sendfile.h> header file. */
+#define EVENT__HAVE_SYS_SENDFILE_H 1
+
+/* Define to 1 if you have the <sys/socket.h> header file. */
+#define EVENT__HAVE_SYS_SOCKET_H 1
+
+/* Define to 1 if you have the <sys/stat.h> header file. */
+#define EVENT__HAVE_SYS_STAT_H 1
+
+/* Define to 1 if you have the <sys/sysctl.h> header file. */
+/* #undef EVENT__HAVE_SYS_SYSCTL_H */
+
+/* Define to 1 if you have the <sys/timerfd.h> header file. */
+#define EVENT__HAVE_SYS_TIMERFD_H 1
+
+/* Define to 1 if you have the <sys/time.h> header file. */
+#define EVENT__HAVE_SYS_TIME_H 1
+
+/* Define to 1 if you have the <sys/types.h> header file. */
+#define EVENT__HAVE_SYS_TYPES_H 1
+
+/* Define to 1 if you have the <sys/uio.h> header file. */
+#define EVENT__HAVE_SYS_UIO_H 1
+
+/* Define to 1 if you have the <sys/un.h> header file. */
+#define EVENT__HAVE_SYS_UN_H 1
+
+/* Define to 1 if you have the <sys/wait.h> header file. */
+#define EVENT__HAVE_SYS_WAIT_H 1
+
+/* Define if TAILQ_FOREACH is defined in <sys/queue.h> */
+#define EVENT__HAVE_TAILQFOREACH 1
+
+/* Define if timeradd is defined in <sys/time.h> */
+#define EVENT__HAVE_TIMERADD 1
+
+/* Define if timerclear is defined in <sys/time.h> */
+#define EVENT__HAVE_TIMERCLEAR 1
+
+/* Define if timercmp is defined in <sys/time.h> */
+#define EVENT__HAVE_TIMERCMP 1
+
+/* Define to 1 if you have the `timerfd_create' function. */
+#define EVENT__HAVE_TIMERFD_CREATE 1
+
+/* Define if timerisset is defined in <sys/time.h> */
+#define EVENT__HAVE_TIMERISSET 1
+
+/* Define to 1 if the system has the type `uint16_t'. */
+#define EVENT__HAVE_UINT16_T 1
+
+/* Define to 1 if the system has the type `uint32_t'. */
+#define EVENT__HAVE_UINT32_T 1
+
+/* Define to 1 if the system has the type `uint64_t'. */
+#define EVENT__HAVE_UINT64_T 1
+
+/* Define to 1 if the system has the type `uint8_t'. */
+#define EVENT__HAVE_UINT8_T 1
+
+/* Define to 1 if the system has the type `uintptr_t'. */
+#define EVENT__HAVE_UINTPTR_T 1
+
+/* Define to 1 if you have the `umask' function. */
+#define EVENT__HAVE_UMASK 1
+
+/* Define to 1 if you have the <unistd.h> header file. */
+#define EVENT__HAVE_UNISTD_H 1
+
+/* Define to 1 if you have the `unsetenv' function. */
+#define EVENT__HAVE_UNSETENV 1
+
+/* Define to 1 if you have the `usleep' function. */
+#define EVENT__HAVE_USLEEP 1
+
+/* Define to 1 if you have the `vasprintf' function. */
+#define EVENT__HAVE_VASPRINTF 1
+
+/* Define if kqueue works correctly with pipes */
+/* #undef EVENT__HAVE_WORKING_KQUEUE */
+
+/* Define to 1 if you have the <zlib.h> header file. */
+#define EVENT__HAVE_ZLIB_H 1
+
+/* Define to 1 if you have the `_gmtime64' function. */
+/* #undef EVENT__HAVE__GMTIME64 */
+
+/* Define to 1 if you have the `_gmtime64_s' function. */
+/* #undef EVENT__HAVE__GMTIME64_S */
+
+/* Define to 1 if compiler have __FUNCTION__ */
+#define EVENT__HAVE___FUNCTION__ 1
+
+/* Define to 1 if compiler have __func__ */
+#define EVENT__HAVE___func__ 1
+
+/* Define to the sub-directory where libtool stores uninstalled libraries. */
+#define LT_OBJDIR ".libs/"
+
+/* Numeric representation of the version */
+#define EVENT__NUMERIC_VERSION 0x02010c00
+
+/* Name of package */
+#define PACKAGE "libevent"
+
+/* Define to the address where bug reports for this package should be sent. */
+#define PACKAGE_BUGREPORT ""
+
+/* Define to the full name of this package. */
+#define PACKAGE_NAME "libevent"
+
+/* Define to the full name and version of this package. */
+#define PACKAGE_STRING "libevent 2.1.12-stable"
+
+/* Define to the one symbol short name of this package. */
+#define PACKAGE_TARNAME "libevent"
+
+/* Define to the home page for this package. */
+#define PACKAGE_URL ""
+
+/* Define to the version of this package. */
+#define PACKAGE_VERSION "2.1.12-stable"
+
+/* Define to necessary symbol if this constant uses a non-standard name on
+   your system. */
+/* #undef PTHREAD_CREATE_JOINABLE */
+
+/* The size of `int', as computed by sizeof. */
+#define EVENT__SIZEOF_INT 4
+
+/* The size of `long', as computed by sizeof. */
+#define EVENT__SIZEOF_LONG 8
+
+/* The size of `long long', as computed by sizeof. */
+#define EVENT__SIZEOF_LONG_LONG 8
+
+/* The size of `off_t', as computed by sizeof. */
+#define EVENT__SIZEOF_OFF_T 8
+
+/* The size of `pthread_t', as computed by sizeof. */
+#define EVENT__SIZEOF_PTHREAD_T 8
+
+/* The size of `short', as computed by sizeof. */
+#define EVENT__SIZEOF_SHORT 2
+
+/* The size of `size_t', as computed by sizeof. */
+#define EVENT__SIZEOF_SIZE_T 8
+
+/* The size of `time_t', as computed by sizeof. */
+#define EVENT__SIZEOF_TIME_T 8
+
+/* The size of `void *', as computed by sizeof. */
+#define EVENT__SIZEOF_VOID_P 8
+
+/* Define to 1 if you have the ANSI C header files. */
+#define STDC_HEADERS 1
+
+/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */
+#define TIME_WITH_SYS_TIME 1
+
+/* Enable extensions on AIX 3, Interix.  */
+#ifndef _ALL_SOURCE
+# define _ALL_SOURCE 1
+#endif
+/* Enable GNU extensions on systems that have them.  */
+#ifndef _GNU_SOURCE
+# define _GNU_SOURCE 1
+#endif
+/* Enable threading extensions on Solaris.  */
+#ifndef _POSIX_PTHREAD_SEMANTICS
+# define _POSIX_PTHREAD_SEMANTICS 1
+#endif
+/* Enable extensions on HP NonStop.  */
+#ifndef _TANDEM_SOURCE
+# define _TANDEM_SOURCE 1
+#endif
+/* Enable general extensions on Solaris.  */
+#ifndef __EXTENSIONS__
+# define __EXTENSIONS__ 1
+#endif
+
+
+/* Version number of package */
+#define EVENT__VERSION "2.1.12-stable"
+
+/* Enable large inode numbers on Mac OS X 10.5.  */
+#ifndef _DARWIN_USE_64_BIT_INODE
+# define _DARWIN_USE_64_BIT_INODE 1
+#endif
+
+/* Number of bits in a file offset, on hosts where this is settable. */
+/* #undef _FILE_OFFSET_BITS */
+
+/* Define for large files, on AIX-style hosts. */
+/* #undef _LARGE_FILES */
+
+/* Define to 1 if on MINIX. */
+/* #undef _MINIX */
+
+/* Define to 2 if the system does not provide POSIX.1 features except with
+   this defined. */
+/* #undef _POSIX_1_SOURCE */
+
+/* Define to 1 if you need to in order for `stat' and other things to work. */
+/* #undef _POSIX_SOURCE */
+
+/* Define to empty if `const' does not conform to ANSI C. */
+/* #undef const */
+
+/* Define to `__inline__' or `__inline' if that's what the C compiler
+   calls it, or to nothing if 'inline' is not supported under any name.  */
+#ifndef __cplusplus
+/* #undef inline */
+#endif
+
+/* Define to `int' if <sys/types.h> does not define. */
+/* #undef pid_t */
+
+/* Define to `unsigned int' if <sys/types.h> does not define. */
+/* #undef size_t */
+
+/* Define to unsigned int if you dont have it */
+/* #undef socklen_t */
+
+/* Define to `int' if <sys/types.h> does not define. */
+/* #undef ssize_t */
-- 
2.17.1



From minios-devel-bounces@lists.xenproject.org Mon Aug 10 15:33:52 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Mon, 10 Aug 2020 15:33:52 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1k59o7-0005CG-NA; Mon, 10 Aug 2020 15:33:51 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=gd2F=BU=uliege.be=gaulthier.gain@srs-us1.protection.inumbo.net>)
 id 1k59o5-0005C9-Or
 for minios-devel@lists.xenproject.org; Mon, 10 Aug 2020 15:33:49 +0000
X-Inumbo-ID: 25cdb948-c15c-45f0-a407-a59e76e0ade4
Received: from serv108.segi.ulg.ac.be (unknown [139.165.32.111])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 25cdb948-c15c-45f0-a407-a59e76e0ade4;
 Mon, 10 Aug 2020 15:33:48 +0000 (UTC)
Received: from sauron.run.montefiore.ulg.ac.be
 (sauron.run.montefiore.ulg.ac.be [139.165.223.31])
 (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
 (No client certificate requested)
 by serv108.segi.ulg.ac.be (Postfix) with ESMTPSA id AE507200E2C7;
 Mon, 10 Aug 2020 17:33:47 +0200 (CEST)
DKIM-Filter: OpenDKIM Filter v2.11.0 serv108.segi.ulg.ac.be AE507200E2C7
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=uliege.be;
 s=ulg20190529; t=1597073627;
 bh=e3PEkWCtakEjxnFOS/6PgVnQnAwGURRqogRAQVDudmM=;
 h=From:To:Cc:Subject:Date:From;
 b=B0rOdIEqM0vBWvWJyTktWLyl6d+FhLK/6dnZPm9NbaMTZZeKptu2QL15jE4xJ7U96
 zGkVCWq1OQkamqSU/WROqML/BL6N+xlFR15exLiUmJNZultvqVL7Ol5tQ9f5latWlF
 /ZwviQhdfZbR3QCbSKkaUsNxCZbXoE15qP/6DBI9Ny5oo827nZ3e+B3NzWaSz8pdV9
 lZykOhMLN1I77AtFHM4egH415TVJwUQNTvy9LvEIA1rSDPKb5p8jvv/YsDu24AEwkw
 T4vsaltU82y59x0ZqYfF4Dt7MgcRTCcD4117Paolo3d8AIoPycON0OM6jA5P9Bi1z9
 jy0GSjaJjmJNA==
From: gaulthier.gain@uliege.be
To: minios-devel@lists.xenproject.org
Subject: [UNIKRAFT/LIBMEMCACHED PATCH 0/7] Memcached port on Unikraft
Date: Mon, 10 Aug 2020 15:33:33 +0000
Message-Id: <20200810153340.47103-1-gaulthier.gain@uliege.be>
X-Mailer: git-send-email 2.17.1
X-BeenThere: minios-devel@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Mini-os development list <minios-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:minios-devel@lists.xenproject.org>
List-Help: <mailto:minios-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=subscribe>
Cc: felipe.huici@neclab.eu, gaulthier gain <gaulthier.gain@uliege.be>
Errors-To: minios-devel-bounces@lists.xenproject.org
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>

From: gaulthier gain <gaulthier.gain@uliege.be>

This patch series is the initial port of Memcached on unikraft. For now,
this series uses newlib as a libc. In future version, musl will be
considered when it will be more stable.

Note: The patch `Add-LIST-END-macro-in-queue.patch` from newlib
(https://patchwork.unikraft.org/patch/737951/) must be applied
before using this library. In addition, the libevent library is 
required (https://patchwork.unikraft.org/cover/737952/).

gaulthier gain (7):
  Introduce library skeleton
  Add Makefile.uk
  Add Memcached auto-generated header
  include/config.h: Disable features that are not available on Unikraft
  Provide main() function if configured to do so
  Add patches folder
  README.md: Update with info about building and running

 .gitignore                                    |  27 +++
 CODING_STYLE.md                               |   4 +
 CONTRIBUTING.md                               |   4 +
 COPYING.md                                    |  38 ++++
 Config.uk                                     |  11 ++
 MAINTAINERS.md                                |  11 ++
 Makefile.uk                                   | 117 +++++++++++++
 README.md                                     |  25 +++
 include/config.h                              | 165 ++++++++++++++++++
 main.c                                        |   8 +
 patches/0001-fix-trace-conflict.patch         |  43 +++++
 ...d-to-avoid-conflicts-with-stats_init.patch |  44 +++++
 patches/0003-remove-daemonize-mode.patch      |  92 ++++++++++
 patches/0004-remove-root-user-check.patch     |  47 +++++
 14 files changed, 636 insertions(+)
 create mode 100644 .gitignore
 create mode 100644 CODING_STYLE.md
 create mode 100644 CONTRIBUTING.md
 create mode 100644 COPYING.md
 create mode 100644 Config.uk
 create mode 100644 MAINTAINERS.md
 create mode 100644 Makefile.uk
 create mode 100644 README.md
 create mode 100644 include/config.h
 create mode 100644 main.c
 create mode 100644 patches/0001-fix-trace-conflict.patch
 create mode 100644 patches/0002-update-memcached-to-avoid-conflicts-with-stats_init.patch
 create mode 100644 patches/0003-remove-daemonize-mode.patch
 create mode 100644 patches/0004-remove-root-user-check.patch

-- 
2.17.1



From minios-devel-bounces@lists.xenproject.org Mon Aug 10 15:33:55 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Mon, 10 Aug 2020 15:33:55 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1k59oB-0005D0-PL; Mon, 10 Aug 2020 15:33:55 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=gd2F=BU=uliege.be=gaulthier.gain@srs-us1.protection.inumbo.net>)
 id 1k59o9-0005Ch-SM
 for minios-devel@lists.xenproject.org; Mon, 10 Aug 2020 15:33:53 +0000
X-Inumbo-ID: b4592984-aec2-4f6c-97c8-17d918bdb593
Received: from serv108.segi.ulg.ac.be (unknown [139.165.32.111])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id b4592984-aec2-4f6c-97c8-17d918bdb593;
 Mon, 10 Aug 2020 15:33:52 +0000 (UTC)
Received: from sauron.run.montefiore.ulg.ac.be
 (sauron.run.montefiore.ulg.ac.be [139.165.223.31])
 (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
 (No client certificate requested)
 by serv108.segi.ulg.ac.be (Postfix) with ESMTPSA id C69B1200E7DD;
 Mon, 10 Aug 2020 17:33:51 +0200 (CEST)
DKIM-Filter: OpenDKIM Filter v2.11.0 serv108.segi.ulg.ac.be C69B1200E7DD
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=uliege.be;
 s=ulg20190529; t=1597073631;
 bh=8Px2xOpWFYIqyhiLyWtFodSRMvD4nDZ79vQtr9Wqu5s=;
 h=From:To:Cc:Subject:Date:In-Reply-To:References:From;
 b=eisVaX3HgVCequpT7AocTT3umDh6AVBQAyZm2yqf0Ty3CDwY2M5r7Sa+eU6Tj92S5
 uLUQsRRdXw9ubqarC4/vh6XgcfXmM4+m2QXGgjmBIg6NFOFXoG3/vjVp0OW6UMpXPq
 2fcb6dCySO7GzmhF1DD+yjyKIGzGwdLAuD6OACWmsQsbIoiKVqn0IJA+nY6IXh+B/0
 vMP2q2DXzD/cBwE4txaICMG3K6D9TU+wSQXDmk24XtU6o5Kv/GIIEGv9/BZivHWFyA
 9IucL5C+FyNUISofENgrF1SUzdzJdgW4+A0MLxw+I/5OXUMAEBVaphBsJZp+tWVCAr
 Or13r75hGN9eg==
From: gaulthier.gain@uliege.be
To: minios-devel@lists.xenproject.org
Subject: [UNIKRAFT/LIBMEMCACHED PATCH 2/7] Add Makefile.uk
Date: Mon, 10 Aug 2020 15:33:35 +0000
Message-Id: <20200810153340.47103-3-gaulthier.gain@uliege.be>
X-Mailer: git-send-email 2.17.1
In-Reply-To: <20200810153340.47103-1-gaulthier.gain@uliege.be>
References: <20200810153340.47103-1-gaulthier.gain@uliege.be>
X-BeenThere: minios-devel@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Mini-os development list <minios-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:minios-devel@lists.xenproject.org>
List-Help: <mailto:minios-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=subscribe>
Cc: felipe.huici@neclab.eu, gaulthier gain <gaulthier.gain@uliege.be>
Errors-To: minios-devel-bounces@lists.xenproject.org
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>

From: gaulthier gain <gaulthier.gain@uliege.be>

Add SQLite port Makefile.uk.

Signed-off-by: gaulthier gain <gaulthier.gain@uliege.be>
---
 Makefile.uk | 109 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 109 insertions(+)
 create mode 100644 Makefile.uk

diff --git a/Makefile.uk b/Makefile.uk
new file mode 100644
index 0000000..2e07f4e
--- /dev/null
+++ b/Makefile.uk
@@ -0,0 +1,109 @@
+#  SPDX-License-Identifier: BSD-3-Clause
+#
+#  Memcached Makefile.uk
+#
+#  Authors: Gain Gaulthier <gaulthier.gain@uliege.be>
+#
+#  Copyright (c) 2020, University of Liege. All rights reserved.
+#
+#  Redistribution and use in source and binary forms, with or without
+#  modification, are permitted provided that the following conditions
+#  are met:
+#
+#  1. Redistributions of source code must retain the above copyright
+#     notice, this list of conditions and the following disclaimer.
+#  2. Redistributions in binary form must reproduce the above copyright
+#     notice, this list of conditions and the following disclaimer in the
+#     documentation and/or other materials provided with the distribution.
+#  3. Neither the name of the copyright holder nor the names of its
+#     contributors may be used to endorse or promote products derived from
+#     this software without specific prior written permission.
+#
+#  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+#  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+#  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+#  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+#  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+#  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+#  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+#  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+#  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+#  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+#  POSSIBILITY OF SUCH DAMAGE.
+#
+#  THIS HEADER MAY NOT BE EXTRACTED OR MODIFIED IN ANY WAY.
+#
+
+################################################################################
+# Library registration
+################################################################################
+$(eval $(call addlib,libmemcached))
+
+################################################################################
+# Sources
+################################################################################
+LIBMEMCACHED_VERSION=1.5.18
+LIBMEMCACHED_URL=https://memcached.org/files/memcached-$(LIBMEMCACHED_VERSION).tar.gz
+LIBMEMCACHED_PATCHDIR=$(LIBMEMCACHED_BASE)/patches
+
+$(eval $(call fetch,libmemcached,$(LIBMEMCACHED_URL)))
+$(eval $(call patch,libmemcached,$(LIBMEMCACHED_PATCHDIR),memcached-$(LIBMEMCACHED_VERSION)))
+
+################################################################################
+# Helpers
+################################################################################
+LIBMEMCACHED_SUBDIR=memcached-$(LIBMEMCACHED_VERSION)
+LIBMEMCACHED=$(LIBMEMCACHED_ORIGIN)/$(LIBMEMCACHED_SUBDIR)/
+
+################################################################################
+# Library includes
+################################################################################
+LIBMEMCACHED_CINCLUDES-y += -I$(LIBMEMCACHED_BASE)/include
+LIBMEMCACHED_CINCLUDES-y += -I$(LIBMEMCACHED)
+
+################################################################################
+# Global flags
+################################################################################
+LIBMEMCACHED_FLAGS = -DHAVE_CONFIG_H
+
+LIBMEMCACHED_SUPPRESS_FLAGS-y = -Wno-unused-parameter -Wno-unused-variable		\
+-Wno-cast-function-type -Wno-char-subscripts
+
+LIBMEMCACHED_SUPPRESS_FLAGS-$(call gcc_version_ge,7,0) +=-Wimplicit-fallthrough=0	\
+
+LIBMEMCACHED_CFLAGS-y += $(LIBMEMCACHED_FLAGS)
+LIBMEMCACHED_CFLAGS-y += $(LIBMEMCACHED_SUPPRESS_FLAGS-y)
+
+################################################################################
+# Memcached sources
+################################################################################
+LIBMEMCACHED_SRCS-y += $(LIBMEMCACHED)/assoc.c
+LIBMEMCACHED_SRCS-y += $(LIBMEMCACHED)/authfile.c
+LIBMEMCACHED_SRCS-y += $(LIBMEMCACHED)/bipbuffer.c
+LIBMEMCACHED_SRCS-y += $(LIBMEMCACHED)/cache.c
+LIBMEMCACHED_SRCS-y += $(LIBMEMCACHED)/crawler.c
+LIBMEMCACHED_SRCS-y += $(LIBMEMCACHED)/crc32c.c
+#LIBMEMCACHED_SRCS-y += $(LIBMEMCACHED)/daemon.c
+LIBMEMCACHED_SRCS-y += $(LIBMEMCACHED)/extstore.c
+LIBMEMCACHED_SRCS-y += $(LIBMEMCACHED)/hash.c
+LIBMEMCACHED_SRCS-y += $(LIBMEMCACHED)/items.c
+LIBMEMCACHED_SRCS-y += $(LIBMEMCACHED)/itoa_ljust.c
+LIBMEMCACHED_SRCS-y += $(LIBMEMCACHED)/jenkins_hash.c
+#LIBMEMCACHED_SRCS-y += $(LIBMEMCACHED)/linux_priv.c
+LIBMEMCACHED_SRCS-y += $(LIBMEMCACHED)/logger.c
+LIBMEMCACHED_SRCS-y += $(LIBMEMCACHED)/memcached.c
+LIBMEMCACHED_SRCS-y += $(LIBMEMCACHED)/murmur3_hash.c
+#LIBMEMCACHED_SRCS-y += $(LIBMEMCACHED)/openbsd_priv.c
+LIBMEMCACHED_SRCS-y += $(LIBMEMCACHED)/restart.c
+#LIBMEMCACHED_SRCS-y += $(LIBMEMCACHED)/sasl_defs.c
+#LIBMEMCACHED_SRCS-y += $(LIBMEMCACHED)/sizes.c
+LIBMEMCACHED_SRCS-y += $(LIBMEMCACHED)/slab_automove.c
+#LIBMEMCACHED_SRCS-y += $(LIBMEMCACHED)/slab_automove_extstore.c
+LIBMEMCACHED_SRCS-y += $(LIBMEMCACHED)/slabs.c
+#LIBMEMCACHED_SRCS-y += $(LIBMEMCACHED)/solaris_priv.c
+LIBMEMCACHED_SRCS-y += $(LIBMEMCACHED)/stats.c
+LIBMEMCACHED_SRCS-y += $(LIBMEMCACHED)/storage.c
+#LIBMEMCACHED_SRCS-y += $(LIBMEMCACHED)/testapp.c
+LIBMEMCACHED_SRCS-y += $(LIBMEMCACHED)/thread.c
+#LIBMEMCACHED_SRCS-y += $(LIBMEMCACHED)/timedrun.c
+LIBMEMCACHED_SRCS-y += $(LIBMEMCACHED)/util.c
-- 
2.17.1



From minios-devel-bounces@lists.xenproject.org Mon Aug 10 15:33:59 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Mon, 10 Aug 2020 15:33:59 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1k59oF-0005Dv-Qn; Mon, 10 Aug 2020 15:33:59 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=gd2F=BU=uliege.be=gaulthier.gain@srs-us1.protection.inumbo.net>)
 id 1k59oE-0005Ch-Pb
 for minios-devel@lists.xenproject.org; Mon, 10 Aug 2020 15:33:58 +0000
X-Inumbo-ID: 857a682c-0b2a-4330-bb9a-a7b7e26847c5
Received: from serv108.segi.ulg.ac.be (unknown [139.165.32.111])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 857a682c-0b2a-4330-bb9a-a7b7e26847c5;
 Mon, 10 Aug 2020 15:33:53 +0000 (UTC)
Received: from sauron.run.montefiore.ulg.ac.be
 (sauron.run.montefiore.ulg.ac.be [139.165.223.31])
 (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
 (No client certificate requested)
 by serv108.segi.ulg.ac.be (Postfix) with ESMTPSA id A4192200EEA7;
 Mon, 10 Aug 2020 17:33:52 +0200 (CEST)
DKIM-Filter: OpenDKIM Filter v2.11.0 serv108.segi.ulg.ac.be A4192200EEA7
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=uliege.be;
 s=ulg20190529; t=1597073632;
 bh=EgUS4yucIYFjWjP3bIB3qTTg5CFnYXhtRsA9IwFn3nE=;
 h=From:To:Cc:Subject:Date:In-Reply-To:References:From;
 b=qNR/GEAgGpAD/6IZ1xNiSGrIYuHQeq/qi2uPWZr3JvWQ1fML/dTY4n5LO/r6qUs0M
 DZuLcntWHxaeWtl8un079nFApTP8Vub/Zhlye5qgZfPikDMn7uF+MY5rHMfitIt73Z
 xDvw20sygjsoMcFjQPjSZw3CWm97rrieI5Unb5huJUlK7+TsTMKjJN470OY2ItsFXl
 hqvi7FcmFXuhKon+6zWrAGMlAU4AGzQL0TnTKG1oxRVnRSA+oLrcFwS+QbabyYzMVw
 OQx1ocPGWuJ6FmQ1kPTB3eswVMGktIEGOY8mwQD2gYFolyM5RP818r3HDTu4y5D078
 gMHaYMzGl6RVw==
From: gaulthier.gain@uliege.be
To: minios-devel@lists.xenproject.org
Subject: [UNIKRAFT/LIBMEMCACHED PATCH 3/7] Add Memcached auto-generated header
Date: Mon, 10 Aug 2020 15:33:36 +0000
Message-Id: <20200810153340.47103-4-gaulthier.gain@uliege.be>
X-Mailer: git-send-email 2.17.1
In-Reply-To: <20200810153340.47103-1-gaulthier.gain@uliege.be>
References: <20200810153340.47103-1-gaulthier.gain@uliege.be>
X-BeenThere: minios-devel@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Mini-os development list <minios-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:minios-devel@lists.xenproject.org>
List-Help: <mailto:minios-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=subscribe>
Cc: felipe.huici@neclab.eu, gaulthier gain <gaulthier.gain@uliege.be>
Errors-To: minios-devel-bounces@lists.xenproject.org
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>

From: gaulthier gain <gaulthier.gain@uliege.be>

The `config.h` header is generated when running ./configure and it
contains the features that are available on the build machine. This
is copied from a local build.

Signed-off-by: gaulthier gain <gaulthier.gain@uliege.be>
---
 include/config.h | 165 +++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 165 insertions(+)
 create mode 100644 include/config.h

diff --git a/include/config.h b/include/config.h
new file mode 100644
index 0000000..d3e7aa4
--- /dev/null
+++ b/include/config.h
@@ -0,0 +1,165 @@
+/* config.h.  Generated from config.h.in by configure.  */
+/* config.h.in.  Generated from configure.ac by autoheader.  */
+
+/* Set to nonzero if you want to enable ARMv8 crc32 */
+/* #undef ARM_CRC32 */
+
+/* Set to nonzero if you want to include DTRACE */
+/* #undef ENABLE_DTRACE */
+
+/* Set to nonzero if you want to include SASL */
+/* #undef ENABLE_SASL */
+
+/* Set to nonzero if you want to enable a SASL pwdb */
+/* #undef ENABLE_SASL_PWDB */
+
+/* machine is bigendian */
+/* #undef ENDIAN_BIG */
+
+/* machine is littleendian */
+#define ENDIAN_LITTLE 1
+
+/* Set to nonzero if you want to enable extstore */
+/* #undef EXTSTORE */
+
+/* Define to 1 if support accept4 */
+#define HAVE_ACCEPT4 1
+
+/* Define to 1 if you have the `clock_gettime' function. */
+#define HAVE_CLOCK_GETTIME 1
+
+/* Define this if you have an implementation of drop_privileges() */
+/* #undef HAVE_DROP_PRIVILEGES */
+
+/* Define this if you have an implementation of drop_worker_privileges() */
+/* #undef HAVE_DROP_WORKER_PRIVILEGES */
+
+/* GCC 64bit Atomics available */
+#define HAVE_GCC_64ATOMICS 1
+
+/* GCC Atomics available */
+#define HAVE_GCC_ATOMICS 1
+
+/* Define to 1 if support getopt_long */
+#define HAVE_GETOPT_LONG 1
+
+/* Define to 1 if you have the `getpagesizes' function. */
+#define HAVE_GETPAGESIZES 1
+
+/* Have ntohll */
+/* #undef HAVE_HTONLL */
+
+/* Define to 1 if you have the <inttypes.h> header file. */
+#define HAVE_INTTYPES_H 1
+
+/* Define to 1 if you have the `memcntl' function. */
+/* #undef HAVE_MEMCNTL */
+
+/* Define to 1 if you have the <memory.h> header file. */
+#define HAVE_MEMORY_H 1
+
+/* Define to 1 if you have the `mlockall' function. */
+#define HAVE_MLOCKALL 1
+
+/* Define to 1 if you have the `pledge' function. */
+/* #undef HAVE_PLEDGE */
+
+/* we have sasl_callback_ft */
+/* #undef HAVE_SASL_CALLBACK_FT */
+
+/* Set to nonzero if your SASL implementation supports SASL_CB_GETCONF */
+/* #undef HAVE_SASL_CB_GETCONF */
+
+/* Set to nonzero if your SASL implementation supports SASL_CB_GETCONFPATH */
+/* #undef HAVE_SASL_CB_GETCONFPATH */
+
+/* Define to 1 if you have the <sasl/sasl.h> header file. */
+/* #undef HAVE_SASL_SASL_H */
+
+/* Define to 1 if you have the `setppriv' function. */
+/* #undef HAVE_SETPPRIV */
+
+/* Define to 1 if you have the `sigignore' function. */
+#define HAVE_SIGIGNORE 1
+
+/* Define to 1 if stdbool.h conforms to C99. */
+#define HAVE_STDBOOL_H 1
+
+/* Define to 1 if you have the <stdint.h> header file. */
+#define HAVE_STDINT_H 1
+
+/* Define to 1 if you have the <stdlib.h> header file. */
+#define HAVE_STDLIB_H 1
+
+/* Define to 1 if you have the <strings.h> header file. */
+#define HAVE_STRINGS_H 1
+
+/* Define to 1 if you have the <string.h> header file. */
+#define HAVE_STRING_H 1
+
+/* Define to 1 if you have the <sys/stat.h> header file. */
+#define HAVE_SYS_STAT_H 1
+
+/* Define to 1 if you have the <sys/types.h> header file. */
+#define HAVE_SYS_TYPES_H 1
+
+/* Define this if you have umem.h */
+/* #undef HAVE_UMEM_H */
+
+/* Define to 1 if you have the <unistd.h> header file. */
+#define HAVE_UNISTD_H 1
+
+/* Define to 1 if the system has the type `_Bool'. */
+#define HAVE__BOOL 1
+
+/* Machine need alignment */
+/* #undef NEED_ALIGN */
+
+/* Name of package */
+#define PACKAGE "memcached"
+
+/* Define to the address where bug reports for this package should be sent. */
+#define PACKAGE_BUGREPORT "memcached@googlegroups.com"
+
+/* Define to the full name of this package. */
+#define PACKAGE_NAME "memcached"
+
+/* Define to the full name and version of this package. */
+#define PACKAGE_STRING "memcached 1.5.12"
+
+/* Define to the one symbol short name of this package. */
+#define PACKAGE_TARNAME "memcached"
+
+/* Define to the home page for this package. */
+#define PACKAGE_URL ""
+
+/* Define to the version of this package. */
+#define PACKAGE_VERSION "1.5.12"
+
+/* Define to 1 if you have the ANSI C header files. */
+#define STDC_HEADERS 1
+
+/* Version number of package */
+#define VERSION "1.5.12"
+
+/* find sigignore on Linux */
+#define _GNU_SOURCE 1
+
+/* Define to empty if `const' does not conform to ANSI C. */
+/* #undef const */
+
+/* define to int if socklen_t not available */
+/* #undef socklen_t */
+
+#if HAVE_STDBOOL_H
+#include <stdbool.h>
+#else
+#define bool char
+#define false 0
+#define true 1
+#endif 
+
+#ifdef HAVE_INTTYPES_H
+#include <inttypes.h>
+#endif
+
-- 
2.17.1



From minios-devel-bounces@lists.xenproject.org Mon Aug 10 15:34:00 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Mon, 10 Aug 2020 15:34:00 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1k59oG-0005ER-SG; Mon, 10 Aug 2020 15:34:00 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=gd2F=BU=uliege.be=gaulthier.gain@srs-us1.protection.inumbo.net>)
 id 1k59oF-0005C9-Js
 for minios-devel@lists.xenproject.org; Mon, 10 Aug 2020 15:33:59 +0000
X-Inumbo-ID: 40a83aed-9223-4c83-a4cf-a46f01c1594f
Received: from serv108.segi.ulg.ac.be (unknown [139.165.32.111])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 40a83aed-9223-4c83-a4cf-a46f01c1594f;
 Mon, 10 Aug 2020 15:33:51 +0000 (UTC)
Received: from sauron.run.montefiore.ulg.ac.be
 (sauron.run.montefiore.ulg.ac.be [139.165.223.31])
 (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
 (No client certificate requested)
 by serv108.segi.ulg.ac.be (Postfix) with ESMTPSA id C5D9F200E2DC;
 Mon, 10 Aug 2020 17:33:50 +0200 (CEST)
DKIM-Filter: OpenDKIM Filter v2.11.0 serv108.segi.ulg.ac.be C5D9F200E2DC
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=uliege.be;
 s=ulg20190529; t=1597073630;
 bh=YnzqeEoLbwEy+0tJ5gjupO+IgGzu4O06ZZZV5P5KQV0=;
 h=From:To:Cc:Subject:Date:In-Reply-To:References:From;
 b=Zii0p/a+H7rcRHA3pINSowvH3nataCRiuTMsUmMysXgeqrOhMw3KGfpIXY5cQEKwr
 E+eIO+4xcEdfYN3Y+RB8FPrQQLkB64p2+rLYLxb6MPUCRB5wgRXd9DHKW+qtqhJ896
 b0JsBKy8+VXh3ceAsMSgwcZ4sM4an4S/ltdp5dY8FAQTurBwEmzOxdq8Mi4oQVq1ij
 TzcMQubBdahBd0hysRlzgzYdXmJY3LBpxEzPG77Hsi/ucLtoqOph+KVxuAKx6gx+rE
 JSbMayYOJF/81q8HiYLV8tiYWZmqG11u9l9iVOXV75BFaFWO1iZ0aYGa49voW9FvS4
 8xHyk+PE4vS0Q==
From: gaulthier.gain@uliege.be
To: minios-devel@lists.xenproject.org
Subject: [UNIKRAFT/LIBMEMCACHED PATCH 1/7] Introduce library skeleton
Date: Mon, 10 Aug 2020 15:33:34 +0000
Message-Id: <20200810153340.47103-2-gaulthier.gain@uliege.be>
X-Mailer: git-send-email 2.17.1
In-Reply-To: <20200810153340.47103-1-gaulthier.gain@uliege.be>
References: <20200810153340.47103-1-gaulthier.gain@uliege.be>
X-BeenThere: minios-devel@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Mini-os development list <minios-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:minios-devel@lists.xenproject.org>
List-Help: <mailto:minios-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=subscribe>
Cc: felipe.huici@neclab.eu, gaulthier gain <gaulthier.gain@uliege.be>
Errors-To: minios-devel-bounces@lists.xenproject.org
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>

From: gaulthier gain <gaulthier.gain@uliege.be>

We use the BSD-3-Clause license for this library glue code.

Signed-off-by: gaulthier gain <gaulthier.gain@uliege.be>
---
 .gitignore      | 27 +++++++++++++++++++++++++++
 CODING_STYLE.md |  4 ++++
 CONTRIBUTING.md |  4 ++++
 COPYING.md      | 38 ++++++++++++++++++++++++++++++++++++++
 Config.uk       |  4 ++++
 MAINTAINERS.md  | 11 +++++++++++
 README.md       |  7 +++++++
 7 files changed, 95 insertions(+)
 create mode 100644 .gitignore
 create mode 100644 CODING_STYLE.md
 create mode 100644 CONTRIBUTING.md
 create mode 100644 COPYING.md
 create mode 100644 Config.uk
 create mode 100644 MAINTAINERS.md
 create mode 100644 README.md

diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..75d2fd3
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,27 @@
+*.depend
+*.o
+*.a
+*.d
+*.so
+*.orig
+*.rej
+*.bak
+*.swp
+*~
+,*
+\#*\#
+.\#*
+\#_*\#
+.\#_*
+!.gitignore
+.*
+
+# gnu global files
+GPATH
+GRTAGS
+GSYMS
+GTAGS
+
+# cscope files
+cscope.*
+ncscope.*
diff --git a/CODING_STYLE.md b/CODING_STYLE.md
new file mode 100644
index 0000000..5730041
--- /dev/null
+++ b/CODING_STYLE.md
@@ -0,0 +1,4 @@
+Coding Style
+============
+
+Please refer to the `CODING_STYLE.md` file in the main Unikraft repository.
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
new file mode 100644
index 0000000..14f6ac6
--- /dev/null
+++ b/CONTRIBUTING.md
@@ -0,0 +1,4 @@
+Contributing to Unikraft
+========================
+
+Please refer to the `CONTRIBUTING.md` file in the main Unikraft repository.
diff --git a/COPYING.md b/COPYING.md
new file mode 100644
index 0000000..be33219
--- /dev/null
+++ b/COPYING.md
@@ -0,0 +1,38 @@
+License
+=======
+
+Unikraft Memcached wrappers
+----------------------------------
+
+This repository contains wrapper code to build Memcached with Unikraft.
+Each C code file in this repository should declare who is the
+copyright owner and under which terms and conditions the code is
+licensed. If such a licence note is missing, the following copyright
+notice will apply:
+
+	Copyright (c) Year, Institution. All rights reserved.
+
+	Redistribution and use in source and binary forms, with or without
+	modification, are permitted provided that the following conditions
+	are met:
+
+	1. Redistributions of source code must retain the above copyright
+	   notice, this list of conditions and the following disclaimer.
+	2. Redistributions in binary form must reproduce the above copyright
+	   notice, this list of conditions and the following disclaimer in the
+	   documentation and/or other materials provided with the distribution.
+	3. Neither the name of the copyright holder nor the names of its
+	   contributors may be used to endorse or promote products derived from
+	   this software without specific prior written permission.
+
+	THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+	AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+	IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+	ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+	LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+	CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+	SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+	INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+	CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+	ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+	POSSIBILITY OF SUCH DAMAGE.
diff --git a/Config.uk b/Config.uk
new file mode 100644
index 0000000..1611588
--- /dev/null
+++ b/Config.uk
@@ -0,0 +1,4 @@
+config LIBMEMCACHED
+	bool "libmemcached - Memcached"
+	default y
+        select LIBLIBEVENT
diff --git a/MAINTAINERS.md b/MAINTAINERS.md
new file mode 100644
index 0000000..f92aa0d
--- /dev/null
+++ b/MAINTAINERS.md
@@ -0,0 +1,11 @@
+Maintainers List
+================
+
+For notes on how to read this information, please refer to `MAINTAINERS.md` in
+the main Unikraft repository.
+
+	LIBMEMCACHED-UNIKRAFT
+	M:  Gaulthier Gain <gaulthier.gain@uliege.be>
+	M:  Felipe Huici <felipe.huici@neclab.eu>
+	L:  minios-devel@lists.xen.org
+	F: *
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..2f27f51
--- /dev/null
+++ b/README.md
@@ -0,0 +1,7 @@
+Memcached for Unikraft
+=============================
+
+This is the port of Memcached for Unikraft as external library.
+
+Please refer to the `README.md` as well as the documentation in the
+`doc/` subdirectory of the main unikraft repository.
-- 
2.17.1



From minios-devel-bounces@lists.xenproject.org Mon Aug 10 15:34:04 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Mon, 10 Aug 2020 15:34:04 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1k59oK-0005Ff-Ts; Mon, 10 Aug 2020 15:34:04 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=gd2F=BU=uliege.be=gaulthier.gain@srs-us1.protection.inumbo.net>)
 id 1k59oJ-0005Ch-Pk
 for minios-devel@lists.xenproject.org; Mon, 10 Aug 2020 15:34:03 +0000
X-Inumbo-ID: dbf03af6-8b2e-43bb-b42f-72a38c1bf015
Received: from serv108.segi.ulg.ac.be (unknown [139.165.32.111])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id dbf03af6-8b2e-43bb-b42f-72a38c1bf015;
 Mon, 10 Aug 2020 15:33:55 +0000 (UTC)
Received: from sauron.run.montefiore.ulg.ac.be
 (sauron.run.montefiore.ulg.ac.be [139.165.223.31])
 (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
 (No client certificate requested)
 by serv108.segi.ulg.ac.be (Postfix) with ESMTPSA id C7072200F83B;
 Mon, 10 Aug 2020 17:33:54 +0200 (CEST)
DKIM-Filter: OpenDKIM Filter v2.11.0 serv108.segi.ulg.ac.be C7072200F83B
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=uliege.be;
 s=ulg20190529; t=1597073634;
 bh=R0ei2442va1lJD6Zh2zvgIru+xJs+8Iz5Ej/cjZVLSI=;
 h=From:To:Cc:Subject:Date:In-Reply-To:References:From;
 b=rBiBeUV91CLrs2b0TWcXeTh/AI6bpgTLtT4b9zaBH29P4Rd3O2DPkIQrmCRdrIQd1
 fRNnbj6Yi32bGpGS40oq66jm1dMEcDUGaO4Q7xN9DI2PXYeXTW9PsYEoM1vmjIvXM7
 UFqJKmc5/TajflvxTY3Qr+2zBbEzVSB/HJHESXx7Ib+m31gFEY4RBUrD+lqr+uOA98
 xiMVtzxPZUnFL2U1J7cgN5oE14E2Fl2eMc3bGb3QuorgKEB/cY8Wl6ImP28xxv/o1o
 zcxH5LqAlKxQwvPkMy0PhitH6NMclUfFxHD+OVXWwbY0b2bLgTtMFD5LrxaF9hIiPa
 6blw5gLzpE9/w==
From: gaulthier.gain@uliege.be
To: minios-devel@lists.xenproject.org
Subject: [UNIKRAFT/LIBMEMCACHED PATCH 6/7] Add patches folder
Date: Mon, 10 Aug 2020 15:33:39 +0000
Message-Id: <20200810153340.47103-7-gaulthier.gain@uliege.be>
X-Mailer: git-send-email 2.17.1
In-Reply-To: <20200810153340.47103-1-gaulthier.gain@uliege.be>
References: <20200810153340.47103-1-gaulthier.gain@uliege.be>
X-BeenThere: minios-devel@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Mini-os development list <minios-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:minios-devel@lists.xenproject.org>
List-Help: <mailto:minios-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=subscribe>
Cc: felipe.huici@neclab.eu, gaulthier gain <gaulthier.gain@uliege.be>
Errors-To: minios-devel-bounces@lists.xenproject.org
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>

From: gaulthier gain <gaulthier.gain@uliege.be>

The first patch fixes an internal declaration with `trace.h` to avoid
conflicts with unikraft. The second removes the daemonize mode. The
third one renames the `stats_init` function to avoid conflicts.
Finally, the last patch removes the root user mode.

Signed-off-by: gaulthier gain <gaulthier.gain@uliege.be>
---
 patches/0001-fix-trace-conflict.patch         | 43 +++++++++
 ...d-to-avoid-conflicts-with-stats_init.patch | 44 +++++++++
 patches/0003-remove-daemonize-mode.patch      | 92 +++++++++++++++++++
 patches/0004-remove-root-user-check.patch     | 47 ++++++++++
 4 files changed, 226 insertions(+)
 create mode 100644 patches/0001-fix-trace-conflict.patch
 create mode 100644 patches/0002-update-memcached-to-avoid-conflicts-with-stats_init.patch
 create mode 100644 patches/0003-remove-daemonize-mode.patch
 create mode 100644 patches/0004-remove-root-user-check.patch

diff --git a/patches/0001-fix-trace-conflict.patch b/patches/0001-fix-trace-conflict.patch
new file mode 100644
index 0000000..1a25194
--- /dev/null
+++ b/patches/0001-fix-trace-conflict.patch
@@ -0,0 +1,43 @@
+From e22039da0cfc9ebd10b3483c1a5aa6224c390f88 Mon Sep 17 00:00:00 2001
+From: Gaulthier Gain <gaulthier.gain@uliege.be>
+Date: Tue, 20 Aug 2019 11:07:41 +0200
+Subject: [PATCH] Rename trace.h to avoid conflicts with unikraft
+
+Signed-off-by: Gaulthier Gain <gaulthier.gain@uliege.be>
+---
+ memcached.h                 | 2 +-
+ trace.h => memcachedtrace.h | 4 ++--
+ 2 files changed, 3 insertions(+), 3 deletions(-)
+ rename trace.h => memcachedtrace.h (98%)
+
+diff --git a/memcached.h b/memcached.h
+index a8dd59d..9258ed4 100644
+--- a/memcached.h
++++ b/memcached.h
+@@ -728,7 +728,7 @@ extern int daemonize(int nochdir, int noclose);
+ #include "assoc.h"
+ #include "items.h"
+ #include "crawler.h"
+-#include "trace.h"
++#include "memcachedtrace.h"
+ #include "hash.h"
+ #include "util.h"
+ 
+diff --git a/trace.h b/memcachedtrace.h
+similarity index 98%
+rename from trace.h
+rename to memcachedtrace.h
+index 94e585d..a2c422d 100644
+--- a/trace.h
++++ b/memcachedtrace.h
+@@ -1,5 +1,5 @@
+-#ifndef TRACE_H
+-#define TRACE_H
++#ifndef MEMCACHEDTRACE_H
++#define MEMCACHEDTRACE_H
+ 
+ #ifdef ENABLE_DTRACE
+ #include "memcached_dtrace.h"
+-- 
+2.11.0
+
diff --git a/patches/0002-update-memcached-to-avoid-conflicts-with-stats_init.patch b/patches/0002-update-memcached-to-avoid-conflicts-with-stats_init.patch
new file mode 100644
index 0000000..5af2976
--- /dev/null
+++ b/patches/0002-update-memcached-to-avoid-conflicts-with-stats_init.patch
@@ -0,0 +1,44 @@
+From 1e59864136b472d4f31757b420f374c1bb8acf83 Mon Sep 17 00:00:00 2001
+From: gaulthier gain <gaulthier.gain@uliege.be>
+Date: Mon, 10 Aug 2020 12:59:19 +0000
+Subject: [PATCH] Update memcached.c to avoid conflicts with stats_init
+
+Signed-off-by: gaulthier gain <gaulthier.gain@uliege.be>
+---
+ memcached.c | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/memcached.c b/memcached.c
+index 884469c..224016a 100644
+--- a/memcached.c
++++ b/memcached.c
+@@ -105,7 +105,7 @@ static void conn_set_state(conn *c, enum conn_states state);
+ static int start_conn_timeout_thread();
+ 
+ /* stats */
+-static void stats_init(void);
++static void stats_init_memcached(void);
+ static void server_stats(ADD_STAT add_stats, conn *c);
+ static void process_stat_settings(ADD_STAT add_stats, void *c);
+ static void conn_to_str(const conn *c, char *addr, char *svr_addr);
+@@ -232,7 +232,7 @@ static rel_time_t realtime(const time_t exptime) {
+     }
+ }
+ 
+-static void stats_init(void) {
++static void stats_init_memcached(void) {
+     memset(&stats, 0, sizeof(struct stats));
+     memset(&stats_state, 0, sizeof(struct stats_state));
+     stats_state.accepting_conns = true; /* assuming we start in this state. */
+@@ -8554,7 +8554,7 @@ int main (int argc, char **argv) {
+ 
+     /* initialize other stuff */
+     logger_init();
+-    stats_init();
++    stats_init_memcached();
+     conn_init();
+     bool reuse_mem = false;
+     void *mem_base = NULL;
+-- 
+2.17.1
+
diff --git a/patches/0003-remove-daemonize-mode.patch b/patches/0003-remove-daemonize-mode.patch
new file mode 100644
index 0000000..1cdceb2
--- /dev/null
+++ b/patches/0003-remove-daemonize-mode.patch
@@ -0,0 +1,92 @@
+From 102035fe58ebfc77f1c3ff8415304f11059734fc Mon Sep 17 00:00:00 2001
+From: gaulthier gain <gaulthier.gain@uliege.be>
+Date: Mon, 10 Aug 2020 13:05:05 +0000
+Subject: [PATCH] Remove daemonize mode
+
+This patch temporary removes the daemonize mode of memcached which is
+based on `fork()`. Since this primitive is not yet supported in
+Unikraft, we disable it.
+
+Signed-off-by: gaulthier gain <gaulthier.gain@uliege.be>
+---
+ memcached.c | 22 ----------------------
+ 1 file changed, 22 deletions(-)
+
+diff --git a/memcached.c b/memcached.c
+index 224016a..5368542 100644
+--- a/memcached.c
++++ b/memcached.c
+@@ -6595,7 +6595,6 @@ static void usage(void) {
+            "                          if TLS/SSL is enabled, 'notls' prefix can be used to\n"
+            "                          disable for specific listeners (-l notls:<ip>:<port>) \n"
+ #endif
+-           "-d, --daemon              run as a daemon\n"
+            "-r, --enable-coredumps    maximize core file limit\n"
+            "-u, --user=<user>         assume identity of <username> (only when run as root)\n"
+            "-m, --memory-limit=<num>  item memory in megabytes (default: 64 MB)\n"
+@@ -7281,7 +7280,6 @@ static int _mc_meta_load_cb(const char *tag, void *ctx, void *data) {
+ int main (int argc, char **argv) {
+     int c;
+     bool lock_memory = false;
+-    bool do_daemonize = false;
+     bool preallocate = false;
+     int maxcore = 0;
+     char *username = NULL;
+@@ -7501,7 +7499,6 @@ int main (int argc, char **argv) {
+           "hiV" /* help, licence info, version */
+           "r"   /* maximize core file limit */
+           "v"   /* verbose */
+-          "d"   /* daemon mode */
+           "l:"  /* interface to listen on */
+           "u:"  /* user identity to run as */
+           "P:"  /* save PID in file */
+@@ -7541,7 +7538,6 @@ int main (int argc, char **argv) {
+         {"version", no_argument, 0, 'V'},
+         {"enable-coredumps", no_argument, 0, 'r'},
+         {"verbose", optional_argument, 0, 'v'},
+-        {"daemon", no_argument, 0, 'd'},
+         {"listen", required_argument, 0, 'l'},
+         {"user", required_argument, 0, 'u'},
+         {"pidfile", required_argument, 0, 'P'},
+@@ -7643,9 +7639,6 @@ int main (int argc, char **argv) {
+                 settings.inter= strdup(optarg);
+             }
+             break;
+-        case 'd':
+-            do_daemonize = true;
+-            break;
+         case 'r':
+             maxcore = 1;
+             break;
+@@ -8488,18 +8481,6 @@ int main (int argc, char **argv) {
+         init_sasl();
+     }
+ 
+-    /* daemonize if requested */
+-    /* if we want to ensure our ability to dump core, don't chdir to / */
+-    if (do_daemonize) {
+-        if (sigignore(SIGHUP) == -1) {
+-            perror("Failed to ignore SIGHUP");
+-        }
+-        if (daemonize(maxcore, settings.verbose) == -1) {
+-            fprintf(stderr, "failed to daemon() in order to daemonize\n");
+-            exit(EXIT_FAILURE);
+-        }
+-    }
+-
+     /* lock paged memory if needed */
+     if (lock_memory) {
+ #ifdef HAVE_MLOCKALL
+@@ -8811,9 +8792,6 @@ int main (int argc, char **argv) {
+         restart_mmap_close();
+     }
+ 
+-    /* remove the PID file if we're a daemon */
+-    if (do_daemonize)
+-        remove_pidfile(pid_file);
+     /* Clean up strdup() call for bind() address */
+     if (settings.inter)
+       free(settings.inter);
+-- 
+2.17.1
+
diff --git a/patches/0004-remove-root-user-check.patch b/patches/0004-remove-root-user-check.patch
new file mode 100644
index 0000000..c5ff784
--- /dev/null
+++ b/patches/0004-remove-root-user-check.patch
@@ -0,0 +1,47 @@
+From ecacaab5b500780eb99d8f58e57b0688f6d3119e Mon Sep 17 00:00:00 2001
+From: gaulthier gain <gaulthier.gain@uliege.be>
+Date: Mon, 10 Aug 2020 13:39:28 +0000
+Subject: [PATCH] Remove root user check
+
+Since unikraft does not support multi-user support, this patch
+removes this feature.
+
+Signed-off-by: gaulthier gain <gaulthier.gain@uliege.be>
+---
+ memcached.c | 20 --------------------
+ 1 file changed, 20 deletions(-)
+
+diff --git a/memcached.c b/memcached.c
+index 884469c..63590c6 100644
+--- a/memcached.c
++++ b/memcached.c
+@@ -8463,26 +8463,6 @@ int main (int argc, char **argv) {
+         }
+     }
+ 
+-    /* lose root privileges if we have them */
+-    if (getuid() == 0 || geteuid() == 0) {
+-        if (username == 0 || *username == '\0') {
+-            fprintf(stderr, "can't run as root without the -u switch\n");
+-            exit(EX_USAGE);
+-        }
+-        if ((pw = getpwnam(username)) == 0) {
+-            fprintf(stderr, "can't find the user %s to switch to\n", username);
+-            exit(EX_NOUSER);
+-        }
+-        if (setgroups(0, NULL) < 0) {
+-            fprintf(stderr, "failed to drop supplementary groups\n");
+-            exit(EX_OSERR);
+-        }
+-        if (setgid(pw->pw_gid) < 0 || setuid(pw->pw_uid) < 0) {
+-            fprintf(stderr, "failed to assume identity of user %s\n", username);
+-            exit(EX_OSERR);
+-        }
+-    }
+-
+     /* Initialize Sasl if -S was specified */
+     if (settings.sasl) {
+         init_sasl();
+-- 
+2.17.1
+
-- 
2.17.1



From minios-devel-bounces@lists.xenproject.org Mon Aug 10 15:34:06 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Mon, 10 Aug 2020 15:34:06 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1k59oM-0005GH-0C; Mon, 10 Aug 2020 15:34:06 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=gd2F=BU=uliege.be=gaulthier.gain@srs-us1.protection.inumbo.net>)
 id 1k59oK-0005C9-K0
 for minios-devel@lists.xenproject.org; Mon, 10 Aug 2020 15:34:04 +0000
X-Inumbo-ID: 3af4f5fd-9ad6-4ed6-ad7b-d5415fe1983a
Received: from serv108.segi.ulg.ac.be (unknown [139.165.32.111])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 3af4f5fd-9ad6-4ed6-ad7b-d5415fe1983a;
 Mon, 10 Aug 2020 15:33:54 +0000 (UTC)
Received: from sauron.run.montefiore.ulg.ac.be
 (sauron.run.montefiore.ulg.ac.be [139.165.223.31])
 (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
 (No client certificate requested)
 by serv108.segi.ulg.ac.be (Postfix) with ESMTPSA id 606CB200EED2;
 Mon, 10 Aug 2020 17:33:53 +0200 (CEST)
DKIM-Filter: OpenDKIM Filter v2.11.0 serv108.segi.ulg.ac.be 606CB200EED2
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=uliege.be;
 s=ulg20190529; t=1597073633;
 bh=fB2xuKD7d8QUILQGHF5Z+WBq7W/hTDK4RH1t15lY2xw=;
 h=From:To:Cc:Subject:Date:In-Reply-To:References:From;
 b=H34e5hwCEmiqADvvsmu89xZEoz9hss72d3TQwrV8DNjBxryaM/XavKTBF5C8fv44P
 XdtyFt6tBPVzkNSNpLFjZOXasYYqXefYNijVflOaA6vhi9Crl4NI1jGKNi4+w0e4xm
 CQ+tr5eu1/xgkghJQs8HiLIU31pAuzO5Tsng8xTAMn+QLYNSrWJz7bAdh4+7UTPbo8
 TWU5Wfwp8n3lY0ecZKOaTvi3jZeKVlLML76nU+fh0RHbUr+1wfkGIxu7uge9EESxlB
 0nQzeHci4ZWAP8jmW+rP1/TGS0Be0utpH5iCxAWrqc9Q8JcQ7lE7drJeb7ZhZfyZRb
 O78Dp91xsROZA==
From: gaulthier.gain@uliege.be
To: minios-devel@lists.xenproject.org
Subject: [UNIKRAFT/LIBMEMCACHED PATCH 4/7] include/config.h: Disable features
 that are not available on Unikraft
Date: Mon, 10 Aug 2020 15:33:37 +0000
Message-Id: <20200810153340.47103-5-gaulthier.gain@uliege.be>
X-Mailer: git-send-email 2.17.1
In-Reply-To: <20200810153340.47103-1-gaulthier.gain@uliege.be>
References: <20200810153340.47103-1-gaulthier.gain@uliege.be>
X-BeenThere: minios-devel@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Mini-os development list <minios-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:minios-devel@lists.xenproject.org>
List-Help: <mailto:minios-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=subscribe>
Cc: felipe.huici@neclab.eu, gaulthier gain <gaulthier.gain@uliege.be>
Errors-To: minios-devel-bounces@lists.xenproject.org
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>

From: gaulthier gain <gaulthier.gain@uliege.be>

Some of these features have to enabled back when we will support them.

Signed-off-by: gaulthier gain <gaulthier.gain@uliege.be>
---
 include/config.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/include/config.h b/include/config.h
index d3e7aa4..f5eb3bd 100644
--- a/include/config.h
+++ b/include/config.h
@@ -23,7 +23,7 @@
 /* #undef EXTSTORE */
 
 /* Define to 1 if support accept4 */
-#define HAVE_ACCEPT4 1
+/* #undef HAVE_ACCEPT4 */
 
 /* Define to 1 if you have the `clock_gettime' function. */
 #define HAVE_CLOCK_GETTIME 1
@@ -59,7 +59,7 @@
 #define HAVE_MEMORY_H 1
 
 /* Define to 1 if you have the `mlockall' function. */
-#define HAVE_MLOCKALL 1
+/* #undef HAVE_MLOCKALL */
 
 /* Define to 1 if you have the `pledge' function. */
 /* #undef HAVE_PLEDGE */
@@ -80,7 +80,7 @@
 /* #undef HAVE_SETPPRIV */
 
 /* Define to 1 if you have the `sigignore' function. */
-#define HAVE_SIGIGNORE 1
+/* #undef HAVE_SIGIGNORE */
 
 /* Define to 1 if stdbool.h conforms to C99. */
 #define HAVE_STDBOOL_H 1
-- 
2.17.1



From minios-devel-bounces@lists.xenproject.org Mon Aug 10 15:34:09 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Mon, 10 Aug 2020 15:34:09 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1k59oP-0005HR-1p; Mon, 10 Aug 2020 15:34:09 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=gd2F=BU=uliege.be=gaulthier.gain@srs-us1.protection.inumbo.net>)
 id 1k59oO-0005Ch-Pu
 for minios-devel@lists.xenproject.org; Mon, 10 Aug 2020 15:34:08 +0000
X-Inumbo-ID: 44720105-a1e7-4574-8ac2-56fcf8c41dd4
Received: from serv108.segi.ulg.ac.be (unknown [139.165.32.111])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 44720105-a1e7-4574-8ac2-56fcf8c41dd4;
 Mon, 10 Aug 2020 15:33:56 +0000 (UTC)
Received: from sauron.run.montefiore.ulg.ac.be
 (sauron.run.montefiore.ulg.ac.be [139.165.223.31])
 (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
 (No client certificate requested)
 by serv108.segi.ulg.ac.be (Postfix) with ESMTPSA id 87C92200F833;
 Mon, 10 Aug 2020 17:33:55 +0200 (CEST)
DKIM-Filter: OpenDKIM Filter v2.11.0 serv108.segi.ulg.ac.be 87C92200F833
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=uliege.be;
 s=ulg20190529; t=1597073635;
 bh=LZ3383548+sNL4RfeBCqSsRAtD2iXySJDY9oWZoqlFM=;
 h=From:To:Cc:Subject:Date:In-Reply-To:References:From;
 b=APc0uciRGksLXUoU7Le0qk1+ckcivCOzfqInQ0NVR7XzNIVcDT1SSTD8b88BNipQc
 d+Tc1TLM90JSRer8AXC3JGObZ892nGMC+Dr2hznmI44kVG7qhyU8ggKUen+t2h6v8N
 CpS3EgTOWo4Hj8QfIN0Z98D0P7L7u0ACxyYTjExlVYLBpUN941nOZD20uUeP/z9UC8
 WdPwKVIRZL3RaKTRdehjvwt439SlkuWhCb9jfdEFyZcwUUaASBE1DOTSDI+StoJkqp
 9rdmBx+jth8PGbExEWCzFpPZc9CaogBq1lmqLuKiWiQrtZCLI3SWGVpbn30PgXemfv
 YuCWs4G6iWY8g==
From: gaulthier.gain@uliege.be
To: minios-devel@lists.xenproject.org
Subject: [UNIKRAFT/LIBMEMCACHED PATCH 7/7] README.md: Update with info about
 building and running
Date: Mon, 10 Aug 2020 15:33:40 +0000
Message-Id: <20200810153340.47103-8-gaulthier.gain@uliege.be>
X-Mailer: git-send-email 2.17.1
In-Reply-To: <20200810153340.47103-1-gaulthier.gain@uliege.be>
References: <20200810153340.47103-1-gaulthier.gain@uliege.be>
X-BeenThere: minios-devel@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Mini-os development list <minios-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:minios-devel@lists.xenproject.org>
List-Help: <mailto:minios-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=subscribe>
Cc: felipe.huici@neclab.eu, gaulthier gain <gaulthier.gain@uliege.be>
Errors-To: minios-devel-bounces@lists.xenproject.org
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>

From: gaulthier gain <gaulthier.gain@uliege.be>

Signed-off-by: gaulthier gain <gaulthier.gain@uliege.be>
---
 README.md | 24 +++++++++++++++++++++---
 1 file changed, 21 insertions(+), 3 deletions(-)

diff --git a/README.md b/README.md
index 2f27f51..c26514b 100644
--- a/README.md
+++ b/README.md
@@ -1,7 +1,25 @@
-Memcached for Unikraft
-=============================
-
+# Memcached for Unikraft
 This is the port of Memcached for Unikraft as external library.
 
+## Build
+Memcached depends on the following libraries, that need to be added to
+`Makefile` in this order:
+
+* `pthreads`, e.g. `pthread-embedded`
+* `libc`, e.g. `newlib`
+* `libevent`
+
+Before you proceed to writing your own application, you can use the
+`main()` function provided in the Memcached glue code by enabling it in
+its configuration menu.
+
+## Root filesystem
+
+To import/export data from/to files, it is necessary to have a
+filesystem. The steps for creating and using a filesystem are the
+same as the ones used for
+[nginx](https://github.com/unikraft/lib-nginx/blob/staging/README.md).
+
+## Further information
 Please refer to the `README.md` as well as the documentation in the
 `doc/` subdirectory of the main unikraft repository.
-- 
2.17.1



From minios-devel-bounces@lists.xenproject.org Mon Aug 10 15:34:10 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Mon, 10 Aug 2020 15:34:10 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1k59oQ-0005I6-3T; Mon, 10 Aug 2020 15:34:10 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=gd2F=BU=uliege.be=gaulthier.gain@srs-us1.protection.inumbo.net>)
 id 1k59oP-0005C9-K4
 for minios-devel@lists.xenproject.org; Mon, 10 Aug 2020 15:34:09 +0000
X-Inumbo-ID: fa36f7a3-fe11-44b7-b164-fc847ae843cd
Received: from serv108.segi.ulg.ac.be (unknown [139.165.32.111])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id fa36f7a3-fe11-44b7-b164-fc847ae843cd;
 Mon, 10 Aug 2020 15:33:54 +0000 (UTC)
Received: from sauron.run.montefiore.ulg.ac.be
 (sauron.run.montefiore.ulg.ac.be [139.165.223.31])
 (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
 (No client certificate requested)
 by serv108.segi.ulg.ac.be (Postfix) with ESMTPSA id 144ED200F833;
 Mon, 10 Aug 2020 17:33:54 +0200 (CEST)
DKIM-Filter: OpenDKIM Filter v2.11.0 serv108.segi.ulg.ac.be 144ED200F833
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=uliege.be;
 s=ulg20190529; t=1597073634;
 bh=CVOcTa3bB/zHwLa/db0b6ulgeicxFbbeM8uJYEyGPus=;
 h=From:To:Cc:Subject:Date:In-Reply-To:References:From;
 b=sEeRlPtN2I9a9Rdpt6UiAJgk2j+56Hlg+T9M7LmLTb6yNJXjlnHRGKledJ+1T/BvD
 0Lfs7P9mUTo40dkh8UXATZgoyxAtTo1aoEVQ/UeyqkjuLV7VofFCZxamBMvlrA4A21
 Q45iccC6VqFDxg5Qwpst1VbyxMx1uyCskZZ4NEKuHnzhObfdTaElS1BMpUk2Lc3Hv1
 KfepScYIBq/j8bCJfSp767u/qLvcv5DdWK90+sNwlljOaw30B6/0Sn/yYxeJPoXSfk
 fgvwjDitvs9GhirbrRB74YaeVK5tISya/mI3AFCTFLMVZM4zWSLzPHL91p3pvoC8b9
 cXlfQzitXzJmg==
From: gaulthier.gain@uliege.be
To: minios-devel@lists.xenproject.org
Subject: [UNIKRAFT/LIBMEMCACHED PATCH 5/7] Provide main() function if
 configured to do so
Date: Mon, 10 Aug 2020 15:33:38 +0000
Message-Id: <20200810153340.47103-6-gaulthier.gain@uliege.be>
X-Mailer: git-send-email 2.17.1
In-Reply-To: <20200810153340.47103-1-gaulthier.gain@uliege.be>
References: <20200810153340.47103-1-gaulthier.gain@uliege.be>
X-BeenThere: minios-devel@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Mini-os development list <minios-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:minios-devel@lists.xenproject.org>
List-Help: <mailto:minios-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=subscribe>
Cc: felipe.huici@neclab.eu, gaulthier gain <gaulthier.gain@uliege.be>
Errors-To: minios-devel-bounces@lists.xenproject.org
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>

From: gaulthier gain <gaulthier.gain@uliege.be>

We add a config option for enabling the main() function provided by
our Memcached glue code.

Signed-off-by: gaulthier gain <gaulthier.gain@uliege.be>
---
 Config.uk   | 9 ++++++++-
 Makefile.uk | 8 ++++++++
 main.c      | 8 ++++++++
 3 files changed, 24 insertions(+), 1 deletion(-)
 create mode 100644 main.c

diff --git a/Config.uk b/Config.uk
index 1611588..9c5d57a 100644
--- a/Config.uk
+++ b/Config.uk
@@ -1,4 +1,11 @@
-config LIBMEMCACHED
+menuconfig LIBMEMCACHED
 	bool "libmemcached - Memcached"
 	default y
         select LIBLIBEVENT
+
+if LIBMEMCACHED
+config LIBMEMCACHED_MAIN_FUNCTION
+        bool "Provide main function"
+        default n
+endif
+	
diff --git a/Makefile.uk b/Makefile.uk
index 2e07f4e..636435f 100644
--- a/Makefile.uk
+++ b/Makefile.uk
@@ -74,9 +74,17 @@ LIBMEMCACHED_SUPPRESS_FLAGS-$(call gcc_version_ge,7,0) +=-Wimplicit-fallthrough=
 LIBMEMCACHED_CFLAGS-y += $(LIBMEMCACHED_FLAGS)
 LIBMEMCACHED_CFLAGS-y += $(LIBMEMCACHED_SUPPRESS_FLAGS-y)
 
+################################################################################
+# Glue code
+################################################################################
+LIBMEMCACHED_SRCS-$(CONFIG_LIBMEMCACHED_MAIN_FUNCTION) += $(LIBMEMCACHED_BASE)/main.c|unikraft
+
 ################################################################################
 # Memcached sources
 ################################################################################
+# Rename the main function found in memcached.c to memcached_main
+LIBMEMCACHED_MEMCACHED_FLAGS-y += -Dmain=memcached_main
+
 LIBMEMCACHED_SRCS-y += $(LIBMEMCACHED)/assoc.c
 LIBMEMCACHED_SRCS-y += $(LIBMEMCACHED)/authfile.c
 LIBMEMCACHED_SRCS-y += $(LIBMEMCACHED)/bipbuffer.c
diff --git a/main.c b/main.c
new file mode 100644
index 0000000..6a2b1f4
--- /dev/null
+++ b/main.c
@@ -0,0 +1,8 @@
+#include <stdio.h>
+extern int memcached_main(int argc, char *argv[]);
+
+int main(int argc, char *argv[])
+{
+    printf("HeyHey\n");
+    return memcached_main(argc, argv);
+}
-- 
2.17.1



From minios-devel-bounces@lists.xenproject.org Tue Aug 11 08:16:26 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Tue, 11 Aug 2020 08:16:26 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1k5PSI-0005bF-Ut; Tue, 11 Aug 2020 08:16:22 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=nA/H=BV=uliege.be=gaulthier.gain@srs-us1.protection.inumbo.net>)
 id 1k5PSI-0005bA-0e
 for minios-devel@lists.xen.org; Tue, 11 Aug 2020 08:16:22 +0000
X-Inumbo-ID: 60abe282-8dda-4e41-9a6e-8ba111677121
Received: from serv108.segi.ulg.ac.be (unknown [139.165.32.111])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 60abe282-8dda-4e41-9a6e-8ba111677121;
 Tue, 11 Aug 2020 08:16:05 +0000 (UTC)
Received: from gaulthiers-mbp.lan (151.169-240-81.adsl-dyn.isp.belgacom.be
 [81.240.169.151])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
 (No client certificate requested)
 by serv108.segi.ulg.ac.be (Postfix) with ESMTPSA id 0EFE72010375;
 Tue, 11 Aug 2020 10:16:04 +0200 (CEST)
DKIM-Filter: OpenDKIM Filter v2.11.0 serv108.segi.ulg.ac.be 0EFE72010375
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=uliege.be;
 s=ulg20190529; t=1597133764;
 bh=ERY09k9ioxBQ+g38Dbi1NZger/nDjZCKG9/lFS+SWYE=;
 h=Subject:From:In-Reply-To:Date:Cc:References:To:From;
 b=StK8JvtyjAZqwmsHjHnLE3fLgAGDVg/3BPuzZCMRjtgmATnWGP1EVQ5UsCjGlSKI8
 k/AdoZZnWDHy25XsjHf6Qt0yhsJZ4Q3yTYxdoVP+RSDu+ntBsCVU5aWjTgkOBh78VU
 98S5SwikPpQQW3rChl187tMYmZWIq2TnQJhZ98K0ek2Eo1jftUit5YrXCeVGOUW2bV
 EHXosibP+VHoCQF4zT75WvcHOtZbtavj465Me5bZHIhwhwDcTl9zz4CUFYtlxwVMpT
 NeyBo3BXevCs2qUDf71RweXYbAr7Rr00WzFh+x/nkKHMVOth1nGFC9Tv+1q+y9hKIA
 hUoOB/h0xBK1g==
Content-Type: text/plain;
	charset=utf-8
Mime-Version: 1.0 (Mac OS X Mail 13.0 \(3608.60.0.2.5\))
Subject: Re: [UNIKRAFT/MUSL PATCH 1/3] Makefile.*, Config.uk: Sub-componentize
 MUSL
From: Gaulthier Gain <Gaulthier.Gain@uliege.be>
In-Reply-To: <20200714125930.91234-11-a.jung@lancs.ac.uk>
Date: Tue, 11 Aug 2020 10:16:03 +0200
Content-Transfer-Encoding: quoted-printable
Message-Id: <3FBCE523-7468-43E4-B225-6E20B2EC475D@uliege.be>
References: <20200714125930.91234-1-a.jung@lancs.ac.uk>
 <20200714125930.91234-11-a.jung@lancs.ac.uk>
To: Alexander Jung <a.jung@lancs.ac.uk>
X-Mailer: Apple Mail (2.3608.60.0.2.5)
X-BeenThere: minios-devel@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Mini-os development list <minios-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:minios-devel@lists.xenproject.org>
List-Help: <mailto:minios-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=subscribe>
Cc: Felipe Huici <felipe.huici@neclab.eu>,
 Simon Kuenzer <simon.kuenzer@neclab.eu>,
 Alexander Jung <alexander.jung@neclab.eu>, minios-devel@lists.xen.org,
 Sharan Santhanam <sharan.santhanam@neclab.eu>
Errors-To: minios-devel-bounces@lists.xenproject.org
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>

Hi Alex,=20

Thanks a lot for this great work. Unfortunately, I cannot apply this =
patch on a clean staging branch (6ec7541bd). I got the following error: =
"corrupt patch at line 4949=E2=80=9D. Did you generate it from the =
staging branch?

Gaulthier

> On 14 Jul 2020, at 14:59, Alexander Jung <a.jung@lancs.ac.uk> wrote:
>=20
> From: Alexander Jung <alexander.jung@neclab.eu>
>=20
> This commit introduces the ability to select paticular
> subcomponents within the MUSL standard library framework through
> Unikraft's KConfig system.  In order to achieve distinction
> between libraries, additional rules were created to copy the
> necessary headers from the subcomponents into the microlibrary's
> build directory.  This is achieved by adding to an appropriate
> subcomponent list of headers (standarized via `*_HDRS-y`) and
> then calling a subcomponent registration macro
> `_libmusl_import_lib`.
>=20
> Signed-off-by: Alexander Jung <alexander.jung@neclab.eu>
> ---
> Config.uk                  | 211 ++++++++-
> Makefile.rules             |  31 ++
> Makefile.uk                | 123 ++++-
> Makefile.uk.musl.aio       |  22 +-
> Makefile.uk.musl.complex   | 142 +++---
> Makefile.uk.musl.conf      |  22 +-
> Makefile.uk.musl.crypt     |  27 +-
> Makefile.uk.musl.ctype     |  90 ++--
> Makefile.uk.musl.dirent    |  42 +-
> Makefile.uk.musl.env       |  38 +-
> Makefile.uk.musl.errno     |  13 +-
> Makefile.uk.musl.exit      |  27 +-
> Makefile.uk.musl.fcntl     |  20 +-
> Makefile.uk.musl.fenv      |  55 ++-
> Makefile.uk.musl.internal  |  66 ++-
> Makefile.uk.musl.ipc       |  41 +-
> Makefile.uk.musl.ldso      |  68 +--
> Makefile.uk.musl.legacy    |  56 ++-
> Makefile.uk.musl.linux     | 152 +++---
> Makefile.uk.musl.locale    |  82 +++-
> Makefile.uk.musl.malloc    |  32 +-
> Makefile.uk.musl.math      | 926 +++++++++++++++++++------------------
> Makefile.uk.musl.misc      | 117 +++--
> Makefile.uk.musl.mman      |  49 +-
> Makefile.uk.musl.mq        |  32 +-
> Makefile.uk.musl.multibyte |  51 +-
> Makefile.uk.musl.network   | 192 +++++---
> Makefile.uk.musl.passwd    |  60 ++-
> Makefile.uk.musl.prng      |  30 +-
> Makefile.uk.musl.process   |  90 ++--
> Makefile.uk.musl.regex     |  34 +-
> Makefile.uk.musl.sched     |  29 +-
> Makefile.uk.musl.search    |  17 +-
> Makefile.uk.musl.select    |  17 +-
> Makefile.uk.musl.setjmp    |  62 +--
> Makefile.uk.musl.signal    | 155 ++++---
> Makefile.uk.musl.stat      |  51 +-
> Makefile.uk.musl.stdio     | 266 ++++++-----
> Makefile.uk.musl.stdlib    |  60 ++-
> Makefile.uk.musl.string    | 189 ++++----
> Makefile.uk.musl.temp      |  26 +-
> Makefile.uk.musl.termios   |  28 +-
> Makefile.uk.musl.thread    | 412 +++++++++--------
> Makefile.uk.musl.time      | 117 +++--
> Makefile.uk.musl.unistd    | 189 ++++----
> 45 files changed, 2815 insertions(+), 1744 deletions(-)
> create mode 100644 Makefile.rules
>=20
> diff --git a/Config.uk b/Config.uk
> index 7862da8..9d4a15a 100644
> --- a/Config.uk
> +++ b/Config.uk
> @@ -1,9 +1,206 @@
> # hidden
> menuconfig LIBMUSL
> -        bool "musl - A C standard library"
> -        default n
> -        select HAVE_LIBC
> -        select LIBKUALLOC
> -        select LIBSYSCALL_SHIM
> -        select LIBVFSCORE
> -        select LIBPOSIX_PROCESS
> +  bool "musl: A C standard library"
> +  default n
> +  select HAVE_LIBC
> +  select LIBKUALLOC
> +  select LIBSYSCALL_SHIM
> +  select LIBVFSCORE
> +  select LIBPOSIX_PROCESS
> +
> +  select LIBMUSL_STAT
> +  select LIBMUSL_DIRENT
> +  select LIBMUSL_TERMIOS
> +  select LIBMUSL_LOCALE
> +  select LIBMUSL_ERRNO
> +  select LIBMUSL_INTERNAL
> +  select LIBMUSL_STRING
> +  select LIBMUSL_CTYPE
> +  select LIBMUSL_STDLIB
> +  select LIBMUSL_ENV
> +
> +if LIBMUSL
> +
> +config LIBMUSL_AIO
> +  bool "libaio"
> +  default y
> +
> +config LIBMUSL_COMPLEX
> +  bool "libcomplex"
> +  default y
> +
> +config LIBMUSL_CONF
> +  bool "libconf"
> +  default y
> +
> +config LIBMUSL_CRYPT
> +  bool "libcrypt"
> +  default y
> +
> +config LIBMUSL_CTYPE
> +  bool "libctype"
> +  default y
> +
> +config LIBMUSL_DIRENT
> +  bool "libdirent"
> +  default y
> +
> +config LIBMUSL_ENV
> +  bool "libenv"
> +  default y
> +
> +config LIBMUSL_ERRNO
> +  bool "liberrno"
> +  default y
> +
> +config LIBMUSL_EXIT
> +  bool "libexit"
> +  default y
> +
> +config LIBMUSL_FCNTL
> +  bool "libfcntl"
> +  default y
> +
> +config LIBMUSL_FENV
> +  bool "libfenv"
> +  default y
> +
> +config LIBMUSL_INTERNAL
> +  bool "libinternal"
> +  default y
> +
> +config LIBMUSL_IPC
> +  bool "libipc"
> +  default y
> +
> +config LIBMUSL_LDSO
> +  bool "libldso"
> +  default y
> +
> +config LIBMUSL_LEGACY
> +  bool "liblegacy"
> +  default y
> +
> +config LIBMUSL_LINUX
> +  bool "liblinux"
> +  default y
> +
> +config LIBMUSL_LOCALE
> +  bool "liblocale"
> +  default y
> +
> +config LIBMUSL_MALLOC
> +  bool "libmalloc"
> +  default y
> +
> +config LIBMUSL_MATH
> +  bool "libmath"
> +  default y
> +  select LIBMUSL_FENV
> +
> +config LIBMUSL_MISC
> +  bool "libmisc"
> +  default y
> +
> +config LIBMUSL_MMAN
> +  bool "libmman"
> +  default y
> +
> +config LIBMUSL_MQ
> +  bool "libmq"
> +  default y
> +
> +config LIBMUSL_MULTIBYTE
> +  bool "libmultibyte"
> +  default y
> +
> +config LIBMUSL_NETWORK
> +  bool "libnetwork"
> +  default y
> +
> +config LIBMUSL_PASSWD
> +  bool "libpasswd"
> +  default y
> +
> +config LIBMUSL_PRNG
> +  bool "libprng"
> +  default y
> +
> +config LIBMUSL_PROCESS
> +  bool "libprocess"
> +  default y
> +  select LIBMUSL_THREAD
> +
> +config LIBMUSL_REGEX
> +  bool "libregex"
> +  default y
> +
> +config LIBMUSL_SCHED
> +  bool "libsched"
> +  default y
> +
> +config LIBMUSL_SEARCH
> +  bool "libsearch"
> +  default y
> +
> +config LIBMUSL_SELECT
> +  bool "libselect"
> +  default y
> +
> +config LIBMUSL_SETJMP
> +  bool "libsetjmp"
> +  default y
> +
> +config LIBMUSL_SIGNAL
> +  bool "libsignal"
> +  default y
> +
> +config LIBMUSL_STAT
> +  bool "libstat"
> +  default y
> +
> +config LIBMUSL_STDIO
> +  bool "libstdio"
> +  default y
> +  select LIBMUSL_FENV
> +  select LIBMUSL_UNISTD
> +
> +config LIBMUSL_STDLIB
> +  bool "libstdlib"
> +  default y
> +  select LIBMUSL_SIGNAL
> +  select LIBMUSL_MULTIBYTE
> +
> +config LIBMUSL_STRING
> +  bool "libstring"
> +  default y
> +
> +config LIBMUSL_TEMP
> +  bool "libtemp"
> +  default y
> +
> +config LIBMUSL_TERMIOS
> +  bool "libtermios"
> +  default y
> +
> +config LIBMUSL_THREAD
> +  bool "libthread"
> +  default y
> +  select LIBMUSL_SCHED
> +  select LIBMUSL_MMAN
> +
> +config LIBMUSL_FORCE_THREAD
> +  bool
> +  default y if LIBUKSCHED
> +  default n
> +  select LIBMUSL_THREAD
> +
> +config LIBMUSL_TIME
> +  bool "libtime"
> +  default y
> +
> +config LIBMUSL_UNISTD
> +  bool "libunistd"
> +  default y
> +
> +endif
> diff --git a/Makefile.rules b/Makefile.rules
> new file mode 100644
> index 0000000..53e8477
> --- /dev/null
> +++ b/Makefile.rules
> @@ -0,0 +1,31 @@
> +#
> +# Import a sub-library of musl
> +#
> +# @param $(1)
> +#   The name of the sub-library within musl.
> +# @param $(2)
> +#   The headers for this sub-library.
> +# @param $(3)
> +#   The source files for this sub-library.
> +#
> +define _libmusl_import_lib
> +$(LIBMUSL_BUILD)/include/$(1):
> +	$(call verbose_cmd,MKDIR,libmusl: $(subst =
$(LIBMUSL_BUILD),,$(1)): $(notdir $$@), mkdir -p $$@)
> +
> +# Make a symbolic link of the original header file to a sub-library =
directory
> +$(LIBMUSL_BUILD)/include/$(1)/%.h:
> +	$$(Q)mkdir -p $$(shell dirname $$@)
> +	$(call verbose_cmd,HOSTLN,libmusl: $(1): $$(subst =
$(LIBMUSL_BUILD)/include/$(1)/,,$$@), \
> +		ln -sf $$(subst =
$(LIBMUSL_BUILD)/include/$(1)/,$(LIBMUSL),$$@) $$@)
> +
> +LIBMUSL_$(call uc,$(1))_INCLUDES-y +=3D =
-I$(LIBMUSL_BUILD)/include/$(1)/include
> +LIBMUSL_$(call uc,$(1))_INCLUDES-y +=3D =
-I$(LIBMUSL_BUILD)/include/$(1)/src/internal
> +LIBMUSL_$(call uc,$(1))_INCLUDES-y +=3D =
-I$(LIBMUSL_BUILD)/include/$(1)/src/$(1)
> +LIBMUSL_SRCS-y +=3D $(3)
> +
> +CINCLUDES-y +=3D $$(LIBMUSL_$(call uc,$(1))_INCLUDES-y)
> +CXXINCLUDES-y +=3D $$(LIBMUSL_$(call uc,$(1))_INCLUDES-y)
> +
> +# Append the sub library directory to the include path
> +$(LIBMUSL_BUILD)/.prepared: $(subst =
$(LIBMUSL),$(LIBMUSL_BUILD)/include/$(1),$(2))
> +endef
> diff --git a/Makefile.uk b/Makefile.uk
> index 9657bb7..8ef65ff 100644
> --- a/Makefile.uk
> +++ b/Makefile.uk
> @@ -1,6 +1,7 @@
> #  libmusl Makefile.uk
> #
> #  Authors: Felipe Huici <felipe.huici@neclab.eu>
> +#           Alexander Jung <alexander.jung@neclab.eu>
> #
> #  Copyright (c) 2017, NEC Europe Ltd., NEC Corporation. All rights =
reserved.
> #
> @@ -36,6 +37,7 @@
> # Library registration
> =
##########################################################################=
######
> $(eval $(call addlib_s,libmusl,$(CONFIG_LIBMUSL)))
> +
> # Additionally, build glue code. This is put into a separate library =
so that we
> # can apply a thick helping of warning suppressions to musl, which =
throws
> # lots of compilation warnings, but keep our glue code up to our =
standards.
> @@ -56,13 +58,14 @@ $(eval $(call =
patch,libmusl,$(LIBMUSL_PATCHDIR),musl-$(LIBMUSL_VERSION)))
> LIBMUSL_SUBDIR=3Dmusl-$(LIBMUSL_VERSION)
> LIBMUSL=3D$(LIBMUSL_ORIGIN)/$(LIBMUSL_SUBDIR)/
>=20
> +# Additional macros for musl sub-libraries
> +include $(LIBMUSL_BASE)/Makefile.rules
> +
> =
##########################################################################=
######
> # Library includes
> =
##########################################################################=
######
> LIBMUSL_GLOBAL_INCLUDES-y   +=3D -I$(LIBMUSL)/arch/$(ARCH)
> LIBMUSL_GLOBAL_INCLUDES-y   +=3D -I$(LIBMUSL)/arch/generic
> -LIBMUSL_GLOBAL_INCLUDES-y   +=3D -I$(LIBMUSL)/src/internal
> -LIBMUSL_GLOBAL_INCLUDES-y   +=3D -I$(LIBMUSL)/include
> LIBMUSL_GLOBAL_INCLUDES-y   +=3D -I$(LIBMUSL_BASE)/include
>=20
> CINCLUDES-y    +=3D $(LIBMUSL_GLOBAL_INCLUDES-y)
> @@ -87,15 +90,21 @@ $(LIBMUSL)/src/internal/version.h:
>=20
> UK_PREPARE +=3D $(LIBMUSL)/arch/$(ARCH)/bits/alltypes.h
> UK_PREPARE +=3D $(LIBMUSL)/src/internal/version.h
> +UK_PREPARE +=3D $(LIBMUSL_BUILD)/.prepared
>=20
> LIBMUSL_CLEAN +=3D $(LIBMUSL)/arch/$(ARCH)/bits/alltypes.h
> LIBMUSL_CLEAN +=3D $(LIBMUSL)/src/internal/version.h
> +LIBMUSL_CLEAN +=3D $(LIBMUSL_BUILD)/include
>=20
> =
##########################################################################=
######
> # Global flags
> =
##########################################################################=
######
> -LIBMUSL_HEADER_FLAGS-y +=3D -Wno-unused-parameter -Wno-unused-value \
> -			  -Wno-parentheses
> +LIBMUSL_HDRS_FLAGS-y +=3D -Wno-unused-parameter
> +LIBMUSL_HDRS_FLAGS-y +=3D -Wno-unused-value
> +LIBMUSL_HDRS_FLAGS-y +=3D -Wno-parentheses
> +LIBMUSL_HDRS_FLAGS-y +=3D -Wno-builtin-macro-redefined
> +LIBMUSL_HDRS_FLAGS-y +=3D -D_POSIX_SOURCE -D_BSD_SOURCE
> +
> LIBMUSL_CFLAGS-y +=3D -Wno-implicit-fallthrough
> LIBMUSL_CFLAGS-y +=3D -Wno-restrict
> LIBMUSL_CFLAGS-y +=3D -Wno-unused-but-set-variable
> @@ -107,59 +116,159 @@ LIBMUSL_CFLAGS-y +=3D -Wno-missing-braces
> LIBMUSL_CFLAGS-y +=3D -Wno-cast-function-type
> LIBMUSL_CFLAGS-y +=3D -Wno-format-contains-nul
> LIBMUSL_CFLAGS-y +=3D -Wno-type-limits
> -LIBMUSL_CFLAGS-y +=3D $(LIBMUSL_HEADER_FLAGS-y)
> +LIBMUSL_CFLAGS-y +=3D $(LIBMUSL_HDRS_FLAGS-y)
>=20
> # We globally switch off warnings that are caused by musl's public =
headers
> -CFLAGS +=3D $(LIBMUSL_HEADER_FLAGS-y)
> -CXXFLAGS +=3D $(LIBMUSL_HEADER_FLAGS-y)
> +CFLAGS +=3D $(LIBMUSL_HDRS_FLAGS-y)
> +CXXFLAGS +=3D $(LIBMUSL_HDRS_FLAGS-y)
>=20
> =
##########################################################################=
######
> # OS dependencies code - Glue between Unicore and musl
> =
##########################################################################=
######
> LIBMUSLGLUE_SRCS-y +=3D $(LIBMUSL_BASE)/mem.c
>=20
> =
+#########################################################################=
#######
> +# Core Standard Library
> =
+#########################################################################=
#######
> +LIBMUSL_CORE_HDRS-y +=3D $(LIBMUSL)/include/sys/types.h
> +LIBMUSL_CORE_HDRS-y +=3D $(LIBMUSL)/include/sys/param.h
> +LIBMUSL_CORE_HDRS-y +=3D $(LIBMUSL)/include/sys/time.h
> +LIBMUSL_CORE_HDRS-y +=3D $(LIBMUSL)/include/sys/mount.h
> +LIBMUSL_CORE_HDRS-y +=3D $(LIBMUSL)/include/sys/sysmacros.h
> +LIBMUSL_CORE_HDRS-y +=3D $(LIBMUSL)/include/sys/file.h
> +LIBMUSL_CORE_HDRS-y +=3D $(LIBMUSL)/include/alloca.h
> +LIBMUSL_CORE_HDRS-y +=3D $(LIBMUSL)/include/stdbool.h
> +LIBMUSL_CORE_HDRS-y +=3D $(LIBMUSL)/include/limits.h
> +LIBMUSL_CORE_HDRS-y +=3D $(LIBMUSL)/include/assert.h
> +
> +$(eval $(call =
_libmusl_import_lib,core,$(LIBMUSL_CORE_HDRS-y),$(LIBMUSL_CORE_SRCS-y)))
> +
> =
##########################################################################=
######
> # musl code -- one external Makefile per sub-lib
> =
##########################################################################=
######
> +ifeq ($(CONFIG_LIBMUSL_MQ),y)
> include $(LIBMUSL_BASE)/Makefile.uk.musl.mq
> +endif
> +ifeq ($(CONFIG_LIBMUSL_DIRENT),y)
> include $(LIBMUSL_BASE)/Makefile.uk.musl.dirent
> +endif
> +ifeq ($(CONFIG_LIBMUSL_MISC),y)
> include $(LIBMUSL_BASE)/Makefile.uk.musl.misc
> +endif
> +ifeq ($(CONFIG_LIBMUSL_TEMP),y)
> include $(LIBMUSL_BASE)/Makefile.uk.musl.temp
> +endif
> +ifeq ($(CONFIG_LIBMUSL_MULTIBYTE),y)
> include $(LIBMUSL_BASE)/Makefile.uk.musl.multibyte
> +endif
> +ifeq ($(CONFIG_LIBMUSL_PROCESS),y)
> include $(LIBMUSL_BASE)/Makefile.uk.musl.process
> +endif
> +ifeq ($(CONFIG_LIBMUSL_MMAN),y)
> include $(LIBMUSL_BASE)/Makefile.uk.musl.mman
> +endif
> +ifeq ($(CONFIG_LIBMUSL_STDLIB),y)
> include $(LIBMUSL_BASE)/Makefile.uk.musl.stdlib
> +endif
> +ifeq ($(CONFIG_LIBMUSL_FCNTL),y)
> include $(LIBMUSL_BASE)/Makefile.uk.musl.fcntl
> +endif
> +ifeq ($(CONFIG_LIBMUSL_STDIO),y)
> include $(LIBMUSL_BASE)/Makefile.uk.musl.stdio
> +endif
> +ifeq ($(CONFIG_LIBMUSL_CONF),y)
> include $(LIBMUSL_BASE)/Makefile.uk.musl.conf
> +endif
> +ifeq ($(CONFIG_LIBMUSL_MATH),y)
> include $(LIBMUSL_BASE)/Makefile.uk.musl.math
> +endif
> +ifeq ($(CONFIG_LIBMUSL_AIO),y)
> include $(LIBMUSL_BASE)/Makefile.uk.musl.aio
> +endif
> +ifeq ($(CONFIG_LIBMUSL_STAT),y)
> include $(LIBMUSL_BASE)/Makefile.uk.musl.stat
> +endif
> +ifeq ($(CONFIG_LIBMUSL_SEARCH),y)
> include $(LIBMUSL_BASE)/Makefile.uk.musl.search
> +endif
> +ifeq ($(CONFIG_LIBMUSL_CRYPT),y)
> include $(LIBMUSL_BASE)/Makefile.uk.musl.crypt
> +endif
> +ifeq ($(CONFIG_LIBMUSL_SELECT),y)
> include $(LIBMUSL_BASE)/Makefile.uk.musl.select
> +endif
> +ifeq ($(CONFIG_LIBMUSL_MALLOC),y)
> include $(LIBMUSL_BASE)/Makefile.uk.musl.malloc
> +endif
> +ifeq ($(CONFIG_LIBMUSL_UNISTD),y)
> include $(LIBMUSL_BASE)/Makefile.uk.musl.unistd
> +endif
> +ifeq ($(CONFIG_LIBMUSL_SIGNAL),y)
> include $(LIBMUSL_BASE)/Makefile.uk.musl.signal
> +endif
> +ifeq ($(CONFIG_LIBMUSL_THREAD),y)
> include $(LIBMUSL_BASE)/Makefile.uk.musl.thread
> +endif
> +ifeq ($(CONFIG_LIBMUSL_LEGACY),y)
> include $(LIBMUSL_BASE)/Makefile.uk.musl.legacy
> +endif
> +ifeq ($(CONFIG_LIBMUSL_ENV),y)
> include $(LIBMUSL_BASE)/Makefile.uk.musl.env
> +endif
> +ifeq ($(CONFIG_LIBMUSL_TIME),y)
> include $(LIBMUSL_BASE)/Makefile.uk.musl.time
> +endif
> +ifeq ($(CONFIG_LIBMUSL_ERRNO),y)
> include $(LIBMUSL_BASE)/Makefile.uk.musl.errno
> +endif
> +ifeq ($(CONFIG_LIBMUSL_IPC),y)
> include $(LIBMUSL_BASE)/Makefile.uk.musl.ipc
> +endif
> +ifeq ($(CONFIG_LIBMUSL_PRNG),y)
> include $(LIBMUSL_BASE)/Makefile.uk.musl.prng
> +endif
> +ifeq ($(CONFIG_LIBMUSL_LDSO),y)
> include $(LIBMUSL_BASE)/Makefile.uk.musl.ldso
> +endif
> +ifeq ($(CONFIG_LIBMUSL_PASSWD),y)
> include $(LIBMUSL_BASE)/Makefile.uk.musl.passwd
> +endif
> +ifeq ($(CONFIG_LIBMUSL_FENV),y)
> include $(LIBMUSL_BASE)/Makefile.uk.musl.fenv
> +endif
> +ifeq ($(CONFIG_LIBMUSL_CTYPE),y)
> include $(LIBMUSL_BASE)/Makefile.uk.musl.ctype
> +endif
> +ifeq ($(CONFIG_LIBMUSL_LINUX),y)
> include $(LIBMUSL_BASE)/Makefile.uk.musl.linux
> +endif
> +ifeq ($(CONFIG_LIBMUSL_INTERNAL),y)
> include $(LIBMUSL_BASE)/Makefile.uk.musl.internal
> +endif
> +ifeq ($(CONFIG_LIBMUSL_NETWORK),y)
> include $(LIBMUSL_BASE)/Makefile.uk.musl.network
> +endif
> +ifeq ($(CONFIG_LIBMUSL_SCHED),y)
> include $(LIBMUSL_BASE)/Makefile.uk.musl.sched
> +endif
> +ifeq ($(CONFIG_LIBMUSL_STRING),y)
> include $(LIBMUSL_BASE)/Makefile.uk.musl.string
> +endif
> +ifeq ($(CONFIG_LIBMUSL_REGEX),y)
> include $(LIBMUSL_BASE)/Makefile.uk.musl.regex
> +endif
> +ifeq ($(CONFIG_LIBMUSL_TERMIOS),y)
> include $(LIBMUSL_BASE)/Makefile.uk.musl.termios
> +endif
> +ifeq ($(CONFIG_LIBMUSL_EXIT),y)
> include $(LIBMUSL_BASE)/Makefile.uk.musl.exit
> +endif
> +ifeq ($(CONFIG_LIBMUSL_SETJMP),y)
> include $(LIBMUSL_BASE)/Makefile.uk.musl.setjmp
> +endif
> +ifeq ($(CONFIG_LIBMUSL_LOCALE),y)
> include $(LIBMUSL_BASE)/Makefile.uk.musl.locale
> +endif
> +ifeq ($(CONFIG_LIBMUSL_COMPLEX),y)
> include $(LIBMUSL_BASE)/Makefile.uk.musl.complex
> +endif
> diff --git a/Makefile.uk.musl.aio b/Makefile.uk.musl.aio
> index f59397a..ac4ab88 100644
> --- a/Makefile.uk.musl.aio
> +++ b/Makefile.uk.musl.aio
> @@ -1,3 +1,19 @@
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/aio/aio.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/aio/aio_suspend.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/aio/lio_listio.c
> +LIBMUSL_AIO_HDRS-y +=3D $(LIBMUSL)/include/aio.h
> +LIBMUSL_AIO_HDRS-y +=3D $(LIBMUSL)/src/internal/atomic.h
> +LIBMUSL_AIO_HDRS-y +=3D $(LIBMUSL)/include/errno.h
> +LIBMUSL_AIO_HDRS-y +=3D $(LIBMUSL)/src/internal/libc.h
> +LIBMUSL_AIO_HDRS-y +=3D $(LIBMUSL)/include/limits.h
> +LIBMUSL_AIO_HDRS-y +=3D $(LIBMUSL)/include/pthread.h
> +LIBMUSL_AIO_HDRS-y +=3D $(LIBMUSL)/src/internal/pthread_impl.h
> +LIBMUSL_AIO_HDRS-y +=3D $(LIBMUSL)/include/semaphore.h
> +LIBMUSL_AIO_HDRS-y +=3D $(LIBMUSL)/include/stdlib.h
> +LIBMUSL_AIO_HDRS-y +=3D $(LIBMUSL)/include/string.h
> +LIBMUSL_AIO_HDRS-y +=3D $(LIBMUSL)/src/internal/syscall.h
> +LIBMUSL_AIO_HDRS-y +=3D $(LIBMUSL)/include/time.h
> +LIBMUSL_AIO_HDRS-y +=3D $(LIBMUSL)/include/unistd.h
> +
> +LIBMUSL_AIO_SRCS-y +=3D $(LIBMUSL)/src/aio/aio.c
> +LIBMUSL_AIO_SRCS-y +=3D $(LIBMUSL)/src/aio/aio_suspend.c
> +LIBMUSL_AIO_SRCS-y +=3D $(LIBMUSL)/src/aio/lio_listio.c
> +
> +$(eval $(call =
_libmusl_import_lib,aio,$(LIBMUSL_AIO_HDRS-y),$(LIBMUSL_AIO_SRCS-y)))
> diff --git a/Makefile.uk.musl.complex b/Makefile.uk.musl.complex
> index 14ea162..84c8d26 100644
> --- a/Makefile.uk.musl.complex
> +++ b/Makefile.uk.musl.complex
> @@ -1,71 +1,77 @@
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/complex/casinh.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/complex/csinhl.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/complex/creal.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/complex/__cexpf.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/complex/casinl.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/complex/cabs.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/complex/cexp.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/complex/ctanl.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/complex/ccosl.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/complex/ccoshf.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/complex/ccosh.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/complex/csqrt.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/complex/ccos.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/complex/cacos.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/complex/cacosl.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/complex/cexpf.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/complex/cprojf.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/complex/conjf.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/complex/catanhl.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/complex/creall.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/complex/catanf.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/complex/csinl.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/complex/cacosf.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/complex/csinh.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/complex/cimag.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/complex/ctan.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/complex/casinf.c
> +LIBMUSL_COMPLEX_HDRS-y +=3D $(LIBMUSL)/include/complex.h
> +LIBMUSL_COMPLEX_HDRS-y +=3D $(LIBMUSL)/include/float.h
> +LIBMUSL_COMPLEX_HDRS-y +=3D $(LIBMUSL)/src/intenal/libm.h
> +
> +LIBMUSL_COMPLEX_SRCS-y +=3D $(LIBMUSL)/src/complex/casinh.c
> +LIBMUSL_COMPLEX_SRCS-y +=3D $(LIBMUSL)/src/complex/csinhl.c
> +LIBMUSL_COMPLEX_SRCS-y +=3D $(LIBMUSL)/src/complex/creal.c
> +LIBMUSL_COMPLEX_SRCS-y +=3D $(LIBMUSL)/src/complex/__cexpf.c
> +LIBMUSL_COMPLEX_SRCS-y +=3D $(LIBMUSL)/src/complex/casinl.c
> +LIBMUSL_COMPLEX_SRCS-y +=3D $(LIBMUSL)/src/complex/cabs.c
> +LIBMUSL_COMPLEX_SRCS-y +=3D $(LIBMUSL)/src/complex/cexp.c
> +LIBMUSL_COMPLEX_SRCS-y +=3D $(LIBMUSL)/src/complex/ctanl.c
> +LIBMUSL_COMPLEX_SRCS-y +=3D $(LIBMUSL)/src/complex/ccosl.c
> +LIBMUSL_COMPLEX_SRCS-y +=3D $(LIBMUSL)/src/complex/ccoshf.c
> +LIBMUSL_COMPLEX_SRCS-y +=3D $(LIBMUSL)/src/complex/ccosh.c
> +LIBMUSL_COMPLEX_SRCS-y +=3D $(LIBMUSL)/src/complex/csqrt.c
> +LIBMUSL_COMPLEX_SRCS-y +=3D $(LIBMUSL)/src/complex/ccos.c
> +LIBMUSL_COMPLEX_SRCS-y +=3D $(LIBMUSL)/src/complex/cacos.c
> +LIBMUSL_COMPLEX_SRCS-y +=3D $(LIBMUSL)/src/complex/cacosl.c
> +LIBMUSL_COMPLEX_SRCS-y +=3D $(LIBMUSL)/src/complex/cexpf.c
> +LIBMUSL_COMPLEX_SRCS-y +=3D $(LIBMUSL)/src/complex/cprojf.c
> +LIBMUSL_COMPLEX_SRCS-y +=3D $(LIBMUSL)/src/complex/conjf.c
> +LIBMUSL_COMPLEX_SRCS-y +=3D $(LIBMUSL)/src/complex/catanhl.c
> +LIBMUSL_COMPLEX_SRCS-y +=3D $(LIBMUSL)/src/complex/creall.c
> +LIBMUSL_COMPLEX_SRCS-y +=3D $(LIBMUSL)/src/complex/catanf.c
> +LIBMUSL_COMPLEX_SRCS-y +=3D $(LIBMUSL)/src/complex/csinl.c
> +LIBMUSL_COMPLEX_SRCS-y +=3D $(LIBMUSL)/src/complex/cacosf.c
> +LIBMUSL_COMPLEX_SRCS-y +=3D $(LIBMUSL)/src/complex/csinh.c
> +LIBMUSL_COMPLEX_SRCS-y +=3D $(LIBMUSL)/src/complex/cimag.c
> +LIBMUSL_COMPLEX_SRCS-y +=3D $(LIBMUSL)/src/complex/ctan.c
> +LIBMUSL_COMPLEX_SRCS-y +=3D $(LIBMUSL)/src/complex/casinf.c
> # TO DO: missing __mulxc3
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/complex/cpowl.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/complex/cacoshf.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/complex/ctanhl.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/complex/casinhl.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/complex/casinhf.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/complex/catanl.c
> +#LIBMUSL_COMPLEX_SRCS-y +=3D $(LIBMUSL)/src/complex/cpowl.c
> +LIBMUSL_COMPLEX_SRCS-y +=3D $(LIBMUSL)/src/complex/cacoshf.c
> +LIBMUSL_COMPLEX_SRCS-y +=3D $(LIBMUSL)/src/complex/ctanhl.c
> +LIBMUSL_COMPLEX_SRCS-y +=3D $(LIBMUSL)/src/complex/casinhl.c
> +LIBMUSL_COMPLEX_SRCS-y +=3D $(LIBMUSL)/src/complex/casinhf.c
> +LIBMUSL_COMPLEX_SRCS-y +=3D $(LIBMUSL)/src/complex/catanl.c
> # TO DO: missing __muldc3
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/complex/cpow.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/complex/catanh.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/complex/__cexp.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/complex/clogl.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/complex/cacosh.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/complex/cargl.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/complex/catanhf.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/complex/cimagl.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/complex/cprojl.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/complex/conj.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/complex/cproj.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/complex/cargf.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/complex/catan.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/complex/cacoshl.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/complex/clogf.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/complex/csqrtf.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/complex/clog.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/complex/casin.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/complex/ctanh.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/complex/cexpl.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/complex/csin.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/complex/cabsf.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/complex/ctanf.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/complex/cimagf.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/complex/ctanhf.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/complex/carg.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/complex/csinhf.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/complex/csinf.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/complex/crealf.c
> +#LIBMUSL_COMPLEX_SRCS-y +=3D $(LIBMUSL)/src/complex/cpow.c
> +LIBMUSL_COMPLEX_SRCS-y +=3D $(LIBMUSL)/src/complex/catanh.c
> +LIBMUSL_COMPLEX_SRCS-y +=3D $(LIBMUSL)/src/complex/__cexp.c
> +LIBMUSL_COMPLEX_SRCS-y +=3D $(LIBMUSL)/src/complex/clogl.c
> +LIBMUSL_COMPLEX_SRCS-y +=3D $(LIBMUSL)/src/complex/cacosh.c
> +LIBMUSL_COMPLEX_SRCS-y +=3D $(LIBMUSL)/src/complex/cargl.c
> +LIBMUSL_COMPLEX_SRCS-y +=3D $(LIBMUSL)/src/complex/catanhf.c
> +LIBMUSL_COMPLEX_SRCS-y +=3D $(LIBMUSL)/src/complex/cimagl.c
> +LIBMUSL_COMPLEX_SRCS-y +=3D $(LIBMUSL)/src/complex/cprojl.c
> +LIBMUSL_COMPLEX_SRCS-y +=3D $(LIBMUSL)/src/complex/conj.c
> +LIBMUSL_COMPLEX_SRCS-y +=3D $(LIBMUSL)/src/complex/cproj.c
> +LIBMUSL_COMPLEX_SRCS-y +=3D $(LIBMUSL)/src/complex/cargf.c
> +LIBMUSL_COMPLEX_SRCS-y +=3D $(LIBMUSL)/src/complex/catan.c
> +LIBMUSL_COMPLEX_SRCS-y +=3D $(LIBMUSL)/src/complex/cacoshl.c
> +LIBMUSL_COMPLEX_SRCS-y +=3D $(LIBMUSL)/src/complex/clogf.c
> +LIBMUSL_COMPLEX_SRCS-y +=3D $(LIBMUSL)/src/complex/csqrtf.c
> +LIBMUSL_COMPLEX_SRCS-y +=3D $(LIBMUSL)/src/complex/clog.c
> +LIBMUSL_COMPLEX_SRCS-y +=3D $(LIBMUSL)/src/complex/casin.c
> +LIBMUSL_COMPLEX_SRCS-y +=3D $(LIBMUSL)/src/complex/ctanh.c
> +LIBMUSL_COMPLEX_SRCS-y +=3D $(LIBMUSL)/src/complex/cexpl.c
> +LIBMUSL_COMPLEX_SRCS-y +=3D $(LIBMUSL)/src/complex/csin.c
> +LIBMUSL_COMPLEX_SRCS-y +=3D $(LIBMUSL)/src/complex/cabsf.c
> +LIBMUSL_COMPLEX_SRCS-y +=3D $(LIBMUSL)/src/complex/ctanf.c
> +LIBMUSL_COMPLEX_SRCS-y +=3D $(LIBMUSL)/src/complex/cimagf.c
> +LIBMUSL_COMPLEX_SRCS-y +=3D $(LIBMUSL)/src/complex/ctanhf.c
> +LIBMUSL_COMPLEX_SRCS-y +=3D $(LIBMUSL)/src/complex/carg.c
> +LIBMUSL_COMPLEX_SRCS-y +=3D $(LIBMUSL)/src/complex/csinhf.c
> +LIBMUSL_COMPLEX_SRCS-y +=3D $(LIBMUSL)/src/complex/csinf.c
> +LIBMUSL_COMPLEX_SRCS-y +=3D $(LIBMUSL)/src/complex/crealf.c
> # TO DO: missing __mulsc3
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/complex/cpowf.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/complex/cabsl.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/complex/conjl.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/complex/ccoshl.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/complex/csqrtl.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/complex/ccosf.c
> +#LIBMUSL_COMPLEX_SRCS-y +=3D $(LIBMUSL)/src/complex/cpowf.c
> +LIBMUSL_COMPLEX_SRCS-y +=3D $(LIBMUSL)/src/complex/cabsl.c
> +LIBMUSL_COMPLEX_SRCS-y +=3D $(LIBMUSL)/src/complex/conjl.c
> +LIBMUSL_COMPLEX_SRCS-y +=3D $(LIBMUSL)/src/complex/ccoshl.c
> +LIBMUSL_COMPLEX_SRCS-y +=3D $(LIBMUSL)/src/complex/csqrtl.c
> +LIBMUSL_COMPLEX_SRCS-y +=3D $(LIBMUSL)/src/complex/ccosf.c
> +
> +$(eval $(call =
_libmusl_import_lib,complex,$(LIBMUSL_COMPLEX_HDRS-y),$(LIBMUSL_COMPLEX_SR=
CS-y)))
> diff --git a/Makefile.uk.musl.conf b/Makefile.uk.musl.conf
> index 4e89e81..e4e49de 100644
> --- a/Makefile.uk.musl.conf
> +++ b/Makefile.uk.musl.conf
> @@ -1,5 +1,17 @@
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/conf/confstr.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/conf/fpathconf.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/conf/legacy.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/conf/pathconf.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/conf/sysconf.c
> +LIBMUSL_CONF_HDRS-y +=3D $(LIBMUSL)/include/errno.h
> +LIBMUSL_CONF_HDRS-y +=3D $(LIBMUSL)/src/internal/libc.h
> +LIBMUSL_CONF_HDRS-y +=3D $(LIBMUSL)/include/limits.h
> +LIBMUSL_CONF_HDRS-y +=3D $(LIBMUSL)/include/signal.h
> +LIBMUSL_CONF_HDRS-y +=3D $(LIBMUSL)/include/stdio.h
> +LIBMUSL_CONF_HDRS-y +=3D $(LIBMUSL)/src/internal/syscall.h
> +LIBMUSL_CONF_HDRS-y +=3D $(LIBMUSL)/include/sys/resource.h
> +LIBMUSL_CONF_HDRS-y +=3D $(LIBMUSL)/include/sys/sysinfo.h
> +LIBMUSL_CONF_HDRS-y +=3D $(LIBMUSL)/include/unistd.h
> +
> +LIBMUSL_CONF_SRCS-y +=3D $(LIBMUSL)/src/conf/confstr.c
> +LIBMUSL_CONF_SRCS-y +=3D $(LIBMUSL)/src/conf/fpathconf.c
> +LIBMUSL_CONF_SRCS-y +=3D $(LIBMUSL)/src/conf/legacy.c
> +LIBMUSL_CONF_SRCS-y +=3D $(LIBMUSL)/src/conf/pathconf.c
> +LIBMUSL_CONF_SRCS-y +=3D $(LIBMUSL)/src/conf/sysconf.c
> +
> +$(eval $(call =
_libmusl_import_lib,conf,$(LIBMUSL_CONF_HDRS-y),$(LIBMUSL_CONF_SRCS-y)))
> diff --git a/Makefile.uk.musl.crypt b/Makefile.uk.musl.crypt
> index 71ceda6..0d491ac 100644
> --- a/Makefile.uk.musl.crypt
> +++ b/Makefile.uk.musl.crypt
> @@ -1,8 +1,19 @@
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/crypt/crypt.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/crypt/crypt_blowfish.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/crypt/crypt_des.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/crypt/crypt_md5.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/crypt/crypt_r.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/crypt/crypt_sha256.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/crypt/crypt_sha512.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/crypt/encrypt.c
> +LIBMUSL_CRYPT_HDRS-y +=3D $(LIBMUSL)/include/crypt.h
> +LIBMUSL_CRYPT_HDRS-y +=3D $(LIBMUSL)/include/ctype.h
> +LIBMUSL_CRYPT_HDRS-y +=3D $(LIBMUSL)/src/internal/libc.h
> +LIBMUSL_CRYPT_HDRS-y +=3D $(LIBMUSL)/include/stdint.h
> +LIBMUSL_CRYPT_HDRS-y +=3D $(LIBMUSL)/include/stdio.h
> +LIBMUSL_CRYPT_HDRS-y +=3D $(LIBMUSL)/include/stdlib.h
> +LIBMUSL_CRYPT_HDRS-y +=3D $(LIBMUSL)/include/string.h
> +LIBMUSL_CRYPT_HDRS-y +=3D $(LIBMUSL)/include/unistd.h
> +
> +LIBMUSL_CRYPT_SRCS-y +=3D $(LIBMUSL)/src/crypt/crypt.c
> +LIBMUSL_CRYPT_SRCS-y +=3D $(LIBMUSL)/src/crypt/crypt_blowfish.c
> +LIBMUSL_CRYPT_SRCS-y +=3D $(LIBMUSL)/src/crypt/crypt_des.c
> +LIBMUSL_CRYPT_SRCS-y +=3D $(LIBMUSL)/src/crypt/crypt_md5.c
> +LIBMUSL_CRYPT_SRCS-y +=3D $(LIBMUSL)/src/crypt/crypt_r.c
> +LIBMUSL_CRYPT_SRCS-y +=3D $(LIBMUSL)/src/crypt/crypt_sha256.c
> +LIBMUSL_CRYPT_SRCS-y +=3D $(LIBMUSL)/src/crypt/crypt_sha512.c
> +LIBMUSL_CRYPT_SRCS-y +=3D $(LIBMUSL)/src/crypt/encrypt.c
> +
> +$(eval $(call =
_libmusl_import_lib,crypt,$(LIBMUSL_CRYPT_HDRS-y),$(LIBMUSL_CRYPT_SRCS-y))=
)
> diff --git a/Makefile.uk.musl.ctype b/Makefile.uk.musl.ctype
> index c02dfed..0da9391 100644
> --- a/Makefile.uk.musl.ctype
> +++ b/Makefile.uk.musl.ctype
> @@ -1,37 +1,53 @@
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/ctype/__ctype_b_loc.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/ctype/__ctype_get_mb_cur_max.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/ctype/__ctype_tolower_loc.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/ctype/__ctype_toupper_loc.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/ctype/isalnum.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/ctype/isalpha.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/ctype/isascii.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/ctype/isblank.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/ctype/iscntrl.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/ctype/isdigit.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/ctype/isgraph.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/ctype/islower.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/ctype/isprint.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/ctype/ispunct.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/ctype/isspace.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/ctype/isupper.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/ctype/iswalnum.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/ctype/iswalpha.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/ctype/iswblank.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/ctype/iswcntrl.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/ctype/iswctype.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/ctype/iswdigit.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/ctype/iswgraph.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/ctype/iswlower.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/ctype/iswprint.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/ctype/iswpunct.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/ctype/iswspace.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/ctype/iswupper.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/ctype/iswxdigit.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/ctype/isxdigit.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/ctype/toascii.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/ctype/tolower.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/ctype/toupper.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/ctype/towctrans.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/ctype/wcswidth.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/ctype/wctrans.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/ctype/wcwidth.c
> +# LIBMUSL_CTYPE_HDRS-y +=3D alpha.h # not found
> +LIBMUSL_CTYPE_HDRS-y +=3D $(LIBMUSL)/include/ctype.h
> +LIBMUSL_CTYPE_HDRS-y +=3D $(LIBMUSL)/include/endian.h
> +LIBMUSL_CTYPE_HDRS-y +=3D $(LIBMUSL)/src/internal/libc.h
> +LIBMUSL_CTYPE_HDRS-y +=3D $(LIBMUSL)/src/internal/locale_impl.h
> +LIBMUSL_CTYPE_HDRS-y +=3D $(LIBMUSL)/src/ctype/nonspacing.h
> +LIBMUSL_CTYPE_HDRS-y +=3D $(LIBMUSL)/src/ctype/punct.h
> +LIBMUSL_CTYPE_HDRS-y +=3D $(LIBMUSL)/include/stdint.h
> +LIBMUSL_CTYPE_HDRS-y +=3D $(LIBMUSL)/include/stdlib.h
> +LIBMUSL_CTYPE_HDRS-y +=3D $(LIBMUSL)/include/string.h
> +LIBMUSL_CTYPE_HDRS-y +=3D $(LIBMUSL)/include/wchar.h
> +LIBMUSL_CTYPE_HDRS-y +=3D $(LIBMUSL)/include/wctype.h
> +LIBMUSL_CTYPE_HDRS-y +=3D $(LIBMUSL)/src/ctype/wide.h
> +
> +LIBMUSL_CTYPE_SRCS-y +=3D $(LIBMUSL)/src/ctype/__ctype_b_loc.c
> +LIBMUSL_CTYPE_SRCS-y +=3D =
$(LIBMUSL)/src/ctype/__ctype_get_mb_cur_max.c
> +LIBMUSL_CTYPE_SRCS-y +=3D $(LIBMUSL)/src/ctype/__ctype_tolower_loc.c
> +LIBMUSL_CTYPE_SRCS-y +=3D $(LIBMUSL)/src/ctype/__ctype_toupper_loc.c
> +LIBMUSL_CTYPE_SRCS-y +=3D $(LIBMUSL)/src/ctype/isalnum.c
> +LIBMUSL_CTYPE_SRCS-y +=3D $(LIBMUSL)/src/ctype/isalpha.c
> +LIBMUSL_CTYPE_SRCS-y +=3D $(LIBMUSL)/src/ctype/isascii.c
> +LIBMUSL_CTYPE_SRCS-y +=3D $(LIBMUSL)/src/ctype/isblank.c
> +LIBMUSL_CTYPE_SRCS-y +=3D $(LIBMUSL)/src/ctype/iscntrl.c
> +LIBMUSL_CTYPE_SRCS-y +=3D $(LIBMUSL)/src/ctype/isdigit.c
> +LIBMUSL_CTYPE_SRCS-y +=3D $(LIBMUSL)/src/ctype/isgraph.c
> +LIBMUSL_CTYPE_SRCS-y +=3D $(LIBMUSL)/src/ctype/islower.c
> +LIBMUSL_CTYPE_SRCS-y +=3D $(LIBMUSL)/src/ctype/isprint.c
> +LIBMUSL_CTYPE_SRCS-y +=3D $(LIBMUSL)/src/ctype/ispunct.c
> +LIBMUSL_CTYPE_SRCS-y +=3D $(LIBMUSL)/src/ctype/isspace.c
> +LIBMUSL_CTYPE_SRCS-y +=3D $(LIBMUSL)/src/ctype/isupper.c
> +LIBMUSL_CTYPE_SRCS-y +=3D $(LIBMUSL)/src/ctype/iswalnum.c
> +LIBMUSL_CTYPE_SRCS-y +=3D $(LIBMUSL)/src/ctype/iswalpha.c
> +LIBMUSL_CTYPE_SRCS-y +=3D $(LIBMUSL)/src/ctype/iswblank.c
> +LIBMUSL_CTYPE_SRCS-y +=3D $(LIBMUSL)/src/ctype/iswcntrl.c
> +LIBMUSL_CTYPE_SRCS-y +=3D $(LIBMUSL)/src/ctype/iswctype.c
> +LIBMUSL_CTYPE_SRCS-y +=3D $(LIBMUSL)/src/ctype/iswdigit.c
> +LIBMUSL_CTYPE_SRCS-y +=3D $(LIBMUSL)/src/ctype/iswgraph.c
> +LIBMUSL_CTYPE_SRCS-y +=3D $(LIBMUSL)/src/ctype/iswlower.c
> +LIBMUSL_CTYPE_SRCS-y +=3D $(LIBMUSL)/src/ctype/iswprint.c
> +LIBMUSL_CTYPE_SRCS-y +=3D $(LIBMUSL)/src/ctype/iswpunct.c
> +LIBMUSL_CTYPE_SRCS-y +=3D $(LIBMUSL)/src/ctype/iswspace.c
> +LIBMUSL_CTYPE_SRCS-y +=3D $(LIBMUSL)/src/ctype/iswupper.c
> +LIBMUSL_CTYPE_SRCS-y +=3D $(LIBMUSL)/src/ctype/iswxdigit.c
> +LIBMUSL_CTYPE_SRCS-y +=3D $(LIBMUSL)/src/ctype/isxdigit.c
> +LIBMUSL_CTYPE_SRCS-y +=3D $(LIBMUSL)/src/ctype/toascii.c
> +LIBMUSL_CTYPE_SRCS-y +=3D $(LIBMUSL)/src/ctype/tolower.c
> +LIBMUSL_CTYPE_SRCS-y +=3D $(LIBMUSL)/src/ctype/toupper.c
> +LIBMUSL_CTYPE_SRCS-y +=3D $(LIBMUSL)/src/ctype/towctrans.c
> +LIBMUSL_CTYPE_SRCS-y +=3D $(LIBMUSL)/src/ctype/wcswidth.c
> +LIBMUSL_CTYPE_SRCS-y +=3D $(LIBMUSL)/src/ctype/wctrans.c
> +LIBMUSL_CTYPE_SRCS-y +=3D $(LIBMUSL)/src/ctype/wcwidth.c
> +
> +$(eval $(call =
_libmusl_import_lib,ctype,$(LIBMUSL_CTYPE_HDRS-y),$(LIBMUSL_CTYPE_SRCS-y))=
)
> diff --git a/Makefile.uk.musl.dirent b/Makefile.uk.musl.dirent
> index 3bb54a3..c64b2d7 100644
> --- a/Makefile.uk.musl.dirent
> +++ b/Makefile.uk.musl.dirent
> @@ -1,13 +1,29 @@
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/dirent/__getdents.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/dirent/alphasort.c
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/dirent/closedir.c
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/dirent/dirfd.c
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/dirent/fdopendir.c
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/dirent/opendir.c
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/dirent/readdir.c
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/dirent/readdir_r.c
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/dirent/rewinddir.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/dirent/scandir.c
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/dirent/seekdir.c
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/dirent/telldir.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/dirent/versionsort.c
> +LIBMUSL_DIRENT_HDRS-y +=3D $(LIBMUSL)/include/sys/stat.h
> +LIBMUSL_DIRENT_HDRS-y +=3D $(LIBMUSL)/include/dirent.h
> +LIBMUSL_DIRENT_HDRS-y +=3D $(LIBMUSL)/include/errno.h
> +LIBMUSL_DIRENT_HDRS-y +=3D $(LIBMUSL)/include/fcntl.h
> +LIBMUSL_DIRENT_HDRS-y +=3D $(LIBMUSL)/include/stddef.h
> +LIBMUSL_DIRENT_HDRS-y +=3D $(LIBMUSL)/include/stdint.h
> +LIBMUSL_DIRENT_HDRS-y +=3D $(LIBMUSL)/include/stdlib.h
> +LIBMUSL_DIRENT_HDRS-y +=3D $(LIBMUSL)/include/string.h
> +
> +LIBMUSL_DIRENT_HDRS-y +=3D $(LIBMUSL)/include/unistd.h
> +LIBMUSL_DIRENT_HDRS-y +=3D $(LIBMUSL)/src/dirent/__dirent.h
> +LIBMUSL_DIRENT_HDRS-y +=3D $(LIBMUSL)/src/internal/libc.h
> +LIBMUSL_DIRENT_HDRS-y +=3D $(LIBMUSL)/src/internal/syscall.h
> +
> +LIBMUSL_DIRENT_SRCS-y +=3D $(LIBMUSL)/src/dirent/__getdents.c
> +LIBMUSL_DIRENT_SRCS-y +=3D $(LIBMUSL)/src/dirent/alphasort.c
> +#LIBMUSL_DIRENT_SRCS-y +=3D $(LIBMUSL)/src/dirent/closedir.c
> +#LIBMUSL_DIRENT_SRCS-y +=3D $(LIBMUSL)/src/dirent/dirfd.c
> +#LIBMUSL_DIRENT_SRCS-y +=3D $(LIBMUSL)/src/dirent/fdopendir.c
> +#LIBMUSL_DIRENT_SRCS-y +=3D $(LIBMUSL)/src/dirent/opendir.c
> +#LIBMUSL_DIRENT_SRCS-y +=3D $(LIBMUSL)/src/dirent/readdir.c
> +#LIBMUSL_DIRENT_SRCS-y +=3D $(LIBMUSL)/src/dirent/readdir_r.c
> +#LIBMUSL_DIRENT_SRCS-y +=3D $(LIBMUSL)/src/dirent/rewinddir.c
> +#LIBMUSL_DIRENT_SRCS-y +=3D $(LIBMUSL)/src/dirent/scandir.c
> +#LIBMUSL_DIRENT_SRCS-y +=3D $(LIBMUSL)/src/dirent/seekdir.c
> +#LIBMUSL_DIRENT_SRCS-y +=3D $(LIBMUSL)/src/dirent/telldir.c
> +LIBMUSL_DIRENT_SRCS-y +=3D $(LIBMUSL)/src/dirent/versionsort.c
> +
> +$(eval $(call =
_libmusl_import_lib,dirent,$(LIBMUSL_DIRENT_HDRS-y),$(LIBMUSL_DIRENT_SRCS-=
y)))
> diff --git a/Makefile.uk.musl.env b/Makefile.uk.musl.env
> index b724725..cab319e 100644
> --- a/Makefile.uk.musl.env
> +++ b/Makefile.uk.musl.env
> @@ -1,10 +1,28 @@
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/env/__environ.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/env/__init_tls.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/env/__libc_start_main.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/env/__reset_tls.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/env/__stack_chk_fail.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/env/clearenv.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/env/getenv.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/env/putenv.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/env/setenv.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/env/unsetenv.c
> +LIBMUSL_ENV_HDRS-y +=3D $(LIBMUSL)/src/internal/atomic.h
> +LIBMUSL_ENV_HDRS-y +=3D $(LIBMUSL)/include/elf.h
> +LIBMUSL_ENV_HDRS-y +=3D $(LIBMUSL)/include/errno.h
> +LIBMUSL_ENV_HDRS-y +=3D $(LIBMUSL)/include/fcntl.h
> +LIBMUSL_ENV_HDRS-y +=3D $(LIBMUSL)/src/internal/libc.h
> +LIBMUSL_ENV_HDRS-y +=3D $(LIBMUSL)/include/limits.h
> +LIBMUSL_ENV_HDRS-y +=3D $(LIBMUSL)/include/poll.h
> +LIBMUSL_ENV_HDRS-y +=3D $(LIBMUSL)/src/internal/pthread_impl.h
> +LIBMUSL_ENV_HDRS-y +=3D $(LIBMUSL)/include/signal.h
> +LIBMUSL_ENV_HDRS-y +=3D $(LIBMUSL)/include/stddef.h
> +LIBMUSL_ENV_HDRS-y +=3D $(LIBMUSL)/include/stdint.h
> +LIBMUSL_ENV_HDRS-y +=3D $(LIBMUSL)/include/stdlib.h
> +LIBMUSL_ENV_HDRS-y +=3D $(LIBMUSL)/include/string.h
> +LIBMUSL_ENV_HDRS-y +=3D $(LIBMUSL)/src/internal/syscall.h
> +LIBMUSL_ENV_HDRS-y +=3D $(LIBMUSL)/include/sys/mman.h
> +
> +LIBMUSL_ENV_SRCS-y +=3D $(LIBMUSL)/src/env/__environ.c
> +LIBMUSL_ENV_SRCS-y +=3D $(LIBMUSL)/src/env/__init_tls.c
> +LIBMUSL_ENV_SRCS-y +=3D $(LIBMUSL)/src/env/__libc_start_main.c
> +LIBMUSL_ENV_SRCS-y +=3D $(LIBMUSL)/src/env/__reset_tls.c
> +LIBMUSL_ENV_SRCS-y +=3D $(LIBMUSL)/src/env/__stack_chk_fail.c
> +LIBMUSL_ENV_SRCS-y +=3D $(LIBMUSL)/src/env/clearenv.c
> +LIBMUSL_ENV_SRCS-y +=3D $(LIBMUSL)/src/env/getenv.c
> +LIBMUSL_ENV_SRCS-y +=3D $(LIBMUSL)/src/env/putenv.c
> +LIBMUSL_ENV_SRCS-y +=3D $(LIBMUSL)/src/env/setenv.c
> +LIBMUSL_ENV_SRCS-y +=3D $(LIBMUSL)/src/env/unsetenv.c
> +
> +$(eval $(call =
_libmusl_import_lib,env,$(LIBMUSL_ENV_HDRS-y),$(LIBMUSL_ENV_SRCS-y)))
> diff --git a/Makefile.uk.musl.errno b/Makefile.uk.musl.errno
> index d43226e..985f93a 100644
> --- a/Makefile.uk.musl.errno
> +++ b/Makefile.uk.musl.errno
> @@ -1,2 +1,11 @@
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/errno/__errno_location.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/errno/strerror.c
> +LIBMUSL_ERRNO_HDRS-y +=3D $(LIBMUSL)/include/errno.h
> +LIBMUSL_ERRNO_HDRS-y +=3D $(LIBMUSL)/src/internal/libc.h
> +LIBMUSL_ERRNO_HDRS-y +=3D $(LIBMUSL)/src/internal/locale_impl.h
> +LIBMUSL_ERRNO_HDRS-y +=3D $(LIBMUSL)/src/internal/pthread_impl.h
> +LIBMUSL_ERRNO_HDRS-y +=3D $(LIBMUSL)/src/errno/__strerror.h
> +LIBMUSL_ERRNO_HDRS-y +=3D $(LIBMUSL)/include/string.h
> +
> +LIBMUSL_ERRNO_SRCS-y +=3D $(LIBMUSL)/src/errno/__errno_location.c
> +LIBMUSL_ERRNO_SRCS-y +=3D $(LIBMUSL)/src/errno/strerror.c
> +
> +$(eval $(call =
_libmusl_import_lib,errno,$(LIBMUSL_ERRNO_HDRS-y),$(LIBMUSL_ERRNO_SRCS-y))=
)
> diff --git a/Makefile.uk.musl.exit b/Makefile.uk.musl.exit
> index eea591c..79aa64d 100644
> --- a/Makefile.uk.musl.exit
> +++ b/Makefile.uk.musl.exit
> @@ -1,8 +1,19 @@
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/exit/_Exit.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/exit/abort.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/exit/arm/__aeabi_atexit.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/exit/assert.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/exit/at_quick_exit.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/exit/atexit.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/exit/exit.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/exit/quick_exit.c
> +LIBMUSL_EXIT_HDRS-y +=3D $(LIBMUSL)/src/internal/atomic.h
> +LIBMUSL_EXIT_HDRS-y +=3D $(LIBMUSL)/src/internal/libc.h
> +LIBMUSL_EXIT_HDRS-y +=3D $(LIBMUSL)/src/internal/pthread_impl.h
> +LIBMUSL_EXIT_HDRS-y +=3D $(LIBMUSL)/include/signal.h
> +LIBMUSL_EXIT_HDRS-y +=3D $(LIBMUSL)/include/stdint.h
> +LIBMUSL_EXIT_HDRS-y +=3D $(LIBMUSL)/include/stdio.h
> +LIBMUSL_EXIT_HDRS-y +=3D $(LIBMUSL)/include/stdlib.h
> +LIBMUSL_EXIT_HDRS-y +=3D $(LIBMUSL)/src/internal/syscall.h
> +
> +LIBMUSL_EXIT_SRCS-y +=3D $(LIBMUSL)/src/exit/_Exit.c
> +LIBMUSL_EXIT_SRCS-y +=3D $(LIBMUSL)/src/exit/abort.c
> +LIBMUSL_EXIT_SRCS-y +=3D $(LIBMUSL)/src/exit/arm/__aeabi_atexit.c
> +LIBMUSL_EXIT_SRCS-y +=3D $(LIBMUSL)/src/exit/assert.c
> +LIBMUSL_EXIT_SRCS-y +=3D $(LIBMUSL)/src/exit/at_quick_exit.c
> +LIBMUSL_EXIT_SRCS-y +=3D $(LIBMUSL)/src/exit/atexit.c
> +LIBMUSL_EXIT_SRCS-y +=3D $(LIBMUSL)/src/exit/exit.c
> +LIBMUSL_EXIT_SRCS-y +=3D $(LIBMUSL)/src/exit/quick_exit.c
> +
> +$(eval $(call =
_libmusl_import_lib,exit,$(LIBMUSL_EXIT_HDRS-y),$(LIBMUSL_EXIT_SRCS-y)))
> diff --git a/Makefile.uk.musl.fcntl b/Makefile.uk.musl.fcntl
> index b2f8d2b..78a94c8 100644
> --- a/Makefile.uk.musl.fcntl
> +++ b/Makefile.uk.musl.fcntl
> @@ -1,6 +1,14 @@
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/fcntl/creat.c
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/fcntl/fcntl.c
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/fcntl/open.c
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/fcntl/openat.c
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/fcntl/posix_fadvise.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/fcntl/posix_fallocate.c
> +LIBMUSL_FCNTL_HDRS-y +=3D $(LIBMUSL)/include/errno.h
> +LIBMUSL_FCNTL_HDRS-y +=3D $(LIBMUSL)/include/fcntl.h
> +LIBMUSL_FCNTL_HDRS-y +=3D $(LIBMUSL)/src/internal/libc.h
> +LIBMUSL_FCNTL_HDRS-y +=3D $(LIBMUSL)/include/stdarg.h
> +LIBMUSL_FCNTL_HDRS-y +=3D $(LIBMUSL)/src/internal/syscall.h
> +
> +#LIBMUSL_FCNTL_SRCS-y +=3D $(LIBMUSL)/src/fcntl/creat.c
> +#LIBMUSL_FCNTL_SRCS-y +=3D $(LIBMUSL)/src/fcntl/fcntl.c
> +#LIBMUSL_FCNTL_SRCS-y +=3D $(LIBMUSL)/src/fcntl/open.c
> +#LIBMUSL_FCNTL_SRCS-y +=3D $(LIBMUSL)/src/fcntl/openat.c
> +#LIBMUSL_FCNTL_SRCS-y +=3D $(LIBMUSL)/src/fcntl/posix_fadvise.c
> +LIBMUSL_FCNTL_SRCS-y +=3D $(LIBMUSL)/src/fcntl/posix_fallocate.c
> +
> +$(eval $(call =
_libmusl_import_lib,fcntl,$(LIBMUSL_FCNTL_HDRS-y),$(LIBMUSL_FCNTL_SRCS-y))=
)
> diff --git a/Makefile.uk.musl.fenv b/Makefile.uk.musl.fenv
> index 355beca..62e46b1 100644
> --- a/Makefile.uk.musl.fenv
> +++ b/Makefile.uk.musl.fenv
> @@ -1,32 +1,37 @@
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/fenv/__flt_rounds.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/fenv/fegetexceptflag.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/fenv/feholdexcept.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/fenv/fesetexceptflag.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/fenv/fesetround.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/fenv/feupdateenv.c
> +LIBMUSL_FENV_HDRS-y +=3D $(LIBMUSL)/include/fenv.h
> +LIBMUSL_FENV_HDRS-y +=3D $(LIBMUSL)/include/float.h
> +
> +LIBMUSL_FENV_SRCS-y +=3D $(LIBMUSL)/src/fenv/__flt_rounds.c
> +LIBMUSL_FENV_SRCS-y +=3D $(LIBMUSL)/src/fenv/fegetexceptflag.c
> +LIBMUSL_FENV_SRCS-y +=3D $(LIBMUSL)/src/fenv/feholdexcept.c
> +LIBMUSL_FENV_SRCS-y +=3D $(LIBMUSL)/src/fenv/fesetexceptflag.c
> +LIBMUSL_FENV_SRCS-y +=3D $(LIBMUSL)/src/fenv/fesetround.c
> +LIBMUSL_FENV_SRCS-y +=3D $(LIBMUSL)/src/fenv/feupdateenv.c
>=20
> ifeq (arm,$(CONFIG_UK_ARCH))
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/fenv/arm/fenv-hf.S|arm
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/fenv/arm/fenv.c|arm
> +LIBMUSL_FENV_SRCS-y +=3D $(LIBMUSL)/src/fenv/arm/fenv-hf.S|arm
> +LIBMUSL_FENV_SRCS-y +=3D $(LIBMUSL)/src/fenv/arm/fenv.c|arm
> else ifeq (x86_32,$(CONFIG_UK_ARCH))
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/fenv/i386/fenv.s|x86_32
> +LIBMUSL_FENV_SRCS-y +=3D $(LIBMUSL)/src/fenv/i386/fenv.s|x86_32
> else ifeq (x86_64,$(CONFIG_UK_ARCH))
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/fenv/x86_64/fenv.s|x86_64
> +LIBMUSL_FENV_SRCS-y +=3D $(LIBMUSL)/src/fenv/x86_64/fenv.s|x86_64
> else
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/fenv/fenv.c
> +LIBMUSL_FENV_SRCS-y +=3D $(LIBMUSL)/src/fenv/fenv.c
> endif
>=20
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/fenv/aarch64/fenv.s
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/fenv/mips/fenv-sf.c
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/fenv/mips/fenv.S
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/fenv/mips64/fenv-sf.c
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/fenv/mips64/fenv.S
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/fenv/mipsn32/fenv-sf.c
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/fenv/mipsn32/fenv.S
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/fenv/powerpc/fenv-sf.c
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/fenv/powerpc/fenv.S
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/fenv/powerpc64/fenv.c
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/fenv/s390x/fenv.c
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/fenv/sh/fenv-nofpu.c
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/fenv/sh/fenv.S
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/fenv/x32/fenv.s
> +#LIBMUSL_FENV_SRCS-y +=3D $(LIBMUSL)/src/fenv/aarch64/fenv.s
> +#LIBMUSL_FENV_SRCS-y +=3D $(LIBMUSL)/src/fenv/mips/fenv-sf.c
> +#LIBMUSL_FENV_SRCS-y +=3D $(LIBMUSL)/src/fenv/mips/fenv.S
> +#LIBMUSL_FENV_SRCS-y +=3D $(LIBMUSL)/src/fenv/mips64/fenv-sf.c
> +#LIBMUSL_FENV_SRCS-y +=3D $(LIBMUSL)/src/fenv/mips64/fenv.S
> +#LIBMUSL_FENV_SRCS-y +=3D $(LIBMUSL)/src/fenv/mipsn32/fenv-sf.c
> +#LIBMUSL_FENV_SRCS-y +=3D $(LIBMUSL)/src/fenv/mipsn32/fenv.S
> +#LIBMUSL_FENV_SRCS-y +=3D $(LIBMUSL)/src/fenv/powerpc/fenv-sf.c
> +#LIBMUSL_FENV_SRCS-y +=3D $(LIBMUSL)/src/fenv/powerpc/fenv.S
> +#LIBMUSL_FENV_SRCS-y +=3D $(LIBMUSL)/src/fenv/powerpc64/fenv.c
> +#LIBMUSL_FENV_SRCS-y +=3D $(LIBMUSL)/src/fenv/s390x/fenv.c
> +#LIBMUSL_FENV_SRCS-y +=3D $(LIBMUSL)/src/fenv/sh/fenv-nofpu.c
> +#LIBMUSL_FENV_SRCS-y +=3D $(LIBMUSL)/src/fenv/sh/fenv.S
> +#LIBMUSL_FENV_SRCS-y +=3D $(LIBMUSL)/src/fenv/x32/fenv.s
> +
> +$(eval $(call =
_libmusl_import_lib,fenv,$(LIBMUSL_FENV_HDRS-y),$(LIBMUSL_FENV_SRCS-y)))
> diff --git a/Makefile.uk.musl.internal b/Makefile.uk.musl.internal
> index b65b15b..6f909ff 100644
> --- a/Makefile.uk.musl.internal
> +++ b/Makefile.uk.musl.internal
> @@ -1,32 +1,48 @@
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/internal/floatscan.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/internal/intscan.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/internal/libc.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/internal/procfdname.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/internal/shgetc.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/internal/syscall.c|internal
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/internal/syscall_ret.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/internal/vdso.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/internal/version.c
> +LIBMUSL_INTERNAL_HDRS-y +=3D $(LIBMUSL)/include/ctype.h
> +LIBMUSL_INTERNAL_HDRS-y +=3D $(LIBMUSL)/include/elf.h
> +LIBMUSL_INTERNAL_HDRS-y +=3D $(LIBMUSL)/include/errno.h
> +LIBMUSL_INTERNAL_HDRS-y +=3D $(LIBMUSL)/include/float.h
> +LIBMUSL_INTERNAL_HDRS-y +=3D $(LIBMUSL)/src/internal/floatscan.h
> +LIBMUSL_INTERNAL_HDRS-y +=3D $(LIBMUSL)/src/internal/libc.h
> +LIBMUSL_INTERNAL_HDRS-y +=3D $(LIBMUSL)/include/limits.h
> +LIBMUSL_INTERNAL_HDRS-y +=3D $(LIBMUSL)/include/link.h
> +LIBMUSL_INTERNAL_HDRS-y +=3D $(LIBMUSL)/include/math.h
> +LIBMUSL_INTERNAL_HDRS-y +=3D $(LIBMUSL)/src/internal/shgetc.h
> +LIBMUSL_INTERNAL_HDRS-y +=3D $(LIBMUSL)/include/stdint.h
> +LIBMUSL_INTERNAL_HDRS-y +=3D $(LIBMUSL)/include/stdio.h
> +LIBMUSL_INTERNAL_HDRS-y +=3D $(LIBMUSL)/include/string.h
> +LIBMUSL_INTERNAL_HDRS-y +=3D $(LIBMUSL)/src/internal/syscall.h
> +LIBMUSL_INTERNAL_HDRS-y +=3D $(LIBMUSL)/src/internal/version.h
> +
> +LIBMUSL_INTERNAL_SRCS-y +=3D $(LIBMUSL)/src/internal/floatscan.c
> +LIBMUSL_INTERNAL_SRCS-y +=3D $(LIBMUSL)/src/internal/intscan.c
> +LIBMUSL_INTERNAL_SRCS-y +=3D $(LIBMUSL)/src/internal/libc.c
> +LIBMUSL_INTERNAL_SRCS-y +=3D $(LIBMUSL)/src/internal/procfdname.c
> +LIBMUSL_INTERNAL_SRCS-y +=3D $(LIBMUSL)/src/internal/shgetc.c
> +LIBMUSL_INTERNAL_SRCS-y +=3D =
$(LIBMUSL)/src/internal/syscall.c|internal
> +LIBMUSL_INTERNAL_SRCS-y +=3D $(LIBMUSL)/src/internal/syscall_ret.c
> +LIBMUSL_INTERNAL_SRCS-y +=3D $(LIBMUSL)/src/internal/vdso.c
> +LIBMUSL_INTERNAL_SRCS-y +=3D $(LIBMUSL)/src/internal/version.c
>=20
> #ifeq (arm,$(CONFIG_UK_ARCH))
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/internal/arm/syscall.s|arm
> +#LIBMUSL_INTERNAL_SRCS-y +=3D =
$(LIBMUSL)/src/internal/arm/syscall.s|arm
> #else ifeq (x86_32,$(CONFIG_UK_ARCH))
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/internal/i386/syscall.s|i386
> +#LIBMUSL_INTERNAL_SRCS-y +=3D =
$(LIBMUSL)/src/internal/i386/syscall.s|i386
> #else ifeq (x86_64,$(CONFIG_UK_ARCH))
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/internal/x86_64/syscall.s|x86_64
> +#LIBMUSL_INTERNAL_SRCS-y +=3D =
$(LIBMUSL)/src/internal/x86_64/syscall.s|x86_64
> #endif
>=20
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/internal/aarch64/syscall.s
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/internal/microblaze/syscall.s
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/internal/mips/syscall.s
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/internal/mips64/syscall.s
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/internal/mipsn32/syscall.s
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/internal/or1k/syscall.s
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/internal/powerpc/syscall.s
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/internal/powerpc64/syscall.s
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/internal/s390x/syscall.s
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/internal/sh/__shcall.c
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/internal/sh/syscall.s
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/internal/x32/syscall.s|x32
> -
> +#LIBMUSL_INTERNAL_SRCS-y +=3D =
$(LIBMUSL)/src/internal/aarch64/syscall.s
> +#LIBMUSL_INTERNAL_SRCS-y +=3D =
$(LIBMUSL)/src/internal/microblaze/syscall.s
> +#LIBMUSL_INTERNAL_SRCS-y +=3D $(LIBMUSL)/src/internal/mips/syscall.s
> +#LIBMUSL_INTERNAL_SRCS-y +=3D =
$(LIBMUSL)/src/internal/mips64/syscall.s
> +#LIBMUSL_INTERNAL_SRCS-y +=3D =
$(LIBMUSL)/src/internal/mipsn32/syscall.s
> +#LIBMUSL_INTERNAL_SRCS-y +=3D $(LIBMUSL)/src/internal/or1k/syscall.s
> +#LIBMUSL_INTERNAL_SRCS-y +=3D =
$(LIBMUSL)/src/internal/powerpc/syscall.s
> +#LIBMUSL_INTERNAL_SRCS-y +=3D =
$(LIBMUSL)/src/internal/powerpc64/syscall.s
> +#LIBMUSL_INTERNAL_SRCS-y +=3D $(LIBMUSL)/src/internal/s390x/syscall.s
> +#LIBMUSL_INTERNAL_SRCS-y +=3D $(LIBMUSL)/src/internal/sh/__shcall.c
> +#LIBMUSL_INTERNAL_SRCS-y +=3D $(LIBMUSL)/src/internal/sh/syscall.s
> +#LIBMUSL_INTERNAL_SRCS-y +=3D =
$(LIBMUSL)/src/internal/x32/syscall.s|x32
>=20
> +$(eval $(call =
_libmusl_import_lib,internal,$(LIBMUSL_INTERNAL_HDRS-y),$(LIBMUSL_INTERNAL=
_SRCS-y)))
> diff --git a/Makefile.uk.musl.ipc b/Makefile.uk.musl.ipc
> index 02f4c25..a64d38e 100644
> --- a/Makefile.uk.musl.ipc
> +++ b/Makefile.uk.musl.ipc
> @@ -1,13 +1,28 @@
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/ipc/ftok.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/ipc/msgctl.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/ipc/msgget.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/ipc/msgrcv.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/ipc/msgsnd.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/ipc/semctl.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/ipc/semget.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/ipc/semop.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/ipc/semtimedop.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/ipc/shmat.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/ipc/shmctl.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/ipc/shmdt.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/ipc/shmget.c
> +LIBMUSL_IPC_HDRS-y +=3D $(LIBMUSL)/include/errno.h
> +LIBMUSL_IPC_HDRS-y +=3D $(LIBMUSL)/src/ipc/ipc.h
> +LIBMUSL_IPC_HDRS-y +=3D $(LIBMUSL)/src/internal/libc.h
> +LIBMUSL_IPC_HDRS-y +=3D $(LIBMUSL)/include/limits.h
> +LIBMUSL_IPC_HDRS-y +=3D $(LIBMUSL)/include/stdarg.h
> +LIBMUSL_IPC_HDRS-y +=3D $(LIBMUSL)/include/stdint.h
> +LIBMUSL_IPC_HDRS-y +=3D $(LIBMUSL)/src/internal/syscall.h
> +LIBMUSL_IPC_HDRS-y +=3D $(LIBMUSL)/include/sys/ipc.h
> +LIBMUSL_IPC_HDRS-y +=3D $(LIBMUSL)/include/sys/msg.h
> +LIBMUSL_IPC_HDRS-y +=3D $(LIBMUSL)/include/sys/sem.h
> +LIBMUSL_IPC_HDRS-y +=3D $(LIBMUSL)/include/sys/shm.h
> +LIBMUSL_IPC_HDRS-y +=3D $(LIBMUSL)/include/sys/stat.h
> +
> +LIBMUSL_IPC_SRCS-y +=3D $(LIBMUSL)/src/ipc/ftok.c
> +LIBMUSL_IPC_SRCS-y +=3D $(LIBMUSL)/src/ipc/msgctl.c
> +LIBMUSL_IPC_SRCS-y +=3D $(LIBMUSL)/src/ipc/msgget.c
> +LIBMUSL_IPC_SRCS-y +=3D $(LIBMUSL)/src/ipc/msgrcv.c
> +LIBMUSL_IPC_SRCS-y +=3D $(LIBMUSL)/src/ipc/msgsnd.c
> +LIBMUSL_IPC_SRCS-y +=3D $(LIBMUSL)/src/ipc/semctl.c
> +LIBMUSL_IPC_SRCS-y +=3D $(LIBMUSL)/src/ipc/semget.c
> +LIBMUSL_IPC_SRCS-y +=3D $(LIBMUSL)/src/ipc/semop.c
> +LIBMUSL_IPC_SRCS-y +=3D $(LIBMUSL)/src/ipc/semtimedop.c
> +LIBMUSL_IPC_SRCS-y +=3D $(LIBMUSL)/src/ipc/shmat.c
> +LIBMUSL_IPC_SRCS-y +=3D $(LIBMUSL)/src/ipc/shmctl.c
> +LIBMUSL_IPC_SRCS-y +=3D $(LIBMUSL)/src/ipc/shmdt.c
> +LIBMUSL_IPC_SRCS-y +=3D $(LIBMUSL)/src/ipc/shmget.c
> +
> +$(eval $(call =
_libmusl_import_lib,ipc,$(LIBMUSL_IPC_HDRS-y),$(LIBMUSL_IPC_SRCS-y)))
> diff --git a/Makefile.uk.musl.ldso b/Makefile.uk.musl.ldso
> index a689004..7e1b74b 100644
> --- a/Makefile.uk.musl.ldso
> +++ b/Makefile.uk.musl.ldso
> @@ -1,35 +1,47 @@
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/ldso/__dlsym.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/ldso/dl_iterate_phdr.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/ldso/dladdr.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/ldso/dlclose.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/ldso/dlerror.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/ldso/dlinfo.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/ldso/dlopen.c
> +LIBMUSL_LDSO_HDRS-y +=3D $(LIBMUSL)/include/dlfcn.h
> +LIBMUSL_LDSO_HDRS-y +=3D $(LIBMUSL)/include/elf.h
> +LIBMUSL_LDSO_HDRS-y +=3D $(LIBMUSL)/src/internal/libc.h
> +LIBMUSL_LDSO_HDRS-y +=3D $(LIBMUSL)/include/link.h
> +LIBMUSL_LDSO_HDRS-y +=3D $(LIBMUSL)/src/internal/pthread_impl.h
> +LIBMUSL_LDSO_HDRS-y +=3D $(LIBMUSL)/include/stdarg.h
> +LIBMUSL_LDSO_HDRS-y +=3D $(LIBMUSL)/include/stddef.h
> +LIBMUSL_LDSO_HDRS-y +=3D $(LIBMUSL)/include/stdint.h
> +LIBMUSL_LDSO_HDRS-y +=3D $(LIBMUSL)/include/stdlib.h
> +
> +LIBMUSL_LDSO_SRCS-y +=3D $(LIBMUSL)/src/ldso/__dlsym.c
> +LIBMUSL_LDSO_SRCS-y +=3D $(LIBMUSL)/src/ldso/dl_iterate_phdr.c
> +LIBMUSL_LDSO_SRCS-y +=3D $(LIBMUSL)/src/ldso/dladdr.c
> +LIBMUSL_LDSO_SRCS-y +=3D $(LIBMUSL)/src/ldso/dlclose.c
> +LIBMUSL_LDSO_SRCS-y +=3D $(LIBMUSL)/src/ldso/dlerror.c
> +LIBMUSL_LDSO_SRCS-y +=3D $(LIBMUSL)/src/ldso/dlinfo.c
> +LIBMUSL_LDSO_SRCS-y +=3D $(LIBMUSL)/src/ldso/dlopen.c
>=20
> ifeq (arm,$(CONFIG_UK_ARCH))
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/ldso/arm/dlsym.s|arm
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/ldso/arm/find_exidx.c|arm
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/ldso/tlsdesc.c
> +LIBMUSL_LDSO_SRCS-y +=3D $(LIBMUSL)/src/ldso/arm/dlsym.s|arm
> +LIBMUSL_LDSO_SRCS-y +=3D $(LIBMUSL)/src/ldso/arm/find_exidx.c|arm
> +LIBMUSL_LDSO_SRCS-y +=3D $(LIBMUSL)/src/ldso/tlsdesc.c
> else ifeq (x86_32,$(CONFIG_UK_ARCH))
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/ldso/i386/dlsym.s|x86_32
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/ldso/i386/tlsdesc.s|x86_32
> +LIBMUSL_LDSO_SRCS-y +=3D $(LIBMUSL)/src/ldso/i386/dlsym.s|x86_32
> +LIBMUSL_LDSO_SRCS-y +=3D $(LIBMUSL)/src/ldso/i386/tlsdesc.s|x86_32
> else ifeq (x86_64,$(CONFIG_UK_ARCH))
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/ldso/x86_64/dlsym.s|x86_64
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/ldso/x86_64/tlsdesc.s|x86_64
> +LIBMUSL_LDSO_SRCS-y +=3D $(LIBMUSL)/src/ldso/x86_64/dlsym.s|x86_64
> +LIBMUSL_LDSO_SRCS-y +=3D $(LIBMUSL)/src/ldso/x86_64/tlsdesc.s|x86_64
> else
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/ldso/tlsdesc.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/ldso/dlsym.c
> +LIBMUSL_LDSO_SRCS-y +=3D $(LIBMUSL)/src/ldso/tlsdesc.c
> +LIBMUSL_LDSO_SRCS-y +=3D $(LIBMUSL)/src/ldso/dlsym.c
> endif
>=20
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/ldso/aarch64/dlsym.s
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/ldso/aarch64/tlsdesc.s
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/ldso/microblaze/dlsym.s
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/ldso/mips/dlsym.s
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/ldso/mips64/dlsym.s
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/ldso/mipsn32/dlsym.s
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/ldso/or1k/dlsym.s
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/ldso/powerpc/dlsym.s
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/ldso/powerpc64/dlsym.s
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/ldso/s390x/dlsym.s
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/ldso/sh/dlsym.s
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/ldso/x32/dlsym.s
> \ No newline at end of file
> +#LIBMUSL_LDSO_SRCS-y +=3D $(LIBMUSL)/src/ldso/aarch64/dlsym.s
> +#LIBMUSL_LDSO_SRCS-y +=3D $(LIBMUSL)/src/ldso/aarch64/tlsdesc.s
> +#LIBMUSL_LDSO_SRCS-y +=3D $(LIBMUSL)/src/ldso/microblaze/dlsym.s
> +#LIBMUSL_LDSO_SRCS-y +=3D $(LIBMUSL)/src/ldso/mips/dlsym.s
> +#LIBMUSL_LDSO_SRCS-y +=3D $(LIBMUSL)/src/ldso/mips64/dlsym.s
> +#LIBMUSL_LDSO_SRCS-y +=3D $(LIBMUSL)/src/ldso/mipsn32/dlsym.s
> +#LIBMUSL_LDSO_SRCS-y +=3D $(LIBMUSL)/src/ldso/or1k/dlsym.s
> +#LIBMUSL_LDSO_SRCS-y +=3D $(LIBMUSL)/src/ldso/powerpc/dlsym.s
> +#LIBMUSL_LDSO_SRCS-y +=3D $(LIBMUSL)/src/ldso/powerpc64/dlsym.s
> +#LIBMUSL_LDSO_SRCS-y +=3D $(LIBMUSL)/src/ldso/s390x/dlsym.s
> +#LIBMUSL_LDSO_SRCS-y +=3D $(LIBMUSL)/src/ldso/sh/dlsym.s
> +#LIBMUSL_LDSO_SRCS-y +=3D $(LIBMUSL)/src/ldso/x32/dlsym.s
> +
> +$(eval $(call =
_libmusl_import_lib,ldso,$(LIBMUSL_LDSO_HDRS-y),$(LIBMUSL_LDSO_SRCS-y)))
> diff --git a/Makefile.uk.musl.legacy b/Makefile.uk.musl.legacy
> index 9d73217..62b71f5 100644
> --- a/Makefile.uk.musl.legacy
> +++ b/Makefile.uk.musl.legacy
> @@ -1,16 +1,40 @@
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/legacy/cuserid.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/legacy/daemon.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/legacy/err.c
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/legacy/euidaccess.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/legacy/ftw.c
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/legacy/futimes.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/legacy/getdtablesize.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/legacy/getloadavg.c
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/legacy/getpagesize.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/legacy/getpass.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/legacy/getusershell.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/legacy/isastream.c
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/legacy/lutimes.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/legacy/ulimit.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/legacy/utmpx.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/legacy/valloc.c
> +LIBMUSL_LEGACY_HDRS-y +=3D $(LIBMUSL)/include/err.h
> +LIBMUSL_LEGACY_HDRS-y +=3D $(LIBMUSL)/include/errno.h
> +LIBMUSL_LEGACY_HDRS-y +=3D $(LIBMUSL)/include/fcntl.h
> +LIBMUSL_LEGACY_HDRS-y +=3D $(LIBMUSL)/include/ftw.h
> +LIBMUSL_LEGACY_HDRS-y +=3D $(LIBMUSL)/src/internal/libc.h
> +LIBMUSL_LEGACY_HDRS-y +=3D $(LIBMUSL)/include/limits.h
> +LIBMUSL_LEGACY_HDRS-y +=3D $(LIBMUSL)/include/pwd.h
> +LIBMUSL_LEGACY_HDRS-y +=3D $(LIBMUSL)/include/stdarg.h
> +LIBMUSL_LEGACY_HDRS-y +=3D $(LIBMUSL)/include/stddef.h
> +LIBMUSL_LEGACY_HDRS-y +=3D $(LIBMUSL)/include/stdio.h
> +LIBMUSL_LEGACY_HDRS-y +=3D $(LIBMUSL)/include/stdlib.h
> +LIBMUSL_LEGACY_HDRS-y +=3D $(LIBMUSL)/include/string.h
> +LIBMUSL_LEGACY_HDRS-y +=3D $(LIBMUSL)/include/stropts.h
> +LIBMUSL_LEGACY_HDRS-y +=3D $(LIBMUSL)/include/sys/resource.h
> +LIBMUSL_LEGACY_HDRS-y +=3D $(LIBMUSL)/include/sys/stat.h
> +LIBMUSL_LEGACY_HDRS-y +=3D $(LIBMUSL)/include/sys/sysinfo.h
> +LIBMUSL_LEGACY_HDRS-y +=3D $(LIBMUSL)/include/sys/time.h
> +LIBMUSL_LEGACY_HDRS-y +=3D $(LIBMUSL)/include/termios.h
> +LIBMUSL_LEGACY_HDRS-y +=3D $(LIBMUSL)/include/ulimit.h
> +LIBMUSL_LEGACY_HDRS-y +=3D $(LIBMUSL)/include/unistd.h
> +LIBMUSL_LEGACY_HDRS-y +=3D $(LIBMUSL)/include/utmpx.h
> +
> +LIBMUSL_LEGACY_SRCS-y +=3D $(LIBMUSL)/src/legacy/cuserid.c
> +LIBMUSL_LEGACY_SRCS-y +=3D $(LIBMUSL)/src/legacy/daemon.c
> +LIBMUSL_LEGACY_SRCS-y +=3D $(LIBMUSL)/src/legacy/err.c
> +#LIBMUSL_LEGACY_SRCS-y +=3D $(LIBMUSL)/src/legacy/euidaccess.c
> +LIBMUSL_LEGACY_SRCS-y +=3D $(LIBMUSL)/src/legacy/ftw.c
> +#LIBMUSL_LEGACY_SRCS-y +=3D $(LIBMUSL)/src/legacy/futimes.c
> +LIBMUSL_LEGACY_SRCS-y +=3D $(LIBMUSL)/src/legacy/getdtablesize.c
> +LIBMUSL_LEGACY_SRCS-y +=3D $(LIBMUSL)/src/legacy/getloadavg.c
> +#LIBMUSL_LEGACY_SRCS-y +=3D $(LIBMUSL)/src/legacy/getpagesize.c
> +LIBMUSL_LEGACY_SRCS-y +=3D $(LIBMUSL)/src/legacy/getpass.c
> +LIBMUSL_LEGACY_SRCS-y +=3D $(LIBMUSL)/src/legacy/getusershell.c
> +LIBMUSL_LEGACY_SRCS-y +=3D $(LIBMUSL)/src/legacy/isastream.c
> +#LIBMUSL_LEGACY_SRCS-y +=3D $(LIBMUSL)/src/legacy/lutimes.c
> +LIBMUSL_LEGACY_SRCS-y +=3D $(LIBMUSL)/src/legacy/ulimit.c
> +LIBMUSL_LEGACY_SRCS-y +=3D $(LIBMUSL)/src/legacy/utmpx.c
> +LIBMUSL_LEGACY_SRCS-y +=3D $(LIBMUSL)/src/legacy/valloc.c
> +
> +$(eval $(call =
_libmusl_import_lib,legacy,$(LIBMUSL_LEGACY_HDRS-y),$(LIBMUSL_LEGACY_SRCS-=
y)))
> diff --git a/Makefile.uk.musl.linux b/Makefile.uk.musl.linux
> index 510f642..50dd483 100644
> --- a/Makefile.uk.musl.linux
> +++ b/Makefile.uk.musl.linux
> @@ -1,57 +1,97 @@
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/linux/adjtime.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/linux/adjtimex.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/linux/arch_prctl.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/linux/brk.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/linux/cache.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/linux/cap.c
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/linux/chroot.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/linux/clock_adjtime.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/linux/clone.c|linux
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/linux/epoll.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/linux/eventfd.c
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/linux/fallocate.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/linux/fanotify.c
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/linux/flock.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/linux/inotify.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/linux/ioperm.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/linux/iopl.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/linux/klogctl.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/linux/module.c
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/linux/mount.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/linux/personality.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/linux/pivot_root.c
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/linux/ppoll.c
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/linux/prctl.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/linux/prlimit.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/linux/process_vm.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/linux/ptrace.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/linux/quotactl.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/linux/readahead.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/linux/reboot.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/linux/remap_file_pages.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/linux/sbrk.c
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/linux/sendfile.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/linux/setfsgid.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/linux/setfsuid.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/linux/setgroups.c
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/linux/sethostname.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/linux/setns.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/linux/settimeofday.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/linux/signalfd.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/linux/splice.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/linux/stime.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/linux/swap.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/linux/sync_file_range.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/linux/syncfs.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/linux/sysinfo.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/linux/tee.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/linux/timerfd.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/linux/unshare.c
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/linux/utimes.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/linux/vhangup.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/linux/vmsplice.c
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/linux/wait3.c
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/linux/wait4.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/linux/xattr.c
> +LIBMUSL_LINUX_HDRS-y +=3D $(LIBMUSL)/include/errno.h
> +LIBMUSL_LINUX_HDRS-y +=3D $(LIBMUSL)/include/fcntl.h
> +LIBMUSL_LINUX_HDRS-y +=3D $(LIBMUSL)/src/internal/libc.h
> +LIBMUSL_LINUX_HDRS-y +=3D $(LIBMUSL)/include/poll.h
> +LIBMUSL_LINUX_HDRS-y +=3D $(LIBMUSL)/src/internal/pthread_impl.h
> +LIBMUSL_LINUX_HDRS-y +=3D $(LIBMUSL)/include/sched.h
> +LIBMUSL_LINUX_HDRS-y +=3D $(LIBMUSL)/include/signal.h
> +LIBMUSL_LINUX_HDRS-y +=3D $(LIBMUSL)/include/stdarg.h
> +LIBMUSL_LINUX_HDRS-y +=3D $(LIBMUSL)/include/stdint.h
> +LIBMUSL_LINUX_HDRS-y +=3D $(LIBMUSL)/src/internal/syscall.h
> +LIBMUSL_LINUX_HDRS-y +=3D $(LIBMUSL)/include/sys/epoll.h
> +LIBMUSL_LINUX_HDRS-y +=3D $(LIBMUSL)/include/sys/eventfd.h
> +LIBMUSL_LINUX_HDRS-y +=3D $(LIBMUSL)/include/sys/fanotify.h
> +LIBMUSL_LINUX_HDRS-y +=3D $(LIBMUSL)/include/sys/file.h
> +LIBMUSL_LINUX_HDRS-y +=3D $(LIBMUSL)/include/sys/fsuid.h
> +LIBMUSL_LINUX_HDRS-y +=3D $(LIBMUSL)/include/sys/inotify.h
> +LIBMUSL_LINUX_HDRS-y +=3D $(LIBMUSL)/include/sys/io.h
> +LIBMUSL_LINUX_HDRS-y +=3D $(LIBMUSL)/include/sys/klog.h
> +LIBMUSL_LINUX_HDRS-y +=3D $(LIBMUSL)/include/sys/mman.h
> +LIBMUSL_LINUX_HDRS-y +=3D $(LIBMUSL)/include/sys/mount.h
> +LIBMUSL_LINUX_HDRS-y +=3D $(LIBMUSL)/include/sys/personality.h
> +LIBMUSL_LINUX_HDRS-y +=3D $(LIBMUSL)/include/sys/prctl.h
> +LIBMUSL_LINUX_HDRS-y +=3D $(LIBMUSL)/include/sys/ptrace.h
> +LIBMUSL_LINUX_HDRS-y +=3D $(LIBMUSL)/include/sys/quota.h
> +LIBMUSL_LINUX_HDRS-y +=3D $(LIBMUSL)/include/sys/reboot.h
> +LIBMUSL_LINUX_HDRS-y +=3D $(LIBMUSL)/include/sys/resource.h
> +LIBMUSL_LINUX_HDRS-y +=3D $(LIBMUSL)/include/sys/sendfile.h
> +LIBMUSL_LINUX_HDRS-y +=3D $(LIBMUSL)/include/sys/signalfd.h
> +LIBMUSL_LINUX_HDRS-y +=3D $(LIBMUSL)/include/sys/swap.h
> +LIBMUSL_LINUX_HDRS-y +=3D $(LIBMUSL)/include/sys/sysinfo.h
> +LIBMUSL_LINUX_HDRS-y +=3D $(LIBMUSL)/include/sys/time.h
> +LIBMUSL_LINUX_HDRS-y +=3D $(LIBMUSL)/include/sys/timerfd.h
> +LIBMUSL_LINUX_HDRS-y +=3D $(LIBMUSL)/include/sys/timex.h
> +LIBMUSL_LINUX_HDRS-y +=3D $(LIBMUSL)/include/sys/uio.h
> +LIBMUSL_LINUX_HDRS-y +=3D $(LIBMUSL)/include/sys/wait.h
> +LIBMUSL_LINUX_HDRS-y +=3D $(LIBMUSL)/include/sys/xattr.h
> +LIBMUSL_LINUX_HDRS-y +=3D $(LIBMUSL)/include/time.h
> +LIBMUSL_LINUX_HDRS-y +=3D $(LIBMUSL)/include/unistd.h
>=20
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/linux/x32/sysinfo.c
> +LIBMUSL_LINUX_SRCS-y +=3D $(LIBMUSL)/src/linux/adjtime.c
> +LIBMUSL_LINUX_SRCS-y +=3D $(LIBMUSL)/src/linux/adjtimex.c
> +LIBMUSL_LINUX_SRCS-y +=3D $(LIBMUSL)/src/linux/arch_prctl.c
> +LIBMUSL_LINUX_SRCS-y +=3D $(LIBMUSL)/src/linux/brk.c
> +LIBMUSL_LINUX_SRCS-y +=3D $(LIBMUSL)/src/linux/cache.c
> +LIBMUSL_LINUX_SRCS-y +=3D $(LIBMUSL)/src/linux/cap.c
> +#LIBMUSL_LINUX_SRCS-y +=3D $(LIBMUSL)/src/linux/chroot.c
> +LIBMUSL_LINUX_SRCS-y +=3D $(LIBMUSL)/src/linux/clock_adjtime.c
> +LIBMUSL_LINUX_SRCS-y +=3D $(LIBMUSL)/src/linux/clone.c|linux
> +LIBMUSL_LINUX_SRCS-y +=3D $(LIBMUSL)/src/linux/epoll.c
> +LIBMUSL_LINUX_SRCS-y +=3D $(LIBMUSL)/src/linux/eventfd.c
> +#LIBMUSL_LINUX_SRCS-y +=3D $(LIBMUSL)/src/linux/fallocate.c
> +LIBMUSL_LINUX_SRCS-y +=3D $(LIBMUSL)/src/linux/fanotify.c
> +#LIBMUSL_LINUX_SRCS-y +=3D $(LIBMUSL)/src/linux/flock.c
> +LIBMUSL_LINUX_SRCS-y +=3D $(LIBMUSL)/src/linux/inotify.c
> +LIBMUSL_LINUX_SRCS-y +=3D $(LIBMUSL)/src/linux/ioperm.c
> +LIBMUSL_LINUX_SRCS-y +=3D $(LIBMUSL)/src/linux/iopl.c
> +LIBMUSL_LINUX_SRCS-y +=3D $(LIBMUSL)/src/linux/klogctl.c
> +LIBMUSL_LINUX_SRCS-y +=3D $(LIBMUSL)/src/linux/module.c
> +#LIBMUSL_LINUX_SRCS-y +=3D $(LIBMUSL)/src/linux/mount.c
> +LIBMUSL_LINUX_SRCS-y +=3D $(LIBMUSL)/src/linux/personality.c
> +LIBMUSL_LINUX_SRCS-y +=3D $(LIBMUSL)/src/linux/pivot_root.c
> +#LIBMUSL_LINUX_SRCS-y +=3D $(LIBMUSL)/src/linux/ppoll.c
> +#LIBMUSL_LINUX_SRCS-y +=3D $(LIBMUSL)/src/linux/prctl.c
> +LIBMUSL_LINUX_SRCS-y +=3D $(LIBMUSL)/src/linux/prlimit.c
> +LIBMUSL_LINUX_SRCS-y +=3D $(LIBMUSL)/src/linux/process_vm.c
> +LIBMUSL_LINUX_SRCS-y +=3D $(LIBMUSL)/src/linux/ptrace.c
> +LIBMUSL_LINUX_SRCS-y +=3D $(LIBMUSL)/src/linux/quotactl.c
> +LIBMUSL_LINUX_SRCS-y +=3D $(LIBMUSL)/src/linux/readahead.c
> +LIBMUSL_LINUX_SRCS-y +=3D $(LIBMUSL)/src/linux/reboot.c
> +LIBMUSL_LINUX_SRCS-y +=3D $(LIBMUSL)/src/linux/remap_file_pages.c
> +LIBMUSL_LINUX_SRCS-y +=3D $(LIBMUSL)/src/linux/sbrk.c
> +#LIBMUSL_LINUX_SRCS-y +=3D $(LIBMUSL)/src/linux/sendfile.c
> +LIBMUSL_LINUX_SRCS-y +=3D $(LIBMUSL)/src/linux/setfsgid.c
> +LIBMUSL_LINUX_SRCS-y +=3D $(LIBMUSL)/src/linux/setfsuid.c
> +LIBMUSL_LINUX_SRCS-y +=3D $(LIBMUSL)/src/linux/setgroups.c
> +#LIBMUSL_LINUX_SRCS-y +=3D $(LIBMUSL)/src/linux/sethostname.c
> +LIBMUSL_LINUX_SRCS-y +=3D $(LIBMUSL)/src/linux/setns.c
> +LIBMUSL_LINUX_SRCS-y +=3D $(LIBMUSL)/src/linux/settimeofday.c
> +LIBMUSL_LINUX_SRCS-y +=3D $(LIBMUSL)/src/linux/signalfd.c
> +LIBMUSL_LINUX_SRCS-y +=3D $(LIBMUSL)/src/linux/splice.c
> +LIBMUSL_LINUX_SRCS-y +=3D $(LIBMUSL)/src/linux/stime.c
> +LIBMUSL_LINUX_SRCS-y +=3D $(LIBMUSL)/src/linux/swap.c
> +LIBMUSL_LINUX_SRCS-y +=3D $(LIBMUSL)/src/linux/sync_file_range.c
> +LIBMUSL_LINUX_SRCS-y +=3D $(LIBMUSL)/src/linux/syncfs.c
> +LIBMUSL_LINUX_SRCS-y +=3D $(LIBMUSL)/src/linux/sysinfo.c
> +LIBMUSL_LINUX_SRCS-y +=3D $(LIBMUSL)/src/linux/tee.c
> +LIBMUSL_LINUX_SRCS-y +=3D $(LIBMUSL)/src/linux/timerfd.c
> +LIBMUSL_LINUX_SRCS-y +=3D $(LIBMUSL)/src/linux/unshare.c
> +#LIBMUSL_LINUX_SRCS-y +=3D $(LIBMUSL)/src/linux/utimes.c
> +LIBMUSL_LINUX_SRCS-y +=3D $(LIBMUSL)/src/linux/vhangup.c
> +LIBMUSL_LINUX_SRCS-y +=3D $(LIBMUSL)/src/linux/vmsplice.c
> +#LIBMUSL_LINUX_SRCS-y +=3D $(LIBMUSL)/src/linux/wait3.c
> +#LIBMUSL_LINUX_SRCS-y +=3D $(LIBMUSL)/src/linux/wait4.c
> +LIBMUSL_LINUX_SRCS-y +=3D $(LIBMUSL)/src/linux/xattr.c
> +#LIBMUSL_LINUX_SRCS-y +=3D $(LIBMUSL)/src/linux/x32/sysinfo.c
> +
> +$(eval $(call =
_libmusl_import_lib,linux,$(LIBMUSL_LINUX_HDRS-y),$(LIBMUSL_LINUX_SRCS-y))=
)
> diff --git a/Makefile.uk.musl.locale b/Makefile.uk.musl.locale
> index fd060d8..bffe0a2 100644
> --- a/Makefile.uk.musl.locale
> +++ b/Makefile.uk.musl.locale
> @@ -1,25 +1,57 @@
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/locale/__lctrans.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/locale/__mo_lookup.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/locale/bind_textdomain_codeset.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/locale/c_locale.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/locale/catclose.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/locale/catgets.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/locale/catopen.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/locale/dcngettext.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/locale/duplocale.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/locale/freelocale.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/locale/iconv.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/locale/iconv_close.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/locale/langinfo.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/locale/locale_map.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/locale/localeconv.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/locale/newlocale.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/locale/pleval.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/locale/setlocale.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/locale/strcoll.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/locale/strfmon.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/locale/strxfrm.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/locale/textdomain.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/locale/uselocale.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/locale/wcscoll.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/locale/wcsxfrm.c
> +LIBMUSL_LOCALE_HDRS-y +=3D $(LIBMUSL)/src/internal/atomic.h
> +LIBMUSL_LOCALE_HDRS-y +=3D $(LIBMUSL)/src/locale/big5.h
> +LIBMUSL_LOCALE_HDRS-y +=3D $(LIBMUSL)/src/locale/codepages.h
> +LIBMUSL_LOCALE_HDRS-y +=3D $(LIBMUSL)/include/ctype.h
> +LIBMUSL_LOCALE_HDRS-y +=3D $(LIBMUSL)/include/errno.h
> +LIBMUSL_LOCALE_HDRS-y +=3D $(LIBMUSL)/src/locale/gb18030.h
> +LIBMUSL_LOCALE_HDRS-y +=3D $(LIBMUSL)/src/locale/hkscs.h
> +LIBMUSL_LOCALE_HDRS-y +=3D $(LIBMUSL)/include/iconv.h
> +LIBMUSL_LOCALE_HDRS-y +=3D $(LIBMUSL)/src/locale/jis0208.h
> +LIBMUSL_LOCALE_HDRS-y +=3D $(LIBMUSL)/src/locale/ksc.h
> +LIBMUSL_LOCALE_HDRS-y +=3D $(LIBMUSL)/include/langinfo.h
> +LIBMUSL_LOCALE_HDRS-y +=3D $(LIBMUSL)/src/locale/legacychars.h
> +LIBMUSL_LOCALE_HDRS-y +=3D $(LIBMUSL)/src/internal/libc.h
> +LIBMUSL_LOCALE_HDRS-y +=3D $(LIBMUSL)/include/libintl.h
> +LIBMUSL_LOCALE_HDRS-y +=3D $(LIBMUSL)/include/limits.h
> +LIBMUSL_LOCALE_HDRS-y +=3D $(LIBMUSL)/include/locale.h
> +LIBMUSL_LOCALE_HDRS-y +=3D $(LIBMUSL)/src/internal/locale_impl.h
> +LIBMUSL_LOCALE_HDRS-y +=3D $(LIBMUSL)/include/monetary.h
> +LIBMUSL_LOCALE_HDRS-y +=3D $(LIBMUSL)/include/nl_types.h
> +LIBMUSL_LOCALE_HDRS-y +=3D $(LIBMUSL)/src/internal/pthread_impl.h
> +LIBMUSL_LOCALE_HDRS-y +=3D $(LIBMUSL)/src/locale/revjis.h
> +LIBMUSL_LOCALE_HDRS-y +=3D $(LIBMUSL)/include/stdarg.h
> +LIBMUSL_LOCALE_HDRS-y +=3D $(LIBMUSL)/include/stdint.h
> +LIBMUSL_LOCALE_HDRS-y +=3D $(LIBMUSL)/include/stdio.h
> +LIBMUSL_LOCALE_HDRS-y +=3D $(LIBMUSL)/include/stdlib.h
> +LIBMUSL_LOCALE_HDRS-y +=3D $(LIBMUSL)/include/string.h
> +LIBMUSL_LOCALE_HDRS-y +=3D $(LIBMUSL)/include/strings.h
> +LIBMUSL_LOCALE_HDRS-y +=3D $(LIBMUSL)/include/sys/stat.h
> +LIBMUSL_LOCALE_HDRS-y +=3D $(LIBMUSL)/include/wchar.h
> +
> +LIBMUSL_LOCALE_SRCS-y +=3D $(LIBMUSL)/src/locale/__lctrans.c
> +LIBMUSL_LOCALE_SRCS-y +=3D $(LIBMUSL)/src/locale/__mo_lookup.c
> +LIBMUSL_LOCALE_SRCS-y +=3D =
$(LIBMUSL)/src/locale/bind_textdomain_codeset.c
> +LIBMUSL_LOCALE_SRCS-y +=3D $(LIBMUSL)/src/locale/c_locale.c
> +LIBMUSL_LOCALE_SRCS-y +=3D $(LIBMUSL)/src/locale/catclose.c
> +LIBMUSL_LOCALE_SRCS-y +=3D $(LIBMUSL)/src/locale/catgets.c
> +LIBMUSL_LOCALE_SRCS-y +=3D $(LIBMUSL)/src/locale/catopen.c
> +LIBMUSL_LOCALE_SRCS-y +=3D $(LIBMUSL)/src/locale/dcngettext.c
> +LIBMUSL_LOCALE_SRCS-y +=3D $(LIBMUSL)/src/locale/duplocale.c
> +LIBMUSL_LOCALE_SRCS-y +=3D $(LIBMUSL)/src/locale/freelocale.c
> +LIBMUSL_LOCALE_SRCS-y +=3D $(LIBMUSL)/src/locale/iconv.c
> +LIBMUSL_LOCALE_SRCS-y +=3D $(LIBMUSL)/src/locale/iconv_close.c
> +LIBMUSL_LOCALE_SRCS-y +=3D $(LIBMUSL)/src/locale/langinfo.c
> +LIBMUSL_LOCALE_SRCS-y +=3D $(LIBMUSL)/src/locale/locale_map.c
> +LIBMUSL_LOCALE_SRCS-y +=3D $(LIBMUSL)/src/locale/localeconv.c
> +LIBMUSL_LOCALE_SRCS-y +=3D $(LIBMUSL)/src/locale/newlocale.c
> +LIBMUSL_LOCALE_SRCS-y +=3D $(LIBMUSL)/src/locale/pleval.c
> +LIBMUSL_LOCALE_SRCS-y +=3D $(LIBMUSL)/src/locale/setlocale.c
> +LIBMUSL_LOCALE_SRCS-y +=3D $(LIBMUSL)/src/locale/strcoll.c
> +LIBMUSL_LOCALE_SRCS-y +=3D $(LIBMUSL)/src/locale/strfmon.c
> +LIBMUSL_LOCALE_SRCS-y +=3D $(LIBMUSL)/src/locale/strxfrm.c
> +LIBMUSL_LOCALE_SRCS-y +=3D $(LIBMUSL)/src/locale/textdomain.c
> +LIBMUSL_LOCALE_SRCS-y +=3D $(LIBMUSL)/src/locale/uselocale.c
> +LIBMUSL_LOCALE_SRCS-y +=3D $(LIBMUSL)/src/locale/wcscoll.c
> +LIBMUSL_LOCALE_SRCS-y +=3D $(LIBMUSL)/src/locale/wcsxfrm.c
> +
> +$(eval $(call =
_libmusl_import_lib,locale,$(LIBMUSL_LOCALE_HDRS-y),$(LIBMUSL_LOCALE_SRCS-=
y)))
> diff --git a/Makefile.uk.musl.malloc b/Makefile.uk.musl.malloc
> index 1d2c4d5..1ae2fab 100644
> --- a/Makefile.uk.musl.malloc
> +++ b/Makefile.uk.musl.malloc
> @@ -1,9 +1,23 @@
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/malloc/__brk.c
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/malloc/aligned_alloc.c
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/malloc/calloc.c
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/malloc/expand_heap.c
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/malloc/lite_malloc.c
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/malloc/malloc.c
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/malloc/malloc_usable_size.c
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/malloc/memalign.c
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/malloc/posix_memalign.c
> +# LIBMUSL_MALLOC_HDRS-y +=3D $(LIBMUSL)/src/internal/atomic.h
> +# LIBMUSL_MALLOC_HDRS-y +=3D $(LIBMUSL)/include/errno.h
> +# LIBMUSL_MALLOC_HDRS-y +=3D $(LIBMUSL)/src/internal/libc.h
> +# LIBMUSL_MALLOC_HDRS-y +=3D $(LIBMUSL)/include/limits.h
> +# LIBMUSL_MALLOC_HDRS-y +=3D $(LIBMUSL)/include/malloc.h
> +# LIBMUSL_MALLOC_HDRS-y +=3D $(LIBMUSL)/src/internal/pthread_impl.h
> +# LIBMUSL_MALLOC_HDRS-y +=3D $(LIBMUSL)/include/stdint.h
> +# LIBMUSL_MALLOC_HDRS-y +=3D $(LIBMUSL)/include/stdlib.h
> +# LIBMUSL_MALLOC_HDRS-y +=3D $(LIBMUSL)/include/string.h
> +# LIBMUSL_MALLOC_HDRS-y +=3D $(LIBMUSL)/src/internal/syscall.h
> +# LIBMUSL_MALLOC_HDRS-y +=3D $(LIBMUSL)/include/sys/mman.h
> +
> +#LIBMUSL_MALLOC_SRCS-y +=3D $(LIBMUSL)/src/malloc/__brk.c
> +#LIBMUSL_MALLOC_SRCS-y +=3D $(LIBMUSL)/src/malloc/aligned_alloc.c
> +#LIBMUSL_MALLOC_SRCS-y +=3D $(LIBMUSL)/src/malloc/calloc.c
> +#LIBMUSL_MALLOC_SRCS-y +=3D $(LIBMUSL)/src/malloc/expand_heap.c
> +#LIBMUSL_MALLOC_SRCS-y +=3D $(LIBMUSL)/src/malloc/lite_malloc.c
> +#LIBMUSL_MALLOC_SRCS-y +=3D $(LIBMUSL)/src/malloc/malloc.c
> +#LIBMUSL_MALLOC_SRCS-y +=3D =
$(LIBMUSL)/src/malloc/malloc_usable_size.c
> +#LIBMUSL_MALLOC_SRCS-y +=3D $(LIBMUSL)/src/malloc/memalign.c
> +#LIBMUSL_MALLOC_SRCS-y +=3D $(LIBMUSL)/src/malloc/posix_memalign.c
> +
> +$(eval $(call =
_libmusl_import_lib,malloc,$(LIBMUSL_MALLOC_HDRS-y),$(LIBMUSL_MALLOC_SRCS-=
y)))
> diff --git a/Makefile.uk.musl.math b/Makefile.uk.musl.math
> index 682de34..37a4bb2 100644
> --- a/Makefile.uk.musl.math
> +++ b/Makefile.uk.musl.math
> @@ -1,462 +1,478 @@
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/__cos.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/__cosdf.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/__cosl.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/__expo2.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/__expo2f.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/__fpclassify.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/__fpclassifyf.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/__fpclassifyl.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/__invtrigl.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/__polevll.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/__rem_pio2.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/__rem_pio2_large.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/__rem_pio2f.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/__rem_pio2l.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/__signbit.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/__signbitf.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/__signbitl.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/__sin.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/__sindf.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/__sinl.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/__tan.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/__tandf.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/__tanl.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/acos.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/acosf.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/acosh.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/acoshf.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/acoshl.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/asin.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/asinf.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/asinh.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/asinhf.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/asinhl.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/atan.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/atan2.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/atan2f.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/atanf.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/atanh.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/atanhf.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/atanhl.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/cbrt.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/cbrtf.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/cbrtl.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/ceil.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/ceilf.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/copysign.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/copysignf.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/copysignl.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/cos.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/cosf.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/cosh.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/coshf.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/coshl.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/cosl.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/erf.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/erff.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/erfl.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/exp.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/exp10.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/exp10f.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/exp10l.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/exp2.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/exp2f.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/expf.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/expm1.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/expm1f.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/fdim.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/fdimf.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/fdiml.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/finite.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/finitef.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/floor.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/floorf.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/fma.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/fmaf.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/fmal.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/fmax.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/fmaxf.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/fmaxl.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/fmin.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/fminf.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/fminl.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/fmod.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/fmodf.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/frexp.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/frexpf.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/frexpl.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/hypot.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/hypotf.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/hypotl.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/scalb.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/scalbf.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/scalbln.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/scalblnf.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/scalblnl.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/scalbn.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/scalbnf.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/scalbnl.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/signgam.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/significand.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/significandf.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/sin.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/sincos.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/sincosf.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/sincosl.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/sinf.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/sinh.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/sinhf.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/sinhl.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/sinl.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/tan.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/tanf.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/tanh.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/tanhf.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/tanhl.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/tanl.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/tgamma.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/tgammaf.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/tgammal.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/trunc.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/truncf.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/ilogb.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/ilogbf.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/ilogbl.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/j0.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/j0f.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/j1.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/j1f.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/jn.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/jnf.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/ldexp.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/ldexpf.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/ldexpl.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/lgamma.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/lgamma_r.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/lgammaf.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/lgammaf_r.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/lgammal.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/llround.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/llroundf.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/llroundl.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/log.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/log10.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/log10f.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/log1p.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/log1pf.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/log2.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/log2f.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/logb.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/logbf.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/logbl.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/logf.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/lround.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/lroundf.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/lroundl.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/modf.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/modff.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/modfl.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/nan.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/nanf.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/nanl.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/nearbyint.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/nearbyintf.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/nearbyintl.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/nextafter.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/nextafterf.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/nextafterl.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/nexttoward.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/nexttowardf.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/nexttowardl.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/pow.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/powf.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/powl.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/remainder.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/remainderf.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/remquo.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/remquof.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/remquol.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/rint.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/rintf.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/round.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/roundf.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/roundl.c
> +LIBMUSL_MATH_HDRS-y +=3D $(LIBMUSL)/src/internal/atomic.h
> +LIBMUSL_MATH_HDRS-y +=3D $(LIBMUSL)/include/fenv.h
> +LIBMUSL_MATH_HDRS-y +=3D $(LIBMUSL)/include/float.h
> +LIBMUSL_MATH_HDRS-y +=3D $(LIBMUSL)/src/math/__invtrigl.h
> +LIBMUSL_MATH_HDRS-y +=3D $(LIBMUSL)/src/internal/libc.h
> +LIBMUSL_MATH_HDRS-y +=3D $(LIBMUSL)/src/internal/libm.h
> +LIBMUSL_MATH_HDRS-y +=3D $(LIBMUSL)/include/limits.h
> +LIBMUSL_MATH_HDRS-y +=3D $(LIBMUSL)/include/math.h
> +LIBMUSL_MATH_HDRS-y +=3D $(LIBMUSL)/include/stdint.h
> +LIBMUSL_MATH_HDRS-y +=3D $(LIBMUSL)/include/complex.h
> +LIBMUSL_MATH_HDRS-y +=3D $(LIBMUSL)/include/endian.h
> +
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/__cos.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/__cosdf.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/__cosl.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/__expo2.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/__expo2f.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/__fpclassify.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/__fpclassifyf.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/__fpclassifyl.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/__invtrigl.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/__polevll.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/__rem_pio2.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/__rem_pio2_large.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/__rem_pio2f.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/__rem_pio2l.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/__signbit.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/__signbitf.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/__signbitl.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/__sin.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/__sindf.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/__sinl.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/__tan.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/__tandf.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/__tanl.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/acos.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/acosf.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/acosh.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/acoshf.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/acoshl.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/asin.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/asinf.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/asinh.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/asinhf.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/asinhl.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/atan.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/atan2.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/atan2f.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/atanf.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/atanh.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/atanhf.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/atanhl.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/cbrt.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/cbrtf.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/cbrtl.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/ceil.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/ceilf.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/copysign.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/copysignf.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/copysignl.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/cos.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/cosf.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/cosh.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/coshf.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/coshl.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/cosl.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/erf.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/erff.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/erfl.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/exp.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/exp10.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/exp10f.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/exp10l.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/exp2.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/exp2f.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/expf.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/expm1.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/expm1f.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/fdim.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/fdimf.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/fdiml.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/finite.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/finitef.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/floor.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/floorf.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/fma.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/fmaf.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/fmal.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/fmax.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/fmaxf.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/fmaxl.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/fmin.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/fminf.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/fminl.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/fmod.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/fmodf.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/frexp.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/frexpf.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/frexpl.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/hypot.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/hypotf.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/hypotl.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/scalb.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/scalbf.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/scalbln.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/scalblnf.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/scalblnl.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/scalbn.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/scalbnf.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/scalbnl.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/signgam.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/significand.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/significandf.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/sin.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/sincos.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/sincosf.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/sincosl.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/sinf.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/sinh.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/sinhf.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/sinhl.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/sinl.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/tan.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/tanf.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/tanh.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/tanhf.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/tanhl.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/tanl.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/tgamma.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/tgammaf.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/tgammal.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/trunc.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/truncf.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/ilogb.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/ilogbf.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/ilogbl.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/j0.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/j0f.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/j1.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/j1f.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/jn.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/jnf.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/ldexp.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/ldexpf.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/ldexpl.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/lgamma.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/lgamma_r.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/lgammaf.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/lgammaf_r.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/lgammal.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/llround.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/llroundf.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/llroundl.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/log.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/log10.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/log10f.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/log1p.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/log1pf.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/log2.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/log2f.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/logb.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/logbf.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/logbl.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/logf.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/lround.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/lroundf.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/lroundl.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/modf.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/modff.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/modfl.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/nan.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/nanf.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/nanl.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/nearbyint.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/nearbyintf.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/nearbyintl.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/nextafter.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/nextafterf.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/nextafterl.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/nexttoward.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/nexttowardf.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/nexttowardl.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/pow.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/powf.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/powl.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/remainder.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/remainderf.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/remquo.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/remquof.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/remquol.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/rint.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/rintf.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/round.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/roundf.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/roundl.c
>=20
> ifeq (x86_32,$(CONFIG_UK_ARCH))
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/i386/__invtrigl.s|i386
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/i386/acos.s|i386
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/i386/acosf.s|i386
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/i386/acosl.s|i386
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/i386/asin.s|i386
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/i386/asinf.s|i386
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/i386/asinl.s|i386
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/i386/atan.s|i386
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/i386/atan2.s|i386
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/i386/atan2f.s|i386
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/i386/atan2l.s|i386
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/i386/atanf.s|i386
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/i386/atanl.s|i386
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/i386/ceil.s|i386
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/i386/ceilf.s|i386
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/i386/ceill.s|i386
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/i386/exp.s|i386
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/i386/exp2.s|i386
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/i386/exp2f.s|i386
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/i386/exp2l.s|i386
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/i386/expf.s|i386
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/i386/expl.s|i386
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/i386/expm1.s|i386
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/i386/expm1f.s|i386
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/i386/expm1l.s|i386
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/i386/fabs.s|i386
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/i386/fabsf.s|i386
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/i386/fabsl.s|i386
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/i386/floor.s|i386
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/i386/floorf.s|i386
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/i386/floorl.s|i386
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/i386/fmod.s|i386
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/i386/fmodf.s|i386
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/i386/fmodl.s|i386
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/i386/hypot.s|i386
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/i386/hypotf.s|i386
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/i386/ldexp.s|i386
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/i386/ldexpf.s|i386
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/i386/ldexpl.s|i386
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/i386/llrint.s|i386
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/i386/llrintf.s|i386
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/i386/llrintl.s|i386
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/i386/log.s|i386
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/i386/log10.s|i386
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/i386/log10f.s|i386
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/i386/log10l.s|i386
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/i386/log1p.s|i386
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/i386/log1pf.s|i386
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/i386/log1pl.s|i386
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/i386/log2.s|i386
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/i386/log2f.s|i386
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/i386/log2l.s|i386
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/i386/logf.s|i386
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/i386/logl.s|i386
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/i386/lrint.s|i386
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/i386/lrintf.s|i386
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/i386/lrintl.s|i386
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/i386/remainder.s|i386
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/i386/remainderf.s|i386
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/i386/remainderl.s|i386
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/i386/remquo.s|i386
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/i386/remquof.s|i386
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/i386/remquol.s|i386
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/i386/rint.s|i386
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/i386/rintf.s|i386
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/i386/rintl.s|i386
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/i386/scalbln.s|i386
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/i386/scalblnf.s|i386
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/i386/scalblnl.s|i386
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/i386/scalbn.s|i386
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/i386/scalbnf.s|i386
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/i386/scalbnl.s|i386
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/i386/sqrt.s|i386
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/i386/sqrtf.s|i386
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/i386/sqrtl.s|i386
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/i386/trunc.s|i386
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/i386/truncf.s|i386
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/i386/truncl.s|i386
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/i386/__invtrigl.s|i386
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/i386/acos.s|i386
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/i386/acosf.s|i386
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/i386/acosl.s|i386
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/i386/asin.s|i386
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/i386/asinf.s|i386
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/i386/asinl.s|i386
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/i386/atan.s|i386
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/i386/atan2.s|i386
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/i386/atan2f.s|i386
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/i386/atan2l.s|i386
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/i386/atanf.s|i386
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/i386/atanl.s|i386
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/i386/ceil.s|i386
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/i386/ceilf.s|i386
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/i386/ceill.s|i386
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/i386/exp.s|i386
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/i386/exp2.s|i386
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/i386/exp2f.s|i386
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/i386/exp2l.s|i386
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/i386/expf.s|i386
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/i386/expl.s|i386
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/i386/expm1.s|i386
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/i386/expm1f.s|i386
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/i386/expm1l.s|i386
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/i386/fabs.s|i386
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/i386/fabsf.s|i386
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/i386/fabsl.s|i386
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/i386/floor.s|i386
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/i386/floorf.s|i386
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/i386/floorl.s|i386
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/i386/fmod.s|i386
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/i386/fmodf.s|i386
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/i386/fmodl.s|i386
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/i386/hypot.s|i386
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/i386/hypotf.s|i386
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/i386/ldexp.s|i386
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/i386/ldexpf.s|i386
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/i386/ldexpl.s|i386
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/i386/llrint.s|i386
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/i386/llrintf.s|i386
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/i386/llrintl.s|i386
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/i386/log.s|i386
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/i386/log10.s|i386
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/i386/log10f.s|i386
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/i386/log10l.s|i386
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/i386/log1p.s|i386
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/i386/log1pf.s|i386
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/i386/log1pl.s|i386
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/i386/log2.s|i386
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/i386/log2f.s|i386
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/i386/log2l.s|i386
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/i386/logf.s|i386
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/i386/logl.s|i386
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/i386/lrint.s|i386
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/i386/lrintf.s|i386
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/i386/lrintl.s|i386
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/i386/remainder.s|i386
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/i386/remainderf.s|i386
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/i386/remainderl.s|i386
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/i386/remquo.s|i386
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/i386/remquof.s|i386
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/i386/remquol.s|i386
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/i386/rint.s|i386
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/i386/rintf.s|i386
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/i386/rintl.s|i386
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/i386/scalbln.s|i386
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/i386/scalblnf.s|i386
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/i386/scalblnl.s|i386
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/i386/scalbn.s|i386
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/i386/scalbnf.s|i386
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/i386/scalbnl.s|i386
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/i386/sqrt.s|i386
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/i386/sqrtf.s|i386
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/i386/sqrtl.s|i386
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/i386/trunc.s|i386
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/i386/truncf.s|i386
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/i386/truncl.s|i386
> else ifeq (x86_64,$(CONFIG_UK_ARCH))
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/x86_64/__invtrigl.s|x86_64
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/x86_64/acosl.s|x86_64
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/x86_64/asinl.s|x86_64
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/x86_64/atan2l.s|x86_64
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/x86_64/atanl.s|x86_64
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/x86_64/ceill.s|x86_64
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/x86_64/exp2l.s|x86_64
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/x86_64/expl.s|x86_64
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/x86_64/expm1l.s|x86_64
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/x86_64/fabs.s|x86_64
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/x86_64/fabsf.s|x86_64
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/x86_64/fabsl.s|x86_64
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/x86_64/floorl.s|x86_64
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/x86_64/fmodl.s|x86_64
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/x86_64/llrint.s|x86_64
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/x86_64/llrintf.s|x86_64
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/x86_64/llrintl.s|x86_64
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/x86_64/log10l.s|x86_64
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/x86_64/log1pl.s|x86_64
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/x86_64/log2l.s|x86_64
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/x86_64/logl.s|x86_64
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/x86_64/lrint.s|x86_64
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/x86_64/lrintf.s|x86_64
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/x86_64/lrintl.s|x86_64
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/x86_64/remainderl.s|x86_64
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/x86_64/rintl.s|x86_64
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/x86_64/sqrt.s|x86_64
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/x86_64/sqrtf.s|x86_64
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/x86_64/sqrtl.s|x86_64
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/x86_64/truncl.s|x86_64
> +LIBMUSL_MATH_SRCS-y +=3D =
$(LIBMUSL)/src/math/x86_64/__invtrigl.s|x86_64
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/x86_64/acosl.s|x86_64
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/x86_64/asinl.s|x86_64
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/x86_64/atan2l.s|x86_64
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/x86_64/atanl.s|x86_64
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/x86_64/ceill.s|x86_64
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/x86_64/exp2l.s|x86_64
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/x86_64/expl.s|x86_64
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/x86_64/expm1l.s|x86_64
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/x86_64/fabs.s|x86_64
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/x86_64/fabsf.s|x86_64
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/x86_64/fabsl.s|x86_64
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/x86_64/floorl.s|x86_64
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/x86_64/fmodl.s|x86_64
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/x86_64/llrint.s|x86_64
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/x86_64/llrintf.s|x86_64
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/x86_64/llrintl.s|x86_64
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/x86_64/log10l.s|x86_64
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/x86_64/log1pl.s|x86_64
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/x86_64/log2l.s|x86_64
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/x86_64/logl.s|x86_64
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/x86_64/lrint.s|x86_64
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/x86_64/lrintf.s|x86_64
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/x86_64/lrintl.s|x86_64
> +LIBMUSL_MATH_SRCS-y +=3D =
$(LIBMUSL)/src/math/x86_64/remainderl.s|x86_64
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/x86_64/rintl.s|x86_64
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/x86_64/sqrt.s|x86_64
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/x86_64/sqrtf.s|x86_64
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/x86_64/sqrtl.s|x86_64
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/x86_64/truncl.s|x86_64
> else ifeq (arm,$(CONFIG_UK_ARCH))
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/acosl.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/asinl.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/atan2l.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/atanl.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/expm1l.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/exp2l.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/expl.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/fabsl.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/floorl.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/ceill.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/truncl.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/fmodl.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/lrintf.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/llrint.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/llrintf.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/llrintl.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/log10l.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/log1pl.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/log2l.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/logl.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/lrint.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/lrintl.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/remainderl.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/rintl.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/sqrtl.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/arm/fabs.c|arm
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/arm/fabsf.c|arm
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/arm/sqrt.c|arm
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/arm/sqrtf.c|arm
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/acosl.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/asinl.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/atan2l.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/atanl.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/expm1l.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/exp2l.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/expl.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/fabsl.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/floorl.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/ceill.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/truncl.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/fmodl.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/lrintf.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/llrint.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/llrintf.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/llrintl.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/log10l.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/log1pl.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/log2l.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/logl.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/lrint.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/lrintl.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/remainderl.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/rintl.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/sqrtl.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/arm/fabs.c|arm
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/arm/fabsf.c|arm
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/arm/sqrt.c|arm
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/arm/sqrtf.c|arm
> else
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/acosl.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/asinl.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/atan2l.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/atanl.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/expm1l.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/exp2l.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/expl.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/fabsl.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/floorl.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/ceill.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/truncl.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/fmodl.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/lrintf.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/llrint.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/llrintf.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/llrintl.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/log10l.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/log1pl.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/log2l.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/logl.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/lrint.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/lrintl.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/remainderl.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/rintl.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/sqrtl.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/fabs.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/fabsf.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/sqrt.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/sqrtf.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/acosl.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/asinl.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/atan2l.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/atanl.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/expm1l.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/exp2l.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/expl.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/fabsl.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/floorl.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/ceill.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/truncl.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/fmodl.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/lrintf.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/llrint.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/llrintf.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/llrintl.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/log10l.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/log1pl.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/log2l.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/logl.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/lrint.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/lrintl.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/remainderl.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/rintl.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/sqrtl.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/fabs.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/fabsf.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/sqrt.c
> +LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/sqrtf.c
> endif
>=20
> -# LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/aarch64/ceil.c
> -# LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/aarch64/ceilf.c
> -# LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/aarch64/fabs.c
> -# LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/aarch64/fabsf.c
> -# LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/aarch64/floor.c
> -# LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/aarch64/floorf.c
> -# LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/aarch64/fma.c
> -# LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/aarch64/fmaf.c
> -# LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/aarch64/fmax.c
> -# LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/aarch64/fmaxf.c
> -# LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/aarch64/fmin.c
> -# LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/aarch64/fminf.c
> -# LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/aarch64/llrint.c
> -# LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/aarch64/llrintf.c
> -# LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/aarch64/llround.c
> -# LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/aarch64/llroundf.c
> -# LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/aarch64/lrint.c
> -# LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/aarch64/lrintf.c
> -# LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/aarch64/lround.c
> -# LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/aarch64/lroundf.c
> -# LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/aarch64/nearbyint.c
> -# LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/aarch64/nearbyintf.c
> -# LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/aarch64/rint.c
> -# LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/aarch64/rintf.c
> -# LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/aarch64/round.c
> -# LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/aarch64/roundf.c
> -# LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/aarch64/sqrt.c
> -# LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/aarch64/sqrtf.c
> -# LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/aarch64/trunc.c
> -# LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/aarch64/truncf.c
> -# LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/powerpc64/ceil.c
> -# LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/powerpc64/ceilf.c
> -# LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/powerpc64/fabs.c
> -# LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/powerpc64/fabsf.c
> -# LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/powerpc64/floor.c
> -# LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/powerpc64/floorf.c
> -# LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/powerpc64/fma.c
> -# LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/powerpc64/fmaf.c
> -# LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/powerpc64/fmax.c
> -# LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/powerpc64/fmaxf.c
> -# LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/powerpc64/fmin.c
> -# LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/powerpc64/fminf.c
> -# LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/powerpc64/lrint.c
> -# LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/powerpc64/lrintf.c
> -# LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/powerpc64/lround.c
> -# LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/powerpc64/lroundf.c
> -# LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/powerpc64/round.c
> -# LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/powerpc64/roundf.c
> -# LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/powerpc64/sqrt.c
> -# LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/powerpc64/sqrtf.c
> -# LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/powerpc64/trunc.c
> -# LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/powerpc64/truncf.c
> -# LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/s390x/ceil.c
> -# LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/s390x/ceilf.c
> -# LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/s390x/ceill.c
> -# LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/s390x/fabs.c
> -# LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/s390x/fabsf.c
> -# LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/s390x/fabsl.c
> -# LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/s390x/floor.c
> -# LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/s390x/floorf.c
> -# LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/s390x/floorl.c
> -# LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/s390x/nearbyint.c
> -# LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/s390x/nearbyintf.c
> -# LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/s390x/nearbyintl.c
> -# LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/s390x/rint.c
> -# LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/s390x/rintf.c
> -# LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/s390x/rintl.c
> -# LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/s390x/round.c
> -# LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/s390x/roundf.c
> -# LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/s390x/roundl.c
> -# LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/s390x/sqrt.c
> -# LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/s390x/sqrtf.c
> -# LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/s390x/sqrtl.c
> -# LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/s390x/trunc.c
> -# LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/s390x/truncf.c
> -# LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/s390x/truncl.c
> -# LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/x32/__invtrigl.s|x32
> -# LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/x32/acosl.s|x32
> -# LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/x32/asinl.s|x32
> -# LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/x32/atan2l.s|x32
> -# LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/x32/atanl.s|x32
> -# LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/x32/ceill.s|x32
> -# LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/x32/exp2l.s|x32
> -# LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/x32/expl.s|x32
> -# LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/x32/expm1l.s|x32
> -# LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/x32/fabs.s|x32
> -# LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/x32/fabsf.s|x32
> -# LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/x32/fabsl.s|x32
> -# LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/x32/floorl.s|x32
> -# LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/x32/fmodl.s|x32
> -# LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/x32/llrint.s|x32
> -# LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/x32/llrintf.s|x32
> -# LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/x32/llrintl.s|x32
> -# LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/x32/log10l.s|x32
> -# LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/x32/log1pl.s|x32
> -# LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/x32/log2l.s|x32
> -# LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/x32/logl.s|x32
> -# LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/x32/lrint.s|x32
> -# LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/x32/lrintf.s|x32
> -# LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/x32/lrintl.s|x32
> -# LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/x32/remainderl.s|x32
> -# LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/x32/rintl.s|x32
> -# LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/x32/sqrt.s|x32
> -# LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/x32/sqrtf.s|x32
> -# LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/x32/sqrtl.s|x32
> -# LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/math/x32/truncl.s|x32
> +# LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/aarch64/ceil.c
> +# LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/aarch64/ceilf.c
> +# LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/aarch64/fabs.c
> +# LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/aarch64/fabsf.c
> +# LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/aarch64/floor.c
> +# LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/aarch64/floorf.c
> +# LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/aarch64/fma.c
> +# LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/aarch64/fmaf.c
> +# LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/aarch64/fmax.c
> +# LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/aarch64/fmaxf.c
> +# LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/aarch64/fmin.c
> +# LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/aarch64/fminf.c
> +# LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/aarch64/llrint.c
> +# LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/aarch64/llrintf.c
> +# LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/aarch64/llround.c
> +# LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/aarch64/llroundf.c
> +# LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/aarch64/lrint.c
> +# LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/aarch64/lrintf.c
> +# LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/aarch64/lround.c
> +# LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/aarch64/lroundf.c
> +# LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/aarch64/nearbyint.c
> +# LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/aarch64/nearbyintf.c
> +# LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/aarch64/rint.c
> +# LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/aarch64/rintf.c
> +# LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/aarch64/round.c
> +# LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/aarch64/roundf.c
> +# LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/aarch64/sqrt.c
> +# LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/aarch64/sqrtf.c
> +# LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/aarch64/trunc.c
> +# LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/aarch64/truncf.c
> +# LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/powerpc64/ceil.c
> +# LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/powerpc64/ceilf.c
> +# LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/powerpc64/fabs.c
> +# LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/powerpc64/fabsf.c
> +# LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/powerpc64/floor.c
> +# LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/powerpc64/floorf.c
> +# LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/powerpc64/fma.c
> +# LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/powerpc64/fmaf.c
> +# LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/powerpc64/fmax.c
> +# LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/powerpc64/fmaxf.c
> +# LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/powerpc64/fmin.c
> +# LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/powerpc64/fminf.c
> +# LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/powerpc64/lrint.c
> +# LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/powerpc64/lrintf.c
> +# LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/powerpc64/lround.c
> +# LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/powerpc64/lroundf.c
> +# LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/powerpc64/round.c
> +# LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/powerpc64/roundf.c
> +# LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/powerpc64/sqrt.c
> +# LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/powerpc64/sqrtf.c
> +# LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/powerpc64/trunc.c
> +# LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/powerpc64/truncf.c
> +# LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/s390x/ceil.c
> +# LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/s390x/ceilf.c
> +# LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/s390x/ceill.c
> +# LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/s390x/fabs.c
> +# LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/s390x/fabsf.c
> +# LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/s390x/fabsl.c
> +# LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/s390x/floor.c
> +# LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/s390x/floorf.c
> +# LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/s390x/floorl.c
> +# LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/s390x/nearbyint.c
> +# LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/s390x/nearbyintf.c
> +# LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/s390x/nearbyintl.c
> +# LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/s390x/rint.c
> +# LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/s390x/rintf.c
> +# LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/s390x/rintl.c
> +# LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/s390x/round.c
> +# LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/s390x/roundf.c
> +# LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/s390x/roundl.c
> +# LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/s390x/sqrt.c
> +# LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/s390x/sqrtf.c
> +# LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/s390x/sqrtl.c
> +# LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/s390x/trunc.c
> +# LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/s390x/truncf.c
> +# LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/s390x/truncl.c
> +# LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/x32/__invtrigl.s|x32
> +# LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/x32/acosl.s|x32
> +# LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/x32/asinl.s|x32
> +# LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/x32/atan2l.s|x32
> +# LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/x32/atanl.s|x32
> +# LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/x32/ceill.s|x32
> +# LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/x32/exp2l.s|x32
> +# LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/x32/expl.s|x32
> +# LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/x32/expm1l.s|x32
> +# LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/x32/fabs.s|x32
> +# LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/x32/fabsf.s|x32
> +# LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/x32/fabsl.s|x32
> +# LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/x32/floorl.s|x32
> +# LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/x32/fmodl.s|x32
> +# LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/x32/llrint.s|x32
> +# LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/x32/llrintf.s|x32
> +# LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/x32/llrintl.s|x32
> +# LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/x32/log10l.s|x32
> +# LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/x32/log1pl.s|x32
> +# LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/x32/log2l.s|x32
> +# LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/x32/logl.s|x32
> +# LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/x32/lrint.s|x32
> +# LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/x32/lrintf.s|x32
> +# LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/x32/lrintl.s|x32
> +# LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/x32/remainderl.s|x32
> +# LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/x32/rintl.s|x32
> +# LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/x32/sqrt.s|x32
> +# LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/x32/sqrtf.s|x32
> +# LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/x32/sqrtl.s|x32
> +# LIBMUSL_MATH_SRCS-y +=3D $(LIBMUSL)/src/math/x32/truncl.s|x32
> +
> +# CINCLUDES-y +=3D -D_GNU_SOURCE
> +
> +$(eval $(call =
_libmusl_import_lib,math,$(LIBMUSL_MATH_HDRS-y),$(LIBMUSL_MATH_SRCS-y)))
> diff --git a/Makefile.uk.musl.misc b/Makefile.uk.musl.misc
> index da54093..d62c1ab 100644
> --- a/Makefile.uk.musl.misc
> +++ b/Makefile.uk.musl.misc
> @@ -1,38 +1,79 @@
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/misc/a64l.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/misc/basename.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/misc/dirname.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/misc/ffs.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/misc/ffsl.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/misc/ffsll.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/misc/fmtmsg.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/misc/forkpty.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/misc/get_current_dir_name.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/misc/getauxval.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/misc/getdomainname.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/misc/gethostid.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/misc/getopt.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/misc/getopt_long.c
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/misc/getpriority.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/misc/getresgid.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/misc/getresuid.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/misc/getrlimit.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/misc/getrusage.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/misc/getsubopt.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/misc/initgroups.c
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/misc/ioctl.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/misc/issetugid.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/misc/lockf.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/misc/login_tty.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/misc/mntent.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/misc/nftw.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/misc/openpty.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/misc/ptsname.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/misc/pty.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/misc/realpath.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/misc/setdomainname.c
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/misc/setpriority.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/misc/setrlimit.c
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/misc/syscall.c|misc
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/misc/syslog.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/misc/uname.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/misc/wordexp.c
> +LIBMUSL_MISC_HDRS-y +=3D $(LIBMUSL)/src/internal/atomic.h
> +LIBMUSL_MISC_HDRS-y +=3D $(LIBMUSL)/include/dirent.h
> +LIBMUSL_MISC_HDRS-y +=3D $(LIBMUSL)/include/errno.h
> +LIBMUSL_MISC_HDRS-y +=3D $(LIBMUSL)/include/fcntl.h
> +LIBMUSL_MISC_HDRS-y +=3D $(LIBMUSL)/include/fmtmsg.h
> +LIBMUSL_MISC_HDRS-y +=3D $(LIBMUSL)/include/ftw.h
> +LIBMUSL_MISC_HDRS-y +=3D $(LIBMUSL)/include/getopt.h
> +LIBMUSL_MISC_HDRS-y +=3D $(LIBMUSL)/include/grp.h
> +LIBMUSL_MISC_HDRS-y +=3D $(LIBMUSL)/src/internal/libc.h
> +LIBMUSL_MISC_HDRS-y +=3D $(LIBMUSL)/include/libgen.h
> +LIBMUSL_MISC_HDRS-y +=3D $(LIBMUSL)/include/limits.h
> +LIBMUSL_MISC_HDRS-y +=3D $(LIBMUSL)/src/internal/locale_impl.h
> +LIBMUSL_MISC_HDRS-y +=3D $(LIBMUSL)/include/mntent.h
> +LIBMUSL_MISC_HDRS-y +=3D $(LIBMUSL)/include/pthread.h
> +LIBMUSL_MISC_HDRS-y +=3D $(LIBMUSL)/src/internal/pthread_impl.h
> +LIBMUSL_MISC_HDRS-y +=3D $(LIBMUSL)/include/pty.h
> +LIBMUSL_MISC_HDRS-y +=3D $(LIBMUSL)/include/signal.h
> +LIBMUSL_MISC_HDRS-y +=3D $(LIBMUSL)/include/stdarg.h
> +LIBMUSL_MISC_HDRS-y +=3D $(LIBMUSL)/include/stddef.h
> +LIBMUSL_MISC_HDRS-y +=3D $(LIBMUSL)/include/stdint.h
> +LIBMUSL_MISC_HDRS-y +=3D $(LIBMUSL)/include/stdio.h
> +LIBMUSL_MISC_HDRS-y +=3D $(LIBMUSL)/include/stdlib.h
> +LIBMUSL_MISC_HDRS-y +=3D $(LIBMUSL)/include/string.h
> +LIBMUSL_MISC_HDRS-y +=3D $(LIBMUSL)/include/strings.h
> +LIBMUSL_MISC_HDRS-y +=3D $(LIBMUSL)/include/sys/auxv.h
> +LIBMUSL_MISC_HDRS-y +=3D $(LIBMUSL)/src/internal/syscall.h
> +LIBMUSL_MISC_HDRS-y +=3D $(LIBMUSL)/include/sys/ioctl.h
> +LIBMUSL_MISC_HDRS-y +=3D $(LIBMUSL)/include/syslog.h
> +LIBMUSL_MISC_HDRS-y +=3D $(LIBMUSL)/include/sys/resource.h
> +LIBMUSL_MISC_HDRS-y +=3D $(LIBMUSL)/include/sys/socket.h
> +LIBMUSL_MISC_HDRS-y +=3D $(LIBMUSL)/include/sys/stat.h
> +LIBMUSL_MISC_HDRS-y +=3D $(LIBMUSL)/include/sys/utsname.h
> +LIBMUSL_MISC_HDRS-y +=3D $(LIBMUSL)/include/sys/wait.h
> +LIBMUSL_MISC_HDRS-y +=3D $(LIBMUSL)/include/time.h
> +LIBMUSL_MISC_HDRS-y +=3D $(LIBMUSL)/include/unistd.h
> +LIBMUSL_MISC_HDRS-y +=3D $(LIBMUSL)/include/utmp.h
> +LIBMUSL_MISC_HDRS-y +=3D $(LIBMUSL)/include/wchar.h
> +LIBMUSL_MISC_HDRS-y +=3D $(LIBMUSL)/include/wordexp.h
> +
> +LIBMUSL_MISC_SRCS-y +=3D $(LIBMUSL)/src/misc/a64l.c
> +LIBMUSL_MISC_SRCS-y +=3D $(LIBMUSL)/src/misc/basename.c
> +LIBMUSL_MISC_SRCS-y +=3D $(LIBMUSL)/src/misc/dirname.c
> +LIBMUSL_MISC_SRCS-y +=3D $(LIBMUSL)/src/misc/ffs.c
> +LIBMUSL_MISC_SRCS-y +=3D $(LIBMUSL)/src/misc/ffsl.c
> +LIBMUSL_MISC_SRCS-y +=3D $(LIBMUSL)/src/misc/ffsll.c
> +LIBMUSL_MISC_SRCS-y +=3D $(LIBMUSL)/src/misc/fmtmsg.c
> +LIBMUSL_MISC_SRCS-y +=3D $(LIBMUSL)/src/misc/forkpty.c
> +LIBMUSL_MISC_SRCS-y +=3D $(LIBMUSL)/src/misc/get_current_dir_name.c
> +LIBMUSL_MISC_SRCS-y +=3D $(LIBMUSL)/src/misc/getauxval.c
> +LIBMUSL_MISC_SRCS-y +=3D $(LIBMUSL)/src/misc/getdomainname.c
> +LIBMUSL_MISC_SRCS-y +=3D $(LIBMUSL)/src/misc/gethostid.c
> +LIBMUSL_MISC_SRCS-y +=3D $(LIBMUSL)/src/misc/getopt.c
> +LIBMUSL_MISC_SRCS-y +=3D $(LIBMUSL)/src/misc/getopt_long.c
> +#LIBMUSL_MISC_SRCS-y +=3D $(LIBMUSL)/src/misc/getpriority.c
> +LIBMUSL_MISC_SRCS-y +=3D $(LIBMUSL)/src/misc/getresgid.c
> +LIBMUSL_MISC_SRCS-y +=3D $(LIBMUSL)/src/misc/getresuid.c
> +LIBMUSL_MISC_SRCS-y +=3D $(LIBMUSL)/src/misc/getrlimit.c
> +LIBMUSL_MISC_SRCS-y +=3D $(LIBMUSL)/src/misc/getrusage.c
> +LIBMUSL_MISC_SRCS-y +=3D $(LIBMUSL)/src/misc/getsubopt.c
> +LIBMUSL_MISC_SRCS-y +=3D $(LIBMUSL)/src/misc/initgroups.c
> +#LIBMUSL_MISC_SRCS-y +=3D $(LIBMUSL)/src/misc/ioctl.c
> +LIBMUSL_MISC_SRCS-y +=3D $(LIBMUSL)/src/misc/issetugid.c
> +LIBMUSL_MISC_SRCS-y +=3D $(LIBMUSL)/src/misc/lockf.c
> +LIBMUSL_MISC_SRCS-y +=3D $(LIBMUSL)/src/misc/login_tty.c
> +LIBMUSL_MISC_SRCS-y +=3D $(LIBMUSL)/src/misc/mntent.c
> +LIBMUSL_MISC_SRCS-y +=3D $(LIBMUSL)/src/misc/nftw.c
> +LIBMUSL_MISC_SRCS-y +=3D $(LIBMUSL)/src/misc/openpty.c
> +LIBMUSL_MISC_SRCS-y +=3D $(LIBMUSL)/src/misc/ptsname.c
> +LIBMUSL_MISC_SRCS-y +=3D $(LIBMUSL)/src/misc/pty.c
> +LIBMUSL_MISC_SRCS-y +=3D $(LIBMUSL)/src/misc/realpath.c
> +LIBMUSL_MISC_SRCS-y +=3D $(LIBMUSL)/src/misc/setdomainname.c
> +#LIBMUSL_MISC_SRCS-y +=3D $(LIBMUSL)/src/misc/setpriority.c
> +LIBMUSL_MISC_SRCS-y +=3D $(LIBMUSL)/src/misc/setrlimit.c
> +#LIBMUSL_MISC_SRCS-y +=3D $(LIBMUSL)/src/misc/syscall.c|misc
> +LIBMUSL_MISC_SRCS-y +=3D $(LIBMUSL)/src/misc/syslog.c
> +LIBMUSL_MISC_SRCS-y +=3D $(LIBMUSL)/src/misc/uname.c
> +LIBMUSL_MISC_SRCS-y +=3D $(LIBMUSL)/src/misc/wordexp.c
> +
> +$(eval $(call =
_libmusl_import_lib,misc,$(LIBMUSL_MISC_HDRS-y),$(LIBMUSL_MISC_SRCS-y)))
> diff --git a/Makefile.uk.musl.mman b/Makefile.uk.musl.mman
> index c989771..c64bc9d 100644
> --- a/Makefile.uk.musl.mman
> +++ b/Makefile.uk.musl.mman
> @@ -1,13 +1,36 @@
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/mman/madvise.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/mman/mincore.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/mman/mlock.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/mman/mlockall.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/mman/mmap.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/mman/mprotect.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/mman/mremap.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/mman/msync.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/mman/munlock.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/mman/munlockall.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/mman/munmap.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/mman/posix_madvise.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/mman/shm_open.c
> +LIBMUSL_MMAN_HDRS-y +=3D $(LIBMUSL)/include/errno.h
> +LIBMUSL_MMAN_HDRS-y +=3D $(LIBMUSL)/include/fcntl.h
> +LIBMUSL_MMAN_HDRS-y +=3D $(LIBMUSL)/src/internal/libc.h
> +LIBMUSL_MMAN_HDRS-y +=3D $(LIBMUSL)/include/limits.h
> +LIBMUSL_MMAN_HDRS-y +=3D $(LIBMUSL)/include/pthread.h
> +LIBMUSL_MMAN_HDRS-y +=3D $(LIBMUSL)/include/stdarg.h
> +LIBMUSL_MMAN_HDRS-y +=3D $(LIBMUSL)/include/stdint.h
> +LIBMUSL_MMAN_HDRS-y +=3D $(LIBMUSL)/include/string.h
> +LIBMUSL_MMAN_HDRS-y +=3D $(LIBMUSL)/src/internal/syscall.h
> +LIBMUSL_MMAN_HDRS-y +=3D $(LIBMUSL)/include/sys/syscall.h
> +LIBMUSL_MMAN_HDRS-y +=3D $(LIBMUSL)/include/sys/mman.h
> +LIBMUSL_MMAN_HDRS-y +=3D $(LIBMUSL)/include/unistd.h
> +
> +# ifeq (arm,$(ARCH))
> +# LIBMUSL_SIGNAL_HDRS-y +=3D $(LIBMUSL)/arch/arm/syscall_arch.h
> +# else ifeq (x86_32,$(ARCH))
> +# LIBMUSL_SIGNAL_HDRS-y +=3D $(LIBMUSL)/arch/i386/syscall_arch.h
> +# else ifeq (x86_64,$(ARCH))
> +# LIBMUSL_SIGNAL_HDRS-y +=3D $(LIBMUSL)/arch/x86_64/syscall_arch.h
> +# endif
> +
> +LIBMUSL_MMAN_SRCS-y +=3D $(LIBMUSL)/src/mman/madvise.c
> +LIBMUSL_MMAN_SRCS-y +=3D $(LIBMUSL)/src/mman/mincore.c
> +LIBMUSL_MMAN_SRCS-y +=3D $(LIBMUSL)/src/mman/mlock.c
> +LIBMUSL_MMAN_SRCS-y +=3D $(LIBMUSL)/src/mman/mlockall.c
> +LIBMUSL_MMAN_SRCS-y +=3D $(LIBMUSL)/src/mman/mmap.c
> +LIBMUSL_MMAN_SRCS-y +=3D $(LIBMUSL)/src/mman/mprotect.c
> +LIBMUSL_MMAN_SRCS-y +=3D $(LIBMUSL)/src/mman/mremap.c
> +LIBMUSL_MMAN_SRCS-y +=3D $(LIBMUSL)/src/mman/msync.c
> +LIBMUSL_MMAN_SRCS-y +=3D $(LIBMUSL)/src/mman/munlock.c
> +LIBMUSL_MMAN_SRCS-y +=3D $(LIBMUSL)/src/mman/munlockall.c
> +LIBMUSL_MMAN_SRCS-y +=3D $(LIBMUSL)/src/mman/munmap.c
> +LIBMUSL_MMAN_SRCS-y +=3D $(LIBMUSL)/src/mman/posix_madvise.c
> +LIBMUSL_MMAN_SRCS-y +=3D $(LIBMUSL)/src/mman/shm_open.c
> +
> +$(eval $(call =
_libmusl_import_lib,mman,$(LIBMUSL_MMAN_HDRS-y),$(LIBMUSL_MMAN_SRCS-y)))
> diff --git a/Makefile.uk.musl.mq b/Makefile.uk.musl.mq
> index 24da79c..48ec5f8 100644
> --- a/Makefile.uk.musl.mq
> +++ b/Makefile.uk.musl.mq
> @@ -1,10 +1,22 @@
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/mq/mq_close.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/mq/mq_getattr.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/mq/mq_notify.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/mq/mq_open.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/mq/mq_receive.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/mq/mq_send.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/mq/mq_setattr.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/mq/mq_timedreceive.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/mq/mq_timedsend.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/mq/mq_unlink.c
> +LIBMUSL_MQ_HDRS-y +=3D $(LIBMUSL)/include/errno.h
> +LIBMUSL_MQ_HDRS-y +=3D $(LIBMUSL)/include/fcntl.h
> +LIBMUSL_MQ_HDRS-y +=3D $(LIBMUSL)/include/mqueue.h
> +LIBMUSL_MQ_HDRS-y +=3D $(LIBMUSL)/include/pthread.h
> +LIBMUSL_MQ_HDRS-y +=3D $(LIBMUSL)/include/signal.h
> +LIBMUSL_MQ_HDRS-y +=3D $(LIBMUSL)/include/stdarg.h
> +LIBMUSL_MQ_HDRS-y +=3D $(LIBMUSL)/src/internal/syscall.h
> +LIBMUSL_MQ_HDRS-y +=3D $(LIBMUSL)/include/sys/socket.h
> +LIBMUSL_MQ_HDRS-y +=3D $(LIBMUSL)/include/unistd.h
> +
> +LIBMUSL_MQ_SRCS-y +=3D $(LIBMUSL)/src/mq/mq_close.c
> +LIBMUSL_MQ_SRCS-y +=3D $(LIBMUSL)/src/mq/mq_getattr.c
> +LIBMUSL_MQ_SRCS-y +=3D $(LIBMUSL)/src/mq/mq_notify.c
> +LIBMUSL_MQ_SRCS-y +=3D $(LIBMUSL)/src/mq/mq_open.c
> +LIBMUSL_MQ_SRCS-y +=3D $(LIBMUSL)/src/mq/mq_receive.c
> +LIBMUSL_MQ_SRCS-y +=3D $(LIBMUSL)/src/mq/mq_send.c
> +LIBMUSL_MQ_SRCS-y +=3D $(LIBMUSL)/src/mq/mq_setattr.c
> +LIBMUSL_MQ_SRCS-y +=3D $(LIBMUSL)/src/mq/mq_timedreceive.c
> +LIBMUSL_MQ_SRCS-y +=3D $(LIBMUSL)/src/mq/mq_timedsend.c
> +LIBMUSL_MQ_SRCS-y +=3D $(LIBMUSL)/src/mq/mq_unlink.c
> +
> +$(eval $(call =
_libmusl_import_lib,mq,$(LIBMUSL_MQ_HDRS-y),$(LIBMUSL_MQ_SRCS-y)))
> diff --git a/Makefile.uk.musl.multibyte b/Makefile.uk.musl.multibyte
> index fed5400..b4418eb 100644
> --- a/Makefile.uk.musl.multibyte
> +++ b/Makefile.uk.musl.multibyte
> @@ -1,20 +1,31 @@
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/multibyte/btowc.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/multibyte/c16rtomb.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/multibyte/c32rtomb.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/multibyte/internal.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/multibyte/mblen.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/multibyte/mbrlen.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/multibyte/mbrtoc16.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/multibyte/mbrtoc32.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/multibyte/mbrtowc.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/multibyte/mbsinit.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/multibyte/mbsnrtowcs.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/multibyte/mbsrtowcs.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/multibyte/mbstowcs.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/multibyte/mbtowc.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/multibyte/wcrtomb.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/multibyte/wcsnrtombs.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/multibyte/wcsrtombs.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/multibyte/wcstombs.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/multibyte/wctob.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/multibyte/wctomb.c
> +LIBMUSL_MULTIBYTE_HDRS-y +=3D $(LIBMUSL)/include/errno.h
> +LIBMUSL_MULTIBYTE_HDRS-y +=3D $(LIBMUSL)/src/multibyte/internal.h
> +LIBMUSL_MULTIBYTE_HDRS-y +=3D $(LIBMUSL)/include/stdint.h
> +LIBMUSL_MULTIBYTE_HDRS-y +=3D $(LIBMUSL)/include/stdio.h
> +LIBMUSL_MULTIBYTE_HDRS-y +=3D $(LIBMUSL)/include/stdlib.h
> +LIBMUSL_MULTIBYTE_HDRS-y +=3D $(LIBMUSL)/include/string.h
> +LIBMUSL_MULTIBYTE_HDRS-y +=3D $(LIBMUSL)/include/uchar.h
> +LIBMUSL_MULTIBYTE_HDRS-y +=3D $(LIBMUSL)/include/wchar.h
> +
> +LIBMUSL_MULTIBYTE_SRCS-y +=3D $(LIBMUSL)/src/multibyte/btowc.c
> +LIBMUSL_MULTIBYTE_SRCS-y +=3D $(LIBMUSL)/src/multibyte/c16rtomb.c
> +LIBMUSL_MULTIBYTE_SRCS-y +=3D $(LIBMUSL)/src/multibyte/c32rtomb.c
> +LIBMUSL_MULTIBYTE_SRCS-y +=3D $(LIBMUSL)/src/multibyte/internal.c
> +LIBMUSL_MULTIBYTE_SRCS-y +=3D $(LIBMUSL)/src/multibyte/mblen.c
> +LIBMUSL_MULTIBYTE_SRCS-y +=3D $(LIBMUSL)/src/multibyte/mbrlen.c
> +LIBMUSL_MULTIBYTE_SRCS-y +=3D $(LIBMUSL)/src/multibyte/mbrtoc16.c
> +LIBMUSL_MULTIBYTE_SRCS-y +=3D $(LIBMUSL)/src/multibyte/mbrtoc32.c
> +LIBMUSL_MULTIBYTE_SRCS-y +=3D $(LIBMUSL)/src/multibyte/mbrtowc.c
> +LIBMUSL_MULTIBYTE_SRCS-y +=3D $(LIBMUSL)/src/multibyte/mbsinit.c
> +LIBMUSL_MULTIBYTE_SRCS-y +=3D $(LIBMUSL)/src/multibyte/mbsnrtowcs.c
> +LIBMUSL_MULTIBYTE_SRCS-y +=3D $(LIBMUSL)/src/multibyte/mbsrtowcs.c
> +LIBMUSL_MULTIBYTE_SRCS-y +=3D $(LIBMUSL)/src/multibyte/mbstowcs.c
> +LIBMUSL_MULTIBYTE_SRCS-y +=3D $(LIBMUSL)/src/multibyte/mbtowc.c
> +LIBMUSL_MULTIBYTE_SRCS-y +=3D $(LIBMUSL)/src/multibyte/wcrtomb.c
> +LIBMUSL_MULTIBYTE_SRCS-y +=3D $(LIBMUSL)/src/multibyte/wcsnrtombs.c
> +LIBMUSL_MULTIBYTE_SRCS-y +=3D $(LIBMUSL)/src/multibyte/wcsrtombs.c
> +LIBMUSL_MULTIBYTE_SRCS-y +=3D $(LIBMUSL)/src/multibyte/wcstombs.c
> +LIBMUSL_MULTIBYTE_SRCS-y +=3D $(LIBMUSL)/src/multibyte/wctob.c
> +LIBMUSL_MULTIBYTE_SRCS-y +=3D $(LIBMUSL)/src/multibyte/wctomb.c
> +
> +$(eval $(call =
_libmusl_import_lib,multibyte,$(LIBMUSL_MULTIBYTE_HDRS-y),$(LIBMUSL_MULTIB=
YTE_SRCS-y)))
> diff --git a/Makefile.uk.musl.network b/Makefile.uk.musl.network
> index b0879a3..bf65608 100644
> --- a/Makefile.uk.musl.network
> +++ b/Makefile.uk.musl.network
> @@ -1,77 +1,115 @@
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/network/accept.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/network/accept4.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/network/bind.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/network/connect.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/network/dn_comp.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/network/dn_expand.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/network/dn_skipname.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/network/dns_parse.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/network/ent.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/network/ether.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/network/freeaddrinfo.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/network/gai_strerror.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/network/getaddrinfo.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/network/gethostbyaddr.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/network/gethostbyaddr_r.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/network/gethostbyname.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/network/gethostbyname2.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/network/gethostbyname2_r.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/network/gethostbyname_r.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/network/getifaddrs.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/network/getnameinfo.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/network/getpeername.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/network/getservbyname.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/network/getservbyname_r.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/network/getservbyport.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/network/getservbyport_r.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/network/getsockname.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/network/getsockopt.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/network/h_errno.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/network/herror.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/network/hstrerror.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/network/htonl.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/network/htons.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/network/if_freenameindex.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/network/if_indextoname.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/network/if_nameindex.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/network/if_nametoindex.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/network/in6addr_any.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/network/in6addr_loopback.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/network/inet_addr.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/network/inet_aton.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/network/inet_legacy.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/network/inet_ntoa.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/network/inet_ntop.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/network/inet_pton.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/network/listen.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/network/lookup_ipliteral.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/network/lookup_name.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/network/lookup_serv.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/network/netlink.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/network/netname.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/network/ns_parse.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/network/ntohl.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/network/ntohs.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/network/proto.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/network/recv.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/network/recvfrom.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/network/recvmmsg.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/network/recvmsg.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/network/res_init.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/network/res_mkquery.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/network/res_msend.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/network/res_query.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/network/res_querydomain.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/network/res_send.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/network/res_state.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/network/resolvconf.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/network/send.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/network/sendmmsg.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/network/sendmsg.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/network/sendto.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/network/serv.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/network/setsockopt.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/network/shutdown.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/network/sockatmark.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/network/socket.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/network/socketpair.c
> +LIBMUSL_NETWORK_HDRS-y +=3D $(LIBMUSL)/include/arpa/inet.h
> +LIBMUSL_NETWORK_HDRS-y +=3D $(LIBMUSL)/include/arpa/nameser.h
> +LIBMUSL_NETWORK_HDRS-y +=3D $(LIBMUSL)/include/byteswap.h
> +LIBMUSL_NETWORK_HDRS-y +=3D $(LIBMUSL)/include/ctype.h
> +LIBMUSL_NETWORK_HDRS-y +=3D $(LIBMUSL)/include/errno.h
> +LIBMUSL_NETWORK_HDRS-y +=3D $(LIBMUSL)/include/fcntl.h
> +LIBMUSL_NETWORK_HDRS-y +=3D $(LIBMUSL)/include/ifaddrs.h
> +LIBMUSL_NETWORK_HDRS-y +=3D $(LIBMUSL)/include/inttypes.h
> +LIBMUSL_NETWORK_HDRS-y +=3D $(LIBMUSL)/src/internal/libc.h
> +LIBMUSL_NETWORK_HDRS-y +=3D $(LIBMUSL)/include/limits.h
> +LIBMUSL_NETWORK_HDRS-y +=3D $(LIBMUSL)/src/internal/locale_impl.h
> +LIBMUSL_NETWORK_HDRS-y +=3D $(LIBMUSL)/src/network/lookup.h
> +LIBMUSL_NETWORK_HDRS-y +=3D $(LIBMUSL)/include/netdb.h
> +LIBMUSL_NETWORK_HDRS-y +=3D $(LIBMUSL)/include/net/if.h
> +LIBMUSL_NETWORK_HDRS-y +=3D $(LIBMUSL)/include/netinet/ether.h
> +LIBMUSL_NETWORK_HDRS-y +=3D $(LIBMUSL)/include/netinet/in.h
> +LIBMUSL_NETWORK_HDRS-y +=3D $(LIBMUSL)/src/network/netlink.h
> +LIBMUSL_NETWORK_HDRS-y +=3D $(LIBMUSL)/include/poll.h
> +LIBMUSL_NETWORK_HDRS-y +=3D $(LIBMUSL)/include/pthread.h
> +LIBMUSL_NETWORK_HDRS-y +=3D $(LIBMUSL)/include/resolv.h
> +LIBMUSL_NETWORK_HDRS-y +=3D $(LIBMUSL)/include/stddef.h
> +LIBMUSL_NETWORK_HDRS-y +=3D $(LIBMUSL)/include/stdint.h
> +LIBMUSL_NETWORK_HDRS-y +=3D $(LIBMUSL)/include/stdio.h
> +LIBMUSL_NETWORK_HDRS-y +=3D $(LIBMUSL)/src/internal/stdio_impl.h
> +LIBMUSL_NETWORK_HDRS-y +=3D $(LIBMUSL)/include/stdlib.h
> +LIBMUSL_NETWORK_HDRS-y +=3D $(LIBMUSL)/include/string.h
> +LIBMUSL_NETWORK_HDRS-y +=3D $(LIBMUSL)/src/internal/syscall.h
> +LIBMUSL_NETWORK_HDRS-y +=3D $(LIBMUSL)/include/sys/ioctl.h
> +LIBMUSL_NETWORK_HDRS-y +=3D $(LIBMUSL)/include/time.h
> +LIBMUSL_NETWORK_HDRS-y +=3D $(LIBMUSL)/include/unistd.h
> +
> +ifneq ($(CONFIG_LIBPOSIX_SOCKET),y)
> +LIBMUSL_NETWORK_HDRS-y +=3D $(LIBMUSL)/include/sys/socket.h
> +
> +LIBMUSL_NETWORK_SRCS-y +=3D $(LIBMUSL)/src/network/socket.c
> +LIBMUSL_NETWORK_SRCS-y +=3D $(LIBMUSL)/src/network/accept.c
> +LIBMUSL_NETWORK_SRCS-y +=3D $(LIBMUSL)/src/network/accept4.c
> +LIBMUSL_NETWORK_SRCS-y +=3D $(LIBMUSL)/src/network/bind.c
> +LIBMUSL_NETWORK_SRCS-y +=3D $(LIBMUSL)/src/network/shutdown.c
> +LIBMUSL_NETWORK_SRCS-y +=3D $(LIBMUSL)/src/network/getpeername.c
> +LIBMUSL_NETWORK_SRCS-y +=3D $(LIBMUSL)/src/network/getsockname.c
> +LIBMUSL_NETWORK_SRCS-y +=3D $(LIBMUSL)/src/network/getsockopt.c
> +LIBMUSL_NETWORK_SRCS-y +=3D $(LIBMUSL)/src/network/setsockopt.c
> +LIBMUSL_NETWORK_SRCS-y +=3D $(LIBMUSL)/src/network/connect.c
> +LIBMUSL_NETWORK_SRCS-y +=3D $(LIBMUSL)/src/network/listen.c
> +LIBMUSL_NETWORK_SRCS-y +=3D $(LIBMUSL)/src/network/recv.c
> +LIBMUSL_NETWORK_SRCS-y +=3D $(LIBMUSL)/src/network/recvfrom.c
> +# LIBMUSL_NETWORK_SRCS-y +=3D $(LIBMUSL)/src/network/recvmmsg.c
> +LIBMUSL_NETWORK_SRCS-y +=3D $(LIBMUSL)/src/network/recvmsg.c
> +LIBMUSL_NETWORK_SRCS-y +=3D $(LIBMUSL)/src/network/send.c
> +LIBMUSL_NETWORK_SRCS-y +=3D $(LIBMUSL)/src/network/sendmsg.c
> +# LIBMUSL_NETWORK_SRCS-y +=3D $(LIBMUSL)/src/network/sendmmsg.c
> +LIBMUSL_NETWORK_SRCS-y +=3D $(LIBMUSL)/src/network/sendto.c
> +LIBMUSL_NETWORK_SRCS-y +=3D $(LIBMUSL)/src/network/socketpair.c
> +endif
> +
> +LIBMUSL_NETWORK_SRCS-y +=3D $(LIBMUSL)/src/network/dn_comp.c
> +LIBMUSL_NETWORK_SRCS-y +=3D $(LIBMUSL)/src/network/dn_expand.c
> +LIBMUSL_NETWORK_SRCS-y +=3D $(LIBMUSL)/src/network/dn_skipname.c
> +LIBMUSL_NETWORK_SRCS-y +=3D $(LIBMUSL)/src/network/dns_parse.c
> +LIBMUSL_NETWORK_SRCS-y +=3D $(LIBMUSL)/src/network/ent.c
> +LIBMUSL_NETWORK_SRCS-y +=3D $(LIBMUSL)/src/network/ether.c
> +LIBMUSL_NETWORK_SRCS-y +=3D $(LIBMUSL)/src/network/freeaddrinfo.c
> +LIBMUSL_NETWORK_SRCS-y +=3D $(LIBMUSL)/src/network/gai_strerror.c
> +LIBMUSL_NETWORK_SRCS-y +=3D $(LIBMUSL)/src/network/getaddrinfo.c
> +LIBMUSL_NETWORK_SRCS-y +=3D $(LIBMUSL)/src/network/gethostbyaddr.c
> +LIBMUSL_NETWORK_SRCS-y +=3D $(LIBMUSL)/src/network/gethostbyaddr_r.c
> +LIBMUSL_NETWORK_SRCS-y +=3D $(LIBMUSL)/src/network/gethostbyname.c
> +LIBMUSL_NETWORK_SRCS-y +=3D $(LIBMUSL)/src/network/gethostbyname2.c
> +LIBMUSL_NETWORK_SRCS-y +=3D $(LIBMUSL)/src/network/gethostbyname2_r.c
> +LIBMUSL_NETWORK_SRCS-y +=3D $(LIBMUSL)/src/network/gethostbyname_r.c
> +LIBMUSL_NETWORK_SRCS-y +=3D $(LIBMUSL)/src/network/getifaddrs.c
> +LIBMUSL_NETWORK_SRCS-y +=3D $(LIBMUSL)/src/network/getnameinfo.c
> +LIBMUSL_NETWORK_SRCS-y +=3D $(LIBMUSL)/src/network/getservbyname.c
> +LIBMUSL_NETWORK_SRCS-y +=3D $(LIBMUSL)/src/network/getservbyname_r.c
> +LIBMUSL_NETWORK_SRCS-y +=3D $(LIBMUSL)/src/network/getservbyport.c
> +LIBMUSL_NETWORK_SRCS-y +=3D $(LIBMUSL)/src/network/getservbyport_r.c
> +LIBMUSL_NETWORK_SRCS-y +=3D $(LIBMUSL)/src/network/h_errno.c
> +LIBMUSL_NETWORK_SRCS-y +=3D $(LIBMUSL)/src/network/herror.c
> +LIBMUSL_NETWORK_SRCS-y +=3D $(LIBMUSL)/src/network/hstrerror.c
> +LIBMUSL_NETWORK_SRCS-y +=3D $(LIBMUSL)/src/network/htonl.c
> +LIBMUSL_NETWORK_SRCS-y +=3D $(LIBMUSL)/src/network/htons.c
> +LIBMUSL_NETWORK_SRCS-y +=3D $(LIBMUSL)/src/network/if_freenameindex.c
> +LIBMUSL_NETWORK_SRCS-y +=3D $(LIBMUSL)/src/network/if_indextoname.c
> +LIBMUSL_NETWORK_SRCS-y +=3D $(LIBMUSL)/src/network/if_nameindex.c
> +LIBMUSL_NETWORK_SRCS-y +=3D $(LIBMUSL)/src/network/if_nametoindex.c
> +LIBMUSL_NETWORK_SRCS-y +=3D $(LIBMUSL)/src/network/in6addr_any.c
> +LIBMUSL_NETWORK_SRCS-y +=3D $(LIBMUSL)/src/network/in6addr_loopback.c
> +LIBMUSL_NETWORK_SRCS-y +=3D $(LIBMUSL)/src/network/inet_addr.c
> +LIBMUSL_NETWORK_SRCS-y +=3D $(LIBMUSL)/src/network/inet_aton.c
> +LIBMUSL_NETWORK_SRCS-y +=3D $(LIBMUSL)/src/network/inet_legacy.c
> +LIBMUSL_NETWORK_SRCS-y +=3D $(LIBMUSL)/src/network/inet_ntoa.c
> +LIBMUSL_NETWORK_SRCS-y +=3D $(LIBMUSL)/src/network/inet_ntop.c
> +LIBMUSL_NETWORK_SRCS-y +=3D $(LIBMUSL)/src/network/inet_pton.c
> +LIBMUSL_NETWORK_SRCS-y +=3D $(LIBMUSL)/src/network/lookup_ipliteral.c
> +LIBMUSL_NETWORK_SRCS-y +=3D $(LIBMUSL)/src/network/lookup_name.c
> +LIBMUSL_NETWORK_SRCS-y +=3D $(LIBMUSL)/src/network/lookup_serv.c
> +LIBMUSL_NETWORK_SRCS-y +=3D $(LIBMUSL)/src/network/netlink.c
> +LIBMUSL_NETWORK_SRCS-y +=3D $(LIBMUSL)/src/network/netname.c
> +LIBMUSL_NETWORK_SRCS-y +=3D $(LIBMUSL)/src/network/ns_parse.c
> +LIBMUSL_NETWORK_SRCS-y +=3D $(LIBMUSL)/src/network/ntohl.c
> +LIBMUSL_NETWORK_SRCS-y +=3D $(LIBMUSL)/src/network/ntohs.c
> +LIBMUSL_NETWORK_SRCS-y +=3D $(LIBMUSL)/src/network/proto.c
> +LIBMUSL_NETWORK_SRCS-y +=3D $(LIBMUSL)/src/network/res_init.c
> +LIBMUSL_NETWORK_SRCS-y +=3D $(LIBMUSL)/src/network/res_mkquery.c
> +LIBMUSL_NETWORK_SRCS-y +=3D $(LIBMUSL)/src/network/res_msend.c
> +LIBMUSL_NETWORK_SRCS-y +=3D $(LIBMUSL)/src/network/res_query.c
> +LIBMUSL_NETWORK_SRCS-y +=3D $(LIBMUSL)/src/network/res_querydomain.c
> +LIBMUSL_NETWORK_SRCS-y +=3D $(LIBMUSL)/src/network/res_send.c
> +LIBMUSL_NETWORK_SRCS-y +=3D $(LIBMUSL)/src/network/res_state.c
> +LIBMUSL_NETWORK_SRCS-y +=3D $(LIBMUSL)/src/network/resolvconf.c
> +LIBMUSL_NETWORK_SRCS-y +=3D $(LIBMUSL)/src/network/serv.c
> +LIBMUSL_NETWORK_SRCS-y +=3D $(LIBMUSL)/src/network/sockatmark.c
> +
> +$(eval $(call =
_libmusl_import_lib,network,$(LIBMUSL_NETWORK_HDRS-y),$(LIBMUSL_NETWORK_SR=
CS-y)))
> diff --git a/Makefile.uk.musl.passwd b/Makefile.uk.musl.passwd
> index a08cd6f..dbad5fd 100644
> --- a/Makefile.uk.musl.passwd
> +++ b/Makefile.uk.musl.passwd
> @@ -1,20 +1,40 @@
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/passwd/fgetgrent.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/passwd/fgetpwent.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/passwd/fgetspent.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/passwd/getgr_a.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/passwd/getgr_r.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/passwd/getgrent.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/passwd/getgrent_a.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/passwd/getgrouplist.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/passwd/getpw_a.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/passwd/getpw_r.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/passwd/getpwent.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/passwd/getpwent_a.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/passwd/getspent.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/passwd/getspnam.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/passwd/getspnam_r.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/passwd/lckpwdf.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/passwd/nscd_query.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/passwd/putgrent.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/passwd/putpwent.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/passwd/putspent.c
> +LIBMUSL_PASSWD_HDRS-y +=3D $(LIBMUSL)/include/byteswap.h
> +LIBMUSL_PASSWD_HDRS-y +=3D $(LIBMUSL)/include/ctype.h
> +LIBMUSL_PASSWD_HDRS-y +=3D $(LIBMUSL)/include/errno.h
> +LIBMUSL_PASSWD_HDRS-y +=3D $(LIBMUSL)/include/fcntl.h
> +LIBMUSL_PASSWD_HDRS-y +=3D $(LIBMUSL)/include/grp.h
> +LIBMUSL_PASSWD_HDRS-y +=3D $(LIBMUSL)/include/limits.h
> +LIBMUSL_PASSWD_HDRS-y +=3D $(LIBMUSL)/src/passwd/nscd.h
> +LIBMUSL_PASSWD_HDRS-y +=3D $(LIBMUSL)/include/pthread.h
> +LIBMUSL_PASSWD_HDRS-y +=3D $(LIBMUSL)/include/pwd.h
> +LIBMUSL_PASSWD_HDRS-y +=3D $(LIBMUSL)/src/passwd/pwf.h
> +LIBMUSL_PASSWD_HDRS-y +=3D $(LIBMUSL)/include/shadow.h
> +LIBMUSL_PASSWD_HDRS-y +=3D $(LIBMUSL)/include/stdio.h
> +LIBMUSL_PASSWD_HDRS-y +=3D $(LIBMUSL)/include/stdlib.h
> +LIBMUSL_PASSWD_HDRS-y +=3D $(LIBMUSL)/include/string.h
> +LIBMUSL_PASSWD_HDRS-y +=3D $(LIBMUSL)/include/sys/socket.h
> +LIBMUSL_PASSWD_HDRS-y +=3D $(LIBMUSL)/include/sys/stat.h
> +LIBMUSL_PASSWD_HDRS-y +=3D $(LIBMUSL)/include/unistd.h
> +
> +LIBMUSL_PASSWD_SRCS-y +=3D $(LIBMUSL)/src/passwd/fgetgrent.c
> +LIBMUSL_PASSWD_SRCS-y +=3D $(LIBMUSL)/src/passwd/fgetpwent.c
> +LIBMUSL_PASSWD_SRCS-y +=3D $(LIBMUSL)/src/passwd/fgetspent.c
> +LIBMUSL_PASSWD_SRCS-y +=3D $(LIBMUSL)/src/passwd/getgr_a.c
> +LIBMUSL_PASSWD_SRCS-y +=3D $(LIBMUSL)/src/passwd/getgr_r.c
> +LIBMUSL_PASSWD_SRCS-y +=3D $(LIBMUSL)/src/passwd/getgrent.c
> +LIBMUSL_PASSWD_SRCS-y +=3D $(LIBMUSL)/src/passwd/getgrent_a.c
> +LIBMUSL_PASSWD_SRCS-y +=3D $(LIBMUSL)/src/passwd/getgrouplist.c
> +LIBMUSL_PASSWD_SRCS-y +=3D $(LIBMUSL)/src/passwd/getpw_a.c
> +LIBMUSL_PASSWD_SRCS-y +=3D $(LIBMUSL)/src/passwd/getpw_r.c
> +LIBMUSL_PASSWD_SRCS-y +=3D $(LIBMUSL)/src/passwd/getpwent.c
> +LIBMUSL_PASSWD_SRCS-y +=3D $(LIBMUSL)/src/passwd/getpwent_a.c
> +LIBMUSL_PASSWD_SRCS-y +=3D $(LIBMUSL)/src/passwd/getspent.c
> +LIBMUSL_PASSWD_SRCS-y +=3D $(LIBMUSL)/src/passwd/getspnam.c
> +LIBMUSL_PASSWD_SRCS-y +=3D $(LIBMUSL)/src/passwd/getspnam_r.c
> +LIBMUSL_PASSWD_SRCS-y +=3D $(LIBMUSL)/src/passwd/lckpwdf.c
> +LIBMUSL_PASSWD_SRCS-y +=3D $(LIBMUSL)/src/passwd/nscd_query.c
> +LIBMUSL_PASSWD_SRCS-y +=3D $(LIBMUSL)/src/passwd/putgrent.c
> +LIBMUSL_PASSWD_SRCS-y +=3D $(LIBMUSL)/src/passwd/putpwent.c
> +LIBMUSL_PASSWD_SRCS-y +=3D $(LIBMUSL)/src/passwd/putspent.c
> +
> +$(eval $(call =
_libmusl_import_lib,passwd,$(LIBMUSL_PASSWD_HDRS-y),$(LIBMUSL_PASSWD_SRCS-=
y)))
> diff --git a/Makefile.uk.musl.prng b/Makefile.uk.musl.prng
> index b4b786c..cfcccc2 100644
> --- a/Makefile.uk.musl.prng
> +++ b/Makefile.uk.musl.prng
> @@ -1,11 +1,19 @@
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/prng/__rand48_step.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/prng/__seed48.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/prng/drand48.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/prng/lcong48.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/prng/lrand48.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/prng/mrand48.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/prng/rand.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/prng/rand_r.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/prng/random.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/prng/seed48.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/prng/srand48.c
> +LIBMUSL_PRNG_HDRS-y +=3D $(LIBMUSL)/include/inttypes.h
> +LIBMUSL_PRNG_HDRS-y +=3D $(LIBMUSL)/src/internal/libc.h
> +LIBMUSL_PRNG_HDRS-y +=3D $(LIBMUSL)/include/stdint.h
> +LIBMUSL_PRNG_HDRS-y +=3D $(LIBMUSL)/include/stdlib.h
> +LIBMUSL_PRNG_HDRS-y +=3D $(LIBMUSL)/include/string.h
> +
> +LIBMUSL_PRNG_SRCS-y +=3D $(LIBMUSL)/src/prng/__rand48_step.c
> +LIBMUSL_PRNG_SRCS-y +=3D $(LIBMUSL)/src/prng/__seed48.c
> +LIBMUSL_PRNG_SRCS-y +=3D $(LIBMUSL)/src/prng/drand48.c
> +LIBMUSL_PRNG_SRCS-y +=3D $(LIBMUSL)/src/prng/lcong48.c
> +LIBMUSL_PRNG_SRCS-y +=3D $(LIBMUSL)/src/prng/lrand48.c
> +LIBMUSL_PRNG_SRCS-y +=3D $(LIBMUSL)/src/prng/mrand48.c
> +LIBMUSL_PRNG_SRCS-y +=3D $(LIBMUSL)/src/prng/rand.c
> +LIBMUSL_PRNG_SRCS-y +=3D $(LIBMUSL)/src/prng/rand_r.c
> +LIBMUSL_PRNG_SRCS-y +=3D $(LIBMUSL)/src/prng/random.c
> +LIBMUSL_PRNG_SRCS-y +=3D $(LIBMUSL)/src/prng/seed48.c
> +LIBMUSL_PRNG_SRCS-y +=3D $(LIBMUSL)/src/prng/srand48.c
> +
> +$(eval $(call =
_libmusl_import_lib,prng,$(LIBMUSL_PRNG_HDRS-y),$(LIBMUSL_PRNG_SRCS-y)))
> diff --git a/Makefile.uk.musl.process b/Makefile.uk.musl.process
> index 1bc77e7..71b4042 100644
> --- a/Makefile.uk.musl.process
> +++ b/Makefile.uk.musl.process
> @@ -1,42 +1,60 @@
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/process/execl.c
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/process/execle.c
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/process/execlp.c
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/process/execv.c
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/process/execve.c
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/process/execvp.c
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/process/fexecve.c
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/process/fork.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/process/posix_spawn.c
> -LIBMUSL_SRCS-y +=3D =
$(LIBMUSL)/src/process/posix_spawn_file_actions_addclose.c
> -LIBMUSL_SRCS-y +=3D =
$(LIBMUSL)/src/process/posix_spawn_file_actions_adddup2.c
> -LIBMUSL_SRCS-y +=3D =
$(LIBMUSL)/src/process/posix_spawn_file_actions_addopen.c
> -LIBMUSL_SRCS-y +=3D =
$(LIBMUSL)/src/process/posix_spawn_file_actions_destroy.c
> -LIBMUSL_SRCS-y +=3D =
$(LIBMUSL)/src/process/posix_spawn_file_actions_init.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/process/posix_spawnattr_destroy.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/process/posix_spawnattr_getflags.c
> -LIBMUSL_SRCS-y +=3D =
$(LIBMUSL)/src/process/posix_spawnattr_getpgroup.c
> -LIBMUSL_SRCS-y +=3D =
$(LIBMUSL)/src/process/posix_spawnattr_getsigdefault.c
> -LIBMUSL_SRCS-y +=3D =
$(LIBMUSL)/src/process/posix_spawnattr_getsigmask.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/process/posix_spawnattr_init.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/process/posix_spawnattr_sched.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/process/posix_spawnattr_setflags.c
> -LIBMUSL_SRCS-y +=3D =
$(LIBMUSL)/src/process/posix_spawnattr_setpgroup.c
> -LIBMUSL_SRCS-y +=3D =
$(LIBMUSL)/src/process/posix_spawnattr_setsigdefault.c
> -LIBMUSL_SRCS-y +=3D =
$(LIBMUSL)/src/process/posix_spawnattr_setsigmask.c
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/process/posix_spawnp.c
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/process/system.c
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/process/wait.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/process/waitid.c
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/process/waitpid.c
> +LIBMUSL_PROCESS_HDRS-y +=3D $(LIBMUSL)/include/errno.h
> +LIBMUSL_PROCESS_HDRS-y +=3D $(LIBMUSL)/include/fcntl.h
> +LIBMUSL_PROCESS_HDRS-y +=3D $(LIBMUSL)/src/process/fdop.h
> +LIBMUSL_PROCESS_HDRS-y +=3D $(LIBMUSL)/src/internal/libc.h
> +LIBMUSL_PROCESS_HDRS-y +=3D $(LIBMUSL)/include/limits.h
> +LIBMUSL_PROCESS_HDRS-y +=3D $(LIBMUSL)/src/internal/pthread_impl.h
> +LIBMUSL_PROCESS_HDRS-y +=3D $(LIBMUSL)/include/sched.h
> +LIBMUSL_PROCESS_HDRS-y +=3D $(LIBMUSL)/include/signal.h
> +LIBMUSL_PROCESS_HDRS-y +=3D $(LIBMUSL)/include/spawn.h
> +LIBMUSL_PROCESS_HDRS-y +=3D $(LIBMUSL)/include/stdarg.h
> +LIBMUSL_PROCESS_HDRS-y +=3D $(LIBMUSL)/include/stdlib.h
> +LIBMUSL_PROCESS_HDRS-y +=3D $(LIBMUSL)/include/string.h
> +LIBMUSL_PROCESS_HDRS-y +=3D $(LIBMUSL)/src/internal/syscall.h
> +LIBMUSL_PROCESS_HDRS-y +=3D $(LIBMUSL)/include/sys/wait.h
> +LIBMUSL_PROCESS_HDRS-y +=3D $(LIBMUSL)/include/unistd.h
> +
> +#LIBMUSL_PROCESS_SRCS-y +=3D $(LIBMUSL)/src/process/execl.c
> +#LIBMUSL_PROCESS_SRCS-y +=3D $(LIBMUSL)/src/process/execle.c
> +#LIBMUSL_PROCESS_SRCS-y +=3D $(LIBMUSL)/src/process/execlp.c
> +#LIBMUSL_PROCESS_SRCS-y +=3D $(LIBMUSL)/src/process/execv.c
> +#LIBMUSL_PROCESS_SRCS-y +=3D $(LIBMUSL)/src/process/execve.c
> +#LIBMUSL_PROCESS_SRCS-y +=3D $(LIBMUSL)/src/process/execvp.c
> +#LIBMUSL_PROCESS_SRCS-y +=3D $(LIBMUSL)/src/process/fexecve.c
> +#LIBMUSL_PROCESS_SRCS-y +=3D $(LIBMUSL)/src/process/fork.c
> +LIBMUSL_PROCESS_SRCS-y +=3D $(LIBMUSL)/src/process/posix_spawn.c
> +LIBMUSL_PROCESS_SRCS-y +=3D =
$(LIBMUSL)/src/process/posix_spawn_file_actions_addclose.c
> +LIBMUSL_PROCESS_SRCS-y +=3D =
$(LIBMUSL)/src/process/posix_spawn_file_actions_adddup2.c
> +LIBMUSL_PROCESS_SRCS-y +=3D =
$(LIBMUSL)/src/process/posix_spawn_file_actions_addopen.c
> +LIBMUSL_PROCESS_SRCS-y +=3D =
$(LIBMUSL)/src/process/posix_spawn_file_actions_destroy.c
> +LIBMUSL_PROCESS_SRCS-y +=3D =
$(LIBMUSL)/src/process/posix_spawn_file_actions_init.c
> +LIBMUSL_PROCESS_SRCS-y +=3D =
$(LIBMUSL)/src/process/posix_spawnattr_destroy.c
> +LIBMUSL_PROCESS_SRCS-y +=3D =
$(LIBMUSL)/src/process/posix_spawnattr_getflags.c
> +LIBMUSL_PROCESS_SRCS-y +=3D =
$(LIBMUSL)/src/process/posix_spawnattr_getpgroup.c
> +LIBMUSL_PROCESS_SRCS-y +=3D =
$(LIBMUSL)/src/process/posix_spawnattr_getsigdefault.c
> +LIBMUSL_PROCESS_SRCS-y +=3D =
$(LIBMUSL)/src/process/posix_spawnattr_getsigmask.c
> +LIBMUSL_PROCESS_SRCS-y +=3D =
$(LIBMUSL)/src/process/posix_spawnattr_init.c
> +LIBMUSL_PROCESS_SRCS-y +=3D =
$(LIBMUSL)/src/process/posix_spawnattr_sched.c
> +LIBMUSL_PROCESS_SRCS-y +=3D =
$(LIBMUSL)/src/process/posix_spawnattr_setflags.c
> +LIBMUSL_PROCESS_SRCS-y +=3D =
$(LIBMUSL)/src/process/posix_spawnattr_setpgroup.c
> +LIBMUSL_PROCESS_SRCS-y +=3D =
$(LIBMUSL)/src/process/posix_spawnattr_setsigdefault.c
> +LIBMUSL_PROCESS_SRCS-y +=3D =
$(LIBMUSL)/src/process/posix_spawnattr_setsigmask.c
> +#LIBMUSL_PROCESS_SRCS-y +=3D $(LIBMUSL)/src/process/posix_spawnp.c
> +#LIBMUSL_PROCESS_SRCS-y +=3D $(LIBMUSL)/src/process/system.c
> +#LIBMUSL_PROCESS_SRCS-y +=3D $(LIBMUSL)/src/process/wait.c
> +LIBMUSL_PROCESS_SRCS-y +=3D $(LIBMUSL)/src/process/waitid.c
> +#LIBMUSL_PROCESS_SRCS-y +=3D $(LIBMUSL)/src/process/waitpid.c
>=20
> ifeq (x86_32,$(CONFIG_UK_ARCH))
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/process/i386/vfork.s|i386
> +LIBMUSL_PROCESS_SRCS-y +=3D $(LIBMUSL)/src/process/i386/vfork.s|i386
> else ifeq (x86_64,$(CONFIG_UK_ARCH))
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/process/x86_64/vfork.s|x86_64
> +LIBMUSL_PROCESS_SRCS-y +=3D =
$(LIBMUSL)/src/process/x86_64/vfork.s|x86_64
> else
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/process/vfork.c
> +LIBMUSL_PROCESS_SRCS-y +=3D $(LIBMUSL)/src/process/vfork.c
> endif
>=20
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/process/s390x/vfork.s
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/process/sh/vfork.s
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/process/x32/vfork.s
> +#LIBMUSL_PROCESS_SRCS-y +=3D $(LIBMUSL)/src/process/s390x/vfork.s
> +#LIBMUSL_PROCESS_SRCS-y +=3D $(LIBMUSL)/src/process/sh/vfork.s
> +#LIBMUSL_PROCESS_SRCS-y +=3D $(LIBMUSL)/src/process/x32/vfork.s
> +
> +$(eval $(call =
_libmusl_import_lib,process,$(LIBMUSL_PROCESS_HDRS-y),$(LIBMUSL_PROCESS_SR=
CS-y)))
> diff --git a/Makefile.uk.musl.regex b/Makefile.uk.musl.regex
> index e564903..edd7df1 100644
> --- a/Makefile.uk.musl.regex
> +++ b/Makefile.uk.musl.regex
> @@ -1,6 +1,28 @@
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/regex/fnmatch.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/regex/glob.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/regex/regcomp.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/regex/regerror.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/regex/regexec.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/regex/tre-mem.c
> +LIBMUSL_REGEX_HDRS-y +=3D $(LIBMUSL)/include/assert.h
> +LIBMUSL_REGEX_HDRS-y +=3D $(LIBMUSL)/include/ctype.h
> +LIBMUSL_REGEX_HDRS-y +=3D $(LIBMUSL)/include/dirent.h
> +LIBMUSL_REGEX_HDRS-y +=3D $(LIBMUSL)/include/errno.h
> +LIBMUSL_REGEX_HDRS-y +=3D $(LIBMUSL)/include/fnmatch.h
> +LIBMUSL_REGEX_HDRS-y +=3D $(LIBMUSL)/include/glob.h
> +LIBMUSL_REGEX_HDRS-y +=3D $(LIBMUSL)/src/internal/libc.h
> +LIBMUSL_REGEX_HDRS-y +=3D $(LIBMUSL)/include/limits.h
> +LIBMUSL_REGEX_HDRS-y +=3D $(LIBMUSL)/src/internal/locale_impl.h
> +LIBMUSL_REGEX_HDRS-y +=3D $(LIBMUSL)/include/regex.h
> +LIBMUSL_REGEX_HDRS-y +=3D $(LIBMUSL)/include/stddef.h
> +LIBMUSL_REGEX_HDRS-y +=3D $(LIBMUSL)/include/stdint.h
> +LIBMUSL_REGEX_HDRS-y +=3D $(LIBMUSL)/include/stdio.h
> +LIBMUSL_REGEX_HDRS-y +=3D $(LIBMUSL)/include/stdlib.h
> +LIBMUSL_REGEX_HDRS-y +=3D $(LIBMUSL)/include/string.h
> +LIBMUSL_REGEX_HDRS-y +=3D $(LIBMUSL)/include/sys/stat.h
> +LIBMUSL_REGEX_HDRS-y +=3D $(LIBMUSL)/src/regex/tre.h
> +LIBMUSL_REGEX_HDRS-y +=3D $(LIBMUSL)/include/wchar.h
> +LIBMUSL_REGEX_HDRS-y +=3D $(LIBMUSL)/include/wctype.h
> +
> +LIBMUSL_REGEX_SRCS-y +=3D $(LIBMUSL)/src/regex/fnmatch.c
> +LIBMUSL_REGEX_SRCS-y +=3D $(LIBMUSL)/src/regex/glob.c
> +LIBMUSL_REGEX_SRCS-y +=3D $(LIBMUSL)/src/regex/regcomp.c
> +LIBMUSL_REGEX_SRCS-y +=3D $(LIBMUSL)/src/regex/regerror.c
> +LIBMUSL_REGEX_SRCS-y +=3D $(LIBMUSL)/src/regex/regexec.c
> +LIBMUSL_REGEX_SRCS-y +=3D $(LIBMUSL)/src/regex/tre-mem.c
> +
> +$(eval $(call =
_libmusl_import_lib,regex,$(LIBMUSL_REGEX_HDRS-y),$(LIBMUSL_REGEX_SRCS-y))=
)
> diff --git a/Makefile.uk.musl.sched b/Makefile.uk.musl.sched
> index efa511e..4fe268d 100644
> --- a/Makefile.uk.musl.sched
> +++ b/Makefile.uk.musl.sched
> @@ -1,10 +1,19 @@
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/sched/affinity.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/sched/sched_cpucount.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/sched/sched_get_priority_max.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/sched/sched_getcpu.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/sched/sched_getparam.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/sched/sched_getscheduler.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/sched/sched_rr_get_interval.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/sched/sched_setparam.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/sched/sched_setscheduler.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/sched/sched_yield.c
> +LIBMUSL_SCHED_HDRS-y +=3D $(LIBMUSL)/src/internal/atomic.h
> +LIBMUSL_SCHED_HDRS-y +=3D $(LIBMUSL)/include/errno.h
> +LIBMUSL_SCHED_HDRS-y +=3D $(LIBMUSL)/src/internal/pthread_impl.h
> +LIBMUSL_SCHED_HDRS-y +=3D $(LIBMUSL)/include/sched.h
> +LIBMUSL_SCHED_HDRS-y +=3D $(LIBMUSL)/include/string.h
> +LIBMUSL_SCHED_HDRS-y +=3D $(LIBMUSL)/src/internal/syscall.h
> +
> +LIBMUSL_SCHED_SRCS-y +=3D $(LIBMUSL)/src/sched/affinity.c
> +LIBMUSL_SCHED_SRCS-y +=3D $(LIBMUSL)/src/sched/sched_cpucount.c
> +LIBMUSL_SCHED_SRCS-y +=3D =
$(LIBMUSL)/src/sched/sched_get_priority_max.c
> +LIBMUSL_SCHED_SRCS-y +=3D $(LIBMUSL)/src/sched/sched_getcpu.c
> +LIBMUSL_SCHED_SRCS-y +=3D $(LIBMUSL)/src/sched/sched_getparam.c
> +LIBMUSL_SCHED_SRCS-y +=3D $(LIBMUSL)/src/sched/sched_getscheduler.c
> +LIBMUSL_SCHED_SRCS-y +=3D =
$(LIBMUSL)/src/sched/sched_rr_get_interval.c
> +LIBMUSL_SCHED_SRCS-y +=3D $(LIBMUSL)/src/sched/sched_setparam.c
> +LIBMUSL_SCHED_SRCS-y +=3D $(LIBMUSL)/src/sched/sched_setscheduler.c
> +LIBMUSL_SCHED_SRCS-y +=3D $(LIBMUSL)/src/sched/sched_yield.c
> +
> +$(eval $(call =
_libmusl_import_lib,sched,$(LIBMUSL_SCHED_HDRS-y),$(LIBMUSL_SCHED_SRCS-y))=
)
> diff --git a/Makefile.uk.musl.search b/Makefile.uk.musl.search
> index 9b34f3b..d611b93 100644
> --- a/Makefile.uk.musl.search
> +++ b/Makefile.uk.musl.search
> @@ -1,5 +1,12 @@
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/search/hsearch.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/search/insque.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/search/lsearch.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/search/tdestroy.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/search/tsearch_avl.c
> +LIBMUSL_SEARCH_HDRS-y +=3D $(LIBMUSL)/src/internal/libc.h
> +LIBMUSL_SEARCH_HDRS-y +=3D $(LIBMUSL)/include/search.h
> +LIBMUSL_SEARCH_HDRS-y +=3D $(LIBMUSL)/include/stdlib.h
> +LIBMUSL_SEARCH_HDRS-y +=3D $(LIBMUSL)/include/string.h
> +
> +LIBMUSL_SEARCH_SRCS-y +=3D $(LIBMUSL)/src/search/hsearch.c
> +LIBMUSL_SEARCH_SRCS-y +=3D $(LIBMUSL)/src/search/insque.c
> +LIBMUSL_SEARCH_SRCS-y +=3D $(LIBMUSL)/src/search/lsearch.c
> +LIBMUSL_SEARCH_SRCS-y +=3D $(LIBMUSL)/src/search/tdestroy.c
> +LIBMUSL_SEARCH_SRCS-y +=3D $(LIBMUSL)/src/search/tsearch_avl.c
> +
> +$(eval $(call =
_libmusl_import_lib,search,$(LIBMUSL_SEARCH_HDRS-y),$(LIBMUSL_SEARCH_SRCS-=
y)))
> diff --git a/Makefile.uk.musl.select b/Makefile.uk.musl.select
> index 21c1a9a..3ac5a3f 100644
> --- a/Makefile.uk.musl.select
> +++ b/Makefile.uk.musl.select
> @@ -1,3 +1,14 @@
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/select/poll.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/select/pselect.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/select/select.c
> +LIBMUSL_SELECT_HDRS-y +=3D $(LIBMUSL)/include/errno.h
> +LIBMUSL_SELECT_HDRS-y +=3D $(LIBMUSL)/src/internal/libc.h
> +LIBMUSL_SELECT_HDRS-y +=3D $(LIBMUSL)/include/poll.h
> +LIBMUSL_SELECT_HDRS-y +=3D $(LIBMUSL)/include/signal.h
> +LIBMUSL_SELECT_HDRS-y +=3D $(LIBMUSL)/include/stdint.h
> +LIBMUSL_SELECT_HDRS-y +=3D $(LIBMUSL)/src/internal/syscall.h
> +LIBMUSL_SELECT_HDRS-y +=3D $(LIBMUSL)/include/sys/select.h
> +LIBMUSL_SELECT_HDRS-y +=3D $(LIBMUSL)/include/time.h
> +
> +LIBMUSL_SELECT_SRCS-y +=3D $(LIBMUSL)/src/select/poll.c
> +LIBMUSL_SELECT_SRCS-y +=3D $(LIBMUSL)/src/select/pselect.c
> +LIBMUSL_SELECT_SRCS-y +=3D $(LIBMUSL)/src/select/select.c
> +
> +$(eval $(call =
_libmusl_import_lib,select,$(LIBMUSL_SELECT_HDRS-y),$(LIBMUSL_SELECT_SRCS-=
y)))
> diff --git a/Makefile.uk.musl.setjmp b/Makefile.uk.musl.setjmp
> index c4bf289..9a9b267 100644
> --- a/Makefile.uk.musl.setjmp
> +++ b/Makefile.uk.musl.setjmp
> @@ -1,36 +1,38 @@
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/setjmp/setjmp.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/setjmp/longjmp.c
> +LIBMUSL_SETJMP_SRCS-y +=3D $(LIBMUSL)/src/setjmp/setjmp.c
> +LIBMUSL_SETJMP_SRCS-y +=3D $(LIBMUSL)/src/setjmp/longjmp.c
>=20
> ifeq (arm,$(CONFIG_UK_ARCH))
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/setjmp/arm/longjmp.s|arm
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/setjmp/arm/setjmp.s|arm
> +LIBMUSL_SETJMP_SRCS-y +=3D $(LIBMUSL)/src/setjmp/arm/longjmp.s|arm
> +LIBMUSL_SETJMP_SRCS-y +=3D $(LIBMUSL)/src/setjmp/arm/setjmp.s|arm
> else ifeq (x86_32,$(CONFIG_UK_ARCH))
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/setjmp/i386/longjmp.s|i386
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/setjmp/i386/setjmp.s|i386
> +LIBMUSL_SETJMP_SRCS-y +=3D $(LIBMUSL)/src/setjmp/i386/longjmp.s|i386
> +LIBMUSL_SETJMP_SRCS-y +=3D $(LIBMUSL)/src/setjmp/i386/setjmp.s|i386
> else ifeq (x86_64,$(CONFIG_UK_ARCH))
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/setjmp/x86_64/longjmp.s|x86_64
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/setjmp/x86_64/setjmp.s|x86_64
> +LIBMUSL_SETJMP_SRCS-y +=3D =
$(LIBMUSL)/src/setjmp/x86_64/longjmp.s|x86_64
> +LIBMUSL_SETJMP_SRCS-y +=3D =
$(LIBMUSL)/src/setjmp/x86_64/setjmp.s|x86_64
> endif
>=20
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/setjmp/aarch64/longjmp.s
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/setjmp/aarch64/setjmp.s
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/setjmp/microblaze/longjmp.s
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/setjmp/microblaze/setjmp.s
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/setjmp/mips/longjmp.S
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/setjmp/mips/setjmp.S
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/setjmp/mips64/longjmp.S
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/setjmp/mips64/setjmp.S
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/setjmp/mipsn32/longjmp.S
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/setjmp/mipsn32/setjmp.S
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/setjmp/or1k/longjmp.s
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/setjmp/or1k/setjmp.s
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/setjmp/powerpc/longjmp.S
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/setjmp/powerpc/setjmp.S
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/setjmp/powerpc64/longjmp.s
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/setjmp/powerpc64/setjmp.s
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/setjmp/s390x/longjmp.s
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/setjmp/s390x/setjmp.s
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/setjmp/sh/longjmp.S
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/setjmp/sh/setjmp.S
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/setjmp/x32/longjmp.s
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/setjmp/x32/setjmp.s
> +#LIBMUSL_SETJMP_SRCS-y +=3D $(LIBMUSL)/src/setjmp/aarch64/longjmp.s
> +#LIBMUSL_SETJMP_SRCS-y +=3D $(LIBMUSL)/src/setjmp/aarch64/setjmp.s
> +#LIBMUSL_SETJMP_SRCS-y +=3D =
$(LIBMUSL)/src/setjmp/microblaze/longjmp.s
> +#LIBMUSL_SETJMP_SRCS-y +=3D $(LIBMUSL)/src/setjmp/microblaze/setjmp.s
> +#LIBMUSL_SETJMP_SRCS-y +=3D $(LIBMUSL)/src/setjmp/mips/longjmp.S
> +#LIBMUSL_SETJMP_SRCS-y +=3D $(LIBMUSL)/src/setjmp/mips/setjmp.S
> +#LIBMUSL_SETJMP_SRCS-y +=3D $(LIBMUSL)/src/setjmp/mips64/longjmp.S
> +#LIBMUSL_SETJMP_SRCS-y +=3D $(LIBMUSL)/src/setjmp/mips64/setjmp.S
> +#LIBMUSL_SETJMP_SRCS-y +=3D $(LIBMUSL)/src/setjmp/mipsn32/longjmp.S
> +#LIBMUSL_SETJMP_SRCS-y +=3D $(LIBMUSL)/src/setjmp/mipsn32/setjmp.S
> +#LIBMUSL_SETJMP_SRCS-y +=3D $(LIBMUSL)/src/setjmp/or1k/longjmp.s
> +#LIBMUSL_SETJMP_SRCS-y +=3D $(LIBMUSL)/src/setjmp/or1k/setjmp.s
> +#LIBMUSL_SETJMP_SRCS-y +=3D $(LIBMUSL)/src/setjmp/powerpc/longjmp.S
> +#LIBMUSL_SETJMP_SRCS-y +=3D $(LIBMUSL)/src/setjmp/powerpc/setjmp.S
> +#LIBMUSL_SETJMP_SRCS-y +=3D $(LIBMUSL)/src/setjmp/powerpc64/longjmp.s
> +#LIBMUSL_SETJMP_SRCS-y +=3D $(LIBMUSL)/src/setjmp/powerpc64/setjmp.s
> +#LIBMUSL_SETJMP_SRCS-y +=3D $(LIBMUSL)/src/setjmp/s390x/longjmp.s
> +#LIBMUSL_SETJMP_SRCS-y +=3D $(LIBMUSL)/src/setjmp/s390x/setjmp.s
> +#LIBMUSL_SETJMP_SRCS-y +=3D $(LIBMUSL)/src/setjmp/sh/longjmp.S
> +#LIBMUSL_SETJMP_SRCS-y +=3D $(LIBMUSL)/src/setjmp/sh/setjmp.S
> +#LIBMUSL_SETJMP_SRCS-y +=3D $(LIBMUSL)/src/setjmp/x32/longjmp.s
> +#LIBMUSL_SETJMP_SRCS-y +=3D $(LIBMUSL)/src/setjmp/x32/setjmp.s
> +
> +$(eval $(call =
_libmusl_import_lib,setjmp,$(LIBMUSL_SETJMP_HDRS-y),$(LIBMUSL_SETJMP_SRCS-=
y)))
> diff --git a/Makefile.uk.musl.signal b/Makefile.uk.musl.signal
> index 24969ef..a7af11f 100644
> --- a/Makefile.uk.musl.signal
> +++ b/Makefile.uk.musl.signal
> @@ -1,72 +1,97 @@
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/signal/block.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/signal/getitimer.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/signal/kill.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/signal/killpg.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/signal/psiginfo.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/signal/psignal.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/signal/raise.c
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/signal/setitimer.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/signal/sigaction.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/signal/sigaddset.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/signal/sigaltstack.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/signal/sigandset.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/signal/sigdelset.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/signal/sigemptyset.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/signal/sigfillset.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/signal/sighold.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/signal/sigignore.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/signal/siginterrupt.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/signal/sigisemptyset.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/signal/sigismember.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/signal/siglongjmp.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/signal/signal.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/signal/sigorset.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/signal/sigpause.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/signal/sigpending.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/signal/sigprocmask.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/signal/sigqueue.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/signal/sigrelse.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/signal/sigrtmax.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/signal/sigrtmin.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/signal/sigset.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/signal/sigsetjmp.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/signal/sigsetjmp_tail.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/signal/sigsuspend.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/signal/sigtimedwait.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/signal/sigwait.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/signal/sigwaitinfo.c
> +LIBMUSL_SIGNAL_HDRS-y +=3D $(LIBMUSL)/include/errno.h
> +LIBMUSL_SIGNAL_HDRS-y +=3D $(LIBMUSL)/src/internal/ksigaction.h
> +LIBMUSL_SIGNAL_HDRS-y +=3D $(LIBMUSL)/src/internal/libc.h
> +LIBMUSL_SIGNAL_HDRS-y +=3D $(LIBMUSL)/include/limits.h
> +LIBMUSL_SIGNAL_HDRS-y +=3D $(LIBMUSL)/src/internal/pthread_impl.h
> +LIBMUSL_SIGNAL_HDRS-y +=3D $(LIBMUSL)/include/setjmp.h
> +LIBMUSL_SIGNAL_HDRS-y +=3D $(LIBMUSL)/include/signal.h
> +LIBMUSL_SIGNAL_HDRS-y +=3D $(LIBMUSL)/include/stdint.h
> +LIBMUSL_SIGNAL_HDRS-y +=3D $(LIBMUSL)/include/stdio.h
> +LIBMUSL_SIGNAL_HDRS-y +=3D $(LIBMUSL)/include/string.h
> +LIBMUSL_SIGNAL_HDRS-y +=3D $(LIBMUSL)/src/internal/syscall.h
> +LIBMUSL_SIGNAL_HDRS-y +=3D $(LIBMUSL)/include/sys/syscall.h
> +LIBMUSL_SIGNAL_HDRS-y +=3D $(LIBMUSL)/include/sys/time.h
> +LIBMUSL_SIGNAL_HDRS-y +=3D $(LIBMUSL)/include/unistd.h
> +
> +ifeq (arm,$(ARCH))
> +LIBMUSL_SIGNAL_HDRS-y +=3D $(LIBMUSL)/arch/arm/bits/signal.h
> +else ifeq (x86_32,$(ARCH))
> +LIBMUSL_SIGNAL_HDRS-y +=3D $(LIBMUSL)/arch/i386/bits/signal.h
> +else ifeq (x86_64,$(ARCH))
> +LIBMUSL_SIGNAL_HDRS-y +=3D $(LIBMUSL)/arch/x86_64/bits/signal.h
> +endif
> +
> +LIBMUSL_SIGNAL_SRCS-y +=3D $(LIBMUSL)/src/signal/block.c
> +LIBMUSL_SIGNAL_SRCS-y +=3D $(LIBMUSL)/src/signal/getitimer.c
> +LIBMUSL_SIGNAL_SRCS-y +=3D $(LIBMUSL)/src/signal/kill.c
> +LIBMUSL_SIGNAL_SRCS-y +=3D $(LIBMUSL)/src/signal/killpg.c
> +LIBMUSL_SIGNAL_SRCS-y +=3D $(LIBMUSL)/src/signal/psiginfo.c
> +LIBMUSL_SIGNAL_SRCS-y +=3D $(LIBMUSL)/src/signal/psignal.c
> +LIBMUSL_SIGNAL_SRCS-y +=3D $(LIBMUSL)/src/signal/raise.c
> +#LIBMUSL_SIGNAL_SRCS-y +=3D $(LIBMUSL)/src/signal/setitimer.c
> +LIBMUSL_SIGNAL_SRCS-y +=3D $(LIBMUSL)/src/signal/sigaction.c
> +LIBMUSL_SIGNAL_SRCS-y +=3D $(LIBMUSL)/src/signal/sigaddset.c
> +LIBMUSL_SIGNAL_SRCS-y +=3D $(LIBMUSL)/src/signal/sigaltstack.c
> +LIBMUSL_SIGNAL_SRCS-y +=3D $(LIBMUSL)/src/signal/sigandset.c
> +LIBMUSL_SIGNAL_SRCS-y +=3D $(LIBMUSL)/src/signal/sigdelset.c
> +LIBMUSL_SIGNAL_SRCS-y +=3D $(LIBMUSL)/src/signal/sigemptyset.c
> +LIBMUSL_SIGNAL_SRCS-y +=3D $(LIBMUSL)/src/signal/sigfillset.c
> +LIBMUSL_SIGNAL_SRCS-y +=3D $(LIBMUSL)/src/signal/sighold.c
> +LIBMUSL_SIGNAL_SRCS-y +=3D $(LIBMUSL)/src/signal/sigignore.c
> +LIBMUSL_SIGNAL_SRCS-y +=3D $(LIBMUSL)/src/signal/siginterrupt.c
> +LIBMUSL_SIGNAL_SRCS-y +=3D $(LIBMUSL)/src/signal/sigisemptyset.c
> +LIBMUSL_SIGNAL_SRCS-y +=3D $(LIBMUSL)/src/signal/sigismember.c
> +LIBMUSL_SIGNAL_SRCS-y +=3D $(LIBMUSL)/src/signal/siglongjmp.c
> +LIBMUSL_SIGNAL_SRCS-y +=3D $(LIBMUSL)/src/signal/signal.c
> +LIBMUSL_SIGNAL_SRCS-y +=3D $(LIBMUSL)/src/signal/sigorset.c
> +LIBMUSL_SIGNAL_SRCS-y +=3D $(LIBMUSL)/src/signal/sigpause.c
> +LIBMUSL_SIGNAL_SRCS-y +=3D $(LIBMUSL)/src/signal/sigpending.c
> +LIBMUSL_SIGNAL_SRCS-y +=3D $(LIBMUSL)/src/signal/sigprocmask.c
> +LIBMUSL_SIGNAL_SRCS-y +=3D $(LIBMUSL)/src/signal/sigqueue.c
> +LIBMUSL_SIGNAL_SRCS-y +=3D $(LIBMUSL)/src/signal/sigrelse.c
> +LIBMUSL_SIGNAL_SRCS-y +=3D $(LIBMUSL)/src/signal/sigrtmax.c
> +LIBMUSL_SIGNAL_SRCS-y +=3D $(LIBMUSL)/src/signal/sigrtmin.c
> +LIBMUSL_SIGNAL_SRCS-y +=3D $(LIBMUSL)/src/signal/sigset.c
> +LIBMUSL_SIGNAL_SRCS-y +=3D $(LIBMUSL)/src/signal/sigsetjmp.c
> +LIBMUSL_SIGNAL_SRCS-y +=3D $(LIBMUSL)/src/signal/sigsetjmp_tail.c
> +LIBMUSL_SIGNAL_SRCS-y +=3D $(LIBMUSL)/src/signal/sigsuspend.c
> +LIBMUSL_SIGNAL_SRCS-y +=3D $(LIBMUSL)/src/signal/sigtimedwait.c
> +LIBMUSL_SIGNAL_SRCS-y +=3D $(LIBMUSL)/src/signal/sigwait.c
> +LIBMUSL_SIGNAL_SRCS-y +=3D $(LIBMUSL)/src/signal/sigwaitinfo.c
>=20
> ifeq (x86_32,$(CONFIG_UK_ARCH))
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/signal/i386/restore.s|i386
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/signal/i386/sigsetjmp.s|i386
> +LIBMUSL_SIGNAL_SRCS-y +=3D $(LIBMUSL)/src/signal/i386/restore.s|i386
> +LIBMUSL_SIGNAL_SRCS-y +=3D =
$(LIBMUSL)/src/signal/i386/sigsetjmp.s|i386
> else ifeq (x86_64,$(CONFIG_UK_ARCH))
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/signal/x86_64/restore.s|x86_64
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/signal/x86_64/sigsetjmp.s|x86_64
> +LIBMUSL_SIGNAL_SRCS-y +=3D =
$(LIBMUSL)/src/signal/x86_64/restore.s|x86_64
> +LIBMUSL_SIGNAL_SRCS-y +=3D =
$(LIBMUSL)/src/signal/x86_64/sigsetjmp.s|x86_64
> else ifeq (arm,$(CONFIG_UK_ARCH))
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/signal/arm/restore.s|arm
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/signal/arm/sigsetjmp.s|arm
> +LIBMUSL_SIGNAL_SRCS-y +=3D $(LIBMUSL)/src/signal/arm/restore.s|arm
> +LIBMUSL_SIGNAL_SRCS-y +=3D $(LIBMUSL)/src/signal/arm/sigsetjmp.s|arm
> else
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/signal/restore.c
> +LIBMUSL_SIGNAL_SRCS-y +=3D $(LIBMUSL)/src/signal/restore.c
> endif
>=20
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/signal/aarch64/restore.s
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/signal/aarch64/sigsetjmp.s
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/signal/microblaze/restore.s
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/signal/microblaze/sigsetjmp.s
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/signal/mips/restore.s
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/signal/mips/sigsetjmp.s
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/signal/mips64/restore.s
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/signal/mips64/sigsetjmp.s
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/signal/mipsn32/restore.s
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/signal/mipsn32/sigsetjmp.s
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/signal/or1k/sigsetjmp.s
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/signal/powerpc/restore.s
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/signal/powerpc/sigsetjmp.s
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/signal/powerpc64/restore.s
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/signal/powerpc64/sigsetjmp.s
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/signal/s390x/restore.s
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/signal/s390x/sigsetjmp.s
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/signal/sh/restore.s
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/signal/sh/sigsetjmp.s
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/signal/x32/restore.s
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/signal/x32/sigsetjmp.s
> +#LIBMUSL_SIGNAL_SRCS-y +=3D $(LIBMUSL)/src/signal/aarch64/restore.s
> +#LIBMUSL_SIGNAL_SRCS-y +=3D $(LIBMUSL)/src/signal/aarch64/sigsetjmp.s
> +#LIBMUSL_SIGNAL_SRCS-y +=3D =
$(LIBMUSL)/src/signal/microblaze/restore.s
> +#LIBMUSL_SIGNAL_SRCS-y +=3D =
$(LIBMUSL)/src/signal/microblaze/sigsetjmp.s
> +#LIBMUSL_SIGNAL_SRCS-y +=3D $(LIBMUSL)/src/signal/mips/restore.s
> +#LIBMUSL_SIGNAL_SRCS-y +=3D $(LIBMUSL)/src/signal/mips/sigsetjmp.s
> +#LIBMUSL_SIGNAL_SRCS-y +=3D $(LIBMUSL)/src/signal/mips64/restore.s
> +#LIBMUSL_SIGNAL_SRCS-y +=3D $(LIBMUSL)/src/signal/mips64/sigsetjmp.s
> +#LIBMUSL_SIGNAL_SRCS-y +=3D $(LIBMUSL)/src/signal/mipsn32/restore.s
> +#LIBMUSL_SIGNAL_SRCS-y +=3D $(LIBMUSL)/src/signal/mipsn32/sigsetjmp.s
> +#LIBMUSL_SIGNAL_SRCS-y +=3D $(LIBMUSL)/src/signal/or1k/sigsetjmp.s
> +#LIBMUSL_SIGNAL_SRCS-y +=3D $(LIBMUSL)/src/signal/powerpc/restore.s
> +#LIBMUSL_SIGNAL_SRCS-y +=3D $(LIBMUSL)/src/signal/powerpc/sigsetjmp.s
> +#LIBMUSL_SIGNAL_SRCS-y +=3D $(LIBMUSL)/src/signal/powerpc64/restore.s
> +#LIBMUSL_SIGNAL_SRCS-y +=3D =
$(LIBMUSL)/src/signal/powerpc64/sigsetjmp.s
> +#LIBMUSL_SIGNAL_SRCS-y +=3D $(LIBMUSL)/src/signal/s390x/restore.s
> +#LIBMUSL_SIGNAL_SRCS-y +=3D $(LIBMUSL)/src/signal/s390x/sigsetjmp.s
> +#LIBMUSL_SIGNAL_SRCS-y +=3D $(LIBMUSL)/src/signal/sh/restore.s
> +#LIBMUSL_SIGNAL_SRCS-y +=3D $(LIBMUSL)/src/signal/sh/sigsetjmp.s
> +#LIBMUSL_SIGNAL_SRCS-y +=3D $(LIBMUSL)/src/signal/x32/restore.s
> +#LIBMUSL_SIGNAL_SRCS-y +=3D $(LIBMUSL)/src/signal/x32/sigsetjmp.s
> +
> +$(eval $(call =
_libmusl_import_lib,signal,$(LIBMUSL_SIGNAL_HDRS-y),$(LIBMUSL_SIGNAL_SRCS-=
y)))
> diff --git a/Makefile.uk.musl.stat b/Makefile.uk.musl.stat
> index c754192..5ecc50b 100644
> --- a/Makefile.uk.musl.stat
> +++ b/Makefile.uk.musl.stat
> @@ -1,20 +1,31 @@
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/stat/__xstat.c
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/stat/chmod.c
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/stat/fchmod.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/stat/fchmodat.c
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/stat/fstat.c
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/stat/fstatat.c
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/stat/futimens.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/stat/futimesat.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/stat/lchmod.c
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/stat/lstat.c
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/stat/mkdir.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/stat/mkdirat.c
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/stat/mkfifo.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/stat/mkfifoat.c
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/stat/mknod.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/stat/mknodat.c
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/stat/stat.c
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/stat/statvfs.c
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/stat/umask.c
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/stat/utimensat.c
> +LIBMUSL_STAT_HDRS-y +=3D $(LIBMUSL)/include/errno.h
> +LIBMUSL_STAT_HDRS-y +=3D $(LIBMUSL)/include/fcntl.h
> +LIBMUSL_STAT_HDRS-y +=3D $(LIBMUSL)/src/internal/libc.h
> +LIBMUSL_STAT_HDRS-y +=3D $(LIBMUSL)/src/internal/syscall.h
> +LIBMUSL_STAT_HDRS-y +=3D $(LIBMUSL)/include/sys/statfs.h
> +LIBMUSL_STAT_HDRS-y +=3D $(LIBMUSL)/include/sys/stat.h
> +LIBMUSL_STAT_HDRS-y +=3D $(LIBMUSL)/include/sys/statvfs.h
> +LIBMUSL_STAT_HDRS-y +=3D $(LIBMUSL)/include/sys/time.h
> +
> +#LIBMUSL_STAT_SRCS-y +=3D $(LIBMUSL)/src/stat/__xstat.c
> +#LIBMUSL_STAT_SRCS-y +=3D $(LIBMUSL)/src/stat/chmod.c
> +#LIBMUSL_STAT_SRCS-y +=3D $(LIBMUSL)/src/stat/fchmod.c
> +LIBMUSL_STAT_SRCS-y +=3D $(LIBMUSL)/src/stat/fchmodat.c
> +#LIBMUSL_STAT_SRCS-y +=3D $(LIBMUSL)/src/stat/fstat.c
> +#LIBMUSL_STAT_SRCS-y +=3D $(LIBMUSL)/src/stat/fstatat.c
> +#LIBMUSL_STAT_SRCS-y +=3D $(LIBMUSL)/src/stat/futimens.c
> +LIBMUSL_STAT_SRCS-y +=3D $(LIBMUSL)/src/stat/futimesat.c
> +LIBMUSL_STAT_SRCS-y +=3D $(LIBMUSL)/src/stat/lchmod.c
> +#LIBMUSL_STAT_SRCS-y +=3D $(LIBMUSL)/src/stat/lstat.c
> +#LIBMUSL_STAT_SRCS-y +=3D $(LIBMUSL)/src/stat/mkdir.c
> +LIBMUSL_STAT_SRCS-y +=3D $(LIBMUSL)/src/stat/mkdirat.c
> +#LIBMUSL_STAT_SRCS-y +=3D $(LIBMUSL)/src/stat/mkfifo.c
> +LIBMUSL_STAT_SRCS-y +=3D $(LIBMUSL)/src/stat/mkfifoat.c
> +#LIBMUSL_STAT_SRCS-y +=3D $(LIBMUSL)/src/stat/mknod.c
> +LIBMUSL_STAT_SRCS-y +=3D $(LIBMUSL)/src/stat/mknodat.c
> +#LIBMUSL_STAT_SRCS-y +=3D $(LIBMUSL)/src/stat/stat.c
> +#LIBMUSL_STAT_SRCS-y +=3D $(LIBMUSL)/src/stat/statvfs.c
> +#LIBMUSL_STAT_SRCS-y +=3D $(LIBMUSL)/src/stat/umask.c
> +#LIBMUSL_STAT_SRCS-y +=3D $(LIBMUSL)/src/stat/utimensat.c
> +
> +$(eval $(call =
_libmusl_import_lib,stat,$(LIBMUSL_STAT_HDRS-y),$(LIBMUSL_STAT_SRCS-y)))
> diff --git a/Makefile.uk.musl.stdio b/Makefile.uk.musl.stdio
> index 8a9254e..8e4417e 100644
> --- a/Makefile.uk.musl.stdio
> +++ b/Makefile.uk.musl.stdio
> @@ -1,117 +1,149 @@
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/stdio/__fclose_ca.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/stdio/__fdopen.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/stdio/__fmodeflags.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/stdio/__fopen_rb_ca.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/stdio/__lockfile.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/stdio/__overflow.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/stdio/__stdio_close.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/stdio/__stdio_exit.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/stdio/__stdio_read.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/stdio/__stdio_seek.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/stdio/__stdio_write.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/stdio/__stdout_write.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/stdio/__string_read.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/stdio/__toread.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/stdio/__towrite.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/stdio/__uflow.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/stdio/asprintf.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/stdio/clearerr.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/stdio/dprintf.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/stdio/ext.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/stdio/ext2.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/stdio/fclose.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/stdio/feof.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/stdio/ferror.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/stdio/fflush.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/stdio/fgetc.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/stdio/fgetln.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/stdio/fgetpos.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/stdio/fgets.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/stdio/fgetwc.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/stdio/fgetws.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/stdio/fileno.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/stdio/flockfile.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/stdio/fmemopen.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/stdio/fopen.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/stdio/fopencookie.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/stdio/fprintf.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/stdio/fputc.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/stdio/fputs.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/stdio/fputwc.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/stdio/fputws.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/stdio/fread.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/stdio/freopen.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/stdio/fscanf.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/stdio/fseek.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/stdio/fsetpos.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/stdio/ftell.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/stdio/ftrylockfile.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/stdio/funlockfile.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/stdio/fwide.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/stdio/fwprintf.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/stdio/fwrite.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/stdio/fwscanf.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/stdio/getc.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/stdio/getc_unlocked.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/stdio/getchar.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/stdio/getchar_unlocked.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/stdio/getdelim.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/stdio/getline.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/stdio/gets.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/stdio/getw.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/stdio/getwc.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/stdio/getwchar.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/stdio/ofl.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/stdio/ofl_add.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/stdio/open_memstream.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/stdio/open_wmemstream.c
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/stdio/pclose.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/stdio/perror.c
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/stdio/popen.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/stdio/printf.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/stdio/putc.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/stdio/putc_unlocked.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/stdio/putchar.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/stdio/putchar_unlocked.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/stdio/puts.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/stdio/putw.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/stdio/putwc.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/stdio/putwchar.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/stdio/remove.c
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/stdio/rename.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/stdio/rewind.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/stdio/scanf.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/stdio/setbuf.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/stdio/setbuffer.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/stdio/setlinebuf.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/stdio/setvbuf.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/stdio/snprintf.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/stdio/sprintf.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/stdio/sscanf.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/stdio/stderr.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/stdio/stdin.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/stdio/stdout.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/stdio/swprintf.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/stdio/swscanf.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/stdio/tempnam.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/stdio/tmpfile.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/stdio/tmpnam.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/stdio/ungetc.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/stdio/ungetwc.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/stdio/vasprintf.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/stdio/vdprintf.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/stdio/vfprintf.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/stdio/vfscanf.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/stdio/vfwprintf.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/stdio/vfwscanf.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/stdio/vprintf.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/stdio/vscanf.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/stdio/vsnprintf.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/stdio/vsprintf.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/stdio/vsscanf.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/stdio/vswprintf.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/stdio/vswscanf.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/stdio/vwprintf.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/stdio/vwscanf.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/stdio/wprintf.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/stdio/wscanf.c
> +LIBMUSL_STDIO_HDRS-y +=3D $(LIBMUSL)/include/ctype.h
> +LIBMUSL_STDIO_HDRS-y +=3D $(LIBMUSL)/include/errno.h
> +LIBMUSL_STDIO_HDRS-y +=3D $(LIBMUSL)/include/fcntl.h
> +LIBMUSL_STDIO_HDRS-y +=3D $(LIBMUSL)/include/float.h
> +LIBMUSL_STDIO_HDRS-y +=3D $(LIBMUSL)/src/internal/floatscan.h
> +LIBMUSL_STDIO_HDRS-y +=3D $(LIBMUSL)/src/internal/intscan.h
> +LIBMUSL_STDIO_HDRS-y +=3D $(LIBMUSL)/include/inttypes.h
> +LIBMUSL_STDIO_HDRS-y +=3D $(LIBMUSL)/src/internal/libc.h
> +LIBMUSL_STDIO_HDRS-y +=3D $(LIBMUSL)/include/limits.h
> +LIBMUSL_STDIO_HDRS-y +=3D $(LIBMUSL)/src/internal/locale_impl.h
> +LIBMUSL_STDIO_HDRS-y +=3D $(LIBMUSL)/include/math.h
> +LIBMUSL_STDIO_HDRS-y +=3D $(LIBMUSL)/src/internal/pthread_impl.h
> +LIBMUSL_STDIO_HDRS-y +=3D $(LIBMUSL)/src/internal/shgetc.h
> +LIBMUSL_STDIO_HDRS-y +=3D $(LIBMUSL)/include/spawn.h
> +LIBMUSL_STDIO_HDRS-y +=3D $(LIBMUSL)/include/stdarg.h
> +LIBMUSL_STDIO_HDRS-y +=3D $(LIBMUSL)/include/stddef.h
> +LIBMUSL_STDIO_HDRS-y +=3D $(LIBMUSL)/include/stdint.h
> +LIBMUSL_STDIO_HDRS-y +=3D $(LIBMUSL)/include/stdio_ext.h
> +LIBMUSL_STDIO_HDRS-y +=3D $(LIBMUSL)/include/stdio.h
> +LIBMUSL_STDIO_HDRS-y +=3D $(LIBMUSL)/src/internal/stdio_impl.h
> +LIBMUSL_STDIO_HDRS-y +=3D $(LIBMUSL)/include/stdlib.h
> +LIBMUSL_STDIO_HDRS-y +=3D $(LIBMUSL)/include/string.h
> +LIBMUSL_STDIO_HDRS-y +=3D $(LIBMUSL)/src/internal/syscall.h
> +LIBMUSL_STDIO_HDRS-y +=3D $(LIBMUSL)/include/sys/ioctl.h
> +LIBMUSL_STDIO_HDRS-y +=3D $(LIBMUSL)/include/sys/stat.h
> +LIBMUSL_STDIO_HDRS-y +=3D $(LIBMUSL)/include/sys/uio.h
> +LIBMUSL_STDIO_HDRS-y +=3D $(LIBMUSL)/include/unistd.h
> +LIBMUSL_STDIO_HDRS-y +=3D $(LIBMUSL)/include/wchar.h
> +LIBMUSL_STDIO_HDRS-y +=3D $(LIBMUSL)/include/wctype.h
> +
> +LIBMUSL_STDIO_SRCS-y +=3D $(LIBMUSL)/src/stdio/__fclose_ca.c
> +LIBMUSL_STDIO_SRCS-y +=3D $(LIBMUSL)/src/stdio/__fdopen.c
> +LIBMUSL_STDIO_SRCS-y +=3D $(LIBMUSL)/src/stdio/__fmodeflags.c
> +LIBMUSL_STDIO_SRCS-y +=3D $(LIBMUSL)/src/stdio/__fopen_rb_ca.c
> +LIBMUSL_STDIO_SRCS-y +=3D $(LIBMUSL)/src/stdio/__lockfile.c
> +LIBMUSL_STDIO_SRCS-y +=3D $(LIBMUSL)/src/stdio/__overflow.c
> +LIBMUSL_STDIO_SRCS-y +=3D $(LIBMUSL)/src/stdio/__stdio_close.c
> +LIBMUSL_STDIO_SRCS-y +=3D $(LIBMUSL)/src/stdio/__stdio_exit.c
> +LIBMUSL_STDIO_SRCS-y +=3D $(LIBMUSL)/src/stdio/__stdio_read.c
> +LIBMUSL_STDIO_SRCS-y +=3D $(LIBMUSL)/src/stdio/__stdio_seek.c
> +LIBMUSL_STDIO_SRCS-y +=3D $(LIBMUSL)/src/stdio/__stdio_write.c
> +LIBMUSL_STDIO_SRCS-y +=3D $(LIBMUSL)/src/stdio/__stdout_write.c
> +LIBMUSL_STDIO_SRCS-y +=3D $(LIBMUSL)/src/stdio/__string_read.c
> +LIBMUSL_STDIO_SRCS-y +=3D $(LIBMUSL)/src/stdio/__toread.c
> +LIBMUSL_STDIO_SRCS-y +=3D $(LIBMUSL)/src/stdio/__towrite.c
> +LIBMUSL_STDIO_SRCS-y +=3D $(LIBMUSL)/src/stdio/__uflow.c
> +LIBMUSL_STDIO_SRCS-y +=3D $(LIBMUSL)/src/stdio/asprintf.c
> +LIBMUSL_STDIO_SRCS-y +=3D $(LIBMUSL)/src/stdio/clearerr.c
> +LIBMUSL_STDIO_SRCS-y +=3D $(LIBMUSL)/src/stdio/dprintf.c
> +LIBMUSL_STDIO_SRCS-y +=3D $(LIBMUSL)/src/stdio/ext.c
> +LIBMUSL_STDIO_SRCS-y +=3D $(LIBMUSL)/src/stdio/ext2.c
> +LIBMUSL_STDIO_SRCS-y +=3D $(LIBMUSL)/src/stdio/fclose.c
> +LIBMUSL_STDIO_SRCS-y +=3D $(LIBMUSL)/src/stdio/feof.c
> +LIBMUSL_STDIO_SRCS-y +=3D $(LIBMUSL)/src/stdio/ferror.c
> +LIBMUSL_STDIO_SRCS-y +=3D $(LIBMUSL)/src/stdio/fflush.c
> +LIBMUSL_STDIO_SRCS-y +=3D $(LIBMUSL)/src/stdio/fgetc.c
> +LIBMUSL_STDIO_SRCS-y +=3D $(LIBMUSL)/src/stdio/fgetln.c
> +LIBMUSL_STDIO_SRCS-y +=3D $(LIBMUSL)/src/stdio/fgetpos.c
> +LIBMUSL_STDIO_SRCS-y +=3D $(LIBMUSL)/src/stdio/fgets.c
> +LIBMUSL_STDIO_SRCS-y +=3D $(LIBMUSL)/src/stdio/fgetwc.c
> +LIBMUSL_STDIO_SRCS-y +=3D $(LIBMUSL)/src/stdio/fgetws.c
> +LIBMUSL_STDIO_SRCS-y +=3D $(LIBMUSL)/src/stdio/fileno.c
> +LIBMUSL_STDIO_SRCS-y +=3D $(LIBMUSL)/src/stdio/flockfile.c
> +LIBMUSL_STDIO_SRCS-y +=3D $(LIBMUSL)/src/stdio/fmemopen.c
> +LIBMUSL_STDIO_SRCS-y +=3D $(LIBMUSL)/src/stdio/fopen.c
> +LIBMUSL_STDIO_SRCS-y +=3D $(LIBMUSL)/src/stdio/fopencookie.c
> +LIBMUSL_STDIO_SRCS-y +=3D $(LIBMUSL)/src/stdio/fprintf.c
> +LIBMUSL_STDIO_SRCS-y +=3D $(LIBMUSL)/src/stdio/fputc.c
> +LIBMUSL_STDIO_SRCS-y +=3D $(LIBMUSL)/src/stdio/fputs.c
> +LIBMUSL_STDIO_SRCS-y +=3D $(LIBMUSL)/src/stdio/fputwc.c
> +LIBMUSL_STDIO_SRCS-y +=3D $(LIBMUSL)/src/stdio/fputws.c
> +LIBMUSL_STDIO_SRCS-y +=3D $(LIBMUSL)/src/stdio/fread.c
> +LIBMUSL_STDIO_SRCS-y +=3D $(LIBMUSL)/src/stdio/freopen.c
> +LIBMUSL_STDIO_SRCS-y +=3D $(LIBMUSL)/src/stdio/fscanf.c
> +LIBMUSL_STDIO_SRCS-y +=3D $(LIBMUSL)/src/stdio/fseek.c
> +LIBMUSL_STDIO_SRCS-y +=3D $(LIBMUSL)/src/stdio/fsetpos.c
> +LIBMUSL_STDIO_SRCS-y +=3D $(LIBMUSL)/src/stdio/ftell.c
> +LIBMUSL_STDIO_SRCS-y +=3D $(LIBMUSL)/src/stdio/ftrylockfile.c
> +LIBMUSL_STDIO_SRCS-y +=3D $(LIBMUSL)/src/stdio/funlockfile.c
> +LIBMUSL_STDIO_SRCS-y +=3D $(LIBMUSL)/src/stdio/fwide.c
> +LIBMUSL_STDIO_SRCS-y +=3D $(LIBMUSL)/src/stdio/fwprintf.c
> +LIBMUSL_STDIO_SRCS-y +=3D $(LIBMUSL)/src/stdio/fwrite.c
> +LIBMUSL_STDIO_SRCS-y +=3D $(LIBMUSL)/src/stdio/fwscanf.c
> +LIBMUSL_STDIO_SRCS-y +=3D $(LIBMUSL)/src/stdio/getc.c
> +LIBMUSL_STDIO_SRCS-y +=3D $(LIBMUSL)/src/stdio/getc_unlocked.c
> +LIBMUSL_STDIO_SRCS-y +=3D $(LIBMUSL)/src/stdio/getchar.c
> +LIBMUSL_STDIO_SRCS-y +=3D $(LIBMUSL)/src/stdio/getchar_unlocked.c
> +LIBMUSL_STDIO_SRCS-y +=3D $(LIBMUSL)/src/stdio/getdelim.c
> +LIBMUSL_STDIO_SRCS-y +=3D $(LIBMUSL)/src/stdio/getline.c
> +LIBMUSL_STDIO_SRCS-y +=3D $(LIBMUSL)/src/stdio/gets.c
> +LIBMUSL_STDIO_SRCS-y +=3D $(LIBMUSL)/src/stdio/getw.c
> +LIBMUSL_STDIO_SRCS-y +=3D $(LIBMUSL)/src/stdio/getwc.c
> +LIBMUSL_STDIO_SRCS-y +=3D $(LIBMUSL)/src/stdio/getwchar.c
> +LIBMUSL_STDIO_SRCS-y +=3D $(LIBMUSL)/src/stdio/ofl.c
> +LIBMUSL_STDIO_SRCS-y +=3D $(LIBMUSL)/src/stdio/ofl_add.c
> +LIBMUSL_STDIO_SRCS-y +=3D $(LIBMUSL)/src/stdio/open_memstream.c
> +LIBMUSL_STDIO_SRCS-y +=3D $(LIBMUSL)/src/stdio/open_wmemstream.c
> +#LIBMUSL_STDIO_SRCS-y +=3D $(LIBMUSL)/src/stdio/pclose.c
> +LIBMUSL_STDIO_SRCS-y +=3D $(LIBMUSL)/src/stdio/perror.c
> +#LIBMUSL_STDIO_SRCS-y +=3D $(LIBMUSL)/src/stdio/popen.c
> +LIBMUSL_STDIO_SRCS-y +=3D $(LIBMUSL)/src/stdio/printf.c
> +LIBMUSL_STDIO_SRCS-y +=3D $(LIBMUSL)/src/stdio/putc.c
> +LIBMUSL_STDIO_SRCS-y +=3D $(LIBMUSL)/src/stdio/putc_unlocked.c
> +LIBMUSL_STDIO_SRCS-y +=3D $(LIBMUSL)/src/stdio/putchar.c
> +LIBMUSL_STDIO_SRCS-y +=3D $(LIBMUSL)/src/stdio/putchar_unlocked.c
> +LIBMUSL_STDIO_SRCS-y +=3D $(LIBMUSL)/src/stdio/puts.c
> +LIBMUSL_STDIO_SRCS-y +=3D $(LIBMUSL)/src/stdio/putw.c
> +LIBMUSL_STDIO_SRCS-y +=3D $(LIBMUSL)/src/stdio/putwc.c
> +LIBMUSL_STDIO_SRCS-y +=3D $(LIBMUSL)/src/stdio/putwchar.c
> +LIBMUSL_STDIO_SRCS-y +=3D $(LIBMUSL)/src/stdio/remove.c
> +#LIBMUSL_STDIO_SRCS-y +=3D $(LIBMUSL)/src/stdio/rename.c
> +LIBMUSL_STDIO_SRCS-y +=3D $(LIBMUSL)/src/stdio/rewind.c
> +LIBMUSL_STDIO_SRCS-y +=3D $(LIBMUSL)/src/stdio/scanf.c
> +LIBMUSL_STDIO_SRCS-y +=3D $(LIBMUSL)/src/stdio/setbuf.c
> +LIBMUSL_STDIO_SRCS-y +=3D $(LIBMUSL)/src/stdio/setbuffer.c
> +LIBMUSL_STDIO_SRCS-y +=3D $(LIBMUSL)/src/stdio/setlinebuf.c
> +LIBMUSL_STDIO_SRCS-y +=3D $(LIBMUSL)/src/stdio/setvbuf.c
> +LIBMUSL_STDIO_SRCS-y +=3D $(LIBMUSL)/src/stdio/snprintf.c
> +LIBMUSL_STDIO_SRCS-y +=3D $(LIBMUSL)/src/stdio/sprintf.c
> +LIBMUSL_STDIO_SRCS-y +=3D $(LIBMUSL)/src/stdio/sscanf.c
> +LIBMUSL_STDIO_SRCS-y +=3D $(LIBMUSL)/src/stdio/stderr.c
> +LIBMUSL_STDIO_SRCS-y +=3D $(LIBMUSL)/src/stdio/stdin.c
> +LIBMUSL_STDIO_SRCS-y +=3D $(LIBMUSL)/src/stdio/stdout.c
> +LIBMUSL_STDIO_SRCS-y +=3D $(LIBMUSL)/src/stdio/swprintf.c
> +LIBMUSL_STDIO_SRCS-y +=3D $(LIBMUSL)/src/stdio/swscanf.c
> +LIBMUSL_STDIO_SRCS-y +=3D $(LIBMUSL)/src/stdio/tempnam.c
> +LIBMUSL_STDIO_SRCS-y +=3D $(LIBMUSL)/src/stdio/tmpfile.c
> +LIBMUSL_STDIO_SRCS-y +=3D $(LIBMUSL)/src/stdio/tmpnam.c
> +LIBMUSL_STDIO_SRCS-y +=3D $(LIBMUSL)/src/stdio/ungetc.c
> +LIBMUSL_STDIO_SRCS-y +=3D $(LIBMUSL)/src/stdio/ungetwc.c
> +LIBMUSL_STDIO_SRCS-y +=3D $(LIBMUSL)/src/stdio/vasprintf.c
> +LIBMUSL_STDIO_SRCS-y +=3D $(LIBMUSL)/src/stdio/vdprintf.c
> +LIBMUSL_STDIO_SRCS-y +=3D $(LIBMUSL)/src/stdio/vfprintf.c
> +LIBMUSL_STDIO_SRCS-y +=3D $(LIBMUSL)/src/stdio/vfscanf.c
> +LIBMUSL_STDIO_SRCS-y +=3D $(LIBMUSL)/src/stdio/vfwprintf.c
> +LIBMUSL_STDIO_SRCS-y +=3D $(LIBMUSL)/src/stdio/vfwscanf.c
> +LIBMUSL_STDIO_SRCS-y +=3D $(LIBMUSL)/src/stdio/vprintf.c
> +LIBMUSL_STDIO_SRCS-y +=3D $(LIBMUSL)/src/stdio/vscanf.c
> +LIBMUSL_STDIO_SRCS-y +=3D $(LIBMUSL)/src/stdio/vsnprintf.c
> +LIBMUSL_STDIO_SRCS-y +=3D $(LIBMUSL)/src/stdio/vsprintf.c
> +LIBMUSL_STDIO_SRCS-y +=3D $(LIBMUSL)/src/stdio/vsscanf.c
> +LIBMUSL_STDIO_SRCS-y +=3D $(LIBMUSL)/src/stdio/vswprintf.c
> +LIBMUSL_STDIO_SRCS-y +=3D $(LIBMUSL)/src/stdio/vswscanf.c
> +LIBMUSL_STDIO_SRCS-y +=3D $(LIBMUSL)/src/stdio/vwprintf.c
> +LIBMUSL_STDIO_SRCS-y +=3D $(LIBMUSL)/src/stdio/vwscanf.c
> +LIBMUSL_STDIO_SRCS-y +=3D $(LIBMUSL)/src/stdio/wprintf.c
> +LIBMUSL_STDIO_SRCS-y +=3D $(LIBMUSL)/src/stdio/wscanf.c
> +
> +$(eval $(call =
_libmusl_import_lib,stdio,$(LIBMUSL_STDIO_HDRS-y),$(LIBMUSL_STDIO_SRCS-y))=
)
> diff --git a/Makefile.uk.musl.stdlib b/Makefile.uk.musl.stdlib
> index 21167f1..9529226 100644
> --- a/Makefile.uk.musl.stdlib
> +++ b/Makefile.uk.musl.stdlib
> @@ -1,21 +1,39 @@
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/stdlib/abs.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/stdlib/atof.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/stdlib/atoi.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/stdlib/atol.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/stdlib/atoll.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/stdlib/bsearch.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/stdlib/div.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/stdlib/ecvt.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/stdlib/fcvt.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/stdlib/gcvt.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/stdlib/imaxabs.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/stdlib/imaxdiv.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/stdlib/labs.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/stdlib/ldiv.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/stdlib/llabs.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/stdlib/lldiv.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/stdlib/qsort.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/stdlib/strtod.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/stdlib/strtol.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/stdlib/wcstod.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/stdlib/wcstol.c
> +LIBMUSL_STDLIB_HDRS-y +=3D $(LIBMUSL)/src/internal/atomic.h
> +LIBMUSL_STDLIB_HDRS-y +=3D $(LIBMUSL)/include/ctype.h
> +LIBMUSL_STDLIB_HDRS-y +=3D $(LIBMUSL)/src/internal/floatscan.h
> +LIBMUSL_STDLIB_HDRS-y +=3D $(LIBMUSL)/src/internal/intscan.h
> +LIBMUSL_STDLIB_HDRS-y +=3D $(LIBMUSL)/include/inttypes.h
> +LIBMUSL_STDLIB_HDRS-y +=3D $(LIBMUSL)/src/internal/libc.h
> +LIBMUSL_STDLIB_HDRS-y +=3D $(LIBMUSL)/include/limits.h
> +LIBMUSL_STDLIB_HDRS-y +=3D $(LIBMUSL)/src/internal/shgetc.h
> +LIBMUSL_STDLIB_HDRS-y +=3D $(LIBMUSL)/include/stdint.h
> +LIBMUSL_STDLIB_HDRS-y +=3D $(LIBMUSL)/include/stdio.h
> +LIBMUSL_STDLIB_HDRS-y +=3D $(LIBMUSL)/src/internal/stdio_impl.h
> +LIBMUSL_STDLIB_HDRS-y +=3D $(LIBMUSL)/include/stdlib.h
> +LIBMUSL_STDLIB_HDRS-y +=3D $(LIBMUSL)/include/string.h
> +LIBMUSL_STDLIB_HDRS-y +=3D $(LIBMUSL)/include/wchar.h
> +LIBMUSL_STDLIB_HDRS-y +=3D $(LIBMUSL)/include/wctype.h
> +
> +LIBMUSL_STDLIB_SRCS-y +=3D $(LIBMUSL)/src/stdlib/abs.c
> +LIBMUSL_STDLIB_SRCS-y +=3D $(LIBMUSL)/src/stdlib/atof.c
> +LIBMUSL_STDLIB_SRCS-y +=3D $(LIBMUSL)/src/stdlib/atoi.c
> +LIBMUSL_STDLIB_SRCS-y +=3D $(LIBMUSL)/src/stdlib/atol.c
> +LIBMUSL_STDLIB_SRCS-y +=3D $(LIBMUSL)/src/stdlib/atoll.c
> +LIBMUSL_STDLIB_SRCS-y +=3D $(LIBMUSL)/src/stdlib/bsearch.c
> +LIBMUSL_STDLIB_SRCS-y +=3D $(LIBMUSL)/src/stdlib/div.c
> +LIBMUSL_STDLIB_SRCS-y +=3D $(LIBMUSL)/src/stdlib/ecvt.c
> +LIBMUSL_STDLIB_SRCS-y +=3D $(LIBMUSL)/src/stdlib/fcvt.c
> +LIBMUSL_STDLIB_SRCS-y +=3D $(LIBMUSL)/src/stdlib/gcvt.c
> +LIBMUSL_STDLIB_SRCS-y +=3D $(LIBMUSL)/src/stdlib/imaxabs.c
> +LIBMUSL_STDLIB_SRCS-y +=3D $(LIBMUSL)/src/stdlib/imaxdiv.c
> +LIBMUSL_STDLIB_SRCS-y +=3D $(LIBMUSL)/src/stdlib/labs.c
> +LIBMUSL_STDLIB_SRCS-y +=3D $(LIBMUSL)/src/stdlib/ldiv.c
> +LIBMUSL_STDLIB_SRCS-y +=3D $(LIBMUSL)/src/stdlib/llabs.c
> +LIBMUSL_STDLIB_SRCS-y +=3D $(LIBMUSL)/src/stdlib/lldiv.c
> +LIBMUSL_STDLIB_SRCS-y +=3D $(LIBMUSL)/src/stdlib/qsort.c
> +LIBMUSL_STDLIB_SRCS-y +=3D $(LIBMUSL)/src/stdlib/strtod.c
> +LIBMUSL_STDLIB_SRCS-y +=3D $(LIBMUSL)/src/stdlib/strtol.c
> +LIBMUSL_STDLIB_SRCS-y +=3D $(LIBMUSL)/src/stdlib/wcstod.c
> +LIBMUSL_STDLIB_SRCS-y +=3D $(LIBMUSL)/src/stdlib/wcstol.c
> +
> +$(eval $(call =
_libmusl_import_lib,stdlib,$(LIBMUSL_STDLIB_HDRS-y),$(LIBMUSL_STDLIB_SRCS-=
y)))
> diff --git a/Makefile.uk.musl.string b/Makefile.uk.musl.string
> index 63794f5..45316b4 100644
> --- a/Makefile.uk.musl.string
> +++ b/Makefile.uk.musl.string
> @@ -1,91 +1,108 @@
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/string/bcmp.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/string/bcopy.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/string/bzero.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/string/index.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/string/memccpy.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/string/memchr.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/string/memcmp.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/string/memmem.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/string/mempcpy.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/string/memrchr.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/string/rindex.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/string/stpcpy.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/string/stpncpy.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/string/strcasecmp.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/string/strcasestr.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/string/strcat.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/string/strchr.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/string/strchrnul.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/string/strcmp.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/string/strcpy.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/string/strcspn.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/string/strdup.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/string/strerror_r.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/string/strlcat.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/string/strlcpy.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/string/strlen.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/string/strncasecmp.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/string/strncat.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/string/strncmp.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/string/strncpy.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/string/strndup.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/string/strnlen.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/string/strpbrk.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/string/strrchr.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/string/strsep.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/string/strsignal.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/string/strspn.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/string/strstr.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/string/strtok.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/string/strtok_r.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/string/strverscmp.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/string/swab.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/string/wcpcpy.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/string/wcpncpy.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/string/wcscasecmp.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/string/wcscasecmp_l.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/string/wcscat.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/string/wcschr.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/string/wcscmp.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/string/wcscpy.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/string/wcscspn.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/string/wcsdup.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/string/wcslen.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/string/wcsncasecmp.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/string/wcsncasecmp_l.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/string/wcsncat.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/string/wcsncmp.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/string/wcsncpy.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/string/wcsnlen.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/string/wcspbrk.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/string/wcsrchr.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/string/wcsspn.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/string/wcsstr.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/string/wcstok.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/string/wcswcs.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/string/wmemchr.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/string/wmemcmp.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/string/wmemcpy.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/string/wmemmove.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/string/wmemset.c
> +LIBMUSL_STRING_HDRS-y +=3D $(LIBMUSL)/include/ctype.h
> +LIBMUSL_STRING_HDRS-y +=3D $(LIBMUSL)/include/endian.h
> +LIBMUSL_STRING_HDRS-y +=3D $(LIBMUSL)/include/errno.h
> +LIBMUSL_STRING_HDRS-y +=3D $(LIBMUSL)/src/internal/libc.h
> +LIBMUSL_STRING_HDRS-y +=3D $(LIBMUSL)/include/limits.h
> +LIBMUSL_STRING_HDRS-y +=3D $(LIBMUSL)/src/internal/locale_impl.h
> +LIBMUSL_STRING_HDRS-y +=3D $(LIBMUSL)/include/signal.h
> +LIBMUSL_STRING_HDRS-y +=3D $(LIBMUSL)/include/stdint.h
> +LIBMUSL_STRING_HDRS-y +=3D $(LIBMUSL)/include/stdlib.h
> +LIBMUSL_STRING_HDRS-y +=3D $(LIBMUSL)/include/string.h
> +LIBMUSL_STRING_HDRS-y +=3D $(LIBMUSL)/include/strings.h
> +LIBMUSL_STRING_HDRS-y +=3D $(LIBMUSL)/include/unistd.h
> +LIBMUSL_STRING_HDRS-y +=3D $(LIBMUSL)/include/wchar.h
> +LIBMUSL_STRING_HDRS-y +=3D $(LIBMUSL)/include/wctype.h
> +
> +LIBMUSL_STRING_SRCS-y +=3D $(LIBMUSL)/src/string/bcmp.c
> +LIBMUSL_STRING_SRCS-y +=3D $(LIBMUSL)/src/string/bcopy.c
> +LIBMUSL_STRING_SRCS-y +=3D $(LIBMUSL)/src/string/bzero.c
> +LIBMUSL_STRING_SRCS-y +=3D $(LIBMUSL)/src/string/index.c
> +LIBMUSL_STRING_SRCS-y +=3D $(LIBMUSL)/src/string/memccpy.c
> +LIBMUSL_STRING_SRCS-y +=3D $(LIBMUSL)/src/string/memchr.c
> +LIBMUSL_STRING_SRCS-y +=3D $(LIBMUSL)/src/string/memcmp.c
> +LIBMUSL_STRING_SRCS-y +=3D $(LIBMUSL)/src/string/memmem.c
> +LIBMUSL_STRING_SRCS-y +=3D $(LIBMUSL)/src/string/mempcpy.c
> +LIBMUSL_STRING_SRCS-y +=3D $(LIBMUSL)/src/string/memrchr.c
> +LIBMUSL_STRING_SRCS-y +=3D $(LIBMUSL)/src/string/rindex.c
> +LIBMUSL_STRING_SRCS-y +=3D $(LIBMUSL)/src/string/stpcpy.c
> +LIBMUSL_STRING_SRCS-y +=3D $(LIBMUSL)/src/string/stpncpy.c
> +LIBMUSL_STRING_SRCS-y +=3D $(LIBMUSL)/src/string/strcasecmp.c
> +LIBMUSL_STRING_SRCS-y +=3D $(LIBMUSL)/src/string/strcasestr.c
> +LIBMUSL_STRING_SRCS-y +=3D $(LIBMUSL)/src/string/strcat.c
> +LIBMUSL_STRING_SRCS-y +=3D $(LIBMUSL)/src/string/strchr.c
> +LIBMUSL_STRING_SRCS-y +=3D $(LIBMUSL)/src/string/strchrnul.c
> +LIBMUSL_STRING_SRCS-y +=3D $(LIBMUSL)/src/string/strcmp.c
> +LIBMUSL_STRING_SRCS-y +=3D $(LIBMUSL)/src/string/strcpy.c
> +LIBMUSL_STRING_SRCS-y +=3D $(LIBMUSL)/src/string/strcspn.c
> +LIBMUSL_STRING_SRCS-y +=3D $(LIBMUSL)/src/string/strdup.c
> +LIBMUSL_STRING_SRCS-y +=3D $(LIBMUSL)/src/string/strerror_r.c
> +LIBMUSL_STRING_SRCS-y +=3D $(LIBMUSL)/src/string/strlcat.c
> +LIBMUSL_STRING_SRCS-y +=3D $(LIBMUSL)/src/string/strlcpy.c
> +LIBMUSL_STRING_SRCS-y +=3D $(LIBMUSL)/src/string/strlen.c
> +LIBMUSL_STRING_SRCS-y +=3D $(LIBMUSL)/src/string/strncasecmp.c
> +LIBMUSL_STRING_SRCS-y +=3D $(LIBMUSL)/src/string/strncat.c
> +LIBMUSL_STRING_SRCS-y +=3D $(LIBMUSL)/src/string/strncmp.c
> +LIBMUSL_STRING_SRCS-y +=3D $(LIBMUSL)/src/string/strncpy.c
> +LIBMUSL_STRING_SRCS-y +=3D $(LIBMUSL)/src/string/strndup.c
> +LIBMUSL_STRING_SRCS-y +=3D $(LIBMUSL)/src/string/strnlen.c
> +LIBMUSL_STRING_SRCS-y +=3D $(LIBMUSL)/src/string/strpbrk.c
> +LIBMUSL_STRING_SRCS-y +=3D $(LIBMUSL)/src/string/strrchr.c
> +LIBMUSL_STRING_SRCS-y +=3D $(LIBMUSL)/src/string/strsep.c
> +LIBMUSL_STRING_SRCS-y +=3D $(LIBMUSL)/src/string/strsignal.c
> +LIBMUSL_STRING_SRCS-y +=3D $(LIBMUSL)/src/string/strspn.c
> +LIBMUSL_STRING_SRCS-y +=3D $(LIBMUSL)/src/string/strstr.c
> +LIBMUSL_STRING_SRCS-y +=3D $(LIBMUSL)/src/string/strtok.c
> +LIBMUSL_STRING_SRCS-y +=3D $(LIBMUSL)/src/string/strtok_r.c
> +LIBMUSL_STRING_SRCS-y +=3D $(LIBMUSL)/src/string/strverscmp.c
> +LIBMUSL_STRING_SRCS-y +=3D $(LIBMUSL)/src/string/swab.c
> +LIBMUSL_STRING_SRCS-y +=3D $(LIBMUSL)/src/string/wcpcpy.c
> +LIBMUSL_STRING_SRCS-y +=3D $(LIBMUSL)/src/string/wcpncpy.c
> +LIBMUSL_STRING_SRCS-y +=3D $(LIBMUSL)/src/string/wcscasecmp.c
> +LIBMUSL_STRING_SRCS-y +=3D $(LIBMUSL)/src/string/wcscasecmp_l.c
> +LIBMUSL_STRING_SRCS-y +=3D $(LIBMUSL)/src/string/wcscat.c
> +LIBMUSL_STRING_SRCS-y +=3D $(LIBMUSL)/src/string/wcschr.c
> +LIBMUSL_STRING_SRCS-y +=3D $(LIBMUSL)/src/string/wcscmp.c
> +LIBMUSL_STRING_SRCS-y +=3D $(LIBMUSL)/src/string/wcscpy.c
> +LIBMUSL_STRING_SRCS-y +=3D $(LIBMUSL)/src/string/wcscspn.c
> +LIBMUSL_STRING_SRCS-y +=3D $(LIBMUSL)/src/string/wcsdup.c
> +LIBMUSL_STRING_SRCS-y +=3D $(LIBMUSL)/src/string/wcslen.c
> +LIBMUSL_STRING_SRCS-y +=3D $(LIBMUSL)/src/string/wcsncasecmp.c
> +LIBMUSL_STRING_SRCS-y +=3D $(LIBMUSL)/src/string/wcsncasecmp_l.c
> +LIBMUSL_STRING_SRCS-y +=3D $(LIBMUSL)/src/string/wcsncat.c
> +LIBMUSL_STRING_SRCS-y +=3D $(LIBMUSL)/src/string/wcsncmp.c
> +LIBMUSL_STRING_SRCS-y +=3D $(LIBMUSL)/src/string/wcsncpy.c
> +LIBMUSL_STRING_SRCS-y +=3D $(LIBMUSL)/src/string/wcsnlen.c
> +LIBMUSL_STRING_SRCS-y +=3D $(LIBMUSL)/src/string/wcspbrk.c
> +LIBMUSL_STRING_SRCS-y +=3D $(LIBMUSL)/src/string/wcsrchr.c
> +LIBMUSL_STRING_SRCS-y +=3D $(LIBMUSL)/src/string/wcsspn.c
> +LIBMUSL_STRING_SRCS-y +=3D $(LIBMUSL)/src/string/wcsstr.c
> +LIBMUSL_STRING_SRCS-y +=3D $(LIBMUSL)/src/string/wcstok.c
> +LIBMUSL_STRING_SRCS-y +=3D $(LIBMUSL)/src/string/wcswcs.c
> +LIBMUSL_STRING_SRCS-y +=3D $(LIBMUSL)/src/string/wmemchr.c
> +LIBMUSL_STRING_SRCS-y +=3D $(LIBMUSL)/src/string/wmemcmp.c
> +LIBMUSL_STRING_SRCS-y +=3D $(LIBMUSL)/src/string/wmemcpy.c
> +LIBMUSL_STRING_SRCS-y +=3D $(LIBMUSL)/src/string/wmemmove.c
> +LIBMUSL_STRING_SRCS-y +=3D $(LIBMUSL)/src/string/wmemset.c
>=20
> ifeq (arm,$(CONFIG_UK_ARCH))
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/string/arm/__aeabi_memcpy.s|arm
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/string/arm/__aeabi_memset.s|arm
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/string/arm/memcpy.c|arm
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/string/arm/memcpy_le.S|arm
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/string/memmove.c|arm
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/string/memset.c|arm
> +LIBMUSL_STRING_SRCS-y +=3D =
$(LIBMUSL)/src/string/arm/__aeabi_memcpy.s|arm
> +LIBMUSL_STRING_SRCS-y +=3D =
$(LIBMUSL)/src/string/arm/__aeabi_memset.s|arm
> +LIBMUSL_STRING_SRCS-y +=3D $(LIBMUSL)/src/string/arm/memcpy.c|arm
> +LIBMUSL_STRING_SRCS-y +=3D $(LIBMUSL)/src/string/arm/memcpy_le.S|arm
> +LIBMUSL_STRING_SRCS-y +=3D $(LIBMUSL)/src/string/memmove.c|arm
> +LIBMUSL_STRING_SRCS-y +=3D $(LIBMUSL)/src/string/memset.c|arm
> else ifeq (x86_32,$(CONFIG_UK_ARCH))
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/string/i386/memcpy.s|i386
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/string/i386/memmove.s|i386
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/string/i386/memset.s|i386
> +LIBMUSL_STRING_SRCS-y +=3D $(LIBMUSL)/src/string/i386/memcpy.s|i386
> +LIBMUSL_STRING_SRCS-y +=3D $(LIBMUSL)/src/string/i386/memmove.s|i386
> +LIBMUSL_STRING_SRCS-y +=3D $(LIBMUSL)/src/string/i386/memset.s|i386
> else ifeq (x86_64,$(CONFIG_UK_ARCH))
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/string/x86_64/memcpy.s|x86_64
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/string/x86_64/memmove.s|x86_64
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/string/x86_64/memset.s|x86_64
> +LIBMUSL_STRING_SRCS-y +=3D =
$(LIBMUSL)/src/string/x86_64/memcpy.s|x86_64
> +LIBMUSL_STRING_SRCS-y +=3D =
$(LIBMUSL)/src/string/x86_64/memmove.s|x86_64
> +LIBMUSL_STRING_SRCS-y +=3D =
$(LIBMUSL)/src/string/x86_64/memset.s|x86_64
> else
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/string/memcpy.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/string/memmove.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/string/memset.c
> -endif
> \ No newline at end of file
> +LIBMUSL_STRING_SRCS-y +=3D $(LIBMUSL)/src/string/memcpy.c
> +LIBMUSL_STRING_SRCS-y +=3D $(LIBMUSL)/src/string/memmove.c
> +LIBMUSL_STRING_SRCS-y +=3D $(LIBMUSL)/src/string/memset.c
> +endif
> +
> +$(eval $(call =
_libmusl_import_lib,string,$(LIBMUSL_STRING_HDRS-y),$(LIBMUSL_STRING_SRCS-=
y)))
> diff --git a/Makefile.uk.musl.temp b/Makefile.uk.musl.temp
> index 1107ffc..3d7f554 100644
> --- a/Makefile.uk.musl.temp
> +++ b/Makefile.uk.musl.temp
> @@ -1,7 +1,19 @@
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/temp/__randname.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/temp/mkdtemp.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/temp/mkostemp.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/temp/mkostemps.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/temp/mkstemp.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/temp/mkstemps.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/temp/mktemp.c
> +LIBMUSL_TEMP_HDRS-y +=3D $(LIBMUSL)/include/errno.h
> +LIBMUSL_TEMP_HDRS-y +=3D $(LIBMUSL)/include/fcntl.h
> +LIBMUSL_TEMP_HDRS-y +=3D $(LIBMUSL)/src/internal/libc.h
> +LIBMUSL_TEMP_HDRS-y +=3D $(LIBMUSL)/include/stdint.h
> +LIBMUSL_TEMP_HDRS-y +=3D $(LIBMUSL)/include/stdlib.h
> +LIBMUSL_TEMP_HDRS-y +=3D $(LIBMUSL)/include/string.h
> +LIBMUSL_TEMP_HDRS-y +=3D $(LIBMUSL)/include/sys/stat.h
> +LIBMUSL_TEMP_HDRS-y +=3D $(LIBMUSL)/include/time.h
> +LIBMUSL_TEMP_HDRS-y +=3D $(LIBMUSL)/include/unistd.h
> +
> +LIBMUSL_TEMP_SRCS-y +=3D $(LIBMUSL)/src/temp/__randname.c
> +LIBMUSL_TEMP_SRCS-y +=3D $(LIBMUSL)/src/temp/mkdtemp.c
> +LIBMUSL_TEMP_SRCS-y +=3D $(LIBMUSL)/src/temp/mkostemp.c
> +LIBMUSL_TEMP_SRCS-y +=3D $(LIBMUSL)/src/temp/mkostemps.c
> +LIBMUSL_TEMP_SRCS-y +=3D $(LIBMUSL)/src/temp/mkstemp.c
> +LIBMUSL_TEMP_SRCS-y +=3D $(LIBMUSL)/src/temp/mkstemps.c
> +LIBMUSL_TEMP_SRCS-y +=3D $(LIBMUSL)/src/temp/mktemp.c
> +
> +$(eval $(call =
_libmusl_import_lib,temp,$(LIBMUSL_TEMP_HDRS-y),$(LIBMUSL_TEMP_SRCS-y)))
> diff --git a/Makefile.uk.musl.termios b/Makefile.uk.musl.termios
> index 734c13b..318fc92 100644
> --- a/Makefile.uk.musl.termios
> +++ b/Makefile.uk.musl.termios
> @@ -1,10 +1,18 @@
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/termios/cfgetospeed.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/termios/cfmakeraw.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/termios/cfsetospeed.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/termios/tcdrain.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/termios/tcflow.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/termios/tcflush.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/termios/tcgetattr.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/termios/tcgetsid.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/termios/tcsendbreak.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/termios/tcsetattr.c
> +LIBMUSL_TERMIOS_HDRS-y +=3D $(LIBMUSL)/include/errno.h
> +LIBMUSL_TERMIOS_HDRS-y +=3D $(LIBMUSL)/src/internal/libc.h
> +LIBMUSL_TERMIOS_HDRS-y +=3D $(LIBMUSL)/src/internal/syscall.h
> +LIBMUSL_TERMIOS_HDRS-y +=3D $(LIBMUSL)/include/sys/ioctl.h
> +LIBMUSL_TERMIOS_HDRS-y +=3D $(LIBMUSL)/include/termios.h
> +
> +LIBMUSL_TERMIOS_SRCS-y +=3D $(LIBMUSL)/src/termios/cfgetospeed.c
> +LIBMUSL_TERMIOS_SRCS-y +=3D $(LIBMUSL)/src/termios/cfmakeraw.c
> +LIBMUSL_TERMIOS_SRCS-y +=3D $(LIBMUSL)/src/termios/cfsetospeed.c
> +LIBMUSL_TERMIOS_SRCS-y +=3D $(LIBMUSL)/src/termios/tcdrain.c
> +LIBMUSL_TERMIOS_SRCS-y +=3D $(LIBMUSL)/src/termios/tcflow.c
> +LIBMUSL_TERMIOS_SRCS-y +=3D $(LIBMUSL)/src/termios/tcflush.c
> +LIBMUSL_TERMIOS_SRCS-y +=3D $(LIBMUSL)/src/termios/tcgetattr.c
> +LIBMUSL_TERMIOS_SRCS-y +=3D $(LIBMUSL)/src/termios/tcgetsid.c
> +LIBMUSL_TERMIOS_SRCS-y +=3D $(LIBMUSL)/src/termios/tcsendbreak.c
> +LIBMUSL_TERMIOS_SRCS-y +=3D $(LIBMUSL)/src/termios/tcsetattr.c
> +
> +$(eval $(call =
_libmusl_import_lib,termios,$(LIBMUSL_TERMIOS_HDRS-y),$(LIBMUSL_TERMIOS_SR=
CS-y)))
> diff --git a/Makefile.uk.musl.thread b/Makefile.uk.musl.thread
> index f5e567a..ceab827 100644
> --- a/Makefile.uk.musl.thread
> +++ b/Makefile.uk.musl.thread
> @@ -1,197 +1,229 @@
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/thread/__futex.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/thread/__lock.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/thread/__syscall_cp.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/thread/__timedwait.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/thread/__tls_get_addr.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/thread/__wait.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/thread/call_once.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/thread/cnd_broadcast.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/thread/cnd_destroy.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/thread/cnd_init.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/thread/cnd_signal.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/thread/cnd_timedwait.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/thread/cnd_wait.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/thread/lock_ptc.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/thread/mtx_destroy.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/thread/mtx_init.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/thread/mtx_lock.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/thread/mtx_timedlock.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/thread/mtx_trylock.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/thread/mtx_unlock.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/thread/pthread_atfork.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/thread/pthread_attr_destroy.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/thread/pthread_attr_get.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/thread/pthread_attr_init.c
> -LIBMUSL_SRCS-y +=3D =
$(LIBMUSL)/src/thread/pthread_attr_setdetachstate.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/thread/pthread_attr_setguardsize.c
> -LIBMUSL_SRCS-y +=3D =
$(LIBMUSL)/src/thread/pthread_attr_setinheritsched.c
> -LIBMUSL_SRCS-y +=3D =
$(LIBMUSL)/src/thread/pthread_attr_setschedparam.c
> -LIBMUSL_SRCS-y +=3D =
$(LIBMUSL)/src/thread/pthread_attr_setschedpolicy.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/thread/pthread_attr_setscope.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/thread/pthread_attr_setstack.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/thread/pthread_attr_setstacksize.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/thread/pthread_barrier_destroy.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/thread/pthread_barrier_init.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/thread/pthread_barrier_wait.c
> -LIBMUSL_SRCS-y +=3D =
$(LIBMUSL)/src/thread/pthread_barrierattr_destroy.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/thread/pthread_barrierattr_init.c
> -LIBMUSL_SRCS-y +=3D =
$(LIBMUSL)/src/thread/pthread_barrierattr_setpshared.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/thread/pthread_cancel.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/thread/pthread_cleanup_push.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/thread/pthread_cond_broadcast.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/thread/pthread_cond_destroy.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/thread/pthread_cond_init.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/thread/pthread_cond_signal.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/thread/pthread_cond_timedwait.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/thread/pthread_cond_wait.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/thread/pthread_condattr_destroy.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/thread/pthread_condattr_init.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/thread/pthread_condattr_setclock.c
> -LIBMUSL_SRCS-y +=3D =
$(LIBMUSL)/src/thread/pthread_condattr_setpshared.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/thread/pthread_create.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/thread/pthread_detach.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/thread/pthread_equal.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/thread/pthread_getattr_np.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/thread/pthread_getconcurrency.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/thread/pthread_getcpuclockid.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/thread/pthread_getschedparam.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/thread/pthread_getspecific.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/thread/pthread_join.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/thread/pthread_key_create.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/thread/pthread_kill.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/thread/pthread_mutex_consistent.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/thread/pthread_mutex_destroy.c
> -LIBMUSL_SRCS-y +=3D =
$(LIBMUSL)/src/thread/pthread_mutex_getprioceiling.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/thread/pthread_mutex_init.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/thread/pthread_mutex_lock.c
> -LIBMUSL_SRCS-y +=3D =
$(LIBMUSL)/src/thread/pthread_mutex_setprioceiling.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/thread/pthread_mutex_timedlock.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/thread/pthread_mutex_trylock.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/thread/pthread_mutex_unlock.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/thread/pthread_mutexattr_destroy.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/thread/pthread_mutexattr_init.c
> -LIBMUSL_SRCS-y +=3D =
$(LIBMUSL)/src/thread/pthread_mutexattr_setprotocol.c
> -LIBMUSL_SRCS-y +=3D =
$(LIBMUSL)/src/thread/pthread_mutexattr_setpshared.c
> -LIBMUSL_SRCS-y +=3D =
$(LIBMUSL)/src/thread/pthread_mutexattr_setrobust.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/thread/pthread_mutexattr_settype.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/thread/pthread_once.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/thread/pthread_rwlock_destroy.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/thread/pthread_rwlock_init.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/thread/pthread_rwlock_rdlock.c
> -LIBMUSL_SRCS-y +=3D =
$(LIBMUSL)/src/thread/pthread_rwlock_timedrdlock.c
> -LIBMUSL_SRCS-y +=3D =
$(LIBMUSL)/src/thread/pthread_rwlock_timedwrlock.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/thread/pthread_rwlock_tryrdlock.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/thread/pthread_rwlock_trywrlock.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/thread/pthread_rwlock_unlock.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/thread/pthread_rwlock_wrlock.c
> -LIBMUSL_SRCS-y +=3D =
$(LIBMUSL)/src/thread/pthread_rwlockattr_destroy.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/thread/pthread_rwlockattr_init.c
> -LIBMUSL_SRCS-y +=3D =
$(LIBMUSL)/src/thread/pthread_rwlockattr_setpshared.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/thread/pthread_self.c
> -LIBMUSL_SRCS-y +=3D =
$(LIBMUSL)/src/thread/pthread_setattr_default_np.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/thread/pthread_setcancelstate.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/thread/pthread_setcanceltype.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/thread/pthread_setconcurrency.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/thread/pthread_setname_np.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/thread/pthread_setschedparam.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/thread/pthread_setschedprio.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/thread/pthread_setspecific.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/thread/pthread_sigmask.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/thread/pthread_spin_destroy.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/thread/pthread_spin_init.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/thread/pthread_spin_lock.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/thread/pthread_spin_trylock.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/thread/pthread_spin_unlock.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/thread/pthread_testcancel.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/thread/sem_destroy.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/thread/sem_getvalue.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/thread/sem_init.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/thread/sem_open.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/thread/sem_post.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/thread/sem_timedwait.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/thread/sem_trywait.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/thread/sem_unlink.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/thread/sem_wait.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/thread/synccall.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/thread/syscall_cp.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/thread/thrd_create.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/thread/thrd_exit.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/thread/thrd_join.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/thread/thrd_sleep.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/thread/thrd_yield.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/thread/tls.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/thread/tss_create.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/thread/tss_delete.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/thread/tss_set.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/thread/vmlock.c
> +LIBMUSL_THREAD_HDRS-y +=3D $(LIBMUSL)/src/internal/atomic.h
> +LIBMUSL_THREAD_HDRS-y +=3D $(LIBMUSL)/include/ctype.h
> +LIBMUSL_THREAD_HDRS-y +=3D $(LIBMUSL)/include/dirent.h
> +LIBMUSL_THREAD_HDRS-y +=3D $(LIBMUSL)/src/internal/dynlink.h
> +LIBMUSL_THREAD_HDRS-y +=3D $(LIBMUSL)/include/elf.h
> +LIBMUSL_THREAD_HDRS-y +=3D $(LIBMUSL)/include/errno.h
> +LIBMUSL_THREAD_HDRS-y +=3D $(LIBMUSL)/include/fcntl.h
> +LIBMUSL_THREAD_HDRS-y +=3D $(LIBMUSL)/src/internal/futex.h
> +LIBMUSL_THREAD_HDRS-y +=3D $(LIBMUSL)/src/internal/libc.h
> +LIBMUSL_THREAD_HDRS-y +=3D $(LIBMUSL)/include/limits.h
> +LIBMUSL_THREAD_HDRS-y +=3D $(LIBMUSL)/include/pthread.h
> +LIBMUSL_THREAD_HDRS-y +=3D $(LIBMUSL)/src/internal/pthread_impl.h
> +LIBMUSL_THREAD_HDRS-y +=3D $(LIBMUSL)/include/semaphore.h
> +LIBMUSL_THREAD_HDRS-y +=3D $(LIBMUSL)/include/signal.h
> +LIBMUSL_THREAD_HDRS-y +=3D $(LIBMUSL)/include/stdarg.h
> +LIBMUSL_THREAD_HDRS-y +=3D $(LIBMUSL)/include/stddef.h
> +LIBMUSL_THREAD_HDRS-y +=3D $(LIBMUSL)/include/stdint.h
> +LIBMUSL_THREAD_HDRS-y +=3D $(LIBMUSL)/include/stdio.h
> +LIBMUSL_THREAD_HDRS-y +=3D $(LIBMUSL)/src/internal/stdio_impl.h
> +LIBMUSL_THREAD_HDRS-y +=3D $(LIBMUSL)/include/stdlib.h
> +LIBMUSL_THREAD_HDRS-y +=3D $(LIBMUSL)/include/string.h
> +LIBMUSL_THREAD_HDRS-y +=3D $(LIBMUSL)/src/internal/syscall.h
> +LIBMUSL_THREAD_HDRS-y +=3D $(LIBMUSL)/include/sys/mman.h
> +LIBMUSL_THREAD_HDRS-y +=3D $(LIBMUSL)/include/sys/prctl.h
> +LIBMUSL_THREAD_HDRS-y +=3D $(LIBMUSL)/include/sys/stat.h
> +LIBMUSL_THREAD_HDRS-y +=3D $(LIBMUSL)/include/sys/syscall.h
> +LIBMUSL_THREAD_HDRS-y +=3D $(LIBMUSL)/include/threads.h
> +LIBMUSL_THREAD_HDRS-y +=3D $(LIBMUSL)/include/time.h
> +LIBMUSL_THREAD_HDRS-y +=3D $(LIBMUSL)/include/unistd.h
> +
> +LIBMUSL_THREAD_SRCS-y +=3D $(LIBMUSL)/src/thread/__futex.c
> +LIBMUSL_THREAD_SRCS-y +=3D $(LIBMUSL)/src/thread/__lock.c
> +LIBMUSL_THREAD_SRCS-y +=3D $(LIBMUSL)/src/thread/__syscall_cp.c
> +LIBMUSL_THREAD_SRCS-y +=3D $(LIBMUSL)/src/thread/__timedwait.c
> +LIBMUSL_THREAD_SRCS-y +=3D $(LIBMUSL)/src/thread/__tls_get_addr.c
> +LIBMUSL_THREAD_SRCS-y +=3D $(LIBMUSL)/src/thread/__wait.c
> +LIBMUSL_THREAD_SRCS-y +=3D $(LIBMUSL)/src/thread/call_once.c
> +LIBMUSL_THREAD_SRCS-y +=3D $(LIBMUSL)/src/thread/cnd_broadcast.c
> +LIBMUSL_THREAD_SRCS-y +=3D $(LIBMUSL)/src/thread/cnd_destroy.c
> +LIBMUSL_THREAD_SRCS-y +=3D $(LIBMUSL)/src/thread/cnd_init.c
> +LIBMUSL_THREAD_SRCS-y +=3D $(LIBMUSL)/src/thread/cnd_signal.c
> +LIBMUSL_THREAD_SRCS-y +=3D $(LIBMUSL)/src/thread/cnd_timedwait.c
> +LIBMUSL_THREAD_SRCS-y +=3D $(LIBMUSL)/src/thread/cnd_wait.c
> +LIBMUSL_THREAD_SRCS-y +=3D $(LIBMUSL)/src/thread/lock_ptc.c
> +LIBMUSL_THREAD_SRCS-y +=3D $(LIBMUSL)/src/thread/mtx_destroy.c
> +LIBMUSL_THREAD_SRCS-y +=3D $(LIBMUSL)/src/thread/mtx_init.c
> +LIBMUSL_THREAD_SRCS-y +=3D $(LIBMUSL)/src/thread/mtx_lock.c
> +LIBMUSL_THREAD_SRCS-y +=3D $(LIBMUSL)/src/thread/mtx_timedlock.c
> +LIBMUSL_THREAD_SRCS-y +=3D $(LIBMUSL)/src/thread/mtx_trylock.c
> +LIBMUSL_THREAD_SRCS-y +=3D $(LIBMUSL)/src/thread/mtx_unlock.c
> +LIBMUSL_THREAD_SRCS-y +=3D $(LIBMUSL)/src/thread/pthread_atfork.c
> +LIBMUSL_THREAD_SRCS-y +=3D =
$(LIBMUSL)/src/thread/pthread_attr_destroy.c
> +LIBMUSL_THREAD_SRCS-y +=3D $(LIBMUSL)/src/thread/pthread_attr_get.c
> +LIBMUSL_THREAD_SRCS-y +=3D $(LIBMUSL)/src/thread/pthread_attr_init.c
> +LIBMUSL_THREAD_SRCS-y +=3D =
$(LIBMUSL)/src/thread/pthread_attr_setdetachstate.c
> +LIBMUSL_THREAD_SRCS-y +=3D =
$(LIBMUSL)/src/thread/pthread_attr_setguardsize.c
> +LIBMUSL_THREAD_SRCS-y +=3D =
$(LIBMUSL)/src/thread/pthread_attr_setinheritsched.c
> +LIBMUSL_THREAD_SRCS-y +=3D =
$(LIBMUSL)/src/thread/pthread_attr_setschedparam.c
> +LIBMUSL_THREAD_SRCS-y +=3D =
$(LIBMUSL)/src/thread/pthread_attr_setschedpolicy.c
> +LIBMUSL_THREAD_SRCS-y +=3D =
$(LIBMUSL)/src/thread/pthread_attr_setscope.c
> +LIBMUSL_THREAD_SRCS-y +=3D =
$(LIBMUSL)/src/thread/pthread_attr_setstack.c
> +LIBMUSL_THREAD_SRCS-y +=3D =
$(LIBMUSL)/src/thread/pthread_attr_setstacksize.c
> +LIBMUSL_THREAD_SRCS-y +=3D =
$(LIBMUSL)/src/thread/pthread_barrier_destroy.c
> +LIBMUSL_THREAD_SRCS-y +=3D =
$(LIBMUSL)/src/thread/pthread_barrier_init.c
> +LIBMUSL_THREAD_SRCS-y +=3D =
$(LIBMUSL)/src/thread/pthread_barrier_wait.c
> +LIBMUSL_THREAD_SRCS-y +=3D =
$(LIBMUSL)/src/thread/pthread_barrierattr_destroy.c
> +LIBMUSL_THREAD_SRCS-y +=3D =
$(LIBMUSL)/src/thread/pthread_barrierattr_init.c
> +LIBMUSL_THREAD_SRCS-y +=3D =
$(LIBMUSL)/src/thread/pthread_barrierattr_setpshared.c
> +LIBMUSL_THREAD_SRCS-y +=3D $(LIBMUSL)/src/thread/pthread_cancel.c
> +LIBMUSL_THREAD_SRCS-y +=3D =
$(LIBMUSL)/src/thread/pthread_cleanup_push.c
> +LIBMUSL_THREAD_SRCS-y +=3D =
$(LIBMUSL)/src/thread/pthread_cond_broadcast.c
> +LIBMUSL_THREAD_SRCS-y +=3D =
$(LIBMUSL)/src/thread/pthread_cond_destroy.c
> +LIBMUSL_THREAD_SRCS-y +=3D $(LIBMUSL)/src/thread/pthread_cond_init.c
> +LIBMUSL_THREAD_SRCS-y +=3D =
$(LIBMUSL)/src/thread/pthread_cond_signal.c
> +LIBMUSL_THREAD_SRCS-y +=3D =
$(LIBMUSL)/src/thread/pthread_cond_timedwait.c
> +LIBMUSL_THREAD_SRCS-y +=3D $(LIBMUSL)/src/thread/pthread_cond_wait.c
> +LIBMUSL_THREAD_SRCS-y +=3D =
$(LIBMUSL)/src/thread/pthread_condattr_destroy.c
> +LIBMUSL_THREAD_SRCS-y +=3D =
$(LIBMUSL)/src/thread/pthread_condattr_init.c
> +LIBMUSL_THREAD_SRCS-y +=3D =
$(LIBMUSL)/src/thread/pthread_condattr_setclock.c
> +LIBMUSL_THREAD_SRCS-y +=3D =
$(LIBMUSL)/src/thread/pthread_condattr_setpshared.c
> +LIBMUSL_THREAD_SRCS-y +=3D $(LIBMUSL)/src/thread/pthread_create.c
> +LIBMUSL_THREAD_SRCS-y +=3D $(LIBMUSL)/src/thread/pthread_detach.c
> +LIBMUSL_THREAD_SRCS-y +=3D $(LIBMUSL)/src/thread/pthread_equal.c
> +LIBMUSL_THREAD_SRCS-y +=3D $(LIBMUSL)/src/thread/pthread_getattr_np.c
> +LIBMUSL_THREAD_SRCS-y +=3D =
$(LIBMUSL)/src/thread/pthread_getconcurrency.c
> +LIBMUSL_THREAD_SRCS-y +=3D =
$(LIBMUSL)/src/thread/pthread_getcpuclockid.c
> +LIBMUSL_THREAD_SRCS-y +=3D =
$(LIBMUSL)/src/thread/pthread_getschedparam.c
> +LIBMUSL_THREAD_SRCS-y +=3D =
$(LIBMUSL)/src/thread/pthread_getspecific.c
> +LIBMUSL_THREAD_SRCS-y +=3D $(LIBMUSL)/src/thread/pthread_join.c
> +LIBMUSL_THREAD_SRCS-y +=3D $(LIBMUSL)/src/thread/pthread_key_create.c
> +LIBMUSL_THREAD_SRCS-y +=3D $(LIBMUSL)/src/thread/pthread_kill.c
> +LIBMUSL_THREAD_SRCS-y +=3D =
$(LIBMUSL)/src/thread/pthread_mutex_consistent.c
> +LIBMUSL_THREAD_SRCS-y +=3D =
$(LIBMUSL)/src/thread/pthread_mutex_destroy.c
> +LIBMUSL_THREAD_SRCS-y +=3D =
$(LIBMUSL)/src/thread/pthread_mutex_getprioceiling.c
> +LIBMUSL_THREAD_SRCS-y +=3D $(LIBMUSL)/src/thread/pthread_mutex_init.c
> +LIBMUSL_THREAD_SRCS-y +=3D $(LIBMUSL)/src/thread/pthread_mutex_lock.c
> +LIBMUSL_THREAD_SRCS-y +=3D =
$(LIBMUSL)/src/thread/pthread_mutex_setprioceiling.c
> +LIBMUSL_THREAD_SRCS-y +=3D =
$(LIBMUSL)/src/thread/pthread_mutex_timedlock.c
> +LIBMUSL_THREAD_SRCS-y +=3D =
$(LIBMUSL)/src/thread/pthread_mutex_trylock.c
> +LIBMUSL_THREAD_SRCS-y +=3D =
$(LIBMUSL)/src/thread/pthread_mutex_unlock.c
> +LIBMUSL_THREAD_SRCS-y +=3D =
$(LIBMUSL)/src/thread/pthread_mutexattr_destroy.c
> +LIBMUSL_THREAD_SRCS-y +=3D =
$(LIBMUSL)/src/thread/pthread_mutexattr_init.c
> +LIBMUSL_THREAD_SRCS-y +=3D =
$(LIBMUSL)/src/thread/pthread_mutexattr_setprotocol.c
> +LIBMUSL_THREAD_SRCS-y +=3D =
$(LIBMUSL)/src/thread/pthread_mutexattr_setpshared.c
> +LIBMUSL_THREAD_SRCS-y +=3D =
$(LIBMUSL)/src/thread/pthread_mutexattr_setrobust.c
> +LIBMUSL_THREAD_SRCS-y +=3D =
$(LIBMUSL)/src/thread/pthread_mutexattr_settype.c
> +LIBMUSL_THREAD_SRCS-y +=3D $(LIBMUSL)/src/thread/pthread_once.c
> +LIBMUSL_THREAD_SRCS-y +=3D =
$(LIBMUSL)/src/thread/pthread_rwlock_destroy.c
> +LIBMUSL_THREAD_SRCS-y +=3D =
$(LIBMUSL)/src/thread/pthread_rwlock_init.c
> +LIBMUSL_THREAD_SRCS-y +=3D =
$(LIBMUSL)/src/thread/pthread_rwlock_rdlock.c
> +LIBMUSL_THREAD_SRCS-y +=3D =
$(LIBMUSL)/src/thread/pthread_rwlock_timedrdlock.c
> +LIBMUSL_THREAD_SRCS-y +=3D =
$(LIBMUSL)/src/thread/pthread_rwlock_timedwrlock.c
> +LIBMUSL_THREAD_SRCS-y +=3D =
$(LIBMUSL)/src/thread/pthread_rwlock_tryrdlock.c
> +LIBMUSL_THREAD_SRCS-y +=3D =
$(LIBMUSL)/src/thread/pthread_rwlock_trywrlock.c
> +LIBMUSL_THREAD_SRCS-y +=3D =
$(LIBMUSL)/src/thread/pthread_rwlock_unlock.c
> +LIBMUSL_THREAD_SRCS-y +=3D =
$(LIBMUSL)/src/thread/pthread_rwlock_wrlock.c
> +LIBMUSL_THREAD_SRCS-y +=3D =
$(LIBMUSL)/src/thread/pthread_rwlockattr_destroy.c
> +LIBMUSL_THREAD_SRCS-y +=3D =
$(LIBMUSL)/src/thread/pthread_rwlockattr_init.c
> +LIBMUSL_THREAD_SRCS-y +=3D =
$(LIBMUSL)/src/thread/pthread_rwlockattr_setpshared.c
> +LIBMUSL_THREAD_SRCS-y +=3D $(LIBMUSL)/src/thread/pthread_self.c
> +LIBMUSL_THREAD_SRCS-y +=3D =
$(LIBMUSL)/src/thread/pthread_setattr_default_np.c
> +LIBMUSL_THREAD_SRCS-y +=3D =
$(LIBMUSL)/src/thread/pthread_setcancelstate.c
> +LIBMUSL_THREAD_SRCS-y +=3D =
$(LIBMUSL)/src/thread/pthread_setcanceltype.c
> +LIBMUSL_THREAD_SRCS-y +=3D =
$(LIBMUSL)/src/thread/pthread_setconcurrency.c
> +LIBMUSL_THREAD_SRCS-y +=3D $(LIBMUSL)/src/thread/pthread_setname_np.c
> +LIBMUSL_THREAD_SRCS-y +=3D =
$(LIBMUSL)/src/thread/pthread_setschedparam.c
> +LIBMUSL_THREAD_SRCS-y +=3D =
$(LIBMUSL)/src/thread/pthread_setschedprio.c
> +LIBMUSL_THREAD_SRCS-y +=3D =
$(LIBMUSL)/src/thread/pthread_setspecific.c
> +LIBMUSL_THREAD_SRCS-y +=3D $(LIBMUSL)/src/thread/pthread_sigmask.c
> +LIBMUSL_THREAD_SRCS-y +=3D =
$(LIBMUSL)/src/thread/pthread_spin_destroy.c
> +LIBMUSL_THREAD_SRCS-y +=3D $(LIBMUSL)/src/thread/pthread_spin_init.c
> +LIBMUSL_THREAD_SRCS-y +=3D $(LIBMUSL)/src/thread/pthread_spin_lock.c
> +LIBMUSL_THREAD_SRCS-y +=3D =
$(LIBMUSL)/src/thread/pthread_spin_trylock.c
> +LIBMUSL_THREAD_SRCS-y +=3D =
$(LIBMUSL)/src/thread/pthread_spin_unlock.c
> +LIBMUSL_THREAD_SRCS-y +=3D $(LIBMUSL)/src/thread/pthread_testcancel.c
> +LIBMUSL_THREAD_SRCS-y +=3D $(LIBMUSL)/src/thread/sem_destroy.c
> +LIBMUSL_THREAD_SRCS-y +=3D $(LIBMUSL)/src/thread/sem_getvalue.c
> +LIBMUSL_THREAD_SRCS-y +=3D $(LIBMUSL)/src/thread/sem_init.c
> +LIBMUSL_THREAD_SRCS-y +=3D $(LIBMUSL)/src/thread/sem_open.c
> +LIBMUSL_THREAD_SRCS-y +=3D $(LIBMUSL)/src/thread/sem_post.c
> +LIBMUSL_THREAD_SRCS-y +=3D $(LIBMUSL)/src/thread/sem_timedwait.c
> +LIBMUSL_THREAD_SRCS-y +=3D $(LIBMUSL)/src/thread/sem_trywait.c
> +LIBMUSL_THREAD_SRCS-y +=3D $(LIBMUSL)/src/thread/sem_unlink.c
> +LIBMUSL_THREAD_SRCS-y +=3D $(LIBMUSL)/src/thread/sem_wait.c
> +LIBMUSL_THREAD_SRCS-y +=3D $(LIBMUSL)/src/thread/synccall.c
> +LIBMUSL_THREAD_SRCS-y +=3D $(LIBMUSL)/src/thread/syscall_cp.c
> +LIBMUSL_THREAD_SRCS-y +=3D $(LIBMUSL)/src/thread/thrd_create.c
> +LIBMUSL_THREAD_SRCS-y +=3D $(LIBMUSL)/src/thread/thrd_exit.c
> +LIBMUSL_THREAD_SRCS-y +=3D $(LIBMUSL)/src/thread/thrd_join.c
> +LIBMUSL_THREAD_SRCS-y +=3D $(LIBMUSL)/src/thread/thrd_sleep.c
> +LIBMUSL_THREAD_SRCS-y +=3D $(LIBMUSL)/src/thread/thrd_yield.c
> +LIBMUSL_THREAD_SRCS-y +=3D $(LIBMUSL)/src/thread/tls.c
> +LIBMUSL_THREAD_SRCS-y +=3D $(LIBMUSL)/src/thread/tss_create.c
> +LIBMUSL_THREAD_SRCS-y +=3D $(LIBMUSL)/src/thread/tss_delete.c
> +LIBMUSL_THREAD_SRCS-y +=3D $(LIBMUSL)/src/thread/tss_set.c
> +LIBMUSL_THREAD_SRCS-y +=3D $(LIBMUSL)/src/thread/vmlock.c
>=20
> ifeq (x86_32,$(CONFIG_UK_ARCH))
> -LIBMUSL_SRCS-y +=3D =
$(LIBMUSL)/src/thread/i386/__set_thread_area.s|i386
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/thread/i386/__unmapself.s|i386
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/thread/i386/clone.s|i386
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/thread/i386/syscall_cp.s|i386
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/thread/i386/tls.s|i386
> +LIBMUSL_THREAD_SRCS-y +=3D =
$(LIBMUSL)/src/thread/i386/__set_thread_area.s|i386
> +LIBMUSL_THREAD_SRCS-y +=3D =
$(LIBMUSL)/src/thread/i386/__unmapself.s|i386
> +LIBMUSL_THREAD_SRCS-y +=3D $(LIBMUSL)/src/thread/i386/clone.s|i386
> +LIBMUSL_THREAD_SRCS-y +=3D =
$(LIBMUSL)/src/thread/i386/syscall_cp.s|i386
> +LIBMUSL_THREAD_SRCS-y +=3D $(LIBMUSL)/src/thread/i386/tls.s|i386
> else ifeq (x86_64,$(CONFIG_UK_ARCH))
> -LIBMUSL_SRCS-y +=3D =
$(LIBMUSL)/src/thread/x86_64/__set_thread_area.s|x86_64
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/thread/x86_64/__unmapself.s|x86_64
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/thread/x86_64/clone.s|x86_64
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/thread/x86_64/syscall_cp.s|x86_64
> +LIBMUSL_THREAD_SRCS-y +=3D =
$(LIBMUSL)/src/thread/x86_64/__set_thread_area.s|x86_64
> +LIBMUSL_THREAD_SRCS-y +=3D =
$(LIBMUSL)/src/thread/x86_64/__unmapself.s|x86_64
> +LIBMUSL_THREAD_SRCS-y +=3D =
$(LIBMUSL)/src/thread/x86_64/clone.s|x86_64
> +LIBMUSL_THREAD_SRCS-y +=3D =
$(LIBMUSL)/src/thread/x86_64/syscall_cp.s|x86_64
> else ifeq (arm,$(CONFIG_UK_ARCH))
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/thread/arm/__aeabi_read_tp.s|arm
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/thread/arm/__aeabi_read_tp_c.c|arm
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/thread/arm/__set_thread_area.c|arm
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/thread/arm/__unmapself.s|arm
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/thread/arm/atomics.s|arm
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/thread/arm/clone.s|arm
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/thread/arm/syscall_cp.s|arm
> +LIBMUSL_THREAD_SRCS-y +=3D =
$(LIBMUSL)/src/thread/arm/__aeabi_read_tp.s|arm
> +LIBMUSL_THREAD_SRCS-y +=3D =
$(LIBMUSL)/src/thread/arm/__aeabi_read_tp_c.c|arm
> +LIBMUSL_THREAD_SRCS-y +=3D =
$(LIBMUSL)/src/thread/arm/__set_thread_area.c|arm
> +LIBMUSL_THREAD_SRCS-y +=3D =
$(LIBMUSL)/src/thread/arm/__unmapself.s|arm
> +LIBMUSL_THREAD_SRCS-y +=3D $(LIBMUSL)/src/thread/arm/atomics.s|arm
> +LIBMUSL_THREAD_SRCS-y +=3D $(LIBMUSL)/src/thread/arm/clone.s|arm
> +LIBMUSL_THREAD_SRCS-y +=3D $(LIBMUSL)/src/thread/arm/syscall_cp.s|arm
> else
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/thread/__set_thread_area.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/thread/__unmapself.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/thread/clone.c|thread
> +LIBMUSL_THREAD_SRCS-y +=3D $(LIBMUSL)/src/thread/__set_thread_area.c
> +LIBMUSL_THREAD_SRCS-y +=3D $(LIBMUSL)/src/thread/__unmapself.c
> +LIBMUSL_THREAD_SRCS-y +=3D $(LIBMUSL)/src/thread/clone.c|thread
> endif
>=20
> -#LIBMUSL_SRCS-y +=3D =
$(LIBMUSL)/src/thread/aarch64/__set_thread_area.s
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/thread/aarch64/__unmapself.s
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/thread/aarch64/clone.s
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/thread/aarch64/syscall_cp.s
> -#LIBMUSL_SRCS-y +=3D =
$(LIBMUSL)/src/thread/microblaze/__set_thread_area.s
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/thread/microblaze/__unmapself.s
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/thread/microblaze/clone.s
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/thread/microblaze/syscall_cp.s
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/thread/mips/__unmapself.s
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/thread/mips/clone.s
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/thread/mips/syscall_cp.s
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/thread/mips64/__unmapself.s
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/thread/mips64/clone.s
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/thread/mips64/syscall_cp.s
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/thread/mipsn32/__unmapself.s
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/thread/mipsn32/clone.s
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/thread/mipsn32/syscall_cp.s
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/thread/or1k/__set_thread_area.s
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/thread/or1k/__unmapself.s
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/thread/or1k/clone.s
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/thread/or1k/syscall_cp.s
> -#LIBMUSL_SRCS-y +=3D =
$(LIBMUSL)/src/thread/powerpc/__set_thread_area.s
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/thread/powerpc/__unmapself.s
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/thread/powerpc/clone.s
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/thread/powerpc/syscall_cp.s
> -#LIBMUSL_SRCS-y +=3D =
$(LIBMUSL)/src/thread/powerpc64/__set_thread_area.s
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/thread/powerpc64/__unmapself.s
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/thread/powerpc64/clone.s
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/thread/powerpc64/syscall_cp.s
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/thread/s390x/__set_thread_area.s
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/thread/s390x/__tls_get_offset.s
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/thread/s390x/__unmapself.s
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/thread/s390x/clone.s
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/thread/s390x/syscall_cp.s
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/thread/sh/__set_thread_area.c
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/thread/sh/__unmapself.c
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/thread/sh/__unmapself_mmu.s
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/thread/sh/atomics.s
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/thread/sh/clone.s
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/thread/sh/syscall_cp.s
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/thread/x32/__set_thread_area.s
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/thread/x32/__unmapself.s
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/thread/x32/clone.s
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/thread/x32/syscall_cp.s
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/thread/x32/syscall_cp_fixup.c
> +#LIBMUSL_THREAD_SRCS-y +=3D =
$(LIBMUSL)/src/thread/aarch64/__set_thread_area.s
> +#LIBMUSL_THREAD_SRCS-y +=3D =
$(LIBMUSL)/src/thread/aarch64/__unmapself.s
> +#LIBMUSL_THREAD_SRCS-y +=3D $(LIBMUSL)/src/thread/aarch64/clone.s
> +#LIBMUSL_THREAD_SRCS-y +=3D =
$(LIBMUSL)/src/thread/aarch64/syscall_cp.s
> +#LIBMUSL_THREAD_SRCS-y +=3D =
$(LIBMUSL)/src/thread/microblaze/__set_thread_area.s
> +#LIBMUSL_THREAD_SRCS-y +=3D =
$(LIBMUSL)/src/thread/microblaze/__unmapself.s
> +#LIBMUSL_THREAD_SRCS-y +=3D $(LIBMUSL)/src/thread/microblaze/clone.s
> +#LIBMUSL_THREAD_SRCS-y +=3D =
$(LIBMUSL)/src/thread/microblaze/syscall_cp.s
> +#LIBMUSL_THREAD_SRCS-y +=3D $(LIBMUSL)/src/thread/mips/__unmapself.s
> +#LIBMUSL_THREAD_SRCS-y +=3D $(LIBMUSL)/src/thread/mips/clone.s
> +#LIBMUSL_THREAD_SRCS-y +=3D $(LIBMUSL)/src/thread/mips/syscall_cp.s
> +#LIBMUSL_THREAD_SRCS-y +=3D =
$(LIBMUSL)/src/thread/mips64/__unmapself.s
> +#LIBMUSL_THREAD_SRCS-y +=3D $(LIBMUSL)/src/thread/mips64/clone.s
> +#LIBMUSL_THREAD_SRCS-y +=3D $(LIBMUSL)/src/thread/mips64/syscall_cp.s
> +#LIBMUSL_THREAD_SRCS-y +=3D =
$(LIBMUSL)/src/thread/mipsn32/__unmapself.s
> +#LIBMUSL_THREAD_SRCS-y +=3D $(LIBMUSL)/src/thread/mipsn32/clone.s
> +#LIBMUSL_THREAD_SRCS-y +=3D =
$(LIBMUSL)/src/thread/mipsn32/syscall_cp.s
> +#LIBMUSL_THREAD_SRCS-y +=3D =
$(LIBMUSL)/src/thread/or1k/__set_thread_area.s
> +#LIBMUSL_THREAD_SRCS-y +=3D $(LIBMUSL)/src/thread/or1k/__unmapself.s
> +#LIBMUSL_THREAD_SRCS-y +=3D $(LIBMUSL)/src/thread/or1k/clone.s
> +#LIBMUSL_THREAD_SRCS-y +=3D $(LIBMUSL)/src/thread/or1k/syscall_cp.s
> +#LIBMUSL_THREAD_SRCS-y +=3D =
$(LIBMUSL)/src/thread/powerpc/__set_thread_area.s
> +#LIBMUSL_THREAD_SRCS-y +=3D =
$(LIBMUSL)/src/thread/powerpc/__unmapself.s
> +#LIBMUSL_THREAD_SRCS-y +=3D $(LIBMUSL)/src/thread/powerpc/clone.s
> +#LIBMUSL_THREAD_SRCS-y +=3D =
$(LIBMUSL)/src/thread/powerpc/syscall_cp.s
> +#LIBMUSL_THREAD_SRCS-y +=3D =
$(LIBMUSL)/src/thread/powerpc64/__set_thread_area.s
> +#LIBMUSL_THREAD_SRCS-y +=3D =
$(LIBMUSL)/src/thread/powerpc64/__unmapself.s
> +#LIBMUSL_THREAD_SRCS-y +=3D $(LIBMUSL)/src/thread/powerpc64/clone.s
> +#LIBMUSL_THREAD_SRCS-y +=3D =
$(LIBMUSL)/src/thread/powerpc64/syscall_cp.s
> +#LIBMUSL_THREAD_SRCS-y +=3D =
$(LIBMUSL)/src/thread/s390x/__set_thread_area.s
> +#LIBMUSL_THREAD_SRCS-y +=3D =
$(LIBMUSL)/src/thread/s390x/__tls_get_offset.s
> +#LIBMUSL_THREAD_SRCS-y +=3D $(LIBMUSL)/src/thread/s390x/__unmapself.s
> +#LIBMUSL_THREAD_SRCS-y +=3D $(LIBMUSL)/src/thread/s390x/clone.s
> +#LIBMUSL_THREAD_SRCS-y +=3D $(LIBMUSL)/src/thread/s390x/syscall_cp.s
> +#LIBMUSL_THREAD_SRCS-y +=3D =
$(LIBMUSL)/src/thread/sh/__set_thread_area.c
> +#LIBMUSL_THREAD_SRCS-y +=3D $(LIBMUSL)/src/thread/sh/__unmapself.c
> +#LIBMUSL_THREAD_SRCS-y +=3D =
$(LIBMUSL)/src/thread/sh/__unmapself_mmu.s
> +#LIBMUSL_THREAD_SRCS-y +=3D $(LIBMUSL)/src/thread/sh/atomics.s
> +#LIBMUSL_THREAD_SRCS-y +=3D $(LIBMUSL)/src/thread/sh/clone.s
> +#LIBMUSL_THREAD_SRCS-y +=3D $(LIBMUSL)/src/thread/sh/syscall_cp.s
> +#LIBMUSL_THREAD_SRCS-y +=3D =
$(LIBMUSL)/src/thread/x32/__set_thread_area.s
> +#LIBMUSL_THREAD_SRCS-y +=3D $(LIBMUSL)/src/thread/x32/__unmapself.s
> +#LIBMUSL_THREAD_SRCS-y +=3D $(LIBMUSL)/src/thread/x32/clone.s
> +#LIBMUSL_THREAD_SRCS-y +=3D $(LIBMUSL)/src/thread/x32/syscall_cp.s
> +#LIBMUSL_THREAD_SRCS-y +=3D =
$(LIBMUSL)/src/thread/x32/syscall_cp_fixup.c
> +
> +$(eval $(call =
_libmusl_import_lib,thread,$(LIBMUSL_THREAD_HDRS-y),$(LIBMUSL_THREAD_SRCS-=
y)))
> diff --git a/Makefile.uk.musl.time b/Makefile.uk.musl.time
> index db4a736..7330c96 100644
> --- a/Makefile.uk.musl.time
> +++ b/Makefile.uk.musl.time
> @@ -1,40 +1,77 @@
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/time/__asctime.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/time/__map_file.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/time/__month_to_secs.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/time/__secs_to_tm.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/time/__tm_to_secs.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/time/__tz.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/time/__year_to_secs.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/time/asctime.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/time/asctime_r.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/time/clock.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/time/clock_getcpuclockid.c
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/time/clock_getres.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/time/clock_gettime.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/time/clock_nanosleep.c
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/time/clock_settime.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/time/ctime.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/time/ctime_r.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/time/difftime.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/time/ftime.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/time/getdate.c
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/time/gettimeofday.c
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/time/gmtime.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/time/gmtime_r.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/time/localtime.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/time/localtime_r.c
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/time/mktime.c
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/time/nanosleep.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/time/strftime.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/time/strptime.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/time/time.c
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/time/timegm.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/time/timer_create.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/time/timer_delete.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/time/timer_getoverrun.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/time/timer_gettime.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/time/timer_settime.c
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/time/times.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/time/timespec_get.c
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/time/utime.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/time/wcsftime.c
> +LIBMUSL_TIME_HDRS-y +=3D $(LIBMUSL)/src/internal/atomic.h
> +LIBMUSL_TIME_HDRS-y +=3D $(LIBMUSL)/include/ctype.h
> +LIBMUSL_TIME_HDRS-y +=3D $(LIBMUSL)/include/errno.h
> +LIBMUSL_TIME_HDRS-y +=3D $(LIBMUSL)/include/fcntl.h
> +LIBMUSL_TIME_HDRS-y +=3D $(LIBMUSL)/include/langinfo.h
> +LIBMUSL_TIME_HDRS-y +=3D $(LIBMUSL)/src/internal/libc.h
> +LIBMUSL_TIME_HDRS-y +=3D $(LIBMUSL)/include/limits.h
> +LIBMUSL_TIME_HDRS-y +=3D $(LIBMUSL)/include/locale.h
> +LIBMUSL_TIME_HDRS-y +=3D $(LIBMUSL)/src/internal/locale_impl.h
> +LIBMUSL_TIME_HDRS-y +=3D $(LIBMUSL)/include/pthread.h
> +LIBMUSL_TIME_HDRS-y +=3D $(LIBMUSL)/src/internal/pthread_impl.h
> +LIBMUSL_TIME_HDRS-y +=3D $(LIBMUSL)/include/setjmp.h
> +LIBMUSL_TIME_HDRS-y +=3D $(LIBMUSL)/include/stddef.h
> +LIBMUSL_TIME_HDRS-y +=3D $(LIBMUSL)/include/stdint.h
> +LIBMUSL_TIME_HDRS-y +=3D $(LIBMUSL)/include/stdio.h
> +LIBMUSL_TIME_HDRS-y +=3D $(LIBMUSL)/include/stdlib.h
> +LIBMUSL_TIME_HDRS-y +=3D $(LIBMUSL)/include/string.h
> +LIBMUSL_TIME_HDRS-y +=3D $(LIBMUSL)/include/strings.h
> +LIBMUSL_TIME_HDRS-y +=3D $(LIBMUSL)/src/internal/syscall.h
> +LIBMUSL_TIME_HDRS-y +=3D $(LIBMUSL)/include/sys/mman.h
> +LIBMUSL_TIME_HDRS-y +=3D $(LIBMUSL)/include/sys/stat.h
> +LIBMUSL_TIME_HDRS-y +=3D $(LIBMUSL)/include/sys/timeb.h
> +LIBMUSL_TIME_HDRS-y +=3D $(LIBMUSL)/include/sys/time.h
> +LIBMUSL_TIME_HDRS-y +=3D $(LIBMUSL)/include/sys/times.h
> +LIBMUSL_TIME_HDRS-y +=3D $(LIBMUSL)/include/time.h
> +LIBMUSL_TIME_HDRS-y +=3D $(LIBMUSL)/src/time/time_impl.h
> +LIBMUSL_TIME_HDRS-y +=3D $(LIBMUSL)/include/unistd.h
> +LIBMUSL_TIME_HDRS-y +=3D $(LIBMUSL)/include/utime.h
> +LIBMUSL_TIME_HDRS-y +=3D $(LIBMUSL)/include/wchar.h
> +LIBMUSL_TIME_HDRS-y +=3D $(LIBMUSL)/include/nl_types.h
> +
> +LIBMUSL_TIME_SRCS-y +=3D $(LIBMUSL)/src/time/__asctime.c
> +LIBMUSL_TIME_SRCS-y +=3D $(LIBMUSL)/src/time/__map_file.c
> +LIBMUSL_TIME_SRCS-y +=3D $(LIBMUSL)/src/time/__month_to_secs.c
> +LIBMUSL_TIME_SRCS-y +=3D $(LIBMUSL)/src/time/__secs_to_tm.c
> +LIBMUSL_TIME_SRCS-y +=3D $(LIBMUSL)/src/time/__tm_to_secs.c
> +LIBMUSL_TIME_SRCS-y +=3D $(LIBMUSL)/src/time/__tz.c
> +LIBMUSL_TIME_SRCS-y +=3D $(LIBMUSL)/src/time/__year_to_secs.c
> +LIBMUSL_TIME_SRCS-y +=3D $(LIBMUSL)/src/time/asctime.c
> +LIBMUSL_TIME_SRCS-y +=3D $(LIBMUSL)/src/time/asctime_r.c
> +LIBMUSL_TIME_SRCS-y +=3D $(LIBMUSL)/src/time/clock.c
> +LIBMUSL_TIME_SRCS-y +=3D $(LIBMUSL)/src/time/clock_getcpuclockid.c
> +#LIBMUSL_TIME_SRCS-y +=3D $(LIBMUSL)/src/time/clock_getres.c
> +LIBMUSL_TIME_SRCS-y +=3D $(LIBMUSL)/src/time/clock_gettime.c
> +LIBMUSL_TIME_SRCS-y +=3D $(LIBMUSL)/src/time/clock_nanosleep.c
> +#LIBMUSL_TIME_SRCS-y +=3D $(LIBMUSL)/src/time/clock_settime.c
> +LIBMUSL_TIME_SRCS-y +=3D $(LIBMUSL)/src/time/ctime.c
> +LIBMUSL_TIME_SRCS-y +=3D $(LIBMUSL)/src/time/ctime_r.c
> +LIBMUSL_TIME_SRCS-y +=3D $(LIBMUSL)/src/time/difftime.c
> +LIBMUSL_TIME_SRCS-y +=3D $(LIBMUSL)/src/time/ftime.c
> +LIBMUSL_TIME_SRCS-y +=3D $(LIBMUSL)/src/time/getdate.c
> +#LIBMUSL_TIME_SRCS-y +=3D $(LIBMUSL)/src/time/gettimeofday.c
> +#LIBMUSL_TIME_SRCS-y +=3D $(LIBMUSL)/src/time/gmtime.c
> +LIBMUSL_TIME_SRCS-y +=3D $(LIBMUSL)/src/time/gmtime_r.c
> +LIBMUSL_TIME_SRCS-y +=3D $(LIBMUSL)/src/time/localtime.c
> +LIBMUSL_TIME_SRCS-y +=3D $(LIBMUSL)/src/time/localtime_r.c
> +#LIBMUSL_TIME_SRCS-y +=3D $(LIBMUSL)/src/time/mktime.c
> +#LIBMUSL_TIME_SRCS-y +=3D $(LIBMUSL)/src/time/nanosleep.c
> +LIBMUSL_TIME_SRCS-y +=3D $(LIBMUSL)/src/time/strftime.c
> +LIBMUSL_TIME_SRCS-y +=3D $(LIBMUSL)/src/time/strptime.c
> +LIBMUSL_TIME_SRCS-y +=3D $(LIBMUSL)/src/time/time.c
> +#LIBMUSL_TIME_SRCS-y +=3D $(LIBMUSL)/src/time/timegm.c
> +
> +ifneq ($(CONFIG_LIBUKTIME),y)
> +LIBMUSL_TIME_SRCS-y +=3D $(LIBMUSL)/src/time/timer_create.c
> +LIBMUSL_TIME_SRCS-y +=3D $(LIBMUSL)/src/time/timer_delete.c
> +LIBMUSL_TIME_SRCS-y +=3D $(LIBMUSL)/src/time/timer_gettime.c
> +LIBMUSL_TIME_SRCS-y +=3D $(LIBMUSL)/src/time/timer_settime.c
> +LIBMUSL_TIME_SRCS-y +=3D $(LIBMUSL)/src/time/timer_getoverrun.c
> +endif
> +
> +#LIBMUSL_TIME_SRCS-y +=3D $(LIBMUSL)/src/time/times.c
> +LIBMUSL_TIME_SRCS-y +=3D $(LIBMUSL)/src/time/timespec_get.c
> +#LIBMUSL_TIME_SRCS-y +=3D $(LIBMUSL)/src/time/utime.c
> +LIBMUSL_TIME_SRCS-y +=3D $(LIBMUSL)/src/time/wcsftime.c
> +
> +$(eval $(call =
_libmusl_import_lib,time,$(LIBMUSL_TIME_HDRS-y),$(LIBMUSL_TIME_SRCS-y)))
> diff --git a/Makefile.uk.musl.unistd b/Makefile.uk.musl.unistd
> index 1b02a3b..a4378b4 100644
> --- a/Makefile.uk.musl.unistd
> +++ b/Makefile.uk.musl.unistd
> @@ -1,84 +1,107 @@
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/unistd/_exit.c
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/unistd/access.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/unistd/acct.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/unistd/alarm.c
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/unistd/chdir.c
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/unistd/chown.c
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/unistd/close.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/unistd/ctermid.c
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/unistd/dup.c
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/unistd/dup2.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/unistd/dup3.c
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/unistd/faccessat.c
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/unistd/fchdir.c
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/unistd/fchown.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/unistd/fchownat.c
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/unistd/fdatasync.c
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/unistd/fsync.c
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/unistd/ftruncate.c
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/unistd/getcwd.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/unistd/getegid.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/unistd/geteuid.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/unistd/getgid.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/unistd/getgroups.c
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/unistd/gethostname.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/unistd/getlogin.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/unistd/getlogin_r.c
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/unistd/getpgid.c
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/unistd/getpgrp.c
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/unistd/getpid.c
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/unistd/getppid.c
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/unistd/getsid.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/unistd/getuid.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/unistd/isatty.c
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/unistd/lchown.c
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/unistd/link.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/unistd/linkat.c
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/unistd/lseek.c
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/unistd/nice.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/unistd/pause.c
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/unistd/pipe.c
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/unistd/pipe2.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/unistd/posix_close.c
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/unistd/pread.c
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/unistd/preadv.c
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/unistd/pwrite.c
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/unistd/pwritev.c
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/unistd/read.c
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/unistd/readlink.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/unistd/readlinkat.c
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/unistd/readv.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/unistd/renameat.c
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/unistd/rmdir.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/unistd/setegid.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/unistd/seteuid.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/unistd/setgid.c
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/unistd/setpgid.c
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/unistd/setpgrp.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/unistd/setregid.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/unistd/setresgid.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/unistd/setresuid.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/unistd/setreuid.c
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/unistd/setsid.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/unistd/setuid.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/unistd/setxid.c
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/unistd/sleep.c
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/unistd/symlink.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/unistd/symlinkat.c
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/unistd/sync.c
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/unistd/tcgetpgrp.c
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/unistd/tcsetpgrp.c
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/unistd/truncate.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/unistd/ttyname.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/unistd/ttyname_r.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/unistd/ualarm.c
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/unistd/unlink.c
> -LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/unistd/unlinkat.c
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/unistd/usleep.c
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/unistd/write.c
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/unistd/writev.c
> +LIBMUSL_UNISTD_HDRS-y +=3D $(LIBMUSL)/include/errno.h
> +LIBMUSL_UNISTD_HDRS-y +=3D $(LIBMUSL)/include/fcntl.h
> +LIBMUSL_UNISTD_HDRS-y +=3D $(LIBMUSL)/src/internal/libc.h
> +LIBMUSL_UNISTD_HDRS-y +=3D $(LIBMUSL)/include/limits.h
> +LIBMUSL_UNISTD_HDRS-y +=3D $(LIBMUSL)/src/internal/pthread_impl.h
> +LIBMUSL_UNISTD_HDRS-y +=3D $(LIBMUSL)/include/signal.h
> +LIBMUSL_UNISTD_HDRS-y +=3D $(LIBMUSL)/include/stdio.h
> +LIBMUSL_UNISTD_HDRS-y +=3D $(LIBMUSL)/include/stdlib.h
> +LIBMUSL_UNISTD_HDRS-y +=3D $(LIBMUSL)/include/string.h
> +LIBMUSL_UNISTD_HDRS-y +=3D $(LIBMUSL)/src/internal/syscall.h
> +LIBMUSL_UNISTD_HDRS-y +=3D $(LIBMUSL)/include/sys/ioctl.h
> +LIBMUSL_UNISTD_HDRS-y +=3D $(LIBMUSL)/include/sys/resource.h
> +LIBMUSL_UNISTD_HDRS-y +=3D $(LIBMUSL)/include/sys/stat.h
> +LIBMUSL_UNISTD_HDRS-y +=3D $(LIBMUSL)/include/sys/time.h
> +LIBMUSL_UNISTD_HDRS-y +=3D $(LIBMUSL)/include/sys/uio.h
> +LIBMUSL_UNISTD_HDRS-y +=3D $(LIBMUSL)/include/sys/utsname.h
> +LIBMUSL_UNISTD_HDRS-y +=3D $(LIBMUSL)/include/sys/wait.h
> +LIBMUSL_UNISTD_HDRS-y +=3D $(LIBMUSL)/include/termios.h
> +LIBMUSL_UNISTD_HDRS-y +=3D $(LIBMUSL)/include/time.h
> +LIBMUSL_UNISTD_HDRS-y +=3D $(LIBMUSL)/include/unistd.h
>=20
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/unistd/mips/pipe.s
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/unistd/mips64/pipe.s
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/unistd/mipsn32/pipe.s
> -#LIBMUSL_SRCS-y +=3D $(LIBMUSL)/src/unistd/sh/pipe.s
> +LIBMUSL_UNISTD_SRCS-y +=3D $(LIBMUSL)/src/unistd/_exit.c
> +#LIBMUSL_UNISTD_SRCS-y +=3D $(LIBMUSL)/src/unistd/access.c
> +LIBMUSL_UNISTD_SRCS-y +=3D $(LIBMUSL)/src/unistd/acct.c
> +LIBMUSL_UNISTD_SRCS-y +=3D $(LIBMUSL)/src/unistd/alarm.c
> +#LIBMUSL_UNISTD_SRCS-y +=3D $(LIBMUSL)/src/unistd/chdir.c
> +#LIBMUSL_UNISTD_SRCS-y +=3D $(LIBMUSL)/src/unistd/chown.c
> +#LIBMUSL_UNISTD_SRCS-y +=3D $(LIBMUSL)/src/unistd/close.c
> +LIBMUSL_UNISTD_SRCS-y +=3D $(LIBMUSL)/src/unistd/ctermid.c
> +#LIBMUSL_UNISTD_SRCS-y +=3D $(LIBMUSL)/src/unistd/dup.c
> +#LIBMUSL_UNISTD_SRCS-y +=3D $(LIBMUSL)/src/unistd/dup2.c
> +LIBMUSL_UNISTD_SRCS-y +=3D $(LIBMUSL)/src/unistd/dup3.c
> +#LIBMUSL_UNISTD_SRCS-y +=3D $(LIBMUSL)/src/unistd/faccessat.c
> +#LIBMUSL_UNISTD_SRCS-y +=3D $(LIBMUSL)/src/unistd/fchdir.c
> +#LIBMUSL_UNISTD_SRCS-y +=3D $(LIBMUSL)/src/unistd/fchown.c
> +LIBMUSL_UNISTD_SRCS-y +=3D $(LIBMUSL)/src/unistd/fchownat.c
> +#LIBMUSL_UNISTD_SRCS-y +=3D $(LIBMUSL)/src/unistd/fdatasync.c
> +#LIBMUSL_UNISTD_SRCS-y +=3D $(LIBMUSL)/src/unistd/fsync.c
> +#LIBMUSL_UNISTD_SRCS-y +=3D $(LIBMUSL)/src/unistd/ftruncate.c
> +#LIBMUSL_UNISTD_SRCS-y +=3D $(LIBMUSL)/src/unistd/getcwd.c
> +LIBMUSL_UNISTD_SRCS-y +=3D $(LIBMUSL)/src/unistd/getegid.c
> +LIBMUSL_UNISTD_SRCS-y +=3D $(LIBMUSL)/src/unistd/geteuid.c
> +LIBMUSL_UNISTD_SRCS-y +=3D $(LIBMUSL)/src/unistd/getgid.c
> +LIBMUSL_UNISTD_SRCS-y +=3D $(LIBMUSL)/src/unistd/getgroups.c
> +#LIBMUSL_UNISTD_SRCS-y +=3D $(LIBMUSL)/src/unistd/gethostname.c
> +LIBMUSL_UNISTD_SRCS-y +=3D $(LIBMUSL)/src/unistd/getlogin.c
> +LIBMUSL_UNISTD_SRCS-y +=3D $(LIBMUSL)/src/unistd/getlogin_r.c
> +#LIBMUSL_UNISTD_SRCS-y +=3D $(LIBMUSL)/src/unistd/getpgid.c
> +#LIBMUSL_UNISTD_SRCS-y +=3D $(LIBMUSL)/src/unistd/getpgrp.c
> +#LIBMUSL_UNISTD_SRCS-y +=3D $(LIBMUSL)/src/unistd/getpid.c
> +#LIBMUSL_UNISTD_SRCS-y +=3D $(LIBMUSL)/src/unistd/getppid.c
> +#LIBMUSL_UNISTD_SRCS-y +=3D $(LIBMUSL)/src/unistd/getsid.c
> +LIBMUSL_UNISTD_SRCS-y +=3D $(LIBMUSL)/src/unistd/getuid.c
> +LIBMUSL_UNISTD_SRCS-y +=3D $(LIBMUSL)/src/unistd/isatty.c
> +#LIBMUSL_UNISTD_SRCS-y +=3D $(LIBMUSL)/src/unistd/lchown.c
> +#LIBMUSL_UNISTD_SRCS-y +=3D $(LIBMUSL)/src/unistd/link.c
> +LIBMUSL_UNISTD_SRCS-y +=3D $(LIBMUSL)/src/unistd/linkat.c
> +#LIBMUSL_UNISTD_SRCS-y +=3D $(LIBMUSL)/src/unistd/lseek.c
> +#LIBMUSL_UNISTD_SRCS-y +=3D $(LIBMUSL)/src/unistd/nice.c
> +LIBMUSL_UNISTD_SRCS-y +=3D $(LIBMUSL)/src/unistd/pause.c
> +#LIBMUSL_UNISTD_SRCS-y +=3D $(LIBMUSL)/src/unistd/pipe.c
> +#LIBMUSL_UNISTD_SRCS-y +=3D $(LIBMUSL)/src/unistd/pipe2.c
> +LIBMUSL_UNISTD_SRCS-y +=3D $(LIBMUSL)/src/unistd/posix_close.c
> +#LIBMUSL_UNISTD_SRCS-y +=3D $(LIBMUSL)/src/unistd/pread.c
> +#LIBMUSL_UNISTD_SRCS-y +=3D $(LIBMUSL)/src/unistd/preadv.c
> +#LIBMUSL_UNISTD_SRCS-y +=3D $(LIBMUSL)/src/unistd/pwrite.c
> +#LIBMUSL_UNISTD_SRCS-y +=3D $(LIBMUSL)/src/unistd/pwritev.c
> +#LIBMUSL_UNISTD_SRCS-y +=3D $(LIBMUSL)/src/unistd/read.c
> +#LIBMUSL_UNISTD_SRCS-y +=3D $(LIBMUSL)/src/unistd/readlink.c
> +LIBMUSL_UNISTD_SRCS-y +=3D $(LIBMUSL)/src/unistd/readlinkat.c
> +#LIBMUSL_UNISTD_SRCS-y +=3D $(LIBMUSL)/src/unistd/readv.c
> +LIBMUSL_UNISTD_SRCS-y +=3D $(LIBMUSL)/src/unistd/renameat.c
> +#LIBMUSL_UNISTD_SRCS-y +=3D $(LIBMUSL)/src/unistd/rmdir.c
> +LIBMUSL_UNISTD_SRCS-y +=3D $(LIBMUSL)/src/unistd/setegid.c
> +LIBMUSL_UNISTD_SRCS-y +=3D $(LIBMUSL)/src/unistd/seteuid.c
> +LIBMUSL_UNISTD_SRCS-y +=3D $(LIBMUSL)/src/unistd/setgid.c
> +#LIBMUSL_UNISTD_SRCS-y +=3D $(LIBMUSL)/src/unistd/setpgid.c
> +#LIBMUSL_UNISTD_SRCS-y +=3D $(LIBMUSL)/src/unistd/setpgrp.c
> +LIBMUSL_UNISTD_SRCS-y +=3D $(LIBMUSL)/src/unistd/setregid.c
> +LIBMUSL_UNISTD_SRCS-y +=3D $(LIBMUSL)/src/unistd/setresgid.c
> +LIBMUSL_UNISTD_SRCS-y +=3D $(LIBMUSL)/src/unistd/setresuid.c
> +LIBMUSL_UNISTD_SRCS-y +=3D $(LIBMUSL)/src/unistd/setreuid.c
> +#LIBMUSL_UNISTD_SRCS-y +=3D $(LIBMUSL)/src/unistd/setsid.c
> +LIBMUSL_UNISTD_SRCS-y +=3D $(LIBMUSL)/src/unistd/setuid.c
> +LIBMUSL_UNISTD_SRCS-y +=3D $(LIBMUSL)/src/unistd/setxid.c
> +#LIBMUSL_UNISTD_SRCS-y +=3D $(LIBMUSL)/src/unistd/sleep.c
> +#LIBMUSL_UNISTD_SRCS-y +=3D $(LIBMUSL)/src/unistd/symlink.c
> +LIBMUSL_UNISTD_SRCS-y +=3D $(LIBMUSL)/src/unistd/symlinkat.c
> +#LIBMUSL_UNISTD_SRCS-y +=3D $(LIBMUSL)/src/unistd/sync.c
> +#LIBMUSL_UNISTD_SRCS-y +=3D $(LIBMUSL)/src/unistd/tcgetpgrp.c
> +#LIBMUSL_UNISTD_SRCS-y +=3D $(LIBMUSL)/src/unistd/tcsetpgrp.c
> +#LIBMUSL_UNISTD_SRCS-y +=3D $(LIBMUSL)/src/unistd/truncate.c
> +LIBMUSL_UNISTD_SRCS-y +=3D $(LIBMUSL)/src/unistd/ttyname.c
> +LIBMUSL_UNISTD_SRCS-y +=3D $(LIBMUSL)/src/unistd/ttyname_r.c
> +LIBMUSL_UNISTD_SRCS-y +=3D $(LIBMUSL)/src/unistd/ualarm.c
> +#LIBMUSL_UNISTD_SRCS-y +=3D $(LIBMUSL)/src/unistd/unlink.c
> +LIBMUSL_UNISTD_SRCS-y +=3D $(LIBMUSL)/src/unistd/unlinkat.c
> +#LIBMUSL_UNISTD_SRCS-y +=3D $(LIBMUSL)/src/unistd/usleep.c
> +#LIBMUSL_UNISTD_SRCS-y +=3D $(LIBMUSL)/src/unistd/write.c
> +#LIBMUSL_UNISTD_SRCS-y +=3D $(LIBMUSL)/src/unistd/writev.c
> +
> +#LIBMUSL_UNISTD_SRCS-y +=3D $(LIBMUSL)/src/unistd/mips/pipe.s
> +#LIBMUSL_UNISTD_SRCS-y +=3D $(LIBMUSL)/src/unistd/mips64/pipe.s
> +#LIBMUSL_UNISTD_SRCS-y +=3D $(LIBMUSL)/src/unistd/mipsn32/pipe.s
> +#LIBMUSL_UNISTD_SRCS-y +=3D $(LIBMUSL)/src/unistd/sh/pipe.s
> +
> +$(eval $(call =
_libmusl_import_lib,unistd,$(LIBMUSL_UNISTD_HDRS-y),$(LIBMUSL_UNISTD_SRCS-=
y)))
> --=20
> 2.20.1
>=20
>=20



From minios-devel-bounces@lists.xenproject.org Tue Aug 11 08:41:02 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Tue, 11 Aug 2020 08:41:02 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1k5Pq7-00080b-Ue; Tue, 11 Aug 2020 08:40:59 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=z2dq=BV=neclab.eu=sharan.santhanam@srs-us1.protection.inumbo.net>)
 id 1k5Pq7-0007zs-1k
 for minios-devel@lists.xenproject.org; Tue, 11 Aug 2020 08:40:59 +0000
X-Inumbo-ID: c1dbb1ee-953a-47e1-a645-d825b440b43f
Received: from mailer1.neclab.eu (unknown [195.37.70.40])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id c1dbb1ee-953a-47e1-a645-d825b440b43f;
 Tue, 11 Aug 2020 08:40:57 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
 by mailer1.neclab.eu (Postfix) with ESMTP id DE9C21040D6;
 Tue, 11 Aug 2020 10:40:55 +0200 (CEST)
X-Virus-Scanned: Amavisd on Debian GNU/Linux (atlas-a.office.hd)
Received: from mailer1.neclab.eu ([127.0.0.1])
 by localhost (atlas-a.office.hd [127.0.0.1]) (amavisd-new, port 10024)
 with ESMTP id mXb7JFlNC8yS; Tue, 11 Aug 2020 10:40:55 +0200 (CEST)
X-ENC: Last-Hop-TLS-encrypted
X-ENC: Last-Hop-TLS-encrypted
Received: from puck.office.hd (puck.office.hd [192.168.24.91])
 (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
 (No client certificate requested)
 by mailer1.neclab.eu (Postfix) with ESMTPS id B95081003CD;
 Tue, 11 Aug 2020 10:40:55 +0200 (CEST)
Received: from [10.7.1.9] (192.168.24.96) by puck.office.hd (192.168.24.91)
 with Microsoft SMTP Server (version=TLS1_2,
 cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1979.3; Tue, 11 Aug
 2020 10:40:55 +0200
Subject: Re: [Minios-devel] [UNIKRAFT PATCH v3 02/12] lib/uknetdev: Add
 alignment size for packet buffers allocations
To: <minios-devel@lists.xenproject.org>
References: <20200303141344.16002-1-costin.lupu@cs.pub.ro>
 <20200303141344.16002-3-costin.lupu@cs.pub.ro>
From: Sharan Santhanam <sharan.santhanam@neclab.eu>
Message-ID: <6894a296-d0e9-7f27-ae4b-94984bd15180@neclab.eu>
Date: Tue, 11 Aug 2020 10:40:54 +0200
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101
 Thunderbird/68.10.0
MIME-Version: 1.0
In-Reply-To: <20200303141344.16002-3-costin.lupu@cs.pub.ro>
Content-Type: text/plain; charset="utf-8"; format=flowed
Content-Transfer-Encoding: 7bit
Content-Language: en-US
X-Originating-IP: [192.168.24.96]
X-ClientProxiedBy: titania.office.hd (192.168.24.89) To puck.office.hd
 (192.168.24.91)
X-BeenThere: minios-devel@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Mini-os development list <minios-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:minios-devel@lists.xenproject.org>
List-Help: <mailto:minios-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=subscribe>
Cc: Costin Lupu <costin.lupu@cs.pub.ro>
Errors-To: minios-devel-bounces@lists.xenproject.org
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>

Hello Costin,

Thank you for the work. Please find the comments inline.

Thanks & Regards
Sharan

On 3/3/20 3:13 PM, Costin Lupu wrote:
> Packet buffers may need different alignments, depending on their driver
> requirements. For Xen netfront driver, packet buffers have to be page aligned
> because they are saved in pages shared between backend and frontend. For KVM
> virtio net driver, word size alignments suffice. Therefore, we need to save the
> alignment size in order to support multiple drivers.
>
> This patch also squeezes a small fix for setting the max_mtu when retrieving
> device information from the virtio net driver.
>
> Signed-off-by: Costin Lupu <costin.lupu@cs.pub.ro>
> ---
>   lib/uknetdev/include/uk/netdev_core.h | 1 +
>   plat/drivers/virtio/virtio_net.c      | 2 ++
>   2 files changed, 3 insertions(+)
>
> diff --git a/lib/uknetdev/include/uk/netdev_core.h b/lib/uknetdev/include/uk/netdev_core.h
> index f073e101..268d54d7 100644
> --- a/lib/uknetdev/include/uk/netdev_core.h
> +++ b/lib/uknetdev/include/uk/netdev_core.h
> @@ -94,6 +94,7 @@ struct uk_netdev_info {
>   	uint16_t max_mtu;   /**< Maximum supported MTU size. */
>   	uint16_t nb_encap_tx;  /**< Number of bytes required as headroom for tx. */
>   	uint16_t nb_encap_rx;  /**< Number of bytes required as headroom for rx. */
> +	uint16_t align;  /**< Alignment required for data address. */
Why do we need to introduce yet another align field. Each of the tx 
queue and rx queue has a `uk_netdev_queue_info` which have the align 
fields. Since packet buffers are more tied to the rxq and txq why dont 
we use those align field.
>   };
>   
>   /**
> diff --git a/plat/drivers/virtio/virtio_net.c b/plat/drivers/virtio/virtio_net.c
> index efc2cb71..9f1873c5 100644
> --- a/plat/drivers/virtio/virtio_net.c
> +++ b/plat/drivers/virtio/virtio_net.c
> @@ -1048,8 +1048,10 @@ static void virtio_net_info_get(struct uk_netdev *dev,
>   
>   	dev_info->max_rx_queues = vndev->max_vqueue_pairs;
>   	dev_info->max_tx_queues = vndev->max_vqueue_pairs;
> +	dev_info->max_mtu = vndev->max_mtu;
>   	dev_info->nb_encap_tx = sizeof(struct virtio_net_hdr_padded);
>   	dev_info->nb_encap_rx = sizeof(struct virtio_net_hdr_padded);
> +	dev_info->align = sizeof(void *); /* word size alignment */
>   }
>   
>   static int virtio_net_start(struct uk_netdev *n)


From minios-devel-bounces@lists.xenproject.org Tue Aug 11 08:42:06 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Tue, 11 Aug 2020 08:42:06 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1k5PrC-00082B-2E; Tue, 11 Aug 2020 08:42:06 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=z2dq=BV=neclab.eu=sharan.santhanam@srs-us1.protection.inumbo.net>)
 id 1k5PrA-000826-9w
 for minios-devel@lists.xen.org; Tue, 11 Aug 2020 08:42:04 +0000
X-Inumbo-ID: e7398363-4760-47cd-af49-769f702f2396
Received: from mailer2.neclab.eu (unknown [195.37.70.41])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id e7398363-4760-47cd-af49-769f702f2396;
 Tue, 11 Aug 2020 08:42:03 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
 by mailer2.neclab.eu (Postfix) with ESMTP id 2F744F201C;
 Tue, 11 Aug 2020 10:42:02 +0200 (CEST)
X-Virus-Scanned: Amavisd on Debian GNU/Linux (atlas-b.office.hd)
Received: from mailer2.neclab.eu ([127.0.0.1])
 by localhost (atlas-b.office.hd [127.0.0.1]) (amavisd-new, port 10024)
 with ESMTP id szLt61RvtMGv; Tue, 11 Aug 2020 10:42:02 +0200 (CEST)
X-ENC: Last-Hop-TLS-encrypted
X-ENC: Last-Hop-TLS-encrypted
Received: from puck.office.hd (puck.office.hd [192.168.24.91])
 (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
 (No client certificate requested)
 by mailer2.neclab.eu (Postfix) with ESMTPS id 0298EF201A;
 Tue, 11 Aug 2020 10:41:58 +0200 (CEST)
Received: from [10.7.1.9] (192.168.24.96) by puck.office.hd (192.168.24.91)
 with Microsoft SMTP Server (version=TLS1_2,
 cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1979.3; Tue, 11 Aug
 2020 10:41:57 +0200
Subject: Re: [Minios-devel] [UNIKRAFT PATCH v3 01/12] lib/uknetdev: Make
 Ethernet macros visible to all network devices
To: Costin Lupu <costin.lupu@cs.pub.ro>, <minios-devel@lists.xen.org>
References: <20200303141344.16002-1-costin.lupu@cs.pub.ro>
 <20200303141344.16002-2-costin.lupu@cs.pub.ro>
From: Sharan Santhanam <sharan.santhanam@neclab.eu>
Message-ID: <7a1392ef-38fe-bf1a-65c2-bbde97afac6f@neclab.eu>
Date: Tue, 11 Aug 2020 10:41:56 +0200
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101
 Thunderbird/68.10.0
MIME-Version: 1.0
In-Reply-To: <20200303141344.16002-2-costin.lupu@cs.pub.ro>
Content-Type: text/plain; charset="utf-8"; format=flowed
Content-Transfer-Encoding: 7bit
Content-Language: en-US
X-Originating-IP: [192.168.24.96]
X-ClientProxiedBy: oberon.office.hd (192.168.24.90) To puck.office.hd
 (192.168.24.91)
X-BeenThere: minios-devel@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Mini-os development list <minios-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:minios-devel@lists.xenproject.org>
List-Help: <mailto:minios-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: minios-devel-bounces@lists.xenproject.org
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>

Hello,

This patch seems fine.


Reviewed-by: Sharan Santhanam <sharan.santhanam@neclab.eu>

Thanks & Regards

Sharan

On 3/3/20 3:13 PM, Costin Lupu wrote:
> Both Ethernet header and payload sizes have the same values for all
> network devices.
>
> Signed-off-by: Costin Lupu <costin.lupu@cs.pub.ro>
> ---
>   lib/uknetdev/include/uk/netdev_core.h | 7 +++++++
>   plat/drivers/virtio/virtio_net.c      | 2 --
>   2 files changed, 7 insertions(+), 2 deletions(-)
>
> diff --git a/lib/uknetdev/include/uk/netdev_core.h b/lib/uknetdev/include/uk/netdev_core.h
> index dba719fc..f073e101 100644
> --- a/lib/uknetdev/include/uk/netdev_core.h
> +++ b/lib/uknetdev/include/uk/netdev_core.h
> @@ -68,6 +68,13 @@ extern "C" {
>   struct uk_netdev;
>   UK_TAILQ_HEAD(uk_netdev_list, struct uk_netdev);
>   
> +/**
> + * Ethernet macros
> + */
> +#define ETH_HDR_LEN           14
> +#define ETH_PKT_PAYLOAD_LEN   1500
> +#define ETH_PKT_LEN           (ETH_HDR_LEN + ETH_PKT_PAYLOAD_LEN)
> +
>   /**
>    * A structure used for Ethernet hardware addresses
>    */
> diff --git a/plat/drivers/virtio/virtio_net.c b/plat/drivers/virtio/virtio_net.c
> index 3025ed3f..efc2cb71 100644
> --- a/plat/drivers/virtio/virtio_net.c
> +++ b/plat/drivers/virtio/virtio_net.c
> @@ -47,8 +47,6 @@
>    *		   12 bytes in length in modern mode.
>    */
>   #define VIRTIO_HDR_LEN          12
> -#define ETH_HDR_LEN             14
> -#define ETH_PKT_PAYLOAD_LEN   1500
>   #define VIRTIO_PKT_BUFFER_LEN ((ETH_PKT_PAYLOAD_LEN)	\
>   			       + (ETH_HDR_LEN)		\
>   			       + (VIRTIO_HDR_LEN))


From minios-devel-bounces@lists.xenproject.org Tue Aug 11 09:46:44 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Tue, 11 Aug 2020 09:46:44 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1k5Qri-00051q-7t; Tue, 11 Aug 2020 09:46:42 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=nA/H=BV=uliege.be=gaulthier.gain@srs-us1.protection.inumbo.net>)
 id 1k5Qrg-00051U-3b
 for minios-devel@lists.xen.org; Tue, 11 Aug 2020 09:46:40 +0000
X-Inumbo-ID: 173847a4-c882-4de9-aa45-ef0afc44a0e5
Received: from serv108.segi.ulg.ac.be (unknown [139.165.32.111])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 173847a4-c882-4de9-aa45-ef0afc44a0e5;
 Tue, 11 Aug 2020 09:46:38 +0000 (UTC)
Received: from gaulthiers-mbp.lan (151.169-240-81.adsl-dyn.isp.belgacom.be
 [81.240.169.151])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
 (No client certificate requested)
 by serv108.segi.ulg.ac.be (Postfix) with ESMTPSA id 5CF6E201036E;
 Tue, 11 Aug 2020 11:46:37 +0200 (CEST)
DKIM-Filter: OpenDKIM Filter v2.11.0 serv108.segi.ulg.ac.be 5CF6E201036E
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=uliege.be;
 s=ulg20190529; t=1597139197;
 bh=vl6QF0RTvMnbp1BUxYHVFjwkFlU4xZBSEYGHM95hh0Q=;
 h=From:Subject:Date:In-Reply-To:Cc:To:References:From;
 b=vAjyEIMzpUBtrwcnMiw7H8xMTJBU52yfX6HktkRmEROB/KzxSn0p6+XFuigH+72mD
 yMzUEOZc3Gkayet9ow3zNOsgsHl6hjn+cKVphrTM78yG5W0LeHpl1fO44sOoBiw2t5
 PJ1WmR1gRfsHRsVQRPRUYuh641YaDsY3u+YTw8IEHBqTHRZIsf3WquJ0GXZB+tb7w/
 rtZ8tWQzfe3fhsUkFUITC6VGnYogvA9JEPxF8qbWPH9z+A+0FUSE68C1PpSPbeXYwP
 sGCp0kvAomQLD/Ug0aBTwEFUE4cPGoF3EFP4pwX/3kzNApBBcX4nHds015G2dniCj+
 G56SMjnyH3ThA==
From: Gaulthier Gain <Gaulthier.Gain@uliege.be>
Message-Id: <454FC12D-1363-429F-9D89-28FA345ECF9F@uliege.be>
Content-Type: multipart/alternative;
 boundary="Apple-Mail=_F954499F-AAF0-4CE5-AC30-8C91345EA439"
Mime-Version: 1.0 (Mac OS X Mail 13.0 \(3608.60.0.2.5\))
Subject: Re: [UNIKRAFT PATCH] include: uk/page.h: Provide __PAGE_SIZE
Date: Tue, 11 Aug 2020 11:46:36 +0200
In-Reply-To: <1595942407.4796.14.camel@neclab.eu>
To: minios-devel@lists.xen.org
References: <20200728111425.28417-1-simon.kuenzer@neclab.eu>
 <1595942407.4796.14.camel@neclab.eu>
X-Mailer: Apple Mail (2.3608.60.0.2.5)
X-BeenThere: minios-devel@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Mini-os development list <minios-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:minios-devel@lists.xenproject.org>
List-Help: <mailto:minios-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=subscribe>
Cc: Simon Kuenzer <simon.kuenzer@neclab.eu>,
 Hugo Lefeuvre <hugo.lefeuvre@neclab.eu>
Errors-To: minios-devel-bounces@lists.xenproject.org
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>


--Apple-Mail=_F954499F-AAF0-4CE5-AC30-8C91345EA439
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain;
	charset=us-ascii

Hi Simon, Hugo,=20

Using `<uk/asm/limits.h>` breaks the build with ramfs. What do you think =
of using  `<uk/arch/limits.h>` instead of  `<uk/asm/limits.h>`?

Gaulthier

> On 28 Jul 2020, at 15:20, Hugo Lefeuvre <hugo.lefeuvre@neclab.eu> =
wrote:
>=20
> Hi Simon,
>=20
> thanks a lot, this looks good to me. It was confusing to me that
> including page.h didn't define __PAGE_SIZE.
>=20
> regards,
> Hugo
>=20
> Reviewed-by: Hugo Lefeuvre <hugo.lefeuvre@neclab.eu>
>=20
> On Tue, 2020-07-28 at 13:14 +0200, Simon Kuenzer wrote:
>> Provides __PAGE_SIZE with the uk/page.h header.
>>=20
>> Signed-off-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
>> ---
>>  include/uk/page.h | 1 +
>>  1 file changed, 1 insertion(+)
>>=20
>> diff --git a/include/uk/page.h b/include/uk/page.h
>> index 48ae9602..4e95f1b6 100644
>> --- a/include/uk/page.h
>> +++ b/include/uk/page.h
>> @@ -35,6 +35,7 @@
>>  #ifndef __UK_PAGE_H__
>>  #define __UK_PAGE_H__
>> =20
>> +#include <uk/asm/limits.h>
>>  #include <uk/essentials.h>
>> =20
>>  #ifdef __cplusplus
>=20


--Apple-Mail=_F954499F-AAF0-4CE5-AC30-8C91345EA439
Content-Transfer-Encoding: quoted-printable
Content-Type: text/html;
	charset=us-ascii

<html><head><meta http-equiv=3D"Content-Type" content=3D"text/html; =
charset=3Dus-ascii"></head><body style=3D"word-wrap: break-word; =
-webkit-nbsp-mode: space; line-break: after-white-space;" class=3D"">Hi =
Simon, Hugo,&nbsp;<div class=3D""><br class=3D""></div><div =
class=3D"">Using&nbsp;<span style=3D"font-family: &quot;Helvetica =
Neue&quot;;" class=3D"">`</span>&lt;uk/asm/limits.h&gt;<span =
style=3D"font-family: &quot;Helvetica Neue&quot;;" class=3D"">` breaks =
the build with ramfs. What do you think of using&nbsp;</span>&nbsp;<span =
style=3D"font-family: &quot;Helvetica Neue&quot;;" =
class=3D"">`</span>&lt;uk/arch/limits.h&gt;<span style=3D"font-family: =
&quot;Helvetica Neue&quot;;" class=3D"">`</span><span =
style=3D"font-family: &quot;Helvetica Neue&quot;;" =
class=3D"">&nbsp;instead of&nbsp;</span>&nbsp;<span style=3D"font-family: =
&quot;Helvetica Neue&quot;;" =
class=3D"">`</span>&lt;uk/asm/limits.h&gt;<span style=3D"font-family: =
&quot;Helvetica Neue&quot;;" class=3D"">`?</span></div><div =
class=3D""><span style=3D"font-family: &quot;Helvetica Neue&quot;;" =
class=3D""><br class=3D""></span></div><div class=3D""><span =
style=3D"font-family: &quot;Helvetica Neue&quot;;" =
class=3D"">Gaulthier</span></div><div class=3D""><div class=3D""><div><br =
class=3D""><blockquote type=3D"cite" class=3D""><div class=3D"">On 28 =
Jul 2020, at 15:20, Hugo Lefeuvre &lt;<a =
href=3D"mailto:hugo.lefeuvre@neclab.eu" =
class=3D"">hugo.lefeuvre@neclab.eu</a>&gt; wrote:</div><br =
class=3D"Apple-interchange-newline"><div class=3D""><div class=3D"">Hi =
Simon,<br class=3D""><br class=3D"">thanks a lot, this looks good to me. =
It was confusing to me that<br class=3D"">including page.h didn't define =
__PAGE_SIZE.<br class=3D""><br class=3D"">regards,<br class=3D"">Hugo<br =
class=3D""><br class=3D"">Reviewed-by: Hugo Lefeuvre &lt;<a =
href=3D"mailto:hugo.lefeuvre@neclab.eu" =
class=3D"">hugo.lefeuvre@neclab.eu</a>&gt;<br class=3D""><br class=3D"">On=
 Tue, 2020-07-28 at 13:14 +0200, Simon Kuenzer wrote:<br =
class=3D""><blockquote type=3D"cite" class=3D"">Provides __PAGE_SIZE =
with the uk/page.h header.<br class=3D""><br class=3D"">Signed-off-by: =
Simon Kuenzer &lt;<a href=3D"mailto:simon.kuenzer@neclab.eu" =
class=3D"">simon.kuenzer@neclab.eu</a>&gt;<br class=3D"">---<br =
class=3D"">&nbsp;include/uk/page.h | 1 +<br class=3D"">&nbsp;1 file =
changed, 1 insertion(+)<br class=3D""><br class=3D"">diff --git =
a/include/uk/page.h b/include/uk/page.h<br class=3D"">index =
48ae9602..4e95f1b6 100644<br class=3D"">--- a/include/uk/page.h<br =
class=3D"">+++ b/include/uk/page.h<br class=3D"">@@ -35,6 +35,7 @@<br =
class=3D"">&nbsp;#ifndef __UK_PAGE_H__<br class=3D"">&nbsp;#define =
__UK_PAGE_H__<br class=3D"">&nbsp;<br class=3D"">+#include =
&lt;uk/asm/limits.h&gt;<br class=3D"">&nbsp;#include =
&lt;uk/essentials.h&gt;<br class=3D"">&nbsp;<br class=3D"">&nbsp;#ifdef =
__cplusplus<br class=3D""></blockquote><br =
class=3D""></div></div></blockquote></div><br =
class=3D""></div></div></body></html>=

--Apple-Mail=_F954499F-AAF0-4CE5-AC30-8C91345EA439--


From minios-devel-bounces@lists.xenproject.org Tue Aug 11 10:40:46 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Tue, 11 Aug 2020 10:40:46 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1k5Ri0-0001uQ-E9; Tue, 11 Aug 2020 10:40:44 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=I9oM=BV=cs.pub.ro=costin.lupu@srs-us1.protection.inumbo.net>)
 id 1k5Rhz-0001uL-N6
 for minios-devel@lists.xenproject.org; Tue, 11 Aug 2020 10:40:43 +0000
X-Inumbo-ID: b9f38e55-6062-46ee-a63b-b34495b738b1
Received: from mx.upb.ro (unknown [141.85.13.220])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id b9f38e55-6062-46ee-a63b-b34495b738b1;
 Tue, 11 Aug 2020 10:40:41 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
 by mx.upb.ro (Postfix) with ESMTP id 20B7DB560093;
 Tue, 11 Aug 2020 13:40:38 +0300 (EEST)
Received: from mx.upb.ro ([127.0.0.1])
 by localhost (mx.upb.ro [127.0.0.1]) (amavisd-new, port 10032)
 with ESMTP id nX2LdukAG3uh; Tue, 11 Aug 2020 13:40:35 +0300 (EEST)
Received: from localhost (localhost [127.0.0.1])
 by mx.upb.ro (Postfix) with ESMTP id DD21AB561A67;
 Tue, 11 Aug 2020 13:40:35 +0300 (EEST)
X-Virus-Scanned: amavisd-new at upb.ro
Received: from mx.upb.ro ([127.0.0.1])
 by localhost (mx.upb.ro [127.0.0.1]) (amavisd-new, port 10026)
 with ESMTP id 5jOtfPGn3nme; Tue, 11 Aug 2020 13:40:35 +0300 (EEST)
Received: from [192.168.1.35] (unknown [188.25.162.205])
 by mx.upb.ro (Postfix) with ESMTPSA id AC491B560093;
 Tue, 11 Aug 2020 13:40:35 +0300 (EEST)
Subject: Re: [Minios-devel] [UNIKRAFT PATCH v3 02/12] lib/uknetdev: Add
 alignment size for packet buffers allocations
To: Sharan Santhanam <sharan.santhanam@neclab.eu>,
 minios-devel@lists.xenproject.org
References: <20200303141344.16002-1-costin.lupu@cs.pub.ro>
 <20200303141344.16002-3-costin.lupu@cs.pub.ro>
 <6894a296-d0e9-7f27-ae4b-94984bd15180@neclab.eu>
From: Costin Lupu <costin.lupu@cs.pub.ro>
Message-ID: <8cb1a39b-2002-7f82-31c3-ad35ae856617@cs.pub.ro>
Date: Tue, 11 Aug 2020 13:40:35 +0300
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101
 Thunderbird/68.11.0
MIME-Version: 1.0
In-Reply-To: <6894a296-d0e9-7f27-ae4b-94984bd15180@neclab.eu>
Content-Type: text/plain; charset=utf-8
Content-Language: en-US
Content-Transfer-Encoding: quoted-printable
X-BeenThere: minios-devel@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Mini-os development list <minios-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:minios-devel@lists.xenproject.org>
List-Help: <mailto:minios-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: minios-devel-bounces@lists.xenproject.org
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>

Hi Sharan,

Please see inline.

On 8/11/20 11:40 AM, Sharan Santhanam wrote:
> Hello Costin,
>=20
> Thank you for the work. Please find the comments inline.
>=20
> Thanks & Regards
> Sharan
>=20
> On 3/3/20 3:13 PM, Costin Lupu wrote:
>> Packet buffers may need different alignments, depending on their drive=
r
>> requirements. For Xen netfront driver, packet buffers have to be page
>> aligned
>> because they are saved in pages shared between backend and frontend.
>> For KVM
>> virtio net driver, word size alignments suffice. Therefore, we need to
>> save the
>> alignment size in order to support multiple drivers.
>>
>> This patch also squeezes a small fix for setting the max_mtu when
>> retrieving
>> device information from the virtio net driver.
>>
>> Signed-off-by: Costin Lupu <costin.lupu@cs.pub.ro>
>> ---
>> =C2=A0 lib/uknetdev/include/uk/netdev_core.h | 1 +
>> =C2=A0 plat/drivers/virtio/virtio_net.c=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 =
| 2 ++
>> =C2=A0 2 files changed, 3 insertions(+)
>>
>> diff --git a/lib/uknetdev/include/uk/netdev_core.h
>> b/lib/uknetdev/include/uk/netdev_core.h
>> index f073e101..268d54d7 100644
>> --- a/lib/uknetdev/include/uk/netdev_core.h
>> +++ b/lib/uknetdev/include/uk/netdev_core.h
>> @@ -94,6 +94,7 @@ struct uk_netdev_info {
>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 uint16_t max_mtu;=C2=A0=C2=A0 /**< Maxi=
mum supported MTU size. */
>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 uint16_t nb_encap_tx;=C2=A0 /**< Number=
 of bytes required as headroom
>> for tx. */
>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 uint16_t nb_encap_rx;=C2=A0 /**< Number=
 of bytes required as headroom
>> for rx. */
>> +=C2=A0=C2=A0=C2=A0 uint16_t align;=C2=A0 /**< Alignment required for =
data address. */
> Why do we need to introduce yet another align field. Each of the tx
> queue and rx queue has a `uk_netdev_queue_info` which have the align
> fields. Since packet buffers are more tied to the rxq and txq why dont
> we use those align field.

Indeed, I overlooked the nb_align field from the queue info. However, it
isn't initialized or used anywhere in the code. Besides this, isn't
alignment a property of the device rather than the queue? Are there
network devices with different alignments for their queues? Maybe we
should drop the field from the queue and use the one from device info
instead.

I needed the alignment for allocating buffers in lwip (please see
function `netbuf_alloc_helper_init()` in lwip glue code). All the
information needed for allocating buffers seems to be device specific,
not queue specific. If we had used the nb_field of queues then we would
have a buffer allocation helper for each queue.

>> =C2=A0 };
>> =C2=A0 =C2=A0 /**
>> diff --git a/plat/drivers/virtio/virtio_net.c
>> b/plat/drivers/virtio/virtio_net.c
>> index efc2cb71..9f1873c5 100644
>> --- a/plat/drivers/virtio/virtio_net.c
>> +++ b/plat/drivers/virtio/virtio_net.c
>> @@ -1048,8 +1048,10 @@ static void virtio_net_info_get(struct
>> uk_netdev *dev,
>> =C2=A0 =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 dev_info->max_rx_queues =3D vnde=
v->max_vqueue_pairs;
>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 dev_info->max_tx_queues =3D vndev->max_=
vqueue_pairs;
>> +=C2=A0=C2=A0=C2=A0 dev_info->max_mtu =3D vndev->max_mtu;
>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 dev_info->nb_encap_tx =3D sizeof(struct=
 virtio_net_hdr_padded);
>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 dev_info->nb_encap_rx =3D sizeof(struct=
 virtio_net_hdr_padded);
>> +=C2=A0=C2=A0=C2=A0 dev_info->align =3D sizeof(void *); /* word size a=
lignment */
>> =C2=A0 }
>> =C2=A0 =C2=A0 static int virtio_net_start(struct uk_netdev *n)
>=20


From minios-devel-bounces@lists.xenproject.org Tue Aug 11 16:27:53 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Tue, 11 Aug 2020 16:27:53 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1k5X7t-00064k-Ch; Tue, 11 Aug 2020 16:27:49 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=bfiO=BV=lancs.ac.uk=a.jung@srs-us1.protection.inumbo.net>)
 id 1k5X7r-00064f-NO
 for minios-devel@lists.xen.org; Tue, 11 Aug 2020 16:27:47 +0000
X-Inumbo-ID: 3478bf15-d4b7-4374-856b-31beba5b7e83
Received: from mh-fa-1.lancs.ac.uk (unknown [148.88.65.131])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 3478bf15-d4b7-4374-856b-31beba5b7e83;
 Tue, 11 Aug 2020 16:27:36 +0000 (UTC)
Received: from x4dbdc442.dyn.telefonica.de ([77.189.196.66]
 helo=localhost.localdomain)
 by mh-fa-1.lancs.ac.uk with esmtpsa (TLSv1.2:ECDHE-RSA-AES128-GCM-SHA256:128)
 (Exim 4.92.3) (envelope-from <a.jung@lancs.ac.uk>)
 id 1k5X7d-00DzUM-Ch; Tue, 11 Aug 2020 17:27:35 +0100
From: Alexander Jung <a.jung@lancs.ac.uk>
To: minios-devel@lists.xen.org
Subject: [UNIKRAFT/LIB-NEWLIB PATCH] Makefile.uk: Include unix basename and
 dirname
Date: Tue, 11 Aug 2020 18:27:23 +0200
Message-Id: <20200811162723.30929-1-a.jung@lancs.ac.uk>
X-Mailer: git-send-email 2.27.0
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-Spam-Score: -1.0 (-)
X-Spam-Bar: -
X-Spam-Report: Spam detection software, running on the system
 "mh-fa-1.lancs.ac.uk", has processed this message.
 The results are shown below. .
 Content analysis details:   (-1.0 points, 4.1 required) .
 pts rule name              description
 ---- ---------------------- --------------------------------------------------
 -1.0 ALL_TRUSTED            Passed through trusted hosts only via SMTP
X-BeenThere: minios-devel@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Mini-os development list <minios-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:minios-devel@lists.xenproject.org>
List-Help: <mailto:minios-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=subscribe>
Cc: Felipe Huici <felipe.huici@neclab.eu>,
 Simon Kuenzer <simon.kuenzer@neclab.eu>,
 Alexander Jung <alexander.jung@neclab.eu>,
 Sharan Santhanam <sharan.santhanam@neclab.eu>,
 Alexander Jung <a.jung@lancs.ac.uk>
Errors-To: minios-devel-bounces@lists.xenproject.org
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>

This commit adds basename() and dirname() into the newlib build
for Unikraft.  Both functions have only dependencies to <string.h>
making them easily compatible.

Signed-off-by: Alexander Jung <alexander.jung@neclab.eu>
---
 Makefile.uk | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/Makefile.uk b/Makefile.uk
index 82836e4..f1cdf7a 100644
--- a/Makefile.uk
+++ b/Makefile.uk
@@ -860,6 +860,12 @@ LIBNEWLIBC_SRCS-y += $(LIBNEWLIB_LIBC)/time/tzset_r.c
 LIBNEWLIBC_SRCS-y += $(LIBNEWLIB_LIBC)/time/tzvars.c
 LIBNEWLIBC_SRCS-y += $(LIBNEWLIB_LIBC)/time/wcsftime.c
 
+################################################################################
+# Newlib/libc code -- unix
+################################################################################
+LIBNEWLIBC_SRCS-y += $(LIBNEWLIB_LIBC)/unix/basename.c
+LIBNEWLIBC_SRCS-y += $(LIBNEWLIB_LIBC)/unix/dirname.c
+
 ################################################################################
 # Newlib/libc code -- setjmp, longjmp
 ################################################################################
-- 
2.20.1



From minios-devel-bounces@lists.xenproject.org Wed Aug 12 10:15:12 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Wed, 12 Aug 2020 10:15:12 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1k5nmo-0002Us-NC; Wed, 12 Aug 2020 10:15:10 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=il7M=BU=gmail.com=cristianvijelie@srs-us1.protection.inumbo.net>)
 id 1k5BoT-0000Ld-R1
 for minios-devel@lists.xen.org; Mon, 10 Aug 2020 17:42:21 +0000
X-Inumbo-ID: bfbd86c2-57a4-4ac7-866f-71f1ba09ace0
Received: from mail-ej1-x642.google.com (unknown [2a00:1450:4864:20::642])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id bfbd86c2-57a4-4ac7-866f-71f1ba09ace0;
 Mon, 10 Aug 2020 17:42:19 +0000 (UTC)
Received: by mail-ej1-x642.google.com with SMTP id g19so10222162ejc.9
 for <minios-devel@lists.xen.org>; Mon, 10 Aug 2020 10:42:19 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=from:to:cc:subject:date:message-id:in-reply-to:references
 :mime-version:content-transfer-encoding;
 bh=+2AZe+bI+AuS0sQulqtLGXZ9JDEqIlGeMF51V2tbc4g=;
 b=AvuqRI2J3aKgB0uC2w5/96hwj6DernW88ITy0hvcwc/eZ34HDJyfIxYIFSeyT5a58F
 +QhCKEYrgyxop4ZZpwCDN5zyk1t/jR+Hcq63vFE/MhDPBzQ/BOYdke3spW+RpU1p4w/3
 O8+ZfrM9dAN67YlRfSktvMCITK//IelHTEw+I5FmXvg0AKEBaHDNZw7rTBTMkw7SlJ70
 RiHf2/rZSLUgp69j5iNcRLWX2CsYaSdyd+pXhvCsi71bvOQrpDt16TWFT4+F9odZ7g/c
 sadEbEp/QCRpfzCyLSoy6gk+6kGX3o/PqE0Ym3785BsVWVJweYyhvpG6/NLrzJOh2Mik
 qwyw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to
 :references:mime-version:content-transfer-encoding;
 bh=+2AZe+bI+AuS0sQulqtLGXZ9JDEqIlGeMF51V2tbc4g=;
 b=l2X7IbR0zTrL8El7J9naVkhR/Yl+v+wlFkczw0l7sA2w/uD/wd2rxBtIpNfMvHnoTn
 pRMsAAgW3/4fZ5yOJkpXycuXb3qrEK4FM8/KVy3A3dNwF9JHWbmG0+2Ia0zv4xrFTvah
 XxvOAmoncc9dtQe9ozISLuPYDSSjY8R+nYxn0FBui4QcvIyHzOizcmPpvwJk5kN0o3pz
 NsqWiWlSqzJ6pRCmIajTRTN1q7ohKySwS7sfZzY8opc/ZyjE1XNY9NfVE+tZyH48IU75
 X93tdrza/7tfkMAU5idcRkhmfP6T7dUV00+AWqf5wSWq0Nt0nKwXObDWCaNRFeIV4TWO
 VN5Q==
X-Gm-Message-State: AOAM53127XbSx+34CP1n3uWLpGjuNEf5xUONFabXkd3yK5b/3uUPm58Q
 Ydz6MEmWMjtL2IBcfHaM0b+XEunjbe4=
X-Google-Smtp-Source: ABdhPJwwDs0UndCMgQFDrubffI40d4qk9ZyIl4aJvoMDRSHnQz7+0gZWN0qJhGwDNttC8hAG1357FQ==
X-Received: by 2002:a17:907:104a:: with SMTP id
 oy10mr22777592ejb.267.1597081335005; 
 Mon, 10 Aug 2020 10:42:15 -0700 (PDT)
Received: from localhost.localdomain ([2a02:2f0b:450d:d00:a5e5:c12b:1900:6130])
 by smtp.gmail.com with ESMTPSA id x21sm12661712edq.84.2020.08.10.10.42.14
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Mon, 10 Aug 2020 10:42:14 -0700 (PDT)
From: cristian-vijelie <cristianvijelie@gmail.com>
To: minios-devel@lists.xen.org
Subject: [[UNIKRAFT RFC PATCH] 2/2] lib/isrlib: Fixed a name typo that
 prevented build
Date: Mon, 10 Aug 2020 20:42:11 +0300
Message-Id: <20200810174211.6249-2-cristianvijelie@gmail.com>
X-Mailer: git-send-email 2.25.1
In-Reply-To: <20200810174211.6249-1-cristianvijelie@gmail.com>
References: <20200810174211.6249-1-cristianvijelie@gmail.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-Mailman-Approved-At: Wed, 12 Aug 2020 10:15:10 +0000
X-BeenThere: minios-devel@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Mini-os development list <minios-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:minios-devel@lists.xenproject.org>
List-Help: <mailto:minios-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=subscribe>
Cc: Cristian Vijelie <cristianvijelie@gmail.com>
Errors-To: minios-devel-bounces@lists.xenproject.org
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>

From: Cristian Vijelie <cristianvijelie@gmail.com>

---
 lib/Makefile.uk                                             | 1 +
 lib/irslib/Makefile.uk                                      | 6 ------
 lib/{irslib => isrlib}/Config.uk                            | 2 +-
 lib/isrlib/Makefile.uk                                      | 6 ++++++
 lib/{irslib => isrlib}/include/isrlib-internal/shareddefs.h | 0
 lib/{irslib => isrlib}/string.c                             | 0
 6 files changed, 8 insertions(+), 7 deletions(-)
 delete mode 100644 lib/irslib/Makefile.uk
 rename lib/{irslib => isrlib}/Config.uk (59%)
 create mode 100644 lib/isrlib/Makefile.uk
 rename lib/{irslib => isrlib}/include/isrlib-internal/shareddefs.h (100%)
 rename lib/{irslib => isrlib}/string.c (100%)

diff --git a/lib/Makefile.uk b/lib/Makefile.uk
index 07e8a29..f832a0b 100644
--- a/lib/Makefile.uk
+++ b/lib/Makefile.uk
@@ -37,3 +37,4 @@ $(eval $(call _import_lib,$(CONFIG_UK_BASE)/lib/ukmmap))
 $(eval $(call _import_lib,$(CONFIG_UK_BASE)/lib/ukblkdev))
 $(eval $(call _import_lib,$(CONFIG_UK_BASE)/lib/posix-process))
 $(eval $(call _import_lib,$(CONFIG_UK_BASE)/lib/uksp))
+$(eval $(call _import_lib,$(CONFIG_UK_BASE)/lib/isrlib))
diff --git a/lib/irslib/Makefile.uk b/lib/irslib/Makefile.uk
deleted file mode 100644
index fe2461e..0000000
--- a/lib/irslib/Makefile.uk
+++ /dev/null
@@ -1,6 +0,0 @@
-$(eval $(call addlib_s,libisrlib,$(CONFIG_LIBISRLIB)))
-
-CINCLUDES-$(CONFIG_LIBISRLIB)   += -I$(LIBISRLIB_BASE)/include
-CXXINCLUDES-$(CONFIG_LIBISRLIB)   += -I$(LIBISRLIB_BASE)/include
-
-LIBISRLIB_SRCS-y += $(LIBISRLIB_BASE)/string.c|isr
diff --git a/lib/irslib/Config.uk b/lib/isrlib/Config.uk
similarity index 59%
rename from lib/irslib/Config.uk
rename to lib/isrlib/Config.uk
index 88ff441..c6be13c 100644
--- a/lib/irslib/Config.uk
+++ b/lib/isrlib/Config.uk
@@ -1,5 +1,5 @@
 menuconfig LIBISRLIB
-    bool "isr helper library"
+    bool "isrlib: ISR helper library"
     default n
 
 if LIBISRLIB
diff --git a/lib/isrlib/Makefile.uk b/lib/isrlib/Makefile.uk
new file mode 100644
index 0000000..65baf2e
--- /dev/null
+++ b/lib/isrlib/Makefile.uk
@@ -0,0 +1,6 @@
+$(eval $(call addlib_s,libisrlib,$(CONFIG_LIBISRLIB)))
+
+CINCLUDES-$(CONFIG_LIBISRLIB) += -I$(LIBISRLIB_BASE)/include
+CXXINCLUDES-$(CONFIG_LIBISRLIB) += -I$(LIBISRLIB_BASE)/include
+
+LIBISRLIB_SRCS-y += $(LIBISRLIB_BASE)/string.c|isr
diff --git a/lib/irslib/include/isrlib-internal/shareddefs.h b/lib/isrlib/include/isrlib-internal/shareddefs.h
similarity index 100%
rename from lib/irslib/include/isrlib-internal/shareddefs.h
rename to lib/isrlib/include/isrlib-internal/shareddefs.h
diff --git a/lib/irslib/string.c b/lib/isrlib/string.c
similarity index 100%
rename from lib/irslib/string.c
rename to lib/isrlib/string.c
-- 
2.25.1



From minios-devel-bounces@lists.xenproject.org Wed Aug 12 10:15:12 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Wed, 12 Aug 2020 10:15:12 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1k5nmo-0002Un-Li; Wed, 12 Aug 2020 10:15:10 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=il7M=BU=gmail.com=cristianvijelie@srs-us1.protection.inumbo.net>)
 id 1k5BoP-0000Ld-23
 for minios-devel@lists.xen.org; Mon, 10 Aug 2020 17:42:17 +0000
X-Inumbo-ID: b8bc79f2-4370-40f5-a00d-b9f4d57ce7a4
Received: from mail-ej1-x633.google.com (unknown [2a00:1450:4864:20::633])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id b8bc79f2-4370-40f5-a00d-b9f4d57ce7a4;
 Mon, 10 Aug 2020 17:42:15 +0000 (UTC)
Received: by mail-ej1-x633.google.com with SMTP id a26so10267880ejc.2
 for <minios-devel@lists.xen.org>; Mon, 10 Aug 2020 10:42:15 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=from:to:cc:subject:date:message-id:mime-version
 :content-transfer-encoding;
 bh=c6qXzok7ZcCmCBoJSB3FNDqfQn9RLZ/dAO6JXopHu9I=;
 b=YnP1HhCrBH18BTXpyQdbtMLNR+mk3ubjs42i9HPAEnCZZv0fQiiSrjPesRKfSqTpi/
 ErGKChm5Cszb0MoQHzaBJtBufd/ZHCjP8CvGP4qaJqac0XJU3hR4B4lrdLA7itDbLsD+
 3LW8ph+2FRz4EEHX0SGjpg5db+digBNqHpTPj9Z3zAtjkgPZiNXiEXL/jsbPdnSxGc17
 u/ojvA2C3gUBdPaaz49QdKax2PnICHhRzGwv0VtkqA+M5ApczarIwDDGYesq5e6FJj7I
 tUhnfFNJ8EVLopefjzuAHeYn39SGI9JFYpOXwgN58TDgRH5Jl8TkmifjAfDKqTGW9rPG
 5SJA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version
 :content-transfer-encoding;
 bh=c6qXzok7ZcCmCBoJSB3FNDqfQn9RLZ/dAO6JXopHu9I=;
 b=RAduyZUu6NF+OpALCBIkuOUs5SHy94EPsLOt2lUIosae/iH/0oWpzGMrlyypLKT99p
 pCkkcGzDaqctxWBWSSSMeEvz6ktU8MEVxXhjKPfhArDAos4yFEqS3fo99N8/QPVjOWqt
 3nkrAZkccc0N53sfEBCJ2XnW0lNlnyjDdBdpFcw1J24daD5mHkMvTKgGFEsDHXJHGk8W
 BjqXhHLMpr8lVO6gxDAvqHwKGvAorq9l/XRQx0Jrex5pj7jNyC90iB9jhiPM0a368tZK
 QW84Uuxs2aMunFNz4Uz5knd8ugjQELEOItN6otpuBILKbn6e4NHOws6zlDismwKwSFSO
 xp6g==
X-Gm-Message-State: AOAM533Sdo7swD7ck2Ua1JbHi0JDoKs7kHOLUqrBu0fSjRvmgxzDtJAA
 X9rCpGILOMWDPlZqTnJlt0qJKngGqsw=
X-Google-Smtp-Source: ABdhPJwICPFLTzHWPZ19CQKIjhtZoteknbo9YPLmOfmkdWB+44k312RbxUDEEpAzY1+ZaUKxCJPypA==
X-Received: by 2002:a17:907:aaa:: with SMTP id
 bz10mr22180538ejc.304.1597081334030; 
 Mon, 10 Aug 2020 10:42:14 -0700 (PDT)
Received: from localhost.localdomain ([2a02:2f0b:450d:d00:a5e5:c12b:1900:6130])
 by smtp.gmail.com with ESMTPSA id x21sm12661712edq.84.2020.08.10.10.42.12
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Mon, 10 Aug 2020 10:42:13 -0700 (PDT)
From: cristian-vijelie <cristianvijelie@gmail.com>
To: minios-devel@lists.xen.org
Subject: [[UNIKRAFT RFC PATCH] 1/2] lib/isrlib: Applied Simon's recommendations
Date: Mon, 10 Aug 2020 20:42:10 +0300
Message-Id: <20200810174211.6249-1-cristianvijelie@gmail.com>
X-Mailer: git-send-email 2.25.1
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-Mailman-Approved-At: Wed, 12 Aug 2020 10:15:10 +0000
X-BeenThere: minios-devel@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Mini-os development list <minios-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:minios-devel@lists.xenproject.org>
List-Help: <mailto:minios-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=subscribe>
Cc: Cristian Vijelie <cristianvijelie@gmail.com>
Errors-To: minios-devel-bounces@lists.xenproject.org
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>

From: Cristian Vijelie <cristianvijelie@gmail.com>

---
 include/uk/isr/string.h                       |  53 +++++++
 lib/irslib/Config.uk                          |   7 +
 lib/irslib/Makefile.uk                        |   6 +
 .../include/isrlib-internal/shareddefs.h      | 146 ++++++++++++++++++
 lib/irslib/string.c                           |  11 ++
 5 files changed, 223 insertions(+)
 create mode 100644 include/uk/isr/string.h
 create mode 100644 lib/irslib/Config.uk
 create mode 100644 lib/irslib/Makefile.uk
 create mode 100644 lib/irslib/include/isrlib-internal/shareddefs.h
 create mode 100644 lib/irslib/string.c

diff --git a/include/uk/isr/string.h b/include/uk/isr/string.h
new file mode 100644
index 0000000..ceb8a0a
--- /dev/null
+++ b/include/uk/isr/string.h
@@ -0,0 +1,53 @@
+/* SPDX-License-Identifier: BSD-3-Clause */
+/*
+ * Authors: Simon Kuenzer <simon.kuenzer@neclab.eu>
+ *
+ *
+ * Copyright (c) 2017, NEC Europe Ltd., NEC Corporation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the copyright holder nor the names of its
+ *    contributors may be used to endorse or promote products derived from
+ *    this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ * THIS HEADER MAY NOT BE EXTRACTED OR MODIFIED IN ANY WAY.
+ */
+
+#ifndef __UK_ISR_STRING_H__
+#define __UK_ISR_STRING_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define __NEED_size_t
+
+#include <isrlib-internal/shareddefs.h>
+
+void *memcpy_isr(void *dst, const void *src, size_t len);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __STRING_H__ */
diff --git a/lib/irslib/Config.uk b/lib/irslib/Config.uk
new file mode 100644
index 0000000..88ff441
--- /dev/null
+++ b/lib/irslib/Config.uk
@@ -0,0 +1,7 @@
+menuconfig LIBISRLIB
+    bool "isr helper library"
+    default n
+
+if LIBISRLIB
+
+endif
diff --git a/lib/irslib/Makefile.uk b/lib/irslib/Makefile.uk
new file mode 100644
index 0000000..fe2461e
--- /dev/null
+++ b/lib/irslib/Makefile.uk
@@ -0,0 +1,6 @@
+$(eval $(call addlib_s,libisrlib,$(CONFIG_LIBISRLIB)))
+
+CINCLUDES-$(CONFIG_LIBISRLIB)   += -I$(LIBISRLIB_BASE)/include
+CXXINCLUDES-$(CONFIG_LIBISRLIB)   += -I$(LIBISRLIB_BASE)/include
+
+LIBISRLIB_SRCS-y += $(LIBISRLIB_BASE)/string.c|isr
diff --git a/lib/irslib/include/isrlib-internal/shareddefs.h b/lib/irslib/include/isrlib-internal/shareddefs.h
new file mode 100644
index 0000000..d386820
--- /dev/null
+++ b/lib/irslib/include/isrlib-internal/shareddefs.h
@@ -0,0 +1,146 @@
+/* SPDX-License-Identifier: BSD-3-Clause */
+/*
+ * Authors: Florian Schmidt <florian.schmidt@neclab.eu>
+ *
+ * Copyright (c) 2018, NEC Labs Europe, NEC Corporation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the copyright holder nor the names of its
+ *    contributors may be used to endorse or promote products derived from
+ *    this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ * THIS HEADER MAY NOT BE EXTRACTED OR MODIFIED IN ANY WAY.
+ */
+
+/* This header does by design not have include guards, so that it can be
+ * included from multiple files. The __NEED_x macros instead make sure that
+ * only those definitions are included that are required by that specific
+ * file, and only if they haven't been defined on a previous pass through
+ * this file.
+ */
+
+#include <uk/config.h>
+#include <uk/arch/types.h>
+
+#if (defined __NEED_NULL && !defined __DEFINED_NULL)
+#ifdef __cplusplus
+#define NULL 0L
+#else
+#define NULL ((void *) 0)
+#endif
+#define __DEFINED__NULL
+#endif
+
+#if (defined __NEED_size_t && !defined __DEFINED_size_t)
+typedef __sz size_t;
+#define __DEFINED_size_t
+#endif
+
+#if (defined __NEED_ssize_t && !defined __DEFINED_ssize_t)
+typedef __ssz ssize_t;
+#define __DEFINED_ssize_t
+#endif
+
+#if (defined __NEED_off_t && !defined __DEFINED_off_t)
+typedef __off off_t;
+#define __DEFINED_off_t
+#endif
+
+#if CONFIG_HAVE_TIME
+#include <uk/time_types.h>
+#endif
+
+#if (defined __NEED_mode_t && !defined __DEFINED_mode_t)
+typedef unsigned mode_t;
+#define __DEFINED_mode_t
+#endif
+
+#if defined(__NEED_uid_t) && !defined(__DEFINED_uid_t)
+typedef unsigned uid_t;
+#define __DEFINED_uid_t
+#endif
+
+#if defined(__NEED_gid_t) && !defined(__DEFINED_gid_t)
+typedef unsigned gid_t;
+#define __DEFINED_gid_t
+#endif
+
+#if defined(__NEED_useconds_t) && !defined(__DEFINED_useconds_t)
+typedef unsigned useconds_t;
+#define __DEFINED_useconds_t
+#endif
+
+#if defined(__NEED_pid_t) && !defined(__DEFINED_pid_t)
+typedef int pid_t;
+#define __DEFINED_pid_t
+#endif
+
+#if defined(__NEED_id_t) && !defined(__DEFINED_id_t)
+typedef unsigned id_t;
+#define __DEFINED_id_t
+#endif
+
+#if defined(__NEED_dev_t) && !defined(__DEFINED_dev_t)
+typedef __u64 dev_t;
+#define __DEFINED_dev_t
+#endif
+
+#if defined(__NEED_ino_t) && !defined(__DEFINED_ino_t)
+typedef __u64 ino_t;
+#define __DEFINED_ino_t
+#endif
+
+#if defined(__NEED_nlink_t) && !defined(__DEFINED_nlink_t)
+typedef __u32 nlink_t;
+#define __DEFINED_nlink_t
+#endif
+
+#if defined(__NEED_blkcnt_t) && !defined(__DEFINED_blkcnt_t)
+typedef __s64 blkcnt_t;
+#define __DEFINED_blkcnt_t
+#endif
+
+#if defined(__NEED_blksize_t) && !defined(__DEFINED_blksize_t)
+typedef long blksize_t;
+#define __DEFINED_blksize_t
+#endif
+
+#if defined(__NEED_locale_t) && !defined(__DEFINED_locale_t)
+typedef struct __locale_struct *locale_t;
+#define __DEFINED_locale_t
+#endif
+
+#if defined(__NEED_struct_iovec) && !defined(__DEFINED_struct_iovec)
+struct iovec { void *iov_base; size_t iov_len; };
+#define __DEFINED_struct_iovec
+#endif
+
+#if defined(__NEED_fsblkcnt_t) && !defined(__DEFINED_fsblkcnt_t)
+typedef unsigned long long fsblkcnt_t;
+#define __DEFINED_fsblkcnt_t
+#endif
+
+#if defined(__NEED_fsfilcnt_t) && !defined(__DEFINED_fsfilcnt_t)
+typedef unsigned long long fsfilcnt_t;
+#define __DEFINED_fsfilcnt_t
+#endif
diff --git a/lib/irslib/string.c b/lib/irslib/string.c
new file mode 100644
index 0000000..e14e187
--- /dev/null
+++ b/lib/irslib/string.c
@@ -0,0 +1,11 @@
+#include <uk/isr/string.h>
+
+void *memcpy_isr(void *dst, const void *src, size_t len)
+{
+	size_t p;
+
+	for (p = 0; p < len; ++p)
+		*((__u8 *)(((__uptr)dst) + p)) = *((__u8 *)(((__uptr)src) + p));
+
+	return dst;
+}
-- 
2.25.1



From minios-devel-bounces@lists.xenproject.org Wed Aug 12 12:04:56 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Wed, 12 Aug 2020 12:04:56 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1k5pUy-0003FP-I7; Wed, 12 Aug 2020 12:04:52 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=SByz=BW=neclab.eu=sharan.santhanam@srs-us1.protection.inumbo.net>)
 id 1k5pUx-0003FK-G5
 for minios-devel@lists.xenproject.org; Wed, 12 Aug 2020 12:04:51 +0000
X-Inumbo-ID: d0aae6e5-9ee5-4a4b-a02f-68aee9789ebd
Received: from mailer1.neclab.eu (unknown [195.37.70.40])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id d0aae6e5-9ee5-4a4b-a02f-68aee9789ebd;
 Wed, 12 Aug 2020 12:04:49 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
 by mailer1.neclab.eu (Postfix) with ESMTP id 97C54103F8A;
 Wed, 12 Aug 2020 14:04:47 +0200 (CEST)
X-Virus-Scanned: Amavisd on Debian GNU/Linux (atlas-a.office.hd)
Received: from mailer1.neclab.eu ([127.0.0.1])
 by localhost (atlas-a.office.hd [127.0.0.1]) (amavisd-new, port 10024)
 with ESMTP id DuIAha7mRNNC; Wed, 12 Aug 2020 14:04:47 +0200 (CEST)
X-ENC: Last-Hop-TLS-encrypted
X-ENC: Last-Hop-TLS-encrypted
Received: from puck.office.hd (puck.office.hd [192.168.24.91])
 (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
 (No client certificate requested)
 by mailer1.neclab.eu (Postfix) with ESMTPS id 71245103B1F;
 Wed, 12 Aug 2020 14:04:47 +0200 (CEST)
Received: from [10.7.1.9] (192.168.24.96) by puck.office.hd (192.168.24.91)
 with Microsoft SMTP Server (version=TLS1_2,
 cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1979.3; Wed, 12 Aug
 2020 14:04:46 +0200
Subject: Re: [Minios-devel] [UNIKRAFT PATCH v3 02/12] lib/uknetdev: Add
 alignment size for packet buffers allocations
To: Costin Lupu <costin.lupu@cs.pub.ro>, <minios-devel@lists.xenproject.org>
References: <20200303141344.16002-1-costin.lupu@cs.pub.ro>
 <20200303141344.16002-3-costin.lupu@cs.pub.ro>
 <6894a296-d0e9-7f27-ae4b-94984bd15180@neclab.eu>
 <8cb1a39b-2002-7f82-31c3-ad35ae856617@cs.pub.ro>
From: Sharan Santhanam <sharan.santhanam@neclab.eu>
Message-ID: <c7054e51-c649-d909-6dde-ce419f6da64b@neclab.eu>
Date: Wed, 12 Aug 2020 14:04:45 +0200
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101
 Thunderbird/68.10.0
MIME-Version: 1.0
In-Reply-To: <8cb1a39b-2002-7f82-31c3-ad35ae856617@cs.pub.ro>
Content-Type: text/plain; charset="utf-8"; format=flowed
Content-Transfer-Encoding: 8bit
Content-Language: en-US
X-Originating-IP: [192.168.24.96]
X-ClientProxiedBy: titania.office.hd (192.168.24.89) To puck.office.hd
 (192.168.24.91)
X-BeenThere: minios-devel@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Mini-os development list <minios-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:minios-devel@lists.xenproject.org>
List-Help: <mailto:minios-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: minios-devel-bounces@lists.xenproject.org
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>

Hello Costin,

On 8/11/20 12:40 PM, Costin Lupu wrote:
> Hi Sharan,
>
> Please see inline.
>
> On 8/11/20 11:40 AM, Sharan Santhanam wrote:
>> Hello Costin,
>>
>> Thank you for the work. Please find the comments inline.
>>
>> Thanks & Regards
>> Sharan
>>
>> On 3/3/20 3:13 PM, Costin Lupu wrote:
>>> Packet buffers may need different alignments, depending on their driver
>>> requirements. For Xen netfront driver, packet buffers have to be page
>>> aligned
>>> because they are saved in pages shared between backend and frontend.
>>> For KVM
>>> virtio net driver, word size alignments suffice. Therefore, we need to
>>> save the
>>> alignment size in order to support multiple drivers.
>>>
>>> This patch also squeezes a small fix for setting the max_mtu when
>>> retrieving
>>> device information from the virtio net driver.
>>>
>>> Signed-off-by: Costin Lupu <costin.lupu@cs.pub.ro>
>>> ---
>>>  Â  lib/uknetdev/include/uk/netdev_core.h | 1 +
>>>  Â  plat/drivers/virtio/virtio_net.cÂ Â Â Â Â  | 2 ++
>>>  Â  2 files changed, 3 insertions(+)
>>>
>>> diff --git a/lib/uknetdev/include/uk/netdev_core.h
>>> b/lib/uknetdev/include/uk/netdev_core.h
>>> index f073e101..268d54d7 100644
>>> --- a/lib/uknetdev/include/uk/netdev_core.h
>>> +++ b/lib/uknetdev/include/uk/netdev_core.h
>>> @@ -94,6 +94,7 @@ struct uk_netdev_info {
>>>  Â Â Â Â Â  uint16_t max_mtu;Â Â  /**< Maximum supported MTU size. */
>>>  Â Â Â Â Â  uint16_t nb_encap_tx;Â  /**< Number of bytes required as headroom
>>> for tx. */
>>>  Â Â Â Â Â  uint16_t nb_encap_rx;Â  /**< Number of bytes required as headroom
>>> for rx. */
>>> +Â Â Â  uint16_t align;Â  /**< Alignment required for data address. */
>> Why do we need to introduce yet another align field. Each of the tx
>> queue and rx queue has a `uk_netdev_queue_info` which have the align
>> fields. Since packet buffers are more tied to the rxq and txq why dont
>> we use those align field.
> Indeed, I overlooked the nb_align field from the queue info. However, it
> isn't initialized or used anywhere in the code. Besides this, isn't
> alignment a property of the device rather than the queue? Are there
> network devices with different alignments for their queues? Maybe we
> should drop the field from the queue and use the one from device info
> instead.
>
> I needed the alignment for allocating buffers in lwip (please see
> function `netbuf_alloc_helper_init()` in lwip glue code). All the
> information needed for allocating buffers seems to be device specific,
> not queue specific. If we had used the nb_field of queues then we would
> have a buffer allocation helper for each queue.

The alignment property wasn't used so far because we did not have 
alignment requirement for the other driver. Virtio had requirement on 
the number of descriptors should be a power of two and i guess that 
would be set in the virtio drivers.

 Â I see your point on the necessity to have a uniform queue information 
for all the rx/tx queues of a netdevice. But we could get around the 
problem, by getting the queue info for a one queue setting it all the 
different instance of rx and tx queue while still maintaining the 
configuration granularity of a queue. The other option might be to move 
the `uk_netdev_queue_info` as a struct into the `netdev_info` with 2 
different fields as `rxq_info` and `txq_info` and fetch the information 
only once when configuring the respective queue. This also leads to the 
question on where we should use the tx_headroom and rx_headroom be 
defined. Since the scope of the patch series changes, we can split it as 
a separate patch series. For the current problem, I would use the 
`nb_align` field from `uk_netdev_queue_info` since the queue properties 
would remain either ways.

In the netdev API, both the rx_one and tx_one operation happens at the 
queue level and not on a device level since we select the queue on which 
send/receive the packet from the netdevice. The netdev API have taken 
the multiqueue in account. The receive part on LWIP happens also at the 
queue level as all the callback are set for a queue configuration, while 
the tx part is still the one were netdevice where we don't use the queue 
information yet.

`netbuf_alloc_helper_init` does not have any dependency to a netdevice 
except we pass the netdev_info to it and collapse the netdev_info to a 
flat structure for that interface which is a valid method for lwip to 
handle its memory allocation. A suggestion might be fetch the device and 
queue information as a part of the `netbuf_alloc_helper_init`. But the 
needs of LWIP may not cause a change to netdev as it is a specific use 
case. The other use case of running DPDK on Unikraft does not have these 
requirements. I would keep the netdev API flexible enough and handle the 
specific use case at a higher level than netdev.


Thanks & Regards

Sharan

>>>  Â  };
>>>  Â  Â  /**
>>> diff --git a/plat/drivers/virtio/virtio_net.c
>>> b/plat/drivers/virtio/virtio_net.c
>>> index efc2cb71..9f1873c5 100644
>>> --- a/plat/drivers/virtio/virtio_net.c
>>> +++ b/plat/drivers/virtio/virtio_net.c
>>> @@ -1048,8 +1048,10 @@ static void virtio_net_info_get(struct
>>> uk_netdev *dev,
>>>  Â  Â Â Â Â Â  dev_info->max_rx_queues = vndev->max_vqueue_pairs;
>>>  Â Â Â Â Â  dev_info->max_tx_queues = vndev->max_vqueue_pairs;
>>> +Â Â Â  dev_info->max_mtu = vndev->max_mtu;
>>>  Â Â Â Â Â  dev_info->nb_encap_tx = sizeof(struct virtio_net_hdr_padded);
>>>  Â Â Â Â Â  dev_info->nb_encap_rx = sizeof(struct virtio_net_hdr_padded);
>>> +Â Â Â  dev_info->align = sizeof(void *); /* word size alignment */
>>>  Â  }
>>>  Â  Â  static int virtio_net_start(struct uk_netdev *n)


From minios-devel-bounces@lists.xenproject.org Wed Aug 12 12:34:45 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Wed, 12 Aug 2020 12:34:45 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1k5pxr-0005gt-PY; Wed, 12 Aug 2020 12:34:43 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=VSCm=BW=cs.pub.ro=costin.lupu@srs-us1.protection.inumbo.net>)
 id 1k5pxq-0005gN-OI
 for minios-devel@lists.xenproject.org; Wed, 12 Aug 2020 12:34:42 +0000
X-Inumbo-ID: 0f750cc7-9334-4640-a0e5-940f4f661fa0
Received: from mx.upb.ro (unknown [141.85.13.220])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 0f750cc7-9334-4640-a0e5-940f4f661fa0;
 Wed, 12 Aug 2020 12:34:40 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
 by mx.upb.ro (Postfix) with ESMTP id C34A4B5617CC;
 Wed, 12 Aug 2020 15:34:38 +0300 (EEST)
Received: from mx.upb.ro ([127.0.0.1])
 by localhost (mx.upb.ro [127.0.0.1]) (amavisd-new, port 10032)
 with ESMTP id jFMYxDQqTAr4; Wed, 12 Aug 2020 15:34:36 +0300 (EEST)
Received: from localhost (localhost [127.0.0.1])
 by mx.upb.ro (Postfix) with ESMTP id 15C82B561CCE;
 Wed, 12 Aug 2020 15:34:36 +0300 (EEST)
X-Virus-Scanned: amavisd-new at upb.ro
Received: from mx.upb.ro ([127.0.0.1])
 by localhost (mx.upb.ro [127.0.0.1]) (amavisd-new, port 10026)
 with ESMTP id 0m2-8t63I8CF; Wed, 12 Aug 2020 15:34:35 +0300 (EEST)
Received: from [192.168.1.35] (unknown [188.25.162.205])
 by mx.upb.ro (Postfix) with ESMTPSA id D6881B5617CC;
 Wed, 12 Aug 2020 15:34:35 +0300 (EEST)
Subject: Re: [Minios-devel] [UNIKRAFT PATCH v3 02/12] lib/uknetdev: Add
 alignment size for packet buffers allocations
To: Sharan Santhanam <sharan.santhanam@neclab.eu>,
 minios-devel@lists.xenproject.org
References: <20200303141344.16002-1-costin.lupu@cs.pub.ro>
 <20200303141344.16002-3-costin.lupu@cs.pub.ro>
 <6894a296-d0e9-7f27-ae4b-94984bd15180@neclab.eu>
 <8cb1a39b-2002-7f82-31c3-ad35ae856617@cs.pub.ro>
 <c7054e51-c649-d909-6dde-ce419f6da64b@neclab.eu>
From: Costin Lupu <costin.lupu@cs.pub.ro>
Message-ID: <e653fe96-842a-a157-fe16-ba0f2dd7f00b@cs.pub.ro>
Date: Wed, 12 Aug 2020 15:34:35 +0300
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101
 Thunderbird/68.11.0
MIME-Version: 1.0
In-Reply-To: <c7054e51-c649-d909-6dde-ce419f6da64b@neclab.eu>
Content-Type: text/plain; charset=utf-8
Content-Language: en-US
Content-Transfer-Encoding: quoted-printable
X-BeenThere: minios-devel@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Mini-os development list <minios-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:minios-devel@lists.xenproject.org>
List-Help: <mailto:minios-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: minios-devel-bounces@lists.xenproject.org
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>

Hi Sharan,

Please see inline.

On 8/12/20 3:04 PM, Sharan Santhanam wrote:
> Hello Costin,
>=20
> On 8/11/20 12:40 PM, Costin Lupu wrote:
>> Hi Sharan,
>>
>> Please see inline.
>>
>> On 8/11/20 11:40 AM, Sharan Santhanam wrote:
>>> Hello Costin,
>>>
>>> Thank you for the work. Please find the comments inline.
>>>
>>> Thanks & Regards
>>> Sharan
>>>
>>> On 3/3/20 3:13 PM, Costin Lupu wrote:
>>>> Packet buffers may need different alignments, depending on their dri=
ver
>>>> requirements. For Xen netfront driver, packet buffers have to be pag=
e
>>>> aligned
>>>> because they are saved in pages shared between backend and frontend.
>>>> For KVM
>>>> virtio net driver, word size alignments suffice. Therefore, we need =
to
>>>> save the
>>>> alignment size in order to support multiple drivers.
>>>>
>>>> This patch also squeezes a small fix for setting the max_mtu when
>>>> retrieving
>>>> device information from the virtio net driver.
>>>>
>>>> Signed-off-by: Costin Lupu <costin.lupu@cs.pub.ro>
>>>> ---
>>>> =C2=A0=C2=A0 lib/uknetdev/include/uk/netdev_core.h | 1 +
>>>> =C2=A0=C2=A0 plat/drivers/virtio/virtio_net.c=C2=A0=C2=A0=C2=A0=C2=A0=
=C2=A0 | 2 ++
>>>> =C2=A0=C2=A0 2 files changed, 3 insertions(+)
>>>>
>>>> diff --git a/lib/uknetdev/include/uk/netdev_core.h
>>>> b/lib/uknetdev/include/uk/netdev_core.h
>>>> index f073e101..268d54d7 100644
>>>> --- a/lib/uknetdev/include/uk/netdev_core.h
>>>> +++ b/lib/uknetdev/include/uk/netdev_core.h
>>>> @@ -94,6 +94,7 @@ struct uk_netdev_info {
>>>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 uint16_t max_mtu;=C2=A0=C2=A0 /=
**< Maximum supported MTU size. */
>>>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 uint16_t nb_encap_tx;=C2=A0 /**=
< Number of bytes required as headroom
>>>> for tx. */
>>>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 uint16_t nb_encap_rx;=C2=A0 /**=
< Number of bytes required as headroom
>>>> for rx. */
>>>> +=C2=A0=C2=A0=C2=A0 uint16_t align;=C2=A0 /**< Alignment required fo=
r data address. */
>>> Why do we need to introduce yet another align field. Each of the tx
>>> queue and rx queue has a `uk_netdev_queue_info` which have the align
>>> fields. Since packet buffers are more tied to the rxq and txq why don=
t
>>> we use those align field.
>> Indeed, I overlooked the nb_align field from the queue info. However, =
it
>> isn't initialized or used anywhere in the code. Besides this, isn't
>> alignment a property of the device rather than the queue? Are there
>> network devices with different alignments for their queues? Maybe we
>> should drop the field from the queue and use the one from device info
>> instead.
>>
>> I needed the alignment for allocating buffers in lwip (please see
>> function `netbuf_alloc_helper_init()` in lwip glue code). All the
>> information needed for allocating buffers seems to be device specific,
>> not queue specific. If we had used the nb_field of queues then we woul=
d
>> have a buffer allocation helper for each queue.
>=20
> The alignment property wasn't used so far because we did not have
> alignment requirement for the other driver. Virtio had requirement on
> the number of descriptors should be a power of two and i guess that
> would be set in the virtio drivers.
>=20
> =C2=A0I see your point on the necessity to have a uniform queue informa=
tion
> for all the rx/tx queues of a netdevice. But we could get around the
> problem, by getting the queue info for a one queue setting it all the
> different instance of rx and tx queue while still maintaining the
> configuration granularity of a queue.=20

Ok, so let me see if I got this right. Are you saying that I should get
the nb_align values only for the first rx queue and the first tx queue
and that would be enough?

> The other option might be to move the `uk_netdev_queue_info` as a
> struct into the `netdev_info` with 2 different fields as `rxq_info`
> and `txq_info` and fetch the information only once when configuring
> the respective queue. This also leads to the question on where we
> should use the tx_headroom and rx_headroom be defined. Since the
> scope of the patch series changes, we can split it as a separate
> patch series. For the current problem, I would use the `nb_align`
> field from `uk_netdev_queue_info` since the queue properties would
> remain either ways.
>=20
> In the netdev API, both the rx_one and tx_one operation happens at the
> queue level and not on a device level since we select the queue on whic=
h
> send/receive the packet from the netdevice. The netdev API have taken
> the multiqueue in account. The receive part on LWIP happens also at the
> queue level as all the callback are set for a queue configuration, whil=
e
> the tx part is still the one were netdevice where we don't use the queu=
e
> information yet.
>=20
> `netbuf_alloc_helper_init` does not have any dependency to a netdevice
> except we pass the netdev_info to it and collapse the netdev_info to a
> flat structure for that interface which is a valid method for lwip to
> handle its memory allocation. A suggestion might be fetch the device an=
d
> queue information as a part of the `netbuf_alloc_helper_init`. But the
> needs of LWIP may not cause a change to netdev as it is a specific use
> case. The other use case of running DPDK on Unikraft does not have thes=
e
> requirements. I would keep the netdev API flexible enough and handle th=
e
> specific use case at a higher level than netdev.
>=20
>=20
> Thanks & Regards
>=20
> Sharan
>=20
>>>> =C2=A0=C2=A0 };
>>>> =C2=A0=C2=A0 =C2=A0 /**
>>>> diff --git a/plat/drivers/virtio/virtio_net.c
>>>> b/plat/drivers/virtio/virtio_net.c
>>>> index efc2cb71..9f1873c5 100644
>>>> --- a/plat/drivers/virtio/virtio_net.c
>>>> +++ b/plat/drivers/virtio/virtio_net.c
>>>> @@ -1048,8 +1048,10 @@ static void virtio_net_info_get(struct
>>>> uk_netdev *dev,
>>>> =C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 dev_info->max_rx_queues =
=3D vndev->max_vqueue_pairs;
>>>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 dev_info->max_tx_queues =3D vnd=
ev->max_vqueue_pairs;
>>>> +=C2=A0=C2=A0=C2=A0 dev_info->max_mtu =3D vndev->max_mtu;
>>>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 dev_info->nb_encap_tx =3D sizeo=
f(struct virtio_net_hdr_padded);
>>>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 dev_info->nb_encap_rx =3D sizeo=
f(struct virtio_net_hdr_padded);
>>>> +=C2=A0=C2=A0=C2=A0 dev_info->align =3D sizeof(void *); /* word size=
 alignment */
>>>> =C2=A0=C2=A0 }
>>>> =C2=A0=C2=A0 =C2=A0 static int virtio_net_start(struct uk_netdev *n)
>=20


From minios-devel-bounces@lists.xenproject.org Wed Aug 12 13:20:10 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Wed, 12 Aug 2020 13:20:10 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1k5qfn-000249-Ji; Wed, 12 Aug 2020 13:20:07 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=SByz=BW=neclab.eu=sharan.santhanam@srs-us1.protection.inumbo.net>)
 id 1k5qfm-00020Q-2h
 for minios-devel@lists.xenproject.org; Wed, 12 Aug 2020 13:20:06 +0000
X-Inumbo-ID: 901a7c14-72eb-4f49-92f0-edca670963bc
Received: from mailer2.neclab.eu (unknown [195.37.70.41])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 901a7c14-72eb-4f49-92f0-edca670963bc;
 Wed, 12 Aug 2020 13:20:03 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
 by mailer2.neclab.eu (Postfix) with ESMTP id 86922F202B;
 Wed, 12 Aug 2020 15:20:02 +0200 (CEST)
X-Virus-Scanned: Amavisd on Debian GNU/Linux (atlas-b.office.hd)
Received: from mailer2.neclab.eu ([127.0.0.1])
 by localhost (atlas-b.office.hd [127.0.0.1]) (amavisd-new, port 10024)
 with ESMTP id YQPOS_cZMNdk; Wed, 12 Aug 2020 15:20:02 +0200 (CEST)
X-ENC: Last-Hop-TLS-encrypted
X-ENC: Last-Hop-TLS-encrypted
Received: from puck.office.hd (puck.office.hd [192.168.24.91])
 (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
 (No client certificate requested)
 by mailer2.neclab.eu (Postfix) with ESMTPS id 4BA1AF2008;
 Wed, 12 Aug 2020 15:19:58 +0200 (CEST)
Received: from [10.7.1.9] (192.168.24.96) by puck.office.hd (192.168.24.91)
 with Microsoft SMTP Server (version=TLS1_2,
 cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1979.3; Wed, 12 Aug
 2020 15:19:57 +0200
Subject: Re: [Minios-devel] [UNIKRAFT PATCH v3 02/12] lib/uknetdev: Add
 alignment size for packet buffers allocations
To: Costin Lupu <costin.lupu@cs.pub.ro>, <minios-devel@lists.xenproject.org>
References: <20200303141344.16002-1-costin.lupu@cs.pub.ro>
 <20200303141344.16002-3-costin.lupu@cs.pub.ro>
 <6894a296-d0e9-7f27-ae4b-94984bd15180@neclab.eu>
 <8cb1a39b-2002-7f82-31c3-ad35ae856617@cs.pub.ro>
 <c7054e51-c649-d909-6dde-ce419f6da64b@neclab.eu>
 <e653fe96-842a-a157-fe16-ba0f2dd7f00b@cs.pub.ro>
From: Sharan Santhanam <sharan.santhanam@neclab.eu>
Message-ID: <f5b1a893-d0a0-1717-812c-9771e40e3f15@neclab.eu>
Date: Wed, 12 Aug 2020 15:19:56 +0200
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101
 Thunderbird/68.10.0
MIME-Version: 1.0
In-Reply-To: <e653fe96-842a-a157-fe16-ba0f2dd7f00b@cs.pub.ro>
Content-Type: text/plain; charset="utf-8"; format=flowed
Content-Transfer-Encoding: 8bit
Content-Language: en-US
X-Originating-IP: [192.168.24.96]
X-ClientProxiedBy: puck.office.hd (192.168.24.91) To puck.office.hd
 (192.168.24.91)
X-BeenThere: minios-devel@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Mini-os development list <minios-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:minios-devel@lists.xenproject.org>
List-Help: <mailto:minios-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: minios-devel-bounces@lists.xenproject.org
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>


On 8/12/20 2:34 PM, Costin Lupu wrote:
> Hi Sharan,
>
> Please see inline.
>
> On 8/12/20 3:04 PM, Sharan Santhanam wrote:
>> Hello Costin,
>>
>> On 8/11/20 12:40 PM, Costin Lupu wrote:
>>> Hi Sharan,
>>>
>>> Please see inline.
>>>
>>> On 8/11/20 11:40 AM, Sharan Santhanam wrote:
>>>> Hello Costin,
>>>>
>>>> Thank you for the work. Please find the comments inline.
>>>>
>>>> Thanks & Regards
>>>> Sharan
>>>>
>>>> On 3/3/20 3:13 PM, Costin Lupu wrote:
>>>>> Packet buffers may need different alignments, depending on their driver
>>>>> requirements. For Xen netfront driver, packet buffers have to be page
>>>>> aligned
>>>>> because they are saved in pages shared between backend and frontend.
>>>>> For KVM
>>>>> virtio net driver, word size alignments suffice. Therefore, we need to
>>>>> save the
>>>>> alignment size in order to support multiple drivers.
>>>>>
>>>>> This patch also squeezes a small fix for setting the max_mtu when
>>>>> retrieving
>>>>> device information from the virtio net driver.
>>>>>
>>>>> Signed-off-by: Costin Lupu <costin.lupu@cs.pub.ro>
>>>>> ---
>>>>>  Â Â  lib/uknetdev/include/uk/netdev_core.h | 1 +
>>>>>  Â Â  plat/drivers/virtio/virtio_net.cÂ Â Â Â Â  | 2 ++
>>>>>  Â Â  2 files changed, 3 insertions(+)
>>>>>
>>>>> diff --git a/lib/uknetdev/include/uk/netdev_core.h
>>>>> b/lib/uknetdev/include/uk/netdev_core.h
>>>>> index f073e101..268d54d7 100644
>>>>> --- a/lib/uknetdev/include/uk/netdev_core.h
>>>>> +++ b/lib/uknetdev/include/uk/netdev_core.h
>>>>> @@ -94,6 +94,7 @@ struct uk_netdev_info {
>>>>>  Â Â Â Â Â Â  uint16_t max_mtu;Â Â  /**< Maximum supported MTU size. */
>>>>>  Â Â Â Â Â Â  uint16_t nb_encap_tx;Â  /**< Number of bytes required as headroom
>>>>> for tx. */
>>>>>  Â Â Â Â Â Â  uint16_t nb_encap_rx;Â  /**< Number of bytes required as headroom
>>>>> for rx. */
>>>>> +Â Â Â  uint16_t align;Â  /**< Alignment required for data address. */
>>>> Why do we need to introduce yet another align field. Each of the tx
>>>> queue and rx queue has a `uk_netdev_queue_info` which have the align
>>>> fields. Since packet buffers are more tied to the rxq and txq why dont
>>>> we use those align field.
>>> Indeed, I overlooked the nb_align field from the queue info. However, it
>>> isn't initialized or used anywhere in the code. Besides this, isn't
>>> alignment a property of the device rather than the queue? Are there
>>> network devices with different alignments for their queues? Maybe we
>>> should drop the field from the queue and use the one from device info
>>> instead.
>>>
>>> I needed the alignment for allocating buffers in lwip (please see
>>> function `netbuf_alloc_helper_init()` in lwip glue code). All the
>>> information needed for allocating buffers seems to be device specific,
>>> not queue specific. If we had used the nb_field of queues then we would
>>> have a buffer allocation helper for each queue.
>> The alignment property wasn't used so far because we did not have
>> alignment requirement for the other driver. Virtio had requirement on
>> the number of descriptors should be a power of two and i guess that
>> would be set in the virtio drivers.
>>
>>  Â I see your point on the necessity to have a uniform queue information
>> for all the rx/tx queues of a netdevice. But we could get around the
>> problem, by getting the queue info for a one queue setting it all the
>> different instance of rx and tx queue while still maintaining the
>> configuration granularity of a queue.
> Ok, so let me see if I got this right. Are you saying that I should get
> the nb_align values only for the first rx queue and the first tx queue
> and that would be enough?

Yes in this case.


>
>> The other option might be to move the `uk_netdev_queue_info` as a
>> struct into the `netdev_info` with 2 different fields as `rxq_info`
>> and `txq_info` and fetch the information only once when configuring
>> the respective queue. This also leads to the question on where we
>> should use the tx_headroom and rx_headroom be defined. Since the
>> scope of the patch series changes, we can split it as a separate
>> patch series. For the current problem, I would use the `nb_align`
>> field from `uk_netdev_queue_info` since the queue properties would
>> remain either ways.
>>
>> In the netdev API, both the rx_one and tx_one operation happens at the
>> queue level and not on a device level since we select the queue on which
>> send/receive the packet from the netdevice. The netdev API have taken
>> the multiqueue in account. The receive part on LWIP happens also at the
>> queue level as all the callback are set for a queue configuration, while
>> the tx part is still the one were netdevice where we don't use the queue
>> information yet.
>>
>> `netbuf_alloc_helper_init` does not have any dependency to a netdevice
>> except we pass the netdev_info to it and collapse the netdev_info to a
>> flat structure for that interface which is a valid method for lwip to
>> handle its memory allocation. A suggestion might be fetch the device and
>> queue information as a part of the `netbuf_alloc_helper_init`. But the
>> needs of LWIP may not cause a change to netdev as it is a specific use
>> case. The other use case of running DPDK on Unikraft does not have these
>> requirements. I would keep the netdev API flexible enough and handle the
>> specific use case at a higher level than netdev.
>>
>>
>> Thanks & Regards
>>
>> Sharan
>>
>>>>>  Â Â  };
>>>>>  Â Â  Â  /**
>>>>> diff --git a/plat/drivers/virtio/virtio_net.c
>>>>> b/plat/drivers/virtio/virtio_net.c
>>>>> index efc2cb71..9f1873c5 100644
>>>>> --- a/plat/drivers/virtio/virtio_net.c
>>>>> +++ b/plat/drivers/virtio/virtio_net.c
>>>>> @@ -1048,8 +1048,10 @@ static void virtio_net_info_get(struct
>>>>> uk_netdev *dev,
>>>>>  Â Â  Â Â Â Â Â  dev_info->max_rx_queues = vndev->max_vqueue_pairs;
>>>>>  Â Â Â Â Â Â  dev_info->max_tx_queues = vndev->max_vqueue_pairs;
>>>>> +Â Â Â  dev_info->max_mtu = vndev->max_mtu;
>>>>>  Â Â Â Â Â Â  dev_info->nb_encap_tx = sizeof(struct virtio_net_hdr_padded);
>>>>>  Â Â Â Â Â Â  dev_info->nb_encap_rx = sizeof(struct virtio_net_hdr_padded);
>>>>> +Â Â Â  dev_info->align = sizeof(void *); /* word size alignment */
>>>>>  Â Â  }
>>>>>  Â Â  Â  static int virtio_net_start(struct uk_netdev *n)


From minios-devel-bounces@lists.xenproject.org Wed Aug 12 13:48:04 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Wed, 12 Aug 2020 13:48:04 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1k5r6o-00045y-Go; Wed, 12 Aug 2020 13:48:02 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=VSCm=BW=cs.pub.ro=costin.lupu@srs-us1.protection.inumbo.net>)
 id 1k5r6n-00045n-L0
 for minios-devel@lists.xenproject.org; Wed, 12 Aug 2020 13:48:01 +0000
X-Inumbo-ID: 2f799eed-5c2f-4864-ab9a-a519bbe21faa
Received: from mx.upb.ro (unknown [141.85.13.210])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 2f799eed-5c2f-4864-ab9a-a519bbe21faa;
 Wed, 12 Aug 2020 13:47:59 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
 by mx.upb.ro (Postfix) with ESMTP id 0CCC0B5617CC;
 Wed, 12 Aug 2020 16:47:58 +0300 (EEST)
Received: from mx.upb.ro ([127.0.0.1])
 by localhost (mx.upb.ro [127.0.0.1]) (amavisd-new, port 10032)
 with ESMTP id KofPz_s5hqmT; Wed, 12 Aug 2020 16:47:54 +0300 (EEST)
Received: from localhost (localhost [127.0.0.1])
 by mx.upb.ro (Postfix) with ESMTP id 83A74B561CCA;
 Wed, 12 Aug 2020 16:47:54 +0300 (EEST)
X-Virus-Scanned: amavisd-new at upb.ro
Received: from mx.upb.ro ([127.0.0.1])
 by localhost (mx.upb.ro [127.0.0.1]) (amavisd-new, port 10026)
 with ESMTP id kdtveM58UP5q; Wed, 12 Aug 2020 16:47:54 +0300 (EEST)
Received: from [192.168.1.35] (unknown [188.25.162.205])
 by mx.upb.ro (Postfix) with ESMTPSA id 533C9B5617CC;
 Wed, 12 Aug 2020 16:47:54 +0300 (EEST)
Subject: Re: [Minios-devel] [UNIKRAFT PATCH v3 02/12] lib/uknetdev: Add
 alignment size for packet buffers allocations
To: Sharan Santhanam <sharan.santhanam@neclab.eu>,
 minios-devel@lists.xenproject.org
References: <20200303141344.16002-1-costin.lupu@cs.pub.ro>
 <20200303141344.16002-3-costin.lupu@cs.pub.ro>
 <6894a296-d0e9-7f27-ae4b-94984bd15180@neclab.eu>
 <8cb1a39b-2002-7f82-31c3-ad35ae856617@cs.pub.ro>
 <c7054e51-c649-d909-6dde-ce419f6da64b@neclab.eu>
 <e653fe96-842a-a157-fe16-ba0f2dd7f00b@cs.pub.ro>
 <f5b1a893-d0a0-1717-812c-9771e40e3f15@neclab.eu>
From: Costin Lupu <costin.lupu@cs.pub.ro>
Message-ID: <c00b2dfa-3788-c9b2-b46e-b9c9b1bc0982@cs.pub.ro>
Date: Wed, 12 Aug 2020 16:47:54 +0300
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101
 Thunderbird/68.11.0
MIME-Version: 1.0
In-Reply-To: <f5b1a893-d0a0-1717-812c-9771e40e3f15@neclab.eu>
Content-Type: text/plain; charset=utf-8
Content-Language: en-US
Content-Transfer-Encoding: quoted-printable
X-BeenThere: minios-devel@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Mini-os development list <minios-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:minios-devel@lists.xenproject.org>
List-Help: <mailto:minios-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: minios-devel-bounces@lists.xenproject.org
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>

On 8/12/20 4:19 PM, Sharan Santhanam wrote:
>=20
> On 8/12/20 2:34 PM, Costin Lupu wrote:
>> Hi Sharan,
>>
>> Please see inline.
>>
>> On 8/12/20 3:04 PM, Sharan Santhanam wrote:
>>> Hello Costin,
>>>
>>> On 8/11/20 12:40 PM, Costin Lupu wrote:
>>>> Hi Sharan,
>>>>
>>>> Please see inline.
>>>>
>>>> On 8/11/20 11:40 AM, Sharan Santhanam wrote:
>>>>> Hello Costin,
>>>>>
>>>>> Thank you for the work. Please find the comments inline.
>>>>>
>>>>> Thanks & Regards
>>>>> Sharan
>>>>>
>>>>> On 3/3/20 3:13 PM, Costin Lupu wrote:
>>>>>> Packet buffers may need different alignments, depending on their
>>>>>> driver
>>>>>> requirements. For Xen netfront driver, packet buffers have to be p=
age
>>>>>> aligned
>>>>>> because they are saved in pages shared between backend and fronten=
d.
>>>>>> For KVM
>>>>>> virtio net driver, word size alignments suffice. Therefore, we
>>>>>> need to
>>>>>> save the
>>>>>> alignment size in order to support multiple drivers.
>>>>>>
>>>>>> This patch also squeezes a small fix for setting the max_mtu when
>>>>>> retrieving
>>>>>> device information from the virtio net driver.
>>>>>>
>>>>>> Signed-off-by: Costin Lupu <costin.lupu@cs.pub.ro>
>>>>>> ---
>>>>>> =C2=A0=C2=A0=C2=A0 lib/uknetdev/include/uk/netdev_core.h | 1 +
>>>>>> =C2=A0=C2=A0=C2=A0 plat/drivers/virtio/virtio_net.c=C2=A0=C2=A0=C2=
=A0=C2=A0=C2=A0 | 2 ++
>>>>>> =C2=A0=C2=A0=C2=A0 2 files changed, 3 insertions(+)
>>>>>>
>>>>>> diff --git a/lib/uknetdev/include/uk/netdev_core.h
>>>>>> b/lib/uknetdev/include/uk/netdev_core.h
>>>>>> index f073e101..268d54d7 100644
>>>>>> --- a/lib/uknetdev/include/uk/netdev_core.h
>>>>>> +++ b/lib/uknetdev/include/uk/netdev_core.h
>>>>>> @@ -94,6 +94,7 @@ struct uk_netdev_info {
>>>>>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 uint16_t max_mtu;=C2=A0=
=C2=A0 /**< Maximum supported MTU size. */
>>>>>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 uint16_t nb_encap_tx;=C2=
=A0 /**< Number of bytes required as
>>>>>> headroom
>>>>>> for tx. */
>>>>>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 uint16_t nb_encap_rx;=C2=
=A0 /**< Number of bytes required as
>>>>>> headroom
>>>>>> for rx. */
>>>>>> +=C2=A0=C2=A0=C2=A0 uint16_t align;=C2=A0 /**< Alignment required =
for data address. */
>>>>> Why do we need to introduce yet another align field. Each of the tx
>>>>> queue and rx queue has a `uk_netdev_queue_info` which have the alig=
n
>>>>> fields. Since packet buffers are more tied to the rxq and txq why d=
ont
>>>>> we use those align field.
>>>> Indeed, I overlooked the nb_align field from the queue info.
>>>> However, it
>>>> isn't initialized or used anywhere in the code. Besides this, isn't
>>>> alignment a property of the device rather than the queue? Are there
>>>> network devices with different alignments for their queues? Maybe we
>>>> should drop the field from the queue and use the one from device inf=
o
>>>> instead.
>>>>
>>>> I needed the alignment for allocating buffers in lwip (please see
>>>> function `netbuf_alloc_helper_init()` in lwip glue code). All the
>>>> information needed for allocating buffers seems to be device specifi=
c,
>>>> not queue specific. If we had used the nb_field of queues then we wo=
uld
>>>> have a buffer allocation helper for each queue.
>>> The alignment property wasn't used so far because we did not have
>>> alignment requirement for the other driver. Virtio had requirement on
>>> the number of descriptors should be a power of two and i guess that
>>> would be set in the virtio drivers.
>>>
>>> =C2=A0=C2=A0I see your point on the necessity to have a uniform queue=
 information
>>> for all the rx/tx queues of a netdevice. But we could get around the
>>> problem, by getting the queue info for a one queue setting it all the
>>> different instance of rx and tx queue while still maintaining the
>>> configuration granularity of a queue.
>> Ok, so let me see if I got this right. Are you saying that I should ge=
t
>> the nb_align values only for the first rx queue and the first tx queue
>> and that would be enough?
>=20
> Yes in this case.
>=20

Alright then. I'll upstream the first patch and send a new one setting
the mtu and the nb_align for virtio. And I'll send a new version for lwip=
.

>=20
>>
>>> The other option might be to move the `uk_netdev_queue_info` as a
>>> struct into the `netdev_info` with 2 different fields as `rxq_info`
>>> and `txq_info` and fetch the information only once when configuring
>>> the respective queue. This also leads to the question on where we
>>> should use the tx_headroom and rx_headroom be defined. Since the
>>> scope of the patch series changes, we can split it as a separate
>>> patch series. For the current problem, I would use the `nb_align`
>>> field from `uk_netdev_queue_info` since the queue properties would
>>> remain either ways.
>>>
>>> In the netdev API, both the rx_one and tx_one operation happens at th=
e
>>> queue level and not on a device level since we select the queue on wh=
ich
>>> send/receive the packet from the netdevice. The netdev API have taken
>>> the multiqueue in account. The receive part on LWIP happens also at t=
he
>>> queue level as all the callback are set for a queue configuration, wh=
ile
>>> the tx part is still the one were netdevice where we don't use the qu=
eue
>>> information yet.
>>>
>>> `netbuf_alloc_helper_init` does not have any dependency to a netdevic=
e
>>> except we pass the netdev_info to it and collapse the netdev_info to =
a
>>> flat structure for that interface which is a valid method for lwip to
>>> handle its memory allocation. A suggestion might be fetch the device =
and
>>> queue information as a part of the `netbuf_alloc_helper_init`. But th=
e
>>> needs of LWIP may not cause a change to netdev as it is a specific us=
e
>>> case. The other use case of running DPDK on Unikraft does not have th=
ese
>>> requirements. I would keep the netdev API flexible enough and handle =
the
>>> specific use case at a higher level than netdev.
>>>
>>>
>>> Thanks & Regards
>>>
>>> Sharan
>>>
>>>>>> =C2=A0=C2=A0=C2=A0 };
>>>>>> =C2=A0=C2=A0=C2=A0 =C2=A0 /**
>>>>>> diff --git a/plat/drivers/virtio/virtio_net.c
>>>>>> b/plat/drivers/virtio/virtio_net.c
>>>>>> index efc2cb71..9f1873c5 100644
>>>>>> --- a/plat/drivers/virtio/virtio_net.c
>>>>>> +++ b/plat/drivers/virtio/virtio_net.c
>>>>>> @@ -1048,8 +1048,10 @@ static void virtio_net_info_get(struct
>>>>>> uk_netdev *dev,
>>>>>> =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 dev_info->max_rx=
_queues =3D vndev->max_vqueue_pairs;
>>>>>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 dev_info->max_tx_queues=
 =3D vndev->max_vqueue_pairs;
>>>>>> +=C2=A0=C2=A0=C2=A0 dev_info->max_mtu =3D vndev->max_mtu;
>>>>>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 dev_info->nb_encap_tx =3D=
 sizeof(struct virtio_net_hdr_padded);
>>>>>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 dev_info->nb_encap_rx =3D=
 sizeof(struct virtio_net_hdr_padded);
>>>>>> +=C2=A0=C2=A0=C2=A0 dev_info->align =3D sizeof(void *); /* word si=
ze alignment */
>>>>>> =C2=A0=C2=A0=C2=A0 }
>>>>>> =C2=A0=C2=A0=C2=A0 =C2=A0 static int virtio_net_start(struct uk_ne=
tdev *n)
>=20


From minios-devel-bounces@lists.xenproject.org Thu Aug 13 08:53:56 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Thu, 13 Aug 2020 08:53:56 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1k68zh-0001WB-Qg; Thu, 13 Aug 2020 08:53:53 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=QcnS=BX=cs.pub.ro=costin.lupu@srs-us1.protection.inumbo.net>)
 id 1k68zg-0001W0-Qa
 for minios-devel@lists.xen.org; Thu, 13 Aug 2020 08:53:52 +0000
X-Inumbo-ID: 3f30d939-9f5c-4b6c-a82b-06e61abed7b0
Received: from mx.upb.ro (unknown [141.85.13.210])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 3f30d939-9f5c-4b6c-a82b-06e61abed7b0;
 Thu, 13 Aug 2020 08:53:50 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
 by mx.upb.ro (Postfix) with ESMTP id 66688B561D4F;
 Thu, 13 Aug 2020 11:53:49 +0300 (EEST)
Received: from mx.upb.ro ([127.0.0.1])
 by localhost (mx.upb.ro [127.0.0.1]) (amavisd-new, port 10032)
 with ESMTP id pqyAlYIbo5dv; Thu, 13 Aug 2020 11:53:47 +0300 (EEST)
Received: from localhost (localhost [127.0.0.1])
 by mx.upb.ro (Postfix) with ESMTP id 6534DB561D1A;
 Thu, 13 Aug 2020 11:53:47 +0300 (EEST)
X-Virus-Scanned: amavisd-new at upb.ro
Received: from mx.upb.ro ([127.0.0.1])
 by localhost (mx.upb.ro [127.0.0.1]) (amavisd-new, port 10026)
 with ESMTP id pr4E4xn0dDT8; Thu, 13 Aug 2020 11:53:47 +0300 (EEST)
Received: from localhost.localdomain (unknown [188.25.162.205])
 by mx.upb.ro (Postfix) with ESMTPSA id 2D6CDB5617CC;
 Thu, 13 Aug 2020 11:53:47 +0300 (EEST)
From: Costin Lupu <costin.lupu@cs.pub.ro>
To: minios-devel@lists.xen.org
Cc: sharan.santhanam@neclab.eu
Subject: [UNIKRAFT PATCH v4 00/12] Introduce Xen Netfront driver 
Date: Thu, 13 Aug 2020 11:53:30 +0300
Message-Id: <20200813085342.29799-1-costin.lupu@cs.pub.ro>
X-Mailer: git-send-email 2.20.1
MIME-Version: 1.0
Content-Transfer-Encoding: quoted-printable
X-BeenThere: minios-devel@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Mini-os development list <minios-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:minios-devel@lists.xenproject.org>
List-Help: <mailto:minios-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: minios-devel-bounces@lists.xenproject.org
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>

The current changes are required for supporting netfront devices. They sh=
ould
be used together with the lwip patch series because they depend on each o=
ther.

These changes follow the same approach used for the design and implementa=
tion
of the virtio-net driver.

The first version of these patches was sent in 2018. Maybe the current ye=
ar is
a lucky one and we will achieve the performance to upstream these changes=
.

Changes since v1:
- Split into multiple patches
- Use the new uknetdev API

Changes since v2:
- Add more info to commit messages

Changes since v3:
- Use nb_align field for queue infos
- Add patch for enabling default drivers

Costin Lupu (12):
  plat/drivers/virtio: Fill MTU and queues alignments when retrieving
    information
  plat/xen: Add vif device type
  plat/xen/drivers: Add skeleton for netfront driver
  plat/xen/drivers/net: Configure netfront device
  plat/xen/drivers/net: Create netfront queues
  plat/xen/drivers/net: Configure netfront tx queue
  plat/xen/drivers/net: Configure netfront rx queue
  plat/xen/drivers/net: Enable/disable interrupts for rx queues
  plat/xen/drivers/net: Start netfront device
  plat/xen/drivers/net: Add transmit operation
  plat/xen/drivers/net: Add receive operation
  lib/uknetdev: Enable default drivers

 lib/uknetdev/Config.uk             |   2 +
 plat/drivers/virtio/virtio_net.c   |   3 +
 plat/xen/Config.uk                 |   7 +
 plat/xen/Makefile.uk               |  11 +
 plat/xen/drivers/net/exportsyms.uk |   1 +
 plat/xen/drivers/net/netfront.c    | 843 +++++++++++++++++++++++++++++
 plat/xen/drivers/net/netfront.h    | 145 +++++
 plat/xen/drivers/net/netfront_xb.h |  46 ++
 plat/xen/drivers/net/netfront_xs.c | 522 ++++++++++++++++++
 plat/xen/include/xenbus/xenbus.h   |   1 +
 plat/xen/xenbus/client.c           |   1 +
 11 files changed, 1582 insertions(+)
 create mode 100644 plat/xen/drivers/net/exportsyms.uk
 create mode 100644 plat/xen/drivers/net/netfront.c
 create mode 100644 plat/xen/drivers/net/netfront.h
 create mode 100644 plat/xen/drivers/net/netfront_xb.h
 create mode 100644 plat/xen/drivers/net/netfront_xs.c

--=20
2.20.1



From minios-devel-bounces@lists.xenproject.org Thu Aug 13 08:53:56 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Thu, 13 Aug 2020 08:53:56 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1k68zi-0001WI-S9; Thu, 13 Aug 2020 08:53:54 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=QcnS=BX=cs.pub.ro=costin.lupu@srs-us1.protection.inumbo.net>)
 id 1k68zh-0001W6-LF
 for minios-devel@lists.xen.org; Thu, 13 Aug 2020 08:53:53 +0000
X-Inumbo-ID: e6756125-8dd4-4c9d-9ad7-7546cc28cdac
Received: from mx.upb.ro (unknown [141.85.13.200])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id e6756125-8dd4-4c9d-9ad7-7546cc28cdac;
 Thu, 13 Aug 2020 08:53:51 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
 by mx.upb.ro (Postfix) with ESMTP id 3FA40B561D39;
 Thu, 13 Aug 2020 11:53:50 +0300 (EEST)
Received: from mx.upb.ro ([127.0.0.1])
 by localhost (mx.upb.ro [127.0.0.1]) (amavisd-new, port 10032)
 with ESMTP id SP6SaL_LFoe0; Thu, 13 Aug 2020 11:53:47 +0300 (EEST)
Received: from localhost (localhost [127.0.0.1])
 by mx.upb.ro (Postfix) with ESMTP id 8F0C8B5617CC;
 Thu, 13 Aug 2020 11:53:47 +0300 (EEST)
X-Virus-Scanned: amavisd-new at upb.ro
Received: from mx.upb.ro ([127.0.0.1])
 by localhost (mx.upb.ro [127.0.0.1]) (amavisd-new, port 10026)
 with ESMTP id MswO0rNw1_wR; Thu, 13 Aug 2020 11:53:47 +0300 (EEST)
Received: from localhost.localdomain (unknown [188.25.162.205])
 by mx.upb.ro (Postfix) with ESMTPSA id 62DAFB561CCA;
 Thu, 13 Aug 2020 11:53:47 +0300 (EEST)
From: Costin Lupu <costin.lupu@cs.pub.ro>
To: minios-devel@lists.xen.org
Cc: sharan.santhanam@neclab.eu
Subject: [UNIKRAFT PATCH v4 01/12] plat/drivers/virtio: Fill MTU and queues
 alignments when retrieving information
Date: Thu, 13 Aug 2020 11:53:31 +0300
Message-Id: <20200813085342.29799-2-costin.lupu@cs.pub.ro>
X-Mailer: git-send-email 2.20.1
In-Reply-To: <20200813085342.29799-1-costin.lupu@cs.pub.ro>
References: <20200813085342.29799-1-costin.lupu@cs.pub.ro>
MIME-Version: 1.0
Content-Transfer-Encoding: quoted-printable
X-BeenThere: minios-devel@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Mini-os development list <minios-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:minios-devel@lists.xenproject.org>
List-Help: <mailto:minios-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: minios-devel-bounces@lists.xenproject.org
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>

This patch sets the max MTU value when retrieving device information and =
the
alignments used when allocating packets for each queue.

Signed-off-by: Costin Lupu <costin.lupu@cs.pub.ro>
---
 plat/drivers/virtio/virtio_net.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/plat/drivers/virtio/virtio_net.c b/plat/drivers/virtio/virti=
o_net.c
index b0663e60..0e748b8f 100644
--- a/plat/drivers/virtio/virtio_net.c
+++ b/plat/drivers/virtio/virtio_net.c
@@ -770,6 +770,7 @@ static int virtio_netdev_rxq_info_get(struct uk_netde=
v *dev,
 	rxq =3D &vndev->rxqs[queue_id];
 	qinfo->nb_min =3D 1;
 	qinfo->nb_max =3D rxq->max_nb_desc;
+	qinfo->nb_align =3D sizeof(void *); /* word size alignment */
 	qinfo->nb_is_power_of_two =3D 1;
=20
 exit:
@@ -797,6 +798,7 @@ static int virtio_netdev_txq_info_get(struct uk_netde=
v *dev,
 	txq =3D &vndev->txqs[queue_id];
 	qinfo->nb_min =3D 1;
 	qinfo->nb_max =3D txq->max_nb_desc;
+	qinfo->nb_align =3D sizeof(void *); /* word size alignment */
 	qinfo->nb_is_power_of_two =3D 1;
=20
 exit:
@@ -1048,6 +1050,7 @@ static void virtio_net_info_get(struct uk_netdev *d=
ev,
=20
 	dev_info->max_rx_queues =3D vndev->max_vqueue_pairs;
 	dev_info->max_tx_queues =3D vndev->max_vqueue_pairs;
+	dev_info->max_mtu =3D vndev->max_mtu;
 	dev_info->nb_encap_tx =3D sizeof(struct virtio_net_hdr_padded);
 	dev_info->nb_encap_rx =3D sizeof(struct virtio_net_hdr_padded);
 	dev_info->features =3D UK_FEATURE_RXQ_INTR_AVAILABLE;
--=20
2.20.1



From minios-devel-bounces@lists.xenproject.org Thu Aug 13 08:53:58 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Thu, 13 Aug 2020 08:53:58 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1k68zm-0001X7-To; Thu, 13 Aug 2020 08:53:58 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=QcnS=BX=cs.pub.ro=costin.lupu@srs-us1.protection.inumbo.net>)
 id 1k68zl-0001W0-PT
 for minios-devel@lists.xen.org; Thu, 13 Aug 2020 08:53:57 +0000
X-Inumbo-ID: ac68bd5f-8484-4fd8-9073-07bc628b3173
Received: from mx.upb.ro (unknown [141.85.13.200])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id ac68bd5f-8484-4fd8-9073-07bc628b3173;
 Thu, 13 Aug 2020 08:53:51 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
 by mx.upb.ro (Postfix) with ESMTP id 5941FB561DB6;
 Thu, 13 Aug 2020 11:53:50 +0300 (EEST)
Received: from mx.upb.ro ([127.0.0.1])
 by localhost (mx.upb.ro [127.0.0.1]) (amavisd-new, port 10032)
 with ESMTP id 28OD-lo4a_Zm; Thu, 13 Aug 2020 11:53:47 +0300 (EEST)
Received: from localhost (localhost [127.0.0.1])
 by mx.upb.ro (Postfix) with ESMTP id D4870B561D38;
 Thu, 13 Aug 2020 11:53:47 +0300 (EEST)
X-Virus-Scanned: amavisd-new at upb.ro
Received: from mx.upb.ro ([127.0.0.1])
 by localhost (mx.upb.ro [127.0.0.1]) (amavisd-new, port 10026)
 with ESMTP id 9jzHxmALR-o8; Thu, 13 Aug 2020 11:53:47 +0300 (EEST)
Received: from localhost.localdomain (unknown [188.25.162.205])
 by mx.upb.ro (Postfix) with ESMTPSA id 951CDB561D12;
 Thu, 13 Aug 2020 11:53:47 +0300 (EEST)
From: Costin Lupu <costin.lupu@cs.pub.ro>
To: minios-devel@lists.xen.org
Cc: sharan.santhanam@neclab.eu,
 Roxana Nicolescu <nicolescu.roxana1996@gmail.com>
Subject: [UNIKRAFT PATCH v4 02/12] plat/xen: Add vif device type
Date: Thu, 13 Aug 2020 11:53:32 +0300
Message-Id: <20200813085342.29799-3-costin.lupu@cs.pub.ro>
X-Mailer: git-send-email 2.20.1
In-Reply-To: <20200813085342.29799-1-costin.lupu@cs.pub.ro>
References: <20200813085342.29799-1-costin.lupu@cs.pub.ro>
MIME-Version: 1.0
Content-Transfer-Encoding: quoted-printable
X-BeenThere: minios-devel@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Mini-os development list <minios-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:minios-devel@lists.xenproject.org>
List-Help: <mailto:minios-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: minios-devel-bounces@lists.xenproject.org
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>

vif device type is used for virtual network interfaces.

Signed-off-by: Costin Lupu <costin.lupu@cs.pub.ro>
Reviewed-by: Roxana Nicolescu <nicolescu.roxana1996@gmail.com>
---
 plat/xen/include/xenbus/xenbus.h | 1 +
 plat/xen/xenbus/client.c         | 1 +
 2 files changed, 2 insertions(+)

diff --git a/plat/xen/include/xenbus/xenbus.h b/plat/xen/include/xenbus/x=
enbus.h
index 9fc942bc..fc6d6811 100644
--- a/plat/xen/include/xenbus/xenbus.h
+++ b/plat/xen/include/xenbus/xenbus.h
@@ -49,6 +49,7 @@
  */
 typedef enum xenbus_dev_type {
 	xenbus_dev_none =3D 0,
+	xenbus_dev_vif,
 	xenbus_dev_vbd,
 	xenbus_dev_9pfs,
 } xenbus_dev_type_t;
diff --git a/plat/xen/xenbus/client.c b/plat/xen/xenbus/client.c
index 504b117e..d83f604d 100644
--- a/plat/xen/xenbus/client.c
+++ b/plat/xen/xenbus/client.c
@@ -74,6 +74,7 @@ const char *xenbus_state_to_str(XenbusState state)
=20
 static const char *const xb_devtype_tbl[] =3D {
 	XENBUS_DEVTYPE_ENTRY(none),
+	XENBUS_DEVTYPE_ENTRY(vif),
 	XENBUS_DEVTYPE_ENTRY(vbd),
 	XENBUS_DEVTYPE_ENTRY(9pfs),
 };
--=20
2.20.1



From minios-devel-bounces@lists.xenproject.org Thu Aug 13 08:54:00 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Thu, 13 Aug 2020 08:54:00 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1k68zn-0001Xd-VM; Thu, 13 Aug 2020 08:53:59 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=QcnS=BX=cs.pub.ro=costin.lupu@srs-us1.protection.inumbo.net>)
 id 1k68zm-0001W6-Ic
 for minios-devel@lists.xen.org; Thu, 13 Aug 2020 08:53:58 +0000
X-Inumbo-ID: bd035084-72f5-4883-a978-fffe65f8de85
Received: from mx.upb.ro (unknown [141.85.13.220])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id bd035084-72f5-4883-a978-fffe65f8de85;
 Thu, 13 Aug 2020 08:53:54 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
 by mx.upb.ro (Postfix) with ESMTP id E7716B561DB8;
 Thu, 13 Aug 2020 11:53:52 +0300 (EEST)
Received: from mx.upb.ro ([127.0.0.1])
 by localhost (mx.upb.ro [127.0.0.1]) (amavisd-new, port 10032)
 with ESMTP id UAITE415WI3p; Thu, 13 Aug 2020 11:53:48 +0300 (EEST)
Received: from localhost (localhost [127.0.0.1])
 by mx.upb.ro (Postfix) with ESMTP id 66525B561D3A;
 Thu, 13 Aug 2020 11:53:48 +0300 (EEST)
X-Virus-Scanned: amavisd-new at upb.ro
Received: from mx.upb.ro ([127.0.0.1])
 by localhost (mx.upb.ro [127.0.0.1]) (amavisd-new, port 10026)
 with ESMTP id IqC0SCB-hV4X; Thu, 13 Aug 2020 11:53:48 +0300 (EEST)
Received: from localhost.localdomain (unknown [188.25.162.205])
 by mx.upb.ro (Postfix) with ESMTPSA id 1D725B561D39;
 Thu, 13 Aug 2020 11:53:48 +0300 (EEST)
From: Costin Lupu <costin.lupu@cs.pub.ro>
To: minios-devel@lists.xen.org
Cc: sharan.santhanam@neclab.eu, Razvan Cojocaru <razvan.cojocaru93@gmail.com>
Subject: [UNIKRAFT PATCH v4 04/12] plat/xen/drivers/net: Configure netfront
 device
Date: Thu, 13 Aug 2020 11:53:34 +0300
Message-Id: <20200813085342.29799-5-costin.lupu@cs.pub.ro>
X-Mailer: git-send-email 2.20.1
In-Reply-To: <20200813085342.29799-1-costin.lupu@cs.pub.ro>
References: <20200813085342.29799-1-costin.lupu@cs.pub.ro>
MIME-Version: 1.0
Content-Transfer-Encoding: quoted-printable
X-BeenThere: minios-devel@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Mini-os development list <minios-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:minios-devel@lists.xenproject.org>
List-Help: <mailto:minios-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: minios-devel-bounces@lists.xenproject.org
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>

The information needed for configuring netfront devices is in the Xenstor=
e. For
now, we only retrieve the MAC and IP addresses from there in order to
initialize the device.

This patch introduces the `netfront_dev` structure which integrates both =
netdev
and Xenbus device information and also keeps the configuration parameters=
.

Signed-off-by: Costin Lupu <costin.lupu@cs.pub.ro>
Signed-off-by: Razvan Cojocaru <razvan.cojocaru93@gmail.com>
---
 plat/xen/Makefile.uk               |   1 +
 plat/xen/drivers/net/netfront.c    | 100 ++++++++++++++
 plat/xen/drivers/net/netfront.h    |  66 ++++++++++
 plat/xen/drivers/net/netfront_xb.h |  43 ++++++
 plat/xen/drivers/net/netfront_xs.c | 205 +++++++++++++++++++++++++++++
 5 files changed, 415 insertions(+)
 create mode 100644 plat/xen/drivers/net/netfront.h
 create mode 100644 plat/xen/drivers/net/netfront_xb.h
 create mode 100644 plat/xen/drivers/net/netfront_xs.c

diff --git a/plat/xen/Makefile.uk b/plat/xen/Makefile.uk
index 339b1b21..dfca58fe 100644
--- a/plat/xen/Makefile.uk
+++ b/plat/xen/Makefile.uk
@@ -121,6 +121,7 @@ LIBXENNETFRONT_ASINCLUDES-y    +=3D $(LIBXENPLAT_ASIN=
CLUDES-y)
 LIBXENNETFRONT_CFLAGS-y        +=3D $(LIBXENPLAT_CFLAGS-y)
 LIBXENNETFRONT_CINCLUDES-y     +=3D $(LIBXENPLAT_CINCLUDES-y)
 LIBXENNETFRONT_SRCS-y          +=3D $(LIBXENPLAT_BASE)/drivers/net/netfr=
ont.c
+LIBXENNETFRONT_SRCS-y          +=3D $(LIBXENPLAT_BASE)/drivers/net/netfr=
ont_xs.c
 endif
=20
 ifeq ($(CONFIG_XEN_BLKFRONT),y)
diff --git a/plat/xen/drivers/net/netfront.c b/plat/xen/drivers/net/netfr=
ont.c
index b455911e..539e1cbc 100644
--- a/plat/xen/drivers/net/netfront.c
+++ b/plat/xen/drivers/net/netfront.c
@@ -33,21 +33,121 @@
  * THIS HEADER MAY NOT BE EXTRACTED OR MODIFIED IN ANY WAY.
  */
=20
+#include <uk/assert.h>
+#include <uk/print.h>
+#include <uk/alloc.h>
+#include <uk/netdev_driver.h>
 #include <xenbus/xenbus.h>
+#include "netfront.h"
+#include "netfront_xb.h"
=20
=20
 #define DRIVER_NAME  "xen-netfront"
=20
+#define to_netfront_dev(dev) \
+	__containerof(dev, struct netfront_dev, netdev)
+
 static struct uk_alloc *drv_allocator;
=20
+static const void *netfront_einfo_get(struct uk_netdev *n,
+		enum uk_netdev_einfo_type einfo_type)
+{
+	struct netfront_dev *nfdev;
+
+	UK_ASSERT(n !=3D NULL);
+
+	nfdev =3D to_netfront_dev(n);
+	switch (einfo_type) {
+	case UK_NETDEV_IPV4_ADDR_STR:
+		return nfdev->econf.ipv4addr;
+	case UK_NETDEV_IPV4_MASK_STR:
+		return nfdev->econf.ipv4mask;
+	case UK_NETDEV_IPV4_GW_STR:
+		return nfdev->econf.ipv4gw;
+	default:
+		break;
+	}
+
+	/* type not supported */
+	return NULL;
+}
+
+static const struct uk_hwaddr *netfront_mac_get(struct uk_netdev *n)
+{
+	struct netfront_dev *nfdev;
+
+	UK_ASSERT(n !=3D NULL);
+	nfdev =3D to_netfront_dev(n);
+	return &nfdev->hw_addr;
+}
+
+static uint16_t netfront_mtu_get(struct uk_netdev *n)
+{
+	struct netfront_dev *nfdev;
+
+	UK_ASSERT(n !=3D NULL);
+	nfdev =3D to_netfront_dev(n);
+	return nfdev->mtu;
+}
+
+static unsigned int netfront_promisc_get(struct uk_netdev *n)
+{
+	struct netfront_dev *nfdev;
+
+	UK_ASSERT(n !=3D NULL);
+	nfdev =3D to_netfront_dev(n);
+	return nfdev->promisc;
+}
+
+static const struct uk_netdev_ops netfront_ops =3D {
+	.einfo_get =3D netfront_einfo_get,
+	.hwaddr_get =3D netfront_mac_get,
+	.mtu_get =3D netfront_mtu_get,
+	.promiscuous_get =3D netfront_promisc_get,
+};
=20
 static int netfront_add_dev(struct xenbus_device *xendev)
 {
+	struct netfront_dev *nfdev;
 	int rc =3D 0;
=20
 	UK_ASSERT(xendev !=3D NULL);
=20
+	nfdev =3D uk_calloc(drv_allocator, 1, sizeof(*nfdev));
+	if (!nfdev) {
+		rc =3D -ENOMEM;
+		goto err_out;
+	}
+
+	nfdev->xendev =3D xendev;
+	nfdev->mtu =3D ETH_PKT_PAYLOAD_LEN;
+
+	/* Xenbus initialization */
+	rc =3D netfront_xb_init(nfdev, drv_allocator);
+	if (rc) {
+		uk_pr_err("Error initializing Xenbus data: %d\n", rc);
+		goto err_xenbus;
+	}
+
+	/* register netdev */
+	nfdev->netdev.ops =3D &netfront_ops;
+	rc =3D uk_netdev_drv_register(&nfdev->netdev, drv_allocator, DRIVER_NAM=
E);
+	if (rc < 0) {
+		uk_pr_err("Failed to register %s device with libuknetdev\n",
+			DRIVER_NAME);
+		goto err_register;
+	}
+	nfdev->uid =3D rc;
+	rc =3D 0;
+
+out:
 	return rc;
+err_register:
+	netfront_xb_fini(nfdev, drv_allocator);
+err_xenbus:
+	uk_free(drv_allocator, nfdev);
+err_out:
+	goto out;
 }
=20
 static int netfront_drv_init(struct uk_alloc *allocator)
diff --git a/plat/xen/drivers/net/netfront.h b/plat/xen/drivers/net/netfr=
ont.h
new file mode 100644
index 00000000..0cc8230b
--- /dev/null
+++ b/plat/xen/drivers/net/netfront.h
@@ -0,0 +1,66 @@
+/* SPDX-License-Identifier: BSD-3-Clause */
+/*
+ * Authors: Costin Lupu <costin.lupu@cs.pub.ro>
+ *          Razvan Cojocaru <razvan.cojocaru93@gmail.com>
+ *
+ * Copyright (c) 2020, University Politehnica of Bucharest. All rights r=
eserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in th=
e
+ *    documentation and/or other materials provided with the distributio=
n.
+ * 3. Neither the name of the copyright holder nor the names of its
+ *    contributors may be used to endorse or promote products derived fr=
om
+ *    this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "=
AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,=
 THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PU=
RPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTOR=
S BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSIN=
ESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER =
IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWIS=
E)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED O=
F THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ * THIS HEADER MAY NOT BE EXTRACTED OR MODIFIED IN ANY WAY.
+ */
+
+#ifndef __NETFRONT_H__
+#define __NETFRONT_H__
+
+#include <uk/netdev.h>
+
+struct xs_econf {
+	char *ipv4addr;
+	char *ipv4mask;
+	char *ipv4gw;
+};
+
+struct netfront_dev {
+	/* Xenbus device */
+	struct xenbus_device *xendev;
+	/* Network device */
+	struct uk_netdev netdev;
+
+	/* Configuration parameters */
+	struct xs_econf econf;
+
+	/* The netdevice identifier */
+	uint16_t uid;
+	/* The mtu */
+	uint16_t mtu;
+	/* The hw address of the netdevice */
+	struct uk_hwaddr hw_addr;
+	/* RX promiscuous mode. */
+	uint8_t promisc : 1;
+};
+
+#endif /* __NETFRONT_H__ */
diff --git a/plat/xen/drivers/net/netfront_xb.h b/plat/xen/drivers/net/ne=
tfront_xb.h
new file mode 100644
index 00000000..6332cf71
--- /dev/null
+++ b/plat/xen/drivers/net/netfront_xb.h
@@ -0,0 +1,43 @@
+/* SPDX-License-Identifier: BSD-3-Clause */
+/*
+ * Authors: Costin Lupu <costin.lupu@cs.pub.ro>
+ *
+ * Copyright (c) 2020, University Politehnica of Bucharest. All rights r=
eserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in th=
e
+ *    documentation and/or other materials provided with the distributio=
n.
+ * 3. Neither the name of the copyright holder nor the names of its
+ *    contributors may be used to endorse or promote products derived fr=
om
+ *    this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "=
AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,=
 THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PU=
RPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTOR=
S BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSIN=
ESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER =
IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWIS=
E)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED O=
F THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ * THIS HEADER MAY NOT BE EXTRACTED OR MODIFIED IN ANY WAY.
+ */
+
+#ifndef __NETFRONT_XB_H__
+#define __NETFRONT_XB_H__
+
+#include "netfront.h"
+
+int  netfront_xb_init(struct netfront_dev *netdev, struct uk_alloc *a);
+void netfront_xb_fini(struct netfront_dev *netdev, struct uk_alloc *a);
+
+#endif /* __NETFRONT_XB_H__ */
diff --git a/plat/xen/drivers/net/netfront_xs.c b/plat/xen/drivers/net/ne=
tfront_xs.c
new file mode 100644
index 00000000..48f01b34
--- /dev/null
+++ b/plat/xen/drivers/net/netfront_xs.c
@@ -0,0 +1,205 @@
+/* SPDX-License-Identifier: BSD-3-Clause */
+/*
+ * Authors: Costin Lupu <costin.lupu@cs.pub.ro>
+ *
+ * Copyright (c) 2020, University Politehnica of Bucharest. All rights r=
eserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in th=
e
+ *    documentation and/or other materials provided with the distributio=
n.
+ * 3. Neither the name of the copyright holder nor the names of its
+ *    contributors may be used to endorse or promote products derived fr=
om
+ *    this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "=
AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,=
 THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PU=
RPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTOR=
S BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSIN=
ESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER =
IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWIS=
E)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED O=
F THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ * THIS HEADER MAY NOT BE EXTRACTED OR MODIFIED IN ANY WAY.
+ */
+#include <inttypes.h>
+#include <stdio.h>
+#include <string.h>
+#include <uk/errptr.h>
+#include <uk/print.h>
+#include <uk/assert.h>
+#include <xenbus/xs.h>
+#include "netfront_xb.h"
+
+
+static int xs_read_backend_id(const char *nodename, domid_t *domid)
+{
+	char path[strlen(nodename) + sizeof("/backend-id")];
+	int value, rc;
+
+	sprintf(path, "%s/backend-id", nodename);
+
+	rc =3D xs_read_integer(XBT_NIL, path, &value);
+	if (!rc)
+		*domid =3D (domid_t) value;
+
+	return rc;
+}
+
+static void xs_econf_fini(struct xs_econf *econf,
+		struct uk_alloc *a)
+{
+	if (econf->ipv4addr) {
+		uk_free(a, econf->ipv4addr);
+		econf->ipv4addr =3D NULL;
+	}
+	if (econf->ipv4mask) {
+		uk_free(a, econf->ipv4mask);
+		econf->ipv4mask =3D NULL;
+	}
+	if (econf->ipv4gw) {
+		uk_free(a, econf->ipv4gw);
+		econf->ipv4gw =3D NULL;
+	}
+}
+
+static int xs_econf_init(struct xs_econf *econf, char *ip_str,
+		struct uk_alloc *a)
+{
+	int rc =3D -1;
+	char *ip_addr =3D NULL, *ip_gw_str =3D NULL, *ip_mask_str =3D NULL;
+
+	/* IP */
+	ip_addr =3D strtok(ip_str, " ");
+	if (ip_addr =3D=3D NULL)
+		goto out_err;
+	econf->ipv4addr =3D uk_malloc(a, strlen(ip_addr) + 1);
+	if (!econf->ipv4addr) {
+		uk_pr_err("Error allocating ip config.\n");
+		goto out_err;
+	}
+	memcpy(econf->ipv4addr, ip_addr, strlen(ip_addr) + 1);
+
+	/* Mask */
+	ip_mask_str =3D strtok(NULL, " ");
+	if (ip_mask_str =3D=3D NULL)
+		goto out_err;
+	econf->ipv4mask =3D uk_malloc(a, strlen(ip_mask_str) + 1);
+	if (!econf->ipv4mask) {
+		uk_pr_err("Error allocating ip mask config.\n");
+		goto out_err;
+	}
+	memcpy(econf->ipv4mask, ip_mask_str, strlen(ip_mask_str) + 1);
+
+	/* Gateway */
+	ip_gw_str =3D strtok(NULL, " ");
+	if (ip_gw_str =3D=3D NULL)
+		goto out_err;
+	econf->ipv4gw =3D uk_malloc(a, strlen(ip_gw_str) + 1);
+	if (!econf->ipv4gw) {
+		uk_pr_err("Error allocating ip gateway config.\n");
+		goto out_err;
+	}
+	memcpy(econf->ipv4gw, ip_gw_str, strlen(ip_gw_str) + 1);
+
+	rc =3D 0;
+out:
+	return rc;
+out_err:
+	xs_econf_fini(econf, a);
+	goto out;
+}
+
+int netfront_xb_init(struct netfront_dev *nfdev, struct uk_alloc *a)
+{
+	struct xenbus_device *xendev;
+	char *mac_str, *p, *ip_str;
+	int rc;
+
+	UK_ASSERT(nfdev !=3D NULL);
+
+	xendev =3D nfdev->xendev;
+	UK_ASSERT(xendev !=3D NULL);
+
+	rc =3D xs_read_backend_id(xendev->nodename, &xendev->otherend_id);
+	if (rc)
+		goto out;
+
+	/* read backend path */
+	xendev->otherend =3D xs_read(XBT_NIL, xendev->nodename, "backend");
+	if (PTRISERR(xendev->otherend)) {
+		uk_pr_err("Error reading backend path.\n");
+		rc =3D PTR2ERR(xendev->otherend);
+		xendev->otherend =3D NULL;
+		goto out;
+	}
+
+	/* read MAC address */
+	mac_str =3D xs_read(XBT_NIL, xendev->nodename, "mac");
+	if (PTRISERR(mac_str)) {
+		uk_pr_err("Error reading MAC address.\n");
+		rc =3D PTR2ERR(mac_str);
+		goto no_conf;
+	}
+	uk_pr_info("\tMAC %s\n", mac_str);
+
+	p =3D mac_str;
+	for (int i =3D 0; i < UK_NETDEV_HWADDR_LEN; i++) {
+		nfdev->hw_addr.addr_bytes[i] =3D (uint8_t) strtoul(p, &p, 16);
+		p++;
+	}
+	free(mac_str);
+
+	/* read IP address */
+	ip_str =3D xs_read(XBT_NIL, xendev->otherend, "ip");
+	if (PTRISERR(ip_str)) {
+		uk_pr_err("Error reading IP address.\n");
+		rc =3D PTR2ERR(ip_str);
+		goto no_conf;
+	}
+	uk_pr_info("\tIP: %s\n", ip_str);
+
+	rc =3D xs_econf_init(&nfdev->econf, ip_str, a);
+	if (rc)
+		goto no_conf;
+	free(ip_str);
+
+	/* TODO spit event channels */
+
+	/* TODO netmap */
+
+out:
+	return rc;
+no_conf:
+	if (xendev->otherend) {
+		free(xendev->otherend);
+		xendev->otherend =3D NULL;
+	}
+	goto out;
+}
+
+void netfront_xb_fini(struct netfront_dev *nfdev, struct uk_alloc *a)
+{
+	struct xenbus_device *xendev;
+
+	UK_ASSERT(nfdev !=3D NULL);
+
+	xendev =3D nfdev->xendev;
+	UK_ASSERT(xendev !=3D NULL);
+
+	xs_econf_fini(&nfdev->econf, a);
+
+	if (xendev->otherend) {
+		free(xendev->otherend);
+		xendev->otherend =3D NULL;
+	}
+}
--=20
2.20.1



From minios-devel-bounces@lists.xenproject.org Thu Aug 13 08:54:04 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Thu, 13 Aug 2020 08:54:04 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1k68zs-0001Yk-1O; Thu, 13 Aug 2020 08:54:04 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=QcnS=BX=cs.pub.ro=costin.lupu@srs-us1.protection.inumbo.net>)
 id 1k68zq-0001W0-Pc
 for minios-devel@lists.xen.org; Thu, 13 Aug 2020 08:54:02 +0000
X-Inumbo-ID: 27a99684-3a27-4f28-9be3-663318f6fdae
Received: from mx.upb.ro (unknown [141.85.13.200])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 27a99684-3a27-4f28-9be3-663318f6fdae;
 Thu, 13 Aug 2020 08:53:53 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
 by mx.upb.ro (Postfix) with ESMTP id 7D9D6B561D12;
 Thu, 13 Aug 2020 11:53:52 +0300 (EEST)
Received: from mx.upb.ro ([127.0.0.1])
 by localhost (mx.upb.ro [127.0.0.1]) (amavisd-new, port 10032)
 with ESMTP id joenlKnW3Jb7; Thu, 13 Aug 2020 11:53:50 +0300 (EEST)
Received: from localhost (localhost [127.0.0.1])
 by mx.upb.ro (Postfix) with ESMTP id 84713B561D48;
 Thu, 13 Aug 2020 11:53:49 +0300 (EEST)
X-Virus-Scanned: amavisd-new at upb.ro
Received: from mx.upb.ro ([127.0.0.1])
 by localhost (mx.upb.ro [127.0.0.1]) (amavisd-new, port 10026)
 with ESMTP id f2Rc_utDk6ES; Thu, 13 Aug 2020 11:53:49 +0300 (EEST)
Received: from localhost.localdomain (unknown [188.25.162.205])
 by mx.upb.ro (Postfix) with ESMTPSA id 3BB0BB561D39;
 Thu, 13 Aug 2020 11:53:49 +0300 (EEST)
From: Costin Lupu <costin.lupu@cs.pub.ro>
To: minios-devel@lists.xen.org
Cc: sharan.santhanam@neclab.eu, Razvan Cojocaru <razvan.cojocaru93@gmail.com>
Subject: [UNIKRAFT PATCH v4 08/12] plat/xen/drivers/net: Enable/disable
 interrupts for rx queues
Date: Thu, 13 Aug 2020 11:53:38 +0300
Message-Id: <20200813085342.29799-9-costin.lupu@cs.pub.ro>
X-Mailer: git-send-email 2.20.1
In-Reply-To: <20200813085342.29799-1-costin.lupu@cs.pub.ro>
References: <20200813085342.29799-1-costin.lupu@cs.pub.ro>
MIME-Version: 1.0
Content-Transfer-Encoding: quoted-printable
X-BeenThere: minios-devel@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Mini-os development list <minios-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:minios-devel@lists.xenproject.org>
List-Help: <mailto:minios-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: minios-devel-bounces@lists.xenproject.org
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>

The user can enable/disable interrupts for devices according with the ope=
ration
mode he or she chooses for the device. This patch follows closely the log=
ic
implemented in the virtio net driver.

Signed-off-by: Costin Lupu <costin.lupu@cs.pub.ro>
Signed-off-by: Razvan Cojocaru <razvan.cojocaru93@gmail.com>
---
 plat/xen/drivers/net/netfront.c | 67 +++++++++++++++++++++++++++++++++
 1 file changed, 67 insertions(+)

diff --git a/plat/xen/drivers/net/netfront.c b/plat/xen/drivers/net/netfr=
ont.c
index 742e05cf..6b708790 100644
--- a/plat/xen/drivers/net/netfront.c
+++ b/plat/xen/drivers/net/netfront.c
@@ -46,6 +46,12 @@
=20
 #define DRIVER_NAME  "xen-netfront"
=20
+/* TODO Same interrupt macros we use in virtio-net */
+#define NETFRONT_INTR_EN             (1 << 0)
+#define NETFRONT_INTR_EN_MASK        (1)
+#define NETFRONT_INTR_USR_EN         (1 << 1)
+#define NETFRONT_INTR_USR_EN_MASK    (2)
+
 #define to_netfront_dev(dev) \
 	__containerof(dev, struct netfront_dev, netdev)
=20
@@ -148,6 +154,22 @@ out:
 	return status;
 }
=20
+/* Returns 1 if more packets available */
+static int netfront_rxq_intr_enable(struct uk_netdev_rx_queue *rxq)
+{
+	int more;
+
+	/* Check if there are no more packets enabled */
+	RING_FINAL_CHECK_FOR_RESPONSES(&rxq->ring, more);
+	if (!more) {
+		/* No more packets, we can enable interrupts */
+		rxq->intr_enabled |=3D NETFRONT_INTR_EN;
+		unmask_evtchn(rxq->evtchn);
+	}
+
+	return (more > 0);
+}
+
 static struct uk_netdev_tx_queue *netfront_txq_setup(struct uk_netdev *n=
,
 		uint16_t queue_id,
 		uint16_t nb_desc __unused,
@@ -218,6 +240,10 @@ static void netfront_handler(evtchn_port_t port __un=
used,
 {
 	struct uk_netdev_rx_queue *rxq =3D arg;
=20
+	/* Disable the interrupt for the ring */
+	rxq->intr_enabled &=3D ~(NETFRONT_INTR_EN);
+	mask_evtchn(rxq->evtchn);
+
 	/* Indicate to the network stack about an event */
 	uk_netdev_drv_rx_event(&rxq->netfront_dev->netdev, rxq->lqueue_id);
 }
@@ -334,6 +360,45 @@ err_free_txrx:
 	return rc;
 }
=20
+static int netfront_rx_intr_enable(struct uk_netdev *n,
+		struct uk_netdev_rx_queue *rxq)
+{
+	int rc;
+
+	UK_ASSERT(n !=3D NULL);
+	UK_ASSERT(rxq !=3D NULL);
+	UK_ASSERT(&rxq->netfront_dev->netdev =3D=3D n);
+
+	/* If the interrupt is enabled */
+	if (rxq->intr_enabled & NETFRONT_INTR_EN)
+		return 0;
+
+	/**
+	 * Enable the user configuration bit. This would cause the interrupt to
+	 * be enabled automatically if the interrupt could not be enabled now
+	 * due to data in the queue.
+	 */
+	rxq->intr_enabled =3D NETFRONT_INTR_USR_EN;
+	rc =3D netfront_rxq_intr_enable(rxq);
+	if (!rc)
+		rxq->intr_enabled |=3D NETFRONT_INTR_EN;
+
+	return rc;
+}
+
+static int netfront_rx_intr_disable(struct uk_netdev *n,
+		struct uk_netdev_rx_queue *rxq)
+{
+	UK_ASSERT(n !=3D NULL);
+	UK_ASSERT(rxq !=3D NULL);
+	UK_ASSERT(&rxq->netfront_dev->netdev =3D=3D n);
+
+	rxq->intr_enabled &=3D ~(NETFRONT_INTR_USR_EN | NETFRONT_INTR_EN);
+	mask_evtchn(rxq->evtchn);
+
+	return 0;
+}
+
 static int netfront_txq_info_get(struct uk_netdev *n,
 		uint16_t queue_id,
 		struct uk_netdev_queue_info *qinfo)
@@ -479,6 +544,8 @@ static const struct uk_netdev_ops netfront_ops =3D {
 	.configure =3D netfront_configure,
 	.txq_configure =3D netfront_txq_setup,
 	.rxq_configure =3D netfront_rxq_setup,
+	.rxq_intr_enable =3D netfront_rx_intr_enable,
+	.rxq_intr_disable =3D netfront_rx_intr_disable,
 	.txq_info_get =3D netfront_txq_info_get,
 	.rxq_info_get =3D netfront_rxq_info_get,
 	.info_get =3D netfront_info_get,
--=20
2.20.1



From minios-devel-bounces@lists.xenproject.org Thu Aug 13 08:54:04 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Thu, 13 Aug 2020 08:54:04 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1k68zs-0001Z2-3Z; Thu, 13 Aug 2020 08:54:04 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=QcnS=BX=cs.pub.ro=costin.lupu@srs-us1.protection.inumbo.net>)
 id 1k68zr-0001W6-Ii
 for minios-devel@lists.xen.org; Thu, 13 Aug 2020 08:54:03 +0000
X-Inumbo-ID: 18734a9d-5d72-4522-9475-ae4e76258514
Received: from mx.upb.ro (unknown [141.85.13.200])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 18734a9d-5d72-4522-9475-ae4e76258514;
 Thu, 13 Aug 2020 08:53:54 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
 by mx.upb.ro (Postfix) with ESMTP id 8EE06B5617CC;
 Thu, 13 Aug 2020 11:53:53 +0300 (EEST)
Received: from mx.upb.ro ([127.0.0.1])
 by localhost (mx.upb.ro [127.0.0.1]) (amavisd-new, port 10032)
 with ESMTP id fScjHj74WuD0; Thu, 13 Aug 2020 11:53:51 +0300 (EEST)
Received: from localhost (localhost [127.0.0.1])
 by mx.upb.ro (Postfix) with ESMTP id A71E3B561D1A;
 Thu, 13 Aug 2020 11:53:50 +0300 (EEST)
X-Virus-Scanned: amavisd-new at upb.ro
Received: from mx.upb.ro ([127.0.0.1])
 by localhost (mx.upb.ro [127.0.0.1]) (amavisd-new, port 10026)
 with ESMTP id nRQrwTjZkjT0; Thu, 13 Aug 2020 11:53:50 +0300 (EEST)
Received: from localhost.localdomain (unknown [188.25.162.205])
 by mx.upb.ro (Postfix) with ESMTPSA id 59459B561DB8;
 Thu, 13 Aug 2020 11:53:50 +0300 (EEST)
From: Costin Lupu <costin.lupu@cs.pub.ro>
To: minios-devel@lists.xen.org
Cc: sharan.santhanam@neclab.eu
Subject: [UNIKRAFT PATCH v4 12/12] lib/uknetdev: Enable default drivers
Date: Thu, 13 Aug 2020 11:53:42 +0300
Message-Id: <20200813085342.29799-13-costin.lupu@cs.pub.ro>
X-Mailer: git-send-email 2.20.1
In-Reply-To: <20200813085342.29799-1-costin.lupu@cs.pub.ro>
References: <20200813085342.29799-1-costin.lupu@cs.pub.ro>
MIME-Version: 1.0
Content-Transfer-Encoding: quoted-printable
X-BeenThere: minios-devel@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Mini-os development list <minios-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:minios-devel@lists.xenproject.org>
List-Help: <mailto:minios-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: minios-devel-bounces@lists.xenproject.org
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>

Currently, for KVM and Xen we only have one network driver each. We enabl=
e
them by default whenever uknetdev library is enabled.

Signed-off-by: Costin Lupu <costin.lupu@cs.pub.ro>
---
 lib/uknetdev/Config.uk | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/lib/uknetdev/Config.uk b/lib/uknetdev/Config.uk
index 186dd462..2af47efb 100644
--- a/lib/uknetdev/Config.uk
+++ b/lib/uknetdev/Config.uk
@@ -5,6 +5,8 @@ menuconfig LIBUKNETDEV
 	select LIBUKDEBUG
 	select LIBUKALLOC
 	imply LIBUKLIBPARAM
+	imply VIRTIO_NET if PLAT_KVM
+	imply XEN_NETFRONT if PLAT_XEN
=20
 if LIBUKNETDEV
 	config LIBUKNETDEV_MAXNBQUEUES
--=20
2.20.1



From minios-devel-bounces@lists.xenproject.org Thu Aug 13 08:54:08 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Thu, 13 Aug 2020 08:54:08 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1k68zw-0001aK-56; Thu, 13 Aug 2020 08:54:08 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=QcnS=BX=cs.pub.ro=costin.lupu@srs-us1.protection.inumbo.net>)
 id 1k68zv-0001W0-Pj
 for minios-devel@lists.xen.org; Thu, 13 Aug 2020 08:54:07 +0000
X-Inumbo-ID: 0f76b6c0-77e5-45bb-aceb-7d26bfc457b3
Received: from mx.upb.ro (unknown [141.85.13.250])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 0f76b6c0-77e5-45bb-aceb-7d26bfc457b3;
 Thu, 13 Aug 2020 08:53:52 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
 by mx.upb.ro (Postfix) with ESMTP id E08D8B561D38;
 Thu, 13 Aug 2020 11:53:50 +0300 (EEST)
Received: from mx.upb.ro ([127.0.0.1])
 by localhost (mx.upb.ro [127.0.0.1]) (amavisd-new, port 10032)
 with ESMTP id zlvjMjD89T0m; Thu, 13 Aug 2020 11:53:48 +0300 (EEST)
Received: from localhost (localhost [127.0.0.1])
 by mx.upb.ro (Postfix) with ESMTP id 1D1B3B561D12;
 Thu, 13 Aug 2020 11:53:48 +0300 (EEST)
X-Virus-Scanned: amavisd-new at upb.ro
Received: from mx.upb.ro ([127.0.0.1])
 by localhost (mx.upb.ro [127.0.0.1]) (amavisd-new, port 10026)
 with ESMTP id cGv8-HCLrf1B; Thu, 13 Aug 2020 11:53:48 +0300 (EEST)
Received: from localhost.localdomain (unknown [188.25.162.205])
 by mx.upb.ro (Postfix) with ESMTPSA id D137CB561CCA;
 Thu, 13 Aug 2020 11:53:47 +0300 (EEST)
From: Costin Lupu <costin.lupu@cs.pub.ro>
To: minios-devel@lists.xen.org
Cc: sharan.santhanam@neclab.eu, Razvan Cojocaru <razvan.cojocaru93@gmail.com>
Subject: [UNIKRAFT PATCH v4 03/12] plat/xen/drivers: Add skeleton for netfront
 driver
Date: Thu, 13 Aug 2020 11:53:33 +0300
Message-Id: <20200813085342.29799-4-costin.lupu@cs.pub.ro>
X-Mailer: git-send-email 2.20.1
In-Reply-To: <20200813085342.29799-1-costin.lupu@cs.pub.ro>
References: <20200813085342.29799-1-costin.lupu@cs.pub.ro>
MIME-Version: 1.0
Content-Transfer-Encoding: quoted-printable
X-BeenThere: minios-devel@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Mini-os development list <minios-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:minios-devel@lists.xenproject.org>
List-Help: <mailto:minios-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: minios-devel-bounces@lists.xenproject.org
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>

This patch introduces the skeleton for the Xen netfront driver.

Signed-off-by: Costin Lupu <costin.lupu@cs.pub.ro>
Signed-off-by: Razvan Cojocaru <razvan.cojocaru93@gmail.com>
---
 plat/xen/Config.uk                 |  7 +++
 plat/xen/Makefile.uk               | 10 ++++
 plat/xen/drivers/net/exportsyms.uk |  1 +
 plat/xen/drivers/net/netfront.c    | 73 ++++++++++++++++++++++++++++++
 4 files changed, 91 insertions(+)
 create mode 100644 plat/xen/drivers/net/exportsyms.uk
 create mode 100644 plat/xen/drivers/net/netfront.c

diff --git a/plat/xen/Config.uk b/plat/xen/Config.uk
index 364c9528..511bfa89 100644
--- a/plat/xen/Config.uk
+++ b/plat/xen/Config.uk
@@ -90,6 +90,13 @@ config XEN_XENBUS
 menu "Xenbus Drivers"
 	depends on XEN_XENBUS
=20
+config XEN_NETFRONT
+	bool "Xenbus Netfront Driver"
+	default n
+	depends on LIBUKNETDEV
+	help
+		Driver for netfront devices
+
 menuconfig XEN_BLKFRONT
 	bool "Xenbus Blkfront Driver"
 	default n
diff --git a/plat/xen/Makefile.uk b/plat/xen/Makefile.uk
index 2a8cdbf6..339b1b21 100644
--- a/plat/xen/Makefile.uk
+++ b/plat/xen/Makefile.uk
@@ -10,6 +10,7 @@ $(eval $(call addplat_s,xen,$(CONFIG_PLAT_XEN)))
 ##
 $(eval $(call addplatlib,xen,libxenplat))
 $(eval $(call addplatlib_s,xen,libxenbus,$(CONFIG_XEN_XENBUS)))
+$(eval $(call addplatlib_s,xen,libxennetfront,$(CONFIG_XEN_NETFRONT)))
 $(eval $(call addplatlib_s,xen,libxenblkfront,$(CONFIG_XEN_BLKFRONT)))
 $(eval $(call addplatlib_s,xen,libxen9pfront,$(CONFIG_XEN_9PFRONT)))
=20
@@ -113,6 +114,15 @@ LIBXENBUS_SRCS-y               +=3D $(LIBXENPLAT_BAS=
E)/xenbus/xs_watch.c
 LIBXENBUS_SRCS-y               +=3D $(LIBXENPLAT_BASE)/xenbus/xs.c
 endif
=20
+ifeq ($(CONFIG_XEN_NETFRONT),y)
+LIBXENNETFRONT_EXPORTS          =3D $(LIBXENPLAT_BASE)/drivers/net/expor=
tsyms.uk
+LIBXENNETFRONT_ASFLAGS-y       +=3D $(LIBXENPLAT_ASFLAGS-y)
+LIBXENNETFRONT_ASINCLUDES-y    +=3D $(LIBXENPLAT_ASINCLUDES-y)
+LIBXENNETFRONT_CFLAGS-y        +=3D $(LIBXENPLAT_CFLAGS-y)
+LIBXENNETFRONT_CINCLUDES-y     +=3D $(LIBXENPLAT_CINCLUDES-y)
+LIBXENNETFRONT_SRCS-y          +=3D $(LIBXENPLAT_BASE)/drivers/net/netfr=
ont.c
+endif
+
 ifeq ($(CONFIG_XEN_BLKFRONT),y)
 LIBXENBLKFRONT_EXPORTS           =3D $(LIBXENPLAT_BASE)/drivers/blk/expo=
rtsyms.uk
 LIBXENBLKFRONT_ASFLAGS-y        +=3D $(LIBXENPLAT_ASFLAGS-y)
diff --git a/plat/xen/drivers/net/exportsyms.uk b/plat/xen/drivers/net/ex=
portsyms.uk
new file mode 100644
index 00000000..c86c3f35
--- /dev/null
+++ b/plat/xen/drivers/net/exportsyms.uk
@@ -0,0 +1 @@
+none
\ No newline at end of file
diff --git a/plat/xen/drivers/net/netfront.c b/plat/xen/drivers/net/netfr=
ont.c
new file mode 100644
index 00000000..b455911e
--- /dev/null
+++ b/plat/xen/drivers/net/netfront.c
@@ -0,0 +1,73 @@
+/* SPDX-License-Identifier: BSD-3-Clause */
+/*
+ * Authors: Costin Lupu <costin.lupu@cs.pub.ro>
+ *          Razvan Cojocaru <razvan.cojocaru93@gmail.com>
+ *
+ * Copyright (c) 2020, University Politehnica of Bucharest. All rights r=
eserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in th=
e
+ *    documentation and/or other materials provided with the distributio=
n.
+ * 3. Neither the name of the copyright holder nor the names of its
+ *    contributors may be used to endorse or promote products derived fr=
om
+ *    this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "=
AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,=
 THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PU=
RPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTOR=
S BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSIN=
ESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER =
IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWIS=
E)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED O=
F THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ * THIS HEADER MAY NOT BE EXTRACTED OR MODIFIED IN ANY WAY.
+ */
+
+#include <xenbus/xenbus.h>
+
+
+#define DRIVER_NAME  "xen-netfront"
+
+static struct uk_alloc *drv_allocator;
+
+
+static int netfront_add_dev(struct xenbus_device *xendev)
+{
+	int rc =3D 0;
+
+	UK_ASSERT(xendev !=3D NULL);
+
+	return rc;
+}
+
+static int netfront_drv_init(struct uk_alloc *allocator)
+{
+	/* driver initialization */
+	if (!allocator)
+		return -EINVAL;
+
+	drv_allocator =3D allocator;
+	return 0;
+}
+
+static const xenbus_dev_type_t netfront_devtypes[] =3D {
+	xenbus_dev_vif,
+	xenbus_dev_none
+};
+
+static struct xenbus_driver netfront_driver =3D {
+	.device_types =3D netfront_devtypes,
+	.init         =3D netfront_drv_init,
+	.add_dev      =3D netfront_add_dev
+};
+XENBUS_REGISTER_DRIVER(&netfront_driver);
--=20
2.20.1



From minios-devel-bounces@lists.xenproject.org Thu Aug 13 08:54:09 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Thu, 13 Aug 2020 08:54:09 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1k68zx-0001ar-6t; Thu, 13 Aug 2020 08:54:09 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=QcnS=BX=cs.pub.ro=costin.lupu@srs-us1.protection.inumbo.net>)
 id 1k68zw-0001W6-Iz
 for minios-devel@lists.xen.org; Thu, 13 Aug 2020 08:54:08 +0000
X-Inumbo-ID: d0b2e252-9050-4856-a016-15ed337aabe7
Received: from mx.upb.ro (unknown [141.85.13.200])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id d0b2e252-9050-4856-a016-15ed337aabe7;
 Thu, 13 Aug 2020 08:53:55 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
 by mx.upb.ro (Postfix) with ESMTP id CAA63B561D48;
 Thu, 13 Aug 2020 11:53:53 +0300 (EEST)
Received: from mx.upb.ro ([127.0.0.1])
 by localhost (mx.upb.ro [127.0.0.1]) (amavisd-new, port 10032)
 with ESMTP id fMUgy9KCBBWs; Thu, 13 Aug 2020 11:53:50 +0300 (EEST)
Received: from localhost (localhost [127.0.0.1])
 by mx.upb.ro (Postfix) with ESMTP id C6B11B561D51;
 Thu, 13 Aug 2020 11:53:49 +0300 (EEST)
X-Virus-Scanned: amavisd-new at upb.ro
Received: from mx.upb.ro ([127.0.0.1])
 by localhost (mx.upb.ro [127.0.0.1]) (amavisd-new, port 10026)
 with ESMTP id 1c_I8aMQQwap; Thu, 13 Aug 2020 11:53:49 +0300 (EEST)
Received: from localhost.localdomain (unknown [188.25.162.205])
 by mx.upb.ro (Postfix) with ESMTPSA id 806AAB561D1A;
 Thu, 13 Aug 2020 11:53:49 +0300 (EEST)
From: Costin Lupu <costin.lupu@cs.pub.ro>
To: minios-devel@lists.xen.org
Cc: sharan.santhanam@neclab.eu, Razvan Cojocaru <razvan.cojocaru93@gmail.com>
Subject: [UNIKRAFT PATCH v4 09/12] plat/xen/drivers/net: Start netfront device
Date: Thu, 13 Aug 2020 11:53:39 +0300
Message-Id: <20200813085342.29799-10-costin.lupu@cs.pub.ro>
X-Mailer: git-send-email 2.20.1
In-Reply-To: <20200813085342.29799-1-costin.lupu@cs.pub.ro>
References: <20200813085342.29799-1-costin.lupu@cs.pub.ro>
MIME-Version: 1.0
Content-Transfer-Encoding: quoted-printable
X-BeenThere: minios-devel@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Mini-os development list <minios-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:minios-devel@lists.xenproject.org>
List-Help: <mailto:minios-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: minios-devel-bounces@lists.xenproject.org
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>

Starting the device implies establishing the connection between netfront =
and
netback. The connection is set up after a negociation between the two end
points. After configuring the device queues, the netfront publishes via
Xenstore the information associated with the queues which will be used by=
 the
backend to connect.

Signed-off-by: Costin Lupu <costin.lupu@cs.pub.ro>
Signed-off-by: Razvan Cojocaru <razvan.cojocaru93@gmail.com>
---
 plat/xen/drivers/net/netfront.c    |  18 ++
 plat/xen/drivers/net/netfront_xb.h |   3 +
 plat/xen/drivers/net/netfront_xs.c | 303 +++++++++++++++++++++++++++++
 3 files changed, 324 insertions(+)

diff --git a/plat/xen/drivers/net/netfront.c b/plat/xen/drivers/net/netfr=
ont.c
index 6b708790..858d124a 100644
--- a/plat/xen/drivers/net/netfront.c
+++ b/plat/xen/drivers/net/netfront.c
@@ -474,6 +474,23 @@ out:
 	return rc;
 }
=20
+static int netfront_start(struct uk_netdev *n)
+{
+	struct netfront_dev *nfdev;
+	int rc;
+
+	UK_ASSERT(n !=3D NULL);
+	nfdev =3D to_netfront_dev(n);
+
+	rc =3D netfront_xb_connect(nfdev);
+	if (rc) {
+		uk_pr_err("Error connecting to backend: %d\n", rc);
+		return rc;
+	}
+
+	return rc;
+}
+
 static void netfront_info_get(struct uk_netdev *n,
 		struct uk_netdev_info *dev_info)
 {
@@ -542,6 +559,7 @@ static unsigned int netfront_promisc_get(struct uk_ne=
tdev *n)
=20
 static const struct uk_netdev_ops netfront_ops =3D {
 	.configure =3D netfront_configure,
+	.start =3D netfront_start,
 	.txq_configure =3D netfront_txq_setup,
 	.rxq_configure =3D netfront_rxq_setup,
 	.rxq_intr_enable =3D netfront_rx_intr_enable,
diff --git a/plat/xen/drivers/net/netfront_xb.h b/plat/xen/drivers/net/ne=
tfront_xb.h
index 6332cf71..07dde171 100644
--- a/plat/xen/drivers/net/netfront_xb.h
+++ b/plat/xen/drivers/net/netfront_xb.h
@@ -40,4 +40,7 @@
 int  netfront_xb_init(struct netfront_dev *netdev, struct uk_alloc *a);
 void netfront_xb_fini(struct netfront_dev *netdev, struct uk_alloc *a);
=20
+int netfront_xb_connect(struct netfront_dev *netdev);
+int netfront_xb_disconnect(struct netfront_dev *netdev);
+
 #endif /* __NETFRONT_XB_H__ */
diff --git a/plat/xen/drivers/net/netfront_xs.c b/plat/xen/drivers/net/ne=
tfront_xs.c
index 1bde44e0..618496e7 100644
--- a/plat/xen/drivers/net/netfront_xs.c
+++ b/plat/xen/drivers/net/netfront_xs.c
@@ -31,6 +31,7 @@
  *
  * THIS HEADER MAY NOT BE EXTRACTED OR MODIFIED IN ANY WAY.
  */
+#define _GNU_SOURCE
 #include <inttypes.h>
 #include <stdio.h>
 #include <string.h>
@@ -38,9 +39,14 @@
 #include <uk/print.h>
 #include <uk/assert.h>
 #include <xenbus/xs.h>
+#include <xenbus/client.h>
 #include "netfront_xb.h"
=20
=20
+static int netfront_xb_wait_be_connect(struct netfront_dev *nfdev);
+static int netfront_xb_wait_be_disconnect(struct netfront_dev *nfdev);
+
+
 static int xs_read_backend_id(const char *nodename, domid_t *domid)
 {
 	char path[strlen(nodename) + sizeof("/backend-id")];
@@ -217,3 +223,300 @@ void netfront_xb_fini(struct netfront_dev *nfdev, s=
truct uk_alloc *a)
 		xendev->otherend =3D NULL;
 	}
 }
+
+static int xs_write_queue(struct netfront_dev *nfdev, uint16_t queue_id,
+		xenbus_transaction_t xbt, int write_hierarchical)
+{
+	struct xenbus_device *xendev =3D nfdev->xendev;
+	struct uk_netdev_tx_queue *txq =3D &nfdev->txqs[queue_id];
+	struct uk_netdev_rx_queue *rxq =3D &nfdev->rxqs[queue_id];
+	char *path;
+	int rc;
+
+	if (write_hierarchical) {
+		rc =3D asprintf(&path, "%s/queue-%u", xendev->nodename, queue_id);
+		if (rc < 0)
+			goto out;
+	} else
+		path =3D xendev->nodename;
+
+	rc =3D xs_printf(xbt, path, "tx-ring-ref", "%u", txq->ring_ref);
+	if (rc < 0)
+		goto out_path;
+
+	rc =3D xs_printf(xbt, path, "rx-ring-ref", "%u", rxq->ring_ref);
+	if (rc < 0)
+		goto out_path;
+
+	if (nfdev->split_evtchn) {
+		/* split event channels */
+		rc =3D xs_printf(xbt, path, "event-channel-tx", "%u",
+			txq->evtchn);
+		if (rc < 0)
+			goto out_path;
+
+		rc =3D xs_printf(xbt, path, "event-channel-rx", "%u",
+			rxq->evtchn);
+		if (rc < 0)
+			goto out_path;
+	} else {
+		/* shared event channel */
+		rc =3D xs_printf(xbt, path, "event-channel", "%u",
+			txq->evtchn);
+		if (rc < 0)
+			goto out_path;
+	}
+
+	rc =3D 0;
+
+out_path:
+	if (write_hierarchical)
+		free(path);
+out:
+	return rc;
+}
+
+static void xs_delete_queue(struct netfront_dev *nfdev, uint16_t queue_i=
d,
+		xenbus_transaction_t xbt, int write_hierarchical)
+{
+	struct xenbus_device *xendev =3D nfdev->xendev;
+	char *dir, *path;
+	int rc;
+
+	if (write_hierarchical) {
+		rc =3D asprintf(&dir, "%s/queue-%u", xendev->nodename, queue_id);
+		if (rc < 0)
+			return;
+	} else
+		dir =3D xendev->nodename;
+
+	rc =3D asprintf(&path, "%s/tx-ring-ref", dir);
+	if (rc < 0)
+		goto out;
+	xs_rm(xbt, path);
+	free(path);
+
+	rc =3D asprintf(&path, "%s/rx-ring-ref", dir);
+	if (rc < 0)
+		goto out;
+	xs_rm(xbt, path);
+	free(path);
+
+	if (nfdev->split_evtchn) {
+		/* split event channels */
+		rc =3D asprintf(&path, "%s/event-channel-tx", dir);
+		if (rc < 0)
+			goto out;
+		xs_rm(xbt, path);
+		free(path);
+		rc =3D asprintf(&path, "%s/event-channel-rx", dir);
+		if (rc < 0)
+			goto out;
+		xs_rm(xbt, path);
+		free(path);
+	} else {
+		/* shared event channel */
+		rc =3D asprintf(&path, "%s/event-channel", dir);
+		if (rc < 0)
+			goto out;
+		xs_rm(xbt, path);
+		free(path);
+	}
+
+out:
+	if (write_hierarchical)
+		free(dir);
+}
+
+static int netfront_xb_front_init(struct netfront_dev *nfdev,
+		xenbus_transaction_t xbt)
+{
+	struct xenbus_device *xendev =3D nfdev->xendev;
+	int rc, i;
+
+	if (nfdev->rxqs_num =3D=3D 1) {
+		rc =3D xs_write_queue(nfdev, 0, xbt, 0);
+		if (rc)
+			goto out;
+	} else {
+		for (i =3D 0; i < nfdev->rxqs_num; i++) {
+			rc =3D xs_write_queue(nfdev, i, xbt, 1);
+			if (rc)
+				goto out;
+		}
+	}
+
+	rc =3D xs_printf(xbt, xendev->nodename, "request-rx-copy", "%u", 1);
+	if (rc < 0)
+		goto out;
+
+	rc =3D 0;
+
+out:
+	return rc;
+}
+
+static void netfront_xb_front_fini(struct netfront_dev *nfdev,
+		xenbus_transaction_t xbt)
+{
+	int i;
+
+	if (nfdev->rxqs_num =3D=3D 1)
+		xs_delete_queue(nfdev, 0, xbt, 0);
+	else {
+		for (i =3D 0; i < nfdev->rxqs_num; i++)
+			xs_delete_queue(nfdev, i, xbt, 1);
+	}
+}
+
+int netfront_xb_connect(struct netfront_dev *nfdev)
+{
+	struct xenbus_device *xendev;
+	xenbus_transaction_t xbt;
+	int rc;
+
+	UK_ASSERT(nfdev !=3D NULL);
+
+	xendev =3D nfdev->xendev;
+	UK_ASSERT(xendev !=3D NULL);
+
+again:
+	rc =3D xs_transaction_start(&xbt);
+	if (rc)
+		goto abort_transaction;
+
+	rc =3D netfront_xb_front_init(nfdev, xbt);
+	if (rc)
+		goto abort_transaction;
+
+	rc =3D xenbus_switch_state(xbt, xendev, XenbusStateConnected);
+	if (rc)
+		goto abort_transaction;
+
+	rc =3D xs_transaction_end(xbt, 0);
+	if (rc =3D=3D -EAGAIN)
+		goto again;
+
+	rc =3D netfront_xb_wait_be_connect(nfdev);
+	if (rc)
+		netfront_xb_front_fini(nfdev, xbt);
+
+	return rc;
+
+abort_transaction:
+	xs_transaction_end(xbt, 1);
+
+	return rc;
+}
+
+int netfront_xb_disconnect(struct netfront_dev *nfdev)
+{
+	struct xenbus_device *xendev;
+	int rc;
+
+	UK_ASSERT(nfdev !=3D NULL);
+
+	xendev =3D nfdev->xendev;
+	UK_ASSERT(xendev !=3D NULL);
+
+	uk_pr_debug("Close network: backend at %s\n", xendev->otherend);
+
+	rc =3D xenbus_switch_state(XBT_NIL, xendev, XenbusStateClosing);
+	if (rc)
+		goto out;
+
+	rc =3D netfront_xb_wait_be_disconnect(nfdev);
+	if (rc)
+		goto out;
+
+	netfront_xb_front_fini(nfdev, XBT_NIL);
+
+out:
+	return rc;
+}
+
+static int be_watch_start(struct xenbus_device *xendev, const char *path=
)
+{
+	struct xenbus_watch *watch;
+
+	watch =3D xs_watch_path(XBT_NIL, path);
+	if (PTRISERR(watch))
+		return PTR2ERR(watch);
+
+	xendev->otherend_watch =3D watch;
+
+	return 0;
+}
+
+static int be_watch_stop(struct xenbus_device *xendev)
+{
+	return xs_unwatch(XBT_NIL, xendev->otherend_watch);
+}
+
+#define WAIT_BE_STATE_CHANGE_WHILE_COND(state_cond) \
+	do { \
+		rc =3D xs_read_integer(XBT_NIL, be_state_path, \
+			(int *) &be_state); \
+		if (rc) \
+			goto out; \
+		while (!rc && (state_cond)) \
+			rc =3D xenbus_wait_for_state_change(be_state_path, \
+				&be_state, xendev->otherend_watch); \
+		if (rc) \
+			goto out; \
+	} while (0)
+
+static int netfront_xb_wait_be_connect(struct netfront_dev *nfdev)
+{
+	struct xenbus_device *xendev =3D nfdev->xendev;
+	char be_state_path[strlen(xendev->otherend) + sizeof("/state")];
+	XenbusState be_state;
+	int rc;
+
+	sprintf(be_state_path, "%s/state", xendev->otherend);
+
+	rc =3D be_watch_start(xendev, be_state_path);
+	if (rc)
+		goto out;
+
+	WAIT_BE_STATE_CHANGE_WHILE_COND(be_state < XenbusStateConnected);
+
+	if (be_state !=3D XenbusStateConnected) {
+		uk_pr_err("Backend not available, state=3D%s\n",
+				xenbus_state_to_str(be_state));
+		be_watch_stop(xendev);
+	}
+
+out:
+	return rc;
+}
+
+static int netfront_xb_wait_be_disconnect(struct netfront_dev *nfdev)
+{
+	struct xenbus_device *xendev =3D nfdev->xendev;
+	char be_state_path[strlen(xendev->otherend) + sizeof("/state")];
+	XenbusState be_state;
+	int rc;
+
+	sprintf(be_state_path, "%s/state", xendev->otherend);
+
+	WAIT_BE_STATE_CHANGE_WHILE_COND(be_state < XenbusStateClosing);
+
+	rc =3D xenbus_switch_state(XBT_NIL, xendev, XenbusStateClosed);
+	if (rc)
+		goto out;
+
+	WAIT_BE_STATE_CHANGE_WHILE_COND(be_state < XenbusStateClosed);
+
+	rc =3D xenbus_switch_state(XBT_NIL, xendev, XenbusStateInitialising);
+	if (rc)
+		goto out;
+
+	WAIT_BE_STATE_CHANGE_WHILE_COND(be_state < XenbusStateInitWait ||
+			be_state >=3D XenbusStateClosed);
+
+	be_watch_stop(xendev);
+
+out:
+	return rc;
+}
--=20
2.20.1



From minios-devel-bounces@lists.xenproject.org Thu Aug 13 08:54:13 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Thu, 13 Aug 2020 08:54:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1k6901-0001cU-8U; Thu, 13 Aug 2020 08:54:13 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=QcnS=BX=cs.pub.ro=costin.lupu@srs-us1.protection.inumbo.net>)
 id 1k6900-0001W0-Py
 for minios-devel@lists.xen.org; Thu, 13 Aug 2020 08:54:12 +0000
X-Inumbo-ID: fa19ec67-95b9-4d92-bd92-7ac75043d972
Received: from mx.upb.ro (unknown [141.85.13.210])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id fa19ec67-95b9-4d92-bd92-7ac75043d972;
 Thu, 13 Aug 2020 08:53:53 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
 by mx.upb.ro (Postfix) with ESMTP id DB9A2B561DAD;
 Thu, 13 Aug 2020 11:53:51 +0300 (EEST)
Received: from mx.upb.ro ([127.0.0.1])
 by localhost (mx.upb.ro [127.0.0.1]) (amavisd-new, port 10032)
 with ESMTP id X1GofRMfIIkA; Thu, 13 Aug 2020 11:53:49 +0300 (EEST)
Received: from localhost (localhost [127.0.0.1])
 by mx.upb.ro (Postfix) with ESMTP id E7F2DB561CCA;
 Thu, 13 Aug 2020 11:53:48 +0300 (EEST)
X-Virus-Scanned: amavisd-new at upb.ro
Received: from mx.upb.ro ([127.0.0.1])
 by localhost (mx.upb.ro [127.0.0.1]) (amavisd-new, port 10026)
 with ESMTP id dRJPgR2gSrU8; Thu, 13 Aug 2020 11:53:48 +0300 (EEST)
Received: from localhost.localdomain (unknown [188.25.162.205])
 by mx.upb.ro (Postfix) with ESMTPSA id A6CF6B561D39;
 Thu, 13 Aug 2020 11:53:48 +0300 (EEST)
From: Costin Lupu <costin.lupu@cs.pub.ro>
To: minios-devel@lists.xen.org
Cc: sharan.santhanam@neclab.eu, Razvan Cojocaru <razvan.cojocaru93@gmail.com>
Subject: [UNIKRAFT PATCH v4 06/12] plat/xen/drivers/net: Configure netfront tx
 queue
Date: Thu, 13 Aug 2020 11:53:36 +0300
Message-Id: <20200813085342.29799-7-costin.lupu@cs.pub.ro>
X-Mailer: git-send-email 2.20.1
In-Reply-To: <20200813085342.29799-1-costin.lupu@cs.pub.ro>
References: <20200813085342.29799-1-costin.lupu@cs.pub.ro>
MIME-Version: 1.0
Content-Transfer-Encoding: quoted-printable
X-BeenThere: minios-devel@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Mini-os development list <minios-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:minios-devel@lists.xenproject.org>
List-Help: <mailto:minios-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: minios-devel-bounces@lists.xenproject.org
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>

For each queue, either rx or tx, the packets references are kept in a Xen
shared ring. This patch introduces the initialization of tx shared ring. =
Each
time the driver will send a packet it will add a request on the tx shared=
 ring
which will be serviced by the backend. Therefore we need to keep track of=
 the
requests by keeping track of their IDs. Because our resources are limited=
, we
will maintain a pool of IDs (see `freelist` array) for this purpose.

Signed-off-by: Costin Lupu <costin.lupu@cs.pub.ro>
Signed-off-by: Razvan Cojocaru <razvan.cojocaru93@gmail.com>
---
 plat/xen/drivers/net/netfront.c | 108 ++++++++++++++++++++++++++++++++
 plat/xen/drivers/net/netfront.h |  30 +++++++++
 2 files changed, 138 insertions(+)

diff --git a/plat/xen/drivers/net/netfront.c b/plat/xen/drivers/net/netfr=
ont.c
index ddbb4b70..3c936743 100644
--- a/plat/xen/drivers/net/netfront.c
+++ b/plat/xen/drivers/net/netfront.c
@@ -33,10 +33,12 @@
  * THIS HEADER MAY NOT BE EXTRACTED OR MODIFIED IN ANY WAY.
  */
=20
+#include <string.h>
 #include <uk/assert.h>
 #include <uk/print.h>
 #include <uk/alloc.h>
 #include <uk/netdev_driver.h>
+#include <xen-x86/mm.h>
 #include <xenbus/xenbus.h>
 #include "netfront.h"
 #include "netfront_xb.h"
@@ -49,6 +51,83 @@
=20
 static struct uk_alloc *drv_allocator;
=20
+
+static void add_id_to_freelist(uint16_t id, uint16_t *freelist)
+{
+	freelist[id + 1] =3D freelist[0];
+	freelist[0]  =3D id;
+}
+
+static uint16_t get_id_from_freelist(uint16_t *freelist)
+{
+	uint16_t id;
+
+	id =3D freelist[0];
+	freelist[0] =3D freelist[id + 1];
+	return id;
+}
+
+static struct uk_netdev_tx_queue *netfront_txq_setup(struct uk_netdev *n=
,
+		uint16_t queue_id,
+		uint16_t nb_desc __unused,
+		struct uk_netdev_txqueue_conf *conf __unused)
+{
+	int rc;
+	struct netfront_dev *nfdev;
+	struct uk_netdev_tx_queue *txq;
+	netif_tx_sring_t *sring;
+
+	UK_ASSERT(n !=3D NULL);
+
+	nfdev =3D to_netfront_dev(n);
+	if (queue_id >=3D nfdev->max_queue_pairs) {
+		uk_pr_err("Invalid queue identifier: %"__PRIu16"\n", queue_id);
+		return ERR2PTR(-EINVAL);
+	}
+
+	txq  =3D &nfdev->txqs[queue_id];
+	UK_ASSERT(!txq->initialized);
+	txq->netfront_dev =3D nfdev;
+	txq->lqueue_id =3D queue_id;
+
+	/* Setup shared ring */
+	sring =3D uk_palloc(drv_allocator, 1);
+	if (!sring)
+		return ERR2PTR(-ENOMEM);
+	memset(sring, 0, PAGE_SIZE);
+	SHARED_RING_INIT(sring);
+	FRONT_RING_INIT(&txq->ring, sring, PAGE_SIZE);
+	txq->ring_size =3D NET_TX_RING_SIZE;
+	txq->ring_ref =3D gnttab_grant_access(nfdev->xendev->otherend_id,
+		virt_to_mfn(sring), 0);
+	UK_ASSERT(txq->ring_ref !=3D GRANT_INVALID_REF);
+
+	/* Setup event channel */
+	rc =3D evtchn_alloc_unbound(nfdev->xendev->otherend_id,
+			NULL, NULL,
+			&txq->evtchn);
+	if (rc) {
+		uk_pr_err("Error creating event channel: %d\n", rc);
+		gnttab_end_access(txq->ring_ref);
+		uk_pfree(drv_allocator, sring, 1);
+		return ERR2PTR(-rc);
+	}
+	/* Events are always disabled for tx queue */
+	mask_evtchn(txq->evtchn);
+
+	/* Initialize list of request ids */
+	uk_semaphore_init(&txq->sem, NET_TX_RING_SIZE);
+	for (uint16_t i =3D 0; i < NET_TX_RING_SIZE; i++) {
+		add_id_to_freelist(i, txq->freelist);
+		txq->gref[i] =3D GRANT_INVALID_REF;
+	}
+
+	txq->initialized =3D true;
+	nfdev->txqs_num++;
+
+	return txq;
+}
+
 static int netfront_rxtx_alloc(struct netfront_dev *nfdev,
 		const struct uk_netdev_conf *conf)
 {
@@ -90,6 +169,33 @@ err_free_txrx:
 	return rc;
 }
=20
+static int netfront_txq_info_get(struct uk_netdev *n,
+		uint16_t queue_id,
+		struct uk_netdev_queue_info *qinfo)
+{
+	struct netfront_dev *nfdev;
+	struct uk_netdev_tx_queue *txq;
+	int rc =3D 0;
+
+	UK_ASSERT(n !=3D NULL);
+	UK_ASSERT(qinfo !=3D NULL);
+
+	nfdev =3D to_netfront_dev(n);
+	if (unlikely(queue_id >=3D nfdev->txqs_num)) {
+		uk_pr_err("Invalid queue_id %"__PRIu16"\n", queue_id);
+		rc =3D -EINVAL;
+		goto exit;
+	}
+	txq =3D &nfdev->txqs[queue_id];
+	qinfo->nb_min =3D txq->ring_size;
+	qinfo->nb_max =3D txq->ring_size;
+	qinfo->nb_align =3D PAGE_SIZE;
+	qinfo->nb_is_power_of_two =3D 1;
+
+exit:
+	return rc;
+}
+
 static int netfront_configure(struct uk_netdev *n,
 		const struct uk_netdev_conf *conf)
 {
@@ -179,6 +285,8 @@ static unsigned int netfront_promisc_get(struct uk_ne=
tdev *n)
=20
 static const struct uk_netdev_ops netfront_ops =3D {
 	.configure =3D netfront_configure,
+	.txq_configure =3D netfront_txq_setup,
+	.txq_info_get =3D netfront_txq_info_get,
 	.info_get =3D netfront_info_get,
 	.einfo_get =3D netfront_einfo_get,
 	.hwaddr_get =3D netfront_mac_get,
diff --git a/plat/xen/drivers/net/netfront.h b/plat/xen/drivers/net/netfr=
ont.h
index a811b092..d3f603b3 100644
--- a/plat/xen/drivers/net/netfront.h
+++ b/plat/xen/drivers/net/netfront.h
@@ -37,11 +37,40 @@
 #define __NETFRONT_H__
=20
 #include <uk/netdev.h>
+#include <uk/semaphore.h>
+#include <xen/io/netif.h>
+#include <common/gnttab.h>
+#include <common/events.h>
+
+
+#define NET_TX_RING_SIZE __CONST_RING_SIZE(netif_tx, PAGE_SIZE)
=20
 /**
  * internal structure to represent the transmit queue.
  */
 struct uk_netdev_tx_queue {
+	/* The netfront device */
+	struct netfront_dev *netfront_dev;
+	/* The libuknet queue identifier */
+	uint16_t lqueue_id;
+	/* True if initialized */
+	bool initialized;
+
+	/* Shared ring size */
+	uint16_t ring_size;
+	/* Shared ring */
+	netif_tx_front_ring_t ring;
+	/* Shared ring grant ref */
+	grant_ref_t ring_ref;
+	/* Queue event channel */
+	evtchn_port_t evtchn;
+
+	/* Free list protecting semaphore */
+	struct uk_semaphore sem;
+	/* Free list of transmitting request IDs */
+	uint16_t freelist[NET_TX_RING_SIZE + 1];
+	/* Grants for transmit buffers */
+	grant_ref_t gref[NET_TX_RING_SIZE];
 };
=20
 /**
@@ -63,6 +92,7 @@ struct netfront_dev {
 	struct uk_netdev netdev;
=20
 	/* List of the Rx/Tx queues */
+	uint16_t txqs_num;
 	struct uk_netdev_tx_queue *txqs;
 	struct uk_netdev_rx_queue *rxqs;
 	/* Maximum number of queue pairs */
--=20
2.20.1



From minios-devel-bounces@lists.xenproject.org Thu Aug 13 08:54:18 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Thu, 13 Aug 2020 08:54:18 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1k6906-0001es-B9; Thu, 13 Aug 2020 08:54:18 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=QcnS=BX=cs.pub.ro=costin.lupu@srs-us1.protection.inumbo.net>)
 id 1k6905-0001W0-QA
 for minios-devel@lists.xen.org; Thu, 13 Aug 2020 08:54:17 +0000
X-Inumbo-ID: 5370791f-28d1-4c2e-b967-31b6f5e748ea
Received: from mx.upb.ro (unknown [141.85.13.240])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 5370791f-28d1-4c2e-b967-31b6f5e748ea;
 Thu, 13 Aug 2020 08:53:53 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
 by mx.upb.ro (Postfix) with ESMTP id F1A77B561CCA;
 Thu, 13 Aug 2020 11:53:51 +0300 (EEST)
Received: from mx.upb.ro ([127.0.0.1])
 by localhost (mx.upb.ro [127.0.0.1]) (amavisd-new, port 10032)
 with ESMTP id yjSJZ3lKw88a; Thu, 13 Aug 2020 11:53:49 +0300 (EEST)
Received: from localhost (localhost [127.0.0.1])
 by mx.upb.ro (Postfix) with ESMTP id B66A0B561D40;
 Thu, 13 Aug 2020 11:53:48 +0300 (EEST)
X-Virus-Scanned: amavisd-new at upb.ro
Received: from mx.upb.ro ([127.0.0.1])
 by localhost (mx.upb.ro [127.0.0.1]) (amavisd-new, port 10026)
 with ESMTP id BjxTzR8Jb9UO; Thu, 13 Aug 2020 11:53:48 +0300 (EEST)
Received: from localhost.localdomain (unknown [188.25.162.205])
 by mx.upb.ro (Postfix) with ESMTPSA id 65A68B561CCA;
 Thu, 13 Aug 2020 11:53:48 +0300 (EEST)
From: Costin Lupu <costin.lupu@cs.pub.ro>
To: minios-devel@lists.xen.org
Cc: sharan.santhanam@neclab.eu, Razvan Cojocaru <razvan.cojocaru93@gmail.com>
Subject: [UNIKRAFT PATCH v4 05/12] plat/xen/drivers/net: Create netfront queues
Date: Thu, 13 Aug 2020 11:53:35 +0300
Message-Id: <20200813085342.29799-6-costin.lupu@cs.pub.ro>
X-Mailer: git-send-email 2.20.1
In-Reply-To: <20200813085342.29799-1-costin.lupu@cs.pub.ro>
References: <20200813085342.29799-1-costin.lupu@cs.pub.ro>
MIME-Version: 1.0
Content-Transfer-Encoding: quoted-printable
X-BeenThere: minios-devel@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Mini-os development list <minios-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:minios-devel@lists.xenproject.org>
List-Help: <mailto:minios-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: minios-devel-bounces@lists.xenproject.org
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>

We continue with the device configuration by retrieving the Xenstore
information regarding the number of queues and their associated event cha=
nnels.
Netfront devices operate pairs of Rx/Tx queues and for notifications we c=
an
either use a single event channel per pair or split event channels.

Signed-off-by: Costin Lupu <costin.lupu@cs.pub.ro>
Signed-off-by: Razvan Cojocaru <razvan.cojocaru93@gmail.com>
---
 plat/xen/drivers/net/netfront.c    | 81 ++++++++++++++++++++++++++++++
 plat/xen/drivers/net/netfront.h    | 20 ++++++++
 plat/xen/drivers/net/netfront_xs.c | 18 ++++++-
 3 files changed, 117 insertions(+), 2 deletions(-)

diff --git a/plat/xen/drivers/net/netfront.c b/plat/xen/drivers/net/netfr=
ont.c
index 539e1cbc..ddbb4b70 100644
--- a/plat/xen/drivers/net/netfront.c
+++ b/plat/xen/drivers/net/netfront.c
@@ -49,6 +49,84 @@
=20
 static struct uk_alloc *drv_allocator;
=20
+static int netfront_rxtx_alloc(struct netfront_dev *nfdev,
+		const struct uk_netdev_conf *conf)
+{
+	int rc =3D 0;
+
+	if (conf->nb_tx_queues !=3D conf->nb_rx_queues) {
+		uk_pr_err("Different number of queues not supported\n");
+		rc =3D -ENOTSUP;
+		goto err_free_txrx;
+	}
+
+	nfdev->max_queue_pairs =3D
+		MIN(nfdev->max_queue_pairs, conf->nb_tx_queues);
+
+	nfdev->txqs =3D uk_calloc(drv_allocator,
+		nfdev->max_queue_pairs, sizeof(*nfdev->txqs));
+	if (unlikely(!nfdev->txqs)) {
+		uk_pr_err("Failed to allocate memory for tx queues\n");
+		rc =3D -ENOMEM;
+		goto err_free_txrx;
+	}
+
+	nfdev->rxqs =3D uk_calloc(drv_allocator,
+		nfdev->max_queue_pairs, sizeof(*nfdev->rxqs));
+	if (unlikely(!nfdev->rxqs)) {
+		uk_pr_err("Failed to allocate memory for rx queues\n");
+		rc =3D -ENOMEM;
+		goto err_free_txrx;
+	}
+
+	return rc;
+
+err_free_txrx:
+	if (!nfdev->rxqs)
+		uk_free(drv_allocator, nfdev->rxqs);
+	if (!nfdev->txqs)
+		uk_free(drv_allocator, nfdev->txqs);
+
+	return rc;
+}
+
+static int netfront_configure(struct uk_netdev *n,
+		const struct uk_netdev_conf *conf)
+{
+	int rc;
+	struct netfront_dev *nfdev;
+
+	UK_ASSERT(n !=3D NULL);
+	UK_ASSERT(conf !=3D NULL);
+
+	nfdev =3D to_netfront_dev(n);
+
+	rc =3D netfront_rxtx_alloc(nfdev, conf);
+	if (rc !=3D 0) {
+		uk_pr_err("Failed to allocate rx and tx rings %d\n", rc);
+		goto out;
+	}
+
+out:
+	return rc;
+}
+
+static void netfront_info_get(struct uk_netdev *n,
+		struct uk_netdev_info *dev_info)
+{
+	struct netfront_dev *nfdev;
+
+	UK_ASSERT(n !=3D NULL);
+	UK_ASSERT(dev_info !=3D NULL);
+
+	nfdev =3D to_netfront_dev(n);
+	dev_info->max_rx_queues =3D nfdev->max_queue_pairs;
+	dev_info->max_tx_queues =3D nfdev->max_queue_pairs;
+	dev_info->max_mtu =3D nfdev->mtu;
+	dev_info->nb_encap_tx =3D 0;
+	dev_info->nb_encap_rx =3D 0;
+}
+
 static const void *netfront_einfo_get(struct uk_netdev *n,
 		enum uk_netdev_einfo_type einfo_type)
 {
@@ -100,6 +178,8 @@ static unsigned int netfront_promisc_get(struct uk_ne=
tdev *n)
 }
=20
 static const struct uk_netdev_ops netfront_ops =3D {
+	.configure =3D netfront_configure,
+	.info_get =3D netfront_info_get,
 	.einfo_get =3D netfront_einfo_get,
 	.hwaddr_get =3D netfront_mac_get,
 	.mtu_get =3D netfront_mtu_get,
@@ -121,6 +201,7 @@ static int netfront_add_dev(struct xenbus_device *xen=
dev)
=20
 	nfdev->xendev =3D xendev;
 	nfdev->mtu =3D ETH_PKT_PAYLOAD_LEN;
+	nfdev->max_queue_pairs =3D 1;
=20
 	/* Xenbus initialization */
 	rc =3D netfront_xb_init(nfdev, drv_allocator);
diff --git a/plat/xen/drivers/net/netfront.h b/plat/xen/drivers/net/netfr=
ont.h
index 0cc8230b..a811b092 100644
--- a/plat/xen/drivers/net/netfront.h
+++ b/plat/xen/drivers/net/netfront.h
@@ -38,6 +38,18 @@
=20
 #include <uk/netdev.h>
=20
+/**
+ * internal structure to represent the transmit queue.
+ */
+struct uk_netdev_tx_queue {
+};
+
+/**
+ * internal structure to represent the receive queue.
+ */
+struct uk_netdev_rx_queue {
+};
+
 struct xs_econf {
 	char *ipv4addr;
 	char *ipv4mask;
@@ -50,6 +62,14 @@ struct netfront_dev {
 	/* Network device */
 	struct uk_netdev netdev;
=20
+	/* List of the Rx/Tx queues */
+	struct uk_netdev_tx_queue *txqs;
+	struct uk_netdev_rx_queue *rxqs;
+	/* Maximum number of queue pairs */
+	uint16_t  max_queue_pairs;
+	/* True if using split event channels */
+	bool split_evtchn;
+
 	/* Configuration parameters */
 	struct xs_econf econf;
=20
diff --git a/plat/xen/drivers/net/netfront_xs.c b/plat/xen/drivers/net/ne=
tfront_xs.c
index 48f01b34..1bde44e0 100644
--- a/plat/xen/drivers/net/netfront_xs.c
+++ b/plat/xen/drivers/net/netfront_xs.c
@@ -122,7 +122,7 @@ out_err:
 int netfront_xb_init(struct netfront_dev *nfdev, struct uk_alloc *a)
 {
 	struct xenbus_device *xendev;
-	char *mac_str, *p, *ip_str;
+	char *mac_str, *p, *ip_str, *int_str;
 	int rc;
=20
 	UK_ASSERT(nfdev !=3D NULL);
@@ -173,7 +173,21 @@ int netfront_xb_init(struct netfront_dev *nfdev, str=
uct uk_alloc *a)
 		goto no_conf;
 	free(ip_str);
=20
-	/* TODO spit event channels */
+	/* maximum queues number */
+	int_str =3D xs_read(XBT_NIL, xendev->otherend,
+		"multi-queue-max-queues");
+	if (!PTRISERR(int_str)) {
+		nfdev->max_queue_pairs =3D (uint16_t) strtoul(int_str, NULL, 10);
+		free(int_str);
+	}
+
+	/* spit event channels */
+	int_str =3D xs_read(XBT_NIL, xendev->otherend,
+		"feature-split-event-channels");
+	if (!PTRISERR(int_str)) {
+		nfdev->split_evtchn =3D (bool) strtoul(int_str, NULL, 10);
+		free(int_str);
+	}
=20
 	/* TODO netmap */
=20
--=20
2.20.1



From minios-devel-bounces@lists.xenproject.org Thu Aug 13 08:54:23 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Thu, 13 Aug 2020 08:54:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1k690B-0001fx-D4; Thu, 13 Aug 2020 08:54:23 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=QcnS=BX=cs.pub.ro=costin.lupu@srs-us1.protection.inumbo.net>)
 id 1k690A-0001W0-QL
 for minios-devel@lists.xen.org; Thu, 13 Aug 2020 08:54:22 +0000
X-Inumbo-ID: 552812fa-d5e7-411d-8622-a9b4c66f7cc6
Received: from mx.upb.ro (unknown [141.85.13.240])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 552812fa-d5e7-411d-8622-a9b4c66f7cc6;
 Thu, 13 Aug 2020 08:53:54 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
 by mx.upb.ro (Postfix) with ESMTP id 011CBB561D3A;
 Thu, 13 Aug 2020 11:53:53 +0300 (EEST)
Received: from mx.upb.ro ([127.0.0.1])
 by localhost (mx.upb.ro [127.0.0.1]) (amavisd-new, port 10032)
 with ESMTP id u77IJsMQcUpk; Thu, 13 Aug 2020 11:53:50 +0300 (EEST)
Received: from localhost (localhost [127.0.0.1])
 by mx.upb.ro (Postfix) with ESMTP id 11C8EB561DA8;
 Thu, 13 Aug 2020 11:53:50 +0300 (EEST)
X-Virus-Scanned: amavisd-new at upb.ro
Received: from mx.upb.ro ([127.0.0.1])
 by localhost (mx.upb.ro [127.0.0.1]) (amavisd-new, port 10026)
 with ESMTP id YGuQw1-lS8E2; Thu, 13 Aug 2020 11:53:49 +0300 (EEST)
Received: from localhost.localdomain (unknown [188.25.162.205])
 by mx.upb.ro (Postfix) with ESMTPSA id C582CB561D39;
 Thu, 13 Aug 2020 11:53:49 +0300 (EEST)
From: Costin Lupu <costin.lupu@cs.pub.ro>
To: minios-devel@lists.xen.org
Cc: sharan.santhanam@neclab.eu, Razvan Cojocaru <razvan.cojocaru93@gmail.com>
Subject: [UNIKRAFT PATCH v4 10/12] plat/xen/drivers/net: Add transmit operation
Date: Thu, 13 Aug 2020 11:53:40 +0300
Message-Id: <20200813085342.29799-11-costin.lupu@cs.pub.ro>
X-Mailer: git-send-email 2.20.1
In-Reply-To: <20200813085342.29799-1-costin.lupu@cs.pub.ro>
References: <20200813085342.29799-1-costin.lupu@cs.pub.ro>
MIME-Version: 1.0
Content-Transfer-Encoding: quoted-printable
X-BeenThere: minios-devel@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Mini-os development list <minios-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:minios-devel@lists.xenproject.org>
List-Help: <mailto:minios-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: minios-devel-bounces@lists.xenproject.org
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>

Whenever a packet is transmitted, the request describing it is written in=
 the
shared ring. The packet itself is written in a page referenced by the req=
uest
and shared, as well, with the backend. At the end of each transmit operat=
ion, a
cleanup operation is performed free'ing the resources allocated for the
previously transmitted packets.

Signed-off-by: Costin Lupu <costin.lupu@cs.pub.ro>
Signed-off-by: Razvan Cojocaru <razvan.cojocaru93@gmail.com>
---
 plat/xen/drivers/net/netfront.c | 102 ++++++++++++++++++++++++++++++++
 1 file changed, 102 insertions(+)

diff --git a/plat/xen/drivers/net/netfront.c b/plat/xen/drivers/net/netfr=
ont.c
index 858d124a..f2b81329 100644
--- a/plat/xen/drivers/net/netfront.c
+++ b/plat/xen/drivers/net/netfront.c
@@ -39,6 +39,7 @@
 #include <uk/alloc.h>
 #include <uk/netdev_driver.h>
 #include <xen-x86/mm.h>
+#include <xen-x86/irq.h>
 #include <xenbus/xenbus.h>
 #include "netfront.h"
 #include "netfront_xb.h"
@@ -78,6 +79,106 @@ static uint16_t get_id_from_freelist(uint16_t *freeli=
st)
 	return id;
 }
=20
+static int network_tx_buf_gc(struct uk_netdev_tx_queue *txq)
+{
+	RING_IDX prod, cons;
+	netif_tx_response_t *tx_rsp;
+	uint16_t id;
+	bool more_to_do;
+	int count =3D 0;
+
+	do {
+		prod =3D txq->ring.sring->rsp_prod;
+		rmb(); /* Ensure we see responses up to 'rp'. */
+
+		for (cons =3D txq->ring.rsp_cons; cons !=3D prod; cons++) {
+			tx_rsp =3D RING_GET_RESPONSE(&txq->ring, cons);
+
+			if (tx_rsp->status =3D=3D NETIF_RSP_NULL)
+				continue;
+
+			if (tx_rsp->status =3D=3D NETIF_RSP_ERROR)
+				uk_pr_err("packet error\n");
+
+			id  =3D tx_rsp->id;
+			UK_ASSERT(id < NET_TX_RING_SIZE);
+
+			gnttab_end_access(txq->gref[id]);
+			txq->gref[id] =3D GRANT_INVALID_REF;
+
+			add_id_to_freelist(id, txq->freelist);
+			uk_semaphore_up(&txq->sem);
+
+			count++;
+		}
+
+		txq->ring.rsp_cons =3D prod;
+
+		RING_FINAL_CHECK_FOR_RESPONSES(&txq->ring, more_to_do);
+	} while (more_to_do);
+
+	return count;
+}
+
+static int netfront_xmit(struct uk_netdev *n,
+		struct uk_netdev_tx_queue *txq,
+		struct uk_netbuf *pkt)
+{
+	struct netfront_dev *nfdev;
+	unsigned long flags;
+	uint16_t id;
+	RING_IDX req_prod;
+	netif_tx_request_t *tx_req;
+	int notify;
+	int status =3D 0, count;
+
+	UK_ASSERT(n !=3D NULL);
+	UK_ASSERT(txq !=3D NULL);
+	UK_ASSERT(pkt !=3D NULL);
+	UK_ASSERT(pkt->len < PAGE_SIZE);
+
+	nfdev =3D to_netfront_dev(n);
+
+	/* get request id */
+	uk_semaphore_down(&txq->sem);
+	local_irq_save(flags);
+	id =3D get_id_from_freelist(txq->freelist);
+	local_irq_restore(flags);
+
+	/* get request */
+	req_prod =3D txq->ring.req_prod_pvt;
+	tx_req =3D RING_GET_REQUEST(&txq->ring, req_prod);
+
+	/* setup grant for buffer data */
+	txq->gref[id] =3D tx_req->gref =3D
+		gnttab_grant_access(nfdev->xendev->otherend_id,
+			virt_to_mfn(pkt->data), 1);
+	UK_ASSERT(tx_req->gref !=3D GRANT_INVALID_REF);
+
+	tx_req->offset =3D 0;
+	tx_req->size =3D (uint16_t) pkt->len;
+	tx_req->flags =3D 0;
+	tx_req->id =3D id;
+
+	txq->ring.req_prod_pvt =3D req_prod + 1;
+	wmb(); /* Ensure backend sees requests */
+
+	RING_PUSH_REQUESTS_AND_CHECK_NOTIFY(&txq->ring, notify);
+	if (notify)
+		notify_remote_via_evtchn(txq->evtchn);
+
+	status |=3D UK_NETDEV_STATUS_SUCCESS;
+
+	/* some cleanup */
+	local_irq_save(flags);
+	count =3D network_tx_buf_gc(txq);
+	local_irq_restore(flags);
+
+	status |=3D likely(count > 0) ? UK_NETDEV_STATUS_MORE : 0x0;
+
+	return status;
+}
+
 static int netfront_rxq_enqueue(struct uk_netdev_rx_queue *rxq,
 		struct uk_netbuf *netbuf)
 {
@@ -598,6 +699,7 @@ static int netfront_add_dev(struct xenbus_device *xen=
dev)
 	}
=20
 	/* register netdev */
+	nfdev->netdev.tx_one =3D netfront_xmit;
 	nfdev->netdev.ops =3D &netfront_ops;
 	rc =3D uk_netdev_drv_register(&nfdev->netdev, drv_allocator, DRIVER_NAM=
E);
 	if (rc < 0) {
--=20
2.20.1



From minios-devel-bounces@lists.xenproject.org Thu Aug 13 08:54:28 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Thu, 13 Aug 2020 08:54:28 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1k690G-0001gy-Eo; Thu, 13 Aug 2020 08:54:28 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=QcnS=BX=cs.pub.ro=costin.lupu@srs-us1.protection.inumbo.net>)
 id 1k690F-0001W0-QS
 for minios-devel@lists.xen.org; Thu, 13 Aug 2020 08:54:27 +0000
X-Inumbo-ID: 5e5d2939-280a-473f-91f8-15804eaffa92
Received: from mx.upb.ro (unknown [141.85.13.220])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 5e5d2939-280a-473f-91f8-15804eaffa92;
 Thu, 13 Aug 2020 08:53:54 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
 by mx.upb.ro (Postfix) with ESMTP id 182C2B561DA8;
 Thu, 13 Aug 2020 11:53:53 +0300 (EEST)
Received: from mx.upb.ro ([127.0.0.1])
 by localhost (mx.upb.ro [127.0.0.1]) (amavisd-new, port 10032)
 with ESMTP id JNIdCx4Ab6dZ; Thu, 13 Aug 2020 11:53:50 +0300 (EEST)
Received: from localhost (localhost [127.0.0.1])
 by mx.upb.ro (Postfix) with ESMTP id 564A4B561DB0;
 Thu, 13 Aug 2020 11:53:50 +0300 (EEST)
X-Virus-Scanned: amavisd-new at upb.ro
Received: from mx.upb.ro ([127.0.0.1])
 by localhost (mx.upb.ro [127.0.0.1]) (amavisd-new, port 10026)
 with ESMTP id Qftna9TfuEyo; Thu, 13 Aug 2020 11:53:50 +0300 (EEST)
Received: from localhost.localdomain (unknown [188.25.162.205])
 by mx.upb.ro (Postfix) with ESMTPSA id 14823B561DAD;
 Thu, 13 Aug 2020 11:53:49 +0300 (EEST)
From: Costin Lupu <costin.lupu@cs.pub.ro>
To: minios-devel@lists.xen.org
Cc: sharan.santhanam@neclab.eu, Razvan Cojocaru <razvan.cojocaru93@gmail.com>
Subject: [UNIKRAFT PATCH v4 11/12] plat/xen/drivers/net: Add receive operation
Date: Thu, 13 Aug 2020 11:53:41 +0300
Message-Id: <20200813085342.29799-12-costin.lupu@cs.pub.ro>
X-Mailer: git-send-email 2.20.1
In-Reply-To: <20200813085342.29799-1-costin.lupu@cs.pub.ro>
References: <20200813085342.29799-1-costin.lupu@cs.pub.ro>
MIME-Version: 1.0
Content-Transfer-Encoding: quoted-printable
X-BeenThere: minios-devel@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Mini-os development list <minios-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:minios-devel@lists.xenproject.org>
List-Help: <mailto:minios-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: minios-devel-bounces@lists.xenproject.org
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>

Incoming packets are written in pages allocated by the netfront. Such pag=
es are
allocated and registered to the shared ring after completion of receiving
operations.

Signed-off-by: Costin Lupu <costin.lupu@cs.pub.ro>
Signed-off-by: Razvan Cojocaru <razvan.cojocaru93@gmail.com>
---
 plat/xen/drivers/net/netfront.c | 100 ++++++++++++++++++++++++++++++++
 1 file changed, 100 insertions(+)

diff --git a/plat/xen/drivers/net/netfront.c b/plat/xen/drivers/net/netfr=
ont.c
index f2b81329..101e38c8 100644
--- a/plat/xen/drivers/net/netfront.c
+++ b/plat/xen/drivers/net/netfront.c
@@ -221,6 +221,49 @@ static int netfront_rxq_enqueue(struct uk_netdev_rx_=
queue *rxq,
 	return 0;
 }
=20
+static int netfront_rxq_dequeue(struct uk_netdev_rx_queue *rxq,
+		struct uk_netbuf **netbuf)
+{
+	RING_IDX prod, cons;
+	netif_rx_response_t *rx_rsp;
+	uint16_t len, id;
+	struct uk_netbuf *buf =3D NULL;
+	int count =3D 0;
+
+	UK_ASSERT(rxq !=3D NULL);
+	UK_ASSERT(netbuf !=3D NULL);
+
+	prod =3D rxq->ring.sring->rsp_prod;
+	rmb(); /* Ensure we see queued responses up to 'rp'. */
+	cons =3D rxq->ring.rsp_cons;
+	/* No new descriptor since last dequeue operation */
+	if (cons =3D=3D prod)
+		goto out;
+
+	/* get response */
+	rx_rsp =3D RING_GET_RESPONSE(&rxq->ring, cons);
+	UK_ASSERT(rx_rsp->status > NETIF_RSP_NULL);
+	id =3D rx_rsp->id;
+	UK_ASSERT(id < NET_RX_RING_SIZE);
+
+	/* remove grant for buffer data */
+	gnttab_end_access(rxq->gref[id]);
+
+	buf =3D rxq->netbuf[id];
+	len =3D (uint16_t) rx_rsp->status;
+	if (len > ETH_PKT_LEN)
+		len =3D ETH_PKT_LEN;
+	buf->len =3D len;
+
+	*netbuf =3D buf;
+
+	rxq->ring.rsp_cons++;
+	count =3D 1;
+
+out:
+	return count;
+}
+
 static int netfront_rx_fillup(struct uk_netdev_rx_queue *rxq, uint16_t n=
b_desc)
 {
 	struct uk_netbuf *netbuf[nb_desc];
@@ -271,6 +314,62 @@ static int netfront_rxq_intr_enable(struct uk_netdev=
_rx_queue *rxq)
 	return (more > 0);
 }
=20
+static int netfront_recv(struct uk_netdev *n,
+		struct uk_netdev_rx_queue *rxq,
+		struct uk_netbuf **pkt)
+{
+	int rc, status =3D 0;
+
+	UK_ASSERT(n !=3D NULL);
+	UK_ASSERT(rxq !=3D NULL);
+	UK_ASSERT(pkt !=3D NULL);
+
+	/* Queue interrupts have to be off when calling receive */
+	UK_ASSERT(!(rxq->intr_enabled & NETFRONT_INTR_EN));
+
+	rc =3D netfront_rxq_dequeue(rxq, pkt);
+	UK_ASSERT(rc >=3D 0);
+
+	status |=3D (*pkt) ? UK_NETDEV_STATUS_SUCCESS : 0x0;
+	status |=3D netfront_rx_fillup(rxq, rc);
+
+	/* Enable interrupt only when user had previously enabled it */
+	if (rxq->intr_enabled & NETFRONT_INTR_USR_EN_MASK) {
+		/* Need to enable the interrupt on the last packet */
+		rc =3D netfront_rxq_intr_enable(rxq);
+		if (rc =3D=3D 1 && !(*pkt)) {
+			/**
+			 * Packet arrive after reading the queue and before
+			 * enabling the interrupt
+			 */
+			rc =3D netfront_rxq_dequeue(rxq, pkt);
+			UK_ASSERT(rc >=3D 0);
+			status |=3D UK_NETDEV_STATUS_SUCCESS;
+
+			/*
+			 * Since we received something, we need to fillup
+			 * and notify
+			 */
+			status |=3D netfront_rx_fillup(rxq, rc);
+
+			/* Need to enable the interrupt on the last packet */
+			rc =3D netfront_rxq_intr_enable(rxq);
+			status |=3D (rc =3D=3D 1) ? UK_NETDEV_STATUS_MORE : 0x0;
+		} else if (*pkt) {
+			/* When we originally got a packet and there is more */
+			status |=3D (rc =3D=3D 1) ? UK_NETDEV_STATUS_MORE : 0x0;
+		}
+	} else if (*pkt) {
+		/**
+		 * For polling case, we report always there are further
+		 * packets unless the queue is empty.
+		 */
+		status |=3D UK_NETDEV_STATUS_MORE;
+	}
+
+	return status;
+}
+
 static struct uk_netdev_tx_queue *netfront_txq_setup(struct uk_netdev *n=
,
 		uint16_t queue_id,
 		uint16_t nb_desc __unused,
@@ -700,6 +799,7 @@ static int netfront_add_dev(struct xenbus_device *xen=
dev)
=20
 	/* register netdev */
 	nfdev->netdev.tx_one =3D netfront_xmit;
+	nfdev->netdev.rx_one =3D netfront_recv;
 	nfdev->netdev.ops =3D &netfront_ops;
 	rc =3D uk_netdev_drv_register(&nfdev->netdev, drv_allocator, DRIVER_NAM=
E);
 	if (rc < 0) {
--=20
2.20.1



From minios-devel-bounces@lists.xenproject.org Thu Aug 13 08:54:33 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Thu, 13 Aug 2020 08:54:33 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1k690L-0001ht-GS; Thu, 13 Aug 2020 08:54:33 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=QcnS=BX=cs.pub.ro=costin.lupu@srs-us1.protection.inumbo.net>)
 id 1k690K-0001W0-Qn
 for minios-devel@lists.xen.org; Thu, 13 Aug 2020 08:54:32 +0000
X-Inumbo-ID: a755537d-9ace-4132-b8ef-51832fc06f74
Received: from mx.upb.ro (unknown [141.85.13.230])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id a755537d-9ace-4132-b8ef-51832fc06f74;
 Thu, 13 Aug 2020 08:53:55 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
 by mx.upb.ro (Postfix) with ESMTP id AF5E9B561D1A;
 Thu, 13 Aug 2020 11:53:53 +0300 (EEST)
Received: from mx.upb.ro ([127.0.0.1])
 by localhost (mx.upb.ro [127.0.0.1]) (amavisd-new, port 10032)
 with ESMTP id t9FF2m2Ye9Sm; Thu, 13 Aug 2020 11:53:50 +0300 (EEST)
Received: from localhost (localhost [127.0.0.1])
 by mx.upb.ro (Postfix) with ESMTP id 4D6A5B561D4A;
 Thu, 13 Aug 2020 11:53:49 +0300 (EEST)
X-Virus-Scanned: amavisd-new at upb.ro
Received: from mx.upb.ro ([127.0.0.1])
 by localhost (mx.upb.ro [127.0.0.1]) (amavisd-new, port 10026)
 with ESMTP id YYtZmHSmHnGe; Thu, 13 Aug 2020 11:53:49 +0300 (EEST)
Received: from localhost.localdomain (unknown [188.25.162.205])
 by mx.upb.ro (Postfix) with ESMTPSA id E8164B561D48;
 Thu, 13 Aug 2020 11:53:48 +0300 (EEST)
From: Costin Lupu <costin.lupu@cs.pub.ro>
To: minios-devel@lists.xen.org
Cc: sharan.santhanam@neclab.eu, Razvan Cojocaru <razvan.cojocaru93@gmail.com>
Subject: [UNIKRAFT PATCH v4 07/12] plat/xen/drivers/net: Configure netfront rx
 queue
Date: Thu, 13 Aug 2020 11:53:37 +0300
Message-Id: <20200813085342.29799-8-costin.lupu@cs.pub.ro>
X-Mailer: git-send-email 2.20.1
In-Reply-To: <20200813085342.29799-1-costin.lupu@cs.pub.ro>
References: <20200813085342.29799-1-costin.lupu@cs.pub.ro>
MIME-Version: 1.0
Content-Transfer-Encoding: quoted-printable
X-BeenThere: minios-devel@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Mini-os development list <minios-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:minios-devel@lists.xenproject.org>
List-Help: <mailto:minios-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: minios-devel-bounces@lists.xenproject.org
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>

Incoming packets are saved in buffers allocated with user-provided callba=
cks.
Whenever such packet is available, the driver is notified via event chann=
els.
This patch introduces the configuration logic for rx queues and the handl=
er
used in dealing with the notifications.

Signed-off-by: Costin Lupu <costin.lupu@cs.pub.ro>
Signed-off-by: Razvan Cojocaru <razvan.cojocaru93@gmail.com>
---
 plat/xen/drivers/net/netfront.c | 212 ++++++++++++++++++++++++++++++--
 plat/xen/drivers/net/netfront.h |  29 +++++
 2 files changed, 232 insertions(+), 9 deletions(-)

diff --git a/plat/xen/drivers/net/netfront.c b/plat/xen/drivers/net/netfr=
ont.c
index 3c936743..742e05cf 100644
--- a/plat/xen/drivers/net/netfront.c
+++ b/plat/xen/drivers/net/netfront.c
@@ -52,6 +52,11 @@
 static struct uk_alloc *drv_allocator;
=20
=20
+static uint16_t xennet_rxidx(RING_IDX idx)
+{
+	return (uint16_t) (idx & (NET_RX_RING_SIZE - 1));
+}
+
 static void add_id_to_freelist(uint16_t id, uint16_t *freelist)
 {
 	freelist[id + 1] =3D freelist[0];
@@ -67,6 +72,82 @@ static uint16_t get_id_from_freelist(uint16_t *freelis=
t)
 	return id;
 }
=20
+static int netfront_rxq_enqueue(struct uk_netdev_rx_queue *rxq,
+		struct uk_netbuf *netbuf)
+{
+	RING_IDX req_prod;
+	uint16_t id;
+	netif_rx_request_t *rx_req;
+	struct netfront_dev *nfdev;
+	int notify;
+
+	/* buffer must be page aligned */
+	UK_ASSERT(((unsigned long) netbuf->data & ~PAGE_MASK) =3D=3D 0);
+
+	if (RING_FULL(&rxq->ring)) {
+		uk_pr_debug("rx queue is full\n");
+		return -ENOSPC;
+	}
+
+	/* get request */
+	req_prod =3D rxq->ring.req_prod_pvt;
+	id =3D xennet_rxidx(req_prod);
+	rx_req =3D RING_GET_REQUEST(&rxq->ring, req_prod);
+	rx_req->id =3D id;
+
+	/* save buffer */
+	rxq->netbuf[id] =3D netbuf;
+	/* setup grant for buffer data */
+	nfdev =3D rxq->netfront_dev;
+	rxq->gref[id] =3D rx_req->gref =3D
+		gnttab_grant_access(nfdev->xendev->otherend_id,
+			virt_to_mfn(netbuf->data), 0);
+	UK_ASSERT(rx_req->gref !=3D GRANT_INVALID_REF);
+
+	wmb(); /* Ensure backend sees requests */
+	rxq->ring.req_prod_pvt =3D req_prod + 1;
+
+	RING_PUSH_REQUESTS_AND_CHECK_NOTIFY(&rxq->ring, notify);
+	if (notify)
+		notify_remote_via_evtchn(rxq->evtchn);
+
+	return 0;
+}
+
+static int netfront_rx_fillup(struct uk_netdev_rx_queue *rxq, uint16_t n=
b_desc)
+{
+	struct uk_netbuf *netbuf[nb_desc];
+	int rc, status =3D 0;
+	uint16_t cnt;
+
+	cnt =3D rxq->alloc_rxpkts(rxq->alloc_rxpkts_argp, netbuf, nb_desc);
+
+	for (uint16_t i =3D 0; i < cnt; i++) {
+		rc =3D netfront_rxq_enqueue(rxq, netbuf[i]);
+		if (unlikely(rc < 0)) {
+			uk_pr_err("Failed to add a buffer to rx queue %p: %d\n",
+				rxq, rc);
+
+			/*
+			 * Release netbufs that we are not going
+			 * to use anymore
+			 */
+			for (uint16_t j =3D i; j < cnt; j++)
+				uk_netbuf_free(netbuf[j]);
+
+			status |=3D UK_NETDEV_STATUS_UNDERRUN;
+
+			goto out;
+		}
+	}
+
+	if (unlikely(cnt < nb_desc))
+		status |=3D UK_NETDEV_STATUS_UNDERRUN;
+
+out:
+	return status;
+}
+
 static struct uk_netdev_tx_queue *netfront_txq_setup(struct uk_netdev *n=
,
 		uint16_t queue_id,
 		uint16_t nb_desc __unused,
@@ -103,15 +184,19 @@ static struct uk_netdev_tx_queue *netfront_txq_setu=
p(struct uk_netdev *n,
 	UK_ASSERT(txq->ring_ref !=3D GRANT_INVALID_REF);
=20
 	/* Setup event channel */
-	rc =3D evtchn_alloc_unbound(nfdev->xendev->otherend_id,
-			NULL, NULL,
-			&txq->evtchn);
-	if (rc) {
-		uk_pr_err("Error creating event channel: %d\n", rc);
-		gnttab_end_access(txq->ring_ref);
-		uk_pfree(drv_allocator, sring, 1);
-		return ERR2PTR(-rc);
-	}
+	if (nfdev->split_evtchn || !nfdev->rxqs[queue_id].initialized) {
+		rc =3D evtchn_alloc_unbound(nfdev->xendev->otherend_id,
+				NULL, NULL,
+				&txq->evtchn);
+		if (rc) {
+			uk_pr_err("Error creating event channel: %d\n", rc);
+			gnttab_end_access(txq->ring_ref);
+			uk_pfree(drv_allocator, sring, 1);
+			return ERR2PTR(rc);
+		}
+	} else
+		txq->evtchn =3D nfdev->rxqs[queue_id].evtchn;
+
 	/* Events are always disabled for tx queue */
 	mask_evtchn(txq->evtchn);
=20
@@ -128,6 +213,86 @@ static struct uk_netdev_tx_queue *netfront_txq_setup=
(struct uk_netdev *n,
 	return txq;
 }
=20
+static void netfront_handler(evtchn_port_t port __unused,
+		struct __regs *regs __unused, void *arg)
+{
+	struct uk_netdev_rx_queue *rxq =3D arg;
+
+	/* Indicate to the network stack about an event */
+	uk_netdev_drv_rx_event(&rxq->netfront_dev->netdev, rxq->lqueue_id);
+}
+
+static struct uk_netdev_rx_queue *netfront_rxq_setup(struct uk_netdev *n=
,
+		uint16_t queue_id,
+		uint16_t nb_desc __unused,
+		struct uk_netdev_rxqueue_conf *conf)
+{
+	int rc;
+	struct netfront_dev *nfdev;
+	struct uk_netdev_rx_queue *rxq;
+	netif_rx_sring_t *sring;
+
+	UK_ASSERT(n !=3D NULL);
+	UK_ASSERT(conf !=3D NULL);
+
+	nfdev =3D to_netfront_dev(n);
+	if (queue_id >=3D nfdev->max_queue_pairs) {
+		uk_pr_err("Invalid queue identifier: %"__PRIu16"\n", queue_id);
+		return ERR2PTR(-EINVAL);
+	}
+
+	rxq =3D &nfdev->rxqs[queue_id];
+	UK_ASSERT(!rxq->initialized);
+	rxq->netfront_dev =3D nfdev;
+	rxq->lqueue_id =3D queue_id;
+
+	/* Setup shared ring */
+	sring =3D uk_palloc(drv_allocator, 1);
+	if (!sring)
+		return ERR2PTR(-ENOMEM);
+	memset(sring, 0, PAGE_SIZE);
+	SHARED_RING_INIT(sring);
+	FRONT_RING_INIT(&rxq->ring, sring, PAGE_SIZE);
+	rxq->ring_size =3D NET_RX_RING_SIZE;
+	rxq->ring_ref =3D gnttab_grant_access(nfdev->xendev->otherend_id,
+		virt_to_mfn(sring), 0);
+	UK_ASSERT(rxq->ring_ref !=3D GRANT_INVALID_REF);
+
+	/* Setup event channel */
+	if (nfdev->split_evtchn || !nfdev->txqs[queue_id].initialized) {
+		rc =3D evtchn_alloc_unbound(nfdev->xendev->otherend_id,
+				netfront_handler, rxq,
+				&rxq->evtchn);
+		if (rc) {
+			uk_pr_err("Error creating event channel: %d\n", rc);
+			gnttab_end_access(rxq->ring_ref);
+			uk_pfree(drv_allocator, sring, 1);
+			return ERR2PTR(rc);
+		}
+	} else {
+		rxq->evtchn =3D nfdev->txqs[queue_id].evtchn;
+		/* overwriting event handler */
+		bind_evtchn(rxq->evtchn, netfront_handler, rxq);
+	}
+	/*
+	 * By default, events are disabled and it is up to the user or
+	 * network stack to explicitly enable them.
+	 */
+	mask_evtchn(rxq->evtchn);
+	rxq->intr_enabled =3D 0;
+
+	rxq->alloc_rxpkts =3D conf->alloc_rxpkts;
+	rxq->alloc_rxpkts_argp =3D conf->alloc_rxpkts_argp;
+
+	/* Allocate receive buffers for this queue */
+	netfront_rx_fillup(rxq, rxq->ring_size);
+
+	rxq->initialized =3D true;
+	nfdev->rxqs_num++;
+
+	return rxq;
+}
+
 static int netfront_rxtx_alloc(struct netfront_dev *nfdev,
 		const struct uk_netdev_conf *conf)
 {
@@ -196,6 +361,33 @@ exit:
 	return rc;
 }
=20
+static int netfront_rxq_info_get(struct uk_netdev *n,
+		uint16_t queue_id,
+		struct uk_netdev_queue_info *qinfo)
+{
+	struct netfront_dev *nfdev;
+	struct uk_netdev_rx_queue *rxq;
+	int rc =3D 0;
+
+	UK_ASSERT(n !=3D NULL);
+	UK_ASSERT(qinfo !=3D NULL);
+
+	nfdev =3D to_netfront_dev(n);
+	if (unlikely(queue_id >=3D nfdev->rxqs_num)) {
+		uk_pr_err("Invalid queue id: %"__PRIu16"\n", queue_id);
+		rc =3D -EINVAL;
+		goto exit;
+	}
+	rxq =3D &nfdev->rxqs[queue_id];
+	qinfo->nb_min =3D rxq->ring_size;
+	qinfo->nb_max =3D rxq->ring_size;
+	qinfo->nb_align =3D PAGE_SIZE;
+	qinfo->nb_is_power_of_two =3D 1;
+
+exit:
+	return rc;
+}
+
 static int netfront_configure(struct uk_netdev *n,
 		const struct uk_netdev_conf *conf)
 {
@@ -286,7 +478,9 @@ static unsigned int netfront_promisc_get(struct uk_ne=
tdev *n)
 static const struct uk_netdev_ops netfront_ops =3D {
 	.configure =3D netfront_configure,
 	.txq_configure =3D netfront_txq_setup,
+	.rxq_configure =3D netfront_rxq_setup,
 	.txq_info_get =3D netfront_txq_info_get,
+	.rxq_info_get =3D netfront_rxq_info_get,
 	.info_get =3D netfront_info_get,
 	.einfo_get =3D netfront_einfo_get,
 	.hwaddr_get =3D netfront_mac_get,
diff --git a/plat/xen/drivers/net/netfront.h b/plat/xen/drivers/net/netfr=
ont.h
index d3f603b3..c8364815 100644
--- a/plat/xen/drivers/net/netfront.h
+++ b/plat/xen/drivers/net/netfront.h
@@ -44,6 +44,7 @@
=20
=20
 #define NET_TX_RING_SIZE __CONST_RING_SIZE(netif_tx, PAGE_SIZE)
+#define NET_RX_RING_SIZE __CONST_RING_SIZE(netif_rx, PAGE_SIZE)
=20
 /**
  * internal structure to represent the transmit queue.
@@ -77,6 +78,33 @@ struct uk_netdev_tx_queue {
  * internal structure to represent the receive queue.
  */
 struct uk_netdev_rx_queue {
+	/* The netfront device */
+	struct netfront_dev *netfront_dev;
+	/* The libuknet queue identifier */
+	uint16_t lqueue_id;
+	/* True if initialized */
+	bool initialized;
+
+	/* Shared ring size */
+	uint16_t ring_size;
+	/* Shared ring */
+	netif_rx_front_ring_t ring;
+	/* Shared ring grant ref */
+	grant_ref_t ring_ref;
+	/* Queue event channel */
+	evtchn_port_t evtchn;
+
+	/* The flag to interrupt on the transmit queue */
+	uint8_t intr_enabled;
+
+	/* User-provided receive buffer allocation function */
+	uk_netdev_alloc_rxpkts alloc_rxpkts;
+	void *alloc_rxpkts_argp;
+
+	/* Receive buffers for incoming packets */
+	struct uk_netbuf *netbuf[NET_RX_RING_SIZE];
+	/* Grants for receive buffers */
+	grant_ref_t gref[NET_RX_RING_SIZE];
 };
=20
 struct xs_econf {
@@ -93,6 +121,7 @@ struct netfront_dev {
=20
 	/* List of the Rx/Tx queues */
 	uint16_t txqs_num;
+	uint16_t rxqs_num;
 	struct uk_netdev_tx_queue *txqs;
 	struct uk_netdev_rx_queue *rxqs;
 	/* Maximum number of queue pairs */
--=20
2.20.1



From minios-devel-bounces@lists.xenproject.org Thu Aug 13 08:54:54 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Thu, 13 Aug 2020 08:54:54 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1k690g-0001jT-K2; Thu, 13 Aug 2020 08:54:54 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=QcnS=BX=cs.pub.ro=costin.lupu@srs-us1.protection.inumbo.net>)
 id 1k690f-0001jJ-DS
 for minios-devel@lists.xen.org; Thu, 13 Aug 2020 08:54:53 +0000
X-Inumbo-ID: 29400285-4537-4f5e-a1a6-a6cdab449ab0
Received: from mx.upb.ro (unknown [141.85.13.220])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 29400285-4537-4f5e-a1a6-a6cdab449ab0;
 Thu, 13 Aug 2020 08:54:52 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
 by mx.upb.ro (Postfix) with ESMTP id F201FB561CCA;
 Thu, 13 Aug 2020 11:54:51 +0300 (EEST)
Received: from mx.upb.ro ([127.0.0.1])
 by localhost (mx.upb.ro [127.0.0.1]) (amavisd-new, port 10032)
 with ESMTP id Q74elfzLEde2; Thu, 13 Aug 2020 11:54:50 +0300 (EEST)
Received: from localhost (localhost [127.0.0.1])
 by mx.upb.ro (Postfix) with ESMTP id 3F05EB561D12;
 Thu, 13 Aug 2020 11:54:50 +0300 (EEST)
X-Virus-Scanned: amavisd-new at upb.ro
Received: from mx.upb.ro ([127.0.0.1])
 by localhost (mx.upb.ro [127.0.0.1]) (amavisd-new, port 10026)
 with ESMTP id IRRniwvrtXj7; Thu, 13 Aug 2020 11:54:50 +0300 (EEST)
Received: from localhost.localdomain (unknown [188.25.162.205])
 by mx.upb.ro (Postfix) with ESMTPSA id 13729B561CCA;
 Thu, 13 Aug 2020 11:54:50 +0300 (EEST)
From: Costin Lupu <costin.lupu@cs.pub.ro>
To: minios-devel@lists.xen.org
Cc: sharan.santhanam@neclab.eu
Subject: [UNIKRAFT/LWIP PATCH v3 0/2] Xen netfront support 
Date: Thu, 13 Aug 2020 11:54:47 +0300
Message-Id: <20200813085449.29903-1-costin.lupu@cs.pub.ro>
X-Mailer: git-send-email 2.20.1
MIME-Version: 1.0
Content-Transfer-Encoding: quoted-printable
X-BeenThere: minios-devel@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Mini-os development list <minios-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:minios-devel@lists.xenproject.org>
List-Help: <mailto:minios-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: minios-devel-bounces@lists.xenproject.org
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>

The current changes are required for supporting netfront devices in Unikr=
aft.
They should be used together with the netfront patch series because they =
depend
on each other.

This series revisit the packet buffer allocation design in order to exten=
d it
for usage with different network devices at the same time.

Changes since v2:
- Use nb_align field for queue infos
- First patch of v3 was already upstreamed

Costin Lupu (2):
  uknetdev: Extend private state of network interface
  uknetdev: Introduce netbuf allocation helper

 include/arch/cc.h |   2 +-
 netbuf.c          |   8 ++--
 netbuf.h          |   2 +-
 uknetdev.c        | 119 ++++++++++++++++++++++++++++++++++++----------
 4 files changed, 100 insertions(+), 31 deletions(-)

--=20
2.20.1



From minios-devel-bounces@lists.xenproject.org Thu Aug 13 08:54:54 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Thu, 13 Aug 2020 08:54:54 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1k690g-0001jf-LX; Thu, 13 Aug 2020 08:54:54 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=QcnS=BX=cs.pub.ro=costin.lupu@srs-us1.protection.inumbo.net>)
 id 1k690f-0001jO-PJ
 for minios-devel@lists.xen.org; Thu, 13 Aug 2020 08:54:53 +0000
X-Inumbo-ID: fd251e5a-29b0-487f-9029-add975ecf3aa
Received: from mx.upb.ro (unknown [141.85.13.200])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id fd251e5a-29b0-487f-9029-add975ecf3aa;
 Thu, 13 Aug 2020 08:54:53 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
 by mx.upb.ro (Postfix) with ESMTP id 277EEB561D12;
 Thu, 13 Aug 2020 11:54:52 +0300 (EEST)
Received: from mx.upb.ro ([127.0.0.1])
 by localhost (mx.upb.ro [127.0.0.1]) (amavisd-new, port 10032)
 with ESMTP id tkQUSuDszfaq; Thu, 13 Aug 2020 11:54:50 +0300 (EEST)
Received: from localhost (localhost [127.0.0.1])
 by mx.upb.ro (Postfix) with ESMTP id 676C2B561D1A;
 Thu, 13 Aug 2020 11:54:50 +0300 (EEST)
X-Virus-Scanned: amavisd-new at upb.ro
Received: from mx.upb.ro ([127.0.0.1])
 by localhost (mx.upb.ro [127.0.0.1]) (amavisd-new, port 10026)
 with ESMTP id sUQnCIIK9xRp; Thu, 13 Aug 2020 11:54:50 +0300 (EEST)
Received: from localhost.localdomain (unknown [188.25.162.205])
 by mx.upb.ro (Postfix) with ESMTPSA id 3D7F4B5617CC;
 Thu, 13 Aug 2020 11:54:50 +0300 (EEST)
From: Costin Lupu <costin.lupu@cs.pub.ro>
To: minios-devel@lists.xen.org
Cc: sharan.santhanam@neclab.eu
Subject: [UNIKRAFT/LWIP PATCH v3 1/2] uknetdev: Extend private state of
 network interface
Date: Thu, 13 Aug 2020 11:54:48 +0300
Message-Id: <20200813085449.29903-2-costin.lupu@cs.pub.ro>
X-Mailer: git-send-email 2.20.1
In-Reply-To: <20200813085449.29903-1-costin.lupu@cs.pub.ro>
References: <20200813085449.29903-1-costin.lupu@cs.pub.ro>
MIME-Version: 1.0
Content-Transfer-Encoding: quoted-printable
X-BeenThere: minios-devel@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Mini-os development list <minios-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:minios-devel@lists.xenproject.org>
List-Help: <mailto:minios-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: minios-devel-bounces@lists.xenproject.org
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>

We introduce an encapsulating structure for keeping private information
of network interfaces which is intended for internal use.

Signed-off-by: Costin Lupu <costin.lupu@cs.pub.ro>
---
 uknetdev.c | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/uknetdev.c b/uknetdev.c
index e794c37..66c0ac9 100644
--- a/uknetdev.c
+++ b/uknetdev.c
@@ -83,8 +83,12 @@ struct lwip_netdev_data {
 static uint16_t rx_headroom =3D ETH_PAD_SIZE;
 static uint16_t tx_headroom =3D ETH_PAD_SIZE;
=20
+struct uk_netif_state {
+	struct uk_netdev *netdev;
+};
+
 #define netif_to_uknetdev(nf) \
-	((struct uk_netdev *) (nf)->state)
+	(((struct uk_netif_state *) (nf)->state)->netdev)
=20
 static uint16_t netif_alloc_rxpkts(void *argp, struct uk_netbuf *nb[],
 				   uint16_t count)
@@ -686,16 +690,20 @@ struct netif *uknetdev_addif(struct uk_netdev *n
 	static const void *pethernet_input =3D NETIF_INPUT;
 	struct netif *nf;
 	struct netif *ret;
+	struct uk_netif_state *state;
=20
-	nf =3D mem_calloc(1, sizeof(*nf));
+	nf =3D mem_calloc(1, sizeof(*nf) + sizeof(*state));
 	if (!nf)
 		return NULL;
=20
+	state =3D (struct uk_netif_state *) (nf + 1);
+	state->netdev =3D n;
+
 	ret =3D netif_add(nf,
 #if LWIP_IPV4
 			ipaddr, netmask, gw,
 #endif /* LWIP_IPV4 */
-			n, uknetdev_init, UK_READ_ONCE(pethernet_input));
+			state, uknetdev_init, UK_READ_ONCE(pethernet_input));
 	UK_ASSERT(nf->input);
=20
 	if (!ret) {
--=20
2.20.1



From minios-devel-bounces@lists.xenproject.org Thu Aug 13 08:55:00 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Thu, 13 Aug 2020 08:55:00 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1k690l-0001kl-N9; Thu, 13 Aug 2020 08:54:59 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=QcnS=BX=cs.pub.ro=costin.lupu@srs-us1.protection.inumbo.net>)
 id 1k690k-0001jO-Nw
 for minios-devel@lists.xen.org; Thu, 13 Aug 2020 08:54:58 +0000
X-Inumbo-ID: e9ba2615-cc69-4a96-85a7-5f4f33c2831c
Received: from mx.upb.ro (unknown [141.85.13.220])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id e9ba2615-cc69-4a96-85a7-5f4f33c2831c;
 Thu, 13 Aug 2020 08:54:54 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
 by mx.upb.ro (Postfix) with ESMTP id 9BD35B561CCA;
 Thu, 13 Aug 2020 11:54:53 +0300 (EEST)
Received: from mx.upb.ro ([127.0.0.1])
 by localhost (mx.upb.ro [127.0.0.1]) (amavisd-new, port 10032)
 with ESMTP id V-IpD4bF1VIF; Thu, 13 Aug 2020 11:54:50 +0300 (EEST)
Received: from localhost (localhost [127.0.0.1])
 by mx.upb.ro (Postfix) with ESMTP id A0EFFB5617CC;
 Thu, 13 Aug 2020 11:54:50 +0300 (EEST)
X-Virus-Scanned: amavisd-new at upb.ro
Received: from mx.upb.ro ([127.0.0.1])
 by localhost (mx.upb.ro [127.0.0.1]) (amavisd-new, port 10026)
 with ESMTP id 23ZzJoSXhO1D; Thu, 13 Aug 2020 11:54:50 +0300 (EEST)
Received: from localhost.localdomain (unknown [188.25.162.205])
 by mx.upb.ro (Postfix) with ESMTPSA id 674CAB561CCA;
 Thu, 13 Aug 2020 11:54:50 +0300 (EEST)
From: Costin Lupu <costin.lupu@cs.pub.ro>
To: minios-devel@lists.xen.org
Cc: sharan.santhanam@neclab.eu
Subject: [UNIKRAFT/LWIP PATCH v3 2/2] uknetdev: Introduce netbuf allocation
 helper
Date: Thu, 13 Aug 2020 11:54:49 +0300
Message-Id: <20200813085449.29903-3-costin.lupu@cs.pub.ro>
X-Mailer: git-send-email 2.20.1
In-Reply-To: <20200813085449.29903-1-costin.lupu@cs.pub.ro>
References: <20200813085449.29903-1-costin.lupu@cs.pub.ro>
MIME-Version: 1.0
Content-Transfer-Encoding: quoted-printable
X-BeenThere: minios-devel@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Mini-os development list <minios-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:minios-devel@lists.xenproject.org>
List-Help: <mailto:minios-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: minios-devel-bounces@lists.xenproject.org
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>

On Xen, packet buffers need to be page aligned. Therefore we add support
for allocating buffer data with alignment. Because packet buffer sizes
and alignments may differ from one device to another, we introduce the
netbuf allocation helper structure which encapsulates the information
required for allocating packet buffers for each network device.

We also set ETH_PAD_SIZE to 0 considering that padding and alignment is
handled according to each driver capabilities.

Signed-off-by: Costin Lupu <costin.lupu@cs.pub.ro>
---
 include/arch/cc.h |   2 +-
 netbuf.c          |   8 ++--
 netbuf.h          |   2 +-
 uknetdev.c        | 105 ++++++++++++++++++++++++++++++++++++----------
 4 files changed, 89 insertions(+), 28 deletions(-)

diff --git a/include/arch/cc.h b/include/arch/cc.h
index a1d0c34..a5b91b5 100644
--- a/include/arch/cc.h
+++ b/include/arch/cc.h
@@ -51,7 +51,7 @@
=20
 /* 32 bit checksum calculation */
 #define LWIP_CHKSUM_ALGORITHM 3
-#define ETH_PAD_SIZE 2
+#define ETH_PAD_SIZE 0
=20
 /* rand */
 #define LWIP_RAND() uk_swrand_randr()
diff --git a/netbuf.c b/netbuf.c
index 4878f74..c8c02bf 100644
--- a/netbuf.c
+++ b/netbuf.c
@@ -50,14 +50,16 @@ static void _netbuf_free(struct pbuf *p)
 }
=20
 struct uk_netbuf *lwip_alloc_netbuf(struct uk_alloc *a, size_t alloc_siz=
e,
-				    size_t headroom)
+		size_t alloc_align, size_t headroom)
 {
 	void *allocation;
 	struct uk_netbuf *b;
 	struct _netbuf_pbuf *np;
+	int rc;
=20
-	allocation =3D uk_malloc(a, alloc_size);
-	if (unlikely(!allocation))
+	rc =3D uk_posix_memalign(a, (void **) &allocation, alloc_align,
+			alloc_size);
+	if (unlikely(rc))
 		goto err_out;
=20
 	b =3D uk_netbuf_prepare_buf(allocation, alloc_size,
diff --git a/netbuf.h b/netbuf.h
index 1492065..d21e084 100644
--- a/netbuf.h
+++ b/netbuf.h
@@ -61,7 +61,7 @@ struct _netbuf_pbuf {
  * before handing over the embedded pbuf to the network stack.
  */
 struct uk_netbuf *lwip_alloc_netbuf(struct uk_alloc *a, size_t alloc_siz=
e,
-				    size_t headroom);
+		size_t alloc_align, size_t headroom);
=20
 /**
  * Returns the reference of the embedded pbuf of a netbuf
diff --git a/uknetdev.c b/uknetdev.c
index 66c0ac9..b0e00a0 100644
--- a/uknetdev.c
+++ b/uknetdev.c
@@ -57,7 +57,6 @@
 #include <uk/essentials.h>
=20
 #define UKNETDEV_BPS 1000000000u
-#define UKNETDEV_BUFLEN 2048
=20
 #define UKNETDEV_NETIF_NAME0 'e'
 #define UKNETDEV_NETIF_NAME1 'n'
@@ -83,25 +82,68 @@ struct lwip_netdev_data {
 static uint16_t rx_headroom =3D ETH_PAD_SIZE;
 static uint16_t tx_headroom =3D ETH_PAD_SIZE;
=20
+/* Helper structure for allocating packet buffers */
+struct netbuf_alloc_helper {
+	struct uk_alloc *allocator;     /* Packet allocator */
+	struct {
+		uint16_t headroom;      /* buffer headroom */
+		uint16_t size;          /* buffer size */
+		uint16_t align;         /* alignment for packet data */
+	} tx, rx;
+};
+
+static void netbuf_alloc_helper_init(struct netbuf_alloc_helper *nah,
+		struct uk_alloc *a, struct uk_netdev_info *dev_info,
+		struct uk_netdev_queue_info *txq_info,
+		struct uk_netdev_queue_info *rxq_info)
+{
+	nah->allocator =3D a;
+
+	/* TX */
+	nah->tx.align =3D txq_info->nb_align;
+	nah->tx.headroom =3D MAX(tx_headroom, dev_info->nb_encap_tx);
+	nah->tx.size =3D sizeof(struct uk_netbuf) + nah->tx.headroom;
+	/* If buffer data is aligned then buffer header is aligned */
+	nah->tx.size =3D ALIGN_UP(nah->tx.size, nah->tx.align);
+	/* If buffer data is aligned then headroom expands */
+	nah->tx.headroom =3D nah->tx.size - sizeof(struct uk_netbuf);
+	/* Add aligned size of buffer data */
+	nah->tx.size +=3D ALIGN_UP(dev_info->max_mtu, nah->tx.align);
+
+	/* RX */
+	nah->rx.align =3D rxq_info->nb_align;
+	nah->rx.headroom =3D MAX(rx_headroom, dev_info->nb_encap_rx);
+	nah->rx.size =3D sizeof(struct uk_netbuf) + sizeof(struct _netbuf_pbuf)=
 +
+			nah->rx.headroom;
+	nah->rx.size =3D ALIGN_UP(nah->rx.size, nah->rx.align);
+	nah->rx.headroom =3D nah->rx.size - sizeof(struct uk_netbuf) -
+			sizeof(struct _netbuf_pbuf);
+	nah->rx.size +=3D ALIGN_UP(dev_info->max_mtu, nah->rx.align);
+}
+
 struct uk_netif_state {
 	struct uk_netdev *netdev;
+	struct netbuf_alloc_helper alloc_helper;
 };
=20
 #define netif_to_uknetdev(nf) \
 	(((struct uk_netif_state *) (nf)->state)->netdev)
+#define netif_to_alloc_helper(nf) \
+	(&((struct uk_netif_state *) (nf)->state)->alloc_helper)
=20
 static uint16_t netif_alloc_rxpkts(void *argp, struct uk_netbuf *nb[],
 				   uint16_t count)
 {
-	struct uk_alloc *a;
+	struct netbuf_alloc_helper *nah;
 	uint16_t i;
=20
 	UK_ASSERT(argp);
=20
-	a =3D (struct uk_alloc *) argp;
+	nah =3D (struct netbuf_alloc_helper *) argp;
=20
 	for (i =3D 0; i < count; ++i) {
-		nb[i] =3D lwip_alloc_netbuf(a, UKNETDEV_BUFLEN, rx_headroom);
+		nb[i] =3D lwip_alloc_netbuf(nah->allocator, nah->rx.size,
+				nah->rx.align, nah->rx.headroom);
 		if (!nb[i]) {
 			/* we run out of memory */
 			break;
@@ -113,7 +155,7 @@ static uint16_t netif_alloc_rxpkts(void *argp, struct=
 uk_netbuf *nb[],
=20
 static err_t uknetdev_output(struct netif *nf, struct pbuf *p)
 {
-	struct uk_alloc *a;
+	struct netbuf_alloc_helper *nah;
 	struct uk_netdev *dev;
 	struct pbuf *q;
 	struct uk_netbuf *nb;
@@ -124,18 +166,17 @@ static err_t uknetdev_output(struct netif *nf, stru=
ct pbuf *p)
 	UK_ASSERT(nf);
 	dev =3D netif_to_uknetdev(nf);
 	UK_ASSERT(dev);
+	nah =3D netif_to_alloc_helper(nf);
+	UK_ASSERT(nah);
=20
-	a =3D uk_alloc_get_default();
-	if (!a)
+	ret =3D uk_posix_memalign(nah->allocator, (void **) &allocation,
+			nah->tx.align, nah->tx.size);
+	if (unlikely(ret))
 		return ERR_MEM;
-
-	allocation =3D uk_malloc(a, UKNETDEV_BUFLEN);
-	if (!allocation)
-		return ERR_MEM;
-	nb =3D uk_netbuf_prepare_buf(allocation, UKNETDEV_BUFLEN,
-				   tx_headroom, 0, NULL);
+	nb =3D uk_netbuf_prepare_buf(allocation, nah->tx.size,
+				   nah->tx.headroom, 0, NULL);
 	UK_ASSERT(nb);
-	nb->_a =3D a; /* register allocator for free operation */
+	nb->_a =3D nah->allocator; /* register allocator for free operation */
=20
 	if (unlikely(p->tot_len > uk_netbuf_tailroom(nb))) {
 		LWIP_DEBUGF(NETIF_DEBUG,
@@ -440,14 +481,19 @@ err_t uknetdev_init(struct netif *nf)
 	struct uk_netdev_rxqueue_conf rxq_conf;
 	struct uk_netdev_txqueue_conf txq_conf;
 	struct uk_netdev_info info;
+	struct uk_netdev_queue_info rxq_info;
+	struct uk_netdev_queue_info txq_info;
 	struct lwip_netdev_data *lwip_data;
 	const struct uk_hwaddr *hwaddr;
+	struct netbuf_alloc_helper *nah;
 	unsigned int i;
 	int ret;
=20
 	UK_ASSERT(nf);
 	dev =3D netif_to_uknetdev(nf);
 	UK_ASSERT(dev);
+	nah =3D netif_to_alloc_helper(nf);
+	UK_ASSERT(nah);
=20
 	lwip_data =3D (struct lwip_netdev_data *)dev->scratch_pad;
=20
@@ -484,14 +530,6 @@ err_t uknetdev_init(struct netif *nf)
 		return ERR_IF;
 	lwip_data->features =3D info.features;
=20
-	/*
-	 * Update our global (rx|tx)_headroom setting that we use for
-	 * buffer allocations
-	 */
-	rx_headroom =3D (rx_headroom < info.nb_encap_rx)
-		      ? info.nb_encap_rx : rx_headroom;
-	tx_headroom =3D (tx_headroom < info.nb_encap_tx)
-		      ? info.nb_encap_tx : tx_headroom;
 	LWIP_DEBUGF(NETIF_DEBUG,
 		    ("%s: %c%c%u: Need headroom rx:%"PRIu16", tx:%"PRIu16"\n",
 		     __func__, nf->name[0], nf->name[1], nf->num,
@@ -518,7 +556,7 @@ err_t uknetdev_init(struct netif *nf)
 	 */
 	rxq_conf.a =3D a;
 	rxq_conf.alloc_rxpkts =3D netif_alloc_rxpkts;
-	rxq_conf.alloc_rxpkts_argp =3D a;
+	rxq_conf.alloc_rxpkts_argp =3D nah;
 #ifdef CONFIG_LWIP_NOTHREADS
 	/*
 	 * In mainloop mode, we will not use interrupts.
@@ -558,6 +596,27 @@ err_t uknetdev_init(struct netif *nf)
 		return ERR_IF;
 	}
=20
+	ret =3D uk_netdev_rxq_info_get(dev, 0, &rxq_info);
+	if (ret < 0) {
+		LWIP_DEBUGF(NETIF_DEBUG,
+			    ("%s: %c%c%u: Failed to get rx queue info of netdev %u\n",
+			     __func__, nf->name[0], nf->name[1], nf->num,
+			     uk_netdev_id_get(dev)));
+		return ERR_IF;
+	}
+
+	ret =3D uk_netdev_txq_info_get(dev, 0, &txq_info);
+	if (ret < 0) {
+		LWIP_DEBUGF(NETIF_DEBUG,
+			    ("%s: %c%c%u: Failed to get tx queue info of netdev %u\n",
+			     __func__, nf->name[0], nf->name[1], nf->num,
+			     uk_netdev_id_get(dev)));
+		return ERR_IF;
+	}
+
+	/* initialize buffer allocation helper */
+	netbuf_alloc_helper_init(nah, a, &info, &txq_info, &rxq_info);
+
 	/* Start interface */
 	ret =3D uk_netdev_start(dev);
 	if (ret < 0) {
--=20
2.20.1



From minios-devel-bounces@lists.xenproject.org Fri Aug 14 20:14:50 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Fri, 14 Aug 2020 20:14:50 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1k6g69-0006ay-LM; Fri, 14 Aug 2020 20:14:45 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <SRS0=osIB=BY=xen.org=julien@srs-us1.protection.inumbo.net>)
 id 1k6g68-0006at-89
 for minios-devel@lists.xen.org; Fri, 14 Aug 2020 20:14:44 +0000
X-Inumbo-ID: 92d62346-f104-4e57-bf60-513a5ebbc3cd
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 92d62346-f104-4e57-bf60-513a5ebbc3cd;
 Fri, 14 Aug 2020 20:14:42 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Content-Transfer-Encoding:Content-Type:In-Reply-To:
 MIME-Version:Date:Message-ID:From:References:Cc:To:Subject;
 bh=H2vzzlRaLQeCKBrprR48tYMlcCjjb1iFW+lyjhls/CY=; b=bqnP7M1/9Q6LjOCQcVST05sISI
 X/TlUra6yO12QAqzsQdim1jmKlzXqIuyesnKt2BOWzQIxiDIxlMndMdB7gOy24H1VVSF4QTH+Nr7Q
 c2Vs3Bd9rhMOJlsAZqRg96QWub1Qi+OqhAgJlRbA+ELHCrn8a4eUnKChU0dsIxQt/Hq4=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <julien@xen.org>)
 id 1k6g60-0006FX-O0; Fri, 14 Aug 2020 20:14:36 +0000
Received: from [54.239.6.185] (helo=a483e7b01a66.ant.amazon.com)
 by xenbits.xenproject.org with esmtpsa
 (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92)
 (envelope-from <julien@xen.org>)
 id 1k6g60-0005kA-G2; Fri, 14 Aug 2020 20:14:36 +0000
Subject: Re: [UNIKRAFT PATCH 2/2] arch/arm: Provide ukarch_spinwait noop for
 ARM
To: Alexander Jung <a.jung@lancs.ac.uk>, minios-devel@lists.xen.org
Cc: Felipe Huici <felipe.huici@neclab.eu>,
 Alexander Jung <alexander.jung@neclab.eu>,
 Costin Lupu <costin.lupu@cs.pub.ro>, Simon Kuenzer
 <simon.kuenzer@neclab.eu>, Sharan Santhanam <sharan.santhanam@neclab.eu>
References: <20200723081526.50677-1-a.jung@lancs.ac.uk>
 <20200723081526.50677-3-a.jung@lancs.ac.uk>
From: Julien Grall <julien@xen.org>
Message-ID: <d83a1008-8bc9-202b-05e9-8c6465f800d3@xen.org>
Date: Fri, 14 Aug 2020 21:14:34 +0100
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:68.0)
 Gecko/20100101 Thunderbird/68.11.0
MIME-Version: 1.0
In-Reply-To: <20200723081526.50677-3-a.jung@lancs.ac.uk>
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Language: en-GB
Content-Transfer-Encoding: 7bit
X-BeenThere: minios-devel@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Mini-os development list <minios-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:minios-devel@lists.xenproject.org>
List-Help: <mailto:minios-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: minios-devel-bounces@lists.xenproject.org
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>

Hi,

On 23/07/2020 09:15, Alexander Jung wrote:
> ARM does not support a pause-type instruction for busy spin wait
> operations.  This commit provides the same alias to be used in
> instances where it is required but defaults to a blank operation.

On Arm, the closest instruction would be "yield".

> 
> Signed-off-by: Alexander Jung <alexander.jung@neclab.eu>
> ---
>   arch/arm/arm/include/uk/asm/lcpu.h   | 5 +++++
>   arch/arm/arm64/include/uk/asm/lcpu.h | 5 +++++
>   2 files changed, 10 insertions(+)
> 
> diff --git a/arch/arm/arm/include/uk/asm/lcpu.h b/arch/arm/arm/include/uk/asm/lcpu.h
> index cdeffc3..f38ffb9 100644
> --- a/arch/arm/arm/include/uk/asm/lcpu.h
> +++ b/arch/arm/arm/include/uk/asm/lcpu.h
> @@ -57,3 +57,8 @@ struct __regs {
>   #ifndef wmb
>   #define wmb() __asm__("dsb" : : : "memory")
>   #endif
> +
> +static inline void ukarch_spinwait(void)
> +{
> +	/* Intelligent busy wait not supported on arm. */

This at least need to contain a barrier() to force the compiler to 
reload the memory after the wait. Otherwise, it may optimize waiting 
loop to infinite loop.

Unfortunately, I don't have a setup with Unikraft. But I am happy to 
provide a patch if someone else can test it.

> +}
> diff --git a/arch/arm/arm64/include/uk/asm/lcpu.h b/arch/arm/arm64/include/uk/asm/lcpu.h
> index 45d1b23..51e17ad 100644
> --- a/arch/arm/arm64/include/uk/asm/lcpu.h
> +++ b/arch/arm/arm64/include/uk/asm/lcpu.h
> @@ -146,4 +146,9 @@ static inline unsigned long ukarch_read_sp(void)
>   	return sp;
>   }
>   
> +static inline void ukarch_spinwait(void)
> +{
> +	/* Intelligent busy wait not supported on arm64. */

Likewise here.

> +}
> +
>   #endif /* __ASSEMBLY__ */
> 

Cheers,

-- 
Julien Grall


From minios-devel-bounces@lists.xenproject.org Sat Aug 15 09:56:06 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Sat, 15 Aug 2020 09:56:06 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1k6suy-0006UM-1F; Sat, 15 Aug 2020 09:56:04 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=oILU=BZ=gmail.com=cristianvijelie@srs-us1.protection.inumbo.net>)
 id 1k6suw-0006Sw-A1
 for minios-devel@lists.xen.org; Sat, 15 Aug 2020 09:56:02 +0000
X-Inumbo-ID: 7aa48994-31c1-4374-a8d7-2102e6288e21
Received: from mail-ed1-x534.google.com (unknown [2a00:1450:4864:20::534])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 7aa48994-31c1-4374-a8d7-2102e6288e21;
 Sat, 15 Aug 2020 09:55:59 +0000 (UTC)
Received: by mail-ed1-x534.google.com with SMTP id i26so8617709edv.4
 for <minios-devel@lists.xen.org>; Sat, 15 Aug 2020 02:55:59 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=from:to:subject:date:message-id:in-reply-to:references:mime-version
 :content-transfer-encoding;
 bh=aHN8h+BNdOjZ5IFxfqyAMZ2+CwmAU/kHuJQD19BddvY=;
 b=u9gGb7IcgFO+3rPQft0SJc4I+B2ofqxzBz8Mu/YA/Uy3/q9ca+FGSgOWW/GxqOs49c
 bRHcuD46Bvs9yDu34jCm3NxA91G+bbxoQIwV71nS4qh8svFVGP4H/cNMJuhdGz/5wYIS
 BRlxBmrohQw5OYhv2oIW9sEumCXqvhjoKMoa9AMu+SDsl9jFJwqywKxEERbtkfnfAiZ9
 U698ErO54HmlhOYhrP1FKGQpjSTd2+Sre/LLoJA86MS0d9kdwPoEO7V6UhYrwNU0rVuh
 LDp51ga96XqoEBIXTah3LmPnfkybkhAImjSGF941Q3l0gLMLiTMw1G8IR6Dcfu9HUmAN
 +7tA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to
 :references:mime-version:content-transfer-encoding;
 bh=aHN8h+BNdOjZ5IFxfqyAMZ2+CwmAU/kHuJQD19BddvY=;
 b=WWesY0LALJvReDWvjwMl1iAwiZ1v6Q5uEJ9R+G6qNbJ40/Z93VwjteIo8OrGqX6tWA
 Kl4aBRXDX1ubpxnIy/ObLnLxp1z4SIxPc060DoHTfblPmWNX9tZnTtLXaS6zEjpS2QPj
 T00gFVVqLo0t1vuVJ8mIxYIutQz1BVTlpiat5aaV3A4eWVOgcsL3t4Qpax18NOfGFTno
 j606yMy7sefjSobiUcR6rFOV8VjnqJFtanCVTvSsT6U9mVE7rwH/dUKI+PsXBHryYKvO
 OCYT/J9OA+K/jynLXv8k4Bb83yfMfVlqxwP9h1PM628s1Kl5UB1N4NQsX173uflN1VSU
 S/+g==
X-Gm-Message-State: AOAM532IQ/uylTsF+ui7/3e2KBUAVRADA4gh0z6ZqtC1dGBo1WstB22/
 2LCS6+GEECyWQel/78sVQw5w8OIWcf9WsA==
X-Google-Smtp-Source: ABdhPJxoJ2DHDw1hZH7Qka6jEaEsETYJiUlxqqhG4AAElW8Uw+smjig9ny+iY1W2+w0blVIh3qWtJA==
X-Received: by 2002:a05:6402:1d8f:: with SMTP id
 dk15mr3930367edb.90.1597485357988; 
 Sat, 15 Aug 2020 02:55:57 -0700 (PDT)
Received: from localhost.localdomain ([2a02:2f0b:450d:d00:88c0:915e:4b72:30f9])
 by smtp.gmail.com with ESMTPSA id l7sm8108061edn.45.2020.08.15.02.55.57
 for <minios-devel@lists.xen.org>
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Sat, 15 Aug 2020 02:55:57 -0700 (PDT)
From: Cristian Vijelie <cristianvijelie@gmail.com>
To: minios-devel@lists.xen.org
Subject: [UNIKRAFT/LIBNETTLE 2/4] Succesfully built the library
Date: Sat, 15 Aug 2020 12:55:51 +0300
Message-Id: <20200815095553.6205-3-cristianvijelie@gmail.com>
X-Mailer: git-send-email 2.25.1
In-Reply-To: <20200815095553.6205-1-cristianvijelie@gmail.com>
References: <20200815095553.6205-1-cristianvijelie@gmail.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-BeenThere: minios-devel@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Mini-os development list <minios-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:minios-devel@lists.xenproject.org>
List-Help: <mailto:minios-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: minios-devel-bounces@lists.xenproject.org
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>

Signed-off-by: Cristian Vijelie <cristianvijelie@gmail.com>
---
 Makefile.uk | 152 ++++++++++++++++++++++++++--------------------------
 1 file changed, 76 insertions(+), 76 deletions(-)

diff --git a/Makefile.uk b/Makefile.uk
index 408d246..6e896da 100644
--- a/Makefile.uk
+++ b/Makefile.uk
@@ -9,11 +9,11 @@ LIBNETTLE_PATCHDIR=$(LIBNETTLE_BASE)/patches
 
 LIBNETTLE_SUBDIR = $(LIBNETTLE_ORIGIN)/nettle-$(LIBNETTLE_VERSION)
 
-LIBNETTLE_CFLAGS += -I. -I$(LIBNETTLE_BASE)/include -DHAVE_CONFIG_H -g -O2 -ggdb3 -Wall -W -Wno-sign-compare   -Wmissing-prototypes -Wmissing-declarations -Wstrict-prototypes   -Wpointer-arith -Wbad-function-cast -Wnested-externs -fpic 
+LIBNETTLE_CFLAGS += -I. -I$(LIBNETTLE_BASE)/include -DHAVE_CONFIG_H -g -O2 -ggdb3 -Wall -W -Wno-sign-compare   -Wmissing-prototypes -Wmissing-declarations -Wstrict-prototypes   -Wpointer-arith -Wbad-function-cast -Wnested-externs -fpic -MT $@ -MD -MP -MF $@.d
 
-LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/aes-decrypt-internal.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/aes-decrypt-internal.s
 LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/aes-decrypt.c
-LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/aes-encrypt-internal.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/aes-encrypt-internal.s
 LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/aes-encrypt.c
 LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/aes-encrypt-table.c
 LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/aes-invert-internal.c 
@@ -45,7 +45,7 @@ LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/base64url-decode.c
 LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/base64url-meta.c
 LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/buffer.c
 LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/buffer-init.c
-LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/camellia-crypt-internal.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/camellia-crypt-internal.s
 LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/camellia-table.c
 LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/camellia-absorb.c
 LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/camellia-invert-key.c
@@ -71,7 +71,7 @@ LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/siv-cmac-aes128.c
 LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/siv-cmac-aes256.c
 LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/cnd-memcpy.c
 LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/chacha-crypt.c
-LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/chacha-core-internal.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/chacha-core-internal.s
 LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/chacha-poly1305.c
 LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/chacha-poly1305-meta.c
 LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/chacha-set-key.c
@@ -129,12 +129,12 @@ LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/md2-meta.c
 LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/md4.c
 LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/md4-meta.c
 LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/md5.c
-LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/md5-compress.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/md5-compress.s
 LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/md5-compat.c
 LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/md5-meta.c
 LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/memeql-sec.c
-LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/memxor.c
-LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/memxor3.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/memxor.s
+LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/memxor3.s
 LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/nettle-lookup-hash.c
 LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/nettle-meta-aeads.c
 LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/nettle-meta-armors.c
@@ -146,12 +146,12 @@ LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/pbkdf2-hmac-gosthash94.c
 LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/pbkdf2-hmac-sha1.c
 LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/pbkdf2-hmac-sha256.c
 LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/poly1305-aes.c
-LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/poly1305-internal.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/poly1305-internal.s
 LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/realloc.c
 LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/ripemd160.c
 LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/ripemd160-compress.c
 LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/ripemd160-meta.c
-LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/salsa20-core-internal.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/salsa20-core-internal.s
 LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/salsa20-crypt.c
 LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/salsa20r12-crypt.c
 LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/salsa20-set-key.c
@@ -159,20 +159,20 @@ LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/salsa20-set-nonce.c
 LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/salsa20-128-set-key.c
 LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/salsa20-256-set-key.c
 LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/sha1.c
-LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/sha1-compress.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/sha1-compress.s
 LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/sha1-meta.c
 LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/sha256.c
-LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/sha256-compress.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/sha256-compress.s
 LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/sha224-meta.c
 LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/sha256-meta.c
 LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/sha512.c
-LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/sha512-compress.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/sha512-compress.s
 LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/sha384-meta.c
 LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/sha512-meta.c
 LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/sha512-224-meta.c
 LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/sha512-256-meta.c
 LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/sha3.c
-LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/sha3-permute.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/sha3-permute.s
 LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/sha3-224.c
 LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/sha3-224-meta.c
 LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/sha3-256.c
@@ -183,13 +183,13 @@ LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/sha3-512.c
 LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/sha3-512-meta.c
 LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/shake256.c
 LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/serpent-set-key.c
-LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/serpent-encrypt.c
-LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/serpent-decrypt.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/serpent-encrypt.s
+LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/serpent-decrypt.s
 LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/serpent-meta.c
 LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/twofish.c
 LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/twofish-meta.c
-LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/umac-nh.c
-LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/umac-nh-n.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/umac-nh.s
+LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/umac-nh-n.s
 LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/umac-l2.c
 LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/umac-l3.c
 LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/umac-poly64.c
@@ -208,24 +208,24 @@ LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/yarrow_key_event.c
 LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/xts.c
 LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/xts-aes128.c
 LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/xts-aes256.c
-LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/aes-decrypt-internal.s
-LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/aes-encrypt-internal.s
-LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/camellia-crypt-internal.s
-LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/chacha-core-internal.s
-LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/md5-compress.s
-LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/memxor.s
-LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/memxor3.s
-LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/poly1305-internal.s
-LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/salsa20-core-internal.s
-LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/salsa20-crypt.s 
-LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/sha1-compress.s
-LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/sha256-compress.s
-LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/sha512-compress.s
-LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/sha3-permute.s
-LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/serpent-encrypt.s
-LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/serpent-decrypt.s
-LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/umac-nh.s
-LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/umac-nh-n.s
+# LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/aes-decrypt-internal.s
+# LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/aes-encrypt-internal.s
+# LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/camellia-crypt-internal.s
+# LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/chacha-core-internal.s
+# LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/md5-compress.s
+# LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/memxor.s
+# LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/memxor3.s
+# LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/poly1305-internal.s
+# LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/salsa20-core-internal.s
+# LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/salsa20-crypt.s 
+# LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/sha1-compress.s
+# LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/sha256-compress.s
+# LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/sha512-compress.s
+# LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/sha3-permute.s
+# LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/serpent-encrypt.s
+# LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/serpent-decrypt.s
+# LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/umac-nh.s
+# LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/umac-nh-n.s
 LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/gcm-hash8.s
 
 # Run ./configure
@@ -237,67 +237,67 @@ $(LIBNETTLE_SUBDIR)/.configured: $(LIBNETTLE_BUILD)/.origin
 LIBNETTLE_ASSEMBLY_DEPS = $(LIBNETTLE_SUBDIR)/asm.m4 $(LIBNETTLE_SUBDIR)/machine.m4 $(LIBNETTLE_SUBDIR)/config.m4
 
 $(LIBNETTLE_SUBDIR)/aes-decrypt-internal.s: $(LIBNETTLE_ASSEMBLY_DEPS) $(LIBNETTLE_SUBDIR)/aes-decrypt-internal.asm
-    $(call verbose_cmd,GEN,libnettle: $(notdir $@), cd $(LIBNETTLE_SUBDIR) && /usr/bin/m4 $^ >$@)
+	$(call verbose_cmd,GEN,libnettle: $(notdir $@), cd $(LIBNETTLE_SUBDIR) && /usr/bin/m4 $^ >$@)
 $(LIBNETTLE_SUBDIR)/aes-encrypt-internal.s: $(LIBNETTLE_ASSEMBLY_DEPS) $(LIBNETTLE_SUBDIR)/aes-encrypt-internal.asm
-    $(call verbose_cmd,GEN,libnettle: $(notdir $@), cd $(LIBNETTLE_SUBDIR) && /usr/bin/m4 $^ >$@)
+	$(call verbose_cmd,GEN,libnettle: $(notdir $@), cd $(LIBNETTLE_SUBDIR) && /usr/bin/m4 $^ >$@)
 $(LIBNETTLE_SUBDIR)/camellia-crypt-internal.s: $(LIBNETTLE_ASSEMBLY_DEPS) $(LIBNETTLE_SUBDIR)/camellia-crypt-internal.asm
-    $(call verbose_cmd,GEN,libnettle: $(notdir $@), cd $(LIBNETTLE_SUBDIR) && /usr/bin/m4 $^ >$@)
+	$(call verbose_cmd,GEN,libnettle: $(notdir $@), cd $(LIBNETTLE_SUBDIR) && /usr/bin/m4 $^ >$@)
 $(LIBNETTLE_SUBDIR)/chacha-core-internal.s: $(LIBNETTLE_ASSEMBLY_DEPS) $(LIBNETTLE_SUBDIR)/chacha-core-internal.asm
-    $(call verbose_cmd,GEN,libnettle: $(notdir $@), cd $(LIBNETTLE_SUBDIR) && /usr/bin/m4 $^ >$@)
+	$(call verbose_cmd,GEN,libnettle: $(notdir $@), cd $(LIBNETTLE_SUBDIR) && /usr/bin/m4 $^ >$@)
 $(LIBNETTLE_SUBDIR)/md5-compress.s: $(LIBNETTLE_ASSEMBLY_DEPS) $(LIBNETTLE_SUBDIR)/md5-compress.asm
-    $(call verbose_cmd,GEN,libnettle: $(notdir $@), cd $(LIBNETTLE_SUBDIR) && /usr/bin/m4 $^ >$@)
+	$(call verbose_cmd,GEN,libnettle: $(notdir $@), cd $(LIBNETTLE_SUBDIR) && /usr/bin/m4 $^ >$@)
 $(LIBNETTLE_SUBDIR)/memxor.s: $(LIBNETTLE_ASSEMBLY_DEPS) $(LIBNETTLE_SUBDIR)/memxor.asm
-    $(call verbose_cmd,GEN,libnettle: $(notdir $@), cd $(LIBNETTLE_SUBDIR) && /usr/bin/m4 $^ >$@)
+	$(call verbose_cmd,GEN,libnettle: $(notdir $@), cd $(LIBNETTLE_SUBDIR) && /usr/bin/m4 $^ >$@)
 $(LIBNETTLE_SUBDIR)/memxor3.s: $(LIBNETTLE_ASSEMBLY_DEPS) $(LIBNETTLE_SUBDIR)/memxor3.asm
-    $(call verbose_cmd,GEN,libnettle: $(notdir $@), cd $(LIBNETTLE_SUBDIR) && /usr/bin/m4 $^ >$@)
+	$(call verbose_cmd,GEN,libnettle: $(notdir $@), cd $(LIBNETTLE_SUBDIR) && /usr/bin/m4 $^ >$@)
 $(LIBNETTLE_SUBDIR)/poly1305-internal.s: $(LIBNETTLE_ASSEMBLY_DEPS) $(LIBNETTLE_SUBDIR)/poly1305-internal.asm
-    $(call verbose_cmd,GEN,libnettle: $(notdir $@), cd $(LIBNETTLE_SUBDIR) && /usr/bin/m4 $^ >$@)
+	$(call verbose_cmd,GEN,libnettle: $(notdir $@), cd $(LIBNETTLE_SUBDIR) && /usr/bin/m4 $^ >$@)
 $(LIBNETTLE_SUBDIR)/salsa20-core-internal.s: $(LIBNETTLE_ASSEMBLY_DEPS) $(LIBNETTLE_SUBDIR)/salsa20-core-internal.asm
-    $(call verbose_cmd,GEN,libnettle: $(notdir $@), cd $(LIBNETTLE_SUBDIR) && /usr/bin/m4 $^ >$@)
+	$(call verbose_cmd,GEN,libnettle: $(notdir $@), cd $(LIBNETTLE_SUBDIR) && /usr/bin/m4 $^ >$@)
 $(LIBNETTLE_SUBDIR)/salsa20-crypt.s: $(LIBNETTLE_ASSEMBLY_DEPS) $(LIBNETTLE_SUBDIR)/salsa20-crypt.asm
-    $(call verbose_cmd,GEN,libnettle: $(notdir $@), cd $(LIBNETTLE_SUBDIR) && /usr/bin/m4 $^ >$@)
+	$(call verbose_cmd,GEN,libnettle: $(notdir $@), cd $(LIBNETTLE_SUBDIR) && /usr/bin/m4 $^ >$@)
 $(LIBNETTLE_SUBDIR)/sha1-compress.s: $(LIBNETTLE_ASSEMBLY_DEPS) $(LIBNETTLE_SUBDIR)/sha1-compress.asm
-    $(call verbose_cmd,GEN,libnettle: $(notdir $@), cd $(LIBNETTLE_SUBDIR) && /usr/bin/m4 $^ >$@)
+	$(call verbose_cmd,GEN,libnettle: $(notdir $@), cd $(LIBNETTLE_SUBDIR) && /usr/bin/m4 $^ >$@)
 $(LIBNETTLE_SUBDIR)/sha256-compress.s: $(LIBNETTLE_ASSEMBLY_DEPS) $(LIBNETTLE_SUBDIR)/sha256-compress.asm
-    $(call verbose_cmd,GEN,libnettle: $(notdir $@), cd $(LIBNETTLE_SUBDIR) && /usr/bin/m4 $^ >$@)
+	$(call verbose_cmd,GEN,libnettle: $(notdir $@), cd $(LIBNETTLE_SUBDIR) && /usr/bin/m4 $^ >$@)
 $(LIBNETTLE_SUBDIR)/sha512-compress.s: $(LIBNETTLE_ASSEMBLY_DEPS) $(LIBNETTLE_SUBDIR)/sha512-compress.asm
-    $(call verbose_cmd,GEN,libnettle: $(notdir $@), cd $(LIBNETTLE_SUBDIR) && /usr/bin/m4 $^ >$@)
+	$(call verbose_cmd,GEN,libnettle: $(notdir $@), cd $(LIBNETTLE_SUBDIR) && /usr/bin/m4 $^ >$@)
 $(LIBNETTLE_SUBDIR)/sha3-permute.s: $(LIBNETTLE_ASSEMBLY_DEPS) $(LIBNETTLE_SUBDIR)/sha3-permute.asm
-    $(call verbose_cmd,GEN,libnettle: $(notdir $@), cd $(LIBNETTLE_SUBDIR) && /usr/bin/m4 $^ >$@)
+	$(call verbose_cmd,GEN,libnettle: $(notdir $@), cd $(LIBNETTLE_SUBDIR) && /usr/bin/m4 $^ >$@)
 $(LIBNETTLE_SUBDIR)/serpent-encrypt.s: $(LIBNETTLE_ASSEMBLY_DEPS) $(LIBNETTLE_SUBDIR)/serpent-encrypt.asm
-    $(call verbose_cmd,GEN,libnettle: $(notdir $@), cd $(LIBNETTLE_SUBDIR) && /usr/bin/m4 $^ >$@)
+	$(call verbose_cmd,GEN,libnettle: $(notdir $@), cd $(LIBNETTLE_SUBDIR) && /usr/bin/m4 $^ >$@)
 $(LIBNETTLE_SUBDIR)/serpent-decrypt.s: $(LIBNETTLE_ASSEMBLY_DEPS) $(LIBNETTLE_SUBDIR)/serpent-decrypt.asm
-    $(call verbose_cmd,GEN,libnettle: $(notdir $@), cd $(LIBNETTLE_SUBDIR) && /usr/bin/m4 $^ >$@)
+	$(call verbose_cmd,GEN,libnettle: $(notdir $@), cd $(LIBNETTLE_SUBDIR) && /usr/bin/m4 $^ >$@)
 $(LIBNETTLE_SUBDIR)/umac-nh.s: $(LIBNETTLE_ASSEMBLY_DEPS) $(LIBNETTLE_SUBDIR)/umac-nh.asm
-    $(call verbose_cmd,GEN,libnettle: $(notdir $@), d $(LIBNETTLE_SUBDIR) && /usr/bin/m4 $^ >$@)
+	$(call verbose_cmd,GEN,libnettle: $(notdir $@), cd $(LIBNETTLE_SUBDIR) && /usr/bin/m4 $^ >$@)
 $(LIBNETTLE_SUBDIR)/umac-nh-n.s: $(LIBNETTLE_ASSEMBLY_DEPS) $(LIBNETTLE_SUBDIR)/umac-nh-n.asm
-    $(call verbose_cmd,GEN,libnettle: $(notdir $@), cd $(LIBNETTLE_SUBDIR) && /usr/bin/m4 $^ >$@)
+	$(call verbose_cmd,GEN,libnettle: $(notdir $@), cd $(LIBNETTLE_SUBDIR) && /usr/bin/m4 $^ >$@)
 $(LIBNETTLE_SUBDIR)/gcm-hash8.s: $(LIBNETTLE_ASSEMBLY_DEPS) $(LIBNETTLE_SUBDIR)/gcm-hash8.asm
-    $(call verbose_cmd,GEN,libnettle: $(notdir $@), cd $(LIBNETTLE_SUBDIR) && /usr/bin/m4 $^ >$@)
+	$(call verbose_cmd,GEN,libnettle: $(notdir $@), cd $(LIBNETTLE_SUBDIR) && /usr/bin/m4 $^ >$@)
 
 LIBNETTLE_PREPAED_DEPS = \
-    $(LIBNETTLE_SUBDIR)/.configured \
-    $(LIBNETTLE_SUBDIR)/aes-decrypt-internal.s \
-    $(LIBNETTLE_SUBDIR)/aes-encrypt-internal.s \
-    $(LIBNETTLE_SUBDIR)/camellia-crypt-internal.s \
-    $(LIBNETTLE_SUBDIR)/chacha-core-internal.s \
-    $(LIBNETTLE_SUBDIR)/md5-compress.s \
-    $(LIBNETTLE_SUBDIR)/memxor.s \
-    $(LIBNETTLE_SUBDIR)/memxor3.s \
-    $(LIBNETTLE_SUBDIR)/poly1305-internal.s \
-    $(LIBNETTLE_SUBDIR)/salsa20-core-internal.s \
-    $(LIBNETTLE_SUBDIR)/salsa20-crypt.s \
-    $(LIBNETTLE_SUBDIR)/sha1-compress.s \
-    $(LIBNETTLE_SUBDIR)/sha256-compress.s \
-    $(LIBNETTLE_SUBDIR)/sha512-compress.s \
-    $(LIBNETTLE_SUBDIR)/sha3-permute.s \
-    $(LIBNETTLE_SUBDIR)/serpent-encrypt.s \
-    $(LIBNETTLE_SUBDIR)/serpent-decrypt.s \
-    $(LIBNETTLE_SUBDIR)/umac-nh.s \
-    $(LIBNETTLE_SUBDIR)/umac-nh-n.s \
-    $(LIBNETTLE_SUBDIR)/gcm-hash8.s \
+	$(LIBNETTLE_SUBDIR)/.configured \
+	$(LIBNETTLE_SUBDIR)/aes-decrypt-internal.s \
+	$(LIBNETTLE_SUBDIR)/aes-encrypt-internal.s \
+	$(LIBNETTLE_SUBDIR)/camellia-crypt-internal.s \
+	$(LIBNETTLE_SUBDIR)/chacha-core-internal.s \
+	$(LIBNETTLE_SUBDIR)/md5-compress.s \
+	$(LIBNETTLE_SUBDIR)/memxor.s \
+	$(LIBNETTLE_SUBDIR)/memxor3.s \
+	$(LIBNETTLE_SUBDIR)/poly1305-internal.s \
+	$(LIBNETTLE_SUBDIR)/salsa20-core-internal.s \
+	$(LIBNETTLE_SUBDIR)/salsa20-crypt.s \
+	$(LIBNETTLE_SUBDIR)/sha1-compress.s \
+	$(LIBNETTLE_SUBDIR)/sha256-compress.s \
+	$(LIBNETTLE_SUBDIR)/sha512-compress.s \
+	$(LIBNETTLE_SUBDIR)/sha3-permute.s \
+	$(LIBNETTLE_SUBDIR)/serpent-encrypt.s \
+	$(LIBNETTLE_SUBDIR)/serpent-decrypt.s \
+	$(LIBNETTLE_SUBDIR)/umac-nh.s \
+	$(LIBNETTLE_SUBDIR)/umac-nh-n.s \
+	$(LIBNETTLE_SUBDIR)/gcm-hash8.s \
 
 $(LIBNETTLE_BUILD)/.prepared : $(LIBNETTLE_PREPAED_DEPS)
-    $(call verbose_cmd,GEN,libnettle: $(notdir $@), cd $(LIBNETTLE_SUBDIR) touch $@)
+	$(call verbose_cmd,GEN,libnettle: $(notdir $@), cd $(LIBNETTLE_SUBDIR) && touch $@)
 
 UK_PREPARE += $(LIBNETTLE_BUILD)/.prepared
-- 
2.25.1



From minios-devel-bounces@lists.xenproject.org Sat Aug 15 09:56:06 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Sat, 15 Aug 2020 09:56:06 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1k6sus-0006UA-VU; Sat, 15 Aug 2020 09:55:58 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=oILU=BZ=gmail.com=cristianvijelie@srs-us1.protection.inumbo.net>)
 id 1k6sur-0006Sw-H4
 for minios-devel@lists.xen.org; Sat, 15 Aug 2020 09:55:57 +0000
X-Inumbo-ID: 425314f5-24da-4e56-a1f9-522a8c109878
Received: from mail-ej1-x636.google.com (unknown [2a00:1450:4864:20::636])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 425314f5-24da-4e56-a1f9-522a8c109878;
 Sat, 15 Aug 2020 09:55:56 +0000 (UTC)
Received: by mail-ej1-x636.google.com with SMTP id m22so12397319eje.10
 for <minios-devel@lists.xen.org>; Sat, 15 Aug 2020 02:55:56 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=from:to:subject:date:message-id:mime-version
 :content-transfer-encoding;
 bh=qc+I98pTgUbMX64WlP/YDBVj0rcIoR0vwjO3nAKPrbY=;
 b=AXr2iMFJCW92QPCVLc6Bbd2l4hXLNu/yWcNMRWcZHygjT3hwAe493BII8WWPbUjO27
 IiCv06hlVFpBT9/LZN8kiKbmrcmcxxE9PbvsAbbRNoKvuwvdrSglgbjnVYrYDMJ27w+1
 Jsu38wdE+lNTvUsXZns+orWugx2pSjlLe/T5sIfTYwtrddwkhWebUv/Ct2Nf4s4NYbCt
 NDjOyybpC9xgeNJqQ58z5wbf5MoTN37D3EOYODDRLHXiWTBj1V2d/kuqY43t+Haohh0m
 Nl6b8wno/XuODvuMAjO5gMNY7Zl/uqJ5WQ1XB8AgJJOJ+YXcsWY3fy9fxMuWTtWW4Mmt
 TN0w==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:to:subject:date:message-id:mime-version
 :content-transfer-encoding;
 bh=qc+I98pTgUbMX64WlP/YDBVj0rcIoR0vwjO3nAKPrbY=;
 b=n1tE55y2lcAOoRNK82qRMbOXAMsFI9bY3t68DV+XsQ+cr+KEEUAkCXMakDFqZ0Cz1O
 ML3nrq2KKGfTHhe6OnvznWwGyWz+FH666D8o9PK8vGcNjsOGlgz/xX1bwnW1K3Op21UQ
 3h8ploLxsRIwPQZYAXUip8Zqea0wwykx7sJeaUoWzbxx/FBkwYXzk5czjH3U3m5/Gob0
 /qiZDF49Eqbu58YW1y5PqJfy5jN01lLLUm1/taCqI8vks07vhGxclwB2UPJ4fZSkSB0U
 cY3G/RIJ3iOegCDqkGZTUYuMki4WP6CXfiJJuSwSxajokJB+EgVPIzGmza6r//KLQrie
 Qi4g==
X-Gm-Message-State: AOAM5336JTNEWhqjf8+7wyx7OaCWg1kADFgwGZ73esyoBDxc9tt3oaDA
 OlJ6NHfrtMVId7bm7dIAGmwEmiQFQN9UnA==
X-Google-Smtp-Source: ABdhPJwTSy1fV+7BfUAzmddK2k/ucMU8jOsGL60ElC9hZZBHEpHqF+yHQx9EjXREJ2dU4EMW5WUpKA==
X-Received: by 2002:a17:906:403:: with SMTP id
 d3mr6218029eja.522.1597485355036; 
 Sat, 15 Aug 2020 02:55:55 -0700 (PDT)
Received: from localhost.localdomain ([2a02:2f0b:450d:d00:88c0:915e:4b72:30f9])
 by smtp.gmail.com with ESMTPSA id l7sm8108061edn.45.2020.08.15.02.55.53
 for <minios-devel@lists.xen.org>
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Sat, 15 Aug 2020 02:55:54 -0700 (PDT)
From: Cristian Vijelie <cristianvijelie@gmail.com>
To: minios-devel@lists.xen.org
Subject: [UNIKRAFT/LIBNETTLE 0/4] *** Crypto library nettle porting to
 Unikraft ***
Date: Sat, 15 Aug 2020 12:55:49 +0300
Message-Id: <20200815095553.6205-1-cristianvijelie@gmail.com>
X-Mailer: git-send-email 2.25.1
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-BeenThere: minios-devel@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Mini-os development list <minios-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:minios-devel@lists.xenproject.org>
List-Help: <mailto:minios-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: minios-devel-bounces@lists.xenproject.org
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>

*** BLURB HERE ***

Cristian Vijelie (4):
  First port of libnettle
  Succesfully built the library
  minor changes to Makefile.uk
  Added .md files

 CODING_STYLE.md                               |    4 +
 CONTRIBUTING.md                               |    4 +
 MAINTAINERS.md                                |    9 +
 Makefile.uk                                   |  162 +-
 README.md                                     |    6 +
 patches/0001-First-port-of-libnettle.patch    | 1806 +++++++++++++++++
 .../0002-Succesfully-built-the-library.patch  |  274 +++
 .../0003-minor-changes-to-Makefile.uk.patch   |   62 +
 patches/0004-Added-.md-files.patch            |  120 ++
 9 files changed, 2366 insertions(+), 81 deletions(-)
 create mode 100644 CODING_STYLE.md
 create mode 100644 CONTRIBUTING.md
 create mode 100644 MAINTAINERS.md
 create mode 100644 README.md

-- 
2.25.1



From minios-devel-bounces@lists.xenproject.org Sat Aug 15 09:56:09 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Sat, 15 Aug 2020 09:56:09 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1k6sv3-0006V3-2y; Sat, 15 Aug 2020 09:56:09 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=oILU=BZ=gmail.com=cristianvijelie@srs-us1.protection.inumbo.net>)
 id 1k6sv1-0006Sw-A5
 for minios-devel@lists.xen.org; Sat, 15 Aug 2020 09:56:07 +0000
X-Inumbo-ID: d1110c95-6542-4642-bff5-fe0680a43dd1
Received: from mail-ej1-x62a.google.com (unknown [2a00:1450:4864:20::62a])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id d1110c95-6542-4642-bff5-fe0680a43dd1;
 Sat, 15 Aug 2020 09:56:00 +0000 (UTC)
Received: by mail-ej1-x62a.google.com with SMTP id c16so12408484ejx.12
 for <minios-devel@lists.xen.org>; Sat, 15 Aug 2020 02:56:00 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=from:to:subject:date:message-id:in-reply-to:references:mime-version
 :content-transfer-encoding;
 bh=m6zqo5KwLTx4jF7FLG9yy5z8+VhV+NhhqkPkPuxNf5M=;
 b=DG/9MwQ4hCe+05+4I/4ZwIhU5yUb7sxTv8Uz5ApJzqhQszIKYo1wOS/Bdvmo/uEMSG
 ymqPktgl97wC+HL5IiXh1dDqyrmUuyAu4EiJdbxZdQBvnnvPDLD0neugJRg+cGyfD9Tf
 9UmDHU3x3pVT0M+6PltkXLL5KDzelRdDQq3D1/4qzLTdzl1375Xu4L5982gq8AVDf1Ok
 dRxSUs/PKalKs/PUDwt8EhHVsHw6HWGNI4rvPS7u+y3AT99Ma8zJ4+283I76ed3+kcv+
 sX6/7OekrW6M0mAjRbXoMwzXi93MBuA5VZrfzx/ZX1PvoEdHhPOmEtU0IPeqp/SPooT2
 W+4Q==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to
 :references:mime-version:content-transfer-encoding;
 bh=m6zqo5KwLTx4jF7FLG9yy5z8+VhV+NhhqkPkPuxNf5M=;
 b=NYdYjq9boigjJ5yO/ANfMbTvieXSUcA+06+D43xgANsPNWWyAHqH31O9UDz1VMB1KB
 304xLFmqIxplqvQztdVmS4MhYhEdJfZdPPAOum5s18t8stFWFwiF+zpUWFphEWmnQIaM
 o83H8D+f2Ke4g5EN3zLasyibLE3JFe/ciZ2RhcezmgGar/8BMjnfrjz0E0FC2eyp++TR
 TO49vrPHB4vMqXpoQ/3wByyYjOqzUbyzhXzPcb0mZKODi2QMQjWrhKINFTBQ/K7Tkdii
 DxW6DL/O1m6yHyEdbFQmwFyKpzT3t/rSpgeRWsOT2q7glJuQPDk1qHnfu7sLPt0BdyoT
 G20A==
X-Gm-Message-State: AOAM5327FbsGDoa//pQXCcBgddghVS67DtxlfBs1iRWHmOKmydb58vlv
 wEkPgp/dxoayZG9C+EOoCrnvFBfHYy6zKg==
X-Google-Smtp-Source: ABdhPJwDyGnb0CAZMZQUwLYhT9mqEfSAb0cmqxmiDGgwIDBTjuRRscg/A0BzfR5ENUrCWHuDnAwTWA==
X-Received: by 2002:a17:907:724b:: with SMTP id
 ds11mr6224397ejc.481.1597485359162; 
 Sat, 15 Aug 2020 02:55:59 -0700 (PDT)
Received: from localhost.localdomain ([2a02:2f0b:450d:d00:88c0:915e:4b72:30f9])
 by smtp.gmail.com with ESMTPSA id l7sm8108061edn.45.2020.08.15.02.55.58
 for <minios-devel@lists.xen.org>
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Sat, 15 Aug 2020 02:55:58 -0700 (PDT)
From: Cristian Vijelie <cristianvijelie@gmail.com>
To: minios-devel@lists.xen.org
Subject: [UNIKRAFT/LIBNETTLE 3/4] Minor changes to Makefile.uk
Date: Sat, 15 Aug 2020 12:55:52 +0300
Message-Id: <20200815095553.6205-4-cristianvijelie@gmail.com>
X-Mailer: git-send-email 2.25.1
In-Reply-To: <20200815095553.6205-1-cristianvijelie@gmail.com>
References: <20200815095553.6205-1-cristianvijelie@gmail.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-BeenThere: minios-devel@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Mini-os development list <minios-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:minios-devel@lists.xenproject.org>
List-Help: <mailto:minios-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: minios-devel-bounces@lists.xenproject.org
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>

Signed-off-by: Cristian Vijelie <cristianvijelie@gmail.com>
---
 Makefile.uk | 27 +++++----------------------
 1 file changed, 5 insertions(+), 22 deletions(-)

diff --git a/Makefile.uk b/Makefile.uk
index 6e896da..460a078 100644
--- a/Makefile.uk
+++ b/Makefile.uk
@@ -1,15 +1,16 @@
 $(eval $(call addlib_s,libnettle,$(CONFIG_LIBNETTLE)))
 
 LIBNETTLE_VERSION=3.6
-LIBNETTLE_TARNAME=nettle-$(LIBNETTLE_VERSION)
-LIBNETTLE_URL=https://ftp.gnu.org/gnu/nettle/$(LIBNETTLE_TARNAME).tar.gz
+LIBNETTLE_ZIPNAME=nettle-$(LIBNETTLE_VERSION)
+LIBNETTLE_URL=https://ftp.gnu.org/gnu/nettle/$(LIBNETTLE_ZIPNAME).tar.gz
 $(eval $(call fetch,libnettle,$(LIBNETTLE_URL)))
 
 LIBNETTLE_PATCHDIR=$(LIBNETTLE_BASE)/patches
+$(eval $(call patch,libnettle,$(LIBNETTLE_PATCHDIR),$(LIBNETTLE_ZIPNAME)))
 
-LIBNETTLE_SUBDIR = $(LIBNETTLE_ORIGIN)/nettle-$(LIBNETTLE_VERSION)
+LIBNETTLE_SUBDIR = $(LIBNETTLE_ORIGIN)/$(LIBNETTLE_ZIPNAME)
 
-LIBNETTLE_CFLAGS += -I. -I$(LIBNETTLE_BASE)/include -DHAVE_CONFIG_H -g -O2 -ggdb3 -Wall -W -Wno-sign-compare   -Wmissing-prototypes -Wmissing-declarations -Wstrict-prototypes   -Wpointer-arith -Wbad-function-cast -Wnested-externs -fpic -MT $@ -MD -MP -MF $@.d
+LIBNETTLE_CFLAGS = -I. -I$(LIBNETTLE_BASE)/include -DHAVE_CONFIG_H -g -O2 -ggdb3 -Wall -W -Wno-sign-compare   -Wmissing-prototypes -Wmissing-declarations -Wstrict-prototypes   -Wpointer-arith -Wbad-function-cast -Wnested-externs -fpic -MT $@ -MD -MP -MF $@.d
 
 LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/aes-decrypt-internal.s
 LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/aes-decrypt.c
@@ -208,24 +209,6 @@ LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/yarrow_key_event.c
 LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/xts.c
 LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/xts-aes128.c
 LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/xts-aes256.c
-# LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/aes-decrypt-internal.s
-# LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/aes-encrypt-internal.s
-# LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/camellia-crypt-internal.s
-# LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/chacha-core-internal.s
-# LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/md5-compress.s
-# LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/memxor.s
-# LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/memxor3.s
-# LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/poly1305-internal.s
-# LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/salsa20-core-internal.s
-# LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/salsa20-crypt.s 
-# LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/sha1-compress.s
-# LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/sha256-compress.s
-# LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/sha512-compress.s
-# LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/sha3-permute.s
-# LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/serpent-encrypt.s
-# LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/serpent-decrypt.s
-# LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/umac-nh.s
-# LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/umac-nh-n.s
 LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/gcm-hash8.s
 
 # Run ./configure
-- 
2.25.1



From minios-devel-bounces@lists.xenproject.org Sat Aug 15 09:56:14 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Sat, 15 Aug 2020 09:56:14 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1k6sv8-0006WE-5T; Sat, 15 Aug 2020 09:56:14 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=oILU=BZ=gmail.com=cristianvijelie@srs-us1.protection.inumbo.net>)
 id 1k6sv6-0006Sw-AB
 for minios-devel@lists.xen.org; Sat, 15 Aug 2020 09:56:12 +0000
X-Inumbo-ID: 8cc1576a-5ab1-4f2c-bd3c-604e7c2679fa
Received: from mail-ed1-x52b.google.com (unknown [2a00:1450:4864:20::52b])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 8cc1576a-5ab1-4f2c-bd3c-604e7c2679fa;
 Sat, 15 Aug 2020 09:56:01 +0000 (UTC)
Received: by mail-ed1-x52b.google.com with SMTP id ba10so8608487edb.3
 for <minios-devel@lists.xen.org>; Sat, 15 Aug 2020 02:56:01 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=from:to:subject:date:message-id:in-reply-to:references:mime-version
 :content-transfer-encoding;
 bh=8L6xsepk1eOe/SizsPtg25uxYyMmAp6e0WwDVg0Mbzo=;
 b=lFdJCUoETe27gDb0ORyEJFT1Oq6KcZ2pTeuN7WoWrTu+vqbhkh1k3SByG+7UtYIKjW
 7iGLUekLO7SjgptPFroNkAiyE2mxiaIVfKW7HjybRF4LpA5UFA7ggD5U9Px/VoarQDpT
 nceWHx0exIr2WGXHG8ozbryrcN2YmDzE1pr0FX8GOMN0ByTik6sgDHaQOVgz3VRByoxc
 bEx37ZDRt2Tf9ugE2YaLdee3ha4wQ/vPHHFBe965SiYN3/ehcQz++B8QhPiXPuldzrYQ
 M9ef0aZ6owkGk8X7cw7lQS8Ymw4jCMCPnofz3ZSoNDeJ1fSqL///yjCBtA1rIxCzLxdV
 gC6Q==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to
 :references:mime-version:content-transfer-encoding;
 bh=8L6xsepk1eOe/SizsPtg25uxYyMmAp6e0WwDVg0Mbzo=;
 b=pBC2exJ26nbGUM4YZt8JntehKGFfDo22EOqEYu1iorCrR/8c9junwXrlsL1fGsVEHA
 PSx6fOzTl9AFU3fL52oaoK5X2UeWLtP2KyioOdJ09iGQkk1gV5iNY0mQhxVo7E2dyGuB
 6f7IQ8hWa2tdIRDtDlLw2XVO8Bqbiocv7QkHsYOk8UKa+gJjBwpchEzw3PSpXyCDE89z
 gk57bAkedl6OIbVZJ9GmVyXAJEtGtxzrNIvhFpXhv5oAxZk2hfkXIfzLT2esz5EBRPvH
 +4CKo3hrdWqGN2Rj+f6vZ/48n12KGGEBhFitZAEwkl+eCk8iYz2f1N1Xon15zgI42yOO
 VZLQ==
X-Gm-Message-State: AOAM530ENDvnmhruDh+JoXfajwroEk7HdvxKm80MyEV82FDGhCZBxu/Z
 rzgX/5C39b44kntDe7azjWHUaKsIdd2qiw==
X-Google-Smtp-Source: ABdhPJxx3fDwCS0NfWhGCt0uHDmGSnpjlOnEdRFBoW0C4d/D5/JrXlzWmt8/TEqo6QKH6h6bnV42hg==
X-Received: by 2002:aa7:dcd2:: with SMTP id w18mr6470471edu.307.1597485360388; 
 Sat, 15 Aug 2020 02:56:00 -0700 (PDT)
Received: from localhost.localdomain ([2a02:2f0b:450d:d00:88c0:915e:4b72:30f9])
 by smtp.gmail.com with ESMTPSA id l7sm8108061edn.45.2020.08.15.02.55.59
 for <minios-devel@lists.xen.org>
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Sat, 15 Aug 2020 02:55:59 -0700 (PDT)
From: Cristian Vijelie <cristianvijelie@gmail.com>
To: minios-devel@lists.xen.org
Subject: [UNIKRAFT/LIBNETTLE 4/4] Added .md files
Date: Sat, 15 Aug 2020 12:55:53 +0300
Message-Id: <20200815095553.6205-5-cristianvijelie@gmail.com>
X-Mailer: git-send-email 2.25.1
In-Reply-To: <20200815095553.6205-1-cristianvijelie@gmail.com>
References: <20200815095553.6205-1-cristianvijelie@gmail.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-BeenThere: minios-devel@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Mini-os development list <minios-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:minios-devel@lists.xenproject.org>
List-Help: <mailto:minios-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: minios-devel-bounces@lists.xenproject.org
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>

Signed-off-by: Cristian Vijelie <cristianvijelie@gmail.com>
---
 CODING_STYLE.md |  4 ++++
 CONTRIBUTING.md |  4 ++++
 MAINTAINERS.md  |  9 +++++++++
 Makefile.uk     | 21 +++++++++++++++++++--
 README.md       |  6 ++++++
 5 files changed, 42 insertions(+), 2 deletions(-)
 create mode 100644 CODING_STYLE.md
 create mode 100644 CONTRIBUTING.md
 create mode 100644 MAINTAINERS.md
 create mode 100644 README.md

diff --git a/CODING_STYLE.md b/CODING_STYLE.md
new file mode 100644
index 0000000..5730041
--- /dev/null
+++ b/CODING_STYLE.md
@@ -0,0 +1,4 @@
+Coding Style
+============
+
+Please refer to the `CODING_STYLE.md` file in the main Unikraft repository.
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
new file mode 100644
index 0000000..14f6ac6
--- /dev/null
+++ b/CONTRIBUTING.md
@@ -0,0 +1,4 @@
+Contributing to Unikraft
+========================
+
+Please refer to the `CONTRIBUTING.md` file in the main Unikraft repository.
diff --git a/MAINTAINERS.md b/MAINTAINERS.md
new file mode 100644
index 0000000..c123f15
--- /dev/null
+++ b/MAINTAINERS.md
@@ -0,0 +1,9 @@
+Maintainers List
+================
+
+For notes on how to read this information, please refer to `MAINTAINERS.md` in
+the main Unikraft repository.
+
+	LIBNETTLE-UNIKRAFT
+	L:	minios-devel@lists.xen.org
+	F: *
diff --git a/Makefile.uk b/Makefile.uk
index 460a078..18139ef 100644
--- a/Makefile.uk
+++ b/Makefile.uk
@@ -1,17 +1,31 @@
+################################################################################
+# Library registration
+################################################################################
 $(eval $(call addlib_s,libnettle,$(CONFIG_LIBNETTLE)))
 
+################################################################################
+# Original sources
+################################################################################
 LIBNETTLE_VERSION=3.6
 LIBNETTLE_ZIPNAME=nettle-$(LIBNETTLE_VERSION)
 LIBNETTLE_URL=https://ftp.gnu.org/gnu/nettle/$(LIBNETTLE_ZIPNAME).tar.gz
 $(eval $(call fetch,libnettle,$(LIBNETTLE_URL)))
-
 LIBNETTLE_PATCHDIR=$(LIBNETTLE_BASE)/patches
 $(eval $(call patch,libnettle,$(LIBNETTLE_PATCHDIR),$(LIBNETTLE_ZIPNAME)))
 
+################################################################################
+# Helpers
+################################################################################
 LIBNETTLE_SUBDIR = $(LIBNETTLE_ORIGIN)/$(LIBNETTLE_ZIPNAME)
 
+################################################################################
+# Global flags
+################################################################################
 LIBNETTLE_CFLAGS = -I. -I$(LIBNETTLE_BASE)/include -DHAVE_CONFIG_H -g -O2 -ggdb3 -Wall -W -Wno-sign-compare   -Wmissing-prototypes -Wmissing-declarations -Wstrict-prototypes   -Wpointer-arith -Wbad-function-cast -Wnested-externs -fpic -MT $@ -MD -MP -MF $@.d
 
+################################################################################
+# Nettle code
+################################################################################
 LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/aes-decrypt-internal.s
 LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/aes-decrypt.c
 LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/aes-encrypt-internal.s
@@ -211,11 +225,14 @@ LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/xts-aes128.c
 LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/xts-aes256.c
 LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/gcm-hash8.s
 
+################################################################################
+# Nettle prepare
+################################################################################
 # Run ./configure
 $(LIBNETTLE_SUBDIR)/.configured: $(LIBNETTLE_BUILD)/.origin
 	$(call verbose_cmd,CONFIG,libnettle: $(notdir $@), cd $(LIBNETTLE_SUBDIR) && ./configure && touch $@)
 
-# Prepare assembly files
+# Generate assembly files
 
 LIBNETTLE_ASSEMBLY_DEPS = $(LIBNETTLE_SUBDIR)/asm.m4 $(LIBNETTLE_SUBDIR)/machine.m4 $(LIBNETTLE_SUBDIR)/config.m4
 
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..207d99a
--- /dev/null
+++ b/README.md
@@ -0,0 +1,6 @@
+Nettle crypto library for Unikraft
+=============================
+
+This is the port of Nettle crypto library for Unikraft as external library. 
+
+Please refer to the `README.md` as well as the documentation in the `doc/` subdirectory of the main unikraft repository.
-- 
2.25.1



From minios-devel-bounces@lists.xenproject.org Sat Aug 15 09:56:19 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Sat, 15 Aug 2020 09:56:19 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1k6svD-0006XB-7D; Sat, 15 Aug 2020 09:56:19 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=oILU=BZ=gmail.com=cristianvijelie@srs-us1.protection.inumbo.net>)
 id 1k6svB-0006Sw-AS
 for minios-devel@lists.xen.org; Sat, 15 Aug 2020 09:56:17 +0000
X-Inumbo-ID: b782a14d-82d9-41fe-bebe-c1d9b0c24a63
Received: from mail-ed1-x531.google.com (unknown [2a00:1450:4864:20::531])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id b782a14d-82d9-41fe-bebe-c1d9b0c24a63;
 Sat, 15 Aug 2020 09:55:58 +0000 (UTC)
Received: by mail-ed1-x531.google.com with SMTP id df16so8603942edb.9
 for <minios-devel@lists.xen.org>; Sat, 15 Aug 2020 02:55:58 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=from:to:subject:date:message-id:in-reply-to:references:mime-version
 :content-transfer-encoding;
 bh=XJ7xCaVpGP8b8MTTj0NpdLO3wRolyc+E/+th/p4MhRs=;
 b=sc9/q6MV11Lo3aI8cttxWyLJcQKugusRgAPCzAR8BxmN2GmfFUZmOKFqH90Av+VhsJ
 YWQS7lwkjmL+gyiXpNkIqqjriRgGB53QqxatPJCellNS+AYgHjDiaf74ka1h64RyFatA
 YXPE7GULbgtb0JwZ+9H+IZdIoy/RCbUwfVoR8KTbPxrI7go4uf4Gdcg3TpIZtm87l202
 mfWDdIl3ofTen9AONDPcJez5gD0LuGyAUhTYH0CtmdL0jko5x4HcVPSKiFxxiGqSo4lt
 4NbTlcXywWOI/hY+7NAn8nJI71catK96zDJTbbVX1fFsemZQ+gT0S3chKTkfTsWg0pc+
 qiyQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to
 :references:mime-version:content-transfer-encoding;
 bh=XJ7xCaVpGP8b8MTTj0NpdLO3wRolyc+E/+th/p4MhRs=;
 b=cFDQJMjW5JWLBETyjvXaLeClPja60fl2mQ7K1k74956d+25bRjvcD1gnXFvAdmdMRk
 LVoQxacLCYPNyMY3RJN5/Yum+tWEwIi5lLrTUepE24qMkGe6z5/Sds7P25XOfC3mlcgb
 idhouFUGN2RqnR1IfRHytFWJ3xtkc01h5hp2l10IKCNbmK+0HKkO5VqAaTtDdQMVuU/0
 aKAUC1HHdmFUtUPHETswWW/ymL9PkX1JK6FrShiApB0YVI+WfsPRZ4VZiqWkQpUirFzL
 Qg3e4BVlFee5wmF8yj0CtByrWW3kWmakUC9Sl3eua8eEV5UpRuQWwowxoYdBwUE+z41c
 2K7w==
X-Gm-Message-State: AOAM533Cz9PezAfVqE2HIcIhZwTceeG2BhUoM8T9ckjPBmb+ZzX7/k+V
 a4heWdIOcyG1PJYLAiSTE1SVdniUIeKKvA==
X-Google-Smtp-Source: ABdhPJzL5LZ7By0PVVC0+b2suR8KY/GwxO/7p2DvubN0w2nFATY/oerfx6O46UUwKNAYOJ4QVgHpsA==
X-Received: by 2002:aa7:d1cb:: with SMTP id g11mr6144340edp.26.1597485356230; 
 Sat, 15 Aug 2020 02:55:56 -0700 (PDT)
Received: from localhost.localdomain ([2a02:2f0b:450d:d00:88c0:915e:4b72:30f9])
 by smtp.gmail.com with ESMTPSA id l7sm8108061edn.45.2020.08.15.02.55.55
 for <minios-devel@lists.xen.org>
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Sat, 15 Aug 2020 02:55:55 -0700 (PDT)
From: Cristian Vijelie <cristianvijelie@gmail.com>
To: minios-devel@lists.xen.org
Subject: [UNIKRAFT/LIBNETTLE 1/4] First port of libnettle
Date: Sat, 15 Aug 2020 12:55:50 +0300
Message-Id: <20200815095553.6205-2-cristianvijelie@gmail.com>
X-Mailer: git-send-email 2.25.1
In-Reply-To: <20200815095553.6205-1-cristianvijelie@gmail.com>
References: <20200815095553.6205-1-cristianvijelie@gmail.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-BeenThere: minios-devel@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Mini-os development list <minios-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:minios-devel@lists.xenproject.org>
List-Help: <mailto:minios-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: minios-devel-bounces@lists.xenproject.org
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>

Signed-off-by: Cristian Vijelie <cristianvijelie@gmail.com>
---
 .gitignore                 |   1 +
 Config.uk                  |   4 +
 Makefile.uk                | 303 ++++++++++++++++++++++
 include/alloca.h           |  40 +++
 include/bits/long-double.h |  21 ++
 include/bits/wordsize.h    |  17 ++
 include/features.h         | 488 ++++++++++++++++++++++++++++++++++
 include/gnu/stubs-32.h     |  18 ++
 include/gnu/stubs-64.h     |  19 ++
 include/gnu/stubs-x32.h    |  24 ++
 include/gnu/stubs.h        |  14 +
 include/limits.h           | 149 +++++++++++
 include/stdc-predef.h      |  60 +++++
 include/stddef.h           |   0
 include/sys/cdefs.h        | 517 +++++++++++++++++++++++++++++++++++++
 15 files changed, 1675 insertions(+)
 create mode 100644 .gitignore
 create mode 100644 Config.uk
 create mode 100644 Makefile.uk
 create mode 100644 include/alloca.h
 create mode 100644 include/bits/long-double.h
 create mode 100644 include/bits/wordsize.h
 create mode 100644 include/features.h
 create mode 100644 include/gnu/stubs-32.h
 create mode 100644 include/gnu/stubs-64.h
 create mode 100644 include/gnu/stubs-x32.h
 create mode 100644 include/gnu/stubs.h
 create mode 100644 include/limits.h
 create mode 100644 include/stdc-predef.h
 create mode 100644 include/stddef.h
 create mode 100644 include/sys/cdefs.h

diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..4dcb82f
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1 @@
+nettle-*
\ No newline at end of file
diff --git a/Config.uk b/Config.uk
new file mode 100644
index 0000000..10e212c
--- /dev/null
+++ b/Config.uk
@@ -0,0 +1,4 @@
+menuconfig LIBNETTLE
+    bool "libnettle: Symmetric and one-way cryptographic library"
+    select LIBNOLIBC if !HAVE_LIBC
+    default n
\ No newline at end of file
diff --git a/Makefile.uk b/Makefile.uk
new file mode 100644
index 0000000..408d246
--- /dev/null
+++ b/Makefile.uk
@@ -0,0 +1,303 @@
+$(eval $(call addlib_s,libnettle,$(CONFIG_LIBNETTLE)))
+
+LIBNETTLE_VERSION=3.6
+LIBNETTLE_TARNAME=nettle-$(LIBNETTLE_VERSION)
+LIBNETTLE_URL=https://ftp.gnu.org/gnu/nettle/$(LIBNETTLE_TARNAME).tar.gz
+$(eval $(call fetch,libnettle,$(LIBNETTLE_URL)))
+
+LIBNETTLE_PATCHDIR=$(LIBNETTLE_BASE)/patches
+
+LIBNETTLE_SUBDIR = $(LIBNETTLE_ORIGIN)/nettle-$(LIBNETTLE_VERSION)
+
+LIBNETTLE_CFLAGS += -I. -I$(LIBNETTLE_BASE)/include -DHAVE_CONFIG_H -g -O2 -ggdb3 -Wall -W -Wno-sign-compare   -Wmissing-prototypes -Wmissing-declarations -Wstrict-prototypes   -Wpointer-arith -Wbad-function-cast -Wnested-externs -fpic 
+
+LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/aes-decrypt-internal.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/aes-decrypt.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/aes-encrypt-internal.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/aes-encrypt.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/aes-encrypt-table.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/aes-invert-internal.c 
+LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/aes-set-key-internal.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/aes-set-encrypt-key.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/aes-set-decrypt-key.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/aes128-set-encrypt-key.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/aes128-set-decrypt-key.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/aes128-meta.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/aes192-set-encrypt-key.c 
+LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/aes192-set-decrypt-key.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/aes192-meta.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/aes256-set-encrypt-key.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/aes256-set-decrypt-key.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/aes256-meta.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/arcfour.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/arcfour-crypt.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/arctwo.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/arctwo-meta.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/blowfish.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/base16-encode.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/base16-decode.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/base16-meta.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/base64-encode.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/base64-decode.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/base64-meta.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/base64url-encode.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/base64url-decode.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/base64url-meta.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/buffer.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/buffer-init.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/camellia-crypt-internal.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/camellia-table.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/camellia-absorb.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/camellia-invert-key.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/camellia128-set-encrypt-key.c 
+LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/camellia128-crypt.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/camellia128-set-decrypt-key.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/camellia128-meta.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/camellia192-meta.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/camellia256-set-encrypt-key.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/camellia256-crypt.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/camellia256-set-decrypt-key.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/camellia256-meta.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/cast128.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/cast128-meta.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/cbc.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/ccm.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/ccm-aes128.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/ccm-aes192.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/ccm-aes256.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/cfb.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/siv-cmac.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/siv-cmac-aes128.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/siv-cmac-aes256.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/cnd-memcpy.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/chacha-crypt.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/chacha-core-internal.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/chacha-poly1305.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/chacha-poly1305-meta.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/chacha-set-key.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/chacha-set-nonce.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/ctr.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/ctr16.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/des.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/des3.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/eax.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/eax-aes128.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/eax-aes128-meta.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/gcm.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/gcm-aes.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/gcm-aes128.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/gcm-aes128-meta.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/gcm-aes192.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/gcm-aes192-meta.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/gcm-aes256.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/gcm-aes256-meta.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/gcm-camellia128.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/gcm-camellia128-meta.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/gcm-camellia256.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/gcm-camellia256-meta.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/cmac.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/cmac64.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/cmac-aes128.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/cmac-aes256.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/cmac-des3.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/cmac-aes128-meta.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/cmac-aes256-meta.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/cmac-des3-meta.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/gost28147.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/gosthash94.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/gosthash94-meta.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/hmac.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/hmac-gosthash94.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/hmac-md5.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/hmac-ripemd160.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/hmac-sha1.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/hmac-sha224.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/hmac-sha256.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/hmac-sha384.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/hmac-sha512.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/hmac-md5-meta.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/hmac-ripemd160-meta.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/hmac-sha1-meta.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/hmac-sha224-meta.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/hmac-sha256-meta.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/hmac-sha384-meta.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/hmac-sha512-meta.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/knuth-lfib.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/hkdf.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/md2.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/md2-meta.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/md4.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/md4-meta.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/md5.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/md5-compress.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/md5-compat.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/md5-meta.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/memeql-sec.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/memxor.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/memxor3.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/nettle-lookup-hash.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/nettle-meta-aeads.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/nettle-meta-armors.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/nettle-meta-ciphers.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/nettle-meta-hashes.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/nettle-meta-macs.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/pbkdf2.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/pbkdf2-hmac-gosthash94.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/pbkdf2-hmac-sha1.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/pbkdf2-hmac-sha256.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/poly1305-aes.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/poly1305-internal.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/realloc.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/ripemd160.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/ripemd160-compress.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/ripemd160-meta.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/salsa20-core-internal.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/salsa20-crypt.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/salsa20r12-crypt.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/salsa20-set-key.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/salsa20-set-nonce.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/salsa20-128-set-key.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/salsa20-256-set-key.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/sha1.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/sha1-compress.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/sha1-meta.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/sha256.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/sha256-compress.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/sha224-meta.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/sha256-meta.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/sha512.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/sha512-compress.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/sha384-meta.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/sha512-meta.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/sha512-224-meta.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/sha512-256-meta.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/sha3.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/sha3-permute.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/sha3-224.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/sha3-224-meta.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/sha3-256.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/sha3-256-meta.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/sha3-384.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/sha3-384-meta.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/sha3-512.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/sha3-512-meta.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/shake256.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/serpent-set-key.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/serpent-encrypt.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/serpent-decrypt.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/serpent-meta.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/twofish.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/twofish-meta.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/umac-nh.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/umac-nh-n.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/umac-l2.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/umac-l3.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/umac-poly64.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/umac-poly128.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/umac-set-key.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/umac32.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/umac64.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/umac96.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/umac128.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/version.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/write-be32.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/write-le32.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/write-le64.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/yarrow256.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/yarrow_key_event.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/xts.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/xts-aes128.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/xts-aes256.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/aes-decrypt-internal.s
+LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/aes-encrypt-internal.s
+LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/camellia-crypt-internal.s
+LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/chacha-core-internal.s
+LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/md5-compress.s
+LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/memxor.s
+LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/memxor3.s
+LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/poly1305-internal.s
+LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/salsa20-core-internal.s
+LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/salsa20-crypt.s 
+LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/sha1-compress.s
+LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/sha256-compress.s
+LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/sha512-compress.s
+LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/sha3-permute.s
+LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/serpent-encrypt.s
+LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/serpent-decrypt.s
+LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/umac-nh.s
+LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/umac-nh-n.s
+LIBNETTLE_SRCS-y += $(LIBNETTLE_SUBDIR)/gcm-hash8.s
+
+# Run ./configure
+$(LIBNETTLE_SUBDIR)/.configured: $(LIBNETTLE_BUILD)/.origin
+	$(call verbose_cmd,CONFIG,libnettle: $(notdir $@), cd $(LIBNETTLE_SUBDIR) && ./configure && touch $@)
+
+# Prepare assembly files
+
+LIBNETTLE_ASSEMBLY_DEPS = $(LIBNETTLE_SUBDIR)/asm.m4 $(LIBNETTLE_SUBDIR)/machine.m4 $(LIBNETTLE_SUBDIR)/config.m4
+
+$(LIBNETTLE_SUBDIR)/aes-decrypt-internal.s: $(LIBNETTLE_ASSEMBLY_DEPS) $(LIBNETTLE_SUBDIR)/aes-decrypt-internal.asm
+    $(call verbose_cmd,GEN,libnettle: $(notdir $@), cd $(LIBNETTLE_SUBDIR) && /usr/bin/m4 $^ >$@)
+$(LIBNETTLE_SUBDIR)/aes-encrypt-internal.s: $(LIBNETTLE_ASSEMBLY_DEPS) $(LIBNETTLE_SUBDIR)/aes-encrypt-internal.asm
+    $(call verbose_cmd,GEN,libnettle: $(notdir $@), cd $(LIBNETTLE_SUBDIR) && /usr/bin/m4 $^ >$@)
+$(LIBNETTLE_SUBDIR)/camellia-crypt-internal.s: $(LIBNETTLE_ASSEMBLY_DEPS) $(LIBNETTLE_SUBDIR)/camellia-crypt-internal.asm
+    $(call verbose_cmd,GEN,libnettle: $(notdir $@), cd $(LIBNETTLE_SUBDIR) && /usr/bin/m4 $^ >$@)
+$(LIBNETTLE_SUBDIR)/chacha-core-internal.s: $(LIBNETTLE_ASSEMBLY_DEPS) $(LIBNETTLE_SUBDIR)/chacha-core-internal.asm
+    $(call verbose_cmd,GEN,libnettle: $(notdir $@), cd $(LIBNETTLE_SUBDIR) && /usr/bin/m4 $^ >$@)
+$(LIBNETTLE_SUBDIR)/md5-compress.s: $(LIBNETTLE_ASSEMBLY_DEPS) $(LIBNETTLE_SUBDIR)/md5-compress.asm
+    $(call verbose_cmd,GEN,libnettle: $(notdir $@), cd $(LIBNETTLE_SUBDIR) && /usr/bin/m4 $^ >$@)
+$(LIBNETTLE_SUBDIR)/memxor.s: $(LIBNETTLE_ASSEMBLY_DEPS) $(LIBNETTLE_SUBDIR)/memxor.asm
+    $(call verbose_cmd,GEN,libnettle: $(notdir $@), cd $(LIBNETTLE_SUBDIR) && /usr/bin/m4 $^ >$@)
+$(LIBNETTLE_SUBDIR)/memxor3.s: $(LIBNETTLE_ASSEMBLY_DEPS) $(LIBNETTLE_SUBDIR)/memxor3.asm
+    $(call verbose_cmd,GEN,libnettle: $(notdir $@), cd $(LIBNETTLE_SUBDIR) && /usr/bin/m4 $^ >$@)
+$(LIBNETTLE_SUBDIR)/poly1305-internal.s: $(LIBNETTLE_ASSEMBLY_DEPS) $(LIBNETTLE_SUBDIR)/poly1305-internal.asm
+    $(call verbose_cmd,GEN,libnettle: $(notdir $@), cd $(LIBNETTLE_SUBDIR) && /usr/bin/m4 $^ >$@)
+$(LIBNETTLE_SUBDIR)/salsa20-core-internal.s: $(LIBNETTLE_ASSEMBLY_DEPS) $(LIBNETTLE_SUBDIR)/salsa20-core-internal.asm
+    $(call verbose_cmd,GEN,libnettle: $(notdir $@), cd $(LIBNETTLE_SUBDIR) && /usr/bin/m4 $^ >$@)
+$(LIBNETTLE_SUBDIR)/salsa20-crypt.s: $(LIBNETTLE_ASSEMBLY_DEPS) $(LIBNETTLE_SUBDIR)/salsa20-crypt.asm
+    $(call verbose_cmd,GEN,libnettle: $(notdir $@), cd $(LIBNETTLE_SUBDIR) && /usr/bin/m4 $^ >$@)
+$(LIBNETTLE_SUBDIR)/sha1-compress.s: $(LIBNETTLE_ASSEMBLY_DEPS) $(LIBNETTLE_SUBDIR)/sha1-compress.asm
+    $(call verbose_cmd,GEN,libnettle: $(notdir $@), cd $(LIBNETTLE_SUBDIR) && /usr/bin/m4 $^ >$@)
+$(LIBNETTLE_SUBDIR)/sha256-compress.s: $(LIBNETTLE_ASSEMBLY_DEPS) $(LIBNETTLE_SUBDIR)/sha256-compress.asm
+    $(call verbose_cmd,GEN,libnettle: $(notdir $@), cd $(LIBNETTLE_SUBDIR) && /usr/bin/m4 $^ >$@)
+$(LIBNETTLE_SUBDIR)/sha512-compress.s: $(LIBNETTLE_ASSEMBLY_DEPS) $(LIBNETTLE_SUBDIR)/sha512-compress.asm
+    $(call verbose_cmd,GEN,libnettle: $(notdir $@), cd $(LIBNETTLE_SUBDIR) && /usr/bin/m4 $^ >$@)
+$(LIBNETTLE_SUBDIR)/sha3-permute.s: $(LIBNETTLE_ASSEMBLY_DEPS) $(LIBNETTLE_SUBDIR)/sha3-permute.asm
+    $(call verbose_cmd,GEN,libnettle: $(notdir $@), cd $(LIBNETTLE_SUBDIR) && /usr/bin/m4 $^ >$@)
+$(LIBNETTLE_SUBDIR)/serpent-encrypt.s: $(LIBNETTLE_ASSEMBLY_DEPS) $(LIBNETTLE_SUBDIR)/serpent-encrypt.asm
+    $(call verbose_cmd,GEN,libnettle: $(notdir $@), cd $(LIBNETTLE_SUBDIR) && /usr/bin/m4 $^ >$@)
+$(LIBNETTLE_SUBDIR)/serpent-decrypt.s: $(LIBNETTLE_ASSEMBLY_DEPS) $(LIBNETTLE_SUBDIR)/serpent-decrypt.asm
+    $(call verbose_cmd,GEN,libnettle: $(notdir $@), cd $(LIBNETTLE_SUBDIR) && /usr/bin/m4 $^ >$@)
+$(LIBNETTLE_SUBDIR)/umac-nh.s: $(LIBNETTLE_ASSEMBLY_DEPS) $(LIBNETTLE_SUBDIR)/umac-nh.asm
+    $(call verbose_cmd,GEN,libnettle: $(notdir $@), d $(LIBNETTLE_SUBDIR) && /usr/bin/m4 $^ >$@)
+$(LIBNETTLE_SUBDIR)/umac-nh-n.s: $(LIBNETTLE_ASSEMBLY_DEPS) $(LIBNETTLE_SUBDIR)/umac-nh-n.asm
+    $(call verbose_cmd,GEN,libnettle: $(notdir $@), cd $(LIBNETTLE_SUBDIR) && /usr/bin/m4 $^ >$@)
+$(LIBNETTLE_SUBDIR)/gcm-hash8.s: $(LIBNETTLE_ASSEMBLY_DEPS) $(LIBNETTLE_SUBDIR)/gcm-hash8.asm
+    $(call verbose_cmd,GEN,libnettle: $(notdir $@), cd $(LIBNETTLE_SUBDIR) && /usr/bin/m4 $^ >$@)
+
+LIBNETTLE_PREPAED_DEPS = \
+    $(LIBNETTLE_SUBDIR)/.configured \
+    $(LIBNETTLE_SUBDIR)/aes-decrypt-internal.s \
+    $(LIBNETTLE_SUBDIR)/aes-encrypt-internal.s \
+    $(LIBNETTLE_SUBDIR)/camellia-crypt-internal.s \
+    $(LIBNETTLE_SUBDIR)/chacha-core-internal.s \
+    $(LIBNETTLE_SUBDIR)/md5-compress.s \
+    $(LIBNETTLE_SUBDIR)/memxor.s \
+    $(LIBNETTLE_SUBDIR)/memxor3.s \
+    $(LIBNETTLE_SUBDIR)/poly1305-internal.s \
+    $(LIBNETTLE_SUBDIR)/salsa20-core-internal.s \
+    $(LIBNETTLE_SUBDIR)/salsa20-crypt.s \
+    $(LIBNETTLE_SUBDIR)/sha1-compress.s \
+    $(LIBNETTLE_SUBDIR)/sha256-compress.s \
+    $(LIBNETTLE_SUBDIR)/sha512-compress.s \
+    $(LIBNETTLE_SUBDIR)/sha3-permute.s \
+    $(LIBNETTLE_SUBDIR)/serpent-encrypt.s \
+    $(LIBNETTLE_SUBDIR)/serpent-decrypt.s \
+    $(LIBNETTLE_SUBDIR)/umac-nh.s \
+    $(LIBNETTLE_SUBDIR)/umac-nh-n.s \
+    $(LIBNETTLE_SUBDIR)/gcm-hash8.s \
+
+$(LIBNETTLE_BUILD)/.prepared : $(LIBNETTLE_PREPAED_DEPS)
+    $(call verbose_cmd,GEN,libnettle: $(notdir $@), cd $(LIBNETTLE_SUBDIR) touch $@)
+
+UK_PREPARE += $(LIBNETTLE_BUILD)/.prepared
diff --git a/include/alloca.h b/include/alloca.h
new file mode 100644
index 0000000..bd44688
--- /dev/null
+++ b/include/alloca.h
@@ -0,0 +1,40 @@
+/* Copyright (C) 1992-2020 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <https://www.gnu.org/licenses/>.  */
+
+#ifndef	_ALLOCA_H
+#define	_ALLOCA_H	1
+
+#include <features.h>
+
+#define	__need_size_t
+#include <stddef.h>
+
+__BEGIN_DECLS
+
+/* Remove any previous definitions.  */
+#undef	alloca
+
+/* Allocate a block that will be freed when the calling function exits.  */
+extern void *alloca (size_t __size) __THROW;
+
+#ifdef	__GNUC__
+# define alloca(size)	__builtin_alloca (size)
+#endif /* GCC.  */
+
+__END_DECLS
+
+#endif /* alloca.h */
diff --git a/include/bits/long-double.h b/include/bits/long-double.h
new file mode 100644
index 0000000..b77124f
--- /dev/null
+++ b/include/bits/long-double.h
@@ -0,0 +1,21 @@
+/* Properties of long double type.  ldbl-96 version.
+   Copyright (C) 2016-2020 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License  published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <https://www.gnu.org/licenses/>.  */
+
+/* long double is distinct from double, so there is nothing to
+   define here.  */
+#define __LONG_DOUBLE_USES_FLOAT128 0
diff --git a/include/bits/wordsize.h b/include/bits/wordsize.h
new file mode 100644
index 0000000..70f652b
--- /dev/null
+++ b/include/bits/wordsize.h
@@ -0,0 +1,17 @@
+/* Determine the wordsize from the preprocessor defines.  */
+
+#if defined __x86_64__ && !defined __ILP32__
+# define __WORDSIZE	64
+#else
+# define __WORDSIZE	32
+#define __WORDSIZE32_SIZE_ULONG		0
+#define __WORDSIZE32_PTRDIFF_LONG	0
+#endif
+
+#ifdef __x86_64__
+# define __WORDSIZE_TIME64_COMPAT32	1
+/* Both x86-64 and x32 use the 64-bit system call interface.  */
+# define __SYSCALL_WORDSIZE		64
+#else
+# define __WORDSIZE_TIME64_COMPAT32	0
+#endif
diff --git a/include/features.h b/include/features.h
new file mode 100644
index 0000000..f334777
--- /dev/null
+++ b/include/features.h
@@ -0,0 +1,488 @@
+/* Copyright (C) 1991-2020 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <https://www.gnu.org/licenses/>.  */
+
+#ifndef	_FEATURES_H
+#define	_FEATURES_H	1
+
+/* These are defined by the user (or the compiler)
+   to specify the desired environment:
+
+   __STRICT_ANSI__	ISO Standard C.
+   _ISOC99_SOURCE	Extensions to ISO C89 from ISO C99.
+   _ISOC11_SOURCE	Extensions to ISO C99 from ISO C11.
+   _ISOC2X_SOURCE	Extensions to ISO C99 from ISO C2X.
+   __STDC_WANT_LIB_EXT2__
+			Extensions to ISO C99 from TR 27431-2:2010.
+   __STDC_WANT_IEC_60559_BFP_EXT__
+			Extensions to ISO C11 from TS 18661-1:2014.
+   __STDC_WANT_IEC_60559_FUNCS_EXT__
+			Extensions to ISO C11 from TS 18661-4:2015.
+   __STDC_WANT_IEC_60559_TYPES_EXT__
+			Extensions to ISO C11 from TS 18661-3:2015.
+
+   _POSIX_SOURCE	IEEE Std 1003.1.
+   _POSIX_C_SOURCE	If ==1, like _POSIX_SOURCE; if >=2 add IEEE Std 1003.2;
+			if >=199309L, add IEEE Std 1003.1b-1993;
+			if >=199506L, add IEEE Std 1003.1c-1995;
+			if >=200112L, all of IEEE 1003.1-2004
+			if >=200809L, all of IEEE 1003.1-2008
+   _XOPEN_SOURCE	Includes POSIX and XPG things.  Set to 500 if
+			Single Unix conformance is wanted, to 600 for the
+			sixth revision, to 700 for the seventh revision.
+   _XOPEN_SOURCE_EXTENDED XPG things and X/Open Unix extensions.
+   _LARGEFILE_SOURCE	Some more functions for correct standard I/O.
+   _LARGEFILE64_SOURCE	Additional functionality from LFS for large files.
+   _FILE_OFFSET_BITS=N	Select default filesystem interface.
+   _ATFILE_SOURCE	Additional *at interfaces.
+   _GNU_SOURCE		All of the above, plus GNU extensions.
+   _DEFAULT_SOURCE	The default set of features (taking precedence over
+			__STRICT_ANSI__).
+
+   _FORTIFY_SOURCE	Add security hardening to many library functions.
+			Set to 1 or 2; 2 performs stricter checks than 1.
+
+   _REENTRANT, _THREAD_SAFE
+			Obsolete; equivalent to _POSIX_C_SOURCE=199506L.
+
+   The `-ansi' switch to the GNU C compiler, and standards conformance
+   options such as `-std=c99', define __STRICT_ANSI__.  If none of
+   these are defined, or if _DEFAULT_SOURCE is defined, the default is
+   to have _POSIX_SOURCE set to one and _POSIX_C_SOURCE set to
+   200809L, as well as enabling miscellaneous functions from BSD and
+   SVID.  If more than one of these are defined, they accumulate.  For
+   example __STRICT_ANSI__, _POSIX_SOURCE and _POSIX_C_SOURCE together
+   give you ISO C, 1003.1, and 1003.2, but nothing else.
+
+   These are defined by this file and are used by the
+   header files to decide what to declare or define:
+
+   __GLIBC_USE (F)	Define things from feature set F.  This is defined
+			to 1 or 0; the subsequent macros are either defined
+			or undefined, and those tests should be moved to
+			__GLIBC_USE.
+   __USE_ISOC11		Define ISO C11 things.
+   __USE_ISOC99		Define ISO C99 things.
+   __USE_ISOC95		Define ISO C90 AMD1 (C95) things.
+   __USE_ISOCXX11	Define ISO C++11 things.
+   __USE_POSIX		Define IEEE Std 1003.1 things.
+   __USE_POSIX2		Define IEEE Std 1003.2 things.
+   __USE_POSIX199309	Define IEEE Std 1003.1, and .1b things.
+   __USE_POSIX199506	Define IEEE Std 1003.1, .1b, .1c and .1i things.
+   __USE_XOPEN		Define XPG things.
+   __USE_XOPEN_EXTENDED	Define X/Open Unix things.
+   __USE_UNIX98		Define Single Unix V2 things.
+   __USE_XOPEN2K        Define XPG6 things.
+   __USE_XOPEN2KXSI     Define XPG6 XSI things.
+   __USE_XOPEN2K8       Define XPG7 things.
+   __USE_XOPEN2K8XSI    Define XPG7 XSI things.
+   __USE_LARGEFILE	Define correct standard I/O things.
+   __USE_LARGEFILE64	Define LFS things with separate names.
+   __USE_FILE_OFFSET64	Define 64bit interface as default.
+   __USE_MISC		Define things from 4.3BSD or System V Unix.
+   __USE_ATFILE		Define *at interfaces and AT_* constants for them.
+   __USE_GNU		Define GNU extensions.
+   __USE_FORTIFY_LEVEL	Additional security measures used, according to level.
+
+   The macros `__GNU_LIBRARY__', `__GLIBC__', and `__GLIBC_MINOR__' are
+   defined by this file unconditionally.  `__GNU_LIBRARY__' is provided
+   only for compatibility.  All new code should use the other symbols
+   to test for features.
+
+   All macros listed above as possibly being defined by this file are
+   explicitly undefined if they are not explicitly defined.
+   Feature-test macros that are not defined by the user or compiler
+   but are implied by the other feature-test macros defined (or by the
+   lack of any definitions) are defined by the file.
+
+   ISO C feature test macros depend on the definition of the macro
+   when an affected header is included, not when the first system
+   header is included, and so they are handled in
+   <bits/libc-header-start.h>, which does not have a multiple include
+   guard.  Feature test macros that can be handled from the first
+   system header included are handled here.  */
+
+
+/* Undefine everything, so we get a clean slate.  */
+#undef	__USE_ISOC11
+#undef	__USE_ISOC99
+#undef	__USE_ISOC95
+#undef	__USE_ISOCXX11
+#undef	__USE_POSIX
+#undef	__USE_POSIX2
+#undef	__USE_POSIX199309
+#undef	__USE_POSIX199506
+#undef	__USE_XOPEN
+#undef	__USE_XOPEN_EXTENDED
+#undef	__USE_UNIX98
+#undef	__USE_XOPEN2K
+#undef	__USE_XOPEN2KXSI
+#undef	__USE_XOPEN2K8
+#undef	__USE_XOPEN2K8XSI
+#undef	__USE_LARGEFILE
+#undef	__USE_LARGEFILE64
+#undef	__USE_FILE_OFFSET64
+#undef	__USE_MISC
+#undef	__USE_ATFILE
+#undef	__USE_GNU
+#undef	__USE_FORTIFY_LEVEL
+#undef	__KERNEL_STRICT_NAMES
+#undef	__GLIBC_USE_ISOC2X
+#undef	__GLIBC_USE_DEPRECATED_GETS
+#undef	__GLIBC_USE_DEPRECATED_SCANF
+
+/* Suppress kernel-name space pollution unless user expressedly asks
+   for it.  */
+#ifndef _LOOSE_KERNEL_NAMES
+# define __KERNEL_STRICT_NAMES
+#endif
+
+/* Convenience macro to test the version of gcc.
+   Use like this:
+   #if __GNUC_PREREQ (2,8)
+   ... code requiring gcc 2.8 or later ...
+   #endif
+   Note: only works for GCC 2.0 and later, because __GNUC_MINOR__ was
+   added in 2.0.  */
+#if defined __GNUC__ && defined __GNUC_MINOR__
+# define __GNUC_PREREQ(maj, min) \
+	((__GNUC__ << 16) + __GNUC_MINOR__ >= ((maj) << 16) + (min))
+#else
+# define __GNUC_PREREQ(maj, min) 0
+#endif
+
+/* Similarly for clang.  Features added to GCC after version 4.2 may
+   or may not also be available in clang, and clang's definitions of
+   __GNUC(_MINOR)__ are fixed at 4 and 2 respectively.  Not all such
+   features can be queried via __has_extension/__has_feature.  */
+#if defined __clang_major__ && defined __clang_minor__
+# define __glibc_clang_prereq(maj, min) \
+  ((__clang_major__ << 16) + __clang_minor__ >= ((maj) << 16) + (min))
+#else
+# define __glibc_clang_prereq(maj, min) 0
+#endif
+
+/* Whether to use feature set F.  */
+#define __GLIBC_USE(F)	__GLIBC_USE_ ## F
+
+/* _BSD_SOURCE and _SVID_SOURCE are deprecated aliases for
+   _DEFAULT_SOURCE.  If _DEFAULT_SOURCE is present we do not
+   issue a warning; the expectation is that the source is being
+   transitioned to use the new macro.  */
+#if (defined _BSD_SOURCE || defined _SVID_SOURCE) \
+    && !defined _DEFAULT_SOURCE
+# warning "_BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE"
+# undef  _DEFAULT_SOURCE
+# define _DEFAULT_SOURCE	1
+#endif
+
+/* If _GNU_SOURCE was defined by the user, turn on all the other features.  */
+#ifdef _GNU_SOURCE
+# undef  _ISOC95_SOURCE
+# define _ISOC95_SOURCE	1
+# undef  _ISOC99_SOURCE
+# define _ISOC99_SOURCE	1
+# undef  _ISOC11_SOURCE
+# define _ISOC11_SOURCE	1
+# undef  _ISOC2X_SOURCE
+# define _ISOC2X_SOURCE	1
+# undef  _POSIX_SOURCE
+# define _POSIX_SOURCE	1
+# undef  _POSIX_C_SOURCE
+# define _POSIX_C_SOURCE	200809L
+# undef  _XOPEN_SOURCE
+# define _XOPEN_SOURCE	700
+# undef  _XOPEN_SOURCE_EXTENDED
+# define _XOPEN_SOURCE_EXTENDED	1
+# undef	 _LARGEFILE64_SOURCE
+# define _LARGEFILE64_SOURCE	1
+# undef  _DEFAULT_SOURCE
+# define _DEFAULT_SOURCE	1
+# undef  _ATFILE_SOURCE
+# define _ATFILE_SOURCE	1
+#endif
+
+/* If nothing (other than _GNU_SOURCE and _DEFAULT_SOURCE) is defined,
+   define _DEFAULT_SOURCE.  */
+#if (defined _DEFAULT_SOURCE					\
+     || (!defined __STRICT_ANSI__				\
+	 && !defined _ISOC99_SOURCE && !defined _ISOC11_SOURCE	\
+	 && !defined _ISOC2X_SOURCE				\
+	 && !defined _POSIX_SOURCE && !defined _POSIX_C_SOURCE	\
+	 && !defined _XOPEN_SOURCE))
+# undef  _DEFAULT_SOURCE
+# define _DEFAULT_SOURCE	1
+#endif
+
+/* This is to enable the ISO C2X extension.  */
+#if (defined _ISOC2X_SOURCE \
+     || (defined __STDC_VERSION__ && __STDC_VERSION__ > 201710L))
+# define __GLIBC_USE_ISOC2X	1
+#else
+# define __GLIBC_USE_ISOC2X	0
+#endif
+
+/* This is to enable the ISO C11 extension.  */
+#if (defined _ISOC11_SOURCE || defined _ISOC2X_SOURCE \
+     || (defined __STDC_VERSION__ && __STDC_VERSION__ >= 201112L))
+# define __USE_ISOC11	1
+#endif
+
+/* This is to enable the ISO C99 extension.  */
+#if (defined _ISOC99_SOURCE || defined _ISOC11_SOURCE			\
+     || defined _ISOC2X_SOURCE						\
+     || (defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L))
+# define __USE_ISOC99	1
+#endif
+
+/* This is to enable the ISO C90 Amendment 1:1995 extension.  */
+#if (defined _ISOC99_SOURCE || defined _ISOC11_SOURCE			\
+     || defined _ISOC2X_SOURCE						\
+     || (defined __STDC_VERSION__ && __STDC_VERSION__ >= 199409L))
+# define __USE_ISOC95	1
+#endif
+
+#ifdef __cplusplus
+/* This is to enable compatibility for ISO C++17.  */
+# if __cplusplus >= 201703L
+#  define __USE_ISOC11	1
+# endif
+/* This is to enable compatibility for ISO C++11.
+   Check the temporary macro for now, too.  */
+# if __cplusplus >= 201103L || defined __GXX_EXPERIMENTAL_CXX0X__
+#  define __USE_ISOCXX11	1
+#  define __USE_ISOC99	1
+# endif
+#endif
+
+/* If none of the ANSI/POSIX macros are defined, or if _DEFAULT_SOURCE
+   is defined, use POSIX.1-2008 (or another version depending on
+   _XOPEN_SOURCE).  */
+#ifdef _DEFAULT_SOURCE
+# if !defined _POSIX_SOURCE && !defined _POSIX_C_SOURCE
+#  define __USE_POSIX_IMPLICITLY	1
+# endif
+# undef  _POSIX_SOURCE
+# define _POSIX_SOURCE	1
+# undef  _POSIX_C_SOURCE
+# define _POSIX_C_SOURCE	200809L
+#endif
+
+#if ((!defined __STRICT_ANSI__					\
+      || (defined _XOPEN_SOURCE && (_XOPEN_SOURCE - 0) >= 500))	\
+     && !defined _POSIX_SOURCE && !defined _POSIX_C_SOURCE)
+# define _POSIX_SOURCE	1
+# if defined _XOPEN_SOURCE && (_XOPEN_SOURCE - 0) < 500
+#  define _POSIX_C_SOURCE	2
+# elif defined _XOPEN_SOURCE && (_XOPEN_SOURCE - 0) < 600
+#  define _POSIX_C_SOURCE	199506L
+# elif defined _XOPEN_SOURCE && (_XOPEN_SOURCE - 0) < 700
+#  define _POSIX_C_SOURCE	200112L
+# else
+#  define _POSIX_C_SOURCE	200809L
+# endif
+# define __USE_POSIX_IMPLICITLY	1
+#endif
+
+/* Some C libraries once required _REENTRANT and/or _THREAD_SAFE to be
+   defined in all multithreaded code.  GNU libc has not required this
+   for many years.  We now treat them as compatibility synonyms for
+   _POSIX_C_SOURCE=199506L, which is the earliest level of POSIX with
+   comprehensive support for multithreaded code.  Using them never
+   lowers the selected level of POSIX conformance, only raises it.  */
+#if ((!defined _POSIX_C_SOURCE || (_POSIX_C_SOURCE - 0) < 199506L) \
+     && (defined _REENTRANT || defined _THREAD_SAFE))
+# define _POSIX_SOURCE   1
+# undef  _POSIX_C_SOURCE
+# define _POSIX_C_SOURCE 199506L
+#endif
+
+#if (defined _POSIX_SOURCE					\
+     || (defined _POSIX_C_SOURCE && _POSIX_C_SOURCE >= 1)	\
+     || defined _XOPEN_SOURCE)
+# define __USE_POSIX	1
+#endif
+
+#if defined _POSIX_C_SOURCE && _POSIX_C_SOURCE >= 2 || defined _XOPEN_SOURCE
+# define __USE_POSIX2	1
+#endif
+
+#if defined _POSIX_C_SOURCE && (_POSIX_C_SOURCE - 0) >= 199309L
+# define __USE_POSIX199309	1
+#endif
+
+#if defined _POSIX_C_SOURCE && (_POSIX_C_SOURCE - 0) >= 199506L
+# define __USE_POSIX199506	1
+#endif
+
+#if defined _POSIX_C_SOURCE && (_POSIX_C_SOURCE - 0) >= 200112L
+# define __USE_XOPEN2K		1
+# undef __USE_ISOC95
+# define __USE_ISOC95		1
+# undef __USE_ISOC99
+# define __USE_ISOC99		1
+#endif
+
+#if defined _POSIX_C_SOURCE && (_POSIX_C_SOURCE - 0) >= 200809L
+# define __USE_XOPEN2K8		1
+# undef  _ATFILE_SOURCE
+# define _ATFILE_SOURCE	1
+#endif
+
+#ifdef	_XOPEN_SOURCE
+# define __USE_XOPEN	1
+# if (_XOPEN_SOURCE - 0) >= 500
+#  define __USE_XOPEN_EXTENDED	1
+#  define __USE_UNIX98	1
+#  undef _LARGEFILE_SOURCE
+#  define _LARGEFILE_SOURCE	1
+#  if (_XOPEN_SOURCE - 0) >= 600
+#   if (_XOPEN_SOURCE - 0) >= 700
+#    define __USE_XOPEN2K8	1
+#    define __USE_XOPEN2K8XSI	1
+#   endif
+#   define __USE_XOPEN2K	1
+#   define __USE_XOPEN2KXSI	1
+#   undef __USE_ISOC95
+#   define __USE_ISOC95		1
+#   undef __USE_ISOC99
+#   define __USE_ISOC99		1
+#  endif
+# else
+#  ifdef _XOPEN_SOURCE_EXTENDED
+#   define __USE_XOPEN_EXTENDED	1
+#  endif
+# endif
+#endif
+
+#ifdef _LARGEFILE_SOURCE
+# define __USE_LARGEFILE	1
+#endif
+
+#ifdef _LARGEFILE64_SOURCE
+# define __USE_LARGEFILE64	1
+#endif
+
+#if defined _FILE_OFFSET_BITS && _FILE_OFFSET_BITS == 64
+# define __USE_FILE_OFFSET64	1
+#endif
+
+#if defined _DEFAULT_SOURCE
+# define __USE_MISC	1
+#endif
+
+#ifdef	_ATFILE_SOURCE
+# define __USE_ATFILE	1
+#endif
+
+#ifdef	_GNU_SOURCE
+# define __USE_GNU	1
+#endif
+
+#if defined _FORTIFY_SOURCE && _FORTIFY_SOURCE > 0 \
+    && __GNUC_PREREQ (4, 1) && defined __OPTIMIZE__ && __OPTIMIZE__ > 0
+# if _FORTIFY_SOURCE > 1
+#  define __USE_FORTIFY_LEVEL 2
+# else
+#  define __USE_FORTIFY_LEVEL 1
+# endif
+#else
+# define __USE_FORTIFY_LEVEL 0
+#endif
+
+/* The function 'gets' existed in C89, but is impossible to use
+   safely.  It has been removed from ISO C11 and ISO C++14.  Note: for
+   compatibility with various implementations of <cstdio>, this test
+   must consider only the value of __cplusplus when compiling C++.  */
+#if defined __cplusplus ? __cplusplus >= 201402L : defined __USE_ISOC11
+# define __GLIBC_USE_DEPRECATED_GETS 0
+#else
+# define __GLIBC_USE_DEPRECATED_GETS 1
+#endif
+
+/* GNU formerly extended the scanf functions with modified format
+   specifiers %as, %aS, and %a[...] that allocate a buffer for the
+   input using malloc.  This extension conflicts with ISO C99, which
+   defines %a as a standalone format specifier that reads a floating-
+   point number; moreover, POSIX.1-2008 provides the same feature
+   using the modifier letter 'm' instead (%ms, %mS, %m[...]).
+
+   We now follow C99 unless GNU extensions are active and the compiler
+   is specifically in C89 or C++98 mode (strict or not).  For
+   instance, with GCC, -std=gnu11 will have C99-compliant scanf with
+   or without -D_GNU_SOURCE, but -std=c89 -D_GNU_SOURCE will have the
+   old extension.  */
+#if (defined __USE_GNU							\
+     && (defined __cplusplus						\
+	 ? (__cplusplus < 201103L && !defined __GXX_EXPERIMENTAL_CXX0X__) \
+	 : (!defined __STDC_VERSION__ || __STDC_VERSION__ < 199901L)))
+# define __GLIBC_USE_DEPRECATED_SCANF 1
+#else
+# define __GLIBC_USE_DEPRECATED_SCANF 0
+#endif
+
+/* Get definitions of __STDC_* predefined macros, if the compiler has
+   not preincluded this header automatically.  */
+#include <stdc-predef.h>
+
+/* This macro indicates that the installed library is the GNU C Library.
+   For historic reasons the value now is 6 and this will stay from now
+   on.  The use of this variable is deprecated.  Use __GLIBC__ and
+   __GLIBC_MINOR__ now (see below) when you want to test for a specific
+   GNU C library version and use the values in <gnu/lib-names.h> to get
+   the sonames of the shared libraries.  */
+#undef  __GNU_LIBRARY__
+#define __GNU_LIBRARY__ 6
+
+/* Major and minor version number of the GNU C library package.  Use
+   these macros to test for features in specific releases.  */
+#define	__GLIBC__	2
+#define	__GLIBC_MINOR__	31
+
+#define __GLIBC_PREREQ(maj, min) \
+	((__GLIBC__ << 16) + __GLIBC_MINOR__ >= ((maj) << 16) + (min))
+
+/* This is here only because every header file already includes this one.  */
+#ifndef __ASSEMBLER__
+# ifndef _SYS_CDEFS_H
+#  include <sys/cdefs.h>
+# endif
+
+/* If we don't have __REDIRECT, prototypes will be missing if
+   __USE_FILE_OFFSET64 but not __USE_LARGEFILE[64]. */
+# if defined __USE_FILE_OFFSET64 && !defined __REDIRECT
+#  define __USE_LARGEFILE	1
+#  define __USE_LARGEFILE64	1
+# endif
+
+#endif	/* !ASSEMBLER */
+
+/* Decide whether we can define 'extern inline' functions in headers.  */
+#if __GNUC_PREREQ (2, 7) && defined __OPTIMIZE__ \
+    && !defined __OPTIMIZE_SIZE__ && !defined __NO_INLINE__ \
+    && defined __extern_inline
+# define __USE_EXTERN_INLINES	1
+#endif
+
+
+/* This is here only because every header file already includes this one.
+   Get the definitions of all the appropriate `__stub_FUNCTION' symbols.
+   <gnu/stubs.h> contains `#define __stub_FUNCTION' when FUNCTION is a stub
+   that will always return failure (and set errno to ENOSYS).  */
+#include <gnu/stubs.h>
+
+
+#endif	/* features.h  */
diff --git a/include/gnu/stubs-32.h b/include/gnu/stubs-32.h
new file mode 100644
index 0000000..9a304f4
--- /dev/null
+++ b/include/gnu/stubs-32.h
@@ -0,0 +1,18 @@
+/* This file is automatically generated.
+   It defines a symbol `__stub_FUNCTION' for each function
+   in the C library which is a stub, meaning it will fail
+   every time called, usually setting errno to ENOSYS.  */
+
+#ifdef _LIBC
+# error Applications may not define the macro _LIBC
+#endif
+
+#define __stub_chflags
+#define __stub_fchflags
+#define __stub_gtty
+#define __stub_lchmod
+#define __stub_revoke
+#define __stub_setlogin
+#define __stub_sigreturn
+#define __stub_sstk
+#define __stub_stty
diff --git a/include/gnu/stubs-64.h b/include/gnu/stubs-64.h
new file mode 100644
index 0000000..4f9c4ba
--- /dev/null
+++ b/include/gnu/stubs-64.h
@@ -0,0 +1,19 @@
+/* This file is automatically generated.
+   It defines a symbol `__stub_FUNCTION' for each function
+   in the C library which is a stub, meaning it will fail
+   every time called, usually setting errno to ENOSYS.  */
+
+#ifdef _LIBC
+# error Applications may not define the macro _LIBC
+#endif
+
+#define __stub___compat_bdflush
+#define __stub_chflags
+#define __stub_fchflags
+#define __stub_gtty
+#define __stub_lchmod
+#define __stub_revoke
+#define __stub_setlogin
+#define __stub_sigreturn
+#define __stub_sstk
+#define __stub_stty
diff --git a/include/gnu/stubs-x32.h b/include/gnu/stubs-x32.h
new file mode 100644
index 0000000..5421416
--- /dev/null
+++ b/include/gnu/stubs-x32.h
@@ -0,0 +1,24 @@
+/* This file is automatically generated.
+   It defines a symbol `__stub_FUNCTION' for each function
+   in the C library which is a stub, meaning it will fail
+   every time called, usually setting errno to ENOSYS.  */
+
+#ifdef _LIBC
+# error Applications may not define the macro _LIBC
+#endif
+
+#define __stub___compat_bdflush
+#define __stub___compat_create_module
+#define __stub___compat_get_kernel_syms
+#define __stub___compat_nfsservctl
+#define __stub___compat_query_module
+#define __stub___compat_uselib
+#define __stub_chflags
+#define __stub_fchflags
+#define __stub_gtty
+#define __stub_lchmod
+#define __stub_revoke
+#define __stub_setlogin
+#define __stub_sigreturn
+#define __stub_sstk
+#define __stub_stty
diff --git a/include/gnu/stubs.h b/include/gnu/stubs.h
new file mode 100644
index 0000000..70a1ba0
--- /dev/null
+++ b/include/gnu/stubs.h
@@ -0,0 +1,14 @@
+/* This file is automatically generated.
+   This file selects the right generated file of `__stub_FUNCTION' macros
+   based on the architecture being compiled for.  */
+
+
+#if !defined __x86_64__
+# include <gnu/stubs-32.h>
+#endif
+#if defined __x86_64__ && defined __LP64__
+# include <gnu/stubs-64.h>
+#endif
+#if defined __x86_64__ && defined __ILP32__
+# include <gnu/stubs-x32.h>
+#endif
diff --git a/include/limits.h b/include/limits.h
new file mode 100644
index 0000000..1c9c030
--- /dev/null
+++ b/include/limits.h
@@ -0,0 +1,149 @@
+/* Copyright (C) 1991, 1992, 1996, 1997, 1998, 1999, 2000, 2005
+   Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+/*
+ *        ISO C99 Standard: 7.10/5.2.4.2.1 Sizes of integer types        <limits.h>
+ */
+
+#ifndef _LIBC_LIMITS_H_
+#define _LIBC_LIMITS_H_        1
+
+#include <features.h>
+
+
+/* Maximum length of any multibyte character in any locale.
+   We define this value here since the gcc header does not define
+   the correct value.  */
+#define MB_LEN_MAX        16
+
+
+/* If we are not using GNU CC we have to define all the symbols ourself.
+   Otherwise use gcc's definitions (see below).  */
+
+
+/* We only protect from multiple inclusion here, because all the other
+   #include's protect themselves, and in GCC 2 we may #include_next through
+   multiple copies of this file before we get to GCC's.  */
+# ifndef _LIMITS_H
+#  define _LIMITS_H        1
+
+#include <bits/wordsize.h>
+
+/* We don't have #include_next.
+   Define ANSI <limits.h> for standard 32-bit words.  */
+
+/* These assume 8-bit `char's, 16-bit `short int's,
+   and 32-bit `int's and `long int's.  */
+
+/* Number of bits in a `char'.        */
+#  define CHAR_BIT        8
+
+/* Minimum and maximum values a `signed char' can hold.  */
+#  define SCHAR_MIN        (-128)
+#  define SCHAR_MAX        127
+
+/* Maximum value an `unsigned char' can hold.  (Minimum is 0.)  */
+#  define UCHAR_MAX        255
+
+/* Minimum and maximum values a `char' can hold.  */
+#  ifdef __CHAR_UNSIGNED__
+#   define CHAR_MIN        0
+#   define CHAR_MAX        UCHAR_MAX
+#  else
+#   define CHAR_MIN        SCHAR_MIN
+#   define CHAR_MAX        SCHAR_MAX
+#  endif
+
+/* Minimum and maximum values a `signed short int' can hold.  */
+#  define SHRT_MIN        (-32768)
+#  define SHRT_MAX        32767
+
+/* Maximum value an `unsigned short int' can hold.  (Minimum is 0.)  */
+#  define USHRT_MAX        65535
+
+/* Minimum and maximum values a `signed int' can hold.  */
+#  define INT_MIN        (-INT_MAX - 1)
+#  define INT_MAX        2147483647
+
+/* Maximum value an `unsigned int' can hold.  (Minimum is 0.)  */
+#  define UINT_MAX        4294967295U
+
+/* Minimum and maximum values a `signed long int' can hold.  */
+#  if __WORDSIZE == 64
+#   define LONG_MAX        9223372036854775807L
+#  else
+#   define LONG_MAX        2147483647L
+#  endif
+#  define LONG_MIN        (-LONG_MAX - 1L)
+
+/* Maximum value an `unsigned long int' can hold.  (Minimum is 0.)  */
+#  if __WORDSIZE == 64
+#   define ULONG_MAX        18446744073709551615UL
+#  else
+#   define ULONG_MAX        4294967295UL
+#  endif
+
+#  ifdef __USE_ISOC99
+
+/* Minimum and maximum values a `signed long long int' can hold.  */
+#   define LLONG_MAX        9223372036854775807LL
+#   define LLONG_MIN        (-LLONG_MAX - 1LL)
+
+/* Maximum value an `unsigned long long int' can hold.  (Minimum is 0.)  */
+#   define ULLONG_MAX        18446744073709551615ULL
+
+#  endif /* ISO C99 */
+
+# endif        /* limits.h  */
+
+#endif        /* !_LIBC_LIMITS_H_ */
+
+ /* Get the compiler's limits.h, which defines almost all the ISO constants.
+
+    We put this #include_next outside the double inclusion check because
+    it should be possible to include this file more than once and still get
+    the definitions from gcc's header.  */
+
+/* The <limits.h> files in some gcc versions don't define LLONG_MIN,
+   LLONG_MAX, and ULLONG_MAX.  Instead only the values gcc defined for
+   ages are available.  */
+#if defined __USE_ISOC99 && defined __GNUC__
+# ifndef LLONG_MIN
+#  define LLONG_MIN        (-LLONG_MAX-1)
+# endif
+# ifndef LLONG_MAX
+#  define LLONG_MAX        __LONG_LONG_MAX__
+# endif
+# ifndef ULLONG_MAX
+#  define ULLONG_MAX        (LLONG_MAX * 2ULL + 1)
+# endif
+#endif
+
+#ifdef        __USE_POSIX
+/* POSIX adds things to <limits.h>.  */
+# include <bits/posix1_lim.h>
+#endif
+
+#ifdef        __USE_POSIX2
+# include <bits/posix2_lim.h>
+#endif
+
+#ifdef        __USE_XOPEN
+# include <bits/xopen_lim.h>
+#endif
\ No newline at end of file
diff --git a/include/stdc-predef.h b/include/stdc-predef.h
new file mode 100644
index 0000000..eaf0a6a
--- /dev/null
+++ b/include/stdc-predef.h
@@ -0,0 +1,60 @@
+/* Copyright (C) 1991-2020 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <https://www.gnu.org/licenses/>.  */
+
+#ifndef	_STDC_PREDEF_H
+#define	_STDC_PREDEF_H	1
+
+/* This header is separate from features.h so that the compiler can
+   include it implicitly at the start of every compilation.  It must
+   not itself include <features.h> or any other header that includes
+   <features.h> because the implicit include comes before any feature
+   test macros that may be defined in a source file before it first
+   explicitly includes a system header.  GCC knows the name of this
+   header in order to preinclude it.  */
+
+/* glibc's intent is to support the IEC 559 math functionality, real
+   and complex.  If the GCC (4.9 and later) predefined macros
+   specifying compiler intent are available, use them to determine
+   whether the overall intent is to support these features; otherwise,
+   presume an older compiler has intent to support these features and
+   define these macros by default.  */
+
+#ifdef __GCC_IEC_559
+# if __GCC_IEC_559 > 0
+#  define __STDC_IEC_559__		1
+# endif
+#else
+# define __STDC_IEC_559__		1
+#endif
+
+#ifdef __GCC_IEC_559_COMPLEX
+# if __GCC_IEC_559_COMPLEX > 0
+#  define __STDC_IEC_559_COMPLEX__	1
+# endif
+#else
+# define __STDC_IEC_559_COMPLEX__	1
+#endif
+
+/* wchar_t uses Unicode 10.0.0.  Version 10.0 of the Unicode Standard is
+   synchronized with ISO/IEC 10646:2017, fifth edition, plus
+   the following additions from Amendment 1 to the fifth edition:
+   - 56 emoji characters
+   - 285 hentaigana
+   - 3 additional Zanabazar Square characters */
+#define __STDC_ISO_10646__		201706L
+
+#endif
diff --git a/include/stddef.h b/include/stddef.h
new file mode 100644
index 0000000..e69de29
diff --git a/include/sys/cdefs.h b/include/sys/cdefs.h
new file mode 100644
index 0000000..ff7144f
--- /dev/null
+++ b/include/sys/cdefs.h
@@ -0,0 +1,517 @@
+/* Copyright (C) 1992-2020 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <https://www.gnu.org/licenses/>.  */
+
+#ifndef	_SYS_CDEFS_H
+#define	_SYS_CDEFS_H	1
+
+/* We are almost always included from features.h. */
+#ifndef _FEATURES_H
+# include <features.h>
+#endif
+
+/* The GNU libc does not support any K&R compilers or the traditional mode
+   of ISO C compilers anymore.  Check for some of the combinations not
+   anymore supported.  */
+#if defined __GNUC__ && !defined __STDC__
+# error "You need a ISO C conforming compiler to use the glibc headers"
+#endif
+
+/* Some user header file might have defined this before.  */
+#undef	__P
+#undef	__PMT
+
+#ifdef __GNUC__
+
+/* All functions, except those with callbacks or those that
+   synchronize memory, are leaf functions.  */
+# if __GNUC_PREREQ (4, 6) && !defined _LIBC
+#  define __LEAF , __leaf__
+#  define __LEAF_ATTR __attribute__ ((__leaf__))
+# else
+#  define __LEAF
+#  define __LEAF_ATTR
+# endif
+
+/* GCC can always grok prototypes.  For C++ programs we add throw()
+   to help it optimize the function calls.  But this works only with
+   gcc 2.8.x and egcs.  For gcc 3.2 and up we even mark C functions
+   as non-throwing using a function attribute since programs can use
+   the -fexceptions options for C code as well.  */
+# if !defined __cplusplus && __GNUC_PREREQ (3, 3)
+#  define __THROW	__attribute__ ((__nothrow__ __LEAF))
+#  define __THROWNL	__attribute__ ((__nothrow__))
+#  define __NTH(fct)	__attribute__ ((__nothrow__ __LEAF)) fct
+#  define __NTHNL(fct)  __attribute__ ((__nothrow__)) fct
+# else
+#  if defined __cplusplus && __GNUC_PREREQ (2,8)
+#   define __THROW	throw ()
+#   define __THROWNL	throw ()
+#   define __NTH(fct)	__LEAF_ATTR fct throw ()
+#   define __NTHNL(fct) fct throw ()
+#  else
+#   define __THROW
+#   define __THROWNL
+#   define __NTH(fct)	fct
+#   define __NTHNL(fct) fct
+#  endif
+# endif
+
+#else	/* Not GCC.  */
+
+# if (defined __cplusplus						\
+      || (defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L))
+#  define __inline	inline
+# else
+#  define __inline		/* No inline functions.  */
+# endif
+
+# define __THROW
+# define __THROWNL
+# define __NTH(fct)	fct
+
+#endif	/* GCC.  */
+
+/* Compilers that are not clang may object to
+       #if defined __clang__ && __has_extension(...)
+   even though they do not need to evaluate the right-hand side of the &&.  */
+#if defined __clang__ && defined __has_extension
+# define __glibc_clang_has_extension(ext) __has_extension (ext)
+#else
+# define __glibc_clang_has_extension(ext) 0
+#endif
+
+/* These two macros are not used in glibc anymore.  They are kept here
+   only because some other projects expect the macros to be defined.  */
+#define __P(args)	args
+#define __PMT(args)	args
+
+/* For these things, GCC behaves the ANSI way normally,
+   and the non-ANSI way under -traditional.  */
+
+#define __CONCAT(x,y)	x ## y
+#define __STRING(x)	#x
+
+/* This is not a typedef so `const __ptr_t' does the right thing.  */
+#define __ptr_t void *
+
+
+/* C++ needs to know that types and declarations are C, not C++.  */
+#ifdef	__cplusplus
+# define __BEGIN_DECLS	extern "C" {
+# define __END_DECLS	}
+#else
+# define __BEGIN_DECLS
+# define __END_DECLS
+#endif
+
+
+/* Fortify support.  */
+#define __bos(ptr) __builtin_object_size (ptr, __USE_FORTIFY_LEVEL > 1)
+#define __bos0(ptr) __builtin_object_size (ptr, 0)
+
+#if __GNUC_PREREQ (4,3)
+# define __warndecl(name, msg) \
+  extern void name (void) __attribute__((__warning__ (msg)))
+# define __warnattr(msg) __attribute__((__warning__ (msg)))
+# define __errordecl(name, msg) \
+  extern void name (void) __attribute__((__error__ (msg)))
+#else
+# define __warndecl(name, msg) extern void name (void)
+# define __warnattr(msg)
+# define __errordecl(name, msg) extern void name (void)
+#endif
+
+/* Support for flexible arrays.
+   Headers that should use flexible arrays only if they're "real"
+   (e.g. only if they won't affect sizeof()) should test
+   #if __glibc_c99_flexarr_available.  */
+#if defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L
+# define __flexarr	[]
+# define __glibc_c99_flexarr_available 1
+#elif __GNUC_PREREQ (2,97)
+/* GCC 2.97 supports C99 flexible array members as an extension,
+   even when in C89 mode or compiling C++ (any version).  */
+# define __flexarr	[]
+# define __glibc_c99_flexarr_available 1
+#elif defined __GNUC__
+/* Pre-2.97 GCC did not support C99 flexible arrays but did have
+   an equivalent extension with slightly different notation.  */
+# define __flexarr	[0]
+# define __glibc_c99_flexarr_available 1
+#else
+/* Some other non-C99 compiler.  Approximate with [1].  */
+# define __flexarr	[1]
+# define __glibc_c99_flexarr_available 0
+#endif
+
+
+/* __asm__ ("xyz") is used throughout the headers to rename functions
+   at the assembly language level.  This is wrapped by the __REDIRECT
+   macro, in order to support compilers that can do this some other
+   way.  When compilers don't support asm-names at all, we have to do
+   preprocessor tricks instead (which don't have exactly the right
+   semantics, but it's the best we can do).
+
+   Example:
+   int __REDIRECT(setpgrp, (__pid_t pid, __pid_t pgrp), setpgid); */
+
+#if defined __GNUC__ && __GNUC__ >= 2
+
+# define __REDIRECT(name, proto, alias) name proto __asm__ (__ASMNAME (#alias))
+# ifdef __cplusplus
+#  define __REDIRECT_NTH(name, proto, alias) \
+     name proto __THROW __asm__ (__ASMNAME (#alias))
+#  define __REDIRECT_NTHNL(name, proto, alias) \
+     name proto __THROWNL __asm__ (__ASMNAME (#alias))
+# else
+#  define __REDIRECT_NTH(name, proto, alias) \
+     name proto __asm__ (__ASMNAME (#alias)) __THROW
+#  define __REDIRECT_NTHNL(name, proto, alias) \
+     name proto __asm__ (__ASMNAME (#alias)) __THROWNL
+# endif
+# define __ASMNAME(cname)  __ASMNAME2 (__USER_LABEL_PREFIX__, cname)
+# define __ASMNAME2(prefix, cname) __STRING (prefix) cname
+
+/*
+#elif __SOME_OTHER_COMPILER__
+
+# define __REDIRECT(name, proto, alias) name proto; \
+	_Pragma("let " #name " = " #alias)
+*/
+#endif
+
+/* GCC has various useful declarations that can be made with the
+   `__attribute__' syntax.  All of the ways we use this do fine if
+   they are omitted for compilers that don't understand it. */
+#if !defined __GNUC__ || __GNUC__ < 2
+# define __attribute__(xyz)	/* Ignore */
+#endif
+
+/* At some point during the gcc 2.96 development the `malloc' attribute
+   for functions was introduced.  We don't want to use it unconditionally
+   (although this would be possible) since it generates warnings.  */
+#if __GNUC_PREREQ (2,96)
+# define __attribute_malloc__ __attribute__ ((__malloc__))
+#else
+# define __attribute_malloc__ /* Ignore */
+#endif
+
+/* Tell the compiler which arguments to an allocation function
+   indicate the size of the allocation.  */
+#if __GNUC_PREREQ (4, 3)
+# define __attribute_alloc_size__(params) \
+  __attribute__ ((__alloc_size__ params))
+#else
+# define __attribute_alloc_size__(params) /* Ignore.  */
+#endif
+
+/* At some point during the gcc 2.96 development the `pure' attribute
+   for functions was introduced.  We don't want to use it unconditionally
+   (although this would be possible) since it generates warnings.  */
+#if __GNUC_PREREQ (2,96)
+# define __attribute_pure__ __attribute__ ((__pure__))
+#else
+# define __attribute_pure__ /* Ignore */
+#endif
+
+/* This declaration tells the compiler that the value is constant.  */
+#if __GNUC_PREREQ (2,5)
+# define __attribute_const__ __attribute__ ((__const__))
+#else
+# define __attribute_const__ /* Ignore */
+#endif
+
+/* At some point during the gcc 3.1 development the `used' attribute
+   for functions was introduced.  We don't want to use it unconditionally
+   (although this would be possible) since it generates warnings.  */
+#if __GNUC_PREREQ (3,1)
+# define __attribute_used__ __attribute__ ((__used__))
+# define __attribute_noinline__ __attribute__ ((__noinline__))
+#else
+# define __attribute_used__ __attribute__ ((__unused__))
+# define __attribute_noinline__ /* Ignore */
+#endif
+
+/* Since version 3.2, gcc allows marking deprecated functions.  */
+#if __GNUC_PREREQ (3,2)
+# define __attribute_deprecated__ __attribute__ ((__deprecated__))
+#else
+# define __attribute_deprecated__ /* Ignore */
+#endif
+
+/* Since version 4.5, gcc also allows one to specify the message printed
+   when a deprecated function is used.  clang claims to be gcc 4.2, but
+   may also support this feature.  */
+#if __GNUC_PREREQ (4,5) \
+    || __glibc_clang_has_extension (__attribute_deprecated_with_message__)
+# define __attribute_deprecated_msg__(msg) \
+	 __attribute__ ((__deprecated__ (msg)))
+#else
+# define __attribute_deprecated_msg__(msg) __attribute_deprecated__
+#endif
+
+/* At some point during the gcc 2.8 development the `format_arg' attribute
+   for functions was introduced.  We don't want to use it unconditionally
+   (although this would be possible) since it generates warnings.
+   If several `format_arg' attributes are given for the same function, in
+   gcc-3.0 and older, all but the last one are ignored.  In newer gccs,
+   all designated arguments are considered.  */
+#if __GNUC_PREREQ (2,8)
+# define __attribute_format_arg__(x) __attribute__ ((__format_arg__ (x)))
+#else
+# define __attribute_format_arg__(x) /* Ignore */
+#endif
+
+/* At some point during the gcc 2.97 development the `strfmon' format
+   attribute for functions was introduced.  We don't want to use it
+   unconditionally (although this would be possible) since it
+   generates warnings.  */
+#if __GNUC_PREREQ (2,97)
+# define __attribute_format_strfmon__(a,b) \
+  __attribute__ ((__format__ (__strfmon__, a, b)))
+#else
+# define __attribute_format_strfmon__(a,b) /* Ignore */
+#endif
+
+/* The nonull function attribute allows to mark pointer parameters which
+   must not be NULL.  */
+#if __GNUC_PREREQ (3,3)
+# define __nonnull(params) __attribute__ ((__nonnull__ params))
+#else
+# define __nonnull(params)
+#endif
+
+/* If fortification mode, we warn about unused results of certain
+   function calls which can lead to problems.  */
+#if __GNUC_PREREQ (3,4)
+# define __attribute_warn_unused_result__ \
+   __attribute__ ((__warn_unused_result__))
+# if __USE_FORTIFY_LEVEL > 0
+#  define __wur __attribute_warn_unused_result__
+# endif
+#else
+# define __attribute_warn_unused_result__ /* empty */
+#endif
+#ifndef __wur
+# define __wur /* Ignore */
+#endif
+
+/* Forces a function to be always inlined.  */
+#if __GNUC_PREREQ (3,2)
+/* The Linux kernel defines __always_inline in stddef.h (283d7573), and
+   it conflicts with this definition.  Therefore undefine it first to
+   allow either header to be included first.  */
+# undef __always_inline
+# define __always_inline __inline __attribute__ ((__always_inline__))
+#else
+# undef __always_inline
+# define __always_inline __inline
+#endif
+
+/* Associate error messages with the source location of the call site rather
+   than with the source location inside the function.  */
+#if __GNUC_PREREQ (4,3)
+# define __attribute_artificial__ __attribute__ ((__artificial__))
+#else
+# define __attribute_artificial__ /* Ignore */
+#endif
+
+/* GCC 4.3 and above with -std=c99 or -std=gnu99 implements ISO C99
+   inline semantics, unless -fgnu89-inline is used.  Using __GNUC_STDC_INLINE__
+   or __GNUC_GNU_INLINE is not a good enough check for gcc because gcc versions
+   older than 4.3 may define these macros and still not guarantee GNU inlining
+   semantics.
+
+   clang++ identifies itself as gcc-4.2, but has support for GNU inlining
+   semantics, that can be checked for by using the __GNUC_STDC_INLINE_ and
+   __GNUC_GNU_INLINE__ macro definitions.  */
+#if (!defined __cplusplus || __GNUC_PREREQ (4,3) \
+     || (defined __clang__ && (defined __GNUC_STDC_INLINE__ \
+			       || defined __GNUC_GNU_INLINE__)))
+# if defined __GNUC_STDC_INLINE__ || defined __cplusplus
+#  define __extern_inline extern __inline __attribute__ ((__gnu_inline__))
+#  define __extern_always_inline \
+  extern __always_inline __attribute__ ((__gnu_inline__))
+# else
+#  define __extern_inline extern __inline
+#  define __extern_always_inline extern __always_inline
+# endif
+#endif
+
+#ifdef __extern_always_inline
+# define __fortify_function __extern_always_inline __attribute_artificial__
+#endif
+
+/* GCC 4.3 and above allow passing all anonymous arguments of an
+   __extern_always_inline function to some other vararg function.  */
+#if __GNUC_PREREQ (4,3)
+# define __va_arg_pack() __builtin_va_arg_pack ()
+# define __va_arg_pack_len() __builtin_va_arg_pack_len ()
+#endif
+
+/* It is possible to compile containing GCC extensions even if GCC is
+   run in pedantic mode if the uses are carefully marked using the
+   `__extension__' keyword.  But this is not generally available before
+   version 2.8.  */
+#if !__GNUC_PREREQ (2,8)
+# define __extension__		/* Ignore */
+#endif
+
+/* __restrict is known in EGCS 1.2 and above. */
+#if !__GNUC_PREREQ (2,92)
+# if defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L
+#  define __restrict	restrict
+# else
+#  define __restrict	/* Ignore */
+# endif
+#endif
+
+/* ISO C99 also allows to declare arrays as non-overlapping.  The syntax is
+     array_name[restrict]
+   GCC 3.1 supports this.  */
+#if __GNUC_PREREQ (3,1) && !defined __GNUG__
+# define __restrict_arr	__restrict
+#else
+# ifdef __GNUC__
+#  define __restrict_arr	/* Not supported in old GCC.  */
+# else
+#  if defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L
+#   define __restrict_arr	restrict
+#  else
+/* Some other non-C99 compiler.  */
+#   define __restrict_arr	/* Not supported.  */
+#  endif
+# endif
+#endif
+
+#if __GNUC__ >= 3
+# define __glibc_unlikely(cond)	__builtin_expect ((cond), 0)
+# define __glibc_likely(cond)	__builtin_expect ((cond), 1)
+#else
+# define __glibc_unlikely(cond)	(cond)
+# define __glibc_likely(cond)	(cond)
+#endif
+
+#ifdef __has_attribute
+# define __glibc_has_attribute(attr)	__has_attribute (attr)
+#else
+# define __glibc_has_attribute(attr)	0
+#endif
+
+#if (!defined _Noreturn \
+     && (defined __STDC_VERSION__ ? __STDC_VERSION__ : 0) < 201112 \
+     &&  !__GNUC_PREREQ (4,7))
+# if __GNUC_PREREQ (2,8)
+#  define _Noreturn __attribute__ ((__noreturn__))
+# else
+#  define _Noreturn
+# endif
+#endif
+
+#if __GNUC_PREREQ (8, 0)
+/* Describes a char array whose address can safely be passed as the first
+   argument to strncpy and strncat, as the char array is not necessarily
+   a NUL-terminated string.  */
+# define __attribute_nonstring__ __attribute__ ((__nonstring__))
+#else
+# define __attribute_nonstring__
+#endif
+
+/* Undefine (also defined in libc-symbols.h).  */
+#undef __attribute_copy__
+#if __GNUC_PREREQ (9, 0)
+/* Copies attributes from the declaration or type referenced by
+   the argument.  */
+# define __attribute_copy__(arg) __attribute__ ((__copy__ (arg)))
+#else
+# define __attribute_copy__(arg)
+#endif
+
+#if (!defined _Static_assert && !defined __cplusplus \
+     && (defined __STDC_VERSION__ ? __STDC_VERSION__ : 0) < 201112 \
+     && (!__GNUC_PREREQ (4, 6) || defined __STRICT_ANSI__))
+# define _Static_assert(expr, diagnostic) \
+    extern int (*__Static_assert_function (void)) \
+      [!!sizeof (struct { int __error_if_negative: (expr) ? 2 : -1; })]
+#endif
+
+#include <bits/wordsize.h>
+#include <bits/long-double.h>
+
+#if defined __LONG_DOUBLE_MATH_OPTIONAL && defined __NO_LONG_DOUBLE_MATH
+# define __LDBL_COMPAT 1
+# ifdef __REDIRECT
+#  define __LDBL_REDIR1(name, proto, alias) __REDIRECT (name, proto, alias)
+#  define __LDBL_REDIR(name, proto) \
+  __LDBL_REDIR1 (name, proto, __nldbl_##name)
+#  define __LDBL_REDIR1_NTH(name, proto, alias) __REDIRECT_NTH (name, proto, alias)
+#  define __LDBL_REDIR_NTH(name, proto) \
+  __LDBL_REDIR1_NTH (name, proto, __nldbl_##name)
+#  define __LDBL_REDIR1_DECL(name, alias) \
+  extern __typeof (name) name __asm (__ASMNAME (#alias));
+#  define __LDBL_REDIR_DECL(name) \
+  extern __typeof (name) name __asm (__ASMNAME ("__nldbl_" #name));
+#  define __REDIRECT_LDBL(name, proto, alias) \
+  __LDBL_REDIR1 (name, proto, __nldbl_##alias)
+#  define __REDIRECT_NTH_LDBL(name, proto, alias) \
+  __LDBL_REDIR1_NTH (name, proto, __nldbl_##alias)
+# endif
+#endif
+#if !defined __LDBL_COMPAT || !defined __REDIRECT
+# define __LDBL_REDIR1(name, proto, alias) name proto
+# define __LDBL_REDIR(name, proto) name proto
+# define __LDBL_REDIR1_NTH(name, proto, alias) name proto __THROW
+# define __LDBL_REDIR_NTH(name, proto) name proto __THROW
+# define __LDBL_REDIR_DECL(name)
+# ifdef __REDIRECT
+#  define __REDIRECT_LDBL(name, proto, alias) __REDIRECT (name, proto, alias)
+#  define __REDIRECT_NTH_LDBL(name, proto, alias) \
+  __REDIRECT_NTH (name, proto, alias)
+# endif
+#endif
+
+/* __glibc_macro_warning (MESSAGE) issues warning MESSAGE.  This is
+   intended for use in preprocessor macros.
+
+   Note: MESSAGE must be a _single_ string; concatenation of string
+   literals is not supported.  */
+#if __GNUC_PREREQ (4,8) || __glibc_clang_prereq (3,5)
+# define __glibc_macro_warning1(message) _Pragma (#message)
+# define __glibc_macro_warning(message) \
+  __glibc_macro_warning1 (GCC warning message)
+#else
+# define __glibc_macro_warning(msg)
+#endif
+
+/* Generic selection (ISO C11) is a C-only feature, available in GCC
+   since version 4.9.  Previous versions do not provide generic
+   selection, even though they might set __STDC_VERSION__ to 201112L,
+   when in -std=c11 mode.  Thus, we must check for !defined __GNUC__
+   when testing __STDC_VERSION__ for generic selection support.
+   On the other hand, Clang also defines __GNUC__, so a clang-specific
+   check is required to enable the use of generic selection.  */
+#if !defined __cplusplus \
+    && (__GNUC_PREREQ (4, 9) \
+	|| __glibc_clang_has_extension (c_generic_selections) \
+	|| (!defined __GNUC__ && defined __STDC_VERSION__ \
+	    && __STDC_VERSION__ >= 201112L))
+# define __HAVE_GENERIC_SELECTION 1
+#else
+# define __HAVE_GENERIC_SELECTION 0
+#endif
+
+#endif	 /* sys/cdefs.h */
-- 
2.25.1



From minios-devel-bounces@lists.xenproject.org Sat Aug 15 09:56:39 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Sat, 15 Aug 2020 09:56:39 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1k6svX-0006aY-B0; Sat, 15 Aug 2020 09:56:39 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=oILU=BZ=gmail.com=cristianvijelie@srs-us1.protection.inumbo.net>)
 id 1k6svV-0006aL-BG
 for minios-devel@lists.xen.org; Sat, 15 Aug 2020 09:56:37 +0000
X-Inumbo-ID: 11580924-4492-46b9-a809-56bc7fd7caac
Received: from mail-ej1-x635.google.com (unknown [2a00:1450:4864:20::635])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 11580924-4492-46b9-a809-56bc7fd7caac;
 Sat, 15 Aug 2020 09:56:36 +0000 (UTC)
Received: by mail-ej1-x635.google.com with SMTP id o18so12429820eje.7
 for <minios-devel@lists.xen.org>; Sat, 15 Aug 2020 02:56:36 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=from:to:subject:date:message-id:mime-version
 :content-transfer-encoding;
 bh=FBr+KECPbRpPSbPQfMqItw0nAaKkH+TGGHRWuo0NTV8=;
 b=ISDY7MU1tD5y5bnZpE7tLbFVYWHI85mAySTzuD7/YfxtjYFJXs1eAjah8pYXiY3dRn
 fnzrMfIJDX0IzttPb0XD6jBgD7LJmA225d49yyWonJB9e90mKRLdkUWY575JqDXHeAGK
 JXgsRawBxj636OCfsEhYfgO6UJr+G4CNWEnwRF2E5LZTJyj79AtF7nV9HzJB9auHt/uN
 0VyYU8gw+xNL+sFVJM0m5FssvEcGUNwsL/lDEqeSIgIMAbPw2Q30RUzz3Vw9Zgk+X6ky
 tUumbX17U5jb70gRrVNPiXo4w2qx6ocVw7jvaoMPD9HpSLz2WB3DTigC5Y2eKqlelkPC
 9uSw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:to:subject:date:message-id:mime-version
 :content-transfer-encoding;
 bh=FBr+KECPbRpPSbPQfMqItw0nAaKkH+TGGHRWuo0NTV8=;
 b=EmqoxCsArbWxHggm+zccZ3NvJ2u2GuFwljskgEXG9dAh88kHG5UORjmXe4C60KJFL+
 Ar2xwWMyErR8ZTSw1IuxuiwZKn4ins6+TMssq0oxbkTtLqd6qlKBmBvM+zEl0RW2FFfq
 iw1s/AmHT/eTLh383i2aZpFQNsF47A6eYFv6+iRnL8B+spg/S3EifKZOXsT/Wpm5ooKb
 vB+26mZ8jaVG7WNEbfr+v1q6Ka1MzZ+EZPpTIkLatMU8cMSQqAGuPG8aH7shKOII4TXv
 BZ7Rcoq669pz3nx8r6V8cWKCxO29Evofz4Su31xqElIubTNI9gxSDsgQpjzOpZR88Z2n
 LW7A==
X-Gm-Message-State: AOAM530QHY0vx9TRvIb2hT1vP2MSLuBY914v0e4YmfRtaRHeZyFK6H0Y
 aN4aYLbdsmXbgfnQa6ZVumQnMvkK5srayQ==
X-Google-Smtp-Source: ABdhPJxBhrjnd9CovQMVZuUA+CejrTR3YlFeV50pbw1w5Lrwp/hAQ1KwjOdNBblUpZ92jJamScqNOg==
X-Received: by 2002:a17:906:4094:: with SMTP id
 u20mr6174692ejj.553.1597485395523; 
 Sat, 15 Aug 2020 02:56:35 -0700 (PDT)
Received: from localhost.localdomain ([2a02:2f0b:450d:d00:88c0:915e:4b72:30f9])
 by smtp.gmail.com with ESMTPSA id re10sm8751382ejb.68.2020.08.15.02.56.34
 for <minios-devel@lists.xen.org>
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Sat, 15 Aug 2020 02:56:34 -0700 (PDT)
From: Cristian Vijelie <cristianvijelie@gmail.com>
To: minios-devel@lists.xen.org
Subject: [UNIKRAFT/NOLIBC] Added some things to make libnettle work
Date: Sat, 15 Aug 2020 12:56:33 +0300
Message-Id: <20200815095633.6787-1-cristianvijelie@gmail.com>
X-Mailer: git-send-email 2.25.1
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-BeenThere: minios-devel@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Mini-os development list <minios-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:minios-devel@lists.xenproject.org>
List-Help: <mailto:minios-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: minios-devel-bounces@lists.xenproject.org
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>

---
 lib/nolibc/exportsyms.uk    | 1 +
 lib/nolibc/include/stddef.h | 2 +-
 lib/nolibc/include/stdint.h | 6 ++++++
 3 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/lib/nolibc/exportsyms.uk b/lib/nolibc/exportsyms.uk
index f283d45..7f29cb2 100644
--- a/lib/nolibc/exportsyms.uk
+++ b/lib/nolibc/exportsyms.uk
@@ -46,6 +46,7 @@ strtoll
 strtoull
 atoi
 qsort
+abort
 
 # string
 memcpy
diff --git a/lib/nolibc/include/stddef.h b/lib/nolibc/include/stddef.h
index 9fb27b1..427a5c2 100644
--- a/lib/nolibc/include/stddef.h
+++ b/lib/nolibc/include/stddef.h
@@ -45,7 +45,7 @@ extern "C" {
 typedef __sptr ptrdiff_t;
 
 #ifndef offsetof
-#define offsetof(t, d) __offsetof(t, d)
+#define offsetof(t, d) __builtin_offsetof(t, d)
 #endif
 
 #define __NEED_NULL
diff --git a/lib/nolibc/include/stdint.h b/lib/nolibc/include/stdint.h
index a6a55c4..af0a617 100644
--- a/lib/nolibc/include/stdint.h
+++ b/lib/nolibc/include/stdint.h
@@ -80,6 +80,12 @@ typedef __sptr intptr_t;
 #define INTMAX_MAX   __LL_MAX
 #define UINTMAX_MAX __ULL_MAX
 
+# if __WORDSIZE == 64
+#  define UINT64_C(c)	c ## UL
+# else
+#  define UINT64_C(c)	c ## ULL
+# endif
+
 #ifdef __cplusplus
 }
 #endif
-- 
2.25.1



From minios-devel-bounces@lists.xenproject.org Sat Aug 15 11:13:11 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Sat, 15 Aug 2020 11:13:11 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1k6u7X-0005PC-HT; Sat, 15 Aug 2020 11:13:07 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <SRS0=ceF6=BZ=suse.com=jgross@srs-us1.protection.inumbo.net>)
 id 1k6u7X-0005Ou-1F
 for minios-devel@lists.xenproject.org; Sat, 15 Aug 2020 11:13:07 +0000
X-Inumbo-ID: bec9e6c2-0101-4a2d-b2ac-ccec9bdfda77
Received: from mx2.suse.de (unknown [195.135.220.15])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id bec9e6c2-0101-4a2d-b2ac-ccec9bdfda77;
 Sat, 15 Aug 2020 11:13:00 +0000 (UTC)
X-Virus-Scanned: by amavisd-new at test-mx.suse.de
Received: from relay2.suse.de (unknown [195.135.221.27])
 by mx2.suse.de (Postfix) with ESMTP id 7987EB73B;
 Sat, 15 Aug 2020 11:13:23 +0000 (UTC)
From: Juergen Gross <jgross@suse.com>
To: minios-devel@lists.xenproject.org,
	xen-devel@lists.xenproject.org
Cc: samuel.thibault@ens-lyon.org, wl@xen.org, Juergen Gross <jgross@suse.com>
Subject: [PATCH] mini-os: fix do_map_frames() for pvh
Date: Sat, 15 Aug 2020 13:12:57 +0200
Message-Id: <20200815111257.29302-1-jgross@suse.com>
X-Mailer: git-send-email 2.26.2
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-BeenThere: minios-devel@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Mini-os development list <minios-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:minios-devel@lists.xenproject.org>
List-Help: <mailto:minios-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: minios-devel-bounces@lists.xenproject.org
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>

In case ov PVH dom_map_frames() is missing to increment the virtual
address. This leads to writing only the first page table entry multiple
times.

Signed-off-by: Juergen Gross <jgross@suse.com>
---
 arch/x86/mm.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/x86/mm.c b/arch/x86/mm.c
index ea58444..8ba14a5 100644
--- a/arch/x86/mm.c
+++ b/arch/x86/mm.c
@@ -695,6 +695,7 @@ int do_map_frames(unsigned long va,
         pgt[l1_table_offset(va)] = (pgentry_t)
             (((mfns[done * stride] + done * incr) << PAGE_SHIFT) | prot);
         done++;
+        va += PAGE_SIZE;
 #endif
     }
 
-- 
2.26.2



From minios-devel-bounces@lists.xenproject.org Sat Aug 15 11:16:07 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Sat, 15 Aug 2020 11:16:07 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1k6uAR-0005Yz-2j; Sat, 15 Aug 2020 11:16:07 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <SRS0=ceF6=BZ=suse.com=jgross@srs-us1.protection.inumbo.net>)
 id 1k6uAQ-0005Y0-2y
 for minios-devel@lists.xenproject.org; Sat, 15 Aug 2020 11:16:06 +0000
X-Inumbo-ID: dd838711-5613-43cc-99de-5935b60c0053
Received: from mx2.suse.de (unknown [195.135.220.15])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id dd838711-5613-43cc-99de-5935b60c0053;
 Sat, 15 Aug 2020 11:15:59 +0000 (UTC)
X-Virus-Scanned: by amavisd-new at test-mx.suse.de
Received: from relay2.suse.de (unknown [195.135.221.27])
 by mx2.suse.de (Postfix) with ESMTP id 08C5FB73B;
 Sat, 15 Aug 2020 11:16:22 +0000 (UTC)
From: Juergen Gross <jgross@suse.com>
To: minios-devel@lists.xenproject.org,
	xen-devel@lists.xenproject.org
Cc: samuel.thibault@ens-lyon.org, wl@xen.org, Juergen Gross <jgross@suse.com>
Subject: [PATCH] mini-os: correct memory access rights for pvh mode
Date: Sat, 15 Aug 2020 13:15:57 +0200
Message-Id: <20200815111557.29564-1-jgross@suse.com>
X-Mailer: git-send-email 2.26.2
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-BeenThere: minios-devel@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Mini-os development list <minios-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:minios-devel@lists.xenproject.org>
List-Help: <mailto:minios-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: minios-devel-bounces@lists.xenproject.org
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>

When running as a PVH guest the memory access rights are not set
correctly: _PAGE_USER should not be set and CR0.WP should be set.
Especially CR0.WP is important in order to let the allocate on
demand feature work, as it requires a page fault when writing to a
read-only page.

Signed-off-by: Juergen Gross <jgross@suse.com>
---
 arch/x86/x86_hvm.S    |  2 +-
 include/x86/arch_mm.h | 18 ++++++++++++------
 include/x86/os.h      |  1 +
 3 files changed, 14 insertions(+), 7 deletions(-)

diff --git a/arch/x86/x86_hvm.S b/arch/x86/x86_hvm.S
index 6e8ad98..42a5f02 100644
--- a/arch/x86/x86_hvm.S
+++ b/arch/x86/x86_hvm.S
@@ -20,7 +20,7 @@ _start:
 #endif /* __x86_64__ */
 
         mov %cr0, %eax
-        or $X86_CR0_PG, %eax
+        or $(X86_CR0_PG | X86_CR0_WP), %eax
         mov %eax, %cr0
 
         lgdt gdt_ptr
diff --git a/include/x86/arch_mm.h b/include/x86/arch_mm.h
index cbbeb21..ffbec5a 100644
--- a/include/x86/arch_mm.h
+++ b/include/x86/arch_mm.h
@@ -171,17 +171,23 @@ typedef unsigned long pgentry_t;
 #define _PAGE_PSE      CONST(0x080)
 #define _PAGE_GLOBAL   CONST(0x100)
 
+#ifdef CONFIG_PARAVIRT
+#define PAGE_USER _PAGE_USER
+#else
+#define PAGE_USER CONST(0)
+#endif
+
 #if defined(__i386__)
 #define L1_PROT (_PAGE_PRESENT|_PAGE_RW|_PAGE_ACCESSED)
 #define L1_PROT_RO (_PAGE_PRESENT|_PAGE_ACCESSED)
-#define L2_PROT (_PAGE_PRESENT|_PAGE_RW|_PAGE_ACCESSED|_PAGE_DIRTY |_PAGE_USER)
+#define L2_PROT (_PAGE_PRESENT|_PAGE_RW|_PAGE_ACCESSED|_PAGE_DIRTY |PAGE_USER)
 #define L3_PROT (_PAGE_PRESENT)
 #elif defined(__x86_64__)
-#define L1_PROT (_PAGE_PRESENT|_PAGE_RW|_PAGE_ACCESSED|_PAGE_USER)
-#define L1_PROT_RO (_PAGE_PRESENT|_PAGE_ACCESSED|_PAGE_USER)
-#define L2_PROT (_PAGE_PRESENT|_PAGE_RW|_PAGE_ACCESSED|_PAGE_DIRTY|_PAGE_USER)
-#define L3_PROT (_PAGE_PRESENT|_PAGE_RW|_PAGE_ACCESSED|_PAGE_DIRTY|_PAGE_USER)
-#define L4_PROT (_PAGE_PRESENT|_PAGE_RW|_PAGE_ACCESSED|_PAGE_DIRTY|_PAGE_USER)
+#define L1_PROT (_PAGE_PRESENT|_PAGE_RW|_PAGE_ACCESSED|PAGE_USER)
+#define L1_PROT_RO (_PAGE_PRESENT|_PAGE_ACCESSED|PAGE_USER)
+#define L2_PROT (_PAGE_PRESENT|_PAGE_RW|_PAGE_ACCESSED|_PAGE_DIRTY|PAGE_USER)
+#define L3_PROT (_PAGE_PRESENT|_PAGE_RW|_PAGE_ACCESSED|_PAGE_DIRTY|PAGE_USER)
+#define L4_PROT (_PAGE_PRESENT|_PAGE_RW|_PAGE_ACCESSED|_PAGE_DIRTY|PAGE_USER)
 #endif /* __i386__ || __x86_64__ */
 
 /* flags for ioremap */
diff --git a/include/x86/os.h b/include/x86/os.h
index a73b63e..46a824d 100644
--- a/include/x86/os.h
+++ b/include/x86/os.h
@@ -27,6 +27,7 @@
 #define MSR_EFER          0xc0000080
 #define _EFER_LME         8             /* Long mode enable */
 
+#define X86_CR0_WP        0x00010000    /* Write protect */
 #define X86_CR0_PG        0x80000000    /* Paging */
 #define X86_CR4_PAE       0x00000020    /* enable physical address extensions */
 #define X86_CR4_OSFXSR    0x00000200    /* enable fast FPU save and restore */
-- 
2.26.2



From minios-devel-bounces@lists.xenproject.org Sat Aug 15 21:40:17 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Sat, 15 Aug 2020 21:40:17 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1k73uQ-0001GQ-Eq; Sat, 15 Aug 2020 21:40:14 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=VULP=BZ=ens-lyon.org=samuel.thibault@srs-us1.protection.inumbo.net>)
 id 1k73uP-0001G6-4C
 for minios-devel@lists.xenproject.org; Sat, 15 Aug 2020 21:40:13 +0000
X-Inumbo-ID: a60975e0-0d4f-4aa1-af7b-a198fd4450b2
Received: from hera.aquilenet.fr (unknown [185.233.100.1])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id a60975e0-0d4f-4aa1-af7b-a198fd4450b2;
 Sat, 15 Aug 2020 21:40:05 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
 by hera.aquilenet.fr (Postfix) with ESMTP id 6278B116FA;
 Sat, 15 Aug 2020 23:40:04 +0200 (CEST)
X-Virus-Scanned: Debian amavisd-new at aquilenet.fr
Received: from hera.aquilenet.fr ([127.0.0.1])
 by localhost (hera.aquilenet.fr [127.0.0.1]) (amavisd-new, port 10024)
 with ESMTP id X_2rCA7E-Re5; Sat, 15 Aug 2020 23:40:03 +0200 (CEST)
Received: from function.home
 (2a01cb008800c5009eb6d0fffe88c3c7.ipv6.abo.wanadoo.fr
 [IPv6:2a01:cb00:8800:c500:9eb6:d0ff:fe88:c3c7])
 by hera.aquilenet.fr (Postfix) with ESMTPSA id 5EB592E70;
 Sat, 15 Aug 2020 23:40:03 +0200 (CEST)
Received: from samy by function.home with local (Exim 4.94)
 (envelope-from <samuel.thibault@ens-lyon.org>)
 id 1k73uE-001iIz-9u; Sat, 15 Aug 2020 23:40:02 +0200
Date: Sat, 15 Aug 2020 23:40:02 +0200
From: Samuel Thibault <samuel.thibault@ens-lyon.org>
To: Juergen Gross <jgross@suse.com>
Cc: minios-devel@lists.xenproject.org, xen-devel@lists.xenproject.org,
 wl@xen.org
Subject: Re: [PATCH] mini-os: correct memory access rights for pvh mode
Message-ID: <20200815214002.vow2zqlqhtxw6jmb@function>
Mail-Followup-To: Samuel Thibault <samuel.thibault@ens-lyon.org>,
 Juergen Gross <jgross@suse.com>, minios-devel@lists.xenproject.org,
 xen-devel@lists.xenproject.org, wl@xen.org
References: <20200815111557.29564-1-jgross@suse.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
Content-Transfer-Encoding: 8bit
In-Reply-To: <20200815111557.29564-1-jgross@suse.com>
Organization: I am not organized
User-Agent: NeoMutt/20170609 (1.8.3)
X-BeenThere: minios-devel@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Mini-os development list <minios-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:minios-devel@lists.xenproject.org>
List-Help: <mailto:minios-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: minios-devel-bounces@lists.xenproject.org
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>

Juergen Gross, le sam. 15 aoÃ»t 2020 13:15:57 +0200, a ecrit:
> When running as a PVH guest the memory access rights are not set
> correctly: _PAGE_USER should not be set and CR0.WP should be set.
> Especially CR0.WP is important in order to let the allocate on
> demand feature work, as it requires a page fault when writing to a
> read-only page.
> 
> Signed-off-by: Juergen Gross <jgross@suse.com>

Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>

> ---
>  arch/x86/x86_hvm.S    |  2 +-
>  include/x86/arch_mm.h | 18 ++++++++++++------
>  include/x86/os.h      |  1 +
>  3 files changed, 14 insertions(+), 7 deletions(-)
> 
> diff --git a/arch/x86/x86_hvm.S b/arch/x86/x86_hvm.S
> index 6e8ad98..42a5f02 100644
> --- a/arch/x86/x86_hvm.S
> +++ b/arch/x86/x86_hvm.S
> @@ -20,7 +20,7 @@ _start:
>  #endif /* __x86_64__ */
>  
>          mov %cr0, %eax
> -        or $X86_CR0_PG, %eax
> +        or $(X86_CR0_PG | X86_CR0_WP), %eax
>          mov %eax, %cr0
>  
>          lgdt gdt_ptr
> diff --git a/include/x86/arch_mm.h b/include/x86/arch_mm.h
> index cbbeb21..ffbec5a 100644
> --- a/include/x86/arch_mm.h
> +++ b/include/x86/arch_mm.h
> @@ -171,17 +171,23 @@ typedef unsigned long pgentry_t;
>  #define _PAGE_PSE      CONST(0x080)
>  #define _PAGE_GLOBAL   CONST(0x100)
>  
> +#ifdef CONFIG_PARAVIRT
> +#define PAGE_USER _PAGE_USER
> +#else
> +#define PAGE_USER CONST(0)
> +#endif
> +
>  #if defined(__i386__)
>  #define L1_PROT (_PAGE_PRESENT|_PAGE_RW|_PAGE_ACCESSED)
>  #define L1_PROT_RO (_PAGE_PRESENT|_PAGE_ACCESSED)
> -#define L2_PROT (_PAGE_PRESENT|_PAGE_RW|_PAGE_ACCESSED|_PAGE_DIRTY |_PAGE_USER)
> +#define L2_PROT (_PAGE_PRESENT|_PAGE_RW|_PAGE_ACCESSED|_PAGE_DIRTY |PAGE_USER)
>  #define L3_PROT (_PAGE_PRESENT)
>  #elif defined(__x86_64__)
> -#define L1_PROT (_PAGE_PRESENT|_PAGE_RW|_PAGE_ACCESSED|_PAGE_USER)
> -#define L1_PROT_RO (_PAGE_PRESENT|_PAGE_ACCESSED|_PAGE_USER)
> -#define L2_PROT (_PAGE_PRESENT|_PAGE_RW|_PAGE_ACCESSED|_PAGE_DIRTY|_PAGE_USER)
> -#define L3_PROT (_PAGE_PRESENT|_PAGE_RW|_PAGE_ACCESSED|_PAGE_DIRTY|_PAGE_USER)
> -#define L4_PROT (_PAGE_PRESENT|_PAGE_RW|_PAGE_ACCESSED|_PAGE_DIRTY|_PAGE_USER)
> +#define L1_PROT (_PAGE_PRESENT|_PAGE_RW|_PAGE_ACCESSED|PAGE_USER)
> +#define L1_PROT_RO (_PAGE_PRESENT|_PAGE_ACCESSED|PAGE_USER)
> +#define L2_PROT (_PAGE_PRESENT|_PAGE_RW|_PAGE_ACCESSED|_PAGE_DIRTY|PAGE_USER)
> +#define L3_PROT (_PAGE_PRESENT|_PAGE_RW|_PAGE_ACCESSED|_PAGE_DIRTY|PAGE_USER)
> +#define L4_PROT (_PAGE_PRESENT|_PAGE_RW|_PAGE_ACCESSED|_PAGE_DIRTY|PAGE_USER)
>  #endif /* __i386__ || __x86_64__ */
>  
>  /* flags for ioremap */
> diff --git a/include/x86/os.h b/include/x86/os.h
> index a73b63e..46a824d 100644
> --- a/include/x86/os.h
> +++ b/include/x86/os.h
> @@ -27,6 +27,7 @@
>  #define MSR_EFER          0xc0000080
>  #define _EFER_LME         8             /* Long mode enable */
>  
> +#define X86_CR0_WP        0x00010000    /* Write protect */
>  #define X86_CR0_PG        0x80000000    /* Paging */
>  #define X86_CR4_PAE       0x00000020    /* enable physical address extensions */
>  #define X86_CR4_OSFXSR    0x00000200    /* enable fast FPU save and restore */
> -- 
> 2.26.2
> 

-- 
Samuel
<y> la vraie vie, c'est quand le prompt passe de $ Ã  #


From minios-devel-bounces@lists.xenproject.org Sat Aug 15 21:43:26 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Sat, 15 Aug 2020 21:43:26 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1k73xV-0001Px-Nj; Sat, 15 Aug 2020 21:43:25 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=VULP=BZ=ens-lyon.org=samuel.thibault@srs-us1.protection.inumbo.net>)
 id 1k73xU-0001Ps-T5
 for minios-devel@lists.xenproject.org; Sat, 15 Aug 2020 21:43:24 +0000
X-Inumbo-ID: dd007171-d210-4b69-98ea-e0c516208e1c
Received: from hera.aquilenet.fr (unknown [185.233.100.1])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id dd007171-d210-4b69-98ea-e0c516208e1c;
 Sat, 15 Aug 2020 21:43:23 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
 by hera.aquilenet.fr (Postfix) with ESMTP id 14AE511457;
 Sat, 15 Aug 2020 23:43:23 +0200 (CEST)
X-Virus-Scanned: Debian amavisd-new at aquilenet.fr
Received: from hera.aquilenet.fr ([127.0.0.1])
 by localhost (hera.aquilenet.fr [127.0.0.1]) (amavisd-new, port 10024)
 with ESMTP id 0t9WTyfwBkGy; Sat, 15 Aug 2020 23:43:22 +0200 (CEST)
Received: from function.home
 (2a01cb008800c5009eb6d0fffe88c3c7.ipv6.abo.wanadoo.fr
 [IPv6:2a01:cb00:8800:c500:9eb6:d0ff:fe88:c3c7])
 by hera.aquilenet.fr (Postfix) with ESMTPSA id 41BFB2E70;
 Sat, 15 Aug 2020 23:43:22 +0200 (CEST)
Received: from samy by function.home with local (Exim 4.94)
 (envelope-from <samuel.thibault@ens-lyon.org>)
 id 1k73xR-001iMT-Gi; Sat, 15 Aug 2020 23:43:21 +0200
Date: Sat, 15 Aug 2020 23:43:21 +0200
From: Samuel Thibault <samuel.thibault@ens-lyon.org>
To: Juergen Gross <jgross@suse.com>
Cc: minios-devel@lists.xenproject.org, xen-devel@lists.xenproject.org,
 wl@xen.org
Subject: Re: [PATCH] mini-os: fix do_map_frames() for pvh
Message-ID: <20200815214321.qp46x46ucqlh6mp6@function>
Mail-Followup-To: Samuel Thibault <samuel.thibault@ens-lyon.org>,
 Juergen Gross <jgross@suse.com>, minios-devel@lists.xenproject.org,
 xen-devel@lists.xenproject.org, wl@xen.org
References: <20200815111257.29302-1-jgross@suse.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
Content-Transfer-Encoding: 8bit
In-Reply-To: <20200815111257.29302-1-jgross@suse.com>
Organization: I am not organized
User-Agent: NeoMutt/20170609 (1.8.3)
X-BeenThere: minios-devel@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Mini-os development list <minios-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:minios-devel@lists.xenproject.org>
List-Help: <mailto:minios-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: minios-devel-bounces@lists.xenproject.org
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>

Juergen Gross, le sam. 15 aoÃ»t 2020 13:12:57 +0200, a ecrit:
> In case ov PVH dom_map_frames() is missing to increment the virtual
> address. This leads to writing only the first page table entry multiple
> times.
> 
> Signed-off-by: Juergen Gross <jgross@suse.com>

Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>

> ---
>  arch/x86/mm.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/arch/x86/mm.c b/arch/x86/mm.c
> index ea58444..8ba14a5 100644
> --- a/arch/x86/mm.c
> +++ b/arch/x86/mm.c
> @@ -695,6 +695,7 @@ int do_map_frames(unsigned long va,
>          pgt[l1_table_offset(va)] = (pgentry_t)
>              (((mfns[done * stride] + done * incr) << PAGE_SHIFT) | prot);
>          done++;
> +        va += PAGE_SIZE;
>  #endif
>      }
>  
> -- 
> 2.26.2
> 

-- 
Samuel
j'etais en train de nettoyer ma souris et le coup est parti...
 -+- s sur #ens-mim - et en plus c vrai... -+-


From minios-devel-bounces@lists.xenproject.org Sun Aug 16 23:35:01 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Sun, 16 Aug 2020 23:35:01 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1k7SAx-0003uv-Au; Sun, 16 Aug 2020 23:34:55 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=5bSd=B2=neclab.eu=sharan.santhanam@srs-us1.protection.inumbo.net>)
 id 1k7SAw-0003uq-7a
 for minios-devel@lists.xen.org; Sun, 16 Aug 2020 23:34:54 +0000
X-Inumbo-ID: 09ae9000-b0b2-44a5-a57e-90823d560f74
Received: from mailer1.neclab.eu (unknown [195.37.70.40])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 09ae9000-b0b2-44a5-a57e-90823d560f74;
 Sun, 16 Aug 2020 23:34:52 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
 by mailer1.neclab.eu (Postfix) with ESMTP id 95E9D1041BE;
 Mon, 17 Aug 2020 01:34:50 +0200 (CEST)
X-Virus-Scanned: Amavisd on Debian GNU/Linux (atlas-a.office.hd)
Received: from mailer1.neclab.eu ([127.0.0.1])
 by localhost (atlas-a.office.hd [127.0.0.1]) (amavisd-new, port 10024)
 with ESMTP id zDgCHhpmKlg3; Mon, 17 Aug 2020 01:34:50 +0200 (CEST)
X-ENC: Last-Hop-TLS-encrypted
X-ENC: Last-Hop-TLS-encrypted
Received: from puck.office.hd (puck.office.hd [192.168.24.91])
 (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
 (No client certificate requested)
 by mailer1.neclab.eu (Postfix) with ESMTPS id 620FC104000
 for <minios-devel@lists.xen.org>; Mon, 17 Aug 2020 01:34:50 +0200 (CEST)
Received: from N-1309.office.hd (192.168.24.96) by puck.office.hd
 (192.168.24.91) with Microsoft SMTP Server (version=TLS1_2,
 cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1979.3; Mon, 17 Aug
 2020 01:34:49 +0200
From: Sharan Santhanam <sharan.santhanam@neclab.eu>
To: <minios-devel@lists.xen.org>
CC: Sharan Santhanam <sharan.santhanam@neclab.eu>
Subject: [UNIKRAFT PATCH] lib/uknetdev: netdev register fails on lib param
Date: Mon, 17 Aug 2020 01:34:17 +0200
Message-ID: <1597620857-11229-1-git-send-email-sharan.santhanam@neclab.eu>
X-Mailer: git-send-email 2.7.4
MIME-Version: 1.0
Content-Type: text/plain
X-Originating-IP: [192.168.24.96]
X-ClientProxiedBy: puck.office.hd (192.168.24.91) To puck.office.hd
 (192.168.24.91)
X-BeenThere: minios-devel@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Mini-os development list <minios-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:minios-devel@lists.xenproject.org>
List-Help: <mailto:minios-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: minios-devel-bounces@lists.xenproject.org
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>

einfo returns error when the user does not provide the library
parameters.

Signed-off-by: Sharan Santhanam <sharan.santhanam@neclab.eu>
---
 lib/uknetdev/netdev.c | 26 +++++++++++++-------------
 1 file changed, 13 insertions(+), 13 deletions(-)

diff --git a/lib/uknetdev/netdev.c b/lib/uknetdev/netdev.c
index 74be618..87322c7 100644
--- a/lib/uknetdev/netdev.c
+++ b/lib/uknetdev/netdev.c
@@ -120,18 +120,16 @@ static struct uk_netdev_einfo *_alloc_einfo(struct uk_alloc *a)
 {
 	struct uk_netdev_einfo *_einfo = NULL;
 
-	if (ipv4_addr || ipv4_subnet_mask || ipv4_gw_addr) {
-		_einfo = uk_zalloc(a, sizeof(*_einfo));
-		if (!_einfo) {
-			uk_pr_warn("Failed to allocate memory for netdev config\n");
-			return NULL;
-		}
-
-		_einfo->ipv4_addr = _parse_ipv4_addr();
-		_einfo->ipv4_net_mask = _parse_ipv4_net_mask();
-		_einfo->ipv4_gw_addr = _parse_ipv4_gw_addr();
+	_einfo = uk_zalloc(a, sizeof(*_einfo));
+	if (!_einfo) {
+		uk_pr_warn("Failed to allocate memory for netdev config\n");
+		return ERR2PTR(-ENOMEM);
 	}
 
+	_einfo->ipv4_addr = _parse_ipv4_addr();
+	_einfo->ipv4_net_mask = _parse_ipv4_net_mask();
+	_einfo->ipv4_gw_addr = _parse_ipv4_gw_addr();
+
 	return _einfo;
 }
 
@@ -162,9 +160,11 @@ int uk_netdev_drv_register(struct uk_netdev *dev, struct uk_alloc *a,
 	if (!dev->_data)
 		return -ENOMEM;
 
-	dev->_einfo = _alloc_einfo(a);
-	if (!dev->_einfo)
-		return -ENOMEM;
+	if (ipv4_addr || ipv4_subnet_mask || ipv4_gw_addr) {
+		dev->_einfo = _alloc_einfo(a);
+		if (PTRISERR(dev->_einfo))
+			return PTR2ERR(dev->_einfo);
+	}
 
 	UK_TAILQ_INSERT_TAIL(&uk_netdev_list, dev, _list);
 	uk_pr_info("Registered netdev%"PRIu16": %p (%s)\n",
-- 
2.7.4



From minios-devel-bounces@lists.xenproject.org Mon Aug 17 09:56:12 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Mon, 17 Aug 2020 09:56:12 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1k7bs9-0006Yz-VN; Mon, 17 Aug 2020 09:56:09 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=5P54=B3=gmail.com=wei.liu.xen@srs-us1.protection.inumbo.net>)
 id 1k7bs8-0006XZ-Eb
 for minios-devel@lists.xenproject.org; Mon, 17 Aug 2020 09:56:08 +0000
X-Inumbo-ID: cbe17c95-0411-4d76-9b91-61fa3974a675
Received: from mail-wm1-f68.google.com (unknown [209.85.128.68])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id cbe17c95-0411-4d76-9b91-61fa3974a675;
 Mon, 17 Aug 2020 09:56:02 +0000 (UTC)
Received: by mail-wm1-f68.google.com with SMTP id g75so13356670wme.4;
 Mon, 17 Aug 2020 02:56:02 -0700 (PDT)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:date:from:to:subject:message-id:references
 :mime-version:content-disposition:content-transfer-encoding
 :in-reply-to:user-agent;
 bh=xW+7rEqmDrgn63svh0fXMbO1m3LLQj/3UD14ZrV2yvI=;
 b=HlBPEbetqfo0HhhnQU7+ptwAL/PyRC7ty4etvE+O0PoMfic54YRTX/ekEjktmbDJhT
 1h3B+UOwd/zcB1B7JTPuS43SCA5ElHkBeCxQmyE9/c0D4gp8ZcV9klaZNBicX9Rnj6Yx
 chIM7Mzqqxx0e8wHM68KowNc9SRImDnQTBEY8PMGDr9oSnnm9O7/LMonwj0r14NGitKD
 5+ZbhBa+wMtMsCT+FZlXSLIMK8OtbRglPh3INAVAN9VSgb6M/zDoyq/9Hz/iIHXIpsLE
 uyW6tKuLD+jCQI34NjW0O6vwpxzbkCxxH1QIW8heFP+iOpr8R9DQhV9l1AoFV5CS2DKq
 r2dw==
X-Gm-Message-State: AOAM533K5tCiv2hDsLSxmnL0rYVTFHxLRSnkh4E5Szel2LDcDfhAYlDm
 N9vXM2vAYDIgLPT2jZwLDcA=
X-Google-Smtp-Source: ABdhPJz7AOpULhiqvMe22YQS9XzxoCDkzhy7WT1X4c6VU00K4bi3khj6/4GFkE3zHWZHBnzi2m+SNQ==
X-Received: by 2002:a1c:1f85:: with SMTP id
 f127mr14721154wmf.154.1597658161495; 
 Mon, 17 Aug 2020 02:56:01 -0700 (PDT)
Received: from liuwe-devbox-debian-v2 ([51.145.34.42])
 by smtp.gmail.com with ESMTPSA id s19sm35429330wrb.54.2020.08.17.02.56.00
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Mon, 17 Aug 2020 02:56:00 -0700 (PDT)
Date: Mon, 17 Aug 2020 09:55:59 +0000
From: Wei Liu <wl@xen.org>
To: Samuel Thibault <samuel.thibault@ens-lyon.org>,
 Juergen Gross <jgross@suse.com>, minios-devel@lists.xenproject.org,
 xen-devel@lists.xenproject.org, wl@xen.org
Subject: Re: [PATCH] mini-os: fix do_map_frames() for pvh
Message-ID: <20200817095559.uobssd2gk5jmd23z@liuwe-devbox-debian-v2>
References: <20200815111257.29302-1-jgross@suse.com>
 <20200815214321.qp46x46ucqlh6mp6@function>
MIME-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
Content-Disposition: inline
Content-Transfer-Encoding: 8bit
In-Reply-To: <20200815214321.qp46x46ucqlh6mp6@function>
User-Agent: NeoMutt/20180716
X-BeenThere: minios-devel@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Mini-os development list <minios-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:minios-devel@lists.xenproject.org>
List-Help: <mailto:minios-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: minios-devel-bounces@lists.xenproject.org
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>

On Sat, Aug 15, 2020 at 11:43:21PM +0200, Samuel Thibault wrote:
> Juergen Gross, le sam. 15 août 2020 13:12:57 +0200, a ecrit:
> > In case ov PVH dom_map_frames() is missing to increment the virtual
> > address. This leads to writing only the first page table entry multiple
> > times.
> > 
> > Signed-off-by: Juergen Gross <jgross@suse.com>
> 
> Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>

Applied.


From minios-devel-bounces@lists.xenproject.org Mon Aug 17 09:56:18 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Mon, 17 Aug 2020 09:56:18 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1k7bsI-0006b3-0m; Mon, 17 Aug 2020 09:56:18 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=5P54=B3=gmail.com=wei.liu.xen@srs-us1.protection.inumbo.net>)
 id 1k7bsG-0006ah-TA
 for minios-devel@lists.xenproject.org; Mon, 17 Aug 2020 09:56:16 +0000
X-Inumbo-ID: 7f506d3d-9e1b-4c16-b60a-eb67c1f0f546
Received: from mail-wr1-f68.google.com (unknown [209.85.221.68])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 7f506d3d-9e1b-4c16-b60a-eb67c1f0f546;
 Mon, 17 Aug 2020 09:56:15 +0000 (UTC)
Received: by mail-wr1-f68.google.com with SMTP id a14so14333408wra.5;
 Mon, 17 Aug 2020 02:56:15 -0700 (PDT)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:date:from:to:subject:message-id:references
 :mime-version:content-disposition:content-transfer-encoding
 :in-reply-to:user-agent;
 bh=Ym9L5vDhvXIq4XNHTX9cSFj82wOCFVMZB7UTRG4gtEY=;
 b=nc+NdOumc9b3nZW0NzIzlBwIBWwyyDntfj0mOIMYT03ibJul1OhUbcCM1Prr7cZZ+K
 npmcQ6LYnIIU0DgFlEG+HP1dAjy69RSnB7jAGArtDLDZmnUWHpzBmL8Rw7bgbriv+2x6
 WUzlC0ViP7FnZvqWZJ10zP7sQ4JJRx8fSrjeL+J7AJ1HlD1zhaEvC6n5dlkxiQg5nU/+
 mN81vVG6g9kAgTz+JbeAnrgfmoXw3T+s1cCZ5VaP4QEiK9DWDnlkf5ayAoUkGI4ACeKU
 +X7ubqtwQ9TDvXR3fONELAhPI1RIvli9/oM7sGLJWW9+jkyf75UEriO0XdbLMNAzuJ4H
 +5Ow==
X-Gm-Message-State: AOAM530dBmmMREF+Fc80UgFvhPEFeIQaJ/7PUgseWXQkyBo3riTpVCms
 UDNWthWA3BrggKriaX3GasI=
X-Google-Smtp-Source: ABdhPJyHMjwpOz/5Bc3MZHtvVk0yrhMX7uoghN7cCOHrP8Fsk2a0lNEWhBtR24fb+8lMDvj8Jeu3ig==
X-Received: by 2002:adf:e704:: with SMTP id c4mr15669239wrm.81.1597658174386; 
 Mon, 17 Aug 2020 02:56:14 -0700 (PDT)
Received: from liuwe-devbox-debian-v2 ([51.145.34.42])
 by smtp.gmail.com with ESMTPSA id w10sm29330232wmk.0.2020.08.17.02.56.13
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Mon, 17 Aug 2020 02:56:13 -0700 (PDT)
Date: Mon, 17 Aug 2020 09:56:12 +0000
From: Wei Liu <wl@xen.org>
To: Samuel Thibault <samuel.thibault@ens-lyon.org>,
 Juergen Gross <jgross@suse.com>, minios-devel@lists.xenproject.org,
 xen-devel@lists.xenproject.org, wl@xen.org
Subject: Re: [PATCH] mini-os: correct memory access rights for pvh mode
Message-ID: <20200817095612.4pczowfuk27lzubz@liuwe-devbox-debian-v2>
References: <20200815111557.29564-1-jgross@suse.com>
 <20200815214002.vow2zqlqhtxw6jmb@function>
MIME-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
Content-Disposition: inline
Content-Transfer-Encoding: 8bit
In-Reply-To: <20200815214002.vow2zqlqhtxw6jmb@function>
User-Agent: NeoMutt/20180716
X-BeenThere: minios-devel@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Mini-os development list <minios-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:minios-devel@lists.xenproject.org>
List-Help: <mailto:minios-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: minios-devel-bounces@lists.xenproject.org
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>

On Sat, Aug 15, 2020 at 11:40:02PM +0200, Samuel Thibault wrote:
> Juergen Gross, le sam. 15 août 2020 13:15:57 +0200, a ecrit:
> > When running as a PVH guest the memory access rights are not set
> > correctly: _PAGE_USER should not be set and CR0.WP should be set.
> > Especially CR0.WP is important in order to let the allocate on
> > demand feature work, as it requires a page fault when writing to a
> > read-only page.
> > 
> > Signed-off-by: Juergen Gross <jgross@suse.com>
> 
> Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>

Applied.


From minios-devel-bounces@lists.xenproject.org Mon Aug 17 13:56:13 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Mon, 17 Aug 2020 13:56:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1k7fcO-0003vj-Ry; Mon, 17 Aug 2020 13:56:08 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=H+Va=B3=lancaster.ac.uk=a.jung@srs-us1.protection.inumbo.net>)
 id 1k7fcN-0003ve-4g
 for minios-devel@lists.xen.org; Mon, 17 Aug 2020 13:56:07 +0000
X-Inumbo-ID: 3e537489-0acd-487f-92fa-28ae26346d33
Received: from GBR01-LO2-obe.outbound.protection.outlook.com (unknown
 [40.107.10.130]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 3e537489-0acd-487f-92fa-28ae26346d33;
 Mon, 17 Aug 2020 13:56:02 +0000 (UTC)
ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none;
 b=jhdC8d+DkGrkGoeZxTE3O0uK2/uQOTJzUKgKvLIa5mMz+cLyuHRuPsNyP/Rd9nmAxTeAQA4yuS5LAC+WmKYpU4JX67VQ1f+g0n0Uw4wZHXhrQiwu+M6h51dv8JpgeXa24oSJ9ze/TAmeh59r1RbdE10oSt6+POiwbl/3f08e1+05y/H2IwtNJPUi8n1iR2YWaGkCam9TkaD4u68avuwTswRtSvlBZd9s2oFQzBl0R6WmMVjKKJ3JFEGt/riCQvYmxvUUfCQZirNhwciES4MyBzTxlT8PFZmHycVh6PIfytDuFznxfIiQNp7KybcLvryd+UZYbHWxbHqJRKmyRVS8kA==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; 
 s=arcselector9901;
 h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck;
 bh=/FszEjH+RDQX2oGgTAb0CXmAnfo5oRJTTSDV4xsTQDo=;
 b=bgSf25SZw2n4XEEI1Je9slj6JFQp+L/3UU/99qV8Tx6HQQVv3sd/acuzhCHDMb9EHB+KfSN8FutjR81ZZa5QYReP0eZxj9PaE5wOfrKskVw3TKYK1cKMJzOL4GfXZu+WN8JxJA1iWFIF6WnVBiSoYVW/ub2MwGx6YmqzvM2Ti6FfqxgvQrT9q4R9vmSmbsHtXYIFGsZhEdIXa2/I443lInewssjTgQjSBndVTBQtBSKAfi5zqCfvJhXeUmbcrI600KelUggBQO3amSYTLPX1Gcsp1k6s1ctmEMbJFr+7FJucDu3FGReUBM4DZGb3d1EFOkjj7ZckniVyn4CY8xCxdQ==
ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass
 smtp.mailfrom=lancaster.ac.uk; dmarc=pass action=none
 header.from=lancaster.ac.uk; dkim=pass header.d=lancaster.ac.uk; arc=none
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=livelancsac.onmicrosoft.com; s=selector2-livelancsac-onmicrosoft-com;
 h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck;
 bh=/FszEjH+RDQX2oGgTAb0CXmAnfo5oRJTTSDV4xsTQDo=;
 b=tFip7I3Vff+MoSbudj/S4vAUBOTt7VUDcdYf4oDvOD01nNEzmj7iCm/ojcT9skqUyZNHu1PwFol8kbXknDrcG0X7HkAgJ/MsTnVYBGfwnsgiucbb39UBr06qROelB2RROqgeoVlStaiDKhrBixn8C0/cMlAx284KJgDZ8fb/32Y=
Received: from CWXP265MB0421.GBRP265.PROD.OUTLOOK.COM (2603:10a6:401:d::13) by
 CWXP265MB1093.GBRP265.PROD.OUTLOOK.COM (2603:10a6:401:3e::18) with
 Microsoft
 SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id
 15.20.3283.23; Mon, 17 Aug 2020 13:56:01 +0000
Received: from CWXP265MB0421.GBRP265.PROD.OUTLOOK.COM
 ([fe80::11b0:1161:4a74:e4b]) by CWXP265MB0421.GBRP265.PROD.OUTLOOK.COM
 ([fe80::11b0:1161:4a74:e4b%5]) with mapi id 15.20.3283.028; Mon, 17 Aug 2020
 13:56:01 +0000
From: "Jung, Alexander" <a.jung@lancaster.ac.uk>
To: Sharan Santhanam <sharan.santhanam@neclab.eu>,
 "minios-devel@lists.xen.org" <minios-devel@lists.xen.org>
Subject: Re: [UNIKRAFT PATCH] lib/uknetdev: netdev register fails on lib param
Thread-Topic: [UNIKRAFT PATCH] lib/uknetdev: netdev register fails on lib param
Thread-Index: AQHWdJ4jXh90lD4WMUaCge6riTCyOw==
Date: Mon, 17 Aug 2020 13:56:01 +0000
Message-ID: <531D7915-CFEB-4EC0-BAEB-9D7A25D0C594@lancaster.ac.uk>
References: <1597620857-11229-1-git-send-email-sharan.santhanam@neclab.eu>
In-Reply-To: <1597620857-11229-1-git-send-email-sharan.santhanam@neclab.eu>
Accept-Language: en-GB, en-US
Content-Language: en-GB
X-MS-Has-Attach: 
X-MS-TNEF-Correlator: 
user-agent: Microsoft-MacOutlook/16.40.20081000
authentication-results: neclab.eu; dkim=none (message not signed)
 header.d=none;neclab.eu; dmarc=none action=none header.from=lancaster.ac.uk;
x-originating-ip: [46.183.103.8]
x-ms-publictraffictype: Email
x-ms-office365-filtering-correlation-id: 1714bdb0-f713-4391-f128-08d842b54682
x-ms-traffictypediagnostic: CWXP265MB1093:
x-microsoft-antispam-prvs: <CWXP265MB109360A9EE09A3A56964B33BCE5F0@CWXP265MB1093.GBRP265.PROD.OUTLOOK.COM>
x-ms-oob-tlc-oobclassifiers: OLM:7691;
x-ms-exchange-senderadcheck: 1
x-microsoft-antispam: BCL:0;
x-microsoft-antispam-message-info: qanuVgQW6COKp4nYCacF4tfCnm25Mo/rsYcrapnfoyXmBZXJvx4E7jdh10PcDpDz7qzjMyURZMBJP1wD8TVdKbgU3eHb/A4xww8/D3cheSsq73C8TWc34jjWAmCfSd02AcXJR0C7/dBXWGOwVFu9M+jqjvn3nBF+8IkeY6QS4OGQB9ygJcdPCCJlbPrumSRh7JuVVmdyJ8pEbK7oJOHQIwpwKMb2IsKCT74KVUOBzZnrHSbI/6ShPSFe3RPuD3AQYBNZ8CO2LX3ZUGX9P2PG1FBfW1JUocSp/tD9Wjj/TAhmZnQQhVvA+lft03/DYb4EsbYJJxHa7ir2K0v8Lc3AWQ==
x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:;
 IPV:NLI; SFV:NSPM; H:CWXP265MB0421.GBRP265.PROD.OUTLOOK.COM; PTR:; CAT:NONE;
 SFS:(4636009)(346002)(396003)(136003)(376002)(366004)(39860400002)(33656002)(6512007)(91956017)(83380400001)(66476007)(2906002)(76116006)(66946007)(71200400001)(2616005)(66556008)(64756008)(66446008)(5660300002)(36756003)(6486002)(26005)(86362001)(110136005)(186003)(6506007)(316002)(478600001)(786003)(8676002)(8936002);
 DIR:OUT; SFP:1102; 
x-ms-exchange-antispam-messagedata: kFtRC9lmHux8I+55yK6JAGAfySLCD9G7rDR3zpkGUb/3IaXAghlpFk+RUt1MZ2oMNaVt/YxRLY0k+nCRY3WLTrYOstL2PAzPzZ9wySMJTsAlw6hoQ/22WMyTDdU3D2j0Kvi3ZzxRaLCyh5JBYQ1f5s4fpMW7p7FqBpyoWT3kyMvPDclxO4YtrKOJWw3UFEG0C3K9nin4B/4x+HokMKYK715ghaNNYBr1P2QN8qDpJZq7NV1EriWTn0bf41zr5Qp/ieAF/y6bmyPSsGJ9Y1PbAE/vY/hw6387Qj/iRQU4OFHB0xadNT/K/aCJUi77QhQw6TucT+4qEGqZ+zBFlG25Pudpi1lXsB4LEba0FEtGRkE5wte1y3JGkBUeZgSJq5vkV+RrWDo5YJ5DjIPmNcTBBhbSJbFvErwD2mgfPOCPSDRa36S5jpze+shzc8hxnDlwtuIWm7J1hSlfVgPxn73y/K1nHK/s0YBBPFRlmCQgkyS7OQ9rhFCmvu8jYGmOJiFgI1lTeYQJjPoayg70K6mNJhn97YzNMokPpvPpOtoJKmvIi6vKGTlY6WXmm6+7Pe4b99RC4PN0g/E3KatU7tTVWhWp8VFX8ibE0mS1h48ROfFdXZ1rFE/dKC9Ezw3gIUeyBb96/fChlR4bHh3UK0bN7A==
x-ms-exchange-transport-forked: True
Content-Type: text/plain; charset="utf-8"
Content-ID: <EA55D813CA5E3645883B615EC3026666@GBRP265.PROD.OUTLOOK.COM>
Content-Transfer-Encoding: base64
MIME-Version: 1.0
X-OriginatorOrg: lancaster.ac.uk
X-MS-Exchange-CrossTenant-AuthAs: Internal
X-MS-Exchange-CrossTenant-AuthSource: CWXP265MB0421.GBRP265.PROD.OUTLOOK.COM
X-MS-Exchange-CrossTenant-Network-Message-Id: 1714bdb0-f713-4391-f128-08d842b54682
X-MS-Exchange-CrossTenant-originalarrivaltime: 17 Aug 2020 13:56:01.1116 (UTC)
X-MS-Exchange-CrossTenant-fromentityheader: Hosted
X-MS-Exchange-CrossTenant-id: 9c9bcd11-977a-4e9c-a9a0-bc734090164a
X-MS-Exchange-CrossTenant-mailboxtype: HOSTED
X-MS-Exchange-CrossTenant-userprincipalname: CTtjuY7b6vhJAGhIvjVX9YuCIMM6cjhdir2c+9xkV8jY51HL3LsHyVT4r+druVfg0dG9ryDnSGF1Pa9HhOWDnA==
X-MS-Exchange-Transport-CrossTenantHeadersStamped: CWXP265MB1093
X-BeenThere: minios-devel@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Mini-os development list <minios-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:minios-devel@lists.xenproject.org>
List-Help: <mailto:minios-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: minios-devel-bounces@lists.xenproject.org
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>

SGkgU2hhcmFuLA0KDQpUaGFua3MgZm9yIHRoZSBwYXRjaC4gIFRlc3RlZCBhbmQgYWxsIGdvb2Qu
DQoNClJldmlld2VkLWJ5OiBBbGV4YW5kZXIgSnVuZyA8YS5qdW5nQGxhbmNzLmFjLnVrPg0KDQoN
Cu+7v09uIDE3LjA4LjIwLCAwMTozNSwgIk1pbmlvcy1kZXZlbCBvbiBiZWhhbGYgb2YgU2hhcmFu
IFNhbnRoYW5hbSIgPG1pbmlvcy1kZXZlbC1ib3VuY2VzQGxpc3RzLnhlbnByb2plY3Qub3JnIG9u
IGJlaGFsZiBvZiBzaGFyYW4uc2FudGhhbmFtQG5lY2xhYi5ldT4gd3JvdGU6DQoNCiAgICBlaW5m
byByZXR1cm5zIGVycm9yIHdoZW4gdGhlIHVzZXIgZG9lcyBub3QgcHJvdmlkZSB0aGUgbGlicmFy
eQ0KICAgIHBhcmFtZXRlcnMuDQoNCiAgICBTaWduZWQtb2ZmLWJ5OiBTaGFyYW4gU2FudGhhbmFt
IDxzaGFyYW4uc2FudGhhbmFtQG5lY2xhYi5ldT4NCiAgICAtLS0NCiAgICAgbGliL3VrbmV0ZGV2
L25ldGRldi5jIHwgMjYgKysrKysrKysrKysrKy0tLS0tLS0tLS0tLS0NCiAgICAgMSBmaWxlIGNo
YW5nZWQsIDEzIGluc2VydGlvbnMoKyksIDEzIGRlbGV0aW9ucygtKQ0KDQogICAgZGlmZiAtLWdp
dCBhL2xpYi91a25ldGRldi9uZXRkZXYuYyBiL2xpYi91a25ldGRldi9uZXRkZXYuYw0KICAgIGlu
ZGV4IDc0YmU2MTguLjg3MzIyYzcgMTAwNjQ0DQogICAgLS0tIGEvbGliL3VrbmV0ZGV2L25ldGRl
di5jDQogICAgKysrIGIvbGliL3VrbmV0ZGV2L25ldGRldi5jDQogICAgQEAgLTEyMCwxOCArMTIw
LDE2IEBAIHN0YXRpYyBzdHJ1Y3QgdWtfbmV0ZGV2X2VpbmZvICpfYWxsb2NfZWluZm8oc3RydWN0
IHVrX2FsbG9jICphKQ0KICAgICB7DQogICAgIAlzdHJ1Y3QgdWtfbmV0ZGV2X2VpbmZvICpfZWlu
Zm8gPSBOVUxMOw0KDQogICAgLQlpZiAoaXB2NF9hZGRyIHx8IGlwdjRfc3VibmV0X21hc2sgfHwg
aXB2NF9nd19hZGRyKSB7DQogICAgLQkJX2VpbmZvID0gdWtfemFsbG9jKGEsIHNpemVvZigqX2Vp
bmZvKSk7DQogICAgLQkJaWYgKCFfZWluZm8pIHsNCiAgICAtCQkJdWtfcHJfd2FybigiRmFpbGVk
IHRvIGFsbG9jYXRlIG1lbW9yeSBmb3IgbmV0ZGV2IGNvbmZpZ1xuIik7DQogICAgLQkJCXJldHVy
biBOVUxMOw0KICAgIC0JCX0NCiAgICAtDQogICAgLQkJX2VpbmZvLT5pcHY0X2FkZHIgPSBfcGFy
c2VfaXB2NF9hZGRyKCk7DQogICAgLQkJX2VpbmZvLT5pcHY0X25ldF9tYXNrID0gX3BhcnNlX2lw
djRfbmV0X21hc2soKTsNCiAgICAtCQlfZWluZm8tPmlwdjRfZ3dfYWRkciA9IF9wYXJzZV9pcHY0
X2d3X2FkZHIoKTsNCiAgICArCV9laW5mbyA9IHVrX3phbGxvYyhhLCBzaXplb2YoKl9laW5mbykp
Ow0KICAgICsJaWYgKCFfZWluZm8pIHsNCiAgICArCQl1a19wcl93YXJuKCJGYWlsZWQgdG8gYWxs
b2NhdGUgbWVtb3J5IGZvciBuZXRkZXYgY29uZmlnXG4iKTsNCiAgICArCQlyZXR1cm4gRVJSMlBU
UigtRU5PTUVNKTsNCiAgICAgCX0NCg0KICAgICsJX2VpbmZvLT5pcHY0X2FkZHIgPSBfcGFyc2Vf
aXB2NF9hZGRyKCk7DQogICAgKwlfZWluZm8tPmlwdjRfbmV0X21hc2sgPSBfcGFyc2VfaXB2NF9u
ZXRfbWFzaygpOw0KICAgICsJX2VpbmZvLT5pcHY0X2d3X2FkZHIgPSBfcGFyc2VfaXB2NF9nd19h
ZGRyKCk7DQogICAgKw0KICAgICAJcmV0dXJuIF9laW5mbzsNCiAgICAgfQ0KDQogICAgQEAgLTE2
Miw5ICsxNjAsMTEgQEAgaW50IHVrX25ldGRldl9kcnZfcmVnaXN0ZXIoc3RydWN0IHVrX25ldGRl
diAqZGV2LCBzdHJ1Y3QgdWtfYWxsb2MgKmEsDQogICAgIAlpZiAoIWRldi0+X2RhdGEpDQogICAg
IAkJcmV0dXJuIC1FTk9NRU07DQoNCiAgICAtCWRldi0+X2VpbmZvID0gX2FsbG9jX2VpbmZvKGEp
Ow0KICAgIC0JaWYgKCFkZXYtPl9laW5mbykNCiAgICAtCQlyZXR1cm4gLUVOT01FTTsNCiAgICAr
CWlmIChpcHY0X2FkZHIgfHwgaXB2NF9zdWJuZXRfbWFzayB8fCBpcHY0X2d3X2FkZHIpIHsNCiAg
ICArCQlkZXYtPl9laW5mbyA9IF9hbGxvY19laW5mbyhhKTsNCiAgICArCQlpZiAoUFRSSVNFUlIo
ZGV2LT5fZWluZm8pKQ0KICAgICsJCQlyZXR1cm4gUFRSMkVSUihkZXYtPl9laW5mbyk7DQogICAg
Kwl9DQoNCiAgICAgCVVLX1RBSUxRX0lOU0VSVF9UQUlMKCZ1a19uZXRkZXZfbGlzdCwgZGV2LCBf
bGlzdCk7DQogICAgIAl1a19wcl9pbmZvKCJSZWdpc3RlcmVkIG5ldGRldiUiUFJJdTE2IjogJXAg
KCVzKVxuIiwNCiAgICAtLSANCiAgICAyLjcuNA0KDQoNCg==


From minios-devel-bounces@lists.xenproject.org Tue Aug 18 13:32:12 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Tue, 18 Aug 2020 13:32:12 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1k81ih-00073v-VM; Tue, 18 Aug 2020 13:32:07 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=6Pwq=B4=gmail.com=cristianvijelie@srs-us1.protection.inumbo.net>)
 id 1k81ig-00073q-An
 for minios-devel@lists.xen.org; Tue, 18 Aug 2020 13:32:06 +0000
X-Inumbo-ID: f25a4849-8934-44d8-bb37-9ec42c475153
Received: from mail-ej1-x630.google.com (unknown [2a00:1450:4864:20::630])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id f25a4849-8934-44d8-bb37-9ec42c475153;
 Tue, 18 Aug 2020 13:32:05 +0000 (UTC)
Received: by mail-ej1-x630.google.com with SMTP id m22so22053492eje.10
 for <minios-devel@lists.xen.org>; Tue, 18 Aug 2020 06:32:05 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=from:to:subject:date:message-id:mime-version
 :content-transfer-encoding;
 bh=kJm7ICSY3kSpWp2K81uHN0rsePN33UsmylgWM9Xf4Cc=;
 b=VhusFVQOuHq6q/81HrMeuDrmHIWDLiOY6tr+bSSdpxbloAxu8XWSjoHG86Vubr/T5v
 jU0r2NA8CIPbBx3b34eawWZ+KS5k45ezjwNIw8bBdVkWOTumLvsXOXe4EAqJZdwmwFMd
 HnB1wFe5j/vXnKREOSx5z3Zz+Rc5h2jvUGUMLVBz4thIPMgttiS/+2KAyXuGSEuzNpXo
 S70g5nmViH12QTUzNqGWu7FpTknaUFs8xOntUVchHkDCfk7lVOJzd3OAv9wd2AHrrtR+
 yWpkLs3UchXPPOczrlMTEGqSjfXVhUDm7Edkt6kMaDquBRfduW6pi6ytZeiC9HwJYoXT
 YtXg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:to:subject:date:message-id:mime-version
 :content-transfer-encoding;
 bh=kJm7ICSY3kSpWp2K81uHN0rsePN33UsmylgWM9Xf4Cc=;
 b=hwEytGgcX56zWVy5xwuWUGdv5GYciLd1r6bWssCl6sW/ST/450iZEn+06Ncrqw+iD9
 arhhI2L7mjExTLL7EWH9fumR5IOyk8/mApuPXcvUXs91cn3iAmyxf7KmqP1ZVsoG49Uo
 w6865YlCLrjK5D8JCzTYq/cWe6tI9+oFD8dYh1EKZxdk/Og4Ul2DT3AhzbZC/Dh+3l3r
 YoFK1pEqTa1vXL45l1liW89GZ1tDMNXwwxN6kBeWU3c5k4VfAzfQBhM39kKdYR/cNV03
 iXCe781zcyk5pnZ4idzNlRlfSvoiehrZd7BQu8+LgaYWhuAlYSG+lF6IHImggYNXFtmF
 t9cw==
X-Gm-Message-State: AOAM530dQ7B33A4ZTsLQzjVprP9nAhW72OX8W6xtnBg+lUql2wg8Aab2
 gpLy/Ya7PEH/T4Xc8pNQbXJ+1Vf6yYN3iA==
X-Google-Smtp-Source: ABdhPJzuajJtNp83iadACtHpIgG3zaD4bRF77jKcj3fTtFTyU6odSVpumJw1CcQ4hFJeVpRTUM3Nnw==
X-Received: by 2002:a17:906:8316:: with SMTP id
 j22mr19359844ejx.20.1597757524160; 
 Tue, 18 Aug 2020 06:32:04 -0700 (PDT)
Received: from localhost.localdomain ([2a02:2f0b:450d:d00:a814:d7ed:a83e:a651])
 by smtp.gmail.com with ESMTPSA id qk30sm16478611ejb.125.2020.08.18.06.32.02
 for <minios-devel@lists.xen.org>
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Tue, 18 Aug 2020 06:32:02 -0700 (PDT)
From: Cristian Vijelie <cristianvijelie@gmail.com>
To: minios-devel@lists.xen.org
Subject: [[UNIKRAFT/LIBS PATCH]] Removed exportsyms.uk from Makefile.uk
Date: Tue, 18 Aug 2020 16:32:01 +0300
Message-Id: <20200818133201.8737-1-cristianvijelie@gmail.com>
X-Mailer: git-send-email 2.25.1
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-BeenThere: minios-devel@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Mini-os development list <minios-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:minios-devel@lists.xenproject.org>
List-Help: <mailto:minios-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: minios-devel-bounces@lists.xenproject.org
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>

---
 Makefile.uk | 2 --
 1 file changed, 2 deletions(-)

diff --git a/Makefile.uk b/Makefile.uk
index b9b7456..4ee37cd 100644
--- a/Makefile.uk
+++ b/Makefile.uk
@@ -59,8 +59,6 @@ LIBPTHREAD-EMBEDDED_CFLAGS-y   += $(LIBPTHREAD-EMBEDDED_SUPPRESS_FLAGS) \
 	-Wno-pointer-to-int-cast -Wno-int-to-pointer-cast
 LIBPTHREAD-EMBEDDED_CXXFLAGS-y += $(LIBPTHREAD-EMBEDDED_SUPPRESS_FLAGS)
 
-LIBPTHREAD-EMBEDDED_EXPORTS = $(LIBPTHREAD-EMBEDDED_BASE)/exportsyms.uk
-
 ################################################################################
 # OS dependencies code - Glue between Unikraft and pthread-embedded
 ################################################################################
-- 
2.25.1



From minios-devel-bounces@lists.xenproject.org Tue Aug 18 13:42:34 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Tue, 18 Aug 2020 13:42:34 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1k81sm-0007x7-PI; Tue, 18 Aug 2020 13:42:32 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=ZTf0=B4=cs.pub.ro=costin.lupu@srs-us1.protection.inumbo.net>)
 id 1k81sl-0007wA-49
 for minios-devel@lists.xen.org; Tue, 18 Aug 2020 13:42:31 +0000
X-Inumbo-ID: e6582cd2-c120-46e6-85e4-485de17468a1
Received: from mx.upb.ro (unknown [141.85.13.210])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id e6582cd2-c120-46e6-85e4-485de17468a1;
 Tue, 18 Aug 2020 13:42:29 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
 by mx.upb.ro (Postfix) with ESMTP id 9515FB560097;
 Tue, 18 Aug 2020 16:42:27 +0300 (EEST)
Received: from mx.upb.ro ([127.0.0.1])
 by localhost (mx.upb.ro [127.0.0.1]) (amavisd-new, port 10032)
 with ESMTP id Lx1Q_cIE2x5S; Tue, 18 Aug 2020 16:42:25 +0300 (EEST)
Received: from localhost (localhost [127.0.0.1])
 by mx.upb.ro (Postfix) with ESMTP id D2212B5617CC;
 Tue, 18 Aug 2020 16:42:25 +0300 (EEST)
X-Virus-Scanned: amavisd-new at upb.ro
Received: from mx.upb.ro ([127.0.0.1])
 by localhost (mx.upb.ro [127.0.0.1]) (amavisd-new, port 10026)
 with ESMTP id vC0jj0-R7h5A; Tue, 18 Aug 2020 16:42:25 +0300 (EEST)
Received: from localhost.localdomain (unknown [188.25.162.205])
 by mx.upb.ro (Postfix) with ESMTPSA id A2048B560097;
 Tue, 18 Aug 2020 16:42:25 +0300 (EEST)
From: Costin Lupu <costin.lupu@cs.pub.ro>
To: minios-devel@lists.xen.org
Cc: samuel.thibault@ens-lyon.org
Subject: [PATCH] mini-os: Use a single start_info_ptr variable
Date: Tue, 18 Aug 2020 16:42:22 +0300
Message-Id: <20200818134222.15081-1-costin.lupu@cs.pub.ro>
X-Mailer: git-send-email 2.20.1
MIME-Version: 1.0
Content-Transfer-Encoding: quoted-printable
X-BeenThere: minios-devel@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Mini-os development list <minios-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:minios-devel@lists.xenproject.org>
List-Help: <mailto:minios-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: minios-devel-bounces@lists.xenproject.org
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>

Signed-off-by: Costin Lupu <costin.lupu@cs.pub.ro>
---
 arch/x86/setup.c | 2 +-
 shutdown.c       | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/arch/x86/setup.c b/arch/x86/setup.c
index 4fd8e39..2ba74fb 100644
--- a/arch/x86/setup.c
+++ b/arch/x86/setup.c
@@ -45,7 +45,7 @@ union start_info_union start_info_union;
 /*
  * This pointer holds a reference to the copy of the start_info struct.
  */
-static start_info_t *start_info_ptr;
+start_info_t *start_info_ptr;
=20
 /*
  * Shared page for communicating with the hypervisor.
diff --git a/shutdown.c b/shutdown.c
index 4c0b13c..4d0617f 100644
--- a/shutdown.c
+++ b/shutdown.c
@@ -46,7 +46,7 @@
 #include <mini-os/xmalloc.h>
=20
=20
-static start_info_t *start_info_ptr;
+extern start_info_t *start_info_ptr;
=20
 #ifdef CONFIG_XENBUS
 static const char *path =3D "control/shutdown";
@@ -113,7 +113,7 @@ static void shutdown_thread(void *p)
=20
 void init_shutdown(start_info_t *si)
 {
-    start_info_ptr =3D si;
+    ASSERT(start_info_ptr =3D=3D si);
=20
     end_shutdown_thread =3D 0;
     create_thread("shutdown", shutdown_thread, NULL);
--=20
2.20.1



From minios-devel-bounces@lists.xenproject.org Tue Aug 18 13:44:14 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Tue, 18 Aug 2020 13:44:14 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1k81uO-00083n-BM; Tue, 18 Aug 2020 13:44:12 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=ZTf0=B4=cs.pub.ro=costin.lupu@srs-us1.protection.inumbo.net>)
 id 1k81uN-00083i-UM
 for minios-devel@lists.xen.org; Tue, 18 Aug 2020 13:44:11 +0000
X-Inumbo-ID: ff443d97-4c6b-4c18-a570-b050c46d9a16
Received: from mx.upb.ro (unknown [141.85.13.210])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id ff443d97-4c6b-4c18-a570-b050c46d9a16;
 Tue, 18 Aug 2020 13:44:09 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
 by mx.upb.ro (Postfix) with ESMTP id B864BB5617CC;
 Tue, 18 Aug 2020 16:44:08 +0300 (EEST)
Received: from mx.upb.ro ([127.0.0.1])
 by localhost (mx.upb.ro [127.0.0.1]) (amavisd-new, port 10032)
 with ESMTP id poFkLQJGvNae; Tue, 18 Aug 2020 16:44:06 +0300 (EEST)
Received: from localhost (localhost [127.0.0.1])
 by mx.upb.ro (Postfix) with ESMTP id DE319B561B2A;
 Tue, 18 Aug 2020 16:44:06 +0300 (EEST)
X-Virus-Scanned: amavisd-new at upb.ro
Received: from mx.upb.ro ([127.0.0.1])
 by localhost (mx.upb.ro [127.0.0.1]) (amavisd-new, port 10026)
 with ESMTP id eQ3VQWi_MGCe; Tue, 18 Aug 2020 16:44:06 +0300 (EEST)
Received: from localhost.localdomain (unknown [188.25.162.205])
 by mx.upb.ro (Postfix) with ESMTPSA id 9FD97B5617CC;
 Tue, 18 Aug 2020 16:44:06 +0300 (EEST)
From: Costin Lupu <costin.lupu@cs.pub.ro>
To: minios-devel@lists.xen.org
Cc: samuel.thibault@ens-lyon.org,
	wl@xen.org
Subject: [PATCH] mini-os: console.c: Rename static variable from buf to
 __print_buf
Date: Tue, 18 Aug 2020 16:44:06 +0300
Message-Id: <20200818134406.15254-1-costin.lupu@cs.pub.ro>
X-Mailer: git-send-email 2.20.1
MIME-Version: 1.0
Content-Transfer-Encoding: quoted-printable
X-BeenThere: minios-devel@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Mini-os development list <minios-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:minios-devel@lists.xenproject.org>
List-Help: <mailto:minios-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: minios-devel-bounces@lists.xenproject.org
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>

lwip soure code also has a static variable called 'buf' in ip_frag.c. Thi=
s can
get confusing when inspecting the binary (e.g. with objdump or something
similar). Therefore this patch renames the 'buf' variable used by print()
function to '__print_buf'.

Signed-off-by: Costin Lupu <costin.lupu@cs.pub.ro>
---
 console/console.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/console/console.c b/console/console.c
index 9ddae9d..af1a6dd 100644
--- a/console/console.c
+++ b/console/console.c
@@ -122,21 +122,21 @@ void console_print(struct consfront_dev *dev, char =
*data, int length)
=20
 void print(int direct, const char *fmt, va_list args)
 {
-    static char   buf[1024];
+    static char __print_buf[1024];
    =20
-    (void)vsnprintf(buf, sizeof(buf), fmt, args);
+    (void)vsnprintf(__print_buf, sizeof(__print_buf), fmt, args);
=20
     if(direct)
     {
-        (void)HYPERVISOR_console_io(CONSOLEIO_write, strlen(buf), buf);
+        (void)HYPERVISOR_console_io(CONSOLEIO_write, strlen(__print_buf)=
, __print_buf);
         return;
     } else {
 #ifndef CONFIG_USE_XEN_CONSOLE
     if(!console_initialised)
 #endif   =20
-            (void)HYPERVISOR_console_io(CONSOLEIO_write, strlen(buf), bu=
f);
+            (void)HYPERVISOR_console_io(CONSOLEIO_write, strlen(__print_=
buf), __print_buf);
        =20
-        console_print(NULL, buf, strlen(buf));
+        console_print(NULL, __print_buf, strlen(__print_buf));
     }
 }
=20
--=20
2.20.1



From minios-devel-bounces@lists.xenproject.org Tue Aug 18 13:45:47 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Tue, 18 Aug 2020 13:45:47 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1k81vt-00087Q-GJ; Tue, 18 Aug 2020 13:45:45 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=ZTf0=B4=cs.pub.ro=costin.lupu@srs-us1.protection.inumbo.net>)
 id 1k81vs-00087L-Iu
 for minios-devel@lists.xen.org; Tue, 18 Aug 2020 13:45:44 +0000
X-Inumbo-ID: 8dc1c157-42d5-4498-91ce-6edd325edf2e
Received: from mx.upb.ro (unknown [141.85.13.200])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 8dc1c157-42d5-4498-91ce-6edd325edf2e;
 Tue, 18 Aug 2020 13:45:41 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
 by mx.upb.ro (Postfix) with ESMTP id E7539B561B2A;
 Tue, 18 Aug 2020 16:45:40 +0300 (EEST)
Received: from mx.upb.ro ([127.0.0.1])
 by localhost (mx.upb.ro [127.0.0.1]) (amavisd-new, port 10032)
 with ESMTP id FsAix6BKp6_8; Tue, 18 Aug 2020 16:45:38 +0300 (EEST)
Received: from localhost (localhost [127.0.0.1])
 by mx.upb.ro (Postfix) with ESMTP id 38EB6B561CCE;
 Tue, 18 Aug 2020 16:45:38 +0300 (EEST)
X-Virus-Scanned: amavisd-new at upb.ro
Received: from mx.upb.ro ([127.0.0.1])
 by localhost (mx.upb.ro [127.0.0.1]) (amavisd-new, port 10026)
 with ESMTP id V9HXZXMtmapB; Tue, 18 Aug 2020 16:45:38 +0300 (EEST)
Received: from localhost.localdomain (unknown [188.25.162.205])
 by mx.upb.ro (Postfix) with ESMTPSA id EF113B561B2A;
 Tue, 18 Aug 2020 16:45:37 +0300 (EEST)
From: Costin Lupu <costin.lupu@cs.pub.ro>
To: minios-devel@lists.xen.org
Cc: samuel.thibault@ens-lyon.org,
	wl@xen.org
Subject: [PATCH] mini-os: netfront: Read netmask and gateway from Xenstore
Date: Tue, 18 Aug 2020 16:45:37 +0300
Message-Id: <20200818134537.15422-1-costin.lupu@cs.pub.ro>
X-Mailer: git-send-email 2.20.1
MIME-Version: 1.0
Content-Transfer-Encoding: quoted-printable
X-BeenThere: minios-devel@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Mini-os development list <minios-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:minios-devel@lists.xenproject.org>
List-Help: <mailto:minios-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: minios-devel-bounces@lists.xenproject.org
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>

When providing the IP address via the config file, one can also add the n=
etmask
and gateway address, e.g. "ip=3D192.168.0.2 255.255.255.0 192.168.0.1", w=
hich
will be further published to Xenstore. This patch adds support for readin=
g the
netmask and gateway values.

The patch also makes the 'gw' variable global in order to be used by othe=
r
source files when communication with the gateway is needed.

Signed-off-by: Costin Lupu <costin.lupu@cs.pub.ro>
---
 include/netfront.h |  5 ++++-
 lwip-net.c         | 35 ++++++++++++++++++++++++-----------
 netfront.c         | 34 +++++++++++++++++++++++++++++-----
 3 files changed, 57 insertions(+), 17 deletions(-)

diff --git a/include/netfront.h b/include/netfront.h
index 1164d50..df1a9a7 100644
--- a/include/netfront.h
+++ b/include/netfront.h
@@ -7,7 +7,7 @@ struct netfront_dev *init_netfront(char *nodename,
                                    void (*netif_rx)(unsigned char *data,
                                                     int len, void* arg),
                                    unsigned char rawmac[6],
-                                   char **ip);
+                                   char **ip, char **mask, char **gw);
 void netfront_xmit(struct netfront_dev *dev, unsigned char* data,int len=
);
 void shutdown_netfront(struct netfront_dev *dev);
 void suspend_netfront(void);
@@ -27,4 +27,7 @@ void start_networking(void);
 void stop_networking(void);
=20
 void networking_set_addr(struct ip_addr *ipaddr, struct ip_addr *netmask=
, struct ip_addr *gw);
+
+/* Gateway address */
+extern struct ip_addr gw;
 #endif
diff --git a/lwip-net.c b/lwip-net.c
index 449b70f..0c49d96 100644
--- a/lwip-net.c
+++ b/lwip-net.c
@@ -331,6 +331,8 @@ static void tcpip_bringup_finished(void *p)
   up(&tcpip_is_up);
 }
=20
+struct ip_addr gw;
+
 /*=20
  * Utility function to bring the whole lot up.  Call this from app_main(=
)=20
  * or similar -- it starts netfront and have lwIP start its thread,
@@ -342,23 +344,34 @@ void start_networking(void)
   struct netif *netif;
   struct ip_addr ipaddr =3D { htonl(IF_IPADDR) };
   struct ip_addr netmask =3D { htonl(IF_NETMASK) };
-  struct ip_addr gw =3D { 0 };
-  char *ip =3D NULL;
+  char *ip =3D NULL, *netmask_str =3D NULL, *gw_str =3D NULL;
=20
   tprintk("Waiting for network.\n");
=20
-  dev =3D init_netfront(NULL, NULL, rawmac, &ip);
+  dev =3D init_netfront(NULL, NULL, rawmac, &ip, &netmask_str, &gw_str);
  =20
   if (ip) {
     ipaddr.addr =3D inet_addr(ip);
-    if (IN_CLASSA(ntohl(ipaddr.addr)))
-      netmask.addr =3D htonl(IN_CLASSA_NET);
-    else if (IN_CLASSB(ntohl(ipaddr.addr)))
-      netmask.addr =3D htonl(IN_CLASSB_NET);
-    else if (IN_CLASSC(ntohl(ipaddr.addr)))
-      netmask.addr =3D htonl(IN_CLASSC_NET);
-    else
-      tprintk("Strange IP %s, leaving netmask to 0.\n", ip);
+    free(ip);
+
+    if (netmask_str) {
+        netmask.addr =3D inet_addr(netmask_str);
+        free(netmask_str);
+    } else {
+        if (IN_CLASSA(ntohl(ipaddr.addr)))
+            netmask.addr =3D htonl(IN_CLASSA_NET);
+        else if (IN_CLASSB(ntohl(ipaddr.addr)))
+            netmask.addr =3D htonl(IN_CLASSB_NET);
+        else if (IN_CLASSC(ntohl(ipaddr.addr)))
+            netmask.addr =3D htonl(IN_CLASSC_NET);
+        else
+            tprintk("Strange IP %s, leaving netmask to 0.\n", ip);
+    }
+
+    if (gw_str) {
+        gw.addr =3D inet_addr(gw_str);
+        free(gw_str);
+    }
   }
   tprintk("IP %x netmask %x gateway %x.\n",
           ntohl(ipaddr.addr), ntohl(netmask.addr), ntohl(gw.addr));
diff --git a/netfront.c b/netfront.c
index 66f2bbc..58eb55e 100644
--- a/netfront.c
+++ b/netfront.c
@@ -71,6 +71,8 @@ struct netfront_dev_list {
     struct netfront_dev *dev;
     unsigned char rawmac[6];
     char *ip;
+    char *mask;
+    char *gw;
=20
     int refcount;
=20
@@ -81,7 +83,7 @@ static struct netfront_dev_list *dev_list =3D NULL;
=20
 void init_rx_buffers(struct netfront_dev *dev);
 static struct netfront_dev *_init_netfront(struct netfront_dev *dev,
-                                           unsigned char rawmac[6], char=
 **ip);
+                                           unsigned char rawmac[6], char=
 **ip, char **mask, char **gw);
 static void _shutdown_netfront(struct netfront_dev *dev);
 void netfront_set_rx_handler(struct netfront_dev *dev,
                              void (*thenetif_rx)(unsigned char *data, in=
t len,
@@ -301,7 +303,7 @@ struct netfront_dev *init_netfront(char *_nodename,
                                    void (*thenetif_rx)(unsigned char* da=
ta,
                                                        int len, void* ar=
g),
                                    unsigned char rawmac[6],
-                                   char **ip)
+                                   char **ip, char **mask, char **gw)
 {
     char nodename[256];
     struct netfront_dev *dev;
@@ -344,7 +346,7 @@ struct netfront_dev *init_netfront(char *_nodename,
     ldev =3D malloc(sizeof(struct netfront_dev_list));
     memset(ldev, 0, sizeof(struct netfront_dev_list));
=20
-    if (_init_netfront(dev, ldev->rawmac, &(ldev->ip))) {
+    if (_init_netfront(dev, ldev->rawmac, &(ldev->ip), &(ldev->mask), &(=
ldev->gw))) {
         ldev->dev =3D dev;
         ldev->refcount =3D 1;
         ldev->next =3D NULL;
@@ -374,6 +376,10 @@ out:
 	}
     if (ip)
         *ip =3D strdup(ldev->ip);
+    if (mask)
+        *mask =3D strdup(ldev->mask);
+    if (gw)
+        *gw =3D strdup(ldev->gw);
=20
 err:
     return dev;
@@ -381,7 +387,7 @@ err:
=20
 static struct netfront_dev *_init_netfront(struct netfront_dev *dev,
 					   unsigned char rawmac[6],
-					   char **ip)
+					   char **ip, char **mask, char **gw)
 {
     xenbus_transaction_t xbt;
     char* err =3D NULL;
@@ -518,8 +524,26 @@ done:
         }
=20
         if (ip) {
+            char *p;
+
             snprintf(path, sizeof(path), "%s/ip", dev->backend);
             xenbus_read(XBT_NIL, path, ip);
+
+            if (mask) {
+                p =3D strchr(*ip, ' ');
+                if (p) {
+                    *p++ =3D '\0';
+                    *mask =3D p;
+
+                    if (gw) {
+                        p =3D strchr(p, ' ');
+                        if (p) {
+                            *p++ =3D '\0';
+                            *gw =3D p;
+                        }
+                    }
+                }
+            }
         }
     }
=20
@@ -676,7 +700,7 @@ void resume_netfront(void)
     struct netfront_dev_list *list;
=20
     for (list =3D dev_list; list !=3D NULL; list =3D list->next)
-        _init_netfront(list->dev, NULL, NULL);
+        _init_netfront(list->dev, NULL, NULL, NULL, NULL);
 }
=20
 void init_rx_buffers(struct netfront_dev *dev)
--=20
2.20.1



From minios-devel-bounces@lists.xenproject.org Tue Aug 18 16:43:43 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Tue, 18 Aug 2020 16:43:43 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1k84i2-0001AH-EL; Tue, 18 Aug 2020 16:43:38 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=JmHm=B4=ens-lyon.org=samuel.thibault@srs-us1.protection.inumbo.net>)
 id 1k84i1-00019l-1j
 for minios-devel@lists.xen.org; Tue, 18 Aug 2020 16:43:37 +0000
X-Inumbo-ID: d28e0f01-ed8a-4370-b72e-c319073e1745
Received: from hera.aquilenet.fr (unknown [185.233.100.1])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id d28e0f01-ed8a-4370-b72e-c319073e1745;
 Tue, 18 Aug 2020 16:43:34 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
 by hera.aquilenet.fr (Postfix) with ESMTP id 665FF11260;
 Tue, 18 Aug 2020 18:43:33 +0200 (CEST)
X-Virus-Scanned: Debian amavisd-new at aquilenet.fr
Received: from hera.aquilenet.fr ([127.0.0.1])
 by localhost (hera.aquilenet.fr [127.0.0.1]) (amavisd-new, port 10024)
 with ESMTP id E4pkcN7sHtrW; Tue, 18 Aug 2020 18:43:32 +0200 (CEST)
Received: from function (unknown [IPv6:2a01:cb19:956:1b00:9eb6:d0ff:fe88:c3c7])
 by hera.aquilenet.fr (Postfix) with ESMTPSA id BCD371C08;
 Tue, 18 Aug 2020 18:43:32 +0200 (CEST)
Received: from samy by function with local (Exim 4.94)
 (envelope-from <samuel.thibault@ens-lyon.org>)
 id 1k84hv-0002JY-JY; Tue, 18 Aug 2020 18:43:31 +0200
Date: Tue, 18 Aug 2020 18:43:31 +0200
From: Samuel Thibault <samuel.thibault@ens-lyon.org>
To: Costin Lupu <costin.lupu@cs.pub.ro>
Cc: minios-devel@lists.xen.org
Subject: Re: [PATCH] mini-os: Use a single start_info_ptr variable
Message-ID: <20200818164331.su32xlwf6b4pdw5w@function>
Mail-Followup-To: Samuel Thibault <samuel.thibault@ens-lyon.org>,
 Costin Lupu <costin.lupu@cs.pub.ro>, minios-devel@lists.xen.org
References: <20200818134222.15081-1-costin.lupu@cs.pub.ro>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
Content-Transfer-Encoding: 8bit
In-Reply-To: <20200818134222.15081-1-costin.lupu@cs.pub.ro>
Organization: I am not organized
User-Agent: NeoMutt/20170609 (1.8.3)
X-BeenThere: minios-devel@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Mini-os development list <minios-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:minios-devel@lists.xenproject.org>
List-Help: <mailto:minios-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: minios-devel-bounces@lists.xenproject.org
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>

Costin Lupu, le mar. 18 aoÃ»t 2020 16:42:22 +0300, a ecrit:
>  arch/x86/setup.c | 2 +-
>  shutdown.c       | 4 ++--

This would break the arm build, which does not have the start_info_ptr
variable. That being said, shutdown.c doesn't seem like buildable on
arm. I'd say not try to touch this code, and wait for ARM porters to fix
the start_info question, and then we can see how to factorize the
variables.

>  2 files changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/arch/x86/setup.c b/arch/x86/setup.c
> index 4fd8e39..2ba74fb 100644
> --- a/arch/x86/setup.c
> +++ b/arch/x86/setup.c
> @@ -45,7 +45,7 @@ union start_info_union start_info_union;
>  /*
>   * This pointer holds a reference to the copy of the start_info struct.
>   */
> -static start_info_t *start_info_ptr;
> +start_info_t *start_info_ptr;
>  
>  /*
>   * Shared page for communicating with the hypervisor.
> diff --git a/shutdown.c b/shutdown.c
> index 4c0b13c..4d0617f 100644
> --- a/shutdown.c
> +++ b/shutdown.c
> @@ -46,7 +46,7 @@
>  #include <mini-os/xmalloc.h>
>  
>  
> -static start_info_t *start_info_ptr;
> +extern start_info_t *start_info_ptr;
>  
>  #ifdef CONFIG_XENBUS
>  static const char *path = "control/shutdown";
> @@ -113,7 +113,7 @@ static void shutdown_thread(void *p)
>  
>  void init_shutdown(start_info_t *si)
>  {
> -    start_info_ptr = si;
> +    ASSERT(start_info_ptr == si);
>  
>      end_shutdown_thread = 0;
>      create_thread("shutdown", shutdown_thread, NULL);
> -- 
> 2.20.1
> 

-- 
Samuel
#include <culture.h>


From minios-devel-bounces@lists.xenproject.org Tue Aug 18 16:44:45 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Tue, 18 Aug 2020 16:44:45 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1k84j5-0001JA-82; Tue, 18 Aug 2020 16:44:43 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=JmHm=B4=ens-lyon.org=samuel.thibault@srs-us1.protection.inumbo.net>)
 id 1k84j3-0001Iz-SC
 for minios-devel@lists.xen.org; Tue, 18 Aug 2020 16:44:41 +0000
X-Inumbo-ID: 945180fb-c4a8-4576-b385-a2cab79f7327
Received: from hera.aquilenet.fr (unknown [2a0c:e300::1])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 945180fb-c4a8-4576-b385-a2cab79f7327;
 Tue, 18 Aug 2020 16:44:39 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
 by hera.aquilenet.fr (Postfix) with ESMTP id 276BF11260;
 Tue, 18 Aug 2020 18:44:39 +0200 (CEST)
X-Virus-Scanned: Debian amavisd-new at aquilenet.fr
Received: from hera.aquilenet.fr ([127.0.0.1])
 by localhost (hera.aquilenet.fr [127.0.0.1]) (amavisd-new, port 10024)
 with ESMTP id shwjtsPACTDJ; Tue, 18 Aug 2020 18:44:38 +0200 (CEST)
Received: from function (unknown [IPv6:2a01:cb19:956:1b00:9eb6:d0ff:fe88:c3c7])
 by hera.aquilenet.fr (Postfix) with ESMTPSA id 1B35F1C08;
 Tue, 18 Aug 2020 18:44:38 +0200 (CEST)
Received: from samy by function with local (Exim 4.94)
 (envelope-from <samuel.thibault@ens-lyon.org>)
 id 1k84iz-0002K0-H1; Tue, 18 Aug 2020 18:44:37 +0200
Date: Tue, 18 Aug 2020 18:44:37 +0200
From: Samuel Thibault <samuel.thibault@ens-lyon.org>
To: Costin Lupu <costin.lupu@cs.pub.ro>
Cc: minios-devel@lists.xen.org, wl@xen.org
Subject: Re: [PATCH] mini-os: console.c: Rename static variable from buf to
 __print_buf
Message-ID: <20200818164437.mivf5sfqgsxzam22@function>
Mail-Followup-To: Samuel Thibault <samuel.thibault@ens-lyon.org>,
 Costin Lupu <costin.lupu@cs.pub.ro>, minios-devel@lists.xen.org,
 wl@xen.org
References: <20200818134406.15254-1-costin.lupu@cs.pub.ro>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
Content-Transfer-Encoding: 8bit
In-Reply-To: <20200818134406.15254-1-costin.lupu@cs.pub.ro>
Organization: I am not organized
User-Agent: NeoMutt/20170609 (1.8.3)
X-BeenThere: minios-devel@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Mini-os development list <minios-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:minios-devel@lists.xenproject.org>
List-Help: <mailto:minios-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: minios-devel-bounces@lists.xenproject.org
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>

Costin Lupu, le mar. 18 aoÃ»t 2020 16:44:06 +0300, a ecrit:
> lwip soure code also has a static variable called 'buf' in ip_frag.c. This can
> get confusing when inspecting the binary (e.g. with objdump or something
> similar). Therefore this patch renames the 'buf' variable used by print()
> function to '__print_buf'.
> 
> Signed-off-by: Costin Lupu <costin.lupu@cs.pub.ro>

Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>

> ---
>  console/console.c | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/console/console.c b/console/console.c
> index 9ddae9d..af1a6dd 100644
> --- a/console/console.c
> +++ b/console/console.c
> @@ -122,21 +122,21 @@ void console_print(struct consfront_dev *dev, char *data, int length)
>  
>  void print(int direct, const char *fmt, va_list args)
>  {
> -    static char   buf[1024];
> +    static char __print_buf[1024];
>      
> -    (void)vsnprintf(buf, sizeof(buf), fmt, args);
> +    (void)vsnprintf(__print_buf, sizeof(__print_buf), fmt, args);
>  
>      if(direct)
>      {
> -        (void)HYPERVISOR_console_io(CONSOLEIO_write, strlen(buf), buf);
> +        (void)HYPERVISOR_console_io(CONSOLEIO_write, strlen(__print_buf), __print_buf);
>          return;
>      } else {
>  #ifndef CONFIG_USE_XEN_CONSOLE
>      if(!console_initialised)
>  #endif    
> -            (void)HYPERVISOR_console_io(CONSOLEIO_write, strlen(buf), buf);
> +            (void)HYPERVISOR_console_io(CONSOLEIO_write, strlen(__print_buf), __print_buf);
>          
> -        console_print(NULL, buf, strlen(buf));
> +        console_print(NULL, __print_buf, strlen(__print_buf));
>      }
>  }
>  
> -- 
> 2.20.1
> 

-- 
Samuel
<c> xlnt comme sujet de stage je peux essayer de donner une description formelle de automake
 -+- #ens-mim -+-


From minios-devel-bounces@lists.xenproject.org Tue Aug 18 16:51:05 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Tue, 18 Aug 2020 16:51:05 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1k84pD-0002Am-Pw; Tue, 18 Aug 2020 16:51:03 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=JmHm=B4=ens-lyon.org=samuel.thibault@srs-us1.protection.inumbo.net>)
 id 1k84pC-0002Ah-DG
 for minios-devel@lists.xen.org; Tue, 18 Aug 2020 16:51:02 +0000
X-Inumbo-ID: ec79b1c6-c826-40ca-b60f-1c952db2ee10
Received: from hera.aquilenet.fr (unknown [185.233.100.1])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id ec79b1c6-c826-40ca-b60f-1c952db2ee10;
 Tue, 18 Aug 2020 16:51:00 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
 by hera.aquilenet.fr (Postfix) with ESMTP id 917E5375C;
 Tue, 18 Aug 2020 18:50:59 +0200 (CEST)
X-Virus-Scanned: Debian amavisd-new at aquilenet.fr
Received: from hera.aquilenet.fr ([127.0.0.1])
 by localhost (hera.aquilenet.fr [127.0.0.1]) (amavisd-new, port 10024)
 with ESMTP id VYddWbSAHa62; Tue, 18 Aug 2020 18:50:58 +0200 (CEST)
Received: from function (unknown [IPv6:2a01:cb19:956:1b00:9eb6:d0ff:fe88:c3c7])
 by hera.aquilenet.fr (Postfix) with ESMTPSA id BF226372F;
 Tue, 18 Aug 2020 18:50:58 +0200 (CEST)
Received: from samy by function with local (Exim 4.94)
 (envelope-from <samuel.thibault@ens-lyon.org>)
 id 1k84p8-0002NZ-3M; Tue, 18 Aug 2020 18:50:58 +0200
Date: Tue, 18 Aug 2020 18:50:58 +0200
From: Samuel Thibault <samuel.thibault@ens-lyon.org>
To: Costin Lupu <costin.lupu@cs.pub.ro>
Cc: minios-devel@lists.xen.org, wl@xen.org
Subject: Re: [PATCH] mini-os: netfront: Read netmask and gateway from Xenstore
Message-ID: <20200818165058.mi2mleiq5zeetorn@function>
Mail-Followup-To: Samuel Thibault <samuel.thibault@ens-lyon.org>,
 Costin Lupu <costin.lupu@cs.pub.ro>, minios-devel@lists.xen.org,
 wl@xen.org
References: <20200818134537.15422-1-costin.lupu@cs.pub.ro>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
Content-Transfer-Encoding: 8bit
In-Reply-To: <20200818134537.15422-1-costin.lupu@cs.pub.ro>
Organization: I am not organized
User-Agent: NeoMutt/20170609 (1.8.3)
X-BeenThere: minios-devel@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Mini-os development list <minios-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:minios-devel@lists.xenproject.org>
List-Help: <mailto:minios-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: minios-devel-bounces@lists.xenproject.org
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>

Thanks for this netmask+gateway support. However wondering:

Costin Lupu, le mar. 18 aoÃ»t 2020 16:45:37 +0300, a ecrit:
> The patch also makes the 'gw' variable global in order to be used by other
> source files when communication with the gateway is needed.

What is the use case here?

This really should be inside struct netfront_dev, and define a getter
for it. And along the way, added ip and mask similarly.

Samuel


From minios-devel-bounces@lists.xenproject.org Tue Aug 18 18:52:33 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Tue, 18 Aug 2020 18:52:33 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1k86ik-0004VN-FI; Tue, 18 Aug 2020 18:52:30 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=ZTf0=B4=cs.pub.ro=costin.lupu@srs-us1.protection.inumbo.net>)
 id 1k86ij-0004VI-9J
 for minios-devel@lists.xen.org; Tue, 18 Aug 2020 18:52:29 +0000
X-Inumbo-ID: 58de9d8e-7ffc-410b-84a3-ee795a4172de
Received: from mx.upb.ro (unknown [141.85.13.200])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 58de9d8e-7ffc-410b-84a3-ee795a4172de;
 Tue, 18 Aug 2020 18:52:27 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
 by mx.upb.ro (Postfix) with ESMTP id A2D44B561B2A;
 Tue, 18 Aug 2020 21:52:26 +0300 (EEST)
Received: from mx.upb.ro ([127.0.0.1])
 by localhost (mx.upb.ro [127.0.0.1]) (amavisd-new, port 10032)
 with ESMTP id sGVF_JfkgJBU; Tue, 18 Aug 2020 21:52:24 +0300 (EEST)
Received: from localhost (localhost [127.0.0.1])
 by mx.upb.ro (Postfix) with ESMTP id E33BBB561CCA;
 Tue, 18 Aug 2020 21:52:24 +0300 (EEST)
X-Virus-Scanned: amavisd-new at upb.ro
Received: from mx.upb.ro ([127.0.0.1])
 by localhost (mx.upb.ro [127.0.0.1]) (amavisd-new, port 10026)
 with ESMTP id y_zjznEFVBAQ; Tue, 18 Aug 2020 21:52:24 +0300 (EEST)
Received: from [192.168.1.35] (unknown [188.25.162.205])
 by mx.upb.ro (Postfix) with ESMTPSA id A5B1EB561B2A;
 Tue, 18 Aug 2020 21:52:24 +0300 (EEST)
Subject: Re: [PATCH] mini-os: netfront: Read netmask and gateway from Xenstore
To: Samuel Thibault <samuel.thibault@ens-lyon.org>,
 minios-devel@lists.xen.org, wl@xen.org
References: <20200818134537.15422-1-costin.lupu@cs.pub.ro>
 <20200818165058.mi2mleiq5zeetorn@function>
From: Costin Lupu <costin.lupu@cs.pub.ro>
Message-ID: <abcdbf83-978a-b829-e432-e6200ff49d3d@cs.pub.ro>
Date: Tue, 18 Aug 2020 21:52:24 +0300
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101
 Thunderbird/68.11.0
MIME-Version: 1.0
In-Reply-To: <20200818165058.mi2mleiq5zeetorn@function>
Content-Type: text/plain; charset=utf-8
Content-Language: en-US
Content-Transfer-Encoding: quoted-printable
X-BeenThere: minios-devel@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Mini-os development list <minios-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:minios-devel@lists.xenproject.org>
List-Help: <mailto:minios-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: minios-devel-bounces@lists.xenproject.org
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>

On 8/18/20 7:50 PM, Samuel Thibault wrote:
> Thanks for this netmask+gateway support. However wondering:
>=20
> Costin Lupu, le mar. 18 ao=C3=BBt 2020 16:45:37 +0300, a ecrit:
>> The patch also makes the 'gw' variable global in order to be used by o=
ther
>> source files when communication with the gateway is needed.
>=20
> What is the use case here?
>=20
> This really should be inside struct netfront_dev, and define a getter
> for it. And along the way, added ip and mask similarly.

Hi Samuel,

Thanks for your reviews.

Indeed, this change was squeezed here. I'll recreate the patch without it=
.

I needed to send an UDP message to the gateway and (this was some time
ago) I remember that for the other values you could query the lwip
stack, it had some functions for retrieving at least the IP. But you're
right, a solution with getters on netfront_dev would be cleaner. I'll
try to send a separate patch for that, but I don't promise. :-)

Cheers,
Costin


From minios-devel-bounces@lists.xenproject.org Wed Aug 19 12:49:17 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Wed, 19 Aug 2020 12:49:17 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1k8NWh-0005fG-AU; Wed, 19 Aug 2020 12:49:11 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=OlH4=B5=cs.pub.ro=costin.lupu@srs-us1.protection.inumbo.net>)
 id 1k8NWg-0005fB-QC
 for minios-devel@lists.xen.org; Wed, 19 Aug 2020 12:49:10 +0000
X-Inumbo-ID: 575a26ae-8c40-4ad7-848e-6524201881b1
Received: from mx.upb.ro (unknown [141.85.13.220])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 575a26ae-8c40-4ad7-848e-6524201881b1;
 Wed, 19 Aug 2020 12:49:08 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
 by mx.upb.ro (Postfix) with ESMTP id 1C320B560097;
 Wed, 19 Aug 2020 15:49:07 +0300 (EEST)
Received: from mx.upb.ro ([127.0.0.1])
 by localhost (mx.upb.ro [127.0.0.1]) (amavisd-new, port 10032)
 with ESMTP id Ivc9-6l2BtTp; Wed, 19 Aug 2020 15:49:04 +0300 (EEST)
Received: from localhost (localhost [127.0.0.1])
 by mx.upb.ro (Postfix) with ESMTP id 8D883B561CE0;
 Wed, 19 Aug 2020 15:49:04 +0300 (EEST)
X-Virus-Scanned: amavisd-new at upb.ro
Received: from mx.upb.ro ([127.0.0.1])
 by localhost (mx.upb.ro [127.0.0.1]) (amavisd-new, port 10026)
 with ESMTP id xLnTz_aXb4yr; Wed, 19 Aug 2020 15:49:04 +0300 (EEST)
Received: from localhost.localdomain (unknown [188.25.162.205])
 by mx.upb.ro (Postfix) with ESMTPSA id 480A5B560097;
 Wed, 19 Aug 2020 15:49:04 +0300 (EEST)
From: Costin Lupu <costin.lupu@cs.pub.ro>
To: minios-devel@lists.xen.org
Cc: samuel.thibault@ens-lyon.org,
	wl@xen.org
Subject: [PATCH v2] mini-os: netfront: Read netmask and gateway from Xenstore
Date: Wed, 19 Aug 2020 15:49:00 +0300
Message-Id: <20200819124900.21743-1-costin.lupu@cs.pub.ro>
X-Mailer: git-send-email 2.20.1
MIME-Version: 1.0
Content-Transfer-Encoding: quoted-printable
X-BeenThere: minios-devel@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Mini-os development list <minios-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:minios-devel@lists.xenproject.org>
List-Help: <mailto:minios-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: minios-devel-bounces@lists.xenproject.org
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>

When providing the IP address via the config file, one can also add the
netmask and gateway address, e.g. "ip=3D192.168.0.2 255.255.255.0
192.168.0.1", which will be further published to Xenstore. This patch add=
s
support for reading the netmask and gateway values.

Signed-off-by: Costin Lupu <costin.lupu@cs.pub.ro>
---
 include/netfront.h |  2 +-
 lwip-net.c         | 32 ++++++++++++++++++++++----------
 netfront.c         | 34 +++++++++++++++++++++++++++++-----
 3 files changed, 52 insertions(+), 16 deletions(-)

diff --git a/include/netfront.h b/include/netfront.h
index 1164d50..bc3080e 100644
--- a/include/netfront.h
+++ b/include/netfront.h
@@ -7,7 +7,7 @@ struct netfront_dev *init_netfront(char *nodename,
                                    void (*netif_rx)(unsigned char *data,
                                                     int len, void* arg),
                                    unsigned char rawmac[6],
-                                   char **ip);
+                                   char **ip, char **mask, char **gw);
 void netfront_xmit(struct netfront_dev *dev, unsigned char* data,int len=
);
 void shutdown_netfront(struct netfront_dev *dev);
 void suspend_netfront(void);
diff --git a/lwip-net.c b/lwip-net.c
index 449b70f..80d1c8f 100644
--- a/lwip-net.c
+++ b/lwip-net.c
@@ -343,22 +343,34 @@ void start_networking(void)
   struct ip_addr ipaddr =3D { htonl(IF_IPADDR) };
   struct ip_addr netmask =3D { htonl(IF_NETMASK) };
   struct ip_addr gw =3D { 0 };
-  char *ip =3D NULL;
+  char *ip =3D NULL, *netmask_str =3D NULL, *gw_str =3D NULL;
=20
   tprintk("Waiting for network.\n");
=20
-  dev =3D init_netfront(NULL, NULL, rawmac, &ip);
+  dev =3D init_netfront(NULL, NULL, rawmac, &ip, &netmask_str, &gw_str);
  =20
   if (ip) {
     ipaddr.addr =3D inet_addr(ip);
-    if (IN_CLASSA(ntohl(ipaddr.addr)))
-      netmask.addr =3D htonl(IN_CLASSA_NET);
-    else if (IN_CLASSB(ntohl(ipaddr.addr)))
-      netmask.addr =3D htonl(IN_CLASSB_NET);
-    else if (IN_CLASSC(ntohl(ipaddr.addr)))
-      netmask.addr =3D htonl(IN_CLASSC_NET);
-    else
-      tprintk("Strange IP %s, leaving netmask to 0.\n", ip);
+    free(ip);
+
+    if (netmask_str) {
+        netmask.addr =3D inet_addr(netmask_str);
+        free(netmask_str);
+    } else {
+        if (IN_CLASSA(ntohl(ipaddr.addr)))
+            netmask.addr =3D htonl(IN_CLASSA_NET);
+        else if (IN_CLASSB(ntohl(ipaddr.addr)))
+            netmask.addr =3D htonl(IN_CLASSB_NET);
+        else if (IN_CLASSC(ntohl(ipaddr.addr)))
+            netmask.addr =3D htonl(IN_CLASSC_NET);
+        else
+            tprintk("Strange IP %s, leaving netmask to 0.\n", ip);
+    }
+
+    if (gw_str) {
+        gw.addr =3D inet_addr(gw_str);
+        free(gw_str);
+    }
   }
   tprintk("IP %x netmask %x gateway %x.\n",
           ntohl(ipaddr.addr), ntohl(netmask.addr), ntohl(gw.addr));
diff --git a/netfront.c b/netfront.c
index 66f2bbc..58eb55e 100644
--- a/netfront.c
+++ b/netfront.c
@@ -71,6 +71,8 @@ struct netfront_dev_list {
     struct netfront_dev *dev;
     unsigned char rawmac[6];
     char *ip;
+    char *mask;
+    char *gw;
=20
     int refcount;
=20
@@ -81,7 +83,7 @@ static struct netfront_dev_list *dev_list =3D NULL;
=20
 void init_rx_buffers(struct netfront_dev *dev);
 static struct netfront_dev *_init_netfront(struct netfront_dev *dev,
-                                           unsigned char rawmac[6], char=
 **ip);
+                                           unsigned char rawmac[6], char=
 **ip, char **mask, char **gw);
 static void _shutdown_netfront(struct netfront_dev *dev);
 void netfront_set_rx_handler(struct netfront_dev *dev,
                              void (*thenetif_rx)(unsigned char *data, in=
t len,
@@ -301,7 +303,7 @@ struct netfront_dev *init_netfront(char *_nodename,
                                    void (*thenetif_rx)(unsigned char* da=
ta,
                                                        int len, void* ar=
g),
                                    unsigned char rawmac[6],
-                                   char **ip)
+                                   char **ip, char **mask, char **gw)
 {
     char nodename[256];
     struct netfront_dev *dev;
@@ -344,7 +346,7 @@ struct netfront_dev *init_netfront(char *_nodename,
     ldev =3D malloc(sizeof(struct netfront_dev_list));
     memset(ldev, 0, sizeof(struct netfront_dev_list));
=20
-    if (_init_netfront(dev, ldev->rawmac, &(ldev->ip))) {
+    if (_init_netfront(dev, ldev->rawmac, &(ldev->ip), &(ldev->mask), &(=
ldev->gw))) {
         ldev->dev =3D dev;
         ldev->refcount =3D 1;
         ldev->next =3D NULL;
@@ -374,6 +376,10 @@ out:
 	}
     if (ip)
         *ip =3D strdup(ldev->ip);
+    if (mask)
+        *mask =3D strdup(ldev->mask);
+    if (gw)
+        *gw =3D strdup(ldev->gw);
=20
 err:
     return dev;
@@ -381,7 +387,7 @@ err:
=20
 static struct netfront_dev *_init_netfront(struct netfront_dev *dev,
 					   unsigned char rawmac[6],
-					   char **ip)
+					   char **ip, char **mask, char **gw)
 {
     xenbus_transaction_t xbt;
     char* err =3D NULL;
@@ -518,8 +524,26 @@ done:
         }
=20
         if (ip) {
+            char *p;
+
             snprintf(path, sizeof(path), "%s/ip", dev->backend);
             xenbus_read(XBT_NIL, path, ip);
+
+            if (mask) {
+                p =3D strchr(*ip, ' ');
+                if (p) {
+                    *p++ =3D '\0';
+                    *mask =3D p;
+
+                    if (gw) {
+                        p =3D strchr(p, ' ');
+                        if (p) {
+                            *p++ =3D '\0';
+                            *gw =3D p;
+                        }
+                    }
+                }
+            }
         }
     }
=20
@@ -676,7 +700,7 @@ void resume_netfront(void)
     struct netfront_dev_list *list;
=20
     for (list =3D dev_list; list !=3D NULL; list =3D list->next)
-        _init_netfront(list->dev, NULL, NULL);
+        _init_netfront(list->dev, NULL, NULL, NULL, NULL);
 }
=20
 void init_rx_buffers(struct netfront_dev *dev)
--=20
2.20.1



From minios-devel-bounces@lists.xenproject.org Wed Aug 19 12:54:24 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Wed, 19 Aug 2020 12:54:24 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1k8Nbi-0006V4-2Y; Wed, 19 Aug 2020 12:54:22 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=hdrE=B5=ens-lyon.org=samuel.thibault@srs-us1.protection.inumbo.net>)
 id 1k8Nbg-0006Uz-JT
 for minios-devel@lists.xen.org; Wed, 19 Aug 2020 12:54:20 +0000
X-Inumbo-ID: 6c4524b2-86cf-467f-a1b4-0442534292b4
Received: from hera.aquilenet.fr (unknown [185.233.100.1])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 6c4524b2-86cf-467f-a1b4-0442534292b4;
 Wed, 19 Aug 2020 12:54:17 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
 by hera.aquilenet.fr (Postfix) with ESMTP id D4CF82C33;
 Wed, 19 Aug 2020 14:54:16 +0200 (CEST)
X-Virus-Scanned: Debian amavisd-new at aquilenet.fr
Received: from hera.aquilenet.fr ([127.0.0.1])
 by localhost (hera.aquilenet.fr [127.0.0.1]) (amavisd-new, port 10024)
 with ESMTP id J6AFlBm6w7XA; Wed, 19 Aug 2020 14:54:16 +0200 (CEST)
Received: from function (lfbn-bor-1-797-11.w86-234.abo.wanadoo.fr
 [86.234.239.11])
 by hera.aquilenet.fr (Postfix) with ESMTPSA id 1276B2A1D;
 Wed, 19 Aug 2020 14:54:15 +0200 (CEST)
Received: from samy by function with local (Exim 4.94)
 (envelope-from <samuel.thibault@ens-lyon.org>)
 id 1k8NZU-001FMM-LY; Wed, 19 Aug 2020 14:52:04 +0200
Date: Wed, 19 Aug 2020 14:52:04 +0200
From: Samuel Thibault <samuel.thibault@ens-lyon.org>
To: Costin Lupu <costin.lupu@cs.pub.ro>
Cc: minios-devel@lists.xen.org, wl@xen.org
Subject: Re: [PATCH v2] mini-os: netfront: Read netmask and gateway from
 Xenstore
Message-ID: <20200819125204.rkedhauadk6d4qz4@function>
Mail-Followup-To: Samuel Thibault <samuel.thibault@ens-lyon.org>,
 Costin Lupu <costin.lupu@cs.pub.ro>, minios-devel@lists.xen.org,
 wl@xen.org
References: <20200819124900.21743-1-costin.lupu@cs.pub.ro>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
Content-Transfer-Encoding: 8bit
In-Reply-To: <20200819124900.21743-1-costin.lupu@cs.pub.ro>
Organization: I am not organized
User-Agent: NeoMutt/20170609 (1.8.3)
X-BeenThere: minios-devel@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Mini-os development list <minios-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:minios-devel@lists.xenproject.org>
List-Help: <mailto:minios-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: minios-devel-bounces@lists.xenproject.org
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>

Costin Lupu, le mer. 19 aoÃ»t 2020 15:49:00 +0300, a ecrit:
> When providing the IP address via the config file, one can also add the
> netmask and gateway address, e.g. "ip=192.168.0.2 255.255.255.0
> 192.168.0.1", which will be further published to Xenstore. This patch adds
> support for reading the netmask and gateway values.
> 
> Signed-off-by: Costin Lupu <costin.lupu@cs.pub.ro>

Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>

> ---
>  include/netfront.h |  2 +-
>  lwip-net.c         | 32 ++++++++++++++++++++++----------
>  netfront.c         | 34 +++++++++++++++++++++++++++++-----
>  3 files changed, 52 insertions(+), 16 deletions(-)
> 
> diff --git a/include/netfront.h b/include/netfront.h
> index 1164d50..bc3080e 100644
> --- a/include/netfront.h
> +++ b/include/netfront.h
> @@ -7,7 +7,7 @@ struct netfront_dev *init_netfront(char *nodename,
>                                     void (*netif_rx)(unsigned char *data,
>                                                      int len, void* arg),
>                                     unsigned char rawmac[6],
> -                                   char **ip);
> +                                   char **ip, char **mask, char **gw);
>  void netfront_xmit(struct netfront_dev *dev, unsigned char* data,int len);
>  void shutdown_netfront(struct netfront_dev *dev);
>  void suspend_netfront(void);
> diff --git a/lwip-net.c b/lwip-net.c
> index 449b70f..80d1c8f 100644
> --- a/lwip-net.c
> +++ b/lwip-net.c
> @@ -343,22 +343,34 @@ void start_networking(void)
>    struct ip_addr ipaddr = { htonl(IF_IPADDR) };
>    struct ip_addr netmask = { htonl(IF_NETMASK) };
>    struct ip_addr gw = { 0 };
> -  char *ip = NULL;
> +  char *ip = NULL, *netmask_str = NULL, *gw_str = NULL;
>  
>    tprintk("Waiting for network.\n");
>  
> -  dev = init_netfront(NULL, NULL, rawmac, &ip);
> +  dev = init_netfront(NULL, NULL, rawmac, &ip, &netmask_str, &gw_str);
>    
>    if (ip) {
>      ipaddr.addr = inet_addr(ip);
> -    if (IN_CLASSA(ntohl(ipaddr.addr)))
> -      netmask.addr = htonl(IN_CLASSA_NET);
> -    else if (IN_CLASSB(ntohl(ipaddr.addr)))
> -      netmask.addr = htonl(IN_CLASSB_NET);
> -    else if (IN_CLASSC(ntohl(ipaddr.addr)))
> -      netmask.addr = htonl(IN_CLASSC_NET);
> -    else
> -      tprintk("Strange IP %s, leaving netmask to 0.\n", ip);
> +    free(ip);
> +
> +    if (netmask_str) {
> +        netmask.addr = inet_addr(netmask_str);
> +        free(netmask_str);
> +    } else {
> +        if (IN_CLASSA(ntohl(ipaddr.addr)))
> +            netmask.addr = htonl(IN_CLASSA_NET);
> +        else if (IN_CLASSB(ntohl(ipaddr.addr)))
> +            netmask.addr = htonl(IN_CLASSB_NET);
> +        else if (IN_CLASSC(ntohl(ipaddr.addr)))
> +            netmask.addr = htonl(IN_CLASSC_NET);
> +        else
> +            tprintk("Strange IP %s, leaving netmask to 0.\n", ip);
> +    }
> +
> +    if (gw_str) {
> +        gw.addr = inet_addr(gw_str);
> +        free(gw_str);
> +    }
>    }
>    tprintk("IP %x netmask %x gateway %x.\n",
>            ntohl(ipaddr.addr), ntohl(netmask.addr), ntohl(gw.addr));
> diff --git a/netfront.c b/netfront.c
> index 66f2bbc..58eb55e 100644
> --- a/netfront.c
> +++ b/netfront.c
> @@ -71,6 +71,8 @@ struct netfront_dev_list {
>      struct netfront_dev *dev;
>      unsigned char rawmac[6];
>      char *ip;
> +    char *mask;
> +    char *gw;
>  
>      int refcount;
>  
> @@ -81,7 +83,7 @@ static struct netfront_dev_list *dev_list = NULL;
>  
>  void init_rx_buffers(struct netfront_dev *dev);
>  static struct netfront_dev *_init_netfront(struct netfront_dev *dev,
> -                                           unsigned char rawmac[6], char **ip);
> +                                           unsigned char rawmac[6], char **ip, char **mask, char **gw);
>  static void _shutdown_netfront(struct netfront_dev *dev);
>  void netfront_set_rx_handler(struct netfront_dev *dev,
>                               void (*thenetif_rx)(unsigned char *data, int len,
> @@ -301,7 +303,7 @@ struct netfront_dev *init_netfront(char *_nodename,
>                                     void (*thenetif_rx)(unsigned char* data,
>                                                         int len, void* arg),
>                                     unsigned char rawmac[6],
> -                                   char **ip)
> +                                   char **ip, char **mask, char **gw)
>  {
>      char nodename[256];
>      struct netfront_dev *dev;
> @@ -344,7 +346,7 @@ struct netfront_dev *init_netfront(char *_nodename,
>      ldev = malloc(sizeof(struct netfront_dev_list));
>      memset(ldev, 0, sizeof(struct netfront_dev_list));
>  
> -    if (_init_netfront(dev, ldev->rawmac, &(ldev->ip))) {
> +    if (_init_netfront(dev, ldev->rawmac, &(ldev->ip), &(ldev->mask), &(ldev->gw))) {
>          ldev->dev = dev;
>          ldev->refcount = 1;
>          ldev->next = NULL;
> @@ -374,6 +376,10 @@ out:
>  	}
>      if (ip)
>          *ip = strdup(ldev->ip);
> +    if (mask)
> +        *mask = strdup(ldev->mask);
> +    if (gw)
> +        *gw = strdup(ldev->gw);
>  
>  err:
>      return dev;
> @@ -381,7 +387,7 @@ err:
>  
>  static struct netfront_dev *_init_netfront(struct netfront_dev *dev,
>  					   unsigned char rawmac[6],
> -					   char **ip)
> +					   char **ip, char **mask, char **gw)
>  {
>      xenbus_transaction_t xbt;
>      char* err = NULL;
> @@ -518,8 +524,26 @@ done:
>          }
>  
>          if (ip) {
> +            char *p;
> +
>              snprintf(path, sizeof(path), "%s/ip", dev->backend);
>              xenbus_read(XBT_NIL, path, ip);
> +
> +            if (mask) {
> +                p = strchr(*ip, ' ');
> +                if (p) {
> +                    *p++ = '\0';
> +                    *mask = p;
> +
> +                    if (gw) {
> +                        p = strchr(p, ' ');
> +                        if (p) {
> +                            *p++ = '\0';
> +                            *gw = p;
> +                        }
> +                    }
> +                }
> +            }
>          }
>      }
>  
> @@ -676,7 +700,7 @@ void resume_netfront(void)
>      struct netfront_dev_list *list;
>  
>      for (list = dev_list; list != NULL; list = list->next)
> -        _init_netfront(list->dev, NULL, NULL);
> +        _init_netfront(list->dev, NULL, NULL, NULL, NULL);
>  }
>  
>  void init_rx_buffers(struct netfront_dev *dev)
> -- 
> 2.20.1
> 

-- 
Samuel
"2 + 2 = 5 pour d'assez grandes valeurs de 2"


From minios-devel-bounces@lists.xenproject.org Wed Aug 19 13:01:25 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Wed, 19 Aug 2020 13:01:25 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1k8NiV-0007LV-Gv; Wed, 19 Aug 2020 13:01:23 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=OlH4=B5=cs.pub.ro=costin.lupu@srs-us1.protection.inumbo.net>)
 id 1k8NiU-0007LQ-9n
 for minios-devel@lists.xen.org; Wed, 19 Aug 2020 13:01:22 +0000
X-Inumbo-ID: 33f52887-3a39-459d-824a-0a80255f00c7
Received: from mx.upb.ro (unknown [141.85.13.220])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 33f52887-3a39-459d-824a-0a80255f00c7;
 Wed, 19 Aug 2020 13:01:21 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
 by mx.upb.ro (Postfix) with ESMTP id A45A2B561CCE;
 Wed, 19 Aug 2020 16:01:20 +0300 (EEST)
Received: from mx.upb.ro ([127.0.0.1])
 by localhost (mx.upb.ro [127.0.0.1]) (amavisd-new, port 10032)
 with ESMTP id M8QDj5_LgBX7; Wed, 19 Aug 2020 16:01:18 +0300 (EEST)
Received: from localhost (localhost [127.0.0.1])
 by mx.upb.ro (Postfix) with ESMTP id E22F1B561CE0;
 Wed, 19 Aug 2020 16:01:18 +0300 (EEST)
X-Virus-Scanned: amavisd-new at upb.ro
Received: from mx.upb.ro ([127.0.0.1])
 by localhost (mx.upb.ro [127.0.0.1]) (amavisd-new, port 10026)
 with ESMTP id E-e8NvZzNTbY; Wed, 19 Aug 2020 16:01:18 +0300 (EEST)
Received: from [192.168.1.35] (unknown [188.25.162.205])
 by mx.upb.ro (Postfix) with ESMTPSA id B23F1B561CCE;
 Wed, 19 Aug 2020 16:01:18 +0300 (EEST)
Subject: Re: [PATCH] mini-os: Use a single start_info_ptr variable
To: Samuel Thibault <samuel.thibault@ens-lyon.org>, minios-devel@lists.xen.org
References: <20200818134222.15081-1-costin.lupu@cs.pub.ro>
 <20200818164331.su32xlwf6b4pdw5w@function>
From: Costin Lupu <costin.lupu@cs.pub.ro>
Message-ID: <fe970860-91e4-ff97-f32a-8ddc8496fa7e@cs.pub.ro>
Date: Wed, 19 Aug 2020 16:01:18 +0300
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101
 Thunderbird/68.11.0
MIME-Version: 1.0
In-Reply-To: <20200818164331.su32xlwf6b4pdw5w@function>
Content-Type: text/plain; charset=utf-8
Content-Language: en-US
Content-Transfer-Encoding: quoted-printable
X-BeenThere: minios-devel@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Mini-os development list <minios-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:minios-devel@lists.xenproject.org>
List-Help: <mailto:minios-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: minios-devel-bounces@lists.xenproject.org
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>

On 8/18/20 7:43 PM, Samuel Thibault wrote:
> Costin Lupu, le mar. 18 ao=C3=BBt 2020 16:42:22 +0300, a ecrit:
>>  arch/x86/setup.c | 2 +-
>>  shutdown.c       | 4 ++--
>=20
> This would break the arm build, which does not have the start_info_ptr
> variable. That being said, shutdown.c doesn't seem like buildable on
> arm. I'd say not try to touch this code, and wait for ARM porters to fi=
x
> the start_info question, and then we can see how to factorize the
> variables.
>=20

Oops, my bad. :(

I guess we should move it to an arch-independent file. One example is
kernel.c where we have a similar scenario for `cmdline`, which is also
set in `arch/x86/setup.c`. And in `init_shutdown` it would be set only
if it wasn't set before, i.e. start_info_ptr =3D=3D 0 (which would happen
for ARM), or otherwise we would check that `si` parameter has the same
value as `start_info_ptr` (which would happen for x86).

If this is ok with you then I can prepare a patch.

Cheers,
Costin


From minios-devel-bounces@lists.xenproject.org Wed Aug 19 13:12:32 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Wed, 19 Aug 2020 13:12:32 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1k8NtF-0008Er-CC; Wed, 19 Aug 2020 13:12:29 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=hdrE=B5=ens-lyon.org=samuel.thibault@srs-us1.protection.inumbo.net>)
 id 1k8NtE-0008Em-0t
 for minios-devel@lists.xen.org; Wed, 19 Aug 2020 13:12:28 +0000
X-Inumbo-ID: cb453fc3-9fa8-438a-84b2-114859d50c20
Received: from hera.aquilenet.fr (unknown [2a0c:e300::1])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id cb453fc3-9fa8-438a-84b2-114859d50c20;
 Wed, 19 Aug 2020 13:12:26 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
 by hera.aquilenet.fr (Postfix) with ESMTP id 3BEA32C3E;
 Wed, 19 Aug 2020 15:12:25 +0200 (CEST)
X-Virus-Scanned: Debian amavisd-new at aquilenet.fr
Received: from hera.aquilenet.fr ([127.0.0.1])
 by localhost (hera.aquilenet.fr [127.0.0.1]) (amavisd-new, port 10024)
 with ESMTP id KpYFDr66Vi5A; Wed, 19 Aug 2020 15:12:24 +0200 (CEST)
Received: from function (lfbn-bor-1-797-11.w86-234.abo.wanadoo.fr
 [86.234.239.11])
 by hera.aquilenet.fr (Postfix) with ESMTPSA id 70BAC1518;
 Wed, 19 Aug 2020 15:12:24 +0200 (CEST)
Received: from samy by function with local (Exim 4.94)
 (envelope-from <samuel.thibault@ens-lyon.org>)
 id 1k8Nt9-001FyK-BK; Wed, 19 Aug 2020 15:12:23 +0200
Date: Wed, 19 Aug 2020 15:12:23 +0200
From: Samuel Thibault <samuel.thibault@ens-lyon.org>
To: Costin Lupu <costin.lupu@cs.pub.ro>
Cc: minios-devel@lists.xen.org
Subject: Re: [PATCH] mini-os: Use a single start_info_ptr variable
Message-ID: <20200819131223.dvnrgaqa2cvbo3ck@function>
Mail-Followup-To: Samuel Thibault <samuel.thibault@ens-lyon.org>,
 Costin Lupu <costin.lupu@cs.pub.ro>, minios-devel@lists.xen.org
References: <20200818134222.15081-1-costin.lupu@cs.pub.ro>
 <20200818164331.su32xlwf6b4pdw5w@function>
 <fe970860-91e4-ff97-f32a-8ddc8496fa7e@cs.pub.ro>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
Content-Transfer-Encoding: 8bit
In-Reply-To: <fe970860-91e4-ff97-f32a-8ddc8496fa7e@cs.pub.ro>
Organization: I am not organized
User-Agent: NeoMutt/20170609 (1.8.3)
X-BeenThere: minios-devel@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Mini-os development list <minios-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:minios-devel@lists.xenproject.org>
List-Help: <mailto:minios-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: minios-devel-bounces@lists.xenproject.org
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>

Costin Lupu, le mer. 19 aoÃ»t 2020 16:01:18 +0300, a ecrit:
> I guess we should move it to an arch-independent file. One example is
> kernel.c where we have a similar scenario for `cmdline`, which is also
> set in `arch/x86/setup.c`.

Indeed.

> And in `init_shutdown` it would be set only
> if it wasn't set before, i.e. start_info_ptr == 0 (which would happen
> for ARM), or otherwise we would check that `si` parameter has the same
> value as `start_info_ptr` (which would happen for x86).

I would say not to bother setting it again. You can actually remove the
parameter of init_shutdown, and of start_kernel as well.
892b661de6d79a768eb7def9489a80f0c7289f42 added, but without taking care
of arm. Arm porters will have to fix the HYPERVISOR_suspend() call
anyway, and possibly they don't even need start_info_ptr in their case,
so letting it to be NULL will be fine, if arm needs it at some point,
they will set it up in their setup.c

Samuel


From minios-devel-bounces@lists.xenproject.org Wed Aug 19 15:22:24 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Wed, 19 Aug 2020 15:22:24 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1k8Puv-0002vw-Q3; Wed, 19 Aug 2020 15:22:21 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=OlH4=B5=cs.pub.ro=costin.lupu@srs-us1.protection.inumbo.net>)
 id 1k8Puu-0002vr-Nf
 for minios-devel@lists.xen.org; Wed, 19 Aug 2020 15:22:20 +0000
X-Inumbo-ID: 22c94354-49f9-483d-9b25-9d2356a4023b
Received: from mx.upb.ro (unknown [141.85.13.200])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 22c94354-49f9-483d-9b25-9d2356a4023b;
 Wed, 19 Aug 2020 15:22:18 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
 by mx.upb.ro (Postfix) with ESMTP id 53624B561CBD;
 Wed, 19 Aug 2020 18:22:17 +0300 (EEST)
Received: from mx.upb.ro ([127.0.0.1])
 by localhost (mx.upb.ro [127.0.0.1]) (amavisd-new, port 10032)
 with ESMTP id wYQYd8vovK-v; Wed, 19 Aug 2020 18:22:15 +0300 (EEST)
Received: from localhost (localhost [127.0.0.1])
 by mx.upb.ro (Postfix) with ESMTP id F0D05B561CED;
 Wed, 19 Aug 2020 18:22:14 +0300 (EEST)
X-Virus-Scanned: amavisd-new at upb.ro
Received: from mx.upb.ro ([127.0.0.1])
 by localhost (mx.upb.ro [127.0.0.1]) (amavisd-new, port 10026)
 with ESMTP id xzpfKTGrHkSK; Wed, 19 Aug 2020 18:22:14 +0300 (EEST)
Received: from [192.168.1.35] (unknown [188.25.162.205])
 by mx.upb.ro (Postfix) with ESMTPSA id BEF02B561CBD;
 Wed, 19 Aug 2020 18:22:14 +0300 (EEST)
Subject: Re: [PATCH] mini-os: Use a single start_info_ptr variable
To: Samuel Thibault <samuel.thibault@ens-lyon.org>, minios-devel@lists.xen.org
References: <20200818134222.15081-1-costin.lupu@cs.pub.ro>
 <20200818164331.su32xlwf6b4pdw5w@function>
 <fe970860-91e4-ff97-f32a-8ddc8496fa7e@cs.pub.ro>
 <20200819131223.dvnrgaqa2cvbo3ck@function>
From: Costin Lupu <costin.lupu@cs.pub.ro>
Message-ID: <6ef9cb5e-966d-8f62-499e-50814a59f93a@cs.pub.ro>
Date: Wed, 19 Aug 2020 18:22:14 +0300
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101
 Thunderbird/68.11.0
MIME-Version: 1.0
In-Reply-To: <20200819131223.dvnrgaqa2cvbo3ck@function>
Content-Type: text/plain; charset=utf-8
Content-Language: en-US
Content-Transfer-Encoding: quoted-printable
X-BeenThere: minios-devel@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Mini-os development list <minios-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:minios-devel@lists.xenproject.org>
List-Help: <mailto:minios-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: minios-devel-bounces@lists.xenproject.org
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>

On 8/19/20 4:12 PM, Samuel Thibault wrote:
> Costin Lupu, le mer. 19 ao=C3=BBt 2020 16:01:18 +0300, a ecrit:
>> I guess we should move it to an arch-independent file. One example is
>> kernel.c where we have a similar scenario for `cmdline`, which is also
>> set in `arch/x86/setup.c`.
>=20
> Indeed.
>=20
>> And in `init_shutdown` it would be set only
>> if it wasn't set before, i.e. start_info_ptr =3D=3D 0 (which would hap=
pen
>> for ARM), or otherwise we would check that `si` parameter has the same
>> value as `start_info_ptr` (which would happen for x86).
>=20
> I would say not to bother setting it again. You can actually remove the
> parameter of init_shutdown, and of start_kernel as well.
> 892b661de6d79a768eb7def9489a80f0c7289f42 added, but without taking care
> of arm. Arm porters will have to fix the HYPERVISOR_suspend() call
> anyway, and possibly they don't even need start_info_ptr in their case,
> so letting it to be NULL will be fine, if arm needs it at some point,
> they will set it up in their setup.c

After looking on that commit I remembered that it tried to port the
changes from NEC's mini-os fork [1], which was intended to work only on
x86 (the fork doesn't have an `arch/arm` directory). Moreover,
start_info structure is defined only for PV guests in `xen.h`, so
because of this I think it makes more sense to keep it in
`arch/x86/setup.c`.

The problem that remains is that the logic in `shutdown.c`, which should
be arch-independent, uses start_info_ptr but it shouldn't. We can fix
this by adding an `arch_suspend()` function which would call the
hypercall on x86 and would be empty on ARM.

However, I tried to build mini-os for ARM but I couldn't. The command I
used on Debian is:

$ make -j32 CROSS_COMPILE=3Darm-linux-gnueabihf- MINIOS_TARGET_ARCH=3Darm
Config.mk:99: arch/arm/arch.mk: No such file or directory

It looks like the ARM build has bigger problems. :-) Anyway, for the
patch I will send I'm gonna leave the HYPERVISOR_suspend() hypercall in
shutdown.c as you advised.


[1] https://github.com/sysml/mini-os

Cheers,
Costin


From minios-devel-bounces@lists.xenproject.org Wed Aug 19 15:35:34 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Wed, 19 Aug 2020 15:35:34 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1k8Q7c-0003rs-Om; Wed, 19 Aug 2020 15:35:28 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=hdrE=B5=ens-lyon.org=samuel.thibault@srs-us1.protection.inumbo.net>)
 id 1k8Q7b-0003rn-Di
 for minios-devel@lists.xen.org; Wed, 19 Aug 2020 15:35:27 +0000
X-Inumbo-ID: 18793cd2-45ed-4501-b4c5-834571895093
Received: from hera.aquilenet.fr (unknown [2a0c:e300::1])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 18793cd2-45ed-4501-b4c5-834571895093;
 Wed, 19 Aug 2020 15:35:25 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
 by hera.aquilenet.fr (Postfix) with ESMTP id 5C468114F;
 Wed, 19 Aug 2020 17:35:24 +0200 (CEST)
X-Virus-Scanned: Debian amavisd-new at aquilenet.fr
Received: from hera.aquilenet.fr ([127.0.0.1])
 by localhost (hera.aquilenet.fr [127.0.0.1]) (amavisd-new, port 10024)
 with ESMTP id 0GYmcG_7_t16; Wed, 19 Aug 2020 17:35:23 +0200 (CEST)
Received: from function (lfbn-bor-1-797-11.w86-234.abo.wanadoo.fr
 [86.234.239.11])
 by hera.aquilenet.fr (Postfix) with ESMTPSA id 9D2BD1131;
 Wed, 19 Aug 2020 17:35:23 +0200 (CEST)
Received: from samy by function with local (Exim 4.94)
 (envelope-from <samuel.thibault@ens-lyon.org>)
 id 1k8Q7W-001mzF-NG; Wed, 19 Aug 2020 17:35:22 +0200
Date: Wed, 19 Aug 2020 17:35:22 +0200
From: Samuel Thibault <samuel.thibault@ens-lyon.org>
To: Costin Lupu <costin.lupu@cs.pub.ro>
Cc: minios-devel@lists.xen.org
Subject: Re: [PATCH] mini-os: Use a single start_info_ptr variable
Message-ID: <20200819153522.fhzvabtuoyfovelx@function>
Mail-Followup-To: Samuel Thibault <samuel.thibault@ens-lyon.org>,
 Costin Lupu <costin.lupu@cs.pub.ro>, minios-devel@lists.xen.org
References: <20200818134222.15081-1-costin.lupu@cs.pub.ro>
 <20200818164331.su32xlwf6b4pdw5w@function>
 <fe970860-91e4-ff97-f32a-8ddc8496fa7e@cs.pub.ro>
 <20200819131223.dvnrgaqa2cvbo3ck@function>
 <6ef9cb5e-966d-8f62-499e-50814a59f93a@cs.pub.ro>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
Content-Transfer-Encoding: 8bit
In-Reply-To: <6ef9cb5e-966d-8f62-499e-50814a59f93a@cs.pub.ro>
Organization: I am not organized
User-Agent: NeoMutt/20170609 (1.8.3)
X-BeenThere: minios-devel@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Mini-os development list <minios-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:minios-devel@lists.xenproject.org>
List-Help: <mailto:minios-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: minios-devel-bounces@lists.xenproject.org
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>

Costin Lupu, le mer. 19 aoÃ»t 2020 18:22:14 +0300, a ecrit:
> The problem that remains is that the logic in `shutdown.c`, which should
> be arch-independent, uses start_info_ptr but it shouldn't. We can fix
> this by adding an `arch_suspend()` function which would call the
> hypercall on x86

Possibly, yes.

> and would be empty on ARM.

I would rather say to abort()?  We don't want to silently ignore that
something is still to be implemented.

> However, I tried to build mini-os for ARM but I couldn't. The command I
> used on Debian is:
> 
> $ make -j32 CROSS_COMPILE=arm-linux-gnueabihf- MINIOS_TARGET_ARCH=arm
> Config.mk:99: arch/arm/arch.mk: No such file or directory

Uh :)

> It looks like the ARM build has bigger problems. :-) Anyway, for the
> patch I will send I'm gonna leave the HYPERVISOR_suspend() hypercall in
> shutdown.c as you advised.

Yes, that should be fine enough for porters to patch over.

Samuel


From minios-devel-bounces@lists.xenproject.org Wed Aug 19 15:45:48 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Wed, 19 Aug 2020 15:45:48 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1k8QHZ-0004jO-GS; Wed, 19 Aug 2020 15:45:45 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=OlH4=B5=cs.pub.ro=costin.lupu@srs-us1.protection.inumbo.net>)
 id 1k8QHY-0004jJ-K0
 for minios-devel@lists.xen.org; Wed, 19 Aug 2020 15:45:44 +0000
X-Inumbo-ID: 96fa5bae-80fd-421d-af3c-516a6b996050
Received: from mx.upb.ro (unknown [141.85.13.200])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 96fa5bae-80fd-421d-af3c-516a6b996050;
 Wed, 19 Aug 2020 15:45:43 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
 by mx.upb.ro (Postfix) with ESMTP id 467A4B561CE0;
 Wed, 19 Aug 2020 18:45:42 +0300 (EEST)
Received: from mx.upb.ro ([127.0.0.1])
 by localhost (mx.upb.ro [127.0.0.1]) (amavisd-new, port 10032)
 with ESMTP id uH8s27PiefnI; Wed, 19 Aug 2020 18:45:40 +0300 (EEST)
Received: from localhost (localhost [127.0.0.1])
 by mx.upb.ro (Postfix) with ESMTP id 0E16CB561CF5;
 Wed, 19 Aug 2020 18:45:40 +0300 (EEST)
X-Virus-Scanned: amavisd-new at upb.ro
Received: from mx.upb.ro ([127.0.0.1])
 by localhost (mx.upb.ro [127.0.0.1]) (amavisd-new, port 10026)
 with ESMTP id ni8LGhyCJGvd; Wed, 19 Aug 2020 18:45:39 +0300 (EEST)
Received: from localhost.localdomain (unknown [188.25.162.205])
 by mx.upb.ro (Postfix) with ESMTPSA id C498FB561CE0;
 Wed, 19 Aug 2020 18:45:39 +0300 (EEST)
From: Costin Lupu <costin.lupu@cs.pub.ro>
To: minios-devel@lists.xen.org
Cc: samuel.thibault@ens-lyon.org,
	wl@xen.org
Subject: [PATCH v2] mini-os: Use a single start_info_ptr variable
Date: Wed, 19 Aug 2020 18:45:36 +0300
Message-Id: <20200819154536.20753-1-costin.lupu@cs.pub.ro>
X-Mailer: git-send-email 2.20.1
MIME-Version: 1.0
Content-Transfer-Encoding: quoted-printable
X-BeenThere: minios-devel@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Mini-os development list <minios-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:minios-devel@lists.xenproject.org>
List-Help: <mailto:minios-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: minios-devel-bounces@lists.xenproject.org
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>

The second definition of the `start_info_ptr` variable was introduced by =
commit
e05eb0 which was part of a series trying to add suspend/resume support to
mini-os. This patch removes the second definition by reverting some chang=
es of
the mentioned commit and of commit 892b66.

However the logic in shutdown.c is still left in an inconsistent state be=
cause
it still doesn't work for ARM. The solution should be part of a future pa=
tch.

Signed-off-by: Costin Lupu <costin.lupu@cs.pub.ro>
---
 arch/x86/setup.c   | 4 ++--
 include/kernel.h   | 2 +-
 include/shutdown.h | 2 +-
 kernel.c           | 4 ++--
 shutdown.c         | 8 ++++----
 5 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/arch/x86/setup.c b/arch/x86/setup.c
index 4fd8e39..64b22c5 100644
--- a/arch/x86/setup.c
+++ b/arch/x86/setup.c
@@ -45,7 +45,7 @@ union start_info_union start_info_union;
 /*
  * This pointer holds a reference to the copy of the start_info struct.
  */
-static start_info_t *start_info_ptr;
+start_info_t *start_info_ptr;
=20
 /*
  * Shared page for communicating with the hypervisor.
@@ -221,7 +221,7 @@ arch_init(void *par)
 #endif
 	start_info_ptr =3D (start_info_t *)par;
=20
-	start_kernel((start_info_t *)par);
+	start_kernel();
 }
=20
 void arch_pre_suspend(void)
diff --git a/include/kernel.h b/include/kernel.h
index 742abf5..161d757 100644
--- a/include/kernel.h
+++ b/include/kernel.h
@@ -4,7 +4,7 @@
 #define MAX_CMDLINE_SIZE 1024
 extern char cmdline[MAX_CMDLINE_SIZE];
=20
-void start_kernel(void* par);
+void start_kernel(void);
 void pre_suspend(void);
 void post_suspend(int canceled);
 void do_exit(void) __attribute__((noreturn));
diff --git a/include/shutdown.h b/include/shutdown.h
index 88993cb..ba71aeb 100644
--- a/include/shutdown.h
+++ b/include/shutdown.h
@@ -3,7 +3,7 @@
=20
 #include <mini-os/hypervisor.h>
=20
-void init_shutdown(start_info_t *si);
+void init_shutdown(void);
 void fini_shutdown(void);
 void kernel_suspend(void);
=20
diff --git a/kernel.c b/kernel.c
index 301273d..1f97d8d 100644
--- a/kernel.c
+++ b/kernel.c
@@ -77,7 +77,7 @@ __attribute__((weak)) int app_main(void *p)
     return 0;
 }
=20
-void start_kernel(void* par)
+void start_kernel(void)
 {
     /* Set up events. */
     init_events();
@@ -107,7 +107,7 @@ void start_kernel(void* par)
=20
 #ifdef CONFIG_XENBUS
     /* Init shutdown thread */
-    init_shutdown((start_info_t *)par);
+    init_shutdown();
 #endif
=20
     /* Call (possibly overridden) app_main() */
diff --git a/shutdown.c b/shutdown.c
index 4c0b13c..0854670 100644
--- a/shutdown.c
+++ b/shutdown.c
@@ -46,7 +46,7 @@
 #include <mini-os/xmalloc.h>
=20
=20
-static start_info_t *start_info_ptr;
+extern start_info_t *start_info_ptr;
=20
 #ifdef CONFIG_XENBUS
 static const char *path =3D "control/shutdown";
@@ -111,10 +111,8 @@ static void shutdown_thread(void *p)
     }
 }
=20
-void init_shutdown(start_info_t *si)
+void init_shutdown(void)
 {
-    start_info_ptr =3D si;
-
     end_shutdown_thread =3D 0;
     create_thread("shutdown", shutdown_thread, NULL);
 }
@@ -145,6 +143,8 @@ void kernel_suspend(void)
     /*
      * This hypercall returns 1 if the suspend
      * was cancelled and 0 if resuming in a new domain
+     *
+     * TODO Fix this for ARM
      */
     rc =3D HYPERVISOR_suspend(virt_to_mfn(start_info_ptr));
=20
--=20
2.20.1



From minios-devel-bounces@lists.xenproject.org Wed Aug 19 15:50:33 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Wed, 19 Aug 2020 15:50:33 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1k8QMA-0005X1-TI; Wed, 19 Aug 2020 15:50:30 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=hdrE=B5=ens-lyon.org=samuel.thibault@srs-us1.protection.inumbo.net>)
 id 1k8QM9-0005Ww-Uj
 for minios-devel@lists.xen.org; Wed, 19 Aug 2020 15:50:29 +0000
X-Inumbo-ID: d459880d-be66-4b89-8f41-cca2087d45de
Received: from hera.aquilenet.fr (unknown [185.233.100.1])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id d459880d-be66-4b89-8f41-cca2087d45de;
 Wed, 19 Aug 2020 15:50:28 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
 by hera.aquilenet.fr (Postfix) with ESMTP id 78B311192;
 Wed, 19 Aug 2020 17:50:27 +0200 (CEST)
X-Virus-Scanned: Debian amavisd-new at aquilenet.fr
Received: from hera.aquilenet.fr ([127.0.0.1])
 by localhost (hera.aquilenet.fr [127.0.0.1]) (amavisd-new, port 10024)
 with ESMTP id P-1xu927LmT3; Wed, 19 Aug 2020 17:50:26 +0200 (CEST)
Received: from function (lfbn-bor-1-797-11.w86-234.abo.wanadoo.fr
 [86.234.239.11])
 by hera.aquilenet.fr (Postfix) with ESMTPSA id D47BBD74;
 Wed, 19 Aug 2020 17:50:26 +0200 (CEST)
Received: from samy by function with local (Exim 4.94)
 (envelope-from <samuel.thibault@ens-lyon.org>)
 id 1k8QM5-001nKQ-RO; Wed, 19 Aug 2020 17:50:25 +0200
Date: Wed, 19 Aug 2020 17:50:25 +0200
From: Samuel Thibault <samuel.thibault@ens-lyon.org>
To: Costin Lupu <costin.lupu@cs.pub.ro>
Cc: minios-devel@lists.xen.org, wl@xen.org
Subject: Re: [PATCH v2] mini-os: Use a single start_info_ptr variable
Message-ID: <20200819155025.uqxmyyyvvvv6naut@function>
Mail-Followup-To: Samuel Thibault <samuel.thibault@ens-lyon.org>,
 Costin Lupu <costin.lupu@cs.pub.ro>, minios-devel@lists.xen.org,
 wl@xen.org
References: <20200819154536.20753-1-costin.lupu@cs.pub.ro>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
Content-Transfer-Encoding: 8bit
In-Reply-To: <20200819154536.20753-1-costin.lupu@cs.pub.ro>
Organization: I am not organized
User-Agent: NeoMutt/20170609 (1.8.3)
X-BeenThere: minios-devel@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Mini-os development list <minios-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:minios-devel@lists.xenproject.org>
List-Help: <mailto:minios-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: minios-devel-bounces@lists.xenproject.org
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>

Costin Lupu, le mer. 19 aoÃ»t 2020 18:45:36 +0300, a ecrit:
> +++ b/shutdown.c
> @@ -46,7 +46,7 @@
>  #include <mini-os/xmalloc.h>
>  
>  
> -static start_info_t *start_info_ptr;
> +extern start_info_t *start_info_ptr;

Please rather put the declaration in include/kernel.h

Samuel


From minios-devel-bounces@lists.xenproject.org Wed Aug 19 16:03:59 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Wed, 19 Aug 2020 16:03:59 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1k8QZC-0007fE-H0; Wed, 19 Aug 2020 16:03:58 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=OlH4=B5=cs.pub.ro=costin.lupu@srs-us1.protection.inumbo.net>)
 id 1k8QZB-0007b4-0b
 for minios-devel@lists.xen.org; Wed, 19 Aug 2020 16:03:57 +0000
X-Inumbo-ID: 35827ede-568a-4de2-bff6-ed7d925954cb
Received: from mx.upb.ro (unknown [141.85.13.200])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 35827ede-568a-4de2-bff6-ed7d925954cb;
 Wed, 19 Aug 2020 16:03:56 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
 by mx.upb.ro (Postfix) with ESMTP id 63C4FB561CBD;
 Wed, 19 Aug 2020 19:03:55 +0300 (EEST)
Received: from mx.upb.ro ([127.0.0.1])
 by localhost (mx.upb.ro [127.0.0.1]) (amavisd-new, port 10032)
 with ESMTP id Zm0yF9ICLmnO; Wed, 19 Aug 2020 19:03:53 +0300 (EEST)
Received: from localhost (localhost [127.0.0.1])
 by mx.upb.ro (Postfix) with ESMTP id 02C98B561CED;
 Wed, 19 Aug 2020 19:03:51 +0300 (EEST)
X-Virus-Scanned: amavisd-new at upb.ro
Received: from mx.upb.ro ([127.0.0.1])
 by localhost (mx.upb.ro [127.0.0.1]) (amavisd-new, port 10026)
 with ESMTP id g_w_RwBjd_7U; Wed, 19 Aug 2020 19:03:50 +0300 (EEST)
Received: from [192.168.1.35] (unknown [188.25.162.205])
 by mx.upb.ro (Postfix) with ESMTPSA id A47B0B561CF5;
 Wed, 19 Aug 2020 19:03:50 +0300 (EEST)
Subject: Re: [PATCH v2] mini-os: Use a single start_info_ptr variable
To: Samuel Thibault <samuel.thibault@ens-lyon.org>,
 minios-devel@lists.xen.org, wl@xen.org
References: <20200819154536.20753-1-costin.lupu@cs.pub.ro>
 <20200819155025.uqxmyyyvvvv6naut@function>
From: Costin Lupu <costin.lupu@cs.pub.ro>
Message-ID: <dd3bd363-6a1d-eddd-d12a-031b334a0983@cs.pub.ro>
Date: Wed, 19 Aug 2020 19:03:50 +0300
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101
 Thunderbird/68.11.0
MIME-Version: 1.0
In-Reply-To: <20200819155025.uqxmyyyvvvv6naut@function>
Content-Type: text/plain; charset=utf-8
Content-Language: en-US
Content-Transfer-Encoding: quoted-printable
X-BeenThere: minios-devel@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Mini-os development list <minios-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:minios-devel@lists.xenproject.org>
List-Help: <mailto:minios-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: minios-devel-bounces@lists.xenproject.org
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>

On 8/19/20 6:50 PM, Samuel Thibault wrote:
> Costin Lupu, le mer. 19 ao=C3=BBt 2020 18:45:36 +0300, a ecrit:
>> +++ b/shutdown.c
>> @@ -46,7 +46,7 @@
>>  #include <mini-os/xmalloc.h>
>> =20
>> =20
>> -static start_info_t *start_info_ptr;
>> +extern start_info_t *start_info_ptr;
>=20
> Please rather put the declaration in include/kernel.h

How about we leave this one as it is and I send a new patch depending on
this one introducing the `arch_suspend()` function I was mentioning in a
previous email? This way we will get rid of the declaration from
`shutdown.c`.

My concern is that if we move the declaration to `kernel.h` then the
"message" will be that it is a variable that can be used freely,
regardless the architecture.

Costin


From minios-devel-bounces@lists.xenproject.org Wed Aug 19 16:08:01 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Wed, 19 Aug 2020 16:08:01 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1k8Qd3-0007yP-SM; Wed, 19 Aug 2020 16:07:57 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=hdrE=B5=ens-lyon.org=samuel.thibault@srs-us1.protection.inumbo.net>)
 id 1k8Qd2-0007yK-2P
 for minios-devel@lists.xen.org; Wed, 19 Aug 2020 16:07:56 +0000
X-Inumbo-ID: ad495db5-423b-4640-9cc1-65aafae29b7e
Received: from hera.aquilenet.fr (unknown [185.233.100.1])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id ad495db5-423b-4640-9cc1-65aafae29b7e;
 Wed, 19 Aug 2020 16:07:54 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
 by hera.aquilenet.fr (Postfix) with ESMTP id 463F6368A;
 Wed, 19 Aug 2020 18:07:53 +0200 (CEST)
X-Virus-Scanned: Debian amavisd-new at aquilenet.fr
Received: from hera.aquilenet.fr ([127.0.0.1])
 by localhost (hera.aquilenet.fr [127.0.0.1]) (amavisd-new, port 10024)
 with ESMTP id nRc3TRh_PxNQ; Wed, 19 Aug 2020 18:07:52 +0200 (CEST)
Received: from function (lfbn-bor-1-797-11.w86-234.abo.wanadoo.fr
 [86.234.239.11])
 by hera.aquilenet.fr (Postfix) with ESMTPSA id 30FF135E9;
 Wed, 19 Aug 2020 18:07:52 +0200 (CEST)
Received: from samy by function with local (Exim 4.94)
 (envelope-from <samuel.thibault@ens-lyon.org>)
 id 1k8Qcx-001o1U-6c; Wed, 19 Aug 2020 18:07:51 +0200
Date: Wed, 19 Aug 2020 18:07:51 +0200
From: Samuel Thibault <samuel.thibault@ens-lyon.org>
To: Costin Lupu <costin.lupu@cs.pub.ro>
Cc: minios-devel@lists.xen.org, wl@xen.org
Subject: Re: [PATCH v2] mini-os: Use a single start_info_ptr variable
Message-ID: <20200819160751.puvml7gxkxt4ftas@function>
Mail-Followup-To: Samuel Thibault <samuel.thibault@ens-lyon.org>,
 Costin Lupu <costin.lupu@cs.pub.ro>, minios-devel@lists.xen.org,
 wl@xen.org
References: <20200819154536.20753-1-costin.lupu@cs.pub.ro>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
Content-Transfer-Encoding: 8bit
In-Reply-To: <20200819154536.20753-1-costin.lupu@cs.pub.ro>
Organization: I am not organized
User-Agent: NeoMutt/20170609 (1.8.3)
X-BeenThere: minios-devel@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Mini-os development list <minios-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:minios-devel@lists.xenproject.org>
List-Help: <mailto:minios-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: minios-devel-bounces@lists.xenproject.org
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>

Costin Lupu, le mer. 19 aoÃ»t 2020 18:45:36 +0300, a ecrit:
> The second definition of the `start_info_ptr` variable was introduced by commit
> e05eb0 which was part of a series trying to add suspend/resume support to
> mini-os. This patch removes the second definition by reverting some changes of
> the mentioned commit and of commit 892b66.
> 
> However the logic in shutdown.c is still left in an inconsistent state because
> it still doesn't work for ARM. The solution should be part of a future patch.
> 
> Signed-off-by: Costin Lupu <costin.lupu@cs.pub.ro>

Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>

> ---
>  arch/x86/setup.c   | 4 ++--
>  include/kernel.h   | 2 +-
>  include/shutdown.h | 2 +-
>  kernel.c           | 4 ++--
>  shutdown.c         | 8 ++++----
>  5 files changed, 10 insertions(+), 10 deletions(-)
> 
> diff --git a/arch/x86/setup.c b/arch/x86/setup.c
> index 4fd8e39..64b22c5 100644
> --- a/arch/x86/setup.c
> +++ b/arch/x86/setup.c
> @@ -45,7 +45,7 @@ union start_info_union start_info_union;
>  /*
>   * This pointer holds a reference to the copy of the start_info struct.
>   */
> -static start_info_t *start_info_ptr;
> +start_info_t *start_info_ptr;
>  
>  /*
>   * Shared page for communicating with the hypervisor.
> @@ -221,7 +221,7 @@ arch_init(void *par)
>  #endif
>  	start_info_ptr = (start_info_t *)par;
>  
> -	start_kernel((start_info_t *)par);
> +	start_kernel();
>  }
>  
>  void arch_pre_suspend(void)
> diff --git a/include/kernel.h b/include/kernel.h
> index 742abf5..161d757 100644
> --- a/include/kernel.h
> +++ b/include/kernel.h
> @@ -4,7 +4,7 @@
>  #define MAX_CMDLINE_SIZE 1024
>  extern char cmdline[MAX_CMDLINE_SIZE];
>  
> -void start_kernel(void* par);
> +void start_kernel(void);
>  void pre_suspend(void);
>  void post_suspend(int canceled);
>  void do_exit(void) __attribute__((noreturn));
> diff --git a/include/shutdown.h b/include/shutdown.h
> index 88993cb..ba71aeb 100644
> --- a/include/shutdown.h
> +++ b/include/shutdown.h
> @@ -3,7 +3,7 @@
>  
>  #include <mini-os/hypervisor.h>
>  
> -void init_shutdown(start_info_t *si);
> +void init_shutdown(void);
>  void fini_shutdown(void);
>  void kernel_suspend(void);
>  
> diff --git a/kernel.c b/kernel.c
> index 301273d..1f97d8d 100644
> --- a/kernel.c
> +++ b/kernel.c
> @@ -77,7 +77,7 @@ __attribute__((weak)) int app_main(void *p)
>      return 0;
>  }
>  
> -void start_kernel(void* par)
> +void start_kernel(void)
>  {
>      /* Set up events. */
>      init_events();
> @@ -107,7 +107,7 @@ void start_kernel(void* par)
>  
>  #ifdef CONFIG_XENBUS
>      /* Init shutdown thread */
> -    init_shutdown((start_info_t *)par);
> +    init_shutdown();
>  #endif
>  
>      /* Call (possibly overridden) app_main() */
> diff --git a/shutdown.c b/shutdown.c
> index 4c0b13c..0854670 100644
> --- a/shutdown.c
> +++ b/shutdown.c
> @@ -46,7 +46,7 @@
>  #include <mini-os/xmalloc.h>
>  
>  
> -static start_info_t *start_info_ptr;
> +extern start_info_t *start_info_ptr;
>  
>  #ifdef CONFIG_XENBUS
>  static const char *path = "control/shutdown";
> @@ -111,10 +111,8 @@ static void shutdown_thread(void *p)
>      }
>  }
>  
> -void init_shutdown(start_info_t *si)
> +void init_shutdown(void)
>  {
> -    start_info_ptr = si;
> -
>      end_shutdown_thread = 0;
>      create_thread("shutdown", shutdown_thread, NULL);
>  }
> @@ -145,6 +143,8 @@ void kernel_suspend(void)
>      /*
>       * This hypercall returns 1 if the suspend
>       * was cancelled and 0 if resuming in a new domain
> +     *
> +     * TODO Fix this for ARM
>       */
>      rc = HYPERVISOR_suspend(virt_to_mfn(start_info_ptr));
>  
> -- 
> 2.20.1
> 



From minios-devel-bounces@lists.xenproject.org Wed Aug 19 16:08:25 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Wed, 19 Aug 2020 16:08:25 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1k8QdT-0007zm-V7; Wed, 19 Aug 2020 16:08:23 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=hdrE=B5=ens-lyon.org=samuel.thibault@srs-us1.protection.inumbo.net>)
 id 1k8QdT-0007zh-KT
 for minios-devel@lists.xen.org; Wed, 19 Aug 2020 16:08:23 +0000
X-Inumbo-ID: 95d3379b-db23-4811-83aa-7268c4d2d84a
Received: from hera.aquilenet.fr (unknown [2a0c:e300::1])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 95d3379b-db23-4811-83aa-7268c4d2d84a;
 Wed, 19 Aug 2020 16:08:22 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
 by hera.aquilenet.fr (Postfix) with ESMTP id 6E5CB368A;
 Wed, 19 Aug 2020 18:08:21 +0200 (CEST)
X-Virus-Scanned: Debian amavisd-new at aquilenet.fr
Received: from hera.aquilenet.fr ([127.0.0.1])
 by localhost (hera.aquilenet.fr [127.0.0.1]) (amavisd-new, port 10024)
 with ESMTP id OvJCfv5Cki9s; Wed, 19 Aug 2020 18:08:20 +0200 (CEST)
Received: from function (lfbn-bor-1-797-11.w86-234.abo.wanadoo.fr
 [86.234.239.11])
 by hera.aquilenet.fr (Postfix) with ESMTPSA id C42C035E9;
 Wed, 19 Aug 2020 18:08:20 +0200 (CEST)
Received: from samy by function with local (Exim 4.94)
 (envelope-from <samuel.thibault@ens-lyon.org>)
 id 1k8QdQ-001o1k-56; Wed, 19 Aug 2020 18:08:20 +0200
Date: Wed, 19 Aug 2020 18:08:20 +0200
From: Samuel Thibault <samuel.thibault@ens-lyon.org>
To: Costin Lupu <costin.lupu@cs.pub.ro>
Cc: minios-devel@lists.xen.org, wl@xen.org
Subject: Re: [PATCH v2] mini-os: Use a single start_info_ptr variable
Message-ID: <20200819160820.n3hiaqd4b35fvzzg@function>
Mail-Followup-To: Samuel Thibault <samuel.thibault@ens-lyon.org>,
 Costin Lupu <costin.lupu@cs.pub.ro>, minios-devel@lists.xen.org,
 wl@xen.org
References: <20200819154536.20753-1-costin.lupu@cs.pub.ro>
 <20200819155025.uqxmyyyvvvv6naut@function>
 <dd3bd363-6a1d-eddd-d12a-031b334a0983@cs.pub.ro>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
Content-Transfer-Encoding: 8bit
In-Reply-To: <dd3bd363-6a1d-eddd-d12a-031b334a0983@cs.pub.ro>
Organization: I am not organized
User-Agent: NeoMutt/20170609 (1.8.3)
X-BeenThere: minios-devel@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Mini-os development list <minios-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:minios-devel@lists.xenproject.org>
List-Help: <mailto:minios-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: minios-devel-bounces@lists.xenproject.org
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>

Costin Lupu, le mer. 19 aoÃ»t 2020 19:03:50 +0300, a ecrit:
> On 8/19/20 6:50 PM, Samuel Thibault wrote:
> > Costin Lupu, le mer. 19 aoÃ»t 2020 18:45:36 +0300, a ecrit:
> >> +++ b/shutdown.c
> >> @@ -46,7 +46,7 @@
> >>  #include <mini-os/xmalloc.h>
> >>  
> >>  
> >> -static start_info_t *start_info_ptr;
> >> +extern start_info_t *start_info_ptr;
> > 
> > Please rather put the declaration in include/kernel.h
> 
> How about we leave this one as it is and I send a new patch depending on
> this one introducing the `arch_suspend()` function I was mentioning in a
> previous email? This way we will get rid of the declaration from
> `shutdown.c`.
> 
> My concern is that if we move the declaration to `kernel.h` then the
> "message" will be that it is a variable that can be used freely,
> regardless the architecture.

Right, while the structure itself is arch-independent, the availability
depends on the arch.

Samuel


From minios-devel-bounces@lists.xenproject.org Wed Aug 19 16:20:19 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Wed, 19 Aug 2020 16:20:19 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1k8Qoz-00016g-RF; Wed, 19 Aug 2020 16:20:17 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=OlH4=B5=cs.pub.ro=costin.lupu@srs-us1.protection.inumbo.net>)
 id 1k8Qoz-00016b-CZ
 for minios-devel@lists.xen.org; Wed, 19 Aug 2020 16:20:17 +0000
X-Inumbo-ID: a924ec44-e05b-48aa-8352-08167c58f5cd
Received: from mx.upb.ro (unknown [141.85.13.230])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id a924ec44-e05b-48aa-8352-08167c58f5cd;
 Wed, 19 Aug 2020 16:20:16 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
 by mx.upb.ro (Postfix) with ESMTP id 4951AB560097;
 Wed, 19 Aug 2020 19:20:15 +0300 (EEST)
Received: from mx.upb.ro ([127.0.0.1])
 by localhost (mx.upb.ro [127.0.0.1]) (amavisd-new, port 10032)
 with ESMTP id xMN_UjFbVcF3; Wed, 19 Aug 2020 19:20:13 +0300 (EEST)
Received: from localhost (localhost [127.0.0.1])
 by mx.upb.ro (Postfix) with ESMTP id 5BE3DB561CBD;
 Wed, 19 Aug 2020 19:20:13 +0300 (EEST)
X-Virus-Scanned: amavisd-new at upb.ro
Received: from mx.upb.ro ([127.0.0.1])
 by localhost (mx.upb.ro [127.0.0.1]) (amavisd-new, port 10026)
 with ESMTP id jn9u3Esw-78j; Wed, 19 Aug 2020 19:20:13 +0300 (EEST)
Received: from localhost.localdomain (unknown [188.25.162.205])
 by mx.upb.ro (Postfix) with ESMTPSA id 13BEEB560097;
 Wed, 19 Aug 2020 19:20:13 +0300 (EEST)
From: Costin Lupu <costin.lupu@cs.pub.ro>
To: minios-devel@lists.xen.org
Cc: samuel.thibault@ens-lyon.org,
	wl@xen.org
Subject: [PATCH] mini-os: Add suspend stubs for ARM
Date: Wed, 19 Aug 2020 19:20:09 +0300
Message-Id: <20200819162009.27205-1-costin.lupu@cs.pub.ro>
X-Mailer: git-send-email 2.20.1
MIME-Version: 1.0
Content-Transfer-Encoding: quoted-printable
X-BeenThere: minios-devel@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Mini-os development list <minios-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:minios-devel@lists.xenproject.org>
List-Help: <mailto:minios-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: minios-devel-bounces@lists.xenproject.org
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>

This patch introduces the missing suspend-related stubs for ARM. It also
introduces the new arch_suspend() function in order to keep the logic in
kernel_suspend() arch independent.

Signed-off-by: Costin Lupu <costin.lupu@cs.pub.ro>
---
 arch/arm/setup.c | 15 +++++++++++++++
 arch/x86/setup.c |  9 +++++++++
 include/x86/os.h |  1 +
 shutdown.c       | 10 +---------
 4 files changed, 26 insertions(+), 9 deletions(-)

diff --git a/arch/arm/setup.c b/arch/arm/setup.c
index b65023c..21b6ed4 100644
--- a/arch/arm/setup.c
+++ b/arch/arm/setup.c
@@ -53,6 +53,21 @@ arch_fini(void)
 {
 }
=20
+void arch_pre_suspend(void)
+{
+}
+
+void arch_post_suspend(int canceled)
+{
+}
+
+int arch_suspend(void)
+{
+    printk("Suspend not supported on ARM. Aborting.");
+    do_exit();
+    return 1;
+}
+
 void
 arch_do_exit(void)
 {
diff --git a/arch/x86/setup.c b/arch/x86/setup.c
index 64b22c5..1b5d0d5 100644
--- a/arch/x86/setup.c
+++ b/arch/x86/setup.c
@@ -278,6 +278,15 @@ void arch_post_suspend(int canceled)
     arch_mm_post_suspend(canceled);
 }
=20
+int arch_suspend(void)
+{
+    /*
+     * This hypercall returns 1 if the suspend
+     * was cancelled and 0 if resuming in a new domain
+     */
+    return HYPERVISOR_suspend(virt_to_mfn(start_info_ptr));
+}
+
 void
 arch_fini(void)
 {
diff --git a/include/x86/os.h b/include/x86/os.h
index 46a824d..7c5d2fe 100644
--- a/include/x86/os.h
+++ b/include/x86/os.h
@@ -74,6 +74,7 @@ void xen_callback_vector(void);
=20
 void arch_pre_suspend(void);
 void arch_post_suspend(int canceled);
+int  arch_suspend(void);
 void arch_fini(void);
=20
 #ifdef CONFIG_PARAVIRT
diff --git a/shutdown.c b/shutdown.c
index 0854670..bb2c6f1 100644
--- a/shutdown.c
+++ b/shutdown.c
@@ -46,8 +46,6 @@
 #include <mini-os/xmalloc.h>
=20
=20
-extern start_info_t *start_info_ptr;
-
 #ifdef CONFIG_XENBUS
 static const char *path =3D "control/shutdown";
 static const char *token =3D "control/shutdown";
@@ -140,13 +138,7 @@ void kernel_suspend(void)
     pre_suspend();
     arch_pre_suspend();
=20
-    /*
-     * This hypercall returns 1 if the suspend
-     * was cancelled and 0 if resuming in a new domain
-     *
-     * TODO Fix this for ARM
-     */
-    rc =3D HYPERVISOR_suspend(virt_to_mfn(start_info_ptr));
+    rc =3D arch_suspend();
=20
     arch_post_suspend(rc);
     post_suspend(rc);
--=20
2.20.1



From minios-devel-bounces@lists.xenproject.org Wed Aug 19 16:37:12 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Wed, 19 Aug 2020 16:37:12 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1k8R5J-00027f-29; Wed, 19 Aug 2020 16:37:09 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=hdrE=B5=ens-lyon.org=samuel.thibault@srs-us1.protection.inumbo.net>)
 id 1k8R5H-00027a-Q2
 for minios-devel@lists.xen.org; Wed, 19 Aug 2020 16:37:07 +0000
X-Inumbo-ID: fdb9b178-fdcb-4c4a-b9b3-7e981a0342f3
Received: from hera.aquilenet.fr (unknown [185.233.100.1])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id fdb9b178-fdcb-4c4a-b9b3-7e981a0342f3;
 Wed, 19 Aug 2020 16:37:06 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
 by hera.aquilenet.fr (Postfix) with ESMTP id 088323779;
 Wed, 19 Aug 2020 18:37:05 +0200 (CEST)
X-Virus-Scanned: Debian amavisd-new at aquilenet.fr
Received: from hera.aquilenet.fr ([127.0.0.1])
 by localhost (hera.aquilenet.fr [127.0.0.1]) (amavisd-new, port 10024)
 with ESMTP id WF5lXtoi-oSI; Wed, 19 Aug 2020 18:37:04 +0200 (CEST)
Received: from function (lfbn-bor-1-797-11.w86-234.abo.wanadoo.fr
 [86.234.239.11])
 by hera.aquilenet.fr (Postfix) with ESMTPSA id 770C53760;
 Wed, 19 Aug 2020 18:37:04 +0200 (CEST)
Received: from samy by function with local (Exim 4.94)
 (envelope-from <samuel.thibault@ens-lyon.org>)
 id 1k8R5D-001pGz-Ia; Wed, 19 Aug 2020 18:37:03 +0200
Date: Wed, 19 Aug 2020 18:37:03 +0200
From: Samuel Thibault <samuel.thibault@ens-lyon.org>
To: Costin Lupu <costin.lupu@cs.pub.ro>
Cc: minios-devel@lists.xen.org, wl@xen.org
Subject: Re: [PATCH] mini-os: Add suspend stubs for ARM
Message-ID: <20200819163703.x6pitf4dg2aolb6x@function>
Mail-Followup-To: Samuel Thibault <samuel.thibault@ens-lyon.org>,
 Costin Lupu <costin.lupu@cs.pub.ro>, minios-devel@lists.xen.org,
 wl@xen.org
References: <20200819162009.27205-1-costin.lupu@cs.pub.ro>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
Content-Transfer-Encoding: 8bit
In-Reply-To: <20200819162009.27205-1-costin.lupu@cs.pub.ro>
Organization: I am not organized
User-Agent: NeoMutt/20170609 (1.8.3)
X-BeenThere: minios-devel@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Mini-os development list <minios-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:minios-devel@lists.xenproject.org>
List-Help: <mailto:minios-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: minios-devel-bounces@lists.xenproject.org
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>

Costin Lupu, le mer. 19 aoÃ»t 2020 19:20:09 +0300, a ecrit:
> +void arch_pre_suspend(void)
> +{
> +}
> +
> +void arch_post_suspend(int canceled)
> +{
> +}
> +
> +int arch_suspend(void)
> +{
> +    printk("Suspend not supported on ARM. Aborting.");
> +    do_exit();
> +    return 1;
> +}

Rather put arch_suspend between arch_pre_suspend and arch_post_suspend,
so they are in the calling order. Same for x86.

Samuel


From minios-devel-bounces@lists.xenproject.org Wed Aug 19 16:41:19 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Wed, 19 Aug 2020 16:41:19 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1k8R9K-0002rR-DP; Wed, 19 Aug 2020 16:41:18 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=OlH4=B5=cs.pub.ro=costin.lupu@srs-us1.protection.inumbo.net>)
 id 1k8R9J-0002rM-0s
 for minios-devel@lists.xen.org; Wed, 19 Aug 2020 16:41:17 +0000
X-Inumbo-ID: a20c6fc3-b06c-45df-acb9-4e2e838c61f7
Received: from mx.upb.ro (unknown [141.85.13.200])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id a20c6fc3-b06c-45df-acb9-4e2e838c61f7;
 Wed, 19 Aug 2020 16:41:15 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
 by mx.upb.ro (Postfix) with ESMTP id 0A9EEB560097;
 Wed, 19 Aug 2020 19:41:14 +0300 (EEST)
Received: from mx.upb.ro ([127.0.0.1])
 by localhost (mx.upb.ro [127.0.0.1]) (amavisd-new, port 10032)
 with ESMTP id ifFpLha9OQb2; Wed, 19 Aug 2020 19:41:12 +0300 (EEST)
Received: from localhost (localhost [127.0.0.1])
 by mx.upb.ro (Postfix) with ESMTP id 09567B561CBD;
 Wed, 19 Aug 2020 19:41:12 +0300 (EEST)
X-Virus-Scanned: amavisd-new at upb.ro
Received: from mx.upb.ro ([127.0.0.1])
 by localhost (mx.upb.ro [127.0.0.1]) (amavisd-new, port 10026)
 with ESMTP id KFH1tc4l-FJH; Wed, 19 Aug 2020 19:41:11 +0300 (EEST)
Received: from localhost.localdomain (unknown [188.25.162.205])
 by mx.upb.ro (Postfix) with ESMTPSA id B6436B560097;
 Wed, 19 Aug 2020 19:41:11 +0300 (EEST)
From: Costin Lupu <costin.lupu@cs.pub.ro>
To: minios-devel@lists.xen.org
Cc: samuel.thibault@ens-lyon.org,
	wl@xen.org
Subject: [PATCH v2] mini-os: Add suspend stubs for ARM
Date: Wed, 19 Aug 2020 19:41:08 +0300
Message-Id: <20200819164108.30545-1-costin.lupu@cs.pub.ro>
X-Mailer: git-send-email 2.20.1
MIME-Version: 1.0
Content-Transfer-Encoding: quoted-printable
X-BeenThere: minios-devel@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Mini-os development list <minios-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:minios-devel@lists.xenproject.org>
List-Help: <mailto:minios-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: minios-devel-bounces@lists.xenproject.org
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>

This patch introduces the missing suspend-related stubs for ARM. It also
introduces the new arch_suspend() function in order to keep the logic in
kernel_suspend() arch independent.

Signed-off-by: Costin Lupu <costin.lupu@cs.pub.ro>
---
 arch/arm/setup.c | 15 +++++++++++++++
 arch/x86/setup.c |  9 +++++++++
 include/x86/os.h |  1 +
 shutdown.c       | 10 +---------
 4 files changed, 26 insertions(+), 9 deletions(-)

diff --git a/arch/arm/setup.c b/arch/arm/setup.c
index b65023c..3d112fa 100644
--- a/arch/arm/setup.c
+++ b/arch/arm/setup.c
@@ -53,6 +53,21 @@ arch_fini(void)
 {
 }
=20
+void arch_pre_suspend(void)
+{
+}
+
+int arch_suspend(void)
+{
+    printk("Suspend not supported on ARM. Aborting.");
+    do_exit();
+    return 1;
+}
+
+void arch_post_suspend(int canceled)
+{
+}
+
 void
 arch_do_exit(void)
 {
diff --git a/arch/x86/setup.c b/arch/x86/setup.c
index 64b22c5..1ec68d3 100644
--- a/arch/x86/setup.c
+++ b/arch/x86/setup.c
@@ -249,6 +249,15 @@ void arch_pre_suspend(void)
     arch_mm_pre_suspend();
 }
=20
+int arch_suspend(void)
+{
+    /*
+     * This hypercall returns 1 if the suspend
+     * was cancelled and 0 if resuming in a new domain
+     */
+    return HYPERVISOR_suspend(virt_to_mfn(start_info_ptr));
+}
+
 void arch_post_suspend(int canceled)
 {
 #if CONFIG_PARAVIRT
diff --git a/include/x86/os.h b/include/x86/os.h
index 46a824d..ee34d78 100644
--- a/include/x86/os.h
+++ b/include/x86/os.h
@@ -73,6 +73,7 @@ void xen_callback_vector(void);
 #endif
=20
 void arch_pre_suspend(void);
+int  arch_suspend(void);
 void arch_post_suspend(int canceled);
 void arch_fini(void);
=20
diff --git a/shutdown.c b/shutdown.c
index 0854670..bb2c6f1 100644
--- a/shutdown.c
+++ b/shutdown.c
@@ -46,8 +46,6 @@
 #include <mini-os/xmalloc.h>
=20
=20
-extern start_info_t *start_info_ptr;
-
 #ifdef CONFIG_XENBUS
 static const char *path =3D "control/shutdown";
 static const char *token =3D "control/shutdown";
@@ -140,13 +138,7 @@ void kernel_suspend(void)
     pre_suspend();
     arch_pre_suspend();
=20
-    /*
-     * This hypercall returns 1 if the suspend
-     * was cancelled and 0 if resuming in a new domain
-     *
-     * TODO Fix this for ARM
-     */
-    rc =3D HYPERVISOR_suspend(virt_to_mfn(start_info_ptr));
+    rc =3D arch_suspend();
=20
     arch_post_suspend(rc);
     post_suspend(rc);
--=20
2.20.1



From minios-devel-bounces@lists.xenproject.org Wed Aug 19 16:49:40 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Wed, 19 Aug 2020 16:49:40 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1k8RHO-00031i-3C; Wed, 19 Aug 2020 16:49:38 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=hdrE=B5=ens-lyon.org=samuel.thibault@srs-us1.protection.inumbo.net>)
 id 1k8RHM-00031d-V8
 for minios-devel@lists.xen.org; Wed, 19 Aug 2020 16:49:36 +0000
X-Inumbo-ID: 10e175d5-c722-4114-b7fe-424262de5bfd
Received: from hera.aquilenet.fr (unknown [2a0c:e300::1])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 10e175d5-c722-4114-b7fe-424262de5bfd;
 Wed, 19 Aug 2020 16:49:34 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
 by hera.aquilenet.fr (Postfix) with ESMTP id 280C7379A;
 Wed, 19 Aug 2020 18:49:33 +0200 (CEST)
X-Virus-Scanned: Debian amavisd-new at aquilenet.fr
Received: from hera.aquilenet.fr ([127.0.0.1])
 by localhost (hera.aquilenet.fr [127.0.0.1]) (amavisd-new, port 10024)
 with ESMTP id QpZLp8kObsob; Wed, 19 Aug 2020 18:49:32 +0200 (CEST)
Received: from function (lfbn-bor-1-797-11.w86-234.abo.wanadoo.fr
 [86.234.239.11])
 by hera.aquilenet.fr (Postfix) with ESMTPSA id 2A3643782;
 Wed, 19 Aug 2020 18:49:32 +0200 (CEST)
Received: from samy by function with local (Exim 4.94)
 (envelope-from <samuel.thibault@ens-lyon.org>)
 id 1k8RHH-001pYl-GA; Wed, 19 Aug 2020 18:49:31 +0200
Date: Wed, 19 Aug 2020 18:49:31 +0200
From: Samuel Thibault <samuel.thibault@ens-lyon.org>
To: Costin Lupu <costin.lupu@cs.pub.ro>
Cc: minios-devel@lists.xen.org, wl@xen.org
Subject: Re: [PATCH v2] mini-os: Add suspend stubs for ARM
Message-ID: <20200819164931.p2rrbjtbnrycnu36@function>
Mail-Followup-To: Samuel Thibault <samuel.thibault@ens-lyon.org>,
 Costin Lupu <costin.lupu@cs.pub.ro>, minios-devel@lists.xen.org,
 wl@xen.org
References: <20200819164108.30545-1-costin.lupu@cs.pub.ro>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
Content-Transfer-Encoding: 8bit
In-Reply-To: <20200819164108.30545-1-costin.lupu@cs.pub.ro>
Organization: I am not organized
User-Agent: NeoMutt/20170609 (1.8.3)
X-BeenThere: minios-devel@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Mini-os development list <minios-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:minios-devel@lists.xenproject.org>
List-Help: <mailto:minios-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: minios-devel-bounces@lists.xenproject.org
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>

Costin Lupu, le mer. 19 aoÃ»t 2020 19:41:08 +0300, a ecrit:
> This patch introduces the missing suspend-related stubs for ARM. It also
> introduces the new arch_suspend() function in order to keep the logic in
> kernel_suspend() arch independent.
> 
> Signed-off-by: Costin Lupu <costin.lupu@cs.pub.ro>

Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>

> ---
>  arch/arm/setup.c | 15 +++++++++++++++
>  arch/x86/setup.c |  9 +++++++++
>  include/x86/os.h |  1 +
>  shutdown.c       | 10 +---------
>  4 files changed, 26 insertions(+), 9 deletions(-)
> 
> diff --git a/arch/arm/setup.c b/arch/arm/setup.c
> index b65023c..3d112fa 100644
> --- a/arch/arm/setup.c
> +++ b/arch/arm/setup.c
> @@ -53,6 +53,21 @@ arch_fini(void)
>  {
>  }
>  
> +void arch_pre_suspend(void)
> +{
> +}
> +
> +int arch_suspend(void)
> +{
> +    printk("Suspend not supported on ARM. Aborting.");
> +    do_exit();
> +    return 1;
> +}
> +
> +void arch_post_suspend(int canceled)
> +{
> +}
> +
>  void
>  arch_do_exit(void)
>  {
> diff --git a/arch/x86/setup.c b/arch/x86/setup.c
> index 64b22c5..1ec68d3 100644
> --- a/arch/x86/setup.c
> +++ b/arch/x86/setup.c
> @@ -249,6 +249,15 @@ void arch_pre_suspend(void)
>      arch_mm_pre_suspend();
>  }
>  
> +int arch_suspend(void)
> +{
> +    /*
> +     * This hypercall returns 1 if the suspend
> +     * was cancelled and 0 if resuming in a new domain
> +     */
> +    return HYPERVISOR_suspend(virt_to_mfn(start_info_ptr));
> +}
> +
>  void arch_post_suspend(int canceled)
>  {
>  #if CONFIG_PARAVIRT
> diff --git a/include/x86/os.h b/include/x86/os.h
> index 46a824d..ee34d78 100644
> --- a/include/x86/os.h
> +++ b/include/x86/os.h
> @@ -73,6 +73,7 @@ void xen_callback_vector(void);
>  #endif
>  
>  void arch_pre_suspend(void);
> +int  arch_suspend(void);
>  void arch_post_suspend(int canceled);
>  void arch_fini(void);
>  
> diff --git a/shutdown.c b/shutdown.c
> index 0854670..bb2c6f1 100644
> --- a/shutdown.c
> +++ b/shutdown.c
> @@ -46,8 +46,6 @@
>  #include <mini-os/xmalloc.h>
>  
>  
> -extern start_info_t *start_info_ptr;
> -
>  #ifdef CONFIG_XENBUS
>  static const char *path = "control/shutdown";
>  static const char *token = "control/shutdown";
> @@ -140,13 +138,7 @@ void kernel_suspend(void)
>      pre_suspend();
>      arch_pre_suspend();
>  
> -    /*
> -     * This hypercall returns 1 if the suspend
> -     * was cancelled and 0 if resuming in a new domain
> -     *
> -     * TODO Fix this for ARM
> -     */
> -    rc = HYPERVISOR_suspend(virt_to_mfn(start_info_ptr));
> +    rc = arch_suspend();
>  
>      arch_post_suspend(rc);
>      post_suspend(rc);
> -- 
> 2.20.1
> 

-- 
Samuel
--- christ gives channel operator status to Dieu
 -+- #ens-mim and hell -+-


From minios-devel-bounces@lists.xenproject.org Thu Aug 20 09:46:32 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Thu, 20 Aug 2020 09:46:32 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1k8h9R-00089K-NA; Thu, 20 Aug 2020 09:46:29 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=WisD=B6=gmail.com=cristianvijelie@srs-us1.protection.inumbo.net>)
 id 1k8h9R-00089A-32
 for minios-devel@lists.xen.org; Thu, 20 Aug 2020 09:46:29 +0000
X-Inumbo-ID: 06fa26db-44b0-49b9-9627-6652562b3744
Received: from mail-ej1-x633.google.com (unknown [2a00:1450:4864:20::633])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 06fa26db-44b0-49b9-9627-6652562b3744;
 Thu, 20 Aug 2020 09:46:28 +0000 (UTC)
Received: by mail-ej1-x633.google.com with SMTP id f24so1738764ejx.6
 for <minios-devel@lists.xen.org>; Thu, 20 Aug 2020 02:46:27 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=from:to:cc:subject:date:message-id:mime-version
 :content-transfer-encoding;
 bh=4bWkge8bCADe7VhzE6LnyKNPw1bd0iBLz65cuJDKqBQ=;
 b=lYTBQE8PLYGZ7XN18F55S3Rp+sr5pM3kT8mgWIdn3XTC/qRinhABDsthNJy9ZJTIV/
 yNoKCQTUWLRhSPXzjvSXRGnFnAFwPDCWnFFDEM5ClJDLLl/YmhpzW/6ARBECJTQ0Aqhn
 fkXyd4PSLuPOyqtxWu/BGgAYksncF+MdDp9Z849Ae9FJGgSulv5zwImmay4AnpeHQOHc
 tEWvJsJJFg6oK5C+5zPK3HQIxOQAgEd0PfrYXKpY/Dy9TOhhiCay9kCjkxavXNQjGjON
 Iux0By0x9vZkpjQwliXcFsOccnPw/Rof+p22Xq22Eqt7PfrRSFrZCXSyk9iGPXe5nDPw
 Mfeg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version
 :content-transfer-encoding;
 bh=4bWkge8bCADe7VhzE6LnyKNPw1bd0iBLz65cuJDKqBQ=;
 b=Ul1XX14g00k6M+e0bVUQmbwlvIh+JKP3BRz8nlS7x+ikfaf0bdR2hgYbs5XOvAyQMJ
 /I0UGur8HrFiSvzrx7udToNP0nURdyORG1YHXWsjNfoTuy3Ad9RqHctdEaZeuUH1dPv+
 wADTzRD1tE67Q4r/cScEDk8uSIJuNDRVlK7rtIIpLDdssxKItQvaCAt3HiL3PYoNwZAU
 26+ejjKmCFacOC3L6Lhumzku5kHhg9DXYL9Knp4sM2Xjtj3+7/pYx50fBKrykvDz5UAt
 16vrNZpWTbbw6qCXI4qw8/PHHylnlzOZP8KbMDtDBgueY1svJJy4t8aB8SGTry0L7DfT
 KGsQ==
X-Gm-Message-State: AOAM530qNkvRf9Agzt4fDc46eja2LrlGn2SUQTwM/jtH+OVJurAqRWmE
 r6ZudnNSnKOjJGQDBGsfT7zZCDQvpFk=
X-Google-Smtp-Source: ABdhPJzXwq2jtM2JQWnzoil+as2roNUXYpNwrHfYiHBkvo0dviFztR7yWdZWQ8jKdsFF7xVG/rIuoQ==
X-Received: by 2002:a17:906:ce3a:: with SMTP id
 sd26mr2331272ejb.489.1597916786757; 
 Thu, 20 Aug 2020 02:46:26 -0700 (PDT)
Received: from localhost.localdomain ([82.137.12.155])
 by smtp.gmail.com with ESMTPSA id y9sm994789edt.34.2020.08.20.02.46.25
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Thu, 20 Aug 2020 02:46:26 -0700 (PDT)
From: cristianvijelie@gmail.com
To: minios-devel@lists.xen.org
Cc: Cristian <cristianvijelie@gmail.com>
Subject: [UNIKRAFT PATCH 0/4] Porting of the MIT Kerberos runtime librares
Date: Thu, 20 Aug 2020 12:46:19 +0300
Message-Id: <20200820094623.77456-1-cristianvijelie@gmail.com>
X-Mailer: git-send-email 2.25.1
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-BeenThere: minios-devel@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Mini-os development list <minios-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:minios-devel@lists.xenproject.org>
List-Help: <mailto:minios-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: minios-devel-bounces@lists.xenproject.org
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>

From: Cristian <cristianvijelie@gmail.com>

As libkrb5support, libkrb5crypto, libcom_err, libkrb5 and libgssapi are all
downloaded and built from the same source, I've decided to include them all
in one Unikraft external library.

Here are the needed libraries for each one of them
libkrb5support: lib-newlib, lib-pthread-embedded, lib-lwip
libkrb5crypto:  libkrb5support and it's dependencies
libcom_err:     libkrb5support and it's dependencies
libkrb5:        all of the above
libgssapi:      all of the above + libdl (not implemented)

The configuring of the Kerberos libraries is done with the flag --disable-nls,
because the nls feature needs libdl, which is not yet implemented (but it 
exists as unikraft/lib/posix-libdl).

Also, I added a sed command after configuring the library, to remove the use
of secure_getenv, as it's not implemented in newlib.

The libkrb5 can't be built, yet, because of the missing implementation for 
__res_ninit, from libnewlibc/origin/newlib-2.5.0.20170922/newlib/libc/sys/linux/include/resolv.h.

I've not added the gssapi library, as it has missing dependencies, and I will add
it after libdl will be implemented.

I've not yet added the OpenSSL support, or the OpenLDAP support.

Cristian (4):
  Ported libkrb5support, libkrb5crypto and libcom_err
  Added libkrb5 sorurces
  Added .md files
  Fixed the README

 .gitignore         |   4 +
 CODING_STYLE.md    |   4 +
 CONTRIBUTING.md    |   4 +
 Config.uk          |  34 +++
 MAINTAINERS.md     |   9 +
 Makefile.uk        | 561 +++++++++++++++++++++++++++++++++++++++++++++
 README.md          |   6 +
 include/byteswap.h |  26 +++
 8 files changed, 648 insertions(+)
 create mode 100644 .gitignore
 create mode 100644 CODING_STYLE.md
 create mode 100644 CONTRIBUTING.md
 create mode 100644 Config.uk
 create mode 100644 MAINTAINERS.md
 create mode 100644 Makefile.uk
 create mode 100644 include/byteswap.h

-- 
2.25.1



From minios-devel-bounces@lists.xenproject.org Thu Aug 20 09:46:34 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Thu, 20 Aug 2020 09:46:34 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1k8h9W-0008AW-Oz; Thu, 20 Aug 2020 09:46:34 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=WisD=B6=gmail.com=cristianvijelie@srs-us1.protection.inumbo.net>)
 id 1k8h9W-00089A-3H
 for minios-devel@lists.xen.org; Thu, 20 Aug 2020 09:46:34 +0000
X-Inumbo-ID: 2c4d3944-4bd9-47d0-8529-1e3985222aec
Received: from mail-ej1-x62e.google.com (unknown [2a00:1450:4864:20::62e])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 2c4d3944-4bd9-47d0-8529-1e3985222aec;
 Thu, 20 Aug 2020 09:46:32 +0000 (UTC)
Received: by mail-ej1-x62e.google.com with SMTP id t10so1727373ejs.8
 for <minios-devel@lists.xen.org>; Thu, 20 Aug 2020 02:46:32 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=from:to:cc:subject:date:message-id:in-reply-to:references
 :mime-version:content-transfer-encoding;
 bh=uA/NG1hNMHe/noCR563gAln1rqlOVkuWndwDD+OzG7U=;
 b=KSS+CDU6Y8OH3m7I/SkdShTZIcKlYNbWpdlrQARPlecokk4nznAz5kH5DarqsjxgtA
 Fedgqyi4UZ9J1jcpEiXOIUAFdIbDxHY7vHxQtNbIafpjKZcwgJ3AqM5bsL2XUPHnvOCH
 ozrw7rsBtybl8ulvPcMuDASYTEMxAgy7CqWtplY3XXpNVJfThdr03/TIx62281GWfb+J
 zOO/bWRxFYnhkyI7bEAbNfxrxRZRYd9q5pc5cLIgRTOkklnwtOfrD6ACIx5rXy4Bme0f
 rjvq0ZJvzYPvDviLUB3B+Jf+5qndOsa0WoDcXNc8Mh6d57SGvih0wdJYWnBOqWJOxO7l
 XwCg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to
 :references:mime-version:content-transfer-encoding;
 bh=uA/NG1hNMHe/noCR563gAln1rqlOVkuWndwDD+OzG7U=;
 b=rjskQd/p4yoI6aMhdf9XrByRM0ccBQU5y9BvhRQPrERHUeZh65uoReYG9tZ0CB6vWt
 Rl0feoiL7Em2ha/dDK+iiqI2aNFzT+8OIv7cmow9YPvXKmU9vQiV3D+eG0/Z0YtnY8Nu
 mjmhbrQDaA/ObAlpJUpz7sFPhn2ggyefuUjc9MHU0PnUzyDxX0E9nVeXwat6KuevtLj7
 PrehBl1Tzh805aeAhAtrSHMW/weLh1sCCJ4JeMZjOnaHj0QX0GEYkSY2PqcGyamdnbKz
 e9OblsrO4IO2r6HKQLf6fKVxfEsm6GjiB7bKAeh85Ej+vm1WLz7wzO+Q7bk4h6ciysj7
 5vow==
X-Gm-Message-State: AOAM531ifGUqnrrWZbV0bDt5KwzZnGYK7xqiDZBTl5+N471mnLfkcRxC
 yGejVmvh40tnhABblyFTX6xz9PJ5r0A=
X-Google-Smtp-Source: ABdhPJzjpDCnrTkSM8KeQAD2d779MIlrrA2Ihmhm5u5YOtX5OJje+jyWcAnbmHR5C2HDjU0e/8VL1Q==
X-Received: by 2002:a17:906:eb90:: with SMTP id
 mh16mr2363127ejb.10.1597916791011; 
 Thu, 20 Aug 2020 02:46:31 -0700 (PDT)
Received: from localhost.localdomain ([82.137.12.155])
 by smtp.gmail.com with ESMTPSA id y9sm994789edt.34.2020.08.20.02.46.29
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Thu, 20 Aug 2020 02:46:30 -0700 (PDT)
From: cristianvijelie@gmail.com
To: minios-devel@lists.xen.org
Cc: Cristian <cristianvijelie@gmail.com>
Subject: [UNIKRAFT PATCH 2/4] Added libkrb5 sources
Date: Thu, 20 Aug 2020 12:46:21 +0300
Message-Id: <20200820094623.77456-3-cristianvijelie@gmail.com>
X-Mailer: git-send-email 2.25.1
In-Reply-To: <20200820094623.77456-1-cristianvijelie@gmail.com>
References: <20200820094623.77456-1-cristianvijelie@gmail.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-BeenThere: minios-devel@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Mini-os development list <minios-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:minios-devel@lists.xenproject.org>
List-Help: <mailto:minios-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: minios-devel-bounces@lists.xenproject.org
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>

From: Cristian <cristianvijelie@gmail.com>

Signed-off-by: Cristian <cristianvijelie@gmail.com>
---
 .gitignore  |   2 +
 Config.uk   |   2 +-
 Makefile.uk | 251 +++++++++++++++++++++++++++++++++++++++++++++++-----
 3 files changed, 232 insertions(+), 23 deletions(-)

diff --git a/.gitignore b/.gitignore
index 890d606..01e46c1 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,5 @@
 krb5-1.18.2
 *_make
 make_log
+0000-cover-letter.patch
+0001-Ported-libkrb5support-libkrb5crypto-and-libcom_err.patch
diff --git a/Config.uk b/Config.uk
index 73176de..ab7834e 100644
--- a/Config.uk
+++ b/Config.uk
@@ -12,11 +12,11 @@ menuconfig LIBKRB5SUPPORT
     select LIBLWIP
     select LWIP_UKNETDEV
 	select LWIP_TCP
-	select LWIP_TCP_KEEPALIVE
 	select LWIP_THREADS
 	select LWIP_SOCKET
 	select LWIP_IPV4
     select LWIP_IPV6
+    select LWIP_DNS
     default n
 
 menuconfig LIBKRB5CRYPTO
diff --git a/Makefile.uk b/Makefile.uk
index eea8972..1f901f1 100644
--- a/Makefile.uk
+++ b/Makefile.uk
@@ -28,7 +28,7 @@ LIBKRB5SUPPORT_DIR=$(LIBKRB5_MAINDIR)/util/support
 LIBKRB5CRYPTO_DIR=$(LIBKRB5_MAINDIR)/lib/crypto
 
 ##############################################################################################
-# libkrb5 flags
+# Initialize library flags
 ##############################################################################################
 LIBKRB5_CFLAGS += -fPIC -DSHARED -DHAVE_CONFIG_H  -I$(LIBKRB5_BASE)/include \
 -I$(LIBKRB5_MAINDIR)/include  -DKRB5_DEPRECATED=1 -DKRB5_PRIVATE -Wall -Wcast-align -Wshadow \
@@ -39,23 +39,237 @@ LIBKRB5_CFLAGS += -fPIC -DSHARED -DHAVE_CONFIG_H  -I$(LIBKRB5_BASE)/include \
 -Werror=int-conversion -Werror=incompatible-pointer-types -Werror=discarded-qualifiers \
 -Werror=implicit-int -Werror=declaration-after-statement -Werror-implicit-function-declaration
 
+LIBCOM_ERR_CFLAGS = $(LIBKRB5_CFLAGS)
+
+LIBKRB5_CFLAGS += -I$(LIBNEWLIB_LIBC)/sys/linux/include
+LIBKRB5_CFLAGS += -I$(LIBNEWLIB_LIBC)/sys/linux
+LIBKRB5_CFLAGS += -I$(LIBNEWLIB_LIBC)/sys/linux/sys
+
+LIBKRB5SUPPORT_OBJFLAGS = $(LIBKRB5_OBJFLAGS)
+LIBKRB5CRYPTO_CFLAGS = $(LIBKRB5_CFLAGS)
+
+LIBKRB5_CFLAGS += -I$(LIBKRB5_DIR)/ccache
+LIBKRB5_CFLAGS += -I$(LIBKRB5_DIR)/ccache/ccapi
+LIBKRB5_CFLAGS += -I$(LIBKRB5_DIR)/os
+LIBKRB5_CFLAGS += -I$(LIBKRB5_DIR)/keytab
+LIBKRB5_CFLAGS += -I$(LIBKRB5_DIR)/rcache
+LIBKRB5_CFLAGS += -I$(LIBKRB5_DIR)/unicode
+LIBKRB5_CFLAGS += -I$(LIBKRB5_MAINDIR)
+LIBKRB5_CFLAGS += -I$(LIBKRB5_MAINDIR)/util/profile
+LIBKRB5_CFLAGS += -DLIBDIR=\"/usr/local/lib\"
+LIBKRB5_CFLAGS += -DDYNOBJEXT=\".so\"
+LIBKRB5_CFLAGS += -DBINDIR=\"/usr/local/bin\"
+LIBKRB5_CFLAGS += -DSBINDIR=\"/usr/local/sbin\"
+
 LIBKRB5_OBJFLAGS += -shared -fPIC -Wl,--no-undefined -Wl,--enable-new-dtags \
 -Wl,-rpath
 
 ##############################################################################################
 # libkrb5 code
 ##############################################################################################
-LIBKRB5_SRCS-y += 
-
-##############################################################################################
-# libkrb5support flags
-##############################################################################################
-
-LIBKRB5SUPPORT_CFLAGS = $(LIBKRB5_CFLAGS)
-LIBKRB5SUPPORT_CFLAGS += -I$(LIBNEWLIB_LIBC)/sys/linux/include
-LIBKRB5SUPPORT_CFLAGS += -I$(LIBNEWLIB_LIBC)/sys/linux
-LIBKRB5SUPPORT_CFLAGS += -I$(LIBNEWLIB_LIBC)/sys/linux/sys
-LIBKRB5SUPPORT_OBJFLAGS = $(LIBKRB5_OBJFLAGS)
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/error_tables/asn1_err.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/error_tables/kdb5_err.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/error_tables/krb5_err.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/error_tables/k5e1_err.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/error_tables/kv5m_err.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/error_tables/krb524_err.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/asn.1/asn1_encode.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/asn.1/asn1_k_encode.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/asn.1/ldap_key_seq.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/ccache/ccbase.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/ccache/cccopy.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/ccache/cccursor.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/ccache/ccdefault.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/ccache/ccdefops.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/ccache/ccmarshal.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/ccache/ccselect.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/ccache/ccselect_hostname.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/ccache/ccselect_k5identity.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/ccache/ccselect_realm.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/ccache/cc_dir.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/ccache/cc_retr.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/ccache/cc_file.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/ccache/cc_kcm.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/ccache/cc_memory.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/ccache/cc_keyring.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/ccache/ccfns.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/keytab/ktadd.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/keytab/ktbase.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/keytab/ktdefault.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/keytab/ktfr_entry.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/keytab/ktremove.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/keytab/ktfns.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/keytab/kt_file.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/keytab/kt_memory.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/keytab/read_servi.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/addr_comp.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/addr_order.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/addr_srch.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/allow_weak.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/appdefault.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/ai_authdata.c 
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/auth_con.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/cammac_util.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/authdata.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/authdata_exp.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/authdata_enc.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/authdata_dec.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/bld_pr_ext.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/bld_princ.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/chk_trans.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/chpw.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/conv_creds.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/conv_princ.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/copy_addrs.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/copy_auth.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/copy_athctr.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/copy_cksum.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/copy_creds.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/copy_data.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/copy_key.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/copy_princ.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/copy_tick.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/cp_key_cnt.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/decode_kdc.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/decrypt_tk.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/deltat.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/enc_helper.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/enc_keyhelper.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/encode_kdc.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/encrypt_tk.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/etype_list.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/fast.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/fwd_tgt.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/gc_via_tkt.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/gen_seqnum.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/gen_subkey.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/gen_save_subkey.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/get_creds.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/get_etype_info.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/get_in_tkt.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/gic_keytab.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/gic_opt.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/gic_pwd.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/in_tkt_sky.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/init_ctx.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/copy_ctx.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/init_keyblock.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/kdc_rep_dc.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/kerrs.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/kfree.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/libdef_parse.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/mk_cred.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/mk_error.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/mk_priv.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/mk_rep.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/mk_req.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/mk_req_ext.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/mk_safe.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/pac.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/pac_sign.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/padata.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/parse.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/parse_host_string.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/plugin.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/pr_to_salt.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/preauth2.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/preauth_ec.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/preauth_encts.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/preauth_otp.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/preauth_pkinit.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/preauth_sam2.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/princ_comp.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/privsafe.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/random_str.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/rd_cred.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/rd_error.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/rd_priv.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/rd_rep.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/rd_req.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/rd_req_dec.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/rd_safe.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/recvauth.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/response_items.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/s4u_authdata.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/s4u_creds.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/sendauth.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/send_tgs.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/ser_actx.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/ser_adata.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/ser_addr.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/ser_auth.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/ser_cksum.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/ser_ctx.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/ser_key.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/ser_princ.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/serialize.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/set_realm.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/sname_match.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/srv_dec_tkt.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/srv_rcache.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/str_conv.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/tgtname.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/unparse.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/val_renew.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/valid_times.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/vfy_increds.c 
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/vic_opt.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/walk_rtree.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/os/accessor.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/os/c_ustime.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/os/ccdefname.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/os/changepw.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/os/dnsglue.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/os/dnssrv.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/os/expand_path.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/os/full_ipadr.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/os/gen_port.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/os/genaddrs.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/os/gen_rname.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/os/hostaddr.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/os/hostrealm.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/os/hostrealm_dns.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/os/hostrealm_domain.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/os/hostrealm_profile.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/os/hostrealm_registry.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/os/init_os_ctx.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/os/krbfileio.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/os/ktdefname.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/os/mk_faddr.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/os/localaddr.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/os/localauth.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/os/localauth_an2ln.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/os/localauth_k5login.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/os/localauth_names.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/os/localauth_rule.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/os/locate_kdc.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/os/lock_file.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/os/net_read.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/os/net_write.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/os/port2ip.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/os/prompter.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/os/read_msg.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/os/read_pwd.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/os/realm_dom.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/os/sendto_kdc.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/os/sn2princ.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/os/thread_safe.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/os/timeofday.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/os/toffset.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/os/trace.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/os/unlck_file.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/os/ustime.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/os/write_msg.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/rcache/memrcache.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/rcache/rc_base.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/rcache/rc_dfl.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/rcache/rc_file2.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/rcache/rc_none.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/unicode/ucdata.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/unicode/ure.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/unicode/urestubs.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/unicode/ucstr.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb5_libinit.c
 
 ##############################################################################################
 # libkrb5support code
@@ -83,7 +297,6 @@ LIBKRB5SUPPORT_SRCS-y += $(LIBKRB5SUPPORT_DIR)/strlcpy.c
 ##############################################################################################
 # libkrb5crypto flags
 ##############################################################################################
-LIBKRB5CRYPTO_CFLAGS = $(LIBKRB5_CFLAGS)
 LIBKRB5CRYPTO_CFLAGS += -I$(LIBKRB5CRYPTO_DIR)/krb
 LIBKRB5CRYPTO_CFLAGS += -I$(LIBKRB5CRYPTO_DIR)/builtin
 LIBKRB5CRYPTO_CFLAGS += -I$(LIBKRB5CRYPTO_DIR)/builtin/aes
@@ -93,9 +306,6 @@ LIBKRB5CRYPTO_CFLAGS += -I$(LIBKRB5CRYPTO_DIR)/builtin/md4
 LIBKRB5CRYPTO_CFLAGS += -I$(LIBKRB5CRYPTO_DIR)/builtin/md5
 LIBKRB5CRYPTO_CFLAGS += -I$(LIBKRB5CRYPTO_DIR)/builtin/sha1
 LIBKRB5CRYPTO_CFLAGS += -I$(LIBKRB5CRYPTO_DIR)/builtin/sha2
-LIBKRB5CRYPTO_CFLAGS += -I$(LIBNEWLIB_LIBC)/sys/linux/include
-LIBKRB5CRYPTO_CFLAGS += -I$(LIBNEWLIB_LIBC)/sys/linux
-LIBKRB5CRYPTO_CFLAGS += -I$(LIBNEWLIB_LIBC)/sys/linux/sys
 LIBKRB5CRYPTO_OBJFLAGS = $(LIBKRB5_OBJFLAGS)
 
 ##############################################################################################
@@ -189,11 +399,6 @@ LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/builtin/hmac.c
 LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/builtin/init.c
 LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/builtin/pbkdf2.c
 
-##############################################################################################
-# libcom_err flags
-##############################################################################################
-LIBCOM_ERR_CFLAGS = $(LIBKRB5_CFLAGS)
-
 ##############################################################################################
 # libcom_err code
 ##############################################################################################
@@ -207,7 +412,9 @@ LIBCOM_ERR_SRCS-y += $(LIBKRB5_COMPILE_PATH)/com_err.c
 # Run ./configure
 $(LIBKRB5_MAINDIR)/.configured: $(LIBKRB5_BUILD)/.origin
 	$(call verbose_cmd,CONFIG,libkrb: $(notdir $@), cd $(LIBKRB5_MAINDIR) && ./configure \
-	--disable-nls && touch $@)
+	--disable-nls && touch $@ && cd include && \
+	sed -e "s/#define HAVE_SECURE_GETENV 1/\/\* #undef HAVE_SECURE_GETENV \*\//" autoconf.h > \
+	autoconf.temp && mv autoconf.temp autoconf.h)
 
 # Generate compile_et
 $(LIBKRB5_COMPILE_PATH)/compile_et:
-- 
2.25.1



From minios-devel-bounces@lists.xenproject.org Thu Aug 20 09:46:39 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Thu, 20 Aug 2020 09:46:39 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1k8h9b-0008BV-Qn; Thu, 20 Aug 2020 09:46:39 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=WisD=B6=gmail.com=cristianvijelie@srs-us1.protection.inumbo.net>)
 id 1k8h9b-00089A-3J
 for minios-devel@lists.xen.org; Thu, 20 Aug 2020 09:46:39 +0000
X-Inumbo-ID: 185b094e-7a25-4367-9d14-9a5c89934fef
Received: from mail-ej1-x62b.google.com (unknown [2a00:1450:4864:20::62b])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 185b094e-7a25-4367-9d14-9a5c89934fef;
 Thu, 20 Aug 2020 09:46:30 +0000 (UTC)
Received: by mail-ej1-x62b.google.com with SMTP id o18so1727465eje.7
 for <minios-devel@lists.xen.org>; Thu, 20 Aug 2020 02:46:30 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=from:to:cc:subject:date:message-id:in-reply-to:references
 :mime-version:content-transfer-encoding;
 bh=oshyL7tw7R9DlVneQwZKCxmhGdp4Z58wb+gIYLeXSy8=;
 b=hKjPCEAY3iVrrELAsWdl8BwqwcX/9Awh4kajX0fs4xcuEAIygSVxaYX7arznPycenx
 5qQaUbwYkX5f3qpUGUN85FZkOsjusJuYQF3QkU6KsarZK31BjOo5ljBNggDwHk7xivZi
 hZcHrckhj1r8O6JHQ2WIFnZIY1kefgddF5W+3hJZhxRmwXnz5QbCCYPuSmvDkiAPzPxd
 Bw6A4Qfy53sB1CA+ivQn3cJIG9iDCjzf0e2zxkYJkFks1/QWIeYkNb/A55WKb0AcRPdr
 Svgsr7UIOwE7dXeGFrkyrAD1LgJ4RSBn7ay0KRgWxwWw4HBV5TBQUMqLFYNFbG5dlYGF
 YKVg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to
 :references:mime-version:content-transfer-encoding;
 bh=oshyL7tw7R9DlVneQwZKCxmhGdp4Z58wb+gIYLeXSy8=;
 b=c5bUdVk+CgUr5xQrWiGoQmgEUZHqNNuKmSG5v/bM/35/1nPESCEGJQMp6xJ5P7anV4
 ZVcGKB4AVV+uxPWX8R9C8EiYRorwJeLJxoOy2XIbTIewvREgEMuATGxB92gcP9c6lb1B
 QqyavzF5HOIg2aa/tVpnp3SK3GhMaK/ylHsNcoiY97MZvK/Wtd2zZtBtRaA+hDUb5xWh
 ShAsJDbQ5GZv0GTOP8Ff7CXkhcRV/jl33VSioe7yWi5Ij54ztlRCt5tyQ0Jdh1VV5v/r
 evc/lsQqT+nlYTSHiLXaf4HIe1H5/AseHr1Isrpk6hU/sDvq51KKU59d2G/H7GfwEtsd
 vo7Q==
X-Gm-Message-State: AOAM531f7CrSYYWnHDxt9n9F4uAL8o/yVbJxvLcDSms297xhZrXDaJEo
 whUdeTuCDUCIMBsQrxrfcyvajnk/vno=
X-Google-Smtp-Source: ABdhPJzB6tkX6hGe5ICVwWN/LYBcKHCJdsF9cyctQkDcW9fFMBaJp71pbkqSwnrCpktqlbB7AVAjKg==
X-Received: by 2002:a17:906:1b0e:: with SMTP id
 o14mr2370164ejg.472.1597916788908; 
 Thu, 20 Aug 2020 02:46:28 -0700 (PDT)
Received: from localhost.localdomain ([82.137.12.155])
 by smtp.gmail.com with ESMTPSA id y9sm994789edt.34.2020.08.20.02.46.26
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Thu, 20 Aug 2020 02:46:28 -0700 (PDT)
From: cristianvijelie@gmail.com
To: minios-devel@lists.xen.org
Cc: Cristian <cristianvijelie@gmail.com>
Subject: [UNIKRAFT PATCH 1/4] Ported libkrb5support,
 libkrb5crypto and libcom_err
Date: Thu, 20 Aug 2020 12:46:20 +0300
Message-Id: <20200820094623.77456-2-cristianvijelie@gmail.com>
X-Mailer: git-send-email 2.25.1
In-Reply-To: <20200820094623.77456-1-cristianvijelie@gmail.com>
References: <20200820094623.77456-1-cristianvijelie@gmail.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-BeenThere: minios-devel@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Mini-os development list <minios-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:minios-devel@lists.xenproject.org>
List-Help: <mailto:minios-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: minios-devel-bounces@lists.xenproject.org
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>

From: Cristian <cristianvijelie@gmail.com>

Signed-off-by: Cristian <cristianvijelie@gmail.com>
---
 .gitignore         |   3 +
 Config.uk          |  34 +++++
 Makefile.uk        | 354 +++++++++++++++++++++++++++++++++++++++++++++
 include/byteswap.h |  26 ++++
 4 files changed, 417 insertions(+)
 create mode 100644 .gitignore
 create mode 100644 Config.uk
 create mode 100644 Makefile.uk
 create mode 100644 include/byteswap.h

diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..890d606
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,3 @@
+krb5-1.18.2
+*_make
+make_log
diff --git a/Config.uk b/Config.uk
new file mode 100644
index 0000000..73176de
--- /dev/null
+++ b/Config.uk
@@ -0,0 +1,34 @@
+menuconfig LIBKRB5
+    bool "libkrb5: MIT Kerberos runtime libraries"
+    select LIBKRB5SUPPORT
+    select LIBKRB5CRYPTO
+    select LIBCOM_ERR
+    default n
+
+menuconfig LIBKRB5SUPPORT
+    bool "likrb5support: MIT Kerberos support libraries"
+    select LIBNEWLIB
+    select LIBPTHREAD_EMBEDDED
+    select LIBLWIP
+    select LWIP_UKNETDEV
+	select LWIP_TCP
+	select LWIP_TCP_KEEPALIVE
+	select LWIP_THREADS
+	select LWIP_SOCKET
+	select LWIP_IPV4
+    select LWIP_IPV6
+    default n
+
+menuconfig LIBKRB5CRYPTO
+    bool "lib5crypto: MIT Kerberos crypto libraries"
+    select LIBKRB5SUPPORT
+    default n
+
+menuconfig LIBGSSAPI_KRB5
+    bool "libgssapi_krb5: MIT Kerberos GSS-API mechanism"
+    default n
+
+menuconfig LIBCOM_ERR
+    bool "libcom_err: Common error description library"
+    select LIBKRB5SUPPORT
+    default n
diff --git a/Makefile.uk b/Makefile.uk
new file mode 100644
index 0000000..eea8972
--- /dev/null
+++ b/Makefile.uk
@@ -0,0 +1,354 @@
+##############################################################################################
+# Library registration
+##############################################################################################
+$(eval $(call addlib_s,libkrb5,$(CONFIG_LIBKRB5)))
+$(eval $(call addlib_s,libkrb5support,$(CONFIG_LIBKRB5SUPPORT)))
+$(eval $(call addlib_s,libkrb5crypto,$(CONFIG_LIBKRB5CRYPTO)))
+$(eval $(call addlib_s,libcom_err,$(CONFIG_LIBCOM_ERR)))
+
+##############################################################################################
+# SOURCES
+##############################################################################################
+LIBKRB5_MAJORVER=1.18
+LIBKRB5_MINORVER=2
+LIBKRB5_TARNAME=krb5-$(LIBKRB5_MAJORVER).$(LIBKRB5_MINORVER)
+LIBKRB5_URL=http://web.mit.edu/kerberos/dist/krb5/$(LIBKRB5_MAJORVER)/$(LIBKRB5_TARNAME).tar.gz
+LIBKRB5_PATCHDIR=$(LIBKRB5_BASE)/patches
+$(eval $(call fetch,libkrb5,$(LIBKRB5_URL)))
+$(eval $(call patch,libkrb5,$(LIBKRB5_PATCHDIR),$(LIBKRB5_TARNAME)))
+
+##############################################################################################
+# Helpers
+##############################################################################################
+LIBKRB5_MAINDIR=$(LIBKRB5_ORIGIN)/$(LIBKRB5_TARNAME)/src
+LIBKRB5_COMPILE_PATH=$(LIBKRB5_MAINDIR)/util/et
+LIBKRB5_DIR=$(LIBKRB5_MAINDIR)/lib/krb5
+
+LIBKRB5SUPPORT_DIR=$(LIBKRB5_MAINDIR)/util/support
+LIBKRB5CRYPTO_DIR=$(LIBKRB5_MAINDIR)/lib/crypto
+
+##############################################################################################
+# libkrb5 flags
+##############################################################################################
+LIBKRB5_CFLAGS += -fPIC -DSHARED -DHAVE_CONFIG_H  -I$(LIBKRB5_BASE)/include \
+-I$(LIBKRB5_MAINDIR)/include  -DKRB5_DEPRECATED=1 -DKRB5_PRIVATE -Wall -Wcast-align -Wshadow \
+-Wmissing-prototypes -Wno-format-zero-length -Woverflow -Wstrict-overflow \
+-Wmissing-format-attribute -Wmissing-prototypes -Wreturn-type -Wmissing-braces -Wparentheses \
+-Wswitch -Wunused-function -Wunused-label -Wunused-variable -Wunused-value -Wunknown-pragmas \
+-Wsign-compare -Werror=uninitialized -Wno-maybe-uninitialized -Werror=pointer-arith \
+-Werror=int-conversion -Werror=incompatible-pointer-types -Werror=discarded-qualifiers \
+-Werror=implicit-int -Werror=declaration-after-statement -Werror-implicit-function-declaration
+
+LIBKRB5_OBJFLAGS += -shared -fPIC -Wl,--no-undefined -Wl,--enable-new-dtags \
+-Wl,-rpath
+
+##############################################################################################
+# libkrb5 code
+##############################################################################################
+LIBKRB5_SRCS-y += 
+
+##############################################################################################
+# libkrb5support flags
+##############################################################################################
+
+LIBKRB5SUPPORT_CFLAGS = $(LIBKRB5_CFLAGS)
+LIBKRB5SUPPORT_CFLAGS += -I$(LIBNEWLIB_LIBC)/sys/linux/include
+LIBKRB5SUPPORT_CFLAGS += -I$(LIBNEWLIB_LIBC)/sys/linux
+LIBKRB5SUPPORT_CFLAGS += -I$(LIBNEWLIB_LIBC)/sys/linux/sys
+LIBKRB5SUPPORT_OBJFLAGS = $(LIBKRB5_OBJFLAGS)
+
+##############################################################################################
+# libkrb5support code
+##############################################################################################
+LIBKRB5SUPPORT_SRCS-y += $(LIBKRB5SUPPORT_DIR)/threads.c
+LIBKRB5SUPPORT_SRCS-y += $(LIBKRB5SUPPORT_DIR)/init-addrinfo.c
+LIBKRB5SUPPORT_SRCS-y += $(LIBKRB5SUPPORT_DIR)/plugins.c
+LIBKRB5SUPPORT_SRCS-y += $(LIBKRB5SUPPORT_DIR)/errors.c
+LIBKRB5SUPPORT_SRCS-y += $(LIBKRB5SUPPORT_DIR)/k5buf.c
+LIBKRB5SUPPORT_SRCS-y += $(LIBKRB5SUPPORT_DIR)/gmt_mktime.c
+LIBKRB5SUPPORT_SRCS-y += $(LIBKRB5SUPPORT_DIR)/fake-addrinfo.c
+LIBKRB5SUPPORT_SRCS-y += $(LIBKRB5SUPPORT_DIR)/utf8.c
+LIBKRB5SUPPORT_SRCS-y += $(LIBKRB5SUPPORT_DIR)/utf8_conv.c
+LIBKRB5SUPPORT_SRCS-y += $(LIBKRB5SUPPORT_DIR)/zap.c
+LIBKRB5SUPPORT_SRCS-y += $(LIBKRB5SUPPORT_DIR)/path.c
+LIBKRB5SUPPORT_SRCS-y += $(LIBKRB5SUPPORT_DIR)/base64.c
+LIBKRB5SUPPORT_SRCS-y += $(LIBKRB5SUPPORT_DIR)/json.c
+LIBKRB5SUPPORT_SRCS-y += $(LIBKRB5SUPPORT_DIR)/hex.c
+LIBKRB5SUPPORT_SRCS-y += $(LIBKRB5SUPPORT_DIR)/hashtab.c
+LIBKRB5SUPPORT_SRCS-y += $(LIBKRB5SUPPORT_DIR)/bcmp.c
+LIBKRB5SUPPORT_SRCS-y += $(LIBKRB5SUPPORT_DIR)/strerror_r.c
+LIBKRB5SUPPORT_SRCS-y += $(LIBKRB5SUPPORT_DIR)/dir_filenames.c
+LIBKRB5SUPPORT_SRCS-y += $(LIBKRB5SUPPORT_DIR)/strlcpy.c
+
+##############################################################################################
+# libkrb5crypto flags
+##############################################################################################
+LIBKRB5CRYPTO_CFLAGS = $(LIBKRB5_CFLAGS)
+LIBKRB5CRYPTO_CFLAGS += -I$(LIBKRB5CRYPTO_DIR)/krb
+LIBKRB5CRYPTO_CFLAGS += -I$(LIBKRB5CRYPTO_DIR)/builtin
+LIBKRB5CRYPTO_CFLAGS += -I$(LIBKRB5CRYPTO_DIR)/builtin/aes
+LIBKRB5CRYPTO_CFLAGS += -I$(LIBKRB5CRYPTO_DIR)/builtin/camellia
+LIBKRB5CRYPTO_CFLAGS += -I$(LIBKRB5CRYPTO_DIR)/builtin/des
+LIBKRB5CRYPTO_CFLAGS += -I$(LIBKRB5CRYPTO_DIR)/builtin/md4
+LIBKRB5CRYPTO_CFLAGS += -I$(LIBKRB5CRYPTO_DIR)/builtin/md5
+LIBKRB5CRYPTO_CFLAGS += -I$(LIBKRB5CRYPTO_DIR)/builtin/sha1
+LIBKRB5CRYPTO_CFLAGS += -I$(LIBKRB5CRYPTO_DIR)/builtin/sha2
+LIBKRB5CRYPTO_CFLAGS += -I$(LIBNEWLIB_LIBC)/sys/linux/include
+LIBKRB5CRYPTO_CFLAGS += -I$(LIBNEWLIB_LIBC)/sys/linux
+LIBKRB5CRYPTO_CFLAGS += -I$(LIBNEWLIB_LIBC)/sys/linux/sys
+LIBKRB5CRYPTO_OBJFLAGS = $(LIBKRB5_OBJFLAGS)
+
+##############################################################################################
+# libkrb5crypto code
+##############################################################################################
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/krb/aead.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/krb/block_size.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/krb/cf2.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/krb/checksum_dk_cmac.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/krb/checksum_dk_hmac.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/krb/checksum_etm.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/krb/checksum_hmac_md5.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/krb/checksum_unkeyed.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/krb/checksum_length.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/krb/cksumtype_to_string.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/krb/cksumtypes.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/krb/cmac.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/krb/coll_proof_cksum.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/krb/crypto_length.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/krb/crypto_libinit.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/krb/default_state.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/krb/decrypt.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/krb/decrypt_iov.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/krb/derive.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/krb/encrypt.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/krb/encrypt_iov.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/krb/encrypt_length.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/krb/enctype_util.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/krb/enc_dk_cmac.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/krb/enc_dk_hmac.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/krb/enc_etm.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/krb/enc_raw.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/krb/enc_rc4.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/krb/etypes.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/krb/key.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/krb/keyblocks.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/krb/keyed_cksum.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/krb/keyed_checksum_types.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/krb/keylengths.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/krb/make_checksum.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/krb/make_checksum_iov.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/krb/make_random_key.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/krb/mandatory_sumtype.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/krb/nfold.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/krb/old_api_glue.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/krb/prf.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/krb/prf_aes2.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/krb/prf_cmac.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/krb/prf_des.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/krb/prf_dk.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/krb/prf_rc4.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/krb/prng.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/krb/prng_fortuna.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/krb/random_to_key.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/krb/s2k_pbkdf2.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/krb/s2k_rc4.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/krb/state.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/krb/string_to_cksumtype.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/krb/string_to_key.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/krb/valid_cksumtype.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/krb/verify_checksum.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/krb/verify_checksum_iov.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/builtin/camellia/camellia.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/builtin/des/d3_aead.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/builtin/des/d3_kysched.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/builtin/des/des_keys.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/builtin/des/f_aead.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/builtin/des/f_cksum.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/builtin/des/f_parity.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/builtin/des/f_sched.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/builtin/des/f_tables.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/builtin/des/key_sched.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/builtin/des/weak_key.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/builtin/aes/aescrypt.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/builtin/aes/aestab.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/builtin/aes/aeskey.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/builtin/md4/md4.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/builtin/md5/md5.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/builtin/sha1/shs.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/builtin/sha2/sha256.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/builtin/sha2/sha512.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/builtin/enc_provider/des3.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/builtin/enc_provider/rc4.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/builtin/enc_provider/aes.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/builtin/enc_provider/enc_camellia.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/builtin/hash_provider/hash_md4.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/builtin/hash_provider/hash_md5.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/builtin/hash_provider/hash_sha1.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/builtin/hash_provider/hash_sha2.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/builtin/hmac.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/builtin/init.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/builtin/pbkdf2.c
+
+##############################################################################################
+# libcom_err flags
+##############################################################################################
+LIBCOM_ERR_CFLAGS = $(LIBKRB5_CFLAGS)
+
+##############################################################################################
+# libcom_err code
+##############################################################################################
+LIBCOM_ERR_SRCS-y += $(LIBKRB5_COMPILE_PATH)/error_message.c
+LIBCOM_ERR_SRCS-y += $(LIBKRB5_COMPILE_PATH)/et_name.c
+LIBCOM_ERR_SRCS-y += $(LIBKRB5_COMPILE_PATH)/com_err.c
+
+##############################################################################################
+# dependencies
+##############################################################################################
+# Run ./configure
+$(LIBKRB5_MAINDIR)/.configured: $(LIBKRB5_BUILD)/.origin
+	$(call verbose_cmd,CONFIG,libkrb: $(notdir $@), cd $(LIBKRB5_MAINDIR) && ./configure \
+	--disable-nls && touch $@)
+
+# Generate compile_et
+$(LIBKRB5_COMPILE_PATH)/compile_et:
+	$(call verbose_cmd,GEN,libkrb: $(notdir $@), cd $(LIBKRB5_COMPILE_PATH) && /bin/sh \
+	./config_script ./compile_et.sh "/usr/local/share/et" mawk sed > $@ && chmod 755 $@)
+
+# Generate .h and .c files
+$(LIBKRB5_MAINDIR)/include/osconf.h: $(LIBKRB5_MAINDIR)/include/osconf.hin
+	$(call verbose_cmd,GEN,libkrb: $(notdir $@), cat $^ | sed -e "s\"@KRB5RCTMPDIR\"/var/tmp\""\
+	 -e "s\"@PREFIX\"/usr/local\"" -e "s\"@EXEC_PREFIX\"/usr/local\"" \
+	 -e "s\"@BINDIR\"/usr/local/bin\"" -e "s\"@LIBDIR\"/usr/local/lib\"" \
+	 -e "s\"@SBINDIR\"/usr/local/sbin\"" -e "s\"@MODULEDIR\"/usr/local/lib/krb5/plugins\"" \
+	 -e "s\"@GSSMODULEDIR\"/usr/local/lib/gss\"" -e "s\"@LOCALSTATEDIR\"/usr/local/var\"" \
+	 -e "s\"@RUNSTATEDIR\"/run\"" -e "s\"@SYSCONFDIR\"/usr/local/etc\"" \
+	 -e "s\"@DYNOBJEXT\".so\"" -e "s\"@SYSCONFCONF\":/usr/local/etc/krb5.conf\"" > osconf.new \
+	 && $(LIBKRB5_MAINDIR)/config/move-if-changed osconf.new $@)
+
+$(LIBKRB5_MAINDIR)/include/com_err.h: $(LIBKRB5_COMPILE_PATH)/com_err.h
+	$(call verbose_cmd,GEN,libkrb: $(notdir $@), cp $^ $@)
+
+$(LIBKRB5_MAINDIR)/include/profile.h: $(LIBKRB5_MAINDIR)/util/profile/profile.hin $(LIBKRB5_MAINDIR)/util/profile/prof_err.h
+	$(call verbose_cmd,GEN,libkrb: $(notdir $@), cat $^ > $@)
+
+$(LIBKRB5_MAINDIR)/include/krb5/krb5.h: $(LIBKRB5_MAINDIR)/include/krb5/krb5.hin
+	$(call verbose_cmd,GEN,libkrb: $(notdir $@), cd $(LIBKRB5_MAINDIR)/include && echo "#ifndef KRB5_KRB5_H_INCLUDED" >> krb5/krb5.new && echo "#define KRB5_KRB5_H_INCLUDED" >> krb5/krb5.new && cat krb5/krb5.hin $(LIBKRB5_MAINDIR)/lib/krb5/error_tables/krb5_err.h $(LIBKRB5_MAINDIR)/lib/krb5/error_tables/k5e1_err.h $(LIBKRB5_MAINDIR)/lib/krb5/error_tables/kdb5_err.h $(LIBKRB5_MAINDIR)/lib/krb5/error_tables/kv5m_err.h $(LIBKRB5_MAINDIR)/lib/krb5/error_tables/krb524_err.h $(LIBKRB5_MAINDIR)/lib/krb5/error_tables/asn1_err.h >> krb5/krb5.new && echo "#endif /* KRB5_KRB5_H_INCLUDED */" >> krb5/krb5.new && $(LIBKRB5_MAINDIR)/config/move-if-changed krb5/krb5.new krb5/krb5.h)
+
+$(LIBKRB5_DIR)/error_tables/et-c-asn1_err.et: $(LIBKRB5_DIR)/error_tables/asn1_err.et
+	$(call verbose_cmd,GEN,libkrb: $(notdir $@), cd $(LIBKRB5_DIR)/error_tables && rm -f et-c-asn1_err.et et-c-asn1_err.c et-c-asn1_err.h && cp $^ $@)
+$(LIBKRB5_DIR)/error_tables/et-c-asn1_err.c: $(LIBKRB5_DIR)/error_tables/et-c-asn1_err.et
+	$(call verbose_cmd,GEN,libkrb: $(notdir $@), cd $(LIBKRB5_DIR)/error_tables && $(LIBKRB5_COMPILE_PATH)/compile_et -d $(LIBKRB5_COMPILE_PATH) --textdomain mit-krb5 $^)
+$(LIBKRB5_DIR)/error_tables/asn1_err.c: $(LIBKRB5_DIR)/error_tables/et-c-asn1_err.c
+	$(call verbose_cmd,GEN,libkrb: $(notdir $@), cd $(LIBKRB5_DIR)/error_tables && mv -f $^ $@ && rm -f et-c-asn1_err.et et-c-asn1_err.h)
+
+$(LIBKRB5_DIR)/error_tables/et-c-kdb5_err.et: $(LIBKRB5_DIR)/error_tables/kdb5_err.et
+	$(call verbose_cmd,GEN,libkrb: $(notdir $@), cd $(LIBKRB5_DIR)/error_tables && rm -f et-c-kdb5_err.et et-c-kdb5_err.c et-c-kdb5_err.h && cp $^ $@)
+$(LIBKRB5_DIR)/error_tables/et-c-kdb5_err.c: $(LIBKRB5_DIR)/error_tables/et-c-kdb5_err.et
+	$(call verbose_cmd,GEN,libkrb: $(notdir $@), cd $(LIBKRB5_DIR)/error_tables && $(LIBKRB5_COMPILE_PATH)/compile_et -d $(LIBKRB5_COMPILE_PATH) --textdomain mit-krb5 $^)
+$(LIBKRB5_DIR)/error_tables/kdb5_err.c: $(LIBKRB5_DIR)/error_tables/et-c-kdb5_err.c
+	$(call verbose_cmd,GEN,libkrb: $(notdir $@), cd $(LIBKRB5_DIR)/error_tables && mv -f $^ $@ && rm -f et-c-kdb5_err.et et-c-kdb5_err.h)
+
+$(LIBKRB5_DIR)/error_tables/et-c-krb5_err.et: $(LIBKRB5_DIR)/error_tables/krb5_err.et
+	$(call verbose_cmd,GEN,libkrb: $(notdir $@), cd $(LIBKRB5_DIR)/error_tables && rm -f et-c-krb5_err.et et-c-krb5_err.c et-c-krb5_err.h && cp $^ $@)
+$(LIBKRB5_DIR)/error_tables/et-c-krb5_err.c: $(LIBKRB5_DIR)/error_tables/et-c-krb5_err.et
+	$(call verbose_cmd,GEN,libkrb: $(notdir $@), cd $(LIBKRB5_DIR)/error_tables && $(LIBKRB5_COMPILE_PATH)/compile_et -d $(LIBKRB5_COMPILE_PATH) --textdomain mit-krb5 $^)
+$(LIBKRB5_DIR)/error_tables/krb5_err.c: $(LIBKRB5_DIR)/error_tables/et-c-krb5_err.c
+	$(call verbose_cmd,GEN,libkrb: $(notdir $@), cd $(LIBKRB5_DIR)/error_tables && mv -f $^ $@ && rm -f et-c-krb5_err.et et-c-krb5_err.h)
+
+$(LIBKRB5_DIR)/error_tables/et-c-k5e1_err.et: $(LIBKRB5_DIR)/error_tables/k5e1_err.et
+	$(call verbose_cmd,GEN,libkrb: $(notdir $@), cd $(LIBKRB5_DIR)/error_tables && rm -f et-c-k5e1_err.et et-c-k5e1_err.c et-c-k5e1_err.h && cp $^ $@)
+$(LIBKRB5_DIR)/error_tables/et-c-k5e1_err.c: $(LIBKRB5_DIR)/error_tables/et-c-k5e1_err.et
+	$(call verbose_cmd,GEN,libkrb: $(notdir $@), cd $(LIBKRB5_DIR)/error_tables && $(LIBKRB5_COMPILE_PATH)/compile_et -d $(LIBKRB5_COMPILE_PATH) --textdomain mit-krb5 $^)
+$(LIBKRB5_DIR)/error_tables/k5e1_err.c: $(LIBKRB5_DIR)/error_tables/et-c-k5e1_err.c
+	$(call verbose_cmd,GEN,libkrb: $(notdir $@), cd $(LIBKRB5_DIR)/error_tables && mv -f $^ $@ && rm -f et-c-k5e1_err.et et-c-k5e1_err.h)
+
+$(LIBKRB5_DIR)/error_tables/et-c-kv5m_err.et: $(LIBKRB5_DIR)/error_tables/kv5m_err.et
+	$(call verbose_cmd,GEN,libkrb: $(notdir $@), cd $(LIBKRB5_DIR)/error_tables && rm -f et-c-kv5m_err.et et-c-kv5m_err.c et-c-kv5m_err.h && cp $^ $@)
+$(LIBKRB5_DIR)/error_tables/et-c-kv5m_err.c: $(LIBKRB5_DIR)/error_tables/et-c-kv5m_err.et
+	$(call verbose_cmd,GEN,libkrb: $(notdir $@), cd $(LIBKRB5_DIR)/error_tables && $(LIBKRB5_COMPILE_PATH)/compile_et -d $(LIBKRB5_COMPILE_PATH) --textdomain mit-krb5 $^)
+$(LIBKRB5_DIR)/error_tables/kv5m_err.c: $(LIBKRB5_DIR)/error_tables/et-c-kv5m_err.c
+	$(call verbose_cmd,GEN,libkrb: $(notdir $@), cd $(LIBKRB5_DIR)/error_tables && mv -f $^ $@ && rm -f et-c-kv5m_err.et et-c-kv5m_err.h)
+
+$(LIBKRB5_DIR)/error_tables/et-c-krb524_err.et: $(LIBKRB5_DIR)/error_tables/krb524_err.et
+	$(call verbose_cmd,GEN,libkrb: $(notdir $@), cd $(LIBKRB5_DIR)/error_tables && rm -f et-c-krb524_err.et et-c-krb524_err.c et-c-krb524_err.h && cp $^ $@)
+$(LIBKRB5_DIR)/error_tables/et-c-krb524_err.c: $(LIBKRB5_DIR)/error_tables/et-c-krb524_err.et
+	$(call verbose_cmd,GEN,libkrb: $(notdir $@), cd $(LIBKRB5_DIR)/error_tables && $(LIBKRB5_COMPILE_PATH)/compile_et -d $(LIBKRB5_COMPILE_PATH) --textdomain mit-krb5 $^)
+$(LIBKRB5_DIR)/error_tables/krb524_err.c: $(LIBKRB5_DIR)/error_tables/et-c-krb524_err.c
+	$(call verbose_cmd,GEN,libkrb: $(notdir $@), cd $(LIBKRB5_DIR)/error_tables && mv -f $^ $@ && rm -f et-c-krb524_err.et et-c-krb524_err.h)
+
+$(LIBKRB5_DIR)/error_tables/et-h-asn1_err.et: $(LIBKRB5_DIR)/error_tables/asn1_err.et
+	$(call verbose_cmd,GEN,libkrb: $(notdir $@), cd $(LIBKRB5_DIR)/error_tables && rm -f et-h-asn1_err.et et-h-asn1_err.c et-h-asn1_err.h && cp $^ $@)
+$(LIBKRB5_DIR)/error_tables/et-h-asn1_err.h: $(LIBKRB5_DIR)/error_tables/et-h-asn1_err.et
+	$(call verbose_cmd,GEN,libkrb: $(notdir $@), cd $(LIBKRB5_DIR)/error_tables && $(LIBKRB5_COMPILE_PATH)/compile_et -d $(LIBKRB5_COMPILE_PATH) --textdomain mit-krb5 $^)
+$(LIBKRB5_DIR)/error_tables/asn1_err.h: $(LIBKRB5_DIR)/error_tables/et-h-asn1_err.h
+	$(call verbose_cmd,GEN,libkrb: $(notdir $@), cd $(LIBKRB5_DIR)/error_tables && mv -f $^ $@ && rm -f et-h-asn1_err.et et-h-asn1_err.c)
+
+$(LIBKRB5_DIR)/error_tables/et-h-kdb5_err.et: $(LIBKRB5_DIR)/error_tables/kdb5_err.et
+	$(call verbose_cmd,GEN,libkrb: $(notdir $@), cd $(LIBKRB5_DIR)/error_tables && rm -f et-h-kdb5_err.et et-h-kdb5_err.c et-h-kdb5_err.h && cp $^ $@)
+$(LIBKRB5_DIR)/error_tables/et-h-kdb5_err.h: $(LIBKRB5_DIR)/error_tables/et-h-kdb5_err.et
+	$(call verbose_cmd,GEN,libkrb: $(notdir $@), cd $(LIBKRB5_DIR)/error_tables && $(LIBKRB5_COMPILE_PATH)/compile_et -d $(LIBKRB5_COMPILE_PATH) --textdomain mit-krb5 $^)
+$(LIBKRB5_DIR)/error_tables/kdb5_err.h: $(LIBKRB5_DIR)/error_tables/et-h-kdb5_err.h
+	$(call verbose_cmd,GEN,libkrb: $(notdir $@), cd $(LIBKRB5_DIR)/error_tables && mv -f $^ $@ && rm -f et-h-kdb5_err.et et-h-kdb5_err.c)
+
+$(LIBKRB5_DIR)/error_tables/et-h-krb5_err.et: $(LIBKRB5_DIR)/error_tables/krb5_err.et
+	$(call verbose_cmd,GEN,libkrb: $(notdir $@), cd $(LIBKRB5_DIR)/error_tables && rm -f et-h-krb5_err.et et-h-krb5_err.c et-h-krb5_err.h && cp $^ $@)
+$(LIBKRB5_DIR)/error_tables/et-h-krb5_err.h: $(LIBKRB5_DIR)/error_tables/et-h-krb5_err.et
+	$(call verbose_cmd,GEN,libkrb: $(notdir $@), cd $(LIBKRB5_DIR)/error_tables && $(LIBKRB5_COMPILE_PATH)/compile_et -d $(LIBKRB5_COMPILE_PATH) --textdomain mit-krb5 $^)
+$(LIBKRB5_DIR)/error_tables/krb5_err.h: $(LIBKRB5_DIR)/error_tables/et-h-krb5_err.h
+	$(call verbose_cmd,GEN,libkrb: $(notdir $@), cd $(LIBKRB5_DIR)/error_tables && mv -f $^ $@ && rm -f et-h-krb5_err.et et-h-krb5_err.c)
+
+$(LIBKRB5_DIR)/error_tables/et-h-k5e1_err.et: $(LIBKRB5_DIR)/error_tables/k5e1_err.et
+	$(call verbose_cmd,GEN,libkrb: $(notdir $@), cd $(LIBKRB5_DIR)/error_tables && rm -f et-h-k5e1_err.et et-h-k5e1_err.c et-h-k5e1_err.h && cp $^ $@)
+$(LIBKRB5_DIR)/error_tables/et-h-k5e1_err.h: $(LIBKRB5_DIR)/error_tables/et-h-k5e1_err.et
+	$(call verbose_cmd,GEN,libkrb: $(notdir $@), cd $(LIBKRB5_DIR)/error_tables && $(LIBKRB5_COMPILE_PATH)/compile_et -d $(LIBKRB5_COMPILE_PATH) --textdomain mit-krb5 $^)
+$(LIBKRB5_DIR)/error_tables/k5e1_err.h: $(LIBKRB5_DIR)/error_tables/et-h-k5e1_err.h
+	$(call verbose_cmd,GEN,libkrb: $(notdir $@), cd $(LIBKRB5_DIR)/error_tables && mv -f $^ $@ && rm -f et-h-k5e1_err.et et-h-k5e1_err.c)
+
+$(LIBKRB5_DIR)/error_tables/et-h-kv5m_err.et: $(LIBKRB5_DIR)/error_tables/kv5m_err.et
+	$(call verbose_cmd,GEN,libkrb: $(notdir $@), cd $(LIBKRB5_DIR)/error_tables && rm -f et-h-kv5m_err.et et-h-kv5m_err.c et-h-kv5m_err.h && cp $^ $@)
+$(LIBKRB5_DIR)/error_tables/et-h-kv5m_err.h: $(LIBKRB5_DIR)/error_tables/et-h-kv5m_err.et
+	$(call verbose_cmd,GEN,libkrb: $(notdir $@), cd $(LIBKRB5_DIR)/error_tables && $(LIBKRB5_COMPILE_PATH)/compile_et -d $(LIBKRB5_COMPILE_PATH) --textdomain mit-krb5 $^)
+$(LIBKRB5_DIR)/error_tables/kv5m_err.h: $(LIBKRB5_DIR)/error_tables/et-h-kv5m_err.h
+	$(call verbose_cmd,GEN,libkrb: $(notdir $@), cd $(LIBKRB5_DIR)/error_tables && mv -f $^ $@ && rm -f et-h-kv5m_err.et et-h-kv5m_err.c)
+
+$(LIBKRB5_DIR)/error_tables/et-h-krb524_err.et: $(LIBKRB5_DIR)/error_tables/krb524_err.et
+	$(call verbose_cmd,GEN,libkrb: $(notdir $@), cd $(LIBKRB5_DIR)/error_tables && rm -f et-h-krb524_err.et et-h-krb524_err.c et-h-krb524_err.h && cp $^ $@)
+$(LIBKRB5_DIR)/error_tables/et-h-krb524_err.h: $(LIBKRB5_DIR)/error_tables/et-h-krb524_err.et
+	$(call verbose_cmd,GEN,libkrb: $(notdir $@), cd $(LIBKRB5_DIR)/error_tables && $(LIBKRB5_COMPILE_PATH)/compile_et -d $(LIBKRB5_COMPILE_PATH) --textdomain mit-krb5 $^)
+$(LIBKRB5_DIR)/error_tables/krb524_err.h: $(LIBKRB5_DIR)/error_tables/et-h-krb524_err.h
+	$(call verbose_cmd,GEN,libkrb: $(notdir $@), cd $(LIBKRB5_DIR)/error_tables && mv -f $^ $@ && rm -f et-h-krb524_err.et et-h-krb524_err.c)
+
+$(LIBKRB5_MAINDIR)/util/profile/et-h-prof_err.et: $(LIBKRB5_MAINDIR)/util/profile/prof_err.et
+	$(call verbose_cmd,GEN,libkrb: $(notdir $@), cd $(LIBKRB5_MAINDIR)/util/profile && rm -f et-h-prof_err.et et-h-prof_err.c et-h-prof_err.h && cp $^ $@)
+$(LIBKRB5_MAINDIR)/util/profile/et-h-prof_err.h: $(LIBKRB5_MAINDIR)/util/profile/et-h-prof_err.et
+	$(call verbose_cmd,GEN,libkrb: $(notdir $@), cd $(LIBKRB5_MAINDIR)/util/profile && $(LIBKRB5_COMPILE_PATH)/compile_et -d $(LIBKRB5_COMPILE_PATH) --textdomain mit-krb5 $^)
+$(LIBKRB5_MAINDIR)/util/profile/prof_err.h: $(LIBKRB5_MAINDIR)/util/profile/et-h-prof_err.h
+	$(call verbose_cmd,GEN,libkrb: $(notdir $@), cd $(LIBKRB5_MAINDIR)/util/profile && mv -f $^ $@ && rm -f et-h-prof_err.et et-h-prof_err.c)
+
+# There are 2 camellia.c in the library, so we must differentiate them
+$(LIBKRB5CRYPTO_DIR)/builtin/enc_provider/enc_camellia.c: $(LIBKRB5CRYPTO_DIR)/builtin/enc_provider/camellia.c
+	$(call verbose_cmd,GEN,libkrb5crypto: $(notdir $@), cp $^ $@)
+
+LIBKRB5_DEPS = \
+	$(LIBKRB5_MAINDIR)/.configured \
+	$(LIBKRB5_MAINDIR)/include/osconf.h \
+	$(LIBKRB5_MAINDIR)/include/com_err.h \
+	$(LIBKRB5_COMPILE_PATH)/compile_et \
+	$(LIBKRB5_MAINDIR)/util/profile/prof_err.h \
+	$(LIBKRB5_MAINDIR)/include/profile.h \
+	$(LIBKRB5_DIR)/error_tables/krb524_err.c \
+	$(LIBKRB5_DIR)/error_tables/kv5m_err.c \
+	$(LIBKRB5_DIR)/error_tables/k5e1_err.c \
+	$(LIBKRB5_DIR)/error_tables/krb5_err.c \
+	$(LIBKRB5_DIR)/error_tables/kdb5_err.c \
+	$(LIBKRB5_DIR)/error_tables/asn1_err.c \
+	$(LIBKRB5_DIR)/error_tables/krb524_err.h \
+	$(LIBKRB5_DIR)/error_tables/kv5m_err.h \
+	$(LIBKRB5_DIR)/error_tables/k5e1_err.h \
+	$(LIBKRB5_DIR)/error_tables/krb5_err.h \
+	$(LIBKRB5_DIR)/error_tables/kdb5_err.h \
+	$(LIBKRB5_DIR)/error_tables/asn1_err.h \
+	$(LIBKRB5_MAINDIR)/include/krb5/krb5.h \
+	$(LIBKRB5CRYPTO_DIR)/builtin/enc_provider/enc_camellia.c \
+
+UK_PREPARE += $(LIBKRB5_DEPS)
diff --git a/include/byteswap.h b/include/byteswap.h
new file mode 100644
index 0000000..00b9df3
--- /dev/null
+++ b/include/byteswap.h
@@ -0,0 +1,26 @@
+#ifndef _BYTESWAP_H
+#define _BYTESWAP_H
+
+#include <features.h>
+#include <stdint.h>
+
+static __inline uint16_t __bswap_16(uint16_t __x)
+{
+	return __x<<8 | __x>>8;
+}
+
+static __inline uint32_t __bswap_32(uint32_t __x)
+{
+	return __x>>24 | __x>>8&0xff00 | __x<<8&0xff0000 | __x<<24;
+}
+
+static __inline uint64_t __bswap_64(uint64_t __x)
+{
+	return __bswap_32(__x)+0ULL<<32 | __bswap_32(__x>>32);
+}
+
+#define bswap_16(x) __bswap_16(x)
+#define bswap_32(x) __bswap_32(x)
+#define bswap_64(x) __bswap_64(x)
+
+#endif
-- 
2.25.1



From minios-devel-bounces@lists.xenproject.org Thu Aug 20 09:46:44 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Thu, 20 Aug 2020 09:46:44 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1k8h9g-0008Ch-Tx; Thu, 20 Aug 2020 09:46:44 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=WisD=B6=gmail.com=cristianvijelie@srs-us1.protection.inumbo.net>)
 id 1k8h9g-00089A-3T
 for minios-devel@lists.xen.org; Thu, 20 Aug 2020 09:46:44 +0000
X-Inumbo-ID: ae4960c0-ce67-4945-a8d3-0ac971d5dd4a
Received: from mail-ej1-x633.google.com (unknown [2a00:1450:4864:20::633])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id ae4960c0-ce67-4945-a8d3-0ac971d5dd4a;
 Thu, 20 Aug 2020 09:46:34 +0000 (UTC)
Received: by mail-ej1-x633.google.com with SMTP id g19so1719678ejc.9
 for <minios-devel@lists.xen.org>; Thu, 20 Aug 2020 02:46:34 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=from:to:cc:subject:date:message-id:in-reply-to:references
 :mime-version:content-transfer-encoding;
 bh=30z6YxxwVgzNhAquzSmJVUFohp9J4Xo397KMlCOuhc4=;
 b=fwHlTCJ3DSUdPQzf4pr9A22GWiw5Iy955hxLrxjag/uC7gsIo2nzGuQc7dF7yFYzZe
 yyO7UrQ9Fc1Nog0255GEtl4KpeA7QXWZXImXNJKNt2MvAXfJBpKXuNsX7JQC86XoHBMf
 sDaENPrDgEoBLk9NwngBXeeee57Dt4iMqhFXikq+llOlLf+zRPcSOpJo0XnYYABM2Oqu
 41GnN023ZPIoacvedfKsNTgrNxGODMAgyuo+Pp1dQcbjphxh5tpr/Uap494EwmdPF27n
 dqAMcIxRAl8E5yuKnsPYcOSTJXo9J6dpr7xcH0NQy+GKyhWF4vh5shtS6is19stUy2a5
 HjAA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to
 :references:mime-version:content-transfer-encoding;
 bh=30z6YxxwVgzNhAquzSmJVUFohp9J4Xo397KMlCOuhc4=;
 b=Nm2v21XHI+tREVAYXzx1xPF+JNR5IccvZmZdA0zilYRzJHqZAVy5u1/XiXEVnKpqOy
 jqU40UlKS4fH7yUT4XBOU2B/YIBcUThjhPxCl/2djd+b187B6RZqcknz7KaY4g/ClIfh
 Jw6aydVf7myJPEQx/FE/TgYLgu3lu0jRV1A9vEIHXNAUMqfGK5HwDryIdndH/k1bbMdh
 13Rh0zGkOjAqPPtyKc2lIFusq25YFDDqiM2U318Owk6jsD+jId7H9B3zsDQOJ8yqf9BO
 NhP7l6R/WCmJGBIVq/2K2EJUDJrZ+6mO586WXBhTcrrRmBFqE9kwL9RCoJ2W4Ih2rgDd
 cITg==
X-Gm-Message-State: AOAM532FO13nonMTwjP2FClYuy2DfcJpNt+SS0BrkBTop69fVCAmlngC
 OVIKMMxGoWYQEdnSddsIzgVd4WdpeLw=
X-Google-Smtp-Source: ABdhPJwWHzd9hgmGlLwCRZvU3VZvAtDB578J13WxrRHJvGhCDxtIlrKQdfT859ZoxN0HSv8SDm6kHw==
X-Received: by 2002:a17:906:a00d:: with SMTP id
 p13mr2530780ejy.535.1597916792911; 
 Thu, 20 Aug 2020 02:46:32 -0700 (PDT)
Received: from localhost.localdomain ([82.137.12.155])
 by smtp.gmail.com with ESMTPSA id y9sm994789edt.34.2020.08.20.02.46.31
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Thu, 20 Aug 2020 02:46:32 -0700 (PDT)
From: cristianvijelie@gmail.com
To: minios-devel@lists.xen.org
Cc: Cristian <cristianvijelie@gmail.com>
Subject: [UNIKRAFT PATCH 3/4] Added .md files
Date: Thu, 20 Aug 2020 12:46:22 +0300
Message-Id: <20200820094623.77456-4-cristianvijelie@gmail.com>
X-Mailer: git-send-email 2.25.1
In-Reply-To: <20200820094623.77456-1-cristianvijelie@gmail.com>
References: <20200820094623.77456-1-cristianvijelie@gmail.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-BeenThere: minios-devel@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Mini-os development list <minios-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:minios-devel@lists.xenproject.org>
List-Help: <mailto:minios-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: minios-devel-bounces@lists.xenproject.org
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>

From: Cristian <cristianvijelie@gmail.com>

Signed-off-by: Cristian <cristianvijelie@gmail.com>
---
 .gitignore      | 3 +--
 CODING_STYLE.md | 4 ++++
 CONTRIBUTING.md | 4 ++++
 MAINTAINERS.md  | 9 +++++++++
 README.md       | 6 ++++++
 5 files changed, 24 insertions(+), 2 deletions(-)
 create mode 100644 CODING_STYLE.md
 create mode 100644 CONTRIBUTING.md
 create mode 100644 MAINTAINERS.md

diff --git a/.gitignore b/.gitignore
index 01e46c1..5fda993 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,5 +1,4 @@
 krb5-1.18.2
 *_make
 make_log
-0000-cover-letter.patch
-0001-Ported-libkrb5support-libkrb5crypto-and-libcom_err.patch
+*.patch
diff --git a/CODING_STYLE.md b/CODING_STYLE.md
new file mode 100644
index 0000000..5730041
--- /dev/null
+++ b/CODING_STYLE.md
@@ -0,0 +1,4 @@
+Coding Style
+============
+
+Please refer to the `CODING_STYLE.md` file in the main Unikraft repository.
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
new file mode 100644
index 0000000..14f6ac6
--- /dev/null
+++ b/CONTRIBUTING.md
@@ -0,0 +1,4 @@
+Contributing to Unikraft
+========================
+
+Please refer to the `CONTRIBUTING.md` file in the main Unikraft repository.
diff --git a/MAINTAINERS.md b/MAINTAINERS.md
new file mode 100644
index 0000000..c123f15
--- /dev/null
+++ b/MAINTAINERS.md
@@ -0,0 +1,9 @@
+Maintainers List
+================
+
+For notes on how to read this information, please refer to `MAINTAINERS.md` in
+the main Unikraft repository.
+
+	LIBNETTLE-UNIKRAFT
+	L:	minios-devel@lists.xen.org
+	F: *
diff --git a/README.md b/README.md
index e69de29..40246bd 100644
--- a/README.md
+++ b/README.md
@@ -0,0 +1,6 @@
+Nettle crypto library for Unikraft
+=============================
+
+This is the port of Unikraft runtime libaries for Unikraft. 
+
+Please refer to the `README.md` as well as the documentation in the `doc/` subdirectory of the main unikraft repository.
-- 
2.25.1



From minios-devel-bounces@lists.xenproject.org Thu Aug 20 09:46:50 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Thu, 20 Aug 2020 09:46:50 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1k8h9l-0008Dp-Vb; Thu, 20 Aug 2020 09:46:49 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=WisD=B6=gmail.com=cristianvijelie@srs-us1.protection.inumbo.net>)
 id 1k8h9l-00089A-3d
 for minios-devel@lists.xen.org; Thu, 20 Aug 2020 09:46:49 +0000
X-Inumbo-ID: bf9ae46d-bc76-417b-b6d8-4a5afa0dc324
Received: from mail-ej1-x644.google.com (unknown [2a00:1450:4864:20::644])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id bf9ae46d-bc76-417b-b6d8-4a5afa0dc324;
 Thu, 20 Aug 2020 09:46:35 +0000 (UTC)
Received: by mail-ej1-x644.google.com with SMTP id d6so1747237ejr.5
 for <minios-devel@lists.xen.org>; Thu, 20 Aug 2020 02:46:35 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=from:to:cc:subject:date:message-id:in-reply-to:references
 :mime-version:content-transfer-encoding;
 bh=jNzcUMJDL/HfPqtywa/14shmxbVY6ey/fzX1hbddb5w=;
 b=NL5REzmmBPEDYyUvbkirKD04/2C/uqbY/wpXpOxA3WnEEpVsEKhy3jMYKx1J9LJMjn
 5yFKbMnq6aomqepC0hllqOAdf7bJpBPmncK03D4m3qv1bZLsFPrcCklfqfpxjhyhypMF
 rVzjzDSz5qddEqRsSKsBIf88gre2MU2zq4Pw2gywQVKGbnqMUifEGc2ufEbeouwPV/Kw
 VBt3Cy4t/XUmvzHZ6ZBLh13osGG/GzBSgL03fjWGT9ciokwnlumYF6kNrmVF/WmmyqcU
 56zXAW66dTwnNn4Q1lHpCNlG3LCdyihGLg6rW9FhhqCFnuJP0KRSAMTbqWBXw6cFGGC/
 eYXQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to
 :references:mime-version:content-transfer-encoding;
 bh=jNzcUMJDL/HfPqtywa/14shmxbVY6ey/fzX1hbddb5w=;
 b=pzuLEOAgzZPHX6w6tpjThAJbMgz3VdYrewJ4nr/ZXFMu3HEkxhjyt4LBJBmYB4Fktz
 46Ky/1M/pn7MG5xn9KFbBoE1BGXCVCY68ejgptXgVfY7DWvUg8kfoLUj5PgmfoUe6SJo
 m4/6UWIxI375/YJokjlQllKuMs3+/SoCy77j0wO6WYEubNhBcaLWm1AcmML4pHtkbKyi
 wz8eZFKz8ZsFIgAHnxHyEqIpQ6GygV/doLT0JeAgbPjbsmm8o1ulwxUW6ZeZi/uN/ZOv
 j5xyK3Jwk6drQ8irOD8iJUUsYDAze1kdXxRt7/zlR3C9rBqAHR3gltuoeS6mMDylO6c1
 JrgA==
X-Gm-Message-State: AOAM531ZpC1wbqZk9+c1HMRmgGZ/ipVozwQ8EvKPfjK3P5sNuSq+SBoy
 qmSOZjaZOyJ8jdngTBjoIHzPUiw+t48=
X-Google-Smtp-Source: ABdhPJxRKbAx7K5holKpTQNCvCTPIS9HL6DYOwan3kLoTbvikhRJvzqSeYerIjrjtgeaDi+lwtjjqg==
X-Received: by 2002:a17:906:8d8:: with SMTP id
 o24mr2341139eje.384.1597916794474; 
 Thu, 20 Aug 2020 02:46:34 -0700 (PDT)
Received: from localhost.localdomain ([82.137.12.155])
 by smtp.gmail.com with ESMTPSA id y9sm994789edt.34.2020.08.20.02.46.33
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Thu, 20 Aug 2020 02:46:33 -0700 (PDT)
From: cristianvijelie@gmail.com
To: minios-devel@lists.xen.org
Cc: Cristian <cristianvijelie@gmail.com>
Subject: [UNIKRAFT PATCH 4/4] Fixed the README
Date: Thu, 20 Aug 2020 12:46:23 +0300
Message-Id: <20200820094623.77456-5-cristianvijelie@gmail.com>
X-Mailer: git-send-email 2.25.1
In-Reply-To: <20200820094623.77456-1-cristianvijelie@gmail.com>
References: <20200820094623.77456-1-cristianvijelie@gmail.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-BeenThere: minios-devel@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Mini-os development list <minios-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:minios-devel@lists.xenproject.org>
List-Help: <mailto:minios-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: minios-devel-bounces@lists.xenproject.org
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>

From: Cristian <cristianvijelie@gmail.com>

Signed-off-by: Cristian <cristianvijelie@gmail.com>
---
 README.md | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/README.md b/README.md
index 40246bd..9546fa6 100644
--- a/README.md
+++ b/README.md
@@ -1,6 +1,6 @@
-Nettle crypto library for Unikraft
+MIT Kerberos runtime libaries for Unikraft
 =============================
 
-This is the port of Unikraft runtime libaries for Unikraft. 
+This is the port of MIT Kerberos runtime libaries for Unikraft. 
 
 Please refer to the `README.md` as well as the documentation in the `doc/` subdirectory of the main unikraft repository.
-- 
2.25.1



From minios-devel-bounces@lists.xenproject.org Thu Aug 20 09:53:00 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Thu, 20 Aug 2020 09:53:00 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1k8hFi-0000lQ-Qq; Thu, 20 Aug 2020 09:52:58 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=WisD=B6=gmail.com=cristianvijelie@srs-us1.protection.inumbo.net>)
 id 1k8hFh-0000lJ-RH
 for minios-devel@lists.xen.org; Thu, 20 Aug 2020 09:52:57 +0000
X-Inumbo-ID: f19b4f57-2943-4681-b05f-90649042d4f9
Received: from mail-ed1-x535.google.com (unknown [2a00:1450:4864:20::535])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id f19b4f57-2943-4681-b05f-90649042d4f9;
 Thu, 20 Aug 2020 09:52:56 +0000 (UTC)
Received: by mail-ed1-x535.google.com with SMTP id c10so1089527edk.6
 for <minios-devel@lists.xen.org>; Thu, 20 Aug 2020 02:52:56 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=from:to:cc:subject:date:message-id:mime-version
 :content-transfer-encoding;
 bh=Q95/jCzo/mWM1AnwD2DOCpalmTHkA/iEgdcd22Ud2e4=;
 b=YIzFiO2PB9QZB3uzxaLlwKGy4YHsqNZYFE1xCctZrdsKCoOHP/qC3Na3C08aVzjXpc
 WNziaeZbKRv+lyuzUoxzDtpTzYB5cIW0bLlBV8CnIzDqsSvukA1CkNmWrXQNGi1DR6H2
 W1Op1pd5c/IQRK3P/fMHXDb0NF8HFx3mFUL2P19fugNzdsy2QdQGdtBZ7x9dXQbfn4r+
 q97u/Yb/fjAtVQN1d+RXitrCK6eg+F8mO23L3vmltEQcE8UMc6twXblieG9ySanCQtvX
 xi3AxafM892wcq/Biyv2rvffkLcyj3S9SK0bNkxR0/ueCA52FpDGzzA09+ZMOwKxLbZS
 XoPA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version
 :content-transfer-encoding;
 bh=Q95/jCzo/mWM1AnwD2DOCpalmTHkA/iEgdcd22Ud2e4=;
 b=OOTIqHgimv++n2z/negJCCRj0va0jZHQR+qI9zyCEVW7Jhk2Xlc3rh1ca7x7NEbtlL
 VKUFnGnD74smyW433epmLLOOKIb8mJCelOvGSB5/P0ybZl4bK99AUBolRgHYI5G+WSLO
 +X9At6SETXf8mz80EqSoJ2ETNXyDZyMeE5QLfFzlSbXOWdmj8NFaqwIFuQ1MIN6rJwjP
 cpAsXjDBpg1zPntufMVSN31TuZLUgZZ1rACsGsm5Hq/gmXfHvLDZ3fZ9Mv40ymR8dwQn
 2AKMJN5Qv/9ls+pWfr2XZCewwaTme7uyrfk6O44G7PEWYksuY1z/xtJzIZwn0YE0sByR
 8qHQ==
X-Gm-Message-State: AOAM531OB0mJjTADnv25wbsrhg3+6MjxYcgLLyZeYglqCkQSjgQljW06
 bJU/88mDRLStWh72QrPSK+1f2ndGhe0=
X-Google-Smtp-Source: ABdhPJxkmCKLWkfBfzbwNiL8sugwSDDA+qN7KtfIsiJsS5J7gDMMMNNERSbR+VkZ27F9+/HQt+yf0g==
X-Received: by 2002:a05:6402:1299:: with SMTP id
 w25mr2091275edv.247.1597917175617; 
 Thu, 20 Aug 2020 02:52:55 -0700 (PDT)
Received: from localhost.localdomain ([82.137.12.155])
 by smtp.gmail.com with ESMTPSA id p8sm1109310ejx.53.2020.08.20.02.52.54
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Thu, 20 Aug 2020 02:52:54 -0700 (PDT)
From: cristianvijelie@gmail.com
To: minios-devel@lists.xen.org
Cc: Cristian Vijelie <cristianvijelie@gmail.com>
Subject: [UNIKRAFT/KERBEROS 0/4] Porting of the MIT Kerberos runtime librares
Date: Thu, 20 Aug 2020 12:52:48 +0300
Message-Id: <20200820095252.77993-1-cristianvijelie@gmail.com>
X-Mailer: git-send-email 2.25.1
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-BeenThere: minios-devel@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Mini-os development list <minios-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:minios-devel@lists.xenproject.org>
List-Help: <mailto:minios-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: minios-devel-bounces@lists.xenproject.org
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>

From: Cristian Vijelie <cristianvijelie@gmail.com>

As libkrb5support, libkrb5crypto, libcom_err, libkrb5 and libgssapi are all
downloaded and built from the same source, I've decided to include them all
in one Unikraft external library.

Here are the needed libraries for each one of them
libkrb5support: lib-newlib, lib-pthread-embedded, lib-lwip
libkrb5crypto:  libkrb5support and it's dependencies
libcom_err:     libkrb5support and it's dependencies
libkrb5:        all of the above
libgssapi:      all of the above + libdl (not implemented)

The configuring of the Kerberos libraries is done with the flag --disable-nls,
because the nls feature needs libdl, which is not yet implemented (but it 
exists as unikraft/lib/posix-libdl).

Also, I added a sed command after configuring the library, to remove the use
of secure_getenv, as it's not implemented in newlib.

The libkrb5 can't be built, yet, because of the missing implementation for 
__res_ninit, from libnewlibc/origin/newlib-2.5.0.20170922/newlib/libc/sys/linux/include/resolv.h.

I've not added the gssapi library, as it has missing dependencies, and I will add
it after libdl will be implemented.

I've not yet added the OpenSSL support, or the OpenLDAP support.

Cristian (4):
  Ported libkrb5support, libkrb5crypto and libcom_err
  Added libkrb5 sorurces
  Added .md files
  Fixed the README

 .gitignore         |   4 +
 CODING_STYLE.md    |   4 +
 CONTRIBUTING.md    |   4 +
 Config.uk          |  34 +++
 MAINTAINERS.md     |   9 +
 Makefile.uk        | 561 +++++++++++++++++++++++++++++++++++++++++++++
 README.md          |   6 +
 include/byteswap.h |  26 +++
 8 files changed, 648 insertions(+)
 create mode 100644 .gitignore
 create mode 100644 CODING_STYLE.md
 create mode 100644 CONTRIBUTING.md
 create mode 100644 Config.uk
 create mode 100644 MAINTAINERS.md
 create mode 100644 Makefile.uk
 create mode 100644 include/byteswap.h

-- 
2.25.1



From minios-devel-bounces@lists.xenproject.org Thu Aug 20 09:53:03 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Thu, 20 Aug 2020 09:53:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1k8hFn-0000m0-Sl; Thu, 20 Aug 2020 09:53:03 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=WisD=B6=gmail.com=cristianvijelie@srs-us1.protection.inumbo.net>)
 id 1k8hFm-0000lJ-Fw
 for minios-devel@lists.xen.org; Thu, 20 Aug 2020 09:53:02 +0000
X-Inumbo-ID: 756b25ee-99aa-4323-98a9-d51c0cdcc826
Received: from mail-ej1-x62d.google.com (unknown [2a00:1450:4864:20::62d])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 756b25ee-99aa-4323-98a9-d51c0cdcc826;
 Thu, 20 Aug 2020 09:52:59 +0000 (UTC)
Received: by mail-ej1-x62d.google.com with SMTP id c16so1719442ejx.12
 for <minios-devel@lists.xen.org>; Thu, 20 Aug 2020 02:52:59 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=from:to:cc:subject:date:message-id:in-reply-to:references
 :mime-version:content-transfer-encoding;
 bh=i3ZcCSGThM1xeU0ZX9sSDEAeDyE61rQLpqtp+6i89u0=;
 b=LgAVRdriN4d48G4t4VmEAZQ41WK6BEFZGZwsoJWEgD8TIlQtXJyar3P3ofEb0Gvoql
 xul4uh+OG1cm/Z0aSGYKFJV8qZstgmrNJLYqLVPzDAM6+Bo610RBhUlprbJe+GntsGIl
 0CAJgqc9H7MFchF/A4ZZwh6BhjwpcopyW4AHjdJtlPpkGTTyQ7Jsyfnk042OYZoe28ka
 OJhSAqiA3GLPItWZKKYID/e5kI2Au6h9SmidH8F0qOuuereMPMEck/uodoTXLz6pRfEA
 ELiztuwEv7rANntMCWXjwThQUuzsRBLO1IcuZBhX6P0fF6RJaKdjECS5PjL7os/9P6pX
 nr8g==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to
 :references:mime-version:content-transfer-encoding;
 bh=i3ZcCSGThM1xeU0ZX9sSDEAeDyE61rQLpqtp+6i89u0=;
 b=lXTA0fbunxKJDR3+826ivBAlGdNp+Cl+9222QeOHJY6svOh6JffOlCU/ym95T0xawp
 2ngCzzSSYUwi7DPxxGIu+Pj4Z0qPjSgR6JcIDtYz4W4LtcZ6+fo36LRt4UOVS1svINf+
 TShFxTEwQGti8jOy02JFCzZyvErw3xgMC9tO+oTd3NUSC6UFlRwAQtRClIrXr3g07Gu/
 gQdRfAqEoLqUaEBX8vM4LcIc6Y9ovQ2G2gQp+m1YEhdfLBd/ot+l9pOJemtmcHHe11gF
 +S4EpFFDhtAPDzaP0x+YL5DRjWJndXuFir1rPbzZfSp0tcSb/PtnaPAUEWg88hbb2y5E
 xAHw==
X-Gm-Message-State: AOAM531ou3I5ZgYkHSD0lvpVObri7zVt/1JFbbqRGm8eqZcKyZa0x8Bq
 CO/0TnAQSgw9ybdN0dJb4yuoPc1gU3I=
X-Google-Smtp-Source: ABdhPJxgj/CFXnpMuv+ZsIuNXL1bJJwYe/ItgriABHBLvLXCy8slEQYO3pMZIDdBgWehSMXZlIGfJw==
X-Received: by 2002:a17:906:2a0d:: with SMTP id
 j13mr2555264eje.474.1597917177931; 
 Thu, 20 Aug 2020 02:52:57 -0700 (PDT)
Received: from localhost.localdomain ([82.137.12.155])
 by smtp.gmail.com with ESMTPSA id p8sm1109310ejx.53.2020.08.20.02.52.55
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Thu, 20 Aug 2020 02:52:57 -0700 (PDT)
From: cristianvijelie@gmail.com
To: minios-devel@lists.xen.org
Cc: Cristian Vijelie <cristianvijelie@gmail.com>
Subject: [UNIKRAFT/KERBEROS 1/4] Ported libkrb5support,
 libkrb5crypto and libcom_err
Date: Thu, 20 Aug 2020 12:52:49 +0300
Message-Id: <20200820095252.77993-2-cristianvijelie@gmail.com>
X-Mailer: git-send-email 2.25.1
In-Reply-To: <20200820095252.77993-1-cristianvijelie@gmail.com>
References: <20200820095252.77993-1-cristianvijelie@gmail.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-BeenThere: minios-devel@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Mini-os development list <minios-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:minios-devel@lists.xenproject.org>
List-Help: <mailto:minios-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: minios-devel-bounces@lists.xenproject.org
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>

From: Cristian Vijelie <cristianvijelie@gmail.com>

Signed-off-by: Cristian <cristianvijelie@gmail.com>
---
 .gitignore         |   3 +
 Config.uk          |  34 +++++
 Makefile.uk        | 354 +++++++++++++++++++++++++++++++++++++++++++++
 include/byteswap.h |  26 ++++
 4 files changed, 417 insertions(+)
 create mode 100644 .gitignore
 create mode 100644 Config.uk
 create mode 100644 Makefile.uk
 create mode 100644 include/byteswap.h

diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..890d606
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,3 @@
+krb5-1.18.2
+*_make
+make_log
diff --git a/Config.uk b/Config.uk
new file mode 100644
index 0000000..73176de
--- /dev/null
+++ b/Config.uk
@@ -0,0 +1,34 @@
+menuconfig LIBKRB5
+    bool "libkrb5: MIT Kerberos runtime libraries"
+    select LIBKRB5SUPPORT
+    select LIBKRB5CRYPTO
+    select LIBCOM_ERR
+    default n
+
+menuconfig LIBKRB5SUPPORT
+    bool "likrb5support: MIT Kerberos support libraries"
+    select LIBNEWLIB
+    select LIBPTHREAD_EMBEDDED
+    select LIBLWIP
+    select LWIP_UKNETDEV
+	select LWIP_TCP
+	select LWIP_TCP_KEEPALIVE
+	select LWIP_THREADS
+	select LWIP_SOCKET
+	select LWIP_IPV4
+    select LWIP_IPV6
+    default n
+
+menuconfig LIBKRB5CRYPTO
+    bool "lib5crypto: MIT Kerberos crypto libraries"
+    select LIBKRB5SUPPORT
+    default n
+
+menuconfig LIBGSSAPI_KRB5
+    bool "libgssapi_krb5: MIT Kerberos GSS-API mechanism"
+    default n
+
+menuconfig LIBCOM_ERR
+    bool "libcom_err: Common error description library"
+    select LIBKRB5SUPPORT
+    default n
diff --git a/Makefile.uk b/Makefile.uk
new file mode 100644
index 0000000..eea8972
--- /dev/null
+++ b/Makefile.uk
@@ -0,0 +1,354 @@
+##############################################################################################
+# Library registration
+##############################################################################################
+$(eval $(call addlib_s,libkrb5,$(CONFIG_LIBKRB5)))
+$(eval $(call addlib_s,libkrb5support,$(CONFIG_LIBKRB5SUPPORT)))
+$(eval $(call addlib_s,libkrb5crypto,$(CONFIG_LIBKRB5CRYPTO)))
+$(eval $(call addlib_s,libcom_err,$(CONFIG_LIBCOM_ERR)))
+
+##############################################################################################
+# SOURCES
+##############################################################################################
+LIBKRB5_MAJORVER=1.18
+LIBKRB5_MINORVER=2
+LIBKRB5_TARNAME=krb5-$(LIBKRB5_MAJORVER).$(LIBKRB5_MINORVER)
+LIBKRB5_URL=http://web.mit.edu/kerberos/dist/krb5/$(LIBKRB5_MAJORVER)/$(LIBKRB5_TARNAME).tar.gz
+LIBKRB5_PATCHDIR=$(LIBKRB5_BASE)/patches
+$(eval $(call fetch,libkrb5,$(LIBKRB5_URL)))
+$(eval $(call patch,libkrb5,$(LIBKRB5_PATCHDIR),$(LIBKRB5_TARNAME)))
+
+##############################################################################################
+# Helpers
+##############################################################################################
+LIBKRB5_MAINDIR=$(LIBKRB5_ORIGIN)/$(LIBKRB5_TARNAME)/src
+LIBKRB5_COMPILE_PATH=$(LIBKRB5_MAINDIR)/util/et
+LIBKRB5_DIR=$(LIBKRB5_MAINDIR)/lib/krb5
+
+LIBKRB5SUPPORT_DIR=$(LIBKRB5_MAINDIR)/util/support
+LIBKRB5CRYPTO_DIR=$(LIBKRB5_MAINDIR)/lib/crypto
+
+##############################################################################################
+# libkrb5 flags
+##############################################################################################
+LIBKRB5_CFLAGS += -fPIC -DSHARED -DHAVE_CONFIG_H  -I$(LIBKRB5_BASE)/include \
+-I$(LIBKRB5_MAINDIR)/include  -DKRB5_DEPRECATED=1 -DKRB5_PRIVATE -Wall -Wcast-align -Wshadow \
+-Wmissing-prototypes -Wno-format-zero-length -Woverflow -Wstrict-overflow \
+-Wmissing-format-attribute -Wmissing-prototypes -Wreturn-type -Wmissing-braces -Wparentheses \
+-Wswitch -Wunused-function -Wunused-label -Wunused-variable -Wunused-value -Wunknown-pragmas \
+-Wsign-compare -Werror=uninitialized -Wno-maybe-uninitialized -Werror=pointer-arith \
+-Werror=int-conversion -Werror=incompatible-pointer-types -Werror=discarded-qualifiers \
+-Werror=implicit-int -Werror=declaration-after-statement -Werror-implicit-function-declaration
+
+LIBKRB5_OBJFLAGS += -shared -fPIC -Wl,--no-undefined -Wl,--enable-new-dtags \
+-Wl,-rpath
+
+##############################################################################################
+# libkrb5 code
+##############################################################################################
+LIBKRB5_SRCS-y += 
+
+##############################################################################################
+# libkrb5support flags
+##############################################################################################
+
+LIBKRB5SUPPORT_CFLAGS = $(LIBKRB5_CFLAGS)
+LIBKRB5SUPPORT_CFLAGS += -I$(LIBNEWLIB_LIBC)/sys/linux/include
+LIBKRB5SUPPORT_CFLAGS += -I$(LIBNEWLIB_LIBC)/sys/linux
+LIBKRB5SUPPORT_CFLAGS += -I$(LIBNEWLIB_LIBC)/sys/linux/sys
+LIBKRB5SUPPORT_OBJFLAGS = $(LIBKRB5_OBJFLAGS)
+
+##############################################################################################
+# libkrb5support code
+##############################################################################################
+LIBKRB5SUPPORT_SRCS-y += $(LIBKRB5SUPPORT_DIR)/threads.c
+LIBKRB5SUPPORT_SRCS-y += $(LIBKRB5SUPPORT_DIR)/init-addrinfo.c
+LIBKRB5SUPPORT_SRCS-y += $(LIBKRB5SUPPORT_DIR)/plugins.c
+LIBKRB5SUPPORT_SRCS-y += $(LIBKRB5SUPPORT_DIR)/errors.c
+LIBKRB5SUPPORT_SRCS-y += $(LIBKRB5SUPPORT_DIR)/k5buf.c
+LIBKRB5SUPPORT_SRCS-y += $(LIBKRB5SUPPORT_DIR)/gmt_mktime.c
+LIBKRB5SUPPORT_SRCS-y += $(LIBKRB5SUPPORT_DIR)/fake-addrinfo.c
+LIBKRB5SUPPORT_SRCS-y += $(LIBKRB5SUPPORT_DIR)/utf8.c
+LIBKRB5SUPPORT_SRCS-y += $(LIBKRB5SUPPORT_DIR)/utf8_conv.c
+LIBKRB5SUPPORT_SRCS-y += $(LIBKRB5SUPPORT_DIR)/zap.c
+LIBKRB5SUPPORT_SRCS-y += $(LIBKRB5SUPPORT_DIR)/path.c
+LIBKRB5SUPPORT_SRCS-y += $(LIBKRB5SUPPORT_DIR)/base64.c
+LIBKRB5SUPPORT_SRCS-y += $(LIBKRB5SUPPORT_DIR)/json.c
+LIBKRB5SUPPORT_SRCS-y += $(LIBKRB5SUPPORT_DIR)/hex.c
+LIBKRB5SUPPORT_SRCS-y += $(LIBKRB5SUPPORT_DIR)/hashtab.c
+LIBKRB5SUPPORT_SRCS-y += $(LIBKRB5SUPPORT_DIR)/bcmp.c
+LIBKRB5SUPPORT_SRCS-y += $(LIBKRB5SUPPORT_DIR)/strerror_r.c
+LIBKRB5SUPPORT_SRCS-y += $(LIBKRB5SUPPORT_DIR)/dir_filenames.c
+LIBKRB5SUPPORT_SRCS-y += $(LIBKRB5SUPPORT_DIR)/strlcpy.c
+
+##############################################################################################
+# libkrb5crypto flags
+##############################################################################################
+LIBKRB5CRYPTO_CFLAGS = $(LIBKRB5_CFLAGS)
+LIBKRB5CRYPTO_CFLAGS += -I$(LIBKRB5CRYPTO_DIR)/krb
+LIBKRB5CRYPTO_CFLAGS += -I$(LIBKRB5CRYPTO_DIR)/builtin
+LIBKRB5CRYPTO_CFLAGS += -I$(LIBKRB5CRYPTO_DIR)/builtin/aes
+LIBKRB5CRYPTO_CFLAGS += -I$(LIBKRB5CRYPTO_DIR)/builtin/camellia
+LIBKRB5CRYPTO_CFLAGS += -I$(LIBKRB5CRYPTO_DIR)/builtin/des
+LIBKRB5CRYPTO_CFLAGS += -I$(LIBKRB5CRYPTO_DIR)/builtin/md4
+LIBKRB5CRYPTO_CFLAGS += -I$(LIBKRB5CRYPTO_DIR)/builtin/md5
+LIBKRB5CRYPTO_CFLAGS += -I$(LIBKRB5CRYPTO_DIR)/builtin/sha1
+LIBKRB5CRYPTO_CFLAGS += -I$(LIBKRB5CRYPTO_DIR)/builtin/sha2
+LIBKRB5CRYPTO_CFLAGS += -I$(LIBNEWLIB_LIBC)/sys/linux/include
+LIBKRB5CRYPTO_CFLAGS += -I$(LIBNEWLIB_LIBC)/sys/linux
+LIBKRB5CRYPTO_CFLAGS += -I$(LIBNEWLIB_LIBC)/sys/linux/sys
+LIBKRB5CRYPTO_OBJFLAGS = $(LIBKRB5_OBJFLAGS)
+
+##############################################################################################
+# libkrb5crypto code
+##############################################################################################
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/krb/aead.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/krb/block_size.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/krb/cf2.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/krb/checksum_dk_cmac.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/krb/checksum_dk_hmac.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/krb/checksum_etm.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/krb/checksum_hmac_md5.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/krb/checksum_unkeyed.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/krb/checksum_length.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/krb/cksumtype_to_string.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/krb/cksumtypes.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/krb/cmac.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/krb/coll_proof_cksum.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/krb/crypto_length.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/krb/crypto_libinit.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/krb/default_state.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/krb/decrypt.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/krb/decrypt_iov.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/krb/derive.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/krb/encrypt.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/krb/encrypt_iov.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/krb/encrypt_length.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/krb/enctype_util.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/krb/enc_dk_cmac.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/krb/enc_dk_hmac.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/krb/enc_etm.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/krb/enc_raw.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/krb/enc_rc4.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/krb/etypes.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/krb/key.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/krb/keyblocks.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/krb/keyed_cksum.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/krb/keyed_checksum_types.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/krb/keylengths.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/krb/make_checksum.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/krb/make_checksum_iov.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/krb/make_random_key.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/krb/mandatory_sumtype.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/krb/nfold.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/krb/old_api_glue.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/krb/prf.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/krb/prf_aes2.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/krb/prf_cmac.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/krb/prf_des.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/krb/prf_dk.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/krb/prf_rc4.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/krb/prng.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/krb/prng_fortuna.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/krb/random_to_key.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/krb/s2k_pbkdf2.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/krb/s2k_rc4.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/krb/state.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/krb/string_to_cksumtype.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/krb/string_to_key.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/krb/valid_cksumtype.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/krb/verify_checksum.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/krb/verify_checksum_iov.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/builtin/camellia/camellia.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/builtin/des/d3_aead.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/builtin/des/d3_kysched.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/builtin/des/des_keys.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/builtin/des/f_aead.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/builtin/des/f_cksum.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/builtin/des/f_parity.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/builtin/des/f_sched.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/builtin/des/f_tables.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/builtin/des/key_sched.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/builtin/des/weak_key.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/builtin/aes/aescrypt.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/builtin/aes/aestab.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/builtin/aes/aeskey.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/builtin/md4/md4.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/builtin/md5/md5.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/builtin/sha1/shs.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/builtin/sha2/sha256.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/builtin/sha2/sha512.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/builtin/enc_provider/des3.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/builtin/enc_provider/rc4.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/builtin/enc_provider/aes.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/builtin/enc_provider/enc_camellia.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/builtin/hash_provider/hash_md4.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/builtin/hash_provider/hash_md5.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/builtin/hash_provider/hash_sha1.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/builtin/hash_provider/hash_sha2.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/builtin/hmac.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/builtin/init.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/builtin/pbkdf2.c
+
+##############################################################################################
+# libcom_err flags
+##############################################################################################
+LIBCOM_ERR_CFLAGS = $(LIBKRB5_CFLAGS)
+
+##############################################################################################
+# libcom_err code
+##############################################################################################
+LIBCOM_ERR_SRCS-y += $(LIBKRB5_COMPILE_PATH)/error_message.c
+LIBCOM_ERR_SRCS-y += $(LIBKRB5_COMPILE_PATH)/et_name.c
+LIBCOM_ERR_SRCS-y += $(LIBKRB5_COMPILE_PATH)/com_err.c
+
+##############################################################################################
+# dependencies
+##############################################################################################
+# Run ./configure
+$(LIBKRB5_MAINDIR)/.configured: $(LIBKRB5_BUILD)/.origin
+	$(call verbose_cmd,CONFIG,libkrb: $(notdir $@), cd $(LIBKRB5_MAINDIR) && ./configure \
+	--disable-nls && touch $@)
+
+# Generate compile_et
+$(LIBKRB5_COMPILE_PATH)/compile_et:
+	$(call verbose_cmd,GEN,libkrb: $(notdir $@), cd $(LIBKRB5_COMPILE_PATH) && /bin/sh \
+	./config_script ./compile_et.sh "/usr/local/share/et" mawk sed > $@ && chmod 755 $@)
+
+# Generate .h and .c files
+$(LIBKRB5_MAINDIR)/include/osconf.h: $(LIBKRB5_MAINDIR)/include/osconf.hin
+	$(call verbose_cmd,GEN,libkrb: $(notdir $@), cat $^ | sed -e "s\"@KRB5RCTMPDIR\"/var/tmp\""\
+	 -e "s\"@PREFIX\"/usr/local\"" -e "s\"@EXEC_PREFIX\"/usr/local\"" \
+	 -e "s\"@BINDIR\"/usr/local/bin\"" -e "s\"@LIBDIR\"/usr/local/lib\"" \
+	 -e "s\"@SBINDIR\"/usr/local/sbin\"" -e "s\"@MODULEDIR\"/usr/local/lib/krb5/plugins\"" \
+	 -e "s\"@GSSMODULEDIR\"/usr/local/lib/gss\"" -e "s\"@LOCALSTATEDIR\"/usr/local/var\"" \
+	 -e "s\"@RUNSTATEDIR\"/run\"" -e "s\"@SYSCONFDIR\"/usr/local/etc\"" \
+	 -e "s\"@DYNOBJEXT\".so\"" -e "s\"@SYSCONFCONF\":/usr/local/etc/krb5.conf\"" > osconf.new \
+	 && $(LIBKRB5_MAINDIR)/config/move-if-changed osconf.new $@)
+
+$(LIBKRB5_MAINDIR)/include/com_err.h: $(LIBKRB5_COMPILE_PATH)/com_err.h
+	$(call verbose_cmd,GEN,libkrb: $(notdir $@), cp $^ $@)
+
+$(LIBKRB5_MAINDIR)/include/profile.h: $(LIBKRB5_MAINDIR)/util/profile/profile.hin $(LIBKRB5_MAINDIR)/util/profile/prof_err.h
+	$(call verbose_cmd,GEN,libkrb: $(notdir $@), cat $^ > $@)
+
+$(LIBKRB5_MAINDIR)/include/krb5/krb5.h: $(LIBKRB5_MAINDIR)/include/krb5/krb5.hin
+	$(call verbose_cmd,GEN,libkrb: $(notdir $@), cd $(LIBKRB5_MAINDIR)/include && echo "#ifndef KRB5_KRB5_H_INCLUDED" >> krb5/krb5.new && echo "#define KRB5_KRB5_H_INCLUDED" >> krb5/krb5.new && cat krb5/krb5.hin $(LIBKRB5_MAINDIR)/lib/krb5/error_tables/krb5_err.h $(LIBKRB5_MAINDIR)/lib/krb5/error_tables/k5e1_err.h $(LIBKRB5_MAINDIR)/lib/krb5/error_tables/kdb5_err.h $(LIBKRB5_MAINDIR)/lib/krb5/error_tables/kv5m_err.h $(LIBKRB5_MAINDIR)/lib/krb5/error_tables/krb524_err.h $(LIBKRB5_MAINDIR)/lib/krb5/error_tables/asn1_err.h >> krb5/krb5.new && echo "#endif /* KRB5_KRB5_H_INCLUDED */" >> krb5/krb5.new && $(LIBKRB5_MAINDIR)/config/move-if-changed krb5/krb5.new krb5/krb5.h)
+
+$(LIBKRB5_DIR)/error_tables/et-c-asn1_err.et: $(LIBKRB5_DIR)/error_tables/asn1_err.et
+	$(call verbose_cmd,GEN,libkrb: $(notdir $@), cd $(LIBKRB5_DIR)/error_tables && rm -f et-c-asn1_err.et et-c-asn1_err.c et-c-asn1_err.h && cp $^ $@)
+$(LIBKRB5_DIR)/error_tables/et-c-asn1_err.c: $(LIBKRB5_DIR)/error_tables/et-c-asn1_err.et
+	$(call verbose_cmd,GEN,libkrb: $(notdir $@), cd $(LIBKRB5_DIR)/error_tables && $(LIBKRB5_COMPILE_PATH)/compile_et -d $(LIBKRB5_COMPILE_PATH) --textdomain mit-krb5 $^)
+$(LIBKRB5_DIR)/error_tables/asn1_err.c: $(LIBKRB5_DIR)/error_tables/et-c-asn1_err.c
+	$(call verbose_cmd,GEN,libkrb: $(notdir $@), cd $(LIBKRB5_DIR)/error_tables && mv -f $^ $@ && rm -f et-c-asn1_err.et et-c-asn1_err.h)
+
+$(LIBKRB5_DIR)/error_tables/et-c-kdb5_err.et: $(LIBKRB5_DIR)/error_tables/kdb5_err.et
+	$(call verbose_cmd,GEN,libkrb: $(notdir $@), cd $(LIBKRB5_DIR)/error_tables && rm -f et-c-kdb5_err.et et-c-kdb5_err.c et-c-kdb5_err.h && cp $^ $@)
+$(LIBKRB5_DIR)/error_tables/et-c-kdb5_err.c: $(LIBKRB5_DIR)/error_tables/et-c-kdb5_err.et
+	$(call verbose_cmd,GEN,libkrb: $(notdir $@), cd $(LIBKRB5_DIR)/error_tables && $(LIBKRB5_COMPILE_PATH)/compile_et -d $(LIBKRB5_COMPILE_PATH) --textdomain mit-krb5 $^)
+$(LIBKRB5_DIR)/error_tables/kdb5_err.c: $(LIBKRB5_DIR)/error_tables/et-c-kdb5_err.c
+	$(call verbose_cmd,GEN,libkrb: $(notdir $@), cd $(LIBKRB5_DIR)/error_tables && mv -f $^ $@ && rm -f et-c-kdb5_err.et et-c-kdb5_err.h)
+
+$(LIBKRB5_DIR)/error_tables/et-c-krb5_err.et: $(LIBKRB5_DIR)/error_tables/krb5_err.et
+	$(call verbose_cmd,GEN,libkrb: $(notdir $@), cd $(LIBKRB5_DIR)/error_tables && rm -f et-c-krb5_err.et et-c-krb5_err.c et-c-krb5_err.h && cp $^ $@)
+$(LIBKRB5_DIR)/error_tables/et-c-krb5_err.c: $(LIBKRB5_DIR)/error_tables/et-c-krb5_err.et
+	$(call verbose_cmd,GEN,libkrb: $(notdir $@), cd $(LIBKRB5_DIR)/error_tables && $(LIBKRB5_COMPILE_PATH)/compile_et -d $(LIBKRB5_COMPILE_PATH) --textdomain mit-krb5 $^)
+$(LIBKRB5_DIR)/error_tables/krb5_err.c: $(LIBKRB5_DIR)/error_tables/et-c-krb5_err.c
+	$(call verbose_cmd,GEN,libkrb: $(notdir $@), cd $(LIBKRB5_DIR)/error_tables && mv -f $^ $@ && rm -f et-c-krb5_err.et et-c-krb5_err.h)
+
+$(LIBKRB5_DIR)/error_tables/et-c-k5e1_err.et: $(LIBKRB5_DIR)/error_tables/k5e1_err.et
+	$(call verbose_cmd,GEN,libkrb: $(notdir $@), cd $(LIBKRB5_DIR)/error_tables && rm -f et-c-k5e1_err.et et-c-k5e1_err.c et-c-k5e1_err.h && cp $^ $@)
+$(LIBKRB5_DIR)/error_tables/et-c-k5e1_err.c: $(LIBKRB5_DIR)/error_tables/et-c-k5e1_err.et
+	$(call verbose_cmd,GEN,libkrb: $(notdir $@), cd $(LIBKRB5_DIR)/error_tables && $(LIBKRB5_COMPILE_PATH)/compile_et -d $(LIBKRB5_COMPILE_PATH) --textdomain mit-krb5 $^)
+$(LIBKRB5_DIR)/error_tables/k5e1_err.c: $(LIBKRB5_DIR)/error_tables/et-c-k5e1_err.c
+	$(call verbose_cmd,GEN,libkrb: $(notdir $@), cd $(LIBKRB5_DIR)/error_tables && mv -f $^ $@ && rm -f et-c-k5e1_err.et et-c-k5e1_err.h)
+
+$(LIBKRB5_DIR)/error_tables/et-c-kv5m_err.et: $(LIBKRB5_DIR)/error_tables/kv5m_err.et
+	$(call verbose_cmd,GEN,libkrb: $(notdir $@), cd $(LIBKRB5_DIR)/error_tables && rm -f et-c-kv5m_err.et et-c-kv5m_err.c et-c-kv5m_err.h && cp $^ $@)
+$(LIBKRB5_DIR)/error_tables/et-c-kv5m_err.c: $(LIBKRB5_DIR)/error_tables/et-c-kv5m_err.et
+	$(call verbose_cmd,GEN,libkrb: $(notdir $@), cd $(LIBKRB5_DIR)/error_tables && $(LIBKRB5_COMPILE_PATH)/compile_et -d $(LIBKRB5_COMPILE_PATH) --textdomain mit-krb5 $^)
+$(LIBKRB5_DIR)/error_tables/kv5m_err.c: $(LIBKRB5_DIR)/error_tables/et-c-kv5m_err.c
+	$(call verbose_cmd,GEN,libkrb: $(notdir $@), cd $(LIBKRB5_DIR)/error_tables && mv -f $^ $@ && rm -f et-c-kv5m_err.et et-c-kv5m_err.h)
+
+$(LIBKRB5_DIR)/error_tables/et-c-krb524_err.et: $(LIBKRB5_DIR)/error_tables/krb524_err.et
+	$(call verbose_cmd,GEN,libkrb: $(notdir $@), cd $(LIBKRB5_DIR)/error_tables && rm -f et-c-krb524_err.et et-c-krb524_err.c et-c-krb524_err.h && cp $^ $@)
+$(LIBKRB5_DIR)/error_tables/et-c-krb524_err.c: $(LIBKRB5_DIR)/error_tables/et-c-krb524_err.et
+	$(call verbose_cmd,GEN,libkrb: $(notdir $@), cd $(LIBKRB5_DIR)/error_tables && $(LIBKRB5_COMPILE_PATH)/compile_et -d $(LIBKRB5_COMPILE_PATH) --textdomain mit-krb5 $^)
+$(LIBKRB5_DIR)/error_tables/krb524_err.c: $(LIBKRB5_DIR)/error_tables/et-c-krb524_err.c
+	$(call verbose_cmd,GEN,libkrb: $(notdir $@), cd $(LIBKRB5_DIR)/error_tables && mv -f $^ $@ && rm -f et-c-krb524_err.et et-c-krb524_err.h)
+
+$(LIBKRB5_DIR)/error_tables/et-h-asn1_err.et: $(LIBKRB5_DIR)/error_tables/asn1_err.et
+	$(call verbose_cmd,GEN,libkrb: $(notdir $@), cd $(LIBKRB5_DIR)/error_tables && rm -f et-h-asn1_err.et et-h-asn1_err.c et-h-asn1_err.h && cp $^ $@)
+$(LIBKRB5_DIR)/error_tables/et-h-asn1_err.h: $(LIBKRB5_DIR)/error_tables/et-h-asn1_err.et
+	$(call verbose_cmd,GEN,libkrb: $(notdir $@), cd $(LIBKRB5_DIR)/error_tables && $(LIBKRB5_COMPILE_PATH)/compile_et -d $(LIBKRB5_COMPILE_PATH) --textdomain mit-krb5 $^)
+$(LIBKRB5_DIR)/error_tables/asn1_err.h: $(LIBKRB5_DIR)/error_tables/et-h-asn1_err.h
+	$(call verbose_cmd,GEN,libkrb: $(notdir $@), cd $(LIBKRB5_DIR)/error_tables && mv -f $^ $@ && rm -f et-h-asn1_err.et et-h-asn1_err.c)
+
+$(LIBKRB5_DIR)/error_tables/et-h-kdb5_err.et: $(LIBKRB5_DIR)/error_tables/kdb5_err.et
+	$(call verbose_cmd,GEN,libkrb: $(notdir $@), cd $(LIBKRB5_DIR)/error_tables && rm -f et-h-kdb5_err.et et-h-kdb5_err.c et-h-kdb5_err.h && cp $^ $@)
+$(LIBKRB5_DIR)/error_tables/et-h-kdb5_err.h: $(LIBKRB5_DIR)/error_tables/et-h-kdb5_err.et
+	$(call verbose_cmd,GEN,libkrb: $(notdir $@), cd $(LIBKRB5_DIR)/error_tables && $(LIBKRB5_COMPILE_PATH)/compile_et -d $(LIBKRB5_COMPILE_PATH) --textdomain mit-krb5 $^)
+$(LIBKRB5_DIR)/error_tables/kdb5_err.h: $(LIBKRB5_DIR)/error_tables/et-h-kdb5_err.h
+	$(call verbose_cmd,GEN,libkrb: $(notdir $@), cd $(LIBKRB5_DIR)/error_tables && mv -f $^ $@ && rm -f et-h-kdb5_err.et et-h-kdb5_err.c)
+
+$(LIBKRB5_DIR)/error_tables/et-h-krb5_err.et: $(LIBKRB5_DIR)/error_tables/krb5_err.et
+	$(call verbose_cmd,GEN,libkrb: $(notdir $@), cd $(LIBKRB5_DIR)/error_tables && rm -f et-h-krb5_err.et et-h-krb5_err.c et-h-krb5_err.h && cp $^ $@)
+$(LIBKRB5_DIR)/error_tables/et-h-krb5_err.h: $(LIBKRB5_DIR)/error_tables/et-h-krb5_err.et
+	$(call verbose_cmd,GEN,libkrb: $(notdir $@), cd $(LIBKRB5_DIR)/error_tables && $(LIBKRB5_COMPILE_PATH)/compile_et -d $(LIBKRB5_COMPILE_PATH) --textdomain mit-krb5 $^)
+$(LIBKRB5_DIR)/error_tables/krb5_err.h: $(LIBKRB5_DIR)/error_tables/et-h-krb5_err.h
+	$(call verbose_cmd,GEN,libkrb: $(notdir $@), cd $(LIBKRB5_DIR)/error_tables && mv -f $^ $@ && rm -f et-h-krb5_err.et et-h-krb5_err.c)
+
+$(LIBKRB5_DIR)/error_tables/et-h-k5e1_err.et: $(LIBKRB5_DIR)/error_tables/k5e1_err.et
+	$(call verbose_cmd,GEN,libkrb: $(notdir $@), cd $(LIBKRB5_DIR)/error_tables && rm -f et-h-k5e1_err.et et-h-k5e1_err.c et-h-k5e1_err.h && cp $^ $@)
+$(LIBKRB5_DIR)/error_tables/et-h-k5e1_err.h: $(LIBKRB5_DIR)/error_tables/et-h-k5e1_err.et
+	$(call verbose_cmd,GEN,libkrb: $(notdir $@), cd $(LIBKRB5_DIR)/error_tables && $(LIBKRB5_COMPILE_PATH)/compile_et -d $(LIBKRB5_COMPILE_PATH) --textdomain mit-krb5 $^)
+$(LIBKRB5_DIR)/error_tables/k5e1_err.h: $(LIBKRB5_DIR)/error_tables/et-h-k5e1_err.h
+	$(call verbose_cmd,GEN,libkrb: $(notdir $@), cd $(LIBKRB5_DIR)/error_tables && mv -f $^ $@ && rm -f et-h-k5e1_err.et et-h-k5e1_err.c)
+
+$(LIBKRB5_DIR)/error_tables/et-h-kv5m_err.et: $(LIBKRB5_DIR)/error_tables/kv5m_err.et
+	$(call verbose_cmd,GEN,libkrb: $(notdir $@), cd $(LIBKRB5_DIR)/error_tables && rm -f et-h-kv5m_err.et et-h-kv5m_err.c et-h-kv5m_err.h && cp $^ $@)
+$(LIBKRB5_DIR)/error_tables/et-h-kv5m_err.h: $(LIBKRB5_DIR)/error_tables/et-h-kv5m_err.et
+	$(call verbose_cmd,GEN,libkrb: $(notdir $@), cd $(LIBKRB5_DIR)/error_tables && $(LIBKRB5_COMPILE_PATH)/compile_et -d $(LIBKRB5_COMPILE_PATH) --textdomain mit-krb5 $^)
+$(LIBKRB5_DIR)/error_tables/kv5m_err.h: $(LIBKRB5_DIR)/error_tables/et-h-kv5m_err.h
+	$(call verbose_cmd,GEN,libkrb: $(notdir $@), cd $(LIBKRB5_DIR)/error_tables && mv -f $^ $@ && rm -f et-h-kv5m_err.et et-h-kv5m_err.c)
+
+$(LIBKRB5_DIR)/error_tables/et-h-krb524_err.et: $(LIBKRB5_DIR)/error_tables/krb524_err.et
+	$(call verbose_cmd,GEN,libkrb: $(notdir $@), cd $(LIBKRB5_DIR)/error_tables && rm -f et-h-krb524_err.et et-h-krb524_err.c et-h-krb524_err.h && cp $^ $@)
+$(LIBKRB5_DIR)/error_tables/et-h-krb524_err.h: $(LIBKRB5_DIR)/error_tables/et-h-krb524_err.et
+	$(call verbose_cmd,GEN,libkrb: $(notdir $@), cd $(LIBKRB5_DIR)/error_tables && $(LIBKRB5_COMPILE_PATH)/compile_et -d $(LIBKRB5_COMPILE_PATH) --textdomain mit-krb5 $^)
+$(LIBKRB5_DIR)/error_tables/krb524_err.h: $(LIBKRB5_DIR)/error_tables/et-h-krb524_err.h
+	$(call verbose_cmd,GEN,libkrb: $(notdir $@), cd $(LIBKRB5_DIR)/error_tables && mv -f $^ $@ && rm -f et-h-krb524_err.et et-h-krb524_err.c)
+
+$(LIBKRB5_MAINDIR)/util/profile/et-h-prof_err.et: $(LIBKRB5_MAINDIR)/util/profile/prof_err.et
+	$(call verbose_cmd,GEN,libkrb: $(notdir $@), cd $(LIBKRB5_MAINDIR)/util/profile && rm -f et-h-prof_err.et et-h-prof_err.c et-h-prof_err.h && cp $^ $@)
+$(LIBKRB5_MAINDIR)/util/profile/et-h-prof_err.h: $(LIBKRB5_MAINDIR)/util/profile/et-h-prof_err.et
+	$(call verbose_cmd,GEN,libkrb: $(notdir $@), cd $(LIBKRB5_MAINDIR)/util/profile && $(LIBKRB5_COMPILE_PATH)/compile_et -d $(LIBKRB5_COMPILE_PATH) --textdomain mit-krb5 $^)
+$(LIBKRB5_MAINDIR)/util/profile/prof_err.h: $(LIBKRB5_MAINDIR)/util/profile/et-h-prof_err.h
+	$(call verbose_cmd,GEN,libkrb: $(notdir $@), cd $(LIBKRB5_MAINDIR)/util/profile && mv -f $^ $@ && rm -f et-h-prof_err.et et-h-prof_err.c)
+
+# There are 2 camellia.c in the library, so we must differentiate them
+$(LIBKRB5CRYPTO_DIR)/builtin/enc_provider/enc_camellia.c: $(LIBKRB5CRYPTO_DIR)/builtin/enc_provider/camellia.c
+	$(call verbose_cmd,GEN,libkrb5crypto: $(notdir $@), cp $^ $@)
+
+LIBKRB5_DEPS = \
+	$(LIBKRB5_MAINDIR)/.configured \
+	$(LIBKRB5_MAINDIR)/include/osconf.h \
+	$(LIBKRB5_MAINDIR)/include/com_err.h \
+	$(LIBKRB5_COMPILE_PATH)/compile_et \
+	$(LIBKRB5_MAINDIR)/util/profile/prof_err.h \
+	$(LIBKRB5_MAINDIR)/include/profile.h \
+	$(LIBKRB5_DIR)/error_tables/krb524_err.c \
+	$(LIBKRB5_DIR)/error_tables/kv5m_err.c \
+	$(LIBKRB5_DIR)/error_tables/k5e1_err.c \
+	$(LIBKRB5_DIR)/error_tables/krb5_err.c \
+	$(LIBKRB5_DIR)/error_tables/kdb5_err.c \
+	$(LIBKRB5_DIR)/error_tables/asn1_err.c \
+	$(LIBKRB5_DIR)/error_tables/krb524_err.h \
+	$(LIBKRB5_DIR)/error_tables/kv5m_err.h \
+	$(LIBKRB5_DIR)/error_tables/k5e1_err.h \
+	$(LIBKRB5_DIR)/error_tables/krb5_err.h \
+	$(LIBKRB5_DIR)/error_tables/kdb5_err.h \
+	$(LIBKRB5_DIR)/error_tables/asn1_err.h \
+	$(LIBKRB5_MAINDIR)/include/krb5/krb5.h \
+	$(LIBKRB5CRYPTO_DIR)/builtin/enc_provider/enc_camellia.c \
+
+UK_PREPARE += $(LIBKRB5_DEPS)
diff --git a/include/byteswap.h b/include/byteswap.h
new file mode 100644
index 0000000..00b9df3
--- /dev/null
+++ b/include/byteswap.h
@@ -0,0 +1,26 @@
+#ifndef _BYTESWAP_H
+#define _BYTESWAP_H
+
+#include <features.h>
+#include <stdint.h>
+
+static __inline uint16_t __bswap_16(uint16_t __x)
+{
+	return __x<<8 | __x>>8;
+}
+
+static __inline uint32_t __bswap_32(uint32_t __x)
+{
+	return __x>>24 | __x>>8&0xff00 | __x<<8&0xff0000 | __x<<24;
+}
+
+static __inline uint64_t __bswap_64(uint64_t __x)
+{
+	return __bswap_32(__x)+0ULL<<32 | __bswap_32(__x>>32);
+}
+
+#define bswap_16(x) __bswap_16(x)
+#define bswap_32(x) __bswap_32(x)
+#define bswap_64(x) __bswap_64(x)
+
+#endif
-- 
2.25.1



From minios-devel-bounces@lists.xenproject.org Thu Aug 20 09:53:09 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Thu, 20 Aug 2020 09:53:09 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1k8hFs-0000n6-VX; Thu, 20 Aug 2020 09:53:08 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=WisD=B6=gmail.com=cristianvijelie@srs-us1.protection.inumbo.net>)
 id 1k8hFr-0000lJ-G3
 for minios-devel@lists.xen.org; Thu, 20 Aug 2020 09:53:07 +0000
X-Inumbo-ID: daf937d2-0fa6-460f-9902-1ac6851f9f43
Received: from mail-ed1-x52e.google.com (unknown [2a00:1450:4864:20::52e])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id daf937d2-0fa6-460f-9902-1ac6851f9f43;
 Thu, 20 Aug 2020 09:53:01 +0000 (UTC)
Received: by mail-ed1-x52e.google.com with SMTP id c10so1089703edk.6
 for <minios-devel@lists.xen.org>; Thu, 20 Aug 2020 02:53:01 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=from:to:cc:subject:date:message-id:in-reply-to:references
 :mime-version:content-transfer-encoding;
 bh=cNMkX9Js2CHEMT7ONk1Ssa3OPm1MFCbAcCucuo8EHIg=;
 b=Q5LVszR39GpNxpwccMP2wQ7Z0SDnroTq2nZO+FJb6wOZvwsSDQIekOj/xqAfc745T3
 NAGcLURXLyvDjlhnlqzE/sz72IgUJDnKvNAzPuLYOnkzmBzuc72DJ7Ue5E6ONXFkbpUo
 191sLnzaEeTnmuOZiudXc+XAU6ajulDbwHsbCyESw/5Aw1UkHt88qQUBQCg/fqu+2Sen
 aF3JVYMT8UxaxaC3OmzQXSwyra+0lhnSzdRNqnnxxfORqJ7v0NU6Ic0mW1l+SJHpHcBX
 Bai6fGVAvUvWNi9Zr1DWx62YXL8jfgykkYVALpSo3wiNK6ikRiUPx2yPKzBjkaQnDWJw
 jQTQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to
 :references:mime-version:content-transfer-encoding;
 bh=cNMkX9Js2CHEMT7ONk1Ssa3OPm1MFCbAcCucuo8EHIg=;
 b=sSk74QiaP3CY9WlsPesuq+4AzwOHKlq3n5+2IX2OvEtKAOtGfqfEwmHdCl1T2gJ1fF
 hirEEjxIEWIEUaaN+Y3ROpIiqXs1psTZo5TnwpjrYzt/0M2UMt6BloAHdVmpzYG69nQe
 oCVKjYSqfpS2okVoGZ2C+NFKXnGvAS/I+nQw+9B8FfL1Z1VCzu2fE3Pqh+hEGl+Vyc2X
 kBFQjdppy0mWJHja3hMHUTAEIHWxSD2MX7uIFDGBJgs7qa0dRD+cyJ82V1sYWaR2mYKm
 MJzRw6F4aQX7R+jb3NrFfFLEdDDGd9henz+K0CzJdmthP8EYz16EWisillDIzmcQ0Itm
 V2ag==
X-Gm-Message-State: AOAM533vUm5VkQNR2de78o/8n0IB6nqapov2mkA15oMEtrax327Xizyd
 lSR806FmwBqbq6FFqIDjWApJjHaSIMc=
X-Google-Smtp-Source: ABdhPJwHjSMPSWpy5DA0CvRA7gmZuijHNWJQG1GvwC/qfFOxmXIXXVJUfHby7AWyYj/CiNblDtJRcA==
X-Received: by 2002:aa7:c983:: with SMTP id c3mr2002007edt.383.1597917179919; 
 Thu, 20 Aug 2020 02:52:59 -0700 (PDT)
Received: from localhost.localdomain ([82.137.12.155])
 by smtp.gmail.com with ESMTPSA id p8sm1109310ejx.53.2020.08.20.02.52.58
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Thu, 20 Aug 2020 02:52:59 -0700 (PDT)
From: cristianvijelie@gmail.com
To: minios-devel@lists.xen.org
Cc: Cristian Vijelie <cristianvijelie@gmail.com>
Subject: [UNIKRAFT/KERBEROS 2/4] Added libkrb5 sources
Date: Thu, 20 Aug 2020 12:52:50 +0300
Message-Id: <20200820095252.77993-3-cristianvijelie@gmail.com>
X-Mailer: git-send-email 2.25.1
In-Reply-To: <20200820095252.77993-1-cristianvijelie@gmail.com>
References: <20200820095252.77993-1-cristianvijelie@gmail.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-BeenThere: minios-devel@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Mini-os development list <minios-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:minios-devel@lists.xenproject.org>
List-Help: <mailto:minios-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: minios-devel-bounces@lists.xenproject.org
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>

From: Cristian Vijelie <cristianvijelie@gmail.com>

Signed-off-by: Cristian <cristianvijelie@gmail.com>
---
 .gitignore  |   2 +
 Config.uk   |   2 +-
 Makefile.uk | 251 +++++++++++++++++++++++++++++++++++++++++++++++-----
 3 files changed, 232 insertions(+), 23 deletions(-)

diff --git a/.gitignore b/.gitignore
index 890d606..01e46c1 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,5 @@
 krb5-1.18.2
 *_make
 make_log
+0000-cover-letter.patch
+0001-Ported-libkrb5support-libkrb5crypto-and-libcom_err.patch
diff --git a/Config.uk b/Config.uk
index 73176de..ab7834e 100644
--- a/Config.uk
+++ b/Config.uk
@@ -12,11 +12,11 @@ menuconfig LIBKRB5SUPPORT
     select LIBLWIP
     select LWIP_UKNETDEV
 	select LWIP_TCP
-	select LWIP_TCP_KEEPALIVE
 	select LWIP_THREADS
 	select LWIP_SOCKET
 	select LWIP_IPV4
     select LWIP_IPV6
+    select LWIP_DNS
     default n
 
 menuconfig LIBKRB5CRYPTO
diff --git a/Makefile.uk b/Makefile.uk
index eea8972..1f901f1 100644
--- a/Makefile.uk
+++ b/Makefile.uk
@@ -28,7 +28,7 @@ LIBKRB5SUPPORT_DIR=$(LIBKRB5_MAINDIR)/util/support
 LIBKRB5CRYPTO_DIR=$(LIBKRB5_MAINDIR)/lib/crypto
 
 ##############################################################################################
-# libkrb5 flags
+# Initialize library flags
 ##############################################################################################
 LIBKRB5_CFLAGS += -fPIC -DSHARED -DHAVE_CONFIG_H  -I$(LIBKRB5_BASE)/include \
 -I$(LIBKRB5_MAINDIR)/include  -DKRB5_DEPRECATED=1 -DKRB5_PRIVATE -Wall -Wcast-align -Wshadow \
@@ -39,23 +39,237 @@ LIBKRB5_CFLAGS += -fPIC -DSHARED -DHAVE_CONFIG_H  -I$(LIBKRB5_BASE)/include \
 -Werror=int-conversion -Werror=incompatible-pointer-types -Werror=discarded-qualifiers \
 -Werror=implicit-int -Werror=declaration-after-statement -Werror-implicit-function-declaration
 
+LIBCOM_ERR_CFLAGS = $(LIBKRB5_CFLAGS)
+
+LIBKRB5_CFLAGS += -I$(LIBNEWLIB_LIBC)/sys/linux/include
+LIBKRB5_CFLAGS += -I$(LIBNEWLIB_LIBC)/sys/linux
+LIBKRB5_CFLAGS += -I$(LIBNEWLIB_LIBC)/sys/linux/sys
+
+LIBKRB5SUPPORT_OBJFLAGS = $(LIBKRB5_OBJFLAGS)
+LIBKRB5CRYPTO_CFLAGS = $(LIBKRB5_CFLAGS)
+
+LIBKRB5_CFLAGS += -I$(LIBKRB5_DIR)/ccache
+LIBKRB5_CFLAGS += -I$(LIBKRB5_DIR)/ccache/ccapi
+LIBKRB5_CFLAGS += -I$(LIBKRB5_DIR)/os
+LIBKRB5_CFLAGS += -I$(LIBKRB5_DIR)/keytab
+LIBKRB5_CFLAGS += -I$(LIBKRB5_DIR)/rcache
+LIBKRB5_CFLAGS += -I$(LIBKRB5_DIR)/unicode
+LIBKRB5_CFLAGS += -I$(LIBKRB5_MAINDIR)
+LIBKRB5_CFLAGS += -I$(LIBKRB5_MAINDIR)/util/profile
+LIBKRB5_CFLAGS += -DLIBDIR=\"/usr/local/lib\"
+LIBKRB5_CFLAGS += -DDYNOBJEXT=\".so\"
+LIBKRB5_CFLAGS += -DBINDIR=\"/usr/local/bin\"
+LIBKRB5_CFLAGS += -DSBINDIR=\"/usr/local/sbin\"
+
 LIBKRB5_OBJFLAGS += -shared -fPIC -Wl,--no-undefined -Wl,--enable-new-dtags \
 -Wl,-rpath
 
 ##############################################################################################
 # libkrb5 code
 ##############################################################################################
-LIBKRB5_SRCS-y += 
-
-##############################################################################################
-# libkrb5support flags
-##############################################################################################
-
-LIBKRB5SUPPORT_CFLAGS = $(LIBKRB5_CFLAGS)
-LIBKRB5SUPPORT_CFLAGS += -I$(LIBNEWLIB_LIBC)/sys/linux/include
-LIBKRB5SUPPORT_CFLAGS += -I$(LIBNEWLIB_LIBC)/sys/linux
-LIBKRB5SUPPORT_CFLAGS += -I$(LIBNEWLIB_LIBC)/sys/linux/sys
-LIBKRB5SUPPORT_OBJFLAGS = $(LIBKRB5_OBJFLAGS)
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/error_tables/asn1_err.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/error_tables/kdb5_err.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/error_tables/krb5_err.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/error_tables/k5e1_err.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/error_tables/kv5m_err.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/error_tables/krb524_err.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/asn.1/asn1_encode.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/asn.1/asn1_k_encode.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/asn.1/ldap_key_seq.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/ccache/ccbase.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/ccache/cccopy.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/ccache/cccursor.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/ccache/ccdefault.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/ccache/ccdefops.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/ccache/ccmarshal.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/ccache/ccselect.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/ccache/ccselect_hostname.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/ccache/ccselect_k5identity.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/ccache/ccselect_realm.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/ccache/cc_dir.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/ccache/cc_retr.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/ccache/cc_file.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/ccache/cc_kcm.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/ccache/cc_memory.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/ccache/cc_keyring.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/ccache/ccfns.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/keytab/ktadd.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/keytab/ktbase.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/keytab/ktdefault.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/keytab/ktfr_entry.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/keytab/ktremove.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/keytab/ktfns.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/keytab/kt_file.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/keytab/kt_memory.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/keytab/read_servi.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/addr_comp.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/addr_order.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/addr_srch.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/allow_weak.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/appdefault.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/ai_authdata.c 
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/auth_con.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/cammac_util.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/authdata.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/authdata_exp.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/authdata_enc.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/authdata_dec.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/bld_pr_ext.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/bld_princ.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/chk_trans.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/chpw.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/conv_creds.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/conv_princ.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/copy_addrs.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/copy_auth.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/copy_athctr.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/copy_cksum.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/copy_creds.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/copy_data.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/copy_key.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/copy_princ.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/copy_tick.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/cp_key_cnt.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/decode_kdc.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/decrypt_tk.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/deltat.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/enc_helper.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/enc_keyhelper.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/encode_kdc.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/encrypt_tk.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/etype_list.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/fast.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/fwd_tgt.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/gc_via_tkt.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/gen_seqnum.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/gen_subkey.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/gen_save_subkey.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/get_creds.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/get_etype_info.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/get_in_tkt.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/gic_keytab.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/gic_opt.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/gic_pwd.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/in_tkt_sky.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/init_ctx.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/copy_ctx.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/init_keyblock.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/kdc_rep_dc.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/kerrs.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/kfree.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/libdef_parse.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/mk_cred.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/mk_error.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/mk_priv.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/mk_rep.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/mk_req.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/mk_req_ext.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/mk_safe.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/pac.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/pac_sign.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/padata.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/parse.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/parse_host_string.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/plugin.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/pr_to_salt.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/preauth2.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/preauth_ec.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/preauth_encts.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/preauth_otp.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/preauth_pkinit.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/preauth_sam2.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/princ_comp.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/privsafe.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/random_str.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/rd_cred.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/rd_error.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/rd_priv.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/rd_rep.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/rd_req.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/rd_req_dec.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/rd_safe.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/recvauth.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/response_items.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/s4u_authdata.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/s4u_creds.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/sendauth.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/send_tgs.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/ser_actx.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/ser_adata.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/ser_addr.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/ser_auth.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/ser_cksum.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/ser_ctx.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/ser_key.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/ser_princ.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/serialize.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/set_realm.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/sname_match.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/srv_dec_tkt.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/srv_rcache.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/str_conv.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/tgtname.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/unparse.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/val_renew.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/valid_times.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/vfy_increds.c 
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/vic_opt.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/walk_rtree.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/os/accessor.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/os/c_ustime.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/os/ccdefname.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/os/changepw.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/os/dnsglue.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/os/dnssrv.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/os/expand_path.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/os/full_ipadr.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/os/gen_port.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/os/genaddrs.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/os/gen_rname.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/os/hostaddr.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/os/hostrealm.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/os/hostrealm_dns.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/os/hostrealm_domain.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/os/hostrealm_profile.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/os/hostrealm_registry.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/os/init_os_ctx.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/os/krbfileio.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/os/ktdefname.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/os/mk_faddr.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/os/localaddr.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/os/localauth.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/os/localauth_an2ln.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/os/localauth_k5login.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/os/localauth_names.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/os/localauth_rule.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/os/locate_kdc.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/os/lock_file.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/os/net_read.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/os/net_write.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/os/port2ip.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/os/prompter.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/os/read_msg.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/os/read_pwd.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/os/realm_dom.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/os/sendto_kdc.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/os/sn2princ.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/os/thread_safe.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/os/timeofday.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/os/toffset.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/os/trace.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/os/unlck_file.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/os/ustime.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/os/write_msg.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/rcache/memrcache.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/rcache/rc_base.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/rcache/rc_dfl.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/rcache/rc_file2.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/rcache/rc_none.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/unicode/ucdata.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/unicode/ure.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/unicode/urestubs.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/unicode/ucstr.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb5_libinit.c
 
 ##############################################################################################
 # libkrb5support code
@@ -83,7 +297,6 @@ LIBKRB5SUPPORT_SRCS-y += $(LIBKRB5SUPPORT_DIR)/strlcpy.c
 ##############################################################################################
 # libkrb5crypto flags
 ##############################################################################################
-LIBKRB5CRYPTO_CFLAGS = $(LIBKRB5_CFLAGS)
 LIBKRB5CRYPTO_CFLAGS += -I$(LIBKRB5CRYPTO_DIR)/krb
 LIBKRB5CRYPTO_CFLAGS += -I$(LIBKRB5CRYPTO_DIR)/builtin
 LIBKRB5CRYPTO_CFLAGS += -I$(LIBKRB5CRYPTO_DIR)/builtin/aes
@@ -93,9 +306,6 @@ LIBKRB5CRYPTO_CFLAGS += -I$(LIBKRB5CRYPTO_DIR)/builtin/md4
 LIBKRB5CRYPTO_CFLAGS += -I$(LIBKRB5CRYPTO_DIR)/builtin/md5
 LIBKRB5CRYPTO_CFLAGS += -I$(LIBKRB5CRYPTO_DIR)/builtin/sha1
 LIBKRB5CRYPTO_CFLAGS += -I$(LIBKRB5CRYPTO_DIR)/builtin/sha2
-LIBKRB5CRYPTO_CFLAGS += -I$(LIBNEWLIB_LIBC)/sys/linux/include
-LIBKRB5CRYPTO_CFLAGS += -I$(LIBNEWLIB_LIBC)/sys/linux
-LIBKRB5CRYPTO_CFLAGS += -I$(LIBNEWLIB_LIBC)/sys/linux/sys
 LIBKRB5CRYPTO_OBJFLAGS = $(LIBKRB5_OBJFLAGS)
 
 ##############################################################################################
@@ -189,11 +399,6 @@ LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/builtin/hmac.c
 LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/builtin/init.c
 LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/builtin/pbkdf2.c
 
-##############################################################################################
-# libcom_err flags
-##############################################################################################
-LIBCOM_ERR_CFLAGS = $(LIBKRB5_CFLAGS)
-
 ##############################################################################################
 # libcom_err code
 ##############################################################################################
@@ -207,7 +412,9 @@ LIBCOM_ERR_SRCS-y += $(LIBKRB5_COMPILE_PATH)/com_err.c
 # Run ./configure
 $(LIBKRB5_MAINDIR)/.configured: $(LIBKRB5_BUILD)/.origin
 	$(call verbose_cmd,CONFIG,libkrb: $(notdir $@), cd $(LIBKRB5_MAINDIR) && ./configure \
-	--disable-nls && touch $@)
+	--disable-nls && touch $@ && cd include && \
+	sed -e "s/#define HAVE_SECURE_GETENV 1/\/\* #undef HAVE_SECURE_GETENV \*\//" autoconf.h > \
+	autoconf.temp && mv autoconf.temp autoconf.h)
 
 # Generate compile_et
 $(LIBKRB5_COMPILE_PATH)/compile_et:
-- 
2.25.1



From minios-devel-bounces@lists.xenproject.org Thu Aug 20 09:53:14 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Thu, 20 Aug 2020 09:53:14 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1k8hFy-0000o6-18; Thu, 20 Aug 2020 09:53:14 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=WisD=B6=gmail.com=cristianvijelie@srs-us1.protection.inumbo.net>)
 id 1k8hFw-0000lJ-GB
 for minios-devel@lists.xen.org; Thu, 20 Aug 2020 09:53:12 +0000
X-Inumbo-ID: f4e5084b-d1a2-4b50-9ee2-b5ca7a410dac
Received: from mail-ej1-x635.google.com (unknown [2a00:1450:4864:20::635])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id f4e5084b-d1a2-4b50-9ee2-b5ca7a410dac;
 Thu, 20 Aug 2020 09:53:02 +0000 (UTC)
Received: by mail-ej1-x635.google.com with SMTP id kq25so1773814ejb.3
 for <minios-devel@lists.xen.org>; Thu, 20 Aug 2020 02:53:02 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=from:to:cc:subject:date:message-id:in-reply-to:references
 :mime-version:content-transfer-encoding;
 bh=cK/whXDMMNN0ZS67yuqkodbrDFvC4DhdacNRap72CXE=;
 b=mS7HLtranVyjoMrTtmscKCxVTHhHtUl4DYxKN0J/xPyW+cRLgUk2GL13rz1m/oMo2D
 qBhaCRVAQLrgEPZWcqbwmeV62xm9sKtIo4hPXYgDCn/JCBFM2EAh/b+slxlHu+0yU+pE
 FGvS8wMazw0C5DSXSHsCIZU5eB/AMzVNtNpZ1v7AT57ocQ32vk8+sYhLrLI6kGEYs0Ro
 gTq0tO8N1u7F6Opw2b1omE6qwp6+ZaKcmnNfaF90W9cVi5j293QrNFHRFbR4U/kTj5if
 UmPSUrla4nqsgwHzvPtj7kDWXq90iXOfM1q2f5k80XYRmBKGK1R80Ix1b0YwKp3E80jD
 NzzQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to
 :references:mime-version:content-transfer-encoding;
 bh=cK/whXDMMNN0ZS67yuqkodbrDFvC4DhdacNRap72CXE=;
 b=kIeCgt5FgAJLghAqY3y3g9n22rnp17PhKCOcD9q/ArYSpj4r+j4sQId7CuFBeOZn6Y
 U7465CbOw1fvzvr7BmqhoPnpCuef7Yu9JnpuhZTaPdg4wprqCTbSywF8joldyNSqb34h
 V5rJjMdFGYd7VE3U9nO6w3cYTcyhzmx/VkSnABAaouiuzYKfMaSY5MJQ59OGF9vJNTob
 OUMwZLU8KL1pCbNg+l0PHl9mPRLNL8E63BkOQDRlmVhsgsK7HC0b06A05XNlAqDV15dw
 odu+0DuRKowjpicdrv9syKXnMxp2MHHwcHv1JnEEDERRqKi8WZ3RcdANKLPXHCBRuXXr
 QAsg==
X-Gm-Message-State: AOAM531C2vf++pIu3mwDP2azIyhYF/ztrC3ABJSvEuT7pmX1q18rK2TW
 weAWakXt2WufoLP55koRYgFg5RNR+vs=
X-Google-Smtp-Source: ABdhPJzTyib7cIBcLyhDoBfsQY0O8Xq1wBM6iUofuwFG444AvAcAkA+wJBySL2mLsshmWHxyw1+n8g==
X-Received: by 2002:a17:906:2296:: with SMTP id
 p22mr2390174eja.510.1597917181745; 
 Thu, 20 Aug 2020 02:53:01 -0700 (PDT)
Received: from localhost.localdomain ([82.137.12.155])
 by smtp.gmail.com with ESMTPSA id p8sm1109310ejx.53.2020.08.20.02.53.00
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Thu, 20 Aug 2020 02:53:01 -0700 (PDT)
From: cristianvijelie@gmail.com
To: minios-devel@lists.xen.org
Cc: Cristian Vijelie <cristianvijelie@gmail.com>
Subject: [UNIKRAFT/KERBEROS 3/4] Added .md files
Date: Thu, 20 Aug 2020 12:52:51 +0300
Message-Id: <20200820095252.77993-4-cristianvijelie@gmail.com>
X-Mailer: git-send-email 2.25.1
In-Reply-To: <20200820095252.77993-1-cristianvijelie@gmail.com>
References: <20200820095252.77993-1-cristianvijelie@gmail.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-BeenThere: minios-devel@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Mini-os development list <minios-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:minios-devel@lists.xenproject.org>
List-Help: <mailto:minios-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: minios-devel-bounces@lists.xenproject.org
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>

From: Cristian Vijelie <cristianvijelie@gmail.com>

Signed-off-by: Cristian <cristianvijelie@gmail.com>
---
 .gitignore      | 3 +--
 CODING_STYLE.md | 4 ++++
 CONTRIBUTING.md | 4 ++++
 MAINTAINERS.md  | 9 +++++++++
 README.md       | 6 ++++++
 5 files changed, 24 insertions(+), 2 deletions(-)
 create mode 100644 CODING_STYLE.md
 create mode 100644 CONTRIBUTING.md
 create mode 100644 MAINTAINERS.md

diff --git a/.gitignore b/.gitignore
index 01e46c1..5fda993 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,5 +1,4 @@
 krb5-1.18.2
 *_make
 make_log
-0000-cover-letter.patch
-0001-Ported-libkrb5support-libkrb5crypto-and-libcom_err.patch
+*.patch
diff --git a/CODING_STYLE.md b/CODING_STYLE.md
new file mode 100644
index 0000000..5730041
--- /dev/null
+++ b/CODING_STYLE.md
@@ -0,0 +1,4 @@
+Coding Style
+============
+
+Please refer to the `CODING_STYLE.md` file in the main Unikraft repository.
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
new file mode 100644
index 0000000..14f6ac6
--- /dev/null
+++ b/CONTRIBUTING.md
@@ -0,0 +1,4 @@
+Contributing to Unikraft
+========================
+
+Please refer to the `CONTRIBUTING.md` file in the main Unikraft repository.
diff --git a/MAINTAINERS.md b/MAINTAINERS.md
new file mode 100644
index 0000000..c123f15
--- /dev/null
+++ b/MAINTAINERS.md
@@ -0,0 +1,9 @@
+Maintainers List
+================
+
+For notes on how to read this information, please refer to `MAINTAINERS.md` in
+the main Unikraft repository.
+
+	LIBNETTLE-UNIKRAFT
+	L:	minios-devel@lists.xen.org
+	F: *
diff --git a/README.md b/README.md
index e69de29..40246bd 100644
--- a/README.md
+++ b/README.md
@@ -0,0 +1,6 @@
+Nettle crypto library for Unikraft
+=============================
+
+This is the port of Unikraft runtime libaries for Unikraft. 
+
+Please refer to the `README.md` as well as the documentation in the `doc/` subdirectory of the main unikraft repository.
-- 
2.25.1



From minios-devel-bounces@lists.xenproject.org Thu Aug 20 09:53:19 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Thu, 20 Aug 2020 09:53:19 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1k8hG3-0000p4-2e; Thu, 20 Aug 2020 09:53:19 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=WisD=B6=gmail.com=cristianvijelie@srs-us1.protection.inumbo.net>)
 id 1k8hG1-0000lJ-GR
 for minios-devel@lists.xen.org; Thu, 20 Aug 2020 09:53:17 +0000
X-Inumbo-ID: 8d4d9e1a-4749-4b76-a1fd-1abdacdc37b5
Received: from mail-ed1-x52f.google.com (unknown [2a00:1450:4864:20::52f])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 8d4d9e1a-4749-4b76-a1fd-1abdacdc37b5;
 Thu, 20 Aug 2020 09:53:04 +0000 (UTC)
Received: by mail-ed1-x52f.google.com with SMTP id bs17so1110915edb.1
 for <minios-devel@lists.xen.org>; Thu, 20 Aug 2020 02:53:04 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=from:to:cc:subject:date:message-id:in-reply-to:references
 :mime-version:content-transfer-encoding;
 bh=YjVuvO9T9J1Dr6fN/rMteyk+37rtKoajAG058rXtz3E=;
 b=aLGmQGejeY7TWaCcEqBIIIP9S2wN8ZWse5ZQkCBtgsIrzz65fQt6BxlU1RVi2s9UXx
 oC3uz1CB85H3+324Ui4GDZdF0trggooGVNeFpYqlYDiW943AmpRt8EqRfv6xdIk/Dt5I
 hsH7QmHFwHXWDwdAMZ81DC13j+7zc6s9EXBkDQvcjMh+T/3VF2DzvALz1SmZvUSxuKWu
 MmiEjEoJNoiK0l4d+gB351iQlhugGeCWS3OaBAPnzdTnftu2RsT8o+h9RDYiPTRimDMO
 NX0LKqwjblT5wEyy/K4bvw2OIwK3cZ31gvdl56lyw6y93BcptR9eot7a3GbP5DQ4wWE4
 eZ8w==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to
 :references:mime-version:content-transfer-encoding;
 bh=YjVuvO9T9J1Dr6fN/rMteyk+37rtKoajAG058rXtz3E=;
 b=NcZWnedX4iEr6F1ut7X7nEnh0MQA13oEIQa9pCuGc0RkcPSWMkDJ++ebobA/nM/evb
 tXpI3L3xIGtAMpFRY9ZXIYXctlAuAaelcb+qBC3us1kIRDlIcPKnjK3XSCrUTIDYrqGD
 GHfCvMe27UsJlNVb5LR/tMHilEP/JZVgsNIrcByxVSHcoBL7x+F7i63B7GXrKpCSib39
 0qXuBRFZbll+j7y+jLISbc5IhnGcXQASHjEqMOL9FEdPwLSIFThf8LivBTq+mxVmAoUN
 Mk+B0yrEKsH7gzKkGtaHII/AP2G5SFexlS8HfpG1bXzH5a7+s7mIM1CKXg7tBO8sgFaL
 Uy+g==
X-Gm-Message-State: AOAM533KpSFcbjpG0DdUZBQuxOmNdVZFViNHDgVfndfcqZcQh4sZ01nx
 Tdcz9HbnA71w2f5+ZSHQoqSoPfB5yXk=
X-Google-Smtp-Source: ABdhPJz0llVPFlyfX0UQGZheh4pdL30vPK+jPQ2J73RQAD9cKocU3WxclKYf7a5tmWOTatEKc1uD0A==
X-Received: by 2002:aa7:cf06:: with SMTP id a6mr2152423edy.293.1597917183558; 
 Thu, 20 Aug 2020 02:53:03 -0700 (PDT)
Received: from localhost.localdomain ([82.137.12.155])
 by smtp.gmail.com with ESMTPSA id p8sm1109310ejx.53.2020.08.20.02.53.02
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Thu, 20 Aug 2020 02:53:03 -0700 (PDT)
From: cristianvijelie@gmail.com
To: minios-devel@lists.xen.org
Cc: Cristian Vijelie <cristianvijelie@gmail.com>
Subject: [UNIKRAFT/KERBEROS 4/4] Fixed the README
Date: Thu, 20 Aug 2020 12:52:52 +0300
Message-Id: <20200820095252.77993-5-cristianvijelie@gmail.com>
X-Mailer: git-send-email 2.25.1
In-Reply-To: <20200820095252.77993-1-cristianvijelie@gmail.com>
References: <20200820095252.77993-1-cristianvijelie@gmail.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-BeenThere: minios-devel@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Mini-os development list <minios-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:minios-devel@lists.xenproject.org>
List-Help: <mailto:minios-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: minios-devel-bounces@lists.xenproject.org
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>

From: Cristian Vijelie <cristianvijelie@gmail.com>

Signed-off-by: Cristian <cristianvijelie@gmail.com>
---
 README.md | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/README.md b/README.md
index 40246bd..9546fa6 100644
--- a/README.md
+++ b/README.md
@@ -1,6 +1,6 @@
-Nettle crypto library for Unikraft
+MIT Kerberos runtime libaries for Unikraft
 =============================
 
-This is the port of Unikraft runtime libaries for Unikraft. 
+This is the port of MIT Kerberos runtime libaries for Unikraft. 
 
 Please refer to the `README.md` as well as the documentation in the `doc/` subdirectory of the main unikraft repository.
-- 
2.25.1



From minios-devel-bounces@lists.xenproject.org Thu Aug 20 10:18:24 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Thu, 20 Aug 2020 10:18:24 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1k8heI-0002lc-0L; Thu, 20 Aug 2020 10:18:22 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=efXq=B6=cs.pub.ro=costin.lupu@srs-us1.protection.inumbo.net>)
 id 1k8heG-0002lX-PZ
 for minios-devel@lists.xen.org; Thu, 20 Aug 2020 10:18:20 +0000
X-Inumbo-ID: dcdcc6ef-3f52-4fd4-85c6-8910c2d1880c
Received: from mx.upb.ro (unknown [141.85.13.230])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id dcdcc6ef-3f52-4fd4-85c6-8910c2d1880c;
 Thu, 20 Aug 2020 10:18:18 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
 by mx.upb.ro (Postfix) with ESMTP id 023C3B560097;
 Thu, 20 Aug 2020 13:18:17 +0300 (EEST)
Received: from mx.upb.ro ([127.0.0.1])
 by localhost (mx.upb.ro [127.0.0.1]) (amavisd-new, port 10032)
 with ESMTP id jZJT5vHSpUKa; Thu, 20 Aug 2020 13:18:14 +0300 (EEST)
Received: from localhost (localhost [127.0.0.1])
 by mx.upb.ro (Postfix) with ESMTP id E1B5DB561CE0;
 Thu, 20 Aug 2020 13:18:14 +0300 (EEST)
X-Virus-Scanned: amavisd-new at upb.ro
Received: from mx.upb.ro ([127.0.0.1])
 by localhost (mx.upb.ro [127.0.0.1]) (amavisd-new, port 10026)
 with ESMTP id ouy6VxBjKElX; Thu, 20 Aug 2020 13:18:14 +0300 (EEST)
Received: from [192.168.1.35] (unknown [188.25.162.205])
 by mx.upb.ro (Postfix) with ESMTPSA id A6EE5B560097;
 Thu, 20 Aug 2020 13:18:14 +0300 (EEST)
Subject: Re: [UNIKRAFT/KERBEROS 0/4] Porting of the MIT Kerberos runtime
 librares
To: cristianvijelie@gmail.com, minios-devel@lists.xen.org
References: <20200820095252.77993-1-cristianvijelie@gmail.com>
From: Costin Lupu <costin.lupu@cs.pub.ro>
Message-ID: <9effc570-e4b5-8c38-e80f-cb89ceee4bde@cs.pub.ro>
Date: Thu, 20 Aug 2020 13:18:14 +0300
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101
 Thunderbird/68.11.0
MIME-Version: 1.0
In-Reply-To: <20200820095252.77993-1-cristianvijelie@gmail.com>
Content-Type: text/plain; charset=utf-8
Content-Language: en-US
Content-Transfer-Encoding: 7bit
X-BeenThere: minios-devel@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Mini-os development list <minios-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:minios-devel@lists.xenproject.org>
List-Help: <mailto:minios-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: minios-devel-bounces@lists.xenproject.org
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>

Hi Cristian,

Please follow the guidelines from here [1]. There is actually a logic
behind how the commits should be structured. You have plenty of examples
here [2] (all those repos that start with lib-).

Please send v2 for all the patches you sent so far only after you
understand properly the guidelines.

[1] https://wiki.xenproject.org/wiki/Unikraft_Porting_Libraries_Walkthrough
[2] https://github.com/unikraft

Cheers,
Costin


From minios-devel-bounces@lists.xenproject.org Thu Aug 20 14:46:08 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Thu, 20 Aug 2020 14:46:08 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1k8lpM-0001tP-Sw; Thu, 20 Aug 2020 14:46:04 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=DN23=B6=neclab.eu=simon.kuenzer@srs-us1.protection.inumbo.net>)
 id 1k8lpL-0001tK-5K
 for minios-devel@lists.xen.org; Thu, 20 Aug 2020 14:46:03 +0000
X-Inumbo-ID: c9a893b4-8afa-4aa8-9f43-21da2cf9c95a
Received: from mailer2.neclab.eu (unknown [195.37.70.41])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id c9a893b4-8afa-4aa8-9f43-21da2cf9c95a;
 Thu, 20 Aug 2020 14:46:00 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
 by mailer2.neclab.eu (Postfix) with ESMTP id 7D106F201A;
 Thu, 20 Aug 2020 16:45:59 +0200 (CEST)
X-Virus-Scanned: Amavisd on Debian GNU/Linux (atlas-b.office.hd)
Received: from mailer2.neclab.eu ([127.0.0.1])
 by localhost (atlas-b.office.hd [127.0.0.1]) (amavisd-new, port 10024)
 with ESMTP id 1GP-Xd9uo4z1; Thu, 20 Aug 2020 16:45:59 +0200 (CEST)
X-ENC: Last-Hop-TLS-encrypted
X-ENC: Last-Hop-TLS-encrypted
Received: from puck.office.hd (puck.office.hd [192.168.24.91])
 (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
 (No client certificate requested)
 by mailer2.neclab.eu (Postfix) with ESMTPS id 5726EF2014;
 Thu, 20 Aug 2020 16:45:55 +0200 (CEST)
Received: from localhost (192.168.24.96) by puck.office.hd (192.168.24.91)
 with Microsoft SMTP Server (version=TLS1_2,
 cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1979.3; Thu, 20 Aug
 2020 16:45:54 +0200
From: Simon Kuenzer <simon.kuenzer@neclab.eu>
To: <minios-devel@lists.xen.org>
CC: Sharan Santhanam <sharan.santhanam@neclab.eu>, Costin Lupu
 <costin.lupu@cs.pub.ro>, Simon Kuenzer <simon.kuenzer@neclab.eu>
Subject: [UNIKRAFT PATCH] lib/uknetdev: Provide IEEE 802.1q, 802.1ad,
 Jumbo frame definitions
Date: Thu, 20 Aug 2020 16:45:49 +0200
Message-ID: <20200820144549.13687-1-simon.kuenzer@neclab.eu>
X-Mailer: git-send-email 2.20.1
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Content-Type: text/plain
X-Originating-IP: [192.168.24.96]
X-ClientProxiedBy: titania.office.hd (192.168.24.89) To puck.office.hd
 (192.168.24.91)
X-BeenThere: minios-devel@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Mini-os development list <minios-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:minios-devel@lists.xenproject.org>
List-Help: <mailto:minios-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: minios-devel-bounces@lists.xenproject.org
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>

This commit includes support for IEEE 802.1q and IEEE 802.1ad tagged
frames to the recently introduced Ethernet header and frame definitions.
Due to these standards, an Ethernet frame (without FCS/CRC) can be 1522 B
(non-jumbo) and 9022 B (jumbo).
Together with this commit, the definitions are name spaced with `UK_`
prefix. This is done to avoid possible macro name clashes when porting
network stacks or packet processing frameworks to libuknetdev.

Signed-off-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
---
 lib/uknetdev/include/uk/netdev_core.h | 56 ++++++++++++++++++++++-----
 plat/drivers/virtio/virtio_net.c      |  8 ++--
 2 files changed, 51 insertions(+), 13 deletions(-)

diff --git a/lib/uknetdev/include/uk/netdev_core.h b/lib/uknetdev/include/uk/netdev_core.h
index 1e8b4e72..b9a994e3 100644
--- a/lib/uknetdev/include/uk/netdev_core.h
+++ b/lib/uknetdev/include/uk/netdev_core.h
@@ -73,16 +73,58 @@ struct uk_netdev;
 UK_TAILQ_HEAD(uk_netdev_list, struct uk_netdev);
 
 /**
- * Ethernet macros
+ * Ethernet size macros
  */
-#define ETH_HDR_LEN           14
-#define ETH_PKT_PAYLOAD_LEN   1500
-#define ETH_PKT_LEN           (ETH_HDR_LEN + ETH_PKT_PAYLOAD_LEN)
+/* Header fields */
+#define UK_ETH_ADDR_LEN			   6
+#define UK_ETH_TYPE_LEN			   2
+#define UK_ETH_8021Q_LEN		(UK_ETH_TYPE_LEN + 2)
+
+/* Ethernet header */
+/* Untagged */
+#define UK_ETH_HDR_UNTAGGED_LEN		((2 * UK_ETH_ADDR_LEN) + \
+					 UK_ETH_TYPE_LEN)
+/* Single VLAN tag (IEEE 802.1q) */
+#define UK_ETH_HDR_8021Q_LEN		(UK_ETH_HDR_UNTAGGED_LEN + \
+					 UK_ETH_8021Q_LEN)
+/* Double VLAN tag (IEEE 802.1q) */
+#define UK_ETH_HDR_8021AD_LEN		(UK_ETH_HDR_UNTAGGED_LEN + \
+					 (2 * UK_ETH_8021Q_LEN))
+
+/* Payload */
+#define UK_ETH_PAYLOAD_MAXLEN		1500
+#define UK_ETH_JPAYLOAD_MAXLEN		9000 /**< Jumbo frame. */
+
+/* Frame sizes */
+#define UK_ETH_FRAME_MINLEN		  60
+
+
+#define UK_ETH_FRAME_UNTAGGED_MAXLEN	(UK_ETH_HDR_UNTAGGED_LEN +	\
+					 UK_ETH_PAYLOAD_MAXLEN)
+#define UK_ETH_FRAME_8021Q_MAXLEN	(UK_ETH_HDR_8021_LEN + \
+					 UK_ETH_PAYLOAD_MAXLEN)
+#define UK_ETH_FRAME_8021AD_MAXLEN	(UK_ETH_HDR_8021ADLEN + \
+					 UK_ETH_PAYLOAD_MAXLEN)
+#define UK_ETH_FRAME_MAXLEN		(UK_ETH_FRAME_8021AD_MAXLEN)
+
+
+#define UK_ETH_JFRAME_UNTAGGED_MAXLEN	(UK_ETH_HDR_UNTAGGED_LEN +	\
+					 UK_ETH_JPAYLOAD_MAXLEN)
+#define UK_ETH_JFRAME_8021Q_MAXLEN	(UK_ETH_HDR_8021_LEN + \
+					 UK_ETH_JPAYLOAD_MAXLEN)
+#define UK_ETH_JFRAME_8021AD_MAXLEN	(UK_ETH_HDR_8021ADLEN + \
+					 UK_ETH_JPAYLOAD_MAXLEN)
+#define UK_ETH_JFRAME_MAXLEN		(UK_ETH_JFRAME_8021AD_MAXLEN)
 
 /**
  * A structure used for Ethernet hardware addresses
  */
-#define UK_NETDEV_HWADDR_LEN 6 /**< Length of Ethernet address. */
+#define UK_NETDEV_HWADDR_LEN		(UK_ETH_ADDR_LEN)
+
+struct uk_hwaddr {
+	uint8_t addr_bytes[UK_NETDEV_HWADDR_LEN];
+} __packed;
+
 
 /**
  * The netdevice support rx/tx interrupt.
@@ -95,10 +137,6 @@ UK_TAILQ_HEAD(uk_netdev_list, struct uk_netdev);
 #define uk_netdev_rxintr_supported(feature)	\
 	(feature & (UK_FEATURE_RXQ_INTR_AVAILABLE))
 
-struct uk_hwaddr {
-	uint8_t addr_bytes[UK_NETDEV_HWADDR_LEN];
-} __packed;
-
 /**
  * A structure used to describe network device capabilities.
  */
diff --git a/plat/drivers/virtio/virtio_net.c b/plat/drivers/virtio/virtio_net.c
index b0663e60..6f5d2422 100644
--- a/plat/drivers/virtio/virtio_net.c
+++ b/plat/drivers/virtio/virtio_net.c
@@ -47,8 +47,8 @@
  *		   12 bytes in length in modern mode.
  */
 #define VIRTIO_HDR_LEN          12
-#define VIRTIO_PKT_BUFFER_LEN ((ETH_PKT_PAYLOAD_LEN)	\
-			       + (ETH_HDR_LEN)		\
+#define VIRTIO_PKT_BUFFER_LEN ((UK_ETH_PAYLOAD_MAXLEN) \
+			       + (UK_ETH_HDR_UNTAGGED_LEN) \
 			       + (VIRTIO_HDR_LEN))
 
 #define DRIVER_NAME           "virtio-net"
@@ -511,7 +511,7 @@ static int virtio_netdev_rxq_dequeue(struct uk_netdev_rx_queue *rxq,
 		*netbuf = NULL;
 		return rxq->nb_desc;
 	}
-	if (unlikely((len < VIRTIO_HDR_LEN + ETH_HDR_LEN)
+	if (unlikely((len < VIRTIO_HDR_LEN + UK_ETH_HDR_UNTAGGED_LEN)
 		     || (len > VIRTIO_PKT_BUFFER_LEN))) {
 		uk_pr_err("Received invalid packet size: %"__PRIu32"\n", len);
 		return -EINVAL;
@@ -1137,7 +1137,7 @@ static int virtio_net_add_dev(struct virtio_dev *vdev)
 	}
 	vndev->uid = rc;
 	rc = 0;
-	vndev->max_mtu = ETH_PKT_PAYLOAD_LEN;
+	vndev->max_mtu = UK_ETH_PAYLOAD_MAXLEN;
 	vndev->mtu = vndev->max_mtu;
 	vndev->promisc = 0;
 	virtio_netdev_feature_set(vndev);
-- 
2.20.1



From minios-devel-bounces@lists.xenproject.org Thu Aug 20 15:17:50 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Thu, 20 Aug 2020 15:17:50 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1k8mK3-0005SM-9X; Thu, 20 Aug 2020 15:17:47 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=DN23=B6=neclab.eu=simon.kuenzer@srs-us1.protection.inumbo.net>)
 id 1k8mK1-0005SE-Oj
 for minios-devel@lists.xen.org; Thu, 20 Aug 2020 15:17:45 +0000
X-Inumbo-ID: 77fb6f65-d98e-4e04-9e7e-d370efad530e
Received: from mailer1.neclab.eu (unknown [195.37.70.40])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 77fb6f65-d98e-4e04-9e7e-d370efad530e;
 Thu, 20 Aug 2020 15:17:43 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
 by mailer1.neclab.eu (Postfix) with ESMTP id 5ABAB10417B;
 Thu, 20 Aug 2020 17:17:42 +0200 (CEST)
X-Virus-Scanned: Amavisd on Debian GNU/Linux (atlas-a.office.hd)
Received: from mailer1.neclab.eu ([127.0.0.1])
 by localhost (atlas-a.office.hd [127.0.0.1]) (amavisd-new, port 10024)
 with ESMTP id f9VsYfBJYEV1; Thu, 20 Aug 2020 17:17:42 +0200 (CEST)
X-ENC: Last-Hop-TLS-encrypted
X-ENC: Last-Hop-TLS-encrypted
Received: from puck.office.hd (puck.office.hd [192.168.24.91])
 (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
 (No client certificate requested)
 by mailer1.neclab.eu (Postfix) with ESMTPS id 33A94103EC2;
 Thu, 20 Aug 2020 17:17:42 +0200 (CEST)
Received: from [10.7.1.42] (192.168.24.96) by puck.office.hd (192.168.24.91)
 with Microsoft SMTP Server (version=TLS1_2,
 cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1979.3; Thu, 20 Aug
 2020 17:17:41 +0200
Subject: Re: [UNIKRAFT PATCH 2/2] arch/arm: Provide ukarch_spinwait noop for
 ARM
To: Julien Grall <julien@xen.org>, Alexander Jung <a.jung@lancs.ac.uk>,
 <minios-devel@lists.xen.org>
CC: Felipe Huici <felipe.huici@neclab.eu>, Alexander Jung
 <alexander.jung@neclab.eu>, Costin Lupu <costin.lupu@cs.pub.ro>, Sharan
 Santhanam <sharan.santhanam@neclab.eu>
References: <20200723081526.50677-1-a.jung@lancs.ac.uk>
 <20200723081526.50677-3-a.jung@lancs.ac.uk>
 <d83a1008-8bc9-202b-05e9-8c6465f800d3@xen.org>
From: Simon Kuenzer <simon.kuenzer@neclab.eu>
Message-ID: <c266796c-d90e-8472-a9d7-5a0bcee9ad2e@neclab.eu>
Date: Thu, 20 Aug 2020 17:17:40 +0200
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:68.0)
 Gecko/20100101 Thunderbird/68.11.0
MIME-Version: 1.0
In-Reply-To: <d83a1008-8bc9-202b-05e9-8c6465f800d3@xen.org>
Content-Type: text/plain; charset="utf-8"; format=flowed
Content-Language: en-US
Content-Transfer-Encoding: 8bit
X-Originating-IP: [192.168.24.96]
X-ClientProxiedBy: oberon.office.hd (192.168.24.90) To puck.office.hd
 (192.168.24.91)
X-BeenThere: minios-devel@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Mini-os development list <minios-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:minios-devel@lists.xenproject.org>
List-Help: <mailto:minios-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: minios-devel-bounces@lists.xenproject.org
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>

On 14.08.20 22:14, Julien Grall wrote:
> Hi,
> 
> On 23/07/2020 09:15, Alexander Jung wrote:
>> ARM does not support a pause-type instruction for busy spin wait
>> operations.Â  This commit provides the same alias to be used in
>> instances where it is required but defaults to a blank operation.
> 
> On Arm, the closest instruction would be "yield".
> 
>>
>> Signed-off-by: Alexander Jung <alexander.jung@neclab.eu>
>> ---
>> Â  arch/arm/arm/include/uk/asm/lcpu.hÂ Â  | 5 +++++
>> Â  arch/arm/arm64/include/uk/asm/lcpu.h | 5 +++++
>> Â  2 files changed, 10 insertions(+)
>>
>> diff --git a/arch/arm/arm/include/uk/asm/lcpu.h 
>> b/arch/arm/arm/include/uk/asm/lcpu.h
>> index cdeffc3..f38ffb9 100644
>> --- a/arch/arm/arm/include/uk/asm/lcpu.h
>> +++ b/arch/arm/arm/include/uk/asm/lcpu.h
>> @@ -57,3 +57,8 @@ struct __regs {
>> Â  #ifndef wmb
>> Â  #define wmb() __asm__("dsb" : : : "memory")
>> Â  #endif
>> +
>> +static inline void ukarch_spinwait(void)
>> +{
>> +Â Â Â  /* Intelligent busy wait not supported on arm. */
> 
> This at least need to contain a barrier() to force the compiler to 
> reload the memory after the wait. Otherwise, it may optimize waiting 
> loop to infinite loop.
> 
> Unfortunately, I don't have a setup with Unikraft. But I am happy to 
> provide a patch if someone else can test it.

Hey Alex, Costin,

can one of you provide a follow-up patch that includes a barrier as 
Julien suggested? I saw that this patch made it upstream already.

Thanks,

Simon

> 
>> +}
>> diff --git a/arch/arm/arm64/include/uk/asm/lcpu.h 
>> b/arch/arm/arm64/include/uk/asm/lcpu.h
>> index 45d1b23..51e17ad 100644
>> --- a/arch/arm/arm64/include/uk/asm/lcpu.h
>> +++ b/arch/arm/arm64/include/uk/asm/lcpu.h
>> @@ -146,4 +146,9 @@ static inline unsigned long ukarch_read_sp(void)
>> Â Â Â Â Â  return sp;
>> Â  }
>> +static inline void ukarch_spinwait(void)
>> +{
>> +Â Â Â  /* Intelligent busy wait not supported on arm64. */
> 
> Likewise here.
> 
>> +}
>> +
>> Â  #endif /* __ASSEMBLY__ */
>>
> 
> Cheers,
> 


From minios-devel-bounces@lists.xenproject.org Thu Aug 20 15:46:00 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Thu, 20 Aug 2020 15:46:00 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1k8mlI-0008Io-H7; Thu, 20 Aug 2020 15:45:56 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=DN23=B6=neclab.eu=simon.kuenzer@srs-us1.protection.inumbo.net>)
 id 1k8mlH-0008Ij-He
 for minios-devel@lists.xen.org; Thu, 20 Aug 2020 15:45:55 +0000
X-Inumbo-ID: 1522d42d-8731-4899-8f1a-91bcff98e73d
Received: from mailer1.neclab.eu (unknown [195.37.70.40])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 1522d42d-8731-4899-8f1a-91bcff98e73d;
 Thu, 20 Aug 2020 15:45:53 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
 by mailer1.neclab.eu (Postfix) with ESMTP id 6F71D10414E;
 Thu, 20 Aug 2020 17:45:52 +0200 (CEST)
X-Virus-Scanned: Amavisd on Debian GNU/Linux (atlas-a.office.hd)
Received: from mailer1.neclab.eu ([127.0.0.1])
 by localhost (atlas-a.office.hd [127.0.0.1]) (amavisd-new, port 10024)
 with ESMTP id lLsbOf06i5yw; Thu, 20 Aug 2020 17:45:52 +0200 (CEST)
X-ENC: Last-Hop-TLS-encrypted
X-ENC: Last-Hop-TLS-encrypted
Received: from puck.office.hd (puck.office.hd [192.168.24.91])
 (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
 (No client certificate requested)
 by mailer1.neclab.eu (Postfix) with ESMTPS id 4A24210397A;
 Thu, 20 Aug 2020 17:45:52 +0200 (CEST)
Received: from [10.7.1.42] (192.168.24.96) by puck.office.hd (192.168.24.91)
 with Microsoft SMTP Server (version=TLS1_2,
 cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1979.3; Thu, 20 Aug
 2020 17:45:51 +0200
Subject: Re: [UNIKRAFT PATCH v4 00/12] Introduce Xen Netfront driver
To: Costin Lupu <costin.lupu@cs.pub.ro>, <minios-devel@lists.xen.org>
CC: <sharan.santhanam@neclab.eu>
References: <20200813085342.29799-1-costin.lupu@cs.pub.ro>
From: Simon Kuenzer <simon.kuenzer@neclab.eu>
Message-ID: <8facc270-694e-ac4b-2d28-3f9a0c81208f@neclab.eu>
Date: Thu, 20 Aug 2020 17:45:50 +0200
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:68.0)
 Gecko/20100101 Thunderbird/68.11.0
MIME-Version: 1.0
In-Reply-To: <20200813085342.29799-1-costin.lupu@cs.pub.ro>
Content-Type: text/plain; charset="utf-8"; format=flowed
Content-Language: en-US
Content-Transfer-Encoding: 7bit
X-Originating-IP: [192.168.24.96]
X-ClientProxiedBy: puck.office.hd (192.168.24.91) To puck.office.hd
 (192.168.24.91)
X-BeenThere: minios-devel@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Mini-os development list <minios-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:minios-devel@lists.xenproject.org>
List-Help: <mailto:minios-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: minios-devel-bounces@lists.xenproject.org
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>

Hi Costin,

really, thanks a lot for picking up this patch series and driving it for 
upstreaming! This is great news. Lets make 2020 a lucky year for 
netfront ;-). I add a few comments inline to some patches that I briefly 
checked (I did a non-detailed review).

Please also consider the outstanding update to the Ethernet macro 
definitons in lib/uknetdev: https://patchwork.unikraft.org/patch/738013/ 
. Since Intel DPDK and in general NFV is one of our targets, we should 
support VLAN tags. This has an effect to the maximum transmission unit 
(1522 B). Do you know if your netfront driver can handle such frame 
sizes (more or less) out-of-the box? As far as I understood, we have 
some restrictions with our virtio driver currently and need to re-visit 
this.

Thanks,

Simon

On 13.08.20 10:53, Costin Lupu wrote:
> The current changes are required for supporting netfront devices. They should
> be used together with the lwip patch series because they depend on each other.
> 
> These changes follow the same approach used for the design and implementation
> of the virtio-net driver.
> 
> The first version of these patches was sent in 2018. Maybe the current year is
> a lucky one and we will achieve the performance to upstream these changes.
> 
> Changes since v1:
> - Split into multiple patches
> - Use the new uknetdev API
> 
> Changes since v2:
> - Add more info to commit messages
> 
> Changes since v3:
> - Use nb_align field for queue infos
> - Add patch for enabling default drivers
> 
> Costin Lupu (12):
>    plat/drivers/virtio: Fill MTU and queues alignments when retrieving
>      information
>    plat/xen: Add vif device type
>    plat/xen/drivers: Add skeleton for netfront driver
>    plat/xen/drivers/net: Configure netfront device
>    plat/xen/drivers/net: Create netfront queues
>    plat/xen/drivers/net: Configure netfront tx queue
>    plat/xen/drivers/net: Configure netfront rx queue
>    plat/xen/drivers/net: Enable/disable interrupts for rx queues
>    plat/xen/drivers/net: Start netfront device
>    plat/xen/drivers/net: Add transmit operation
>    plat/xen/drivers/net: Add receive operation
>    lib/uknetdev: Enable default drivers
> 
>   lib/uknetdev/Config.uk             |   2 +
>   plat/drivers/virtio/virtio_net.c   |   3 +
>   plat/xen/Config.uk                 |   7 +
>   plat/xen/Makefile.uk               |  11 +
>   plat/xen/drivers/net/exportsyms.uk |   1 +
>   plat/xen/drivers/net/netfront.c    | 843 +++++++++++++++++++++++++++++
>   plat/xen/drivers/net/netfront.h    | 145 +++++
>   plat/xen/drivers/net/netfront_xb.h |  46 ++
>   plat/xen/drivers/net/netfront_xs.c | 522 ++++++++++++++++++
>   plat/xen/include/xenbus/xenbus.h   |   1 +
>   plat/xen/xenbus/client.c           |   1 +
>   11 files changed, 1582 insertions(+)
>   create mode 100644 plat/xen/drivers/net/exportsyms.uk
>   create mode 100644 plat/xen/drivers/net/netfront.c
>   create mode 100644 plat/xen/drivers/net/netfront.h
>   create mode 100644 plat/xen/drivers/net/netfront_xb.h
>   create mode 100644 plat/xen/drivers/net/netfront_xs.c
> 


From minios-devel-bounces@lists.xenproject.org Thu Aug 20 15:46:08 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Thu, 20 Aug 2020 15:46:08 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1k8mlT-0008JR-Ix; Thu, 20 Aug 2020 15:46:07 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=DN23=B6=neclab.eu=simon.kuenzer@srs-us1.protection.inumbo.net>)
 id 1k8mlS-0008JH-FD
 for minios-devel@lists.xen.org; Thu, 20 Aug 2020 15:46:06 +0000
X-Inumbo-ID: e04603bb-4945-44a8-90f8-6c06b1ee939d
Received: from mailer2.neclab.eu (unknown [195.37.70.41])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id e04603bb-4945-44a8-90f8-6c06b1ee939d;
 Thu, 20 Aug 2020 15:46:03 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
 by mailer2.neclab.eu (Postfix) with ESMTP id E5085F2014;
 Thu, 20 Aug 2020 17:46:02 +0200 (CEST)
X-Virus-Scanned: Amavisd on Debian GNU/Linux (atlas-b.office.hd)
Received: from mailer2.neclab.eu ([127.0.0.1])
 by localhost (atlas-b.office.hd [127.0.0.1]) (amavisd-new, port 10024)
 with ESMTP id wo8PDWbu4Zx9; Thu, 20 Aug 2020 17:46:02 +0200 (CEST)
X-ENC: Last-Hop-TLS-encrypted
X-ENC: Last-Hop-TLS-encrypted
Received: from puck.office.hd (puck.office.hd [192.168.24.91])
 (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
 (No client certificate requested)
 by mailer2.neclab.eu (Postfix) with ESMTPS id B710AF2013;
 Thu, 20 Aug 2020 17:45:56 +0200 (CEST)
Received: from [10.7.1.42] (192.168.24.96) by puck.office.hd (192.168.24.91)
 with Microsoft SMTP Server (version=TLS1_2,
 cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1979.3; Thu, 20 Aug
 2020 17:45:55 +0200
Subject: Re: [UNIKRAFT PATCH v4 03/12] plat/xen/drivers: Add skeleton for
 netfront driver
To: Costin Lupu <costin.lupu@cs.pub.ro>, <minios-devel@lists.xen.org>
CC: <sharan.santhanam@neclab.eu>, Razvan Cojocaru <razvan.cojocaru93@gmail.com>
References: <20200813085342.29799-1-costin.lupu@cs.pub.ro>
 <20200813085342.29799-4-costin.lupu@cs.pub.ro>
From: Simon Kuenzer <simon.kuenzer@neclab.eu>
Message-ID: <ab699543-2fd9-bb04-51eb-43be58e24036@neclab.eu>
Date: Thu, 20 Aug 2020 17:45:55 +0200
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:68.0)
 Gecko/20100101 Thunderbird/68.11.0
MIME-Version: 1.0
In-Reply-To: <20200813085342.29799-4-costin.lupu@cs.pub.ro>
Content-Type: text/plain; charset="utf-8"; format=flowed
Content-Language: en-US
Content-Transfer-Encoding: 7bit
X-Originating-IP: [192.168.24.96]
X-ClientProxiedBy: oberon.office.hd (192.168.24.90) To puck.office.hd
 (192.168.24.91)
X-BeenThere: minios-devel@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Mini-os development list <minios-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:minios-devel@lists.xenproject.org>
List-Help: <mailto:minios-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: minios-devel-bounces@lists.xenproject.org
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>

On 13.08.20 10:53, Costin Lupu wrote:
> This patch introduces the skeleton for the Xen netfront driver.
> 
> Signed-off-by: Costin Lupu <costin.lupu@cs.pub.ro>
> Signed-off-by: Razvan Cojocaru <razvan.cojocaru93@gmail.com>
> ---
>   plat/xen/Config.uk                 |  7 +++
>   plat/xen/Makefile.uk               | 10 ++++
>   plat/xen/drivers/net/exportsyms.uk |  1 +
>   plat/xen/drivers/net/netfront.c    | 73 ++++++++++++++++++++++++++++++
>   4 files changed, 91 insertions(+)
>   create mode 100644 plat/xen/drivers/net/exportsyms.uk
>   create mode 100644 plat/xen/drivers/net/netfront.c
> 
> diff --git a/plat/xen/Config.uk b/plat/xen/Config.uk
> index 364c9528..511bfa89 100644
> --- a/plat/xen/Config.uk
> +++ b/plat/xen/Config.uk
> @@ -90,6 +90,13 @@ config XEN_XENBUS
>   menu "Xenbus Drivers"
>   	depends on XEN_XENBUS
>   
> +config XEN_NETFRONT
> +	bool "Xenbus Netfront Driver"
> +	default n

Instead of having patch 12 in this series we should add another default 
line here to achieve the same configuration experience:

	default y if LIBUKNETDEV

We did the same with virtio-net (kvm's Config.uk):

...
config VIRTIO_NET
        bool "Virtio Net device"
        default y if LIBUKNETDEV
        default n
        depends on LIBUKNETDEV
        imply VIRTIO_PCI if ARCH_X86_64
        select VIRTIO_BUS
        select LIBUKSGLIST
        help
               Virtual network driver.
...

> +	depends on LIBUKNETDEV
> +	help
> +		Driver for netfront devices
> +
>   menuconfig XEN_BLKFRONT
>   	bool "Xenbus Blkfront Driver"
>   	default n
> diff --git a/plat/xen/Makefile.uk b/plat/xen/Makefile.uk
> index 2a8cdbf6..339b1b21 100644
> --- a/plat/xen/Makefile.uk
> +++ b/plat/xen/Makefile.uk
> @@ -10,6 +10,7 @@ $(eval $(call addplat_s,xen,$(CONFIG_PLAT_XEN)))
>   ##
>   $(eval $(call addplatlib,xen,libxenplat))
>   $(eval $(call addplatlib_s,xen,libxenbus,$(CONFIG_XEN_XENBUS)))
> +$(eval $(call addplatlib_s,xen,libxennetfront,$(CONFIG_XEN_NETFRONT)))
>   $(eval $(call addplatlib_s,xen,libxenblkfront,$(CONFIG_XEN_BLKFRONT)))
>   $(eval $(call addplatlib_s,xen,libxen9pfront,$(CONFIG_XEN_9PFRONT)))
>   
> @@ -113,6 +114,15 @@ LIBXENBUS_SRCS-y               += $(LIBXENPLAT_BASE)/xenbus/xs_watch.c
>   LIBXENBUS_SRCS-y               += $(LIBXENPLAT_BASE)/xenbus/xs.c
>   endif
>   
> +ifeq ($(CONFIG_XEN_NETFRONT),y)
> +LIBXENNETFRONT_EXPORTS          = $(LIBXENPLAT_BASE)/drivers/net/exportsyms.uk
> +LIBXENNETFRONT_ASFLAGS-y       += $(LIBXENPLAT_ASFLAGS-y)
> +LIBXENNETFRONT_ASINCLUDES-y    += $(LIBXENPLAT_ASINCLUDES-y)
> +LIBXENNETFRONT_CFLAGS-y        += $(LIBXENPLAT_CFLAGS-y)
> +LIBXENNETFRONT_CINCLUDES-y     += $(LIBXENPLAT_CINCLUDES-y)
> +LIBXENNETFRONT_SRCS-y          += $(LIBXENPLAT_BASE)/drivers/net/netfront.c
> +endif
> +
>   ifeq ($(CONFIG_XEN_BLKFRONT),y)
>   LIBXENBLKFRONT_EXPORTS           = $(LIBXENPLAT_BASE)/drivers/blk/exportsyms.uk
>   LIBXENBLKFRONT_ASFLAGS-y        += $(LIBXENPLAT_ASFLAGS-y)
> diff --git a/plat/xen/drivers/net/exportsyms.uk b/plat/xen/drivers/net/exportsyms.uk
> new file mode 100644
> index 00000000..c86c3f35
> --- /dev/null
> +++ b/plat/xen/drivers/net/exportsyms.uk
> @@ -0,0 +1 @@
> +none
> \ No newline at end of file
> diff --git a/plat/xen/drivers/net/netfront.c b/plat/xen/drivers/net/netfront.c
> new file mode 100644
> index 00000000..b455911e
> --- /dev/null
> +++ b/plat/xen/drivers/net/netfront.c
> @@ -0,0 +1,73 @@
> +/* SPDX-License-Identifier: BSD-3-Clause */
> +/*
> + * Authors: Costin Lupu <costin.lupu@cs.pub.ro>
> + *          Razvan Cojocaru <razvan.cojocaru93@gmail.com>
> + *
> + * Copyright (c) 2020, University Politehnica of Bucharest. All rights reserved.
> + *
> + * Redistribution and use in source and binary forms, with or without
> + * modification, are permitted provided that the following conditions
> + * are met:
> + *
> + * 1. Redistributions of source code must retain the above copyright
> + *    notice, this list of conditions and the following disclaimer.
> + * 2. Redistributions in binary form must reproduce the above copyright
> + *    notice, this list of conditions and the following disclaimer in the
> + *    documentation and/or other materials provided with the distribution.
> + * 3. Neither the name of the copyright holder nor the names of its
> + *    contributors may be used to endorse or promote products derived from
> + *    this software without specific prior written permission.
> + *
> + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
> + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
> + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
> + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
> + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
> + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
> + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
> + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
> + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
> + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
> + * POSSIBILITY OF SUCH DAMAGE.
> + *
> + * THIS HEADER MAY NOT BE EXTRACTED OR MODIFIED IN ANY WAY.
> + */
> +
> +#include <xenbus/xenbus.h>
> +
> +
> +#define DRIVER_NAME  "xen-netfront"
> +
> +static struct uk_alloc *drv_allocator;
> +
> +
> +static int netfront_add_dev(struct xenbus_device *xendev)
> +{
> +	int rc = 0;
> +
> +	UK_ASSERT(xendev != NULL);
> +
> +	return rc;
> +}
> +
> +static int netfront_drv_init(struct uk_alloc *allocator)
> +{
> +	/* driver initialization */
> +	if (!allocator)
> +		return -EINVAL;
> +
> +	drv_allocator = allocator;
> +	return 0;
> +}
> +
> +static const xenbus_dev_type_t netfront_devtypes[] = {
> +	xenbus_dev_vif,
> +	xenbus_dev_none
> +};
> +
> +static struct xenbus_driver netfront_driver = {
> +	.device_types = netfront_devtypes,
> +	.init         = netfront_drv_init,
> +	.add_dev      = netfront_add_dev
> +};
> +XENBUS_REGISTER_DRIVER(&netfront_driver);
> 


From minios-devel-bounces@lists.xenproject.org Thu Aug 20 15:47:39 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Thu, 20 Aug 2020 15:47:39 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1k8mmw-0008Ns-O1; Thu, 20 Aug 2020 15:47:38 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=DN23=B6=neclab.eu=simon.kuenzer@srs-us1.protection.inumbo.net>)
 id 1k8mmv-0008Nm-K7
 for minios-devel@lists.xen.org; Thu, 20 Aug 2020 15:47:37 +0000
X-Inumbo-ID: d3198c65-bea0-4e19-8558-cdfc0570af90
Received: from mailer1.neclab.eu (unknown [195.37.70.40])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id d3198c65-bea0-4e19-8558-cdfc0570af90;
 Thu, 20 Aug 2020 15:47:35 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
 by mailer1.neclab.eu (Postfix) with ESMTP id 5542910414E;
 Thu, 20 Aug 2020 17:47:34 +0200 (CEST)
X-Virus-Scanned: Amavisd on Debian GNU/Linux (atlas-a.office.hd)
Received: from mailer1.neclab.eu ([127.0.0.1])
 by localhost (atlas-a.office.hd [127.0.0.1]) (amavisd-new, port 10024)
 with ESMTP id irU9oaSqg48G; Thu, 20 Aug 2020 17:47:34 +0200 (CEST)
X-ENC: Last-Hop-TLS-encrypted
X-ENC: Last-Hop-TLS-encrypted
Received: from puck.office.hd (puck.office.hd [192.168.24.91])
 (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
 (No client certificate requested)
 by mailer1.neclab.eu (Postfix) with ESMTPS id 30F6C10397A;
 Thu, 20 Aug 2020 17:47:34 +0200 (CEST)
Received: from [10.7.1.42] (192.168.24.96) by puck.office.hd (192.168.24.91)
 with Microsoft SMTP Server (version=TLS1_2,
 cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1979.3; Thu, 20 Aug
 2020 17:47:33 +0200
Subject: Re: [UNIKRAFT PATCH v4 01/12] plat/drivers/virtio: Fill MTU and
 queues alignments when retrieving information
To: Costin Lupu <costin.lupu@cs.pub.ro>, <minios-devel@lists.xen.org>
CC: <sharan.santhanam@neclab.eu>
References: <20200813085342.29799-1-costin.lupu@cs.pub.ro>
 <20200813085342.29799-2-costin.lupu@cs.pub.ro>
From: Simon Kuenzer <simon.kuenzer@neclab.eu>
Message-ID: <c246a0fb-3c90-48ce-9bd2-333034f9ebb3@neclab.eu>
Date: Thu, 20 Aug 2020 17:47:32 +0200
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:68.0)
 Gecko/20100101 Thunderbird/68.11.0
MIME-Version: 1.0
In-Reply-To: <20200813085342.29799-2-costin.lupu@cs.pub.ro>
Content-Type: text/plain; charset="utf-8"; format=flowed
Content-Language: en-US
Content-Transfer-Encoding: 7bit
X-Originating-IP: [192.168.24.96]
X-ClientProxiedBy: titania.office.hd (192.168.24.89) To puck.office.hd
 (192.168.24.91)
X-BeenThere: minios-devel@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Mini-os development list <minios-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:minios-devel@lists.xenproject.org>
List-Help: <mailto:minios-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: minios-devel-bounces@lists.xenproject.org
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>

Wouldn't this patch go independently to netfront? I do not see the 
relation...

On 13.08.20 10:53, Costin Lupu wrote:
> This patch sets the max MTU value when retrieving device information and the
> alignments used when allocating packets for each queue.
> 
> Signed-off-by: Costin Lupu <costin.lupu@cs.pub.ro>
> ---
>   plat/drivers/virtio/virtio_net.c | 3 +++
>   1 file changed, 3 insertions(+)
> 
> diff --git a/plat/drivers/virtio/virtio_net.c b/plat/drivers/virtio/virtio_net.c
> index b0663e60..0e748b8f 100644
> --- a/plat/drivers/virtio/virtio_net.c
> +++ b/plat/drivers/virtio/virtio_net.c
> @@ -770,6 +770,7 @@ static int virtio_netdev_rxq_info_get(struct uk_netdev *dev,
>   	rxq = &vndev->rxqs[queue_id];
>   	qinfo->nb_min = 1;
>   	qinfo->nb_max = rxq->max_nb_desc;
> +	qinfo->nb_align = sizeof(void *); /* word size alignment */

@Costin, @Sharan: Does changing the alignment something good or bad to 
the virtio performance? I guess it does not harm. 0 meant that there is 
no alignment requirement for network packet buffers.

>   	qinfo->nb_is_power_of_two = 1;
>   
>   exit:
> @@ -797,6 +798,7 @@ static int virtio_netdev_txq_info_get(struct uk_netdev *dev,
>   	txq = &vndev->txqs[queue_id];
>   	qinfo->nb_min = 1;
>   	qinfo->nb_max = txq->max_nb_desc;
> +	qinfo->nb_align = sizeof(void *); /* word size alignment */

@Costin, @Sharan: ...same here.

>   	qinfo->nb_is_power_of_two = 1;
>   
>   exit:
> @@ -1048,6 +1050,7 @@ static void virtio_net_info_get(struct uk_netdev *dev,
>   
>   	dev_info->max_rx_queues = vndev->max_vqueue_pairs;
>   	dev_info->max_tx_queues = vndev->max_vqueue_pairs;
> +	dev_info->max_mtu = vndev->max_mtu;

I agree, this should be announced.

>   	dev_info->nb_encap_tx = sizeof(struct virtio_net_hdr_padded);
>   	dev_info->nb_encap_rx = sizeof(struct virtio_net_hdr_padded);
>   	dev_info->features = UK_FEATURE_RXQ_INTR_AVAILABLE;
> 


From minios-devel-bounces@lists.xenproject.org Thu Aug 20 15:50:03 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Thu, 20 Aug 2020 15:50:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1k8mpG-0000Ad-Vi; Thu, 20 Aug 2020 15:50:02 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=DN23=B6=neclab.eu=simon.kuenzer@srs-us1.protection.inumbo.net>)
 id 1k8mpF-0008Qv-9A
 for minios-devel@lists.xen.org; Thu, 20 Aug 2020 15:50:01 +0000
X-Inumbo-ID: 54d8195a-dffd-43b1-aafd-b27dda0b1516
Received: from mailer2.neclab.eu (unknown [195.37.70.41])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 54d8195a-dffd-43b1-aafd-b27dda0b1516;
 Thu, 20 Aug 2020 15:49:59 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
 by mailer2.neclab.eu (Postfix) with ESMTP id 077F6F2014;
 Thu, 20 Aug 2020 17:49:59 +0200 (CEST)
X-Virus-Scanned: Amavisd on Debian GNU/Linux (atlas-b.office.hd)
Received: from mailer2.neclab.eu ([127.0.0.1])
 by localhost (atlas-b.office.hd [127.0.0.1]) (amavisd-new, port 10024)
 with ESMTP id rixilWiwYi7R; Thu, 20 Aug 2020 17:49:58 +0200 (CEST)
X-ENC: Last-Hop-TLS-encrypted
X-ENC: Last-Hop-TLS-encrypted
Received: from puck.office.hd (puck.office.hd [192.168.24.91])
 (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
 (No client certificate requested)
 by mailer2.neclab.eu (Postfix) with ESMTPS id CEC37F2013;
 Thu, 20 Aug 2020 17:49:52 +0200 (CEST)
Received: from [10.7.1.42] (192.168.24.96) by puck.office.hd (192.168.24.91)
 with Microsoft SMTP Server (version=TLS1_2,
 cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1979.3; Thu, 20 Aug
 2020 17:49:51 +0200
Subject: Re: [UNIKRAFT PATCH v4 10/12] plat/xen/drivers/net: Add transmit
 operation
To: Costin Lupu <costin.lupu@cs.pub.ro>, <minios-devel@lists.xen.org>
CC: <sharan.santhanam@neclab.eu>, Razvan Cojocaru <razvan.cojocaru93@gmail.com>
References: <20200813085342.29799-1-costin.lupu@cs.pub.ro>
 <20200813085342.29799-11-costin.lupu@cs.pub.ro>
From: Simon Kuenzer <simon.kuenzer@neclab.eu>
Message-ID: <494d8796-a3e0-a3d5-df36-6343df10d571@neclab.eu>
Date: Thu, 20 Aug 2020 17:49:51 +0200
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:68.0)
 Gecko/20100101 Thunderbird/68.11.0
MIME-Version: 1.0
In-Reply-To: <20200813085342.29799-11-costin.lupu@cs.pub.ro>
Content-Type: text/plain; charset="utf-8"; format=flowed
Content-Language: en-US
Content-Transfer-Encoding: 7bit
X-Originating-IP: [192.168.24.96]
X-ClientProxiedBy: puck.office.hd (192.168.24.91) To puck.office.hd
 (192.168.24.91)
X-BeenThere: minios-devel@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Mini-os development list <minios-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:minios-devel@lists.xenproject.org>
List-Help: <mailto:minios-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: minios-devel-bounces@lists.xenproject.org
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>

On 13.08.20 10:53, Costin Lupu wrote:
> Whenever a packet is transmitted, the request describing it is written in the
> shared ring. The packet itself is written in a page referenced by the request
> and shared, as well, with the backend. At the end of each transmit operation, a
> cleanup operation is performed free'ing the resources allocated for the
> previously transmitted packets.
> 
> Signed-off-by: Costin Lupu <costin.lupu@cs.pub.ro>
> Signed-off-by: Razvan Cojocaru <razvan.cojocaru93@gmail.com>
> ---
>   plat/xen/drivers/net/netfront.c | 102 ++++++++++++++++++++++++++++++++
>   1 file changed, 102 insertions(+)
> 
> diff --git a/plat/xen/drivers/net/netfront.c b/plat/xen/drivers/net/netfront.c
> index 858d124a..f2b81329 100644
> --- a/plat/xen/drivers/net/netfront.c
> +++ b/plat/xen/drivers/net/netfront.c
> @@ -39,6 +39,7 @@
>   #include <uk/alloc.h>
>   #include <uk/netdev_driver.h>
>   #include <xen-x86/mm.h>
> +#include <xen-x86/irq.h>
>   #include <xenbus/xenbus.h>
>   #include "netfront.h"
>   #include "netfront_xb.h"
> @@ -78,6 +79,106 @@ static uint16_t get_id_from_freelist(uint16_t *freelist)
>   	return id;
>   }
>   
> +static int network_tx_buf_gc(struct uk_netdev_tx_queue *txq)
> +{
> +	RING_IDX prod, cons;
> +	netif_tx_response_t *tx_rsp;
> +	uint16_t id;
> +	bool more_to_do;
> +	int count = 0;
> +
> +	do {
> +		prod = txq->ring.sring->rsp_prod;
> +		rmb(); /* Ensure we see responses up to 'rp'. */
> +
> +		for (cons = txq->ring.rsp_cons; cons != prod; cons++) {
> +			tx_rsp = RING_GET_RESPONSE(&txq->ring, cons);
> +
> +			if (tx_rsp->status == NETIF_RSP_NULL)
> +				continue;
> +
> +			if (tx_rsp->status == NETIF_RSP_ERROR)
> +				uk_pr_err("packet error\n");

"netdev%u: Transmission error on txq %u\n" ?

> +
> +			id  = tx_rsp->id;
> +			UK_ASSERT(id < NET_TX_RING_SIZE);
> +
> +			gnttab_end_access(txq->gref[id]);
> +			txq->gref[id] = GRANT_INVALID_REF;
> +
> +			add_id_to_freelist(id, txq->freelist);
> +			uk_semaphore_up(&txq->sem);
> +
> +			count++;
> +		}
> +
> +		txq->ring.rsp_cons = prod;
> +
> +		RING_FINAL_CHECK_FOR_RESPONSES(&txq->ring, more_to_do);
> +	} while (more_to_do);
> +
> +	return count;
> +}
> +
> +static int netfront_xmit(struct uk_netdev *n,
> +		struct uk_netdev_tx_queue *txq,
> +		struct uk_netbuf *pkt)
> +{
> +	struct netfront_dev *nfdev;
> +	unsigned long flags;
> +	uint16_t id;
> +	RING_IDX req_prod;
> +	netif_tx_request_t *tx_req;
> +	int notify;
> +	int status = 0, count;
> +
> +	UK_ASSERT(n != NULL);
> +	UK_ASSERT(txq != NULL);
> +	UK_ASSERT(pkt != NULL);
> +	UK_ASSERT(pkt->len < PAGE_SIZE);
> +
> +	nfdev = to_netfront_dev(n);
> +
> +	/* get request id */
> +	uk_semaphore_down(&txq->sem);
> +	local_irq_save(flags);
> +	id = get_id_from_freelist(txq->freelist);

What happens when we are out of space and the ring is full?
The xmit function should be non-blocking so that we can use it in 
polling mode. We should return in such a case that the transmission 
queue is currently full...

> +	local_irq_restore(flags);
> +
> +	/* get request */
> +	req_prod = txq->ring.req_prod_pvt;
> +	tx_req = RING_GET_REQUEST(&txq->ring, req_prod); > +
> +	/* setup grant for buffer data */
> +	txq->gref[id] = tx_req->gref =
> +		gnttab_grant_access(nfdev->xendev->otherend_id,
> +			virt_to_mfn(pkt->data), 1);
> +	UK_ASSERT(tx_req->gref != GRANT_INVALID_REF);
> +
> +	tx_req->offset = 0;
> +	tx_req->size = (uint16_t) pkt->len;
> +	tx_req->flags = 0;
> +	tx_req->id = id;
> +
> +	txq->ring.req_prod_pvt = req_prod + 1;
> +	wmb(); /* Ensure backend sees requests */
> +
> +	RING_PUSH_REQUESTS_AND_CHECK_NOTIFY(&txq->ring, notify);
> +	if (notify)
> +		notify_remote_via_evtchn(txq->evtchn); > +
> +	status |= UK_NETDEV_STATUS_SUCCESS;
> +
> +	/* some cleanup */
> +	local_irq_save(flags);
> +	count = network_tx_buf_gc(txq);

The clean-up should happen before enqueuing the given packet to the 
transmit queue, it is the first thing of xmit(). Since we anyway need to 
do it and we do not have an advantage by delaying this operation. We can 
also deal much better with full rings. Otherwise we unnecessarily drop a 
packets for transmission although there would have been space when 
clean-up finished.
After calling cleaning you can check if there is space on the ring and 
return if we run out of it (use an `unlikely` to the condition so that 
we speed up the successful sending case).

> +	local_irq_restore(flags);
> +
> +	status |= likely(count > 0) ? UK_NETDEV_STATUS_MORE : 0x0;
> +
> +	return status;
> +}
> +
>   static int netfront_rxq_enqueue(struct uk_netdev_rx_queue *rxq,
>   		struct uk_netbuf *netbuf)
>   {
> @@ -598,6 +699,7 @@ static int netfront_add_dev(struct xenbus_device *xendev)
>   	}
>   
>   	/* register netdev */
> +	nfdev->netdev.tx_one = netfront_xmit;
>   	nfdev->netdev.ops = &netfront_ops;
>   	rc = uk_netdev_drv_register(&nfdev->netdev, drv_allocator, DRIVER_NAME);
>   	if (rc < 0) {
> 


From minios-devel-bounces@lists.xenproject.org Thu Aug 20 16:01:46 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Thu, 20 Aug 2020 16:01:46 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1k8n0a-00023m-Rx; Thu, 20 Aug 2020 16:01:44 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=DN23=B6=neclab.eu=simon.kuenzer@srs-us1.protection.inumbo.net>)
 id 1k8n0Z-00023E-17
 for minios-devel@lists.xen.org; Thu, 20 Aug 2020 16:01:43 +0000
X-Inumbo-ID: e009ee90-77a0-4f23-a287-f313108f79b1
Received: from mailer2.neclab.eu (unknown [195.37.70.41])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id e009ee90-77a0-4f23-a287-f313108f79b1;
 Thu, 20 Aug 2020 16:01:41 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
 by mailer2.neclab.eu (Postfix) with ESMTP id AD059F2014;
 Thu, 20 Aug 2020 18:01:40 +0200 (CEST)
X-Virus-Scanned: Amavisd on Debian GNU/Linux (atlas-b.office.hd)
Received: from mailer2.neclab.eu ([127.0.0.1])
 by localhost (atlas-b.office.hd [127.0.0.1]) (amavisd-new, port 10024)
 with ESMTP id IjgENhSU6BWq; Thu, 20 Aug 2020 18:01:40 +0200 (CEST)
X-ENC: Last-Hop-TLS-encrypted
X-ENC: Last-Hop-TLS-encrypted
Received: from puck.office.hd (puck.office.hd [192.168.24.91])
 (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
 (No client certificate requested)
 by mailer2.neclab.eu (Postfix) with ESMTPS id 83C86F2013;
 Thu, 20 Aug 2020 18:01:36 +0200 (CEST)
Received: from [10.7.1.42] (192.168.24.96) by puck.office.hd (192.168.24.91)
 with Microsoft SMTP Server (version=TLS1_2,
 cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1979.3; Thu, 20 Aug
 2020 18:01:35 +0200
Subject: Re: [[UNIKRAFT/LIBS PATCH]] Removed exportsyms.uk from Makefile.uk
To: Cristian Vijelie <cristianvijelie@gmail.com>, <minios-devel@lists.xen.org>
References: <20200818133201.8737-1-cristianvijelie@gmail.com>
From: Simon Kuenzer <simon.kuenzer@neclab.eu>
Message-ID: <cfceee56-9e17-9b94-44ea-6241ed81da74@neclab.eu>
Date: Thu, 20 Aug 2020 18:01:34 +0200
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:68.0)
 Gecko/20100101 Thunderbird/68.11.0
MIME-Version: 1.0
In-Reply-To: <20200818133201.8737-1-cristianvijelie@gmail.com>
Content-Type: text/plain; charset="utf-8"; format=flowed
Content-Language: en-US
Content-Transfer-Encoding: 7bit
X-Originating-IP: [192.168.24.96]
X-ClientProxiedBy: oberon.office.hd (192.168.24.90) To puck.office.hd
 (192.168.24.91)
X-BeenThere: minios-devel@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Mini-os development list <minios-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:minios-devel@lists.xenproject.org>
List-Help: <mailto:minios-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: minios-devel-bounces@lists.xenproject.org
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>

Hi Cristian,

thanks a lot for this patch. From your patch I can see that this goes to 
pthread embedded. In such a case the subject prefix should say 
"[UNIRKAFT/LIBPTHREAD-EMBEDDED PATH]". We have such a patch already 
accepted in the staging branch of pthread-embedded. I know, it is time 
to follow-up the master branch since this became a show-stopper when 
mixing branches across libraries ;-) . In general I recommend to use 
same branches for all libraries and the core: either `master` or `staging`.

Thanks,

Simon

On 18.08.20 15:32, Cristian Vijelie wrote:
> ---
>   Makefile.uk | 2 --
>   1 file changed, 2 deletions(-)
> 
> diff --git a/Makefile.uk b/Makefile.uk
> index b9b7456..4ee37cd 100644
> --- a/Makefile.uk
> +++ b/Makefile.uk
> @@ -59,8 +59,6 @@ LIBPTHREAD-EMBEDDED_CFLAGS-y   += $(LIBPTHREAD-EMBEDDED_SUPPRESS_FLAGS) \
>   	-Wno-pointer-to-int-cast -Wno-int-to-pointer-cast
>   LIBPTHREAD-EMBEDDED_CXXFLAGS-y += $(LIBPTHREAD-EMBEDDED_SUPPRESS_FLAGS)
>   
> -LIBPTHREAD-EMBEDDED_EXPORTS = $(LIBPTHREAD-EMBEDDED_BASE)/exportsyms.uk
> -
>   ################################################################################
>   # OS dependencies code - Glue between Unikraft and pthread-embedded
>   ################################################################################
> 


From minios-devel-bounces@lists.xenproject.org Thu Aug 20 16:13:45 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Thu, 20 Aug 2020 16:13:45 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1k8nC8-0002wQ-Oh; Thu, 20 Aug 2020 16:13:40 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=DN23=B6=neclab.eu=simon.kuenzer@srs-us1.protection.inumbo.net>)
 id 1k8nC6-0002wL-Qq
 for minios-devel@lists.xen.org; Thu, 20 Aug 2020 16:13:38 +0000
X-Inumbo-ID: f1b089d5-fd9b-4a02-9887-0b55d603f683
Received: from mailer2.neclab.eu (unknown [195.37.70.41])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id f1b089d5-fd9b-4a02-9887-0b55d603f683;
 Thu, 20 Aug 2020 16:13:36 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
 by mailer2.neclab.eu (Postfix) with ESMTP id 68006F2014;
 Thu, 20 Aug 2020 18:13:35 +0200 (CEST)
X-Virus-Scanned: Amavisd on Debian GNU/Linux (atlas-b.office.hd)
Received: from mailer2.neclab.eu ([127.0.0.1])
 by localhost (atlas-b.office.hd [127.0.0.1]) (amavisd-new, port 10024)
 with ESMTP id IHN46XBB4Cha; Thu, 20 Aug 2020 18:13:35 +0200 (CEST)
X-ENC: Last-Hop-TLS-encrypted
X-ENC: Last-Hop-TLS-encrypted
Received: from puck.office.hd (puck.office.hd [192.168.24.91])
 (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
 (No client certificate requested)
 by mailer2.neclab.eu (Postfix) with ESMTPS id 37288F2013;
 Thu, 20 Aug 2020 18:13:31 +0200 (CEST)
Received: from [10.7.1.42] (192.168.24.96) by puck.office.hd (192.168.24.91)
 with Microsoft SMTP Server (version=TLS1_2,
 cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1979.3; Thu, 20 Aug
 2020 18:13:30 +0200
Subject: Re: [[UNIKRAFT RFC PATCH] 1/2] lib/isrlib: Applied Simon's
 recommendations
To: cristian-vijelie <cristianvijelie@gmail.com>, <minios-devel@lists.xen.org>
References: <20200810174211.6249-1-cristianvijelie@gmail.com>
From: Simon Kuenzer <simon.kuenzer@neclab.eu>
Message-ID: <241322f2-078c-b897-8c7a-76b9a1462d78@neclab.eu>
Date: Thu, 20 Aug 2020 18:13:29 +0200
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:68.0)
 Gecko/20100101 Thunderbird/68.11.0
MIME-Version: 1.0
In-Reply-To: <20200810174211.6249-1-cristianvijelie@gmail.com>
Content-Type: text/plain; charset="utf-8"; format=flowed
Content-Language: en-US
Content-Transfer-Encoding: 7bit
X-Originating-IP: [192.168.24.96]
X-ClientProxiedBy: titania.office.hd (192.168.24.89) To puck.office.hd
 (192.168.24.91)
X-BeenThere: minios-devel@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Mini-os development list <minios-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:minios-devel@lists.xenproject.org>
List-Help: <mailto:minios-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: minios-devel-bounces@lists.xenproject.org
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>

Hi Christian,

you should add a version number to this patch series and you can keep 
the title of the series. As comment to the version you can say that you 
applied my recommendations ;-). Overall, this RFC version looks ways 
cleaner, thanks a lot for the update! See my comments inline.

Thanks,

Simon

On 10.08.20 19:42, cristian-vijelie wrote:
> From: Cristian Vijelie <cristianvijelie@gmail.com>
> 
> ---
>   include/uk/isr/string.h                       |  53 +++++++
>   lib/irslib/Config.uk                          |   7 +
>   lib/irslib/Makefile.uk                        |   6 +
>   .../include/isrlib-internal/shareddefs.h      | 146 ++++++++++++++++++
>   lib/irslib/string.c                           |  11 ++
>   5 files changed, 223 insertions(+)
>   create mode 100644 include/uk/isr/string.h
>   create mode 100644 lib/irslib/Config.uk
>   create mode 100644 lib/irslib/Makefile.uk
>   create mode 100644 lib/irslib/include/isrlib-internal/shareddefs.h
>   create mode 100644 lib/irslib/string.c
> 
> diff --git a/include/uk/isr/string.h b/include/uk/isr/string.h
> new file mode 100644
> index 0000000..ceb8a0a
> --- /dev/null
> +++ b/include/uk/isr/string.h
> @@ -0,0 +1,53 @@
> +/* SPDX-License-Identifier: BSD-3-Clause */
> +/*
> + * Authors: Simon Kuenzer <simon.kuenzer@neclab.eu>
> + *
> + *
> + * Copyright (c) 2017, NEC Europe Ltd., NEC Corporation. All rights reserved.
> + *
> + * Redistribution and use in source and binary forms, with or without
> + * modification, are permitted provided that the following conditions
> + * are met:
> + *
> + * 1. Redistributions of source code must retain the above copyright
> + *    notice, this list of conditions and the following disclaimer.
> + * 2. Redistributions in binary form must reproduce the above copyright
> + *    notice, this list of conditions and the following disclaimer in the
> + *    documentation and/or other materials provided with the distribution.
> + * 3. Neither the name of the copyright holder nor the names of its
> + *    contributors may be used to endorse or promote products derived from
> + *    this software without specific prior written permission.
> + *
> + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
> + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
> + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
> + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
> + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
> + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
> + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
> + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
> + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
> + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
> + * POSSIBILITY OF SUCH DAMAGE.
> + *
> + * THIS HEADER MAY NOT BE EXTRACTED OR MODIFIED IN ANY WAY.

Please remove this line from the headers. It is there by mistake. This 
needs to be fixed in general.

> + */
> +
> +#ifndef __UK_ISR_STRING_H__
> +#define __UK_ISR_STRING_H__
> +
> +#ifdef __cplusplus
> +extern "C" {
> +#endif
> +
> +#define __NEED_size_t
> +
> +#include <isrlib-internal/shareddefs.h>
Just include the standard libc headers that define you datatypes that 
you need. I think it is just `size_t` here. You won't need a 
library-internal shareddefs.h for isrlib. For this header, I would 
probably include <string.h>.

> +
> +void *memcpy_isr(void *dst, const void *src, size_t len);
> +
> +#ifdef __cplusplus
> +}
> +#endif
> +
> +#endif /* __STRING_H__ */
> diff --git a/lib/irslib/Config.uk b/lib/irslib/Config.uk
> new file mode 100644
> index 0000000..88ff441
> --- /dev/null
> +++ b/lib/irslib/Config.uk
> @@ -0,0 +1,7 @@
> +menuconfig LIBISRLIB
> +    bool "isr helper library"
> +    default n
> +
> +if LIBISRLIB
> +
> +endif
> diff --git a/lib/irslib/Makefile.uk b/lib/irslib/Makefile.uk
> new file mode 100644
> index 0000000..fe2461e
> --- /dev/null
> +++ b/lib/irslib/Makefile.uk
> @@ -0,0 +1,6 @@
> +$(eval $(call addlib_s,libisrlib,$(CONFIG_LIBISRLIB)))
> +
> +CINCLUDES-$(CONFIG_LIBISRLIB)   += -I$(LIBISRLIB_BASE)/include
> +CXXINCLUDES-$(CONFIG_LIBISRLIB)   += -I$(LIBISRLIB_BASE)/include
> +
> +LIBISRLIB_SRCS-y += $(LIBISRLIB_BASE)/string.c|isr
> diff --git a/lib/irslib/include/isrlib-internal/shareddefs.h b/lib/irslib/include/isrlib-internal/shareddefs.h
> new file mode 100644
> index 0000000..d386820
> --- /dev/null
> +++ b/lib/irslib/include/isrlib-internal/shareddefs.h
> @@ -0,0 +1,146 @@
> +/* SPDX-License-Identifier: BSD-3-Clause */
> +/*
> + * Authors: Florian Schmidt <florian.schmidt@neclab.eu>
> + *
> + * Copyright (c) 2018, NEC Labs Europe, NEC Corporation. All rights reserved.
> + *
> + * Redistribution and use in source and binary forms, with or without
> + * modification, are permitted provided that the following conditions
> + * are met:
> + *
> + * 1. Redistributions of source code must retain the above copyright
> + *    notice, this list of conditions and the following disclaimer.
> + * 2. Redistributions in binary form must reproduce the above copyright
> + *    notice, this list of conditions and the following disclaimer in the
> + *    documentation and/or other materials provided with the distribution.
> + * 3. Neither the name of the copyright holder nor the names of its
> + *    contributors may be used to endorse or promote products derived from
> + *    this software without specific prior written permission.
> + *
> + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
> + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
> + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
> + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
> + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
> + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
> + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
> + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
> + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
> + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
> + * POSSIBILITY OF SUCH DAMAGE.
> + *
> + * THIS HEADER MAY NOT BE EXTRACTED OR MODIFIED IN ANY WAY.
> + */
> +
> +/* This header does by design not have include guards, so that it can be
> + * included from multiple files. The __NEED_x macros instead make sure that
> + * only those definitions are included that are required by that specific
> + * file, and only if they haven't been defined on a previous pass through
> + * this file.
> + */
> +
> +#include <uk/config.h>
> +#include <uk/arch/types.h>
> +
> +#if (defined __NEED_NULL && !defined __DEFINED_NULL)
> +#ifdef __cplusplus
> +#define NULL 0L
> +#else
> +#define NULL ((void *) 0)
> +#endif
> +#define __DEFINED__NULL
> +#endif
> +
> +#if (defined __NEED_size_t && !defined __DEFINED_size_t)
> +typedef __sz size_t;
> +#define __DEFINED_size_t
> +#endif
> +
> +#if (defined __NEED_ssize_t && !defined __DEFINED_ssize_t)
> +typedef __ssz ssize_t;
> +#define __DEFINED_ssize_t
> +#endif
> +
> +#if (defined __NEED_off_t && !defined __DEFINED_off_t)
> +typedef __off off_t;
> +#define __DEFINED_off_t
> +#endif
> +
> +#if CONFIG_HAVE_TIME
> +#include <uk/time_types.h>
> +#endif
> +
> +#if (defined __NEED_mode_t && !defined __DEFINED_mode_t)
> +typedef unsigned mode_t;
> +#define __DEFINED_mode_t
> +#endif
> +
> +#if defined(__NEED_uid_t) && !defined(__DEFINED_uid_t)
> +typedef unsigned uid_t;
> +#define __DEFINED_uid_t
> +#endif
> +
> +#if defined(__NEED_gid_t) && !defined(__DEFINED_gid_t)
> +typedef unsigned gid_t;
> +#define __DEFINED_gid_t
> +#endif
> +
> +#if defined(__NEED_useconds_t) && !defined(__DEFINED_useconds_t)
> +typedef unsigned useconds_t;
> +#define __DEFINED_useconds_t
> +#endif
> +
> +#if defined(__NEED_pid_t) && !defined(__DEFINED_pid_t)
> +typedef int pid_t;
> +#define __DEFINED_pid_t
> +#endif
> +
> +#if defined(__NEED_id_t) && !defined(__DEFINED_id_t)
> +typedef unsigned id_t;
> +#define __DEFINED_id_t
> +#endif
> +
> +#if defined(__NEED_dev_t) && !defined(__DEFINED_dev_t)
> +typedef __u64 dev_t;
> +#define __DEFINED_dev_t
> +#endif
> +
> +#if defined(__NEED_ino_t) && !defined(__DEFINED_ino_t)
> +typedef __u64 ino_t;
> +#define __DEFINED_ino_t
> +#endif
> +
> +#if defined(__NEED_nlink_t) && !defined(__DEFINED_nlink_t)
> +typedef __u32 nlink_t;
> +#define __DEFINED_nlink_t
> +#endif
> +
> +#if defined(__NEED_blkcnt_t) && !defined(__DEFINED_blkcnt_t)
> +typedef __s64 blkcnt_t;
> +#define __DEFINED_blkcnt_t
> +#endif
> +
> +#if defined(__NEED_blksize_t) && !defined(__DEFINED_blksize_t)
> +typedef long blksize_t;
> +#define __DEFINED_blksize_t
> +#endif
> +
> +#if defined(__NEED_locale_t) && !defined(__DEFINED_locale_t)
> +typedef struct __locale_struct *locale_t;
> +#define __DEFINED_locale_t
> +#endif
> +
> +#if defined(__NEED_struct_iovec) && !defined(__DEFINED_struct_iovec)
> +struct iovec { void *iov_base; size_t iov_len; };
> +#define __DEFINED_struct_iovec
> +#endif
> +
> +#if defined(__NEED_fsblkcnt_t) && !defined(__DEFINED_fsblkcnt_t)
> +typedef unsigned long long fsblkcnt_t;
> +#define __DEFINED_fsblkcnt_t
> +#endif
> +
> +#if defined(__NEED_fsfilcnt_t) && !defined(__DEFINED_fsfilcnt_t)
> +typedef unsigned long long fsfilcnt_t;
> +#define __DEFINED_fsfilcnt_t
> +#endif
> diff --git a/lib/irslib/string.c b/lib/irslib/string.c
> new file mode 100644
> index 0000000..e14e187
> --- /dev/null
> +++ b/lib/irslib/string.c
> @@ -0,0 +1,11 @@
> +#include <uk/isr/string.h>
> +
> +void *memcpy_isr(void *dst, const void *src, size_t len)
> +{
> +	size_t p;
> +
> +	for (p = 0; p < len; ++p)
> +		*((__u8 *)(((__uptr)dst) + p)) = *((__u8 *)(((__uptr)src) + p));
> +
> +	return dst;
> +}
> 


From minios-devel-bounces@lists.xenproject.org Thu Aug 20 16:14:40 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Thu, 20 Aug 2020 16:14:40 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1k8nD6-0002xy-So; Thu, 20 Aug 2020 16:14:40 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=DN23=B6=neclab.eu=simon.kuenzer@srs-us1.protection.inumbo.net>)
 id 1k8nD4-0002xs-U9
 for minios-devel@lists.xen.org; Thu, 20 Aug 2020 16:14:38 +0000
X-Inumbo-ID: 48a7a18e-c6cd-4f52-a15b-2157d90a293f
Received: from mailer1.neclab.eu (unknown [195.37.70.40])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 48a7a18e-c6cd-4f52-a15b-2157d90a293f;
 Thu, 20 Aug 2020 16:14:36 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
 by mailer1.neclab.eu (Postfix) with ESMTP id 9350810414E;
 Thu, 20 Aug 2020 18:14:35 +0200 (CEST)
X-Virus-Scanned: Amavisd on Debian GNU/Linux (atlas-a.office.hd)
Received: from mailer1.neclab.eu ([127.0.0.1])
 by localhost (atlas-a.office.hd [127.0.0.1]) (amavisd-new, port 10024)
 with ESMTP id lC9rfs9jBXz4; Thu, 20 Aug 2020 18:14:35 +0200 (CEST)
X-ENC: Last-Hop-TLS-encrypted
X-ENC: Last-Hop-TLS-encrypted
Received: from puck.office.hd (puck.office.hd [192.168.24.91])
 (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
 (No client certificate requested)
 by mailer1.neclab.eu (Postfix) with ESMTPS id 6D95010397A;
 Thu, 20 Aug 2020 18:14:35 +0200 (CEST)
Received: from [10.7.1.42] (192.168.24.96) by puck.office.hd (192.168.24.91)
 with Microsoft SMTP Server (version=TLS1_2,
 cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1979.3; Thu, 20 Aug
 2020 18:14:34 +0200
Subject: Re: [[UNIKRAFT RFC PATCH] 2/2] lib/isrlib: Fixed a name typo that
 prevented build
To: cristian-vijelie <cristianvijelie@gmail.com>, <minios-devel@lists.xen.org>
References: <20200810174211.6249-1-cristianvijelie@gmail.com>
 <20200810174211.6249-2-cristianvijelie@gmail.com>
From: Simon Kuenzer <simon.kuenzer@neclab.eu>
Message-ID: <486d4af3-6b5b-7c39-4949-b6715e019e4c@neclab.eu>
Date: Thu, 20 Aug 2020 18:14:33 +0200
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:68.0)
 Gecko/20100101 Thunderbird/68.11.0
MIME-Version: 1.0
In-Reply-To: <20200810174211.6249-2-cristianvijelie@gmail.com>
Content-Type: text/plain; charset="utf-8"; format=flowed
Content-Language: en-US
Content-Transfer-Encoding: 7bit
X-Originating-IP: [192.168.24.96]
X-ClientProxiedBy: puck.office.hd (192.168.24.91) To puck.office.hd
 (192.168.24.91)
X-BeenThere: minios-devel@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Mini-os development list <minios-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:minios-devel@lists.xenproject.org>
List-Help: <mailto:minios-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: minios-devel-bounces@lists.xenproject.org
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>

Please merge this to your previous commit and send only one patch.

Thanks,

Simon

On 10.08.20 19:42, cristian-vijelie wrote:
> From: Cristian Vijelie <cristianvijelie@gmail.com>
> 
> ---
>   lib/Makefile.uk                                             | 1 +
>   lib/irslib/Makefile.uk                                      | 6 ------
>   lib/{irslib => isrlib}/Config.uk                            | 2 +-
>   lib/isrlib/Makefile.uk                                      | 6 ++++++
>   lib/{irslib => isrlib}/include/isrlib-internal/shareddefs.h | 0
>   lib/{irslib => isrlib}/string.c                             | 0
>   6 files changed, 8 insertions(+), 7 deletions(-)
>   delete mode 100644 lib/irslib/Makefile.uk
>   rename lib/{irslib => isrlib}/Config.uk (59%)
>   create mode 100644 lib/isrlib/Makefile.uk
>   rename lib/{irslib => isrlib}/include/isrlib-internal/shareddefs.h (100%)
>   rename lib/{irslib => isrlib}/string.c (100%)
> 
> diff --git a/lib/Makefile.uk b/lib/Makefile.uk
> index 07e8a29..f832a0b 100644
> --- a/lib/Makefile.uk
> +++ b/lib/Makefile.uk
> @@ -37,3 +37,4 @@ $(eval $(call _import_lib,$(CONFIG_UK_BASE)/lib/ukmmap))
>   $(eval $(call _import_lib,$(CONFIG_UK_BASE)/lib/ukblkdev))
>   $(eval $(call _import_lib,$(CONFIG_UK_BASE)/lib/posix-process))
>   $(eval $(call _import_lib,$(CONFIG_UK_BASE)/lib/uksp))
> +$(eval $(call _import_lib,$(CONFIG_UK_BASE)/lib/isrlib))
> diff --git a/lib/irslib/Makefile.uk b/lib/irslib/Makefile.uk
> deleted file mode 100644
> index fe2461e..0000000
> --- a/lib/irslib/Makefile.uk
> +++ /dev/null
> @@ -1,6 +0,0 @@
> -$(eval $(call addlib_s,libisrlib,$(CONFIG_LIBISRLIB)))
> -
> -CINCLUDES-$(CONFIG_LIBISRLIB)   += -I$(LIBISRLIB_BASE)/include
> -CXXINCLUDES-$(CONFIG_LIBISRLIB)   += -I$(LIBISRLIB_BASE)/include
> -
> -LIBISRLIB_SRCS-y += $(LIBISRLIB_BASE)/string.c|isr
> diff --git a/lib/irslib/Config.uk b/lib/isrlib/Config.uk
> similarity index 59%
> rename from lib/irslib/Config.uk
> rename to lib/isrlib/Config.uk
> index 88ff441..c6be13c 100644
> --- a/lib/irslib/Config.uk
> +++ b/lib/isrlib/Config.uk
> @@ -1,5 +1,5 @@
>   menuconfig LIBISRLIB
> -    bool "isr helper library"
> +    bool "isrlib: ISR helper library"
>       default n
>   
>   if LIBISRLIB
> diff --git a/lib/isrlib/Makefile.uk b/lib/isrlib/Makefile.uk
> new file mode 100644
> index 0000000..65baf2e
> --- /dev/null
> +++ b/lib/isrlib/Makefile.uk
> @@ -0,0 +1,6 @@
> +$(eval $(call addlib_s,libisrlib,$(CONFIG_LIBISRLIB)))
> +
> +CINCLUDES-$(CONFIG_LIBISRLIB) += -I$(LIBISRLIB_BASE)/include
> +CXXINCLUDES-$(CONFIG_LIBISRLIB) += -I$(LIBISRLIB_BASE)/include
> +
> +LIBISRLIB_SRCS-y += $(LIBISRLIB_BASE)/string.c|isr
> diff --git a/lib/irslib/include/isrlib-internal/shareddefs.h b/lib/isrlib/include/isrlib-internal/shareddefs.h
> similarity index 100%
> rename from lib/irslib/include/isrlib-internal/shareddefs.h
> rename to lib/isrlib/include/isrlib-internal/shareddefs.h
> diff --git a/lib/irslib/string.c b/lib/isrlib/string.c
> similarity index 100%
> rename from lib/irslib/string.c
> rename to lib/isrlib/string.c
> 


From minios-devel-bounces@lists.xenproject.org Thu Aug 20 21:23:16 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Thu, 20 Aug 2020 21:23:16 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1k8s1f-0004zI-Bo; Thu, 20 Aug 2020 21:23:11 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=efXq=B6=cs.pub.ro=costin.lupu@srs-us1.protection.inumbo.net>)
 id 1k8s1d-0004zD-KA
 for minios-devel@lists.xen.org; Thu, 20 Aug 2020 21:23:09 +0000
X-Inumbo-ID: e4a6da0a-9759-4c4a-8251-d3c9b1aa6d7b
Received: from mx.upb.ro (unknown [141.85.13.200])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id e4a6da0a-9759-4c4a-8251-d3c9b1aa6d7b;
 Thu, 20 Aug 2020 21:23:07 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
 by mx.upb.ro (Postfix) with ESMTP id 983FCB560097;
 Fri, 21 Aug 2020 00:23:06 +0300 (EEST)
Received: from mx.upb.ro ([127.0.0.1])
 by localhost (mx.upb.ro [127.0.0.1]) (amavisd-new, port 10032)
 with ESMTP id uty4B1ybSG97; Fri, 21 Aug 2020 00:23:04 +0300 (EEST)
Received: from localhost (localhost [127.0.0.1])
 by mx.upb.ro (Postfix) with ESMTP id 75900B561D11;
 Fri, 21 Aug 2020 00:23:04 +0300 (EEST)
X-Virus-Scanned: amavisd-new at upb.ro
Received: from mx.upb.ro ([127.0.0.1])
 by localhost (mx.upb.ro [127.0.0.1]) (amavisd-new, port 10026)
 with ESMTP id ArLKqt8_a7Hy; Fri, 21 Aug 2020 00:23:04 +0300 (EEST)
Received: from [192.168.1.35] (unknown [188.25.162.205])
 by mx.upb.ro (Postfix) with ESMTPSA id 34A35B560097;
 Fri, 21 Aug 2020 00:23:04 +0300 (EEST)
Subject: Re: [UNIKRAFT PATCH v4 00/12] Introduce Xen Netfront driver
To: Simon Kuenzer <simon.kuenzer@neclab.eu>, minios-devel@lists.xen.org
Cc: sharan.santhanam@neclab.eu
References: <20200813085342.29799-1-costin.lupu@cs.pub.ro>
 <8facc270-694e-ac4b-2d28-3f9a0c81208f@neclab.eu>
From: Costin Lupu <costin.lupu@cs.pub.ro>
Message-ID: <809e83e9-76a7-f863-559c-beb0b27701e2@cs.pub.ro>
Date: Fri, 21 Aug 2020 00:23:03 +0300
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101
 Thunderbird/68.11.0
MIME-Version: 1.0
In-Reply-To: <8facc270-694e-ac4b-2d28-3f9a0c81208f@neclab.eu>
Content-Type: text/plain; charset=utf-8
Content-Language: en-US
Content-Transfer-Encoding: 7bit
X-BeenThere: minios-devel@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Mini-os development list <minios-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:minios-devel@lists.xenproject.org>
List-Help: <mailto:minios-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: minios-devel-bounces@lists.xenproject.org
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>

On 8/20/20 6:45 PM, Simon Kuenzer wrote:
> Hi Costin,
> 
> really, thanks a lot for picking up this patch series and driving it for
> upstreaming! This is great news. Lets make 2020 a lucky year for
> netfront ;-). I add a few comments inline to some patches that I briefly
> checked (I did a non-detailed review).
> 
> Please also consider the outstanding update to the Ethernet macro
> definitons in lib/uknetdev: https://patchwork.unikraft.org/patch/738013/
> . Since Intel DPDK and in general NFV is one of our targets, we should
> support VLAN tags. This has an effect to the maximum transmission unit
> (1522 B). Do you know if your netfront driver can handle such frame
> sizes (more or less) out-of-the box? As far as I understood, we have
> some restrictions with our virtio driver currently and need to re-visit
> this.

I just want to be super clear about this. These patches have been
sitting on both internal repos and public lists for way too long, it's
been 2 years since the first version. And I'm doing these patches on my
spare time. I'm not going to add any more functionality to them, I will
just accept the minor comments. It's either you will upstream the v5 or
you will have to find someone else to upstream these.

Costin


From minios-devel-bounces@lists.xenproject.org Fri Aug 21 07:58:16 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Fri, 21 Aug 2020 07:58:16 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1k91wG-0002cn-1M; Fri, 21 Aug 2020 07:58:16 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=50MG=B7=gmail.com=cristianvijelie@srs-us1.protection.inumbo.net>)
 id 1k91wF-0002cV-4Y
 for minios-devel@lists.xen.org; Fri, 21 Aug 2020 07:58:15 +0000
X-Inumbo-ID: 768f53ee-d56e-4653-8e35-65eca1a08107
Received: from mail-ej1-x629.google.com (unknown [2a00:1450:4864:20::629])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 768f53ee-d56e-4653-8e35-65eca1a08107;
 Fri, 21 Aug 2020 07:58:11 +0000 (UTC)
Received: by mail-ej1-x629.google.com with SMTP id o23so1286709ejr.1
 for <minios-devel@lists.xen.org>; Fri, 21 Aug 2020 00:58:11 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=from:to:cc:subject:date:message-id:in-reply-to:references
 :mime-version:content-transfer-encoding;
 bh=ipN5nVkhqpVOKYssG9w7HnSjqrLFG4QAA6KC4Zbk9IM=;
 b=EUBeIbeH0P7XxzoAIvscVEsDh2YJWW9u5EgZvyZrGg8QnIRtQEfsYzYKJ3vZkpncXo
 AgiNr6ItwomOU8XTyx92Opg+1BXZ5/zihr7J1WoS5GpNagp5XNirXgeKWtvX1Ma5iczw
 w+w5Js4WZxncOJwUP0pXcTElcKc/DneGhV5+NWquOGq2uumWCMcsnaX5IZeV0eR4QR+q
 FfPwXDv4jwSfvzhRl6wBMO/pKGj+eA0MXfCo5B5ngoAnaB3yWvK/ID7w58PRusTChWwK
 7nRCFDS+PsM5LQ7pxcQbZWPJ1weOJ2v0OKuVfZKvyJJfyrjIzdKq+TYh7+g4uwLDc1zO
 uFoA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to
 :references:mime-version:content-transfer-encoding;
 bh=ipN5nVkhqpVOKYssG9w7HnSjqrLFG4QAA6KC4Zbk9IM=;
 b=HLkY3KPY7UIgpTksbIXhCIZ952GYQpKPlaxVJ+wR3gB1KkXEV8MkcUddB/bimZfT1x
 /T1QCKmZ1CDUIYn8OpV737obpzQei2EE3krXaFbZSWd9gCt2zuuEaFRp0yDdur1OrRHp
 7oe3u877V2T0DjKZlyaQRTfsv/VF529ZFfPVlIvoysUl/SgW6MUVv3BltafQ/TFyW7RC
 cSej6amHaTSQrM8GXMVwNfOZkjOPtv9HC/+EmhsOUuUTJSM4DSbpyrsH/Ws/QQ0ELBni
 ITj/ikFG4E583ECU1J2NKtLaFac7e+Ec7MC2mRxabk5Zjd7Nxd2M6570CMXapECGZd9z
 xA3Q==
X-Gm-Message-State: AOAM533OgALZyjOz7yIX+51F/lc+N94IN//MbTsrnUkMDjtjsLKdx+YX
 Cq9muvEQfI5hdtGgPsGKsax0l7FiI+s=
X-Google-Smtp-Source: ABdhPJyWOYHwYZLq/xop96QL/kcdtI9IqVtqdg9trFr5NzPTQzYvSz7tiCCMuqQ0LaZ31ErFxNAZ9A==
X-Received: by 2002:a17:906:3715:: with SMTP id
 d21mr1531294ejc.281.1597996689668; 
 Fri, 21 Aug 2020 00:58:09 -0700 (PDT)
Received: from localhost.localdomain ([82.137.12.155])
 by smtp.gmail.com with ESMTPSA id h25sm835690ejq.12.2020.08.21.00.58.08
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Fri, 21 Aug 2020 00:58:09 -0700 (PDT)
From: cristianvijelie@gmail.com
To: minios-devel@lists.xen.org
Cc: Cristian Vijelie <cristianvijelie@gmail.com>
Subject: [[UNIKRAFT RFC PATCH] v2 1/1] Implementation of isrlib string.c
Date: Fri, 21 Aug 2020 10:57:51 +0300
Message-Id: <20200821075751.11116-2-cristianvijelie@gmail.com>
X-Mailer: git-send-email 2.25.1
In-Reply-To: <20200821075751.11116-1-cristianvijelie@gmail.com>
References: <20200821075751.11116-1-cristianvijelie@gmail.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-BeenThere: minios-devel@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Mini-os development list <minios-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:minios-devel@lists.xenproject.org>
List-Help: <mailto:minios-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: minios-devel-bounces@lists.xenproject.org
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>

From: Cristian Vijelie <cristianvijelie@gmail.com>

Signed-off-by: Cristian Vijelie <cristianvijelie@gmail.com>
---
 include/uk/isr/string.h |  76 +++++
 lib/isrlib/Config.uk    |   7 +
 lib/isrlib/Makefile.uk  |   3 +
 lib/isrlib/string.c     | 633 ++++++++++++++++++++++++++++++++++++++++
 4 files changed, 719 insertions(+)
 create mode 100644 include/uk/isr/string.h
 create mode 100644 lib/isrlib/Config.uk
 create mode 100644 lib/isrlib/Makefile.uk
 create mode 100644 lib/isrlib/string.c

diff --git a/include/uk/isr/string.h b/include/uk/isr/string.h
new file mode 100644
index 0000000..7ce9fea
--- /dev/null
+++ b/include/uk/isr/string.h
@@ -0,0 +1,76 @@
+/* SPDX-License-Identifier: BSD-3-Clause */
+/*
+ * Authors: Simon Kuenzer <simon.kuenzer@neclab.eu>
+ *
+ *
+ * Copyright (c) 2017, NEC Europe Ltd., NEC Corporation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the copyright holder nor the names of its
+ *    contributors may be used to endorse or promote products derived from
+ *    this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+#ifndef __UK_ISR_STRING_H__
+#define __UK_ISR_STRING_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <string.h>
+
+void *memcpy_isr(void *dst, const void *src, size_t len);
+void *memset_isr(void *ptr, int val, size_t len);
+void *memchr_isr(const void *ptr, int val, size_t len);
+void *memrchr_isr(const void *m, int c, size_t n);
+int memcmp_isr(const void *ptr1, const void *ptr2, size_t len);
+void *memmove_isr(void *dst, const void *src, size_t len);
+
+char *strncpy_isr(char *dst, const char *src, size_t len);
+char *strcpy_isr(char *dst, const char *src);
+size_t strlcpy_isr(char *d, const char *s, size_t n);
+size_t strlcat_isr(char *d, const char *s, size_t n);
+size_t strnlen_isr(const char *str, size_t maxlen);
+size_t strlen_isr(const char *str);
+char *strchrnul_isr(const char *s, int c);
+char *strchr_isr(const char *str, int c);
+char *strrchr_isr(const char *s, int c);
+int strncmp_isr(const char *str1, const char *str2, size_t len);
+int strcmp_isr(const char *str1, const char *str2);
+size_t strcspn_isr(const char *s, const char *c);
+size_t strspn_isr(const char *s, const char *c);
+char *strtok_isr(char *restrict s, const char *restrict sep);
+char *strtok_isr_r(char *restrict s, const char *restrict sep, char **restrict p);
+char *strndup_isr(const char *str, size_t len);
+char *strdup_isr(const char *str);
+
+char *strerror_isr_r(int errnum, char *buf, size_t buflen);
+char *strerror_isr(int errnum);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __UK_ISR_STRING_H__ */
diff --git a/lib/isrlib/Config.uk b/lib/isrlib/Config.uk
new file mode 100644
index 0000000..c6be13c
--- /dev/null
+++ b/lib/isrlib/Config.uk
@@ -0,0 +1,7 @@
+menuconfig LIBISRLIB
+    bool "isrlib: ISR helper library"
+    default n
+
+if LIBISRLIB
+
+endif
diff --git a/lib/isrlib/Makefile.uk b/lib/isrlib/Makefile.uk
new file mode 100644
index 0000000..df3616d
--- /dev/null
+++ b/lib/isrlib/Makefile.uk
@@ -0,0 +1,3 @@
+$(eval $(call addlib_s,libisrlib,$(CONFIG_LIBISRLIB)))
+
+LIBISRLIB_SRCS-y += $(LIBISRLIB_BASE)/string.c|isr
diff --git a/lib/isrlib/string.c b/lib/isrlib/string.c
new file mode 100644
index 0000000..6cb0981
--- /dev/null
+++ b/lib/isrlib/string.c
@@ -0,0 +1,633 @@
+#include <uk/isr/string.h>
+/* I included types.h because VSCode was complaining that __u8 and other 
+ * types are not defined, but the build is succesfull without it. 
+ */
+#include <uk/arch/types.h>
+#include <stdint.h>
+#include <limits.h>
+#include <errno.h>
+
+void *memcpy_isr(void *dst, const void *src, size_t len)
+{
+	size_t p;
+
+	for (p = 0; p < len; ++p)
+		*((__u8 *)(((__uptr)dst) + p)) = *((__u8 *)(((__uptr)src) + p));
+
+	return dst;
+}
+
+void *memset_isr(void *ptr, int val, size_t len)
+{
+	__u8 *p = (__u8 *) ptr;
+
+	for (; len > 0; --len)
+		*(p++) = (__u8)val;
+
+	return ptr;
+}
+
+void *memchr_isr(const void *ptr, int val, size_t len)
+{
+	uintptr_t o = 0;
+
+	for (o = 0; o < (uintptr_t)len; ++o)
+		if (*((const uint8_t *)(((uintptr_t)ptr) + o)) == (uint8_t)val)
+			return (void *)((uintptr_t)ptr + o);
+
+	return NULL; /* did not find val */
+}
+
+void *memrchr_isr(const void *m, int c, size_t n)
+{
+	const unsigned char *s = m;
+
+	c = (unsigned char) c;
+	while (n--)
+		if (s[n] == c)
+			return (void *) (s + n);
+	return 0;
+}
+
+void *memmove_isr(void *dst, const void *src, size_t len)
+{
+	uint8_t *d = dst;
+	const uint8_t *s = src;
+
+	if (src > dst) {
+		for (; len > 0; --len)
+			*(d++) = *(s++);
+	} else {
+		s += len;
+		d += len;
+
+		for (; len > 0; --len)
+			*(d--) = *(s--);
+	}
+
+	return dst;
+}
+
+int memcmp_isr(const void *ptr1, const void *ptr2, size_t len)
+{
+	const unsigned char *c1 = (const unsigned char *)ptr1;
+	const unsigned char *c2 = (const unsigned char *)ptr2;
+
+	for (; len > 0; --len, ++c1, ++c2) {
+		if ((*c1) != (*c2))
+			return ((*c1) - (*c2));
+	}
+
+	return 0;
+}
+
+size_t strlen_isr(const char *str)
+{
+	return strnlen_isr(str, SIZE_MAX);
+}
+
+size_t strnlen_isr(const char *str, size_t len)
+{
+	const char *p = memchr_isr(str, 0, len);
+	return p ? (size_t) (p - str) : len;
+}
+
+char *strncpy_isr(char *dst, const char *src, size_t len)
+{
+	size_t clen;
+
+	clen = strnlen_isr(src, len);
+	memcpy_isr(dst, src, clen);
+
+	/* instead of filling up the rest of left space with zeros,
+	 * append a termination character if we did not copy one
+	 */
+	if (clen < len && dst[clen - 1] != '\0')
+		dst[clen] = '\0';
+	return dst;
+}
+
+char *strcpy_isr(char *dst, const char *src)
+{
+	return strncpy_isr(dst, src, SIZE_MAX);
+}
+
+int strncmp_isr(const char *str1, const char *str2, size_t len)
+{
+	const char *c1 = (const char *)str1;
+	const char *c2 = (const char *)str2;
+
+	for (; len > 0; --len, ++c1, ++c2) {
+		if ((*c1) != (*c2))
+			return (int)((*c1) - (*c2));
+		if ((*c1) == '\0')
+			break;
+	}
+	return 0;
+}
+
+int strcmp_isr(const char *str1, const char *str2)
+{
+	register signed char __res;
+
+	while ((__res = *str1 - *str2++) == 0 && *str1++)
+		;
+
+	return __res;
+}
+
+/* The following code is taken from musl libc */
+#define ALIGN (sizeof(size_t))
+#define ONES ((size_t) -1 / UCHAR_MAX)
+#define HIGHS (ONES * (UCHAR_MAX / 2 + 1))
+#define HASZERO(x) (((x) - ONES) & ~(x) & HIGHS)
+#define BITOP(a, b, op) \
+		((a)[(size_t)(b) / (8*sizeof *(a))] op \
+		(size_t)1 << ((size_t)(b) % (8 * sizeof *(a))))
+
+char *strchrnul_isr(const char *s, int c)
+{
+	size_t *w, k;
+
+	c = (unsigned char)c;
+	if (!c)
+		return (char *)s + strlen_isr(s);
+
+	for (; (uintptr_t)s % ALIGN; s++)
+		if (!*s || *(unsigned char *)s == c)
+			return (char *)s;
+	k = ONES * c;
+	for (w = (void *)s; !HASZERO(*w) && !HASZERO(*w ^ k); w++)
+		;
+	for (s = (void *)w; *s && *(unsigned char *)s != c; s++)
+		;
+	return (char *)s;
+}
+
+char *strchr_isr(const char *str, int c)
+{
+	char *r = strchrnul_sr(str, c);
+	return *(unsigned char *)r == (unsigned char)c ? r : 0;
+}
+
+char *strrchr_isr(const char *s, int c)
+{
+	return memrchr_isr(s, c, strlen_isr(s) + 1);
+}
+
+size_t strcspn_isr(const char *s, const char *c)
+{
+	const char *a = s;
+	size_t byteset[32 / sizeof(size_t)];
+
+	if (!c[0] || !c[1])
+		return strchrnul_isr(s, *c)-a;
+
+	memset_isr(byteset, 0, sizeof(byteset));
+	for (; *c && BITOP(byteset, *(unsigned char *)c, |=); c++)
+		;
+	for (; *s && !BITOP(byteset, *(unsigned char *)s, &); s++)
+		;
+	return s-a;
+}
+
+size_t strspn_isr(const char *s, const char *c)
+{
+	const char *a = s;
+	size_t byteset[32 / sizeof(size_t)] = { 0 };
+
+	if (!c[0])
+		return 0;
+	if (!c[1]) {
+		for (; *s == *c; s++)
+			;
+		return s-a;
+	}
+
+	for (; *c && BITOP(byteset, *(unsigned char *)c, |=); c++)
+		;
+	for (; *s && BITOP(byteset, *(unsigned char *)s, &); s++)
+		;
+	return s-a;
+}
+
+char *strtok_isr(char *restrict s, const char *restrict sep)
+{
+	static char *p;
+
+	if (!s && !(s = p))
+		return NULL;
+	s += strspn_isr(s, sep);
+	if (!*s)
+		return p = 0;
+	p = s + strcspn_isr(s, sep);
+	if (*p)
+		*p++ = 0;
+	else
+		p = 0;
+	return s;
+}
+
+char *strtok_isr_r(char *restrict s, const char *restrict sep, char **restrict p)
+{
+	if (!s && !(s = *p))
+		return NULL;
+	s += strspn_isr(s, sep);
+	if (!*s)
+		return *p = 0;
+	*p = s + strcspn_isr(s, sep);
+	if (**p)
+		*(*p)++ = 0;
+	else
+		*p = 0;
+	return s;
+}
+
+char *strndup_isr(const char *str, size_t len)
+{
+	char *__res;
+	int __len;
+
+	__len = strnlen(str, len);
+
+	__res = malloc(__len + 1);
+	if (__res) {
+		memcpy(__res, str, __len);
+		__res[__len] = '\0';
+	}
+
+	return __res;
+}
+
+char *strdup_isr(const char *str)
+{
+	return strndup_isr(str, SIZE_MAX);
+}
+
+/* strlcpy has different ALIGN */
+#undef ALIGN
+#define ALIGN (sizeof(size_t)-1)
+size_t strlcpy_isr(char *d, const char *s, size_t n)
+{
+	char *d0 = d;
+	size_t *wd;
+	const size_t *ws;
+
+	if (!n--)
+		goto finish;
+
+	if (((uintptr_t)s & ALIGN) == ((uintptr_t)d & ALIGN)) {
+		for (; ((uintptr_t) s & ALIGN) && n && (*d = *s);
+		     n--, s++, d++)
+			;
+
+		if (n && *s) {
+			wd = (void *)d; ws = (const void *)s;
+			for (; n >= sizeof(size_t) && !HASZERO(*ws);
+			     n -= sizeof(size_t), ws++, wd++)
+				*wd = *ws;
+
+			d = (void *)wd; s = (const void *)ws;
+		}
+	}
+
+	for (; n && (*d = *s); n--, s++, d++)
+		;
+	*d = 0;
+finish:
+	return d-d0 + strlen_isr(s);
+}
+
+size_t strlcat_isr(char *d, const char *s, size_t n)
+{
+	size_t l = strnlen_isr(d, n);
+	if (l == n)
+		return l + strlen_isr(s);
+	return l + strlcpy_isr(d+l, s, n-l);
+}
+
+/* GNU-specific version of strerror_r */
+char *strerror_isr_r(int errnum, char *buf, size_t buflen)
+{
+	const char *strerr;
+
+	switch (errnum) {
+	case EPERM:
+		strerr = "Operation not permitted";
+		break;
+	case ENOENT:
+		strerr = "No such file or directory";
+		break;
+	case ESRCH:
+		strerr = "No such process";
+		break;
+	case EINTR:
+		strerr = "Interrupted system call";
+		break;
+	case EIO:
+		strerr = "Input/output error";
+		break;
+	case ENXIO:
+		strerr = "Device not configured";
+		break;
+	case E2BIG:
+		strerr = "Argument list too long";
+		break;
+	case ENOEXEC:
+		strerr = "Exec format error";
+		break;
+	case EBADF:
+		strerr = "Bad file descriptor";
+		break;
+	case ECHILD:
+		strerr = "No child processes";
+		break;
+	case EDEADLK:
+		strerr = "Resource deadlock avoided";
+		break;
+	case ENOMEM:
+		strerr = "Cannot allocate memory";
+		break;
+	case EACCES:
+		strerr = "Permission denied";
+		break;
+	case EFAULT:
+		strerr = "Bad address";
+		break;
+	case ENOTBLK:
+		strerr = "Block device required";
+		break;
+	case EBUSY:
+		strerr = "Device busy";
+		break;
+	case EEXIST:
+		strerr = "File exists";
+		break;
+	case EXDEV:
+		strerr = "Cross-device link";
+		break;
+	case ENODEV:
+		strerr = "Operation not supported by device";
+		break;
+	case ENOTDIR:
+		strerr = "Not a directory";
+		break;
+	case EISDIR:
+		strerr = "Is a directory";
+		break;
+	case EINVAL:
+		strerr = "Invalid argument";
+		break;
+	case ENFILE:
+		strerr = "Too many open files in system";
+		break;
+	case EMFILE:
+		strerr = "Too many open files";
+		break;
+	case ENOTTY:
+		strerr = "Inappropriate ioctl for device";
+		break;
+	case ETXTBSY:
+		strerr = "Text file busy";
+		break;
+	case EFBIG:
+		strerr = "File too large";
+		break;
+	case ENOSPC:
+		strerr = "No space left on device";
+		break;
+	case ESPIPE:
+		strerr = "Illegal seek";
+		break;
+	case EROFS:
+		strerr = "Read-only file system";
+		break;
+	case EMLINK:
+		strerr = "Too many links";
+		break;
+	case EPIPE:
+		strerr = "Broken pipe";
+		break;
+	case EDOM:
+		strerr = "Numerical argument out of domain";
+		break;
+	case ERANGE:
+		strerr = "Result too large";
+		break;
+	case EAGAIN:
+		strerr = "Resource temporarily unavailable";
+		break;
+	case EINPROGRESS:
+		strerr = "Operation now in progress";
+		break;
+	case EALREADY:
+		strerr = "Operation already in progress";
+		break;
+	case ENOTSOCK:
+		strerr = "Socket operation on non-socket";
+		break;
+	case EDESTADDRREQ:
+		strerr = "Destination address required";
+		break;
+	case EMSGSIZE:
+		strerr = "Message too long";
+		break;
+	case EPROTOTYPE:
+		strerr = "Protocol wrong type for socket";
+		break;
+	case ENOPROTOOPT:
+		strerr = "Protocol not available";
+		break;
+	case EPROTONOSUPPORT:
+		strerr = "Protocol not supported";
+		break;
+	case ESOCKTNOSUPPORT:
+		strerr = "Socket type not supported";
+		break;
+	case EOPNOTSUPP:
+		strerr = "Operation not supported on socket";
+		break;
+	case EPFNOSUPPORT:
+		strerr = "Protocol family not supported";
+		break;
+	case EAFNOSUPPORT:
+		strerr = "Address family not supported by protocol family";
+		break;
+	case EADDRINUSE:
+		strerr = "Address already in use";
+		break;
+	case EADDRNOTAVAIL:
+		strerr = "Can't assign requested address";
+		break;
+	case ENETDOWN:
+		strerr = "Network is down";
+		break;
+	case ENETUNREACH:
+		strerr = "Network is unreachable";
+		break;
+	case ENETRESET:
+		strerr = "Network dropped connection on reset";
+		break;
+	case ECONNABORTED:
+		strerr = "Software caused connection abort";
+		break;
+	case ECONNRESET:
+		strerr = "Connection reset by peer";
+		break;
+	case ENOBUFS:
+		strerr = "No buffer space available";
+		break;
+	case EISCONN:
+		strerr = "Socket is already connected";
+		break;
+	case ENOTCONN:
+		strerr = "Socket is not connected";
+		break;
+	case ESHUTDOWN:
+		strerr = "Can't send after socket shutdown";
+		break;
+	case ETIMEDOUT:
+		strerr = "Operation timed out";
+		break;
+	case ECONNREFUSED:
+		strerr = "Connection refused";
+		break;
+	case ELOOP:
+		strerr = "Too many levels of symbolic links";
+		break;
+	case ENAMETOOLONG:
+		strerr = "File name too long";
+		break;
+	case EHOSTDOWN:
+		strerr = "Host is down";
+		break;
+	case EHOSTUNREACH:
+		strerr = "No route to host";
+		break;
+	case ENOTEMPTY:
+		strerr = "Directory not empty";
+		break;
+	case EPROCLIM:
+		strerr = "Too many processes";
+		break;
+	case EUSERS:
+		strerr = "Too many users";
+		break;
+	case EDQUOT:
+		strerr = "Disc quota exceeded";
+		break;
+	case ESTALE:
+		strerr = "Stale NFS file handle";
+		break;
+	case EBADRPC:
+		strerr = "RPC struct is bad";
+		break;
+	case ERPCMISMATCH:
+		strerr = "RPC version wrong";
+		break;
+	case EPROGUNAVAIL:
+		strerr = "RPC prog";
+		break;
+	case EPROGMISMATCH:
+		strerr = "Program version wrong";
+		break;
+	case EPROCUNAVAIL:
+		strerr = "Bad procedure for program";
+		break;
+	case ENOLCK:
+		strerr = "No locks available";
+		break;
+	case ENOSYS:
+		strerr = "Function not implemented";
+		break;
+	case EFTYPE:
+		strerr = "Inappropriate file type or format";
+		break;
+	case EAUTH:
+		strerr = "Authentication error";
+		break;
+	case ENEEDAUTH:
+		strerr = "Need authenticator";
+		break;
+	case EIDRM:
+		strerr = "Identifier removed";
+		break;
+	case ENOMSG:
+		strerr = "No message of desired type";
+		break;
+	case EOVERFLOW:
+		strerr = "Value too large to be stored in data type";
+		break;
+	case ECANCELED:
+		strerr = "Operation canceled";
+		break;
+	case EILSEQ:
+		strerr = "Illegal byte sequence";
+		break;
+	case ENOATTR:
+		strerr = "Attribute not found";
+		break;
+	case EDOOFUS:
+		strerr = "Programming error";
+		break;
+	case EBADMSG:
+		strerr = "Bad message";
+		break;
+	case EMULTIHOP:
+		strerr = "Multihop attempted";
+		break;
+	case ENOLINK:
+		strerr = "Link has been severed";
+		break;
+	case EPROTO:
+		strerr = "Protocol error";
+		break;
+	case ENOTCAPABLE:
+		strerr = "Capabilities insufficient";
+		break;
+	case ECAPMODE:
+		strerr = "Not permitted in capability mode";
+		break;
+	case ENOTRECOVERABLE:
+		strerr = "State not recoverable";
+		break;
+	case EOWNERDEAD:
+		strerr = "Previous owner died";
+		break;
+	case ENOTSUP:
+		strerr = "Not supported";
+		break;
+	default:
+		strerr = NULL;
+		errno = EINVAL; /* Unknown errnum requires errno to be set */
+		break;
+	}
+
+	if (!buflen)
+		return buf;
+
+	/*
+	 * NOTE: If target buffer is too small, we are supposed to set
+	 *       errno to ERANGE. We ignore this case for simplification.
+	 */
+	if (strerr)
+		strncpy_isr(buf, strerr, buflen);
+	else
+		snprintf_isr(buf, buflen, "Unknown error %d", errnum);
+
+	/* ensure null termination */
+	buf[buflen - 1] = '\0';
+	return buf;
+}
+
+/* NOTE: strerror() is not thread-safe, nor reentrant-safe */
+char *strerror_isr(int errnum)
+{
+	/* NOTE: Our longest message is currently 48 characters. With
+	 *       64 characters we should have room for minor changes
+	 *       in the future.
+	 */
+	static char buf[64];
+
+	return strerror_isr_r(errnum, buf, sizeof(buf));
+}
-- 
2.25.1



From minios-devel-bounces@lists.xenproject.org Fri Aug 21 07:58:16 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Fri, 21 Aug 2020 07:58:16 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1k91wB-0002ca-Vz; Fri, 21 Aug 2020 07:58:11 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=50MG=B7=gmail.com=cristianvijelie@srs-us1.protection.inumbo.net>)
 id 1k91wA-0002cV-CQ
 for minios-devel@lists.xen.org; Fri, 21 Aug 2020 07:58:10 +0000
X-Inumbo-ID: 4652b78c-0341-448e-a18d-9dd1b8be2717
Received: from mail-ej1-x641.google.com (unknown [2a00:1450:4864:20::641])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 4652b78c-0341-448e-a18d-9dd1b8be2717;
 Fri, 21 Aug 2020 07:58:09 +0000 (UTC)
Received: by mail-ej1-x641.google.com with SMTP id o18so1253725eje.7
 for <minios-devel@lists.xen.org>; Fri, 21 Aug 2020 00:58:09 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=from:to:cc:subject:date:message-id:mime-version
 :content-transfer-encoding;
 bh=4MTgJZJisuh3uDk9Hr9MYz6fyyknmNievsN6jVuuL+w=;
 b=oF57E7dQvZBiK1ioe57afU4hOZuDgTy2Ps9P3KF6OZFH4ApXzu6CoC3mk3nPHIlub6
 YPDXGBKs4qAoQoV4DxoNlt6ieDQASJ6PqsH8gPIwfMrzvJDk2EjpjUKPrqA0FhbASeJo
 +zpXGd5w3C78HJq+hthUxomdq7XV7M1rMHHij6EVoT6S5CFYosxNXmQxpEWJS5wx5Dfn
 xJ1vJgdef9LGC1tH73l8Oao8hGPlSiHvef2+x08amyqpRpHK+UCc/LGSmy+yuHysTWeM
 rBxXkRBMY6EX8lhC5y4pulrRadSUr2qlnKSg6KPf+Krwp5VdQKZFywCa7IP90A59zot9
 0uxQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version
 :content-transfer-encoding;
 bh=4MTgJZJisuh3uDk9Hr9MYz6fyyknmNievsN6jVuuL+w=;
 b=oDMaJb5+onprN3f9qdXzTKVJyXGyPjK5ZRojNi8jXm9+S9SQmCZctKkX/ceNAyPcu5
 mw1Y1Gq2zw5Gg+UL/HKQrHbakk9R4OTZ/OWnIhniPdtE8C7Ma4pQVN8RVOjQVpf75Xo5
 7gSBto6Clb1p/K7sQgzEDhxRwkqgYzPTLXllli5NipZLSyMXm0lOQNJ2WzsFgLTDIGwA
 swRUQcC2uuuNRgda6MLnC2WjdDGyIPpnChZlkqMGl97CzPS3ZqrR0h3fGl/6e0Rioo0z
 5p4OXIM2fQc4bAtC4dfhaLyRBqEItbSMOTWBXSY1WamsHLq3Q/X+u3otM6XKkCdVXEmP
 UHlQ==
X-Gm-Message-State: AOAM530VrtwQNlcUak590IvnsVJKLH39Yfh7kPT6y/NF2IYPrMLJjsnV
 I+frkIpbtE5cYdlGoKinpOj16yZQuTs=
X-Google-Smtp-Source: ABdhPJwg4jqwDBn0rgA+jUjPJfmT4sdtNRqJ8eloGHmx0+sHRuzw/qz65oErvkh9G6ycfY/5i+ug6w==
X-Received: by 2002:a17:906:36c2:: with SMTP id
 b2mr1663602ejc.238.1597996687844; 
 Fri, 21 Aug 2020 00:58:07 -0700 (PDT)
Received: from localhost.localdomain ([82.137.12.155])
 by smtp.gmail.com with ESMTPSA id h25sm835690ejq.12.2020.08.21.00.58.06
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Fri, 21 Aug 2020 00:58:07 -0700 (PDT)
From: cristianvijelie@gmail.com
To: minios-devel@lists.xen.org
Cc: Cristian Vijelie <cristianvijelie@gmail.com>
Subject: [[UNIKRAFT RFC PATCH] v2 0/1] Implementation of lib/isrlib
Date: Fri, 21 Aug 2020 10:57:50 +0300
Message-Id: <20200821075751.11116-1-cristianvijelie@gmail.com>
X-Mailer: git-send-email 2.25.1
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-BeenThere: minios-devel@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Mini-os development list <minios-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:minios-devel@lists.xenproject.org>
List-Help: <mailto:minios-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: minios-devel-bounces@lists.xenproject.org
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>

From: Cristian Vijelie <cristianvijelie@gmail.com>

I have added the irq-safe variants of all the functions defined in the 
nolibc string.c 

Cristian Vijelie (1):
  Implementation of isrlib string.c

 include/uk/isr/string.h |  76 +++++
 lib/isrlib/Config.uk    |   7 +
 lib/isrlib/Makefile.uk  |   3 +
 lib/isrlib/string.c     | 633 ++++++++++++++++++++++++++++++++++++++++
 4 files changed, 719 insertions(+)
 create mode 100644 include/uk/isr/string.h
 create mode 100644 lib/isrlib/Config.uk
 create mode 100644 lib/isrlib/Makefile.uk
 create mode 100644 lib/isrlib/string.c

-- 
2.25.1



From minios-devel-bounces@lists.xenproject.org Fri Aug 21 09:18:36 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Fri, 21 Aug 2020 09:18:36 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1k93Bu-0001eB-7E; Fri, 21 Aug 2020 09:18:30 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=4ar4=B7=cs.pub.ro=costin.lupu@srs-us1.protection.inumbo.net>)
 id 1k93Bt-0001e6-1g
 for minios-devel@lists.xen.org; Fri, 21 Aug 2020 09:18:29 +0000
X-Inumbo-ID: 00d654e0-2b04-4145-b2c9-0fcded881c7d
Received: from mx.upb.ro (unknown [141.85.13.220])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 00d654e0-2b04-4145-b2c9-0fcded881c7d;
 Fri, 21 Aug 2020 09:18:26 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
 by mx.upb.ro (Postfix) with ESMTP id 3F025B560097;
 Fri, 21 Aug 2020 12:18:25 +0300 (EEST)
Received: from mx.upb.ro ([127.0.0.1])
 by localhost (mx.upb.ro [127.0.0.1]) (amavisd-new, port 10032)
 with ESMTP id yEfepNM_X8sx; Fri, 21 Aug 2020 12:18:23 +0300 (EEST)
Received: from localhost (localhost [127.0.0.1])
 by mx.upb.ro (Postfix) with ESMTP id 30E18B561D12;
 Fri, 21 Aug 2020 12:18:23 +0300 (EEST)
X-Virus-Scanned: amavisd-new at upb.ro
Received: from mx.upb.ro ([127.0.0.1])
 by localhost (mx.upb.ro [127.0.0.1]) (amavisd-new, port 10026)
 with ESMTP id lFCz7eGBNugL; Fri, 21 Aug 2020 12:18:23 +0300 (EEST)
Received: from [192.168.1.35] (unknown [188.25.162.205])
 by mx.upb.ro (Postfix) with ESMTPSA id DE762B560097;
 Fri, 21 Aug 2020 12:18:22 +0300 (EEST)
Subject: Re: [UNIKRAFT PATCH v4 01/12] plat/drivers/virtio: Fill MTU and
 queues alignments when retrieving information
To: Simon Kuenzer <simon.kuenzer@neclab.eu>, minios-devel@lists.xen.org
Cc: sharan.santhanam@neclab.eu
References: <20200813085342.29799-1-costin.lupu@cs.pub.ro>
 <20200813085342.29799-2-costin.lupu@cs.pub.ro>
 <c246a0fb-3c90-48ce-9bd2-333034f9ebb3@neclab.eu>
From: Costin Lupu <costin.lupu@cs.pub.ro>
Message-ID: <8a093944-29d7-93ab-f612-f68a742d0e47@cs.pub.ro>
Date: Fri, 21 Aug 2020 12:18:22 +0300
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101
 Thunderbird/68.11.0
MIME-Version: 1.0
In-Reply-To: <c246a0fb-3c90-48ce-9bd2-333034f9ebb3@neclab.eu>
Content-Type: text/plain; charset=utf-8
Content-Language: en-US
Content-Transfer-Encoding: quoted-printable
X-BeenThere: minios-devel@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Mini-os development list <minios-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:minios-devel@lists.xenproject.org>
List-Help: <mailto:minios-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: minios-devel-bounces@lists.xenproject.org
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>

On 8/20/20 6:47 PM, Simon Kuenzer wrote:
> Wouldn't this patch go independently to netfront? I do not see the
> relation...
>=20

Yes, this can be pushed separately. It's in the series because it's a
longer story behind. Sharan reviewed its previous version and it would
make sense if he would review the current one as well.

> On 13.08.20 10:53, Costin Lupu wrote:
>> This patch sets the max MTU value when retrieving device information
>> and the
>> alignments used when allocating packets for each queue.
>>
>> Signed-off-by: Costin Lupu <costin.lupu@cs.pub.ro>
>> ---
>> =C2=A0 plat/drivers/virtio/virtio_net.c | 3 +++
>> =C2=A0 1 file changed, 3 insertions(+)
>>
>> diff --git a/plat/drivers/virtio/virtio_net.c
>> b/plat/drivers/virtio/virtio_net.c
>> index b0663e60..0e748b8f 100644
>> --- a/plat/drivers/virtio/virtio_net.c
>> +++ b/plat/drivers/virtio/virtio_net.c
>> @@ -770,6 +770,7 @@ static int virtio_netdev_rxq_info_get(struct
>> uk_netdev *dev,
>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 rxq =3D &vndev->rxqs[queue_id];
>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 qinfo->nb_min =3D 1;
>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 qinfo->nb_max =3D rxq->max_nb_desc;
>> +=C2=A0=C2=A0=C2=A0 qinfo->nb_align =3D sizeof(void *); /* word size a=
lignment */
>=20
> @Costin, @Sharan: Does changing the alignment something good or bad to
> the virtio performance? I guess it does not harm. 0 meant that there is
> no alignment requirement for network packet buffers.
>=20

Word size alignment is better than no alignment. Given that you want
some performance, I don't think you'd be happy with no alignment. Btw,
with the buddy allocator all unaligned allocations do return (at least)
word size aligned addresses.

>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 qinfo->nb_is_power_of_two =3D 1;
>> =C2=A0 =C2=A0 exit:
>> @@ -797,6 +798,7 @@ static int virtio_netdev_txq_info_get(struct
>> uk_netdev *dev,
>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 txq =3D &vndev->txqs[queue_id];
>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 qinfo->nb_min =3D 1;
>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 qinfo->nb_max =3D txq->max_nb_desc;
>> +=C2=A0=C2=A0=C2=A0 qinfo->nb_align =3D sizeof(void *); /* word size a=
lignment */
>=20
> @Costin, @Sharan: ...same here.
>=20
>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 qinfo->nb_is_power_of_two =3D 1;
>> =C2=A0 =C2=A0 exit:
>> @@ -1048,6 +1050,7 @@ static void virtio_net_info_get(struct uk_netdev
>> *dev,
>> =C2=A0 =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 dev_info->max_rx_queues =3D vnde=
v->max_vqueue_pairs;
>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 dev_info->max_tx_queues =3D vndev->max_=
vqueue_pairs;
>> +=C2=A0=C2=A0=C2=A0 dev_info->max_mtu =3D vndev->max_mtu;
>=20
> I agree, this should be announced.
>=20
>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 dev_info->nb_encap_tx =3D sizeof(struct=
 virtio_net_hdr_padded);
>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 dev_info->nb_encap_rx =3D sizeof(struct=
 virtio_net_hdr_padded);
>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 dev_info->features =3D UK_FEATURE_RXQ_I=
NTR_AVAILABLE;
>>
>=20


From minios-devel-bounces@lists.xenproject.org Fri Aug 21 09:18:55 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Fri, 21 Aug 2020 09:18:55 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1k93CJ-0001fC-AL; Fri, 21 Aug 2020 09:18:55 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=4ar4=B7=cs.pub.ro=costin.lupu@srs-us1.protection.inumbo.net>)
 id 1k93CH-0001f6-TW
 for minios-devel@lists.xen.org; Fri, 21 Aug 2020 09:18:53 +0000
X-Inumbo-ID: 70cb8e80-19bb-45d1-a233-08aa043d5ef4
Received: from mx.upb.ro (unknown [141.85.13.220])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 70cb8e80-19bb-45d1-a233-08aa043d5ef4;
 Fri, 21 Aug 2020 09:18:52 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
 by mx.upb.ro (Postfix) with ESMTP id 53443B560097;
 Fri, 21 Aug 2020 12:18:51 +0300 (EEST)
Received: from mx.upb.ro ([127.0.0.1])
 by localhost (mx.upb.ro [127.0.0.1]) (amavisd-new, port 10032)
 with ESMTP id OwvUxQn5vqIK; Fri, 21 Aug 2020 12:18:48 +0300 (EEST)
Received: from localhost (localhost [127.0.0.1])
 by mx.upb.ro (Postfix) with ESMTP id 66D6DB561D1A;
 Fri, 21 Aug 2020 12:18:48 +0300 (EEST)
X-Virus-Scanned: amavisd-new at upb.ro
Received: from mx.upb.ro ([127.0.0.1])
 by localhost (mx.upb.ro [127.0.0.1]) (amavisd-new, port 10026)
 with ESMTP id E6dCsZ3XSlVZ; Fri, 21 Aug 2020 12:18:48 +0300 (EEST)
Received: from [192.168.1.35] (unknown [188.25.162.205])
 by mx.upb.ro (Postfix) with ESMTPSA id 078FEB560097;
 Fri, 21 Aug 2020 12:18:47 +0300 (EEST)
Subject: Re: [UNIKRAFT PATCH v4 03/12] plat/xen/drivers: Add skeleton for
 netfront driver
To: Simon Kuenzer <simon.kuenzer@neclab.eu>, minios-devel@lists.xen.org
Cc: sharan.santhanam@neclab.eu, Razvan Cojocaru <razvan.cojocaru93@gmail.com>
References: <20200813085342.29799-1-costin.lupu@cs.pub.ro>
 <20200813085342.29799-4-costin.lupu@cs.pub.ro>
 <ab699543-2fd9-bb04-51eb-43be58e24036@neclab.eu>
From: Costin Lupu <costin.lupu@cs.pub.ro>
Message-ID: <6c235e77-e36a-53d5-d592-2c60c5891e53@cs.pub.ro>
Date: Fri, 21 Aug 2020 12:18:47 +0300
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101
 Thunderbird/68.11.0
MIME-Version: 1.0
In-Reply-To: <ab699543-2fd9-bb04-51eb-43be58e24036@neclab.eu>
Content-Type: text/plain; charset=utf-8
Content-Language: en-US
Content-Transfer-Encoding: quoted-printable
X-BeenThere: minios-devel@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Mini-os development list <minios-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:minios-devel@lists.xenproject.org>
List-Help: <mailto:minios-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: minios-devel-bounces@lists.xenproject.org
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>

On 8/20/20 6:45 PM, Simon Kuenzer wrote:
> On 13.08.20 10:53, Costin Lupu wrote:
>> This patch introduces the skeleton for the Xen netfront driver.
>>
>> Signed-off-by: Costin Lupu <costin.lupu@cs.pub.ro>
>> Signed-off-by: Razvan Cojocaru <razvan.cojocaru93@gmail.com>
>> ---
>> =C2=A0 plat/xen/Config.uk=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=
=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 |=C2=A0 7 +++
>> =C2=A0 plat/xen/Makefile.uk=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=
=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 | 10 ++++
>> =C2=A0 plat/xen/drivers/net/exportsyms.uk |=C2=A0 1 +
>> =C2=A0 plat/xen/drivers/net/netfront.c=C2=A0=C2=A0=C2=A0 | 73 ++++++++=
++++++++++++++++++++++
>> =C2=A0 4 files changed, 91 insertions(+)
>> =C2=A0 create mode 100644 plat/xen/drivers/net/exportsyms.uk
>> =C2=A0 create mode 100644 plat/xen/drivers/net/netfront.c
>>
>> diff --git a/plat/xen/Config.uk b/plat/xen/Config.uk
>> index 364c9528..511bfa89 100644
>> --- a/plat/xen/Config.uk
>> +++ b/plat/xen/Config.uk
>> @@ -90,6 +90,13 @@ config XEN_XENBUS
>> =C2=A0 menu "Xenbus Drivers"
>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 depends on XEN_XENBUS
>> =C2=A0 +config XEN_NETFRONT
>> +=C2=A0=C2=A0=C2=A0 bool "Xenbus Netfront Driver"
>> +=C2=A0=C2=A0=C2=A0 default n
>=20
> Instead of having patch 12 in this series we should add another default
> line here to achieve the same configuration experience:
>=20
> =C2=A0=C2=A0=C2=A0=C2=A0default y if LIBUKNETDEV
>=20
> We did the same with virtio-net (kvm's Config.uk):
>=20
> ...
> config VIRTIO_NET
> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 bool "Virtio Net device"
> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 default y if LIBUKNETDEV
> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 default n
> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 depends on LIBUKNETDEV
> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 imply VIRTIO_PCI if ARCH_X86_64
> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 select VIRTIO_BUS
> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 select LIBUKSGLIST
> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 help
> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=
=C2=A0 Virtual network driver.
> ...

Ack.

>=20
>> +=C2=A0=C2=A0=C2=A0 depends on LIBUKNETDEV
>> +=C2=A0=C2=A0=C2=A0 help
>> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 Driver for netfront device=
s
>> +
>> =C2=A0 menuconfig XEN_BLKFRONT
>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 bool "Xenbus Blkfront Driver"
>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 default n
>> diff --git a/plat/xen/Makefile.uk b/plat/xen/Makefile.uk
>> index 2a8cdbf6..339b1b21 100644
>> --- a/plat/xen/Makefile.uk
>> +++ b/plat/xen/Makefile.uk
>> @@ -10,6 +10,7 @@ $(eval $(call addplat_s,xen,$(CONFIG_PLAT_XEN)))
>> =C2=A0 ##
>> =C2=A0 $(eval $(call addplatlib,xen,libxenplat))
>> =C2=A0 $(eval $(call addplatlib_s,xen,libxenbus,$(CONFIG_XEN_XENBUS)))
>> +$(eval $(call addplatlib_s,xen,libxennetfront,$(CONFIG_XEN_NETFRONT))=
)
>> =C2=A0 $(eval $(call addplatlib_s,xen,libxenblkfront,$(CONFIG_XEN_BLKF=
RONT)))
>> =C2=A0 $(eval $(call addplatlib_s,xen,libxen9pfront,$(CONFIG_XEN_9PFRO=
NT)))
>> =C2=A0 @@ -113,6 +114,15 @@ LIBXENBUS_SRCS-y=C2=A0=C2=A0=C2=A0=C2=A0=C2=
=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 +=3D
>> $(LIBXENPLAT_BASE)/xenbus/xs_watch.c
>> =C2=A0 LIBXENBUS_SRCS-y=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 +=3D $(LIBXENPLAT_BASE)/xenbus/xs.c
>> =C2=A0 endif
>> =C2=A0 +ifeq ($(CONFIG_XEN_NETFRONT),y)
>> +LIBXENNETFRONT_EXPORTS=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=
=C2=A0 =3D
>> $(LIBXENPLAT_BASE)/drivers/net/exportsyms.uk
>> +LIBXENNETFRONT_ASFLAGS-y=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 +=3D $(L=
IBXENPLAT_ASFLAGS-y)
>> +LIBXENNETFRONT_ASINCLUDES-y=C2=A0=C2=A0=C2=A0 +=3D $(LIBXENPLAT_ASINC=
LUDES-y)
>> +LIBXENNETFRONT_CFLAGS-y=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 +=3D=
 $(LIBXENPLAT_CFLAGS-y)
>> +LIBXENNETFRONT_CINCLUDES-y=C2=A0=C2=A0=C2=A0=C2=A0 +=3D $(LIBXENPLAT_=
CINCLUDES-y)
>> +LIBXENNETFRONT_SRCS-y=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=
=C2=A0 +=3D
>> $(LIBXENPLAT_BASE)/drivers/net/netfront.c
>> +endif
>> +
>> =C2=A0 ifeq ($(CONFIG_XEN_BLKFRONT),y)
>> =C2=A0 LIBXENBLKFRONT_EXPORTS=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=
=C2=A0=C2=A0=C2=A0 =3D
>> $(LIBXENPLAT_BASE)/drivers/blk/exportsyms.uk
>> =C2=A0 LIBXENBLKFRONT_ASFLAGS-y=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=
=A0 +=3D $(LIBXENPLAT_ASFLAGS-y)
>> diff --git a/plat/xen/drivers/net/exportsyms.uk
>> b/plat/xen/drivers/net/exportsyms.uk
>> new file mode 100644
>> index 00000000..c86c3f35
>> --- /dev/null
>> +++ b/plat/xen/drivers/net/exportsyms.uk
>> @@ -0,0 +1 @@
>> +none
>> \ No newline at end of file
>> diff --git a/plat/xen/drivers/net/netfront.c
>> b/plat/xen/drivers/net/netfront.c
>> new file mode 100644
>> index 00000000..b455911e
>> --- /dev/null
>> +++ b/plat/xen/drivers/net/netfront.c
>> @@ -0,0 +1,73 @@
>> +/* SPDX-License-Identifier: BSD-3-Clause */
>> +/*
>> + * Authors: Costin Lupu <costin.lupu@cs.pub.ro>
>> + *=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 Razvan Cojoc=
aru <razvan.cojocaru93@gmail.com>
>> + *
>> + * Copyright (c) 2020, University Politehnica of Bucharest. All
>> rights reserved.
>> + *
>> + * Redistribution and use in source and binary forms, with or without
>> + * modification, are permitted provided that the following conditions
>> + * are met:
>> + *
>> + * 1. Redistributions of source code must retain the above copyright
>> + *=C2=A0=C2=A0=C2=A0 notice, this list of conditions and the followin=
g disclaimer.
>> + * 2. Redistributions in binary form must reproduce the above copyrig=
ht
>> + *=C2=A0=C2=A0=C2=A0 notice, this list of conditions and the followin=
g disclaimer in
>> the
>> + *=C2=A0=C2=A0=C2=A0 documentation and/or other materials provided wi=
th the
>> distribution.
>> + * 3. Neither the name of the copyright holder nor the names of its
>> + *=C2=A0=C2=A0=C2=A0 contributors may be used to endorse or promote p=
roducts derived
>> from
>> + *=C2=A0=C2=A0=C2=A0 this software without specific prior written per=
mission.
>> + *
>> + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
>> CONTRIBUTORS "AS IS"
>> + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
>> TO, THE
>> + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
>> PURPOSE
>> + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
>> CONTRIBUTORS BE
>> + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, O=
R
>> + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT =
OF
>> + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
>> BUSINESS
>> + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
>> WHETHER IN
>> + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
>> OTHERWISE)
>> + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
>> ADVISED OF THE
>> + * POSSIBILITY OF SUCH DAMAGE.
>> + *
>> + * THIS HEADER MAY NOT BE EXTRACTED OR MODIFIED IN ANY WAY.
>> + */
>> +
>> +#include <xenbus/xenbus.h>
>> +
>> +
>> +#define DRIVER_NAME=C2=A0 "xen-netfront"
>> +
>> +static struct uk_alloc *drv_allocator;
>> +
>> +
>> +static int netfront_add_dev(struct xenbus_device *xendev)
>> +{
>> +=C2=A0=C2=A0=C2=A0 int rc =3D 0;
>> +
>> +=C2=A0=C2=A0=C2=A0 UK_ASSERT(xendev !=3D NULL);
>> +
>> +=C2=A0=C2=A0=C2=A0 return rc;
>> +}
>> +
>> +static int netfront_drv_init(struct uk_alloc *allocator)
>> +{
>> +=C2=A0=C2=A0=C2=A0 /* driver initialization */
>> +=C2=A0=C2=A0=C2=A0 if (!allocator)
>> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 return -EINVAL;
>> +
>> +=C2=A0=C2=A0=C2=A0 drv_allocator =3D allocator;
>> +=C2=A0=C2=A0=C2=A0 return 0;
>> +}
>> +
>> +static const xenbus_dev_type_t netfront_devtypes[] =3D {
>> +=C2=A0=C2=A0=C2=A0 xenbus_dev_vif,
>> +=C2=A0=C2=A0=C2=A0 xenbus_dev_none
>> +};
>> +
>> +static struct xenbus_driver netfront_driver =3D {
>> +=C2=A0=C2=A0=C2=A0 .device_types =3D netfront_devtypes,
>> +=C2=A0=C2=A0=C2=A0 .init=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=
=A0 =3D netfront_drv_init,
>> +=C2=A0=C2=A0=C2=A0 .add_dev=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 =3D netfron=
t_add_dev
>> +};
>> +XENBUS_REGISTER_DRIVER(&netfront_driver);
>>
>=20


From minios-devel-bounces@lists.xenproject.org Fri Aug 21 09:33:05 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Fri, 21 Aug 2020 09:33:05 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1k93Q0-0003Ea-DW; Fri, 21 Aug 2020 09:33:04 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=4ar4=B7=cs.pub.ro=costin.lupu@srs-us1.protection.inumbo.net>)
 id 1k93Py-0003EV-IX
 for minios-devel@lists.xen.org; Fri, 21 Aug 2020 09:33:02 +0000
X-Inumbo-ID: edc03e90-afd2-40f5-a990-24ab3ff86ddf
Received: from mx.upb.ro (unknown [141.85.13.250])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id edc03e90-afd2-40f5-a990-24ab3ff86ddf;
 Fri, 21 Aug 2020 09:33:01 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
 by mx.upb.ro (Postfix) with ESMTP id 1D260B560097;
 Fri, 21 Aug 2020 12:33:00 +0300 (EEST)
Received: from mx.upb.ro ([127.0.0.1])
 by localhost (mx.upb.ro [127.0.0.1]) (amavisd-new, port 10032)
 with ESMTP id ZCx7cMINGrRW; Fri, 21 Aug 2020 12:32:57 +0300 (EEST)
Received: from localhost (localhost [127.0.0.1])
 by mx.upb.ro (Postfix) with ESMTP id 2C028B561D12;
 Fri, 21 Aug 2020 12:32:57 +0300 (EEST)
X-Virus-Scanned: amavisd-new at upb.ro
Received: from mx.upb.ro ([127.0.0.1])
 by localhost (mx.upb.ro [127.0.0.1]) (amavisd-new, port 10026)
 with ESMTP id 0ZNqP-VQ0FPB; Fri, 21 Aug 2020 12:32:57 +0300 (EEST)
Received: from [192.168.1.35] (unknown [188.25.162.205])
 by mx.upb.ro (Postfix) with ESMTPSA id BB937B560097;
 Fri, 21 Aug 2020 12:32:56 +0300 (EEST)
Subject: Re: [UNIKRAFT PATCH v4 10/12] plat/xen/drivers/net: Add transmit
 operation
To: Simon Kuenzer <simon.kuenzer@neclab.eu>, minios-devel@lists.xen.org
Cc: sharan.santhanam@neclab.eu, Razvan Cojocaru <razvan.cojocaru93@gmail.com>
References: <20200813085342.29799-1-costin.lupu@cs.pub.ro>
 <20200813085342.29799-11-costin.lupu@cs.pub.ro>
 <494d8796-a3e0-a3d5-df36-6343df10d571@neclab.eu>
From: Costin Lupu <costin.lupu@cs.pub.ro>
Message-ID: <c71f09f9-79b7-816f-bced-a190ed6665fc@cs.pub.ro>
Date: Fri, 21 Aug 2020 12:32:56 +0300
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101
 Thunderbird/68.11.0
MIME-Version: 1.0
In-Reply-To: <494d8796-a3e0-a3d5-df36-6343df10d571@neclab.eu>
Content-Type: text/plain; charset=utf-8
Content-Language: en-US
Content-Transfer-Encoding: quoted-printable
X-BeenThere: minios-devel@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Mini-os development list <minios-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:minios-devel@lists.xenproject.org>
List-Help: <mailto:minios-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: minios-devel-bounces@lists.xenproject.org
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>

On 8/20/20 6:49 PM, Simon Kuenzer wrote:
> On 13.08.20 10:53, Costin Lupu wrote:
>> Whenever a packet is transmitted, the request describing it is written
>> in the
>> shared ring. The packet itself is written in a page referenced by the
>> request
>> and shared, as well, with the backend. At the end of each transmit
>> operation, a
>> cleanup operation is performed free'ing the resources allocated for th=
e
>> previously transmitted packets.
>>
>> Signed-off-by: Costin Lupu <costin.lupu@cs.pub.ro>
>> Signed-off-by: Razvan Cojocaru <razvan.cojocaru93@gmail.com>
>> ---
>> =C2=A0 plat/xen/drivers/net/netfront.c | 102 +++++++++++++++++++++++++=
+++++++
>> =C2=A0 1 file changed, 102 insertions(+)
>>
>> diff --git a/plat/xen/drivers/net/netfront.c
>> b/plat/xen/drivers/net/netfront.c
>> index 858d124a..f2b81329 100644
>> --- a/plat/xen/drivers/net/netfront.c
>> +++ b/plat/xen/drivers/net/netfront.c
>> @@ -39,6 +39,7 @@
>> =C2=A0 #include <uk/alloc.h>
>> =C2=A0 #include <uk/netdev_driver.h>
>> =C2=A0 #include <xen-x86/mm.h>
>> +#include <xen-x86/irq.h>
>> =C2=A0 #include <xenbus/xenbus.h>
>> =C2=A0 #include "netfront.h"
>> =C2=A0 #include "netfront_xb.h"
>> @@ -78,6 +79,106 @@ static uint16_t get_id_from_freelist(uint16_t
>> *freelist)
>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 return id;
>> =C2=A0 }
>> =C2=A0 +static int network_tx_buf_gc(struct uk_netdev_tx_queue *txq)
>> +{
>> +=C2=A0=C2=A0=C2=A0 RING_IDX prod, cons;
>> +=C2=A0=C2=A0=C2=A0 netif_tx_response_t *tx_rsp;
>> +=C2=A0=C2=A0=C2=A0 uint16_t id;
>> +=C2=A0=C2=A0=C2=A0 bool more_to_do;
>> +=C2=A0=C2=A0=C2=A0 int count =3D 0;
>> +
>> +=C2=A0=C2=A0=C2=A0 do {
>> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 prod =3D txq->ring.sring->=
rsp_prod;
>> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 rmb(); /* Ensure we see re=
sponses up to 'rp'. */
>> +
>> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 for (cons =3D txq->ring.rs=
p_cons; cons !=3D prod; cons++) {
>> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 tx=
_rsp =3D RING_GET_RESPONSE(&txq->ring, cons);
>> +
>> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 if=
 (tx_rsp->status =3D=3D NETIF_RSP_NULL)
>> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=
=A0=C2=A0=C2=A0=C2=A0 continue;
>> +
>> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 if=
 (tx_rsp->status =3D=3D NETIF_RSP_ERROR)
>> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=
=A0=C2=A0=C2=A0=C2=A0 uk_pr_err("packet error\n");
>=20
> "netdev%u: Transmission error on txq %u\n" ?
>=20

Ack.

>> +
>> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 id=
=C2=A0 =3D tx_rsp->id;
>> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 UK=
_ASSERT(id < NET_TX_RING_SIZE);
>> +
>> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 gn=
ttab_end_access(txq->gref[id]);
>> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 tx=
q->gref[id] =3D GRANT_INVALID_REF;
>> +
>> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 ad=
d_id_to_freelist(id, txq->freelist);
>> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 uk=
_semaphore_up(&txq->sem);
>> +
>> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 co=
unt++;
>> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 }
>> +
>> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 txq->ring.rsp_cons =3D pro=
d;
>> +
>> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 RING_FINAL_CHECK_FOR_RESPO=
NSES(&txq->ring, more_to_do);
>> +=C2=A0=C2=A0=C2=A0 } while (more_to_do);
>> +
>> +=C2=A0=C2=A0=C2=A0 return count;
>> +}
>> +
>> +static int netfront_xmit(struct uk_netdev *n,
>> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 struct uk_netdev_tx_queue =
*txq,
>> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 struct uk_netbuf *pkt)
>> +{
>> +=C2=A0=C2=A0=C2=A0 struct netfront_dev *nfdev;
>> +=C2=A0=C2=A0=C2=A0 unsigned long flags;
>> +=C2=A0=C2=A0=C2=A0 uint16_t id;
>> +=C2=A0=C2=A0=C2=A0 RING_IDX req_prod;
>> +=C2=A0=C2=A0=C2=A0 netif_tx_request_t *tx_req;
>> +=C2=A0=C2=A0=C2=A0 int notify;
>> +=C2=A0=C2=A0=C2=A0 int status =3D 0, count;
>> +
>> +=C2=A0=C2=A0=C2=A0 UK_ASSERT(n !=3D NULL);
>> +=C2=A0=C2=A0=C2=A0 UK_ASSERT(txq !=3D NULL);
>> +=C2=A0=C2=A0=C2=A0 UK_ASSERT(pkt !=3D NULL);
>> +=C2=A0=C2=A0=C2=A0 UK_ASSERT(pkt->len < PAGE_SIZE);
>> +
>> +=C2=A0=C2=A0=C2=A0 nfdev =3D to_netfront_dev(n);
>> +
>> +=C2=A0=C2=A0=C2=A0 /* get request id */
>> +=C2=A0=C2=A0=C2=A0 uk_semaphore_down(&txq->sem);
>> +=C2=A0=C2=A0=C2=A0 local_irq_save(flags);
>> +=C2=A0=C2=A0=C2=A0 id =3D get_id_from_freelist(txq->freelist);
>=20
> What happens when we are out of space and the ring is full?
> The xmit function should be non-blocking so that we can use it in
> polling mode. We should return in such a case that the transmission
> queue is currently full...
>=20

Ack.

>> +=C2=A0=C2=A0=C2=A0 local_irq_restore(flags);
>> +
>> +=C2=A0=C2=A0=C2=A0 /* get request */
>> +=C2=A0=C2=A0=C2=A0 req_prod =3D txq->ring.req_prod_pvt;
>> +=C2=A0=C2=A0=C2=A0 tx_req =3D RING_GET_REQUEST(&txq->ring, req_prod);=
 > +
>> +=C2=A0=C2=A0=C2=A0 /* setup grant for buffer data */
>> +=C2=A0=C2=A0=C2=A0 txq->gref[id] =3D tx_req->gref =3D
>> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 gnttab_grant_access(nfdev-=
>xendev->otherend_id,
>> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 vi=
rt_to_mfn(pkt->data), 1);
>> +=C2=A0=C2=A0=C2=A0 UK_ASSERT(tx_req->gref !=3D GRANT_INVALID_REF);
>> +
>> +=C2=A0=C2=A0=C2=A0 tx_req->offset =3D 0;
>> +=C2=A0=C2=A0=C2=A0 tx_req->size =3D (uint16_t) pkt->len;
>> +=C2=A0=C2=A0=C2=A0 tx_req->flags =3D 0;
>> +=C2=A0=C2=A0=C2=A0 tx_req->id =3D id;
>> +
>> +=C2=A0=C2=A0=C2=A0 txq->ring.req_prod_pvt =3D req_prod + 1;
>> +=C2=A0=C2=A0=C2=A0 wmb(); /* Ensure backend sees requests */
>> +
>> +=C2=A0=C2=A0=C2=A0 RING_PUSH_REQUESTS_AND_CHECK_NOTIFY(&txq->ring, no=
tify);
>> +=C2=A0=C2=A0=C2=A0 if (notify)
>> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 notify_remote_via_evtchn(t=
xq->evtchn); > +
>> +=C2=A0=C2=A0=C2=A0 status |=3D UK_NETDEV_STATUS_SUCCESS;
>> +
>> +=C2=A0=C2=A0=C2=A0 /* some cleanup */
>> +=C2=A0=C2=A0=C2=A0 local_irq_save(flags);
>> +=C2=A0=C2=A0=C2=A0 count =3D network_tx_buf_gc(txq);
>=20
> The clean-up should happen before enqueuing the given packet to the
> transmit queue, it is the first thing of xmit(). Since we anyway need t=
o
> do it and we do not have an advantage by delaying this operation.=20

Of course there is an advantage. You push the packets in order for them
to be processed ASAP by the backend and deal with cleaning up
afterwards. It's a kind of parallelization. Otherwise you would delay
the transmissions.

> We can also deal much better with full rings. Otherwise we
> unnecessarily drop a packets for transmission although there would
> have been space when clean-up finished. After calling cleaning you
> can check if there is space on the ring and return if we run out of
> it (use an `unlikely` to the condition so that we speed up the
> successful sending case).
>=20

The only scenario when this would solve anything would be when you have
the ring full and just before you decide to send a new packet the
backend starts processing your previous transmitted packets, leaving you
at least one free slot. There are 2 unlikely events here: first, the
ring is full, and second, the backend starts to process again when the
ring gets full (for the latter event, it's unlikely that the backend
will wake up given that it couldn't process 256 transmitted packets,
where 256 is the current number of slots). And for this very unlikely
context you would introduce a delay for all the transmissions if we
followed your suggestion.

Anyway, both Linux and FreeBSD do the cleanup after pushing the
requests, so I don't think we have much more to say about this.


Btw, I'm waiting for reviews on the other patches as well before I send
the v5.


>> +=C2=A0=C2=A0=C2=A0 local_irq_restore(flags);
>> +
>> +=C2=A0=C2=A0=C2=A0 status |=3D likely(count > 0) ? UK_NETDEV_STATUS_M=
ORE : 0x0;
>> +
>> +=C2=A0=C2=A0=C2=A0 return status;
>> +}
>> +
>> =C2=A0 static int netfront_rxq_enqueue(struct uk_netdev_rx_queue *rxq,
>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 struct uk_netbu=
f *netbuf)
>> =C2=A0 {
>> @@ -598,6 +699,7 @@ static int netfront_add_dev(struct xenbus_device
>> *xendev)
>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 }
>> =C2=A0 =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 /* register netdev */
>> +=C2=A0=C2=A0=C2=A0 nfdev->netdev.tx_one =3D netfront_xmit;
>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 nfdev->netdev.ops =3D &netfront_ops;
>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 rc =3D uk_netdev_drv_register(&nfdev->n=
etdev, drv_allocator,
>> DRIVER_NAME);
>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 if (rc < 0) {
>>
>=20


From minios-devel-bounces@lists.xenproject.org Fri Aug 21 09:49:42 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Fri, 21 Aug 2020 09:49:42 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1k93g3-0004Ib-Ua; Fri, 21 Aug 2020 09:49:39 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=50MG=B7=gmail.com=cristianvijelie@srs-us1.protection.inumbo.net>)
 id 1k93g3-0004IV-86
 for minios-devel@lists.xen.org; Fri, 21 Aug 2020 09:49:39 +0000
X-Inumbo-ID: 68820d96-b4ec-46eb-9b89-b87e3788d1ff
Received: from mail-ej1-x632.google.com (unknown [2a00:1450:4864:20::632])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 68820d96-b4ec-46eb-9b89-b87e3788d1ff;
 Fri, 21 Aug 2020 09:49:38 +0000 (UTC)
Received: by mail-ej1-x632.google.com with SMTP id d11so1366482ejt.13
 for <minios-devel@lists.xen.org>; Fri, 21 Aug 2020 02:49:38 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=from:to:subject:date:message-id:mime-version
 :content-transfer-encoding;
 bh=iKA3Ui3kJrPRYWPWfRJ941ZsthauH4DumVSYzeIe37E=;
 b=W12BumGjyp40VUh9Ud9hYmC1DDxO5PnSRR76badLPZDDbICgYHLW8YUHtUSX07+9TW
 ham1nEOYKfdi0do6q52MgDqXKikkHwr8WSE+3d2TlFaISbcMxCZqHOJjinjyuGY4Wf2o
 QELnbaOvORh0np+K32EZQWEEQXMEwodeIHBux98eNXVBMlQTplbW57gMRIikgrVMzjWf
 dItUCD5kgjBWOlELg3nABroii79Gi1cyEbPqKbeH7dbaMP58kusd66DK69WU88ujpvMd
 sCdiLFIJg/ghuYgjpnKr/JilXopgRsEdwqdErHvCrUqCwkvidfilPf2EvCdmebcvZPt0
 zLoA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:to:subject:date:message-id:mime-version
 :content-transfer-encoding;
 bh=iKA3Ui3kJrPRYWPWfRJ941ZsthauH4DumVSYzeIe37E=;
 b=ZjHuvbl4kaYujretL+upLPHl6M+65/Dgh2tqbcKRj2p1/Ms+LFyoidjR5RRyyTZxNg
 CA0dqhkV/cEtJr8IGqS5ixJT3E8X0k26yz8r2Q6CnYwmhpP7oAs1IYrQZHaqmP23QNV6
 sha+BmUKXAUnc0LUkFX3A/kXGE7vYM2AN4pX3+uyDxGFrQ1cMU16aXzHkmg3ybD1qRg+
 ymGuz1M2IMytVel+AD9RisD2DPfEKE18q5vhETGQkia5iWRZ1mLA35uXz5WqTiIlO7lI
 xNilbkXT0wmRt9trapj4BvlQqQ5+eWhJ/h2+E35bfiQREakTUoxlSIqFOocHi+RaLceu
 94xg==
X-Gm-Message-State: AOAM5329NUVygiDjc2NWOsslcPjvkd+dKLhvB9SB4KKgixpWLPrXVhwI
 FQL8zXDJT7320xgV7mcpDGVcOaKB1QY=
X-Google-Smtp-Source: ABdhPJzU9gpWzWDK//vcINWxRT/n+AAS+CAAHw0TSatilHJobWHhOHZrDlZ3Q1nof/UAfqSHid8o2Q==
X-Received: by 2002:a17:906:3c02:: with SMTP id
 h2mr1992465ejg.437.1598003377193; 
 Fri, 21 Aug 2020 02:49:37 -0700 (PDT)
Received: from localhost.localdomain ([82.137.12.155])
 by smtp.gmail.com with ESMTPSA id v4sm991887eje.39.2020.08.21.02.49.35
 for <minios-devel@lists.xen.org>
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Fri, 21 Aug 2020 02:49:36 -0700 (PDT)
From: cristianvijelie@gmail.com
To: minios-devel@lists.xen.org
Subject: [[UNIKRAFT PATCH] libs/lib-krb5 v2 0/2] Porting of the MIT Kerberos
 runtime librares
Date: Fri, 21 Aug 2020 12:49:27 +0300
Message-Id: <20200821094929.35373-1-cristianvijelie@gmail.com>
X-Mailer: git-send-email 2.25.1
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-BeenThere: minios-devel@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Mini-os development list <minios-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:minios-devel@lists.xenproject.org>
List-Help: <mailto:minios-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: minios-devel-bounces@lists.xenproject.org
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>

From: Cristian Vijelie <cristianvijelie@gmail.com>

As libkrb5support, libkrb5crypto, libcom_err, libkrb5 and libgssapi are all
downloaded and built from the same source, I've decided to include them all
in one Unikraft external library.

Here are the needed libraries for each one of them
libkrb5support: lib-newlib, lib-pthread-embedded, lib-lwip
libkrb5crypto:  libkrb5support and it's dependencies
libcom_err:     libkrb5support and it's dependencies
libkrb5:        all of the above
libgssapi:      all of the above + libdl (not implemented)

The configuring of the Kerberos libraries is done with the flag --disable-nls,
because the nls feature needs libdl, which is not yet implemented (but it
exists as unikraft/lib/posix-libdl).

Also, I added a sed command after configuring the library, to remove the use
of secure_getenv, as it's not implemented in newlib.

The libkrb5 can't be built, yet, because of the missing implementation for
__res_ninit, from libnewlibc/origin/newlib-2.5.0.20170922/newlib/libc/sys/linux/include/resolv.h.

I've not added the gssapi library, as it has missing dependencies, and I will add
it after libdl will be implemented.

I've not yet added the OpenSSL support, or the OpenLDAP support.

Cristian Vijelie (5):
  Initial empty commit
  Introducing the library skeleton
  Add Makefile.uk
  Small changes to Makefile.uk
  Add Makefile.uk

-- 
2.25.1



From minios-devel-bounces@lists.xenproject.org Fri Aug 21 09:49:45 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Fri, 21 Aug 2020 09:49:45 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1k93g9-0004J3-01; Fri, 21 Aug 2020 09:49:45 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=50MG=B7=gmail.com=cristianvijelie@srs-us1.protection.inumbo.net>)
 id 1k93g8-0004IV-1b
 for minios-devel@lists.xen.org; Fri, 21 Aug 2020 09:49:44 +0000
X-Inumbo-ID: 08c0f339-d079-4be7-87e1-6bda2eecbb02
Received: from mail-ed1-x530.google.com (unknown [2a00:1450:4864:20::530])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 08c0f339-d079-4be7-87e1-6bda2eecbb02;
 Fri, 21 Aug 2020 09:49:39 +0000 (UTC)
Received: by mail-ed1-x530.google.com with SMTP id b2so930938edw.5
 for <minios-devel@lists.xen.org>; Fri, 21 Aug 2020 02:49:39 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=from:to:subject:date:message-id:in-reply-to:references:mime-version
 :content-transfer-encoding;
 bh=j6dIgyFIIKdDjU8/DHBCaWi68U8jtJz+J0+EdaDLmao=;
 b=lZ4kcG+ENSHhshqxj0xPvtJwWiYCRX7iKys76cniHjQYI0wFOPkfia5xILckTpjILc
 oIHoswIyYm3MXpY+OS4wgSVFUatFYKfAxbRNcQBLJWj8MDgfMDTnsjIh3xSMW67bHEXo
 9Y3fRkDMB6b/JjdPVsl6ixAxGJltwy3feohS3f20S4OJ1Yu56grWXd/OfclZHVfXD6Nr
 AKiHqoZrlsFJkuFd9AN5FlELAgStRV4J0rj+zZkrwhBimXve0oFiH1khaGIjM/PQ9N8Q
 Ue0cF9Z9YmdUkUXRy5OiYvM/tsAt5xdW4pv44g2sHTKh/w7OxaWvYaJxd5AvVKoK6I2q
 1BKA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to
 :references:mime-version:content-transfer-encoding;
 bh=j6dIgyFIIKdDjU8/DHBCaWi68U8jtJz+J0+EdaDLmao=;
 b=onxUF69F/HUgOwi+iIXvvA7FbAO6HdXRWNmmmgO2RDz7UnwXFVW8klpubWFvhqisiU
 hDvW55AkOcGhbYJy5WtLUXvK6YFhq4j08O0B0lch/dDSW/oZO7XbS1hePZJaXgDmZIj+
 fosxV6WToW/N/2C4VeMidP7+uZ16eWIyt4wSYoLI0nlLWhREFuv/dPeE44FZUEvqQBWT
 a/hORvnOpyK+bdiuPCYhoUD8AFuTWWIGJ+OJfn5ydRBZe5dKlfvDDLyuPASNkzNlInQO
 iTVzE35tq3wXBl/FmEVevxOJHd7QWaxRdBBEufzCkcTMC4vssuro4p9FLc0iBjdTGBCL
 NSsQ==
X-Gm-Message-State: AOAM530KhS/2OP9OoEsWqolh2Gzzzf1oMPTLfSFdeZEri69ZBJtQAwwP
 HAaZN5FNEZy/hU0fAB+P/jj1y9E8CZQ=
X-Google-Smtp-Source: ABdhPJzsVMpst5jYkoJ+aBjOc+225gaQEawHD6ycCY0OG8OEq1tiSDBwTO1maARbxeBtSj+utXkTOQ==
X-Received: by 2002:aa7:d145:: with SMTP id r5mr1793315edo.323.1598003378483; 
 Fri, 21 Aug 2020 02:49:38 -0700 (PDT)
Received: from localhost.localdomain ([82.137.12.155])
 by smtp.gmail.com with ESMTPSA id v4sm991887eje.39.2020.08.21.02.49.37
 for <minios-devel@lists.xen.org>
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Fri, 21 Aug 2020 02:49:37 -0700 (PDT)
From: cristianvijelie@gmail.com
To: minios-devel@lists.xen.org
Subject: [[UNIKRAFT PATCH] libs/lib-krb5 v2 1/2] Introducing the library
 skeleton
Date: Fri, 21 Aug 2020 12:49:28 +0300
Message-Id: <20200821094929.35373-2-cristianvijelie@gmail.com>
X-Mailer: git-send-email 2.25.1
In-Reply-To: <20200821094929.35373-1-cristianvijelie@gmail.com>
References: <20200821094929.35373-1-cristianvijelie@gmail.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-BeenThere: minios-devel@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Mini-os development list <minios-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:minios-devel@lists.xenproject.org>
List-Help: <mailto:minios-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: minios-devel-bounces@lists.xenproject.org
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>

From: Cristian Vijelie <cristianvijelie@gmail.com>

Signed-off-by: Cristian Vijelie <cristianvijelie@gmail.com>
---
 .gitignore      |  5 +++++
 CODING_STYLE.md |  4 ++++
 CONTRIBUTING.md |  4 ++++
 COPYING.md      | 38 ++++++++++++++++++++++++++++++++++++++
 Config.uk       | 34 ++++++++++++++++++++++++++++++++++
 MAINTAINERS.md  | 10 ++++++++++
 README.md       | 10 ++++++++++
 7 files changed, 105 insertions(+)
 create mode 100644 .gitignore
 create mode 100644 CODING_STYLE.md
 create mode 100644 CONTRIBUTING.md
 create mode 100644 COPYING.md
 create mode 100644 Config.uk
 create mode 100644 MAINTAINERS.md
 create mode 100644 README.md

diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..090479c
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,5 @@
+krb5-1.18.2
+*_make
+make_log
+*.patch
+temp
diff --git a/CODING_STYLE.md b/CODING_STYLE.md
new file mode 100644
index 0000000..5730041
--- /dev/null
+++ b/CODING_STYLE.md
@@ -0,0 +1,4 @@
+Coding Style
+============
+
+Please refer to the `CODING_STYLE.md` file in the main Unikraft repository.
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
new file mode 100644
index 0000000..14f6ac6
--- /dev/null
+++ b/CONTRIBUTING.md
@@ -0,0 +1,4 @@
+Contributing to Unikraft
+========================
+
+Please refer to the `CONTRIBUTING.md` file in the main Unikraft repository.
diff --git a/COPYING.md b/COPYING.md
new file mode 100644
index 0000000..fed756c
--- /dev/null
+++ b/COPYING.md
@@ -0,0 +1,38 @@
+License
+=======
+
+Unikraft Kerberos wrappers
+----------------------------------
+
+This repository contains wrapper code to build MIT Kerberos runtime
+libraries with Unikraft. Each C code file in this repository should 
+declare who is the copyright owner and under which terms and conditions 
+the code is licensed. If such a licence note is missing, the following 
+copyright notice will apply:
+
+	Copyright (c) Year, Institution. All rights reserved.
+
+	Redistribution and use in source and binary forms, with or without
+	modification, are permitted provided that the following conditions
+	are met:
+
+	1. Redistributions of source code must retain the above copyright
+	   notice, this list of conditions and the following disclaimer.
+	2. Redistributions in binary form must reproduce the above copyright
+	   notice, this list of conditions and the following disclaimer in the
+	   documentation and/or other materials provided with the distribution.
+	3. Neither the name of the copyright holder nor the names of its
+	   contributors may be used to endorse or promote products derived from
+	   this software without specific prior written permission.
+
+	THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+	AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+	IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+	ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+	LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+	CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+	SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+	INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+	CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+	ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+	POSSIBILITY OF SUCH DAMAGE.
\ No newline at end of file
diff --git a/Config.uk b/Config.uk
new file mode 100644
index 0000000..ab7834e
--- /dev/null
+++ b/Config.uk
@@ -0,0 +1,34 @@
+menuconfig LIBKRB5
+    bool "libkrb5: MIT Kerberos runtime libraries"
+    select LIBKRB5SUPPORT
+    select LIBKRB5CRYPTO
+    select LIBCOM_ERR
+    default n
+
+menuconfig LIBKRB5SUPPORT
+    bool "likrb5support: MIT Kerberos support libraries"
+    select LIBNEWLIB
+    select LIBPTHREAD_EMBEDDED
+    select LIBLWIP
+    select LWIP_UKNETDEV
+	select LWIP_TCP
+	select LWIP_THREADS
+	select LWIP_SOCKET
+	select LWIP_IPV4
+    select LWIP_IPV6
+    select LWIP_DNS
+    default n
+
+menuconfig LIBKRB5CRYPTO
+    bool "lib5crypto: MIT Kerberos crypto libraries"
+    select LIBKRB5SUPPORT
+    default n
+
+menuconfig LIBGSSAPI_KRB5
+    bool "libgssapi_krb5: MIT Kerberos GSS-API mechanism"
+    default n
+
+menuconfig LIBCOM_ERR
+    bool "libcom_err: Common error description library"
+    select LIBKRB5SUPPORT
+    default n
diff --git a/MAINTAINERS.md b/MAINTAINERS.md
new file mode 100644
index 0000000..64c23e2
--- /dev/null
+++ b/MAINTAINERS.md
@@ -0,0 +1,10 @@
+Maintainers List
+================
+
+For notes on how to read this information, please refer to `MAINTAINERS.md` in
+the main Unikraft repository.
+
+	LIBNETTLE-UNIKRAFT
+	M:	Cristian Vijelie <cristianvijelie@gmail.com>
+	L:	minios-devel@lists.xen.org
+	F: *
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..cfcb208
--- /dev/null
+++ b/README.md
@@ -0,0 +1,10 @@
+MIT Kerberos runtime libaries for Unikraft
+=============================
+
+This is the port of MIT Kerberos runtime libaries for Unikraft. You will need pthread-embedded, newlib and lwip to make it work.
+When adding the libraru in the dependencies list, lib-krb5, the libraries should be like this:
+`...$(UK_LIBS)/krb5:$(UK_LIBS)/pthread-embedded:$(UK_LIBS)/newlib:$(UK_LIBS)/lwip:...`
+
+Please refer to the `README.md` as well as the documentation in the `doc/` subdirectory of the main unikraft repository.
+
+Issues known: libkrb5 can't be built, due to some missing dependencies (__res_ninit). Only lib5crypto, libkrb5support and liberr_com work for now.
-- 
2.25.1



From minios-devel-bounces@lists.xenproject.org Fri Aug 21 09:49:50 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Fri, 21 Aug 2020 09:49:50 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1k93gE-0004K0-2g; Fri, 21 Aug 2020 09:49:50 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=50MG=B7=gmail.com=cristianvijelie@srs-us1.protection.inumbo.net>)
 id 1k93gD-0004IV-1q
 for minios-devel@lists.xen.org; Fri, 21 Aug 2020 09:49:49 +0000
X-Inumbo-ID: 11e978ba-fbd7-44b9-b523-9ae79a9cd54b
Received: from mail-ej1-x636.google.com (unknown [2a00:1450:4864:20::636])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 11e978ba-fbd7-44b9-b523-9ae79a9cd54b;
 Fri, 21 Aug 2020 09:49:41 +0000 (UTC)
Received: by mail-ej1-x636.google.com with SMTP id a26so1599980ejc.2
 for <minios-devel@lists.xen.org>; Fri, 21 Aug 2020 02:49:41 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=from:to:subject:date:message-id:in-reply-to:references:mime-version
 :content-transfer-encoding;
 bh=aSwqDFz/qFICNrMR8Ghf5E0v2YQl1zNY1ulq4iAL1MI=;
 b=qL8CYjajlnBK3T020Q3YsWlbgffkOuf72XJztw/jOxCDk2/4zxoosCHLly6IxKV5Ej
 sjDnaM20taPhMpo/DKWDKPcB7xZhyZuX5ahhzBusWtv4A1N7ptjoX/H+mbCLzBMSBfQj
 U9A4xCFQNTIYGc2nw9ERwnsKU+V0YWQsUmMux2dlrcTAGHPjShewX1qllXFdADC9ulyE
 xRGkfwodE/TXrhCNOz6z3zup65Vb2tYj+oahCTI6sfJ/naLwfPNVcCw3ZgztU9Kb8JWw
 +yb9hz1rGdnkTtNgWHW6bIVdsfPQspqXUZbjyZ21sLkELoh1dt2LgN4gV1Ata2rv12hc
 3G1g==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to
 :references:mime-version:content-transfer-encoding;
 bh=aSwqDFz/qFICNrMR8Ghf5E0v2YQl1zNY1ulq4iAL1MI=;
 b=pNZtVG0D/UzVb4gwj0sKCxi00kbnIN10q9IFnpbu/RuOaRHDjpqdNbOdxQkcrq/DdU
 wLUzt6gyo+q3Exvj0JjaFlVbcIq0fT5OnWrd6wWqwP0RnwokW8tkjzx/Zaah4fouGxwO
 UTo9Oa+LBWADAEugtPmOQ+F3YE5SRASthUfVDjWO8K4JOglONrMYuGCOA1PDIe3bqvjr
 /XXQo75sFmke+eA3ewV2rGERvM3Kg14GunU/BWEOCPKfV0yek/6Prp30jhTX49JtaNM3
 0HwpAuXHbhRfmAj3XtLpTKWHd0gxR+40JGdVf+LRC0e0ejOB5/b4mBCvZ+g6kSt/T3my
 r+kg==
X-Gm-Message-State: AOAM531fQqcVK6eTwPaWU6zbQafa4QqBpJWpww+atzmCw4ICNZ+MGSmp
 EU5pGYdgnyQFtIA9ZeroFkJzV3jjqr4=
X-Google-Smtp-Source: ABdhPJyHnnbWRMDmBRSJ++fjjvSIKgsO2n82W8oknFKCt71t7sdfJOfcQDkKW1QYKiZ8e8tRRRhPFg==
X-Received: by 2002:a17:906:7e4e:: with SMTP id
 z14mr1982282ejr.87.1598003379815; 
 Fri, 21 Aug 2020 02:49:39 -0700 (PDT)
Received: from localhost.localdomain ([82.137.12.155])
 by smtp.gmail.com with ESMTPSA id v4sm991887eje.39.2020.08.21.02.49.38
 for <minios-devel@lists.xen.org>
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Fri, 21 Aug 2020 02:49:39 -0700 (PDT)
From: cristianvijelie@gmail.com
To: minios-devel@lists.xen.org
Subject: [[UNIKRAFT PATCH] libs/lib-krb5 v2 2/2] Add Makefile.uk
Date: Fri, 21 Aug 2020 12:49:29 +0300
Message-Id: <20200821094929.35373-3-cristianvijelie@gmail.com>
X-Mailer: git-send-email 2.25.1
In-Reply-To: <20200821094929.35373-1-cristianvijelie@gmail.com>
References: <20200821094929.35373-1-cristianvijelie@gmail.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-BeenThere: minios-devel@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Mini-os development list <minios-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:minios-devel@lists.xenproject.org>
List-Help: <mailto:minios-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: minios-devel-bounces@lists.xenproject.org
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>

From: Cristian Vijelie <cristianvijelie@gmail.com>

Signed-off-by: Cristian Vijelie <cristianvijelie@gmail.com>
---
 Makefile.uk        | 562 +++++++++++++++++++++++++++++++++++++++++++++
 include/byteswap.h |  26 +++
 2 files changed, 588 insertions(+)
 create mode 100644 Makefile.uk
 create mode 100644 include/byteswap.h

diff --git a/Makefile.uk b/Makefile.uk
new file mode 100644
index 0000000..90b4ace
--- /dev/null
+++ b/Makefile.uk
@@ -0,0 +1,562 @@
+##############################################################################################
+# Library registration
+##############################################################################################
+$(eval $(call addlib_s,libkrb5,$(CONFIG_LIBKRB5)))
+$(eval $(call addlib_s,libkrb5support,$(CONFIG_LIBKRB5SUPPORT)))
+$(eval $(call addlib_s,libkrb5crypto,$(CONFIG_LIBKRB5CRYPTO)))
+$(eval $(call addlib_s,libcom_err,$(CONFIG_LIBCOM_ERR)))
+
+##############################################################################################
+# SOURCES
+##############################################################################################
+LIBKRB5_MAJORVER=1.18
+LIBKRB5_MINORVER=2
+LIBKRB5_TARNAME=krb5-$(LIBKRB5_MAJORVER).$(LIBKRB5_MINORVER)
+LIBKRB5_URL=http://web.mit.edu/kerberos/dist/krb5/$(LIBKRB5_MAJORVER)/$(LIBKRB5_TARNAME).tar.gz
+LIBKRB5_PATCHDIR=$(LIBKRB5_BASE)/patches
+$(eval $(call fetch,libkrb5,$(LIBKRB5_URL)))
+$(eval $(call patch,libkrb5,$(LIBKRB5_PATCHDIR),$(LIBKRB5_TARNAME)))
+
+##############################################################################################
+# Helpers
+##############################################################################################
+LIBKRB5_MAINDIR=$(LIBKRB5_ORIGIN)/$(LIBKRB5_TARNAME)/src
+LIBKRB5_COMPILE_PATH=$(LIBKRB5_MAINDIR)/util/et
+LIBKRB5_DIR=$(LIBKRB5_MAINDIR)/lib/krb5
+
+LIBKRB5SUPPORT_DIR=$(LIBKRB5_MAINDIR)/util/support
+LIBKRB5CRYPTO_DIR=$(LIBKRB5_MAINDIR)/lib/crypto
+
+##############################################################################################
+# Library includes
+##############################################################################################
+LIBKRB5_COMMON_INCLUDES = -I$(LIBKRB5_BASE)/include -I$(LIBKRB5_MAINDIR)/include
+
+# Unsafe includes, but build can't be realised without them 
+LIBKRB5_NEWLIB_INCLUDES = -I$(LIBNEWLIB_LIBC)/sys/linux/include -I$(LIBNEWLIB_LIBC)/sys/linux \
+-I$(LIBNEWLIB_LIBC)/sys/linux/sys
+
+LIBKRB5_CINCLUDES-y = $(LIBKRB5_COMMON_INCLUDES) $(LIBKRB5_NEWLIB_INCLUDES) -I$(LIBKRB5_DIR)/ccache \
+-I$(LIBKRB5_DIR)/ccache/ccapi -I$(LIBKRB5_DIR)/ccache/ccapi -I$(LIBKRB5_DIR)/os \
+-I$(LIBKRB5_DIR)/keytab -I$(LIBKRB5_DIR)/rcache -I$(LIBKRB5_DIR)/unicode -I$(LIBKRB5_MAINDIR) \
+-I$(LIBKRB5_MAINDIR)/util/profile
+
+LIBKRB5CRYPTO_CINCLUDES-y = $(LIBKRB5_COMMON_INCLUDES) $(LIBKRB5_NEWLIB_INCLUDES) \
+-I$(LIBKRB5CRYPTO_DIR)/krb -I$(LIBKRB5CRYPTO_DIR)/builtin -I$(LIBKRB5CRYPTO_DIR)/builtin/aes \
+-I$(LIBKRB5CRYPTO_DIR)/builtin/camellia -I$(LIBKRB5CRYPTO_DIR)/builtin/des \
+-I$(LIBKRB5CRYPTO_DIR)/builtin/md4 -I$(LIBKRB5CRYPTO_DIR)/builtin/md5 \
+-I$(LIBKRB5CRYPTO_DIR)/builtin/sha1 -I$(LIBKRB5CRYPTO_DIR)/builtin/sha2 \
+
+LIBKRB5SUPPORT_CINCLUDES = $(LIBKRB5_COMMON_INCLUDES)
+
+LIBCOM_ERR_CINCLUDES-y = $(LIBKRB5_COMMON_INCLUDES) $(LIBKRB5_COMPILE_PATH)
+
+##############################################################################################
+# Global flags
+##############################################################################################
+# Flags taken from the original Kerberos Makefiles
+LIBKRB5_CFLAGS += -fPIC -DSHARED -DHAVE_CONFIG_H  -DKRB5_DEPRECATED=1 -DKRB5_PRIVATE -Wall \
+-Wcast-align -Wshadow -Wmissing-prototypes -Wno-format-zero-length -Woverflow -Wstrict-overflow \
+-Wmissing-format-attribute -Wmissing-prototypes -Wreturn-type -Wmissing-braces -Wparentheses \
+-Wswitch -Wunused-function -Wunused-label -Wunused-variable -Wunused-value -Wunknown-pragmas \
+-Wsign-compare -Werror=uninitialized -Wno-maybe-uninitialized -Werror=pointer-arith \
+-Werror=int-conversion -Werror=incompatible-pointer-types -Werror=discarded-qualifiers \
+-Werror=implicit-int -Werror=declaration-after-statement -Werror-implicit-function-declaration
+
+LIBCOM_ERR_CFLAGS = $(LIBKRB5_CFLAGS)
+LIBKRB5SUPPORT_CFLAGS = $(LIBKRB5_CFLAGS)
+LIBKRB5CRYPTO_CFLAGS = $(LIBKRB5_CFLAGS)
+
+# Defines used only by libkrb5
+LIBKRB5_CFLAGS += -DLIBDIR=\"/usr/local/lib\"
+LIBKRB5_CFLAGS += -DDYNOBJEXT=\".so\"
+LIBKRB5_CFLAGS += -DBINDIR=\"/usr/local/bin\"
+LIBKRB5_CFLAGS += -DSBINDIR=\"/usr/local/sbin\"
+
+# Linking flags taken from the original Kerberos Makefiles 
+LIBKRB5_OBJFLAGS += -shared -fPIC -Wl,--no-undefined -Wl,--enable-new-dtags -Wl,-rpath
+LIBCOM_ERR_OBJFLAGS = $(LIBKRB5_OBJFLAGS)
+LIBKRB5SUPPORT_OBJFLAGS = $(LIBKRB5_OBJFLAGS)
+LIBKRB5CRYPTO_OBJFLAGS = $(LIBKRB5_OBJFLAGS)
+
+##############################################################################################
+# libkrb5 code
+##############################################################################################
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/error_tables/asn1_err.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/error_tables/kdb5_err.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/error_tables/krb5_err.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/error_tables/k5e1_err.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/error_tables/kv5m_err.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/error_tables/krb524_err.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/asn.1/asn1_encode.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/asn.1/asn1_k_encode.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/asn.1/ldap_key_seq.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/ccache/ccbase.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/ccache/cccopy.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/ccache/cccursor.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/ccache/ccdefault.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/ccache/ccdefops.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/ccache/ccmarshal.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/ccache/ccselect.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/ccache/ccselect_hostname.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/ccache/ccselect_k5identity.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/ccache/ccselect_realm.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/ccache/cc_dir.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/ccache/cc_retr.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/ccache/cc_file.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/ccache/cc_kcm.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/ccache/cc_memory.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/ccache/cc_keyring.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/ccache/ccfns.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/keytab/ktadd.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/keytab/ktbase.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/keytab/ktdefault.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/keytab/ktfr_entry.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/keytab/ktremove.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/keytab/ktfns.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/keytab/kt_file.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/keytab/kt_memory.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/keytab/read_servi.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/addr_comp.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/addr_order.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/addr_srch.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/allow_weak.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/appdefault.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/ai_authdata.c 
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/auth_con.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/cammac_util.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/authdata.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/authdata_exp.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/authdata_enc.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/authdata_dec.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/bld_pr_ext.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/bld_princ.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/chk_trans.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/chpw.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/conv_creds.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/conv_princ.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/copy_addrs.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/copy_auth.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/copy_athctr.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/copy_cksum.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/copy_creds.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/copy_data.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/copy_key.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/copy_princ.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/copy_tick.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/cp_key_cnt.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/decode_kdc.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/decrypt_tk.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/deltat.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/enc_helper.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/enc_keyhelper.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/encode_kdc.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/encrypt_tk.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/etype_list.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/fast.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/fwd_tgt.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/gc_via_tkt.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/gen_seqnum.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/gen_subkey.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/gen_save_subkey.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/get_creds.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/get_etype_info.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/get_in_tkt.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/gic_keytab.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/gic_opt.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/gic_pwd.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/in_tkt_sky.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/init_ctx.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/copy_ctx.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/init_keyblock.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/kdc_rep_dc.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/kerrs.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/kfree.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/libdef_parse.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/mk_cred.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/mk_error.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/mk_priv.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/mk_rep.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/mk_req.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/mk_req_ext.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/mk_safe.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/pac.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/pac_sign.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/padata.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/parse.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/parse_host_string.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/plugin.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/pr_to_salt.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/preauth2.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/preauth_ec.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/preauth_encts.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/preauth_otp.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/preauth_pkinit.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/preauth_sam2.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/princ_comp.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/privsafe.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/random_str.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/rd_cred.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/rd_error.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/rd_priv.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/rd_rep.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/rd_req.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/rd_req_dec.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/rd_safe.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/recvauth.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/response_items.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/s4u_authdata.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/s4u_creds.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/sendauth.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/send_tgs.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/ser_actx.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/ser_adata.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/ser_addr.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/ser_auth.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/ser_cksum.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/ser_ctx.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/ser_key.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/ser_princ.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/serialize.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/set_realm.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/sname_match.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/srv_dec_tkt.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/srv_rcache.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/str_conv.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/tgtname.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/unparse.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/val_renew.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/valid_times.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/vfy_increds.c 
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/vic_opt.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb/walk_rtree.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/os/accessor.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/os/c_ustime.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/os/ccdefname.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/os/changepw.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/os/dnsglue.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/os/dnssrv.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/os/expand_path.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/os/full_ipadr.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/os/gen_port.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/os/genaddrs.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/os/gen_rname.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/os/hostaddr.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/os/hostrealm.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/os/hostrealm_dns.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/os/hostrealm_domain.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/os/hostrealm_profile.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/os/hostrealm_registry.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/os/init_os_ctx.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/os/krbfileio.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/os/ktdefname.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/os/mk_faddr.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/os/localaddr.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/os/localauth.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/os/localauth_an2ln.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/os/localauth_k5login.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/os/localauth_names.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/os/localauth_rule.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/os/locate_kdc.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/os/lock_file.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/os/net_read.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/os/net_write.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/os/port2ip.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/os/prompter.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/os/read_msg.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/os/read_pwd.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/os/realm_dom.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/os/sendto_kdc.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/os/sn2princ.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/os/thread_safe.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/os/timeofday.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/os/toffset.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/os/trace.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/os/unlck_file.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/os/ustime.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/os/write_msg.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/rcache/memrcache.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/rcache/rc_base.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/rcache/rc_dfl.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/rcache/rc_file2.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/rcache/rc_none.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/unicode/ucdata.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/unicode/ure.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/unicode/urestubs.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/unicode/ucstr.c
+LIBKRB5_SRCS-y += $(LIBKRB5_DIR)/krb5_libinit.c
+
+##############################################################################################
+# libkrb5support code
+##############################################################################################
+LIBKRB5SUPPORT_SRCS-y += $(LIBKRB5SUPPORT_DIR)/threads.c
+LIBKRB5SUPPORT_SRCS-y += $(LIBKRB5SUPPORT_DIR)/init-addrinfo.c
+LIBKRB5SUPPORT_SRCS-y += $(LIBKRB5SUPPORT_DIR)/plugins.c
+LIBKRB5SUPPORT_SRCS-y += $(LIBKRB5SUPPORT_DIR)/errors.c
+LIBKRB5SUPPORT_SRCS-y += $(LIBKRB5SUPPORT_DIR)/k5buf.c
+LIBKRB5SUPPORT_SRCS-y += $(LIBKRB5SUPPORT_DIR)/gmt_mktime.c
+LIBKRB5SUPPORT_SRCS-y += $(LIBKRB5SUPPORT_DIR)/fake-addrinfo.c
+LIBKRB5SUPPORT_SRCS-y += $(LIBKRB5SUPPORT_DIR)/utf8.c
+LIBKRB5SUPPORT_SRCS-y += $(LIBKRB5SUPPORT_DIR)/utf8_conv.c
+LIBKRB5SUPPORT_SRCS-y += $(LIBKRB5SUPPORT_DIR)/zap.c
+LIBKRB5SUPPORT_SRCS-y += $(LIBKRB5SUPPORT_DIR)/path.c
+LIBKRB5SUPPORT_SRCS-y += $(LIBKRB5SUPPORT_DIR)/base64.c
+LIBKRB5SUPPORT_SRCS-y += $(LIBKRB5SUPPORT_DIR)/json.c
+LIBKRB5SUPPORT_SRCS-y += $(LIBKRB5SUPPORT_DIR)/hex.c
+LIBKRB5SUPPORT_SRCS-y += $(LIBKRB5SUPPORT_DIR)/hashtab.c
+LIBKRB5SUPPORT_SRCS-y += $(LIBKRB5SUPPORT_DIR)/bcmp.c
+LIBKRB5SUPPORT_SRCS-y += $(LIBKRB5SUPPORT_DIR)/strerror_r.c
+LIBKRB5SUPPORT_SRCS-y += $(LIBKRB5SUPPORT_DIR)/dir_filenames.c
+LIBKRB5SUPPORT_SRCS-y += $(LIBKRB5SUPPORT_DIR)/strlcpy.c
+
+##############################################################################################
+# libkrb5crypto code
+##############################################################################################
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/krb/aead.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/krb/block_size.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/krb/cf2.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/krb/checksum_dk_cmac.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/krb/checksum_dk_hmac.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/krb/checksum_etm.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/krb/checksum_hmac_md5.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/krb/checksum_unkeyed.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/krb/checksum_length.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/krb/cksumtype_to_string.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/krb/cksumtypes.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/krb/cmac.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/krb/coll_proof_cksum.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/krb/crypto_length.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/krb/crypto_libinit.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/krb/default_state.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/krb/decrypt.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/krb/decrypt_iov.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/krb/derive.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/krb/encrypt.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/krb/encrypt_iov.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/krb/encrypt_length.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/krb/enctype_util.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/krb/enc_dk_cmac.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/krb/enc_dk_hmac.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/krb/enc_etm.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/krb/enc_raw.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/krb/enc_rc4.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/krb/etypes.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/krb/key.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/krb/keyblocks.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/krb/keyed_cksum.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/krb/keyed_checksum_types.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/krb/keylengths.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/krb/make_checksum.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/krb/make_checksum_iov.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/krb/make_random_key.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/krb/mandatory_sumtype.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/krb/nfold.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/krb/old_api_glue.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/krb/prf.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/krb/prf_aes2.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/krb/prf_cmac.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/krb/prf_des.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/krb/prf_dk.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/krb/prf_rc4.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/krb/prng.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/krb/prng_fortuna.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/krb/random_to_key.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/krb/s2k_pbkdf2.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/krb/s2k_rc4.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/krb/state.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/krb/string_to_cksumtype.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/krb/string_to_key.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/krb/valid_cksumtype.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/krb/verify_checksum.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/krb/verify_checksum_iov.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/builtin/camellia/camellia.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/builtin/des/d3_aead.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/builtin/des/d3_kysched.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/builtin/des/des_keys.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/builtin/des/f_aead.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/builtin/des/f_cksum.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/builtin/des/f_parity.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/builtin/des/f_sched.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/builtin/des/f_tables.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/builtin/des/key_sched.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/builtin/des/weak_key.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/builtin/aes/aescrypt.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/builtin/aes/aestab.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/builtin/aes/aeskey.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/builtin/md4/md4.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/builtin/md5/md5.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/builtin/sha1/shs.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/builtin/sha2/sha256.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/builtin/sha2/sha512.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/builtin/enc_provider/des3.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/builtin/enc_provider/rc4.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/builtin/enc_provider/aes.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/builtin/enc_provider/enc_camellia.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/builtin/hash_provider/hash_md4.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/builtin/hash_provider/hash_md5.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/builtin/hash_provider/hash_sha1.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/builtin/hash_provider/hash_sha2.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/builtin/hmac.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/builtin/init.c
+LIBKRB5CRYPTO_SRCS-y += $(LIBKRB5CRYPTO_DIR)/builtin/pbkdf2.c
+
+##############################################################################################
+# libcom_err code
+##############################################################################################
+LIBCOM_ERR_SRCS-y += $(LIBKRB5_COMPILE_PATH)/error_message.c
+LIBCOM_ERR_SRCS-y += $(LIBKRB5_COMPILE_PATH)/et_name.c
+LIBCOM_ERR_SRCS-y += $(LIBKRB5_COMPILE_PATH)/com_err.c
+
+##############################################################################################
+# Library prepare
+##############################################################################################
+# Run ./configure
+$(LIBKRB5_MAINDIR)/.configured: $(LIBKRB5_BUILD)/.origin
+	$(call verbose_cmd,CONFIG,libkrb: $(notdir $@), cd $(LIBKRB5_MAINDIR) && ./configure \
+	--disable-nls && touch $@ && cd include && \
+	sed -e "s/#define HAVE_SECURE_GETENV 1/\/\* #undef HAVE_SECURE_GETENV \*\//" autoconf.h > \
+	autoconf.temp && mv autoconf.temp autoconf.h)
+
+# Generate compile_et
+$(LIBKRB5_COMPILE_PATH)/compile_et:
+	$(call verbose_cmd,GEN,libkrb: $(notdir $@), cd $(LIBKRB5_COMPILE_PATH) && /bin/sh \
+	./config_script ./compile_et.sh "/usr/local/share/et" mawk sed > $@ && chmod 755 $@)
+
+# Generate .h and .c files
+$(LIBKRB5_MAINDIR)/include/osconf.h: $(LIBKRB5_MAINDIR)/include/osconf.hin
+	$(call verbose_cmd,GEN,libkrb: $(notdir $@), cat $^ | sed -e "s\"@KRB5RCTMPDIR\"/var/tmp\""\
+	 -e "s\"@PREFIX\"/usr/local\"" -e "s\"@EXEC_PREFIX\"/usr/local\"" \
+	 -e "s\"@BINDIR\"/usr/local/bin\"" -e "s\"@LIBDIR\"/usr/local/lib\"" \
+	 -e "s\"@SBINDIR\"/usr/local/sbin\"" -e "s\"@MODULEDIR\"/usr/local/lib/krb5/plugins\"" \
+	 -e "s\"@GSSMODULEDIR\"/usr/local/lib/gss\"" -e "s\"@LOCALSTATEDIR\"/usr/local/var\"" \
+	 -e "s\"@RUNSTATEDIR\"/run\"" -e "s\"@SYSCONFDIR\"/usr/local/etc\"" \
+	 -e "s\"@DYNOBJEXT\".so\"" -e "s\"@SYSCONFCONF\":/usr/local/etc/krb5.conf\"" > osconf.new \
+	 && $(LIBKRB5_MAINDIR)/config/move-if-changed osconf.new $@)
+
+$(LIBKRB5_MAINDIR)/include/com_err.h: $(LIBKRB5_COMPILE_PATH)/com_err.h
+	$(call verbose_cmd,GEN,libkrb: $(notdir $@), cp $^ $@)
+
+$(LIBKRB5_MAINDIR)/include/profile.h: $(LIBKRB5_MAINDIR)/util/profile/profile.hin $(LIBKRB5_MAINDIR)/util/profile/prof_err.h
+	$(call verbose_cmd,GEN,libkrb: $(notdir $@), cat $^ > $@)
+
+$(LIBKRB5_MAINDIR)/include/krb5/krb5.h: $(LIBKRB5_MAINDIR)/include/krb5/krb5.hin
+	$(call verbose_cmd,GEN,libkrb: $(notdir $@), cd $(LIBKRB5_MAINDIR)/include && echo "#ifndef KRB5_KRB5_H_INCLUDED" >> krb5/krb5.new && echo "#define KRB5_KRB5_H_INCLUDED" >> krb5/krb5.new && cat krb5/krb5.hin $(LIBKRB5_MAINDIR)/lib/krb5/error_tables/krb5_err.h $(LIBKRB5_MAINDIR)/lib/krb5/error_tables/k5e1_err.h $(LIBKRB5_MAINDIR)/lib/krb5/error_tables/kdb5_err.h $(LIBKRB5_MAINDIR)/lib/krb5/error_tables/kv5m_err.h $(LIBKRB5_MAINDIR)/lib/krb5/error_tables/krb524_err.h $(LIBKRB5_MAINDIR)/lib/krb5/error_tables/asn1_err.h >> krb5/krb5.new && echo "#endif /* KRB5_KRB5_H_INCLUDED */" >> krb5/krb5.new && $(LIBKRB5_MAINDIR)/config/move-if-changed krb5/krb5.new krb5/krb5.h)
+
+$(LIBKRB5_DIR)/error_tables/et-c-asn1_err.et: $(LIBKRB5_DIR)/error_tables/asn1_err.et
+	$(call verbose_cmd,GEN,libkrb: $(notdir $@), cd $(LIBKRB5_DIR)/error_tables && rm -f et-c-asn1_err.et et-c-asn1_err.c et-c-asn1_err.h && cp $^ $@)
+$(LIBKRB5_DIR)/error_tables/et-c-asn1_err.c: $(LIBKRB5_DIR)/error_tables/et-c-asn1_err.et
+	$(call verbose_cmd,GEN,libkrb: $(notdir $@), cd $(LIBKRB5_DIR)/error_tables && $(LIBKRB5_COMPILE_PATH)/compile_et -d $(LIBKRB5_COMPILE_PATH) --textdomain mit-krb5 $^)
+$(LIBKRB5_DIR)/error_tables/asn1_err.c: $(LIBKRB5_DIR)/error_tables/et-c-asn1_err.c
+	$(call verbose_cmd,GEN,libkrb: $(notdir $@), cd $(LIBKRB5_DIR)/error_tables && mv -f $^ $@ && rm -f et-c-asn1_err.et et-c-asn1_err.h)
+
+$(LIBKRB5_DIR)/error_tables/et-c-kdb5_err.et: $(LIBKRB5_DIR)/error_tables/kdb5_err.et
+	$(call verbose_cmd,GEN,libkrb: $(notdir $@), cd $(LIBKRB5_DIR)/error_tables && rm -f et-c-kdb5_err.et et-c-kdb5_err.c et-c-kdb5_err.h && cp $^ $@)
+$(LIBKRB5_DIR)/error_tables/et-c-kdb5_err.c: $(LIBKRB5_DIR)/error_tables/et-c-kdb5_err.et
+	$(call verbose_cmd,GEN,libkrb: $(notdir $@), cd $(LIBKRB5_DIR)/error_tables && $(LIBKRB5_COMPILE_PATH)/compile_et -d $(LIBKRB5_COMPILE_PATH) --textdomain mit-krb5 $^)
+$(LIBKRB5_DIR)/error_tables/kdb5_err.c: $(LIBKRB5_DIR)/error_tables/et-c-kdb5_err.c
+	$(call verbose_cmd,GEN,libkrb: $(notdir $@), cd $(LIBKRB5_DIR)/error_tables && mv -f $^ $@ && rm -f et-c-kdb5_err.et et-c-kdb5_err.h)
+
+$(LIBKRB5_DIR)/error_tables/et-c-krb5_err.et: $(LIBKRB5_DIR)/error_tables/krb5_err.et
+	$(call verbose_cmd,GEN,libkrb: $(notdir $@), cd $(LIBKRB5_DIR)/error_tables && rm -f et-c-krb5_err.et et-c-krb5_err.c et-c-krb5_err.h && cp $^ $@)
+$(LIBKRB5_DIR)/error_tables/et-c-krb5_err.c: $(LIBKRB5_DIR)/error_tables/et-c-krb5_err.et
+	$(call verbose_cmd,GEN,libkrb: $(notdir $@), cd $(LIBKRB5_DIR)/error_tables && $(LIBKRB5_COMPILE_PATH)/compile_et -d $(LIBKRB5_COMPILE_PATH) --textdomain mit-krb5 $^)
+$(LIBKRB5_DIR)/error_tables/krb5_err.c: $(LIBKRB5_DIR)/error_tables/et-c-krb5_err.c
+	$(call verbose_cmd,GEN,libkrb: $(notdir $@), cd $(LIBKRB5_DIR)/error_tables && mv -f $^ $@ && rm -f et-c-krb5_err.et et-c-krb5_err.h)
+
+$(LIBKRB5_DIR)/error_tables/et-c-k5e1_err.et: $(LIBKRB5_DIR)/error_tables/k5e1_err.et
+	$(call verbose_cmd,GEN,libkrb: $(notdir $@), cd $(LIBKRB5_DIR)/error_tables && rm -f et-c-k5e1_err.et et-c-k5e1_err.c et-c-k5e1_err.h && cp $^ $@)
+$(LIBKRB5_DIR)/error_tables/et-c-k5e1_err.c: $(LIBKRB5_DIR)/error_tables/et-c-k5e1_err.et
+	$(call verbose_cmd,GEN,libkrb: $(notdir $@), cd $(LIBKRB5_DIR)/error_tables && $(LIBKRB5_COMPILE_PATH)/compile_et -d $(LIBKRB5_COMPILE_PATH) --textdomain mit-krb5 $^)
+$(LIBKRB5_DIR)/error_tables/k5e1_err.c: $(LIBKRB5_DIR)/error_tables/et-c-k5e1_err.c
+	$(call verbose_cmd,GEN,libkrb: $(notdir $@), cd $(LIBKRB5_DIR)/error_tables && mv -f $^ $@ && rm -f et-c-k5e1_err.et et-c-k5e1_err.h)
+
+$(LIBKRB5_DIR)/error_tables/et-c-kv5m_err.et: $(LIBKRB5_DIR)/error_tables/kv5m_err.et
+	$(call verbose_cmd,GEN,libkrb: $(notdir $@), cd $(LIBKRB5_DIR)/error_tables && rm -f et-c-kv5m_err.et et-c-kv5m_err.c et-c-kv5m_err.h && cp $^ $@)
+$(LIBKRB5_DIR)/error_tables/et-c-kv5m_err.c: $(LIBKRB5_DIR)/error_tables/et-c-kv5m_err.et
+	$(call verbose_cmd,GEN,libkrb: $(notdir $@), cd $(LIBKRB5_DIR)/error_tables && $(LIBKRB5_COMPILE_PATH)/compile_et -d $(LIBKRB5_COMPILE_PATH) --textdomain mit-krb5 $^)
+$(LIBKRB5_DIR)/error_tables/kv5m_err.c: $(LIBKRB5_DIR)/error_tables/et-c-kv5m_err.c
+	$(call verbose_cmd,GEN,libkrb: $(notdir $@), cd $(LIBKRB5_DIR)/error_tables && mv -f $^ $@ && rm -f et-c-kv5m_err.et et-c-kv5m_err.h)
+
+$(LIBKRB5_DIR)/error_tables/et-c-krb524_err.et: $(LIBKRB5_DIR)/error_tables/krb524_err.et
+	$(call verbose_cmd,GEN,libkrb: $(notdir $@), cd $(LIBKRB5_DIR)/error_tables && rm -f et-c-krb524_err.et et-c-krb524_err.c et-c-krb524_err.h && cp $^ $@)
+$(LIBKRB5_DIR)/error_tables/et-c-krb524_err.c: $(LIBKRB5_DIR)/error_tables/et-c-krb524_err.et
+	$(call verbose_cmd,GEN,libkrb: $(notdir $@), cd $(LIBKRB5_DIR)/error_tables && $(LIBKRB5_COMPILE_PATH)/compile_et -d $(LIBKRB5_COMPILE_PATH) --textdomain mit-krb5 $^)
+$(LIBKRB5_DIR)/error_tables/krb524_err.c: $(LIBKRB5_DIR)/error_tables/et-c-krb524_err.c
+	$(call verbose_cmd,GEN,libkrb: $(notdir $@), cd $(LIBKRB5_DIR)/error_tables && mv -f $^ $@ && rm -f et-c-krb524_err.et et-c-krb524_err.h)
+
+$(LIBKRB5_DIR)/error_tables/et-h-asn1_err.et: $(LIBKRB5_DIR)/error_tables/asn1_err.et
+	$(call verbose_cmd,GEN,libkrb: $(notdir $@), cd $(LIBKRB5_DIR)/error_tables && rm -f et-h-asn1_err.et et-h-asn1_err.c et-h-asn1_err.h && cp $^ $@)
+$(LIBKRB5_DIR)/error_tables/et-h-asn1_err.h: $(LIBKRB5_DIR)/error_tables/et-h-asn1_err.et
+	$(call verbose_cmd,GEN,libkrb: $(notdir $@), cd $(LIBKRB5_DIR)/error_tables && $(LIBKRB5_COMPILE_PATH)/compile_et -d $(LIBKRB5_COMPILE_PATH) --textdomain mit-krb5 $^)
+$(LIBKRB5_DIR)/error_tables/asn1_err.h: $(LIBKRB5_DIR)/error_tables/et-h-asn1_err.h
+	$(call verbose_cmd,GEN,libkrb: $(notdir $@), cd $(LIBKRB5_DIR)/error_tables && mv -f $^ $@ && rm -f et-h-asn1_err.et et-h-asn1_err.c)
+
+$(LIBKRB5_DIR)/error_tables/et-h-kdb5_err.et: $(LIBKRB5_DIR)/error_tables/kdb5_err.et
+	$(call verbose_cmd,GEN,libkrb: $(notdir $@), cd $(LIBKRB5_DIR)/error_tables && rm -f et-h-kdb5_err.et et-h-kdb5_err.c et-h-kdb5_err.h && cp $^ $@)
+$(LIBKRB5_DIR)/error_tables/et-h-kdb5_err.h: $(LIBKRB5_DIR)/error_tables/et-h-kdb5_err.et
+	$(call verbose_cmd,GEN,libkrb: $(notdir $@), cd $(LIBKRB5_DIR)/error_tables && $(LIBKRB5_COMPILE_PATH)/compile_et -d $(LIBKRB5_COMPILE_PATH) --textdomain mit-krb5 $^)
+$(LIBKRB5_DIR)/error_tables/kdb5_err.h: $(LIBKRB5_DIR)/error_tables/et-h-kdb5_err.h
+	$(call verbose_cmd,GEN,libkrb: $(notdir $@), cd $(LIBKRB5_DIR)/error_tables && mv -f $^ $@ && rm -f et-h-kdb5_err.et et-h-kdb5_err.c)
+
+$(LIBKRB5_DIR)/error_tables/et-h-krb5_err.et: $(LIBKRB5_DIR)/error_tables/krb5_err.et
+	$(call verbose_cmd,GEN,libkrb: $(notdir $@), cd $(LIBKRB5_DIR)/error_tables && rm -f et-h-krb5_err.et et-h-krb5_err.c et-h-krb5_err.h && cp $^ $@)
+$(LIBKRB5_DIR)/error_tables/et-h-krb5_err.h: $(LIBKRB5_DIR)/error_tables/et-h-krb5_err.et
+	$(call verbose_cmd,GEN,libkrb: $(notdir $@), cd $(LIBKRB5_DIR)/error_tables && $(LIBKRB5_COMPILE_PATH)/compile_et -d $(LIBKRB5_COMPILE_PATH) --textdomain mit-krb5 $^)
+$(LIBKRB5_DIR)/error_tables/krb5_err.h: $(LIBKRB5_DIR)/error_tables/et-h-krb5_err.h
+	$(call verbose_cmd,GEN,libkrb: $(notdir $@), cd $(LIBKRB5_DIR)/error_tables && mv -f $^ $@ && rm -f et-h-krb5_err.et et-h-krb5_err.c)
+
+$(LIBKRB5_DIR)/error_tables/et-h-k5e1_err.et: $(LIBKRB5_DIR)/error_tables/k5e1_err.et
+	$(call verbose_cmd,GEN,libkrb: $(notdir $@), cd $(LIBKRB5_DIR)/error_tables && rm -f et-h-k5e1_err.et et-h-k5e1_err.c et-h-k5e1_err.h && cp $^ $@)
+$(LIBKRB5_DIR)/error_tables/et-h-k5e1_err.h: $(LIBKRB5_DIR)/error_tables/et-h-k5e1_err.et
+	$(call verbose_cmd,GEN,libkrb: $(notdir $@), cd $(LIBKRB5_DIR)/error_tables && $(LIBKRB5_COMPILE_PATH)/compile_et -d $(LIBKRB5_COMPILE_PATH) --textdomain mit-krb5 $^)
+$(LIBKRB5_DIR)/error_tables/k5e1_err.h: $(LIBKRB5_DIR)/error_tables/et-h-k5e1_err.h
+	$(call verbose_cmd,GEN,libkrb: $(notdir $@), cd $(LIBKRB5_DIR)/error_tables && mv -f $^ $@ && rm -f et-h-k5e1_err.et et-h-k5e1_err.c)
+
+$(LIBKRB5_DIR)/error_tables/et-h-kv5m_err.et: $(LIBKRB5_DIR)/error_tables/kv5m_err.et
+	$(call verbose_cmd,GEN,libkrb: $(notdir $@), cd $(LIBKRB5_DIR)/error_tables && rm -f et-h-kv5m_err.et et-h-kv5m_err.c et-h-kv5m_err.h && cp $^ $@)
+$(LIBKRB5_DIR)/error_tables/et-h-kv5m_err.h: $(LIBKRB5_DIR)/error_tables/et-h-kv5m_err.et
+	$(call verbose_cmd,GEN,libkrb: $(notdir $@), cd $(LIBKRB5_DIR)/error_tables && $(LIBKRB5_COMPILE_PATH)/compile_et -d $(LIBKRB5_COMPILE_PATH) --textdomain mit-krb5 $^)
+$(LIBKRB5_DIR)/error_tables/kv5m_err.h: $(LIBKRB5_DIR)/error_tables/et-h-kv5m_err.h
+	$(call verbose_cmd,GEN,libkrb: $(notdir $@), cd $(LIBKRB5_DIR)/error_tables && mv -f $^ $@ && rm -f et-h-kv5m_err.et et-h-kv5m_err.c)
+
+$(LIBKRB5_DIR)/error_tables/et-h-krb524_err.et: $(LIBKRB5_DIR)/error_tables/krb524_err.et
+	$(call verbose_cmd,GEN,libkrb: $(notdir $@), cd $(LIBKRB5_DIR)/error_tables && rm -f et-h-krb524_err.et et-h-krb524_err.c et-h-krb524_err.h && cp $^ $@)
+$(LIBKRB5_DIR)/error_tables/et-h-krb524_err.h: $(LIBKRB5_DIR)/error_tables/et-h-krb524_err.et
+	$(call verbose_cmd,GEN,libkrb: $(notdir $@), cd $(LIBKRB5_DIR)/error_tables && $(LIBKRB5_COMPILE_PATH)/compile_et -d $(LIBKRB5_COMPILE_PATH) --textdomain mit-krb5 $^)
+$(LIBKRB5_DIR)/error_tables/krb524_err.h: $(LIBKRB5_DIR)/error_tables/et-h-krb524_err.h
+	$(call verbose_cmd,GEN,libkrb: $(notdir $@), cd $(LIBKRB5_DIR)/error_tables && mv -f $^ $@ && rm -f et-h-krb524_err.et et-h-krb524_err.c)
+
+$(LIBKRB5_MAINDIR)/util/profile/et-h-prof_err.et: $(LIBKRB5_MAINDIR)/util/profile/prof_err.et
+	$(call verbose_cmd,GEN,libkrb: $(notdir $@), cd $(LIBKRB5_MAINDIR)/util/profile && rm -f et-h-prof_err.et et-h-prof_err.c et-h-prof_err.h && cp $^ $@)
+$(LIBKRB5_MAINDIR)/util/profile/et-h-prof_err.h: $(LIBKRB5_MAINDIR)/util/profile/et-h-prof_err.et
+	$(call verbose_cmd,GEN,libkrb: $(notdir $@), cd $(LIBKRB5_MAINDIR)/util/profile && $(LIBKRB5_COMPILE_PATH)/compile_et -d $(LIBKRB5_COMPILE_PATH) --textdomain mit-krb5 $^)
+$(LIBKRB5_MAINDIR)/util/profile/prof_err.h: $(LIBKRB5_MAINDIR)/util/profile/et-h-prof_err.h
+	$(call verbose_cmd,GEN,libkrb: $(notdir $@), cd $(LIBKRB5_MAINDIR)/util/profile && mv -f $^ $@ && rm -f et-h-prof_err.et et-h-prof_err.c)
+
+# There are 2 camellia.c in the library, so we must differentiate them
+$(LIBKRB5CRYPTO_DIR)/builtin/enc_provider/enc_camellia.c: $(LIBKRB5CRYPTO_DIR)/builtin/enc_provider/camellia.c
+	$(call verbose_cmd,GEN,libkrb5crypto: $(notdir $@), cp $^ $@)
+
+LIBKRB5_DEPS = \
+	$(LIBKRB5_MAINDIR)/.configured \
+	$(LIBKRB5_MAINDIR)/include/osconf.h \
+	$(LIBKRB5_MAINDIR)/include/com_err.h \
+	$(LIBKRB5_COMPILE_PATH)/compile_et \
+	$(LIBKRB5_MAINDIR)/util/profile/prof_err.h \
+	$(LIBKRB5_MAINDIR)/include/profile.h \
+	$(LIBKRB5_DIR)/error_tables/krb524_err.c \
+	$(LIBKRB5_DIR)/error_tables/kv5m_err.c \
+	$(LIBKRB5_DIR)/error_tables/k5e1_err.c \
+	$(LIBKRB5_DIR)/error_tables/krb5_err.c \
+	$(LIBKRB5_DIR)/error_tables/kdb5_err.c \
+	$(LIBKRB5_DIR)/error_tables/asn1_err.c \
+	$(LIBKRB5_DIR)/error_tables/krb524_err.h \
+	$(LIBKRB5_DIR)/error_tables/kv5m_err.h \
+	$(LIBKRB5_DIR)/error_tables/k5e1_err.h \
+	$(LIBKRB5_DIR)/error_tables/krb5_err.h \
+	$(LIBKRB5_DIR)/error_tables/kdb5_err.h \
+	$(LIBKRB5_DIR)/error_tables/asn1_err.h \
+	$(LIBKRB5_MAINDIR)/include/krb5/krb5.h \
+	$(LIBKRB5CRYPTO_DIR)/builtin/enc_provider/enc_camellia.c \
+
+UK_PREPARE += $(LIBKRB5_DEPS)
diff --git a/include/byteswap.h b/include/byteswap.h
new file mode 100644
index 0000000..00b9df3
--- /dev/null
+++ b/include/byteswap.h
@@ -0,0 +1,26 @@
+#ifndef _BYTESWAP_H
+#define _BYTESWAP_H
+
+#include <features.h>
+#include <stdint.h>
+
+static __inline uint16_t __bswap_16(uint16_t __x)
+{
+	return __x<<8 | __x>>8;
+}
+
+static __inline uint32_t __bswap_32(uint32_t __x)
+{
+	return __x>>24 | __x>>8&0xff00 | __x<<8&0xff0000 | __x<<24;
+}
+
+static __inline uint64_t __bswap_64(uint64_t __x)
+{
+	return __bswap_32(__x)+0ULL<<32 | __bswap_32(__x>>32);
+}
+
+#define bswap_16(x) __bswap_16(x)
+#define bswap_32(x) __bswap_32(x)
+#define bswap_64(x) __bswap_64(x)
+
+#endif
-- 
2.25.1



From minios-devel-bounces@lists.xenproject.org Fri Aug 21 10:03:05 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Fri, 21 Aug 2020 10:03:05 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1k93t1-0005yF-4j; Fri, 21 Aug 2020 10:03:03 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=GXOG=B7=neclab.eu=simon.kuenzer@srs-us1.protection.inumbo.net>)
 id 1k93sz-0005yA-Tc
 for minios-devel@lists.xen.org; Fri, 21 Aug 2020 10:03:01 +0000
X-Inumbo-ID: 729f613f-ea0f-4d99-846e-8a633a1931a4
Received: from mailer1.neclab.eu (unknown [195.37.70.40])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 729f613f-ea0f-4d99-846e-8a633a1931a4;
 Fri, 21 Aug 2020 10:02:58 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
 by mailer1.neclab.eu (Postfix) with ESMTP id B1F70103F14;
 Fri, 21 Aug 2020 12:02:57 +0200 (CEST)
X-Virus-Scanned: Amavisd on Debian GNU/Linux (atlas-a.office.hd)
Received: from mailer1.neclab.eu ([127.0.0.1])
 by localhost (atlas-a.office.hd [127.0.0.1]) (amavisd-new, port 10024)
 with ESMTP id 62-1pWfkh8R3; Fri, 21 Aug 2020 12:02:57 +0200 (CEST)
X-ENC: Last-Hop-TLS-encrypted
X-ENC: Last-Hop-TLS-encrypted
Received: from puck.office.hd (puck.office.hd [192.168.24.91])
 (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
 (No client certificate requested)
 by mailer1.neclab.eu (Postfix) with ESMTPS id 8781A100BC3;
 Fri, 21 Aug 2020 12:02:57 +0200 (CEST)
Received: from [10.7.1.42] (192.168.24.96) by puck.office.hd (192.168.24.91)
 with Microsoft SMTP Server (version=TLS1_2,
 cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1979.3; Fri, 21 Aug
 2020 12:02:56 +0200
Subject: Re: [[UNIKRAFT RFC PATCH] v2 1/1] Implementation of isrlib string.c
To: <cristianvijelie@gmail.com>, <minios-devel@lists.xen.org>
References: <20200821075751.11116-1-cristianvijelie@gmail.com>
 <20200821075751.11116-2-cristianvijelie@gmail.com>
From: Simon Kuenzer <simon.kuenzer@neclab.eu>
Message-ID: <f2a83cad-771e-9b98-6677-a5c2748d4bbe@neclab.eu>
Date: Fri, 21 Aug 2020 12:02:55 +0200
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:68.0)
 Gecko/20100101 Thunderbird/68.11.0
MIME-Version: 1.0
In-Reply-To: <20200821075751.11116-2-cristianvijelie@gmail.com>
Content-Type: text/plain; charset="utf-8"; format=flowed
Content-Language: en-US
Content-Transfer-Encoding: 7bit
X-Originating-IP: [192.168.24.96]
X-ClientProxiedBy: puck.office.hd (192.168.24.91) To puck.office.hd
 (192.168.24.91)
X-BeenThere: minios-devel@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Mini-os development list <minios-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:minios-devel@lists.xenproject.org>
List-Help: <mailto:minios-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: minios-devel-bounces@lists.xenproject.org
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>

Hi Christian,

thanks a lot for the update. I would remove some functions from the 
library, especially the ones that are not thread- and reentrance-safe 
(use variables on stack only). Otherwise, it looks good. In the patch 
description you should briefly describe why you introduce this library 
and where you got the code from. As subject I would choose something like:
	lib/isrlib: Introduce libc-like interrupt-context-safe routines

Thanks,

Simon

On 21.08.20 09:57, cristianvijelie@gmail.com wrote:
> From: Cristian Vijelie <cristianvijelie@gmail.com>
> 
> Signed-off-by: Cristian Vijelie <cristianvijelie@gmail.com>
> ---
>   include/uk/isr/string.h |  76 +++++
>   lib/isrlib/Config.uk    |   7 +
>   lib/isrlib/Makefile.uk  |   3 +
>   lib/isrlib/string.c     | 633 ++++++++++++++++++++++++++++++++++++++++
>   4 files changed, 719 insertions(+)
>   create mode 100644 include/uk/isr/string.h
>   create mode 100644 lib/isrlib/Config.uk
>   create mode 100644 lib/isrlib/Makefile.uk
>   create mode 100644 lib/isrlib/string.c
> 
> diff --git a/include/uk/isr/string.h b/include/uk/isr/string.h
> new file mode 100644
> index 0000000..7ce9fea
> --- /dev/null
> +++ b/include/uk/isr/string.h
> @@ -0,0 +1,76 @@
> +/* SPDX-License-Identifier: BSD-3-Clause */
> +/*
> + * Authors: Simon Kuenzer <simon.kuenzer@neclab.eu>

You can add your name here, too.

> + *
> + *
> + * Copyright (c) 2017, NEC Europe Ltd., NEC Corporation. All rights reserved.
> + *

Probably you can add your university to the copyright too (depends on 
your university and if there is a contract). Do the same also for the 
license header in string.c.

> + * Redistribution and use in source and binary forms, with or without
> + * modification, are permitted provided that the following conditions
> + * are met:
> + *
> + * 1. Redistributions of source code must retain the above copyright
> + *    notice, this list of conditions and the following disclaimer.
> + * 2. Redistributions in binary form must reproduce the above copyright
> + *    notice, this list of conditions and the following disclaimer in the
> + *    documentation and/or other materials provided with the distribution.
> + * 3. Neither the name of the copyright holder nor the names of its
> + *    contributors may be used to endorse or promote products derived from
> + *    this software without specific prior written permission.
> + *
> + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
> + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
> + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
> + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
> + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
> + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
> + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
> + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
> + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
> + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
> + * POSSIBILITY OF SUCH DAMAGE.
> + *
> + */
> +
> +#ifndef __UK_ISR_STRING_H__
> +#define __UK_ISR_STRING_H__
> +
> +#ifdef __cplusplus
> +extern "C" {
> +#endif
> +
> +#include <string.h>
> +
> +void *memcpy_isr(void *dst, const void *src, size_t len);
> +void *memset_isr(void *ptr, int val, size_t len);
> +void *memchr_isr(const void *ptr, int val, size_t len);
> +void *memrchr_isr(const void *m, int c, size_t n);
> +int memcmp_isr(const void *ptr1, const void *ptr2, size_t len);
> +void *memmove_isr(void *dst, const void *src, size_t len);
> +
> +char *strncpy_isr(char *dst, const char *src, size_t len);
> +char *strcpy_isr(char *dst, const char *src);
> +size_t strlcpy_isr(char *d, const char *s, size_t n);
> +size_t strlcat_isr(char *d, const char *s, size_t n);
> +size_t strnlen_isr(const char *str, size_t maxlen);
> +size_t strlen_isr(const char *str);
> +char *strchrnul_isr(const char *s, int c);
> +char *strchr_isr(const char *str, int c);
> +char *strrchr_isr(const char *s, int c);
> +int strncmp_isr(const char *str1, const char *str2, size_t len);
> +int strcmp_isr(const char *str1, const char *str2);
> +size_t strcspn_isr(const char *s, const char *c);
> +size_t strspn_isr(const char *s, const char *c);

Functions that depend on a global variable are a bad idea for being 
interrupt-context-safe (breaks thread-safety, reentrancy property). For 
interrupts this will break as soon as we support SMP or have nested 
interrupts. Please remove those functions from the lib. As far as I 
briefly see, this is at least true for strtok_isr() and strerror_isr(). 
You could then rename strtok_isr_r() to strtok_isr().

> +char *strtok_isr(char *restrict s, const char *restrict sep);
> +char *strtok_isr_r(char *restrict s, const char *restrict sep, char **restrict p);

Please, also remove any function that uses malloc (like these two). It 
is in general not recommended to alloc memory during interrupt context. 
Since we can swap allocators, you don't know if malloc is 
interrupt-context-safe. All your functions in the isrlib should not call 
any library-external function, otherwise they are not 
interrupt-context-safe anymore. In general, I was thinking if we could 
do an offline analysis by using a function call tree in order to make 
sure that our interrupt handlers fulfill the properties...

> +char *strndup_isr(const char *str, size_t len);
> +char *strdup_isr(const char *str);
> +

I think strerror is not needed at all. This is done for formatting an 
error message which is in general not a good idea to do within interrupt 
context. I would remove them. We also do not want to keep maintaining 
two error number lists (nolibc):

> +char *strerror_isr_r(int errnum, char *buf, size_t buflen);
> +char *strerror_isr(int errnum);
> +
> +#ifdef __cplusplus
> +}
> +#endif
> +
> +#endif /* __UK_ISR_STRING_H__ */
> diff --git a/lib/isrlib/Config.uk b/lib/isrlib/Config.uk
> new file mode 100644
> index 0000000..c6be13c
> --- /dev/null
> +++ b/lib/isrlib/Config.uk
> @@ -0,0 +1,7 @@
> +menuconfig LIBISRLIB
> +    bool "isrlib: ISR helper library"
> +    default n
> +

Since we do not have any options - and I do not expect any for now, use 
`config` instead of `menuconfig`. The if-case can be removed.

> +if LIBISRLIB
> +
> +endif
> diff --git a/lib/isrlib/Makefile.uk b/lib/isrlib/Makefile.uk
> new file mode 100644
> index 0000000..df3616d
> --- /dev/null
> +++ b/lib/isrlib/Makefile.uk
> @@ -0,0 +1,3 @@
> +$(eval $(call addlib_s,libisrlib,$(CONFIG_LIBISRLIB)))
> +
> +LIBISRLIB_SRCS-y += $(LIBISRLIB_BASE)/string.c|isr

I think you need to add the library include folder to the glocal C and 
C++ scope.

> diff --git a/lib/isrlib/string.c b/lib/isrlib/string.c
> new file mode 100644
> index 0000000..6cb0981
> --- /dev/null
> +++ b/lib/isrlib/string.c
> @@ -0,0 +1,633 @@

Please keep the license headers in string.c. Copy them from nolibc and 
add your name and your university as mentioned to string.h.

> +#include <uk/isr/string.h>

You can remove this comment:

> +/* I included types.h because VSCode was complaining that __u8 and other
> + * types are not defined, but the build is succesfull without it.
> + */
> +#include <uk/arch/types.h>
> +#include <stdint.h>
> +#include <limits.h>

Is errno still needed?:

> +#include <errno.h>
> +
> +void *memcpy_isr(void *dst, const void *src, size_t len)
> +{
> +	size_t p;
> +
> +	for (p = 0; p < len; ++p)
> +		*((__u8 *)(((__uptr)dst) + p)) = *((__u8 *)(((__uptr)src) + p));
> +
> +	return dst;
> +}
> +
> +void *memset_isr(void *ptr, int val, size_t len)
> +{
> +	__u8 *p = (__u8 *) ptr;
> +
> +	for (; len > 0; --len)
> +		*(p++) = (__u8)val;
> +
> +	return ptr;
> +}
> +
> +void *memchr_isr(const void *ptr, int val, size_t len)
> +{
> +	uintptr_t o = 0;
> +
> +	for (o = 0; o < (uintptr_t)len; ++o)
> +		if (*((const uint8_t *)(((uintptr_t)ptr) + o)) == (uint8_t)val)
> +			return (void *)((uintptr_t)ptr + o);
> +
> +	return NULL; /* did not find val */
> +}
> +
> +void *memrchr_isr(const void *m, int c, size_t n)
> +{
> +	const unsigned char *s = m;
> +
> +	c = (unsigned char) c;
> +	while (n--)
> +		if (s[n] == c)
> +			return (void *) (s + n);
> +	return 0;
> +}
> +
> +void *memmove_isr(void *dst, const void *src, size_t len)
> +{
> +	uint8_t *d = dst;
> +	const uint8_t *s = src;
> +
> +	if (src > dst) {
> +		for (; len > 0; --len)
> +			*(d++) = *(s++);
> +	} else {
> +		s += len;
> +		d += len;
> +
> +		for (; len > 0; --len)
> +			*(d--) = *(s--);
> +	}
> +
> +	return dst;
> +}
> +
> +int memcmp_isr(const void *ptr1, const void *ptr2, size_t len)
> +{
> +	const unsigned char *c1 = (const unsigned char *)ptr1;
> +	const unsigned char *c2 = (const unsigned char *)ptr2;
> +
> +	for (; len > 0; --len, ++c1, ++c2) {
> +		if ((*c1) != (*c2))
> +			return ((*c1) - (*c2));
> +	}
> +
> +	return 0;
> +}
> +
> +size_t strlen_isr(const char *str)
> +{
> +	return strnlen_isr(str, SIZE_MAX);
> +}
> +
> +size_t strnlen_isr(const char *str, size_t len)
> +{
> +	const char *p = memchr_isr(str, 0, len);
> +	return p ? (size_t) (p - str) : len;
> +}
> +
> +char *strncpy_isr(char *dst, const char *src, size_t len)
> +{
> +	size_t clen;
> +
> +	clen = strnlen_isr(src, len);
> +	memcpy_isr(dst, src, clen);
> +
> +	/* instead of filling up the rest of left space with zeros,
> +	 * append a termination character if we did not copy one
> +	 */
> +	if (clen < len && dst[clen - 1] != '\0')
> +		dst[clen] = '\0';
> +	return dst;
> +}
> +
> +char *strcpy_isr(char *dst, const char *src)
> +{
> +	return strncpy_isr(dst, src, SIZE_MAX);
> +}
> +
> +int strncmp_isr(const char *str1, const char *str2, size_t len)
> +{
> +	const char *c1 = (const char *)str1;
> +	const char *c2 = (const char *)str2;
> +
> +	for (; len > 0; --len, ++c1, ++c2) {
> +		if ((*c1) != (*c2))
> +			return (int)((*c1) - (*c2));
> +		if ((*c1) == '\0')
> +			break;
> +	}
> +	return 0;
> +}
> +
> +int strcmp_isr(const char *str1, const char *str2)
> +{
> +	register signed char __res;
> +
> +	while ((__res = *str1 - *str2++) == 0 && *str1++)
> +		;
> +
> +	return __res;
> +}
> +
> +/* The following code is taken from musl libc */
> +#define ALIGN (sizeof(size_t))
> +#define ONES ((size_t) -1 / UCHAR_MAX)
> +#define HIGHS (ONES * (UCHAR_MAX / 2 + 1))
> +#define HASZERO(x) (((x) - ONES) & ~(x) & HIGHS)
> +#define BITOP(a, b, op) \
> +		((a)[(size_t)(b) / (8*sizeof *(a))] op \
> +		(size_t)1 << ((size_t)(b) % (8 * sizeof *(a))))
> +
> +char *strchrnul_isr(const char *s, int c)
> +{
> +	size_t *w, k;
> +
> +	c = (unsigned char)c;
> +	if (!c)
> +		return (char *)s + strlen_isr(s);
> +
> +	for (; (uintptr_t)s % ALIGN; s++)
> +		if (!*s || *(unsigned char *)s == c)
> +			return (char *)s;
> +	k = ONES * c;
> +	for (w = (void *)s; !HASZERO(*w) && !HASZERO(*w ^ k); w++)
> +		;
> +	for (s = (void *)w; *s && *(unsigned char *)s != c; s++)
> +		;
> +	return (char *)s;
> +}
> +
> +char *strchr_isr(const char *str, int c)
> +{
> +	char *r = strchrnul_sr(str, c);
> +	return *(unsigned char *)r == (unsigned char)c ? r : 0;
> +}
> +
> +char *strrchr_isr(const char *s, int c)
> +{
> +	return memrchr_isr(s, c, strlen_isr(s) + 1);
> +}
> +
> +size_t strcspn_isr(const char *s, const char *c)
> +{
> +	const char *a = s;
> +	size_t byteset[32 / sizeof(size_t)];
> +
> +	if (!c[0] || !c[1])
> +		return strchrnul_isr(s, *c)-a;
> +
> +	memset_isr(byteset, 0, sizeof(byteset));
> +	for (; *c && BITOP(byteset, *(unsigned char *)c, |=); c++)
> +		;
> +	for (; *s && !BITOP(byteset, *(unsigned char *)s, &); s++)
> +		;
> +	return s-a;
> +}
> +
> +size_t strspn_isr(const char *s, const char *c)
> +{
> +	const char *a = s;
> +	size_t byteset[32 / sizeof(size_t)] = { 0 };
> +
> +	if (!c[0])
> +		return 0;
> +	if (!c[1]) {
> +		for (; *s == *c; s++)
> +			;
> +		return s-a;
> +	}
> +
> +	for (; *c && BITOP(byteset, *(unsigned char *)c, |=); c++)
> +		;
> +	for (; *s && BITOP(byteset, *(unsigned char *)s, &); s++)
> +		;
> +	return s-a;
> +}
> +
> +char *strtok_isr(char *restrict s, const char *restrict sep)
> +{
> +	static char *p;
> +
> +	if (!s && !(s = p))
> +		return NULL;
> +	s += strspn_isr(s, sep);
> +	if (!*s)
> +		return p = 0;
> +	p = s + strcspn_isr(s, sep);
> +	if (*p)
> +		*p++ = 0;
> +	else
> +		p = 0;
> +	return s;
> +}
> +
> +char *strtok_isr_r(char *restrict s, const char *restrict sep, char **restrict p)
> +{
> +	if (!s && !(s = *p))
> +		return NULL;
> +	s += strspn_isr(s, sep);
> +	if (!*s)
> +		return *p = 0;
> +	*p = s + strcspn_isr(s, sep);
> +	if (**p)
> +		*(*p)++ = 0;
> +	else
> +		*p = 0;
> +	return s;
> +}
> +
> +char *strndup_isr(const char *str, size_t len)
> +{
> +	char *__res;
> +	int __len;
> +
> +	__len = strnlen(str, len);
> +
> +	__res = malloc(__len + 1);
> +	if (__res) {
> +		memcpy(__res, str, __len);
> +		__res[__len] = '\0';
> +	}
> +
> +	return __res;
> +}
> +
> +char *strdup_isr(const char *str)
> +{
> +	return strndup_isr(str, SIZE_MAX);
> +}
> +
> +/* strlcpy has different ALIGN */
> +#undef ALIGN
> +#define ALIGN (sizeof(size_t)-1)
> +size_t strlcpy_isr(char *d, const char *s, size_t n)
> +{
> +	char *d0 = d;
> +	size_t *wd;
> +	const size_t *ws;
> +
> +	if (!n--)
> +		goto finish;
> +
> +	if (((uintptr_t)s & ALIGN) == ((uintptr_t)d & ALIGN)) {
> +		for (; ((uintptr_t) s & ALIGN) && n && (*d = *s);
> +		     n--, s++, d++)
> +			;
> +
> +		if (n && *s) {
> +			wd = (void *)d; ws = (const void *)s;
> +			for (; n >= sizeof(size_t) && !HASZERO(*ws);
> +			     n -= sizeof(size_t), ws++, wd++)
> +				*wd = *ws;
> +
> +			d = (void *)wd; s = (const void *)ws;
> +		}
> +	}
> +
> +	for (; n && (*d = *s); n--, s++, d++)
> +		;
> +	*d = 0;
> +finish:
> +	return d-d0 + strlen_isr(s);
> +}
> +
> +size_t strlcat_isr(char *d, const char *s, size_t n)
> +{
> +	size_t l = strnlen_isr(d, n);
> +	if (l == n)
> +		return l + strlen_isr(s);
> +	return l + strlcpy_isr(d+l, s, n-l);
> +}
> +
> +/* GNU-specific version of strerror_r */
> +char *strerror_isr_r(int errnum, char *buf, size_t buflen)
> +{
> +	const char *strerr;
> +
> +	switch (errnum) {
> +	case EPERM:
> +		strerr = "Operation not permitted";
> +		break;
> +	case ENOENT:
> +		strerr = "No such file or directory";
> +		break;
> +	case ESRCH:
> +		strerr = "No such process";
> +		break;
> +	case EINTR:
> +		strerr = "Interrupted system call";
> +		break;
> +	case EIO:
> +		strerr = "Input/output error";
> +		break;
> +	case ENXIO:
> +		strerr = "Device not configured";
> +		break;
> +	case E2BIG:
> +		strerr = "Argument list too long";
> +		break;
> +	case ENOEXEC:
> +		strerr = "Exec format error";
> +		break;
> +	case EBADF:
> +		strerr = "Bad file descriptor";
> +		break;
> +	case ECHILD:
> +		strerr = "No child processes";
> +		break;
> +	case EDEADLK:
> +		strerr = "Resource deadlock avoided";
> +		break;
> +	case ENOMEM:
> +		strerr = "Cannot allocate memory";
> +		break;
> +	case EACCES:
> +		strerr = "Permission denied";
> +		break;
> +	case EFAULT:
> +		strerr = "Bad address";
> +		break;
> +	case ENOTBLK:
> +		strerr = "Block device required";
> +		break;
> +	case EBUSY:
> +		strerr = "Device busy";
> +		break;
> +	case EEXIST:
> +		strerr = "File exists";
> +		break;
> +	case EXDEV:
> +		strerr = "Cross-device link";
> +		break;
> +	case ENODEV:
> +		strerr = "Operation not supported by device";
> +		break;
> +	case ENOTDIR:
> +		strerr = "Not a directory";
> +		break;
> +	case EISDIR:
> +		strerr = "Is a directory";
> +		break;
> +	case EINVAL:
> +		strerr = "Invalid argument";
> +		break;
> +	case ENFILE:
> +		strerr = "Too many open files in system";
> +		break;
> +	case EMFILE:
> +		strerr = "Too many open files";
> +		break;
> +	case ENOTTY:
> +		strerr = "Inappropriate ioctl for device";
> +		break;
> +	case ETXTBSY:
> +		strerr = "Text file busy";
> +		break;
> +	case EFBIG:
> +		strerr = "File too large";
> +		break;
> +	case ENOSPC:
> +		strerr = "No space left on device";
> +		break;
> +	case ESPIPE:
> +		strerr = "Illegal seek";
> +		break;
> +	case EROFS:
> +		strerr = "Read-only file system";
> +		break;
> +	case EMLINK:
> +		strerr = "Too many links";
> +		break;
> +	case EPIPE:
> +		strerr = "Broken pipe";
> +		break;
> +	case EDOM:
> +		strerr = "Numerical argument out of domain";
> +		break;
> +	case ERANGE:
> +		strerr = "Result too large";
> +		break;
> +	case EAGAIN:
> +		strerr = "Resource temporarily unavailable";
> +		break;
> +	case EINPROGRESS:
> +		strerr = "Operation now in progress";
> +		break;
> +	case EALREADY:
> +		strerr = "Operation already in progress";
> +		break;
> +	case ENOTSOCK:
> +		strerr = "Socket operation on non-socket";
> +		break;
> +	case EDESTADDRREQ:
> +		strerr = "Destination address required";
> +		break;
> +	case EMSGSIZE:
> +		strerr = "Message too long";
> +		break;
> +	case EPROTOTYPE:
> +		strerr = "Protocol wrong type for socket";
> +		break;
> +	case ENOPROTOOPT:
> +		strerr = "Protocol not available";
> +		break;
> +	case EPROTONOSUPPORT:
> +		strerr = "Protocol not supported";
> +		break;
> +	case ESOCKTNOSUPPORT:
> +		strerr = "Socket type not supported";
> +		break;
> +	case EOPNOTSUPP:
> +		strerr = "Operation not supported on socket";
> +		break;
> +	case EPFNOSUPPORT:
> +		strerr = "Protocol family not supported";
> +		break;
> +	case EAFNOSUPPORT:
> +		strerr = "Address family not supported by protocol family";
> +		break;
> +	case EADDRINUSE:
> +		strerr = "Address already in use";
> +		break;
> +	case EADDRNOTAVAIL:
> +		strerr = "Can't assign requested address";
> +		break;
> +	case ENETDOWN:
> +		strerr = "Network is down";
> +		break;
> +	case ENETUNREACH:
> +		strerr = "Network is unreachable";
> +		break;
> +	case ENETRESET:
> +		strerr = "Network dropped connection on reset";
> +		break;
> +	case ECONNABORTED:
> +		strerr = "Software caused connection abort";
> +		break;
> +	case ECONNRESET:
> +		strerr = "Connection reset by peer";
> +		break;
> +	case ENOBUFS:
> +		strerr = "No buffer space available";
> +		break;
> +	case EISCONN:
> +		strerr = "Socket is already connected";
> +		break;
> +	case ENOTCONN:
> +		strerr = "Socket is not connected";
> +		break;
> +	case ESHUTDOWN:
> +		strerr = "Can't send after socket shutdown";
> +		break;
> +	case ETIMEDOUT:
> +		strerr = "Operation timed out";
> +		break;
> +	case ECONNREFUSED:
> +		strerr = "Connection refused";
> +		break;
> +	case ELOOP:
> +		strerr = "Too many levels of symbolic links";
> +		break;
> +	case ENAMETOOLONG:
> +		strerr = "File name too long";
> +		break;
> +	case EHOSTDOWN:
> +		strerr = "Host is down";
> +		break;
> +	case EHOSTUNREACH:
> +		strerr = "No route to host";
> +		break;
> +	case ENOTEMPTY:
> +		strerr = "Directory not empty";
> +		break;
> +	case EPROCLIM:
> +		strerr = "Too many processes";
> +		break;
> +	case EUSERS:
> +		strerr = "Too many users";
> +		break;
> +	case EDQUOT:
> +		strerr = "Disc quota exceeded";
> +		break;
> +	case ESTALE:
> +		strerr = "Stale NFS file handle";
> +		break;
> +	case EBADRPC:
> +		strerr = "RPC struct is bad";
> +		break;
> +	case ERPCMISMATCH:
> +		strerr = "RPC version wrong";
> +		break;
> +	case EPROGUNAVAIL:
> +		strerr = "RPC prog";
> +		break;
> +	case EPROGMISMATCH:
> +		strerr = "Program version wrong";
> +		break;
> +	case EPROCUNAVAIL:
> +		strerr = "Bad procedure for program";
> +		break;
> +	case ENOLCK:
> +		strerr = "No locks available";
> +		break;
> +	case ENOSYS:
> +		strerr = "Function not implemented";
> +		break;
> +	case EFTYPE:
> +		strerr = "Inappropriate file type or format";
> +		break;
> +	case EAUTH:
> +		strerr = "Authentication error";
> +		break;
> +	case ENEEDAUTH:
> +		strerr = "Need authenticator";
> +		break;
> +	case EIDRM:
> +		strerr = "Identifier removed";
> +		break;
> +	case ENOMSG:
> +		strerr = "No message of desired type";
> +		break;
> +	case EOVERFLOW:
> +		strerr = "Value too large to be stored in data type";
> +		break;
> +	case ECANCELED:
> +		strerr = "Operation canceled";
> +		break;
> +	case EILSEQ:
> +		strerr = "Illegal byte sequence";
> +		break;
> +	case ENOATTR:
> +		strerr = "Attribute not found";
> +		break;
> +	case EDOOFUS:
> +		strerr = "Programming error";
> +		break;
> +	case EBADMSG:
> +		strerr = "Bad message";
> +		break;
> +	case EMULTIHOP:
> +		strerr = "Multihop attempted";
> +		break;
> +	case ENOLINK:
> +		strerr = "Link has been severed";
> +		break;
> +	case EPROTO:
> +		strerr = "Protocol error";
> +		break;
> +	case ENOTCAPABLE:
> +		strerr = "Capabilities insufficient";
> +		break;
> +	case ECAPMODE:
> +		strerr = "Not permitted in capability mode";
> +		break;
> +	case ENOTRECOVERABLE:
> +		strerr = "State not recoverable";
> +		break;
> +	case EOWNERDEAD:
> +		strerr = "Previous owner died";
> +		break;
> +	case ENOTSUP:
> +		strerr = "Not supported";
> +		break;
> +	default:
> +		strerr = NULL;
> +		errno = EINVAL; /* Unknown errnum requires errno to be set */
> +		break;
> +	}
> +
> +	if (!buflen)
> +		return buf;
> +
> +	/*
> +	 * NOTE: If target buffer is too small, we are supposed to set
> +	 *       errno to ERANGE. We ignore this case for simplification.
> +	 */
> +	if (strerr)
> +		strncpy_isr(buf, strerr, buflen);
> +	else
> +		snprintf_isr(buf, buflen, "Unknown error %d", errnum);
> +
> +	/* ensure null termination */
> +	buf[buflen - 1] = '\0';
> +	return buf;
> +}
> +
> +/* NOTE: strerror() is not thread-safe, nor reentrant-safe */
> +char *strerror_isr(int errnum)
> +{
> +	/* NOTE: Our longest message is currently 48 characters. With
> +	 *       64 characters we should have room for minor changes
> +	 *       in the future.
> +	 */
> +	static char buf[64];
> +
> +	return strerror_isr_r(errnum, buf, sizeof(buf));
> +}
> 


From minios-devel-bounces@lists.xenproject.org Fri Aug 21 10:07:19 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Fri, 21 Aug 2020 10:07:19 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1k93x9-00064H-Gt; Fri, 21 Aug 2020 10:07:19 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=GXOG=B7=neclab.eu=simon.kuenzer@srs-us1.protection.inumbo.net>)
 id 1k93x8-00064C-Pt
 for minios-devel@lists.xen.org; Fri, 21 Aug 2020 10:07:18 +0000
X-Inumbo-ID: 183bf228-7ce1-442e-a69a-422d6ce5be78
Received: from mailer2.neclab.eu (unknown [195.37.70.41])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 183bf228-7ce1-442e-a69a-422d6ce5be78;
 Fri, 21 Aug 2020 10:07:17 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
 by mailer2.neclab.eu (Postfix) with ESMTP id 5FC6BF201B;
 Fri, 21 Aug 2020 12:07:16 +0200 (CEST)
X-Virus-Scanned: Amavisd on Debian GNU/Linux (atlas-b.office.hd)
Received: from mailer2.neclab.eu ([127.0.0.1])
 by localhost (atlas-b.office.hd [127.0.0.1]) (amavisd-new, port 10024)
 with ESMTP id CWyx72N_t9ch; Fri, 21 Aug 2020 12:07:16 +0200 (CEST)
X-ENC: Last-Hop-TLS-encrypted
X-ENC: Last-Hop-TLS-encrypted
Received: from puck.office.hd (puck.office.hd [192.168.24.91])
 (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
 (No client certificate requested)
 by mailer2.neclab.eu (Postfix) with ESMTPS id 2FC00F2005;
 Fri, 21 Aug 2020 12:07:12 +0200 (CEST)
Received: from [10.7.1.42] (192.168.24.96) by puck.office.hd (192.168.24.91)
 with Microsoft SMTP Server (version=TLS1_2,
 cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1979.3; Fri, 21 Aug
 2020 12:07:11 +0200
Subject: Re: [UNIKRAFT PATCH v4 01/12] plat/drivers/virtio: Fill MTU and
 queues alignments when retrieving information
To: Costin Lupu <costin.lupu@cs.pub.ro>, <minios-devel@lists.xen.org>
CC: <sharan.santhanam@neclab.eu>
References: <20200813085342.29799-1-costin.lupu@cs.pub.ro>
 <20200813085342.29799-2-costin.lupu@cs.pub.ro>
 <c246a0fb-3c90-48ce-9bd2-333034f9ebb3@neclab.eu>
 <8a093944-29d7-93ab-f612-f68a742d0e47@cs.pub.ro>
From: Simon Kuenzer <simon.kuenzer@neclab.eu>
Message-ID: <dbdd84bd-c718-65d8-1ab5-ff09324e4783@neclab.eu>
Date: Fri, 21 Aug 2020 12:07:10 +0200
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:68.0)
 Gecko/20100101 Thunderbird/68.11.0
MIME-Version: 1.0
In-Reply-To: <8a093944-29d7-93ab-f612-f68a742d0e47@cs.pub.ro>
Content-Type: text/plain; charset="utf-8"; format=flowed
Content-Language: en-US
Content-Transfer-Encoding: 8bit
X-Originating-IP: [192.168.24.96]
X-ClientProxiedBy: oberon.office.hd (192.168.24.90) To puck.office.hd
 (192.168.24.91)
X-BeenThere: minios-devel@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Mini-os development list <minios-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:minios-devel@lists.xenproject.org>
List-Help: <mailto:minios-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: minios-devel-bounces@lists.xenproject.org
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>

On 21.08.20 11:18, Costin Lupu wrote:
> On 8/20/20 6:47 PM, Simon Kuenzer wrote:
>> Wouldn't this patch go independently to netfront? I do not see the
>> relation...
>>
> 
> Yes, this can be pushed separately. It's in the series because it's a
> longer story behind. Sharan reviewed its previous version and it would
> make sense if he would review the current one as well.
> 
Thanks for the explanation. I leave it up you and Sharan how to handle it.

>> On 13.08.20 10:53, Costin Lupu wrote:
>>> This patch sets the max MTU value when retrieving device information
>>> and the
>>> alignments used when allocating packets for each queue.
>>>
>>> Signed-off-by: Costin Lupu <costin.lupu@cs.pub.ro>
>>> ---
>>>  Â  plat/drivers/virtio/virtio_net.c | 3 +++
>>>  Â  1 file changed, 3 insertions(+)
>>>
>>> diff --git a/plat/drivers/virtio/virtio_net.c
>>> b/plat/drivers/virtio/virtio_net.c
>>> index b0663e60..0e748b8f 100644
>>> --- a/plat/drivers/virtio/virtio_net.c
>>> +++ b/plat/drivers/virtio/virtio_net.c
>>> @@ -770,6 +770,7 @@ static int virtio_netdev_rxq_info_get(struct
>>> uk_netdev *dev,
>>>  Â Â Â Â Â  rxq = &vndev->rxqs[queue_id];
>>>  Â Â Â Â Â  qinfo->nb_min = 1;
>>>  Â Â Â Â Â  qinfo->nb_max = rxq->max_nb_desc;
>>> +Â Â Â  qinfo->nb_align = sizeof(void *); /* word size alignment */
>>
>> @Costin, @Sharan: Does changing the alignment something good or bad to
>> the virtio performance? I guess it does not harm. 0 meant that there is
>> no alignment requirement for network packet buffers.
>>
> 
> Word size alignment is better than no alignment. Given that you want
> some performance, I don't think you'd be happy with no alignment. Btw,
> with the buddy allocator all unaligned allocations do return (at least)
> word size aligned addresses.

In general, I agree and would do the same. I just wanted to confirm the 
fact since Sharan was working heavily on virtio-net performance. His 
changes need to go upstream still.

> 
>>>  Â Â Â Â Â  qinfo->nb_is_power_of_two = 1;
>>>  Â  Â  exit:
>>> @@ -797,6 +798,7 @@ static int virtio_netdev_txq_info_get(struct
>>> uk_netdev *dev,
>>>  Â Â Â Â Â  txq = &vndev->txqs[queue_id];
>>>  Â Â Â Â Â  qinfo->nb_min = 1;
>>>  Â Â Â Â Â  qinfo->nb_max = txq->max_nb_desc;
>>> +Â Â Â  qinfo->nb_align = sizeof(void *); /* word size alignment */
>>
>> @Costin, @Sharan: ...same here.
>>
>>>  Â Â Â Â Â  qinfo->nb_is_power_of_two = 1;
>>>  Â  Â  exit:
>>> @@ -1048,6 +1050,7 @@ static void virtio_net_info_get(struct uk_netdev
>>> *dev,
>>>  Â  Â Â Â Â Â  dev_info->max_rx_queues = vndev->max_vqueue_pairs;
>>>  Â Â Â Â Â  dev_info->max_tx_queues = vndev->max_vqueue_pairs;
>>> +Â Â Â  dev_info->max_mtu = vndev->max_mtu;
>>
>> I agree, this should be announced.
>>
>>>  Â Â Â Â Â  dev_info->nb_encap_tx = sizeof(struct virtio_net_hdr_padded);
>>>  Â Â Â Â Â  dev_info->nb_encap_rx = sizeof(struct virtio_net_hdr_padded);
>>>  Â Â Â Â Â  dev_info->features = UK_FEATURE_RXQ_INTR_AVAILABLE;
>>>
>>

Thanks,

Simon


From minios-devel-bounces@lists.xenproject.org Fri Aug 21 10:27:17 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Fri, 21 Aug 2020 10:27:17 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1k94GR-00088J-E3; Fri, 21 Aug 2020 10:27:15 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=50MG=B7=gmail.com=cristianvijelie@srs-us1.protection.inumbo.net>)
 id 1k94GQ-00088E-Ba
 for minios-devel@lists.xen.org; Fri, 21 Aug 2020 10:27:14 +0000
X-Inumbo-ID: a3b7d8ba-34e2-4e67-a62a-37623e2ab357
Received: from mail-ed1-x544.google.com (unknown [2a00:1450:4864:20::544])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id a3b7d8ba-34e2-4e67-a62a-37623e2ab357;
 Fri, 21 Aug 2020 10:27:13 +0000 (UTC)
Received: by mail-ed1-x544.google.com with SMTP id w2so998998edv.7
 for <minios-devel@lists.xen.org>; Fri, 21 Aug 2020 03:27:13 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=from:to:subject:date:message-id:mime-version
 :content-transfer-encoding;
 bh=Jy9DTWK1BlVRjPTistUXEanuCsBE9XYq7iyLMHXqKCo=;
 b=G2aFtCghbBCUA97D72PgIjk/Jzy6I2KnWj+5L/Y3vmtCozXwmeSNylq6MEJSbPHYc4
 ixsT3ipWvd1c9aibiLGsD0Vle+F5qeTwaxg9egYEsCPEgH0dzpUwObQ3DnCle0Awd0ZG
 FKYueQHwXWEF2EUaPB3ausHCMMa4iyY36IS5jWYdirbs0xsPP5aoBmq7eJ2zBq0jy0Iz
 582aGtcOsGs7hKcpzYVXtQarsgO9smODGs4j5cI2iv3qpG8kcH49zX7S4ifU8d8HoGmy
 bKQQZrz1I2Jc5HTUFkziGRbvApCwNCpxIcjOoz1htADJcdj1aclo1MXC/jg9V0L9VH29
 AQTg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:to:subject:date:message-id:mime-version
 :content-transfer-encoding;
 bh=Jy9DTWK1BlVRjPTistUXEanuCsBE9XYq7iyLMHXqKCo=;
 b=V5yzmZTdW3meEk+3D3VzeYUDwxn4/zZY4ISYapnPT9Js31SgVCALgaCxO1TFxUMygS
 aQEvesB62NR3VR2OiCwFSRZ6UP0PzqU85SvX73BvDt8vGqVoIW2RbVds2HUEsj7mQnXK
 oJNFcXV2Qn9vixDgH19ldyYNwhiKFhVySX+Bkg2Ak9S096dDTAstv9W5h73FM/hiHLL6
 JtrmSYJpdKokD0LG1XdR5AmIx8MyYN9RBIokxIBoxWY1ZK1dJVxGSrU39aRxZ0oOLAzI
 h0SMMoR/ts6avLIJVg2d3xpykyCBXr3bV5ltnnyKfgfzCwT/oUznQjEp5BUByxNTjhLP
 luMA==
X-Gm-Message-State: AOAM533FUrtRSPFcnNn2r3wB2UW+YIkYXiGOwWGTa3k8uuHllUnyMoxu
 rLUYR6w2AjzjVTxYbLCYbASqQswdwzo=
X-Google-Smtp-Source: ABdhPJwQxIw29gVg17bEzNQ3clWMHxFWV1/z9p/sQWFzxP5tHoau+Nz8C9s0lKQh2fMdUeRkfUGHpQ==
X-Received: by 2002:a05:6402:1f0:: with SMTP id
 i16mr1928658edy.309.1598005632244; 
 Fri, 21 Aug 2020 03:27:12 -0700 (PDT)
Received: from localhost.localdomain ([82.137.12.155])
 by smtp.gmail.com with ESMTPSA id k6sm1021222ejg.81.2020.08.21.03.27.10
 for <minios-devel@lists.xen.org>
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Fri, 21 Aug 2020 03:27:11 -0700 (PDT)
From: cristianvijelie@gmail.com
To: minios-devel@lists.xen.org
Subject: [[UNIKRAFT/LIBNETTLE PATCH] v2 0/2] Porting of the Nettle crypto
 library
Date: Fri, 21 Aug 2020 13:27:06 +0300
Message-Id: <20200821102708.48922-1-cristianvijelie@gmail.com>
X-Mailer: git-send-email 2.25.1
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-BeenThere: minios-devel@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Mini-os development list <minios-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:minios-devel@lists.xenproject.org>
List-Help: <mailto:minios-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: minios-devel-bounces@lists.xenproject.org
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>

From: Cristian Vijelie <cristianvijelie@gmail.com>

The library requires newlibc to work.

Cristian Vijelie (2):
  Introducing library skeleton
  Add Makefile.uk

 .gitignore      |   3 +
 CODING_STYLE.md |   4 +
 CONTRIBUTING.md |   4 +
 COPYING.md      |  37 ++++++
 Config.uk       |   4 +
 MAINTAINERS.md  |  10 ++
 Makefile.uk     | 311 ++++++++++++++++++++++++++++++++++++++++++++++++
 README.md       |   8 ++
 8 files changed, 381 insertions(+)
 create mode 100644 .gitignore
 create mode 100644 CODING_STYLE.md
 create mode 100644 CONTRIBUTING.md
 create mode 100644 COPYING.md
 create mode 100644 Config.uk
 create mode 100644 MAINTAINERS.md
 create mode 100644 Makefile.uk
 create mode 100644 README.md

-- 
2.25.1



From minios-devel-bounces@lists.xenproject.org Fri Aug 21 10:27:20 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Fri, 21 Aug 2020 10:27:20 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1k94GW-00088p-Fr; Fri, 21 Aug 2020 10:27:20 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=50MG=B7=gmail.com=cristianvijelie@srs-us1.protection.inumbo.net>)
 id 1k94GV-00088E-9d
 for minios-devel@lists.xen.org; Fri, 21 Aug 2020 10:27:19 +0000
X-Inumbo-ID: f9a347bd-d37a-4c9a-86bb-4cd3ead76d33
Received: from mail-ed1-x532.google.com (unknown [2a00:1450:4864:20::532])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id f9a347bd-d37a-4c9a-86bb-4cd3ead76d33;
 Fri, 21 Aug 2020 10:27:15 +0000 (UTC)
Received: by mail-ed1-x532.google.com with SMTP id b2so1008709edw.5
 for <minios-devel@lists.xen.org>; Fri, 21 Aug 2020 03:27:15 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=from:to:subject:date:message-id:in-reply-to:references:mime-version
 :content-transfer-encoding;
 bh=9HrmUv4J3SIhnm+KvVf4pbG7n36jI9x+cY/kKlYoz2w=;
 b=kNvqlqRkJHcQTATPQSiuQ7zx492Gclx7TPuowvXA5+ONMIv9Q9lW04XTOSQo7V/kh/
 juhCaiw3mM7o7g35swU8cYpydFcfzQQDekonO97MYPrFqkhEEjk+Stb+nZkWMDN5c7hb
 jJtmb9HdhjYaWkZrIIppJHqRUT5KwGF9ysFYu+Dsas2iusUdvrhlGxy08txGvJZpfV50
 mctZjehx6DXVa35fr1PJM3P5AWmN/CMgpWQcNlQiA5Hn1B81/2vf+2l4ArsEUZ2+bYsC
 aytAtDtPDXBveToGCr6R2WFh9inBlLojKB/OWgwb38FYP64clv/vtNopR+nL/+ZZ3ZpP
 Ho9A==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to
 :references:mime-version:content-transfer-encoding;
 bh=9HrmUv4J3SIhnm+KvVf4pbG7n36jI9x+cY/kKlYoz2w=;
 b=QNTfUQ3cCV5A3kJAP2ll2FufvFTJzlNu4ClydAJxDt3U01Bejh+yG5/F1/jYFDv9Ia
 F4cj1ZWaKvernyd51475+HnqQ4T7bNkg6+GV24ZJ5VxyB6yJeAZxEIAKXavvjF61d6px
 IeVTjCabHiGn0u/M71ksSVvK/tdKC3tLrGoObZ56+EaLzN/3glc8GnaNScA4bKvc5IbQ
 4O08l8OT7TsILsTyLUAA+sGnYVAmeiHD0OisuPwuaUL3fExgk0ykxPVeMUW2as0hqDAf
 5YOZ+NBBCOmKqnOw71ahkmwUM1nLx2hh2euT7J3qdJVn9DJUXkNaQnVrMps8FdIbdH5f
 mYMg==
X-Gm-Message-State: AOAM532os0SRfxOnCt0FXIGLqJCfreioum/AS5E/J2puABOtOzENPhIt
 hbzfk2df38VXmrLGZt11fpO0aV4YnQc=
X-Google-Smtp-Source: ABdhPJwE7cIVQOwb+Ifu6lpuHJQ5rtdHMoh6LRWGXUvvOqFrV9MqjMuu4NJBMEs2VDTVZYsZtBQ8sA==
X-Received: by 2002:aa7:da52:: with SMTP id w18mr2065835eds.367.1598005634388; 
 Fri, 21 Aug 2020 03:27:14 -0700 (PDT)
Received: from localhost.localdomain ([82.137.12.155])
 by smtp.gmail.com with ESMTPSA id k6sm1021222ejg.81.2020.08.21.03.27.12
 for <minios-devel@lists.xen.org>
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Fri, 21 Aug 2020 03:27:13 -0700 (PDT)
From: cristianvijelie@gmail.com
To: minios-devel@lists.xen.org
Subject: [[UNIKRAFT/LIBNETTLE PATCH] v2 1/2] Introducing library skeleton
Date: Fri, 21 Aug 2020 13:27:07 +0300
Message-Id: <20200821102708.48922-2-cristianvijelie@gmail.com>
X-Mailer: git-send-email 2.25.1
In-Reply-To: <20200821102708.48922-1-cristianvijelie@gmail.com>
References: <20200821102708.48922-1-cristianvijelie@gmail.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-BeenThere: minios-devel@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Mini-os development list <minios-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:minios-devel@lists.xenproject.org>
List-Help: <mailto:minios-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: minios-devel-bounces@lists.xenproject.org
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>

From: Cristian Vijelie <cristianvijelie@gmail.com>

Signed-off-by: Cristian Vijelie <cristianvijelie@gmail.com>
---
 .gitignore      |  3 +++
 CODING_STYLE.md |  4 ++++
 CONTRIBUTING.md |  4 ++++
 COPYING.md      | 37 +++++++++++++++++++++++++++++++++++++
 Config.uk       |  4 ++++
 MAINTAINERS.md  | 10 ++++++++++
 README.md       |  8 ++++++++
 7 files changed, 70 insertions(+)
 create mode 100644 .gitignore
 create mode 100644 CODING_STYLE.md
 create mode 100644 CONTRIBUTING.md
 create mode 100644 COPYING.md
 create mode 100644 Config.uk
 create mode 100644 MAINTAINERS.md
 create mode 100644 README.md

diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..d44f82a
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,3 @@
+nettle-*
+patches
+*/*.patch
\ No newline at end of file
diff --git a/CODING_STYLE.md b/CODING_STYLE.md
new file mode 100644
index 0000000..5730041
--- /dev/null
+++ b/CODING_STYLE.md
@@ -0,0 +1,4 @@
+Coding Style
+============
+
+Please refer to the `CODING_STYLE.md` file in the main Unikraft repository.
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
new file mode 100644
index 0000000..14f6ac6
--- /dev/null
+++ b/CONTRIBUTING.md
@@ -0,0 +1,4 @@
+Contributing to Unikraft
+========================
+
+Please refer to the `CONTRIBUTING.md` file in the main Unikraft repository.
diff --git a/COPYING.md b/COPYING.md
new file mode 100644
index 0000000..3953481
--- /dev/null
+++ b/COPYING.md
@@ -0,0 +1,37 @@
+License
+=======
+
+Unikraft Nettle wrappers
+----------------------------------
+
+This repository contains wrapper code to build Nettle cryptographic library 
+with Unikraft. Each C code file in this repository should declare who is 
+the copyright owner and under which terms and conditions the code is licensed.
+If such a licence note is missing, the following copyright notice will apply:
+
+	Copyright (c) Year, Institution. All rights reserved.
+
+	Redistribution and use in source and binary forms, with or without
+	modification, are permitted provided that the following conditions
+	are met:
+
+	1. Redistributions of source code must retain the above copyright
+	   notice, this list of conditions and the following disclaimer.
+	2. Redistributions in binary form must reproduce the above copyright
+	   notice, this list of conditions and the following disclaimer in the
+	   documentation and/or other materials provided with the distribution.
+	3. Neither the name of the copyright holder nor the names of its
+	   contributors may be used to endorse or promote products derived from
+	   this software without specific prior written permission.
+
+	THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+	AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+	IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+	ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+	LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+	CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+	SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+	INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+	CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+	ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+	POSSIBILITY OF SUCH DAMAGE.
\ No newline at end of file
diff --git a/Config.uk b/Config.uk
new file mode 100644
index 0000000..c2967e5
--- /dev/null
+++ b/Config.uk
@@ -0,0 +1,4 @@
+menuconfig LIBNETTLE
+    bool "libnettle: Symmetric and one-way cryptographic library"
+    select LIBNEWLIBC
+    default n
\ No newline at end of file
diff --git a/MAINTAINERS.md b/MAINTAINERS.md
new file mode 100644
index 0000000..c3a227d
--- /dev/null
+++ b/MAINTAINERS.md
@@ -0,0 +1,10 @@
+Maintainers List
+================
+
+For notes on how to read this information, please refer to `MAINTAINERS.md` in
+the main Unikraft repository.
+
+	LIBNETTLE-UNIKRAFT
+	M: 	Cristian Vijelie <cristianvijelie@gmail.com>
+	L:	minios-devel@lists.xen.org
+	F: *
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..e3974c1
--- /dev/null
+++ b/README.md
@@ -0,0 +1,8 @@
+Nettle crypto library for Unikraft
+=============================
+
+This is the port of Nettle crypto library for Unikraft as external library. It requires newlibc to work.
+When adding the library in the dependencies list, the libraries should be like this:
+`...$(UK_LIBS)/nettle:$(UK_LIBS)/newlib:...`
+
+Please refer to the `README.md` as well as the documentation in the `doc/` subdirectory of the main unikraft repository.
-- 
2.25.1



From minios-devel-bounces@lists.xenproject.org Fri Aug 21 10:27:25 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Fri, 21 Aug 2020 10:27:25 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1k94Gb-0008BL-Hk; Fri, 21 Aug 2020 10:27:25 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=50MG=B7=gmail.com=cristianvijelie@srs-us1.protection.inumbo.net>)
 id 1k94Ga-00088E-AN
 for minios-devel@lists.xen.org; Fri, 21 Aug 2020 10:27:24 +0000
X-Inumbo-ID: 417f9ae6-53fe-4117-bc7b-4f5ca45b5c6b
Received: from mail-ej1-x641.google.com (unknown [2a00:1450:4864:20::641])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 417f9ae6-53fe-4117-bc7b-4f5ca45b5c6b;
 Fri, 21 Aug 2020 10:27:17 +0000 (UTC)
Received: by mail-ej1-x641.google.com with SMTP id t10so1688798ejs.8
 for <minios-devel@lists.xen.org>; Fri, 21 Aug 2020 03:27:17 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=from:to:subject:date:message-id:in-reply-to:references:mime-version
 :content-transfer-encoding;
 bh=RdvOfN1mrefM/6A5ziVT+UbFiwPaNdQKxb+pm1Fyj1A=;
 b=Be8jmeGE6dwYEy8slcqg+oi9g970t8+Fk1xO3DcpsKaHadRcwLMdwogtrBj3z73Wih
 Pf61nzr5ys3J/+WDRIaOkTT0ZDER5R2kxvLq/2KI6MwQZGTOX2q+b23DToZ27inWTpDc
 lhssU/VpLaZlf5In149UZ52mjVyiKyEf9mD58D+Aw2sRh3nLAEPqWMYo3vqv4PXGEWYn
 AU/eZMqlLs6Fgpd3RjJ6XNWXn+mPRLFoHa7liv8NEzz9PhJu1rNCyUjEcVk3tuKUmPA0
 iyB+7dT9UbJOCTLJq7Z5apfhDUJujkvOnbgMe8zUMcTCLK7x12+zQD0o3/gQ+IfjAQ4j
 VqnA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to
 :references:mime-version:content-transfer-encoding;
 bh=RdvOfN1mrefM/6A5ziVT+UbFiwPaNdQKxb+pm1Fyj1A=;
 b=HYLf2OBH46PYG/rMZKiQywhjWxQIBDsYt8YqaUV1SfqXbSKkTmADLDTU7vZX9s73A6
 Of32mwlhOEZhnBkUAFzWzWXw9a0y+efPW54K56TVx467wafbIJP3vtr2Y8KLi1+cX7ku
 9R7ze0AHqJVp8kbdJtq6Kb74tVZPlYD8RsIrN6/EyJZeirgXJ4daMPY66HzZzhHRQutT
 UD4ei62MnSQTm+QOTf/8At/QOO3mSNEG19kDeHenaD+8OqseCVHoJyQcRqjawgWMHdNw
 foVprO6uVORlpwzdCPLpDlxpaR3EifSaazYKJXZjkWqAWwBh2GHYCJlAZt7WQd5FDveQ
 w4oQ==
X-Gm-Message-State: AOAM533/eqC1beV0uFbh/p6uCFOcSDNr6XcPNqxP1iGQNTaeeiRr85+O
 fF1f/xo5yDPSvGkoLbZlHdN2MBfLQUE=
X-Google-Smtp-Source: ABdhPJyFzY6A9eW6DHtKEeoeoCD2cj5k78L2Ke//f1FWrszJNMuwAhndfbioPo4RxeMowsB54pKKlA==
X-Received: by 2002:a17:906:393:: with SMTP id
 b19mr1179904eja.268.1598005635973; 
 Fri, 21 Aug 2020 03:27:15 -0700 (PDT)
Received: from localhost.localdomain ([82.137.12.155])
 by smtp.gmail.com with ESMTPSA id k6sm1021222ejg.81.2020.08.21.03.27.14
 for <minios-devel@lists.xen.org>
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Fri, 21 Aug 2020 03:27:15 -0700 (PDT)
From: cristianvijelie@gmail.com
To: minios-devel@lists.xen.org
Subject: [[UNIKRAFT/LIBNETTLE PATCH] v2 2/2] Add Makefile.uk
Date: Fri, 21 Aug 2020 13:27:08 +0300
Message-Id: <20200821102708.48922-3-cristianvijelie@gmail.com>
X-Mailer: git-send-email 2.25.1
In-Reply-To: <20200821102708.48922-1-cristianvijelie@gmail.com>
References: <20200821102708.48922-1-cristianvijelie@gmail.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-BeenThere: minios-devel@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Mini-os development list <minios-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:minios-devel@lists.xenproject.org>
List-Help: <mailto:minios-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: minios-devel-bounces@lists.xenproject.org
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>

From: Cristian Vijelie <cristianvijelie@gmail.com>

Signed-off-by: Cristian Vijelie <cristianvijelie@gmail.com>
---
 Makefile.uk | 311 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 311 insertions(+)
 create mode 100644 Makefile.uk

diff --git a/Makefile.uk b/Makefile.uk
new file mode 100644
index 0000000..64cd2ce
--- /dev/null
+++ b/Makefile.uk
@@ -0,0 +1,311 @@
+################################################################################
+# Library registration
+################################################################################
+$(eval $(call addlib_s,libnettle,$(CONFIG_LIBNETTLE)))
+
+################################################################################
+# Original sources
+################################################################################
+LIBNETTLE_VERSION=3.6
+LIBNETTLE_TARNAME=nettle-$(LIBNETTLE_VERSION)
+LIBNETTLE_URL=https://ftp.gnu.org/gnu/nettle/$(LIBNETTLE_TARNAME).tar.gz
+$(eval $(call fetch,libnettle,$(LIBNETTLE_URL)))
+LIBNETTLE_PATCHDIR=$(LIBNETTLE_BASE)/patches
+$(eval $(call patch,libnettle,$(LIBNETTLE_PATCHDIR),$(LIBNETTLE_TARNAME)))
+
+################################################################################
+# Helpers
+################################################################################
+LIBNETTLE_DIR = $(LIBNETTLE_ORIGIN)/$(LIBNETTLE_TARNAME)
+
+################################################################################
+# Library includes
+################################################################################
+LIBNETTLE-CINCLUDES-y = -I$(LIBNETTLE_DIR) -I$(LIBNETTLE_BASE)/include
+
+################################################################################
+# Global flags
+################################################################################
+LIBNETTLE_CFLAGS = -DHAVE_CONFIG_H -g -O2 -ggdb3 -Wall -W -Wno-sign-compare   \
+-Wmissing-prototypes -Wmissing-declarations -Wstrict-prototypes   \
+-Wpointer-arith -Wbad-function-cast -Wnested-externs -fpic -MT $@ -MD -MP \
+-MF $@.d
+
+################################################################################
+# Nettle code
+################################################################################
+LIBNETTLE_SRCS-y += $(LIBNETTLE_DIR)/aes-decrypt-internal.s
+LIBNETTLE_SRCS-y += $(LIBNETTLE_DIR)/aes-decrypt.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_DIR)/aes-encrypt-internal.s
+LIBNETTLE_SRCS-y += $(LIBNETTLE_DIR)/aes-encrypt.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_DIR)/aes-encrypt-table.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_DIR)/aes-invert-internal.c 
+LIBNETTLE_SRCS-y += $(LIBNETTLE_DIR)/aes-set-key-internal.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_DIR)/aes-set-encrypt-key.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_DIR)/aes-set-decrypt-key.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_DIR)/aes128-set-encrypt-key.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_DIR)/aes128-set-decrypt-key.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_DIR)/aes128-meta.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_DIR)/aes192-set-encrypt-key.c 
+LIBNETTLE_SRCS-y += $(LIBNETTLE_DIR)/aes192-set-decrypt-key.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_DIR)/aes192-meta.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_DIR)/aes256-set-encrypt-key.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_DIR)/aes256-set-decrypt-key.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_DIR)/aes256-meta.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_DIR)/arcfour.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_DIR)/arcfour-crypt.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_DIR)/arctwo.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_DIR)/arctwo-meta.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_DIR)/blowfish.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_DIR)/base16-encode.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_DIR)/base16-decode.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_DIR)/base16-meta.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_DIR)/base64-encode.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_DIR)/base64-decode.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_DIR)/base64-meta.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_DIR)/base64url-encode.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_DIR)/base64url-decode.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_DIR)/base64url-meta.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_DIR)/buffer.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_DIR)/buffer-init.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_DIR)/camellia-crypt-internal.s
+LIBNETTLE_SRCS-y += $(LIBNETTLE_DIR)/camellia-table.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_DIR)/camellia-absorb.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_DIR)/camellia-invert-key.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_DIR)/camellia128-set-encrypt-key.c 
+LIBNETTLE_SRCS-y += $(LIBNETTLE_DIR)/camellia128-crypt.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_DIR)/camellia128-set-decrypt-key.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_DIR)/camellia128-meta.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_DIR)/camellia192-meta.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_DIR)/camellia256-set-encrypt-key.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_DIR)/camellia256-crypt.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_DIR)/camellia256-set-decrypt-key.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_DIR)/camellia256-meta.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_DIR)/cast128.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_DIR)/cast128-meta.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_DIR)/cbc.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_DIR)/ccm.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_DIR)/ccm-aes128.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_DIR)/ccm-aes192.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_DIR)/ccm-aes256.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_DIR)/cfb.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_DIR)/siv-cmac.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_DIR)/siv-cmac-aes128.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_DIR)/siv-cmac-aes256.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_DIR)/cnd-memcpy.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_DIR)/chacha-crypt.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_DIR)/chacha-core-internal.s
+LIBNETTLE_SRCS-y += $(LIBNETTLE_DIR)/chacha-poly1305.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_DIR)/chacha-poly1305-meta.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_DIR)/chacha-set-key.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_DIR)/chacha-set-nonce.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_DIR)/ctr.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_DIR)/ctr16.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_DIR)/des.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_DIR)/des3.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_DIR)/eax.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_DIR)/eax-aes128.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_DIR)/eax-aes128-meta.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_DIR)/gcm.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_DIR)/gcm-aes.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_DIR)/gcm-aes128.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_DIR)/gcm-aes128-meta.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_DIR)/gcm-aes192.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_DIR)/gcm-aes192-meta.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_DIR)/gcm-aes256.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_DIR)/gcm-aes256-meta.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_DIR)/gcm-camellia128.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_DIR)/gcm-camellia128-meta.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_DIR)/gcm-camellia256.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_DIR)/gcm-camellia256-meta.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_DIR)/cmac.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_DIR)/cmac64.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_DIR)/cmac-aes128.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_DIR)/cmac-aes256.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_DIR)/cmac-des3.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_DIR)/cmac-aes128-meta.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_DIR)/cmac-aes256-meta.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_DIR)/cmac-des3-meta.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_DIR)/gost28147.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_DIR)/gosthash94.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_DIR)/gosthash94-meta.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_DIR)/hmac.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_DIR)/hmac-gosthash94.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_DIR)/hmac-md5.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_DIR)/hmac-ripemd160.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_DIR)/hmac-sha1.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_DIR)/hmac-sha224.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_DIR)/hmac-sha256.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_DIR)/hmac-sha384.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_DIR)/hmac-sha512.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_DIR)/hmac-md5-meta.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_DIR)/hmac-ripemd160-meta.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_DIR)/hmac-sha1-meta.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_DIR)/hmac-sha224-meta.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_DIR)/hmac-sha256-meta.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_DIR)/hmac-sha384-meta.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_DIR)/hmac-sha512-meta.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_DIR)/knuth-lfib.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_DIR)/hkdf.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_DIR)/md2.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_DIR)/md2-meta.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_DIR)/md4.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_DIR)/md4-meta.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_DIR)/md5.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_DIR)/md5-compress.s
+LIBNETTLE_SRCS-y += $(LIBNETTLE_DIR)/md5-compat.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_DIR)/md5-meta.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_DIR)/memeql-sec.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_DIR)/memxor.s
+LIBNETTLE_SRCS-y += $(LIBNETTLE_DIR)/memxor3.s
+LIBNETTLE_SRCS-y += $(LIBNETTLE_DIR)/nettle-lookup-hash.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_DIR)/nettle-meta-aeads.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_DIR)/nettle-meta-armors.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_DIR)/nettle-meta-ciphers.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_DIR)/nettle-meta-hashes.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_DIR)/nettle-meta-macs.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_DIR)/pbkdf2.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_DIR)/pbkdf2-hmac-gosthash94.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_DIR)/pbkdf2-hmac-sha1.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_DIR)/pbkdf2-hmac-sha256.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_DIR)/poly1305-aes.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_DIR)/poly1305-internal.s
+LIBNETTLE_SRCS-y += $(LIBNETTLE_DIR)/realloc.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_DIR)/ripemd160.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_DIR)/ripemd160-compress.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_DIR)/ripemd160-meta.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_DIR)/salsa20-core-internal.s
+LIBNETTLE_SRCS-y += $(LIBNETTLE_DIR)/salsa20-crypt.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_DIR)/salsa20r12-crypt.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_DIR)/salsa20-set-key.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_DIR)/salsa20-set-nonce.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_DIR)/salsa20-128-set-key.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_DIR)/salsa20-256-set-key.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_DIR)/sha1.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_DIR)/sha1-compress.s
+LIBNETTLE_SRCS-y += $(LIBNETTLE_DIR)/sha1-meta.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_DIR)/sha256.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_DIR)/sha256-compress.s
+LIBNETTLE_SRCS-y += $(LIBNETTLE_DIR)/sha224-meta.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_DIR)/sha256-meta.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_DIR)/sha512.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_DIR)/sha512-compress.s
+LIBNETTLE_SRCS-y += $(LIBNETTLE_DIR)/sha384-meta.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_DIR)/sha512-meta.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_DIR)/sha512-224-meta.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_DIR)/sha512-256-meta.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_DIR)/sha3.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_DIR)/sha3-permute.s
+LIBNETTLE_SRCS-y += $(LIBNETTLE_DIR)/sha3-224.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_DIR)/sha3-224-meta.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_DIR)/sha3-256.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_DIR)/sha3-256-meta.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_DIR)/sha3-384.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_DIR)/sha3-384-meta.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_DIR)/sha3-512.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_DIR)/sha3-512-meta.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_DIR)/shake256.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_DIR)/serpent-set-key.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_DIR)/serpent-encrypt.s
+LIBNETTLE_SRCS-y += $(LIBNETTLE_DIR)/serpent-decrypt.s
+LIBNETTLE_SRCS-y += $(LIBNETTLE_DIR)/serpent-meta.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_DIR)/twofish.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_DIR)/twofish-meta.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_DIR)/umac-nh.s
+LIBNETTLE_SRCS-y += $(LIBNETTLE_DIR)/umac-nh-n.s
+LIBNETTLE_SRCS-y += $(LIBNETTLE_DIR)/umac-l2.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_DIR)/umac-l3.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_DIR)/umac-poly64.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_DIR)/umac-poly128.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_DIR)/umac-set-key.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_DIR)/umac32.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_DIR)/umac64.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_DIR)/umac96.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_DIR)/umac128.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_DIR)/version.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_DIR)/write-be32.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_DIR)/write-le32.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_DIR)/write-le64.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_DIR)/yarrow256.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_DIR)/yarrow_key_event.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_DIR)/xts.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_DIR)/xts-aes128.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_DIR)/xts-aes256.c
+LIBNETTLE_SRCS-y += $(LIBNETTLE_DIR)/gcm-hash8.s
+
+################################################################################
+# Nettle prepare
+################################################################################
+# Run ./configure
+$(LIBNETTLE_DIR)/.configured: $(LIBNETTLE_BUILD)/.origin
+	$(call verbose_cmd,CONFIG,libnettle: $(notdir $@), cd $(LIBNETTLE_DIR) && ./configure && touch $@)
+
+# Generate assembly files
+
+LIBNETTLE_ASSEMBLY_DEPS = $(LIBNETTLE_DIR)/asm.m4 $(LIBNETTLE_DIR)/machine.m4 $(LIBNETTLE_DIR)/config.m4
+
+$(LIBNETTLE_DIR)/aes-decrypt-internal.s: $(LIBNETTLE_ASSEMBLY_DEPS) $(LIBNETTLE_DIR)/aes-decrypt-internal.asm
+	$(call verbose_cmd,GEN,libnettle: $(notdir $@), cd $(LIBNETTLE_DIR) && /usr/bin/m4 $^ >$@)
+$(LIBNETTLE_DIR)/aes-encrypt-internal.s: $(LIBNETTLE_ASSEMBLY_DEPS) $(LIBNETTLE_DIR)/aes-encrypt-internal.asm
+	$(call verbose_cmd,GEN,libnettle: $(notdir $@), cd $(LIBNETTLE_DIR) && /usr/bin/m4 $^ >$@)
+$(LIBNETTLE_DIR)/camellia-crypt-internal.s: $(LIBNETTLE_ASSEMBLY_DEPS) $(LIBNETTLE_DIR)/camellia-crypt-internal.asm
+	$(call verbose_cmd,GEN,libnettle: $(notdir $@), cd $(LIBNETTLE_DIR) && /usr/bin/m4 $^ >$@)
+$(LIBNETTLE_DIR)/chacha-core-internal.s: $(LIBNETTLE_ASSEMBLY_DEPS) $(LIBNETTLE_DIR)/chacha-core-internal.asm
+	$(call verbose_cmd,GEN,libnettle: $(notdir $@), cd $(LIBNETTLE_DIR) && /usr/bin/m4 $^ >$@)
+$(LIBNETTLE_DIR)/md5-compress.s: $(LIBNETTLE_ASSEMBLY_DEPS) $(LIBNETTLE_DIR)/md5-compress.asm
+	$(call verbose_cmd,GEN,libnettle: $(notdir $@), cd $(LIBNETTLE_DIR) && /usr/bin/m4 $^ >$@)
+$(LIBNETTLE_DIR)/memxor.s: $(LIBNETTLE_ASSEMBLY_DEPS) $(LIBNETTLE_DIR)/memxor.asm
+	$(call verbose_cmd,GEN,libnettle: $(notdir $@), cd $(LIBNETTLE_DIR) && /usr/bin/m4 $^ >$@)
+$(LIBNETTLE_DIR)/memxor3.s: $(LIBNETTLE_ASSEMBLY_DEPS) $(LIBNETTLE_DIR)/memxor3.asm
+	$(call verbose_cmd,GEN,libnettle: $(notdir $@), cd $(LIBNETTLE_DIR) && /usr/bin/m4 $^ >$@)
+$(LIBNETTLE_DIR)/poly1305-internal.s: $(LIBNETTLE_ASSEMBLY_DEPS) $(LIBNETTLE_DIR)/poly1305-internal.asm
+	$(call verbose_cmd,GEN,libnettle: $(notdir $@), cd $(LIBNETTLE_DIR) && /usr/bin/m4 $^ >$@)
+$(LIBNETTLE_DIR)/salsa20-core-internal.s: $(LIBNETTLE_ASSEMBLY_DEPS) $(LIBNETTLE_DIR)/salsa20-core-internal.asm
+	$(call verbose_cmd,GEN,libnettle: $(notdir $@), cd $(LIBNETTLE_DIR) && /usr/bin/m4 $^ >$@)
+$(LIBNETTLE_DIR)/salsa20-crypt.s: $(LIBNETTLE_ASSEMBLY_DEPS) $(LIBNETTLE_DIR)/salsa20-crypt.asm
+	$(call verbose_cmd,GEN,libnettle: $(notdir $@), cd $(LIBNETTLE_DIR) && /usr/bin/m4 $^ >$@)
+$(LIBNETTLE_DIR)/sha1-compress.s: $(LIBNETTLE_ASSEMBLY_DEPS) $(LIBNETTLE_DIR)/sha1-compress.asm
+	$(call verbose_cmd,GEN,libnettle: $(notdir $@), cd $(LIBNETTLE_DIR) && /usr/bin/m4 $^ >$@)
+$(LIBNETTLE_DIR)/sha256-compress.s: $(LIBNETTLE_ASSEMBLY_DEPS) $(LIBNETTLE_DIR)/sha256-compress.asm
+	$(call verbose_cmd,GEN,libnettle: $(notdir $@), cd $(LIBNETTLE_DIR) && /usr/bin/m4 $^ >$@)
+$(LIBNETTLE_DIR)/sha512-compress.s: $(LIBNETTLE_ASSEMBLY_DEPS) $(LIBNETTLE_DIR)/sha512-compress.asm
+	$(call verbose_cmd,GEN,libnettle: $(notdir $@), cd $(LIBNETTLE_DIR) && /usr/bin/m4 $^ >$@)
+$(LIBNETTLE_DIR)/sha3-permute.s: $(LIBNETTLE_ASSEMBLY_DEPS) $(LIBNETTLE_DIR)/sha3-permute.asm
+	$(call verbose_cmd,GEN,libnettle: $(notdir $@), cd $(LIBNETTLE_DIR) && /usr/bin/m4 $^ >$@)
+$(LIBNETTLE_DIR)/serpent-encrypt.s: $(LIBNETTLE_ASSEMBLY_DEPS) $(LIBNETTLE_DIR)/serpent-encrypt.asm
+	$(call verbose_cmd,GEN,libnettle: $(notdir $@), cd $(LIBNETTLE_DIR) && /usr/bin/m4 $^ >$@)
+$(LIBNETTLE_DIR)/serpent-decrypt.s: $(LIBNETTLE_ASSEMBLY_DEPS) $(LIBNETTLE_DIR)/serpent-decrypt.asm
+	$(call verbose_cmd,GEN,libnettle: $(notdir $@), cd $(LIBNETTLE_DIR) && /usr/bin/m4 $^ >$@)
+$(LIBNETTLE_DIR)/umac-nh.s: $(LIBNETTLE_ASSEMBLY_DEPS) $(LIBNETTLE_DIR)/umac-nh.asm
+	$(call verbose_cmd,GEN,libnettle: $(notdir $@), cd $(LIBNETTLE_DIR) && /usr/bin/m4 $^ >$@)
+$(LIBNETTLE_DIR)/umac-nh-n.s: $(LIBNETTLE_ASSEMBLY_DEPS) $(LIBNETTLE_DIR)/umac-nh-n.asm
+	$(call verbose_cmd,GEN,libnettle: $(notdir $@), cd $(LIBNETTLE_DIR) && /usr/bin/m4 $^ >$@)
+$(LIBNETTLE_DIR)/gcm-hash8.s: $(LIBNETTLE_ASSEMBLY_DEPS) $(LIBNETTLE_DIR)/gcm-hash8.asm
+	$(call verbose_cmd,GEN,libnettle: $(notdir $@), cd $(LIBNETTLE_DIR) && /usr/bin/m4 $^ >$@)
+
+LIBNETTLE_PREPAED_DEPS = \
+	$(LIBNETTLE_DIR)/.configured \
+	$(LIBNETTLE_DIR)/aes-decrypt-internal.s \
+	$(LIBNETTLE_DIR)/aes-encrypt-internal.s \
+	$(LIBNETTLE_DIR)/camellia-crypt-internal.s \
+	$(LIBNETTLE_DIR)/chacha-core-internal.s \
+	$(LIBNETTLE_DIR)/md5-compress.s \
+	$(LIBNETTLE_DIR)/memxor.s \
+	$(LIBNETTLE_DIR)/memxor3.s \
+	$(LIBNETTLE_DIR)/poly1305-internal.s \
+	$(LIBNETTLE_DIR)/salsa20-core-internal.s \
+	$(LIBNETTLE_DIR)/salsa20-crypt.s \
+	$(LIBNETTLE_DIR)/sha1-compress.s \
+	$(LIBNETTLE_DIR)/sha256-compress.s \
+	$(LIBNETTLE_DIR)/sha512-compress.s \
+	$(LIBNETTLE_DIR)/sha3-permute.s \
+	$(LIBNETTLE_DIR)/serpent-encrypt.s \
+	$(LIBNETTLE_DIR)/serpent-decrypt.s \
+	$(LIBNETTLE_DIR)/umac-nh.s \
+	$(LIBNETTLE_DIR)/umac-nh-n.s \
+	$(LIBNETTLE_DIR)/gcm-hash8.s \
+
+$(LIBNETTLE_BUILD)/.prepared : $(LIBNETTLE_PREPAED_DEPS)
+	$(call verbose_cmd,GEN,libnettle: $(notdir $@), cd $(LIBNETTLE_DIR) && touch $@)
+
+UK_PREPARE += $(LIBNETTLE_BUILD)/.prepared
-- 
2.25.1



From minios-devel-bounces@lists.xenproject.org Fri Aug 21 10:47:16 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Fri, 21 Aug 2020 10:47:16 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1k94Zn-00022U-2S; Fri, 21 Aug 2020 10:47:15 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=50MG=B7=gmail.com=cristianvijelie@srs-us1.protection.inumbo.net>)
 id 1k94Zm-00021l-AL
 for minios-devel@lists.xen.org; Fri, 21 Aug 2020 10:47:14 +0000
X-Inumbo-ID: 77afc81f-cd1c-453b-8b58-9a69dd47e282
Received: from mail-ed1-x541.google.com (unknown [2a00:1450:4864:20::541])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 77afc81f-cd1c-453b-8b58-9a69dd47e282;
 Fri, 21 Aug 2020 10:47:13 +0000 (UTC)
Received: by mail-ed1-x541.google.com with SMTP id w17so1033606edt.8
 for <minios-devel@lists.xen.org>; Fri, 21 Aug 2020 03:47:13 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=from:to:subject:date:message-id:mime-version
 :content-transfer-encoding;
 bh=DcYsLjCIXtTA8ZUCk7Nt6Ly6MFRAMbwCz1WqS420+GE=;
 b=DVsC6idjkfyFYEukyNs31wAA7bLNCMwCbcftzNQGEAp1W9/iaM4L80oIVZcwfMp7uu
 4hC5eDqg40cxaVRqvdBhKaau2uguDADkoUW7n9na8jc56vjGJG/agcmigzkemEeG8CG2
 eqBZqnux0WsQCH+IKElKo52nydIrztZ5MJeinageJtYQ9aOT3bMmyta25m9yM6r2SlvH
 SFh4Wk1vcLtvRNvYwn5v6/m9KjNvChHxsR4uyx4i0WSRzbRuRGXacK8t1nPiK/mYV9Nw
 A6Gdl/l6mk0rO7rgWDVobuGoF6BM5ispHdGMx/Cq/K28XXUx56DA96r8Jf8uedG+D6b1
 4z7w==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:to:subject:date:message-id:mime-version
 :content-transfer-encoding;
 bh=DcYsLjCIXtTA8ZUCk7Nt6Ly6MFRAMbwCz1WqS420+GE=;
 b=Hh+opeym62+k+gM8oJ40wy/vrteMJqAy/1iVovNSj/EahjicNHTIokHBAWbw9y1Ah8
 Ma86loTdUfzXoLTCDvP+Lcllh2pPZOreLZr69Fx8rr+5fWVkeZAYI3MiQ0ElJYaQVaGd
 nxhCsw5MO2KXWWoAOA2BCv241BoLKfSbnnwwuuN+BgxYQeu/2CbosZkcW4eBBbLcHx2Q
 qV50QdGFqPCXxZTeuZ9HZTrSx28o68leUZqxeZIZ61R5x/QhtAg7exaccLg9fVCFrWhB
 oG/9pO/aZ6xsxtm+/daLj3tiIZLvOfAaWFBaSXOkq3pGKYlH9SsoXfr8jPAAiCgv22j9
 BCog==
X-Gm-Message-State: AOAM530stoeg4FmVJtcrTHt7zLpHHGMkrPYGKB8d7+C5WOp5VNV6vc7i
 ba0J1WRv5AAGayO+wvZuQm7SRrIHWjc=
X-Google-Smtp-Source: ABdhPJz/wW2xoizMUWHBsyhN86GQMXBHfZ++85gIWPmtl5nkiEjMzik0J5QKgTcq4fmHTQv1pdUJSg==
X-Received: by 2002:aa7:cd04:: with SMTP id b4mr2114606edw.254.1598006832371; 
 Fri, 21 Aug 2020 03:47:12 -0700 (PDT)
Received: from localhost.localdomain ([82.137.12.155])
 by smtp.gmail.com with ESMTPSA id x1sm1026690ejc.119.2020.08.21.03.47.11
 for <minios-devel@lists.xen.org>
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Fri, 21 Aug 2020 03:47:11 -0700 (PDT)
From: cristianvijelie@gmail.com
To: minios-devel@lists.xen.org
Subject: [[UNIKRAFT PATCH] v2 0/1] lib/isrlib: Introduce libc-like
 interrupt-context-safe routines
Date: Fri, 21 Aug 2020 13:47:08 +0300
Message-Id: <20200821104709.50778-1-cristianvijelie@gmail.com>
X-Mailer: git-send-email 2.25.1
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-BeenThere: minios-devel@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Mini-os development list <minios-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:minios-devel@lists.xenproject.org>
List-Help: <mailto:minios-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: minios-devel-bounces@lists.xenproject.org
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>

From: Cristian Vijelie <cristianvijelie@gmail.com>

This library aims to provide functions tat are interrupt-safe, to be used
by interrupt handlers and drivers. It is based on nolibc.

For now, only string functions are implemented.

Cristian Vijelie (1):
  Implementation of isrlib string.c

 include/uk/isr/string.h |  72 ++++++++++
 lib/isrlib/Config.uk    |   3 +
 lib/isrlib/Makefile.uk  |   3 +
 lib/isrlib/string.c     | 299 ++++++++++++++++++++++++++++++++++++++++
 4 files changed, 377 insertions(+)
 create mode 100644 include/uk/isr/string.h
 create mode 100644 lib/isrlib/Config.uk
 create mode 100644 lib/isrlib/Makefile.uk
 create mode 100644 lib/isrlib/string.c

-- 
2.25.1



From minios-devel-bounces@lists.xenproject.org Fri Aug 21 10:47:20 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Fri, 21 Aug 2020 10:47:20 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1k94Zs-000231-41; Fri, 21 Aug 2020 10:47:20 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=50MG=B7=gmail.com=cristianvijelie@srs-us1.protection.inumbo.net>)
 id 1k94Zr-00021l-4N
 for minios-devel@lists.xen.org; Fri, 21 Aug 2020 10:47:19 +0000
X-Inumbo-ID: 74270cb3-addb-40aa-831c-29865b5a6676
Received: from mail-ej1-x632.google.com (unknown [2a00:1450:4864:20::632])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 74270cb3-addb-40aa-831c-29865b5a6676;
 Fri, 21 Aug 2020 10:47:15 +0000 (UTC)
Received: by mail-ej1-x632.google.com with SMTP id u21so1080781ejz.0
 for <minios-devel@lists.xen.org>; Fri, 21 Aug 2020 03:47:15 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=from:to:subject:date:message-id:in-reply-to:references:mime-version
 :content-transfer-encoding;
 bh=3dWJsoE0s6smEVKbEC7ecZIugN0mSBZ2NuU5TQL/EEE=;
 b=YdkkBDkMWO8C9XEThAhRxfhpgyPvai7QOf4e45dOe2B4rwvk3t6068i2oSTfToqqQr
 XSK3pL/DiKqBruBVQ5SHcqVpR+zR68L1nkOVnRnAG1jwFtKlPcv6nIN1s+ZgWXhYX5Iw
 M7ox/WKmhW0ixJmmBk4IuIqI11dABPhyjl8YAwwjE7nKuTXaRXtN9noBODkt7K1dLxMY
 Y9QqHeZMFYFpvIoejZ9ptgHTX08vziGKYT3vP6lPDF3tEFajSIeW1tPXe5Xo9Pl67WS4
 o5VU3sXdv+3VoNpCxHD8OS5XQrhWC0oRgMnJSCJKvWjfRdU9wRzL2KUH5Ugfni7erihH
 P/og==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to
 :references:mime-version:content-transfer-encoding;
 bh=3dWJsoE0s6smEVKbEC7ecZIugN0mSBZ2NuU5TQL/EEE=;
 b=siTlq8G99gw2PPSueju/fjeq+ZJ/X8Ao56NBMnWNMb/jbXkuDykMQvG0rnqbgSWjr/
 wEZ/w/1GDEqe6VXeG4x8Rw2YKt9nuFtsrfkQkTHCBSB9AbVJnctmupiwQ2eaeELIGD/5
 CnDNxQOiuzXHN8/mj4pDe4fEeQmYe7Ol33lZeVaKJTAFJkhNMW4wUwrZ3Ijo9YX7TyMb
 8FX/auEKp9YGdW1cHw6pEZrrtpQ3pRty9ow/HhAuFJyz2z8Ad548/t90yWtlhb1GChkZ
 Hr+ELHUGHeDty38IbN2fxBnIJGGpgbILD2JNPlzqBjJkNNaB3bovbXw0Bj40eV7NHVW5
 4qsw==
X-Gm-Message-State: AOAM533+6e8+s3uQ6qh5+cGIYVRBpBiftD8STfNqk6hHpbn5gGYltOLP
 oouvuFnSZjiQ2WNGKeMl48ycIAv4dsk=
X-Google-Smtp-Source: ABdhPJz+GhKhBNGncfTMmFn7BeI2Yl8Dw69gqsAPqt2FYda1Wzi2ytWj1foQTBBFEJQfG1Lt6FVK/A==
X-Received: by 2002:a17:906:388b:: with SMTP id
 q11mr2431948ejd.100.1598006833887; 
 Fri, 21 Aug 2020 03:47:13 -0700 (PDT)
Received: from localhost.localdomain ([82.137.12.155])
 by smtp.gmail.com with ESMTPSA id x1sm1026690ejc.119.2020.08.21.03.47.12
 for <minios-devel@lists.xen.org>
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Fri, 21 Aug 2020 03:47:13 -0700 (PDT)
From: cristianvijelie@gmail.com
To: minios-devel@lists.xen.org
Subject: [[UNIKRAFT PATCH] v2 1/1] Implementation of isrlib string.c
Date: Fri, 21 Aug 2020 13:47:09 +0300
Message-Id: <20200821104709.50778-2-cristianvijelie@gmail.com>
X-Mailer: git-send-email 2.25.1
In-Reply-To: <20200821104709.50778-1-cristianvijelie@gmail.com>
References: <20200821104709.50778-1-cristianvijelie@gmail.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-BeenThere: minios-devel@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Mini-os development list <minios-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:minios-devel@lists.xenproject.org>
List-Help: <mailto:minios-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: minios-devel-bounces@lists.xenproject.org
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>

From: Cristian Vijelie <cristianvijelie@gmail.com>

Signed-off-by: Cristian Vijelie <cristianvijelie@gmail.com>
---
 include/uk/isr/string.h |  72 ++++++++++
 lib/isrlib/Config.uk    |   3 +
 lib/isrlib/Makefile.uk  |   3 +
 lib/isrlib/string.c     | 299 ++++++++++++++++++++++++++++++++++++++++
 4 files changed, 377 insertions(+)
 create mode 100644 include/uk/isr/string.h
 create mode 100644 lib/isrlib/Config.uk
 create mode 100644 lib/isrlib/Makefile.uk
 create mode 100644 lib/isrlib/string.c

diff --git a/include/uk/isr/string.h b/include/uk/isr/string.h
new file mode 100644
index 0000000..bcf9fef
--- /dev/null
+++ b/include/uk/isr/string.h
@@ -0,0 +1,72 @@
+/* SPDX-License-Identifier: BSD-3-Clause */
+/*
+ * Authors: Simon Kuenzer <simon.kuenzer@neclab.eu>
+ *          Cristian Vijelie <cristianvijelie@gmail.com>
+ *
+ *
+ * Copyright (c) 2017, NEC Europe Ltd., NEC Corporation. All rights reserved.
+ * Copyright (c) 2020, University Politehnica of Bucharest. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the copyright holder nor the names of its
+ *    contributors may be used to endorse or promote products derived from
+ *    this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+#ifndef __UK_ISR_STRING_H__
+#define __UK_ISR_STRING_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <string.h>
+
+void *memcpy_isr(void *dst, const void *src, size_t len);
+void *memset_isr(void *ptr, int val, size_t len);
+void *memchr_isr(const void *ptr, int val, size_t len);
+void *memrchr_isr(const void *m, int c, size_t n);
+int memcmp_isr(const void *ptr1, const void *ptr2, size_t len);
+void *memmove_isr(void *dst, const void *src, size_t len);
+
+char *strncpy_isr(char *dst, const char *src, size_t len);
+char *strcpy_isr(char *dst, const char *src);
+size_t strlcpy_isr(char *d, const char *s, size_t n);
+size_t strlcat_isr(char *d, const char *s, size_t n);
+size_t strnlen_isr(const char *str, size_t maxlen);
+size_t strlen_isr(const char *str);
+char *strchrnul_isr(const char *s, int c);
+char *strchr_isr(const char *str, int c);
+char *strrchr_isr(const char *s, int c);
+int strncmp_isr(const char *str1, const char *str2, size_t len);
+int strcmp_isr(const char *str1, const char *str2);
+size_t strcspn_isr(const char *s, const char *c);
+size_t strspn_isr(const char *s, const char *c);
+char *strtok_isr(char *restrict s, const char *restrict sep, char **restrict p);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __UK_ISR_STRING_H__ */
diff --git a/lib/isrlib/Config.uk b/lib/isrlib/Config.uk
new file mode 100644
index 0000000..60b4274
--- /dev/null
+++ b/lib/isrlib/Config.uk
@@ -0,0 +1,3 @@
+config LIBISRLIB
+    bool "isrlib: ISR helper library"
+    default n
diff --git a/lib/isrlib/Makefile.uk b/lib/isrlib/Makefile.uk
new file mode 100644
index 0000000..df3616d
--- /dev/null
+++ b/lib/isrlib/Makefile.uk
@@ -0,0 +1,3 @@
+$(eval $(call addlib_s,libisrlib,$(CONFIG_LIBISRLIB)))
+
+LIBISRLIB_SRCS-y += $(LIBISRLIB_BASE)/string.c|isr
diff --git a/lib/isrlib/string.c b/lib/isrlib/string.c
new file mode 100644
index 0000000..ea38e2f
--- /dev/null
+++ b/lib/isrlib/string.c
@@ -0,0 +1,299 @@
+/* SPDX-License-Identifier: BSD-3-Clause */
+/*
+ * Authors: Cristian Vijelie <cristianvijelie@gmail.com>
+ *
+ *
+ * Copyright (c) 2020, University Politehnica of Bucharest. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the copyright holder nor the names of its
+ *    contributors may be used to endorse or promote products derived from
+ *    this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+#include <uk/isr/string.h>
+#include <uk/arch/types.h>
+#include <stdint.h>
+#include <limits.h>
+
+void *memcpy_isr(void *dst, const void *src, size_t len)
+{
+	size_t p;
+
+	for (p = 0; p < len; ++p)
+		*((__u8 *)(((__uptr)dst) + p)) = *((__u8 *)(((__uptr)src) + p));
+
+	return dst;
+}
+
+void *memset_isr(void *ptr, int val, size_t len)
+{
+	__u8 *p = (__u8 *) ptr;
+
+	for (; len > 0; --len)
+		*(p++) = (__u8)val;
+
+	return ptr;
+}
+
+void *memchr_isr(const void *ptr, int val, size_t len)
+{
+	uintptr_t o = 0;
+
+	for (o = 0; o < (uintptr_t)len; ++o)
+		if (*((const uint8_t *)(((uintptr_t)ptr) + o)) == (uint8_t)val)
+			return (void *)((uintptr_t)ptr + o);
+
+	return NULL; /* did not find val */
+}
+
+void *memrchr_isr(const void *m, int c, size_t n)
+{
+	const unsigned char *s = m;
+
+	c = (unsigned char) c;
+	while (n--)
+		if (s[n] == c)
+			return (void *) (s + n);
+	return 0;
+}
+
+void *memmove_isr(void *dst, const void *src, size_t len)
+{
+	uint8_t *d = dst;
+	const uint8_t *s = src;
+
+	if (src > dst) {
+		for (; len > 0; --len)
+			*(d++) = *(s++);
+	} else {
+		s += len;
+		d += len;
+
+		for (; len > 0; --len)
+			*(d--) = *(s--);
+	}
+
+	return dst;
+}
+
+int memcmp_isr(const void *ptr1, const void *ptr2, size_t len)
+{
+	const unsigned char *c1 = (const unsigned char *)ptr1;
+	const unsigned char *c2 = (const unsigned char *)ptr2;
+
+	for (; len > 0; --len, ++c1, ++c2) {
+		if ((*c1) != (*c2))
+			return ((*c1) - (*c2));
+	}
+
+	return 0;
+}
+
+size_t strlen_isr(const char *str)
+{
+	return strnlen_isr(str, SIZE_MAX);
+}
+
+size_t strnlen_isr(const char *str, size_t len)
+{
+	const char *p = memchr_isr(str, 0, len);
+	return p ? (size_t) (p - str) : len;
+}
+
+char *strncpy_isr(char *dst, const char *src, size_t len)
+{
+	size_t clen;
+
+	clen = strnlen_isr(src, len);
+	memcpy_isr(dst, src, clen);
+
+	/* instead of filling up the rest of left space with zeros,
+	 * append a termination character if we did not copy one
+	 */
+	if (clen < len && dst[clen - 1] != '\0')
+		dst[clen] = '\0';
+	return dst;
+}
+
+char *strcpy_isr(char *dst, const char *src)
+{
+	return strncpy_isr(dst, src, SIZE_MAX);
+}
+
+int strncmp_isr(const char *str1, const char *str2, size_t len)
+{
+	const char *c1 = (const char *)str1;
+	const char *c2 = (const char *)str2;
+
+	for (; len > 0; --len, ++c1, ++c2) {
+		if ((*c1) != (*c2))
+			return (int)((*c1) - (*c2));
+		if ((*c1) == '\0')
+			break;
+	}
+	return 0;
+}
+
+int strcmp_isr(const char *str1, const char *str2)
+{
+	register signed char __res;
+
+	while ((__res = *str1 - *str2++) == 0 && *str1++)
+		;
+
+	return __res;
+}
+
+/* The following code is taken from musl libc */
+#define ALIGN (sizeof(size_t))
+#define ONES ((size_t) -1 / UCHAR_MAX)
+#define HIGHS (ONES * (UCHAR_MAX / 2 + 1))
+#define HASZERO(x) (((x) - ONES) & ~(x) & HIGHS)
+#define BITOP(a, b, op) \
+		((a)[(size_t)(b) / (8*sizeof *(a))] op \
+		(size_t)1 << ((size_t)(b) % (8 * sizeof *(a))))
+
+char *strchrnul_isr(const char *s, int c)
+{
+	size_t *w, k;
+
+	c = (unsigned char)c;
+	if (!c)
+		return (char *)s + strlen_isr(s);
+
+	for (; (uintptr_t)s % ALIGN; s++)
+		if (!*s || *(unsigned char *)s == c)
+			return (char *)s;
+	k = ONES * c;
+	for (w = (void *)s; !HASZERO(*w) && !HASZERO(*w ^ k); w++)
+		;
+	for (s = (void *)w; *s && *(unsigned char *)s != c; s++)
+		;
+	return (char *)s;
+}
+
+char *strchr_isr(const char *str, int c)
+{
+	char *r = strchrnul_sr(str, c);
+	return *(unsigned char *)r == (unsigned char)c ? r : 0;
+}
+
+char *strrchr_isr(const char *s, int c)
+{
+	return memrchr_isr(s, c, strlen_isr(s) + 1);
+}
+
+size_t strcspn_isr(const char *s, const char *c)
+{
+	const char *a = s;
+	size_t byteset[32 / sizeof(size_t)];
+
+	if (!c[0] || !c[1])
+		return strchrnul_isr(s, *c)-a;
+
+	memset_isr(byteset, 0, sizeof(byteset));
+	for (; *c && BITOP(byteset, *(unsigned char *)c, |=); c++)
+		;
+	for (; *s && !BITOP(byteset, *(unsigned char *)s, &); s++)
+		;
+	return s-a;
+}
+
+size_t strspn_isr(const char *s, const char *c)
+{
+	const char *a = s;
+	size_t byteset[32 / sizeof(size_t)] = { 0 };
+
+	if (!c[0])
+		return 0;
+	if (!c[1]) {
+		for (; *s == *c; s++)
+			;
+		return s-a;
+	}
+
+	for (; *c && BITOP(byteset, *(unsigned char *)c, |=); c++)
+		;
+	for (; *s && BITOP(byteset, *(unsigned char *)s, &); s++)
+		;
+	return s-a;
+}
+
+char *strtok_isr(char *restrict s, const char *restrict sep, char **restrict p)
+{
+	if (!s && !(s = *p))
+		return NULL;
+	s += strspn_isr(s, sep);
+	if (!*s)
+		return *p = 0;
+	*p = s + strcspn_isr(s, sep);
+	if (**p)
+		*(*p)++ = 0;
+	else
+		*p = 0;
+	return s;
+}
+
+/* strlcpy has different ALIGN */
+#undef ALIGN
+#define ALIGN (sizeof(size_t)-1)
+size_t strlcpy_isr(char *d, const char *s, size_t n)
+{
+	char *d0 = d;
+	size_t *wd;
+	const size_t *ws;
+
+	if (!n--)
+		goto finish;
+
+	if (((uintptr_t)s & ALIGN) == ((uintptr_t)d & ALIGN)) {
+		for (; ((uintptr_t) s & ALIGN) && n && (*d = *s);
+		     n--, s++, d++)
+			;
+
+		if (n && *s) {
+			wd = (void *)d; ws = (const void *)s;
+			for (; n >= sizeof(size_t) && !HASZERO(*ws);
+			     n -= sizeof(size_t), ws++, wd++)
+				*wd = *ws;
+
+			d = (void *)wd; s = (const void *)ws;
+		}
+	}
+
+	for (; n && (*d = *s); n--, s++, d++)
+		;
+	*d = 0;
+finish:
+	return d-d0 + strlen_isr(s);
+}
+
+size_t strlcat_isr(char *d, const char *s, size_t n)
+{
+	size_t l = strnlen_isr(d, n);
+	if (l == n)
+		return l + strlen_isr(s);
+	return l + strlcpy_isr(d+l, s, n-l);
+}
-- 
2.25.1



From minios-devel-bounces@lists.xenproject.org Fri Aug 21 10:49:28 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Fri, 21 Aug 2020 10:49:28 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1k94bw-00027I-Ae; Fri, 21 Aug 2020 10:49:28 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=GXOG=B7=neclab.eu=simon.kuenzer@srs-us1.protection.inumbo.net>)
 id 1k94bv-00027D-9C
 for minios-devel@lists.xen.org; Fri, 21 Aug 2020 10:49:27 +0000
X-Inumbo-ID: f2e01073-4e48-42c0-be06-d5404f215299
Received: from mailer1.neclab.eu (unknown [195.37.70.40])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id f2e01073-4e48-42c0-be06-d5404f215299;
 Fri, 21 Aug 2020 10:49:25 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
 by mailer1.neclab.eu (Postfix) with ESMTP id 1A58F103A75;
 Fri, 21 Aug 2020 12:49:24 +0200 (CEST)
X-Virus-Scanned: Amavisd on Debian GNU/Linux (atlas-a.office.hd)
Received: from mailer1.neclab.eu ([127.0.0.1])
 by localhost (atlas-a.office.hd [127.0.0.1]) (amavisd-new, port 10024)
 with ESMTP id iE6f7KPQb8Es; Fri, 21 Aug 2020 12:49:23 +0200 (CEST)
X-ENC: Last-Hop-TLS-encrypted
X-ENC: Last-Hop-TLS-encrypted
Received: from puck.office.hd (puck.office.hd [192.168.24.91])
 (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
 (No client certificate requested)
 by mailer1.neclab.eu (Postfix) with ESMTPS id E5576103A43;
 Fri, 21 Aug 2020 12:49:23 +0200 (CEST)
Received: from [10.7.1.42] (192.168.24.96) by puck.office.hd (192.168.24.91)
 with Microsoft SMTP Server (version=TLS1_2,
 cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1979.3; Fri, 21 Aug
 2020 12:49:23 +0200
Subject: Re: [UNIKRAFT PATCH v4 10/12] plat/xen/drivers/net: Add transmit
 operation
To: Costin Lupu <costin.lupu@cs.pub.ro>, <minios-devel@lists.xen.org>
CC: <sharan.santhanam@neclab.eu>, Razvan Cojocaru <razvan.cojocaru93@gmail.com>
References: <20200813085342.29799-1-costin.lupu@cs.pub.ro>
 <20200813085342.29799-11-costin.lupu@cs.pub.ro>
 <494d8796-a3e0-a3d5-df36-6343df10d571@neclab.eu>
 <c71f09f9-79b7-816f-bced-a190ed6665fc@cs.pub.ro>
From: Simon Kuenzer <simon.kuenzer@neclab.eu>
Message-ID: <726dd84d-33cb-877f-3e22-a5d92870ac35@neclab.eu>
Date: Fri, 21 Aug 2020 12:49:21 +0200
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:68.0)
 Gecko/20100101 Thunderbird/68.11.0
MIME-Version: 1.0
In-Reply-To: <c71f09f9-79b7-816f-bced-a190ed6665fc@cs.pub.ro>
Content-Type: text/plain; charset="utf-8"; format=flowed
Content-Language: en-US
Content-Transfer-Encoding: 8bit
X-Originating-IP: [192.168.24.96]
X-ClientProxiedBy: puck.office.hd (192.168.24.91) To puck.office.hd
 (192.168.24.91)
X-BeenThere: minios-devel@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Mini-os development list <minios-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:minios-devel@lists.xenproject.org>
List-Help: <mailto:minios-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: minios-devel-bounces@lists.xenproject.org
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>

On 21.08.20 11:32, Costin Lupu wrote:
> On 8/20/20 6:49 PM, Simon Kuenzer wrote:
>> On 13.08.20 10:53, Costin Lupu wrote:
>>> Whenever a packet is transmitted, the request describing it is written
>>> in the
>>> shared ring. The packet itself is written in a page referenced by the
>>> request
>>> and shared, as well, with the backend. At the end of each transmit
>>> operation, a
>>> cleanup operation is performed free'ing the resources allocated for the
>>> previously transmitted packets.
>>>
>>> Signed-off-by: Costin Lupu <costin.lupu@cs.pub.ro>
>>> Signed-off-by: Razvan Cojocaru <razvan.cojocaru93@gmail.com>
>>> ---
>>>  Â  plat/xen/drivers/net/netfront.c | 102 ++++++++++++++++++++++++++++++++
>>>  Â  1 file changed, 102 insertions(+)
>>>
>>> diff --git a/plat/xen/drivers/net/netfront.c
>>> b/plat/xen/drivers/net/netfront.c
>>> index 858d124a..f2b81329 100644
>>> --- a/plat/xen/drivers/net/netfront.c
>>> +++ b/plat/xen/drivers/net/netfront.c
>>> @@ -39,6 +39,7 @@
>>>  Â  #include <uk/alloc.h>
>>>  Â  #include <uk/netdev_driver.h>
>>>  Â  #include <xen-x86/mm.h>
>>> +#include <xen-x86/irq.h>
>>>  Â  #include <xenbus/xenbus.h>
>>>  Â  #include "netfront.h"
>>>  Â  #include "netfront_xb.h"
>>> @@ -78,6 +79,106 @@ static uint16_t get_id_from_freelist(uint16_t
>>> *freelist)
>>>  Â Â Â Â Â  return id;
>>>  Â  }
>>>  Â  +static int network_tx_buf_gc(struct uk_netdev_tx_queue *txq)
>>> +{
>>> +Â Â Â  RING_IDX prod, cons;
>>> +Â Â Â  netif_tx_response_t *tx_rsp;
>>> +Â Â Â  uint16_t id;
>>> +Â Â Â  bool more_to_do;
>>> +Â Â Â  int count = 0;
>>> +
>>> +Â Â Â  do {
>>> +Â Â Â Â Â Â Â  prod = txq->ring.sring->rsp_prod;
>>> +Â Â Â Â Â Â Â  rmb(); /* Ensure we see responses up to 'rp'. */
>>> +
>>> +Â Â Â Â Â Â Â  for (cons = txq->ring.rsp_cons; cons != prod; cons++) {
>>> +Â Â Â Â Â Â Â Â Â Â Â  tx_rsp = RING_GET_RESPONSE(&txq->ring, cons);
>>> +
>>> +Â Â Â Â Â Â Â Â Â Â Â  if (tx_rsp->status == NETIF_RSP_NULL)
>>> +Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â  continue;
>>> +
>>> +Â Â Â Â Â Â Â Â Â Â Â  if (tx_rsp->status == NETIF_RSP_ERROR)
>>> +Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â  uk_pr_err("packet error\n");
>>
>> "netdev%u: Transmission error on txq %u\n" ?
>>
> 
> Ack.
> 
>>> +
>>> +Â Â Â Â Â Â Â Â Â Â Â  idÂ  = tx_rsp->id;
>>> +Â Â Â Â Â Â Â Â Â Â Â  UK_ASSERT(id < NET_TX_RING_SIZE);
>>> +
>>> +Â Â Â Â Â Â Â Â Â Â Â  gnttab_end_access(txq->gref[id]);
>>> +Â Â Â Â Â Â Â Â Â Â Â  txq->gref[id] = GRANT_INVALID_REF;
>>> +
>>> +Â Â Â Â Â Â Â Â Â Â Â  add_id_to_freelist(id, txq->freelist);
>>> +Â Â Â Â Â Â Â Â Â Â Â  uk_semaphore_up(&txq->sem);
>>> +
>>> +Â Â Â Â Â Â Â Â Â Â Â  count++;
>>> +Â Â Â Â Â Â Â  }
>>> +
>>> +Â Â Â Â Â Â Â  txq->ring.rsp_cons = prod;
>>> +
>>> +Â Â Â Â Â Â Â  RING_FINAL_CHECK_FOR_RESPONSES(&txq->ring, more_to_do);
>>> +Â Â Â  } while (more_to_do);
>>> +
>>> +Â Â Â  return count;
>>> +}
>>> +
>>> +static int netfront_xmit(struct uk_netdev *n,
>>> +Â Â Â Â Â Â Â  struct uk_netdev_tx_queue *txq,
>>> +Â Â Â Â Â Â Â  struct uk_netbuf *pkt)
>>> +{
>>> +Â Â Â  struct netfront_dev *nfdev;
>>> +Â Â Â  unsigned long flags;
>>> +Â Â Â  uint16_t id;
>>> +Â Â Â  RING_IDX req_prod;
>>> +Â Â Â  netif_tx_request_t *tx_req;
>>> +Â Â Â  int notify;
>>> +Â Â Â  int status = 0, count;
>>> +
>>> +Â Â Â  UK_ASSERT(n != NULL);
>>> +Â Â Â  UK_ASSERT(txq != NULL);
>>> +Â Â Â  UK_ASSERT(pkt != NULL);
>>> +Â Â Â  UK_ASSERT(pkt->len < PAGE_SIZE);
>>> +
>>> +Â Â Â  nfdev = to_netfront_dev(n);
>>> +
>>> +Â Â Â  /* get request id */
>>> +Â Â Â  uk_semaphore_down(&txq->sem);
>>> +Â Â Â  local_irq_save(flags);
>>> +Â Â Â  id = get_id_from_freelist(txq->freelist);
>>
>> What happens when we are out of space and the ring is full?
>> The xmit function should be non-blocking so that we can use it in
>> polling mode. We should return in such a case that the transmission
>> queue is currently full...
>>
> 
> Ack.
> 
>>> +Â Â Â  local_irq_restore(flags);
>>> +
>>> +Â Â Â  /* get request */
>>> +Â Â Â  req_prod = txq->ring.req_prod_pvt;
>>> +Â Â Â  tx_req = RING_GET_REQUEST(&txq->ring, req_prod); > +
>>> +Â Â Â  /* setup grant for buffer data */
>>> +Â Â Â  txq->gref[id] = tx_req->gref =
>>> +Â Â Â Â Â Â Â  gnttab_grant_access(nfdev->xendev->otherend_id,
>>> +Â Â Â Â Â Â Â Â Â Â Â  virt_to_mfn(pkt->data), 1);
>>> +Â Â Â  UK_ASSERT(tx_req->gref != GRANT_INVALID_REF);
>>> +
>>> +Â Â Â  tx_req->offset = 0;
>>> +Â Â Â  tx_req->size = (uint16_t) pkt->len;
>>> +Â Â Â  tx_req->flags = 0;
>>> +Â Â Â  tx_req->id = id;
>>> +
>>> +Â Â Â  txq->ring.req_prod_pvt = req_prod + 1;
>>> +Â Â Â  wmb(); /* Ensure backend sees requests */
>>> +
>>> +Â Â Â  RING_PUSH_REQUESTS_AND_CHECK_NOTIFY(&txq->ring, notify);
>>> +Â Â Â  if (notify)
>>> +Â Â Â Â Â Â Â  notify_remote_via_evtchn(txq->evtchn); > +
>>> +Â Â Â  status |= UK_NETDEV_STATUS_SUCCESS;
>>> +
>>> +Â Â Â  /* some cleanup */
>>> +Â Â Â  local_irq_save(flags);
>>> +Â Â Â  count = network_tx_buf_gc(txq);
>>
>> The clean-up should happen before enqueuing the given packet to the
>> transmit queue, it is the first thing of xmit(). Since we anyway need to
>> do it and we do not have an advantage by delaying this operation.
> 
> Of course there is an advantage. You push the packets in order for them
> to be processed ASAP by the backend and deal with cleaning up
> afterwards. It's a kind of parallelization. Otherwise you would delay
> the transmissions.
> 
>> We can also deal much better with full rings. Otherwise we
>> unnecessarily drop a packets for transmission although there would
>> have been space when clean-up finished. After calling cleaning you
>> can check if there is space on the ring and return if we run out of
>> it (use an `unlikely` to the condition so that we speed up the
>> successful sending case).
>>
> 
> The only scenario when this would solve anything would be when you have
> the ring full and just before you decide to send a new packet the
> backend starts processing your previous transmitted packets, leaving you
> at least one free slot. There are 2 unlikely events here: first, the
> ring is full, and second, the backend starts to process again when the
> ring gets full (for the latter event, it's unlikely that the backend
> will wake up given that it couldn't process 256 transmitted packets,
> where 256 is the current number of slots). And for this very unlikely
> context you would introduce a delay for all the transmissions if we
> followed your suggestion.
> 
> Anyway, both Linux and FreeBSD do the cleanup after pushing the
> requests, so I don't think we have much more to say about this.
> 

Hum... I double-checked with Intel DPDK's ixgbe (10 Gig) driver:

http://git.dpdk.org/dpdk-stable/tree/drivers/net/ixgbe/ixgbe_rxtx.c?h=20.02#n230

They clean the slots before sending. I derived my conclusion from there. 
However I noticed now that there is one minor difference: They do both - 
cleanup and enqueuing - before they notify the card about changes on the 
ring. In that case it does not add any delay if you swap the order of 
cleanup and enqueuing. In your case this is probably different because 
you can cleanup without notifying. Here, I agree with you that we add 
unnecessary xmit delays by swapping the order.

However and in general, having a full ring is not an uncommon and 
unlikely case. To my experience, this can already happen with a single 
TCP connection if your network stack is feeding next packets fast enough 
and if the current TCP window allows to send them. It also depends on 
when the driver domain is scheduled; on which CPU core your netfront 
domain and the driver domain sit; and even on the underlying physical 
device that might be busy with other traffic.

Another thing we are having in mind for uknetdev - and this is probably 
different to Linux/BSD's implementation - we plan to change the xmit 
function to do batching (as DPDK does). Sharan could push virtio-net 
performance further with this. You are able to reduce the number of 
notifies to the backend because you enqueue multiple packets at once and 
due to locality of batching you can utilize CPU caches ways better.

What about this idea for netfront: We could do first a check for 
available space and - if needed - clean-up just as many extra slots that 
you need to complete the transmission (for now this is anyways just one 
slot). Then we proceed with enqueuing and do the cleanup of the rest of 
the slots after we notified the backend. What do you think?

> 
> Btw, I'm waiting for reviews on the other patches as well before I send
> the v5.

Yes, sure.

> 
> 
>>> +Â Â Â  local_irq_restore(flags);
>>> +
>>> +Â Â Â  status |= likely(count > 0) ? UK_NETDEV_STATUS_MORE : 0x0;
>>> +
>>> +Â Â Â  return status;
>>> +}
>>> +
>>>  Â  static int netfront_rxq_enqueue(struct uk_netdev_rx_queue *rxq,
>>>  Â Â Â Â Â Â Â Â Â  struct uk_netbuf *netbuf)
>>>  Â  {
>>> @@ -598,6 +699,7 @@ static int netfront_add_dev(struct xenbus_device
>>> *xendev)
>>>  Â Â Â Â Â  }
>>>  Â  Â Â Â Â Â  /* register netdev */
>>> +Â Â Â  nfdev->netdev.tx_one = netfront_xmit;
>>>  Â Â Â Â Â  nfdev->netdev.ops = &netfront_ops;
>>>  Â Â Â Â Â  rc = uk_netdev_drv_register(&nfdev->netdev, drv_allocator,
>>> DRIVER_NAME);
>>>  Â Â Â Â Â  if (rc < 0) {
>>>
>>

Thanks,

Simon


From minios-devel-bounces@lists.xenproject.org Fri Aug 21 11:12:40 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Fri, 21 Aug 2020 11:12:40 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1k94yN-0004Yc-2V; Fri, 21 Aug 2020 11:12:39 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=GXOG=B7=neclab.eu=simon.kuenzer@srs-us1.protection.inumbo.net>)
 id 1k94yL-0004YW-KK
 for minios-devel@lists.xen.org; Fri, 21 Aug 2020 11:12:37 +0000
X-Inumbo-ID: f3ec62a0-60d9-4772-a1a0-b8020fd3176b
Received: from mailer2.neclab.eu (unknown [195.37.70.41])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id f3ec62a0-60d9-4772-a1a0-b8020fd3176b;
 Fri, 21 Aug 2020 11:12:34 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
 by mailer2.neclab.eu (Postfix) with ESMTP id EE238F2005;
 Fri, 21 Aug 2020 13:12:33 +0200 (CEST)
X-Virus-Scanned: Amavisd on Debian GNU/Linux (atlas-b.office.hd)
Received: from mailer2.neclab.eu ([127.0.0.1])
 by localhost (atlas-b.office.hd [127.0.0.1]) (amavisd-new, port 10024)
 with ESMTP id fVJ_F4PQymr8; Fri, 21 Aug 2020 13:12:33 +0200 (CEST)
X-ENC: Last-Hop-TLS-encrypted
X-ENC: Last-Hop-TLS-encrypted
Received: from puck.office.hd (puck.office.hd [192.168.24.91])
 (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
 (No client certificate requested)
 by mailer2.neclab.eu (Postfix) with ESMTPS id B9C04F201C;
 Fri, 21 Aug 2020 13:12:29 +0200 (CEST)
Received: from [10.7.1.42] (192.168.24.96) by puck.office.hd (192.168.24.91)
 with Microsoft SMTP Server (version=TLS1_2,
 cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1979.3; Fri, 21 Aug
 2020 13:12:29 +0200
Subject: Re: [[UNIKRAFT PATCH] v2 1/1] Implementation of isrlib string.c
To: <cristianvijelie@gmail.com>, <minios-devel@lists.xen.org>
References: <20200821104709.50778-1-cristianvijelie@gmail.com>
 <20200821104709.50778-2-cristianvijelie@gmail.com>
From: Simon Kuenzer <simon.kuenzer@neclab.eu>
Message-ID: <492b7a28-409e-652f-3f5e-b12c6da4aedd@neclab.eu>
Date: Fri, 21 Aug 2020 13:12:27 +0200
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:68.0)
 Gecko/20100101 Thunderbird/68.11.0
MIME-Version: 1.0
In-Reply-To: <20200821104709.50778-2-cristianvijelie@gmail.com>
Content-Type: text/plain; charset="utf-8"; format=flowed
Content-Language: en-US
Content-Transfer-Encoding: 7bit
X-Originating-IP: [192.168.24.96]
X-ClientProxiedBy: oberon.office.hd (192.168.24.90) To puck.office.hd
 (192.168.24.91)
X-BeenThere: minios-devel@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Mini-os development list <minios-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:minios-devel@lists.xenproject.org>
List-Help: <mailto:minios-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: minios-devel-bounces@lists.xenproject.org
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>

Hi Christian,

thanks for the update. Two minor comments... ;-)

Thanks,

Simon

On 21.08.20 12:47, cristianvijelie@gmail.com wrote:
> From: Cristian Vijelie <cristianvijelie@gmail.com>
> 
> Signed-off-by: Cristian Vijelie <cristianvijelie@gmail.com>
> ---
>   include/uk/isr/string.h |  72 ++++++++++
>   lib/isrlib/Config.uk    |   3 +
>   lib/isrlib/Makefile.uk  |   3 +
>   lib/isrlib/string.c     | 299 ++++++++++++++++++++++++++++++++++++++++
>   4 files changed, 377 insertions(+)
>   create mode 100644 include/uk/isr/string.h
>   create mode 100644 lib/isrlib/Config.uk
>   create mode 100644 lib/isrlib/Makefile.uk
>   create mode 100644 lib/isrlib/string.c
> 
> diff --git a/include/uk/isr/string.h b/include/uk/isr/string.h
> new file mode 100644
> index 0000000..bcf9fef
> --- /dev/null
> +++ b/include/uk/isr/string.h
> @@ -0,0 +1,72 @@
> +/* SPDX-License-Identifier: BSD-3-Clause */
> +/*
> + * Authors: Simon Kuenzer <simon.kuenzer@neclab.eu>
> + *          Cristian Vijelie <cristianvijelie@gmail.com>
> + *
> + *
> + * Copyright (c) 2017, NEC Europe Ltd., NEC Corporation. All rights reserved.
> + * Copyright (c) 2020, University Politehnica of Bucharest. All rights reserved.
> + *
> + * Redistribution and use in source and binary forms, with or without
> + * modification, are permitted provided that the following conditions
> + * are met:
> + *
> + * 1. Redistributions of source code must retain the above copyright
> + *    notice, this list of conditions and the following disclaimer.
> + * 2. Redistributions in binary form must reproduce the above copyright
> + *    notice, this list of conditions and the following disclaimer in the
> + *    documentation and/or other materials provided with the distribution.
> + * 3. Neither the name of the copyright holder nor the names of its
> + *    contributors may be used to endorse or promote products derived from
> + *    this software without specific prior written permission.
> + *
> + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
> + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
> + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
> + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
> + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
> + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
> + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
> + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
> + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
> + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
> + * POSSIBILITY OF SUCH DAMAGE.
> + *
> + */
> +
> +#ifndef __UK_ISR_STRING_H__
> +#define __UK_ISR_STRING_H__
> +
> +#ifdef __cplusplus
> +extern "C" {
> +#endif
> +
> +#include <string.h>
> +
> +void *memcpy_isr(void *dst, const void *src, size_t len);
> +void *memset_isr(void *ptr, int val, size_t len);
> +void *memchr_isr(const void *ptr, int val, size_t len);
> +void *memrchr_isr(const void *m, int c, size_t n);
> +int memcmp_isr(const void *ptr1, const void *ptr2, size_t len);
> +void *memmove_isr(void *dst, const void *src, size_t len);
> +
> +char *strncpy_isr(char *dst, const char *src, size_t len);
> +char *strcpy_isr(char *dst, const char *src);
> +size_t strlcpy_isr(char *d, const char *s, size_t n);
> +size_t strlcat_isr(char *d, const char *s, size_t n);
> +size_t strnlen_isr(const char *str, size_t maxlen);
> +size_t strlen_isr(const char *str);
> +char *strchrnul_isr(const char *s, int c);
> +char *strchr_isr(const char *str, int c);
> +char *strrchr_isr(const char *s, int c);
> +int strncmp_isr(const char *str1, const char *str2, size_t len);
> +int strcmp_isr(const char *str1, const char *str2);
> +size_t strcspn_isr(const char *s, const char *c);
> +size_t strspn_isr(const char *s, const char *c);
> +char *strtok_isr(char *restrict s, const char *restrict sep, char **restrict p);
> +
> +#ifdef __cplusplus
> +}
> +#endif
> +
> +#endif /* __UK_ISR_STRING_H__ */
> diff --git a/lib/isrlib/Config.uk b/lib/isrlib/Config.uk
> new file mode 100644
> index 0000000..60b4274
> --- /dev/null
> +++ b/lib/isrlib/Config.uk
> @@ -0,0 +1,3 @@
> +config LIBISRLIB
> +    bool "isrlib: ISR helper library"
> +    default n
> diff --git a/lib/isrlib/Makefile.uk b/lib/isrlib/Makefile.uk
> new file mode 100644
> index 0000000..df3616d
> --- /dev/null
> +++ b/lib/isrlib/Makefile.uk
> @@ -0,0 +1,3 @@
> +$(eval $(call addlib_s,libisrlib,$(CONFIG_LIBISRLIB)))
> +

Include folder?

> +LIBISRLIB_SRCS-y += $(LIBISRLIB_BASE)/string.c|isr
> diff --git a/lib/isrlib/string.c b/lib/isrlib/string.c
> new file mode 100644
> index 0000000..ea38e2f
> --- /dev/null
> +++ b/lib/isrlib/string.c
> @@ -0,0 +1,299 @@
> +/* SPDX-License-Identifier: BSD-3-Clause */
> +/*
> + * Authors: Cristian Vijelie <cristianvijelie@gmail.com>
> + *
> + *
> + * Copyright (c) 2020, University Politehnica of Bucharest. All rights reserved.
> + *
> + * Redistribution and use in source and binary forms, with or without
> + * modification, are permitted provided that the following conditions
> + * are met:
> + *
> + * 1. Redistributions of source code must retain the above copyright
> + *    notice, this list of conditions and the following disclaimer.
> + * 2. Redistributions in binary form must reproduce the above copyright
> + *    notice, this list of conditions and the following disclaimer in the
> + *    documentation and/or other materials provided with the distribution.
> + * 3. Neither the name of the copyright holder nor the names of its
> + *    contributors may be used to endorse or promote products derived from
> + *    this software without specific prior written permission.
> + *
> + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
> + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
> + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
> + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
> + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
> + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
> + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
> + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
> + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
> + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
> + * POSSIBILITY OF SUCH DAMAGE.
> + *
> + */

Please keep the headers from the original string.c from nolibc. You got 
the code from there and we have even code from musl here.

> +
> +#include <uk/isr/string.h>
> +#include <uk/arch/types.h>
> +#include <stdint.h>
> +#include <limits.h>
> +
> +void *memcpy_isr(void *dst, const void *src, size_t len)
> +{
> +	size_t p;
> +
> +	for (p = 0; p < len; ++p)
> +		*((__u8 *)(((__uptr)dst) + p)) = *((__u8 *)(((__uptr)src) + p));
> +
> +	return dst;
> +}
> +
> +void *memset_isr(void *ptr, int val, size_t len)
> +{
> +	__u8 *p = (__u8 *) ptr;
> +
> +	for (; len > 0; --len)
> +		*(p++) = (__u8)val;
> +
> +	return ptr;
> +}
> +
> +void *memchr_isr(const void *ptr, int val, size_t len)
> +{
> +	uintptr_t o = 0;
> +
> +	for (o = 0; o < (uintptr_t)len; ++o)
> +		if (*((const uint8_t *)(((uintptr_t)ptr) + o)) == (uint8_t)val)
> +			return (void *)((uintptr_t)ptr + o);
> +
> +	return NULL; /* did not find val */
> +}
> +
> +void *memrchr_isr(const void *m, int c, size_t n)
> +{
> +	const unsigned char *s = m;
> +
> +	c = (unsigned char) c;
> +	while (n--)
> +		if (s[n] == c)
> +			return (void *) (s + n);
> +	return 0;
> +}
> +
> +void *memmove_isr(void *dst, const void *src, size_t len)
> +{
> +	uint8_t *d = dst;
> +	const uint8_t *s = src;
> +
> +	if (src > dst) {
> +		for (; len > 0; --len)
> +			*(d++) = *(s++);
> +	} else {
> +		s += len;
> +		d += len;
> +
> +		for (; len > 0; --len)
> +			*(d--) = *(s--);
> +	}
> +
> +	return dst;
> +}
> +
> +int memcmp_isr(const void *ptr1, const void *ptr2, size_t len)
> +{
> +	const unsigned char *c1 = (const unsigned char *)ptr1;
> +	const unsigned char *c2 = (const unsigned char *)ptr2;
> +
> +	for (; len > 0; --len, ++c1, ++c2) {
> +		if ((*c1) != (*c2))
> +			return ((*c1) - (*c2));
> +	}
> +
> +	return 0;
> +}
> +
> +size_t strlen_isr(const char *str)
> +{
> +	return strnlen_isr(str, SIZE_MAX);
> +}
> +
> +size_t strnlen_isr(const char *str, size_t len)
> +{
> +	const char *p = memchr_isr(str, 0, len);
> +	return p ? (size_t) (p - str) : len;
> +}
> +
> +char *strncpy_isr(char *dst, const char *src, size_t len)
> +{
> +	size_t clen;
> +
> +	clen = strnlen_isr(src, len);
> +	memcpy_isr(dst, src, clen);
> +
> +	/* instead of filling up the rest of left space with zeros,
> +	 * append a termination character if we did not copy one
> +	 */
> +	if (clen < len && dst[clen - 1] != '\0')
> +		dst[clen] = '\0';
> +	return dst;
> +}
> +
> +char *strcpy_isr(char *dst, const char *src)
> +{
> +	return strncpy_isr(dst, src, SIZE_MAX);
> +}
> +
> +int strncmp_isr(const char *str1, const char *str2, size_t len)
> +{
> +	const char *c1 = (const char *)str1;
> +	const char *c2 = (const char *)str2;
> +
> +	for (; len > 0; --len, ++c1, ++c2) {
> +		if ((*c1) != (*c2))
> +			return (int)((*c1) - (*c2));
> +		if ((*c1) == '\0')
> +			break;
> +	}
> +	return 0;
> +}
> +
> +int strcmp_isr(const char *str1, const char *str2)
> +{
> +	register signed char __res;
> +
> +	while ((__res = *str1 - *str2++) == 0 && *str1++)
> +		;
> +
> +	return __res;
> +}
> +
> +/* The following code is taken from musl libc */
> +#define ALIGN (sizeof(size_t))
> +#define ONES ((size_t) -1 / UCHAR_MAX)
> +#define HIGHS (ONES * (UCHAR_MAX / 2 + 1))
> +#define HASZERO(x) (((x) - ONES) & ~(x) & HIGHS)
> +#define BITOP(a, b, op) \
> +		((a)[(size_t)(b) / (8*sizeof *(a))] op \
> +		(size_t)1 << ((size_t)(b) % (8 * sizeof *(a))))
> +
> +char *strchrnul_isr(const char *s, int c)
> +{
> +	size_t *w, k;
> +
> +	c = (unsigned char)c;
> +	if (!c)
> +		return (char *)s + strlen_isr(s);
> +
> +	for (; (uintptr_t)s % ALIGN; s++)
> +		if (!*s || *(unsigned char *)s == c)
> +			return (char *)s;
> +	k = ONES * c;
> +	for (w = (void *)s; !HASZERO(*w) && !HASZERO(*w ^ k); w++)
> +		;
> +	for (s = (void *)w; *s && *(unsigned char *)s != c; s++)
> +		;
> +	return (char *)s;
> +}
> +
> +char *strchr_isr(const char *str, int c)
> +{
> +	char *r = strchrnul_sr(str, c);
> +	return *(unsigned char *)r == (unsigned char)c ? r : 0;
> +}
> +
> +char *strrchr_isr(const char *s, int c)
> +{
> +	return memrchr_isr(s, c, strlen_isr(s) + 1);
> +}
> +
> +size_t strcspn_isr(const char *s, const char *c)
> +{
> +	const char *a = s;
> +	size_t byteset[32 / sizeof(size_t)];
> +
> +	if (!c[0] || !c[1])
> +		return strchrnul_isr(s, *c)-a;
> +
> +	memset_isr(byteset, 0, sizeof(byteset));
> +	for (; *c && BITOP(byteset, *(unsigned char *)c, |=); c++)
> +		;
> +	for (; *s && !BITOP(byteset, *(unsigned char *)s, &); s++)
> +		;
> +	return s-a;
> +}
> +
> +size_t strspn_isr(const char *s, const char *c)
> +{
> +	const char *a = s;
> +	size_t byteset[32 / sizeof(size_t)] = { 0 };
> +
> +	if (!c[0])
> +		return 0;
> +	if (!c[1]) {
> +		for (; *s == *c; s++)
> +			;
> +		return s-a;
> +	}
> +
> +	for (; *c && BITOP(byteset, *(unsigned char *)c, |=); c++)
> +		;
> +	for (; *s && BITOP(byteset, *(unsigned char *)s, &); s++)
> +		;
> +	return s-a;
> +}
> +
> +char *strtok_isr(char *restrict s, const char *restrict sep, char **restrict p)
> +{
> +	if (!s && !(s = *p))
> +		return NULL;
> +	s += strspn_isr(s, sep);
> +	if (!*s)
> +		return *p = 0;
> +	*p = s + strcspn_isr(s, sep);
> +	if (**p)
> +		*(*p)++ = 0;
> +	else
> +		*p = 0;
> +	return s;
> +}
> +
> +/* strlcpy has different ALIGN */
> +#undef ALIGN
> +#define ALIGN (sizeof(size_t)-1)
> +size_t strlcpy_isr(char *d, const char *s, size_t n)
> +{
> +	char *d0 = d;
> +	size_t *wd;
> +	const size_t *ws;
> +
> +	if (!n--)
> +		goto finish;
> +
> +	if (((uintptr_t)s & ALIGN) == ((uintptr_t)d & ALIGN)) {
> +		for (; ((uintptr_t) s & ALIGN) && n && (*d = *s);
> +		     n--, s++, d++)
> +			;
> +
> +		if (n && *s) {
> +			wd = (void *)d; ws = (const void *)s;
> +			for (; n >= sizeof(size_t) && !HASZERO(*ws);
> +			     n -= sizeof(size_t), ws++, wd++)
> +				*wd = *ws;
> +
> +			d = (void *)wd; s = (const void *)ws;
> +		}
> +	}
> +
> +	for (; n && (*d = *s); n--, s++, d++)
> +		;
> +	*d = 0;
> +finish:
> +	return d-d0 + strlen_isr(s);
> +}
> +
> +size_t strlcat_isr(char *d, const char *s, size_t n)
> +{
> +	size_t l = strnlen_isr(d, n);
> +	if (l == n)
> +		return l + strlen_isr(s);
> +	return l + strlcpy_isr(d+l, s, n-l);
> +}
> 


From minios-devel-bounces@lists.xenproject.org Fri Aug 21 11:25:02 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Fri, 21 Aug 2020 11:25:02 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1k95AK-0005cl-LV; Fri, 21 Aug 2020 11:25:00 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=4ar4=B7=cs.pub.ro=costin.lupu@srs-us1.protection.inumbo.net>)
 id 1k95AI-0005cg-MW
 for minios-devel@lists.xen.org; Fri, 21 Aug 2020 11:24:58 +0000
X-Inumbo-ID: c79a2b63-a715-4229-8f65-07e12e937e4f
Received: from mx.upb.ro (unknown [141.85.13.220])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id c79a2b63-a715-4229-8f65-07e12e937e4f;
 Fri, 21 Aug 2020 11:24:56 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
 by mx.upb.ro (Postfix) with ESMTP id 99A4AB561D39;
 Fri, 21 Aug 2020 14:24:55 +0300 (EEST)
Received: from mx.upb.ro ([127.0.0.1])
 by localhost (mx.upb.ro [127.0.0.1]) (amavisd-new, port 10032)
 with ESMTP id JhQxG2LCLbKh; Fri, 21 Aug 2020 14:24:51 +0300 (EEST)
Received: from localhost (localhost [127.0.0.1])
 by mx.upb.ro (Postfix) with ESMTP id D903DB561D1A;
 Fri, 21 Aug 2020 14:24:51 +0300 (EEST)
X-Virus-Scanned: amavisd-new at upb.ro
Received: from mx.upb.ro ([127.0.0.1])
 by localhost (mx.upb.ro [127.0.0.1]) (amavisd-new, port 10026)
 with ESMTP id AkXfr40Q-n4K; Fri, 21 Aug 2020 14:24:51 +0300 (EEST)
Received: from [192.168.1.35] (unknown [188.25.162.205])
 by mx.upb.ro (Postfix) with ESMTPSA id 7B723B561D40;
 Fri, 21 Aug 2020 14:24:51 +0300 (EEST)
Subject: Re: [UNIKRAFT PATCH v4 10/12] plat/xen/drivers/net: Add transmit
 operation
To: Simon Kuenzer <simon.kuenzer@neclab.eu>, minios-devel@lists.xen.org
Cc: sharan.santhanam@neclab.eu, Razvan Cojocaru <razvan.cojocaru93@gmail.com>
References: <20200813085342.29799-1-costin.lupu@cs.pub.ro>
 <20200813085342.29799-11-costin.lupu@cs.pub.ro>
 <494d8796-a3e0-a3d5-df36-6343df10d571@neclab.eu>
 <c71f09f9-79b7-816f-bced-a190ed6665fc@cs.pub.ro>
 <726dd84d-33cb-877f-3e22-a5d92870ac35@neclab.eu>
From: Costin Lupu <costin.lupu@cs.pub.ro>
Message-ID: <06f26c34-1a23-6fae-d5ba-46b4b49dfc13@cs.pub.ro>
Date: Fri, 21 Aug 2020 14:24:51 +0300
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101
 Thunderbird/68.11.0
MIME-Version: 1.0
In-Reply-To: <726dd84d-33cb-877f-3e22-a5d92870ac35@neclab.eu>
Content-Type: text/plain; charset=utf-8
Content-Language: en-US
Content-Transfer-Encoding: quoted-printable
X-BeenThere: minios-devel@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Mini-os development list <minios-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:minios-devel@lists.xenproject.org>
List-Help: <mailto:minios-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: minios-devel-bounces@lists.xenproject.org
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>

On 8/21/20 1:49 PM, Simon Kuenzer wrote:
> On 21.08.20 11:32, Costin Lupu wrote:
>> On 8/20/20 6:49 PM, Simon Kuenzer wrote:
>>> On 13.08.20 10:53, Costin Lupu wrote:
>>>> Whenever a packet is transmitted, the request describing it is writt=
en
>>>> in the
>>>> shared ring. The packet itself is written in a page referenced by th=
e
>>>> request
>>>> and shared, as well, with the backend. At the end of each transmit
>>>> operation, a
>>>> cleanup operation is performed free'ing the resources allocated for =
the
>>>> previously transmitted packets.
>>>>
>>>> Signed-off-by: Costin Lupu <costin.lupu@cs.pub.ro>
>>>> Signed-off-by: Razvan Cojocaru <razvan.cojocaru93@gmail.com>
>>>> ---
>>>> =C2=A0=C2=A0 plat/xen/drivers/net/netfront.c | 102
>>>> ++++++++++++++++++++++++++++++++
>>>> =C2=A0=C2=A0 1 file changed, 102 insertions(+)
>>>>
>>>> diff --git a/plat/xen/drivers/net/netfront.c
>>>> b/plat/xen/drivers/net/netfront.c
>>>> index 858d124a..f2b81329 100644
>>>> --- a/plat/xen/drivers/net/netfront.c
>>>> +++ b/plat/xen/drivers/net/netfront.c
>>>> @@ -39,6 +39,7 @@
>>>> =C2=A0=C2=A0 #include <uk/alloc.h>
>>>> =C2=A0=C2=A0 #include <uk/netdev_driver.h>
>>>> =C2=A0=C2=A0 #include <xen-x86/mm.h>
>>>> +#include <xen-x86/irq.h>
>>>> =C2=A0=C2=A0 #include <xenbus/xenbus.h>
>>>> =C2=A0=C2=A0 #include "netfront.h"
>>>> =C2=A0=C2=A0 #include "netfront_xb.h"
>>>> @@ -78,6 +79,106 @@ static uint16_t get_id_from_freelist(uint16_t
>>>> *freelist)
>>>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 return id;
>>>> =C2=A0=C2=A0 }
>>>> =C2=A0=C2=A0 +static int network_tx_buf_gc(struct uk_netdev_tx_queue=
 *txq)
>>>> +{
>>>> +=C2=A0=C2=A0=C2=A0 RING_IDX prod, cons;
>>>> +=C2=A0=C2=A0=C2=A0 netif_tx_response_t *tx_rsp;
>>>> +=C2=A0=C2=A0=C2=A0 uint16_t id;
>>>> +=C2=A0=C2=A0=C2=A0 bool more_to_do;
>>>> +=C2=A0=C2=A0=C2=A0 int count =3D 0;
>>>> +
>>>> +=C2=A0=C2=A0=C2=A0 do {
>>>> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 prod =3D txq->ring.sring=
->rsp_prod;
>>>> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 rmb(); /* Ensure we see =
responses up to 'rp'. */
>>>> +
>>>> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 for (cons =3D txq->ring.=
rsp_cons; cons !=3D prod; cons++) {
>>>> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 =
tx_rsp =3D RING_GET_RESPONSE(&txq->ring, cons);
>>>> +
>>>> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 =
if (tx_rsp->status =3D=3D NETIF_RSP_NULL)
>>>> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=
=A0=C2=A0=C2=A0=C2=A0 continue;
>>>> +
>>>> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 =
if (tx_rsp->status =3D=3D NETIF_RSP_ERROR)
>>>> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=
=A0=C2=A0=C2=A0=C2=A0 uk_pr_err("packet error\n");
>>>
>>> "netdev%u: Transmission error on txq %u\n" ?
>>>
>>
>> Ack.
>>
>>>> +
>>>> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 =
id=C2=A0 =3D tx_rsp->id;
>>>> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 =
UK_ASSERT(id < NET_TX_RING_SIZE);
>>>> +
>>>> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 =
gnttab_end_access(txq->gref[id]);
>>>> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 =
txq->gref[id] =3D GRANT_INVALID_REF;
>>>> +
>>>> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 =
add_id_to_freelist(id, txq->freelist);
>>>> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 =
uk_semaphore_up(&txq->sem);
>>>> +
>>>> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 =
count++;
>>>> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 }
>>>> +
>>>> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 txq->ring.rsp_cons =3D p=
rod;
>>>> +
>>>> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 RING_FINAL_CHECK_FOR_RES=
PONSES(&txq->ring, more_to_do);
>>>> +=C2=A0=C2=A0=C2=A0 } while (more_to_do);
>>>> +
>>>> +=C2=A0=C2=A0=C2=A0 return count;
>>>> +}
>>>> +
>>>> +static int netfront_xmit(struct uk_netdev *n,
>>>> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 struct uk_netdev_tx_queu=
e *txq,
>>>> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 struct uk_netbuf *pkt)
>>>> +{
>>>> +=C2=A0=C2=A0=C2=A0 struct netfront_dev *nfdev;
>>>> +=C2=A0=C2=A0=C2=A0 unsigned long flags;
>>>> +=C2=A0=C2=A0=C2=A0 uint16_t id;
>>>> +=C2=A0=C2=A0=C2=A0 RING_IDX req_prod;
>>>> +=C2=A0=C2=A0=C2=A0 netif_tx_request_t *tx_req;
>>>> +=C2=A0=C2=A0=C2=A0 int notify;
>>>> +=C2=A0=C2=A0=C2=A0 int status =3D 0, count;
>>>> +
>>>> +=C2=A0=C2=A0=C2=A0 UK_ASSERT(n !=3D NULL);
>>>> +=C2=A0=C2=A0=C2=A0 UK_ASSERT(txq !=3D NULL);
>>>> +=C2=A0=C2=A0=C2=A0 UK_ASSERT(pkt !=3D NULL);
>>>> +=C2=A0=C2=A0=C2=A0 UK_ASSERT(pkt->len < PAGE_SIZE);
>>>> +
>>>> +=C2=A0=C2=A0=C2=A0 nfdev =3D to_netfront_dev(n);
>>>> +
>>>> +=C2=A0=C2=A0=C2=A0 /* get request id */
>>>> +=C2=A0=C2=A0=C2=A0 uk_semaphore_down(&txq->sem);
>>>> +=C2=A0=C2=A0=C2=A0 local_irq_save(flags);
>>>> +=C2=A0=C2=A0=C2=A0 id =3D get_id_from_freelist(txq->freelist);
>>>
>>> What happens when we are out of space and the ring is full?
>>> The xmit function should be non-blocking so that we can use it in
>>> polling mode. We should return in such a case that the transmission
>>> queue is currently full...
>>>
>>
>> Ack.
>>
>>>> +=C2=A0=C2=A0=C2=A0 local_irq_restore(flags);
>>>> +
>>>> +=C2=A0=C2=A0=C2=A0 /* get request */
>>>> +=C2=A0=C2=A0=C2=A0 req_prod =3D txq->ring.req_prod_pvt;
>>>> +=C2=A0=C2=A0=C2=A0 tx_req =3D RING_GET_REQUEST(&txq->ring, req_prod=
); > +
>>>> +=C2=A0=C2=A0=C2=A0 /* setup grant for buffer data */
>>>> +=C2=A0=C2=A0=C2=A0 txq->gref[id] =3D tx_req->gref =3D
>>>> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 gnttab_grant_access(nfde=
v->xendev->otherend_id,
>>>> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 =
virt_to_mfn(pkt->data), 1);
>>>> +=C2=A0=C2=A0=C2=A0 UK_ASSERT(tx_req->gref !=3D GRANT_INVALID_REF);
>>>> +
>>>> +=C2=A0=C2=A0=C2=A0 tx_req->offset =3D 0;
>>>> +=C2=A0=C2=A0=C2=A0 tx_req->size =3D (uint16_t) pkt->len;
>>>> +=C2=A0=C2=A0=C2=A0 tx_req->flags =3D 0;
>>>> +=C2=A0=C2=A0=C2=A0 tx_req->id =3D id;
>>>> +
>>>> +=C2=A0=C2=A0=C2=A0 txq->ring.req_prod_pvt =3D req_prod + 1;
>>>> +=C2=A0=C2=A0=C2=A0 wmb(); /* Ensure backend sees requests */
>>>> +
>>>> +=C2=A0=C2=A0=C2=A0 RING_PUSH_REQUESTS_AND_CHECK_NOTIFY(&txq->ring, =
notify);
>>>> +=C2=A0=C2=A0=C2=A0 if (notify)
>>>> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 notify_remote_via_evtchn=
(txq->evtchn); > +
>>>> +=C2=A0=C2=A0=C2=A0 status |=3D UK_NETDEV_STATUS_SUCCESS;
>>>> +
>>>> +=C2=A0=C2=A0=C2=A0 /* some cleanup */
>>>> +=C2=A0=C2=A0=C2=A0 local_irq_save(flags);
>>>> +=C2=A0=C2=A0=C2=A0 count =3D network_tx_buf_gc(txq);
>>>
>>> The clean-up should happen before enqueuing the given packet to the
>>> transmit queue, it is the first thing of xmit(). Since we anyway need=
 to
>>> do it and we do not have an advantage by delaying this operation.
>>
>> Of course there is an advantage. You push the packets in order for the=
m
>> to be processed ASAP by the backend and deal with cleaning up
>> afterwards. It's a kind of parallelization. Otherwise you would delay
>> the transmissions.
>>
>>> We can also deal much better with full rings. Otherwise we
>>> unnecessarily drop a packets for transmission although there would
>>> have been space when clean-up finished. After calling cleaning you
>>> can check if there is space on the ring and return if we run out of
>>> it (use an `unlikely` to the condition so that we speed up the
>>> successful sending case).
>>>
>>
>> The only scenario when this would solve anything would be when you hav=
e
>> the ring full and just before you decide to send a new packet the
>> backend starts processing your previous transmitted packets, leaving y=
ou
>> at least one free slot. There are 2 unlikely events here: first, the
>> ring is full, and second, the backend starts to process again when the
>> ring gets full (for the latter event, it's unlikely that the backend
>> will wake up given that it couldn't process 256 transmitted packets,
>> where 256 is the current number of slots). And for this very unlikely
>> context you would introduce a delay for all the transmissions if we
>> followed your suggestion.
>>
>> Anyway, both Linux and FreeBSD do the cleanup after pushing the
>> requests, so I don't think we have much more to say about this.
>>
>=20
> Hum... I double-checked with Intel DPDK's ixgbe (10 Gig) driver:
>=20
> http://git.dpdk.org/dpdk-stable/tree/drivers/net/ixgbe/ixgbe_rxtx.c?h=3D=
20.02#n230
>=20
>=20
> They clean the slots before sending. I derived my conclusion from there=
.
> However I noticed now that there is one minor difference: They do both =
-
> cleanup and enqueuing - before they notify the card about changes on th=
e
> ring. In that case it does not add any delay if you swap the order of
> cleanup and enqueuing. In your case this is probably different because
> you can cleanup without notifying. Here, I agree with you that we add
> unnecessary xmit delays by swapping the order.
>=20

ixgbe is a native driver, so there is no backend driver in that case.
It's a different scenario.

> However and in general, having a full ring is not an uncommon and
> unlikely case. To my experience, this can already happen with a single
> TCP connection if your network stack is feeding next packets fast enoug=
h
> and if the current TCP window allows to send them. It also depends on
> when the driver domain is scheduled; on which CPU core your netfront
> domain and the driver domain sit; and even on the underlying physical
> device that might be busy with other traffic.
>=20

What I tried to say with the events probabilities explanation is that
you add delay for the common case in order to remove delay for the much
less probable corner case.

> Another thing we are having in mind for uknetdev - and this is probably
> different to Linux/BSD's implementation - we plan to change the xmit
> function to do batching (as DPDK does). Sharan could push virtio-net
> performance further with this. You are able to reduce the number of
> notifies to the backend because you enqueue multiple packets at once an=
d
> due to locality of batching you can utilize CPU caches ways better.
>=20
> What about this idea for netfront: We could do first a check for
> available space and - if needed - clean-up just as many extra slots tha=
t
> you need to complete the transmission (for now this is anyways just one
> slot). Then we proceed with enqueuing and do the cleanup of the rest of
> the slots after we notified the backend. What do you think?
>=20

This will stay just as it is for the current patches. Feel free to
change anything after upstreaming these patches.

>>
>> Btw, I'm waiting for reviews on the other patches as well before I sen=
d
>> the v5.
>=20
> Yes, sure.
>=20
>>
>>
>>>> +=C2=A0=C2=A0=C2=A0 local_irq_restore(flags);
>>>> +
>>>> +=C2=A0=C2=A0=C2=A0 status |=3D likely(count > 0) ? UK_NETDEV_STATUS=
_MORE : 0x0;
>>>> +
>>>> +=C2=A0=C2=A0=C2=A0 return status;
>>>> +}
>>>> +
>>>> =C2=A0=C2=A0 static int netfront_rxq_enqueue(struct uk_netdev_rx_que=
ue *rxq,
>>>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 struct =
uk_netbuf *netbuf)
>>>> =C2=A0=C2=A0 {
>>>> @@ -598,6 +699,7 @@ static int netfront_add_dev(struct xenbus_device
>>>> *xendev)
>>>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 }
>>>> =C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 /* register netdev */
>>>> +=C2=A0=C2=A0=C2=A0 nfdev->netdev.tx_one =3D netfront_xmit;
>>>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 nfdev->netdev.ops =3D &netfront=
_ops;
>>>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 rc =3D uk_netdev_drv_register(&=
nfdev->netdev, drv_allocator,
>>>> DRIVER_NAME);
>>>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 if (rc < 0) {
>>>>
>>>
>=20
> Thanks,
>=20
> Simon
>=20


From minios-devel-bounces@lists.xenproject.org Fri Aug 21 11:38:14 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Fri, 21 Aug 2020 11:38:14 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1k95N5-0006Ys-HB; Fri, 21 Aug 2020 11:38:11 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=50MG=B7=gmail.com=cristianvijelie@srs-us1.protection.inumbo.net>)
 id 1k95N3-0006Yn-J5
 for minios-devel@lists.xen.org; Fri, 21 Aug 2020 11:38:09 +0000
X-Inumbo-ID: 6a6c81b6-d74e-42f6-8476-eab349bc419c
Received: from mail-ej1-x62a.google.com (unknown [2a00:1450:4864:20::62a])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 6a6c81b6-d74e-42f6-8476-eab349bc419c;
 Fri, 21 Aug 2020 11:38:07 +0000 (UTC)
Received: by mail-ej1-x62a.google.com with SMTP id o23so1934568ejr.1
 for <minios-devel@lists.xen.org>; Fri, 21 Aug 2020 04:38:07 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=from:to:subject:date:message-id:mime-version
 :content-transfer-encoding;
 bh=fJsYLR4D0SwmU0bOTtfrnPzHd3lGX989gz4noBLpvZU=;
 b=oZ8C9mjN0We4CnIPp9+UOXhZOSYxDVrAtrp553iLeI8S4/zK04rG+KYimrgWa09pnS
 p4MevsaNVOUSLRjHAyL/efRHCVxE1yd42EutHqo0LlHVJUAYRzw7JS/9/l4DUl+d4u54
 BsSZGutbOdg+N6hthUa+/RoBAGaBnKxqRUBeaLvgzo/QKcRWQk6R5cYz6fXMGqsMMHL1
 rIIE8VoOrGqCIRhKbQ2ToTnrk9puM8e8WZMEYEkKC6H6scR4Abv9QH8EaxscUp2I7QzS
 EUq59bEH2InXcWjt89CMWCUofErNy0jDNYhtyZuFJy8VYaiF7GiBsL8amZoqVUhoOJ7v
 k/8g==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:to:subject:date:message-id:mime-version
 :content-transfer-encoding;
 bh=fJsYLR4D0SwmU0bOTtfrnPzHd3lGX989gz4noBLpvZU=;
 b=Lzd4HzEWNi/zzk05DW+gD1n4R4mbfTs5rLwu7glDYxGCxJvvjFN8foGwxjP6is5mFQ
 un+ESckRXEvVpoxdAsWFNpUulcD0z2aov1OmR4/d0qX51fmaJJZqOVAr17/qcAXT28ix
 TK3eD8cQ4uZ1GhBIiisIViDuXHKt98UFuLikp8Y1cRKuIuddTfc6kD3t8uI+pJa5OYBz
 Q9Z2DZiJzCkzqlG96QpVHe7lQBl7cKats1Aql2HJD5+GwY4O6ZYssVg013iG2ripPlw7
 59fMwGmSei1ck7ruN0OOSulggIOWKZ1pOPg0cW2w9I2EQ1d7tWG6Y1u3uZx49pm6aLdn
 M0RQ==
X-Gm-Message-State: AOAM533PiKwEj/SwOLhT22WM+VDlqDNqoAikuVEbt0shRpAzgl2IzYFo
 Moy4AuSUbto63ue8UMxmFXaJIyn93og=
X-Google-Smtp-Source: ABdhPJxrDYCtu0tqOTv71vCIzY0ODWBBTUgD9qu39f8TQiIRI7+KEBvyND2l4b4tvFpJahDqd10llA==
X-Received: by 2002:a17:906:cc4a:: with SMTP id
 mm10mr2249931ejb.451.1598009886157; 
 Fri, 21 Aug 2020 04:38:06 -0700 (PDT)
Received: from localhost.localdomain ([2a00:5dc0:ffff:0:1d80:4338:662b:feac])
 by smtp.gmail.com with ESMTPSA id
 oq13sm1148473ejb.33.2020.08.21.04.38.05
 for <minios-devel@lists.xen.org>
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Fri, 21 Aug 2020 04:38:05 -0700 (PDT)
From: cristianvijelie@gmail.com
To: minios-devel@lists.xen.org
Subject: [[UNIKRAFT PATCH] v3 1/1] lib/isrlib: Introduce libc-like
 interrupt-context-safe routines
Date: Fri, 21 Aug 2020 14:38:04 +0300
Message-Id: <20200821113804.53313-1-cristianvijelie@gmail.com>
X-Mailer: git-send-email 2.25.1
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-BeenThere: minios-devel@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Mini-os development list <minios-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:minios-devel@lists.xenproject.org>
List-Help: <mailto:minios-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: minios-devel-bounces@lists.xenproject.org
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>

From: Cristian Vijelie <cristianvijelie@gmail.com>

libisr library means to introduce interrupt-context-safe routines, 
to be used in interrupt handlers and drivers. It is based on nolibc.

This patch adds the string functions for libisr.

Signed-off-by: Cristian Vijelie <cristianvijelie@gmail.com>
---
 include/uk/isr/string.h |  72 +++++++++
 lib/isrlib/Config.uk    |   3 +
 lib/isrlib/Makefile.uk  |   8 +
 lib/isrlib/string.c     | 324 ++++++++++++++++++++++++++++++++++++++++
 4 files changed, 407 insertions(+)
 create mode 100644 include/uk/isr/string.h
 create mode 100644 lib/isrlib/Config.uk
 create mode 100644 lib/isrlib/Makefile.uk
 create mode 100644 lib/isrlib/string.c

diff --git a/include/uk/isr/string.h b/include/uk/isr/string.h
new file mode 100644
index 0000000..bcf9fef
--- /dev/null
+++ b/include/uk/isr/string.h
@@ -0,0 +1,72 @@
+/* SPDX-License-Identifier: BSD-3-Clause */
+/*
+ * Authors: Simon Kuenzer <simon.kuenzer@neclab.eu>
+ *          Cristian Vijelie <cristianvijelie@gmail.com>
+ *
+ *
+ * Copyright (c) 2017, NEC Europe Ltd., NEC Corporation. All rights reserved.
+ * Copyright (c) 2020, University Politehnica of Bucharest. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the copyright holder nor the names of its
+ *    contributors may be used to endorse or promote products derived from
+ *    this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+#ifndef __UK_ISR_STRING_H__
+#define __UK_ISR_STRING_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <string.h>
+
+void *memcpy_isr(void *dst, const void *src, size_t len);
+void *memset_isr(void *ptr, int val, size_t len);
+void *memchr_isr(const void *ptr, int val, size_t len);
+void *memrchr_isr(const void *m, int c, size_t n);
+int memcmp_isr(const void *ptr1, const void *ptr2, size_t len);
+void *memmove_isr(void *dst, const void *src, size_t len);
+
+char *strncpy_isr(char *dst, const char *src, size_t len);
+char *strcpy_isr(char *dst, const char *src);
+size_t strlcpy_isr(char *d, const char *s, size_t n);
+size_t strlcat_isr(char *d, const char *s, size_t n);
+size_t strnlen_isr(const char *str, size_t maxlen);
+size_t strlen_isr(const char *str);
+char *strchrnul_isr(const char *s, int c);
+char *strchr_isr(const char *str, int c);
+char *strrchr_isr(const char *s, int c);
+int strncmp_isr(const char *str1, const char *str2, size_t len);
+int strcmp_isr(const char *str1, const char *str2);
+size_t strcspn_isr(const char *s, const char *c);
+size_t strspn_isr(const char *s, const char *c);
+char *strtok_isr(char *restrict s, const char *restrict sep, char **restrict p);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __UK_ISR_STRING_H__ */
diff --git a/lib/isrlib/Config.uk b/lib/isrlib/Config.uk
new file mode 100644
index 0000000..60b4274
--- /dev/null
+++ b/lib/isrlib/Config.uk
@@ -0,0 +1,3 @@
+config LIBISRLIB
+    bool "isrlib: ISR helper library"
+    default n
diff --git a/lib/isrlib/Makefile.uk b/lib/isrlib/Makefile.uk
new file mode 100644
index 0000000..26f19e8
--- /dev/null
+++ b/lib/isrlib/Makefile.uk
@@ -0,0 +1,8 @@
+$(eval $(call addlib_s,libisrlib,$(CONFIG_LIBISRLIB)))
+
+LIBISRLIB_GLOBAL_INCLUDES-y = $(LIBISRLIB_BASE)/include
+
+CINCLUDES-$(CONFIG_LIBISRLIB) += $(LIBISRLIB_GLOBAL_INCLUDES)
+CXXINCLUDES-$(CONFIG_LIBISRLIB) += $(LIBISRLIB_GLOBAL_INCLUDES)
+
+LIBISRLIB_SRCS-y += $(LIBISRLIB_BASE)/string.c|isr
diff --git a/lib/isrlib/string.c b/lib/isrlib/string.c
new file mode 100644
index 0000000..3080510
--- /dev/null
+++ b/lib/isrlib/string.c
@@ -0,0 +1,324 @@
+/* SPDX-License-Identifier: BSD-3-Clause AND MIT */
+/*
+ * Authors: Cristian Vijelie <cristianvijelie@gmail.com>
+ *
+ * Copyright (c) 2020, University Politehnica of Bucharest. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the copyright holder nor the names of its
+ *    contributors may be used to endorse or promote products derived from
+ *    this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ * THIS HEADER MAY NOT BE EXTRACTED OR MODIFIED IN ANY WAY.
+ */
+/* For the parts taken from musl (marked as such below), the MIT licence
+ * applies instead:
+ * ----------------------------------------------------------------------
+ * Copyright (c) 2005-2014 Rich Felker, et al.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ * ----------------------------------------------------------------------
+ */
+
+#include <uk/isr/string.h>
+#include <uk/arch/types.h>
+#include <stdint.h>
+#include <limits.h>
+
+void *memcpy_isr(void *dst, const void *src, size_t len)
+{
+	size_t p;
+
+	for (p = 0; p < len; ++p)
+		*((__u8 *)(((__uptr)dst) + p)) = *((__u8 *)(((__uptr)src) + p));
+
+	return dst;
+}
+
+void *memset_isr(void *ptr, int val, size_t len)
+{
+	__u8 *p = (__u8 *) ptr;
+
+	for (; len > 0; --len)
+		*(p++) = (__u8)val;
+
+	return ptr;
+}
+
+void *memchr_isr(const void *ptr, int val, size_t len)
+{
+	uintptr_t o = 0;
+
+	for (o = 0; o < (uintptr_t)len; ++o)
+		if (*((const uint8_t *)(((uintptr_t)ptr) + o)) == (uint8_t)val)
+			return (void *)((uintptr_t)ptr + o);
+
+	return NULL; /* did not find val */
+}
+
+void *memrchr_isr(const void *m, int c, size_t n)
+{
+	const unsigned char *s = m;
+
+	c = (unsigned char) c;
+	while (n--)
+		if (s[n] == c)
+			return (void *) (s + n);
+	return 0;
+}
+
+void *memmove_isr(void *dst, const void *src, size_t len)
+{
+	uint8_t *d = dst;
+	const uint8_t *s = src;
+
+	if (src > dst) {
+		for (; len > 0; --len)
+			*(d++) = *(s++);
+	} else {
+		s += len;
+		d += len;
+
+		for (; len > 0; --len)
+			*(d--) = *(s--);
+	}
+
+	return dst;
+}
+
+int memcmp_isr(const void *ptr1, const void *ptr2, size_t len)
+{
+	const unsigned char *c1 = (const unsigned char *)ptr1;
+	const unsigned char *c2 = (const unsigned char *)ptr2;
+
+	for (; len > 0; --len, ++c1, ++c2) {
+		if ((*c1) != (*c2))
+			return ((*c1) - (*c2));
+	}
+
+	return 0;
+}
+
+size_t strlen_isr(const char *str)
+{
+	return strnlen_isr(str, SIZE_MAX);
+}
+
+size_t strnlen_isr(const char *str, size_t len)
+{
+	const char *p = memchr_isr(str, 0, len);
+	return p ? (size_t) (p - str) : len;
+}
+
+char *strncpy_isr(char *dst, const char *src, size_t len)
+{
+	size_t clen;
+
+	clen = strnlen_isr(src, len);
+	memcpy_isr(dst, src, clen);
+
+	/* instead of filling up the rest of left space with zeros,
+	 * append a termination character if we did not copy one
+	 */
+	if (clen < len && dst[clen - 1] != '\0')
+		dst[clen] = '\0';
+	return dst;
+}
+
+char *strcpy_isr(char *dst, const char *src)
+{
+	return strncpy_isr(dst, src, SIZE_MAX);
+}
+
+int strncmp_isr(const char *str1, const char *str2, size_t len)
+{
+	const char *c1 = (const char *)str1;
+	const char *c2 = (const char *)str2;
+
+	for (; len > 0; --len, ++c1, ++c2) {
+		if ((*c1) != (*c2))
+			return (int)((*c1) - (*c2));
+		if ((*c1) == '\0')
+			break;
+	}
+	return 0;
+}
+
+int strcmp_isr(const char *str1, const char *str2)
+{
+	register signed char __res;
+
+	while ((__res = *str1 - *str2++) == 0 && *str1++)
+		;
+
+	return __res;
+}
+
+/* The following code is taken from musl libc */
+#define ALIGN (sizeof(size_t))
+#define ONES ((size_t) -1 / UCHAR_MAX)
+#define HIGHS (ONES * (UCHAR_MAX / 2 + 1))
+#define HASZERO(x) (((x) - ONES) & ~(x) & HIGHS)
+#define BITOP(a, b, op) \
+		((a)[(size_t)(b) / (8*sizeof *(a))] op \
+		(size_t)1 << ((size_t)(b) % (8 * sizeof *(a))))
+
+char *strchrnul_isr(const char *s, int c)
+{
+	size_t *w, k;
+
+	c = (unsigned char)c;
+	if (!c)
+		return (char *)s + strlen_isr(s);
+
+	for (; (uintptr_t)s % ALIGN; s++)
+		if (!*s || *(unsigned char *)s == c)
+			return (char *)s;
+	k = ONES * c;
+	for (w = (void *)s; !HASZERO(*w) && !HASZERO(*w ^ k); w++)
+		;
+	for (s = (void *)w; *s && *(unsigned char *)s != c; s++)
+		;
+	return (char *)s;
+}
+
+char *strchr_isr(const char *str, int c)
+{
+	char *r = strchrnul_sr(str, c);
+	return *(unsigned char *)r == (unsigned char)c ? r : 0;
+}
+
+char *strrchr_isr(const char *s, int c)
+{
+	return memrchr_isr(s, c, strlen_isr(s) + 1);
+}
+
+size_t strcspn_isr(const char *s, const char *c)
+{
+	const char *a = s;
+	size_t byteset[32 / sizeof(size_t)];
+
+	if (!c[0] || !c[1])
+		return strchrnul_isr(s, *c)-a;
+
+	memset_isr(byteset, 0, sizeof(byteset));
+	for (; *c && BITOP(byteset, *(unsigned char *)c, |=); c++)
+		;
+	for (; *s && !BITOP(byteset, *(unsigned char *)s, &); s++)
+		;
+	return s-a;
+}
+
+size_t strspn_isr(const char *s, const char *c)
+{
+	const char *a = s;
+	size_t byteset[32 / sizeof(size_t)] = { 0 };
+
+	if (!c[0])
+		return 0;
+	if (!c[1]) {
+		for (; *s == *c; s++)
+			;
+		return s-a;
+	}
+
+	for (; *c && BITOP(byteset, *(unsigned char *)c, |=); c++)
+		;
+	for (; *s && BITOP(byteset, *(unsigned char *)s, &); s++)
+		;
+	return s-a;
+}
+
+char *strtok_isr(char *restrict s, const char *restrict sep, char **restrict p)
+{
+	if (!s && !(s = *p))
+		return NULL;
+	s += strspn_isr(s, sep);
+	if (!*s)
+		return *p = 0;
+	*p = s + strcspn_isr(s, sep);
+	if (**p)
+		*(*p)++ = 0;
+	else
+		*p = 0;
+	return s;
+}
+
+/* strlcpy has different ALIGN */
+#undef ALIGN
+#define ALIGN (sizeof(size_t)-1)
+size_t strlcpy_isr(char *d, const char *s, size_t n)
+{
+	char *d0 = d;
+	size_t *wd;
+	const size_t *ws;
+
+	if (!n--)
+		goto finish;
+
+	if (((uintptr_t)s & ALIGN) == ((uintptr_t)d & ALIGN)) {
+		for (; ((uintptr_t) s & ALIGN) && n && (*d = *s);
+		     n--, s++, d++)
+			;
+
+		if (n && *s) {
+			wd = (void *)d; ws = (const void *)s;
+			for (; n >= sizeof(size_t) && !HASZERO(*ws);
+			     n -= sizeof(size_t), ws++, wd++)
+				*wd = *ws;
+
+			d = (void *)wd; s = (const void *)ws;
+		}
+	}
+
+	for (; n && (*d = *s); n--, s++, d++)
+		;
+	*d = 0;
+finish:
+	return d-d0 + strlen_isr(s);
+}
+
+size_t strlcat_isr(char *d, const char *s, size_t n)
+{
+	size_t l = strnlen_isr(d, n);
+	if (l == n)
+		return l + strlen_isr(s);
+	return l + strlcpy_isr(d+l, s, n-l);
+}
-- 
2.25.1



From minios-devel-bounces@lists.xenproject.org Fri Aug 21 13:04:46 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Fri, 21 Aug 2020 13:04:46 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1k96io-00067n-HP; Fri, 21 Aug 2020 13:04:42 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=GXOG=B7=neclab.eu=simon.kuenzer@srs-us1.protection.inumbo.net>)
 id 1k96in-00067i-C1
 for minios-devel@lists.xen.org; Fri, 21 Aug 2020 13:04:41 +0000
X-Inumbo-ID: 54087663-d6b3-4d8f-98af-97de27823000
Received: from mailer2.neclab.eu (unknown [195.37.70.41])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 54087663-d6b3-4d8f-98af-97de27823000;
 Fri, 21 Aug 2020 13:04:38 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
 by mailer2.neclab.eu (Postfix) with ESMTP id D80A6F200E;
 Fri, 21 Aug 2020 15:04:37 +0200 (CEST)
X-Virus-Scanned: Amavisd on Debian GNU/Linux (atlas-b.office.hd)
Received: from mailer2.neclab.eu ([127.0.0.1])
 by localhost (atlas-b.office.hd [127.0.0.1]) (amavisd-new, port 10024)
 with ESMTP id N3Jr9E9Uz2YB; Fri, 21 Aug 2020 15:04:37 +0200 (CEST)
X-ENC: Last-Hop-TLS-encrypted
X-ENC: Last-Hop-TLS-encrypted
Received: from puck.office.hd (puck.office.hd [192.168.24.91])
 (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
 (No client certificate requested)
 by mailer2.neclab.eu (Postfix) with ESMTPS id AB4BAF2005;
 Fri, 21 Aug 2020 15:04:31 +0200 (CEST)
Received: from [10.7.1.42] (192.168.24.96) by puck.office.hd (192.168.24.91)
 with Microsoft SMTP Server (version=TLS1_2,
 cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1979.3; Fri, 21 Aug
 2020 15:04:30 +0200
Subject: Re: [UNIKRAFT PATCH v4 10/12] plat/xen/drivers/net: Add transmit
 operation
To: Costin Lupu <costin.lupu@cs.pub.ro>, <minios-devel@lists.xen.org>
CC: <sharan.santhanam@neclab.eu>, Razvan Cojocaru <razvan.cojocaru93@gmail.com>
References: <20200813085342.29799-1-costin.lupu@cs.pub.ro>
 <20200813085342.29799-11-costin.lupu@cs.pub.ro>
 <494d8796-a3e0-a3d5-df36-6343df10d571@neclab.eu>
 <c71f09f9-79b7-816f-bced-a190ed6665fc@cs.pub.ro>
 <726dd84d-33cb-877f-3e22-a5d92870ac35@neclab.eu>
 <06f26c34-1a23-6fae-d5ba-46b4b49dfc13@cs.pub.ro>
From: Simon Kuenzer <simon.kuenzer@neclab.eu>
Message-ID: <a106f115-336c-d97c-f441-f130633c4c53@neclab.eu>
Date: Fri, 21 Aug 2020 15:04:29 +0200
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:68.0)
 Gecko/20100101 Thunderbird/68.11.0
MIME-Version: 1.0
In-Reply-To: <06f26c34-1a23-6fae-d5ba-46b4b49dfc13@cs.pub.ro>
Content-Type: text/plain; charset="utf-8"; format=flowed
Content-Language: en-US
Content-Transfer-Encoding: 8bit
X-Originating-IP: [192.168.24.96]
X-ClientProxiedBy: titania.office.hd (192.168.24.89) To puck.office.hd
 (192.168.24.91)
X-BeenThere: minios-devel@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Mini-os development list <minios-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:minios-devel@lists.xenproject.org>
List-Help: <mailto:minios-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: minios-devel-bounces@lists.xenproject.org
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>

On 21.08.20 13:24, Costin Lupu wrote:
> On 8/21/20 1:49 PM, Simon Kuenzer wrote:
>> On 21.08.20 11:32, Costin Lupu wrote:
>>> On 8/20/20 6:49 PM, Simon Kuenzer wrote:
>>>> On 13.08.20 10:53, Costin Lupu wrote:
>>>>> Whenever a packet is transmitted, the request describing it is written
>>>>> in the
>>>>> shared ring. The packet itself is written in a page referenced by the
>>>>> request
>>>>> and shared, as well, with the backend. At the end of each transmit
>>>>> operation, a
>>>>> cleanup operation is performed free'ing the resources allocated for the
>>>>> previously transmitted packets.
>>>>>
>>>>> Signed-off-by: Costin Lupu <costin.lupu@cs.pub.ro>
>>>>> Signed-off-by: Razvan Cojocaru <razvan.cojocaru93@gmail.com>
>>>>> ---
>>>>>  Â Â  plat/xen/drivers/net/netfront.c | 102
>>>>> ++++++++++++++++++++++++++++++++
>>>>>  Â Â  1 file changed, 102 insertions(+)
>>>>>
>>>>> diff --git a/plat/xen/drivers/net/netfront.c
>>>>> b/plat/xen/drivers/net/netfront.c
>>>>> index 858d124a..f2b81329 100644
>>>>> --- a/plat/xen/drivers/net/netfront.c
>>>>> +++ b/plat/xen/drivers/net/netfront.c
>>>>> @@ -39,6 +39,7 @@
>>>>>  Â Â  #include <uk/alloc.h>
>>>>>  Â Â  #include <uk/netdev_driver.h>
>>>>>  Â Â  #include <xen-x86/mm.h>
>>>>> +#include <xen-x86/irq.h>
>>>>>  Â Â  #include <xenbus/xenbus.h>
>>>>>  Â Â  #include "netfront.h"
>>>>>  Â Â  #include "netfront_xb.h"
>>>>> @@ -78,6 +79,106 @@ static uint16_t get_id_from_freelist(uint16_t
>>>>> *freelist)
>>>>>  Â Â Â Â Â Â  return id;
>>>>>  Â Â  }
>>>>>  Â Â  +static int network_tx_buf_gc(struct uk_netdev_tx_queue *txq)
>>>>> +{
>>>>> +Â Â Â  RING_IDX prod, cons;
>>>>> +Â Â Â  netif_tx_response_t *tx_rsp;
>>>>> +Â Â Â  uint16_t id;
>>>>> +Â Â Â  bool more_to_do;
>>>>> +Â Â Â  int count = 0;
>>>>> +
>>>>> +Â Â Â  do {
>>>>> +Â Â Â Â Â Â Â  prod = txq->ring.sring->rsp_prod;
>>>>> +Â Â Â Â Â Â Â  rmb(); /* Ensure we see responses up to 'rp'. */
>>>>> +
>>>>> +Â Â Â Â Â Â Â  for (cons = txq->ring.rsp_cons; cons != prod; cons++) {
>>>>> +Â Â Â Â Â Â Â Â Â Â Â  tx_rsp = RING_GET_RESPONSE(&txq->ring, cons);
>>>>> +
>>>>> +Â Â Â Â Â Â Â Â Â Â Â  if (tx_rsp->status == NETIF_RSP_NULL)
>>>>> +Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â  continue;
>>>>> +
>>>>> +Â Â Â Â Â Â Â Â Â Â Â  if (tx_rsp->status == NETIF_RSP_ERROR)
>>>>> +Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â  uk_pr_err("packet error\n");
>>>>
>>>> "netdev%u: Transmission error on txq %u\n" ?
>>>>
>>>
>>> Ack.
>>>
>>>>> +
>>>>> +Â Â Â Â Â Â Â Â Â Â Â  idÂ  = tx_rsp->id;
>>>>> +Â Â Â Â Â Â Â Â Â Â Â  UK_ASSERT(id < NET_TX_RING_SIZE);
>>>>> +
>>>>> +Â Â Â Â Â Â Â Â Â Â Â  gnttab_end_access(txq->gref[id]);
>>>>> +Â Â Â Â Â Â Â Â Â Â Â  txq->gref[id] = GRANT_INVALID_REF;
>>>>> +
>>>>> +Â Â Â Â Â Â Â Â Â Â Â  add_id_to_freelist(id, txq->freelist);
>>>>> +Â Â Â Â Â Â Â Â Â Â Â  uk_semaphore_up(&txq->sem);
>>>>> +
>>>>> +Â Â Â Â Â Â Â Â Â Â Â  count++;
>>>>> +Â Â Â Â Â Â Â  }
>>>>> +
>>>>> +Â Â Â Â Â Â Â  txq->ring.rsp_cons = prod;
>>>>> +
>>>>> +Â Â Â Â Â Â Â  RING_FINAL_CHECK_FOR_RESPONSES(&txq->ring, more_to_do);
>>>>> +Â Â Â  } while (more_to_do);
>>>>> +
>>>>> +Â Â Â  return count;
>>>>> +}
>>>>> +
>>>>> +static int netfront_xmit(struct uk_netdev *n,
>>>>> +Â Â Â Â Â Â Â  struct uk_netdev_tx_queue *txq,
>>>>> +Â Â Â Â Â Â Â  struct uk_netbuf *pkt)
>>>>> +{
>>>>> +Â Â Â  struct netfront_dev *nfdev;
>>>>> +Â Â Â  unsigned long flags;
>>>>> +Â Â Â  uint16_t id;
>>>>> +Â Â Â  RING_IDX req_prod;
>>>>> +Â Â Â  netif_tx_request_t *tx_req;
>>>>> +Â Â Â  int notify;
>>>>> +Â Â Â  int status = 0, count;
>>>>> +
>>>>> +Â Â Â  UK_ASSERT(n != NULL);
>>>>> +Â Â Â  UK_ASSERT(txq != NULL);
>>>>> +Â Â Â  UK_ASSERT(pkt != NULL);
>>>>> +Â Â Â  UK_ASSERT(pkt->len < PAGE_SIZE);
>>>>> +
>>>>> +Â Â Â  nfdev = to_netfront_dev(n);
>>>>> +
>>>>> +Â Â Â  /* get request id */
>>>>> +Â Â Â  uk_semaphore_down(&txq->sem);
>>>>> +Â Â Â  local_irq_save(flags);
>>>>> +Â Â Â  id = get_id_from_freelist(txq->freelist);
>>>>
>>>> What happens when we are out of space and the ring is full?
>>>> The xmit function should be non-blocking so that we can use it in
>>>> polling mode. We should return in such a case that the transmission
>>>> queue is currently full...
>>>>
>>>
>>> Ack.
>>>
>>>>> +Â Â Â  local_irq_restore(flags);
>>>>> +
>>>>> +Â Â Â  /* get request */
>>>>> +Â Â Â  req_prod = txq->ring.req_prod_pvt;
>>>>> +Â Â Â  tx_req = RING_GET_REQUEST(&txq->ring, req_prod); > +
>>>>> +Â Â Â  /* setup grant for buffer data */
>>>>> +Â Â Â  txq->gref[id] = tx_req->gref =
>>>>> +Â Â Â Â Â Â Â  gnttab_grant_access(nfdev->xendev->otherend_id,
>>>>> +Â Â Â Â Â Â Â Â Â Â Â  virt_to_mfn(pkt->data), 1);
>>>>> +Â Â Â  UK_ASSERT(tx_req->gref != GRANT_INVALID_REF);
>>>>> +
>>>>> +Â Â Â  tx_req->offset = 0;
>>>>> +Â Â Â  tx_req->size = (uint16_t) pkt->len;
>>>>> +Â Â Â  tx_req->flags = 0;
>>>>> +Â Â Â  tx_req->id = id;
>>>>> +
>>>>> +Â Â Â  txq->ring.req_prod_pvt = req_prod + 1;
>>>>> +Â Â Â  wmb(); /* Ensure backend sees requests */
>>>>> +
>>>>> +Â Â Â  RING_PUSH_REQUESTS_AND_CHECK_NOTIFY(&txq->ring, notify);
>>>>> +Â Â Â  if (notify)
>>>>> +Â Â Â Â Â Â Â  notify_remote_via_evtchn(txq->evtchn); > +
>>>>> +Â Â Â  status |= UK_NETDEV_STATUS_SUCCESS;
>>>>> +
>>>>> +Â Â Â  /* some cleanup */
>>>>> +Â Â Â  local_irq_save(flags);
>>>>> +Â Â Â  count = network_tx_buf_gc(txq);
>>>>
>>>> The clean-up should happen before enqueuing the given packet to the
>>>> transmit queue, it is the first thing of xmit(). Since we anyway need to
>>>> do it and we do not have an advantage by delaying this operation.
>>>
>>> Of course there is an advantage. You push the packets in order for them
>>> to be processed ASAP by the backend and deal with cleaning up
>>> afterwards. It's a kind of parallelization. Otherwise you would delay
>>> the transmissions.
>>>
>>>> We can also deal much better with full rings. Otherwise we
>>>> unnecessarily drop a packets for transmission although there would
>>>> have been space when clean-up finished. After calling cleaning you
>>>> can check if there is space on the ring and return if we run out of
>>>> it (use an `unlikely` to the condition so that we speed up the
>>>> successful sending case).
>>>>
>>>
>>> The only scenario when this would solve anything would be when you have
>>> the ring full and just before you decide to send a new packet the
>>> backend starts processing your previous transmitted packets, leaving you
>>> at least one free slot. There are 2 unlikely events here: first, the
>>> ring is full, and second, the backend starts to process again when the
>>> ring gets full (for the latter event, it's unlikely that the backend
>>> will wake up given that it couldn't process 256 transmitted packets,
>>> where 256 is the current number of slots). And for this very unlikely
>>> context you would introduce a delay for all the transmissions if we
>>> followed your suggestion.
>>>
>>> Anyway, both Linux and FreeBSD do the cleanup after pushing the
>>> requests, so I don't think we have much more to say about this.
>>>
>>
>> Hum... I double-checked with Intel DPDK's ixgbe (10 Gig) driver:
>>
>> http://git.dpdk.org/dpdk-stable/tree/drivers/net/ixgbe/ixgbe_rxtx.c?h=20.02#n230
>>
>>
>> They clean the slots before sending. I derived my conclusion from there.
>> However I noticed now that there is one minor difference: They do both -
>> cleanup and enqueuing - before they notify the card about changes on the
>> ring. In that case it does not add any delay if you swap the order of
>> cleanup and enqueuing. In your case this is probably different because
>> you can cleanup without notifying. Here, I agree with you that we add
>> unnecessary xmit delays by swapping the order.
>>
> 
> ixgbe is a native driver, so there is no backend driver in that case.
> It's a different scenario.

You could consider the card itself as a backend driver, but fine. There 
is a ABI difference between ixgbe and netback.

> 
>> However and in general, having a full ring is not an uncommon and
>> unlikely case. To my experience, this can already happen with a single
>> TCP connection if your network stack is feeding next packets fast enough
>> and if the current TCP window allows to send them. It also depends on
>> when the driver domain is scheduled; on which CPU core your netfront
>> domain and the driver domain sit; and even on the underlying physical
>> device that might be busy with other traffic.
>>
> 
> What I tried to say with the events probabilities explanation is that
> you add delay for the common case in order to remove delay for the much
> less probable corner case.

I got that and agreed.

> 
>> Another thing we are having in mind for uknetdev - and this is probably
>> different to Linux/BSD's implementation - we plan to change the xmit
>> function to do batching (as DPDK does). Sharan could push virtio-net
>> performance further with this. You are able to reduce the number of
>> notifies to the backend because you enqueue multiple packets at once and
>> due to locality of batching you can utilize CPU caches ways better.
>>
>> What about this idea for netfront: We could do first a check for
>> available space and - if needed - clean-up just as many extra slots that
>> you need to complete the transmission (for now this is anyways just one
>> slot). Then we proceed with enqueuing and do the cleanup of the rest of
>> the slots after we notified the backend. What do you think?
>>
> 
> This will stay just as it is for the current patches. Feel free to
> change anything after upstreaming these patches.

No, it won't stay like this. At least, you have to call clean-up when 
the ring is full before you leave the non-blocking function. Otherwise 
you end up in never getting space back on a full ring, but I think this 
is clear.

> 
>>>
>>> Btw, I'm waiting for reviews on the other patches as well before I send
>>> the v5.
>>
>> Yes, sure.
>>
>>>
>>>
>>>>> +Â Â Â  local_irq_restore(flags);
>>>>> +
>>>>> +Â Â Â  status |= likely(count > 0) ? UK_NETDEV_STATUS_MORE : 0x0;
>>>>> +
>>>>> +Â Â Â  return status;
>>>>> +}
>>>>> +
>>>>>  Â Â  static int netfront_rxq_enqueue(struct uk_netdev_rx_queue *rxq,
>>>>>  Â Â Â Â Â Â Â Â Â Â  struct uk_netbuf *netbuf)
>>>>>  Â Â  {
>>>>> @@ -598,6 +699,7 @@ static int netfront_add_dev(struct xenbus_device
>>>>> *xendev)
>>>>>  Â Â Â Â Â Â  }
>>>>>  Â Â  Â Â Â Â Â  /* register netdev */
>>>>> +Â Â Â  nfdev->netdev.tx_one = netfront_xmit;
>>>>>  Â Â Â Â Â Â  nfdev->netdev.ops = &netfront_ops;
>>>>>  Â Â Â Â Â Â  rc = uk_netdev_drv_register(&nfdev->netdev, drv_allocator,
>>>>> DRIVER_NAME);
>>>>>  Â Â Â Â Â Â  if (rc < 0) {
>>>>>
>>>>
>>
>> Thanks,
>>
>> Simon
>>


From minios-devel-bounces@lists.xenproject.org Fri Aug 21 13:07:20 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Fri, 21 Aug 2020 13:07:20 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1k96lL-0006D0-PC; Fri, 21 Aug 2020 13:07:19 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=GXOG=B7=neclab.eu=simon.kuenzer@srs-us1.protection.inumbo.net>)
 id 1k96lK-0006CI-41
 for minios-devel@lists.xen.org; Fri, 21 Aug 2020 13:07:18 +0000
X-Inumbo-ID: 973a3f47-c1c6-4e27-bdd4-9bb6d7edc545
Received: from mailer1.neclab.eu (unknown [195.37.70.40])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 973a3f47-c1c6-4e27-bdd4-9bb6d7edc545;
 Fri, 21 Aug 2020 13:07:15 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
 by mailer1.neclab.eu (Postfix) with ESMTP id 2CEE5103EF0;
 Fri, 21 Aug 2020 15:07:14 +0200 (CEST)
X-Virus-Scanned: Amavisd on Debian GNU/Linux (atlas-a.office.hd)
Received: from mailer1.neclab.eu ([127.0.0.1])
 by localhost (atlas-a.office.hd [127.0.0.1]) (amavisd-new, port 10024)
 with ESMTP id N6pk9ZyagTmZ; Fri, 21 Aug 2020 15:07:14 +0200 (CEST)
X-ENC: Last-Hop-TLS-encrypted
X-ENC: Last-Hop-TLS-encrypted
Received: from puck.office.hd (puck.office.hd [192.168.24.91])
 (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
 (No client certificate requested)
 by mailer1.neclab.eu (Postfix) with ESMTPS id F0040103B17;
 Fri, 21 Aug 2020 15:07:13 +0200 (CEST)
Received: from [10.7.1.42] (192.168.24.96) by puck.office.hd (192.168.24.91)
 with Microsoft SMTP Server (version=TLS1_2,
 cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1979.3; Fri, 21 Aug
 2020 15:07:13 +0200
Subject: Re: [[UNIKRAFT PATCH] v3 1/1] lib/isrlib: Introduce libc-like
 interrupt-context-safe routines
To: <cristianvijelie@gmail.com>, <minios-devel@lists.xen.org>
References: <20200821113804.53313-1-cristianvijelie@gmail.com>
From: Simon Kuenzer <simon.kuenzer@neclab.eu>
Message-ID: <e2e4e484-19dd-a893-7111-ce5f8094bd40@neclab.eu>
Date: Fri, 21 Aug 2020 15:07:12 +0200
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:68.0)
 Gecko/20100101 Thunderbird/68.11.0
MIME-Version: 1.0
In-Reply-To: <20200821113804.53313-1-cristianvijelie@gmail.com>
Content-Type: text/plain; charset="utf-8"; format=flowed
Content-Language: en-US
Content-Transfer-Encoding: 7bit
X-Originating-IP: [192.168.24.96]
X-ClientProxiedBy: puck.office.hd (192.168.24.91) To puck.office.hd
 (192.168.24.91)
X-BeenThere: minios-devel@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Mini-os development list <minios-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:minios-devel@lists.xenproject.org>
List-Help: <mailto:minios-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: minios-devel-bounces@lists.xenproject.org
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>

On 21.08.20 13:38, cristianvijelie@gmail.com wrote:
> From: Cristian Vijelie <cristianvijelie@gmail.com>
> 
> libisr library means to introduce interrupt-context-safe routines,
> to be used in interrupt handlers and drivers. It is based on nolibc.

I would replace "based on" with "derived from".

> 
> This patch adds the string functions for libisr.
> 
> Signed-off-by: Cristian Vijelie <cristianvijelie@gmail.com>
> ---
>   include/uk/isr/string.h |  72 +++++++++
>   lib/isrlib/Config.uk    |   3 +
>   lib/isrlib/Makefile.uk  |   8 +
>   lib/isrlib/string.c     | 324 ++++++++++++++++++++++++++++++++++++++++
>   4 files changed, 407 insertions(+)
>   create mode 100644 include/uk/isr/string.h
>   create mode 100644 lib/isrlib/Config.uk
>   create mode 100644 lib/isrlib/Makefile.uk
>   create mode 100644 lib/isrlib/string.c
> 
> diff --git a/include/uk/isr/string.h b/include/uk/isr/string.h
> new file mode 100644
> index 0000000..bcf9fef
> --- /dev/null
> +++ b/include/uk/isr/string.h
> @@ -0,0 +1,72 @@
> +/* SPDX-License-Identifier: BSD-3-Clause */
> +/*
> + * Authors: Simon Kuenzer <simon.kuenzer@neclab.eu>
> + *          Cristian Vijelie <cristianvijelie@gmail.com>
> + *
> + *
> + * Copyright (c) 2017, NEC Europe Ltd., NEC Corporation. All rights reserved.
> + * Copyright (c) 2020, University Politehnica of Bucharest. All rights reserved.
> + *
> + * Redistribution and use in source and binary forms, with or without
> + * modification, are permitted provided that the following conditions
> + * are met:
> + *
> + * 1. Redistributions of source code must retain the above copyright
> + *    notice, this list of conditions and the following disclaimer.
> + * 2. Redistributions in binary form must reproduce the above copyright
> + *    notice, this list of conditions and the following disclaimer in the
> + *    documentation and/or other materials provided with the distribution.
> + * 3. Neither the name of the copyright holder nor the names of its
> + *    contributors may be used to endorse or promote products derived from
> + *    this software without specific prior written permission.
> + *
> + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
> + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
> + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
> + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
> + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
> + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
> + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
> + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
> + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
> + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
> + * POSSIBILITY OF SUCH DAMAGE.
> + *
> + */
> +
> +#ifndef __UK_ISR_STRING_H__
> +#define __UK_ISR_STRING_H__
> +
> +#ifdef __cplusplus
> +extern "C" {
> +#endif
> +
> +#include <string.h>
> +
> +void *memcpy_isr(void *dst, const void *src, size_t len);
> +void *memset_isr(void *ptr, int val, size_t len);
> +void *memchr_isr(const void *ptr, int val, size_t len);
> +void *memrchr_isr(const void *m, int c, size_t n);
> +int memcmp_isr(const void *ptr1, const void *ptr2, size_t len);
> +void *memmove_isr(void *dst, const void *src, size_t len);
> +
> +char *strncpy_isr(char *dst, const char *src, size_t len);
> +char *strcpy_isr(char *dst, const char *src);
> +size_t strlcpy_isr(char *d, const char *s, size_t n);
> +size_t strlcat_isr(char *d, const char *s, size_t n);
> +size_t strnlen_isr(const char *str, size_t maxlen);
> +size_t strlen_isr(const char *str);
> +char *strchrnul_isr(const char *s, int c);
> +char *strchr_isr(const char *str, int c);
> +char *strrchr_isr(const char *s, int c);
> +int strncmp_isr(const char *str1, const char *str2, size_t len);
> +int strcmp_isr(const char *str1, const char *str2);
> +size_t strcspn_isr(const char *s, const char *c);
> +size_t strspn_isr(const char *s, const char *c);
> +char *strtok_isr(char *restrict s, const char *restrict sep, char **restrict p);
> +
> +#ifdef __cplusplus
> +}
> +#endif
> +
> +#endif /* __UK_ISR_STRING_H__ */
> diff --git a/lib/isrlib/Config.uk b/lib/isrlib/Config.uk
> new file mode 100644
> index 0000000..60b4274
> --- /dev/null
> +++ b/lib/isrlib/Config.uk
> @@ -0,0 +1,3 @@
> +config LIBISRLIB
> +    bool "isrlib: ISR helper library"
> +    default n
> diff --git a/lib/isrlib/Makefile.uk b/lib/isrlib/Makefile.uk
> new file mode 100644
> index 0000000..26f19e8
> --- /dev/null
> +++ b/lib/isrlib/Makefile.uk
> @@ -0,0 +1,8 @@
> +$(eval $(call addlib_s,libisrlib,$(CONFIG_LIBISRLIB)))
> +
> +LIBISRLIB_GLOBAL_INCLUDES-y = $(LIBISRLIB_BASE)/include
> +
> +CINCLUDES-$(CONFIG_LIBISRLIB) += $(LIBISRLIB_GLOBAL_INCLUDES)
> +CXXINCLUDES-$(CONFIG_LIBISRLIB) += $(LIBISRLIB_GLOBAL_INCLUDES)
> +
> +LIBISRLIB_SRCS-y += $(LIBISRLIB_BASE)/string.c|isr
> diff --git a/lib/isrlib/string.c b/lib/isrlib/string.c
> new file mode 100644
> index 0000000..3080510
> --- /dev/null
> +++ b/lib/isrlib/string.c
> @@ -0,0 +1,324 @@
> +/* SPDX-License-Identifier: BSD-3-Clause AND MIT */
> +/*
> + * Authors: Cristian Vijelie <cristianvijelie@gmail.com>
> + *
> + * Copyright (c) 2020, University Politehnica of Bucharest. All rights reserved.

Please keep the original authors of string.c, too. You can add yourself 
additionally.

> + *
> + * Redistribution and use in source and binary forms, with or without
> + * modification, are permitted provided that the following conditions
> + * are met:
> + *
> + * 1. Redistributions of source code must retain the above copyright
> + *    notice, this list of conditions and the following disclaimer.
> + * 2. Redistributions in binary form must reproduce the above copyright
> + *    notice, this list of conditions and the following disclaimer in the
> + *    documentation and/or other materials provided with the distribution.
> + * 3. Neither the name of the copyright holder nor the names of its
> + *    contributors may be used to endorse or promote products derived from
> + *    this software without specific prior written permission.
> + *
> + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
> + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
> + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
> + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
> + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
> + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
> + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
> + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
> + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
> + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
> + * POSSIBILITY OF SUCH DAMAGE.
> + *
> + * THIS HEADER MAY NOT BE EXTRACTED OR MODIFIED IN ANY WAY.

..and remove this sentence again. ;-)

> + */
> +/* For the parts taken from musl (marked as such below), the MIT licence
> + * applies instead:
> + * ----------------------------------------------------------------------
> + * Copyright (c) 2005-2014 Rich Felker, et al.
> + *
> + * Permission is hereby granted, free of charge, to any person obtaining
> + * a copy of this software and associated documentation files (the
> + * "Software"), to deal in the Software without restriction, including
> + * without limitation the rights to use, copy, modify, merge, publish,
> + * distribute, sublicense, and/or sell copies of the Software, and to
> + * permit persons to whom the Software is furnished to do so, subject to
> + * the following conditions:
> + *
> + * The above copyright notice and this permission notice shall be
> + * included in all copies or substantial portions of the Software.
> + *
> + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
> + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
> + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
> + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
> + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
> + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
> + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
> + * ----------------------------------------------------------------------
> + */
> +
> +#include <uk/isr/string.h>
> +#include <uk/arch/types.h>
> +#include <stdint.h>
> +#include <limits.h>
> +
> +void *memcpy_isr(void *dst, const void *src, size_t len)
> +{
> +	size_t p;
> +
> +	for (p = 0; p < len; ++p)
> +		*((__u8 *)(((__uptr)dst) + p)) = *((__u8 *)(((__uptr)src) + p));
> +
> +	return dst;
> +}
> +
> +void *memset_isr(void *ptr, int val, size_t len)
> +{
> +	__u8 *p = (__u8 *) ptr;
> +
> +	for (; len > 0; --len)
> +		*(p++) = (__u8)val;
> +
> +	return ptr;
> +}
> +
> +void *memchr_isr(const void *ptr, int val, size_t len)
> +{
> +	uintptr_t o = 0;
> +
> +	for (o = 0; o < (uintptr_t)len; ++o)
> +		if (*((const uint8_t *)(((uintptr_t)ptr) + o)) == (uint8_t)val)
> +			return (void *)((uintptr_t)ptr + o);
> +
> +	return NULL; /* did not find val */
> +}
> +
> +void *memrchr_isr(const void *m, int c, size_t n)
> +{
> +	const unsigned char *s = m;
> +
> +	c = (unsigned char) c;
> +	while (n--)
> +		if (s[n] == c)
> +			return (void *) (s + n);
> +	return 0;
> +}
> +
> +void *memmove_isr(void *dst, const void *src, size_t len)
> +{
> +	uint8_t *d = dst;
> +	const uint8_t *s = src;
> +
> +	if (src > dst) {
> +		for (; len > 0; --len)
> +			*(d++) = *(s++);
> +	} else {
> +		s += len;
> +		d += len;
> +
> +		for (; len > 0; --len)
> +			*(d--) = *(s--);
> +	}
> +
> +	return dst;
> +}
> +
> +int memcmp_isr(const void *ptr1, const void *ptr2, size_t len)
> +{
> +	const unsigned char *c1 = (const unsigned char *)ptr1;
> +	const unsigned char *c2 = (const unsigned char *)ptr2;
> +
> +	for (; len > 0; --len, ++c1, ++c2) {
> +		if ((*c1) != (*c2))
> +			return ((*c1) - (*c2));
> +	}
> +
> +	return 0;
> +}
> +
> +size_t strlen_isr(const char *str)
> +{
> +	return strnlen_isr(str, SIZE_MAX);
> +}
> +
> +size_t strnlen_isr(const char *str, size_t len)
> +{
> +	const char *p = memchr_isr(str, 0, len);
> +	return p ? (size_t) (p - str) : len;
> +}
> +
> +char *strncpy_isr(char *dst, const char *src, size_t len)
> +{
> +	size_t clen;
> +
> +	clen = strnlen_isr(src, len);
> +	memcpy_isr(dst, src, clen);
> +
> +	/* instead of filling up the rest of left space with zeros,
> +	 * append a termination character if we did not copy one
> +	 */
> +	if (clen < len && dst[clen - 1] != '\0')
> +		dst[clen] = '\0';
> +	return dst;
> +}
> +
> +char *strcpy_isr(char *dst, const char *src)
> +{
> +	return strncpy_isr(dst, src, SIZE_MAX);
> +}
> +
> +int strncmp_isr(const char *str1, const char *str2, size_t len)
> +{
> +	const char *c1 = (const char *)str1;
> +	const char *c2 = (const char *)str2;
> +
> +	for (; len > 0; --len, ++c1, ++c2) {
> +		if ((*c1) != (*c2))
> +			return (int)((*c1) - (*c2));
> +		if ((*c1) == '\0')
> +			break;
> +	}
> +	return 0;
> +}
> +
> +int strcmp_isr(const char *str1, const char *str2)
> +{
> +	register signed char __res;
> +
> +	while ((__res = *str1 - *str2++) == 0 && *str1++)
> +		;
> +
> +	return __res;
> +}
> +
> +/* The following code is taken from musl libc */
> +#define ALIGN (sizeof(size_t))
> +#define ONES ((size_t) -1 / UCHAR_MAX)
> +#define HIGHS (ONES * (UCHAR_MAX / 2 + 1))
> +#define HASZERO(x) (((x) - ONES) & ~(x) & HIGHS)
> +#define BITOP(a, b, op) \
> +		((a)[(size_t)(b) / (8*sizeof *(a))] op \
> +		(size_t)1 << ((size_t)(b) % (8 * sizeof *(a))))
> +
> +char *strchrnul_isr(const char *s, int c)
> +{
> +	size_t *w, k;
> +
> +	c = (unsigned char)c;
> +	if (!c)
> +		return (char *)s + strlen_isr(s);
> +
> +	for (; (uintptr_t)s % ALIGN; s++)
> +		if (!*s || *(unsigned char *)s == c)
> +			return (char *)s;
> +	k = ONES * c;
> +	for (w = (void *)s; !HASZERO(*w) && !HASZERO(*w ^ k); w++)
> +		;
> +	for (s = (void *)w; *s && *(unsigned char *)s != c; s++)
> +		;
> +	return (char *)s;
> +}
> +
> +char *strchr_isr(const char *str, int c)
> +{
> +	char *r = strchrnul_sr(str, c);
> +	return *(unsigned char *)r == (unsigned char)c ? r : 0;
> +}
> +
> +char *strrchr_isr(const char *s, int c)
> +{
> +	return memrchr_isr(s, c, strlen_isr(s) + 1);
> +}
> +
> +size_t strcspn_isr(const char *s, const char *c)
> +{
> +	const char *a = s;
> +	size_t byteset[32 / sizeof(size_t)];
> +
> +	if (!c[0] || !c[1])
> +		return strchrnul_isr(s, *c)-a;
> +
> +	memset_isr(byteset, 0, sizeof(byteset));
> +	for (; *c && BITOP(byteset, *(unsigned char *)c, |=); c++)
> +		;
> +	for (; *s && !BITOP(byteset, *(unsigned char *)s, &); s++)
> +		;
> +	return s-a;
> +}
> +
> +size_t strspn_isr(const char *s, const char *c)
> +{
> +	const char *a = s;
> +	size_t byteset[32 / sizeof(size_t)] = { 0 };
> +
> +	if (!c[0])
> +		return 0;
> +	if (!c[1]) {
> +		for (; *s == *c; s++)
> +			;
> +		return s-a;
> +	}
> +
> +	for (; *c && BITOP(byteset, *(unsigned char *)c, |=); c++)
> +		;
> +	for (; *s && BITOP(byteset, *(unsigned char *)s, &); s++)
> +		;
> +	return s-a;
> +}
> +
> +char *strtok_isr(char *restrict s, const char *restrict sep, char **restrict p)
> +{
> +	if (!s && !(s = *p))
> +		return NULL;
> +	s += strspn_isr(s, sep);
> +	if (!*s)
> +		return *p = 0;
> +	*p = s + strcspn_isr(s, sep);
> +	if (**p)
> +		*(*p)++ = 0;
> +	else
> +		*p = 0;
> +	return s;
> +}
> +
> +/* strlcpy has different ALIGN */
> +#undef ALIGN
> +#define ALIGN (sizeof(size_t)-1)
> +size_t strlcpy_isr(char *d, const char *s, size_t n)
> +{
> +	char *d0 = d;
> +	size_t *wd;
> +	const size_t *ws;
> +
> +	if (!n--)
> +		goto finish;
> +
> +	if (((uintptr_t)s & ALIGN) == ((uintptr_t)d & ALIGN)) {
> +		for (; ((uintptr_t) s & ALIGN) && n && (*d = *s);
> +		     n--, s++, d++)
> +			;
> +
> +		if (n && *s) {
> +			wd = (void *)d; ws = (const void *)s;
> +			for (; n >= sizeof(size_t) && !HASZERO(*ws);
> +			     n -= sizeof(size_t), ws++, wd++)
> +				*wd = *ws;
> +
> +			d = (void *)wd; s = (const void *)ws;
> +		}
> +	}
> +
> +	for (; n && (*d = *s); n--, s++, d++)
> +		;
> +	*d = 0;
> +finish:
> +	return d-d0 + strlen_isr(s);
> +}
> +
> +size_t strlcat_isr(char *d, const char *s, size_t n)
> +{
> +	size_t l = strnlen_isr(d, n);
> +	if (l == n)
> +		return l + strlen_isr(s);
> +	return l + strlcpy_isr(d+l, s, n-l);
> +}
> 

Thanks,

Simon


From minios-devel-bounces@lists.xenproject.org Fri Aug 21 13:13:51 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Fri, 21 Aug 2020 13:13:51 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1k96rd-0006zj-Ai; Fri, 21 Aug 2020 13:13:49 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=GXOG=B7=neclab.eu=simon.kuenzer@srs-us1.protection.inumbo.net>)
 id 1k96rc-0006ze-7r
 for minios-devel@lists.xenproject.org; Fri, 21 Aug 2020 13:13:48 +0000
X-Inumbo-ID: f83d53f0-ceab-47d0-a5b1-f9bf8026fa47
Received: from mailer2.neclab.eu (unknown [195.37.70.41])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id f83d53f0-ceab-47d0-a5b1-f9bf8026fa47;
 Fri, 21 Aug 2020 13:13:47 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
 by mailer2.neclab.eu (Postfix) with ESMTP id 0ECB3F200E;
 Fri, 21 Aug 2020 15:13:46 +0200 (CEST)
X-Virus-Scanned: Amavisd on Debian GNU/Linux (atlas-b.office.hd)
Received: from mailer2.neclab.eu ([127.0.0.1])
 by localhost (atlas-b.office.hd [127.0.0.1]) (amavisd-new, port 10024)
 with ESMTP id H_5fkEzPKgNJ; Fri, 21 Aug 2020 15:13:45 +0200 (CEST)
X-ENC: Last-Hop-TLS-encrypted
X-ENC: Last-Hop-TLS-encrypted
Received: from puck.office.hd (puck.office.hd [192.168.24.91])
 (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
 (No client certificate requested)
 by mailer2.neclab.eu (Postfix) with ESMTPS id DAE9DF2005;
 Fri, 21 Aug 2020 15:13:41 +0200 (CEST)
Received: from [10.7.1.42] (192.168.24.96) by puck.office.hd (192.168.24.91)
 with Microsoft SMTP Server (version=TLS1_2,
 cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1979.3; Fri, 21 Aug
 2020 15:13:41 +0200
Subject: Re: [Minios-devel] [UNIKRAFT/MUSL PATCH V2 1/5] Add patch to update
 mount.h to avoid conflicts with vfscore
To: <gaulthier.gain@uliege.be>, <minios-devel@lists.xenproject.org>
References: <20200303102327.14050-1-gaulthier.gain@uliege.be>
 <20200303102327.14050-2-gaulthier.gain@uliege.be>
From: Simon Kuenzer <simon.kuenzer@neclab.eu>
Message-ID: <c0f019be-838f-dcdb-7461-8d6da710bffe@neclab.eu>
Date: Fri, 21 Aug 2020 15:13:40 +0200
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:68.0)
 Gecko/20100101 Thunderbird/68.11.0
MIME-Version: 1.0
In-Reply-To: <20200303102327.14050-2-gaulthier.gain@uliege.be>
Content-Type: text/plain; charset="utf-8"; format=flowed
Content-Language: en-US
Content-Transfer-Encoding: 7bit
X-Originating-IP: [192.168.24.96]
X-ClientProxiedBy: titania.office.hd (192.168.24.89) To puck.office.hd
 (192.168.24.91)
X-BeenThere: minios-devel@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Mini-os development list <minios-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:minios-devel@lists.xenproject.org>
List-Help: <mailto:minios-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: minios-devel-bounces@lists.xenproject.org
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>

Hi Gaulthier,

do you think we could fix this with vfscore instead? We would keep the 
require patches to musl smaller which simplifies updates to newer musl 
versions.

Thanks,

Simon

On 03.03.20 11:23, gaulthier.gain@uliege.be wrote:
> From: gaulthier gain <gaulthier.gain@uliege.be>
> 
> This patch updates "mount.h" in order to avoid ioctl redefinition
> error with vfscore. Basically, the musl "mount.h" file includes
> <sys/ioctl.h> only if _VFSCORE_SYS_MOUNT_H_ was not defined.
> 
> Signed-off-by: gaulthier gain <gaulthier.gain@uliege.be>
> ---
>   patches/0008-Fix-sys_ioctl_h-conflicts.patch | 27 ++++++++++++++++++++
>   1 file changed, 27 insertions(+)
>   create mode 100644 patches/0008-Fix-sys_ioctl_h-conflicts.patch
> 
> diff --git a/patches/0008-Fix-sys_ioctl_h-conflicts.patch b/patches/0008-Fix-sys_ioctl_h-conflicts.patch
> new file mode 100644
> index 0000000..953b8ad
> --- /dev/null
> +++ b/patches/0008-Fix-sys_ioctl_h-conflicts.patch
> @@ -0,0 +1,27 @@
> +From 2aa8ddeb0deb165b28f9e70b14da69b7bf9b938d Mon Sep 17 00:00:00 2001
> +From: gaulthier gain <gaulthier.gain@uliege.be>
> +Date: Mon, 24 Feb 2020 21:01:40 +0000
> +Subject: [PATCH] Remove <sys/ioctl> from musl internal
> +
> +Signed-off-by: Gaulthier Gain <gaulthier.gain@uliege.be>
> +---
> + include/sys/mount.h | 2 ++
> + 1 file changed, 2 insertions(+)
> +
> +diff --git a/include/sys/mount.h b/include/sys/mount.h
> +index 57a89c0..6516a51 100644
> +--- a/include/sys/mount.h
> ++++ b/include/sys/mount.h
> +@@ -5,7 +5,9 @@
> + extern "C" {
> + #endif
> +
> ++#ifndef _VFSCORE_SYS_MOUNT_H_
> + #include <sys/ioctl.h>
> ++#endif
> +
> + #define BLKROSET   _IO(0x12, 93)
> + #define BLKROGET   _IO(0x12, 94)
> +--
> +2.17.1
> +
> 


From minios-devel-bounces@lists.xenproject.org Fri Aug 21 13:18:52 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Fri, 21 Aug 2020 13:18:52 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1k96wV-00077K-Lc; Fri, 21 Aug 2020 13:18:51 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=GXOG=B7=neclab.eu=simon.kuenzer@srs-us1.protection.inumbo.net>)
 id 1k96wU-00077F-BF
 for minios-devel@lists.xenproject.org; Fri, 21 Aug 2020 13:18:50 +0000
X-Inumbo-ID: 5fd4561d-fbdc-42ae-9cdb-6f5a58bfe8d7
Received: from mailer1.neclab.eu (unknown [195.37.70.40])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 5fd4561d-fbdc-42ae-9cdb-6f5a58bfe8d7;
 Fri, 21 Aug 2020 13:18:48 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
 by mailer1.neclab.eu (Postfix) with ESMTP id D73F6103B17;
 Fri, 21 Aug 2020 15:18:47 +0200 (CEST)
X-Virus-Scanned: Amavisd on Debian GNU/Linux (atlas-a.office.hd)
Received: from mailer1.neclab.eu ([127.0.0.1])
 by localhost (atlas-a.office.hd [127.0.0.1]) (amavisd-new, port 10024)
 with ESMTP id DZiuTTUi04QO; Fri, 21 Aug 2020 15:18:47 +0200 (CEST)
X-ENC: Last-Hop-TLS-encrypted
X-ENC: Last-Hop-TLS-encrypted
Received: from puck.office.hd (puck.office.hd [192.168.24.91])
 (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
 (No client certificate requested)
 by mailer1.neclab.eu (Postfix) with ESMTPS id B35E91039C3;
 Fri, 21 Aug 2020 15:18:47 +0200 (CEST)
Received: from [10.7.1.42] (192.168.24.96) by puck.office.hd (192.168.24.91)
 with Microsoft SMTP Server (version=TLS1_2,
 cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1979.3; Fri, 21 Aug
 2020 15:18:47 +0200
Subject: Re: [Minios-devel] [UNIKRAFT/MUSL PATCH V2 2/5] Update __stdout_write
 to allow flushing on stdout
To: <gaulthier.gain@uliege.be>, <minios-devel@lists.xenproject.org>
References: <20200303102327.14050-1-gaulthier.gain@uliege.be>
 <20200303102327.14050-3-gaulthier.gain@uliege.be>
From: Simon Kuenzer <simon.kuenzer@neclab.eu>
Message-ID: <cead6330-6205-96be-4bc9-96da75160645@neclab.eu>
Date: Fri, 21 Aug 2020 15:18:45 +0200
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:68.0)
 Gecko/20100101 Thunderbird/68.11.0
MIME-Version: 1.0
In-Reply-To: <20200303102327.14050-3-gaulthier.gain@uliege.be>
Content-Type: text/plain; charset="utf-8"; format=flowed
Content-Language: en-US
Content-Transfer-Encoding: 7bit
X-Originating-IP: [192.168.24.96]
X-ClientProxiedBy: oberon.office.hd (192.168.24.90) To puck.office.hd
 (192.168.24.91)
X-BeenThere: minios-devel@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Mini-os development list <minios-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:minios-devel@lists.xenproject.org>
List-Help: <mailto:minios-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: minios-devel-bounces@lists.xenproject.org
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>

Hi Gaulthier,

I think this is a reasonable solution to the problem. Hopefully, we can 
remove it when ioctl systemcall support is there. Do you know if stderr 
is handled separately and do we need a similar patch for it?

Thanks,

Simon

Reviewed-by: Simon Kuenzer <simon.kuenzer@neclab.eu>

On 03.03.20 11:23, gaulthier.gain@uliege.be wrote:
> From: gaulthier gain <gaulthier.gain@uliege.be>
> 
> This patch fixes the issue where printing on stdout does nothing
> since stdout was not flushed. In that case, we found that the problem
> was related to __stdout_write. Indeed f->lbf must be set to '\n' for
> line-buffered mode nevertheless, the condition "(!(f->flags & F_SVB)
> && __syscall(SYS_ioctl, f->fd, TIOCGWINSZ, &wsz))" fails on Unikraft.
> The variable f->lbf is thus reset to -1 which prevents a correct
> display on stdout. With this patch, we "force" f->lbf to be set in
> line-buffered mode.
> 
> Signed-off-by: gaulthier gain <gaulthier.gain@uliege.be>
> ---
>   ...09-update__stdout_write_for_flushing.patch | 25 +++++++++++++++++++
>   1 file changed, 25 insertions(+)
>   create mode 100644 patches/0009-update__stdout_write_for_flushing.patch
> 
> diff --git a/patches/0009-update__stdout_write_for_flushing.patch b/patches/0009-update__stdout_write_for_flushing.patch
> new file mode 100644
> index 0000000..2653104
> --- /dev/null
> +++ b/patches/0009-update__stdout_write_for_flushing.patch
> @@ -0,0 +1,25 @@
> +From 235b3d8240fbc99782f2fb8449786f519fcb3bde Mon Sep 17 00:00:00 2001
> +From: gaulthier gain <gaulthier.gain@uliege.be>
> +Date: Fri, 28 Feb 2020 17:05:28 +0000
> +Subject: [UNIKRAFT/MUSL] Update __stdout_write to allow flushing on stdout
> +
> +Signed-off-by: gaulthier gain <gaulthier.gain@uliege.be>
> +---
> + src/stdio/__stdout_write.c | 2 +-
> + 1 file changed, 1 insertion(+), 1 deletion(-)
> +
> +diff --git a/src/stdio/__stdout_write.c b/src/stdio/__stdout_write.c
> +index dd1ec60..f9c9489 100644
> +--- a/src/stdio/__stdout_write.c
> ++++ b/src/stdio/__stdout_write.c
> +@@ -6,6 +6,6 @@ size_t __stdout_write(FILE *f, const unsigned char *buf, size_t len)
> +	struct winsize wsz;
> +	f->write = __stdio_write;
> +	if (!(f->flags & F_SVB) && __syscall(SYS_ioctl, f->fd, TIOCGWINSZ, &wsz))
> +-		f->lbf = -1;
> ++		f->lbf = '\n';
> +	return __stdio_write(f, buf, len);
> + }
> +--
> +2.17.1
> +
> --
> 2.17.1
> 
> _______________________________________________
> Minios-devel mailing list
> Minios-devel@lists.xenproject.org
> https://lists.xenproject.org/mailman/listinfo/minios-devel
> 


From minios-devel-bounces@lists.xenproject.org Mon Aug 24 06:50:20 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Mon, 24 Aug 2020 06:50:20 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1kA6J8-0006P7-6E; Mon, 24 Aug 2020 06:50:18 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=ojDw=CC=gmail.com=cristianvijelie@srs-us1.protection.inumbo.net>)
 id 1kA6J7-0006P2-05
 for minios-devel@lists.xen.org; Mon, 24 Aug 2020 06:50:17 +0000
X-Inumbo-ID: 05ec45d4-a7c0-4f56-8a70-ff4172bdfaeb
Received: from mail-ej1-x62f.google.com (unknown [2a00:1450:4864:20::62f])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 05ec45d4-a7c0-4f56-8a70-ff4172bdfaeb;
 Mon, 24 Aug 2020 06:50:15 +0000 (UTC)
Received: by mail-ej1-x62f.google.com with SMTP id si26so10428373ejb.12
 for <minios-devel@lists.xen.org>; Sun, 23 Aug 2020 23:50:15 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=from:to:subject:date:message-id:mime-version
 :content-transfer-encoding;
 bh=FbXSE1VUaYxAz6qXTlMEQYkymgPIm7tS7ZsEuf6DyBE=;
 b=YTR+IZl3qeC/Acmz+gFrFYDs4bUSFv4Bhsd54gWDMt+X9ysbqjnEE6+0Wu9ghCSbVa
 jSPcMqFkWKG8HbfWjeHKrM5Pw+tk2cIbdbugZQgEHhk5lz0NSnK+YtYfoFWzRyckK5Uh
 pKwfWmTuYW9626846sZYRcQCH+UHWqeGlp4NzujYZyrsW958HIrcxJd0ZuBRUr8HUIaY
 uTE46DQ7Cm3oBWCuUF6QOclwMeAV7lnl2MDxVzH5s/CbVq2yyMm6X9SGqW5hpu9+bA5P
 PJrtDDMDOMorcRbLODxrNNqSyu6jR+182mL7HM3yftp73epIYBaO+ue5j4Q0Q67f9r4B
 GjkQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:to:subject:date:message-id:mime-version
 :content-transfer-encoding;
 bh=FbXSE1VUaYxAz6qXTlMEQYkymgPIm7tS7ZsEuf6DyBE=;
 b=kk8OpRi81qbAJ0Rw8wuGeP36ogkZ8d+YE/T7L3/eMFj2u1iIzlu2FbL4bH/1eM/2Zh
 XPk+9UHwAK5tw+EfDv+rnsqMXJVBMcJp9s7YLmSVTpIFVfBFjsW87dLr0sXp/9AIy3Cv
 zQOQhNr3rDdyBLK1NJflQ9wkHCnFe7ZzkgPMZlypS3ewrlj4cHf4KjX2q4VACKm7TKVd
 YUuhZiQqS/qMpTLcSsuEWxw4JUX2A4GWsBoCyN02tjb/vRfMhAtnMSYqE5R1psqpAbc2
 Nn0/O/hBF7EabtXA3KNnWamzndYyxBtq7HyFi+AE3whM2l97NWYo5zkTZFgQ9m1WNscD
 TgBw==
X-Gm-Message-State: AOAM531wathg2bQAU1/8TF8IWkmpQsWNwWsxgy/p4tJ6rsjlmtcV3/89
 n/XnYpC9JLqgsWpXExgItgZnqfB+9Og=
X-Google-Smtp-Source: ABdhPJwXrtVucNrOAmxLXkyCnxS8pqGIHZDE2vJxHtDCiNmyEs8dhTh/JTloSVmMqd5k78kvjGSvIg==
X-Received: by 2002:a17:907:94ce:: with SMTP id
 dn14mr4108316ejc.351.1598251813600; 
 Sun, 23 Aug 2020 23:50:13 -0700 (PDT)
Received: from localhost.localdomain ([2a00:5dc0:ffff:0:e40b:ceb9:6f0:7289])
 by smtp.gmail.com with ESMTPSA id x1sm8622568ejc.119.2020.08.23.23.50.12
 for <minios-devel@lists.xen.org>
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Sun, 23 Aug 2020 23:50:12 -0700 (PDT)
From: cristianvijelie@gmail.com
To: minios-devel@lists.xen.org
Subject: [[UNIKRAFT PATCH] v4 1/1] lib/isrlib: Introduce libc-like
 interrupt-context-safe routines
Date: Mon, 24 Aug 2020 09:50:11 +0300
Message-Id: <20200824065011.6729-1-cristianvijelie@gmail.com>
X-Mailer: git-send-email 2.25.1
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-BeenThere: minios-devel@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Mini-os development list <minios-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:minios-devel@lists.xenproject.org>
List-Help: <mailto:minios-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: minios-devel-bounces@lists.xenproject.org
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>

From: Cristian Vijelie <cristianvijelie@gmail.com>

libisr library means to introduce interrupt-context-safe routines, 
to be used in interrupt handlers and drivers. It is derived from nolibc.

This patch adds the string functions for libisr.

Signed-off-by: Cristian Vijelie <cristianvijelie@gmail.com>
---
 include/uk/isr/string.h |  72 +++++++++
 lib/isrlib/Config.uk    |   3 +
 lib/isrlib/Makefile.uk  |   8 +
 lib/isrlib/string.c     | 325 ++++++++++++++++++++++++++++++++++++++++
 4 files changed, 408 insertions(+)
 create mode 100644 include/uk/isr/string.h
 create mode 100644 lib/isrlib/Config.uk
 create mode 100644 lib/isrlib/Makefile.uk
 create mode 100644 lib/isrlib/string.c

diff --git a/include/uk/isr/string.h b/include/uk/isr/string.h
new file mode 100644
index 0000000..bcf9fef
--- /dev/null
+++ b/include/uk/isr/string.h
@@ -0,0 +1,72 @@
+/* SPDX-License-Identifier: BSD-3-Clause */
+/*
+ * Authors: Simon Kuenzer <simon.kuenzer@neclab.eu>
+ *          Cristian Vijelie <cristianvijelie@gmail.com>
+ *
+ *
+ * Copyright (c) 2017, NEC Europe Ltd., NEC Corporation. All rights reserved.
+ * Copyright (c) 2020, University Politehnica of Bucharest. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the copyright holder nor the names of its
+ *    contributors may be used to endorse or promote products derived from
+ *    this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+#ifndef __UK_ISR_STRING_H__
+#define __UK_ISR_STRING_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <string.h>
+
+void *memcpy_isr(void *dst, const void *src, size_t len);
+void *memset_isr(void *ptr, int val, size_t len);
+void *memchr_isr(const void *ptr, int val, size_t len);
+void *memrchr_isr(const void *m, int c, size_t n);
+int memcmp_isr(const void *ptr1, const void *ptr2, size_t len);
+void *memmove_isr(void *dst, const void *src, size_t len);
+
+char *strncpy_isr(char *dst, const char *src, size_t len);
+char *strcpy_isr(char *dst, const char *src);
+size_t strlcpy_isr(char *d, const char *s, size_t n);
+size_t strlcat_isr(char *d, const char *s, size_t n);
+size_t strnlen_isr(const char *str, size_t maxlen);
+size_t strlen_isr(const char *str);
+char *strchrnul_isr(const char *s, int c);
+char *strchr_isr(const char *str, int c);
+char *strrchr_isr(const char *s, int c);
+int strncmp_isr(const char *str1, const char *str2, size_t len);
+int strcmp_isr(const char *str1, const char *str2);
+size_t strcspn_isr(const char *s, const char *c);
+size_t strspn_isr(const char *s, const char *c);
+char *strtok_isr(char *restrict s, const char *restrict sep, char **restrict p);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __UK_ISR_STRING_H__ */
diff --git a/lib/isrlib/Config.uk b/lib/isrlib/Config.uk
new file mode 100644
index 0000000..60b4274
--- /dev/null
+++ b/lib/isrlib/Config.uk
@@ -0,0 +1,3 @@
+config LIBISRLIB
+    bool "isrlib: ISR helper library"
+    default n
diff --git a/lib/isrlib/Makefile.uk b/lib/isrlib/Makefile.uk
new file mode 100644
index 0000000..26f19e8
--- /dev/null
+++ b/lib/isrlib/Makefile.uk
@@ -0,0 +1,8 @@
+$(eval $(call addlib_s,libisrlib,$(CONFIG_LIBISRLIB)))
+
+LIBISRLIB_GLOBAL_INCLUDES-y = $(LIBISRLIB_BASE)/include
+
+CINCLUDES-$(CONFIG_LIBISRLIB) += $(LIBISRLIB_GLOBAL_INCLUDES)
+CXXINCLUDES-$(CONFIG_LIBISRLIB) += $(LIBISRLIB_GLOBAL_INCLUDES)
+
+LIBISRLIB_SRCS-y += $(LIBISRLIB_BASE)/string.c|isr
diff --git a/lib/isrlib/string.c b/lib/isrlib/string.c
new file mode 100644
index 0000000..1d241d1
--- /dev/null
+++ b/lib/isrlib/string.c
@@ -0,0 +1,325 @@
+/* SPDX-License-Identifier: BSD-3-Clause AND MIT */
+/*
+ * Authors: Simon Kuenzer <simon.kuenzer@neclab.eu>
+ * Authors: Cristian Vijelie <cristianvijelie@gmail.com>
+ *
+ * Copyright (c) 2017, NEC Europe Ltd., NEC Corporation. All rights reserved.
+ * Copyright (c) 2020, University Politehnica of Bucharest. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the copyright holder nor the names of its
+ *    contributors may be used to endorse or promote products derived from
+ *    this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+/* For the parts taken from musl (marked as such below), the MIT licence
+ * applies instead:
+ * ----------------------------------------------------------------------
+ * Copyright (c) 2005-2014 Rich Felker, et al.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ * ----------------------------------------------------------------------
+ */
+
+#include <uk/isr/string.h>
+#include <uk/arch/types.h>
+#include <stdint.h>
+#include <limits.h>
+
+void *memcpy_isr(void *dst, const void *src, size_t len)
+{
+	size_t p;
+
+	for (p = 0; p < len; ++p)
+		*((__u8 *)(((__uptr)dst) + p)) = *((__u8 *)(((__uptr)src) + p));
+
+	return dst;
+}
+
+void *memset_isr(void *ptr, int val, size_t len)
+{
+	__u8 *p = (__u8 *) ptr;
+
+	for (; len > 0; --len)
+		*(p++) = (__u8)val;
+
+	return ptr;
+}
+
+void *memchr_isr(const void *ptr, int val, size_t len)
+{
+	uintptr_t o = 0;
+
+	for (o = 0; o < (uintptr_t)len; ++o)
+		if (*((const uint8_t *)(((uintptr_t)ptr) + o)) == (uint8_t)val)
+			return (void *)((uintptr_t)ptr + o);
+
+	return NULL; /* did not find val */
+}
+
+void *memrchr_isr(const void *m, int c, size_t n)
+{
+	const unsigned char *s = m;
+
+	c = (unsigned char) c;
+	while (n--)
+		if (s[n] == c)
+			return (void *) (s + n);
+	return 0;
+}
+
+void *memmove_isr(void *dst, const void *src, size_t len)
+{
+	uint8_t *d = dst;
+	const uint8_t *s = src;
+
+	if (src > dst) {
+		for (; len > 0; --len)
+			*(d++) = *(s++);
+	} else {
+		s += len;
+		d += len;
+
+		for (; len > 0; --len)
+			*(d--) = *(s--);
+	}
+
+	return dst;
+}
+
+int memcmp_isr(const void *ptr1, const void *ptr2, size_t len)
+{
+	const unsigned char *c1 = (const unsigned char *)ptr1;
+	const unsigned char *c2 = (const unsigned char *)ptr2;
+
+	for (; len > 0; --len, ++c1, ++c2) {
+		if ((*c1) != (*c2))
+			return ((*c1) - (*c2));
+	}
+
+	return 0;
+}
+
+size_t strlen_isr(const char *str)
+{
+	return strnlen_isr(str, SIZE_MAX);
+}
+
+size_t strnlen_isr(const char *str, size_t len)
+{
+	const char *p = memchr_isr(str, 0, len);
+	return p ? (size_t) (p - str) : len;
+}
+
+char *strncpy_isr(char *dst, const char *src, size_t len)
+{
+	size_t clen;
+
+	clen = strnlen_isr(src, len);
+	memcpy_isr(dst, src, clen);
+
+	/* instead of filling up the rest of left space with zeros,
+	 * append a termination character if we did not copy one
+	 */
+	if (clen < len && dst[clen - 1] != '\0')
+		dst[clen] = '\0';
+	return dst;
+}
+
+char *strcpy_isr(char *dst, const char *src)
+{
+	return strncpy_isr(dst, src, SIZE_MAX);
+}
+
+int strncmp_isr(const char *str1, const char *str2, size_t len)
+{
+	const char *c1 = (const char *)str1;
+	const char *c2 = (const char *)str2;
+
+	for (; len > 0; --len, ++c1, ++c2) {
+		if ((*c1) != (*c2))
+			return (int)((*c1) - (*c2));
+		if ((*c1) == '\0')
+			break;
+	}
+	return 0;
+}
+
+int strcmp_isr(const char *str1, const char *str2)
+{
+	register signed char __res;
+
+	while ((__res = *str1 - *str2++) == 0 && *str1++)
+		;
+
+	return __res;
+}
+
+/* The following code is taken from musl libc */
+#define ALIGN (sizeof(size_t))
+#define ONES ((size_t) -1 / UCHAR_MAX)
+#define HIGHS (ONES * (UCHAR_MAX / 2 + 1))
+#define HASZERO(x) (((x) - ONES) & ~(x) & HIGHS)
+#define BITOP(a, b, op) \
+		((a)[(size_t)(b) / (8*sizeof *(a))] op \
+		(size_t)1 << ((size_t)(b) % (8 * sizeof *(a))))
+
+char *strchrnul_isr(const char *s, int c)
+{
+	size_t *w, k;
+
+	c = (unsigned char)c;
+	if (!c)
+		return (char *)s + strlen_isr(s);
+
+	for (; (uintptr_t)s % ALIGN; s++)
+		if (!*s || *(unsigned char *)s == c)
+			return (char *)s;
+	k = ONES * c;
+	for (w = (void *)s; !HASZERO(*w) && !HASZERO(*w ^ k); w++)
+		;
+	for (s = (void *)w; *s && *(unsigned char *)s != c; s++)
+		;
+	return (char *)s;
+}
+
+char *strchr_isr(const char *str, int c)
+{
+	char *r = strchrnul_sr(str, c);
+	return *(unsigned char *)r == (unsigned char)c ? r : 0;
+}
+
+char *strrchr_isr(const char *s, int c)
+{
+	return memrchr_isr(s, c, strlen_isr(s) + 1);
+}
+
+size_t strcspn_isr(const char *s, const char *c)
+{
+	const char *a = s;
+	size_t byteset[32 / sizeof(size_t)];
+
+	if (!c[0] || !c[1])
+		return strchrnul_isr(s, *c)-a;
+
+	memset_isr(byteset, 0, sizeof(byteset));
+	for (; *c && BITOP(byteset, *(unsigned char *)c, |=); c++)
+		;
+	for (; *s && !BITOP(byteset, *(unsigned char *)s, &); s++)
+		;
+	return s-a;
+}
+
+size_t strspn_isr(const char *s, const char *c)
+{
+	const char *a = s;
+	size_t byteset[32 / sizeof(size_t)] = { 0 };
+
+	if (!c[0])
+		return 0;
+	if (!c[1]) {
+		for (; *s == *c; s++)
+			;
+		return s-a;
+	}
+
+	for (; *c && BITOP(byteset, *(unsigned char *)c, |=); c++)
+		;
+	for (; *s && BITOP(byteset, *(unsigned char *)s, &); s++)
+		;
+	return s-a;
+}
+
+char *strtok_isr(char *restrict s, const char *restrict sep, char **restrict p)
+{
+	if (!s && !(s = *p))
+		return NULL;
+	s += strspn_isr(s, sep);
+	if (!*s)
+		return *p = 0;
+	*p = s + strcspn_isr(s, sep);
+	if (**p)
+		*(*p)++ = 0;
+	else
+		*p = 0;
+	return s;
+}
+
+/* strlcpy has different ALIGN */
+#undef ALIGN
+#define ALIGN (sizeof(size_t)-1)
+size_t strlcpy_isr(char *d, const char *s, size_t n)
+{
+	char *d0 = d;
+	size_t *wd;
+	const size_t *ws;
+
+	if (!n--)
+		goto finish;
+
+	if (((uintptr_t)s & ALIGN) == ((uintptr_t)d & ALIGN)) {
+		for (; ((uintptr_t) s & ALIGN) && n && (*d = *s);
+		     n--, s++, d++)
+			;
+
+		if (n && *s) {
+			wd = (void *)d; ws = (const void *)s;
+			for (; n >= sizeof(size_t) && !HASZERO(*ws);
+			     n -= sizeof(size_t), ws++, wd++)
+				*wd = *ws;
+
+			d = (void *)wd; s = (const void *)ws;
+		}
+	}
+
+	for (; n && (*d = *s); n--, s++, d++)
+		;
+	*d = 0;
+finish:
+	return d-d0 + strlen_isr(s);
+}
+
+size_t strlcat_isr(char *d, const char *s, size_t n)
+{
+	size_t l = strnlen_isr(d, n);
+	if (l == n)
+		return l + strlen_isr(s);
+	return l + strlcpy_isr(d+l, s, n-l);
+}
-- 
2.25.1



From minios-devel-bounces@lists.xenproject.org Mon Aug 24 08:39:11 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Mon, 24 Aug 2020 08:39:11 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1kA80T-00081i-CC; Mon, 24 Aug 2020 08:39:09 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=RyOm=CC=neclab.eu=sharan.santhanam@srs-us1.protection.inumbo.net>)
 id 1kA80S-00081b-QG
 for minios-devel@lists.xen.org; Mon, 24 Aug 2020 08:39:08 +0000
X-Inumbo-ID: 69ffd228-ed51-4dc0-a23a-095759200288
Received: from mailer2.neclab.eu (unknown [195.37.70.41])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 69ffd228-ed51-4dc0-a23a-095759200288;
 Mon, 24 Aug 2020 08:39:06 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
 by mailer2.neclab.eu (Postfix) with ESMTP id 498B8F202D;
 Mon, 24 Aug 2020 10:39:05 +0200 (CEST)
X-Virus-Scanned: Amavisd on Debian GNU/Linux (atlas-b.office.hd)
Received: from mailer2.neclab.eu ([127.0.0.1])
 by localhost (atlas-b.office.hd [127.0.0.1]) (amavisd-new, port 10024)
 with ESMTP id YEzXznILI84j; Mon, 24 Aug 2020 10:39:05 +0200 (CEST)
X-ENC: Last-Hop-TLS-encrypted
X-ENC: Last-Hop-TLS-encrypted
Received: from puck.office.hd (puck.office.hd [192.168.24.91])
 (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
 (No client certificate requested)
 by mailer2.neclab.eu (Postfix) with ESMTPS id 1C8F9F200F;
 Mon, 24 Aug 2020 10:39:01 +0200 (CEST)
Received: from [10.7.1.9] (192.168.24.96) by puck.office.hd (192.168.24.91)
 with Microsoft SMTP Server (version=TLS1_2,
 cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1979.3; Mon, 24 Aug
 2020 10:39:00 +0200
Subject: Re: [UNIKRAFT PATCH] lib/uknetdev: Provide IEEE 802.1q, 802.1ad,
 Jumbo frame definitions
To: Simon Kuenzer <simon.kuenzer@neclab.eu>, <minios-devel@lists.xen.org>
CC: Costin Lupu <costin.lupu@cs.pub.ro>
References: <20200820144549.13687-1-simon.kuenzer@neclab.eu>
From: Sharan Santhanam <sharan.santhanam@neclab.eu>
Message-ID: <0f08b7c5-eebf-cf14-0d45-d8ced28e8957@neclab.eu>
Date: Mon, 24 Aug 2020 10:38:52 +0200
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101
 Thunderbird/68.10.0
MIME-Version: 1.0
In-Reply-To: <20200820144549.13687-1-simon.kuenzer@neclab.eu>
Content-Type: text/plain; charset="utf-8"; format=flowed
Content-Transfer-Encoding: 7bit
Content-Language: en-US
X-Originating-IP: [192.168.24.96]
X-ClientProxiedBy: titania.office.hd (192.168.24.89) To puck.office.hd
 (192.168.24.91)
X-BeenThere: minios-devel@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Mini-os development list <minios-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:minios-devel@lists.xenproject.org>
List-Help: <mailto:minios-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: minios-devel-bounces@lists.xenproject.org
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>

Hello Simon,

This patch seems fine to me.

Reviewed-by: Sharan Santhanam <sharan.santhanam@neclab.eu>

Thanks & Regards

Sharan

On 8/20/20 4:45 PM, Simon Kuenzer wrote:
> This commit includes support for IEEE 802.1q and IEEE 802.1ad tagged
> frames to the recently introduced Ethernet header and frame definitions.
> Due to these standards, an Ethernet frame (without FCS/CRC) can be 1522 B
> (non-jumbo) and 9022 B (jumbo).
> Together with this commit, the definitions are name spaced with `UK_`
> prefix. This is done to avoid possible macro name clashes when porting
> network stacks or packet processing frameworks to libuknetdev.
>
> Signed-off-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
> ---
>   lib/uknetdev/include/uk/netdev_core.h | 56 ++++++++++++++++++++++-----
>   plat/drivers/virtio/virtio_net.c      |  8 ++--
>   2 files changed, 51 insertions(+), 13 deletions(-)
>
> diff --git a/lib/uknetdev/include/uk/netdev_core.h b/lib/uknetdev/include/uk/netdev_core.h
> index 1e8b4e72..b9a994e3 100644
> --- a/lib/uknetdev/include/uk/netdev_core.h
> +++ b/lib/uknetdev/include/uk/netdev_core.h
> @@ -73,16 +73,58 @@ struct uk_netdev;
>   UK_TAILQ_HEAD(uk_netdev_list, struct uk_netdev);
>   
>   /**
> - * Ethernet macros
> + * Ethernet size macros
>    */
> -#define ETH_HDR_LEN           14
> -#define ETH_PKT_PAYLOAD_LEN   1500
> -#define ETH_PKT_LEN           (ETH_HDR_LEN + ETH_PKT_PAYLOAD_LEN)
> +/* Header fields */
> +#define UK_ETH_ADDR_LEN			   6
> +#define UK_ETH_TYPE_LEN			   2
> +#define UK_ETH_8021Q_LEN		(UK_ETH_TYPE_LEN + 2)
> +
> +/* Ethernet header */
> +/* Untagged */
> +#define UK_ETH_HDR_UNTAGGED_LEN		((2 * UK_ETH_ADDR_LEN) + \
> +					 UK_ETH_TYPE_LEN)
> +/* Single VLAN tag (IEEE 802.1q) */
> +#define UK_ETH_HDR_8021Q_LEN		(UK_ETH_HDR_UNTAGGED_LEN + \
> +					 UK_ETH_8021Q_LEN)
> +/* Double VLAN tag (IEEE 802.1q) */
> +#define UK_ETH_HDR_8021AD_LEN		(UK_ETH_HDR_UNTAGGED_LEN + \
> +					 (2 * UK_ETH_8021Q_LEN))
> +
> +/* Payload */
> +#define UK_ETH_PAYLOAD_MAXLEN		1500
> +#define UK_ETH_JPAYLOAD_MAXLEN		9000 /**< Jumbo frame. */
> +
> +/* Frame sizes */
> +#define UK_ETH_FRAME_MINLEN		  60
> +
> +
> +#define UK_ETH_FRAME_UNTAGGED_MAXLEN	(UK_ETH_HDR_UNTAGGED_LEN +	\
> +					 UK_ETH_PAYLOAD_MAXLEN)
> +#define UK_ETH_FRAME_8021Q_MAXLEN	(UK_ETH_HDR_8021_LEN + \
> +					 UK_ETH_PAYLOAD_MAXLEN)
> +#define UK_ETH_FRAME_8021AD_MAXLEN	(UK_ETH_HDR_8021ADLEN + \
> +					 UK_ETH_PAYLOAD_MAXLEN)
> +#define UK_ETH_FRAME_MAXLEN		(UK_ETH_FRAME_8021AD_MAXLEN)
> +
> +
> +#define UK_ETH_JFRAME_UNTAGGED_MAXLEN	(UK_ETH_HDR_UNTAGGED_LEN +	\
> +					 UK_ETH_JPAYLOAD_MAXLEN)
> +#define UK_ETH_JFRAME_8021Q_MAXLEN	(UK_ETH_HDR_8021_LEN + \
> +					 UK_ETH_JPAYLOAD_MAXLEN)
> +#define UK_ETH_JFRAME_8021AD_MAXLEN	(UK_ETH_HDR_8021ADLEN + \
> +					 UK_ETH_JPAYLOAD_MAXLEN)
> +#define UK_ETH_JFRAME_MAXLEN		(UK_ETH_JFRAME_8021AD_MAXLEN)
>   
>   /**
>    * A structure used for Ethernet hardware addresses
>    */
> -#define UK_NETDEV_HWADDR_LEN 6 /**< Length of Ethernet address. */
> +#define UK_NETDEV_HWADDR_LEN		(UK_ETH_ADDR_LEN)
> +
> +struct uk_hwaddr {
> +	uint8_t addr_bytes[UK_NETDEV_HWADDR_LEN];
> +} __packed;
> +
>   
>   /**
>    * The netdevice support rx/tx interrupt.
> @@ -95,10 +137,6 @@ UK_TAILQ_HEAD(uk_netdev_list, struct uk_netdev);
>   #define uk_netdev_rxintr_supported(feature)	\
>   	(feature & (UK_FEATURE_RXQ_INTR_AVAILABLE))
>   
> -struct uk_hwaddr {
> -	uint8_t addr_bytes[UK_NETDEV_HWADDR_LEN];
> -} __packed;
> -
>   /**
>    * A structure used to describe network device capabilities.
>    */
> diff --git a/plat/drivers/virtio/virtio_net.c b/plat/drivers/virtio/virtio_net.c
> index b0663e60..6f5d2422 100644
> --- a/plat/drivers/virtio/virtio_net.c
> +++ b/plat/drivers/virtio/virtio_net.c
> @@ -47,8 +47,8 @@
>    *		   12 bytes in length in modern mode.
>    */
>   #define VIRTIO_HDR_LEN          12
> -#define VIRTIO_PKT_BUFFER_LEN ((ETH_PKT_PAYLOAD_LEN)	\
> -			       + (ETH_HDR_LEN)		\
> +#define VIRTIO_PKT_BUFFER_LEN ((UK_ETH_PAYLOAD_MAXLEN) \
> +			       + (UK_ETH_HDR_UNTAGGED_LEN) \
>   			       + (VIRTIO_HDR_LEN))
>   
>   #define DRIVER_NAME           "virtio-net"
> @@ -511,7 +511,7 @@ static int virtio_netdev_rxq_dequeue(struct uk_netdev_rx_queue *rxq,
>   		*netbuf = NULL;
>   		return rxq->nb_desc;
>   	}
> -	if (unlikely((len < VIRTIO_HDR_LEN + ETH_HDR_LEN)
> +	if (unlikely((len < VIRTIO_HDR_LEN + UK_ETH_HDR_UNTAGGED_LEN)
>   		     || (len > VIRTIO_PKT_BUFFER_LEN))) {
>   		uk_pr_err("Received invalid packet size: %"__PRIu32"\n", len);
>   		return -EINVAL;
> @@ -1137,7 +1137,7 @@ static int virtio_net_add_dev(struct virtio_dev *vdev)
>   	}
>   	vndev->uid = rc;
>   	rc = 0;
> -	vndev->max_mtu = ETH_PKT_PAYLOAD_LEN;
> +	vndev->max_mtu = UK_ETH_PAYLOAD_MAXLEN;
>   	vndev->mtu = vndev->max_mtu;
>   	vndev->promisc = 0;
>   	virtio_netdev_feature_set(vndev);


From minios-devel-bounces@lists.xenproject.org Mon Aug 24 12:46:41 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Mon, 24 Aug 2020 12:46:41 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1kABrz-0006K2-7s; Mon, 24 Aug 2020 12:46:39 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=t+KQ=CC=gmail.com=felix.nasch@srs-us1.protection.inumbo.net>)
 id 1kABrx-0006Jn-TP
 for minios-devel@lists.xen.org; Mon, 24 Aug 2020 12:46:37 +0000
X-Inumbo-ID: d8234725-8984-41f0-a40f-cf9768b9c71d
Received: from mail-wr1-x432.google.com (unknown [2a00:1450:4864:20::432])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id d8234725-8984-41f0-a40f-cf9768b9c71d;
 Mon, 24 Aug 2020 12:46:37 +0000 (UTC)
Received: by mail-wr1-x432.google.com with SMTP id o4so4510314wrn.0
 for <minios-devel@lists.xen.org>; Mon, 24 Aug 2020 05:46:37 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=mime-version:from:date:message-id:subject:to;
 bh=v60itV3IKUrWb/brMQbjZ+PW+yWSg0XKotVKPAn0njg=;
 b=WM+AbzuWP9z5ejkkpjro0jO1tuNeIT0ISPynnKMIEsbiw5vwtc0Xaq5Hiamaqqdric
 Rsr+t204Pj5ptsq1W4EpR4FztO1Z07o7C3fL4ry/NfzuI3jY4jiBT1NUh42gQ6IY5Lku
 O/Wv6cjXrP2QGrJkzwKzYpnusX6tFi5/fodFNG9HksqX15i/8Hhg31G7ldLQi63mAlB8
 OPVDxjP/Aq071COEUNohXiai4SxbF1a8Nf3QP5R1nBDV3PBHFRaPD+YubWBuRvaCX4aI
 DWdpSyPQhR0oRBChx+3kn3ziLivZuXvtZ+9ePXz4LgYz2wwMHm0NlpMm0jBMXmT0gunT
 Jt/g==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:mime-version:from:date:message-id:subject:to;
 bh=v60itV3IKUrWb/brMQbjZ+PW+yWSg0XKotVKPAn0njg=;
 b=hfkbv/VMESGstvsVYvnhOS2Da1U1JojuhFP9p3t5uU0mzDao139/v+YoRMRHwagOM4
 07DHxOwQ0GQ4L8ZY0W6yGkh2HOKVOYGk+ZnMrB3Y4vGkYLfpR2juq+ldUsBo7AzRqilG
 0TbA8wEvQVMEQe46ieqPWp+aQgjZvkxQPjn2NZJTZDcIYf7F+GxZ4uRO3QktVCx38JLD
 M7AvuT8WNr5byqM9/2AA0gyGj5CkfUg6xQ6mIrK+QtEFJyHpkJ92CjnMJMfYHHPeXeIa
 5Szk26YFS9t7EsWZ/R7YUek+KhYMRAwPmePogSpdRehpYbajL7BRqmFYjoIDRl0PvrN9
 kWkQ==
X-Gm-Message-State: AOAM531RfilO8rL+eX9O/G2rq7lhdve+MlWH23cRkbjIdCDpPU7Lj20v
 5mrtE6O4tAhRxgXlWOqrNGoXIkefkS/zPDw3/+l4T6KgjGs=
X-Google-Smtp-Source: ABdhPJyVT/5sFCNsG2zP+Ntajz9jqGnW7eMQEvFW/J6WWi/9nB8V2DfjPipQrCHbzyUuYpdBoIBsVxRgPuiDSdhzmEQ=
X-Received: by 2002:a5d:5589:: with SMTP id i9mr5654850wrv.127.1598273196168; 
 Mon, 24 Aug 2020 05:46:36 -0700 (PDT)
MIME-Version: 1.0
From: felix nasch <felix.nasch@gmail.com>
Date: Mon, 24 Aug 2020 14:46:25 +0200
Message-ID: <CAMEmTtXLPNPjGLenfH2Jhq=-HszQwwZzVoPXbB1FE5GQUnTNjQ@mail.gmail.com>
Subject: mounting files/directory into unikraft app
To: minios-devel@lists.xen.org
Content-Type: text/plain; charset="UTF-8"
X-BeenThere: minios-devel@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Mini-os development list <minios-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:minios-devel@lists.xenproject.org>
List-Help: <mailto:minios-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: minios-devel-bounces@lists.xenproject.org
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>

Hi,

I am working on virtual machine introspection with the inspector as a
unikraft application. For this, I need to access some virtual files
provided by xen.

Essentially, I need to map a few files, like e.g. "/dev/xen/privcmd"
into my unikraft application. However, I dont understand how to do
that. There are some hints in e.g.
https://github.com/unikraft/lib-python3 , but i am not even sure where
to place the mentioned  -fsdev and -device parameters...

Can you give some advice on how to accomplish this?

Thanks. :)


From minios-devel-bounces@lists.xenproject.org Tue Aug 25 11:54:48 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Tue, 25 Aug 2020 11:54:48 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1kAXXH-0005G5-Tu; Tue, 25 Aug 2020 11:54:43 +0000
Received: from [34.197.232.57] (helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=Y3FT=CD=uliege.be=gaulthier.gain@srs-us1.protection.inumbo.net>)
 id 1kAXXG-0004WO-2d
 for minios-devel@lists.xenproject.org; Tue, 25 Aug 2020 11:54:42 +0000
X-Inumbo-ID: 9d397dd2-be77-4b5d-8f45-f2b81c0bd0e0
Received: from serv108.segi.ulg.ac.be (unknown [139.165.32.111])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 9d397dd2-be77-4b5d-8f45-f2b81c0bd0e0;
 Tue, 25 Aug 2020 11:51:25 +0000 (UTC)
Received: from sauron.run.montefiore.ulg.ac.be
 (sauron.run.montefiore.ulg.ac.be [139.165.223.31])
 (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
 (No client certificate requested)
 by serv108.segi.ulg.ac.be (Postfix) with ESMTPSA id 501442011241;
 Tue, 25 Aug 2020 13:51:24 +0200 (CEST)
DKIM-Filter: OpenDKIM Filter v2.11.0 serv108.segi.ulg.ac.be 501442011241
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=uliege.be;
 s=ulg20190529; t=1598356284;
 bh=ZsqTHbu4aoSfAKBOexoJS10b5ofxFgxcg31kuNkjpF4=;
 h=From:To:Cc:Subject:Date:From;
 b=sIHhMu31t6WSkmA85KzBbf4o/qYahud0tHLf6tsI31Rs6izC4NjM9H+O99e57B6+z
 fd6/AnCqYAVPFNIxyGQoe4myIduYQ5pPG5sisC4uPI+4t2H8soq/6pePDh9ymbb9v8
 sX3KM930Lylz5ZWrS8VUVoF9TqruGzfV5UauzcxqsirJG3XwVP6x/JYf1czSkN1nxf
 F7hezU0PcS7VLPnBUGbr+EJlTtoAGZS7mYuIb5SbDUtVwGKHel+Qhiw+Cr209MSX4Q
 laJf+Lug9DFXVDBpRpyEsmqBFVFu1R5bV6aPwsJwafYclzH6FS+5NmFVBnJ2QZrlie
 +WNnjP/4U21og==
From: gaulthier.gain@uliege.be
To: minios-devel@lists.xenproject.org
Cc: gaulthier gain <gaulthier.gain@uliege.be>
Subject: [UNIKRAFT] include: uk/page.h: Include arch instead of asm
Date: Tue, 25 Aug 2020 11:51:05 +0000
Message-Id: <20200825115105.9437-1-gaulthier.gain@uliege.be>
X-Mailer: git-send-email 2.17.1
X-BeenThere: minios-devel@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Mini-os development list <minios-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:minios-devel@lists.xenproject.org>
List-Help: <mailto:minios-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: minios-devel-bounces@lists.xenproject.org
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>

From: gaulthier gain <gaulthier.gain@uliege.be>

This patch allows to use the uk/arch/limits.h instead of uk/asm/limits.h
since asm/limits.h cannot be directly included.

Signed-off-by: gaulthier gain <gaulthier.gain@uliege.be>
---
 include/uk/page.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/uk/page.h b/include/uk/page.h
index 4e95f1b6..a9262635 100644
--- a/include/uk/page.h
+++ b/include/uk/page.h
@@ -35,7 +35,7 @@
 #ifndef __UK_PAGE_H__
 #define __UK_PAGE_H__
 
-#include <uk/asm/limits.h>
+#include <uk/arch/limits.h>
 #include <uk/essentials.h>
 
 #ifdef __cplusplus
-- 
2.17.1



From minios-devel-bounces@lists.xenproject.org Wed Aug 26 07:04:28 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Wed, 26 Aug 2020 07:04:28 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1kApTu-000653-1S; Wed, 26 Aug 2020 07:04:26 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=KeZZ=CE=gmail.com=cristianvijelie@srs-us1.protection.inumbo.net>)
 id 1kApTs-00064u-Jp
 for minios-devel@lists.xen.org; Wed, 26 Aug 2020 07:04:24 +0000
X-Inumbo-ID: 2745ebd8-f7a9-4670-867f-49a15101ecd2
Received: from mail-ej1-x629.google.com (unknown [2a00:1450:4864:20::629])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 2745ebd8-f7a9-4670-867f-49a15101ecd2;
 Wed, 26 Aug 2020 07:04:22 +0000 (UTC)
Received: by mail-ej1-x629.google.com with SMTP id d26so1411988ejr.1
 for <minios-devel@lists.xen.org>; Wed, 26 Aug 2020 00:04:21 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=from:to:subject:date:message-id:mime-version
 :content-transfer-encoding;
 bh=8tj1Hvt2fmHqBjrOxJlLTlk/OpQCXGUwGPxwQ71YF0I=;
 b=s8/FBS5XLhxQVLf70Jd/8hLftunDK7rRT/vjU+g6lWpYwxtVadA3yINqIzOOFFP2e5
 TrJ2D8oMz52O1LIXfZ2HUWijJm5eWUeqEPEDxFsx8KqK44A7x0ISB8gOP6HC2Bfv2j1t
 bL+SPuFqrwV1P3k2+r9nsBD/S+ux2DCW4+eXoLHwvJmsbGuHZG5rBuIJIHQleuP3tUQ8
 xBAJCcd9pItx7v8doogm3BPqx7BKGzMoiVUDtwHcrZmh69oTaLcB5sBSmOCgBERYx0nU
 v/mvTX5ec0i9xZ1KRRM+uSNpFwYIuhHmoo9BcYr/i3ciHAogIAN4DmDL+IY1dnSLTSTf
 IhZw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:to:subject:date:message-id:mime-version
 :content-transfer-encoding;
 bh=8tj1Hvt2fmHqBjrOxJlLTlk/OpQCXGUwGPxwQ71YF0I=;
 b=E171SL3xpcqbd9Ftsp5tIGOsXe/WHsxoDS6f/REEV5+EpZX0GS2mJaH78ZYam+V/O4
 z5tbkWFX9fZuQqzXeTDbfYlTW9S2bEQphjM5U4BGVpCneY2VTrpmGV7gapOOXrtY7zbN
 noYfKvTLOacVpFuj8erma4PbTRP1OXJwtI2DafRyu1JQfkdmNj+BpNM2QXG7N5A4eAj6
 YIii1mm2a8IgrXTfEnoqTqWbtlPxDszhoU7z6JqnfbbmLtQZHBPrI/APpdXWFKHsK11W
 X8HuC3cGcUYScKUOrGBcLC3fY95GIsQkeJzTrMx8wpk2EklROUXvDDpVzpe25LxMGTMM
 rFAA==
X-Gm-Message-State: AOAM533SourC7Vy4VdkOrFKiI+41lEuH7/xKinHUwruFyAMzKriCZIsY
 KIo3066WIfq8MQdNc3YFVs2p7XcjaA8=
X-Google-Smtp-Source: ABdhPJyxRmznIzR8DloNYW9/8baY6rMOZ1z+rCJElDrTTi3txpbN1Ukj41EJSVRtnRxppCji0wM0Nw==
X-Received: by 2002:a17:906:6a15:: with SMTP id
 o21mr13864605ejr.496.1598425457376; 
 Wed, 26 Aug 2020 00:04:17 -0700 (PDT)
Received: from localhost.localdomain ([2a00:5dc0:ffff:0:4174:3bd1:9f32:f968])
 by smtp.gmail.com with ESMTPSA id
 r26sm1248257eds.79.2020.08.26.00.04.16
 for <minios-devel@lists.xen.org>
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Wed, 26 Aug 2020 00:04:16 -0700 (PDT)
From: cristianvijelie@gmail.com
To: minios-devel@lists.xen.org
Subject: [[UNIKRAFT] v4] lib/isrlib: Introduce stdlib irq-safe rutines
Date: Wed, 26 Aug 2020 10:04:15 +0300
Message-Id: <20200826070415.7732-1-cristianvijelie@gmail.com>
X-Mailer: git-send-email 2.25.1
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-BeenThere: minios-devel@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Mini-os development list <minios-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:minios-devel@lists.xenproject.org>
List-Help: <mailto:minios-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: minios-devel-bounces@lists.xenproject.org
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>

From: Cristian Vijelie <cristianvijelie@gmail.com>

This patch introduces stdlib interrupt-context-safe functions, based on
nolibc. I removed abort, as it made no sense to have another abort
function.

Signed-off-by: Cristian Vijelie <cristianvijelie@gmail.com>
---
 include/uk/isr/stdlib.h |  63 ++++++
 lib/isrlib/Makefile.uk  |   2 +
 lib/isrlib/qsort.c      | 157 +++++++++++++++
 lib/isrlib/stdlib.c     | 417 ++++++++++++++++++++++++++++++++++++++++
 4 files changed, 639 insertions(+)
 create mode 100644 include/uk/isr/stdlib.h
 create mode 100644 lib/isrlib/qsort.c
 create mode 100644 lib/isrlib/stdlib.c

diff --git a/include/uk/isr/stdlib.h b/include/uk/isr/stdlib.h
new file mode 100644
index 0000000..30eb443
--- /dev/null
+++ b/include/uk/isr/stdlib.h
@@ -0,0 +1,63 @@
+/* SPDX-License-Identifier: BSD-2-Clause */
+/*
+ * Copyright (c) 2009 Citrix Systems, Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#ifndef __UK_ISR_STDLIB_H__
+#define __UK_ISR_STDLIB_H__
+
+#include <stdlib.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * Convert a string to an unsigned long integer.
+ * Ignores `locale' stuff.  Assumes that the upper and lower case
+ * alphabets and digits are each contiguous.
+ *
+ * @nptr:   The start of the string
+ * @endptr: A pointer to the end of the parsed string will be placed here
+ * @base:   The number base to use
+ */
+long strtol_isr(const char *nptr, char **endptr, int base);
+unsigned long strtoul_isr(const char *nptr, char **endptr, int base);
+long long strtoll_isr(const char *nptr, char **endptr, int base);
+unsigned long long strtoull_isr(const char *nptr, char **endptr, int base);
+
+/**
+ * Convert a string to an integer
+ * @s: The start of the string
+ */
+int atoi_isr(const char *s);
+
+void qsort_isr(void *base, size_t nmemb, size_t size,
+           int (*compar)(const void *, const void *));
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __UK_ISR_STDLIB_H__ */
diff --git a/lib/isrlib/Makefile.uk b/lib/isrlib/Makefile.uk
index 26f19e8..9b60e04 100644
--- a/lib/isrlib/Makefile.uk
+++ b/lib/isrlib/Makefile.uk
@@ -6,3 +6,5 @@ CINCLUDES-$(CONFIG_LIBISRLIB) += $(LIBISRLIB_GLOBAL_INCLUDES)
 CXXINCLUDES-$(CONFIG_LIBISRLIB) += $(LIBISRLIB_GLOBAL_INCLUDES)
 
 LIBISRLIB_SRCS-y += $(LIBISRLIB_BASE)/string.c|isr
+LIBISRLIB_SRCS-y += $(LIBISRLIB_BASE)/stdlib.c|isr
+LIBISRLIB_SRCS-y += $(LIBISRLIB_BASE)/qsort.c|isr
diff --git a/lib/isrlib/qsort.c b/lib/isrlib/qsort.c
new file mode 100644
index 0000000..418e217
--- /dev/null
+++ b/lib/isrlib/qsort.c
@@ -0,0 +1,157 @@
+/*	$OpenBSD: qsort.c,v 1.10 2005/08/08 08:05:37 espie Exp $ */
+/*-
+ * Copyright (c) 1992, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+#include <sys/types.h>
+#include <uk/isr/stdlib.h>
+static inline char	*med3_isr(char *, char *, char *, int (*)
+				(const void *, const void *));
+static inline void	 swapfunc_isr(char *, char *, int, int);
+#define min(a, b)	((a) < (b) ? a : b)
+/*
+ * Qsort routine from Bentley & McIlroy's "Engineering a Sort Function".
+ */
+#define swapcode(TYPE, parmi, parmj, n) {		\
+	long i = (n) / sizeof(TYPE);			\
+	TYPE *pi = (TYPE *) (parmi);			\
+	TYPE *pj = (TYPE *) (parmj);			\
+	do {						\
+		TYPE	t = *pi;			\
+		*pi++ = *pj;				\
+		*pj++ = t;				\
+	} while (--i > 0);				\
+}
+#define SWAPINIT(a, es) (swaptype = ((char *)a - (char *)0) % sizeof(long) || \
+	es % sizeof(long) ? 2 : es == sizeof(long) ? 0 : 1)
+static inline void
+swapfunc_isr(char *a, char *b, int n, int swaptype)
+{
+	if (swaptype <= 1)
+		swapcode(long, a, b, n)
+	else
+		swapcode(char, a, b, n)
+}
+#define swap(a, b)					\
+	do {						\
+		if (swaptype == 0) {				\
+			long t = *(long *)(a);			\
+			*(long *)(a) = *(long *)(b);		\
+			*(long *)(b) = t;			\
+		} else						\
+			swapfunc_isr(a, b, es, swaptype);		\
+	} while (0)
+
+#define vecswap(a, b, n)					\
+	do {							\
+		if ((n) > 0)					\
+			swapfunc_isr(a, b, n, swaptype);		\
+	} while (0)
+static inline char *
+med3_isr(char *a, char *b, char *c, int (*cmp)(const void *, const void *))
+{
+	return cmp(a, b) < 0 ?
+		(cmp(b, c) < 0 ? b : (cmp(a, c) < 0 ? c : a))
+		: (cmp(b, c) > 0 ? b : (cmp(a, c) < 0 ? a : c));
+}
+void
+qsort_isr(void *aa, size_t n, size_t es, int (*cmp)(const void *, const void *))
+{
+	char *pa, *pb, *pc, *pd, *pl, *pm, *pn;
+	int d, r, swaptype, swap_cnt;
+	char *a = aa;
+loop:
+	SWAPINIT(a, es);
+	swap_cnt = 0;
+	if (n < 7) {
+		for (pm = (char *)a + es; pm < (char *) a + n * es; pm += es)
+			for (pl = pm; pl > (char *) a && cmp(pl - es, pl) > 0;
+			     pl -= es)
+				swap(pl, pl - es);
+		return;
+	}
+	pm = (char *)a + (n / 2) * es;
+	if (n > 7) {
+		pl = (char *)a;
+		pn = (char *)a + (n - 1) * es;
+		if (n > 40) {
+			d = (n / 8) * es;
+			pl = med3_isr(pl, pl + d, pl + 2 * d, cmp);
+			pm = med3_isr(pm - d, pm, pm + d, cmp);
+			pn = med3_isr(pn - 2 * d, pn - d, pn, cmp);
+		}
+		pm = med3_isr(pl, pm, pn, cmp);
+	}
+	swap(a, pm);
+	pa = pb = (char *)a + es;
+
+	pc = pd = (char *)a + (n - 1) * es;
+	for (;;) {
+		while (pb <= pc && (r = cmp(pb, a)) <= 0) {
+			if (r == 0) {
+				swap_cnt = 1;
+				swap(pa, pb);
+				pa += es;
+			}
+			pb += es;
+		}
+		while (pb <= pc && (r = cmp(pc, a)) >= 0) {
+			if (r == 0) {
+				swap_cnt = 1;
+				swap(pc, pd);
+				pd -= es;
+			}
+			pc -= es;
+		}
+		if (pb > pc)
+			break;
+		swap(pb, pc);
+		swap_cnt = 1;
+		pb += es;
+		pc -= es;
+	}
+	if (swap_cnt == 0) {  /* Switch to insertion sort */
+		for (pm = (char *) a + es; pm < (char *) a + n * es; pm += es)
+			for (pl = pm; pl > (char *) a && cmp(pl - es, pl) > 0;
+			     pl -= es)
+				swap(pl, pl - es);
+		return;
+	}
+	pn = (char *)a + n * es;
+	r = min(pa - (char *)a, pb - pa);
+	vecswap(a, pb - r, r);
+	r = min(pd - pc, pn - pd - (int)es);
+	vecswap(pb, pn - r, r);
+	if ((r = pb - pa) > (int)es)
+		qsort_isr(a, r / es, es, cmp);
+	if ((r = pd - pc) > (int)es) {
+		/* Iterate rather than recurse to save stack space */
+		a = pn - r;
+		n = r / es;
+		goto loop;
+	}
+}
diff --git a/lib/isrlib/stdlib.c b/lib/isrlib/stdlib.c
new file mode 100644
index 0000000..d1aad75
--- /dev/null
+++ b/lib/isrlib/stdlib.c
@@ -0,0 +1,417 @@
+/* SPDX-License-Identifier: BSD-3-Clause */
+/*
+ ****************************************************************************
+ *
+ *        File: printf.c
+ *      Author: Juergen Gross <jgross@suse.com>
+ *
+ *        Date: Jun 2016
+ *
+ * Environment: Xen Minimal OS
+ * Description: Library functions for printing
+ *              (FreeBSD port)
+ *
+ ****************************************************************************
+ */
+
+/*-
+ * Copyright (c) 1990, 1993
+ * The Regents of the University of California.  All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Chris Torek.
+ *
+ * Copyright (c) 2011 The FreeBSD Foundation
+ * All rights reserved.
+ * Portions of this software were developed by David Chisnall
+ * under sponsorship from the FreeBSD Foundation.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <errno.h>
+#include <stdint.h>
+#include <stdlib.h>
+#include <limits.h>
+#include <ctype.h>
+#include <uk/print.h>
+#include <uk/plat/bootstrap.h>
+#include <uk/arch/limits.h>
+
+#define __DECONST(type, var) ((type)(uintptr_t)(const void *)(var))
+
+/*
+ * Convert a string to an unsigned long integer.
+ *
+ * Ignores `locale' stuff.  Assumes that the upper and lower case
+ * alphabets and digits are each contiguous.
+ */
+unsigned long strtoul_isr(const char *nptr, char **endptr, int base)
+{
+	const char *s = nptr;
+	unsigned long acc;
+	unsigned char c;
+	unsigned long cutoff;
+	int neg = 0, any, cutlim;
+
+	if (base < 0 || base == 1 || base > 36) {
+		errno = -EINVAL;
+		any = 0;
+		acc = 0;
+		goto exit;
+	}
+
+	/*
+	 * See strtol for comments as to the logic used.
+	 */
+	do {
+		c = *s++;
+	} while (isspace(c));
+	if (c == '-') {
+		neg = 1;
+		c = *s++;
+	} else if (c == '+')
+		c = *s++;
+	if ((base == 0 || base == 16) && c == '0' && (*s == 'x' || *s == 'X')) {
+		c = s[1];
+		s += 2;
+		base = 16;
+	}
+	if (base == 0)
+		base = c == '0' ? 8 : 10;
+	cutoff = (unsigned long)ULONG_MAX / (unsigned long)base;
+	cutlim = (unsigned long)ULONG_MAX % (unsigned long)base;
+	for (acc = 0, any = 0;; c = *s++) {
+		if (!isascii(c))
+			break;
+		if (isdigit(c))
+			c -= '0';
+		else if (isalpha(c))
+			c -= isupper(c) ? 'A' - 10 : 'a' - 10;
+		else
+			break;
+		if (c >= base)
+			break;
+		if (any < 0 || acc > cutoff || (acc == cutoff && c > cutlim))
+			any = -1;
+		else {
+			any = 1;
+			acc *= base;
+			acc += c;
+		}
+	}
+	if (any < 0) {
+		acc = ULONG_MAX;
+		errno = ERANGE;
+	} else if (neg)
+		acc = -acc;
+exit:
+	if (endptr != 0)
+		*endptr = __DECONST(char *, any ? s - 1 : nptr);
+	return acc;
+}
+
+long strtol_isr(const char *nptr, char **endptr, int base)
+{
+	const char *s;
+	unsigned long acc;
+	unsigned char c;
+	unsigned long qbase, cutoff;
+	int neg, any, cutlim;
+
+	s = nptr;
+	if (base < 0 || base == 1 || base > 36) {
+		errno = -EINVAL;
+		any = 0;
+		acc = 0;
+		goto exit;
+	}
+
+	/*
+	 * Skip white space and pick up leading +/- sign if any.
+	 * If base is 0, allow 0x for hex and 0 for octal, else
+	 * assume decimal; if base is already 16, allow 0x.
+	 */
+	do {
+		c = *s++;
+	} while (isspace(c));
+	if (c == '-') {
+		neg = 1;
+		c = *s++;
+	} else {
+		neg = 0;
+		if (c == '+')
+			c = *s++;
+	}
+	if ((base == 0 || base == 16) && c == '0' && (*s == 'x' || *s == 'X')) {
+		c = s[1];
+		s += 2;
+		base = 16;
+	}
+	if (base == 0)
+		base = c == '0' ? 8 : 10;
+
+	/*
+	 * Compute the cutoff value between legal numbers and illegal
+	 * numbers.  That is the largest legal value, divided by the
+	 * base.  An input number that is greater than this value, if
+	 * followed by a legal input character, is too big.  One that
+	 * is equal to this value may be valid or not; the limit
+	 * between valid and invalid numbers is then based on the last
+	 * digit.  For instance, if the range for quads is
+	 * [-2147483648..2147483647] and the input base
+	 * is 10, cutoff will be set to 2147483647 and cutlim to
+	 * either 7 (neg==0) or 8 (neg==1), meaning that if we have
+	 * accumulated a value > 2147483647, or equal but the
+	 * next digit is > 7 (or 8), the number is too big, and we will
+	 * return a range error.
+	 *
+	 * Set any if any `digits' consumed; make it negative to indicate
+	 * overflow.
+	 */
+	qbase = (unsigned int)base;
+	cutoff = neg
+		     ? (unsigned long)LONG_MAX
+			   - (unsigned long)(LONG_MIN + LONG_MAX)
+		     : LONG_MAX;
+	cutlim = cutoff % qbase;
+	cutoff /= qbase;
+	for (acc = 0, any = 0;; c = *s++) {
+		if (!isascii(c))
+			break;
+		if (isdigit(c))
+			c -= '0';
+		else if (isalpha(c))
+			c -= isupper(c) ? 'A' - 10 : 'a' - 10;
+		else
+			break;
+		if (c >= base)
+			break;
+		if (any < 0 || acc > cutoff || (acc == cutoff && c > cutlim))
+			any = -1;
+		else {
+			any = 1;
+			acc *= qbase;
+			acc += c;
+		}
+	}
+	if (any < 0) {
+		acc = neg ? LONG_MIN : LONG_MAX;
+		errno = ERANGE;
+	} else if (neg)
+		acc = -acc;
+
+exit:
+	if (endptr != 0)
+		*endptr = __DECONST(char *, any ? s - 1 : nptr);
+	return acc;
+}
+
+/*
+ * Convert a string to a long long integer.
+ *
+ * Ignores `locale' stuff.  Assumes that the upper and lower case
+ * alphabets and digits are each contiguous.
+ */
+long long strtoll_isr(const char *nptr, char **endptr, int base)
+{
+	const char *s;
+	unsigned long long acc;
+	unsigned char c;
+	unsigned long long qbase, cutoff;
+	int neg, any, cutlim;
+
+	s = nptr;
+	if (base < 0 || base == 1 || base > 36) {
+		errno = -EINVAL;
+		any = 0;
+		acc = 0;
+		goto exit;
+	}
+	/*
+	 * Skip white space and pick up leading +/- sign if any.
+	 * If base is 0, allow 0x for hex and 0 for octal, else
+	 * assume decimal; if base is already 16, allow 0x.
+	 */
+	do {
+		c = *s++;
+	} while (isspace(c));
+	if (c == '-') {
+		neg = 1;
+		c = *s++;
+	} else {
+		neg = 0;
+		if (c == '+')
+			c = *s++;
+	}
+	if ((base == 0 || base == 16) && c == '0' && (*s == 'x' || *s == 'X')) {
+		c = s[1];
+		s += 2;
+		base = 16;
+	}
+	if (base == 0)
+		base = c == '0' ? 8 : 10;
+
+	/*
+	 * Compute the cutoff value between legal numbers and illegal
+	 * numbers.  That is the largest legal value, divided by the
+	 * base.  An input number that is greater than this value, if
+	 * followed by a legal input character, is too big.  One that
+	 * is equal to this value may be valid or not; the limit
+	 * between valid and invalid numbers is then based on the last
+	 * digit.  For instance, if the range for quads is
+	 * [-9223372036854775808..9223372036854775807] and the input base
+	 * is 10, cutoff will be set to 922337203685477580 and cutlim to
+	 * either 7 (neg==0) or 8 (neg==1), meaning that if we have
+	 * accumulated a value > 922337203685477580, or equal but the
+	 * next digit is > 7 (or 8), the number is too big, and we will
+	 * return a range error.
+	 *
+	 * Set any if any `digits' consumed; make it negative to indicate
+	 * overflow.
+	 */
+	qbase = (unsigned int)base;
+	cutoff = neg
+		     ? (unsigned long long)LLONG_MAX
+			   - (unsigned long long)(LLONG_MIN + LLONG_MAX)
+		     : LLONG_MAX;
+	cutlim = cutoff % qbase;
+	cutoff /= qbase;
+	for (acc = 0, any = 0;; c = *s++) {
+		if (!isascii(c))
+			break;
+		if (isdigit(c))
+			c -= '0';
+		else if (isalpha(c))
+			c -= isupper(c) ? 'A' - 10 : 'a' - 10;
+		else
+			break;
+		if (c >= base)
+			break;
+		if (any < 0 || acc > cutoff || (acc == cutoff && c > cutlim))
+			any = -1;
+		else {
+			any = 1;
+			acc *= qbase;
+			acc += c;
+		}
+	}
+	if (any < 0) {
+		errno = ERANGE;
+		acc = neg ? LLONG_MIN : LLONG_MAX;
+	} else if (neg)
+		acc = -acc;
+
+exit:
+	if (endptr != 0)
+		*endptr = __DECONST(char *, any ? s - 1 : nptr);
+	return acc;
+}
+
+/*
+ * Convert a string to an unsigned long long integer.
+ *
+ * Ignores `locale' stuff.  Assumes that the upper and lower case
+ * alphabets and digits are each contiguous.
+ */
+unsigned long long strtoull_isr(const char *nptr, char **endptr, int base)
+{
+	const char *s = nptr;
+	unsigned long long acc;
+	unsigned char c;
+	unsigned long long qbase, cutoff;
+	int neg, any, cutlim;
+
+	if (base < 0 || base == 1 || base > 36) {
+		errno = -EINVAL;
+		any = 0;
+		acc = 0;
+		goto exit;
+	}
+	/*
+	 * See strtoq for comments as to the logic used.
+	 */
+	do {
+		c = *s++;
+	} while (isspace(c));
+	if (c == '-') {
+		neg = 1;
+		c = *s++;
+	} else {
+		neg = 0;
+		if (c == '+')
+			c = *s++;
+	}
+	if ((base == 0 || base == 16) && c == '0' && (*s == 'x' || *s == 'X')) {
+		c = s[1];
+		s += 2;
+		base = 16;
+	}
+	if (base == 0)
+		base = c == '0' ? 8 : 10;
+	qbase = (unsigned int)base;
+	cutoff = (unsigned long long)ULLONG_MAX / qbase;
+	cutlim = (unsigned long long)ULLONG_MAX % qbase;
+	for (acc = 0, any = 0;; c = *s++) {
+		if (!isascii(c))
+			break;
+		if (isdigit(c))
+			c -= '0';
+		else if (isalpha(c))
+			c -= isupper(c) ? 'A' - 10 : 'a' - 10;
+		else
+			break;
+		if (c >= base)
+			break;
+		if (any < 0 || acc > cutoff || (acc == cutoff && c > cutlim))
+			any = -1;
+		else {
+			any = 1;
+			acc *= qbase;
+			acc += c;
+		}
+	}
+	if (any < 0) {
+		errno = ERANGE;
+		acc = ULLONG_MAX;
+	} else if (neg)
+		acc = -acc;
+
+exit:
+	if (endptr != 0)
+		*endptr = __DECONST(char *, any ? s - 1 : nptr);
+	return acc;
+}
+
+int atoi_isr(const char *s)
+{
+	long long atoll;
+
+	atoll = strtoll_isr(s, NULL, 10);
+	atoll = (atoll > __I_MAX) ? __I_MAX : atoll;
+	atoll = (atoll < __I_MIN) ? __I_MIN : atoll;
+
+	return (int) atoll;
+}
-- 
2.25.1



From minios-devel-bounces@lists.xenproject.org Wed Aug 26 10:40:26 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Wed, 26 Aug 2020 10:40:26 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1kAsqr-0001Gv-Uq; Wed, 26 Aug 2020 10:40:21 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=KeZZ=CE=gmail.com=cristianvijelie@srs-us1.protection.inumbo.net>)
 id 1kAsqq-0001Gq-OR
 for minios-devel@lists.xen.org; Wed, 26 Aug 2020 10:40:20 +0000
X-Inumbo-ID: 43e0404b-d2a7-42fa-8600-7f67c0bc39e3
Received: from mail-ed1-x542.google.com (unknown [2a00:1450:4864:20::542])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 43e0404b-d2a7-42fa-8600-7f67c0bc39e3;
 Wed, 26 Aug 2020 10:40:19 +0000 (UTC)
Received: by mail-ed1-x542.google.com with SMTP id q4so1318031eds.3
 for <minios-devel@lists.xen.org>; Wed, 26 Aug 2020 03:40:19 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=from:to:subject:date:message-id:mime-version
 :content-transfer-encoding;
 bh=x2AZR5pCGGsWQC6tLsToJY60d5Vk2khS/jAbumTa/gc=;
 b=U/GEl6SX5gh4malcLwQ2bfH4kd5o4sSuLh2SRrueI6LawopTMDkQvn9k8kb1mh5uEM
 eAcYcj6bwKpN322ahj6uWGIXffvQlTMEGJ4RtwdyRl224F8Arm+mgUMrBW1aYI/PYom9
 T5KWXCH3pYTqNh6idgetDiMrRzPRw2I/U7qlQrHbiDNvCEICKA3xvSasLu0P08O/+LAh
 4oDzSXkZOeFLNDWOteZr2JU5CieXNS/+L0+FwRV/SUeRpCMuAT1hMEdqtdUcHdU58uw8
 vMmo9eChGg2uutpcny8smLo5klXyMeiAqpIEW8f1QReYzVcAn1c4W03nDPThZkfwcsCA
 SZgQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:to:subject:date:message-id:mime-version
 :content-transfer-encoding;
 bh=x2AZR5pCGGsWQC6tLsToJY60d5Vk2khS/jAbumTa/gc=;
 b=sdEdJUhzLDSFHD2urMg0WGKirf6dgijN6Xt4bghPC/cf2ZFS8CTQya+7F+fhpwRug5
 /Zzal4oLNaBazPdx76c7Sqy4XJYAy4XoDqkFua5QV5BqGZrx5Vb1EiEjCnhuSx/KsGHp
 0IwqZHLE87/Dy9f2MmMA0X5pGFtiNfMNYoMTpOl0ywmo6jhuu7avIGshOEZPte53+t6v
 Sm7BvPft5rZcnC+SCtRwUHqqTgfRzV2Ul4dBSWS+0fZh7pIlCTvcH0QDj2Pi+QuX+Cby
 vecgt8NRc9tS+rA98QPO7Mfp8R/QRz0vigybGkKquwuw9IifDfZHz21lSTOpgqGu2lwj
 XQ4w==
X-Gm-Message-State: AOAM530mvXgvxao62Nm9GcO3foIFjz9kcgMhBTvanA5jHBPZu31vSFI1
 afh3VXEE+f4fuGg25WlmeXh9uWVUBVI=
X-Google-Smtp-Source: ABdhPJzJinYcbRzZ2yLOvHddjX5FBohZXf+lMZeaDDyXHUA+8Ls0km5wt5loopZfC1NBx9DLD58cew==
X-Received: by 2002:a05:6402:456:: with SMTP id
 p22mr14078488edw.177.1598438417954; 
 Wed, 26 Aug 2020 03:40:17 -0700 (PDT)
Received: from localhost.localdomain ([2a00:5dc0:ffff:0:4174:3bd1:9f32:f968])
 by smtp.gmail.com with ESMTPSA id
 j9sm1869167ejx.64.2020.08.26.03.40.16
 for <minios-devel@lists.xen.org>
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Wed, 26 Aug 2020 03:40:17 -0700 (PDT)
From: cristianvijelie@gmail.com
To: minios-devel@lists.xen.org
Subject: [[UNIKRAFT PATCH] v4] Made _ukplat_irq_handle interrupt-context-safe
Date: Wed, 26 Aug 2020 13:40:15 +0300
Message-Id: <20200826104015.26240-1-cristianvijelie@gmail.com>
X-Mailer: git-send-email 2.25.1
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-BeenThere: minios-devel@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Mini-os development list <minios-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:minios-devel@lists.xenproject.org>
List-Help: <mailto:minios-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: minios-devel-bounces@lists.xenproject.org
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>

From: Cristian Vijelie <cristianvijelie@gmail.com>

I moved the intrrupt request handler for the KVM platform into a separate 
source file, isr.c, that is built using the 'isr' flag. Also, I have moved 
the definitions needed by both irq.c and isr.c into an internal header, 
'internal/irq.h'

Signed-off-by: Cristian Vijelie <cristianvijelie@gmail.com>
---
 plat/kvm/Makefile.uk    |  1 +
 plat/kvm/internal/irq.h | 13 ++++++++
 plat/kvm/irq.c          | 51 +---------------------------
 plat/kvm/isr.c          | 73 +++++++++++++++++++++++++++++++++++++++++
 4 files changed, 88 insertions(+), 50 deletions(-)
 create mode 100644 plat/kvm/internal/irq.h
 create mode 100644 plat/kvm/isr.c

diff --git a/plat/kvm/Makefile.uk b/plat/kvm/Makefile.uk
index 94321e0..ec079dd 100644
--- a/plat/kvm/Makefile.uk
+++ b/plat/kvm/Makefile.uk
@@ -100,6 +100,7 @@ LIBKVMPLAT_SRCS-$(CONFIG_ARCH_ARM_64) += $(LIBKVMPLAT_BASE)/arm/intctrl.c
 LIBKVMPLAT_SRCS-y              += $(LIBKVMPLAT_BASE)/shutdown.c
 LIBKVMPLAT_SRCS-y              += $(LIBKVMPLAT_BASE)/memory.c
 LIBKVMPLAT_SRCS-y              += $(LIBKVMPLAT_BASE)/irq.c
+LIBKVMPLAT_SRCS-y              += $(LIBKVMPLAT_BASE)/isr.c|isr
 LIBKVMPLAT_SRCS-y              += $(LIBKVMPLAT_BASE)/io.c
 LIBKVMPLAT_SRCS-y              += $(UK_PLAT_COMMON_BASE)/lcpu.c|common
 LIBKVMPLAT_SRCS-y              += $(UK_PLAT_COMMON_BASE)/memory.c|common
diff --git a/plat/kvm/internal/irq.h b/plat/kvm/internal/irq.h
new file mode 100644
index 0000000..2fd6b6d
--- /dev/null
+++ b/plat/kvm/internal/irq.h
@@ -0,0 +1,13 @@
+#include <uk/plat/irq.h>
+#include <uk/compat_list.h>
+#include <uk/plat/common/irq.h>
+
+struct irq_handler {
+	irq_handler_func_t func;
+	void *arg;
+
+	UK_SLIST_ENTRY(struct irq_handler) entries;
+};
+
+UK_SLIST_HEAD(irq_handler_head, struct irq_handler);
+static struct irq_handler_head irq_handlers[__MAX_IRQ];
\ No newline at end of file
diff --git a/plat/kvm/irq.c b/plat/kvm/irq.c
index 8f43aa6..87301a2 100644
--- a/plat/kvm/irq.c
+++ b/plat/kvm/irq.c
@@ -36,19 +36,10 @@
 #include <uk/assert.h>
 #include <errno.h>
 #include <uk/bitops.h>
+#include "internal/irq.h"
 
 static struct uk_alloc *allocator;
 
-struct irq_handler {
-	irq_handler_func_t func;
-	void *arg;
-
-	UK_SLIST_ENTRY(struct irq_handler) entries;
-};
-
-UK_SLIST_HEAD(irq_handler_head, struct irq_handler);
-static struct irq_handler_head irq_handlers[__MAX_IRQ];
-
 int ukplat_irq_register(unsigned long irq, irq_handler_func_t func, void *arg)
 {
 	struct irq_handler *h;
@@ -72,46 +63,6 @@ int ukplat_irq_register(unsigned long irq, irq_handler_func_t func, void *arg)
 	return 0;
 }
 
-/*
- * TODO: This is a temporary solution used to identify non TSC clock
- * interrupts in order to stop waiting for interrupts with deadline.
- */
-extern unsigned long sched_have_pending_events;
-
-void _ukplat_irq_handle(unsigned long irq)
-{
-	struct irq_handler *h;
-
-	UK_SLIST_FOREACH(h, &irq_handlers[irq], entries) {
-		/* TODO define platform wise macro for timer IRQ number */
-		if (irq != 0)
-			/* IRQ 0 is reserved for a timer, responsible to
-			 * wake up cpu from halt, so it can check if
-			 * it has something to do. Effectively it is OS ticks.
-			 *
-			 * If interrupt comes not from the timer, the
-			 * chances are some work have just
-			 * arrived. Let's kick the scheduler out of
-			 * the halting loop, and let it take care of
-			 * that work.
-			 */
-			__uk_test_and_set_bit(0, &sched_have_pending_events);
-
-		if (h->func(h->arg) == 1)
-			goto exit_ack;
-	}
-	/*
-	 * Acknowledge interrupts even in the case when there was no handler for
-	 * it. We do this to (1) compensate potential spurious interrupts of
-	 * devices, and (2) to minimize impact on drivers that share one
-	 * interrupt line that would then stay disabled.
-	 */
-	uk_pr_crit("Unhandled irq=%lu\n", irq);
-
-exit_ack:
-	intctrl_ack_irq(irq);
-}
-
 int ukplat_irq_init(struct uk_alloc *a)
 {
 	UK_ASSERT(allocator == NULL);
diff --git a/plat/kvm/isr.c b/plat/kvm/isr.c
new file mode 100644
index 0000000..f0ea3d3
--- /dev/null
+++ b/plat/kvm/isr.c
@@ -0,0 +1,73 @@
+/* SPDX-License-Identifier: ISC */
+/*
+ * Authors: Dan Williams
+ *          Martin Lucina
+ *          Ricardo Koller
+ *          Costin Lupu <costin.lupu@cs.pub.ro>
+ *
+ * Copyright (c) 2015-2017 IBM
+ * Copyright (c) 2016-2017 Docker, Inc.
+ * Copyright (c) 2018, NEC Europe Ltd., NEC Corporation
+ *
+ * Permission to use, copy, modify, and/or distribute this software
+ * for any purpose with or without fee is hereby granted, provided
+ * that the above copyright notice and this permission notice appear
+ * in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
+ * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
+ * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
+ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+/* Taken from solo5 intr.c */
+
+#include <kvm/irq.h>
+#include "internal/irq.h"
+#include <uk/bitops.h>
+#include <kvm/intctrl.h>
+#include <uk/assert.h>
+
+extern unsigned long sched_have_pending_events;
+
+/*
+ * TODO: This is a temporary solution used to identify non TSC clock
+ * interrupts in order to stop waiting for interrupts with deadline.
+ */
+
+void _ukplat_irq_handle(unsigned long irq)
+{
+	struct irq_handler *h;
+
+	UK_SLIST_FOREACH(h, &irq_handlers[irq], entries) {
+		/* TODO define platform wise macro for timer IRQ number */
+		if (irq != 0)
+			/* IRQ 0 is reserved for a timer, responsible to
+			 * wake up cpu from halt, so it can check if
+			 * it has something to do. Effectively it is OS ticks.
+			 *
+			 * If interrupt comes not from the timer, the
+			 * chances are some work have just
+			 * arrived. Let's kick the scheduler out of
+			 * the halting loop, and let it take care of
+			 * that work.
+			 */
+			__uk_test_and_set_bit(0, &sched_have_pending_events);
+
+		if (h->func(h->arg) == 1)
+			goto exit_ack;
+	}
+	/*
+	 * Acknowledge interrupts even in the case when there was no handler for
+	 * it. We do this to (1) compensate potential spurious interrupts of
+	 * devices, and (2) to minimize impact on drivers that share one
+	 * interrupt line that would then stay disabled.
+	 */
+	uk_pr_crit("Unhandled irq=%lu\n", irq);
+
+exit_ack:
+	intctrl_ack_irq(irq);
+}
\ No newline at end of file
-- 
2.25.1



From minios-devel-bounces@lists.xenproject.org Thu Aug 27 06:35:45 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Thu, 27 Aug 2020 06:35:45 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1kBBVe-0008Tb-OH; Thu, 27 Aug 2020 06:35:42 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=2a6o=CF=gmail.com=cristianvijelie@srs-us1.protection.inumbo.net>)
 id 1kBBVd-0008TV-Hm
 for minios-devel@lists.xen.org; Thu, 27 Aug 2020 06:35:41 +0000
X-Inumbo-ID: 7c4946a6-86eb-4dcb-a677-09f1fb4352fe
Received: from mail-ej1-x643.google.com (unknown [2a00:1450:4864:20::643])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 7c4946a6-86eb-4dcb-a677-09f1fb4352fe;
 Thu, 27 Aug 2020 06:35:40 +0000 (UTC)
Received: by mail-ej1-x643.google.com with SMTP id d11so6065964ejt.13
 for <minios-devel@lists.xen.org>; Wed, 26 Aug 2020 23:35:40 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=from:to:subject:date:message-id:mime-version
 :content-transfer-encoding;
 bh=x2AZR5pCGGsWQC6tLsToJY60d5Vk2khS/jAbumTa/gc=;
 b=ngrqmauwavJFxk254rL35M+RnxgjaTpq8fVxdPYd/JJzVW+dSlWEk7Mmk+Vhb3q2GT
 SwWcVKKSe7Ljfp8KJG2aWDa6Kc0T9/WbcifS6ZQnqDa3/AC8wQab3UZX1OBV1rM6mBdx
 z03PBTkxB9cgf+JBfUXBlkIUKSXuhQSAspG4yDBx+4ALzZCKySFkiBafYqoVWBHeg8Qt
 oKPe29l44kyuuUKIJVaApiHC83c2fcYvS2G0d1y+lSiO9YV4PjozrtJtxdp5aWeyESTq
 hpD/TM7y1ic6tvhzAUr5ZSir2rBO/Hhg+Zzg1AWY9Ni9GGjZlNaXVmE9Nyoo/GpN6x6R
 kVPA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:to:subject:date:message-id:mime-version
 :content-transfer-encoding;
 bh=x2AZR5pCGGsWQC6tLsToJY60d5Vk2khS/jAbumTa/gc=;
 b=sxMfKTQwLhFd9xrlIJk4lSbzk8xFfblxlh7k7MA2lHKDKjX2oBvhiztWp+UPk/SqV6
 EtgkUr77Zp78fDv4ZCjmNfemTFaXc6VWn5bnFSE+DI3P8kyXbBlJgGY9PG3Le4QA+308
 I7ySxhVSDiAQhSah9xAnHaDuZRsImUInkmuFBB40Vg8robfr9/GBG7RcN383x5hCBDj+
 YKW1MwgTQTWjqqUVF7wk0Tm38zLSHjmGEnzo2wwacx+DmCbLNvyReZmnGSlK2Qx8MYAF
 68pwsVmlCj9ufnmrIFd/soUa3zhxLebIFTdiPir9btmMKUgaeJcfH9AQk8mrrsP2sApf
 PT8Q==
X-Gm-Message-State: AOAM533hJ9xzX3pU7lLr6Sm0vSO6qWZkZSh0u3mv/QcYuGz/CMueadD5
 zzGwC1GZK3KdGZt967FQ+Pr6fhZyFVU=
X-Google-Smtp-Source: ABdhPJwYj5502GCgDu894h014kwDyVl1iLMhODAJqdzHa7PtRzH131bXc1MAm0FFYe4rXyomqCQt0g==
X-Received: by 2002:a17:906:abc6:: with SMTP id
 kq6mr19093899ejb.216.1598510139042; 
 Wed, 26 Aug 2020 23:35:39 -0700 (PDT)
Received: from localhost.localdomain ([2a00:5dc0:ffff:0:7083:372e:49:a275])
 by smtp.gmail.com with ESMTPSA id md20sm1095420ejb.16.2020.08.26.23.35.38
 for <minios-devel@lists.xen.org>
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Wed, 26 Aug 2020 23:35:38 -0700 (PDT)
From: cristianvijelie@gmail.com
To: minios-devel@lists.xen.org
Subject: [[UNIKRAFT PATCH] v4] plat/kvm: Made _ukplat_irq_handle
 interrupt-context-safe
Date: Thu, 27 Aug 2020 09:35:37 +0300
Message-Id: <20200827063537.4053-1-cristianvijelie@gmail.com>
X-Mailer: git-send-email 2.25.1
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-BeenThere: minios-devel@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Mini-os development list <minios-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:minios-devel@lists.xenproject.org>
List-Help: <mailto:minios-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: minios-devel-bounces@lists.xenproject.org
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>

From: Cristian Vijelie <cristianvijelie@gmail.com>

I moved the intrrupt request handler for the KVM platform into a separate 
source file, isr.c, that is built using the 'isr' flag. Also, I have moved 
the definitions needed by both irq.c and isr.c into an internal header, 
'internal/irq.h'

Signed-off-by: Cristian Vijelie <cristianvijelie@gmail.com>
---
 plat/kvm/Makefile.uk    |  1 +
 plat/kvm/internal/irq.h | 13 ++++++++
 plat/kvm/irq.c          | 51 +---------------------------
 plat/kvm/isr.c          | 73 +++++++++++++++++++++++++++++++++++++++++
 4 files changed, 88 insertions(+), 50 deletions(-)
 create mode 100644 plat/kvm/internal/irq.h
 create mode 100644 plat/kvm/isr.c

diff --git a/plat/kvm/Makefile.uk b/plat/kvm/Makefile.uk
index 94321e0..ec079dd 100644
--- a/plat/kvm/Makefile.uk
+++ b/plat/kvm/Makefile.uk
@@ -100,6 +100,7 @@ LIBKVMPLAT_SRCS-$(CONFIG_ARCH_ARM_64) += $(LIBKVMPLAT_BASE)/arm/intctrl.c
 LIBKVMPLAT_SRCS-y              += $(LIBKVMPLAT_BASE)/shutdown.c
 LIBKVMPLAT_SRCS-y              += $(LIBKVMPLAT_BASE)/memory.c
 LIBKVMPLAT_SRCS-y              += $(LIBKVMPLAT_BASE)/irq.c
+LIBKVMPLAT_SRCS-y              += $(LIBKVMPLAT_BASE)/isr.c|isr
 LIBKVMPLAT_SRCS-y              += $(LIBKVMPLAT_BASE)/io.c
 LIBKVMPLAT_SRCS-y              += $(UK_PLAT_COMMON_BASE)/lcpu.c|common
 LIBKVMPLAT_SRCS-y              += $(UK_PLAT_COMMON_BASE)/memory.c|common
diff --git a/plat/kvm/internal/irq.h b/plat/kvm/internal/irq.h
new file mode 100644
index 0000000..2fd6b6d
--- /dev/null
+++ b/plat/kvm/internal/irq.h
@@ -0,0 +1,13 @@
+#include <uk/plat/irq.h>
+#include <uk/compat_list.h>
+#include <uk/plat/common/irq.h>
+
+struct irq_handler {
+	irq_handler_func_t func;
+	void *arg;
+
+	UK_SLIST_ENTRY(struct irq_handler) entries;
+};
+
+UK_SLIST_HEAD(irq_handler_head, struct irq_handler);
+static struct irq_handler_head irq_handlers[__MAX_IRQ];
\ No newline at end of file
diff --git a/plat/kvm/irq.c b/plat/kvm/irq.c
index 8f43aa6..87301a2 100644
--- a/plat/kvm/irq.c
+++ b/plat/kvm/irq.c
@@ -36,19 +36,10 @@
 #include <uk/assert.h>
 #include <errno.h>
 #include <uk/bitops.h>
+#include "internal/irq.h"
 
 static struct uk_alloc *allocator;
 
-struct irq_handler {
-	irq_handler_func_t func;
-	void *arg;
-
-	UK_SLIST_ENTRY(struct irq_handler) entries;
-};
-
-UK_SLIST_HEAD(irq_handler_head, struct irq_handler);
-static struct irq_handler_head irq_handlers[__MAX_IRQ];
-
 int ukplat_irq_register(unsigned long irq, irq_handler_func_t func, void *arg)
 {
 	struct irq_handler *h;
@@ -72,46 +63,6 @@ int ukplat_irq_register(unsigned long irq, irq_handler_func_t func, void *arg)
 	return 0;
 }
 
-/*
- * TODO: This is a temporary solution used to identify non TSC clock
- * interrupts in order to stop waiting for interrupts with deadline.
- */
-extern unsigned long sched_have_pending_events;
-
-void _ukplat_irq_handle(unsigned long irq)
-{
-	struct irq_handler *h;
-
-	UK_SLIST_FOREACH(h, &irq_handlers[irq], entries) {
-		/* TODO define platform wise macro for timer IRQ number */
-		if (irq != 0)
-			/* IRQ 0 is reserved for a timer, responsible to
-			 * wake up cpu from halt, so it can check if
-			 * it has something to do. Effectively it is OS ticks.
-			 *
-			 * If interrupt comes not from the timer, the
-			 * chances are some work have just
-			 * arrived. Let's kick the scheduler out of
-			 * the halting loop, and let it take care of
-			 * that work.
-			 */
-			__uk_test_and_set_bit(0, &sched_have_pending_events);
-
-		if (h->func(h->arg) == 1)
-			goto exit_ack;
-	}
-	/*
-	 * Acknowledge interrupts even in the case when there was no handler for
-	 * it. We do this to (1) compensate potential spurious interrupts of
-	 * devices, and (2) to minimize impact on drivers that share one
-	 * interrupt line that would then stay disabled.
-	 */
-	uk_pr_crit("Unhandled irq=%lu\n", irq);
-
-exit_ack:
-	intctrl_ack_irq(irq);
-}
-
 int ukplat_irq_init(struct uk_alloc *a)
 {
 	UK_ASSERT(allocator == NULL);
diff --git a/plat/kvm/isr.c b/plat/kvm/isr.c
new file mode 100644
index 0000000..f0ea3d3
--- /dev/null
+++ b/plat/kvm/isr.c
@@ -0,0 +1,73 @@
+/* SPDX-License-Identifier: ISC */
+/*
+ * Authors: Dan Williams
+ *          Martin Lucina
+ *          Ricardo Koller
+ *          Costin Lupu <costin.lupu@cs.pub.ro>
+ *
+ * Copyright (c) 2015-2017 IBM
+ * Copyright (c) 2016-2017 Docker, Inc.
+ * Copyright (c) 2018, NEC Europe Ltd., NEC Corporation
+ *
+ * Permission to use, copy, modify, and/or distribute this software
+ * for any purpose with or without fee is hereby granted, provided
+ * that the above copyright notice and this permission notice appear
+ * in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
+ * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
+ * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
+ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+/* Taken from solo5 intr.c */
+
+#include <kvm/irq.h>
+#include "internal/irq.h"
+#include <uk/bitops.h>
+#include <kvm/intctrl.h>
+#include <uk/assert.h>
+
+extern unsigned long sched_have_pending_events;
+
+/*
+ * TODO: This is a temporary solution used to identify non TSC clock
+ * interrupts in order to stop waiting for interrupts with deadline.
+ */
+
+void _ukplat_irq_handle(unsigned long irq)
+{
+	struct irq_handler *h;
+
+	UK_SLIST_FOREACH(h, &irq_handlers[irq], entries) {
+		/* TODO define platform wise macro for timer IRQ number */
+		if (irq != 0)
+			/* IRQ 0 is reserved for a timer, responsible to
+			 * wake up cpu from halt, so it can check if
+			 * it has something to do. Effectively it is OS ticks.
+			 *
+			 * If interrupt comes not from the timer, the
+			 * chances are some work have just
+			 * arrived. Let's kick the scheduler out of
+			 * the halting loop, and let it take care of
+			 * that work.
+			 */
+			__uk_test_and_set_bit(0, &sched_have_pending_events);
+
+		if (h->func(h->arg) == 1)
+			goto exit_ack;
+	}
+	/*
+	 * Acknowledge interrupts even in the case when there was no handler for
+	 * it. We do this to (1) compensate potential spurious interrupts of
+	 * devices, and (2) to minimize impact on drivers that share one
+	 * interrupt line that would then stay disabled.
+	 */
+	uk_pr_crit("Unhandled irq=%lu\n", irq);
+
+exit_ack:
+	intctrl_ack_irq(irq);
+}
\ No newline at end of file
-- 
2.25.1



From minios-devel-bounces@lists.xenproject.org Thu Aug 27 07:45:18 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Thu, 27 Aug 2020 07:45:18 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1kBCax-00064F-KD; Thu, 27 Aug 2020 07:45:15 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=2a6o=CF=gmail.com=cristianvijelie@srs-us1.protection.inumbo.net>)
 id 1kBCav-00064A-LY
 for minios-devel@lists.xen.org; Thu, 27 Aug 2020 07:45:13 +0000
X-Inumbo-ID: 4527359a-2f63-4678-aa41-40bc86da8200
Received: from mail-ed1-x542.google.com (unknown [2a00:1450:4864:20::542])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 4527359a-2f63-4678-aa41-40bc86da8200;
 Thu, 27 Aug 2020 07:45:11 +0000 (UTC)
Received: by mail-ed1-x542.google.com with SMTP id v8so4040419edl.7
 for <minios-devel@lists.xen.org>; Thu, 27 Aug 2020 00:45:11 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=from:to:subject:date:message-id:mime-version
 :content-transfer-encoding;
 bh=7Ln4neXfc6Bf/1zQaWRGV5rCWmZT4bsED89tU7fQVpM=;
 b=kdkXBMUIEEmM1day0JfPxSYYTnAeWmmNxRSJl55jerW/m0WglImw1IsMB5QMRaWVlr
 ArFIto9benBPeB3yZbrCB/6cf0Bl4o6FPBcH1mAiPN6sQzdFe+5tUwZcw4zZ9c3w5myE
 UMVq5RboWxrTKCzMaEHVuu8vn+ZFQuuRWy8wZgYWN6KT/9FsrOsfFnXASlqM+IcMFKkq
 DNCXqKG30EAfOMN8aPenZbkGMU9XWtYu3l4AJaWGgrb2Noy88/iYqDE6hX21IhFMw7l8
 FmQETv73vSIYO9yV1eGWlXljlYrvuia/wyLP1y91hePAeejiSX0ti0+1LaKVWkEYHKcF
 GmXQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:to:subject:date:message-id:mime-version
 :content-transfer-encoding;
 bh=7Ln4neXfc6Bf/1zQaWRGV5rCWmZT4bsED89tU7fQVpM=;
 b=GKU6lrl4MML7REn+zxYYgCzh2hUvkoZrXLfMJgp7NaZYQNzRG4/VmdIbTNoDo6k4V5
 n5posUg8YwyDWD2RCIR4r4pqXNcRFJZeytO9uojCh5Ttio+ThRye7AWNe761/Q/K8UlX
 ZuLOl0ZdxQC0mVb2kPpNt6K9bbe2ttDFRO5p0zpXpu8DHPtvlSaAVhGIIvjiB9s6JL69
 3my2jl8rvxCDuGWascbX7R7S9zkTQnxP/bmfCDU6u/zcmDXyVIqn1Kn+rz8+hhTHodZG
 MWJnx6HMZVtK2ou+oShidJhKrNJ2vn4dNbOILvO3dToFoDVG/2gFVJk3VdqNgTzdAR/D
 9kWg==
X-Gm-Message-State: AOAM532lavdyadNhBkz5ixDsfef5hmjXM3mmDf5Nbopb/6NDTyHtst7n
 80nBgqMG882Dadn/mZd9rUbWofxu1ffujA==
X-Google-Smtp-Source: ABdhPJzOnHh/tn/vbuzvvGIXrc/ryXoLOY0oE8kUtDkQ6F1vRv7zBHQMbe+htlL9IQ3xVDz28a6DUQ==
X-Received: by 2002:aa7:d68b:: with SMTP id d11mr15415842edr.143.1598514310430; 
 Thu, 27 Aug 2020 00:45:10 -0700 (PDT)
Received: from localhost.localdomain ([2a00:5dc0:ffff:0:7083:372e:49:a275])
 by smtp.gmail.com with ESMTPSA id t22sm1227719ejf.24.2020.08.27.00.45.09
 for <minios-devel@lists.xen.org>
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Thu, 27 Aug 2020 00:45:09 -0700 (PDT)
From: cristianvijelie@gmail.com
To: minios-devel@lists.xen.org
Subject: [[UNIKRAFT PATCH] v4] plat/drivers/virtio: Made virtio irq handler
 interrupt-context-safe
Date: Thu, 27 Aug 2020 10:45:08 +0300
Message-Id: <20200827074508.15839-1-cristianvijelie@gmail.com>
X-Mailer: git-send-email 2.25.1
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-BeenThere: minios-devel@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Mini-os development list <minios-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:minios-devel@lists.xenproject.org>
List-Help: <mailto:minios-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: minios-devel-bounces@lists.xenproject.org
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>

From: Cristian Vijelie <cristianvijelie@gmail.com>

Added a new sourcefile, virtio-isr.c, where I placed the interrupt handler
'virtqueue_ring_interrupt', and made it to be build with the isr flag.


Signed-off-by: Cristian Vijelie <cristianvijelie@gmail.com>
---
 plat/drivers/virtio/internal/internal.h | 63 ++++++++++++++++++++++++
 plat/drivers/virtio/virtio_isr.c        | 64 +++++++++++++++++++++++++
 plat/drivers/virtio/virtio_ring.c       | 61 ++++++++---------------
 plat/kvm/Makefile.uk                    |  2 +
 4 files changed, 148 insertions(+), 42 deletions(-)
 create mode 100644 plat/drivers/virtio/internal/internal.h
 create mode 100644 plat/drivers/virtio/virtio_isr.c

diff --git a/plat/drivers/virtio/internal/internal.h b/plat/drivers/virtio/internal/internal.h
new file mode 100644
index 0000000..7f71653
--- /dev/null
+++ b/plat/drivers/virtio/internal/internal.h
@@ -0,0 +1,63 @@
+/* SPDX-License-Identifier: BSD-3-Clause */
+/*
+ * Authors: Sharan Santhanam <sharan.santhanam@neclab.eu>
+ *
+ * Copyright (c) 2018, NEC Europe Ltd., NEC Corporation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the copyright holder nor the names of its
+ *    contributors may be used to endorse or promote products derived from
+ *    this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ * THIS HEADER MAY NOT BE EXTRACTED OR MODIFIED IN ANY WAY.
+ */
+/**
+ * Inspired from the FreeBSD.
+ * Commit-id: a89e7a10d501
+ */
+
+#include <virtio/virtqueue.h>
+
+struct virtqueue_desc_info {
+	void *cookie;
+	__u16 desc_count;
+};
+
+struct virtqueue_vring {
+	struct virtqueue vq;
+	/* Descriptor Ring */
+	struct vring vring;
+	/* Reference to the vring */
+	void   *vring_mem;
+	/* Keep track of available descriptors */
+	__u16 desc_avail;
+	/* Index of the next available slot */
+	__u16 head_free_desc;
+	/* Index of the last used descriptor by the host */
+	__u16 last_used_desc_idx;
+	/* Cookie to identify driver buffer */
+	struct virtqueue_desc_info vq_info[];
+};
+
+#define to_virtqueue_vring(vq)			\
+	__containerof(vq, struct virtqueue_vring, vq)
diff --git a/plat/drivers/virtio/virtio_isr.c b/plat/drivers/virtio/virtio_isr.c
new file mode 100644
index 0000000..d338be0
--- /dev/null
+++ b/plat/drivers/virtio/virtio_isr.c
@@ -0,0 +1,64 @@
+/* SPDX-License-Identifier: BSD-3-Clause */
+/*
+ * Authors: Sharan Santhanam <sharan.santhanam@neclab.eu>
+ *
+ * Copyright (c) 2018, NEC Europe Ltd., NEC Corporation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the copyright holder nor the names of its
+ *    contributors may be used to endorse or promote products derived from
+ *    this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ * THIS HEADER MAY NOT BE EXTRACTED OR MODIFIED IN ANY WAY.
+ */
+/**
+ * Inspired from the FreeBSD.
+ * Commit-id: a89e7a10d501
+ */
+
+#include "internal/internal.h"
+
+int virtqueue_hasdata(struct virtqueue *vq)
+{
+	struct virtqueue_vring *vring;
+
+	UK_ASSERT(vq);
+
+	vring = to_virtqueue_vring(vq);
+	return (vring->last_used_desc_idx != vring->vring.used->idx);
+}
+
+int virtqueue_ring_interrupt(void *obj)
+{
+	struct virtqueue *vq = (struct virtqueue *)obj;
+	int rc = 0;
+
+	UK_ASSERT(vq);
+
+	if (!virtqueue_hasdata(vq))
+		return rc;
+
+	if (likely(vq->vq_callback))
+		rc = vq->vq_callback(vq, vq->priv);
+	return rc;
+}
diff --git a/plat/drivers/virtio/virtio_ring.c b/plat/drivers/virtio/virtio_ring.c
index 0a5c3f3..5a05bef 100644
--- a/plat/drivers/virtio/virtio_ring.c
+++ b/plat/drivers/virtio/virtio_ring.c
@@ -44,32 +44,9 @@
 #include <uk/arch/atomic.h>
 #include <uk/plat/io.h>
 #include <virtio/virtio_ring.h>
-#include <virtio/virtqueue.h>
+#include "internal/internal.h"
 
 #define VIRTQUEUE_MAX_SIZE  32768
-#define to_virtqueue_vring(vq)			\
-	__containerof(vq, struct virtqueue_vring, vq)
-
-struct virtqueue_desc_info {
-	void *cookie;
-	__u16 desc_count;
-};
-
-struct virtqueue_vring {
-	struct virtqueue vq;
-	/* Descriptor Ring */
-	struct vring vring;
-	/* Reference to the vring */
-	void   *vring_mem;
-	/* Keep track of available descriptors */
-	__u16 desc_avail;
-	/* Index of the next available slot */
-	__u16 head_free_desc;
-	/* Index of the last used descriptor by the host */
-	__u16 last_used_desc_idx;
-	/* Cookie to identify driver buffer */
-	struct virtqueue_desc_info vq_info[];
-};
 
 /**
  * Static function Declaration(s).
@@ -215,15 +192,15 @@ static inline int virtqueue_buffer_enqueue_segments(
 	return idx;
 }
 
-int virtqueue_hasdata(struct virtqueue *vq)
-{
-	struct virtqueue_vring *vring;
+// int virtqueue_hasdata(struct virtqueue *vq)
+// {
+// 	struct virtqueue_vring *vring;
 
-	UK_ASSERT(vq);
+// 	UK_ASSERT(vq);
 
-	vring = to_virtqueue_vring(vq);
-	return (vring->last_used_desc_idx != vring->vring.used->idx);
-}
+ 	// vring = to_virtqueue_vring(vq);
+// 	return (vring->last_used_desc_idx != vring->vring.used->idx);
+// }
 
 __u64 virtqueue_feature_negotiate(__u64 feature_set)
 {
@@ -237,20 +214,20 @@ __u64 virtqueue_feature_negotiate(__u64 feature_set)
 	return feature;
 }
 
-int virtqueue_ring_interrupt(void *obj)
-{
-	struct virtqueue *vq = (struct virtqueue *)obj;
-	int rc = 0;
+// int virtqueue_ring_interrupt(void *obj)
+// {
+// 	struct virtqueue *vq = (struct virtqueue *)obj;
+// 	int rc = 0;
 
-	UK_ASSERT(vq);
+// 	UK_ASSERT(vq);
 
-	if (!virtqueue_hasdata(vq))
-		return rc;
+// 	if (!virtqueue_hasdata(vq))
+// 		return rc;
 
-	if (likely(vq->vq_callback))
-		rc = vq->vq_callback(vq, vq->priv);
-	return rc;
-}
+// 	if (likely(vq->vq_callback))
+// 		rc = vq->vq_callback(vq, vq->priv);
+// 	return rc;
+// }
 
 __phys_addr virtqueue_physaddr(struct virtqueue *vq)
 {
diff --git a/plat/kvm/Makefile.uk b/plat/kvm/Makefile.uk
index ec079dd..5a3a741 100644
--- a/plat/kvm/Makefile.uk
+++ b/plat/kvm/Makefile.uk
@@ -128,6 +128,8 @@ LIBKVMVIRTIO_SRCS-$(CONFIG_VIRTIO_BUS) +=\
 			$(UK_PLAT_DRIVERS_BASE)/virtio/virtio_bus.c
 LIBKVMVIRTIO_SRCS-$(CONFIG_VIRTIO_BUS) +=\
 			$(UK_PLAT_DRIVERS_BASE)/virtio/virtio_ring.c
+			LIBKVMVIRTIO_SRCS-$(CONFIG_VIRTIO_BUS) +=\
+			$(UK_PLAT_DRIVERS_BASE)/virtio/virtio_isr.c|isr
 LIBKVMVIRTIO_SRCS-$(CONFIG_VIRTIO_PCI) +=\
 			$(UK_PLAT_DRIVERS_BASE)/virtio/virtio_pci.c
 ##
-- 
2.25.1



From minios-devel-bounces@lists.xenproject.org Thu Aug 27 13:41:09 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Thu, 27 Aug 2020 13:41:09 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1kBI9F-00009r-Qf; Thu, 27 Aug 2020 13:41:01 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=cFEh=CF=gmail.com=wei.liu.xen@srs-us1.protection.inumbo.net>)
 id 1kBI9E-00009m-Fi
 for minios-devel@lists.xen.org; Thu, 27 Aug 2020 13:41:00 +0000
X-Inumbo-ID: 1319de13-772a-4cd1-a66a-f2f8cb4e3f8c
Received: from mail-wm1-f68.google.com (unknown [209.85.128.68])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 1319de13-772a-4cd1-a66a-f2f8cb4e3f8c;
 Thu, 27 Aug 2020 13:40:59 +0000 (UTC)
Received: by mail-wm1-f68.google.com with SMTP id y8so3767312wma.0
 for <minios-devel@lists.xen.org>; Thu, 27 Aug 2020 06:40:58 -0700 (PDT)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:date:from:to:subject:message-id:references
 :mime-version:content-disposition:content-transfer-encoding
 :in-reply-to:user-agent;
 bh=Fw7IOLSr7JeT4Hz4Xv/W3z6Dx52vFM/jjUrilM8dXK8=;
 b=jagtez47EHRiKSvG7xxLJ5IFCrqBwKOD0xn1glPkfpwM4n5FMLa4ON+7Bw+em1s2oC
 DV1MZOWBKPIZUxcgSMj3G9BLisSTyJaBsWhsfYxciqJfbLeGwXRPyO5rS6gVjjTcgZcF
 OR/IqfsNjG4WBAEe2F+IM+LmjkqEIiukpNwH6+Xo5eFJJ/xDv/zr71Lq+AjrAL0gtU0J
 HW2Uhcm5I69UHR1su8GjNjlIK6Xp9Shos9QOpYz+BvlVO6OeTqS6Wn+u5nqOcQFVB4Vw
 8o0G7Rg3qm30pcYppD+aULupfHF5XDhdvd0X7CQYh3Kb4Jw9zio+qziHsYMF29zpN+0u
 ZAKg==
X-Gm-Message-State: AOAM532iYdhYcdFDTO+E4MlrHav3YsGQAqMTfullDN0/S2QvqExdFEPX
 pUnIvX5N8jrGdj3P3H4XtIg=
X-Google-Smtp-Source: ABdhPJwYkjyVyaXTHwGh8s/zldyOhohqJIuzlXOYkIPfuD+91yZUq7dpdFauucWbyIhE+i/zIx2IVw==
X-Received: by 2002:a05:600c:296:: with SMTP id
 22mr6535808wmk.154.1598535657953; 
 Thu, 27 Aug 2020 06:40:57 -0700 (PDT)
Received: from liuwe-devbox-debian-v2 ([51.145.34.42])
 by smtp.gmail.com with ESMTPSA id t70sm37546870wmt.3.2020.08.27.06.40.56
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Thu, 27 Aug 2020 06:40:57 -0700 (PDT)
Date: Thu, 27 Aug 2020 13:40:55 +0000
From: Wei Liu <wl@xen.org>
To: Samuel Thibault <samuel.thibault@ens-lyon.org>,
 Costin Lupu <costin.lupu@cs.pub.ro>, minios-devel@lists.xen.org, wl@xen.org
Subject: Re: [PATCH v2] mini-os: netfront: Read netmask and gateway from
 Xenstore
Message-ID: <20200827134055.zshk6bkf4dv3frur@liuwe-devbox-debian-v2>
References: <20200819124900.21743-1-costin.lupu@cs.pub.ro>
 <20200819125204.rkedhauadk6d4qz4@function>
MIME-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
Content-Disposition: inline
Content-Transfer-Encoding: 8bit
In-Reply-To: <20200819125204.rkedhauadk6d4qz4@function>
User-Agent: NeoMutt/20180716
X-BeenThere: minios-devel@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Mini-os development list <minios-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:minios-devel@lists.xenproject.org>
List-Help: <mailto:minios-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: minios-devel-bounces@lists.xenproject.org
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>

On Wed, Aug 19, 2020 at 02:52:04PM +0200, Samuel Thibault wrote:
> Costin Lupu, le mer. 19 août 2020 15:49:00 +0300, a ecrit:
> > When providing the IP address via the config file, one can also add the
> > netmask and gateway address, e.g. "ip=192.168.0.2 255.255.255.0
> > 192.168.0.1", which will be further published to Xenstore. This patch adds
> > support for reading the netmask and gateway values.
> > 
> > Signed-off-by: Costin Lupu <costin.lupu@cs.pub.ro>
> 
> Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>

Applied.


From minios-devel-bounces@lists.xenproject.org Thu Aug 27 13:41:12 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Thu, 27 Aug 2020 13:41:12 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1kBI9Q-0000AR-SQ; Thu, 27 Aug 2020 13:41:12 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=cFEh=CF=gmail.com=wei.liu.xen@srs-us1.protection.inumbo.net>)
 id 1kBI9Q-0000AJ-70
 for minios-devel@lists.xen.org; Thu, 27 Aug 2020 13:41:12 +0000
X-Inumbo-ID: c5a7e9ca-e33d-489d-9cab-aafc3e2763d3
Received: from mail-wr1-f66.google.com (unknown [209.85.221.66])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id c5a7e9ca-e33d-489d-9cab-aafc3e2763d3;
 Thu, 27 Aug 2020 13:41:11 +0000 (UTC)
Received: by mail-wr1-f66.google.com with SMTP id o4so5441079wrn.0
 for <minios-devel@lists.xen.org>; Thu, 27 Aug 2020 06:41:11 -0700 (PDT)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:date:from:to:subject:message-id:references
 :mime-version:content-disposition:content-transfer-encoding
 :in-reply-to:user-agent;
 bh=+tZUS5w93e0g8XHZEHxjMJpBGc2BTbi8HNdc3qUNvoQ=;
 b=G+gy65k/yLpB5g6sI016iTtST2OBycpvjus8k++r7Q8/a11upS6EbffhrEA/rNekGR
 Uqr02vrOUh8m+pfboVGRVJN8xXr0ieVY3Pk8k3HVpepTqvZrcF/9DCjJsy76tMcD/8mr
 SLR/R51Vz73xhflWi+Jr7TD5xo7N5kESK9PvxSflgTrx1dVTIGWOjL2Xhc9BSUoSwnfi
 6bg1F5GF1/KMJRUnYdZzG8izGbYPWCKb0fCffX5zVkJ4FJC3Ud78alaDpxKcIBzaBCud
 PFu9EDVxA1a5jd1F3EdR8eCzBId2J63o9bseq23Oym643TZZbB0UXoL1hLxkdQy/6TwV
 e9gg==
X-Gm-Message-State: AOAM530NYJJOhPhbgb7ihTZFUKufhQazxP2r12QgK7yCppmiJa346mSh
 LtK2p5u9cQ+z48jQXqnnJdY=
X-Google-Smtp-Source: ABdhPJxKco4N/G+c7f054mqdYKJXfmgOzt9IiUTDENFHBlspcIbVfPcpvGIpL8siWSTjCPQgzVYKIw==
X-Received: by 2002:adf:f509:: with SMTP id q9mr6672127wro.133.1598535670591; 
 Thu, 27 Aug 2020 06:41:10 -0700 (PDT)
Received: from liuwe-devbox-debian-v2 ([51.145.34.42])
 by smtp.gmail.com with ESMTPSA id l1sm6105006wrb.12.2020.08.27.06.41.09
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Thu, 27 Aug 2020 06:41:09 -0700 (PDT)
Date: Thu, 27 Aug 2020 13:41:08 +0000
From: Wei Liu <wl@xen.org>
To: Samuel Thibault <samuel.thibault@ens-lyon.org>,
 Costin Lupu <costin.lupu@cs.pub.ro>, minios-devel@lists.xen.org, wl@xen.org
Subject: Re: [PATCH v2] mini-os: Use a single start_info_ptr variable
Message-ID: <20200827134108.novmgoe2uerfjnkq@liuwe-devbox-debian-v2>
References: <20200819154536.20753-1-costin.lupu@cs.pub.ro>
 <20200819160751.puvml7gxkxt4ftas@function>
MIME-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
Content-Disposition: inline
Content-Transfer-Encoding: 8bit
In-Reply-To: <20200819160751.puvml7gxkxt4ftas@function>
User-Agent: NeoMutt/20180716
X-BeenThere: minios-devel@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Mini-os development list <minios-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:minios-devel@lists.xenproject.org>
List-Help: <mailto:minios-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: minios-devel-bounces@lists.xenproject.org
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>

On Wed, Aug 19, 2020 at 06:07:51PM +0200, Samuel Thibault wrote:
> Costin Lupu, le mer. 19 août 2020 18:45:36 +0300, a ecrit:
> > The second definition of the `start_info_ptr` variable was introduced by commit
> > e05eb0 which was part of a series trying to add suspend/resume support to
> > mini-os. This patch removes the second definition by reverting some changes of
> > the mentioned commit and of commit 892b66.
> > 
> > However the logic in shutdown.c is still left in an inconsistent state because
> > it still doesn't work for ARM. The solution should be part of a future patch.
> > 
> > Signed-off-by: Costin Lupu <costin.lupu@cs.pub.ro>
> 
> Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>

Applied.


From minios-devel-bounces@lists.xenproject.org Thu Aug 27 13:41:38 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Thu, 27 Aug 2020 13:41:38 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1kBI9q-0000C6-Uk; Thu, 27 Aug 2020 13:41:38 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=cFEh=CF=gmail.com=wei.liu.xen@srs-us1.protection.inumbo.net>)
 id 1kBI9q-0000C0-Cj
 for minios-devel@lists.xen.org; Thu, 27 Aug 2020 13:41:38 +0000
X-Inumbo-ID: 0397e1cc-f629-4dbc-878f-ea5588d90644
Received: from mail-wr1-f66.google.com (unknown [209.85.221.66])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 0397e1cc-f629-4dbc-878f-ea5588d90644;
 Thu, 27 Aug 2020 13:41:37 +0000 (UTC)
Received: by mail-wr1-f66.google.com with SMTP id y3so5434655wrl.4
 for <minios-devel@lists.xen.org>; Thu, 27 Aug 2020 06:41:37 -0700 (PDT)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:date:from:to:subject:message-id:references
 :mime-version:content-disposition:content-transfer-encoding
 :in-reply-to:user-agent;
 bh=Vku+TxsYv2Ouk1OKczwnbtu83rI9wCBaLCp2UyyQ1i0=;
 b=H+HE/O7d4qm4rkkS0Wev06DF8k8FlX8ZC27kPchL7Ibh1418I3GjTEf9stTZAUHgsb
 SUl+M9Gcg8Skxjh4F/zAwRWq4lJQEUW/+de6CfyQHqlzkpxEf5RUr104QL+NHm/dHb+6
 VslSAidir9rOtyV55d3COdzzE+QO6m/SPMW/MYhqv4/2XKTm04iQiq6eh9wP5iGfXBdj
 xjpcQYhUyNdwud4wRM05uQbpf7kfwFHckmzZBQd7AWtkIf0ATEZ3J8fazJ/wS1NN+WjG
 BZAJHhVaRRU8DLN5dMhnZO1qJdOxlh+0dYjO7SQtytU+8VLWMZctvk+3rrubhvXbE/x4
 aNZw==
X-Gm-Message-State: AOAM531osB45OYME3T9Rpb0op5Mo99b7P/B2m+L89+BWXW96YiSNLCv6
 MI8NuyeA0n/oOInTOh+EuJCu5Gzk0Dg=
X-Google-Smtp-Source: ABdhPJwXNJ0QPuSr+J7PvTcrO1XK+DVAAUArdYsRPmzz9PpCPgwRkF6zQC/tVVh2sKTrsTDYYpyUmA==
X-Received: by 2002:adf:f442:: with SMTP id f2mr9846167wrp.184.1598535696691; 
 Thu, 27 Aug 2020 06:41:36 -0700 (PDT)
Received: from liuwe-devbox-debian-v2 ([51.145.34.42])
 by smtp.gmail.com with ESMTPSA id n24sm4949177wmi.36.2020.08.27.06.41.36
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Thu, 27 Aug 2020 06:41:36 -0700 (PDT)
Date: Thu, 27 Aug 2020 13:41:34 +0000
From: Wei Liu <wl@xen.org>
To: Samuel Thibault <samuel.thibault@ens-lyon.org>,
 Costin Lupu <costin.lupu@cs.pub.ro>, minios-devel@lists.xen.org, wl@xen.org
Subject: Re: [PATCH v2] mini-os: Add suspend stubs for ARM
Message-ID: <20200827134134.h7uc3mvmv57lnpn3@liuwe-devbox-debian-v2>
References: <20200819164108.30545-1-costin.lupu@cs.pub.ro>
 <20200819164931.p2rrbjtbnrycnu36@function>
MIME-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
Content-Disposition: inline
Content-Transfer-Encoding: 8bit
In-Reply-To: <20200819164931.p2rrbjtbnrycnu36@function>
User-Agent: NeoMutt/20180716
X-BeenThere: minios-devel@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Mini-os development list <minios-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:minios-devel@lists.xenproject.org>
List-Help: <mailto:minios-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: minios-devel-bounces@lists.xenproject.org
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>

On Wed, Aug 19, 2020 at 06:49:31PM +0200, Samuel Thibault wrote:
> Costin Lupu, le mer. 19 août 2020 19:41:08 +0300, a ecrit:
> > This patch introduces the missing suspend-related stubs for ARM. It also
> > introduces the new arch_suspend() function in order to keep the logic in
> > kernel_suspend() arch independent.
> > 
> > Signed-off-by: Costin Lupu <costin.lupu@cs.pub.ro>
> 
> Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>

Applied.


From minios-devel-bounces@lists.xenproject.org Thu Aug 27 13:42:11 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Thu, 27 Aug 2020 13:42:11 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1kBIAN-0000DY-17; Thu, 27 Aug 2020 13:42:11 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=cFEh=CF=gmail.com=wei.liu.xen@srs-us1.protection.inumbo.net>)
 id 1kBIAM-0000DT-BM
 for minios-devel@lists.xen.org; Thu, 27 Aug 2020 13:42:10 +0000
X-Inumbo-ID: 445b3cff-e4bd-42ee-bc64-62767770392f
Received: from mail-wr1-f68.google.com (unknown [209.85.221.68])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 445b3cff-e4bd-42ee-bc64-62767770392f;
 Thu, 27 Aug 2020 13:42:09 +0000 (UTC)
Received: by mail-wr1-f68.google.com with SMTP id w13so5431123wrk.5
 for <minios-devel@lists.xen.org>; Thu, 27 Aug 2020 06:42:09 -0700 (PDT)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:date:from:to:subject:message-id:references
 :mime-version:content-disposition:content-transfer-encoding
 :in-reply-to:user-agent;
 bh=Y0idI45mxT38OgdS1YvOS0vkdYyk6pAvzdtNmAet/jA=;
 b=EiL5mnjBF3d+KxxSffYxauogaOCtjmOSXCUI5bAOnLvx+Aw+dadaE7XsZRMXFS98SB
 UXrAYlDL89+MT4GvFr3/dv07B7IVJCegQU7Eylr+voqpKTxdfB0oVNvll7xYAgfjYAB2
 y8RERRdoytnlharJgTvcB69B/zTLR+b8hjS40+OBKsrfWgg0qt2DzsKuBz7w8thmBMHB
 Z3cJewswjEITww/RD9gjU3HY7B/qsEJwmeJjsD0v37DCYIDved29VXK933w2IJlwPa7O
 YZG5Ka2prvrxCZxCQ7P8R+b8JmuR+2GP2siNWDmHvq6hX6gi30/FtMzMFOcOggIZFdx9
 220A==
X-Gm-Message-State: AOAM530MeLpyJuvv6bvdaqBOH5ueVSeW+fjJPSSlifTtAiNgwDascXeW
 S1XKw2NNW4IyLnxeWr5l6rg=
X-Google-Smtp-Source: ABdhPJwIRxsNHO7AtQtihvrBrrS3oh2nalWq8paP89OFL7D41+pnTTxkzxgLDdVaIuePZFsGoJTm7Q==
X-Received: by 2002:a5d:420b:: with SMTP id n11mr19898067wrq.11.1598535727575; 
 Thu, 27 Aug 2020 06:42:07 -0700 (PDT)
Received: from liuwe-devbox-debian-v2 ([51.145.34.42])
 by smtp.gmail.com with ESMTPSA id n205sm5783104wma.47.2020.08.27.06.41.50
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Thu, 27 Aug 2020 06:41:50 -0700 (PDT)
Date: Thu, 27 Aug 2020 13:41:49 +0000
From: Wei Liu <wl@xen.org>
To: Samuel Thibault <samuel.thibault@ens-lyon.org>,
 Costin Lupu <costin.lupu@cs.pub.ro>, minios-devel@lists.xen.org, wl@xen.org
Subject: Re: [PATCH] mini-os: console.c: Rename static variable from buf to
 __print_buf
Message-ID: <20200827134149.5oiuo222wzvqj3ty@liuwe-devbox-debian-v2>
References: <20200818134406.15254-1-costin.lupu@cs.pub.ro>
 <20200818164437.mivf5sfqgsxzam22@function>
MIME-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
Content-Disposition: inline
Content-Transfer-Encoding: 8bit
In-Reply-To: <20200818164437.mivf5sfqgsxzam22@function>
User-Agent: NeoMutt/20180716
X-BeenThere: minios-devel@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Mini-os development list <minios-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:minios-devel@lists.xenproject.org>
List-Help: <mailto:minios-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: minios-devel-bounces@lists.xenproject.org
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>

On Tue, Aug 18, 2020 at 06:44:37PM +0200, Samuel Thibault wrote:
> Costin Lupu, le mar. 18 août 2020 16:44:06 +0300, a ecrit:
> > lwip soure code also has a static variable called 'buf' in ip_frag.c. This can
> > get confusing when inspecting the binary (e.g. with objdump or something
> > similar). Therefore this patch renames the 'buf' variable used by print()
> > function to '__print_buf'.
> > 
> > Signed-off-by: Costin Lupu <costin.lupu@cs.pub.ro>
> 
> Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>

Applied.


From minios-devel-bounces@lists.xenproject.org Thu Aug 27 16:45:51 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Thu, 27 Aug 2020 16:45:51 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1kBL24-0000iT-9J; Thu, 27 Aug 2020 16:45:48 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=QM1O=CF=cs.pub.ro=costin.lupu@srs-us1.protection.inumbo.net>)
 id 1kBL23-0000iO-9G
 for minios-devel@lists.xen.org; Thu, 27 Aug 2020 16:45:47 +0000
X-Inumbo-ID: 88cc83a7-bc6d-40fa-98dc-d16409351818
Received: from mx.upb.ro (unknown [141.85.13.230])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 88cc83a7-bc6d-40fa-98dc-d16409351818;
 Thu, 27 Aug 2020 16:45:44 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
 by mx.upb.ro (Postfix) with ESMTP id 1226EB561EEC;
 Thu, 27 Aug 2020 19:45:43 +0300 (EEST)
Received: from mx.upb.ro ([127.0.0.1])
 by localhost (mx.upb.ro [127.0.0.1]) (amavisd-new, port 10032)
 with ESMTP id C2QNYmABoQ4Z; Thu, 27 Aug 2020 19:45:41 +0300 (EEST)
Received: from localhost (localhost [127.0.0.1])
 by mx.upb.ro (Postfix) with ESMTP id 265A0B561EF4;
 Thu, 27 Aug 2020 19:45:41 +0300 (EEST)
X-Virus-Scanned: amavisd-new at upb.ro
Received: from mx.upb.ro ([127.0.0.1])
 by localhost (mx.upb.ro [127.0.0.1]) (amavisd-new, port 10026)
 with ESMTP id eUjzM_Ke3CFn; Thu, 27 Aug 2020 19:45:41 +0300 (EEST)
Received: from localhost.localdomain (5-12-253-103.residential.rdsnet.ro
 [5.12.253.103]) by mx.upb.ro (Postfix) with ESMTPSA id BFD5AB561EEC;
 Thu, 27 Aug 2020 19:45:40 +0300 (EEST)
From: Costin Lupu <costin.lupu@cs.pub.ro>
To: minios-devel@lists.xen.org
Cc: samuel.thibault@ens-lyon.org,
	wl@xen.org,
	jbeulich@suse.com
Subject: [PATCH] mini-os: Fix outdated init_netfront() calls
Date: Thu, 27 Aug 2020 19:45:36 +0300
Message-Id: <20200827164536.25776-1-costin.lupu@cs.pub.ro>
X-Mailer: git-send-email 2.20.1
MIME-Version: 1.0
Content-Transfer-Encoding: quoted-printable
X-BeenThere: minios-devel@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Mini-os development list <minios-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:minios-devel@lists.xenproject.org>
List-Help: <mailto:minios-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: minios-devel-bounces@lists.xenproject.org
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>

Commit 1b8ed31f changed the init_netfront() declaration. This patch fixes=
 a
couple of calls that were overlooked for that initial commit.

Signed-off-by: Costin Lupu <costin.lupu@cs.pub.ro>
---
 netfront.c | 2 +-
 test.c     | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/netfront.c b/netfront.c
index 58eb55e..205484b 100644
--- a/netfront.c
+++ b/netfront.c
@@ -576,7 +576,7 @@ error:
 int netfront_tap_open(char *nodename) {
     struct netfront_dev *dev;
=20
-    dev =3D init_netfront(nodename, NETIF_SELECT_RX, NULL, NULL);
+    dev =3D init_netfront(nodename, NETIF_SELECT_RX, NULL, NULL, NULL, N=
ULL);
     if (!dev) {
 	printk("TAP open failed\n");
 	errno =3D EIO;
diff --git a/test.c b/test.c
index 42a2666..2e5f7f9 100644
--- a/test.c
+++ b/test.c
@@ -91,7 +91,7 @@ static struct semaphore net_sem =3D __SEMAPHORE_INITIAL=
IZER(net_sem, 0);
=20
 static void netfront_thread(void *p)
 {
-    net_dev =3D init_netfront(NULL, NULL, NULL, NULL);
+    net_dev =3D init_netfront(NULL, NULL, NULL, NULL, NULL, NULL);
     up(&net_sem);
 }
 #endif
--=20
2.20.1



From minios-devel-bounces@lists.xenproject.org Thu Aug 27 18:38:32 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Thu, 27 Aug 2020 18:38:32 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1kBMn8-0003Td-Sm; Thu, 27 Aug 2020 18:38:30 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=z6xA=CF=ens-lyon.org=samuel.thibault@srs-us1.protection.inumbo.net>)
 id 1kBMn7-0003TI-Rq
 for minios-devel@lists.xen.org; Thu, 27 Aug 2020 18:38:29 +0000
X-Inumbo-ID: b5cff433-95da-402d-ae70-959f686fdb49
Received: from hera.aquilenet.fr (unknown [185.233.100.1])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id b5cff433-95da-402d-ae70-959f686fdb49;
 Thu, 27 Aug 2020 18:38:28 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
 by hera.aquilenet.fr (Postfix) with ESMTP id 2C5AB9335;
 Thu, 27 Aug 2020 20:38:27 +0200 (CEST)
X-Virus-Scanned: Debian amavisd-new at aquilenet.fr
Received: from hera.aquilenet.fr ([127.0.0.1])
 by localhost (hera.aquilenet.fr [127.0.0.1]) (amavisd-new, port 10024)
 with ESMTP id Ugm8kB9S81he; Thu, 27 Aug 2020 20:38:26 +0200 (CEST)
Received: from function (lfbn-bor-1-797-11.w86-234.abo.wanadoo.fr
 [86.234.239.11])
 by hera.aquilenet.fr (Postfix) with ESMTPSA id 54B2692DC;
 Thu, 27 Aug 2020 20:38:26 +0200 (CEST)
Received: from samy by function with local (Exim 4.94)
 (envelope-from <samuel.thibault@ens-lyon.org>)
 id 1kBMn3-0003rT-Dz; Thu, 27 Aug 2020 20:38:25 +0200
Date: Thu, 27 Aug 2020 20:38:25 +0200
From: Samuel Thibault <samuel.thibault@ens-lyon.org>
To: Costin Lupu <costin.lupu@cs.pub.ro>
Cc: minios-devel@lists.xen.org, wl@xen.org, jbeulich@suse.com
Subject: Re: [PATCH] mini-os: Fix outdated init_netfront() calls
Message-ID: <20200827183825.hdkzrs3caaz25uyq@function>
Mail-Followup-To: Samuel Thibault <samuel.thibault@ens-lyon.org>,
 Costin Lupu <costin.lupu@cs.pub.ro>, minios-devel@lists.xen.org,
 wl@xen.org, jbeulich@suse.com
References: <20200827164536.25776-1-costin.lupu@cs.pub.ro>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
Content-Transfer-Encoding: 8bit
In-Reply-To: <20200827164536.25776-1-costin.lupu@cs.pub.ro>
Organization: I am not organized
User-Agent: NeoMutt/20170609 (1.8.3)
X-BeenThere: minios-devel@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Mini-os development list <minios-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:minios-devel@lists.xenproject.org>
List-Help: <mailto:minios-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: minios-devel-bounces@lists.xenproject.org
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>

Costin Lupu, le jeu. 27 aoÃ»t 2020 19:45:36 +0300, a ecrit:
> Commit 1b8ed31f changed the init_netfront() declaration. This patch fixes a
> couple of calls that were overlooked for that initial commit.
> 
> Signed-off-by: Costin Lupu <costin.lupu@cs.pub.ro>

Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>

> ---
>  netfront.c | 2 +-
>  test.c     | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/netfront.c b/netfront.c
> index 58eb55e..205484b 100644
> --- a/netfront.c
> +++ b/netfront.c
> @@ -576,7 +576,7 @@ error:
>  int netfront_tap_open(char *nodename) {
>      struct netfront_dev *dev;
>  
> -    dev = init_netfront(nodename, NETIF_SELECT_RX, NULL, NULL);
> +    dev = init_netfront(nodename, NETIF_SELECT_RX, NULL, NULL, NULL, NULL);
>      if (!dev) {
>  	printk("TAP open failed\n");
>  	errno = EIO;
> diff --git a/test.c b/test.c
> index 42a2666..2e5f7f9 100644
> --- a/test.c
> +++ b/test.c
> @@ -91,7 +91,7 @@ static struct semaphore net_sem = __SEMAPHORE_INITIALIZER(net_sem, 0);
>  
>  static void netfront_thread(void *p)
>  {
> -    net_dev = init_netfront(NULL, NULL, NULL, NULL);
> +    net_dev = init_netfront(NULL, NULL, NULL, NULL, NULL, NULL);
>      up(&net_sem);
>  }
>  #endif
> -- 
> 2.20.1
> 

-- 
Samuel
<y> Ã§a gaze ?
<l> prout
 -+- #ens-mim - ouvrez les fenÃªtres ! -+-


From minios-devel-bounces@lists.xenproject.org Fri Aug 28 06:57:26 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Fri, 28 Aug 2020 06:57:26 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1kBYK8-0000Ii-DT; Fri, 28 Aug 2020 06:57:20 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <SRS0=8pf4=CG=suse.com=jbeulich@srs-us1.protection.inumbo.net>)
 id 1kBYK7-0000Id-2V
 for minios-devel@lists.xen.org; Fri, 28 Aug 2020 06:57:19 +0000
X-Inumbo-ID: 6dec2785-8c08-4b25-a02f-f4136a26a6dc
Received: from mx2.suse.de (unknown [195.135.220.15])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 6dec2785-8c08-4b25-a02f-f4136a26a6dc;
 Fri, 28 Aug 2020 06:57:17 +0000 (UTC)
X-Virus-Scanned: by amavisd-new at test-mx.suse.de
Received: from relay2.suse.de (unknown [195.135.221.27])
 by mx2.suse.de (Postfix) with ESMTP id 4C860B683;
 Fri, 28 Aug 2020 06:57:49 +0000 (UTC)
Subject: Re: [PATCH] mini-os: Fix outdated init_netfront() calls
To: Costin Lupu <costin.lupu@cs.pub.ro>
Cc: minios-devel@lists.xen.org, samuel.thibault@ens-lyon.org, wl@xen.org
References: <20200827164536.25776-1-costin.lupu@cs.pub.ro>
From: Jan Beulich <jbeulich@suse.com>
Message-ID: <f4099ddf-840e-35dd-63c6-471e0adcaf84@suse.com>
Date: Fri, 28 Aug 2020 08:57:16 +0200
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:68.0) Gecko/20100101
 Thunderbird/68.11.0
MIME-Version: 1.0
In-Reply-To: <20200827164536.25776-1-costin.lupu@cs.pub.ro>
Content-Type: text/plain; charset=utf-8
Content-Language: en-US
Content-Transfer-Encoding: 7bit
X-BeenThere: minios-devel@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Mini-os development list <minios-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:minios-devel@lists.xenproject.org>
List-Help: <mailto:minios-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: minios-devel-bounces@lists.xenproject.org
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>

On 27.08.2020 18:45, Costin Lupu wrote:
> Commit 1b8ed31f changed the init_netfront() declaration. This patch fixes a
> couple of calls that were overlooked for that initial commit.
> 

Reported-by: Jan Beulich <jbeulich@suse.com>

> Signed-off-by: Costin Lupu <costin.lupu@cs.pub.ro>
> ---
>  netfront.c | 2 +-
>  test.c     | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/netfront.c b/netfront.c
> index 58eb55e..205484b 100644
> --- a/netfront.c
> +++ b/netfront.c
> @@ -576,7 +576,7 @@ error:
>  int netfront_tap_open(char *nodename) {
>      struct netfront_dev *dev;
>  
> -    dev = init_netfront(nodename, NETIF_SELECT_RX, NULL, NULL);
> +    dev = init_netfront(nodename, NETIF_SELECT_RX, NULL, NULL, NULL, NULL);
>      if (!dev) {
>  	printk("TAP open failed\n");
>  	errno = EIO;
> diff --git a/test.c b/test.c
> index 42a2666..2e5f7f9 100644
> --- a/test.c
> +++ b/test.c
> @@ -91,7 +91,7 @@ static struct semaphore net_sem = __SEMAPHORE_INITIALIZER(net_sem, 0);
>  
>  static void netfront_thread(void *p)
>  {
> -    net_dev = init_netfront(NULL, NULL, NULL, NULL);
> +    net_dev = init_netfront(NULL, NULL, NULL, NULL, NULL, NULL);
>      up(&net_sem);
>  }
>  #endif
> 



From minios-devel-bounces@lists.xenproject.org Fri Aug 28 08:44:25 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Fri, 28 Aug 2020 08:44:25 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1kBZzj-0002fz-FU; Fri, 28 Aug 2020 08:44:23 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=lqI4=CG=gmail.com=wei.liu.xen@srs-us1.protection.inumbo.net>)
 id 1kBZzi-0002ft-JB
 for minios-devel@lists.xen.org; Fri, 28 Aug 2020 08:44:22 +0000
X-Inumbo-ID: 1b146c3d-957c-4fac-ae10-b8d0274dd6a3
Received: from mail-wr1-f66.google.com (unknown [209.85.221.66])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 1b146c3d-957c-4fac-ae10-b8d0274dd6a3;
 Fri, 28 Aug 2020 08:44:21 +0000 (UTC)
Received: by mail-wr1-f66.google.com with SMTP id a5so516186wrm.6
 for <minios-devel@lists.xen.org>; Fri, 28 Aug 2020 01:44:21 -0700 (PDT)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:date:from:to:cc:subject:message-id:references
 :mime-version:content-disposition:in-reply-to:user-agent;
 bh=w4B3BqKomJxAooWgp9w4SnvIu0y9a8uY55O1Ra5IVRI=;
 b=RBp0lMKg5y1pluyd6G3834oMUmITmFea0/Kwb/qbwYRdMDEbIH9Cx7Q7EqPnWuokh1
 HjAlOI/+LP+OOiLT4hS0YxsutBwMBnNHtPkzVoGAbQGdQu9ZJQqYeNO3uW4/XnnuZAk5
 fCQ4Q0/QNtkQSpLKb2r5Ad6mEPqwnH83T6ut1oyE21y1mHk67bB+XSlAorpkhjDOnLpB
 tGGCSxMtzmAmY8VNGRFVHGdfqvwEh2bKtfo59s0bWVQRSNJGmSohByYrslhU46XrmUPp
 CI8Q/wdE2ySZoyj5+sjBwH0AKRjI596O12mj50oS63TMFTG3RElKrirfdHND8g9nr3CE
 ZTng==
X-Gm-Message-State: AOAM533HvcUIukfbhGXPs+TW+hbeQL+fNG1Qlzkung1fZwW8rscZw7t7
 wTuCb1pxmIMLtisrX+CERM8=
X-Google-Smtp-Source: ABdhPJwAy3IdQ2f1JTy85b4uA8sO8nDQvQmRQYibz1Pp6+ePAGOfPmxuojK4IFUaC8xJX/aZGVNKRA==
X-Received: by 2002:adf:c182:: with SMTP id x2mr468259wre.400.1598604260473;
 Fri, 28 Aug 2020 01:44:20 -0700 (PDT)
Received: from liuwe-devbox-debian-v2 ([51.145.34.42])
 by smtp.gmail.com with ESMTPSA id e17sm878919wrm.28.2020.08.28.01.44.19
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Fri, 28 Aug 2020 01:44:19 -0700 (PDT)
Date: Fri, 28 Aug 2020 08:44:18 +0000
From: Wei Liu <wl@xen.org>
To: Jan Beulich <jbeulich@suse.com>
Cc: Costin Lupu <costin.lupu@cs.pub.ro>, minios-devel@lists.xen.org,
 samuel.thibault@ens-lyon.org, wl@xen.org
Subject: Re: [PATCH] mini-os: Fix outdated init_netfront() calls
Message-ID: <20200828084418.7qeinjjy3chjhqga@liuwe-devbox-debian-v2>
References: <20200827164536.25776-1-costin.lupu@cs.pub.ro>
 <f4099ddf-840e-35dd-63c6-471e0adcaf84@suse.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <f4099ddf-840e-35dd-63c6-471e0adcaf84@suse.com>
User-Agent: NeoMutt/20180716
X-BeenThere: minios-devel@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Mini-os development list <minios-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:minios-devel@lists.xenproject.org>
List-Help: <mailto:minios-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: minios-devel-bounces@lists.xenproject.org
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>

On Fri, Aug 28, 2020 at 08:57:16AM +0200, Jan Beulich wrote:
> On 27.08.2020 18:45, Costin Lupu wrote:
> > Commit 1b8ed31f changed the init_netfront() declaration. This patch fixes a
> > couple of calls that were overlooked for that initial commit.
> > 
> 
> Reported-by: Jan Beulich <jbeulich@suse.com>

Applied.


From minios-devel-bounces@lists.xenproject.org Fri Aug 28 09:37:41 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Fri, 28 Aug 2020 09:37:41 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1kBapI-0007VI-3S; Fri, 28 Aug 2020 09:37:40 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=CR8p=CG=gmail.com=cristianvijelie@srs-us1.protection.inumbo.net>)
 id 1kBapH-0007VD-GW
 for minios-devel@lists.xen.org; Fri, 28 Aug 2020 09:37:39 +0000
X-Inumbo-ID: 76023af1-18dd-4d0c-980a-c84d9f8ec635
Received: from mail-wm1-x336.google.com (unknown [2a00:1450:4864:20::336])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 76023af1-18dd-4d0c-980a-c84d9f8ec635;
 Fri, 28 Aug 2020 09:37:38 +0000 (UTC)
Received: by mail-wm1-x336.google.com with SMTP id b79so304396wmb.4
 for <minios-devel@lists.xen.org>; Fri, 28 Aug 2020 02:37:38 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=from:to:subject:date:message-id:mime-version
 :content-transfer-encoding;
 bh=XD26U7h5y2FxIjnfKAta9LZudE2YWA7dButz3zQKfRI=;
 b=exCvm9b6g3C1YcT9r//R9mfvqbi+jZsxlSEz7kwv5gA39O0hd/vL05h+1bAuts5seF
 vykBVoEUsjPP3BDvJkyg9wANfw7STVMBBFGQQ1l84kjV9bLyN5BmLE65MjXYiR2DgTgb
 bcH4szK6tKyjF0mNPY1rXxneSrZz9oaSMV0XeqAOc12iy8karG6BOKRWPvKR8nBv9xTi
 whBbYO/8V5l9VwQ1PxbxEVFB/4A+jiqaZT8n0WNmKZpk5t0kFU689QONXThPoM/TA7Ff
 hG0Raadmrirck98zIa8kOE6ngeoyE0A4GEFOw6hFsmRsWmyGR1dM1c6LDN6Ya7M2qED9
 6mWg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:to:subject:date:message-id:mime-version
 :content-transfer-encoding;
 bh=XD26U7h5y2FxIjnfKAta9LZudE2YWA7dButz3zQKfRI=;
 b=faH0Zt5Ue235TTZgWKUpaxRILAamLcouFCvVrGFAb+rIqIf4gcfkj3k7LGeKrLtJ4Q
 5ZjmUPLONnkocaexklFc8dREtnkJzYzu5vhPfbcDtxCv0+S8eWIdMmkAjYs2uD6O8kmx
 ZWLjHwGrsS9Pk6+4/zpedKiTheKpHFxeWUsxXgoyrSrC1F+W6mlUQTHvkhDnIQv3CMon
 q3NbBNh1ZiJQJIDHEnUURQvKsPtQxpM/lL6v/kpMOqh+Sh2SLvg28RZW+R/Y6OGgY00r
 T05fIQvt5y3y06sdypLdIGZPszNNJuyfLBGOEhb2UZMpZtKZ5IhBxbtl1zk2Cd5sTGyG
 MVNg==
X-Gm-Message-State: AOAM53291Mm3t0AQiOajuluWwP36+VyElgvtsPAyNNFQdNi+v1lTHLTN
 5oI4H0x5tk+5PDXRVxdPF2C2A9CkRx+XhQ==
X-Google-Smtp-Source: ABdhPJySFN3aNavY6FDEacq82s/3BXcj0snqtlVIUgKx1657S0IQBIQZ9Fo10pyTY/ZLGnlXuwQ7vQ==
X-Received: by 2002:a1c:cc0c:: with SMTP id h12mr712642wmb.57.1598607457491;
 Fri, 28 Aug 2020 02:37:37 -0700 (PDT)
Received: from localhost.localdomain ([2a00:5dc0:ffff:0:78d4:1e02:22e0:26fa])
 by smtp.gmail.com with ESMTPSA id
 b131sm1339100wmc.8.2020.08.28.02.37.36
 for <minios-devel@lists.xen.org>
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Fri, 28 Aug 2020 02:37:36 -0700 (PDT)
From: cristianvijelie@gmail.com
To: minios-devel@lists.xen.org
Subject: [[UNIKRAFT PATCH] v4 0/4] Remove extended register usage in interupt
 handlers
Date: Fri, 28 Aug 2020 12:37:31 +0300
Message-Id: <20200828093735.23895-1-cristianvijelie@gmail.com>
X-Mailer: git-send-email 2.25.1
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-BeenThere: minios-devel@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Mini-os development list <minios-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:minios-devel@lists.xenproject.org>
List-Help: <mailto:minios-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: minios-devel-bounces@lists.xenproject.org
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>

From: Cristian Vijelie <cristianvijelie@gmail.com>

This sries of patches means to create a new library, based on nolibc, which is
interrupt-context-safe and change the drivers, so that the interrupt handlers
are also interrupt-context-safe, by making them use the new library, where needed
and by moving the interrupt handlers in separate files, that are compiled using
the unikraft 'isr' flag.

Cristian Vijelie (4):
  Introduce libc-like interrupt-context-safe routines
  Made _ukplat_irq_handle interrupt-context-safe
  Made virtio irq handler interrupt-context-safe
  Made xen event handler interrupt-context-safe

-- 
2.25.1



From minios-devel-bounces@lists.xenproject.org Fri Aug 28 09:37:45 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Fri, 28 Aug 2020 09:37:45 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1kBapN-0007Vv-5r; Fri, 28 Aug 2020 09:37:45 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=CR8p=CG=gmail.com=cristianvijelie@srs-us1.protection.inumbo.net>)
 id 1kBapM-0007VD-F8
 for minios-devel@lists.xen.org; Fri, 28 Aug 2020 09:37:44 +0000
X-Inumbo-ID: 01df882a-ff87-4bf6-99ff-f16e8e15f1a9
Received: from mail-wr1-x443.google.com (unknown [2a00:1450:4864:20::443])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 01df882a-ff87-4bf6-99ff-f16e8e15f1a9;
 Fri, 28 Aug 2020 09:37:40 +0000 (UTC)
Received: by mail-wr1-x443.google.com with SMTP id a5so664861wrm.6
 for <minios-devel@lists.xen.org>; Fri, 28 Aug 2020 02:37:40 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=from:to:subject:date:message-id:in-reply-to:references:mime-version
 :content-transfer-encoding;
 bh=obWJ407OCvMlPj/ZLPy14vYTNsbtTBuCMiIjVLNroog=;
 b=Bp15gO7i99d+87oIiy706YRYIk1FmaIgEXwPzW0zL55n2q74By+zRL1tkQrRJ8IFFZ
 u7LCH2P2pAJjiw6x71xAGcmRlpYl4Swgwx1+ID837MG7nps1NHGNxN03+Gn/+Ck59jGI
 sRDvQJPWKIUNvXU9lnY/VT9Ah6gbaWCpFoXscQ3XDxWBJSsbo31lkvjotraCO73CZrHv
 HEh7E+HQRgb2YZk501kFwJn1GOHFV0ZKvwCrEwk8Vz7TbvleYmTLF6x2kHB9LWfLy3/M
 D5snMoYv0eQeUG39ZFUuB3KypTZQjgyQpbUcIOwLwKqFvLhSAMyMhLAb/O4iJIw8+azR
 4MHA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to
 :references:mime-version:content-transfer-encoding;
 bh=obWJ407OCvMlPj/ZLPy14vYTNsbtTBuCMiIjVLNroog=;
 b=WWBjhEiTknFPFQNGAPa+KRuQduwWGS6Veqr/uW3esrBT3lyCsDAdv5STCXq8sIIpUg
 QNhEcUAYEEEjs6pGBp1KW6WeQ+1qsbY0cFY3tbGp4j01HALZ/2XFDXJ+ZNWpSY8DZxrw
 54hOJ5O+eVsOkNdEIk1CPLd8LOtck4aH7sUaOr14I5/66ONHAs4c5GRMPIQeJSzyPMba
 /+qqf1J0q+umsYo5DkBDfoFxzx646Sl0m4ff//vvcb9LG/K5Ge+bDI9sPYOto5/XlMrx
 cnjVdj+K1/Z+C1HAApLckZGO5mmpLb4enMqwo3k+IX91DZ97K1RX1e15aeuIl8WRixeK
 ChVA==
X-Gm-Message-State: AOAM533FPDiGf5Ok1E08kwVjOcQ8IGa7ICTBNpMkp+RNovU3QF2idwGp
 bpcPwsgkWnivxFHZcH7T+n26rYZCpzWdfQ==
X-Google-Smtp-Source: ABdhPJwReSrWF5+K9+DiGDNcmxrKtfWz6ZM8vc4XEIWqWyHNFFrR8dTazeZslqRRh4KZ5jF+1VxvgA==
X-Received: by 2002:adf:a48d:: with SMTP id g13mr692727wrb.212.1598607459565; 
 Fri, 28 Aug 2020 02:37:39 -0700 (PDT)
Received: from localhost.localdomain ([2a00:5dc0:ffff:0:78d4:1e02:22e0:26fa])
 by smtp.gmail.com with ESMTPSA id
 b131sm1339100wmc.8.2020.08.28.02.37.38
 for <minios-devel@lists.xen.org>
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Fri, 28 Aug 2020 02:37:38 -0700 (PDT)
From: cristianvijelie@gmail.com
To: minios-devel@lists.xen.org
Subject: [[UNIKRAFT PATCH] v4 2/4] plat/kvm: Made _ukplat_irq_handle
 interrupt-context-safe
Date: Fri, 28 Aug 2020 12:37:33 +0300
Message-Id: <20200828093735.23895-3-cristianvijelie@gmail.com>
X-Mailer: git-send-email 2.25.1
In-Reply-To: <20200828093735.23895-1-cristianvijelie@gmail.com>
References: <20200828093735.23895-1-cristianvijelie@gmail.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-BeenThere: minios-devel@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Mini-os development list <minios-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:minios-devel@lists.xenproject.org>
List-Help: <mailto:minios-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: minios-devel-bounces@lists.xenproject.org
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>

From: Cristian Vijelie <cristianvijelie@gmail.com>

I moved the interrupt request handler for the KVM platform into a separate 
source file, isr.c, that is built using the 'isr' flag. Also, I have moved 
the definitions needed by both irq.c and isr.c into an internal header, 
'internal/irq.h'

Signed-off-by: Cristian Vijelie <cristianvijelie@gmail.com>
---
 plat/kvm/Makefile.uk    |  1 +
 plat/kvm/internal/irq.h | 13 ++++++++
 plat/kvm/irq.c          | 51 +---------------------------
 plat/kvm/isr.c          | 73 +++++++++++++++++++++++++++++++++++++++++
 4 files changed, 88 insertions(+), 50 deletions(-)
 create mode 100644 plat/kvm/internal/irq.h
 create mode 100644 plat/kvm/isr.c

diff --git a/plat/kvm/Makefile.uk b/plat/kvm/Makefile.uk
index 94321e0..ec079dd 100644
--- a/plat/kvm/Makefile.uk
+++ b/plat/kvm/Makefile.uk
@@ -100,6 +100,7 @@ LIBKVMPLAT_SRCS-$(CONFIG_ARCH_ARM_64) += $(LIBKVMPLAT_BASE)/arm/intctrl.c
 LIBKVMPLAT_SRCS-y              += $(LIBKVMPLAT_BASE)/shutdown.c
 LIBKVMPLAT_SRCS-y              += $(LIBKVMPLAT_BASE)/memory.c
 LIBKVMPLAT_SRCS-y              += $(LIBKVMPLAT_BASE)/irq.c
+LIBKVMPLAT_SRCS-y              += $(LIBKVMPLAT_BASE)/isr.c|isr
 LIBKVMPLAT_SRCS-y              += $(LIBKVMPLAT_BASE)/io.c
 LIBKVMPLAT_SRCS-y              += $(UK_PLAT_COMMON_BASE)/lcpu.c|common
 LIBKVMPLAT_SRCS-y              += $(UK_PLAT_COMMON_BASE)/memory.c|common
diff --git a/plat/kvm/internal/irq.h b/plat/kvm/internal/irq.h
new file mode 100644
index 0000000..2fd6b6d
--- /dev/null
+++ b/plat/kvm/internal/irq.h
@@ -0,0 +1,13 @@
+#include <uk/plat/irq.h>
+#include <uk/compat_list.h>
+#include <uk/plat/common/irq.h>
+
+struct irq_handler {
+	irq_handler_func_t func;
+	void *arg;
+
+	UK_SLIST_ENTRY(struct irq_handler) entries;
+};
+
+UK_SLIST_HEAD(irq_handler_head, struct irq_handler);
+static struct irq_handler_head irq_handlers[__MAX_IRQ];
\ No newline at end of file
diff --git a/plat/kvm/irq.c b/plat/kvm/irq.c
index 8f43aa6..87301a2 100644
--- a/plat/kvm/irq.c
+++ b/plat/kvm/irq.c
@@ -36,19 +36,10 @@
 #include <uk/assert.h>
 #include <errno.h>
 #include <uk/bitops.h>
+#include "internal/irq.h"
 
 static struct uk_alloc *allocator;
 
-struct irq_handler {
-	irq_handler_func_t func;
-	void *arg;
-
-	UK_SLIST_ENTRY(struct irq_handler) entries;
-};
-
-UK_SLIST_HEAD(irq_handler_head, struct irq_handler);
-static struct irq_handler_head irq_handlers[__MAX_IRQ];
-
 int ukplat_irq_register(unsigned long irq, irq_handler_func_t func, void *arg)
 {
 	struct irq_handler *h;
@@ -72,46 +63,6 @@ int ukplat_irq_register(unsigned long irq, irq_handler_func_t func, void *arg)
 	return 0;
 }
 
-/*
- * TODO: This is a temporary solution used to identify non TSC clock
- * interrupts in order to stop waiting for interrupts with deadline.
- */
-extern unsigned long sched_have_pending_events;
-
-void _ukplat_irq_handle(unsigned long irq)
-{
-	struct irq_handler *h;
-
-	UK_SLIST_FOREACH(h, &irq_handlers[irq], entries) {
-		/* TODO define platform wise macro for timer IRQ number */
-		if (irq != 0)
-			/* IRQ 0 is reserved for a timer, responsible to
-			 * wake up cpu from halt, so it can check if
-			 * it has something to do. Effectively it is OS ticks.
-			 *
-			 * If interrupt comes not from the timer, the
-			 * chances are some work have just
-			 * arrived. Let's kick the scheduler out of
-			 * the halting loop, and let it take care of
-			 * that work.
-			 */
-			__uk_test_and_set_bit(0, &sched_have_pending_events);
-
-		if (h->func(h->arg) == 1)
-			goto exit_ack;
-	}
-	/*
-	 * Acknowledge interrupts even in the case when there was no handler for
-	 * it. We do this to (1) compensate potential spurious interrupts of
-	 * devices, and (2) to minimize impact on drivers that share one
-	 * interrupt line that would then stay disabled.
-	 */
-	uk_pr_crit("Unhandled irq=%lu\n", irq);
-
-exit_ack:
-	intctrl_ack_irq(irq);
-}
-
 int ukplat_irq_init(struct uk_alloc *a)
 {
 	UK_ASSERT(allocator == NULL);
diff --git a/plat/kvm/isr.c b/plat/kvm/isr.c
new file mode 100644
index 0000000..f0ea3d3
--- /dev/null
+++ b/plat/kvm/isr.c
@@ -0,0 +1,73 @@
+/* SPDX-License-Identifier: ISC */
+/*
+ * Authors: Dan Williams
+ *          Martin Lucina
+ *          Ricardo Koller
+ *          Costin Lupu <costin.lupu@cs.pub.ro>
+ *
+ * Copyright (c) 2015-2017 IBM
+ * Copyright (c) 2016-2017 Docker, Inc.
+ * Copyright (c) 2018, NEC Europe Ltd., NEC Corporation
+ *
+ * Permission to use, copy, modify, and/or distribute this software
+ * for any purpose with or without fee is hereby granted, provided
+ * that the above copyright notice and this permission notice appear
+ * in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
+ * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
+ * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
+ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+/* Taken from solo5 intr.c */
+
+#include <kvm/irq.h>
+#include "internal/irq.h"
+#include <uk/bitops.h>
+#include <kvm/intctrl.h>
+#include <uk/assert.h>
+
+extern unsigned long sched_have_pending_events;
+
+/*
+ * TODO: This is a temporary solution used to identify non TSC clock
+ * interrupts in order to stop waiting for interrupts with deadline.
+ */
+
+void _ukplat_irq_handle(unsigned long irq)
+{
+	struct irq_handler *h;
+
+	UK_SLIST_FOREACH(h, &irq_handlers[irq], entries) {
+		/* TODO define platform wise macro for timer IRQ number */
+		if (irq != 0)
+			/* IRQ 0 is reserved for a timer, responsible to
+			 * wake up cpu from halt, so it can check if
+			 * it has something to do. Effectively it is OS ticks.
+			 *
+			 * If interrupt comes not from the timer, the
+			 * chances are some work have just
+			 * arrived. Let's kick the scheduler out of
+			 * the halting loop, and let it take care of
+			 * that work.
+			 */
+			__uk_test_and_set_bit(0, &sched_have_pending_events);
+
+		if (h->func(h->arg) == 1)
+			goto exit_ack;
+	}
+	/*
+	 * Acknowledge interrupts even in the case when there was no handler for
+	 * it. We do this to (1) compensate potential spurious interrupts of
+	 * devices, and (2) to minimize impact on drivers that share one
+	 * interrupt line that would then stay disabled.
+	 */
+	uk_pr_crit("Unhandled irq=%lu\n", irq);
+
+exit_ack:
+	intctrl_ack_irq(irq);
+}
\ No newline at end of file
-- 
2.25.1



From minios-devel-bounces@lists.xenproject.org Fri Aug 28 09:37:50 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Fri, 28 Aug 2020 09:37:50 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1kBapS-0007Wn-7g; Fri, 28 Aug 2020 09:37:50 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=CR8p=CG=gmail.com=cristianvijelie@srs-us1.protection.inumbo.net>)
 id 1kBapR-0007VD-FQ
 for minios-devel@lists.xen.org; Fri, 28 Aug 2020 09:37:49 +0000
X-Inumbo-ID: 38075309-0f71-4f7b-8801-6d739069d0d5
Received: from mail-wm1-x342.google.com (unknown [2a00:1450:4864:20::342])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 38075309-0f71-4f7b-8801-6d739069d0d5;
 Fri, 28 Aug 2020 09:37:41 +0000 (UTC)
Received: by mail-wm1-x342.google.com with SMTP id x9so313662wmi.2
 for <minios-devel@lists.xen.org>; Fri, 28 Aug 2020 02:37:41 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=from:to:subject:date:message-id:in-reply-to:references:mime-version
 :content-transfer-encoding;
 bh=uDWt7mB9w7rPwhsGlaftmOz5jWeYomjb5vJ2j6S1y6I=;
 b=r4cxHUN81P2867y886PYjdVwK5I+rmXsJcCB+vtlZUfsLvGJ75ozdGvreMKQHFT9sh
 I9mC8FSv7fjBYMvlBwpfyxbUrjQ/Hqa2jt4c2uBvwN5kEZQvuIOY/eLS0ngsVGzicfHM
 C4i15TG3lpsJ9muu2724fDAXnMLiV6uD5pHXvH22GGRsJJRvMzKocTYsNxpZPKoEhH6D
 4ZshyTLDrPBHHNuKewDca99T9s95F6D64b4yDmNq59D9GZXJ8plwAkTNu9SSjF3pNNbU
 xLniXi+HPok+7mUAEmlHNduLV2AH5C6Q7DuA7+af3xCKjo7kRsL1eWXdd+NISPtN3wmg
 TBoQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to
 :references:mime-version:content-transfer-encoding;
 bh=uDWt7mB9w7rPwhsGlaftmOz5jWeYomjb5vJ2j6S1y6I=;
 b=HMp/B7NO96Nyk4HI/yfho93UKLs4Jb1BsvF7IKuyBYW7P38ZTXoknLGUPDiZ2mzv1D
 Neh4VuHaugLPfdkUiZ263mETHvPH1xLayvUbbMsyPaAOf4HVFSUjquoBlq9ZVqHSpcu3
 YOGjB3kHwd8LU/c2azmC/CGDiyKoyFz36MEd8wbeLNsq5esctNhPx7vubFwdLOTLwLUp
 yNReZ1Anz2QRVdalBcwA+XTTdY7yf0ayJLvEmWu1BDR29TXRPK+QCNbWEJOJbhLVO7V0
 YlHU9tFkxHAE+Z8JGe9sYiZ331D2ioN+IzY8WB+LpOfokLMzU/+fEYcXy2MBWdpTZKk2
 mZLQ==
X-Gm-Message-State: AOAM530CY+ugSOaJNL9dChtHv+7mx1dmO/lUDLW5xGK/W4XsMjGnW0Y/
 QaXzOLhE2RVHwAEnnKQR8zVB+8ymbGmgew==
X-Google-Smtp-Source: ABdhPJwUeeSR3Pp8C3OJMnjf9ZbqIN9+zY70/b+F6sSWNMSCXTXo0xhUMyS/HR+NtC0HjdeJX9Aqkw==
X-Received: by 2002:a1c:c207:: with SMTP id s7mr720457wmf.182.1598607460736;
 Fri, 28 Aug 2020 02:37:40 -0700 (PDT)
Received: from localhost.localdomain ([2a00:5dc0:ffff:0:78d4:1e02:22e0:26fa])
 by smtp.gmail.com with ESMTPSA id
 b131sm1339100wmc.8.2020.08.28.02.37.39
 for <minios-devel@lists.xen.org>
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Fri, 28 Aug 2020 02:37:40 -0700 (PDT)
From: cristianvijelie@gmail.com
To: minios-devel@lists.xen.org
Subject: [[UNIKRAFT PATCH] v4 3/4] plat/drivers/virtio: Made virtio irq
 handler interrupt-context-safe
Date: Fri, 28 Aug 2020 12:37:34 +0300
Message-Id: <20200828093735.23895-4-cristianvijelie@gmail.com>
X-Mailer: git-send-email 2.25.1
In-Reply-To: <20200828093735.23895-1-cristianvijelie@gmail.com>
References: <20200828093735.23895-1-cristianvijelie@gmail.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-BeenThere: minios-devel@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Mini-os development list <minios-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:minios-devel@lists.xenproject.org>
List-Help: <mailto:minios-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: minios-devel-bounces@lists.xenproject.org
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>

From: Cristian Vijelie <cristianvijelie@gmail.com>

Added a new sourcefile, virtio-isr.c, where I placed the interrupt handler
'virtqueue_ring_interrupt', and made it to be build with the isr flag.

Signed-off-by: Cristian Vijelie <cristianvijelie@gmail.com>
---
 plat/drivers/virtio/internal/internal.h | 63 ++++++++++++++++++++++++
 plat/drivers/virtio/virtio_isr.c        | 64 +++++++++++++++++++++++++
 plat/drivers/virtio/virtio_ring.c       | 61 ++++++++---------------
 plat/kvm/Makefile.uk                    |  2 +
 4 files changed, 148 insertions(+), 42 deletions(-)
 create mode 100644 plat/drivers/virtio/internal/internal.h
 create mode 100644 plat/drivers/virtio/virtio_isr.c

diff --git a/plat/drivers/virtio/internal/internal.h b/plat/drivers/virtio/internal/internal.h
new file mode 100644
index 0000000..7f71653
--- /dev/null
+++ b/plat/drivers/virtio/internal/internal.h
@@ -0,0 +1,63 @@
+/* SPDX-License-Identifier: BSD-3-Clause */
+/*
+ * Authors: Sharan Santhanam <sharan.santhanam@neclab.eu>
+ *
+ * Copyright (c) 2018, NEC Europe Ltd., NEC Corporation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the copyright holder nor the names of its
+ *    contributors may be used to endorse or promote products derived from
+ *    this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ * THIS HEADER MAY NOT BE EXTRACTED OR MODIFIED IN ANY WAY.
+ */
+/**
+ * Inspired from the FreeBSD.
+ * Commit-id: a89e7a10d501
+ */
+
+#include <virtio/virtqueue.h>
+
+struct virtqueue_desc_info {
+	void *cookie;
+	__u16 desc_count;
+};
+
+struct virtqueue_vring {
+	struct virtqueue vq;
+	/* Descriptor Ring */
+	struct vring vring;
+	/* Reference to the vring */
+	void   *vring_mem;
+	/* Keep track of available descriptors */
+	__u16 desc_avail;
+	/* Index of the next available slot */
+	__u16 head_free_desc;
+	/* Index of the last used descriptor by the host */
+	__u16 last_used_desc_idx;
+	/* Cookie to identify driver buffer */
+	struct virtqueue_desc_info vq_info[];
+};
+
+#define to_virtqueue_vring(vq)			\
+	__containerof(vq, struct virtqueue_vring, vq)
diff --git a/plat/drivers/virtio/virtio_isr.c b/plat/drivers/virtio/virtio_isr.c
new file mode 100644
index 0000000..d338be0
--- /dev/null
+++ b/plat/drivers/virtio/virtio_isr.c
@@ -0,0 +1,64 @@
+/* SPDX-License-Identifier: BSD-3-Clause */
+/*
+ * Authors: Sharan Santhanam <sharan.santhanam@neclab.eu>
+ *
+ * Copyright (c) 2018, NEC Europe Ltd., NEC Corporation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the copyright holder nor the names of its
+ *    contributors may be used to endorse or promote products derived from
+ *    this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ * THIS HEADER MAY NOT BE EXTRACTED OR MODIFIED IN ANY WAY.
+ */
+/**
+ * Inspired from the FreeBSD.
+ * Commit-id: a89e7a10d501
+ */
+
+#include "internal/internal.h"
+
+int virtqueue_hasdata(struct virtqueue *vq)
+{
+	struct virtqueue_vring *vring;
+
+	UK_ASSERT(vq);
+
+	vring = to_virtqueue_vring(vq);
+	return (vring->last_used_desc_idx != vring->vring.used->idx);
+}
+
+int virtqueue_ring_interrupt(void *obj)
+{
+	struct virtqueue *vq = (struct virtqueue *)obj;
+	int rc = 0;
+
+	UK_ASSERT(vq);
+
+	if (!virtqueue_hasdata(vq))
+		return rc;
+
+	if (likely(vq->vq_callback))
+		rc = vq->vq_callback(vq, vq->priv);
+	return rc;
+}
diff --git a/plat/drivers/virtio/virtio_ring.c b/plat/drivers/virtio/virtio_ring.c
index 0a5c3f3..5a05bef 100644
--- a/plat/drivers/virtio/virtio_ring.c
+++ b/plat/drivers/virtio/virtio_ring.c
@@ -44,32 +44,9 @@
 #include <uk/arch/atomic.h>
 #include <uk/plat/io.h>
 #include <virtio/virtio_ring.h>
-#include <virtio/virtqueue.h>
+#include "internal/internal.h"
 
 #define VIRTQUEUE_MAX_SIZE  32768
-#define to_virtqueue_vring(vq)			\
-	__containerof(vq, struct virtqueue_vring, vq)
-
-struct virtqueue_desc_info {
-	void *cookie;
-	__u16 desc_count;
-};
-
-struct virtqueue_vring {
-	struct virtqueue vq;
-	/* Descriptor Ring */
-	struct vring vring;
-	/* Reference to the vring */
-	void   *vring_mem;
-	/* Keep track of available descriptors */
-	__u16 desc_avail;
-	/* Index of the next available slot */
-	__u16 head_free_desc;
-	/* Index of the last used descriptor by the host */
-	__u16 last_used_desc_idx;
-	/* Cookie to identify driver buffer */
-	struct virtqueue_desc_info vq_info[];
-};
 
 /**
  * Static function Declaration(s).
@@ -215,15 +192,15 @@ static inline int virtqueue_buffer_enqueue_segments(
 	return idx;
 }
 
-int virtqueue_hasdata(struct virtqueue *vq)
-{
-	struct virtqueue_vring *vring;
+// int virtqueue_hasdata(struct virtqueue *vq)
+// {
+// 	struct virtqueue_vring *vring;
 
-	UK_ASSERT(vq);
+// 	UK_ASSERT(vq);
 
-	vring = to_virtqueue_vring(vq);
-	return (vring->last_used_desc_idx != vring->vring.used->idx);
-}
+ 	// vring = to_virtqueue_vring(vq);
+// 	return (vring->last_used_desc_idx != vring->vring.used->idx);
+// }
 
 __u64 virtqueue_feature_negotiate(__u64 feature_set)
 {
@@ -237,20 +214,20 @@ __u64 virtqueue_feature_negotiate(__u64 feature_set)
 	return feature;
 }
 
-int virtqueue_ring_interrupt(void *obj)
-{
-	struct virtqueue *vq = (struct virtqueue *)obj;
-	int rc = 0;
+// int virtqueue_ring_interrupt(void *obj)
+// {
+// 	struct virtqueue *vq = (struct virtqueue *)obj;
+// 	int rc = 0;
 
-	UK_ASSERT(vq);
+// 	UK_ASSERT(vq);
 
-	if (!virtqueue_hasdata(vq))
-		return rc;
+// 	if (!virtqueue_hasdata(vq))
+// 		return rc;
 
-	if (likely(vq->vq_callback))
-		rc = vq->vq_callback(vq, vq->priv);
-	return rc;
-}
+// 	if (likely(vq->vq_callback))
+// 		rc = vq->vq_callback(vq, vq->priv);
+// 	return rc;
+// }
 
 __phys_addr virtqueue_physaddr(struct virtqueue *vq)
 {
diff --git a/plat/kvm/Makefile.uk b/plat/kvm/Makefile.uk
index ec079dd..5a3a741 100644
--- a/plat/kvm/Makefile.uk
+++ b/plat/kvm/Makefile.uk
@@ -128,6 +128,8 @@ LIBKVMVIRTIO_SRCS-$(CONFIG_VIRTIO_BUS) +=\
 			$(UK_PLAT_DRIVERS_BASE)/virtio/virtio_bus.c
 LIBKVMVIRTIO_SRCS-$(CONFIG_VIRTIO_BUS) +=\
 			$(UK_PLAT_DRIVERS_BASE)/virtio/virtio_ring.c
+			LIBKVMVIRTIO_SRCS-$(CONFIG_VIRTIO_BUS) +=\
+			$(UK_PLAT_DRIVERS_BASE)/virtio/virtio_isr.c|isr
 LIBKVMVIRTIO_SRCS-$(CONFIG_VIRTIO_PCI) +=\
 			$(UK_PLAT_DRIVERS_BASE)/virtio/virtio_pci.c
 ##
-- 
2.25.1



From minios-devel-bounces@lists.xenproject.org Fri Aug 28 09:37:55 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Fri, 28 Aug 2020 09:37:55 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1kBapX-0007Xl-9R; Fri, 28 Aug 2020 09:37:55 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=CR8p=CG=gmail.com=cristianvijelie@srs-us1.protection.inumbo.net>)
 id 1kBapW-0007VD-Fk
 for minios-devel@lists.xen.org; Fri, 28 Aug 2020 09:37:54 +0000
X-Inumbo-ID: 60389f4b-f997-4750-9d6b-25b06fb0aba8
Received: from mail-wr1-x42f.google.com (unknown [2a00:1450:4864:20::42f])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 60389f4b-f997-4750-9d6b-25b06fb0aba8;
 Fri, 28 Aug 2020 09:37:40 +0000 (UTC)
Received: by mail-wr1-x42f.google.com with SMTP id o4so683255wrn.0
 for <minios-devel@lists.xen.org>; Fri, 28 Aug 2020 02:37:40 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=from:to:subject:date:message-id:in-reply-to:references:mime-version
 :content-transfer-encoding;
 bh=vn3eh3I6xH4sp+1lsJimbzvA0eOd5AUHMU9pSxbw+P0=;
 b=UQfHkgUuicSuZ58IAJPDK+3YpBAg/38AnXXSyh+APP5+LXAvpTofYz2op+seXq9QT1
 xCz7PaB43KXurUXlrgBuorDtMItr9KI+GeyK0PR/zb9wPJT0raGRKg/I/kK2KfPw/lPW
 lk4SkZOCsFMWt/O3bBIvECusb6Ok66kf58WODZK0Vb8ItxFiQgs/3Bpm9D7nfKyWXqOS
 y1xYtqIOXjm+Er3cPf535l7i7RzYWzPsImLwbmx8uRb5f0vRR4o938k3UmkkKAsXntY3
 PSqdj43Xtw7XiodelA4ZkpMB+2onnXlr43cLtySQyR3c33lPwp5kk7OgOTs7WphTLk71
 TzHg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to
 :references:mime-version:content-transfer-encoding;
 bh=vn3eh3I6xH4sp+1lsJimbzvA0eOd5AUHMU9pSxbw+P0=;
 b=mmI6oih+YrGNy5t72mkUfWhOtvnK5q19V0i9byE4olKDJj2XRUYuGXNlk78wn/7+6R
 3GHtBUAYC9vBo0jidTi7U+zHe3tNIacF76CzEdRGQMtl3Z38jY/Bd1CCKju/cimDPFCe
 SNc7TGcGVJrLv9BrhNYqJEYhlc6D/kPC7ra8rKH8djA/S1/zibzXkuwvjCQSLy70cwNZ
 x43vXiGFkaKjZ63yiIC/q67baB+D+Pp1cMekFR4jtQ31LR1PfxJiQ2ekM9/uzqDFt38b
 GNIObIkwCVvQfqrum/L+NPWxw7WwPaldi1s/eGXNSyjLMyFZcwdsOB7LlAeFTEw7+Re2
 F6mQ==
X-Gm-Message-State: AOAM533fCzhARpC6VtiWvIZgi32Bl4y9veInOJoN/nDB+up4IuhotlX9
 UPHIp702pSxbYuhwBRWGWai2DwRENOUr9A==
X-Google-Smtp-Source: ABdhPJwIlWbipI2T4dpiJmGexvj6RjOSRnc39BW7LLTyZGYxAugH0diVRh2w7qFu21ixZW7HWMRzig==
X-Received: by 2002:adf:ea0f:: with SMTP id q15mr662845wrm.113.1598607458648; 
 Fri, 28 Aug 2020 02:37:38 -0700 (PDT)
Received: from localhost.localdomain ([2a00:5dc0:ffff:0:78d4:1e02:22e0:26fa])
 by smtp.gmail.com with ESMTPSA id
 b131sm1339100wmc.8.2020.08.28.02.37.37
 for <minios-devel@lists.xen.org>
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Fri, 28 Aug 2020 02:37:37 -0700 (PDT)
From: cristianvijelie@gmail.com
To: minios-devel@lists.xen.org
Subject: [[UNIKRAFT PATCH] v4 1/4] lib/isrlib: Introduce libc-like
 interrupt-context-safe routines
Date: Fri, 28 Aug 2020 12:37:32 +0300
Message-Id: <20200828093735.23895-2-cristianvijelie@gmail.com>
X-Mailer: git-send-email 2.25.1
In-Reply-To: <20200828093735.23895-1-cristianvijelie@gmail.com>
References: <20200828093735.23895-1-cristianvijelie@gmail.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-BeenThere: minios-devel@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Mini-os development list <minios-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:minios-devel@lists.xenproject.org>
List-Help: <mailto:minios-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: minios-devel-bounces@lists.xenproject.org
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>

From: Cristian Vijelie <cristianvijelie@gmail.com>

libisr library means to introduce interrupt-context-safe routines, 
to be used in interrupt handlers and drivers. It is derived from nolibc.

This patch merges 2 previous patches, also fixing one error that prevented build.

Signed-off-by: Cristian Vijelie <cristianvijelie@gmail.com>
---
 include/uk/isr/stdlib.h |  63 ++++++
 include/uk/isr/string.h |  72 +++++++
 lib/isrlib/Config.uk    |   3 +
 lib/isrlib/Makefile.uk  |  10 +
 lib/isrlib/qsort.c      | 157 +++++++++++++++
 lib/isrlib/stdlib.c     | 417 ++++++++++++++++++++++++++++++++++++++++
 lib/isrlib/string.c     | 325 +++++++++++++++++++++++++++++++
 7 files changed, 1047 insertions(+)
 create mode 100644 include/uk/isr/stdlib.h
 create mode 100644 include/uk/isr/string.h
 create mode 100644 lib/isrlib/Config.uk
 create mode 100644 lib/isrlib/Makefile.uk
 create mode 100644 lib/isrlib/qsort.c
 create mode 100644 lib/isrlib/stdlib.c
 create mode 100644 lib/isrlib/string.c

diff --git a/include/uk/isr/stdlib.h b/include/uk/isr/stdlib.h
new file mode 100644
index 0000000..30eb443
--- /dev/null
+++ b/include/uk/isr/stdlib.h
@@ -0,0 +1,63 @@
+/* SPDX-License-Identifier: BSD-2-Clause */
+/*
+ * Copyright (c) 2009 Citrix Systems, Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#ifndef __UK_ISR_STDLIB_H__
+#define __UK_ISR_STDLIB_H__
+
+#include <stdlib.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * Convert a string to an unsigned long integer.
+ * Ignores `locale' stuff.  Assumes that the upper and lower case
+ * alphabets and digits are each contiguous.
+ *
+ * @nptr:   The start of the string
+ * @endptr: A pointer to the end of the parsed string will be placed here
+ * @base:   The number base to use
+ */
+long strtol_isr(const char *nptr, char **endptr, int base);
+unsigned long strtoul_isr(const char *nptr, char **endptr, int base);
+long long strtoll_isr(const char *nptr, char **endptr, int base);
+unsigned long long strtoull_isr(const char *nptr, char **endptr, int base);
+
+/**
+ * Convert a string to an integer
+ * @s: The start of the string
+ */
+int atoi_isr(const char *s);
+
+void qsort_isr(void *base, size_t nmemb, size_t size,
+           int (*compar)(const void *, const void *));
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __UK_ISR_STDLIB_H__ */
diff --git a/include/uk/isr/string.h b/include/uk/isr/string.h
new file mode 100644
index 0000000..bcf9fef
--- /dev/null
+++ b/include/uk/isr/string.h
@@ -0,0 +1,72 @@
+/* SPDX-License-Identifier: BSD-3-Clause */
+/*
+ * Authors: Simon Kuenzer <simon.kuenzer@neclab.eu>
+ *          Cristian Vijelie <cristianvijelie@gmail.com>
+ *
+ *
+ * Copyright (c) 2017, NEC Europe Ltd., NEC Corporation. All rights reserved.
+ * Copyright (c) 2020, University Politehnica of Bucharest. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the copyright holder nor the names of its
+ *    contributors may be used to endorse or promote products derived from
+ *    this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+#ifndef __UK_ISR_STRING_H__
+#define __UK_ISR_STRING_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <string.h>
+
+void *memcpy_isr(void *dst, const void *src, size_t len);
+void *memset_isr(void *ptr, int val, size_t len);
+void *memchr_isr(const void *ptr, int val, size_t len);
+void *memrchr_isr(const void *m, int c, size_t n);
+int memcmp_isr(const void *ptr1, const void *ptr2, size_t len);
+void *memmove_isr(void *dst, const void *src, size_t len);
+
+char *strncpy_isr(char *dst, const char *src, size_t len);
+char *strcpy_isr(char *dst, const char *src);
+size_t strlcpy_isr(char *d, const char *s, size_t n);
+size_t strlcat_isr(char *d, const char *s, size_t n);
+size_t strnlen_isr(const char *str, size_t maxlen);
+size_t strlen_isr(const char *str);
+char *strchrnul_isr(const char *s, int c);
+char *strchr_isr(const char *str, int c);
+char *strrchr_isr(const char *s, int c);
+int strncmp_isr(const char *str1, const char *str2, size_t len);
+int strcmp_isr(const char *str1, const char *str2);
+size_t strcspn_isr(const char *s, const char *c);
+size_t strspn_isr(const char *s, const char *c);
+char *strtok_isr(char *restrict s, const char *restrict sep, char **restrict p);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __UK_ISR_STRING_H__ */
diff --git a/lib/isrlib/Config.uk b/lib/isrlib/Config.uk
new file mode 100644
index 0000000..60b4274
--- /dev/null
+++ b/lib/isrlib/Config.uk
@@ -0,0 +1,3 @@
+config LIBISRLIB
+    bool "isrlib: ISR helper library"
+    default n
diff --git a/lib/isrlib/Makefile.uk b/lib/isrlib/Makefile.uk
new file mode 100644
index 0000000..9b60e04
--- /dev/null
+++ b/lib/isrlib/Makefile.uk
@@ -0,0 +1,10 @@
+$(eval $(call addlib_s,libisrlib,$(CONFIG_LIBISRLIB)))
+
+LIBISRLIB_GLOBAL_INCLUDES-y = $(LIBISRLIB_BASE)/include
+
+CINCLUDES-$(CONFIG_LIBISRLIB) += $(LIBISRLIB_GLOBAL_INCLUDES)
+CXXINCLUDES-$(CONFIG_LIBISRLIB) += $(LIBISRLIB_GLOBAL_INCLUDES)
+
+LIBISRLIB_SRCS-y += $(LIBISRLIB_BASE)/string.c|isr
+LIBISRLIB_SRCS-y += $(LIBISRLIB_BASE)/stdlib.c|isr
+LIBISRLIB_SRCS-y += $(LIBISRLIB_BASE)/qsort.c|isr
diff --git a/lib/isrlib/qsort.c b/lib/isrlib/qsort.c
new file mode 100644
index 0000000..418e217
--- /dev/null
+++ b/lib/isrlib/qsort.c
@@ -0,0 +1,157 @@
+/*	$OpenBSD: qsort.c,v 1.10 2005/08/08 08:05:37 espie Exp $ */
+/*-
+ * Copyright (c) 1992, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+#include <sys/types.h>
+#include <uk/isr/stdlib.h>
+static inline char	*med3_isr(char *, char *, char *, int (*)
+				(const void *, const void *));
+static inline void	 swapfunc_isr(char *, char *, int, int);
+#define min(a, b)	((a) < (b) ? a : b)
+/*
+ * Qsort routine from Bentley & McIlroy's "Engineering a Sort Function".
+ */
+#define swapcode(TYPE, parmi, parmj, n) {		\
+	long i = (n) / sizeof(TYPE);			\
+	TYPE *pi = (TYPE *) (parmi);			\
+	TYPE *pj = (TYPE *) (parmj);			\
+	do {						\
+		TYPE	t = *pi;			\
+		*pi++ = *pj;				\
+		*pj++ = t;				\
+	} while (--i > 0);				\
+}
+#define SWAPINIT(a, es) (swaptype = ((char *)a - (char *)0) % sizeof(long) || \
+	es % sizeof(long) ? 2 : es == sizeof(long) ? 0 : 1)
+static inline void
+swapfunc_isr(char *a, char *b, int n, int swaptype)
+{
+	if (swaptype <= 1)
+		swapcode(long, a, b, n)
+	else
+		swapcode(char, a, b, n)
+}
+#define swap(a, b)					\
+	do {						\
+		if (swaptype == 0) {				\
+			long t = *(long *)(a);			\
+			*(long *)(a) = *(long *)(b);		\
+			*(long *)(b) = t;			\
+		} else						\
+			swapfunc_isr(a, b, es, swaptype);		\
+	} while (0)
+
+#define vecswap(a, b, n)					\
+	do {							\
+		if ((n) > 0)					\
+			swapfunc_isr(a, b, n, swaptype);		\
+	} while (0)
+static inline char *
+med3_isr(char *a, char *b, char *c, int (*cmp)(const void *, const void *))
+{
+	return cmp(a, b) < 0 ?
+		(cmp(b, c) < 0 ? b : (cmp(a, c) < 0 ? c : a))
+		: (cmp(b, c) > 0 ? b : (cmp(a, c) < 0 ? a : c));
+}
+void
+qsort_isr(void *aa, size_t n, size_t es, int (*cmp)(const void *, const void *))
+{
+	char *pa, *pb, *pc, *pd, *pl, *pm, *pn;
+	int d, r, swaptype, swap_cnt;
+	char *a = aa;
+loop:
+	SWAPINIT(a, es);
+	swap_cnt = 0;
+	if (n < 7) {
+		for (pm = (char *)a + es; pm < (char *) a + n * es; pm += es)
+			for (pl = pm; pl > (char *) a && cmp(pl - es, pl) > 0;
+			     pl -= es)
+				swap(pl, pl - es);
+		return;
+	}
+	pm = (char *)a + (n / 2) * es;
+	if (n > 7) {
+		pl = (char *)a;
+		pn = (char *)a + (n - 1) * es;
+		if (n > 40) {
+			d = (n / 8) * es;
+			pl = med3_isr(pl, pl + d, pl + 2 * d, cmp);
+			pm = med3_isr(pm - d, pm, pm + d, cmp);
+			pn = med3_isr(pn - 2 * d, pn - d, pn, cmp);
+		}
+		pm = med3_isr(pl, pm, pn, cmp);
+	}
+	swap(a, pm);
+	pa = pb = (char *)a + es;
+
+	pc = pd = (char *)a + (n - 1) * es;
+	for (;;) {
+		while (pb <= pc && (r = cmp(pb, a)) <= 0) {
+			if (r == 0) {
+				swap_cnt = 1;
+				swap(pa, pb);
+				pa += es;
+			}
+			pb += es;
+		}
+		while (pb <= pc && (r = cmp(pc, a)) >= 0) {
+			if (r == 0) {
+				swap_cnt = 1;
+				swap(pc, pd);
+				pd -= es;
+			}
+			pc -= es;
+		}
+		if (pb > pc)
+			break;
+		swap(pb, pc);
+		swap_cnt = 1;
+		pb += es;
+		pc -= es;
+	}
+	if (swap_cnt == 0) {  /* Switch to insertion sort */
+		for (pm = (char *) a + es; pm < (char *) a + n * es; pm += es)
+			for (pl = pm; pl > (char *) a && cmp(pl - es, pl) > 0;
+			     pl -= es)
+				swap(pl, pl - es);
+		return;
+	}
+	pn = (char *)a + n * es;
+	r = min(pa - (char *)a, pb - pa);
+	vecswap(a, pb - r, r);
+	r = min(pd - pc, pn - pd - (int)es);
+	vecswap(pb, pn - r, r);
+	if ((r = pb - pa) > (int)es)
+		qsort_isr(a, r / es, es, cmp);
+	if ((r = pd - pc) > (int)es) {
+		/* Iterate rather than recurse to save stack space */
+		a = pn - r;
+		n = r / es;
+		goto loop;
+	}
+}
diff --git a/lib/isrlib/stdlib.c b/lib/isrlib/stdlib.c
new file mode 100644
index 0000000..d1aad75
--- /dev/null
+++ b/lib/isrlib/stdlib.c
@@ -0,0 +1,417 @@
+/* SPDX-License-Identifier: BSD-3-Clause */
+/*
+ ****************************************************************************
+ *
+ *        File: printf.c
+ *      Author: Juergen Gross <jgross@suse.com>
+ *
+ *        Date: Jun 2016
+ *
+ * Environment: Xen Minimal OS
+ * Description: Library functions for printing
+ *              (FreeBSD port)
+ *
+ ****************************************************************************
+ */
+
+/*-
+ * Copyright (c) 1990, 1993
+ * The Regents of the University of California.  All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Chris Torek.
+ *
+ * Copyright (c) 2011 The FreeBSD Foundation
+ * All rights reserved.
+ * Portions of this software were developed by David Chisnall
+ * under sponsorship from the FreeBSD Foundation.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <errno.h>
+#include <stdint.h>
+#include <stdlib.h>
+#include <limits.h>
+#include <ctype.h>
+#include <uk/print.h>
+#include <uk/plat/bootstrap.h>
+#include <uk/arch/limits.h>
+
+#define __DECONST(type, var) ((type)(uintptr_t)(const void *)(var))
+
+/*
+ * Convert a string to an unsigned long integer.
+ *
+ * Ignores `locale' stuff.  Assumes that the upper and lower case
+ * alphabets and digits are each contiguous.
+ */
+unsigned long strtoul_isr(const char *nptr, char **endptr, int base)
+{
+	const char *s = nptr;
+	unsigned long acc;
+	unsigned char c;
+	unsigned long cutoff;
+	int neg = 0, any, cutlim;
+
+	if (base < 0 || base == 1 || base > 36) {
+		errno = -EINVAL;
+		any = 0;
+		acc = 0;
+		goto exit;
+	}
+
+	/*
+	 * See strtol for comments as to the logic used.
+	 */
+	do {
+		c = *s++;
+	} while (isspace(c));
+	if (c == '-') {
+		neg = 1;
+		c = *s++;
+	} else if (c == '+')
+		c = *s++;
+	if ((base == 0 || base == 16) && c == '0' && (*s == 'x' || *s == 'X')) {
+		c = s[1];
+		s += 2;
+		base = 16;
+	}
+	if (base == 0)
+		base = c == '0' ? 8 : 10;
+	cutoff = (unsigned long)ULONG_MAX / (unsigned long)base;
+	cutlim = (unsigned long)ULONG_MAX % (unsigned long)base;
+	for (acc = 0, any = 0;; c = *s++) {
+		if (!isascii(c))
+			break;
+		if (isdigit(c))
+			c -= '0';
+		else if (isalpha(c))
+			c -= isupper(c) ? 'A' - 10 : 'a' - 10;
+		else
+			break;
+		if (c >= base)
+			break;
+		if (any < 0 || acc > cutoff || (acc == cutoff && c > cutlim))
+			any = -1;
+		else {
+			any = 1;
+			acc *= base;
+			acc += c;
+		}
+	}
+	if (any < 0) {
+		acc = ULONG_MAX;
+		errno = ERANGE;
+	} else if (neg)
+		acc = -acc;
+exit:
+	if (endptr != 0)
+		*endptr = __DECONST(char *, any ? s - 1 : nptr);
+	return acc;
+}
+
+long strtol_isr(const char *nptr, char **endptr, int base)
+{
+	const char *s;
+	unsigned long acc;
+	unsigned char c;
+	unsigned long qbase, cutoff;
+	int neg, any, cutlim;
+
+	s = nptr;
+	if (base < 0 || base == 1 || base > 36) {
+		errno = -EINVAL;
+		any = 0;
+		acc = 0;
+		goto exit;
+	}
+
+	/*
+	 * Skip white space and pick up leading +/- sign if any.
+	 * If base is 0, allow 0x for hex and 0 for octal, else
+	 * assume decimal; if base is already 16, allow 0x.
+	 */
+	do {
+		c = *s++;
+	} while (isspace(c));
+	if (c == '-') {
+		neg = 1;
+		c = *s++;
+	} else {
+		neg = 0;
+		if (c == '+')
+			c = *s++;
+	}
+	if ((base == 0 || base == 16) && c == '0' && (*s == 'x' || *s == 'X')) {
+		c = s[1];
+		s += 2;
+		base = 16;
+	}
+	if (base == 0)
+		base = c == '0' ? 8 : 10;
+
+	/*
+	 * Compute the cutoff value between legal numbers and illegal
+	 * numbers.  That is the largest legal value, divided by the
+	 * base.  An input number that is greater than this value, if
+	 * followed by a legal input character, is too big.  One that
+	 * is equal to this value may be valid or not; the limit
+	 * between valid and invalid numbers is then based on the last
+	 * digit.  For instance, if the range for quads is
+	 * [-2147483648..2147483647] and the input base
+	 * is 10, cutoff will be set to 2147483647 and cutlim to
+	 * either 7 (neg==0) or 8 (neg==1), meaning that if we have
+	 * accumulated a value > 2147483647, or equal but the
+	 * next digit is > 7 (or 8), the number is too big, and we will
+	 * return a range error.
+	 *
+	 * Set any if any `digits' consumed; make it negative to indicate
+	 * overflow.
+	 */
+	qbase = (unsigned int)base;
+	cutoff = neg
+		     ? (unsigned long)LONG_MAX
+			   - (unsigned long)(LONG_MIN + LONG_MAX)
+		     : LONG_MAX;
+	cutlim = cutoff % qbase;
+	cutoff /= qbase;
+	for (acc = 0, any = 0;; c = *s++) {
+		if (!isascii(c))
+			break;
+		if (isdigit(c))
+			c -= '0';
+		else if (isalpha(c))
+			c -= isupper(c) ? 'A' - 10 : 'a' - 10;
+		else
+			break;
+		if (c >= base)
+			break;
+		if (any < 0 || acc > cutoff || (acc == cutoff && c > cutlim))
+			any = -1;
+		else {
+			any = 1;
+			acc *= qbase;
+			acc += c;
+		}
+	}
+	if (any < 0) {
+		acc = neg ? LONG_MIN : LONG_MAX;
+		errno = ERANGE;
+	} else if (neg)
+		acc = -acc;
+
+exit:
+	if (endptr != 0)
+		*endptr = __DECONST(char *, any ? s - 1 : nptr);
+	return acc;
+}
+
+/*
+ * Convert a string to a long long integer.
+ *
+ * Ignores `locale' stuff.  Assumes that the upper and lower case
+ * alphabets and digits are each contiguous.
+ */
+long long strtoll_isr(const char *nptr, char **endptr, int base)
+{
+	const char *s;
+	unsigned long long acc;
+	unsigned char c;
+	unsigned long long qbase, cutoff;
+	int neg, any, cutlim;
+
+	s = nptr;
+	if (base < 0 || base == 1 || base > 36) {
+		errno = -EINVAL;
+		any = 0;
+		acc = 0;
+		goto exit;
+	}
+	/*
+	 * Skip white space and pick up leading +/- sign if any.
+	 * If base is 0, allow 0x for hex and 0 for octal, else
+	 * assume decimal; if base is already 16, allow 0x.
+	 */
+	do {
+		c = *s++;
+	} while (isspace(c));
+	if (c == '-') {
+		neg = 1;
+		c = *s++;
+	} else {
+		neg = 0;
+		if (c == '+')
+			c = *s++;
+	}
+	if ((base == 0 || base == 16) && c == '0' && (*s == 'x' || *s == 'X')) {
+		c = s[1];
+		s += 2;
+		base = 16;
+	}
+	if (base == 0)
+		base = c == '0' ? 8 : 10;
+
+	/*
+	 * Compute the cutoff value between legal numbers and illegal
+	 * numbers.  That is the largest legal value, divided by the
+	 * base.  An input number that is greater than this value, if
+	 * followed by a legal input character, is too big.  One that
+	 * is equal to this value may be valid or not; the limit
+	 * between valid and invalid numbers is then based on the last
+	 * digit.  For instance, if the range for quads is
+	 * [-9223372036854775808..9223372036854775807] and the input base
+	 * is 10, cutoff will be set to 922337203685477580 and cutlim to
+	 * either 7 (neg==0) or 8 (neg==1), meaning that if we have
+	 * accumulated a value > 922337203685477580, or equal but the
+	 * next digit is > 7 (or 8), the number is too big, and we will
+	 * return a range error.
+	 *
+	 * Set any if any `digits' consumed; make it negative to indicate
+	 * overflow.
+	 */
+	qbase = (unsigned int)base;
+	cutoff = neg
+		     ? (unsigned long long)LLONG_MAX
+			   - (unsigned long long)(LLONG_MIN + LLONG_MAX)
+		     : LLONG_MAX;
+	cutlim = cutoff % qbase;
+	cutoff /= qbase;
+	for (acc = 0, any = 0;; c = *s++) {
+		if (!isascii(c))
+			break;
+		if (isdigit(c))
+			c -= '0';
+		else if (isalpha(c))
+			c -= isupper(c) ? 'A' - 10 : 'a' - 10;
+		else
+			break;
+		if (c >= base)
+			break;
+		if (any < 0 || acc > cutoff || (acc == cutoff && c > cutlim))
+			any = -1;
+		else {
+			any = 1;
+			acc *= qbase;
+			acc += c;
+		}
+	}
+	if (any < 0) {
+		errno = ERANGE;
+		acc = neg ? LLONG_MIN : LLONG_MAX;
+	} else if (neg)
+		acc = -acc;
+
+exit:
+	if (endptr != 0)
+		*endptr = __DECONST(char *, any ? s - 1 : nptr);
+	return acc;
+}
+
+/*
+ * Convert a string to an unsigned long long integer.
+ *
+ * Ignores `locale' stuff.  Assumes that the upper and lower case
+ * alphabets and digits are each contiguous.
+ */
+unsigned long long strtoull_isr(const char *nptr, char **endptr, int base)
+{
+	const char *s = nptr;
+	unsigned long long acc;
+	unsigned char c;
+	unsigned long long qbase, cutoff;
+	int neg, any, cutlim;
+
+	if (base < 0 || base == 1 || base > 36) {
+		errno = -EINVAL;
+		any = 0;
+		acc = 0;
+		goto exit;
+	}
+	/*
+	 * See strtoq for comments as to the logic used.
+	 */
+	do {
+		c = *s++;
+	} while (isspace(c));
+	if (c == '-') {
+		neg = 1;
+		c = *s++;
+	} else {
+		neg = 0;
+		if (c == '+')
+			c = *s++;
+	}
+	if ((base == 0 || base == 16) && c == '0' && (*s == 'x' || *s == 'X')) {
+		c = s[1];
+		s += 2;
+		base = 16;
+	}
+	if (base == 0)
+		base = c == '0' ? 8 : 10;
+	qbase = (unsigned int)base;
+	cutoff = (unsigned long long)ULLONG_MAX / qbase;
+	cutlim = (unsigned long long)ULLONG_MAX % qbase;
+	for (acc = 0, any = 0;; c = *s++) {
+		if (!isascii(c))
+			break;
+		if (isdigit(c))
+			c -= '0';
+		else if (isalpha(c))
+			c -= isupper(c) ? 'A' - 10 : 'a' - 10;
+		else
+			break;
+		if (c >= base)
+			break;
+		if (any < 0 || acc > cutoff || (acc == cutoff && c > cutlim))
+			any = -1;
+		else {
+			any = 1;
+			acc *= qbase;
+			acc += c;
+		}
+	}
+	if (any < 0) {
+		errno = ERANGE;
+		acc = ULLONG_MAX;
+	} else if (neg)
+		acc = -acc;
+
+exit:
+	if (endptr != 0)
+		*endptr = __DECONST(char *, any ? s - 1 : nptr);
+	return acc;
+}
+
+int atoi_isr(const char *s)
+{
+	long long atoll;
+
+	atoll = strtoll_isr(s, NULL, 10);
+	atoll = (atoll > __I_MAX) ? __I_MAX : atoll;
+	atoll = (atoll < __I_MIN) ? __I_MIN : atoll;
+
+	return (int) atoll;
+}
diff --git a/lib/isrlib/string.c b/lib/isrlib/string.c
new file mode 100644
index 0000000..d599294
--- /dev/null
+++ b/lib/isrlib/string.c
@@ -0,0 +1,325 @@
+/* SPDX-License-Identifier: BSD-3-Clause AND MIT */
+/*
+ * Authors: Simon Kuenzer <simon.kuenzer@neclab.eu>
+ * Authors: Cristian Vijelie <cristianvijelie@gmail.com>
+ *
+ * Copyright (c) 2017, NEC Europe Ltd., NEC Corporation. All rights reserved.
+ * Copyright (c) 2020, University Politehnica of Bucharest. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the copyright holder nor the names of its
+ *    contributors may be used to endorse or promote products derived from
+ *    this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+/* For the parts taken from musl (marked as such below), the MIT licence
+ * applies instead:
+ * ----------------------------------------------------------------------
+ * Copyright (c) 2005-2014 Rich Felker, et al.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ * ----------------------------------------------------------------------
+ */
+
+#include <uk/isr/string.h>
+#include <uk/arch/types.h>
+#include <stdint.h>
+#include <limits.h>
+
+void *memcpy_isr(void *dst, const void *src, size_t len)
+{
+	size_t p;
+
+	for (p = 0; p < len; ++p)
+		*((__u8 *)(((__uptr)dst) + p)) = *((__u8 *)(((__uptr)src) + p));
+
+	return dst;
+}
+
+void *memset_isr(void *ptr, int val, size_t len)
+{
+	__u8 *p = (__u8 *) ptr;
+
+	for (; len > 0; --len)
+		*(p++) = (__u8)val;
+
+	return ptr;
+}
+
+void *memchr_isr(const void *ptr, int val, size_t len)
+{
+	uintptr_t o = 0;
+
+	for (o = 0; o < (uintptr_t)len; ++o)
+		if (*((const uint8_t *)(((uintptr_t)ptr) + o)) == (uint8_t)val)
+			return (void *)((uintptr_t)ptr + o);
+
+	return NULL; /* did not find val */
+}
+
+void *memrchr_isr(const void *m, int c, size_t n)
+{
+	const unsigned char *s = m;
+
+	c = (unsigned char) c;
+	while (n--)
+		if (s[n] == c)
+			return (void *) (s + n);
+	return 0;
+}
+
+void *memmove_isr(void *dst, const void *src, size_t len)
+{
+	uint8_t *d = dst;
+	const uint8_t *s = src;
+
+	if (src > dst) {
+		for (; len > 0; --len)
+			*(d++) = *(s++);
+	} else {
+		s += len;
+		d += len;
+
+		for (; len > 0; --len)
+			*(d--) = *(s--);
+	}
+
+	return dst;
+}
+
+int memcmp_isr(const void *ptr1, const void *ptr2, size_t len)
+{
+	const unsigned char *c1 = (const unsigned char *)ptr1;
+	const unsigned char *c2 = (const unsigned char *)ptr2;
+
+	for (; len > 0; --len, ++c1, ++c2) {
+		if ((*c1) != (*c2))
+			return ((*c1) - (*c2));
+	}
+
+	return 0;
+}
+
+size_t strlen_isr(const char *str)
+{
+	return strnlen_isr(str, SIZE_MAX);
+}
+
+size_t strnlen_isr(const char *str, size_t len)
+{
+	const char *p = memchr_isr(str, 0, len);
+	return p ? (size_t) (p - str) : len;
+}
+
+char *strncpy_isr(char *dst, const char *src, size_t len)
+{
+	size_t clen;
+
+	clen = strnlen_isr(src, len);
+	memcpy_isr(dst, src, clen);
+
+	/* instead of filling up the rest of left space with zeros,
+	 * append a termination character if we did not copy one
+	 */
+	if (clen < len && dst[clen - 1] != '\0')
+		dst[clen] = '\0';
+	return dst;
+}
+
+char *strcpy_isr(char *dst, const char *src)
+{
+	return strncpy_isr(dst, src, SIZE_MAX);
+}
+
+int strncmp_isr(const char *str1, const char *str2, size_t len)
+{
+	const char *c1 = (const char *)str1;
+	const char *c2 = (const char *)str2;
+
+	for (; len > 0; --len, ++c1, ++c2) {
+		if ((*c1) != (*c2))
+			return (int)((*c1) - (*c2));
+		if ((*c1) == '\0')
+			break;
+	}
+	return 0;
+}
+
+int strcmp_isr(const char *str1, const char *str2)
+{
+	register signed char __res;
+
+	while ((__res = *str1 - *str2++) == 0 && *str1++)
+		;
+
+	return __res;
+}
+
+/* The following code is taken from musl libc */
+#define ALIGN (sizeof(size_t))
+#define ONES ((size_t) -1 / UCHAR_MAX)
+#define HIGHS (ONES * (UCHAR_MAX / 2 + 1))
+#define HASZERO(x) (((x) - ONES) & ~(x) & HIGHS)
+#define BITOP(a, b, op) \
+		((a)[(size_t)(b) / (8*sizeof *(a))] op \
+		(size_t)1 << ((size_t)(b) % (8 * sizeof *(a))))
+
+char *strchrnul_isr(const char *s, int c)
+{
+	size_t *w, k;
+
+	c = (unsigned char)c;
+	if (!c)
+		return (char *)s + strlen_isr(s);
+
+	for (; (uintptr_t)s % ALIGN; s++)
+		if (!*s || *(unsigned char *)s == c)
+			return (char *)s;
+	k = ONES * c;
+	for (w = (void *)s; !HASZERO(*w) && !HASZERO(*w ^ k); w++)
+		;
+	for (s = (void *)w; *s && *(unsigned char *)s != c; s++)
+		;
+	return (char *)s;
+}
+
+char *strchr_isr(const char *str, int c)
+{
+	char *r = strchrnul_isr(str, c);
+	return *(unsigned char *)r == (unsigned char)c ? r : 0;
+}
+
+char *strrchr_isr(const char *s, int c)
+{
+	return memrchr_isr(s, c, strlen_isr(s) + 1);
+}
+
+size_t strcspn_isr(const char *s, const char *c)
+{
+	const char *a = s;
+	size_t byteset[32 / sizeof(size_t)];
+
+	if (!c[0] || !c[1])
+		return strchrnul_isr(s, *c)-a;
+
+	memset_isr(byteset, 0, sizeof(byteset));
+	for (; *c && BITOP(byteset, *(unsigned char *)c, |=); c++)
+		;
+	for (; *s && !BITOP(byteset, *(unsigned char *)s, &); s++)
+		;
+	return s-a;
+}
+
+size_t strspn_isr(const char *s, const char *c)
+{
+	const char *a = s;
+	size_t byteset[32 / sizeof(size_t)] = { 0 };
+
+	if (!c[0])
+		return 0;
+	if (!c[1]) {
+		for (; *s == *c; s++)
+			;
+		return s-a;
+	}
+
+	for (; *c && BITOP(byteset, *(unsigned char *)c, |=); c++)
+		;
+	for (; *s && BITOP(byteset, *(unsigned char *)s, &); s++)
+		;
+	return s-a;
+}
+
+char *strtok_isr(char *restrict s, const char *restrict sep, char **restrict p)
+{
+	if (!s && !(s = *p))
+		return NULL;
+	s += strspn_isr(s, sep);
+	if (!*s)
+		return *p = 0;
+	*p = s + strcspn_isr(s, sep);
+	if (**p)
+		*(*p)++ = 0;
+	else
+		*p = 0;
+	return s;
+}
+
+/* strlcpy has different ALIGN */
+#undef ALIGN
+#define ALIGN (sizeof(size_t)-1)
+size_t strlcpy_isr(char *d, const char *s, size_t n)
+{
+	char *d0 = d;
+	size_t *wd;
+	const size_t *ws;
+
+	if (!n--)
+		goto finish;
+
+	if (((uintptr_t)s & ALIGN) == ((uintptr_t)d & ALIGN)) {
+		for (; ((uintptr_t) s & ALIGN) && n && (*d = *s);
+		     n--, s++, d++)
+			;
+
+		if (n && *s) {
+			wd = (void *)d; ws = (const void *)s;
+			for (; n >= sizeof(size_t) && !HASZERO(*ws);
+			     n -= sizeof(size_t), ws++, wd++)
+				*wd = *ws;
+
+			d = (void *)wd; s = (const void *)ws;
+		}
+	}
+
+	for (; n && (*d = *s); n--, s++, d++)
+		;
+	*d = 0;
+finish:
+	return d-d0 + strlen_isr(s);
+}
+
+size_t strlcat_isr(char *d, const char *s, size_t n)
+{
+	size_t l = strnlen_isr(d, n);
+	if (l == n)
+		return l + strlen_isr(s);
+	return l + strlcpy_isr(d+l, s, n-l);
+}
-- 
2.25.1



From minios-devel-bounces@lists.xenproject.org Fri Aug 28 09:38:00 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Fri, 28 Aug 2020 09:38:00 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1kBapc-0007Ym-Ca; Fri, 28 Aug 2020 09:38:00 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=CR8p=CG=gmail.com=cristianvijelie@srs-us1.protection.inumbo.net>)
 id 1kBapb-0007VD-Fy
 for minios-devel@lists.xen.org; Fri, 28 Aug 2020 09:37:59 +0000
X-Inumbo-ID: c74b8d6a-99ce-4aec-b68e-4437c820b993
Received: from mail-wr1-x444.google.com (unknown [2a00:1450:4864:20::444])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id c74b8d6a-99ce-4aec-b68e-4437c820b993;
 Fri, 28 Aug 2020 09:37:43 +0000 (UTC)
Received: by mail-wr1-x444.google.com with SMTP id x7so670566wro.3
 for <minios-devel@lists.xen.org>; Fri, 28 Aug 2020 02:37:43 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=from:to:subject:date:message-id:in-reply-to:references:mime-version
 :content-transfer-encoding;
 bh=x67tDMVQYsppt8OOBfqtOCTsQUa1cGBAwyrV5sE0ye4=;
 b=k5lsOCL/f1uFuuhnNd+uYWz6ZT+pUt5P5jsiY0OEAHljYLKNCbTL/Vg3ONBFpW24VO
 c8ml8XIBxtmgTLh/lxx559ApqPK0ETZLeM1P0NlILjwp06doImj6Qasn31nRM9Otgyhs
 dgF9+0HyL6Tn8Uoide48o9v5dHwVi5rnZeJeH2ZOfIyyHd+Q8/BTOAkurnyO5R3vVDDh
 q9gZ1hAworQ5ahhXLKlNLNGrTU0aaT85LpY4EvF67Ka79JS2m4UiFMzVU/ddkHfzPI/9
 DohXDYeAdShm/zzLHVIgbE9x1M5pEfFo4RVk35UN5ZPpTRvBrW9O27Gin7SqZqCETm1o
 WcJQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to
 :references:mime-version:content-transfer-encoding;
 bh=x67tDMVQYsppt8OOBfqtOCTsQUa1cGBAwyrV5sE0ye4=;
 b=iabr8uBEzea9cX0NCNXL+TkLqF7acwxjmYHLMwTwRzjrT5t2LMGuZbuVXowK+kot9C
 TJHYtSeJn46oVt4CiWIfw39JVZTu9mB3qp8lOwUdYKWkqF+Z/pzLNRTq8ySd8b/VUVcE
 9ATVJytRk67ikUqXQBpRYNsAUbRoEgSYF8DUb9o9S6sqBReMzKDU9QRSmDX/3mZdCk4j
 mdGBZbHUDEPJLdFfxwLLrE43eORqdKth4dYAbtPFS3F2VlF9Us5X+NDDdWxMA0Z6xiCN
 4dIoV/KCtIW8mAanSOxETrWj67rvJiuvzI6PSEG4A01L6GjcG6S1p7FyjTBEEu2CArZH
 XL/Q==
X-Gm-Message-State: AOAM532bB87Fl6AFQlNaNYSMC9Cn3tI1ouv3RdvUcPG5NkKwNvn8ShVe
 rDAohVX3Au6UflgoZXhNP7TTWajY1ir5yA==
X-Google-Smtp-Source: ABdhPJxN65unxjuPcWWo5syDB1387cnCx90XQR6VfTlZMcG6t3FDsGau+rZNWYBsv/GQZ3nLcM2kLw==
X-Received: by 2002:adf:fd91:: with SMTP id d17mr672111wrr.234.1598607461887; 
 Fri, 28 Aug 2020 02:37:41 -0700 (PDT)
Received: from localhost.localdomain ([2a00:5dc0:ffff:0:78d4:1e02:22e0:26fa])
 by smtp.gmail.com with ESMTPSA id
 b131sm1339100wmc.8.2020.08.28.02.37.40
 for <minios-devel@lists.xen.org>
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Fri, 28 Aug 2020 02:37:41 -0700 (PDT)
From: cristianvijelie@gmail.com
To: minios-devel@lists.xen.org
Subject: [[UNIKRAFT PATCH] v4 4/4] plat/xen: Made xen event handler
 interrupt-context-safe
Date: Fri, 28 Aug 2020 12:37:35 +0300
Message-Id: <20200828093735.23895-5-cristianvijelie@gmail.com>
X-Mailer: git-send-email 2.25.1
In-Reply-To: <20200828093735.23895-1-cristianvijelie@gmail.com>
References: <20200828093735.23895-1-cristianvijelie@gmail.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-BeenThere: minios-devel@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Mini-os development list <minios-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:minios-devel@lists.xenproject.org>
List-Help: <mailto:minios-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: minios-devel-bounces@lists.xenproject.org
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>

From: Cristian Vijelie <cristianvijelie@gmail.com>

I have moved 'do_event' function into a separate source file, 'isr.c' 
along with another function, which is called by 'do_event',
'clear_eventchn'. I also added a header file 'internal/isr.h', which
contains definitions needed in both events.c and the newlycreated
source file.

Signed-off-by: Cristian Vijelie <cristianvijelie@gmail.com>
---
 plat/xen/Makefile.uk    |  1 +
 plat/xen/events.c       | 49 ++------------------------------
 plat/xen/internal/isr.h | 51 +++++++++++++++++++++++++++++++++
 plat/xen/isr.c          | 63 +++++++++++++++++++++++++++++++++++++++++
 4 files changed, 117 insertions(+), 47 deletions(-)
 create mode 100644 plat/xen/internal/isr.h
 create mode 100644 plat/xen/isr.c

diff --git a/plat/xen/Makefile.uk b/plat/xen/Makefile.uk
index 2a8cdbf..c6e5a05 100644
--- a/plat/xen/Makefile.uk
+++ b/plat/xen/Makefile.uk
@@ -94,6 +94,7 @@ LIBXENPLAT_SRCS-y              += $(LIBXENPLAT_BASE)/emg_console.c
 endif
 LIBXENPLAT_SRCS-y              += $(LIBXENPLAT_BASE)/shutdown.c
 LIBXENPLAT_SRCS-y              += $(LIBXENPLAT_BASE)/events.c
+LIBXENPLAT_SRCS-y              += $(LIBXENPLAT_BASE)/isr.c|isr
 
 ifeq ($(CONFIG_XEN_GNTTAB),y)
 LIBXENPLAT_SRCS-y              += $(LIBXENPLAT_BASE)/gnttab.c
diff --git a/plat/xen/events.c b/plat/xen/events.c
index 3a1d155..bf9707d 100644
--- a/plat/xen/events.c
+++ b/plat/xen/events.c
@@ -32,24 +32,10 @@
  * Deals with events received on event channels
  * Ported from Mini-OS
  */
-#include <stdlib.h>
-#include <stdint.h>
-#include <common/hypervisor.h>
-#include <common/events.h>
+#include "internal/isr.h"
 #include <xen/xen.h>
-#include <uk/print.h>
-#include <uk/bitops.h>
 
-#define NR_EVS 1024
-
-/* this represents a event handler. Chaining or sharing is not allowed */
-typedef struct _ev_action_t {
-	evtchn_handler_t handler;
-	void *data;
-	uint32_t count;
-} ev_action_t;
-
-static ev_action_t ev_actions[NR_EVS];
+ev_action_t ev_actions[NR_EVS];
 static void default_handler(evtchn_port_t port, struct __regs *regs,
 			    void *data);
 
@@ -78,30 +64,6 @@ void unbind_all_ports(void)
 	vcpu_info->evtchn_pending_sel = 0;
 }
 
-/*
- * Demux events to different handlers.
- */
-int do_event(evtchn_port_t port, struct __regs *regs)
-{
-	ev_action_t *action;
-
-	clear_evtchn(port);
-
-	if (port >= NR_EVS) {
-		uk_pr_err("%s: Port number too large: %d\n", __func__, port);
-		return 1;
-	}
-
-	action = &ev_actions[port];
-	action->count++;
-
-	/* call the handler */
-	action->handler(port, regs, action->data);
-
-	return 1;
-
-}
-
 evtchn_port_t bind_evtchn(evtchn_port_t port, evtchn_handler_t handler,
 			  void *data)
 {
@@ -321,13 +283,6 @@ inline void unmask_evtchn(evtchn_port_t port)
 	}
 }
 
-inline void clear_evtchn(evtchn_port_t port)
-{
-	shared_info_t *s = HYPERVISOR_shared_info;
-
-	uk_clear_bit(port, &s->evtchn_pending[0]);
-}
-
 struct uk_alloc;
 
 int ukplat_irq_init(struct uk_alloc *a __unused)
diff --git a/plat/xen/internal/isr.h b/plat/xen/internal/isr.h
new file mode 100644
index 0000000..9a23d69
--- /dev/null
+++ b/plat/xen/internal/isr.h
@@ -0,0 +1,51 @@
+/* SPDX-License-Identifier: BSD-2-Clause */
+/*
+ * Authors: Rolf Neugebauer <neugebar@dcs.gla.ac.uk>
+ *          Grzegorz Milos <gm281@cam.ac.uk>
+ *          Costin Lupu <costin.lupu@cs.pub.ro>
+ *
+ * Copyright (c) 2003-2005, Intel Research Cambridge
+ * Copyright (c) 2017, NEC Europe Ltd., NEC Corporation.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#ifndef XEN_ISR_H
+#define XEN_ISR_H
+
+#include <stdint.h>
+#include <stdlib.h>
+#include <common/events.h>
+#include <uk/print.h>
+#include <common/hypervisor.h>
+#include <uk/bitops.h>
+
+#define NR_EVS 1024
+
+/* this represents a event handler. Chaining or sharing is not allowed */
+typedef struct _ev_action_t {
+	evtchn_handler_t handler;
+	void *data;
+	uint32_t count;
+} ev_action_t;
+
+#endif /* XEN_ISR_H */
diff --git a/plat/xen/isr.c b/plat/xen/isr.c
new file mode 100644
index 0000000..9aad3ac
--- /dev/null
+++ b/plat/xen/isr.c
@@ -0,0 +1,63 @@
+/* SPDX-License-Identifier: BSD-2-Clause */
+/*
+ * Authors: Rolf Neugebauer <neugebar@dcs.gla.ac.uk>
+ *          Grzegorz Milos <gm281@cam.ac.uk>
+ *          Costin Lupu <costin.lupu@cs.pub.ro>
+ *
+ * Copyright (c) 2003-2005, Intel Research Cambridge
+ * Copyright (c) 2017, NEC Europe Ltd., NEC Corporation.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+#include "internal/isr.h"
+
+extern ev_action_t *ev_actions;
+
+inline void clear_evtchn(evtchn_port_t port)
+{
+	shared_info_t *s = HYPERVISOR_shared_info;
+
+	uk_clear_bit(port, &s->evtchn_pending[0]);
+}
+
+/*
+ * Demux events to different handlers.
+ */
+int do_event(evtchn_port_t port, struct __regs *regs)
+{
+	ev_action_t *action;
+
+	clear_evtchn(port);
+
+	if (port >= NR_EVS) {
+		uk_pr_err("%s: Port number too large: %d\n", __func__, port);
+		return 1;
+	}
+
+	action = &ev_actions[port];
+	action->count++;
+
+	/* call the handler */
+	action->handler(port, regs, action->data);
+
+	return 1;
+}
-- 
2.25.1



From minios-devel-bounces@lists.xenproject.org Fri Aug 28 12:43:02 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Fri, 28 Aug 2020 12:43:02 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1kBdie-00009B-0F; Fri, 28 Aug 2020 12:43:00 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=Ghly=CG=neclab.eu=simon.kuenzer@srs-us1.protection.inumbo.net>)
 id 1kBdic-00008N-Ap
 for minios-devel@lists.xenproject.org; Fri, 28 Aug 2020 12:42:58 +0000
X-Inumbo-ID: 5f8b4e1a-b639-460a-8ad5-ac123da08f34
Received: from mailer1.neclab.eu (unknown [195.37.70.40])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 5f8b4e1a-b639-460a-8ad5-ac123da08f34;
 Fri, 28 Aug 2020 12:42:52 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
 by mailer1.neclab.eu (Postfix) with ESMTP id 3A02C103BC1;
 Fri, 28 Aug 2020 14:42:51 +0200 (CEST)
X-Virus-Scanned: Amavisd on Debian GNU/Linux (atlas-a.office.hd)
Received: from mailer1.neclab.eu ([127.0.0.1])
 by localhost (atlas-a.office.hd [127.0.0.1]) (amavisd-new, port 10024)
 with ESMTP id 8C9FzIKi3Enf; Fri, 28 Aug 2020 14:42:51 +0200 (CEST)
X-ENC: Last-Hop-TLS-encrypted
X-ENC: Last-Hop-TLS-encrypted
Received: from puck.office.hd (puck.office.hd [192.168.24.91])
 (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
 (No client certificate requested)
 by mailer1.neclab.eu (Postfix) with ESMTPS id 16964103AE4;
 Fri, 28 Aug 2020 14:42:51 +0200 (CEST)
Received: from [10.7.2.46] (192.168.24.96) by puck.office.hd (192.168.24.91)
 with Microsoft SMTP Server (version=TLS1_2,
 cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1979.3; Fri, 28 Aug
 2020 14:42:50 +0200
Subject: Re: [UNIKRAFT] include: uk/page.h: Include arch instead of asm
To: <gaulthier.gain@uliege.be>, <minios-devel@lists.xenproject.org>
References: <20200825115105.9437-1-gaulthier.gain@uliege.be>
From: Simon Kuenzer <simon.kuenzer@neclab.eu>
Message-ID: <b376c440-d02b-d5d2-e6a6-9ce65f565e88@neclab.eu>
Date: Fri, 28 Aug 2020 14:42:50 +0200
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:68.0)
 Gecko/20100101 Thunderbird/68.11.0
MIME-Version: 1.0
In-Reply-To: <20200825115105.9437-1-gaulthier.gain@uliege.be>
Content-Type: text/plain; charset="utf-8"; format=flowed
Content-Language: en-US
Content-Transfer-Encoding: 7bit
X-Originating-IP: [192.168.24.96]
X-ClientProxiedBy: oberon.office.hd (192.168.24.90) To puck.office.hd
 (192.168.24.91)
X-BeenThere: minios-devel@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Mini-os development list <minios-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:minios-devel@lists.xenproject.org>
List-Help: <mailto:minios-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: minios-devel-bounces@lists.xenproject.org
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>

Thanks a lot for this fix!

Reviewed-by: Simon Kuenzer <simon.kuenzer@neclab.eu>

On 25.08.20 13:51, gaulthier.gain@uliege.be wrote:
> From: gaulthier gain <gaulthier.gain@uliege.be>
> 
> This patch allows to use the uk/arch/limits.h instead of uk/asm/limits.h
> since asm/limits.h cannot be directly included.
> 
> Signed-off-by: gaulthier gain <gaulthier.gain@uliege.be>
> ---
>   include/uk/page.h | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/include/uk/page.h b/include/uk/page.h
> index 4e95f1b6..a9262635 100644
> --- a/include/uk/page.h
> +++ b/include/uk/page.h
> @@ -35,7 +35,7 @@
>   #ifndef __UK_PAGE_H__
>   #define __UK_PAGE_H__
>   
> -#include <uk/asm/limits.h>
> +#include <uk/arch/limits.h>
>   #include <uk/essentials.h>
>   
>   #ifdef __cplusplus
> 


From minios-devel-bounces@lists.xenproject.org Fri Aug 28 15:36:23 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Fri, 28 Aug 2020 15:36:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1kBgQO-00026m-JH; Fri, 28 Aug 2020 15:36:20 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=Ghly=CG=neclab.eu=simon.kuenzer@srs-us1.protection.inumbo.net>)
 id 1kBgQN-00026h-Oa
 for minios-devel@lists.xen.org; Fri, 28 Aug 2020 15:36:19 +0000
X-Inumbo-ID: cee60612-fc4d-49fc-b035-9967a540f8bb
Received: from mailer1.neclab.eu (unknown [195.37.70.40])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id cee60612-fc4d-49fc-b035-9967a540f8bb;
 Fri, 28 Aug 2020 15:36:16 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
 by mailer1.neclab.eu (Postfix) with ESMTP id 609AF103AE4;
 Fri, 28 Aug 2020 17:36:15 +0200 (CEST)
X-Virus-Scanned: Amavisd on Debian GNU/Linux (atlas-a.office.hd)
Received: from mailer1.neclab.eu ([127.0.0.1])
 by localhost (atlas-a.office.hd [127.0.0.1]) (amavisd-new, port 10024)
 with ESMTP id EheQg7_pUxX5; Fri, 28 Aug 2020 17:36:15 +0200 (CEST)
X-ENC: Last-Hop-TLS-encrypted
X-ENC: Last-Hop-TLS-encrypted
Received: from puck.office.hd (puck.office.hd [192.168.24.91])
 (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
 (No client certificate requested)
 by mailer1.neclab.eu (Postfix) with ESMTPS id 2BAF1103ACD;
 Fri, 28 Aug 2020 17:36:15 +0200 (CEST)
Received: from [10.7.2.27] (192.168.24.96) by puck.office.hd (192.168.24.91)
 with Microsoft SMTP Server (version=TLS1_2,
 cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1979.3; Fri, 28 Aug
 2020 17:36:14 +0200
Subject: Re: [[UNIKRAFT] v4] lib/isrlib: Introduce stdlib irq-safe rutines
To: <cristianvijelie@gmail.com>, <minios-devel@lists.xen.org>
References: <20200826070415.7732-1-cristianvijelie@gmail.com>
From: Simon Kuenzer <simon.kuenzer@neclab.eu>
Message-ID: <a599a5ff-dcc2-0f0b-c219-8bf09d9a6773@neclab.eu>
Date: Fri, 28 Aug 2020 17:36:13 +0200
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:68.0)
 Gecko/20100101 Thunderbird/68.11.0
MIME-Version: 1.0
In-Reply-To: <20200826070415.7732-1-cristianvijelie@gmail.com>
Content-Type: text/plain; charset="utf-8"; format=flowed
Content-Language: en-US
Content-Transfer-Encoding: 7bit
X-Originating-IP: [192.168.24.96]
X-ClientProxiedBy: titania.office.hd (192.168.24.89) To puck.office.hd
 (192.168.24.91)
X-BeenThere: minios-devel@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Mini-os development list <minios-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:minios-devel@lists.xenproject.org>
List-Help: <mailto:minios-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: minios-devel-bounces@lists.xenproject.org
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>

Hi Christian,

I got really confused be the version 4. ;-) This is a new patch, right? 
You do not need to add a version number for new patches which are not 
part of a reworked patch-series.
In general, do you have a case where quick sort or string to character 
conversions are needed already? I would prefer introducing them as soon 
as we have a case where they are needed. I also think qsort is not a 
wise idea to do within interrupt context. What do you think?

Thanks,

Simon

On 26.08.20 09:04, cristianvijelie@gmail.com wrote:
> From: Cristian Vijelie <cristianvijelie@gmail.com>
> 
> This patch introduces stdlib interrupt-context-safe functions, based on

based on/derived from

> nolibc. I removed abort, as it made no sense to have another abort
> function.
> 
> Signed-off-by: Cristian Vijelie <cristianvijelie@gmail.com>
> ---
>   include/uk/isr/stdlib.h |  63 ++++++
>   lib/isrlib/Makefile.uk  |   2 +
>   lib/isrlib/qsort.c      | 157 +++++++++++++++
>   lib/isrlib/stdlib.c     | 417 ++++++++++++++++++++++++++++++++++++++++
>   4 files changed, 639 insertions(+)
>   create mode 100644 include/uk/isr/stdlib.h
>   create mode 100644 lib/isrlib/qsort.c
>   create mode 100644 lib/isrlib/stdlib.c
> 
> diff --git a/include/uk/isr/stdlib.h b/include/uk/isr/stdlib.h
> new file mode 100644
> index 0000000..30eb443
> --- /dev/null
> +++ b/include/uk/isr/stdlib.h
> @@ -0,0 +1,63 @@
> +/* SPDX-License-Identifier: BSD-2-Clause */
> +/*
> + * Copyright (c) 2009 Citrix Systems, Inc. All rights reserved.
> + *
> + * Redistribution and use in source and binary forms, with or without
> + * modification, are permitted provided that the following conditions
> + * are met:
> + * 1. Redistributions of source code must retain the above copyright
> + *    notice, this list of conditions and the following disclaimer.
> + * 2. Redistributions in binary form must reproduce the above copyright
> + *    notice, this list of conditions and the following disclaimer in the
> + *    documentation and/or other materials provided with the distribution.
> + *
> + * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
> + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
> + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
> + * ARE DISCLAIMED.  IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
> + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
> + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
> + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
> + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
> + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
> + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
> + * SUCH DAMAGE.
> + */
> +
> +#ifndef __UK_ISR_STDLIB_H__
> +#define __UK_ISR_STDLIB_H__
> +
> +#include <stdlib.h>
> +
> +#ifdef __cplusplus
> +extern "C" {
> +#endif
> +
> +/**
> + * Convert a string to an unsigned long integer.
> + * Ignores `locale' stuff.  Assumes that the upper and lower case
> + * alphabets and digits are each contiguous.
> + *
> + * @nptr:   The start of the string
> + * @endptr: A pointer to the end of the parsed string will be placed here
> + * @base:   The number base to use
> + */
> +long strtol_isr(const char *nptr, char **endptr, int base);
> +unsigned long strtoul_isr(const char *nptr, char **endptr, int base);
> +long long strtoll_isr(const char *nptr, char **endptr, int base);
> +unsigned long long strtoull_isr(const char *nptr, char **endptr, int base);
> +
> +/**
> + * Convert a string to an integer
> + * @s: The start of the string
> + */
> +int atoi_isr(const char *s);
> +
> +void qsort_isr(void *base, size_t nmemb, size_t size,
> +           int (*compar)(const void *, const void *));
> +
> +#ifdef __cplusplus
> +}
> +#endif
> +
> +#endif /* __UK_ISR_STDLIB_H__ */
> diff --git a/lib/isrlib/Makefile.uk b/lib/isrlib/Makefile.uk
> index 26f19e8..9b60e04 100644
> --- a/lib/isrlib/Makefile.uk
> +++ b/lib/isrlib/Makefile.uk
> @@ -6,3 +6,5 @@ CINCLUDES-$(CONFIG_LIBISRLIB) += $(LIBISRLIB_GLOBAL_INCLUDES)
>   CXXINCLUDES-$(CONFIG_LIBISRLIB) += $(LIBISRLIB_GLOBAL_INCLUDES)
>   
>   LIBISRLIB_SRCS-y += $(LIBISRLIB_BASE)/string.c|isr
> +LIBISRLIB_SRCS-y += $(LIBISRLIB_BASE)/stdlib.c|isr
> +LIBISRLIB_SRCS-y += $(LIBISRLIB_BASE)/qsort.c|isr
> diff --git a/lib/isrlib/qsort.c b/lib/isrlib/qsort.c
> new file mode 100644
> index 0000000..418e217
> --- /dev/null
> +++ b/lib/isrlib/qsort.c
> @@ -0,0 +1,157 @@
> +/*	$OpenBSD: qsort.c,v 1.10 2005/08/08 08:05:37 espie Exp $ */
> +/*-
> + * Copyright (c) 1992, 1993
> + *	The Regents of the University of California.  All rights reserved.
> + *
> + * Redistribution and use in source and binary forms, with or without
> + * modification, are permitted provided that the following conditions
> + * are met:
> + * 1. Redistributions of source code must retain the above copyright
> + *    notice, this list of conditions and the following disclaimer.
> + * 2. Redistributions in binary form must reproduce the above copyright
> + *    notice, this list of conditions and the following disclaimer in the
> + *    documentation and/or other materials provided with the distribution.
> + * 3. Neither the name of the University nor the names of its contributors
> + *    may be used to endorse or promote products derived from this software
> + *    without specific prior written permission.
> + *
> + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
> + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
> + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
> + * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
> + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
> + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
> + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
> + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
> + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
> + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
> + * SUCH DAMAGE.
> + */
> +#include <sys/types.h>
> +#include <uk/isr/stdlib.h>
> +static inline char	*med3_isr(char *, char *, char *, int (*)
> +				(const void *, const void *));
> +static inline void	 swapfunc_isr(char *, char *, int, int);
> +#define min(a, b)	((a) < (b) ? a : b)
> +/*
> + * Qsort routine from Bentley & McIlroy's "Engineering a Sort Function".
> + */
> +#define swapcode(TYPE, parmi, parmj, n) {		\
> +	long i = (n) / sizeof(TYPE);			\
> +	TYPE *pi = (TYPE *) (parmi);			\
> +	TYPE *pj = (TYPE *) (parmj);			\
> +	do {						\
> +		TYPE	t = *pi;			\
> +		*pi++ = *pj;				\
> +		*pj++ = t;				\
> +	} while (--i > 0);				\
> +}
> +#define SWAPINIT(a, es) (swaptype = ((char *)a - (char *)0) % sizeof(long) || \
> +	es % sizeof(long) ? 2 : es == sizeof(long) ? 0 : 1)
> +static inline void
> +swapfunc_isr(char *a, char *b, int n, int swaptype)
> +{
> +	if (swaptype <= 1)
> +		swapcode(long, a, b, n)
> +	else
> +		swapcode(char, a, b, n)
> +}
> +#define swap(a, b)					\
> +	do {						\
> +		if (swaptype == 0) {				\
> +			long t = *(long *)(a);			\
> +			*(long *)(a) = *(long *)(b);		\
> +			*(long *)(b) = t;			\
> +		} else						\
> +			swapfunc_isr(a, b, es, swaptype);		\
> +	} while (0)
> +
> +#define vecswap(a, b, n)					\
> +	do {							\
> +		if ((n) > 0)					\
> +			swapfunc_isr(a, b, n, swaptype);		\
> +	} while (0)
> +static inline char *
> +med3_isr(char *a, char *b, char *c, int (*cmp)(const void *, const void *))
> +{
> +	return cmp(a, b) < 0 ?
> +		(cmp(b, c) < 0 ? b : (cmp(a, c) < 0 ? c : a))
> +		: (cmp(b, c) > 0 ? b : (cmp(a, c) < 0 ? a : c));
> +}
> +void
> +qsort_isr(void *aa, size_t n, size_t es, int (*cmp)(const void *, const void *))
> +{
> +	char *pa, *pb, *pc, *pd, *pl, *pm, *pn;
> +	int d, r, swaptype, swap_cnt;
> +	char *a = aa;
> +loop:
> +	SWAPINIT(a, es);
> +	swap_cnt = 0;
> +	if (n < 7) {
> +		for (pm = (char *)a + es; pm < (char *) a + n * es; pm += es)
> +			for (pl = pm; pl > (char *) a && cmp(pl - es, pl) > 0;
> +			     pl -= es)
> +				swap(pl, pl - es);
> +		return;
> +	}
> +	pm = (char *)a + (n / 2) * es;
> +	if (n > 7) {
> +		pl = (char *)a;
> +		pn = (char *)a + (n - 1) * es;
> +		if (n > 40) {
> +			d = (n / 8) * es;
> +			pl = med3_isr(pl, pl + d, pl + 2 * d, cmp);
> +			pm = med3_isr(pm - d, pm, pm + d, cmp);
> +			pn = med3_isr(pn - 2 * d, pn - d, pn, cmp);
> +		}
> +		pm = med3_isr(pl, pm, pn, cmp);
> +	}
> +	swap(a, pm);
> +	pa = pb = (char *)a + es;
> +
> +	pc = pd = (char *)a + (n - 1) * es;
> +	for (;;) {
> +		while (pb <= pc && (r = cmp(pb, a)) <= 0) {
> +			if (r == 0) {
> +				swap_cnt = 1;
> +				swap(pa, pb);
> +				pa += es;
> +			}
> +			pb += es;
> +		}
> +		while (pb <= pc && (r = cmp(pc, a)) >= 0) {
> +			if (r == 0) {
> +				swap_cnt = 1;
> +				swap(pc, pd);
> +				pd -= es;
> +			}
> +			pc -= es;
> +		}
> +		if (pb > pc)
> +			break;
> +		swap(pb, pc);
> +		swap_cnt = 1;
> +		pb += es;
> +		pc -= es;
> +	}
> +	if (swap_cnt == 0) {  /* Switch to insertion sort */
> +		for (pm = (char *) a + es; pm < (char *) a + n * es; pm += es)
> +			for (pl = pm; pl > (char *) a && cmp(pl - es, pl) > 0;
> +			     pl -= es)
> +				swap(pl, pl - es);
> +		return;
> +	}
> +	pn = (char *)a + n * es;
> +	r = min(pa - (char *)a, pb - pa);
> +	vecswap(a, pb - r, r);
> +	r = min(pd - pc, pn - pd - (int)es);
> +	vecswap(pb, pn - r, r);
> +	if ((r = pb - pa) > (int)es)
> +		qsort_isr(a, r / es, es, cmp);
> +	if ((r = pd - pc) > (int)es) {
> +		/* Iterate rather than recurse to save stack space */
> +		a = pn - r;
> +		n = r / es;
> +		goto loop;
> +	}
> +}
> diff --git a/lib/isrlib/stdlib.c b/lib/isrlib/stdlib.c
> new file mode 100644
> index 0000000..d1aad75
> --- /dev/null
> +++ b/lib/isrlib/stdlib.c
> @@ -0,0 +1,417 @@
> +/* SPDX-License-Identifier: BSD-3-Clause */
> +/*
> + ****************************************************************************
> + *
> + *        File: printf.c
> + *      Author: Juergen Gross <jgross@suse.com>
> + *
> + *        Date: Jun 2016
> + *
> + * Environment: Xen Minimal OS
> + * Description: Library functions for printing
> + *              (FreeBSD port)
> + *
> + ****************************************************************************
> + */
> +
> +/*-
> + * Copyright (c) 1990, 1993
> + * The Regents of the University of California.  All rights reserved.
> + *
> + * This code is derived from software contributed to Berkeley by
> + * Chris Torek.
> + *
> + * Copyright (c) 2011 The FreeBSD Foundation
> + * All rights reserved.
> + * Portions of this software were developed by David Chisnall
> + * under sponsorship from the FreeBSD Foundation.
> + *
> + * Redistribution and use in source and binary forms, with or without
> + * modification, are permitted provided that the following conditions
> + * are met:
> + * 1. Redistributions of source code must retain the above copyright
> + *    notice, this list of conditions and the following disclaimer.
> + * 2. Redistributions in binary form must reproduce the above copyright
> + *    notice, this list of conditions and the following disclaimer in the
> + *    documentation and/or other materials provided with the distribution.
> + * 3. Neither the name of the University nor the names of its contributors
> + *    may be used to endorse or promote products derived from this software
> + *    without specific prior written permission.
> + *
> + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
> + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
> + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
> + * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
> + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
> + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
> + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
> + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
> + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
> + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
> + * SUCH DAMAGE.
> + */
> +
> +#include <errno.h>
> +#include <stdint.h>
> +#include <stdlib.h>
> +#include <limits.h>
> +#include <ctype.h>
> +#include <uk/print.h>
> +#include <uk/plat/bootstrap.h>
> +#include <uk/arch/limits.h>
> +
> +#define __DECONST(type, var) ((type)(uintptr_t)(const void *)(var))
> +
> +/*
> + * Convert a string to an unsigned long integer.
> + *
> + * Ignores `locale' stuff.  Assumes that the upper and lower case
> + * alphabets and digits are each contiguous.
> + */
> +unsigned long strtoul_isr(const char *nptr, char **endptr, int base)
> +{
> +	const char *s = nptr;
> +	unsigned long acc;
> +	unsigned char c;
> +	unsigned long cutoff;
> +	int neg = 0, any, cutlim;
> +
> +	if (base < 0 || base == 1 || base > 36) {
> +		errno = -EINVAL;
> +		any = 0;
> +		acc = 0;
> +		goto exit;
> +	}
> +
> +	/*
> +	 * See strtol for comments as to the logic used.
> +	 */
> +	do {
> +		c = *s++;
> +	} while (isspace(c));
> +	if (c == '-') {
> +		neg = 1;
> +		c = *s++;
> +	} else if (c == '+')
> +		c = *s++;
> +	if ((base == 0 || base == 16) && c == '0' && (*s == 'x' || *s == 'X')) {
> +		c = s[1];
> +		s += 2;
> +		base = 16;
> +	}
> +	if (base == 0)
> +		base = c == '0' ? 8 : 10;
> +	cutoff = (unsigned long)ULONG_MAX / (unsigned long)base;
> +	cutlim = (unsigned long)ULONG_MAX % (unsigned long)base;
> +	for (acc = 0, any = 0;; c = *s++) {
> +		if (!isascii(c))
> +			break;
> +		if (isdigit(c))
> +			c -= '0';
> +		else if (isalpha(c))
> +			c -= isupper(c) ? 'A' - 10 : 'a' - 10;
> +		else
> +			break;
> +		if (c >= base)
> +			break;
> +		if (any < 0 || acc > cutoff || (acc == cutoff && c > cutlim))
> +			any = -1;
> +		else {
> +			any = 1;
> +			acc *= base;
> +			acc += c;
> +		}
> +	}
> +	if (any < 0) {
> +		acc = ULONG_MAX;
> +		errno = ERANGE;
> +	} else if (neg)
> +		acc = -acc;
> +exit:
> +	if (endptr != 0)
> +		*endptr = __DECONST(char *, any ? s - 1 : nptr);
> +	return acc;
> +}
> +
> +long strtol_isr(const char *nptr, char **endptr, int base)
> +{
> +	const char *s;
> +	unsigned long acc;
> +	unsigned char c;
> +	unsigned long qbase, cutoff;
> +	int neg, any, cutlim;
> +
> +	s = nptr;
> +	if (base < 0 || base == 1 || base > 36) {
> +		errno = -EINVAL;
> +		any = 0;
> +		acc = 0;
> +		goto exit;
> +	}
> +
> +	/*
> +	 * Skip white space and pick up leading +/- sign if any.
> +	 * If base is 0, allow 0x for hex and 0 for octal, else
> +	 * assume decimal; if base is already 16, allow 0x.
> +	 */
> +	do {
> +		c = *s++;
> +	} while (isspace(c));
> +	if (c == '-') {
> +		neg = 1;
> +		c = *s++;
> +	} else {
> +		neg = 0;
> +		if (c == '+')
> +			c = *s++;
> +	}
> +	if ((base == 0 || base == 16) && c == '0' && (*s == 'x' || *s == 'X')) {
> +		c = s[1];
> +		s += 2;
> +		base = 16;
> +	}
> +	if (base == 0)
> +		base = c == '0' ? 8 : 10;
> +
> +	/*
> +	 * Compute the cutoff value between legal numbers and illegal
> +	 * numbers.  That is the largest legal value, divided by the
> +	 * base.  An input number that is greater than this value, if
> +	 * followed by a legal input character, is too big.  One that
> +	 * is equal to this value may be valid or not; the limit
> +	 * between valid and invalid numbers is then based on the last
> +	 * digit.  For instance, if the range for quads is
> +	 * [-2147483648..2147483647] and the input base
> +	 * is 10, cutoff will be set to 2147483647 and cutlim to
> +	 * either 7 (neg==0) or 8 (neg==1), meaning that if we have
> +	 * accumulated a value > 2147483647, or equal but the
> +	 * next digit is > 7 (or 8), the number is too big, and we will
> +	 * return a range error.
> +	 *
> +	 * Set any if any `digits' consumed; make it negative to indicate
> +	 * overflow.
> +	 */
> +	qbase = (unsigned int)base;
> +	cutoff = neg
> +		     ? (unsigned long)LONG_MAX
> +			   - (unsigned long)(LONG_MIN + LONG_MAX)
> +		     : LONG_MAX;
> +	cutlim = cutoff % qbase;
> +	cutoff /= qbase;
> +	for (acc = 0, any = 0;; c = *s++) {
> +		if (!isascii(c))
> +			break;
> +		if (isdigit(c))
> +			c -= '0';
> +		else if (isalpha(c))
> +			c -= isupper(c) ? 'A' - 10 : 'a' - 10;
> +		else
> +			break;
> +		if (c >= base)
> +			break;
> +		if (any < 0 || acc > cutoff || (acc == cutoff && c > cutlim))
> +			any = -1;
> +		else {
> +			any = 1;
> +			acc *= qbase;
> +			acc += c;
> +		}
> +	}
> +	if (any < 0) {
> +		acc = neg ? LONG_MIN : LONG_MAX;
> +		errno = ERANGE;
> +	} else if (neg)
> +		acc = -acc;
> +
> +exit:
> +	if (endptr != 0)
> +		*endptr = __DECONST(char *, any ? s - 1 : nptr);
> +	return acc;
> +}
> +
> +/*
> + * Convert a string to a long long integer.
> + *
> + * Ignores `locale' stuff.  Assumes that the upper and lower case
> + * alphabets and digits are each contiguous.
> + */
> +long long strtoll_isr(const char *nptr, char **endptr, int base)
> +{
> +	const char *s;
> +	unsigned long long acc;
> +	unsigned char c;
> +	unsigned long long qbase, cutoff;
> +	int neg, any, cutlim;
> +
> +	s = nptr;
> +	if (base < 0 || base == 1 || base > 36) {
> +		errno = -EINVAL;
> +		any = 0;
> +		acc = 0;
> +		goto exit;
> +	}
> +	/*
> +	 * Skip white space and pick up leading +/- sign if any.
> +	 * If base is 0, allow 0x for hex and 0 for octal, else
> +	 * assume decimal; if base is already 16, allow 0x.
> +	 */
> +	do {
> +		c = *s++;
> +	} while (isspace(c));
> +	if (c == '-') {
> +		neg = 1;
> +		c = *s++;
> +	} else {
> +		neg = 0;
> +		if (c == '+')
> +			c = *s++;
> +	}
> +	if ((base == 0 || base == 16) && c == '0' && (*s == 'x' || *s == 'X')) {
> +		c = s[1];
> +		s += 2;
> +		base = 16;
> +	}
> +	if (base == 0)
> +		base = c == '0' ? 8 : 10;
> +
> +	/*
> +	 * Compute the cutoff value between legal numbers and illegal
> +	 * numbers.  That is the largest legal value, divided by the
> +	 * base.  An input number that is greater than this value, if
> +	 * followed by a legal input character, is too big.  One that
> +	 * is equal to this value may be valid or not; the limit
> +	 * between valid and invalid numbers is then based on the last
> +	 * digit.  For instance, if the range for quads is
> +	 * [-9223372036854775808..9223372036854775807] and the input base
> +	 * is 10, cutoff will be set to 922337203685477580 and cutlim to
> +	 * either 7 (neg==0) or 8 (neg==1), meaning that if we have
> +	 * accumulated a value > 922337203685477580, or equal but the
> +	 * next digit is > 7 (or 8), the number is too big, and we will
> +	 * return a range error.
> +	 *
> +	 * Set any if any `digits' consumed; make it negative to indicate
> +	 * overflow.
> +	 */
> +	qbase = (unsigned int)base;
> +	cutoff = neg
> +		     ? (unsigned long long)LLONG_MAX
> +			   - (unsigned long long)(LLONG_MIN + LLONG_MAX)
> +		     : LLONG_MAX;
> +	cutlim = cutoff % qbase;
> +	cutoff /= qbase;
> +	for (acc = 0, any = 0;; c = *s++) {
> +		if (!isascii(c))
> +			break;
> +		if (isdigit(c))
> +			c -= '0';
> +		else if (isalpha(c))
> +			c -= isupper(c) ? 'A' - 10 : 'a' - 10;
> +		else
> +			break;
> +		if (c >= base)
> +			break;
> +		if (any < 0 || acc > cutoff || (acc == cutoff && c > cutlim))
> +			any = -1;
> +		else {
> +			any = 1;
> +			acc *= qbase;
> +			acc += c;
> +		}
> +	}
> +	if (any < 0) {
> +		errno = ERANGE;
> +		acc = neg ? LLONG_MIN : LLONG_MAX;
> +	} else if (neg)
> +		acc = -acc;
> +
> +exit:
> +	if (endptr != 0)
> +		*endptr = __DECONST(char *, any ? s - 1 : nptr);
> +	return acc;
> +}
> +
> +/*
> + * Convert a string to an unsigned long long integer.
> + *
> + * Ignores `locale' stuff.  Assumes that the upper and lower case
> + * alphabets and digits are each contiguous.
> + */
> +unsigned long long strtoull_isr(const char *nptr, char **endptr, int base)
> +{
> +	const char *s = nptr;
> +	unsigned long long acc;
> +	unsigned char c;
> +	unsigned long long qbase, cutoff;
> +	int neg, any, cutlim;
> +
> +	if (base < 0 || base == 1 || base > 36) {
> +		errno = -EINVAL;
> +		any = 0;
> +		acc = 0;
> +		goto exit;
> +	}
> +	/*
> +	 * See strtoq for comments as to the logic used.
> +	 */
> +	do {
> +		c = *s++;
> +	} while (isspace(c));
> +	if (c == '-') {
> +		neg = 1;
> +		c = *s++;
> +	} else {
> +		neg = 0;
> +		if (c == '+')
> +			c = *s++;
> +	}
> +	if ((base == 0 || base == 16) && c == '0' && (*s == 'x' || *s == 'X')) {
> +		c = s[1];
> +		s += 2;
> +		base = 16;
> +	}
> +	if (base == 0)
> +		base = c == '0' ? 8 : 10;
> +	qbase = (unsigned int)base;
> +	cutoff = (unsigned long long)ULLONG_MAX / qbase;
> +	cutlim = (unsigned long long)ULLONG_MAX % qbase;
> +	for (acc = 0, any = 0;; c = *s++) {
> +		if (!isascii(c))
> +			break;
> +		if (isdigit(c))
> +			c -= '0';
> +		else if (isalpha(c))
> +			c -= isupper(c) ? 'A' - 10 : 'a' - 10;
> +		else
> +			break;
> +		if (c >= base)
> +			break;
> +		if (any < 0 || acc > cutoff || (acc == cutoff && c > cutlim))
> +			any = -1;
> +		else {
> +			any = 1;
> +			acc *= qbase;
> +			acc += c;
> +		}
> +	}
> +	if (any < 0) {
> +		errno = ERANGE;
> +		acc = ULLONG_MAX;
> +	} else if (neg)
> +		acc = -acc;
> +
> +exit:
> +	if (endptr != 0)
> +		*endptr = __DECONST(char *, any ? s - 1 : nptr);
> +	return acc;
> +}
> +
> +int atoi_isr(const char *s)
> +{
> +	long long atoll;
> +
> +	atoll = strtoll_isr(s, NULL, 10);
> +	atoll = (atoll > __I_MAX) ? __I_MAX : atoll;
> +	atoll = (atoll < __I_MIN) ? __I_MIN : atoll;
> +
> +	return (int) atoll;
> +}
> 


From minios-devel-bounces@lists.xenproject.org Fri Aug 28 15:49:41 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Fri, 28 Aug 2020 15:49:41 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1kBgdJ-0003BL-7I; Fri, 28 Aug 2020 15:49:41 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=/7oQ=CG=gmail.com=cezar.craciunoiu@srs-us1.protection.inumbo.net>)
 id 1kBfde-0002jn-OQ
 for minios-devel@lists.xen.org; Fri, 28 Aug 2020 14:45:58 +0000
X-Inumbo-ID: a584f712-eb4f-4aae-b544-6e81978eab74
Received: from mail-ed1-x534.google.com (unknown [2a00:1450:4864:20::534])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id a584f712-eb4f-4aae-b544-6e81978eab74;
 Fri, 28 Aug 2020 14:45:33 +0000 (UTC)
Received: by mail-ed1-x534.google.com with SMTP id l23so1380189edv.11
 for <minios-devel@lists.xen.org>; Fri, 28 Aug 2020 07:45:33 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=from:to:cc:subject:date:message-id:in-reply-to:references
 :mime-version:content-transfer-encoding;
 bh=0795LcuPWfzhup/mEJtQYk+nwrGZ0304wAukIzFlnbs=;
 b=vFIFLnXdPDORIJvBJ/sY2w8Ui1c65Pvj6s99wgs2k0jZRn9+pkaqOHQyRyHVyjXQ34
 PIw9006l7xTXDhIRXXEPN0n+LXsHR2tDKAnVDY5p6KbnMFR5PrEDx5mMSqZ0JFUHRUfY
 oSXyAYHIfqyBqWLfCi3SI9J8b7iq1hm3+l9e6gWw3YBVfrZuVUzsF+82C78bQ4ctlJtu
 TuntqrrO1ZIatNbe95TEbeXGBEjeRrt0dQVLEqhJrMi50duU7T5nymCpI+WSButeGNVp
 r19OTG/n/KXpJAwW5vxR1FqrQJUtW+fQA5hTIy9T+C5AmYcx/W3CSkA90viLcMBVzdtz
 vWKg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to
 :references:mime-version:content-transfer-encoding;
 bh=0795LcuPWfzhup/mEJtQYk+nwrGZ0304wAukIzFlnbs=;
 b=ouO7zPFDdGdYrg0WUz5KvahE9ufe4RVzAnhCkk8eD1IKIrh59Fa7rD4AgVTEYmSnNn
 9J4CAUU5wiDZCpqui31KJ3QiKYzB+kjAbyLcJrfF/rPEJrj6GN8DJqhLzv/v4PWfX8Ha
 7JAickGOy5FhgeQItglxFPkM3ooiV/4Qw4IKuImc5zrQ6MsNszgVAhSHXH1cSkeitKFc
 4HHVgLrIDJ8oeibEh9MKKtospcdaA/wMGw/impMfHRxS6Sh8TJvzHYGKfXEOyyAP2C0s
 llo/7c46WkD66UFmICxOgwBJbRp5DAYmQAgsbjnicVzYurFWftVxuNEnA4KfH3WNvZ6u
 utrg==
X-Gm-Message-State: AOAM532OPnCMonqieubcWeTNpjsSi4Ixfcde48xY3syvHn2PDE9A7+TQ
 7BAwBVKy+MYmxv4b9Pfhj8PkQQGBJ9fFE61Q
X-Google-Smtp-Source: ABdhPJzMssju2YsCmPtXIuPr/9hfCvPY7D1s0I3WlJZfadfAhJtgx/Xg/aNBjsZtp4yBzd8OOQ7xlg==
X-Received: by 2002:a50:a2e6:: with SMTP id 93mr2130144edm.147.1598625932454; 
 Fri, 28 Aug 2020 07:45:32 -0700 (PDT)
Received: from localhost.localdomain ([2a02:2f05:6e05:7200::1003])
 by smtp.gmail.com with ESMTPSA id q7sm1131277edw.96.2020.08.28.07.45.31
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Fri, 28 Aug 2020 07:45:31 -0700 (PDT)
From: CezarCraciunoiu <cezar.craciunoiu@gmail.com>
To: minios-devel@lists.xen.org
Cc: simon.kuenzer@neclab.eu, sharan.santhanam@neclab.eu,
 felipe.huici@neclab.eu, Cezar Craciunoiu <cezar.craciunoiu@gmail.com>
Subject: [UNIKRAFT/BALLOON v2 6/7] plat/xen/balloon: Xen balloon hypervisor
 calls implementation
Date: Fri, 28 Aug 2020 17:45:22 +0300
Message-Id: <eeb56218be64b09c5293b313f84b885643311217.1598621743.git.cezar.craciunoiu@gmail.com>
X-Mailer: git-send-email 2.20.1
In-Reply-To: <cover.1598621743.git.cezar.craciunoiu@gmail.com>
References: <cover.1598621743.git.cezar.craciunoiu@gmail.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-Mailman-Approved-At: Fri, 28 Aug 2020 15:49:39 +0000
X-BeenThere: minios-devel@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Mini-os development list <minios-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:minios-devel@lists.xenproject.org>
List-Help: <mailto:minios-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: minios-devel-bounces@lists.xenproject.org
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>

From: Cezar Craciunoiu <cezar.craciunoiu@gmail.com>

The Xen implementation just prepares the arguments for the functions and
drivers of the Xen hypervisor.

As Xen reserves and keeps separate memory zones for it's VM's, it is harder
to observe the behaviour of the balloon. To add to this, Xen already has
a working balloon that takes memory from the host, which makes things a bit
harder to test.

Signed-off-by: Cezar Craciunoiu <cezar.craciunoiu@gmail.com>
---
 plat/xen/Makefile.uk |   1 +
 plat/xen/balloon.c   | 135 +++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 136 insertions(+)
 create mode 100644 plat/xen/balloon.c

diff --git a/plat/xen/Makefile.uk b/plat/xen/Makefile.uk
index 2a8cdbf..76b7488 100644
--- a/plat/xen/Makefile.uk
+++ b/plat/xen/Makefile.uk
@@ -41,6 +41,7 @@ LIBXENPLAT_CINCLUDES-y         += -I$(UK_PLAT_COMMON_BASE)/include
 LIBXENPLAT_SRCS-y              += $(UK_PLAT_XEN_DEF_LDS)
 LIBXENPLAT_SRCS-y              += $(LIBXENPLAT_BASE)/hypervisor.c
 LIBXENPLAT_SRCS-y              += $(LIBXENPLAT_BASE)/memory.c
+LIBXENPLAT_SRCS-y              += $(LIBXENPLAT_BASE)/balloon.c
 LIBXENPLAT_SRCS-y              += $(LIBXENPLAT_BASE)/io.c
 LIBXENPLAT_SRCS-y              += $(UK_PLAT_COMMON_BASE)/lcpu.c|common
 LIBXENPLAT_SRCS-y              += $(UK_PLAT_COMMON_BASE)/memory.c|common
diff --git a/plat/xen/balloon.c b/plat/xen/balloon.c
new file mode 100644
index 0000000..7cc231f
--- /dev/null
+++ b/plat/xen/balloon.c
@@ -0,0 +1,135 @@
+/* SPDX-License-Identifier: BSD-3-Clause */
+/*
+ * Authors: Cason Schindler & Jack Raney <cason.j.schindler@gmail.com>
+ *          Cezar Craciunoiu <cezar.craciunoiu@gmail.com>
+ *
+ * Copyright (c) 2019, The University of Texas at Austin. All rights reserved.
+ *               2020, University Politehnica of Bucharest. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the copyright holder nor the names of its
+ *    contributors may be used to endorse or promote products derived from
+ *    this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ * THIS HEADER MAY NOT BE EXTRACTED OR MODIFIED IN ANY WAY.
+ */
+#include <uk/plat/common/sections.h>
+
+#include <common/gnttab.h>
+#if (defined __X86_32__) || (defined __X86_64__)
+#include <xen-x86/setup.h>
+#include <xen-x86/mm_pv.h>
+#include <xen-x86/mm.h>
+#elif (defined __ARM_32__) || (defined __ARM_64__)
+#include <xen-arm/setup.h>
+#include <xen-arm/mm.h>
+#endif
+
+#include <xen/memory.h>
+#include <uk/plat/balloon.h>
+#include <common/hypervisor.h>
+
+#include <errno.h>
+#include <stddef.h>
+
+/**
+ * Set up and call Xen hypercall to ask for memory back from Xen.
+ */
+static int xenmem_reservation_increase(int count, xen_pfn_t *frames, int order)
+{
+	struct xen_memory_reservation res = {
+#if __XEN_INTERFACE_VERSION__ >= 0x00030209
+		.memflags = 0;
+#else
+		.address_bits = 0,
+#endif
+		.extent_order = order,
+		.domid        = DOMID_SELF
+	};
+
+	set_xen_guest_handle(res.extent_start, frames);
+	res.nr_extents = count;
+
+	/* Needs physical frame number */
+	return HYPERVISOR_memory_op(XENMEM_populate_physmap, &res);
+}
+
+/**
+ * Set up and call Xen hypercall to give memory to Xen.
+ */
+static int xenmem_reservation_decrease(int count, xen_pfn_t *frames, int order)
+{
+	struct xen_memory_reservation res = {
+#if __XEN_INTERFACE_VERSION__ >= 0x00030209
+		.mem_flags = 0,
+#else
+		.address_bits = 0,
+#endif
+		.extent_order = order,
+		.domid        = DOMID_SELF
+	};
+
+	set_xen_guest_handle(res.extent_start, frames);
+	res.nr_extents = count;
+
+	/* Needs guest frame number */
+	return HYPERVISOR_memory_op(XENMEM_decrease_reservation, &res);
+}
+
+/**
+ * When we inflate we will be decreasing the memory available to the VM
+ * We will give the extent of extent order = order starting at va to the host.
+ */
+int ukplat_inflate(void *va, int order)
+{
+	xen_pfn_t pfn = virt_to_pfn(va);
+
+	if (va == NULL)
+		return -EINVAL;
+
+	return xenmem_reservation_decrease(1, &pfn, order);
+}
+
+/**
+ * When we deflate we will be increasing the memory available to the VM
+ * We will ask for 1 extent of extent order = order back from the host.
+ * It will map the extent to the address va.
+ */
+int ukplat_deflate(void *va, int order)
+{
+	/* Make sure we are sending the correct frame number. Should be a GFN */
+	xen_pfn_t pfn = virt_to_pfn(va);
+
+	if (va == NULL)
+		return -EINVAL;
+
+	return xenmem_reservation_increase(1, &pfn, order);
+}
+
+/**
+ * Sets behaviour for Xen.
+ */
+void ukplat_balloon_set(char *balloon_type)
+{
+	*balloon_type = 0;
+}
-- 
2.20.1



From minios-devel-bounces@lists.xenproject.org Fri Aug 28 15:49:41 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Fri, 28 Aug 2020 15:49:41 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1kBgdJ-0003BE-5O; Fri, 28 Aug 2020 15:49:41 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=/7oQ=CG=gmail.com=cezar.craciunoiu@srs-us1.protection.inumbo.net>)
 id 1kBfdZ-0002jn-OE
 for minios-devel@lists.xen.org; Fri, 28 Aug 2020 14:45:53 +0000
X-Inumbo-ID: e3c70b88-a624-47c7-8cc1-70bf60135021
Received: from mail-ed1-x541.google.com (unknown [2a00:1450:4864:20::541])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id e3c70b88-a624-47c7-8cc1-70bf60135021;
 Fri, 28 Aug 2020 14:45:32 +0000 (UTC)
Received: by mail-ed1-x541.google.com with SMTP id q21so1407475edv.1
 for <minios-devel@lists.xen.org>; Fri, 28 Aug 2020 07:45:32 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=from:to:cc:subject:date:message-id:in-reply-to:references
 :mime-version:content-transfer-encoding;
 bh=0DJ4OPNKqVpvdhB1yJ1C6ylztxSLyPkaYIbg6MIt3SU=;
 b=gQXUPQ3o6FPKlHwTRIGjW2ZN0bhdDncZRbGvoE/BhQLan0lQWJt3p9xGSHbCFyLENk
 wDZsxTw0K0hO0Te0LnFCGKB2eSFvuJ7KnaRJMwXZdw4RBCVAua8jNYZa35lG9H7UEcn7
 QXDBoS/rcMpjSvNDgleNkPwRBRdOIAdm28CskyO6WgirlkxFrZgEZKpFikX7CdHHZUQt
 xe+gNMr6zRZWvlmJERfLkvD/hM74uwWPICAxulyV3GLXrsXyjpz2tPSpfCt4AWcfXws1
 u0ThauP2FRzrOUACdrmxPhzj/PtV/yEJ1kXOf+9VgefVWP0ehxTpu7ovg6yWETcFgG9l
 t2/Q==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to
 :references:mime-version:content-transfer-encoding;
 bh=0DJ4OPNKqVpvdhB1yJ1C6ylztxSLyPkaYIbg6MIt3SU=;
 b=eaczdXPHuTv07u8S6le/sQXGnRtgc7NwDyAHxDhiUzyCd5nvyYJ5BZb1Nt9N8Bm6+F
 vAywsiZKFZdzs4CjhFHU1B5JQDd0JKgMO+7wfvb23YAsjXpiwn5sfDXXVtnDbfS5KsoV
 1lTG7s6Vcf7W0ih4Y6ooHful9+rQKknkjvRL7nIgv1sB9J4XFjWfR+qL7HihCW2QTzz0
 7d5oMXIBVuIxnlz4/W/HwItSeR2dd7XziSOzClLEW9HH1hdcXn71jnv/cVOMCbxNOvek
 9zF0sWivC89+UVY6cL70QGi7TUicimxwAdZ2YmA7u4XvoJpkjfrdxMenEML3ISfd+poV
 /zUA==
X-Gm-Message-State: AOAM533giLgu0VUCxj2NcepcZExSOxJTu342WP9Qu2NmFjLsBso3nstb
 CkWv79tHkgIjlai5Bnetsfj9bbFgkAskBhn5
X-Google-Smtp-Source: ABdhPJweG9a/gtz8yE/1Nms1SzryVDd+WbywTygQtTXWsh81r1Jwc0a4s/eBSwDcPtteZqFZdL751g==
X-Received: by 2002:aa7:c6ca:: with SMTP id b10mr2210743eds.269.1598625931396; 
 Fri, 28 Aug 2020 07:45:31 -0700 (PDT)
Received: from localhost.localdomain ([2a02:2f05:6e05:7200::1003])
 by smtp.gmail.com with ESMTPSA id q7sm1131277edw.96.2020.08.28.07.45.30
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Fri, 28 Aug 2020 07:45:30 -0700 (PDT)
From: CezarCraciunoiu <cezar.craciunoiu@gmail.com>
To: minios-devel@lists.xen.org
Cc: simon.kuenzer@neclab.eu, sharan.santhanam@neclab.eu,
 felipe.huici@neclab.eu, Cezar Craciunoiu <cezar.craciunoiu@gmail.com>
Subject: [UNIKRAFT/BALLOON v2 5/7] plat/linuxu/balloon: Linuxu balloon stubs
Date: Fri, 28 Aug 2020 17:45:21 +0300
Message-Id: <cc622b9869d91229e3ad0ccb212a4120dcc42973.1598621743.git.cezar.craciunoiu@gmail.com>
X-Mailer: git-send-email 2.20.1
In-Reply-To: <cover.1598621743.git.cezar.craciunoiu@gmail.com>
References: <cover.1598621743.git.cezar.craciunoiu@gmail.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-Mailman-Approved-At: Fri, 28 Aug 2020 15:49:39 +0000
X-BeenThere: minios-devel@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Mini-os development list <minios-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:minios-devel@lists.xenproject.org>
List-Help: <mailto:minios-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: minios-devel-bounces@lists.xenproject.org
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>

From: Cezar Craciunoiu <cezar.craciunoiu@gmail.com>

The balloon is not implemented for linuxu, but as the original authors
suggested, it could be done with mmap/munmap.

The stubs were kept so the calls in bbuddy do not fail.

Signed-off-by: Cezar Craciunoiu <cezar.craciunoiu@gmail.com>
---
 plat/linuxu/Makefile.uk |  2 ++
 plat/linuxu/balloon.c   | 61 +++++++++++++++++++++++++++++++++++++++++
 2 files changed, 63 insertions(+)
 create mode 100644 plat/linuxu/balloon.c

diff --git a/plat/linuxu/Makefile.uk b/plat/linuxu/Makefile.uk
index 94516ac..ce82c5c 100644
--- a/plat/linuxu/Makefile.uk
+++ b/plat/linuxu/Makefile.uk
@@ -36,12 +36,14 @@ LIBLINUXUPLAT_SRCS-y              += $(LIBLINUXUPLAT_BASE)/setup.c
 LIBLINUXUPLAT_SRCS-y              += $(LIBLINUXUPLAT_BASE)/console.c
 LIBLINUXUPLAT_SRCS-y              += $(LIBLINUXUPLAT_BASE)/shutdown.c
 LIBLINUXUPLAT_SRCS-y              += $(LIBLINUXUPLAT_BASE)/memory.c
+LIBLINUXUPLAT_SRCS-y              += $(LIBLINUXUPLAT_BASE)/balloon.c
 LIBLINUXUPLAT_SRCS-y              += $(LIBLINUXUPLAT_BASE)/lcpu.c
 LIBLINUXUPLAT_SRCS-y              += $(LIBLINUXUPLAT_BASE)/irq.c
 LIBLINUXUPLAT_SRCS-y              += $(LIBLINUXUPLAT_BASE)/time.c
 LIBLINUXUPLAT_SRCS-y              += $(UK_PLAT_COMMON_BASE)/lcpu.c|common
 LIBLINUXUPLAT_SRCS-y              += $(UK_PLAT_COMMON_BASE)/memory.c|common
 LIBLINUXUPLAT_SRCS-y              += $(LIBLINUXUPLAT_BASE)/io.c
+
 LIBLINUXUPLAT_SRCS-$(CONFIG_ARCH_X86_64) += \
 			$(LIBLINUXUPLAT_BASE)/x86/link64.lds.S
 LIBLINUXUPLAT_SRCS-$(CONFIG_ARCH_ARM_32) += \
diff --git a/plat/linuxu/balloon.c b/plat/linuxu/balloon.c
new file mode 100644
index 0000000..9377ee2
--- /dev/null
+++ b/plat/linuxu/balloon.c
@@ -0,0 +1,61 @@
+/* SPDX-License-Identifier: BSD-3-Clause */
+/*
+ * Authors: Cason Schindler & Jack Raney <cason.j.schindler@gmail.com>
+ *          Cezar Craciunoiu <cezar.craciunoiu@gmail.com>
+ *
+ * Copyright (c) 2019, The University of Texas at Austin. All rights reserved.
+ *               2020, University Politehnica of Bucharest. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the copyright holder nor the names of its
+ *    contributors may be used to endorse or promote products derived from
+ *    this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ * THIS HEADER MAY NOT BE EXTRACTED OR MODIFIED IN ANY WAY.
+ */
+#include <errno.h>
+#include <errno.h>
+#include <stddef.h>
+
+#include <uk/plat/balloon.h>
+#include <uk/assert.h>
+
+/* Memory ballooning is not yet supported for linuxu */
+
+int ukplat_inflate(void *va __unused, int order __unused)
+{
+	return -ENOSYS;
+}
+
+int ukplat_deflate(void *va __unused, int order __unused)
+{
+	return -ENOSYS;
+}
+
+/**
+ * Sets behaviour for Linuxu.
+ */
+void ukplat_balloon_set(char *balloon_type)
+{
+	*balloon_type = 0;
+}
-- 
2.20.1



From minios-devel-bounces@lists.xenproject.org Fri Aug 28 15:49:41 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Fri, 28 Aug 2020 15:49:41 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1kBgdI-0003AY-T4; Fri, 28 Aug 2020 15:49:40 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=rCnF=CA=yahoo.com=hack3rcon@srs-us1.protection.inumbo.net>)
 id 1k9UI8-0000Dq-7o
 for minios-devel@lists.xen.org; Sat, 22 Aug 2020 14:14:44 +0000
X-Inumbo-ID: d3bb5103-9bf2-49de-b73d-7d137ae4d14b
Received: from sonic304-9.consmr.mail.bf2.yahoo.com (unknown [74.6.128.32])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id d3bb5103-9bf2-49de-b73d-7d137ae4d14b;
 Sat, 22 Aug 2020 14:14:43 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048;
 t=1598105683; bh=EVjrDcqaeweVaI9sDUDJCf5PxsGGGTLpDY2Z0zWi36I=;
 h=Date:From:Reply-To:To:Subject:References:From:Subject;
 b=l2s5HOkdPv8j5szFOf3QJrIKxN97uYtgRKo84tFlcTS+YoQPAIItWZUrqu40c1iRsv6OEwz1LZC3Lvfx0wdvUyio6BLm31pOxx68gTQksqRcuq3TvpE3k0WH9f0DuEStWAwkt19c20xw8U4WJ5cSDWpHxJMh1UbOGWDkwv5OBNC8hO81okQswXh8kV/hWfSnM0Yn2ZDWAKwilhxJb+yYJbo0xJ4XnvfPhkvOhkChiL1YkvcRNShUW2pah2Uh60hnG+EknAHdUEbgMq5ixgmKIG7Z2NfDWJnU5rYY7eRCkwP+CKgYTNKgYyDx6qmY2WO0VwZuLvOEfe7gihDBC+g1+w==
X-YMail-OSG: r257i7sVM1mFqaerwdc6yWoWtUmowpZd3JVFvL_X16Z9Xk_3udFPcjUdWI8QsSn
 vUSpHGaRk85oTpdPXYYPXu4BcKBZ1idHw3XN.MosnYcG9TbI9XHVM_A.23MdZDqZ.D3uz1OFEj8w
 ZpZI1aA_AJttAsB00AjZdsrJyp5qeTx9DVaVt1Y.AfCqniEyQGiBGu4hwKRkjtRcPto01S0saK3d
 Yr4ZiNeGgIyGuWYxkpHBlkjXAvQQYiLGC_A6TSwXWDumIOmE.UlygWVBFkWHGIcsS.dF_NyBusYz
 4_7NlVScRbW_6RqItKub2BPpq.HuMZMMrMG8tN.yV0VzFzIGDkuNmcsZduk5w8icbkUTDu4qQSyt
 4nxSHYQxbzpJzSINVT.VHoLoPGCLdVGPRrTs93pnLDEIhOJFVHNaP3L7iiX6yL6NfB5gf8.0A.Tj
 yJoIvnD.EmCZT5G7QbFwBlLWmDUcw2foxEslez7PtnHw2jxHa.D5yCwU.00f7y6AcDqNN6sEUzCa
 uqEqdsn.Ey4AlDyCwiId2BTI9MABT8SE8on37SFWABqCjX5ANwh7qJnn9UMhVw1s3P7PUXZnpfj6
 VKZ1vfBKo8T5GvALygc_V3G6LFUpK1iQzEZ9f97V976CIcpxfOe5aSO1cfHgMNyeK.nYpyaGIVuo
 FPOKQS7aS0NASkxwCKahLTGj0V4l2Jf0xm2VqvVVGHpaF2FviRT0P62nqTKPzG3Frl2qdO04xZFj
 1luzZFasBotiN7CufnOiMo6__o06x1u7R4lvElSipkA7PW_GHDT8HtZYZo.LAAFL9pbNIX6WtUSg
 LL9AG4w3Lzl_67xlrAcGCMi9KNwjhb8rEEd3LEar2iv9QTEn.lOP47TRfDrEfQ_GzUof7yptevm3
 ImtA5H62veorKuPc3rl25e8CmxdeUGHQGWzJJ6TRgBNogB.sSU81vULhqqirDH7rKNxPgC4tRThl
 POAlYYC02dkR9VP0kXswtBEjgEBVxcB2zYPsux8HEE8vdXuqp6TDno7Z_6UwSX8.xmfNRv4WFvH2
 93d0mlTF_pLkA7UifIJZt8eQuPsAd6J3yEvv3yg7asBxN5ivenjbW8onhW2_25l2C5VlfroAs.sg
 yjhepkBjNDot3Zq0h5sJyD5PfNngild4wHOA0Tg5DM2bFvvpxno399JbpxbmN1_qjKSmzoSA6Jgo
 i_lMbEwzri8xXY8YPa2l4tjRywLUOMIeq6Q7rNIBGeyRuclzB75FCFWbMbWht.q.XXcTKBvcaMRU
 cDLJBHuPjNZUZZBdAerdECzZtH4WhdgdiY5u2xMCWF0wj849wKczoyiQVU0kxeymJOaLBXEtOrKl
 fWEAe7SWvYLrKIY.ua8QRP.6NibwRDf7vV8MoFxcZQKCp0WMip6BDtf.lUrgSOFHbSdaoffIqUbt
 RPsWDz.uskv0F1QxQsevaEo04kL.thBvcIZOWvMaSLokEk78FcxiQn9f3n6p7sADpGZwNZmEx4Tx
 k8Jo.sOMyxgmL1V0Nhm0e9YHCTfyjQTNYupUs_eM-
Received: from sonic.gate.mail.ne1.yahoo.com by
 sonic304.consmr.mail.bf2.yahoo.com with HTTP; Sat, 22 Aug 2020 14:14:43 +0000
Date: Sat, 22 Aug 2020 14:14:33 +0000 (UTC)
From: Jason Long <hack3rcon@yahoo.com>
To: "minios-devel@lists.xen.org" <minios-devel@lists.xen.org>
Message-ID: <2136227700.4433719.1598105673578@mail.yahoo.com>
Subject: The difference between Unikraft and MiniOS.
MIME-Version: 1.0
Content-Type: multipart/alternative; 
 boundary="----=_Part_4433718_623480292.1598105673577"
References: <2136227700.4433719.1598105673578.ref@mail.yahoo.com>
X-Mailer: WebService/1.1.16455 YahooMailAndroidMobile YMobile/1.0
 (com.yahoo.mobile.client.android.mail/6.10.4; Android/7.1.1; NMF26F; bbc100;
 BlackBerry; BBC100-1; 5.16; 1184x720; )
Content-Length: 505
X-Mailman-Approved-At: Fri, 28 Aug 2020 15:49:39 +0000
X-BeenThere: minios-devel@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Mini-os development list <minios-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:minios-devel@lists.xenproject.org>
List-Help: <mailto:minios-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=subscribe>
Reply-To: Jason Long <hack3rcon@yahoo.com>
Errors-To: minios-devel-bounces@lists.xenproject.org
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>

------=_Part_4433718_623480292.1598105673577
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit

Hello,What is the difference between the Unikraft and MiniOS?
Thanks.
------=_Part_4433718_623480292.1598105673577
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: 7bit

Hello,<div>What is the difference between the Unikraft and MiniOS?</div><div><br></div><div id="yMail_cursorElementTracker_1598105650221">Thanks.</div>
------=_Part_4433718_623480292.1598105673577--


From minios-devel-bounces@lists.xenproject.org Fri Aug 28 15:49:41 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Fri, 28 Aug 2020 15:49:41 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1kBgdI-0003Ad-UV; Fri, 28 Aug 2020 15:49:40 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=/7oQ=CG=gmail.com=cezar.craciunoiu@srs-us1.protection.inumbo.net>)
 id 1kBfdA-0002jn-QW
 for minios-devel@lists.xen.org; Fri, 28 Aug 2020 14:45:28 +0000
X-Inumbo-ID: bce6e1fc-d145-451a-a83d-3df48d1ff856
Received: from mail-ej1-x634.google.com (unknown [2a00:1450:4864:20::634])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id bce6e1fc-d145-451a-a83d-3df48d1ff856;
 Fri, 28 Aug 2020 14:45:27 +0000 (UTC)
Received: by mail-ej1-x634.google.com with SMTP id m22so1827753eje.10
 for <minios-devel@lists.xen.org>; Fri, 28 Aug 2020 07:45:27 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=from:to:cc:subject:date:message-id:mime-version
 :content-transfer-encoding;
 bh=3+bSr1gzlaiVMvoD1VDrMrdrP+cd1qoTy6T/ReaAx9E=;
 b=Vs1/pgejzwfbuuRVhGxKokycCAgJNRmWgQcdXC7x/9FCiuumiqBF5vLU2IEY8yY6Dc
 ieJ6qsx9YsI8OHGUDbPSVbij1dEnmRCT7RpBoWxmJQrpIQ4oWGo+fkFPRvRr5NwfmpWj
 IPgTqftoC34dREOTqztYA9LUYahYJHcTF9Lfjdt1JHxrUwtGIaCN+w7QmsqI2Og05t9g
 fSCPBle65U2YnRS2ZuczDobRnSLynkKKhu6KHvOnGcdJ1T7R4+wN82EMTDGFr9XDDyDk
 nQA/JdQmypWGNFi2pzA9f+SalwGRClmi4badCiIpNC24lUpjw0qFPHX+CuiqbsyKtr/K
 1afw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version
 :content-transfer-encoding;
 bh=3+bSr1gzlaiVMvoD1VDrMrdrP+cd1qoTy6T/ReaAx9E=;
 b=IH7GVS693BwcfspJBawwoyeMvcYt35eriGznll0kqLkY6L3fqhIgAn5iTpIxt6h6rS
 C8k6NXa2O2VWC+vfUggd7zoz1DluAI/UpPnAzijulPiq4/SbY7VzrRGz4OFruQYPAfje
 PuJuSX0epbRNJkf7zaEltrQg2RnlywASiX7+ymLAby6vRjkGyDCsH41JF+Un88cZt/np
 Wn+kaMixVMl+bm+4Qh02Pj1FGVQw64ew+VsnGJtEaxwxMah+au+67HzyjIbp2LqX1VTB
 csJOhWDZ/jth10VwzEeMuGf797RBdYBPBrmLkAjZ1gQzPVQkkkp2DGtNPpS6kvuvZygo
 niJw==
X-Gm-Message-State: AOAM530npx9Sb4j9SjVE7101VEw17dPwSpoDhduwZfXmZY5TrBUZOg+W
 +zbVUNy/SStgI89NfVWpN3b/YPeyAUdFJpDn
X-Google-Smtp-Source: ABdhPJx6ZCHvI4fxUshEeMct1Pznd73rf5QFfgJD0Rr19z0DZ8yvZttQLYhxytK5zTOMujLA+izSyQ==
X-Received: by 2002:a17:906:c10c:: with SMTP id
 do12mr2162320ejc.92.1598625926346; 
 Fri, 28 Aug 2020 07:45:26 -0700 (PDT)
Received: from localhost.localdomain ([2a02:2f05:6e05:7200::1003])
 by smtp.gmail.com with ESMTPSA id q7sm1131277edw.96.2020.08.28.07.45.25
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Fri, 28 Aug 2020 07:45:25 -0700 (PDT)
From: CezarCraciunoiu <cezar.craciunoiu@gmail.com>
To: minios-devel@lists.xen.org
Cc: simon.kuenzer@neclab.eu, sharan.santhanam@neclab.eu,
 felipe.huici@neclab.eu, Cezar Craciunoiu <cezar.craciunoiu@gmail.com>
Subject: [UNIKRAFT/BALLOON v2 0/7] Memory Ballooning Cover Letter
Date: Fri, 28 Aug 2020 17:45:16 +0300
Message-Id: <cover.1598621743.git.cezar.craciunoiu@gmail.com>
X-Mailer: git-send-email 2.20.1
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-Mailman-Approved-At: Fri, 28 Aug 2020 15:49:39 +0000
X-BeenThere: minios-devel@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Mini-os development list <minios-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:minios-devel@lists.xenproject.org>
List-Help: <mailto:minios-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: minios-devel-bounces@lists.xenproject.org
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>

From: Cezar Craciunoiu <cezar.craciunoiu@gmail.com>

Hello to whoever is reading this.

This is my version of the memory ballooning patch two people added around
one year ago. This patch structures the code that they worked on and
separates it in different files, based on the content. This, along with
the additions brought to the Makefile and Config files, fixed one of their
issues mentioned in the cover letter: working with the Unikraft
build system.

Also, more than a couple of bugs were fixed, along with coding style fixes,
to ensure that the reviewing process takes as little time as possible.

Lastly, and maybe the most important part, the KVM Memory Balloon works in
any circumstances, handling malloc/free calls with
no noticeable slowdowns. Xen should also work, but the way the interaction
with it is done, made testing the balloon for it pretty hard.

Unfortunately, right now, the Linuxu implementation does not exist,
but it does not hinder the normal execution of applications.
The code could be revisited when a stable version of mmap/munmap is
released (if I understood correctly, right now it is just a "trick"
to fool Go).

Thank you very much for the chance to work on this patch.
I will stay in touch with the reviewer until the patch is brought to a
stable/usable state.

Yours sincerely,

Cezar Craciunoiu
University Politehnica of Bucharest

Cezar Craciunoiu (7):
  plat/balloon: Declared balloon interaction functions
  plat/drivers/include/balloon: Declared KVM driver inflate/deflate
    functions
  plat/drivers/balloon: KVM Virtio balloon driver implementation
  plat/kvm/balloon: KVM balloon driver calls implementation
  plat/linuxu/balloon: Linuxu balloon stubs
  plat/xen/balloon: Xen balloon hypervisor calls implementation
  lib/ukallocbbuddy: Balloon API calls insertion

 include/uk/plat/balloon.h              |  64 +++++
 lib/ukallocbbuddy/Config.uk            |   2 +
 lib/ukallocbbuddy/bbuddy.c             | 137 ++++++++-
 plat/drivers/balloon/balloon_drv.c     | 371 +++++++++++++++++++++++++
 plat/drivers/include/balloon/balloon.h |  46 +++
 plat/kvm/Config.uk                     |  10 +
 plat/kvm/Makefile.uk                   |  11 +
 plat/kvm/balloon.c                     | 107 +++++++
 plat/linuxu/Makefile.uk                |   2 +
 plat/linuxu/balloon.c                  |  61 ++++
 plat/xen/Makefile.uk                   |   1 +
 plat/xen/balloon.c                     | 135 +++++++++
 12 files changed, 945 insertions(+), 2 deletions(-)
 create mode 100644 include/uk/plat/balloon.h
 create mode 100644 plat/drivers/balloon/balloon_drv.c
 create mode 100644 plat/drivers/include/balloon/balloon.h
 create mode 100644 plat/kvm/balloon.c
 create mode 100644 plat/linuxu/balloon.c
 create mode 100644 plat/xen/balloon.c

-- 
2.20.1



From minios-devel-bounces@lists.xenproject.org Fri Aug 28 15:49:41 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Fri, 28 Aug 2020 15:49:41 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1kBgdJ-0003As-2I; Fri, 28 Aug 2020 15:49:41 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=/7oQ=CG=gmail.com=cezar.craciunoiu@srs-us1.protection.inumbo.net>)
 id 1kBfdP-0002jn-Nw
 for minios-devel@lists.xen.org; Fri, 28 Aug 2020 14:45:43 +0000
X-Inumbo-ID: 8358d684-cc1f-43ac-b22d-61b4d5c11824
Received: from mail-ej1-x643.google.com (unknown [2a00:1450:4864:20::643])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 8358d684-cc1f-43ac-b22d-61b4d5c11824;
 Fri, 28 Aug 2020 14:45:30 +0000 (UTC)
Received: by mail-ej1-x643.google.com with SMTP id s19so1847810eju.6
 for <minios-devel@lists.xen.org>; Fri, 28 Aug 2020 07:45:30 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=from:to:cc:subject:date:message-id:in-reply-to:references
 :mime-version:content-transfer-encoding;
 bh=NusBe5va226eaJVbcLjZEGzntqZYoi53Mu6s/xnIV4E=;
 b=TAP35zH4MBnNziiwJ6iFGOvqRZjtSd0Fv4A2AwCkn9LxhUxy1HUkMT0wwya12OWctm
 0mgN8gSL//WuWCzwze5M/fA4NrlXd1dcvuFQH22xCoSV1HHQUEZHL2TM1j8UvuEaEvNs
 QrQTSPc9cpyn6J/81dG/I3lAi+glB72d6+w+sTw5GLqHHbu5lgAAD1EdYexIccN4DYNA
 jh51deY6bT5bEmFTu29dy3hm4p+Qgt5VDqUI1+162SYtSvj6CWvEKuyVF73Jr+L0wdEs
 81W487Bkpuh1I0B0MccK2sN4cqsECP/N7tCQg4bczc2BEQN7SGeuwETmh+t+ofY6IM3V
 oMiQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to
 :references:mime-version:content-transfer-encoding;
 bh=NusBe5va226eaJVbcLjZEGzntqZYoi53Mu6s/xnIV4E=;
 b=hKuVASOc4gRV1Wjm+dZu4x/nCwO0aVEH+EudF51j+QpAwN85f8VaiY0ksfcUudikPn
 OsLP9I8zEfKLLn+WvEqgof3VtYeagl0P5sI5mRo6jZa+QfXT+JkvVU0FBZG4Zk9AXa9H
 7NxKUmAsIFHU1H0rlOikpC/pYMA2rB36UDbA9CtPQERhVCpL/BHqRxI8aUugMnTzHOLh
 aGWBaBewgFdMUj4ny2MhjANi6EM4xhOPMmC5MkKDSPS5lxFFywEsEYgUfe1kqtToMOtJ
 vHz+x1TYuLED+oY7Yk55UEu/ODDkalntizzyxNjHvAVkft3aGZrE/DvyrMZ/8HsUJ527
 GVtQ==
X-Gm-Message-State: AOAM532kcGhrQny/g0jOVA/7xCObGF3vesJBhEzm8iFIsuEs2YOnLKV6
 nHA8gZbPdVpjSkESRXx8U5mekgqrAue6XetQ
X-Google-Smtp-Source: ABdhPJxXkIZKnUjW4jnGZpDpTzp46bFVRXlZECsLNNvu6Oj1c+7wK0I0UzTPB8hrA+LvjGe4Uoi0iA==
X-Received: by 2002:a17:906:3a81:: with SMTP id
 y1mr2089177ejd.464.1598625929432; 
 Fri, 28 Aug 2020 07:45:29 -0700 (PDT)
Received: from localhost.localdomain ([2a02:2f05:6e05:7200::1003])
 by smtp.gmail.com with ESMTPSA id q7sm1131277edw.96.2020.08.28.07.45.28
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Fri, 28 Aug 2020 07:45:28 -0700 (PDT)
From: CezarCraciunoiu <cezar.craciunoiu@gmail.com>
To: minios-devel@lists.xen.org
Cc: simon.kuenzer@neclab.eu, sharan.santhanam@neclab.eu,
 felipe.huici@neclab.eu, Cezar Craciunoiu <cezar.craciunoiu@gmail.com>
Subject: [UNIKRAFT/BALLOON v2 3/7] plat/drivers/balloon: KVM Virtio balloon
 driver implementation
Date: Fri, 28 Aug 2020 17:45:19 +0300
Message-Id: <f67c3e3cec492c4a34042dcf1cb1b88e98c00367.1598621743.git.cezar.craciunoiu@gmail.com>
X-Mailer: git-send-email 2.20.1
In-Reply-To: <cover.1598621743.git.cezar.craciunoiu@gmail.com>
References: <cover.1598621743.git.cezar.craciunoiu@gmail.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-Mailman-Approved-At: Fri, 28 Aug 2020 15:49:39 +0000
X-BeenThere: minios-devel@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Mini-os development list <minios-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:minios-devel@lists.xenproject.org>
List-Help: <mailto:minios-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: minios-devel-bounces@lists.xenproject.org
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>

From: Cezar Craciunoiu <cezar.craciunoiu@gmail.com>

The implementation is based on different Virtio drivers in the project.
It follows a similar structure to 9p/blk/etc. After adding the device,
the driver uses virtqueues to send/take memory to/from KVM.

Other functions will interact with the driver through the inflate_balloon
and deflate_balloon calls.

Signed-off-by: Cezar Craciunoiu <cezar.craciunoiu@gmail.com>
---
 plat/drivers/balloon/balloon_drv.c | 371 +++++++++++++++++++++++++++++
 1 file changed, 371 insertions(+)
 create mode 100644 plat/drivers/balloon/balloon_drv.c

diff --git a/plat/drivers/balloon/balloon_drv.c b/plat/drivers/balloon/balloon_drv.c
new file mode 100644
index 0000000..832eff8
--- /dev/null
+++ b/plat/drivers/balloon/balloon_drv.c
@@ -0,0 +1,371 @@
+/* SPDX-License-Identifier: BSD-3-Clause */
+/*
+ * Authors: Cason Schindler & Jack Raney <cason.j.schindler@gmail.com>
+ *          Cezar Craciunoiu <cezar.craciunoiu@gmail.com>
+ *
+ * Copyright (c) 2019, The University of Texas at Austin. All rights reserved.
+ *               2020, University Politehnica of Bucharest. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the copyright holder nor the names of its
+ *    contributors may be used to endorse or promote products derived from
+ *    this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ * THIS HEADER MAY NOT BE EXTRACTED OR MODIFIED IN ANY WAY.
+ */
+#include <uk/plat/common/sections.h>
+#include <sys/types.h>
+#include <uk/assert.h>
+#include <kvm/config.h>
+#include <inttypes.h>
+#include <uk/alloc.h>
+#include <uk/sglist.h>
+#include <uk/list.h>
+#include <uk/assert.h>
+#include <uk/mutex.h>
+#include <virtio/virtio_ids.h>
+#include <virtio/virtio_bus.h>
+#include <virtio/virtqueue.h>
+#include <balloon/balloon.h>
+
+#define DRIVER_NAME "virtio-balloon"
+#define VTBALLOON_PAGES_PER_REQUEST	8192
+
+static struct uk_alloc *a;
+
+static struct virtio_balloon_device *global_vb;
+
+/* pages given to hypervisor (in the balloon) */
+struct balloon_pages {
+
+	uint32_t num_pages;
+
+};
+
+/* temporary storage for pages with which we are either
+ * inflating or deflating the balloon
+ */
+struct transport_pages {
+
+	uint32_t num_pages;
+	uint32_t *pages;
+
+};
+
+/* wrapper for virtio device */
+struct virtio_balloon_device {
+
+	struct virtio_dev *vdev;
+
+	struct virtqueue *inflate_vq, *deflate_vq;
+
+	__u16 infvq_id;
+	__u16 defvq_id;
+
+	char *tag;
+
+	struct balloon_pages *balloon;
+
+	struct transport_pages *transport;
+
+	uint64_t features;
+	uint32_t flags;
+
+	struct uk_mutex lock;
+};
+
+static void clear_transport(struct virtio_balloon_device *vb)
+{
+	int num = vb->transport->num_pages;
+	int i;
+
+	for (i = 0; i < num; i++) {
+		(vb->transport->pages)[i] = 0;
+		vb->transport->num_pages -= 1;
+	}
+}
+
+/*-
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ *
+ * Copyright (c) 2011, Bryan Venteicher <bryanv@FreeBSD.org>
+ * All rights reserved.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/* The above copyright notice applies only to the below function,
+ * vtballoon_send_page_frames, which is based on FreeBSD's function
+ * of the same name.
+ */
+
+static void vtballoon_send_page_frames(struct virtio_balloon_device *vb,
+			struct virtqueue *vq, int npages)
+{
+	struct uk_sglist sg;
+	struct uk_sglist_seg segs[1];
+	int c;
+	void *vq_cookie;
+	__u32 len = 0;
+
+	uk_sglist_init(&sg, 1, segs);
+
+	uk_sglist_append(&sg, vb->transport->pages, npages * sizeof(uint32_t));
+
+	virtqueue_buffer_enqueue(vq, &vq_cookie, &sg, 1, 0);
+
+	virtqueue_host_notify(vq);
+
+	/* wait on KVM to respond. Need a safer method for this */
+	while ((c = virtqueue_buffer_dequeue(vq, &vq_cookie, &len)) < 0)
+		;
+
+}
+
+/**
+ * This is equivalent to leaking from the balloon and
+ * increasing memory reservation for guest.
+ */
+int deflate_balloon(uintptr_t *pages_to_guest, uint32_t num)
+{
+	struct virtio_balloon_device *vb = global_vb;
+	int num_pages_taken;
+	uint32_t i;
+
+	/* check if device is ready */
+	if (!global_vb)
+		return -ENXIO;
+
+	uk_mutex_lock(&vb->lock);
+
+	clear_transport(vb);
+
+	if (vb->balloon->num_pages < num)
+		num = vb->balloon->num_pages;
+
+	for (i = 0; i < num; i++) {
+		vb->transport->pages[i] = pages_to_guest[i];
+		vb->balloon->num_pages -= 1;
+		vb->transport->num_pages += 1;
+	}
+
+	num_pages_taken = vb->transport->num_pages;
+
+	if (vb->transport->num_pages != 0) {
+		vtballoon_send_page_frames(vb, vb->deflate_vq,
+			vb->transport->num_pages);
+	}
+
+	uk_mutex_unlock(&vb->lock);
+
+	return num_pages_taken;
+}
+
+/**
+ * This is equivalent to filling the balloon and
+ * decreasing memory reservation for guest.
+ */
+int inflate_balloon(uintptr_t *pages_to_host, uint32_t num)
+{
+	struct virtio_balloon_device *vb = global_vb;
+	int num_pages_given;
+	uint32_t i;
+
+	/* check if device is ready */
+	if (!global_vb)
+		return -ENXIO;
+
+	uk_mutex_lock(&vb->lock);
+
+	clear_transport(vb);
+
+	for (i = 0; i < num; i++) {
+		vb->transport->pages[i] = pages_to_host[i] / __PAGE_SIZE;
+		vb->balloon->num_pages += 1;
+		vb->transport->num_pages += 1;
+	}
+
+	num_pages_given = vb->transport->num_pages;
+
+	if (vb->transport->num_pages != 0) {
+		vtballoon_send_page_frames(vb, vb->inflate_vq,
+			vb->transport->num_pages);
+	}
+
+	uk_mutex_unlock(&vb->lock);
+
+	return num_pages_given;
+}
+
+
+static inline void virtio_balloon_feature_set(struct virtio_balloon_device *vb)
+{
+	vb->features = 0;
+	vb->flags = 0;
+	vb->vdev->features = 0;
+}
+
+static int virtio_balloon_vq_alloc(struct virtio_balloon_device *vb)
+{
+	int vq_avail = 0;
+	int rc = 0;
+	__u16 qdesc_size[2];
+
+	vq_avail = virtio_find_vqs(vb->vdev, 2, &(qdesc_size[0]));
+	if (unlikely(vq_avail != 2)) {
+		uk_pr_err(DRIVER_NAME": Expected: %d queues, found %d\n",
+			  2, vq_avail);
+		rc = -ENOMEM;
+		goto exit;
+	}
+
+	vb->infvq_id = 0;
+	vb->defvq_id = 1;
+
+	vb->inflate_vq = virtio_vqueue_setup(vb->vdev, vb->infvq_id,
+			qdesc_size[0], NULL, a);
+	vb->inflate_vq->priv = vb;
+
+	if (unlikely(PTRISERR(vb->inflate_vq))) {
+		uk_pr_err(DRIVER_NAME": Failed to set up virtqueue %"PRIu16"\n",
+			vb->infvq_id);
+		rc = PTR2ERR(vb->inflate_vq);
+	}
+
+	vb->deflate_vq = virtio_vqueue_setup(vb->vdev, vb->defvq_id,
+			qdesc_size[1], NULL, a);
+	vb->deflate_vq->priv = vb;
+
+	if (unlikely(PTRISERR(vb->deflate_vq))) {
+		uk_pr_err(DRIVER_NAME": Failed to set up virtqueue %"PRIu16"\n",
+			vb->defvq_id);
+		rc = PTR2ERR(vb->deflate_vq);
+	}
+
+exit:
+	return rc;
+}
+
+static int virtio_balloon_start(struct virtio_balloon_device *vb)
+{
+	/* Disable interrupts for queues to suppress error messages */
+	virtqueue_intr_disable(vb->inflate_vq);
+	virtqueue_intr_disable(vb->deflate_vq);
+	virtio_dev_drv_up(vb->vdev);
+	uk_pr_info(DRIVER_NAME": %s started\n", vb->tag);
+
+	return 0;
+}
+
+static int virtio_balloon_add_dev(struct virtio_dev *vdev)
+{
+
+	struct virtio_balloon_device *vbdev;
+	int rc = 0;
+	void *alc;
+
+	UK_ASSERT(vdev != NULL);
+
+	vbdev = uk_calloc(a, 1, sizeof(*vbdev));
+
+	if (!vbdev) {
+		rc = -ENOMEM;
+		goto err_out;
+	}
+
+	vbdev->tag = "VIRTIO_BALLOON_DRV_DEV";
+
+	uk_mutex_init(&vbdev->lock);
+
+	vbdev->vdev = vdev;
+	virtio_balloon_feature_set(vbdev);
+	rc = virtio_balloon_vq_alloc(vbdev);
+	if (rc)
+		goto err_out;
+
+	vbdev->transport = uk_calloc(a, 1, sizeof(struct transport_pages));
+	if (!(vbdev->transport)) {
+		rc = -ENOMEM;
+		goto err_out;
+	}
+	vbdev->transport->pages = uk_calloc(a, 1,
+			VTBALLOON_PAGES_PER_REQUEST * sizeof(uint32_t));
+	if (!(vbdev->transport->pages)) {
+		rc = -ENOMEM;
+		goto err_out;
+	}
+	vbdev->balloon = uk_calloc(a, 1, sizeof(struct balloon_pages));
+	if (!(vbdev->balloon)) {
+		rc = -ENOMEM;
+		goto err_out;
+	}
+
+	rc = virtio_balloon_start(vbdev);
+	if (rc)
+		goto err_out;
+
+exit:
+	global_vb = vbdev;
+	/* initial alloc and free to trigger ballon init */
+	alc = uk_palloc(a, 1);
+	uk_pfree(a, alc, 1);
+	return rc;
+err_out:
+	uk_free(a, vbdev->transport->pages);
+	uk_free(a, vbdev->transport);
+	uk_free(a, vbdev->balloon);
+	uk_free(a, vbdev);
+	goto exit;
+
+}
+
+static int virtio_balloon_drv_init(struct uk_alloc *drv_allocator)
+{
+	if (!drv_allocator)
+		return -EINVAL;
+
+	a = drv_allocator;
+	return 0;
+
+}
+
+static const struct virtio_dev_id vballoon_dev_id[] = {
+	{VIRTIO_ID_BALLOON},
+	{VIRTIO_ID_INVALID} /* List Terminator */
+};
+
+static struct virtio_driver virtio_balloon_driver = {
+	.dev_ids = vballoon_dev_id,
+	.init	 = virtio_balloon_drv_init,
+	.add_dev = virtio_balloon_add_dev
+};
+VIRTIO_BUS_REGISTER_DRIVER(&virtio_balloon_driver);
-- 
2.20.1



From minios-devel-bounces@lists.xenproject.org Fri Aug 28 15:49:41 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Fri, 28 Aug 2020 15:49:41 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1kBgdI-0003Ai-Vt; Fri, 28 Aug 2020 15:49:40 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=/7oQ=CG=gmail.com=cezar.craciunoiu@srs-us1.protection.inumbo.net>)
 id 1kBfdF-0002jn-Nn
 for minios-devel@lists.xen.org; Fri, 28 Aug 2020 14:45:33 +0000
X-Inumbo-ID: 8d77c8cc-dddc-47b8-ac42-244093069462
Received: from mail-ej1-x644.google.com (unknown [2a00:1450:4864:20::644])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 8d77c8cc-dddc-47b8-ac42-244093069462;
 Fri, 28 Aug 2020 14:45:28 +0000 (UTC)
Received: by mail-ej1-x644.google.com with SMTP id d26so1877480ejr.1
 for <minios-devel@lists.xen.org>; Fri, 28 Aug 2020 07:45:28 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=from:to:cc:subject:date:message-id:in-reply-to:references
 :mime-version:content-transfer-encoding;
 bh=L/MIH+ZzZQYRKJSywCMQdHhjEPRadyXG45HT9NBINHE=;
 b=ppHp9NCU1nZTeJH7FANqp0y/nx4wqq9njk7aINt4Y22+n0QKLra3cw9RGD2i+hrL+I
 T+3xvjq9jY4v78EzMo/hwSIMQqMsNYIK1OG8tC2C/MD59PrF9GtI9lxwgcibdeaW9IIC
 m9gPdhn/zj3sLISZGYd5zPyIFVs6i7GViV+R2W2yCMNuMARotDOCxssYjc5Q83w1rnk2
 uUaCkXPydIfjKlzEZx9qfKpWeG9SfwPzSTfcJ2cFnpgQ/jZtPBchHU7wu4tYhh0GQYSJ
 HLmlWCub6FHiH2OgY+pJCW5DQHyZCwLwktbXdYa0G8R+t/BTgPDnah2uSS04b+n+s84G
 /Z4g==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to
 :references:mime-version:content-transfer-encoding;
 bh=L/MIH+ZzZQYRKJSywCMQdHhjEPRadyXG45HT9NBINHE=;
 b=jIyZbC7Mk9g/iRKYLPGJ2p/itbVtWPnEL702VJ1tO8Nv9UpCftUKqZuuCoGGJlHfZW
 Zypq8C5GHKvd/5ANhoM25NQi7PgAPMPPCBVWV9UXbpgE8ExK7fGprdhu/hNpuXHkZVFT
 bfbpg1YekpTPsWlCKlYqQfzR1G06KiPX4Pk+7cpYRtMAzAoAf9ohz5gJ14rKWw844OBR
 Y78MrPS7kePvDdMj64ql99LfCqaszVw9glxbJ8KqYv93FlB5DL/Z3kqQzIdLzfwJG8xd
 AY9GmYQ7ubOF599ktGm5WesD4/wp7GsyHJXg5xQ0TsLRJtCcMTR71KKXDO+R2s7VkSYr
 5d3g==
X-Gm-Message-State: AOAM530Km/HFk8s9exYFzlIrL4r2O8zVJsN59fQuNoZeYEagHda2xj/R
 Nningi4jAlllvkqp9nVG13equHuW/IyccyWW
X-Google-Smtp-Source: ABdhPJwiLqWETl6q6VYbdYsdobdqMxF32IupNpRxzmKhm6cc22I6fMfGyNLF1dNt4nKHVXsTJo9Ozw==
X-Received: by 2002:a17:906:4007:: with SMTP id
 v7mr2248895ejj.197.1598625927400; 
 Fri, 28 Aug 2020 07:45:27 -0700 (PDT)
Received: from localhost.localdomain ([2a02:2f05:6e05:7200::1003])
 by smtp.gmail.com with ESMTPSA id q7sm1131277edw.96.2020.08.28.07.45.26
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Fri, 28 Aug 2020 07:45:26 -0700 (PDT)
From: CezarCraciunoiu <cezar.craciunoiu@gmail.com>
To: minios-devel@lists.xen.org
Cc: simon.kuenzer@neclab.eu, sharan.santhanam@neclab.eu,
 felipe.huici@neclab.eu, Cezar Craciunoiu <cezar.craciunoiu@gmail.com>
Subject: [UNIKRAFT/BALLOON v2 1/7] plat/balloon: Declared balloon interaction
 functions
Date: Fri, 28 Aug 2020 17:45:17 +0300
Message-Id: <ef8080cc65f4e9fc7b455d6a040b4cbdb04d626d.1598621743.git.cezar.craciunoiu@gmail.com>
X-Mailer: git-send-email 2.20.1
In-Reply-To: <cover.1598621743.git.cezar.craciunoiu@gmail.com>
References: <cover.1598621743.git.cezar.craciunoiu@gmail.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-Mailman-Approved-At: Fri, 28 Aug 2020 15:49:39 +0000
X-BeenThere: minios-devel@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Mini-os development list <minios-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:minios-devel@lists.xenproject.org>
List-Help: <mailto:minios-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: minios-devel-bounces@lists.xenproject.org
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>

From: Cezar Craciunoiu <cezar.craciunoiu@gmail.com>

Provides the signature of the functions that interact with the balloon.
These functions are implemented in each platform specific balloon.c file.

Signed-off-by: Cezar Craciunoiu <cezar.craciunoiu@gmail.com>
---
 include/uk/plat/balloon.h | 64 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 64 insertions(+)
 create mode 100644 include/uk/plat/balloon.h

diff --git a/include/uk/plat/balloon.h b/include/uk/plat/balloon.h
new file mode 100644
index 0000000..64a4cef
--- /dev/null
+++ b/include/uk/plat/balloon.h
@@ -0,0 +1,64 @@
+/* SPDX-License-Identifier: BSD-3-Clause */
+/*
+ * Authors: Cason Schindler & Jack Raney <cason.j.schindler@gmail.com>
+ *          Cezar Craciunoiu <cezar.craciunoiu@gmail.com>
+ *
+ * Copyright (c) 2019, The University of Texas at Austin. All rights reserved.
+ *               2020, University Politehnica of Bucharest. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the copyright holder nor the names of its
+ *    contributors may be used to endorse or promote products derived from
+ *    this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ * THIS HEADER MAY NOT BE EXTRACTED OR MODIFIED IN ANY WAY.
+ */
+#ifndef __UKPLAT_BALLOON_H__
+#define __UKPLAT_BALLOON_H__
+
+/**
+ * Inflates the memory balloon by 1 extent. After this point, the extent
+ * starting at the specified virtual address will be unavailable to the guest.
+ * The host will then be able to use the extent for its own purposes.
+ * @param va The starting virtual address to release
+ * @param order The sie of the extent to be released
+ * @return >= 0 on success, < 0 otherwise.
+ */
+int ukplat_inflate(void *va, int order);
+
+/**
+ * Deflates the memory balloon by 1 extent, and returns a frame to the
+ * hypervisor starting at the specified virtual address.
+ * @param va The starting virtual address to recover
+ * @param order The size of the extent to be recovered
+ * @return num pages reclaimed on success, < 0 otherwise.
+ */
+int ukplat_deflate(void *va, int order);
+
+/**
+ * Sets the type of balloon based on platform.
+ * @param btype The type of balloon. Can be either 0 (Xen/Linuxu) or 2 (KVM).
+ */
+void ukplat_balloon_set(char *btype);
+
+#endif /* __UKPLAT_BALLOON_H__ */
-- 
2.20.1



From minios-devel-bounces@lists.xenproject.org Fri Aug 28 15:49:41 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Fri, 28 Aug 2020 15:49:41 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1kBgdJ-0003B7-3q; Fri, 28 Aug 2020 15:49:41 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=/7oQ=CG=gmail.com=cezar.craciunoiu@srs-us1.protection.inumbo.net>)
 id 1kBfdU-0002jn-O9
 for minios-devel@lists.xen.org; Fri, 28 Aug 2020 14:45:48 +0000
X-Inumbo-ID: 2f6b5ddb-6e81-4e37-9731-d15c9055c097
Received: from mail-ej1-x62e.google.com (unknown [2a00:1450:4864:20::62e])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 2f6b5ddb-6e81-4e37-9731-d15c9055c097;
 Fri, 28 Aug 2020 14:45:31 +0000 (UTC)
Received: by mail-ej1-x62e.google.com with SMTP id si26so1813810ejb.12
 for <minios-devel@lists.xen.org>; Fri, 28 Aug 2020 07:45:31 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=from:to:cc:subject:date:message-id:in-reply-to:references
 :mime-version:content-transfer-encoding;
 bh=GtTe9cNf3L2K8iUOMmnW/PgBQdu5wUlib0HcXzZA/Uc=;
 b=GhdZ3Gu0GH6orICfkAQgCw0YgKRuX+LwpLHVBxdCC12W8QWwoCb3T/AFKDYpjsLUdd
 faEJR1JFKKN6xL8rkoW4wIk7pz58032zFHz6Pg2TFumOHjaXG0UxAEeLIlNX9JrkGJDK
 rIn0HIAEZ2e48X75ucNyBob93wn70a7THj1a4tbsdztQAo+9z41WL9pmAKyj2yFhL+O6
 4WuAqkafAAZUgkPoqPM6RNgAA7ZpI89XE9FbYu5DoclXFR2P2X1hor9WAXpeq6LVE4ez
 PVm+It88F/NARkWE05skXKN7DaB25sRRnFRn/Dj3oLYYuj/WyMemiL9uvj+8jopLh4ni
 GQWg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to
 :references:mime-version:content-transfer-encoding;
 bh=GtTe9cNf3L2K8iUOMmnW/PgBQdu5wUlib0HcXzZA/Uc=;
 b=ikRexf94xy3xpHNbYxb4dyKO2ffFKIcBHSRVA0bTpJY2i3UOUDO5zddyg02HTU2XHS
 oerUxLZ7w2zZkdw5sGnX09m2B13RbwTRk14C38h+kIEsvHhtRpAi2qot3nrnpQFtt3N7
 sdDwecqKoe3I5vJeFLnuq1zr+9/2xJp7VpAL2uwdTPYsDYwnoET51Gxj1U9tnwVWLN1F
 ucVGo7TfAU08opJ92PUuG3zv6E7eLWhfg58sAtfbcDTiZnRHYhOdWFceVuuGV3rr+lq7
 DY3b4N729pEPg4Ugd3+rAbGI9Yu3TYRHEK2k6BfU5H+l1yJIawDe5Gtol66ttlNv4Y+6
 /HKQ==
X-Gm-Message-State: AOAM533A8I9wE/ngJLPxgXgj/ZJi8kin+z47NMe/1HI+De8Y+UJwoIxG
 rspTiI+JR8Ppa87uqJJLidCg9ozmBEUTQvpX
X-Google-Smtp-Source: ABdhPJykCIis7jGhSK811e/7O4QHQuM2BXiCB2TtkBeu4n4RMfcSc4QaN7MWYtoMrvfbZVsAyFIVsQ==
X-Received: by 2002:a17:906:2bdb:: with SMTP id
 n27mr2231306ejg.12.1598625930427; 
 Fri, 28 Aug 2020 07:45:30 -0700 (PDT)
Received: from localhost.localdomain ([2a02:2f05:6e05:7200::1003])
 by smtp.gmail.com with ESMTPSA id q7sm1131277edw.96.2020.08.28.07.45.29
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Fri, 28 Aug 2020 07:45:29 -0700 (PDT)
From: CezarCraciunoiu <cezar.craciunoiu@gmail.com>
To: minios-devel@lists.xen.org
Cc: simon.kuenzer@neclab.eu, sharan.santhanam@neclab.eu,
 felipe.huici@neclab.eu, Cezar Craciunoiu <cezar.craciunoiu@gmail.com>
Subject: [UNIKRAFT/BALLOON v2 4/7] plat/kvm/balloon: KVM balloon driver calls
 implementation
Date: Fri, 28 Aug 2020 17:45:20 +0300
Message-Id: <b1fb8483079817ec027dd46af1d4ca7e6b746c32.1598621743.git.cezar.craciunoiu@gmail.com>
X-Mailer: git-send-email 2.20.1
In-Reply-To: <cover.1598621743.git.cezar.craciunoiu@gmail.com>
References: <cover.1598621743.git.cezar.craciunoiu@gmail.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-Mailman-Approved-At: Fri, 28 Aug 2020 15:49:39 +0000
X-BeenThere: minios-devel@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Mini-os development list <minios-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:minios-devel@lists.xenproject.org>
List-Help: <mailto:minios-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: minios-devel-bounces@lists.xenproject.org
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>

From: Cezar Craciunoiu <cezar.craciunoiu@gmail.com>

The functions prepare the parameters for the calls to the inflate/deflate
functions.
The balloon_set function helps the functions in bbuddy jump over the
inflate calls, as these are not needed when allocating memory with KVM.

As you can see in the Config.uk file, the KVM balloon driver depends
on the mutex implementation. Locks were added with multi-threading in mind.
For a single thread, the balloon works without the locks (and the dependecy
on uklock is removed).

Signed-off-by: Cezar Craciunoiu <cezar.craciunoiu@gmail.com>
---
 plat/kvm/Config.uk   |  10 ++++
 plat/kvm/Makefile.uk |  11 +++++
 plat/kvm/balloon.c   | 107 +++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 128 insertions(+)
 create mode 100644 plat/kvm/balloon.c

diff --git a/plat/kvm/Config.uk b/plat/kvm/Config.uk
index 3372b6c..929a172 100644
--- a/plat/kvm/Config.uk
+++ b/plat/kvm/Config.uk
@@ -84,6 +84,16 @@ config VIRTIO_BUS
                Virtio bus driver for probing and operating virtio device and
                transport layer.
 
+config BALLOON
+       bool "Balloon driver"
+       default y if LIBUKALLOCBBUDDY
+       default n
+       depends on VIRTIO_PCI
+       depends on LIBUKLOCK_MUTEX
+       help
+              Virtio Memory ballooning device driver for returning memory
+              to the host.
+
 menu "Virtio"
 config VIRTIO_PCI
        bool "Virtio PCI device support"
diff --git a/plat/kvm/Makefile.uk b/plat/kvm/Makefile.uk
index 94321e0..35216e4 100644
--- a/plat/kvm/Makefile.uk
+++ b/plat/kvm/Makefile.uk
@@ -14,6 +14,7 @@ $(eval $(call addplatlib_s,kvm,libkvmvirtioblk,$(CONFIG_VIRTIO_BLK)))
 $(eval $(call addplatlib_s,kvm,libkvmvirtio9p,$(CONFIG_VIRTIO_9P)))
 $(eval $(call addplatlib_s,kvm,libkvmofw,$(CONFIG_LIBOFW)))
 $(eval $(call addplatlib_s,kvm,libkvmgicv2,$(CONFIG_LIBGICV2)))
+$(eval $(call addplatlib_s,kvm,libkvmballoon,$(CONFIG_BALLOON)))
 
 ##
 ## Platform library definitions
@@ -182,3 +183,13 @@ LIBKVMGICV2_CINCLUDES-y         += -I$(UK_PLAT_COMMON_BASE)/include
 LIBKVMGICV2_CINCLUDES-y         += -I$(UK_PLAT_DRIVERS_BASE)/include
 
 LIBKVMGICV2_SRCS-y += $(UK_PLAT_DRIVERS_BASE)/gic/gic-v2.c
+
+##
+## BALLOON library definitions
+##
+LIBKVMBALLOON_CINCLUDES-y += -I$(LIBKVMPLAT_BASE)/include
+LIBKVMBALLOON_CINCLUDES-y += -I$(UK_PLAT_DRIVERS_BASE)/include
+LIBKVMBALLOON_CINCLUDES-y += -I$(UK_PLAT_COMMON_BASE)/include
+
+LIBKVMBALLOON_SRCS-y += $(UK_PLAT_DRIVERS_BASE)/balloon/balloon_drv.c
+LIBKVMBALLOON_SRCS-y += $(LIBKVMPLAT_BASE)/balloon.c
diff --git a/plat/kvm/balloon.c b/plat/kvm/balloon.c
new file mode 100644
index 0000000..d3c5fd2
--- /dev/null
+++ b/plat/kvm/balloon.c
@@ -0,0 +1,107 @@
+/* SPDX-License-Identifier: BSD-3-Clause */
+/*
+ * Authors: Cason Schindler & Jack Raney <cason.j.schindler@gmail.com>
+ *          Cezar Craciunoiu <cezar.craciunoiu@gmail.com>
+ *
+ * Copyright (c) 2019, The University of Texas at Austin. All rights reserved.
+ *               2020, University Politehnica of Bucharest. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the copyright holder nor the names of its
+ *    contributors may be used to endorse or promote products derived from
+ *    this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ * THIS HEADER MAY NOT BE EXTRACTED OR MODIFIED IN ANY WAY.
+ */
+#include <inttypes.h>
+#include <errno.h>
+#include <stddef.h>
+
+#include <balloon/balloon.h>
+#include <uk/plat/balloon.h>
+#include <uk/asm/limits.h>
+
+static inline int get_num_pages(int order)
+{
+	int num_pages = 1;
+	int i;
+
+	for (i = 0; i < order; i++)
+		num_pages *= 2;
+	return num_pages;
+}
+
+/**
+ * Fills addresses for page range starting at first_page.
+ */
+static inline void fill_page_array(uintptr_t *pages_array,
+			void *first_page, int num_pages)
+{
+	uint64_t current_pg = (uint64_t) first_page;
+	int i;
+
+	for (i = 0; i < num_pages; i++) {
+		pages_array[i] = current_pg;
+		current_pg += __PAGE_SIZE;
+	}
+}
+
+/**
+ * Calls driver inflate_balloon
+ * returns number of pages actually put into balloon or < 0 on error
+ */
+int ukplat_inflate(void *page, int order)
+{
+	int num_pages = get_num_pages(order);
+	uintptr_t pages_to_host[num_pages];
+
+	if (page == NULL)
+		return -EINVAL;
+
+	fill_page_array(pages_to_host, page, num_pages);
+	return inflate_balloon(pages_to_host, num_pages);
+}
+
+/**
+ * Call driver deflate_balloon
+ * returns number of pages actually taken from balloon or < 0 on error
+ */
+int ukplat_deflate(void *page, int order)
+{
+	int num_pages = get_num_pages(order);
+	uintptr_t pages_to_guest[num_pages];
+
+	if (page == NULL)
+		return -EINVAL;
+
+	fill_page_array(pages_to_guest, page, num_pages);
+	return deflate_balloon(pages_to_guest, num_pages);
+}
+
+/**
+ * Sets behaviour for KVM.
+ */
+void ukplat_balloon_set(char *balloon_type)
+{
+	*balloon_type = 2;
+}
-- 
2.20.1



From minios-devel-bounces@lists.xenproject.org Fri Aug 28 15:49:42 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Fri, 28 Aug 2020 15:49:42 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1kBgdJ-0003BS-8r; Fri, 28 Aug 2020 15:49:41 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=/7oQ=CG=gmail.com=cezar.craciunoiu@srs-us1.protection.inumbo.net>)
 id 1kBfdj-0002jn-Oc
 for minios-devel@lists.xen.org; Fri, 28 Aug 2020 14:46:03 +0000
X-Inumbo-ID: 185516f8-8906-4e18-b850-956f616f0829
Received: from mail-ed1-x541.google.com (unknown [2a00:1450:4864:20::541])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 185516f8-8906-4e18-b850-956f616f0829;
 Fri, 28 Aug 2020 14:45:34 +0000 (UTC)
Received: by mail-ed1-x541.google.com with SMTP id c10so1388810edk.6
 for <minios-devel@lists.xen.org>; Fri, 28 Aug 2020 07:45:34 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=from:to:cc:subject:date:message-id:in-reply-to:references
 :mime-version:content-transfer-encoding;
 bh=XSbQnL6etPT11WdKnsTgF03bmaI+1ZQJmRm2QbjHKbM=;
 b=hHhYPMpAhB/g0Ev6l+kL2xl1eLkIwiMaqeGhpIFmCOIr3fOh+J4UiZAEsdrqo7ac4e
 6XhTBZo80SaVHxcLIPskREGiiTe/DAVA2Kb7N47wN1peAGYPS54WhxLBO7t7s3fqV0jX
 tZp9Dx002II2e6QxEFsfe7GOOsprtyY/AV/xZctWr6SDirYW/E1SCVV3NO6ONHU93Fo2
 ZUIYKyj+kt5uP3nNX4caOqmlRgyzurYcp24ok6Q+Q4A0A6+DhHqpFldf6B83b81W+yvG
 AaM5tmRyMFC0nSdRAeo7qyeL2Fp6wL204PJ9JYPnJHJCE3UN0FsBMLUFzPngQe7hdYM7
 9zLg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to
 :references:mime-version:content-transfer-encoding;
 bh=XSbQnL6etPT11WdKnsTgF03bmaI+1ZQJmRm2QbjHKbM=;
 b=F0Iwn92omK5O1z2+qbB7rRoeQQOoazDg8m4r3O4qAd9solGqrnhi+7WTjG0rq+av5x
 he5okVnYXtK8km9uESbIXj+U4iy2xxjhPfIwcKLZZBXZrPoae9dkSXap5eNZaHz/1Prn
 MnbV7bwg9nKMUVLo5SV1iH/gi3h5j08PveGMelIHQMx0CYk0pIY05S5tGCNsUVjUI3wk
 MM/gy+gt89Ym33lfWb7j5KCxJoLQWhbMCVPi+Ef0tEOrxpn8VsOiXujwSI8UHPIxluXN
 ZrKXhhxN6GwPNpc9A+9gRs0PaoBJkCUHjVQopE19rm0XSdyLrcQS+j2cWqICBCFuF+/M
 qkUw==
X-Gm-Message-State: AOAM533/jygL0QSEFufR9HdKYyVZAnizXWiN6gnmK0xbYFRnuZiVsjKc
 g+tMaVB00MvcL2ui6vrUgUVq+1qmGzInnDSp
X-Google-Smtp-Source: ABdhPJzQDoSCY8weKYG62p0xCymb5qNv0ar+j1yw9us8IB6inksdyc56B0RTBJmFDTLQA9q1Dkib5A==
X-Received: by 2002:a50:ec89:: with SMTP id e9mr2370878edr.32.1598625933406;
 Fri, 28 Aug 2020 07:45:33 -0700 (PDT)
Received: from localhost.localdomain ([2a02:2f05:6e05:7200::1003])
 by smtp.gmail.com with ESMTPSA id q7sm1131277edw.96.2020.08.28.07.45.32
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Fri, 28 Aug 2020 07:45:32 -0700 (PDT)
From: CezarCraciunoiu <cezar.craciunoiu@gmail.com>
To: minios-devel@lists.xen.org
Cc: simon.kuenzer@neclab.eu, sharan.santhanam@neclab.eu,
 felipe.huici@neclab.eu, Cezar Craciunoiu <cezar.craciunoiu@gmail.com>
Subject: [UNIKRAFT/BALLOON v2 7/7] lib/ukallocbbuddy: Balloon API calls
 insertion
Date: Fri, 28 Aug 2020 17:45:23 +0300
Message-Id: <2b4ebcac9e4f876e954216f5783a7b6c4af88604.1598621743.git.cezar.craciunoiu@gmail.com>
X-Mailer: git-send-email 2.20.1
In-Reply-To: <cover.1598621743.git.cezar.craciunoiu@gmail.com>
References: <cover.1598621743.git.cezar.craciunoiu@gmail.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-Mailman-Approved-At: Fri, 28 Aug 2020 15:49:39 +0000
X-BeenThere: minios-devel@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Mini-os development list <minios-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:minios-devel@lists.xenproject.org>
List-Help: <mailto:minios-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: minios-devel-bounces@lists.xenproject.org
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>

From: Cezar Craciunoiu <cezar.craciunoiu@gmail.com>

To call the balloon in a fashionable way, the calls were added to bbuddy.
The palloc function calls deflate, pfree and addmem call inflate.

The balloon is first started using the balloon_init function that is called
just once. In the case of KVM, because it does not currently need to
initialize itself by inflating the balloon, the calls to balloon_init and
ukplat_inflate are skipped.

As there might be a need in the future for balloon inflation for KVM, it was
not removed from the original implementation. If needed (for cleaner code),
it can be removed and replaced with a stub.

The balloon calls do not influence the behaviour of bbuddy in a visible way,
meaning that, if something fails in the balloon, it does not affect what
is in bbuddy. Except for the case where an unknown error happens.

Signed-off-by: Cezar Craciunoiu <cezar.craciunoiu@gmail.com>
---
 lib/ukallocbbuddy/Config.uk |   2 +
 lib/ukallocbbuddy/bbuddy.c  | 137 +++++++++++++++++++++++++++++++++++-
 2 files changed, 137 insertions(+), 2 deletions(-)

diff --git a/lib/ukallocbbuddy/Config.uk b/lib/ukallocbbuddy/Config.uk
index c5a3025..5b3f9d2 100644
--- a/lib/ukallocbbuddy/Config.uk
+++ b/lib/ukallocbbuddy/Config.uk
@@ -4,3 +4,5 @@ config LIBUKALLOCBBUDDY
 	select LIBNOLIBC if !HAVE_LIBC
 	select LIBUKDEBUG
 	select LIBUKALLOC
+	select BALLOON if HAVE_KVM
+
diff --git a/lib/ukallocbbuddy/bbuddy.c b/lib/ukallocbbuddy/bbuddy.c
index 85f3e8d..becc36e 100644
--- a/lib/ukallocbbuddy/bbuddy.c
+++ b/lib/ukallocbbuddy/bbuddy.c
@@ -49,6 +49,8 @@
 #include <uk/assert.h>
 #include <uk/page.h>
 
+#include <uk/plat/balloon.h>
+
 typedef struct chunk_head_st chunk_head_t;
 typedef struct chunk_tail_st chunk_tail_t;
 
@@ -242,6 +244,51 @@ static inline unsigned long num_pages_to_order(unsigned long num_pages)
 	return ukarch_flsl(num_pages - 1) + 1;
 }
 
+/*********************
+ * BALLOON SUPPORT
+ */
+
+static char using_balloon;
+
+/**
+ * Initializes the balloon once it is ready. Immediate for Xen,
+ * but later for KVM driver.
+ */
+static void balloon_init(struct uk_alloc *a)
+{
+	struct uk_bbpalloc *b;
+	size_t i;
+	int order;
+	chunk_head_t *chunk;
+	int r;
+
+	b = (struct uk_bbpalloc *)&a->priv;
+
+	ukplat_balloon_set(&using_balloon);
+
+	if (using_balloon != 0)
+		return;
+
+	for (i = 0; i < FREELIST_SIZE; i++) {
+		if (!FREELIST_EMPTY(b->free_head[i])) {
+			chunk = b->free_head[i];
+			order = chunk->level;
+
+			r = ukplat_inflate((void *)chunk, order);
+			if (r < 0) {
+				/* The balloon is ready but
+				 * failed for another reason.
+				 */
+				return;
+			}
+		}
+
+	}
+	using_balloon = 1;
+}
+
+
+
 /*********************
  * BINARY BUDDY PAGE ALLOCATOR
  */
@@ -249,6 +296,7 @@ static void *bbuddy_palloc(struct uk_alloc *a, unsigned long num_pages)
 {
 	struct uk_bbpalloc *b;
 	size_t i;
+	int r;
 	chunk_head_t *alloc_ch, *spare_ch;
 	chunk_tail_t *spare_ct;
 
@@ -291,6 +339,31 @@ static void *bbuddy_palloc(struct uk_alloc *a, unsigned long num_pages)
 	}
 	map_alloc(b, (uintptr_t)alloc_ch, 1UL << order);
 
+	/* Remove the chunk from the balloon - not for KVM */
+	if (using_balloon != 2) {
+		r = ukplat_deflate((void *)alloc_ch, (int)order);
+		if (r < 0) {
+			if (r == -ENXIO) {
+				/* The balloon isn't ready yet!
+				 * We don't need to do anything.
+				 */
+			} else if (r == -ENOSYS) {
+				/* deflation not implemented */
+			} else {
+				/* The balloon is ready but
+				 * failed for another reason.
+				 */
+				return NULL;
+			}
+		} else if (using_balloon == 0) {
+			/* Deflate succeeded for the first time.
+			 * The balloon driver is ready! We need to move
+			 * all of the freelist data to the balloon.
+			 */
+			balloon_init(a);
+		}
+	}
+
 	return ((void *)alloc_ch);
 
 no_memory:
@@ -306,6 +379,7 @@ static void bbuddy_pfree(struct uk_alloc *a, void *obj, unsigned long num_pages)
 	chunk_head_t *freed_ch, *to_merge_ch;
 	chunk_tail_t *freed_ct;
 	unsigned long mask;
+	int r;
 
 	UK_ASSERT(a != NULL);
 	b = (struct uk_bbpalloc *)&a->priv;
@@ -318,6 +392,29 @@ static void bbuddy_pfree(struct uk_alloc *a, void *obj, unsigned long num_pages)
 	/* First free the chunk */
 	map_free(b, (uintptr_t)obj, 1UL << order);
 
+	/* Add the free chunk to the balloon */
+	r = ukplat_inflate((void *)obj, (int)order);
+	if (r < 0) {
+		if (r == -ENXIO) {
+			/* The balloon isn't ready yet!
+			 * We don't need to do anything.
+			 */
+		} else if (r == -ENOSYS) {
+			/* inflateion not implemented */
+		} else {
+			/* The balloon is ready but
+			 * failed for another reason.
+			 */
+			return;
+		}
+	} else if (using_balloon == 0) {
+		/* Inflate succeeded for the first time.
+		 * The balloon driver is now ready!
+		 * We need to move all of the free list data to the balloon.
+		 */
+		balloon_init(a);
+	}
+
 	/* Create free chunk */
 	freed_ch = (chunk_head_t *)obj;
 	freed_ct = (chunk_tail_t *)((char *)obj
@@ -371,6 +468,7 @@ static int bbuddy_addmem(struct uk_alloc *a, void *base, size_t len)
 	chunk_head_t *ch;
 	chunk_tail_t *ct;
 	uintptr_t min, max, range;
+	int r;
 
 	UK_ASSERT(a != NULL);
 	UK_ASSERT(base != NULL);
@@ -431,8 +529,10 @@ static int bbuddy_addmem(struct uk_alloc *a, void *base, size_t len)
 	memset(memr->mm_alloc_bitmap, (unsigned char) ~0,
 			memr->mm_alloc_bitmap_size);
 
-	/* free up the memory we've been given to play with */
-	map_free(b, min, memr->nr_pages);
+
+	/* Mock call to check if the balloon is implemented */
+	if (ukplat_inflate(NULL, 0) == -ENOSYS)
+		map_free(b, min, memr->nr_pages);
 
 	count = 0;
 	while (range != 0) {
@@ -448,6 +548,39 @@ static int bbuddy_addmem(struct uk_alloc *a, void *base, size_t len)
 			    (uintptr_t)a, min, (uintptr_t)(min + (1UL << i)),
 			    (i - __PAGE_SHIFT));
 
+		/*
+		 * For each free block we attempt to add it to the balloon
+		 * Afterwards, if successful, all of our usable memory will be
+		 * in the balloon. It will become accessible by calling deflate
+		 * in ukpalloc, or directly for KVM!
+		 *
+		 * If the balloon device has not yet been added then the
+		 * allocator will proceed without ballooning support until
+		 * the device has been added (KVM).
+		 */
+		r = ukplat_inflate((void *)min, (int)(i - __PAGE_SHIFT));
+		if (r < 0) {
+			if (r == -ENXIO) {
+				/* The balloon isn't ready yet!
+				 * We don't need to do anything.
+				 */
+			} else if (r == -ENOSYS) {
+				/* inflation not implemented */
+			} else {
+				/* The balloon is ready but failed
+				 * for another reason.
+				 */
+				return r;
+			}
+		} else if (using_balloon == 0) {
+			/* Inflate succeeded for the first time.
+			 * The balloon driver is now ready!
+			 * We need to move all of the free list
+			 * data to the balloon.
+			 */
+			balloon_init(a);
+		}
+
 		ch = (chunk_head_t *)min;
 		min += 1UL << i;
 		range -= 1UL << i;
-- 
2.20.1



From minios-devel-bounces@lists.xenproject.org Fri Aug 28 15:49:42 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Fri, 28 Aug 2020 15:49:42 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1kBgdJ-0003An-10; Fri, 28 Aug 2020 15:49:41 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=/7oQ=CG=gmail.com=cezar.craciunoiu@srs-us1.protection.inumbo.net>)
 id 1kBfdK-0002jn-Oo
 for minios-devel@lists.xen.org; Fri, 28 Aug 2020 14:45:38 +0000
X-Inumbo-ID: c2926fe5-47dc-44ae-9cda-eccba1134e23
Received: from mail-ej1-x631.google.com (unknown [2a00:1450:4864:20::631])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id c2926fe5-47dc-44ae-9cda-eccba1134e23;
 Fri, 28 Aug 2020 14:45:29 +0000 (UTC)
Received: by mail-ej1-x631.google.com with SMTP id bo3so1825147ejb.11
 for <minios-devel@lists.xen.org>; Fri, 28 Aug 2020 07:45:29 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=from:to:cc:subject:date:message-id:in-reply-to:references
 :mime-version:content-transfer-encoding;
 bh=JHOiKAsOJAhkuZyB1CUvr6TkH0QcHF6QE+Am1B+B3Po=;
 b=ujVUtmVj9gVWYnhnoDxcrpgDOUOggAMArTcizVFYbVbm4BYjCKMSn3MmlO/HUxYjYY
 EEBkyj4TdTBT43vimIoj50F5zaRhek9CdBACFPBB0UNqeASEz6vhnpaRcrhlj4we118p
 J0x8NFjclsIDxZbEfwQEGp0UVt6hSP4e8qSJtKs6N7vJSMXQEYglLkbAijHjN2btK85C
 wuJYCcXy01QTr8ypjj+m+anGpojtYt1bV9iUasbwv9DJj7fkW5+Jch47PqomS4NhRYjr
 2HNx9knUTCofhFM6h9zDtEIQAyKhRMZoyT0RlX7d1kBQqdUnmyKu7c+5MObkehmW84ho
 kaMQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to
 :references:mime-version:content-transfer-encoding;
 bh=JHOiKAsOJAhkuZyB1CUvr6TkH0QcHF6QE+Am1B+B3Po=;
 b=cl431HPOKyCnyNWVr9iNZzlldWe+eSsi0AcFkitMjE/VNybDxj/xE9kzLYLYNZd7WO
 EuDJ7VcyBOtpgANFghGC93yqI4gmJ1ok+I+AZdq2QnDb91aYKeuE7LwewMhez+LQH6bM
 ngZ89gn9szY3SAleP0DoSCTKjqDzslFNxOd5gcl4zRQ8+mx/uqrOe29zca4ccYwBgvTR
 e3jxDBpgHlSuyUYqEaOaWu5XDQ7VqFkMXxRr3kjZ+EhGZC+nG8um2qMKyB4zz19dMU8Y
 TGyeWAPSNXzQV5g26PDE/muZJbY8B5Vi+GVQm9em2KbiQt8DBLCBpgahLUqAtQubK1Fe
 Y+FA==
X-Gm-Message-State: AOAM530X+6/ZcNs8Z78cXfxVr5yM2Bl9LRDc1HoPxWZqRqFcKrhKOJMS
 c7Jr8Q7sSEYjqeGrKI9X5rI0gYV4xYZTuLuV
X-Google-Smtp-Source: ABdhPJzYi2wwFHtTXEaYW2rr3k7lLeKEZSAZ91K5Htfv78a12T8nW0aC5NdFogPo+ZzpvaG5eTO/ow==
X-Received: by 2002:a17:906:38c7:: with SMTP id
 r7mr2252273ejd.118.1598625928418; 
 Fri, 28 Aug 2020 07:45:28 -0700 (PDT)
Received: from localhost.localdomain ([2a02:2f05:6e05:7200::1003])
 by smtp.gmail.com with ESMTPSA id q7sm1131277edw.96.2020.08.28.07.45.27
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Fri, 28 Aug 2020 07:45:27 -0700 (PDT)
From: CezarCraciunoiu <cezar.craciunoiu@gmail.com>
To: minios-devel@lists.xen.org
Cc: simon.kuenzer@neclab.eu, sharan.santhanam@neclab.eu,
 felipe.huici@neclab.eu, Cezar Craciunoiu <cezar.craciunoiu@gmail.com>
Subject: [UNIKRAFT/BALLOON v2 2/7] plat/drivers/include/balloon: Declared KVM
 driver inflate/deflate functions
Date: Fri, 28 Aug 2020 17:45:18 +0300
Message-Id: <d68e5305e5eb39cddaf0202a59314a92ec7b90bd.1598621743.git.cezar.craciunoiu@gmail.com>
X-Mailer: git-send-email 2.20.1
In-Reply-To: <cover.1598621743.git.cezar.craciunoiu@gmail.com>
References: <cover.1598621743.git.cezar.craciunoiu@gmail.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-Mailman-Approved-At: Fri, 28 Aug 2020 15:49:39 +0000
X-BeenThere: minios-devel@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Mini-os development list <minios-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:minios-devel@lists.xenproject.org>
List-Help: <mailto:minios-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: minios-devel-bounces@lists.xenproject.org
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>

From: Cezar Craciunoiu <cezar.craciunoiu@gmail.com>

These methods represent the two basic functions of the balloon driver,
to inflate and to deflate the memory balloon. These are used by
the balloon.c file and implemented in the balloon_drv.c file.

Signed-off-by: Cezar Craciunoiu <cezar.craciunoiu@gmail.com>
---
 plat/drivers/include/balloon/balloon.h | 46 ++++++++++++++++++++++++++
 1 file changed, 46 insertions(+)
 create mode 100644 plat/drivers/include/balloon/balloon.h

diff --git a/plat/drivers/include/balloon/balloon.h b/plat/drivers/include/balloon/balloon.h
new file mode 100644
index 0000000..83b3b95
--- /dev/null
+++ b/plat/drivers/include/balloon/balloon.h
@@ -0,0 +1,46 @@
+/* SPDX-License-Identifier: BSD-3-Clause */
+/*
+ * Authors: Cason Schindler & Jack Raney <cason.j.schindler@gmail.com>
+ *          Cezar Craciunoiu <cezar.craciunoiu@gmail.com>
+ *
+ * Copyright (c) 2019, The University of Texas at Austin. All rights reserved.
+ *               2020, University Politehnica of Bucharest. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the copyright holder nor the names of its
+ *    contributors may be used to endorse or promote products derived from
+ *    this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ * THIS HEADER MAY NOT BE EXTRACTED OR MODIFIED IN ANY WAY.
+ */
+#ifndef _PLAT_DRV_BALLOON_H_
+#define _PLAT_DRV_BALLOON_H_
+
+#include <inttypes.h>
+#include <sys/types.h>
+
+int deflate_balloon(uintptr_t *pages_to_guest, uint32_t num);
+
+int inflate_balloon(uintptr_t *pages_to_host, uint32_t num);
+
+#endif /* _PLAT_DRV_BALLOON_H_ */
-- 
2.20.1



