From minios-devel-bounces@lists.xenproject.org Tue Dec 01 12:03:02 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Tue, 01 Dec 2020 12:03:02 +0000
Received: from list by lists.xenproject.org with outflank-mailman.41883.75380 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1kk4N2-00043y-Dn; Tue, 01 Dec 2020 12:03:00 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 41883.75380; Tue, 01 Dec 2020 12:03: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 1kk4N2-00043r-Ag; Tue, 01 Dec 2020 12:03:00 +0000
Received: by outflank-mailman (input) for mailman id 41883;
 Tue, 01 Dec 2020 12:02: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=Puf+=FF=upb.ro=vlad_andrei.badoiu@srs-us1.protection.inumbo.net>)
 id 1kk4N0-00043m-PI
 for minios-devel@lists.xen.org; Tue, 01 Dec 2020 12:02:59 +0000
Received: from mx.upb.ro (unknown [141.85.13.200])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id a013d8d2-e754-4282-bdd6-6e999679396d;
 Tue, 01 Dec 2020 12:02:55 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
 by mx.upb.ro (Postfix) with ESMTP id 5C0EEB561E86;
 Tue,  1 Dec 2020 14:02:54 +0200 (EET)
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 VJRKHlUMc2Ct; Tue,  1 Dec 2020 14:02:52 +0200 (EET)
Received: from localhost (localhost [127.0.0.1])
 by mx.upb.ro (Postfix) with ESMTP id 157BEB561E9E;
 Tue,  1 Dec 2020 14:02:52 +0200 (EET)
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 nW_QXgvzsbPI; Tue,  1 Dec 2020 14:02:52 +0200 (EET)
Received: from localhost.localdomain (unknown [188.26.226.218])
 by mx.upb.ro (Postfix) with ESMTPSA id BC5CAB561E86;
 Tue,  1 Dec 2020 14:02:51 +0200 (EET)
X-BeenThere: minios-devel@lists.xenproject.org
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
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: a013d8d2-e754-4282-bdd6-6e999679396d
DKIM-Filter: OpenDKIM Filter v2.10.3 mx.upb.ro 157BEB561E9E
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=upb.ro;
	s=96342B8A-77E4-11E5-BA93-D93D0963A2DF; t=1606824172;
	bh=WoTJqrQ8M0E0wgl2389Oxe9pLpyyYJFP+WhqI0PfRnI=;
	h=From:To:Date:Message-Id:MIME-Version;
	b=sSmXMERysICtMbbtRW6XN4TDQ6Cs+XdRSjVmxnHg1JfY1KPOMRU4Qgsd5ai1vgCPD
	 TdeypOdkD9w1N+EZgFnvAOgNDr1jcoWPkRKwpHtKNWv8lkpbY4gevRiJph9kDdWsl7
	 NLrz4kg6G8eWaMd28xgLNRViKwnH0EpF6mm3H5uQ=
X-Virus-Scanned: amavisd-new at upb.ro
From: Vlad-Andrei Badoiu <vlad_andrei.badoiu@upb.ro>
To: minios-devel@lists.xen.org
Cc: felipe.huici@neclab.eu,
	Vlad-Andrei Badoiu <vlad_andrei.badoiu@upb.ro>
Subject: [UNIKRAFT/SQLITE 1/1] Add sqlite extension
Date: Tue,  1 Dec 2020 14:02:46 +0200
Message-Id: <20201201120246.225603-1-vlad_andrei.badoiu@upb.ro>
X-Mailer: git-send-email 2.27.0
MIME-Version: 1.0
Content-Transfer-Encoding: quoted-printable

This patch adds a config option that enables
the sqlite extensions that may be used by Python.
We also add the sqlite.h to the global headers in
order to be available to Python.

Signed-off-by: Vlad-Andrei Badoiu <vlad_andrei.badoiu@upb.ro>
---
 0001-Fix.patch | 48 ++++++++++++++++++++++++++++++++++++++++++++++++
 Config.uk      |  4 ++++
 Makefile.uk    |  7 ++++++-
 3 files changed, 58 insertions(+), 1 deletion(-)
 create mode 100644 0001-Fix.patch

diff --git a/0001-Fix.patch b/0001-Fix.patch
new file mode 100644
index 0000000..fb87899
--- /dev/null
+++ b/0001-Fix.patch
@@ -0,0 +1,48 @@
+From b05afc39ea86652a89723609ff70401eb4556b76 Mon Sep 17 00:00:00 2001
+From: Vlad-Andrei Badoiu <vlad_andrei.badoiu@upb.ro>
+Date: Tue, 1 Dec 2020 11:51:32 +0000
+Subject: [PATCH 1/1] Fix
+
+---
+ Config.uk   | 4 ++++
+ Makefile.uk | 8 +++++++-
+ 2 files changed, 11 insertions(+), 1 deletion(-)
+
+diff --git a/Config.uk b/Config.uk
+index b32df59..b883326 100644
+--- a/Config.uk
++++ b/Config.uk
+@@ -10,4 +10,8 @@ if LIBSQLITE
+ config LIBSQLITE_MAIN_FUNCTION
+     bool "Provide main function"
+     default y
++
++config LIBSQLITE_ENABLE_EXTERNSIONS
++    bool "Enable mysql extensions"
++    default y
+ endif
+diff --git a/Makefile.uk b/Makefile.uk
+index f8287b7..59dfb13 100644
+--- a/Makefile.uk
++++ b/Makefile.uk
+@@ -60,10 +60,16 @@ LIBSQLITE_SRC =3D $(LIBSQLITE_ORIGIN)/$(LIBSQLITE_BA=
SENAME)
+ LIBSQLITE_CINCLUDES-y +=3D -I$(LIBSQLITE_BASE)/include
+ LIBSQLITE_CINCLUDES +=3D -I$(LIBSQLITE_SRC)
+=20
++CINCLUDES-$(CONFIG_LIBSQLITE)	+=3D $(LIBSQLITE_CINCLUDES)
++
+ #######################################################################=
#########
+ # Global flags
+ #######################################################################=
#########
+-LIBSQLITE_FLAGS =3D -D_HAVE_SQLITE_CONFIG_H -DSQLITE_OMIT_LOAD_EXTENSIO=
N
++libsqlite_flags =3D -d_have_sqlite_config_h=20
++ifneq ($(CONFIG_LIBSQLITE_ENABLE_EXTERNSIONS),y)
++libsqlite_flags =3D -DSQLITE_OMIT_LOAD_EXTENSION
++endif
++
+=20
+ # Suppress some warnings to make the build process look neater
+ LIBSQLITE_SUPPRESS_FLAGS-y +=3D -Wno-unused-parameter -Wno-unused-varia=
ble		\
+--=20
+2.11.0
+
diff --git a/Config.uk b/Config.uk
index b32df59..b883326 100644
--- a/Config.uk
+++ b/Config.uk
@@ -10,4 +10,8 @@ if LIBSQLITE
 config LIBSQLITE_MAIN_FUNCTION
     bool "Provide main function"
     default y
+
+config LIBSQLITE_ENABLE_EXTERNSIONS
+    bool "Enable mysql extensions"
+    default y
 endif
diff --git a/Makefile.uk b/Makefile.uk
index f8287b7..036683a 100644
--- a/Makefile.uk
+++ b/Makefile.uk
@@ -60,10 +60,15 @@ LIBSQLITE_SRC =3D $(LIBSQLITE_ORIGIN)/$(LIBSQLITE_BAS=
ENAME)
 LIBSQLITE_CINCLUDES-y +=3D -I$(LIBSQLITE_BASE)/include
 LIBSQLITE_CINCLUDES +=3D -I$(LIBSQLITE_SRC)
=20
+CINCLUDES-$(CONFIG_LIBSQLITE)	+=3D $(LIBSQLITE_CINCLUDES)
+
 ########################################################################=
########
 # Global flags
 ########################################################################=
########
-LIBSQLITE_FLAGS =3D -D_HAVE_SQLITE_CONFIG_H -DSQLITE_OMIT_LOAD_EXTENSION
+LIBSQLITE_FLAGS +=3D -D_HAVE_SQLITE_CONFIG_H
+ifneq ($(CONFIG_LIBSQLITE_ENABLE_EXTERNSIONS),y)
+LIBSQLITE_FLAGS +=3D -DSQLITE_OMIT_LOAD_EXTENSION
+endif
=20
 # Suppress some warnings to make the build process look neater
 LIBSQLITE_SUPPRESS_FLAGS-y +=3D -Wno-unused-parameter -Wno-unused-variab=
le		\
--=20
2.27.0



From minios-devel-bounces@lists.xenproject.org Tue Dec 01 12:12:21 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Tue, 01 Dec 2020 12:12:21 +0000
Received: from list by lists.xenproject.org with outflank-mailman.41894.75396 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1kk4W4-000563-DG; Tue, 01 Dec 2020 12:12:20 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 41894.75396; Tue, 01 Dec 2020 12:12: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 1kk4W4-00055w-AH; Tue, 01 Dec 2020 12:12:20 +0000
Received: by outflank-mailman (input) for mailman id 41894;
 Tue, 01 Dec 2020 12:12: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=Puf+=FF=upb.ro=vlad_andrei.badoiu@srs-us1.protection.inumbo.net>)
 id 1kk4W2-00055o-Qx
 for minios-devel@lists.xen.org; Tue, 01 Dec 2020 12:12:18 +0000
Received: from mx.upb.ro (unknown [141.85.13.200])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id b47643f2-d2c3-4830-a1e3-09052c57dc0b;
 Tue, 01 Dec 2020 12:12:17 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
 by mx.upb.ro (Postfix) with ESMTP id 6CAC7B561E86;
 Tue,  1 Dec 2020 14:12:16 +0200 (EET)
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 y0cxSLlomVbQ; Tue,  1 Dec 2020 14:12:14 +0200 (EET)
Received: from localhost (localhost [127.0.0.1])
 by mx.upb.ro (Postfix) with ESMTP id 3D259B561EA6;
 Tue,  1 Dec 2020 14:12:14 +0200 (EET)
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 sw69riXzcxQV; Tue,  1 Dec 2020 14:12:14 +0200 (EET)
Received: from localhost.localdomain (unknown [188.26.226.218])
 by mx.upb.ro (Postfix) with ESMTPSA id C7393B561E86;
 Tue,  1 Dec 2020 14:12:13 +0200 (EET)
X-BeenThere: minios-devel@lists.xenproject.org
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
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: b47643f2-d2c3-4830-a1e3-09052c57dc0b
DKIM-Filter: OpenDKIM Filter v2.10.3 mx.upb.ro 3D259B561EA6
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=upb.ro;
	s=96342B8A-77E4-11E5-BA93-D93D0963A2DF; t=1606824734;
	bh=Rt0DkKeQf+6PI4uFE6qptGGn5nwyV6CDhipw+WhmBUU=;
	h=From:To:Date:Message-Id:MIME-Version;
	b=CKmjyhk3IwNAnQWPPnZm08ySJo8n2fi405EiSl56oX8i1r+ht57DUdUuA4nMY3je/
	 UhIv+NHqk7b3fkEePOl4EFNvQaOiPocO0/Psaiq6mQwpStVFgyCSBda8QAJY+WFZgy
	 F/Ph2jSO6Yi2OpQCxmBD5oC7mCPpFwlGxJWTvCfs=
X-Virus-Scanned: amavisd-new at upb.ro
From: Vlad-Andrei Badoiu <vlad_andrei.badoiu@upb.ro>
To: minios-devel@lists.xen.org
Cc: felipe.huici@neclab.eu,
	Vlad-Andrei Badoiu <vlad_andrei.badoiu@upb.ro>
Subject: [UNIKRAFT/PYTHON3 1/1] Fix sqlite module
Date: Tue,  1 Dec 2020 14:09:17 +0200
Message-Id: <20201201120917.226063-1-vlad_andrei.badoiu@upb.ro>
X-Mailer: git-send-email 2.27.0
MIME-Version: 1.0
Content-Transfer-Encoding: quoted-printable

This patch fixes the sqlite module. Python now compiles when
the sqlite extension is selected from menuconfig.

Signed-off-by: Vlad-Andrei Badoiu <vlad_andrei.badoiu@upb.ro>
---
 Makefile.uk      | 19 ++++++++++---------
 modules_config.c |  4 ++++
 2 files changed, 14 insertions(+), 9 deletions(-)

diff --git a/Makefile.uk b/Makefile.uk
index efd58a1..c718b3c 100644
--- a/Makefile.uk
+++ b/Makefile.uk
@@ -419,15 +419,16 @@ LIBPYTHON3_EXTENSIONS_SRCS-y +=3D $(LIBPYTHON3_SRC)=
/Modules/sha512module.c
 LIBPYTHON3_EXTENSIONS_SRCS-y +=3D $(LIBPYTHON3_SRC)/Modules/socketmodule=
.c
 # TODO enable LIBPYTHON3_EXTENSIONS_SRCS-y +=3D $(LIBPYTHON3_SRC)/Module=
s/spwdmodule.c
 ifeq ($(CONFIG_LIBPYTHON3_EXTENSION_SQLITE),y)
-LIBPYTHON3_EXTENSIONS_SRCS-y +=3D $(LIBPYTHON3_SRC)/Modules/_sqlite/cach=
e.c
-LIBPYTHON3_EXTENSIONS_SRCS-y +=3D $(LIBPYTHON3_SRC)/Modules/_sqlite/conn=
ection.c
-LIBPYTHON3_EXTENSIONS_SRCS-y +=3D $(LIBPYTHON3_SRC)/Modules/_sqlite/curs=
or.c
-LIBPYTHON3_EXTENSIONS_SRCS-y +=3D $(LIBPYTHON3_SRC)/Modules/_sqlite/micr=
oprotocols.c
-LIBPYTHON3_EXTENSIONS_SRCS-y +=3D $(LIBPYTHON3_SRC)/Modules/_sqlite/modu=
le.c
-LIBPYTHON3_EXTENSIONS_SRCS-y +=3D $(LIBPYTHON3_SRC)/Modules/_sqlite/prep=
are_protocol.c
-LIBPYTHON3_EXTENSIONS_SRCS-y +=3D $(LIBPYTHON3_SRC)/Modules/_sqlite/row.=
c
-LIBPYTHON3_EXTENSIONS_SRCS-y +=3D $(LIBPYTHON3_SRC)/Modules/_sqlite/stat=
ement.c
-LIBPYTHON3_EXTENSIONS_SRCS-y +=3D $(LIBPYTHON3_SRC)/Modules/_sqlite/util=
.c
+LIBPYTHON3_EXTENSIONS_CFLAGS-y    +=3D -DMODULE_NAME=3D"\"sqlite3\""
+LIBPYTHON3_EXTENSIONS_SRCS-y +=3D $(LIBPYTHON3_SRC)/Modules/_sqlite/cach=
e.c|sqlite
+LIBPYTHON3_EXTENSIONS_SRCS-y +=3D $(LIBPYTHON3_SRC)/Modules/_sqlite/conn=
ection.c|sqlite
+LIBPYTHON3_EXTENSIONS_SRCS-y +=3D $(LIBPYTHON3_SRC)/Modules/_sqlite/curs=
or.c|sqlite
+LIBPYTHON3_EXTENSIONS_SRCS-y +=3D $(LIBPYTHON3_SRC)/Modules/_sqlite/micr=
oprotocols.c|sqlite
+LIBPYTHON3_EXTENSIONS_SRCS-y +=3D $(LIBPYTHON3_SRC)/Modules/_sqlite/modu=
le.c|sqlite
+LIBPYTHON3_EXTENSIONS_SRCS-y +=3D $(LIBPYTHON3_SRC)/Modules/_sqlite/prep=
are_protocol.c|sqlite
+LIBPYTHON3_EXTENSIONS_SRCS-y +=3D $(LIBPYTHON3_SRC)/Modules/_sqlite/row.=
c|sqlite
+LIBPYTHON3_EXTENSIONS_SRCS-y +=3D $(LIBPYTHON3_SRC)/Modules/_sqlite/stat=
ement.c|sqlite
+LIBPYTHON3_EXTENSIONS_SRCS-y +=3D $(LIBPYTHON3_SRC)/Modules/_sqlite/util=
.c|sqlite
 endif
 LIBPYTHON3_EXTENSIONS_SRCS-$(CONFIG_LIBPYTHON3_EXTENSION_SSL) +=3D $(LIB=
PYTHON3_SRC)/Modules/_ssl.c
 LIBPYTHON3_EXTENSIONS_SRCS-y +=3D $(LIBPYTHON3_SRC)/Modules/_struct.c
diff --git a/modules_config.c b/modules_config.c
index 7772d00..1bb591c 100644
--- a/modules_config.c
+++ b/modules_config.c
@@ -145,6 +145,10 @@ extern PyObject* PyInit_zipimport(void);
 #ifdef CONFIG_LIBZLIB
 extern PyObject* PyInit_zlib(void);
 #endif
+#if CONFIG_LIBPYTHON3_EXTENSION_SQLITE
+extern PyObject* PyInit__sqlite3(void);
+#endif
+
 /* Unikraft Marker end */
 /* -- ADDMODULE MARKER 1 -- */
=20
--=20
2.27.0



From minios-devel-bounces@lists.xenproject.org Tue Dec 01 18:35:54 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Tue, 01 Dec 2020 18:35:54 +0000
Received: from list by lists.xenproject.org with outflank-mailman.42249.75958 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1kkAVB-0002u9-JX; Tue, 01 Dec 2020 18:35:49 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 42249.75958; Tue, 01 Dec 2020 18:35:49 +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 1kkAVB-0002u2-GS; Tue, 01 Dec 2020 18:35:49 +0000
Received: by outflank-mailman (input) for mailman id 42249;
 Tue, 01 Dec 2020 18:35: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=D4MR=FF=gmail.com=alicesuiu17@srs-us1.protection.inumbo.net>)
 id 1kkAVA-0002tx-Bg
 for minios-devel@lists.xen.org; Tue, 01 Dec 2020 18:35:48 +0000
Received: from mail-ed1-x544.google.com (unknown [2a00:1450:4864:20::544])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 4077e56d-b324-4139-8ecc-e903b4cf8584;
 Tue, 01 Dec 2020 18:35:47 +0000 (UTC)
Received: by mail-ed1-x544.google.com with SMTP id j14so1807460edy.3
 for <minios-devel@lists.xen.org>; Tue, 01 Dec 2020 10:35:47 -0800 (PST)
Received: from localhost.localdomain ([86.120.239.186])
 by smtp.gmail.com with ESMTPSA id t26sm282947edt.69.2020.12.01.10.35.44
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Tue, 01 Dec 2020 10:35:45 -0800 (PST)
X-BeenThere: minios-devel@lists.xenproject.org
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
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: 4077e56d-b324-4139-8ecc-e903b4cf8584
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20161025;
        h=from:to:cc:subject:date:message-id;
        bh=jFH7Pf3JaigDPE0sNSr+08teL3Xc8a/TffffOu46USY=;
        b=dLpAWLnAzdc6DJY0uanVECIi+q5021VcdmaTItW5mnEZ6ZPCg76zlUff0mlV77aO1P
         7Em2H0L5F0rIVBOAiMlFMJT4YDVREts7bz3rX503EuD/2CLD7Egv16nfBZ7wKq+W0jNH
         4CLer4pJ1pZjF2KBc9MxYOBs7f21PhLBmwLArJs5clHxG9UWEe/qCz1G0KsGVC1HY9n7
         bHmmF1bKD0dTdAM0ALMNslkDGJDwhcyDPr8umIYpeEGRGDHjeEtR7K16CwWmGt66O7+o
         Dkr4dnXhaVsEXZKP++JdQYHyJbo949++AzV7j5aE0uEgHhxwugnRm+xTwS/DzBymVGX7
         ga1Q==
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=jFH7Pf3JaigDPE0sNSr+08teL3Xc8a/TffffOu46USY=;
        b=Rb2YKPpoF07p/2sHJLb+VV4a7fkL6XFPtIO1U4Uglliv8f9AHdzmMY5GW3pC6pb4Kz
         EKmQhDKWVDOY59Vdq9RI3CIBcDHfNxwrWuGCv10HbFxufYCULm8rTR9B6IlqCo4c0Q/5
         zOfdvMM98Ed65F3t56V4GlJi5Wk0s+x9beATsetTTHmwKOnGQ2gNDL87+FhCY10/4d5v
         6XFLcv5+qLMAWkqVYAlzcZIWMkaT2DRVzzlaQSxTIx8GiyB1Ur2PKdm2LhhM2vV4jBms
         mzFknwyMxLIftkE4Ih/0E7lLgjdbk1w45NntTDoPW4D7KaPiwrnk8VERdIJlyBRkdWd/
         Oihg==
X-Gm-Message-State: AOAM530y60aTwZS66Elgg9qWsuyr11x5zta3kBf4O345mYdreCjxlxUI
	FhaW5a7/wF1RPnCIN/OOg0P7Yk8PcZxS4g==
X-Google-Smtp-Source: ABdhPJzzgrMfdKxQ5oXKLSqH0WYYDzYPf7kwlJvTf05Kt+zsCzEMfDQdPlN4OuXS/HF4A6Bu3e7Klg==
X-Received: by 2002:a05:6402:36a:: with SMTP id s10mr406065edw.216.1606847745907;
        Tue, 01 Dec 2020 10:35:45 -0800 (PST)
From: Alice Suiu <alicesuiu17@gmail.com>
To: minios-devel@lists.xen.org
Cc: razvan.deaconescu@cs.pub.ro,
	felipe.huici@neclab.eu,
	alicesuiu <alicesuiu17@gmail.com>
Subject: [LIBGCC/LIBGCOV PATCH v3 1/2] Add documentation for libgcov
Date: Tue,  1 Dec 2020 20:35:38 +0200
Message-Id: <20201201183539.30682-1-alicesuiu17@gmail.com>
X-Mailer: git-send-email 2.17.1

From: alicesuiu <alicesuiu17@gmail.com>

Signed-off-by: Alice Suiu <alicesuiu17@gmail.com>
---
 README.md | 36 ++++++++++++++++++++++++++++++++++--
 1 file changed, 34 insertions(+), 2 deletions(-)

diff --git a/README.md b/README.md
index e3460cd..5baa2c8 100644
--- a/README.md
+++ b/README.md
@@ -4,8 +4,9 @@ gcc for Unikraft
 This is a port of gcc for Unikraft as an external library.
 
 For the time being we only port libbacktrace and libffi libraries as
-they are needed for the libgo port. You will need newlib for both
-libraries to build. In addition, 
+they are needed for the libgo port and libgcov library because it is needed
+for the PGO (Profile-Guided Optimization) mechanism. You will need newlib
+for all three libraries to build. In addition, 
 
 For libffi you will need the pthread\_embedded external library too.
 
@@ -19,5 +20,36 @@ Note that because of a documented bug in libunwind `unw_getcontext`
 leads to a page fault, and in turn `backtrace_full`will also lead to
 one as it uses `_Unwind_Backtrace` which calls `unw_getcontext`.
 
+For libgcov you will need the following libraries that should be added to the
+`Makefile` in this order:
+
+* `pthreads`, e.g `pthread-embedded`
+* `compiler-rt`
+* `libcxx`
+* `libcxxabi`
+* `libunwind`
+* `libc`, e.g. `newlib`
+
+In order to use the `PGO` mechanism, the `-fprofile-generate` and `-fprofile-use`
+flags should be added to the `Makefile.uk` of the application running in Unikraft.
+
+For example, if you want to use the `PGO` mechanism for the `helloworld`
+application you have to add the following lines in the `Makefile.uk`:
+
+```
+APPHELLOWORLD_CFLAGS-$(CONFIG_OPTIMIZE_PGO_GENERATE)	+= -fprofile-generate
+APPHELLOWORLD_CFLAGS-$(CONFIG_OPTIMIZE_PGO_USE)        += -fprofile-use
+```
+
+Several header files should be generated to successfully compile the source files
+from the libgcov library. These headers have already been generated in the
+`libgcov/include` directory. If you want to generate again the files, you need
+to download the `GCC` sources and run the following commands:
+
+* in the `libgcc` directory:
+`make auto-target.h gthr-default.h libgcc_tm.h`
+* in the `gcc` directory:
+`make tconfig.h tm.h auto-host.h gcov-iov.h`
+
 Please refer to the `README.md` as well as the documentation in the `doc/`
 subdirectory of the main unikraft repository for further information.
-- 
2.17.1



From minios-devel-bounces@lists.xenproject.org Tue Dec 01 18:35:57 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Tue, 01 Dec 2020 18:35:57 +0000
Received: from list by lists.xenproject.org with outflank-mailman.42250.75962 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1kkAVJ-0002uq-LT; Tue, 01 Dec 2020 18:35:57 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 42250.75962; Tue, 01 Dec 2020 18:35: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 1kkAVJ-0002uj-IJ; Tue, 01 Dec 2020 18:35:57 +0000
Received: by outflank-mailman (input) for mailman id 42250;
 Tue, 01 Dec 2020 18:35: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=D4MR=FF=gmail.com=alicesuiu17@srs-us1.protection.inumbo.net>)
 id 1kkAVI-0002uY-Bd
 for minios-devel@lists.xen.org; Tue, 01 Dec 2020 18:35:56 +0000
Received: from mail-ed1-x541.google.com (unknown [2a00:1450:4864:20::541])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id f0a70435-d0c8-4a04-9719-33a4d7ddc5dc;
 Tue, 01 Dec 2020 18:35:55 +0000 (UTC)
Received: by mail-ed1-x541.google.com with SMTP id j14so1808219edy.3
 for <minios-devel@lists.xen.org>; Tue, 01 Dec 2020 10:35:55 -0800 (PST)
Received: from localhost.localdomain ([86.120.239.186])
 by smtp.gmail.com with ESMTPSA id t26sm282947edt.69.2020.12.01.10.35.53
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Tue, 01 Dec 2020 10:35:54 -0800 (PST)
X-BeenThere: minios-devel@lists.xenproject.org
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
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: f0a70435-d0c8-4a04-9719-33a4d7ddc5dc
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;
        bh=CkEpxZPhOyMyfR7LX7P1iXrjmcROVPgMSMVJxAXRPac=;
        b=NNUOa1SbSsP6ddbJ50tw5xufUD1lEKhKKvx4Da4NKriZ1TRjYs0w64rUfPwr6UAVJs
         ACr3WJbmel1mDiYrFnvx/IuKS/8aM5xItEE+CFu72phOqCBcSWPTdbEG4x3RA1Wsyo7z
         gZ4lEWid+sxXyY1jkmxA2QcPpF3HQvJCzRzFHm4i2OM5dhm3jz+cCvwheaSn4SlJ7Jyx
         QIR8xmS22ouAw7lak7YwqEfGE44Dhmanh2glMS+Hq14ykOvob4h6IA2OzHwFS84OzA+w
         wbEteOvhCTaZhUM57cQDUEQjC5jVk01uvLt+XbbiUmH6qHSgGpzmdy5Xr2YuVkyVr+1I
         Tzgw==
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;
        bh=CkEpxZPhOyMyfR7LX7P1iXrjmcROVPgMSMVJxAXRPac=;
        b=Mlx0I5TKbTHeBStUnA60U2vVnBgpeS8JNsJKPeeIhIIk6ItXaa6kjh4BZk+fc8OmNW
         I2Q7PMEf7Xq0fCyCNuPHm7d5TUgt2YyLeZGMjFlt9xoCrznu74o3tw9aHsTunztUPOX6
         c/FDpYpaSxKQSczEBwmJEpRHLxmTc96y45NcoCqeHmko0pcU/bLV2gGDfGL9309OiO64
         VigD2yGmv+yI35snhfzCVAhMYTW+5oLdneSb6Lhwy9GBpnnQrTzWl1eZmevVnLDgp/Ur
         6+6mxkp8Z70Ry7j0jcJH5YIRwAyNsgIq7n+L6opAAE2cSXtvtpsqmKnOnzKcCbF3hyyP
         Ve9w==
X-Gm-Message-State: AOAM530KH+eMu/P2KrgRDo5IA44PTGek+hUg+zbs0dhIr6ztuB3cCG+n
	z32dHCRseSk7TKCuJNY+uiEO3uHQ40oGUQ==
X-Google-Smtp-Source: ABdhPJwNNq5j07htQzabbTqPoZAmwgE3mrN4TKcGvY1BPQNmBUOz3LEN5voV+FADjwZn3LDxUXOC3w==
X-Received: by 2002:aa7:d154:: with SMTP id r20mr4617619edo.258.1606847754414;
        Tue, 01 Dec 2020 10:35:54 -0800 (PST)
From: Alice Suiu <alicesuiu17@gmail.com>
To: minios-devel@lists.xen.org
Cc: razvan.deaconescu@cs.pub.ro,
	felipe.huici@neclab.eu,
	Alice Suiu <alicesuiu17@gmail.com>
Subject: [LIBGCC/LIBGCOV PATCH v3 2/2] Add extra comments
Date: Tue,  1 Dec 2020 20:35:39 +0200
Message-Id: <20201201183539.30682-2-alicesuiu17@gmail.com>
X-Mailer: git-send-email 2.17.1
In-Reply-To: <20201201183539.30682-1-alicesuiu17@gmail.com>
References: <20201201183539.30682-1-alicesuiu17@gmail.com>

Signed-off-by: Alice Suiu <alicesuiu17@gmail.com>
---
 Makefile.uk | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/Makefile.uk b/Makefile.uk
index 435b098..080243a 100644
--- a/Makefile.uk
+++ b/Makefile.uk
@@ -129,13 +129,17 @@ LIBFFI_SRCS-$(CONFIG_ARCH_X86_64) += $(LIBFFI_EXTRACTED)/src/x86/unix64.S
 LIBGCOV_CINCLUDES-y = -I$(LIBGCC_BASE)/libgcov/include  -I$(LIBGCC_EXTRACTED)/include \
 		-I$(LIBGCC_EXTRACTED)/gcc -I$(LIBGCC_EXTRACTED)/libgcc
 
+# each function in the gcov library is defined by a macro. Thus, in order to be able to
+# compile and access a function from gcov, the macro associated with it should be added
+# to the compilation
+
 LIBGCOV_CFLAGS-y += -DIN_LIBGCC2 -fbuilding-libgcc -fno-stack-protector \
 	-DHAVE_CC_TLS -DL_gcov_merge_add -DL_gcov_merge_single -DL_gcov_merge_ior -DL_gcov_merge_time_profile -DL_gcov_merge_icall_topn \
 	-DL_gcov_interval_profiler -DL_gcov_interval_profiler_atomic -DL_gcov_pow2_profiler -DL_gcov_pow2_profiler_atomic \
-	-DL_gcov_one_value_profiler -DL_gcov_one_value_profiler_atomic -DL_gcov_average_profiler -DL_gcov_average_profiler_atomic	\
+	-DL_gcov_one_value_profiler -DL_gcov_one_value_profiler_atomic -DL_gcov_average_profiler -DL_gcov_average_profiler_atomic \
 	-DL_gcov_ior_profiler -DL_gcov_ior_profiler_atomic -DL_gcov_indirect_call_profiler_v2 -DL_gcov_time_profiler \
 	-DL_gcov_indirect_call_topn_profiler -DL_gcov_dump -DL_gcov_flush -DL_gcov_fork -DL_gcov_execl -DL_gcov_execlp -DL_gcov_execle \
-	-DL_gcov_execv -DL_gcov_execvp -DL_gcov_execve -DL_gcov_reset -DL_gcov \
+	-DL_gcov_execv -DL_gcov_execvp -DL_gcov_execve -DL_gcov_reset -DL_gcov
 
 LIBGCOV_SRCS-y += $(LIBGCC_EXTRACTED)/libgcc/libgcov-merge.c
 LIBGCOV_SRCS-y += $(LIBGCC_EXTRACTED)/libgcc/libgcov-profiler.c
-- 
2.17.1



From minios-devel-bounces@lists.xenproject.org Wed Dec 02 05:09:14 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Wed, 02 Dec 2020 05:09:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.42432.76298 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1kkKO6-0003MX-Hp; Wed, 02 Dec 2020 05:09:10 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 42432.76298; Wed, 02 Dec 2020 05:09: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 1kkKO6-0003MP-E4; Wed, 02 Dec 2020 05:09:10 +0000
Received: by outflank-mailman (input) for mailman id 42432;
 Wed, 02 Dec 2020 05:09:08 +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=YnCb=FG=arm.com=jianyong.wu@srs-us1.protection.inumbo.net>)
 id 1kkKO4-0003MK-Ai
 for minios-devel@lists.xenproject.org; Wed, 02 Dec 2020 05:09:08 +0000
Received: from EUR05-DB8-obe.outbound.protection.outlook.com (unknown
 [40.107.20.71]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 4161a866-519c-4066-a434-945a689cfe87;
 Wed, 02 Dec 2020 05:09:05 +0000 (UTC)
Received: from AM7PR04CA0020.eurprd04.prod.outlook.com (2603:10a6:20b:110::30)
 by HE1PR0802MB2444.eurprd08.prod.outlook.com (2603:10a6:3:df::13)
 with Microsoft SMTP Server (version=TLS1_2,
 cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3611.25; Wed, 2 Dec
 2020 05:09:01 +0000
Received: from VE1EUR03FT038.eop-EUR03.prod.protection.outlook.com
 (2603:10a6:20b:110:cafe::27) by AM7PR04CA0020.outlook.office365.com
 (2603:10a6:20b:110::30) with Microsoft SMTP Server (version=TLS1_2,
 cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3632.17 via Frontend
 Transport; Wed, 2 Dec 2020 05:09:01 +0000
Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by
 VE1EUR03FT038.mail.protection.outlook.com (10.152.19.112) with
 Microsoft SMTP
 Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id
 15.20.3632.17 via Frontend Transport; Wed, 2 Dec 2020 05:09:00 +0000
Received: ("Tessian outbound 6ec21dac9dd3:v71");
 Wed, 02 Dec 2020 05:09:00 +0000
Received: from 0f288873eb84.2
 by 64aa7808-outbound-1.mta.getcheckrecipient.com id
 BB78D5BC-E8EF-46CF-8386-7D8379956EEE.1; 
 Wed, 02 Dec 2020 05:08:55 +0000
Received: from EUR04-HE1-obe.outbound.protection.outlook.com
 by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 0f288873eb84.2
 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384);
 Wed, 02 Dec 2020 05:08:55 +0000
Received: from HE1PR0802MB2555.eurprd08.prod.outlook.com (2603:10a6:3:e0::7)
 by HE1PR08MB2826.eurprd08.prod.outlook.com (2603:10a6:7:31::11) with
 Microsoft SMTP Server (version=TLS1_2,
 cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3632.18; Wed, 2 Dec
 2020 05:08:50 +0000
Received: from HE1PR0802MB2555.eurprd08.prod.outlook.com
 ([fe80::9930:b22f:9e8c:8200]) by HE1PR0802MB2555.eurprd08.prod.outlook.com
 ([fe80::9930:b22f:9e8c:8200%5]) with mapi id 15.20.3632.017; Wed, 2 Dec 2020
 05:08:49 +0000
X-BeenThere: minios-devel@lists.xenproject.org
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
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: 4161a866-519c-4066-a434-945a689cfe87
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com;
 s=selector2-armh-onmicrosoft-com;
 h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck;
 bh=Y70MAGTtvDv9d/xtiQwZIW72g5lBqQqKAB51hsFRp5U=;
 b=O4dYwuAdUGB+e82YGdz9IpsLaWQ19m5LcEg0BHrZr5GvyxagubWf449rxcE9qTqzcTanobWHiiDqEL+UTGPKBHHWUuiXVFcrVexYMlTPdvbELwbLM/7+6aH2uY6cIaSs5ViDWdgQuzG86U9uhIrcUNtEexNgaROYiwj+VTpaWPI=
X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.35.35.123)
 smtp.mailfrom=arm.com; lists.xenproject.org; dkim=pass (signature was
 verified) header.d=armh.onmicrosoft.com;lists.xenproject.org; dmarc=pass
 action=none header.from=arm.com;
Received-SPF: Pass (protection.outlook.com: domain of arm.com designates
 63.35.35.123 as permitted sender) receiver=protection.outlook.com;
 client-ip=63.35.35.123; helo=64aa7808-outbound-1.mta.getcheckrecipient.com;
X-CR-MTA-TID: 64aa7808
ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none;
 b=YxGsdHc/vRZQ32hXLLr/1zKEbABxjppvXA7RbuQBKo+gUSl5VeJIH6uAbUoPwnelbIrJN/Ve2LX99Of7LWB37igplogGdNRrtb7qR6olaGctxN0swk8hI/LR3z5h7pwD0vyVVj2wX1f7jDFniM9aHhqUX6h0X5Uet4fHaFHVV4v2J7OnALPauAhc9ekxnlDfxU6biuqjCY3NidHWL4sjurQcZYVq0nNylm7tTR/gzxt2G3JL+f4bOmdTDDPOGE5xAajtsIRFOeeL9Ix9eECoDFwoflwgzw91Yt9S8BkZ+ZuQPLQPhpipgxPyA8mBjrWbHAlW2GyfcdJJVsPG8ci6UQ==
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=Y70MAGTtvDv9d/xtiQwZIW72g5lBqQqKAB51hsFRp5U=;
 b=oHABlzlb8gmNm5ZWH8jBxobtBKhxM7iMB+CQpA4q/WPQRhoSjrvpfufTsQR2AbBu6t4Nyso+724Bw2eAuz309F7ic48QNKmAdMwcpmtj/5VvT/fCrNlrHloWdWwxGrANQOnkxCPWpqO6vMbNoi5m0ZLwccTuJODrHhTN7PVFouytwepuHeQGacwEifnYsjC+lP4MEtBL9eiBcUyEO6Vd/JFNiPCLk0NEvt7arWpTr6ybeETN72nfbt6SyiTuSxDekZLhxVxMvu18VpZb8cTvz7XxiyPvtqUVnDdaC74ANC+UD9AGXCxAUbLBeYVlJuZj+ljFJtQZf94Op4B+KYdLiw==
ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass
 smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass
 header.d=arm.com; arc=none
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com;
 s=selector2-armh-onmicrosoft-com;
 h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck;
 bh=Y70MAGTtvDv9d/xtiQwZIW72g5lBqQqKAB51hsFRp5U=;
 b=O4dYwuAdUGB+e82YGdz9IpsLaWQ19m5LcEg0BHrZr5GvyxagubWf449rxcE9qTqzcTanobWHiiDqEL+UTGPKBHHWUuiXVFcrVexYMlTPdvbELwbLM/7+6aH2uY6cIaSs5ViDWdgQuzG86U9uhIrcUNtEexNgaROYiwj+VTpaWPI=
From: Jianyong Wu <Jianyong.Wu@arm.com>
To: Sharan Santhanam <sharan.santhanam@neclab.eu>,
	"minios-devel@lists.xenproject.org" <minios-devel@lists.xenproject.org>,
	"simon.kuenzer@neclab.eu" <simon.kuenzer@neclab.eu>
CC: Justin He <Justin.He@arm.com>, Wei Chen <Wei.Chen@arm.com>
Subject: RE: [Minios-devel] [PATCH] arm/rtc: enable pl031 for arm64.
Thread-Topic: [Minios-devel] [PATCH] arm/rtc: enable pl031 for arm64.
Thread-Index: AQHWB0LT0W7EMY1atkSduebKZyeGQaniZIUAgAI+wlA=
Date: Wed, 2 Dec 2020 05:08:49 +0000
Message-ID:
 <HE1PR0802MB25556B8C059409A3D31979B8F4F30@HE1PR0802MB2555.eurprd08.prod.outlook.com>
References: <20200331095711.44593-1-jianyong.wu@arm.com>
 <b635ae64-5753-09ff-2a2c-5a5f5d4fc336@neclab.eu>
In-Reply-To: <b635ae64-5753-09ff-2a2c-5a5f5d4fc336@neclab.eu>
Accept-Language: en-US
Content-Language: en-US
X-MS-Has-Attach:
X-MS-TNEF-Correlator:
x-ts-tracking-id: 61D43D8C80A03945930265FCDC78873D.0
x-checkrecipientchecked: true
Authentication-Results-Original: neclab.eu; dkim=none (message not signed)
 header.d=none;neclab.eu; dmarc=none action=none header.from=arm.com;
x-originating-ip: [203.126.0.111]
x-ms-publictraffictype: Email
X-MS-Office365-Filtering-HT: Tenant
X-MS-Office365-Filtering-Correlation-Id: dd044490-3015-4b01-9990-08d896806194
x-ms-traffictypediagnostic: HE1PR08MB2826:|HE1PR0802MB2444:
x-ms-exchange-transport-forked: True
X-Microsoft-Antispam-PRVS:
	<HE1PR0802MB2444773E867694AA85BBE5C2F4F30@HE1PR0802MB2444.eurprd08.prod.outlook.com>
x-checkrecipientrouted: true
nodisclaimer: true
x-ms-oob-tlc-oobclassifiers: OLM:7691;OLM:8882;
X-MS-Exchange-SenderADCheck: 1
X-Microsoft-Antispam-Untrusted: BCL:0;
X-Microsoft-Antispam-Message-Info-Original:
 /v/Aba730s3oeRA29I8qn/1QmMGr7BZ/7Zn5rIxViNfUMQSEZ0rH2cEMjY5B/rWqPs1/aGXzWgAclzlrWcg5ArfKogkzZCD7BpMswiFiFXcjjXHAYvDNBAcPMkFvlYzZat1vGB9EWfrorflW3wOiWBChkaIyrZAFXt1oxR85iDuc4gs+qS7C5pf8NYQOOk/Wvy3x1E8brFATd5ai5DhIsu8W7cR9iFUWhg1xyYSj5sQkYUo6JnUkwkf0YouMyC403XGfhvPlH6IQIOfoJNzJcwNvQ/IBO/J6oyPWJ97WgkVSry32BUXJn7FK88+hljHITaiOuKqwiLS9pRcn3TGGpg==
X-Forefront-Antispam-Report-Untrusted:
 CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:HE1PR0802MB2555.eurprd08.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(39850400004)(396003)(346002)(366004)(376002)(136003)(2906002)(71200400001)(316002)(7696005)(9686003)(55016002)(478600001)(53546011)(8676002)(6506007)(33656002)(8936002)(83380400001)(110136005)(54906003)(5660300002)(52536014)(66946007)(76116006)(66446008)(64756008)(66476007)(66556008)(30864003)(26005)(186003)(86362001)(4326008);DIR:OUT;SFP:1101;
x-ms-exchange-antispam-messagedata:
 =?utf-8?B?U3MwU3dMM1VwZVRXZmIzRHdldVc2L2dCVTBUWGVKQzVzcmlBbjdHUnVXUEJZ?=
 =?utf-8?B?Q3JDcmxwRjhaUXJSQmMzbUNKWmhCWWl3OWVhYWRyNzU2dkNSbCtaeUZ4RHpO?=
 =?utf-8?B?UmsxNFVMWEt6NWV5WnFWS29HTWtpbFRRdkorNlA1UCtDK3B6ZFppRWR6QXhH?=
 =?utf-8?B?Vm5uWU9QMnQ4eEV0cy94enc4aUVadlVHY1NtczdGdHlzOGRPc1lTMm5qbFl5?=
 =?utf-8?B?ZkR6dnpvaWhzcjc3Vnd5bjl1bElRdksxZXY4Z0kyT2lNdk1EaFJ2TDBWV1Yx?=
 =?utf-8?B?T1ZaMWQ1RHNUWDVGb1pyZHpLbk9DSXUrblFMVFAzbkoyYU9xTFBaMXdSUzNm?=
 =?utf-8?B?SmdCK1ZPSW1nZEx1UFltbUVMaGg1ektxSUd0Ti9TaFkzZm1rd05KTVNvZHcz?=
 =?utf-8?B?OWg5cU9yWXBJQ0VneGpWdXZqakNXNUZNRGZBZEhXUFVGckhXRHBUN3lOODhs?=
 =?utf-8?B?dkd5QUJ5WjV5WXc2VXQxL0FNem1qRENZcm5DcFRwcGVYQS90QVcrMHpNcjdB?=
 =?utf-8?B?SUtRSkd1TlVhZXFEaExHTU03Ti9keEZaeEJVSjRQTFdBWDYvMmRac1dyam13?=
 =?utf-8?B?SjBwNENYYi9CdGtOTmF4RmV5NFJNMk9uNmlhY0dUaTh1U21DL0w2dVpsMGhY?=
 =?utf-8?B?c1E5ZVltQTNBdnZUcE9MeGxlQ2tvcUFyT0RCeXk4Y3VpMnlMMjJKL1hKbURG?=
 =?utf-8?B?eHA4ODNsZGZsY2thK0hMNENmTGgwSzV5TU9GYXZBNmRQaWRpY21FdTJpTit0?=
 =?utf-8?B?cUpkV0tySkhzZGxYTkQ5a3MzQmQzU2VqSVc5dExQWlhwWTdPMzVMKzN3RURD?=
 =?utf-8?B?WHBzdjQyNnFpMFpnQlNBN1VFbjBTaWdISnJFdFQrTHR2YnkrakNHQXJxWlZy?=
 =?utf-8?B?cXJIY0lIeFd4VW52Z1Q1S1NhS0RZNFJUeVh6SDBvRkNiZXc3SkpuUk5tVE8z?=
 =?utf-8?B?aUVWcjdMWVY3V05ZRWJkQmhuMmY5NVYvSHZQSlF0MjdLUDdjNmg5dHA2RHhz?=
 =?utf-8?B?UEt5WHVyWERJcElzNkg0T0NYaExxbS80TjR0SHZ1cDdwYlh5eENGWHdJdEtK?=
 =?utf-8?B?SGdEWlExT3pXTE5Ja21ia2IwaDNpNGVuaGprRnJGaEJHV3c2eTZzRXg3VHBE?=
 =?utf-8?B?bkJPeFpUL3VIN1k2RUlBQkdVNDVFbkFtZ3VPNVljcWNhVWx2d1FiZll0YlJ2?=
 =?utf-8?B?aW5UdG9BMTJ1MSs5UmpienE4RnRlVjlQZUVwSXdKZkFPY0RnK0orekU2T3cx?=
 =?utf-8?B?aGhvUDJoY1ZEbkhUa25FUlVldTBqNTRBV2V6QzJkNGZFSVBPRjR1bnNxR09N?=
 =?utf-8?Q?AsXBrNLx/pkh0=3D?=
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: base64
MIME-Version: 1.0
X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR08MB2826
Original-Authentication-Results: neclab.eu; dkim=none (message not signed)
 header.d=none;neclab.eu; dmarc=none action=none header.from=arm.com;
X-EOPAttributedMessage: 0
X-MS-Exchange-Transport-CrossTenantHeadersStripped:
 VE1EUR03FT038.eop-EUR03.prod.protection.outlook.com
X-MS-Office365-Filtering-Correlation-Id-Prvs:
	5e56c8d7-44ba-4eed-a2af-08d896805af5
X-Microsoft-Antispam: BCL:0;
X-Microsoft-Antispam-Message-Info:
	hahpcniq5dJSh6BLlOlx3rNjip8SiOZWtMG7trx2yDvR0BgKnvq2qB2zvx/YIChnO4JICuxKP9QnOW9v1hjC5Gs12h6kdGVBc7EqT8xF4GbGe16dyu/3r7sYWaUAc3Y2robZhhLgEkfg7q04jY16EV/4ZApFAni+VhfTbnwlvQZmXJFMSrbKhTTwE3RC8gkd/cwwEK+NfFkGGJZHH7k3xdEvdDwCbTIDSpRTULPvHrbJ1XUtnV0E7lv23zZRgtvhXqUg8/GwQKBk7dkN5NUhsknUpLW41p8MXD9//YDr5qjBz6vgtsweSa/zTdjSVHelCG6r86oZBM4CkMh8LVWJgkRJLtrNx4bKwAwcxdrSVGxxwGU9oIgMvWbVRoGOZnK4znnH/tu9b2sO87M/RN+GiQ==
X-Forefront-Antispam-Report:
	CIP:63.35.35.123;CTRY:IE;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:64aa7808-outbound-1.mta.getcheckrecipient.com;PTR:ec2-63-35-35-123.eu-west-1.compute.amazonaws.com;CAT:NONE;SFS:(4636009)(136003)(346002)(39850400004)(396003)(376002)(46966005)(2906002)(55016002)(7696005)(316002)(83380400001)(4326008)(478600001)(8936002)(186003)(9686003)(54906003)(26005)(336012)(8676002)(82310400003)(82740400003)(6506007)(70206006)(5660300002)(47076004)(86362001)(81166007)(52536014)(110136005)(70586007)(30864003)(356005)(53546011)(33656002);DIR:OUT;SFP:1101;
X-OriginatorOrg: arm.com
X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Dec 2020 05:09:00.8284
 (UTC)
X-MS-Exchange-CrossTenant-Network-Message-Id: dd044490-3015-4b01-9990-08d896806194
X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d
X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d;Ip=[63.35.35.123];Helo=[64aa7808-outbound-1.mta.getcheckrecipient.com]
X-MS-Exchange-CrossTenant-AuthSource:
	VE1EUR03FT038.eop-EUR03.prod.protection.outlook.com
X-MS-Exchange-CrossTenant-AuthAs: Anonymous
X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem
X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR0802MB2444

SGkgU2hhcmFuLA0KDQpUaGFua3MgZm9yIHlvdXIgY29tbWVudHMuDQoNCj4gLS0tLS1PcmlnaW5h
bCBNZXNzYWdlLS0tLS0NCj4gRnJvbTogU2hhcmFuIFNhbnRoYW5hbSA8c2hhcmFuLnNhbnRoYW5h
bUBuZWNsYWIuZXU+DQo+IFNlbnQ6IFR1ZXNkYXksIERlY2VtYmVyIDEsIDIwMjAgMTI6NTUgQU0N
Cj4gVG86IEppYW55b25nIFd1IDxKaWFueW9uZy5XdUBhcm0uY29tPjsgbWluaW9zLQ0KPiBkZXZl
bEBsaXN0cy54ZW5wcm9qZWN0Lm9yZzsgc2ltb24ua3VlbnplckBuZWNsYWIuZXUNCj4gQ2M6IEp1
c3RpbiBIZSA8SnVzdGluLkhlQGFybS5jb20+OyBXZWkgQ2hlbiA8V2VpLkNoZW5AYXJtLmNvbT4N
Cj4gU3ViamVjdDogUmU6IFtNaW5pb3MtZGV2ZWxdIFtQQVRDSF0gYXJtL3J0YzogZW5hYmxlIHBs
MDMxIGZvciBhcm02NC4NCj4NCj4gSGVsbG8gSmlhbnlvbmcgV3UsDQo+DQo+IFBsZWFzZSBmaW5k
IHRoZSBjb21tZW50cyBpbmxpbmU6DQo+DQo+IFRoYW5rcyAmIFJlZ2FyZHMNCj4gU2hhcmFuDQo+
DQo+IE9uIDMvMzEvMjAgMTE6NTcgQU0sIEppYW55b25nIFd1IHdyb3RlOg0KPiA+IEN1cnJlbnRs
eSwgcnRjIGlzIG5vdCBlbmFibGVkIGluIGFybSwgc28gd2FsbCB0aW1lIGNhbid0IGJlIHByb3Zp
ZGVkDQo+ID4gY3VycmVjdGx5Lg0KPiA+IHBsMDMxIGlzIGNob3NlbiBhcyB0aGUgcnRjIGRldmlj
ZSBmb3IgYXJtIGluIHRoaXMgcGF0Y2gsIGJ1dCB3ZSBoYXZlDQo+ID4gaW50ZXJmYWNlIGV4dGVu
c2lvbiBvZiBjYXBhYmxlIG9mIHBsdWdnaW5nIG90aGVyIHJ0YyBkZXZpY2UuDQo+ID4NCj4gPiBU
aGlzIHBhdGNoIHVzZSB0aGUgbmV3IGZkdCBBUEkgb2YNCj4gImZkdF9ub2RlX29mZnNldF9pZHhf
YnlfY29tcGF0aWJsZV9saXN0Ig0KPiA+IGluIEp1c3RpbidzIHBhdGNoIGluIHJldmlldy4NCj4g
Pg0KPiA+IFNpZ25lZC1vZmYtYnk6IFdlaSBDaGVuIDx3ZWkuY2hlbkBhcm0uY29tPg0KPiA+IFNp
Z25lZC1vZmYtYnk6IEppYW55b25nIFd1IDxqaWFueW9uZy53dUBhcm0uY29tPg0KPiA+IC0tLQ0K
PiA+ICAgcGxhdC9jb21tb24vYXJtL3RpbWUuYyAgICAgICAgIHwgICAyICsNCj4gPiAgIHBsYXQv
ZHJpdmVycy9pbmNsdWRlL3J0Yy9ydGMuaCB8ICA3NyArKysrKysrKw0KPiA+ICAgcGxhdC9kcml2
ZXJzL3J0Yy9wbDAzMS5jICAgICAgIHwgMzE1DQo+ICsrKysrKysrKysrKysrKysrKysrKysrKysr
KysrKysrKw0KPiA+ICAgcGxhdC9rdm0vQ29uZmlnLnVrICAgICAgICAgICAgIHwgICA1ICsNCj4g
PiAgIHBsYXQva3ZtL01ha2VmaWxlLnVrICAgICAgICAgICB8ICAxMSArLQ0KPiA+ICAgNSBmaWxl
cyBjaGFuZ2VkLCA0MDkgaW5zZXJ0aW9ucygrKSwgMSBkZWxldGlvbigtKQ0KPiA+ICAgY3JlYXRl
IG1vZGUgMTAwNjQ0IHBsYXQvZHJpdmVycy9pbmNsdWRlL3J0Yy9ydGMuaA0KPiA+ICAgY3JlYXRl
IG1vZGUgMTAwNjQ0IHBsYXQvZHJpdmVycy9ydGMvcGwwMzEuYw0KPiA+DQo+ID4gZGlmZiAtLWdp
dCBhL3BsYXQvY29tbW9uL2FybS90aW1lLmMgYi9wbGF0L2NvbW1vbi9hcm0vdGltZS5jIGluZGV4
DQo+ID4gYmJiM2M3Mi4uNzU2MGZmZiAxMDA2NDQNCj4gPiAtLS0gYS9wbGF0L2NvbW1vbi9hcm0v
dGltZS5jDQo+ID4gKysrIGIvcGxhdC9jb21tb24vYXJtL3RpbWUuYw0KPiA+IEBAIC0xNTAsNCAr
MTUwLDYgQEAgdm9pZCB1a3BsYXRfdGltZV9pbml0KHZvaWQpDQo+ID4NCj4gPiAgIC8qIEVuYWJs
ZSB0aW1lciAqLw0KPiA+ICAgZ2VuZXJpY190aW1lcl9lbmFibGUoKTsNCj4gPiArLyogSW5pdGlh
bGl6ZSBydGMgKi8NCj4gPiArX2R0Yl9pbml0X3J0YyhfbGlia3ZtcGxhdF9jZmcuZHRiKTsNCj4g
PiAgIH0NCj4gPiBkaWZmIC0tZ2l0IGEvcGxhdC9kcml2ZXJzL2luY2x1ZGUvcnRjL3J0Yy5oDQo+
ID4gYi9wbGF0L2RyaXZlcnMvaW5jbHVkZS9ydGMvcnRjLmggbmV3IGZpbGUgbW9kZSAxMDA2NDQg
aW5kZXgNCj4gPiAwMDAwMDAwLi40ZGFmYjg3DQo+ID4gLS0tIC9kZXYvbnVsbA0KPiA+ICsrKyBi
L3BsYXQvZHJpdmVycy9pbmNsdWRlL3J0Yy9ydGMuaA0KPiA+IEBAIC0wLDAgKzEsNzcgQEANCj4g
PiArLyogU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IEJTRC0zLUNsYXVzZSAqLw0KPiA+ICsvKg0K
PiA+ICsgKiBBdXRob3JzOiBXZWkgQ2hlbiA8V2VpLkNoZW5AYXJtLmNvbT4NCj4gPiArICogICAg
ICAgICAgSmlhbnlvbmcgV3UgPEppYW55b25nLld1QGFybS5jb20+DQo+ID4gKyAqDQo+ID4gKyAq
IENvcHlyaWdodCAoYykgMjAxOSwgQXJtIEx0ZC4gQWxsIHJpZ2h0cyByZXNlcnZlZC4NCj4gPiAr
ICoNCj4gPiArICogUmVkaXN0cmlidXRpb24gYW5kIHVzZSBpbiBzb3VyY2UgYW5kIGJpbmFyeSBm
b3Jtcywgd2l0aCBvciB3aXRob3V0DQo+ID4gKyAqIG1vZGlmaWNhdGlvbiwgYXJlIHBlcm1pdHRl
ZCBwcm92aWRlZCB0aGF0IHRoZSBmb2xsb3dpbmcgY29uZGl0aW9ucw0KPiA+ICsgKiBhcmUgbWV0
Og0KPiA+ICsgKg0KPiA+ICsgKiAxLiBSZWRpc3RyaWJ1dGlvbnMgb2Ygc291cmNlIGNvZGUgbXVz
dCByZXRhaW4gdGhlIGFib3ZlIGNvcHlyaWdodA0KPiA+ICsgKiAgICBub3RpY2UsIHRoaXMgbGlz
dCBvZiBjb25kaXRpb25zIGFuZCB0aGUgZm9sbG93aW5nIGRpc2NsYWltZXIuDQo+ID4gKyAqIDIu
IFJlZGlzdHJpYnV0aW9ucyBpbiBiaW5hcnkgZm9ybSBtdXN0IHJlcHJvZHVjZSB0aGUgYWJvdmUg
Y29weXJpZ2h0DQo+ID4gKyAqICAgIG5vdGljZSwgdGhpcyBsaXN0IG9mIGNvbmRpdGlvbnMgYW5k
IHRoZSBmb2xsb3dpbmcgZGlzY2xhaW1lciBpbiB0aGUNCj4gPiArICogICAgZG9jdW1lbnRhdGlv
biBhbmQvb3Igb3RoZXIgbWF0ZXJpYWxzIHByb3ZpZGVkIHdpdGggdGhlIGRpc3RyaWJ1dGlvbi4N
Cj4gPiArICogMy4gTmVpdGhlciB0aGUgbmFtZSBvZiB0aGUgY29weXJpZ2h0IGhvbGRlciBub3Ig
dGhlIG5hbWVzIG9mIGl0cw0KPiA+ICsgKiAgICBjb250cmlidXRvcnMgbWF5IGJlIHVzZWQgdG8g
ZW5kb3JzZSBvciBwcm9tb3RlIHByb2R1Y3RzIGRlcml2ZWQNCj4gZnJvbQ0KPiA+ICsgKiAgICB0
aGlzIHNvZnR3YXJlIHdpdGhvdXQgc3BlY2lmaWMgcHJpb3Igd3JpdHRlbiBwZXJtaXNzaW9uLg0K
PiA+ICsgKg0KPiA+ICsgKiBUSElTIFNPRlRXQVJFIElTIFBST1ZJREVEIEJZIFRIRSBDT1BZUklH
SFQgSE9MREVSUyBBTkQNCj4gQ09OVFJJQlVUT1JTICJBUyBJUyINCj4gPiArICogQU5EIEFOWSBF
WFBSRVNTIE9SIElNUExJRUQgV0FSUkFOVElFUywgSU5DTFVESU5HLCBCVVQgTk9UDQo+IExJTUlU
RUQNCj4gPiArVE8sIFRIRQ0KPiA+ICsgKiBJTVBMSUVEIFdBUlJBTlRJRVMgT0YgTUVSQ0hBTlRB
QklMSVRZIEFORCBGSVRORVNTIEZPUiBBDQo+IFBBUlRJQ1VMQVINCj4gPiArUFVSUE9TRQ0KPiA+
ICsgKiBBUkUgRElTQ0xBSU1FRC4gSU4gTk8gRVZFTlQgU0hBTEwgVEhFIENPUFlSSUdIVCBIT0xE
RVIgT1INCj4gPiArQ09OVFJJQlVUT1JTIEJFDQo+ID4gKyAqIExJQUJMRSBGT1IgQU5ZIERJUkVD
VCwgSU5ESVJFQ1QsIElOQ0lERU5UQUwsIFNQRUNJQUwsIEVYRU1QTEFSWSwNCj4gPiArT1INCj4g
PiArICogQ09OU0VRVUVOVElBTCBEQU1BR0VTIChJTkNMVURJTkcsIEJVVCBOT1QgTElNSVRFRCBU
TywNCj4gUFJPQ1VSRU1FTlQNCj4gPiArT0YNCj4gPiArICogU1VCU1RJVFVURSBHT09EUyBPUiBT
RVJWSUNFUzsgTE9TUyBPRiBVU0UsIERBVEEsIE9SIFBST0ZJVFM7IE9SDQo+ID4gK0JVU0lORVNT
DQo+ID4gKyAqIElOVEVSUlVQVElPTikgSE9XRVZFUiBDQVVTRUQgQU5EIE9OIEFOWSBUSEVPUlkg
T0YgTElBQklMSVRZLA0KPiA+ICtXSEVUSEVSIElODQo+ID4gKyAqIENPTlRSQUNULCBTVFJJQ1Qg
TElBQklMSVRZLCBPUiBUT1JUIChJTkNMVURJTkcgTkVHTElHRU5DRSBPUg0KPiA+ICtPVEhFUldJ
U0UpDQo+ID4gKyAqIEFSSVNJTkcgSU4gQU5ZIFdBWSBPVVQgT0YgVEhFIFVTRSBPRiBUSElTIFNP
RlRXQVJFLCBFVkVOIElGDQo+ID4gK0FEVklTRUQgT0YgVEhFDQo+ID4gKyAqIFBPU1NJQklMSVRZ
IE9GIFNVQ0ggREFNQUdFLg0KPiA+ICsgKg0KPiA+ICsgKiBUSElTIEhFQURFUiBNQVkgTk9UIEJF
IEVYVFJBQ1RFRCBPUiBNT0RJRklFRCBJTiBBTlkgV0FZLg0KPg0KPiBSZW1vdmUgdGhlIGFib3Zl
IGxpbmUgc2luY2UgaXQgaXMgaW5jb21wYXRpYmxlIHdpdGggdGhlIEJTRCBsaWNlbnNlLg0KPg0K
T0sNCg0KPg0KPiA+ICsgKi8NCj4gPiArDQo+ID4gKyNpZm5kZWYgX19QTEFUX0tWTV9BUk1fUlRD
X0hfXw0KPiA+ICsjZGVmaW5lIF9fUExBVF9LVk1fQVJNX1JUQ19IX18NCj4gPiArDQo+ID4gK3N0
cnVjdCBydGNfdGltZSB7DQo+ID4gK2ludCB5ZWFyOw0KPiA+ICtpbnQgbW9uOw0KPiA+ICtpbnQg
ZGF5Ow0KPiA+ICtpbnQgaG91cjsNCj4gPiAraW50IG1pbjsNCj4gPiAraW50IHNlYzsNCj4gPiAr
fTsNCj4gPiArDQo+ID4gK3N0cnVjdCBydGNfb3BzIHsNCj4gPiArdm9pZCAoKmVuYWJsZSkoaW50
KTsNCj4gPiAraW50ICgqc3RhdHVzKSh2b2lkKTsNCj4gPiArdm9pZCAoKnJlYWQpKHN0cnVjdCBy
dGNfdGltZSAqKTsNCj4gPiArdWludDMyX3QgKCpyZWFkX3Jhdykodm9pZCk7DQo+ID4gK3ZvaWQg
KCp3cml0ZSkoc3RydWN0IHJ0Y190aW1lICopOw0KPiA+ICt2b2lkICgqd3JpdGVfcmF3KSh1aW50
MzJfdCk7DQo+DQo+IFdlIHNob3VsZCByZW5hbWUgaXQgYXMgcmVhZF90aW1lIGFuZCB0aGUgd3Jp
dGVfdGltZS4gSSBhbSBub3Qgc3VyZSB3aHkgd2UNCj4gbmVlZCB0byBleHBvc2UgdGhlICpfcmF3
IGFzIGEgcGFydCBvZiB0aGUgcnRjX29wcyBvcGVyYXRpb24gYmVjYXVzZSB0aGlzIGlzDQo+IHVz
ZWQgb25seSBmb3IgYSBzcGVjaWZpYyBvcGVyYXRpb24uDQo+DQpPSw0KDQo+IEluc3RlYWQgd2Ug
Y291bGQgcmVhZCB0aGUgYm9vdCB0aWNrIHdpdGggYW4gQVBJIGZ1bmN0aW9uIGxpa2U6DQo+DQo+
IHVpbnQzMl90IHJ0Y19ib290X3RpY2tfZ2V0KHN0cnVjdCBydGNfZGV2ICpkZXYpOw0KPg0KT0sN
Cg0KPg0KPiA+ICt2b2lkICgqcmVhZF9hbGFybSkoc3RydWN0IHJ0Y190aW1lICopOw0KPiA+ICt1
aW50MzJfdCAoKnJlYWRfYWxhcm1fcmF3KSh2b2lkKTsNCj4gPiArdm9pZCAoKndyaXRlX2FsYXJt
KShzdHJ1Y3QgcnRjX3RpbWUgKik7DQo+ID4gK3ZvaWQgKCp3cml0ZV9hbGFybV9yYXcpKHVpbnQz
Ml90KTsNCj4gPiArdm9pZCAoKmFsYXJtX2lycV9lbmFibGUpKGludCk7DQo+ID4gK307DQo+DQo+
IFdoeSBkb24ndCB0aGVzZSBydGNfb3BzIHRha2UgdGhlIHJ0Y19kZXYgYXMgaXRzIHBhcmFtZXRl
ci4gSXQgd291bGQgYmUNCj4gZGlmZmljdWx0IHRvIHN1cHBvcnQgbXVsdGlwbGUgZGV2aWNlLg0K
Pg0KT0sNCg0KPg0KPiA+ICsNCj4gPiArc3RydWN0IHJ0Y19kZXYgew0KPiA+ICtjaGFyICpuYW1l
Ow0KPiA+ICtpbnQgaWQ7DQo+ID4gK2NvbnN0IHN0cnVjdCBydGNfb3BzICpvcHM7DQo+ID4gK307
DQo+ID4gKw0KPiA+ICsjaWZkZWYgQ09ORklHX1JUQ19QTDAzMQ0KPiA+ICsNCj4gPiArI2luY2x1
ZGUgPHN0ZGludC5oPg0KPiA+ICsNCj4gPiArZXh0ZXJuIHVpbnQzMl90IHJ0Y19ib290X3NlY29u
ZHM7DQo+ID4gKw0KPiA+ICtpbnQgX2R0Yl9pbml0X3J0Yyh2b2lkICpkdGIpOw0KPiA+ICsNCj4g
PiArI2VuZGlmDQo+ID4gKyNlbmRpZiAvL19fUExBVF9LVk1fQVJNX0dJQ1YyX0hfXw0KPiBzL19f
UExBVF9LVk1fQVJNX0dJQ1YyX0hfXy9fX1BMQVRfS1ZNX0FSTV9SVENfSF9fDQo+ID4gZGlmZiAt
LWdpdCBhL3BsYXQvZHJpdmVycy9ydGMvcGwwMzEuYyBiL3BsYXQvZHJpdmVycy9ydGMvcGwwMzEu
Yw0KPiA+IG5ldyBmaWxlIG1vZGUgMTAwNjQ0DQo+ID4gaW5kZXggMDAwMDAwMC4uZmYyNDQxMQ0K
PiA+IC0tLSAvZGV2L251bGwNCj4gPiArKysgYi9wbGF0L2RyaXZlcnMvcnRjL3BsMDMxLmMNCj4g
PiBAQCAtMCwwICsxLDMxNSBAQA0KPiA+ICsvKiBTUERYLUxpY2Vuc2UtSWRlbnRpZmllcjogQlNE
LTMtQ2xhdXNlICovDQo+ID4gKy8qDQo+ID4gKyAqIEF1dGhvcnM6IFdlaSBDaGVuIDxXZWkuQ2hl
bkBhcm0uY29tPg0KPiA+ICsgKiAgICAgICAgICBKaWFueW9uZyBXdSA8SmlhbnlvbmcuV3VAYXJt
LmNvbT4NCj4gPiArICoNCj4gPiArICogQ29weXJpZ2h0IChjKSAyMDE4LCBBcm0gTHRkLiBBbGwg
cmlnaHRzIHJlc2VydmVkLg0KPiA+ICsgKg0KPiA+ICsgKiBSZWRpc3RyaWJ1dGlvbiBhbmQgdXNl
IGluIHNvdXJjZSBhbmQgYmluYXJ5IGZvcm1zLCB3aXRoIG9yIHdpdGhvdXQNCj4gPiArICogbW9k
aWZpY2F0aW9uLCBhcmUgcGVybWl0dGVkIHByb3ZpZGVkIHRoYXQgdGhlIGZvbGxvd2luZyBjb25k
aXRpb25zDQo+ID4gKyAqIGFyZSBtZXQ6DQo+ID4gKyAqDQo+ID4gKyAqIDEuIFJlZGlzdHJpYnV0
aW9ucyBvZiBzb3VyY2UgY29kZSBtdXN0IHJldGFpbiB0aGUgYWJvdmUgY29weXJpZ2h0DQo+ID4g
KyAqICAgIG5vdGljZSwgdGhpcyBsaXN0IG9mIGNvbmRpdGlvbnMgYW5kIHRoZSBmb2xsb3dpbmcg
ZGlzY2xhaW1lci4NCj4gPiArICogMi4gUmVkaXN0cmlidXRpb25zIGluIGJpbmFyeSBmb3JtIG11
c3QgcmVwcm9kdWNlIHRoZSBhYm92ZSBjb3B5cmlnaHQNCj4gPiArICogICAgbm90aWNlLCB0aGlz
IGxpc3Qgb2YgY29uZGl0aW9ucyBhbmQgdGhlIGZvbGxvd2luZyBkaXNjbGFpbWVyIGluIHRoZQ0K
PiA+ICsgKiAgICBkb2N1bWVudGF0aW9uIGFuZC9vciBvdGhlciBtYXRlcmlhbHMgcHJvdmlkZWQg
d2l0aCB0aGUgZGlzdHJpYnV0aW9uLg0KPiA+ICsgKiAzLiBOZWl0aGVyIHRoZSBuYW1lIG9mIHRo
ZSBjb3B5cmlnaHQgaG9sZGVyIG5vciB0aGUgbmFtZXMgb2YgaXRzDQo+ID4gKyAqICAgIGNvbnRy
aWJ1dG9ycyBtYXkgYmUgdXNlZCB0byBlbmRvcnNlIG9yIHByb21vdGUgcHJvZHVjdHMgZGVyaXZl
ZA0KPiBmcm9tDQo+ID4gKyAqICAgIHRoaXMgc29mdHdhcmUgd2l0aG91dCBzcGVjaWZpYyBwcmlv
ciB3cml0dGVuIHBlcm1pc3Npb24uDQo+ID4gKyAqDQo+ID4gKyAqIFRISVMgU09GVFdBUkUgSVMg
UFJPVklERUQgQlkgVEhFIENPUFlSSUdIVCBIT0xERVJTIEFORA0KPiBDT05UUklCVVRPUlMgIkFT
IElTIg0KPiA+ICsgKiBBTkQgQU5ZIEVYUFJFU1MgT1IgSU1QTElFRCBXQVJSQU5USUVTLCBJTkNM
VURJTkcsIEJVVCBOT1QNCj4gTElNSVRFRCBUTywgVEhFDQo+ID4gKyAqIElNUExJRUQgV0FSUkFO
VElFUyBPRiBNRVJDSEFOVEFCSUxJVFkgQU5EIEZJVE5FU1MgRk9SIEENCj4gUEFSVElDVUxBUiBQ
VVJQT1NFDQo+ID4gKyAqIEFSRSBESVNDTEFJTUVELiBJTiBOTyBFVkVOVCBTSEFMTCBUSEUgQ09Q
WVJJR0hUIEhPTERFUiBPUg0KPiBDT05UUklCVVRPUlMgQkUNCj4gPiArICogTElBQkxFIEZPUiBB
TlkgRElSRUNULCBJTkRJUkVDVCwgSU5DSURFTlRBTCwgU1BFQ0lBTCwgRVhFTVBMQVJZLA0KPiBP
Ug0KPiA+ICsgKiBDT05TRVFVRU5USUFMIERBTUFHRVMgKElOQ0xVRElORywgQlVUIE5PVCBMSU1J
VEVEIFRPLA0KPiBQUk9DVVJFTUVOVCBPRg0KPiA+ICsgKiBTVUJTVElUVVRFIEdPT0RTIE9SIFNF
UlZJQ0VTOyBMT1NTIE9GIFVTRSwgREFUQSwgT1IgUFJPRklUUzsgT1INCj4gQlVTSU5FU1MNCj4g
PiArICogSU5URVJSVVBUSU9OKSBIT1dFVkVSIENBVVNFRCBBTkQgT04gQU5ZIFRIRU9SWSBPRiBM
SUFCSUxJVFksDQo+IFdIRVRIRVIgSU4NCj4gPiArICogQ09OVFJBQ1QsIFNUUklDVCBMSUFCSUxJ
VFksIE9SIFRPUlQgKElOQ0xVRElORyBORUdMSUdFTkNFIE9SDQo+IE9USEVSV0lTRSkNCj4gPiAr
ICogQVJJU0lORyBJTiBBTlkgV0FZIE9VVCBPRiBUSEUgVVNFIE9GIFRISVMgU09GVFdBUkUsIEVW
RU4gSUYNCj4gQURWSVNFRCBPRiBUSEUNCj4gPiArICogUE9TU0lCSUxJVFkgT0YgU1VDSCBEQU1B
R0UuDQo+ID4gKyAqDQo+ID4gKyAqIFRISVMgSEVBREVSIE1BWSBOT1QgQkUgRVhUUkFDVEVEIE9S
IE1PRElGSUVEIElOIEFOWSBXQVkuDQo+DQo+IFJlbW92ZSB0aGUgYWJvdmUgbGluZSBzaW5jZSBp
dCBpcyBpbmNvbXBhdGlibGUgd2l0aCB0aGUgQlNEIGxpY2Vuc2UuDQo+DQpPSw0KDQo+DQo+ID4g
KyAqLw0KPiA+ICsjaW5jbHVkZSA8c3RyaW5nLmg+DQo+ID4gKyNpbmNsdWRlIDxsaWJmZHQuaD4N
Cj4gPiArI2luY2x1ZGUgPHN0ZGlvLmg+DQo+ID4gKyNpbmNsdWRlIDx1ay9hc3NlcnQuaD4NCj4g
PiArI2luY2x1ZGUgPHVrL2Vzc2VudGlhbHMuaD4NCj4gPiArI2luY2x1ZGUgPHVrL3ByaW50Lmg+
DQo+ID4gKyNpbmNsdWRlIDx1ay9saXN0Lmg+DQo+ID4gKyNpbmNsdWRlIDxhcm0vY3B1Lmg+DQo+
ID4gKyNpbmNsdWRlIDxvZncvZmR0Lmg+DQo+ID4gKyNpbmNsdWRlIDxydGMvcnRjLmg+DQo+ID4g
KyNpbmNsdWRlIDxnaWMvZ2ljLXYyLmg+DQo+ID4gKyNpbmNsdWRlIDxvZncvZ2ljX2ZkdC5oPg0K
PiA+ICsjaW5jbHVkZSA8dWsvcGxhdC9jb21tb24vaXJxLmg+DQo+ID4gKw0KPiA+ICtzdGF0aWMg
dWludDY0X3QgcnRjX2Jhc2VfYWRkcjsNCj4gPiArdWludDMyX3QgcnRjX2Jvb3Rfc2Vjb25kczsN
Cj4gPiArDQo+ID4gKy8qIERlZmluZSBvZmZzZXQgb2YgUlRDIHJlZ2lzdGVycyAqLw0KPiA+ICsj
ZGVmaW5lIFJUQ19EUjANCj4gPiArI2RlZmluZSBSVENfTVIweDQNCj4gPiArI2RlZmluZSBSVENf
TFIweDgNCj4gPiArI2RlZmluZSBSVENfQ1IweGMNCj4gPiArI2RlZmluZSBSVENfSU1TQzB4MTAN
Cj4gPiArI2RlZmluZSBSVENfUklTMHgxNA0KPiA+ICsjZGVmaW5lIFJUQ19NSVMweDE4DQo+ID4g
KyNkZWZpbmUgUlRDX0lDUjB4MWMNCj4gPiArDQo+ID4gKyNkZWZpbmUgUlRDX1JFRyhyKSh2b2lk
ICopKHJ0Y19iYXNlX2FkZHIgKyAocikpDQo+ID4gKw0KPiA+ICsjZGVmaW5lIFJUQ19ERVZfTlVN
IDENCj4gPiArI2RlZmluZSBSVENfRU5BQkxFIDENCj4gPiArI2RlZmluZSBSVENfRElTQUJMRSAw
DQo+ID4gKw0KPiA+ICtzdGF0aWMgaW50IGRheV9wZXJfbW9uWzEyXSA9IHszMSwgMjgsIDMxLCAz
MCwgMzEsIDMwLCAzMSwgMzEsIDMwLCAzMSwgMzAsIDMxfTsNCj4gPiArDQo+ID4gK3N0YXRpYyBj
b25zdCBjaGFyICogY29uc3QgcnRjX2RldmljZV9saXN0W10gPSB7DQo+ID4gKyJhcm0scGwwMzEi
LA0KPiA+ICt9Ow0KPiA+ICsNCj4gPiArc3RhdGljIHZvaWQgcGwwMzFfcmF3X3RvX3RtKHVpbnQz
Ml90IHJhdywgc3RydWN0IHJ0Y190aW1lICpydCkNCj4NCj4gICBNb3ZlIHRoZXNlIGZ1bmN0aW9u
IGludG8gYSBoZWFkZXIgZmlsZSBgcnRjLmhgIGFzIGEgc3RhdGljIGlubGluZQ0KPiBmdW5jdGlv
biBhcyB0aGVzZSBhcmUgZ2VuZXJpYyBjb252ZXJzaW9uIGZ1bmN0aW9ucy4NCj4NClRoZXJlIGlz
IGEgZm9yIGxvb3AgaW4gdGhpcyBmdW5jdGlvbiwgc28gaXQgbWF5IG5vdCBiZSBhcHByb3ByaWF0
ZSB0byBiZSBhIGlubGluZSBmdW5jdGlvbi4gaXNuJ3Q/DQoNCj4NCj4gPiArew0KPiA+ICtpbnQg
aG91ciwgZGF5cywgeWVhcnMsIGR5NCwgZHkxMDAsIGR5NDAwLCBub3JtYWxfZGF5cywNCj4gPiAr
ZGF5X2luX3llYXIsIHN1bSA9IDAsIGxlYXA7DQo+ID4gKw0KPiA+ICtydC0+c2VjID0gcmF3ICUg
NjA7DQo+ID4gK3J0LT5taW4gPSAocmF3ICUgKDYwICogNjApKSAvIDYwOw0KPiA+ICtob3VyID0g
cmF3IC8gNjAgLyA2MDsNCj4gPiArZGF5cyA9ICBob3VyIC8gMjQ7DQo+ID4gK3J0LT5ob3VyID0g
aG91ciAlIDI0Ow0KPiA+ICsvKg0KPiA+ICsgKiB0b3RhbCBkYXlzIGZvciBldmVyeSBjb250aW51
ZSA0LXllYXJzLCBhc3N1bWluZyB0aGVyZSBpcyBhIGxlYXANCj4gPiArICogeWVhciBhbW9uZyBl
dmVyeSA0IHllYXJzLg0KPiA+ICsgKi8NCj4gPiArZHk0ID0gMzY1ICogMyArIDM2NjsNCj4gPiAr
Ly8gdG90YWwgZGF5cyBmb3IgZXZlcnkgY29udGludWUgMTAwLXllYXJzLg0KPiA+ICtkeTEwMCA9
IDI1ICogZHk0IC0gMTsNCj4gPiArLy8gdG90YWwgZGF5cyBmb3IgZXZlcnkgY29udGludWUgNDAw
LXllYXJzLg0KPiA+ICtkeTQwMCA9IGR5MTAwICogNCArIDE7DQo+ID4gKy8vIG5vcm1hbGl6ZSB0
aGUgZGF5cyBieSBnZXQgcmlkIG9mIHRoZSBhZGRpdGlvbmFsIGRheSBpbiBsZWFwIHllYXINCj4g
PiArbm9ybWFsX2RheXMgPSBkYXlzIC0gZGF5cyAvIGR5NCArIGRheXMgLyBkeTEwMCArIGRheXMg
LyBkeTQwMDsNCj4gPiAreWVhcnMgPSBub3JtYWxfZGF5cyAvIDM2NTsNCj4gPiArcnQtPnllYXIg
PSAxOTcwICsgeWVhcnM7DQo+ID4gK2xlYXAgPSAoKCEocnQtPnllYXIgJSA0KSAmJiAocnQtPnll
YXIgJSAxMDApKSB8fCAhKHJ0LT55ZWFyICUgNDAwKSk7DQo+ID4gK2RheV9pbl95ZWFyID0gIG5v
cm1hbF9kYXlzIC0geWVhcnMgKiAzNjU7DQo+ID4gKy8qDQo+ID4gKyAqIGlmIHRoZSByZXNpZHVl
IGRheXMgbGFyZ2VyIHRoYW4gdGhlIHN1bSBvZiB0aGUgZmlyc3QgdHdvIG1vbnRoDQo+ID4gKyAq
IHdlIHNob3VsZCBjb25zaWRlciBGZWIsMjkuDQo+ID4gKyAqLw0KPiA+ICtzdW0gKz0gbGVhcCAq
IChkYXlfaW5feWVhciA+PSAoZGF5X3Blcl9tb25bMF0gKw0KPiBkYXlfcGVyX21vblsxXSkpOw0K
PiA+ICtmb3IgKGludCBpID0gMDsgaSA8IDEyOyBpKyspIHsNCj4gPiArc3VtICs9IGRheV9wZXJf
bW9uW2ldOw0KPiA+ICtpZiAoZGF5X2luX3llYXIgPCBzdW0pIHsNCj4gPiArcnQtPm1vbiA9IGkg
KyAxOw0KPiA+ICtydC0+ZGF5ID0gZGF5X2luX3llYXIgLSAoc3VtIC0gZGF5X3Blcl9tb25baV0p
ICsgMTsNCj4gPiArYnJlYWs7DQo+ID4gK30NCj4gPiArfQ0KPiA+ICt9DQo+ID4gKw0KPiA+ICtz
dGF0aWMgdWludDMyX3QgcGwwMzFfdG1fdG9fcmF3KHN0cnVjdCBydGNfdGltZSAqcnQpDQo+IE1v
dmUgdGhlc2UgZnVuY3Rpb24gaW50byBhIGhlYWRlciBmaWxlIGBydGMuaGAgYXMgYSBzdGF0aWMg
aW5saW5lIGZ1bmN0aW9uLg0KDQppdCdzIGEgbGl0dGxlIG9kZCB0byBwdXQgdGhpcyBkZXZpY2Ut
c3BlY2lmaWMgZnVuY3Rpb24gaW50byBydGMuaCwgYXMgYWxsIG9mIHRoZSB0ZXJtcyBpbiBydGMu
aCBzaG91bGQgYmUNCmdlbmVyaWMuDQpQczogYWxzbyB0aGVzZSBmdW5jdGlvbnMgaW4gbGludXgg
a2VybmVsIGFyZSBrZXB0IGluIGl0cyBzcGVjaWZpYyBmaWxlLg0KDQo+ID4gK3sNCj4gPiAraW50
IGxlYXBzLCBsZWFwLCBkYXlzLCBzZWM7DQo+ID4gKw0KPiA+ICtsZWFwcyA9IChydC0+eWVhciAt
IDE5NzApIC8gNCAtIChydC0+eWVhciAtIDE5NzApIC8gMTAwICsNCj4gPiArKHJ0LT55ZWFyIC0g
MTk3MCkgLyA0MDA7DQo+ID4gK2xlYXAgPSAoKCEocnQtPnllYXIgJSA0KSAmJiAocnQtPnllYXIg
JSAxMDApKSB8fCAhKHJ0LT55ZWFyICUgNDAwKSk7DQo+ID4gK2RheXMgPSAocnQtPnllYXIgLSAx
OTcwKSAqIDM2NSArIGxlYXBzOw0KPiA+ICtpZiAocnQtPm1vbiA9PSAxKSB7DQo+ID4gK2RheXMg
Kz0gZGF5X3Blcl9tb25bMF07DQo+ID4gK30gZWxzZSB7DQo+ID4gK2ZvciAoaW50IGkgPSAwOyBp
IDwgcnQtPm1vbiAtIDE7IGkrKykNCj4gPiArZGF5cyArPSBkYXlfcGVyX21vbltpXTsNCj4gPiAr
fQ0KPiA+ICtkYXlzICs9IHJ0LT5kYXkgKyAocnQtPm1vbiA+IDIpICogbGVhcCAtIDE7DQo+ID4g
K3NlYyA9IGRheXMgKiAzNjAwICogMjQgKyBydC0+aG91ciAqIDM2MDAgKyBydC0+bWluICogNjAg
KyBydC0+c2VjOw0KPiA+ICsNCj4gPiArcmV0dXJuIHNlYzsNCj4gPiArfQ0KPiA+ICsNCj4gPiAr
c3RhdGljIHVpbnQzMl90IHBsMDMxX3JlYWRfcmF3KHZvaWQpDQo+ID4gK3sNCj4gPiArcmV0dXJu
IGlvcmVnX3JlYWQzMihSVENfUkVHKFJUQ19EUikpOw0KPiA+ICt9DQo+ID4gKw0KPiA+ICtzdGF0
aWMgdm9pZCBwbDAzMV9yZWFkX3RpbWUoc3RydWN0IHJ0Y190aW1lICpydCkNCj4gPiArew0KPiA+
ICt1aW50MzJfdCByYXc7DQo+ID4gKw0KPiA+ICtyYXcgPSBwbDAzMV9yZWFkX3JhdygpOw0KPiA+
ICtwbDAzMV9yYXdfdG9fdG0ocmF3LCBydCk7DQo+ID4gK30NCj4gPiArDQo+ID4gK3N0YXRpYyB2
b2lkIHBsMDMxX3dyaXRlX3Jhdyh1aW50MzJfdCB2YWwpDQo+ID4gK3sNCj4gPiAraW9yZWdfd3Jp
dGUzMihSVENfUkVHKFJUQ19MUiksIHZhbCk7DQo+ID4gK30NCj4gPiArDQo+ID4gK3N0YXRpYyB2
b2lkIHBsMDMxX3dyaXRlX3RpbWUoc3RydWN0IHJ0Y190aW1lICpydCkNCj4gPiArew0KPiA+ICt1
aW50MzJfdCByYXc7DQo+ID4gKw0KPiA+ICtyYXcgPSBwbDAzMV90bV90b19yYXcocnQpOw0KPiA+
ICtwbDAzMV93cml0ZV9yYXcocmF3KTsNCj4gPiArfQ0KPiA+ICsNCj4gPiArLyoNCj4gPiArICog
c2V0IHJ0YyBtYXRjaCByZWdpc3RlciBjb21wYXJpbmcgd2l0aCBjb3VudGVyDQo+ID4gKyAqIHZh
bHVlIHRvIGdlbmVyYXQgYSBpbnRlcnJ1cHQNCj4gPiArICovDQo+ID4gK3N0YXRpYyB2b2lkIHBs
MDMxX3dyaXRlX2FsYXJtX3Jhdyh1aW50MzJfdCBhbGFybSkNCj4gPiArew0KPiA+ICtpb3JlZ193
cml0ZTMyKFJUQ19SRUcoUlRDX01SKSwgYWxhcm0pOw0KPiA+ICt9DQo+ID4gKw0KPiA+ICtzdGF0
aWMgdm9pZCBwbDAzMV93cml0ZV9hbGFybShzdHJ1Y3QgcnRjX3RpbWUgKnJ0KQ0KPiA+ICt7DQo+
ID4gK3VpbnQzMl90IHJhdzsNCj4gPiArDQo+ID4gK3JhdyA9IHBsMDMxX3RtX3RvX3JhdyhydCk7
DQo+ID4gK3BsMDMxX3dyaXRlX2FsYXJtX3JhdyhyYXcpOw0KPiA+ICt9DQo+ID4gKw0KPiA+ICtz
dGF0aWMgdWludDMyX3QgcGwwMzFfcmVhZF9hbGFybV9yYXcodm9pZCkNCj4gPiArew0KPiA+ICty
ZXR1cm4gaW9yZWdfcmVhZDMyKFJUQ19SRUcoUlRDX01SKSk7DQo+ID4gK30NCj4gPiArDQo+ID4g
K3N0YXRpYyB2b2lkIHBsMDMxX3JlYWRfYWxhcm0oc3RydWN0IHJ0Y190aW1lICpydCkNCj4gPiAr
ew0KPiA+ICtwbDAzMV9yYXdfdG9fdG0ocGwwMzFfcmVhZF9hbGFybV9yYXcoKSwgcnQpOw0KPiA+
ICt9DQo+ID4gKw0KPiA+ICsvKg0KPiA+ICsgKiBJZiBwbDAzMSBpcyBub3QgZW5hYmxlZCwgZW5h
YmxlIGl0IGJ5IHdyaXRlIDEgdG8gUlRDX0NSLCBvdGhlcndpc2UNCj4gPiArICogZG8gbm90aGlu
Zy4NCj4gPiArICovDQo+ID4gK3N0YXRpYyB2b2lkIHBsMDMxX2VuYWJsZShpbnQgZW5hYmxlKQ0K
PiA+ICt7DQo+ID4gK2lvcmVnX3dyaXRlMzIoUlRDX1JFRyhSVENfQ1IpLCBlbmFibGUpOw0KPiA+
ICt9DQo+ID4gKw0KPiA+ICsvKiByZXR1cm4gcnRjIHN0YXR1cywgMSBkZW5vdGVzIGVuYWJsZSBh
bmQgMCBkZW5vdGVzIGRpc2FibGUgKi8NCj4gPiArc3RhdGljIGludCBwbDAzMV9nZXRfc3RhdHVz
KHZvaWQpDQo+ID4gK3sNCj4gPiAraW50IHZhbDsNCj4gPiArDQo+ID4gK3ZhbCA9IGlvcmVnX3Jl
YWQzMihSVENfUkVHKFJUQ19DUikpOw0KPiA+ICt2YWwgJj0gUlRDX0VOQUJMRTsNCj4gPiArcmV0
dXJuIHZhbDsNCj4gPiArfQ0KPiA+ICsNCj4gPiArLyogZW5hYmxlIGFsYXJtIGlycSwgMSBkZW5v
dGVzIGVuYWJsZSwgMiBkZW5vdGVzIGRpc2FibGUgKi8NCj4gPiArc3RhdGljIHZvaWQgcGwwMzFf
ZW5hYmxlX2ludHIoaW50IGVuYWJsZSkNCj4gPiArew0KPiA+ICtpb3JlZ193cml0ZTMyKFJUQ19S
RUcoUlRDX0lNU0MpLCBlbmFibGUpOw0KPiA+ICt9DQo+ID4gKw0KPiA+ICtzdGF0aWMgdWludDMy
X3QgcGwwMzFfZ2V0X3Jhd19pbnRyX3N0YXRlKHZvaWQpDQo+ID4gK3sNCj4gPiArcmV0dXJuIGlv
cmVnX3JlYWQzMihSVENfUkVHKFJUQ19SSVMpKTsNCj4gPiArfQ0KPiA+ICsNCj4gPiArc3RhdGlj
IHZvaWQgcGwwMzFfY2xlYXJfaW50cih2b2lkKQ0KPiA+ICt7DQo+ID4gK3doaWxlIChwbDAzMV9n
ZXRfcmF3X2ludHJfc3RhdGUoKSkNCj4gPiAraW9yZWdfd3JpdGUzMihSVENfUkVHKFJUQ19JQ1Ip
LCAxKTsNCj4gPiArfQ0KPiA+ICsNCj4gPiArLyogd2FpdCBmb3IgcGxhdGZvcm0gZGV2aWNlIGZy
YW1ld29yayB0byByZWdpc3RlciB0aGlzIGhhbmRsZXIgKi8NCj4gPiAraW50IHBsMDMxX2lycV9o
YW5kbGVyKHZvaWQgKmFyZyBfX3VudXNlZCkNCj4gPiArew0KPiA+ICtwbDAzMV9jbGVhcl9pbnRy
KCk7DQo+ID4gKy8vIFRPRE86IGRvIHNvbWV0aGluZyByZWFsDQo+ID4gKw0KPiA+ICtyZXR1cm4g
MTsNCj4gPiArfQ0KPiA+ICsNCj4gPiArc3RhdGljIGNvbnN0IHN0cnVjdCBydGNfb3BzIG9wc19w
bDAzMSA9IHsNCj4gPiArLmVuYWJsZT0gcGwwMzFfZW5hYmxlLA0KPiA+ICsuc3RhdHVzPSBwbDAz
MV9nZXRfc3RhdHVzLA0KPiA+ICsucmVhZD0gcGwwMzFfcmVhZF90aW1lLA0KPiA+ICsucmVhZF9y
YXc9IHBsMDMxX3JlYWRfcmF3LA0KPiA+ICsud3JpdGU9IHBsMDMxX3dyaXRlX3RpbWUsDQo+ID4g
Ky53cml0ZV9yYXc9IHBsMDMxX3dyaXRlX3JhdywNCj4gPiArLnJlYWRfYWxhcm09IHBsMDMxX3Jl
YWRfYWxhcm0sDQo+ID4gKy5yZWFkX2FsYXJtX3Jhdz0gcGwwMzFfcmVhZF9hbGFybV9yYXcsDQo+
ID4gKy53cml0ZV9hbGFybT0gcGwwMzFfd3JpdGVfYWxhcm0sDQo+ID4gKy53cml0ZV9hbGFybV9y
YXc9IHBsMDMxX3dyaXRlX2FsYXJtX3JhdywNCj4gPiArLmFsYXJtX2lycV9lbmFibGU9IHBsMDMx
X2VuYWJsZV9pbnRyLA0KPiA+ICt9Ow0KPiA+ICsNCj4gPiArY29uc3Qgc3RydWN0IHJ0Y19kZXYg
cnRjX3BsMDMxID0gew0KPiA+ICsubmFtZT0gInJ0Y19wbDAzMSIsDQo+ID4gKy5pZD0gMCwNCj4g
PiArLm9wcz0gJm9wc19wbDAzMSwNCj4gPiArfTsNCj4NCj4gRG8gd2UgbmVlZCB0byBjb21iaW5l
IHRoZSBydGNfcGwwMzEgZHJpdmVyIGNvZGUgd2l0aCBhIGdlbmVyaWMgcnRjDQo+IGxpYnJhcnkg
Y29kZS4gVGhlIGNvZGUgYmVsb3cgdGhpcyBjb21tZW50IGJlbG9uZ3MgdG8gZ2VuZXJpYw0KPiBg
cGxhdC9kcml2ZXIvcnRjL3J0Yy5jYC4gV2hpbGUgd2UgZG8gdGhpcyBjaGFuZ2Ugd2Ugc2hvdWxk
IGFsc28gc3BsaXQgaXQNCj4gaW50byAyIGxpYnJhcmllcyBuYW1lbHksDQo+DQo+IGxpYnJ0YyBh
bmQgdGhlIGxpYnBsMDMxLg0KDQpXaGF0IGFib3V0IHJlY292ZXJpbmcgdGhlICJydGMuYyIgYW5k
IHB1dCB0aGVzZSBnZW5lcmljIHRlcm1zIGludG8gaXQ/DQoNCj4NCj4gPiArDQo+ID4gK2NvbnN0
IHN0cnVjdCBydGNfZGV2ICpydGNfbGlzdFtSVENfREVWX05VTV07DQo+IFdoeSBzaG91bGQgd2Ug
ZGVmaW5lIHRoaXMgYXMgYW4gYXJyYXkuIFdlIG1pZ2h0IGRlZmluZSBpdCB1c2luZyB0aGUgbGlz
dA0KPiBpbXBsZW1lbnRhdGlvbiBgaW5jbHVkZS91ay9saXN0LmhgDQo+ID4gKw0KPiA+ICtzdGF0
aWMgdm9pZCBydGNfZGV2X3JlZ2lzdGVyKHZvaWQpDQo+DQo+IFJlZ2lzdGVyIGZ1bmN0aW9uIHdp
dGggcGFyYW1ldGVyIHN0cnVjdCBydGNfZGV2Lg0KPg0KT0sNCj4NCj4gPiArew0KPiA+ICtydGNf
bGlzdFtydGNfcGwwMzEuaWRdID0gJnJ0Y19wbDAzMTsNCj4gPiArfQ0KPiA+ICsNCj4gPiArdm9p
ZCBfZHRiX2luaXRfcnRjKHZvaWQgKmR0YikNCj4gPiArew0KPiA+ICt1aW50NjRfdCBzaXplOw0K
PiA+ICt1aW50MzJfdCBpcnFfdHlwZSwgaHdpcnEsIHRyaWdnZXJfdHlwZTsNCj4gPiAraW50IGZk
dF9ydGMsIHJldCwgaW5kZXgsIGlycSwgcmM7DQo+ID4gKw0KPiA+ICt1a19wcl9pbmZvKCJQcm9i
aW5nIFJUQy4uLlxuIik7DQo+ID4gKy8qDQo+ID4gKyAqIFdlIGNob29zZSB0aGUgZmlyc3QgYXZh
aWxhYmxlIHJ0YyBkZXZpY2UgaW4gZGV2aWNlIGxpc3QgYXMgdGhlDQo+ID4gKyAqIHN5c3RlbSBy
dGMuDQo+ID4gKyAqLw0KPiA+ICtmZHRfcnRjID0gZmR0X25vZGVfb2Zmc2V0X2lkeF9ieV9jb21w
YXRpYmxlX2xpc3QoZHRiLCAtMSwNCj4gPiArcnRjX2RldmljZV9saXN0LCAmaW5kZXgpOw0KPg0K
PiBNaXNzaW5nIHRoaXMgZnVuY3Rpb24uIEkgZ3Vlc3MgdGhpcyBzaG91bGQgYmUNCj4gZmR0X25v
ZGVfb2Zmc2V0X2J5X2NvbXBhdGlibGVfbGlzdC4NCj4NCk9LDQoNCj4NCj4gPiAraWYgKGZkdF9y
dGMgPCAwKSB7DQo+ID4gK3VrX3ByX3dhcm4oIkNvdWxkIG5vdCBmaW5kIHJ0YyBkZXZpY2UhLCBm
ZHRfcnRjIGlzICVkXG4iLA0KPiA+ICtmZHRfcnRjKTsNCj4gPiArcmV0dXJuOw0KPiA+ICt9DQo+
ID4gKw0KPiA+ICtyZXQgPSBmZHRfZ2V0X2FkZHJlc3MoZHRiLCBmZHRfcnRjLCAwLCAmcnRjX2Jh
c2VfYWRkciwgJnNpemUpOw0KPiA+ICtpZiAocmV0IDwgMCkgew0KPiA+ICt1a19wcl93YXJuKCJD
b3VsZCBub3QgZ2V0IHJ0YyBhZGRyZXNzXG4iKTsNCj4gUHJpbnQgdGhlIGVycm9yIGNvZGUuDQpP
Sw0KDQo+ID4gK3JldHVybjsNCj4gPiArfQ0KPiA+ICsNCj4gPiArcmMgPSBnaWNfZ2V0X2lycV9m
cm9tX2R0YihkdGIsIGZkdF9ydGMsIDAsICZpcnFfdHlwZSwgJmh3aXJxLA0KPiA+ICsmdHJpZ2dl
cl90eXBlKTsNCj4gPiAraWYgKHJjIDwgMCkgew0KPiA+ICt1a19wcl93YXJuKCJGYWlsZWQgdG8g
ZmluZCBJUlEgbnVtYmVyIGZyb20gRFRCXG4iKTsNCj4gUHJpbnQgdGhlIGVycm9yIGNvZGUuDQpP
Sw0KDQo+ID4gK3JldHVybjsNCj4gPiArfQ0KPiA+ICsNCj4gPiAraXJxID0gZ2ljX2lycV90cmFu
c2xhdGUoaXJxX3R5cGUsIGh3aXJxKTsNCj4gPiAraWYgKGlycSA8IDAgfHwgaXJxID49IF9fTUFY
X0lSUSkgew0KPiA+ICt1a19wcl93YXJuKCJGYWlsZWQgdG8gdHJhbnNsYXRlIElSUSBudW1iZXIs
IHR5cGU9JXUsDQo+ID4gKyAgIGh3aXJxPSV1XG4iLCBpcnFfdHlwZSwgaHdpcnEpOw0KPiA+ICty
ZXR1cm47DQo+ID4gK30NCj4gPiArDQo+ID4gK3JjID0gdWtwbGF0X2lycV9yZWdpc3RlcihpcnEs
IHBsMDMxX2lycV9oYW5kbGVyLCBOVUxMKTsNCj4gPiAraWYgKHJjIDwgMCkgew0KPiA+ICt1a19w
cl93YXJuKCJGYWlsZWQgdG8gcmVnaXN0ZXIgcnRjIGludGVycnVwdCBoYW5kbGVyXG4iKTsNCj4g
UHJpbnQgdGhlIGVycm9yIGNvZGUuDQpPSw0KDQo+ID4gK3JldHVybjsNCj4gPiArfQ0KPiA+ICsN
Cj4gPiArcnRjX2Rldl9yZWdpc3RlcigpOw0KPiA+ICsNCj4gPiAraWYgKCFydGNfbGlzdFtpbmRl
eF0tPm9wcy0+c3RhdHVzKCkpDQo+ID4gK3J0Y19saXN0W2luZGV4XS0+b3BzLT5lbmFibGUoUlRD
X0VOQUJMRSk7DQo+ID4gKw0KPiA+ICsvKiBSZWNvcmQgdGhlIGJvb3Qgc2Vjb25kcyAqLw0KPiA+
ICtydGNfYm9vdF9zZWNvbmRzID0gcnRjX2xpc3RbaW5kZXhdLT5vcHMtPnJlYWRfcmF3KCk7DQo+
ID4gKy8qIERpc2FibGUgcnRjIGFsYXJtIGlycSBhdCBpdHMgcmVzZXQgKi8NCj4gPiArcnRjX2xp
c3RbaW5kZXhdLT5vcHMtPmFsYXJtX2lycV9lbmFibGUoUlRDX0RJU0FCTEUpOw0KPiA+ICsNCj4g
PiArdWtfcHJfaW5mbygiRm91bmQgUlRDIG9uOiAlbHVcbiIsIHJ0Y19iYXNlX2FkZHIpOw0KPiA+
ICt9DQo+ID4gZGlmZiAtLWdpdCBhL3BsYXQva3ZtL0NvbmZpZy51ayBiL3BsYXQva3ZtL0NvbmZp
Zy51aw0KPiA+IGluZGV4IDMzNzJiNmMuLjFiZjcyZjMgMTAwNjQ0DQo+ID4gLS0tIGEvcGxhdC9r
dm0vQ29uZmlnLnVrDQo+ID4gKysrIGIvcGxhdC9rdm0vQ29uZmlnLnVrDQo+ID4gQEAgLTEzMyw2
ICsxMzMsMTEgQEAgY29uZmlnIExJQkdJQ1YyDQo+ID4gICAgICAgICAgc2VsZWN0IExJQk9GVw0K
PiA+ICAgICAgICAgIGRlcGVuZHMgb24gQVJDSF9BUk1fNjQNCj4gPg0KPiA+ICtjb25maWcgTElC
UEwwMzENCj4gPiArICAgICAgIGJvb2wgIkFybSBwbGF0Zm9ybSBydGMgZGV2aWNlIGRyaXZlciIN
Cj4gPiArICAgICAgIGRlZmF1bHQgeSBpZiBBUkNIX0FSTV82NA0KPiA+ICsgICAgICAgZGVwZW5k
cyBvbiBBUkNIX0FSTV82NA0KPiA+ICsNCj4gPiAgIGNvbmZpZyBMSUJPRlcNCj4gPiAgICAgICAg
ICBib29sICJPcGVuIEZpcm13YXJlIGxpYnJhcnkgc3VwcG9ydCINCj4gPiAgICAgICAgICBkZWZh
dWx0IG4NCj4gPiBkaWZmIC0tZ2l0IGEvcGxhdC9rdm0vTWFrZWZpbGUudWsgYi9wbGF0L2t2bS9N
YWtlZmlsZS51aw0KPiA+IGluZGV4IGE2ZDZmNWUuLmQ0ZjRjZmQgMTAwNjQ0DQo+ID4gLS0tIGEv
cGxhdC9rdm0vTWFrZWZpbGUudWsNCj4gPiArKysgYi9wbGF0L2t2bS9NYWtlZmlsZS51aw0KPiA+
IEBAIC0xNCw3ICsxNCw3IEBAICQoZXZhbCAkKGNhbGwNCj4gYWRkcGxhdGxpYl9zLGt2bSxsaWJr
dm12aXJ0aW9ibGssJChDT05GSUdfVklSVElPX0JMSykpKQ0KPiA+ICAgJChldmFsICQoY2FsbCBh
ZGRwbGF0bGliX3Msa3ZtLGxpYmt2bXZpcnRpbzlwLCQoQ09ORklHX1ZJUlRJT185UCkpKQ0KPiA+
ICAgJChldmFsICQoY2FsbCBhZGRwbGF0bGliX3Msa3ZtLGxpYmt2bW9mdywkKENPTkZJR19MSUJP
RlcpKSkNCj4gPiAgICQoZXZhbCAkKGNhbGwgYWRkcGxhdGxpYl9zLGt2bSxsaWJrdm1naWN2Miwk
KENPTkZJR19MSUJHSUNWMikpKQ0KPiA+IC0NCj4gPiArJChldmFsICQoY2FsbCBhZGRwbGF0bGli
X3Msa3ZtLGxpYmt2bXBsMDMxLCQoQ09ORklHX0xJQlBMMDMxKSkpDQo+ID4gICAjIw0KPiA+ICAg
IyMgUGxhdGZvcm0gbGlicmFyeSBkZWZpbml0aW9ucw0KPiA+ICAgIyMNCj4gPiBAQCAtMTgxLDMg
KzE4MSwxMiBAQCBMSUJLVk1HSUNWMl9DSU5DTFVERVMteSAgICAgICAgICs9IC0NCj4gSSQoVUtf
UExBVF9DT01NT05fQkFTRSkvaW5jbHVkZQ0KPiA+ICAgTElCS1ZNR0lDVjJfQ0lOQ0xVREVTLXkg
ICAgICAgICArPSAtSSQoVUtfUExBVF9EUklWRVJTX0JBU0UpL2luY2x1ZGUNCj4gPg0KPiA+ICAg
TElCS1ZNR0lDVjJfU1JDUy15ICs9ICQoVUtfUExBVF9EUklWRVJTX0JBU0UpL2dpYy9naWMtdjIu
Yw0KPiA+ICsNCj4gPiArIyMNCj4gPiArIyMgUlRDLVBMMDMxIGxpYnJhcnkgZGVmaW5pdGlvbnMN
Cj4gPiArIyMNCj4gPiArTElCS1ZNUEwwMzFfQ0lOQ0xVREVTLXkrPSAtDQo+IEkkKExJQktWTVBM
QVRfQkFTRSkvaW5jbHVkZQ0KPiBEb2VzIGl0IG5lZWQgc29tZSBoZWFkZXIgZnJvbSB0aGUgIEtW
TSBwbGF0Zm9ybT8NCg0KSSBkb24ndCB0aGluayBzby4gVGhpcyBSVEMgZHJpdmVyIGlzIGNvbW1v
biBvbiBhcm0sIGl0J3MgYmV0dGVyIHB1dCB0aGlzIHVuZGVyICJwbGF0L2NvbW1vbi8iDQpCdXQg
dGhlcmUgaXMgbm8gYSAiTWFrZWZpbGUiLiBTbyBJIGhhdmUgdG8gcHV0IGl0IGhlcmUuDQoNClRo
YW5rcw0KSmlhbnlvbmcNCg0KPiA+ICtMSUJLVk1QTDAzMV9DSU5DTFVERVMteSs9IC0NCj4gSSQo
VUtfUExBVF9DT01NT05fQkFTRSkvaW5jbHVkZQ0KPiA+ICtMSUJLVk1QTDAzMV9DSU5DTFVERVMt
eSs9IC0NCj4gSSQoVUtfUExBVF9EUklWRVJTX0JBU0UpL2luY2x1ZGUNCj4gPiArDQo+ID4gK0xJ
QktWTVBMMDMxX1NSQ1MteSArPSAkKFVLX1BMQVRfRFJJVkVSU19CQVNFKS9ydGMvcGwwMzEuYw0K
SU1QT1JUQU5UIE5PVElDRTogVGhlIGNvbnRlbnRzIG9mIHRoaXMgZW1haWwgYW5kIGFueSBhdHRh
Y2htZW50cyBhcmUgY29uZmlkZW50aWFsIGFuZCBtYXkgYWxzbyBiZSBwcml2aWxlZ2VkLiBJZiB5
b3UgYXJlIG5vdCB0aGUgaW50ZW5kZWQgcmVjaXBpZW50LCBwbGVhc2Ugbm90aWZ5IHRoZSBzZW5k
ZXIgaW1tZWRpYXRlbHkgYW5kIGRvIG5vdCBkaXNjbG9zZSB0aGUgY29udGVudHMgdG8gYW55IG90
aGVyIHBlcnNvbiwgdXNlIGl0IGZvciBhbnkgcHVycG9zZSwgb3Igc3RvcmUgb3IgY29weSB0aGUg
aW5mb3JtYXRpb24gaW4gYW55IG1lZGl1bS4gVGhhbmsgeW91Lg0K


From minios-devel-bounces@lists.xenproject.org Wed Dec 02 16:05:28 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Wed, 02 Dec 2020 16:05:28 +0000
Received: from list by lists.xenproject.org with outflank-mailman.42868.77143 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1kkUd9-0004QT-7F; Wed, 02 Dec 2020 16:05:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 42868.77143; Wed, 02 Dec 2020 16:05: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 1kkUd9-0004QM-47; Wed, 02 Dec 2020 16:05:23 +0000
Received: by outflank-mailman (input) for mailman id 42868;
 Wed, 02 Dec 2020 16:05: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=LBdA=FG=gmail.com=dincadaniel97@srs-us1.protection.inumbo.net>)
 id 1kkUd8-0004QH-2Z
 for minios-devel@lists.xen.org; Wed, 02 Dec 2020 16:05:22 +0000
Received: from mail-ed1-x52b.google.com (unknown [2a00:1450:4864:20::52b])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 86116b5c-d008-4bb5-ae2a-98efd5b9feb9;
 Wed, 02 Dec 2020 16:05:21 +0000 (UTC)
Received: by mail-ed1-x52b.google.com with SMTP id y22so4557105edv.1
 for <minios-devel@lists.xen.org>; Wed, 02 Dec 2020 08:05:21 -0800 (PST)
Received: from ?IPv6:2a02:2f0c:5105:a500:8d18:ff5e:344a:5a1c?
 ([2a02:2f0c:5105:a500:8d18:ff5e:344a:5a1c])
 by smtp.gmail.com with ESMTPSA id r7sm260737edv.39.2020.12.02.08.05.19
 for <minios-devel@lists.xen.org>
 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128);
 Wed, 02 Dec 2020 08:05:19 -0800 (PST)
X-BeenThere: minios-devel@lists.xenproject.org
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
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: 86116b5c-d008-4bb5-ae2a-98efd5b9feb9
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20161025;
        h=to:in-reply-to:from:subject:message-id:date:user-agent:mime-version
         :content-transfer-encoding:content-language;
        bh=pWd9YbMCJZmbEe4ffJFVKC/0y49D4cbtDDBUrSAz9xU=;
        b=X2W1Ii3cQgLqw2GuQEr7lIBlqqnbIQq4pMwW3T8YvIv9JPiLsU6yUWU4F9GxykO+Fq
         Y/OG3JombE67kL+nNZ9YOiFowcCYXoX7j1jGqYQUX+9RJjmvK1e7Q0wW9GX6fZovYMZb
         CTc6dUVG7v/dGgO+1WI9HCIMZ1ruuq483xkoPMPAp5RMsTqLBRkSyz8N+OTztrEcyqio
         5NpT+f2ATdvW+LRTzaLQGq9KQMI2xEj+Mp0ICzK9EJXH8CYEMhyqDaLzlkvOFwY9RH9h
         LPJDi9i08cuac8eVXfAVEdRv+n8Eerbi5mhwWOkyd/dEENdVxhFutCnj+EuD3zeqEEUx
         iHZw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20161025;
        h=x-gm-message-state:to:in-reply-to:from:subject:message-id:date
         :user-agent:mime-version:content-transfer-encoding:content-language;
        bh=pWd9YbMCJZmbEe4ffJFVKC/0y49D4cbtDDBUrSAz9xU=;
        b=Ziu8lpoQNBnT9vKUIyt8WYBAsk/7FijvO/cIdfzTVuJGRxLXwWmExSFgCjBML/dXny
         oKx5JW19tCVVF86o7S4ZdQ2/Ol5FWhogrNwDOZ1uHCmCkug2q7WguL8HL3070TS0C7yZ
         SN36mCWog/KYU9IfTtiitWgMgN4Dg8Bfg6PO3i0s9ne/EUizpYij1/P8crgaS7/Im/b8
         iC8hJ/TfXZH85T+m2rTKk3AvrtmK267UsZitdT+oUGv/xiCsA8eFJLY+KeFvcdfo+2wl
         qWxlvxOoG+W5+EI30f8JXttkqRUDjUWCMgEbOoBBROY9BOcOLsRbzJFL4UP7bD2ywtCG
         xA4Q==
X-Gm-Message-State: AOAM530iKS6grcexFjdZDwYkOh0h4Mm78sHuHwX68dEbSPGT1S+Oia2q
	VWW8BbhaQWhTmUn40GFiL4oQoxxvHiY0Zw==
X-Google-Smtp-Source: ABdhPJxxEP8DOzoggPz/DOxLXxKidTNw4vPET0TeRz+wnK1/9VBayIbCVjqrTvdF4QPVZUIUv2niqQ==
X-Received: by 2002:a50:85c6:: with SMTP id q6mr634837edh.126.1606925119973;
        Wed, 02 Dec 2020 08:05:19 -0800 (PST)
To: minios-devel@lists.xen.org
In-Reply-To: <20200417194116.23195-1-raducanu.costi@gmail.com>
From: Daniel Dinca <dincadaniel97@gmail.com>
Subject: Re: [1/5] lib/vfscore: Register `close` to syscall_shim
Message-ID: <cb98cc4c-fd66-84ff-4f1f-970e3f12b34f@gmail.com>
Date: Wed, 2 Dec 2020 18:05:18 +0200
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101
 Thunderbird/68.10.0
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
Content-Language: en-US

Looks good.

Reviewed-by: Dinca Daniel <dincadaniel97@gmail.com>



From minios-devel-bounces@lists.xenproject.org Wed Dec 02 23:31:27 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Wed, 02 Dec 2020 23:31:27 +0000
Received: from list by lists.xenproject.org with outflank-mailman.43039.77440 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1kkbam-0005zv-En; Wed, 02 Dec 2020 23:31:24 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 43039.77440; Wed, 02 Dec 2020 23:31: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 1kkbam-0005zo-BU; Wed, 02 Dec 2020 23:31:24 +0000
Received: by outflank-mailman (input) for mailman id 43039;
 Wed, 02 Dec 2020 23:31: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=sqtA=FG=neclab.eu=simon.kuenzer@srs-us1.protection.inumbo.net>)
 id 1kkbal-0005z9-2F
 for minios-devel@lists.xen.org; Wed, 02 Dec 2020 23:31:23 +0000
Received: from mailer1.neclab.eu (unknown [195.37.70.40])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 15b268bf-bf09-41d8-b48d-d6accf3e9a43;
 Wed, 02 Dec 2020 23:31:21 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
 by mailer1.neclab.eu (Postfix) with ESMTP id 5566E1039E6;
 Thu,  3 Dec 2020 00:31:20 +0100 (CET)
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 Yt6m9oSsTaCL; Thu,  3 Dec 2020 00:31:20 +0100 (CET)
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 2B2921038E5
 for <minios-devel@lists.xen.org>; Thu,  3 Dec 2020 00:31:20 +0100 (CET)
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, 3 Dec 2020
 00:31:19 +0100
X-BeenThere: minios-devel@lists.xenproject.org
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
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: 15b268bf-bf09-41d8-b48d-d6accf3e9a43
X-Virus-Scanned: Amavisd on Debian GNU/Linux (atlas-a.office.hd)
X-ENC: Last-Hop-TLS-encrypted
X-ENC: Last-Hop-TLS-encrypted
From: Simon Kuenzer <simon.kuenzer@neclab.eu>
To: <minios-devel@lists.xen.org>
CC: Simon Kuenzer <simon.kuenzer@neclab.eu>
Subject: [UNIKRAFT PATCH] alloc.c: Include missing `<stddef.h>`
Date: Thu, 3 Dec 2020 00:31:10 +0100
Message-ID: <20201202233110.28910-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: puck.office.hd (192.168.24.91) To puck.office.hd
 (192.168.24.91)

Include `<stddef.h>` that provides the definition for `size_t`.

Signed-off-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
---
 alloc.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/alloc.c b/alloc.c
index a5b4377..af52f27 100644
--- a/alloc.c
+++ b/alloc.c
@@ -32,6 +32,7 @@
  */
 
 #include <uk/alloc.h>
+#include <stddef.h>
 
 void *sys_malloc(size_t size)
 {
-- 
2.20.1


From minios-devel-bounces@lists.xenproject.org Wed Dec 02 23:32:06 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Wed, 02 Dec 2020 23:32:06 +0000
Received: from list by lists.xenproject.org with outflank-mailman.43044.77443 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1kkbbS-00063d-HQ; Wed, 02 Dec 2020 23:32:06 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 43044.77443; Wed, 02 Dec 2020 23:32: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 1kkbbS-00063W-EW; Wed, 02 Dec 2020 23:32:06 +0000
Received: by outflank-mailman (input) for mailman id 43044;
 Wed, 02 Dec 2020 23:32: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=sqtA=FG=neclab.eu=simon.kuenzer@srs-us1.protection.inumbo.net>)
 id 1kkbbS-00063Q-0G
 for minios-devel@lists.xen.org; Wed, 02 Dec 2020 23:32:06 +0000
Received: from mailer2.neclab.eu (unknown [195.37.70.41])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 539cd298-b27e-4128-a843-9d56b1d7eeb5;
 Wed, 02 Dec 2020 23:32:04 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
 by mailer2.neclab.eu (Postfix) with ESMTP id A69C3F225D;
 Thu,  3 Dec 2020 00:32:03 +0100 (CET)
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 cNvGIY8IamqJ; Thu,  3 Dec 2020 00:32:03 +0100 (CET)
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 82FC0F225C
 for <minios-devel@lists.xen.org>; Thu,  3 Dec 2020 00:32:01 +0100 (CET)
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, 3 Dec 2020
 00:32:01 +0100
X-BeenThere: minios-devel@lists.xenproject.org
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
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: 539cd298-b27e-4128-a843-9d56b1d7eeb5
X-Virus-Scanned: Amavisd on Debian GNU/Linux (atlas-b.office.hd)
X-ENC: Last-Hop-TLS-encrypted
X-ENC: Last-Hop-TLS-encrypted
From: Simon Kuenzer <simon.kuenzer@neclab.eu>
To: <minios-devel@lists.xen.org>
CC: Simon Kuenzer <simon.kuenzer@neclab.eu>
Subject: [UNIKRAFT/LWIP PATCH] alloc.c: Include missing `<stddef.h>`
Date: Thu, 3 Dec 2020 00:31:57 +0100
Message-ID: <20201202233157.28996-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: oberon.office.hd (192.168.24.90) To puck.office.hd
 (192.168.24.91)

Include `<stddef.h>` that provides the definition for `size_t`.

Signed-off-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
---
 alloc.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/alloc.c b/alloc.c
index a5b4377..af52f27 100644
--- a/alloc.c
+++ b/alloc.c
@@ -32,6 +32,7 @@
  */
 
 #include <uk/alloc.h>
+#include <stddef.h>
 
 void *sys_malloc(size_t size)
 {
-- 
2.20.1


From minios-devel-bounces@lists.xenproject.org Wed Dec 02 23:32:22 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Wed, 02 Dec 2020 23:32:22 +0000
Received: from list by lists.xenproject.org with outflank-mailman.43045.77447 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1kkbbi-00065F-JT; Wed, 02 Dec 2020 23:32:22 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 43045.77447; Wed, 02 Dec 2020 23:32: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 1kkbbi-000658-GU; Wed, 02 Dec 2020 23:32:22 +0000
Received: by outflank-mailman (input) for mailman id 43045;
 Wed, 02 Dec 2020 23:32: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=sqtA=FG=neclab.eu=simon.kuenzer@srs-us1.protection.inumbo.net>)
 id 1kkbbh-000652-RT
 for minios-devel@lists.xen.org; Wed, 02 Dec 2020 23:32:21 +0000
Received: from mailer1.neclab.eu (unknown [195.37.70.40])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 8cb21556-42c5-4061-b44d-b647f9d0d5df;
 Wed, 02 Dec 2020 23:32:21 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
 by mailer1.neclab.eu (Postfix) with ESMTP id 6C164103A1C;
 Thu,  3 Dec 2020 00:32:20 +0100 (CET)
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 7TmPsfWiZ_g6; Thu,  3 Dec 2020 00:32:20 +0100 (CET)
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 4C1381039E6
 for <minios-devel@lists.xen.org>; Thu,  3 Dec 2020 00:32:20 +0100 (CET)
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, 3 Dec 2020
 00:32:20 +0100
X-BeenThere: minios-devel@lists.xenproject.org
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
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: 8cb21556-42c5-4061-b44d-b647f9d0d5df
X-Virus-Scanned: Amavisd on Debian GNU/Linux (atlas-a.office.hd)
X-ENC: Last-Hop-TLS-encrypted
X-ENC: Last-Hop-TLS-encrypted
From: Simon Kuenzer <simon.kuenzer@neclab.eu>
To: <minios-devel@lists.xen.org>
CC: Simon Kuenzer <simon.kuenzer@neclab.eu>
Subject: [UNIKRAFT/LWIP PATCH] Option to force polling mode
Date: Thu, 3 Dec 2020 00:32:14 +0100
Message-ID: <20201202233214.29070-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)

Introduces an option to force polling mode for uknetdev devices
irrespective if the device supports interrupt-driven mode.
Because this option always causes 100% CPU utilization it should
be considered as workaround for cases where interrupt-based
handling performs badly.

Signed-off-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
---
 Config.uk  | 14 ++++++++++++++
 uknetdev.c |  4 ++++
 2 files changed, 18 insertions(+)

diff --git a/Config.uk b/Config.uk
index 658e272..6d1fdb1 100644
--- a/Config.uk
+++ b/Config.uk
@@ -23,6 +23,20 @@ config LWIP_UKNETDEV
 		driver does not support receive interrupts the network
 		interfaces have to be polled manually (uknetdev_poll()).
 
+if LWIP_UKNETDEV
+config LWIP_UKNETDEV_POLLONLY
+       depends on LWIP_THREADS
+       bool "Force polling mode (workaround)"
+       default n
+       help
+		This option forces polling mode for uknetdev devices
+		irrespective if the device supports interrupt-driven
+		mode.
+		Because this option always causes 100% CPU utilization
+		it should be considered as workaround for cases where
+		interrupt-based handling performs badly.
+endif
+
 config LWIP_UKNETDEV_SCRATCH
 	int
 	default 64
diff --git a/uknetdev.c b/uknetdev.c
index 0524f12..b665830 100644
--- a/uknetdev.c
+++ b/uknetdev.c
@@ -477,6 +477,10 @@ err_t uknetdev_init(struct netif *nf)
 	if (!lwip_data->dev_info.max_rx_queues
 	    || !lwip_data->dev_info.max_tx_queues)
 		return ERR_IF;
+#if CONFIG_LWIP_UKNETDEV_POLLONLY
+	/* Unset receive interrupt support: We force polling mode */
+	lwip_data->dev_info.features &= ~UK_FEATURE_RXQ_INTR_AVAILABLE;
+#endif /* CONFIG_LWIP_UKNETDEV_POLLONLY */
 	lwip_data->pkt_a = a;
 
 	LWIP_DEBUGF(NETIF_DEBUG,
-- 
2.20.1


From minios-devel-bounces@lists.xenproject.org Wed Dec 02 23:33:17 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Wed, 02 Dec 2020 23:33:17 +0000
Received: from list by lists.xenproject.org with outflank-mailman.43051.77452 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1kkbca-00069x-Mv; Wed, 02 Dec 2020 23:33:16 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 43051.77452; Wed, 02 Dec 2020 23:33: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 1kkbca-00069q-Jx; Wed, 02 Dec 2020 23:33:16 +0000
Received: by outflank-mailman (input) for mailman id 43051;
 Wed, 02 Dec 2020 23:33: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=sqtA=FG=neclab.eu=simon.kuenzer@srs-us1.protection.inumbo.net>)
 id 1kkbcZ-00069l-QM
 for minios-devel@lists.xen.org; Wed, 02 Dec 2020 23:33:15 +0000
Received: from mailer2.neclab.eu (unknown [195.37.70.41])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id af4ccccc-8d33-4558-8fb4-37e52811f057;
 Wed, 02 Dec 2020 23:33:15 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
 by mailer2.neclab.eu (Postfix) with ESMTP id 2C271F225D;
 Thu,  3 Dec 2020 00:33:14 +0100 (CET)
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 gf-yhSKNY5TW; Thu,  3 Dec 2020 00:33:14 +0100 (CET)
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 03BBDF225C
 for <minios-devel@lists.xen.org>; Thu,  3 Dec 2020 00:33:12 +0100 (CET)
Received: from puck.office.hd (192.168.24.91) 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, 3 Dec 2020
 00:33:11 +0100
Received: from puck.office.hd ([192.168.126.12]) by puck.office.hd
 ([192.168.126.12]) with mapi id 15.01.1979.006; Thu, 3 Dec 2020 00:33:11
 +0100
X-BeenThere: minios-devel@lists.xenproject.org
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
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: af4ccccc-8d33-4558-8fb4-37e52811f057
X-Virus-Scanned: Amavisd on Debian GNU/Linux (atlas-b.office.hd)
X-ENC: Last-Hop-TLS-encrypted
X-ENC: Last-Hop-TLS-encrypted
From: Simon Kuenzer <simon.kuenzer@neclab.eu>
To: "minios-devel@lists.xen.org" <minios-devel@lists.xen.org>
Subject: Re: [UNIKRAFT PATCH] alloc.c: Include missing `<stddef.h>`
Thread-Topic: [UNIKRAFT PATCH] alloc.c: Include missing `<stddef.h>`
Thread-Index: AQHWyQM9T6mPUnfo0UaW7/3wP2LijqnkdPeA
Date: Wed, 2 Dec 2020 23:33:11 +0000
Message-ID: <5F4D985F-BEDE-45F4-9057-48DD724A3D07@neclab.eu>
References: <20201202233110.28910-1-simon.kuenzer@neclab.eu>
In-Reply-To: <20201202233110.28910-1-simon.kuenzer@neclab.eu>
Accept-Language: en-GB, gl-ES, en-US
Content-Language: en-US
X-MS-Has-Attach:
X-MS-TNEF-Correlator:
user-agent: Microsoft-MacOutlook/10.10.1b.201012
x-originating-ip: [192.168.24.96]
Content-Type: text/plain; charset="utf-8"
Content-ID: <70160547F606A14CBE75304E12DC1230@office.hd>
Content-Transfer-Encoding: base64
MIME-Version: 1.0

SSBhbSBzb3JyeSwgcGxlYXNlIGlnbm9yZSB0aGlzIHBhdGNoLCB0aGUgdGFnIHdhcyB3cm9uZy4g
VGhpcyB3YXMgZm9yIGx3aXAsIEkgcmVzZW50IGl0Lg0KDQpUaGFua3MsDQoNClNpbW9uDQoNCu+7
v09uIDAzLjEyLjIwLCAwMDozMSwgIlNpbW9uIEt1ZW56ZXIiIDxzaW1vbi5rdWVuemVyQG5lY2xh
Yi5ldT4gd3JvdGU6DQoNCiAgICBJbmNsdWRlIGA8c3RkZGVmLmg+YCB0aGF0IHByb3ZpZGVzIHRo
ZSBkZWZpbml0aW9uIGZvciBgc2l6ZV90YC4NCiAgICANCiAgICBTaWduZWQtb2ZmLWJ5OiBTaW1v
biBLdWVuemVyIDxzaW1vbi5rdWVuemVyQG5lY2xhYi5ldT4NCiAgICAtLS0NCiAgICAgYWxsb2Mu
YyB8IDEgKw0KICAgICAxIGZpbGUgY2hhbmdlZCwgMSBpbnNlcnRpb24oKykNCiAgICANCiAgICBk
aWZmIC0tZ2l0IGEvYWxsb2MuYyBiL2FsbG9jLmMNCiAgICBpbmRleCBhNWI0Mzc3Li5hZjUyZjI3
IDEwMDY0NA0KICAgIC0tLSBhL2FsbG9jLmMNCiAgICArKysgYi9hbGxvYy5jDQogICAgQEAgLTMy
LDYgKzMyLDcgQEANCiAgICAgICovDQogICAgIA0KICAgICAjaW5jbHVkZSA8dWsvYWxsb2MuaD4N
CiAgICArI2luY2x1ZGUgPHN0ZGRlZi5oPg0KICAgICANCiAgICAgdm9pZCAqc3lzX21hbGxvYyhz
aXplX3Qgc2l6ZSkNCiAgICAgew0KICAgIC0tIA0KICAgIDIuMjAuMQ0KICAgIA0KDQo=


From minios-devel-bounces@lists.xenproject.org Thu Dec 03 00:03:54 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Thu, 03 Dec 2020 00:03:54 +0000
Received: from list by lists.xenproject.org with outflank-mailman.43059.77461 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1kkc6A-00018c-E3; Thu, 03 Dec 2020 00:03:50 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 43059.77461; Thu, 03 Dec 2020 00:03: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 1kkc6A-00018V-BF; Thu, 03 Dec 2020 00:03:50 +0000
Received: by outflank-mailman (input) for mailman id 43059;
 Thu, 03 Dec 2020 00:03:48 +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=0nnq=FH=neclab.eu=simon.kuenzer@srs-us1.protection.inumbo.net>)
 id 1kkc68-00018Q-TL
 for minios-devel@lists.xen.org; Thu, 03 Dec 2020 00:03:48 +0000
Received: from mailer1.neclab.eu (unknown [195.37.70.40])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 8b811af1-f768-4c24-a427-4c8c9e3a2ade;
 Thu, 03 Dec 2020 00:03:46 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
 by mailer1.neclab.eu (Postfix) with ESMTP id 846BE1039E6;
 Thu,  3 Dec 2020 01:03:45 +0100 (CET)
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 kzi7cvevBk2H; Thu,  3 Dec 2020 01:03:45 +0100 (CET)
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 63B431003F1
 for <minios-devel@lists.xen.org>; Thu,  3 Dec 2020 01:03:45 +0100 (CET)
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, 3 Dec 2020
 01:03:45 +0100
X-BeenThere: minios-devel@lists.xenproject.org
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
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: 8b811af1-f768-4c24-a427-4c8c9e3a2ade
X-Virus-Scanned: Amavisd on Debian GNU/Linux (atlas-a.office.hd)
X-ENC: Last-Hop-TLS-encrypted
X-ENC: Last-Hop-TLS-encrypted
From: Simon Kuenzer <simon.kuenzer@neclab.eu>
To: <minios-devel@lists.xen.org>
CC: Simon Kuenzer <simon.kuenzer@neclab.eu>
Subject: [UNIKRAFT PATCH] lib/syscall_shim: Avoid warning about unused system call arguments
Date: Thu, 3 Dec 2020 01:03:42 +0100
Message-ID: <20201203000342.32175-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: puck.office.hd (192.168.24.91) To puck.office.hd
 (192.168.24.91)

Some system call implementations may not use all arguments which causes
a compiler warning. This commit adds the `__maybe_unused` attribute to
the arguments when one of the following macros is used for a system call
implementation: `UK_SYSCALL_DEFINE()`, `UK_LLSYSCALL_DEFINE()`,
`UK_SYSCALL_R_DEFINE()`, and `UK_LLSYSCALL_R_DEFINE()`.

Signed-off-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
---
 lib/syscall_shim/include/uk/syscall.h | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/lib/syscall_shim/include/uk/syscall.h b/lib/syscall_shim/include/uk/syscall.h
index ffa9f1ee4..37d7f5f0e 100644
--- a/lib/syscall_shim/include/uk/syscall.h
+++ b/lib/syscall_shim/include/uk/syscall.h
@@ -105,6 +105,8 @@ typedef long uk_syscall_arg_t;
 
 #define UK_S_ARG_LONG(type, arg)   long arg
 #define UK_S_ARG_ACTUAL(type, arg) type arg
+#define UK_S_ARG_LONG_MAYBE_UNUSED(type, arg)   long arg __maybe_unused
+#define UK_S_ARG_ACTUAL_MAYBE_UNUSED(type, arg) type arg __maybe_unused
 #define UK_S_ARG_CAST_LONG(type, arg)   (long) arg
 #define UK_S_ARG_CAST_ACTUAL(type, arg) (type) arg
 
@@ -139,7 +141,8 @@ typedef long uk_syscall_arg_t;
 			UK_ARG_MAPx(x, UK_S_ARG_CAST_ACTUAL, __VA_ARGS__)); \
 	}								\
 	static inline rtype __##ename(UK_ARG_MAPx(x,			\
-						  UK_S_ARG_ACTUAL, __VA_ARGS__))
+						  UK_S_ARG_ACTUAL_MAYBE_UNUSED,\
+						  __VA_ARGS__))
 #define _UK_LLSYSCALL_DEFINE(...) __UK_LLSYSCALL_DEFINE(__VA_ARGS__)
 #define UK_LLSYSCALL_DEFINE(rtype, name, ...)				\
 	_UK_LLSYSCALL_DEFINE(__UK_SYSCALL_DEF_NARGS(__VA_ARGS__),	\
@@ -208,8 +211,9 @@ typedef long uk_syscall_arg_t;
 		return (long) __##rname(				\
 			UK_ARG_MAPx(x, UK_S_ARG_CAST_ACTUAL, __VA_ARGS__)); \
 	}								\
-	static inline rtype __##rname(UK_ARG_MAPx(x, UK_S_ARG_ACTUAL,	\
-						 __VA_ARGS__))
+	static inline rtype __##rname(UK_ARG_MAPx(x,			\
+						  UK_S_ARG_ACTUAL_MAYBE_UNUSED,\
+						  __VA_ARGS__))
 #define _UK_LLSYSCALL_R_DEFINE(...) __UK_LLSYSCALL_R_DEFINE(__VA_ARGS__)
 #define UK_LLSYSCALL_R_DEFINE(rtype, name, ...)				\
 	_UK_LLSYSCALL_R_DEFINE(__UK_SYSCALL_DEF_NARGS(__VA_ARGS__),	\
-- 
2.20.1


From minios-devel-bounces@lists.xenproject.org Thu Dec 03 00:16:55 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Thu, 03 Dec 2020 00:16:55 +0000
Received: from list by lists.xenproject.org with outflank-mailman.42971.77466 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1kkcIm-000265-Dn; Thu, 03 Dec 2020 00:16:52 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 42971.77466; Thu, 03 Dec 2020 00:16: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 1kkcIm-00025y-Ai; Thu, 03 Dec 2020 00:16:52 +0000
Received: by outflank-mailman (input) for mailman id 42971;
 Wed, 02 Dec 2020 18:54: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=GrrD=FG=gmail.com=rodrigoferrazazevedo@srs-us1.protection.inumbo.net>)
 id 1kkXGT-0004mw-M3
 for minios-devel@lists.xenproject.org; Wed, 02 Dec 2020 18:54:09 +0000
Received: from mail-lj1-x230.google.com (unknown [2a00:1450:4864:20::230])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id bb6d1906-18c2-464b-9183-f434ca8b927f;
 Wed, 02 Dec 2020 18:54:08 +0000 (UTC)
Received: by mail-lj1-x230.google.com with SMTP id t22so5059717ljk.0
 for <minios-devel@lists.xenproject.org>; Wed, 02 Dec 2020 10:54:08 -0800 (PST)
X-BeenThere: minios-devel@lists.xenproject.org
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
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: bb6d1906-18c2-464b-9183-f434ca8b927f
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=Xl6mwBj8AujMMSUlt0iqBBpxUdmG1aw+PeHXARmAgBQ=;
        b=Wlx4a4W9i5wPE8XfNKARhj82cVsnFTQSHv/0MEeF3kKdvRXzLCKBy3mX5pKUqYLJEo
         7zhXmBah6g5e8PxRbqbaCoqZ6jqFUV/uDt6iG2cQ9sDpI8Xs0Zo12wDlbnUOfhB+d2f4
         aAVLuldilEY6NF0ECpmEdgh+TSTledUQ3o7U1kx0LgEqkTkRhKRrmw79fNpLnwPF4rXi
         BsydeYDVfmX1R4zI3FbHusVVFSGG2bgF75tMozINN9ADpuLtnEaMjlSZmKGmj7Bo5i+/
         HonzTLpXvgaifTn6e07sfgRnqXm9252sqm0YBS6yDsysxFN950AT3vdVIzYSajREh5Ig
         Ar4g==
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=Xl6mwBj8AujMMSUlt0iqBBpxUdmG1aw+PeHXARmAgBQ=;
        b=rCjTsaetk1AY177k+2zXnMFmxvnfFVN7WgfwcTxzFDS1/ro9clGgiPaT2oqUnJs2jK
         RW9kfwfuOU0oGFyged+YTyEFybVfDSMWdCyQdvt/vEgVlZPZ3/YgXABuuYCFO6KC5aS3
         lO1MDp9h+JBwCoarG7f7TztLnjFiYyzlVuSAc59dMDeswwKsXJyBfoMkYpUgBq1Kn5XT
         IGXVzYlPiO8bvhvoQlPTUMbNOMRRTTXyxweirZ+kfe0qNecp7KQ/gV61fcuGeBTrRlWN
         Zs1URyyQOiWMqtmhU6FMI1xNZaCkZtPQmMui9B5yDR7gCJXrs1gWgsghrhXFw7K3L7UP
         l9Yw==
X-Gm-Message-State: AOAM533o14xDhM3di/dYfzWWo8j1ed88gdXrWrv/SbdDXXvHvgg3uSs1
	kX4I3SwjQrK4yeExZAlFnj++Op0dO0P8mwk3VQgNS8CpvzE6Pg==
X-Google-Smtp-Source: ABdhPJwdvgI2+8TOLK7IqBm0GytHuTBZ+37CY6ncH7HC7PbUSi5JAbAVIkQ0cHtpwfFk57+zZOXJm0k0ETV2xLwfUh8=
X-Received: by 2002:a2e:9615:: with SMTP id v21mr1704248ljh.211.1606935247202;
 Wed, 02 Dec 2020 10:54:07 -0800 (PST)
MIME-Version: 1.0
From: Rodrigo Ferraz Azevedo <rodrigoferrazazevedo@gmail.com>
Date: Wed, 2 Dec 2020 15:54:01 -0300
Message-ID: <CANkJ_md70czyRjNETxkxE2Ri6=3DihJSyxPVc7bpJ4kD-icaaQ@mail.gmail.com>
Subject: Doubts about use the Unikraft in NVIDIA Jetson Nano
To: minios-devel@lists.xenproject.org
Content-Type: multipart/alternative; boundary="00000000000096319805b57fc43c"

--00000000000096319805b57fc43c
Content-Type: text/plain; charset="UTF-8"

Hello Guys,

I had installed Unikraft on an NVIDIA Jetson Nano (ARM Board) and trying to
run my first Unikernel application, but I'm receiving an error below. I
think I'm not using the commands correctly.

Sequence tried:
mkdir my_unikernel
cd my_unikernel
kraft init -a helloworld my_unikernel
kraft configure -m x86_64 -p kvm
kraft build -j
kraft run -p kvm


Anyone can help me?


-----------------------------
Rodrigo Ferraz Azevedo

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

<div dir=3D"ltr">Hello Guys,<div><br></div><div>I had installed Unikraft on=
 an NVIDIA Jetson Nano (ARM Board) and trying=C2=A0to run my first Unikerne=
l application, but I&#39;m receiving an error below. I think I&#39;m not us=
ing the commands correctly.</div><div><br></div><div>Sequence tried:</div><=
div>mkdir my_unikernel</div><div>cd my_unikernel</div><div>kraft init -a he=
lloworld my_unikernel</div><div>kraft configure -m x86_64 -p kvm</div><div>=
kraft build -j</div><div>kraft run -p kvm<br clear=3D"all"><div><div dir=3D=
"ltr"><div dir=3D"ltr"><div><div dir=3D"ltr"><div><br></div><div><br></div>=
<div>Anyone can help me?</div></div></div></div></div></div></div><div><div=
 dir=3D"ltr" class=3D"gmail_signature" data-smartmail=3D"gmail_signature"><=
div dir=3D"ltr"><div><div dir=3D"ltr"><div><br></div><div><br>-------------=
----------------<br>Rodrigo Ferraz Azevedo<div><br></div></div></div></div>=
</div></div></div></div>

--00000000000096319805b57fc43c--


From minios-devel-bounces@lists.xenproject.org Thu Dec 03 09:30:37 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Thu, 03 Dec 2020 09:30:37 +0000
Received: from list by lists.xenproject.org with outflank-mailman.43228.77755 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1kkkwa-0002up-6o; Thu, 03 Dec 2020 09:30:32 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 43228.77755; Thu, 03 Dec 2020 09:30: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 1kkkwa-0002ui-3o; Thu, 03 Dec 2020 09:30:32 +0000
Received: by outflank-mailman (input) for mailman id 43228;
 Thu, 03 Dec 2020 09:30: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=SiMt=FH=gmail.com=dincadaniel97@srs-us1.protection.inumbo.net>)
 id 1kkkwY-0002uY-BY
 for minios-devel@lists.xen.org; Thu, 03 Dec 2020 09:30:30 +0000
Received: from mail-ej1-x644.google.com (unknown [2a00:1450:4864:20::644])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 14a7db07-015d-4d37-b799-2bfe4364e49f;
 Thu, 03 Dec 2020 09:30:29 +0000 (UTC)
Received: by mail-ej1-x644.google.com with SMTP id m19so2392997ejj.11
 for <minios-devel@lists.xen.org>; Thu, 03 Dec 2020 01:30:29 -0800 (PST)
Received: from ?IPv6:2a02:2f0c:5105:a500:904f:a43e:16c8:882c?
 ([2a02:2f0c:5105:a500:904f:a43e:16c8:882c])
 by smtp.gmail.com with ESMTPSA id b15sm763697edv.85.2020.12.03.01.30.27
 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128);
 Thu, 03 Dec 2020 01:30:27 -0800 (PST)
X-BeenThere: minios-devel@lists.xenproject.org
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
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: 14a7db07-015d-4d37-b799-2bfe4364e49f
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20161025;
        h=subject:to:cc:references:from:message-id:date:user-agent
         :mime-version:in-reply-to:content-transfer-encoding:content-language;
        bh=5Dmw66lU6kuJGyl1Qpffj+LHMYACy6aV23Hyws4Ed50=;
        b=XBXmG011pzcpsgvWBPLQ16eauGKgnF8ZhxOczLlshJ1dnFwC1idtoBJ18ud0vHQNKe
         6VnKqaSBSqXINtXvwg/4yzLraDaHzRI+PYMFyHuxLd/xKaVx0Au1AT3dnXPjhlLsrzTg
         cnndsyC5YiB9AuhHmv/wiw9XRXrSqtiV9MgcsVoMl7zv16PVNwgcsHzbs3caF/7bjVmV
         xLPbMIClfDBbVjoedUNYC0ILh8jovnZbj60zY0LsWG7nDygS7inofmP5uuvftRytDu/+
         qUgFCnGJ17nPDPwhDEcWjbv1w4TUn/32PGPW93S4TSzRpV1mjnTRDhUlAhhvW1Mvd1Dm
         EPDw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20161025;
        h=x-gm-message-state:subject:to:cc:references:from:message-id:date
         :user-agent:mime-version:in-reply-to:content-transfer-encoding
         :content-language;
        bh=5Dmw66lU6kuJGyl1Qpffj+LHMYACy6aV23Hyws4Ed50=;
        b=UBbTMqDsSke2jY/l6dsn5kPkCyGtS4aJ4DkI2aNt13JoSFo/3fpX4rvx40A9/o+C5F
         hZYe/xQVlH/01lvyoJFyA6qFRxqeKInUdK97rr052p+91ZPYx7ioDR16O5IA0hUIEcZG
         ceKgfQCkUvO2cgP/XJ6oXpZvJqrCLVJlxtg4qIozO67BZu2IVdNt5iLDTNyNi/kBQQ47
         okcqCzQM3kpINtPrgqJrNLddaKuz7T1qtpojOEc2u8GTxBZQ9F7PqyZMajnRdFzOtOGS
         N6eXHUnR9U1+DsbLDtlpcTMLpQu8ssk7d4305CMeULijStN/cG/vx6E9+oDDSSC79ovD
         a3gQ==
X-Gm-Message-State: AOAM5331oeZnPhPTlhXumZc0qEBVfOiUbyQYuaA2Fz8dHadIHk9AOx9w
	ynAi482Wa2C65gcAJDMYJyY=
X-Google-Smtp-Source: ABdhPJzZCU5Wv59iqvyP3499KrirIKW/3CoIG3IPu181Ha2Cvv7nIgJK5uU1Yg/n7OxdJAE5jyJUmQ==
X-Received: by 2002:a17:906:9a07:: with SMTP id ai7mr1723124ejc.216.1606987828329;
        Thu, 03 Dec 2020 01:30:28 -0800 (PST)
Subject: Re: [UNIKRAFT PATCH 1/5] lib/vfscore: Register `close` to
 syscall_shim
To: Constantin Raducanu <raducanu.costi@gmail.com>, minios-devel@lists.xen.org
Cc: simon.kuenzer@neclab.eu
References: <20200417194116.23195-1-raducanu.costi@gmail.com>
From: Daniel Dinca <dincadaniel97@gmail.com>
Message-ID: <c1bbcc60-4071-ac61-b778-d65c90e597ea@gmail.com>
Date: Thu, 3 Dec 2020 11:30:26 +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: <20200417194116.23195-1-raducanu.costi@gmail.com>
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
Content-Language: en-US

Looks good.

Reviewed-by: Daniel Dinca <dincadaniel97@gmail.com>

On 17.04.2020 22:41, Constantin Raducanu wrote:
> Registers `close` system call to syscall_shim library.
>
> Signed-off-by: Constantin Raducanu <raducanu.costi@gmail.com>
> ---
>   lib/vfscore/Makefile.uk   | 1 +
>   lib/vfscore/exportsyms.uk | 2 ++
>   lib/vfscore/main.c        | 9 ++++-----
>   3 files changed, 7 insertions(+), 5 deletions(-)
>
> diff --git a/lib/vfscore/Makefile.uk b/lib/vfscore/Makefile.uk
> index a3391e6..631f351 100644
> --- a/lib/vfscore/Makefile.uk
> +++ b/lib/vfscore/Makefile.uk
> @@ -29,3 +29,4 @@ UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += write-3 writev-3
>   UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += read-3 readv-3
>   UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += fstat-2
>   UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += readlink-3
> +UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += close-1
> \ No newline at end of file
> diff --git a/lib/vfscore/exportsyms.uk b/lib/vfscore/exportsyms.uk
> index 223bb72..cb01f33 100644
> --- a/lib/vfscore/exportsyms.uk
> +++ b/lib/vfscore/exportsyms.uk
> @@ -18,6 +18,8 @@ write
>   uk_syscall_e_write
>   uk_syscall_r_write
>   close
> +uk_syscall_e_close
> +uk_syscall_r_close
>   read
>   uk_syscall_e_read
>   uk_syscall_r_read
> diff --git a/lib/vfscore/main.c b/lib/vfscore/main.c
> index 846e2ef..e970df1 100644
> --- a/lib/vfscore/main.c
> +++ b/lib/vfscore/main.c
> @@ -207,22 +207,21 @@ int fdclose(int fd)
>   	return error;
>   }
>   
> -int close(int fd)
> +UK_SYSCALL_R_DEFINE(int, close, int, fd)
>   {
>   	int error;
>   
>   	trace_vfs_close(fd);
>   	error = fdclose(fd);
>   	if (error)
> -		goto out_errno;
> +		goto out_error;
>   
>   	trace_vfs_close_ret();
>   	return 0;
>   
> -	out_errno:
> +	out_error:
>   	trace_vfs_close_err(error);
> -	errno = error;
> -	return -1;
> +	return -error;
>   }
>   
>   UK_TRACEPOINT(trace_vfs_mknod, "\"%s\" 0%0o 0x%x", const char*, mode_t, dev_t);
>


From minios-devel-bounces@lists.xenproject.org Thu Dec 03 09:36:42 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Thu, 03 Dec 2020 09:36:42 +0000
Received: from list by lists.xenproject.org with outflank-mailman.43233.77759 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1kkl2W-000387-MJ; Thu, 03 Dec 2020 09:36:40 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 43233.77759; Thu, 03 Dec 2020 09:36: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 1kkl2W-00037z-JR; Thu, 03 Dec 2020 09:36:40 +0000
Received: by outflank-mailman (input) for mailman id 43233;
 Thu, 03 Dec 2020 09:36: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=SiMt=FH=gmail.com=dincadaniel97@srs-us1.protection.inumbo.net>)
 id 1kkl2V-00037u-L6
 for minios-devel@lists.xen.org; Thu, 03 Dec 2020 09:36:39 +0000
Received: from mail-ed1-x542.google.com (unknown [2a00:1450:4864:20::542])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 273c1d93-0c33-4aa5-8589-d5aa0ccfabf7;
 Thu, 03 Dec 2020 09:36:38 +0000 (UTC)
Received: by mail-ed1-x542.google.com with SMTP id r5so1335686eda.12
 for <minios-devel@lists.xen.org>; Thu, 03 Dec 2020 01:36:38 -0800 (PST)
Received: from ?IPv6:2a02:2f0c:5105:a500:904f:a43e:16c8:882c?
 ([2a02:2f0c:5105:a500:904f:a43e:16c8:882c])
 by smtp.gmail.com with ESMTPSA id w17sm753250edu.90.2020.12.03.01.36.36
 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128);
 Thu, 03 Dec 2020 01:36:37 -0800 (PST)
X-BeenThere: minios-devel@lists.xenproject.org
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
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: 273c1d93-0c33-4aa5-8589-d5aa0ccfabf7
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20161025;
        h=subject:to:cc:references:from:message-id:date:user-agent
         :mime-version:in-reply-to:content-transfer-encoding:content-language;
        bh=VMVDcNXBDV5GN2WFLl/4wRG2JSAyA86pHlP6yv4oyr4=;
        b=l39FKqEQaQ1zcdUwtHkBd3h7hJKg8VMRqoXO3AoA1tnc2T3KYWdFLJCZagQ66ydo5C
         abZm7g05euwojDq65b5Ey4gFji5GS3brglAg60IgJRaYDanWGEVcMzr2j/fhL38wVg7f
         sW6SH/PHM0Cg05zAKdJK+ydVwgod9NqgLUPyVNQztEbj+f3c2O7EKjlR2ZPAcS+FyK2N
         KXSjFMDaW830vbVjMZvqU1vt9ews5gVo3wpsFC1QEFE/PWXIpyW0I3GcljacklBos8u5
         5+hcFNp9aHT0jOaKDyXxEtM96sF+ykOaeIZNN18tUdHBy+LVBG79MZuZCdBIAGhTQ1qE
         bryw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20161025;
        h=x-gm-message-state:subject:to:cc:references:from:message-id:date
         :user-agent:mime-version:in-reply-to:content-transfer-encoding
         :content-language;
        bh=VMVDcNXBDV5GN2WFLl/4wRG2JSAyA86pHlP6yv4oyr4=;
        b=kfechSxRo86STud3vLBgoj0eHVb7ptkRpfya1Dibpe7fYYsk4lBIp5PH3dNuREjJ1T
         IJ7aox0zQ1tryAnXnsIaP0M0KdS4mBIi/6+yL5/7mJU2pu2TfiXrBvrpfLSqSWMeIk58
         y8mekF9cToNJ2/b8kVTMEFgG4I1la17TY0eM3qqBiZeEvOL00K+EO54qZbNoY9zbjOAV
         Pi/Se7nVs0aNpzHtB8ImdRZiF/1izAB5+HfG/82cxRJdF1mBwODILRyxIzD4/MscaZVu
         /soJnrsERFm8V2l2FdMfeT9yEE3WuWGhtOCK+sf6xYD03fKqMYTqWTQ3ze+/37Aq4vpY
         z7vA==
X-Gm-Message-State: AOAM533J5NP9KcLGByOa29gSGT2Agio6gcfU0JVi7mjaO1pFY4wiXqq+
	ujxY2VIWFSkg0+GWdoot35A=
X-Google-Smtp-Source: ABdhPJxeEgs0mzkmBL0c5oJHt7IGCDK76iCcaYw/B+ayhdrItWCGdZuDKi6zUg/gHMuNLy0ghuS9QQ==
X-Received: by 2002:a50:b205:: with SMTP id o5mr2044571edd.304.1606988197756;
        Thu, 03 Dec 2020 01:36:37 -0800 (PST)
Subject: Re: [UNIKRAFT PATCH 2/5] lib/vfscore: Register `lseek` to
 syscall_shim
To: Constantin Raducanu <raducanu.costi@gmail.com>, minios-devel@lists.xen.org
Cc: simon.kuenzer@neclab.eu
References: <20200417194116.23195-1-raducanu.costi@gmail.com>
 <20200417194116.23195-2-raducanu.costi@gmail.com>
From: Daniel Dinca <dincadaniel97@gmail.com>
Message-ID: <4520f5bb-6ec8-6ff1-6814-895301193b39@gmail.com>
Date: Thu, 3 Dec 2020 11:36:36 +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: <20200417194116.23195-2-raducanu.costi@gmail.com>
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
Content-Language: en-US

Looks ok.

Reviewed-by: Daniel Dinca <dincadaniel97@gmail.com>

On 17.04.2020 22:41, Constantin Raducanu wrote:
> Registers `lseek` system call to syscall_shim library.
>
> Signed-off-by: Constantin Raducanu <raducanu.costi@gmail.com>
> ---
>   lib/vfscore/Makefile.uk   |  3 ++-
>   lib/vfscore/exportsyms.uk |  2 ++
>   lib/vfscore/main.c        | 11 +++++------
>   3 files changed, 9 insertions(+), 7 deletions(-)
>
> diff --git a/lib/vfscore/Makefile.uk b/lib/vfscore/Makefile.uk
> index 631f351..ec415f4 100644
> --- a/lib/vfscore/Makefile.uk
> +++ b/lib/vfscore/Makefile.uk
> @@ -29,4 +29,5 @@ UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += write-3 writev-3
>   UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += read-3 readv-3
>   UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += fstat-2
>   UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += readlink-3
> -UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += close-1
> \ No newline at end of file
> +UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += close-1
> +UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += lseek-3
> \ No newline at end of file
> diff --git a/lib/vfscore/exportsyms.uk b/lib/vfscore/exportsyms.uk
> index cb01f33..5ad97c2 100644
> --- a/lib/vfscore/exportsyms.uk
> +++ b/lib/vfscore/exportsyms.uk
> @@ -89,6 +89,8 @@ uk_syscall_e_readlink
>   uk_syscall_r_readlink
>   fallocate
>   lseek
> +uk_syscall_e_lseek
> +uk_syscall_r_lseek
>   uk_syscall_e_writev
>   uk_syscall_r_writev
>   umask
> diff --git a/lib/vfscore/main.c b/lib/vfscore/main.c
> index e970df1..8bbce80 100644
> --- a/lib/vfscore/main.c
> +++ b/lib/vfscore/main.c
> @@ -262,7 +262,7 @@ UK_TRACEPOINT(trace_vfs_lseek, "%d 0x%x %d", int, off_t, int);
>   UK_TRACEPOINT(trace_vfs_lseek_ret, "0x%x", off_t);
>   UK_TRACEPOINT(trace_vfs_lseek_err, "%d", int);
>   
> -off_t lseek(int fd, off_t offset, int whence)
> +UK_SYSCALL_R_DEFINE(off_t, lseek, int, fd, off_t, offset, int, whence)
>   {
>   	struct vfscore_file *fp;
>   	off_t org;
> @@ -271,20 +271,19 @@ off_t lseek(int fd, off_t offset, int whence)
>   	trace_vfs_lseek(fd, offset, whence);
>   	error = fget(fd, &fp);
>   	if (error)
> -		goto out_errno;
> +		goto out_error;
>   
>   	error = sys_lseek(fp, offset, whence, &org);
>   	fdrop(fp);
>   
>   	if (error)
> -		goto out_errno;
> +		goto out_error;
>   	trace_vfs_lseek_ret(org);
>   	return org;
>   
> -	out_errno:
> +	out_error:
>   	trace_vfs_lseek_err(error);
> -	errno = error;
> -	return -1;
> +	return -error;
>   }
>   
>   LFS64(lseek);
>


From minios-devel-bounces@lists.xenproject.org Thu Dec 03 09:39:37 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Thu, 03 Dec 2020 09:39:37 +0000
Received: from list by lists.xenproject.org with outflank-mailman.43236.77763 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1kkl5M-0003DC-Uc; Thu, 03 Dec 2020 09:39:36 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 43236.77763; Thu, 03 Dec 2020 09:39: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 1kkl5M-0003D5-Rr; Thu, 03 Dec 2020 09:39:36 +0000
Received: by outflank-mailman (input) for mailman id 43236;
 Thu, 03 Dec 2020 09:39:36 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=SiMt=FH=gmail.com=dincadaniel97@srs-us1.protection.inumbo.net>)
 id 1kkl5M-0003D0-4J
 for minios-devel@lists.xen.org; Thu, 03 Dec 2020 09:39:36 +0000
Received: from mail-ej1-x642.google.com (unknown [2a00:1450:4864:20::642])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 29fb3e8f-60f6-44fe-bd8b-46dd55be67f3;
 Thu, 03 Dec 2020 09:39:35 +0000 (UTC)
Received: by mail-ej1-x642.google.com with SMTP id lt17so2492507ejb.3
 for <minios-devel@lists.xen.org>; Thu, 03 Dec 2020 01:39:35 -0800 (PST)
Received: from ?IPv6:2a02:2f0c:5105:a500:904f:a43e:16c8:882c?
 ([2a02:2f0c:5105:a500:904f:a43e:16c8:882c])
 by smtp.gmail.com with ESMTPSA id r1sm442985eje.51.2020.12.03.01.39.33
 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128);
 Thu, 03 Dec 2020 01:39:34 -0800 (PST)
X-BeenThere: minios-devel@lists.xenproject.org
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
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: 29fb3e8f-60f6-44fe-bd8b-46dd55be67f3
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20161025;
        h=subject:to:cc:references:from:message-id:date:user-agent
         :mime-version:in-reply-to:content-transfer-encoding:content-language;
        bh=P/wSDrepws+IsSuPI4Z9hYleUGbsce6KgJGl9PP4Dts=;
        b=H0Dekpl95K3bnHfLYqbEKexnDEAdqiYjsOVMfbqf0FHH1pKmZKXjbxQTAWjdCq17MV
         HkdqeYq5984BgB/NV3L6MFW1rjIQMgwOX0e+knZFU8Mjx/JmQgKq2kLT9fH++pZ/iGeB
         jp3mgmCFUhu0HtvRDzAiRbTIhnamj+0lBr9yV1DKFChNy4o7fY5I6fKpLs+1Uwu78IE7
         PW9uMIcDUkk2fNu2QzLRyCNFrkeOuvPPAO6H2U41YnbYfVIT8IoIRRO+GYxeF3TJUXe/
         +oIs/S3PEDaA9t/EimQDbQgd9gHjYBaHW2RC/1J5lLSW2Z7h0BIjJQmIH2z7I+7HEKxx
         MNuw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20161025;
        h=x-gm-message-state:subject:to:cc:references:from:message-id:date
         :user-agent:mime-version:in-reply-to:content-transfer-encoding
         :content-language;
        bh=P/wSDrepws+IsSuPI4Z9hYleUGbsce6KgJGl9PP4Dts=;
        b=Wumub7Dlf15/uMxv8TwhGxNsdumb67xZMJZmo9LC9sjwk6H24EdfxWpxoPQ24xEVER
         ZoNKwqKke+2FcExuM12YExIC0xjouLzfAGZmcBf38uDoIdB1Rn96+SxxHQUUOrryWkwU
         ZgDxWehGj8JxdnnKcY/ZzXZqdsImHsWp0dHYaZG4ftW86tZJChNtXb1bXDc3yJUMXAJf
         n6Bnn1EWvYT5KVSxJnDGQcYPctB1EF5DYI+O8NGmcV+Y/HMWj20UdKjygJlT6wTUKiz7
         LcX0ZaW7WIk+Z0JwMEkOq/VuPq3/A6TODkxhxFRVI76NmhuCi8by9wRjAEA4bodWqyAp
         RZEg==
X-Gm-Message-State: AOAM531y4GRXB2irlVXRJfcOUrhzU6pK6VEHEtpsz1AlmRboVyrE2lae
	7XckWzw1bKd9AbQ1obey5ao=
X-Google-Smtp-Source: ABdhPJzWJPBxffq/IdE41Wem/HrqtpK7lnrGMmGXjS3GidJIz3jQxa+yywy2qjEyiPU9h3rwZD9XEg==
X-Received: by 2002:a17:906:2e85:: with SMTP id o5mr1683733eji.521.1606988374548;
        Thu, 03 Dec 2020 01:39:34 -0800 (PST)
Subject: Re: [UNIKRAFT PATCH 4/5] lib/vfscore: Register `ftruncate` to
 syscall_shim
To: Constantin Raducanu <raducanu.costi@gmail.com>, minios-devel@lists.xen.org
Cc: simon.kuenzer@neclab.eu
References: <20200417194116.23195-1-raducanu.costi@gmail.com>
 <20200417194116.23195-4-raducanu.costi@gmail.com>
From: Daniel Dinca <dincadaniel97@gmail.com>
Message-ID: <38c05541-61dd-0d6b-7dad-2fa9001251aa@gmail.com>
Date: Thu, 3 Dec 2020 11:39:33 +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: <20200417194116.23195-4-raducanu.costi@gmail.com>
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
Content-Language: en-US

Looks ok.

Reviewed-by: Daniel Dinca <dincadaniel97@gmail.com>

On 17.04.2020 22:41, Constantin Raducanu wrote:
> Registers `ftruncate` system call to syscall_shim library.
>
> Signed-off-by: Constantin Raducanu <raducanu.costi@gmail.com>
> ---
>   lib/vfscore/Makefile.uk   |  3 ++-
>   lib/vfscore/exportsyms.uk |  2 ++
>   lib/vfscore/main.c        | 11 +++++------
>   3 files changed, 9 insertions(+), 7 deletions(-)
>
> diff --git a/lib/vfscore/Makefile.uk b/lib/vfscore/Makefile.uk
> index 3986676..6580573 100644
> --- a/lib/vfscore/Makefile.uk
> +++ b/lib/vfscore/Makefile.uk
> @@ -31,4 +31,5 @@ UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += fstat-2
>   UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += readlink-3
>   UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += close-1
>   UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += lseek-3
> -UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += link-2
> \ No newline at end of file
> +UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += link-2
> +UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += ftruncate-2
> \ No newline at end of file
> diff --git a/lib/vfscore/exportsyms.uk b/lib/vfscore/exportsyms.uk
> index 57413d6..158386b 100644
> --- a/lib/vfscore/exportsyms.uk
> +++ b/lib/vfscore/exportsyms.uk
> @@ -33,6 +33,8 @@ fhold
>   fdrop
>   fget
>   ftruncate
> +uk_syscall_e_ftruncate
> +uk_syscall_r_ftruncate
>   stat
>   chmod
>   fchmod
> diff --git a/lib/vfscore/main.c b/lib/vfscore/main.c
> index b5b7e40..2600dd2 100644
> --- a/lib/vfscore/main.c
> +++ b/lib/vfscore/main.c
> @@ -1724,7 +1724,7 @@ UK_TRACEPOINT(trace_vfs_ftruncate, "%d 0x%x", int, off_t);
>   UK_TRACEPOINT(trace_vfs_ftruncate_ret, "");
>   UK_TRACEPOINT(trace_vfs_ftruncate_err, "%d", int);
>   
> -int ftruncate(int fd, off_t length)
> +UK_SYSCALL_R_DEFINE(int, ftruncate, int, fd, off_t, length)
>   {
>   	trace_vfs_ftruncate(fd, length);
>   	struct vfscore_file *fp;
> @@ -1732,20 +1732,19 @@ int ftruncate(int fd, off_t length)
>   
>   	error = fget(fd, &fp);
>   	if (error)
> -		goto out_errno;
> +		goto out_error;
>   
>   	error = sys_ftruncate(fp, length);
>   	fdrop(fp);
>   
>   	if (error)
> -		goto out_errno;
> +		goto out_error;
>   	trace_vfs_ftruncate_ret();
>   	return 0;
>   
> -	out_errno:
> -	errno = error;
> +	out_error:
>   	trace_vfs_ftruncate_err(error);
> -	return -1;
> +	return -error;
>   }
>   
>   LFS64(ftruncate);
>


From minios-devel-bounces@lists.xenproject.org Thu Dec 03 09:39:55 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Thu, 03 Dec 2020 09:39:55 +0000
Received: from list by lists.xenproject.org with outflank-mailman.43240.77792 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1kkl5f-0003M1-N3; Thu, 03 Dec 2020 09:39:55 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 43240.77792; Thu, 03 Dec 2020 09:39: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 1kkl5f-0003Lu-JU; Thu, 03 Dec 2020 09:39:55 +0000
Received: by outflank-mailman (input) for mailman id 43240;
 Thu, 03 Dec 2020 09:39: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=SiMt=FH=gmail.com=dincadaniel97@srs-us1.protection.inumbo.net>)
 id 1kkl5f-0003Lg-4d
 for minios-devel@lists.xen.org; Thu, 03 Dec 2020 09:39:55 +0000
Received: from mail-ej1-x644.google.com (unknown [2a00:1450:4864:20::644])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id e41ad6f7-994d-4a5d-88b6-2fb73720c032;
 Thu, 03 Dec 2020 09:39:54 +0000 (UTC)
Received: by mail-ej1-x644.google.com with SMTP id ga15so2482693ejb.4
 for <minios-devel@lists.xen.org>; Thu, 03 Dec 2020 01:39:54 -0800 (PST)
Received: from ?IPv6:2a02:2f0c:5105:a500:904f:a43e:16c8:882c?
 ([2a02:2f0c:5105:a500:904f:a43e:16c8:882c])
 by smtp.gmail.com with ESMTPSA id i2sm747215edk.93.2020.12.03.01.39.52
 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128);
 Thu, 03 Dec 2020 01:39:53 -0800 (PST)
X-BeenThere: minios-devel@lists.xenproject.org
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
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: e41ad6f7-994d-4a5d-88b6-2fb73720c032
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20161025;
        h=subject:to:cc:references:from:message-id:date:user-agent
         :mime-version:in-reply-to:content-transfer-encoding:content-language;
        bh=qBSNsYf858s4S43iw+hVb1b12yWZzFVCyxz5+UwCys8=;
        b=KjvdXjfOzw4hxUecELZo8L0PPxx5/5UvxYCyMtkH7OsfX+KjI/JEnKiRrz3LFWC/3u
         afxfxOAdPDqFDxEsMs6X7apVIbWDd3N8G9YS6xcbn4NzRrF3egiZCKNO9O4mhPE5doN4
         4Db2tGx+xkryD7II+YS90b55UXxH6NcBB0TIg++P3AHRuqnXH0PHLIemSisUoNeZoB2L
         I5Fh8mlEj84UyKiHynRJYoLRuZjOO+FwSyKUZtTohBVrUXd5TOsLmFXYnBBMO+bLOm5S
         B9nRuuNg2TD6qCxhHP/slx+EfhFj0Rl4jWYdVWQrhkejx878nV046O/A+QSESlm32/ry
         cocA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20161025;
        h=x-gm-message-state:subject:to:cc:references:from:message-id:date
         :user-agent:mime-version:in-reply-to:content-transfer-encoding
         :content-language;
        bh=qBSNsYf858s4S43iw+hVb1b12yWZzFVCyxz5+UwCys8=;
        b=UkmMAmTq6mL0hgjTgsn/2n+HwvTgLjPIpKZ7SmzBzouxXLQPCFYsHu+farcoDpeY54
         w3/6epQqkKRQGJPLSwcgMJ/xoktPoi7reSs4fdhBLdGDncGuLqI+gsiTz/UqrsmYkaIx
         btrd4wCrdp01LqjOZ2NGHxmn3broNJmlOHKsP3Gi9ayTzoiBGh+a9Wz0NxHg37Wedh1l
         pIo8SQztM0yLf1CdtcKdL9E0uDNFriqqsDKkp0VHU6xSigwmd5tAhwYlwrOCptAZDhLn
         VdsQzinoBTtBHPMpJRtEtMqM9X8uD21Cz6ushGaUHYJM5hkHjgdWXkxND8dCeW2YShME
         6RtA==
X-Gm-Message-State: AOAM533R78UoYNailvqvChjr8VVwQYjbCPEvEYNkcNaamBALE+1cWCuD
	PtAYnZTnk+tTxBg9s5GR2C0=
X-Google-Smtp-Source: ABdhPJzMiU2TBNrGPmRwcfjv2Z8/jd3pZifJUhR48F3DxoL1tO8odAds/EalD4+nPAUTlEmPYRAmQw==
X-Received: by 2002:a17:907:2116:: with SMTP id qn22mr1702490ejb.483.1606988393619;
        Thu, 03 Dec 2020 01:39:53 -0800 (PST)
Subject: Re: [UNIKRAFT PATCH 5/5] lib/vfscore: Register `truncate` to
 syscall_shim
To: Constantin Raducanu <raducanu.costi@gmail.com>, minios-devel@lists.xen.org
Cc: simon.kuenzer@neclab.eu
References: <20200417194116.23195-1-raducanu.costi@gmail.com>
 <20200417194116.23195-5-raducanu.costi@gmail.com>
From: Daniel Dinca <dincadaniel97@gmail.com>
Message-ID: <4c250830-c7f4-44f5-7c08-3b0a48e00bf4@gmail.com>
Date: Thu, 3 Dec 2020 11:39: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: <20200417194116.23195-5-raducanu.costi@gmail.com>
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
Content-Language: en-US

Looks ok.

Reviewed-by: Daniel Dinca <dincadaniel97@gmail.com>

On 17.04.2020 22:41, Constantin Raducanu wrote:
> Registers `truncate` system call to syscall_shim library.
>
> Signed-off-by: Constantin Raducanu <raducanu.costi@gmail.com>
> ---
>   lib/vfscore/Makefile.uk   |  3 ++-
>   lib/vfscore/exportsyms.uk |  2 ++
>   lib/vfscore/main.c        | 16 +++++++++-------
>   3 files changed, 13 insertions(+), 8 deletions(-)
>
> diff --git a/lib/vfscore/Makefile.uk b/lib/vfscore/Makefile.uk
> index 6580573..662a2c8 100644
> --- a/lib/vfscore/Makefile.uk
> +++ b/lib/vfscore/Makefile.uk
> @@ -32,4 +32,5 @@ UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += readlink-3
>   UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += close-1
>   UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += lseek-3
>   UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += link-2
> -UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += ftruncate-2
> \ No newline at end of file
> +UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += ftruncate-2
> +UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += truncate-2
> \ No newline at end of file
> diff --git a/lib/vfscore/exportsyms.uk b/lib/vfscore/exportsyms.uk
> index 158386b..2805b73 100644
> --- a/lib/vfscore/exportsyms.uk
> +++ b/lib/vfscore/exportsyms.uk
> @@ -72,6 +72,8 @@ uk_syscall_e_readv
>   uk_syscall_r_readv
>   writev
>   truncate
> +uk_syscall_e_truncate
> +uk_syscall_r_truncate
>   mknod
>   preadv
>   ioctl
> diff --git a/lib/vfscore/main.c b/lib/vfscore/main.c
> index 2600dd2..1bcafe0 100644
> --- a/lib/vfscore/main.c
> +++ b/lib/vfscore/main.c
> @@ -1694,7 +1694,7 @@ UK_TRACEPOINT(trace_vfs_truncate, "\"%s\" 0x%x", const char*, off_t);
>   UK_TRACEPOINT(trace_vfs_truncate_ret, "");
>   UK_TRACEPOINT(trace_vfs_truncate_err, "%d", int);
>   
> -int truncate(const char *pathname, off_t length)
> +UK_SYSCALL_R_DEFINE(int, truncate, const char*, pathname, off_t, length)
>   {
>   	trace_vfs_truncate(pathname, length);
>   	struct task *t = main_task;
> @@ -1703,19 +1703,21 @@ int truncate(const char *pathname, off_t length)
>   
>   	error = ENOENT;
>   	if (pathname == NULL)
> -		goto out_errno;
> +		goto out_error;
> +
>   	if ((error = task_conv(t, pathname, VWRITE, path)) != 0)
> -		goto out_errno;
> +		goto out_error;
>   
>   	error = sys_truncate(path, length);
>   	if (error)
> -		goto out_errno;
> +		goto out_error;
> +
>   	trace_vfs_truncate_ret();
>   	return 0;
> -	out_errno:
> -	errno = error;
> +
> +	out_error:
>   	trace_vfs_truncate_err(error);
> -	return -1;
> +	return -error;
>   }
>   
>   LFS64(truncate);
>


From minios-devel-bounces@lists.xenproject.org Thu Dec 03 09:44:10 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Thu, 03 Dec 2020 09:44:10 +0000
Received: from list by lists.xenproject.org with outflank-mailman.43254.77795 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1kkl9l-0004Ky-0Y; Thu, 03 Dec 2020 09:44:09 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 43254.77795; Thu, 03 Dec 2020 09:44: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 1kkl9k-0004Kr-Tx; Thu, 03 Dec 2020 09:44:08 +0000
Received: by outflank-mailman (input) for mailman id 43254;
 Thu, 03 Dec 2020 09:44: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=SiMt=FH=gmail.com=dincadaniel97@srs-us1.protection.inumbo.net>)
 id 1kkl9j-0004Km-Tj
 for minios-devel@lists.xen.org; Thu, 03 Dec 2020 09:44:07 +0000
Received: from mail-ej1-x643.google.com (unknown [2a00:1450:4864:20::643])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id ed5fe2ec-4fd5-464b-bca8-b980868dda76;
 Thu, 03 Dec 2020 09:44:07 +0000 (UTC)
Received: by mail-ej1-x643.google.com with SMTP id d17so2465210ejy.9
 for <minios-devel@lists.xen.org>; Thu, 03 Dec 2020 01:44:07 -0800 (PST)
Received: from ?IPv6:2a02:2f0c:5105:a500:904f:a43e:16c8:882c?
 ([2a02:2f0c:5105:a500:904f:a43e:16c8:882c])
 by smtp.gmail.com with ESMTPSA id be6sm784427edb.29.2020.12.03.01.44.05
 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128);
 Thu, 03 Dec 2020 01:44:05 -0800 (PST)
X-BeenThere: minios-devel@lists.xenproject.org
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
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: ed5fe2ec-4fd5-464b-bca8-b980868dda76
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20161025;
        h=subject:to:cc:references:from:message-id:date:user-agent
         :mime-version:in-reply-to:content-transfer-encoding:content-language;
        bh=bAhkvmW3bIBhZS2DHcgJk1Y4iWVIvO5Z8zgoNmGvqH8=;
        b=l5CvJgyRoYP17fFuMe93s0W94Wr0+NX57mnOvOHCDVz1E+YlEIDjWxcDFWOeSwPETB
         ddH8LSzHcxCQvHCQWFuasvrhdTq6xMr0cp+58BQZddQ400i2Gq4lU98rB9iI0eG8n8ws
         hznyUXnil73fpQAuG/5FNqufedrEgXO1JNuxsGY8Lz8XUmifMxnLQAjPMQEDljFaRSJp
         hhOdV4C2BvITG7XCBKczdbhcQBr860b4p68oWALtmuPN1YjsfvV3mreZb+o+PvV+x+3y
         fbU2PWvpiVe3f9G/EGAPm1/lFJP7CROARmL3mI7Dm1mvURtebUReVS+NgXtTioWopGeM
         G7Ow==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20161025;
        h=x-gm-message-state:subject:to:cc:references:from:message-id:date
         :user-agent:mime-version:in-reply-to:content-transfer-encoding
         :content-language;
        bh=bAhkvmW3bIBhZS2DHcgJk1Y4iWVIvO5Z8zgoNmGvqH8=;
        b=VJnJ+TKbyzHQNlPK2TAcvMxyvD/kKxrYaW+afcIbhabDXy5w9hkiUH2DQjscKebOA7
         ++QBChHhUVkbh2wC6Ql81GM7lWC7xF19RB9Toy24qO56Aoqu3QjYZrfEB8CE5w7vOCPy
         bkj9oyS2EdagICsd8PkZFx+NvqtX7j9lFruFTu2bgdM5z2SW2hsjPQsppfTTZQlvoFwK
         mkj+6kHacwL3Wz4361xoaWOsDtw3qexWI5wsF7aOPB3UZV8JEEhF7IhBafxOsOq/5wZn
         ipyrkAmg7dp1kaR9FTOzvzwiDv9h9plqz6hN/U6LEjULzF2veHUeooY2sjYjmA4lK6Mv
         BF2w==
X-Gm-Message-State: AOAM530ucKHUzr2nKy6/n47ovjzwBOtaUjwd/iIEzLLevR3QDjCRug/Q
	m0DAPcxTaHW35VhJzE41JWM=
X-Google-Smtp-Source: ABdhPJz3nMl+mu7M55rAeMencEh007eANubW9h0dc1DLWihBMTbPh+SGc7CqpU3/nsJThP57eYMnHQ==
X-Received: by 2002:a17:906:168f:: with SMTP id s15mr1707303ejd.180.1606988646325;
        Thu, 03 Dec 2020 01:44:06 -0800 (PST)
Subject: Re: [UNIKRAFT PATCH 01/10] lib/vfscore: Register `access` to
 syscall_shim
To: Constantin Raducanu <raducanu.costi@gmail.com>, minios-devel@lists.xen.org
Cc: simon.kuenzer@neclab.eu
References: <20200428120747.21674-1-raducanu.costi@gmail.com>
From: Daniel Dinca <dincadaniel97@gmail.com>
Message-ID: <057535e7-4fee-86be-cf11-b2aaddcc8103@gmail.com>
Date: Thu, 3 Dec 2020 11:44:04 +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: <20200428120747.21674-1-raducanu.costi@gmail.com>
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
Content-Language: en-US

Looks ok.

Reviewed-by: Daniel Dinca <dincadaniel97@gmail.com>

On 28.04.2020 15:07, Constantin Raducanu wrote:
> Registers `access` system call to syscall_shim library.
>
> Signed-off-by: Constantin Raducanu <raducanu.costi@gmail.com>
> ---
>   lib/vfscore/Makefile.uk   |  3 ++-
>   lib/vfscore/exportsyms.uk |  2 ++
>   lib/vfscore/main.c        | 12 ++++++------
>   3 files changed, 10 insertions(+), 7 deletions(-)
>
> diff --git a/lib/vfscore/Makefile.uk b/lib/vfscore/Makefile.uk
> index 662a2c8..5d50b5d 100644
> --- a/lib/vfscore/Makefile.uk
> +++ b/lib/vfscore/Makefile.uk
> @@ -33,4 +33,5 @@ UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += close-1
>   UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += lseek-3
>   UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += link-2
>   UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += ftruncate-2
> -UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += truncate-2
> \ No newline at end of file
> +UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += truncate-2
> +UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += access-2
> diff --git a/lib/vfscore/exportsyms.uk b/lib/vfscore/exportsyms.uk
> index 2805b73..9c1803a 100644
> --- a/lib/vfscore/exportsyms.uk
> +++ b/lib/vfscore/exportsyms.uk
> @@ -89,6 +89,8 @@ symlink
>   statvfs
>   fstatvfs
>   access
> +uk_syscall_e_access
> +uk_syscall_r_access
>   faccessat
>   readlink
>   uk_syscall_e_readlink
> diff --git a/lib/vfscore/main.c b/lib/vfscore/main.c
> index 1bcafe0..759c41b 100644
> --- a/lib/vfscore/main.c
> +++ b/lib/vfscore/main.c
> @@ -1592,7 +1592,7 @@ UK_TRACEPOINT(trace_vfs_access_err, "%d", int);
>   /*
>    * Check permission for file access
>    */
> -int access(const char *pathname, int mode)
> +UK_SYSCALL_R_DEFINE(int, access, const char*, pathname, int, mode)
>   {
>   	trace_vfs_access(pathname, mode);
>   	struct task *t = main_task;
> @@ -1606,17 +1606,17 @@ int access(const char *pathname, int mode)
>   		acc |= VWRITE;
>   
>   	if ((error = task_conv(t, pathname, acc, path)) != 0)
> -		goto out_errno;
> +		goto out_error;
>   
>   	error = sys_access(path, mode);
>   	if (error)
> -		goto out_errno;
> +		goto out_error;
>   	trace_vfs_access_ret();
>   	return 0;
> -	out_errno:
> -	errno = error;
> +
> +	out_error:
>   	trace_vfs_access_err(error);
> -	return -1;
> +	return -error;
>   }
>   
>   int faccessat(int dirfd, const char *pathname, int mode, int flags)
>


From minios-devel-bounces@lists.xenproject.org Thu Dec 03 09:44:22 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Thu, 03 Dec 2020 09:44:22 +0000
Received: from list by lists.xenproject.org with outflank-mailman.43255.77799 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1kkl9y-0004M2-2f; Thu, 03 Dec 2020 09:44:22 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 43255.77799; Thu, 03 Dec 2020 09:44: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 1kkl9x-0004Lv-W2; Thu, 03 Dec 2020 09:44:21 +0000
Received: by outflank-mailman (input) for mailman id 43255;
 Thu, 03 Dec 2020 09:44: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=SiMt=FH=gmail.com=dincadaniel97@srs-us1.protection.inumbo.net>)
 id 1kkl9x-0004Lp-9M
 for minios-devel@lists.xen.org; Thu, 03 Dec 2020 09:44:21 +0000
Received: from mail-ej1-x644.google.com (unknown [2a00:1450:4864:20::644])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id f2e29c57-8c62-4163-bf4f-6580a301aca0;
 Thu, 03 Dec 2020 09:44:20 +0000 (UTC)
Received: by mail-ej1-x644.google.com with SMTP id n26so2487227eju.6
 for <minios-devel@lists.xen.org>; Thu, 03 Dec 2020 01:44:20 -0800 (PST)
Received: from ?IPv6:2a02:2f0c:5105:a500:904f:a43e:16c8:882c?
 ([2a02:2f0c:5105:a500:904f:a43e:16c8:882c])
 by smtp.gmail.com with ESMTPSA id i21sm775263edt.92.2020.12.03.01.44.18
 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128);
 Thu, 03 Dec 2020 01:44:18 -0800 (PST)
X-BeenThere: minios-devel@lists.xenproject.org
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
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: f2e29c57-8c62-4163-bf4f-6580a301aca0
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20161025;
        h=subject:to:cc:references:from:message-id:date:user-agent
         :mime-version:in-reply-to:content-transfer-encoding:content-language;
        bh=JzsQ2vfR9hEqTbmiknSn1TSzYZTDhdaY7qzZzrJVx4M=;
        b=nR+IogVl3QqBTMJvwPmqpPSaNVYyYGqE3+1mQgxdOiwxkR70RptxJlPR+OicUuqpl5
         0VEvihTQSQpLDRULtq2KhylODBoXjpcf5iU6mf2ickBTkBiUmZDQILRX53PXYxH4HM/0
         9UzfaQ2QS0iYdOqnm+xmEY6oiTNAXnXYVr8Vl45EVYK0Y2FVWlPaX/KlbkHOXrbBMejc
         SNFSovQ7TEnyFMF1irIzrP1h1e0xgk/uSlcijLw0XYMpyf7jKC81VnAYvr9NZ0vL/0BA
         tjAqQLc4NG/6bff/oAuWYG14638/5RWuJnkwxS8FyANrYNutMbLlsgogRSuacSbg1pF0
         sR9Q==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20161025;
        h=x-gm-message-state:subject:to:cc:references:from:message-id:date
         :user-agent:mime-version:in-reply-to:content-transfer-encoding
         :content-language;
        bh=JzsQ2vfR9hEqTbmiknSn1TSzYZTDhdaY7qzZzrJVx4M=;
        b=BcGgbHBMDB7VCYc7KqKIidSlteyZBthmZ5qJZSZjwd/3R3SWL1hYWX+ZcImx37Ywqd
         MkCpmLL05JLNM3MF+dE+gu+nNfSOJfUTON/ZpKosTskibaKSXLKoD61jHRe5nDTaEApP
         Fwy8/769P6PHFJamDJYu54dDdqoVPUj6liH/SDAZncGhi2k7u2o459hL8YBA5JtioV6S
         MQi/5qNnAPycWKNXKUhbJBtaQtEtlGIrDgu/2X2r0q9vJEboQHMKpmQKnlx5gCnapOcS
         hGIeZ7/lZG3tSdwgMNYPAbC6/I4LUVdHBcuG+oaO8ZFoyHoVvSfWwIjgIqhgrADVOrRk
         /xBw==
X-Gm-Message-State: AOAM531Cqa8FPl0MXshr5aHfi/U7YekStKpVbsA8NR75la498R8uNMUX
	mkDD25GX4atXvb7r2z3FL02u5Dcf4IMc4cwD
X-Google-Smtp-Source: ABdhPJywOgMCAg4apj1pLzAzcUAW8uqtJUxCw+qKMz6mg+3YtpbS1dyXrdyJ331bMZw0RqE9yagThQ==
X-Received: by 2002:a17:906:170e:: with SMTP id c14mr1741691eje.117.1606988659677;
        Thu, 03 Dec 2020 01:44:19 -0800 (PST)
Subject: Re: [UNIKRAFT PATCH 02/10] lib/vfscore: Register `faccessat` to
 syscall_shim
To: Constantin Raducanu <raducanu.costi@gmail.com>, minios-devel@lists.xen.org
Cc: simon.kuenzer@neclab.eu
References: <20200428120747.21674-1-raducanu.costi@gmail.com>
 <20200428120747.21674-2-raducanu.costi@gmail.com>
From: Daniel Dinca <dincadaniel97@gmail.com>
Message-ID: <707fd83b-4a77-8b22-4201-cfc5e02352c1@gmail.com>
Date: Thu, 3 Dec 2020 11:44:18 +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: <20200428120747.21674-2-raducanu.costi@gmail.com>
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
Content-Language: en-US

Looks ok.

Reviewed-by: Daniel Dinca <dincadaniel97@gmail.com>

On 28.04.2020 15:07, Constantin Raducanu wrote:
> Registers `faccessat` system call to syscall_shim library.
>
> Signed-off-by: Constantin Raducanu <raducanu.costi@gmail.com>
> ---
>   lib/vfscore/Makefile.uk   | 1 +
>   lib/vfscore/exportsyms.uk | 2 ++
>   lib/vfscore/main.c        | 6 +++---
>   3 files changed, 6 insertions(+), 3 deletions(-)
>
> diff --git a/lib/vfscore/Makefile.uk b/lib/vfscore/Makefile.uk
> index 5d50b5d..da45140 100644
> --- a/lib/vfscore/Makefile.uk
> +++ b/lib/vfscore/Makefile.uk
> @@ -35,3 +35,4 @@ UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += link-2
>   UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += ftruncate-2
>   UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += truncate-2
>   UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += access-2
> +UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += faccessat-4
> diff --git a/lib/vfscore/exportsyms.uk b/lib/vfscore/exportsyms.uk
> index 9c1803a..41c8f3c 100644
> --- a/lib/vfscore/exportsyms.uk
> +++ b/lib/vfscore/exportsyms.uk
> @@ -92,6 +92,8 @@ access
>   uk_syscall_e_access
>   uk_syscall_r_access
>   faccessat
> +uk_syscall_e_faccessat
> +uk_syscall_r_faccessat
>   readlink
>   uk_syscall_e_readlink
>   uk_syscall_r_readlink
> diff --git a/lib/vfscore/main.c b/lib/vfscore/main.c
> index 759c41b..588c4eb 100644
> --- a/lib/vfscore/main.c
> +++ b/lib/vfscore/main.c
> @@ -1619,7 +1619,7 @@ UK_SYSCALL_R_DEFINE(int, access, const char*, pathname, int, mode)
>   	return -error;
>   }
>   
> -int faccessat(int dirfd, const char *pathname, int mode, int flags)
> +UK_SYSCALL_R_DEFINE(int, faccessat, int, dirfd, const char*, pathname, int, mode, int, flags)
>   {
>   	if (flags & AT_SYMLINK_NOFOLLOW) {
>   		UK_CRASH("UNIMPLEMENTED: faccessat() with AT_SYMLINK_NOFOLLOW");
> @@ -1632,8 +1632,7 @@ int faccessat(int dirfd, const char *pathname, int mode, int flags)
>   	struct vfscore_file *fp;
>   	int error = fget(dirfd, &fp);
>   	if (error) {
> -		errno = error;
> -		return -1;
> +		goto out_error;
>   	}
>   
>   	struct vnode *vp = fp->f_dentry->d_vnode;
> @@ -1652,6 +1651,7 @@ int faccessat(int dirfd, const char *pathname, int mode, int flags)
>   	vn_unlock(vp);
>   	fdrop(fp);
>   
> +	out_error:
>   	return error;
>   }
>   
>


From minios-devel-bounces@lists.xenproject.org Thu Dec 03 09:44:33 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Thu, 03 Dec 2020 09:44:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.43257.77804 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1kklA9-0004NQ-5o; Thu, 03 Dec 2020 09:44:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 43257.77804; Thu, 03 Dec 2020 09:44: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 1kklA9-0004NJ-2k; Thu, 03 Dec 2020 09:44:33 +0000
Received: by outflank-mailman (input) for mailman id 43257;
 Thu, 03 Dec 2020 09:44:32 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=SiMt=FH=gmail.com=dincadaniel97@srs-us1.protection.inumbo.net>)
 id 1kklA8-0004NB-4h
 for minios-devel@lists.xen.org; Thu, 03 Dec 2020 09:44:32 +0000
Received: from mail-ej1-x643.google.com (unknown [2a00:1450:4864:20::643])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id caa9ca36-42d1-4c22-a876-1c97d8427320;
 Thu, 03 Dec 2020 09:44:31 +0000 (UTC)
Received: by mail-ej1-x643.google.com with SMTP id a16so2500962ejj.5
 for <minios-devel@lists.xen.org>; Thu, 03 Dec 2020 01:44:31 -0800 (PST)
Received: from ?IPv6:2a02:2f0c:5105:a500:904f:a43e:16c8:882c?
 ([2a02:2f0c:5105:a500:904f:a43e:16c8:882c])
 by smtp.gmail.com with ESMTPSA id w10sm433182ejq.121.2020.12.03.01.44.29
 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128);
 Thu, 03 Dec 2020 01:44:30 -0800 (PST)
X-BeenThere: minios-devel@lists.xenproject.org
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
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: caa9ca36-42d1-4c22-a876-1c97d8427320
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20161025;
        h=subject:to:cc:references:from:message-id:date:user-agent
         :mime-version:in-reply-to:content-transfer-encoding:content-language;
        bh=fpjk9VA1WzSBx3A7UvQmaURdiGPx8zuyJ07tZlpIOhI=;
        b=lG5JUEVOf8Aw8k17joIiK2B//yXslkWrIClSAEC/uoqQAMioDDV5vURysaJvm5xmJ1
         DvyWe2O+2DNSFd5HjUo2RLybLR3cqy7CM9b71XwXxtTf8x68Gpb3mFJa8gfky10xIomT
         sYcYmVdpizi/Nue88V9IV6fiSeO8znCmEOSAgBA7WD0pGFIMMjrnWbTWQ+zV+PSjkeqk
         moMpdS9aDmfhjzygB4QGuSuDW0uxqSTSIC1wy/jmn34kUwP/k1TJ8Pi1sXBh4RGfOK5k
         11in6Tt2e3jg4Pff7V9+AoQe2PL1WzkpQTS4EUuy19neaImvfHBrpsVuzwC2ytOl+fEP
         9i+A==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20161025;
        h=x-gm-message-state:subject:to:cc:references:from:message-id:date
         :user-agent:mime-version:in-reply-to:content-transfer-encoding
         :content-language;
        bh=fpjk9VA1WzSBx3A7UvQmaURdiGPx8zuyJ07tZlpIOhI=;
        b=b4E/OH8BmMy7fQjFARhugSh4Jt4pl00gUEUElb/CKjeaw4KSBuK+DUIz4qjvnp3t4H
         WloI1vV6bJrP4O1B8g8b5sgpEqKLeDSkVs8Dmu5IY+8Vp8Ahwr0mR5Dv0RTCccpN49hR
         +0WVG7MXLB9FbKbEPPaiFG8BFCPljqIpMAeC/hs1Xi8+D6n9egZ+dckbTlBTb8gDCQKM
         cnfr+fYLa5UrgaWWlBbLl0qa09dpMRT5wQW0xn04H4ZdLmTTxatF+y7VWkCFXaJVSbY9
         PIcvzF0ddN3Dvb6ej9QyqO6ZfmOrt31/534gdRu7Y9bxkAioD3J99IYlxiMUhvvVcXTS
         2cMQ==
X-Gm-Message-State: AOAM530SlQm3dyfj4Bj3bhLCGFo8/qIBWbkxgYUpc6Wzeb1ZkrU0q8KH
	NrMCGsdzyUxo0HpNWp48Cow=
X-Google-Smtp-Source: ABdhPJx2DLVdmPKIXbHs1YDYBZZbGeNMuYwfPyBSy5NoRjH/pCEZjZspEK/7tnY+ExIA+AZKv0QG6Q==
X-Received: by 2002:a17:906:9588:: with SMTP id r8mr1701131ejx.148.1606988670574;
        Thu, 03 Dec 2020 01:44:30 -0800 (PST)
Subject: Re: [UNIKRAFT PATCH 03/10] lib/vfscore: Register `fallocate` to
 syscall_shim
To: Constantin Raducanu <raducanu.costi@gmail.com>, minios-devel@lists.xen.org
Cc: simon.kuenzer@neclab.eu
References: <20200428120747.21674-1-raducanu.costi@gmail.com>
 <20200428120747.21674-3-raducanu.costi@gmail.com>
From: Daniel Dinca <dincadaniel97@gmail.com>
Message-ID: <f0b29dca-a527-b27e-f390-c84788ff056b@gmail.com>
Date: Thu, 3 Dec 2020 11:44:29 +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: <20200428120747.21674-3-raducanu.costi@gmail.com>
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
Content-Language: en-US

Looks ok.

Reviewed-by: Daniel Dinca <dincadaniel97@gmail.com>

On 28.04.2020 15:07, Constantin Raducanu wrote:
> Registers `fallocate` system call to syscall_shim library.
>
> Signed-off-by: Constantin Raducanu <raducanu.costi@gmail.com>
> ---
>   lib/vfscore/Makefile.uk   |  1 +
>   lib/vfscore/exportsyms.uk |  2 ++
>   lib/vfscore/main.c        | 11 +++++------
>   3 files changed, 8 insertions(+), 6 deletions(-)
>
> diff --git a/lib/vfscore/Makefile.uk b/lib/vfscore/Makefile.uk
> index da45140..1cae643 100644
> --- a/lib/vfscore/Makefile.uk
> +++ b/lib/vfscore/Makefile.uk
> @@ -36,3 +36,4 @@ UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += ftruncate-2
>   UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += truncate-2
>   UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += access-2
>   UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += faccessat-4
> +UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += fallocate-4
> diff --git a/lib/vfscore/exportsyms.uk b/lib/vfscore/exportsyms.uk
> index 41c8f3c..b897aa7 100644
> --- a/lib/vfscore/exportsyms.uk
> +++ b/lib/vfscore/exportsyms.uk
> @@ -98,6 +98,8 @@ readlink
>   uk_syscall_e_readlink
>   uk_syscall_r_readlink
>   fallocate
> +uk_syscall_e_fallocate
> +uk_syscall_r_fallocate
>   lseek
>   uk_syscall_e_lseek
>   uk_syscall_r_lseek
> diff --git a/lib/vfscore/main.c b/lib/vfscore/main.c
> index 588c4eb..eb007b9 100644
> --- a/lib/vfscore/main.c
> +++ b/lib/vfscore/main.c
> @@ -1785,7 +1785,7 @@ UK_TRACEPOINT(trace_vfs_fallocate, "%d %d 0x%x 0x%x", int, int, loff_t, loff_t);
>   UK_TRACEPOINT(trace_vfs_fallocate_ret, "");
>   UK_TRACEPOINT(trace_vfs_fallocate_err, "%d", int);
>   
> -int fallocate(int fd, int mode, loff_t offset, loff_t len)
> +UK_SYSCALL_R_DEFINE(int, fallocate, int, fd, int, mode, loff_t, offset, loff_t, len)
>   {
>   	struct vfscore_file *fp;
>   	int error;
> @@ -1793,20 +1793,19 @@ int fallocate(int fd, int mode, loff_t offset, loff_t len)
>   	trace_vfs_fallocate(fd, mode, offset, len);
>   	error = fget(fd, &fp);
>   	if (error)
> -		goto out_errno;
> +		goto out_error;
>   
>   	error = sys_fallocate(fp, mode, offset, len);
>   	fdrop(fp);
>   
>   	if (error)
> -		goto out_errno;
> +		goto out_error;
>   	trace_vfs_fallocate_ret();
>   	return 0;
>   
> -	out_errno:
> +	out_error:
>   	trace_vfs_fallocate_err(error);
> -	errno = error;
> -	return -1;
> +	return -error;
>   }
>   
>   LFS64(fallocate);
>


From minios-devel-bounces@lists.xenproject.org Thu Dec 03 09:44:46 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Thu, 03 Dec 2020 09:44:46 +0000
Received: from list by lists.xenproject.org with outflank-mailman.43259.77807 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1kklAM-0004Oz-7k; Thu, 03 Dec 2020 09:44:46 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 43259.77807; Thu, 03 Dec 2020 09:44: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 1kklAM-0004Os-4k; Thu, 03 Dec 2020 09:44:46 +0000
Received: by outflank-mailman (input) for mailman id 43259;
 Thu, 03 Dec 2020 09:44: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=SiMt=FH=gmail.com=dincadaniel97@srs-us1.protection.inumbo.net>)
 id 1kklAL-0004On-7i
 for minios-devel@lists.xen.org; Thu, 03 Dec 2020 09:44:45 +0000
Received: from mail-ed1-x541.google.com (unknown [2a00:1450:4864:20::541])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 4dd37235-bed7-4b9e-b219-22c63e831ffc;
 Thu, 03 Dec 2020 09:44:44 +0000 (UTC)
Received: by mail-ed1-x541.google.com with SMTP id r5so1360005eda.12
 for <minios-devel@lists.xen.org>; Thu, 03 Dec 2020 01:44:44 -0800 (PST)
Received: from ?IPv6:2a02:2f0c:5105:a500:904f:a43e:16c8:882c?
 ([2a02:2f0c:5105:a500:904f:a43e:16c8:882c])
 by smtp.gmail.com with ESMTPSA id e12sm797373edm.48.2020.12.03.01.44.42
 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128);
 Thu, 03 Dec 2020 01:44:43 -0800 (PST)
X-BeenThere: minios-devel@lists.xenproject.org
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
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: 4dd37235-bed7-4b9e-b219-22c63e831ffc
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20161025;
        h=subject:to:cc:references:from:message-id:date:user-agent
         :mime-version:in-reply-to:content-transfer-encoding:content-language;
        bh=2JRPxyVV4fcH8ys4OkgzUH36Vxm5oYLTdOAYfdVTDg4=;
        b=Z2JijUHh+GiXuSDlQdD8shb7CXsosk6yjnodBeLMtKBZi6iQMg+zAXbjOVaVY2M+X3
         pHxTCPYp0yuNPZVZ459Ko8bwGihbSdSu90Ce/lJ01x64I+MZYwb1eobGFVjQvZ/VOmMW
         HzVBVUw1nCJqhZvpJgHJHA7WH0K2e86sdQqkTVjxfcRfQrkXfNhL6/ocNoAXte8pngug
         NTzqQRo1zBPnbA3CqD5TeaTe69ImqJfeOktuXRGj6Nx9pp9wliHH+2/lcW7fWZA6MaRz
         40KqJP6dME+ltSPVXM9ynXL/HsuBLDnPIXdqkDHAfBe2Y4rsBOZAaM5qfK4RgqH6YEgR
         Ctnw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20161025;
        h=x-gm-message-state:subject:to:cc:references:from:message-id:date
         :user-agent:mime-version:in-reply-to:content-transfer-encoding
         :content-language;
        bh=2JRPxyVV4fcH8ys4OkgzUH36Vxm5oYLTdOAYfdVTDg4=;
        b=nX6ZKCNjvpe9j7tIUUoUWm5x9bsTy0A+gAF1FCKCKPt1vTTt2+GhkjhY2dcEWzQxKC
         Hm1Utgosr8Wp6ViVoaNLTClCCF2RNrVo6i2L60PYLV5eJ/qhBjkOaXFaagiyYQyDqN34
         wQC9uzvld2ciTcmpMwgpNBhsQFMQlJTRQzHTILj9FLDh1tIOJCcAutYopea0xwtNbuvE
         vuN//XTppOfiY2VxmNvx6q2e0fCpCiOxE+GkSmohcuuYE9GK1nJuJo1g5T286SyXuiSW
         jebrvBZjLmgRQ4kOe8DqT4GKzcqR8brZfP2didtTGktODgdvg01fhAtm4MCdV/d92YmZ
         pK4A==
X-Gm-Message-State: AOAM5333G0oTg7tE/zUojoUE8timmWg8jbrv7poUODzIfZ+5YVe4vehV
	1H9pWqyyF717KOfNdllgBg4=
X-Google-Smtp-Source: ABdhPJwOSRo4hYFnqBcILkUgPA3n4y7CE96wPySUPQ5cUI3rcOTAXURD6NomPyvRSaomOAO3Sx9yqQ==
X-Received: by 2002:a50:8a02:: with SMTP id i2mr2090904edi.222.1606988683537;
        Thu, 03 Dec 2020 01:44:43 -0800 (PST)
Subject: Re: [UNIKRAFT PATCH 06/10] lib/vfscore: Register `chdir` to
 syscall_shim
To: Constantin Raducanu <raducanu.costi@gmail.com>, minios-devel@lists.xen.org
Cc: simon.kuenzer@neclab.eu
References: <20200428120747.21674-1-raducanu.costi@gmail.com>
 <20200428120747.21674-6-raducanu.costi@gmail.com>
From: Daniel Dinca <dincadaniel97@gmail.com>
Message-ID: <8aa9962e-d4bb-db15-d753-1115396fb7e9@gmail.com>
Date: Thu, 3 Dec 2020 11:44:42 +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: <20200428120747.21674-6-raducanu.costi@gmail.com>
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
Content-Language: en-US

Looks ok.

Reviewed-by: Daniel Dinca <dincadaniel97@gmail.com>

On 28.04.2020 15:07, Constantin Raducanu wrote:
> Registers `chdir` system call to syscall_shim library.
>
> Signed-off-by: Constantin Raducanu <raducanu.costi@gmail.com>
> ---
>   lib/vfscore/Makefile.uk   |  1 +
>   lib/vfscore/exportsyms.uk |  2 ++
>   lib/vfscore/main.c        | 16 ++++++++--------
>   3 files changed, 11 insertions(+), 8 deletions(-)
>
> diff --git a/lib/vfscore/Makefile.uk b/lib/vfscore/Makefile.uk
> index e77818d..5ccc917 100644
> --- a/lib/vfscore/Makefile.uk
> +++ b/lib/vfscore/Makefile.uk
> @@ -39,3 +39,4 @@ UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += faccessat-4
>   UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += fallocate-4
>   UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += chmod-2
>   UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += fchmod-2
> +UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += chdir-1
> diff --git a/lib/vfscore/exportsyms.uk b/lib/vfscore/exportsyms.uk
> index 03a02bb..64ca3f6 100644
> --- a/lib/vfscore/exportsyms.uk
> +++ b/lib/vfscore/exportsyms.uk
> @@ -58,6 +58,8 @@ getcwd
>   chown
>   chroot
>   chdir
> +uk_syscall_e_chdir
> +uk_syscall_r_chdir
>   fstatat
>   statfs
>   lstat
> diff --git a/lib/vfscore/main.c b/lib/vfscore/main.c
> index d5ece51..8d074fe 100644
> --- a/lib/vfscore/main.c
> +++ b/lib/vfscore/main.c
> @@ -1001,7 +1001,7 @@ __do_fchdir(struct vfscore_file *fp, struct task *t)
>   	return error;
>   }
>   
> -int chdir(const char *pathname)
> +UK_SYSCALL_R_DEFINE(int, chdir, const char*, pathname)
>   {
>   	trace_vfs_chdir(pathname);
>   	struct task *t = main_task;
> @@ -1011,29 +1011,29 @@ int chdir(const char *pathname)
>   
>   	error = ENOENT;
>   	if (pathname == NULL)
> -		goto out_errno;
> +		goto out_error;
>   
>   	if ((error = task_conv(t, pathname, VREAD, path)) != 0)
> -		goto out_errno;
> +		goto out_error;
>   
>   	/* Check if directory exits */
>   	error = sys_open(path, O_DIRECTORY, 0, &fp);
>   	if (error) {
> -		goto out_errno;
> +		goto out_error;
>   	}
>   
>   	error = __do_fchdir(fp, t);
>   	if (error) {
>   		fdrop(fp);
> -		goto out_errno;
> +		goto out_error;
>   	}
>   
>   	trace_vfs_chdir_ret();
>   	return 0;
> -	out_errno:
> -	errno = error;
> +
> +	out_error:
>   	trace_vfs_chdir_err(errno);
> -	return -1;
> +	return -error;
>   }
>   
>   UK_TRACEPOINT(trace_vfs_fchdir, "%d", int);
>


From minios-devel-bounces@lists.xenproject.org Thu Dec 03 09:44:58 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Thu, 03 Dec 2020 09:44:58 +0000
Received: from list by lists.xenproject.org with outflank-mailman.43262.77811 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1kklAY-0004R2-9h; Thu, 03 Dec 2020 09:44:58 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 43262.77811; Thu, 03 Dec 2020 09:44: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 1kklAY-0004Qv-6j; Thu, 03 Dec 2020 09:44:58 +0000
Received: by outflank-mailman (input) for mailman id 43262;
 Thu, 03 Dec 2020 09:44:57 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=SiMt=FH=gmail.com=dincadaniel97@srs-us1.protection.inumbo.net>)
 id 1kklAX-0004Qo-19
 for minios-devel@lists.xen.org; Thu, 03 Dec 2020 09:44:57 +0000
Received: from mail-ej1-x643.google.com (unknown [2a00:1450:4864:20::643])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 206bf23c-c4a2-4b15-8770-8541a1fa86b3;
 Thu, 03 Dec 2020 09:44:56 +0000 (UTC)
Received: by mail-ej1-x643.google.com with SMTP id x16so2479977ejj.7
 for <minios-devel@lists.xen.org>; Thu, 03 Dec 2020 01:44:56 -0800 (PST)
Received: from ?IPv6:2a02:2f0c:5105:a500:904f:a43e:16c8:882c?
 ([2a02:2f0c:5105:a500:904f:a43e:16c8:882c])
 by smtp.gmail.com with ESMTPSA id n17sm444362ejh.49.2020.12.03.01.44.54
 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128);
 Thu, 03 Dec 2020 01:44:55 -0800 (PST)
X-BeenThere: minios-devel@lists.xenproject.org
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
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: 206bf23c-c4a2-4b15-8770-8541a1fa86b3
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20161025;
        h=subject:to:cc:references:from:message-id:date:user-agent
         :mime-version:in-reply-to:content-transfer-encoding:content-language;
        bh=mcGdts6U0ZZxJyjIlQEBgr9380usAW6Z+zgY9HnEqls=;
        b=ITFfifU+v8EtBeEaaCYXuGXaNxc0JSsf0GJgPKq8K4gQS/7OFYpt2pm8nLJQn0pcqM
         KnGUc2peXiTq3E2Rmag7e1PYD48auak6PDPNCw7QWPXzqRvBMf8s7nSA0LKVNFa0yptA
         WTmC2MbJTeWusj6Rpb9Nufo3MF4mo0DKfvYWcSdJg4dtnzwAeLnyq5HfK2zMKJS1SQgD
         seNyrVaAdy/d1m3UCUiIhmghKzQUQlKhP2coW1DkY/vj7BmOnt2ASMxDGeKdogPP69XN
         AvYtWEMysFXxrbLWOTNyVqBT2CQdisl+Jq9sGJQ2jj22RhgVteIQaGefRBRVpU4dZQ5d
         CZTw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20161025;
        h=x-gm-message-state:subject:to:cc:references:from:message-id:date
         :user-agent:mime-version:in-reply-to:content-transfer-encoding
         :content-language;
        bh=mcGdts6U0ZZxJyjIlQEBgr9380usAW6Z+zgY9HnEqls=;
        b=ZvWuIGofmaIO/Sz02Ejdd+ePrYEwdGtfxpCs2GFLn3WnlJ7yFJLy9cFwNiHvyr8dzC
         mi6NRskpDCxmt6GPzpPi33u2PKbP8M4mTxY5kgHAjEzaVcSm4icR6GXX7rZELncprGYo
         IfMEcXHe1uO9MHBcYI3Ac9ngIBArssvy6QOSdn4JiaUhlBRigaczWEKHU9zIl3YzG+y0
         /L+/pEDdzlAKXifCuJdf7fPMIweJZusV4EgbLMh1nDylr38i095VfeX7dxotSHbAxUBD
         liB1UA13OwvJK+/2EkyJ9y9uv4MsKevsNAKkIoK8ltevyub4uhu1vNEEs5ABLIQlKQIg
         SYDQ==
X-Gm-Message-State: AOAM532JUE7R471XdLgri8J3jX27CNeBTj2nb+t/ng3UmxH32rdp7UQp
	l7MGrFBysRy5dfTuirBkWJg=
X-Google-Smtp-Source: ABdhPJxMyGOLxrGeWtUaUUBIUROrHU0WthOzOQvNtalTE1uj2qeOISfRJdimgSmoy2Hu8wTBKZkk9w==
X-Received: by 2002:a17:906:304c:: with SMTP id d12mr1813141ejd.84.1606988695501;
        Thu, 03 Dec 2020 01:44:55 -0800 (PST)
Subject: Re: [UNIKRAFT PATCH 07/10] lib/vfscore: Register `fchdir` to
 syscall_shim
To: Constantin Raducanu <raducanu.costi@gmail.com>, minios-devel@lists.xen.org
Cc: simon.kuenzer@neclab.eu
References: <20200428120747.21674-1-raducanu.costi@gmail.com>
 <20200428120747.21674-7-raducanu.costi@gmail.com>
From: Daniel Dinca <dincadaniel97@gmail.com>
Message-ID: <d6fd5079-c2e1-61eb-a13b-eef31aac6511@gmail.com>
Date: Thu, 3 Dec 2020 11:44: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: <20200428120747.21674-7-raducanu.costi@gmail.com>
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
Content-Language: en-US

Looks ok.

Reviewed-by: Daniel Dinca <dincadaniel97@gmail.com>

On 28.04.2020 15:07, Constantin Raducanu wrote:
> Registers `fchdir` system call to syscall_shim library.
>
> Signed-off-by: Constantin Raducanu <raducanu.costi@gmail.com>
> ---
>   lib/vfscore/Makefile.uk   |  1 +
>   lib/vfscore/exportsyms.uk |  2 ++
>   lib/vfscore/main.c        | 11 +++++------
>   3 files changed, 8 insertions(+), 6 deletions(-)
>
> diff --git a/lib/vfscore/Makefile.uk b/lib/vfscore/Makefile.uk
> index 5ccc917..68d108c 100644
> --- a/lib/vfscore/Makefile.uk
> +++ b/lib/vfscore/Makefile.uk
> @@ -40,3 +40,4 @@ UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += fallocate-4
>   UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += chmod-2
>   UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += fchmod-2
>   UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += chdir-1
> +UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += fchdir-1
> diff --git a/lib/vfscore/exportsyms.uk b/lib/vfscore/exportsyms.uk
> index 64ca3f6..583a75e 100644
> --- a/lib/vfscore/exportsyms.uk
> +++ b/lib/vfscore/exportsyms.uk
> @@ -91,6 +91,8 @@ telldir
>   seekdir
>   rmdir
>   fchdir
> +uk_syscall_e_fchdir
> +uk_syscall_r_fchdir
>   symlink
>   statvfs
>   fstatvfs
> diff --git a/lib/vfscore/main.c b/lib/vfscore/main.c
> index 8d074fe..c6e446a 100644
> --- a/lib/vfscore/main.c
> +++ b/lib/vfscore/main.c
> @@ -1040,7 +1040,7 @@ UK_TRACEPOINT(trace_vfs_fchdir, "%d", int);
>   UK_TRACEPOINT(trace_vfs_fchdir_ret, "");
>   UK_TRACEPOINT(trace_vfs_fchdir_err, "%d", int);
>   
> -int fchdir(int fd)
> +UK_SYSCALL_R_DEFINE(int, fchdir, int, fd)
>   {
>   	trace_vfs_fchdir(fd);
>   	struct task *t = main_task;
> @@ -1049,21 +1049,20 @@ int fchdir(int fd)
>   
>   	error = fget(fd, &fp);
>   	if (error)
> -		goto out_errno;
> +		goto out_error;
>   
>   	error = __do_fchdir(fp, t);
>   	if (error) {
>   		fdrop(fp);
> -		goto out_errno;
> +		goto out_error;
>   	}
>   
>   	trace_vfs_fchdir_ret();
>   	return 0;
>   
> -	out_errno:
> +	out_error:
>   	trace_vfs_fchdir_err(error);
> -	errno = error;
> -	return -1;
> +	return -error;
>   }
>   
>   UK_TRACEPOINT(trace_vfs_link, "\"%s\" \"%s\"", const char*, const char*);
>


From minios-devel-bounces@lists.xenproject.org Thu Dec 03 09:45:23 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Thu, 03 Dec 2020 09:45:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.43265.77815 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1kklAw-0004SV-CC; Thu, 03 Dec 2020 09:45:22 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 43265.77815; Thu, 03 Dec 2020 09:45: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 1kklAw-0004SO-9C; Thu, 03 Dec 2020 09:45:22 +0000
Received: by outflank-mailman (input) for mailman id 43265;
 Thu, 03 Dec 2020 09:45: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=SiMt=FH=gmail.com=dincadaniel97@srs-us1.protection.inumbo.net>)
 id 1kklAv-0004SJ-Ju
 for minios-devel@lists.xen.org; Thu, 03 Dec 2020 09:45:21 +0000
Received: from mail-ej1-x643.google.com (unknown [2a00:1450:4864:20::643])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id e6609226-d748-4566-b877-c19bb70de53d;
 Thu, 03 Dec 2020 09:45:20 +0000 (UTC)
Received: by mail-ej1-x643.google.com with SMTP id g20so2539922ejb.1
 for <minios-devel@lists.xen.org>; Thu, 03 Dec 2020 01:45:20 -0800 (PST)
Received: from ?IPv6:2a02:2f0c:5105:a500:904f:a43e:16c8:882c?
 ([2a02:2f0c:5105:a500:904f:a43e:16c8:882c])
 by smtp.gmail.com with ESMTPSA id k18sm770434edx.18.2020.12.03.01.45.19
 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128);
 Thu, 03 Dec 2020 01:45:19 -0800 (PST)
X-BeenThere: minios-devel@lists.xenproject.org
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
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: e6609226-d748-4566-b877-c19bb70de53d
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20161025;
        h=subject:to:cc:references:from:message-id:date:user-agent
         :mime-version:in-reply-to:content-transfer-encoding:content-language;
        bh=eS0gXD6DUaOrp4fGTv9cOwzrWGbcT1T0o7grOh5kHLo=;
        b=JNdwUZOCjmrH86mPvTo4XaIwigEu74J1bdgFOaFoI9YzKjnomTBkKS0T/7maF8kYIY
         6mxdYr9HOu4x3hZLtiVzVcaa34vzfGfFWZAwuqA3B68HPFSc6VeWfoDffxDDiMBczUtj
         +A3xrzZ8ICZzZ1e10t3U+XXsZeGe0uX4rvzOHUv3Eit10rkI96RsGpC/6bU4Nwep50tR
         FLXmThVsnvrYU+WTdZIjdhvFX+u/giZnq6rdf3P2L/tAoxXADeHQxcG1r6ysYh8SYKbM
         6U7vfGIvCMVQGJjJVcg3bKFA/9wlUpcioD+R3dLwx99FyWdDgO3OH7VjIjJdckFrgOyK
         WLIg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20161025;
        h=x-gm-message-state:subject:to:cc:references:from:message-id:date
         :user-agent:mime-version:in-reply-to:content-transfer-encoding
         :content-language;
        bh=eS0gXD6DUaOrp4fGTv9cOwzrWGbcT1T0o7grOh5kHLo=;
        b=q3xGyALC4OLTHWxW/vBC1pIlCKgceQdVSMRfhDyPYYItVNW1ktk9Zf3fgwu1jtwj+9
         VhEjnVV2TN6/HCSoU9JsY3Km2l7svqYk/zgM0OhyRDuYYoIdIf2E3pRl44pHO+zEjRky
         XPPu3PQ23ITtWaUAzrXVabDpWtxKSko8AX2SOAROSJF8oRs0Uh5tyQxshg68zI4cRf1I
         HJ9aj5RyHpCU+iO9Kd7QzUmUBoO11Rj/tAEoNMkKc90r7Q0VMdW++1KqPZlMj+zbpzzW
         seX7hyo6NFxHiJ7XR22IFAe4edaBI6vtR/HPet4BbCSY5laxPAZBHTHaJL+i7oHX9PPv
         +0+w==
X-Gm-Message-State: AOAM532UT8V1G6Xp5DzFAAvlpSbfohuis6kXOX5SJUnN4nA4cNJc/szR
	qhNezh+yg8uy16mfHz6BFlA=
X-Google-Smtp-Source: ABdhPJyth9D07kQqWooiAyO4mTFdkGysPA04ZZ8SSidlB58ZR2CnjfG9fitiEPfCTQLzuvHeF9RP6A==
X-Received: by 2002:a17:906:33d4:: with SMTP id w20mr1713055eja.396.1606988720013;
        Thu, 03 Dec 2020 01:45:20 -0800 (PST)
Subject: Re: [UNIKRAFT PATCH 09/10] lib/vfscore: Register `dup3` to
 syscall_shim
To: Constantin Raducanu <raducanu.costi@gmail.com>, minios-devel@lists.xen.org
Cc: simon.kuenzer@neclab.eu
References: <20200428120747.21674-1-raducanu.costi@gmail.com>
 <20200428120747.21674-9-raducanu.costi@gmail.com>
From: Daniel Dinca <dincadaniel97@gmail.com>
Message-ID: <b55bfaea-e9a0-50be-345d-d8debbcd953c@gmail.com>
Date: Thu, 3 Dec 2020 11:45:18 +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: <20200428120747.21674-9-raducanu.costi@gmail.com>
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
Content-Language: en-US

Looks ok.

Reviewed-by: Daniel Dinca <dincadaniel97@gmail.com>

On 28.04.2020 15:07, Constantin Raducanu wrote:
> Registers `dup3` system call to syscall_shim library.
>
> Signed-off-by: Constantin Raducanu <raducanu.costi@gmail.com>
> ---
>   lib/vfscore/Makefile.uk   |  1 +
>   lib/vfscore/exportsyms.uk |  2 ++
>   lib/vfscore/main.c        | 21 +++++++++++----------
>   3 files changed, 14 insertions(+), 10 deletions(-)
>
> diff --git a/lib/vfscore/Makefile.uk b/lib/vfscore/Makefile.uk
> index a1570ed..0919de7 100644
> --- a/lib/vfscore/Makefile.uk
> +++ b/lib/vfscore/Makefile.uk
> @@ -42,3 +42,4 @@ UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += fchmod-2
>   UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += chdir-1
>   UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += fchdir-1
>   UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += dup-1
> +UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += dup3-3
> diff --git a/lib/vfscore/exportsyms.uk b/lib/vfscore/exportsyms.uk
> index e16fa90..ead0d9f 100644
> --- a/lib/vfscore/exportsyms.uk
> +++ b/lib/vfscore/exportsyms.uk
> @@ -48,6 +48,8 @@ uk_syscall_e_dup
>   uk_syscall_r_dup
>   dup2
>   dup3
> +uk_syscall_e_dup3
> +uk_syscall_r_dup3
>   sync
>   vfscore_mount_dump
>   umount
> diff --git a/lib/vfscore/main.c b/lib/vfscore/main.c
> index 67344f9..dc8f9e2 100644
> --- a/lib/vfscore/main.c
> +++ b/lib/vfscore/main.c
> @@ -1421,7 +1421,7 @@ UK_TRACEPOINT(trace_vfs_dup3_err, "%d", int);
>   /*
>    * Duplicate a file descriptor to a particular value.
>    */
> -int dup3(int oldfd, int newfd, int flags)
> +UK_SYSCALL_R_DEFINE(int, dup3, int, oldfd, int, newfd, int, flags)
>   {
>   	struct vfscore_file *fp, *fp_new;
>   	int error;
> @@ -1433,44 +1433,45 @@ int dup3(int oldfd, int newfd, int flags)
>   	 */
>   	if ((flags & ~O_CLOEXEC) != 0) {
>   		error = EINVAL;
> -		goto out_errno;
> +		goto out_error;
>   	}
>   
>   	if (oldfd == newfd) {
>   		error = EINVAL;
> -		goto out_errno;
> +		goto out_error;
>   	}
>   
>   	error = fget(oldfd, &fp);
>   	if (error)
> -		goto out_errno;
> +		goto out_error;
>   
>   	error = fget(newfd, &fp_new);
>   	if (error == 0) {
>   		/* if newfd is open, then close it */
>   		error = close(newfd);
>   		if (error)
> -			goto out_errno;
> +			goto out_error;
>   	}
>   
>   	error = vfscore_reserve_fd(newfd);
>   	if (error)
> -		goto out_errno;
> +		goto out_error;
>   
>   	error = vfscore_install_fd(newfd, fp);
>   	if (error) {
>   		fdrop(fp);
> -		goto out_errno;
> +		goto out_error;
>   	}
>   
>   	fdrop(fp);
>   	trace_vfs_dup3_ret(newfd);
>   	return newfd;
>   
> -	out_errno:
> +	out_error:
>   	trace_vfs_dup3_err(error);
> -	errno = error;
> -	return -1;
> +	if(error > 0)
> +		return -error;
> +	return error;
>   }
>   
>   int dup2(int oldfd, int newfd)
>


From minios-devel-bounces@lists.xenproject.org Thu Dec 03 09:45:37 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Thu, 03 Dec 2020 09:45:37 +0000
Received: from list by lists.xenproject.org with outflank-mailman.43268.77819 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1kklBB-0004Tx-EP; Thu, 03 Dec 2020 09:45:37 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 43268.77819; Thu, 03 Dec 2020 09:45: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 1kklBB-0004Tq-BG; Thu, 03 Dec 2020 09:45:37 +0000
Received: by outflank-mailman (input) for mailman id 43268;
 Thu, 03 Dec 2020 09:45:36 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=SiMt=FH=gmail.com=dincadaniel97@srs-us1.protection.inumbo.net>)
 id 1kklBA-0004Tl-OI
 for minios-devel@lists.xen.org; Thu, 03 Dec 2020 09:45:36 +0000
Received: from mail-ed1-x541.google.com (unknown [2a00:1450:4864:20::541])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id dd726220-72ef-47f1-aa17-21387a134043;
 Thu, 03 Dec 2020 09:45:36 +0000 (UTC)
Received: by mail-ed1-x541.google.com with SMTP id q16so1368734edv.10
 for <minios-devel@lists.xen.org>; Thu, 03 Dec 2020 01:45:36 -0800 (PST)
Received: from ?IPv6:2a02:2f0c:5105:a500:904f:a43e:16c8:882c?
 ([2a02:2f0c:5105:a500:904f:a43e:16c8:882c])
 by smtp.gmail.com with ESMTPSA id h23sm431299ejg.37.2020.12.03.01.45.34
 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128);
 Thu, 03 Dec 2020 01:45:34 -0800 (PST)
X-BeenThere: minios-devel@lists.xenproject.org
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
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: dd726220-72ef-47f1-aa17-21387a134043
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20161025;
        h=subject:to:cc:references:from:message-id:date:user-agent
         :mime-version:in-reply-to:content-transfer-encoding:content-language;
        bh=ovmnOS/uVBx6VtDx6HxZRumJAw9xjoU2ozTZc7RTNkA=;
        b=QUxeav5NXuijpfzMH4bOAF4RbxZ5Xr7ZXuOGOm8fJmxwmOFfyPl5ge3ADGPCCaAndc
         g31AoTXiqg6Mcr+DU2MUpzguoXRAGUh5OwSXE20zEBZE162kh5OBv+TsWEnh6AFZ6tqf
         lRTGYGlKHIxaU3RQbQr2sbxveBSXDv3dpMq89U425Pw/ugOxRfNkNB/40ccn5EbNzMwI
         koFtxY3MXwZ8xFdcIXIz3bo0tf6b2Doe79GGNC1CbkdeFZ7tRBj6ooDJ3PGdCaqoKgwk
         acLyrm5tpq620eL9/dFkfOr5Ve5yTYaDPXZQqXWKRwRKmkU0wSkCis79JC8QC/EGMGbl
         /cMA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20161025;
        h=x-gm-message-state:subject:to:cc:references:from:message-id:date
         :user-agent:mime-version:in-reply-to:content-transfer-encoding
         :content-language;
        bh=ovmnOS/uVBx6VtDx6HxZRumJAw9xjoU2ozTZc7RTNkA=;
        b=ZmTXiITJ1A8MtI5QnvLr2tj8d5RSD0SaBmuZcLl9A5m+QeoS4hryBvrpVyTQcDFlxs
         eHvqkuCSFfk28Mf3jTkIWpGRXuo9iI1zvVScL1u2gJ15sYI4z8jnxU4qg9Rzta19ayZ/
         +M8upVjviXATttnoJ+b6zs/XYvNxTw3KnZULX+NeXokKuciQn1ln6XYMYji8q3v2jQ/G
         dU0u9kxCHTYTiqJuMvxrLVDHhol422KvkVHLU3IcIFQwkeDeSiWhcm6WxDYu0kj8nBnm
         XXSfMgjRp5EJsHqoM9cuUASUMNXjXcAosRmbA+Xmzzfrvmpt21e65bi2aQh5CGnrTX5H
         2k+w==
X-Gm-Message-State: AOAM532pbcrOPVXBDMC+DjILaNmjl3EVsW1Si9GU93E0QZCifUKuxxFU
	dCjDBcKATt5hlrhEFm85ZgI=
X-Google-Smtp-Source: ABdhPJw180kr0gj8IxItyMV21TpTJy/7MZLjb3iM210zQNX70VAWUFCrZ4jhEmn8LxJm39cnD+Oung==
X-Received: by 2002:a50:cdc8:: with SMTP id h8mr2030605edj.37.1606988735167;
        Thu, 03 Dec 2020 01:45:35 -0800 (PST)
Subject: Re: [UNIKRAFT PATCH 10/10] lib/vfscore: Register `dup2` to
 syscall_shim
To: Constantin Raducanu <raducanu.costi@gmail.com>, minios-devel@lists.xen.org
Cc: simon.kuenzer@neclab.eu
References: <20200428120747.21674-1-raducanu.costi@gmail.com>
 <20200428120747.21674-10-raducanu.costi@gmail.com>
From: Daniel Dinca <dincadaniel97@gmail.com>
Message-ID: <3bb36159-6a29-278f-13be-edc006fa9751@gmail.com>
Date: Thu, 3 Dec 2020 11:45:33 +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: <20200428120747.21674-10-raducanu.costi@gmail.com>
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
Content-Language: en-US

Looks ok.

Reviewed-by: Daniel Dinca <dincadaniel97@gmail.com>

On 28.04.2020 15:07, Constantin Raducanu wrote:
> Registers `dup2` system call to syscall_shim library.
>
> Signed-off-by: Constantin Raducanu <raducanu.costi@gmail.com>
> ---
>   lib/vfscore/Makefile.uk   | 1 +
>   lib/vfscore/exportsyms.uk | 2 ++
>   lib/vfscore/main.c        | 2 +-
>   3 files changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/lib/vfscore/Makefile.uk b/lib/vfscore/Makefile.uk
> index 0919de7..5906a40 100644
> --- a/lib/vfscore/Makefile.uk
> +++ b/lib/vfscore/Makefile.uk
> @@ -43,3 +43,4 @@ UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += chdir-1
>   UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += fchdir-1
>   UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += dup-1
>   UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += dup3-3
> +UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += dup2-2
> diff --git a/lib/vfscore/exportsyms.uk b/lib/vfscore/exportsyms.uk
> index ead0d9f..037537c 100644
> --- a/lib/vfscore/exportsyms.uk
> +++ b/lib/vfscore/exportsyms.uk
> @@ -47,6 +47,8 @@ dup
>   uk_syscall_e_dup
>   uk_syscall_r_dup
>   dup2
> +uk_syscall_e_dup2
> +uk_syscall_r_dup2
>   dup3
>   uk_syscall_e_dup3
>   uk_syscall_r_dup3
> diff --git a/lib/vfscore/main.c b/lib/vfscore/main.c
> index dc8f9e2..7c61013 100644
> --- a/lib/vfscore/main.c
> +++ b/lib/vfscore/main.c
> @@ -1474,7 +1474,7 @@ UK_SYSCALL_R_DEFINE(int, dup3, int, oldfd, int, newfd, int, flags)
>   	return error;
>   }
>   
> -int dup2(int oldfd, int newfd)
> +UK_SYSCALL_R_DEFINE(int, dup2, int, oldfd, int, newfd)
>   {
>   	if (oldfd == newfd)
>   		return newfd;
>


From minios-devel-bounces@lists.xenproject.org Thu Dec 03 09:48:23 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Thu, 03 Dec 2020 09:48:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.43280.77836 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1kklDr-0004g8-07; Thu, 03 Dec 2020 09:48:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 43280.77836; Thu, 03 Dec 2020 09:48: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 1kklDq-0004g1-T8; Thu, 03 Dec 2020 09:48:22 +0000
Received: by outflank-mailman (input) for mailman id 43280;
 Thu, 03 Dec 2020 09:48: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=SiMt=FH=gmail.com=dincadaniel97@srs-us1.protection.inumbo.net>)
 id 1kklDp-0004fw-Me
 for minios-devel@lists.xen.org; Thu, 03 Dec 2020 09:48:21 +0000
Received: from mail-ej1-x644.google.com (unknown [2a00:1450:4864:20::644])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 716948dd-3430-4c8b-93c8-4b9777a8725f;
 Thu, 03 Dec 2020 09:48:21 +0000 (UTC)
Received: by mail-ej1-x644.google.com with SMTP id bo9so2436873ejb.13
 for <minios-devel@lists.xen.org>; Thu, 03 Dec 2020 01:48:20 -0800 (PST)
Received: from ?IPv6:2a02:2f0c:5105:a500:904f:a43e:16c8:882c?
 ([2a02:2f0c:5105:a500:904f:a43e:16c8:882c])
 by smtp.gmail.com with ESMTPSA id j22sm388119ejy.106.2020.12.03.01.48.19
 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128);
 Thu, 03 Dec 2020 01:48:19 -0800 (PST)
X-BeenThere: minios-devel@lists.xenproject.org
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
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: 716948dd-3430-4c8b-93c8-4b9777a8725f
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20161025;
        h=subject:to:cc:references:from:message-id:date:user-agent
         :mime-version:in-reply-to:content-transfer-encoding:content-language;
        bh=ovmnOS/uVBx6VtDx6HxZRumJAw9xjoU2ozTZc7RTNkA=;
        b=aPcFPHdazcABqf1EHkXQNfrXJJIqOKqOTgy1KIrlX1OW3mKlzmb99MsX/i5HR7cAUM
         4DHGe8+Kq7vkKzdtDAIeIdUlPjIwpjom90Qr6bL71WMe3Xpz8UWiAzx78SVdaq2UBwM0
         NFFBMtbRc+kvNRpAb2nw5fE0zYUFM1odcPFm2yDtxhAg4JKwo+3pEuyxhlsWau/PodMn
         V8YkAARXmzzewWhxmjk0YIuRX4lXSEmaIICIB2cSWqRzaMFg2um8QK/t5Pb/J+ojNuLb
         KeeaThjFoKxKPGL0rJ0fies5n0NCIhe/q0LzPntgyfkhy7Hl1qmvXlx/Fez12zO9AIMi
         ofDQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20161025;
        h=x-gm-message-state:subject:to:cc:references:from:message-id:date
         :user-agent:mime-version:in-reply-to:content-transfer-encoding
         :content-language;
        bh=ovmnOS/uVBx6VtDx6HxZRumJAw9xjoU2ozTZc7RTNkA=;
        b=T0tZ4sy9Jj45JHDBzDOTsOm1D5hV4Od/Y0xLVwOs9ChRhcAKXX8XtnAM16H8H1MBLc
         8CJct3eY2TJgiuNqwBW6N7eUimHFCBgkzTMnlYVaP4A19t63+3RgIHX/P6Btk/yEflvc
         zfBMZIIMOYXnq5UKrZj+UH6eEgqJ8deQ5T/K/nt3drWR8MaQr4euPnaXWD01razKt+7R
         R5U5Le6MMoaNzLMqH58bYDyD65KvTYoQRQYDXEYgSMFcK602lSaN0J5iemOtMN1cuDKA
         +VKuRi3IsCBrUXq4zFlnFpM7lrAjDZgeyvIRImXoHyoT2C0AYbg64qBgao4F/VwlzEQd
         iYdA==
X-Gm-Message-State: AOAM533FYyjY2uzwTeGH1mxgKlQ4vjDHQ6Ud374naZ5VReQ1MEc/puZb
	ha7UpoU/IyajhDbkPfdUKxw=
X-Google-Smtp-Source: ABdhPJysrSoE/2HSnvP0BRrHB6HEQc/YuAv/nUbiV0Jx3wONMjIvVVdilqcqe7xWnmbdbrqthQl/dA==
X-Received: by 2002:a17:906:f905:: with SMTP id lc5mr1731792ejb.177.1606988900185;
        Thu, 03 Dec 2020 01:48:20 -0800 (PST)
Subject: Re: [UNIKRAFT PATCH 10/10] lib/vfscore: Register `dup2` to
 syscall_shim
To: Constantin Raducanu <raducanu.costi@gmail.com>, minios-devel@lists.xen.org
Cc: simon.kuenzer@neclab.eu
References: <20200428120747.21674-1-raducanu.costi@gmail.com>
 <20200428120747.21674-10-raducanu.costi@gmail.com>
From: Daniel Dinca <dincadaniel97@gmail.com>
Message-ID: <efa5af0b-e36e-8896-2e4d-d3ed08023480@gmail.com>
Date: Thu, 3 Dec 2020 11:48:18 +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: <20200428120747.21674-10-raducanu.costi@gmail.com>
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
Content-Language: en-US

Looks ok.

Reviewed-by: Daniel Dinca <dincadaniel97@gmail.com>

On 28.04.2020 15:07, Constantin Raducanu wrote:
> Registers `dup2` system call to syscall_shim library.
>
> Signed-off-by: Constantin Raducanu <raducanu.costi@gmail.com>
> ---
>   lib/vfscore/Makefile.uk   | 1 +
>   lib/vfscore/exportsyms.uk | 2 ++
>   lib/vfscore/main.c        | 2 +-
>   3 files changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/lib/vfscore/Makefile.uk b/lib/vfscore/Makefile.uk
> index 0919de7..5906a40 100644
> --- a/lib/vfscore/Makefile.uk
> +++ b/lib/vfscore/Makefile.uk
> @@ -43,3 +43,4 @@ UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += chdir-1
>   UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += fchdir-1
>   UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += dup-1
>   UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += dup3-3
> +UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += dup2-2
> diff --git a/lib/vfscore/exportsyms.uk b/lib/vfscore/exportsyms.uk
> index ead0d9f..037537c 100644
> --- a/lib/vfscore/exportsyms.uk
> +++ b/lib/vfscore/exportsyms.uk
> @@ -47,6 +47,8 @@ dup
>   uk_syscall_e_dup
>   uk_syscall_r_dup
>   dup2
> +uk_syscall_e_dup2
> +uk_syscall_r_dup2
>   dup3
>   uk_syscall_e_dup3
>   uk_syscall_r_dup3
> diff --git a/lib/vfscore/main.c b/lib/vfscore/main.c
> index dc8f9e2..7c61013 100644
> --- a/lib/vfscore/main.c
> +++ b/lib/vfscore/main.c
> @@ -1474,7 +1474,7 @@ UK_SYSCALL_R_DEFINE(int, dup3, int, oldfd, int, newfd, int, flags)
>   	return error;
>   }
>   
> -int dup2(int oldfd, int newfd)
> +UK_SYSCALL_R_DEFINE(int, dup2, int, oldfd, int, newfd)
>   {
>   	if (oldfd == newfd)
>   		return newfd;
>


From minios-devel-bounces@lists.xenproject.org Thu Dec 03 09:58:46 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Thu, 03 Dec 2020 09:58:46 +0000
Received: from list by lists.xenproject.org with outflank-mailman.43291.77851 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1kklNr-0005k9-0t; Thu, 03 Dec 2020 09:58:43 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 43291.77851; Thu, 03 Dec 2020 09:58: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 1kklNq-0005k2-UD; Thu, 03 Dec 2020 09:58:42 +0000
Received: by outflank-mailman (input) for mailman id 43291;
 Thu, 03 Dec 2020 09:58: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=SiMt=FH=gmail.com=dincadaniel97@srs-us1.protection.inumbo.net>)
 id 1kklNo-0005jx-U4
 for minios-devel@lists.xen.org; Thu, 03 Dec 2020 09:58:40 +0000
Received: from mail-ed1-x544.google.com (unknown [2a00:1450:4864:20::544])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id cb741ec0-995b-4d66-8ba1-e09ad0ab25b1;
 Thu, 03 Dec 2020 09:58:39 +0000 (UTC)
Received: by mail-ed1-x544.google.com with SMTP id b73so1398459edf.13
 for <minios-devel@lists.xen.org>; Thu, 03 Dec 2020 01:58:39 -0800 (PST)
Received: from ?IPv6:2a02:2f0c:5105:a500:904f:a43e:16c8:882c?
 ([2a02:2f0c:5105:a500:904f:a43e:16c8:882c])
 by smtp.gmail.com with ESMTPSA id m7sm429270ejo.125.2020.12.03.01.58.37
 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128);
 Thu, 03 Dec 2020 01:58:38 -0800 (PST)
X-BeenThere: minios-devel@lists.xenproject.org
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
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: cb741ec0-995b-4d66-8ba1-e09ad0ab25b1
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20161025;
        h=subject:to:cc:references:from:message-id:date:user-agent
         :mime-version:in-reply-to:content-transfer-encoding:content-language;
        bh=aMfItqsQdt3koTt0Js/ODE6mafbs6GZXa10fr896j+g=;
        b=Yy+ia7ofWY94+tzIi5Sk/Isg36MmhNrwpwHeNMJU77BFqMh+Pt+d4u+hpW14xdHhUJ
         lRgxOIkXtuET668bCglEp6S3vkgQdwAr1Z0uRu306rGHpaKfIx/fUj/qKonPpe0LtJHA
         QJHhkOg3LJplwVRJwoPgA331Y1sBn6Zdzm1vPUnhwvkqARIeMR8EYsiY1r4Nfi/H0fxY
         RKE5jnFiOydVyCD0QojtjbDHRv0eFB3kpaNtDLPDIcTHd0OYgO4yFIqPWjjEgGPQblUw
         p8Qw/OdYJJtdb6XruBHw8HGMjZN7gcotDHyviun9LWulmTs/ZflLeW5FX/bb7tVlsD+E
         IoWg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20161025;
        h=x-gm-message-state:subject:to:cc:references:from:message-id:date
         :user-agent:mime-version:in-reply-to:content-transfer-encoding
         :content-language;
        bh=aMfItqsQdt3koTt0Js/ODE6mafbs6GZXa10fr896j+g=;
        b=F8Q69a+Tpl5bmS5U5N0jeKMdlLwMPLO6fHu5979S43haZ7ILUqLJ+4x2lIR8hG/AuJ
         HWxjQkvpdeCM79YdmFocjHEzyhO4ec5729+0+pLxZKet6zISlDzCiI9Tzywzy3S9RGHo
         WcsReNZnTw2+MEa6hPlETLPHdOIyw0nrlItBg5w+M0THkR9uAcLKp7Fpi2IKmaqxkoSn
         GBBzF955rAbDYBj6N/1hvCij7UzKNzLeXBpFkFuYG6XSvsRvCQZscPYSRh78MCW14pXJ
         WVV9w+g7R8GHV2p2klM+26lzlDnPkTaGQnmKRrHOqplEh/vWFYChC0HroMq+uI7dXZwG
         5bzA==
X-Gm-Message-State: AOAM530HntwLheWv56v0FYWIq4wekStBXq95DukHbaM+n69jMfWInMvR
	CUAxPrFcw4rMjVY8twvB+kA=
X-Google-Smtp-Source: ABdhPJxSnsQ/1eAqOFerGXR6x+HKFt7rUfE8igga08SSQWHcPLUX8be7ZmdvLssiNJaB8ttA4LLXDA==
X-Received: by 2002:a50:a40a:: with SMTP id u10mr2027054edb.16.1606989519143;
        Thu, 03 Dec 2020 01:58:39 -0800 (PST)
Subject: Re: [UNIKRAFT PATCH 08/10] lib/vfscore: Register `dup` to
 syscall_shim
To: Constantin Raducanu <raducanu.costi@gmail.com>, minios-devel@lists.xen.org
Cc: simon.kuenzer@neclab.eu
References: <20200428120747.21674-1-raducanu.costi@gmail.com>
 <20200428120747.21674-8-raducanu.costi@gmail.com>
From: Daniel Dinca <dincadaniel97@gmail.com>
Message-ID: <f0c3dc46-ad18-554d-6374-eec12c8ee344@gmail.com>
Date: Thu, 3 Dec 2020 11:58:37 +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: <20200428120747.21674-8-raducanu.costi@gmail.com>
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
Content-Language: en-US

UK_SYSCALL_R_DEFINE is missing.

Reviewed-by: Daniel Dinca <dincadaniel97@gmail.com>

On 28.04.2020 15:07, Constantin Raducanu wrote:
> Registers `dup` system call to syscall_shim library.
>
> Signed-off-by: Constantin Raducanu <raducanu.costi@gmail.com>
> ---
>   lib/vfscore/Makefile.uk   |  1 +
>   lib/vfscore/exportsyms.uk |  2 ++
>   lib/vfscore/main.c        | 10 ++++++----
>   3 files changed, 9 insertions(+), 4 deletions(-)
>
> diff --git a/lib/vfscore/Makefile.uk b/lib/vfscore/Makefile.uk
> index 68d108c..a1570ed 100644
> --- a/lib/vfscore/Makefile.uk
> +++ b/lib/vfscore/Makefile.uk
> @@ -41,3 +41,4 @@ UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += chmod-2
>   UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += fchmod-2
>   UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += chdir-1
>   UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += fchdir-1
> +UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += dup-1
> diff --git a/lib/vfscore/exportsyms.uk b/lib/vfscore/exportsyms.uk
> index 583a75e..e16fa90 100644
> --- a/lib/vfscore/exportsyms.uk
> +++ b/lib/vfscore/exportsyms.uk
> @@ -44,6 +44,8 @@ uk_syscall_e_fchmod
>   uk_syscall_r_fchmod
>   fchown
>   dup
> +uk_syscall_e_dup
> +uk_syscall_r_dup
>   dup2
>   dup3
>   sync
> diff --git a/lib/vfscore/main.c b/lib/vfscore/main.c
> index c6e446a..67344f9 100644
> --- a/lib/vfscore/main.c
> +++ b/lib/vfscore/main.c
> @@ -1395,7 +1395,7 @@ int dup(int oldfd)
>   	trace_vfs_dup(oldfd);
>   	error = fget(oldfd, &fp);
>   	if (error)
> -		goto out_errno;
> +		goto out_error;
>   
>   	error = fdalloc(fp, &newfd);
>   	if (error)
> @@ -1407,10 +1407,12 @@ int dup(int oldfd)
>   
>   	out_fdrop:
>   	fdrop(fp);
> -	out_errno:
> +
> +	out_error:
>   	trace_vfs_dup_err(error);
> -	errno = error;
> -	return -1;
> +	if(error > 0)
> +		return -error;
> +	return error;
>   }
>   
>   UK_TRACEPOINT(trace_vfs_dup3, "%d %d 0x%x", int, int, int);
>


From minios-devel-bounces@lists.xenproject.org Thu Dec 03 10:05:17 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Thu, 03 Dec 2020 10:05:17 +0000
Received: from list by lists.xenproject.org with outflank-mailman.43294.77856 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1kklUC-0006hd-Gp; Thu, 03 Dec 2020 10:05:16 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 43294.77856; Thu, 03 Dec 2020 10:05: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 1kklUC-0006hW-Dr; Thu, 03 Dec 2020 10:05:16 +0000
Received: by outflank-mailman (input) for mailman id 43294;
 Thu, 03 Dec 2020 10:05: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=SiMt=FH=gmail.com=dincadaniel97@srs-us1.protection.inumbo.net>)
 id 1kklUA-0006hR-Lq
 for minios-devel@lists.xen.org; Thu, 03 Dec 2020 10:05:14 +0000
Received: from mail-ed1-x542.google.com (unknown [2a00:1450:4864:20::542])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 29c0fa41-6af1-4892-bfaf-84ecae6fb4aa;
 Thu, 03 Dec 2020 10:05:13 +0000 (UTC)
Received: by mail-ed1-x542.google.com with SMTP id cm17so1464980edb.4
 for <minios-devel@lists.xen.org>; Thu, 03 Dec 2020 02:05:13 -0800 (PST)
Received: from ?IPv6:2a02:2f0c:5105:a500:904f:a43e:16c8:882c?
 ([2a02:2f0c:5105:a500:904f:a43e:16c8:882c])
 by smtp.gmail.com with ESMTPSA id z9sm470522eju.123.2020.12.03.02.05.11
 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128);
 Thu, 03 Dec 2020 02:05:12 -0800 (PST)
X-BeenThere: minios-devel@lists.xenproject.org
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
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: 29c0fa41-6af1-4892-bfaf-84ecae6fb4aa
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20161025;
        h=subject:to:cc:references:from:message-id:date:user-agent
         :mime-version:in-reply-to:content-transfer-encoding:content-language;
        bh=UuvcecRRkEcFY9togVx+1LtHD49vkkI18ab38nCuaeg=;
        b=aeEejczTHU7sR29dgWjFutmdtw/UuXFjRLm1k3LZC32d4pFW15l6qFVxDkug/woV73
         4x3O+IgBtRgRIcS9u3aXcJMyHj0u+uldUy6zdyZUnSLCqqtgmcuzNQVDglKD0BPFNbil
         tyVYFqlCoH/TSHa9GVCUGF1gOYOHa9RlRxdJWXuPKks2M5RhturzZgSLZNwDA57qdzML
         my4+MkaTRrrQGKadCOLRKWf0OY1F4ep+YcGn7xuTIcOTeyxNQ02lV9neVyRZEm9YqBZ5
         w1mdhiWbZiMbArtNL/LKG5G9BUJDvAn1sNuaU3u5bRMQ0Xbkuz2jvhpa4Ss6OYKNR2ro
         D5qw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20161025;
        h=x-gm-message-state:subject:to:cc:references:from:message-id:date
         :user-agent:mime-version:in-reply-to:content-transfer-encoding
         :content-language;
        bh=UuvcecRRkEcFY9togVx+1LtHD49vkkI18ab38nCuaeg=;
        b=CVdBQ4ymzN4y/Uie3j9q8yAPL//CMVkX5RnxjrmxwpFNsv5fnrGaIM+OFywfyoHGvY
         KToTR12ndUPH3ntQQN0jPXA8r7ywSMENyFz48lGO/WQQ4YYYqu1nlTFcvVUyKgJlOnQ+
         ICIrrSrciFMFsCLWe/PHsx3EpIny0Lx8W91nATJ12ksbzur2kKq2IHUCv/okrLNP/oRi
         Vz7uxPkACZ9TlKZPUSA36ID/WJcdRvAn0YIOz+G2ggGB2hqhCCkEEgkIZ1qWgfPQ31HE
         z6kBWWF9D8hd1sW14XImfE3hSn6JWQvp+TbtRO71gm2UQNYY9z514Hle36/vgerePw3v
         i0wg==
X-Gm-Message-State: AOAM532UtvTUBAzu/sQ82txODGQaNejPucnp7ed400hEsaGR0mKqSNAa
	SUNgOKbHRDmjxjovFciBq7s=
X-Google-Smtp-Source: ABdhPJyRUOQDkvSUas5PmnEKBrraZ+2VN0FmWo5Uc8DCX5HrcPSY0CZnwNRuaStNXO1b2Aw/K517RA==
X-Received: by 2002:aa7:ce94:: with SMTP id y20mr2048835edv.361.1606989912888;
        Thu, 03 Dec 2020 02:05:12 -0800 (PST)
Subject: Re: [UNIKRAFT PATCH 01/11] lib/vfscore: Add the macro
 UK_SYSCALL_R_DEFINE for dup
To: Constantin Raducanu <raducanu.costi@gmail.com>, minios-devel@lists.xen.org
Cc: simon.kuenzer@neclab.eu
References: <20200502181835.6724-1-raducanu.costi@gmail.com>
From: Daniel Dinca <dincadaniel97@gmail.com>
Message-ID: <99c9657b-0d04-e7a2-5739-3719604dc83a@gmail.com>
Date: Thu, 3 Dec 2020 12:05:11 +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: <20200502181835.6724-1-raducanu.costi@gmail.com>
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
Content-Language: en-US

This should be in the same patch with the previous changes to dup.

Reviewed-by: Daniel Dinca <dincadaniel97@gmail.com>

On 02.05.2020 21:18, Constantin Raducanu wrote:
> Adds the macro UK_SYSCALL_R_DEFINE for `dup` in order to
> be registered to syscall_shim library.
>
> Signed-off-by: Constantin Raducanu <raducanu.costi@gmail.com>
> ---
>   lib/vfscore/main.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/lib/vfscore/main.c b/lib/vfscore/main.c
> index 7c61013..5a287ed 100644
> --- a/lib/vfscore/main.c
> +++ b/lib/vfscore/main.c
> @@ -1386,7 +1386,7 @@ UK_TRACEPOINT(trace_vfs_dup_err, "%d", int);
>   /*
>    * Duplicate a file descriptor
>    */
> -int dup(int oldfd)
> +UK_SYSCALL_R_DEFINE(int, dup, int, oldfd)
>   {
>   	struct vfscore_file *fp;
>   	int newfd;
>


From minios-devel-bounces@lists.xenproject.org Thu Dec 03 10:05:31 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Thu, 03 Dec 2020 10:05:31 +0000
Received: from list by lists.xenproject.org with outflank-mailman.43296.77859 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1kklUR-0006iw-Ir; Thu, 03 Dec 2020 10:05:31 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 43296.77859; Thu, 03 Dec 2020 10:05: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 1kklUR-0006ip-G0; Thu, 03 Dec 2020 10:05:31 +0000
Received: by outflank-mailman (input) for mailman id 43296;
 Thu, 03 Dec 2020 10:05: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=SiMt=FH=gmail.com=dincadaniel97@srs-us1.protection.inumbo.net>)
 id 1kklUQ-0006if-2s
 for minios-devel@lists.xen.org; Thu, 03 Dec 2020 10:05:30 +0000
Received: from mail-ed1-x542.google.com (unknown [2a00:1450:4864:20::542])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 83846896-12e4-44bc-9bc6-8105954da0cd;
 Thu, 03 Dec 2020 10:05:29 +0000 (UTC)
Received: by mail-ed1-x542.google.com with SMTP id b73so1419624edf.13
 for <minios-devel@lists.xen.org>; Thu, 03 Dec 2020 02:05:29 -0800 (PST)
Received: from ?IPv6:2a02:2f0c:5105:a500:904f:a43e:16c8:882c?
 ([2a02:2f0c:5105:a500:904f:a43e:16c8:882c])
 by smtp.gmail.com with ESMTPSA id c25sm482839ejx.39.2020.12.03.02.05.27
 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128);
 Thu, 03 Dec 2020 02:05:28 -0800 (PST)
X-BeenThere: minios-devel@lists.xenproject.org
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
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: 83846896-12e4-44bc-9bc6-8105954da0cd
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20161025;
        h=subject:to:cc:references:from:message-id:date:user-agent
         :mime-version:in-reply-to:content-transfer-encoding:content-language;
        bh=YAKOGnOjalBrVDtpKWJuixS6Q7rlqoHi8jFNlkkXcsc=;
        b=Eo5Lwe57m++RtiW14EliYG+pE8MC+jY3xztYm3vDg+RbWc7m8HtxLdNLCuJipRV87U
         VJCQXFdgw89ESiuPKmaWoT+vU7MKzK0lpJQzitj2Lis1pA3gB4d+8VqXlFD2MF9cgJoB
         7G16CZHU0zfzracxRbaodaJFyR4uh3eqmI+8Q8lILVHkLxefFKC0CSZr1DGh9a/D5+uT
         3kOEAG4FgXGOZcQ8ms2mVhRgJT/cvcpChUCJTSHICf8TLTSDV5n3/rIgSd/3tqr/fH8h
         qGsXaLexZNAbMNXRk28kbUEYv+lh9H6U366Yri4PuQMw9lYmhduDZR8b8XWcE6hQnEyt
         KW4A==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20161025;
        h=x-gm-message-state:subject:to:cc:references:from:message-id:date
         :user-agent:mime-version:in-reply-to:content-transfer-encoding
         :content-language;
        bh=YAKOGnOjalBrVDtpKWJuixS6Q7rlqoHi8jFNlkkXcsc=;
        b=PcGeJJ3fXCct4BUpMKhROBPti7YwsqS77kjIEdQsIYUhna55dXXz1ZlaNq2VUIBhps
         NQr/r7YSLQOe0/V1TOaJ0yIoZlej/hmZ7Ib2WrlS1Cw+UOuoN4Nc+ceD7YyAO6eATXz/
         P1KqXdNs9UbpKTjAd30WP0y4XrLlPI5krpTt0zm7UOFYA0nraAqC0Yu+H6NTVieeIf6j
         Ic0NRbqAi/zm0xxCgfx5kgxeSTj7BKXQjQ3FyIqKtnGnR/435OzlhCxXSNe6IqeXWnyB
         UbQePy3PfDNFfh129oByKsmupCCLBtyYJxa3yGtyYzWBNw2Aju15P8XgGrQiAUCl+Ytr
         WZ+A==
X-Gm-Message-State: AOAM532TKYOlz/9ktez7wEFwQrVDEqz3JWM6aa18tIYlgdSU2yeUlRwu
	/proqNbuLwjmRjHxZtoDLFI=
X-Google-Smtp-Source: ABdhPJzfJM39lj+oRY25QkQzh/QoRnKjVuy3KgXFE0dsNih/l9LWQouclYd1+M0VZ97Vlb9Mz9TjFQ==
X-Received: by 2002:a05:6402:1c96:: with SMTP id cy22mr2060658edb.339.1606989928528;
        Thu, 03 Dec 2020 02:05:28 -0800 (PST)
Subject: Re: [UNIKRAFT PATCH 02/11] lib/vfscore: Register `pwritev` to
 syscall_shim
To: Constantin Raducanu <raducanu.costi@gmail.com>, minios-devel@lists.xen.org
Cc: simon.kuenzer@neclab.eu
References: <20200502181835.6724-1-raducanu.costi@gmail.com>
 <20200502181835.6724-2-raducanu.costi@gmail.com>
From: Daniel Dinca <dincadaniel97@gmail.com>
Message-ID: <ba5e10bb-a7d4-17f4-d603-d2615594eed6@gmail.com>
Date: Thu, 3 Dec 2020 12:05:26 +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: <20200502181835.6724-2-raducanu.costi@gmail.com>
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
Content-Language: en-US

Looks good.

Reviewed-by: Daniel Dinca <dincadaniel97@gmail.com>

On 02.05.2020 21:18, Constantin Raducanu wrote:
> Registers `pwritev` system call to syscall_shim library.
>
> Signed-off-by: Constantin Raducanu <raducanu.costi@gmail.com>
> ---
>   lib/vfscore/Makefile.uk   |  1 +
>   lib/vfscore/exportsyms.uk |  2 ++
>   lib/vfscore/main.c        | 12 ++++++------
>   3 files changed, 9 insertions(+), 6 deletions(-)
>
> diff --git a/lib/vfscore/Makefile.uk b/lib/vfscore/Makefile.uk
> index 5906a40..aea4470 100644
> --- a/lib/vfscore/Makefile.uk
> +++ b/lib/vfscore/Makefile.uk
> @@ -44,3 +44,4 @@ UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += fchdir-1
>   UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += dup-1
>   UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += dup3-3
>   UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += dup2-2
> +UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += pwritev-4
> \ No newline at end of file
> diff --git a/lib/vfscore/exportsyms.uk b/lib/vfscore/exportsyms.uk
> index 037537c..b54a6a1 100644
> --- a/lib/vfscore/exportsyms.uk
> +++ b/lib/vfscore/exportsyms.uk
> @@ -79,6 +79,8 @@ closedir
>   pread
>   pwrite
>   pwritev
> +uk_syscall_e_pwritev
> +uk_syscall_r_pwritev
>   readv
>   uk_syscall_e_readv
>   uk_syscall_r_readv
> diff --git a/lib/vfscore/main.c b/lib/vfscore/main.c
> index 5a287ed..3edcd49 100644
> --- a/lib/vfscore/main.c
> +++ b/lib/vfscore/main.c
> @@ -418,7 +418,8 @@ UK_TRACEPOINT(trace_vfs_pwritev, "%d %p 0x%x 0x%x", int, const struct iovec*,
>   UK_TRACEPOINT(trace_vfs_pwritev_ret, "0x%x", ssize_t);
>   UK_TRACEPOINT(trace_vfs_pwritev_err, "%d", int);
>   
> -ssize_t pwritev(int fd, const struct iovec *iov, int iovcnt, off_t offset)
> +UK_SYSCALL_R_DEFINE(ssize_t, pwritev, int, fd, const struct iovec*, iov,
> +			int, iovcnt, off_t, offset)
>   {
>   	struct vfscore_file *fp;
>   	size_t bytes;
> @@ -427,20 +428,19 @@ ssize_t pwritev(int fd, const struct iovec *iov, int iovcnt, off_t offset)
>   	trace_vfs_pwritev(fd, iov, iovcnt, offset);
>   	error = fget(fd, &fp);
>   	if (error)
> -		goto out_errno;
> +		goto out_error;
>   
>   	error = sys_write(fp, iov, iovcnt, offset, &bytes);
>   	fdrop(fp);
>   
>   	if (has_error(error, bytes))
> -		goto out_errno;
> +		goto out_error;
>   	trace_vfs_pwritev_ret(bytes);
>   	return bytes;
>   
> -	out_errno:
> +	out_error:
>   	trace_vfs_pwritev_err(error);
> -	errno = error;
> -	return -1;
> +	return -error;
>   }
>   LFS64(pwritev);
>   
>


From minios-devel-bounces@lists.xenproject.org Thu Dec 03 10:05:53 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Thu, 03 Dec 2020 10:05:53 +0000
Received: from list by lists.xenproject.org with outflank-mailman.43298.77863 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1kklUn-0006kp-LG; Thu, 03 Dec 2020 10:05:53 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 43298.77863; Thu, 03 Dec 2020 10:05: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 1kklUn-0006ki-IO; Thu, 03 Dec 2020 10:05:53 +0000
Received: by outflank-mailman (input) for mailman id 43298;
 Thu, 03 Dec 2020 10:05:51 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=SiMt=FH=gmail.com=dincadaniel97@srs-us1.protection.inumbo.net>)
 id 1kklUl-0006kd-P2
 for minios-devel@lists.xen.org; Thu, 03 Dec 2020 10:05:51 +0000
Received: from mail-ej1-x644.google.com (unknown [2a00:1450:4864:20::644])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 8d80f78c-9e2c-4680-a786-867b031a38d3;
 Thu, 03 Dec 2020 10:05:50 +0000 (UTC)
Received: by mail-ej1-x644.google.com with SMTP id lt17so2606401ejb.3
 for <minios-devel@lists.xen.org>; Thu, 03 Dec 2020 02:05:50 -0800 (PST)
Received: from ?IPv6:2a02:2f0c:5105:a500:904f:a43e:16c8:882c?
 ([2a02:2f0c:5105:a500:904f:a43e:16c8:882c])
 by smtp.gmail.com with ESMTPSA id v18sm813861edx.30.2020.12.03.02.05.48
 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128);
 Thu, 03 Dec 2020 02:05:49 -0800 (PST)
X-BeenThere: minios-devel@lists.xenproject.org
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
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: 8d80f78c-9e2c-4680-a786-867b031a38d3
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20161025;
        h=subject:to:cc:references:from:message-id:date:user-agent
         :mime-version:in-reply-to:content-transfer-encoding:content-language;
        bh=CeWsSnyuVXUs3KCKM9tGdNjWdGWG4h6J4OzQ/tr5aVA=;
        b=uNZYvfNgA7gPVA03UCs758B/ABfDEfVvzuiyCDO1C8qfxStLSvb7f2k90jS5MPj+K+
         71q1wprp04uLMJiqLvqKkTUSXxFj1EuF0OJZbSYMizQgYCkrZ3sn52Q/ba7gGuD44Kaf
         As65byjCeSLyVxMZ9IEubPre+QHLB0ukpLCmMriQyeScyltSsdb85BdX9r+sDPX+lV9D
         0XqueY7KNk4xtvGOdKhZstEfb7+mFeUZy0FnEb9Qio3JMXWtSGoUbC27QE/KSpbHPtSq
         Q1Izz67As/TZdCrkYXrWQLOOw7+qCkn/Gf3BP8ouy8d5KgxrJaCigxljM4avV7b7mG/h
         BY6g==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20161025;
        h=x-gm-message-state:subject:to:cc:references:from:message-id:date
         :user-agent:mime-version:in-reply-to:content-transfer-encoding
         :content-language;
        bh=CeWsSnyuVXUs3KCKM9tGdNjWdGWG4h6J4OzQ/tr5aVA=;
        b=q8/X8bOXuXLn0OdQLyxqRO+IemCSxirNT7Cu8Jblr+HzlCWOj5O3Xoqp+ju7S3Q1iS
         nWEhcthmt9SEohWFTtLMPCOUHFo1XON77ybWgT6dxtV5XIsF5WAOkRPFg0826jt8vJz5
         20+ULFkz2v00jD4dNZ08UsGmK0t1kcnqB3Y+OOFBdoY+dKqoFf3uLZuJl0iBX3Nwi+fR
         3AEavHpDQ8A7hfDrdaRTC6fGQLxhX09eCWVwjOp/tRGBkHJaSKYgt/HxMfl2WoVQ+UZ3
         irmeQjHrSzvpmaPZhulaZQbKx8xw5/YaD7EJwAtVHaWXYlUOJ/vVI0aMWjeQT4KLmbWs
         VTyg==
X-Gm-Message-State: AOAM533P8fD1T+lhytAuMB6FNwXAlQt0onc0BFOyf0h30z5EPhRWCu6H
	uzKYxLfdHUDB2tYTOVZ5pBVPT+j+Pkd7ikh1
X-Google-Smtp-Source: ABdhPJxEjrB3eHdbC79JLArhgvJLKP/kg1bi4HNJTAr4FI37xGuAXUl899PL8jyBUoOGUJF55Z76ig==
X-Received: by 2002:a17:906:2a09:: with SMTP id j9mr1831931eje.355.1606989950165;
        Thu, 03 Dec 2020 02:05:50 -0800 (PST)
Subject: Re: [UNIKRAFT PATCH 03/11] lib/vfscore: Register `utimes` to
 syscall_shim
To: Constantin Raducanu <raducanu.costi@gmail.com>, minios-devel@lists.xen.org
Cc: simon.kuenzer@neclab.eu
References: <20200502181835.6724-1-raducanu.costi@gmail.com>
 <20200502181835.6724-3-raducanu.costi@gmail.com>
From: Daniel Dinca <dincadaniel97@gmail.com>
Message-ID: <cb2736a1-beed-9010-619b-0ac9e01f3cae@gmail.com>
Date: Thu, 3 Dec 2020 12:05:48 +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: <20200502181835.6724-3-raducanu.costi@gmail.com>
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
Content-Language: en-US

Looks good.

Reviewed-by: Daniel Dinca <dincadaniel97@gmail.com>

On 02.05.2020 21:18, Constantin Raducanu wrote:
> Registers `utimes` system call to syscall_shim library.
>
> Signed-off-by: Constantin Raducanu <raducanu.costi@gmail.com>
> ---
>   lib/vfscore/Makefile.uk   |  3 ++-
>   lib/vfscore/exportsyms.uk |  2 ++
>   lib/vfscore/main.c        | 13 ++++++++-----
>   3 files changed, 12 insertions(+), 6 deletions(-)
>
> diff --git a/lib/vfscore/Makefile.uk b/lib/vfscore/Makefile.uk
> index aea4470..c2064d9 100644
> --- a/lib/vfscore/Makefile.uk
> +++ b/lib/vfscore/Makefile.uk
> @@ -44,4 +44,5 @@ UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += fchdir-1
>   UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += dup-1
>   UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += dup3-3
>   UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += dup2-2
> -UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += pwritev-4
> \ No newline at end of file
> +UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += pwritev-4
> +UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += utimes-2
> \ No newline at end of file
> diff --git a/lib/vfscore/exportsyms.uk b/lib/vfscore/exportsyms.uk
> index b54a6a1..44ff969 100644
> --- a/lib/vfscore/exportsyms.uk
> +++ b/lib/vfscore/exportsyms.uk
> @@ -161,6 +161,8 @@ futimesat
>   utimensat
>   futimens
>   utimes
> +uk_syscall_e_utimes
> +uk_syscall_r_utimes
>   lutimes
>   posix_fadvise
>   scandir
> diff --git a/lib/vfscore/main.c b/lib/vfscore/main.c
> index 3edcd49..51417b9 100644
> --- a/lib/vfscore/main.c
> +++ b/lib/vfscore/main.c
> @@ -1931,21 +1931,24 @@ static int do_utimes(const char *pathname, const struct timeval times[2], int fl
>   
>   	error = task_conv(t, pathname, 0, path);
>   	if (error) {
> -		trace_vfs_utimes_err(error);
> -		return libc_error(error);
> +		goto out_error;
>   	}
>   
>   	error = sys_utimes(path, times, flags);
>   	if (error) {
> -		trace_vfs_utimes_err(error);
> -		return libc_error(error);
> +		goto out_error;
>   	}
>   
>   	trace_vfs_utimes_ret();
>   	return 0;
> +
> +	out_error:
> +	trace_vfs_utimes_err(error);
> +	return -error;
>   }
>   
> -int utimes(const char *pathname, const struct timeval times[2])
> +UK_SYSCALL_R_DEFINE(int, utimes, const char*, pathname,
> +	const struct timeval*, times)
>   {
>   	return do_utimes(pathname, times, 0);
>   }
>


From minios-devel-bounces@lists.xenproject.org Thu Dec 03 10:06:26 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Thu, 03 Dec 2020 10:06:26 +0000
Received: from list by lists.xenproject.org with outflank-mailman.43301.77868 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1kklVJ-0006mO-OW; Thu, 03 Dec 2020 10:06:25 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 43301.77868; Thu, 03 Dec 2020 10:06: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 1kklVJ-0006mH-L7; Thu, 03 Dec 2020 10:06:25 +0000
Received: by outflank-mailman (input) for mailman id 43301;
 Thu, 03 Dec 2020 10:06: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=SiMt=FH=gmail.com=dincadaniel97@srs-us1.protection.inumbo.net>)
 id 1kklVH-0006m7-M0
 for minios-devel@lists.xen.org; Thu, 03 Dec 2020 10:06:23 +0000
Received: from mail-ej1-x643.google.com (unknown [2a00:1450:4864:20::643])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 6f672bf5-aef7-4c2a-a8e1-55b45d8674c7;
 Thu, 03 Dec 2020 10:06:22 +0000 (UTC)
Received: by mail-ej1-x643.google.com with SMTP id n26so2581398eju.6
 for <minios-devel@lists.xen.org>; Thu, 03 Dec 2020 02:06:22 -0800 (PST)
Received: from ?IPv6:2a02:2f0c:5105:a500:904f:a43e:16c8:882c?
 ([2a02:2f0c:5105:a500:904f:a43e:16c8:882c])
 by smtp.gmail.com with ESMTPSA id o11sm478120ejh.55.2020.12.03.02.06.21
 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128);
 Thu, 03 Dec 2020 02:06:21 -0800 (PST)
X-BeenThere: minios-devel@lists.xenproject.org
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
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: 6f672bf5-aef7-4c2a-a8e1-55b45d8674c7
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20161025;
        h=subject:to:cc:references:from:message-id:date:user-agent
         :mime-version:in-reply-to:content-transfer-encoding:content-language;
        bh=q+4TuhTwAUMn2emmKND8w+GkvB3RHad8ZV42TGSKwpM=;
        b=uBCQWdB/SZuip4/3luLAaA1har+ZF7LzJ7GjSk+q5zL6EnwA3I0quCqIN3T5YMbu/q
         Y0HdHK930e66GyALosUBHQow5ubTXwtDvO0MGWWUxOU6/Wvpe1Bxb2tgIt5DU3sClsSL
         wQ6v+2dbzaUaY8Wpfv76mW2+L8WhxFlVzjIlbQ8ZxU+AEC1wBMBw5jafwam4OMDmg0mL
         Z82sOhXce0Kj5bI8qABHi/EpuXVF+ABy4rxRa1U2vN1O04YNCa+MHKO9tbykeTOqtdxQ
         hIKfbE5+DeIPJ9Mc0yOSwyks7KkgKioGRNGFRXckOrmTcHLnGofSgdHT10f8k6FYnfHp
         nfwQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20161025;
        h=x-gm-message-state:subject:to:cc:references:from:message-id:date
         :user-agent:mime-version:in-reply-to:content-transfer-encoding
         :content-language;
        bh=q+4TuhTwAUMn2emmKND8w+GkvB3RHad8ZV42TGSKwpM=;
        b=DOM8r2RhGn3IQeZDlLHbIh6gPAqGOp5vsb9lyQdd7JsJLh87O/8fN1WrP2quo2cOMe
         noKi3fNL2jJl0ku/SvV1WlEpwVBfrPR+NvLOC/PYgC6wdLFmX/ZJWfwgBicwpETNvOue
         +kR2Ghkg4Z5lpVVhEQNtlls+xvESzEhPXhZJbkUf4ujQAAezZNjHZVzY2gls6VdCvMdp
         Ik7kWbIKXyLetqCjjnMMCt5xnpCYrO5Kk7vX3Kn5Ki9nRW7QYmEyPGZqa2vy5DZOpGbT
         msTZB9wP2ysX9tsmJ9jRmlDYkqaulSHZU7ucdb2H0KyBAvvffqI2YddF/SXpi4Qp8RGq
         ui6A==
X-Gm-Message-State: AOAM5334NCjaTuowtk7/qdwKonHP2xBwxHStLn272T/48kv/+PbLZS6P
	u16KODmUz1QAHBRhwUggzFg=
X-Google-Smtp-Source: ABdhPJzUPnGe+tAZSgjeU7mdIHwU2+kZ9LTx3qo46tj2axPcUz4ntzCDen6LcATx9wpUUjWAVyr4jg==
X-Received: by 2002:a17:906:a197:: with SMTP id s23mr1795462ejy.463.1606989982106;
        Thu, 03 Dec 2020 02:06:22 -0800 (PST)
Subject: Re: [UNIKRAFT PATCH 05/11] lib/vfscore: Register `rmdir` to
 syscall_shim
To: Constantin Raducanu <raducanu.costi@gmail.com>, minios-devel@lists.xen.org
Cc: simon.kuenzer@neclab.eu
References: <20200502181835.6724-1-raducanu.costi@gmail.com>
 <20200502181835.6724-5-raducanu.costi@gmail.com>
From: Daniel Dinca <dincadaniel97@gmail.com>
Message-ID: <176548b4-7508-1c02-d75f-9d35c8b182e6@gmail.com>
Date: Thu, 3 Dec 2020 12:06:20 +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: <20200502181835.6724-5-raducanu.costi@gmail.com>
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
Content-Language: en-US

Looks good.

Reviewed-by: Daniel Dinca <dincadaniel97@gmail.com>

On 02.05.2020 21:18, Constantin Raducanu wrote:
> Registers `rmdir` system call to syscall_shim library.
>
> Signed-off-by: Constantin Raducanu <raducanu.costi@gmail.com>
> ---
>   lib/vfscore/Makefile.uk   |  3 ++-
>   lib/vfscore/exportsyms.uk |  2 ++
>   lib/vfscore/main.c        | 14 +++++++-------
>   3 files changed, 11 insertions(+), 8 deletions(-)
>
> diff --git a/lib/vfscore/Makefile.uk b/lib/vfscore/Makefile.uk
> index 45d3bcb..56d3e4f 100644
> --- a/lib/vfscore/Makefile.uk
> +++ b/lib/vfscore/Makefile.uk
> @@ -46,4 +46,5 @@ UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += dup3-3
>   UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += dup2-2
>   UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += pwritev-4
>   UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += utimes-2
> -UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += mknod-3
> \ No newline at end of file
> +UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += mknod-3
> +UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += rmdir-1
> \ No newline at end of file
> diff --git a/lib/vfscore/exportsyms.uk b/lib/vfscore/exportsyms.uk
> index 67f3fa8..d615eb8 100644
> --- a/lib/vfscore/exportsyms.uk
> +++ b/lib/vfscore/exportsyms.uk
> @@ -100,6 +100,8 @@ rewinddir
>   telldir
>   seekdir
>   rmdir
> +uk_syscall_e_rmdir
> +uk_syscall_r_rmdir
>   fchdir
>   uk_syscall_e_fchdir
>   uk_syscall_r_fchdir
> diff --git a/lib/vfscore/main.c b/lib/vfscore/main.c
> index d9496bf..b0af047 100644
> --- a/lib/vfscore/main.c
> +++ b/lib/vfscore/main.c
> @@ -879,7 +879,7 @@ UK_TRACEPOINT(trace_vfs_rmdir, "\"%s\"", const char*);
>   UK_TRACEPOINT(trace_vfs_rmdir_ret, "");
>   UK_TRACEPOINT(trace_vfs_rmdir_err, "%d", int);
>   
> -int rmdir(const char *pathname)
> +UK_SYSCALL_R_DEFINE(int, rmdir, const char*, pathname)
>   {
>   	struct task *t = main_task;
>   	char path[PATH_MAX];
> @@ -888,19 +888,19 @@ int rmdir(const char *pathname)
>   	trace_vfs_rmdir(pathname);
>   	error = ENOENT;
>   	if (pathname == NULL)
> -		goto out_errno;
> +		goto out_error;
>   	if ((error = task_conv(t, pathname, VWRITE, path)) != 0)
> -		goto out_errno;
> +		goto out_error;
>   
>   	error = sys_rmdir(path);
>   	if (error)
> -		goto out_errno;
> +		goto out_error;
>   	trace_vfs_rmdir_ret();
>   	return 0;
> -	out_errno:
> +
> +	out_error:
>   	trace_vfs_rmdir_err(error);
> -	errno = error;
> -	return -1;
> +	return -error;
>   }
>   
>   static void
>


From minios-devel-bounces@lists.xenproject.org Thu Dec 03 10:07:17 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Thu, 03 Dec 2020 10:07:17 +0000
Received: from list by lists.xenproject.org with outflank-mailman.43305.77871 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1kklW9-0006om-SN; Thu, 03 Dec 2020 10:07:17 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 43305.77871; Thu, 03 Dec 2020 10:07: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 1kklW9-0006of-PR; Thu, 03 Dec 2020 10:07:17 +0000
Received: by outflank-mailman (input) for mailman id 43305;
 Thu, 03 Dec 2020 10:07: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=SiMt=FH=gmail.com=dincadaniel97@srs-us1.protection.inumbo.net>)
 id 1kklW8-0006oa-6L
 for minios-devel@lists.xen.org; Thu, 03 Dec 2020 10:07:16 +0000
Received: from mail-ej1-x642.google.com (unknown [2a00:1450:4864:20::642])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id cf0a2012-56b8-4135-94b8-28a815a4c997;
 Thu, 03 Dec 2020 10:07:15 +0000 (UTC)
Received: by mail-ej1-x642.google.com with SMTP id g20so2634839ejb.1
 for <minios-devel@lists.xen.org>; Thu, 03 Dec 2020 02:07:15 -0800 (PST)
Received: from ?IPv6:2a02:2f0c:5105:a500:904f:a43e:16c8:882c?
 ([2a02:2f0c:5105:a500:904f:a43e:16c8:882c])
 by smtp.gmail.com with ESMTPSA id y17sm481394ejj.84.2020.12.03.02.07.13
 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128);
 Thu, 03 Dec 2020 02:07:14 -0800 (PST)
X-BeenThere: minios-devel@lists.xenproject.org
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
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: cf0a2012-56b8-4135-94b8-28a815a4c997
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20161025;
        h=subject:to:cc:references:from:message-id:date:user-agent
         :mime-version:in-reply-to:content-transfer-encoding:content-language;
        bh=Q0uo+FcGF2pPc76KHx/MnrgSbKkFypw1vE0LdzBFL0g=;
        b=rbmY87EsoagryYS10eZYHm7jZbt6CP2RJe1p8LbWPCsvMRD2u1OlzS//itRuCeFeoi
         AlEyqK0mtgT5gYOGYR7qWxZaPv9N1f/QQUYHGGwEhFd74WHAkhIWlqLreFWcGMXlrXoI
         3uVtqZdryUQoQ3BrJddbMjjFr3gkHrgh+G2BmKX2kVSD+JT5FetzA+IDfmYWLZd91Emu
         vicz6XJrKympsRRD5U527n0cjRBcDi25xxRJmHWiyUmt96+uUhLDnU5lBLO+VEBiDjcl
         qtVR2v7gYZIt7bRXWHfFCwjddAnxT9YHET78uKgf45UNe1gfvHRPm4CJB9fDn1xceITG
         pRaA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20161025;
        h=x-gm-message-state:subject:to:cc:references:from:message-id:date
         :user-agent:mime-version:in-reply-to:content-transfer-encoding
         :content-language;
        bh=Q0uo+FcGF2pPc76KHx/MnrgSbKkFypw1vE0LdzBFL0g=;
        b=NI+YJxgYelKSY+hehkwJZ/D0+nTKl7BekudesuyIAesUTZKy5DzLDnV+YhrCdTGlmG
         UMN89xf/6ZlV5TqMzgptTE+UwexyxkDBCxo94/o7v4wCzOsO0iZ0pvGYzU2tB8IEKY/1
         vzfk/NGRCeWCgmze5X1q+v7/F4J4g0tPEfrgKrYSPXk2n6mgDImiu0pT8msDeSoo9MAJ
         mI0F5ZFr7thYyEimWldFY5Q36c8p96bvk4I/aT4TAT6cSdWYiGJX6tkWfteD68UWa4eK
         ugEbyAOwO8cFWuDUYVb4sAuPJyIEWBPBON1zP78ZcJY1or/RacSJyQUQQRslyolCJRLJ
         5w1w==
X-Gm-Message-State: AOAM531daB8XfjU9hXqVmltpXe20ht1dI54dc8W8VHn0vxIaEvwXu+AN
	2zlF2HQFZGIJA5v4kVhmrms=
X-Google-Smtp-Source: ABdhPJyWqGA0dhWLDsfOwltTt/0suGVcbP53FardNNf4r5lDBAV+IvFDBuKD+t0qTT7FpABn3v4Jbw==
X-Received: by 2002:a17:906:145b:: with SMTP id q27mr1865256ejc.86.1606990034613;
        Thu, 03 Dec 2020 02:07:14 -0800 (PST)
Subject: Re: [UNIKRAFT PATCH 07/11] lib/vfscore: Register `fsync` and
 `fdatasync` to syscall_shim
To: Constantin Raducanu <raducanu.costi@gmail.com>, minios-devel@lists.xen.org
Cc: simon.kuenzer@neclab.eu
References: <20200502181835.6724-1-raducanu.costi@gmail.com>
 <20200502181835.6724-7-raducanu.costi@gmail.com>
From: Daniel Dinca <dincadaniel97@gmail.com>
Message-ID: <bf02b556-f7bb-9bba-5865-6029c8384d40@gmail.com>
Date: Thu, 3 Dec 2020 12:07:12 +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: <20200502181835.6724-7-raducanu.costi@gmail.com>
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
Content-Language: en-US

Looks good.

Reviewed-by: Daniel Dinca <dincadaniel97@gmail.com>

On 02.05.2020 21:18, Constantin Raducanu wrote:
> Registers `fsync` and `fdatasync` system calls to syscall_shim library.
>
> Signed-off-by: Constantin Raducanu <raducanu.costi@gmail.com>
> ---
>   lib/vfscore/Makefile.uk   |  4 +++-
>   lib/vfscore/exportsyms.uk |  4 ++++
>   lib/vfscore/main.c        | 13 ++++++-------
>   3 files changed, 13 insertions(+), 8 deletions(-)
>
> diff --git a/lib/vfscore/Makefile.uk b/lib/vfscore/Makefile.uk
> index 63fc806..a643c03 100644
> --- a/lib/vfscore/Makefile.uk
> +++ b/lib/vfscore/Makefile.uk
> @@ -48,4 +48,6 @@ UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += pwritev-4
>   UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += utimes-2
>   UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += mknod-3
>   UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += rmdir-1
> -UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += rename-2
> \ No newline at end of file
> +UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += rename-2
> +UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += fsync-1
> +UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += fdatasync-1
> \ No newline at end of file
> diff --git a/lib/vfscore/exportsyms.uk b/lib/vfscore/exportsyms.uk
> index 4a8a4f4..d297957 100644
> --- a/lib/vfscore/exportsyms.uk
> +++ b/lib/vfscore/exportsyms.uk
> @@ -25,6 +25,8 @@ uk_syscall_e_read
>   uk_syscall_r_read
>   mkdir
>   fsync
> +uk_syscall_e_fsync
> +uk_syscall_r_fsync
>   fstat
>   uk_syscall_e_fstat
>   uk_syscall_r_fstat
> @@ -94,6 +96,8 @@ uk_syscall_r_mknod
>   preadv
>   ioctl
>   fdatasync
> +uk_syscall_e_fdatasync
> +uk_syscall_r_fdatasync
>   fdopendir
>   dirfd
>   rewinddir
> diff --git a/lib/vfscore/main.c b/lib/vfscore/main.c
> index 41c81f5..25da26b 100644
> --- a/lib/vfscore/main.c
> +++ b/lib/vfscore/main.c
> @@ -489,7 +489,7 @@ UK_TRACEPOINT(trace_vfs_fsync, "%d", int);
>   UK_TRACEPOINT(trace_vfs_fsync_ret, "");
>   UK_TRACEPOINT(trace_vfs_fsync_err, "%d", int);
>   
> -int fsync(int fd)
> +UK_SYSCALL_R_DEFINE(int, fsync, int, fd)
>   {
>   	struct vfscore_file *fp;
>   	int error;
> @@ -497,23 +497,22 @@ int fsync(int fd)
>   	trace_vfs_fsync(fd);
>   	error = fget(fd, &fp);
>   	if (error)
> -		goto out_errno;
> +		goto out_error;
>   
>   	error = sys_fsync(fp);
>   	fdrop(fp);
>   
>   	if (error)
> -		goto out_errno;
> +		goto out_error;
>   	trace_vfs_fsync_ret();
>   	return 0;
>   
> -	out_errno:
> +	out_error:
>   	trace_vfs_fsync_err(error);
> -	errno = error;
> -	return -1;
> +	return -error;
>   }
>   
> -int fdatasync(int fd)
> +UK_SYSCALL_R_DEFINE(int, fdatasync, int, fd)
>   {
>   	// TODO: See if we can do less than fsync().
>   	return fsync(fd);
>


From minios-devel-bounces@lists.xenproject.org Thu Dec 03 10:07:41 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Thu, 03 Dec 2020 10:07:41 +0000
Received: from list by lists.xenproject.org with outflank-mailman.43308.77875 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1kklWW-0006qE-Ud; Thu, 03 Dec 2020 10:07:40 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 43308.77875; Thu, 03 Dec 2020 10:07: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 1kklWW-0006q7-Rk; Thu, 03 Dec 2020 10:07:40 +0000
Received: by outflank-mailman (input) for mailman id 43308;
 Thu, 03 Dec 2020 10:07: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=SiMt=FH=gmail.com=dincadaniel97@srs-us1.protection.inumbo.net>)
 id 1kklWV-0006q2-3A
 for minios-devel@lists.xen.org; Thu, 03 Dec 2020 10:07:39 +0000
Received: from mail-ej1-x643.google.com (unknown [2a00:1450:4864:20::643])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id bf9c05a3-6549-43e9-b220-1c248d496b75;
 Thu, 03 Dec 2020 10:07:38 +0000 (UTC)
Received: by mail-ej1-x643.google.com with SMTP id x16so2578512ejj.7
 for <minios-devel@lists.xen.org>; Thu, 03 Dec 2020 02:07:38 -0800 (PST)
Received: from ?IPv6:2a02:2f0c:5105:a500:904f:a43e:16c8:882c?
 ([2a02:2f0c:5105:a500:904f:a43e:16c8:882c])
 by smtp.gmail.com with ESMTPSA id b15sm829814edv.85.2020.12.03.02.07.36
 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128);
 Thu, 03 Dec 2020 02:07:37 -0800 (PST)
X-BeenThere: minios-devel@lists.xenproject.org
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
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: bf9c05a3-6549-43e9-b220-1c248d496b75
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20161025;
        h=subject:to:cc:references:from:message-id:date:user-agent
         :mime-version:in-reply-to:content-transfer-encoding:content-language;
        bh=AoSGbfBHlV1LUabtleAVUV+ZLjWypTI5XuhAmo4KSpk=;
        b=mLXrVSziSJsQZFforCt9MFWKELobMZBupzuPOP01NC0tKnZCbD/Meuv4wjEHhikkTG
         UrdjLeCo9WW6XAZESSSDh78EoF6j34ndS9L2Igo2z/Kt9Do1thSCH3br8is6E2G/UJkJ
         9GCfFGeTlkptxsxX3ReHR0oNBcYPasdM58ZEu35kqG0dPnMuv5MpgHUlIxxwCIgktn22
         vqlirAtm1+T14ndNPNB4XcpUbGQB/7dTa8y0/cBsw35S/QVz1mx2oJzjAEejhXdoL4uO
         6AHzKZWvfZ7YSF1YwWjF6OAgCBduAEucKhC+HrotCeXofYPapq7goE1x+lkCnwqRmH8M
         MURg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20161025;
        h=x-gm-message-state:subject:to:cc:references:from:message-id:date
         :user-agent:mime-version:in-reply-to:content-transfer-encoding
         :content-language;
        bh=AoSGbfBHlV1LUabtleAVUV+ZLjWypTI5XuhAmo4KSpk=;
        b=Zv5RSj8NR+mvZyWguiyne8w/uxbWH6hJGGNM5DEn4PEPDarVR/sBliorHSjSip+Ltb
         052Y5AN8sitlVZVeLn77aHe1uSjEDnGu1C9QGZI8Wqz/ErDgStyMUKUtCEqlbKKnNnbe
         CnTJLrNuRuzp0pfPbutipxbrcc8wjvpcx5hF1PaBasuJ9tNXsLG4u5RNsaINm/k37jBH
         +G+L8kN5AOMt4zSgjXjxhr+BYFU22jddcZkbUfb3ZsBxCCcdVpFdIZhE7uATYg+Mh/zS
         sxB3C/AYzMN7EyYPQQV/KA5tF78ZFih+62TIjDzVTaIttCphuwo8Le0xi8I9rEI2ASIS
         eU+Q==
X-Gm-Message-State: AOAM5302/Qm5z4R93lRhCSQpMCVn1TPvPSER8NdviNU5rKQLI2QYdD5I
	6rivCVC1KUPGk6kWZ6uCoQGpma+23sOHbrRZ
X-Google-Smtp-Source: ABdhPJwjoylfyv2tEQO96/YEcNdgBXKebwqBNpvPJqDoreCFJC+rKDGCOmp22QhISUNeLnTJcr3kBQ==
X-Received: by 2002:a17:906:1282:: with SMTP id k2mr1751073ejb.554.1606990057484;
        Thu, 03 Dec 2020 02:07:37 -0800 (PST)
Subject: Re: [UNIKRAFT PATCH 08/11] lib/vfscore: Register `preadv` to
 syscall_shim
To: Constantin Raducanu <raducanu.costi@gmail.com>, minios-devel@lists.xen.org
Cc: simon.kuenzer@neclab.eu
References: <20200502181835.6724-1-raducanu.costi@gmail.com>
 <20200502181835.6724-8-raducanu.costi@gmail.com>
From: Daniel Dinca <dincadaniel97@gmail.com>
Message-ID: <7689598c-94b8-1ee6-9017-e1f17113c068@gmail.com>
Date: Thu, 3 Dec 2020 12:07:35 +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: <20200502181835.6724-8-raducanu.costi@gmail.com>
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
Content-Language: en-US

Looks good.

Reviewed-by: Daniel Dinca <dincadaniel97@gmail.com>

On 02.05.2020 21:18, Constantin Raducanu wrote:
> Registers `preadv` system call to syscall_shim library.
>
> Signed-off-by: Constantin Raducanu <raducanu.costi@gmail.com>
> ---
>   lib/vfscore/Makefile.uk   |  3 ++-
>   lib/vfscore/exportsyms.uk |  2 ++
>   lib/vfscore/main.c        | 12 ++++++------
>   3 files changed, 10 insertions(+), 7 deletions(-)
>
> diff --git a/lib/vfscore/Makefile.uk b/lib/vfscore/Makefile.uk
> index a643c03..5c64046 100644
> --- a/lib/vfscore/Makefile.uk
> +++ b/lib/vfscore/Makefile.uk
> @@ -50,4 +50,5 @@ UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += mknod-3
>   UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += rmdir-1
>   UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += rename-2
>   UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += fsync-1
> -UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += fdatasync-1
> \ No newline at end of file
> +UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += fdatasync-1
> +UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += preadv-4
> \ No newline at end of file
> diff --git a/lib/vfscore/exportsyms.uk b/lib/vfscore/exportsyms.uk
> index d297957..46c7437 100644
> --- a/lib/vfscore/exportsyms.uk
> +++ b/lib/vfscore/exportsyms.uk
> @@ -94,6 +94,8 @@ mknod
>   uk_syscall_e_mknod
>   uk_syscall_r_mknod
>   preadv
> +uk_syscall_e_preadv
> +uk_syscall_r_preadv
>   ioctl
>   fdatasync
>   uk_syscall_e_fdatasync
> diff --git a/lib/vfscore/main.c b/lib/vfscore/main.c
> index 25da26b..e7b0e90 100644
> --- a/lib/vfscore/main.c
> +++ b/lib/vfscore/main.c
> @@ -381,7 +381,8 @@ UK_SYSCALL_DEFINE(ssize_t, write, int, fd, const void *, buf, size_t, count)
>   	return pwrite(fd, buf, count, -1);
>   }
>   
> -ssize_t preadv(int fd, const struct iovec *iov, int iovcnt, off_t offset)
> +UK_SYSCALL_R_DEFINE(ssize_t, preadv, int, fd, const struct iovec*, iov,
> +	int, iovcnt, off_t, offset)
>   {
>   	struct vfscore_file *fp;
>   	size_t bytes;
> @@ -389,18 +390,17 @@ ssize_t preadv(int fd, const struct iovec *iov, int iovcnt, off_t offset)
>   
>   	error = fget(fd, &fp);
>   	if (error)
> -		goto out_errno;
> +		goto out_error;
>   
>   	error = sys_read(fp, iov, iovcnt, offset, &bytes);
>   	fdrop(fp);
>   
>   	if (has_error(error, bytes))
> -		goto out_errno;
> +		goto out_error;
>   	return bytes;
>   
> -	out_errno:
> -	errno = error;
> -	return -1;
> +	out_error:
> +	return -error;
>   }
>   
>   LFS64(preadv);
>


From minios-devel-bounces@lists.xenproject.org Thu Dec 03 10:09:21 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Thu, 03 Dec 2020 10:09:21 +0000
Received: from list by lists.xenproject.org with outflank-mailman.43313.77892 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1kklY8-0006vS-CD; Thu, 03 Dec 2020 10:09:20 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 43313.77892; Thu, 03 Dec 2020 10:09: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 1kklY8-0006vL-8O; Thu, 03 Dec 2020 10:09:20 +0000
Received: by outflank-mailman (input) for mailman id 43313;
 Thu, 03 Dec 2020 10:09: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=SiMt=FH=gmail.com=dincadaniel97@srs-us1.protection.inumbo.net>)
 id 1kklY7-0006uK-R7
 for minios-devel@lists.xen.org; Thu, 03 Dec 2020 10:09:19 +0000
Received: from mail-ed1-x541.google.com (unknown [2a00:1450:4864:20::541])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id ac8dfc5f-2dc1-4b0a-bace-b31cf5f7cbb1;
 Thu, 03 Dec 2020 10:09:19 +0000 (UTC)
Received: by mail-ed1-x541.google.com with SMTP id v22so1446169edt.9
 for <minios-devel@lists.xen.org>; Thu, 03 Dec 2020 02:09:19 -0800 (PST)
Received: from ?IPv6:2a02:2f0c:5105:a500:904f:a43e:16c8:882c?
 ([2a02:2f0c:5105:a500:904f:a43e:16c8:882c])
 by smtp.gmail.com with ESMTPSA id x20sm492108ejv.66.2020.12.03.02.09.17
 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128);
 Thu, 03 Dec 2020 02:09:17 -0800 (PST)
X-BeenThere: minios-devel@lists.xenproject.org
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
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: ac8dfc5f-2dc1-4b0a-bace-b31cf5f7cbb1
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20161025;
        h=subject:to:cc:references:from:message-id:date:user-agent
         :mime-version:in-reply-to:content-transfer-encoding:content-language;
        bh=dI7nMZJNndwqV5dTkmp3qTld/+Eq+/sklH2L2jOEBhg=;
        b=Y48N/1G5yVNlYdf6aABAcRzHdZLFwgtqfuPZIqyu+FSAHBtJJhhgoAGJuguUm0OTgF
         2M9xYF3/Qo26aneE6ieoZDIkOyo1k3xNWZ3F9qLhqlxo2eBOgi17ieZdd9z5QVCnC7oA
         tfsobunH9iIef8n7vy6NmHcIeSAbSdxLmU6wFL9FK+NIRHpmmoplELMnAGM4UhVifDpb
         0lsmY5y1sQq4AGOFRYqSpWntcHoNqp324W1ttjMkG+SvDwZNsqU4lpPXu0SfmbjRPsMu
         h7kB2P4h7gj1KPC4gKw7/nUKh7uzOZdZepmsL2Ocb1v65DT+M8yuo4HAahFxYp2wEogP
         QAOg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20161025;
        h=x-gm-message-state:subject:to:cc:references:from:message-id:date
         :user-agent:mime-version:in-reply-to:content-transfer-encoding
         :content-language;
        bh=dI7nMZJNndwqV5dTkmp3qTld/+Eq+/sklH2L2jOEBhg=;
        b=ZZZbdnDnrQFs20TtWYvahaWY5kSqMp3weBo5H/+P+rA8AYsr0LI7ZPhhyx+ZOY2Rwg
         Hwugi/Z9EiQ4MlLD2x/SIOibX0nDGR/mt3ynCYqRLq1g9IGJSkoqPnt28JRJ9FQ5JXN9
         eng3e+gsvN0rf+m50N3yyaVN3Nh+2UMIxWBil1xIVRp7pAozvEcIA/Z2YIfvN2WZRxcs
         YDbTA5ladh4GfzGmoFDQLBo63dJyefENOq/f4aI5mkgxsOj9i/08BmA2uz4VSG8zdS/x
         8IhFZtmttI6IEJGPdUnvBcjEgaWN6iugc92qtYOrggQi44XpsB8PDk/maRPcpOPoJG/J
         KbyA==
X-Gm-Message-State: AOAM533htBxLhB9iWOmLkW0LosQ4pYOguk2xF/LlNmEH25IMm2P4rVM3
	18wK3Mi3QJwEPYLwvTCB9W8rQuk6KtMgPVGi
X-Google-Smtp-Source: ABdhPJyTSZww9UaQzSu98KmH1jE4fX0Zeli7/e9As5wTqHgiJEiVWoNObs6EyLYDE8X1i9B0MUqxLw==
X-Received: by 2002:aa7:c403:: with SMTP id j3mr2084710edq.217.1606990158383;
        Thu, 03 Dec 2020 02:09:18 -0800 (PST)
Subject: Re: [UNIKRAFT PATCH 09/11] lib/vfscore: Register `umask` to
 syscall_shim
To: Constantin Raducanu <raducanu.costi@gmail.com>, minios-devel@lists.xen.org
Cc: simon.kuenzer@neclab.eu
References: <20200502181835.6724-1-raducanu.costi@gmail.com>
 <20200502181835.6724-9-raducanu.costi@gmail.com>
From: Daniel Dinca <dincadaniel97@gmail.com>
Message-ID: <fc913e72-cb53-d639-3488-23db89ab9c2e@gmail.com>
Date: Thu, 3 Dec 2020 12:09:16 +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: <20200502181835.6724-9-raducanu.costi@gmail.com>
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
Content-Language: en-US

Looks good.

Reviewed-by: Daniel Dinca <dincadaniel97@gmail.com>

On 02.05.2020 21:18, Constantin Raducanu wrote:
> Registers `umask` system call to syscall_shim library.
>
> Signed-off-by: Constantin Raducanu <raducanu.costi@gmail.com>
> ---
>   lib/vfscore/Makefile.uk   | 3 ++-
>   lib/vfscore/exportsyms.uk | 2 ++
>   lib/vfscore/main.c        | 2 +-
>   3 files changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/lib/vfscore/Makefile.uk b/lib/vfscore/Makefile.uk
> index 5c64046..c7025bd 100644
> --- a/lib/vfscore/Makefile.uk
> +++ b/lib/vfscore/Makefile.uk
> @@ -51,4 +51,5 @@ UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += rmdir-1
>   UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += rename-2
>   UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += fsync-1
>   UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += fdatasync-1
> -UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += preadv-4
> \ No newline at end of file
> +UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += preadv-4
> +UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += umask-1
> \ No newline at end of file
> diff --git a/lib/vfscore/exportsyms.uk b/lib/vfscore/exportsyms.uk
> index 46c7437..b9c29b1 100644
> --- a/lib/vfscore/exportsyms.uk
> +++ b/lib/vfscore/exportsyms.uk
> @@ -132,6 +132,8 @@ uk_syscall_r_lseek
>   uk_syscall_e_writev
>   uk_syscall_r_writev
>   umask
> +uk_syscall_e_umask
> +uk_syscall_r_umask
>   dentry_alloc
>   dentry_init
>   dentry_lookup
> diff --git a/lib/vfscore/main.c b/lib/vfscore/main.c
> index e7b0e90..18cf17c 100644
> --- a/lib/vfscore/main.c
> +++ b/lib/vfscore/main.c
> @@ -2138,7 +2138,7 @@ int posix_fadvise(int fd __unused, off_t offset __unused, off_t len __unused,
>   }
>   LFS64(posix_fadvise);
>   
> -mode_t umask(mode_t newmask)
> +UK_SYSCALL_R_DEFINE(mode_t, umask, mode_t, newmask)
>   {
>   	return ukarch_exchange_n(&global_umask, newmask);
>   }
>


From minios-devel-bounces@lists.xenproject.org Thu Dec 03 10:09:45 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Thu, 03 Dec 2020 10:09:45 +0000
Received: from list by lists.xenproject.org with outflank-mailman.43319.77896 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1kklYX-00070l-E1; Thu, 03 Dec 2020 10:09:45 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 43319.77896; Thu, 03 Dec 2020 10:09: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 1kklYX-00070e-At; Thu, 03 Dec 2020 10:09:45 +0000
Received: by outflank-mailman (input) for mailman id 43319;
 Thu, 03 Dec 2020 10:09: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=SiMt=FH=gmail.com=dincadaniel97@srs-us1.protection.inumbo.net>)
 id 1kklYW-000708-Pc
 for minios-devel@lists.xen.org; Thu, 03 Dec 2020 10:09:44 +0000
Received: from mail-ed1-x543.google.com (unknown [2a00:1450:4864:20::543])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id c6946d33-357e-475d-b133-5892393755ea;
 Thu, 03 Dec 2020 10:09:44 +0000 (UTC)
Received: by mail-ed1-x543.google.com with SMTP id b73so1432167edf.13
 for <minios-devel@lists.xen.org>; Thu, 03 Dec 2020 02:09:44 -0800 (PST)
Received: from ?IPv6:2a02:2f0c:5105:a500:904f:a43e:16c8:882c?
 ([2a02:2f0c:5105:a500:904f:a43e:16c8:882c])
 by smtp.gmail.com with ESMTPSA id cb14sm478416ejb.105.2020.12.03.02.09.42
 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128);
 Thu, 03 Dec 2020 02:09:42 -0800 (PST)
X-BeenThere: minios-devel@lists.xenproject.org
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
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: c6946d33-357e-475d-b133-5892393755ea
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20161025;
        h=subject:to:cc:references:from:message-id:date:user-agent
         :mime-version:in-reply-to:content-transfer-encoding:content-language;
        bh=iixsvx6Fn7C0RolCsfaqpQAhF1Ecke0xfJfEojdJwbQ=;
        b=WEi0VD2ypWJgN2VgTgDbwLBmcEh1dvhWJWWo0XKR5inRpQEb9F4kv0we8dpfDLCMbO
         EPyf4ckeuWHgQuz/79NFxyxyAyb85lyKOIzUveFS2lFY/UHuzFsuMu8NYZhcBFsPkDpk
         QbsK7pGtnjZuEoBWCeP9IH86cCV6HbuhCzfOacHO2txNInNsEINpMxhaFA+8Du/IEVqJ
         6SofrXHT7amn5M/QNPXgYTH9t0WnqnqVW2K4RyAcp/ieOS9Y43tPDP4HQurxN3djPRkG
         BGlTUdAK1aKDyAMv/RxyYxU8zHqkXh496ydDjKhSOhBtdpHs2Bg3WGQbWZoAYV2YHrch
         a5ew==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20161025;
        h=x-gm-message-state:subject:to:cc:references:from:message-id:date
         :user-agent:mime-version:in-reply-to:content-transfer-encoding
         :content-language;
        bh=iixsvx6Fn7C0RolCsfaqpQAhF1Ecke0xfJfEojdJwbQ=;
        b=PbhDo7CuRTsKZRRv3E0w6uFWs72JFyUq3SQN0Ywtq7rTr5DtV8EEfmfERhH8rwqDdb
         FmLOzO1dgbS3Rh0EKK0LYp2bqelHgv6dsyGyzc7ReDBn2+JxsXpsX3XKcyf3rvnBLzpn
         YSppjKJqG3NcbyYYBmmEeSFm42eoUl+y/hAkxX1+c/5gp7Z9h6SJ6c0Y1+E2+GfmVVeR
         kfVs7O0IRHR3CN/YtfCAxcPgc2sSu9vk/070ZIfIjfxwct4lsJB3F4ajzJePPO0ZWY/L
         ecg2oOFT6O3RDYWxuUjSx6w7wUHNyi7Bmw452uGfj0GobdW9AWossJR6CPmHIPfcB5AG
         0jCQ==
X-Gm-Message-State: AOAM5330TVsi+2PfaPPErL5A1VDDa2YrqcK7BxYHJrDTHYV75ckqI3lr
	VjL8BwIMI5EW4eP8McGxAhoaiqlsnWWzsw==
X-Google-Smtp-Source: ABdhPJxvCVO0CWQvcy1YpwC9FJv/cEYZpz4wj1WaMVKSY+863MYJ1B0a10FB04Du5MlcZhzpkWSbpQ==
X-Received: by 2002:aa7:dd17:: with SMTP id i23mr2109822edv.14.1606990183225;
        Thu, 03 Dec 2020 02:09:43 -0800 (PST)
Subject: Re: [UNIKRAFT PATCH 11/11] lib/vfscore: Register `flock` to
 syscall_shim
To: Constantin Raducanu <raducanu.costi@gmail.com>, minios-devel@lists.xen.org
Cc: simon.kuenzer@neclab.eu
References: <20200502181835.6724-1-raducanu.costi@gmail.com>
 <20200502181835.6724-11-raducanu.costi@gmail.com>
From: Daniel Dinca <dincadaniel97@gmail.com>
Message-ID: <b99edb58-fe37-65d3-cdbb-1a916c7c7286@gmail.com>
Date: Thu, 3 Dec 2020 12:09:41 +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: <20200502181835.6724-11-raducanu.costi@gmail.com>
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
Content-Language: en-US

Looks good.

Reviewed-by: Daniel Dinca <dincadaniel97@gmail.com>

On 02.05.2020 21:18, Constantin Raducanu wrote:
> Registers `flock` system call to syscall_shim library.
>
> Signed-off-by: Constantin Raducanu <raducanu.costi@gmail.com>
> ---
>   lib/vfscore/Makefile.uk   |  3 ++-
>   lib/vfscore/exportsyms.uk |  2 ++
>   lib/vfscore/main.c        | 12 +++++++++---
>   3 files changed, 13 insertions(+), 4 deletions(-)
>
> diff --git a/lib/vfscore/Makefile.uk b/lib/vfscore/Makefile.uk
> index dfd33d6..e7f327a 100644
> --- a/lib/vfscore/Makefile.uk
> +++ b/lib/vfscore/Makefile.uk
> @@ -53,4 +53,5 @@ UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += fsync-1
>   UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += fdatasync-1
>   UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += preadv-4
>   UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += umask-1
> -UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += lstat-2
> \ No newline at end of file
> +UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += lstat-2
> +UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += flock-2
> \ No newline at end of file
> diff --git a/lib/vfscore/exportsyms.uk b/lib/vfscore/exportsyms.uk
> index 6061c85..20595e1 100644
> --- a/lib/vfscore/exportsyms.uk
> +++ b/lib/vfscore/exportsyms.uk
> @@ -31,6 +31,8 @@ fstat
>   uk_syscall_e_fstat
>   uk_syscall_r_fstat
>   flock
> +uk_syscall_e_flock
> +uk_syscall_r_flock
>   fhold
>   fdrop
>   fget
> diff --git a/lib/vfscore/main.c b/lib/vfscore/main.c
> index 8f955ff..746dd7f 100644
> --- a/lib/vfscore/main.c
> +++ b/lib/vfscore/main.c
> @@ -605,12 +605,14 @@ int fstatat(int dirfd, const char *path, struct stat *st, int flags)
>   
>   LFS64(fstatat);
>   
> -int flock(int fd, int operation)
> +UK_SYSCALL_R_DEFINE(int, flock, int, fd, int, operation)
>   {
>   	struct vfscore_file *file;
> +	int error;
>   
>   	if (!fget(fd, &file)) {
> -		return libc_error(EBADF);
> +		error = EBADF;
> +		goto out_error;
>   	}
>   
>   	switch (operation) {
> @@ -621,10 +623,14 @@ int flock(int fd, int operation)
>   	case LOCK_UN:
>   		break;
>   	default:
> -		return libc_error(EINVAL);
> +		error = EINVAL;
> +		goto out_error;
>   	}
>   
>   	return 0;
> +
> +	out_error:
> +	return -error;
>   }
>   
>   UK_TRACEPOINT(trace_vfs_readdir, "%d %p", int, struct dirent*);
>


From minios-devel-bounces@lists.xenproject.org Thu Dec 03 10:15:57 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Thu, 03 Dec 2020 10:15:57 +0000
Received: from list by lists.xenproject.org with outflank-mailman.43324.77900 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1kkleU-0007vi-Ti; Thu, 03 Dec 2020 10:15:54 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 43324.77900; Thu, 03 Dec 2020 10:15: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 1kkleU-0007vb-Qo; Thu, 03 Dec 2020 10:15:54 +0000
Received: by outflank-mailman (input) for mailman id 43324;
 Thu, 03 Dec 2020 10:15: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=SiMt=FH=gmail.com=dincadaniel97@srs-us1.protection.inumbo.net>)
 id 1kkleT-0007vW-TT
 for minios-devel@lists.xen.org; Thu, 03 Dec 2020 10:15:53 +0000
Received: from mail-ej1-x644.google.com (unknown [2a00:1450:4864:20::644])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id dc6c3df2-dd2d-4566-95c1-894910d89c8e;
 Thu, 03 Dec 2020 10:15:52 +0000 (UTC)
Received: by mail-ej1-x644.google.com with SMTP id d17so2601869ejy.9
 for <minios-devel@lists.xen.org>; Thu, 03 Dec 2020 02:15:52 -0800 (PST)
Received: from ?IPv6:2a02:2f0c:5105:a500:904f:a43e:16c8:882c?
 ([2a02:2f0c:5105:a500:904f:a43e:16c8:882c])
 by smtp.gmail.com with ESMTPSA id r9sm828640edx.82.2020.12.03.02.15.50
 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128);
 Thu, 03 Dec 2020 02:15:51 -0800 (PST)
X-BeenThere: minios-devel@lists.xenproject.org
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
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: dc6c3df2-dd2d-4566-95c1-894910d89c8e
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20161025;
        h=subject:to:cc:references:from:message-id:date:user-agent
         :mime-version:in-reply-to:content-transfer-encoding:content-language;
        bh=4Ppik6hGfxuvv1Bugq9OshPDbhuE4+zY0k8mFz+4IQI=;
        b=Ax4nqHP4C4G/p9N3kebENA+Whj4SuWnhm3COafR/fSzofDRvfjOLgUVxmxZtCP+NgS
         c/eZ89FsFCLL7dKh5+wTrRhTVPsPxj9/T3QkpGWE5+TfmMPH1E7PKYngZ3pqcgohfPUJ
         ydNTuyUj8q9ZBHJ2t3Qh1b5sQUIwULwHyDVqgiD0ndweE9iB/S5aTU9JVh+8oemhuyDH
         sdN+74aIN2arNEuLmIiyUSTiNQ8exaM0UeDYMx71GEIYX1LYjfGuSXlQQd7Zv2H+5gpm
         anVZnnCIcXl21Ur0eqIbF46RCkzexeBO+4GpLHnPEo8bj3xmeb/GpRvVLAyVH9dgucro
         eERg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20161025;
        h=x-gm-message-state:subject:to:cc:references:from:message-id:date
         :user-agent:mime-version:in-reply-to:content-transfer-encoding
         :content-language;
        bh=4Ppik6hGfxuvv1Bugq9OshPDbhuE4+zY0k8mFz+4IQI=;
        b=R3coTu4iBCGavFWdU7BBoKWgBgnJ37Kn/m/fqAADCYkwuNC/zvkUie1HWjyuhe4/Sa
         u3cayS+vf4CSBTWOhQKiP4a3d5XIx7pUwwSG+WEnmgM4UolmF0Y3BpbEhYZnjrbWLkEA
         uo6LCqXsWoV3SeUcIb5mDx0MqeMFNNcixTFS8XucarmxDuSxVj/V4MDFWElxdWEhbi8F
         fYSxKUNdNmZVWJYsPhNdPWXSQHrVnyP4b0iypGGZTDUkvgu9PJ3fgI7auOXnScKgTk0J
         qFZShqi0dXAod51HyfJ1OstG4OCrT1UCVpTIv13iTnNNA2JA1O16niTKglus3xz+Mcqw
         9htw==
X-Gm-Message-State: AOAM533K2wUJQTPX9Oqe2UM2f4JfPgC4Rj3evqozWXrtwAlxZZS4cqzU
	eoPEg9xiGKv2ojzpPVZqqGU=
X-Google-Smtp-Source: ABdhPJzUZUcZxWkAoIzAmtDsX4F91OQkM40WE8aCwqw6r1fc3kc5YvUuVqDwRkkyC8Y3DoDzEvsjVg==
X-Received: by 2002:a17:906:33d4:: with SMTP id w20mr1822650eja.396.1606990552041;
        Thu, 03 Dec 2020 02:15:52 -0800 (PST)
Subject: Re: [UNIKRAFT PATCH 3/5] lib/uktime: Register `gettimeofday` to
 syscall_shim
To: Constantin Raducanu <raducanu.costi@gmail.com>, minios-devel@lists.xen.org
Cc: simon.kuenzer@neclab.eu
References: <20200717124718.16583-1-raducanu.costi@gmail.com>
 <20200717124718.16583-3-raducanu.costi@gmail.com>
From: Daniel Dinca <dincadaniel97@gmail.com>
Message-ID: <b20506ea-fd25-c477-9403-ea859ac487ab@gmail.com>
Date: Thu, 3 Dec 2020 12:15:50 +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: <20200717124718.16583-3-raducanu.costi@gmail.com>
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
Content-Language: en-US

This should use the UK_SYSCALL_R_DEFINE macro, with the new

updated version it should support __unused so no warning will appear.


Reviewed-by: Daniel Dinca <dincadaniel97@gmail.com>

On 17.07.2020 15:47, Constantin Raducanu wrote:
> Registers `gettimeofday` system call to syscall_shim library.
> In order to avoid the unused warning for the second parameter,
> I had to provide all three system call entry functions manually.
>
> Signed-off-by: Constantin Raducanu <raducanu.costi@gmail.com>
> ---
>   lib/uktime/Makefile.uk   |  2 ++
>   lib/uktime/exportsyms.uk |  2 ++
>   lib/uktime/time.c        | 32 +++++++++++++++++++++++++++-----
>   3 files changed, 31 insertions(+), 5 deletions(-)
>
> diff --git a/lib/uktime/Makefile.uk b/lib/uktime/Makefile.uk
> index 2976a10..4fdf282 100644
> --- a/lib/uktime/Makefile.uk
> +++ b/lib/uktime/Makefile.uk
> @@ -12,3 +12,5 @@ LIBUKTIME_SRCS-y += $(LIBUKTIME_BASE)/musl-imported/src/__tm_to_secs.c
>   LIBUKTIME_SRCS-y += $(LIBUKTIME_BASE)/musl-imported/src/__year_to_secs.c
>   LIBUKTIME_SRCS-y += $(LIBUKTIME_BASE)/time.c
>   LIBUKTIME_SRCS-y += $(LIBUKTIME_BASE)/timer.c
> +
> +UK_PROVIDED_SYSCALLS-$(CONFIG_LIBUKTIME) += gettimeofday-2
> \ No newline at end of file
> diff --git a/lib/uktime/exportsyms.uk b/lib/uktime/exportsyms.uk
> index 82b70b7..90ad7f9 100644
> --- a/lib/uktime/exportsyms.uk
> +++ b/lib/uktime/exportsyms.uk
> @@ -2,6 +2,8 @@ clock_getres
>   clock_gettime
>   clock_settime
>   gettimeofday
> +uk_syscall_e_gettimeofday
> +uk_syscall_r_gettimeofday
>   nanosleep
>   setitimer
>   sleep
> diff --git a/lib/uktime/time.c b/lib/uktime/time.c
> index 4d3ba53..e45b6f4 100644
> --- a/lib/uktime/time.c
> +++ b/lib/uktime/time.c
> @@ -43,6 +43,8 @@
>   #include <uk/plat/time.h>
>   #include <uk/config.h>
>   #include <uk/print.h>
> +#include <uk/syscall.h>
> +
>   #if CONFIG_HAVE_SCHED
>   #include <uk/sched.h>
>   #else
> @@ -125,20 +127,40 @@ unsigned int sleep(unsigned int seconds)
>   	return 0;
>   }
>   
> -int gettimeofday(struct timeval *tv, void *tz __unused)
> +long uk_syscall_r_gettimeofday(long tv, long tz __unused)
>   {
>   	__nsec now = ukplat_wall_clock();
>   
>   	if (!tv) {
> -		errno = EINVAL;
> -		return -1;
> +		return -EINVAL;
>   	}
>   
> -	tv->tv_sec = ukarch_time_nsec_to_sec(now);
> -	tv->tv_usec = ukarch_time_nsec_to_usec(ukarch_time_subsec(now));
> +	((struct timeval*) tv)->tv_sec = ukarch_time_nsec_to_sec(now);
> +	((struct timeval*) tv)->tv_usec =
> +		ukarch_time_nsec_to_usec(ukarch_time_subsec(now));
> +
>   	return 0;
>   }
>   
> +long uk_syscall_e_gettimeofday(long tv, long tz __unused)
> +{
> +	long ret;
> +
> +	ret = uk_syscall_r_gettimeofday(tv, tz);
> +	if (ret < 0) {
> +		errno = (int) -ret;
> +		return -1;
> +	}
> +	return 0;
> +}
> +
> +#if !UK_LIBC_SYSCALL
> +int gettimeofday (struct timeval* tv, void* tz __unused)
> +{
> +	return uk_syscall_e_gettimeofday((long) tv, (long)tz);
> +}
> +#endif
> +
>   int clock_getres(clockid_t clk_id __unused, struct timespec *res __unused)
>   {
>   	return 0;
>


From minios-devel-bounces@lists.xenproject.org Thu Dec 03 10:25:40 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Thu, 03 Dec 2020 10:25:40 +0000
Received: from list by lists.xenproject.org with outflank-mailman.43327.77903 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1kklnu-0000Ry-MJ; Thu, 03 Dec 2020 10:25:38 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 43327.77903; Thu, 03 Dec 2020 10:25: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 1kklnu-0000Rr-JS; Thu, 03 Dec 2020 10:25:38 +0000
Received: by outflank-mailman (input) for mailman id 43327;
 Thu, 03 Dec 2020 10:25: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=SiMt=FH=gmail.com=dincadaniel97@srs-us1.protection.inumbo.net>)
 id 1kklns-0000Rm-TI
 for minios-devel@lists.xen.org; Thu, 03 Dec 2020 10:25:36 +0000
Received: from mail-oi1-x242.google.com (unknown [2607:f8b0:4864:20::242])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 9e93ad55-c51c-4175-9ce2-e99db0617138;
 Thu, 03 Dec 2020 10:25:35 +0000 (UTC)
Received: by mail-oi1-x242.google.com with SMTP id t205so1614189oib.12
 for <minios-devel@lists.xen.org>; Thu, 03 Dec 2020 02:25:35 -0800 (PST)
X-BeenThere: minios-devel@lists.xenproject.org
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
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: 9e93ad55-c51c-4175-9ce2-e99db0617138
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=g5rrBBrXbCB/2w0qjGCyzfs7fi9HQ8gT7LHrOFU4s58=;
        b=HAFVQd9iJNwzAlHszXV/zu5k4aij2qVhwmcIHKwgKHEYNf5uyvjRtB7+n/LmK6D0Sg
         W5TrOfNKGsNiqtACIfVJtTUfJq4Dnb/SKG+FyUuJuUyn8obyDDvEhu59l7M9Wwqj8hC5
         RbhNvhPHSvseyx4HC7GngwtAcNdHVLO6fWSfaEdPJC9tTyK3Adhl/3tfb+kRrDJ7+Xho
         UWpsXZ8joo/hp5VsObnlRegQ6nBJXK4+QhE0Fw/NihmkyJBZutVpiKf/B96vZ+hYysRo
         9oL2O6k4XipYwJdhuSxloLoPe5WbgnUDNT7EWR2xwDK1tymPYFec7KlHTQYY7eNPvsIv
         7zog==
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=g5rrBBrXbCB/2w0qjGCyzfs7fi9HQ8gT7LHrOFU4s58=;
        b=FmaopA311Uft///P58Ass0E8QaBOj1BcwT/QpZkMiazUX6LUXEJWky3P4MIxfrsAy4
         ibLjDPQiuT7poRjo1d2Xk0gbPD4H/vHlIQCD0fFBzkWXDrqnCA/YjYxKnGVb10aUDLPN
         Lyq98EFCjx8qBnj1jxUzGFvoGW/qBFHqSenSlx5rfGskPQxYSs+cuDRBUNizfHGCziFc
         5mPHCj0NBrmGNDSpYtG1Bfg75rh+M6WERLq8Lv4r73Kz7uTqpYdAqSKNuFLQtnuUm+I+
         DDh058/gyY2isxkkNo3MyGehIrgBT+d6PpZ3DEQ79HOTyq6NIK0iIQ2DqAfosVS7cMfm
         3s+A==
X-Gm-Message-State: AOAM530syZ9eFQEv31mxKITpcHikmCuRvsofEOOFdWvz+c4oA/nrRvWh
	VEI56i8MrdQN4WIPAsRj2EO+9vj8LX8Oyb28gaybQ9gr3dY=
X-Google-Smtp-Source: ABdhPJzW4Sgp21mTnKeT5pB2gdQQjbhoFfun79rSDelq/zw5iTJ+es++FtpOJUHUa01vWFLO3YIN66pQsnOv/1QpH7k=
X-Received: by 2002:aca:1b0a:: with SMTP id b10mr1310441oib.9.1606991135226;
 Thu, 03 Dec 2020 02:25:35 -0800 (PST)
MIME-Version: 1.0
References: <20201203000342.32175-1-simon.kuenzer@neclab.eu>
In-Reply-To: <20201203000342.32175-1-simon.kuenzer@neclab.eu>
From: Daniel Dinca <dincadaniel97@gmail.com>
Date: Thu, 3 Dec 2020 12:25:24 +0200
Message-ID: <CALjJXS4aYknU15y9xDKFbee3N21co6XimyQtf8PQE6i6UGe1Dw@mail.gmail.com>
Subject: Re: [UNIKRAFT PATCH] lib/syscall_shim: Avoid warning about unused
 system call arguments
To: Simon Kuenzer <simon.kuenzer@neclab.eu>
Cc: minios-devel@lists.xen.org
Content-Type: multipart/alternative; boundary="000000000000c5be4505b58cc7bb"

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

Looks good.

Reviewed-by: Daniel Dinca <dincadaniel97@gmail.com>

=C3=8En joi, 3 dec. 2020 la 02:04, Simon Kuenzer <simon.kuenzer@neclab.eu> =
a
scris:

> Some system call implementations may not use all arguments which causes
> a compiler warning. This commit adds the `__maybe_unused` attribute to
> the arguments when one of the following macros is used for a system call
> implementation: `UK_SYSCALL_DEFINE()`, `UK_LLSYSCALL_DEFINE()`,
> `UK_SYSCALL_R_DEFINE()`, and `UK_LLSYSCALL_R_DEFINE()`.
>
> Signed-off-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
> ---
>  lib/syscall_shim/include/uk/syscall.h | 10 +++++++---
>  1 file changed, 7 insertions(+), 3 deletions(-)
>
> diff --git a/lib/syscall_shim/include/uk/syscall.h
> b/lib/syscall_shim/include/uk/syscall.h
> index ffa9f1ee4..37d7f5f0e 100644
> --- a/lib/syscall_shim/include/uk/syscall.h
> +++ b/lib/syscall_shim/include/uk/syscall.h
> @@ -105,6 +105,8 @@ typedef long uk_syscall_arg_t;
>
>  #define UK_S_ARG_LONG(type, arg)   long arg
>  #define UK_S_ARG_ACTUAL(type, arg) type arg
> +#define UK_S_ARG_LONG_MAYBE_UNUSED(type, arg)   long arg __maybe_unused
> +#define UK_S_ARG_ACTUAL_MAYBE_UNUSED(type, arg) type arg __maybe_unused
>  #define UK_S_ARG_CAST_LONG(type, arg)   (long) arg
>  #define UK_S_ARG_CAST_ACTUAL(type, arg) (type) arg
>
> @@ -139,7 +141,8 @@ typedef long uk_syscall_arg_t;
>                         UK_ARG_MAPx(x, UK_S_ARG_CAST_ACTUAL,
> __VA_ARGS__)); \
>         }                                                               \
>         static inline rtype __##ename(UK_ARG_MAPx(x,                    \
> -                                                 UK_S_ARG_ACTUAL,
> __VA_ARGS__))
> +
>  UK_S_ARG_ACTUAL_MAYBE_UNUSED,\
> +                                                 __VA_ARGS__))
>  #define _UK_LLSYSCALL_DEFINE(...) __UK_LLSYSCALL_DEFINE(__VA_ARGS__)
>  #define UK_LLSYSCALL_DEFINE(rtype, name, ...)                          \
>         _UK_LLSYSCALL_DEFINE(__UK_SYSCALL_DEF_NARGS(__VA_ARGS__),       \
> @@ -208,8 +211,9 @@ typedef long uk_syscall_arg_t;
>                 return (long) __##rname(                                \
>                         UK_ARG_MAPx(x, UK_S_ARG_CAST_ACTUAL,
> __VA_ARGS__)); \
>         }                                                               \
> -       static inline rtype __##rname(UK_ARG_MAPx(x, UK_S_ARG_ACTUAL,   \
> -                                                __VA_ARGS__))
> +       static inline rtype __##rname(UK_ARG_MAPx(x,                    \
> +
>  UK_S_ARG_ACTUAL_MAYBE_UNUSED,\
> +                                                 __VA_ARGS__))
>  #define _UK_LLSYSCALL_R_DEFINE(...) __UK_LLSYSCALL_R_DEFINE(__VA_ARGS__)
>  #define UK_LLSYSCALL_R_DEFINE(rtype, name, ...)
>       \
>         _UK_LLSYSCALL_R_DEFINE(__UK_SYSCALL_DEF_NARGS(__VA_ARGS__),     \
> --
> 2.20.1
>
>

--000000000000c5be4505b58cc7bb
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: base64

PGRpdiBkaXI9Imx0ciI+PGRpdj5Mb29rcyBnb29kLjwvZGl2PjxkaXY+PGJyPjwvZGl2PjxkaXY+
UmV2aWV3ZWQtYnk6IERhbmllbCBEaW5jYSAmbHQ7PGEgaHJlZj0ibWFpbHRvOmRpbmNhZGFuaWVs
OTdAZ21haWwuY29tIiB0YXJnZXQ9Il9ibGFuayI+ZGluY2FkYW5pZWw5N0BnbWFpbC5jb208L2E+
Jmd0Ozxicj48L2Rpdj48YnI+PGRpdiBjbGFzcz0iZ21haWxfcXVvdGUiPjxkaXYgZGlyPSJsdHIi
IGNsYXNzPSJnbWFpbF9hdHRyIj7Djm4gam9pLCAzIGRlYy4gMjAyMCBsYSAwMjowNCwgU2ltb24g
S3VlbnplciAmbHQ7PGEgaHJlZj0ibWFpbHRvOnNpbW9uLmt1ZW56ZXJAbmVjbGFiLmV1IiB0YXJn
ZXQ9Il9ibGFuayI+c2ltb24ua3VlbnplckBuZWNsYWIuZXU8L2E+Jmd0OyBhIHNjcmlzOjxicj48
L2Rpdj48YmxvY2txdW90ZSBjbGFzcz0iZ21haWxfcXVvdGUiIHN0eWxlPSJtYXJnaW46MHB4IDBw
eCAwcHggMC44ZXg7Ym9yZGVyLWxlZnQ6MXB4IHNvbGlkIHJnYigyMDQsMjA0LDIwNCk7cGFkZGlu
Zy1sZWZ0OjFleCI+U29tZSBzeXN0ZW0gY2FsbCBpbXBsZW1lbnRhdGlvbnMgbWF5IG5vdCB1c2Ug
YWxsIGFyZ3VtZW50cyB3aGljaCBjYXVzZXM8YnI+DQphIGNvbXBpbGVyIHdhcm5pbmcuIFRoaXMg
Y29tbWl0IGFkZHMgdGhlIGBfX21heWJlX3VudXNlZGAgYXR0cmlidXRlIHRvPGJyPg0KdGhlIGFy
Z3VtZW50cyB3aGVuIG9uZSBvZiB0aGUgZm9sbG93aW5nIG1hY3JvcyBpcyB1c2VkIGZvciBhIHN5
c3RlbSBjYWxsPGJyPg0KaW1wbGVtZW50YXRpb246IGBVS19TWVNDQUxMX0RFRklORSgpYCwgYFVL
X0xMU1lTQ0FMTF9ERUZJTkUoKWAsPGJyPg0KYFVLX1NZU0NBTExfUl9ERUZJTkUoKWAsIGFuZCBg
VUtfTExTWVNDQUxMX1JfREVGSU5FKClgLjxicj4NCjxicj4NClNpZ25lZC1vZmYtYnk6IFNpbW9u
IEt1ZW56ZXIgJmx0OzxhIGhyZWY9Im1haWx0bzpzaW1vbi5rdWVuemVyQG5lY2xhYi5ldSIgdGFy
Z2V0PSJfYmxhbmsiPnNpbW9uLmt1ZW56ZXJAbmVjbGFiLmV1PC9hPiZndDs8YnI+DQotLS08YnI+
DQrCoGxpYi9zeXNjYWxsX3NoaW0vaW5jbHVkZS91ay9zeXNjYWxsLmggfCAxMCArKysrKysrLS0t
PGJyPg0KwqAxIGZpbGUgY2hhbmdlZCwgNyBpbnNlcnRpb25zKCspLCAzIGRlbGV0aW9ucygtKTxi
cj4NCjxicj4NCmRpZmYgLS1naXQgYS9saWIvc3lzY2FsbF9zaGltL2luY2x1ZGUvdWsvc3lzY2Fs
bC5oIGIvbGliL3N5c2NhbGxfc2hpbS9pbmNsdWRlL3VrL3N5c2NhbGwuaDxicj4NCmluZGV4IGZm
YTlmMWVlNC4uMzdkN2Y1ZjBlIDEwMDY0NDxicj4NCi0tLSBhL2xpYi9zeXNjYWxsX3NoaW0vaW5j
bHVkZS91ay9zeXNjYWxsLmg8YnI+DQorKysgYi9saWIvc3lzY2FsbF9zaGltL2luY2x1ZGUvdWsv
c3lzY2FsbC5oPGJyPg0KQEAgLTEwNSw2ICsxMDUsOCBAQCB0eXBlZGVmIGxvbmcgdWtfc3lzY2Fs
bF9hcmdfdDs8YnI+DQo8YnI+DQrCoCNkZWZpbmUgVUtfU19BUkdfTE9ORyh0eXBlLCBhcmcpwqAg
wqBsb25nIGFyZzxicj4NCsKgI2RlZmluZSBVS19TX0FSR19BQ1RVQUwodHlwZSwgYXJnKSB0eXBl
IGFyZzxicj4NCisjZGVmaW5lIFVLX1NfQVJHX0xPTkdfTUFZQkVfVU5VU0VEKHR5cGUsIGFyZynC
oCDCoGxvbmcgYXJnIF9fbWF5YmVfdW51c2VkPGJyPg0KKyNkZWZpbmUgVUtfU19BUkdfQUNUVUFM
X01BWUJFX1VOVVNFRCh0eXBlLCBhcmcpIHR5cGUgYXJnIF9fbWF5YmVfdW51c2VkPGJyPg0KwqAj
ZGVmaW5lIFVLX1NfQVJHX0NBU1RfTE9ORyh0eXBlLCBhcmcpwqAgwqAobG9uZykgYXJnPGJyPg0K
wqAjZGVmaW5lIFVLX1NfQVJHX0NBU1RfQUNUVUFMKHR5cGUsIGFyZykgKHR5cGUpIGFyZzxicj4N
Cjxicj4NCkBAIC0xMzksNyArMTQxLDggQEAgdHlwZWRlZiBsb25nIHVrX3N5c2NhbGxfYXJnX3Q7
PGJyPg0KwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgVUtfQVJHX01BUHgoeCwg
VUtfU19BUkdfQ0FTVF9BQ1RVQUwsIF9fVkFfQVJHU19fKSk7IFw8YnI+DQrCoCDCoCDCoCDCoCB9
wqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAg
wqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqBcPGJyPg0KwqAgwqAgwqAgwqAg
c3RhdGljIGlubGluZSBydHlwZSBfXyMjZW5hbWUoVUtfQVJHX01BUHgoeCzCoCDCoCDCoCDCoCDC
oCDCoCDCoCDCoCDCoCDCoCBcPGJyPg0KLcKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKg
IMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgVUtfU19BUkdfQUNUVUFM
LCBfX1ZBX0FSR1NfXykpPGJyPg0KK8KgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKg
IMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgVUtfU19BUkdfQUNUVUFMX01B
WUJFX1VOVVNFRCxcPGJyPg0KK8KgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKg
IMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgX19WQV9BUkdTX18pKTxicj4NCsKg
I2RlZmluZSBfVUtfTExTWVNDQUxMX0RFRklORSguLi4pIF9fVUtfTExTWVNDQUxMX0RFRklORShf
X1ZBX0FSR1NfXyk8YnI+DQrCoCNkZWZpbmUgVUtfTExTWVNDQUxMX0RFRklORShydHlwZSwgbmFt
ZSwgLi4uKcKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIFw8YnI+DQrCoCDC
oCDCoCDCoCBfVUtfTExTWVNDQUxMX0RFRklORShfX1VLX1NZU0NBTExfREVGX05BUkdTKF9fVkFf
QVJHU19fKSzCoCDCoCDCoCDCoFw8YnI+DQpAQCAtMjA4LDggKzIxMSw5IEBAIHR5cGVkZWYgbG9u
ZyB1a19zeXNjYWxsX2FyZ190Ozxicj4NCsKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIHJldHVybiAo
bG9uZykgX18jI3JuYW1lKMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKg
IMKgIMKgIFw8YnI+DQrCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCBVS19BUkdf
TUFQeCh4LCBVS19TX0FSR19DQVNUX0FDVFVBTCwgX19WQV9BUkdTX18pKTsgXDxicj4NCsKgIMKg
IMKgIMKgIH3CoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDC
oCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoFw8YnI+DQotwqAg
wqAgwqAgwqBzdGF0aWMgaW5saW5lIHJ0eXBlIF9fIyNybmFtZShVS19BUkdfTUFQeCh4LCBVS19T
X0FSR19BQ1RVQUwswqAgwqBcPGJyPg0KLcKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKg
IMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIF9fVkFfQVJHU19fKSk8YnI+
DQorwqAgwqAgwqAgwqBzdGF0aWMgaW5saW5lIHJ0eXBlIF9fIyNybmFtZShVS19BUkdfTUFQeCh4
LMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIFw8YnI+DQorwqAgwqAgwqAgwqAgwqAgwqAg
wqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqBV
S19TX0FSR19BQ1RVQUxfTUFZQkVfVU5VU0VELFw8YnI+DQorwqAgwqAgwqAgwqAgwqAgwqAgwqAg
wqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqBfX1ZB
X0FSR1NfXykpPGJyPg0KwqAjZGVmaW5lIF9VS19MTFNZU0NBTExfUl9ERUZJTkUoLi4uKSBfX1VL
X0xMU1lTQ0FMTF9SX0RFRklORShfX1ZBX0FSR1NfXyk8YnI+DQrCoCNkZWZpbmUgVUtfTExTWVND
QUxMX1JfREVGSU5FKHJ0eXBlLCBuYW1lLCAuLi4pwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAg
wqAgwqAgwqAgwqAgwqAgwqAgwqAgXDxicj4NCsKgIMKgIMKgIMKgIF9VS19MTFNZU0NBTExfUl9E
RUZJTkUoX19VS19TWVNDQUxMX0RFRl9OQVJHUyhfX1ZBX0FSR1NfXykswqAgwqAgwqBcPGJyPg0K
LS0gPGJyPg0KMi4yMC4xPGJyPg0KPGJyPg0KPC9ibG9ja3F1b3RlPjwvZGl2PjwvZGl2Pg0K
--000000000000c5be4505b58cc7bb--


From minios-devel-bounces@lists.xenproject.org Thu Dec 03 11:17:02 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Thu, 03 Dec 2020 11:17:02 +0000
Received: from list by lists.xenproject.org with outflank-mailman.43335.77907 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1kkmbZ-00058M-Bd; Thu, 03 Dec 2020 11:16:57 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 43335.77907; Thu, 03 Dec 2020 11:16: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 1kkmbZ-00058F-8q; Thu, 03 Dec 2020 11:16:57 +0000
Received: by outflank-mailman (input) for mailman id 43335;
 Thu, 03 Dec 2020 11:16:56 +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=dY1J=FH=owl.eu.com=hle@srs-us1.protection.inumbo.net>)
 id 1kkmbY-00058A-6U
 for minios-devel@lists.xenproject.org; Thu, 03 Dec 2020 11:16:56 +0000
Received: from relay2-d.mail.gandi.net (unknown [217.70.183.194])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id ecc3831e-db1c-47e7-bfb0-a8de6b39f26a;
 Thu, 03 Dec 2020 11:16:54 +0000 (UTC)
Received: from localhost (88-145-216-252.host.pobb.as13285.net
 [88.145.216.252]) (Authenticated sender: hle@owl.eu.com)
 by relay2-d.mail.gandi.net (Postfix) with ESMTPSA id 5FDCB40003;
 Thu,  3 Dec 2020 11:16:52 +0000 (UTC)
X-BeenThere: minios-devel@lists.xenproject.org
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
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: ecc3831e-db1c-47e7-bfb0-a8de6b39f26a
X-Originating-IP: 88.145.216.252
From: Hugo Lefeuvre <hle@owl.eu.com>
To: minios-devel@lists.xenproject.org
Cc: Hugo Lefeuvre <hugo.lefeuvre@owl.eu.com>
Subject: [UNIKRAFT PATCH 0/2] support PKE on x86
Date: Thu,  3 Dec 2020 11:16:35 +0000
Message-Id: <cover.1606992954.git.hugo.lefeuvre@manchester.ac.uk>
X-Mailer: git-send-email 2.29.2
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit

From: Hugo Lefeuvre <hugo.lefeuvre@owl.eu.com>

Hi,

There is an ongoing work to support memory protection keys (MPK, also referred
to as protection keys userspace -- PKU) in Unikraft.

Full support will be achieved by:
(1) detecting the availability of PKU and enabling it via CR4
(2) supporting PKU-related protection changes in the page table
(3) supporting PKU-swap during thread context switches
(4) defining an new interface/microlib to facilitate the use of MPKs

This patch implements (1) as a first step towards a full support of memory
protection keys in the main tree.

This patch is independent from (2)-(4) and can already be merged as-is.

It has been tested thoroughly: (2)-(4) are already implemented and tested, but
cannot be merged immediately since they are based on top of the yet to come
page table support series.

More details regarding the implementation:

Since we do not want to pay the cost of MPK-related code when MPK is not
enabled, we introduce a new HAVE_X86PKU property; MPK code is compile-guarded
so that it does not get compiled in without HAVE_X86PKU. HAVE_X86PKU will be
set by PKU kernel libraries later on (this is step (4)).

At boot time, if HAVE_X86PKU is enabled, the kernel now checks whether PKU is
advertised by cpuid. If yes, it enables it by setting bit 22 (PKE) in CR4.  If
not, it aborts the boot process (the underlying idea is that images compiled
with HAVE_X86PKU are *specialized* to be executed on PKU-enabled hardware).

Hugo Lefeuvre (2):
  plat/kvm: support PKE bit on x86
  plat/xen: support PKE bit on x86

 lib/Config.uk                      |  4 ++++
 plat/common/include/x86/cpu.h      | 15 +++++++++++++++
 plat/common/include/x86/cpu_defs.h |  3 +++
 plat/kvm/x86/entry64.S             | 12 ++++++++++++
 plat/kvm/x86/setup.c               |  4 ++++
 plat/xen/x86/entry64.S             |  9 +++++++++
 plat/xen/x86/setup.c               |  4 ++++
 7 files changed, 51 insertions(+)

-- 
2.20.1



From minios-devel-bounces@lists.xenproject.org Thu Dec 03 11:17:21 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Thu, 03 Dec 2020 11:17:21 +0000
Received: from list by lists.xenproject.org with outflank-mailman.43336.77912 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1kkmbx-00059Y-EQ; Thu, 03 Dec 2020 11:17:21 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 43336.77912; Thu, 03 Dec 2020 11:17:21 +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 1kkmbx-00059R-BB; Thu, 03 Dec 2020 11:17:21 +0000
Received: by outflank-mailman (input) for mailman id 43336;
 Thu, 03 Dec 2020 11:17: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=dY1J=FH=owl.eu.com=hle@srs-us1.protection.inumbo.net>)
 id 1kkmbv-00059I-Js
 for minios-devel@lists.xenproject.org; Thu, 03 Dec 2020 11:17:19 +0000
Received: from relay4-d.mail.gandi.net (unknown [217.70.183.196])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 0bfab59c-c7e2-4f97-bff0-edc433cb0264;
 Thu, 03 Dec 2020 11:17:16 +0000 (UTC)
Received: from localhost (88-145-216-252.host.pobb.as13285.net
 [88.145.216.252]) (Authenticated sender: hle@owl.eu.com)
 by relay4-d.mail.gandi.net (Postfix) with ESMTPSA id E07F5E0010;
 Thu,  3 Dec 2020 11:17:14 +0000 (UTC)
X-BeenThere: minios-devel@lists.xenproject.org
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
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: 0bfab59c-c7e2-4f97-bff0-edc433cb0264
X-Originating-IP: 88.145.216.252
From: Hugo Lefeuvre <hle@owl.eu.com>
To: minios-devel@lists.xenproject.org
Cc: Hugo Lefeuvre <hugo.lefeuvre@owl.eu.com>,
	Hugo Lefeuvre <hugo.lefeuvre@manchester.ac.uk>
Subject: [UNIKRAFT PATCH 1/2] plat/kvm: support PKE bit on x86
Date: Thu,  3 Dec 2020 11:16:36 +0000
Message-Id: <b5b87c3a0d2f6026b9b2275eeaff3a5e5a899180.1606992954.git.hugo.lefeuvre@manchester.ac.uk>
X-Mailer: git-send-email 2.29.2
In-Reply-To: <cover.1606992954.git.hugo.lefeuvre@manchester.ac.uk>
References: <cover.1606992954.git.hugo.lefeuvre@manchester.ac.uk>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit

From: Hugo Lefeuvre <hugo.lefeuvre@owl.eu.com>

Provided that PKU is advertised by cpuid (EAX=7, ECX=0, EXC bit 3),
Memory Protection Keys can be enabled by setting bit 22 (PKE) in CR4.

Since we do not want to pay the cost of MPK-related code when MPK is
not enabled, we introduce a new HAVE_X86PKU property; MPK code is
compile-guarded so that it does not get compiled in without
HAVE_X86PKU. HAVE_X86PKU will be set by PKU kernel libraries later on.

At boot time, if HAVE_X86PKU is enabled, the kernel now checks whether
PKU is advertised by cpuid. If not, it aborts the boot process. The
underlying idea is that images compiled with HAVE_X86PKU are
*specialized* to be executed on PKU-enabled hardware. Hence, provided
that HAVE_X86PKU is set, there is a guarantee that PKU is supported
*and* enabled, effectively removing the need for checks later at
runtime. This might benefit performance when the domain switching rate
is high.

Signed-off-by: Hugo Lefeuvre <hugo.lefeuvre@manchester.ac.uk>
---
 lib/Config.uk                      |  4 ++++
 plat/common/include/x86/cpu.h      | 15 +++++++++++++++
 plat/common/include/x86/cpu_defs.h |  3 +++
 plat/kvm/x86/entry64.S             | 12 ++++++++++++
 plat/kvm/x86/setup.c               |  4 ++++
 5 files changed, 38 insertions(+)

diff --git a/lib/Config.uk b/lib/Config.uk
index e83ed30b..dac2d2fa 100644
--- a/lib/Config.uk
+++ b/lib/Config.uk
@@ -28,3 +28,7 @@ config HAVE_NW_STACK
 config HAVE_SYSCALL
        bool
        default n
+
+config HAVE_X86PKU
+	bool
+	default n
diff --git a/plat/common/include/x86/cpu.h b/plat/common/include/x86/cpu.h
index 5f1a35e4..d4c02e08 100644
--- a/plat/common/include/x86/cpu.h
+++ b/plat/common/include/x86/cpu.h
@@ -341,4 +341,19 @@ static inline void _init_syscall(void)
 }
 #endif /* CONFIG_HAVE_SYSCALL */
 
+#if CONFIG_HAVE_X86PKU
+static inline void _check_ospke(void)
+{
+	__u32 eax, ebx, ecx, edx;
+	cpuid(0x7, 0, &eax, &ebx, &ecx, &edx);
+	if (!(ecx & X86_CPUID7_ECX_OSPKE)) {
+		/* if PKU is not enabled, abort the boot process. Images
+		 * compiled with HAVE_X86PKU are *specialized* to be executed on
+		 * PKU-enabled hardware. This allows us to avoid checks later at
+		 * runtime. */
+		UK_CRASH("CPU does not support PKU!\n");
+	}
+}
+#endif /* CONFIG_HAVE_X86PKU */
+
 #endif /* __PLAT_COMMON_X86_CPU_H__ */
diff --git a/plat/common/include/x86/cpu_defs.h b/plat/common/include/x86/cpu_defs.h
index dcbe2c65..74cff459 100644
--- a/plat/common/include/x86/cpu_defs.h
+++ b/plat/common/include/x86/cpu_defs.h
@@ -71,6 +71,7 @@
 #define X86_CR4_OSXMMEXCPT      (1 << 10)   /* OS support for FP exceptions */
 #define X86_CR4_FSGSBASE        (1 << 16)   /* enable FSGSBASE*/
 #define X86_CR4_OSXSAVE         (1 << 18)   /* enable XSAVE, extended states */
+#define X86_CR4_PKE             (1 << 22)   /* enable protection keys */
 
 /*
  * Intel CPU features in EFER
@@ -86,6 +87,8 @@
 #define X86_CPUID1_EDX_SSE      (1 << 25)
 /* CPUID feature bits in EBX and ECX when EAX=7, ECX=0 */
 #define X86_CPUID7_EBX_FSGSBASE (1 << 0)
+#define X86_CPUID7_ECX_PKU	(1 << 3)
+#define X86_CPUID7_ECX_OSPKE	(1 << 4)
 /* CPUID feature bits when EAX=0xd, ECX=1 */
 #define X86_CPUIDD1_EAX_XSAVEOPT (1<<0)
 /* CPUID 80000001H:EDX feature list */
diff --git a/plat/kvm/x86/entry64.S b/plat/kvm/x86/entry64.S
index 169f4c82..ef5e0e77 100644
--- a/plat/kvm/x86/entry64.S
+++ b/plat/kvm/x86/entry64.S
@@ -31,6 +31,9 @@
 #include <kvm-x86/traps.h>
 #include <kvm-x86/multiboot_defs.h>
 
+/* necessary for CONFIG_ macros to be accessible */
+#include <uk/config.h>
+
 #define ENTRY(x) .globl x; .type x,%function; x:
 #define END(x)   .size x, . - x
 
@@ -227,6 +230,15 @@ noxsave:
 	orl $(X86_CR4_FSGSBASE), %edi
 	movq %rdi, %cr4
 nofsgsbase:
+#if CONFIG_HAVE_X86PKU
+	/* check for Memory Protection Keys (PKU) */
+	testl $(X86_CPUID7_ECX_PKU), %ecx
+	jz nopku
+	/* if PKU is supported, enable it via CR4 */
+	orl $(X86_CR4_PKE), %edi
+	movq %rdi, %cr4
+nopku:
+#endif /* CONFIG_HAVE_X86PKU */
 	/* done setting up CPU capabilities */
 
 	/* read multiboot info pointer */
diff --git a/plat/kvm/x86/setup.c b/plat/kvm/x86/setup.c
index 284ec793..e8c44a93 100644
--- a/plat/kvm/x86/setup.c
+++ b/plat/kvm/x86/setup.c
@@ -329,6 +329,10 @@ void _libkvmplat_entry(void *arg)
 	_init_syscall();
 #endif /* CONFIG_HAVE_SYSCALL */
 
+#if CONFIG_HAVE_X86PKU
+	_check_ospke();
+#endif /* CONFIG_HAVE_X86PKU */
+
 	/*
 	 * Switch away from the bootstrap stack as early as possible.
 	 */
-- 
2.20.1



From minios-devel-bounces@lists.xenproject.org Thu Dec 03 11:17:23 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Thu, 03 Dec 2020 11:17:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.43337.77916 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1kkmbz-0005AL-Fw; Thu, 03 Dec 2020 11:17:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 43337.77916; Thu, 03 Dec 2020 11:17: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 1kkmbz-0005AE-Ck; Thu, 03 Dec 2020 11:17:23 +0000
Received: by outflank-mailman (input) for mailman id 43337;
 Thu, 03 Dec 2020 11:17: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=dY1J=FH=owl.eu.com=hle@srs-us1.protection.inumbo.net>)
 id 1kkmbx-00059y-Ko
 for minios-devel@lists.xenproject.org; Thu, 03 Dec 2020 11:17:21 +0000
Received: from relay9-d.mail.gandi.net (unknown [217.70.183.199])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 01fd0d4c-6557-4834-89cd-732e40d85df7;
 Thu, 03 Dec 2020 11:17:20 +0000 (UTC)
Received: from localhost (88-145-216-252.host.pobb.as13285.net
 [88.145.216.252]) (Authenticated sender: hle@owl.eu.com)
 by relay9-d.mail.gandi.net (Postfix) with ESMTPSA id 2493AFF803;
 Thu,  3 Dec 2020 11:17:17 +0000 (UTC)
X-BeenThere: minios-devel@lists.xenproject.org
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
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: 01fd0d4c-6557-4834-89cd-732e40d85df7
X-Originating-IP: 88.145.216.252
From: Hugo Lefeuvre <hle@owl.eu.com>
To: minios-devel@lists.xenproject.org
Cc: Hugo Lefeuvre <hugo.lefeuvre@owl.eu.com>,
	Hugo Lefeuvre <hugo.lefeuvre@manchester.ac.uk>
Subject: [UNIKRAFT PATCH 2/2] plat/xen: support PKE bit on x86
Date: Thu,  3 Dec 2020 11:16:37 +0000
Message-Id: <4a43cbdde90fd528d6f86b943938e7bbc2a9dfac.1606992954.git.hugo.lefeuvre@manchester.ac.uk>
X-Mailer: git-send-email 2.29.2
In-Reply-To: <cover.1606992954.git.hugo.lefeuvre@manchester.ac.uk>
References: <cover.1606992954.git.hugo.lefeuvre@manchester.ac.uk>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit

From: Hugo Lefeuvre <hugo.lefeuvre@owl.eu.com>

Signed-off-by: Hugo Lefeuvre <hugo.lefeuvre@manchester.ac.uk>
---
 plat/xen/x86/entry64.S | 9 +++++++++
 plat/xen/x86/setup.c   | 4 ++++
 2 files changed, 13 insertions(+)

diff --git a/plat/xen/x86/entry64.S b/plat/xen/x86/entry64.S
index ae118e1d..c1bee635 100644
--- a/plat/xen/x86/entry64.S
+++ b/plat/xen/x86/entry64.S
@@ -115,6 +115,15 @@ noxsave:
 	orl $(X86_CR4_FSGSBASE), %edi
 	movq %rdi, %cr4
 nofsgsbase:
+#if CONFIG_HAVE_X86PKU
+	/* check for Memory Protection Keys (PKU) */
+	testl $(X86_CPUID7_ECX_PKU), %ecx
+	jz nopku
+	/* if PKU is supported, enable it via CR4 */
+	orl $(X86_CR4_PKE), %edi
+	movq %rdi, %cr4
+nopku:
+#endif /* CONFIG_HAVE_X86PKU */
 	/* Done setting up CPU capabilities, hand over to C entry point. */
 	movq %r8, %rdi /* pass pointer to start_info page to C entry */
 	call _libxenplat_x86entry
diff --git a/plat/xen/x86/setup.c b/plat/xen/x86/setup.c
index ebe99328..e5d51b32 100644
--- a/plat/xen/x86/setup.c
+++ b/plat/xen/x86/setup.c
@@ -211,5 +211,9 @@ void _libxenplat_x86entry(void *start_info)
 
 	init_console();
 
+#if CONFIG_HAVE_X86PKU
+	_check_ospke();
+#endif /* CONFIG_HAVE_X86PKU */
+
 	ukplat_entry_argp(CONFIG_UK_NAME, cmdline, MAX_GUEST_CMDLINE);
 }
-- 
2.20.1



From minios-devel-bounces@lists.xenproject.org Thu Dec 03 11:18:16 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Thu, 03 Dec 2020 11:18:16 +0000
Received: from list by lists.xenproject.org with outflank-mailman.43342.77920 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1kkmcp-0005Ee-JF; Thu, 03 Dec 2020 11:18:15 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 43342.77920; Thu, 03 Dec 2020 11:18:15 +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 1kkmcp-0005EX-GE; Thu, 03 Dec 2020 11:18:15 +0000
Received: by outflank-mailman (input) for mailman id 43342;
 Thu, 03 Dec 2020 11:18: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=dY1J=FH=owl.eu.com=hle@srs-us1.protection.inumbo.net>)
 id 1kkmcn-0005ES-SP
 for minios-devel@lists.xenproject.org; Thu, 03 Dec 2020 11:18:13 +0000
Received: from relay1-d.mail.gandi.net (unknown [217.70.183.193])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id d9ddeb55-72e2-4df5-8178-bcf4521ae1ea;
 Thu, 03 Dec 2020 11:18:11 +0000 (UTC)
Received: from localhost (88-145-216-252.host.pobb.as13285.net
 [88.145.216.252]) (Authenticated sender: hle@owl.eu.com)
 by relay1-d.mail.gandi.net (Postfix) with ESMTPSA id ECF6D240013;
 Thu,  3 Dec 2020 11:18:09 +0000 (UTC)
X-BeenThere: minios-devel@lists.xenproject.org
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
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: d9ddeb55-72e2-4df5-8178-bcf4521ae1ea
X-Originating-IP: 88.145.216.252
From: Hugo Lefeuvre <hle@owl.eu.com>
To: minios-devel@lists.xenproject.org
Cc: Hugo Lefeuvre <hugo.lefeuvre@owl.eu.com>
Subject: [UNIKRAFT PATCH 0/2] support PKE on x86
Date: Thu,  3 Dec 2020 11:18:05 +0000
Message-Id: <cover.1606992954.git.hugo.lefeuvre@manchester.ac.uk>
X-Mailer: git-send-email 2.29.2
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit

From: Hugo Lefeuvre <hugo.lefeuvre@owl.eu.com>

Hi,

There is an ongoing work to support memory protection keys (MPK, also referred
to as protection keys userspace -- PKU) in Unikraft.

Full support will be achieved by:
(1) detecting the availability of PKU and enabling it via CR4
(2) supporting PKU-related protection changes in the page table
(3) supporting PKU-swap during thread context switches
(4) defining an new interface/microlib to facilitate the use of MPKs

This patch implements (1) as a first step towards a full support of memory
protection keys in the main tree.

This patch is independent from (2)-(4) and can already be merged as-is.

It has been tested thoroughly: (2)-(4) are already implemented and tested, but
cannot be merged immediately since they are based on top of the yet to come
page table support series.

More details regarding the implementation:

Since we do not want to pay the cost of MPK-related code when MPK is not
enabled, we introduce a new HAVE_X86PKU property; MPK code is compile-guarded
so that it does not get compiled in without HAVE_X86PKU. HAVE_X86PKU will be
set by PKU kernel libraries later on (this is step (4)).

At boot time, if HAVE_X86PKU is enabled, the kernel now checks whether PKU is
advertised by cpuid. If yes, it enables it by setting bit 22 (PKE) in CR4.  If
not, it aborts the boot process (the underlying idea is that images compiled
with HAVE_X86PKU are *specialized* to be executed on PKU-enabled hardware).

Hugo Lefeuvre (2):
  plat/kvm: support PKE bit on x86
  plat/xen: support PKE bit on x86

 lib/Config.uk                      |  4 ++++
 plat/common/include/x86/cpu.h      | 15 +++++++++++++++
 plat/common/include/x86/cpu_defs.h |  3 +++
 plat/kvm/x86/entry64.S             | 12 ++++++++++++
 plat/kvm/x86/setup.c               |  4 ++++
 plat/xen/x86/entry64.S             |  9 +++++++++
 plat/xen/x86/setup.c               |  4 ++++
 7 files changed, 51 insertions(+)

-- 
2.20.1



From minios-devel-bounces@lists.xenproject.org Thu Dec 03 11:23:14 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Thu, 03 Dec 2020 11:23:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.43352.77938 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1kkmhe-0006Cr-FK; Thu, 03 Dec 2020 11:23:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 43352.77938; Thu, 03 Dec 2020 11:23: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 1kkmhe-0006Ck-CG; Thu, 03 Dec 2020 11:23:14 +0000
Received: by outflank-mailman (input) for mailman id 43352;
 Thu, 03 Dec 2020 11:23:13 +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=dY1J=FH=owl.eu.com=hle@srs-us1.protection.inumbo.net>)
 id 1kkmhd-0006Ce-6k
 for minios-devel@lists.xenproject.org; Thu, 03 Dec 2020 11:23:13 +0000
Received: from relay4-d.mail.gandi.net (unknown [217.70.183.196])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id fa3693b8-b445-432a-9cbe-557673abff13;
 Thu, 03 Dec 2020 11:23:12 +0000 (UTC)
Received: from localhost (88-145-216-252.host.pobb.as13285.net
 [88.145.216.252]) (Authenticated sender: hle@owl.eu.com)
 by relay4-d.mail.gandi.net (Postfix) with ESMTPSA id D8449E000E;
 Thu,  3 Dec 2020 11:23:10 +0000 (UTC)
X-BeenThere: minios-devel@lists.xenproject.org
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
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: fa3693b8-b445-432a-9cbe-557673abff13
X-Originating-IP: 88.145.216.252
Date: Thu, 3 Dec 2020 11:23:10 +0000
From: Hugo Lefeuvre <hle@owl.eu.com>
To: minios-devel@lists.xenproject.org
Cc: Hugo Lefeuvre <hugo.lefeuvre@manchester.ac.uk>
Subject: Re: [UNIKRAFT PATCH 1/2] plat/kvm: support PKE bit on x86
Message-ID: <20201203112310.xh2ydavrynwmluej@behemoth.owl.eu.com.local>
References: <cover.1606992954.git.hugo.lefeuvre@manchester.ac.uk>
 <b5b87c3a0d2f6026b9b2275eeaff3a5e5a899180.1606992954.git.hugo.lefeuvre@manchester.ac.uk>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <b5b87c3a0d2f6026b9b2275eeaff3a5e5a899180.1606992954.git.hugo.lefeuvre@manchester.ac.uk>

On Thu, Dec 03, 2020 at 11:16:36AM +0000, Hugo Lefeuvre wrote:
> From: Hugo Lefeuvre <hugo.lefeuvre@owl.eu.com>

My bad, this from should not be there. I can resend after the review, or we
can remove it while upstreaming.

> Provided that PKU is advertised by cpuid (EAX=7, ECX=0, EXC bit 3),
> Memory Protection Keys can be enabled by setting bit 22 (PKE) in CR4.
> 
> Since we do not want to pay the cost of MPK-related code when MPK is
> not enabled, we introduce a new HAVE_X86PKU property; MPK code is
> compile-guarded so that it does not get compiled in without
> HAVE_X86PKU. HAVE_X86PKU will be set by PKU kernel libraries later on.
> 
> At boot time, if HAVE_X86PKU is enabled, the kernel now checks whether
> PKU is advertised by cpuid. If not, it aborts the boot process. The
> underlying idea is that images compiled with HAVE_X86PKU are
> *specialized* to be executed on PKU-enabled hardware. Hence, provided
> that HAVE_X86PKU is set, there is a guarantee that PKU is supported
> *and* enabled, effectively removing the need for checks later at
> runtime. This might benefit performance when the domain switching rate
> is high.
> 
> Signed-off-by: Hugo Lefeuvre <hugo.lefeuvre@manchester.ac.uk>
> ---
>  lib/Config.uk                      |  4 ++++
>  plat/common/include/x86/cpu.h      | 15 +++++++++++++++
>  plat/common/include/x86/cpu_defs.h |  3 +++
>  plat/kvm/x86/entry64.S             | 12 ++++++++++++
>  plat/kvm/x86/setup.c               |  4 ++++
>  5 files changed, 38 insertions(+)
> 
> diff --git a/lib/Config.uk b/lib/Config.uk
> index e83ed30b..dac2d2fa 100644
> --- a/lib/Config.uk
> +++ b/lib/Config.uk
> @@ -28,3 +28,7 @@ config HAVE_NW_STACK
>  config HAVE_SYSCALL
>         bool
>         default n
> +
> +config HAVE_X86PKU
> +	bool
> +	default n
> diff --git a/plat/common/include/x86/cpu.h b/plat/common/include/x86/cpu.h
> index 5f1a35e4..d4c02e08 100644
> --- a/plat/common/include/x86/cpu.h
> +++ b/plat/common/include/x86/cpu.h
> @@ -341,4 +341,19 @@ static inline void _init_syscall(void)
>  }
>  #endif /* CONFIG_HAVE_SYSCALL */
>  
> +#if CONFIG_HAVE_X86PKU
> +static inline void _check_ospke(void)
> +{
> +	__u32 eax, ebx, ecx, edx;
> +	cpuid(0x7, 0, &eax, &ebx, &ecx, &edx);
> +	if (!(ecx & X86_CPUID7_ECX_OSPKE)) {
> +		/* if PKU is not enabled, abort the boot process. Images
> +		 * compiled with HAVE_X86PKU are *specialized* to be executed on
> +		 * PKU-enabled hardware. This allows us to avoid checks later at
> +		 * runtime. */
> +		UK_CRASH("CPU does not support PKU!\n");
> +	}
> +}
> +#endif /* CONFIG_HAVE_X86PKU */
> +
>  #endif /* __PLAT_COMMON_X86_CPU_H__ */
> diff --git a/plat/common/include/x86/cpu_defs.h b/plat/common/include/x86/cpu_defs.h
> index dcbe2c65..74cff459 100644
> --- a/plat/common/include/x86/cpu_defs.h
> +++ b/plat/common/include/x86/cpu_defs.h
> @@ -71,6 +71,7 @@
>  #define X86_CR4_OSXMMEXCPT      (1 << 10)   /* OS support for FP exceptions */
>  #define X86_CR4_FSGSBASE        (1 << 16)   /* enable FSGSBASE*/
>  #define X86_CR4_OSXSAVE         (1 << 18)   /* enable XSAVE, extended states */
> +#define X86_CR4_PKE             (1 << 22)   /* enable protection keys */
>  
>  /*
>   * Intel CPU features in EFER
> @@ -86,6 +87,8 @@
>  #define X86_CPUID1_EDX_SSE      (1 << 25)
>  /* CPUID feature bits in EBX and ECX when EAX=7, ECX=0 */
>  #define X86_CPUID7_EBX_FSGSBASE (1 << 0)
> +#define X86_CPUID7_ECX_PKU	(1 << 3)
> +#define X86_CPUID7_ECX_OSPKE	(1 << 4)
>  /* CPUID feature bits when EAX=0xd, ECX=1 */
>  #define X86_CPUIDD1_EAX_XSAVEOPT (1<<0)
>  /* CPUID 80000001H:EDX feature list */
> diff --git a/plat/kvm/x86/entry64.S b/plat/kvm/x86/entry64.S
> index 169f4c82..ef5e0e77 100644
> --- a/plat/kvm/x86/entry64.S
> +++ b/plat/kvm/x86/entry64.S
> @@ -31,6 +31,9 @@
>  #include <kvm-x86/traps.h>
>  #include <kvm-x86/multiboot_defs.h>
>  
> +/* necessary for CONFIG_ macros to be accessible */
> +#include <uk/config.h>
> +
>  #define ENTRY(x) .globl x; .type x,%function; x:
>  #define END(x)   .size x, . - x
>  
> @@ -227,6 +230,15 @@ noxsave:
>  	orl $(X86_CR4_FSGSBASE), %edi
>  	movq %rdi, %cr4
>  nofsgsbase:
> +#if CONFIG_HAVE_X86PKU
> +	/* check for Memory Protection Keys (PKU) */
> +	testl $(X86_CPUID7_ECX_PKU), %ecx
> +	jz nopku
> +	/* if PKU is supported, enable it via CR4 */
> +	orl $(X86_CR4_PKE), %edi
> +	movq %rdi, %cr4
> +nopku:
> +#endif /* CONFIG_HAVE_X86PKU */
>  	/* done setting up CPU capabilities */
>  
>  	/* read multiboot info pointer */
> diff --git a/plat/kvm/x86/setup.c b/plat/kvm/x86/setup.c
> index 284ec793..e8c44a93 100644
> --- a/plat/kvm/x86/setup.c
> +++ b/plat/kvm/x86/setup.c
> @@ -329,6 +329,10 @@ void _libkvmplat_entry(void *arg)
>  	_init_syscall();
>  #endif /* CONFIG_HAVE_SYSCALL */
>  
> +#if CONFIG_HAVE_X86PKU
> +	_check_ospke();
> +#endif /* CONFIG_HAVE_X86PKU */
> +
>  	/*
>  	 * Switch away from the bootstrap stack as early as possible.
>  	 */
> -- 
> 2.20.1
> 
> 

-- 
                Hugo Lefeuvre (hle)    |    www.owl.eu.com
RSA4096_ 360B 03B3 BF27 4F4D 7A3F D5E8 14AA 1EB8 A247 3DFD
ed25519_ 37B2 6D38 0B25 B8A2 6B9F 3A65 A36F 5357 5F2D DC4C


From minios-devel-bounces@lists.xenproject.org Thu Dec 03 11:42:33 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Thu, 03 Dec 2020 11:42:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.43370.77966 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1kkn0K-0008HF-DJ; Thu, 03 Dec 2020 11:42:32 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 43370.77966; Thu, 03 Dec 2020 11:42: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 1kkn0K-0008H8-AT; Thu, 03 Dec 2020 11:42:32 +0000
Received: by outflank-mailman (input) for mailman id 43370;
 Thu, 03 Dec 2020 11:42: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=nr/x=FH=upb.ro=vlad_andrei.badoiu@srs-us1.protection.inumbo.net>)
 id 1kkn0I-0008H3-48
 for minios-devel@lists.xenproject.org; Thu, 03 Dec 2020 11:42:30 +0000
Received: from mx.upb.ro (unknown [141.85.13.200])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id a1f25f50-3e29-4646-9349-4c33d1d410a7;
 Thu, 03 Dec 2020 11:42:25 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
 by mx.upb.ro (Postfix) with ESMTP id 6E723B561CBF;
 Thu,  3 Dec 2020 13:42:24 +0200 (EET)
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 T6jzIaI0fxQ5; Thu,  3 Dec 2020 13:42:22 +0200 (EET)
Received: from localhost (localhost [127.0.0.1])
 by mx.upb.ro (Postfix) with ESMTP id AD8FCB561D12;
 Thu,  3 Dec 2020 13:42:22 +0200 (EET)
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 Z4zBCLhLMTXJ; Thu,  3 Dec 2020 13:42:22 +0200 (EET)
Received: from [10.157.58.229] (unknown [213.233.110.199])
 by mx.upb.ro (Postfix) with ESMTPSA id 5BB54B561CBF;
 Thu,  3 Dec 2020 13:42:22 +0200 (EET)
X-BeenThere: minios-devel@lists.xenproject.org
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
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: a1f25f50-3e29-4646-9349-4c33d1d410a7
DKIM-Filter: OpenDKIM Filter v2.10.3 mx.upb.ro AD8FCB561D12
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=upb.ro;
	s=96342B8A-77E4-11E5-BA93-D93D0963A2DF; t=1606995742;
	bh=cQw4o4CdORzLziBqFneLZX84ijjaOdmqlVxxWuyEO3A=;
	h=Date:Message-ID:From:To:MIME-Version;
	b=cbJ20onFGjysyQ/eCmrQN4TBF7smEQtZyAtw5qGc+Yc4veNS3t4rVLS2crxzr9//P
	 dGF65iHGZnOtoEx/A9MI1NPjQ2216VEaxF8/u/lI1G6ae+Z0dqmInesTTtaWbmRNBe
	 lzccjCceZPNQGE5Y2bI+4ePS4CKCGCyRIJ4BuZPM=
X-Virus-Scanned: amavisd-new at upb.ro
Date: Thu, 03 Dec 2020 13:42:20 +0200
Subject: Re: Doubts about use the Unikraft in NVIDIA Jetson Nano
Message-ID: <bd56599e-5436-47cc-911c-da06366644ab@email.android.com>
X-Android-Message-ID: <bd56599e-5436-47cc-911c-da06366644ab@email.android.com>
In-Reply-To: <CANkJ_md70czyRjNETxkxE2Ri6=3DihJSyxPVc7bpJ4kD-icaaQ@mail.gmail.com>
From: vlad_andrei.badoiu@upb.ro
To: Rodrigo Ferraz Azevedo <rodrigoferrazazevedo@gmail.com>
Cc: minios-devel@lists.xenproject.org
Importance: Normal
X-Priority: 3
X-MSMail-Priority: Normal
MIME-Version: 1.0
Content-Type: text/html; charset=utf-8
Content-Transfer-Encoding: base64

PGRpdiBkaXI9J2F1dG8nPjxkaXY+SGksPC9kaXY+PGRpdiBkaXI9ImF1dG8iPjxicj48L2Rpdj48
ZGl2IGRpcj0iYXV0byI+WW91IHNlZW0gdG8gYmUgY29uZmlndXJpbmcgaXQgZm9yIDg2XzY0IGFu
ZCBhbmQgYXJtLjwvZGl2PjxkaXYgZGlyPSJhdXRvIj48YnI+PC9kaXY+PGRpdiBkaXI9ImF1dG8i
PjxzcGFuIHN0eWxlPSJmb250LWZhbWlseTogc2Fucy1zZXJpZjsiPmtyYWZ0IGNvbmZpZ3VyZSAt
bSB4ODZfNjQgLXAga3ZtPC9zcGFuPjwvZGl2PjxkaXYgZGlyPSJhdXRvIj48Zm9udCBmYWNlPSJz
YW5zLXNlcmlmIj48YnI+PC9mb250PjxkaXYgY2xhc3M9ImdtYWlsX2V4dHJhIiBkaXI9ImF1dG8i
Pjxicj48ZGl2IGNsYXNzPSJnbWFpbF9xdW90ZSI+T24gRGVjIDIsIDIwMjAgMjA6NTQsIFJvZHJp
Z28gRmVycmF6IEF6ZXZlZG8gJmx0O3JvZHJpZ29mZXJyYXphemV2ZWRvQGdtYWlsLmNvbSZndDsg
d3JvdGU6PGJyIHR5cGU9ImF0dHJpYnV0aW9uIj48YmxvY2txdW90ZSBjbGFzcz0icXVvdGUiIHN0
eWxlPSJtYXJnaW46MCAwIDAgLjhleDtib3JkZXItbGVmdDoxcHggI2NjYyBzb2xpZDtwYWRkaW5n
LWxlZnQ6MWV4Ij48ZGl2IGRpcj0ibHRyIj5IZWxsbyBHdXlzLDxkaXY+PGJyPjwvZGl2PjxkaXY+
SSBoYWQgaW5zdGFsbGVkIFVuaWtyYWZ0IG9uIGFuIE5WSURJQSBKZXRzb24gTmFubyAoQVJNIEJv
YXJkKSBhbmQgdHJ5aW5nJm5ic3A7dG8gcnVuIG15IGZpcnN0IFVuaWtlcm5lbCBhcHBsaWNhdGlv
biwgYnV0IEknbSByZWNlaXZpbmcgYW4gZXJyb3IgYmVsb3cuIEkgdGhpbmsgSSdtIG5vdCB1c2lu
ZyB0aGUgY29tbWFuZHMgY29ycmVjdGx5LjwvZGl2PjxkaXY+PGJyPjwvZGl2PjxkaXY+U2VxdWVu
Y2UgdHJpZWQ6PC9kaXY+PGRpdj5ta2RpciBteV91bmlrZXJuZWw8L2Rpdj48ZGl2PmNkIG15X3Vu
aWtlcm5lbDwvZGl2PjxkaXY+a3JhZnQgaW5pdCAtYSBoZWxsb3dvcmxkIG15X3VuaWtlcm5lbDwv
ZGl2PjxkaXY+a3JhZnQgY29uZmlndXJlIC1tIHg4Nl82NCAtcCBrdm08L2Rpdj48ZGl2PmtyYWZ0
IGJ1aWxkIC1qPC9kaXY+PGRpdj5rcmFmdCBydW4gLXAga3ZtPGJyIGNsZWFyPSJhbGwiPjxkaXY+
PGRpdiBkaXI9Imx0ciI+PGRpdiBkaXI9Imx0ciI+PGRpdj48ZGl2IGRpcj0ibHRyIj48ZGl2Pjxi
cj48L2Rpdj48ZGl2Pjxicj48L2Rpdj48ZGl2PkFueW9uZSBjYW4gaGVscCBtZT88L2Rpdj48L2Rp
dj48L2Rpdj48L2Rpdj48L2Rpdj48L2Rpdj48L2Rpdj48ZGl2PjxkaXYgZGlyPSJsdHIiIGRhdGEt
c21hcnRtYWlsPSJnbWFpbF9zaWduYXR1cmUiPjxkaXYgZGlyPSJsdHIiPjxkaXY+PGRpdiBkaXI9
Imx0ciI+PGRpdj48YnI+PC9kaXY+PGRpdj48YnI+LS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0t
LS08YnI+Um9kcmlnbyBGZXJyYXogQXpldmVkbzxkaXY+PGJyPjwvZGl2PjwvZGl2PjwvZGl2Pjwv
ZGl2PjwvZGl2PjwvZGl2PjwvZGl2PjwvZGl2Pgo8L2Jsb2NrcXVvdGU+PC9kaXY+PGJyPjwvZGl2
PjwvZGl2PjwvZGl2Pg==



From minios-devel-bounces@lists.xenproject.org Thu Dec 03 21:07:17 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Thu, 03 Dec 2020 21:07:17 +0000
Received: from list by lists.xenproject.org with outflank-mailman.43967.78897 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1kkvoq-0004Sn-PT; Thu, 03 Dec 2020 21:07:16 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 43967.78897; Thu, 03 Dec 2020 21:07: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 1kkvoq-0004Sg-Mb; Thu, 03 Dec 2020 21:07:16 +0000
Received: by outflank-mailman (input) for mailman id 43967;
 Thu, 03 Dec 2020 21:07: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=2odt=FH=gmail.com=dragosargint21@srs-us1.protection.inumbo.net>)
 id 1kkvop-0004SA-L3
 for minios-devel@lists.xen.org; Thu, 03 Dec 2020 21:07:15 +0000
Received: from mail-ed1-x529.google.com (unknown [2a00:1450:4864:20::529])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 7005636f-6820-4ff8-935c-a7e43b701381;
 Thu, 03 Dec 2020 21:07:10 +0000 (UTC)
Received: by mail-ed1-x529.google.com with SMTP id cm17so3643762edb.4
 for <minios-devel@lists.xen.org>; Thu, 03 Dec 2020 13:07:10 -0800 (PST)
Received: from localhost.localdomain ([82.76.50.17])
 by smtp.gmail.com with ESMTPSA id i8sm1958256eds.72.2020.12.03.13.07.08
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Thu, 03 Dec 2020 13:07:09 -0800 (PST)
X-BeenThere: minios-devel@lists.xenproject.org
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
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: 7005636f-6820-4ff8-935c-a7e43b701381
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
         :in-reply-to:references;
        bh=ZIWZ7P6Tu+R18rQnDng+EGUX55zuxjX5BmncleXHwjA=;
        b=B8LtdB0doHp6y4l5C9r8G5x4N1A7kPPoEisY1FJblBRDATM5fjQMGssNt9XByx/Jjw
         KlvfqtCu1v1h8dhQ9QhRlTuDMQC8E9OeKfV3vWy7i1TzEgSl1nnjtrFToItZladtuvD8
         frKlXZ9yE1+iH7WPA9D+R/luIGNMYFOTSDXY2Va6uhs5uxSQ6+0eG31eVTvX+6DsxVny
         /mn2b39HgyI7FURVCVY9wE9rMZql0w5HtUegn1ckgbG92AIxXzA6Gz1Jxhr7uGY6y+HD
         pIRZSRXPkxNqkC5P+yEOlqMgfX2rbctGuvitkR3Zt8D9Dnsekr9whIqUZkMDPxx0KgIQ
         9Jsw==
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:in-reply-to:references;
        bh=ZIWZ7P6Tu+R18rQnDng+EGUX55zuxjX5BmncleXHwjA=;
        b=rxoHBeufdWJ8WO5KuXjJGRkDr74vUcIQPZRFBQbnYrF12IrmTghEHS6p7A6b1+IteH
         kom2Csnfiy/WAe4uxyzBdm4xL6fR54CYYPDERxsOwxsOn5U4X557akVEt31dpBbaiAg8
         gzKd+lDGFRadAKrZw/GEYmhGaSmX5D+HB23bSDau2zCAWAIbPi/5K8uVNiYWvNDZ0Paf
         B3PRNYgWqjkG+SoGUg8baHIktC0+tzIDSQGKEwou3ir5Qc02+rt4BnwNPzLNhQgU8iip
         NWem/8qDOg1a5vtkkbMKCxpnSoB3sfMgfGyoCbf4Lyj+ctYLn+H7b6FX/2v+ffMSzEEO
         MSyQ==
X-Gm-Message-State: AOAM533v24nOH+bJnWWtSnt+7wIUoP3D+S0pR50SBWVnLbjzgEWsLRlh
	yKFusBggjrkxNgqHI4LAKx6yKVvPhj93c9k3
X-Google-Smtp-Source: ABdhPJyvn+DlVMA7T5yF+AY7RDyMsKT3t2zUzrII0rK4WZUFZyvU0G5rXU/We1C3OufAqznGWa9oIA==
X-Received: by 2002:a50:d685:: with SMTP id r5mr1063297edi.248.1607029629647;
        Thu, 03 Dec 2020 13:07:09 -0800 (PST)
From: ARGINT DRAGOS IULIAN <dragosargint21@gmail.com>
To: minios-devel@lists.xen.org
Cc: felipe.huici@neclab.eu,
	lrbarbulescu@gmail.com,
	ARGINT DRAGOS IULIAN <dragosargint21@gmail.com>
Subject: [PATCH v3 1/3] Add md files
Date: Thu,  3 Dec 2020 23:06:58 +0200
Message-Id: <7cf6506472c164db86771836431fb660af0e9148.1607029055.git.dragosargint21@gmail.com>
X-Mailer: git-send-email 2.17.1
In-Reply-To: <cover.1607029055.git.dragosargint21@gmail.com>
References: <cover.1607029055.git.dragosargint21@gmail.com>
In-Reply-To: <cover.1607029055.git.dragosargint21@gmail.com>
References: <cover.1607029055.git.dragosargint21@gmail.com>

Signed-off-by: ARGINT DRAGOS IULIAN <dragosargint21@gmail.com>
---
 .gitignore      | 27 +++++++++++++++++++++++++++
 CODING_STYLE.md |  4 ++++
 CONTRIBUTING.md |  4 ++++
 COPYING.md      | 39 +++++++++++++++++++++++++++++++++++++++
 MAINTAINERS.md  | 11 +++++++++++
 README.md       | 49 +++++++++++++++++++++++++++++++++++++++++++++++++
 6 files changed, 134 insertions(+)
 create mode 100644 .gitignore
 create mode 100644 CODING_STYLE.md
 create mode 100644 CONTRIBUTING.md
 create mode 100644 COPYING.md
 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..2595ad9
--- /dev/null
+++ b/COPYING.md
@@ -0,0 +1,39 @@
+License
+=======
+
+Unikraft libhogweed wrappers
+----------------------------------
+
+This repository contains wrapper code to build hogweed 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/MAINTAINERS.md b/MAINTAINERS.md
new file mode 100644
index 0000000..6db09e2
--- /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.
+
+	LIBHOGWEED-UNIKRAFT
+	M:	Argint Dragos Iulian <dragosargint21@gmail.com>
+	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..3853914
--- /dev/null
+++ b/README.md
@@ -0,0 +1,49 @@
+Libhogweed for Unikraft
+=============================
+
+This is the port of nettle's libhogweed for Unikraft as external library.
+
+Libhogweed depends on newlib, so please make sure you add the following
+line to the `LIBS` variable in your `Makefile`:
+	`...:$(UK_LIBS)/newlib:$(UK_LIBS)/libhogweed:...`
+
+Testing
+-------
+
+For running the tests: enable the `testsuite` option in the configuration menu
+and select the desired tests. Make sure to include `testutils_glue.h` and call 
+the `run_all_libhogweed_tests(v);` function in your main application. The parameter
+`v` stands for verbose and you can either set it to `0`, non verbose mode, or `1`,
+verbose mode.
+
+Applications
+------------
+
+To run an application that requires a filesystem, you'll need to run them on
+`kvm` and enable `9pfs`, selecting the following menu options, all of them under
+`Library Configuration`:
+- `libnewlib`
+- `libhogweed`
+- `vfscore: VFS Core Interface` ---> `vfscore: Configuration` ---> 
+ `Automatically mount a root filesystem` ---> `Default root filesystem`
+  ---> `9PFS`
+- `uk9p: 9p client`
+- `9pfs: 9p filesystem`
+- `devfs: devfs file system ---> Mount /dev during boot`
+- `ukswrand: Software random number generator ---> Register random and
+ urandom device to devfs`
+
+Mounting a file system
+---------------------
+In order to mount the file system you'll need to provide the following Qemu
+parameters:
+- `-fsdev local,id=myid,path=<some directory>,security_model=none`
+- `-device virtio-9p-pci,fsdev=myid,mount_tag=rootfs,disable-modern=on,
+  disable-legacy=off`
+
+Note that if you use a different `mount_tag`, you'll need to add it in `Default
+root device` in `vfscore configuration`. Also, to provide command line 
+arguments to the kernel, you'll need to use `-append "param1 param2 ..."`.
+	
+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 Thu Dec 03 21:07:17 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Thu, 03 Dec 2020 21:07:17 +0000
Received: from list by lists.xenproject.org with outflank-mailman.43966.78893 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1kkvom-0004SM-Nw; Thu, 03 Dec 2020 21:07:12 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 43966.78893; Thu, 03 Dec 2020 21:07: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 1kkvom-0004SF-Kr; Thu, 03 Dec 2020 21:07:12 +0000
Received: by outflank-mailman (input) for mailman id 43966;
 Thu, 03 Dec 2020 21:07: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=2odt=FH=gmail.com=dragosargint21@srs-us1.protection.inumbo.net>)
 id 1kkvok-0004SA-Ps
 for minios-devel@lists.xen.org; Thu, 03 Dec 2020 21:07:10 +0000
Received: from mail-ej1-x643.google.com (unknown [2a00:1450:4864:20::643])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 373d493a-dc5d-440c-8ae7-86b83c895b3b;
 Thu, 03 Dec 2020 21:07:09 +0000 (UTC)
Received: by mail-ej1-x643.google.com with SMTP id n26so5577394eju.6
 for <minios-devel@lists.xen.org>; Thu, 03 Dec 2020 13:07:09 -0800 (PST)
Received: from localhost.localdomain ([82.76.50.17])
 by smtp.gmail.com with ESMTPSA id i8sm1958256eds.72.2020.12.03.13.07.07
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Thu, 03 Dec 2020 13:07:08 -0800 (PST)
X-BeenThere: minios-devel@lists.xenproject.org
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
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: 373d493a-dc5d-440c-8ae7-86b83c895b3b
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20161025;
        h=from:to:cc:subject:date:message-id;
        bh=DhWwS+WUIuvSKHppdyEnkPZPgvqVLfPZxsZ7X0WKgUQ=;
        b=Krz7z/bbc0QJVPd4EZZym9AjgUylpEepmtNQVQlbzxR8BZBsZSTYrwcJXgkMFfbndg
         BwnOLu/1+U8UpgIZyKReAJsi4SAru2OBtQFHmHiTu1vEJRY1UEgmnQJQbGrsqXfeJcLP
         IjMuuOnLphP0a4eaOiAE/qMTH7EajVL6giNpFGhrKY3fy5nNJ6PrM2/Clpbqp3Z20Avu
         43ySqfh0Ut3trA+03C5v+GI4+Bg/0OaA2t1oayJ7ZZ8zDN3O6dqBDm3i+IsZFI6z53Wj
         nLoxXdfC9xaEZO0ZhlpEYf+L1M6NkezXhA7oFXHQMLViGN/eGJvw6s+dAAyI1OAlViM+
         0XUQ==
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=DhWwS+WUIuvSKHppdyEnkPZPgvqVLfPZxsZ7X0WKgUQ=;
        b=IzZ3Cr6Csj8lP2zoZLPqVaDgbTgzRBKnOzTeTE52QCRNh53fgyr2D7PJ7UkTM/LEw/
         KtSPbxfm2FwNtCRuaH8aOtJ2wDHtOCISgoR5i9LtYhhy5RNTCssqXc6oZFZ/2gZ0q0nz
         cUMT9DSTraUGTEWyEzta73nlYwwSeTfS67AsapCw0K7esegx6uAEhYJy621R6bClpx2I
         6r/KmJGuSWIhaf7hmOKbdPKcMtG/rkSO1JeFoB1UFZqTp37uQTc7D0Bcr9Htvil71rw9
         ADyhch0ZGARYxeKCG6ygCC2yVvtQmQ6bkEuSZjIMJdVMExYT7xFU88K1gfAzv4JMBYh7
         DueA==
X-Gm-Message-State: AOAM532z9rntFVdxvmKX8NdEg5+tmaYXIGSexgld4xi7CjdPfcVmJy1y
	Rvjbj8F/U5EtBITBBDCm5qFKBwGxdKbguQ==
X-Google-Smtp-Source: ABdhPJzz+FHrfI3fzwrxUFlum/wJ+QDBP/EC0ol9wzGjwwfP2fqU1TO/Jg3K8Ql67nPGDC6I2TUMLg==
X-Received: by 2002:a17:906:d8a1:: with SMTP id qc1mr4143921ejb.294.1607029628586;
        Thu, 03 Dec 2020 13:07:08 -0800 (PST)
From: ARGINT DRAGOS IULIAN <dragosargint21@gmail.com>
To: minios-devel@lists.xen.org
Cc: felipe.huici@neclab.eu,
	lrbarbulescu@gmail.com,
	ARGINT DRAGOS IULIAN <dragosargint21@gmail.com>
Subject: [PATCH v3 0/3] Port of libhogweed on Unikraft - v3
Date: Thu,  3 Dec 2020 23:06:57 +0200
Message-Id: <cover.1607029055.git.dragosargint21@gmail.com>
X-Mailer: git-send-email 2.17.1

Nettle is a cryptographic library that is designed to fit easily in more or
less any context: In crypto toolkits for object-oriented languages
(C++, Python, Pike, ...), in applications like LSH or GNUPG, or even in kernel
space.

Nettle actually consists of two libraries, libnettle and libhogweed. The
libhogweed library contains those functions of Nettle that uses bignum
operations, and depends on the GMP library.

github repository: https://github.com/dragosargint/libhogweed.git


ARGINT DRAGOS IULIAN (3):
  Add md files
  Add Makefile.uk and Config.uk
  Add glue code

 .gitignore               |  27 ++
 CODING_STYLE.md          |   4 +
 CONTRIBUTING.md          |   4 +
 COPYING.md               |  39 ++
 Config.uk                |  83 ++++
 MAINTAINERS.md           |  11 +
 Makefile.uk              | 490 ++++++++++++++++++++++++
 README.md                |  49 +++
 include/testutils_glue.h |  26 ++
 testutils_glue.c         | 808 +++++++++++++++++++++++++++++++++++++++
 10 files changed, 1541 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/testutils_glue.h
 create mode 100644 testutils_glue.c

-- 
2.17.1



From minios-devel-bounces@lists.xenproject.org Thu Dec 03 21:07:22 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Thu, 03 Dec 2020 21:07:22 +0000
Received: from list by lists.xenproject.org with outflank-mailman.43968.78902 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1kkvow-0004U9-S0; Thu, 03 Dec 2020 21:07:22 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 43968.78902; Thu, 03 Dec 2020 21:07: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 1kkvow-0004U2-OV; Thu, 03 Dec 2020 21:07:22 +0000
Received: by outflank-mailman (input) for mailman id 43968;
 Thu, 03 Dec 2020 21:07: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=2odt=FH=gmail.com=dragosargint21@srs-us1.protection.inumbo.net>)
 id 1kkvou-0004SA-LM
 for minios-devel@lists.xen.org; Thu, 03 Dec 2020 21:07:20 +0000
Received: from mail-ej1-x62d.google.com (unknown [2a00:1450:4864:20::62d])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id a43c0901-5463-49e9-81eb-b25a333903f9;
 Thu, 03 Dec 2020 21:07:12 +0000 (UTC)
Received: by mail-ej1-x62d.google.com with SMTP id ga15so5590112ejb.4
 for <minios-devel@lists.xen.org>; Thu, 03 Dec 2020 13:07:12 -0800 (PST)
Received: from localhost.localdomain ([82.76.50.17])
 by smtp.gmail.com with ESMTPSA id i8sm1958256eds.72.2020.12.03.13.07.09
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Thu, 03 Dec 2020 13:07:10 -0800 (PST)
X-BeenThere: minios-devel@lists.xenproject.org
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
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: a43c0901-5463-49e9-81eb-b25a333903f9
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
         :in-reply-to:references;
        bh=B2Zd2iKMrj3k5C0YBjXzRSE+d1gfYUGwv4cZNv9jXms=;
        b=kX5WPxQHfXifn4ZMRhLKrEg1I0xonZfcphgafSfpJ93IzuKu/ZlrddgTGSz5x07cai
         vwlBx6ROkZIVqDeX+djZdK66wgkAlQMMRZQ9SQ0iaPAiZcWUsOOFW0HwCVTQWDC3n3lI
         T1X3IyfRIiT9E+2ckpMHXDC8ZcVerrkzk6HpYt8yzOyT6tHLpIJDpJubD38vNn8qNyRs
         TaVF75iOeuonTldye+tEXMjAW9Xommexya8iZECorw7KcAy2wWyrTqxLCjfHTkVmQDde
         QtEqlpNf3QZsLgkme/BUJa1+F9xGFETQcgSjOyBd3+Mcw86XoHWtCr4mBBXoZiLXdjYe
         vBkA==
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:in-reply-to:references;
        bh=B2Zd2iKMrj3k5C0YBjXzRSE+d1gfYUGwv4cZNv9jXms=;
        b=HsgYVTvtNFFaBRyAZccq5P4FrEyZQPGNJlCDupVmFWSQ6Msb19AmB23OqU3NkXHqci
         tus085wJPVeV0wiGo9OGT52ecKlYQbnnNopddM8/iRw1pyTPMO+b5Cw5WXMmqCaoZUAu
         +8ehcfwZQlJ8vu9/akujqxXB50nfnfvJHHeDgCsh0ZI9/2qrYlaQ042Ib/ZneySVWGMe
         a7p6F9uuJ+MFDKSZCC5Ja2FPsxqgN2ma7VHFq75lbgChRWrOpGjUN4OCis/LH3cXEnBc
         qSlyzAFTcJLL6ZsAJrEzMg0M+EDOcinv6ln9u0NERkfcwHMKdeCNxU+bcehZYO9FezGM
         nvLA==
X-Gm-Message-State: AOAM5305l6buyqIMDNtfmKnTp2s/jT8fz5PfV5j/WWHjAsPkoW+uvY1u
	ngd26iwkL5/5a2mMx6Ol84RNQNxlJLI3NOj9
X-Google-Smtp-Source: ABdhPJwY5Nw0ARU47uVsWXOBYhoDl1svuzzmzchKKHgfyfDMul0VxGMSxxk3wkd/W14+pbh74Mr5Bw==
X-Received: by 2002:a17:906:8042:: with SMTP id x2mr4548105ejw.79.1607029631027;
        Thu, 03 Dec 2020 13:07:11 -0800 (PST)
From: ARGINT DRAGOS IULIAN <dragosargint21@gmail.com>
To: minios-devel@lists.xen.org
Cc: felipe.huici@neclab.eu,
	lrbarbulescu@gmail.com,
	ARGINT DRAGOS IULIAN <dragosargint21@gmail.com>
Subject: [PATCH v3 2/3] Add Makefile.uk and Config.uk
Date: Thu,  3 Dec 2020 23:06:59 +0200
Message-Id: <fbc37140d325a0bc41b69700b1d2a724d3dac61f.1607029055.git.dragosargint21@gmail.com>
X-Mailer: git-send-email 2.17.1
In-Reply-To: <cover.1607029055.git.dragosargint21@gmail.com>
References: <cover.1607029055.git.dragosargint21@gmail.com>
In-Reply-To: <cover.1607029055.git.dragosargint21@gmail.com>
References: <cover.1607029055.git.dragosargint21@gmail.com>

Signed-off-by: ARGINT DRAGOS IULIAN <dragosargint21@gmail.com>
---
 Config.uk   |  83 +++++++++
 Makefile.uk | 490 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 573 insertions(+)
 create mode 100644 Config.uk
 create mode 100644 Makefile.uk

diff --git a/Config.uk b/Config.uk
new file mode 100644
index 0000000..7f422ee
--- /dev/null
+++ b/Config.uk
@@ -0,0 +1,83 @@
+config LIBHOGWEED
+	bool "libhogweed - Public-key algorithms"
+	default n
+	select LIBNEWLIBC
+
+if LIBHOGWEED
+	menuconfig TESTSUITE
+		bool "testsuite - tests for libhogweed"
+		default n
+		if TESTSUITE
+			config RSA_COMPUTE_ROOT_TEST
+				bool "rsa-compute-root-test"
+				default y
+			config RSA_ENCRYPT_TEST
+				bool "rsa-encrypt-test"
+				default y
+			config RSA_KEYGEN_TEST
+				bool "rsa-keygen-test"
+				default y
+			config RSA_PSS_SIGN_TR_TEST
+				bool "rsa-pss-sign-tr-test"
+				default y
+			config RSA_SEC_DECRYPT_TEST
+				bool "rsa-sec-decrypt-test"
+				default y
+			config RSA_SIGN_TR_TEST
+				bool "rsa-sign-tr-test"
+				default y
+			config RSA_TEST
+				bool "rsa-test"
+				default y
+			config RSA2SEXP_TEST
+				bool "rsa2sexp-test"
+				default y
+			config SEXP2RSA_TEST
+				bool "sexp2rsa-test"
+				default y
+			config CURVE25519_DH_TEST
+				bool "curve25519-dh-test"
+				default y
+			config CURVE448_DH_TEST
+				bool "curve448-dh-test"
+				default y
+			config DSA_KEYGEN_TEST
+				bool "dsa-keygen-test"
+				default y
+			config DSA_TEST
+				bool "dsa-test"
+				default y
+			config ECDSA_KEYGEN_TEST
+				bool "ecdsa-keygen-test"
+				default y
+			config ECDSA_SIGN_TEST
+				bool "ecdsa-sign-test"
+				default y
+			config ECDSA_VERIFY_TEST
+				bool "ecdsa-verify-test"
+				default y
+			config EDDSA_COMPRESS_TEST
+				bool "eddsa-compress-test"
+				default y
+			config EDDSA_SIGN_TEST
+				bool "eddsa-sign-test"
+				default y
+			config EDDSA_VERIFY_TEST
+				bool "eddsa-verify-test"
+				default y
+			config GOSTDSA_KEYGEN_TEST
+				bool "gostdsa-keygen-test"
+				default y
+			config GOSTDSA_SIGN_TEST
+				bool "gostdsa-sign-test"
+				default y
+			config GOSTDSA_VERIFY_TEST
+				bool "gostdsa-verify-test"
+				default y
+			config GOSTDSA_VKO_TEST
+				bool "gostdsa-vko-test"
+				default y
+	endif
+endif
+
+
diff --git a/Makefile.uk b/Makefile.uk
new file mode 100644
index 0000000..666f31b
--- /dev/null
+++ b/Makefile.uk
@@ -0,0 +1,490 @@
+#  SPDX-License-Identifier: BSD-3-Clause
+#
+#  libhogweed Makefile.uk
+#
+#  Authors: Argint Dragos Iulian <dragosargint21@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.
+#
+
+################################################################################
+# Library registration
+################################################################################
+$(eval $(call addlib_s,libhogweed,$(CONFIG_LIBHOGWEED)))
+#$(eval $(call addlib_s,libhogweedglue,$(CONFIG_LIBHOGWEED)))
+
+################################################################################
+# Original sources
+################################################################################
+LIBHOGWEED_VERSION=3.6
+LIBHOGWEED_URL=https://ftp.gnu.org/gnu/nettle/nettle-$(LIBHOGWEED_VERSION).tar.gz
+LIBHOGWEED_PATCHDIR=$(LIBHOGWEED_BASE)/patches
+LIBHOGWEED_SUBDIR=nettle-$(LIBHOGWEED_VERSION)
+$(eval $(call fetch,libhogweed,$(LIBHOGWEED_URL)))
+#$(eval $(call patch,libhogweed,$(LIBHOHWEED_PATCHDIR),$(LIBHOGWEED_SUBDIR)))
+
+################################################################################
+# Helpers
+################################################################################
+LIBHOGWEED_EXTRACTED = $(LIBHOGWEED_ORIGIN)/nettle-$(LIBHOGWEED_VERSION)
+
+################################################################################
+# Library includes
+################################################################################
+LIBHOGWEED_COMMON_INCLUDES-y     += -I$(LIBHOGWEED_BASE)/include
+LIBHOGWEED_COMMON_INCLUDES-y     += -I$(LIBHOGWEED_EXTRACTED)
+LIBHOGWEED_COMMON_INCLUDES-y     += -I$(LIBHOGWEED_EXTRACTED)/testsuite
+CINCLUDES-$(CONFIG_LIBHOGWEED)   += $(LIBHOGWEED_COMMON_INCLUDES-y)
+CXXINCLUDES-$(CONFIG_LIBHOGWEED) += $(LIBHOGWEED_COMMON_INCLUDES-y)
+
+LIBHOGWEED_CINCLUDES   += -I$(LIBHOGWEED_EXTRACTED)
+LIBHOGWEED_CXXINCLUDES += -I$(LIBHOGWEED_EXTRACTED)
+
+################################################################################
+# Global flags
+################################################################################
+# Suppress flags
+LIBHOGWEED_SUPPRESS_FLAGS += -Wno-unused-parameter \
+        -Wno-unused-variable -Wno-unused-value -Wno-unused-function \
+        -Wno-missing-field-initializers -Wno-implicit-fallthrough \
+        -Wno-sign-compare
+LIBHOGWEED_CFLAGS-y   += $(LIBHOGWEED_SUPPRESS_FLAGS) \
+        -Wno-pointer-to-int-cast -Wno-int-to-pointer-cast
+LIBHOGWEED_CXXFLAGS-y += $(LIBHOGWEED_SUPPRESS_FLAGS)
+
+# Preprocessing symbols
+LIBHOGWEED_DEFINES    += -DHAVE_CONFIG_H
+LIBHOGWEED_CFLAGS-y   += $(LIBHOGWEED_DEFINES)
+LIBHOGWEED_CXXFLAGS-y += $(LIBHOGWEED_DEFINES)
+
+################################################################################
+# HOGWEED code -- bignum
+################################################################################
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/bignum.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/bignum-random.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/bignum-random-prime.c
+
+################################################################################
+# HOGWEED code -- yarrow
+################################################################################
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/yarrow256.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/yarrow_key_event.c
+
+################################################################################
+# HOGWEED code -- gmp
+################################################################################
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/mini-gmp.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/gmp-glue.c
+
+################################################################################
+# HOGWEED code -- aes
+################################################################################
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/aes-encrypt.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/aes-decrypt.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/aes-encrypt-internal.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/aes-encrypt-table.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/aes-decrypt-internal.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/aes-set-key-internal.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/aes256-set-encrypt-key.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/aes256-set-decrypt-key.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/aes-invert-internal.c
+
+################################################################################
+# HOGWEED code -- sha
+################################################################################
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/sha1.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/sha1-meta.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/sha1-compress.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/sha256.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/sha256-meta.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/sha256-compress.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/sha512.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/sha512-meta.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/sha512-compress.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/sha3.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/sha3-permute.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/sha3-256.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/sha384-meta.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/sha224-meta.c
+
+################################################################################
+# HOGWEED code -- md5
+################################################################################
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/md5.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/md5-compress.c
+
+################################################################################
+# HOGWEED code -- write
+################################################################################
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/write-be32.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/write-le32.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/write-le64.c
+
+################################################################################
+# HOGWEED code -- buffer
+################################################################################
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/buffer.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/buffer-init.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/realloc.c
+
+################################################################################
+# HOGWEED code -- rsa
+################################################################################
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/rsa.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/rsa-sign.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/rsa-sign-tr.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/rsa-keygen.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/rsa-encrypt.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/rsa-decrypt.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/rsa-decrypt-tr.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/rsa-verify.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/rsa-sha1-sign.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/rsa-sha1-sign-tr.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/rsa-sha1-verify.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/rsa-md5-sign.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/rsa-md5-sign-tr.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/rsa-md5-verify.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/rsa-pss-sha256-sign-tr.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/rsa-pss-sha256-verify.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/rsa-pss-sha512-sign-tr.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/rsa-pss-sha512-verify.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/rsa-pkcs1-sign.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/rsa-pkcs1-sign-tr.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/rsa-pkcs1-verify.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/rsa-sha256-sign.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/rsa-sha256-sign-tr.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/rsa-sha256-verify.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/rsa-sha512-sign.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/rsa-sha512-sign-tr.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/rsa-sha512-verify.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/rsa-sec-decrypt.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/rsa-sec-compute-root.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/rsa2sexp.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/rsa-blind.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/rsa2openpgp.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/pgp-encode.c
+
+################################################################################
+# HOGWEED code -- pss
+################################################################################
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/pss.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/pss-mgf1.c
+
+################################################################################
+# HOGWEED code -- pkcs
+################################################################################
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/pkcs1.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/pkcs1-encrypt.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/pkcs1-decrypt.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/pkcs1-sec-decrypt.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/pkcs1-rsa-sha1.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/pkcs1-rsa-sha256.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/pkcs1-rsa-sha512.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/pkcs1-rsa-digest.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/pkcs1-rsa-md5.c
+
+################################################################################
+# HOGWEED code -- dsa
+################################################################################
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/dsa.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/dsa-sign.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/dsa-hash.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/dsa-verify.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/dsa-keygen.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/dsa-compat.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/dsa-compat-keygen.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/dsa-gen-params.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/dsa-sha1-sign.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/dsa-sha1-verify.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/dsa-sha256-sign.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/dsa-sha256-verify.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/dsa2sexp.c
+
+################################################################################
+# HOGWEED code -- ecdsa
+################################################################################
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/ecdsa-keygen.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/ecdsa-sign.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/ecdsa-verify.c
+
+################################################################################
+# HOGWEED code -- ecc
+################################################################################
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/ecc-a-to-j.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/ecc-add-eh.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/ecc-add-ehh.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/ecc-add-jja.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/ecc-add-jjj.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/ecc-add-th.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/ecc-add-thh.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/ecc-curve25519-modp.s
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/ecc-curve25519.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/ecc-curve448-modp.s
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/ecc-curve448.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/ecc-dup-eh.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/ecc-dup-jj.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/ecc-dup-th.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/ecc-ecdsa-sign.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/ecc-ecdsa-verify.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/ecc-eh-to-a.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/ecc-gost-gc256b.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/ecc-gost-gc512a.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/ecc-gostdsa-sign.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/ecc-gostdsa-verify.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/ecc-hash.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/ecc-j-to-a.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/ecc-mod-arith.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/ecc-mod-inv.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/ecc-mod.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/ecc-mul-a-eh.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/ecc-mul-a.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/ecc-mul-g-eh.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/ecc-mul-g.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/ecc-mul-m.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/ecc-point.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/ecc-random.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/ecc-scalar.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/ecc-secp192r1-modp.s
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/ecc-secp192r1.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/ecc-secp224r1-modp.s
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/ecc-secp224r1.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/ecc-secp256r1-redc.s
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/ecc-secp256r1.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/ecc-secp384r1-modp.s
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/ecc-secp384r1.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/ecc-secp521r1-modp.s
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/ecc-secp521r1.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/ecc-size.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/sec-add-1.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/sec-tabselect.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/cnd-copy.c
+
+################################################################################
+# HOGWEED code -- curve
+################################################################################
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/curve25519-mul.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/curve25519-mul-g.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/curve25519-eh-to-x.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/curve448-mul.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/curve448-mul-g.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/curve448-eh-to-x.c
+
+################################################################################
+# HOGWEED code -- gostdsa
+################################################################################
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/gostdsa-sign.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/gostdsa-verify.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/gostdsa-vko.c
+
+################################################################################
+# HOGWEED code -- eddsa
+################################################################################
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/eddsa-compress.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/eddsa-decompress.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/eddsa-sign.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/eddsa-verify.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/eddsa-expand.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/eddsa-hash.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/eddsa-pubkey.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/ed25519-sha512.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/ed448-shake256.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/shake256.c
+
+################################################################################
+# HOGWEED code -- sexp
+################################################################################
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/sexp.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/sexp2rsa.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/sexp-format.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/sexp2bignum.c
+#LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/sexp-transport-format.c
+
+################################################################################
+# HOGWEED code -- hex encoding
+################################################################################
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/base16-encode.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/base16-decode.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/base64-encode.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/base64-decode.c
+
+################################################################################
+# HOGWEED code -- miscellaneous
+################################################################################
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/knuth-lfib.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/hmac.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/hmac-sha1.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/memxor.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/memxor3.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/cnd-memcpy.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/memeql-sec.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/cbc.c
+
+################################################################################
+# HOGWEED code -- tests
+################################################################################
+LIBHOGWEED_SRCS-$(CONFIG_TESTSUITE) += $(LIBHOGWEED_BASE)/testutils_glue.c
+ifeq ($(CONFIG_RSA_COMPUTE_ROOT_TEST),y)
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/testsuite/rsa-compute-root-test.c
+LIBHOGWEED_RSA-COMPUTE-ROOT-TEST_FLAGS-y += -Dtest_main=rsa_compute_root_test
+endif
+ifeq ($(CONFIG_RSA_ENCRYPT_TEST),y)
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/testsuite/rsa-encrypt-test.c
+LIBHOGWEED_RSA-ENCRYPT-TEST_FLAGS-y += -Dtest_main=rsa_encrypt_test
+endif
+ifeq ($(CONFIG_RSA_KEYGEN_TEST),y)
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/testsuite/rsa-keygen-test.c
+LIBHOGWEED_RSA-KEYGEN-TEST_FLAGS-y += -Dtest_main=rsa_keygen_test
+endif
+ifeq ($(CONFIG_RSA_PSS_SIGN_TR_TEST),y)
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/testsuite/rsa-pss-sign-tr-test.c
+LIBHOGWEED_RSA-PSS-SIGN-TR-TEST_FLAGS-y += -Dtest_main=rsa_pss_sign_tr_test
+endif
+ifeq ($(CONFIG_RSA_SEC_DECRYPT_TEST),y)
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/testsuite/rsa-sec-decrypt-test.c
+LIBHOGWEED_RSA-SEC-DECRYPT-TEST_FLAGS-y += -Dtest_main=rsa_sec_decrypt_test
+endif
+ifeq ($(CONFIG_RSA_SIGN_TR_TEST),y)
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/testsuite/rsa-sign-tr-test.c
+LIBHOGWEED_RSA-SIGN-TR-TEST_FLAGS-y += -Dtest_main=rsa_sign_tr_test
+endif
+ifeq ($(CONFIG_RSA_TEST),y)
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/testsuite/rsa-test.c
+LIBHOGWEED_RSA-TEST_FLAGS-y += -Dtest_main=rsa_test
+endif
+ifeq ($(CONFIG_RSA2SEXP_TEST),y)
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/testsuite/rsa2sexp-test.c
+LIBHOGWEED_RSA2SEXP-TEST_FLAGS-y += -Dtest_main=rsa2sexp_test
+endif
+ifeq ($(CONFIG_SEXP2RSA_TEST),y)
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/testsuite/sexp2rsa-test.c
+LIBHOGWEED_SEXP2RSA-TEST_FLAGS-y += -Dtest_main=sexp2rsa_test
+endif
+ifeq ($(CONFIG_CURVE25519_DH_TEST),y)
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/testsuite/curve25519-dh-test.c
+LIBHOGWEED_CURVE25519-DH-TEST_FLAGS-y += -Dtest_main=curve25519_dh_test
+endif
+ifeq ($(CONFIG_CURVE448_DH_TEST),y)
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/testsuite/curve448-dh-test.c
+LIBHOGWEED_CURVE448-DH-TEST_FLAGS-y += -Dtest_main=curve448_dh_test
+endif
+ifeq ($(CONFIG_DSA_KEYGEN_TEST),y)
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/testsuite/dsa-keygen-test.c
+LIBHOGWEED_DSA-KEYGEN-TEST_FLAGS-y += -Dtest_main=dsa_keygen_test
+endif
+ifeq ($(CONFIG_DSA_TEST),y)
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/testsuite/dsa-test.c
+LIBHOGWEED_DSA-TEST_FLAGS-y += -Dtest_main=dsa_test
+endif
+ifeq ($(CONFIG_ECDSA_KEYGEN_TEST),y)
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/testsuite/ecdsa-keygen-test.c
+LIBHOGWEED_ECDSA-KEYGEN-TEST_FLAGS-y += -Dtest_main=ecdsa_keygen_test
+endif
+ifeq ($(CONFIG_ECDSA_SIGN_TEST),y)
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/testsuite/ecdsa-sign-test.c
+LIBHOGWEED_ECDSA-SIGN-TEST_FLAGS-y += -Dtest_main=ecdsa_sign_test
+endif
+ifeq ($(CONFIG_ECDSA_VERIFY_TEST),y)
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/testsuite/ecdsa-verify-test.c
+LIBHOGWEED_ECDSA-VERIFY-TEST_FLAGS-y += -Dtest_main=ecdsa_verify_test
+endif
+ifeq ($(CONFIG_EDDSA_COMPRESS_TEST),y)
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/testsuite/eddsa-compress-test.c
+LIBHOGWEED_EDDSA-COMPRESS-TEST_FLAGS-y += -Dtest_main=eddsa_compress_test
+endif
+ifeq ($(CONFIG_EDDSA_SIGN_TEST),y)
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/testsuite/eddsa-sign-test.c
+LIBHOGWEED_EDDSA-SIGN-TEST_FLAGS-y += -Dtest_main=eddsa_sign_test
+endif
+ifeq ($(CONFIG_EDDSA_VERIFY_TEST),y)
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/testsuite/eddsa-verify-test.c
+LIBHOGWEED_EDDSA-VERIFY-TEST_FLAGS-y += -Dtest_main=eddsa_verify_test
+endif
+ifeq ($(CONFIG_GOSTDSA_KEYGEN_TEST),y)
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/testsuite/gostdsa-keygen-test.c
+LIBHOGWEED_GOSTDSA-KEYGEN-TEST_FLAGS-y += -Dtest_main=gostdsa_keygen_test
+endif
+ifeq ($(CONFIG_GOSTDSA_SIGN_TEST),y)
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/testsuite/gostdsa-sign-test.c
+LIBHOGWEED_GOSTDSA-SIGN-TEST_FLAGS-y += -Dtest_main=gostdsa_sign_test
+endif
+ifeq ($(CONFIG_GOSTDSA_VERIFY_TEST),y)
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/testsuite/gostdsa-verify-test.c
+LIBHOGWEED_GOSTDSA-VERIFY-TEST_FLAGS-y += -Dtest_main=gostdsa_verify_test
+endif
+ifeq ($(CONFIG_GOSTDSA_VKO_TEST),y)
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/testsuite/gostdsa-vko-test.c
+LIBHOGWEED_GOSTDSA-VKO-TEST_FLAGS-y += -Dtest_main=gostdsa_vko_test
+endif
+
+
+
+################################################################################
+# HOGWEED prepare
+################################################################################
+# Run ./configure
+$(LIBHOGWEED_EXTRACTED)/config.h: $(LIBHOGWEED_BUILD)/.origin
+	$(call verbose_cmd,CONFIG,libhogweed: $(notdir $@), \
+        cd $(LIBHOGWEED_EXTRACTED) && ./configure --enable-mini-gmp \
+    )
+
+# Generate auxiliar files using the original building system
+$(LIBHOGWEED_EXTRACTED)/make_auxiliar: $(LIBHOGWEED_BUILD)/.origin
+	$(call verbose_cmd,CONFIG,libhogweed: $(notdir $@), \
+        cd $(LIBHOGWEED_EXTRACTED) && \
+        make ecc-secp192r1.h && \
+        make ecc-secp224r1.h && \
+        make ecc-secp256r1.h && \
+       	make ecc-secp384r1.h && \
+        make ecc-secp521r1.h && \
+        make ecc-curve25519.h && \
+        make ecc-curve448.h && \
+        make ecc-gost-gc256b.h && \
+        make ecc-gost-gc512a.h && \
+        /usr/bin/m4 ./asm.m4 machine.m4 config.m4 ecc-curve25519-modp.asm \
+        	> ecc-curve25519-modp.s && \
+        /usr/bin/m4 ./asm.m4 machine.m4 config.m4 ecc-curve448-modp.asm \
+        	> ecc-curve448-modp.s && \
+        /usr/bin/m4 ./asm.m4 machine.m4 config.m4 ecc-secp192r1-modp.asm \
+        	> ecc-secp192r1-modp.s && \
+        /usr/bin/m4 ./asm.m4 machine.m4 config.m4 ecc-secp224r1-modp.asm \
+            > ecc-secp224r1-modp.s && \
+        /usr/bin/m4 ./asm.m4 machine.m4 config.m4 ecc-secp256r1-redc.asm \
+        	> ecc-secp256r1-redc.s && \
+        /usr/bin/m4 ./asm.m4 machine.m4 config.m4 ecc-secp384r1-modp.asm \
+        	> ecc-secp384r1-modp.s && \
+        /usr/bin/m4 ./asm.m4 machine.m4 config.m4 ecc-secp521r1-modp.asm \
+        	> ecc-secp521r1-modp.s && \
+        echo "done" > make_auxiliar \
+    )
+
+LIBHOGWEED_PREPARED_DEPS = $(LIBHOGWEED_EXTRACTED)/config.h \
+							$(LIBHOGWEED_EXTRACTED)/make_auxiliar
+
+$(LIBHOGWEED_BUILD)/.prepared: $(LIBHOGWEED_PREPARED_DEPS)
+
+UK_PREPARE += $(LIBHOGWEED_BUILD)/.prepared
-- 
2.17.1



From minios-devel-bounces@lists.xenproject.org Thu Dec 03 21:07:26 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Thu, 03 Dec 2020 21:07:26 +0000
Received: from list by lists.xenproject.org with outflank-mailman.43969.78905 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1kkvp0-0004VH-Un; Thu, 03 Dec 2020 21:07:26 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 43969.78905; Thu, 03 Dec 2020 21:07: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 1kkvp0-0004VA-Rf; Thu, 03 Dec 2020 21:07:26 +0000
Received: by outflank-mailman (input) for mailman id 43969;
 Thu, 03 Dec 2020 21:07: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=2odt=FH=gmail.com=dragosargint21@srs-us1.protection.inumbo.net>)
 id 1kkvoz-0004SA-LN
 for minios-devel@lists.xen.org; Thu, 03 Dec 2020 21:07:25 +0000
Received: from mail-ed1-x544.google.com (unknown [2a00:1450:4864:20::544])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 6e715f2d-d278-465b-8976-bb73f57856a0;
 Thu, 03 Dec 2020 21:07:13 +0000 (UTC)
Received: by mail-ed1-x544.google.com with SMTP id q16so3600273edv.10
 for <minios-devel@lists.xen.org>; Thu, 03 Dec 2020 13:07:13 -0800 (PST)
Received: from localhost.localdomain ([82.76.50.17])
 by smtp.gmail.com with ESMTPSA id i8sm1958256eds.72.2020.12.03.13.07.11
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Thu, 03 Dec 2020 13:07:11 -0800 (PST)
X-BeenThere: minios-devel@lists.xenproject.org
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
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: 6e715f2d-d278-465b-8976-bb73f57856a0
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
         :in-reply-to:references;
        bh=KFlDAgOWWU6SYWJr7Pqg2Vmeh4tzD78oMFqnrkvcDeM=;
        b=p0eQRL/Y2TpISQB6YEh2K45l3euB6sDk6qtTai99KtPUMYkSNETMjmBcX08YNPsRAm
         kudxJjyDEpghTOUavCN+3E4AiKjbkJw3d11JuBYbsPoWvm+I7Qcv8Dr3lzoxP/PVywz0
         aPT2FlXi5WX8y/3BA6DbvnpWfJWSgRwBYg3HV3bArScLN5ACgyKqiN36AFzDxhIfPRa6
         US3HjoT5K/o2Tg7/1H4fQuknQx8U1ZLCs/33KbozQN1Soui2VI4h9KrKSnDj5nwAT9Bw
         60Xg0cmpS6H2UtEyxCFYe8RQ2DLpnxiYD72ZX75TKsW7viZups/fLwj/UwP/FyFiYPOt
         J6Ig==
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:in-reply-to:references;
        bh=KFlDAgOWWU6SYWJr7Pqg2Vmeh4tzD78oMFqnrkvcDeM=;
        b=rw9rtAl/ogSxS6veD/57ng7WARs+v0eHq+JsxHy80tb9mybIB4fXnIhLUaCgO9I/xd
         VYVZ1+uMweRLdfNoqXXkfAcD6K9fcDIHKrwcPPfj0jqdHJJuN9uV0gx/xDUDqU4EsTcb
         zrCz6Lq6pAPFqbM3zPMDP97duQsoo8La0GD6Uru/trQFkWqKR40TNtq+SnXzUwk4zICm
         pcfeQH0lUfy4yiJyTRjysRNQIkiFMTtV/0nQQyAXLuegPYgLqQYSzoyyWEvlwEJdfrKx
         8SaDkSwUBX/LtfObIwhlQpp9GN4aL8AdADXHG2Ez8YRME6V3fhsFwRNy4eGvibjcIr57
         wz+A==
X-Gm-Message-State: AOAM530edIErG9H/Qq9T41ytUVoZWJAtK/FtiPCrr6H7MIjFduqXTJ4A
	HI6GCHTGn+c+tfwdpUct2SHkF8dH2s3YQKvm
X-Google-Smtp-Source: ABdhPJy7w031+IrzaW4/fUrMajUnBytNhPxkHu1LTOhH5oommKJulqFyRwh0JVkZopqd/XS+VsPd+A==
X-Received: by 2002:a05:6402:16c8:: with SMTP id r8mr4580965edx.59.1607029631981;
        Thu, 03 Dec 2020 13:07:11 -0800 (PST)
From: ARGINT DRAGOS IULIAN <dragosargint21@gmail.com>
To: minios-devel@lists.xen.org
Cc: felipe.huici@neclab.eu,
	lrbarbulescu@gmail.com,
	ARGINT DRAGOS IULIAN <dragosargint21@gmail.com>
Subject: [PATCH v3 3/3] Add glue code
Date: Thu,  3 Dec 2020 23:07:00 +0200
Message-Id: <df5df104a8f99e4803fd2065f0338ee9a7fa6e2c.1607029055.git.dragosargint21@gmail.com>
X-Mailer: git-send-email 2.17.1
In-Reply-To: <cover.1607029055.git.dragosargint21@gmail.com>
References: <cover.1607029055.git.dragosargint21@gmail.com>
In-Reply-To: <cover.1607029055.git.dragosargint21@gmail.com>
References: <cover.1607029055.git.dragosargint21@gmail.com>

Signed-off-by: ARGINT DRAGOS IULIAN <dragosargint21@gmail.com>
---
 include/testutils_glue.h |  26 ++
 testutils_glue.c         | 808 +++++++++++++++++++++++++++++++++++++++
 2 files changed, 834 insertions(+)
 create mode 100644 include/testutils_glue.h
 create mode 100644 testutils_glue.c

diff --git a/include/testutils_glue.h b/include/testutils_glue.h
new file mode 100644
index 0000000..6213879
--- /dev/null
+++ b/include/testutils_glue.h
@@ -0,0 +1,26 @@
+void rsa_compute_root_test(void);
+void rsa_compute_root_test(void);
+void rsa_encrypt_test(void);
+void rsa_keygen_test(void);
+void rsa_pss_sign_tr_test(void);
+void rsa_sec_decrypt_test(void);
+void rsa_sign_tr_test(void);
+void rsa_test(void);
+void rsa2sexp_test(void);
+void sexp2rsa_test(void);
+void curve25519_dh_test(void);
+void curve448_dh_test(void);
+void dsa_keygen_test(void);
+void dsa_test(void);
+void ecdsa_keygen_test(void);
+void ecdsa_sign_test(void);
+void ecdsa_verify_test(void);
+void eddsa_compress_test(void);
+void eddsa_sign_test(void);
+void eddsa_verify_test(void);
+void gostdsa_keygen_test(void);
+void gostdsa_sign_test(void);
+void gostdsa_verify_test(void);
+void gostdsa_vko_test(void);
+int run_all_libhogweed_tests(int v);
+
diff --git a/testutils_glue.c b/testutils_glue.c
new file mode 100644
index 0000000..1832d92
--- /dev/null
+++ b/testutils_glue.c
@@ -0,0 +1,808 @@
+/* testutils_glue.c */
+
+#include "testutils.h"
+#include "testutils_glue.h"
+#include "base16.h"
+#include "cbc.h"
+#include "cfb.h"
+#include "ctr.h"
+#include "knuth-lfib.h"
+#include "macros.h"
+#include "nettle-internal.h"
+#include "uk/config.h"
+#include <assert.h>
+#include <ctype.h>
+
+void
+die(const char *format, ...)
+{
+  va_list args;
+  va_start(args, format);
+  vfprintf(stderr, format, args);
+  va_end(args);
+
+  abort ();
+}
+
+void *
+xalloc(size_t size)
+{
+  void *p = malloc(size);
+  if (size && !p)
+    {
+      fprintf(stderr, "Virtual memory exhausted.\n");
+      abort();
+    }
+
+  return p;
+}
+
+static struct tstring *tstring_first = NULL;
+
+struct tstring *
+tstring_alloc (size_t length)
+{
+  struct tstring *s = xalloc(sizeof(struct tstring) + length);
+  s->length = length;
+  s->next = tstring_first;
+  /* NUL-terminate, for convenience. */
+  s->data[length] = '\0';
+  tstring_first = s;
+  return s;
+}
+
+void
+tstring_clear(void)
+{
+  while (tstring_first)
+    {
+      struct tstring *s = tstring_first;
+      tstring_first = s->next;
+      free(s);
+    }
+}
+
+struct tstring *
+tstring_data(size_t length, const uint8_t *data)
+{
+  struct tstring *s = tstring_alloc (length);
+  memcpy (s->data, data, length);
+  return s;
+}
+
+struct tstring *
+tstring_hex(const char *hex)
+{
+  struct base16_decode_ctx ctx;
+  struct tstring *s;
+  size_t length = strlen(hex);
+
+  s = tstring_alloc(BASE16_DECODE_LENGTH (length));
+  base16_decode_init (&ctx);
+  ASSERT (base16_decode_update (&ctx, &s->length, s->data,
+				length, hex));
+  ASSERT (base16_decode_final (&ctx));
+
+  return s;
+}
+
+void
+tstring_print_hex(const struct tstring *s)
+{
+  print_hex (s->length, s->data);
+}
+
+void
+print_hex(size_t length, const uint8_t *data)
+{
+  size_t i;
+  
+  for (i = 0; i < length; i++)
+    {
+      switch (i % 16)
+	{
+	default:
+	  break;
+	case 0:
+	  printf("\n");
+	  break;
+	case 8:
+	  printf(" ");
+	  break;
+	}
+      printf("%02x", data[i]);
+    }
+  printf("\n");
+}
+
+int verbose = 0;
+
+void
+mpn_out_str (FILE *f, int base, const mp_limb_t *xp, mp_size_t xn)
+{
+  mpz_t x;
+  mpz_out_str (f, base, mpz_roinit_n (x, xp, xn));
+}
+
+#if NETTLE_USE_MINI_GMP
+void
+gmp_randinit_default (struct knuth_lfib_ctx *ctx)
+{
+  knuth_lfib_init (ctx, 17);
+}
+void
+mpz_urandomb (mpz_t r, struct knuth_lfib_ctx *ctx, mp_bitcnt_t bits)
+{
+  size_t bytes = (bits+7)/8;
+  uint8_t *buf = xalloc (bytes);
+
+  knuth_lfib_random (ctx, bytes, buf);
+  buf[0] &= 0xff >> (8*bytes - bits);
+  nettle_mpz_set_str_256_u (r, bytes, buf);
+  free (buf);
+}
+#endif /* NETTLE_USE_MINI_GMP */
+
+mp_limb_t *
+xalloc_limbs (mp_size_t n)
+{
+  return xalloc (n * sizeof (mp_limb_t));
+}
+
+/* Expects local variables pub, key, rstate, digest, signature */
+#define SIGN(hash, msg, expected) do { \
+  hash##_update(&hash, LDATA(msg));					\
+  ASSERT(rsa_##hash##_sign(key, &hash, signature));			\
+  if (verbose)								\
+    {									\
+      fprintf(stderr, "rsa-%s signature: ", #hash);			\
+      mpz_out_str(stderr, 16, signature);				\
+      fprintf(stderr, "\n");						\
+    }									\
+  ASSERT(mpz_cmp (signature, expected) == 0);				\
+									\
+  hash##_update(&hash, LDATA(msg));					\
+  ASSERT(rsa_##hash##_sign_tr(pub, key, &rstate,			\
+			      (nettle_random_func *) knuth_lfib_random,	\
+			      &hash, signature));			\
+  ASSERT(mpz_cmp (signature, expected) == 0);				\
+									\
+  hash##_update(&hash, LDATA(msg));					\
+  hash##_digest(&hash, sizeof(digest), digest);				\
+  ASSERT(rsa_##hash##_sign_digest(key, digest, signature));		\
+  ASSERT(mpz_cmp (signature, expected) == 0);				\
+									\
+  ASSERT(rsa_##hash##_sign_digest_tr(pub, key, &rstate,			\
+				     (nettle_random_func *)knuth_lfib_random, \
+				     digest, signature));		\
+  ASSERT(mpz_cmp (signature, expected) == 0);				\
+} while(0)
+
+#define VERIFY(key, hash, msg, signature) (	\
+  hash##_update(&hash, LDATA(msg)),		\
+  rsa_##hash##_verify(key, &hash, signature)	\
+)
+
+void
+test_rsa_set_key_1(struct rsa_public_key *pub,
+		   struct rsa_private_key *key)
+{
+  /* Initialize key pair for test programs */
+  /* 1000-bit key, generated by
+   *
+   *   lsh-keygen -a rsa -l 1000 -f advanced-hex
+   *
+   * (private-key (rsa-pkcs1 
+   *        (n #69abd505285af665 36ddc7c8f027e6f0 ed435d6748b16088
+   *            4fd60842b3a8d7fb bd8a3c98f0cc50ae 4f6a9f7dd73122cc
+   *            ec8afa3f77134406 f53721973115fc2d 8cfbba23b145f28d
+   *            84f81d3b6ae8ce1e 2850580c026e809b cfbb52566ea3a3b3
+   *            df7edf52971872a7 e35c1451b8636d22 279a8fb299368238
+   *            e545fbb4cf#)
+   *        (e #0db2ad57#)
+   *        (d #3240a56f4cd0dcc2 4a413eb4ea545259 5c83d771a1c2ba7b
+   *            ec47c5b43eb4b374 09bd2aa1e236dd86 481eb1768811412f
+   *            f8d91be3545912af b55c014cb55ceac6 54216af3b85d5c4f
+   *            4a32894e3b5dfcde 5b2875aa4dc8d9a8 6afd0ca92ef50d35
+   *            bd09f1c47efb4c8d c631e07698d362aa 4a83fd304e66d6c5
+   *            468863c307#)
+   *        (p #0a66399919be4b4d e5a78c5ea5c85bf9 aba8c013cb4a8732
+   *            14557a12bd67711e bb4073fd39ad9a86 f4e80253ad809e5b
+   *            f2fad3bc37f6f013 273c9552c9f489#)
+   *        (q #0a294f069f118625 f5eae2538db9338c 776a298eae953329
+   *            9fd1eed4eba04e82 b2593bc98ba8db27 de034da7daaea795
+   *            2d55b07b5f9a5875 d1ca5f6dcab897#)
+   *        (a #011b6c48eb592eee e85d1bb35cfb6e07 344ea0b5e5f03a28
+   *            5b405396cbc78c5c 868e961db160ba8d 4b984250930cf79a
+   *            1bf8a9f28963de53 128aa7d690eb87#)
+   *        (b #0409ecf3d2557c88 214f1af5e1f17853 d8b2d63782fa5628
+   *            60cf579b0833b7ff 5c0529f2a97c6452 2fa1a8878a9635ab
+   *            ce56debf431bdec2 70b308fa5bf387#)
+   *        (c #04e103ee925cb5e6 6653949fa5e1a462 c9e65e1adcd60058
+   *            e2df9607cee95fa8 daec7a389a7d9afc 8dd21fef9d83805a
+   *            40d46f49676a2f6b 2926f70c572c00#)))
+   */
+  
+  mpz_set_str(pub->n,
+	      "69abd505285af665" "36ddc7c8f027e6f0" "ed435d6748b16088"
+	      "4fd60842b3a8d7fb" "bd8a3c98f0cc50ae" "4f6a9f7dd73122cc"
+	      "ec8afa3f77134406" "f53721973115fc2d" "8cfbba23b145f28d"
+	      "84f81d3b6ae8ce1e" "2850580c026e809b" "cfbb52566ea3a3b3"
+	      "df7edf52971872a7" "e35c1451b8636d22" "279a8fb299368238"
+	      "e545fbb4cf", 16);
+  mpz_set_str(pub->e, "0db2ad57", 16);
+
+  ASSERT (rsa_public_key_prepare(pub));
+  
+  /* d is not used */
+#if 0  
+  mpz_set_str(key->d,
+	      "3240a56f4cd0dcc2" "4a413eb4ea545259" "5c83d771a1c2ba7b"
+	      "ec47c5b43eb4b374" "09bd2aa1e236dd86" "481eb1768811412f"
+	      "f8d91be3545912af" "b55c014cb55ceac6" "54216af3b85d5c4f"
+	      "4a32894e3b5dfcde" "5b2875aa4dc8d9a8" "6afd0ca92ef50d35"
+	      "bd09f1c47efb4c8d" "c631e07698d362aa" "4a83fd304e66d6c5"
+	      "468863c307", 16);
+#endif
+  
+  mpz_set_str(key->p,
+	      "0a66399919be4b4d" "e5a78c5ea5c85bf9" "aba8c013cb4a8732"
+	      "14557a12bd67711e" "bb4073fd39ad9a86" "f4e80253ad809e5b"
+	      "f2fad3bc37f6f013" "273c9552c9f489", 16);
+
+  mpz_set_str(key->q,
+	      "0a294f069f118625" "f5eae2538db9338c" "776a298eae953329"
+	      "9fd1eed4eba04e82" "b2593bc98ba8db27" "de034da7daaea795"
+	      "2d55b07b5f9a5875" "d1ca5f6dcab897", 16);
+  
+  mpz_set_str(key->a,
+	      "011b6c48eb592eee" "e85d1bb35cfb6e07" "344ea0b5e5f03a28"
+	      "5b405396cbc78c5c" "868e961db160ba8d" "4b984250930cf79a"
+	      "1bf8a9f28963de53" "128aa7d690eb87", 16);
+  
+  mpz_set_str(key->b,
+	      "0409ecf3d2557c88" "214f1af5e1f17853" "d8b2d63782fa5628"
+	      "60cf579b0833b7ff" "5c0529f2a97c6452" "2fa1a8878a9635ab"
+	      "ce56debf431bdec2" "70b308fa5bf387", 16);
+  
+  mpz_set_str(key->c,
+	      "04e103ee925cb5e6" "6653949fa5e1a462" "c9e65e1adcd60058"
+	      "e2df9607cee95fa8" "daec7a389a7d9afc" "8dd21fef9d83805a"
+	      "40d46f49676a2f6b" "2926f70c572c00", 16);
+
+  ASSERT (rsa_private_key_prepare(key));
+  ASSERT (pub->size == key->size);
+}
+
+void
+test_rsa_md5(struct rsa_public_key *pub,
+	     struct rsa_private_key *key,
+	     mpz_t expected)
+{
+  struct md5_ctx md5;
+  struct knuth_lfib_ctx rstate;
+  uint8_t digest[MD5_DIGEST_SIZE];
+  mpz_t signature;
+
+  md5_init(&md5);
+  mpz_init(signature);
+  knuth_lfib_init (&rstate, 15);
+
+  SIGN(md5, "The magic words are squeamish ossifrage", expected);
+
+  /* Try bad data */
+  ASSERT (!VERIFY(pub, md5,
+		  "The magick words are squeamish ossifrage", signature));
+
+  /* Try correct data */
+  ASSERT (VERIFY(pub, md5,
+		 "The magic words are squeamish ossifrage", signature));
+
+  /* Try bad signature */
+  mpz_combit(signature, 17);
+  ASSERT (!VERIFY(pub, md5,
+		  "The magic words are squeamish ossifrage", signature));
+
+  mpz_clear(signature);
+}
+
+void
+test_rsa_sha1(struct rsa_public_key *pub,
+	      struct rsa_private_key *key,
+	      mpz_t expected)
+{
+  struct sha1_ctx sha1;
+  struct knuth_lfib_ctx rstate;
+  uint8_t digest[SHA1_DIGEST_SIZE];
+  mpz_t signature;
+
+  sha1_init(&sha1);
+  mpz_init(signature);
+  knuth_lfib_init (&rstate, 16);
+
+  SIGN(sha1, "The magic words are squeamish ossifrage", expected);
+
+  /* Try bad data */
+  ASSERT (!VERIFY(pub, sha1,
+		  "The magick words are squeamish ossifrage", signature));
+
+  /* Try correct data */
+  ASSERT (VERIFY(pub, sha1,
+		 "The magic words are squeamish ossifrage", signature));
+
+  /* Try bad signature */
+  mpz_combit(signature, 17);
+  ASSERT (!VERIFY(pub, sha1,
+		  "The magic words are squeamish ossifrage", signature));
+
+  mpz_clear(signature);
+}
+
+void
+test_rsa_sha256(struct rsa_public_key *pub,
+		struct rsa_private_key *key,
+		mpz_t expected)
+{
+  struct sha256_ctx sha256;
+  struct knuth_lfib_ctx rstate;
+  uint8_t digest[SHA256_DIGEST_SIZE];
+  mpz_t signature;
+
+  sha256_init(&sha256);
+  mpz_init(signature);
+  knuth_lfib_init (&rstate, 17);
+
+  SIGN(sha256, "The magic words are squeamish ossifrage", expected);
+
+  /* Try bad data */
+  ASSERT (!VERIFY(pub, sha256,
+		  "The magick words are squeamish ossifrage", signature));
+
+  /* Try correct data */
+  ASSERT (VERIFY(pub, sha256,
+		 "The magic words are squeamish ossifrage", signature));
+
+  /* Try bad signature */
+  mpz_combit(signature, 17);
+  ASSERT (!VERIFY(pub, sha256,
+		  "The magic words are squeamish ossifrage", signature));
+
+  mpz_clear(signature);
+}
+
+void
+test_rsa_sha512(struct rsa_public_key *pub,
+		struct rsa_private_key *key,
+		mpz_t expected)
+{
+  struct sha512_ctx sha512;
+  struct knuth_lfib_ctx rstate;
+  uint8_t digest[SHA512_DIGEST_SIZE];
+  mpz_t signature;
+
+  sha512_init(&sha512);
+  mpz_init(signature);
+  knuth_lfib_init (&rstate, 18);
+
+  SIGN(sha512, "The magic words are squeamish ossifrage", expected);
+
+  /* Try bad data */
+  ASSERT (!VERIFY(pub, sha512,
+		  "The magick words are squeamish ossifrage", signature));
+
+  /* Try correct data */
+  ASSERT (VERIFY(pub, sha512,
+		 "The magic words are squeamish ossifrage", signature));
+
+  /* Try bad signature */
+  mpz_combit(signature, 17);
+  ASSERT (!VERIFY(pub, sha512,
+		  "The magic words are squeamish ossifrage", signature));
+
+  mpz_clear(signature);
+}
+
+#undef SIGN
+#undef VERIFY
+
+void
+test_rsa_key(struct rsa_public_key *pub,
+	     struct rsa_private_key *key)
+{
+  mpz_t tmp;
+  mpz_t phi;
+  
+  mpz_init(tmp); mpz_init(phi);
+  
+  if (verbose)
+    {
+      /* FIXME: Use gmp_printf */
+      fprintf(stderr, "Public key: n=");
+      mpz_out_str(stderr, 16, pub->n);
+      fprintf(stderr, "\n    e=");
+      mpz_out_str(stderr, 16, pub->e);
+
+      fprintf(stderr, "\n\nPrivate key: d=");
+      mpz_out_str(stderr, 16, key->d);
+      fprintf(stderr, "\n    p=");
+      mpz_out_str(stderr, 16, key->p);
+      fprintf(stderr, "\n    q=");
+      mpz_out_str(stderr, 16, key->q);
+      fprintf(stderr, "\n    a=");
+      mpz_out_str(stderr, 16, key->a);
+      fprintf(stderr, "\n    b=");
+      mpz_out_str(stderr, 16, key->b);
+      fprintf(stderr, "\n    c=");
+      mpz_out_str(stderr, 16, key->c);
+      fprintf(stderr, "\n\n");
+    }
+
+  /* Check n = p q */
+  mpz_mul(tmp, key->p, key->q);
+  ASSERT (mpz_cmp(tmp, pub->n)== 0);
+
+  /* Check c q = 1 mod p */
+  mpz_mul(tmp, key->c, key->q);
+  mpz_fdiv_r(tmp, tmp, key->p);
+  ASSERT (mpz_cmp_ui(tmp, 1) == 0);
+
+  /* Check ed = 1 (mod phi) */
+  mpz_sub_ui(phi, key->p, 1);
+  mpz_sub_ui(tmp, key->q, 1);
+
+  mpz_mul(phi, phi, tmp);
+
+  mpz_mul(tmp, pub->e, key->d);
+  mpz_fdiv_r(tmp, tmp, phi);
+  ASSERT (mpz_cmp_ui(tmp, 1) == 0);
+
+  /* Check a e = 1 (mod (p-1) ) */
+  mpz_sub_ui(phi, key->p, 1);
+  mpz_mul(tmp, pub->e, key->a);
+  mpz_fdiv_r(tmp, tmp, phi);
+  ASSERT (mpz_cmp_ui(tmp, 1) == 0);
+  
+  /* Check b e = 1 (mod (q-1) ) */
+  mpz_sub_ui(phi, key->q, 1);
+  mpz_mul(tmp, pub->e, key->b);
+  mpz_fdiv_r(tmp, tmp, phi);
+  ASSERT (mpz_cmp_ui(tmp, 1) == 0);
+  
+  mpz_clear(tmp); mpz_clear(phi);
+}
+
+/* Requires that the context is named like the hash algorithm. */
+#define DSA_VERIFY(key, hash, msg, signature)	\
+  (hash##_update(&hash, LDATA(msg)),		\
+   dsa_##hash##_verify(key, &hash, signature))
+
+void
+test_dsa160(const struct dsa_public_key *pub,
+	    const struct dsa_private_key *key,
+	    const struct dsa_signature *expected)
+{
+  struct sha1_ctx sha1;
+  struct dsa_signature signature;
+  struct knuth_lfib_ctx lfib;
+  
+  sha1_init(&sha1);
+  dsa_signature_init(&signature);
+  knuth_lfib_init(&lfib, 1111);
+  
+  sha1_update(&sha1, LDATA("The magic words are squeamish ossifrage"));
+  ASSERT (dsa_sha1_sign(pub, key,
+			&lfib, (nettle_random_func *) knuth_lfib_random,
+			&sha1, &signature));
+
+  if (verbose)
+    {
+      fprintf(stderr, "dsa160 signature: ");
+      mpz_out_str(stderr, 16, signature.r);
+      fprintf(stderr, ", ");
+      mpz_out_str(stderr, 16, signature.s);
+      fprintf(stderr, "\n");
+    }
+
+  if (expected)
+    ASSERT (mpz_cmp (signature.r, expected->r) == 0
+	    && mpz_cmp (signature.s, expected->s) == 0);
+  
+  /* Try bad data */
+  ASSERT (!DSA_VERIFY(pub, sha1,
+		      "The magick words are squeamish ossifrage",
+		      &signature));
+
+  /* Try correct data */
+  ASSERT (DSA_VERIFY(pub, sha1,
+		     "The magic words are squeamish ossifrage",
+		     &signature));
+
+  /* Try bad signature */
+  mpz_combit(signature.r, 17);
+  ASSERT (!DSA_VERIFY(pub, sha1,
+		      "The magic words are squeamish ossifrage",
+		      &signature));
+
+  dsa_signature_clear(&signature);
+}
+
+void
+test_dsa256(const struct dsa_public_key *pub,
+	    const struct dsa_private_key *key,
+	    const struct dsa_signature *expected)
+{
+  struct sha256_ctx sha256;
+  struct dsa_signature signature;
+  struct knuth_lfib_ctx lfib;
+  
+  sha256_init(&sha256);
+  dsa_signature_init(&signature);
+  knuth_lfib_init(&lfib, 1111);
+  
+  sha256_update(&sha256, LDATA("The magic words are squeamish ossifrage"));
+  ASSERT (dsa_sha256_sign(pub, key,
+			&lfib, (nettle_random_func *) knuth_lfib_random,
+			&sha256, &signature));
+  
+  if (verbose)
+    {
+      fprintf(stderr, "dsa256 signature: ");
+      mpz_out_str(stderr, 16, signature.r);
+      fprintf(stderr, ", ");
+      mpz_out_str(stderr, 16, signature.s);
+      fprintf(stderr, "\n");
+    }
+
+  if (expected)
+    ASSERT (mpz_cmp (signature.r, expected->r) == 0
+	    && mpz_cmp (signature.s, expected->s) == 0);
+  
+  /* Try bad data */
+  ASSERT (!DSA_VERIFY(pub, sha256,
+		      "The magick words are squeamish ossifrage",
+		      &signature));
+
+  /* Try correct data */
+  ASSERT (DSA_VERIFY(pub, sha256,
+		     "The magic words are squeamish ossifrage",
+		     &signature));
+
+  /* Try bad signature */
+  mpz_combit(signature.r, 17);
+  ASSERT (!DSA_VERIFY(pub, sha256,
+		      "The magic words are squeamish ossifrage",
+		      &signature));
+
+  dsa_signature_clear(&signature);
+}
+
+
+void
+test_dsa_verify(const struct dsa_params *params,
+		const mpz_t pub,
+		const struct nettle_hash *hash,
+		struct tstring *msg,
+		const struct dsa_signature *ref)
+{
+  void *ctx = xalloc (hash->context_size);
+  uint8_t *digest = xalloc (hash->digest_size);
+  struct dsa_signature signature;
+
+  dsa_signature_init (&signature);
+
+  hash->init(ctx);
+  
+  hash->update (ctx, msg->length, msg->data);
+  hash->digest (ctx, hash->digest_size, digest);
+
+  mpz_set (signature.r, ref->r);
+  mpz_set (signature.s, ref->s);
+
+  ASSERT (dsa_verify (params, pub,
+		       hash->digest_size, digest,
+		       &signature));
+
+  /* Try bad signature */
+  mpz_combit(signature.r, 17);
+  ASSERT (!dsa_verify (params, pub,
+		       hash->digest_size, digest,
+		       &signature));
+  
+  /* Try bad data */
+  digest[hash->digest_size / 2-1] ^= 8;
+  ASSERT (!dsa_verify (params, pub,
+		       hash->digest_size, digest,
+		       ref));
+
+  free (ctx);
+  free (digest);
+  dsa_signature_clear(&signature);  
+}
+
+void
+test_dsa_key(const struct dsa_params *params,
+	     const mpz_t pub,
+	     const mpz_t key,
+	     unsigned q_size)
+{
+  mpz_t t;
+
+  mpz_init(t);
+
+  ASSERT(mpz_sizeinbase(params->q, 2) == q_size);
+  ASSERT(mpz_sizeinbase(params->p, 2) >= DSA_SHA1_MIN_P_BITS);
+  
+  ASSERT(mpz_probab_prime_p(params->p, 10));
+
+  ASSERT(mpz_probab_prime_p(params->q, 10));
+
+  mpz_fdiv_r(t, params->p, params->q);
+
+  ASSERT(0 == mpz_cmp_ui(t, 1));
+
+  ASSERT(mpz_cmp_ui(params->g, 1) > 0);
+  
+  mpz_powm(t, params->g, params->q, params->p);
+  ASSERT(0 == mpz_cmp_ui(t, 1));
+  
+  mpz_powm(t, params->g, key, params->p);
+  ASSERT(0 == mpz_cmp(t, pub));
+
+  mpz_clear(t);
+}
+
+const struct ecc_curve * const ecc_curves[] = {
+  &_nettle_secp_192r1,
+  &_nettle_secp_224r1,
+  &_nettle_secp_256r1,
+  &_nettle_secp_384r1,
+  &_nettle_secp_521r1,
+  &_nettle_curve25519,
+  &_nettle_curve448,
+  &_nettle_gost_gc256b,
+  &_nettle_gost_gc512a,
+  NULL
+};
+
+void
+write_mpn (FILE *f, int base, const mp_limb_t *xp, mp_size_t n)
+{
+  mpz_t t;
+  mpz_out_str (f, base, mpz_roinit_n (t,xp, n));
+}
+
+int
+run_all_libhogweed_tests(int v)
+{
+      if (v == 1) {
+	      verbose = 1;
+      } else if (v == 0) {
+	      verbose = 0;
+      
+      } else {
+	      fprintf(stderr, "Invalid argument `%d`, only accepted options are `0` or `1`.\n",
+		      v);
+	      return 1;
+      }
+
+#ifdef CONFIG_RSA_COMPUTE_ROOT_TEST
+  puts("running rsa_compute_root_test __________________________________________________");
+  rsa_compute_root_test();
+  puts("rsa_compute_root_test is complete ______________________________________________\n");
+#endif
+#ifdef CONFIG_RSA_ENCRYPT_TEST
+  puts("running rsa_encrypt_test _______________________________________________________");
+  rsa_encrypt_test();
+  puts("rsa_encrypt_test is complete ___________________________________________________\n");
+#endif
+#ifdef CONFIG_RSA_KEYGEN_TEST
+  puts("running rsa_keygen_test ________________________________________________________");
+  rsa_keygen_test();
+  puts("rsa_keygen_test is complete ____________________________________________________\n");
+#endif
+#ifdef CONFIG_RSA_PSS_SIGN_TR_TEST
+  puts("running rsa_pss_sign_tr_test ___________________________________________________");
+  rsa_pss_sign_tr_test();
+  puts("rsa_pss_sign_tr_test is complete _______________________________________________\n");
+#endif
+#ifdef CONFIG_RSA_SEC_DECRYPT_TEST
+  puts("running rsa_sec_decrypt_test ___________________________________________________");
+  rsa_sec_decrypt_test();
+  puts("rsa_sec_decrypt_test is complete _______________________________________________\n");
+#endif
+#ifdef CONFIG_RSA_SIGN_TR_TEST
+  puts("running rsa_sign_tr_test _______________________________________________________");
+  rsa_sign_tr_test();
+  puts("rsa_sign_tr_test is complete ___________________________________________________\n");
+#endif
+#ifdef CONFIG_RSA_TEST
+  puts("running rsa_test _______________________________________________________________");
+  rsa_test();
+  puts("rsa_test is complete ___________________________________________________________\n");
+#endif
+#ifdef CONFIG_RSA2SEXP_TEST
+  puts("running rsa2sexp_test __________________________________________________________");
+  rsa2sexp_test();
+  puts("rsa2sexp_test is complete ______________________________________________________\n");
+#endif
+#ifdef CONFIG_SEXP2RSA_TEST
+  puts("running sexp2rsa_test __________________________________________________________");
+  sexp2rsa_test();
+  puts("sexp2rsa_test is complete ______________________________________________________\n");
+#endif
+#ifdef CONFIG_CURVE25519_DH_TEST
+  puts("running curve25519_dh_test _____________________________________________________");
+  curve25519_dh_test();
+  puts("curve25519_dh_test is complete _________________________________________________\n");
+#endif
+#ifdef CONFIG_CURVE448_DH_TEST
+  puts("running curve448_dh_test _______________________________________________________");
+  curve448_dh_test();
+  puts("curve448_dh_test is complete ___________________________________________________\n");
+#endif
+#ifdef CONFIG_DSA_KEYGEN_TEST
+  puts("running dsa_keygen_test ________________________________________________________");
+  dsa_keygen_test();
+  puts("dsa_keygen_test is complete ____________________________________________________\n");
+#endif
+#ifdef CONFIG_DSA_TEST
+  puts("running dsa_test _______________________________________________________________");
+  dsa_test();
+  puts("dsa_test is complete ___________________________________________________________\n");
+#endif
+#ifdef CONFIG_ECDSA_KEYGEN_TEST
+  puts("running ecdsa_keygen_test ______________________________________________________");
+  ecdsa_keygen_test();
+  puts("ecdsa_keygen_test is complete __________________________________________________\n");
+#endif
+#ifdef CONFIG_ECDSA_SIGN_TEST
+  puts("running ecdsa_sign_test ________________________________________________________");
+  ecdsa_sign_test();
+  puts("ecdsa_sign_test is complete ____________________________________________________\n");
+#endif
+#ifdef CONFIG_ECDSA_VERIFY_TEST
+  puts("running ecdsa_verify_test ______________________________________________________");
+  ecdsa_verify_test();
+  puts("ecdsa_verify_test is complete __________________________________________________\n");
+#endif
+#ifdef CONFIG_EDDSA_COMPRESS_TEST
+  puts("running eddsa_compress_test ____________________________________________________");
+  eddsa_compress_test();
+  puts("eddsa_compress_test is complete ________________________________________________\n");
+#endif
+#ifdef CONFIG_EDDSA_SIGN_TEST
+  puts("running eddsa_sign_test ________________________________________________________");
+  eddsa_sign_test();
+  puts("eddsa_sign_test is complete ____________________________________________________\n");
+#endif
+#ifdef CONFIG_EDDSA_VERIFY_TEST
+  puts("running eddsa_verify_test ______________________________________________________");
+  eddsa_verify_test();
+  puts("eddsa_verify_test is complete __________________________________________________\n");
+#endif
+#ifdef CONFIG_GOSTDSA_KEYGEN_TEST
+  puts("running gostdsa_keygen_test ____________________________________________________");
+  gostdsa_keygen_test();
+  puts("gostdsa_keygen_test is complete ________________________________________________\n");
+#endif
+#ifdef CONFIG_GOSTDSA_SIGN_TEST
+  puts("running gostdsa_sign_test ______________________________________________________");
+  gostdsa_sign_test();
+  puts("gostdsa_sign_test is complete __________________________________________________\n");
+#endif
+#ifdef CONFIG_GOSTDSA_VERIFY_TEST
+  puts("running gostdsa_verify_test ____________________________________________________");
+  gostdsa_verify_test();
+  puts("gostdsa_verify_test is complete ________________________________________________\n");
+#endif
+#ifdef CONFIG_GOSTDSA_VKO_TEST
+  puts("running gostdsa_vko_test _______________________________________________________");
+  gostdsa_vko_test();
+  puts("gostdsa_vko_test is complete ___________________________________________________\n");
+#endif
+
+
+  tstring_clear();
+  return EXIT_SUCCESS;
+}
+
-- 
2.17.1



From minios-devel-bounces@lists.xenproject.org Thu Dec 03 21:14:40 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Thu, 03 Dec 2020 21:14:40 +0000
Received: from list by lists.xenproject.org with outflank-mailman.43980.78910 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1kkvvx-0005Vw-H9; Thu, 03 Dec 2020 21:14:37 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 43980.78910; Thu, 03 Dec 2020 21:14: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 1kkvvx-0005Vp-E8; Thu, 03 Dec 2020 21:14:37 +0000
Received: by outflank-mailman (input) for mailman id 43980;
 Thu, 03 Dec 2020 21:14:36 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=2odt=FH=gmail.com=dragosargint21@srs-us1.protection.inumbo.net>)
 id 1kkvvv-0005Vk-Qy
 for minios-devel@lists.xen.org; Thu, 03 Dec 2020 21:14:35 +0000
Received: from mail-wr1-x443.google.com (unknown [2a00:1450:4864:20::443])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id aae60d6e-6466-4052-9a2f-cb0653681244;
 Thu, 03 Dec 2020 21:14:34 +0000 (UTC)
Received: by mail-wr1-x443.google.com with SMTP id r3so3322101wrt.2
 for <minios-devel@lists.xen.org>; Thu, 03 Dec 2020 13:14:34 -0800 (PST)
X-BeenThere: minios-devel@lists.xenproject.org
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
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: aae60d6e-6466-4052-9a2f-cb0653681244
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=MHVRWfu9MQHjuaKGgSqURoX0w8ywlw/ix2YUZMcTB2w=;
        b=UtT3TMDZbQa5/WfB1pEDJN6W7jlEFKv8FKMEkVW0rjET9sHPLpMAUUssJHRLABqTta
         MZROzJdSe2tRGHbahOtcq5lzxuNy5l/Io+z+vc/Gq+PrhQt3OUDa8UtTqyC8bL8Su40+
         lS+KyTL+4D91tuaYTliFm6R24qvPF3tIQAA7Y0NcGF//zJd4UVuYbJgksr7t4BskyMQ+
         OTV8epBrn1PB0kdGOcJm75/1zzayMpajZKOcWwBr4bqMkgi6felEcQSwuEYXuNNtOdHU
         HbCLw0Uz0s/vgI0SD/UgARqQmK5XnoHuFE41U1s9xXJBfSNUk0N5rxw8AlwXnDPp9uCc
         XJyg==
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=MHVRWfu9MQHjuaKGgSqURoX0w8ywlw/ix2YUZMcTB2w=;
        b=bjL73wQvdx3GyrvykxbdUwASq3aJ7+UNd6QN3exNlrpURJ5U8w55T17QjouwfJ3jiu
         5qcULqwXPo2qmQv41BOL3oa/Ak5jRl3Nf1EhDNwb2Zx5Z7vg27Htw3jWY6EJDqwHBOqG
         6yAOkgrYlhqoOCB+RPNkVwI4z8s424B+P3+6NC5JcT7ECI1eumOnRdJeDQAChc4e6nfV
         ZJKr7bW6470J72RTORRmJA6EFmL3Md83HgknSTrUucBuqgQQ3UaQZ9sAi/ZKLEfUYS0n
         2SQjp1tzxzmWxZPpZOreTkHPUUQYM38ZrmCUEK9pR7wMycVyFSkzY8k7bFuslHa62u8Q
         hisw==
X-Gm-Message-State: AOAM532ld2fo6oQa994XU1KtLxFmNUDddy3fWG4TLewCdbrWe2+Gixa0
	UupXCYA74/YsWHQ4ZhR6P8IpYqAopwBkOhVeGHfhYW1IaitngpJ5
X-Google-Smtp-Source: ABdhPJwNsOWInUS4Af/aDdDvjW7+EyYeSPMLxNGrq5/Pd2pBHlz/9EXa+j8pIAKYjR+HstUbaVf0Tf5Nqx7ir0snU+g=
X-Received: by 2002:adf:dd52:: with SMTP id u18mr1216501wrm.44.1607030073737;
 Thu, 03 Dec 2020 13:14:33 -0800 (PST)
MIME-Version: 1.0
References: <cover.1607029055.git.dragosargint21@gmail.com>
In-Reply-To: <cover.1607029055.git.dragosargint21@gmail.com>
From: dragos argint <dragosargint21@gmail.com>
Date: Thu, 3 Dec 2020 23:14:23 +0200
Message-ID: <CANTUrU=39fxw=ZRPT7ZN9QmzEFt=00L6FOzp9t=VhLpqjchQww@mail.gmail.com>
Subject: Re: [PATCH v3 0/3] Port of libhogweed on Unikraft - v3
To: minios-devel@lists.xen.org
Cc: felipe.huici@neclab.eu, Laurentiu Barbulescu <lrbarbulescu@gmail.com>
Content-Type: multipart/alternative; boundary="000000000000b0441d05b595d868"

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

Please ignore these patches, I forgot to add the tag. I apologise.

Dragos Argint

=C3=8En joi, 3 dec. 2020 la 23:07, ARGINT DRAGOS IULIAN <dragosargint21@gma=
il.com>
a scris:

> Nettle is a cryptographic library that is designed to fit easily in more =
or
> less any context: In crypto toolkits for object-oriented languages
> (C++, Python, Pike, ...), in applications like LSH or GNUPG, or even in
> kernel
> space.
>
> Nettle actually consists of two libraries, libnettle and libhogweed. The
> libhogweed library contains those functions of Nettle that uses bignum
> operations, and depends on the GMP library.
>
> github repository: https://github.com/dragosargint/libhogweed.git
>
>
> ARGINT DRAGOS IULIAN (3):
>   Add md files
>   Add Makefile.uk and Config.uk
>   Add glue code
>
>  .gitignore               |  27 ++
>  CODING_STYLE.md          |   4 +
>  CONTRIBUTING.md          |   4 +
>  COPYING.md               |  39 ++
>  Config.uk                |  83 ++++
>  MAINTAINERS.md           |  11 +
>  Makefile.uk              | 490 ++++++++++++++++++++++++
>  README.md                |  49 +++
>  include/testutils_glue.h |  26 ++
>  testutils_glue.c         | 808 +++++++++++++++++++++++++++++++++++++++
>  10 files changed, 1541 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/testutils_glue.h
>  create mode 100644 testutils_glue.c
>
> --
> 2.17.1
>
>

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

<div dir=3D"ltr">Please ignore these patches, I forgot to add the tag. I ap=
ologise.<div><br></div><div>Dragos Argint</div></div><br><div class=3D"gmai=
l_quote"><div dir=3D"ltr" class=3D"gmail_attr">=C3=8En joi, 3 dec. 2020 la =
23:07, ARGINT DRAGOS IULIAN &lt;<a href=3D"mailto:dragosargint21@gmail.com"=
>dragosargint21@gmail.com</a>&gt; a scris:<br></div><blockquote class=3D"gm=
ail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,=
204,204);padding-left:1ex">Nettle is a cryptographic library that is design=
ed to fit easily in more or<br>
less any context: In crypto toolkits for object-oriented languages<br>
(C++, Python, Pike, ...), in applications like LSH or GNUPG, or even in ker=
nel<br>
space.<br>
<br>
Nettle actually consists of two libraries, libnettle and libhogweed. The<br=
>
libhogweed library contains those functions of Nettle that uses bignum<br>
operations, and depends on the GMP library.<br>
<br>
github repository: <a href=3D"https://github.com/dragosargint/libhogweed.gi=
t" rel=3D"noreferrer" target=3D"_blank">https://github.com/dragosargint/lib=
hogweed.git</a><br>
<br>
<br>
ARGINT DRAGOS IULIAN (3):<br>
=C2=A0 Add md files<br>
=C2=A0 Add Makefile.uk and Config.uk<br>
=C2=A0 Add glue code<br>
<br>
=C2=A0.gitignore=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0|=C2=
=A0 27 ++<br>
=C2=A0CODING_STYLE.md=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 |=C2=A0 =C2=A04 +<b=
r>
=C2=A0CONTRIBUTING.md=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 |=C2=A0 =C2=A04 +<b=
r>
=C2=A0COPYING.md=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0|=C2=
=A0 39 ++<br>
=C2=A0Config.uk=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 |=C2=
=A0 83 ++++<br>
=C2=A0MAINTAINERS.md=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0|=C2=A0 11 +<b=
r>
=C2=A0Makefile.uk=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 | 490 +++=
+++++++++++++++++++++<br>
=C2=A0README.md=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 |=C2=
=A0 49 +++<br>
=C2=A0include/testutils_glue.h |=C2=A0 26 ++<br>
=C2=A0testutils_glue.c=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0| 808 +++++++++++++=
++++++++++++++++++++++++++<br>
=C2=A010 files changed, 1541 insertions(+)<br>
=C2=A0create mode 100644 .gitignore<br>
=C2=A0create mode 100644 CODING_STYLE.md<br>
=C2=A0create mode 100644 CONTRIBUTING.md<br>
=C2=A0create mode 100644 COPYING.md<br>
=C2=A0create mode 100644 Config.uk<br>
=C2=A0create mode 100644 MAINTAINERS.md<br>
=C2=A0create mode 100644 Makefile.uk<br>
=C2=A0create mode 100644 README.md<br>
=C2=A0create mode 100644 include/testutils_glue.h<br>
=C2=A0create mode 100644 testutils_glue.c<br>
<br>
-- <br>
2.17.1<br>
<br>
</blockquote></div>

--000000000000b0441d05b595d868--


From minios-devel-bounces@lists.xenproject.org Thu Dec 03 21:21:24 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Thu, 03 Dec 2020 21:21:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.43983.78914 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1kkw2V-0006Rg-2Q; Thu, 03 Dec 2020 21:21:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 43983.78914; Thu, 03 Dec 2020 21:21: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 1kkw2U-0006RZ-VW; Thu, 03 Dec 2020 21:21:22 +0000
Received: by outflank-mailman (input) for mailman id 43983;
 Thu, 03 Dec 2020 21:21: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=2odt=FH=gmail.com=dragosargint21@srs-us1.protection.inumbo.net>)
 id 1kkw2T-0006RU-4G
 for minios-devel@lists.xen.org; Thu, 03 Dec 2020 21:21:21 +0000
Received: from mail-ej1-x642.google.com (unknown [2a00:1450:4864:20::642])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id f78c66c8-17bf-4b83-bee4-1981bbb77e5b;
 Thu, 03 Dec 2020 21:21:20 +0000 (UTC)
Received: by mail-ej1-x642.google.com with SMTP id jx16so5595803ejb.10
 for <minios-devel@lists.xen.org>; Thu, 03 Dec 2020 13:21:20 -0800 (PST)
Received: from localhost.localdomain ([82.76.50.17])
 by smtp.gmail.com with ESMTPSA id cb21sm1979443edb.57.2020.12.03.13.21.18
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Thu, 03 Dec 2020 13:21:18 -0800 (PST)
X-BeenThere: minios-devel@lists.xenproject.org
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
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: f78c66c8-17bf-4b83-bee4-1981bbb77e5b
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20161025;
        h=from:to:cc:subject:date:message-id;
        bh=DhWwS+WUIuvSKHppdyEnkPZPgvqVLfPZxsZ7X0WKgUQ=;
        b=UF231+rLmA3oebptsxvKBEsUp+DdOgY50I/TLSaqGelIDBHCKkNfXSVTpXfyniyrbd
         Kno/ic9CdJB6Z9CJb4ycY21RTorux8U3qEOecSwvGpPlvbvg9fhsN5jzd+sbi6Glfi4f
         HS6iWEz6eSbDYZj8vhKQdSbmHJSGRWEgE7C+mEE3l2TuEPS9dVFtCZC9368Ntye0qdJ9
         x2KdjLAeB12t4YfBKTR1Kvb+sdYDKD5Rx+LkOQyu1NJt2pJanEIh10kiXUdoF2j/iIH6
         a1o2VmhhZADPvTqYdsMJ9WqcsfWUxv+Xt9amUFgLFz4TMXH+9m8N1Svxxmd1vBTRmLts
         HH9w==
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=DhWwS+WUIuvSKHppdyEnkPZPgvqVLfPZxsZ7X0WKgUQ=;
        b=OtKSSEAiGyZGzqaPnf8CFLWKCJWIMrZXjYE5Ohj/6nLa1tpIlliZPU5/ju2xi/e+DU
         1vQx8Os7uFp3k5y2pF70lGNLTvdq/cJ6PjW69wTysnmqEnyUOiB+khp30n1Cup/VUgvf
         x3jOtOgquqgi8GnFAtEImai1JoOcMBXJMATFuCL44qKFEJpeSf3lrAtdKPrnA24Bh70D
         u6sUcTbuW3BQ4tLTW2adU18zWU+bHwMCqP3v1IDhgJLwvg2N03xw47kUPUjYKl1kXjCT
         zaBlXqAwAYQqGYjTqWnJ7/pjirZePBEXo7DEBAE4gdtAAWG1vaO47rK58LDMgBFdZKyp
         Oqxw==
X-Gm-Message-State: AOAM5327NEkrEngAsT8IHQyYnHsiFgC6EhVc8BRUq4DAZzXtH0DsyP6D
	NNa86UFvSXkhCXugxT2xgvv8uHM3/akmH9Fu
X-Google-Smtp-Source: ABdhPJwEqhqyUWrdqb+Ve8nE64lyWqqyG4W8XdkLNIDWfsnoYHtkZNn0Fts1GUQKsk4nS57OMcIbGg==
X-Received: by 2002:a17:906:a8e:: with SMTP id y14mr2479947ejf.47.1607030479254;
        Thu, 03 Dec 2020 13:21:19 -0800 (PST)
From: ARGINT DRAGOS IULIAN <dragosargint21@gmail.com>
To: minios-devel@lists.xen.org
Cc: felipe.huici@neclab.eu,
	lrbarbulescu@gmail.com,
	ARGINT DRAGOS IULIAN <dragosargint21@gmail.com>
Subject: [UNIKRAFT/LIBHOGWEED v3 0/3] Port of libhogweed on Unikraft - v3
Date: Thu,  3 Dec 2020 23:20:49 +0200
Message-Id: <cover.1607030251.git.dragosargint21@gmail.com>
X-Mailer: git-send-email 2.17.1

Nettle is a cryptographic library that is designed to fit easily in more or
less any context: In crypto toolkits for object-oriented languages
(C++, Python, Pike, ...), in applications like LSH or GNUPG, or even in kernel
space.

Nettle actually consists of two libraries, libnettle and libhogweed. The
libhogweed library contains those functions of Nettle that uses bignum
operations, and depends on the GMP library.

github repository: https://github.com/dragosargint/libhogweed.git


ARGINT DRAGOS IULIAN (3):
  Add md files
  Add Makefile.uk and Config.uk
  Add glue code

 .gitignore               |  27 ++
 CODING_STYLE.md          |   4 +
 CONTRIBUTING.md          |   4 +
 COPYING.md               |  39 ++
 Config.uk                |  83 ++++
 MAINTAINERS.md           |  11 +
 Makefile.uk              | 490 ++++++++++++++++++++++++
 README.md                |  49 +++
 include/testutils_glue.h |  26 ++
 testutils_glue.c         | 808 +++++++++++++++++++++++++++++++++++++++
 10 files changed, 1541 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/testutils_glue.h
 create mode 100644 testutils_glue.c

-- 
2.17.1



From minios-devel-bounces@lists.xenproject.org Thu Dec 03 21:21:27 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Thu, 03 Dec 2020 21:21:27 +0000
Received: from list by lists.xenproject.org with outflank-mailman.43984.78917 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1kkw2Z-0006SN-46; Thu, 03 Dec 2020 21:21:27 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 43984.78917; Thu, 03 Dec 2020 21:21:27 +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 1kkw2Z-0006SF-11; Thu, 03 Dec 2020 21:21:27 +0000
Received: by outflank-mailman (input) for mailman id 43984;
 Thu, 03 Dec 2020 21:21: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=2odt=FH=gmail.com=dragosargint21@srs-us1.protection.inumbo.net>)
 id 1kkw2Y-0006RU-09
 for minios-devel@lists.xen.org; Thu, 03 Dec 2020 21:21:26 +0000
Received: from mail-ed1-x530.google.com (unknown [2a00:1450:4864:20::530])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 6d075f29-85ee-4a31-a841-b0fa771a25f6;
 Thu, 03 Dec 2020 21:21:21 +0000 (UTC)
Received: by mail-ed1-x530.google.com with SMTP id q16so3638695edv.10
 for <minios-devel@lists.xen.org>; Thu, 03 Dec 2020 13:21:21 -0800 (PST)
Received: from localhost.localdomain ([82.76.50.17])
 by smtp.gmail.com with ESMTPSA id cb21sm1979443edb.57.2020.12.03.13.21.19
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Thu, 03 Dec 2020 13:21:19 -0800 (PST)
X-BeenThere: minios-devel@lists.xenproject.org
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
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: 6d075f29-85ee-4a31-a841-b0fa771a25f6
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
         :in-reply-to:references;
        bh=ZIWZ7P6Tu+R18rQnDng+EGUX55zuxjX5BmncleXHwjA=;
        b=t5DJf7fv3Bylook3Rc30p6OnvAz+ClbZPy1kIKYlnLwoplLrhpYCPz9srwRlYE4Ps2
         CPNKEMVU20MKqz8ECYHkjo67ZQk4XmYNzfjQd3bI34SyV39IALZMfM07C34zXQ/X1LGx
         r7kFhGoqW29YvhjIrLjVfjFrP0bmrffpgTyam0m0695rZzmf94ifYi8TPp32UMv/PFPQ
         QyayhL9xBRBhn9bsRLX2KkIY6AuDkdg/jAHZPRdrCrFNZ9s28FvrS5WRHSNYYCpowsfi
         GGD9dD9MJe1D0pZ1q/c3xWrgBmWw5hbawQyyFHj1fyxF+wThFok9b8nR7bIEzCiqus1F
         thqQ==
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:in-reply-to:references;
        bh=ZIWZ7P6Tu+R18rQnDng+EGUX55zuxjX5BmncleXHwjA=;
        b=XR5n6QAOtzVuycaSn+XNUlgy27h0i/iOwEpFJHrGlWF4bonZo3bZFa2VHiiXEVGW8K
         sSXj1YyuofAb09qQvTu3DtB9rWhzbwaTMBhMxsF53G3FRSN+n4igqNibbffJqHww3W6V
         lxuQEmCZieSp3VIVrot/OsuWLZTT4eFQqAA1vakncq0E8//3DVOwI/GOqvLBjd8XL9o/
         BpZ/lgnPhoj62jBqP9S3/WnHJpSvRtv8SUgd60W9zNo37J8iGYMHIguV2ATbF+U4663x
         JJGoTZKGXt3YVdjm2fjFonm+8puTZmbE2cCJVk4/aLJ6vfRWCyukDOwb0aBbVDYwTJBR
         dNIA==
X-Gm-Message-State: AOAM531NhLJL75S0VuSOEnkfrJjx9ezztPValqWMApfEP5NibrZFO9kr
	UelAxeUqyGT2eMs153BgN7FYN7YD/M4Hz+um
X-Google-Smtp-Source: ABdhPJwi28rEMUtQmjF8iPYuYi/F3OddR3IJ7cyJHkgOygFHizJC/NFRW5tERRJvbmFyhYtQMkIxuw==
X-Received: by 2002:aa7:da03:: with SMTP id r3mr4678377eds.155.1607030480197;
        Thu, 03 Dec 2020 13:21:20 -0800 (PST)
From: ARGINT DRAGOS IULIAN <dragosargint21@gmail.com>
To: minios-devel@lists.xen.org
Cc: felipe.huici@neclab.eu,
	lrbarbulescu@gmail.com,
	ARGINT DRAGOS IULIAN <dragosargint21@gmail.com>
Subject: [UNIKRAFT/LIBHOGWEED v3 1/3] Add md files
Date: Thu,  3 Dec 2020 23:20:50 +0200
Message-Id: <7cf6506472c164db86771836431fb660af0e9148.1607030251.git.dragosargint21@gmail.com>
X-Mailer: git-send-email 2.17.1
In-Reply-To: <cover.1607030251.git.dragosargint21@gmail.com>
References: <cover.1607030251.git.dragosargint21@gmail.com>
In-Reply-To: <cover.1607030251.git.dragosargint21@gmail.com>
References: <cover.1607030251.git.dragosargint21@gmail.com>

Signed-off-by: ARGINT DRAGOS IULIAN <dragosargint21@gmail.com>
---
 .gitignore      | 27 +++++++++++++++++++++++++++
 CODING_STYLE.md |  4 ++++
 CONTRIBUTING.md |  4 ++++
 COPYING.md      | 39 +++++++++++++++++++++++++++++++++++++++
 MAINTAINERS.md  | 11 +++++++++++
 README.md       | 49 +++++++++++++++++++++++++++++++++++++++++++++++++
 6 files changed, 134 insertions(+)
 create mode 100644 .gitignore
 create mode 100644 CODING_STYLE.md
 create mode 100644 CONTRIBUTING.md
 create mode 100644 COPYING.md
 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..2595ad9
--- /dev/null
+++ b/COPYING.md
@@ -0,0 +1,39 @@
+License
+=======
+
+Unikraft libhogweed wrappers
+----------------------------------
+
+This repository contains wrapper code to build hogweed 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/MAINTAINERS.md b/MAINTAINERS.md
new file mode 100644
index 0000000..6db09e2
--- /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.
+
+	LIBHOGWEED-UNIKRAFT
+	M:	Argint Dragos Iulian <dragosargint21@gmail.com>
+	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..3853914
--- /dev/null
+++ b/README.md
@@ -0,0 +1,49 @@
+Libhogweed for Unikraft
+=============================
+
+This is the port of nettle's libhogweed for Unikraft as external library.
+
+Libhogweed depends on newlib, so please make sure you add the following
+line to the `LIBS` variable in your `Makefile`:
+	`...:$(UK_LIBS)/newlib:$(UK_LIBS)/libhogweed:...`
+
+Testing
+-------
+
+For running the tests: enable the `testsuite` option in the configuration menu
+and select the desired tests. Make sure to include `testutils_glue.h` and call 
+the `run_all_libhogweed_tests(v);` function in your main application. The parameter
+`v` stands for verbose and you can either set it to `0`, non verbose mode, or `1`,
+verbose mode.
+
+Applications
+------------
+
+To run an application that requires a filesystem, you'll need to run them on
+`kvm` and enable `9pfs`, selecting the following menu options, all of them under
+`Library Configuration`:
+- `libnewlib`
+- `libhogweed`
+- `vfscore: VFS Core Interface` ---> `vfscore: Configuration` ---> 
+ `Automatically mount a root filesystem` ---> `Default root filesystem`
+  ---> `9PFS`
+- `uk9p: 9p client`
+- `9pfs: 9p filesystem`
+- `devfs: devfs file system ---> Mount /dev during boot`
+- `ukswrand: Software random number generator ---> Register random and
+ urandom device to devfs`
+
+Mounting a file system
+---------------------
+In order to mount the file system you'll need to provide the following Qemu
+parameters:
+- `-fsdev local,id=myid,path=<some directory>,security_model=none`
+- `-device virtio-9p-pci,fsdev=myid,mount_tag=rootfs,disable-modern=on,
+  disable-legacy=off`
+
+Note that if you use a different `mount_tag`, you'll need to add it in `Default
+root device` in `vfscore configuration`. Also, to provide command line 
+arguments to the kernel, you'll need to use `-append "param1 param2 ..."`.
+	
+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 Thu Dec 03 21:21:32 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Thu, 03 Dec 2020 21:21:32 +0000
Received: from list by lists.xenproject.org with outflank-mailman.43985.78922 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1kkw2e-0006Te-5y; Thu, 03 Dec 2020 21:21:32 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 43985.78922; Thu, 03 Dec 2020 21:21: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 1kkw2e-0006TX-2n; Thu, 03 Dec 2020 21:21:32 +0000
Received: by outflank-mailman (input) for mailman id 43985;
 Thu, 03 Dec 2020 21:21:31 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=2odt=FH=gmail.com=dragosargint21@srs-us1.protection.inumbo.net>)
 id 1kkw2d-0006RU-0I
 for minios-devel@lists.xen.org; Thu, 03 Dec 2020 21:21:31 +0000
Received: from mail-ed1-x52e.google.com (unknown [2a00:1450:4864:20::52e])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 72e527e1-cbdf-416f-b406-a41cbc71216c;
 Thu, 03 Dec 2020 21:21:22 +0000 (UTC)
Received: by mail-ed1-x52e.google.com with SMTP id c7so3662192edv.6
 for <minios-devel@lists.xen.org>; Thu, 03 Dec 2020 13:21:22 -0800 (PST)
Received: from localhost.localdomain ([82.76.50.17])
 by smtp.gmail.com with ESMTPSA id cb21sm1979443edb.57.2020.12.03.13.21.20
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Thu, 03 Dec 2020 13:21:20 -0800 (PST)
X-BeenThere: minios-devel@lists.xenproject.org
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
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: 72e527e1-cbdf-416f-b406-a41cbc71216c
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
         :in-reply-to:references;
        bh=B2Zd2iKMrj3k5C0YBjXzRSE+d1gfYUGwv4cZNv9jXms=;
        b=i0XyJZSuq2Dcku7Ng+r3e/Bnc3rqoLNmQFqa8DtDCbJ0tRUNf9TxJsiqmhQW1BKKSc
         7o5y8qol5rqXp9kQgAQKjZI1pQZUNixr5zEZnYcG3f1MAwZs3PZRXFfTX44z0Uv5SLzt
         PgGhlRTXoxevnY5XYB38Yf1YYTJzCvT86tJ+M4FIJM5BA+uc/RFnXjFvj6OJvz70ij+R
         Od37u41sI7+CHfvQqVFAD08u1ywEwHskm2mUDPK5Ygt3qdJ2nILtoxfae3dHQtmn+X91
         lKu7L7TqY5xyJXUcDUIyqWWXDPgK2Hc0Dv+4QHKLdnTdP5cyJBbx8WKsuIwLJLbX1HrL
         cSog==
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:in-reply-to:references;
        bh=B2Zd2iKMrj3k5C0YBjXzRSE+d1gfYUGwv4cZNv9jXms=;
        b=GcyhXv7KiZILyeCpySosQ+Mydu0kE4SGv8T4FupP5ZYlNT72ULng8yZ65znO4Qhycn
         Enh9AGDbvLGSX7FLp8eOkbZB27gRvPBAjWYyyLDbTo2UIqiBo+xrgI61SFd/TsnJtiUg
         1h44yrJ9yX9hH8h6VPhdB4B1Rnu1oGdtnGWO8nTzXgi9Bo6ACWDIhtzsOftgdLNq1kK5
         V7p9k0hEFMNHcwvHeBRfMwGwOi0qzli/T8tdgkJT5fqZzM20FExSgarCwNQtkJ0lgeBt
         i7QUb5zHqWTPrvcsihMiO8YpUxerdey3r8vm2/42YDtiVPfLRDRQL3z6PkR4Pd5M7JzH
         4Z7Q==
X-Gm-Message-State: AOAM5320VqE09fycydHQV1DlgJMpLBE8gHvcRYHcIBS4MI8UjxiRHxzt
	tWiNCu1G7DkJ8/YJ8np20vlD910UQbKC3guq
X-Google-Smtp-Source: ABdhPJxyKAq12NNLSrpWpk5iQ7Y0hG5poWuUq/G7RG6wYbG/2QuUw+3AoDh9h9/TPeN+ru9JrV0aOw==
X-Received: by 2002:a05:6402:4cf:: with SMTP id n15mr4709916edw.241.1607030481097;
        Thu, 03 Dec 2020 13:21:21 -0800 (PST)
From: ARGINT DRAGOS IULIAN <dragosargint21@gmail.com>
To: minios-devel@lists.xen.org
Cc: felipe.huici@neclab.eu,
	lrbarbulescu@gmail.com,
	ARGINT DRAGOS IULIAN <dragosargint21@gmail.com>
Subject: [UNIKRAFT/LIBHOGWEED v3 2/3] Add Makefile.uk and Config.uk
Date: Thu,  3 Dec 2020 23:20:51 +0200
Message-Id: <fbc37140d325a0bc41b69700b1d2a724d3dac61f.1607030251.git.dragosargint21@gmail.com>
X-Mailer: git-send-email 2.17.1
In-Reply-To: <cover.1607030251.git.dragosargint21@gmail.com>
References: <cover.1607030251.git.dragosargint21@gmail.com>
In-Reply-To: <cover.1607030251.git.dragosargint21@gmail.com>
References: <cover.1607030251.git.dragosargint21@gmail.com>

Signed-off-by: ARGINT DRAGOS IULIAN <dragosargint21@gmail.com>
---
 Config.uk   |  83 +++++++++
 Makefile.uk | 490 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 573 insertions(+)
 create mode 100644 Config.uk
 create mode 100644 Makefile.uk

diff --git a/Config.uk b/Config.uk
new file mode 100644
index 0000000..7f422ee
--- /dev/null
+++ b/Config.uk
@@ -0,0 +1,83 @@
+config LIBHOGWEED
+	bool "libhogweed - Public-key algorithms"
+	default n
+	select LIBNEWLIBC
+
+if LIBHOGWEED
+	menuconfig TESTSUITE
+		bool "testsuite - tests for libhogweed"
+		default n
+		if TESTSUITE
+			config RSA_COMPUTE_ROOT_TEST
+				bool "rsa-compute-root-test"
+				default y
+			config RSA_ENCRYPT_TEST
+				bool "rsa-encrypt-test"
+				default y
+			config RSA_KEYGEN_TEST
+				bool "rsa-keygen-test"
+				default y
+			config RSA_PSS_SIGN_TR_TEST
+				bool "rsa-pss-sign-tr-test"
+				default y
+			config RSA_SEC_DECRYPT_TEST
+				bool "rsa-sec-decrypt-test"
+				default y
+			config RSA_SIGN_TR_TEST
+				bool "rsa-sign-tr-test"
+				default y
+			config RSA_TEST
+				bool "rsa-test"
+				default y
+			config RSA2SEXP_TEST
+				bool "rsa2sexp-test"
+				default y
+			config SEXP2RSA_TEST
+				bool "sexp2rsa-test"
+				default y
+			config CURVE25519_DH_TEST
+				bool "curve25519-dh-test"
+				default y
+			config CURVE448_DH_TEST
+				bool "curve448-dh-test"
+				default y
+			config DSA_KEYGEN_TEST
+				bool "dsa-keygen-test"
+				default y
+			config DSA_TEST
+				bool "dsa-test"
+				default y
+			config ECDSA_KEYGEN_TEST
+				bool "ecdsa-keygen-test"
+				default y
+			config ECDSA_SIGN_TEST
+				bool "ecdsa-sign-test"
+				default y
+			config ECDSA_VERIFY_TEST
+				bool "ecdsa-verify-test"
+				default y
+			config EDDSA_COMPRESS_TEST
+				bool "eddsa-compress-test"
+				default y
+			config EDDSA_SIGN_TEST
+				bool "eddsa-sign-test"
+				default y
+			config EDDSA_VERIFY_TEST
+				bool "eddsa-verify-test"
+				default y
+			config GOSTDSA_KEYGEN_TEST
+				bool "gostdsa-keygen-test"
+				default y
+			config GOSTDSA_SIGN_TEST
+				bool "gostdsa-sign-test"
+				default y
+			config GOSTDSA_VERIFY_TEST
+				bool "gostdsa-verify-test"
+				default y
+			config GOSTDSA_VKO_TEST
+				bool "gostdsa-vko-test"
+				default y
+	endif
+endif
+
+
diff --git a/Makefile.uk b/Makefile.uk
new file mode 100644
index 0000000..666f31b
--- /dev/null
+++ b/Makefile.uk
@@ -0,0 +1,490 @@
+#  SPDX-License-Identifier: BSD-3-Clause
+#
+#  libhogweed Makefile.uk
+#
+#  Authors: Argint Dragos Iulian <dragosargint21@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.
+#
+
+################################################################################
+# Library registration
+################################################################################
+$(eval $(call addlib_s,libhogweed,$(CONFIG_LIBHOGWEED)))
+#$(eval $(call addlib_s,libhogweedglue,$(CONFIG_LIBHOGWEED)))
+
+################################################################################
+# Original sources
+################################################################################
+LIBHOGWEED_VERSION=3.6
+LIBHOGWEED_URL=https://ftp.gnu.org/gnu/nettle/nettle-$(LIBHOGWEED_VERSION).tar.gz
+LIBHOGWEED_PATCHDIR=$(LIBHOGWEED_BASE)/patches
+LIBHOGWEED_SUBDIR=nettle-$(LIBHOGWEED_VERSION)
+$(eval $(call fetch,libhogweed,$(LIBHOGWEED_URL)))
+#$(eval $(call patch,libhogweed,$(LIBHOHWEED_PATCHDIR),$(LIBHOGWEED_SUBDIR)))
+
+################################################################################
+# Helpers
+################################################################################
+LIBHOGWEED_EXTRACTED = $(LIBHOGWEED_ORIGIN)/nettle-$(LIBHOGWEED_VERSION)
+
+################################################################################
+# Library includes
+################################################################################
+LIBHOGWEED_COMMON_INCLUDES-y     += -I$(LIBHOGWEED_BASE)/include
+LIBHOGWEED_COMMON_INCLUDES-y     += -I$(LIBHOGWEED_EXTRACTED)
+LIBHOGWEED_COMMON_INCLUDES-y     += -I$(LIBHOGWEED_EXTRACTED)/testsuite
+CINCLUDES-$(CONFIG_LIBHOGWEED)   += $(LIBHOGWEED_COMMON_INCLUDES-y)
+CXXINCLUDES-$(CONFIG_LIBHOGWEED) += $(LIBHOGWEED_COMMON_INCLUDES-y)
+
+LIBHOGWEED_CINCLUDES   += -I$(LIBHOGWEED_EXTRACTED)
+LIBHOGWEED_CXXINCLUDES += -I$(LIBHOGWEED_EXTRACTED)
+
+################################################################################
+# Global flags
+################################################################################
+# Suppress flags
+LIBHOGWEED_SUPPRESS_FLAGS += -Wno-unused-parameter \
+        -Wno-unused-variable -Wno-unused-value -Wno-unused-function \
+        -Wno-missing-field-initializers -Wno-implicit-fallthrough \
+        -Wno-sign-compare
+LIBHOGWEED_CFLAGS-y   += $(LIBHOGWEED_SUPPRESS_FLAGS) \
+        -Wno-pointer-to-int-cast -Wno-int-to-pointer-cast
+LIBHOGWEED_CXXFLAGS-y += $(LIBHOGWEED_SUPPRESS_FLAGS)
+
+# Preprocessing symbols
+LIBHOGWEED_DEFINES    += -DHAVE_CONFIG_H
+LIBHOGWEED_CFLAGS-y   += $(LIBHOGWEED_DEFINES)
+LIBHOGWEED_CXXFLAGS-y += $(LIBHOGWEED_DEFINES)
+
+################################################################################
+# HOGWEED code -- bignum
+################################################################################
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/bignum.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/bignum-random.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/bignum-random-prime.c
+
+################################################################################
+# HOGWEED code -- yarrow
+################################################################################
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/yarrow256.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/yarrow_key_event.c
+
+################################################################################
+# HOGWEED code -- gmp
+################################################################################
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/mini-gmp.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/gmp-glue.c
+
+################################################################################
+# HOGWEED code -- aes
+################################################################################
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/aes-encrypt.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/aes-decrypt.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/aes-encrypt-internal.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/aes-encrypt-table.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/aes-decrypt-internal.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/aes-set-key-internal.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/aes256-set-encrypt-key.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/aes256-set-decrypt-key.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/aes-invert-internal.c
+
+################################################################################
+# HOGWEED code -- sha
+################################################################################
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/sha1.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/sha1-meta.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/sha1-compress.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/sha256.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/sha256-meta.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/sha256-compress.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/sha512.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/sha512-meta.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/sha512-compress.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/sha3.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/sha3-permute.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/sha3-256.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/sha384-meta.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/sha224-meta.c
+
+################################################################################
+# HOGWEED code -- md5
+################################################################################
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/md5.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/md5-compress.c
+
+################################################################################
+# HOGWEED code -- write
+################################################################################
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/write-be32.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/write-le32.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/write-le64.c
+
+################################################################################
+# HOGWEED code -- buffer
+################################################################################
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/buffer.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/buffer-init.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/realloc.c
+
+################################################################################
+# HOGWEED code -- rsa
+################################################################################
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/rsa.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/rsa-sign.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/rsa-sign-tr.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/rsa-keygen.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/rsa-encrypt.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/rsa-decrypt.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/rsa-decrypt-tr.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/rsa-verify.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/rsa-sha1-sign.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/rsa-sha1-sign-tr.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/rsa-sha1-verify.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/rsa-md5-sign.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/rsa-md5-sign-tr.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/rsa-md5-verify.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/rsa-pss-sha256-sign-tr.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/rsa-pss-sha256-verify.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/rsa-pss-sha512-sign-tr.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/rsa-pss-sha512-verify.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/rsa-pkcs1-sign.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/rsa-pkcs1-sign-tr.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/rsa-pkcs1-verify.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/rsa-sha256-sign.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/rsa-sha256-sign-tr.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/rsa-sha256-verify.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/rsa-sha512-sign.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/rsa-sha512-sign-tr.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/rsa-sha512-verify.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/rsa-sec-decrypt.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/rsa-sec-compute-root.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/rsa2sexp.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/rsa-blind.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/rsa2openpgp.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/pgp-encode.c
+
+################################################################################
+# HOGWEED code -- pss
+################################################################################
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/pss.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/pss-mgf1.c
+
+################################################################################
+# HOGWEED code -- pkcs
+################################################################################
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/pkcs1.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/pkcs1-encrypt.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/pkcs1-decrypt.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/pkcs1-sec-decrypt.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/pkcs1-rsa-sha1.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/pkcs1-rsa-sha256.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/pkcs1-rsa-sha512.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/pkcs1-rsa-digest.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/pkcs1-rsa-md5.c
+
+################################################################################
+# HOGWEED code -- dsa
+################################################################################
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/dsa.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/dsa-sign.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/dsa-hash.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/dsa-verify.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/dsa-keygen.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/dsa-compat.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/dsa-compat-keygen.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/dsa-gen-params.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/dsa-sha1-sign.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/dsa-sha1-verify.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/dsa-sha256-sign.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/dsa-sha256-verify.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/dsa2sexp.c
+
+################################################################################
+# HOGWEED code -- ecdsa
+################################################################################
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/ecdsa-keygen.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/ecdsa-sign.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/ecdsa-verify.c
+
+################################################################################
+# HOGWEED code -- ecc
+################################################################################
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/ecc-a-to-j.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/ecc-add-eh.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/ecc-add-ehh.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/ecc-add-jja.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/ecc-add-jjj.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/ecc-add-th.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/ecc-add-thh.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/ecc-curve25519-modp.s
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/ecc-curve25519.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/ecc-curve448-modp.s
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/ecc-curve448.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/ecc-dup-eh.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/ecc-dup-jj.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/ecc-dup-th.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/ecc-ecdsa-sign.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/ecc-ecdsa-verify.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/ecc-eh-to-a.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/ecc-gost-gc256b.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/ecc-gost-gc512a.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/ecc-gostdsa-sign.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/ecc-gostdsa-verify.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/ecc-hash.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/ecc-j-to-a.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/ecc-mod-arith.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/ecc-mod-inv.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/ecc-mod.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/ecc-mul-a-eh.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/ecc-mul-a.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/ecc-mul-g-eh.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/ecc-mul-g.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/ecc-mul-m.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/ecc-point.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/ecc-random.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/ecc-scalar.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/ecc-secp192r1-modp.s
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/ecc-secp192r1.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/ecc-secp224r1-modp.s
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/ecc-secp224r1.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/ecc-secp256r1-redc.s
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/ecc-secp256r1.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/ecc-secp384r1-modp.s
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/ecc-secp384r1.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/ecc-secp521r1-modp.s
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/ecc-secp521r1.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/ecc-size.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/sec-add-1.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/sec-tabselect.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/cnd-copy.c
+
+################################################################################
+# HOGWEED code -- curve
+################################################################################
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/curve25519-mul.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/curve25519-mul-g.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/curve25519-eh-to-x.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/curve448-mul.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/curve448-mul-g.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/curve448-eh-to-x.c
+
+################################################################################
+# HOGWEED code -- gostdsa
+################################################################################
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/gostdsa-sign.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/gostdsa-verify.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/gostdsa-vko.c
+
+################################################################################
+# HOGWEED code -- eddsa
+################################################################################
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/eddsa-compress.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/eddsa-decompress.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/eddsa-sign.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/eddsa-verify.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/eddsa-expand.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/eddsa-hash.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/eddsa-pubkey.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/ed25519-sha512.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/ed448-shake256.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/shake256.c
+
+################################################################################
+# HOGWEED code -- sexp
+################################################################################
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/sexp.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/sexp2rsa.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/sexp-format.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/sexp2bignum.c
+#LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/sexp-transport-format.c
+
+################################################################################
+# HOGWEED code -- hex encoding
+################################################################################
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/base16-encode.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/base16-decode.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/base64-encode.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/base64-decode.c
+
+################################################################################
+# HOGWEED code -- miscellaneous
+################################################################################
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/knuth-lfib.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/hmac.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/hmac-sha1.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/memxor.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/memxor3.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/cnd-memcpy.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/memeql-sec.c
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/cbc.c
+
+################################################################################
+# HOGWEED code -- tests
+################################################################################
+LIBHOGWEED_SRCS-$(CONFIG_TESTSUITE) += $(LIBHOGWEED_BASE)/testutils_glue.c
+ifeq ($(CONFIG_RSA_COMPUTE_ROOT_TEST),y)
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/testsuite/rsa-compute-root-test.c
+LIBHOGWEED_RSA-COMPUTE-ROOT-TEST_FLAGS-y += -Dtest_main=rsa_compute_root_test
+endif
+ifeq ($(CONFIG_RSA_ENCRYPT_TEST),y)
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/testsuite/rsa-encrypt-test.c
+LIBHOGWEED_RSA-ENCRYPT-TEST_FLAGS-y += -Dtest_main=rsa_encrypt_test
+endif
+ifeq ($(CONFIG_RSA_KEYGEN_TEST),y)
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/testsuite/rsa-keygen-test.c
+LIBHOGWEED_RSA-KEYGEN-TEST_FLAGS-y += -Dtest_main=rsa_keygen_test
+endif
+ifeq ($(CONFIG_RSA_PSS_SIGN_TR_TEST),y)
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/testsuite/rsa-pss-sign-tr-test.c
+LIBHOGWEED_RSA-PSS-SIGN-TR-TEST_FLAGS-y += -Dtest_main=rsa_pss_sign_tr_test
+endif
+ifeq ($(CONFIG_RSA_SEC_DECRYPT_TEST),y)
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/testsuite/rsa-sec-decrypt-test.c
+LIBHOGWEED_RSA-SEC-DECRYPT-TEST_FLAGS-y += -Dtest_main=rsa_sec_decrypt_test
+endif
+ifeq ($(CONFIG_RSA_SIGN_TR_TEST),y)
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/testsuite/rsa-sign-tr-test.c
+LIBHOGWEED_RSA-SIGN-TR-TEST_FLAGS-y += -Dtest_main=rsa_sign_tr_test
+endif
+ifeq ($(CONFIG_RSA_TEST),y)
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/testsuite/rsa-test.c
+LIBHOGWEED_RSA-TEST_FLAGS-y += -Dtest_main=rsa_test
+endif
+ifeq ($(CONFIG_RSA2SEXP_TEST),y)
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/testsuite/rsa2sexp-test.c
+LIBHOGWEED_RSA2SEXP-TEST_FLAGS-y += -Dtest_main=rsa2sexp_test
+endif
+ifeq ($(CONFIG_SEXP2RSA_TEST),y)
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/testsuite/sexp2rsa-test.c
+LIBHOGWEED_SEXP2RSA-TEST_FLAGS-y += -Dtest_main=sexp2rsa_test
+endif
+ifeq ($(CONFIG_CURVE25519_DH_TEST),y)
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/testsuite/curve25519-dh-test.c
+LIBHOGWEED_CURVE25519-DH-TEST_FLAGS-y += -Dtest_main=curve25519_dh_test
+endif
+ifeq ($(CONFIG_CURVE448_DH_TEST),y)
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/testsuite/curve448-dh-test.c
+LIBHOGWEED_CURVE448-DH-TEST_FLAGS-y += -Dtest_main=curve448_dh_test
+endif
+ifeq ($(CONFIG_DSA_KEYGEN_TEST),y)
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/testsuite/dsa-keygen-test.c
+LIBHOGWEED_DSA-KEYGEN-TEST_FLAGS-y += -Dtest_main=dsa_keygen_test
+endif
+ifeq ($(CONFIG_DSA_TEST),y)
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/testsuite/dsa-test.c
+LIBHOGWEED_DSA-TEST_FLAGS-y += -Dtest_main=dsa_test
+endif
+ifeq ($(CONFIG_ECDSA_KEYGEN_TEST),y)
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/testsuite/ecdsa-keygen-test.c
+LIBHOGWEED_ECDSA-KEYGEN-TEST_FLAGS-y += -Dtest_main=ecdsa_keygen_test
+endif
+ifeq ($(CONFIG_ECDSA_SIGN_TEST),y)
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/testsuite/ecdsa-sign-test.c
+LIBHOGWEED_ECDSA-SIGN-TEST_FLAGS-y += -Dtest_main=ecdsa_sign_test
+endif
+ifeq ($(CONFIG_ECDSA_VERIFY_TEST),y)
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/testsuite/ecdsa-verify-test.c
+LIBHOGWEED_ECDSA-VERIFY-TEST_FLAGS-y += -Dtest_main=ecdsa_verify_test
+endif
+ifeq ($(CONFIG_EDDSA_COMPRESS_TEST),y)
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/testsuite/eddsa-compress-test.c
+LIBHOGWEED_EDDSA-COMPRESS-TEST_FLAGS-y += -Dtest_main=eddsa_compress_test
+endif
+ifeq ($(CONFIG_EDDSA_SIGN_TEST),y)
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/testsuite/eddsa-sign-test.c
+LIBHOGWEED_EDDSA-SIGN-TEST_FLAGS-y += -Dtest_main=eddsa_sign_test
+endif
+ifeq ($(CONFIG_EDDSA_VERIFY_TEST),y)
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/testsuite/eddsa-verify-test.c
+LIBHOGWEED_EDDSA-VERIFY-TEST_FLAGS-y += -Dtest_main=eddsa_verify_test
+endif
+ifeq ($(CONFIG_GOSTDSA_KEYGEN_TEST),y)
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/testsuite/gostdsa-keygen-test.c
+LIBHOGWEED_GOSTDSA-KEYGEN-TEST_FLAGS-y += -Dtest_main=gostdsa_keygen_test
+endif
+ifeq ($(CONFIG_GOSTDSA_SIGN_TEST),y)
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/testsuite/gostdsa-sign-test.c
+LIBHOGWEED_GOSTDSA-SIGN-TEST_FLAGS-y += -Dtest_main=gostdsa_sign_test
+endif
+ifeq ($(CONFIG_GOSTDSA_VERIFY_TEST),y)
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/testsuite/gostdsa-verify-test.c
+LIBHOGWEED_GOSTDSA-VERIFY-TEST_FLAGS-y += -Dtest_main=gostdsa_verify_test
+endif
+ifeq ($(CONFIG_GOSTDSA_VKO_TEST),y)
+LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/testsuite/gostdsa-vko-test.c
+LIBHOGWEED_GOSTDSA-VKO-TEST_FLAGS-y += -Dtest_main=gostdsa_vko_test
+endif
+
+
+
+################################################################################
+# HOGWEED prepare
+################################################################################
+# Run ./configure
+$(LIBHOGWEED_EXTRACTED)/config.h: $(LIBHOGWEED_BUILD)/.origin
+	$(call verbose_cmd,CONFIG,libhogweed: $(notdir $@), \
+        cd $(LIBHOGWEED_EXTRACTED) && ./configure --enable-mini-gmp \
+    )
+
+# Generate auxiliar files using the original building system
+$(LIBHOGWEED_EXTRACTED)/make_auxiliar: $(LIBHOGWEED_BUILD)/.origin
+	$(call verbose_cmd,CONFIG,libhogweed: $(notdir $@), \
+        cd $(LIBHOGWEED_EXTRACTED) && \
+        make ecc-secp192r1.h && \
+        make ecc-secp224r1.h && \
+        make ecc-secp256r1.h && \
+       	make ecc-secp384r1.h && \
+        make ecc-secp521r1.h && \
+        make ecc-curve25519.h && \
+        make ecc-curve448.h && \
+        make ecc-gost-gc256b.h && \
+        make ecc-gost-gc512a.h && \
+        /usr/bin/m4 ./asm.m4 machine.m4 config.m4 ecc-curve25519-modp.asm \
+        	> ecc-curve25519-modp.s && \
+        /usr/bin/m4 ./asm.m4 machine.m4 config.m4 ecc-curve448-modp.asm \
+        	> ecc-curve448-modp.s && \
+        /usr/bin/m4 ./asm.m4 machine.m4 config.m4 ecc-secp192r1-modp.asm \
+        	> ecc-secp192r1-modp.s && \
+        /usr/bin/m4 ./asm.m4 machine.m4 config.m4 ecc-secp224r1-modp.asm \
+            > ecc-secp224r1-modp.s && \
+        /usr/bin/m4 ./asm.m4 machine.m4 config.m4 ecc-secp256r1-redc.asm \
+        	> ecc-secp256r1-redc.s && \
+        /usr/bin/m4 ./asm.m4 machine.m4 config.m4 ecc-secp384r1-modp.asm \
+        	> ecc-secp384r1-modp.s && \
+        /usr/bin/m4 ./asm.m4 machine.m4 config.m4 ecc-secp521r1-modp.asm \
+        	> ecc-secp521r1-modp.s && \
+        echo "done" > make_auxiliar \
+    )
+
+LIBHOGWEED_PREPARED_DEPS = $(LIBHOGWEED_EXTRACTED)/config.h \
+							$(LIBHOGWEED_EXTRACTED)/make_auxiliar
+
+$(LIBHOGWEED_BUILD)/.prepared: $(LIBHOGWEED_PREPARED_DEPS)
+
+UK_PREPARE += $(LIBHOGWEED_BUILD)/.prepared
-- 
2.17.1



From minios-devel-bounces@lists.xenproject.org Thu Dec 03 21:21:37 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Thu, 03 Dec 2020 21:21:37 +0000
Received: from list by lists.xenproject.org with outflank-mailman.43986.78926 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1kkw2j-0006Uz-8l; Thu, 03 Dec 2020 21:21:37 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 43986.78926; Thu, 03 Dec 2020 21:21: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 1kkw2j-0006Us-5i; Thu, 03 Dec 2020 21:21:37 +0000
Received: by outflank-mailman (input) for mailman id 43986;
 Thu, 03 Dec 2020 21:21:36 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=2odt=FH=gmail.com=dragosargint21@srs-us1.protection.inumbo.net>)
 id 1kkw2i-0006RU-0X
 for minios-devel@lists.xen.org; Thu, 03 Dec 2020 21:21:36 +0000
Received: from mail-ed1-x530.google.com (unknown [2a00:1450:4864:20::530])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id c2355e94-e4ae-4309-af8f-ce0e1f7605e4;
 Thu, 03 Dec 2020 21:21:23 +0000 (UTC)
Received: by mail-ed1-x530.google.com with SMTP id d18so3653755edt.7
 for <minios-devel@lists.xen.org>; Thu, 03 Dec 2020 13:21:23 -0800 (PST)
Received: from localhost.localdomain ([82.76.50.17])
 by smtp.gmail.com with ESMTPSA id cb21sm1979443edb.57.2020.12.03.13.21.21
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Thu, 03 Dec 2020 13:21:21 -0800 (PST)
X-BeenThere: minios-devel@lists.xenproject.org
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
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: c2355e94-e4ae-4309-af8f-ce0e1f7605e4
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
         :in-reply-to:references;
        bh=KFlDAgOWWU6SYWJr7Pqg2Vmeh4tzD78oMFqnrkvcDeM=;
        b=m9PV6/JEZzDcKH9YkiM4L9mRSOumvXKeipTssFL1+rck+cepwY4UT4shQc+4aaKkGv
         qFaPDOxuiSguUveMS0PRc2iSiMEu4qsnzegrFnkHgoCiH6zRGOloeW/lvFKXAqzWoU8p
         4Ws4l7/1vgE+RvzMlax1M6ztWQY4xLCU1riWfWhwo6OJjsXGp6LB7SYyQwpO8FB85pCv
         kKb1O7OgqANswzE1X7IwVGOU8+vCTn9u6k10Sh5ZfR39BlZ1HPOBwaRnqe3V5MKrgcX7
         TdxcQuVyxmwz2J2QMF2pLrKLSYXUWMUXzF3odipBqKuXj4r8+tv83cuOtngMwfO0SVVs
         u7XA==
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:in-reply-to:references;
        bh=KFlDAgOWWU6SYWJr7Pqg2Vmeh4tzD78oMFqnrkvcDeM=;
        b=l3asf6rAlhaLfCwNgStGJCHIXbErJfrJ21VT0faAkOY0VGH+tl6Ajygcy8A8M8+5Na
         3FO7C7Cnpws8IQrsJhCQIw3yR1t6Lw7lymS3pEbJRG+8BGNXKBhX+Yhl+heJPOo6JaRA
         kzI75NSTgsRJu0j8erwiMxV0LIPQI1hMoZAsmTbVx8B595a7keELOBOeynukBhIZHyx8
         rBC3Tmmo6VsRr/IK5bOuO4lB63eUaMKYSgwnGjv2ofhPMyEWwqwaNQ/gwL/VaDf79EFC
         6PsPsHeRQxHUZErIgTK+4RInuzpYoGfud6bIowU3spxpGcr/hYTGxjc/Y+pxJ+LAlU6U
         DM0Q==
X-Gm-Message-State: AOAM530bp8kt7nxUx7mC4XhHjmDS00ir5UtocA2SdNqi2ACH/MRjPGiW
	rZtuG2IjqkdgH3D7K+6B7kTnOK7x1KOamlFd
X-Google-Smtp-Source: ABdhPJxTESEs5QZTnnZcJlo13s5E/u93q3nEEZjpuPX5JeyQHLOYTmLNlM2aIyUX0g5VvVD1g1HTIg==
X-Received: by 2002:a50:f307:: with SMTP id p7mr4660993edm.368.1607030482275;
        Thu, 03 Dec 2020 13:21:22 -0800 (PST)
From: ARGINT DRAGOS IULIAN <dragosargint21@gmail.com>
To: minios-devel@lists.xen.org
Cc: felipe.huici@neclab.eu,
	lrbarbulescu@gmail.com,
	ARGINT DRAGOS IULIAN <dragosargint21@gmail.com>
Subject: [UNIKRAFT/LIBHOGWEED v3 3/3] Add glue code
Date: Thu,  3 Dec 2020 23:20:52 +0200
Message-Id: <df5df104a8f99e4803fd2065f0338ee9a7fa6e2c.1607030251.git.dragosargint21@gmail.com>
X-Mailer: git-send-email 2.17.1
In-Reply-To: <cover.1607030251.git.dragosargint21@gmail.com>
References: <cover.1607030251.git.dragosargint21@gmail.com>
In-Reply-To: <cover.1607030251.git.dragosargint21@gmail.com>
References: <cover.1607030251.git.dragosargint21@gmail.com>

Signed-off-by: ARGINT DRAGOS IULIAN <dragosargint21@gmail.com>
---
 include/testutils_glue.h |  26 ++
 testutils_glue.c         | 808 +++++++++++++++++++++++++++++++++++++++
 2 files changed, 834 insertions(+)
 create mode 100644 include/testutils_glue.h
 create mode 100644 testutils_glue.c

diff --git a/include/testutils_glue.h b/include/testutils_glue.h
new file mode 100644
index 0000000..6213879
--- /dev/null
+++ b/include/testutils_glue.h
@@ -0,0 +1,26 @@
+void rsa_compute_root_test(void);
+void rsa_compute_root_test(void);
+void rsa_encrypt_test(void);
+void rsa_keygen_test(void);
+void rsa_pss_sign_tr_test(void);
+void rsa_sec_decrypt_test(void);
+void rsa_sign_tr_test(void);
+void rsa_test(void);
+void rsa2sexp_test(void);
+void sexp2rsa_test(void);
+void curve25519_dh_test(void);
+void curve448_dh_test(void);
+void dsa_keygen_test(void);
+void dsa_test(void);
+void ecdsa_keygen_test(void);
+void ecdsa_sign_test(void);
+void ecdsa_verify_test(void);
+void eddsa_compress_test(void);
+void eddsa_sign_test(void);
+void eddsa_verify_test(void);
+void gostdsa_keygen_test(void);
+void gostdsa_sign_test(void);
+void gostdsa_verify_test(void);
+void gostdsa_vko_test(void);
+int run_all_libhogweed_tests(int v);
+
diff --git a/testutils_glue.c b/testutils_glue.c
new file mode 100644
index 0000000..1832d92
--- /dev/null
+++ b/testutils_glue.c
@@ -0,0 +1,808 @@
+/* testutils_glue.c */
+
+#include "testutils.h"
+#include "testutils_glue.h"
+#include "base16.h"
+#include "cbc.h"
+#include "cfb.h"
+#include "ctr.h"
+#include "knuth-lfib.h"
+#include "macros.h"
+#include "nettle-internal.h"
+#include "uk/config.h"
+#include <assert.h>
+#include <ctype.h>
+
+void
+die(const char *format, ...)
+{
+  va_list args;
+  va_start(args, format);
+  vfprintf(stderr, format, args);
+  va_end(args);
+
+  abort ();
+}
+
+void *
+xalloc(size_t size)
+{
+  void *p = malloc(size);
+  if (size && !p)
+    {
+      fprintf(stderr, "Virtual memory exhausted.\n");
+      abort();
+    }
+
+  return p;
+}
+
+static struct tstring *tstring_first = NULL;
+
+struct tstring *
+tstring_alloc (size_t length)
+{
+  struct tstring *s = xalloc(sizeof(struct tstring) + length);
+  s->length = length;
+  s->next = tstring_first;
+  /* NUL-terminate, for convenience. */
+  s->data[length] = '\0';
+  tstring_first = s;
+  return s;
+}
+
+void
+tstring_clear(void)
+{
+  while (tstring_first)
+    {
+      struct tstring *s = tstring_first;
+      tstring_first = s->next;
+      free(s);
+    }
+}
+
+struct tstring *
+tstring_data(size_t length, const uint8_t *data)
+{
+  struct tstring *s = tstring_alloc (length);
+  memcpy (s->data, data, length);
+  return s;
+}
+
+struct tstring *
+tstring_hex(const char *hex)
+{
+  struct base16_decode_ctx ctx;
+  struct tstring *s;
+  size_t length = strlen(hex);
+
+  s = tstring_alloc(BASE16_DECODE_LENGTH (length));
+  base16_decode_init (&ctx);
+  ASSERT (base16_decode_update (&ctx, &s->length, s->data,
+				length, hex));
+  ASSERT (base16_decode_final (&ctx));
+
+  return s;
+}
+
+void
+tstring_print_hex(const struct tstring *s)
+{
+  print_hex (s->length, s->data);
+}
+
+void
+print_hex(size_t length, const uint8_t *data)
+{
+  size_t i;
+  
+  for (i = 0; i < length; i++)
+    {
+      switch (i % 16)
+	{
+	default:
+	  break;
+	case 0:
+	  printf("\n");
+	  break;
+	case 8:
+	  printf(" ");
+	  break;
+	}
+      printf("%02x", data[i]);
+    }
+  printf("\n");
+}
+
+int verbose = 0;
+
+void
+mpn_out_str (FILE *f, int base, const mp_limb_t *xp, mp_size_t xn)
+{
+  mpz_t x;
+  mpz_out_str (f, base, mpz_roinit_n (x, xp, xn));
+}
+
+#if NETTLE_USE_MINI_GMP
+void
+gmp_randinit_default (struct knuth_lfib_ctx *ctx)
+{
+  knuth_lfib_init (ctx, 17);
+}
+void
+mpz_urandomb (mpz_t r, struct knuth_lfib_ctx *ctx, mp_bitcnt_t bits)
+{
+  size_t bytes = (bits+7)/8;
+  uint8_t *buf = xalloc (bytes);
+
+  knuth_lfib_random (ctx, bytes, buf);
+  buf[0] &= 0xff >> (8*bytes - bits);
+  nettle_mpz_set_str_256_u (r, bytes, buf);
+  free (buf);
+}
+#endif /* NETTLE_USE_MINI_GMP */
+
+mp_limb_t *
+xalloc_limbs (mp_size_t n)
+{
+  return xalloc (n * sizeof (mp_limb_t));
+}
+
+/* Expects local variables pub, key, rstate, digest, signature */
+#define SIGN(hash, msg, expected) do { \
+  hash##_update(&hash, LDATA(msg));					\
+  ASSERT(rsa_##hash##_sign(key, &hash, signature));			\
+  if (verbose)								\
+    {									\
+      fprintf(stderr, "rsa-%s signature: ", #hash);			\
+      mpz_out_str(stderr, 16, signature);				\
+      fprintf(stderr, "\n");						\
+    }									\
+  ASSERT(mpz_cmp (signature, expected) == 0);				\
+									\
+  hash##_update(&hash, LDATA(msg));					\
+  ASSERT(rsa_##hash##_sign_tr(pub, key, &rstate,			\
+			      (nettle_random_func *) knuth_lfib_random,	\
+			      &hash, signature));			\
+  ASSERT(mpz_cmp (signature, expected) == 0);				\
+									\
+  hash##_update(&hash, LDATA(msg));					\
+  hash##_digest(&hash, sizeof(digest), digest);				\
+  ASSERT(rsa_##hash##_sign_digest(key, digest, signature));		\
+  ASSERT(mpz_cmp (signature, expected) == 0);				\
+									\
+  ASSERT(rsa_##hash##_sign_digest_tr(pub, key, &rstate,			\
+				     (nettle_random_func *)knuth_lfib_random, \
+				     digest, signature));		\
+  ASSERT(mpz_cmp (signature, expected) == 0);				\
+} while(0)
+
+#define VERIFY(key, hash, msg, signature) (	\
+  hash##_update(&hash, LDATA(msg)),		\
+  rsa_##hash##_verify(key, &hash, signature)	\
+)
+
+void
+test_rsa_set_key_1(struct rsa_public_key *pub,
+		   struct rsa_private_key *key)
+{
+  /* Initialize key pair for test programs */
+  /* 1000-bit key, generated by
+   *
+   *   lsh-keygen -a rsa -l 1000 -f advanced-hex
+   *
+   * (private-key (rsa-pkcs1 
+   *        (n #69abd505285af665 36ddc7c8f027e6f0 ed435d6748b16088
+   *            4fd60842b3a8d7fb bd8a3c98f0cc50ae 4f6a9f7dd73122cc
+   *            ec8afa3f77134406 f53721973115fc2d 8cfbba23b145f28d
+   *            84f81d3b6ae8ce1e 2850580c026e809b cfbb52566ea3a3b3
+   *            df7edf52971872a7 e35c1451b8636d22 279a8fb299368238
+   *            e545fbb4cf#)
+   *        (e #0db2ad57#)
+   *        (d #3240a56f4cd0dcc2 4a413eb4ea545259 5c83d771a1c2ba7b
+   *            ec47c5b43eb4b374 09bd2aa1e236dd86 481eb1768811412f
+   *            f8d91be3545912af b55c014cb55ceac6 54216af3b85d5c4f
+   *            4a32894e3b5dfcde 5b2875aa4dc8d9a8 6afd0ca92ef50d35
+   *            bd09f1c47efb4c8d c631e07698d362aa 4a83fd304e66d6c5
+   *            468863c307#)
+   *        (p #0a66399919be4b4d e5a78c5ea5c85bf9 aba8c013cb4a8732
+   *            14557a12bd67711e bb4073fd39ad9a86 f4e80253ad809e5b
+   *            f2fad3bc37f6f013 273c9552c9f489#)
+   *        (q #0a294f069f118625 f5eae2538db9338c 776a298eae953329
+   *            9fd1eed4eba04e82 b2593bc98ba8db27 de034da7daaea795
+   *            2d55b07b5f9a5875 d1ca5f6dcab897#)
+   *        (a #011b6c48eb592eee e85d1bb35cfb6e07 344ea0b5e5f03a28
+   *            5b405396cbc78c5c 868e961db160ba8d 4b984250930cf79a
+   *            1bf8a9f28963de53 128aa7d690eb87#)
+   *        (b #0409ecf3d2557c88 214f1af5e1f17853 d8b2d63782fa5628
+   *            60cf579b0833b7ff 5c0529f2a97c6452 2fa1a8878a9635ab
+   *            ce56debf431bdec2 70b308fa5bf387#)
+   *        (c #04e103ee925cb5e6 6653949fa5e1a462 c9e65e1adcd60058
+   *            e2df9607cee95fa8 daec7a389a7d9afc 8dd21fef9d83805a
+   *            40d46f49676a2f6b 2926f70c572c00#)))
+   */
+  
+  mpz_set_str(pub->n,
+	      "69abd505285af665" "36ddc7c8f027e6f0" "ed435d6748b16088"
+	      "4fd60842b3a8d7fb" "bd8a3c98f0cc50ae" "4f6a9f7dd73122cc"
+	      "ec8afa3f77134406" "f53721973115fc2d" "8cfbba23b145f28d"
+	      "84f81d3b6ae8ce1e" "2850580c026e809b" "cfbb52566ea3a3b3"
+	      "df7edf52971872a7" "e35c1451b8636d22" "279a8fb299368238"
+	      "e545fbb4cf", 16);
+  mpz_set_str(pub->e, "0db2ad57", 16);
+
+  ASSERT (rsa_public_key_prepare(pub));
+  
+  /* d is not used */
+#if 0  
+  mpz_set_str(key->d,
+	      "3240a56f4cd0dcc2" "4a413eb4ea545259" "5c83d771a1c2ba7b"
+	      "ec47c5b43eb4b374" "09bd2aa1e236dd86" "481eb1768811412f"
+	      "f8d91be3545912af" "b55c014cb55ceac6" "54216af3b85d5c4f"
+	      "4a32894e3b5dfcde" "5b2875aa4dc8d9a8" "6afd0ca92ef50d35"
+	      "bd09f1c47efb4c8d" "c631e07698d362aa" "4a83fd304e66d6c5"
+	      "468863c307", 16);
+#endif
+  
+  mpz_set_str(key->p,
+	      "0a66399919be4b4d" "e5a78c5ea5c85bf9" "aba8c013cb4a8732"
+	      "14557a12bd67711e" "bb4073fd39ad9a86" "f4e80253ad809e5b"
+	      "f2fad3bc37f6f013" "273c9552c9f489", 16);
+
+  mpz_set_str(key->q,
+	      "0a294f069f118625" "f5eae2538db9338c" "776a298eae953329"
+	      "9fd1eed4eba04e82" "b2593bc98ba8db27" "de034da7daaea795"
+	      "2d55b07b5f9a5875" "d1ca5f6dcab897", 16);
+  
+  mpz_set_str(key->a,
+	      "011b6c48eb592eee" "e85d1bb35cfb6e07" "344ea0b5e5f03a28"
+	      "5b405396cbc78c5c" "868e961db160ba8d" "4b984250930cf79a"
+	      "1bf8a9f28963de53" "128aa7d690eb87", 16);
+  
+  mpz_set_str(key->b,
+	      "0409ecf3d2557c88" "214f1af5e1f17853" "d8b2d63782fa5628"
+	      "60cf579b0833b7ff" "5c0529f2a97c6452" "2fa1a8878a9635ab"
+	      "ce56debf431bdec2" "70b308fa5bf387", 16);
+  
+  mpz_set_str(key->c,
+	      "04e103ee925cb5e6" "6653949fa5e1a462" "c9e65e1adcd60058"
+	      "e2df9607cee95fa8" "daec7a389a7d9afc" "8dd21fef9d83805a"
+	      "40d46f49676a2f6b" "2926f70c572c00", 16);
+
+  ASSERT (rsa_private_key_prepare(key));
+  ASSERT (pub->size == key->size);
+}
+
+void
+test_rsa_md5(struct rsa_public_key *pub,
+	     struct rsa_private_key *key,
+	     mpz_t expected)
+{
+  struct md5_ctx md5;
+  struct knuth_lfib_ctx rstate;
+  uint8_t digest[MD5_DIGEST_SIZE];
+  mpz_t signature;
+
+  md5_init(&md5);
+  mpz_init(signature);
+  knuth_lfib_init (&rstate, 15);
+
+  SIGN(md5, "The magic words are squeamish ossifrage", expected);
+
+  /* Try bad data */
+  ASSERT (!VERIFY(pub, md5,
+		  "The magick words are squeamish ossifrage", signature));
+
+  /* Try correct data */
+  ASSERT (VERIFY(pub, md5,
+		 "The magic words are squeamish ossifrage", signature));
+
+  /* Try bad signature */
+  mpz_combit(signature, 17);
+  ASSERT (!VERIFY(pub, md5,
+		  "The magic words are squeamish ossifrage", signature));
+
+  mpz_clear(signature);
+}
+
+void
+test_rsa_sha1(struct rsa_public_key *pub,
+	      struct rsa_private_key *key,
+	      mpz_t expected)
+{
+  struct sha1_ctx sha1;
+  struct knuth_lfib_ctx rstate;
+  uint8_t digest[SHA1_DIGEST_SIZE];
+  mpz_t signature;
+
+  sha1_init(&sha1);
+  mpz_init(signature);
+  knuth_lfib_init (&rstate, 16);
+
+  SIGN(sha1, "The magic words are squeamish ossifrage", expected);
+
+  /* Try bad data */
+  ASSERT (!VERIFY(pub, sha1,
+		  "The magick words are squeamish ossifrage", signature));
+
+  /* Try correct data */
+  ASSERT (VERIFY(pub, sha1,
+		 "The magic words are squeamish ossifrage", signature));
+
+  /* Try bad signature */
+  mpz_combit(signature, 17);
+  ASSERT (!VERIFY(pub, sha1,
+		  "The magic words are squeamish ossifrage", signature));
+
+  mpz_clear(signature);
+}
+
+void
+test_rsa_sha256(struct rsa_public_key *pub,
+		struct rsa_private_key *key,
+		mpz_t expected)
+{
+  struct sha256_ctx sha256;
+  struct knuth_lfib_ctx rstate;
+  uint8_t digest[SHA256_DIGEST_SIZE];
+  mpz_t signature;
+
+  sha256_init(&sha256);
+  mpz_init(signature);
+  knuth_lfib_init (&rstate, 17);
+
+  SIGN(sha256, "The magic words are squeamish ossifrage", expected);
+
+  /* Try bad data */
+  ASSERT (!VERIFY(pub, sha256,
+		  "The magick words are squeamish ossifrage", signature));
+
+  /* Try correct data */
+  ASSERT (VERIFY(pub, sha256,
+		 "The magic words are squeamish ossifrage", signature));
+
+  /* Try bad signature */
+  mpz_combit(signature, 17);
+  ASSERT (!VERIFY(pub, sha256,
+		  "The magic words are squeamish ossifrage", signature));
+
+  mpz_clear(signature);
+}
+
+void
+test_rsa_sha512(struct rsa_public_key *pub,
+		struct rsa_private_key *key,
+		mpz_t expected)
+{
+  struct sha512_ctx sha512;
+  struct knuth_lfib_ctx rstate;
+  uint8_t digest[SHA512_DIGEST_SIZE];
+  mpz_t signature;
+
+  sha512_init(&sha512);
+  mpz_init(signature);
+  knuth_lfib_init (&rstate, 18);
+
+  SIGN(sha512, "The magic words are squeamish ossifrage", expected);
+
+  /* Try bad data */
+  ASSERT (!VERIFY(pub, sha512,
+		  "The magick words are squeamish ossifrage", signature));
+
+  /* Try correct data */
+  ASSERT (VERIFY(pub, sha512,
+		 "The magic words are squeamish ossifrage", signature));
+
+  /* Try bad signature */
+  mpz_combit(signature, 17);
+  ASSERT (!VERIFY(pub, sha512,
+		  "The magic words are squeamish ossifrage", signature));
+
+  mpz_clear(signature);
+}
+
+#undef SIGN
+#undef VERIFY
+
+void
+test_rsa_key(struct rsa_public_key *pub,
+	     struct rsa_private_key *key)
+{
+  mpz_t tmp;
+  mpz_t phi;
+  
+  mpz_init(tmp); mpz_init(phi);
+  
+  if (verbose)
+    {
+      /* FIXME: Use gmp_printf */
+      fprintf(stderr, "Public key: n=");
+      mpz_out_str(stderr, 16, pub->n);
+      fprintf(stderr, "\n    e=");
+      mpz_out_str(stderr, 16, pub->e);
+
+      fprintf(stderr, "\n\nPrivate key: d=");
+      mpz_out_str(stderr, 16, key->d);
+      fprintf(stderr, "\n    p=");
+      mpz_out_str(stderr, 16, key->p);
+      fprintf(stderr, "\n    q=");
+      mpz_out_str(stderr, 16, key->q);
+      fprintf(stderr, "\n    a=");
+      mpz_out_str(stderr, 16, key->a);
+      fprintf(stderr, "\n    b=");
+      mpz_out_str(stderr, 16, key->b);
+      fprintf(stderr, "\n    c=");
+      mpz_out_str(stderr, 16, key->c);
+      fprintf(stderr, "\n\n");
+    }
+
+  /* Check n = p q */
+  mpz_mul(tmp, key->p, key->q);
+  ASSERT (mpz_cmp(tmp, pub->n)== 0);
+
+  /* Check c q = 1 mod p */
+  mpz_mul(tmp, key->c, key->q);
+  mpz_fdiv_r(tmp, tmp, key->p);
+  ASSERT (mpz_cmp_ui(tmp, 1) == 0);
+
+  /* Check ed = 1 (mod phi) */
+  mpz_sub_ui(phi, key->p, 1);
+  mpz_sub_ui(tmp, key->q, 1);
+
+  mpz_mul(phi, phi, tmp);
+
+  mpz_mul(tmp, pub->e, key->d);
+  mpz_fdiv_r(tmp, tmp, phi);
+  ASSERT (mpz_cmp_ui(tmp, 1) == 0);
+
+  /* Check a e = 1 (mod (p-1) ) */
+  mpz_sub_ui(phi, key->p, 1);
+  mpz_mul(tmp, pub->e, key->a);
+  mpz_fdiv_r(tmp, tmp, phi);
+  ASSERT (mpz_cmp_ui(tmp, 1) == 0);
+  
+  /* Check b e = 1 (mod (q-1) ) */
+  mpz_sub_ui(phi, key->q, 1);
+  mpz_mul(tmp, pub->e, key->b);
+  mpz_fdiv_r(tmp, tmp, phi);
+  ASSERT (mpz_cmp_ui(tmp, 1) == 0);
+  
+  mpz_clear(tmp); mpz_clear(phi);
+}
+
+/* Requires that the context is named like the hash algorithm. */
+#define DSA_VERIFY(key, hash, msg, signature)	\
+  (hash##_update(&hash, LDATA(msg)),		\
+   dsa_##hash##_verify(key, &hash, signature))
+
+void
+test_dsa160(const struct dsa_public_key *pub,
+	    const struct dsa_private_key *key,
+	    const struct dsa_signature *expected)
+{
+  struct sha1_ctx sha1;
+  struct dsa_signature signature;
+  struct knuth_lfib_ctx lfib;
+  
+  sha1_init(&sha1);
+  dsa_signature_init(&signature);
+  knuth_lfib_init(&lfib, 1111);
+  
+  sha1_update(&sha1, LDATA("The magic words are squeamish ossifrage"));
+  ASSERT (dsa_sha1_sign(pub, key,
+			&lfib, (nettle_random_func *) knuth_lfib_random,
+			&sha1, &signature));
+
+  if (verbose)
+    {
+      fprintf(stderr, "dsa160 signature: ");
+      mpz_out_str(stderr, 16, signature.r);
+      fprintf(stderr, ", ");
+      mpz_out_str(stderr, 16, signature.s);
+      fprintf(stderr, "\n");
+    }
+
+  if (expected)
+    ASSERT (mpz_cmp (signature.r, expected->r) == 0
+	    && mpz_cmp (signature.s, expected->s) == 0);
+  
+  /* Try bad data */
+  ASSERT (!DSA_VERIFY(pub, sha1,
+		      "The magick words are squeamish ossifrage",
+		      &signature));
+
+  /* Try correct data */
+  ASSERT (DSA_VERIFY(pub, sha1,
+		     "The magic words are squeamish ossifrage",
+		     &signature));
+
+  /* Try bad signature */
+  mpz_combit(signature.r, 17);
+  ASSERT (!DSA_VERIFY(pub, sha1,
+		      "The magic words are squeamish ossifrage",
+		      &signature));
+
+  dsa_signature_clear(&signature);
+}
+
+void
+test_dsa256(const struct dsa_public_key *pub,
+	    const struct dsa_private_key *key,
+	    const struct dsa_signature *expected)
+{
+  struct sha256_ctx sha256;
+  struct dsa_signature signature;
+  struct knuth_lfib_ctx lfib;
+  
+  sha256_init(&sha256);
+  dsa_signature_init(&signature);
+  knuth_lfib_init(&lfib, 1111);
+  
+  sha256_update(&sha256, LDATA("The magic words are squeamish ossifrage"));
+  ASSERT (dsa_sha256_sign(pub, key,
+			&lfib, (nettle_random_func *) knuth_lfib_random,
+			&sha256, &signature));
+  
+  if (verbose)
+    {
+      fprintf(stderr, "dsa256 signature: ");
+      mpz_out_str(stderr, 16, signature.r);
+      fprintf(stderr, ", ");
+      mpz_out_str(stderr, 16, signature.s);
+      fprintf(stderr, "\n");
+    }
+
+  if (expected)
+    ASSERT (mpz_cmp (signature.r, expected->r) == 0
+	    && mpz_cmp (signature.s, expected->s) == 0);
+  
+  /* Try bad data */
+  ASSERT (!DSA_VERIFY(pub, sha256,
+		      "The magick words are squeamish ossifrage",
+		      &signature));
+
+  /* Try correct data */
+  ASSERT (DSA_VERIFY(pub, sha256,
+		     "The magic words are squeamish ossifrage",
+		     &signature));
+
+  /* Try bad signature */
+  mpz_combit(signature.r, 17);
+  ASSERT (!DSA_VERIFY(pub, sha256,
+		      "The magic words are squeamish ossifrage",
+		      &signature));
+
+  dsa_signature_clear(&signature);
+}
+
+
+void
+test_dsa_verify(const struct dsa_params *params,
+		const mpz_t pub,
+		const struct nettle_hash *hash,
+		struct tstring *msg,
+		const struct dsa_signature *ref)
+{
+  void *ctx = xalloc (hash->context_size);
+  uint8_t *digest = xalloc (hash->digest_size);
+  struct dsa_signature signature;
+
+  dsa_signature_init (&signature);
+
+  hash->init(ctx);
+  
+  hash->update (ctx, msg->length, msg->data);
+  hash->digest (ctx, hash->digest_size, digest);
+
+  mpz_set (signature.r, ref->r);
+  mpz_set (signature.s, ref->s);
+
+  ASSERT (dsa_verify (params, pub,
+		       hash->digest_size, digest,
+		       &signature));
+
+  /* Try bad signature */
+  mpz_combit(signature.r, 17);
+  ASSERT (!dsa_verify (params, pub,
+		       hash->digest_size, digest,
+		       &signature));
+  
+  /* Try bad data */
+  digest[hash->digest_size / 2-1] ^= 8;
+  ASSERT (!dsa_verify (params, pub,
+		       hash->digest_size, digest,
+		       ref));
+
+  free (ctx);
+  free (digest);
+  dsa_signature_clear(&signature);  
+}
+
+void
+test_dsa_key(const struct dsa_params *params,
+	     const mpz_t pub,
+	     const mpz_t key,
+	     unsigned q_size)
+{
+  mpz_t t;
+
+  mpz_init(t);
+
+  ASSERT(mpz_sizeinbase(params->q, 2) == q_size);
+  ASSERT(mpz_sizeinbase(params->p, 2) >= DSA_SHA1_MIN_P_BITS);
+  
+  ASSERT(mpz_probab_prime_p(params->p, 10));
+
+  ASSERT(mpz_probab_prime_p(params->q, 10));
+
+  mpz_fdiv_r(t, params->p, params->q);
+
+  ASSERT(0 == mpz_cmp_ui(t, 1));
+
+  ASSERT(mpz_cmp_ui(params->g, 1) > 0);
+  
+  mpz_powm(t, params->g, params->q, params->p);
+  ASSERT(0 == mpz_cmp_ui(t, 1));
+  
+  mpz_powm(t, params->g, key, params->p);
+  ASSERT(0 == mpz_cmp(t, pub));
+
+  mpz_clear(t);
+}
+
+const struct ecc_curve * const ecc_curves[] = {
+  &_nettle_secp_192r1,
+  &_nettle_secp_224r1,
+  &_nettle_secp_256r1,
+  &_nettle_secp_384r1,
+  &_nettle_secp_521r1,
+  &_nettle_curve25519,
+  &_nettle_curve448,
+  &_nettle_gost_gc256b,
+  &_nettle_gost_gc512a,
+  NULL
+};
+
+void
+write_mpn (FILE *f, int base, const mp_limb_t *xp, mp_size_t n)
+{
+  mpz_t t;
+  mpz_out_str (f, base, mpz_roinit_n (t,xp, n));
+}
+
+int
+run_all_libhogweed_tests(int v)
+{
+      if (v == 1) {
+	      verbose = 1;
+      } else if (v == 0) {
+	      verbose = 0;
+      
+      } else {
+	      fprintf(stderr, "Invalid argument `%d`, only accepted options are `0` or `1`.\n",
+		      v);
+	      return 1;
+      }
+
+#ifdef CONFIG_RSA_COMPUTE_ROOT_TEST
+  puts("running rsa_compute_root_test __________________________________________________");
+  rsa_compute_root_test();
+  puts("rsa_compute_root_test is complete ______________________________________________\n");
+#endif
+#ifdef CONFIG_RSA_ENCRYPT_TEST
+  puts("running rsa_encrypt_test _______________________________________________________");
+  rsa_encrypt_test();
+  puts("rsa_encrypt_test is complete ___________________________________________________\n");
+#endif
+#ifdef CONFIG_RSA_KEYGEN_TEST
+  puts("running rsa_keygen_test ________________________________________________________");
+  rsa_keygen_test();
+  puts("rsa_keygen_test is complete ____________________________________________________\n");
+#endif
+#ifdef CONFIG_RSA_PSS_SIGN_TR_TEST
+  puts("running rsa_pss_sign_tr_test ___________________________________________________");
+  rsa_pss_sign_tr_test();
+  puts("rsa_pss_sign_tr_test is complete _______________________________________________\n");
+#endif
+#ifdef CONFIG_RSA_SEC_DECRYPT_TEST
+  puts("running rsa_sec_decrypt_test ___________________________________________________");
+  rsa_sec_decrypt_test();
+  puts("rsa_sec_decrypt_test is complete _______________________________________________\n");
+#endif
+#ifdef CONFIG_RSA_SIGN_TR_TEST
+  puts("running rsa_sign_tr_test _______________________________________________________");
+  rsa_sign_tr_test();
+  puts("rsa_sign_tr_test is complete ___________________________________________________\n");
+#endif
+#ifdef CONFIG_RSA_TEST
+  puts("running rsa_test _______________________________________________________________");
+  rsa_test();
+  puts("rsa_test is complete ___________________________________________________________\n");
+#endif
+#ifdef CONFIG_RSA2SEXP_TEST
+  puts("running rsa2sexp_test __________________________________________________________");
+  rsa2sexp_test();
+  puts("rsa2sexp_test is complete ______________________________________________________\n");
+#endif
+#ifdef CONFIG_SEXP2RSA_TEST
+  puts("running sexp2rsa_test __________________________________________________________");
+  sexp2rsa_test();
+  puts("sexp2rsa_test is complete ______________________________________________________\n");
+#endif
+#ifdef CONFIG_CURVE25519_DH_TEST
+  puts("running curve25519_dh_test _____________________________________________________");
+  curve25519_dh_test();
+  puts("curve25519_dh_test is complete _________________________________________________\n");
+#endif
+#ifdef CONFIG_CURVE448_DH_TEST
+  puts("running curve448_dh_test _______________________________________________________");
+  curve448_dh_test();
+  puts("curve448_dh_test is complete ___________________________________________________\n");
+#endif
+#ifdef CONFIG_DSA_KEYGEN_TEST
+  puts("running dsa_keygen_test ________________________________________________________");
+  dsa_keygen_test();
+  puts("dsa_keygen_test is complete ____________________________________________________\n");
+#endif
+#ifdef CONFIG_DSA_TEST
+  puts("running dsa_test _______________________________________________________________");
+  dsa_test();
+  puts("dsa_test is complete ___________________________________________________________\n");
+#endif
+#ifdef CONFIG_ECDSA_KEYGEN_TEST
+  puts("running ecdsa_keygen_test ______________________________________________________");
+  ecdsa_keygen_test();
+  puts("ecdsa_keygen_test is complete __________________________________________________\n");
+#endif
+#ifdef CONFIG_ECDSA_SIGN_TEST
+  puts("running ecdsa_sign_test ________________________________________________________");
+  ecdsa_sign_test();
+  puts("ecdsa_sign_test is complete ____________________________________________________\n");
+#endif
+#ifdef CONFIG_ECDSA_VERIFY_TEST
+  puts("running ecdsa_verify_test ______________________________________________________");
+  ecdsa_verify_test();
+  puts("ecdsa_verify_test is complete __________________________________________________\n");
+#endif
+#ifdef CONFIG_EDDSA_COMPRESS_TEST
+  puts("running eddsa_compress_test ____________________________________________________");
+  eddsa_compress_test();
+  puts("eddsa_compress_test is complete ________________________________________________\n");
+#endif
+#ifdef CONFIG_EDDSA_SIGN_TEST
+  puts("running eddsa_sign_test ________________________________________________________");
+  eddsa_sign_test();
+  puts("eddsa_sign_test is complete ____________________________________________________\n");
+#endif
+#ifdef CONFIG_EDDSA_VERIFY_TEST
+  puts("running eddsa_verify_test ______________________________________________________");
+  eddsa_verify_test();
+  puts("eddsa_verify_test is complete __________________________________________________\n");
+#endif
+#ifdef CONFIG_GOSTDSA_KEYGEN_TEST
+  puts("running gostdsa_keygen_test ____________________________________________________");
+  gostdsa_keygen_test();
+  puts("gostdsa_keygen_test is complete ________________________________________________\n");
+#endif
+#ifdef CONFIG_GOSTDSA_SIGN_TEST
+  puts("running gostdsa_sign_test ______________________________________________________");
+  gostdsa_sign_test();
+  puts("gostdsa_sign_test is complete __________________________________________________\n");
+#endif
+#ifdef CONFIG_GOSTDSA_VERIFY_TEST
+  puts("running gostdsa_verify_test ____________________________________________________");
+  gostdsa_verify_test();
+  puts("gostdsa_verify_test is complete ________________________________________________\n");
+#endif
+#ifdef CONFIG_GOSTDSA_VKO_TEST
+  puts("running gostdsa_vko_test _______________________________________________________");
+  gostdsa_vko_test();
+  puts("gostdsa_vko_test is complete ___________________________________________________\n");
+#endif
+
+
+  tstring_clear();
+  return EXIT_SUCCESS;
+}
+
-- 
2.17.1



From minios-devel-bounces@lists.xenproject.org Fri Dec 04 11:32:50 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Fri, 04 Dec 2020 11:32:50 +0000
Received: from list by lists.xenproject.org with outflank-mailman.44557.79845 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1kl9KR-0003lu-Of; Fri, 04 Dec 2020 11:32:47 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 44557.79845; Fri, 04 Dec 2020 11:32: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 1kl9KR-0003ln-Li; Fri, 04 Dec 2020 11:32:47 +0000
Received: by outflank-mailman (input) for mailman id 44557;
 Fri, 04 Dec 2020 11:32: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=n/zE=FI=gmail.com=lrbarbulescu@srs-us1.protection.inumbo.net>)
 id 1kl9KR-0003lh-0i
 for minios-devel@lists.xen.org; Fri, 04 Dec 2020 11:32:47 +0000
Received: from mail-ej1-x643.google.com (unknown [2a00:1450:4864:20::643])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id a54f312f-587f-41a5-a28d-d38dcf0a6cb3;
 Fri, 04 Dec 2020 11:32:46 +0000 (UTC)
Received: by mail-ej1-x643.google.com with SMTP id jx16so8168907ejb.10
 for <minios-devel@lists.xen.org>; Fri, 04 Dec 2020 03:32:45 -0800 (PST)
Received: from ubuntu.localdomain ([92.114.82.213])
 by smtp.gmail.com with ESMTPSA id b15sm3327297edv.85.2020.12.04.03.32.43
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Fri, 04 Dec 2020 03:32:44 -0800 (PST)
X-BeenThere: minios-devel@lists.xenproject.org
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
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: a54f312f-587f-41a5-a28d-d38dcf0a6cb3
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;
        bh=PqxbXbo/3tdA8Kw8DKe3QoynlmYELxgwsJnZREXx6HU=;
        b=CsQK4CJdDaTY+LD5gHlIkfT0FFhUGNOg+yAXwO1BVuHVJxfWZxBG6EHpTIy6Mbuu3c
         cfOXTmunQKzH4A+1nNXvFdCu6c6NhC/5RNKtCfW2tHH6CUWyizk7aFRudFzmwFRpOPcV
         rm+3/NBN3Mj5cX+tNRsTTNiRQqhYJ+O3g5hyz/lJXZLous5itDkxAPgA/KG22D8kqvH1
         dKQgzix/NWXIkwq/5RG27CgUe4nWa1xwDooor4khSqUdhm86orxsa/b7a+plbPPLTdsv
         R483utyob0TFJYwcfiC/dgATH3IVjCqyxzJzIhr4q0qv9SxV82HnAgAAa2qp0heLdaNg
         KSzA==
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;
        bh=PqxbXbo/3tdA8Kw8DKe3QoynlmYELxgwsJnZREXx6HU=;
        b=fpmFkvzfNUkO9xkldUm7aHyTWRrTVElA/pAgn32zSFXRiHNXhc1GohI7VlNfx/wQZO
         B+Us5pCl3F4TogeN2wiJT0sy0QrVxudIouYNVjiAIgb3+w9yuIGrXDGPtV3CoveozZBf
         Vci5KmsIkoza+jLbaUoJ8mXUSYQVKD46PJLOl9sqXOgyTe3vfRU68DjJspqCpaepVOTM
         o+4rKU8IsywacICOQb2jmDr/qPEOm4llmtRrrk3kWCwpLCQahaRgyA3X//gEl81U3uof
         L0Q4z/prf/CT3nt82dv/EJCSQHkSt1+SViLppZCDASQWw/EyqA7YYwmDNo7d7vZxAaSO
         +D/w==
X-Gm-Message-State: AOAM533y4HulakqZb8ZkOIdISCfXsLFqVfBEWbeG8xQRabQFqor7HA0k
	EIIcwb/MLv9WMPGIMh4K1HY=
X-Google-Smtp-Source: ABdhPJy7ND1fmEBRut645FrtnbHPBMSk5gQ3jccMxZkqL8WyllTyvC+OqlyuLwCxUHyLMjhE+RrofA==
X-Received: by 2002:a17:906:7f10:: with SMTP id d16mr6643795ejr.104.1607081565171;
        Fri, 04 Dec 2020 03:32:45 -0800 (PST)
From: Laurentiu Barbulescu <lrbarbulescu@gmail.com>
To: simon.kuenzer@neclab.eu
Cc: minios-devel@lists.xen.org,
	Laurentiu Barbulescu <lrbarbulescu@gmail.com>
Subject: Re: [UNIKRAFT PATCH 0/7] lib/ukblkdev: Minor API improvements and fixes
Date: Fri,  4 Dec 2020 03:32:36 -0800
Message-Id: <45e8ca9192cb76e52747941a2c47829c367d8f84.1607080324.git.lrbarbulescu@gmail.com>
X-Mailer: git-send-email 2.17.1
In-Reply-To: <20201022115507.4983-1-simon.kuenzer@neclab.eu>
References: <20201022115507.4983-1-simon.kuenzer@neclab.eu>

Hi Simon,

Overall looks good.
I have only 2 comments, but I will leave them at the corresponding patches.

Best wishes,
Laurentiu


From minios-devel-bounces@lists.xenproject.org Fri Dec 04 11:34:08 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Fri, 04 Dec 2020 11:34:08 +0000
Received: from list by lists.xenproject.org with outflank-mailman.44563.79849 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1kl9Lj-0003rX-UQ; Fri, 04 Dec 2020 11:34:07 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 44563.79849; Fri, 04 Dec 2020 11:34: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 1kl9Lj-0003rQ-RE; Fri, 04 Dec 2020 11:34:07 +0000
Received: by outflank-mailman (input) for mailman id 44563;
 Fri, 04 Dec 2020 11:34: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=n/zE=FI=gmail.com=lrbarbulescu@srs-us1.protection.inumbo.net>)
 id 1kl9Lj-0003rL-68
 for minios-devel@lists.xen.org; Fri, 04 Dec 2020 11:34:07 +0000
Received: from mail-ed1-x543.google.com (unknown [2a00:1450:4864:20::543])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id b7921f30-0493-46d0-83c5-a603295b2454;
 Fri, 04 Dec 2020 11:34:06 +0000 (UTC)
Received: by mail-ed1-x543.google.com with SMTP id b2so5475262edm.3
 for <minios-devel@lists.xen.org>; Fri, 04 Dec 2020 03:34:06 -0800 (PST)
Received: from ubuntu.localdomain ([92.114.82.213])
 by smtp.gmail.com with ESMTPSA id b7sm2925538ejz.4.2020.12.04.03.34.04
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Fri, 04 Dec 2020 03:34:05 -0800 (PST)
X-BeenThere: minios-devel@lists.xenproject.org
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
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: b7921f30-0493-46d0-83c5-a603295b2454
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;
        bh=DFFeRf2N3cxvn/MPWjYAOYYBcAsR9SJHvzMILF9tOmw=;
        b=MqmITeu47FIupe5F6s1RIl5xqEXdISvx3eEz6ZmeG0fjLuDbyX8cq4JH28t95nKFZc
         9AFuSOFRyGgQ7Mgiytpn3ICXKoQchhKIjUMvu+bCMaWYEp9PGxUQobJ2kdVcYd/2q1ik
         E1K1Mt+GQlDGBef08Y81EFWNEAUJ8fnfW3i4kOFvfaTSq0GtupWMtDCIclY7cVuTs+tv
         zetggW5jVHMVRFiyBvyFgCi2w+2eMLExJtf5dJzoa9dUjO3GzMvj7TYnGnyxLT7Kjd/u
         iKG/h53C2xg3eaObm1OHY2L9Xd5f7yNEss7DIyt4dhM1emScEs9ci/IINyq58ILLj+i4
         fQ1w==
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;
        bh=DFFeRf2N3cxvn/MPWjYAOYYBcAsR9SJHvzMILF9tOmw=;
        b=ayfGDRuglF1z31VQCkK+NnmaEUSHUfrmKlW3tLk8p5vz1l239FA+c8ZKwhFTnJa/K1
         3jgU/u/IrdZYlyNxWY9FpHsEquQlTOOUxGCXPIBGBi+/729B5gSnET/VAgSu/TIk02JZ
         YG4nlouKDhk3beyLi+hHVpc4n+Vta+IoaH8SCLAujR8e6JVzdPEPh+5retRhwlgCFuPI
         FU8RW7fLdwVfq09wpcWXrQUWnamffnwGPj7zOjRBuekpxKb139vi6gg765HQ60AODFYy
         eHfmb4ygSXDCVpRSN8D75TUcniRRyylGkw3KjPeJOtgKnkuZBJ6yDnRCbVIQQyvStIqO
         yaDA==
X-Gm-Message-State: AOAM530Of0DscPphhqLUczZ9bCNa+WJB+6JSvXiSv5e05kuZh1vLsFkM
	ZCLUIrcUMfoq7S8h7jvfCX4=
X-Google-Smtp-Source: ABdhPJw1Yv0x1FTGUejx3A+/NmWIzxmU3hkD5rG0XpFVu7AsbUat1pieyRoC5f543iO8Fyz5dVzzPw==
X-Received: by 2002:a05:6402:513:: with SMTP id m19mr7179751edv.244.1607081645761;
        Fri, 04 Dec 2020 03:34:05 -0800 (PST)
From: Laurentiu Barbulescu <lrbarbulescu@gmail.com>
To: simon.kuenzer@neclab.eu
Cc: minios-devel@lists.xen.org,
	Laurentiu Barbulescu <lrbarbulescu@gmail.com>
Subject: Re: [UNIKRAFT PATCH 3/7] lib/ukblkdev: blkreq.h: Use typedef for __sector
Date: Fri,  4 Dec 2020 03:33:59 -0800
Message-Id: <3f651f0572fdf4d56d58f21520fab6542704476c.1607080324.git.lrbarbulescu@gmail.com>
X-Mailer: git-send-email 2.17.1
In-Reply-To: <20201022115507.4983-4-simon.kuenzer@neclab.eu>
References: <20201022115507.4983-4-simon.kuenzer@neclab.eu>

Considering that `__sz` and `__PRIsz` are defined in `include/uk/arch/types.h`, which is already included by `lib/ukblkdev/include/uk/blkreq.h`, i don't see why we have to include `uk/arch/limits.h`.


From minios-devel-bounces@lists.xenproject.org Fri Dec 04 11:35:43 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Fri, 04 Dec 2020 11:35:43 +0000
Received: from list by lists.xenproject.org with outflank-mailman.44573.79876 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1kl9NG-000436-P2; Fri, 04 Dec 2020 11:35:42 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 44573.79876; Fri, 04 Dec 2020 11:35: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 1kl9NG-000430-Lr; Fri, 04 Dec 2020 11:35:42 +0000
Received: by outflank-mailman (input) for mailman id 44573;
 Fri, 04 Dec 2020 11:35: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=n/zE=FI=gmail.com=lrbarbulescu@srs-us1.protection.inumbo.net>)
 id 1kl9NE-00040j-QE
 for minios-devel@lists.xen.org; Fri, 04 Dec 2020 11:35:40 +0000
Received: from mail-ej1-x643.google.com (unknown [2a00:1450:4864:20::643])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 6ceb2c2f-a33d-46e6-97fa-5a361e59a123;
 Fri, 04 Dec 2020 11:35:40 +0000 (UTC)
Received: by mail-ej1-x643.google.com with SMTP id x16so8195724ejj.7
 for <minios-devel@lists.xen.org>; Fri, 04 Dec 2020 03:35:40 -0800 (PST)
Received: from ubuntu.localdomain ([92.114.82.213])
 by smtp.gmail.com with ESMTPSA id n16sm3255968edq.62.2020.12.04.03.35.38
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Fri, 04 Dec 2020 03:35:38 -0800 (PST)
X-BeenThere: minios-devel@lists.xenproject.org
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
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: 6ceb2c2f-a33d-46e6-97fa-5a361e59a123
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;
        bh=NNJQO9If3Lbj7WVjQ2H25sYFayTHqwPO2EMTjxepTOs=;
        b=jkQe/jl0O/uLo8TnazIDgBxdyoKbrCt2uswn6ysbBQsHgRqrWporm/s0Md3jSA2cD5
         x2CetK45UInlBkNPm0CXP5EiSW0ZlA7vbYIeZFvft+Q6LTAb6hEAlFBWEpMTa0GU/7JM
         oX4ce2udDjb7ntP2ZBUPMEgXkkpHI5foXfgfjxpK20e8nNv6GzIIKjl4xdr64TZ5ULKa
         LlkplVAaBzBTkBJfUOnWNzGG/TAS698sz+nhB4bxh+PlOQH/WpWYOO5mAl5JYRimPD7z
         v0Z3Imp77VOeBvQs0PW/M2r2iOPbFdLw3XoFg4NsCbbF/eETlMkJAIU1nOIV6P1AMzGW
         UJgw==
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;
        bh=NNJQO9If3Lbj7WVjQ2H25sYFayTHqwPO2EMTjxepTOs=;
        b=Vf1vqJU2D0A9UtTeVhSRliyeEqwAeXlialCdxM0Ko1ulPH9VRvBu0M0WpAS76WCcgU
         MsZLXTOkY//FObWyT/T8RAph3mji/pV4P9FDcGUOYJCaYcYKecsktV58xE2+NpYwWWrV
         k/LawHQQZG9jiBGuoGcTgxrRJB5AgapIAdHBMXIkT3SO7e9OJb3GRLChrsmDEzdkuqHV
         aM3KkhkOk5zk8hQdesqFn7TortzW5uxO0rUfaedTgGq45Z7nIgfBv+2zRs21xuUFRcC0
         aL41ZPPgqMygj7IHJTNDhOQMjVO6BlBH6NPfYzmUTKBtcZ6DR84qFv4Wk9BezeiZqqfz
         9Qbw==
X-Gm-Message-State: AOAM532CrKWBDJXHKaObLy+acDx5YvshjaZYyuwubQvhxbMtBrp1gikh
	e9QXh/jS/hV07ygvwlyX/iE=
X-Google-Smtp-Source: ABdhPJyd05snVuXrkLKQKcB1ig6h2RR78jG2vNui1/1iCQhcca9k0nlSF9ruwtW4J4GGu98iHAM2DQ==
X-Received: by 2002:a17:906:d10f:: with SMTP id b15mr6440332ejz.268.1607081739485;
        Fri, 04 Dec 2020 03:35:39 -0800 (PST)
From: Laurentiu Barbulescu <lrbarbulescu@gmail.com>
To: simon.kuenzer@neclab.eu
Cc: minios-devel@lists.xen.org,
	Laurentiu Barbulescu <lrbarbulescu@gmail.com>
Subject: Re: [UNIKRAFT PATCH 5/7] lib/ukblkdev: API refactoring: `uk_blkdev_queue_configure()`
Date: Fri,  4 Dec 2020 03:35:33 -0800
Message-Id: <747bde144a18948f9a86f1ccea52fc7582fa81d9.1607080324.git.lrbarbulescu@gmail.com>
X-Mailer: git-send-email 2.17.1
In-Reply-To: <20201022115507.4983-6-simon.kuenzer@neclab.eu>
References: <20201022115507.4983-6-simon.kuenzer@neclab.eu>

This is affecting only the consistency, but you omitted to modify some comments from `blkdev.h`:
- on line 54: "*      - uk_blkdev_queue_setup()"; 
- on line 51, 200, 501: other non-API comments.


From minios-devel-bounces@lists.xenproject.org Fri Dec 04 13:53:11 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Fri, 04 Dec 2020 13:53:11 +0000
Received: from list by lists.xenproject.org with outflank-mailman.44779.80241 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1klBWE-0004lH-K2; Fri, 04 Dec 2020 13:53:06 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 44779.80241; Fri, 04 Dec 2020 13:53: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 1klBWE-0004lA-Gj; Fri, 04 Dec 2020 13:53:06 +0000
Received: by outflank-mailman (input) for mailman id 44779;
 Fri, 04 Dec 2020 13:53: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=etCE=FI=gmail.com=dragosargint21@srs-us1.protection.inumbo.net>)
 id 1klBWD-0004l5-KL
 for minios-devel@lists.xen.org; Fri, 04 Dec 2020 13:53:05 +0000
Received: from mail-wm1-x336.google.com (unknown [2a00:1450:4864:20::336])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id f9133dcb-f812-4374-8513-adb68958f84f;
 Fri, 04 Dec 2020 13:53:04 +0000 (UTC)
Received: by mail-wm1-x336.google.com with SMTP id 3so7058627wmg.4
 for <minios-devel@lists.xen.org>; Fri, 04 Dec 2020 05:53:04 -0800 (PST)
X-BeenThere: minios-devel@lists.xenproject.org
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
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: f9133dcb-f812-4374-8513-adb68958f84f
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=k3/nK8+n0ih6KxUWumLzrfNZyDbH767xTwpk9W/b1j8=;
        b=KiOxfbJTygnYSeledTm/IMcoTR9jRpf5dQJzwZSxHExQ1IaIu7hc62sWZCEGrsggHG
         UsDVkyJPp1g12PWOAEmt0R+s4gIMOMNABYT0MOpzZX+GEzcOBB++IO1lkDnCBLgULexm
         B0keBdklu5xY5Z0sZfyt+RU4mEuNa1OpuYhO41ci1mt02VXQzB07JbSQ0Rv9lLR/234a
         TdclXrSFe6H80hPhz8O4SyMl7TxDkAUJtbjvtjr4rJHNiAyUbSPByGT4/eUvWeClrESu
         dOdtKNHsp1A5cW6dVTC0XI4kuqcxOPXIxqoAYQOPrNkziMruco/VwRtl1Y+65jH/ElDI
         aMzw==
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=k3/nK8+n0ih6KxUWumLzrfNZyDbH767xTwpk9W/b1j8=;
        b=J0vCO0q2G2MCdqqk81ynYPrtv1TD5gBw0BRkGvBqg1z9R4AXw47CeVheLd664cNZGE
         12WyjOiiR/XXqDfQ2ms4UE4V7uOAx2pWRYuGVM/i/EjgDOV3zYZDDd4Pfm1rIR7zbOxd
         H1omb1wFiQXcGJO7w80uzMuUCyyMlGYK8g1loRdojHkAqz9wbZvxCv17LOdMm9KIVEf2
         TTJ5L39UuFd1oZ1m4M2iQW00Gb/A0cyRGMPUBN0ayk9Y2pxTfD676txKVy/s4Rft4qFV
         HPNcgjU9sdADc3CipBOa4KrnMNNdutFRNEvT0R490cPqEoZZkb2l/oj4JmGQ7SIvS4XG
         AEvg==
X-Gm-Message-State: AOAM530zMq7o8IpHaDbWhRs4fB5yYbFRu2occc4+vwjylfGv4Oe8pT4B
	hHFVv8pHclNKvX1Smj554ouxPsMuFUq2LrO6L84=
X-Google-Smtp-Source: ABdhPJw9EIJ08sVVdxT+qOEGefvoCSib+xPBmxk0i0AnEaeNmhmpcAVIs37TQy99/1zxBfBtUjBAjRfO3wiLU9LC4Qo=
X-Received: by 2002:a1c:9acb:: with SMTP id c194mr4271357wme.43.1607089983598;
 Fri, 04 Dec 2020 05:53:03 -0800 (PST)
MIME-Version: 1.0
References: <cover.1604755251.git.cezar.craciunoiu@gmail.com>
In-Reply-To: <cover.1604755251.git.cezar.craciunoiu@gmail.com>
From: dragos argint <dragosargint21@gmail.com>
Date: Fri, 4 Dec 2020 15:52:52 +0200
Message-ID: <CANTUrUmDeijHr3fUXZTJovD4p+yA7WZ6Pz1TWmpasi3=UCojHQ@mail.gmail.com>
Subject: Re: [UNIKRAFT/LIBP11-KIT v2 0/4] Reworked port of p11-kit
To: Cezar Craciunoiu <cezar.craciunoiu@gmail.com>
Cc: minios-devel@lists.xen.org
Content-Type: multipart/alternative; boundary="0000000000009834c005b5a3cb40"

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

Hi Cezar,

I looked over the library, and added comments to the pull request you
opened on Github regarding what I consider relevant to be changed. As many
of the tests do not work due to features that are not currently implemented
in Unikraft, I suggest that we move the library to UPB repository and
pursue there with further investigations. Also I will mark this patches
with requested changes.

Best regards,
Dragos Argint

=C3=8En s=C3=A2m., 7 nov. 2020 la 15:43, Cezar Craciunoiu <cezar.craciunoiu=
@gmail.com>
a scris:

> The libp11-kit library provides a way to load and enumerate PKCS#11
> modules. In the case of Unikraft, it will work hand-in-hand with
> libtasn1, if configured correctly.
>
> The port ensures functionality for KVM and Linuxu, but only KVM was
> thoroughly tested, as Linuxu could not be configured with 9pfs.
> In the case of Xen, position independent code was not available.
>
> The first version of the patches used the libraries build system to
> generate object files and then linked them to Unikraft. This lead to
> a lot of compatibility issues and had to be addressed.
>
> Some tests still fail, but, hopefully, they will be addressed as soon
> as possible in the next version of the patches.
>
> Cezar Craciunoiu (4):
>   Add information files and patches
>   Add Config.uk
>   Add missing necessary functions as glue
>   Add Makefile.uk with the build logic
>
> --
> 2.20.1
>
>
>

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

<div dir=3D"ltr">Hi Cezar,<div><br></div><div>I looked over the library, an=
d added comments to the pull request you opened on Github regarding what I =
consider relevant to be changed. As many of the tests do not work due to fe=
atures that are not currently implemented in Unikraft, I suggest that we mo=
ve the library to UPB repository and pursue there with further investigatio=
ns. Also I will mark this patches with requested changes.</div><div><br></d=
iv><div>Best regards,</div><div>Dragos Argint</div></div><br><div class=3D"=
gmail_quote"><div dir=3D"ltr" class=3D"gmail_attr">=C3=8En s=C3=A2m., 7 nov=
. 2020 la 15:43, Cezar Craciunoiu &lt;<a href=3D"mailto:cezar.craciunoiu@gm=
ail.com">cezar.craciunoiu@gmail.com</a>&gt; a scris:<br></div><blockquote c=
lass=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px soli=
d rgb(204,204,204);padding-left:1ex">The libp11-kit library provides a way =
to load and enumerate PKCS#11<br>
modules. In the case of Unikraft, it will work hand-in-hand with<br>
libtasn1, if configured correctly.<br>
<br>
The port ensures functionality for KVM and Linuxu, but only KVM was<br>
thoroughly tested, as Linuxu could not be configured with 9pfs.<br>
In the case of Xen, position independent code was not available.<br>
<br>
The first version of the patches used the libraries build system to<br>
generate object files and then linked them to Unikraft. This lead to<br>
a lot of compatibility issues and had to be addressed.<br>
<br>
Some tests still fail, but, hopefully, they will be addressed as soon<br>
as possible in the next version of the patches.<br>
<br>
Cezar Craciunoiu (4):<br>
=C2=A0 Add information files and patches<br>
=C2=A0 Add Config.uk<br>
=C2=A0 Add missing necessary functions as glue<br>
=C2=A0 Add Makefile.uk with the build logic<br>
<br>
-- <br>
2.20.1<br>
<br>
<br>
</blockquote></div>

--0000000000009834c005b5a3cb40--


From minios-devel-bounces@lists.xenproject.org Fri Dec 04 14:45:05 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Fri, 04 Dec 2020 14:45:05 +0000
Received: from list by lists.xenproject.org with outflank-mailman.44853.80271 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1klCKU-0001y0-UE; Fri, 04 Dec 2020 14:45:02 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 44853.80271; Fri, 04 Dec 2020 14:45: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 1klCKU-0001xt-Qz; Fri, 04 Dec 2020 14:45:02 +0000
Received: by outflank-mailman (input) for mailman id 44853;
 Fri, 04 Dec 2020 14:45: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=lDdD=FI=gmail.com=dincadaniel97@srs-us1.protection.inumbo.net>)
 id 1klCKS-0001xm-QR
 for minios-devel@lists.xen.org; Fri, 04 Dec 2020 14:45:01 +0000
Received: from mail-ej1-x642.google.com (unknown [2a00:1450:4864:20::642])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 611dbb1a-2ad8-4629-a4fb-e63f0a0d519e;
 Fri, 04 Dec 2020 14:44:59 +0000 (UTC)
Received: by mail-ej1-x642.google.com with SMTP id a16so9041902ejj.5
 for <minios-devel@lists.xen.org>; Fri, 04 Dec 2020 06:44:59 -0800 (PST)
Received: from [192.168.0.106] ([79.114.185.35])
 by smtp.gmail.com with ESMTPSA id v9sm3170361ejk.48.2020.12.04.06.44.58
 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128);
 Fri, 04 Dec 2020 06:44:58 -0800 (PST)
X-BeenThere: minios-devel@lists.xenproject.org
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
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: 611dbb1a-2ad8-4629-a4fb-e63f0a0d519e
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20161025;
        h=subject:to:cc:references:from:message-id:date:user-agent
         :mime-version:in-reply-to:content-language;
        bh=RRutfX5S+bsFmfCuLvYl55Xrw5juFHzsIGb5Q6WhUq8=;
        b=HIgU7YblCnAgz0X1y/MQg9wn9qhTsR5I5A+jEXXRndN5H/WmMQjoj9I4XI6kWSKI8M
         IxrPqyz4spT+CPc/vXJlpjboyJZoByaKLQAzi8rpH15r1w3QxFt2xcaZjrn+PPwYclAv
         0JDq4Gq+k9qiPQBVRkWxDcc4GW2pYA2ZFADr/pnhVceMBN2bubTAZjkxLUA7zrtvdkLe
         70PP+Fms75gtkHv1GVjYRZevELUpKVUr0h90eGxoVpFfMmnpeYSOQCS6+lAldBpNY7wC
         O+RPvSuRfD0w86ZwyYzAchm2MvXf66Nj+pgLLP22r+gKqXDI2/set82/9z7ptIdUGqfk
         axmw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20161025;
        h=x-gm-message-state:subject:to:cc:references:from:message-id:date
         :user-agent:mime-version:in-reply-to:content-language;
        bh=RRutfX5S+bsFmfCuLvYl55Xrw5juFHzsIGb5Q6WhUq8=;
        b=kiQmpD43FlrpuiVZnMNzOUosRgzQTib/NNmgR0iVbE4fgrnMICCXEZRrML20kMsvIk
         ojsLjY0WKtdIgnb04j94GyqSb2S1MQM/4/CwJXYX7LYqtD+XvGv0XaU/x7QHn1kwjB3B
         1oxZKREspOBp6AL1TiCT60l7pPqgSx+xSGGe47mwgJ8rgg9JoCCX7VFAdumbGW+ItE2W
         WXc1qkL2D6Y4F7AMMT7QeWbz08SoQymQuwibVUzyzsucb3mDcRxrSfhlPeEJkDI0z72i
         KIxHHhSYdq3t6vPEdAgDhTJWV8ZT8hCc9MNaBYTEJYGg/oSDg7aGQxfNg+t7UN3qsFVP
         LT4Q==
X-Gm-Message-State: AOAM533ac2jVdmZXMcfSkeHXWg2SBNHcBLzEEKZ1E82AZhgd4LDL37Ij
	QdDclO/AyY9P/w+uZU6HP+A=
X-Google-Smtp-Source: ABdhPJx2k8MvLXwItjyDumRVRKPzj7int2b7yIn+sdLX4S/wzgX5e3kV6Oi0tdWygoLU6u+ibxeSiQ==
X-Received: by 2002:a17:906:edca:: with SMTP id sb10mr7533859ejb.284.1607093098978;
        Fri, 04 Dec 2020 06:44:58 -0800 (PST)
Subject: Re: [UNIKRAFT PATCH 09/11] lib/vfscore: Register `umask` to
 syscall_shim
To: Constantin Raducanu <raducanu.costi@gmail.com>, minios-devel@lists.xen.org
Cc: simon.kuenzer@neclab.eu
References: <20200502181835.6724-1-raducanu.costi@gmail.com>
 <20200502181835.6724-9-raducanu.costi@gmail.com>
From: Daniel Dinca <dincadaniel97@gmail.com>
Message-ID: <d9996894-a518-184c-7bd6-cd536aab0d34@gmail.com>
Date: Fri, 4 Dec 2020 16:44:57 +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: <20200502181835.6724-9-raducanu.costi@gmail.com>
Content-Type: multipart/alternative;
 boundary="------------536BD73E074F4829C43984C4"
Content-Language: en-US

This is a multi-part message in MIME format.
--------------536BD73E074F4829C43984C4
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit

Looks good.

Reviewed-by: Daniel Dinca <dincadaniel97@gmail.com>

On 02.05.2020 21:18, Constantin Raducanu wrote:
> Registers `umask` system call to syscall_shim library.
>
> Signed-off-by: Constantin Raducanu <raducanu.costi@gmail.com>
> ---
>   lib/vfscore/Makefile.uk   | 3 ++-
>   lib/vfscore/exportsyms.uk | 2 ++
>   lib/vfscore/main.c        | 2 +-
>   3 files changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/lib/vfscore/Makefile.uk b/lib/vfscore/Makefile.uk
> index 5c64046..c7025bd 100644
> --- a/lib/vfscore/Makefile.uk
> +++ b/lib/vfscore/Makefile.uk
> @@ -51,4 +51,5 @@ UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += rmdir-1
>   UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += rename-2
>   UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += fsync-1
>   UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += fdatasync-1
> -UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += preadv-4
> \ No newline at end of file
> +UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += preadv-4
> +UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += umask-1
> \ No newline at end of file
> diff --git a/lib/vfscore/exportsyms.uk b/lib/vfscore/exportsyms.uk
> index 46c7437..b9c29b1 100644
> --- a/lib/vfscore/exportsyms.uk
> +++ b/lib/vfscore/exportsyms.uk
> @@ -132,6 +132,8 @@ uk_syscall_r_lseek
>   uk_syscall_e_writev
>   uk_syscall_r_writev
>   umask
> +uk_syscall_e_umask
> +uk_syscall_r_umask
>   dentry_alloc
>   dentry_init
>   dentry_lookup
> diff --git a/lib/vfscore/main.c b/lib/vfscore/main.c
> index e7b0e90..18cf17c 100644
> --- a/lib/vfscore/main.c
> +++ b/lib/vfscore/main.c
> @@ -2138,7 +2138,7 @@ int posix_fadvise(int fd __unused, off_t offset __unused, off_t len __unused,
>   }
>   LFS64(posix_fadvise);
>   
> -mode_t umask(mode_t newmask)
> +UK_SYSCALL_R_DEFINE(mode_t, umask, mode_t, newmask)
>   {
>   	return ukarch_exchange_n(&global_umask, newmask);
>   }
>

--------------536BD73E074F4829C43984C4
Content-Type: text/html; charset=utf-8
Content-Transfer-Encoding: 7bit

<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <p>Looks good.</p>
    <p><span style="color: rgb(34, 34, 34); font-family: Arial,
        Helvetica, sans-serif; font-size: small; font-style: normal;
        font-variant-ligatures: normal; font-variant-caps: normal;
        font-weight: 400; letter-spacing: normal; orphans: 2;
        text-align: start; text-indent: 0px; text-transform: none;
        white-space: normal; widows: 2; word-spacing: 0px;
        -webkit-text-stroke-width: 0px; background-color: rgb(255, 255,
        255); text-decoration-style: initial; text-decoration-color:
        initial; display: inline !important; float: none;"></span>Reviewed-by:
      Daniel Dinca <a class="moz-txt-link-rfc2396E" href="mailto:dincadaniel97@gmail.com">&lt;dincadaniel97@gmail.com&gt;</a><br>
    </p>
    <div class="moz-cite-prefix">On 02.05.2020 21:18, Constantin
      Raducanu wrote:<br>
    </div>
    <blockquote type="cite"
      cite="mid:20200502181835.6724-9-raducanu.costi@gmail.com">
      <pre class="moz-quote-pre" wrap="">Registers `umask` system call to syscall_shim library.

Signed-off-by: Constantin Raducanu <a class="moz-txt-link-rfc2396E" href="mailto:raducanu.costi@gmail.com">&lt;raducanu.costi@gmail.com&gt;</a>
---
 lib/vfscore/Makefile.uk   | 3 ++-
 lib/vfscore/exportsyms.uk | 2 ++
 lib/vfscore/main.c        | 2 +-
 3 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/lib/vfscore/Makefile.uk b/lib/vfscore/Makefile.uk
index 5c64046..c7025bd 100644
--- a/lib/vfscore/Makefile.uk
+++ b/lib/vfscore/Makefile.uk
@@ -51,4 +51,5 @@ UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += rmdir-1
 UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += rename-2
 UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += fsync-1
 UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += fdatasync-1
-UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += preadv-4
\ No newline at end of file
+UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += preadv-4
+UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += umask-1
\ No newline at end of file
diff --git a/lib/vfscore/exportsyms.uk b/lib/vfscore/exportsyms.uk
index 46c7437..b9c29b1 100644
--- a/lib/vfscore/exportsyms.uk
+++ b/lib/vfscore/exportsyms.uk
@@ -132,6 +132,8 @@ uk_syscall_r_lseek
 uk_syscall_e_writev
 uk_syscall_r_writev
 umask
+uk_syscall_e_umask
+uk_syscall_r_umask
 dentry_alloc
 dentry_init
 dentry_lookup
diff --git a/lib/vfscore/main.c b/lib/vfscore/main.c
index e7b0e90..18cf17c 100644
--- a/lib/vfscore/main.c
+++ b/lib/vfscore/main.c
@@ -2138,7 +2138,7 @@ int posix_fadvise(int fd __unused, off_t offset __unused, off_t len __unused,
 }
 LFS64(posix_fadvise);
 
-mode_t umask(mode_t newmask)
+UK_SYSCALL_R_DEFINE(mode_t, umask, mode_t, newmask)
 {
 	return ukarch_exchange_n(&amp;global_umask, newmask);
 }

</pre>
    </blockquote>
  </body>
</html>

--------------536BD73E074F4829C43984C4--


From minios-devel-bounces@lists.xenproject.org Fri Dec 04 14:46:32 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Fri, 04 Dec 2020 14:46:32 +0000
Received: from list by lists.xenproject.org with outflank-mailman.44857.80275 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1klCLw-00020Q-2h; Fri, 04 Dec 2020 14:46:32 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 44857.80275; Fri, 04 Dec 2020 14: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 1klCLv-00020J-W0; Fri, 04 Dec 2020 14:46:31 +0000
Received: by outflank-mailman (input) for mailman id 44857;
 Fri, 04 Dec 2020 14:46: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=lDdD=FI=gmail.com=dincadaniel97@srs-us1.protection.inumbo.net>)
 id 1klCLu-00020D-Ab
 for minios-devel@lists.xen.org; Fri, 04 Dec 2020 14:46:30 +0000
Received: from mail-ej1-x643.google.com (unknown [2a00:1450:4864:20::643])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 53639a98-fc4e-4b3d-b08c-ac369cf44395;
 Fri, 04 Dec 2020 14:46:29 +0000 (UTC)
Received: by mail-ej1-x643.google.com with SMTP id m19so8989753ejj.11
 for <minios-devel@lists.xen.org>; Fri, 04 Dec 2020 06:46:29 -0800 (PST)
Received: from [192.168.0.106] ([79.114.185.35])
 by smtp.gmail.com with ESMTPSA id r16sm3581465edp.43.2020.12.04.06.46.27
 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128);
 Fri, 04 Dec 2020 06:46:28 -0800 (PST)
X-BeenThere: minios-devel@lists.xenproject.org
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
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: 53639a98-fc4e-4b3d-b08c-ac369cf44395
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20161025;
        h=subject:to:cc:references:from:message-id:date:user-agent
         :mime-version:in-reply-to:content-transfer-encoding:content-language;
        bh=QBN6id9TYqeqGHpkf8UX1X0mXfSZ9bdn2SZKsmHIa30=;
        b=AuVrEevJ/8rnmTvXdu7OoHOnvMwFn2D1gNBr2Kn7DXUV4j7/siY2xNqMrZRUVGoDaD
         RfUSWxIa5NSK0T6FFTcQfs1tv4/eVvdxzLYXhSoDLIr9y13fPLdLNmMcuFoKJMchVbPy
         pC0RemQ1WCQjh6BwwPeEON7DA/Vzxxtr1lOxHO0EO5uR0P7/oYWCAIm3Uu7Q+9le++bZ
         Vktt195TnsGFyT9BFC/Va3fqUxJ7pIVnTAaHRJZiUpD03alRLjEoip2lBs4e0mUxXZxD
         j4ThctUi4fQzcYquivmvHjqJjB7vV4WdzKiTv507xd6sAq8zsnjhAndjQ62Plh/+oqAT
         i1sw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20161025;
        h=x-gm-message-state:subject:to:cc:references:from:message-id:date
         :user-agent:mime-version:in-reply-to:content-transfer-encoding
         :content-language;
        bh=QBN6id9TYqeqGHpkf8UX1X0mXfSZ9bdn2SZKsmHIa30=;
        b=oSBjI4PLKNbrDGHfFXalZW2qE4by493pbsqYdos06m9e9898YAelyPuVahJ2U/rRV8
         5iO7hrth4rtbEvGGG7Rz7C3vdGhQHnFLZ09iKap86DJzf1aoY3bRp+buGH3M5xG8xye5
         fEMhJV/lkW91abppZtKYokVGzAXICBwj+JeYeVseehs2WBuRiCx8C7hvMYWoJg5xDXs/
         KKjtUb3W4IxHidkmPHfrHqbmTRwHI2MbStaTur7DA9nbyW3DepzRCwj+DLnJLHCUqEoO
         BqfJr7pmiSdjvIsPQZgk5mh7hOPONX+24JwDnNYoMtklTCzefgSOqqnzzHr5lY9x4W9K
         xCdA==
X-Gm-Message-State: AOAM532G9f5lrcTmEcvO4Oibh50f3D75V3/gp2y2YxEyc/GwfjpMZlXx
	LIZ5jEgodfJIQRsIQTBaZFY=
X-Google-Smtp-Source: ABdhPJy1XTNHbASxYcIfDksU2eH0Lgc1piocxg6cVYQ6XNvLPEG42J5PYocdlJW21MVU51qhUZVICw==
X-Received: by 2002:a17:906:378f:: with SMTP id n15mr7202824ejc.263.1607093188767;
        Fri, 04 Dec 2020 06:46:28 -0800 (PST)
Subject: Re: [UNIKRAFT PATCH 10/11] lib/vfscore: Register `lstat` to
 syscall_shim
To: Constantin Raducanu <raducanu.costi@gmail.com>, minios-devel@lists.xen.org
Cc: simon.kuenzer@neclab.eu
References: <20200502181835.6724-1-raducanu.costi@gmail.com>
 <20200502181835.6724-10-raducanu.costi@gmail.com>
From: Daniel Dinca <dincadaniel97@gmail.com>
Message-ID: <514218d3-bb41-d71b-6ec5-fab0425e3f68@gmail.com>
Date: Fri, 4 Dec 2020 16:46:27 +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: <20200502181835.6724-10-raducanu.costi@gmail.com>
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
Content-Language: en-US

Looks good.

Reviewed-by: Daniel Dinca <dincadaniel97@gmail.com>

On 02.05.2020 21:18, Constantin Raducanu wrote:
> Registers `lstat` system call to syscall_shim library.
>
> Signed-off-by: Constantin Raducanu <raducanu.costi@gmail.com>
> ---
>   lib/vfscore/Makefile.uk   |  3 ++-
>   lib/vfscore/exportsyms.uk |  2 ++
>   lib/vfscore/main.c        | 14 +++++++-------
>   3 files changed, 11 insertions(+), 8 deletions(-)
>
> diff --git a/lib/vfscore/Makefile.uk b/lib/vfscore/Makefile.uk
> index c7025bd..dfd33d6 100644
> --- a/lib/vfscore/Makefile.uk
> +++ b/lib/vfscore/Makefile.uk
> @@ -52,4 +52,5 @@ UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += rename-2
>   UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += fsync-1
>   UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += fdatasync-1
>   UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += preadv-4
> -UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += umask-1
> \ No newline at end of file
> +UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += umask-1
> +UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += lstat-2
> \ No newline at end of file
> diff --git a/lib/vfscore/exportsyms.uk b/lib/vfscore/exportsyms.uk
> index b9c29b1..6061c85 100644
> --- a/lib/vfscore/exportsyms.uk
> +++ b/lib/vfscore/exportsyms.uk
> @@ -71,6 +71,8 @@ uk_syscall_r_chdir
>   fstatat
>   statfs
>   lstat
> +uk_syscall_e_lstat
> +uk_syscall_r_lstat
>   lchown
>   openat
>   opendir
> diff --git a/lib/vfscore/main.c b/lib/vfscore/main.c
> index 18cf17c..8f955ff 100644
> --- a/lib/vfscore/main.c
> +++ b/lib/vfscore/main.c
> @@ -1209,25 +1209,25 @@ int __lxstat(int ver __unused, const char *pathname, struct stat *st)
>   
>   	error = task_conv(t, pathname, 0, path);
>   	if (error) {
> -		errno = error;
> -		trace_vfs_lstat_err(error);
> -		return (-1);
> +		goto out_error;
>   	}
>   
>   	error = sys_lstat(path, st);
>   	if (error) {
> -		errno = error;
> -		trace_vfs_lstat_err(error);
> -		return (-1);
> +		goto out_error;
>   	}
>   
>   	trace_vfs_lstat_ret();
>   	return 0;
> +
> +	out_error:
> +	trace_vfs_lstat_err(error);
> +	return -error;
>   }
>   
>   LFS64(__lxstat);
>   
> -int lstat(const char *pathname, struct stat *st)
> +UK_SYSCALL_R_DEFINE(int, lstat, const char*, pathname, struct stat*, st)
>   {
>   	return __lxstat(1, pathname, st);
>   }
>


From minios-devel-bounces@lists.xenproject.org Fri Dec 04 14:48:17 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Fri, 04 Dec 2020 14:48:17 +0000
Received: from list by lists.xenproject.org with outflank-mailman.44860.80280 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1klCNd-00024k-7k; Fri, 04 Dec 2020 14:48:17 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 44860.80280; Fri, 04 Dec 2020 14:48: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 1klCNd-00024d-4u; Fri, 04 Dec 2020 14:48:17 +0000
Received: by outflank-mailman (input) for mailman id 44860;
 Fri, 04 Dec 2020 14:48: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=lDdD=FI=gmail.com=dincadaniel97@srs-us1.protection.inumbo.net>)
 id 1klCNc-00024Y-7W
 for minios-devel@lists.xen.org; Fri, 04 Dec 2020 14:48:16 +0000
Received: from mail-ed1-x541.google.com (unknown [2a00:1450:4864:20::541])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 5cf5038c-aac6-4365-bada-73e93e045a19;
 Fri, 04 Dec 2020 14:48:15 +0000 (UTC)
Received: by mail-ed1-x541.google.com with SMTP id l5so6052442edq.11
 for <minios-devel@lists.xen.org>; Fri, 04 Dec 2020 06:48:15 -0800 (PST)
Received: from [192.168.0.106] ([79.114.185.35])
 by smtp.gmail.com with ESMTPSA id qp16sm3182913ejb.74.2020.12.04.06.48.13
 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128);
 Fri, 04 Dec 2020 06:48:13 -0800 (PST)
X-BeenThere: minios-devel@lists.xenproject.org
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
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: 5cf5038c-aac6-4365-bada-73e93e045a19
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20161025;
        h=subject:to:cc:references:from:message-id:date:user-agent
         :mime-version:in-reply-to:content-transfer-encoding:content-language;
        bh=askxVl6SMncJamJa5/OKOp+TA5NG7mD68fHjQ+1bHbY=;
        b=V0mgtsSMYTAx2xd0lYjLHUuKp2MpDAFqKhGYCtr4kTllC1dPeoWL7XXuPqwRFXQOSL
         gFW4BlnRLJx09LUNcDmJ3FLKOshY3PHsLXX8lFPZuuo4jSYnff8lDYgOlgI8tJfELEGD
         k4BMiS0HmayxUHArQeyROfwso5ZMaOU/NqCcOnR6JOn4i0Ch45JYzRDV+XNOpb0gclEy
         fQ5DV0Go39tDBFTKSdTGqx9l/bay/v85f7u8nmEDzhCub5W4JYGCp2X7b5AA3UhYiBiN
         1V21lzJx/a7OpHRjOVL4V1uBeJyj2wZ+ydoyrm/BK1XZoOtMMXMi9XPQJFu9C4DUVAXO
         AcxQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20161025;
        h=x-gm-message-state:subject:to:cc:references:from:message-id:date
         :user-agent:mime-version:in-reply-to:content-transfer-encoding
         :content-language;
        bh=askxVl6SMncJamJa5/OKOp+TA5NG7mD68fHjQ+1bHbY=;
        b=jJHNQCK45vOOX/mIfeZYYA0azxVENYl+EFy3nW70y7ojNPwUUROiuaE3f05YFvlcTb
         wtgd8OHVKolh1qWvLhw4RmRRlrDQk9Dvwk5BZjIG/r/ff39tuYbtKQdISx/ZeYCMtlQl
         +knznr9S5/R2ZDadRIEhX3A1Mw6HuLp3RAYYW3KJkj7KlFt+xQHM20m3uDLiEocR++Yw
         0eLTa56GRo/T1IB25rTkDo6IfYJvEqpOmJ+jEUx9GdfG6aMSTHAkzjn1V2KTD40B3tML
         AwuwObTiYH1vP+vkP3IUhjZWKqW67fkvkNw0+88FDeUYfwPNe0/a64LPRIcAxo759+23
         qFgA==
X-Gm-Message-State: AOAM532pfX/ZJJYnuHF7n7e8KUPH+HHjC3/OujBQEj48px36xQkF99ze
	12H0f/SK9WHsSNCE6QDvYXc=
X-Google-Smtp-Source: ABdhPJxjdKvabHKkAd+PMPThyAN3wKlBsdHee7uihyDeR/wOYli2dGGKkvd1DPNPSZr2BBfbbsMlkA==
X-Received: by 2002:a50:cd08:: with SMTP id z8mr8069465edi.256.1607093294551;
        Fri, 04 Dec 2020 06:48:14 -0800 (PST)
Subject: Re: [UNIKRAFT PATCH 06/11] lib/vfscore: Register `rename` to
 syscall_shim
To: Constantin Raducanu <raducanu.costi@gmail.com>, minios-devel@lists.xen.org
Cc: simon.kuenzer@neclab.eu
References: <20200502181835.6724-1-raducanu.costi@gmail.com>
 <20200502181835.6724-6-raducanu.costi@gmail.com>
From: Daniel Dinca <dincadaniel97@gmail.com>
Message-ID: <e780d507-89d4-834b-28aa-5123f3f0ee66@gmail.com>
Date: Fri, 4 Dec 2020 16:48:13 +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: <20200502181835.6724-6-raducanu.costi@gmail.com>
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
Content-Language: en-US

Looks good.

Reviewed-by: Daniel Dinca <dincadaniel97@gmail.com>

On 02.05.2020 21:18, Constantin Raducanu wrote:
> Registers `rename` system call to syscall_shim library.
>
> Signed-off-by: Constantin Raducanu <raducanu.costi@gmail.com>
> ---
>   lib/vfscore/Makefile.uk   |  3 ++-
>   lib/vfscore/exportsyms.uk |  2 ++
>   lib/vfscore/main.c        | 20 ++++++++++----------
>   3 files changed, 14 insertions(+), 11 deletions(-)
>
> diff --git a/lib/vfscore/Makefile.uk b/lib/vfscore/Makefile.uk
> index 56d3e4f..63fc806 100644
> --- a/lib/vfscore/Makefile.uk
> +++ b/lib/vfscore/Makefile.uk
> @@ -47,4 +47,5 @@ UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += dup2-2
>   UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += pwritev-4
>   UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += utimes-2
>   UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += mknod-3
> -UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += rmdir-1
> \ No newline at end of file
> +UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += rmdir-1
> +UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += rename-2
> \ No newline at end of file
> diff --git a/lib/vfscore/exportsyms.uk b/lib/vfscore/exportsyms.uk
> index d615eb8..4a8a4f4 100644
> --- a/lib/vfscore/exportsyms.uk
> +++ b/lib/vfscore/exportsyms.uk
> @@ -144,6 +144,8 @@ fstatfs
>   eaccess
>   euidaccess
>   rename
> +uk_syscall_e_rename
> +uk_syscall_r_rename
>   __xmknod
>   __xstat
>   __lxstat
> diff --git a/lib/vfscore/main.c b/lib/vfscore/main.c
> index b0af047..41c81f5 100644
> --- a/lib/vfscore/main.c
> +++ b/lib/vfscore/main.c
> @@ -932,7 +932,7 @@ UK_TRACEPOINT(trace_vfs_rename, "\"%s\" \"%s\"", const char*, const char*);
>   UK_TRACEPOINT(trace_vfs_rename_ret, "");
>   UK_TRACEPOINT(trace_vfs_rename_err, "%d", int);
>   
> -int rename(const char *oldpath, const char *newpath)
> +UK_SYSCALL_R_DEFINE(int, rename, const char*, oldpath, const char*, newpath)
>   {
>   	trace_vfs_rename(oldpath, newpath);
>   	struct task *t = main_task;
> @@ -942,35 +942,35 @@ int rename(const char *oldpath, const char *newpath)
>   
>   	error = ENOENT;
>   	if (null_or_empty(oldpath) || null_or_empty(newpath))
> -		goto out_errno;
> +		goto out_error;
>   
>   	get_last_component(oldpath, src);
>   	if (!strcmp(src, ".") || !strcmp(src, "..")) {
>   		error = EINVAL;
> -		goto out_errno;
> +		goto out_error;
>   	}
>   
>   	get_last_component(newpath, dest);
>   	if (!strcmp(dest, ".") || !strcmp(dest, "..")) {
>   		error = EINVAL;
> -		goto out_errno;
> +		goto out_error;
>   	}
>   
>   	if ((error = task_conv(t, oldpath, VREAD, src)) != 0)
> -		goto out_errno;
> +		goto out_error;
>   
>   	if ((error = task_conv(t, newpath, VWRITE, dest)) != 0)
> -		goto out_errno;
> +		goto out_error;
>   
>   	error = sys_rename(src, dest);
>   	if (error)
> -		goto out_errno;
> +		goto out_error;
>   	trace_vfs_rename_ret();
>   	return 0;
> -	out_errno:
> +
> +	out_error:
>   	trace_vfs_rename_err(error);
> -	errno = error;
> -	return -1;
> +	return -error;
>   }
>   
>   UK_TRACEPOINT(trace_vfs_chdir, "\"%s\"", const char*);
>


From minios-devel-bounces@lists.xenproject.org Fri Dec 04 14:49:05 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Fri, 04 Dec 2020 14:49:05 +0000
Received: from list by lists.xenproject.org with outflank-mailman.44862.80284 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1klCOP-00026b-BE; Fri, 04 Dec 2020 14:49:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 44862.80284; Fri, 04 Dec 2020 14:49: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 1klCOP-00026U-80; Fri, 04 Dec 2020 14:49:05 +0000
Received: by outflank-mailman (input) for mailman id 44862;
 Fri, 04 Dec 2020 14:49: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=lDdD=FI=gmail.com=dincadaniel97@srs-us1.protection.inumbo.net>)
 id 1klCON-00026P-Ld
 for minios-devel@lists.xen.org; Fri, 04 Dec 2020 14:49:03 +0000
Received: from mail-ej1-x641.google.com (unknown [2a00:1450:4864:20::641])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 9cc1e9a5-be5e-4356-902a-041453a785fe;
 Fri, 04 Dec 2020 14:49:02 +0000 (UTC)
Received: by mail-ej1-x641.google.com with SMTP id ce23so5268808ejb.8
 for <minios-devel@lists.xen.org>; Fri, 04 Dec 2020 06:49:02 -0800 (PST)
Received: from [192.168.0.106] ([79.114.185.35])
 by smtp.gmail.com with ESMTPSA id b9sm3275275eju.8.2020.12.04.06.49.01
 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128);
 Fri, 04 Dec 2020 06:49:01 -0800 (PST)
X-BeenThere: minios-devel@lists.xenproject.org
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
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: 9cc1e9a5-be5e-4356-902a-041453a785fe
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20161025;
        h=subject:to:cc:references:from:message-id:date:user-agent
         :mime-version:in-reply-to:content-transfer-encoding:content-language;
        bh=9G+3GwU4dkUjrtKrBA17CPuPp87cK5HWlOv4sZ+fkKk=;
        b=cUSEuEYMYZyoymwxt38whgXyd025Guf1prOYZtqLOnPEIYTZhYwNudcGB08LwrXis3
         zyf6Rx81kJYE2Wo+oN7e/xhMtwNQRSWGOqMpZw3+FCvo3yMTCBgfGLqAHFsEt8e2ovmZ
         83cKs3okcHjoZ33X2xDmCBzgFd4HUMuyD2ryV9/ytQ8/zzbgDsNzCPplGhmZGdX83ZRF
         kbxcEJIOFihHMEBZwWSNPdeMSPyls5nv2Gb0CLqDVmU4yZiCHOmJu3soONuUOjIrUkPK
         v6FIPwvnRD51v9bxTl+rXcA8tYRKc29TxTdSYjvQCzPgs5+PQcWD5i0TbXvYoLMWzGP6
         K+Fg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20161025;
        h=x-gm-message-state:subject:to:cc:references:from:message-id:date
         :user-agent:mime-version:in-reply-to:content-transfer-encoding
         :content-language;
        bh=9G+3GwU4dkUjrtKrBA17CPuPp87cK5HWlOv4sZ+fkKk=;
        b=Izl9FEB6pbVYW1Rbz9OSwn3MCUYr867H0PQ+j0knS3oYC7duFbWjMq0qL/dvgc/Qfp
         ZxoLg5TDz2egpIuX2xfMrKd1OuI5IYerhGJqwsOhNel8ZC8I3EMhfJqPxX6dBTZ6LFj5
         Sb0EXYr1b7Idki/qdG8fPdm2KVj3i4HeAuzpjEaS56AtCP3yraKkvktAMR5liWP/qgsj
         O7CCkWN5zrv/ax1QN3BS4GO6F8XkNyskulPgP0mhFx7kkYhAAA2dIrqPo4G9lf9rrT5L
         4FCbnfjKJVMX3pm5x31SVmPTY4R6hPUerrnlq+tNNLlNscil0lU9QDZ90LK24RQ1rHht
         Wpmw==
X-Gm-Message-State: AOAM533Y6SXW16/ZpBXc7td4rldPWJSDqnNbobSGQIBFoO11rS+G4hO6
	Q8gcO1YGKQ8JbJC30RubmIhMmEWx5zhwdg==
X-Google-Smtp-Source: ABdhPJxRTzA7nuXF2YqIZZO/jDk3IjpUiX7dwILvA/UK1xcpvyOGh41DKOoim1km0ClwfMUkvMPCXw==
X-Received: by 2002:a17:906:179a:: with SMTP id t26mr7735695eje.49.1607093342050;
        Fri, 04 Dec 2020 06:49:02 -0800 (PST)
Subject: Re: [UNIKRAFT PATCH 04/11] lib/vfscore: Register `mknod` to
 syscall_shim
To: Constantin Raducanu <raducanu.costi@gmail.com>, minios-devel@lists.xen.org
Cc: simon.kuenzer@neclab.eu
References: <20200502181835.6724-1-raducanu.costi@gmail.com>
 <20200502181835.6724-4-raducanu.costi@gmail.com>
From: Daniel Dinca <dincadaniel97@gmail.com>
Message-ID: <7d022d94-1bfd-e799-772c-74d62932d805@gmail.com>
Date: Fri, 4 Dec 2020 16:49:00 +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: <20200502181835.6724-4-raducanu.costi@gmail.com>
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
Content-Language: en-US

Looks good.

Reviewed-by: Daniel Dinca <dincadaniel97@gmail.com>

On 02.05.2020 21:18, Constantin Raducanu wrote:
> Registers `mknod` system call to syscall_shim library.
>
> Signed-off-by: Constantin Raducanu <raducanu.costi@gmail.com>
> ---
>   lib/vfscore/Makefile.uk   |  3 ++-
>   lib/vfscore/exportsyms.uk |  2 ++
>   lib/vfscore/main.c        | 12 +++++-------
>   3 files changed, 9 insertions(+), 8 deletions(-)
>
> diff --git a/lib/vfscore/Makefile.uk b/lib/vfscore/Makefile.uk
> index c2064d9..45d3bcb 100644
> --- a/lib/vfscore/Makefile.uk
> +++ b/lib/vfscore/Makefile.uk
> @@ -45,4 +45,5 @@ UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += dup-1
>   UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += dup3-3
>   UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += dup2-2
>   UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += pwritev-4
> -UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += utimes-2
> \ No newline at end of file
> +UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += utimes-2
> +UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += mknod-3
> \ No newline at end of file
> diff --git a/lib/vfscore/exportsyms.uk b/lib/vfscore/exportsyms.uk
> index 44ff969..67f3fa8 100644
> --- a/lib/vfscore/exportsyms.uk
> +++ b/lib/vfscore/exportsyms.uk
> @@ -89,6 +89,8 @@ truncate
>   uk_syscall_e_truncate
>   uk_syscall_r_truncate
>   mknod
> +uk_syscall_e_mknod
> +uk_syscall_r_mknod
>   preadv
>   ioctl
>   fdatasync
> diff --git a/lib/vfscore/main.c b/lib/vfscore/main.c
> index 51417b9..d9496bf 100644
> --- a/lib/vfscore/main.c
> +++ b/lib/vfscore/main.c
> @@ -237,27 +237,25 @@ int __xmknod(int ver, const char *pathname, mode_t mode, dev_t *dev __unused)
>   
>   	trace_vfs_mknod(pathname, mode, *dev);
>   	if ((error = task_conv(t, pathname, VWRITE, path)) != 0)
> -		goto out_errno;
> +		goto out_error;
>   
>   	error = sys_mknod(path, mode);
>   	if (error)
> -		goto out_errno;
> +		goto out_error;
>   
>   	trace_vfs_mknod_ret();
>   	return 0;
>   
> -	out_errno:
> +	out_error:
>   	trace_vfs_mknod_err(error);
> -	errno = error;
> -	return -1;
> +	return -error;
>   }
>   
> -int mknod(const char *pathname, mode_t mode, dev_t dev)
> +UK_SYSCALL_R_DEFINE(int, mknod, const char*, pathname, mode_t, mode, dev_t, dev)
>   {
>   	return __xmknod(0, pathname, mode, &dev);
>   }
>   
> -
>   UK_TRACEPOINT(trace_vfs_lseek, "%d 0x%x %d", int, off_t, int);
>   UK_TRACEPOINT(trace_vfs_lseek_ret, "0x%x", off_t);
>   UK_TRACEPOINT(trace_vfs_lseek_err, "%d", int);
>


From minios-devel-bounces@lists.xenproject.org Fri Dec 04 14:51:39 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Fri, 04 Dec 2020 14:51:39 +0000
Received: from list by lists.xenproject.org with outflank-mailman.44867.80288 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1klCQr-00031J-J2; Fri, 04 Dec 2020 14:51:37 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 44867.80288; Fri, 04 Dec 2020 14:51: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 1klCQr-00031C-Fx; Fri, 04 Dec 2020 14:51:37 +0000
Received: by outflank-mailman (input) for mailman id 44867;
 Fri, 04 Dec 2020 14:51: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=lDdD=FI=gmail.com=dincadaniel97@srs-us1.protection.inumbo.net>)
 id 1klCQp-000313-Mh
 for minios-devel@lists.xen.org; Fri, 04 Dec 2020 14:51:35 +0000
Received: from mail-ej1-x643.google.com (unknown [2a00:1450:4864:20::643])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id b2940b75-b7cd-453c-aff3-4b999fbf8a59;
 Fri, 04 Dec 2020 14:51:34 +0000 (UTC)
Received: by mail-ej1-x643.google.com with SMTP id 7so9094389ejm.0
 for <minios-devel@lists.xen.org>; Fri, 04 Dec 2020 06:51:34 -0800 (PST)
Received: from [192.168.0.106] ([79.114.185.35])
 by smtp.gmail.com with ESMTPSA id k21sm2485759ejv.80.2020.12.04.06.51.32
 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128);
 Fri, 04 Dec 2020 06:51:33 -0800 (PST)
X-BeenThere: minios-devel@lists.xenproject.org
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
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: b2940b75-b7cd-453c-aff3-4b999fbf8a59
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20161025;
        h=subject:to:cc:references:from:message-id:date:user-agent
         :mime-version:in-reply-to:content-transfer-encoding:content-language;
        bh=eHUmadnbUr43wCPHnHWaqBzTeFy3pUXSZpYQuFtebFU=;
        b=dHcSCbtTbTKihWRkwr1HSFUoxcM44NstFCZnY9AhTIRlLlfOHOCsY4GvWzuZnAIZHC
         LFvylm4lgtCWCPzUUU7d8FfdpOhlymuO8CoDV9Z9kDA6oZZtUra87x+fSNQrsR7TsrFL
         DRkiCv/CwAODal8tWrpTx5/9HEbTc+5NSffVbBKjSdHeXvn2ICMu1ExQ27kxWHf2eNQP
         DvWv2renOUItqpYg5ug1vJj6XY0KyFA0McfTBsHFl8jlPxZiJtlOQvwlzDbEDV5yt3wb
         J8XYYyKIGi3KOI4ui6J7vBgfH1MRFwe0AFlcJtnPS47QHPdd50FyT/UDZWQwff7Tyvjl
         BTfw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20161025;
        h=x-gm-message-state:subject:to:cc:references:from:message-id:date
         :user-agent:mime-version:in-reply-to:content-transfer-encoding
         :content-language;
        bh=eHUmadnbUr43wCPHnHWaqBzTeFy3pUXSZpYQuFtebFU=;
        b=anzf83JML2dKN4DxCvn/Ozv7zk0RbdiVdOXjG3R1ko41gAJ5D4uryP9c52izIlAowI
         nygjOrJxXwsrSh9OTZqrNgRYAXst0hRhllwFP5HXdaXphtfepFp0xoeFkKv8JARNtdk1
         Y2ylD+J/hM7jJ7XjuEpaz6B4zwbYVWdiXnT+HV4jUdsvgcdnO7cRlXZFknGoygXKnG8f
         QecG2W6zqbqibz8Os/zzm4breWtgPA4ky5czUrV/6ZIChwDPCPHEKe7wt0EpmXIQpaUs
         H+IbpDPBGo3jqSyfwNjtq+7VCbFULHvPOSz+uQ4ntbfZYTe/EiP8cuvXTkRXP4ji4YwH
         N9hg==
X-Gm-Message-State: AOAM530U+cHfeSgF3aJjHQ7Wa8LEd58epWEJ+3hozJ2ONXT4blrBmnox
	kh1Ql/coqUoYi6ekUntgup0=
X-Google-Smtp-Source: ABdhPJxqlvrKkOcrXyJdMMYDqmzHutttWSwkV7mI7D+f5MmBUTpuA2bWV3bpzaycGhMA+VDMvtVk9A==
X-Received: by 2002:a17:907:11ca:: with SMTP id va10mr6283809ejb.78.1607093493902;
        Fri, 04 Dec 2020 06:51:33 -0800 (PST)
Subject: Re: [UNIKRAFT PATCH 04/10] lib/vfscore: Register `chmod` to
 syscall_shim
To: Constantin Raducanu <raducanu.costi@gmail.com>, minios-devel@lists.xen.org
Cc: simon.kuenzer@neclab.eu
References: <20200428120747.21674-1-raducanu.costi@gmail.com>
 <20200428120747.21674-4-raducanu.costi@gmail.com>
From: Daniel Dinca <dincadaniel97@gmail.com>
Message-ID: <5d3c8a0f-3531-ff08-4554-ff4c65848530@gmail.com>
Date: Fri, 4 Dec 2020 16:51:32 +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: <20200428120747.21674-4-raducanu.costi@gmail.com>
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
Content-Language: en-US

Looks good.

Reviewed-by: Daniel Dinca <dincadaniel97@gmail.com>

On 28.04.2020 15:07, Constantin Raducanu wrote:
> Registers `chmod` system call to syscall_shim library.
>
> Signed-off-by: Constantin Raducanu <raducanu.costi@gmail.com>
> ---
>   lib/vfscore/Makefile.uk   |  1 +
>   lib/vfscore/exportsyms.uk |  2 ++
>   lib/vfscore/main.c        | 14 +++++++-------
>   3 files changed, 10 insertions(+), 7 deletions(-)
>
> diff --git a/lib/vfscore/Makefile.uk b/lib/vfscore/Makefile.uk
> index 1cae643..8fef26e 100644
> --- a/lib/vfscore/Makefile.uk
> +++ b/lib/vfscore/Makefile.uk
> @@ -37,3 +37,4 @@ UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += truncate-2
>   UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += access-2
>   UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += faccessat-4
>   UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += fallocate-4
> +UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += chmod-2
> diff --git a/lib/vfscore/exportsyms.uk b/lib/vfscore/exportsyms.uk
> index b897aa7..30e6aba 100644
> --- a/lib/vfscore/exportsyms.uk
> +++ b/lib/vfscore/exportsyms.uk
> @@ -37,6 +37,8 @@ uk_syscall_e_ftruncate
>   uk_syscall_r_ftruncate
>   stat
>   chmod
> +uk_syscall_e_chmod
> +uk_syscall_r_chmod
>   fchmod
>   fchown
>   dup
> diff --git a/lib/vfscore/main.c b/lib/vfscore/main.c
> index eb007b9..aa688b8 100644
> --- a/lib/vfscore/main.c
> +++ b/lib/vfscore/main.c
> @@ -1978,25 +1978,25 @@ UK_TRACEPOINT(trace_vfs_chmod, "\"%s\" 0%0o", const char*, mode_t);
>   UK_TRACEPOINT(trace_vfs_chmod_ret, "");
>   UK_TRACEPOINT(trace_vfs_chmod_err, "%d", int);
>   
> -int chmod(const char *pathname, mode_t mode)
> +UK_SYSCALL_R_DEFINE(int, chmod, const char*, pathname, mode_t, mode)
>   {
>   	trace_vfs_chmod(pathname, mode);
>   	struct task *t = main_task;
>   	char path[PATH_MAX];
>   	int error = ENOENT;
>   	if (pathname == NULL)
> -		goto out_errno;
> +		goto out_error;
>   	if ((error = task_conv(t, pathname, VWRITE, path)) != 0)
> -		goto out_errno;
> +		goto out_error;
>   	error = sys_chmod(path, mode & UK_ALLPERMS);
>   	if (error)
> -		goto out_errno;
> +		goto out_error;
>   	trace_vfs_chmod_ret();
>   	return 0;
> -out_errno:
> +
> +out_error:
>   	trace_vfs_chmod_err(error);
> -	errno = error;
> -	return -1;
> +	return -error;
>   }
>   
>   UK_TRACEPOINT(trace_vfs_fchmod, "\"%d\" 0%0o", int, mode_t);
>


From minios-devel-bounces@lists.xenproject.org Fri Dec 04 14:51:50 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Fri, 04 Dec 2020 14:51:50 +0000
Received: from list by lists.xenproject.org with outflank-mailman.44869.80292 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1klCR4-00032X-LD; Fri, 04 Dec 2020 14:51:50 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 44869.80292; Fri, 04 Dec 2020 14:51: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 1klCR4-00032Q-Hv; Fri, 04 Dec 2020 14:51:50 +0000
Received: by outflank-mailman (input) for mailman id 44869;
 Fri, 04 Dec 2020 14:51: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=lDdD=FI=gmail.com=dincadaniel97@srs-us1.protection.inumbo.net>)
 id 1klCR2-00032C-Qm
 for minios-devel@lists.xen.org; Fri, 04 Dec 2020 14:51:48 +0000
Received: from mail-ed1-x542.google.com (unknown [2a00:1450:4864:20::542])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id e717916d-4440-4b8c-9557-e7160d30397e;
 Fri, 04 Dec 2020 14:51:48 +0000 (UTC)
Received: by mail-ed1-x542.google.com with SMTP id k4so6130522edl.0
 for <minios-devel@lists.xen.org>; Fri, 04 Dec 2020 06:51:48 -0800 (PST)
Received: from [192.168.0.106] ([79.114.185.35])
 by smtp.gmail.com with ESMTPSA id r7sm3575573edv.39.2020.12.04.06.51.46
 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128);
 Fri, 04 Dec 2020 06:51:46 -0800 (PST)
X-BeenThere: minios-devel@lists.xenproject.org
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
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: e717916d-4440-4b8c-9557-e7160d30397e
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20161025;
        h=subject:to:cc:references:from:message-id:date:user-agent
         :mime-version:in-reply-to:content-transfer-encoding:content-language;
        bh=Jo2b5e7DJlovE+/gtV+l39WB0uqm4Ms8DUGFAiy7T9c=;
        b=e5joO2sLaLpMMoXriPySrVP1MlGpLvWE68+HawdtYCtKEKbVrAGSxBNXPcV2V71gfA
         Iip01zdxXsc5s5tuBuKS8Ee7RhZy0q1SDZDykUfJ9wtL9axGktv0vkuMADebgc6aL4Bi
         E0qeAxgErTWkOsjfi/l5ENUEYYeaSpffr3uwARtLaiAHCmYdD8dsDCazH4LeBqnezrEB
         PRh3WkUzGiwi61p1DTe1AvG0JFr2/E0/7RxvVLO3JySXaTjyrHy74sybHKK/m+TThpzY
         35WMjIczGMO44W7Agd04ymgLbc0A+1Ojf/ythHUxaGqw1N6FRXriPYCqrCl7D+/v+bqB
         qPjg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20161025;
        h=x-gm-message-state:subject:to:cc:references:from:message-id:date
         :user-agent:mime-version:in-reply-to:content-transfer-encoding
         :content-language;
        bh=Jo2b5e7DJlovE+/gtV+l39WB0uqm4Ms8DUGFAiy7T9c=;
        b=TtaPcWeiazTNG5xfBDLI/SFTfbB7F9J7DkPZB8tt8MPo1MbODdd3ln01mJ+SZJ/rLC
         GudTDI43PKFxqF74Q823KDzn4EEc6ovqezyxXNxQEyTFBqtfVKUmqX3b2l8qDiH0Hhv5
         wxfrQVYz+yff+7lgzx2dUMQJY65qk27ALHOS9H08jhQ1hSswbF7XQOZkFlfYEkadXseG
         Qo+5mHadXLS4M8GWryfDB1w1Y+iRp4D8XquR7CqP9xA+PFeE13eLFm13wsE7hZtQ7Iol
         kkjoV0xvdf9tf6+2O1/GTDD4G5nhX2yh5Eafc1cbi/sIeXva6P3TyuiNYLVgYvIkxE8j
         Ei/g==
X-Gm-Message-State: AOAM532q87ayk/UsvQPQ6bs3lR02gU46r0ap9KO+IH9knfUeOSXaZXYC
	pVctcwSdJ74uBXyPFzNAZKM=
X-Google-Smtp-Source: ABdhPJxki3EMwh7XZyECMr8Um+xGVlp6SmmnbneOZW8WGVZe6hz9snMA8mrqK+rlPjEWxXH9cdUgwg==
X-Received: by 2002:a50:d6d3:: with SMTP id l19mr1986958edj.376.1607093507249;
        Fri, 04 Dec 2020 06:51:47 -0800 (PST)
Subject: Re: [UNIKRAFT PATCH 05/10] lib/vfscore: Register `fchmod` to
 syscall_shim
To: Constantin Raducanu <raducanu.costi@gmail.com>, minios-devel@lists.xen.org
Cc: simon.kuenzer@neclab.eu
References: <20200428120747.21674-1-raducanu.costi@gmail.com>
 <20200428120747.21674-5-raducanu.costi@gmail.com>
From: Daniel Dinca <dincadaniel97@gmail.com>
Message-ID: <d11c4688-adbf-7fb2-2e47-2b35f265bc9d@gmail.com>
Date: Fri, 4 Dec 2020 16:51: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: <20200428120747.21674-5-raducanu.costi@gmail.com>
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
Content-Language: en-US

Looks good.

Reviewed-by: Daniel Dinca <dincadaniel97@gmail.com>

On 28.04.2020 15:07, Constantin Raducanu wrote:
> Registers `fchmod` system call to syscall_shim library.
>
> Signed-off-by: Constantin Raducanu <raducanu.costi@gmail.com>
> ---
>   lib/vfscore/Makefile.uk   | 1 +
>   lib/vfscore/exportsyms.uk | 2 ++
>   lib/vfscore/main.c        | 9 ++++-----
>   3 files changed, 7 insertions(+), 5 deletions(-)
>
> diff --git a/lib/vfscore/Makefile.uk b/lib/vfscore/Makefile.uk
> index 8fef26e..e77818d 100644
> --- a/lib/vfscore/Makefile.uk
> +++ b/lib/vfscore/Makefile.uk
> @@ -38,3 +38,4 @@ UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += access-2
>   UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += faccessat-4
>   UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += fallocate-4
>   UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += chmod-2
> +UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += fchmod-2
> diff --git a/lib/vfscore/exportsyms.uk b/lib/vfscore/exportsyms.uk
> index 30e6aba..03a02bb 100644
> --- a/lib/vfscore/exportsyms.uk
> +++ b/lib/vfscore/exportsyms.uk
> @@ -40,6 +40,8 @@ chmod
>   uk_syscall_e_chmod
>   uk_syscall_r_chmod
>   fchmod
> +uk_syscall_e_fchmod
> +uk_syscall_r_fchmod
>   fchown
>   dup
>   dup2
> diff --git a/lib/vfscore/main.c b/lib/vfscore/main.c
> index aa688b8..d5ece51 100644
> --- a/lib/vfscore/main.c
> +++ b/lib/vfscore/main.c
> @@ -2002,17 +2002,16 @@ out_error:
>   UK_TRACEPOINT(trace_vfs_fchmod, "\"%d\" 0%0o", int, mode_t);
>   UK_TRACEPOINT(trace_vfs_fchmod_ret, "");
>   
> -int fchmod(int fd, mode_t mode)
> +UK_SYSCALL_R_DEFINE(int, fchmod, int, fd, mode_t, mode)
>   {
>   	trace_vfs_fchmod(fd, mode);
>   	int error = sys_fchmod(fd, mode & UK_ALLPERMS);
>   	trace_vfs_fchmod_ret();
>   	if (error) {
> -		errno = error;
> -		return -1;
> -	} else {
> -		return 0;
> +		return -error;
>   	}
> +
> +	return 0;
>   }
>   
>   UK_TRACEPOINT(trace_vfs_fchown, "\"%d\" %d %d", int, uid_t, gid_t);
>


From minios-devel-bounces@lists.xenproject.org Fri Dec 04 14:52:02 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Fri, 04 Dec 2020 14:52:02 +0000
Received: from list by lists.xenproject.org with outflank-mailman.44871.80295 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1klCRG-00033q-Mg; Fri, 04 Dec 2020 14:52:02 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 44871.80295; Fri, 04 Dec 2020 14:52: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 1klCRG-00033j-Jq; Fri, 04 Dec 2020 14:52:02 +0000
Received: by outflank-mailman (input) for mailman id 44871;
 Fri, 04 Dec 2020 14:52: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=lDdD=FI=gmail.com=dincadaniel97@srs-us1.protection.inumbo.net>)
 id 1klCRF-00033d-I6
 for minios-devel@lists.xen.org; Fri, 04 Dec 2020 14:52:01 +0000
Received: from mail-ed1-x543.google.com (unknown [2a00:1450:4864:20::543])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 2383d02b-332e-4a1c-93f1-5ea1204fb5da;
 Fri, 04 Dec 2020 14:52:00 +0000 (UTC)
Received: by mail-ed1-x543.google.com with SMTP id b2so6102976edm.3
 for <minios-devel@lists.xen.org>; Fri, 04 Dec 2020 06:52:00 -0800 (PST)
Received: from [192.168.0.106] ([79.114.185.35])
 by smtp.gmail.com with ESMTPSA id ov22sm3304771ejb.23.2020.12.04.06.51.59
 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128);
 Fri, 04 Dec 2020 06:51:59 -0800 (PST)
X-BeenThere: minios-devel@lists.xenproject.org
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
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: 2383d02b-332e-4a1c-93f1-5ea1204fb5da
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20161025;
        h=subject:to:cc:references:from:message-id:date:user-agent
         :mime-version:in-reply-to:content-transfer-encoding:content-language;
        bh=l+vcTeA7K2EaZCoe5AodCvyBM/1uZPbLHcoGGNFeqxE=;
        b=M3Kb/LMpVYSEQb1GAWU/P4s9KcJ6MSDGAscYnbAJThf9um/92QRGG9bXWo3oXjJ5QK
         nzsa6PwKZHb943tKgNKWiUf/mrmyXohH7mipJDEYmtDYEjRwkLqNsFMhUSkNUtR6nugT
         W6lPEPBBo+TpxQ8V0k/Nql7Qkk53Ne3OskFiv3yfhQcrTFTTXrqiEt30qLPvTwk63iIt
         3k6RPYmqX8z+66AcPIhoydBAWoWKkM4A71x98gCBYtpG50UsmWwvkTQGkmMxhP95U9qN
         5X0xIIvHfvyO52a/E1LUBBKdsjrWKXc/KHXIZ0kQshkKP1J5mE0Z3+OC7dAH6YZ+8N3Q
         QiUA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20161025;
        h=x-gm-message-state:subject:to:cc:references:from:message-id:date
         :user-agent:mime-version:in-reply-to:content-transfer-encoding
         :content-language;
        bh=l+vcTeA7K2EaZCoe5AodCvyBM/1uZPbLHcoGGNFeqxE=;
        b=lUg4Pz9JVS2ExLSbG0/AIR7dmTN1PKSThGQlXjdTORDsSNLIez/xJEO90LSHU+Ub9m
         fjFJf/8DiERJyQ0b0ovX0mFTvqNAWkzjqtZ4J35yiIqo7wOjHCRIMUoVE6fwT1w3Cc+Z
         xlxTAQzpXiRyBk7RY1zjT3ytkmCwG4sLF1OolIyjTOMioWCxlWND/sFDlXjP9cyHrU1j
         fSoQJqX3Hoin7vc/t1o9jLZb2GxZM/xS0avQt0yutslOXf8zlQsruLdthuOxKt0M7uBH
         1Q++EjqaKZu9VORPIxPO3CG94j0qgxPlFIpOwFCH6xcUqW9cYbcw1dwHZpWwmwBo1kR2
         YB6g==
X-Gm-Message-State: AOAM530EQTG8LdOgaceCprNnC9FjT5hg8nipzlkbxLiULz9SvqYeh5Ek
	GpnbtuA2d7ZDdBa+QIytT7NM/l6DKS2szQ==
X-Google-Smtp-Source: ABdhPJzAMJn0qnjAjBN9ALxATecdbYxVIRtNueMzP6uArWjW1Ct3+zOWzujxPDPo8o8DlbP5wLI2LA==
X-Received: by 2002:a05:6402:1421:: with SMTP id c1mr7963379edx.247.1607093519908;
        Fri, 04 Dec 2020 06:51:59 -0800 (PST)
Subject: Re: [UNIKRAFT PATCH 3/5] lib/vfscore: Register `link` to syscall_shim
To: Constantin Raducanu <raducanu.costi@gmail.com>, minios-devel@lists.xen.org
Cc: simon.kuenzer@neclab.eu
References: <20200417194116.23195-1-raducanu.costi@gmail.com>
 <20200417194116.23195-3-raducanu.costi@gmail.com>
From: Daniel Dinca <dincadaniel97@gmail.com>
Message-ID: <df509b6b-2d85-1a32-6daa-02abb7a5f982@gmail.com>
Date: Fri, 4 Dec 2020 16:51:58 +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: <20200417194116.23195-3-raducanu.costi@gmail.com>
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
Content-Language: en-US

Looks good.

Reviewed-by: Daniel Dinca <dincadaniel97@gmail.com>

On 17.04.2020 22:41, Constantin Raducanu wrote:
> Registers `link` system call to syscall_shim library.
>
> Signed-off-by: Constantin Raducanu <raducanu.costi@gmail.com>
> ---
>   lib/vfscore/Makefile.uk   |  3 ++-
>   lib/vfscore/exportsyms.uk |  2 ++
>   lib/vfscore/main.c        | 17 +++++++++--------
>   3 files changed, 13 insertions(+), 9 deletions(-)
>
> diff --git a/lib/vfscore/Makefile.uk b/lib/vfscore/Makefile.uk
> index ec415f4..3986676 100644
> --- a/lib/vfscore/Makefile.uk
> +++ b/lib/vfscore/Makefile.uk
> @@ -30,4 +30,5 @@ UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += read-3 readv-3
>   UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += fstat-2
>   UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += readlink-3
>   UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += close-1
> -UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += lseek-3
> \ No newline at end of file
> +UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += lseek-3
> +UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += link-2
> \ No newline at end of file
> diff --git a/lib/vfscore/exportsyms.uk b/lib/vfscore/exportsyms.uk
> index 5ad97c2..57413d6 100644
> --- a/lib/vfscore/exportsyms.uk
> +++ b/lib/vfscore/exportsyms.uk
> @@ -45,6 +45,8 @@ vfscore_mount_dump
>   umount
>   umount2
>   link
> +uk_syscall_e_link
> +uk_syscall_r_link
>   unlink
>   getcwd
>   chown
> diff --git a/lib/vfscore/main.c b/lib/vfscore/main.c
> index 8bbce80..b5b7e40 100644
> --- a/lib/vfscore/main.c
> +++ b/lib/vfscore/main.c
> @@ -1070,7 +1070,7 @@ UK_TRACEPOINT(trace_vfs_link, "\"%s\" \"%s\"", const char*, const char*);
>   UK_TRACEPOINT(trace_vfs_link_ret, "");
>   UK_TRACEPOINT(trace_vfs_link_err, "%d", int);
>   
> -int link(const char *oldpath, const char *newpath)
> +UK_SYSCALL_R_DEFINE(int, link, const char*, oldpath, const char*, newpath)
>   {
>   	struct task *t = main_task;
>   	char path1[PATH_MAX];
> @@ -1081,21 +1081,22 @@ int link(const char *oldpath, const char *newpath)
>   
>   	error = ENOENT;
>   	if (oldpath == NULL || newpath == NULL)
> -		goto out_errno;
> +		goto out_error;
>   	if ((error = task_conv(t, oldpath, VWRITE, path1)) != 0)
> -		goto out_errno;
> +		goto out_error;
>   	if ((error = task_conv(t, newpath, VWRITE, path2)) != 0)
> -		goto out_errno;
> +		goto out_error;
>   
>   	error = sys_link(path1, path2);
>   	if (error)
> -		goto out_errno;
> +		goto out_error;
> +
>   	trace_vfs_link_ret();
>   	return 0;
> -	out_errno:
> +
> +	out_error:
>   	trace_vfs_link_err(error);
> -	errno = error;
> -	return -1;
> +	return -error;
>   }
>   
>   
>


From minios-devel-bounces@lists.xenproject.org Mon Dec 07 10:04:46 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Mon, 07 Dec 2020 10:04:46 +0000
Received: from list by lists.xenproject.org with outflank-mailman.46069.81713 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1kmDNq-00032W-Fy; Mon, 07 Dec 2020 10:04:42 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 46069.81713; Mon, 07 Dec 2020 10:04: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 1kmDNq-00032P-Ce; Mon, 07 Dec 2020 10:04:42 +0000
Received: by outflank-mailman (input) for mailman id 46069;
 Mon, 07 Dec 2020 10:04: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=mrSU=FL=arm.com=jianyong.wu@srs-us1.protection.inumbo.net>)
 id 1kmDNo-00032K-VO
 for minios-devel@lists.xenproject.org; Mon, 07 Dec 2020 10:04:41 +0000
Received: from EUR05-AM6-obe.outbound.protection.outlook.com (unknown
 [40.107.22.81]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id f817d086-cbc7-49e3-8bf8-2dab54e1d412;
 Mon, 07 Dec 2020 10:04:36 +0000 (UTC)
Received: from DB6PR0802CA0038.eurprd08.prod.outlook.com (2603:10a6:4:a3::24)
 by AM6PR08MB3352.eurprd08.prod.outlook.com (2603:10a6:209:4c::22)
 with Microsoft SMTP Server (version=TLS1_2,
 cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3611.25; Mon, 7 Dec
 2020 10:04:34 +0000
Received: from DB5EUR03FT039.eop-EUR03.prod.protection.outlook.com
 (2603:10a6:4:a3:cafe::9) by DB6PR0802CA0038.outlook.office365.com
 (2603:10a6:4:a3::24) with Microsoft SMTP Server (version=TLS1_2,
 cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3632.17 via Frontend
 Transport; Mon, 7 Dec 2020 10:04:32 +0000
Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by
 DB5EUR03FT039.mail.protection.outlook.com (10.152.21.120) with
 Microsoft SMTP
 Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id
 15.20.3632.17 via Frontend Transport; Mon, 7 Dec 2020 10:04:32 +0000
Received: ("Tessian outbound 6ec21dac9dd3:v71");
 Mon, 07 Dec 2020 10:04:32 +0000
Received: from e00190b8adaf.1
 by 64aa7808-outbound-1.mta.getcheckrecipient.com id
 7E16646B-92C3-473F-9595-3ECB6A6588CD.1; 
 Mon, 07 Dec 2020 10:04:27 +0000
Received: from EUR04-DB3-obe.outbound.protection.outlook.com
 by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id e00190b8adaf.1
 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384);
 Mon, 07 Dec 2020 10:04:27 +0000
Received: from HE1PR0802MB2555.eurprd08.prod.outlook.com (2603:10a6:3:e0::7)
 by HE1PR08MB2700.eurprd08.prod.outlook.com (2603:10a6:7:39::20) with
 Microsoft SMTP Server (version=TLS1_2,
 cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3632.23; Mon, 7 Dec
 2020 10:04:25 +0000
Received: from HE1PR0802MB2555.eurprd08.prod.outlook.com
 ([fe80::9930:b22f:9e8c:8200]) by HE1PR0802MB2555.eurprd08.prod.outlook.com
 ([fe80::9930:b22f:9e8c:8200%5]) with mapi id 15.20.3632.017; Mon, 7 Dec 2020
 10:04:25 +0000
X-BeenThere: minios-devel@lists.xenproject.org
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
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: f817d086-cbc7-49e3-8bf8-2dab54e1d412
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com;
 s=selector2-armh-onmicrosoft-com;
 h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck;
 bh=6Wzg+owL4B6UCrKu9gss3cej0QLeMjKlIiVhH4oix8k=;
 b=tJAS/rMy2PMca1vscSLWYjGjubPNGBiKMGQEUQUv5RX6ck2o15nPIuBarjqi3o7M3urYbz6B6GM4kaTT53jkDNuenAHVaYDey0NHr5QYaCR7XFpiLlE+9UHy/1SYo18MTBg7ECDxHOQ3iuWlPAPruQwJaav2JrbGn386XW3cJEM=
X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.35.35.123)
 smtp.mailfrom=arm.com; lists.xenproject.org; dkim=pass (signature was
 verified) header.d=armh.onmicrosoft.com;lists.xenproject.org; dmarc=pass
 action=none header.from=arm.com;
Received-SPF: Pass (protection.outlook.com: domain of arm.com designates
 63.35.35.123 as permitted sender) receiver=protection.outlook.com;
 client-ip=63.35.35.123; helo=64aa7808-outbound-1.mta.getcheckrecipient.com;
X-CR-MTA-TID: 64aa7808
ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none;
 b=MRE6dp9UuF+mir6PgnslIgVZdssHG7iQJSenYBHJkS/k8/KK0+PHwMp7coKVlxdyDTjEe+p085szJYeD6URz0UtUe6vd6KO2/vOnWm0O7i+9idFXlZ8eUcwNPYm/ou0YehGT5NeG8j6gWSMoRLVXdzpAhici4+3YYLu9KBuVJzJwERbZXAxWFyKWE4M7ohVsrzPVkghP8VZquq2ZFsIX3FlTvMs0wtNAjwjgt6lm6JxmOYuG4TDzLVZyyA14fv+9gnm7E1s25neXGiNoFQJNcXy8L/Aa9LRjMXT80VPT+ze+fiy+twR5O/pE6NmzDTUGlTZ4PIj/D7ixLBQESKOLXQ==
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=6Wzg+owL4B6UCrKu9gss3cej0QLeMjKlIiVhH4oix8k=;
 b=FdByR0794FQDppXaA5AzRvu7oa9he+UDBWI0Pwi8677PQkknAqoDMLMOXHAceWxmOMORRvBV7P++pciNyjvT+O7GO0TbFGFPDUEuJB+hjMk9m0PatpwOb3ZLMKXch+UZlc94AOr6u9lIglS1eFWAh2BiTGt973wZDixBqMV5VN/aRAdhfwbZPt/ReqthqYH/CqrKfKiwtNYh+OzLSofkhbIPQWMR7koVzGkf4MLkluUXsB985oe0zfzUNKkyT33MTiprWc40WFdQrYvYoTJBKZ44Wfv5KVA1T9ve09X60SBxuYM/sz/tWRyJ0f6aS3PmsE0q+s24awnulAR7gwdeRg==
ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass
 smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass
 header.d=arm.com; arc=none
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com;
 s=selector2-armh-onmicrosoft-com;
 h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck;
 bh=6Wzg+owL4B6UCrKu9gss3cej0QLeMjKlIiVhH4oix8k=;
 b=tJAS/rMy2PMca1vscSLWYjGjubPNGBiKMGQEUQUv5RX6ck2o15nPIuBarjqi3o7M3urYbz6B6GM4kaTT53jkDNuenAHVaYDey0NHr5QYaCR7XFpiLlE+9UHy/1SYo18MTBg7ECDxHOQ3iuWlPAPruQwJaav2JrbGn386XW3cJEM=
From: Jianyong Wu <Jianyong.Wu@arm.com>
To: Sharan Santhanam <sharan.santhanam@neclab.eu>,
	"minios-devel@lists.xenproject.org" <minios-devel@lists.xenproject.org>,
	"simon.kuenzer@neclab.eu" <simon.kuenzer@neclab.eu>
CC: Justin He <Justin.He@arm.com>
Subject: RE: [Minios-devel] [PATCH] arm/rtc: enable pl031 for arm64.
Thread-Topic: [Minios-devel] [PATCH] arm/rtc: enable pl031 for arm64.
Thread-Index: AQHWB0LT0W7EMY1atkSduebKZyeGQaniZIUAgAI+wlCAB9+NEA==
Date: Mon, 7 Dec 2020 10:04:25 +0000
Message-ID:
 <HE1PR0802MB255524512178E169E6BEEA1DF4CE0@HE1PR0802MB2555.eurprd08.prod.outlook.com>
References: <20200331095711.44593-1-jianyong.wu@arm.com>
 <b635ae64-5753-09ff-2a2c-5a5f5d4fc336@neclab.eu>
 <HE1PR0802MB25556B8C059409A3D31979B8F4F30@HE1PR0802MB2555.eurprd08.prod.outlook.com>
In-Reply-To:
 <HE1PR0802MB25556B8C059409A3D31979B8F4F30@HE1PR0802MB2555.eurprd08.prod.outlook.com>
Accept-Language: en-US
Content-Language: en-US
X-MS-Has-Attach:
X-MS-TNEF-Correlator:
x-ts-tracking-id: 5553973B8986B74DA084E88973BF3DD2.0
x-checkrecipientchecked: true
Authentication-Results-Original: neclab.eu; dkim=none (message not signed)
 header.d=none;neclab.eu; dmarc=none action=none header.from=arm.com;
x-originating-ip: [203.126.0.111]
x-ms-publictraffictype: Email
X-MS-Office365-Filtering-HT: Tenant
X-MS-Office365-Filtering-Correlation-Id: fde45ca9-0648-4821-1b08-08d89a977e9e
x-ms-traffictypediagnostic: HE1PR08MB2700:|AM6PR08MB3352:
x-ms-exchange-transport-forked: True
X-Microsoft-Antispam-PRVS:
	<AM6PR08MB33522459077A4EA2C3D63775F4CE0@AM6PR08MB3352.eurprd08.prod.outlook.com>
x-checkrecipientrouted: true
nodisclaimer: true
x-ms-oob-tlc-oobclassifiers: OLM:7691;OLM:8882;
X-MS-Exchange-SenderADCheck: 1
X-Microsoft-Antispam-Untrusted: BCL:0;
X-Microsoft-Antispam-Message-Info-Original:
 dS71lvyInNXvNSO1rKU6YK5w6xkH3qqavNS1lXI19JmomIZDc3bXnAzKWZj0sFaYY8b6VDohpnShI4va7uV86Nqsqb5Hc1WKWIq8WlF07lo/LGGMHIFMPeJBS5xbH5+CEVDqJzUVHPLDZL17NKANNFcPmd/E1VNhnflwkZsHd2xSFCsswN34WUqGLpJXQI5JYVp6GlOQepBVWfF8bYopxXGiQAqnyk0G/a3qCxApHBnHOY2tKvMpebYYi1BxO3IQ7u/ZOSY7gWC7f085QL7kOeH9kOEq4qU5w4hjxd4E/whD4qgQv8JU2lS9fcZ4KQvQnKIjNCF/nBooEkR5IO+9xQ==
X-Forefront-Antispam-Report-Untrusted:
 CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:HE1PR0802MB2555.eurprd08.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(39860400002)(366004)(376002)(346002)(396003)(136003)(71200400001)(478600001)(4326008)(9686003)(33656002)(110136005)(66446008)(6506007)(76116006)(2906002)(30864003)(8936002)(316002)(55016002)(66556008)(26005)(5660300002)(52536014)(8676002)(64756008)(66946007)(86362001)(186003)(66476007)(7696005)(53546011)(83380400001)(579004);DIR:OUT;SFP:1101;
x-ms-exchange-antispam-messagedata:
 =?utf-8?B?TjhINjBTc0lpWXhrMkdBV2RCTGVUZ1BVaVNHdjJEalRGRFdMaXlTOXRBelBw?=
 =?utf-8?B?QkFzeFVGVElyYnN0TzJienFvYjk2aHlmWVI2NWd3K0xtOU14bFEzeDg4SEFq?=
 =?utf-8?B?cHZsdnE3aElQOERMOTBJaVF2SG9NbUZQNVV1a2tiMnU1NWtIM2t1eFA2WWYr?=
 =?utf-8?B?VmVLNDNsWDVaOTdrSGRPSEYwaXlnNmpuZG5wQk43NlV5emFacndhUlpXQm9r?=
 =?utf-8?B?MGtDSWdnQnBXSHNVcEhjR01GdTlJU1F5b3cxakRBOStkTDZjYXF5dGNGVTd3?=
 =?utf-8?B?YnFvaVhUN3RGWmNwZkdnK1UrS3lWeFF4YmNZSU5GTG5MdFhrdVNKZE94eElE?=
 =?utf-8?B?T2V1cktnZmFtcUtSZ0V0S2wyQ2Y4cHUrTUNLMVE5RW1YV3FacmlWYnhGVlo4?=
 =?utf-8?B?eWpJSm1Kb3E0Q1NGVTVWYjVpWlA5Z0NHVDNDdW9od3RrOG13RnBTU2RBS3Zi?=
 =?utf-8?B?TCtZdWFiNXRUSC9ZL1lOcjNSRU95WWdWS1c1L0hjZ0Z4S1ovYm9IcjFaaFJS?=
 =?utf-8?B?TkoyTTJvWGNuSGdUck51dEZKWkE2dHNaKzk2MWo2WEJvQVRXaVdlQk5palkr?=
 =?utf-8?B?amVzTG9GL3JuQjVNT2ErUXZBZGdkWW9hbkZsMFRsOEJyS3hTZGd3NmJUVVp0?=
 =?utf-8?B?b1JoZG5JMlhPMmx4YlRETGh5SUlZVTJKSFBYTmlXbWRyZXNYQU02SWQ0eU1E?=
 =?utf-8?B?eUpQamZxNXJaWUJkWFh0VzNHNHBNRE1jb1FYM3duanhGYittdDM4TGZ3bUsy?=
 =?utf-8?B?dDdYVWo2cVlCbVAzdnNXWVJSaVJCRWlMaktIckdYdEQzaXhJbjRwWnJiRW9P?=
 =?utf-8?B?MVdZaVdZa2FqMEE4Q3pqSUNjaXNwSDNibWZLbHovT2s5cEova0dnWW5iVitH?=
 =?utf-8?B?biswSUpLRko1V3VIbW5TY0daNys1TkpsL2VqRVFmL3o2N0V1NTNmRDlpcWZs?=
 =?utf-8?B?dG80aStldjJITW5UOC80dXAwK1U0dVF1alJYKzlCcTJ6Y1JnUFJnQmxLOUcy?=
 =?utf-8?B?eWJpUERFOTRXSkNvVTRFMmpOcUFFMndURzZFbm9hYzEyWm9OeEdJSGRPa29i?=
 =?utf-8?B?dzFmT2Z0WWdpUEFEY29XZGR6YjJyNFMyUmdzb1FScGVqaHBNdG1zQ1Z4QWRD?=
 =?utf-8?B?U2VWMCtrdTNIekxQTHd3dmxlZzdSV25GVmNPL1JvWVFDTCtyT2s2a3lBQ0RH?=
 =?utf-8?B?TGMvbEQwUU9ueWlXQTNOdUdLaXp3MkRlUUo2SCtNK0FZRndYMkxWYndnN3hk?=
 =?utf-8?B?UXFpbFIyWDhuZEVNZFNQRVRudkhhRWZHSjNaOFo4aVFkUFN1Mk9RNnNjV0RF?=
 =?utf-8?Q?uCwob5H4E/ohM=3D?=
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: base64
MIME-Version: 1.0
X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR08MB2700
Original-Authentication-Results: neclab.eu; dkim=none (message not signed)
 header.d=none;neclab.eu; dmarc=none action=none header.from=arm.com;
X-EOPAttributedMessage: 0
X-MS-Exchange-Transport-CrossTenantHeadersStripped:
 DB5EUR03FT039.eop-EUR03.prod.protection.outlook.com
X-MS-Office365-Filtering-Correlation-Id-Prvs:
	c2661812-b073-4806-6e2f-08d89a977a6e
X-Microsoft-Antispam: BCL:0;
X-Microsoft-Antispam-Message-Info:
	tJgCocmy1e9TtzVIjRrxSwWbmBn/6sB9QK91rFxi7bTtwvAFQ+PWgst7581UoQtosJmQ3vJZMaDsafLE7E4qxp44Nwi8tAjynMjckcMikj36mMrPj3G9AQUmHetoZaFcYGhPZ6R2effP29UxtyDrJOo5hzGiGyGOUq+W6MMtkEor7T6QfIPUO+llPM3U8LYx59XU59ibkqp+JXkv/NyVbXztGGKuZmmHWtqkCOv+9D3FRuKfCfdnZ5mdtK7+MrV4fTw6TbLasp2heilfFouMtI/Ab6o5rcrSn6b9CwhJVipcvq8iALoBu4xdmPToM/tBY3PeS/GV0Z8iYztBpaWlM2Mkpnt1kh84vWMAr1mVL0Gs7rImOAyObxZp4twmAVcWL0EKrt+p9cS0XU83zEs67g==
X-Forefront-Antispam-Report:
	CIP:63.35.35.123;CTRY:IE;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:64aa7808-outbound-1.mta.getcheckrecipient.com;PTR:ec2-63-35-35-123.eu-west-1.compute.amazonaws.com;CAT:NONE;SFS:(4636009)(136003)(39860400002)(346002)(376002)(396003)(46966005)(52536014)(7696005)(4326008)(55016002)(30864003)(53546011)(336012)(83380400001)(110136005)(356005)(316002)(82310400003)(6506007)(2906002)(86362001)(70206006)(8676002)(26005)(5660300002)(33656002)(70586007)(81166007)(82740400003)(8936002)(478600001)(9686003)(47076004)(186003);DIR:OUT;SFP:1101;
X-OriginatorOrg: arm.com
X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Dec 2020 10:04:32.7750
 (UTC)
X-MS-Exchange-CrossTenant-Network-Message-Id: fde45ca9-0648-4821-1b08-08d89a977e9e
X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d
X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d;Ip=[63.35.35.123];Helo=[64aa7808-outbound-1.mta.getcheckrecipient.com]
X-MS-Exchange-CrossTenant-AuthSource:
	DB5EUR03FT039.eop-EUR03.prod.protection.outlook.com
X-MS-Exchange-CrossTenant-AuthAs: Anonymous
X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem
X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR08MB3352

SGkgU2hhcmFuLA0KDQo+IC0tLS0tT3JpZ2luYWwgTWVzc2FnZS0tLS0tDQo+IEZyb206IEppYW55
b25nIFd1DQo+IFNlbnQ6IFdlZG5lc2RheSwgRGVjZW1iZXIgMiwgMjAyMCAxOjA5IFBNDQo+IFRv
OiBTaGFyYW4gU2FudGhhbmFtIDxzaGFyYW4uc2FudGhhbmFtQG5lY2xhYi5ldT47IG1pbmlvcy0N
Cj4gZGV2ZWxAbGlzdHMueGVucHJvamVjdC5vcmc7IHNpbW9uLmt1ZW56ZXJAbmVjbGFiLmV1DQo+
IENjOiBKdXN0aW4gSGUgPEp1c3Rpbi5IZUBhcm0uY29tPjsgV2VpIENoZW4gPFdlaS5DaGVuQGFy
bS5jb20+DQo+IFN1YmplY3Q6IFJFOiBbTWluaW9zLWRldmVsXSBbUEFUQ0hdIGFybS9ydGM6IGVu
YWJsZSBwbDAzMSBmb3IgYXJtNjQuDQo+DQo+IEhpIFNoYXJhbiwNCj4NCj4gVGhhbmtzIGZvciB5
b3VyIGNvbW1lbnRzLg0KPg0KPiA+IC0tLS0tT3JpZ2luYWwgTWVzc2FnZS0tLS0tDQo+ID4gRnJv
bTogU2hhcmFuIFNhbnRoYW5hbSA8c2hhcmFuLnNhbnRoYW5hbUBuZWNsYWIuZXU+DQo+ID4gU2Vu
dDogVHVlc2RheSwgRGVjZW1iZXIgMSwgMjAyMCAxMjo1NSBBTQ0KPiA+IFRvOiBKaWFueW9uZyBX
dSA8SmlhbnlvbmcuV3VAYXJtLmNvbT47IG1pbmlvcy0NCj4gPiBkZXZlbEBsaXN0cy54ZW5wcm9q
ZWN0Lm9yZzsgc2ltb24ua3VlbnplckBuZWNsYWIuZXUNCj4gPiBDYzogSnVzdGluIEhlIDxKdXN0
aW4uSGVAYXJtLmNvbT47IFdlaSBDaGVuIDxXZWkuQ2hlbkBhcm0uY29tPg0KPiA+IFN1YmplY3Q6
IFJlOiBbTWluaW9zLWRldmVsXSBbUEFUQ0hdIGFybS9ydGM6IGVuYWJsZSBwbDAzMSBmb3IgYXJt
NjQuDQo+ID4NCj4gPiBIZWxsbyBKaWFueW9uZyBXdSwNCj4gPg0KPiA+IFBsZWFzZSBmaW5kIHRo
ZSBjb21tZW50cyBpbmxpbmU6DQo+ID4NCj4gPiBUaGFua3MgJiBSZWdhcmRzDQo+ID4gU2hhcmFu
DQo+ID4NCj4gPiBPbiAzLzMxLzIwIDExOjU3IEFNLCBKaWFueW9uZyBXdSB3cm90ZToNCj4gPiA+
IEN1cnJlbnRseSwgcnRjIGlzIG5vdCBlbmFibGVkIGluIGFybSwgc28gd2FsbCB0aW1lIGNhbid0
IGJlIHByb3ZpZGVkDQo+ID4gPiBjdXJyZWN0bHkuDQo+ID4gPiBwbDAzMSBpcyBjaG9zZW4gYXMg
dGhlIHJ0YyBkZXZpY2UgZm9yIGFybSBpbiB0aGlzIHBhdGNoLCBidXQgd2UgaGF2ZQ0KPiA+ID4g
aW50ZXJmYWNlIGV4dGVuc2lvbiBvZiBjYXBhYmxlIG9mIHBsdWdnaW5nIG90aGVyIHJ0YyBkZXZp
Y2UuDQo+ID4gPg0KPiA+ID4gVGhpcyBwYXRjaCB1c2UgdGhlIG5ldyBmZHQgQVBJIG9mDQo+ID4g
ImZkdF9ub2RlX29mZnNldF9pZHhfYnlfY29tcGF0aWJsZV9saXN0Ig0KPiA+ID4gaW4gSnVzdGlu
J3MgcGF0Y2ggaW4gcmV2aWV3Lg0KPiA+ID4NCj4gPiA+IFNpZ25lZC1vZmYtYnk6IFdlaSBDaGVu
IDx3ZWkuY2hlbkBhcm0uY29tPg0KPiA+ID4gU2lnbmVkLW9mZi1ieTogSmlhbnlvbmcgV3UgPGpp
YW55b25nLnd1QGFybS5jb20+DQo+ID4gPiAtLS0NCj4gPiA+ICAgcGxhdC9jb21tb24vYXJtL3Rp
bWUuYyAgICAgICAgIHwgICAyICsNCj4gPiA+ICAgcGxhdC9kcml2ZXJzL2luY2x1ZGUvcnRjL3J0
Yy5oIHwgIDc3ICsrKysrKysrDQo+ID4gPiAgIHBsYXQvZHJpdmVycy9ydGMvcGwwMzEuYyAgICAg
ICB8IDMxNQ0KPiA+ICsrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKw0KPiA+ID4gICBw
bGF0L2t2bS9Db25maWcudWsgICAgICAgICAgICAgfCAgIDUgKw0KPiA+ID4gICBwbGF0L2t2bS9N
YWtlZmlsZS51ayAgICAgICAgICAgfCAgMTEgKy0NCj4gPiA+ICAgNSBmaWxlcyBjaGFuZ2VkLCA0
MDkgaW5zZXJ0aW9ucygrKSwgMSBkZWxldGlvbigtKQ0KPiA+ID4gICBjcmVhdGUgbW9kZSAxMDA2
NDQgcGxhdC9kcml2ZXJzL2luY2x1ZGUvcnRjL3J0Yy5oDQo+ID4gPiAgIGNyZWF0ZSBtb2RlIDEw
MDY0NCBwbGF0L2RyaXZlcnMvcnRjL3BsMDMxLmMNCj4gPiA+DQo+ID4gPiBkaWZmIC0tZ2l0IGEv
cGxhdC9jb21tb24vYXJtL3RpbWUuYyBiL3BsYXQvY29tbW9uL2FybS90aW1lLmMgaW5kZXgNCj4g
PiA+IGJiYjNjNzIuLjc1NjBmZmYgMTAwNjQ0DQo+ID4gPiAtLS0gYS9wbGF0L2NvbW1vbi9hcm0v
dGltZS5jDQo+ID4gPiArKysgYi9wbGF0L2NvbW1vbi9hcm0vdGltZS5jDQo+ID4gPiBAQCAtMTUw
LDQgKzE1MCw2IEBAIHZvaWQgdWtwbGF0X3RpbWVfaW5pdCh2b2lkKQ0KPiA+ID4NCj4gPiA+ICAg
LyogRW5hYmxlIHRpbWVyICovDQo+ID4gPiAgIGdlbmVyaWNfdGltZXJfZW5hYmxlKCk7DQo+ID4g
PiArLyogSW5pdGlhbGl6ZSBydGMgKi8NCj4gPiA+ICtfZHRiX2luaXRfcnRjKF9saWJrdm1wbGF0
X2NmZy5kdGIpOw0KPiA+ID4gICB9DQo+ID4gPiBkaWZmIC0tZ2l0IGEvcGxhdC9kcml2ZXJzL2lu
Y2x1ZGUvcnRjL3J0Yy5oDQo+ID4gPiBiL3BsYXQvZHJpdmVycy9pbmNsdWRlL3J0Yy9ydGMuaCBu
ZXcgZmlsZSBtb2RlIDEwMDY0NCBpbmRleA0KPiA+ID4gMDAwMDAwMC4uNGRhZmI4Nw0KPiA+ID4g
LS0tIC9kZXYvbnVsbA0KPiA+ID4gKysrIGIvcGxhdC9kcml2ZXJzL2luY2x1ZGUvcnRjL3J0Yy5o
DQo+ID4gPiBAQCAtMCwwICsxLDc3IEBADQo+ID4gPiArLyogU1BEWC1MaWNlbnNlLUlkZW50aWZp
ZXI6IEJTRC0zLUNsYXVzZSAqLw0KPiA+ID4gKy8qDQo+ID4gPiArICogQXV0aG9yczogV2VpIENo
ZW4gPFdlaS5DaGVuQGFybS5jb20+DQo+ID4gPiArICogICAgICAgICAgSmlhbnlvbmcgV3UgPEpp
YW55b25nLld1QGFybS5jb20+DQo+ID4gPiArICoNCj4gPiA+ICsgKiBDb3B5cmlnaHQgKGMpIDIw
MTksIEFybSBMdGQuIEFsbCByaWdodHMgcmVzZXJ2ZWQuDQo+ID4gPiArICoNCj4gPiA+ICsgKiBS
ZWRpc3RyaWJ1dGlvbiBhbmQgdXNlIGluIHNvdXJjZSBhbmQgYmluYXJ5IGZvcm1zLCB3aXRoIG9y
DQo+ID4gPiArd2l0aG91dA0KPiA+ID4gKyAqIG1vZGlmaWNhdGlvbiwgYXJlIHBlcm1pdHRlZCBw
cm92aWRlZCB0aGF0IHRoZSBmb2xsb3dpbmcNCj4gPiA+ICtjb25kaXRpb25zDQo+ID4gPiArICog
YXJlIG1ldDoNCj4gPiA+ICsgKg0KPiA+ID4gKyAqIDEuIFJlZGlzdHJpYnV0aW9ucyBvZiBzb3Vy
Y2UgY29kZSBtdXN0IHJldGFpbiB0aGUgYWJvdmUgY29weXJpZ2h0DQo+ID4gPiArICogICAgbm90
aWNlLCB0aGlzIGxpc3Qgb2YgY29uZGl0aW9ucyBhbmQgdGhlIGZvbGxvd2luZyBkaXNjbGFpbWVy
Lg0KPiA+ID4gKyAqIDIuIFJlZGlzdHJpYnV0aW9ucyBpbiBiaW5hcnkgZm9ybSBtdXN0IHJlcHJv
ZHVjZSB0aGUgYWJvdmUgY29weXJpZ2h0DQo+ID4gPiArICogICAgbm90aWNlLCB0aGlzIGxpc3Qg
b2YgY29uZGl0aW9ucyBhbmQgdGhlIGZvbGxvd2luZyBkaXNjbGFpbWVyIGluIHRoZQ0KPiA+ID4g
KyAqICAgIGRvY3VtZW50YXRpb24gYW5kL29yIG90aGVyIG1hdGVyaWFscyBwcm92aWRlZCB3aXRo
IHRoZQ0KPiBkaXN0cmlidXRpb24uDQo+ID4gPiArICogMy4gTmVpdGhlciB0aGUgbmFtZSBvZiB0
aGUgY29weXJpZ2h0IGhvbGRlciBub3IgdGhlIG5hbWVzIG9mIGl0cw0KPiA+ID4gKyAqICAgIGNv
bnRyaWJ1dG9ycyBtYXkgYmUgdXNlZCB0byBlbmRvcnNlIG9yIHByb21vdGUgcHJvZHVjdHMgZGVy
aXZlZA0KPiA+IGZyb20NCj4gPiA+ICsgKiAgICB0aGlzIHNvZnR3YXJlIHdpdGhvdXQgc3BlY2lm
aWMgcHJpb3Igd3JpdHRlbiBwZXJtaXNzaW9uLg0KPiA+ID4gKyAqDQo+ID4gPiArICogVEhJUyBT
T0ZUV0FSRSBJUyBQUk9WSURFRCBCWSBUSEUgQ09QWVJJR0hUIEhPTERFUlMgQU5EDQo+ID4gQ09O
VFJJQlVUT1JTICJBUyBJUyINCj4gPiA+ICsgKiBBTkQgQU5ZIEVYUFJFU1MgT1IgSU1QTElFRCBX
QVJSQU5USUVTLCBJTkNMVURJTkcsIEJVVCBOT1QNCj4gPiBMSU1JVEVEDQo+ID4gPiArVE8sIFRI
RQ0KPiA+ID4gKyAqIElNUExJRUQgV0FSUkFOVElFUyBPRiBNRVJDSEFOVEFCSUxJVFkgQU5EIEZJ
VE5FU1MgRk9SIEENCj4gPiBQQVJUSUNVTEFSDQo+ID4gPiArUFVSUE9TRQ0KPiA+ID4gKyAqIEFS
RSBESVNDTEFJTUVELiBJTiBOTyBFVkVOVCBTSEFMTCBUSEUgQ09QWVJJR0hUIEhPTERFUiBPUg0K
PiA+ID4gK0NPTlRSSUJVVE9SUyBCRQ0KPiA+ID4gKyAqIExJQUJMRSBGT1IgQU5ZIERJUkVDVCwg
SU5ESVJFQ1QsIElOQ0lERU5UQUwsIFNQRUNJQUwsIEVYRU1QTEFSWSwNCj4gPiA+ICtPUg0KPiA+
ID4gKyAqIENPTlNFUVVFTlRJQUwgREFNQUdFUyAoSU5DTFVESU5HLCBCVVQgTk9UIExJTUlURUQg
VE8sDQo+ID4gUFJPQ1VSRU1FTlQNCj4gPiA+ICtPRg0KPiA+ID4gKyAqIFNVQlNUSVRVVEUgR09P
RFMgT1IgU0VSVklDRVM7IExPU1MgT0YgVVNFLCBEQVRBLCBPUiBQUk9GSVRTOw0KPiBPUg0KPiA+
ID4gK0JVU0lORVNTDQo+ID4gPiArICogSU5URVJSVVBUSU9OKSBIT1dFVkVSIENBVVNFRCBBTkQg
T04gQU5ZIFRIRU9SWSBPRg0KPiBMSUFCSUxJVFksDQo+ID4gPiArV0hFVEhFUiBJTg0KPiA+ID4g
KyAqIENPTlRSQUNULCBTVFJJQ1QgTElBQklMSVRZLCBPUiBUT1JUIChJTkNMVURJTkcgTkVHTElH
RU5DRSBPUg0KPiA+ID4gK09USEVSV0lTRSkNCj4gPiA+ICsgKiBBUklTSU5HIElOIEFOWSBXQVkg
T1VUIE9GIFRIRSBVU0UgT0YgVEhJUyBTT0ZUV0FSRSwgRVZFTiBJRg0KPiA+ID4gK0FEVklTRUQg
T0YgVEhFDQo+ID4gPiArICogUE9TU0lCSUxJVFkgT0YgU1VDSCBEQU1BR0UuDQo+ID4gPiArICoN
Cj4gPiA+ICsgKiBUSElTIEhFQURFUiBNQVkgTk9UIEJFIEVYVFJBQ1RFRCBPUiBNT0RJRklFRCBJ
TiBBTlkgV0FZLg0KPiA+DQo+ID4gUmVtb3ZlIHRoZSBhYm92ZSBsaW5lIHNpbmNlIGl0IGlzIGlu
Y29tcGF0aWJsZSB3aXRoIHRoZSBCU0QgbGljZW5zZS4NCj4gPg0KPiBPSw0KPg0KPiA+DQo+ID4g
PiArICovDQo+ID4gPiArDQo+ID4gPiArI2lmbmRlZiBfX1BMQVRfS1ZNX0FSTV9SVENfSF9fDQo+
ID4gPiArI2RlZmluZSBfX1BMQVRfS1ZNX0FSTV9SVENfSF9fDQo+ID4gPiArDQo+ID4gPiArc3Ry
dWN0IHJ0Y190aW1lIHsNCj4gPiA+ICtpbnQgeWVhcjsNCj4gPiA+ICtpbnQgbW9uOw0KPiA+ID4g
K2ludCBkYXk7DQo+ID4gPiAraW50IGhvdXI7DQo+ID4gPiAraW50IG1pbjsNCj4gPiA+ICtpbnQg
c2VjOw0KPiA+ID4gK307DQo+ID4gPiArDQo+ID4gPiArc3RydWN0IHJ0Y19vcHMgew0KPiA+ID4g
K3ZvaWQgKCplbmFibGUpKGludCk7DQo+ID4gPiAraW50ICgqc3RhdHVzKSh2b2lkKTsNCj4gPiA+
ICt2b2lkICgqcmVhZCkoc3RydWN0IHJ0Y190aW1lICopOw0KPiA+ID4gK3VpbnQzMl90ICgqcmVh
ZF9yYXcpKHZvaWQpOw0KPiA+ID4gK3ZvaWQgKCp3cml0ZSkoc3RydWN0IHJ0Y190aW1lICopOw0K
PiA+ID4gK3ZvaWQgKCp3cml0ZV9yYXcpKHVpbnQzMl90KTsNCj4gPg0KPiA+IFdlIHNob3VsZCBy
ZW5hbWUgaXQgYXMgcmVhZF90aW1lIGFuZCB0aGUgd3JpdGVfdGltZS4gSSBhbSBub3Qgc3VyZSB3
aHkNCj4gPiB3ZSBuZWVkIHRvIGV4cG9zZSB0aGUgKl9yYXcgYXMgYSBwYXJ0IG9mIHRoZSBydGNf
b3BzIG9wZXJhdGlvbiBiZWNhdXNlDQo+ID4gdGhpcyBpcyB1c2VkIG9ubHkgZm9yIGEgc3BlY2lm
aWMgb3BlcmF0aW9uLg0KPiA+DQo+IE9LDQo+DQo+ID4gSW5zdGVhZCB3ZSBjb3VsZCByZWFkIHRo
ZSBib290IHRpY2sgd2l0aCBhbiBBUEkgZnVuY3Rpb24gbGlrZToNCj4gPg0KPiA+IHVpbnQzMl90
IHJ0Y19ib290X3RpY2tfZ2V0KHN0cnVjdCBydGNfZGV2ICpkZXYpOw0KPiA+DQo+IE9LDQo+DQo+
ID4NCj4gPiA+ICt2b2lkICgqcmVhZF9hbGFybSkoc3RydWN0IHJ0Y190aW1lICopOw0KPiA+ID4g
K3VpbnQzMl90ICgqcmVhZF9hbGFybV9yYXcpKHZvaWQpOw0KPiA+ID4gK3ZvaWQgKCp3cml0ZV9h
bGFybSkoc3RydWN0IHJ0Y190aW1lICopOw0KPiA+ID4gK3ZvaWQgKCp3cml0ZV9hbGFybV9yYXcp
KHVpbnQzMl90KTsNCj4gPiA+ICt2b2lkICgqYWxhcm1faXJxX2VuYWJsZSkoaW50KTsNCj4gPiA+
ICt9Ow0KPiA+DQo+ID4gV2h5IGRvbid0IHRoZXNlIHJ0Y19vcHMgdGFrZSB0aGUgcnRjX2RldiBh
cyBpdHMgcGFyYW1ldGVyLiBJdCB3b3VsZCBiZQ0KPiA+IGRpZmZpY3VsdCB0byBzdXBwb3J0IG11
bHRpcGxlIGRldmljZS4NCj4gPg0KPiBPSw0KPg0KPiA+DQo+ID4gPiArDQo+ID4gPiArc3RydWN0
IHJ0Y19kZXYgew0KPiA+ID4gK2NoYXIgKm5hbWU7DQo+ID4gPiAraW50IGlkOw0KPiA+ID4gK2Nv
bnN0IHN0cnVjdCBydGNfb3BzICpvcHM7DQo+ID4gPiArfTsNCj4gPiA+ICsNCj4gPiA+ICsjaWZk
ZWYgQ09ORklHX1JUQ19QTDAzMQ0KPiA+ID4gKw0KPiA+ID4gKyNpbmNsdWRlIDxzdGRpbnQuaD4N
Cj4gPiA+ICsNCj4gPiA+ICtleHRlcm4gdWludDMyX3QgcnRjX2Jvb3Rfc2Vjb25kczsNCj4gPiA+
ICsNCj4gPiA+ICtpbnQgX2R0Yl9pbml0X3J0Yyh2b2lkICpkdGIpOw0KPiA+ID4gKw0KPiA+ID4g
KyNlbmRpZg0KPiA+ID4gKyNlbmRpZiAvL19fUExBVF9LVk1fQVJNX0dJQ1YyX0hfXw0KPiA+IHMv
X19QTEFUX0tWTV9BUk1fR0lDVjJfSF9fL19fUExBVF9LVk1fQVJNX1JUQ19IX18NCj4gPiA+IGRp
ZmYgLS1naXQgYS9wbGF0L2RyaXZlcnMvcnRjL3BsMDMxLmMgYi9wbGF0L2RyaXZlcnMvcnRjL3Bs
MDMxLmMgbmV3DQo+ID4gPiBmaWxlIG1vZGUgMTAwNjQ0IGluZGV4IDAwMDAwMDAuLmZmMjQ0MTEN
Cj4gPiA+IC0tLSAvZGV2L251bGwNCj4gPiA+ICsrKyBiL3BsYXQvZHJpdmVycy9ydGMvcGwwMzEu
Yw0KPiA+ID4gQEAgLTAsMCArMSwzMTUgQEANCj4gPiA+ICsvKiBTUERYLUxpY2Vuc2UtSWRlbnRp
ZmllcjogQlNELTMtQ2xhdXNlICovDQo+ID4gPiArLyoNCj4gPiA+ICsgKiBBdXRob3JzOiBXZWkg
Q2hlbiA8V2VpLkNoZW5AYXJtLmNvbT4NCj4gPiA+ICsgKiAgICAgICAgICBKaWFueW9uZyBXdSA8
SmlhbnlvbmcuV3VAYXJtLmNvbT4NCj4gPiA+ICsgKg0KPiA+ID4gKyAqIENvcHlyaWdodCAoYykg
MjAxOCwgQXJtIEx0ZC4gQWxsIHJpZ2h0cyByZXNlcnZlZC4NCj4gPiA+ICsgKg0KPiA+ID4gKyAq
IFJlZGlzdHJpYnV0aW9uIGFuZCB1c2UgaW4gc291cmNlIGFuZCBiaW5hcnkgZm9ybXMsIHdpdGgg
b3INCj4gPiA+ICt3aXRob3V0DQo+ID4gPiArICogbW9kaWZpY2F0aW9uLCBhcmUgcGVybWl0dGVk
IHByb3ZpZGVkIHRoYXQgdGhlIGZvbGxvd2luZw0KPiA+ID4gK2NvbmRpdGlvbnMNCj4gPiA+ICsg
KiBhcmUgbWV0Og0KPiA+ID4gKyAqDQo+ID4gPiArICogMS4gUmVkaXN0cmlidXRpb25zIG9mIHNv
dXJjZSBjb2RlIG11c3QgcmV0YWluIHRoZSBhYm92ZSBjb3B5cmlnaHQNCj4gPiA+ICsgKiAgICBu
b3RpY2UsIHRoaXMgbGlzdCBvZiBjb25kaXRpb25zIGFuZCB0aGUgZm9sbG93aW5nIGRpc2NsYWlt
ZXIuDQo+ID4gPiArICogMi4gUmVkaXN0cmlidXRpb25zIGluIGJpbmFyeSBmb3JtIG11c3QgcmVw
cm9kdWNlIHRoZSBhYm92ZSBjb3B5cmlnaHQNCj4gPiA+ICsgKiAgICBub3RpY2UsIHRoaXMgbGlz
dCBvZiBjb25kaXRpb25zIGFuZCB0aGUgZm9sbG93aW5nIGRpc2NsYWltZXIgaW4gdGhlDQo+ID4g
PiArICogICAgZG9jdW1lbnRhdGlvbiBhbmQvb3Igb3RoZXIgbWF0ZXJpYWxzIHByb3ZpZGVkIHdp
dGggdGhlDQo+IGRpc3RyaWJ1dGlvbi4NCj4gPiA+ICsgKiAzLiBOZWl0aGVyIHRoZSBuYW1lIG9m
IHRoZSBjb3B5cmlnaHQgaG9sZGVyIG5vciB0aGUgbmFtZXMgb2YgaXRzDQo+ID4gPiArICogICAg
Y29udHJpYnV0b3JzIG1heSBiZSB1c2VkIHRvIGVuZG9yc2Ugb3IgcHJvbW90ZSBwcm9kdWN0cyBk
ZXJpdmVkDQo+ID4gZnJvbQ0KPiA+ID4gKyAqICAgIHRoaXMgc29mdHdhcmUgd2l0aG91dCBzcGVj
aWZpYyBwcmlvciB3cml0dGVuIHBlcm1pc3Npb24uDQo+ID4gPiArICoNCj4gPiA+ICsgKiBUSElT
IFNPRlRXQVJFIElTIFBST1ZJREVEIEJZIFRIRSBDT1BZUklHSFQgSE9MREVSUyBBTkQNCj4gPiBD
T05UUklCVVRPUlMgIkFTIElTIg0KPiA+ID4gKyAqIEFORCBBTlkgRVhQUkVTUyBPUiBJTVBMSUVE
IFdBUlJBTlRJRVMsIElOQ0xVRElORywgQlVUIE5PVA0KPiA+IExJTUlURUQgVE8sIFRIRQ0KPiA+
ID4gKyAqIElNUExJRUQgV0FSUkFOVElFUyBPRiBNRVJDSEFOVEFCSUxJVFkgQU5EIEZJVE5FU1Mg
Rk9SIEENCj4gPiBQQVJUSUNVTEFSIFBVUlBPU0UNCj4gPiA+ICsgKiBBUkUgRElTQ0xBSU1FRC4g
SU4gTk8gRVZFTlQgU0hBTEwgVEhFIENPUFlSSUdIVCBIT0xERVIgT1INCj4gPiBDT05UUklCVVRP
UlMgQkUNCj4gPiA+ICsgKiBMSUFCTEUgRk9SIEFOWSBESVJFQ1QsIElORElSRUNULCBJTkNJREVO
VEFMLCBTUEVDSUFMLCBFWEVNUExBUlksDQo+ID4gT1INCj4gPiA+ICsgKiBDT05TRVFVRU5USUFM
IERBTUFHRVMgKElOQ0xVRElORywgQlVUIE5PVCBMSU1JVEVEIFRPLA0KPiA+IFBST0NVUkVNRU5U
IE9GDQo+ID4gPiArICogU1VCU1RJVFVURSBHT09EUyBPUiBTRVJWSUNFUzsgTE9TUyBPRiBVU0Us
IERBVEEsIE9SIFBST0ZJVFM7DQo+IE9SDQo+ID4gQlVTSU5FU1MNCj4gPiA+ICsgKiBJTlRFUlJV
UFRJT04pIEhPV0VWRVIgQ0FVU0VEIEFORCBPTiBBTlkgVEhFT1JZIE9GDQo+IExJQUJJTElUWSwN
Cj4gPiBXSEVUSEVSIElODQo+ID4gPiArICogQ09OVFJBQ1QsIFNUUklDVCBMSUFCSUxJVFksIE9S
IFRPUlQgKElOQ0xVRElORyBORUdMSUdFTkNFIE9SDQo+ID4gT1RIRVJXSVNFKQ0KPiA+ID4gKyAq
IEFSSVNJTkcgSU4gQU5ZIFdBWSBPVVQgT0YgVEhFIFVTRSBPRiBUSElTIFNPRlRXQVJFLCBFVkVO
IElGDQo+ID4gQURWSVNFRCBPRiBUSEUNCj4gPiA+ICsgKiBQT1NTSUJJTElUWSBPRiBTVUNIIERB
TUFHRS4NCj4gPiA+ICsgKg0KPiA+ID4gKyAqIFRISVMgSEVBREVSIE1BWSBOT1QgQkUgRVhUUkFD
VEVEIE9SIE1PRElGSUVEIElOIEFOWSBXQVkuDQo+ID4NCj4gPiBSZW1vdmUgdGhlIGFib3ZlIGxp
bmUgc2luY2UgaXQgaXMgaW5jb21wYXRpYmxlIHdpdGggdGhlIEJTRCBsaWNlbnNlLg0KPiA+DQo+
IE9LDQo+DQo+ID4NCj4gPiA+ICsgKi8NCj4gPiA+ICsjaW5jbHVkZSA8c3RyaW5nLmg+DQo+ID4g
PiArI2luY2x1ZGUgPGxpYmZkdC5oPg0KPiA+ID4gKyNpbmNsdWRlIDxzdGRpby5oPg0KPiA+ID4g
KyNpbmNsdWRlIDx1ay9hc3NlcnQuaD4NCj4gPiA+ICsjaW5jbHVkZSA8dWsvZXNzZW50aWFscy5o
Pg0KPiA+ID4gKyNpbmNsdWRlIDx1ay9wcmludC5oPg0KPiA+ID4gKyNpbmNsdWRlIDx1ay9saXN0
Lmg+DQo+ID4gPiArI2luY2x1ZGUgPGFybS9jcHUuaD4NCj4gPiA+ICsjaW5jbHVkZSA8b2Z3L2Zk
dC5oPg0KPiA+ID4gKyNpbmNsdWRlIDxydGMvcnRjLmg+DQo+ID4gPiArI2luY2x1ZGUgPGdpYy9n
aWMtdjIuaD4NCj4gPiA+ICsjaW5jbHVkZSA8b2Z3L2dpY19mZHQuaD4NCj4gPiA+ICsjaW5jbHVk
ZSA8dWsvcGxhdC9jb21tb24vaXJxLmg+DQo+ID4gPiArDQo+ID4gPiArc3RhdGljIHVpbnQ2NF90
IHJ0Y19iYXNlX2FkZHI7DQo+ID4gPiArdWludDMyX3QgcnRjX2Jvb3Rfc2Vjb25kczsNCj4gPiA+
ICsNCj4gPiA+ICsvKiBEZWZpbmUgb2Zmc2V0IG9mIFJUQyByZWdpc3RlcnMgKi8NCj4gPiA+ICsj
ZGVmaW5lIFJUQ19EUjANCj4gPiA+ICsjZGVmaW5lIFJUQ19NUjB4NA0KPiA+ID4gKyNkZWZpbmUg
UlRDX0xSMHg4DQo+ID4gPiArI2RlZmluZSBSVENfQ1IweGMNCj4gPiA+ICsjZGVmaW5lIFJUQ19J
TVNDMHgxMA0KPiA+ID4gKyNkZWZpbmUgUlRDX1JJUzB4MTQNCj4gPiA+ICsjZGVmaW5lIFJUQ19N
SVMweDE4DQo+ID4gPiArI2RlZmluZSBSVENfSUNSMHgxYw0KPiA+ID4gKw0KPiA+ID4gKyNkZWZp
bmUgUlRDX1JFRyhyKSh2b2lkICopKHJ0Y19iYXNlX2FkZHIgKyAocikpDQo+ID4gPiArDQo+ID4g
PiArI2RlZmluZSBSVENfREVWX05VTSAxDQo+ID4gPiArI2RlZmluZSBSVENfRU5BQkxFIDENCj4g
PiA+ICsjZGVmaW5lIFJUQ19ESVNBQkxFIDANCj4gPiA+ICsNCj4gPiA+ICtzdGF0aWMgaW50IGRh
eV9wZXJfbW9uWzEyXSA9IHszMSwgMjgsIDMxLCAzMCwgMzEsIDMwLCAzMSwgMzEsIDMwLA0KPiA+
ID4gKzMxLCAzMCwgMzF9Ow0KPiA+ID4gKw0KPiA+ID4gK3N0YXRpYyBjb25zdCBjaGFyICogY29u
c3QgcnRjX2RldmljZV9saXN0W10gPSB7DQo+ID4gPiArImFybSxwbDAzMSIsDQo+ID4gPiArfTsN
Cj4gPiA+ICsNCj4gPiA+ICtzdGF0aWMgdm9pZCBwbDAzMV9yYXdfdG9fdG0odWludDMyX3QgcmF3
LCBzdHJ1Y3QgcnRjX3RpbWUgKnJ0KQ0KPiA+DQo+ID4gICBNb3ZlIHRoZXNlIGZ1bmN0aW9uIGlu
dG8gYSBoZWFkZXIgZmlsZSBgcnRjLmhgIGFzIGEgc3RhdGljIGlubGluZQ0KPiA+IGZ1bmN0aW9u
IGFzIHRoZXNlIGFyZSBnZW5lcmljIGNvbnZlcnNpb24gZnVuY3Rpb25zLg0KPiA+DQo+IFRoZXJl
IGlzIGEgZm9yIGxvb3AgaW4gdGhpcyBmdW5jdGlvbiwgc28gaXQgbWF5IG5vdCBiZSBhcHByb3By
aWF0ZSB0byBiZSBhIGlubGluZQ0KPiBmdW5jdGlvbi4gaXNuJ3Q/DQo+DQo+ID4NCj4gPiA+ICt7
DQo+ID4gPiAraW50IGhvdXIsIGRheXMsIHllYXJzLCBkeTQsIGR5MTAwLCBkeTQwMCwgbm9ybWFs
X2RheXMsDQo+ID4gPiArZGF5X2luX3llYXIsIHN1bSA9IDAsIGxlYXA7DQo+ID4gPiArDQo+ID4g
PiArcnQtPnNlYyA9IHJhdyAlIDYwOw0KPiA+ID4gK3J0LT5taW4gPSAocmF3ICUgKDYwICogNjAp
KSAvIDYwOw0KPiA+ID4gK2hvdXIgPSByYXcgLyA2MCAvIDYwOw0KPiA+ID4gK2RheXMgPSAgaG91
ciAvIDI0Ow0KPiA+ID4gK3J0LT5ob3VyID0gaG91ciAlIDI0Ow0KPiA+ID4gKy8qDQo+ID4gPiAr
ICogdG90YWwgZGF5cyBmb3IgZXZlcnkgY29udGludWUgNC15ZWFycywgYXNzdW1pbmcgdGhlcmUg
aXMgYSBsZWFwDQo+ID4gPiArICogeWVhciBhbW9uZyBldmVyeSA0IHllYXJzLg0KPiA+ID4gKyAq
Lw0KPiA+ID4gK2R5NCA9IDM2NSAqIDMgKyAzNjY7DQo+ID4gPiArLy8gdG90YWwgZGF5cyBmb3Ig
ZXZlcnkgY29udGludWUgMTAwLXllYXJzLg0KPiA+ID4gK2R5MTAwID0gMjUgKiBkeTQgLSAxOw0K
PiA+ID4gKy8vIHRvdGFsIGRheXMgZm9yIGV2ZXJ5IGNvbnRpbnVlIDQwMC15ZWFycy4NCj4gPiA+
ICtkeTQwMCA9IGR5MTAwICogNCArIDE7DQo+ID4gPiArLy8gbm9ybWFsaXplIHRoZSBkYXlzIGJ5
IGdldCByaWQgb2YgdGhlIGFkZGl0aW9uYWwgZGF5IGluIGxlYXAgeWVhcg0KPiA+ID4gK25vcm1h
bF9kYXlzID0gZGF5cyAtIGRheXMgLyBkeTQgKyBkYXlzIC8gZHkxMDAgKyBkYXlzIC8gZHk0MDA7
DQo+ID4gPiAreWVhcnMgPSBub3JtYWxfZGF5cyAvIDM2NTsNCj4gPiA+ICtydC0+eWVhciA9IDE5
NzAgKyB5ZWFyczsNCj4gPiA+ICtsZWFwID0gKCghKHJ0LT55ZWFyICUgNCkgJiYgKHJ0LT55ZWFy
ICUgMTAwKSkgfHwgIShydC0+eWVhciAlIDQwMCkpOw0KPiA+ID4gK2RheV9pbl95ZWFyID0gIG5v
cm1hbF9kYXlzIC0geWVhcnMgKiAzNjU7DQo+ID4gPiArLyoNCj4gPiA+ICsgKiBpZiB0aGUgcmVz
aWR1ZSBkYXlzIGxhcmdlciB0aGFuIHRoZSBzdW0gb2YgdGhlIGZpcnN0IHR3byBtb250aA0KPiA+
ID4gKyAqIHdlIHNob3VsZCBjb25zaWRlciBGZWIsMjkuDQo+ID4gPiArICovDQo+ID4gPiArc3Vt
ICs9IGxlYXAgKiAoZGF5X2luX3llYXIgPj0gKGRheV9wZXJfbW9uWzBdICsNCj4gPiBkYXlfcGVy
X21vblsxXSkpOw0KPiA+ID4gK2ZvciAoaW50IGkgPSAwOyBpIDwgMTI7IGkrKykgew0KPiA+ID4g
K3N1bSArPSBkYXlfcGVyX21vbltpXTsNCj4gPiA+ICtpZiAoZGF5X2luX3llYXIgPCBzdW0pIHsN
Cj4gPiA+ICtydC0+bW9uID0gaSArIDE7DQo+ID4gPiArcnQtPmRheSA9IGRheV9pbl95ZWFyIC0g
KHN1bSAtIGRheV9wZXJfbW9uW2ldKSArIDE7DQo+ID4gPiArYnJlYWs7DQo+ID4gPiArfQ0KPiA+
ID4gK30NCj4gPiA+ICt9DQo+ID4gPiArDQo+ID4gPiArc3RhdGljIHVpbnQzMl90IHBsMDMxX3Rt
X3RvX3JhdyhzdHJ1Y3QgcnRjX3RpbWUgKnJ0KQ0KPiA+IE1vdmUgdGhlc2UgZnVuY3Rpb24gaW50
byBhIGhlYWRlciBmaWxlIGBydGMuaGAgYXMgYSBzdGF0aWMgaW5saW5lIGZ1bmN0aW9uLg0KPg0K
PiBpdCdzIGEgbGl0dGxlIG9kZCB0byBwdXQgdGhpcyBkZXZpY2Utc3BlY2lmaWMgZnVuY3Rpb24g
aW50byBydGMuaCwgYXMgYWxsIG9mIHRoZSB0ZXJtcw0KPiBpbiBydGMuaCBzaG91bGQgYmUgZ2Vu
ZXJpYy4NCj4gUHM6IGFsc28gdGhlc2UgZnVuY3Rpb25zIGluIGxpbnV4IGtlcm5lbCBhcmUga2Vw
dCBpbiBpdHMgc3BlY2lmaWMgZmlsZS4NCj4NCj4gPiA+ICt7DQo+ID4gPiAraW50IGxlYXBzLCBs
ZWFwLCBkYXlzLCBzZWM7DQo+ID4gPiArDQo+ID4gPiArbGVhcHMgPSAocnQtPnllYXIgLSAxOTcw
KSAvIDQgLSAocnQtPnllYXIgLSAxOTcwKSAvIDEwMCArDQo+ID4gPiArKHJ0LT55ZWFyIC0gMTk3
MCkgLyA0MDA7DQo+ID4gPiArbGVhcCA9ICgoIShydC0+eWVhciAlIDQpICYmIChydC0+eWVhciAl
IDEwMCkpIHx8ICEocnQtPnllYXIgJSA0MDApKTsNCj4gPiA+ICtkYXlzID0gKHJ0LT55ZWFyIC0g
MTk3MCkgKiAzNjUgKyBsZWFwczsNCj4gPiA+ICtpZiAocnQtPm1vbiA9PSAxKSB7DQo+ID4gPiAr
ZGF5cyArPSBkYXlfcGVyX21vblswXTsNCj4gPiA+ICt9IGVsc2Ugew0KPiA+ID4gK2ZvciAoaW50
IGkgPSAwOyBpIDwgcnQtPm1vbiAtIDE7IGkrKykNCj4gPiA+ICtkYXlzICs9IGRheV9wZXJfbW9u
W2ldOw0KPiA+ID4gK30NCj4gPiA+ICtkYXlzICs9IHJ0LT5kYXkgKyAocnQtPm1vbiA+IDIpICog
bGVhcCAtIDE7DQo+ID4gPiArc2VjID0gZGF5cyAqIDM2MDAgKiAyNCArIHJ0LT5ob3VyICogMzYw
MCArIHJ0LT5taW4gKiA2MCArIHJ0LT5zZWM7DQo+ID4gPiArDQo+ID4gPiArcmV0dXJuIHNlYzsN
Cj4gPiA+ICt9DQo+ID4gPiArDQo+ID4gPiArc3RhdGljIHVpbnQzMl90IHBsMDMxX3JlYWRfcmF3
KHZvaWQpIHsNCj4gPiA+ICtyZXR1cm4gaW9yZWdfcmVhZDMyKFJUQ19SRUcoUlRDX0RSKSk7IH0N
Cj4gPiA+ICsNCj4gPiA+ICtzdGF0aWMgdm9pZCBwbDAzMV9yZWFkX3RpbWUoc3RydWN0IHJ0Y190
aW1lICpydCkgew0KPiA+ID4gK3VpbnQzMl90IHJhdzsNCj4gPiA+ICsNCj4gPiA+ICtyYXcgPSBw
bDAzMV9yZWFkX3JhdygpOw0KPiA+ID4gK3BsMDMxX3Jhd190b190bShyYXcsIHJ0KTsNCj4gPiA+
ICt9DQo+ID4gPiArDQo+ID4gPiArc3RhdGljIHZvaWQgcGwwMzFfd3JpdGVfcmF3KHVpbnQzMl90
IHZhbCkgew0KPiA+ID4gK2lvcmVnX3dyaXRlMzIoUlRDX1JFRyhSVENfTFIpLCB2YWwpOyB9DQo+
ID4gPiArDQo+ID4gPiArc3RhdGljIHZvaWQgcGwwMzFfd3JpdGVfdGltZShzdHJ1Y3QgcnRjX3Rp
bWUgKnJ0KSB7DQo+ID4gPiArdWludDMyX3QgcmF3Ow0KPiA+ID4gKw0KPiA+ID4gK3JhdyA9IHBs
MDMxX3RtX3RvX3JhdyhydCk7DQo+ID4gPiArcGwwMzFfd3JpdGVfcmF3KHJhdyk7DQo+ID4gPiAr
fQ0KPiA+ID4gKw0KPiA+ID4gKy8qDQo+ID4gPiArICogc2V0IHJ0YyBtYXRjaCByZWdpc3RlciBj
b21wYXJpbmcgd2l0aCBjb3VudGVyDQo+ID4gPiArICogdmFsdWUgdG8gZ2VuZXJhdCBhIGludGVy
cnVwdA0KPiA+ID4gKyAqLw0KPiA+ID4gK3N0YXRpYyB2b2lkIHBsMDMxX3dyaXRlX2FsYXJtX3Jh
dyh1aW50MzJfdCBhbGFybSkgew0KPiA+ID4gK2lvcmVnX3dyaXRlMzIoUlRDX1JFRyhSVENfTVIp
LCBhbGFybSk7IH0NCj4gPiA+ICsNCj4gPiA+ICtzdGF0aWMgdm9pZCBwbDAzMV93cml0ZV9hbGFy
bShzdHJ1Y3QgcnRjX3RpbWUgKnJ0KSB7DQo+ID4gPiArdWludDMyX3QgcmF3Ow0KPiA+ID4gKw0K
PiA+ID4gK3JhdyA9IHBsMDMxX3RtX3RvX3JhdyhydCk7DQo+ID4gPiArcGwwMzFfd3JpdGVfYWxh
cm1fcmF3KHJhdyk7DQo+ID4gPiArfQ0KPiA+ID4gKw0KPiA+ID4gK3N0YXRpYyB1aW50MzJfdCBw
bDAzMV9yZWFkX2FsYXJtX3Jhdyh2b2lkKSB7DQo+ID4gPiArcmV0dXJuIGlvcmVnX3JlYWQzMihS
VENfUkVHKFJUQ19NUikpOyB9DQo+ID4gPiArDQo+ID4gPiArc3RhdGljIHZvaWQgcGwwMzFfcmVh
ZF9hbGFybShzdHJ1Y3QgcnRjX3RpbWUgKnJ0KSB7DQo+ID4gPiArcGwwMzFfcmF3X3RvX3RtKHBs
MDMxX3JlYWRfYWxhcm1fcmF3KCksIHJ0KTsgfQ0KPiA+ID4gKw0KPiA+ID4gKy8qDQo+ID4gPiAr
ICogSWYgcGwwMzEgaXMgbm90IGVuYWJsZWQsIGVuYWJsZSBpdCBieSB3cml0ZSAxIHRvIFJUQ19D
UiwNCj4gPiA+ICtvdGhlcndpc2UNCj4gPiA+ICsgKiBkbyBub3RoaW5nLg0KPiA+ID4gKyAqLw0K
PiA+ID4gK3N0YXRpYyB2b2lkIHBsMDMxX2VuYWJsZShpbnQgZW5hYmxlKSB7DQo+ID4gPiAraW9y
ZWdfd3JpdGUzMihSVENfUkVHKFJUQ19DUiksIGVuYWJsZSk7IH0NCj4gPiA+ICsNCj4gPiA+ICsv
KiByZXR1cm4gcnRjIHN0YXR1cywgMSBkZW5vdGVzIGVuYWJsZSBhbmQgMCBkZW5vdGVzIGRpc2Fi
bGUgKi8NCj4gPiA+ICtzdGF0aWMgaW50IHBsMDMxX2dldF9zdGF0dXModm9pZCkgew0KPiA+ID4g
K2ludCB2YWw7DQo+ID4gPiArDQo+ID4gPiArdmFsID0gaW9yZWdfcmVhZDMyKFJUQ19SRUcoUlRD
X0NSKSk7DQo+ID4gPiArdmFsICY9IFJUQ19FTkFCTEU7DQo+ID4gPiArcmV0dXJuIHZhbDsNCj4g
PiA+ICt9DQo+ID4gPiArDQo+ID4gPiArLyogZW5hYmxlIGFsYXJtIGlycSwgMSBkZW5vdGVzIGVu
YWJsZSwgMiBkZW5vdGVzIGRpc2FibGUgKi8gc3RhdGljDQo+ID4gPiArdm9pZCBwbDAzMV9lbmFi
bGVfaW50cihpbnQgZW5hYmxlKSB7DQo+ID4gPiAraW9yZWdfd3JpdGUzMihSVENfUkVHKFJUQ19J
TVNDKSwgZW5hYmxlKTsgfQ0KPiA+ID4gKw0KPiA+ID4gK3N0YXRpYyB1aW50MzJfdCBwbDAzMV9n
ZXRfcmF3X2ludHJfc3RhdGUodm9pZCkgew0KPiA+ID4gK3JldHVybiBpb3JlZ19yZWFkMzIoUlRD
X1JFRyhSVENfUklTKSk7IH0NCj4gPiA+ICsNCj4gPiA+ICtzdGF0aWMgdm9pZCBwbDAzMV9jbGVh
cl9pbnRyKHZvaWQpDQo+ID4gPiArew0KPiA+ID4gK3doaWxlIChwbDAzMV9nZXRfcmF3X2ludHJf
c3RhdGUoKSkNCj4gPiA+ICtpb3JlZ193cml0ZTMyKFJUQ19SRUcoUlRDX0lDUiksIDEpOyB9DQo+
ID4gPiArDQo+ID4gPiArLyogd2FpdCBmb3IgcGxhdGZvcm0gZGV2aWNlIGZyYW1ld29yayB0byBy
ZWdpc3RlciB0aGlzIGhhbmRsZXIgKi8NCj4gPiA+ICtpbnQgcGwwMzFfaXJxX2hhbmRsZXIodm9p
ZCAqYXJnIF9fdW51c2VkKSB7DQo+ID4gPiArcGwwMzFfY2xlYXJfaW50cigpOw0KPiA+ID4gKy8v
IFRPRE86IGRvIHNvbWV0aGluZyByZWFsDQo+ID4gPiArDQo+ID4gPiArcmV0dXJuIDE7DQo+ID4g
PiArfQ0KPiA+ID4gKw0KPiA+ID4gK3N0YXRpYyBjb25zdCBzdHJ1Y3QgcnRjX29wcyBvcHNfcGww
MzEgPSB7DQo+ID4gPiArLmVuYWJsZT0gcGwwMzFfZW5hYmxlLA0KPiA+ID4gKy5zdGF0dXM9IHBs
MDMxX2dldF9zdGF0dXMsDQo+ID4gPiArLnJlYWQ9IHBsMDMxX3JlYWRfdGltZSwNCj4gPiA+ICsu
cmVhZF9yYXc9IHBsMDMxX3JlYWRfcmF3LA0KPiA+ID4gKy53cml0ZT0gcGwwMzFfd3JpdGVfdGlt
ZSwNCj4gPiA+ICsud3JpdGVfcmF3PSBwbDAzMV93cml0ZV9yYXcsDQo+ID4gPiArLnJlYWRfYWxh
cm09IHBsMDMxX3JlYWRfYWxhcm0sDQo+ID4gPiArLnJlYWRfYWxhcm1fcmF3PSBwbDAzMV9yZWFk
X2FsYXJtX3JhdywNCj4gPiA+ICsud3JpdGVfYWxhcm09IHBsMDMxX3dyaXRlX2FsYXJtLA0KPiA+
ID4gKy53cml0ZV9hbGFybV9yYXc9IHBsMDMxX3dyaXRlX2FsYXJtX3JhdywNCj4gPiA+ICsuYWxh
cm1faXJxX2VuYWJsZT0gcGwwMzFfZW5hYmxlX2ludHIsDQo+ID4gPiArfTsNCj4gPiA+ICsNCj4g
PiA+ICtjb25zdCBzdHJ1Y3QgcnRjX2RldiBydGNfcGwwMzEgPSB7DQo+ID4gPiArLm5hbWU9ICJy
dGNfcGwwMzEiLA0KPiA+ID4gKy5pZD0gMCwNCj4gPiA+ICsub3BzPSAmb3BzX3BsMDMxLA0KPiA+
ID4gK307DQo+ID4NCj4gPiBEbyB3ZSBuZWVkIHRvIGNvbWJpbmUgdGhlIHJ0Y19wbDAzMSBkcml2
ZXIgY29kZSB3aXRoIGEgZ2VuZXJpYyBydGMNCj4gPiBsaWJyYXJ5IGNvZGUuIFRoZSBjb2RlIGJl
bG93IHRoaXMgY29tbWVudCBiZWxvbmdzIHRvIGdlbmVyaWMNCj4gPiBgcGxhdC9kcml2ZXIvcnRj
L3J0Yy5jYC4gV2hpbGUgd2UgZG8gdGhpcyBjaGFuZ2Ugd2Ugc2hvdWxkIGFsc28gc3BsaXQNCj4g
PiBpdCBpbnRvIDIgbGlicmFyaWVzIG5hbWVseSwNCj4gPg0KPiA+IGxpYnJ0YyBhbmQgdGhlIGxp
YnBsMDMxLg0KPg0KPiBXaGF0IGFib3V0IHJlY292ZXJpbmcgdGhlICJydGMuYyIgYW5kIHB1dCB0
aGVzZSBnZW5lcmljIHRlcm1zIGludG8gaXQ/DQo+DQo+ID4NCj4gPiA+ICsNCj4gPiA+ICtjb25z
dCBzdHJ1Y3QgcnRjX2RldiAqcnRjX2xpc3RbUlRDX0RFVl9OVU1dOw0KPiA+IFdoeSBzaG91bGQg
d2UgZGVmaW5lIHRoaXMgYXMgYW4gYXJyYXkuIFdlIG1pZ2h0IGRlZmluZSBpdCB1c2luZyB0aGUN
Cj4gPiBsaXN0IGltcGxlbWVudGF0aW9uIGBpbmNsdWRlL3VrL2xpc3QuaGANCj4gPiA+ICsNCj4g
PiA+ICtzdGF0aWMgdm9pZCBydGNfZGV2X3JlZ2lzdGVyKHZvaWQpDQo+ID4NCj4gPiBSZWdpc3Rl
ciBmdW5jdGlvbiB3aXRoIHBhcmFtZXRlciBzdHJ1Y3QgcnRjX2Rldi4NCj4gPg0KPiBPSw0KPiA+
DQo+ID4gPiArew0KPiA+ID4gK3J0Y19saXN0W3J0Y19wbDAzMS5pZF0gPSAmcnRjX3BsMDMxOyB9
DQo+ID4gPiArDQo+ID4gPiArdm9pZCBfZHRiX2luaXRfcnRjKHZvaWQgKmR0YikNCj4gPiA+ICt7
DQo+ID4gPiArdWludDY0X3Qgc2l6ZTsNCj4gPiA+ICt1aW50MzJfdCBpcnFfdHlwZSwgaHdpcnEs
IHRyaWdnZXJfdHlwZTsNCj4gPiA+ICtpbnQgZmR0X3J0YywgcmV0LCBpbmRleCwgaXJxLCByYzsN
Cj4gPiA+ICsNCj4gPiA+ICt1a19wcl9pbmZvKCJQcm9iaW5nIFJUQy4uLlxuIik7DQo+ID4gPiAr
LyoNCj4gPiA+ICsgKiBXZSBjaG9vc2UgdGhlIGZpcnN0IGF2YWlsYWJsZSBydGMgZGV2aWNlIGlu
IGRldmljZSBsaXN0IGFzIHRoZQ0KPiA+ID4gKyAqIHN5c3RlbSBydGMuDQo+ID4gPiArICovDQo+
ID4gPiArZmR0X3J0YyA9IGZkdF9ub2RlX29mZnNldF9pZHhfYnlfY29tcGF0aWJsZV9saXN0KGR0
YiwgLTEsDQo+ID4gPiArcnRjX2RldmljZV9saXN0LCAmaW5kZXgpOw0KPiA+DQo+ID4gTWlzc2lu
ZyB0aGlzIGZ1bmN0aW9uLiBJIGd1ZXNzIHRoaXMgc2hvdWxkIGJlDQo+ID4gZmR0X25vZGVfb2Zm
c2V0X2J5X2NvbXBhdGlibGVfbGlzdC4NCj4gPg0KPiBPSw0KDQpJIGZpbmQgdGhpcyBmdW5jdGlv
biBpbiB0aGUgbmV3IHBhdGNoIHNldCBmcm9tIEp1c3Rpbiwgc28gdGhpcyBzaG91bGQgZGVwZW5k
IG9uIHRoYXQgcGF0Y2ggc2V0Lg0KDQpUaGFua3MNCkppYW55b25nDQoNCj4NCj4gPg0KPiA+ID4g
K2lmIChmZHRfcnRjIDwgMCkgew0KPiA+ID4gK3VrX3ByX3dhcm4oIkNvdWxkIG5vdCBmaW5kIHJ0
YyBkZXZpY2UhLCBmZHRfcnRjIGlzICVkXG4iLA0KPiA+ID4gK2ZkdF9ydGMpOw0KPiA+ID4gK3Jl
dHVybjsNCj4gPiA+ICt9DQo+ID4gPiArDQo+ID4gPiArcmV0ID0gZmR0X2dldF9hZGRyZXNzKGR0
YiwgZmR0X3J0YywgMCwgJnJ0Y19iYXNlX2FkZHIsICZzaXplKTsNCj4gPiA+ICtpZiAocmV0IDwg
MCkgew0KPiA+ID4gK3VrX3ByX3dhcm4oIkNvdWxkIG5vdCBnZXQgcnRjIGFkZHJlc3NcbiIpOw0K
PiA+IFByaW50IHRoZSBlcnJvciBjb2RlLg0KPiBPSw0KPg0KPiA+ID4gK3JldHVybjsNCj4gPiA+
ICt9DQo+ID4gPiArDQo+ID4gPiArcmMgPSBnaWNfZ2V0X2lycV9mcm9tX2R0YihkdGIsIGZkdF9y
dGMsIDAsICZpcnFfdHlwZSwgJmh3aXJxLA0KPiA+ID4gKyZ0cmlnZ2VyX3R5cGUpOw0KPiA+ID4g
K2lmIChyYyA8IDApIHsNCj4gPiA+ICt1a19wcl93YXJuKCJGYWlsZWQgdG8gZmluZCBJUlEgbnVt
YmVyIGZyb20gRFRCXG4iKTsNCj4gPiBQcmludCB0aGUgZXJyb3IgY29kZS4NCj4gT0sNCj4NCj4g
PiA+ICtyZXR1cm47DQo+ID4gPiArfQ0KPiA+ID4gKw0KPiA+ID4gK2lycSA9IGdpY19pcnFfdHJh
bnNsYXRlKGlycV90eXBlLCBod2lycSk7DQo+ID4gPiAraWYgKGlycSA8IDAgfHwgaXJxID49IF9f
TUFYX0lSUSkgew0KPiA+ID4gK3VrX3ByX3dhcm4oIkZhaWxlZCB0byB0cmFuc2xhdGUgSVJRIG51
bWJlciwgdHlwZT0ldSwNCj4gPiA+ICsgICBod2lycT0ldVxuIiwgaXJxX3R5cGUsIGh3aXJxKTsN
Cj4gPiA+ICtyZXR1cm47DQo+ID4gPiArfQ0KPiA+ID4gKw0KPiA+ID4gK3JjID0gdWtwbGF0X2ly
cV9yZWdpc3RlcihpcnEsIHBsMDMxX2lycV9oYW5kbGVyLCBOVUxMKTsNCj4gPiA+ICtpZiAocmMg
PCAwKSB7DQo+ID4gPiArdWtfcHJfd2FybigiRmFpbGVkIHRvIHJlZ2lzdGVyIHJ0YyBpbnRlcnJ1
cHQgaGFuZGxlclxuIik7DQo+ID4gUHJpbnQgdGhlIGVycm9yIGNvZGUuDQo+IE9LDQo+DQo+ID4g
PiArcmV0dXJuOw0KPiA+ID4gK30NCj4gPiA+ICsNCj4gPiA+ICtydGNfZGV2X3JlZ2lzdGVyKCk7
DQo+ID4gPiArDQo+ID4gPiAraWYgKCFydGNfbGlzdFtpbmRleF0tPm9wcy0+c3RhdHVzKCkpDQo+
ID4gPiArcnRjX2xpc3RbaW5kZXhdLT5vcHMtPmVuYWJsZShSVENfRU5BQkxFKTsNCj4gPiA+ICsN
Cj4gPiA+ICsvKiBSZWNvcmQgdGhlIGJvb3Qgc2Vjb25kcyAqLw0KPiA+ID4gK3J0Y19ib290X3Nl
Y29uZHMgPSBydGNfbGlzdFtpbmRleF0tPm9wcy0+cmVhZF9yYXcoKTsNCj4gPiA+ICsvKiBEaXNh
YmxlIHJ0YyBhbGFybSBpcnEgYXQgaXRzIHJlc2V0ICovDQo+ID4gPiArcnRjX2xpc3RbaW5kZXhd
LT5vcHMtPmFsYXJtX2lycV9lbmFibGUoUlRDX0RJU0FCTEUpOw0KPiA+ID4gKw0KPiA+ID4gK3Vr
X3ByX2luZm8oIkZvdW5kIFJUQyBvbjogJWx1XG4iLCBydGNfYmFzZV9hZGRyKTsgfQ0KPiA+ID4g
ZGlmZiAtLWdpdCBhL3BsYXQva3ZtL0NvbmZpZy51ayBiL3BsYXQva3ZtL0NvbmZpZy51ayBpbmRl
eA0KPiA+ID4gMzM3MmI2Yy4uMWJmNzJmMyAxMDA2NDQNCj4gPiA+IC0tLSBhL3BsYXQva3ZtL0Nv
bmZpZy51aw0KPiA+ID4gKysrIGIvcGxhdC9rdm0vQ29uZmlnLnVrDQo+ID4gPiBAQCAtMTMzLDYg
KzEzMywxMSBAQCBjb25maWcgTElCR0lDVjINCj4gPiA+ICAgICAgICAgIHNlbGVjdCBMSUJPRlcN
Cj4gPiA+ICAgICAgICAgIGRlcGVuZHMgb24gQVJDSF9BUk1fNjQNCj4gPiA+DQo+ID4gPiArY29u
ZmlnIExJQlBMMDMxDQo+ID4gPiArICAgICAgIGJvb2wgIkFybSBwbGF0Zm9ybSBydGMgZGV2aWNl
IGRyaXZlciINCj4gPiA+ICsgICAgICAgZGVmYXVsdCB5IGlmIEFSQ0hfQVJNXzY0DQo+ID4gPiAr
ICAgICAgIGRlcGVuZHMgb24gQVJDSF9BUk1fNjQNCj4gPiA+ICsNCj4gPiA+ICAgY29uZmlnIExJ
Qk9GVw0KPiA+ID4gICAgICAgICAgYm9vbCAiT3BlbiBGaXJtd2FyZSBsaWJyYXJ5IHN1cHBvcnQi
DQo+ID4gPiAgICAgICAgICBkZWZhdWx0IG4NCj4gPiA+IGRpZmYgLS1naXQgYS9wbGF0L2t2bS9N
YWtlZmlsZS51ayBiL3BsYXQva3ZtL01ha2VmaWxlLnVrIGluZGV4DQo+ID4gPiBhNmQ2ZjVlLi5k
NGY0Y2ZkIDEwMDY0NA0KPiA+ID4gLS0tIGEvcGxhdC9rdm0vTWFrZWZpbGUudWsNCj4gPiA+ICsr
KyBiL3BsYXQva3ZtL01ha2VmaWxlLnVrDQo+ID4gPiBAQCAtMTQsNyArMTQsNyBAQCAkKGV2YWwg
JChjYWxsDQo+ID4gYWRkcGxhdGxpYl9zLGt2bSxsaWJrdm12aXJ0aW9ibGssJChDT05GSUdfVklS
VElPX0JMSykpKQ0KPiA+ID4gICAkKGV2YWwgJChjYWxsIGFkZHBsYXRsaWJfcyxrdm0sbGlia3Zt
dmlydGlvOXAsJChDT05GSUdfVklSVElPXzlQKSkpDQo+ID4gPiAgICQoZXZhbCAkKGNhbGwgYWRk
cGxhdGxpYl9zLGt2bSxsaWJrdm1vZncsJChDT05GSUdfTElCT0ZXKSkpDQo+ID4gPiAgICQoZXZh
bCAkKGNhbGwgYWRkcGxhdGxpYl9zLGt2bSxsaWJrdm1naWN2MiwkKENPTkZJR19MSUJHSUNWMikp
KQ0KPiA+ID4gLQ0KPiA+ID4gKyQoZXZhbCAkKGNhbGwgYWRkcGxhdGxpYl9zLGt2bSxsaWJrdm1w
bDAzMSwkKENPTkZJR19MSUJQTDAzMSkpKQ0KPiA+ID4gICAjIw0KPiA+ID4gICAjIyBQbGF0Zm9y
bSBsaWJyYXJ5IGRlZmluaXRpb25zDQo+ID4gPiAgICMjDQo+ID4gPiBAQCAtMTgxLDMgKzE4MSwx
MiBAQCBMSUJLVk1HSUNWMl9DSU5DTFVERVMteSAgICAgICAgICs9IC0NCj4gPiBJJChVS19QTEFU
X0NPTU1PTl9CQVNFKS9pbmNsdWRlDQo+ID4gPiAgIExJQktWTUdJQ1YyX0NJTkNMVURFUy15ICAg
ICAgICAgKz0gLQ0KPiBJJChVS19QTEFUX0RSSVZFUlNfQkFTRSkvaW5jbHVkZQ0KPiA+ID4NCj4g
PiA+ICAgTElCS1ZNR0lDVjJfU1JDUy15ICs9ICQoVUtfUExBVF9EUklWRVJTX0JBU0UpL2dpYy9n
aWMtdjIuYw0KPiA+ID4gKw0KPiA+ID4gKyMjDQo+ID4gPiArIyMgUlRDLVBMMDMxIGxpYnJhcnkg
ZGVmaW5pdGlvbnMNCj4gPiA+ICsjIw0KPiA+ID4gK0xJQktWTVBMMDMxX0NJTkNMVURFUy15Kz0g
LQ0KPiA+IEkkKExJQktWTVBMQVRfQkFTRSkvaW5jbHVkZQ0KPiA+IERvZXMgaXQgbmVlZCBzb21l
IGhlYWRlciBmcm9tIHRoZSAgS1ZNIHBsYXRmb3JtPw0KPg0KPiBJIGRvbid0IHRoaW5rIHNvLiBU
aGlzIFJUQyBkcml2ZXIgaXMgY29tbW9uIG9uIGFybSwgaXQncyBiZXR0ZXIgcHV0IHRoaXMgdW5k
ZXINCj4gInBsYXQvY29tbW9uLyINCj4gQnV0IHRoZXJlIGlzIG5vIGEgIk1ha2VmaWxlIi4gU28g
SSBoYXZlIHRvIHB1dCBpdCBoZXJlLg0KPg0KPiBUaGFua3MNCj4gSmlhbnlvbmcNCj4NCj4gPiA+
ICtMSUJLVk1QTDAzMV9DSU5DTFVERVMteSs9IC0NCj4gPiBJJChVS19QTEFUX0NPTU1PTl9CQVNF
KS9pbmNsdWRlDQo+ID4gPiArTElCS1ZNUEwwMzFfQ0lOQ0xVREVTLXkrPSAtDQo+ID4gSSQoVUtf
UExBVF9EUklWRVJTX0JBU0UpL2luY2x1ZGUNCj4gPiA+ICsNCj4gPiA+ICtMSUJLVk1QTDAzMV9T
UkNTLXkgKz0gJChVS19QTEFUX0RSSVZFUlNfQkFTRSkvcnRjL3BsMDMxLmMNCklNUE9SVEFOVCBO
T1RJQ0U6IFRoZSBjb250ZW50cyBvZiB0aGlzIGVtYWlsIGFuZCBhbnkgYXR0YWNobWVudHMgYXJl
IGNvbmZpZGVudGlhbCBhbmQgbWF5IGFsc28gYmUgcHJpdmlsZWdlZC4gSWYgeW91IGFyZSBub3Qg
dGhlIGludGVuZGVkIHJlY2lwaWVudCwgcGxlYXNlIG5vdGlmeSB0aGUgc2VuZGVyIGltbWVkaWF0
ZWx5IGFuZCBkbyBub3QgZGlzY2xvc2UgdGhlIGNvbnRlbnRzIHRvIGFueSBvdGhlciBwZXJzb24s
IHVzZSBpdCBmb3IgYW55IHB1cnBvc2UsIG9yIHN0b3JlIG9yIGNvcHkgdGhlIGluZm9ybWF0aW9u
IGluIGFueSBtZWRpdW0uIFRoYW5rIHlvdS4NCg==


From minios-devel-bounces@lists.xenproject.org Mon Dec 07 13:48:51 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Mon, 07 Dec 2020 13:48:51 +0000
Received: from list by lists.xenproject.org with outflank-mailman.46594.82680 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1kmGsg-0008OO-9s; Mon, 07 Dec 2020 13:48:46 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 46594.82680; Mon, 07 Dec 2020 13:48: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 1kmGsg-0008OH-6u; Mon, 07 Dec 2020 13:48:46 +0000
Received: by outflank-mailman (input) for mailman id 46594;
 Mon, 07 Dec 2020 13:48: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=NPkr=FL=gmail.com=lrbarbulescu@srs-us1.protection.inumbo.net>)
 id 1kmGsf-0008OC-Gn
 for minios-devel@lists.xen.org; Mon, 07 Dec 2020 13:48:45 +0000
Received: from mail-lj1-x235.google.com (unknown [2a00:1450:4864:20::235])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 03761984-9eaf-49e6-aa9b-07c218f2c1fe;
 Mon, 07 Dec 2020 13:48:43 +0000 (UTC)
Received: by mail-lj1-x235.google.com with SMTP id e7so4759182ljg.10
 for <minios-devel@lists.xen.org>; Mon, 07 Dec 2020 05:48:43 -0800 (PST)
X-BeenThere: minios-devel@lists.xenproject.org
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
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: 03761984-9eaf-49e6-aa9b-07c218f2c1fe
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=COsXDZdfTJ4uBssOTD+57i/yazzYY7F1psioKHtrfus=;
        b=tB/y7C2lUfbgi7B1JfHpKTbbMULYsawllEkEBupncPMzQ+qydKT4e+tjxMJp86EeL5
         PpHhW5dyzGcvt6MloZUGkZktIjKCRAUeV/NkztDHLqUc8XFhKIJgHfRxdWQg2ZY0jaWP
         lyqBLPtoun3QXbrjqAbws+ckFcbSz9r1xaBcYIndft15ILmjl/YvJO/jdqrPuT8o4h02
         7rWor/gvKJ+csw4FThTjQSuXeUyaKGqetzw2Dp67SxjGelokxv8QkogJHKKGqntPXhiF
         AmkeI4y6nT3RO3L05FLoNfqwiUvAvqf0hf+vgwhtRP0xpobgbu1Sa5Xifx6n8Tx4dfZ8
         p7wA==
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=COsXDZdfTJ4uBssOTD+57i/yazzYY7F1psioKHtrfus=;
        b=ZcEqBXVF/M2NHaqXrup7Enny0YVpRy2RR9YkF2Qp93VdTsF+fqlGvfoscdQviaNBUK
         S1WlC5BQyU932o4zFl0hOKbZfB/tvUnYRZQGk0ED950S8kTL41299n62J/xF4uFVcMd+
         SPEsQE5y6ynzC/W+mKL/Tgyf5xsZG/mB3R9eDjywTK9TBYUWOQk671kaPTqPVSGyLQKW
         gc1kpE0QRlSi5N1vdGMXj7+QtJ6N+j3+ODNlsQid4TPXVz575lLR/vE5tqEmlzM6GBhI
         Oq9QIwmH7HGhxWB1yeneAoYAYUADoU97Zs4NxQ06FgY50oULw2lC7hZFdqbq4TQ3aOo9
         KPig==
X-Gm-Message-State: AOAM531LEW/vb7R+9XyVcFEwB/aYNC86iNJxIX1RPLSfk/6RMDTqVAo3
	ZGBsOVveAdf18goyckvf3DW2RXSVWZOEydL20So=
X-Google-Smtp-Source: ABdhPJxpaODiWslV8ulrgbnJFhwPgh8hJy735ebBzO8FV/Q32bS1jsxWUMabgof1ciFPKZmPfrztJx5iBvY9J4dgUzc=
X-Received: by 2002:a2e:9807:: with SMTP id a7mr8968961ljj.449.1607348922109;
 Mon, 07 Dec 2020 05:48:42 -0800 (PST)
MIME-Version: 1.0
References: <cover.1607030251.git.dragosargint21@gmail.com> <7cf6506472c164db86771836431fb660af0e9148.1607030251.git.dragosargint21@gmail.com>
In-Reply-To: <7cf6506472c164db86771836431fb660af0e9148.1607030251.git.dragosargint21@gmail.com>
From: Laurentiu Barbulescu <lrbarbulescu@gmail.com>
Date: Mon, 7 Dec 2020 15:48:30 +0200
Message-ID: <CAMpNDKkeJyEPoZA8qLoZ54A8JNdS+Ku4c68QRF_bMUsHWupVvA@mail.gmail.com>
Subject: Re: [UNIKRAFT/LIBHOGWEED v3 1/3] Add md files
To: ARGINT DRAGOS IULIAN <dragosargint21@gmail.com>
Cc: minios-devel@lists.xen.org, felipe.huici@neclab.eu
Content-Type: multipart/alternative; boundary="00000000000088536f05b5e01577"

--00000000000088536f05b5e01577
Content-Type: text/plain; charset="UTF-8"

Hi Dragos,

Looks good to me.

Reviewed-by: Laurentiu Barbulescu <lrbarbulescu@gmail.com>

On Thu, Dec 3, 2020 at 11:21 PM ARGINT DRAGOS IULIAN <
dragosargint21@gmail.com> wrote:

> Signed-off-by: ARGINT DRAGOS IULIAN <dragosargint21@gmail.com>
> ---
>  .gitignore      | 27 +++++++++++++++++++++++++++
>  CODING_STYLE.md |  4 ++++
>  CONTRIBUTING.md |  4 ++++
>  COPYING.md      | 39 +++++++++++++++++++++++++++++++++++++++
>  MAINTAINERS.md  | 11 +++++++++++
>  README.md       | 49 +++++++++++++++++++++++++++++++++++++++++++++++++
>  6 files changed, 134 insertions(+)
>  create mode 100644 .gitignore
>  create mode 100644 CODING_STYLE.md
>  create mode 100644 CONTRIBUTING.md
>  create mode 100644 COPYING.md
>  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..2595ad9
> --- /dev/null
> +++ b/COPYING.md
> @@ -0,0 +1,39 @@
> +License
> +=======
> +
> +Unikraft libhogweed wrappers
> +----------------------------------
> +
> +This repository contains wrapper code to build hogweed 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/MAINTAINERS.md b/MAINTAINERS.md
> new file mode 100644
> index 0000000..6db09e2
> --- /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.
> +
> +       LIBHOGWEED-UNIKRAFT
> +       M:      Argint Dragos Iulian <dragosargint21@gmail.com>
> +       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..3853914
> --- /dev/null
> +++ b/README.md
> @@ -0,0 +1,49 @@
> +Libhogweed for Unikraft
> +=============================
> +
> +This is the port of nettle's libhogweed for Unikraft as external library.
> +
> +Libhogweed depends on newlib, so please make sure you add the following
> +line to the `LIBS` variable in your `Makefile`:
> +       `...:$(UK_LIBS)/newlib:$(UK_LIBS)/libhogweed:...`
> +
> +Testing
> +-------
> +
> +For running the tests: enable the `testsuite` option in the configuration
> menu
> +and select the desired tests. Make sure to include `testutils_glue.h` and
> call
> +the `run_all_libhogweed_tests(v);` function in your main application. The
> parameter
> +`v` stands for verbose and you can either set it to `0`, non verbose
> mode, or `1`,
> +verbose mode.
> +
> +Applications
> +------------
> +
> +To run an application that requires a filesystem, you'll need to run them
> on
> +`kvm` and enable `9pfs`, selecting the following menu options, all of
> them under
> +`Library Configuration`:
> +- `libnewlib`
> +- `libhogweed`
> +- `vfscore: VFS Core Interface` ---> `vfscore: Configuration` --->
> + `Automatically mount a root filesystem` ---> `Default root filesystem`
> +  ---> `9PFS`
> +- `uk9p: 9p client`
> +- `9pfs: 9p filesystem`
> +- `devfs: devfs file system ---> Mount /dev during boot`
> +- `ukswrand: Software random number generator ---> Register random and
> + urandom device to devfs`
> +
> +Mounting a file system
> +---------------------
> +In order to mount the file system you'll need to provide the following
> Qemu
> +parameters:
> +- `-fsdev local,id=myid,path=<some directory>,security_model=none`
> +- `-device virtio-9p-pci,fsdev=myid,mount_tag=rootfs,disable-modern=on,
> +  disable-legacy=off`
> +
> +Note that if you use a different `mount_tag`, you'll need to add it in
> `Default
> +root device` in `vfscore configuration`. Also, to provide command line
> +arguments to the kernel, you'll need to use `-append "param1 param2 ..."`.
> +
> +Please refer to the `README.md` as well as the documentation in the `doc/`
> +subdirectory of the main unikraft repository.
> --
> 2.17.1
>
>

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

<div dir=3D"ltr">Hi Dragos,<div><br></div><div><span style=3D"color:rgb(80,=
0,80)">Looks good to me.</span></div><div><br></div><div>Reviewed-by: Laure=
ntiu Barbulescu &lt;<a href=3D"mailto:lrbarbulescu@gmail.com">lrbarbulescu@=
gmail.com</a>&gt;=C2=A0<br></div></div><br><div class=3D"gmail_quote"><div =
dir=3D"ltr" class=3D"gmail_attr">On Thu, Dec 3, 2020 at 11:21 PM ARGINT DRA=
GOS IULIAN &lt;<a href=3D"mailto:dragosargint21@gmail.com">dragosargint21@g=
mail.com</a>&gt; wrote:<br></div><blockquote class=3D"gmail_quote" style=3D=
"margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-le=
ft:1ex">Signed-off-by: ARGINT DRAGOS IULIAN &lt;<a href=3D"mailto:dragosarg=
int21@gmail.com" target=3D"_blank">dragosargint21@gmail.com</a>&gt;<br>
---<br>
=C2=A0.gitignore=C2=A0 =C2=A0 =C2=A0 | 27 +++++++++++++++++++++++++++<br>
=C2=A0CODING_STYLE.md |=C2=A0 4 ++++<br>
=C2=A0CONTRIBUTING.md |=C2=A0 4 ++++<br>
=C2=A0COPYING.md=C2=A0 =C2=A0 =C2=A0 | 39 +++++++++++++++++++++++++++++++++=
++++++<br>
=C2=A0MAINTAINERS.md=C2=A0 | 11 +++++++++++<br>
=C2=A0README.md=C2=A0 =C2=A0 =C2=A0 =C2=A0| 49 ++++++++++++++++++++++++++++=
+++++++++++++++++++++<br>
=C2=A06 files changed, 134 insertions(+)<br>
=C2=A0create mode 100644 .gitignore<br>
=C2=A0create mode 100644 CODING_STYLE.md<br>
=C2=A0create mode 100644 CONTRIBUTING.md<br>
=C2=A0create mode 100644 COPYING.md<br>
=C2=A0create mode 100644 MAINTAINERS.md<br>
=C2=A0create mode 100644 README.md<br>
<br>
diff --git a/.gitignore b/.gitignore<br>
new file mode 100644<br>
index 0000000..75d2fd3<br>
--- /dev/null<br>
+++ b/.gitignore<br>
@@ -0,0 +1,27 @@<br>
+*.depend<br>
+*.o<br>
+*.a<br>
+*.d<br>
+*.so<br>
+*.orig<br>
+*.rej<br>
+*.bak<br>
+*.swp<br>
+*~<br>
+,*<br>
+\#*\#<br>
+.\#*<br>
+\#_*\#<br>
+.\#_*<br>
+!.gitignore<br>
+.*<br>
+<br>
+# gnu global files<br>
+GPATH<br>
+GRTAGS<br>
+GSYMS<br>
+GTAGS<br>
+<br>
+# cscope files<br>
+cscope.*<br>
+ncscope.*<br>
diff --git a/CODING_STYLE.md b/CODING_STYLE.md<br>
new file mode 100644<br>
index 0000000..5730041<br>
--- /dev/null<br>
+++ b/CODING_STYLE.md<br>
@@ -0,0 +1,4 @@<br>
+Coding Style<br>
+=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D<br>
+<br>
+Please refer to the `CODING_STYLE.md` file in the main Unikraft repository=
.<br>
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md<br>
new file mode 100644<br>
index 0000000..14f6ac6<br>
--- /dev/null<br>
+++ b/CONTRIBUTING.md<br>
@@ -0,0 +1,4 @@<br>
+Contributing to Unikraft<br>
+=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D<b=
r>
+<br>
+Please refer to the `CONTRIBUTING.md` file in the main Unikraft repository=
.<br>
diff --git a/COPYING.md b/COPYING.md<br>
new file mode 100644<br>
index 0000000..2595ad9<br>
--- /dev/null<br>
+++ b/COPYING.md<br>
@@ -0,0 +1,39 @@<br>
+License<br>
+=3D=3D=3D=3D=3D=3D=3D<br>
+<br>
+Unikraft libhogweed wrappers<br>
+----------------------------------<br>
+<br>
+This repository contains wrapper code to build hogweed with Unikraft.<br>
+Each C code file in this repository should declare who is the<br>
+copyright owner and under which terms and conditions the code is<br>
+licensed. If such a licence note is missing, the following copyright<br>
+notice will apply:<br>
+<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0Copyright (c) Year, Institution. All rights res=
erved.<br>
+<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0Redistribution and use in source and binary for=
ms, with or without<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0modification, are permitted provided that the f=
ollowing conditions<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0are met:<br>
+<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A01. Redistributions of source code must retain t=
he above copyright<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 notice, this list of conditions and the=
 following disclaimer.<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A02. Redistributions in binary form must reproduc=
e the above copyright<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 notice, this list of conditions and the=
 following disclaimer in the<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 documentation and/or other materials pr=
ovided with the distribution.<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A03. Neither the name of the copyright holder nor=
 the names of its<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 contributors may be used to endorse or =
promote products derived from<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 this software without specific prior wr=
itten permission.<br>
+<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLD=
ERS AND CONTRIBUTORS &quot;AS IS&quot;<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDIN=
G, BUT NOT LIMITED TO, THE<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNE=
SS FOR A PARTICULAR PURPOSE<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT=
 HOLDER OR CONTRIBUTORS BE<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SP=
ECIAL, EXEMPLARY, OR<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMIT=
ED TO, PROCUREMENT OF<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA=
, OR PROFITS; OR BUSINESS<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY =
OF LIABILITY, WHETHER IN<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING =
NEGLIGENCE OR OTHERWISE)<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTW=
ARE, EVEN IF ADVISED OF THE<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0POSSIBILITY OF SUCH DAMAGE.<br>
+<br>
diff --git a/MAINTAINERS.md b/MAINTAINERS.md<br>
new file mode 100644<br>
index 0000000..6db09e2<br>
--- /dev/null<br>
+++ b/MAINTAINERS.md<br>
@@ -0,0 +1,11 @@<br>
+Maintainers List<br>
+=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D<br>
+<br>
+For notes on how to read this information, please refer to `MAINTAINERS.md=
` in<br>
+the main Unikraft repository.<br>
+<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0LIBHOGWEED-UNIKRAFT<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0M:=C2=A0 =C2=A0 =C2=A0 Argint Dragos Iulian &lt=
;<a href=3D"mailto:dragosargint21@gmail.com" target=3D"_blank">dragosargint=
21@gmail.com</a>&gt;<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0M:=C2=A0 =C2=A0 =C2=A0 Felipe Huici &lt;<a href=
=3D"mailto:felipe.huici@neclab.eu" target=3D"_blank">felipe.huici@neclab.eu=
</a>&gt;<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0L:=C2=A0 =C2=A0 =C2=A0 <a href=3D"mailto:minios=
-devel@lists.xen.org" target=3D"_blank">minios-devel@lists.xen.org</a><br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0F: *<br>
diff --git a/README.md b/README.md<br>
new file mode 100644<br>
index 0000000..3853914<br>
--- /dev/null<br>
+++ b/README.md<br>
@@ -0,0 +1,49 @@<br>
+Libhogweed for Unikraft<br>
+=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D<br>
+<br>
+This is the port of nettle&#39;s libhogweed for Unikraft as external libra=
ry.<br>
+<br>
+Libhogweed depends on newlib, so please make sure you add the following<br=
>
+line to the `LIBS` variable in your `Makefile`:<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0`...:$(UK_LIBS)/newlib:$(UK_LIBS)/libhogweed:..=
.`<br>
+<br>
+Testing<br>
+-------<br>
+<br>
+For running the tests: enable the `testsuite` option in the configuration =
menu<br>
+and select the desired tests. Make sure to include `testutils_glue.h` and =
call <br>
+the `run_all_libhogweed_tests(v);` function in your main application. The =
parameter<br>
+`v` stands for verbose and you can either set it to `0`, non verbose mode,=
 or `1`,<br>
+verbose mode.<br>
+<br>
+Applications<br>
+------------<br>
+<br>
+To run an application that requires a filesystem, you&#39;ll need to run t=
hem on<br>
+`kvm` and enable `9pfs`, selecting the following menu options, all of them=
 under<br>
+`Library Configuration`:<br>
+- `libnewlib`<br>
+- `libhogweed`<br>
+- `vfscore: VFS Core Interface` ---&gt; `vfscore: Configuration` ---&gt; <=
br>
+ `Automatically mount a root filesystem` ---&gt; `Default root filesystem`=
<br>
+=C2=A0 ---&gt; `9PFS`<br>
+- `uk9p: 9p client`<br>
+- `9pfs: 9p filesystem`<br>
+- `devfs: devfs file system ---&gt; Mount /dev during boot`<br>
+- `ukswrand: Software random number generator ---&gt; Register random and<=
br>
+ urandom device to devfs`<br>
+<br>
+Mounting a file system<br>
+---------------------<br>
+In order to mount the file system you&#39;ll need to provide the following=
 Qemu<br>
+parameters:<br>
+- `-fsdev local,id=3Dmyid,path=3D&lt;some directory&gt;,security_model=3Dn=
one`<br>
+- `-device virtio-9p-pci,fsdev=3Dmyid,mount_tag=3Drootfs,disable-modern=3D=
on,<br>
+=C2=A0 disable-legacy=3Doff`<br>
+<br>
+Note that if you use a different `mount_tag`, you&#39;ll need to add it in=
 `Default<br>
+root device` in `vfscore configuration`. Also, to provide command line <br=
>
+arguments to the kernel, you&#39;ll need to use `-append &quot;param1 para=
m2 ...&quot;`.<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0<br>
+Please refer to the `README.md` as well as the documentation in the `doc/`=
<br>
+subdirectory of the main unikraft repository.<br>
-- <br>
2.17.1<br>
<br>
</blockquote></div>

--00000000000088536f05b5e01577--


From minios-devel-bounces@lists.xenproject.org Mon Dec 07 13:50:23 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Mon, 07 Dec 2020 13:50:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.46597.82684 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1kmGuE-0000fb-GC; Mon, 07 Dec 2020 13:50:22 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 46597.82684; Mon, 07 Dec 2020 13:50: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 1kmGuE-0000fT-CW; Mon, 07 Dec 2020 13:50:22 +0000
Received: by outflank-mailman (input) for mailman id 46597;
 Mon, 07 Dec 2020 13:50: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=NPkr=FL=gmail.com=lrbarbulescu@srs-us1.protection.inumbo.net>)
 id 1kmGuD-0000fO-Gt
 for minios-devel@lists.xen.org; Mon, 07 Dec 2020 13:50:21 +0000
Received: from mail-lf1-x141.google.com (unknown [2a00:1450:4864:20::141])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id dc341ed3-9bbd-4a77-9aef-d72041fb9031;
 Mon, 07 Dec 2020 13:50:16 +0000 (UTC)
Received: by mail-lf1-x141.google.com with SMTP id s30so18155732lfc.4
 for <minios-devel@lists.xen.org>; Mon, 07 Dec 2020 05:50:16 -0800 (PST)
X-BeenThere: minios-devel@lists.xenproject.org
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
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: dc341ed3-9bbd-4a77-9aef-d72041fb9031
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=OYq27HkXm+Uqe69nWqRoQAK4VC+7ECu2v+6qa4u2H4Q=;
        b=FhV/O7Illgo+Amj40PQULD14td/08EmPetiHJ1ZrTZ+xI6a2gau9UVfTwbPjQpqsRQ
         98SYQwSwnwn5Tg73GXNZwXaZiO5Pn5whIX6gyl11svlluLVCqeWAnFrh1gmoH2pw0pw6
         MavQoJ8GrmDyyHc85QVw7UopJIGbk/3x32A1nNgKcSu4rP1Bte2cIySczoWiCVGpityG
         ys9p6hjd2cmjWbp7d3qQtJ3Aq+FhbrvPlmtJEyuv9QSGe3DN4KoX5MIJuWFwvup0FPtx
         iXRi1NKf28cilRDtjSbnN9odJcvk/7fq/5kNkl5nCNrHZq4fN+YzmI0QxRRG62wyfrQl
         i0Sg==
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=OYq27HkXm+Uqe69nWqRoQAK4VC+7ECu2v+6qa4u2H4Q=;
        b=mA7Sd0ZY8JIsVSWjPVJGQZMlcUNmPUknGhmW/jzeNQaTeVCagtqV8VRw3l4D7M152V
         Hn2lBXmLoN3Bkj9ip6zmu7lHvtH8/GG7/Shgqa6BOB7SW5jtMvsJ7BzzV4fJbO7SeDBX
         uvvHubLKRzMke+P8JK/XAYy3SRt4uTaDF52rAUsFOXBJOJYloXfAhrjtyFqPJVl1i0F7
         ZPepSromXpqErgi0/RFWupy2iilcQwLIX0sk7elGPg2d//Rr0fFTjAOj7pXs2AMUiUO/
         of8fLcVFc1X9goS6suCVMmrVSHl1x8Sw3SRGQheLrXbnq3mVhDFhZH4Qzc3HavDnrEe2
         Ys2A==
X-Gm-Message-State: AOAM532B+htH6ZLCioYFwbWvHY8RdcWDHo+8qICj+9P7ru5FgNB0ZrMT
	rEBZ0GkgM0bV4IWqM91VP3Ag2Q0JVxC5QqerABM0FoakE2m6F+UM
X-Google-Smtp-Source: ABdhPJwT9b0xk7MCfp/bY54KDwlNjXmvfX2TeO5T4sKNW2tKYeh5ym9Es1Ff+mdVWlXmn5LOHYJfhRZhQV21WueVyfc=
X-Received: by 2002:ac2:5dfa:: with SMTP id z26mr2660782lfq.286.1607349015591;
 Mon, 07 Dec 2020 05:50:15 -0800 (PST)
MIME-Version: 1.0
References: <cover.1607029055.git.dragosargint21@gmail.com> <fbc37140d325a0bc41b69700b1d2a724d3dac61f.1607029055.git.dragosargint21@gmail.com>
In-Reply-To: <fbc37140d325a0bc41b69700b1d2a724d3dac61f.1607029055.git.dragosargint21@gmail.com>
From: Laurentiu Barbulescu <lrbarbulescu@gmail.com>
Date: Mon, 7 Dec 2020 15:50:04 +0200
Message-ID: <CAMpNDKnaiOy=j-6HT5_nVzvPpC031Zin=3PQpzQScGopMGNekg@mail.gmail.com>
Subject: Re: [PATCH v3 2/3] Add Makefile.uk and Config.uk
To: ARGINT DRAGOS IULIAN <dragosargint21@gmail.com>
Cc: minios-devel@lists.xen.org, felipe.huici@neclab.eu
Content-Type: multipart/alternative; boundary="0000000000001abe9f05b5e01b3a"

--0000000000001abe9f05b5e01b3a
Content-Type: text/plain; charset="UTF-8"

Hi Dragos,

Looks good to me.

Reviewed-by: Laurentiu Barbulescu <lrbarbulescu@gmail.com>

On Thu, Dec 3, 2020 at 11:07 PM ARGINT DRAGOS IULIAN <
dragosargint21@gmail.com> wrote:

> Signed-off-by: ARGINT DRAGOS IULIAN <dragosargint21@gmail.com>
> ---
>  Config.uk   |  83 +++++++++
>  Makefile.uk | 490 ++++++++++++++++++++++++++++++++++++++++++++++++++++
>  2 files changed, 573 insertions(+)
>  create mode 100644 Config.uk
>  create mode 100644 Makefile.uk
>
> diff --git a/Config.uk b/Config.uk
> new file mode 100644
> index 0000000..7f422ee
> --- /dev/null
> +++ b/Config.uk
> @@ -0,0 +1,83 @@
> +config LIBHOGWEED
> +       bool "libhogweed - Public-key algorithms"
> +       default n
> +       select LIBNEWLIBC
> +
> +if LIBHOGWEED
> +       menuconfig TESTSUITE
> +               bool "testsuite - tests for libhogweed"
> +               default n
> +               if TESTSUITE
> +                       config RSA_COMPUTE_ROOT_TEST
> +                               bool "rsa-compute-root-test"
> +                               default y
> +                       config RSA_ENCRYPT_TEST
> +                               bool "rsa-encrypt-test"
> +                               default y
> +                       config RSA_KEYGEN_TEST
> +                               bool "rsa-keygen-test"
> +                               default y
> +                       config RSA_PSS_SIGN_TR_TEST
> +                               bool "rsa-pss-sign-tr-test"
> +                               default y
> +                       config RSA_SEC_DECRYPT_TEST
> +                               bool "rsa-sec-decrypt-test"
> +                               default y
> +                       config RSA_SIGN_TR_TEST
> +                               bool "rsa-sign-tr-test"
> +                               default y
> +                       config RSA_TEST
> +                               bool "rsa-test"
> +                               default y
> +                       config RSA2SEXP_TEST
> +                               bool "rsa2sexp-test"
> +                               default y
> +                       config SEXP2RSA_TEST
> +                               bool "sexp2rsa-test"
> +                               default y
> +                       config CURVE25519_DH_TEST
> +                               bool "curve25519-dh-test"
> +                               default y
> +                       config CURVE448_DH_TEST
> +                               bool "curve448-dh-test"
> +                               default y
> +                       config DSA_KEYGEN_TEST
> +                               bool "dsa-keygen-test"
> +                               default y
> +                       config DSA_TEST
> +                               bool "dsa-test"
> +                               default y
> +                       config ECDSA_KEYGEN_TEST
> +                               bool "ecdsa-keygen-test"
> +                               default y
> +                       config ECDSA_SIGN_TEST
> +                               bool "ecdsa-sign-test"
> +                               default y
> +                       config ECDSA_VERIFY_TEST
> +                               bool "ecdsa-verify-test"
> +                               default y
> +                       config EDDSA_COMPRESS_TEST
> +                               bool "eddsa-compress-test"
> +                               default y
> +                       config EDDSA_SIGN_TEST
> +                               bool "eddsa-sign-test"
> +                               default y
> +                       config EDDSA_VERIFY_TEST
> +                               bool "eddsa-verify-test"
> +                               default y
> +                       config GOSTDSA_KEYGEN_TEST
> +                               bool "gostdsa-keygen-test"
> +                               default y
> +                       config GOSTDSA_SIGN_TEST
> +                               bool "gostdsa-sign-test"
> +                               default y
> +                       config GOSTDSA_VERIFY_TEST
> +                               bool "gostdsa-verify-test"
> +                               default y
> +                       config GOSTDSA_VKO_TEST
> +                               bool "gostdsa-vko-test"
> +                               default y
> +       endif
> +endif
> +
> +
> diff --git a/Makefile.uk b/Makefile.uk
> new file mode 100644
> index 0000000..666f31b
> --- /dev/null
> +++ b/Makefile.uk
> @@ -0,0 +1,490 @@
> +#  SPDX-License-Identifier: BSD-3-Clause
> +#
> +#  libhogweed Makefile.uk
> +#
> +#  Authors: Argint Dragos Iulian <dragosargint21@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.
> +#
> +
>
> +################################################################################
> +# Library registration
>
> +################################################################################
> +$(eval $(call addlib_s,libhogweed,$(CONFIG_LIBHOGWEED)))
> +#$(eval $(call addlib_s,libhogweedglue,$(CONFIG_LIBHOGWEED)))
> +
>
> +################################################################################
> +# Original sources
>
> +################################################################################
> +LIBHOGWEED_VERSION=3.6
> +LIBHOGWEED_URL=
> https://ftp.gnu.org/gnu/nettle/nettle-$(LIBHOGWEED_VERSION).tar.gz
> +LIBHOGWEED_PATCHDIR=$(LIBHOGWEED_BASE)/patches
> +LIBHOGWEED_SUBDIR=nettle-$(LIBHOGWEED_VERSION)
> +$(eval $(call fetch,libhogweed,$(LIBHOGWEED_URL)))
> +#$(eval $(call
> patch,libhogweed,$(LIBHOHWEED_PATCHDIR),$(LIBHOGWEED_SUBDIR)))
> +
>
> +################################################################################
> +# Helpers
>
> +################################################################################
> +LIBHOGWEED_EXTRACTED = $(LIBHOGWEED_ORIGIN)/nettle-$(LIBHOGWEED_VERSION)
> +
>
> +################################################################################
> +# Library includes
>
> +################################################################################
> +LIBHOGWEED_COMMON_INCLUDES-y     += -I$(LIBHOGWEED_BASE)/include
> +LIBHOGWEED_COMMON_INCLUDES-y     += -I$(LIBHOGWEED_EXTRACTED)
> +LIBHOGWEED_COMMON_INCLUDES-y     += -I$(LIBHOGWEED_EXTRACTED)/testsuite
> +CINCLUDES-$(CONFIG_LIBHOGWEED)   += $(LIBHOGWEED_COMMON_INCLUDES-y)
> +CXXINCLUDES-$(CONFIG_LIBHOGWEED) += $(LIBHOGWEED_COMMON_INCLUDES-y)
> +
> +LIBHOGWEED_CINCLUDES   += -I$(LIBHOGWEED_EXTRACTED)
> +LIBHOGWEED_CXXINCLUDES += -I$(LIBHOGWEED_EXTRACTED)
> +
>
> +################################################################################
> +# Global flags
>
> +################################################################################
> +# Suppress flags
> +LIBHOGWEED_SUPPRESS_FLAGS += -Wno-unused-parameter \
> +        -Wno-unused-variable -Wno-unused-value -Wno-unused-function \
> +        -Wno-missing-field-initializers -Wno-implicit-fallthrough \
> +        -Wno-sign-compare
> +LIBHOGWEED_CFLAGS-y   += $(LIBHOGWEED_SUPPRESS_FLAGS) \
> +        -Wno-pointer-to-int-cast -Wno-int-to-pointer-cast
> +LIBHOGWEED_CXXFLAGS-y += $(LIBHOGWEED_SUPPRESS_FLAGS)
> +
> +# Preprocessing symbols
> +LIBHOGWEED_DEFINES    += -DHAVE_CONFIG_H
> +LIBHOGWEED_CFLAGS-y   += $(LIBHOGWEED_DEFINES)
> +LIBHOGWEED_CXXFLAGS-y += $(LIBHOGWEED_DEFINES)
> +
>
> +################################################################################
> +# HOGWEED code -- bignum
>
> +################################################################################
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/bignum.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/bignum-random.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/bignum-random-prime.c
> +
>
> +################################################################################
> +# HOGWEED code -- yarrow
>
> +################################################################################
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/yarrow256.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/yarrow_key_event.c
> +
>
> +################################################################################
> +# HOGWEED code -- gmp
>
> +################################################################################
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/mini-gmp.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/gmp-glue.c
> +
>
> +################################################################################
> +# HOGWEED code -- aes
>
> +################################################################################
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/aes-encrypt.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/aes-decrypt.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/aes-encrypt-internal.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/aes-encrypt-table.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/aes-decrypt-internal.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/aes-set-key-internal.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/aes256-set-encrypt-key.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/aes256-set-decrypt-key.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/aes-invert-internal.c
> +
>
> +################################################################################
> +# HOGWEED code -- sha
>
> +################################################################################
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/sha1.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/sha1-meta.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/sha1-compress.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/sha256.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/sha256-meta.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/sha256-compress.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/sha512.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/sha512-meta.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/sha512-compress.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/sha3.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/sha3-permute.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/sha3-256.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/sha384-meta.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/sha224-meta.c
> +
>
> +################################################################################
> +# HOGWEED code -- md5
>
> +################################################################################
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/md5.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/md5-compress.c
> +
>
> +################################################################################
> +# HOGWEED code -- write
>
> +################################################################################
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/write-be32.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/write-le32.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/write-le64.c
> +
>
> +################################################################################
> +# HOGWEED code -- buffer
>
> +################################################################################
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/buffer.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/buffer-init.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/realloc.c
> +
>
> +################################################################################
> +# HOGWEED code -- rsa
>
> +################################################################################
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/rsa.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/rsa-sign.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/rsa-sign-tr.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/rsa-keygen.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/rsa-encrypt.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/rsa-decrypt.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/rsa-decrypt-tr.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/rsa-verify.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/rsa-sha1-sign.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/rsa-sha1-sign-tr.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/rsa-sha1-verify.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/rsa-md5-sign.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/rsa-md5-sign-tr.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/rsa-md5-verify.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/rsa-pss-sha256-sign-tr.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/rsa-pss-sha256-verify.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/rsa-pss-sha512-sign-tr.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/rsa-pss-sha512-verify.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/rsa-pkcs1-sign.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/rsa-pkcs1-sign-tr.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/rsa-pkcs1-verify.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/rsa-sha256-sign.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/rsa-sha256-sign-tr.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/rsa-sha256-verify.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/rsa-sha512-sign.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/rsa-sha512-sign-tr.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/rsa-sha512-verify.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/rsa-sec-decrypt.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/rsa-sec-compute-root.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/rsa2sexp.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/rsa-blind.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/rsa2openpgp.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/pgp-encode.c
> +
>
> +################################################################################
> +# HOGWEED code -- pss
>
> +################################################################################
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/pss.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/pss-mgf1.c
> +
>
> +################################################################################
> +# HOGWEED code -- pkcs
>
> +################################################################################
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/pkcs1.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/pkcs1-encrypt.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/pkcs1-decrypt.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/pkcs1-sec-decrypt.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/pkcs1-rsa-sha1.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/pkcs1-rsa-sha256.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/pkcs1-rsa-sha512.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/pkcs1-rsa-digest.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/pkcs1-rsa-md5.c
> +
>
> +################################################################################
> +# HOGWEED code -- dsa
>
> +################################################################################
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/dsa.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/dsa-sign.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/dsa-hash.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/dsa-verify.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/dsa-keygen.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/dsa-compat.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/dsa-compat-keygen.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/dsa-gen-params.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/dsa-sha1-sign.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/dsa-sha1-verify.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/dsa-sha256-sign.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/dsa-sha256-verify.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/dsa2sexp.c
> +
>
> +################################################################################
> +# HOGWEED code -- ecdsa
>
> +################################################################################
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/ecdsa-keygen.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/ecdsa-sign.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/ecdsa-verify.c
> +
>
> +################################################################################
> +# HOGWEED code -- ecc
>
> +################################################################################
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/ecc-a-to-j.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/ecc-add-eh.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/ecc-add-ehh.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/ecc-add-jja.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/ecc-add-jjj.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/ecc-add-th.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/ecc-add-thh.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/ecc-curve25519-modp.s
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/ecc-curve25519.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/ecc-curve448-modp.s
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/ecc-curve448.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/ecc-dup-eh.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/ecc-dup-jj.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/ecc-dup-th.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/ecc-ecdsa-sign.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/ecc-ecdsa-verify.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/ecc-eh-to-a.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/ecc-gost-gc256b.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/ecc-gost-gc512a.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/ecc-gostdsa-sign.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/ecc-gostdsa-verify.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/ecc-hash.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/ecc-j-to-a.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/ecc-mod-arith.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/ecc-mod-inv.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/ecc-mod.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/ecc-mul-a-eh.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/ecc-mul-a.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/ecc-mul-g-eh.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/ecc-mul-g.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/ecc-mul-m.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/ecc-point.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/ecc-random.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/ecc-scalar.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/ecc-secp192r1-modp.s
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/ecc-secp192r1.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/ecc-secp224r1-modp.s
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/ecc-secp224r1.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/ecc-secp256r1-redc.s
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/ecc-secp256r1.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/ecc-secp384r1-modp.s
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/ecc-secp384r1.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/ecc-secp521r1-modp.s
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/ecc-secp521r1.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/ecc-size.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/sec-add-1.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/sec-tabselect.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/cnd-copy.c
> +
>
> +################################################################################
> +# HOGWEED code -- curve
>
> +################################################################################
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/curve25519-mul.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/curve25519-mul-g.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/curve25519-eh-to-x.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/curve448-mul.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/curve448-mul-g.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/curve448-eh-to-x.c
> +
>
> +################################################################################
> +# HOGWEED code -- gostdsa
>
> +################################################################################
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/gostdsa-sign.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/gostdsa-verify.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/gostdsa-vko.c
> +
>
> +################################################################################
> +# HOGWEED code -- eddsa
>
> +################################################################################
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/eddsa-compress.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/eddsa-decompress.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/eddsa-sign.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/eddsa-verify.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/eddsa-expand.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/eddsa-hash.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/eddsa-pubkey.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/ed25519-sha512.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/ed448-shake256.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/shake256.c
> +
>
> +################################################################################
> +# HOGWEED code -- sexp
>
> +################################################################################
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/sexp.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/sexp2rsa.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/sexp-format.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/sexp2bignum.c
> +#LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/sexp-transport-format.c
> +
>
> +################################################################################
> +# HOGWEED code -- hex encoding
>
> +################################################################################
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/base16-encode.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/base16-decode.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/base64-encode.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/base64-decode.c
> +
>
> +################################################################################
> +# HOGWEED code -- miscellaneous
>
> +################################################################################
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/knuth-lfib.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/hmac.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/hmac-sha1.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/memxor.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/memxor3.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/cnd-memcpy.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/memeql-sec.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/cbc.c
> +
>
> +################################################################################
> +# HOGWEED code -- tests
>
> +################################################################################
> +LIBHOGWEED_SRCS-$(CONFIG_TESTSUITE) += $(LIBHOGWEED_BASE)/testutils_glue.c
> +ifeq ($(CONFIG_RSA_COMPUTE_ROOT_TEST),y)
> +LIBHOGWEED_SRCS-y +=
> $(LIBHOGWEED_EXTRACTED)/testsuite/rsa-compute-root-test.c
> +LIBHOGWEED_RSA-COMPUTE-ROOT-TEST_FLAGS-y +=
> -Dtest_main=rsa_compute_root_test
> +endif
> +ifeq ($(CONFIG_RSA_ENCRYPT_TEST),y)
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/testsuite/rsa-encrypt-test.c
> +LIBHOGWEED_RSA-ENCRYPT-TEST_FLAGS-y += -Dtest_main=rsa_encrypt_test
> +endif
> +ifeq ($(CONFIG_RSA_KEYGEN_TEST),y)
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/testsuite/rsa-keygen-test.c
> +LIBHOGWEED_RSA-KEYGEN-TEST_FLAGS-y += -Dtest_main=rsa_keygen_test
> +endif
> +ifeq ($(CONFIG_RSA_PSS_SIGN_TR_TEST),y)
> +LIBHOGWEED_SRCS-y +=
> $(LIBHOGWEED_EXTRACTED)/testsuite/rsa-pss-sign-tr-test.c
> +LIBHOGWEED_RSA-PSS-SIGN-TR-TEST_FLAGS-y +=
> -Dtest_main=rsa_pss_sign_tr_test
> +endif
> +ifeq ($(CONFIG_RSA_SEC_DECRYPT_TEST),y)
> +LIBHOGWEED_SRCS-y +=
> $(LIBHOGWEED_EXTRACTED)/testsuite/rsa-sec-decrypt-test.c
> +LIBHOGWEED_RSA-SEC-DECRYPT-TEST_FLAGS-y +=
> -Dtest_main=rsa_sec_decrypt_test
> +endif
> +ifeq ($(CONFIG_RSA_SIGN_TR_TEST),y)
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/testsuite/rsa-sign-tr-test.c
> +LIBHOGWEED_RSA-SIGN-TR-TEST_FLAGS-y += -Dtest_main=rsa_sign_tr_test
> +endif
> +ifeq ($(CONFIG_RSA_TEST),y)
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/testsuite/rsa-test.c
> +LIBHOGWEED_RSA-TEST_FLAGS-y += -Dtest_main=rsa_test
> +endif
> +ifeq ($(CONFIG_RSA2SEXP_TEST),y)
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/testsuite/rsa2sexp-test.c
> +LIBHOGWEED_RSA2SEXP-TEST_FLAGS-y += -Dtest_main=rsa2sexp_test
> +endif
> +ifeq ($(CONFIG_SEXP2RSA_TEST),y)
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/testsuite/sexp2rsa-test.c
> +LIBHOGWEED_SEXP2RSA-TEST_FLAGS-y += -Dtest_main=sexp2rsa_test
> +endif
> +ifeq ($(CONFIG_CURVE25519_DH_TEST),y)
> +LIBHOGWEED_SRCS-y +=
> $(LIBHOGWEED_EXTRACTED)/testsuite/curve25519-dh-test.c
> +LIBHOGWEED_CURVE25519-DH-TEST_FLAGS-y += -Dtest_main=curve25519_dh_test
> +endif
> +ifeq ($(CONFIG_CURVE448_DH_TEST),y)
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/testsuite/curve448-dh-test.c
> +LIBHOGWEED_CURVE448-DH-TEST_FLAGS-y += -Dtest_main=curve448_dh_test
> +endif
> +ifeq ($(CONFIG_DSA_KEYGEN_TEST),y)
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/testsuite/dsa-keygen-test.c
> +LIBHOGWEED_DSA-KEYGEN-TEST_FLAGS-y += -Dtest_main=dsa_keygen_test
> +endif
> +ifeq ($(CONFIG_DSA_TEST),y)
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/testsuite/dsa-test.c
> +LIBHOGWEED_DSA-TEST_FLAGS-y += -Dtest_main=dsa_test
> +endif
> +ifeq ($(CONFIG_ECDSA_KEYGEN_TEST),y)
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/testsuite/ecdsa-keygen-test.c
> +LIBHOGWEED_ECDSA-KEYGEN-TEST_FLAGS-y += -Dtest_main=ecdsa_keygen_test
> +endif
> +ifeq ($(CONFIG_ECDSA_SIGN_TEST),y)
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/testsuite/ecdsa-sign-test.c
> +LIBHOGWEED_ECDSA-SIGN-TEST_FLAGS-y += -Dtest_main=ecdsa_sign_test
> +endif
> +ifeq ($(CONFIG_ECDSA_VERIFY_TEST),y)
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/testsuite/ecdsa-verify-test.c
> +LIBHOGWEED_ECDSA-VERIFY-TEST_FLAGS-y += -Dtest_main=ecdsa_verify_test
> +endif
> +ifeq ($(CONFIG_EDDSA_COMPRESS_TEST),y)
> +LIBHOGWEED_SRCS-y +=
> $(LIBHOGWEED_EXTRACTED)/testsuite/eddsa-compress-test.c
> +LIBHOGWEED_EDDSA-COMPRESS-TEST_FLAGS-y += -Dtest_main=eddsa_compress_test
> +endif
> +ifeq ($(CONFIG_EDDSA_SIGN_TEST),y)
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/testsuite/eddsa-sign-test.c
> +LIBHOGWEED_EDDSA-SIGN-TEST_FLAGS-y += -Dtest_main=eddsa_sign_test
> +endif
> +ifeq ($(CONFIG_EDDSA_VERIFY_TEST),y)
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/testsuite/eddsa-verify-test.c
> +LIBHOGWEED_EDDSA-VERIFY-TEST_FLAGS-y += -Dtest_main=eddsa_verify_test
> +endif
> +ifeq ($(CONFIG_GOSTDSA_KEYGEN_TEST),y)
> +LIBHOGWEED_SRCS-y +=
> $(LIBHOGWEED_EXTRACTED)/testsuite/gostdsa-keygen-test.c
> +LIBHOGWEED_GOSTDSA-KEYGEN-TEST_FLAGS-y += -Dtest_main=gostdsa_keygen_test
> +endif
> +ifeq ($(CONFIG_GOSTDSA_SIGN_TEST),y)
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/testsuite/gostdsa-sign-test.c
> +LIBHOGWEED_GOSTDSA-SIGN-TEST_FLAGS-y += -Dtest_main=gostdsa_sign_test
> +endif
> +ifeq ($(CONFIG_GOSTDSA_VERIFY_TEST),y)
> +LIBHOGWEED_SRCS-y +=
> $(LIBHOGWEED_EXTRACTED)/testsuite/gostdsa-verify-test.c
> +LIBHOGWEED_GOSTDSA-VERIFY-TEST_FLAGS-y += -Dtest_main=gostdsa_verify_test
> +endif
> +ifeq ($(CONFIG_GOSTDSA_VKO_TEST),y)
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/testsuite/gostdsa-vko-test.c
> +LIBHOGWEED_GOSTDSA-VKO-TEST_FLAGS-y += -Dtest_main=gostdsa_vko_test
> +endif
> +
> +
> +
>
> +################################################################################
> +# HOGWEED prepare
>
> +################################################################################
> +# Run ./configure
> +$(LIBHOGWEED_EXTRACTED)/config.h: $(LIBHOGWEED_BUILD)/.origin
> +       $(call verbose_cmd,CONFIG,libhogweed: $(notdir $@), \
> +        cd $(LIBHOGWEED_EXTRACTED) && ./configure --enable-mini-gmp \
> +    )
> +
> +# Generate auxiliar files using the original building system
> +$(LIBHOGWEED_EXTRACTED)/make_auxiliar: $(LIBHOGWEED_BUILD)/.origin
> +       $(call verbose_cmd,CONFIG,libhogweed: $(notdir $@), \
> +        cd $(LIBHOGWEED_EXTRACTED) && \
> +        make ecc-secp192r1.h && \
> +        make ecc-secp224r1.h && \
> +        make ecc-secp256r1.h && \
> +               make ecc-secp384r1.h && \
> +        make ecc-secp521r1.h && \
> +        make ecc-curve25519.h && \
> +        make ecc-curve448.h && \
> +        make ecc-gost-gc256b.h && \
> +        make ecc-gost-gc512a.h && \
> +        /usr/bin/m4 ./asm.m4 machine.m4 config.m4 ecc-curve25519-modp.asm
> \
> +               > ecc-curve25519-modp.s && \
> +        /usr/bin/m4 ./asm.m4 machine.m4 config.m4 ecc-curve448-modp.asm \
> +               > ecc-curve448-modp.s && \
> +        /usr/bin/m4 ./asm.m4 machine.m4 config.m4 ecc-secp192r1-modp.asm \
> +               > ecc-secp192r1-modp.s && \
> +        /usr/bin/m4 ./asm.m4 machine.m4 config.m4 ecc-secp224r1-modp.asm \
> +            > ecc-secp224r1-modp.s && \
> +        /usr/bin/m4 ./asm.m4 machine.m4 config.m4 ecc-secp256r1-redc.asm \
> +               > ecc-secp256r1-redc.s && \
> +        /usr/bin/m4 ./asm.m4 machine.m4 config.m4 ecc-secp384r1-modp.asm \
> +               > ecc-secp384r1-modp.s && \
> +        /usr/bin/m4 ./asm.m4 machine.m4 config.m4 ecc-secp521r1-modp.asm \
> +               > ecc-secp521r1-modp.s && \
> +        echo "done" > make_auxiliar \
> +    )
> +
> +LIBHOGWEED_PREPARED_DEPS = $(LIBHOGWEED_EXTRACTED)/config.h \
> +
>  $(LIBHOGWEED_EXTRACTED)/make_auxiliar
> +
> +$(LIBHOGWEED_BUILD)/.prepared: $(LIBHOGWEED_PREPARED_DEPS)
> +
> +UK_PREPARE += $(LIBHOGWEED_BUILD)/.prepared
> --
> 2.17.1
>
>

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

<div dir=3D"ltr">Hi Dragos,<div><br></div><div><span style=3D"color:rgb(80,=
0,80)">Looks good to me.</span></div><div><br></div><div>Reviewed-by: Laure=
ntiu Barbulescu &lt;<a href=3D"mailto:lrbarbulescu@gmail.com">lrbarbulescu@=
gmail.com</a>&gt;</div></div><br><div class=3D"gmail_quote"><div dir=3D"ltr=
" class=3D"gmail_attr">On Thu, Dec 3, 2020 at 11:07 PM ARGINT DRAGOS IULIAN=
 &lt;<a href=3D"mailto:dragosargint21@gmail.com">dragosargint21@gmail.com</=
a>&gt; wrote:<br></div><blockquote class=3D"gmail_quote" style=3D"margin:0p=
x 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Si=
gned-off-by: ARGINT DRAGOS IULIAN &lt;<a href=3D"mailto:dragosargint21@gmai=
l.com" target=3D"_blank">dragosargint21@gmail.com</a>&gt;<br>
---<br>
=C2=A0Config.uk=C2=A0 =C2=A0|=C2=A0 83 +++++++++<br>
=C2=A0Makefile.uk | 490 +++++++++++++++++++++++++++++++++++++++++++++++++++=
+<br>
=C2=A02 files changed, 573 insertions(+)<br>
=C2=A0create mode 100644 Config.uk<br>
=C2=A0create mode 100644 Makefile.uk<br>
<br>
diff --git a/Config.uk b/Config.uk<br>
new file mode 100644<br>
index 0000000..7f422ee<br>
--- /dev/null<br>
+++ b/Config.uk<br>
@@ -0,0 +1,83 @@<br>
+config LIBHOGWEED<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0bool &quot;libhogweed - Public-key algorithms&q=
uot;<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0default n<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0select LIBNEWLIBC<br>
+<br>
+if LIBHOGWEED<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0menuconfig TESTSUITE<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0bool &quot;testsuit=
e - tests for libhogweed&quot;<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0default n<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0if TESTSUITE<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0config RSA_COMPUTE_ROOT_TEST<br>
+=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=A0bool &quot;rsa-compute-root-test&quot=
;<br>
+=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=A0default y<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0config RSA_ENCRYPT_TEST<br>
+=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=A0bool &quot;rsa-encrypt-test&quot;<br>
+=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=A0default y<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0config RSA_KEYGEN_TEST<br>
+=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=A0bool &quot;rsa-keygen-test&quot;<br>
+=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=A0default y<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0config RSA_PSS_SIGN_TR_TEST<br>
+=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=A0bool &quot;rsa-pss-sign-tr-test&quot;=
<br>
+=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=A0default y<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0config RSA_SEC_DECRYPT_TEST<br>
+=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=A0bool &quot;rsa-sec-decrypt-test&quot;=
<br>
+=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=A0default y<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0config RSA_SIGN_TR_TEST<br>
+=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=A0bool &quot;rsa-sign-tr-test&quot;<br>
+=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=A0default y<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0config RSA_TEST<br>
+=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=A0bool &quot;rsa-test&quot;<br>
+=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=A0default y<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0config RSA2SEXP_TEST<br>
+=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=A0bool &quot;rsa2sexp-test&quot;<br>
+=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=A0default y<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0config SEXP2RSA_TEST<br>
+=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=A0bool &quot;sexp2rsa-test&quot;<br>
+=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=A0default y<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0config CURVE25519_DH_TEST<br>
+=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=A0bool &quot;curve25519-dh-test&quot;<b=
r>
+=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=A0default y<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0config CURVE448_DH_TEST<br>
+=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=A0bool &quot;curve448-dh-test&quot;<br>
+=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=A0default y<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0config DSA_KEYGEN_TEST<br>
+=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=A0bool &quot;dsa-keygen-test&quot;<br>
+=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=A0default y<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0config DSA_TEST<br>
+=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=A0bool &quot;dsa-test&quot;<br>
+=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=A0default y<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0config ECDSA_KEYGEN_TEST<br>
+=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=A0bool &quot;ecdsa-keygen-test&quot;<br=
>
+=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=A0default y<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0config ECDSA_SIGN_TEST<br>
+=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=A0bool &quot;ecdsa-sign-test&quot;<br>
+=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=A0default y<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0config ECDSA_VERIFY_TEST<br>
+=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=A0bool &quot;ecdsa-verify-test&quot;<br=
>
+=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=A0default y<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0config EDDSA_COMPRESS_TEST<br>
+=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=A0bool &quot;eddsa-compress-test&quot;<=
br>
+=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=A0default y<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0config EDDSA_SIGN_TEST<br>
+=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=A0bool &quot;eddsa-sign-test&quot;<br>
+=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=A0default y<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0config EDDSA_VERIFY_TEST<br>
+=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=A0bool &quot;eddsa-verify-test&quot;<br=
>
+=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=A0default y<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0config GOSTDSA_KEYGEN_TEST<br>
+=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=A0bool &quot;gostdsa-keygen-test&quot;<=
br>
+=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=A0default y<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0config GOSTDSA_SIGN_TEST<br>
+=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=A0bool &quot;gostdsa-sign-test&quot;<br=
>
+=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=A0default y<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0config GOSTDSA_VERIFY_TEST<br>
+=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=A0bool &quot;gostdsa-verify-test&quot;<=
br>
+=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=A0default y<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0config GOSTDSA_VKO_TEST<br>
+=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=A0bool &quot;gostdsa-vko-test&quot;<br>
+=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=A0default y<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0endif<br>
+endif<br>
+<br>
+<br>
diff --git a/Makefile.uk b/Makefile.uk<br>
new file mode 100644<br>
index 0000000..666f31b<br>
--- /dev/null<br>
+++ b/Makefile.uk<br>
@@ -0,0 +1,490 @@<br>
+#=C2=A0 SPDX-License-Identifier: BSD-3-Clause<br>
+#<br>
+#=C2=A0 libhogweed Makefile.uk<br>
+#<br>
+#=C2=A0 Authors: Argint Dragos Iulian &lt;<a href=3D"mailto:dragosargint21=
@gmail.com" target=3D"_blank">dragosargint21@gmail.com</a>&gt;<br>
+#<br>
+#=C2=A0 Copyright (c) 2020, University Politehnica of Bucharest. All right=
s reserved.<br>
+#<br>
+#=C2=A0 Redistribution and use in source and binary forms, with or without=
<br>
+#=C2=A0 modification, are permitted provided that the following conditions=
<br>
+#=C2=A0 are met:<br>
+#<br>
+#=C2=A0 1. Redistributions of source code must retain the above copyright<=
br>
+#=C2=A0 =C2=A0 =C2=A0notice, this list of conditions and the following dis=
claimer.<br>
+#=C2=A0 2. Redistributions in binary form must reproduce the above copyrig=
ht<br>
+#=C2=A0 =C2=A0 =C2=A0notice, this list of conditions and the following dis=
claimer in the<br>
+#=C2=A0 =C2=A0 =C2=A0documentation and/or other materials provided with th=
e distribution.<br>
+#=C2=A0 3. Neither the name of the copyright holder nor the names of its<b=
r>
+#=C2=A0 =C2=A0 =C2=A0contributors may be used to endorse or promote produc=
ts derived from<br>
+#=C2=A0 =C2=A0 =C2=A0this software without specific prior written permissi=
on.<br>
+#<br>
+#=C2=A0 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTOR=
S &quot;AS IS&quot;<br>
+#=C2=A0 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED =
TO, THE<br>
+#=C2=A0 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR=
 PURPOSE<br>
+#=C2=A0 ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBU=
TORS BE<br>
+#=C2=A0 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, O=
R<br>
+#=C2=A0 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT =
OF<br>
+#=C2=A0 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BU=
SINESS<br>
+#=C2=A0 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETH=
ER IN<br>
+#=C2=A0 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHER=
WISE)<br>
+#=C2=A0 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISE=
D OF THE<br>
+#=C2=A0 POSSIBILITY OF SUCH DAMAGE.<br>
+#<br>
+<br>
+##########################################################################=
######<br>
+# Library registration<br>
+##########################################################################=
######<br>
+$(eval $(call addlib_s,libhogweed,$(CONFIG_LIBHOGWEED)))<br>
+#$(eval $(call addlib_s,libhogweedglue,$(CONFIG_LIBHOGWEED)))<br>
+<br>
+##########################################################################=
######<br>
+# Original sources<br>
+##########################################################################=
######<br>
+LIBHOGWEED_VERSION=3D3.6<br>
+LIBHOGWEED_URL=3D<a href=3D"https://ftp.gnu.org/gnu/nettle/nettle-$(LIBHOG=
WEED_VERSION).tar.gz" rel=3D"noreferrer" target=3D"_blank">https://ftp.gnu.=
org/gnu/nettle/nettle-$(LIBHOGWEED_VERSION).tar.gz</a><br>
+LIBHOGWEED_PATCHDIR=3D$(LIBHOGWEED_BASE)/patches<br>
+LIBHOGWEED_SUBDIR=3Dnettle-$(LIBHOGWEED_VERSION)<br>
+$(eval $(call fetch,libhogweed,$(LIBHOGWEED_URL)))<br>
+#$(eval $(call patch,libhogweed,$(LIBHOHWEED_PATCHDIR),$(LIBHOGWEED_SUBDIR=
)))<br>
+<br>
+##########################################################################=
######<br>
+# Helpers<br>
+##########################################################################=
######<br>
+LIBHOGWEED_EXTRACTED =3D $(LIBHOGWEED_ORIGIN)/nettle-$(LIBHOGWEED_VERSION)=
<br>
+<br>
+##########################################################################=
######<br>
+# Library includes<br>
+##########################################################################=
######<br>
+LIBHOGWEED_COMMON_INCLUDES-y=C2=A0 =C2=A0 =C2=A0+=3D -I$(LIBHOGWEED_BASE)/=
include<br>
+LIBHOGWEED_COMMON_INCLUDES-y=C2=A0 =C2=A0 =C2=A0+=3D -I$(LIBHOGWEED_EXTRAC=
TED)<br>
+LIBHOGWEED_COMMON_INCLUDES-y=C2=A0 =C2=A0 =C2=A0+=3D -I$(LIBHOGWEED_EXTRAC=
TED)/testsuite<br>
+CINCLUDES-$(CONFIG_LIBHOGWEED)=C2=A0 =C2=A0+=3D $(LIBHOGWEED_COMMON_INCLUD=
ES-y)<br>
+CXXINCLUDES-$(CONFIG_LIBHOGWEED) +=3D $(LIBHOGWEED_COMMON_INCLUDES-y)<br>
+<br>
+LIBHOGWEED_CINCLUDES=C2=A0 =C2=A0+=3D -I$(LIBHOGWEED_EXTRACTED)<br>
+LIBHOGWEED_CXXINCLUDES +=3D -I$(LIBHOGWEED_EXTRACTED)<br>
+<br>
+##########################################################################=
######<br>
+# Global flags<br>
+##########################################################################=
######<br>
+# Suppress flags<br>
+LIBHOGWEED_SUPPRESS_FLAGS +=3D -Wno-unused-parameter \<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 -Wno-unused-variable -Wno-unused-value -Wno-un=
used-function \<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 -Wno-missing-field-initializers -Wno-implicit-=
fallthrough \<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 -Wno-sign-compare<br>
+LIBHOGWEED_CFLAGS-y=C2=A0 =C2=A0+=3D $(LIBHOGWEED_SUPPRESS_FLAGS) \<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 -Wno-pointer-to-int-cast -Wno-int-to-pointer-c=
ast<br>
+LIBHOGWEED_CXXFLAGS-y +=3D $(LIBHOGWEED_SUPPRESS_FLAGS)<br>
+<br>
+# Preprocessing symbols<br>
+LIBHOGWEED_DEFINES=C2=A0 =C2=A0 +=3D -DHAVE_CONFIG_H<br>
+LIBHOGWEED_CFLAGS-y=C2=A0 =C2=A0+=3D $(LIBHOGWEED_DEFINES)<br>
+LIBHOGWEED_CXXFLAGS-y +=3D $(LIBHOGWEED_DEFINES)<br>
+<br>
+##########################################################################=
######<br>
+# HOGWEED code -- bignum<br>
+##########################################################################=
######<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/bignum.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/bignum-random.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/bignum-random-prime.c<br>
+<br>
+##########################################################################=
######<br>
+# HOGWEED code -- yarrow<br>
+##########################################################################=
######<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/yarrow256.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/yarrow_key_event.c<br>
+<br>
+##########################################################################=
######<br>
+# HOGWEED code -- gmp<br>
+##########################################################################=
######<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/mini-gmp.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/gmp-glue.c<br>
+<br>
+##########################################################################=
######<br>
+# HOGWEED code -- aes<br>
+##########################################################################=
######<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/aes-encrypt.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/aes-decrypt.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/aes-encrypt-internal.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/aes-encrypt-table.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/aes-decrypt-internal.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/aes-set-key-internal.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/aes256-set-encrypt-key.c<br=
>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/aes256-set-decrypt-key.c<br=
>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/aes-invert-internal.c<br>
+<br>
+##########################################################################=
######<br>
+# HOGWEED code -- sha<br>
+##########################################################################=
######<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/sha1.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/sha1-meta.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/sha1-compress.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/sha256.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/sha256-meta.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/sha256-compress.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/sha512.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/sha512-meta.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/sha512-compress.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/sha3.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/sha3-permute.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/sha3-256.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/sha384-meta.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/sha224-meta.c<br>
+<br>
+##########################################################################=
######<br>
+# HOGWEED code -- md5<br>
+##########################################################################=
######<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/md5.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/md5-compress.c<br>
+<br>
+##########################################################################=
######<br>
+# HOGWEED code -- write<br>
+##########################################################################=
######<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/write-be32.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/write-le32.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/write-le64.c<br>
+<br>
+##########################################################################=
######<br>
+# HOGWEED code -- buffer<br>
+##########################################################################=
######<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/buffer.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/buffer-init.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/realloc.c<br>
+<br>
+##########################################################################=
######<br>
+# HOGWEED code -- rsa<br>
+##########################################################################=
######<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/rsa.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/rsa-sign.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/rsa-sign-tr.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/rsa-keygen.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/rsa-encrypt.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/rsa-decrypt.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/rsa-decrypt-tr.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/rsa-verify.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/rsa-sha1-sign.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/rsa-sha1-sign-tr.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/rsa-sha1-verify.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/rsa-md5-sign.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/rsa-md5-sign-tr.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/rsa-md5-verify.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/rsa-pss-sha256-sign-tr.c<br=
>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/rsa-pss-sha256-verify.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/rsa-pss-sha512-sign-tr.c<br=
>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/rsa-pss-sha512-verify.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/rsa-pkcs1-sign.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/rsa-pkcs1-sign-tr.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/rsa-pkcs1-verify.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/rsa-sha256-sign.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/rsa-sha256-sign-tr.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/rsa-sha256-verify.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/rsa-sha512-sign.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/rsa-sha512-sign-tr.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/rsa-sha512-verify.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/rsa-sec-decrypt.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/rsa-sec-compute-root.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/rsa2sexp.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/rsa-blind.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/rsa2openpgp.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/pgp-encode.c<br>
+<br>
+##########################################################################=
######<br>
+# HOGWEED code -- pss<br>
+##########################################################################=
######<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/pss.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/pss-mgf1.c<br>
+<br>
+##########################################################################=
######<br>
+# HOGWEED code -- pkcs<br>
+##########################################################################=
######<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/pkcs1.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/pkcs1-encrypt.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/pkcs1-decrypt.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/pkcs1-sec-decrypt.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/pkcs1-rsa-sha1.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/pkcs1-rsa-sha256.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/pkcs1-rsa-sha512.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/pkcs1-rsa-digest.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/pkcs1-rsa-md5.c<br>
+<br>
+##########################################################################=
######<br>
+# HOGWEED code -- dsa<br>
+##########################################################################=
######<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/dsa.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/dsa-sign.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/dsa-hash.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/dsa-verify.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/dsa-keygen.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/dsa-compat.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/dsa-compat-keygen.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/dsa-gen-params.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/dsa-sha1-sign.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/dsa-sha1-verify.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/dsa-sha256-sign.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/dsa-sha256-verify.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/dsa2sexp.c<br>
+<br>
+##########################################################################=
######<br>
+# HOGWEED code -- ecdsa<br>
+##########################################################################=
######<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/ecdsa-keygen.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/ecdsa-sign.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/ecdsa-verify.c<br>
+<br>
+##########################################################################=
######<br>
+# HOGWEED code -- ecc<br>
+##########################################################################=
######<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/ecc-a-to-j.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/ecc-add-eh.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/ecc-add-ehh.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/ecc-add-jja.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/ecc-add-jjj.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/ecc-add-th.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/ecc-add-thh.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/ecc-curve25519-modp.s<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/ecc-curve25519.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/ecc-curve448-modp.s<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/ecc-curve448.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/ecc-dup-eh.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/ecc-dup-jj.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/ecc-dup-th.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/ecc-ecdsa-sign.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/ecc-ecdsa-verify.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/ecc-eh-to-a.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/ecc-gost-gc256b.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/ecc-gost-gc512a.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/ecc-gostdsa-sign.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/ecc-gostdsa-verify.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/ecc-hash.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/ecc-j-to-a.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/ecc-mod-arith.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/ecc-mod-inv.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/ecc-mod.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/ecc-mul-a-eh.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/ecc-mul-a.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/ecc-mul-g-eh.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/ecc-mul-g.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/ecc-mul-m.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/ecc-point.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/ecc-random.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/ecc-scalar.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/ecc-secp192r1-modp.s<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/ecc-secp192r1.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/ecc-secp224r1-modp.s<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/ecc-secp224r1.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/ecc-secp256r1-redc.s<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/ecc-secp256r1.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/ecc-secp384r1-modp.s<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/ecc-secp384r1.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/ecc-secp521r1-modp.s<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/ecc-secp521r1.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/ecc-size.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/sec-add-1.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/sec-tabselect.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/cnd-copy.c<br>
+<br>
+##########################################################################=
######<br>
+# HOGWEED code -- curve<br>
+##########################################################################=
######<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/curve25519-mul.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/curve25519-mul-g.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/curve25519-eh-to-x.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/curve448-mul.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/curve448-mul-g.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/curve448-eh-to-x.c<br>
+<br>
+##########################################################################=
######<br>
+# HOGWEED code -- gostdsa<br>
+##########################################################################=
######<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/gostdsa-sign.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/gostdsa-verify.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/gostdsa-vko.c<br>
+<br>
+##########################################################################=
######<br>
+# HOGWEED code -- eddsa<br>
+##########################################################################=
######<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/eddsa-compress.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/eddsa-decompress.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/eddsa-sign.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/eddsa-verify.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/eddsa-expand.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/eddsa-hash.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/eddsa-pubkey.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/ed25519-sha512.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/ed448-shake256.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/shake256.c<br>
+<br>
+##########################################################################=
######<br>
+# HOGWEED code -- sexp<br>
+##########################################################################=
######<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/sexp.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/sexp2rsa.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/sexp-format.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/sexp2bignum.c<br>
+#LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/sexp-transport-format.c<br=
>
+<br>
+##########################################################################=
######<br>
+# HOGWEED code -- hex encoding<br>
+##########################################################################=
######<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/base16-encode.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/base16-decode.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/base64-encode.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/base64-decode.c<br>
+<br>
+##########################################################################=
######<br>
+# HOGWEED code -- miscellaneous<br>
+##########################################################################=
######<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/knuth-lfib.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/hmac.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/hmac-sha1.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/memxor.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/memxor3.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/cnd-memcpy.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/memeql-sec.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/cbc.c<br>
+<br>
+##########################################################################=
######<br>
+# HOGWEED code -- tests<br>
+##########################################################################=
######<br>
+LIBHOGWEED_SRCS-$(CONFIG_TESTSUITE) +=3D $(LIBHOGWEED_BASE)/testutils_glue=
.c<br>
+ifeq ($(CONFIG_RSA_COMPUTE_ROOT_TEST),y)<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/testsuite/rsa-compute-root-=
test.c<br>
+LIBHOGWEED_RSA-COMPUTE-ROOT-TEST_FLAGS-y +=3D -Dtest_main=3Drsa_compute_ro=
ot_test<br>
+endif<br>
+ifeq ($(CONFIG_RSA_ENCRYPT_TEST),y)<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/testsuite/rsa-encrypt-test.=
c<br>
+LIBHOGWEED_RSA-ENCRYPT-TEST_FLAGS-y +=3D -Dtest_main=3Drsa_encrypt_test<br=
>
+endif<br>
+ifeq ($(CONFIG_RSA_KEYGEN_TEST),y)<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/testsuite/rsa-keygen-test.c=
<br>
+LIBHOGWEED_RSA-KEYGEN-TEST_FLAGS-y +=3D -Dtest_main=3Drsa_keygen_test<br>
+endif<br>
+ifeq ($(CONFIG_RSA_PSS_SIGN_TR_TEST),y)<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/testsuite/rsa-pss-sign-tr-t=
est.c<br>
+LIBHOGWEED_RSA-PSS-SIGN-TR-TEST_FLAGS-y +=3D -Dtest_main=3Drsa_pss_sign_tr=
_test<br>
+endif<br>
+ifeq ($(CONFIG_RSA_SEC_DECRYPT_TEST),y)<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/testsuite/rsa-sec-decrypt-t=
est.c<br>
+LIBHOGWEED_RSA-SEC-DECRYPT-TEST_FLAGS-y +=3D -Dtest_main=3Drsa_sec_decrypt=
_test<br>
+endif<br>
+ifeq ($(CONFIG_RSA_SIGN_TR_TEST),y)<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/testsuite/rsa-sign-tr-test.=
c<br>
+LIBHOGWEED_RSA-SIGN-TR-TEST_FLAGS-y +=3D -Dtest_main=3Drsa_sign_tr_test<br=
>
+endif<br>
+ifeq ($(CONFIG_RSA_TEST),y)<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/testsuite/rsa-test.c<br>
+LIBHOGWEED_RSA-TEST_FLAGS-y +=3D -Dtest_main=3Drsa_test<br>
+endif<br>
+ifeq ($(CONFIG_RSA2SEXP_TEST),y)<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/testsuite/rsa2sexp-test.c<b=
r>
+LIBHOGWEED_RSA2SEXP-TEST_FLAGS-y +=3D -Dtest_main=3Drsa2sexp_test<br>
+endif<br>
+ifeq ($(CONFIG_SEXP2RSA_TEST),y)<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/testsuite/sexp2rsa-test.c<b=
r>
+LIBHOGWEED_SEXP2RSA-TEST_FLAGS-y +=3D -Dtest_main=3Dsexp2rsa_test<br>
+endif<br>
+ifeq ($(CONFIG_CURVE25519_DH_TEST),y)<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/testsuite/curve25519-dh-tes=
t.c<br>
+LIBHOGWEED_CURVE25519-DH-TEST_FLAGS-y +=3D -Dtest_main=3Dcurve25519_dh_tes=
t<br>
+endif<br>
+ifeq ($(CONFIG_CURVE448_DH_TEST),y)<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/testsuite/curve448-dh-test.=
c<br>
+LIBHOGWEED_CURVE448-DH-TEST_FLAGS-y +=3D -Dtest_main=3Dcurve448_dh_test<br=
>
+endif<br>
+ifeq ($(CONFIG_DSA_KEYGEN_TEST),y)<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/testsuite/dsa-keygen-test.c=
<br>
+LIBHOGWEED_DSA-KEYGEN-TEST_FLAGS-y +=3D -Dtest_main=3Ddsa_keygen_test<br>
+endif<br>
+ifeq ($(CONFIG_DSA_TEST),y)<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/testsuite/dsa-test.c<br>
+LIBHOGWEED_DSA-TEST_FLAGS-y +=3D -Dtest_main=3Ddsa_test<br>
+endif<br>
+ifeq ($(CONFIG_ECDSA_KEYGEN_TEST),y)<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/testsuite/ecdsa-keygen-test=
.c<br>
+LIBHOGWEED_ECDSA-KEYGEN-TEST_FLAGS-y +=3D -Dtest_main=3Decdsa_keygen_test<=
br>
+endif<br>
+ifeq ($(CONFIG_ECDSA_SIGN_TEST),y)<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/testsuite/ecdsa-sign-test.c=
<br>
+LIBHOGWEED_ECDSA-SIGN-TEST_FLAGS-y +=3D -Dtest_main=3Decdsa_sign_test<br>
+endif<br>
+ifeq ($(CONFIG_ECDSA_VERIFY_TEST),y)<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/testsuite/ecdsa-verify-test=
.c<br>
+LIBHOGWEED_ECDSA-VERIFY-TEST_FLAGS-y +=3D -Dtest_main=3Decdsa_verify_test<=
br>
+endif<br>
+ifeq ($(CONFIG_EDDSA_COMPRESS_TEST),y)<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/testsuite/eddsa-compress-te=
st.c<br>
+LIBHOGWEED_EDDSA-COMPRESS-TEST_FLAGS-y +=3D -Dtest_main=3Deddsa_compress_t=
est<br>
+endif<br>
+ifeq ($(CONFIG_EDDSA_SIGN_TEST),y)<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/testsuite/eddsa-sign-test.c=
<br>
+LIBHOGWEED_EDDSA-SIGN-TEST_FLAGS-y +=3D -Dtest_main=3Deddsa_sign_test<br>
+endif<br>
+ifeq ($(CONFIG_EDDSA_VERIFY_TEST),y)<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/testsuite/eddsa-verify-test=
.c<br>
+LIBHOGWEED_EDDSA-VERIFY-TEST_FLAGS-y +=3D -Dtest_main=3Deddsa_verify_test<=
br>
+endif<br>
+ifeq ($(CONFIG_GOSTDSA_KEYGEN_TEST),y)<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/testsuite/gostdsa-keygen-te=
st.c<br>
+LIBHOGWEED_GOSTDSA-KEYGEN-TEST_FLAGS-y +=3D -Dtest_main=3Dgostdsa_keygen_t=
est<br>
+endif<br>
+ifeq ($(CONFIG_GOSTDSA_SIGN_TEST),y)<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/testsuite/gostdsa-sign-test=
.c<br>
+LIBHOGWEED_GOSTDSA-SIGN-TEST_FLAGS-y +=3D -Dtest_main=3Dgostdsa_sign_test<=
br>
+endif<br>
+ifeq ($(CONFIG_GOSTDSA_VERIFY_TEST),y)<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/testsuite/gostdsa-verify-te=
st.c<br>
+LIBHOGWEED_GOSTDSA-VERIFY-TEST_FLAGS-y +=3D -Dtest_main=3Dgostdsa_verify_t=
est<br>
+endif<br>
+ifeq ($(CONFIG_GOSTDSA_VKO_TEST),y)<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/testsuite/gostdsa-vko-test.=
c<br>
+LIBHOGWEED_GOSTDSA-VKO-TEST_FLAGS-y +=3D -Dtest_main=3Dgostdsa_vko_test<br=
>
+endif<br>
+<br>
+<br>
+<br>
+##########################################################################=
######<br>
+# HOGWEED prepare<br>
+##########################################################################=
######<br>
+# Run ./configure<br>
+$(LIBHOGWEED_EXTRACTED)/config.h: $(LIBHOGWEED_BUILD)/.origin<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0$(call verbose_cmd,CONFIG,libhogweed: $(notdir =
$@), \<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 cd $(LIBHOGWEED_EXTRACTED) &amp;&amp; ./config=
ure --enable-mini-gmp \<br>
+=C2=A0 =C2=A0 )<br>
+<br>
+# Generate auxiliar files using the original building system<br>
+$(LIBHOGWEED_EXTRACTED)/make_auxiliar: $(LIBHOGWEED_BUILD)/.origin<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0$(call verbose_cmd,CONFIG,libhogweed: $(notdir =
$@), \<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 cd $(LIBHOGWEED_EXTRACTED) &amp;&amp; \<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 make ecc-secp192r1.h &amp;&amp; \<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 make ecc-secp224r1.h &amp;&amp; \<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 make ecc-secp256r1.h &amp;&amp; \<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0make ecc-secp384r1.=
h &amp;&amp; \<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 make ecc-secp521r1.h &amp;&amp; \<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 make ecc-curve25519.h &amp;&amp; \<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 make ecc-curve448.h &amp;&amp; \<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 make ecc-gost-gc256b.h &amp;&amp; \<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 make ecc-gost-gc512a.h &amp;&amp; \<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 /usr/bin/m4 ./asm.m4 machine.m4 config.m4 ecc-=
curve25519-modp.asm \<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0&gt; ecc-curve25519=
-modp.s &amp;&amp; \<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 /usr/bin/m4 ./asm.m4 machine.m4 config.m4 ecc-=
curve448-modp.asm \<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0&gt; ecc-curve448-m=
odp.s &amp;&amp; \<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 /usr/bin/m4 ./asm.m4 machine.m4 config.m4 ecc-=
secp192r1-modp.asm \<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0&gt; ecc-secp192r1-=
modp.s &amp;&amp; \<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 /usr/bin/m4 ./asm.m4 machine.m4 config.m4 ecc-=
secp224r1-modp.asm \<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 &gt; ecc-secp224r1-modp.s &amp;&=
amp; \<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 /usr/bin/m4 ./asm.m4 machine.m4 config.m4 ecc-=
secp256r1-redc.asm \<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0&gt; ecc-secp256r1-=
redc.s &amp;&amp; \<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 /usr/bin/m4 ./asm.m4 machine.m4 config.m4 ecc-=
secp384r1-modp.asm \<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0&gt; ecc-secp384r1-=
modp.s &amp;&amp; \<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 /usr/bin/m4 ./asm.m4 machine.m4 config.m4 ecc-=
secp521r1-modp.asm \<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0&gt; ecc-secp521r1-=
modp.s &amp;&amp; \<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 echo &quot;done&quot; &gt; make_auxiliar \<br>
+=C2=A0 =C2=A0 )<br>
+<br>
+LIBHOGWEED_PREPARED_DEPS =3D $(LIBHOGWEED_EXTRACTED)/config.h \<br>
+=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 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0$(LIBHOGWEED_EXTRACTED)/mak=
e_auxiliar<br>
+<br>
+$(LIBHOGWEED_BUILD)/.prepared: $(LIBHOGWEED_PREPARED_DEPS)<br>
+<br>
+UK_PREPARE +=3D $(LIBHOGWEED_BUILD)/.prepared<br>
-- <br>
2.17.1<br>
<br>
</blockquote></div>

--0000000000001abe9f05b5e01b3a--


From minios-devel-bounces@lists.xenproject.org Mon Dec 07 13:52:29 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Mon, 07 Dec 2020 13:52:29 +0000
Received: from list by lists.xenproject.org with outflank-mailman.46601.82687 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1kmGwG-0000s8-Ng; Mon, 07 Dec 2020 13:52:28 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 46601.82687; Mon, 07 Dec 2020 13:52: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 1kmGwG-0000s1-Ki; Mon, 07 Dec 2020 13:52:28 +0000
Received: by outflank-mailman (input) for mailman id 46601;
 Mon, 07 Dec 2020 13:52:27 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=NPkr=FL=gmail.com=lrbarbulescu@srs-us1.protection.inumbo.net>)
 id 1kmGwF-0000rw-Op
 for minios-devel@lists.xen.org; Mon, 07 Dec 2020 13:52:27 +0000
Received: from mail-lj1-x229.google.com (unknown [2a00:1450:4864:20::229])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id f7f8ed9e-9fdb-4364-a638-04d03ed1f5ae;
 Mon, 07 Dec 2020 13:52:23 +0000 (UTC)
Received: by mail-lj1-x229.google.com with SMTP id t22so15053909ljk.0
 for <minios-devel@lists.xen.org>; Mon, 07 Dec 2020 05:52:23 -0800 (PST)
X-BeenThere: minios-devel@lists.xenproject.org
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
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: f7f8ed9e-9fdb-4364-a638-04d03ed1f5ae
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=J0Ih1nUrE9A4XPz2XwDkBWNdvK0mW6iD4zzwn8ULCJw=;
        b=PVl43NcDcZ2dHjxvqoKOowKt/zKosULftmdBtJb4LIRo7900EbdOtErTMeAP+3lEpk
         ad/KIKqRnARLALRwyM4la+0U0tX/wOcFKamh1mzrgjeTQmoSUxh0Yy6lMX9rE7SsVNLb
         Dy8J3hbIetagOyPzFj30Ixkk/ZUIr/jCmbn2mCU7GI/hE3UIqDpxbMmm2YDAe9piy81s
         kceDU7YB2YN1UTUjbHWtvJ9M0nOT07xaFCqD6OIhw34vdvSvrvVCLZmSOZKbTbBo+UrU
         iQnwOcaX8++lmYEc24qG7CnJPvDF4A9zj7q+smVyb4WBNvT1eZAmotG0mpnQmYQCdY87
         88Yw==
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=J0Ih1nUrE9A4XPz2XwDkBWNdvK0mW6iD4zzwn8ULCJw=;
        b=SE7xTtWQRkCAvnlQHjiQ+IPTryexSBv0cWivzDp/7XBn7LcL9Up1aHMiWN6gOa2S8R
         G0An48LSos5iOQ5+MCex1wwOX+OYBehH6ogutbNtAZn+a+z04TtPt6rb0HVi2CrKC46j
         K3vO48XeSC+6dJNBMA01mG6b7J2Z9WOtmQDcI+DqR60cWUYQdwpKvRBUyxuahJpJXqHY
         WpR3Ou9zBHR4VJgDwjf5yN2vO8EoXej6GgdhaoijVssUUwNv6ed0XvvvgbX8voXpRTyX
         r8Q7D1/USnD0bKAMmFbqFMc0txH4dkkDIbWW4/he7kw1eD6qbVj+mWG06siSDm0FLIyi
         eP9Q==
X-Gm-Message-State: AOAM533SLTu/rzsyIB/p0xj6tFyB2DxwD0WJWhwKOSIgGcilPUL6PJKJ
	RG3JemSHw3DA9bSZEiDbcGQDpEK4iM/XtkUQoN0=
X-Google-Smtp-Source: ABdhPJx1eRTTQLACPMTBH1DNNMuA9kuBdth+9WZNNEB1+cvP0cOjfEqlRBf0B2kUb9iyWPB5OtAcXgq6Yzp8RspQeIE=
X-Received: by 2002:a2e:9807:: with SMTP id a7mr8974522ljj.449.1607349142285;
 Mon, 07 Dec 2020 05:52:22 -0800 (PST)
MIME-Version: 1.0
References: <cover.1607030251.git.dragosargint21@gmail.com> <df5df104a8f99e4803fd2065f0338ee9a7fa6e2c.1607030251.git.dragosargint21@gmail.com>
In-Reply-To: <df5df104a8f99e4803fd2065f0338ee9a7fa6e2c.1607030251.git.dragosargint21@gmail.com>
From: Laurentiu Barbulescu <lrbarbulescu@gmail.com>
Date: Mon, 7 Dec 2020 15:52:10 +0200
Message-ID: <CAMpNDK=0mLmJ8FTt_xBsx6+_zczCW0Z6xR1-ZyZcx=8F1ipcfA@mail.gmail.com>
Subject: Re: [UNIKRAFT/LIBHOGWEED v3 3/3] Add glue code
To: ARGINT DRAGOS IULIAN <dragosargint21@gmail.com>
Cc: minios-devel@lists.xen.org, felipe.huici@neclab.eu
Content-Type: multipart/alternative; boundary="000000000000a7f34a05b5e022ad"

--000000000000a7f34a05b5e022ad
Content-Type: text/plain; charset="UTF-8"

Hi Dragos,

All good for now, but we have to keep in mind to assure the concurrency of
libhogweed and the main nettle library, when it will be ported.

Reviewed-by: Laurentiu Barbulescu <lrbarbulescu@gmail.com>

On Thu, Dec 3, 2020 at 11:21 PM ARGINT DRAGOS IULIAN <
dragosargint21@gmail.com> wrote:

> Signed-off-by: ARGINT DRAGOS IULIAN <dragosargint21@gmail.com>
> ---
>  include/testutils_glue.h |  26 ++
>  testutils_glue.c         | 808 +++++++++++++++++++++++++++++++++++++++
>  2 files changed, 834 insertions(+)
>  create mode 100644 include/testutils_glue.h
>  create mode 100644 testutils_glue.c
>
> diff --git a/include/testutils_glue.h b/include/testutils_glue.h
> new file mode 100644
> index 0000000..6213879
> --- /dev/null
> +++ b/include/testutils_glue.h
> @@ -0,0 +1,26 @@
> +void rsa_compute_root_test(void);
> +void rsa_compute_root_test(void);
> +void rsa_encrypt_test(void);
> +void rsa_keygen_test(void);
> +void rsa_pss_sign_tr_test(void);
> +void rsa_sec_decrypt_test(void);
> +void rsa_sign_tr_test(void);
> +void rsa_test(void);
> +void rsa2sexp_test(void);
> +void sexp2rsa_test(void);
> +void curve25519_dh_test(void);
> +void curve448_dh_test(void);
> +void dsa_keygen_test(void);
> +void dsa_test(void);
> +void ecdsa_keygen_test(void);
> +void ecdsa_sign_test(void);
> +void ecdsa_verify_test(void);
> +void eddsa_compress_test(void);
> +void eddsa_sign_test(void);
> +void eddsa_verify_test(void);
> +void gostdsa_keygen_test(void);
> +void gostdsa_sign_test(void);
> +void gostdsa_verify_test(void);
> +void gostdsa_vko_test(void);
> +int run_all_libhogweed_tests(int v);
> +
> diff --git a/testutils_glue.c b/testutils_glue.c
> new file mode 100644
> index 0000000..1832d92
> --- /dev/null
> +++ b/testutils_glue.c
> @@ -0,0 +1,808 @@
> +/* testutils_glue.c */
> +
> +#include "testutils.h"
> +#include "testutils_glue.h"
> +#include "base16.h"
> +#include "cbc.h"
> +#include "cfb.h"
> +#include "ctr.h"
> +#include "knuth-lfib.h"
> +#include "macros.h"
> +#include "nettle-internal.h"
> +#include "uk/config.h"
> +#include <assert.h>
> +#include <ctype.h>
> +
> +void
> +die(const char *format, ...)
> +{
> +  va_list args;
> +  va_start(args, format);
> +  vfprintf(stderr, format, args);
> +  va_end(args);
> +
> +  abort ();
> +}
> +
> +void *
> +xalloc(size_t size)
> +{
> +  void *p = malloc(size);
> +  if (size && !p)
> +    {
> +      fprintf(stderr, "Virtual memory exhausted.\n");
> +      abort();
> +    }
> +
> +  return p;
> +}
> +
> +static struct tstring *tstring_first = NULL;
> +
> +struct tstring *
> +tstring_alloc (size_t length)
> +{
> +  struct tstring *s = xalloc(sizeof(struct tstring) + length);
> +  s->length = length;
> +  s->next = tstring_first;
> +  /* NUL-terminate, for convenience. */
> +  s->data[length] = '\0';
> +  tstring_first = s;
> +  return s;
> +}
> +
> +void
> +tstring_clear(void)
> +{
> +  while (tstring_first)
> +    {
> +      struct tstring *s = tstring_first;
> +      tstring_first = s->next;
> +      free(s);
> +    }
> +}
> +
> +struct tstring *
> +tstring_data(size_t length, const uint8_t *data)
> +{
> +  struct tstring *s = tstring_alloc (length);
> +  memcpy (s->data, data, length);
> +  return s;
> +}
> +
> +struct tstring *
> +tstring_hex(const char *hex)
> +{
> +  struct base16_decode_ctx ctx;
> +  struct tstring *s;
> +  size_t length = strlen(hex);
> +
> +  s = tstring_alloc(BASE16_DECODE_LENGTH (length));
> +  base16_decode_init (&ctx);
> +  ASSERT (base16_decode_update (&ctx, &s->length, s->data,
> +                               length, hex));
> +  ASSERT (base16_decode_final (&ctx));
> +
> +  return s;
> +}
> +
> +void
> +tstring_print_hex(const struct tstring *s)
> +{
> +  print_hex (s->length, s->data);
> +}
> +
> +void
> +print_hex(size_t length, const uint8_t *data)
> +{
> +  size_t i;
> +
> +  for (i = 0; i < length; i++)
> +    {
> +      switch (i % 16)
> +       {
> +       default:
> +         break;
> +       case 0:
> +         printf("\n");
> +         break;
> +       case 8:
> +         printf(" ");
> +         break;
> +       }
> +      printf("%02x", data[i]);
> +    }
> +  printf("\n");
> +}
> +
> +int verbose = 0;
> +
> +void
> +mpn_out_str (FILE *f, int base, const mp_limb_t *xp, mp_size_t xn)
> +{
> +  mpz_t x;
> +  mpz_out_str (f, base, mpz_roinit_n (x, xp, xn));
> +}
> +
> +#if NETTLE_USE_MINI_GMP
> +void
> +gmp_randinit_default (struct knuth_lfib_ctx *ctx)
> +{
> +  knuth_lfib_init (ctx, 17);
> +}
> +void
> +mpz_urandomb (mpz_t r, struct knuth_lfib_ctx *ctx, mp_bitcnt_t bits)
> +{
> +  size_t bytes = (bits+7)/8;
> +  uint8_t *buf = xalloc (bytes);
> +
> +  knuth_lfib_random (ctx, bytes, buf);
> +  buf[0] &= 0xff >> (8*bytes - bits);
> +  nettle_mpz_set_str_256_u (r, bytes, buf);
> +  free (buf);
> +}
> +#endif /* NETTLE_USE_MINI_GMP */
> +
> +mp_limb_t *
> +xalloc_limbs (mp_size_t n)
> +{
> +  return xalloc (n * sizeof (mp_limb_t));
> +}
> +
> +/* Expects local variables pub, key, rstate, digest, signature */
> +#define SIGN(hash, msg, expected) do { \
> +  hash##_update(&hash, LDATA(msg));                                    \
> +  ASSERT(rsa_##hash##_sign(key, &hash, signature));                    \
> +  if (verbose)                                                         \
> +    {                                                                  \
> +      fprintf(stderr, "rsa-%s signature: ", #hash);                    \
> +      mpz_out_str(stderr, 16, signature);                              \
> +      fprintf(stderr, "\n");                                           \
> +    }                                                                  \
> +  ASSERT(mpz_cmp (signature, expected) == 0);                          \
> +                                                                       \
> +  hash##_update(&hash, LDATA(msg));                                    \
> +  ASSERT(rsa_##hash##_sign_tr(pub, key, &rstate,                       \
> +                             (nettle_random_func *) knuth_lfib_random, \
> +                             &hash, signature));                       \
> +  ASSERT(mpz_cmp (signature, expected) == 0);                          \
> +                                                                       \
> +  hash##_update(&hash, LDATA(msg));                                    \
> +  hash##_digest(&hash, sizeof(digest), digest);
>       \
> +  ASSERT(rsa_##hash##_sign_digest(key, digest, signature));            \
> +  ASSERT(mpz_cmp (signature, expected) == 0);                          \
> +                                                                       \
> +  ASSERT(rsa_##hash##_sign_digest_tr(pub, key, &rstate,
>       \
> +                                    (nettle_random_func
> *)knuth_lfib_random, \
> +                                    digest, signature));               \
> +  ASSERT(mpz_cmp (signature, expected) == 0);                          \
> +} while(0)
> +
> +#define VERIFY(key, hash, msg, signature) (    \
> +  hash##_update(&hash, LDATA(msg)),            \
> +  rsa_##hash##_verify(key, &hash, signature)   \
> +)
> +
> +void
> +test_rsa_set_key_1(struct rsa_public_key *pub,
> +                  struct rsa_private_key *key)
> +{
> +  /* Initialize key pair for test programs */
> +  /* 1000-bit key, generated by
> +   *
> +   *   lsh-keygen -a rsa -l 1000 -f advanced-hex
> +   *
> +   * (private-key (rsa-pkcs1
> +   *        (n #69abd505285af665 36ddc7c8f027e6f0 ed435d6748b16088
> +   *            4fd60842b3a8d7fb bd8a3c98f0cc50ae 4f6a9f7dd73122cc
> +   *            ec8afa3f77134406 f53721973115fc2d 8cfbba23b145f28d
> +   *            84f81d3b6ae8ce1e 2850580c026e809b cfbb52566ea3a3b3
> +   *            df7edf52971872a7 e35c1451b8636d22 279a8fb299368238
> +   *            e545fbb4cf#)
> +   *        (e #0db2ad57#)
> +   *        (d #3240a56f4cd0dcc2 4a413eb4ea545259 5c83d771a1c2ba7b
> +   *            ec47c5b43eb4b374 09bd2aa1e236dd86 481eb1768811412f
> +   *            f8d91be3545912af b55c014cb55ceac6 54216af3b85d5c4f
> +   *            4a32894e3b5dfcde 5b2875aa4dc8d9a8 6afd0ca92ef50d35
> +   *            bd09f1c47efb4c8d c631e07698d362aa 4a83fd304e66d6c5
> +   *            468863c307#)
> +   *        (p #0a66399919be4b4d e5a78c5ea5c85bf9 aba8c013cb4a8732
> +   *            14557a12bd67711e bb4073fd39ad9a86 f4e80253ad809e5b
> +   *            f2fad3bc37f6f013 273c9552c9f489#)
> +   *        (q #0a294f069f118625 f5eae2538db9338c 776a298eae953329
> +   *            9fd1eed4eba04e82 b2593bc98ba8db27 de034da7daaea795
> +   *            2d55b07b5f9a5875 d1ca5f6dcab897#)
> +   *        (a #011b6c48eb592eee e85d1bb35cfb6e07 344ea0b5e5f03a28
> +   *            5b405396cbc78c5c 868e961db160ba8d 4b984250930cf79a
> +   *            1bf8a9f28963de53 128aa7d690eb87#)
> +   *        (b #0409ecf3d2557c88 214f1af5e1f17853 d8b2d63782fa5628
> +   *            60cf579b0833b7ff 5c0529f2a97c6452 2fa1a8878a9635ab
> +   *            ce56debf431bdec2 70b308fa5bf387#)
> +   *        (c #04e103ee925cb5e6 6653949fa5e1a462 c9e65e1adcd60058
> +   *            e2df9607cee95fa8 daec7a389a7d9afc 8dd21fef9d83805a
> +   *            40d46f49676a2f6b 2926f70c572c00#)))
> +   */
> +
> +  mpz_set_str(pub->n,
> +             "69abd505285af665" "36ddc7c8f027e6f0" "ed435d6748b16088"
> +             "4fd60842b3a8d7fb" "bd8a3c98f0cc50ae" "4f6a9f7dd73122cc"
> +             "ec8afa3f77134406" "f53721973115fc2d" "8cfbba23b145f28d"
> +             "84f81d3b6ae8ce1e" "2850580c026e809b" "cfbb52566ea3a3b3"
> +             "df7edf52971872a7" "e35c1451b8636d22" "279a8fb299368238"
> +             "e545fbb4cf", 16);
> +  mpz_set_str(pub->e, "0db2ad57", 16);
> +
> +  ASSERT (rsa_public_key_prepare(pub));
> +
> +  /* d is not used */
> +#if 0
> +  mpz_set_str(key->d,
> +             "3240a56f4cd0dcc2" "4a413eb4ea545259" "5c83d771a1c2ba7b"
> +             "ec47c5b43eb4b374" "09bd2aa1e236dd86" "481eb1768811412f"
> +             "f8d91be3545912af" "b55c014cb55ceac6" "54216af3b85d5c4f"
> +             "4a32894e3b5dfcde" "5b2875aa4dc8d9a8" "6afd0ca92ef50d35"
> +             "bd09f1c47efb4c8d" "c631e07698d362aa" "4a83fd304e66d6c5"
> +             "468863c307", 16);
> +#endif
> +
> +  mpz_set_str(key->p,
> +             "0a66399919be4b4d" "e5a78c5ea5c85bf9" "aba8c013cb4a8732"
> +             "14557a12bd67711e" "bb4073fd39ad9a86" "f4e80253ad809e5b"
> +             "f2fad3bc37f6f013" "273c9552c9f489", 16);
> +
> +  mpz_set_str(key->q,
> +             "0a294f069f118625" "f5eae2538db9338c" "776a298eae953329"
> +             "9fd1eed4eba04e82" "b2593bc98ba8db27" "de034da7daaea795"
> +             "2d55b07b5f9a5875" "d1ca5f6dcab897", 16);
> +
> +  mpz_set_str(key->a,
> +             "011b6c48eb592eee" "e85d1bb35cfb6e07" "344ea0b5e5f03a28"
> +             "5b405396cbc78c5c" "868e961db160ba8d" "4b984250930cf79a"
> +             "1bf8a9f28963de53" "128aa7d690eb87", 16);
> +
> +  mpz_set_str(key->b,
> +             "0409ecf3d2557c88" "214f1af5e1f17853" "d8b2d63782fa5628"
> +             "60cf579b0833b7ff" "5c0529f2a97c6452" "2fa1a8878a9635ab"
> +             "ce56debf431bdec2" "70b308fa5bf387", 16);
> +
> +  mpz_set_str(key->c,
> +             "04e103ee925cb5e6" "6653949fa5e1a462" "c9e65e1adcd60058"
> +             "e2df9607cee95fa8" "daec7a389a7d9afc" "8dd21fef9d83805a"
> +             "40d46f49676a2f6b" "2926f70c572c00", 16);
> +
> +  ASSERT (rsa_private_key_prepare(key));
> +  ASSERT (pub->size == key->size);
> +}
> +
> +void
> +test_rsa_md5(struct rsa_public_key *pub,
> +            struct rsa_private_key *key,
> +            mpz_t expected)
> +{
> +  struct md5_ctx md5;
> +  struct knuth_lfib_ctx rstate;
> +  uint8_t digest[MD5_DIGEST_SIZE];
> +  mpz_t signature;
> +
> +  md5_init(&md5);
> +  mpz_init(signature);
> +  knuth_lfib_init (&rstate, 15);
> +
> +  SIGN(md5, "The magic words are squeamish ossifrage", expected);
> +
> +  /* Try bad data */
> +  ASSERT (!VERIFY(pub, md5,
> +                 "The magick words are squeamish ossifrage", signature));
> +
> +  /* Try correct data */
> +  ASSERT (VERIFY(pub, md5,
> +                "The magic words are squeamish ossifrage", signature));
> +
> +  /* Try bad signature */
> +  mpz_combit(signature, 17);
> +  ASSERT (!VERIFY(pub, md5,
> +                 "The magic words are squeamish ossifrage", signature));
> +
> +  mpz_clear(signature);
> +}
> +
> +void
> +test_rsa_sha1(struct rsa_public_key *pub,
> +             struct rsa_private_key *key,
> +             mpz_t expected)
> +{
> +  struct sha1_ctx sha1;
> +  struct knuth_lfib_ctx rstate;
> +  uint8_t digest[SHA1_DIGEST_SIZE];
> +  mpz_t signature;
> +
> +  sha1_init(&sha1);
> +  mpz_init(signature);
> +  knuth_lfib_init (&rstate, 16);
> +
> +  SIGN(sha1, "The magic words are squeamish ossifrage", expected);
> +
> +  /* Try bad data */
> +  ASSERT (!VERIFY(pub, sha1,
> +                 "The magick words are squeamish ossifrage", signature));
> +
> +  /* Try correct data */
> +  ASSERT (VERIFY(pub, sha1,
> +                "The magic words are squeamish ossifrage", signature));
> +
> +  /* Try bad signature */
> +  mpz_combit(signature, 17);
> +  ASSERT (!VERIFY(pub, sha1,
> +                 "The magic words are squeamish ossifrage", signature));
> +
> +  mpz_clear(signature);
> +}
> +
> +void
> +test_rsa_sha256(struct rsa_public_key *pub,
> +               struct rsa_private_key *key,
> +               mpz_t expected)
> +{
> +  struct sha256_ctx sha256;
> +  struct knuth_lfib_ctx rstate;
> +  uint8_t digest[SHA256_DIGEST_SIZE];
> +  mpz_t signature;
> +
> +  sha256_init(&sha256);
> +  mpz_init(signature);
> +  knuth_lfib_init (&rstate, 17);
> +
> +  SIGN(sha256, "The magic words are squeamish ossifrage", expected);
> +
> +  /* Try bad data */
> +  ASSERT (!VERIFY(pub, sha256,
> +                 "The magick words are squeamish ossifrage", signature));
> +
> +  /* Try correct data */
> +  ASSERT (VERIFY(pub, sha256,
> +                "The magic words are squeamish ossifrage", signature));
> +
> +  /* Try bad signature */
> +  mpz_combit(signature, 17);
> +  ASSERT (!VERIFY(pub, sha256,
> +                 "The magic words are squeamish ossifrage", signature));
> +
> +  mpz_clear(signature);
> +}
> +
> +void
> +test_rsa_sha512(struct rsa_public_key *pub,
> +               struct rsa_private_key *key,
> +               mpz_t expected)
> +{
> +  struct sha512_ctx sha512;
> +  struct knuth_lfib_ctx rstate;
> +  uint8_t digest[SHA512_DIGEST_SIZE];
> +  mpz_t signature;
> +
> +  sha512_init(&sha512);
> +  mpz_init(signature);
> +  knuth_lfib_init (&rstate, 18);
> +
> +  SIGN(sha512, "The magic words are squeamish ossifrage", expected);
> +
> +  /* Try bad data */
> +  ASSERT (!VERIFY(pub, sha512,
> +                 "The magick words are squeamish ossifrage", signature));
> +
> +  /* Try correct data */
> +  ASSERT (VERIFY(pub, sha512,
> +                "The magic words are squeamish ossifrage", signature));
> +
> +  /* Try bad signature */
> +  mpz_combit(signature, 17);
> +  ASSERT (!VERIFY(pub, sha512,
> +                 "The magic words are squeamish ossifrage", signature));
> +
> +  mpz_clear(signature);
> +}
> +
> +#undef SIGN
> +#undef VERIFY
> +
> +void
> +test_rsa_key(struct rsa_public_key *pub,
> +            struct rsa_private_key *key)
> +{
> +  mpz_t tmp;
> +  mpz_t phi;
> +
> +  mpz_init(tmp); mpz_init(phi);
> +
> +  if (verbose)
> +    {
> +      /* FIXME: Use gmp_printf */
> +      fprintf(stderr, "Public key: n=");
> +      mpz_out_str(stderr, 16, pub->n);
> +      fprintf(stderr, "\n    e=");
> +      mpz_out_str(stderr, 16, pub->e);
> +
> +      fprintf(stderr, "\n\nPrivate key: d=");
> +      mpz_out_str(stderr, 16, key->d);
> +      fprintf(stderr, "\n    p=");
> +      mpz_out_str(stderr, 16, key->p);
> +      fprintf(stderr, "\n    q=");
> +      mpz_out_str(stderr, 16, key->q);
> +      fprintf(stderr, "\n    a=");
> +      mpz_out_str(stderr, 16, key->a);
> +      fprintf(stderr, "\n    b=");
> +      mpz_out_str(stderr, 16, key->b);
> +      fprintf(stderr, "\n    c=");
> +      mpz_out_str(stderr, 16, key->c);
> +      fprintf(stderr, "\n\n");
> +    }
> +
> +  /* Check n = p q */
> +  mpz_mul(tmp, key->p, key->q);
> +  ASSERT (mpz_cmp(tmp, pub->n)== 0);
> +
> +  /* Check c q = 1 mod p */
> +  mpz_mul(tmp, key->c, key->q);
> +  mpz_fdiv_r(tmp, tmp, key->p);
> +  ASSERT (mpz_cmp_ui(tmp, 1) == 0);
> +
> +  /* Check ed = 1 (mod phi) */
> +  mpz_sub_ui(phi, key->p, 1);
> +  mpz_sub_ui(tmp, key->q, 1);
> +
> +  mpz_mul(phi, phi, tmp);
> +
> +  mpz_mul(tmp, pub->e, key->d);
> +  mpz_fdiv_r(tmp, tmp, phi);
> +  ASSERT (mpz_cmp_ui(tmp, 1) == 0);
> +
> +  /* Check a e = 1 (mod (p-1) ) */
> +  mpz_sub_ui(phi, key->p, 1);
> +  mpz_mul(tmp, pub->e, key->a);
> +  mpz_fdiv_r(tmp, tmp, phi);
> +  ASSERT (mpz_cmp_ui(tmp, 1) == 0);
> +
> +  /* Check b e = 1 (mod (q-1) ) */
> +  mpz_sub_ui(phi, key->q, 1);
> +  mpz_mul(tmp, pub->e, key->b);
> +  mpz_fdiv_r(tmp, tmp, phi);
> +  ASSERT (mpz_cmp_ui(tmp, 1) == 0);
> +
> +  mpz_clear(tmp); mpz_clear(phi);
> +}
> +
> +/* Requires that the context is named like the hash algorithm. */
> +#define DSA_VERIFY(key, hash, msg, signature)  \
> +  (hash##_update(&hash, LDATA(msg)),           \
> +   dsa_##hash##_verify(key, &hash, signature))
> +
> +void
> +test_dsa160(const struct dsa_public_key *pub,
> +           const struct dsa_private_key *key,
> +           const struct dsa_signature *expected)
> +{
> +  struct sha1_ctx sha1;
> +  struct dsa_signature signature;
> +  struct knuth_lfib_ctx lfib;
> +
> +  sha1_init(&sha1);
> +  dsa_signature_init(&signature);
> +  knuth_lfib_init(&lfib, 1111);
> +
> +  sha1_update(&sha1, LDATA("The magic words are squeamish ossifrage"));
> +  ASSERT (dsa_sha1_sign(pub, key,
> +                       &lfib, (nettle_random_func *) knuth_lfib_random,
> +                       &sha1, &signature));
> +
> +  if (verbose)
> +    {
> +      fprintf(stderr, "dsa160 signature: ");
> +      mpz_out_str(stderr, 16, signature.r);
> +      fprintf(stderr, ", ");
> +      mpz_out_str(stderr, 16, signature.s);
> +      fprintf(stderr, "\n");
> +    }
> +
> +  if (expected)
> +    ASSERT (mpz_cmp (signature.r, expected->r) == 0
> +           && mpz_cmp (signature.s, expected->s) == 0);
> +
> +  /* Try bad data */
> +  ASSERT (!DSA_VERIFY(pub, sha1,
> +                     "The magick words are squeamish ossifrage",
> +                     &signature));
> +
> +  /* Try correct data */
> +  ASSERT (DSA_VERIFY(pub, sha1,
> +                    "The magic words are squeamish ossifrage",
> +                    &signature));
> +
> +  /* Try bad signature */
> +  mpz_combit(signature.r, 17);
> +  ASSERT (!DSA_VERIFY(pub, sha1,
> +                     "The magic words are squeamish ossifrage",
> +                     &signature));
> +
> +  dsa_signature_clear(&signature);
> +}
> +
> +void
> +test_dsa256(const struct dsa_public_key *pub,
> +           const struct dsa_private_key *key,
> +           const struct dsa_signature *expected)
> +{
> +  struct sha256_ctx sha256;
> +  struct dsa_signature signature;
> +  struct knuth_lfib_ctx lfib;
> +
> +  sha256_init(&sha256);
> +  dsa_signature_init(&signature);
> +  knuth_lfib_init(&lfib, 1111);
> +
> +  sha256_update(&sha256, LDATA("The magic words are squeamish
> ossifrage"));
> +  ASSERT (dsa_sha256_sign(pub, key,
> +                       &lfib, (nettle_random_func *) knuth_lfib_random,
> +                       &sha256, &signature));
> +
> +  if (verbose)
> +    {
> +      fprintf(stderr, "dsa256 signature: ");
> +      mpz_out_str(stderr, 16, signature.r);
> +      fprintf(stderr, ", ");
> +      mpz_out_str(stderr, 16, signature.s);
> +      fprintf(stderr, "\n");
> +    }
> +
> +  if (expected)
> +    ASSERT (mpz_cmp (signature.r, expected->r) == 0
> +           && mpz_cmp (signature.s, expected->s) == 0);
> +
> +  /* Try bad data */
> +  ASSERT (!DSA_VERIFY(pub, sha256,
> +                     "The magick words are squeamish ossifrage",
> +                     &signature));
> +
> +  /* Try correct data */
> +  ASSERT (DSA_VERIFY(pub, sha256,
> +                    "The magic words are squeamish ossifrage",
> +                    &signature));
> +
> +  /* Try bad signature */
> +  mpz_combit(signature.r, 17);
> +  ASSERT (!DSA_VERIFY(pub, sha256,
> +                     "The magic words are squeamish ossifrage",
> +                     &signature));
> +
> +  dsa_signature_clear(&signature);
> +}
> +
> +
> +void
> +test_dsa_verify(const struct dsa_params *params,
> +               const mpz_t pub,
> +               const struct nettle_hash *hash,
> +               struct tstring *msg,
> +               const struct dsa_signature *ref)
> +{
> +  void *ctx = xalloc (hash->context_size);
> +  uint8_t *digest = xalloc (hash->digest_size);
> +  struct dsa_signature signature;
> +
> +  dsa_signature_init (&signature);
> +
> +  hash->init(ctx);
> +
> +  hash->update (ctx, msg->length, msg->data);
> +  hash->digest (ctx, hash->digest_size, digest);
> +
> +  mpz_set (signature.r, ref->r);
> +  mpz_set (signature.s, ref->s);
> +
> +  ASSERT (dsa_verify (params, pub,
> +                      hash->digest_size, digest,
> +                      &signature));
> +
> +  /* Try bad signature */
> +  mpz_combit(signature.r, 17);
> +  ASSERT (!dsa_verify (params, pub,
> +                      hash->digest_size, digest,
> +                      &signature));
> +
> +  /* Try bad data */
> +  digest[hash->digest_size / 2-1] ^= 8;
> +  ASSERT (!dsa_verify (params, pub,
> +                      hash->digest_size, digest,
> +                      ref));
> +
> +  free (ctx);
> +  free (digest);
> +  dsa_signature_clear(&signature);
> +}
> +
> +void
> +test_dsa_key(const struct dsa_params *params,
> +            const mpz_t pub,
> +            const mpz_t key,
> +            unsigned q_size)
> +{
> +  mpz_t t;
> +
> +  mpz_init(t);
> +
> +  ASSERT(mpz_sizeinbase(params->q, 2) == q_size);
> +  ASSERT(mpz_sizeinbase(params->p, 2) >= DSA_SHA1_MIN_P_BITS);
> +
> +  ASSERT(mpz_probab_prime_p(params->p, 10));
> +
> +  ASSERT(mpz_probab_prime_p(params->q, 10));
> +
> +  mpz_fdiv_r(t, params->p, params->q);
> +
> +  ASSERT(0 == mpz_cmp_ui(t, 1));
> +
> +  ASSERT(mpz_cmp_ui(params->g, 1) > 0);
> +
> +  mpz_powm(t, params->g, params->q, params->p);
> +  ASSERT(0 == mpz_cmp_ui(t, 1));
> +
> +  mpz_powm(t, params->g, key, params->p);
> +  ASSERT(0 == mpz_cmp(t, pub));
> +
> +  mpz_clear(t);
> +}
> +
> +const struct ecc_curve * const ecc_curves[] = {
> +  &_nettle_secp_192r1,
> +  &_nettle_secp_224r1,
> +  &_nettle_secp_256r1,
> +  &_nettle_secp_384r1,
> +  &_nettle_secp_521r1,
> +  &_nettle_curve25519,
> +  &_nettle_curve448,
> +  &_nettle_gost_gc256b,
> +  &_nettle_gost_gc512a,
> +  NULL
> +};
> +
> +void
> +write_mpn (FILE *f, int base, const mp_limb_t *xp, mp_size_t n)
> +{
> +  mpz_t t;
> +  mpz_out_str (f, base, mpz_roinit_n (t,xp, n));
> +}
> +
> +int
> +run_all_libhogweed_tests(int v)
> +{
> +      if (v == 1) {
> +             verbose = 1;
> +      } else if (v == 0) {
> +             verbose = 0;
> +
> +      } else {
> +             fprintf(stderr, "Invalid argument `%d`, only accepted
> options are `0` or `1`.\n",
> +                     v);
> +             return 1;
> +      }
> +
> +#ifdef CONFIG_RSA_COMPUTE_ROOT_TEST
> +  puts("running rsa_compute_root_test
> __________________________________________________");
> +  rsa_compute_root_test();
> +  puts("rsa_compute_root_test is complete
> ______________________________________________\n");
> +#endif
> +#ifdef CONFIG_RSA_ENCRYPT_TEST
> +  puts("running rsa_encrypt_test
> _______________________________________________________");
> +  rsa_encrypt_test();
> +  puts("rsa_encrypt_test is complete
> ___________________________________________________\n");
> +#endif
> +#ifdef CONFIG_RSA_KEYGEN_TEST
> +  puts("running rsa_keygen_test
> ________________________________________________________");
> +  rsa_keygen_test();
> +  puts("rsa_keygen_test is complete
> ____________________________________________________\n");
> +#endif
> +#ifdef CONFIG_RSA_PSS_SIGN_TR_TEST
> +  puts("running rsa_pss_sign_tr_test
> ___________________________________________________");
> +  rsa_pss_sign_tr_test();
> +  puts("rsa_pss_sign_tr_test is complete
> _______________________________________________\n");
> +#endif
> +#ifdef CONFIG_RSA_SEC_DECRYPT_TEST
> +  puts("running rsa_sec_decrypt_test
> ___________________________________________________");
> +  rsa_sec_decrypt_test();
> +  puts("rsa_sec_decrypt_test is complete
> _______________________________________________\n");
> +#endif
> +#ifdef CONFIG_RSA_SIGN_TR_TEST
> +  puts("running rsa_sign_tr_test
> _______________________________________________________");
> +  rsa_sign_tr_test();
> +  puts("rsa_sign_tr_test is complete
> ___________________________________________________\n");
> +#endif
> +#ifdef CONFIG_RSA_TEST
> +  puts("running rsa_test
> _______________________________________________________________");
> +  rsa_test();
> +  puts("rsa_test is complete
> ___________________________________________________________\n");
> +#endif
> +#ifdef CONFIG_RSA2SEXP_TEST
> +  puts("running rsa2sexp_test
> __________________________________________________________");
> +  rsa2sexp_test();
> +  puts("rsa2sexp_test is complete
> ______________________________________________________\n");
> +#endif
> +#ifdef CONFIG_SEXP2RSA_TEST
> +  puts("running sexp2rsa_test
> __________________________________________________________");
> +  sexp2rsa_test();
> +  puts("sexp2rsa_test is complete
> ______________________________________________________\n");
> +#endif
> +#ifdef CONFIG_CURVE25519_DH_TEST
> +  puts("running curve25519_dh_test
> _____________________________________________________");
> +  curve25519_dh_test();
> +  puts("curve25519_dh_test is complete
> _________________________________________________\n");
> +#endif
> +#ifdef CONFIG_CURVE448_DH_TEST
> +  puts("running curve448_dh_test
> _______________________________________________________");
> +  curve448_dh_test();
> +  puts("curve448_dh_test is complete
> ___________________________________________________\n");
> +#endif
> +#ifdef CONFIG_DSA_KEYGEN_TEST
> +  puts("running dsa_keygen_test
> ________________________________________________________");
> +  dsa_keygen_test();
> +  puts("dsa_keygen_test is complete
> ____________________________________________________\n");
> +#endif
> +#ifdef CONFIG_DSA_TEST
> +  puts("running dsa_test
> _______________________________________________________________");
> +  dsa_test();
> +  puts("dsa_test is complete
> ___________________________________________________________\n");
> +#endif
> +#ifdef CONFIG_ECDSA_KEYGEN_TEST
> +  puts("running ecdsa_keygen_test
> ______________________________________________________");
> +  ecdsa_keygen_test();
> +  puts("ecdsa_keygen_test is complete
> __________________________________________________\n");
> +#endif
> +#ifdef CONFIG_ECDSA_SIGN_TEST
> +  puts("running ecdsa_sign_test
> ________________________________________________________");
> +  ecdsa_sign_test();
> +  puts("ecdsa_sign_test is complete
> ____________________________________________________\n");
> +#endif
> +#ifdef CONFIG_ECDSA_VERIFY_TEST
> +  puts("running ecdsa_verify_test
> ______________________________________________________");
> +  ecdsa_verify_test();
> +  puts("ecdsa_verify_test is complete
> __________________________________________________\n");
> +#endif
> +#ifdef CONFIG_EDDSA_COMPRESS_TEST
> +  puts("running eddsa_compress_test
> ____________________________________________________");
> +  eddsa_compress_test();
> +  puts("eddsa_compress_test is complete
> ________________________________________________\n");
> +#endif
> +#ifdef CONFIG_EDDSA_SIGN_TEST
> +  puts("running eddsa_sign_test
> ________________________________________________________");
> +  eddsa_sign_test();
> +  puts("eddsa_sign_test is complete
> ____________________________________________________\n");
> +#endif
> +#ifdef CONFIG_EDDSA_VERIFY_TEST
> +  puts("running eddsa_verify_test
> ______________________________________________________");
> +  eddsa_verify_test();
> +  puts("eddsa_verify_test is complete
> __________________________________________________\n");
> +#endif
> +#ifdef CONFIG_GOSTDSA_KEYGEN_TEST
> +  puts("running gostdsa_keygen_test
> ____________________________________________________");
> +  gostdsa_keygen_test();
> +  puts("gostdsa_keygen_test is complete
> ________________________________________________\n");
> +#endif
> +#ifdef CONFIG_GOSTDSA_SIGN_TEST
> +  puts("running gostdsa_sign_test
> ______________________________________________________");
> +  gostdsa_sign_test();
> +  puts("gostdsa_sign_test is complete
> __________________________________________________\n");
> +#endif
> +#ifdef CONFIG_GOSTDSA_VERIFY_TEST
> +  puts("running gostdsa_verify_test
> ____________________________________________________");
> +  gostdsa_verify_test();
> +  puts("gostdsa_verify_test is complete
> ________________________________________________\n");
> +#endif
> +#ifdef CONFIG_GOSTDSA_VKO_TEST
> +  puts("running gostdsa_vko_test
> _______________________________________________________");
> +  gostdsa_vko_test();
> +  puts("gostdsa_vko_test is complete
> ___________________________________________________\n");
> +#endif
> +
> +
> +  tstring_clear();
> +  return EXIT_SUCCESS;
> +}
> +
> --
> 2.17.1
>
>

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

<div dir=3D"ltr">Hi Dragos,<br><br>All good for now, but we have to keep in=
 mind to assure the concurrency of libhogweed and the main nettle library, =
when it will be ported.<br><br>Reviewed-by: Laurentiu Barbulescu &lt;<a hre=
f=3D"mailto:lrbarbulescu@gmail.com">lrbarbulescu@gmail.com</a>&gt;<br></div=
><br><div class=3D"gmail_quote"><div dir=3D"ltr" class=3D"gmail_attr">On Th=
u, Dec 3, 2020 at 11:21 PM ARGINT DRAGOS IULIAN &lt;<a href=3D"mailto:drago=
sargint21@gmail.com">dragosargint21@gmail.com</a>&gt; wrote:<br></div><bloc=
kquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left:=
1px solid rgb(204,204,204);padding-left:1ex">Signed-off-by: ARGINT DRAGOS I=
ULIAN &lt;<a href=3D"mailto:dragosargint21@gmail.com" target=3D"_blank">dra=
gosargint21@gmail.com</a>&gt;<br>
---<br>
=C2=A0include/testutils_glue.h |=C2=A0 26 ++<br>
=C2=A0testutils_glue.c=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0| 808 +++++++++++++=
++++++++++++++++++++++++++<br>
=C2=A02 files changed, 834 insertions(+)<br>
=C2=A0create mode 100644 include/testutils_glue.h<br>
=C2=A0create mode 100644 testutils_glue.c<br>
<br>
diff --git a/include/testutils_glue.h b/include/testutils_glue.h<br>
new file mode 100644<br>
index 0000000..6213879<br>
--- /dev/null<br>
+++ b/include/testutils_glue.h<br>
@@ -0,0 +1,26 @@<br>
+void rsa_compute_root_test(void);<br>
+void rsa_compute_root_test(void);<br>
+void rsa_encrypt_test(void);<br>
+void rsa_keygen_test(void);<br>
+void rsa_pss_sign_tr_test(void);<br>
+void rsa_sec_decrypt_test(void);<br>
+void rsa_sign_tr_test(void);<br>
+void rsa_test(void);<br>
+void rsa2sexp_test(void);<br>
+void sexp2rsa_test(void);<br>
+void curve25519_dh_test(void);<br>
+void curve448_dh_test(void);<br>
+void dsa_keygen_test(void);<br>
+void dsa_test(void);<br>
+void ecdsa_keygen_test(void);<br>
+void ecdsa_sign_test(void);<br>
+void ecdsa_verify_test(void);<br>
+void eddsa_compress_test(void);<br>
+void eddsa_sign_test(void);<br>
+void eddsa_verify_test(void);<br>
+void gostdsa_keygen_test(void);<br>
+void gostdsa_sign_test(void);<br>
+void gostdsa_verify_test(void);<br>
+void gostdsa_vko_test(void);<br>
+int run_all_libhogweed_tests(int v);<br>
+<br>
diff --git a/testutils_glue.c b/testutils_glue.c<br>
new file mode 100644<br>
index 0000000..1832d92<br>
--- /dev/null<br>
+++ b/testutils_glue.c<br>
@@ -0,0 +1,808 @@<br>
+/* testutils_glue.c */<br>
+<br>
+#include &quot;testutils.h&quot;<br>
+#include &quot;testutils_glue.h&quot;<br>
+#include &quot;base16.h&quot;<br>
+#include &quot;cbc.h&quot;<br>
+#include &quot;cfb.h&quot;<br>
+#include &quot;ctr.h&quot;<br>
+#include &quot;knuth-lfib.h&quot;<br>
+#include &quot;macros.h&quot;<br>
+#include &quot;nettle-internal.h&quot;<br>
+#include &quot;uk/config.h&quot;<br>
+#include &lt;assert.h&gt;<br>
+#include &lt;ctype.h&gt;<br>
+<br>
+void<br>
+die(const char *format, ...)<br>
+{<br>
+=C2=A0 va_list args;<br>
+=C2=A0 va_start(args, format);<br>
+=C2=A0 vfprintf(stderr, format, args);<br>
+=C2=A0 va_end(args);<br>
+<br>
+=C2=A0 abort ();<br>
+}<br>
+<br>
+void *<br>
+xalloc(size_t size)<br>
+{<br>
+=C2=A0 void *p =3D malloc(size);<br>
+=C2=A0 if (size &amp;&amp; !p)<br>
+=C2=A0 =C2=A0 {<br>
+=C2=A0 =C2=A0 =C2=A0 fprintf(stderr, &quot;Virtual memory exhausted.\n&quo=
t;);<br>
+=C2=A0 =C2=A0 =C2=A0 abort();<br>
+=C2=A0 =C2=A0 }<br>
+<br>
+=C2=A0 return p;<br>
+}<br>
+<br>
+static struct tstring *tstring_first =3D NULL;<br>
+<br>
+struct tstring *<br>
+tstring_alloc (size_t length)<br>
+{<br>
+=C2=A0 struct tstring *s =3D xalloc(sizeof(struct tstring) + length);<br>
+=C2=A0 s-&gt;length =3D length;<br>
+=C2=A0 s-&gt;next =3D tstring_first;<br>
+=C2=A0 /* NUL-terminate, for convenience. */<br>
+=C2=A0 s-&gt;data[length] =3D &#39;\0&#39;;<br>
+=C2=A0 tstring_first =3D s;<br>
+=C2=A0 return s;<br>
+}<br>
+<br>
+void<br>
+tstring_clear(void)<br>
+{<br>
+=C2=A0 while (tstring_first)<br>
+=C2=A0 =C2=A0 {<br>
+=C2=A0 =C2=A0 =C2=A0 struct tstring *s =3D tstring_first;<br>
+=C2=A0 =C2=A0 =C2=A0 tstring_first =3D s-&gt;next;<br>
+=C2=A0 =C2=A0 =C2=A0 free(s);<br>
+=C2=A0 =C2=A0 }<br>
+}<br>
+<br>
+struct tstring *<br>
+tstring_data(size_t length, const uint8_t *data)<br>
+{<br>
+=C2=A0 struct tstring *s =3D tstring_alloc (length);<br>
+=C2=A0 memcpy (s-&gt;data, data, length);<br>
+=C2=A0 return s;<br>
+}<br>
+<br>
+struct tstring *<br>
+tstring_hex(const char *hex)<br>
+{<br>
+=C2=A0 struct base16_decode_ctx ctx;<br>
+=C2=A0 struct tstring *s;<br>
+=C2=A0 size_t length =3D strlen(hex);<br>
+<br>
+=C2=A0 s =3D tstring_alloc(BASE16_DECODE_LENGTH (length));<br>
+=C2=A0 base16_decode_init (&amp;ctx);<br>
+=C2=A0 ASSERT (base16_decode_update (&amp;ctx, &amp;s-&gt;length, s-&gt;da=
ta,<br>
+=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=A0length, hex));<br>
+=C2=A0 ASSERT (base16_decode_final (&amp;ctx));<br>
+<br>
+=C2=A0 return s;<br>
+}<br>
+<br>
+void<br>
+tstring_print_hex(const struct tstring *s)<br>
+{<br>
+=C2=A0 print_hex (s-&gt;length, s-&gt;data);<br>
+}<br>
+<br>
+void<br>
+print_hex(size_t length, const uint8_t *data)<br>
+{<br>
+=C2=A0 size_t i;<br>
+=C2=A0 <br>
+=C2=A0 for (i =3D 0; i &lt; length; i++)<br>
+=C2=A0 =C2=A0 {<br>
+=C2=A0 =C2=A0 =C2=A0 switch (i % 16)<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0{<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0default:<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0break;<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0case 0:<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0printf(&quot;\n&quot;);<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0break;<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0case 8:<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0printf(&quot; &quot;);<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0break;<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0}<br>
+=C2=A0 =C2=A0 =C2=A0 printf(&quot;%02x&quot;, data[i]);<br>
+=C2=A0 =C2=A0 }<br>
+=C2=A0 printf(&quot;\n&quot;);<br>
+}<br>
+<br>
+int verbose =3D 0;<br>
+<br>
+void<br>
+mpn_out_str (FILE *f, int base, const mp_limb_t *xp, mp_size_t xn)<br>
+{<br>
+=C2=A0 mpz_t x;<br>
+=C2=A0 mpz_out_str (f, base, mpz_roinit_n (x, xp, xn));<br>
+}<br>
+<br>
+#if NETTLE_USE_MINI_GMP<br>
+void<br>
+gmp_randinit_default (struct knuth_lfib_ctx *ctx)<br>
+{<br>
+=C2=A0 knuth_lfib_init (ctx, 17);<br>
+}<br>
+void<br>
+mpz_urandomb (mpz_t r, struct knuth_lfib_ctx *ctx, mp_bitcnt_t bits)<br>
+{<br>
+=C2=A0 size_t bytes =3D (bits+7)/8;<br>
+=C2=A0 uint8_t *buf =3D xalloc (bytes);<br>
+<br>
+=C2=A0 knuth_lfib_random (ctx, bytes, buf);<br>
+=C2=A0 buf[0] &amp;=3D 0xff &gt;&gt; (8*bytes - bits);<br>
+=C2=A0 nettle_mpz_set_str_256_u (r, bytes, buf);<br>
+=C2=A0 free (buf);<br>
+}<br>
+#endif /* NETTLE_USE_MINI_GMP */<br>
+<br>
+mp_limb_t *<br>
+xalloc_limbs (mp_size_t n)<br>
+{<br>
+=C2=A0 return xalloc (n * sizeof (mp_limb_t));<br>
+}<br>
+<br>
+/* Expects local variables pub, key, rstate, digest, signature */<br>
+#define SIGN(hash, msg, expected) do { \<br>
+=C2=A0 hash##_update(&amp;hash, LDATA(msg));=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 =C2=A0 \<br>
+=C2=A0 ASSERT(rsa_##hash##_sign(key, &amp;hash, signature));=C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 \<br>
+=C2=A0 if (verbose)=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 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0\<=
br>
+=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 =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 =C2=A0 \<br>
+=C2=A0 =C2=A0 =C2=A0 fprintf(stderr, &quot;rsa-%s signature: &quot;, #hash=
);=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 \<b=
r>
+=C2=A0 =C2=A0 =C2=A0 mpz_out_str(stderr, 16, signature);=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 \<br>
+=C2=A0 =C2=A0 =C2=A0 fprintf(stderr, &quot;\n&quot;);=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 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0\<br>
+=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 =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 =C2=A0 \<br>
+=C2=A0 ASSERT(mpz_cmp (signature, expected) =3D=3D 0);=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 \<br=
>
+=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 =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 =C2=A0 =C2=A0\<br>
+=C2=A0 hash##_update(&amp;hash, LDATA(msg));=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 =C2=A0 \<br>
+=C2=A0 ASSERT(rsa_##hash##_sign_tr(pub, key, &amp;rstate,=C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0\<br>
+=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(nettle_random_func *) knuth_lfib_random, \<=
br>
+=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&amp;hash, signature));=C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0\<br>
+=C2=A0 ASSERT(mpz_cmp (signature, expected) =3D=3D 0);=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 \<br=
>
+=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 =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 =C2=A0 =C2=A0\<br>
+=C2=A0 hash##_update(&amp;hash, LDATA(msg));=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 =C2=A0 \<br>
+=C2=A0 hash##_digest(&amp;hash, sizeof(digest), digest);=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 \<br>
+=C2=A0 ASSERT(rsa_##hash##_sign_digest(key, digest, signature));=C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 \<br>
+=C2=A0 ASSERT(mpz_cmp (signature, expected) =3D=3D 0);=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 \<br=
>
+=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 =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 =C2=A0 =C2=A0\<br>
+=C2=A0 ASSERT(rsa_##hash##_sign_digest_tr(pub, key, &amp;rstate,=C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 \=
<br>
+=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 =C2=A0 (nettle_random_func *)=
knuth_lfib_random, \<br>
+=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 =C2=A0 digest, signature));=
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0\<br>
+=C2=A0 ASSERT(mpz_cmp (signature, expected) =3D=3D 0);=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 \<br=
>
+} while(0)<br>
+<br>
+#define VERIFY(key, hash, msg, signature) (=C2=A0 =C2=A0 \<br>
+=C2=A0 hash##_update(&amp;hash, LDATA(msg)),=C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 \<br>
+=C2=A0 rsa_##hash##_verify(key, &amp;hash, signature)=C2=A0 =C2=A0\<br>
+)<br>
+<br>
+void<br>
+test_rsa_set_key_1(struct rsa_public_key *pub,<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 struct rsa_=
private_key *key)<br>
+{<br>
+=C2=A0 /* Initialize key pair for test programs */<br>
+=C2=A0 /* 1000-bit key, generated by<br>
+=C2=A0 =C2=A0*<br>
+=C2=A0 =C2=A0*=C2=A0 =C2=A0lsh-keygen -a rsa -l 1000 -f advanced-hex<br>
+=C2=A0 =C2=A0*<br>
+=C2=A0 =C2=A0* (private-key (rsa-pkcs1 <br>
+=C2=A0 =C2=A0*=C2=A0 =C2=A0 =C2=A0 =C2=A0 (n #69abd505285af665 36ddc7c8f02=
7e6f0 ed435d6748b16088<br>
+=C2=A0 =C2=A0*=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 4fd60842b3a8d7fb b=
d8a3c98f0cc50ae 4f6a9f7dd73122cc<br>
+=C2=A0 =C2=A0*=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ec8afa3f77134406 f=
53721973115fc2d 8cfbba23b145f28d<br>
+=C2=A0 =C2=A0*=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 84f81d3b6ae8ce1e 2=
850580c026e809b cfbb52566ea3a3b3<br>
+=C2=A0 =C2=A0*=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 df7edf52971872a7 e=
35c1451b8636d22 279a8fb299368238<br>
+=C2=A0 =C2=A0*=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 e545fbb4cf#)<br>
+=C2=A0 =C2=A0*=C2=A0 =C2=A0 =C2=A0 =C2=A0 (e #0db2ad57#)<br>
+=C2=A0 =C2=A0*=C2=A0 =C2=A0 =C2=A0 =C2=A0 (d #3240a56f4cd0dcc2 4a413eb4ea5=
45259 5c83d771a1c2ba7b<br>
+=C2=A0 =C2=A0*=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ec47c5b43eb4b374 0=
9bd2aa1e236dd86 481eb1768811412f<br>
+=C2=A0 =C2=A0*=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 f8d91be3545912af b=
55c014cb55ceac6 54216af3b85d5c4f<br>
+=C2=A0 =C2=A0*=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 4a32894e3b5dfcde 5=
b2875aa4dc8d9a8 6afd0ca92ef50d35<br>
+=C2=A0 =C2=A0*=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 bd09f1c47efb4c8d c=
631e07698d362aa 4a83fd304e66d6c5<br>
+=C2=A0 =C2=A0*=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 468863c307#)<br>
+=C2=A0 =C2=A0*=C2=A0 =C2=A0 =C2=A0 =C2=A0 (p #0a66399919be4b4d e5a78c5ea5c=
85bf9 aba8c013cb4a8732<br>
+=C2=A0 =C2=A0*=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 14557a12bd67711e b=
b4073fd39ad9a86 f4e80253ad809e5b<br>
+=C2=A0 =C2=A0*=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 f2fad3bc37f6f013 2=
73c9552c9f489#)<br>
+=C2=A0 =C2=A0*=C2=A0 =C2=A0 =C2=A0 =C2=A0 (q #0a294f069f118625 f5eae2538db=
9338c 776a298eae953329<br>
+=C2=A0 =C2=A0*=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 9fd1eed4eba04e82 b=
2593bc98ba8db27 de034da7daaea795<br>
+=C2=A0 =C2=A0*=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 2d55b07b5f9a5875 d=
1ca5f6dcab897#)<br>
+=C2=A0 =C2=A0*=C2=A0 =C2=A0 =C2=A0 =C2=A0 (a #011b6c48eb592eee e85d1bb35cf=
b6e07 344ea0b5e5f03a28<br>
+=C2=A0 =C2=A0*=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 5b405396cbc78c5c 8=
68e961db160ba8d 4b984250930cf79a<br>
+=C2=A0 =C2=A0*=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 1bf8a9f28963de53 1=
28aa7d690eb87#)<br>
+=C2=A0 =C2=A0*=C2=A0 =C2=A0 =C2=A0 =C2=A0 (b #0409ecf3d2557c88 214f1af5e1f=
17853 d8b2d63782fa5628<br>
+=C2=A0 =C2=A0*=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 60cf579b0833b7ff 5=
c0529f2a97c6452 2fa1a8878a9635ab<br>
+=C2=A0 =C2=A0*=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ce56debf431bdec2 7=
0b308fa5bf387#)<br>
+=C2=A0 =C2=A0*=C2=A0 =C2=A0 =C2=A0 =C2=A0 (c #04e103ee925cb5e6 6653949fa5e=
1a462 c9e65e1adcd60058<br>
+=C2=A0 =C2=A0*=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 e2df9607cee95fa8 d=
aec7a389a7d9afc 8dd21fef9d83805a<br>
+=C2=A0 =C2=A0*=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 40d46f49676a2f6b 2=
926f70c572c00#)))<br>
+=C2=A0 =C2=A0*/<br>
+=C2=A0 <br>
+=C2=A0 mpz_set_str(pub-&gt;n,<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0&quot;69abd505285af665&quo=
t; &quot;36ddc7c8f027e6f0&quot; &quot;ed435d6748b16088&quot;<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0&quot;4fd60842b3a8d7fb&quo=
t; &quot;bd8a3c98f0cc50ae&quot; &quot;4f6a9f7dd73122cc&quot;<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0&quot;ec8afa3f77134406&quo=
t; &quot;f53721973115fc2d&quot; &quot;8cfbba23b145f28d&quot;<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0&quot;84f81d3b6ae8ce1e&quo=
t; &quot;2850580c026e809b&quot; &quot;cfbb52566ea3a3b3&quot;<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0&quot;df7edf52971872a7&quo=
t; &quot;e35c1451b8636d22&quot; &quot;279a8fb299368238&quot;<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0&quot;e545fbb4cf&quot;, 16=
);<br>
+=C2=A0 mpz_set_str(pub-&gt;e, &quot;0db2ad57&quot;, 16);<br>
+<br>
+=C2=A0 ASSERT (rsa_public_key_prepare(pub));<br>
+=C2=A0 <br>
+=C2=A0 /* d is not used */<br>
+#if 0=C2=A0 <br>
+=C2=A0 mpz_set_str(key-&gt;d,<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0&quot;3240a56f4cd0dcc2&quo=
t; &quot;4a413eb4ea545259&quot; &quot;5c83d771a1c2ba7b&quot;<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0&quot;ec47c5b43eb4b374&quo=
t; &quot;09bd2aa1e236dd86&quot; &quot;481eb1768811412f&quot;<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0&quot;f8d91be3545912af&quo=
t; &quot;b55c014cb55ceac6&quot; &quot;54216af3b85d5c4f&quot;<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0&quot;4a32894e3b5dfcde&quo=
t; &quot;5b2875aa4dc8d9a8&quot; &quot;6afd0ca92ef50d35&quot;<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0&quot;bd09f1c47efb4c8d&quo=
t; &quot;c631e07698d362aa&quot; &quot;4a83fd304e66d6c5&quot;<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0&quot;468863c307&quot;, 16=
);<br>
+#endif<br>
+=C2=A0 <br>
+=C2=A0 mpz_set_str(key-&gt;p,<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0&quot;0a66399919be4b4d&quo=
t; &quot;e5a78c5ea5c85bf9&quot; &quot;aba8c013cb4a8732&quot;<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0&quot;14557a12bd67711e&quo=
t; &quot;bb4073fd39ad9a86&quot; &quot;f4e80253ad809e5b&quot;<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0&quot;f2fad3bc37f6f013&quo=
t; &quot;273c9552c9f489&quot;, 16);<br>
+<br>
+=C2=A0 mpz_set_str(key-&gt;q,<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0&quot;0a294f069f118625&quo=
t; &quot;f5eae2538db9338c&quot; &quot;776a298eae953329&quot;<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0&quot;9fd1eed4eba04e82&quo=
t; &quot;b2593bc98ba8db27&quot; &quot;de034da7daaea795&quot;<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0&quot;2d55b07b5f9a5875&quo=
t; &quot;d1ca5f6dcab897&quot;, 16);<br>
+=C2=A0 <br>
+=C2=A0 mpz_set_str(key-&gt;a,<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0&quot;011b6c48eb592eee&quo=
t; &quot;e85d1bb35cfb6e07&quot; &quot;344ea0b5e5f03a28&quot;<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0&quot;5b405396cbc78c5c&quo=
t; &quot;868e961db160ba8d&quot; &quot;4b984250930cf79a&quot;<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0&quot;1bf8a9f28963de53&quo=
t; &quot;128aa7d690eb87&quot;, 16);<br>
+=C2=A0 <br>
+=C2=A0 mpz_set_str(key-&gt;b,<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0&quot;0409ecf3d2557c88&quo=
t; &quot;214f1af5e1f17853&quot; &quot;d8b2d63782fa5628&quot;<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0&quot;60cf579b0833b7ff&quo=
t; &quot;5c0529f2a97c6452&quot; &quot;2fa1a8878a9635ab&quot;<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0&quot;ce56debf431bdec2&quo=
t; &quot;70b308fa5bf387&quot;, 16);<br>
+=C2=A0 <br>
+=C2=A0 mpz_set_str(key-&gt;c,<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0&quot;04e103ee925cb5e6&quo=
t; &quot;6653949fa5e1a462&quot; &quot;c9e65e1adcd60058&quot;<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0&quot;e2df9607cee95fa8&quo=
t; &quot;daec7a389a7d9afc&quot; &quot;8dd21fef9d83805a&quot;<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0&quot;40d46f49676a2f6b&quo=
t; &quot;2926f70c572c00&quot;, 16);<br>
+<br>
+=C2=A0 ASSERT (rsa_private_key_prepare(key));<br>
+=C2=A0 ASSERT (pub-&gt;size =3D=3D key-&gt;size);<br>
+}<br>
+<br>
+void<br>
+test_rsa_md5(struct rsa_public_key *pub,<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 struct rsa_private_key *key,<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 mpz_t expected)<br>
+{<br>
+=C2=A0 struct md5_ctx md5;<br>
+=C2=A0 struct knuth_lfib_ctx rstate;<br>
+=C2=A0 uint8_t digest[MD5_DIGEST_SIZE];<br>
+=C2=A0 mpz_t signature;<br>
+<br>
+=C2=A0 md5_init(&amp;md5);<br>
+=C2=A0 mpz_init(signature);<br>
+=C2=A0 knuth_lfib_init (&amp;rstate, 15);<br>
+<br>
+=C2=A0 SIGN(md5, &quot;The magic words are squeamish ossifrage&quot;, expe=
cted);<br>
+<br>
+=C2=A0 /* Try bad data */<br>
+=C2=A0 ASSERT (!VERIFY(pub, md5,<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0&quot;The ma=
gick words are squeamish ossifrage&quot;, signature));<br>
+<br>
+=C2=A0 /* Try correct data */<br>
+=C2=A0 ASSERT (VERIFY(pub, md5,<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 &quot;The magic wo=
rds are squeamish ossifrage&quot;, signature));<br>
+<br>
+=C2=A0 /* Try bad signature */<br>
+=C2=A0 mpz_combit(signature, 17);<br>
+=C2=A0 ASSERT (!VERIFY(pub, md5,<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0&quot;The ma=
gic words are squeamish ossifrage&quot;, signature));<br>
+<br>
+=C2=A0 mpz_clear(signature);<br>
+}<br>
+<br>
+void<br>
+test_rsa_sha1(struct rsa_public_key *pub,<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0struct rsa_private_key *ke=
y,<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0mpz_t expected)<br>
+{<br>
+=C2=A0 struct sha1_ctx sha1;<br>
+=C2=A0 struct knuth_lfib_ctx rstate;<br>
+=C2=A0 uint8_t digest[SHA1_DIGEST_SIZE];<br>
+=C2=A0 mpz_t signature;<br>
+<br>
+=C2=A0 sha1_init(&amp;sha1);<br>
+=C2=A0 mpz_init(signature);<br>
+=C2=A0 knuth_lfib_init (&amp;rstate, 16);<br>
+<br>
+=C2=A0 SIGN(sha1, &quot;The magic words are squeamish ossifrage&quot;, exp=
ected);<br>
+<br>
+=C2=A0 /* Try bad data */<br>
+=C2=A0 ASSERT (!VERIFY(pub, sha1,<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0&quot;The ma=
gick words are squeamish ossifrage&quot;, signature));<br>
+<br>
+=C2=A0 /* Try correct data */<br>
+=C2=A0 ASSERT (VERIFY(pub, sha1,<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 &quot;The magic wo=
rds are squeamish ossifrage&quot;, signature));<br>
+<br>
+=C2=A0 /* Try bad signature */<br>
+=C2=A0 mpz_combit(signature, 17);<br>
+=C2=A0 ASSERT (!VERIFY(pub, sha1,<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0&quot;The ma=
gic words are squeamish ossifrage&quot;, signature));<br>
+<br>
+=C2=A0 mpz_clear(signature);<br>
+}<br>
+<br>
+void<br>
+test_rsa_sha256(struct rsa_public_key *pub,<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0struct rsa_private_=
key *key,<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0mpz_t expected)<br>
+{<br>
+=C2=A0 struct sha256_ctx sha256;<br>
+=C2=A0 struct knuth_lfib_ctx rstate;<br>
+=C2=A0 uint8_t digest[SHA256_DIGEST_SIZE];<br>
+=C2=A0 mpz_t signature;<br>
+<br>
+=C2=A0 sha256_init(&amp;sha256);<br>
+=C2=A0 mpz_init(signature);<br>
+=C2=A0 knuth_lfib_init (&amp;rstate, 17);<br>
+<br>
+=C2=A0 SIGN(sha256, &quot;The magic words are squeamish ossifrage&quot;, e=
xpected);<br>
+<br>
+=C2=A0 /* Try bad data */<br>
+=C2=A0 ASSERT (!VERIFY(pub, sha256,<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0&quot;The ma=
gick words are squeamish ossifrage&quot;, signature));<br>
+<br>
+=C2=A0 /* Try correct data */<br>
+=C2=A0 ASSERT (VERIFY(pub, sha256,<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 &quot;The magic wo=
rds are squeamish ossifrage&quot;, signature));<br>
+<br>
+=C2=A0 /* Try bad signature */<br>
+=C2=A0 mpz_combit(signature, 17);<br>
+=C2=A0 ASSERT (!VERIFY(pub, sha256,<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0&quot;The ma=
gic words are squeamish ossifrage&quot;, signature));<br>
+<br>
+=C2=A0 mpz_clear(signature);<br>
+}<br>
+<br>
+void<br>
+test_rsa_sha512(struct rsa_public_key *pub,<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0struct rsa_private_=
key *key,<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0mpz_t expected)<br>
+{<br>
+=C2=A0 struct sha512_ctx sha512;<br>
+=C2=A0 struct knuth_lfib_ctx rstate;<br>
+=C2=A0 uint8_t digest[SHA512_DIGEST_SIZE];<br>
+=C2=A0 mpz_t signature;<br>
+<br>
+=C2=A0 sha512_init(&amp;sha512);<br>
+=C2=A0 mpz_init(signature);<br>
+=C2=A0 knuth_lfib_init (&amp;rstate, 18);<br>
+<br>
+=C2=A0 SIGN(sha512, &quot;The magic words are squeamish ossifrage&quot;, e=
xpected);<br>
+<br>
+=C2=A0 /* Try bad data */<br>
+=C2=A0 ASSERT (!VERIFY(pub, sha512,<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0&quot;The ma=
gick words are squeamish ossifrage&quot;, signature));<br>
+<br>
+=C2=A0 /* Try correct data */<br>
+=C2=A0 ASSERT (VERIFY(pub, sha512,<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 &quot;The magic wo=
rds are squeamish ossifrage&quot;, signature));<br>
+<br>
+=C2=A0 /* Try bad signature */<br>
+=C2=A0 mpz_combit(signature, 17);<br>
+=C2=A0 ASSERT (!VERIFY(pub, sha512,<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0&quot;The ma=
gic words are squeamish ossifrage&quot;, signature));<br>
+<br>
+=C2=A0 mpz_clear(signature);<br>
+}<br>
+<br>
+#undef SIGN<br>
+#undef VERIFY<br>
+<br>
+void<br>
+test_rsa_key(struct rsa_public_key *pub,<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 struct rsa_private_key *key)<br>
+{<br>
+=C2=A0 mpz_t tmp;<br>
+=C2=A0 mpz_t phi;<br>
+=C2=A0 <br>
+=C2=A0 mpz_init(tmp); mpz_init(phi);<br>
+=C2=A0 <br>
+=C2=A0 if (verbose)<br>
+=C2=A0 =C2=A0 {<br>
+=C2=A0 =C2=A0 =C2=A0 /* FIXME: Use gmp_printf */<br>
+=C2=A0 =C2=A0 =C2=A0 fprintf(stderr, &quot;Public key: n=3D&quot;);<br>
+=C2=A0 =C2=A0 =C2=A0 mpz_out_str(stderr, 16, pub-&gt;n);<br>
+=C2=A0 =C2=A0 =C2=A0 fprintf(stderr, &quot;\n=C2=A0 =C2=A0 e=3D&quot;);<br=
>
+=C2=A0 =C2=A0 =C2=A0 mpz_out_str(stderr, 16, pub-&gt;e);<br>
+<br>
+=C2=A0 =C2=A0 =C2=A0 fprintf(stderr, &quot;\n\nPrivate key: d=3D&quot;);<b=
r>
+=C2=A0 =C2=A0 =C2=A0 mpz_out_str(stderr, 16, key-&gt;d);<br>
+=C2=A0 =C2=A0 =C2=A0 fprintf(stderr, &quot;\n=C2=A0 =C2=A0 p=3D&quot;);<br=
>
+=C2=A0 =C2=A0 =C2=A0 mpz_out_str(stderr, 16, key-&gt;p);<br>
+=C2=A0 =C2=A0 =C2=A0 fprintf(stderr, &quot;\n=C2=A0 =C2=A0 q=3D&quot;);<br=
>
+=C2=A0 =C2=A0 =C2=A0 mpz_out_str(stderr, 16, key-&gt;q);<br>
+=C2=A0 =C2=A0 =C2=A0 fprintf(stderr, &quot;\n=C2=A0 =C2=A0 a=3D&quot;);<br=
>
+=C2=A0 =C2=A0 =C2=A0 mpz_out_str(stderr, 16, key-&gt;a);<br>
+=C2=A0 =C2=A0 =C2=A0 fprintf(stderr, &quot;\n=C2=A0 =C2=A0 b=3D&quot;);<br=
>
+=C2=A0 =C2=A0 =C2=A0 mpz_out_str(stderr, 16, key-&gt;b);<br>
+=C2=A0 =C2=A0 =C2=A0 fprintf(stderr, &quot;\n=C2=A0 =C2=A0 c=3D&quot;);<br=
>
+=C2=A0 =C2=A0 =C2=A0 mpz_out_str(stderr, 16, key-&gt;c);<br>
+=C2=A0 =C2=A0 =C2=A0 fprintf(stderr, &quot;\n\n&quot;);<br>
+=C2=A0 =C2=A0 }<br>
+<br>
+=C2=A0 /* Check n =3D p q */<br>
+=C2=A0 mpz_mul(tmp, key-&gt;p, key-&gt;q);<br>
+=C2=A0 ASSERT (mpz_cmp(tmp, pub-&gt;n)=3D=3D 0);<br>
+<br>
+=C2=A0 /* Check c q =3D 1 mod p */<br>
+=C2=A0 mpz_mul(tmp, key-&gt;c, key-&gt;q);<br>
+=C2=A0 mpz_fdiv_r(tmp, tmp, key-&gt;p);<br>
+=C2=A0 ASSERT (mpz_cmp_ui(tmp, 1) =3D=3D 0);<br>
+<br>
+=C2=A0 /* Check ed =3D 1 (mod phi) */<br>
+=C2=A0 mpz_sub_ui(phi, key-&gt;p, 1);<br>
+=C2=A0 mpz_sub_ui(tmp, key-&gt;q, 1);<br>
+<br>
+=C2=A0 mpz_mul(phi, phi, tmp);<br>
+<br>
+=C2=A0 mpz_mul(tmp, pub-&gt;e, key-&gt;d);<br>
+=C2=A0 mpz_fdiv_r(tmp, tmp, phi);<br>
+=C2=A0 ASSERT (mpz_cmp_ui(tmp, 1) =3D=3D 0);<br>
+<br>
+=C2=A0 /* Check a e =3D 1 (mod (p-1) ) */<br>
+=C2=A0 mpz_sub_ui(phi, key-&gt;p, 1);<br>
+=C2=A0 mpz_mul(tmp, pub-&gt;e, key-&gt;a);<br>
+=C2=A0 mpz_fdiv_r(tmp, tmp, phi);<br>
+=C2=A0 ASSERT (mpz_cmp_ui(tmp, 1) =3D=3D 0);<br>
+=C2=A0 <br>
+=C2=A0 /* Check b e =3D 1 (mod (q-1) ) */<br>
+=C2=A0 mpz_sub_ui(phi, key-&gt;q, 1);<br>
+=C2=A0 mpz_mul(tmp, pub-&gt;e, key-&gt;b);<br>
+=C2=A0 mpz_fdiv_r(tmp, tmp, phi);<br>
+=C2=A0 ASSERT (mpz_cmp_ui(tmp, 1) =3D=3D 0);<br>
+=C2=A0 <br>
+=C2=A0 mpz_clear(tmp); mpz_clear(phi);<br>
+}<br>
+<br>
+/* Requires that the context is named like the hash algorithm. */<br>
+#define DSA_VERIFY(key, hash, msg, signature)=C2=A0 \<br>
+=C2=A0 (hash##_update(&amp;hash, LDATA(msg)),=C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0\<br>
+=C2=A0 =C2=A0dsa_##hash##_verify(key, &amp;hash, signature))<br>
+<br>
+void<br>
+test_dsa160(const struct dsa_public_key *pub,<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0const struct dsa_private_key *key=
,<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0const struct dsa_signature *expec=
ted)<br>
+{<br>
+=C2=A0 struct sha1_ctx sha1;<br>
+=C2=A0 struct dsa_signature signature;<br>
+=C2=A0 struct knuth_lfib_ctx lfib;<br>
+=C2=A0 <br>
+=C2=A0 sha1_init(&amp;sha1);<br>
+=C2=A0 dsa_signature_init(&amp;signature);<br>
+=C2=A0 knuth_lfib_init(&amp;lfib, 1111);<br>
+=C2=A0 <br>
+=C2=A0 sha1_update(&amp;sha1, LDATA(&quot;The magic words are squeamish os=
sifrage&quot;));<br>
+=C2=A0 ASSERT (dsa_sha1_sign(pub, key,<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0&amp;lfib, (nettle_random_func *) knuth_lfib_random,<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0&amp;sha1, &amp;signature));<br>
+<br>
+=C2=A0 if (verbose)<br>
+=C2=A0 =C2=A0 {<br>
+=C2=A0 =C2=A0 =C2=A0 fprintf(stderr, &quot;dsa160 signature: &quot;);<br>
+=C2=A0 =C2=A0 =C2=A0 mpz_out_str(stderr, 16, signature.r);<br>
+=C2=A0 =C2=A0 =C2=A0 fprintf(stderr, &quot;, &quot;);<br>
+=C2=A0 =C2=A0 =C2=A0 mpz_out_str(stderr, 16, signature.s);<br>
+=C2=A0 =C2=A0 =C2=A0 fprintf(stderr, &quot;\n&quot;);<br>
+=C2=A0 =C2=A0 }<br>
+<br>
+=C2=A0 if (expected)<br>
+=C2=A0 =C2=A0 ASSERT (mpz_cmp (signature.r, expected-&gt;r) =3D=3D 0<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0&amp;&amp; mpz_cmp (signature.s, =
expected-&gt;s) =3D=3D 0);<br>
+=C2=A0 <br>
+=C2=A0 /* Try bad data */<br>
+=C2=A0 ASSERT (!DSA_VERIFY(pub, sha1,<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0&quot;The magick words are squeamish ossifrage&quot;,<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0&amp;signature));<br>
+<br>
+=C2=A0 /* Try correct data */<br>
+=C2=A0 ASSERT (DSA_VERIFY(pub, sha1,<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 &quo=
t;The magic words are squeamish ossifrage&quot;,<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 &amp=
;signature));<br>
+<br>
+=C2=A0 /* Try bad signature */<br>
+=C2=A0 mpz_combit(signature.r, 17);<br>
+=C2=A0 ASSERT (!DSA_VERIFY(pub, sha1,<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0&quot;The magic words are squeamish ossifrage&quot;,<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0&amp;signature));<br>
+<br>
+=C2=A0 dsa_signature_clear(&amp;signature);<br>
+}<br>
+<br>
+void<br>
+test_dsa256(const struct dsa_public_key *pub,<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0const struct dsa_private_key *key=
,<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0const struct dsa_signature *expec=
ted)<br>
+{<br>
+=C2=A0 struct sha256_ctx sha256;<br>
+=C2=A0 struct dsa_signature signature;<br>
+=C2=A0 struct knuth_lfib_ctx lfib;<br>
+=C2=A0 <br>
+=C2=A0 sha256_init(&amp;sha256);<br>
+=C2=A0 dsa_signature_init(&amp;signature);<br>
+=C2=A0 knuth_lfib_init(&amp;lfib, 1111);<br>
+=C2=A0 <br>
+=C2=A0 sha256_update(&amp;sha256, LDATA(&quot;The magic words are squeamis=
h ossifrage&quot;));<br>
+=C2=A0 ASSERT (dsa_sha256_sign(pub, key,<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0&amp;lfib, (nettle_random_func *) knuth_lfib_random,<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0&amp;sha256, &amp;signature));<br>
+=C2=A0 <br>
+=C2=A0 if (verbose)<br>
+=C2=A0 =C2=A0 {<br>
+=C2=A0 =C2=A0 =C2=A0 fprintf(stderr, &quot;dsa256 signature: &quot;);<br>
+=C2=A0 =C2=A0 =C2=A0 mpz_out_str(stderr, 16, signature.r);<br>
+=C2=A0 =C2=A0 =C2=A0 fprintf(stderr, &quot;, &quot;);<br>
+=C2=A0 =C2=A0 =C2=A0 mpz_out_str(stderr, 16, signature.s);<br>
+=C2=A0 =C2=A0 =C2=A0 fprintf(stderr, &quot;\n&quot;);<br>
+=C2=A0 =C2=A0 }<br>
+<br>
+=C2=A0 if (expected)<br>
+=C2=A0 =C2=A0 ASSERT (mpz_cmp (signature.r, expected-&gt;r) =3D=3D 0<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0&amp;&amp; mpz_cmp (signature.s, =
expected-&gt;s) =3D=3D 0);<br>
+=C2=A0 <br>
+=C2=A0 /* Try bad data */<br>
+=C2=A0 ASSERT (!DSA_VERIFY(pub, sha256,<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0&quot;The magick words are squeamish ossifrage&quot;,<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0&amp;signature));<br>
+<br>
+=C2=A0 /* Try correct data */<br>
+=C2=A0 ASSERT (DSA_VERIFY(pub, sha256,<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 &quo=
t;The magic words are squeamish ossifrage&quot;,<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 &amp=
;signature));<br>
+<br>
+=C2=A0 /* Try bad signature */<br>
+=C2=A0 mpz_combit(signature.r, 17);<br>
+=C2=A0 ASSERT (!DSA_VERIFY(pub, sha256,<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0&quot;The magic words are squeamish ossifrage&quot;,<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0&amp;signature));<br>
+<br>
+=C2=A0 dsa_signature_clear(&amp;signature);<br>
+}<br>
+<br>
+<br>
+void<br>
+test_dsa_verify(const struct dsa_params *params,<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0const mpz_t pub,<br=
>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0const struct nettle=
_hash *hash,<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0struct tstring *msg=
,<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0const struct dsa_si=
gnature *ref)<br>
+{<br>
+=C2=A0 void *ctx =3D xalloc (hash-&gt;context_size);<br>
+=C2=A0 uint8_t *digest =3D xalloc (hash-&gt;digest_size);<br>
+=C2=A0 struct dsa_signature signature;<br>
+<br>
+=C2=A0 dsa_signature_init (&amp;signature);<br>
+<br>
+=C2=A0 hash-&gt;init(ctx);<br>
+=C2=A0 <br>
+=C2=A0 hash-&gt;update (ctx, msg-&gt;length, msg-&gt;data);<br>
+=C2=A0 hash-&gt;digest (ctx, hash-&gt;digest_size, digest);<br>
+<br>
+=C2=A0 mpz_set (signature.r, ref-&gt;r);<br>
+=C2=A0 mpz_set (signature.s, ref-&gt;s);<br>
+<br>
+=C2=A0 ASSERT (dsa_verify (params, pub,<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 hash-&gt;digest_size, digest,<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 &amp;signature));<br>
+<br>
+=C2=A0 /* Try bad signature */<br>
+=C2=A0 mpz_combit(signature.r, 17);<br>
+=C2=A0 ASSERT (!dsa_verify (params, pub,<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 hash-&gt;digest_size, digest,<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 &amp;signature));<br>
+=C2=A0 <br>
+=C2=A0 /* Try bad data */<br>
+=C2=A0 digest[hash-&gt;digest_size / 2-1] ^=3D 8;<br>
+=C2=A0 ASSERT (!dsa_verify (params, pub,<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 hash-&gt;digest_size, digest,<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 ref));<br>
+<br>
+=C2=A0 free (ctx);<br>
+=C2=A0 free (digest);<br>
+=C2=A0 dsa_signature_clear(&amp;signature);=C2=A0 <br>
+}<br>
+<br>
+void<br>
+test_dsa_key(const struct dsa_params *params,<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 const mpz_t pub,<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 const mpz_t key,<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 unsigned q_size)<br>
+{<br>
+=C2=A0 mpz_t t;<br>
+<br>
+=C2=A0 mpz_init(t);<br>
+<br>
+=C2=A0 ASSERT(mpz_sizeinbase(params-&gt;q, 2) =3D=3D q_size);<br>
+=C2=A0 ASSERT(mpz_sizeinbase(params-&gt;p, 2) &gt;=3D DSA_SHA1_MIN_P_BITS)=
;<br>
+=C2=A0 <br>
+=C2=A0 ASSERT(mpz_probab_prime_p(params-&gt;p, 10));<br>
+<br>
+=C2=A0 ASSERT(mpz_probab_prime_p(params-&gt;q, 10));<br>
+<br>
+=C2=A0 mpz_fdiv_r(t, params-&gt;p, params-&gt;q);<br>
+<br>
+=C2=A0 ASSERT(0 =3D=3D mpz_cmp_ui(t, 1));<br>
+<br>
+=C2=A0 ASSERT(mpz_cmp_ui(params-&gt;g, 1) &gt; 0);<br>
+=C2=A0 <br>
+=C2=A0 mpz_powm(t, params-&gt;g, params-&gt;q, params-&gt;p);<br>
+=C2=A0 ASSERT(0 =3D=3D mpz_cmp_ui(t, 1));<br>
+=C2=A0 <br>
+=C2=A0 mpz_powm(t, params-&gt;g, key, params-&gt;p);<br>
+=C2=A0 ASSERT(0 =3D=3D mpz_cmp(t, pub));<br>
+<br>
+=C2=A0 mpz_clear(t);<br>
+}<br>
+<br>
+const struct ecc_curve * const ecc_curves[] =3D {<br>
+=C2=A0 &amp;_nettle_secp_192r1,<br>
+=C2=A0 &amp;_nettle_secp_224r1,<br>
+=C2=A0 &amp;_nettle_secp_256r1,<br>
+=C2=A0 &amp;_nettle_secp_384r1,<br>
+=C2=A0 &amp;_nettle_secp_521r1,<br>
+=C2=A0 &amp;_nettle_curve25519,<br>
+=C2=A0 &amp;_nettle_curve448,<br>
+=C2=A0 &amp;_nettle_gost_gc256b,<br>
+=C2=A0 &amp;_nettle_gost_gc512a,<br>
+=C2=A0 NULL<br>
+};<br>
+<br>
+void<br>
+write_mpn (FILE *f, int base, const mp_limb_t *xp, mp_size_t n)<br>
+{<br>
+=C2=A0 mpz_t t;<br>
+=C2=A0 mpz_out_str (f, base, mpz_roinit_n (t,xp, n));<br>
+}<br>
+<br>
+int<br>
+run_all_libhogweed_tests(int v)<br>
+{<br>
+=C2=A0 =C2=A0 =C2=A0 if (v =3D=3D 1) {<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0verbose =3D 1;<br>
+=C2=A0 =C2=A0 =C2=A0 } else if (v =3D=3D 0) {<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0verbose =3D 0;<br>
+=C2=A0 =C2=A0 =C2=A0 <br>
+=C2=A0 =C2=A0 =C2=A0 } else {<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0fprintf(stderr, &quot;Inva=
lid argument `%d`, only accepted options are `0` or `1`.\n&quot;,<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0v);<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0return 1;<br>
+=C2=A0 =C2=A0 =C2=A0 }<br>
+<br>
+#ifdef CONFIG_RSA_COMPUTE_ROOT_TEST<br>
+=C2=A0 puts(&quot;running rsa_compute_root_test __________________________=
________________________&quot;);<br>
+=C2=A0 rsa_compute_root_test();<br>
+=C2=A0 puts(&quot;rsa_compute_root_test is complete ______________________=
________________________\n&quot;);<br>
+#endif<br>
+#ifdef CONFIG_RSA_ENCRYPT_TEST<br>
+=C2=A0 puts(&quot;running rsa_encrypt_test _______________________________=
________________________&quot;);<br>
+=C2=A0 rsa_encrypt_test();<br>
+=C2=A0 puts(&quot;rsa_encrypt_test is complete ___________________________=
________________________\n&quot;);<br>
+#endif<br>
+#ifdef CONFIG_RSA_KEYGEN_TEST<br>
+=C2=A0 puts(&quot;running rsa_keygen_test ________________________________=
________________________&quot;);<br>
+=C2=A0 rsa_keygen_test();<br>
+=C2=A0 puts(&quot;rsa_keygen_test is complete ____________________________=
________________________\n&quot;);<br>
+#endif<br>
+#ifdef CONFIG_RSA_PSS_SIGN_TR_TEST<br>
+=C2=A0 puts(&quot;running rsa_pss_sign_tr_test ___________________________=
________________________&quot;);<br>
+=C2=A0 rsa_pss_sign_tr_test();<br>
+=C2=A0 puts(&quot;rsa_pss_sign_tr_test is complete _______________________=
________________________\n&quot;);<br>
+#endif<br>
+#ifdef CONFIG_RSA_SEC_DECRYPT_TEST<br>
+=C2=A0 puts(&quot;running rsa_sec_decrypt_test ___________________________=
________________________&quot;);<br>
+=C2=A0 rsa_sec_decrypt_test();<br>
+=C2=A0 puts(&quot;rsa_sec_decrypt_test is complete _______________________=
________________________\n&quot;);<br>
+#endif<br>
+#ifdef CONFIG_RSA_SIGN_TR_TEST<br>
+=C2=A0 puts(&quot;running rsa_sign_tr_test _______________________________=
________________________&quot;);<br>
+=C2=A0 rsa_sign_tr_test();<br>
+=C2=A0 puts(&quot;rsa_sign_tr_test is complete ___________________________=
________________________\n&quot;);<br>
+#endif<br>
+#ifdef CONFIG_RSA_TEST<br>
+=C2=A0 puts(&quot;running rsa_test _______________________________________=
________________________&quot;);<br>
+=C2=A0 rsa_test();<br>
+=C2=A0 puts(&quot;rsa_test is complete ___________________________________=
________________________\n&quot;);<br>
+#endif<br>
+#ifdef CONFIG_RSA2SEXP_TEST<br>
+=C2=A0 puts(&quot;running rsa2sexp_test __________________________________=
________________________&quot;);<br>
+=C2=A0 rsa2sexp_test();<br>
+=C2=A0 puts(&quot;rsa2sexp_test is complete ______________________________=
________________________\n&quot;);<br>
+#endif<br>
+#ifdef CONFIG_SEXP2RSA_TEST<br>
+=C2=A0 puts(&quot;running sexp2rsa_test __________________________________=
________________________&quot;);<br>
+=C2=A0 sexp2rsa_test();<br>
+=C2=A0 puts(&quot;sexp2rsa_test is complete ______________________________=
________________________\n&quot;);<br>
+#endif<br>
+#ifdef CONFIG_CURVE25519_DH_TEST<br>
+=C2=A0 puts(&quot;running curve25519_dh_test _____________________________=
________________________&quot;);<br>
+=C2=A0 curve25519_dh_test();<br>
+=C2=A0 puts(&quot;curve25519_dh_test is complete _________________________=
________________________\n&quot;);<br>
+#endif<br>
+#ifdef CONFIG_CURVE448_DH_TEST<br>
+=C2=A0 puts(&quot;running curve448_dh_test _______________________________=
________________________&quot;);<br>
+=C2=A0 curve448_dh_test();<br>
+=C2=A0 puts(&quot;curve448_dh_test is complete ___________________________=
________________________\n&quot;);<br>
+#endif<br>
+#ifdef CONFIG_DSA_KEYGEN_TEST<br>
+=C2=A0 puts(&quot;running dsa_keygen_test ________________________________=
________________________&quot;);<br>
+=C2=A0 dsa_keygen_test();<br>
+=C2=A0 puts(&quot;dsa_keygen_test is complete ____________________________=
________________________\n&quot;);<br>
+#endif<br>
+#ifdef CONFIG_DSA_TEST<br>
+=C2=A0 puts(&quot;running dsa_test _______________________________________=
________________________&quot;);<br>
+=C2=A0 dsa_test();<br>
+=C2=A0 puts(&quot;dsa_test is complete ___________________________________=
________________________\n&quot;);<br>
+#endif<br>
+#ifdef CONFIG_ECDSA_KEYGEN_TEST<br>
+=C2=A0 puts(&quot;running ecdsa_keygen_test ______________________________=
________________________&quot;);<br>
+=C2=A0 ecdsa_keygen_test();<br>
+=C2=A0 puts(&quot;ecdsa_keygen_test is complete __________________________=
________________________\n&quot;);<br>
+#endif<br>
+#ifdef CONFIG_ECDSA_SIGN_TEST<br>
+=C2=A0 puts(&quot;running ecdsa_sign_test ________________________________=
________________________&quot;);<br>
+=C2=A0 ecdsa_sign_test();<br>
+=C2=A0 puts(&quot;ecdsa_sign_test is complete ____________________________=
________________________\n&quot;);<br>
+#endif<br>
+#ifdef CONFIG_ECDSA_VERIFY_TEST<br>
+=C2=A0 puts(&quot;running ecdsa_verify_test ______________________________=
________________________&quot;);<br>
+=C2=A0 ecdsa_verify_test();<br>
+=C2=A0 puts(&quot;ecdsa_verify_test is complete __________________________=
________________________\n&quot;);<br>
+#endif<br>
+#ifdef CONFIG_EDDSA_COMPRESS_TEST<br>
+=C2=A0 puts(&quot;running eddsa_compress_test ____________________________=
________________________&quot;);<br>
+=C2=A0 eddsa_compress_test();<br>
+=C2=A0 puts(&quot;eddsa_compress_test is complete ________________________=
________________________\n&quot;);<br>
+#endif<br>
+#ifdef CONFIG_EDDSA_SIGN_TEST<br>
+=C2=A0 puts(&quot;running eddsa_sign_test ________________________________=
________________________&quot;);<br>
+=C2=A0 eddsa_sign_test();<br>
+=C2=A0 puts(&quot;eddsa_sign_test is complete ____________________________=
________________________\n&quot;);<br>
+#endif<br>
+#ifdef CONFIG_EDDSA_VERIFY_TEST<br>
+=C2=A0 puts(&quot;running eddsa_verify_test ______________________________=
________________________&quot;);<br>
+=C2=A0 eddsa_verify_test();<br>
+=C2=A0 puts(&quot;eddsa_verify_test is complete __________________________=
________________________\n&quot;);<br>
+#endif<br>
+#ifdef CONFIG_GOSTDSA_KEYGEN_TEST<br>
+=C2=A0 puts(&quot;running gostdsa_keygen_test ____________________________=
________________________&quot;);<br>
+=C2=A0 gostdsa_keygen_test();<br>
+=C2=A0 puts(&quot;gostdsa_keygen_test is complete ________________________=
________________________\n&quot;);<br>
+#endif<br>
+#ifdef CONFIG_GOSTDSA_SIGN_TEST<br>
+=C2=A0 puts(&quot;running gostdsa_sign_test ______________________________=
________________________&quot;);<br>
+=C2=A0 gostdsa_sign_test();<br>
+=C2=A0 puts(&quot;gostdsa_sign_test is complete __________________________=
________________________\n&quot;);<br>
+#endif<br>
+#ifdef CONFIG_GOSTDSA_VERIFY_TEST<br>
+=C2=A0 puts(&quot;running gostdsa_verify_test ____________________________=
________________________&quot;);<br>
+=C2=A0 gostdsa_verify_test();<br>
+=C2=A0 puts(&quot;gostdsa_verify_test is complete ________________________=
________________________\n&quot;);<br>
+#endif<br>
+#ifdef CONFIG_GOSTDSA_VKO_TEST<br>
+=C2=A0 puts(&quot;running gostdsa_vko_test _______________________________=
________________________&quot;);<br>
+=C2=A0 gostdsa_vko_test();<br>
+=C2=A0 puts(&quot;gostdsa_vko_test is complete ___________________________=
________________________\n&quot;);<br>
+#endif<br>
+<br>
+<br>
+=C2=A0 tstring_clear();<br>
+=C2=A0 return EXIT_SUCCESS;<br>
+}<br>
+<br>
-- <br>
2.17.1<br>
<br>
</blockquote></div>

--000000000000a7f34a05b5e022ad--


From minios-devel-bounces@lists.xenproject.org Mon Dec 07 14:05:33 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Mon, 07 Dec 2020 14:05:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.46621.82727 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1kmH8u-0002GB-Bq; Mon, 07 Dec 2020 14:05:32 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 46621.82727; Mon, 07 Dec 2020 14:05: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 1kmH8u-0002G4-8a; Mon, 07 Dec 2020 14:05:32 +0000
Received: by outflank-mailman (input) for mailman id 46621;
 Mon, 07 Dec 2020 14:05:31 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=NPkr=FL=gmail.com=lrbarbulescu@srs-us1.protection.inumbo.net>)
 id 1kmH8t-0002Fx-MA
 for minios-devel@lists.xen.org; Mon, 07 Dec 2020 14:05:31 +0000
Received: from mail-lj1-x22f.google.com (unknown [2a00:1450:4864:20::22f])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id c548a5e7-bef7-466c-a1de-c2fc4db981c6;
 Mon, 07 Dec 2020 14:05:26 +0000 (UTC)
Received: by mail-lj1-x22f.google.com with SMTP id f11so3181042ljn.2
 for <minios-devel@lists.xen.org>; Mon, 07 Dec 2020 06:05:26 -0800 (PST)
X-BeenThere: minios-devel@lists.xenproject.org
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
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: c548a5e7-bef7-466c-a1de-c2fc4db981c6
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=zEeVqgturUE7MebGO49ULPouGHkBqtdTgg4+7TPJl2Y=;
        b=WmjPzAF+8uPdbIVrbxw7/zeFerMrEE5eImDAIyt9q3AqyMOV57J1NiXha0NMfjLk6j
         Uv09iYEWU8UWGqYk6/EMgbvJ1y6Yf6/2QQuiaT/krdG/e2103Lyxf9936e2XKZdLNOH2
         45ppRiWjIljf4XNiLAvs3hDQYGlMA1zjtheN+C7uxjwbKhquKsoN2BqtS28MS2qSwYsE
         tgfiz6b1f50ClBOKZAirfw3HkrB00e0lykSii0Ud4QMjOUODE+haw/Nuc/iPfAKfLijK
         GxplYNJChCNvevvlbH0N0YDcjFPJjK14K2Te/7NaaDFW5CPM4u2oW46zMd1uXY3SILQr
         Y1Mw==
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=zEeVqgturUE7MebGO49ULPouGHkBqtdTgg4+7TPJl2Y=;
        b=WZDPirixv+aL3YufCgm5JnEhGrBxWU+MBEmq7RBa/7/JwUPgiqaLc12svmW5GSOiyn
         9pTGRVgxFD7vTe1HmHbMCu/3tGEH/xlzUlVCL2hTQf6c0ng13VWLbg+oa5dWWKU0FVPB
         KF4r/g0I8QtNz8TgYQFdWNfgHsQXpW42Bliuv/2aTDBvNwmK4XDg3FaXcKWCjvz6m32q
         BLDjp7We9CAtEmn8M1xoX0DjwB90lMstKpXJ+Ta5QrInNwIlg6HNBm/zakP2OFfjXA4G
         xG+tbYT6xdCvluOMHWcepzMVrio2fKVgOvHBD7ZQruogEGBb1N/9nJnHoVEqLJYpzS2k
         Vy3Q==
X-Gm-Message-State: AOAM5325vLzVCh+AcpoLq+wSXl6HEES4W42LTf7NAeID6yhxNgQh50dM
	0CZipAX4MbCgnXzbpAxoFAniR2IpNeRB50Dy9hY=
X-Google-Smtp-Source: ABdhPJxYROJGSaj6gI5s92bg6QhufTsvybOsboA7PClQ4xrQXBHI9eN23WKK3TsfnWARbIJZx1rjnqJavn3UH7bHf4M=
X-Received: by 2002:a2e:b54b:: with SMTP id a11mr9127645ljn.40.1607349925472;
 Mon, 07 Dec 2020 06:05:25 -0800 (PST)
MIME-Version: 1.0
References: <cover.1607030251.git.dragosargint21@gmail.com> <fbc37140d325a0bc41b69700b1d2a724d3dac61f.1607030251.git.dragosargint21@gmail.com>
In-Reply-To: <fbc37140d325a0bc41b69700b1d2a724d3dac61f.1607030251.git.dragosargint21@gmail.com>
From: Laurentiu Barbulescu <lrbarbulescu@gmail.com>
Date: Mon, 7 Dec 2020 16:05:13 +0200
Message-ID: <CAMpNDKn-TEv_eDK=6pQ_6s6PbKdg+ptiJ-nu0niu2VGcGwc+_g@mail.gmail.com>
Subject: Re: [UNIKRAFT/LIBHOGWEED v3 2/3] Add Makefile.uk and Config.uk
To: ARGINT DRAGOS IULIAN <dragosargint21@gmail.com>
Cc: minios-devel@lists.xen.org, felipe.huici@neclab.eu
Content-Type: multipart/alternative; boundary="000000000000566f7d05b5e051f5"

--000000000000566f7d05b5e051f5
Content-Type: text/plain; charset="UTF-8"

Hi Dragos,

Looks good to me.

Reviewed-by: Laurentiu Barbulescu <lrbarbulescu@gmail.com>

On Thu, Dec 3, 2020 at 11:21 PM ARGINT DRAGOS IULIAN <
dragosargint21@gmail.com> wrote:

> Signed-off-by: ARGINT DRAGOS IULIAN <dragosargint21@gmail.com>
> ---
>  Config.uk   |  83 +++++++++
>  Makefile.uk | 490 ++++++++++++++++++++++++++++++++++++++++++++++++++++
>  2 files changed, 573 insertions(+)
>  create mode 100644 Config.uk
>  create mode 100644 Makefile.uk
>
> diff --git a/Config.uk b/Config.uk
> new file mode 100644
> index 0000000..7f422ee
> --- /dev/null
> +++ b/Config.uk
> @@ -0,0 +1,83 @@
> +config LIBHOGWEED
> +       bool "libhogweed - Public-key algorithms"
> +       default n
> +       select LIBNEWLIBC
> +
> +if LIBHOGWEED
> +       menuconfig TESTSUITE
> +               bool "testsuite - tests for libhogweed"
> +               default n
> +               if TESTSUITE
> +                       config RSA_COMPUTE_ROOT_TEST
> +                               bool "rsa-compute-root-test"
> +                               default y
> +                       config RSA_ENCRYPT_TEST
> +                               bool "rsa-encrypt-test"
> +                               default y
> +                       config RSA_KEYGEN_TEST
> +                               bool "rsa-keygen-test"
> +                               default y
> +                       config RSA_PSS_SIGN_TR_TEST
> +                               bool "rsa-pss-sign-tr-test"
> +                               default y
> +                       config RSA_SEC_DECRYPT_TEST
> +                               bool "rsa-sec-decrypt-test"
> +                               default y
> +                       config RSA_SIGN_TR_TEST
> +                               bool "rsa-sign-tr-test"
> +                               default y
> +                       config RSA_TEST
> +                               bool "rsa-test"
> +                               default y
> +                       config RSA2SEXP_TEST
> +                               bool "rsa2sexp-test"
> +                               default y
> +                       config SEXP2RSA_TEST
> +                               bool "sexp2rsa-test"
> +                               default y
> +                       config CURVE25519_DH_TEST
> +                               bool "curve25519-dh-test"
> +                               default y
> +                       config CURVE448_DH_TEST
> +                               bool "curve448-dh-test"
> +                               default y
> +                       config DSA_KEYGEN_TEST
> +                               bool "dsa-keygen-test"
> +                               default y
> +                       config DSA_TEST
> +                               bool "dsa-test"
> +                               default y
> +                       config ECDSA_KEYGEN_TEST
> +                               bool "ecdsa-keygen-test"
> +                               default y
> +                       config ECDSA_SIGN_TEST
> +                               bool "ecdsa-sign-test"
> +                               default y
> +                       config ECDSA_VERIFY_TEST
> +                               bool "ecdsa-verify-test"
> +                               default y
> +                       config EDDSA_COMPRESS_TEST
> +                               bool "eddsa-compress-test"
> +                               default y
> +                       config EDDSA_SIGN_TEST
> +                               bool "eddsa-sign-test"
> +                               default y
> +                       config EDDSA_VERIFY_TEST
> +                               bool "eddsa-verify-test"
> +                               default y
> +                       config GOSTDSA_KEYGEN_TEST
> +                               bool "gostdsa-keygen-test"
> +                               default y
> +                       config GOSTDSA_SIGN_TEST
> +                               bool "gostdsa-sign-test"
> +                               default y
> +                       config GOSTDSA_VERIFY_TEST
> +                               bool "gostdsa-verify-test"
> +                               default y
> +                       config GOSTDSA_VKO_TEST
> +                               bool "gostdsa-vko-test"
> +                               default y
> +       endif
> +endif
> +
> +
> diff --git a/Makefile.uk b/Makefile.uk
> new file mode 100644
> index 0000000..666f31b
> --- /dev/null
> +++ b/Makefile.uk
> @@ -0,0 +1,490 @@
> +#  SPDX-License-Identifier: BSD-3-Clause
> +#
> +#  libhogweed Makefile.uk
> +#
> +#  Authors: Argint Dragos Iulian <dragosargint21@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.
> +#
> +
>
> +################################################################################
> +# Library registration
>
> +################################################################################
> +$(eval $(call addlib_s,libhogweed,$(CONFIG_LIBHOGWEED)))
> +#$(eval $(call addlib_s,libhogweedglue,$(CONFIG_LIBHOGWEED)))
> +
>
> +################################################################################
> +# Original sources
>
> +################################################################################
> +LIBHOGWEED_VERSION=3.6
> +LIBHOGWEED_URL=
> https://ftp.gnu.org/gnu/nettle/nettle-$(LIBHOGWEED_VERSION).tar.gz
> +LIBHOGWEED_PATCHDIR=$(LIBHOGWEED_BASE)/patches
> +LIBHOGWEED_SUBDIR=nettle-$(LIBHOGWEED_VERSION)
> +$(eval $(call fetch,libhogweed,$(LIBHOGWEED_URL)))
> +#$(eval $(call
> patch,libhogweed,$(LIBHOHWEED_PATCHDIR),$(LIBHOGWEED_SUBDIR)))
> +
>
> +################################################################################
> +# Helpers
>
> +################################################################################
> +LIBHOGWEED_EXTRACTED = $(LIBHOGWEED_ORIGIN)/nettle-$(LIBHOGWEED_VERSION)
> +
>
> +################################################################################
> +# Library includes
>
> +################################################################################
> +LIBHOGWEED_COMMON_INCLUDES-y     += -I$(LIBHOGWEED_BASE)/include
> +LIBHOGWEED_COMMON_INCLUDES-y     += -I$(LIBHOGWEED_EXTRACTED)
> +LIBHOGWEED_COMMON_INCLUDES-y     += -I$(LIBHOGWEED_EXTRACTED)/testsuite
> +CINCLUDES-$(CONFIG_LIBHOGWEED)   += $(LIBHOGWEED_COMMON_INCLUDES-y)
> +CXXINCLUDES-$(CONFIG_LIBHOGWEED) += $(LIBHOGWEED_COMMON_INCLUDES-y)
> +
> +LIBHOGWEED_CINCLUDES   += -I$(LIBHOGWEED_EXTRACTED)
> +LIBHOGWEED_CXXINCLUDES += -I$(LIBHOGWEED_EXTRACTED)
> +
>
> +################################################################################
> +# Global flags
>
> +################################################################################
> +# Suppress flags
> +LIBHOGWEED_SUPPRESS_FLAGS += -Wno-unused-parameter \
> +        -Wno-unused-variable -Wno-unused-value -Wno-unused-function \
> +        -Wno-missing-field-initializers -Wno-implicit-fallthrough \
> +        -Wno-sign-compare
> +LIBHOGWEED_CFLAGS-y   += $(LIBHOGWEED_SUPPRESS_FLAGS) \
> +        -Wno-pointer-to-int-cast -Wno-int-to-pointer-cast
> +LIBHOGWEED_CXXFLAGS-y += $(LIBHOGWEED_SUPPRESS_FLAGS)
> +
> +# Preprocessing symbols
> +LIBHOGWEED_DEFINES    += -DHAVE_CONFIG_H
> +LIBHOGWEED_CFLAGS-y   += $(LIBHOGWEED_DEFINES)
> +LIBHOGWEED_CXXFLAGS-y += $(LIBHOGWEED_DEFINES)
> +
>
> +################################################################################
> +# HOGWEED code -- bignum
>
> +################################################################################
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/bignum.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/bignum-random.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/bignum-random-prime.c
> +
>
> +################################################################################
> +# HOGWEED code -- yarrow
>
> +################################################################################
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/yarrow256.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/yarrow_key_event.c
> +
>
> +################################################################################
> +# HOGWEED code -- gmp
>
> +################################################################################
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/mini-gmp.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/gmp-glue.c
> +
>
> +################################################################################
> +# HOGWEED code -- aes
>
> +################################################################################
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/aes-encrypt.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/aes-decrypt.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/aes-encrypt-internal.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/aes-encrypt-table.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/aes-decrypt-internal.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/aes-set-key-internal.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/aes256-set-encrypt-key.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/aes256-set-decrypt-key.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/aes-invert-internal.c
> +
>
> +################################################################################
> +# HOGWEED code -- sha
>
> +################################################################################
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/sha1.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/sha1-meta.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/sha1-compress.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/sha256.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/sha256-meta.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/sha256-compress.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/sha512.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/sha512-meta.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/sha512-compress.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/sha3.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/sha3-permute.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/sha3-256.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/sha384-meta.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/sha224-meta.c
> +
>
> +################################################################################
> +# HOGWEED code -- md5
>
> +################################################################################
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/md5.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/md5-compress.c
> +
>
> +################################################################################
> +# HOGWEED code -- write
>
> +################################################################################
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/write-be32.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/write-le32.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/write-le64.c
> +
>
> +################################################################################
> +# HOGWEED code -- buffer
>
> +################################################################################
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/buffer.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/buffer-init.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/realloc.c
> +
>
> +################################################################################
> +# HOGWEED code -- rsa
>
> +################################################################################
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/rsa.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/rsa-sign.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/rsa-sign-tr.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/rsa-keygen.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/rsa-encrypt.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/rsa-decrypt.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/rsa-decrypt-tr.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/rsa-verify.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/rsa-sha1-sign.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/rsa-sha1-sign-tr.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/rsa-sha1-verify.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/rsa-md5-sign.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/rsa-md5-sign-tr.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/rsa-md5-verify.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/rsa-pss-sha256-sign-tr.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/rsa-pss-sha256-verify.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/rsa-pss-sha512-sign-tr.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/rsa-pss-sha512-verify.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/rsa-pkcs1-sign.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/rsa-pkcs1-sign-tr.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/rsa-pkcs1-verify.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/rsa-sha256-sign.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/rsa-sha256-sign-tr.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/rsa-sha256-verify.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/rsa-sha512-sign.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/rsa-sha512-sign-tr.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/rsa-sha512-verify.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/rsa-sec-decrypt.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/rsa-sec-compute-root.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/rsa2sexp.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/rsa-blind.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/rsa2openpgp.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/pgp-encode.c
> +
>
> +################################################################################
> +# HOGWEED code -- pss
>
> +################################################################################
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/pss.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/pss-mgf1.c
> +
>
> +################################################################################
> +# HOGWEED code -- pkcs
>
> +################################################################################
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/pkcs1.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/pkcs1-encrypt.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/pkcs1-decrypt.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/pkcs1-sec-decrypt.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/pkcs1-rsa-sha1.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/pkcs1-rsa-sha256.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/pkcs1-rsa-sha512.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/pkcs1-rsa-digest.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/pkcs1-rsa-md5.c
> +
>
> +################################################################################
> +# HOGWEED code -- dsa
>
> +################################################################################
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/dsa.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/dsa-sign.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/dsa-hash.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/dsa-verify.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/dsa-keygen.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/dsa-compat.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/dsa-compat-keygen.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/dsa-gen-params.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/dsa-sha1-sign.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/dsa-sha1-verify.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/dsa-sha256-sign.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/dsa-sha256-verify.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/dsa2sexp.c
> +
>
> +################################################################################
> +# HOGWEED code -- ecdsa
>
> +################################################################################
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/ecdsa-keygen.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/ecdsa-sign.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/ecdsa-verify.c
> +
>
> +################################################################################
> +# HOGWEED code -- ecc
>
> +################################################################################
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/ecc-a-to-j.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/ecc-add-eh.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/ecc-add-ehh.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/ecc-add-jja.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/ecc-add-jjj.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/ecc-add-th.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/ecc-add-thh.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/ecc-curve25519-modp.s
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/ecc-curve25519.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/ecc-curve448-modp.s
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/ecc-curve448.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/ecc-dup-eh.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/ecc-dup-jj.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/ecc-dup-th.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/ecc-ecdsa-sign.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/ecc-ecdsa-verify.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/ecc-eh-to-a.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/ecc-gost-gc256b.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/ecc-gost-gc512a.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/ecc-gostdsa-sign.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/ecc-gostdsa-verify.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/ecc-hash.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/ecc-j-to-a.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/ecc-mod-arith.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/ecc-mod-inv.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/ecc-mod.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/ecc-mul-a-eh.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/ecc-mul-a.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/ecc-mul-g-eh.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/ecc-mul-g.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/ecc-mul-m.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/ecc-point.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/ecc-random.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/ecc-scalar.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/ecc-secp192r1-modp.s
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/ecc-secp192r1.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/ecc-secp224r1-modp.s
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/ecc-secp224r1.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/ecc-secp256r1-redc.s
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/ecc-secp256r1.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/ecc-secp384r1-modp.s
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/ecc-secp384r1.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/ecc-secp521r1-modp.s
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/ecc-secp521r1.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/ecc-size.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/sec-add-1.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/sec-tabselect.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/cnd-copy.c
> +
>
> +################################################################################
> +# HOGWEED code -- curve
>
> +################################################################################
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/curve25519-mul.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/curve25519-mul-g.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/curve25519-eh-to-x.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/curve448-mul.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/curve448-mul-g.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/curve448-eh-to-x.c
> +
>
> +################################################################################
> +# HOGWEED code -- gostdsa
>
> +################################################################################
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/gostdsa-sign.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/gostdsa-verify.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/gostdsa-vko.c
> +
>
> +################################################################################
> +# HOGWEED code -- eddsa
>
> +################################################################################
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/eddsa-compress.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/eddsa-decompress.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/eddsa-sign.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/eddsa-verify.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/eddsa-expand.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/eddsa-hash.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/eddsa-pubkey.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/ed25519-sha512.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/ed448-shake256.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/shake256.c
> +
>
> +################################################################################
> +# HOGWEED code -- sexp
>
> +################################################################################
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/sexp.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/sexp2rsa.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/sexp-format.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/sexp2bignum.c
> +#LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/sexp-transport-format.c
> +
>
> +################################################################################
> +# HOGWEED code -- hex encoding
>
> +################################################################################
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/base16-encode.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/base16-decode.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/base64-encode.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/base64-decode.c
> +
>
> +################################################################################
> +# HOGWEED code -- miscellaneous
>
> +################################################################################
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/knuth-lfib.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/hmac.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/hmac-sha1.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/memxor.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/memxor3.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/cnd-memcpy.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/memeql-sec.c
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/cbc.c
> +
>
> +################################################################################
> +# HOGWEED code -- tests
>
> +################################################################################
> +LIBHOGWEED_SRCS-$(CONFIG_TESTSUITE) += $(LIBHOGWEED_BASE)/testutils_glue.c
> +ifeq ($(CONFIG_RSA_COMPUTE_ROOT_TEST),y)
> +LIBHOGWEED_SRCS-y +=
> $(LIBHOGWEED_EXTRACTED)/testsuite/rsa-compute-root-test.c
> +LIBHOGWEED_RSA-COMPUTE-ROOT-TEST_FLAGS-y +=
> -Dtest_main=rsa_compute_root_test
> +endif
> +ifeq ($(CONFIG_RSA_ENCRYPT_TEST),y)
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/testsuite/rsa-encrypt-test.c
> +LIBHOGWEED_RSA-ENCRYPT-TEST_FLAGS-y += -Dtest_main=rsa_encrypt_test
> +endif
> +ifeq ($(CONFIG_RSA_KEYGEN_TEST),y)
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/testsuite/rsa-keygen-test.c
> +LIBHOGWEED_RSA-KEYGEN-TEST_FLAGS-y += -Dtest_main=rsa_keygen_test
> +endif
> +ifeq ($(CONFIG_RSA_PSS_SIGN_TR_TEST),y)
> +LIBHOGWEED_SRCS-y +=
> $(LIBHOGWEED_EXTRACTED)/testsuite/rsa-pss-sign-tr-test.c
> +LIBHOGWEED_RSA-PSS-SIGN-TR-TEST_FLAGS-y +=
> -Dtest_main=rsa_pss_sign_tr_test
> +endif
> +ifeq ($(CONFIG_RSA_SEC_DECRYPT_TEST),y)
> +LIBHOGWEED_SRCS-y +=
> $(LIBHOGWEED_EXTRACTED)/testsuite/rsa-sec-decrypt-test.c
> +LIBHOGWEED_RSA-SEC-DECRYPT-TEST_FLAGS-y +=
> -Dtest_main=rsa_sec_decrypt_test
> +endif
> +ifeq ($(CONFIG_RSA_SIGN_TR_TEST),y)
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/testsuite/rsa-sign-tr-test.c
> +LIBHOGWEED_RSA-SIGN-TR-TEST_FLAGS-y += -Dtest_main=rsa_sign_tr_test
> +endif
> +ifeq ($(CONFIG_RSA_TEST),y)
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/testsuite/rsa-test.c
> +LIBHOGWEED_RSA-TEST_FLAGS-y += -Dtest_main=rsa_test
> +endif
> +ifeq ($(CONFIG_RSA2SEXP_TEST),y)
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/testsuite/rsa2sexp-test.c
> +LIBHOGWEED_RSA2SEXP-TEST_FLAGS-y += -Dtest_main=rsa2sexp_test
> +endif
> +ifeq ($(CONFIG_SEXP2RSA_TEST),y)
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/testsuite/sexp2rsa-test.c
> +LIBHOGWEED_SEXP2RSA-TEST_FLAGS-y += -Dtest_main=sexp2rsa_test
> +endif
> +ifeq ($(CONFIG_CURVE25519_DH_TEST),y)
> +LIBHOGWEED_SRCS-y +=
> $(LIBHOGWEED_EXTRACTED)/testsuite/curve25519-dh-test.c
> +LIBHOGWEED_CURVE25519-DH-TEST_FLAGS-y += -Dtest_main=curve25519_dh_test
> +endif
> +ifeq ($(CONFIG_CURVE448_DH_TEST),y)
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/testsuite/curve448-dh-test.c
> +LIBHOGWEED_CURVE448-DH-TEST_FLAGS-y += -Dtest_main=curve448_dh_test
> +endif
> +ifeq ($(CONFIG_DSA_KEYGEN_TEST),y)
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/testsuite/dsa-keygen-test.c
> +LIBHOGWEED_DSA-KEYGEN-TEST_FLAGS-y += -Dtest_main=dsa_keygen_test
> +endif
> +ifeq ($(CONFIG_DSA_TEST),y)
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/testsuite/dsa-test.c
> +LIBHOGWEED_DSA-TEST_FLAGS-y += -Dtest_main=dsa_test
> +endif
> +ifeq ($(CONFIG_ECDSA_KEYGEN_TEST),y)
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/testsuite/ecdsa-keygen-test.c
> +LIBHOGWEED_ECDSA-KEYGEN-TEST_FLAGS-y += -Dtest_main=ecdsa_keygen_test
> +endif
> +ifeq ($(CONFIG_ECDSA_SIGN_TEST),y)
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/testsuite/ecdsa-sign-test.c
> +LIBHOGWEED_ECDSA-SIGN-TEST_FLAGS-y += -Dtest_main=ecdsa_sign_test
> +endif
> +ifeq ($(CONFIG_ECDSA_VERIFY_TEST),y)
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/testsuite/ecdsa-verify-test.c
> +LIBHOGWEED_ECDSA-VERIFY-TEST_FLAGS-y += -Dtest_main=ecdsa_verify_test
> +endif
> +ifeq ($(CONFIG_EDDSA_COMPRESS_TEST),y)
> +LIBHOGWEED_SRCS-y +=
> $(LIBHOGWEED_EXTRACTED)/testsuite/eddsa-compress-test.c
> +LIBHOGWEED_EDDSA-COMPRESS-TEST_FLAGS-y += -Dtest_main=eddsa_compress_test
> +endif
> +ifeq ($(CONFIG_EDDSA_SIGN_TEST),y)
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/testsuite/eddsa-sign-test.c
> +LIBHOGWEED_EDDSA-SIGN-TEST_FLAGS-y += -Dtest_main=eddsa_sign_test
> +endif
> +ifeq ($(CONFIG_EDDSA_VERIFY_TEST),y)
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/testsuite/eddsa-verify-test.c
> +LIBHOGWEED_EDDSA-VERIFY-TEST_FLAGS-y += -Dtest_main=eddsa_verify_test
> +endif
> +ifeq ($(CONFIG_GOSTDSA_KEYGEN_TEST),y)
> +LIBHOGWEED_SRCS-y +=
> $(LIBHOGWEED_EXTRACTED)/testsuite/gostdsa-keygen-test.c
> +LIBHOGWEED_GOSTDSA-KEYGEN-TEST_FLAGS-y += -Dtest_main=gostdsa_keygen_test
> +endif
> +ifeq ($(CONFIG_GOSTDSA_SIGN_TEST),y)
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/testsuite/gostdsa-sign-test.c
> +LIBHOGWEED_GOSTDSA-SIGN-TEST_FLAGS-y += -Dtest_main=gostdsa_sign_test
> +endif
> +ifeq ($(CONFIG_GOSTDSA_VERIFY_TEST),y)
> +LIBHOGWEED_SRCS-y +=
> $(LIBHOGWEED_EXTRACTED)/testsuite/gostdsa-verify-test.c
> +LIBHOGWEED_GOSTDSA-VERIFY-TEST_FLAGS-y += -Dtest_main=gostdsa_verify_test
> +endif
> +ifeq ($(CONFIG_GOSTDSA_VKO_TEST),y)
> +LIBHOGWEED_SRCS-y += $(LIBHOGWEED_EXTRACTED)/testsuite/gostdsa-vko-test.c
> +LIBHOGWEED_GOSTDSA-VKO-TEST_FLAGS-y += -Dtest_main=gostdsa_vko_test
> +endif
> +
> +
> +
>
> +################################################################################
> +# HOGWEED prepare
>
> +################################################################################
> +# Run ./configure
> +$(LIBHOGWEED_EXTRACTED)/config.h: $(LIBHOGWEED_BUILD)/.origin
> +       $(call verbose_cmd,CONFIG,libhogweed: $(notdir $@), \
> +        cd $(LIBHOGWEED_EXTRACTED) && ./configure --enable-mini-gmp \
> +    )
> +
> +# Generate auxiliar files using the original building system
> +$(LIBHOGWEED_EXTRACTED)/make_auxiliar: $(LIBHOGWEED_BUILD)/.origin
> +       $(call verbose_cmd,CONFIG,libhogweed: $(notdir $@), \
> +        cd $(LIBHOGWEED_EXTRACTED) && \
> +        make ecc-secp192r1.h && \
> +        make ecc-secp224r1.h && \
> +        make ecc-secp256r1.h && \
> +               make ecc-secp384r1.h && \
> +        make ecc-secp521r1.h && \
> +        make ecc-curve25519.h && \
> +        make ecc-curve448.h && \
> +        make ecc-gost-gc256b.h && \
> +        make ecc-gost-gc512a.h && \
> +        /usr/bin/m4 ./asm.m4 machine.m4 config.m4 ecc-curve25519-modp.asm
> \
> +               > ecc-curve25519-modp.s && \
> +        /usr/bin/m4 ./asm.m4 machine.m4 config.m4 ecc-curve448-modp.asm \
> +               > ecc-curve448-modp.s && \
> +        /usr/bin/m4 ./asm.m4 machine.m4 config.m4 ecc-secp192r1-modp.asm \
> +               > ecc-secp192r1-modp.s && \
> +        /usr/bin/m4 ./asm.m4 machine.m4 config.m4 ecc-secp224r1-modp.asm \
> +            > ecc-secp224r1-modp.s && \
> +        /usr/bin/m4 ./asm.m4 machine.m4 config.m4 ecc-secp256r1-redc.asm \
> +               > ecc-secp256r1-redc.s && \
> +        /usr/bin/m4 ./asm.m4 machine.m4 config.m4 ecc-secp384r1-modp.asm \
> +               > ecc-secp384r1-modp.s && \
> +        /usr/bin/m4 ./asm.m4 machine.m4 config.m4 ecc-secp521r1-modp.asm \
> +               > ecc-secp521r1-modp.s && \
> +        echo "done" > make_auxiliar \
> +    )
> +
> +LIBHOGWEED_PREPARED_DEPS = $(LIBHOGWEED_EXTRACTED)/config.h \
> +
>  $(LIBHOGWEED_EXTRACTED)/make_auxiliar
> +
> +$(LIBHOGWEED_BUILD)/.prepared: $(LIBHOGWEED_PREPARED_DEPS)
> +
> +UK_PREPARE += $(LIBHOGWEED_BUILD)/.prepared
> --
> 2.17.1
>
>

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

<div dir=3D"ltr">Hi Dragos,<div><br></div><div><span style=3D"color:rgb(80,=
0,80)">Looks good to me.</span></div><div><br></div><div>Reviewed-by: Laure=
ntiu Barbulescu &lt;<a href=3D"mailto:lrbarbulescu@gmail.com" target=3D"_bl=
ank">lrbarbulescu@gmail.com</a>&gt;</div></div><br><div class=3D"gmail_quot=
e"><div dir=3D"ltr" class=3D"gmail_attr">On Thu, Dec 3, 2020 at 11:21 PM AR=
GINT DRAGOS IULIAN &lt;<a href=3D"mailto:dragosargint21@gmail.com">dragosar=
gint21@gmail.com</a>&gt; wrote:<br></div><blockquote class=3D"gmail_quote" =
style=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);pa=
dding-left:1ex">Signed-off-by: ARGINT DRAGOS IULIAN &lt;<a href=3D"mailto:d=
ragosargint21@gmail.com" target=3D"_blank">dragosargint21@gmail.com</a>&gt;=
<br>
---<br>
=C2=A0Config.uk=C2=A0 =C2=A0|=C2=A0 83 +++++++++<br>
=C2=A0Makefile.uk | 490 +++++++++++++++++++++++++++++++++++++++++++++++++++=
+<br>
=C2=A02 files changed, 573 insertions(+)<br>
=C2=A0create mode 100644 Config.uk<br>
=C2=A0create mode 100644 Makefile.uk<br>
<br>
diff --git a/Config.uk b/Config.uk<br>
new file mode 100644<br>
index 0000000..7f422ee<br>
--- /dev/null<br>
+++ b/Config.uk<br>
@@ -0,0 +1,83 @@<br>
+config LIBHOGWEED<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0bool &quot;libhogweed - Public-key algorithms&q=
uot;<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0default n<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0select LIBNEWLIBC<br>
+<br>
+if LIBHOGWEED<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0menuconfig TESTSUITE<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0bool &quot;testsuit=
e - tests for libhogweed&quot;<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0default n<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0if TESTSUITE<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0config RSA_COMPUTE_ROOT_TEST<br>
+=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=A0bool &quot;rsa-compute-root-test&quot=
;<br>
+=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=A0default y<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0config RSA_ENCRYPT_TEST<br>
+=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=A0bool &quot;rsa-encrypt-test&quot;<br>
+=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=A0default y<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0config RSA_KEYGEN_TEST<br>
+=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=A0bool &quot;rsa-keygen-test&quot;<br>
+=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=A0default y<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0config RSA_PSS_SIGN_TR_TEST<br>
+=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=A0bool &quot;rsa-pss-sign-tr-test&quot;=
<br>
+=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=A0default y<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0config RSA_SEC_DECRYPT_TEST<br>
+=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=A0bool &quot;rsa-sec-decrypt-test&quot;=
<br>
+=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=A0default y<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0config RSA_SIGN_TR_TEST<br>
+=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=A0bool &quot;rsa-sign-tr-test&quot;<br>
+=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=A0default y<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0config RSA_TEST<br>
+=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=A0bool &quot;rsa-test&quot;<br>
+=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=A0default y<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0config RSA2SEXP_TEST<br>
+=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=A0bool &quot;rsa2sexp-test&quot;<br>
+=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=A0default y<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0config SEXP2RSA_TEST<br>
+=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=A0bool &quot;sexp2rsa-test&quot;<br>
+=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=A0default y<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0config CURVE25519_DH_TEST<br>
+=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=A0bool &quot;curve25519-dh-test&quot;<b=
r>
+=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=A0default y<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0config CURVE448_DH_TEST<br>
+=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=A0bool &quot;curve448-dh-test&quot;<br>
+=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=A0default y<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0config DSA_KEYGEN_TEST<br>
+=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=A0bool &quot;dsa-keygen-test&quot;<br>
+=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=A0default y<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0config DSA_TEST<br>
+=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=A0bool &quot;dsa-test&quot;<br>
+=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=A0default y<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0config ECDSA_KEYGEN_TEST<br>
+=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=A0bool &quot;ecdsa-keygen-test&quot;<br=
>
+=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=A0default y<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0config ECDSA_SIGN_TEST<br>
+=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=A0bool &quot;ecdsa-sign-test&quot;<br>
+=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=A0default y<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0config ECDSA_VERIFY_TEST<br>
+=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=A0bool &quot;ecdsa-verify-test&quot;<br=
>
+=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=A0default y<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0config EDDSA_COMPRESS_TEST<br>
+=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=A0bool &quot;eddsa-compress-test&quot;<=
br>
+=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=A0default y<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0config EDDSA_SIGN_TEST<br>
+=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=A0bool &quot;eddsa-sign-test&quot;<br>
+=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=A0default y<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0config EDDSA_VERIFY_TEST<br>
+=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=A0bool &quot;eddsa-verify-test&quot;<br=
>
+=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=A0default y<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0config GOSTDSA_KEYGEN_TEST<br>
+=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=A0bool &quot;gostdsa-keygen-test&quot;<=
br>
+=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=A0default y<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0config GOSTDSA_SIGN_TEST<br>
+=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=A0bool &quot;gostdsa-sign-test&quot;<br=
>
+=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=A0default y<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0config GOSTDSA_VERIFY_TEST<br>
+=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=A0bool &quot;gostdsa-verify-test&quot;<=
br>
+=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=A0default y<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0config GOSTDSA_VKO_TEST<br>
+=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=A0bool &quot;gostdsa-vko-test&quot;<br>
+=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=A0default y<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0endif<br>
+endif<br>
+<br>
+<br>
diff --git a/Makefile.uk b/Makefile.uk<br>
new file mode 100644<br>
index 0000000..666f31b<br>
--- /dev/null<br>
+++ b/Makefile.uk<br>
@@ -0,0 +1,490 @@<br>
+#=C2=A0 SPDX-License-Identifier: BSD-3-Clause<br>
+#<br>
+#=C2=A0 libhogweed Makefile.uk<br>
+#<br>
+#=C2=A0 Authors: Argint Dragos Iulian &lt;<a href=3D"mailto:dragosargint21=
@gmail.com" target=3D"_blank">dragosargint21@gmail.com</a>&gt;<br>
+#<br>
+#=C2=A0 Copyright (c) 2020, University Politehnica of Bucharest. All right=
s reserved.<br>
+#<br>
+#=C2=A0 Redistribution and use in source and binary forms, with or without=
<br>
+#=C2=A0 modification, are permitted provided that the following conditions=
<br>
+#=C2=A0 are met:<br>
+#<br>
+#=C2=A0 1. Redistributions of source code must retain the above copyright<=
br>
+#=C2=A0 =C2=A0 =C2=A0notice, this list of conditions and the following dis=
claimer.<br>
+#=C2=A0 2. Redistributions in binary form must reproduce the above copyrig=
ht<br>
+#=C2=A0 =C2=A0 =C2=A0notice, this list of conditions and the following dis=
claimer in the<br>
+#=C2=A0 =C2=A0 =C2=A0documentation and/or other materials provided with th=
e distribution.<br>
+#=C2=A0 3. Neither the name of the copyright holder nor the names of its<b=
r>
+#=C2=A0 =C2=A0 =C2=A0contributors may be used to endorse or promote produc=
ts derived from<br>
+#=C2=A0 =C2=A0 =C2=A0this software without specific prior written permissi=
on.<br>
+#<br>
+#=C2=A0 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTOR=
S &quot;AS IS&quot;<br>
+#=C2=A0 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED =
TO, THE<br>
+#=C2=A0 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR=
 PURPOSE<br>
+#=C2=A0 ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBU=
TORS BE<br>
+#=C2=A0 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, O=
R<br>
+#=C2=A0 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT =
OF<br>
+#=C2=A0 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BU=
SINESS<br>
+#=C2=A0 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETH=
ER IN<br>
+#=C2=A0 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHER=
WISE)<br>
+#=C2=A0 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISE=
D OF THE<br>
+#=C2=A0 POSSIBILITY OF SUCH DAMAGE.<br>
+#<br>
+<br>
+##########################################################################=
######<br>
+# Library registration<br>
+##########################################################################=
######<br>
+$(eval $(call addlib_s,libhogweed,$(CONFIG_LIBHOGWEED)))<br>
+#$(eval $(call addlib_s,libhogweedglue,$(CONFIG_LIBHOGWEED)))<br>
+<br>
+##########################################################################=
######<br>
+# Original sources<br>
+##########################################################################=
######<br>
+LIBHOGWEED_VERSION=3D3.6<br>
+LIBHOGWEED_URL=3D<a href=3D"https://ftp.gnu.org/gnu/nettle/nettle-$(LIBHOG=
WEED_VERSION).tar.gz" rel=3D"noreferrer" target=3D"_blank">https://ftp.gnu.=
org/gnu/nettle/nettle-$(LIBHOGWEED_VERSION).tar.gz</a><br>
+LIBHOGWEED_PATCHDIR=3D$(LIBHOGWEED_BASE)/patches<br>
+LIBHOGWEED_SUBDIR=3Dnettle-$(LIBHOGWEED_VERSION)<br>
+$(eval $(call fetch,libhogweed,$(LIBHOGWEED_URL)))<br>
+#$(eval $(call patch,libhogweed,$(LIBHOHWEED_PATCHDIR),$(LIBHOGWEED_SUBDIR=
)))<br>
+<br>
+##########################################################################=
######<br>
+# Helpers<br>
+##########################################################################=
######<br>
+LIBHOGWEED_EXTRACTED =3D $(LIBHOGWEED_ORIGIN)/nettle-$(LIBHOGWEED_VERSION)=
<br>
+<br>
+##########################################################################=
######<br>
+# Library includes<br>
+##########################################################################=
######<br>
+LIBHOGWEED_COMMON_INCLUDES-y=C2=A0 =C2=A0 =C2=A0+=3D -I$(LIBHOGWEED_BASE)/=
include<br>
+LIBHOGWEED_COMMON_INCLUDES-y=C2=A0 =C2=A0 =C2=A0+=3D -I$(LIBHOGWEED_EXTRAC=
TED)<br>
+LIBHOGWEED_COMMON_INCLUDES-y=C2=A0 =C2=A0 =C2=A0+=3D -I$(LIBHOGWEED_EXTRAC=
TED)/testsuite<br>
+CINCLUDES-$(CONFIG_LIBHOGWEED)=C2=A0 =C2=A0+=3D $(LIBHOGWEED_COMMON_INCLUD=
ES-y)<br>
+CXXINCLUDES-$(CONFIG_LIBHOGWEED) +=3D $(LIBHOGWEED_COMMON_INCLUDES-y)<br>
+<br>
+LIBHOGWEED_CINCLUDES=C2=A0 =C2=A0+=3D -I$(LIBHOGWEED_EXTRACTED)<br>
+LIBHOGWEED_CXXINCLUDES +=3D -I$(LIBHOGWEED_EXTRACTED)<br>
+<br>
+##########################################################################=
######<br>
+# Global flags<br>
+##########################################################################=
######<br>
+# Suppress flags<br>
+LIBHOGWEED_SUPPRESS_FLAGS +=3D -Wno-unused-parameter \<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 -Wno-unused-variable -Wno-unused-value -Wno-un=
used-function \<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 -Wno-missing-field-initializers -Wno-implicit-=
fallthrough \<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 -Wno-sign-compare<br>
+LIBHOGWEED_CFLAGS-y=C2=A0 =C2=A0+=3D $(LIBHOGWEED_SUPPRESS_FLAGS) \<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 -Wno-pointer-to-int-cast -Wno-int-to-pointer-c=
ast<br>
+LIBHOGWEED_CXXFLAGS-y +=3D $(LIBHOGWEED_SUPPRESS_FLAGS)<br>
+<br>
+# Preprocessing symbols<br>
+LIBHOGWEED_DEFINES=C2=A0 =C2=A0 +=3D -DHAVE_CONFIG_H<br>
+LIBHOGWEED_CFLAGS-y=C2=A0 =C2=A0+=3D $(LIBHOGWEED_DEFINES)<br>
+LIBHOGWEED_CXXFLAGS-y +=3D $(LIBHOGWEED_DEFINES)<br>
+<br>
+##########################################################################=
######<br>
+# HOGWEED code -- bignum<br>
+##########################################################################=
######<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/bignum.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/bignum-random.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/bignum-random-prime.c<br>
+<br>
+##########################################################################=
######<br>
+# HOGWEED code -- yarrow<br>
+##########################################################################=
######<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/yarrow256.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/yarrow_key_event.c<br>
+<br>
+##########################################################################=
######<br>
+# HOGWEED code -- gmp<br>
+##########################################################################=
######<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/mini-gmp.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/gmp-glue.c<br>
+<br>
+##########################################################################=
######<br>
+# HOGWEED code -- aes<br>
+##########################################################################=
######<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/aes-encrypt.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/aes-decrypt.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/aes-encrypt-internal.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/aes-encrypt-table.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/aes-decrypt-internal.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/aes-set-key-internal.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/aes256-set-encrypt-key.c<br=
>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/aes256-set-decrypt-key.c<br=
>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/aes-invert-internal.c<br>
+<br>
+##########################################################################=
######<br>
+# HOGWEED code -- sha<br>
+##########################################################################=
######<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/sha1.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/sha1-meta.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/sha1-compress.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/sha256.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/sha256-meta.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/sha256-compress.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/sha512.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/sha512-meta.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/sha512-compress.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/sha3.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/sha3-permute.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/sha3-256.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/sha384-meta.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/sha224-meta.c<br>
+<br>
+##########################################################################=
######<br>
+# HOGWEED code -- md5<br>
+##########################################################################=
######<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/md5.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/md5-compress.c<br>
+<br>
+##########################################################################=
######<br>
+# HOGWEED code -- write<br>
+##########################################################################=
######<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/write-be32.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/write-le32.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/write-le64.c<br>
+<br>
+##########################################################################=
######<br>
+# HOGWEED code -- buffer<br>
+##########################################################################=
######<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/buffer.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/buffer-init.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/realloc.c<br>
+<br>
+##########################################################################=
######<br>
+# HOGWEED code -- rsa<br>
+##########################################################################=
######<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/rsa.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/rsa-sign.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/rsa-sign-tr.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/rsa-keygen.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/rsa-encrypt.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/rsa-decrypt.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/rsa-decrypt-tr.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/rsa-verify.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/rsa-sha1-sign.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/rsa-sha1-sign-tr.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/rsa-sha1-verify.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/rsa-md5-sign.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/rsa-md5-sign-tr.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/rsa-md5-verify.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/rsa-pss-sha256-sign-tr.c<br=
>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/rsa-pss-sha256-verify.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/rsa-pss-sha512-sign-tr.c<br=
>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/rsa-pss-sha512-verify.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/rsa-pkcs1-sign.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/rsa-pkcs1-sign-tr.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/rsa-pkcs1-verify.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/rsa-sha256-sign.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/rsa-sha256-sign-tr.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/rsa-sha256-verify.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/rsa-sha512-sign.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/rsa-sha512-sign-tr.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/rsa-sha512-verify.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/rsa-sec-decrypt.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/rsa-sec-compute-root.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/rsa2sexp.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/rsa-blind.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/rsa2openpgp.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/pgp-encode.c<br>
+<br>
+##########################################################################=
######<br>
+# HOGWEED code -- pss<br>
+##########################################################################=
######<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/pss.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/pss-mgf1.c<br>
+<br>
+##########################################################################=
######<br>
+# HOGWEED code -- pkcs<br>
+##########################################################################=
######<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/pkcs1.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/pkcs1-encrypt.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/pkcs1-decrypt.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/pkcs1-sec-decrypt.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/pkcs1-rsa-sha1.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/pkcs1-rsa-sha256.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/pkcs1-rsa-sha512.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/pkcs1-rsa-digest.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/pkcs1-rsa-md5.c<br>
+<br>
+##########################################################################=
######<br>
+# HOGWEED code -- dsa<br>
+##########################################################################=
######<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/dsa.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/dsa-sign.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/dsa-hash.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/dsa-verify.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/dsa-keygen.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/dsa-compat.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/dsa-compat-keygen.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/dsa-gen-params.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/dsa-sha1-sign.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/dsa-sha1-verify.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/dsa-sha256-sign.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/dsa-sha256-verify.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/dsa2sexp.c<br>
+<br>
+##########################################################################=
######<br>
+# HOGWEED code -- ecdsa<br>
+##########################################################################=
######<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/ecdsa-keygen.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/ecdsa-sign.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/ecdsa-verify.c<br>
+<br>
+##########################################################################=
######<br>
+# HOGWEED code -- ecc<br>
+##########################################################################=
######<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/ecc-a-to-j.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/ecc-add-eh.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/ecc-add-ehh.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/ecc-add-jja.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/ecc-add-jjj.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/ecc-add-th.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/ecc-add-thh.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/ecc-curve25519-modp.s<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/ecc-curve25519.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/ecc-curve448-modp.s<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/ecc-curve448.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/ecc-dup-eh.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/ecc-dup-jj.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/ecc-dup-th.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/ecc-ecdsa-sign.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/ecc-ecdsa-verify.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/ecc-eh-to-a.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/ecc-gost-gc256b.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/ecc-gost-gc512a.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/ecc-gostdsa-sign.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/ecc-gostdsa-verify.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/ecc-hash.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/ecc-j-to-a.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/ecc-mod-arith.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/ecc-mod-inv.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/ecc-mod.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/ecc-mul-a-eh.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/ecc-mul-a.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/ecc-mul-g-eh.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/ecc-mul-g.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/ecc-mul-m.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/ecc-point.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/ecc-random.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/ecc-scalar.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/ecc-secp192r1-modp.s<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/ecc-secp192r1.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/ecc-secp224r1-modp.s<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/ecc-secp224r1.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/ecc-secp256r1-redc.s<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/ecc-secp256r1.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/ecc-secp384r1-modp.s<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/ecc-secp384r1.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/ecc-secp521r1-modp.s<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/ecc-secp521r1.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/ecc-size.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/sec-add-1.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/sec-tabselect.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/cnd-copy.c<br>
+<br>
+##########################################################################=
######<br>
+# HOGWEED code -- curve<br>
+##########################################################################=
######<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/curve25519-mul.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/curve25519-mul-g.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/curve25519-eh-to-x.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/curve448-mul.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/curve448-mul-g.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/curve448-eh-to-x.c<br>
+<br>
+##########################################################################=
######<br>
+# HOGWEED code -- gostdsa<br>
+##########################################################################=
######<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/gostdsa-sign.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/gostdsa-verify.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/gostdsa-vko.c<br>
+<br>
+##########################################################################=
######<br>
+# HOGWEED code -- eddsa<br>
+##########################################################################=
######<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/eddsa-compress.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/eddsa-decompress.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/eddsa-sign.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/eddsa-verify.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/eddsa-expand.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/eddsa-hash.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/eddsa-pubkey.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/ed25519-sha512.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/ed448-shake256.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/shake256.c<br>
+<br>
+##########################################################################=
######<br>
+# HOGWEED code -- sexp<br>
+##########################################################################=
######<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/sexp.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/sexp2rsa.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/sexp-format.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/sexp2bignum.c<br>
+#LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/sexp-transport-format.c<br=
>
+<br>
+##########################################################################=
######<br>
+# HOGWEED code -- hex encoding<br>
+##########################################################################=
######<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/base16-encode.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/base16-decode.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/base64-encode.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/base64-decode.c<br>
+<br>
+##########################################################################=
######<br>
+# HOGWEED code -- miscellaneous<br>
+##########################################################################=
######<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/knuth-lfib.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/hmac.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/hmac-sha1.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/memxor.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/memxor3.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/cnd-memcpy.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/memeql-sec.c<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/cbc.c<br>
+<br>
+##########################################################################=
######<br>
+# HOGWEED code -- tests<br>
+##########################################################################=
######<br>
+LIBHOGWEED_SRCS-$(CONFIG_TESTSUITE) +=3D $(LIBHOGWEED_BASE)/testutils_glue=
.c<br>
+ifeq ($(CONFIG_RSA_COMPUTE_ROOT_TEST),y)<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/testsuite/rsa-compute-root-=
test.c<br>
+LIBHOGWEED_RSA-COMPUTE-ROOT-TEST_FLAGS-y +=3D -Dtest_main=3Drsa_compute_ro=
ot_test<br>
+endif<br>
+ifeq ($(CONFIG_RSA_ENCRYPT_TEST),y)<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/testsuite/rsa-encrypt-test.=
c<br>
+LIBHOGWEED_RSA-ENCRYPT-TEST_FLAGS-y +=3D -Dtest_main=3Drsa_encrypt_test<br=
>
+endif<br>
+ifeq ($(CONFIG_RSA_KEYGEN_TEST),y)<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/testsuite/rsa-keygen-test.c=
<br>
+LIBHOGWEED_RSA-KEYGEN-TEST_FLAGS-y +=3D -Dtest_main=3Drsa_keygen_test<br>
+endif<br>
+ifeq ($(CONFIG_RSA_PSS_SIGN_TR_TEST),y)<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/testsuite/rsa-pss-sign-tr-t=
est.c<br>
+LIBHOGWEED_RSA-PSS-SIGN-TR-TEST_FLAGS-y +=3D -Dtest_main=3Drsa_pss_sign_tr=
_test<br>
+endif<br>
+ifeq ($(CONFIG_RSA_SEC_DECRYPT_TEST),y)<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/testsuite/rsa-sec-decrypt-t=
est.c<br>
+LIBHOGWEED_RSA-SEC-DECRYPT-TEST_FLAGS-y +=3D -Dtest_main=3Drsa_sec_decrypt=
_test<br>
+endif<br>
+ifeq ($(CONFIG_RSA_SIGN_TR_TEST),y)<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/testsuite/rsa-sign-tr-test.=
c<br>
+LIBHOGWEED_RSA-SIGN-TR-TEST_FLAGS-y +=3D -Dtest_main=3Drsa_sign_tr_test<br=
>
+endif<br>
+ifeq ($(CONFIG_RSA_TEST),y)<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/testsuite/rsa-test.c<br>
+LIBHOGWEED_RSA-TEST_FLAGS-y +=3D -Dtest_main=3Drsa_test<br>
+endif<br>
+ifeq ($(CONFIG_RSA2SEXP_TEST),y)<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/testsuite/rsa2sexp-test.c<b=
r>
+LIBHOGWEED_RSA2SEXP-TEST_FLAGS-y +=3D -Dtest_main=3Drsa2sexp_test<br>
+endif<br>
+ifeq ($(CONFIG_SEXP2RSA_TEST),y)<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/testsuite/sexp2rsa-test.c<b=
r>
+LIBHOGWEED_SEXP2RSA-TEST_FLAGS-y +=3D -Dtest_main=3Dsexp2rsa_test<br>
+endif<br>
+ifeq ($(CONFIG_CURVE25519_DH_TEST),y)<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/testsuite/curve25519-dh-tes=
t.c<br>
+LIBHOGWEED_CURVE25519-DH-TEST_FLAGS-y +=3D -Dtest_main=3Dcurve25519_dh_tes=
t<br>
+endif<br>
+ifeq ($(CONFIG_CURVE448_DH_TEST),y)<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/testsuite/curve448-dh-test.=
c<br>
+LIBHOGWEED_CURVE448-DH-TEST_FLAGS-y +=3D -Dtest_main=3Dcurve448_dh_test<br=
>
+endif<br>
+ifeq ($(CONFIG_DSA_KEYGEN_TEST),y)<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/testsuite/dsa-keygen-test.c=
<br>
+LIBHOGWEED_DSA-KEYGEN-TEST_FLAGS-y +=3D -Dtest_main=3Ddsa_keygen_test<br>
+endif<br>
+ifeq ($(CONFIG_DSA_TEST),y)<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/testsuite/dsa-test.c<br>
+LIBHOGWEED_DSA-TEST_FLAGS-y +=3D -Dtest_main=3Ddsa_test<br>
+endif<br>
+ifeq ($(CONFIG_ECDSA_KEYGEN_TEST),y)<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/testsuite/ecdsa-keygen-test=
.c<br>
+LIBHOGWEED_ECDSA-KEYGEN-TEST_FLAGS-y +=3D -Dtest_main=3Decdsa_keygen_test<=
br>
+endif<br>
+ifeq ($(CONFIG_ECDSA_SIGN_TEST),y)<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/testsuite/ecdsa-sign-test.c=
<br>
+LIBHOGWEED_ECDSA-SIGN-TEST_FLAGS-y +=3D -Dtest_main=3Decdsa_sign_test<br>
+endif<br>
+ifeq ($(CONFIG_ECDSA_VERIFY_TEST),y)<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/testsuite/ecdsa-verify-test=
.c<br>
+LIBHOGWEED_ECDSA-VERIFY-TEST_FLAGS-y +=3D -Dtest_main=3Decdsa_verify_test<=
br>
+endif<br>
+ifeq ($(CONFIG_EDDSA_COMPRESS_TEST),y)<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/testsuite/eddsa-compress-te=
st.c<br>
+LIBHOGWEED_EDDSA-COMPRESS-TEST_FLAGS-y +=3D -Dtest_main=3Deddsa_compress_t=
est<br>
+endif<br>
+ifeq ($(CONFIG_EDDSA_SIGN_TEST),y)<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/testsuite/eddsa-sign-test.c=
<br>
+LIBHOGWEED_EDDSA-SIGN-TEST_FLAGS-y +=3D -Dtest_main=3Deddsa_sign_test<br>
+endif<br>
+ifeq ($(CONFIG_EDDSA_VERIFY_TEST),y)<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/testsuite/eddsa-verify-test=
.c<br>
+LIBHOGWEED_EDDSA-VERIFY-TEST_FLAGS-y +=3D -Dtest_main=3Deddsa_verify_test<=
br>
+endif<br>
+ifeq ($(CONFIG_GOSTDSA_KEYGEN_TEST),y)<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/testsuite/gostdsa-keygen-te=
st.c<br>
+LIBHOGWEED_GOSTDSA-KEYGEN-TEST_FLAGS-y +=3D -Dtest_main=3Dgostdsa_keygen_t=
est<br>
+endif<br>
+ifeq ($(CONFIG_GOSTDSA_SIGN_TEST),y)<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/testsuite/gostdsa-sign-test=
.c<br>
+LIBHOGWEED_GOSTDSA-SIGN-TEST_FLAGS-y +=3D -Dtest_main=3Dgostdsa_sign_test<=
br>
+endif<br>
+ifeq ($(CONFIG_GOSTDSA_VERIFY_TEST),y)<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/testsuite/gostdsa-verify-te=
st.c<br>
+LIBHOGWEED_GOSTDSA-VERIFY-TEST_FLAGS-y +=3D -Dtest_main=3Dgostdsa_verify_t=
est<br>
+endif<br>
+ifeq ($(CONFIG_GOSTDSA_VKO_TEST),y)<br>
+LIBHOGWEED_SRCS-y +=3D $(LIBHOGWEED_EXTRACTED)/testsuite/gostdsa-vko-test.=
c<br>
+LIBHOGWEED_GOSTDSA-VKO-TEST_FLAGS-y +=3D -Dtest_main=3Dgostdsa_vko_test<br=
>
+endif<br>
+<br>
+<br>
+<br>
+##########################################################################=
######<br>
+# HOGWEED prepare<br>
+##########################################################################=
######<br>
+# Run ./configure<br>
+$(LIBHOGWEED_EXTRACTED)/config.h: $(LIBHOGWEED_BUILD)/.origin<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0$(call verbose_cmd,CONFIG,libhogweed: $(notdir =
$@), \<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 cd $(LIBHOGWEED_EXTRACTED) &amp;&amp; ./config=
ure --enable-mini-gmp \<br>
+=C2=A0 =C2=A0 )<br>
+<br>
+# Generate auxiliar files using the original building system<br>
+$(LIBHOGWEED_EXTRACTED)/make_auxiliar: $(LIBHOGWEED_BUILD)/.origin<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0$(call verbose_cmd,CONFIG,libhogweed: $(notdir =
$@), \<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 cd $(LIBHOGWEED_EXTRACTED) &amp;&amp; \<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 make ecc-secp192r1.h &amp;&amp; \<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 make ecc-secp224r1.h &amp;&amp; \<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 make ecc-secp256r1.h &amp;&amp; \<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0make ecc-secp384r1.=
h &amp;&amp; \<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 make ecc-secp521r1.h &amp;&amp; \<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 make ecc-curve25519.h &amp;&amp; \<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 make ecc-curve448.h &amp;&amp; \<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 make ecc-gost-gc256b.h &amp;&amp; \<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 make ecc-gost-gc512a.h &amp;&amp; \<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 /usr/bin/m4 ./asm.m4 machine.m4 config.m4 ecc-=
curve25519-modp.asm \<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0&gt; ecc-curve25519=
-modp.s &amp;&amp; \<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 /usr/bin/m4 ./asm.m4 machine.m4 config.m4 ecc-=
curve448-modp.asm \<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0&gt; ecc-curve448-m=
odp.s &amp;&amp; \<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 /usr/bin/m4 ./asm.m4 machine.m4 config.m4 ecc-=
secp192r1-modp.asm \<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0&gt; ecc-secp192r1-=
modp.s &amp;&amp; \<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 /usr/bin/m4 ./asm.m4 machine.m4 config.m4 ecc-=
secp224r1-modp.asm \<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 &gt; ecc-secp224r1-modp.s &amp;&=
amp; \<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 /usr/bin/m4 ./asm.m4 machine.m4 config.m4 ecc-=
secp256r1-redc.asm \<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0&gt; ecc-secp256r1-=
redc.s &amp;&amp; \<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 /usr/bin/m4 ./asm.m4 machine.m4 config.m4 ecc-=
secp384r1-modp.asm \<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0&gt; ecc-secp384r1-=
modp.s &amp;&amp; \<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 /usr/bin/m4 ./asm.m4 machine.m4 config.m4 ecc-=
secp521r1-modp.asm \<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0&gt; ecc-secp521r1-=
modp.s &amp;&amp; \<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 echo &quot;done&quot; &gt; make_auxiliar \<br>
+=C2=A0 =C2=A0 )<br>
+<br>
+LIBHOGWEED_PREPARED_DEPS =3D $(LIBHOGWEED_EXTRACTED)/config.h \<br>
+=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 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0$(LIBHOGWEED_EXTRACTED)/mak=
e_auxiliar<br>
+<br>
+$(LIBHOGWEED_BUILD)/.prepared: $(LIBHOGWEED_PREPARED_DEPS)<br>
+<br>
+UK_PREPARE +=3D $(LIBHOGWEED_BUILD)/.prepared<br>
-- <br>
2.17.1<br>
<br>
</blockquote></div>

--000000000000566f7d05b5e051f5--


From minios-devel-bounces@lists.xenproject.org Wed Dec 09 10:33:46 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Wed, 09 Dec 2020 10:33:46 +0000
Received: from list by lists.xenproject.org with outflank-mailman.48095.85080 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1kmwmx-0007nZ-8t; Wed, 09 Dec 2020 10:33:39 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 48095.85080; Wed, 09 Dec 2020 10:33: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 1kmwmx-0007nS-63; Wed, 09 Dec 2020 10:33:39 +0000
Received: by outflank-mailman (input) for mailman id 48095;
 Wed, 09 Dec 2020 10:33: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=u4Yj=FN=gmail.com=felipehuici@srs-us1.protection.inumbo.net>)
 id 1kmwmw-0007mw-6A
 for minios-devel@lists.xen.org; Wed, 09 Dec 2020 10:33:38 +0000
Received: from mail-vk1-xa42.google.com (unknown [2607:f8b0:4864:20::a42])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 2e71eba2-0d74-4f85-a81d-80650a2e85ec;
 Wed, 09 Dec 2020 10:33:36 +0000 (UTC)
Received: by mail-vk1-xa42.google.com with SMTP id i62so215868vkb.7
 for <minios-devel@lists.xen.org>; Wed, 09 Dec 2020 02:33:36 -0800 (PST)
X-BeenThere: minios-devel@lists.xenproject.org
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
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: 2e71eba2-0d74-4f85-a81d-80650a2e85ec
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=pjpaoVqWcuH1+hlFNFbFLvdJjcuWMo0GlAhdDKV3yJQ=;
        b=kSPN2Dsgrpo958dFG5dwpn3V7018nmHspTFPDkD/NF6YcbKUujZzkY7mFmdY8hA0ox
         LAcq9RUUaE4I0m73CbzhhwFSvrCiHfE2eyIWqQQfCVsjqlc7y7hnYcfl2/1LbogK0CD1
         mAXuK7xxTlqeC3L4Pvjj4TKfq5HM6Yj+rxvTQ9gMEqig4KXG/kNyyPKiFXfB6W+3R7az
         e9t/gc4NsGT5TP5nddhDCIK2y1sAX7xZbaDNDQHSRO2kjAs3sffAtBr4eNZleK7oDpY2
         rxr09lrR7x/PFVCIolRrtscu3ay/x5a0S1nqL/WRigLg5TFMOlm0KWLAWyx7ZVt6s5oe
         KmXQ==
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=pjpaoVqWcuH1+hlFNFbFLvdJjcuWMo0GlAhdDKV3yJQ=;
        b=h1YbK4rqqBzVKa4cuknw9HWlktuIdwqRxUDrG1edMk0lMXE9/gNFW9XEfQ3dl+rwGI
         IPcB9Wslwmngar6luL7AFMNb1xpO3eztmd/Kcr3NXP2v3sgBNKo1hrlonM2BZpV5NrAc
         2HIWp84Cel1w0kc+UHxJubK6PtM4tXhiRTZQ/O2d5IixE1U53cZH0+p2qHSy4t8TWwvG
         yjmSoZko0QoRUkA2QDfb5L3q0qoDMIMLH69WttzIFzLI0Pxssewhwkn7VXqnzs8VF3MO
         pUW1x9cinbME5Um1MAdYsBzh26xrW+EPamdJqZ+KNAGt6t8Y+0lTehj8AxavjXkevSPO
         Q/ew==
X-Gm-Message-State: AOAM530m5FFNbSIEeUp6pHSJwBIeNL0xWJqFmgs0r9f12CMU0r/Qa/lF
	+Yny2K64MBsOjXqMxY7+BgT0GcOZqqssfAKv1n8=
X-Google-Smtp-Source: ABdhPJxoHoWqy0hh6K4GV8GdMEsZnV+U/ErxpC8D1tejPvZvzK8165nXKzBIJfMy8QsZrVq6Rh/apj9jbhFL0+m+1Yg=
X-Received: by 2002:a1f:3216:: with SMTP id y22mr1040733vky.1.1607510016371;
 Wed, 09 Dec 2020 02:33:36 -0800 (PST)
MIME-Version: 1.0
References: <20201121150731.126642-1-vlad_andrei.badoiu@upb.ro> <20201121150731.126642-2-vlad_andrei.badoiu@upb.ro>
In-Reply-To: <20201121150731.126642-2-vlad_andrei.badoiu@upb.ro>
From: felipehuici <felipehuici@gmail.com>
Date: Wed, 9 Dec 2020 11:33:25 +0100
Message-ID: <CAEX4t-ObNLFYFw7medf24jaiP-H3CFMRkTCJNZXy8NoZXT3=EA@mail.gmail.com>
Subject: Re: [UNIKRAFT PATCH 1/5] lib/vfscore: Fix bug where newdp is freed
 before initialization
To: Vlad-Andrei Badoiu <vlad_andrei.badoiu@upb.ro>
Cc: minios-devel@lists.xen.org, Felipe Huici <felipe.huici@neclab.eu>, 
	Simon Kuenzer <simon.kuenzer@neclab.eu>
Content-Type: multipart/alternative; boundary="0000000000007fb12f05b60597e7"

--0000000000007fb12f05b60597e7
Content-Type: text/plain; charset="UTF-8"

Hi Vlad, looks good, thanks.

Reviewed-by: Felipe Huici <felipe.huici@neclab.eu>

On Sat, Nov 21, 2020 at 4:08 PM Vlad-Andrei Badoiu <
vlad_andrei.badoiu@upb.ro> wrote:

> When vp->v_type == VDIR we jump to out where newdp is freed
> via the drele call but newdp has yet to be initialized. We
> solve this by checking the output of namei first.
> ---
>  lib/vfscore/syscalls.c | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/lib/vfscore/syscalls.c b/lib/vfscore/syscalls.c
> index ce512742..c5481905 100644
> --- a/lib/vfscore/syscalls.c
> +++ b/lib/vfscore/syscalls.c
> @@ -940,17 +940,17 @@ sys_link(char *oldpath, char *newpath)
>         vp = olddp->d_vnode;
>         vn_lock(vp);
>
> -       if (vp->v_type == VDIR) {
> -               error = EPERM;
> -               goto out;
> -       }
> -
>         /* If newpath exists, it shouldn't be overwritten */
>         if (!namei(newpath, &newdp)) {
>                 error = EEXIST;
>                 goto out;
>         }
>
> +       if (vp->v_type == VDIR) {
> +               error = EPERM;
> +               goto out;
> +       }
> +
>         /* Get pointer to the parent dentry of newpath */
>         if ((error = lookup(newpath, &newdirdp, &name)) != 0)
>                 goto out;
> --
> 2.27.0
>
>
>

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

<div dir=3D"ltr">Hi Vlad, looks good, thanks.<div><br></div><div><span styl=
e=3D"color:rgba(0,0,0,0.847);font-family:Helvetica;font-size:12px">Reviewed=
-by: Felipe Huici &lt;<a href=3D"mailto:felipe.huici@neclab.eu">felipe.huic=
i@neclab.eu</a>&gt;</span><br></div></div><br><div class=3D"gmail_quote"><d=
iv dir=3D"ltr" class=3D"gmail_attr">On Sat, Nov 21, 2020 at 4:08 PM Vlad-An=
drei Badoiu &lt;<a href=3D"mailto:vlad_andrei.badoiu@upb.ro">vlad_andrei.ba=
doiu@upb.ro</a>&gt; wrote:<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">When vp-&gt;v_type =3D=3D VDIR we jump to out where newdp is fre=
ed<br>
via the drele call but newdp has yet to be initialized. We<br>
solve this by checking the output of namei first.<br>
---<br>
=C2=A0lib/vfscore/syscalls.c | 10 +++++-----<br>
=C2=A01 file changed, 5 insertions(+), 5 deletions(-)<br>
<br>
diff --git a/lib/vfscore/syscalls.c b/lib/vfscore/syscalls.c<br>
index ce512742..c5481905 100644<br>
--- a/lib/vfscore/syscalls.c<br>
+++ b/lib/vfscore/syscalls.c<br>
@@ -940,17 +940,17 @@ sys_link(char *oldpath, char *newpath)<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 vp =3D olddp-&gt;d_vnode;<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 vn_lock(vp);<br>
<br>
-=C2=A0 =C2=A0 =C2=A0 =C2=A0if (vp-&gt;v_type =3D=3D VDIR) {<br>
-=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0error =3D EPERM;<br=
>
-=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0goto out;<br>
-=C2=A0 =C2=A0 =C2=A0 =C2=A0}<br>
-<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 /* If newpath exists, it shouldn&#39;t be overw=
ritten */<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 if (!namei(newpath, &amp;newdp)) {<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 error =3D EEXIST;<b=
r>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 goto out;<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 }<br>
<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0if (vp-&gt;v_type =3D=3D VDIR) {<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0error =3D EPERM;<br=
>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0goto out;<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0}<br>
+<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 /* Get pointer to the parent dentry of newpath =
*/<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 if ((error =3D lookup(newpath, &amp;newdirdp, &=
amp;name)) !=3D 0)<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 goto out;<br>
-- <br>
2.27.0<br>
<br>
<br>
</blockquote></div>

--0000000000007fb12f05b60597e7--


From minios-devel-bounces@lists.xenproject.org Wed Dec 09 12:15:14 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Wed, 09 Dec 2020 12:15:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.48222.85262 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1kmyNA-00026b-Dv; Wed, 09 Dec 2020 12:15:08 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 48222.85262; Wed, 09 Dec 2020 12:15: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 1kmyNA-00026U-Ae; Wed, 09 Dec 2020 12:15:08 +0000
Received: by outflank-mailman (input) for mailman id 48222;
 Wed, 09 Dec 2020 12:15: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=u4Yj=FN=gmail.com=felipehuici@srs-us1.protection.inumbo.net>)
 id 1kmyN8-00026M-TZ
 for minios-devel@lists.xen.org; Wed, 09 Dec 2020 12:15:07 +0000
Received: from mail-vs1-xe43.google.com (unknown [2607:f8b0:4864:20::e43])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id e1a74ae2-8c31-4bce-b396-e62e16f6d4f4;
 Wed, 09 Dec 2020 12:15:06 +0000 (UTC)
Received: by mail-vs1-xe43.google.com with SMTP id r24so741990vsg.10
 for <minios-devel@lists.xen.org>; Wed, 09 Dec 2020 04:15:05 -0800 (PST)
X-BeenThere: minios-devel@lists.xenproject.org
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
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: e1a74ae2-8c31-4bce-b396-e62e16f6d4f4
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=YrqKRp7FQmax2bHsoQtt0keIQWF45/A0IfjejCeSxdg=;
        b=WUByMrSLZYel6Zr2wNcTMS6r1X2LxdxtxX//hlZgmy+z9C1hiFTE6HYz4YN0jz5PWp
         77jLIHBI2slCn7iuv5l3Lhz2pI2f2uKK5uPRfVGARIVAJnw1kW1Q63Yh0u/kvwujjuw2
         4dTn19dVwR+RjrazfkxmC4fQciY4lmbTkMNmMVJxuNtXvJYRI/FhR9im8yprUKOw8w5l
         LqsaknO0kdLiu4Dknr5S2aPk7ZFEWOlPQBiajK3Geq7CP9lxSq03U5r+G/AsKtuS1sln
         j9kEi49yvzCEP9TdmoZN889JuAS72N6ntuj3qORhb3pdhPghKCGN1UUb/8IFuQ62QUxD
         OxiA==
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=YrqKRp7FQmax2bHsoQtt0keIQWF45/A0IfjejCeSxdg=;
        b=QVsz95pcZlva/ZlfUzVYNCBhRQuOoYWtUglL/l3UMrOTHp9JF4nxWTXxxhX2tCuROk
         Ue739eyYWSxytVQXdCX9g3QF6MBILFuvX761YFr0jTZqGCmCOuPJP7Xxg4G4KU15bE01
         TwK2UnILCXmak0RWE+/yEUIhcA8LHs8lhd/eMy/xDf6SYweTT8f32HJkM4nnpGKICw8h
         P5vOM5qmt3mDi0zV0zxtmpOxm9WCDn2yy00FqknXetr44bTLZmAp7Lugdaxe7yqnPR9M
         VJM4g36ITIA8ex2PWpvnwtc7AHCkQ+wP8rgCdHrrGdkfkkSDGuc0euiEHMiYWNf+hHww
         q+fw==
X-Gm-Message-State: AOAM5313VbNm8yxjWdKtykfVycsVAnGENJyq7tRgVSe8T9fLDqVuGgWG
	gw/GfO3UBcfn9UXfJeNkzN42yxuEzJS5o07vM6M=
X-Google-Smtp-Source: ABdhPJzRRTXJziN77lkwbmDii39NVuXPu6vTNaRFa+X/nqMVV/tl7yTdgpxCVSNKSgVVTjoiCR9Hh2ADl0FAtqUF84E=
X-Received: by 2002:a05:6102:3222:: with SMTP id x2mr1420190vsf.2.1607516105517;
 Wed, 09 Dec 2020 04:15:05 -0800 (PST)
MIME-Version: 1.0
References: <20201121150731.126642-1-vlad_andrei.badoiu@upb.ro> <20201121150731.126642-3-vlad_andrei.badoiu@upb.ro>
In-Reply-To: <20201121150731.126642-3-vlad_andrei.badoiu@upb.ro>
From: felipehuici <felipehuici@gmail.com>
Date: Wed, 9 Dec 2020 13:14:54 +0100
Message-ID: <CAEX4t-Pf4aUQcUDAuOt_-K9SjE94VhJgdOi_ajLQv7mT8iOUNg@mail.gmail.com>
Subject: Re: [UNIKRAFT PATCH 2/5] lib/vfscore: Add missing error value
To: Vlad-Andrei Badoiu <vlad_andrei.badoiu@upb.ro>
Cc: minios-devel@lists.xen.org, Felipe Huici <felipe.huici@neclab.eu>, 
	Simon Kuenzer <simon.kuenzer@neclab.eu>
Content-Type: multipart/alternative; boundary="00000000000070af0f05b6070257"

--00000000000070af0f05b6070257
Content-Type: text/plain; charset="UTF-8"

Hi Vlad, looks good, thanks.

Reviewed-by: Felipe Huici <felipe.huici@neclab.eu>

On Sat, Nov 21, 2020 at 4:08 PM Vlad-Andrei Badoiu <
vlad_andrei.badoiu@upb.ro> wrote:

> When mp->m_root is null we set no error. We solve
> this by setting error equal to ENOMEM;
> ---
>  lib/vfscore/mount.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/lib/vfscore/mount.c b/lib/vfscore/mount.c
> index 1a778be2..a6df9983 100644
> --- a/lib/vfscore/mount.c
> +++ b/lib/vfscore/mount.c
> @@ -207,6 +207,7 @@ mount(const char *dev, const char *dir, const char
> *fsname, unsigned long flags,
>
>         mp->m_root = dentry_alloc(NULL, vp, "/");
>         if (!mp->m_root) {
> +               error = ENOMEM;
>                 vput(vp);
>                 goto err3;
>         }
> --
> 2.27.0
>
>
>

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

<div dir=3D"ltr">Hi Vlad, looks good, thanks.<div><br></div><div><span styl=
e=3D"color:rgba(0,0,0,0.847);font-family:Helvetica;font-size:12px">Reviewed=
-by: Felipe Huici &lt;<a href=3D"mailto:felipe.huici@neclab.eu" target=3D"_=
blank">felipe.huici@neclab.eu</a>&gt;</span></div></div><br><div class=3D"g=
mail_quote"><div dir=3D"ltr" class=3D"gmail_attr">On Sat, Nov 21, 2020 at 4=
:08 PM Vlad-Andrei Badoiu &lt;<a href=3D"mailto:vlad_andrei.badoiu@upb.ro">=
vlad_andrei.badoiu@upb.ro</a>&gt; wrote:<br></div><blockquote class=3D"gmai=
l_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,20=
4,204);padding-left:1ex">When mp-&gt;m_root is null we set no error. We sol=
ve<br>
this by setting error equal to ENOMEM;<br>
---<br>
=C2=A0lib/vfscore/mount.c | 1 +<br>
=C2=A01 file changed, 1 insertion(+)<br>
<br>
diff --git a/lib/vfscore/mount.c b/lib/vfscore/mount.c<br>
index 1a778be2..a6df9983 100644<br>
--- a/lib/vfscore/mount.c<br>
+++ b/lib/vfscore/mount.c<br>
@@ -207,6 +207,7 @@ mount(const char *dev, const char *dir, const char *fsn=
ame, unsigned long flags,<br>
<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 mp-&gt;m_root =3D dentry_alloc(NULL, vp, &quot;=
/&quot;);<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 if (!mp-&gt;m_root) {<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0error =3D ENOMEM;<b=
r>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 vput(vp);<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 goto err3;<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 }<br>
-- <br>
2.27.0<br>
<br>
<br>
</blockquote></div>

--00000000000070af0f05b6070257--


From minios-devel-bounces@lists.xenproject.org Wed Dec 09 12:15:27 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Wed, 09 Dec 2020 12:15:27 +0000
Received: from list by lists.xenproject.org with outflank-mailman.48223.85265 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1kmyNT-000286-GN; Wed, 09 Dec 2020 12:15:27 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 48223.85265; Wed, 09 Dec 2020 12:15:27 +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 1kmyNT-00027z-DP; Wed, 09 Dec 2020 12:15:27 +0000
Received: by outflank-mailman (input) for mailman id 48223;
 Wed, 09 Dec 2020 12:15: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=u4Yj=FN=gmail.com=felipehuici@srs-us1.protection.inumbo.net>)
 id 1kmyNR-00027s-US
 for minios-devel@lists.xen.org; Wed, 09 Dec 2020 12:15:25 +0000
Received: from mail-vs1-xe42.google.com (unknown [2607:f8b0:4864:20::e42])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id b3a4c87a-518c-4ec2-95f5-c24a34c92e24;
 Wed, 09 Dec 2020 12:15:25 +0000 (UTC)
Received: by mail-vs1-xe42.google.com with SMTP id q10so735834vsr.13
 for <minios-devel@lists.xen.org>; Wed, 09 Dec 2020 04:15:25 -0800 (PST)
X-BeenThere: minios-devel@lists.xenproject.org
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
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: b3a4c87a-518c-4ec2-95f5-c24a34c92e24
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=iJT6QJ+ezBfvLCm8lmhBwwja56YOTN0R9UkV5Tv0/EE=;
        b=PGvmZRZZ8ZDdEtbvTdiET9cIQDKXxy31SD2aotNLcKOjUdvSyeKpRGrZkNth4qNZ+7
         2wZ7j6vTFWkQF3yQWjX59jBYl7b6jyF+SbnmvRKe8Kj5pD5yUrFR8sAhbr/c6iGRUy/0
         dM6/ARagrnhkSZH9wc81wctQkvi0kp5cEAKtCR4ZRnRy0Ipm6363TaiSXzF0rNTuULQ9
         vhGyoS/QQwQ31Lg1Y3w8hmMOOQQXe4kCSpbCmtcQAZ0a/Ec3BaTQ3UZQOgpZ2FQv35DX
         R2UM3ldxb6k6cY92RBon/7zxypN2ANj2KA9Og+eFxM4oCpAHuGBhfHJ30DYccTg9qn87
         iPuw==
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=iJT6QJ+ezBfvLCm8lmhBwwja56YOTN0R9UkV5Tv0/EE=;
        b=lYjgvXA+VV4GHP+WM/CbjJufud//TGr9n/Z28Bn1G5f3tfiubjr4WImK4h9uUCU3mr
         R5iNyvn/JE9kkiy21my3vw/M76lIDkvnsapt8EFAlkW/vDmXKaBlpEPud3Cy09NP6ZRQ
         ish7EQoYdL09nwBFZvHbI1VmFON4WYZ9CQv0o3pBgelnGNB7L5U8lbGavSa4KauT6QtL
         2iuh4QZUGt2ePSPPWmkoNenkuo7P/eOIP4/+Q4ov9/9MsYGdbC3v7V6jA++4/5tYVe50
         0OUpwFMZryis4tvHESgaOva+RU2J71yXHp2DCt2vdmvQ0MR8hsdYzDaVImv1Ojn1bvn3
         BSzw==
X-Gm-Message-State: AOAM531PBQmRJ2WP9Jmqi8iOpBatn2V3zTNOdyE1YgAWSCbkLlFLS2k7
	T0pssZ0O7iSNFfVCtXT7897Bn+5UozSHZZdqSRjLCY0XTszbFQ==
X-Google-Smtp-Source: ABdhPJwgGXrSsIeihCx85mWrJNu08tXcMbAuijtWrj+IpURCKpCopEaWE8BTcgOqrNzD6DqLwY0/xbPreCfzrO7tKAg=
X-Received: by 2002:a05:6102:1173:: with SMTP id k19mr1212247vsg.51.1607516124908;
 Wed, 09 Dec 2020 04:15:24 -0800 (PST)
MIME-Version: 1.0
References: <20201121150731.126642-1-vlad_andrei.badoiu@upb.ro> <20201121150731.126642-4-vlad_andrei.badoiu@upb.ro>
In-Reply-To: <20201121150731.126642-4-vlad_andrei.badoiu@upb.ro>
From: felipehuici <felipehuici@gmail.com>
Date: Wed, 9 Dec 2020 13:15:13 +0100
Message-ID: <CAEX4t-M0OuLr0fXwpKT8ctB-ODub-e3Lqvw1LQvPnWovUBqvkw@mail.gmail.com>
Subject: Re: [UNIKRAFT PATCH 3/5] plat/drivers/virtio: Add error check for
 return value
To: Vlad-Andrei Badoiu <vlad_andrei.badoiu@upb.ro>
Cc: minios-devel@lists.xen.org, Felipe Huici <felipe.huici@neclab.eu>, 
	Simon Kuenzer <simon.kuenzer@neclab.eu>
Content-Type: multipart/alternative; boundary="0000000000009890ab05b60703bd"

--0000000000009890ab05b60703bd
Content-Type: text/plain; charset="UTF-8"

Hi Vlad, looks good, thanks.

Reviewed-by: Felipe Huici <felipe.huici@neclab.eu>

On Sat, Nov 21, 2020 at 4:08 PM Vlad-Andrei Badoiu <
vlad_andrei.badoiu@upb.ro> wrote:

> If virtio_config_get return an error then tag_len does
> not get initialized and the next calloc is ran with an
> unitialized length.
> ---
>  plat/drivers/virtio/virtio_9p.c | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/plat/drivers/virtio/virtio_9p.c
> b/plat/drivers/virtio/virtio_9p.c
> index fe0d69ab..045ce42f 100644
> --- a/plat/drivers/virtio/virtio_9p.c
> +++ b/plat/drivers/virtio/virtio_9p.c
> @@ -345,9 +345,13 @@ static int virtio_9p_feature_negotiate(struct
> virtio_9p_device *d)
>                 goto out;
>         }
>
> -       virtio_config_get(d->vdev,
> +       if (virtio_config_get(d->vdev,
>                           __offsetof(struct virtio_9p_config, tag_len),
> -                         &tag_len, 1, sizeof(tag_len));
> +                         &tag_len, 1, sizeof(tag_len)))
> +       {
> +               rc = -EAGAIN;
> +               goto out;
> +       }
>
>         d->tag = uk_calloc(a, tag_len + 1, sizeof(*d->tag));
>         if (!d->tag) {
> --
> 2.27.0
>
>
>

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

<div dir=3D"ltr">Hi Vlad, looks good, thanks.<div><br></div><div><span styl=
e=3D"color:rgba(0,0,0,0.847);font-family:Helvetica;font-size:12px">Reviewed=
-by: Felipe Huici &lt;<a href=3D"mailto:felipe.huici@neclab.eu" target=3D"_=
blank">felipe.huici@neclab.eu</a>&gt;</span></div></div><br><div class=3D"g=
mail_quote"><div dir=3D"ltr" class=3D"gmail_attr">On Sat, Nov 21, 2020 at 4=
:08 PM Vlad-Andrei Badoiu &lt;<a href=3D"mailto:vlad_andrei.badoiu@upb.ro">=
vlad_andrei.badoiu@upb.ro</a>&gt; wrote:<br></div><blockquote class=3D"gmai=
l_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,20=
4,204);padding-left:1ex">If virtio_config_get return an error then tag_len =
does<br>
not get initialized and the next calloc is ran with an<br>
unitialized length.<br>
---<br>
=C2=A0plat/drivers/virtio/virtio_9p.c | 8 ++++++--<br>
=C2=A01 file changed, 6 insertions(+), 2 deletions(-)<br>
<br>
diff --git a/plat/drivers/virtio/virtio_9p.c b/plat/drivers/virtio/virtio_9=
p.c<br>
index fe0d69ab..045ce42f 100644<br>
--- a/plat/drivers/virtio/virtio_9p.c<br>
+++ b/plat/drivers/virtio/virtio_9p.c<br>
@@ -345,9 +345,13 @@ static int virtio_9p_feature_negotiate(struct virtio_9=
p_device *d)<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 goto out;<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 }<br>
<br>
-=C2=A0 =C2=A0 =C2=A0 =C2=A0virtio_config_get(d-&gt;vdev,<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0if (virtio_config_get(d-&gt;vdev,<br>
=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 __offsetof(struct virtio_9p_config, tag_len),<br>
-=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&amp;tag_len, 1, sizeof(tag_len));<br>
+=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&amp;tag_len, 1, sizeof(tag_len)))<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0{<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0rc =3D -EAGAIN;<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0goto out;<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0}<br>
<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 d-&gt;tag =3D uk_calloc(a, tag_len + 1, sizeof(=
*d-&gt;tag));<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 if (!d-&gt;tag) {<br>
-- <br>
2.27.0<br>
<br>
<br>
</blockquote></div>

--0000000000009890ab05b60703bd--


From minios-devel-bounces@lists.xenproject.org Wed Dec 09 12:15:58 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Wed, 09 Dec 2020 12:15:58 +0000
Received: from list by lists.xenproject.org with outflank-mailman.48226.85270 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1kmyNy-0002Ak-JT; Wed, 09 Dec 2020 12:15:58 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 48226.85270; Wed, 09 Dec 2020 12:15: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 1kmyNy-0002Ad-GC; Wed, 09 Dec 2020 12:15:58 +0000
Received: by outflank-mailman (input) for mailman id 48226;
 Wed, 09 Dec 2020 12:15:57 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=u4Yj=FN=gmail.com=felipehuici@srs-us1.protection.inumbo.net>)
 id 1kmyNw-0002AY-Uu
 for minios-devel@lists.xen.org; Wed, 09 Dec 2020 12:15:56 +0000
Received: from mail-vs1-xe44.google.com (unknown [2607:f8b0:4864:20::e44])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 75c19d00-3355-4aef-91d5-15a5c789ec80;
 Wed, 09 Dec 2020 12:15:56 +0000 (UTC)
Received: by mail-vs1-xe44.google.com with SMTP id q5so763945vsg.0
 for <minios-devel@lists.xen.org>; Wed, 09 Dec 2020 04:15:56 -0800 (PST)
X-BeenThere: minios-devel@lists.xenproject.org
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
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: 75c19d00-3355-4aef-91d5-15a5c789ec80
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=daGd8bzD/BKa227zoyGv3GSPl+YhumdxYx/NasXSMGE=;
        b=PknPqBUPYFCE/pRCR5w9J78Cq4xYYvfnAr79GUPMtr1ENOTX3n7z2IAyzxCxWVS2W3
         CqtRWqygQ511re7CEM6E+8n+OuAvCoaNCa8rUmMDNivVWFYTW1T3y9J/JYrxX1gsQHx3
         idbe25qWgMPZsYaFXqRQajNUPLwUIRfbVJt4qJt5m75oSG1KCO2byitUJDTABXc0mEtu
         CwIuVETgVqaUYYWOYgvMKmSEAuTEzQ8eao32O5xhSTGOZGEVykrwocskyZy9ayO2Wdg6
         grzNVzDQYaIpmGgdqxfUnnuwYWK/M4eLoCjU21NlbM51ghaIN6s8ISKMpzo4BwcAS1ED
         fN3w==
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=daGd8bzD/BKa227zoyGv3GSPl+YhumdxYx/NasXSMGE=;
        b=ZWS0LCOQXX/Yj+2H6AK0l0Dxkm8WAd51KTnSCyYRFo4W94hIGkqaOA37vcflnNqdQh
         fXcwKcSgm5hz/rftYQqRYKZcydVxVn4I1WBxsNthkBe20xBhnhNxhRX0NZ4sjmLjsfTo
         lG0ccN+L6P/92dT/bRp4EnM1dnrtSkBsDliiyYePndSSMGMLr5juWcSCvbjSQV461aG+
         QH0udNzJTtP4KSJKjik8rNUtC2Kur1rz1AwCsjWycDGmqdgX0+DT182gTb2wEI9GP2a4
         FEsU5Y4AiMy26TkRiWozLKXcqhdWty3p7UBKPSH+gSx7QhrzhxWXPANxrGYebOUalZP4
         sVyw==
X-Gm-Message-State: AOAM530+ospAU259ed1xB1b6xtsVLNwirTO9sWPL4Mm0RQQ/2dHJ5oiU
	VkJD810yJOJyOqgevYV+FwxX7lnHocH2nTQPTSk=
X-Google-Smtp-Source: ABdhPJyBs0kU8ZLpLowfy0lsrBu9468XMfTuuVSH1VBGsTMrwL6B/XEHBzyxUEN1T7Py9lDqEWr+ZForftg3FzKjCYY=
X-Received: by 2002:a05:6102:3222:: with SMTP id x2mr1423801vsf.2.1607516155960;
 Wed, 09 Dec 2020 04:15:55 -0800 (PST)
MIME-Version: 1.0
References: <20201121150731.126642-1-vlad_andrei.badoiu@upb.ro> <20201121150731.126642-5-vlad_andrei.badoiu@upb.ro>
In-Reply-To: <20201121150731.126642-5-vlad_andrei.badoiu@upb.ro>
From: felipehuici <felipehuici@gmail.com>
Date: Wed, 9 Dec 2020 13:15:45 +0100
Message-ID: <CAEX4t-NO1SCoQ_x_1Op+QejtiQfDDXu+HAPHfCzwp4FPUGJZtA@mail.gmail.com>
Subject: Re: [UNIKRAFT PATCH 4/5] lib/uklibparam: Add missing return value check
To: Vlad-Andrei Badoiu <vlad_andrei.badoiu@upb.ro>
Cc: minios-devel@lists.xen.org, Felipe Huici <felipe.huici@neclab.eu>, 
	Simon Kuenzer <simon.kuenzer@neclab.eu>
Content-Type: multipart/alternative; boundary="00000000000072613d05b607051f"

--00000000000072613d05b607051f
Content-Type: text/plain; charset="UTF-8"

Hi Vlad, looks good, thanks.

Reviewed-by: Felipe Huici <felipe.huici@neclab.eu>

On Sat, Nov 21, 2020 at 4:08 PM Vlad-Andrei Badoiu <
vlad_andrei.badoiu@upb.ro> wrote:

> We add a check for the return value of kernel_args_set.
> ---
>  lib/uklibparam/param.c | 5 +++++
>  1 file changed, 5 insertions(+)
>
> diff --git a/lib/uklibparam/param.c b/lib/uklibparam/param.c
> index c0c65782..948150cd 100644
> --- a/lib/uklibparam/param.c
> +++ b/lib/uklibparam/param.c
> @@ -570,6 +570,11 @@ int uk_libparam_parse(const char *progname, int argc,
> char **argv)
>                 }
>
>                 rc = kernel_args_set(&pargs, param);
> +               if (rc < 0) {
> +                       uk_pr_err("Failed to set %s param\n", pargs.param);
> +                       continue;
> +               }
> +
>                 uk_pr_info("Parsed %d args\n", cnt);
>         }
>
> --
> 2.27.0
>
>
>

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

<div dir=3D"ltr">Hi Vlad, looks good, thanks.<div><br></div><div><span styl=
e=3D"color:rgba(0,0,0,0.847);font-family:Helvetica;font-size:12px">Reviewed=
-by: Felipe Huici &lt;<a href=3D"mailto:felipe.huici@neclab.eu" target=3D"_=
blank">felipe.huici@neclab.eu</a>&gt;</span></div></div><br><div class=3D"g=
mail_quote"><div dir=3D"ltr" class=3D"gmail_attr">On Sat, Nov 21, 2020 at 4=
:08 PM Vlad-Andrei Badoiu &lt;<a href=3D"mailto:vlad_andrei.badoiu@upb.ro">=
vlad_andrei.badoiu@upb.ro</a>&gt; wrote:<br></div><blockquote class=3D"gmai=
l_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,20=
4,204);padding-left:1ex">We add a check for the return value of kernel_args=
_set.<br>
---<br>
=C2=A0lib/uklibparam/param.c | 5 +++++<br>
=C2=A01 file changed, 5 insertions(+)<br>
<br>
diff --git a/lib/uklibparam/param.c b/lib/uklibparam/param.c<br>
index c0c65782..948150cd 100644<br>
--- a/lib/uklibparam/param.c<br>
+++ b/lib/uklibparam/param.c<br>
@@ -570,6 +570,11 @@ int uk_libparam_parse(const char *progname, int argc, =
char **argv)<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 }<br>
<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 rc =3D kernel_args_=
set(&amp;pargs, param);<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0if (rc &lt; 0) {<br=
>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0uk_pr_err(&quot;Failed to set %s param\n&quot;, pargs.param);<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0continue;<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0}<br>
+<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 uk_pr_info(&quot;Pa=
rsed %d args\n&quot;, cnt);<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 }<br>
<br>
-- <br>
2.27.0<br>
<br>
<br>
</blockquote></div>

--00000000000072613d05b607051f--


From minios-devel-bounces@lists.xenproject.org Wed Dec 09 12:17:12 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Wed, 09 Dec 2020 12:17:12 +0000
Received: from list by lists.xenproject.org with outflank-mailman.48232.85273 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1kmyP7-0002El-NL; Wed, 09 Dec 2020 12:17:09 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 48232.85273; Wed, 09 Dec 2020 12:17: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 1kmyP7-0002Ee-KV; Wed, 09 Dec 2020 12:17:09 +0000
Received: by outflank-mailman (input) for mailman id 48232;
 Wed, 09 Dec 2020 12:17: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=u4Yj=FN=gmail.com=felipehuici@srs-us1.protection.inumbo.net>)
 id 1kmyP5-0002EU-PK
 for minios-devel@lists.xen.org; Wed, 09 Dec 2020 12:17:07 +0000
Received: from mail-vs1-xe44.google.com (unknown [2607:f8b0:4864:20::e44])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 975d1dfa-2cc5-4d82-9d3d-3b522dc78328;
 Wed, 09 Dec 2020 12:17:06 +0000 (UTC)
Received: by mail-vs1-xe44.google.com with SMTP id v8so758704vso.2
 for <minios-devel@lists.xen.org>; Wed, 09 Dec 2020 04:17:06 -0800 (PST)
X-BeenThere: minios-devel@lists.xenproject.org
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
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: 975d1dfa-2cc5-4d82-9d3d-3b522dc78328
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=szVqwev/W9beOSltaKpebfc57soe+ZOFJwskTl7D35Q=;
        b=ibZm6RRzExJ9GWKjUUVHO6ZrNeWKikNIx1BUQXvWL1/4yojWv8XlFYJtZRpRJhP2C8
         LtCaR9/w2mSRqu69rjqqcJ3Am3ON2nlZbZBd22PTCKfTgRCPxAER/zJQNXDJm9ll2D8S
         bKoWdPggli2SqVcseJG4NrKm9cNJypdBLQ7cUqFECh8pi4q400aSx1ck43SSEGbDhtpD
         wUVv+Mcy66hxh5aSbQ/WnB2GQs6s0i42gyammDQeMYCTwoDjfbq41/6XYFiHX1X8phNO
         X0aBD5IF1wvM1KsEGiLtDjHA57CkzPD24IuKjPLWMiT7z2RddnLEigAUPB3xVgDyBgzQ
         Rxlw==
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=szVqwev/W9beOSltaKpebfc57soe+ZOFJwskTl7D35Q=;
        b=Xm5k6kfe15SyUsGuNzc3Yv1Z+LL4NMzYdg2r2oBj72vtuPHMD+D+lTulE+YfjjHOrx
         vqKoalmsttkPVmhkXAkG2+PKbaCwX/m1Ce4qK8zNGCxE8B56+i/eKUdEcpvgvsLbTXXP
         7wU/XhCyfce7L+Y16sCnn/BiCPNrX+MSnmrXDvC29TLaXqNje2rrHz0zXCi/xvypNZVC
         Kelqkr2/NtvmA9akpKv/EJCRNSXkv0SNKJfxCiQdm49+LaeV+YLcNfEKDSoRZ9aL0hyL
         WJ3tPdI6eS81E0vzVrUQ6dV4h66NWcoWkPzkSUIBcSBgpRDwliz4Wn6haHcn4GXYcQRm
         ZN6Q==
X-Gm-Message-State: AOAM531WzH7NLXL7TBZ3aP2eUTWeQ72jWY7a4RWb8E8eiWlSdqttkWsa
	zKtt2qhrESn5ORmGGgnzgB50ZaX3vOWLq/XozwU=
X-Google-Smtp-Source: ABdhPJyFbxFUmrydf9RlNYT5yRM/mqe7YXxy08y7nHXmT3YKlgbwJ7Sqh7W6hWeecvOzOr6j7ELekx6gDyG8aNw3+6k=
X-Received: by 2002:a67:fe01:: with SMTP id l1mr1225895vsr.53.1607516226676;
 Wed, 09 Dec 2020 04:17:06 -0800 (PST)
MIME-Version: 1.0
References: <20201121150731.126642-1-vlad_andrei.badoiu@upb.ro> <20201121150731.126642-6-vlad_andrei.badoiu@upb.ro>
In-Reply-To: <20201121150731.126642-6-vlad_andrei.badoiu@upb.ro>
From: felipehuici <felipehuici@gmail.com>
Date: Wed, 9 Dec 2020 13:16:55 +0100
Message-ID: <CAEX4t-N3PDCy+15HRO7OGDou_mhYeqgPSbaJ0XRPbJQ7vng=xg@mail.gmail.com>
Subject: Re: [UNIKRAFT PATCH 5/5] lib/vfscore: Fix possible memleak in getcwd
To: Vlad-Andrei Badoiu <vlad_andrei.badoiu@upb.ro>
Cc: minios-devel@lists.xen.org, Felipe Huici <felipe.huici@neclab.eu>, 
	Simon Kuenzer <simon.kuenzer@neclab.eu>
Content-Type: multipart/alternative; boundary="000000000000a969c705b60709e5"

--000000000000a969c705b60709e5
Content-Type: text/plain; charset="UTF-8"

Hi Vlad, looks good, thanks.

Reviewed-by: Felipe Huici <felipe.huici@neclab.eu>


On Sat, Nov 21, 2020 at 4:08 PM Vlad-Andrei Badoiu <
vlad_andrei.badoiu@upb.ro> wrote:

> If path is null and the memory is allocated by us then if size < len
> we exit the call without freeing the memory. We solve this by moving the
> check for sizer earlier.
> ---
>  lib/vfscore/main.c | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/lib/vfscore/main.c b/lib/vfscore/main.c
> index 846e2efd..f8e5e7fb 100644
> --- a/lib/vfscore/main.c
> +++ b/lib/vfscore/main.c
> @@ -1352,6 +1352,11 @@ char *getcwd(char *path, size_t size)
>         size_t len = strlen(t->t_cwd) + 1;
>         int error;
>
> +       if (size < len) {
> +               error = ERANGE;
> +               goto out_errno;
> +       }
> +
>         if (!path) {
>                 if (!size)
>                         size = len;
> @@ -1367,11 +1372,6 @@ char *getcwd(char *path, size_t size)
>                 }
>         }
>
> -       if (size < len) {
> -               error = ERANGE;
> -               goto out_errno;
> -       }
> -
>         memcpy(path, t->t_cwd, len);
>         trace_vfs_getcwd_ret(path);
>         return path;
> --
> 2.27.0
>
>
>

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

<div dir=3D"ltr"><div class=3D"gmail-gs" style=3D"margin:0px;padding:0px 0p=
x 20px;width:1184.25px;font-family:Roboto,RobotoDraft,Helvetica,Arial,sans-=
serif;font-size:medium"><div class=3D"gmail-"><div id=3D"gmail-:37" class=
=3D"gmail-ii gmail-gt gmail-adO" style=3D"font-size:0.875rem;direction:ltr;=
margin:8px 0px 0px;padding:0px"><div id=3D"gmail-:36" class=3D"gmail-a3s gm=
ail-aiL" style=3D"overflow:hidden;font-variant-numeric:normal;font-variant-=
east-asian:normal;font-stretch:normal;font-size:small;line-height:1.5;font-=
family:Arial,Helvetica,sans-serif"><div dir=3D"ltr">Hi Vlad, looks good, th=
anks.<div><br></div><div><span style=3D"color:rgba(0,0,0,0.847);font-family=
:Helvetica;font-size:12px">Reviewed-by: Felipe Huici &lt;<a href=3D"mailto:=
felipe.huici@neclab.eu" target=3D"_blank">felipe.huici@neclab.eu</a>&gt;</s=
pan></div></div><div class=3D"gmail-yj6qo gmail-ajU" style=3D"outline:none;=
padding:10px 0px;width:22px;margin:2px 0px 0px"><div id=3D"gmail-:1u" class=
=3D"gmail-ajR" tabindex=3D"0" style=3D"background-color:rgb(232,234,237);bo=
rder:none;clear:both;line-height:6px;outline:none;width:24px;border-radius:=
5.5px"><img class=3D"gmail-ajT" src=3D"https://ssl.gstatic.com/ui/v1/icons/=
mail/images/cleardot.gif" style=3D"background: url(&quot;https://www.gstati=
c.com/images/icons/material/system/2x/more_horiz_black_20dp.png&quot;) 50% =
50% / 20px no-repeat; height: 11px; opacity: 0.54; width: 24px;"></div></di=
v></div></div><div class=3D"gmail-hi" style=3D"border-bottom-left-radius:1p=
x;border-bottom-right-radius:1px;padding:0px;width:auto;background:rgb(242,=
242,242);margin:0px"></div></div></div><br class=3D"gmail-Apple-interchange=
-newline"></div><br><div class=3D"gmail_quote"><div dir=3D"ltr" class=3D"gm=
ail_attr">On Sat, Nov 21, 2020 at 4:08 PM Vlad-Andrei Badoiu &lt;<a href=3D=
"mailto:vlad_andrei.badoiu@upb.ro">vlad_andrei.badoiu@upb.ro</a>&gt; wrote:=
<br></div><blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8=
ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">If path is null=
 and the memory is allocated by us then if size &lt; len<br>
we exit the call without freeing the memory. We solve this by moving the<br=
>
check for sizer earlier.<br>
---<br>
=C2=A0lib/vfscore/main.c | 10 +++++-----<br>
=C2=A01 file changed, 5 insertions(+), 5 deletions(-)<br>
<br>
diff --git a/lib/vfscore/main.c b/lib/vfscore/main.c<br>
index 846e2efd..f8e5e7fb 100644<br>
--- a/lib/vfscore/main.c<br>
+++ b/lib/vfscore/main.c<br>
@@ -1352,6 +1352,11 @@ char *getcwd(char *path, size_t size)<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 size_t len =3D strlen(t-&gt;t_cwd) + 1;<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 int error;<br>
<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0if (size &lt; len) {<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0error =3D ERANGE;<b=
r>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0goto out_errno;<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0}<br>
+<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 if (!path) {<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 if (!size)<br>
=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 =3D len;<br>
@@ -1367,11 +1372,6 @@ char *getcwd(char *path, size_t size)<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 }<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 }<br>
<br>
-=C2=A0 =C2=A0 =C2=A0 =C2=A0if (size &lt; len) {<br>
-=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0error =3D ERANGE;<b=
r>
-=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0goto out_errno;<br>
-=C2=A0 =C2=A0 =C2=A0 =C2=A0}<br>
-<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 memcpy(path, t-&gt;t_cwd, len);<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 trace_vfs_getcwd_ret(path);<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 return path;<br>
-- <br>
2.27.0<br>
<br>
<br>
</blockquote></div>

--000000000000a969c705b60709e5--


From minios-devel-bounces@lists.xenproject.org Wed Dec 09 21:09:07 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Wed, 09 Dec 2020 21:09:07 +0000
Received: from list by lists.xenproject.org with outflank-mailman.48757.86255 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1kn6hr-00034K-UT; Wed, 09 Dec 2020 21:09:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 48757.86255; Wed, 09 Dec 2020 21:09: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 1kn6hr-00034G-Qt; Wed, 09 Dec 2020 21:09:03 +0000
Received: by outflank-mailman (input) for mailman id 48757;
 Wed, 09 Dec 2020 21:09: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=WndC=FN=neclab.eu=simon.kuenzer@srs-us1.protection.inumbo.net>)
 id 1kn6hq-000349-HM
 for minios-devel@lists.xen.org; Wed, 09 Dec 2020 21:09:02 +0000
Received: from mailer2.neclab.eu (unknown [195.37.70.41])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 7c9e278a-6621-4956-9adc-e5b69de91e3e;
 Wed, 09 Dec 2020 21:09:00 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
 by mailer2.neclab.eu (Postfix) with ESMTP id 615C2F2409;
 Wed,  9 Dec 2020 22:08:59 +0100 (CET)
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 dRLGqad_aPQK; Wed,  9 Dec 2020 22:08:59 +0100 (CET)
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 28419F2191
 for <minios-devel@lists.xen.org>; Wed,  9 Dec 2020 22:08:57 +0100 (CET)
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; Wed, 9 Dec 2020
 22:08:56 +0100
X-BeenThere: minios-devel@lists.xenproject.org
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
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: 7c9e278a-6621-4956-9adc-e5b69de91e3e
X-Virus-Scanned: Amavisd on Debian GNU/Linux (atlas-b.office.hd)
X-ENC: Last-Hop-TLS-encrypted
X-ENC: Last-Hop-TLS-encrypted
From: Simon Kuenzer <simon.kuenzer@neclab.eu>
To: <minios-devel@lists.xen.org>
CC: Simon Kuenzer <simon.kuenzer@neclab.eu>
Subject: [UNIKRAFT PATCH v4 0/5] Memory Pools
Date: Wed, 9 Dec 2020 22:08:48 +0100
Message-ID: <20201209210853.18032-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)

This series implements a memory pool allocator. Pool objects have the same
size and are pre-allocated. Due to this simplification allocations and free
operations are as cheap as O(1). Its intended use is performance critical
allocations when allocation sizes do not vary, like network stacks or disk
buffer caches.

Changes since v3:
 - Remove functionality to let initialize objects by the pool.
   This should be implemented with a wrapping function instead and
   maybe less confusing when using the pool with the uk_alloc API.
 - Provide `uk_allocpool_objlen()`
 - Fix `uk_allocpool2ukalloc()`, the interface was not exported properly

Changes since v2:
 - Fix compile error when `CONFIG_LIBUKALLOC_IFSTATS` is activated

Changes since v1:
 - Correct license header in `pool.c`

Simon Kuenzer (5):
  lib/ukallocpool: Library skeleton
  lib/ukallocpool: LIFO pool implementation
  lib/ukallocpool: Allocate pool on parent allocator
  lib/ukallocpool: `lib/ukalloc` compatible interface
  lib/ukallocpool: Batched allocation

 lib/Makefile.uk                        |   1 +
 lib/ukallocpool/Config.uk              |   6 +
 lib/ukallocpool/Makefile.uk            |   6 +
 lib/ukallocpool/exportsyms.uk          |  11 +
 lib/ukallocpool/include/uk/allocpool.h | 212 +++++++++++++++
 lib/ukallocpool/pool.c                 | 350 +++++++++++++++++++++++++
 6 files changed, 586 insertions(+)
 create mode 100644 lib/ukallocpool/Config.uk
 create mode 100644 lib/ukallocpool/Makefile.uk
 create mode 100644 lib/ukallocpool/exportsyms.uk
 create mode 100644 lib/ukallocpool/include/uk/allocpool.h
 create mode 100644 lib/ukallocpool/pool.c

-- 
2.20.1


From minios-devel-bounces@lists.xenproject.org Wed Dec 09 21:09:08 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Wed, 09 Dec 2020 21:09:08 +0000
Received: from list by lists.xenproject.org with outflank-mailman.48760.86258 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1kn6hw-00035O-14; Wed, 09 Dec 2020 21:09:08 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 48760.86258; Wed, 09 Dec 2020 21:09: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 1kn6hv-00035H-U1; Wed, 09 Dec 2020 21:09:07 +0000
Received: by outflank-mailman (input) for mailman id 48760;
 Wed, 09 Dec 2020 21:09: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=WndC=FN=neclab.eu=simon.kuenzer@srs-us1.protection.inumbo.net>)
 id 1kn6hv-000349-AV
 for minios-devel@lists.xen.org; Wed, 09 Dec 2020 21:09:07 +0000
Received: from mailer2.neclab.eu (unknown [195.37.70.41])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 2cb783e8-d632-4312-863b-12bcab896624;
 Wed, 09 Dec 2020 21:09:02 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
 by mailer2.neclab.eu (Postfix) with ESMTP id 5E22AF2494;
 Wed,  9 Dec 2020 22:09:01 +0100 (CET)
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 bv1ZF-0TY9A3; Wed,  9 Dec 2020 22:09:01 +0100 (CET)
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 327FFF2191
 for <minios-devel@lists.xen.org>; Wed,  9 Dec 2020 22:08:59 +0100 (CET)
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; Wed, 9 Dec 2020
 22:08:58 +0100
X-BeenThere: minios-devel@lists.xenproject.org
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
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: 2cb783e8-d632-4312-863b-12bcab896624
X-Virus-Scanned: Amavisd on Debian GNU/Linux (atlas-b.office.hd)
X-ENC: Last-Hop-TLS-encrypted
X-ENC: Last-Hop-TLS-encrypted
From: Simon Kuenzer <simon.kuenzer@neclab.eu>
To: <minios-devel@lists.xen.org>
CC: Simon Kuenzer <simon.kuenzer@neclab.eu>
Subject: [UNIKRAFT PATCH v4 1/5] lib/ukallocpool: Library skeleton
Date: Wed, 9 Dec 2020 22:08:49 +0100
Message-ID: <20201209210853.18032-2-simon.kuenzer@neclab.eu>
X-Mailer: git-send-email 2.20.1
In-Reply-To: <20201209210853.18032-1-simon.kuenzer@neclab.eu>
References: <20201209210853.18032-1-simon.kuenzer@neclab.eu>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
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)

Registers the library skeleton for ukallocpool.

Signed-off-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
---
 lib/Makefile.uk             | 1 +
 lib/ukallocpool/Config.uk   | 6 ++++++
 lib/ukallocpool/Makefile.uk | 4 ++++
 3 files changed, 11 insertions(+)
 create mode 100644 lib/ukallocpool/Config.uk
 create mode 100644 lib/ukallocpool/Makefile.uk

diff --git a/lib/Makefile.uk b/lib/Makefile.uk
index ff69dfab..7fffdac7 100644
--- a/lib/Makefile.uk
+++ b/lib/Makefile.uk
@@ -15,6 +15,7 @@ $(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))
 $(eval $(call _import_lib,$(CONFIG_UK_BASE)/lib/ukallocregion))
+$(eval $(call _import_lib,$(CONFIG_UK_BASE)/lib/ukallocpool))
 $(eval $(call _import_lib,$(CONFIG_UK_BASE)/lib/uksched))
 $(eval $(call _import_lib,$(CONFIG_UK_BASE)/lib/ukschedcoop))
 $(eval $(call _import_lib,$(CONFIG_UK_BASE)/lib/fdt))
diff --git a/lib/ukallocpool/Config.uk b/lib/ukallocpool/Config.uk
new file mode 100644
index 00000000..5c300117
--- /dev/null
+++ b/lib/ukallocpool/Config.uk
@@ -0,0 +1,6 @@
+config LIBUKALLOCPOOL
+	bool "ukallocpool: Memory pool allocator"
+	default n
+	select LIBNOLIBC if !HAVE_LIBC
+	select LIBUKDEBUG
+	select LIBUKALLOC
diff --git a/lib/ukallocpool/Makefile.uk b/lib/ukallocpool/Makefile.uk
new file mode 100644
index 00000000..c71c9764
--- /dev/null
+++ b/lib/ukallocpool/Makefile.uk
@@ -0,0 +1,4 @@
+$(eval $(call addlib_s,libukallocpool,$(CONFIG_LIBUKALLOCPOOL)))
+
+CINCLUDES-$(CONFIG_LIBUKALLOCPOOL)	+= -I$(LIBUKALLOCPOOL_BASE)/include
+CXXINCLUDES-$(CONFIG_LIBUKALLOCPOOL)	+= -I$(LIBUKALLOCPOOL_BASE)/include
-- 
2.20.1


From minios-devel-bounces@lists.xenproject.org Wed Dec 09 21:09:09 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Wed, 09 Dec 2020 21:09:09 +0000
Received: from list by lists.xenproject.org with outflank-mailman.48761.86262 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1kn6hx-000368-2A; Wed, 09 Dec 2020 21:09:09 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 48761.86262; Wed, 09 Dec 2020 21:09: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 1kn6hw-000361-Vc; Wed, 09 Dec 2020 21:09:08 +0000
Received: by outflank-mailman (input) for mailman id 48761;
 Wed, 09 Dec 2020 21:09:08 +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=WndC=FN=neclab.eu=simon.kuenzer@srs-us1.protection.inumbo.net>)
 id 1kn6hv-00035G-U6
 for minios-devel@lists.xen.org; Wed, 09 Dec 2020 21:09:07 +0000
Received: from mailer2.neclab.eu (unknown [195.37.70.41])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 7d774b38-770f-4632-81fc-c1f7ec3440d8;
 Wed, 09 Dec 2020 21:09:06 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
 by mailer2.neclab.eu (Postfix) with ESMTP id 9A1F1F2494;
 Wed,  9 Dec 2020 22:09:05 +0100 (CET)
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 UiDYhnu6Xpjw; Wed,  9 Dec 2020 22:09:05 +0100 (CET)
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 62AE1F2191
 for <minios-devel@lists.xen.org>; Wed,  9 Dec 2020 22:09:03 +0100 (CET)
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; Wed, 9 Dec 2020
 22:09:00 +0100
X-BeenThere: minios-devel@lists.xenproject.org
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
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: 7d774b38-770f-4632-81fc-c1f7ec3440d8
X-Virus-Scanned: Amavisd on Debian GNU/Linux (atlas-b.office.hd)
X-ENC: Last-Hop-TLS-encrypted
X-ENC: Last-Hop-TLS-encrypted
From: Simon Kuenzer <simon.kuenzer@neclab.eu>
To: <minios-devel@lists.xen.org>
CC: Simon Kuenzer <simon.kuenzer@neclab.eu>
Subject: [UNIKRAFT PATCH v4 3/5] lib/ukallocpool: Allocate pool on parent allocator
Date: Wed, 9 Dec 2020 22:08:51 +0100
Message-ID: <20201209210853.18032-4-simon.kuenzer@neclab.eu>
X-Mailer: git-send-email 2.20.1
In-Reply-To: <20201209210853.18032-1-simon.kuenzer@neclab.eu>
References: <20201209210853.18032-1-simon.kuenzer@neclab.eu>
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)

Provides a function that allocates and initializes a pool on a
given parent allocator.

Signed-off-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
---
 lib/ukallocpool/exportsyms.uk          |  3 ++
 lib/ukallocpool/include/uk/allocpool.h | 49 +++++++++++++++++++++
 lib/ukallocpool/pool.c                 | 59 ++++++++++++++++++++++++++
 3 files changed, 111 insertions(+)

diff --git a/lib/ukallocpool/exportsyms.uk b/lib/ukallocpool/exportsyms.uk
index 9d47d615..0bd38595 100644
--- a/lib/ukallocpool/exportsyms.uk
+++ b/lib/ukallocpool/exportsyms.uk
@@ -1,4 +1,7 @@
+uk_allocpool_alloc
+uk_allocpool_free
 uk_allocpool_init
+uk_allocpool_reqmem
 uk_allocpool_availcount
 uk_allocpool_objlen
 uk_allocpool_take
diff --git a/lib/ukallocpool/include/uk/allocpool.h b/lib/ukallocpool/include/uk/allocpool.h
index 60a47482..7299286b 100644
--- a/lib/ukallocpool/include/uk/allocpool.h
+++ b/lib/ukallocpool/include/uk/allocpool.h
@@ -47,6 +47,55 @@ typedef void (*uk_allocpool_obj_init_t)(void *obj, size_t len, void *cookie);
 
 struct uk_allocpool;
 
+/**
+ * Computes the required memory for a pool allocation
+ *
+ * @param obj_count
+ *  Number of objects that are allocated with the pool
+ * @param obj_len
+ *  Size of one object (bytes)
+ * @param obj_align
+ *  Alignment requirement for each pool object
+ * @return
+ *  Number of bytes needed for pool allocation
+ */
+size_t uk_allocpool_reqmem(unsigned int obj_count, size_t obj_len,
+			   size_t obj_align);
+
+/**
+ * Allocates a memory pool on a parent allocator.
+ *
+ * @param obj_count
+ *  Number of objects that are allocated with the pool
+ * @param obj_len
+ *  Size of one object (bytes)
+ * @param obj_align
+ *  Alignment requirement for each pool object
+ * @param obj_init
+ *  Function pointer to object initialization
+ * @param obj_init_cookie
+ *  Cookie that is hand-over to object initialization
+ * @return
+ *  - (NULL): If allocation failed (e.g., ENOMEM)
+ *  - pointer to allocated pool
+ */
+struct uk_allocpool *uk_allocpool_alloc(struct uk_alloc *parent,
+					unsigned int obj_count,
+					size_t obj_len, size_t obj_align);
+
+/**
+ * Frees a memory pool that was allocated with
+ * uk_allocpool_alloc(). The memory is returned to
+ * the parent allocator.
+ * Note: Please make sure that all taken objects
+ * are returned to the pool before free'ing the
+ * pool.
+ *
+ * @param p
+ *  Pointer to memory pool that will be free'd.
+ */
+void uk_allocpool_free(struct uk_allocpool *p);
+
 /**
  * Initializes a memory pool on a given memory range.
  *
diff --git a/lib/ukallocpool/pool.c b/lib/ukallocpool/pool.c
index 5d5ddbde..31fc8b2d 100644
--- a/lib/ukallocpool/pool.c
+++ b/lib/ukallocpool/pool.c
@@ -73,6 +73,9 @@ struct uk_allocpool {
 	size_t obj_align;
 	size_t obj_len;
 	unsigned int obj_count;
+
+	struct uk_alloc *parent;
+	void *base;
 };
 
 struct free_obj {
@@ -123,6 +126,21 @@ void uk_allocpool_return(struct uk_allocpool *p, void *obj)
 	_prepend_free_obj(p, obj);
 }
 
+size_t uk_allocpool_reqmem(unsigned int obj_count, size_t obj_len,
+			   size_t obj_align)
+{
+	size_t obj_alen;
+
+	UK_ASSERT(POWER_OF_2(obj_align));
+
+	obj_len   = MAX(obj_len, MIN_OBJ_LEN);
+	obj_align = MAX(obj_align, MIN_OBJ_ALIGN);
+	obj_alen  = ALIGN_UP(obj_len, obj_align);
+	return (sizeof(struct uk_allocpool)
+		+ obj_align
+		+ ((size_t) obj_count * obj_alen));
+}
+
 unsigned int uk_allocpool_availcount(struct uk_allocpool *p)
 {
 	return p->free_obj_count;
@@ -181,8 +199,49 @@ struct uk_allocpool *uk_allocpool_init(void *base, size_t len,
 out:
 	p->obj_len         = obj_alen;
 	p->obj_align       = obj_align;
+	p->base            = base;
+	p->parent          = NULL;
 
 	uk_pr_debug("%p: Pool created (%"__PRIsz" B): %u objs of %"__PRIsz" B, aligned to %"__PRIsz" B\n",
 		    p, len, p->obj_count, p->obj_len, p->obj_align);
 	return p;
 }
+
+struct uk_allocpool *uk_allocpool_alloc(struct uk_alloc *parent,
+					unsigned int obj_count,
+					size_t obj_len, size_t obj_align)
+{
+	struct uk_allocpool *p;
+	void *base;
+	size_t len;
+
+	/* uk_allocpool_reqmem computes minimum requirement */
+	len = uk_allocpool_reqmem(obj_count, obj_len, obj_align);
+	base = uk_malloc(parent, len);
+	if (!base)
+		return NULL;
+
+	p = uk_allocpool_init(base, len, obj_len, obj_align);
+	if (!p) {
+		uk_free(parent, base);
+		errno = ENOSPC;
+		return NULL;
+	}
+
+	p->parent = parent;
+	return p;
+}
+
+void uk_allocpool_free(struct uk_allocpool *p)
+{
+	/* If we do not have a parent, this pool was created with
+	 * uk_allocpool_init(). Such a pool cannot be free'd with
+	 * this function since we are not the owner of the allocation
+	 */
+	UK_ASSERT(p->parent);
+
+	/* Make sure we got all objects back */
+	UK_ASSERT(p->free_obj_count == p->obj_count);
+
+	uk_free(p->parent, p->base);
+}
-- 
2.20.1


From minios-devel-bounces@lists.xenproject.org Wed Dec 09 21:09:13 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Wed, 09 Dec 2020 21:09:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.48762.86267 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1kn6i1-00037P-4D; Wed, 09 Dec 2020 21:09:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 48762.86267; Wed, 09 Dec 2020 21:09: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 1kn6i1-00037H-0u; Wed, 09 Dec 2020 21:09:13 +0000
Received: by outflank-mailman (input) for mailman id 48762;
 Wed, 09 Dec 2020 21:09: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=WndC=FN=neclab.eu=simon.kuenzer@srs-us1.protection.inumbo.net>)
 id 1kn6i0-000349-Ad
 for minios-devel@lists.xen.org; Wed, 09 Dec 2020 21:09:12 +0000
Received: from mailer2.neclab.eu (unknown [195.37.70.41])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id f05e2ad7-3b46-4ea9-a536-6780227d008d;
 Wed, 09 Dec 2020 21:09:08 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
 by mailer2.neclab.eu (Postfix) with ESMTP id 9F36BF2495;
 Wed,  9 Dec 2020 22:09:07 +0100 (CET)
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 lUreJ4bykLhg; Wed,  9 Dec 2020 22:09:07 +0100 (CET)
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 74C3EF2191
 for <minios-devel@lists.xen.org>; Wed,  9 Dec 2020 22:09:05 +0100 (CET)
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; Wed, 9 Dec 2020
 22:09:01 +0100
X-BeenThere: minios-devel@lists.xenproject.org
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
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: f05e2ad7-3b46-4ea9-a536-6780227d008d
X-Virus-Scanned: Amavisd on Debian GNU/Linux (atlas-b.office.hd)
X-ENC: Last-Hop-TLS-encrypted
X-ENC: Last-Hop-TLS-encrypted
From: Simon Kuenzer <simon.kuenzer@neclab.eu>
To: <minios-devel@lists.xen.org>
CC: Simon Kuenzer <simon.kuenzer@neclab.eu>
Subject: [UNIKRAFT PATCH v4 4/5] lib/ukallocpool: `lib/ukalloc` compatible interface
Date: Wed, 9 Dec 2020 22:08:52 +0100
Message-ID: <20201209210853.18032-5-simon.kuenzer@neclab.eu>
X-Mailer: git-send-email 2.20.1
In-Reply-To: <20201209210853.18032-1-simon.kuenzer@neclab.eu>
References: <20201209210853.18032-1-simon.kuenzer@neclab.eu>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
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)

Provide a ukalloc compatible interface. This enables the usage of pools
with common allocator interfaces, like `uk_malloc()`, `uk_free()`,
and `uk_memalign()`.

Signed-off-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
---
 lib/ukallocpool/exportsyms.uk          |  1 +
 lib/ukallocpool/include/uk/allocpool.h | 16 ++++++
 lib/ukallocpool/pool.c                 | 76 +++++++++++++++++++++++++-
 3 files changed, 92 insertions(+), 1 deletion(-)

diff --git a/lib/ukallocpool/exportsyms.uk b/lib/ukallocpool/exportsyms.uk
index 0bd38595..68c16ebe 100644
--- a/lib/ukallocpool/exportsyms.uk
+++ b/lib/ukallocpool/exportsyms.uk
@@ -6,3 +6,4 @@ uk_allocpool_availcount
 uk_allocpool_objlen
 uk_allocpool_take
 uk_allocpool_return
+uk_allocpool2ukalloc
diff --git a/lib/ukallocpool/include/uk/allocpool.h b/lib/ukallocpool/include/uk/allocpool.h
index 7299286b..6974ec0c 100644
--- a/lib/ukallocpool/include/uk/allocpool.h
+++ b/lib/ukallocpool/include/uk/allocpool.h
@@ -118,6 +118,18 @@ void uk_allocpool_free(struct uk_allocpool *p);
 struct uk_allocpool *uk_allocpool_init(void *base, size_t len,
 				       size_t obj_len, size_t obj_align);
 
+/**
+ * Return uk_alloc compatible interface for allocpool.
+ * With this interface, uk_malloc(), uk_free(), etc. can
+ * be used with the pool.
+ *
+ * @param p
+ *  Pointer to memory pool.
+ * @return
+ *  Pointer to uk_alloc interface of given pool.
+ */
+struct uk_alloc *uk_allocpool2ukalloc(struct uk_allocpool *p);
+
 /**
  * Return the number of current available (free) objects
  *
@@ -140,6 +152,8 @@ size_t uk_allocpool_objlen(struct uk_allocpool *p);
 
 /**
  * Get one object from a pool
+ * HINT: It is recommended to use this call instead of uk_malloc() whenever
+ *       feasible. This call is avoiding indirections.
  *
  * @param p
  *  Pointer to memory pool.
@@ -151,6 +165,8 @@ void *uk_allocpool_take(struct uk_allocpool *p);
 
 /**
  * Return one object back to a pool
+ * HINT: It is recommended to use this call instead of uk_free() whenever
+ *       feasible. This call is avoiding indirections.
  *
  * @param p
  *  Pointer to memory pool.
diff --git a/lib/ukallocpool/pool.c b/lib/ukallocpool/pool.c
index 31fc8b2d..f9e5c389 100644
--- a/lib/ukallocpool/pool.c
+++ b/lib/ukallocpool/pool.c
@@ -67,6 +67,8 @@
 #define MIN_OBJ_LEN   sizeof(struct uk_list_head)
 
 struct uk_allocpool {
+	struct uk_alloc self;
+
 	struct uk_list_head free_obj;
 	unsigned int free_obj_count;
 
@@ -82,6 +84,21 @@ struct free_obj {
 	struct uk_list_head list;
 };
 
+static inline struct uk_allocpool *ukalloc2pool(struct uk_alloc *a)
+{
+	UK_ASSERT(a);
+	return __containerof(a, struct uk_allocpool, self);
+}
+
+#define allocpool2ukalloc(p) \
+	(&(p)->self)
+
+struct uk_alloc *uk_allocpool2ukalloc(struct uk_allocpool *p)
+{
+	UK_ASSERT(p);
+	return allocpool2ukalloc(p);
+}
+
 static inline void _prepend_free_obj(struct uk_allocpool *p, void *obj)
 {
 	struct uk_list_head *entry;
@@ -109,6 +126,42 @@ static inline void *_take_free_obj(struct uk_allocpool *p)
 	return (void *) obj;
 }
 
+static void pool_free(struct uk_alloc *a, void *ptr)
+{
+	struct uk_allocpool *p = ukalloc2pool(a);
+
+	if (likely(ptr))
+		_prepend_free_obj(p, ptr);
+}
+
+static void *pool_malloc(struct uk_alloc *a, size_t size)
+{
+	struct uk_allocpool *p = ukalloc2pool(a);
+
+	if (unlikely((size > p->obj_len)
+		     || uk_list_empty(&p->free_obj))) {
+		errno = ENOMEM;
+		return NULL;
+	}
+
+	return _take_free_obj(p);
+}
+
+static int pool_posix_memalign(struct uk_alloc *a, void **memptr, size_t align,
+				size_t size)
+{
+	struct uk_allocpool *p = ukalloc2pool(a);
+
+	if (unlikely((size > p->obj_len)
+		     || (align > p->obj_align)
+		     || uk_list_empty(&p->free_obj))) {
+		return ENOMEM;
+	}
+
+	*memptr = _take_free_obj(p);
+	return 0;
+}
+
 void *uk_allocpool_take(struct uk_allocpool *p)
 {
 	UK_ASSERT(p);
@@ -126,6 +179,15 @@ void uk_allocpool_return(struct uk_allocpool *p, void *obj)
 	_prepend_free_obj(p, obj);
 }
 
+#if CONFIG_LIBUKALLOC_IFSTATS
+static ssize_t pool_availmem(struct uk_alloc *a)
+{
+	struct uk_allocpool *p = ukalloc2pool(a);
+
+	return (size_t) p->free_obj_count * p->obj_len;
+}
+#endif
+
 size_t uk_allocpool_reqmem(unsigned int obj_count, size_t obj_len,
 			   size_t obj_align)
 {
@@ -173,7 +235,7 @@ struct uk_allocpool *uk_allocpool_init(void *base, size_t len,
 
 	p = (struct uk_allocpool *) base;
 	memset(p, 0, sizeof(*p));
-	a = uk_allocpool2alloc(p);
+	a = uk_allocpool2ukalloc(p);
 
 	obj_alen = ALIGN_UP(obj_len, obj_align);
 	obj_ptr = (void *) ALIGN_UP((uintptr_t) base + sizeof(*p),
@@ -202,6 +264,18 @@ out:
 	p->base            = base;
 	p->parent          = NULL;
 
+	uk_alloc_init_malloc(a,
+			     pool_malloc,
+			     uk_calloc_compat,
+			     uk_realloc_compat,
+			     pool_free,
+			     pool_posix_memalign,
+			     uk_memalign_compat,
+			     NULL);
+#if CONFIG_LIBUKALLOC_IFSTATS
+	p->self.availmem = pool_availmem;
+#endif
+
 	uk_pr_debug("%p: Pool created (%"__PRIsz" B): %u objs of %"__PRIsz" B, aligned to %"__PRIsz" B\n",
 		    p, len, p->obj_count, p->obj_len, p->obj_align);
 	return p;
-- 
2.20.1


From minios-devel-bounces@lists.xenproject.org Wed Dec 09 21:09:14 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Wed, 09 Dec 2020 21:09:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.48763.86270 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1kn6i2-000383-5r; Wed, 09 Dec 2020 21:09:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 48763.86270; Wed, 09 Dec 2020 21:09: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 1kn6i2-00037w-2O; Wed, 09 Dec 2020 21:09:14 +0000
Received: by outflank-mailman (input) for mailman id 48763;
 Wed, 09 Dec 2020 21:09: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=WndC=FN=neclab.eu=simon.kuenzer@srs-us1.protection.inumbo.net>)
 id 1kn6i0-00035G-Ql
 for minios-devel@lists.xen.org; Wed, 09 Dec 2020 21:09:12 +0000
Received: from mailer2.neclab.eu (unknown [195.37.70.41])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 1ab4d860-0f28-4fc8-a3b2-3f8a877466a7;
 Wed, 09 Dec 2020 21:09:04 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
 by mailer2.neclab.eu (Postfix) with ESMTP id 8E28AF2409;
 Wed,  9 Dec 2020 22:09:03 +0100 (CET)
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 rELJeZGkZ_Rk; Wed,  9 Dec 2020 22:09:03 +0100 (CET)
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 42B85F2191
 for <minios-devel@lists.xen.org>; Wed,  9 Dec 2020 22:09:01 +0100 (CET)
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; Wed, 9 Dec 2020
 22:08:59 +0100
X-BeenThere: minios-devel@lists.xenproject.org
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
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: 1ab4d860-0f28-4fc8-a3b2-3f8a877466a7
X-Virus-Scanned: Amavisd on Debian GNU/Linux (atlas-b.office.hd)
X-ENC: Last-Hop-TLS-encrypted
X-ENC: Last-Hop-TLS-encrypted
From: Simon Kuenzer <simon.kuenzer@neclab.eu>
To: <minios-devel@lists.xen.org>
CC: Simon Kuenzer <simon.kuenzer@neclab.eu>
Subject: [UNIKRAFT PATCH v4 2/5] lib/ukallocpool: LIFO pool implementation
Date: Wed, 9 Dec 2020 22:08:50 +0100
Message-ID: <20201209210853.18032-3-simon.kuenzer@neclab.eu>
X-Mailer: git-send-email 2.20.1
In-Reply-To: <20201209210853.18032-1-simon.kuenzer@neclab.eu>
References: <20201209210853.18032-1-simon.kuenzer@neclab.eu>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Content-Type: text/plain
X-Originating-IP: [192.168.24.96]
X-ClientProxiedBy: oberon.office.hd (192.168.24.90) To puck.office.hd
 (192.168.24.91)

Initial implementation of a memory pool (same-sized and fixed-sized object
allocator) following LIFO principle by using a single list to keep track of
free objects. LIFO is chosen to potentially better utilize hardware caches.

Signed-off-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
---
 lib/ukallocpool/Makefile.uk            |   2 +
 lib/ukallocpool/exportsyms.uk          |   5 +
 lib/ukallocpool/include/uk/allocpool.h | 117 +++++++++++++++
 lib/ukallocpool/pool.c                 | 188 +++++++++++++++++++++++++
 4 files changed, 312 insertions(+)
 create mode 100644 lib/ukallocpool/exportsyms.uk
 create mode 100644 lib/ukallocpool/include/uk/allocpool.h
 create mode 100644 lib/ukallocpool/pool.c

diff --git a/lib/ukallocpool/Makefile.uk b/lib/ukallocpool/Makefile.uk
index c71c9764..63c24dc1 100644
--- a/lib/ukallocpool/Makefile.uk
+++ b/lib/ukallocpool/Makefile.uk
@@ -2,3 +2,5 @@ $(eval $(call addlib_s,libukallocpool,$(CONFIG_LIBUKALLOCPOOL)))
 
 CINCLUDES-$(CONFIG_LIBUKALLOCPOOL)	+= -I$(LIBUKALLOCPOOL_BASE)/include
 CXXINCLUDES-$(CONFIG_LIBUKALLOCPOOL)	+= -I$(LIBUKALLOCPOOL_BASE)/include
+
+LIBUKALLOCPOOL_SRCS-y += $(LIBUKALLOCPOOL_BASE)/pool.c
diff --git a/lib/ukallocpool/exportsyms.uk b/lib/ukallocpool/exportsyms.uk
new file mode 100644
index 00000000..9d47d615
--- /dev/null
+++ b/lib/ukallocpool/exportsyms.uk
@@ -0,0 +1,5 @@
+uk_allocpool_init
+uk_allocpool_availcount
+uk_allocpool_objlen
+uk_allocpool_take
+uk_allocpool_return
diff --git a/lib/ukallocpool/include/uk/allocpool.h b/lib/ukallocpool/include/uk/allocpool.h
new file mode 100644
index 00000000..60a47482
--- /dev/null
+++ b/lib/ukallocpool/include/uk/allocpool.h
@@ -0,0 +1,117 @@
+/* SPDX-License-Identifier: BSD-3-Clause */
+/*
+ * Simple memory pool using LIFO principle
+ *
+ * Authors: Simon Kuenzer <simon.kuenzer@neclab.eu>
+ *
+ *
+ * Copyright (c) 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
+ * 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 __LIBUKALLOCPOOL_H__
+#define __LIBUKALLOCPOOL_H__
+
+#include <uk/alloc.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef void (*uk_allocpool_obj_init_t)(void *obj, size_t len, void *cookie);
+
+struct uk_allocpool;
+
+/**
+ * Initializes a memory pool on a given memory range.
+ *
+ * @param base
+ *  Base address of memory range
+ * @param len
+ *  Length of memory range (bytes)
+ * @param obj_len
+ *  Size of one object (bytes)
+ * @param obj_align
+ *  Alignment requirement for each pool object
+ * @param obj_init
+ *  Function pointer to object initialization
+ * @param obj_init_cookie
+ *  Cookie that is hand-over to object initialization
+ * @return
+ *  - (NULL): Not enough memory for pool
+ *  - pointer to initializes pool
+ */
+struct uk_allocpool *uk_allocpool_init(void *base, size_t len,
+				       size_t obj_len, size_t obj_align);
+
+/**
+ * Return the number of current available (free) objects
+ *
+ * @param p
+ *  Pointer to memory pool.
+ * @return
+ *  Number of free objects in the pool.
+ */
+unsigned int uk_allocpool_availcount(struct uk_allocpool *p);
+
+/**
+ * Return the size of an object
+ *
+ * @param p
+ *  Pointer to memory pool.
+ * @return
+ *  Size of an object
+ */
+size_t uk_allocpool_objlen(struct uk_allocpool *p);
+
+/**
+ * Get one object from a pool
+ *
+ * @param p
+ *  Pointer to memory pool.
+ * @return
+ *  - (NULL): No more free objects available
+ *  - Pointer to object.
+ */
+void *uk_allocpool_take(struct uk_allocpool *p);
+
+/**
+ * Return one object back to a pool
+ *
+ * @param p
+ *  Pointer to memory pool.
+ * @param obj
+ *  Pointer to object that should be returned.
+ */
+void uk_allocpool_return(struct uk_allocpool *p, void *obj);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __LIBUKALLOCPOOL_H__ */
diff --git a/lib/ukallocpool/pool.c b/lib/ukallocpool/pool.c
new file mode 100644
index 00000000..5d5ddbde
--- /dev/null
+++ b/lib/ukallocpool/pool.c
@@ -0,0 +1,188 @@
+/* SPDX-License-Identifier: BSD-3-Clause */
+/*
+ * Simple memory pool using LIFO principle
+ *
+ * Authors: Simon Kuenzer <simon.kuenzer@neclab.eu>
+ *
+ *
+ * Copyright (c) 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
+ * 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/essentials.h>
+#include <uk/alloc_impl.h>
+#include <uk/allocpool.h>
+#include <uk/list.h>
+#include <string.h>
+#include <stddef.h>
+#include <stdint.h>
+#include <sys/types.h>
+#include <errno.h>
+
+/*
+ * POOL: MEMORY LAYOUT
+ *
+ *          ++---------------------++
+ *          || struct uk_allocpool ||
+ *          ||                     ||
+ *          ++---------------------++
+ *          |    // padding //      |
+ *          +=======================+
+ *          |       OBJECT 1        |
+ *          +=======================+
+ *          |       OBJECT 2        |
+ *          +=======================+
+ *          |       OBJECT 3        |
+ *          +=======================+
+ *          |         ...           |
+ *          v                       v
+ */
+
+#define MIN_OBJ_ALIGN sizeof(void *)
+#define MIN_OBJ_LEN   sizeof(struct uk_list_head)
+
+struct uk_allocpool {
+	struct uk_list_head free_obj;
+	unsigned int free_obj_count;
+
+	size_t obj_align;
+	size_t obj_len;
+	unsigned int obj_count;
+};
+
+struct free_obj {
+	struct uk_list_head list;
+};
+
+static inline void _prepend_free_obj(struct uk_allocpool *p, void *obj)
+{
+	struct uk_list_head *entry;
+
+	UK_ASSERT(p);
+	UK_ASSERT(obj);
+	UK_ASSERT(p->free_obj_count < p->obj_count);
+
+	entry = &((struct free_obj *) obj)->list;
+	uk_list_add(entry, &p->free_obj);
+	p->free_obj_count++;
+}
+
+static inline void *_take_free_obj(struct uk_allocpool *p)
+{
+	struct free_obj *obj;
+
+	UK_ASSERT(p);
+	UK_ASSERT(p->free_obj_count > 0);
+
+	/* get object from list head */
+	obj = uk_list_first_entry(&p->free_obj, struct free_obj, list);
+	uk_list_del(&obj->list);
+	p->free_obj_count--;
+	return (void *) obj;
+}
+
+void *uk_allocpool_take(struct uk_allocpool *p)
+{
+	UK_ASSERT(p);
+
+	if (unlikely(uk_list_empty(&p->free_obj)))
+		return NULL;
+
+	return _take_free_obj(p);
+}
+
+void uk_allocpool_return(struct uk_allocpool *p, void *obj)
+{
+	UK_ASSERT(p);
+
+	_prepend_free_obj(p, obj);
+}
+
+unsigned int uk_allocpool_availcount(struct uk_allocpool *p)
+{
+	return p->free_obj_count;
+}
+
+size_t uk_allocpool_objlen(struct uk_allocpool *p)
+{
+	return p->obj_len;
+}
+
+struct uk_allocpool *uk_allocpool_init(void *base, size_t len,
+				       size_t obj_len, size_t obj_align)
+{
+	struct uk_allocpool *p;
+	struct uk_alloc *a;
+	size_t obj_alen;
+	size_t left;
+	void *obj_ptr;
+
+	UK_ASSERT(POWER_OF_2(obj_align));
+
+	if (!base || sizeof(struct uk_allocpool) > len) {
+		errno = ENOSPC;
+		return NULL;
+	}
+
+	/* apply minimum requirements */
+	obj_len   = MAX(obj_len, MIN_OBJ_LEN);
+	obj_align = MAX(obj_align, MIN_OBJ_ALIGN);
+
+	p = (struct uk_allocpool *) base;
+	memset(p, 0, sizeof(*p));
+	a = uk_allocpool2alloc(p);
+
+	obj_alen = ALIGN_UP(obj_len, obj_align);
+	obj_ptr = (void *) ALIGN_UP((uintptr_t) base + sizeof(*p),
+				    obj_align);
+	if ((uintptr_t) obj_ptr > (uintptr_t) base + len) {
+		uk_pr_debug("%p: Empty pool: Not enough space for allocating objects\n",
+			    p);
+		goto out;
+	}
+
+	left = len - ((uintptr_t) obj_ptr - (uintptr_t) base);
+
+	p->obj_count = 0;
+	p->free_obj_count = 0;
+	UK_INIT_LIST_HEAD(&p->free_obj);
+	while (left >= obj_alen) {
+		++p->obj_count;
+		_prepend_free_obj(p, obj_ptr);
+		obj_ptr = (void *) ((uintptr_t) obj_ptr + obj_alen);
+		left -= obj_alen;
+	}
+
+out:
+	p->obj_len         = obj_alen;
+	p->obj_align       = obj_align;
+
+	uk_pr_debug("%p: Pool created (%"__PRIsz" B): %u objs of %"__PRIsz" B, aligned to %"__PRIsz" B\n",
+		    p, len, p->obj_count, p->obj_len, p->obj_align);
+	return p;
+}
-- 
2.20.1


From minios-devel-bounces@lists.xenproject.org Wed Dec 09 21:09:19 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Wed, 09 Dec 2020 21:09:19 +0000
Received: from list by lists.xenproject.org with outflank-mailman.48764.86275 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1kn6i7-00039v-8l; Wed, 09 Dec 2020 21:09:19 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 48764.86275; Wed, 09 Dec 2020 21:09: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 1kn6i7-00039o-5J; Wed, 09 Dec 2020 21:09:19 +0000
Received: by outflank-mailman (input) for mailman id 48764;
 Wed, 09 Dec 2020 21:09: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=WndC=FN=neclab.eu=simon.kuenzer@srs-us1.protection.inumbo.net>)
 id 1kn6i5-00035G-R2
 for minios-devel@lists.xen.org; Wed, 09 Dec 2020 21:09:17 +0000
Received: from mailer2.neclab.eu (unknown [195.37.70.41])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 94684b56-c673-43ed-8bb7-9eb08604479d;
 Wed, 09 Dec 2020 21:09:10 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
 by mailer2.neclab.eu (Postfix) with ESMTP id AF5C0F2409;
 Wed,  9 Dec 2020 22:09:09 +0100 (CET)
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 OpsL4rWmLx5p; Wed,  9 Dec 2020 22:09:09 +0100 (CET)
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 83DE1F2191
 for <minios-devel@lists.xen.org>; Wed,  9 Dec 2020 22:09:07 +0100 (CET)
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; Wed, 9 Dec 2020
 22:09:02 +0100
X-BeenThere: minios-devel@lists.xenproject.org
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
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: 94684b56-c673-43ed-8bb7-9eb08604479d
X-Virus-Scanned: Amavisd on Debian GNU/Linux (atlas-b.office.hd)
X-ENC: Last-Hop-TLS-encrypted
X-ENC: Last-Hop-TLS-encrypted
From: Simon Kuenzer <simon.kuenzer@neclab.eu>
To: <minios-devel@lists.xen.org>
CC: Simon Kuenzer <simon.kuenzer@neclab.eu>
Subject: [UNIKRAFT PATCH v4 5/5] lib/ukallocpool: Batched allocation
Date: Wed, 9 Dec 2020 22:08:53 +0100
Message-ID: <20201209210853.18032-6-simon.kuenzer@neclab.eu>
X-Mailer: git-send-email 2.20.1
In-Reply-To: <20201209210853.18032-1-simon.kuenzer@neclab.eu>
References: <20201209210853.18032-1-simon.kuenzer@neclab.eu>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Content-Type: text/plain
X-Originating-IP: [192.168.24.96]
X-ClientProxiedBy: oberon.office.hd (192.168.24.90) To puck.office.hd
 (192.168.24.91)

Introduce low-overhead interfaces for batched allocations and batched
freeing of objects.

Signed-off-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
---
 lib/ukallocpool/exportsyms.uk          |  2 ++
 lib/ukallocpool/include/uk/allocpool.h | 30 ++++++++++++++++++++++++++
 lib/ukallocpool/pool.c                 | 29 +++++++++++++++++++++++++
 3 files changed, 61 insertions(+)

diff --git a/lib/ukallocpool/exportsyms.uk b/lib/ukallocpool/exportsyms.uk
index 68c16ebe..0f4c3de4 100644
--- a/lib/ukallocpool/exportsyms.uk
+++ b/lib/ukallocpool/exportsyms.uk
@@ -5,5 +5,7 @@ uk_allocpool_reqmem
 uk_allocpool_availcount
 uk_allocpool_objlen
 uk_allocpool_take
+uk_allocpool_take_batch
 uk_allocpool_return
+uk_allocpool_return_batch
 uk_allocpool2ukalloc
diff --git a/lib/ukallocpool/include/uk/allocpool.h b/lib/ukallocpool/include/uk/allocpool.h
index 6974ec0c..6c028289 100644
--- a/lib/ukallocpool/include/uk/allocpool.h
+++ b/lib/ukallocpool/include/uk/allocpool.h
@@ -163,6 +163,22 @@ size_t uk_allocpool_objlen(struct uk_allocpool *p);
  */
 void *uk_allocpool_take(struct uk_allocpool *p);
 
+/**
+ * Get multiple objects from a pool.
+ *
+ * @param p
+ *  Pointer to memory pool.
+ * @param obj
+ *  Pointer to array that will be filled with pointers of
+ *  allocated objects from the pool.
+ * @param count
+ *  Maximum number of objects that should be taken from the pool
+ * @return
+ *  Number of successfully allocated objects on the given array
+ */
+unsigned int uk_allocpool_take_batch(struct uk_allocpool *p,
+				     void *obj[], unsigned int count);
+
 /**
  * Return one object back to a pool
  * HINT: It is recommended to use this call instead of uk_free() whenever
@@ -175,6 +191,20 @@ void *uk_allocpool_take(struct uk_allocpool *p);
  */
 void uk_allocpool_return(struct uk_allocpool *p, void *obj);
 
+/**
+ * Return multiple objects to a pool.
+ *
+ * @param p
+ *  Pointer to memory pool.
+ * @param obj
+ *  Pointer to array that with pointers of objects that
+ *  should be returned.
+ * @param count
+ *  Number of objects that are on the array.
+ */
+void uk_allocpool_return_batch(struct uk_allocpool *p,
+			       void *obj[], unsigned int count);
+
 #ifdef __cplusplus
 }
 #endif
diff --git a/lib/ukallocpool/pool.c b/lib/ukallocpool/pool.c
index f9e5c389..ad8ac24e 100644
--- a/lib/ukallocpool/pool.c
+++ b/lib/ukallocpool/pool.c
@@ -172,6 +172,23 @@ void *uk_allocpool_take(struct uk_allocpool *p)
 	return _take_free_obj(p);
 }
 
+unsigned int uk_allocpool_take_batch(struct uk_allocpool *p,
+				     void *obj[], unsigned int count)
+{
+	unsigned int i;
+
+	UK_ASSERT(p);
+	UK_ASSERT(obj);
+
+	for (i = 0; i < count; ++i) {
+		if (unlikely(uk_list_empty(&p->free_obj)))
+			break;
+		obj[i] = _take_free_obj(p);
+	}
+
+	return i;
+}
+
 void uk_allocpool_return(struct uk_allocpool *p, void *obj)
 {
 	UK_ASSERT(p);
@@ -179,6 +196,18 @@ void uk_allocpool_return(struct uk_allocpool *p, void *obj)
 	_prepend_free_obj(p, obj);
 }
 
+void uk_allocpool_return_batch(struct uk_allocpool *p,
+			       void *obj[], unsigned int count)
+{
+	unsigned int i;
+
+	UK_ASSERT(p);
+	UK_ASSERT(obj);
+
+	for (i = 0; i < count; ++i)
+		_prepend_free_obj(p, obj[i]);
+}
+
 #if CONFIG_LIBUKALLOC_IFSTATS
 static ssize_t pool_availmem(struct uk_alloc *a)
 {
-- 
2.20.1


From minios-devel-bounces@lists.xenproject.org Wed Dec 09 21:32:01 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Wed, 09 Dec 2020 21:32:01 +0000
Received: from list by lists.xenproject.org with outflank-mailman.48778.86278 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1kn743-0005uX-VN; Wed, 09 Dec 2020 21:31:59 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 48778.86278; Wed, 09 Dec 2020 21:31: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 1kn743-0005uQ-ST; Wed, 09 Dec 2020 21:31:59 +0000
Received: by outflank-mailman (input) for mailman id 48778;
 Wed, 09 Dec 2020 21:31: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=WndC=FN=neclab.eu=simon.kuenzer@srs-us1.protection.inumbo.net>)
 id 1kn742-0005uL-MX
 for minios-devel@lists.xen.org; Wed, 09 Dec 2020 21:31:58 +0000
Received: from mailer1.neclab.eu (unknown [195.37.70.40])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id ed6daba2-a08f-43ee-b541-b6b44d40038a;
 Wed, 09 Dec 2020 21:31:56 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
 by mailer1.neclab.eu (Postfix) with ESMTP id D12A910397A;
 Wed,  9 Dec 2020 22:31:55 +0100 (CET)
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 GYkHg_ev6K3J; Wed,  9 Dec 2020 22:31:55 +0100 (CET)
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 A2D88FFA02
 for <minios-devel@lists.xen.org>; Wed,  9 Dec 2020 22:31:55 +0100 (CET)
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; Wed, 9 Dec 2020
 22:31:55 +0100
X-BeenThere: minios-devel@lists.xenproject.org
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
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: ed6daba2-a08f-43ee-b541-b6b44d40038a
X-Virus-Scanned: Amavisd on Debian GNU/Linux (atlas-a.office.hd)
X-ENC: Last-Hop-TLS-encrypted
X-ENC: Last-Hop-TLS-encrypted
From: Simon Kuenzer <simon.kuenzer@neclab.eu>
To: <minios-devel@lists.xen.org>
CC: Simon Kuenzer <simon.kuenzer@neclab.eu>
Subject: [UNIKRAFT PATCH 1/2] lib/ukallocpool: Always provide `uk_alloc_availmem()`, `uk_alloc_maxalloc()`
Date: Wed, 9 Dec 2020 22:31:49 +0100
Message-ID: <20201209213150.18729-2-simon.kuenzer@neclab.eu>
X-Mailer: git-send-email 2.20.1
In-Reply-To: <20201209213150.18729-1-simon.kuenzer@neclab.eu>
References: <20201209213150.18729-1-simon.kuenzer@neclab.eu>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
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)

Adopts to the changed meaning of `CONFIG_LIBUKALLLC_IFSTATS` and provide
`uk_alloc_availmem()` and `uk_alloc_maxalloc()` always.

Signed-off-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
---
 lib/ukallocpool/pool.c | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/lib/ukallocpool/pool.c b/lib/ukallocpool/pool.c
index ad8ac24e..67f235bb 100644
--- a/lib/ukallocpool/pool.c
+++ b/lib/ukallocpool/pool.c
@@ -208,14 +208,19 @@ void uk_allocpool_return_batch(struct uk_allocpool *p,
 		_prepend_free_obj(p, obj[i]);
 }
 
-#if CONFIG_LIBUKALLOC_IFSTATS
 static ssize_t pool_availmem(struct uk_alloc *a)
 {
 	struct uk_allocpool *p = ukalloc2pool(a);
 
-	return (size_t) p->free_obj_count * p->obj_len;
+	return (ssize_t) (p->free_obj_count * p->obj_len);
+}
+
+static ssize_t pool_maxalloc(struct uk_alloc *a)
+{
+	struct uk_allocpool *p = ukalloc2pool(a);
+
+	return (ssize_t) p->obj_len;
 }
-#endif
 
 size_t uk_allocpool_reqmem(unsigned int obj_count, size_t obj_len,
 			   size_t obj_align)
@@ -300,6 +305,8 @@ out:
 			     pool_free,
 			     pool_posix_memalign,
 			     uk_memalign_compat,
+			     pool_maxalloc,
+			     pool_availmem,
 			     NULL);
 #if CONFIG_LIBUKALLOC_IFSTATS
 	p->self.availmem = pool_availmem;
-- 
2.20.1


From minios-devel-bounces@lists.xenproject.org Wed Dec 09 21:32:04 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Wed, 09 Dec 2020 21:32:04 +0000
Received: from list by lists.xenproject.org with outflank-mailman.48779.86283 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1kn748-0005vI-1Y; Wed, 09 Dec 2020 21:32:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 48779.86283; Wed, 09 Dec 2020 21:32: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 1kn747-0005vA-UA; Wed, 09 Dec 2020 21:32:03 +0000
Received: by outflank-mailman (input) for mailman id 48779;
 Wed, 09 Dec 2020 21:32:02 +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=WndC=FN=neclab.eu=simon.kuenzer@srs-us1.protection.inumbo.net>)
 id 1kn746-0005uw-9K
 for minios-devel@lists.xen.org; Wed, 09 Dec 2020 21:32:02 +0000
Received: from mailer2.neclab.eu (unknown [195.37.70.41])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id f6209b07-b589-40e1-b94b-75c325a76431;
 Wed, 09 Dec 2020 21:32:00 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
 by mailer2.neclab.eu (Postfix) with ESMTP id 710E9F2409;
 Wed,  9 Dec 2020 22:31:59 +0100 (CET)
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 2WzMPHX9Y1X2; Wed,  9 Dec 2020 22:31:59 +0100 (CET)
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 46BB9F2339
 for <minios-devel@lists.xen.org>; Wed,  9 Dec 2020 22:31:57 +0100 (CET)
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; Wed, 9 Dec 2020
 22:31:56 +0100
X-BeenThere: minios-devel@lists.xenproject.org
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
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: f6209b07-b589-40e1-b94b-75c325a76431
X-Virus-Scanned: Amavisd on Debian GNU/Linux (atlas-b.office.hd)
X-ENC: Last-Hop-TLS-encrypted
X-ENC: Last-Hop-TLS-encrypted
From: Simon Kuenzer <simon.kuenzer@neclab.eu>
To: <minios-devel@lists.xen.org>
CC: Simon Kuenzer <simon.kuenzer@neclab.eu>
Subject: [UNIKRAFT PATCH 2/2] lib/ukallocpool: Instrumentation for statistics
Date: Wed, 9 Dec 2020 22:31:50 +0100
Message-ID: <20201209213150.18729-3-simon.kuenzer@neclab.eu>
X-Mailer: git-send-email 2.20.1
In-Reply-To: <20201209213150.18729-1-simon.kuenzer@neclab.eu>
References: <20201209213150.18729-1-simon.kuenzer@neclab.eu>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Content-Type: text/plain
X-Originating-IP: [192.168.24.96]
X-ClientProxiedBy: oberon.office.hd (192.168.24.90) To puck.office.hd
 (192.168.24.91)

Instruments the allocator to record allocation statistics.

Signed-off-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
---
 lib/ukallocpool/pool.c | 39 +++++++++++++++++++++++++++++++++------
 1 file changed, 33 insertions(+), 6 deletions(-)

diff --git a/lib/ukallocpool/pool.c b/lib/ukallocpool/pool.c
index 67f235bb..01187012 100644
--- a/lib/ukallocpool/pool.c
+++ b/lib/ukallocpool/pool.c
@@ -130,21 +130,27 @@ static void pool_free(struct uk_alloc *a, void *ptr)
 {
 	struct uk_allocpool *p = ukalloc2pool(a);
 
-	if (likely(ptr))
+	if (likely(ptr)) {
 		_prepend_free_obj(p, ptr);
+		uk_alloc_stats_count_free(a, ptr, p->obj_len);
+	}
 }
 
 static void *pool_malloc(struct uk_alloc *a, size_t size)
 {
 	struct uk_allocpool *p = ukalloc2pool(a);
+	void *obj;
 
 	if (unlikely((size > p->obj_len)
 		     || uk_list_empty(&p->free_obj))) {
+		uk_alloc_stats_count_enomem(a, p->obj_len);
 		errno = ENOMEM;
 		return NULL;
 	}
 
-	return _take_free_obj(p);
+	obj = _take_free_obj(p);
+	uk_alloc_stats_count_alloc(a, obj, p->obj_len);
+	return obj;
 }
 
 static int pool_posix_memalign(struct uk_alloc *a, void **memptr, size_t align,
@@ -155,21 +161,31 @@ static int pool_posix_memalign(struct uk_alloc *a, void **memptr, size_t align,
 	if (unlikely((size > p->obj_len)
 		     || (align > p->obj_align)
 		     || uk_list_empty(&p->free_obj))) {
+		uk_alloc_stats_count_enomem(a, p->obj_len);
 		return ENOMEM;
 	}
 
 	*memptr = _take_free_obj(p);
+	uk_alloc_stats_count_alloc(a, *memptr, p->obj_len);
 	return 0;
 }
 
 void *uk_allocpool_take(struct uk_allocpool *p)
 {
+	void *obj;
+
 	UK_ASSERT(p);
 
-	if (unlikely(uk_list_empty(&p->free_obj)))
+	if (unlikely(uk_list_empty(&p->free_obj))) {
+		uk_alloc_stats_count_enomem(allocpool2alloc(p),
+					    p->obj_len);
 		return NULL;
+	}
 
-	return _take_free_obj(p);
+	obj = _take_free_obj(p);
+	uk_alloc_stats_count_alloc(allocpool2alloc(p),
+				   obj, p->obj_len);
+	return obj;
 }
 
 unsigned int uk_allocpool_take_batch(struct uk_allocpool *p,
@@ -184,8 +200,14 @@ unsigned int uk_allocpool_take_batch(struct uk_allocpool *p,
 		if (unlikely(uk_list_empty(&p->free_obj)))
 			break;
 		obj[i] = _take_free_obj(p);
+		uk_alloc_stats_count_alloc(allocpool2alloc(p),
+					   obj[i], p->obj_len);
 	}
 
+	if (unlikely(i == 0))
+		uk_alloc_stats_count_enomem(allocpool2alloc(p),
+					    p->obj_len);
+
 	return i;
 }
 
@@ -194,6 +216,8 @@ void uk_allocpool_return(struct uk_allocpool *p, void *obj)
 	UK_ASSERT(p);
 
 	_prepend_free_obj(p, obj);
+	uk_alloc_stats_count_free(allocpool2alloc(p),
+				  obj, p->obj_len);
 }
 
 void uk_allocpool_return_batch(struct uk_allocpool *p,
@@ -204,8 +228,11 @@ void uk_allocpool_return_batch(struct uk_allocpool *p,
 	UK_ASSERT(p);
 	UK_ASSERT(obj);
 
-	for (i = 0; i < count; ++i)
+	for (i = 0; i < count; ++i) {
 		_prepend_free_obj(p, obj[i]);
+		uk_alloc_stats_count_free(allocpool2alloc(p),
+					  obj[i], p->obj_len);
+	}
 }
 
 static ssize_t pool_availmem(struct uk_alloc *a)
@@ -269,7 +296,7 @@ struct uk_allocpool *uk_allocpool_init(void *base, size_t len,
 
 	p = (struct uk_allocpool *) base;
 	memset(p, 0, sizeof(*p));
-	a = uk_allocpool2ukalloc(p);
+	a = allocpool2ukalloc(p);
 
 	obj_alen = ALIGN_UP(obj_len, obj_align);
 	obj_ptr = (void *) ALIGN_UP((uintptr_t) base + sizeof(*p),
-- 
2.20.1


From minios-devel-bounces@lists.xenproject.org Wed Dec 09 21:32:05 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Wed, 09 Dec 2020 21:32:05 +0000
Received: from list by lists.xenproject.org with outflank-mailman.48780.86287 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1kn749-0005vt-2j; Wed, 09 Dec 2020 21:32:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 48780.86287; Wed, 09 Dec 2020 21:32: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 1kn748-0005vm-Vr; Wed, 09 Dec 2020 21:32:04 +0000
Received: by outflank-mailman (input) for mailman id 48780;
 Wed, 09 Dec 2020 21:32: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=WndC=FN=neclab.eu=simon.kuenzer@srs-us1.protection.inumbo.net>)
 id 1kn747-0005uL-Ia
 for minios-devel@lists.xen.org; Wed, 09 Dec 2020 21:32:03 +0000
Received: from mailer2.neclab.eu (unknown [195.37.70.41])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id b5106774-fa4b-481f-8597-c89331fd4406;
 Wed, 09 Dec 2020 21:31:56 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
 by mailer2.neclab.eu (Postfix) with ESMTP id AA64CF2409;
 Wed,  9 Dec 2020 22:31:55 +0100 (CET)
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 QXLIis3foL4n; Wed,  9 Dec 2020 22:31:55 +0100 (CET)
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 845E0F2339
 for <minios-devel@lists.xen.org>; Wed,  9 Dec 2020 22:31:53 +0100 (CET)
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; Wed, 9 Dec 2020
 22:31:53 +0100
X-BeenThere: minios-devel@lists.xenproject.org
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
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: b5106774-fa4b-481f-8597-c89331fd4406
X-Virus-Scanned: Amavisd on Debian GNU/Linux (atlas-b.office.hd)
X-ENC: Last-Hop-TLS-encrypted
X-ENC: Last-Hop-TLS-encrypted
From: Simon Kuenzer <simon.kuenzer@neclab.eu>
To: <minios-devel@lists.xen.org>
CC: Simon Kuenzer <simon.kuenzer@neclab.eu>
Subject: [UNIKRAFT PATCH 0/2] lib/ukallocpool: Instrumentation for statistics
Date: Wed, 9 Dec 2020 22:31:48 +0100
Message-ID: <20201209213150.18729-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)

Adopts lib/ukallocpool introduced with series 1597
( https://patchwork.unikraft.org/project/unikraft/list/?series=1597 )
to the lib/ukalloc API changes that are introduced with series 1574
( https://patchwork.unikraft.org/project/unikraft/list/?series=1574 ).

Simon Kuenzer (2):
  lib/ukallocpool: Always provide `uk_alloc_availmem()`,
    `uk_alloc_maxalloc()`
  lib/ukallocpool: Instrumentation for statistics

 lib/ukallocpool/pool.c | 52 ++++++++++++++++++++++++++++++++++--------
 1 file changed, 43 insertions(+), 9 deletions(-)

-- 
2.20.1


From minios-devel-bounces@lists.xenproject.org Fri Dec 11 12:19:39 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Fri, 11 Dec 2020 12:19:39 +0000
Received: from list by lists.xenproject.org with outflank-mailman.50502.89190 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1knhOX-0002um-83; Fri, 11 Dec 2020 12:19:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 50502.89190; Fri, 11 Dec 2020 12:19: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 1knhOX-0002ud-4Q; Fri, 11 Dec 2020 12:19:33 +0000
Received: by outflank-mailman (input) for mailman id 50502;
 Fri, 11 Dec 2020 12:19:31 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=jsd7=FP=gmail.com=cezar.craciunoiu@srs-us1.protection.inumbo.net>)
 id 1knhOV-0002sw-1w
 for minios-devel@lists.xen.org; Fri, 11 Dec 2020 12:19:31 +0000
Received: from mail-ej1-x62a.google.com (unknown [2a00:1450:4864:20::62a])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id ffc21898-6a5f-4243-af6e-1c846274e322;
 Fri, 11 Dec 2020 12:19:30 +0000 (UTC)
Received: by mail-ej1-x62a.google.com with SMTP id g20so12086674ejb.1
 for <minios-devel@lists.xen.org>; Fri, 11 Dec 2020 04:19:30 -0800 (PST)
Received: from localhost.localdomain ([2a02:2f05:6908:e000::1003])
 by smtp.gmail.com with ESMTPSA id qn4sm6808896ejb.50.2020.12.11.04.19.28
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Fri, 11 Dec 2020 04:19:28 -0800 (PST)
X-BeenThere: minios-devel@lists.xenproject.org
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
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: ffc21898-6a5f-4243-af6e-1c846274e322
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=wfeEUMjwKW+4bQmkw0eIBY7NMfN9tzkkdZEUlJfH9ZU=;
        b=pOj87kUldFu/qZUPA/swcJjJ0wBG749+f5+O2TjNQIv8xMPGt/qXvZdhx1JoQhY75w
         9OSbeRTghN32tNp2+2jyfByOMa3ySn2xF5d4j6ZKJjApSNjOI7g84ucKOJv349ymR/bU
         7z5degcl93a6cuYuP1T80mEBb+TkhOqxYjIBkvMXfFjj5KDuH8gD0EQdP7VgulTk7V/v
         xRXyIUPvvp+2ays7RfCtX3HZ1FHCQDNJGkjbEAVaK4/DwdXUJ9H9CnPjg58dGDZ4FSdm
         Nv7wOzCnkC53kJJRSaITHtHnlPhXZHQUHkWm/X6zX5e5eWm4kJ5f5aWF10BICVg76zOn
         O5+g==
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=wfeEUMjwKW+4bQmkw0eIBY7NMfN9tzkkdZEUlJfH9ZU=;
        b=kQkWX+dN2NNWSx2Uwyhif0NJMSFMaCoT8D1vjxc9dtr3U+t+JKDJPrzo8rUvulpgAK
         0Vi6ANPF5QU39fmGRZ6S4kKZmmUd8fwryYVlu6VCQ0UGAohyuqSZuxXI2LuV+WtylWDq
         y4uveRpYLBdpTPHjNiAU/cT51oKn7zey1VdhMD4sETOrYHmNIbYQyQzvVbL+NASnx2UQ
         Nu2JS0InXxLuqCUkFf2R1AQj6hGRPJ36OFjRFB4UHsDH/6oF/vCaoX99G8rLIYeSK427
         zS6U1/GsT/OdqSxL8gxxUuk5OECyfn56ns82wY3oZoJZje/hca5AVCzy4egI/s0TzxVZ
         o56A==
X-Gm-Message-State: AOAM530S1AREhj/ty1BxwvomXrIYAWE0mG3Y9abm6b64puZiRomlUShx
	SRiHCtlYW0JYhFZMQWr6Kp4=
X-Google-Smtp-Source: ABdhPJz3Uy82mBuGeHAPIIRyLSK92XIMO4YUrY65C3aekYfMGbnM4ouT9Gwy8K2YBsT+3agDWPuRUw==
X-Received: by 2002:a17:906:ae4e:: with SMTP id lf14mr11022817ejb.310.1607689169454;
        Fri, 11 Dec 2020 04:19:29 -0800 (PST)
From: Cezar Craciunoiu <cezar.craciunoiu@gmail.com>
To: marius.baciu@stud.acs.upb.ro
Cc: minios-devel@lists.xen.org
Subject: Re: [1/3] libdruntime: Add skeleton for the porting of the D Runtime Library
Date: Fri, 11 Dec 2020 14:19:23 +0200
Message-Id: <20201211121923.1842-1-cezar.craciunoiu@gmail.com>
X-Mailer: git-send-email 2.20.1
In-Reply-To: 20200717071737.18555-1-2309bmcristi@gmail.com
References: 20200717071737.18555-1-2309bmcristi@gmail.com
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit

Hello Cristian,

Unfortunately each patch needs to contain a "Signed-off-by" line before
they can be accepted. Please resubmit the patches and add the following:
 1. Signed-off line
 2. A more in-depth commit message
 3. A more specific prefix

I will get back to your patches afterwards. We can talk in private
until then.

Cezar



From minios-devel-bounces@lists.xenproject.org Fri Dec 11 12:39:43 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Fri, 11 Dec 2020 12:39:43 +0000
Received: from list by lists.xenproject.org with outflank-mailman.50527.89214 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1knhi2-00058U-8G; Fri, 11 Dec 2020 12:39:42 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 50527.89214; Fri, 11 Dec 2020 12:39: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 1knhi2-00058N-5A; Fri, 11 Dec 2020 12:39:42 +0000
Received: by outflank-mailman (input) for mailman id 50527;
 Fri, 11 Dec 2020 12:39: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=jsd7=FP=gmail.com=cezar.craciunoiu@srs-us1.protection.inumbo.net>)
 id 1knhi1-00058I-0S
 for minios-devel@lists.xen.org; Fri, 11 Dec 2020 12:39:41 +0000
Received: from mail-ed1-x52f.google.com (unknown [2a00:1450:4864:20::52f])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 343cee3c-d195-4055-b71b-5fb70ed8348c;
 Fri, 11 Dec 2020 12:39:40 +0000 (UTC)
Received: by mail-ed1-x52f.google.com with SMTP id q16so9158451edv.10
 for <minios-devel@lists.xen.org>; Fri, 11 Dec 2020 04:39:40 -0800 (PST)
Received: from localhost.localdomain ([2a02:2f05:6908:e000::1003])
 by smtp.gmail.com with ESMTPSA id t12sm7457860edy.49.2020.12.11.04.39.38
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Fri, 11 Dec 2020 04:39:38 -0800 (PST)
X-BeenThere: minios-devel@lists.xenproject.org
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
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: 343cee3c-d195-4055-b71b-5fb70ed8348c
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=wfeEUMjwKW+4bQmkw0eIBY7NMfN9tzkkdZEUlJfH9ZU=;
        b=WCoYw3N0PNQczgMO7LLYLQNaigYQdY0a/sqAXv+eNRx/cLUYmG8behHjUn+GYpUt6/
         eKsqTs5Ve33YfuoMUpWsZUwVn1zEVbVQPdsvVO9NLPHwlS14sdtVl6ZwTvIBo85SE5fA
         f6J2BIfW2LWWSF8OJH98tMT7/6MwyY84wCG0lIBPqsPuaFMO9fQBEEIg5J56zgmJLU75
         hMUCrePa5OARMg1nwl/sllcv+MidRNCHdktaDTBEQBhZMcCkNei7BdGyxQcbDf9s+Yw2
         pXVarfy2APZQY/SA94TTQiEcGdAcwiCwU8ppKqORSnlMv/w/bHrrtNpgVINVHCHtX5U5
         WgSQ==
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=wfeEUMjwKW+4bQmkw0eIBY7NMfN9tzkkdZEUlJfH9ZU=;
        b=W5SLyBRrJFgfnCToinrnhKZI+TRDlI0lCYuqCUxzNo8PZpXIk6X0xP4FC4ragYXyau
         qwJhjieztflxT6FLtpz3m5it5oOVrvO4g9QET5cjat3qpJaRBag3EeXQp4vHHvDsf8na
         bZomIM6tQWkBx/Mn26k73nOzS4W8DqopirohRz6ifmkSzwQB7e9AW7pQQZFrgBgt0S7v
         BBsm90JbWI2Gd0zncwolG/yq7tXGVps/FZKZxQ5PhLkKuyz+OBj3GC7njzKbdEjlrBd+
         VAr+t9klgO3F4N4pTLCP9Fbk28I7l9Gyh5cvNDmz1Tz+eZzaKqMpqNZ2nZj/B80LYD/F
         v0JA==
X-Gm-Message-State: AOAM533Ui/p0gZnpMyo/sLQmGHzKzVL+0i9wMiiYRx61/dFyhwXfrqcS
	KetJ3/+NPSfMBJnUllb3pyvrUPeodjeFRg==
X-Google-Smtp-Source: ABdhPJwVPe9s1yW5LCeuj9kNtcO/ZN0HTm3hs+ssRJ/I3d4T0A0Vfs8noY/YQ2L0W7Jrb5D3+qI1FQ==
X-Received: by 2002:a05:6402:212:: with SMTP id t18mr11690068edv.37.1607690379563;
        Fri, 11 Dec 2020 04:39:39 -0800 (PST)
From: Cezar Craciunoiu <cezar.craciunoiu@gmail.com>
To: marius.baciu@stud.acs.upb.ro
Cc: minios-devel@lists.xen.org
Subject: Re: [2/3] libdruntime: Add Makefile.uk
Date: Fri, 11 Dec 2020 14:39:34 +0200
Message-Id: <20201211123934.2375-1-cezar.craciunoiu@gmail.com>
X-Mailer: git-send-email 2.20.1
In-Reply-To: 20200717071737.18555-2-2309bmcristi@gmail.com
References: 20200717071737.18555-2-2309bmcristi@gmail.com
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit

Hello Cristian,

Unfortunately each patch needs to contain a "Signed-off-by" line before
they can be accepted. Please resubmit the patches and add the following:
 1. Signed-off line
 2. A more in-depth commit message
 3. A more specific prefix

I will get back to your patches afterwards. We can talk in private
until then.

Cezar



From minios-devel-bounces@lists.xenproject.org Fri Dec 11 12:40:34 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Fri, 11 Dec 2020 12:40:34 +0000
Received: from list by lists.xenproject.org with outflank-mailman.50529.89219 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1knhis-0005qR-Bp; Fri, 11 Dec 2020 12:40:34 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 50529.89219; Fri, 11 Dec 2020 12:40: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 1knhis-0005qK-8t; Fri, 11 Dec 2020 12:40:34 +0000
Received: by outflank-mailman (input) for mailman id 50529;
 Fri, 11 Dec 2020 12:40: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=jsd7=FP=gmail.com=cezar.craciunoiu@srs-us1.protection.inumbo.net>)
 id 1knhiq-0005qD-UR
 for minios-devel@lists.xen.org; Fri, 11 Dec 2020 12:40:32 +0000
Received: from mail-ed1-x534.google.com (unknown [2a00:1450:4864:20::534])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 9a05c0bb-bc0d-4327-874d-a5ab6b3efff9;
 Fri, 11 Dec 2020 12:40:32 +0000 (UTC)
Received: by mail-ed1-x534.google.com with SMTP id u19so9198368edx.2
 for <minios-devel@lists.xen.org>; Fri, 11 Dec 2020 04:40:32 -0800 (PST)
Received: from localhost.localdomain ([2a02:2f05:6908:e000::1003])
 by smtp.gmail.com with ESMTPSA id n20sm6680430ejo.83.2020.12.11.04.40.30
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Fri, 11 Dec 2020 04:40:30 -0800 (PST)
X-BeenThere: minios-devel@lists.xenproject.org
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
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: 9a05c0bb-bc0d-4327-874d-a5ab6b3efff9
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=wfeEUMjwKW+4bQmkw0eIBY7NMfN9tzkkdZEUlJfH9ZU=;
        b=C8y2i/9K+m81mYO2k46Z/a1oWSIRIrBN3iqwLP2fu39wuQU5by5Ti1Z5PLsslp+f0J
         sbzHsgeIXPR4EXWJUC2mk4qDCVLRTUHgkzllU/sFqKIrGanFi2YGyiM4vzlzRB9Eapqo
         igeXVs+YFYgX0Grh+4M2fgovXOeeMzXDDmDaPOWhhGGRaInl8x8i1kEDmjZ0r2zcPOmo
         voqs7XNnGlie0UfVlsUvn5rJfBUu35SFypgZnHNC6ifHbuOeXnQCl7/T7R5FNQW8Hh3n
         v3YjyExFDs3bamUBvuSjw1ykLXbgan63P+qNSZtO0san/6N82iwQ6DcmN1+Zg6ZFiiiw
         yH4A==
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=wfeEUMjwKW+4bQmkw0eIBY7NMfN9tzkkdZEUlJfH9ZU=;
        b=tWviV4CsQQg6SNtgSQOd8CNhWtH6f5PCwZ5WEyXqxeos5MRZPVqGUbCCDAriJ7uBZD
         57HrjpjB9FgkzCl0m9WneiDi//rF4L0h75tlmcPEMxChSQcynTJII6y8DQ5ueFvZ4ksA
         8c275uGt8xVbmEATr3uIi1CjK7960XnW4U4mM10hllbKEOUb+PaRb7eTarm6Ws97SJQ1
         5ZPl+kfER4Y9VrCDf9VcMCMzI+L1oGqg3WY+yH5mMbvKJm2eIRA8JipLdQa8bTP9mCXA
         J5B+JOIB844P8YFnG+qClYaMuX4FrD23JtFBfwhY2X5jC5kyOe1LJsWDazzFxxy+iM9W
         9M1Q==
X-Gm-Message-State: AOAM533hnn7uD358H/z7APuJtNSO0S+r+lXX5+PCnG7eIVFt+T5VYGTt
	cbcmBRGA8/xySPtXBcvKUu8=
X-Google-Smtp-Source: ABdhPJzgKwUS8Koeyx58MZ1xaS0rNleGbL2hNfznqQNxat7m7J1smZCVpLYlmmEay2bRpn53xsD2mg==
X-Received: by 2002:aa7:da01:: with SMTP id r1mr11782816eds.45.1607690431575;
        Fri, 11 Dec 2020 04:40:31 -0800 (PST)
From: Cezar Craciunoiu <cezar.craciunoiu@gmail.com>
To: marius.baciu@stud.acs.upb.ro
Cc: minios-devel@lists.xen.org
Subject: Re: [3/3] libdruntime: Resolve missing symbols
Date: Fri, 11 Dec 2020 14:40:26 +0200
Message-Id: <20201211124026.2434-1-cezar.craciunoiu@gmail.com>
X-Mailer: git-send-email 2.20.1
In-Reply-To: 0200717071737.18555-3-2309bmcristi@gmail.com
References: 0200717071737.18555-3-2309bmcristi@gmail.com
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit

Hello Cristian,

Unfortunately each patch needs to contain a "Signed-off-by" line before
they can be accepted. Please resubmit the patches and add the following:
 1. Signed-off line
 2. A more in-depth commit message
 3. A more specific prefix

I will get back to your patches afterwards. We can talk in private
until then.

Cezar



From minios-devel-bounces@lists.xenproject.org Fri Dec 11 12:43:11 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Fri, 11 Dec 2020 12:43:11 +0000
Received: from list by lists.xenproject.org with outflank-mailman.50536.89225 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1knhlO-000646-M4; Fri, 11 Dec 2020 12:43:10 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 50536.89225; Fri, 11 Dec 2020 12:43: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 1knhlO-00063z-Ii; Fri, 11 Dec 2020 12:43:10 +0000
Received: by outflank-mailman (input) for mailman id 50536;
 Fri, 11 Dec 2020 12:43: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=jsd7=FP=gmail.com=cezar.craciunoiu@srs-us1.protection.inumbo.net>)
 id 1knhlN-00062T-EY
 for minios-devel@lists.xen.org; Fri, 11 Dec 2020 12:43:09 +0000
Received: from mail-ej1-x62a.google.com (unknown [2a00:1450:4864:20::62a])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id d489c892-d700-4918-9ac4-51292cac458f;
 Fri, 11 Dec 2020 12:43:08 +0000 (UTC)
Received: by mail-ej1-x62a.google.com with SMTP id ga15so12148631ejb.4
 for <minios-devel@lists.xen.org>; Fri, 11 Dec 2020 04:43:08 -0800 (PST)
Received: from localhost.localdomain ([2a02:2f05:6908:e000::1003])
 by smtp.gmail.com with ESMTPSA id e19sm7824796edr.61.2020.12.11.04.43.07
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Fri, 11 Dec 2020 04:43:07 -0800 (PST)
X-BeenThere: minios-devel@lists.xenproject.org
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
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: d489c892-d700-4918-9ac4-51292cac458f
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=wfeEUMjwKW+4bQmkw0eIBY7NMfN9tzkkdZEUlJfH9ZU=;
        b=iMsxHjnXlztV96cOdp7/abH32WzVKL4F8RfBM5MI/C5GK7YZ0PJ1wlZOulinSn8O8K
         3hj/D/4h2aumdRiVULkEwwiabEz8wmUd8QRa3a+cNlQ6uuMqUMvRPRm4wMyEeyeHn8cz
         ONf8yYTyZOFFLxfJcorUlK0y7URdugYpj8dDrhgmKCXdzi6RQCHajd/Ei4WCDTsD1o+Q
         MQRL0K8ExLkk5TxRzAvkY5JIx6EArG5xvPA16Vv0fao/BBKgbBBDiB1bCcNSAlpt+sdF
         p3yV/dAR+s3SjVhMRk03oaFr2TKm8x0YwTKE87OjmzH5HzhfEQ5Z2/H/MzwnbIVlMth8
         aZBA==
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=wfeEUMjwKW+4bQmkw0eIBY7NMfN9tzkkdZEUlJfH9ZU=;
        b=axDcER8laFOrVzu1alqTXTzG9Giw4iTW+Mq/yevRfoQDdONog3I4o/+XUsQiu5iB8I
         h3PVLSEiz1VTqW4s/I3nBVdrbntT5e6OqaCRFcgA9XR1SxbZqpFrjpgo2CjUaBzq/yjv
         prCCNErSUWGlCdAwomjInwlXHksIXO/2bT99p7EyanxWI8nT32m7nTRQkgNcSNyLlRlK
         qkjOaYT93efU8TZy1/EMCVZkfmFyrvEuPMCuPJxZHVNuOdu3qaogMLDT141sxZ1wVp5D
         MY8Oey0KARBrCw5i2fEO82e5QnOpqhqeUbG4lF3FxhfnamRH1hDIlGeu3zk6hduzpDGY
         icpA==
X-Gm-Message-State: AOAM530dD3eRm98f34vxAipelSy6R6IyXOLiuroJqs1myKFZIB7ijBJH
	xPCVIfX1Eg8iaBXJECwAwQA=
X-Google-Smtp-Source: ABdhPJxLJpIV9ScGsV3A+HNXumKLgOuKRoDBv1cAzN3GSUrLH/39iIKNRd1dxhRQFF7GqR16G0QiIA==
X-Received: by 2002:a17:906:ccc5:: with SMTP id ot5mr10660355ejb.248.1607690588012;
        Fri, 11 Dec 2020 04:43:08 -0800 (PST)
From: Cezar Craciunoiu <cezar.craciunoiu@gmail.com>
To: marius.baciu@stud.acs.upb.ro
Cc: minios-devel@lists.xen.org
Subject: Re: [2/3] libdruntime: Expose standard file descriptors symbols to the runtime 
Date: Fri, 11 Dec 2020 14:43:01 +0200
Message-Id: <20201211124301.2557-1-cezar.craciunoiu@gmail.com>
X-Mailer: git-send-email 2.20.1
In-Reply-To: 20200721133730.27234-2-2309bmcristi@gmail.com
References: 20200721133730.27234-2-2309bmcristi@gmail.com
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit

Hello Cristian,

Unfortunately each patch needs to contain a "Signed-off-by" line before
they can be accepted. Please resubmit the patches and add the following:
 1. Signed-off line
 2. A more in-depth commit message
 3. A more specific prefix

I will get back to your patches afterwards. We can talk in private
until then.

Cezar



From minios-devel-bounces@lists.xenproject.org Fri Dec 11 12:44:05 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Fri, 11 Dec 2020 12:44:05 +0000
Received: from list by lists.xenproject.org with outflank-mailman.50539.89230 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1knhmH-00066O-Pa; Fri, 11 Dec 2020 12:44:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 50539.89230; Fri, 11 Dec 2020 12:44: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 1knhmH-00066H-MT; Fri, 11 Dec 2020 12:44:05 +0000
Received: by outflank-mailman (input) for mailman id 50539;
 Fri, 11 Dec 2020 12:44: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=jsd7=FP=gmail.com=cezar.craciunoiu@srs-us1.protection.inumbo.net>)
 id 1knhmG-00066C-Mj
 for minios-devel@lists.xen.org; Fri, 11 Dec 2020 12:44:04 +0000
Received: from mail-ej1-x629.google.com (unknown [2a00:1450:4864:20::629])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 7b8b9c0d-241b-4246-a793-31af82eb7ead;
 Fri, 11 Dec 2020 12:44:04 +0000 (UTC)
Received: by mail-ej1-x629.google.com with SMTP id x16so12148228ejj.7
 for <minios-devel@lists.xen.org>; Fri, 11 Dec 2020 04:44:04 -0800 (PST)
Received: from localhost.localdomain ([2a02:2f05:6908:e000::1003])
 by smtp.gmail.com with ESMTPSA id k21sm6703667ejv.80.2020.12.11.04.44.02
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Fri, 11 Dec 2020 04:44:02 -0800 (PST)
X-BeenThere: minios-devel@lists.xenproject.org
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
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: 7b8b9c0d-241b-4246-a793-31af82eb7ead
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=wfeEUMjwKW+4bQmkw0eIBY7NMfN9tzkkdZEUlJfH9ZU=;
        b=nkzjck0dLOo87iNjUMQb3rEWTnCDwGG0aoki0Wu6wkHhf5mc4KrUAFmwh36uUZYF/P
         ctWqAckP1TamkGTxseM8SrXNrODqrmhk7hhmPdqMUU8lnEEY3q/h0cuESTqkCR+DApZc
         4TWc1r5qSj4Pd4bQKjxDFAXqxbWcHejNX4glZwdvGi7MiSUl8f1Ilwh8nTEPaVkC+mqH
         D3ugIo066953CLq4lHjK6Uo4DWfZ41KU0uDowUE+o53XqmJgHtCwaKrNFY421fOv+s+I
         A99zC0e+rE+TTH1+O+ocTGul5FWAB10mlBA9GgvmSrLSeFZUbohi8FR1oajPXhGIIT3F
         hp7Q==
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=wfeEUMjwKW+4bQmkw0eIBY7NMfN9tzkkdZEUlJfH9ZU=;
        b=OaNJs5blsA9Nu4ue13UT9aDvuHG7Cl/G2UpCjcoaV37C3uvC5NXsOGTYTadFpDaiqi
         BYaCDO4cqkycR3Wst6D3wBg8WPszJuS3NMlAM0rM2I5hjr5xO2j7v+Xqi+T0Wu7JS/Ii
         darn6bjqy38pPr4CdJSMVGiqNp6eovB0ZiT7NtP+Z7OWtNC54W+tD8aBwrzpicTpC5Xh
         qbBdeW7LxJwMRF1NOkjnHBumb1yM+H4zelhkx7TdSqoyWk5FkuumTceiQ0iakLiorcV9
         hIl2/pS6syC1wS1ZxmUYmDzVcb1GGPRi4RMJ5yuwCWWc/sNRnLcIYzNCxZ9Fn04iofqa
         KH7Q==
X-Gm-Message-State: AOAM533GMIE3RoN/g+aCTG83fX8yosEhIVUtC3nDMJS9tu0CzCnNn7gJ
	xyJV3kohD41PjtKYmXdhVPONcgiCKQ6yzg==
X-Google-Smtp-Source: ABdhPJzHoVrvzgpUQcp6qUU+miGnK1ipUy+ZXj1tk2aEiBljMZ/1Ee80VJx5PEpUy7x+90hIbu2qTw==
X-Received: by 2002:a17:906:7b8d:: with SMTP id s13mr10613276ejo.479.1607690643294;
        Fri, 11 Dec 2020 04:44:03 -0800 (PST)
From: Cezar Craciunoiu <cezar.craciunoiu@gmail.com>
To: marius.baciu@stud.acs.upb.ro
Cc: minios-devel@lists.xen.org
Subject: Re: [3/3] libdruntime: Add patches dealing with bugs and various incompatibilities with the platform
Date: Fri, 11 Dec 2020 14:43:59 +0200
Message-Id: <20201211124359.2605-1-cezar.craciunoiu@gmail.com>
X-Mailer: git-send-email 2.20.1
In-Reply-To: 20200721133730.27234-3-2309bmcristi@gmail.com
References: 20200721133730.27234-3-2309bmcristi@gmail.com
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit

Hello Cristian,

Unfortunately each patch needs to contain a "Signed-off-by" line before
they can be accepted. Please resubmit the patches and add the following:
 1. Signed-off line
 2. A more in-depth commit message
 3. A more specific prefix

I will get back to your patches afterwards. We can talk in private
until then.

Cezar



From minios-devel-bounces@lists.xenproject.org Fri Dec 11 12:46:53 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Fri, 11 Dec 2020 12:46:53 +0000
Received: from list by lists.xenproject.org with outflank-mailman.50543.89233 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1knhoz-00069M-1u; Fri, 11 Dec 2020 12:46:53 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 50543.89233; Fri, 11 Dec 2020 12:46: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 1knhoy-00069F-Ur; Fri, 11 Dec 2020 12:46:52 +0000
Received: by outflank-mailman (input) for mailman id 50543;
 Fri, 11 Dec 2020 12:46:51 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=jsd7=FP=gmail.com=cezar.craciunoiu@srs-us1.protection.inumbo.net>)
 id 1knhox-00069A-66
 for minios-devel@lists.xen.org; Fri, 11 Dec 2020 12:46:51 +0000
Received: from mail-ed1-x52a.google.com (unknown [2a00:1450:4864:20::52a])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id addc8e01-eeb1-4662-9bb3-b0a7c4b3df7f;
 Fri, 11 Dec 2020 12:46:50 +0000 (UTC)
Received: by mail-ed1-x52a.google.com with SMTP id q16so9180096edv.10
 for <minios-devel@lists.xen.org>; Fri, 11 Dec 2020 04:46:50 -0800 (PST)
Received: from localhost.localdomain ([2a02:2f05:6908:e000::1003])
 by smtp.gmail.com with ESMTPSA id ef11sm6825251ejb.15.2020.12.11.04.46.48
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Fri, 11 Dec 2020 04:46:49 -0800 (PST)
X-BeenThere: minios-devel@lists.xenproject.org
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
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: addc8e01-eeb1-4662-9bb3-b0a7c4b3df7f
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=wfeEUMjwKW+4bQmkw0eIBY7NMfN9tzkkdZEUlJfH9ZU=;
        b=lvcrpvm4uWA7hb3PEuRuiqFum1UVLDwDqmhuQBikCR41pYKGCIrXllfR3uCXD+7pIK
         xLFmbMqyR85lxsezSCiCAqIUD4UAflHOPWUEn4lLt/o+ola0DYcjMk2gUiEtfEOKxgP0
         /IRFwUM5XARYg9+B2HVklWWek+ShhtPbc/rKFbTCXObvOD8TDx+ZPTqMnWcXzPthJaEt
         4e4lB+HNf95bjTHZy7IlbrA2IkbeyK/HoMK0E14RcOUjC/2xRBuzRPPZUreT0DVr699o
         6Cfo/Bd1AL6W+iSiuojlh/Z7BhRWFAzFHuTpROJ5OhzNFO+E+bgSMaLU9J1kH4KySvIb
         mgpg==
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=wfeEUMjwKW+4bQmkw0eIBY7NMfN9tzkkdZEUlJfH9ZU=;
        b=AFwvvjxu84iZbYMjOOmfHFvR8pYWnl3H0YVFVo/LBuD/E+hbmwOr+NzEaNWCAKNeJb
         f4Sd6IN03UxMVWx5iQ+WHCfZoktg0xhdXg1l8yi/ujiB9ff7OT8rchwA2VfTU0kd4jMW
         BvrtbVW8Gev4YSvNZvqvDs/8lj4Ox49m4gEpqNsAxWHtLlkmiLPEl5li2Tlf0GYNaktS
         GAJunq0bP/fMZsYSIxPRKlsnBncgNbzoxvU/4dlirC2M52VhKy+e9dgwhJwElmTWinA9
         u3yNSd16jn0mJ5CtUlak/Na9LBEMjQqiW+ihxDHJmdx4q19E/jJNbX5ZXOiyX3AJ1Mn6
         I9RA==
X-Gm-Message-State: AOAM530kSbRn5h/fTjURN85I3h3Sxi+/F1v6pKxMX0I8BrsyVehY35ht
	ghaxAgG0dQKLZy/vXqxKx/o=
X-Google-Smtp-Source: ABdhPJwyQA2DipG8Mn+uPDYyFSV1GELTJuEObhYV6ff3/w6t3VypYGIYDtFH5BVWbQ0WFBBSg33Xwg==
X-Received: by 2002:a50:c053:: with SMTP id u19mr11492332edd.109.1607690809688;
        Fri, 11 Dec 2020 04:46:49 -0800 (PST)
From: Cezar Craciunoiu <cezar.craciunoiu@gmail.com>
To: marius.baciu@stud.acs.upb.ro
Cc: minios-devel@lists.xen.org
Subject: Re: [1/3] libdruntime: Add support for unittests execution and solve minor paths-related typo
Date: Fri, 11 Dec 2020 14:46:45 +0200
Message-Id: <20201211124645.2676-1-cezar.craciunoiu@gmail.com>
X-Mailer: git-send-email 2.20.1
In-Reply-To: 20200721133730.27234-1-2309bmcristi@gmail.com
References: 20200721133730.27234-1-2309bmcristi@gmail.com
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit

Hello Cristian,

Unfortunately each patch needs to contain a "Signed-off-by" line before
they can be accepted. Please resubmit the patches and add the following:
 1. Signed-off line
 2. A more in-depth commit message
 3. A more specific prefix

I will get back to your patches afterwards. We can talk in private
until then.

Cezar



From minios-devel-bounces@lists.xenproject.org Fri Dec 11 14:32:34 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Fri, 11 Dec 2020 14:32:34 +0000
Received: from list by lists.xenproject.org with outflank-mailman.50517.89443 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1knjTE-0001rJ-I8; Fri, 11 Dec 2020 14:32:32 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 50517.89443; Fri, 11 Dec 2020 14:32: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 1knjTE-0001r4-BE; Fri, 11 Dec 2020 14:32:32 +0000
Received: by outflank-mailman (input) for mailman id 50517;
 Fri, 11 Dec 2020 12:29: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=IzsC=FP=gmail.com=lizzababu@srs-us1.protection.inumbo.net>)
 id 1knhXj-00040t-IZ
 for minios-devel@lists.xen.org; Fri, 11 Dec 2020 12:29:03 +0000
Received: from mail-ej1-x644.google.com (unknown [2a00:1450:4864:20::644])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id d86517cc-4f0f-4593-954c-e639e1f6a5c5;
 Fri, 11 Dec 2020 12:29:02 +0000 (UTC)
Received: by mail-ej1-x644.google.com with SMTP id g20so12123292ejb.1
 for <minios-devel@lists.xen.org>; Fri, 11 Dec 2020 04:29:02 -0800 (PST)
Received: from localhost.localdomain (5-12-166-103.residential.rdsnet.ro.
 [5.12.166.103])
 by smtp.gmail.com with ESMTPSA id b19sm7387729edx.47.2020.12.11.04.29.00
 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128);
 Fri, 11 Dec 2020 04:29:01 -0800 (PST)
X-BeenThere: minios-devel@lists.xenproject.org
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
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: d86517cc-4f0f-4593-954c-e639e1f6a5c5
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=b/Z4FfPt4PUt4b0rM2tNHYzbngkBFS7GMT9vb8lOKmI=;
        b=I3S7/J8n5XnlpUu6XMD64FLH4IIVevpP5aJEb87jYXHrbxzvr02d0kApr0uXS8BloT
         I4IubGDSYHU40/6YiIlkkeqcxKRcSnbaAgp9hafjE5kQsiLfcylSqjnJJ8Cqoh2B/ELD
         Zu4vN0uqtkZJgNI70L2i0mOpeklhnDZ5QZlZL467f5S4td1/2SCvsOe20DdzZHJZfMG9
         wx6c/JigRDzj630sO4mkwgdnuBr45qIajxrOXmESuxwnxgwjTd45zjt/EB0KG7CHExUL
         OHZa+c4oEyObBHdOpoZ/mk832i/6ldnp05MZV7JiN1KpPQSYNRoe+RbQt3vGBqmewtWh
         G/LQ==
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=b/Z4FfPt4PUt4b0rM2tNHYzbngkBFS7GMT9vb8lOKmI=;
        b=fyblfrKaY8QWxKRk7FIVSt3Pp/3TXVrPbwK2tCUMkln6LcfMSw+osjoisLMaBfG2AD
         FitHN7maMuFHNzLMZZZkKc7uCmLluTRwASSmh/lzQKzRh0w0pBPsYb29zM0g7LbnbCoh
         kwGszmWwzRn6hst42gD3jpNOIOx0E37fEjt6590SmxSI8O112/HFZ24pDpCNATnXK5/a
         y74ovqUGcKFaAlK7dNCjp7b3vYpLMW58/Hg3gm73e0VW2JTQzOns7cc57ljB770+OB5T
         UPvNwAjMkhkgBD46nFcLAyh5SMm+Jmyf+iDsL7Dyt0PKfuaq4YWPrbRBQFW5fMIJWWqg
         icHQ==
X-Gm-Message-State: AOAM530s7jon2YrH5WAGCa7TkWqsbKVUaSoViTJsstOuTFAiwwpjs+D1
	8eqLPKsme9n4kW7RBYj/nnc=
X-Google-Smtp-Source: ABdhPJwTXRjNoSmKoHbzYHjElRpLNI2tXQO1MSySc7YQsStqnVcMkRItSQjoRotRQs1l/13wgGUE2A==
X-Received: by 2002:a17:906:7f11:: with SMTP id d17mr10734511ejr.534.1607689741775;
        Fri, 11 Dec 2020 04:29:01 -0800 (PST)
From: Liza Babu <lizzababu@gmail.com>
X-Google-Original-From: Liza Babu <lizza.babu@gmail.com>
To: raducanu.costi@gmail.com
Cc: minios-devel@lists.xen.org,
	Liza Babu <lizza.babu@gmail.com>
Subject: Re: [UNIKRAFT PATCH 4/5] lib/uktime: Register `clock_gettime` to syscall_shim
Date: Fri, 11 Dec 2020 14:28:41 +0200
Message-Id: <20201211122841.30055-1-lizza.babu@gmail.com>
X-Mailer: git-send-email 2.28.0
In-Reply-To: 20200717124718.16583-4-raducanu.costi@gmail.com 
References: 20200717124718.16583-4-raducanu.costi@gmail.com
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit

Hi, Costi.

Looks good to me.

Liza Babu

Reviewed-by: Liza Babu <lizza.babu@gmail.com>


From minios-devel-bounces@lists.xenproject.org Fri Dec 11 14:32:34 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Fri, 11 Dec 2020 14:32:34 +0000
Received: from list by lists.xenproject.org with outflank-mailman.50520.89449 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1knjTE-0001rk-Ly; Fri, 11 Dec 2020 14:32:32 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 50520.89449; Fri, 11 Dec 2020 14:32: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 1knjTE-0001rI-DK; Fri, 11 Dec 2020 14:32:32 +0000
Received: by outflank-mailman (input) for mailman id 50520;
 Fri, 11 Dec 2020 12:32:51 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=IzsC=FP=gmail.com=lizzababu@srs-us1.protection.inumbo.net>)
 id 1knhbP-0004sF-Gk
 for minios-devel@lists.xen.org; Fri, 11 Dec 2020 12:32:51 +0000
Received: from mail-ej1-x631.google.com (unknown [2a00:1450:4864:20::631])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id efd4e959-1c07-4875-915e-c81e87febe3b;
 Fri, 11 Dec 2020 12:32:50 +0000 (UTC)
Received: by mail-ej1-x631.google.com with SMTP id lt17so12116019ejb.3
 for <minios-devel@lists.xen.org>; Fri, 11 Dec 2020 04:32:50 -0800 (PST)
Received: from localhost.localdomain (5-12-166-103.residential.rdsnet.ro.
 [5.12.166.103])
 by smtp.gmail.com with ESMTPSA id c14sm7508597edy.56.2020.12.11.04.32.49
 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128);
 Fri, 11 Dec 2020 04:32:49 -0800 (PST)
X-BeenThere: minios-devel@lists.xenproject.org
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
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: efd4e959-1c07-4875-915e-c81e87febe3b
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=b/Z4FfPt4PUt4b0rM2tNHYzbngkBFS7GMT9vb8lOKmI=;
        b=MSd0IIGGr4ka3gvA94YdJQBbVluPzRNADjMD4UsySy2FVlNr24gi9swwcCffiTtbEL
         AkLe8fwFlNsFguJqBwaNGPX1if1EbpPJGRnAtgc43xILySABOk8dFA3CxNcr62lMkihH
         OCZ2n6qOBN4nOE4+Bzx5ckYiL0Fx5Boh+NxB1wwgIiPbeYt11O7zACHK1dCnpt+rBdrE
         ikSJQ6/9W++CaAttVjPRi9mu7kLOauiVABUH7jVk/KlKNUkSo1cT+WcYN9bolqkVIP6V
         oD5DjofQBmKEMilRouVS6AvzJLHFo5vOVCXFPQtj6Ur0cfROmPi16XIuzjnYXy/tP3mv
         OQfg==
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=b/Z4FfPt4PUt4b0rM2tNHYzbngkBFS7GMT9vb8lOKmI=;
        b=TxcX2zIE6Frg/GFmTMRJPQDM3ajWUZenpLV0WAynC7/zwWITk6YnaNtISzXs3PoDrR
         PWv2tjU2M+v7M8YR9tbAzUznU/MT3awO6Hurddq7uHLKLJQtqP23QTF8X60baUYL5PA+
         cU9cW1EDVVGSQETAtkkiOTxh9jbiLi0Ka4YQJA/y9BCT1yk3/pmbWk5FsdTTxAODBDpk
         KAh5VNxn6hYu3zO4K5GE3yVhj+WUkQeka3lKUuYeJ304artGxQkgvipGp2iQY/kX81fc
         10uQ5fQgcY6xLV3YSELWVnZ3DRlgfnAzRtGe7Oj/yKbPhixU0belQIDnKRMvA35puC4T
         htzQ==
X-Gm-Message-State: AOAM531Pw+/DqJ0YoGWXJzgHCWO0/ILzDIPVg3sRQLN+pEQttvsdAfBg
	r1+5fFw8FpmqaTK0f9MH8Gf2WsloGk2aXA==
X-Google-Smtp-Source: ABdhPJxYSFJo6Mc6skHkt/KoKq4QJYZ/RT9IsmKftPjxHk7UyykXJ7+fpACWHbJJneB2udU98JZazg==
X-Received: by 2002:a17:906:eb49:: with SMTP id mc9mr10327235ejb.487.1607689969980;
        Fri, 11 Dec 2020 04:32:49 -0800 (PST)
From: Liza Babu <lizzababu@gmail.com>
X-Google-Original-From: Liza Babu <lizza.babu@gmail.com>
To: raducanu.costi@gmail.com
Cc: minios-devel@lists.xen.org,
	Liza Babu <lizza.babu@gmail.com>
Subject: Re: [4/5] lib/uktime: Register `clock_gettime` to syscall_shim
Date: Fri, 11 Dec 2020 14:32:41 +0200
Message-Id: <20201211123241.30120-1-lizza.babu@gmail.com>
X-Mailer: git-send-email 2.28.0
In-Reply-To: 20200717124718.16583-4-raducanu.costi@gmail.com 
References: 20200717124718.16583-4-raducanu.costi@gmail.com
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit

Hi, Costi.

Looks good to me.

Liza Babu

Reviewed-by: Liza Babu <lizza.babu@gmail.com>


From minios-devel-bounces@lists.xenproject.org Fri Dec 11 14:32:34 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Fri, 11 Dec 2020 14:32:34 +0000
Received: from list by lists.xenproject.org with outflank-mailman.50449.89439 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1knjTE-0001qz-Dr; Fri, 11 Dec 2020 14:32:32 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 50449.89439; Fri, 11 Dec 2020 14:32: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 1knjTE-0001qs-9j; Fri, 11 Dec 2020 14:32:32 +0000
Received: by outflank-mailman (input) for mailman id 50449;
 Fri, 11 Dec 2020 11:28: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=IzsC=FP=gmail.com=lizzababu@srs-us1.protection.inumbo.net>)
 id 1kngah-0005xj-92
 for minios-devel@lists.xen.org; Fri, 11 Dec 2020 11:28:03 +0000
Received: from mail-wm1-x343.google.com (unknown [2a00:1450:4864:20::343])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 10a44402-e9e8-4f5b-89c3-f80aa245b69a;
 Fri, 11 Dec 2020 11:28:02 +0000 (UTC)
Received: by mail-wm1-x343.google.com with SMTP id a3so8242146wmb.5
 for <minios-devel@lists.xen.org>; Fri, 11 Dec 2020 03:28:02 -0800 (PST)
Received: from vmx.cs.pub.ro (vmx.cs.pub.ro. [141.85.227.139])
 by smtp.gmail.com with ESMTPSA id s13sm13935416wrt.80.2020.12.11.03.28.00
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Fri, 11 Dec 2020 03:28:00 -0800 (PST)
X-BeenThere: minios-devel@lists.xenproject.org
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
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: 10a44402-e9e8-4f5b-89c3-f80aa245b69a
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=jLp6YId0g5X/E/Q5IT5mqysHEzY7WFydIoc/ruWAQLI=;
        b=j6OdZumWlixzoAxLpTW94v8y+XDeCpVkJyEJcMRQ1aYvIsl5pZll8s4eTo3QDZnzp7
         +FgoYk6BGwSMhxnW2k0z8bfmGSjnNqrqT+Quv2eHi8gE3DUz3QiPrxl55wkqz28CKpaI
         lBOooXqkDlKWKynA2jv7Xyr47/HN68EJK0FzAC0FW1RuKEtfx++oDmAIVEHi3KwCK/k6
         C6WbM5zI3FUG67bbE5zcOq9mS2U4V1FmHBMJ7s8wzTK2h/LPJw83x1hFEIrYYokX/bZk
         NWWdzqMpMndDUbLj52jlZq4bYqKoNP7PUVt8ObA2daRajiaabQ3C7ItxDB/iAjZlVB+w
         SGRQ==
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=jLp6YId0g5X/E/Q5IT5mqysHEzY7WFydIoc/ruWAQLI=;
        b=kq/l2kOKbvD15UCXWTTj15fxcM5MsSEu/Hp6aGxRfM3kpgbOeLr/zhRaLl8H2ffwX5
         czrfof4hLULpI5j09LfJv2MUiJmaxQ3a4VITHPi8N5+VUefNGsTNZSBbvmfBZ7ohyWl7
         BZH/SQKZMe+Y9siF78eklUKExx/1wwrswXSV4ETDTvZdK6+0xkABF+BPlAoTzHSOfkLg
         2NWNO3p+wnlDKi86LUc4nAzHfic/9cZwX/mpUGkMTS5g8NkIpew/qaDb1Hl+SIBLFgPW
         qUGOULEmlQz4jfrXnupZzbSWC0YkKKYubHiRrfK3LXm6T717FBpW3VBNM/R6ZKQm143W
         0BAw==
X-Gm-Message-State: AOAM533cmiZF/qUuYxUz8MBWkYdzROZTOEHyI2Ki9cmbM1MtPPfRq0za
	qH381o8BsVLqEvw4TY4vVNw=
X-Google-Smtp-Source: ABdhPJyWY50feQ+lNyihIkvFeE1qQRgUVvMnQhfUEvYgTl7bpjbrMBv5gi3OSs3tSlbe+EN1jS8Qbg==
X-Received: by 2002:a7b:c208:: with SMTP id x8mr13087639wmi.179.1607686081273;
        Fri, 11 Dec 2020 03:28:01 -0800 (PST)
From: Liza Babu <lizzababu@gmail.com>
X-Google-Original-From: Liza Babu <lizza.babu@gmail.com>
To: raducanu.costi@gmail.com
Cc: minios-devel@lists.xen.org,
	Liza Babu <lizza.babu@gmail.com>
Subject: Re: [UNIKRAFT PATCH 4/5] lib/uktime: Register `clock_gettime` to syscall_shim
Date: Fri, 11 Dec 2020 13:27:53 +0200
Message-Id: <20201211112753.16691-1-lizza.babu@gmail.com>
X-Mailer: git-send-email 2.20.1
In-Reply-To: 20200717124718.16583-4-raducanu.costi@gmail.com 
References: 20200717124718.16583-4-raducanu.costi@gmail.com
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit

Looks good to me.

Reviewed-by: Liza Babu <lizza.babu@gmail.com>


From minios-devel-bounces@lists.xenproject.org Fri Dec 11 16:35:38 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Fri, 11 Dec 2020 16:35:38 +0000
Received: from list by lists.xenproject.org with outflank-mailman.50759.89509 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1knlOK-0006F9-G7; Fri, 11 Dec 2020 16:35:36 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 50759.89509; Fri, 11 Dec 2020 16:35: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 1knlOK-0006F2-C7; Fri, 11 Dec 2020 16:35:36 +0000
Received: by outflank-mailman (input) for mailman id 50759;
 Fri, 11 Dec 2020 16:35: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=NCNs=FP=owl.eu.com=hle@srs-us1.protection.inumbo.net>)
 id 1knlOJ-0006Ex-Dl
 for minios-devel@lists.xenproject.org; Fri, 11 Dec 2020 16:35:35 +0000
Received: from relay12.mail.gandi.net (unknown [217.70.178.232])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 62228de1-eebc-4612-b8d5-f79fbd6e35c6;
 Fri, 11 Dec 2020 16:35:32 +0000 (UTC)
Received: from localhost (79-65-56-149.host.pobb.as13285.net [79.65.56.149])
 (Authenticated sender: hle@owl.eu.com)
 by relay12.mail.gandi.net (Postfix) with ESMTPSA id BCB0C200002;
 Fri, 11 Dec 2020 16:35:29 +0000 (UTC)
X-BeenThere: minios-devel@lists.xenproject.org
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
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: 62228de1-eebc-4612-b8d5-f79fbd6e35c6
From: Hugo Lefeuvre <hle@owl.eu.com>
To: minios-devel@lists.xenproject.org
Cc: Hugo Lefeuvre <hle@owl.eu.com>
Subject: [UNIKRAFT PATCH v2 0/4] Initial support for Intel PKU
Date: Fri, 11 Dec 2020 16:35:11 +0000
Message-Id: <cover.1607704032.git.hugo.lefeuvre@manchester.ac.uk>
X-Mailer: git-send-email 2.29.2
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Hi,

There is an ongoing work to support memory protection keys (MPK, also referred
to as protection keys userspace -- PKU) in Unikraft.

Full support will be achieved by:
(1) detecting the availability of PKU and enabling it via CR4
(2) enabling XSAVE for the PKRU register
(3) supporting PKU-related protection changes in the page table
(4) supporting PKU-swap during thread context switches
(5) defining an new interface/microlib to facilitate the use of MPKs

This series implements (1) and (2) in KVM and Xen as a first step towards a
full support of memory protection keys in the main tree.

This patch is independent from (3)-(5) and can already be merged as-is.

It has been tested thoroughly: (3)-(5) are already implemented and tested, but
cannot be merged immediately since they are based on top of the yet to come
page table support series.

More details regarding the implementation:

Since we do not want to pay the cost of MPK-related code when MPK is not
enabled, we introduce a new HAVE_X86PKU property; MPK code is compile-guarded
so that it does not get compiled in without HAVE_X86PKU. HAVE_X86PKU will be
set by PKU kernel libraries later on (this is step (5)).

At boot time, if HAVE_X86PKU is enabled, the kernel now checks whether PKU is
advertised by cpuid. If yes, it enables it by setting bit 22 (PKE) in CR4.  If
not, it aborts the boot process (the underlying idea is that images compiled
with HAVE_X86PKU are *specialized* to be executed on PKU-enabled hardware).

Hugo Lefeuvre (4):
  plat/kvm: toggle PKE bit if HAVE_X86PKU is enabled
  plat/xen: toggle PKE bit if HAVE_X86PKU is enabled
  plat/kvm: enable XSAVE for PKRU register
  plat/xen: enable XSAVE for PKRU register

 lib/Config.uk                      |  4 ++++
 plat/common/include/x86/cpu.h      | 15 +++++++++++++++
 plat/common/include/x86/cpu_defs.h |  4 ++++
 plat/kvm/x86/entry64.S             | 29 ++++++++++++++++++++++++++---
 plat/kvm/x86/setup.c               |  4 ++++
 plat/xen/x86/entry64.S             | 26 +++++++++++++++++++++++---
 plat/xen/x86/setup.c               |  4 ++++
 7 files changed, 80 insertions(+), 6 deletions(-)

-- 
2.20.1



From minios-devel-bounces@lists.xenproject.org Fri Dec 11 16:35:42 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Fri, 11 Dec 2020 16:35:42 +0000
Received: from list by lists.xenproject.org with outflank-mailman.50760.89511 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1knlOQ-0006Fr-Gr; Fri, 11 Dec 2020 16:35:42 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 50760.89511; Fri, 11 Dec 2020 16:35: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 1knlOQ-0006Fk-Dw; Fri, 11 Dec 2020 16:35:42 +0000
Received: by outflank-mailman (input) for mailman id 50760;
 Fri, 11 Dec 2020 16:35: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=NCNs=FP=owl.eu.com=hle@srs-us1.protection.inumbo.net>)
 id 1knlOO-0006Fa-Me
 for minios-devel@lists.xenproject.org; Fri, 11 Dec 2020 16:35:40 +0000
Received: from relay3-d.mail.gandi.net (unknown [217.70.183.195])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 2dde192c-4ece-4451-a432-a763fcda1b92;
 Fri, 11 Dec 2020 16:35:38 +0000 (UTC)
Received: from localhost (79-65-56-149.host.pobb.as13285.net [79.65.56.149])
 (Authenticated sender: hle@owl.eu.com)
 by relay3-d.mail.gandi.net (Postfix) with ESMTPSA id C355660006;
 Fri, 11 Dec 2020 16:35:36 +0000 (UTC)
X-BeenThere: minios-devel@lists.xenproject.org
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
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: 2dde192c-4ece-4451-a432-a763fcda1b92
X-Originating-IP: 79.65.56.149
From: Hugo Lefeuvre <hle@owl.eu.com>
To: minios-devel@lists.xenproject.org
Cc: Hugo Lefeuvre <hle@owl.eu.com>,
	Hugo Lefeuvre <hugo.lefeuvre@manchester.ac.uk>
Subject: [UNIKRAFT PATCH v2 1/4] plat/kvm: toggle PKE bit if HAVE_X86PKU is enabled
Date: Fri, 11 Dec 2020 16:35:12 +0000
Message-Id: <fa3db72f12d204ca3cb5fe5a83e45fad0c8ceecb.1607704032.git.hugo.lefeuvre@manchester.ac.uk>
X-Mailer: git-send-email 2.29.2
In-Reply-To: <cover.1607704032.git.hugo.lefeuvre@manchester.ac.uk>
References: <cover.1607704032.git.hugo.lefeuvre@manchester.ac.uk>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit

Provided that PKU is advertised by cpuid (EAX=7, ECX=0, ECX bit 4),
Memory Protection Keys can be enabled by setting bit 22 (PKE) in CR4
(see Intel 64 and IA-32 Architectures Software Developer's Manual Vol.
3A, Section 2.5 'Control Registers').

Since we do not want to pay the cost of MPK-related code when MPK is
not enabled, we introduce a new HAVE_X86PKU property; MPK code is
compile-guarded so that it does not get compiled in without
HAVE_X86PKU. HAVE_X86PKU will be set by PKU kernel libraries later on.

At boot time, if HAVE_X86PKU is enabled, the kernel now checks whether
PKU is advertised by cpuid. If not, it aborts the boot process. The
underlying idea is that images compiled with HAVE_X86PKU are
*specialized* to be executed on PKU-enabled hardware. Hence, provided
that HAVE_X86PKU is set, there is a guarantee that PKU is supported
*and* enabled, effectively removing the need for checks later at
runtime. This might benefit performance when the domain switching rate
is high.

Signed-off-by: Hugo Lefeuvre <hugo.lefeuvre@manchester.ac.uk>
---
 lib/Config.uk                      |  4 ++++
 plat/common/include/x86/cpu.h      | 15 +++++++++++++++
 plat/common/include/x86/cpu_defs.h |  3 +++
 plat/kvm/x86/entry64.S             | 12 ++++++++++++
 plat/kvm/x86/setup.c               |  4 ++++
 5 files changed, 38 insertions(+)

diff --git a/lib/Config.uk b/lib/Config.uk
index e83ed30b..dac2d2fa 100644
--- a/lib/Config.uk
+++ b/lib/Config.uk
@@ -28,3 +28,7 @@ config HAVE_NW_STACK
 config HAVE_SYSCALL
        bool
        default n
+
+config HAVE_X86PKU
+	bool
+	default n
diff --git a/plat/common/include/x86/cpu.h b/plat/common/include/x86/cpu.h
index 5f1a35e4..d4c02e08 100644
--- a/plat/common/include/x86/cpu.h
+++ b/plat/common/include/x86/cpu.h
@@ -341,4 +341,19 @@ static inline void _init_syscall(void)
 }
 #endif /* CONFIG_HAVE_SYSCALL */
 
+#if CONFIG_HAVE_X86PKU
+static inline void _check_ospke(void)
+{
+	__u32 eax, ebx, ecx, edx;
+	cpuid(0x7, 0, &eax, &ebx, &ecx, &edx);
+	if (!(ecx & X86_CPUID7_ECX_OSPKE)) {
+		/* if PKU is not enabled, abort the boot process. Images
+		 * compiled with HAVE_X86PKU are *specialized* to be executed on
+		 * PKU-enabled hardware. This allows us to avoid checks later at
+		 * runtime. */
+		UK_CRASH("CPU does not support PKU!\n");
+	}
+}
+#endif /* CONFIG_HAVE_X86PKU */
+
 #endif /* __PLAT_COMMON_X86_CPU_H__ */
diff --git a/plat/common/include/x86/cpu_defs.h b/plat/common/include/x86/cpu_defs.h
index dcbe2c65..74cff459 100644
--- a/plat/common/include/x86/cpu_defs.h
+++ b/plat/common/include/x86/cpu_defs.h
@@ -71,6 +71,7 @@
 #define X86_CR4_OSXMMEXCPT      (1 << 10)   /* OS support for FP exceptions */
 #define X86_CR4_FSGSBASE        (1 << 16)   /* enable FSGSBASE*/
 #define X86_CR4_OSXSAVE         (1 << 18)   /* enable XSAVE, extended states */
+#define X86_CR4_PKE             (1 << 22)   /* enable protection keys */
 
 /*
  * Intel CPU features in EFER
@@ -86,6 +87,8 @@
 #define X86_CPUID1_EDX_SSE      (1 << 25)
 /* CPUID feature bits in EBX and ECX when EAX=7, ECX=0 */
 #define X86_CPUID7_EBX_FSGSBASE (1 << 0)
+#define X86_CPUID7_ECX_PKU	(1 << 3)
+#define X86_CPUID7_ECX_OSPKE	(1 << 4)
 /* CPUID feature bits when EAX=0xd, ECX=1 */
 #define X86_CPUIDD1_EAX_XSAVEOPT (1<<0)
 /* CPUID 80000001H:EDX feature list */
diff --git a/plat/kvm/x86/entry64.S b/plat/kvm/x86/entry64.S
index 169f4c82..ef5e0e77 100644
--- a/plat/kvm/x86/entry64.S
+++ b/plat/kvm/x86/entry64.S
@@ -31,6 +31,9 @@
 #include <kvm-x86/traps.h>
 #include <kvm-x86/multiboot_defs.h>
 
+/* necessary for CONFIG_ macros to be accessible */
+#include <uk/config.h>
+
 #define ENTRY(x) .globl x; .type x,%function; x:
 #define END(x)   .size x, . - x
 
@@ -227,6 +230,15 @@ noxsave:
 	orl $(X86_CR4_FSGSBASE), %edi
 	movq %rdi, %cr4
 nofsgsbase:
+#if CONFIG_HAVE_X86PKU
+	/* check for Memory Protection Keys (PKU) */
+	testl $(X86_CPUID7_ECX_PKU), %ecx
+	jz nopku
+	/* if PKU is supported, enable it via CR4 */
+	orl $(X86_CR4_PKE), %edi
+	movq %rdi, %cr4
+nopku:
+#endif /* CONFIG_HAVE_X86PKU */
 	/* done setting up CPU capabilities */
 
 	/* read multiboot info pointer */
diff --git a/plat/kvm/x86/setup.c b/plat/kvm/x86/setup.c
index 284ec793..e8c44a93 100644
--- a/plat/kvm/x86/setup.c
+++ b/plat/kvm/x86/setup.c
@@ -329,6 +329,10 @@ void _libkvmplat_entry(void *arg)
 	_init_syscall();
 #endif /* CONFIG_HAVE_SYSCALL */
 
+#if CONFIG_HAVE_X86PKU
+	_check_ospke();
+#endif /* CONFIG_HAVE_X86PKU */
+
 	/*
 	 * Switch away from the bootstrap stack as early as possible.
 	 */
-- 
2.20.1



From minios-devel-bounces@lists.xenproject.org Fri Dec 11 16:35:44 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Fri, 11 Dec 2020 16:35:44 +0000
Received: from list by lists.xenproject.org with outflank-mailman.50761.89516 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1knlOS-0006Ge-Iz; Fri, 11 Dec 2020 16:35:44 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 50761.89516; Fri, 11 Dec 2020 16:35: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 1knlOS-0006GY-FX; Fri, 11 Dec 2020 16:35:44 +0000
Received: by outflank-mailman (input) for mailman id 50761;
 Fri, 11 Dec 2020 16:35: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=NCNs=FP=owl.eu.com=hle@srs-us1.protection.inumbo.net>)
 id 1knlOR-0006GL-6L
 for minios-devel@lists.xenproject.org; Fri, 11 Dec 2020 16:35:43 +0000
Received: from relay12.mail.gandi.net (unknown [217.70.178.232])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 979c1ab9-ae9c-4a12-ba09-73d134dbb522;
 Fri, 11 Dec 2020 16:35:40 +0000 (UTC)
Received: from localhost (79-65-56-149.host.pobb.as13285.net [79.65.56.149])
 (Authenticated sender: hle@owl.eu.com)
 by relay12.mail.gandi.net (Postfix) with ESMTPSA id 4795F200009;
 Fri, 11 Dec 2020 16:35:39 +0000 (UTC)
X-BeenThere: minios-devel@lists.xenproject.org
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
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: 979c1ab9-ae9c-4a12-ba09-73d134dbb522
From: Hugo Lefeuvre <hle@owl.eu.com>
To: minios-devel@lists.xenproject.org
Cc: Hugo Lefeuvre <hle@owl.eu.com>,
	Hugo Lefeuvre <hugo.lefeuvre@manchester.ac.uk>
Subject: [UNIKRAFT PATCH v2 2/4] plat/xen: toggle PKE bit if HAVE_X86PKU is enabled
Date: Fri, 11 Dec 2020 16:35:13 +0000
Message-Id: <cf6ee79f54d9c91bc931909b9c1077e160787cb1.1607704032.git.hugo.lefeuvre@manchester.ac.uk>
X-Mailer: git-send-email 2.29.2
In-Reply-To: <cover.1607704032.git.hugo.lefeuvre@manchester.ac.uk>
References: <cover.1607704032.git.hugo.lefeuvre@manchester.ac.uk>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit

This patch is identical to the KVM patch.

Signed-off-by: Hugo Lefeuvre <hugo.lefeuvre@manchester.ac.uk>
---
 plat/xen/x86/entry64.S | 9 +++++++++
 plat/xen/x86/setup.c   | 4 ++++
 2 files changed, 13 insertions(+)

diff --git a/plat/xen/x86/entry64.S b/plat/xen/x86/entry64.S
index ae118e1d..c1bee635 100644
--- a/plat/xen/x86/entry64.S
+++ b/plat/xen/x86/entry64.S
@@ -115,6 +115,15 @@ noxsave:
 	orl $(X86_CR4_FSGSBASE), %edi
 	movq %rdi, %cr4
 nofsgsbase:
+#if CONFIG_HAVE_X86PKU
+	/* check for Memory Protection Keys (PKU) */
+	testl $(X86_CPUID7_ECX_PKU), %ecx
+	jz nopku
+	/* if PKU is supported, enable it via CR4 */
+	orl $(X86_CR4_PKE), %edi
+	movq %rdi, %cr4
+nopku:
+#endif /* CONFIG_HAVE_X86PKU */
 	/* Done setting up CPU capabilities, hand over to C entry point. */
 	movq %r8, %rdi /* pass pointer to start_info page to C entry */
 	call _libxenplat_x86entry
diff --git a/plat/xen/x86/setup.c b/plat/xen/x86/setup.c
index ebe99328..e5d51b32 100644
--- a/plat/xen/x86/setup.c
+++ b/plat/xen/x86/setup.c
@@ -211,5 +211,9 @@ void _libxenplat_x86entry(void *start_info)
 
 	init_console();
 
+#if CONFIG_HAVE_X86PKU
+	_check_ospke();
+#endif /* CONFIG_HAVE_X86PKU */
+
 	ukplat_entry_argp(CONFIG_UK_NAME, cmdline, MAX_GUEST_CMDLINE);
 }
-- 
2.20.1



From minios-devel-bounces@lists.xenproject.org Fri Dec 11 16:35:49 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Fri, 11 Dec 2020 16:35:49 +0000
Received: from list by lists.xenproject.org with outflank-mailman.50762.89520 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1knlOX-0006Hs-Km; Fri, 11 Dec 2020 16:35:49 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 50762.89520; Fri, 11 Dec 2020 16:35:49 +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 1knlOX-0006Hn-HH; Fri, 11 Dec 2020 16:35:49 +0000
Received: by outflank-mailman (input) for mailman id 50762;
 Fri, 11 Dec 2020 16:35:48 +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=NCNs=FP=owl.eu.com=hle@srs-us1.protection.inumbo.net>)
 id 1knlOW-0006GL-0M
 for minios-devel@lists.xenproject.org; Fri, 11 Dec 2020 16:35:48 +0000
Received: from relay8-d.mail.gandi.net (unknown [217.70.183.201])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id a8812e6d-bd3b-4a46-ba41-fa0b7177ba5e;
 Fri, 11 Dec 2020 16:35:43 +0000 (UTC)
Received: from localhost (79-65-56-149.host.pobb.as13285.net [79.65.56.149])
 (Authenticated sender: hle@owl.eu.com)
 by relay8-d.mail.gandi.net (Postfix) with ESMTPSA id C0B871BF20E;
 Fri, 11 Dec 2020 16:35:41 +0000 (UTC)
X-BeenThere: minios-devel@lists.xenproject.org
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
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: a8812e6d-bd3b-4a46-ba41-fa0b7177ba5e
X-Originating-IP: 79.65.56.149
From: Hugo Lefeuvre <hle@owl.eu.com>
To: minios-devel@lists.xenproject.org
Cc: Hugo Lefeuvre <hle@owl.eu.com>,
	Hugo Lefeuvre <hugo.lefeuvre@manchester.ac.uk>
Subject: [UNIKRAFT PATCH v2 3/4] plat/kvm: enable XSAVE for PKRU register
Date: Fri, 11 Dec 2020 16:35:14 +0000
Message-Id: <bd2eb52a05b671b89cdf815e54e5e2152ce7ee96.1607704032.git.hugo.lefeuvre@manchester.ac.uk>
X-Mailer: git-send-email 2.29.2
In-Reply-To: <cover.1607704032.git.hugo.lefeuvre@manchester.ac.uk>
References: <cover.1607704032.git.hugo.lefeuvre@manchester.ac.uk>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

According to Intel 64 and IA-32 Architectures Software Developer’s
Manual Vol. 1, Section 13.5.7 'PKRU State':

	software can use the XSAVE feature set to manage PKRU state
	only if XCR0[9] = 1

This patch sets XCR0[9] if PKU is available (and enabled via
CONFIG_HAVE_X86PKU).

Note: we do not support PKU without XSAVE. If CONFIG_HAVE_X86PKU is
selected but XSAVE is not available, we simply don't initialize PKU
and let the boot process gracefully abort later.

Signed-off-by: Hugo Lefeuvre <hugo.lefeuvre@manchester.ac.uk>
---
 plat/common/include/x86/cpu_defs.h |  1 +
 plat/kvm/x86/entry64.S             | 19 +++++++++++++++----
 2 files changed, 16 insertions(+), 4 deletions(-)

diff --git a/plat/common/include/x86/cpu_defs.h b/plat/common/include/x86/cpu_defs.h
index 74cff459..1cf5367d 100644
--- a/plat/common/include/x86/cpu_defs.h
+++ b/plat/common/include/x86/cpu_defs.h
@@ -100,6 +100,7 @@
 #define X86_XCR0_X87            (1 << 0)
 #define X86_XCR0_SSE            (1 << 1)
 #define X86_XCR0_AVX            (1 << 2)
+#define X86_XCR0_PKRU		(1 << 9)
 
 /*
  * Model-specific register addresses
diff --git a/plat/kvm/x86/entry64.S b/plat/kvm/x86/entry64.S
index ef5e0e77..287f9029 100644
--- a/plat/kvm/x86/entry64.S
+++ b/plat/kvm/x86/entry64.S
@@ -196,18 +196,19 @@ ENTRY(_libkvmplat_start64)
 	movq %rdi, %cr4
 	ldmxcsr (mxcsr_ptr)
 #endif /* __SSE__ */
+#if (__AVX__ || CONFIG_HAVE_X86PKU)
 	/* Check capabilities subject to availability as indicated by cpuid.
 	 * First, start off with "standard features" */
 	movl $0x1, %eax
 	cpuid
-#if __AVX__
 	/* ecx and edx now contain capability information, so we can now
 	 * enable capabilities based on the indicated features */
-	/* OSXSAVE needs to be enabled before AVX */
+	/* note: OSXSAVE needs to be enabled before AVX and PKU */
 	testl $(X86_CPUID1_ECX_XSAVE), %ecx
 	jz noxsave
 	orl $(X86_CR4_OSXSAVE), %edi
 	movq %rdi, %cr4
+#if __AVX__
 	/* now enable AVX. This needs to be last checking cpuid features from
 	 * the eax=1 cpuid call, because it clobbers ecx */
 	testl $(X86_CPUID1_ECX_AVX), %ecx
@@ -217,8 +218,10 @@ ENTRY(_libkvmplat_start64)
 	orl $(X86_XCR0_SSE | X86_XCR0_AVX), %eax
 	xsetbv
 noavx:
-noxsave:
 #endif /* __AVX__ */
+/* Do not enable AVX without XSAVE, otherwise we'll get #UD */
+noxsave:
+#endif /* __AVX__ || CONFIG_HAVE_X86PKU */
 	/* Now, check for extended features. */
 	movl $0x7, %eax
 	movl $0x0, %ecx
@@ -234,9 +237,17 @@ nofsgsbase:
 	/* check for Memory Protection Keys (PKU) */
 	testl $(X86_CPUID7_ECX_PKU), %ecx
 	jz nopku
-	/* if PKU is supported, enable it via CR4 */
+	/* only enable PKU if we support XSAVE */
+	testl $(X86_CR4_OSXSAVE), %edi
+	jz nopku
+	/* PKU is supported, enable it via CR4 */
 	orl $(X86_CR4_PKE), %edi
 	movq %rdi, %cr4
+	/* also enable XSAVE for the PKRU */
+	xorl %ecx, %ecx
+	xgetbv
+	orl $(X86_XCR0_PKRU), %eax
+	xsetbv
 nopku:
 #endif /* CONFIG_HAVE_X86PKU */
 	/* done setting up CPU capabilities */
-- 
2.20.1



From minios-devel-bounces@lists.xenproject.org Fri Dec 11 16:35:54 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Fri, 11 Dec 2020 16:35:54 +0000
Received: from list by lists.xenproject.org with outflank-mailman.50763.89524 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1knlOc-0006J3-Mb; Fri, 11 Dec 2020 16:35:54 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 50763.89524; Fri, 11 Dec 2020 16:35: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 1knlOc-0006Iv-JO; Fri, 11 Dec 2020 16:35:54 +0000
Received: by outflank-mailman (input) for mailman id 50763;
 Fri, 11 Dec 2020 16:35:53 +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=NCNs=FP=owl.eu.com=hle@srs-us1.protection.inumbo.net>)
 id 1knlOb-0006GL-0Q
 for minios-devel@lists.xenproject.org; Fri, 11 Dec 2020 16:35:53 +0000
Received: from relay12.mail.gandi.net (unknown [217.70.178.232])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 76a051af-a379-4fc0-84b0-330ed95dcfb7;
 Fri, 11 Dec 2020 16:35:45 +0000 (UTC)
Received: from localhost (79-65-56-149.host.pobb.as13285.net [79.65.56.149])
 (Authenticated sender: hle@owl.eu.com)
 by relay12.mail.gandi.net (Postfix) with ESMTPSA id AE6F6200006;
 Fri, 11 Dec 2020 16:35:43 +0000 (UTC)
X-BeenThere: minios-devel@lists.xenproject.org
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
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: 76a051af-a379-4fc0-84b0-330ed95dcfb7
From: Hugo Lefeuvre <hle@owl.eu.com>
To: minios-devel@lists.xenproject.org
Cc: Hugo Lefeuvre <hle@owl.eu.com>,
	Hugo Lefeuvre <hugo.lefeuvre@manchester.ac.uk>
Subject: [UNIKRAFT PATCH v2 4/4] plat/xen: enable XSAVE for PKRU register
Date: Fri, 11 Dec 2020 16:35:15 +0000
Message-Id: <a102807d5c65567d6fe6c29e4228fecd9783efac.1607704032.git.hugo.lefeuvre@manchester.ac.uk>
X-Mailer: git-send-email 2.29.2
In-Reply-To: <cover.1607704032.git.hugo.lefeuvre@manchester.ac.uk>
References: <cover.1607704032.git.hugo.lefeuvre@manchester.ac.uk>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit

This patch is identical to the KVM patch.

Signed-off-by: Hugo Lefeuvre <hugo.lefeuvre@manchester.ac.uk>
---
 plat/xen/x86/entry64.S | 19 +++++++++++++++----
 1 file changed, 15 insertions(+), 4 deletions(-)

diff --git a/plat/xen/x86/entry64.S b/plat/xen/x86/entry64.S
index c1bee635..dee832ec 100644
--- a/plat/xen/x86/entry64.S
+++ b/plat/xen/x86/entry64.S
@@ -81,18 +81,19 @@ _libxenplat_start:
 	movq %rdi, %cr4
 	ldmxcsr (mxcsr_ptr)
 #endif /* __SSE__ */
+#if (__AVX__ || CONFIG_HAVE_X86PKU)
 	/* Check capabilities subject to availability as indicated by cpuid.
 	 * First, start off with "standard features" */
 	movl $0x1, %eax
 	cpuid
-#if __AVX__
 	/* ecx and edx now contain capability information, so we can now
 	 * enable capabilities based on the indicated features */
-	/* OSXSAVE needs to be enabled before AVX */
+	/* note: OSXSAVE needs to be enabled before AVX and PKU */
 	testl $(X86_CPUID1_ECX_XSAVE), %ecx
 	jz noxsave
 	orl $(X86_CR4_OSXSAVE), %edi
 	movq %rdi, %cr4
+#if __AVX__
 	/* now enable AVX. This needs to be last checking cpuid features from
 	 * the eax=1 cpuid call, because it clobbers ecx */
 	testl $(X86_CPUID1_ECX_AVX), %ecx
@@ -102,8 +103,10 @@ _libxenplat_start:
 	orl $(X86_XCR0_SSE | X86_XCR0_AVX), %eax
 	xsetbv
 noavx:
-noxsave:
 #endif /* __AVX__ */
+/* Do not enable AVX without XSAVE, otherwise we'll get #UD */
+noxsave:
+#endif /* __AVX__ || CONFIG_HAVE_X86PKU */
 	/* Now, check for extended features. */
 	movl $0x7, %eax
 	movl $0x0, %ecx
@@ -119,9 +122,17 @@ nofsgsbase:
 	/* check for Memory Protection Keys (PKU) */
 	testl $(X86_CPUID7_ECX_PKU), %ecx
 	jz nopku
-	/* if PKU is supported, enable it via CR4 */
+	/* only enable PKU if we support XSAVE */
+	testl $(X86_CR4_OSXSAVE), %edi
+	jz nopku
+	/* PKU is supported, enable it via CR4 */
 	orl $(X86_CR4_PKE), %edi
 	movq %rdi, %cr4
+	/* also enable XSAVE for the PKRU */
+	xorl %ecx, %ecx
+	xgetbv
+	orl $(X86_XCR0_PKRU), %eax
+	xsetbv
 nopku:
 #endif /* CONFIG_HAVE_X86PKU */
 	/* Done setting up CPU capabilities, hand over to C entry point. */
-- 
2.20.1



From minios-devel-bounces@lists.xenproject.org Mon Dec 14 08:42:20 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Mon, 14 Dec 2020 08:42:20 +0000
Received: from list by lists.xenproject.org with outflank-mailman.51968.90919 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1kojQv-0005g5-Je; Mon, 14 Dec 2020 08:42:17 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 51968.90919; Mon, 14 Dec 2020 08:42: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 1kojQv-0005fy-GW; Mon, 14 Dec 2020 08:42:17 +0000
Received: by outflank-mailman (input) for mailman id 51968;
 Mon, 14 Dec 2020 08:42: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=rwpQ=FS=gmail.com=lizzababu@srs-us1.protection.inumbo.net>)
 id 1kojQu-0005ft-5P
 for minios-devel@lists.xen.org; Mon, 14 Dec 2020 08:42:16 +0000
Received: from mail-ej1-x629.google.com (unknown [2a00:1450:4864:20::629])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id d1eeb785-d24a-4595-9738-f6431e0c9a14;
 Mon, 14 Dec 2020 08:42:15 +0000 (UTC)
Received: by mail-ej1-x629.google.com with SMTP id ga15so21389749ejb.4
 for <minios-devel@lists.xen.org>; Mon, 14 Dec 2020 00:42:15 -0800 (PST)
Received: from localhost.localdomain (5-12-166-103.residential.rdsnet.ro.
 [5.12.166.103])
 by smtp.gmail.com with ESMTPSA id f17sm14858880edv.5.2020.12.14.00.42.13
 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128);
 Mon, 14 Dec 2020 00:42:13 -0800 (PST)
X-BeenThere: minios-devel@lists.xenproject.org
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
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: d1eeb785-d24a-4595-9738-f6431e0c9a14
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=b/Z4FfPt4PUt4b0rM2tNHYzbngkBFS7GMT9vb8lOKmI=;
        b=aHKPhqkSxvNNcwFcsUM5iXDlh47QI+yf0w8jTsX2UbgcccxmoRvhqCQi9ya3ZdC7f8
         /oj/S/aV+nxxmocEga8T/Jl2itDdI1/0FaZG5APf14wA6hbvg2RRAzKwjFgqhdxZfX2g
         dIV+SIb+9Kq7rmS2qmr1dh3eaCnRulYH2m3KpmiWZbkjUgCz4BRaIKAIBLqD1ZEKMq0t
         LCLRkhGL0+/50oMbkWWJCbbt4SEgucuqjnKR3NG39O7wJf09eT838/AxtQ0PRMf8Y36N
         Eq5RI5g9W27QtfwdiXVyOdO6bUl8iucb3ZqwDK6WECUSOKH8YmuUksBC6I+a+MMoCgZO
         MtEQ==
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=b/Z4FfPt4PUt4b0rM2tNHYzbngkBFS7GMT9vb8lOKmI=;
        b=BM5dW/xbygNVxNaY3jl3tqd9UC2ZmpsmKlECesqu8Xvbl7NCwzrLVg5aoM6lv6OnkS
         dUPvAZ/TObXLHOP1FKHsDaVUgrKWAOQmTBsApPUu8h1TostqQUIpWuJT2rQyYmrPm/yI
         sUGYJfAItMiVunUsNIdgyLLSs/xf7XUNB4wu+7b5M9b7eKzXIZNw4lXGcL53ypFLDSX7
         Ind3XdZFN16sQ45ftC67bJNHKec0aURRZMHgM9Vnj4RHchESx0pZyedbY3aIDzNkM2x1
         O9InoKXuqGsh4KtrVzwV5gm0Ldqu30T6rUUglELKuSFfOzC9rK94NOCpN3HV43EmJ293
         vtJw==
X-Gm-Message-State: AOAM533HLcWQl5EvhNW8gzcxmnE5qs2RlryuAXbDZvLmHcG0nQCb4S0x
	V8I96EQmIsxNHFYrPdKbm1Y=
X-Google-Smtp-Source: ABdhPJwjRu1I3paen23G4i350snUp7in17TaRgS1e8Dx7J52U4HFzWg1+ZkYYCxULPOfNLuEPDo/4g==
X-Received: by 2002:a17:906:400a:: with SMTP id v10mr21623875ejj.302.1607935334053;
        Mon, 14 Dec 2020 00:42:14 -0800 (PST)
From: Liza Babu <lizzababu@gmail.com>
X-Google-Original-From: Liza Babu <lizza.babu@gmail.com>
To: raducanu.costi@gmail.com
Cc: minios-devel@lists.xen.org,
	Liza Babu <lizza.babu@gmail.com>
Subject: Re: [5/5] lib/vfscore: Register `getcwd` to syscall_shim
Date: Mon, 14 Dec 2020 10:42:01 +0200
Message-Id: <20201214084202.35223-1-lizza.babu@gmail.com>
X-Mailer: git-send-email 2.28.0
In-Reply-To: 20200717124718.16583-5-raducanu.costi@gmail.com
References: 20200717124718.16583-5-raducanu.costi@gmail.com
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit

Hi, Costi.

Looks good to me.

Liza Babu

Reviewed-by: Liza Babu <lizza.babu@gmail.com>


From minios-devel-bounces@lists.xenproject.org Mon Dec 14 09:10:12 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Mon, 14 Dec 2020 09:10:12 +0000
Received: from list by lists.xenproject.org with outflank-mailman.51994.90959 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1kojrt-0001oy-G8; Mon, 14 Dec 2020 09:10:09 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 51994.90959; Mon, 14 Dec 2020 09:10: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 1kojrt-0001op-CN; Mon, 14 Dec 2020 09:10:09 +0000
Received: by outflank-mailman (input) for mailman id 51994;
 Mon, 14 Dec 2020 09:10: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=rwpQ=FS=gmail.com=lizzababu@srs-us1.protection.inumbo.net>)
 id 1kojrs-0001oZ-AW
 for minios-devel@lists.xen.org; Mon, 14 Dec 2020 09:10:08 +0000
Received: from mail-ed1-x52f.google.com (unknown [2a00:1450:4864:20::52f])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 28659af3-8c48-4dc8-8ffb-22207eadc247;
 Mon, 14 Dec 2020 09:10:07 +0000 (UTC)
Received: by mail-ed1-x52f.google.com with SMTP id b2so16389079edm.3
 for <minios-devel@lists.xen.org>; Mon, 14 Dec 2020 01:10:07 -0800 (PST)
Received: from localhost.localdomain (5-12-166-103.residential.rdsnet.ro.
 [5.12.166.103])
 by smtp.gmail.com with ESMTPSA id m7sm13252606ejr.119.2020.12.14.01.10.05
 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128);
 Mon, 14 Dec 2020 01:10:06 -0800 (PST)
X-BeenThere: minios-devel@lists.xenproject.org
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
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: 28659af3-8c48-4dc8-8ffb-22207eadc247
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=b/Z4FfPt4PUt4b0rM2tNHYzbngkBFS7GMT9vb8lOKmI=;
        b=bvSgkj+XBXGZ0JC7gAVURkpOBg5xss4U40wHFM8ChKgfevPdFdU3LqX+IJnNrqBgH4
         Q/cOFd0T9B12blllzYP0AhgM4ec52Fx8wA5o/PYtTdb2EOGyVpcAKHMGUpNaiRDjqbhG
         /JKdYUo8dgjQKA02SOUAdbHcTVfhzW+WnDrc6cUVuqWVcnlpmDl/PUyPAUVY87DpfYeT
         r26YP9ffD3YiAn+MxjWTBQoj5ZpkO/YCV0LvW/7DKTAly3syFpBFv799kMJMawDXZrF8
         AoTUxYPWqSudZQcw2tUEkSddtBhDArMsVa0O5xsxtOhD0Uj+AzfkQFjyQFGBoMx4q04K
         p+kA==
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=b/Z4FfPt4PUt4b0rM2tNHYzbngkBFS7GMT9vb8lOKmI=;
        b=SfS4RQf0hfaMup17LAlh/CpdJEWuMQTooUqwpP/WYLnwnSmfbmKXys9MXijQaf8zO8
         vbiBDUuyut0q5ZDbLlWTtAoz3/YGh7/lMBXnFH/Ah5oawaB1EYbMlvTE95PB0mUPgfRs
         t6NBRU3dLI8Lyv15FQV7wuYS1cWxNlyGpn5/Ey66prSN5ibXLmwic5zpvysJiz5hZfK0
         cbPShHxnU/yotPpBQ6apnW+SORxPty3mMlwyR42Vfc2xvHmoFHjLvTMo1T7Kq59xplAY
         MfHoI9suyH+tqinugag8dYPhrIyiIcyraAeuydE1nbjsUrm9RToPU65j5p+hYp2LSBrH
         jW8A==
X-Gm-Message-State: AOAM530S9mC3y65oQ09Hq4ejSzBmx0Kcip6588yIFr4DaKosDhKN3yj2
	e8stEKVPVyCFidwbA1/hCMY=
X-Google-Smtp-Source: ABdhPJw6IJxiABbBwUovjuz1k1p5qSFwkTI8EZ0fEbFjcUaqoLMC6FCMXItvmKNZeoboBHpIA5adgA==
X-Received: by 2002:a50:e848:: with SMTP id k8mr9451445edn.77.1607937006641;
        Mon, 14 Dec 2020 01:10:06 -0800 (PST)
From: Liza Babu <lizzababu@gmail.com>
X-Google-Original-From: Liza Babu <lizza.babu@gmail.com>
To: raducanu.costi@gmail.com
Cc: minios-devel@lists.xen.org,
	Liza Babu <lizza.babu@gmail.com>
Subject: Re: [2/5] lib/ukmmap: Register `mmap` and `munmap` to syscall_shim
Date: Mon, 14 Dec 2020 11:09:53 +0200
Message-Id: <20201214090953.35986-1-lizza.babu@gmail.com>
X-Mailer: git-send-email 2.28.0
In-Reply-To: 20200717124718.16583-2-raducanu.costi@gmail.com
References: 20200717124718.16583-2-raducanu.costi@gmail.com
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit

Hi, Costi.

Looks good to me.

Liza Babu

Reviewed-by: Liza Babu <lizza.babu@gmail.com>


From minios-devel-bounces@lists.xenproject.org Mon Dec 14 09:10:40 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Mon, 14 Dec 2020 09:10:40 +0000
Received: from list by lists.xenproject.org with outflank-mailman.51997.90963 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1kojsO-0003AB-Ih; Mon, 14 Dec 2020 09:10:40 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 51997.90963; Mon, 14 Dec 2020 09:10: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 1kojsO-0003A4-FZ; Mon, 14 Dec 2020 09:10:40 +0000
Received: by outflank-mailman (input) for mailman id 51997;
 Mon, 14 Dec 2020 09:10: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=rwpQ=FS=gmail.com=lizzababu@srs-us1.protection.inumbo.net>)
 id 1kojsN-00039y-Tr
 for minios-devel@lists.xen.org; Mon, 14 Dec 2020 09:10:39 +0000
Received: from mail-ed1-x52c.google.com (unknown [2a00:1450:4864:20::52c])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 07f63c46-c197-46ed-98f1-44af3d5d64be;
 Mon, 14 Dec 2020 09:10:39 +0000 (UTC)
Received: by mail-ed1-x52c.google.com with SMTP id dk8so16389610edb.1
 for <minios-devel@lists.xen.org>; Mon, 14 Dec 2020 01:10:39 -0800 (PST)
Received: from localhost.localdomain (5-12-166-103.residential.rdsnet.ro.
 [5.12.166.103])
 by smtp.gmail.com with ESMTPSA id k23sm13079096ejs.100.2020.12.14.01.10.37
 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128);
 Mon, 14 Dec 2020 01:10:38 -0800 (PST)
X-BeenThere: minios-devel@lists.xenproject.org
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
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: 07f63c46-c197-46ed-98f1-44af3d5d64be
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=b/Z4FfPt4PUt4b0rM2tNHYzbngkBFS7GMT9vb8lOKmI=;
        b=LSMYMjMOwxQXDQIFm/yOGZ6fChV1MDcxi/wkUGJOck4yGHstX4QprQ1JR4NW2GzVbV
         +OYYQA6oVYGzlU8GOe+nNEW89eGfqKkHq5q3OYZQglp6NjHehz7CzTudTk5rf8lVoZfK
         3JaYiwg1CPMscfjTtYA2FIDhv6FZ4TfFnOu6gRP2WxD7xKnpDZd+W5SnBEXNkggLH5oS
         5zq6nBtomp3DWJ8BVr1XRJwrPaiNsUozT9ogNqbF3vdI/E/s2AIwfuAXD67Z26WwSEFS
         3yK5wgC97nlLX+psGCetYX+jKVpcJy7EIX/5NEWNDxLvswuf2FlS4DrktFCcP0PML8V/
         OWeA==
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=b/Z4FfPt4PUt4b0rM2tNHYzbngkBFS7GMT9vb8lOKmI=;
        b=MMvJNolyBd07nx7qvwh6AbOe5T+pQHP5ug6zTg+w9B9n0PJnSy8MyHCmF5b7LD39Ce
         XqC31b6EBs7X6/y0h1qkh58YkgrSjzu24nfaiAo2TP6SE7tq2NFqsFJphrZOjwxDUu/w
         9H2GOIgzey5a2UjlUTxb2m71tDzwMuyRP2BS9Ue2pxqcLflZCxUIaGUoSQo/pSLt20hv
         b6+//mC87xlMqOX0hJUeBmXa8oJiUfYe7uUYkyVW5jT5xUMKMXQCgNhP11IRFsbhFHa0
         C4LTIvJiEV+LQklHFxV310eyATCdE6MSmALNNwuAjVCttkoQAmquC5RXEq7ZsGNiOvFh
         viCA==
X-Gm-Message-State: AOAM531cBHJbaSdQRiZjP+2jaKFhAg/QiNi6b/RzSNPvRTEhYTpz0Y6n
	DeaEoRH4ar0SQGK0dzHr6iA=
X-Google-Smtp-Source: ABdhPJyy5MyQQO7UCLtPt/5jqEi0XGMVEAX+4uSWfvVF1m9de6pgw4R42ubj1hJieu+VJS+VVYDYNQ==
X-Received: by 2002:aa7:c558:: with SMTP id s24mr24330803edr.257.1607937038506;
        Mon, 14 Dec 2020 01:10:38 -0800 (PST)
From: Liza Babu <lizzababu@gmail.com>
X-Google-Original-From: Liza Babu <lizza.babu@gmail.com>
To: raducanu.costi@gmail.com
Cc: minios-devel@lists.xen.org,
	Liza Babu <lizza.babu@gmail.com>
Subject: Re: [1/5] lib/vfscore: Register `getpid` and `getppid` to syscall_shim
Date: Mon, 14 Dec 2020 11:10:30 +0200
Message-Id: <20201214091030.36058-1-lizza.babu@gmail.com>
X-Mailer: git-send-email 2.28.0
In-Reply-To: 20200717124718.16583-1-raducanu.costi@gmail.com
References: 20200717124718.16583-1-raducanu.costi@gmail.com
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit

Hi, Costi.

Looks good to me.

Liza Babu

Reviewed-by: Liza Babu <lizza.babu@gmail.com>


From minios-devel-bounces@lists.xenproject.org Mon Dec 14 09:44:43 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Mon, 14 Dec 2020 09:44:43 +0000
Received: from list by lists.xenproject.org with outflank-mailman.52054.91074 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1kokPK-00073Z-In; Mon, 14 Dec 2020 09:44:42 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 52054.91074; Mon, 14 Dec 2020 09:44: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 1kokPK-00073S-Fx; Mon, 14 Dec 2020 09:44:42 +0000
Received: by outflank-mailman (input) for mailman id 52054;
 Mon, 14 Dec 2020 09:44: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=rwpQ=FS=gmail.com=lizzababu@srs-us1.protection.inumbo.net>)
 id 1kokPJ-00073N-8M
 for minios-devel@lists.xen.org; Mon, 14 Dec 2020 09:44:41 +0000
Received: from mail-ej1-x62e.google.com (unknown [2a00:1450:4864:20::62e])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 3fd597ab-bdf1-4d40-aa3a-6b8e5a6d21f3;
 Mon, 14 Dec 2020 09:44:40 +0000 (UTC)
Received: by mail-ej1-x62e.google.com with SMTP id d17so21655937ejy.9
 for <minios-devel@lists.xen.org>; Mon, 14 Dec 2020 01:44:40 -0800 (PST)
Received: from localhost.localdomain (5-12-166-103.residential.rdsnet.ro.
 [5.12.166.103])
 by smtp.gmail.com with ESMTPSA id dd18sm13390251ejb.53.2020.12.14.01.44.38
 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128);
 Mon, 14 Dec 2020 01:44:39 -0800 (PST)
X-BeenThere: minios-devel@lists.xenproject.org
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
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: 3fd597ab-bdf1-4d40-aa3a-6b8e5a6d21f3
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=UgSDtEWtq0esAVCBFj+ApHDWBp6MWIhHged2FQdvvZo=;
        b=ghbppxf/IGEIYOpxCCDZz/fkPg3a00ZQ26CYMWRcysbQg8Qdl0fRJm/aYW+39f1/68
         wlsYcKZ2POW5cEj0KFBCMmyJimUp0gNxurKmxmcG4IV/Zne00RiEwFI5ZoEG0b77RO51
         EQ4l/yt2Gyzbs6zjQussTTEAUtykP5y5Qz2fmr/6EeL0c8b7eK99PwGBKR56jCAhH+bQ
         7XleCNskXy7UTq8eCpgnCC6f3qDnddwv4RbP+zv6+ytIyycJPF9IldNonpPQ5iXKUt9X
         9vlOZz7s4YnK0NiOzw38ChIxyg5edapvq21LL/tbYNo85cwnsIPlds37wrnYcwOH2gk+
         3p1Q==
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=UgSDtEWtq0esAVCBFj+ApHDWBp6MWIhHged2FQdvvZo=;
        b=ib19JKtw46tORWpVegb3MZDxk2/AHo5CKEN/MHjf/GSpy4G8hOtNjxbHPsKVPTBLDr
         JnOwC1tlWB63gGL/RweTlsC0f309qzbktCMScWoYNZ8jnHsBZwXsTZ2tRvodBlrQvuLu
         UNPlOKMRTtbJIlsh6Dabd0u7qXIKrhoEAjnmmbrjnLmTHHCE+tUDxKzUwTjSAVtqM0wH
         vXfKxUPTHgLO3RNp/ze9qD9TgNgKnGFG6GGKThj0p09ptTA9C77A6WkquUl/ZYWPrupo
         zRc55/aqhXcCdbV6IO0W04njSFLgyNlrFlmutC4Uscc/7JafhEOmvc9jcqRoFVnU8M7u
         jRhg==
X-Gm-Message-State: AOAM531ZNn8jSKo4VDJx/GDKQl/i6lbTHRRTVjXfY6tAQYbxk9fDjoCf
	cf59wucR/9yFRzeZ0T1mRIs=
X-Google-Smtp-Source: ABdhPJxUZAcPyUub0TRj1p78mnmF+9TtJX18tbsl7muYjhUZHs2Xx/froiSYQY4uCG1YhyaCMWuoLg==
X-Received: by 2002:a17:906:25e:: with SMTP id 30mr20919305ejl.544.1607939079495;
        Mon, 14 Dec 2020 01:44:39 -0800 (PST)
From: Liza Babu <lizzababu@gmail.com>
X-Google-Original-From: Liza Babu <lizza.babu@gmail.com>
To: raducanu.costi@gmail.com
Cc: minios-devel@lists.xen.org,
	Liza Babu <lizza.babu@gmail.com>
Subject: Re: [1/8] lib/vfscore: Register `unlink` to syscall_shim
Date: Mon, 14 Dec 2020 11:44:29 +0200
Message-Id: <20201214094429.36905-1-lizza.babu@gmail.com>
X-Mailer: git-send-email 2.28.0
In-Reply-To: 20200509062946.9638-1-raducanu.costi@gmail.com
References: 20200509062946.9638-1-raducanu.costi@gmail.com
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit

Hi, Costi.

This patch is outdated and has conflicts with the upstream. Can you please fix it?

Liza Babu

Reviewed-by: Liza Babu <lizza.babu@gmail.com>


From minios-devel-bounces@lists.xenproject.org Mon Dec 14 09:45:05 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Mon, 14 Dec 2020 09:45:05 +0000
Received: from list by lists.xenproject.org with outflank-mailman.52055.91079 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1kokPh-00075I-Lr; Mon, 14 Dec 2020 09:45:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 52055.91079; Mon, 14 Dec 2020 09:45: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 1kokPh-00075A-Ib; Mon, 14 Dec 2020 09:45:05 +0000
Received: by outflank-mailman (input) for mailman id 52055;
 Mon, 14 Dec 2020 09:45: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=rwpQ=FS=gmail.com=lizzababu@srs-us1.protection.inumbo.net>)
 id 1kokPg-00074m-8D
 for minios-devel@lists.xen.org; Mon, 14 Dec 2020 09:45:04 +0000
Received: from mail-ed1-x52b.google.com (unknown [2a00:1450:4864:20::52b])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id f76a1c85-7cc0-440f-ae85-a18080ceac18;
 Mon, 14 Dec 2020 09:45:03 +0000 (UTC)
Received: by mail-ed1-x52b.google.com with SMTP id q16so16446779edv.10
 for <minios-devel@lists.xen.org>; Mon, 14 Dec 2020 01:45:03 -0800 (PST)
Received: from localhost.localdomain (5-12-166-103.residential.rdsnet.ro.
 [5.12.166.103])
 by smtp.gmail.com with ESMTPSA id r24sm14889682edo.4.2020.12.14.01.45.02
 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128);
 Mon, 14 Dec 2020 01:45:02 -0800 (PST)
X-BeenThere: minios-devel@lists.xenproject.org
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
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: f76a1c85-7cc0-440f-ae85-a18080ceac18
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=UgSDtEWtq0esAVCBFj+ApHDWBp6MWIhHged2FQdvvZo=;
        b=T7sR9mtrS4I/OTUihg9jMMylcbT4ipJPIJLbXqILPcVZ6bR/GhJUfIuP2usGJS0X6q
         MsbV7ksZLphALJINvnZ8vRby1J37PwbI0px7XW4v0z3tz1S8E8+eDZsTUoQoo3860DiZ
         uPh0C/1z6Fb/xu6e0rvN+ra5d9lr1Nvx3XTmHJXAo3QNqF7R/fSHAwugP/3rxT2+TMjn
         5OHCABLeI/j2QTX2OUm8enZK3NQCGWKLIQTZg+q5e2GFykfYWdyJuDN1gS7Mi44zToVv
         2k4EWYhxkOdkSX6P407YgEJw/8SkaNRLPW40m80ybs9DxNGLBU/0XHU8JzA0xz7ZZuQF
         r/+g==
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=UgSDtEWtq0esAVCBFj+ApHDWBp6MWIhHged2FQdvvZo=;
        b=S/NjM76AF/SJxHBQFaIiFwODxJJW3a1ZSYcwIHONXeGBvXilC21KnJAImcaD6l3OKQ
         rqrTiCbNM5FseomtveftsTM96/gEeojPllrJN/L0c/sBrjRRQKrGpn3RtmW/cLEJgWyz
         PY0cQgW3K4/t1ilGBW8fck5CorR+s5dcO9ms/YNq3jpbwtTXEZucflYU8YCEuvcZ6bYQ
         uOoI0V7rLg+YfTnszSQKyVM8UTRZMLEstkqqlMAEiXkyzy0aIrVvx/eU+AAfD6P1PFH7
         ZtcO83l+4aAOhiWAP9wzvTd2IhPvjxuOtz9oWFv8Yr3PUjfM3Yjbm5rY5qWdxQDsEDf7
         ptqA==
X-Gm-Message-State: AOAM532KSX6D8jO+88MR6Qa8F2GWcpVDtQReHFtAUFngqZxS50sHcaWU
	LpPZdfce5/wZ8BcmzbmQOMM=
X-Google-Smtp-Source: ABdhPJz8jGjtz2ZbLWQMsrjS594itFfen8CwvfntYWAMMJUu8xAZYarutVJy0YCi6W7pFUT95MQSWA==
X-Received: by 2002:a05:6402:b57:: with SMTP id bx23mr23703428edb.191.1607939102800;
        Mon, 14 Dec 2020 01:45:02 -0800 (PST)
From: Liza Babu <lizzababu@gmail.com>
X-Google-Original-From: Liza Babu <lizza.babu@gmail.com>
To: raducanu.costi@gmail.com
Cc: minios-devel@lists.xen.org,
	Liza Babu <lizza.babu@gmail.com>
Subject: Re: [2/8] lib/vfscore: Register `stat` to syscall_shim
Date: Mon, 14 Dec 2020 11:44:55 +0200
Message-Id: <20201214094455.36980-1-lizza.babu@gmail.com>
X-Mailer: git-send-email 2.28.0
In-Reply-To: 20200509062946.9638-2-raducanu.costi@gmail.com
References: 20200509062946.9638-2-raducanu.costi@gmail.com
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit

Hi, Costi.

This patch is outdated and has conflicts with the upstream. Can you please fix it?

Liza Babu

Reviewed-by: Liza Babu <lizza.babu@gmail.com>


From minios-devel-bounces@lists.xenproject.org Mon Dec 14 09:45:31 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Mon, 14 Dec 2020 09:45:31 +0000
Received: from list by lists.xenproject.org with outflank-mailman.52056.91082 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1kokQ7-00076g-O6; Mon, 14 Dec 2020 09:45:31 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 52056.91082; Mon, 14 Dec 2020 09:45: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 1kokQ7-00076Z-LH; Mon, 14 Dec 2020 09:45:31 +0000
Received: by outflank-mailman (input) for mailman id 52056;
 Mon, 14 Dec 2020 09:45: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=rwpQ=FS=gmail.com=lizzababu@srs-us1.protection.inumbo.net>)
 id 1kokQ6-00076P-97
 for minios-devel@lists.xen.org; Mon, 14 Dec 2020 09:45:30 +0000
Received: from mail-ej1-x62e.google.com (unknown [2a00:1450:4864:20::62e])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 3ac20074-8d17-4dc6-9993-c66e16990228;
 Mon, 14 Dec 2020 09:45:29 +0000 (UTC)
Received: by mail-ej1-x62e.google.com with SMTP id x16so21641452ejj.7
 for <minios-devel@lists.xen.org>; Mon, 14 Dec 2020 01:45:29 -0800 (PST)
Received: from localhost.localdomain (5-12-166-103.residential.rdsnet.ro.
 [5.12.166.103])
 by smtp.gmail.com with ESMTPSA id e3sm13145976ejq.96.2020.12.14.01.45.28
 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128);
 Mon, 14 Dec 2020 01:45:28 -0800 (PST)
X-BeenThere: minios-devel@lists.xenproject.org
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
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: 3ac20074-8d17-4dc6-9993-c66e16990228
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=UgSDtEWtq0esAVCBFj+ApHDWBp6MWIhHged2FQdvvZo=;
        b=Ufzh1ArZfPeBvOyhzXFYfJccf+6w8TXOLErry0ZFZd9HHyGCgymMzbi03CL5ugyWNb
         /JG1mHGldBFToXiyNpBddpSAJXcIhGP9QnGYfqy246crvbVCo3cumkqpf6xlScKJXdfA
         Jt9MoxX5IiZIMZ30jDL2+PjS7CWO7maLlmQkkFKanagnYqHHEtVlH6/8jpWX7WEPWkEg
         Cy/W6fzFHI9BZEUs6hj2odyrtJBd/qJR7dH7Mtlln1lar4+BQbHJH7+dMr8qco8aWfMU
         yzyanc4o8jsywGvi1/Yd0xGvzZENjrwEbIqh0ZTV0U4z6d0DlBCQ5caft1pmfAtXJtEP
         ATkw==
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=UgSDtEWtq0esAVCBFj+ApHDWBp6MWIhHged2FQdvvZo=;
        b=f1fl9tp3TFmZyPZPtD2CwLpiYbAIF8YhgVhzpOPbaoJmQ9CFbQBbsTsc63mZG9ZRpu
         I8sKiPPkTxFd25GztnkO74BUtu5RAKCwihwZW/YF20HZt57sKcp2Nvs55CibDb3OZO2J
         unEdF1xMPSAGV5AbrrJk+NLotSWsRWsUywL7M4DHoE8Q3qcLbNfEn21F3XGCKCtFDBqA
         pbyozQ3RJoLldBUlM47V2DZ8hIPCrMbKC/vZhCIKMIogzOTSaT7MFpjiMGiBbD15sdYp
         RBwJNBsjw9FBIcRkmDCZ6fTIm2qm618aLZt4XWK9EYsc2Rox64Aj5ZwzNUDXSi4ozyAM
         a5Bw==
X-Gm-Message-State: AOAM531i1Aq/u+7BGVc+II7ZJVSVjv55ox3J/R5Fyz7qgP7XFGe7swDF
	lE0aWySbFOA0Z6q6TRjKg+g=
X-Google-Smtp-Source: ABdhPJz6026lb778/sTSVq2OSxrdqsCFxHs/rLPFYnzVlxLxBlP92c2zXU55cc1AF445AHNDFwdKIg==
X-Received: by 2002:a17:906:6546:: with SMTP id u6mr22333135ejn.36.1607939128788;
        Mon, 14 Dec 2020 01:45:28 -0800 (PST)
From: Liza Babu <lizzababu@gmail.com>
X-Google-Original-From: Liza Babu <lizza.babu@gmail.com>
To: raducanu.costi@gmail.com
Cc: minios-devel@lists.xen.org,
	Liza Babu <lizza.babu@gmail.com>
Subject: Re: [3/8] lib/vfscore: Register `open` to syscall_shim
Date: Mon, 14 Dec 2020 11:45:20 +0200
Message-Id: <20201214094520.37042-1-lizza.babu@gmail.com>
X-Mailer: git-send-email 2.28.0
In-Reply-To: 20200509062946.9638-3-raducanu.costi@gmail.com
References: 20200509062946.9638-3-raducanu.costi@gmail.com
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit

Hi, Costi.

This patch is outdated and has conflicts with the upstream. Can you please fix it?

Liza Babu

Reviewed-by: Liza Babu <lizza.babu@gmail.com>


From minios-devel-bounces@lists.xenproject.org Mon Dec 14 09:45:58 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Mon, 14 Dec 2020 09:45:58 +0000
Received: from list by lists.xenproject.org with outflank-mailman.52059.91086 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1kokQX-000789-Qm; Mon, 14 Dec 2020 09:45:57 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 52059.91086; Mon, 14 Dec 2020 09:45: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 1kokQX-000782-Nq; Mon, 14 Dec 2020 09:45:57 +0000
Received: by outflank-mailman (input) for mailman id 52059;
 Mon, 14 Dec 2020 09: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=rwpQ=FS=gmail.com=lizzababu@srs-us1.protection.inumbo.net>)
 id 1kokQW-00077x-GJ
 for minios-devel@lists.xen.org; Mon, 14 Dec 2020 09:45:56 +0000
Received: from mail-ej1-x62e.google.com (unknown [2a00:1450:4864:20::62e])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 0f1e3a6c-4fe5-4b32-80d3-33bfbe199ec2;
 Mon, 14 Dec 2020 09:45:55 +0000 (UTC)
Received: by mail-ej1-x62e.google.com with SMTP id g20so21691648ejb.1
 for <minios-devel@lists.xen.org>; Mon, 14 Dec 2020 01:45:55 -0800 (PST)
Received: from localhost.localdomain (5-12-166-103.residential.rdsnet.ro.
 [5.12.166.103])
 by smtp.gmail.com with ESMTPSA id h12sm13822055ejx.81.2020.12.14.01.45.54
 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128);
 Mon, 14 Dec 2020 01:45:54 -0800 (PST)
X-BeenThere: minios-devel@lists.xenproject.org
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
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: 0f1e3a6c-4fe5-4b32-80d3-33bfbe199ec2
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=UgSDtEWtq0esAVCBFj+ApHDWBp6MWIhHged2FQdvvZo=;
        b=qM4ZlGGCb++ZY+Fwz7LxEiq1L+jG8pwqe0Bb4HI8n381E2O3n/Yz3+2ks7lxPOC+xI
         OE2sV+YObIdgecijEX6xsacbzQeU6vGJ7Nfp7wyeW++kcJVp+AvygleB7cmnaMtBxP9x
         rGBOXxqxWmDPklyASnOYCpthZFcUL5dkLZ0Dt4U5FjSWTq4qWekdFkjmFdAtA1N7Bfhv
         k3yxv/uIQpFvYbyqvBaIAz9CIVOo29PKWyUxoPi8LokgT6mPtXxNJHqQoxzIQZq/03od
         HnboaAYQt+o6+Ub8PYiNBxrbBgAZ3Pu3NLBz3L/PDntTiAET42FjvdfRmWEjrrgBhFdu
         eQ4g==
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=UgSDtEWtq0esAVCBFj+ApHDWBp6MWIhHged2FQdvvZo=;
        b=KoNpWz8+fIpSrE2yb2jjdH9t6hk3yYxT8HDxNdPW2E3ZhNCe6pQQzb5VmIL0GzFG8o
         pgvmSN7djz30wVRbnNlwteY5ZfW9s2rnncMmNNURZQeeVBsohbok/w/lv5myHNYtiXH0
         27DxI07rYkAajxPVAjVF9YhDiNJmOERL3mQBppDPdztKXEnJ7BTDzKpRuavyUbphTuzy
         J36lxf9UxVrOkabn6XTgHSmVcT4HUFXP0PU6ldP83rvnhNcr70AdBYUVhdkhowI9WfOT
         U+fYMi8aBX0iJmq9I05tte+HkDce1YGXhpbL/PcrajVDXyEaNjrcW3oBYN6loJzFi6MV
         er7g==
X-Gm-Message-State: AOAM530pgkX/OmgBqV3phGPrHYQe0KRV0OoAKg0/M+3YO8kKR2O9IgYk
	eGvOX8BSNegGBRx2L6R9DMg=
X-Google-Smtp-Source: ABdhPJw1PGImU5mT0WAsVoDwi/ftF4PZP8OtDt3jlDJaMNENTb4OQFnLkuuF0nqfBP1mkQts8oT+Fg==
X-Received: by 2002:a17:906:edd2:: with SMTP id sb18mr22664228ejb.114.1607939154948;
        Mon, 14 Dec 2020 01:45:54 -0800 (PST)
From: Liza Babu <lizzababu@gmail.com>
X-Google-Original-From: Liza Babu <lizza.babu@gmail.com>
To: raducanu.costi@gmail.com
Cc: minios-devel@lists.xen.org,
	Liza Babu <lizza.babu@gmail.com>
Subject: Re: [4/8] lib/vfscore: Register `mkdir` to syscall_shim
Date: Mon, 14 Dec 2020 11:45:47 +0200
Message-Id: <20201214094547.37125-1-lizza.babu@gmail.com>
X-Mailer: git-send-email 2.28.0
In-Reply-To: 20200509062946.9638-4-raducanu.costi@gmail.com
References: 20200509062946.9638-4-raducanu.costi@gmail.com
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit

Hi, Costi.

This patch is outdated and has conflicts with the upstream. Can you please fix it?

Liza Babu

Reviewed-by: Liza Babu <lizza.babu@gmail.com>


From minios-devel-bounces@lists.xenproject.org Mon Dec 14 09:46:16 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Mon, 14 Dec 2020 09:46:16 +0000
Received: from list by lists.xenproject.org with outflank-mailman.52060.91091 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1kokQq-00079o-Tx; Mon, 14 Dec 2020 09:46:16 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 52060.91091; Mon, 14 Dec 2020 09:46: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 1kokQq-00079e-Q6; Mon, 14 Dec 2020 09:46:16 +0000
Received: by outflank-mailman (input) for mailman id 52060;
 Mon, 14 Dec 2020 09:46: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=rwpQ=FS=gmail.com=lizzababu@srs-us1.protection.inumbo.net>)
 id 1kokQp-00079S-MD
 for minios-devel@lists.xen.org; Mon, 14 Dec 2020 09:46:15 +0000
Received: from mail-ej1-x632.google.com (unknown [2a00:1450:4864:20::632])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 852a6826-8b64-4d53-b789-bcc187e78370;
 Mon, 14 Dec 2020 09:46:15 +0000 (UTC)
Received: by mail-ej1-x632.google.com with SMTP id ga15so21650253ejb.4
 for <minios-devel@lists.xen.org>; Mon, 14 Dec 2020 01:46:15 -0800 (PST)
Received: from localhost.localdomain (5-12-166-103.residential.rdsnet.ro.
 [5.12.166.103])
 by smtp.gmail.com with ESMTPSA id u2sm2458260ejb.65.2020.12.14.01.46.13
 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128);
 Mon, 14 Dec 2020 01:46:13 -0800 (PST)
X-BeenThere: minios-devel@lists.xenproject.org
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
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: 852a6826-8b64-4d53-b789-bcc187e78370
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=UgSDtEWtq0esAVCBFj+ApHDWBp6MWIhHged2FQdvvZo=;
        b=EoSAjQFKb3qwxXsFM09VLrfIeLho2Ch4pAzvlOjAYzcqmKy/0DHbf1JYlPv8CMCHOw
         cmMp/h8k/beGxnVVUdSQzNbJouMqzzSi5zPJfLZZYokVelWz9bBwvbA+FBXd/0fM2zX5
         G/pmzE+2oDBOcrj3D3d1S+dGRpbw9mbG3xsT4fMe7lcuiW1ealxt1qMcaNq+2Bexh6Ck
         +K7W4EIrJNArX6ClEGf+JCm43EyY75ST/TivnDphhkiJuY6CgeJTDBf7BFfi3R7azZpG
         zTSSmBd+AF9dmdEiSs5M6AJ+WA6kH2d8t0jApRcOKxWSv9X52GeK3JtMzRuib1HhNPJs
         v/vw==
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=UgSDtEWtq0esAVCBFj+ApHDWBp6MWIhHged2FQdvvZo=;
        b=XQuTy6iXwaZh3wrtVbT2BQpxjC/MULnRxhdQdfkZFo45UIpaYP24nOZGU79Y0zS6tZ
         stH/fkImBMG0CjMhdk7gTkgkcvkdITq1Gw+BOmMJ7gPDR/G8w7ge0imHhLQLLE/Jc48n
         gCoq0VrY8q5yGKhNnhIO3eWjNSp+3QxfKs/ShuXZAqElKSmpLWg73ZSmVAWR/fDj2oo7
         3I8k22e6fIUu6ICiz75MjBQ+YWVYyQTItxrjNJST1xm2O5r9lq18c+HYVTXNYOE1lxwg
         y8d4JddcELoh7AmUrRCKEAmIA5nV0uShgyzKjdo9z7zOHxsVTn8o5jQo2IrAUMfxlwTm
         D/UA==
X-Gm-Message-State: AOAM530FRP9MSQiSvqGAEOriNXH3TMvBPiVqVKjfyT9G0/+KygRafeuk
	usmotLRvGWmEtR8JuEYrKGI=
X-Google-Smtp-Source: ABdhPJyotNBQ9YGtj97kOV8vEQMJwuFJLQ71kbMvnR2/H31vT9TnM46RCsM6Nmr/7yu4i6egs6EYnA==
X-Received: by 2002:a17:907:a8a:: with SMTP id by10mr21409917ejc.423.1607939174248;
        Mon, 14 Dec 2020 01:46:14 -0800 (PST)
From: Liza Babu <lizzababu@gmail.com>
X-Google-Original-From: Liza Babu <lizza.babu@gmail.com>
To: raducanu.costi@gmail.com
Cc: minios-devel@lists.xen.org,
	Liza Babu <lizza.babu@gmail.com>
Subject: Re: [5/8] lib/vfscore: Register `creat` to syscall_shim
Date: Mon, 14 Dec 2020 11:46:06 +0200
Message-Id: <20201214094606.37201-1-lizza.babu@gmail.com>
X-Mailer: git-send-email 2.28.0
In-Reply-To: 20200509062946.9638-5-raducanu.costi@gmail.com
References: 20200509062946.9638-5-raducanu.costi@gmail.com
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit

Hi, Costi.

This patch is outdated and has conflicts with the upstream. Can you please fix it?

Liza Babu

Reviewed-by: Liza Babu <lizza.babu@gmail.com>


From minios-devel-bounces@lists.xenproject.org Mon Dec 14 09:46:34 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Mon, 14 Dec 2020 09:46:34 +0000
Received: from list by lists.xenproject.org with outflank-mailman.52062.91094 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1kokR7-0007BG-W6; Mon, 14 Dec 2020 09:46:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 52062.91094; Mon, 14 Dec 2020 09:46: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 1kokR7-0007B9-T3; Mon, 14 Dec 2020 09:46:33 +0000
Received: by outflank-mailman (input) for mailman id 52062;
 Mon, 14 Dec 2020 09:46:32 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=rwpQ=FS=gmail.com=lizzababu@srs-us1.protection.inumbo.net>)
 id 1kokR6-0007B4-2K
 for minios-devel@lists.xen.org; Mon, 14 Dec 2020 09:46:32 +0000
Received: from mail-ej1-x636.google.com (unknown [2a00:1450:4864:20::636])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 4291d780-3a1f-4927-9218-98c8d3a34f05;
 Mon, 14 Dec 2020 09:46:31 +0000 (UTC)
Received: by mail-ej1-x636.google.com with SMTP id x16so21645742ejj.7
 for <minios-devel@lists.xen.org>; Mon, 14 Dec 2020 01:46:31 -0800 (PST)
Received: from localhost.localdomain (5-12-166-103.residential.rdsnet.ro.
 [5.12.166.103])
 by smtp.gmail.com with ESMTPSA id r7sm15077816edv.39.2020.12.14.01.46.29
 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128);
 Mon, 14 Dec 2020 01:46:30 -0800 (PST)
X-BeenThere: minios-devel@lists.xenproject.org
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
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: 4291d780-3a1f-4927-9218-98c8d3a34f05
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=UgSDtEWtq0esAVCBFj+ApHDWBp6MWIhHged2FQdvvZo=;
        b=NVSI4zIm1RSHoTJSxqe96XcSlVEC9LSAQpFgveZPQly+4OaTCpTpf8S4R56z4V1Ze0
         gHRV31k9vXp3J6zs2FrBwHBaOtO7sEg6dJ8bn6OS1lF8lPHUzQk9GKXkjX/TjNTsU1G2
         ZwMik0ZkY3B1dFSkyZktzrJxLFpYFMt2Ff/w5h/FPBhMinkLTKwlQq7NjPXUp2uYymli
         Hybz1POd05I0PGLtdTmWo3IhPYhxulflGTLmzMLVgxw1BSwInB99Db+e0VQ8E3x47scn
         zhbElqXe64qINLsKgYiGkNysi18eT6bfym9ssvPPpfXxkrS/VPoTBsFeudmqlvRN7tIF
         OM/A==
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=UgSDtEWtq0esAVCBFj+ApHDWBp6MWIhHged2FQdvvZo=;
        b=BePSVdOXedcNNDb2f75G+w6Nv8po7Vqu0vrlMe7LA0sSx6q+bkBjWXAHwiqSmxDnk4
         DSOswTkn5ivqr/+6mKF8FHMeZ6W+loEV2Cqp9gupDheq3/2X1VwWK/cht9EGLrWV3yBi
         oE3st/h55Z9LfRY35geoAPBQGEtyG38O7uUB1hJM0SkjHWAZmjiZ02JZz9jwPRhgdpHG
         mar2E0olgiSuALrirIg19/dRv4WwYNCCsYl0YtZkNJCmQl64GEzSUBcuepkHxcXA0qH0
         y2Mzqigei1qvTzuYcw6oUbFCGA3qgqa2Nb5RphTyGGRdklxz4g2J/INE3UA28Xdeuf5A
         gRbQ==
X-Gm-Message-State: AOAM531bHwaTzureE1XSCUXsiHILawWApjyJrMIIdKprIhyGnLFlL21e
	RMULZlrsjDuwElkL8gKMLAo=
X-Google-Smtp-Source: ABdhPJzKkaOitlvgdTc4+CUsXLLXXnefF+PlQnUBGbuBTRmWKvnSbMH0AbEcynSdpsiUUzpmxc7Bxw==
X-Received: by 2002:a17:906:38c8:: with SMTP id r8mr22191344ejd.39.1607939190574;
        Mon, 14 Dec 2020 01:46:30 -0800 (PST)
From: Liza Babu <lizzababu@gmail.com>
X-Google-Original-From: Liza Babu <lizza.babu@gmail.com>
To: raducanu.costi@gmail.com
Cc: minios-devel@lists.xen.org,
	Liza Babu <lizza.babu@gmail.com>
Subject: Re: [6/8] lib/vfscore: Register `symlink` to syscall_shim
Date: Mon, 14 Dec 2020 11:46:22 +0200
Message-Id: <20201214094622.37267-1-lizza.babu@gmail.com>
X-Mailer: git-send-email 2.28.0
In-Reply-To: 20200509062946.9638-6-raducanu.costi@gmail.com
References: 20200509062946.9638-6-raducanu.costi@gmail.com
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit

Hi, Costi.

This patch is outdated and has conflicts with the upstream. Can you please fix it?

Liza Babu

Reviewed-by: Liza Babu <lizza.babu@gmail.com>


From minios-devel-bounces@lists.xenproject.org Mon Dec 14 09:46:56 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Mon, 14 Dec 2020 09:46:56 +0000
Received: from list by lists.xenproject.org with outflank-mailman.52064.91099 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1kokRU-0007Ce-1y; Mon, 14 Dec 2020 09:46:56 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 52064.91099; Mon, 14 Dec 2020 09:46: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 1kokRT-0007CX-VN; Mon, 14 Dec 2020 09:46:55 +0000
Received: by outflank-mailman (input) for mailman id 52064;
 Mon, 14 Dec 2020 09:46: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=rwpQ=FS=gmail.com=lizzababu@srs-us1.protection.inumbo.net>)
 id 1kokRS-0007CS-K0
 for minios-devel@lists.xen.org; Mon, 14 Dec 2020 09:46:54 +0000
Received: from mail-ej1-x630.google.com (unknown [2a00:1450:4864:20::630])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 9ec6a2a1-904b-48cc-ac7c-3ee73cfe07b2;
 Mon, 14 Dec 2020 09:46:53 +0000 (UTC)
Received: by mail-ej1-x630.google.com with SMTP id jx16so21627689ejb.10
 for <minios-devel@lists.xen.org>; Mon, 14 Dec 2020 01:46:53 -0800 (PST)
Received: from localhost.localdomain (5-12-166-103.residential.rdsnet.ro.
 [5.12.166.103])
 by smtp.gmail.com with ESMTPSA id v24sm15263640edw.23.2020.12.14.01.46.52
 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128);
 Mon, 14 Dec 2020 01:46:52 -0800 (PST)
X-BeenThere: minios-devel@lists.xenproject.org
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
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: 9ec6a2a1-904b-48cc-ac7c-3ee73cfe07b2
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=UgSDtEWtq0esAVCBFj+ApHDWBp6MWIhHged2FQdvvZo=;
        b=SnncBlAn0TcOvjKtji+qCiqWOGG7g1SEHzD3AVo4oGxtWkJmNXpYTAlyUUCOHgWcEf
         Tq2t1QPV3eEVrNWNEmnOeoI6TPS0MOJR1pB5iMoYgRx+PqJpkBGTxrtlCQIFxjl4oed0
         m1vdSUUiJVybsD1RuWZQ1oLWfwpI7JM40Jr/SMPEllm6XhHBG91kAQi/uMP9uCQsGS/g
         ljdTsMa9dJAQSG5IHgUROAGtGoFI6dm5sDUo91ZUJ62fbrSbnrzKPAm6Ke+m6CcO6opG
         3XSi7IeHexkpWkBWTlEJSxvTvLcKP1KHpTV1qHu33FsP6c34RhU+iUGAjeiGbHBd3KsC
         Q3Kw==
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=UgSDtEWtq0esAVCBFj+ApHDWBp6MWIhHged2FQdvvZo=;
        b=HZZpUpFNaybtafdVOdU7OSmvmlMjf0D1R1qHw6wQ+7WIz2tolBs/kyhTg6F2yFYOdq
         3yUf43d+OyaEBkKbVN5eDvnOAS1FlGhp/7Vzhqdkc1c10IkAz5JVNQFyqR4oQPUVudPM
         fjbj4lhXPdZzrw/fect1A+LPQ6/Jf/gCRi13dFY4jmaBFFj1KdI2JIjE3RqEWpPTeDqC
         HrONNZ9YtZOw2wdettxaVf+D3PgGpusC0Jh5S40TrCG/w13b1e+dZd+RiB8Ndl3Xl3Yc
         S56DwN/Hmifjg1dBBSPY8Bj6fZAKwYxWTuAl1zZoN3k0GRLzRqF8iJ7w6oz0mIukKtco
         jrAg==
X-Gm-Message-State: AOAM533eyIZCuoOJXgmgsYhddKnFVuogJ0kG5quSzSw8bcZYF8SOFNzw
	NNaUNVvTT94FFmYdpN/oQGl5atE7zMwzSw==
X-Google-Smtp-Source: ABdhPJzhgkPhYlG9t6v4FACT7HS5DOu8DExOEyiYPgGGhIaPu1vWYz+zWVeSDGWdT7PT/waVbVv+xQ==
X-Received: by 2002:a17:906:5847:: with SMTP id h7mr2966241ejs.124.1607939213164;
        Mon, 14 Dec 2020 01:46:53 -0800 (PST)
From: Liza Babu <lizzababu@gmail.com>
X-Google-Original-From: Liza Babu <lizza.babu@gmail.com>
To: raducanu.costi@gmail.com
Cc: minios-devel@lists.xen.org,
	Liza Babu <lizza.babu@gmail.com>
Subject: Re: [7/8] lib/vfscore: Register `pipe` to syscall_shim
Date: Mon, 14 Dec 2020 11:46:45 +0200
Message-Id: <20201214094645.37321-1-lizza.babu@gmail.com>
X-Mailer: git-send-email 2.28.0
In-Reply-To: 20200509062946.9638-7-raducanu.costi@gmail.com
References: 20200509062946.9638-7-raducanu.costi@gmail.com
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit

Hi, Costi.

This patch is outdated and has conflicts with the upstream. Can you please fix it?

Liza Babu

Reviewed-by: Liza Babu <lizza.babu@gmail.com>


From minios-devel-bounces@lists.xenproject.org Mon Dec 14 09:47:13 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Mon, 14 Dec 2020 09:47:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.52067.91102 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1kokRk-0007EK-3t; Mon, 14 Dec 2020 09:47:12 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 52067.91102; Mon, 14 Dec 2020 09:47: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 1kokRk-0007ED-1C; Mon, 14 Dec 2020 09:47:12 +0000
Received: by outflank-mailman (input) for mailman id 52067;
 Mon, 14 Dec 2020 09:47: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=rwpQ=FS=gmail.com=lizzababu@srs-us1.protection.inumbo.net>)
 id 1kokRi-0007E6-Bc
 for minios-devel@lists.xen.org; Mon, 14 Dec 2020 09:47:10 +0000
Received: from mail-ej1-x635.google.com (unknown [2a00:1450:4864:20::635])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id a5f6fcb5-393e-4fac-a50b-a761ddd0cd38;
 Mon, 14 Dec 2020 09:47:09 +0000 (UTC)
Received: by mail-ej1-x635.google.com with SMTP id n26so21638360eju.6
 for <minios-devel@lists.xen.org>; Mon, 14 Dec 2020 01:47:09 -0800 (PST)
Received: from localhost.localdomain (5-12-166-103.residential.rdsnet.ro.
 [5.12.166.103])
 by smtp.gmail.com with ESMTPSA id s12sm15270818edu.28.2020.12.14.01.47.08
 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128);
 Mon, 14 Dec 2020 01:47:08 -0800 (PST)
X-BeenThere: minios-devel@lists.xenproject.org
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
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: a5f6fcb5-393e-4fac-a50b-a761ddd0cd38
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=UgSDtEWtq0esAVCBFj+ApHDWBp6MWIhHged2FQdvvZo=;
        b=SKgJPf574aoRjgQkJwLDu08B3jqAUbINN1VozOHZ51Wfb0vWOIEPibiIa7J9KVCJd4
         ufLeN7/uETIEsO0yPv0OXvTo3PZ0xiOVhzalvkFMRRBqmd2Z1YrhNBNneS+hAvf8WS10
         9QmtHoWKhB6uTYqTxwynU6Cfxnxtd7i8M9/1o3DwAMncEbQIIFprxKRGINkOoGt0+IOa
         fmBGUM0F5vcUCEKGQ3cJ6dIcOj+mg+rh3dphMxVdE3Rn+ojMZzXIQDisLtLOO+W4Fil0
         /1UH0lX3LL4ZBfbdNmxWvMsZrbD9j+RjNBiopUcwUHYhVD8PaD3if1pKaB+mipbIh0Xu
         x4Ug==
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=UgSDtEWtq0esAVCBFj+ApHDWBp6MWIhHged2FQdvvZo=;
        b=cLEIddiMkldIih0rg7qzr76pIE2rSnAV9Rudm08gTKoGygZ54kUd6SUVBfNh+jS9ex
         9vYNnWyNfVPvEcivVo/iO3TL2T659W4Cm8fPIzSNg9tYomQM0N0GgwyLCb9VD0FANDHT
         /jCB39vdgaAwpv6QOsbGYhQYSIiMiGFDir+P5+DXX3dx/kle66Avbjivl/5/xcu4sqNJ
         dxb1iiB1Ahwi3iNEbdGC3Du5EXifzSIgyf/djADRJGvsOrM7E8yGRvqko7vorFi3pzVr
         OC2LfppNBnW04+AZSSa6lHqgw3wK4chf6GbhX5k2vTD+w5HpSiPgqxjVlBKj5qnicmzC
         hl+w==
X-Gm-Message-State: AOAM532FWpng57z/E1Z0Cn0lyRR1fPAkhBbdA+qklE6011jL8WoVZ29t
	PB/LQdLB+Ql2cW7xN0zpQykCvlgNDzRDkg==
X-Google-Smtp-Source: ABdhPJzliGth051FIN+5W7YNdPo9ohBGktfI/9CldxlvMwgMHWbNgO3HHUepsu8Q1S6iDpsaxkhZTA==
X-Received: by 2002:a17:907:3f9e:: with SMTP id hr30mr9855066ejc.258.1607939228893;
        Mon, 14 Dec 2020 01:47:08 -0800 (PST)
From: Liza Babu <lizzababu@gmail.com>
X-Google-Original-From: Liza Babu <lizza.babu@gmail.com>
To: raducanu.costi@gmail.com
Cc: minios-devel@lists.xen.org,
	Liza Babu <lizza.babu@gmail.com>
Subject: Re: [8/8] lib/vfscore: Register `pipe2` to syscall_shim
Date: Mon, 14 Dec 2020 11:47:01 +0200
Message-Id: <20201214094701.37388-1-lizza.babu@gmail.com>
X-Mailer: git-send-email 2.28.0
In-Reply-To: 20200509062946.9638-8-raducanu.costi@gmail.com
References: 20200509062946.9638-8-raducanu.costi@gmail.com
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit

Hi, Costi.

This patch is outdated and has conflicts with the upstream. Can you please fix it?

Liza Babu

Reviewed-by: Liza Babu <lizza.babu@gmail.com>


From minios-devel-bounces@lists.xenproject.org Mon Dec 14 20:24:15 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Mon, 14 Dec 2020 20:24:15 +0000
Received: from list by lists.xenproject.org with outflank-mailman.52685.91962 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1kouOD-0007ba-Da; Mon, 14 Dec 2020 20:24:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 52685.91962; Mon, 14 Dec 2020 20:24: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 1kouOD-0007bT-Aa; Mon, 14 Dec 2020 20:24:13 +0000
Received: by outflank-mailman (input) for mailman id 52685;
 Mon, 14 Dec 2020 20:24: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=Q9L2=FS=neclab.eu=simon.kuenzer@srs-us1.protection.inumbo.net>)
 id 1kouOB-0007b8-P9
 for minios-devel@lists.xen.org; Mon, 14 Dec 2020 20:24:11 +0000
Received: from mailer1.neclab.eu (unknown [195.37.70.40])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id c83c0877-70f4-4843-b432-0f4e05f245e2;
 Mon, 14 Dec 2020 20:24:10 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
 by mailer1.neclab.eu (Postfix) with ESMTP id 23B52103A3A;
 Mon, 14 Dec 2020 21:24:09 +0100 (CET)
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 uZfKjiMe4gpM; Mon, 14 Dec 2020 21:24:08 +0100 (CET)
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 CA824103F2A
 for <minios-devel@lists.xen.org>; Mon, 14 Dec 2020 21:24:08 +0100 (CET)
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; Mon, 14 Dec
 2020 21:24:08 +0100
X-BeenThere: minios-devel@lists.xenproject.org
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
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: c83c0877-70f4-4843-b432-0f4e05f245e2
X-Virus-Scanned: Amavisd on Debian GNU/Linux (atlas-a.office.hd)
X-ENC: Last-Hop-TLS-encrypted
X-ENC: Last-Hop-TLS-encrypted
From: Simon Kuenzer <simon.kuenzer@neclab.eu>
To: <minios-devel@lists.xen.org>
CC: Simon Kuenzer <simon.kuenzer@neclab.eu>
Subject: [UNIKRAFT PATCH 0/4] lib/uksched: Thread creation/deletion callbacks
Date: Mon, 14 Dec 2020 21:23:54 +0100
Message-ID: <20201214202358.11571-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)

This patch series mainly introduces the ability for libraries to
hook into thread creation and deletion process at `lib/uksched`.
Main intended usage are libc's (like newlibc, musl) that can
initialize TLS for each thread, even when a thread is created/deleted
through the uksched API. Additionally, the platform API is modified
in a way so that there is no dependency to `ukalloc` or a libc.

Simon Kuenzer (4):
  include/: Remove libc dependency in `<uk/plat/thread.h>`
  include/: No dependency to `lib/ukalloc` for thread contexts
  lib/uksched: Thread creation callbacks
  lib/ukbus: Increase initialization class to `platform`

 include/uk/plat/thread.h           | 47 +++++++++-------
 lib/9pfs/9pfs_vfsops.c             |  1 +
 lib/9pfs/9pfs_vnops.c              |  1 +
 lib/ukbus/include/uk/bus.h         |  2 +-
 lib/uknetdev/netdev.c              |  1 +
 lib/uksched/Makefile.uk            |  1 +
 lib/uksched/extra.ld               | 29 ++++++++++
 lib/uksched/include/uk/thread.h    | 39 +++++++++++++
 lib/uksched/thread.c               | 89 +++++++++++++++++++++++++++---
 lib/vfscore/file.c                 |  1 +
 lib/vfscore/pipe.c                 |  1 +
 plat/common/sw_ctx.c               | 36 ++++++------
 plat/xen/drivers/9p/9pfront.c      |  1 +
 plat/xen/drivers/blk/blkfront_xs.c |  1 +
 plat/xen/xenbus/xs_comms.c         |  1 +
 15 files changed, 203 insertions(+), 48 deletions(-)
 create mode 100644 lib/uksched/extra.ld

-- 
2.20.1


From minios-devel-bounces@lists.xenproject.org Mon Dec 14 20:24:17 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Mon, 14 Dec 2020 20:24:17 +0000
Received: from list by lists.xenproject.org with outflank-mailman.52686.91966 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1kouOH-0007cC-F6; Mon, 14 Dec 2020 20:24:17 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 52686.91966; Mon, 14 Dec 2020 20:24: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 1kouOH-0007c5-C7; Mon, 14 Dec 2020 20:24:17 +0000
Received: by outflank-mailman (input) for mailman id 52686;
 Mon, 14 Dec 2020 20:24: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=Q9L2=FS=neclab.eu=simon.kuenzer@srs-us1.protection.inumbo.net>)
 id 1kouOF-0007bq-K6
 for minios-devel@lists.xen.org; Mon, 14 Dec 2020 20:24:15 +0000
Received: from mailer2.neclab.eu (unknown [195.37.70.41])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 91267cd9-5172-450e-8ff5-2db27d7801a9;
 Mon, 14 Dec 2020 20:24:13 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
 by mailer2.neclab.eu (Postfix) with ESMTP id 9A036F22C3;
 Mon, 14 Dec 2020 21:24:12 +0100 (CET)
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 39D5JcnuMj6Y; Mon, 14 Dec 2020 21:24:12 +0100 (CET)
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 63827F22A5
 for <minios-devel@lists.xen.org>; Mon, 14 Dec 2020 21:24:10 +0100 (CET)
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; Mon, 14 Dec
 2020 21:24:10 +0100
X-BeenThere: minios-devel@lists.xenproject.org
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
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: 91267cd9-5172-450e-8ff5-2db27d7801a9
X-Virus-Scanned: Amavisd on Debian GNU/Linux (atlas-b.office.hd)
X-ENC: Last-Hop-TLS-encrypted
X-ENC: Last-Hop-TLS-encrypted
From: Simon Kuenzer <simon.kuenzer@neclab.eu>
To: <minios-devel@lists.xen.org>
CC: Simon Kuenzer <simon.kuenzer@neclab.eu>
Subject: [UNIKRAFT PATCH 1/4] include/: Remove libc dependency in `<uk/plat/thread.h>`
Date: Mon, 14 Dec 2020 21:23:55 +0100
Message-ID: <20201214202358.11571-2-simon.kuenzer@neclab.eu>
X-Mailer: git-send-email 2.20.1
In-Reply-To: <20201214202358.11571-1-simon.kuenzer@neclab.eu>
References: <20201214202358.11571-1-simon.kuenzer@neclab.eu>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Content-Type: text/plain
X-Originating-IP: [192.168.24.96]
X-ClientProxiedBy: oberon.office.hd (192.168.24.90) To puck.office.hd
 (192.168.24.91)

Removes the dependency to a libc with the platform header
`<uk/plat/thread.h>`. This is done in order to avoid unexpected
import orders and conflicts caused by generic Unikraft headers.

Signed-off-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
---
 include/uk/plat/thread.h           | 16 ++++++++--------
 lib/9pfs/9pfs_vfsops.c             |  1 +
 lib/9pfs/9pfs_vnops.c              |  1 +
 lib/uknetdev/netdev.c              |  1 +
 lib/vfscore/file.c                 |  1 +
 lib/vfscore/pipe.c                 |  1 +
 plat/xen/drivers/9p/9pfront.c      |  1 +
 plat/xen/drivers/blk/blkfront_xs.c |  1 +
 plat/xen/xenbus/xs_comms.c         |  1 +
 9 files changed, 16 insertions(+), 8 deletions(-)

diff --git a/include/uk/plat/thread.h b/include/uk/plat/thread.h
index 4b349ea7..8f3b0cea 100644
--- a/include/uk/plat/thread.h
+++ b/include/uk/plat/thread.h
@@ -38,7 +38,7 @@
 #ifndef __UKPLAT_THREAD_H__
 #define __UKPLAT_THREAD_H__
 
-#include <stdlib.h>
+#include <uk/arch/types.h>
 #include <uk/essentials.h>
 #include <uk/assert.h>
 
@@ -76,8 +76,8 @@ void *ukplat_thread_ctx_create(struct ukplat_ctx_callbacks *cbs,
 		struct uk_alloc *allocator, unsigned long sp,
 		unsigned long tlsp)
 {
-	UK_ASSERT(cbs != NULL);
-	UK_ASSERT(allocator != NULL);
+	UK_ASSERT(cbs != __NULL);
+	UK_ASSERT(allocator != __NULL);
 
 	return cbs->create_cb(allocator, sp, tlsp);
 }
@@ -92,8 +92,8 @@ static inline
 void ukplat_thread_ctx_start(struct ukplat_ctx_callbacks *cbs,
 		void *ctx)
 {
-	UK_ASSERT(cbs != NULL);
-	UK_ASSERT(ctx != NULL);
+	UK_ASSERT(cbs != __NULL);
+	UK_ASSERT(ctx != __NULL);
 
 	cbs->start_cb(ctx);
 }
@@ -102,9 +102,9 @@ static inline
 void ukplat_thread_ctx_switch(struct ukplat_ctx_callbacks *cbs,
 		void *prevctx, void *nextctx)
 {
-	UK_ASSERT(cbs != NULL);
-	UK_ASSERT(prevctx != NULL);
-	UK_ASSERT(nextctx != NULL);
+	UK_ASSERT(cbs != __NULL);
+	UK_ASSERT(prevctx != __NULL);
+	UK_ASSERT(nextctx != __NULL);
 
 	cbs->switch_cb(prevctx, nextctx);
 }
diff --git a/lib/9pfs/9pfs_vfsops.c b/lib/9pfs/9pfs_vfsops.c
index 5293b221..0059e06a 100644
--- a/lib/9pfs/9pfs_vfsops.c
+++ b/lib/9pfs/9pfs_vfsops.c
@@ -38,6 +38,7 @@
 #include <uk/9pdev_trans.h>
 #include <vfscore/mount.h>
 #include <vfscore/dentry.h>
+#include <stdlib.h>
 
 #include "9pfs.h"
 
diff --git a/lib/9pfs/9pfs_vnops.c b/lib/9pfs/9pfs_vnops.c
index 5a0700c6..1da64e96 100644
--- a/lib/9pfs/9pfs_vnops.c
+++ b/lib/9pfs/9pfs_vnops.c
@@ -36,6 +36,7 @@
 
 #include <fcntl.h>
 #include <dirent.h>
+#include <stdlib.h>
 #include <uk/config.h>
 #include <uk/9p.h>
 #include <uk/errptr.h>
diff --git a/lib/uknetdev/netdev.c b/lib/uknetdev/netdev.c
index 87322c7f..6a55a25f 100644
--- a/lib/uknetdev/netdev.c
+++ b/lib/uknetdev/netdev.c
@@ -35,6 +35,7 @@
  */
 #define _GNU_SOURCE /* for asprintf() */
 #include <stdio.h>
+#include <stdlib.h>
 #include <string.h>
 #include <uk/netdev.h>
 #include <uk/print.h>
diff --git a/lib/vfscore/file.c b/lib/vfscore/file.c
index bc8b0dc8..fe9458ae 100644
--- a/lib/vfscore/file.c
+++ b/lib/vfscore/file.c
@@ -34,6 +34,7 @@
  */
 
 #include <unistd.h>
+#include <stdlib.h>
 #include <errno.h>
 #include <uk/print.h>
 #include <vfscore/file.h>
diff --git a/lib/vfscore/pipe.c b/lib/vfscore/pipe.c
index 8d382965..7d435174 100644
--- a/lib/vfscore/pipe.c
+++ b/lib/vfscore/pipe.c
@@ -34,6 +34,7 @@
  */
 
 #include <uk/config.h>
+#include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
 #include <vfscore/file.h>
diff --git a/plat/xen/drivers/9p/9pfront.c b/plat/xen/drivers/9p/9pfront.c
index 429c7b97..0b4c5fdd 100644
--- a/plat/xen/drivers/9p/9pfront.c
+++ b/plat/xen/drivers/9p/9pfront.c
@@ -32,6 +32,7 @@
  * THIS HEADER MAY NOT BE EXTRACTED OR MODIFIED IN ANY WAY.
  */
 
+#include <stdlib.h>
 #include <stdbool.h>
 #include <stdio.h>
 #include <uk/config.h>
diff --git a/plat/xen/drivers/blk/blkfront_xs.c b/plat/xen/drivers/blk/blkfront_xs.c
index f10ca66a..d311e33e 100644
--- a/plat/xen/drivers/blk/blkfront_xs.c
+++ b/plat/xen/drivers/blk/blkfront_xs.c
@@ -33,6 +33,7 @@
  * THIS HEADER MAY NOT BE EXTRACTED OR MODIFIED IN ANY WAY.
  */
 #define _GNU_SOURCE /* for asprintf() */
+#include <stdlib.h>
 #include <inttypes.h>
 #include <stdio.h>
 #include <string.h>
diff --git a/plat/xen/xenbus/xs_comms.c b/plat/xen/xenbus/xs_comms.c
index 5c393c1e..953a4eba 100644
--- a/plat/xen/xenbus/xs_comms.c
+++ b/plat/xen/xenbus/xs_comms.c
@@ -40,6 +40,7 @@
  * Ported from Mini-OS xenbus.c
  */
 
+#include <stdlib.h>
 #include <string.h>
 #include <uk/errptr.h>
 #include <uk/bitmap.h>
-- 
2.20.1


From minios-devel-bounces@lists.xenproject.org Mon Dec 14 20:24:21 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Mon, 14 Dec 2020 20:24:21 +0000
Received: from list by lists.xenproject.org with outflank-mailman.52687.91970 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1kouOL-0007dH-H6; Mon, 14 Dec 2020 20:24:21 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 52687.91970; Mon, 14 Dec 2020 20:24:21 +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 1kouOL-0007dA-Dg; Mon, 14 Dec 2020 20:24:21 +0000
Received: by outflank-mailman (input) for mailman id 52687;
 Mon, 14 Dec 2020 20:24: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=Q9L2=FS=neclab.eu=simon.kuenzer@srs-us1.protection.inumbo.net>)
 id 1kouOJ-0007cn-GK
 for minios-devel@lists.xen.org; Mon, 14 Dec 2020 20:24:19 +0000
Received: from mailer2.neclab.eu (unknown [195.37.70.41])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 151cea7e-a5fe-4ee2-a23b-7f3fa8b3e0ca;
 Mon, 14 Dec 2020 20:24:17 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
 by mailer2.neclab.eu (Postfix) with ESMTP id ACC9EF22C3;
 Mon, 14 Dec 2020 21:24:16 +0100 (CET)
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 RD-47psk2tdx; Mon, 14 Dec 2020 21:24:16 +0100 (CET)
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 7F802F22A5
 for <minios-devel@lists.xen.org>; Mon, 14 Dec 2020 21:24:14 +0100 (CET)
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; Mon, 14 Dec
 2020 21:24:12 +0100
X-BeenThere: minios-devel@lists.xenproject.org
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
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: 151cea7e-a5fe-4ee2-a23b-7f3fa8b3e0ca
X-Virus-Scanned: Amavisd on Debian GNU/Linux (atlas-b.office.hd)
X-ENC: Last-Hop-TLS-encrypted
X-ENC: Last-Hop-TLS-encrypted
From: Simon Kuenzer <simon.kuenzer@neclab.eu>
To: <minios-devel@lists.xen.org>
CC: Simon Kuenzer <simon.kuenzer@neclab.eu>
Subject: [UNIKRAFT PATCH 3/4] lib/uksched: Thread creation callbacks
Date: Mon, 14 Dec 2020 21:23:57 +0100
Message-ID: <20201214202358.11571-4-simon.kuenzer@neclab.eu>
X-Mailer: git-send-email 2.20.1
In-Reply-To: <20201214202358.11571-1-simon.kuenzer@neclab.eu>
References: <20201214202358.11571-1-simon.kuenzer@neclab.eu>
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)

Introduces the ability for libraries to hook into thread creation and
deletion process at `lib/uksched`. Main intended usage are libc's
(like newlibc, musl) that can initialize TLS for each thread, even
when a thread is created/deleted through the uksched API.

Signed-off-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
---
 lib/uksched/Makefile.uk         |  1 +
 lib/uksched/extra.ld            | 29 +++++++++++++++
 lib/uksched/include/uk/thread.h | 38 ++++++++++++++++++++
 lib/uksched/thread.c            | 63 +++++++++++++++++++++++++++++++--
 4 files changed, 129 insertions(+), 2 deletions(-)
 create mode 100644 lib/uksched/extra.ld

diff --git a/lib/uksched/Makefile.uk b/lib/uksched/Makefile.uk
index 229d847b..f22a08b8 100644
--- a/lib/uksched/Makefile.uk
+++ b/lib/uksched/Makefile.uk
@@ -6,3 +6,4 @@ CXXINCLUDES-$(CONFIG_LIBUKSCHED)   += -I$(LIBUKSCHED_BASE)/include
 LIBUKSCHED_SRCS-y += $(LIBUKSCHED_BASE)/sched.c
 LIBUKSCHED_SRCS-y += $(LIBUKSCHED_BASE)/thread.c
 LIBUKSCHED_SRCS-y += $(LIBUKSCHED_BASE)/thread_attr.c
+LIBUKSCHED_SRCS-y += $(LIBUKSCHED_BASE)/extra.ld
diff --git a/lib/uksched/extra.ld b/lib/uksched/extra.ld
new file mode 100644
index 00000000..ba659d26
--- /dev/null
+++ b/lib/uksched/extra.ld
@@ -0,0 +1,29 @@
+SECTIONS
+{
+	.uk_thread_inittab : {
+		. = ALIGN(0x8);
+		PROVIDE(_uk_thread_inittab_start = .);
+		KEEP (*(.uk_thread_inittab0))
+		KEEP (*(.uk_thread_inittab0.*))
+		KEEP (*(.uk_thread_inittab1))
+		KEEP (*(.uk_thread_inittab1.*))
+		KEEP (*(.uk_thread_inittab2))
+		KEEP (*(.uk_thread_inittab2.*))
+		KEEP (*(.uk_thread_inittab3))
+		KEEP (*(.uk_thread_inittab3.*))
+		KEEP (*(.uk_thread_inittab4))
+		KEEP (*(.uk_thread_inittab4.*))
+		KEEP (*(.uk_thread_inittab5))
+		KEEP (*(.uk_thread_inittab5.*))
+		KEEP (*(.uk_thread_inittab6))
+		KEEP (*(.uk_thread_inittab6.*))
+		KEEP (*(.uk_thread_inittab7))
+		KEEP (*(.uk_thread_inittab7.*))
+		KEEP (*(.uk_thread_inittab8))
+		KEEP (*(.uk_thread_inittab8.*))
+		KEEP (*(.uk_thread_inittab9))
+		KEEP (*(.uk_thread_inittab9.*))
+		PROVIDE(_uk_thread_inittab_end = .);
+	}
+}
+INSERT AFTER .text;
diff --git a/lib/uksched/include/uk/thread.h b/lib/uksched/include/uk/thread.h
index 15490517..04173d5c 100644
--- a/lib/uksched/include/uk/thread.h
+++ b/lib/uksched/include/uk/thread.h
@@ -40,6 +40,7 @@
 #include <uk/thread_attr.h>
 #include <uk/wait_types.h>
 #include <uk/list.h>
+#include <uk/prio.h>
 #include <uk/essentials.h>
 
 #ifdef __cplusplus
@@ -59,6 +60,8 @@ struct uk_thread {
 	bool detached;
 	struct uk_waitq waiting_threads;
 	struct uk_sched *sched;
+	void (*entry)(void *);
+	void *arg;
 	void *prv;
 #ifdef CONFIG_LIBNEWLIBC
 	struct _reent reent;
@@ -121,6 +124,41 @@ void uk_thread_block_timeout(struct uk_thread *thread, __nsec nsec);
 void uk_thread_block(struct uk_thread *thread);
 void uk_thread_wake(struct uk_thread *thread);
 
+/**
+ * Registers a thread initialization function that is
+ * called during thread creation
+ *
+ * @param fn
+ *   initialization function to be called (uk_thread_init_func_t)
+ * @param prio
+ *   Priority level (0 (earliest) to 9 (latest))
+ *   Use the UK_PRIO_AFTER() helper macro for computing priority dependencies.
+ *   Note: Any other value for level will be ignored
+ */
+typedef int  (*uk_thread_init_func_t)(struct uk_thread *thread);
+typedef void (*uk_thread_fini_func_t)(struct uk_thread *thread);
+struct uk_thread_inittab_entry {
+	uk_thread_init_func_t init;
+	uk_thread_fini_func_t fini;
+};
+
+#define __UK_THREAD_INITTAB_ENTRY(init_fn, fini_fn, prio)		\
+	static const struct uk_thread_inittab_entry			\
+	__used __section(".uk_thread_inittab" # prio) __align(8)	\
+		__uk_thread_inittab ## prio ## _ ## entry = {		\
+		.init = (init_fn),					\
+		.fini = (fini_fn)					\
+	}
+
+#define _UK_THREAD_INITTAB_ENTRY(init_fn, fini_fn, prio)		\
+	__UK_THREAD_INITTAB_ENTRY(init_fn, fini_fn, prio)
+
+#define UK_THREAD_INIT_PRIO(init_fn, fini_fn, prio)			\
+	_UK_THREAD_INITTAB_ENTRY(init_fn, fini_fn, prio)
+
+#define UK_THREAD_INIT(init_fn, fini_fn)				\
+	_UK_THREAD_INITTAB_ENTRY(init_fn, fini_fn, UK_PRIO_LATEST)
+
 #ifdef __cplusplus
 }
 #endif
diff --git a/lib/uksched/thread.c b/lib/uksched/thread.c
index 909e242f..c85a70f1 100644
--- a/lib/uksched/thread.c
+++ b/lib/uksched/thread.c
@@ -88,6 +88,25 @@ struct _reent *__getreent(void)
 }
 #endif /* CONFIG_LIBNEWLIBC */
 
+extern const struct uk_thread_inittab_entry _uk_thread_inittab_start[];
+extern const struct uk_thread_inittab_entry _uk_thread_inittab_end;
+
+#define uk_thread_inittab_foreach(itr)					\
+	for ((itr) = DECONST(struct uk_thread_inittab_entry*,		\
+			     _uk_thread_inittab_start);			\
+	     (itr) < &(_uk_thread_inittab_end);				\
+	     (itr)++)
+
+#define uk_thread_inittab_foreach_reverse2(itr, start)			\
+	for ((itr) = (start);						\
+	     (itr) >= _uk_thread_inittab_start;				\
+	     (itr)--)
+
+#define uk_thread_inittab_foreach_reverse(itr)				\
+	uk_thread_inittab_foreach_reverse2((itr),			\
+			(DECONST(struct uk_thread_inittab_entry*,	\
+				 (&_uk_thread_inittab_end))) - 1)
+
 int uk_thread_init(struct uk_thread *thread,
 		struct ukplat_ctx_callbacks *cbs, struct uk_alloc *allocator,
 		const char *name, void *stack, void *tls,
@@ -96,6 +115,7 @@ int uk_thread_init(struct uk_thread *thread,
 	unsigned long sp;
 	void *ctx;
 	int ret = 0;
+	struct uk_thread_inittab_entry *itr;
 
 	UK_ASSERT(thread != NULL);
 	UK_ASSERT(stack != NULL);
@@ -104,8 +124,6 @@ int uk_thread_init(struct uk_thread *thread,
 	/* Save pointer to the thread on the stack to get current thread */
 	*((unsigned long *) stack) = (unsigned long) thread;
 
-	init_sp(&sp, stack, function, arg);
-
 	/* Allocate thread context */
 	ctx = uk_zalloc(allocator, ukplat_thread_ctx_size(cbs));
 	if (!ctx) {
@@ -118,6 +136,8 @@ int uk_thread_init(struct uk_thread *thread,
 	thread->name = name;
 	thread->stack = stack;
 	thread->tls = tls;
+	thread->entry = function;
+	thread->arg = arg;
 
 	/* Not runnable, not exited, not sleeping */
 	thread->flags = 0;
@@ -127,10 +147,32 @@ int uk_thread_init(struct uk_thread *thread,
 	thread->sched = NULL;
 	thread->prv = NULL;
 
+	/* TODO: Move newlibc reent initialization to newlib as
+	 *       thread initialization function
+	 */
 #ifdef CONFIG_LIBNEWLIBC
 	reent_init(&thread->reent);
 #endif
 
+	/* Iterate over registered thread initialization functions */
+	uk_thread_inittab_foreach(itr) {
+		if (unlikely(!itr->init))
+			continue;
+
+		uk_pr_debug("New thread %p: Call thread initialization function %p...\n",
+			    thread, *itr->init);
+		ret = (itr->init)(thread);
+		if (ret < 0)
+			goto err_fini;
+	}
+
+	/* Prepare stack and TLS
+	 * NOTE: In case the function pointer was changed by a thread init
+	 *       function (e.g., encapsulation), we prepare the stack here
+	 *       with the final setup
+	 */
+	init_sp(&sp, stack, thread->entry, thread->arg);
+
 	/* Platform specific context initialization */
 	ukplat_thread_ctx_init(cbs, thread->ctx, sp,
 			       (uintptr_t) ukarch_tls_pointer(tls));
@@ -140,14 +182,31 @@ int uk_thread_init(struct uk_thread *thread,
 
 	return 0;
 
+err_fini:
+	/* Run fini functions starting from one level before the failed one
+	 * because we expect that the failed one cleaned up.
+	 */
+	uk_thread_inittab_foreach_reverse2(itr, itr - 2) {
+		if (unlikely(!itr->fini))
+			continue;
+		(itr->fini)(thread);
+	}
+	uk_free(allocator, thread->ctx);
 err_out:
 	return ret;
 }
 
 void uk_thread_fini(struct uk_thread *thread, struct uk_alloc *allocator)
 {
+	struct uk_thread_inittab_entry *itr;
+
 	UK_ASSERT(thread != NULL);
 
+	uk_thread_inittab_foreach_reverse(itr) {
+		if (unlikely(!itr->fini))
+			continue;
+		(itr->fini)(thread);
+	}
 	uk_free(allocator, thread->ctx);
 	thread->ctx = NULL;
 }
-- 
2.20.1


From minios-devel-bounces@lists.xenproject.org Mon Dec 14 20:24:22 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Mon, 14 Dec 2020 20:24:22 +0000
Received: from list by lists.xenproject.org with outflank-mailman.52688.91974 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1kouOM-0007e0-Iq; Mon, 14 Dec 2020 20:24:22 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 52688.91974; Mon, 14 Dec 2020 20:24: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 1kouOM-0007dt-FT; Mon, 14 Dec 2020 20:24:22 +0000
Received: by outflank-mailman (input) for mailman id 52688;
 Mon, 14 Dec 2020 20:24: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=Q9L2=FS=neclab.eu=simon.kuenzer@srs-us1.protection.inumbo.net>)
 id 1kouOK-0007bq-I2
 for minios-devel@lists.xen.org; Mon, 14 Dec 2020 20:24:20 +0000
Received: from mailer2.neclab.eu (unknown [195.37.70.41])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 928d70ab-de25-45bb-bcc3-3fee94ac60ac;
 Mon, 14 Dec 2020 20:24:15 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
 by mailer2.neclab.eu (Postfix) with ESMTP id 9CDDAF22C5;
 Mon, 14 Dec 2020 21:24:14 +0100 (CET)
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 PCNNkhZsw6WW; Mon, 14 Dec 2020 21:24:14 +0100 (CET)
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 6E2ADF22A5
 for <minios-devel@lists.xen.org>; Mon, 14 Dec 2020 21:24:12 +0100 (CET)
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; Mon, 14 Dec
 2020 21:24:11 +0100
X-BeenThere: minios-devel@lists.xenproject.org
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
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: 928d70ab-de25-45bb-bcc3-3fee94ac60ac
X-Virus-Scanned: Amavisd on Debian GNU/Linux (atlas-b.office.hd)
X-ENC: Last-Hop-TLS-encrypted
X-ENC: Last-Hop-TLS-encrypted
From: Simon Kuenzer <simon.kuenzer@neclab.eu>
To: <minios-devel@lists.xen.org>
CC: Simon Kuenzer <simon.kuenzer@neclab.eu>
Subject: [UNIKRAFT PATCH 2/4] include/: No dependency to `lib/ukalloc` for thread contexts
Date: Mon, 14 Dec 2020 21:23:56 +0100
Message-ID: <20201214202358.11571-3-simon.kuenzer@neclab.eu>
X-Mailer: git-send-email 2.20.1
In-Reply-To: <20201214202358.11571-1-simon.kuenzer@neclab.eu>
References: <20201214202358.11571-1-simon.kuenzer@neclab.eu>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
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)

Changes the platform API in a way so that there is no dependency to
`ukalloc` for context creation. An API function is added to query the
allocation size for a thread context. Another API function is added to
call the platform-specific thread context initialization.

Signed-off-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
---
 include/uk/plat/thread.h        | 33 ++++++++++++++++++------------
 lib/uksched/include/uk/thread.h |  1 +
 lib/uksched/thread.c            | 26 ++++++++++++++++++------
 plat/common/sw_ctx.c            | 36 ++++++++++++++++-----------------
 4 files changed, 58 insertions(+), 38 deletions(-)

diff --git a/include/uk/plat/thread.h b/include/uk/plat/thread.h
index 8f3b0cea..16cfdb5a 100644
--- a/include/uk/plat/thread.h
+++ b/include/uk/plat/thread.h
@@ -48,19 +48,20 @@ enum ukplat_ctx_type {
 	ukplat_ctx_sw,
 };
 
-struct uk_alloc;
-
-typedef void *(*ukplat_ctx_create_func_t)
-		(struct uk_alloc *allocator, unsigned long sp,
-		 unsigned long tlsp);
+typedef __sz  (*ukplat_ctx_size_func_t)
+		(void);
+typedef void  (*ukplat_ctx_init_func_t)
+		(void *ctx, unsigned long sp, unsigned long tlsp);
 typedef void  (*ukplat_ctx_start_func_t)
 		(void *ctx);
 typedef void  (*ukplat_ctx_switch_func_t)
 		(void *prevctx, void *nextctx);
 
 struct ukplat_ctx_callbacks {
-	/* callback for creating thread context */
-	ukplat_ctx_create_func_t create_cb;
+	/* callback for returning the needed size for a thread context */
+	ukplat_ctx_size_func_t size_cb;
+	/* callback for initializing a new thread context */
+	ukplat_ctx_init_func_t init_cb;
 	/* callback for starting thread context */
 	ukplat_ctx_start_func_t start_cb __noreturn;
 	/* callback for switching contexts */
@@ -72,17 +73,23 @@ int ukplat_ctx_callbacks_init(struct ukplat_ctx_callbacks *ctx_cbs,
 
 
 static inline
-void *ukplat_thread_ctx_create(struct ukplat_ctx_callbacks *cbs,
-		struct uk_alloc *allocator, unsigned long sp,
-		unsigned long tlsp)
+__sz ukplat_thread_ctx_size(struct ukplat_ctx_callbacks *cbs)
 {
 	UK_ASSERT(cbs != __NULL);
-	UK_ASSERT(allocator != __NULL);
 
-	return cbs->create_cb(allocator, sp, tlsp);
+	return cbs->size_cb();
 }
 
-void ukplat_thread_ctx_destroy(struct uk_alloc *allocator, void *ctx);
+static inline
+void ukplat_thread_ctx_init(struct ukplat_ctx_callbacks *cbs,
+			    void *ctx,
+			    unsigned long sp, unsigned long tlsp)
+{
+	UK_ASSERT(cbs != __NULL);
+	UK_ASSERT(ctx != __NULL);
+
+	return cbs->init_cb(ctx, sp, tlsp);
+}
 
 static inline
 void ukplat_thread_ctx_start(struct ukplat_ctx_callbacks *cbs,
diff --git a/lib/uksched/include/uk/thread.h b/lib/uksched/include/uk/thread.h
index d8a4ac88..15490517 100644
--- a/lib/uksched/include/uk/thread.h
+++ b/lib/uksched/include/uk/thread.h
@@ -33,6 +33,7 @@
 #ifdef CONFIG_LIBNEWLIBC
 #include <sys/reent.h>
 #endif
+#include <uk/alloc.h>
 #include <uk/arch/lcpu.h>
 #include <uk/arch/time.h>
 #include <uk/plat/thread.h>
diff --git a/lib/uksched/thread.c b/lib/uksched/thread.c
index f8ae786c..909e242f 100644
--- a/lib/uksched/thread.c
+++ b/lib/uksched/thread.c
@@ -94,6 +94,8 @@ int uk_thread_init(struct uk_thread *thread,
 		void (*function)(void *), void *arg)
 {
 	unsigned long sp;
+	void *ctx;
+	int ret = 0;
 
 	UK_ASSERT(thread != NULL);
 	UK_ASSERT(stack != NULL);
@@ -104,12 +106,15 @@ int uk_thread_init(struct uk_thread *thread,
 
 	init_sp(&sp, stack, function, arg);
 
-	/* Call platform specific setup. */
-	thread->ctx = ukplat_thread_ctx_create(cbs, allocator, sp,
-			(uintptr_t)ukarch_tls_pointer(tls));
-	if (thread->ctx == NULL)
-		return -1;
+	/* Allocate thread context */
+	ctx = uk_zalloc(allocator, ukplat_thread_ctx_size(cbs));
+	if (!ctx) {
+		ret = -1;
+		goto err_out;
+	}
 
+	memset(thread, 0, sizeof(*thread));
+	thread->ctx = ctx;
 	thread->name = name;
 	thread->stack = stack;
 	thread->tls = tls;
@@ -126,16 +131,25 @@ int uk_thread_init(struct uk_thread *thread,
 	reent_init(&thread->reent);
 #endif
 
+	/* Platform specific context initialization */
+	ukplat_thread_ctx_init(cbs, thread->ctx, sp,
+			       (uintptr_t) ukarch_tls_pointer(tls));
+
 	uk_pr_info("Thread \"%s\": pointer: %p, stack: %p, tls: %p\n",
 		   name, thread, thread->stack, thread->tls);
 
 	return 0;
+
+err_out:
+	return ret;
 }
 
 void uk_thread_fini(struct uk_thread *thread, struct uk_alloc *allocator)
 {
 	UK_ASSERT(thread != NULL);
-	ukplat_thread_ctx_destroy(allocator, thread->ctx);
+
+	uk_free(allocator, thread->ctx);
+	thread->ctx = NULL;
 }
 
 static void uk_thread_block_until(struct uk_thread *thread, __snsec until)
diff --git a/plat/common/sw_ctx.c b/plat/common/sw_ctx.c
index 482e99e6..b941caeb 100644
--- a/plat/common/sw_ctx.c
+++ b/plat/common/sw_ctx.c
@@ -40,8 +40,8 @@
 #include <uk/plat/common/tls.h>
 #include <uk/plat/common/cpu.h>
 
-static void *sw_ctx_create(struct uk_alloc *allocator, unsigned long sp,
-				unsigned long tlsp);
+static size_t sw_ctx_size(void);
+static void  sw_ctx_init(void *ctx, unsigned long sp, unsigned long tlsp);
 static void  sw_ctx_start(void *ctx) __noreturn;
 static void  sw_ctx_switch(void *prevctx, void *nextctx);
 
@@ -51,27 +51,24 @@ static void  sw_ctx_switch(void *prevctx, void *nextctx);
  */
 extern void asm_thread_starter(void);
 
-static void *sw_ctx_create(struct uk_alloc *allocator, unsigned long sp,
-				unsigned long tlsp)
+static size_t sw_ctx_size(void)
 {
-	struct sw_ctx *ctx;
-
-	UK_ASSERT(allocator != NULL);
+	return sizeof(struct sw_ctx);
+}
 
-	ctx = arch_alloc_sw_ctx(allocator);
-	if (ctx == NULL) {
-		uk_pr_warn("Error allocating software context.");
-		return NULL;
-	}
+static void sw_ctx_init(void *ctx,
+			unsigned long sp, unsigned long tlsp)
+{
+	struct sw_ctx *sw_ctx = ctx;
 
-	ctx->sp = sp;
-	ctx->tlsp = tlsp;
-	ctx->ip = (unsigned long) asm_thread_starter;
-	arch_init_extregs(ctx);
+	UK_ASSERT(sw_ctx != NULL);
 
-	save_extregs(ctx);
+	sw_ctx->sp   = sp;
+	sw_ctx->tlsp = tlsp;
+	sw_ctx->ip   = (unsigned long) asm_thread_starter;
+	arch_init_extregs(sw_ctx);
 
-	return ctx;
+	save_extregs(sw_ctx);
 }
 
 extern void asm_ctx_start(unsigned long sp, unsigned long ip) __noreturn;
@@ -105,7 +102,8 @@ static void sw_ctx_switch(void *prevctx, void *nextctx)
 void sw_ctx_callbacks_init(struct ukplat_ctx_callbacks *ctx_cbs)
 {
 	UK_ASSERT(ctx_cbs != NULL);
-	ctx_cbs->create_cb = sw_ctx_create;
+	ctx_cbs->size_cb = sw_ctx_size;
+	ctx_cbs->init_cb = sw_ctx_init;
 	ctx_cbs->start_cb = sw_ctx_start;
 	ctx_cbs->switch_cb = sw_ctx_switch;
 }
-- 
2.20.1


From minios-devel-bounces@lists.xenproject.org Mon Dec 14 20:24:23 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Mon, 14 Dec 2020 20:24:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.52689.91977 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1kouON-0007eo-Kx; Mon, 14 Dec 2020 20:24:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 52689.91977; Mon, 14 Dec 2020 20:24: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 1kouON-0007eg-Hv; Mon, 14 Dec 2020 20:24:23 +0000
Received: by outflank-mailman (input) for mailman id 52689;
 Mon, 14 Dec 2020 20:24: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=Q9L2=FS=neclab.eu=simon.kuenzer@srs-us1.protection.inumbo.net>)
 id 1kouOL-0007cn-JC
 for minios-devel@lists.xen.org; Mon, 14 Dec 2020 20:24:21 +0000
Received: from mailer2.neclab.eu (unknown [195.37.70.41])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id d08c0ecc-369a-4fc1-9bdb-272972d37681;
 Mon, 14 Dec 2020 20:24:19 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
 by mailer2.neclab.eu (Postfix) with ESMTP id C2582F22C5;
 Mon, 14 Dec 2020 21:24:18 +0100 (CET)
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 sCix1ntsgESu; Mon, 14 Dec 2020 21:24:18 +0100 (CET)
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 8F473F22A5
 for <minios-devel@lists.xen.org>; Mon, 14 Dec 2020 21:24:16 +0100 (CET)
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; Mon, 14 Dec
 2020 21:24:14 +0100
X-BeenThere: minios-devel@lists.xenproject.org
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
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: d08c0ecc-369a-4fc1-9bdb-272972d37681
X-Virus-Scanned: Amavisd on Debian GNU/Linux (atlas-b.office.hd)
X-ENC: Last-Hop-TLS-encrypted
X-ENC: Last-Hop-TLS-encrypted
From: Simon Kuenzer <simon.kuenzer@neclab.eu>
To: <minios-devel@lists.xen.org>
CC: Simon Kuenzer <simon.kuenzer@neclab.eu>
Subject: [UNIKRAFT PATCH 4/4] lib/ukbus: Increase initialization class to `platform`
Date: Mon, 14 Dec 2020 21:23:58 +0100
Message-ID: <20201214202358.11571-5-simon.kuenzer@neclab.eu>
X-Mailer: git-send-email 2.20.1
In-Reply-To: <20201214202358.11571-1-simon.kuenzer@neclab.eu>
References: <20201214202358.11571-1-simon.kuenzer@neclab.eu>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Content-Type: text/plain
X-Originating-IP: [192.168.24.96]
X-ClientProxiedBy: oberon.office.hd (192.168.24.90) To puck.office.hd
 (192.168.24.91)

Since buses can have dependencies to other basic libraries and require
their early initialization to be called before (e.g, in order create
threads (XenStore), a potentially used threading API library needs to
be initialized before), we make sure that `UK_INIT_CLASS_EARLY` is
reserved for early library initialization. We scan for devices at the
intended stage `UK_INIT_CLASS_PLAT`.

Signed-off-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
---
 lib/ukbus/include/uk/bus.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/ukbus/include/uk/bus.h b/lib/ukbus/include/uk/bus.h
index fcb68421..c76bccc9 100644
--- a/lib/ukbus/include/uk/bus.h
+++ b/lib/ukbus/include/uk/bus.h
@@ -44,7 +44,7 @@
 extern "C" {
 #endif
 
-#define UK_BUS_INIT_CLASS UK_INIT_CLASS_EARLY
+#define UK_BUS_INIT_CLASS UK_INIT_CLASS_PLAT
 #define UK_BUS_INIT_PRIO  0
 #define UK_BUS_REGISTER_PRIO 0
 
-- 
2.20.1


From minios-devel-bounces@lists.xenproject.org Tue Dec 15 08:19:36 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Tue, 15 Dec 2020 08:19:36 +0000
Received: from list by lists.xenproject.org with outflank-mailman.52962.92417 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1kp5YU-000620-Ci; Tue, 15 Dec 2020 08:19:34 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 52962.92417; Tue, 15 Dec 2020 08:19: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 1kp5YU-00061t-9b; Tue, 15 Dec 2020 08:19:34 +0000
Received: by outflank-mailman (input) for mailman id 52962;
 Tue, 15 Dec 2020 08:19: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=mgel=FT=neclab.eu=simon.kuenzer@srs-us1.protection.inumbo.net>)
 id 1kp5YS-00061o-6N
 for minios-devel@lists.xen.org; Tue, 15 Dec 2020 08:19:32 +0000
Received: from mailer1.neclab.eu (unknown [195.37.70.40])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id c6f32f0b-6747-4729-ab22-5422629c945e;
 Tue, 15 Dec 2020 08:19:30 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
 by mailer1.neclab.eu (Postfix) with ESMTP id 1CF15103987;
 Tue, 15 Dec 2020 09:19:29 +0100 (CET)
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 6rP209BrNwYz; Tue, 15 Dec 2020 09:19:29 +0100 (CET)
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 E24161003F1
 for <minios-devel@lists.xen.org>; Tue, 15 Dec 2020 09:19:28 +0100 (CET)
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; Tue, 15 Dec
 2020 09:19:28 +0100
X-BeenThere: minios-devel@lists.xenproject.org
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
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: c6f32f0b-6747-4729-ab22-5422629c945e
X-Virus-Scanned: Amavisd on Debian GNU/Linux (atlas-a.office.hd)
X-ENC: Last-Hop-TLS-encrypted
X-ENC: Last-Hop-TLS-encrypted
From: Simon Kuenzer <simon.kuenzer@neclab.eu>
To: <minios-devel@lists.xen.org>
CC: Simon Kuenzer <simon.kuenzer@neclab.eu>
Subject: [UNIKRAFT/LIBPTHREAD-EMBEDDED PATCH 0/3] `uksched` thread creation callbacks
Date: Tue, 15 Dec 2020 09:19:10 +0100
Message-ID: <20201215081913.23823-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: puck.office.hd (192.168.24.91) To puck.office.hd
 (192.168.24.91)

Utilizes `uksched` callback mechanism to create and delete pthread-embedded
meta data for threads. This enables using pthread-embedded API calls on
threads that were created with the native `uksched` API.

Simon Kuenzer (3):
  Register meta data on `uksched` thread creation callbacks
  Initialize pthread-embedded as early as possible
  No warning when assigning thread starters

 Makefile.uk |   3 ++
 pte_osal.c  | 149 +++++++++++++++++++++++++++++++++++++++++++++-------
 2 files changed, 132 insertions(+), 20 deletions(-)

-- 
2.20.1


From minios-devel-bounces@lists.xenproject.org Tue Dec 15 08:19:39 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Tue, 15 Dec 2020 08:19:39 +0000
Received: from list by lists.xenproject.org with outflank-mailman.52963.92421 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1kp5YZ-00062l-E7; Tue, 15 Dec 2020 08:19:39 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 52963.92421; Tue, 15 Dec 2020 08:19: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 1kp5YZ-00062e-B7; Tue, 15 Dec 2020 08:19:39 +0000
Received: by outflank-mailman (input) for mailman id 52963;
 Tue, 15 Dec 2020 08:19:37 +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=mgel=FT=neclab.eu=simon.kuenzer@srs-us1.protection.inumbo.net>)
 id 1kp5YX-00061o-54
 for minios-devel@lists.xen.org; Tue, 15 Dec 2020 08:19:37 +0000
Received: from mailer2.neclab.eu (unknown [195.37.70.41])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id b834509f-4ead-4917-8a17-aafd6fc6baff;
 Tue, 15 Dec 2020 08:19:33 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
 by mailer2.neclab.eu (Postfix) with ESMTP id 48922F2413;
 Tue, 15 Dec 2020 09:19:32 +0100 (CET)
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 X5p8ZDS8bgRl; Tue, 15 Dec 2020 09:19:32 +0100 (CET)
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 24216F2412
 for <minios-devel@lists.xen.org>; Tue, 15 Dec 2020 09:19:30 +0100 (CET)
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; Tue, 15 Dec
 2020 09:19:29 +0100
X-BeenThere: minios-devel@lists.xenproject.org
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
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: b834509f-4ead-4917-8a17-aafd6fc6baff
X-Virus-Scanned: Amavisd on Debian GNU/Linux (atlas-b.office.hd)
X-ENC: Last-Hop-TLS-encrypted
X-ENC: Last-Hop-TLS-encrypted
From: Simon Kuenzer <simon.kuenzer@neclab.eu>
To: <minios-devel@lists.xen.org>
CC: Simon Kuenzer <simon.kuenzer@neclab.eu>
Subject: [UNIKRAFT/LIBPTHREAD-EMBEDDED PATCH 1/3] Register meta data on `uksched` thread creation callbacks
Date: Tue, 15 Dec 2020 09:19:11 +0100
Message-ID: <20201215081913.23823-2-simon.kuenzer@neclab.eu>
X-Mailer: git-send-email 2.20.1
In-Reply-To: <20201215081913.23823-1-simon.kuenzer@neclab.eu>
References: <20201215081913.23823-1-simon.kuenzer@neclab.eu>
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)

Utilizes `uksched` callback mechanism to create and delete pthread-embedded
meta data for threads. This enables using pthread-embedded API calls on
threads that were created with the native `uksched` API.

Signed-off-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
---
 pte_osal.c | 147 ++++++++++++++++++++++++++++++++++++++++++++++-------
 1 file changed, 128 insertions(+), 19 deletions(-)

diff --git a/pte_osal.c b/pte_osal.c
index 640c3e4..6b4ebd7 100644
--- a/pte_osal.c
+++ b/pte_osal.c
@@ -25,6 +25,7 @@
 
 #include <string.h>
 #include <stdlib.h>
+#include <stdbool.h>
 #include <uk/essentials.h>
 #include <uk/init.h>
 #include <uk/arch/time.h>
@@ -60,10 +61,18 @@ typedef struct {
  *
  ***************************************************************************/
 
+static bool initialized /* false */;
+
 static int pthread_initcall(void)
 {
+	int result;
+
 	uk_pr_debug("Initialize pthread-embedded\n");
-	return pthread_init();
+	result = pthread_init();
+
+	if (result == PTE_TRUE)
+		initialized = true;
+	return result;
 }
 uk_lib_initcall(pthread_initcall);
 
@@ -129,46 +138,146 @@ static void uk_stub_thread_entry(void *argv)
 	ptd->entry_point(ptd->argv);
 }
 
+/* NOTE: We need to be able to distinguish if we created a thread through
+ *       pthread API or through uksched API. In case of pthread_create()
+ *       we have to setup some different properties to the thread like creating
+ *       it in paused state.
+ *       In order to distinguish, we will use a magic number as entry function.
+ *       With the thread argument we forward the actual entry point and argument
+ *       vector. During creation our init callback will be executed by uksched
+ *       and we are able to check if we find our magic number again and handle
+ *       the initialization accordingly.
+ */
+
+/* Use a pointer that points to itself as magic number. This way we can be
+ * sure that the magic number (= pointer address) is unique and reserved
+ * for our purpose.
+ */
+static const void *PTE_CAPSULE_MAGIC = &PTE_CAPSULE_MAGIC;
+struct pte_entry_capsule {
+	pte_osThreadEntryPoint entry_point;
+	void *argv;
+};
+
 pte_osResult pte_osThreadCreate(pte_osThreadEntryPoint entry_point,
 	int stack_size, int initial_prio, void *argv,
 	pte_osThreadHandle *ph)
 {
-	pte_thread_data_t *ptd;
+	struct pte_entry_capsule capsule;
+	struct uk_thread *th;
 
-	ptd = malloc(sizeof(pte_thread_data_t));
-	if (!ptd)
+	capsule.entry_point = entry_point;
+	capsule.argv        = argv;
+
+	/* Create the Unikraft thread. This will cause that
+	 * pte_osInitThread() is called.
+	 */
+	th = uk_thread_create_attr(NULL, NULL,
+				   PTE_CAPSULE_MAGIC, &capsule);
+	if (!th)
 		return PTE_OS_NO_RESOURCES;
 
-	ptd->entry_point = entry_point;
-	ptd->argv = argv;
+	/* pte_osInitThread() should have setup a newly created
+	 * pte_thread_data_t which should be stored on th->prv
+	 */
+	UK_ASSERT(th->prv != NULL);
+
+	/* Return the thread handle */
+	*ph = th;
+	return PTE_OS_OK;
+}
+
+static int pte_osInitThread(struct uk_thread *th)
+{
+	pte_thread_data_t *ptd;
+	struct pte_entry_capsule *capsule;
+
+	/* NOTE: We reserve th->prv for our exclusive use,
+	 *       so it should be NULL when entering here
+	 */
+	UK_ASSERT(th->prv == NULL);
+
+	/* Initialize pte with first thread creation */
+	if (unlikely(!initialized)) {
+		uk_pr_warn("Thread %p created without " STRINGIFY(__LIBNAME__)
+			   " initialized. Utilizing the pthread API from this context may lead to memory leaks.\n",
+			   th);
+		return 0;
+	}
+
+	ptd = calloc(1, sizeof(pte_thread_data_t));
+	if (!ptd)
+		goto err_out;
 
 	/* Allocate TLS structure for this thread. */
 	ptd->tls = pteTlsThreadInit();
 	if (ptd->tls == NULL) {
 		uk_pr_err("Could not allocate TLS\n");
-		free(ptd);
-		return PTE_OS_NO_RESOURCES;
+		goto err_free_ptd;
+	}
+
+	/* How did we enter this function? */
+	if (th->entry == PTE_CAPSULE_MAGIC) {
+		/* This thread got created by pte_osThreadCreate()!
+		 * Lets have a look into the capsule.
+		 */
+		UK_ASSERT(th->arg);
+
+		capsule = (struct pte_entry_capsule *) th->arg;
+
+		ptd->entry_point = capsule->entry_point;
+		ptd->argv        = capsule->argv;
+
+		/* this thread has to wait for further setup */
+		uk_semaphore_init(&ptd->start_sem, 0);
+	} else {
+		/* We will encapsulate our thread entry point,
+		 * we have to move our actual entry to ptd
+		 */
+		ptd->entry_point = (pte_osThreadEntryPoint) th->entry;
+		ptd->argv        = th->arg;
+
+		/* uksched threads need to start automatically */
+		uk_semaphore_init(&ptd->start_sem, 1);
 	}
 
-	uk_semaphore_init(&ptd->start_sem, 0);
+	/* Setup encapsulated entry point */
+	th->entry = uk_stub_thread_entry;
+	th->arg   = ptd;
 	uk_semaphore_init(&ptd->cancel_sem, 0);
 	ptd->done = 0;
 
-	ptd->uk_thread = uk_thread_create_attr(NULL, NULL,
-		uk_stub_thread_entry, ptd);
-	if (ptd->uk_thread == NULL) {
-		pteTlsThreadDestroy(ptd->tls);
-		free(ptd);
-		return PTE_OS_NO_RESOURCES;
-	}
+	/* Store cross references (uk_thread <-> pte_thread_data_t) */
+	th->prv = ptd;
+	ptd->uk_thread = th;
 
-	ptd->uk_thread->prv = ptd;
+	return 0;
 
-	*ph = ptd->uk_thread;
+err_free_ptd:
+	free(ptd);
+err_out:
+	return -1;
+}
 
-	return PTE_OS_OK;
+static void pte_osFiniThread(struct uk_thread *th)
+{
+	pte_thread_data_t *ptd;
+
+	if (!th->prv) {
+		/* It seems that this is a thread that was created before
+		 * this library was initialized. We should not have
+		 * allocated anything for this thread.
+		 */
+		return;
+	}
+
+	ptd = th->prv;
+	pteTlsThreadDestroy(ptd->tls);
+	free(ptd);
 }
 
+UK_THREAD_INIT_PRIO(pte_osInitThread, pte_osFiniThread, UK_PRIO_EARLIEST);
+
 pte_osResult pte_osThreadStart(pte_osThreadHandle h)
 {
 	pte_thread_data_t *ptd = handle_to_ptd(h);
-- 
2.20.1


From minios-devel-bounces@lists.xenproject.org Tue Dec 15 08:19:40 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Tue, 15 Dec 2020 08:19:40 +0000
Received: from list by lists.xenproject.org with outflank-mailman.52964.92425 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1kp5Ya-00063N-G4; Tue, 15 Dec 2020 08:19:40 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 52964.92425; Tue, 15 Dec 2020 08:19: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 1kp5Ya-00063G-Cf; Tue, 15 Dec 2020 08:19:40 +0000
Received: by outflank-mailman (input) for mailman id 52964;
 Tue, 15 Dec 2020 08:19: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=mgel=FT=neclab.eu=simon.kuenzer@srs-us1.protection.inumbo.net>)
 id 1kp5YZ-00062Z-6t
 for minios-devel@lists.xen.org; Tue, 15 Dec 2020 08:19:39 +0000
Received: from mailer2.neclab.eu (unknown [195.37.70.41])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 395480a0-52c5-4804-88c9-472fe5d5fa9b;
 Tue, 15 Dec 2020 08:19:37 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
 by mailer2.neclab.eu (Postfix) with ESMTP id 6A41EF2414;
 Tue, 15 Dec 2020 09:19:36 +0100 (CET)
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 BULHOqwDBP00; Tue, 15 Dec 2020 09:19:36 +0100 (CET)
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 3BF2CF2413
 for <minios-devel@lists.xen.org>; Tue, 15 Dec 2020 09:19:34 +0100 (CET)
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; Tue, 15 Dec
 2020 09:19:31 +0100
X-BeenThere: minios-devel@lists.xenproject.org
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
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: 395480a0-52c5-4804-88c9-472fe5d5fa9b
X-Virus-Scanned: Amavisd on Debian GNU/Linux (atlas-b.office.hd)
X-ENC: Last-Hop-TLS-encrypted
X-ENC: Last-Hop-TLS-encrypted
From: Simon Kuenzer <simon.kuenzer@neclab.eu>
To: <minios-devel@lists.xen.org>
CC: Simon Kuenzer <simon.kuenzer@neclab.eu>
Subject: [UNIKRAFT/LIBPTHREAD-EMBEDDED PATCH 3/3] No warning when assigning thread starters
Date: Tue, 15 Dec 2020 09:19:13 +0100
Message-ID: <20201215081913.23823-4-simon.kuenzer@neclab.eu>
X-Mailer: git-send-email 2.20.1
In-Reply-To: <20201215081913.23823-1-simon.kuenzer@neclab.eu>
References: <20201215081913.23823-1-simon.kuenzer@neclab.eu>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
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)

Suppresses a compiler warning that happens with code that assigns
thread starters.

Signed-off-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
---
 Makefile.uk | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/Makefile.uk b/Makefile.uk
index 4ee37cd..1ab7c6a 100644
--- a/Makefile.uk
+++ b/Makefile.uk
@@ -63,6 +63,9 @@ LIBPTHREAD-EMBEDDED_CXXFLAGS-y += $(LIBPTHREAD-EMBEDDED_SUPPRESS_FLAGS)
 # OS dependencies code - Glue between Unikraft and pthread-embedded
 ################################################################################
 LIBPTHREAD-EMBEDDED_SRCS-y += $(LIBPTHREAD-EMBEDDED_BASE)/pte_osal.c|glue
+LIBPTHREAD-EMBEDDED_PTE_OSAL_GLUE_FLAGS-$(call gcc_version_ge,5,0) += -Wno-incompatible-pointer-types
+LIBPTHREAD-EMBEDDED_PTE_OSAL_GLUE_FLAGS-$(call gcc_version_ge,8,0) += -Wno-cast-function-type
+
 LIBPTHREAD-EMBEDDED_SRCS-y += $(LIBPTHREAD-EMBEDDED_BASE)/attributes.c|glue
 LIBPTHREAD-EMBEDDED_SRCS-y += $(LIBPTHREAD-EMBEDDED_BASE)/pthread_atfork.c|glue
 LIBPTHREAD-EMBEDDED_SRCS-y += $(LIBPTHREAD-EMBEDDED_BASE)/pthread_sigmask.c|glue
-- 
2.20.1


From minios-devel-bounces@lists.xenproject.org Tue Dec 15 08:19:42 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Tue, 15 Dec 2020 08:19:42 +0000
Received: from list by lists.xenproject.org with outflank-mailman.52965.92429 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1kp5Yc-00064L-HG; Tue, 15 Dec 2020 08:19:42 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 52965.92429; Tue, 15 Dec 2020 08:19: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 1kp5Yc-00064E-EH; Tue, 15 Dec 2020 08:19:42 +0000
Received: by outflank-mailman (input) for mailman id 52965;
 Tue, 15 Dec 2020 08:19: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=mgel=FT=neclab.eu=simon.kuenzer@srs-us1.protection.inumbo.net>)
 id 1kp5Yc-00061o-58
 for minios-devel@lists.xen.org; Tue, 15 Dec 2020 08:19:42 +0000
Received: from mailer2.neclab.eu (unknown [195.37.70.41])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id a3276b54-804a-479c-9853-2b2f98e2a8a4;
 Tue, 15 Dec 2020 08:19:35 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
 by mailer2.neclab.eu (Postfix) with ESMTP id 576A2F2413;
 Tue, 15 Dec 2020 09:19:34 +0100 (CET)
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 2X8K7v_3UQKm; Tue, 15 Dec 2020 09:19:34 +0100 (CET)
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 2C37AF2412
 for <minios-devel@lists.xen.org>; Tue, 15 Dec 2020 09:19:32 +0100 (CET)
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; Tue, 15 Dec
 2020 09:19:30 +0100
X-BeenThere: minios-devel@lists.xenproject.org
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
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: a3276b54-804a-479c-9853-2b2f98e2a8a4
X-Virus-Scanned: Amavisd on Debian GNU/Linux (atlas-b.office.hd)
X-ENC: Last-Hop-TLS-encrypted
X-ENC: Last-Hop-TLS-encrypted
From: Simon Kuenzer <simon.kuenzer@neclab.eu>
To: <minios-devel@lists.xen.org>
CC: Simon Kuenzer <simon.kuenzer@neclab.eu>
Subject: [UNIKRAFT/LIBPTHREAD-EMBEDDED PATCH 2/3] Initialize pthread-embedded as early as possible
Date: Tue, 15 Dec 2020 09:19:12 +0100
Message-ID: <20201215081913.23823-3-simon.kuenzer@neclab.eu>
X-Mailer: git-send-email 2.20.1
In-Reply-To: <20201215081913.23823-1-simon.kuenzer@neclab.eu>
References: <20201215081913.23823-1-simon.kuenzer@neclab.eu>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Content-Type: text/plain
X-Originating-IP: [192.168.24.96]
X-ClientProxiedBy: oberon.office.hd (192.168.24.90) To puck.office.hd
 (192.168.24.91)

Because other Unikraft libraries may create threads, we
initialize pthread-embedded within the early init class.

Signed-off-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
---
 pte_osal.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pte_osal.c b/pte_osal.c
index 6b4ebd7..d475e2c 100644
--- a/pte_osal.c
+++ b/pte_osal.c
@@ -74,7 +74,7 @@ static int pthread_initcall(void)
 		initialized = true;
 	return result;
 }
-uk_lib_initcall(pthread_initcall);
+uk_early_initcall_prio(pthread_initcall, UK_PRIO_EARLIEST);
 
 pte_osResult pte_osInit(void)
 {
-- 
2.20.1


From minios-devel-bounces@lists.xenproject.org Tue Dec 15 10:07:47 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Tue, 15 Dec 2020 10:07:47 +0000
Received: from list by lists.xenproject.org with outflank-mailman.53014.92501 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1kp7FA-0007mW-VB; Tue, 15 Dec 2020 10:07:44 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 53014.92501; Tue, 15 Dec 2020 10:07: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 1kp7FA-0007mP-S4; Tue, 15 Dec 2020 10:07:44 +0000
Received: by outflank-mailman (input) for mailman id 53014;
 Tue, 15 Dec 2020 10:07: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=Q16o=FT=neclab.eu=sharan.santhanam@srs-us1.protection.inumbo.net>)
 id 1kp7F9-0007mK-T8
 for minios-devel@lists.xenproject.org; Tue, 15 Dec 2020 10:07:43 +0000
Received: from mailer2.neclab.eu (unknown [195.37.70.41])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id c8d6719b-0479-4a5c-9de4-45e13dbf75ab;
 Tue, 15 Dec 2020 10:07:42 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
 by mailer2.neclab.eu (Postfix) with ESMTP id D129EF2355;
 Tue, 15 Dec 2020 11:07:40 +0100 (CET)
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 BkCKyPa8lvJE; Tue, 15 Dec 2020 11:07:40 +0100 (CET)
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 A0026F22A7;
 Tue, 15 Dec 2020 11:07:32 +0100 (CET)
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, 15 Dec
 2020 11:07:30 +0100
X-BeenThere: minios-devel@lists.xenproject.org
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
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: c8d6719b-0479-4a5c-9de4-45e13dbf75ab
X-Virus-Scanned: Amavisd on Debian GNU/Linux (atlas-b.office.hd)
X-ENC: Last-Hop-TLS-encrypted
X-ENC: Last-Hop-TLS-encrypted
Subject: Re: [Minios-devel] [PATCH] arm/rtc: enable pl031 for arm64.
To: Jianyong Wu <Jianyong.Wu@arm.com>, "minios-devel@lists.xenproject.org"
	<minios-devel@lists.xenproject.org>, "simon.kuenzer@neclab.eu"
	<simon.kuenzer@neclab.eu>
CC: Justin He <Justin.He@arm.com>, Wei Chen <Wei.Chen@arm.com>
References: <20200331095711.44593-1-jianyong.wu@arm.com>
 <b635ae64-5753-09ff-2a2c-5a5f5d4fc336@neclab.eu>
 <HE1PR0802MB25556B8C059409A3D31979B8F4F30@HE1PR0802MB2555.eurprd08.prod.outlook.com>
From: Sharan Santhanam <sharan.santhanam@neclab.eu>
Message-ID: <ad31df04-4d83-2b81-1eed-c34c8655f8b6@neclab.eu>
Date: Tue, 15 Dec 2020 15:37:26 +0530
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: <HE1PR0802MB25556B8C059409A3D31979B8F4F30@HE1PR0802MB2555.eurprd08.prod.outlook.com>
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)

Hello Jianyong,

Please find the comments inline:

Thanks & Regards

Sharan

On 12/2/20 10:38 AM, Jianyong Wu wrote:
> Hi Sharan,
>
> Thanks for your comments.
>
>> -----Original Message-----
>> From: Sharan Santhanam <sharan.santhanam@neclab.eu>
>> Sent: Tuesday, December 1, 2020 12:55 AM
>> To: Jianyong Wu <Jianyong.Wu@arm.com>; minios-
>> devel@lists.xenproject.org; simon.kuenzer@neclab.eu
>> Cc: Justin He <Justin.He@arm.com>; Wei Chen <Wei.Chen@arm.com>
>> Subject: Re: [Minios-devel] [PATCH] arm/rtc: enable pl031 for arm64.
>>
>> Hello Jianyong Wu,
>>
>> Please find the comments inline:
>>
>> Thanks & Regards
>> Sharan
>>
>> On 3/31/20 11:57 AM, Jianyong Wu wrote:
>>> Currently, rtc is not enabled in arm, so wall time can't be provided
>>> currectly.
>>> pl031 is chosen as the rtc device for arm in this patch, but we have
>>> interface extension of capable of plugging other rtc device.
>>>
>>> This patch use the new fdt API of
>> "fdt_node_offset_idx_by_compatible_list"
>>> in Justin's patch in review.
>>>
>>> Signed-off-by: Wei Chen <wei.chen@arm.com>
>>> Signed-off-by: Jianyong Wu <jianyong.wu@arm.com>
>>> ---
>>>    plat/common/arm/time.c         |   2 +
>>>    plat/drivers/include/rtc/rtc.h |  77 ++++++++
>>>    plat/drivers/rtc/pl031.c       | 315
>> +++++++++++++++++++++++++++++++++
>>>    plat/kvm/Config.uk             |   5 +
>>>    plat/kvm/Makefile.uk           |  11 +-
>>>    5 files changed, 409 insertions(+), 1 deletion(-)
>>>    create mode 100644 plat/drivers/include/rtc/rtc.h
>>>    create mode 100644 plat/drivers/rtc/pl031.c
>>>
>>> diff --git a/plat/common/arm/time.c b/plat/common/arm/time.c index
>>> bbb3c72..7560fff 100644
>>> --- a/plat/common/arm/time.c
>>> +++ b/plat/common/arm/time.c
>>> @@ -150,4 +150,6 @@ void ukplat_time_init(void)
>>>
>>>    /* Enable timer */
>>>    generic_timer_enable();
>>> +/* Initialize rtc */
>>> +_dtb_init_rtc(_libkvmplat_cfg.dtb);
>>>    }
>>> diff --git a/plat/drivers/include/rtc/rtc.h
>>> b/plat/drivers/include/rtc/rtc.h new file mode 100644 index
>>> 0000000..4dafb87
>>> --- /dev/null
>>> +++ b/plat/drivers/include/rtc/rtc.h
>>> @@ -0,0 +1,77 @@
>>> +/* SPDX-License-Identifier: BSD-3-Clause */
>>> +/*
>>> + * Authors: Wei Chen <Wei.Chen@arm.com>
>>> + *          Jianyong Wu <Jianyong.Wu@arm.com>
>>> + *
>>> + * Copyright (c) 2019, Arm Ltd. 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.
>> Remove the above line since it is incompatible with the BSD license.
>>
> OK
>
>>> + */
>>> +
>>> +#ifndef __PLAT_KVM_ARM_RTC_H__
>>> +#define __PLAT_KVM_ARM_RTC_H__
>>> +
>>> +struct rtc_time {
>>> +int year;
>>> +int mon;
>>> +int day;
>>> +int hour;
>>> +int min;
>>> +int sec;
>>> +};
>>> +
>>> +struct rtc_ops {
>>> +void (*enable)(int);
>>> +int (*status)(void);
>>> +void (*read)(struct rtc_time *);
>>> +uint32_t (*read_raw)(void);
>>> +void (*write)(struct rtc_time *);
>>> +void (*write_raw)(uint32_t);
>> We should rename it as read_time and the write_time. I am not sure why we
>> need to expose the *_raw as a part of the rtc_ops operation because this is
>> used only for a specific operation.
>>
> OK
>
>> Instead we could read the boot tick with an API function like:
>>
>> uint32_t rtc_boot_tick_get(struct rtc_dev *dev);
>>
> OK
>
>>> +void (*read_alarm)(struct rtc_time *);
>>> +uint32_t (*read_alarm_raw)(void);
>>> +void (*write_alarm)(struct rtc_time *);
>>> +void (*write_alarm_raw)(uint32_t);
>>> +void (*alarm_irq_enable)(int);
>>> +};
>> Why don't these rtc_ops take the rtc_dev as its parameter. It would be
>> difficult to support multiple device.
>>
> OK
>
>>> +
>>> +struct rtc_dev {
>>> +char *name;
>>> +int id;
>>> +const struct rtc_ops *ops;
>>> +};
>>> +
>>> +#ifdef CONFIG_RTC_PL031
>>> +
>>> +#include <stdint.h>
>>> +
>>> +extern uint32_t rtc_boot_seconds;
>>> +
>>> +int _dtb_init_rtc(void *dtb);
>>> +
>>> +#endif
>>> +#endif //__PLAT_KVM_ARM_GICV2_H__
>> s/__PLAT_KVM_ARM_GICV2_H__/__PLAT_KVM_ARM_RTC_H__
>>> diff --git a/plat/drivers/rtc/pl031.c b/plat/drivers/rtc/pl031.c
>>> new file mode 100644
>>> index 0000000..ff24411
>>> --- /dev/null
>>> +++ b/plat/drivers/rtc/pl031.c
>>> @@ -0,0 +1,315 @@
>>> +/* SPDX-License-Identifier: BSD-3-Clause */
>>> +/*
>>> + * Authors: Wei Chen <Wei.Chen@arm.com>
>>> + *          Jianyong Wu <Jianyong.Wu@arm.com>
>>> + *
>>> + * Copyright (c) 2018, Arm Ltd. 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.
>> Remove the above line since it is incompatible with the BSD license.
>>
> OK
>
>>> + */
>>> +#include <string.h>
>>> +#include <libfdt.h>
>>> +#include <stdio.h>
>>> +#include <uk/assert.h>
>>> +#include <uk/essentials.h>
>>> +#include <uk/print.h>
>>> +#include <uk/list.h>
>>> +#include <arm/cpu.h>
>>> +#include <ofw/fdt.h>
>>> +#include <rtc/rtc.h>
>>> +#include <gic/gic-v2.h>
>>> +#include <ofw/gic_fdt.h>
>>> +#include <uk/plat/common/irq.h>
>>> +
>>> +static uint64_t rtc_base_addr;
>>> +uint32_t rtc_boot_seconds;
>>> +
>>> +/* Define offset of RTC registers */
>>> +#define RTC_DR0
>>> +#define RTC_MR0x4
>>> +#define RTC_LR0x8
>>> +#define RTC_CR0xc
>>> +#define RTC_IMSC0x10
>>> +#define RTC_RIS0x14
>>> +#define RTC_MIS0x18
>>> +#define RTC_ICR0x1c
>>> +
>>> +#define RTC_REG(r)(void *)(rtc_base_addr + (r))
>>> +
>>> +#define RTC_DEV_NUM 1
>>> +#define RTC_ENABLE 1
>>> +#define RTC_DISABLE 0
>>> +
>>> +static int day_per_mon[12] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
>>> +
>>> +static const char * const rtc_device_list[] = {
>>> +"arm,pl031",
>>> +};
>>> +
>>> +static void pl031_raw_to_tm(uint32_t raw, struct rtc_time *rt)
>>    Move these function into a header file `rtc.h` as a static inline
>> function as these are generic conversion functions.
>>
> There is a for loop in this function, so it may not be appropriate to be a inline function. isn't?

Sure the compiler might not inline it. I wasn't completely sure, as it 
was constant iteration.

Anyways it would not be a  problem to provide it in `plat/driver/rtc/rtc.c`

>
>>> +{
>>> +int hour, days, years, dy4, dy100, dy400, normal_days,
>>> +day_in_year, sum = 0, leap;
>>> +
>>> +rt->sec = raw % 60;
>>> +rt->min = (raw % (60 * 60)) / 60;
>>> +hour = raw / 60 / 60;
>>> +days =  hour / 24;
>>> +rt->hour = hour % 24;
>>> +/*
>>> + * total days for every continue 4-years, assuming there is a leap
>>> + * year among every 4 years.
>>> + */
>>> +dy4 = 365 * 3 + 366;
>>> +// total days for every continue 100-years.
>>> +dy100 = 25 * dy4 - 1;
>>> +// total days for every continue 400-years.
>>> +dy400 = dy100 * 4 + 1;
>>> +// normalize the days by get rid of the additional day in leap year
>>> +normal_days = days - days / dy4 + days / dy100 + days / dy400;
>>> +years = normal_days / 365;
>>> +rt->year = 1970 + years;
>>> +leap = ((!(rt->year % 4) && (rt->year % 100)) || !(rt->year % 400));
>>> +day_in_year =  normal_days - years * 365;
>>> +/*
>>> + * if the residue days larger than the sum of the first two month
>>> + * we should consider Feb,29.
>>> + */
>>> +sum += leap * (day_in_year >= (day_per_mon[0] +
>> day_per_mon[1]));
>>> +for (int i = 0; i < 12; i++) {
>>> +sum += day_per_mon[i];
>>> +if (day_in_year < sum) {
>>> +rt->mon = i + 1;
>>> +rt->day = day_in_year - (sum - day_per_mon[i]) + 1;
>>> +break;
>>> +}
>>> +}
>>> +}
>>> +
>>> +static uint32_t pl031_tm_to_raw(struct rtc_time *rt)
>> Move these function into a header file `rtc.h` as a static inline function.
> it's a little odd to put this device-specific function into rtc.h, as all of the terms in rtc.h should be
> generic.
> Ps: also these functions in linux kernel are kept in its specific file.

I am not sure why this function is device specific as it convert a 
generic `struct rtc_time` to an uint32 number.

>
>>> +{
>>> +int leaps, leap, days, sec;
>>> +
>>> +leaps = (rt->year - 1970) / 4 - (rt->year - 1970) / 100 +
>>> +(rt->year - 1970) / 400;
>>> +leap = ((!(rt->year % 4) && (rt->year % 100)) || !(rt->year % 400));
>>> +days = (rt->year - 1970) * 365 + leaps;
>>> +if (rt->mon == 1) {
>>> +days += day_per_mon[0];
>>> +} else {
>>> +for (int i = 0; i < rt->mon - 1; i++)
>>> +days += day_per_mon[i];
>>> +}
>>> +days += rt->day + (rt->mon > 2) * leap - 1;
>>> +sec = days * 3600 * 24 + rt->hour * 3600 + rt->min * 60 + rt->sec;
>>> +
>>> +return sec;
>>> +}
>>> +
>>> +static uint32_t pl031_read_raw(void)
>>> +{
>>> +return ioreg_read32(RTC_REG(RTC_DR));
>>> +}
>>> +
>>> +static void pl031_read_time(struct rtc_time *rt)
>>> +{
>>> +uint32_t raw;
>>> +
>>> +raw = pl031_read_raw();
>>> +pl031_raw_to_tm(raw, rt);
>>> +}
>>> +
>>> +static void pl031_write_raw(uint32_t val)
>>> +{
>>> +ioreg_write32(RTC_REG(RTC_LR), val);
>>> +}
>>> +
>>> +static void pl031_write_time(struct rtc_time *rt)
>>> +{
>>> +uint32_t raw;
>>> +
>>> +raw = pl031_tm_to_raw(rt);
>>> +pl031_write_raw(raw);
>>> +}
>>> +
>>> +/*
>>> + * set rtc match register comparing with counter
>>> + * value to generat a interrupt
>>> + */
>>> +static void pl031_write_alarm_raw(uint32_t alarm)
>>> +{
>>> +ioreg_write32(RTC_REG(RTC_MR), alarm);
>>> +}
>>> +
>>> +static void pl031_write_alarm(struct rtc_time *rt)
>>> +{
>>> +uint32_t raw;
>>> +
>>> +raw = pl031_tm_to_raw(rt);
>>> +pl031_write_alarm_raw(raw);
>>> +}
>>> +
>>> +static uint32_t pl031_read_alarm_raw(void)
>>> +{
>>> +return ioreg_read32(RTC_REG(RTC_MR));
>>> +}
>>> +
>>> +static void pl031_read_alarm(struct rtc_time *rt)
>>> +{
>>> +pl031_raw_to_tm(pl031_read_alarm_raw(), rt);
>>> +}
>>> +
>>> +/*
>>> + * If pl031 is not enabled, enable it by write 1 to RTC_CR, otherwise
>>> + * do nothing.
>>> + */
>>> +static void pl031_enable(int enable)
>>> +{
>>> +ioreg_write32(RTC_REG(RTC_CR), enable);
>>> +}
>>> +
>>> +/* return rtc status, 1 denotes enable and 0 denotes disable */
>>> +static int pl031_get_status(void)
>>> +{
>>> +int val;
>>> +
>>> +val = ioreg_read32(RTC_REG(RTC_CR));
>>> +val &= RTC_ENABLE;
>>> +return val;
>>> +}
>>> +
>>> +/* enable alarm irq, 1 denotes enable, 2 denotes disable */
>>> +static void pl031_enable_intr(int enable)
>>> +{
>>> +ioreg_write32(RTC_REG(RTC_IMSC), enable);
>>> +}
>>> +
>>> +static uint32_t pl031_get_raw_intr_state(void)
>>> +{
>>> +return ioreg_read32(RTC_REG(RTC_RIS));
>>> +}
>>> +
>>> +static void pl031_clear_intr(void)
>>> +{
>>> +while (pl031_get_raw_intr_state())
>>> +ioreg_write32(RTC_REG(RTC_ICR), 1);
>>> +}
>>> +
>>> +/* wait for platform device framework to register this handler */
>>> +int pl031_irq_handler(void *arg __unused)
>>> +{
>>> +pl031_clear_intr();
>>> +// TODO: do something real
>>> +
>>> +return 1;
>>> +}
>>> +
>>> +static const struct rtc_ops ops_pl031 = {
>>> +.enable= pl031_enable,
>>> +.status= pl031_get_status,
>>> +.read= pl031_read_time,
>>> +.read_raw= pl031_read_raw,
>>> +.write= pl031_write_time,
>>> +.write_raw= pl031_write_raw,
>>> +.read_alarm= pl031_read_alarm,
>>> +.read_alarm_raw= pl031_read_alarm_raw,
>>> +.write_alarm= pl031_write_alarm,
>>> +.write_alarm_raw= pl031_write_alarm_raw,
>>> +.alarm_irq_enable= pl031_enable_intr,
>>> +};
>>> +
>>> +const struct rtc_dev rtc_pl031 = {
>>> +.name= "rtc_pl031",
>>> +.id= 0,
>>> +.ops= &ops_pl031,
>>> +};
>> Do we need to combine the rtc_pl031 driver code with a generic rtc
>> library code. The code below this comment belongs to generic
>> `plat/driver/rtc/rtc.c`. While we do this change we should also split it
>> into 2 libraries namely,
>>
>> librtc and the libpl031.
> What about recovering the "rtc.c" and put these generic terms into it?
Sure we could put the generic function into `plat/driver/rtc/rtc.c`
>
>>> +
>>> +const struct rtc_dev *rtc_list[RTC_DEV_NUM];
>> Why should we define this as an array. We might define it using the list
>> implementation `include/uk/list.h`
>>> +
>>> +static void rtc_dev_register(void)
>> Register function with parameter struct rtc_dev.
>>
> OK
>>> +{
>>> +rtc_list[rtc_pl031.id] = &rtc_pl031;
>>> +}
>>> +
>>> +void _dtb_init_rtc(void *dtb)
>>> +{
>>> +uint64_t size;
>>> +uint32_t irq_type, hwirq, trigger_type;
>>> +int fdt_rtc, ret, index, irq, rc;
>>> +
>>> +uk_pr_info("Probing RTC...\n");
>>> +/*
>>> + * We choose the first available rtc device in device list as the
>>> + * system rtc.
>>> + */
>>> +fdt_rtc = fdt_node_offset_idx_by_compatible_list(dtb, -1,
>>> +rtc_device_list, &index);
>> Missing this function. I guess this should be
>> fdt_node_offset_by_compatible_list.
>>
> OK
>
>>> +if (fdt_rtc < 0) {
>>> +uk_pr_warn("Could not find rtc device!, fdt_rtc is %d\n",
>>> +fdt_rtc);
>>> +return;
>>> +}
>>> +
>>> +ret = fdt_get_address(dtb, fdt_rtc, 0, &rtc_base_addr, &size);
>>> +if (ret < 0) {
>>> +uk_pr_warn("Could not get rtc address\n");
>> Print the error code.
> OK
>
>>> +return;
>>> +}
>>> +
>>> +rc = gic_get_irq_from_dtb(dtb, fdt_rtc, 0, &irq_type, &hwirq,
>>> +&trigger_type);
>>> +if (rc < 0) {
>>> +uk_pr_warn("Failed to find IRQ number from DTB\n");
>> Print the error code.
> OK
>
>>> +return;
>>> +}
>>> +
>>> +irq = gic_irq_translate(irq_type, hwirq);
>>> +if (irq < 0 || irq >= __MAX_IRQ) {
>>> +uk_pr_warn("Failed to translate IRQ number, type=%u,
>>> +   hwirq=%u\n", irq_type, hwirq);
>>> +return;
>>> +}
>>> +
>>> +rc = ukplat_irq_register(irq, pl031_irq_handler, NULL);
>>> +if (rc < 0) {
>>> +uk_pr_warn("Failed to register rtc interrupt handler\n");
>> Print the error code.
> OK
>
>>> +return;
>>> +}
>>> +
>>> +rtc_dev_register();
>>> +
>>> +if (!rtc_list[index]->ops->status())
>>> +rtc_list[index]->ops->enable(RTC_ENABLE);
>>> +
>>> +/* Record the boot seconds */
>>> +rtc_boot_seconds = rtc_list[index]->ops->read_raw();
>>> +/* Disable rtc alarm irq at its reset */
>>> +rtc_list[index]->ops->alarm_irq_enable(RTC_DISABLE);
>>> +
>>> +uk_pr_info("Found RTC on: %lu\n", rtc_base_addr);
>>> +}
>>> diff --git a/plat/kvm/Config.uk b/plat/kvm/Config.uk
>>> index 3372b6c..1bf72f3 100644
>>> --- a/plat/kvm/Config.uk
>>> +++ b/plat/kvm/Config.uk
>>> @@ -133,6 +133,11 @@ config LIBGICV2
>>>           select LIBOFW
>>>           depends on ARCH_ARM_64
>>>
>>> +config LIBPL031
>>> +       bool "Arm platform rtc device driver"
>>> +       default y if ARCH_ARM_64
>>> +       depends on ARCH_ARM_64
>>> +
>>>    config LIBOFW
>>>           bool "Open Firmware library support"
>>>           default n
>>> diff --git a/plat/kvm/Makefile.uk b/plat/kvm/Makefile.uk
>>> index a6d6f5e..d4f4cfd 100644
>>> --- a/plat/kvm/Makefile.uk
>>> +++ b/plat/kvm/Makefile.uk
>>> @@ -14,7 +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,libkvmpl031,$(CONFIG_LIBPL031)))
>>>    ##
>>>    ## Platform library definitions
>>>    ##
>>> @@ -181,3 +181,12 @@ 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
>>> +
>>> +##
>>> +## RTC-PL031 library definitions
>>> +##
>>> +LIBKVMPL031_CINCLUDES-y+= -
>> I$(LIBKVMPLAT_BASE)/include
>> Does it need some header from the  KVM platform?
> I don't think so. This RTC driver is common on arm, it's better put this under "plat/common/"
> But there is no a "Makefile". So I have to put it here.
>
> Thanks
> Jianyong
>
>>> +LIBKVMPL031_CINCLUDES-y+= -
>> I$(UK_PLAT_COMMON_BASE)/include
>>> +LIBKVMPL031_CINCLUDES-y+= -
>> I$(UK_PLAT_DRIVERS_BASE)/include
>>> +
>>> +LIBKVMPL031_SRCS-y += $(UK_PLAT_DRIVERS_BASE)/rtc/pl031.c
> IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.


From minios-devel-bounces@lists.xenproject.org Tue Dec 15 10:10:52 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Tue, 15 Dec 2020 10:10:52 +0000
Received: from list by lists.xenproject.org with outflank-mailman.53019.92508 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1kp7IC-00008A-BH; Tue, 15 Dec 2020 10:10:52 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 53019.92508; Tue, 15 Dec 2020 10:10: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 1kp7IC-000082-8G; Tue, 15 Dec 2020 10:10:52 +0000
Received: by outflank-mailman (input) for mailman id 53019;
 Tue, 15 Dec 2020 10:10: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=Q16o=FT=neclab.eu=sharan.santhanam@srs-us1.protection.inumbo.net>)
 id 1kp7IB-00007x-D1
 for minios-devel@lists.xenproject.org; Tue, 15 Dec 2020 10:10:51 +0000
Received: from mailer1.neclab.eu (unknown [195.37.70.40])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id b99fafc1-649e-4a05-97bd-47d74f90e65c;
 Tue, 15 Dec 2020 10:10:48 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
 by mailer1.neclab.eu (Postfix) with ESMTP id D6A11101F4B;
 Tue, 15 Dec 2020 11:10:47 +0100 (CET)
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 wS1jjNPWjknK; Tue, 15 Dec 2020 11:10:47 +0100 (CET)
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 ABE971003F1;
 Tue, 15 Dec 2020 11:10:47 +0100 (CET)
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, 15 Dec
 2020 11:10:45 +0100
X-BeenThere: minios-devel@lists.xenproject.org
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
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: b99fafc1-649e-4a05-97bd-47d74f90e65c
X-Virus-Scanned: Amavisd on Debian GNU/Linux (atlas-a.office.hd)
X-ENC: Last-Hop-TLS-encrypted
X-ENC: Last-Hop-TLS-encrypted
Subject: Re: [Minios-devel] [PATCH] arm/rtc: enable pl031 for arm64.
To: Jianyong Wu <Jianyong.Wu@arm.com>, "minios-devel@lists.xenproject.org"
	<minios-devel@lists.xenproject.org>, "simon.kuenzer@neclab.eu"
	<simon.kuenzer@neclab.eu>
CC: Justin He <Justin.He@arm.com>
References: <20200331095711.44593-1-jianyong.wu@arm.com>
 <b635ae64-5753-09ff-2a2c-5a5f5d4fc336@neclab.eu>
 <HE1PR0802MB25556B8C059409A3D31979B8F4F30@HE1PR0802MB2555.eurprd08.prod.outlook.com>
 <HE1PR0802MB255524512178E169E6BEEA1DF4CE0@HE1PR0802MB2555.eurprd08.prod.outlook.com>
From: Sharan Santhanam <sharan.santhanam@neclab.eu>
Message-ID: <8970f84d-f668-1d51-463e-f09007f82908@neclab.eu>
Date: Tue, 15 Dec 2020 15:40:41 +0530
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: <HE1PR0802MB255524512178E169E6BEEA1DF4CE0@HE1PR0802MB2555.eurprd08.prod.outlook.com>
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)

Hello Jianyong,

Please find the comment inline.

Thanks & Regards

Sharan

On 12/7/20 3:34 PM, Jianyong Wu wrote:
> Hi Sharan,
>
>> -----Original Message-----
>> From: Jianyong Wu
>> Sent: Wednesday, December 2, 2020 1:09 PM
>> To: Sharan Santhanam <sharan.santhanam@neclab.eu>; minios-
>> devel@lists.xenproject.org; simon.kuenzer@neclab.eu
>> Cc: Justin He <Justin.He@arm.com>; Wei Chen <Wei.Chen@arm.com>
>> Subject: RE: [Minios-devel] [PATCH] arm/rtc: enable pl031 for arm64.
>>
>> Hi Sharan,
>>
>> Thanks for your comments.
>>
>>> -----Original Message-----
>>> From: Sharan Santhanam <sharan.santhanam@neclab.eu>
>>> Sent: Tuesday, December 1, 2020 12:55 AM
>>> To: Jianyong Wu <Jianyong.Wu@arm.com>; minios-
>>> devel@lists.xenproject.org; simon.kuenzer@neclab.eu
>>> Cc: Justin He <Justin.He@arm.com>; Wei Chen <Wei.Chen@arm.com>
>>> Subject: Re: [Minios-devel] [PATCH] arm/rtc: enable pl031 for arm64.
>>>
>>> Hello Jianyong Wu,
>>>
>>> Please find the comments inline:
>>>
>>> Thanks & Regards
>>> Sharan
>>>
>>> On 3/31/20 11:57 AM, Jianyong Wu wrote:
>>>> Currently, rtc is not enabled in arm, so wall time can't be provided
>>>> currectly.
>>>> pl031 is chosen as the rtc device for arm in this patch, but we have
>>>> interface extension of capable of plugging other rtc device.
>>>>
>>>> This patch use the new fdt API of
>>> "fdt_node_offset_idx_by_compatible_list"
>>>> in Justin's patch in review.
>>>>
>>>> Signed-off-by: Wei Chen <wei.chen@arm.com>
>>>> Signed-off-by: Jianyong Wu <jianyong.wu@arm.com>
>>>> ---
>>>>    plat/common/arm/time.c         |   2 +
>>>>    plat/drivers/include/rtc/rtc.h |  77 ++++++++
>>>>    plat/drivers/rtc/pl031.c       | 315
>>> +++++++++++++++++++++++++++++++++
>>>>    plat/kvm/Config.uk             |   5 +
>>>>    plat/kvm/Makefile.uk           |  11 +-
>>>>    5 files changed, 409 insertions(+), 1 deletion(-)
>>>>    create mode 100644 plat/drivers/include/rtc/rtc.h
>>>>    create mode 100644 plat/drivers/rtc/pl031.c
>>>>
>>>> diff --git a/plat/common/arm/time.c b/plat/common/arm/time.c index
>>>> bbb3c72..7560fff 100644
>>>> --- a/plat/common/arm/time.c
>>>> +++ b/plat/common/arm/time.c
>>>> @@ -150,4 +150,6 @@ void ukplat_time_init(void)
>>>>
>>>>    /* Enable timer */
>>>>    generic_timer_enable();
>>>> +/* Initialize rtc */
>>>> +_dtb_init_rtc(_libkvmplat_cfg.dtb);
>>>>    }
>>>> diff --git a/plat/drivers/include/rtc/rtc.h
>>>> b/plat/drivers/include/rtc/rtc.h new file mode 100644 index
>>>> 0000000..4dafb87
>>>> --- /dev/null
>>>> +++ b/plat/drivers/include/rtc/rtc.h
>>>> @@ -0,0 +1,77 @@
>>>> +/* SPDX-License-Identifier: BSD-3-Clause */
>>>> +/*
>>>> + * Authors: Wei Chen <Wei.Chen@arm.com>
>>>> + *          Jianyong Wu <Jianyong.Wu@arm.com>
>>>> + *
>>>> + * Copyright (c) 2019, Arm Ltd. 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.
>>> Remove the above line since it is incompatible with the BSD license.
>>>
>> OK
>>
>>>> + */
>>>> +
>>>> +#ifndef __PLAT_KVM_ARM_RTC_H__
>>>> +#define __PLAT_KVM_ARM_RTC_H__
>>>> +
>>>> +struct rtc_time {
>>>> +int year;
>>>> +int mon;
>>>> +int day;
>>>> +int hour;
>>>> +int min;
>>>> +int sec;
>>>> +};
>>>> +
>>>> +struct rtc_ops {
>>>> +void (*enable)(int);
>>>> +int (*status)(void);
>>>> +void (*read)(struct rtc_time *);
>>>> +uint32_t (*read_raw)(void);
>>>> +void (*write)(struct rtc_time *);
>>>> +void (*write_raw)(uint32_t);
>>> We should rename it as read_time and the write_time. I am not sure why
>>> we need to expose the *_raw as a part of the rtc_ops operation because
>>> this is used only for a specific operation.
>>>
>> OK
>>
>>> Instead we could read the boot tick with an API function like:
>>>
>>> uint32_t rtc_boot_tick_get(struct rtc_dev *dev);
>>>
>> OK
>>
>>>> +void (*read_alarm)(struct rtc_time *);
>>>> +uint32_t (*read_alarm_raw)(void);
>>>> +void (*write_alarm)(struct rtc_time *);
>>>> +void (*write_alarm_raw)(uint32_t);
>>>> +void (*alarm_irq_enable)(int);
>>>> +};
>>> Why don't these rtc_ops take the rtc_dev as its parameter. It would be
>>> difficult to support multiple device.
>>>
>> OK
>>
>>>> +
>>>> +struct rtc_dev {
>>>> +char *name;
>>>> +int id;
>>>> +const struct rtc_ops *ops;
>>>> +};
>>>> +
>>>> +#ifdef CONFIG_RTC_PL031
>>>> +
>>>> +#include <stdint.h>
>>>> +
>>>> +extern uint32_t rtc_boot_seconds;
>>>> +
>>>> +int _dtb_init_rtc(void *dtb);
>>>> +
>>>> +#endif
>>>> +#endif //__PLAT_KVM_ARM_GICV2_H__
>>> s/__PLAT_KVM_ARM_GICV2_H__/__PLAT_KVM_ARM_RTC_H__
>>>> diff --git a/plat/drivers/rtc/pl031.c b/plat/drivers/rtc/pl031.c new
>>>> file mode 100644 index 0000000..ff24411
>>>> --- /dev/null
>>>> +++ b/plat/drivers/rtc/pl031.c
>>>> @@ -0,0 +1,315 @@
>>>> +/* SPDX-License-Identifier: BSD-3-Clause */
>>>> +/*
>>>> + * Authors: Wei Chen <Wei.Chen@arm.com>
>>>> + *          Jianyong Wu <Jianyong.Wu@arm.com>
>>>> + *
>>>> + * Copyright (c) 2018, Arm Ltd. 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.
>>> Remove the above line since it is incompatible with the BSD license.
>>>
>> OK
>>
>>>> + */
>>>> +#include <string.h>
>>>> +#include <libfdt.h>
>>>> +#include <stdio.h>
>>>> +#include <uk/assert.h>
>>>> +#include <uk/essentials.h>
>>>> +#include <uk/print.h>
>>>> +#include <uk/list.h>
>>>> +#include <arm/cpu.h>
>>>> +#include <ofw/fdt.h>
>>>> +#include <rtc/rtc.h>
>>>> +#include <gic/gic-v2.h>
>>>> +#include <ofw/gic_fdt.h>
>>>> +#include <uk/plat/common/irq.h>
>>>> +
>>>> +static uint64_t rtc_base_addr;
>>>> +uint32_t rtc_boot_seconds;
>>>> +
>>>> +/* Define offset of RTC registers */
>>>> +#define RTC_DR0
>>>> +#define RTC_MR0x4
>>>> +#define RTC_LR0x8
>>>> +#define RTC_CR0xc
>>>> +#define RTC_IMSC0x10
>>>> +#define RTC_RIS0x14
>>>> +#define RTC_MIS0x18
>>>> +#define RTC_ICR0x1c
>>>> +
>>>> +#define RTC_REG(r)(void *)(rtc_base_addr + (r))
>>>> +
>>>> +#define RTC_DEV_NUM 1
>>>> +#define RTC_ENABLE 1
>>>> +#define RTC_DISABLE 0
>>>> +
>>>> +static int day_per_mon[12] = {31, 28, 31, 30, 31, 30, 31, 31, 30,
>>>> +31, 30, 31};
>>>> +
>>>> +static const char * const rtc_device_list[] = {
>>>> +"arm,pl031",
>>>> +};
>>>> +
>>>> +static void pl031_raw_to_tm(uint32_t raw, struct rtc_time *rt)
>>>    Move these function into a header file `rtc.h` as a static inline
>>> function as these are generic conversion functions.
>>>
>> There is a for loop in this function, so it may not be appropriate to be a inline
>> function. isn't?
>>
>>>> +{
>>>> +int hour, days, years, dy4, dy100, dy400, normal_days,
>>>> +day_in_year, sum = 0, leap;
>>>> +
>>>> +rt->sec = raw % 60;
>>>> +rt->min = (raw % (60 * 60)) / 60;
>>>> +hour = raw / 60 / 60;
>>>> +days =  hour / 24;
>>>> +rt->hour = hour % 24;
>>>> +/*
>>>> + * total days for every continue 4-years, assuming there is a leap
>>>> + * year among every 4 years.
>>>> + */
>>>> +dy4 = 365 * 3 + 366;
>>>> +// total days for every continue 100-years.
>>>> +dy100 = 25 * dy4 - 1;
>>>> +// total days for every continue 400-years.
>>>> +dy400 = dy100 * 4 + 1;
>>>> +// normalize the days by get rid of the additional day in leap year
>>>> +normal_days = days - days / dy4 + days / dy100 + days / dy400;
>>>> +years = normal_days / 365;
>>>> +rt->year = 1970 + years;
>>>> +leap = ((!(rt->year % 4) && (rt->year % 100)) || !(rt->year % 400));
>>>> +day_in_year =  normal_days - years * 365;
>>>> +/*
>>>> + * if the residue days larger than the sum of the first two month
>>>> + * we should consider Feb,29.
>>>> + */
>>>> +sum += leap * (day_in_year >= (day_per_mon[0] +
>>> day_per_mon[1]));
>>>> +for (int i = 0; i < 12; i++) {
>>>> +sum += day_per_mon[i];
>>>> +if (day_in_year < sum) {
>>>> +rt->mon = i + 1;
>>>> +rt->day = day_in_year - (sum - day_per_mon[i]) + 1;
>>>> +break;
>>>> +}
>>>> +}
>>>> +}
>>>> +
>>>> +static uint32_t pl031_tm_to_raw(struct rtc_time *rt)
>>> Move these function into a header file `rtc.h` as a static inline function.
>> it's a little odd to put this device-specific function into rtc.h, as all of the terms
>> in rtc.h should be generic.
>> Ps: also these functions in linux kernel are kept in its specific file.
>>
>>>> +{
>>>> +int leaps, leap, days, sec;
>>>> +
>>>> +leaps = (rt->year - 1970) / 4 - (rt->year - 1970) / 100 +
>>>> +(rt->year - 1970) / 400;
>>>> +leap = ((!(rt->year % 4) && (rt->year % 100)) || !(rt->year % 400));
>>>> +days = (rt->year - 1970) * 365 + leaps;
>>>> +if (rt->mon == 1) {
>>>> +days += day_per_mon[0];
>>>> +} else {
>>>> +for (int i = 0; i < rt->mon - 1; i++)
>>>> +days += day_per_mon[i];
>>>> +}
>>>> +days += rt->day + (rt->mon > 2) * leap - 1;
>>>> +sec = days * 3600 * 24 + rt->hour * 3600 + rt->min * 60 + rt->sec;
>>>> +
>>>> +return sec;
>>>> +}
>>>> +
>>>> +static uint32_t pl031_read_raw(void) {
>>>> +return ioreg_read32(RTC_REG(RTC_DR)); }
>>>> +
>>>> +static void pl031_read_time(struct rtc_time *rt) {
>>>> +uint32_t raw;
>>>> +
>>>> +raw = pl031_read_raw();
>>>> +pl031_raw_to_tm(raw, rt);
>>>> +}
>>>> +
>>>> +static void pl031_write_raw(uint32_t val) {
>>>> +ioreg_write32(RTC_REG(RTC_LR), val); }
>>>> +
>>>> +static void pl031_write_time(struct rtc_time *rt) {
>>>> +uint32_t raw;
>>>> +
>>>> +raw = pl031_tm_to_raw(rt);
>>>> +pl031_write_raw(raw);
>>>> +}
>>>> +
>>>> +/*
>>>> + * set rtc match register comparing with counter
>>>> + * value to generat a interrupt
>>>> + */
>>>> +static void pl031_write_alarm_raw(uint32_t alarm) {
>>>> +ioreg_write32(RTC_REG(RTC_MR), alarm); }
>>>> +
>>>> +static void pl031_write_alarm(struct rtc_time *rt) {
>>>> +uint32_t raw;
>>>> +
>>>> +raw = pl031_tm_to_raw(rt);
>>>> +pl031_write_alarm_raw(raw);
>>>> +}
>>>> +
>>>> +static uint32_t pl031_read_alarm_raw(void) {
>>>> +return ioreg_read32(RTC_REG(RTC_MR)); }
>>>> +
>>>> +static void pl031_read_alarm(struct rtc_time *rt) {
>>>> +pl031_raw_to_tm(pl031_read_alarm_raw(), rt); }
>>>> +
>>>> +/*
>>>> + * If pl031 is not enabled, enable it by write 1 to RTC_CR,
>>>> +otherwise
>>>> + * do nothing.
>>>> + */
>>>> +static void pl031_enable(int enable) {
>>>> +ioreg_write32(RTC_REG(RTC_CR), enable); }
>>>> +
>>>> +/* return rtc status, 1 denotes enable and 0 denotes disable */
>>>> +static int pl031_get_status(void) {
>>>> +int val;
>>>> +
>>>> +val = ioreg_read32(RTC_REG(RTC_CR));
>>>> +val &= RTC_ENABLE;
>>>> +return val;
>>>> +}
>>>> +
>>>> +/* enable alarm irq, 1 denotes enable, 2 denotes disable */ static
>>>> +void pl031_enable_intr(int enable) {
>>>> +ioreg_write32(RTC_REG(RTC_IMSC), enable); }
>>>> +
>>>> +static uint32_t pl031_get_raw_intr_state(void) {
>>>> +return ioreg_read32(RTC_REG(RTC_RIS)); }
>>>> +
>>>> +static void pl031_clear_intr(void)
>>>> +{
>>>> +while (pl031_get_raw_intr_state())
>>>> +ioreg_write32(RTC_REG(RTC_ICR), 1); }
>>>> +
>>>> +/* wait for platform device framework to register this handler */
>>>> +int pl031_irq_handler(void *arg __unused) {
>>>> +pl031_clear_intr();
>>>> +// TODO: do something real
>>>> +
>>>> +return 1;
>>>> +}
>>>> +
>>>> +static const struct rtc_ops ops_pl031 = {
>>>> +.enable= pl031_enable,
>>>> +.status= pl031_get_status,
>>>> +.read= pl031_read_time,
>>>> +.read_raw= pl031_read_raw,
>>>> +.write= pl031_write_time,
>>>> +.write_raw= pl031_write_raw,
>>>> +.read_alarm= pl031_read_alarm,
>>>> +.read_alarm_raw= pl031_read_alarm_raw,
>>>> +.write_alarm= pl031_write_alarm,
>>>> +.write_alarm_raw= pl031_write_alarm_raw,
>>>> +.alarm_irq_enable= pl031_enable_intr,
>>>> +};
>>>> +
>>>> +const struct rtc_dev rtc_pl031 = {
>>>> +.name= "rtc_pl031",
>>>> +.id= 0,
>>>> +.ops= &ops_pl031,
>>>> +};
>>> Do we need to combine the rtc_pl031 driver code with a generic rtc
>>> library code. The code below this comment belongs to generic
>>> `plat/driver/rtc/rtc.c`. While we do this change we should also split
>>> it into 2 libraries namely,
>>>
>>> librtc and the libpl031.
>> What about recovering the "rtc.c" and put these generic terms into it?
>>
>>>> +
>>>> +const struct rtc_dev *rtc_list[RTC_DEV_NUM];
>>> Why should we define this as an array. We might define it using the
>>> list implementation `include/uk/list.h`
>>>> +
>>>> +static void rtc_dev_register(void)
>>> Register function with parameter struct rtc_dev.
>>>
>> OK
>>>> +{
>>>> +rtc_list[rtc_pl031.id] = &rtc_pl031; }
>>>> +
>>>> +void _dtb_init_rtc(void *dtb)
>>>> +{
>>>> +uint64_t size;
>>>> +uint32_t irq_type, hwirq, trigger_type;
>>>> +int fdt_rtc, ret, index, irq, rc;
>>>> +
>>>> +uk_pr_info("Probing RTC...\n");
>>>> +/*
>>>> + * We choose the first available rtc device in device list as the
>>>> + * system rtc.
>>>> + */
>>>> +fdt_rtc = fdt_node_offset_idx_by_compatible_list(dtb, -1,
>>>> +rtc_device_list, &index);
>>> Missing this function. I guess this should be
>>> fdt_node_offset_by_compatible_list.
>>>
>> OK
> I find this function in the new patch set from Justin, so this should depend on that patch set.

Maybe in the next version of the series, please add a note in the cover 
letter to indicate a dependency to the Justin's patch set so it is 
easier to track.


>
> Thanks
> Jianyong
>
>>>> +if (fdt_rtc < 0) {
>>>> +uk_pr_warn("Could not find rtc device!, fdt_rtc is %d\n",
>>>> +fdt_rtc);
>>>> +return;
>>>> +}
>>>> +
>>>> +ret = fdt_get_address(dtb, fdt_rtc, 0, &rtc_base_addr, &size);
>>>> +if (ret < 0) {
>>>> +uk_pr_warn("Could not get rtc address\n");
>>> Print the error code.
>> OK
>>
>>>> +return;
>>>> +}
>>>> +
>>>> +rc = gic_get_irq_from_dtb(dtb, fdt_rtc, 0, &irq_type, &hwirq,
>>>> +&trigger_type);
>>>> +if (rc < 0) {
>>>> +uk_pr_warn("Failed to find IRQ number from DTB\n");
>>> Print the error code.
>> OK
>>
>>>> +return;
>>>> +}
>>>> +
>>>> +irq = gic_irq_translate(irq_type, hwirq);
>>>> +if (irq < 0 || irq >= __MAX_IRQ) {
>>>> +uk_pr_warn("Failed to translate IRQ number, type=%u,
>>>> +   hwirq=%u\n", irq_type, hwirq);
>>>> +return;
>>>> +}
>>>> +
>>>> +rc = ukplat_irq_register(irq, pl031_irq_handler, NULL);
>>>> +if (rc < 0) {
>>>> +uk_pr_warn("Failed to register rtc interrupt handler\n");
>>> Print the error code.
>> OK
>>
>>>> +return;
>>>> +}
>>>> +
>>>> +rtc_dev_register();
>>>> +
>>>> +if (!rtc_list[index]->ops->status())
>>>> +rtc_list[index]->ops->enable(RTC_ENABLE);
>>>> +
>>>> +/* Record the boot seconds */
>>>> +rtc_boot_seconds = rtc_list[index]->ops->read_raw();
>>>> +/* Disable rtc alarm irq at its reset */
>>>> +rtc_list[index]->ops->alarm_irq_enable(RTC_DISABLE);
>>>> +
>>>> +uk_pr_info("Found RTC on: %lu\n", rtc_base_addr); }
>>>> diff --git a/plat/kvm/Config.uk b/plat/kvm/Config.uk index
>>>> 3372b6c..1bf72f3 100644
>>>> --- a/plat/kvm/Config.uk
>>>> +++ b/plat/kvm/Config.uk
>>>> @@ -133,6 +133,11 @@ config LIBGICV2
>>>>           select LIBOFW
>>>>           depends on ARCH_ARM_64
>>>>
>>>> +config LIBPL031
>>>> +       bool "Arm platform rtc device driver"
>>>> +       default y if ARCH_ARM_64
>>>> +       depends on ARCH_ARM_64
>>>> +
>>>>    config LIBOFW
>>>>           bool "Open Firmware library support"
>>>>           default n
>>>> diff --git a/plat/kvm/Makefile.uk b/plat/kvm/Makefile.uk index
>>>> a6d6f5e..d4f4cfd 100644
>>>> --- a/plat/kvm/Makefile.uk
>>>> +++ b/plat/kvm/Makefile.uk
>>>> @@ -14,7 +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,libkvmpl031,$(CONFIG_LIBPL031)))
>>>>    ##
>>>>    ## Platform library definitions
>>>>    ##
>>>> @@ -181,3 +181,12 @@ 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
>>>> +
>>>> +##
>>>> +## RTC-PL031 library definitions
>>>> +##
>>>> +LIBKVMPL031_CINCLUDES-y+= -
>>> I$(LIBKVMPLAT_BASE)/include
>>> Does it need some header from the  KVM platform?
>> I don't think so. This RTC driver is common on arm, it's better put this under
>> "plat/common/"
>> But there is no a "Makefile". So I have to put it here.
>>
>> Thanks
>> Jianyong
>>
>>>> +LIBKVMPL031_CINCLUDES-y+= -
>>> I$(UK_PLAT_COMMON_BASE)/include
>>>> +LIBKVMPL031_CINCLUDES-y+= -
>>> I$(UK_PLAT_DRIVERS_BASE)/include
>>>> +
>>>> +LIBKVMPL031_SRCS-y += $(UK_PLAT_DRIVERS_BASE)/rtc/pl031.c
> IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.


From minios-devel-bounces@lists.xenproject.org Tue Dec 15 14:20:02 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Tue, 15 Dec 2020 14:20:02 +0000
Received: from list by lists.xenproject.org with outflank-mailman.54268.94226 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1kpBBI-0004rW-GY; Tue, 15 Dec 2020 14:20:00 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 54268.94226; Tue, 15 Dec 2020 14:20: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 1kpBBI-0004rP-DQ; Tue, 15 Dec 2020 14:20:00 +0000
Received: by outflank-mailman (input) for mailman id 54268;
 Tue, 15 Dec 2020 14:19: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=mgel=FT=neclab.eu=simon.kuenzer@srs-us1.protection.inumbo.net>)
 id 1kpBBG-0004qz-GP
 for minios-devel@lists.xen.org; Tue, 15 Dec 2020 14:19:58 +0000
Received: from mailer1.neclab.eu (unknown [195.37.70.40])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 95f9aceb-738d-443a-af4c-554ce42b0bba;
 Tue, 15 Dec 2020 14:19:56 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
 by mailer1.neclab.eu (Postfix) with ESMTP id C5F8E101F4B;
 Tue, 15 Dec 2020 15:19:55 +0100 (CET)
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 KCYXyfEAR8SP; Tue, 15 Dec 2020 15:19:55 +0100 (CET)
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 A12B410137E;
 Tue, 15 Dec 2020 15:19:55 +0100 (CET)
Received: from [10.7.2.36] (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, 15 Dec
 2020 15:19:55 +0100
X-BeenThere: minios-devel@lists.xenproject.org
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
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: 95f9aceb-738d-443a-af4c-554ce42b0bba
X-Virus-Scanned: Amavisd on Debian GNU/Linux (atlas-a.office.hd)
X-ENC: Last-Hop-TLS-encrypted
X-ENC: Last-Hop-TLS-encrypted
Subject: Re: [UNIKRAFT PATCH 1/3] build: Use -fno-PIC instead of -no-pie as
 compilation flag
To: Razvan Deaconescu <razvan.deaconescu@cs.pub.ro>,
	<minios-devel@lists.xen.org>
CC: Sharan Santhanam <sharan.santhanam@neclab.eu>, Felipe Huici
	<felipe.huici@neclab.eu>
References: <cover.1584949967.git.razvan.deaconescu@cs.pub.ro>
 <8390f765034ce6355ac6c136811684b2730f7679.1584949967.git.razvan.deaconescu@cs.pub.ro>
From: Simon Kuenzer <simon.kuenzer@neclab.eu>
Message-ID: <986dd200-5080-9d27-638d-7bc33f1e3436@neclab.eu>
Date: Tue, 15 Dec 2020 15:19:54 +0100
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0)
 Gecko/20100101 Thunderbird/78.5.1
MIME-Version: 1.0
In-Reply-To: <8390f765034ce6355ac6c136811684b2730f7679.1584949967.git.razvan.deaconescu@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)

Thanks a lot!

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

On 23.03.20 09:25, Razvan Deaconescu wrote:
> -no-pie is used as a linking option to disable PIE (Position Independent
> Executable). -fno-PIC is used for compilation (COMPFLAGS).
> 
> Signed-off-by: Razvan Deaconescu <razvan.deaconescu@cs.pub.ro>
> ---
>   Makefile.uk | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/Makefile.uk b/Makefile.uk
> index a78afc0..7527f0f 100644
> --- a/Makefile.uk
> +++ b/Makefile.uk
> @@ -52,6 +52,6 @@ M4FLAGS      += -DUK_VERSION=$(UK_VERSION).$(UK_SUBVERSION)
>   # 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
> +COMPFLAGS-$(call gcc_version_ge,6,1)	+= -fno-PIC
>   LIBLDFLAGS-$(call gcc_version_ge,6,1)	+= -no-pie
>   LDFLAGS-$(call gcc_version_ge,6,1)	+= -no-pie
> 


From minios-devel-bounces@lists.xenproject.org Tue Dec 15 14:20:04 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Tue, 15 Dec 2020 14:20:04 +0000
Received: from list by lists.xenproject.org with outflank-mailman.54270.94230 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1kpBBM-0005Fg-IW; Tue, 15 Dec 2020 14:20:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 54270.94230; Tue, 15 Dec 2020 14:20: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 1kpBBM-0005FZ-F7; Tue, 15 Dec 2020 14:20:04 +0000
Received: by outflank-mailman (input) for mailman id 54270;
 Tue, 15 Dec 2020 14:20: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=mgel=FT=neclab.eu=simon.kuenzer@srs-us1.protection.inumbo.net>)
 id 1kpBBM-00059h-1K
 for minios-devel@lists.xen.org; Tue, 15 Dec 2020 14:20:04 +0000
Received: from mailer2.neclab.eu (unknown [195.37.70.41])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 919eee39-d52b-452e-b7d7-695584282efb;
 Tue, 15 Dec 2020 14:20:02 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
 by mailer2.neclab.eu (Postfix) with ESMTP id 4ECC2F257A;
 Tue, 15 Dec 2020 15:20:01 +0100 (CET)
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 2i45YxI9k411; Tue, 15 Dec 2020 15:20:01 +0100 (CET)
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 253A8F2579;
 Tue, 15 Dec 2020 15:19:57 +0100 (CET)
Received: from [10.7.2.36] (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, 15 Dec
 2020 15:19:56 +0100
X-BeenThere: minios-devel@lists.xenproject.org
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
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: 919eee39-d52b-452e-b7d7-695584282efb
X-Virus-Scanned: Amavisd on Debian GNU/Linux (atlas-b.office.hd)
X-ENC: Last-Hop-TLS-encrypted
X-ENC: Last-Hop-TLS-encrypted
Subject: Re: [UNIKRAFT PATCH 2/3] build: Remove --omagic flag from LIBLDFLAGS
To: Razvan Deaconescu <razvan.deaconescu@cs.pub.ro>,
	<minios-devel@lists.xen.org>
CC: Sharan Santhanam <sharan.santhanam@neclab.eu>, Felipe Huici
	<felipe.huici@neclab.eu>
References: <cover.1584949967.git.razvan.deaconescu@cs.pub.ro>
 <d139fe404a7696650cd64a3cde34994207f52f7b.1584949967.git.razvan.deaconescu@cs.pub.ro>
From: Simon Kuenzer <simon.kuenzer@neclab.eu>
Message-ID: <e33feaf1-560b-ea5d-1c5f-98bb676cd6be@neclab.eu>
Date: Tue, 15 Dec 2020 15:19:55 +0100
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0)
 Gecko/20100101 Thunderbird/78.5.1
MIME-Version: 1.0
In-Reply-To: <d139fe404a7696650cd64a3cde34994207f52f7b.1584949967.git.razvan.deaconescu@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)

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

On 23.03.20 09:25, Razvan Deaconescu wrote:
> The --omagic flag is required for the final linking step, as part of
> LDFLAGS.
> 
> Signed-off-by: Razvan Deaconescu <razvan.deaconescu@cs.pub.ro>
> ---
>   Makefile.uk | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/Makefile.uk b/Makefile.uk
> index 7527f0f..75adc92 100644
> --- a/Makefile.uk
> +++ b/Makefile.uk
> @@ -18,10 +18,11 @@ CINCLUDES    += -I$(CONFIG_UK_BASE)/include
>   CXXINCLUDES  += -I$(CONFIG_UK_BASE)/include
>   GOCINCLUDES  += -I$(CONFIG_UK_BASE)/include
>   
> +LIBLDFLAGS  += -nostdinc -nostdlib -Wl,-r -Wl,-d -Wl,--build-id=none
> +
>   # 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
>   
>   COMPFLAGS-$(CONFIG_OPTIMIZE_NONE)         += -O0 -fno-optimize-sibling-calls -fno-tree-vectorize
> 


From minios-devel-bounces@lists.xenproject.org Tue Dec 15 14:20:09 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Tue, 15 Dec 2020 14:20:09 +0000
Received: from list by lists.xenproject.org with outflank-mailman.54272.94234 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1kpBBR-0005Z6-KL; Tue, 15 Dec 2020 14:20:09 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 54272.94234; Tue, 15 Dec 2020 14:20: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 1kpBBR-0005Yw-Gj; Tue, 15 Dec 2020 14:20:09 +0000
Received: by outflank-mailman (input) for mailman id 54272;
 Tue, 15 Dec 2020 14:20: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=mgel=FT=neclab.eu=simon.kuenzer@srs-us1.protection.inumbo.net>)
 id 1kpBBQ-00059h-Eq
 for minios-devel@lists.xen.org; Tue, 15 Dec 2020 14:20:08 +0000
Received: from mailer2.neclab.eu (unknown [195.37.70.41])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id b16350bf-f539-4fa4-b79f-aebd35832ca9;
 Tue, 15 Dec 2020 14:20:06 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
 by mailer2.neclab.eu (Postfix) with ESMTP id 596C1F257A;
 Tue, 15 Dec 2020 15:20:05 +0100 (CET)
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 VtT4hQIwGw5s; Tue, 15 Dec 2020 15:20:05 +0100 (CET)
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 2F571F2579;
 Tue, 15 Dec 2020 15:20:01 +0100 (CET)
Received: from [10.7.2.36] (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, 15 Dec
 2020 15:19:57 +0100
X-BeenThere: minios-devel@lists.xenproject.org
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
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: b16350bf-f539-4fa4-b79f-aebd35832ca9
X-Virus-Scanned: Amavisd on Debian GNU/Linux (atlas-b.office.hd)
X-ENC: Last-Hop-TLS-encrypted
X-ENC: Last-Hop-TLS-encrypted
Subject: Re: [UNIKRAFT PATCH 3/3] build: Always use -no-pie as part of
 LIBLDFLAGS
To: Razvan Deaconescu <razvan.deaconescu@cs.pub.ro>,
	<minios-devel@lists.xen.org>
CC: Sharan Santhanam <sharan.santhanam@neclab.eu>, Felipe Huici
	<felipe.huici@neclab.eu>
References: <cover.1584949967.git.razvan.deaconescu@cs.pub.ro>
 <7e9aa2f8396fe8ccf0b50c212b7be21ec445302c.1584949967.git.razvan.deaconescu@cs.pub.ro>
From: Simon Kuenzer <simon.kuenzer@neclab.eu>
Message-ID: <d150aa3e-d6b4-66dd-893a-09d5ecdc59d5@neclab.eu>
Date: Tue, 15 Dec 2020 15:19:56 +0100
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0)
 Gecko/20100101 Thunderbird/78.5.1
MIME-Version: 1.0
In-Reply-To: <7e9aa2f8396fe8ccf0b50c212b7be21ec445302c.1584949967.git.razvan.deaconescu@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)

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

On 23.03.20 09:25, Razvan Deaconescu wrote:
> -no-pie is not configurable for LIBLDFLAGS. It is always part of
> LIBLDFLAGS, as -Wl,-r enforces that. If PIC/PIE is configured by
> updating COMPFLAGS/LDFLAGS, no update will be required for LIBLDFLAGS.
> 
> Signed-off-by: Razvan Deaconescu <razvan.deaconescu@cs.pub.ro>
> ---
>   Makefile.uk | 3 +--
>   1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/Makefile.uk b/Makefile.uk
> index 75adc92..50dbab4 100644
> --- a/Makefile.uk
> +++ b/Makefile.uk
> @@ -18,7 +18,7 @@ CINCLUDES    += -I$(CONFIG_UK_BASE)/include
>   CXXINCLUDES  += -I$(CONFIG_UK_BASE)/include
>   GOCINCLUDES  += -I$(CONFIG_UK_BASE)/include
>   
> -LIBLDFLAGS  += -nostdinc -nostdlib -Wl,-r -Wl,-d -Wl,--build-id=none
> +LIBLDFLAGS  += -nostdinc -nostdlib -Wl,-r -Wl,-d -Wl,--build-id=none -no-pie
>   
>   # Set the text and data sections to be readable and writable. Also,
>   # do not page-align the data segment. If the output format supports
> @@ -54,5 +54,4 @@ M4FLAGS      += -DUK_VERSION=$(UK_VERSION).$(UK_SUBVERSION)
>   # override "pie" option, because some distributions will set
>   # "--enable-default-pie" by default.
>   COMPFLAGS-$(call gcc_version_ge,6,1)	+= -fno-PIC
> -LIBLDFLAGS-$(call gcc_version_ge,6,1)	+= -no-pie
>   LDFLAGS-$(call gcc_version_ge,6,1)	+= -no-pie
> 


From minios-devel-bounces@lists.xenproject.org Tue Dec 15 14:20:26 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Tue, 15 Dec 2020 14:20:26 +0000
Received: from list by lists.xenproject.org with outflank-mailman.54273.94238 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1kpBBi-0005bf-ML; Tue, 15 Dec 2020 14:20:26 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 54273.94238; Tue, 15 Dec 2020 14:20: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 1kpBBi-0005bY-Iv; Tue, 15 Dec 2020 14:20:26 +0000
Received: by outflank-mailman (input) for mailman id 54273;
 Tue, 15 Dec 2020 14:20:26 +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=mgel=FT=neclab.eu=simon.kuenzer@srs-us1.protection.inumbo.net>)
 id 1kpBBi-0005bS-3M
 for minios-devel@lists.xen.org; Tue, 15 Dec 2020 14:20:26 +0000
Received: from mailer1.neclab.eu (unknown [195.37.70.40])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id f4372978-b2ed-4979-b40f-8ac3edf11b41;
 Tue, 15 Dec 2020 14:20:25 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
 by mailer1.neclab.eu (Postfix) with ESMTP id F41EE101F4B;
 Tue, 15 Dec 2020 15:20:23 +0100 (CET)
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 HtjFsO68p2qv; Tue, 15 Dec 2020 15:20:23 +0100 (CET)
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 D037810137E;
 Tue, 15 Dec 2020 15:20:23 +0100 (CET)
Received: from [10.7.2.36] (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, 15 Dec
 2020 15:20:23 +0100
X-BeenThere: minios-devel@lists.xenproject.org
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
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: f4372978-b2ed-4979-b40f-8ac3edf11b41
X-Virus-Scanned: Amavisd on Debian GNU/Linux (atlas-a.office.hd)
X-ENC: Last-Hop-TLS-encrypted
X-ENC: Last-Hop-TLS-encrypted
Subject: Re: [UNIKRAFT PATCH 0/3] Update COMPFLAGS and LIBLDFLAGS in
 Makefile.uk
To: Razvan Deaconescu <razvan.deaconescu@cs.pub.ro>,
	<minios-devel@lists.xen.org>
CC: Sharan Santhanam <sharan.santhanam@neclab.eu>, Felipe Huici
	<felipe.huici@neclab.eu>
References: <cover.1584949967.git.razvan.deaconescu@cs.pub.ro>
From: Simon Kuenzer <simon.kuenzer@neclab.eu>
Message-ID: <cf639ca6-09f8-4948-bca3-82aec5d7625b@neclab.eu>
Date: Tue, 15 Dec 2020 15:20:22 +0100
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0)
 Gecko/20100101 Thunderbird/78.5.1
MIME-Version: 1.0
In-Reply-To: <cover.1584949967.git.razvan.deaconescu@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)

Thanks a lot for these improvements!

On 23.03.20 09:25, Razvan Deaconescu wrote:
> Update values for COMPFLAGS and LIBLDFLAGS. These aren't fixes per se
> (there are no bugs), rather a more correct way of defining COMPFLAGS and
> LIBLDFLAGS.
> 
> Razvan Deaconescu (3):
>    build: Use -fno-PIC instead of -no-pie as compilation flag
>    build: Remove --omagic flag from LIBLDFLAGS
>    build: Always use -no-pie as part of LIBLDFLAGS
> 
>   Makefile.uk | 6 +++---
>   1 file changed, 3 insertions(+), 3 deletions(-)
> 


From minios-devel-bounces@lists.xenproject.org Tue Dec 15 14:29:04 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Tue, 15 Dec 2020 14:29:04 +0000
Received: from list by lists.xenproject.org with outflank-mailman.54289.94254 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1kpBK3-0005yT-JE; Tue, 15 Dec 2020 14:29:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 54289.94254; Tue, 15 Dec 2020 14:29: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 1kpBK3-0005yM-GO; Tue, 15 Dec 2020 14:29:03 +0000
Received: by outflank-mailman (input) for mailman id 54289;
 Tue, 15 Dec 2020 14:29:02 +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=mgel=FT=neclab.eu=simon.kuenzer@srs-us1.protection.inumbo.net>)
 id 1kpBK2-0005yH-JS
 for minios-devel@lists.xen.org; Tue, 15 Dec 2020 14:29:02 +0000
Received: from mailer1.neclab.eu (unknown [195.37.70.40])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 7daabcbc-968c-4a57-b3db-7a13d6406996;
 Tue, 15 Dec 2020 14:29:01 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
 by mailer1.neclab.eu (Postfix) with ESMTP id 0D13E103A0B;
 Tue, 15 Dec 2020 15:29:00 +0100 (CET)
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 Q1hOUJPan2wY; Tue, 15 Dec 2020 15:28:59 +0100 (CET)
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 C0E4A103EF7;
 Tue, 15 Dec 2020 15:28:59 +0100 (CET)
Received: from [10.7.2.36] (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, 15 Dec
 2020 15:28:59 +0100
X-BeenThere: minios-devel@lists.xenproject.org
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
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: 7daabcbc-968c-4a57-b3db-7a13d6406996
X-Virus-Scanned: Amavisd on Debian GNU/Linux (atlas-a.office.hd)
X-ENC: Last-Hop-TLS-encrypted
X-ENC: Last-Hop-TLS-encrypted
Subject: Re: [UNIKRAFT PATCH] build: Fix "Argument list too long" problem
To: Cyril Soldani <cyril.soldani@uliege.be>, <minios-devel@lists.xen.org>
References: <1457ecc58f522dfbb746c4f79ac5a67c6ae79ea6.1586509333.git.cyril.soldani@uliege.be>
From: Simon Kuenzer <simon.kuenzer@neclab.eu>
Message-ID: <1edcf2e5-68ad-c24f-bf92-94e564279f7e@neclab.eu>
Date: Tue, 15 Dec 2020 15:28:58 +0100
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0)
 Gecko/20100101 Thunderbird/78.5.1
MIME-Version: 1.0
In-Reply-To: <1457ecc58f522dfbb746c4f79ac5a67c6ae79ea6.1586509333.git.cyril.soldani@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)

Hi Cyril,

thanks a lot for this nice and useful work-around. I will take it upstream.

Thanks,

Simon

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

On 10.04.20 11:09, Cyril Soldani wrote:
> For libraries with lots of object files, such as musl, `make clean` was
> failing with "make: execvp: /bin/sh: Argument list too long" on some
> machines (depending on default maximum command-line length).
> 
> The user could not solve this problem by changing his shell limits,
> because GNU make resets those to system defaults.
> 
> This patch removes the direct call to `rm`, and replace it with a call
> to `xargs rm`, using an intermediate file generated by `make`. The
> intermediate file is kept after `clean` so that the user can inspect
> which files have been removed.
> 
> Signed-off-by: Cyril Soldani <cyril.soldani@uliege.be>
> ---
>   Makefile                     | 1 +
>   support/build/Makefile.rules | 9 +++++++--
>   2 files changed, 8 insertions(+), 2 deletions(-)
> 
> diff --git a/Makefile b/Makefile
> index be8fa8ce..e2b41457 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -262,6 +262,7 @@ MV    := mv -f
>   CP    := cp -f
>   MKDIR := mkdir
>   TOUCH := touch
> +XARGS := xargs
>   
>   # kconfig uses CONFIG_SHELL
>   CONFIG_SHELL := $(SHELL)
> diff --git a/support/build/Makefile.rules b/support/build/Makefile.rules
> index 8c096fa5..fbdbc2c5 100644
> --- a/support/build/Makefile.rules
> +++ b/support/build/Makefile.rules
> @@ -779,8 +779,13 @@ endef
>   # cleanrule_lib $libname
>   define cleanrule_lib =
>   clean-$(1):
> -	$(call verbose_cmd,CLEAN,$(1),$(RM) \
> -	$($(call vprefix_lib,$(1),CLEAN-y)) $($(call vprefix_lib,$(1),CLEAN)))
> +	$(file >$(BUILD_DIR)/$(1)/uk_clean_list) \
> +            $(foreach O,$($(call vprefix_lib,$(1),CLEAN-y)),\
> +                $(file >>$(BUILD_DIR)/$(1)/uk_clean_list,$O)) \
> +            $(foreach O,$($(call vprefix_lib,$(1),CLEAN)),\
> +                $(file >>$(BUILD_DIR)/$(1)/uk_clean_list,$O))
> +	$(call verbose_cmd,CLEAN,$(1),\
> +            $(XARGS) $(RM) <$(BUILD_DIR)/$(1)/uk_clean_list)
>   
>   .PHONY: clean-$(1)
>   endef
> 


From minios-devel-bounces@lists.xenproject.org Tue Dec 15 14:57:18 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Tue, 15 Dec 2020 14:57:18 +0000
Received: from list by lists.xenproject.org with outflank-mailman.54305.94269 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1kpBlM-0000JI-Va; Tue, 15 Dec 2020 14:57:16 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 54305.94269; Tue, 15 Dec 2020 14:57: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 1kpBlM-0000JB-SW; Tue, 15 Dec 2020 14:57:16 +0000
Received: by outflank-mailman (input) for mailman id 54305;
 Tue, 15 Dec 2020 14:57: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=mgel=FT=neclab.eu=simon.kuenzer@srs-us1.protection.inumbo.net>)
 id 1kpBlL-0000J5-3G
 for minios-devel@lists.xen.org; Tue, 15 Dec 2020 14:57:15 +0000
Received: from mailer2.neclab.eu (unknown [195.37.70.41])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 3de7fd50-c63a-4d85-be16-bbb75a3c5937;
 Tue, 15 Dec 2020 14:57:11 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
 by mailer2.neclab.eu (Postfix) with ESMTP id 4D32CF21F3;
 Tue, 15 Dec 2020 15:57:10 +0100 (CET)
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 yjaGCZo3U13V; Tue, 15 Dec 2020 15:57:10 +0100 (CET)
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 0CF6BF21E6;
 Tue, 15 Dec 2020 15:57:06 +0100 (CET)
Received: from [10.7.2.36] (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, 15 Dec
 2020 15:57:05 +0100
X-BeenThere: minios-devel@lists.xenproject.org
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
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: 3de7fd50-c63a-4d85-be16-bbb75a3c5937
X-Virus-Scanned: Amavisd on Debian GNU/Linux (atlas-b.office.hd)
X-ENC: Last-Hop-TLS-encrypted
X-ENC: Last-Hop-TLS-encrypted
Subject: Re: [[UNIKRAFT] v5] lib/isrlib: Introduce libc-like
 interrupt-context-safe routines
To: Cristian Vijelie <cristianvijelie@gmail.com>, <minios-devel@lists.xen.org>
References: <20201130110834.11809-1-cristianvijelie@gmail.com>
From: Simon Kuenzer <simon.kuenzer@neclab.eu>
Message-ID: <1c1a559f-6efc-5fa4-cb06-ff39b92296de@neclab.eu>
Date: Tue, 15 Dec 2020 15:57:04 +0100
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0)
 Gecko/20100101 Thunderbird/78.5.1
MIME-Version: 1.0
In-Reply-To: <20201130110834.11809-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)

Hi Christian,

thanks a lot for this update! The feature set of the initial isrlib 
looks very good. I think we should further split this patch into several 
ones. Can you also make sure that you run
`support/scripts/checkpatch.pl` before submitting your patches? You can 
use `-g` option to check your commits on your history. The reason is 
that I see a couple of
   `\ No newline at end of file`

I added more comments inline.

Thanks,

Simon

On 30.11.20 12:08, Cristian Vijelie wrote:
> libisr library means to introduce interrupt-context-safe routines,
> to be used in interrupt handlers and drivers. It is derived from nolibc.
> 
> Signed-off-by: Cristian Vijelie <cristianvijelie@gmail.com>
> ---
>   include/uk/isr/mbox.h      |  13 ++
>   include/uk/isr/mutex.h     |   8 +
>   include/uk/isr/semaphore.h |   8 +
>   include/uk/isr/stdlib.h    |  60 ++++++
>   include/uk/isr/string.h    |  72 +++++++
>   lib/isrlib/Config.uk       |   3 +
>   lib/isrlib/Makefile.uk     |  10 +
>   lib/isrlib/stdlib.c        | 417 +++++++++++++++++++++++++++++++++++++
>   lib/isrlib/string.c        | 325 +++++++++++++++++++++++++++++
>   9 files changed, 916 insertions(+)
>   create mode 100644 include/uk/isr/mbox.h
>   create mode 100644 include/uk/isr/mutex.h
>   create mode 100644 include/uk/isr/semaphore.h
>   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/stdlib.c
>   create mode 100644 lib/isrlib/string.c
> 
> diff --git a/include/uk/isr/mbox.h b/include/uk/isr/mbox.h
> new file mode 100644
> index 0000000..ef70939
> --- /dev/null
> +++ b/include/uk/isr/mbox.h

Because this header is related to `ukmpi`, please move this file to
  `lib/ukmpi/include/uk/isr/mbox.h`. Introduce it with an own commit 
with a title like:
  "lib/ukmpi: Provide isr-safe routines"

> @@ -0,0 +1,13 @@
> +#ifndef __MBOX_ISR_H__
> +#define __MBOX_ISR_H__
> +
> +#include <uk/mbox.h>
> +
> +#if CONFIG_LIBUKMPI_MBOX

This if statement will not be needed anymore as soon as you moved it to 
the ukmpi library.

> +
> +int uk_mbox_post_try_isr(struct uk_mbox *m, void *msg);
> +int uk_mbox_recv_try_isr(struct uk_mbox *m, void **msg);
> +
> +#endif /* CONFIG_LIBUKMPI_MBOX */
> +
> +#endif /* __MBOX_ISR_H__ */
> \ No newline at end of file
> diff --git a/include/uk/isr/mutex.h b/include/uk/isr/mutex.h
> new file mode 100644
> index 0000000..06d51f8
> --- /dev/null
> +++ b/include/uk/isr/mutex.h

Because this header is related to `uklock`, please move this file to
  `lib/uklock/include/uk/isr/mutex.h`. Introduce it with an own commit 
with a title like:
  "lib/uklock: Provide isr-safe mutex routines"

> @@ -0,0 +1,8 @@
> +#ifndef __UK_ISR_MUTEX_H__
> +#define __UK_ISR_MUTEX_H__
> +
> +#include <uk/mutex.h>
> +
> +#define uk_mutex_trylock_isr(x) uk_mutex_trylock(x)
> +
> +#endif /* __UK_ISR_MUTEX_H__ */
> \ No newline at end of file
> diff --git a/include/uk/isr/semaphore.h b/include/uk/isr/semaphore.h
> new file mode 100644
> index 0000000..b187f1f
> --- /dev/null
> +++ b/include/uk/isr/semaphore.h

Because this header is related to `uklock`, please move this file to
  `lib/uklock/include/uk/isr/semaphore.h`. Introduce it with an own 
commit with a title like:
  "lib/uklock: Provide isr-safe semaphore routines"

> @@ -0,0 +1,8 @@
> +#ifndef __UK_ISR_SEMAPHORE_H__
> +#define __UK_ISR_SEMAPHORE_H__
> +
> +#include <uk/semaphore.h>
> +
> +#define uk_semaphore_down_try_isr(x) uk_semaphore_down_try(x)
> +
> +#endif /* __UK_ISR_SEMAPHORE_H__ */
> \ No newline at end of file
> diff --git a/include/uk/isr/stdlib.h b/include/uk/isr/stdlib.h
> new file mode 100644
> index 0000000..3c439c2
> --- /dev/null
> +++ b/include/uk/isr/stdlib.h

Please move this header to `lib/isrlib/include/uk/isr/stdlib.h`.
It should not appear in the global include folder because this is a 
header provided by your library.

> @@ -0,0 +1,60 @@
> +/* 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);
> +
> +#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

Please move this header to `lib/isrlib/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);
> +

This is a good set of function. Thanks ;-)

> +#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"

Maybe change the title to the following, it may be a bit clearer:
  "isrlib: Interrupt-safe standard routines"

> +    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/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);
> +}
> 


From minios-devel-bounces@lists.xenproject.org Tue Dec 15 16:27:06 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Tue, 15 Dec 2020 16:27:06 +0000
Received: from list by lists.xenproject.org with outflank-mailman.54461.94627 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1kpDAF-0003j1-VO; Tue, 15 Dec 2020 16:27:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 54461.94627; Tue, 15 Dec 2020 16:27: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 1kpDAF-0003is-SO; Tue, 15 Dec 2020 16:27:03 +0000
Received: by outflank-mailman (input) for mailman id 54461;
 Tue, 15 Dec 2020 16:27: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=AO39=FT=gmail.com=felipehuici@srs-us1.protection.inumbo.net>)
 id 1kpDAE-0003fc-J9
 for minios-devel@lists.xen.org; Tue, 15 Dec 2020 16:27:02 +0000
Received: from mail-ua1-x92f.google.com (unknown [2607:f8b0:4864:20::92f])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id d356cc6d-4719-4fc0-b3fe-e80d3babf8c3;
 Tue, 15 Dec 2020 16:27:01 +0000 (UTC)
Received: by mail-ua1-x92f.google.com with SMTP id t15so6890346ual.6
 for <minios-devel@lists.xen.org>; Tue, 15 Dec 2020 08:27:01 -0800 (PST)
X-BeenThere: minios-devel@lists.xenproject.org
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
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: d356cc6d-4719-4fc0-b3fe-e80d3babf8c3
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=tkZ9cnR0F5KwmJQHPCeBAz67pNLePcThr6Nj+7QaJ4M=;
        b=ayRbRV8vnb/iyYTRDqe7szlt++5voPFBhmFZrBhWfhZRCn3SAWeZ2bMtSQQD8FW3fF
         Y0lh18IOby9+92mZCLMWKOkiWv8yjSuWlGX9EGPwPiyxLIGtCCWvtmMMcaso1z7QuAVU
         KzNf/wPrfITcceerZbHYRG19+aCgd11+q9duixRMmJD5iTI9KAJU6/QEFyV5Gr7DV9c6
         x0WZ7I0cEWlgn5GdQtLGnc60X5nxu6yPxFRoMZ/XD3ARdQUsrMjKsG2j5iCFIghbeRva
         0DdGAuwRos2O4evNY8yTH2XbT6oRlX2YrCYM7tCyp70cY30Rx9hVYBqOV5bJIuYUcMx9
         z/Uw==
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=tkZ9cnR0F5KwmJQHPCeBAz67pNLePcThr6Nj+7QaJ4M=;
        b=nXEb0TBRjP2J8GdF+qph0gWkasYj64PNLu9pRnQXgkieGG1XMCdLz4XD2nRjPG6k5w
         uFsbm0hYIgJkQDQfOHBeV9nglqjk60O+fvyfPETIZ+33BtJr1x7WHBKbFBP+N6KAQwJY
         a8dM5vgabj59R2/mJ1f/DC35fSpyZu6LWDe1WwnjnLAwtkCOvz9HMHaF1zVqvw/3CUds
         XZ/SkCXanxBbbsCgL5B9gFYFRhd5YEblP9PxjvN3hucZENDltudwM+cFIAdlEpAnoRxR
         PO9sTTGnvOTByYfQCjsYYebZ/isL2QEaa6uCFq2vg5zyP6WEYgereK5dleCVd6YR37XF
         2fwA==
X-Gm-Message-State: AOAM533Cijri8/sIUq8ZXRXyDuKqfYJeK/zBcdI2OiEfWZLd/jILEWnn
	dBZY2LlDyE7jaC8y5SfKNKnaY2a+UhYy2ndShCZu0S7ZxzR1xQ==
X-Google-Smtp-Source: ABdhPJyXJoXmVpl5Y3SvsZ5gl3/s4zWsI8t69j0s/2eVl+s9ucJoIpJniZUVQ4Jjq0TTXv/Vzhd7KWhl4swJVO7QyeA=
X-Received: by 2002:ab0:2384:: with SMTP id b4mr28977177uan.27.1608049621496;
 Tue, 15 Dec 2020 08:27:01 -0800 (PST)
MIME-Version: 1.0
From: felipehuici <felipehuici@gmail.com>
Date: Tue, 15 Dec 2020 17:26:50 +0100
Message-ID: <CAEX4t-OO_2AGuDdssPtJP2K0UG=H-FMjGOk_6-u=5BEbzeDVNQ@mail.gmail.com>
Subject: Linux.com Unikraft Article
To: minios-devel@lists.xen.org
Content-Type: multipart/alternative; boundary="0000000000007874cf05b6833aca"

--0000000000007874cf05b6833aca
Content-Type: text/plain; charset="UTF-8"

Hi all,

Just wanted to let you know that there's a Unikraft Linux.com article out
just now:

"Cut your Cloud Computing Costs by Half with Unikraft"
https://www.linux.com/news/cut-your-cloud-computing-costs-by-half-with-unikraft/
.

If you can help disseminate that would be great.

Also, if you can upvote on Hacker News that would be really appreciated
too: https://news.ycombinator.com/item?id=25431474

Thanks!

-- Felipe

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

<div dir=3D"ltr">Hi all,<div><br></div><div>Just wanted to let you know tha=
t there&#39;s a Unikraft Linux.com article out just now:</div><div><br></di=
v><div>&quot;Cut your Cloud Computing Costs by Half with Unikraft&quot;<br>=
</div><div><a class=3D"gmail-theme gmail-markdown__link" href=3D"https://ww=
w.linux.com/news/cut-your-cloud-computing-costs-by-half-with-unikraft/" rel=
=3D"noreferrer" target=3D"_blank" style=3D"box-sizing:border-box;background=
-color:rgba(61,60,64,0.04);color:rgb(35,137,215);text-decoration-line:none;=
word-break:break-word;font-family:&quot;Open Sans&quot;,sans-serif;font-siz=
e:13.5px;white-space:pre-wrap">https://www.linux.com/news/cut-your-cloud-co=
mputing-costs-by-half-with-unikraft/</a><span style=3D"color:rgb(61,60,64);=
font-family:&quot;Open Sans&quot;,sans-serif;font-size:13.5px;white-space:p=
re-wrap;background-color:rgba(61,60,64,0.04)"> . </span></div><div><span st=
yle=3D"color:rgb(61,60,64);font-family:&quot;Open Sans&quot;,sans-serif;fon=
t-size:13.5px;white-space:pre-wrap;background-color:rgba(61,60,64,0.04)"><b=
r></span></div><div><span style=3D"color:rgb(61,60,64);font-family:&quot;Op=
en Sans&quot;,sans-serif;font-size:13.5px;white-space:pre-wrap;background-c=
olor:rgba(61,60,64,0.04)">If you can help disseminate that would be great.<=
/span></div><div><span style=3D"color:rgb(61,60,64);font-family:&quot;Open =
Sans&quot;,sans-serif;font-size:13.5px;white-space:pre-wrap;background-colo=
r:rgba(61,60,64,0.04)"><br></span></div><div><span style=3D"color:rgb(61,60=
,64);font-family:&quot;Open Sans&quot;,sans-serif;font-size:13.5px;white-sp=
ace:pre-wrap;background-color:rgba(61,60,64,0.04)">Also, if you can upvote =
on Hacker News that would be really appreciated too:  </span><a class=3D"gm=
ail-theme gmail-markdown__link" href=3D"https://news.ycombinator.com/item?i=
d=3D25431474" rel=3D"noreferrer" target=3D"_blank" style=3D"box-sizing:bord=
er-box;background-color:rgba(61,60,64,0.04);color:rgb(35,137,215);text-deco=
ration-line:none;word-break:break-word;font-family:&quot;Open Sans&quot;,sa=
ns-serif;font-size:13.5px;white-space:pre-wrap">https://news.ycombinator.co=
m/item?id=3D25431474</a></div><div><br></div><div>Thanks!</div><div><br></d=
iv><div>-- Felipe</div></div>

--0000000000007874cf05b6833aca--


From minios-devel-bounces@lists.xenproject.org Tue Dec 15 16:34:33 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Tue, 15 Dec 2020 16:34:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.54511.94764 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1kpDHV-0005p9-6e; Tue, 15 Dec 2020 16:34:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 54511.94764; Tue, 15 Dec 2020 16:34: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 1kpDHV-0005p2-35; Tue, 15 Dec 2020 16:34:33 +0000
Received: by outflank-mailman (input) for mailman id 54511;
 Tue, 15 Dec 2020 16:34: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=mgel=FT=neclab.eu=simon.kuenzer@srs-us1.protection.inumbo.net>)
 id 1kpDHU-0005oo-0r
 for minios-devel@lists.xen.org; Tue, 15 Dec 2020 16:34:32 +0000
Received: from mailer2.neclab.eu (unknown [195.37.70.41])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 3c0c72f9-9702-44a1-be34-fc24fd4f7617;
 Tue, 15 Dec 2020 16:34:29 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
 by mailer2.neclab.eu (Postfix) with ESMTP id 38BF5F24B7;
 Tue, 15 Dec 2020 17:34:28 +0100 (CET)
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 cmsiErbga9uD; Tue, 15 Dec 2020 17:34:28 +0100 (CET)
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 07773F24B5;
 Tue, 15 Dec 2020 17:34:22 +0100 (CET)
Received: from [10.7.2.36] (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, 15 Dec
 2020 17:34:21 +0100
X-BeenThere: minios-devel@lists.xenproject.org
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
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: 3c0c72f9-9702-44a1-be34-fc24fd4f7617
X-Virus-Scanned: Amavisd on Debian GNU/Linux (atlas-b.office.hd)
X-ENC: Last-Hop-TLS-encrypted
X-ENC: Last-Hop-TLS-encrypted
Subject: Re: [UNIKRAFT PATCH 0/3] Add clang support
To: Vlad-Andrei Badoiu <vlad_andrei.badoiu@upb.ro>,
	<minios-devel@lists.xen.org>
CC: <razvan.deaconescu@cs.pub.ro>
References: <20201121163416.136847-1-vlad_andrei.badoiu@upb.ro>
From: Simon Kuenzer <simon.kuenzer@neclab.eu>
Message-ID: <670df193-bed1-88fe-ab78-624e96dfec15@neclab.eu>
Date: Tue, 15 Dec 2020 17:34:20 +0100
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0)
 Gecko/20100101 Thunderbird/78.5.1
MIME-Version: 1.0
In-Reply-To: <20201121163416.136847-1-vlad_andrei.badoiu@upb.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)

Hi Alice, hi Vlad,

I was briefly checking this patch series (actually, I was on the search 
of another one for reviewing ;-) ) and put some comments inline to the 
patches. But so far, the changes look very good.

Thanks,

Simon

On 21.11.20 17:34, Vlad-Andrei Badoiu wrote:
> We add support for clang on Unikraft. This is an
> adapted series of the previous series of patches
> by Alice Suiu.
> 
> Vlad-Andrei Badoiu (3):
>    build: Configure the compiler from command line
>    support/build: Add build functions for clang and gcc check
>    build: Add support for clang
> 
>   Makefile                     | 13 +++++++++++--
>   Makefile.uk                  | 17 ++++++++++++++---
>   arch/x86/x86_64/Makefile.uk  |  9 ++++++---
>   support/build/Makefile.rules | 12 +++++++++++-
>   4 files changed, 42 insertions(+), 9 deletions(-)
> 


From minios-devel-bounces@lists.xenproject.org Tue Dec 15 16:35:39 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Tue, 15 Dec 2020 16:35:39 +0000
Received: from list by lists.xenproject.org with outflank-mailman.54520.94795 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1kpDIZ-0005zb-Mn; Tue, 15 Dec 2020 16:35:39 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 54520.94795; Tue, 15 Dec 2020 16:35: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 1kpDIZ-0005zJ-Gg; Tue, 15 Dec 2020 16:35:39 +0000
Received: by outflank-mailman (input) for mailman id 54520;
 Tue, 15 Dec 2020 16:35: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=mgel=FT=neclab.eu=simon.kuenzer@srs-us1.protection.inumbo.net>)
 id 1kpDIY-0005yw-JB
 for minios-devel@lists.xen.org; Tue, 15 Dec 2020 16:35:38 +0000
Received: from mailer1.neclab.eu (unknown [195.37.70.40])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 8d7b6d35-2c56-4251-a022-8dcff231088e;
 Tue, 15 Dec 2020 16:35:36 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
 by mailer1.neclab.eu (Postfix) with ESMTP id A120E103B5D;
 Tue, 15 Dec 2020 17:35:35 +0100 (CET)
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 RNYwcujK4Bdr; Tue, 15 Dec 2020 17:35:35 +0100 (CET)
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 7C177103A0B;
 Tue, 15 Dec 2020 17:35:35 +0100 (CET)
Received: from [10.7.2.36] (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, 15 Dec
 2020 17:35:34 +0100
X-BeenThere: minios-devel@lists.xenproject.org
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
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: 8d7b6d35-2c56-4251-a022-8dcff231088e
X-Virus-Scanned: Amavisd on Debian GNU/Linux (atlas-a.office.hd)
X-ENC: Last-Hop-TLS-encrypted
X-ENC: Last-Hop-TLS-encrypted
Subject: Re: [UNIKRAFT PATCH 2/3] support/build: Add build functions for clang
 and gcc check
To: Vlad-Andrei Badoiu <vlad_andrei.badoiu@upb.ro>,
	<minios-devel@lists.xen.org>
CC: <razvan.deaconescu@cs.pub.ro>, Alice Suiu <alicesuiu17@gmail.com>
References: <20201121163416.136847-1-vlad_andrei.badoiu@upb.ro>
 <20201121163416.136847-3-vlad_andrei.badoiu@upb.ro>
From: Simon Kuenzer <simon.kuenzer@neclab.eu>
Message-ID: <e59491cf-8b93-a9e8-d386-935d29397c32@neclab.eu>
Date: Tue, 15 Dec 2020 17:35:34 +0100
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0)
 Gecko/20100101 Thunderbird/78.5.1
MIME-Version: 1.0
In-Reply-To: <20201121163416.136847-3-vlad_andrei.badoiu@upb.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)

On 21.11.20 17:34, Vlad-Andrei Badoiu wrote:
> We add have_gcc and have_clang. We modify gcc_version_ge to
> use have_gcc.
> 
> Signed-off-by: Alice Suiu <alicesuiu17@gmail.com>
> Signed-off-by: Vlad-Andrei Badoiu <vlad_andrei.badoiu@upb.ro>
> ---
>   support/build/Makefile.rules | 12 +++++++++++-
>   1 file changed, 11 insertions(+), 1 deletion(-)
> 
> diff --git a/support/build/Makefile.rules b/support/build/Makefile.rules
> index 9a5963fd..ecd409f0 100644
> --- a/support/build/Makefile.rules
> +++ b/support/build/Makefile.rules
> @@ -29,10 +29,20 @@ lc = $(subst A,a,$(subst B,b,$(subst C,c,$(subst D,d,$(subst E,e,$(subst F,f,$(s
>   # upper case
>   uc = $(subst a,A,$(subst b,B,$(subst c,C,$(subst d,D,$(subst e,E,$(subst f,F,$(subst g,G,$(subst h,H,$(subst i,I,$(subst j,J,$(subst k,K,$(subst l,L,$(subst m,M,$(subst n,N,$(subst o,O,$(subst p,P,$(subst q,Q,$(subst r,R,$(subst s,S,$(subst t,T,$(subst u,U,$(subst v,V,$(subst w,W,$(subst x,X,$(subst y,Y,$(subst z,Z,$(1)))))))))))))))))))))))))))
>   
> +# test if GCC is set as a compiler
> +define have_gcc =
> +$(shell if [ $(CC) = gcc ] ; then echo y ; else echo n ; fi)
> +endef
> +
> +# test if CLANG is set as a compiler
> +define have_clang =
> +$(shell if [ $(CC) == clang ] ; then echo y ; else echo n ; fi)

I just found that use a double `=` for the clang check but a single `=` 
for the gcc check. In general, a single `=` should just work.

> +endef
> +
>   # test whether GCC version is greater than or equal to the minimum requirement
>   # gcc_version_ge $gcc_major,$gcc_minor
>   define gcc_version_ge =
> -$(shell if [ $(CC_VER_MAJOR) -gt $(1) ] || ([ $(CC_VER_MAJOR) -eq $(1) ] && [ $(CC_VER_MINOR) -ge $(2) ]) ; then echo y ; fi)
> +$(shell if [ $(call have_gcc) = y ] ; then if [ $(CC_VER_MAJOR) -gt $(1) ] || ([ $(CC_VER_MAJOR) -eq $(1) ] && [ $(CC_VER_MINOR) -ge $(2) ]) ; then echo y ; fi ; else echo n ; fi)
>   endef
>   

Out of curiosity, I guess you also plan to add a command like 
`clang_version_ge`? ;-)

>   # print error and stop build when GCC version doesn't meet the minimum requirement
> 


From minios-devel-bounces@lists.xenproject.org Tue Dec 15 16:36:03 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Tue, 15 Dec 2020 16:36:03 +0000
Received: from list by lists.xenproject.org with outflank-mailman.54525.94807 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1kpDIx-00064Q-QQ; Tue, 15 Dec 2020 16:36:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 54525.94807; Tue, 15 Dec 2020 16:36: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 1kpDIx-00064J-NT; Tue, 15 Dec 2020 16:36:03 +0000
Received: by outflank-mailman (input) for mailman id 54525;
 Tue, 15 Dec 2020 16:36: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=mgel=FT=neclab.eu=simon.kuenzer@srs-us1.protection.inumbo.net>)
 id 1kpDIw-000646-Im
 for minios-devel@lists.xen.org; Tue, 15 Dec 2020 16:36:02 +0000
Received: from mailer1.neclab.eu (unknown [195.37.70.40])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id fb597d31-939f-4ba4-8d4c-b390fe3f2b4e;
 Tue, 15 Dec 2020 16:36:00 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
 by mailer1.neclab.eu (Postfix) with ESMTP id C4273103A0B;
 Tue, 15 Dec 2020 17:35:59 +0100 (CET)
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 3jA7WZh5Q09e; Tue, 15 Dec 2020 17:35:59 +0100 (CET)
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 9E46A10006C;
 Tue, 15 Dec 2020 17:35:59 +0100 (CET)
Received: from [10.7.2.36] (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, 15 Dec
 2020 17:35:59 +0100
X-BeenThere: minios-devel@lists.xenproject.org
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
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: fb597d31-939f-4ba4-8d4c-b390fe3f2b4e
X-Virus-Scanned: Amavisd on Debian GNU/Linux (atlas-a.office.hd)
X-ENC: Last-Hop-TLS-encrypted
X-ENC: Last-Hop-TLS-encrypted
Subject: Re: [UNIKRAFT PATCH 3/3] build: Add support for clang
To: Vlad-Andrei Badoiu <vlad_andrei.badoiu@upb.ro>,
	<minios-devel@lists.xen.org>
CC: <razvan.deaconescu@cs.pub.ro>, Alice Suiu <alicesuiu17@gmail.com>
References: <20201121163416.136847-1-vlad_andrei.badoiu@upb.ro>
 <20201121163416.136847-4-vlad_andrei.badoiu@upb.ro>
From: Simon Kuenzer <simon.kuenzer@neclab.eu>
Message-ID: <d7c8a7a7-7490-517f-e9e5-751ea8cf884c@neclab.eu>
Date: Tue, 15 Dec 2020 17:35:58 +0100
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0)
 Gecko/20100101 Thunderbird/78.5.1
MIME-Version: 1.0
In-Reply-To: <20201121163416.136847-4-vlad_andrei.badoiu@upb.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)

On 21.11.20 17:34, Vlad-Andrei Badoiu wrote:
> We condition the gcc specific flags via have_gcc and the
> clang specific flags with have_clang.
> 
> Signed-off-by: Alice Suiu <alicesuiu17@gmail.com>
> Signed-off-by: Vlad-Andrei Badoiu <vlad_andrei.badoiu@upb.ro>
> ---
>   Makefile.uk                 | 17 ++++++++++++++---
>   arch/x86/x86_64/Makefile.uk |  9 ++++++---
>   2 files changed, 20 insertions(+), 6 deletions(-)
> 
> diff --git a/Makefile.uk b/Makefile.uk
> index 4f1c7642..54914b26 100644
> --- a/Makefile.uk
> +++ b/Makefile.uk
> @@ -6,7 +6,9 @@
>   
>   COMPFLAGS    += -nostdinc -nostdlib
>   COMPFLAGS    += -U __linux__ -U __FreeBSD__ -U __sun__
> -COMPFLAGS    += -fno-omit-frame-pointer -fno-tree-sra -fno-split-stack
> +COMPFLAGS    += -fno-omit-frame-pointer
> +COMPFLAGS-$(call have_gcc)	+= -fno-tree-sra -fno-split-stack
> +
>   ifneq ($(HAVE_STACKPROTECTOR),y)
>   COMPFLAGS    += -fno-stack-protector
>   endif
> @@ -22,10 +24,17 @@ 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	+= -nostdlib -Wl,--omagic -Wl,-r -Wl,-d -Wl,--build-id=none
> +LIBLDFLAGS-$(call have_gcc)	+= -nostdinc
> +LDFLAGS	+= -nostdlib -Wl,--omagic -Wl,--build-id=none
> +LDFLAGS-$(call have_gcc)	+= -nostdinc
>   
>   COMPFLAGS-$(CONFIG_OPTIMIZE_NONE)         += -O0 -fno-optimize-sibling-calls -fno-tree-vectorize
> +
> +ifeq ($(CONFIG_COMPILER), clang)
> +COMPFLAGS-$(CONFIG_OPTIMIZE_NONE):=$(filter-out -fno-tree-sra,$(COMPFLAGS-$(CONFIG_OPTIMIZE_NONE)))
> +endif
> +

I am not a fan of using filter-out for flags. My concern is that this 
could be easily missed when reading and debugging compile flags. But you 
could do something like this instead:

COMPFLAGS-$(CONFIG_OPTIMIZE_NONE) += -O0 -fno-optimize-sibling-calls
ifeq ($(call have_gcc),y)
COMPFLAGS-$(CONFIG_OPTIMIZE_NONE) += -fno-tree-vectorize
endif

>   COMPFLAGS-$(CONFIG_OPTIMIZE_SIZE)         += -Os
>   COMPFLAGS-$(CONFIG_OPTIMIZE_PERF)         += -O2
>   
> @@ -56,3 +65,5 @@ M4FLAGS      += -DUK_VERSION=$(UK_VERSION).$(UK_SUBVERSION)
>   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
> +
> +COMPFLAGS-$(call have_clang)	+=-fno-builtin -fno-PIC
> diff --git a/arch/x86/x86_64/Makefile.uk b/arch/x86/x86_64/Makefile.uk
> index 24919fb8..7af494d0 100644
> --- a/arch/x86/x86_64/Makefile.uk
> +++ b/arch/x86/x86_64/Makefile.uk
> @@ -1,7 +1,9 @@
>   ARCHFLAGS     += -D__X86_64__
> -ARCHFLAGS     += -m64 -mno-red-zone -fno-reorder-blocks -fno-asynchronous-unwind-tables
> +ARCHFLAGS     += -m64 -mno-red-zone -fno-asynchronous-unwind-tables
> +ARCHFLAGS-$(call have_gcc)	+= -fno-reorder-blocks
>   ISR_ARCHFLAGS += -D__X86_64__
> -ISR_ARCHFLAGS += -m64 -mno-red-zone -fno-reorder-blocks -fno-asynchronous-unwind-tables
> +ISR_ARCHFLAGS += -m64 -mno-red-zone -fno-asynchronous-unwind-tables
> +ISR_ARCHFLAGS-$(call have_gcc)	+= -fno-reorder-blocks
>   
>   CINCLUDES   += -I$(CONFIG_UK_BASE)/arch/x86/x86_64/include
>   ASINCLUDES  += -I$(CONFIG_UK_BASE)/arch/x86/x86_64/include
> @@ -9,7 +11,8 @@ CXXINCLUDES += -I$(CONFIG_UK_BASE)/arch/x86/x86_64/include
>   
>   # compiler flags to prevent use of extended (FP, SSE, AVX) registers.
>   # This is for files that contain trap/exception/interrupt handlers
> -ISR_ARCHFLAGS += -mno-80387 -mno-fp-ret-in-387 -mno-mmx -mno-sse -mno-avx
> +ISR_ARCHFLAGS += -mno-80387 -mno-mmx -mno-sse -mno-avx
> +ISR_ARCHFLAGS-$(call have_gcc)	+= -mno-fp-ret-in-387
>   ISR_ARCHFLAGS-$(call gcc_version_ge,7,1) += -mgeneral-regs-only
>   
>   ARCHFLAGS-$(CONFIG_MARCH_X86_64_GENERIC)        += -mtune=generic
> 


From minios-devel-bounces@lists.xenproject.org Tue Dec 15 16:45:26 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Tue, 15 Dec 2020 16:45:26 +0000
Received: from list by lists.xenproject.org with outflank-mailman.54651.95128 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1kpDS2-0001UT-3N; Tue, 15 Dec 2020 16:45:26 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 54651.95128; Tue, 15 Dec 2020 16:45: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 1kpDS1-0001UL-Vz; Tue, 15 Dec 2020 16:45:25 +0000
Received: by outflank-mailman (input) for mailman id 54651;
 Tue, 15 Dec 2020 16:45: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=mgel=FT=neclab.eu=simon.kuenzer@srs-us1.protection.inumbo.net>)
 id 1kpDS0-0001UG-Vl
 for minios-devel@lists.xen.org; Tue, 15 Dec 2020 16:45:25 +0000
Received: from mailer1.neclab.eu (unknown [195.37.70.40])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 322432d9-cced-4e4d-809d-f3db609c14da;
 Tue, 15 Dec 2020 16:45:23 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
 by mailer1.neclab.eu (Postfix) with ESMTP id BC6CD1003F1;
 Tue, 15 Dec 2020 17:45:22 +0100 (CET)
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 nawMcbGdFSrs; Tue, 15 Dec 2020 17:45:22 +0100 (CET)
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 960A610006C;
 Tue, 15 Dec 2020 17:45:22 +0100 (CET)
Received: from [10.7.2.36] (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, 15 Dec
 2020 17:45:22 +0100
X-BeenThere: minios-devel@lists.xenproject.org
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
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: 322432d9-cced-4e4d-809d-f3db609c14da
X-Virus-Scanned: Amavisd on Debian GNU/Linux (atlas-a.office.hd)
X-ENC: Last-Hop-TLS-encrypted
X-ENC: Last-Hop-TLS-encrypted
Subject: Re: [UNIKRAFT PATCH 1/3] build: Configure the compiler from command
 line
To: Vlad-Andrei Badoiu <vlad_andrei.badoiu@upb.ro>,
	<minios-devel@lists.xen.org>
CC: <razvan.deaconescu@cs.pub.ro>, Alice Suiu <alicesuiu17@gmail.com>
References: <20201121163416.136847-1-vlad_andrei.badoiu@upb.ro>
 <20201121163416.136847-2-vlad_andrei.badoiu@upb.ro>
From: Simon Kuenzer <simon.kuenzer@neclab.eu>
Message-ID: <07083cc9-a6f3-23ca-033f-37f3a53b9be3@neclab.eu>
Date: Tue, 15 Dec 2020 17:45:21 +0100
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0)
 Gecko/20100101 Thunderbird/78.5.1
MIME-Version: 1.0
In-Reply-To: <20201121163416.136847-2-vlad_andrei.badoiu@upb.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)

On 21.11.20 17:34, Vlad-Andrei Badoiu wrote:
> By default, the compiler is GCC. Use COMPILER=clang with make to configure the compiler as CLANG.
> 
> Signed-off-by: Alice Suiu <alicesuiu17@gmail.com>
> Signed-off-by: Vlad-Andrei Badoiu <vlad_andrei.badoiu@upb.ro>
> ---
>   Makefile | 13 +++++++++++--
>   1 file changed, 11 insertions(+), 2 deletions(-)
> 
> diff --git a/Makefile b/Makefile
> index 1f309b7d..b3ba38c4 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -544,11 +544,20 @@ ifneq ("$(origin CROSS_COMPILE)","undefined")
>   CONFIG_CROSS_COMPILE := $(CROSS_COMPILE:"%"=%)
>   endif
>   
> +# Use 'make COMPILER=clang' to compile with clang
> +ifeq ("$(origin COMPILER)", "command line")
> +  CONFIG_COMPILER := $(COMPILER)
> +endif
> +ifndef CONFIG_COMPILER
> +  CONFIG_COMPILER = gcc
> +endif
> +
> +

I think we should prefer a mechanism that works the same way as 
CROSS_COMPILE. This approach would be slightly more flexible (.config, 
environment variable, and command line) and would still cover your 
command line case:

ifneq ("$(origin COMPILER)","undefined")
CONFIG_COMPILER := $(COMPILER:"%"=%)
endif

We maybe need to add CONFIG_COMPILER to the `unexport` list (like we had 
to do for CONFIG_CROSS_COMPILE), but please double-check. It had to do 
with our nested sub-make call.

>   $(eval $(call verbose_include,$(CONFIG_UK_BASE)/arch/$(UK_FAMILY)/Compiler.uk))
>   
>   # Make variables (CC, etc...)
> -LD		:= $(CONFIG_CROSS_COMPILE)gcc
> -CC		:= $(CONFIG_CROSS_COMPILE)gcc
> +LD		:= $(CONFIG_CROSS_COMPILE)$(CONFIG_COMPILER)
> +CC		:= $(CONFIG_CROSS_COMPILE)$(CONFIG_COMPILER)
>   CPP		:= $(CC)
>   CXX		:= $(CPP)
>   GOC		:= $(CONFIG_CROSS_COMPILE)gccgo-7
> 

Btw, the AR and NM commands, are there clang variants available, too?

AR := $(CONFIG_CROSS_COMPILE)$(CONFIG_COMPILER)-ar
NM := $(CONFIG_CROSS_COMPILE)$(CONFIG_COMPILER)-nm

If I remember correctly, something like this was needed when enabling 
LTO with gcc.


From minios-devel-bounces@lists.xenproject.org Wed Dec 16 14:24:00 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Wed, 16 Dec 2020 14:24:00 +0000
Received: from list by lists.xenproject.org with outflank-mailman.55277.96318 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1kpXif-00013r-I8; Wed, 16 Dec 2020 14:23:57 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 55277.96318; Wed, 16 Dec 2020 14:23: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 1kpXif-00013k-FA; Wed, 16 Dec 2020 14:23:57 +0000
Received: by outflank-mailman (input) for mailman id 55277;
 Wed, 16 Dec 2020 14:23: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=5eiW=FU=arm.com=jianyong.wu@srs-us1.protection.inumbo.net>)
 id 1kpXid-00013f-KO
 for minios-devel@lists.xenproject.org; Wed, 16 Dec 2020 14:23:55 +0000
Received: from foss.arm.com (unknown [217.140.110.172])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTP
 id 0a8ca564-cb25-4f88-8960-d8ebc447ed5c;
 Wed, 16 Dec 2020 14:23:54 +0000 (UTC)
Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14])
 by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 955D731B;
 Wed, 16 Dec 2020 06:23:53 -0800 (PST)
Received: from localhost.localdomain (entos-thunderx2-desktop.shanghai.arm.com
 [10.169.212.206])
 by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id A82D33F66B;
 Wed, 16 Dec 2020 06:23:51 -0800 (PST)
X-BeenThere: minios-devel@lists.xenproject.org
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
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: 0a8ca564-cb25-4f88-8960-d8ebc447ed5c
From: Jianyong Wu <jianyong.wu@arm.com>
To: minios-devel@lists.xenproject.org,
	sharan.santhanam@neclab.eu,
	simon.kuenzer@neclab.eu
Cc: justin.he@arm.com,
	jianyong.wu@arm.com
Subject: [PATCH v2 0/2] arm/rtc: enable pl031 for arm64
Date: Wed, 16 Dec 2020 22:23:39 +0800
Message-Id: <20201216142341.164678-1-jianyong.wu@arm.com>
X-Mailer: git-send-email 2.17.1

RTC is important for arm64 to get wall time.
pl031 is the first choice for the most arm platform
even the virtual platform like qemu. Enable it here.

The rtc driver code depends on a fdt interface lies in Justin's
patch, so cover it in this patch set. Then this patch can
integrate into unikraft without dependency.

Change log:

v1 to v2:
	1) move general terms from pl031.c to rtc.c.
	2) add rtc_dev as ops function's parameter.
	3) address other comments from Sharan.
	4) include fdt patch from Justin to let this patch set be
independent.

Jia He (1):
  plat/ofw: add fdt_node_offset_idx_by_compatible_list

Jianyong Wu (1):
  arm/rtc: enable pl031 for arm64.

 plat/common/arm/time.c         |   3 +
 plat/drivers/include/ofw/fdt.h |  28 +++++
 plat/drivers/include/rtc/rtc.h |  75 +++++++++++
 plat/drivers/ofw/fdt.c         |  18 +++
 plat/drivers/rtc/pl031.c       | 223 +++++++++++++++++++++++++++++++++
 plat/drivers/rtc/rtc.c         | 189 ++++++++++++++++++++++++++++
 plat/kvm/Config.uk             |   5 +
 plat/kvm/Makefile.uk           |  12 +-
 8 files changed, 552 insertions(+), 1 deletion(-)
 create mode 100644 plat/drivers/include/rtc/rtc.h
 create mode 100644 plat/drivers/rtc/pl031.c
 create mode 100644 plat/drivers/rtc/rtc.c

-- 
2.17.1



From minios-devel-bounces@lists.xenproject.org Wed Dec 16 14:24:02 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Wed, 16 Dec 2020 14:24:02 +0000
Received: from list by lists.xenproject.org with outflank-mailman.55278.96321 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1kpXik-00014b-Jv; Wed, 16 Dec 2020 14:24:02 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 55278.96321; Wed, 16 Dec 2020 14:24: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 1kpXik-00014U-Gg; Wed, 16 Dec 2020 14:24:02 +0000
Received: by outflank-mailman (input) for mailman id 55278;
 Wed, 16 Dec 2020 14:24: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=5eiW=FU=arm.com=jianyong.wu@srs-us1.protection.inumbo.net>)
 id 1kpXii-00013f-I8
 for minios-devel@lists.xenproject.org; Wed, 16 Dec 2020 14:24:00 +0000
Received: from foss.arm.com (unknown [217.140.110.172])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTP
 id b87c3744-cc49-4a0b-9a33-1d2a2b5b0d49;
 Wed, 16 Dec 2020 14:23:56 +0000 (UTC)
Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14])
 by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 02F49D6E;
 Wed, 16 Dec 2020 06:23:56 -0800 (PST)
Received: from localhost.localdomain (entos-thunderx2-desktop.shanghai.arm.com
 [10.169.212.206])
 by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 2010E3F66B;
 Wed, 16 Dec 2020 06:23:53 -0800 (PST)
X-BeenThere: minios-devel@lists.xenproject.org
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
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: b87c3744-cc49-4a0b-9a33-1d2a2b5b0d49
From: Jianyong Wu <jianyong.wu@arm.com>
To: minios-devel@lists.xenproject.org,
	sharan.santhanam@neclab.eu,
	simon.kuenzer@neclab.eu
Cc: justin.he@arm.com,
	jianyong.wu@arm.com
Subject: [PATCH 1/2] plat/ofw: add fdt_node_offset_idx_by_compatible_list
Date: Wed, 16 Dec 2020 22:23:40 +0800
Message-Id: <20201216142341.164678-2-jianyong.wu@arm.com>
X-Mailer: git-send-email 2.17.1
In-Reply-To: <20201216142341.164678-1-jianyong.wu@arm.com>
References: <20201216142341.164678-1-jianyong.wu@arm.com>

From: Jia He <justin.he@arm.com>

The helper fdt_node_offset_idx_by_compatible_list is similar as
fdt_node_offset_by_compatible_list except that it returns the index
of compatible_list[] array when compatible string is matched.
This is useful when supporting multiple types of platform devices on
arm64.

Signed-off-by: Jia He <justin.he@arm.com>
---
 plat/drivers/include/ofw/fdt.h | 28 ++++++++++++++++++++++++++++
 plat/drivers/ofw/fdt.c         | 18 ++++++++++++++++++
 2 files changed, 46 insertions(+)

diff --git a/plat/drivers/include/ofw/fdt.h b/plat/drivers/include/ofw/fdt.h
index 6f80a27..e8d20da 100644
--- a/plat/drivers/include/ofw/fdt.h
+++ b/plat/drivers/include/ofw/fdt.h
@@ -118,6 +118,34 @@ int fdt_get_address(const void *fdt, int nodeoffset, uint32_t index,
 int fdt_node_offset_by_compatible_list(const void *fdt, int startoffset,
 					const char * const compatibles[]);
 
+/**
+ * fdt_node_offset_idx_by_compatible_list - find nodes with a given
+ *                                     'compatible' list value, and return
+ *                                     index of compatible array
+ * @fdt: pointer to the device tree blob
+ * @startoffset: only find nodes after this offset
+ * @compatibles: a list of 'compatible' string to match, should be ended
+ * with NULL string.
+ * @idx the index of compatible array
+ * fdt_node_offset_idx_by_compatible_list() returns the offset of the
+ * first matched node after startoffset, which has a 'compatible'
+ * property which lists the given compatible string; or if
+ * startoffset is -1, the very first such node in the tree.
+ *
+ * returns:
+ *     structure block offset of the located node (>= 0, >startoffset),
+ *              on success
+ *     -FDT_ERR_NOTFOUND, no node matching the criterion exists in the
+ *             tree after startoffset
+ *     -FDT_ERR_BADOFFSET, nodeoffset does not refer to a BEGIN_NODE tag
+ *     -FDT_ERR_BADMAGIC,
+ *     -FDT_ERR_BADVERSION,
+ *     -FDT_ERR_BADSTATE,
+ *     -FDT_ERR_BADSTRUCTURE, standard meanings
+ */
+int fdt_node_offset_idx_by_compatible_list(const void *fdt, int startoffset,
+				const char * const compatibles[], int *index);
+
 /**
  * fdt_get_interrupt - retrieve device interrupt of a given index
  * @fdt: pointer to the device tree blob
diff --git a/plat/drivers/ofw/fdt.c b/plat/drivers/ofw/fdt.c
index 76f8ff3..5413fdf 100644
--- a/plat/drivers/ofw/fdt.c
+++ b/plat/drivers/ofw/fdt.c
@@ -256,6 +256,24 @@ int fdt_node_offset_by_compatible_list(const void *fdt, int startoffset,
 	return -FDT_ERR_NOTFOUND;
 }
 
+int fdt_node_offset_idx_by_compatible_list(const void *fdt, int startoffset,
+			  const char * const compatibles[], int *index)
+{
+	int idx, offset;
+
+	for (idx = 0; compatibles[idx] != NULL; idx++) {
+		offset = fdt_node_offset_by_compatible(fdt, startoffset,
+				  compatibles[idx]);
+		if (offset >= 0) {
+			*index = idx;
+			return offset;
+		}
+	}
+
+	*index = idx;
+	return -FDT_ERR_NOTFOUND;
+}
+
 int fdt_get_interrupt(const void *fdt, int nodeoffset,
 			uint32_t index, int *size, fdt32_t **prop)
 {
-- 
2.17.1



From minios-devel-bounces@lists.xenproject.org Wed Dec 16 14:24:03 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Wed, 16 Dec 2020 14:24:03 +0000
Received: from list by lists.xenproject.org with outflank-mailman.55279.96326 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1kpXil-00015E-LE; Wed, 16 Dec 2020 14:24:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 55279.96326; Wed, 16 Dec 2020 14:24: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 1kpXil-000156-IC; Wed, 16 Dec 2020 14:24:03 +0000
Received: by outflank-mailman (input) for mailman id 55279;
 Wed, 16 Dec 2020 14:24: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=5eiW=FU=arm.com=jianyong.wu@srs-us1.protection.inumbo.net>)
 id 1kpXij-00014N-NX
 for minios-devel@lists.xenproject.org; Wed, 16 Dec 2020 14:24:01 +0000
Received: from foss.arm.com (unknown [217.140.110.172])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTP
 id b6bb2786-f976-4a9c-9bdf-5d99fc4808e9;
 Wed, 16 Dec 2020 14:23:59 +0000 (UTC)
Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14])
 by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id EA7DD1042;
 Wed, 16 Dec 2020 06:23:58 -0800 (PST)
Received: from localhost.localdomain (entos-thunderx2-desktop.shanghai.arm.com
 [10.169.212.206])
 by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 834C63F66B;
 Wed, 16 Dec 2020 06:23:56 -0800 (PST)
X-BeenThere: minios-devel@lists.xenproject.org
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
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: b6bb2786-f976-4a9c-9bdf-5d99fc4808e9
From: Jianyong Wu <jianyong.wu@arm.com>
To: minios-devel@lists.xenproject.org,
	sharan.santhanam@neclab.eu,
	simon.kuenzer@neclab.eu
Cc: justin.he@arm.com,
	jianyong.wu@arm.com,
	Wei Chen <wei.chen@arm.com>
Subject: [PATCH v2 2/2] arm/rtc: enable pl031 for arm64.
Date: Wed, 16 Dec 2020 22:23:41 +0800
Message-Id: <20201216142341.164678-3-jianyong.wu@arm.com>
X-Mailer: git-send-email 2.17.1
In-Reply-To: <20201216142341.164678-1-jianyong.wu@arm.com>
References: <20201216142341.164678-1-jianyong.wu@arm.com>

Currently, rtc is not enabled in arm, so wall time can't
be provided currectly.
pl031 is chosen as the rtc device for arm in this patch, but
we have interface extension of capable of plugging other rtc device.

Signed-off-by: Wei Chen <wei.chen@arm.com>
Signed-off-by: Jianyong Wu <jianyong.wu@arm.com>
---
 plat/common/arm/time.c         |   3 +
 plat/drivers/include/rtc/rtc.h |  75 +++++++++++
 plat/drivers/rtc/pl031.c       | 223 +++++++++++++++++++++++++++++++++
 plat/drivers/rtc/rtc.c         | 189 ++++++++++++++++++++++++++++
 plat/kvm/Config.uk             |   5 +
 plat/kvm/Makefile.uk           |  12 +-
 6 files changed, 506 insertions(+), 1 deletion(-)
 create mode 100644 plat/drivers/include/rtc/rtc.h
 create mode 100644 plat/drivers/rtc/pl031.c
 create mode 100644 plat/drivers/rtc/rtc.c

diff --git a/plat/common/arm/time.c b/plat/common/arm/time.c
index bbb3c72..5562a0e 100644
--- a/plat/common/arm/time.c
+++ b/plat/common/arm/time.c
@@ -43,6 +43,7 @@
 #include <ofw/gic_fdt.h>
 #include <uk/plat/common/irq.h>
 #include <gic/gic-v2.h>
+#include <rtc/rtc.h>
 #include <arm/time.h>
 
 /* TODO: For now this file is KVM dependent. As soon as we have more
@@ -150,4 +151,6 @@ void ukplat_time_init(void)
 
 	/* Enable timer */
 	generic_timer_enable();
+	/* Initialize rtc */
+	_dtb_init_rtc(_libkvmplat_cfg.dtb);
 }
diff --git a/plat/drivers/include/rtc/rtc.h b/plat/drivers/include/rtc/rtc.h
new file mode 100644
index 0000000..9f00b02
--- /dev/null
+++ b/plat/drivers/include/rtc/rtc.h
@@ -0,0 +1,75 @@
+/* SPDX-License-Identifier: BSD-3-Clause */
+/*
+ * Authors: Wei Chen <Wei.Chen@arm.com>
+ *          Jianyong Wu <Jianyong.Wu@arm.com>
+ *
+ * Copyright (c) 2019, Arm Ltd. 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 __PLAT_KVM_ARM_RTC_H__
+#define __PLAT_KVM_ARM_RTC_H__
+
+#define RTC_ENABLE 1
+#define RTC_DISABLE 0
+
+struct rtc_time {
+	int year;
+	int mon;
+	int day;
+	int hour;
+	int min;
+	int sec;
+};
+
+struct rtc_dev {
+	char *name;
+	int id;
+	const struct rtc_ops *ops;
+};
+
+struct rtc_ops {
+	void (*enable)(struct rtc_dev *, unsigned int);
+	int (*status)(struct rtc_dev *);
+	void (*read_time)(struct rtc_dev *, struct rtc_time *);
+	void (*write_time)(struct rtc_dev *, struct rtc_time *);
+	void (*read_alarm)(struct rtc_dev *, struct rtc_time *);
+	void (*write_alarm)(struct rtc_dev *, struct rtc_time *);
+	uint32_t (*rtc_boot_tick_get)(struct rtc_dev *);
+	void (*alarm_irq_enable)(struct rtc_dev *, unsigned int);
+	int (*irq_handler)(void *);
+};
+
+void _dtb_init_rtc(void *arg);
+void rtc_raw_to_tm(uint32_t raw, struct rtc_time *tm);
+uint32_t rtc_tm_to_raw(struct rtc_time *tm);
+
+extern uint32_t rtc_boot_seconds;
+extern struct rtc_dev rtc_pl031;
+
+#endif //__PLAT_KVM_ARM_RTC_H__
diff --git a/plat/drivers/rtc/pl031.c b/plat/drivers/rtc/pl031.c
new file mode 100644
index 0000000..fe958b9
--- /dev/null
+++ b/plat/drivers/rtc/pl031.c
@@ -0,0 +1,223 @@
+/* SPDX-License-Identifier: BSD-3-Clause */
+/*
+ * Authors: Wei Chen <Wei.Chen@arm.com>
+ *          Jianyong Wu <Jianyong.Wu@arm.com>
+ *
+ * Copyright (c) 2018, Arm Ltd. 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 <string.h>
+#include <libfdt.h>
+#include <stdio.h>
+#include <uk/assert.h>
+#include <uk/essentials.h>
+#include <uk/print.h>
+#include <uk/list.h>
+#include <arm/cpu.h>
+#include <ofw/fdt.h>
+#include <rtc/rtc.h>
+#include <gic/gic-v2.h>
+#include <ofw/gic_fdt.h>
+#include <uk/plat/common/irq.h>
+
+extern uint64_t rtc_base_addr;
+
+/* Define offset of PL031 registers */
+#define RTC_DR		0
+#define RTC_MR		0x4
+#define RTC_LR		0x8
+#define RTC_CR		0xc
+#define RTC_IMSC	0x10
+#define RTC_RIS		0x14
+#define RTC_MIS		0x18
+#define RTC_ICR		0x1c
+
+#define PL031_REG(r)	(void *)(rtc_base_addr + (r))
+
+static uint32_t pl031_read_raw(void)
+{
+	return ioreg_read32(PL031_REG(RTC_DR));
+}
+
+static void pl031_read_time(struct rtc_dev *dev, struct rtc_time *rt)
+{
+	uint32_t raw;
+
+	if (!dev || strcmp(dev->name, "rtc_pl031")) {
+		uk_pr_warn("%s: rtc device should be rtc_pl031\n", __func__);
+		return;
+	}
+
+	raw = pl031_read_raw();
+	rtc_raw_to_tm(raw, rt);
+}
+
+static void pl031_write_raw(uint32_t val)
+{
+	ioreg_write32(PL031_REG(RTC_LR), val);
+}
+
+static void pl031_write_time(struct rtc_dev *dev, struct rtc_time *rt)
+{
+	uint32_t raw;
+
+	if (!dev || strcmp(dev->name, "rtc_pl031")) {
+		uk_pr_warn("%s: rtc device should be rtc_pl031\n", __func__);
+		return;
+	}
+
+	raw = rtc_tm_to_raw(rt);
+	pl031_write_raw(raw);
+}
+
+/*
+ * set rtc match register comparing with counter
+ * value to generat a interrupt
+ */
+static void pl031_write_alarm_raw(uint32_t alarm)
+{
+	ioreg_write32(PL031_REG(RTC_MR), alarm);
+}
+
+static void pl031_write_alarm(struct rtc_dev *dev, struct rtc_time *rt)
+{
+	uint32_t raw;
+
+	if (!dev || strcmp(dev->name, "rtc_pl031")) {
+		uk_pr_warn("%s: rtc device should be rtc_pl031\n", __func__);
+		return;
+	}
+
+	raw = rtc_tm_to_raw(rt);
+	pl031_write_alarm_raw(raw);
+}
+
+static uint32_t pl031_read_alarm_raw(void)
+{
+	return ioreg_read32(PL031_REG(RTC_MR));
+}
+
+uint32_t pl031_boot_tick_get(struct rtc_dev *dev)
+{
+	if (!dev || strcmp(dev->name, "rtc_pl031"))
+		uk_pr_warn("%s: rtc device should be rtc_pl031, return boot time from pl031 instead\n",
+			    __func__);
+
+	return pl031_read_raw();
+}
+
+static void pl031_read_alarm(struct rtc_dev *dev, struct rtc_time *rt)
+{
+	if (!dev || strcmp(dev->name, "rtc_pl031")) {
+		uk_pr_warn("%s: rtc device should be rtc_pl031\n", __func__);
+		return;
+	}
+
+	rtc_raw_to_tm(pl031_read_alarm_raw(), rt);
+}
+
+/*
+ * If pl031 is not enabled, enable it by write 1 to RTC_CR, otherwise
+ * do nothing.
+ */
+static void pl031_enable(struct rtc_dev *dev, unsigned int enable)
+{
+	if (!dev || strcmp(dev->name, "rtc_pl031")) {
+		uk_pr_warn("%s: rtc device should be rtc_pl031\n", __func__);
+		return;
+	}
+
+	ioreg_write32(PL031_REG(RTC_CR), enable);
+}
+
+/*
+ * return rtc status, 1 denotes enable and 0 denotes disable,
+ * -1 denotes wrong device
+ */
+static int pl031_get_status(struct rtc_dev *dev)
+{
+	int val;
+
+	if (!dev || strcmp(dev->name, "rtc_pl031")) {
+		uk_pr_warn("%s: rtc device should be rtc_pl031\n", __func__);
+		return -1;
+	}
+
+	val = ioreg_read32(PL031_REG(RTC_CR));
+	val &= RTC_ENABLE;
+	return val;
+}
+
+/* enable alarm irq, 1 denotes enable, 2 denotes disable */
+static void pl031_enable_intr(struct rtc_dev *dev, unsigned int enable)
+{
+	if (!dev || strcmp(dev->name, "rtc_pl031")) {
+		uk_pr_warn("%s: rtc device should be rtc_pl031\n", __func__);
+		return;
+	}
+
+	ioreg_write32(PL031_REG(RTC_IMSC), enable);
+}
+
+static uint32_t pl031_get_raw_intr_state(void)
+{
+	return ioreg_read32(PL031_REG(RTC_RIS));
+}
+
+static void pl031_clear_intr(void)
+{
+	while (pl031_get_raw_intr_state())
+		ioreg_write32(PL031_REG(RTC_ICR), 1);
+}
+
+/* wait for platform device framework to register this handler */
+int pl031_irq_handler(void *arg __unused)
+{
+	pl031_clear_intr();
+	// TODO: do something real
+
+	return 1;
+}
+
+static const struct rtc_ops ops_pl031 = {
+	.enable			= pl031_enable,
+	.status			= pl031_get_status,
+	.read_time		= pl031_read_time,
+	.write_time		= pl031_write_time,
+	.read_alarm		= pl031_read_alarm,
+	.write_alarm		= pl031_write_alarm,
+	.rtc_boot_tick_get	= pl031_boot_tick_get,
+	.alarm_irq_enable	= pl031_enable_intr,
+	.irq_handler		= pl031_irq_handler,
+};
+
+struct rtc_dev rtc_pl031 = {
+	.name	= "rtc_pl031",
+	.id	= 0,
+	.ops	= &ops_pl031,
+};
diff --git a/plat/drivers/rtc/rtc.c b/plat/drivers/rtc/rtc.c
new file mode 100644
index 0000000..1185ed4
--- /dev/null
+++ b/plat/drivers/rtc/rtc.c
@@ -0,0 +1,189 @@
+/* SPDX-License-Identifier: BSD-3-Clause */
+/*
+ * Authors: Wei Chen <Wei.Chen@arm.com>
+ *          Jianyong Wu <Jianyong.Wu@arm.com>
+ *
+ * Copyright (c) 2018, Arm Ltd. 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 <string.h>
+#include <libfdt.h>
+#include <stdio.h>
+#include <uk/essentials.h>
+#include <arm/cpu.h>
+#include <rtc/rtc.h>
+#include <ofw/fdt.h>
+#include <gic/gic-v2.h>
+#include <ofw/gic_fdt.h>
+#include <uk/plat/common/irq.h>
+
+#define RTC_DEV_NUM 1
+
+uint64_t rtc_base_addr;
+uint32_t rtc_boot_seconds;
+
+const int day_per_mon[12] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
+const char * const rtc_device_list[] = {
+	"arm,pl031",
+};
+
+void rtc_raw_to_tm(uint32_t raw, struct rtc_time *rt)
+{
+	int hour, days, years, dy4, dy100, dy400, normal_days,
+			day_in_year, sum = 0, leap;
+
+	rt->sec = raw % 60;
+	rt->min = (raw % (60 * 60)) / 60;
+	hour = raw / 60 / 60;
+	days =  hour / 24;
+	rt->hour = hour % 24;
+	/*
+	 * total days for every continue 4-years, assuming there is a leap
+	 * year among every 4 years.
+	 */
+	dy4 = 365 * 3 + 366;
+	// total days for every continue 100-years.
+	dy100 = 25 * dy4 - 1;
+	// total days for every continue 400-years.
+	dy400 = dy100 * 4 + 1;
+	// normalize the days by get rid of the additional day in leap year
+	normal_days = days - days / dy4 + days / dy100 + days / dy400;
+	years = normal_days / 365;
+	rt->year = 1970 + years;
+	leap = ((!(rt->year % 4) && (rt->year % 100)) || !(rt->year % 400));
+	day_in_year =  normal_days - years * 365;
+	/*
+	 * if the residue days larger than the sum of the first two month
+	 * we should consider Feb,29.
+	 */
+	sum += leap * (day_in_year >= (day_per_mon[0] + day_per_mon[1]));
+	for (int i = 0; i < 12; i++) {
+		sum += day_per_mon[i];
+		if (day_in_year < sum) {
+			rt->mon = i + 1;
+			rt->day = day_in_year - (sum - day_per_mon[i]) + 1;
+			break;
+		}
+	}
+}
+
+uint32_t rtc_tm_to_raw(struct rtc_time *rt)
+{
+	int leaps, leap, days, sec;
+
+	leaps = (rt->year - 1970) / 4 - (rt->year - 1970) / 100 +
+			(rt->year - 1970) / 400;
+	leap = ((!(rt->year % 4) && (rt->year % 100)) || !(rt->year % 400));
+	days = (rt->year - 1970) * 365 + leaps;
+	if (rt->mon == 1) {
+		days += day_per_mon[0];
+	} else {
+		for (int i = 0; i < rt->mon - 1; i++)
+			days += day_per_mon[i];
+	}
+	days += rt->day + (rt->mon > 2) * leap - 1;
+	sec = days * 3600 * 24 + rt->hour * 3600 + rt->min * 60 + rt->sec;
+
+	return sec;
+}
+
+struct rtc_dev *rtc_list[RTC_DEV_NUM];
+
+static void rtc_dev_register(struct rtc_dev *dev)
+{
+	rtc_list[dev->id] = dev;
+}
+
+void _dtb_init_rtc(void *dtb)
+{
+	uint64_t size;
+	uint32_t irq_type, hwirq, trigger_type;
+	int fdt_rtc, ret, index, irq, rc;
+
+	uk_pr_info("Probing RTC...\n");
+	/*
+	 * We choose the first available rtc device in device list as the
+	 * system rtc.
+	 */
+	fdt_rtc = fdt_node_offset_idx_by_compatible_list(dtb, -1,
+			rtc_device_list, &index);
+	if (fdt_rtc < 0) {
+		uk_pr_err("Could not find rtc device!, fdt_rtc is %d\n",
+			fdt_rtc);
+		return;
+	}
+
+	ret = fdt_get_address(dtb, fdt_rtc, 0, &rtc_base_addr, &size);
+	if (ret < 0) {
+		uk_pr_err("Could not get rtc address\n");
+		return;
+	}
+
+	rc = gic_get_irq_from_dtb(dtb, fdt_rtc, 0, &irq_type, &hwirq,
+			&trigger_type);
+	if (rc < 0) {
+		uk_pr_err("Failed to find IRQ number from DTB\n");
+		return;
+	}
+
+	irq = gic_irq_translate(irq_type, hwirq);
+	if (irq < 0 || irq >= __MAX_IRQ) {
+		uk_pr_err("Failed to translate IRQ number\n");
+		return;
+	}
+
+	rc = ukplat_irq_register(irq, rtc_list[index]->ops->irq_handler, NULL);
+	if (rc < 0) {
+		uk_pr_err("Failed to register rtc interrupt handler\n");
+		return;
+	}
+
+	switch (index) {
+	case 0:
+		rtc_dev_register(&rtc_pl031);
+		break;
+	default:
+		uk_pr_err("No rtc device found to register\n");
+		return;
+	}
+
+	if (rtc_list[index]->ops->status(rtc_list[index]) == RTC_DISABLE)
+		rtc_list[index]->ops->enable(rtc_list[index], RTC_ENABLE);
+
+	if (rtc_list[index]->ops->status(rtc_list[index]) != RTC_ENABLE) {
+		uk_pr_err("Fail to enable rtc\n");
+		return;
+	}
+	/* Record the boot seconds */
+	rtc_boot_seconds = rtc_list[index]->ops->rtc_boot_tick_get(rtc_list[index]);
+	/* Disable rtc alarm irq at its reset */
+	rtc_list[index]->ops->alarm_irq_enable(rtc_list[index], RTC_DISABLE);
+
+	uk_pr_info("Found RTC on: %lu\n", rtc_base_addr);
+}
diff --git a/plat/kvm/Config.uk b/plat/kvm/Config.uk
index 3372b6c..1bf72f3 100644
--- a/plat/kvm/Config.uk
+++ b/plat/kvm/Config.uk
@@ -133,6 +133,11 @@ config LIBGICV2
        select LIBOFW
        depends on ARCH_ARM_64
 
+config LIBPL031
+       bool "Arm platform rtc device driver"
+       default y if ARCH_ARM_64
+       depends on ARCH_ARM_64
+
 config LIBOFW
        bool "Open Firmware library support"
        default n
diff --git a/plat/kvm/Makefile.uk b/plat/kvm/Makefile.uk
index 94321e0..03711b4 100644
--- a/plat/kvm/Makefile.uk
+++ b/plat/kvm/Makefile.uk
@@ -14,7 +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,libkvmpl031,$(CONFIG_LIBPL031)))
 ##
 ## Platform library definitions
 ##
@@ -182,3 +182,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
+
+##
+## RTC-PL031 library definitions
+##
+LIBKVMPL031_CINCLUDES-y		+= -I$(LIBKVMPLAT_BASE)/include
+LIBKVMPL031_CINCLUDES-y		+= -I$(UK_PLAT_COMMON_BASE)/include
+LIBKVMPL031_CINCLUDES-y		+= -I$(UK_PLAT_DRIVERS_BASE)/include
+
+LIBKVMPL031_SRCS-y		+= $(UK_PLAT_DRIVERS_BASE)/rtc/pl031.c
+LIBKVMPL031_SRCS-y		+= $(UK_PLAT_DRIVERS_BASE)/rtc/rtc.c
-- 
2.17.1



From minios-devel-bounces@lists.xenproject.org Thu Dec 17 12:12:30 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Thu, 17 Dec 2020 12:12:30 +0000
Received: from list by lists.xenproject.org with outflank-mailman.55587.97505 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1kps8y-0008Ml-CN; Thu, 17 Dec 2020 12:12:28 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 55587.97505; Thu, 17 Dec 2020 12:12: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 1kps8y-0008Me-9A; Thu, 17 Dec 2020 12:12:28 +0000
Received: by outflank-mailman (input) for mailman id 55587;
 Wed, 16 Dec 2020 20:40: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=+HcR=FU=gmail.com=virtanrazvan@srs-us1.protection.inumbo.net>)
 id 1kpdak-0007Cq-Tn
 for minios-devel@lists.xen.org; Wed, 16 Dec 2020 20:40:10 +0000
Received: from mail-ej1-x633.google.com (unknown [2a00:1450:4864:20::633])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 8e0a522a-f88b-44ff-bdaf-8a35ff5f8cbf;
 Wed, 16 Dec 2020 20:40:09 +0000 (UTC)
Received: by mail-ej1-x633.google.com with SMTP id qw4so34651963ejb.12
 for <minios-devel@lists.xen.org>; Wed, 16 Dec 2020 12:40:09 -0800 (PST)
Received: from razvan-Lenovo-Legion-Y530-15ICH.local
 ([2a02:2f08:c107:2400:11f4:b70:cbfb:4ba1])
 by smtp.gmail.com with ESMTPSA id s24sm2162434ejb.20.2020.12.16.12.40.08
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Wed, 16 Dec 2020 12:40:08 -0800 (PST)
X-BeenThere: minios-devel@lists.xenproject.org
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
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: 8e0a522a-f88b-44ff-bdaf-8a35ff5f8cbf
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;
        bh=m7/H6eoqpIlXWUxNbPECVfJsjSeIwgEViRk/ysIMJXA=;
        b=Slh31s/SqfR//0bCAzl3lU9a69j48YSLhitXJVcX7We17ceysUl0y4hsgCehddZQPl
         Ipa3MNiNh86DmHhUxO/sHxRrqODtuM439suQlKZ89LJhGr5zLADeFdH4OniOdJhr2Oel
         zLtQ+y3i3B/c9oQ7/ujcxYQXRC1Ov4blhpTuOf82d/Qus/YSEIG7p58OmxD7r41OA2RB
         Wq3HUL6F4JYO14HHtzFE7ZndagaXSH5Ea0PqMbzGglyI9pmVWXjnQPfZg+oBwOJLz0As
         qHC/i5Cb5pJX2929FzpAmlOVZvngARO3ifOwo6lF8JIIMSfvepVf1/lUqkJp/ZPmdG6g
         JRNQ==
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;
        bh=m7/H6eoqpIlXWUxNbPECVfJsjSeIwgEViRk/ysIMJXA=;
        b=SrUYdzfXHih7lptHSw9B62f+6M4KcAlSkgPTstHSiHgEy3Z+NbTL3JhdKJd8nmP26n
         /+D7pjIx8zHPNXeQmTh0Z5QztWvXoSn1uZlpEAyYWtddnvTs4xmy6TlooU274IslbXhW
         XV1dT93tldVLuHBZ9V3fAUqarMIvDnw/vBij8qtHvhJ01lLMj6roMuPUu6PNCdXia/ft
         KkbfJRfHGeY6RacyIZ4K3YciX6lbaqmdZjLffE3j0OKiQwkOETE2Plefy/u7kFHzZwd8
         BWW/dDynRg+gSwurrdrqotVPuQLIhR2Nag3OLBTvEBfqH+N97rcrZg3+srO9wpzi4jNs
         1PQw==
X-Gm-Message-State: AOAM531dO7zQGxZpoFqu6AI73OinEyvkg065bqFgU9dvphtHHIXQSvaP
	D5+4+pxBuvgtyae8MyZsfhdkzd1E2+uQHQ==
X-Google-Smtp-Source: ABdhPJwG2sTMBP3wQVLuXGtyjMDcCdbdtFQTFzThPuSveCgt+o3Ui+VaTvna1obUn9gFfBwlCU1Sew==
X-Received: by 2002:a17:906:30c4:: with SMTP id b4mr23300531ejb.456.1608151208916;
        Wed, 16 Dec 2020 12:40:08 -0800 (PST)
From: Razvan Virtan <virtanrazvan@gmail.com>
X-Google-Original-From: Razvan Virtan <razvanvirtan@gmail.com>
To: a.jung@lancs.ac.uk
Cc: minios-devel@lists.xen.org
Subject: Re: [UNIKRAFT/LIB-NEWLIB PATCH] Makefile.uk: Include unix basename and dirname
Date: Wed, 16 Dec 2020 22:40:06 +0200
Message-Id: <20201216204006.7450-1-razvanvirtan@gmail.com>
X-Mailer: git-send-email 2.17.1
In-Reply-To: <20200811162723.30929-1-a.jung@lancs.ac.uk>
References: <20200811162723.30929-1-a.jung@lancs.ac.uk>

I've tested basename() and dirname() on KVM and linuxu and everything works as expected.
Also, the added lines follow the Makefile.uk format.

Reviewed-by: Razvan Virtan <virtanrazvan@gmail.com> 


From minios-devel-bounces@lists.xenproject.org Thu Dec 17 21:32:21 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Thu, 17 Dec 2020 21:32:21 +0000
Received: from list by lists.xenproject.org with outflank-mailman.56192.98192 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1kq0sl-0000UL-7d; Thu, 17 Dec 2020 21:32:19 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 56192.98192; Thu, 17 Dec 2020 21:32: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 1kq0sl-0000UE-4Y; Thu, 17 Dec 2020 21:32:19 +0000
Received: by outflank-mailman (input) for mailman id 56192;
 Thu, 17 Dec 2020 21:32: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=XS7E=FV=neclab.eu=simon.kuenzer@srs-us1.protection.inumbo.net>)
 id 1kq0sk-0000U9-4N
 for minios-devel@lists.xen.org; Thu, 17 Dec 2020 21:32:18 +0000
Received: from mailer2.neclab.eu (unknown [195.37.70.41])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 59438745-dc05-4f35-bd09-bb3ec94fb938;
 Thu, 17 Dec 2020 21:32:15 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
 by mailer2.neclab.eu (Postfix) with ESMTP id 6E573F25BA;
 Thu, 17 Dec 2020 22:32:12 +0100 (CET)
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 7Ss4ZTkF57dk; Thu, 17 Dec 2020 22:32:12 +0100 (CET)
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 231E5F2527;
 Thu, 17 Dec 2020 22:32:08 +0100 (CET)
Received: from [10.7.2.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.2044.4; Thu, 17 Dec
 2020 22:32:07 +0100
X-BeenThere: minios-devel@lists.xenproject.org
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
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: 59438745-dc05-4f35-bd09-bb3ec94fb938
X-Virus-Scanned: Amavisd on Debian GNU/Linux (atlas-b.office.hd)
X-ENC: Last-Hop-TLS-encrypted
X-ENC: Last-Hop-TLS-encrypted
Subject: Re: [UNIKRAFT PATCH 1/2] Add support for compilation of D sources
To: Marius-Cristian Baciu <2309bmcristi@gmail.com>,
	<minios-devel@lists.xen.org>
References: <20200721133800.27291-1-2309bmcristi@gmail.com>
From: Simon Kuenzer <simon.kuenzer@neclab.eu>
Message-ID: <a0214860-fab4-fa3e-92e6-1bc4e63c34f3@neclab.eu>
Date: Thu, 17 Dec 2020 22:32:07 +0100
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0)
 Gecko/20100101 Thunderbird/78.5.1
MIME-Version: 1.0
In-Reply-To: <20200721133800.27291-1-2309bmcristi@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)

Hi Marius-Cristian,

thanks a lot for your work! I am actually wondering if we should rather 
move this to a D language support library instead of maintaining it with 
the core Unikraft repository - especially if a language runtime library 
is anyway required (is this true?). It is also planned that we move the 
GO compile rules out of the main repository. I am concerned that at some 
point we have too many languages to maintain within the core Unikraft 
repository. What do you think?
In general, a language support library, would have a file called 
`Makefile.rules`. It will be automatically loaded by the build system 
and you can take your compile rules for D sources there.

Sorry for this naive question (I am obviously not an D expert): Can the 
D compiler be used to compile our C sources (e.g., by using the betterC 
subset)? In such a case, we could provide a D compiler option with a 
mechanism that is currently suggested for supporting clang compiler:
https://patchwork.unikraft.org/project/unikraft/list/?series=1584&state=*

In case that this could be even completely done without needing any 
runtime library, then we should have enough justifaction to integrate D 
support into the core repository.

Let me know what you think.

Thanks,

Simon

On 21.07.20 15:37, Marius-Cristian Baciu wrote:
> Use 'make D_COMPILER=gdc' for compilation of programs using full-language
> capabilities and 'make D_COMPILER=dmd' for programs using the betterC subset
> ---
>   Makefile                     | 15 +++++++++--
>   Makefile.uk                  | 16 ++++++++++++
>   support/build/Makefile.rules | 48 +++++++++++++++++++++++++++++++++++-
>   3 files changed, 76 insertions(+), 3 deletions(-)
> 
> diff --git a/Makefile b/Makefile
> index 725b012..493ac7b 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -277,6 +277,14 @@ GOCFLAGS :=
>   GOCFLAGS-y :=
>   GOCINCLUDES :=
>   GOCINCLUDES-y :=
> +DMDFLAGS :=
> +DMDFLAGS-y :=
> +DMDINCLUDES :=
> +DMDINCLUDES-y :=
> +GDCFLAGS :=
> +GDCFLAGS-y :=
> +GDCINCLUDES :=
> +GDCINCLUDES-y :=
>   DBGFLAGS :=
>   DBGFLAGS-y :=
>   LDFLAGS :=
> @@ -502,6 +510,8 @@ CC		:= $(CONFIG_CROSS_COMPILE)gcc
>   CPP		:= $(CC)
>   CXX		:= $(CPP)
>   GOC		:= $(CONFIG_CROSS_COMPILE)gccgo-7
> +DMD		:= $(CONFIG_CROSS_COMPILE)dmd
> +GDC		:= $(CONFIG_CROSS_COMPILE)gdc
>   AS		:= $(CC)
>   AR		:= $(CONFIG_CROSS_COMPILE)gcc-ar
>   NM		:= $(CONFIG_CROSS_COMPILE)gcc-nm
> @@ -537,7 +547,7 @@ ASFLAGS		+= -DCC_VERSION=$(CC_VERSION)
>   CFLAGS		+= -DCC_VERSION=$(CC_VERSION)
>   CXXFLAGS	+= -DCC_VERSION=$(CC_VERSION)
>   GOCFLAGS	+= -DCC_VERSION=$(CC_VERSION)
> -
> +GDCFLAGS	+= -DCC_VERSION=$(CC_VERSION)
>   # ensure $(BUILD_DIR)/kconfig, $(BUILD_DIR)/include and $(BUILD_DIR)/include/uk exists
>   $(call mk_sub_build_dir,kconfig)
>   $(call mk_sub_build_dir,include)
> @@ -547,7 +557,8 @@ ASINCLUDES            += -I$(UK_GENERATED_INCLUDES)
>   CINCLUDES             += -I$(UK_GENERATED_INCLUDES)
>   CXXINCLUDES           += -I$(UK_GENERATED_INCLUDES)
>   GOCINCLUDES           += -I$(UK_GENERATED_INCLUDES)
> -
> +DMDINCLUDES           += -I$(UK_GENERATED_INCLUDES)
> +GDCINCLUDES           += -I$(UK_GENERATED_INCLUDES)
>   ################################################################################
>   # Build rules
>   ################################################################################
> diff --git a/Makefile.uk b/Makefile.uk
> index 3f01a25..5356fb2 100644
> --- a/Makefile.uk
> +++ b/Makefile.uk
> @@ -22,6 +22,13 @@ GOCFLAGS    += -fno-stack-protector -fno-omit-frame-pointer -fno-tree-sra
>   GOCFLAGS    += -fno-split-stack -Wall -Wextra
>   GOCINCLUDES += -nostdinc -nostdlib -I$(CONFIG_UK_BASE)/include
>   
> +DMDINCLUDES += -I$(CONFIG_UK_BASE)/include
> +
> +GDCFLAGS    += -U __linux__ -U __FreeBSD__ -U __sun__
> +GDCFLAGS    += -fno-stack-protector -fno-omit-frame-pointer -fno-tree-sra
> +GDCFLAGS    += -fno-split-stack -Wall -Wextra
> +GDCINCLUDES += -nostdinc -nostdlib -nophoboslib -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.
> @@ -31,22 +38,27 @@ LDFLAGS     += -nostdinc -nostdlib -Wl,--omagic -Wl,--build-id=none
>   CFLAGS-$(CONFIG_OPTIMIZE_NONE)            += -O0 -fno-optimize-sibling-calls -fno-tree-vectorize
>   CXXFLAGS-$(CONFIG_OPTIMIZE_NONE)          += -O0 -fno-optimize-sibling-calls -fno-tree-vectorize
>   GOCFLAGS-$(CONFIG_OPTIMIZE_NONE)          += -O0 -fno-optimize-sibling-calls -fno-tree-vectorize
> +GDCFLAGS-$(CONFIG_OPTIMIZE_NONE)          += -O0 -fno-optimize-sibling-calls -fno-tree-vectorize
>   CFLAGS-$(CONFIG_OPTIMIZE_PERF)            += -O2
>   CXXFLAGS-$(CONFIG_OPTIMIZE_PERF)          += -O2
>   GOCFLAGS-$(CONFIG_OPTIMIZE_PERF)          += -O2
> +GDCFLAGS-$(CONFIG_OPTIMIZE_PERF)          += -O2
>   CFLAGS-$(CONFIG_OPTIMIZE_SIZE)            += -Os
>   CXXFLAGS-$(CONFIG_OPTIMIZE_SIZE)          += -Os
>   GOCFLAGS-$(CONFIG_OPTIMIZE_SIZE)          += -Os
> +GDCFLAGS-$(CONFIG_OPTIMIZE_SIZE)          += -Os
>   
>   CFLAGS-$(CONFIG_OPTIMIZE_DEADELIM)        += -fdata-sections -ffunction-sections
>   CXXFLAGS-$(CONFIG_OPTIMIZE_DEADELIM)      += -fdata-sections -ffunction-sections
>   GOCFLAGS-$(CONFIG_OPTIMIZE_DEADELIM)      += -fdata-sections -ffunction-sections
> +GDCFLAGS-$(CONFIG_OPTIMIZE_DEADELIM)      += -fdata-sections -ffunction-sections
>   LDFLAGS-$(CONFIG_OPTIMIZE_DEADELIM)       += -Wl,--gc-sections
>   
>   # LTO requires the compiler flags to be handed over also for linking
>   CFLAGS-$(CONFIG_OPTIMIZE_LTO)             += -flto
>   CXXFLAGS-$(CONFIG_OPTIMIZE_LTO)           += -flto
>   GOCFLAGS-$(CONFIG_OPTIMIZE_LTO)           += -flto
> +GDCFLAGS-$(CONFIG_OPTIMIZE_LTO)           += -flto
>   LIBLDFLAGS-$(CONFIG_OPTIMIZE_LTO)         += $(CFLAGS) $(CFLAGS-y)
>   LDFLAGS-$(CONFIG_OPTIMIZE_LTO)            += $(CFLAGS) $(CFLAGS-y)
>   
> @@ -67,6 +79,9 @@ CXXFLAGS += -DUK_FULLVERSION=$(UK_FULLVERSION)
>   GOCFLAGS += -D __Unikraft__ -DUK_CODENAME="$(UK_CODENAME)"
>   GOCFLAGS += -DUK_VERSION=$(UK_VERSION).$(UK_SUBVERSION)
>   GOCFLAGS += -DUK_FULLVERSION=$(UK_FULLVERSION)
> +GDCFLAGS += -D __Unikraft__ -DUK_CODENAME="$(UK_CODENAME)"
> +GDCFLAGS += -DUK_VERSION=$(UK_VERSION).$(UK_SUBVERSION)
> +GDCFLAGS += -DUK_FULLVERSION=$(UK_FULLVERSION)
>   M4FLAGS  += -D __Unikraft__ -DUK_CODENAME="$(UK_CODENAME)"
>   M4FLAGS  += -DUK_VERSION=$(UK_VERSION).$(UK_SUBVERSION)
>   
> @@ -77,5 +92,6 @@ ASFLAGS-$(call gcc_version_ge,6,1)	+= -no-pie
>   CFLAGS-$(call gcc_version_ge,6,1)	+= -no-pie
>   CXXFLAGS-$(call gcc_version_ge,6,1)	+= -no-pie
>   GOFLAGS-$(call gcc_version_ge,6,1)	+= -no-pie
> +GDCFLAGS-$(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
> diff --git a/support/build/Makefile.rules b/support/build/Makefile.rules
> index a13180a..65cc155 100644
> --- a/support/build/Makefile.rules
> +++ b/support/build/Makefile.rules
> @@ -464,6 +464,51 @@ $(eval $(call vprefix_lib,$(1),OBJS-y) += $(3))
>   $(eval $(call vprefix_lib,$(1),CLEAN-y) += $(call build_clean,$(3)) $(call out2dep,$(3)))
>   endef
>   
> +define buildrule_dmd =
> +$(3): $(2) | prepare
> +	$(call build_cmd,DMD,$(1),$(3),\
> +		$(DMD) -betterC $(DMDINCLUDES) $(DMDINCLUDES-y) \
> +			$($(call vprefix_lib,$(1),DMDINCLUDES)) $($(call vprefix_lib,$(1),DMDINCLUDES-y)) \
> +		    $(DMDFLAGS) $(DMDFLAGS-y) $($(call vprefix_lib,$(1),DMDFLAGS)) \
> +            $($(call vprefix_lib,$(1),DMDFLAGS-y)) \
> +            $(2) -c -od=$(dir $(3))
> +	)
> +
> +UK_SRCS-y += $(2)
> +UK_DEPS-y += $(call out2dep,$(3))
> +UK_OBJS-y += $(3)
> +$(eval $(call vprefix_lib,$(1),OBJS-y) += $(3))
> +$(eval $(call vprefix_lib,$(1),CLEAN-y) += $(call build_clean,$(3)) $(call out2dep,$(3)))
> +endef
> +
> +define buildrule_gdc =
> +$(3): $(2) | prepare
> +	$(call build_cmd,GDC,$(1),$(3),\
> +		$(GDC) $(GDCINCLUDES) $(GDCINCLUDES-y) \
> +			$($(call vprefix_lib,$(1),GDCINCLUDES)) $($(call vprefix_lib,$(1),GDCINCLUDES-y)) \
> +			$(GDCFLAGS) $(GDCFLAGS-y) $(DBGFLAGS) $(DBGFLAGS-y) \
> +			$($(call vprefix_lib,$(1),GDCFLAGS)) $($(call vprefix_lib,$(1),GDCFLAGS-y)) \
> +			$(4) -D__LIBNAME__=$(1) -D__BASENAME__=$(notdir $(2)) \
> +			-c $(2) -o $(3) $(depflags)
> +	)
> +
> +UK_SRCS-y += $(2)
> +UK_DEPS-y += $(call out2dep,$(3))
> +UK_OBJS-y += $(3)
> +$(eval $(call vprefix_lib,$(1),OBJS-y) += $(3))
> +$(eval $(call vprefix_lib,$(1),CLEAN-y) += $(call build_clean,$(3)) $(call out2dep,$(3)))
> +endef
> +
> +ifeq ($(D_COMPILER),dmd)
> +    define buildrule_d =
> +        $(buildrule_dmd)
> +    endef
> +else
> +    define buildrule_d =
> +        $(buildrule_gdc)
> +    endef
> +endif
> +
>   define add_lds_to_plat =
>   $(eval $(call uc,$(2))_LD_SCRIPT-y += $(1))
>   endef
> @@ -544,8 +589,9 @@ $(if $(filter %.CPP,  $(2)),$(call buildrule_cc ,$(1),$(2),$(3),$(4)),\
>   $(if $(filter %.c++,  $(2)),$(call buildrule_cc ,$(1),$(2),$(3),$(4)),\
>   $(if $(filter %.C,    $(2)),$(call buildrule_cc ,$(1),$(2),$(3),$(4)),\
>   $(if $(filter %.go,   $(2)),$(call buildrule_go ,$(1),$(2),$(3),$(4)),\
> +$(if $(filter %.d,   $(2)),$(call buildrule_d ,$(1),$(2),$(3),$(4)),\
>   $(error $(3): missing build rule for source type $(suffix $(2))) \
> -)))))))))))))))
> +))))))))))))))))
>   endef
>   
>   
> 


From minios-devel-bounces@lists.xenproject.org Thu Dec 17 21:43:35 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Thu, 17 Dec 2020 21:43:35 +0000
Received: from list by lists.xenproject.org with outflank-mailman.56194.98196 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1kq13e-0001Uy-40; Thu, 17 Dec 2020 21:43:34 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 56194.98196; Thu, 17 Dec 2020 21:43: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 1kq13e-0001Ur-0i; Thu, 17 Dec 2020 21:43:34 +0000
Received: by outflank-mailman (input) for mailman id 56194;
 Thu, 17 Dec 2020 21:43:32 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=XS7E=FV=neclab.eu=simon.kuenzer@srs-us1.protection.inumbo.net>)
 id 1kq13c-0001Um-Ag
 for minios-devel@lists.xen.org; Thu, 17 Dec 2020 21:43:32 +0000
Received: from mailer1.neclab.eu (unknown [195.37.70.40])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 7b166845-e50e-4393-bc6d-afb541fe3860;
 Thu, 17 Dec 2020 21:43:30 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
 by mailer1.neclab.eu (Postfix) with ESMTP id E60A0103E7C;
 Thu, 17 Dec 2020 22:43:28 +0100 (CET)
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 kkwmxpSpnJAY; Thu, 17 Dec 2020 22:43:28 +0100 (CET)
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 B2856103961;
 Thu, 17 Dec 2020 22:43:28 +0100 (CET)
Received: from [10.7.2.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.2044.4; Thu, 17 Dec
 2020 22:43:28 +0100
X-BeenThere: minios-devel@lists.xenproject.org
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
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: 7b166845-e50e-4393-bc6d-afb541fe3860
X-Virus-Scanned: Amavisd on Debian GNU/Linux (atlas-a.office.hd)
X-ENC: Last-Hop-TLS-encrypted
X-ENC: Last-Hop-TLS-encrypted
Subject: Re: [UNIKRAFT PATCH 2/2] lib/ukmmap: Add page-alignment support to
 mmap/munmap
To: Marius-Cristian Baciu <2309bmcristi@gmail.com>,
	<minios-devel@lists.xen.org>
References: <20200721133800.27291-1-2309bmcristi@gmail.com>
 <20200721133800.27291-2-2309bmcristi@gmail.com>
From: Simon Kuenzer <simon.kuenzer@neclab.eu>
Message-ID: <ae364aba-6052-a102-c207-a22289c9b210@neclab.eu>
Date: Thu, 17 Dec 2020 22:43:27 +0100
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0)
 Gecko/20100101 Thunderbird/78.5.1
MIME-Version: 1.0
In-Reply-To: <20200721133800.27291-2-2309bmcristi@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)

Hi Marius,

I think your patch should change the behavior of this mmap 
implementation: As far as I know, given address (we currently do not 
support this) should be page aligned and also the size should be in 
multiple of pages. If not, the size gets automatically aligned up.

You can send a v2 of this fix independent of D language support.

Thanks,

Simon

On 21.07.20 15:38, Marius-Cristian Baciu wrote:
> The D runtime library is dependent on this property
> ---
>   lib/ukmmap/mmap.c | 29 +++++++++++++++++++++++++++--
>   1 file changed, 27 insertions(+), 2 deletions(-)
> 
> diff --git a/lib/ukmmap/mmap.c b/lib/ukmmap/mmap.c
> index 7cee8dc..3422411 100644
> --- a/lib/ukmmap/mmap.c
> +++ b/lib/ukmmap/mmap.c
> @@ -38,6 +38,13 @@
>   #include <uk/alloc.h>
>   #include <string.h>
>   
> +#ifdef DRUNTIME
> +#include <uk/essentials.h>
> +
> +#define size_to_num_pages(size) \
> +	(ALIGN_UP((unsigned long)(size), __PAGE_SIZE) / __PAGE_SIZE)

A minor thing: You could use __PAGE_SHIFT in order to avoid the div 
operation.

> +#endif
> +
>   struct mmap_addr {
>   	void *begin;
>   	void *end;
> @@ -94,8 +101,12 @@ void *mmap(void *addr, size_t len, int prot,
>   		last = tmp;
>   		tmp = tmp->next;
>   	}
> -	void *mem = uk_malloc(uk_alloc_get_default(), len);
> -
> +#ifdef DRUNTIME
> +    int num_pages = size_to_num_pages(len);
> +	void *mem = uk_palloc(uk_alloc_get_default(), num_pages);

This should be the normal behavior, remove the else cases.

> +#else
> +    void *mem = uk_malloc(uk_alloc_get_default(), len);
> +#endif
>   	if (!mem) {
>   		errno = ENOMEM;
>   		return (void *) -1;
> @@ -131,6 +142,7 @@ int munmap(void *addr, size_t len)
>   	if (!addr)
>   		return 0;
>   	while (tmp) {
> +#ifndef DRUNTIME
>   		if (addr != tmp->begin) {
>   			if (tmp->end > addr + len) {
>   				errno = EINVAL;
> @@ -158,6 +170,19 @@ int munmap(void *addr, size_t len)
>   			uk_free(uk_alloc_get_default(), addr);
>   			return 0;
>   		}
> +#else
> +        if (addr == tmp->begin) {
> +			int num_pages = size_to_num_pages(len);
> +
> +			if (!prev)
> +				mmap_addr = tmp->next;
> +			else
> +				prev->next = tmp->next;
> +			uk_free(uk_alloc_get_default(), tmp);
> +			uk_pfree(uk_alloc_get_default(), addr, num_pages);
> +			break;
> +        }
> +#endif
>   		prev = tmp;
>   		tmp = tmp->next;
>   	}
> 


From minios-devel-bounces@lists.xenproject.org Fri Dec 18 07:38:10 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Fri, 18 Dec 2020 07:38:10 +0000
Received: from list by lists.xenproject.org with outflank-mailman.56339.98622 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1kqAKy-0002Oa-D2; Fri, 18 Dec 2020 07:38:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 56339.98622; Fri, 18 Dec 2020 07:38: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 1kqAKy-0002OT-AH; Fri, 18 Dec 2020 07:38:04 +0000
Received: by outflank-mailman (input) for mailman id 56339;
 Fri, 18 Dec 2020 07:38: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=kN/6=FW=gmail.com=razvand@srs-us1.protection.inumbo.net>)
 id 1kqAKw-0002OO-V8
 for minios-devel@lists.xenproject.org; Fri, 18 Dec 2020 07:38:03 +0000
Received: from mail-wr1-x436.google.com (unknown [2a00:1450:4864:20::436])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id dace845a-f67b-47c5-b570-e757c3efd9cd;
 Fri, 18 Dec 2020 07:38:01 +0000 (UTC)
Received: by mail-wr1-x436.google.com with SMTP id t30so1080124wrb.0
 for <minios-devel@lists.xenproject.org>; Thu, 17 Dec 2020 23:38:00 -0800 (PST)
Received: from localhost ([141.85.225.204])
 by smtp.gmail.com with ESMTPSA id a65sm10899761wmc.35.2020.12.17.23.37.59
 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256);
 Thu, 17 Dec 2020 23:37:59 -0800 (PST)
X-BeenThere: minios-devel@lists.xenproject.org
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
Precedence: list
X-Inumbo-ID: dace845a-f67b-47c5-b570-e757c3efd9cd
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=DrgSgg0JMsqmH1oPa24PBGoQ9Jk9q7MskrJWHzUS0FQ=;
        b=f8/V1W6FFOrhmSFHN01Wx/xM4N0erygIjI/mMqF+1czfZpce0C8WvcePXOcvtUlry/
         53GyMu+Fui1QA01hY3xlWbxtGtU+aHwIjxgEDZhBjsBE5FRo4kLEuQ+xt6or0/vp0jKr
         s6417FDsHd+Mj2+XChNNU2Kd05f01ByvkX6FV9uc2J1WOthCZNcQxPOeHRKjhP5an/JA
         8uw7RifE1kH5ydKLl/iWy8kW67zGzEDoR4AcyBsRjGesTsap9uLAEuiBab1UDgfTvbbZ
         Wltxwn4IUS7MTBsTKxkpJUQIGulD/Yn/966csZAW0pyx3D9fIC4ZjwcT5dq4NxjEtoBR
         C9Kw==
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=DrgSgg0JMsqmH1oPa24PBGoQ9Jk9q7MskrJWHzUS0FQ=;
        b=tR9DE0yt1JHP6q32xQLck6x257ZLJZck4L+nRkobqGCqKNYP5AVpS3lDf8q/LH13Dk
         qORhM+6aP97anPT5WejsuvxwEw5D1yB6q1VYrEViM86jYgUefhAB0x6euMU/iS4HmSZ1
         nczSDosnI61hZ4O93ibraoMc2G6puyRB25qYp6E3m9PgnodpB77sMo9rHePQUIDTyBVN
         KGIy+yhkyFMFxJGw0G2bARfj2CR0W/ujBsPSpgQovapd8/ZC2kcXSgXpwrLG3lv5EtUG
         xY/vzxCEOaw4Iz5IO0plYLftbv44c3WSxm9GbqNVVt49IIwIXhmSs3rbOS9k4LPT6meN
         G3qw==
X-Gm-Message-State: AOAM532rH+6th6h4Xrv0l7jgWYGLjMwioiPJK6eUz+PeHExP5a61FVhr
	a85mrz30rVzvHx+Bl2Hpx0U=
X-Google-Smtp-Source: ABdhPJz4RqNfXncQy7kXFeoKjHHX/L475GcHVYqrspBYaUA3xMcnTHvVA0qtKAG1uSfsafhhbvAsbA==
X-Received: by 2002:adf:ec92:: with SMTP id z18mr2893031wrn.166.1608277080172;
        Thu, 17 Dec 2020 23:38:00 -0800 (PST)
Sender: Razvan Deaconescu <razvand@gmail.com>
From: Razvan Deaconescu <razvan.deaconescu@cs.pub.ro>
To: Punit Agrawal <punitagrawal@gmail.com>
Cc: minios-devel@lists.xenproject.org,  unikraft@listserv.neclab.eu,  jia.he@arm.com
Subject: Re: Unikraft - Compile error on arm64
References: <87h7s3clma.fsf@tinker>
	<CAD4BONcEaE4c9GxBDr4gccEeBER_PzzF8QajurGFLPpkAmMaBA@mail.gmail.com>
Date: Fri, 18 Dec 2020 09:37:58 +0200
In-Reply-To: <CAD4BONcEaE4c9GxBDr4gccEeBER_PzzF8QajurGFLPpkAmMaBA@mail.gmail.com>
	(Punit Agrawal's message of "Sat, 19 Sep 2020 07:48:21 +0900")
Message-ID: <86lfdv1s4p.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

Punit Agrawal <punitagrawal@gmail.com> writes:
> [ +Jia He as he seems to be looking at the arm64 port ]
>
> An update below.
>
> On Sat, Sep 12, 2020 at 8:07 PM Punit Agrawal <punitagrawal@gmail.com> wrote:
>
> [...]
>
>> It seems that using "-no-pie" causes the helpers for builtin atomics to
>> go missing on arm64. A quick hack to drop the "-no-pie" leads to
>> conflicts with "-r".
>
> Turns out this is not quite what's happening. The problem was the
> missing flags to pull in libgcc.
>
> Incidentally, pulling the latest changes on the staging branch fixed
> the issue. See eddaa9b242 ("build: Link libgcc at the end of the link
> options list"). Not sure why the commit was missing from my repo last
> week.
>
> Although it fixes the missing atomic helpers, now I get a different
> error message -
>
> /usr/bin/ld: /home/punit/src/unikraft/apps/helloworld/build/helloworld_kvm-arm64.o:
> in function `init_have_lse_atomics':
> lse-init.o:(.text.startup+0xbc): undefined reference to `__getauxval'
> lse-init.o:(.text.startup+0xbc): relocation truncated to fit:
> R_AARCH64_CALL26 against undefined symbol `__getauxval'
> collect2: error: ld returned 1 exit status
> make[2]: *** [/home/punit/src/unikraft/unikraft/plat/kvm/Linker.uk:24:
> /home/punit/src/unikraft/apps/helloworld/build/helloworld_kvm-arm64.dbg]
> Error 1
> make[1]: *** [Makefile:973: sub-make] Error 2
> make[1]: Leaving directory '/home/punit/src/unikraft/unikraft'
> make: *** [Makefile:6: all] Error 2
>
> __getauxval is provided by libc but it's not being linked here. musl
> carries the symbol but is not being included in the libraries being
> linked for the "Helloworld" app.
>
> Any suggestions on how to get past this one?

Hi, Punit.

I'm doing some e-mail cleanup. Did you manage to solve the above issue?

Razvan


From minios-devel-bounces@lists.xenproject.org Fri Dec 18 07:52:27 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Fri, 18 Dec 2020 07:52:27 +0000
Received: from list by lists.xenproject.org with outflank-mailman.56357.98653 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1kqAYs-0004Wz-6L; Fri, 18 Dec 2020 07:52:26 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 56357.98653; Fri, 18 Dec 2020 07:52: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 1kqAYs-0004Ws-3L; Fri, 18 Dec 2020 07:52:26 +0000
Received: by outflank-mailman (input) for mailman id 56357;
 Fri, 18 Dec 2020 07:52: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=kN/6=FW=gmail.com=razvand@srs-us1.protection.inumbo.net>)
 id 1kqAYr-0004Wn-Lq
 for minios-devel@lists.xenproject.org; Fri, 18 Dec 2020 07:52:25 +0000
Received: from mail-wr1-x431.google.com (unknown [2a00:1450:4864:20::431])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id be56d1bf-52cd-41af-8300-38e40eaa6db2;
 Fri, 18 Dec 2020 07:52:23 +0000 (UTC)
Received: by mail-wr1-x431.google.com with SMTP id t30so1117106wrb.0
 for <minios-devel@lists.xenproject.org>; Thu, 17 Dec 2020 23:52:23 -0800 (PST)
Received: from localhost ([141.85.225.204])
 by smtp.gmail.com with ESMTPSA id b7sm6630510wru.33.2020.12.17.23.52.22
 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256);
 Thu, 17 Dec 2020 23:52:22 -0800 (PST)
X-BeenThere: minios-devel@lists.xenproject.org
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
Precedence: list
X-Inumbo-ID: be56d1bf-52cd-41af-8300-38e40eaa6db2
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=e04Gb57/hL+L+98F749vI1jWX78MLEnOmjDKjwIJn3s=;
        b=kxUS+u4tQNEgme4cV27JAA4urcGugNnp8RnJsqL6gNAQ0JcoF10iUF7Wh2DqiR9h3D
         Ab7AJiOeQtmslacOwmWy5HREIAtDZLMmYgBFwizcgWqB+xlCu3pKieyde0hmD8NaZfkr
         LbGdxA2zJn3diUcQV2nK8yLTILCY2empqRyzMySrPpzv+sITsXilYCVZpTr6N4loZp0D
         80MkhjfKIrPflIWOxdajBB0FewOkLT9VD1ASy4w1ztfbm4pJifjQlnmXK1RYQ80aWjm8
         LQ250c+SKKHz/lBzE9GDBdASkJXD/tIQxi5miWzBaq8cmErIld6QqbL+GsOCZG84RUaD
         sXQg==
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=e04Gb57/hL+L+98F749vI1jWX78MLEnOmjDKjwIJn3s=;
        b=kuMS4ckEWpAfTRmatYDnHIgt4tjEhfqcEw9EF7U1YZTN+yyPjUQYuqAtSdSnRWwAly
         5dFhRh89Lwij4CKszCC1VEUXzKmbQ/bS4aBC8XQWGseeQ1GZxs7Nv2RjZzc1LF2WRe98
         xWGjnsA7Gv5oLEtu1RV2XK9JK8r67cVcJRN69LzHSh2sGLNsnoyvjYI4FvjUEgeq7NBS
         uHlA5a2Vc0t/j7drxKV/4AzHBffxlIeTZDGph25uIVPEoXdwkCIS9DJ1QNCSLDpyriVD
         EHykk3QLgq2oT+ayvjdx4TBQ6KpTJ9Ue8gfTsu6GCQSEC+g+Ev2BXzdeypGIgcmwqPrL
         OPzQ==
X-Gm-Message-State: AOAM532aw5p8cGS0TSHiwBkgZY/Udk5expySIEZRn3kzqlfk2Ge7x9ow
	m5anVTIbEuyxR2OoEaB7bdRLRI8si8x4gA==
X-Google-Smtp-Source: ABdhPJzzzOjFdhR1V80ug6OghX/zOjvZnvc7xmT4tkNHcd6cAnebBdrncIsExmOHEMJRoRu8aTMcjg==
X-Received: by 2002:adf:fdce:: with SMTP id i14mr2959274wrs.58.1608277943005;
        Thu, 17 Dec 2020 23:52:23 -0800 (PST)
Sender: Razvan Deaconescu <razvand@gmail.com>
From: Razvan Deaconescu <razvan.deaconescu@cs.pub.ro>
To: Hugo Lefeuvre <hle@owl.eu.com>
Cc: minios-devel@lists.xenproject.org
Subject: Re: [UNIKRAFT/LIBTLSF PATCH v2] Initial port of TLSF to Unikraft
References: <cover.1593603394.git.hugo.lefeuvre@neclab.eu>
	<78be00dc6e5eebe282eee77f6373e81028a38c46.1593603394.git.hugo.lefeuvre@neclab.eu>
	<861riz4da0.fsf@drone.cs.pub.ro>
	<20201113155923.lukmynejdqjpjwlj@behemoth.owl.eu.com.local>
	<CALe3bMWmu3zaaW5iN5bxMg5nxBizRgL9vkAZ=Mnn2coejuE41Q@mail.gmail.com>
	<CALe3bMUORx3k0yCQPBMaOZ2g=EpEOyqQbgi1XDHu5XwsaQWyoA@mail.gmail.com>
Date: Fri, 18 Dec 2020 09:52:21 +0200
In-Reply-To: <CALe3bMUORx3k0yCQPBMaOZ2g=EpEOyqQbgi1XDHu5XwsaQWyoA@mail.gmail.com>
	(Razvan Deaconescu's message of "Fri, 20 Nov 2020 14:57:16 +0200")
Message-ID: <86h7oj1rgq.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

Razvan Deaconescu <razvan.deaconescu@cs.pub.ro> writes:
> There is, however, an issue that I circumvented. But I don't know how
> to properly handle that.
>
> The URL for TLSF archive doesn't work. Fortunately, I had an old
> archive file I had already downloaded and uploaded it to an account I
> have access to.
>
> I updated the Makefile.uk file for TLSF:
> -LIBTLSF_URL=http://secure-web.cisco.com/1ywfFO5CQJsXcX6R9JUKVRvsqmEzx3sdJawYK9NFxVNL7wTJ8iprx3HpLq0rKGCKJBmvXgMfcY5pvR_bWbZn3Jz9IHZcR-9aKvMyoufKkKfSmi2pFdv0YJgH5VSS34QWEiUhn6p2bHhQKe8hxpYTNarQ6O0ybvzNBJHtqPDFZ2v8F8cVrfOKKsBFt6_dPeQ-nFz9_H_S0UipiDV1RIolvD-69e9eK881_Vw-r3RjLFrV_HdfckLBCdzRqBSoeP9pULPjtHJyF55yFRwJnrrf2opMVPqefWVPAnv6F68MIR0htw8P9501aP73QbhDCM5RO6sM_t9xPGmWm4xZ8PR3fqw/http%3A%2F%2Fwks.gii.upv.es%2Ftlsf%2Ffiles%2Fsrc%2FTLSF-%24%28LIBTLSF_VERSION%29.tbz2
> +LIBTLSF_URL=http://secure-web.cisco.com/1OyOFj0RTCGTY2w-4evk8a30aP21Psu4TG8cZngtWfxFJ4rWuOZAV87R8eRJ6udM9YLWJbkltAc6F4V0MIZjlnwqoxyMRw1TOX2RTAwFzFH_E17SGLOvkpdXh8Is2YJja7vlr4kcn0VZZbVle-LL79dtJtka6ueVYilO1jFogI7GOIQ7xDvJj0kDutvA10R5SJnwbnseLZBb2GMVFekQV5Hk6967GDXGDnvtDN24owNqS0R-SfQTsIHONa1ecDLqmIbUMsut4yqf7yCjOq7eqZOULMXnWH529Id5eknMoyQxL4USFK4TjIdU9fpPfzL9W/http%3A%2F%2Fswarm.cs.pub.ro%2F%7Erazvan%2Fpublic%2FTLSF-%24%28LIBTLSF_VERSION%29.tbz2
>
> What is the proper way to handle this? Should we have a storage space
> for library archives?

Just to close this, as discussed, we will do a hosting of the library
files at UPB.

Razvan


From minios-devel-bounces@lists.xenproject.org Fri Dec 18 10:48:54 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Fri, 18 Dec 2020 10:48:54 +0000
Received: from list by lists.xenproject.org with outflank-mailman.56458.98859 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1kqDJb-0006lg-N1; Fri, 18 Dec 2020 10:48:51 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 56458.98859; Fri, 18 Dec 2020 10:48: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 1kqDJb-0006lZ-KF; Fri, 18 Dec 2020 10:48:51 +0000
Received: by outflank-mailman (input) for mailman id 56458;
 Fri, 18 Dec 2020 10:48: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=Obmf=FW=gmail.com=gabi.mocanu98@srs-us1.protection.inumbo.net>)
 id 1kqDJa-0006lU-B8
 for minios-devel@lists.xenproject.org; Fri, 18 Dec 2020 10:48:50 +0000
Received: from mail-qk1-x731.google.com (unknown [2607:f8b0:4864:20::731])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id c27c2832-4318-4eb6-9e17-4dbe254eb100;
 Fri, 18 Dec 2020 10:48:48 +0000 (UTC)
Received: by mail-qk1-x731.google.com with SMTP id h4so1561948qkk.4
 for <minios-devel@lists.xenproject.org>; Fri, 18 Dec 2020 02:48:48 -0800 (PST)
X-BeenThere: minios-devel@lists.xenproject.org
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
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: c27c2832-4318-4eb6-9e17-4dbe254eb100
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=O+jKETIxG5gNtNaNlNP8nNq2sjq90eBcge5lkpMZEO0=;
        b=R9HNpys2qVfn74nWyr+Gv733qO9plDpG+zOlqeIOg7XiIztisvcYS6kKoPlYbNGM3Q
         sbu7yEUbSkN4hxVgW2KgjgB0g1JfvEPgUuTLFYNqqd3QV5nLYCVVC4TO9VUlTzpCFw/l
         LA85TLwfHHY3y82RJvm6c8LrnGAH9IintD4EHKSY9c6A/kw9wNSwY5BQtZ1MHxRbl/0c
         UwH/vJ2tevMk+DGt9s3MbQEv9uLXYYRjOlxoCyou/Ml81eUZC1JCOSKgCtXXZWYrCT29
         nWK6Q/WKii2hFCzucKa1IunuNGqzywK5o6hAalHVcOm7DqeafBXWO+Z710BPBrhYGZj9
         mWJw==
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=O+jKETIxG5gNtNaNlNP8nNq2sjq90eBcge5lkpMZEO0=;
        b=uAJwBrm5otg9UGjw0ahq7SauOwXAHYnlwz6x1WD98dDcPY5kqpDztVOvlN1VS+NvI1
         vKZcHYOGY17MAf1bwiL0ZYfWELc88fI2PXiJ+ld0Nm8/u5u8LRckW6om4vEFnzyYU3LV
         t3WB7g0wnYXCrOK1iexChWu4VNowCgXbPxJkmPZNmkSW2q9vOSK+qXSVCdlyVPUyJA5Q
         /ug84ObW8/Dx65XUJ5Rn2kVDISDbH89vTg977HD4UPZkXj9QnlqFCX0StfnMEuNrZqES
         NRkDImJWsm+OtcDnkjS0UULNkrwfqR9tFrt9BLCzrfCVN6wZNyv4HJr5At70zfBnRVNe
         LYIw==
X-Gm-Message-State: AOAM530B6VdeP9dL7cpjnn/ga6xtzRy7gvOgmJGgN/11zIzfJ1uC+oF2
	+Ja74w11EbeAGJwUb7DDlHKl1jS1MoptfEPVMsA=
X-Google-Smtp-Source: ABdhPJzOmEiGODAOv6HGMC8YEUPWCgMW98CLOaZI2SK1oyutkNEnmvY5sIuTwh8vHPIx3ru1PkfHq/6NNB/rT+ahShs=
X-Received: by 2002:a05:620a:11ba:: with SMTP id c26mr4180942qkk.140.1608288528402;
 Fri, 18 Dec 2020 02:48:48 -0800 (PST)
MIME-Version: 1.0
References: <cover.1607704032.git.hugo.lefeuvre@manchester.ac.uk> <fa3db72f12d204ca3cb5fe5a83e45fad0c8ceecb.1607704032.git.hugo.lefeuvre@manchester.ac.uk>
In-Reply-To: <fa3db72f12d204ca3cb5fe5a83e45fad0c8ceecb.1607704032.git.hugo.lefeuvre@manchester.ac.uk>
From: Gabriel Mocanu <gabi.mocanu98@gmail.com>
Date: Fri, 18 Dec 2020 12:48:37 +0200
Message-ID: <CAFQtcQOQu6jKQG5WeCaz_Ubf47_vPB2wsASbkNcqVmsn5B794g@mail.gmail.com>
Subject: Re: [UNIKRAFT PATCH v2 1/4] plat/kvm: toggle PKE bit if HAVE_X86PKU
 is enabled
To: Hugo Lefeuvre <hle@owl.eu.com>
Cc: minios-devel@lists.xenproject.org, 
	Hugo Lefeuvre <hugo.lefeuvre@manchester.ac.uk>
Content-Type: multipart/alternative; boundary="0000000000006e8cc105b6badaa7"

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

Hi, Hugo.

Looks good to me.

Mocanu Gabriel

Reviewed-by: Mocanu Gabriel <gabi.mocanu98@gmail.com>

=C3=8En vin., 11 dec. 2020 la 18:35, Hugo Lefeuvre <hle@owl.eu.com> a scris=
:

> Provided that PKU is advertised by cpuid (EAX=3D7, ECX=3D0, ECX bit 4),
> Memory Protection Keys can be enabled by setting bit 22 (PKE) in CR4
> (see Intel 64 and IA-32 Architectures Software Developer's Manual Vol.
> 3A, Section 2.5 'Control Registers').
>
> Since we do not want to pay the cost of MPK-related code when MPK is
> not enabled, we introduce a new HAVE_X86PKU property; MPK code is
> compile-guarded so that it does not get compiled in without
> HAVE_X86PKU. HAVE_X86PKU will be set by PKU kernel libraries later on.
>
> At boot time, if HAVE_X86PKU is enabled, the kernel now checks whether
> PKU is advertised by cpuid. If not, it aborts the boot process. The
> underlying idea is that images compiled with HAVE_X86PKU are
> *specialized* to be executed on PKU-enabled hardware. Hence, provided
> that HAVE_X86PKU is set, there is a guarantee that PKU is supported
> *and* enabled, effectively removing the need for checks later at
> runtime. This might benefit performance when the domain switching rate
> is high.
>
> Signed-off-by: Hugo Lefeuvre <hugo.lefeuvre@manchester.ac.uk>
> ---
>  lib/Config.uk                      |  4 ++++
>  plat/common/include/x86/cpu.h      | 15 +++++++++++++++
>  plat/common/include/x86/cpu_defs.h |  3 +++
>  plat/kvm/x86/entry64.S             | 12 ++++++++++++
>  plat/kvm/x86/setup.c               |  4 ++++
>  5 files changed, 38 insertions(+)
>
> diff --git a/lib/Config.uk b/lib/Config.uk
> index e83ed30b..dac2d2fa 100644
> --- a/lib/Config.uk
> +++ b/lib/Config.uk
> @@ -28,3 +28,7 @@ config HAVE_NW_STACK
>  config HAVE_SYSCALL
>         bool
>         default n
> +
> +config HAVE_X86PKU
> +       bool
> +       default n
> diff --git a/plat/common/include/x86/cpu.h b/plat/common/include/x86/cpu.=
h
> index 5f1a35e4..d4c02e08 100644
> --- a/plat/common/include/x86/cpu.h
> +++ b/plat/common/include/x86/cpu.h
> @@ -341,4 +341,19 @@ static inline void _init_syscall(void)
>  }
>  #endif /* CONFIG_HAVE_SYSCALL */
>
> +#if CONFIG_HAVE_X86PKU
> +static inline void _check_ospke(void)
> +{
> +       __u32 eax, ebx, ecx, edx;
> +       cpuid(0x7, 0, &eax, &ebx, &ecx, &edx);
> +       if (!(ecx & X86_CPUID7_ECX_OSPKE)) {
> +               /* if PKU is not enabled, abort the boot process. Images
> +                * compiled with HAVE_X86PKU are *specialized* to be
> executed on
> +                * PKU-enabled hardware. This allows us to avoid checks
> later at
> +                * runtime. */
> +               UK_CRASH("CPU does not support PKU!\n");
> +       }
> +}
> +#endif /* CONFIG_HAVE_X86PKU */
> +
>  #endif /* __PLAT_COMMON_X86_CPU_H__ */
> diff --git a/plat/common/include/x86/cpu_defs.h
> b/plat/common/include/x86/cpu_defs.h
> index dcbe2c65..74cff459 100644
> --- a/plat/common/include/x86/cpu_defs.h
> +++ b/plat/common/include/x86/cpu_defs.h
> @@ -71,6 +71,7 @@
>  #define X86_CR4_OSXMMEXCPT      (1 << 10)   /* OS support for FP
> exceptions */
>  #define X86_CR4_FSGSBASE        (1 << 16)   /* enable FSGSBASE*/
>  #define X86_CR4_OSXSAVE         (1 << 18)   /* enable XSAVE, extended
> states */
> +#define X86_CR4_PKE             (1 << 22)   /* enable protection keys */
>
>  /*
>   * Intel CPU features in EFER
> @@ -86,6 +87,8 @@
>  #define X86_CPUID1_EDX_SSE      (1 << 25)
>  /* CPUID feature bits in EBX and ECX when EAX=3D7, ECX=3D0 */
>  #define X86_CPUID7_EBX_FSGSBASE (1 << 0)
> +#define X86_CPUID7_ECX_PKU     (1 << 3)
> +#define X86_CPUID7_ECX_OSPKE   (1 << 4)
>  /* CPUID feature bits when EAX=3D0xd, ECX=3D1 */
>  #define X86_CPUIDD1_EAX_XSAVEOPT (1<<0)
>  /* CPUID 80000001H:EDX feature list */
> diff --git a/plat/kvm/x86/entry64.S b/plat/kvm/x86/entry64.S
> index 169f4c82..ef5e0e77 100644
> --- a/plat/kvm/x86/entry64.S
> +++ b/plat/kvm/x86/entry64.S
> @@ -31,6 +31,9 @@
>  #include <kvm-x86/traps.h>
>  #include <kvm-x86/multiboot_defs.h>
>
> +/* necessary for CONFIG_ macros to be accessible */
> +#include <uk/config.h>
> +
>  #define ENTRY(x) .globl x; .type x,%function; x:
>  #define END(x)   .size x, . - x
>
> @@ -227,6 +230,15 @@ noxsave:
>         orl $(X86_CR4_FSGSBASE), %edi
>         movq %rdi, %cr4
>  nofsgsbase:
> +#if CONFIG_HAVE_X86PKU
> +       /* check for Memory Protection Keys (PKU) */
> +       testl $(X86_CPUID7_ECX_PKU), %ecx
> +       jz nopku
> +       /* if PKU is supported, enable it via CR4 */
> +       orl $(X86_CR4_PKE), %edi
> +       movq %rdi, %cr4
> +nopku:
> +#endif /* CONFIG_HAVE_X86PKU */
>         /* done setting up CPU capabilities */
>
>         /* read multiboot info pointer */
> diff --git a/plat/kvm/x86/setup.c b/plat/kvm/x86/setup.c
> index 284ec793..e8c44a93 100644
> --- a/plat/kvm/x86/setup.c
> +++ b/plat/kvm/x86/setup.c
> @@ -329,6 +329,10 @@ void _libkvmplat_entry(void *arg)
>         _init_syscall();
>  #endif /* CONFIG_HAVE_SYSCALL */
>
> +#if CONFIG_HAVE_X86PKU
> +       _check_ospke();
> +#endif /* CONFIG_HAVE_X86PKU */
> +
>         /*
>          * Switch away from the bootstrap stack as early as possible.
>          */
> --
> 2.20.1
>
>
>

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

<div dir=3D"ltr"><div dir=3D"ltr">Hi, Hugo.<br><br>Looks good to me.<br><br=
>Mocanu Gabriel<br><br>Reviewed-by:=C2=A0Mocanu Gabriel=C2=A0&lt;<a href=3D=
"mailto:gabi.mocanu98@gmail.com">gabi.mocanu98@gmail.com</a>&gt;<br></div><=
br><div class=3D"gmail_quote"><div dir=3D"ltr" class=3D"gmail_attr">=C3=8En=
 vin., 11 dec. 2020 la 18:35, Hugo Lefeuvre &lt;<a href=3D"mailto:hle@owl.e=
u.com">hle@owl.eu.com</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">Provided that PKU is advertised by cpuid (EAX=3D7, E=
CX=3D0, ECX bit 4),<br>
Memory Protection Keys can be enabled by setting bit 22 (PKE) in CR4<br>
(see Intel 64 and IA-32 Architectures Software Developer&#39;s Manual Vol.<=
br>
3A, Section 2.5 &#39;Control Registers&#39;).<br>
<br>
Since we do not want to pay the cost of MPK-related code when MPK is<br>
not enabled, we introduce a new HAVE_X86PKU property; MPK code is<br>
compile-guarded so that it does not get compiled in without<br>
HAVE_X86PKU. HAVE_X86PKU will be set by PKU kernel libraries later on.<br>
<br>
At boot time, if HAVE_X86PKU is enabled, the kernel now checks whether<br>
PKU is advertised by cpuid. If not, it aborts the boot process. The<br>
underlying idea is that images compiled with HAVE_X86PKU are<br>
*specialized* to be executed on PKU-enabled hardware. Hence, provided<br>
that HAVE_X86PKU is set, there is a guarantee that PKU is supported<br>
*and* enabled, effectively removing the need for checks later at<br>
runtime. This might benefit performance when the domain switching rate<br>
is high.<br>
<br>
Signed-off-by: Hugo Lefeuvre &lt;<a href=3D"mailto:hugo.lefeuvre@manchester=
.ac.uk" target=3D"_blank">hugo.lefeuvre@manchester.ac.uk</a>&gt;<br>
---<br>
=C2=A0lib/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 4 ++++<br>
=C2=A0plat/common/include/x86/cpu.h=C2=A0 =C2=A0 =C2=A0 | 15 ++++++++++++++=
+<br>
=C2=A0plat/common/include/x86/cpu_defs.h |=C2=A0 3 +++<br>
=C2=A0plat/kvm/x86/entry64.S=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0| 12 ++++++++++++<br>
=C2=A0plat/kvm/x86/setup.c=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0|=C2=A0 4 ++++<br>
=C2=A05 files changed, 38 insertions(+)<br>
<br>
diff --git a/lib/Config.uk b/lib/Config.uk<br>
index e83ed30b..dac2d2fa 100644<br>
--- a/lib/Config.uk<br>
+++ b/lib/Config.uk<br>
@@ -28,3 +28,7 @@ config HAVE_NW_STACK<br>
=C2=A0config HAVE_SYSCALL<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 bool<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 default n<br>
+<br>
+config HAVE_X86PKU<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0bool<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0default n<br>
diff --git a/plat/common/include/x86/cpu.h b/plat/common/include/x86/cpu.h<=
br>
index 5f1a35e4..d4c02e08 100644<br>
--- a/plat/common/include/x86/cpu.h<br>
+++ b/plat/common/include/x86/cpu.h<br>
@@ -341,4 +341,19 @@ static inline void _init_syscall(void)<br>
=C2=A0}<br>
=C2=A0#endif /* CONFIG_HAVE_SYSCALL */<br>
<br>
+#if CONFIG_HAVE_X86PKU<br>
+static inline void _check_ospke(void)<br>
+{<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0__u32 eax, ebx, ecx, edx;<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0cpuid(0x7, 0, &amp;eax, &amp;ebx, &amp;ecx, &am=
p;edx);<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0if (!(ecx &amp; X86_CPUID7_ECX_OSPKE)) {<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0/* if PKU is not en=
abled, abort the boot process. Images<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 * compiled with HA=
VE_X86PKU are *specialized* to be executed on<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 * PKU-enabled hard=
ware. This allows us to avoid checks later at<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 * runtime. */<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0UK_CRASH(&quot;CPU =
does not support PKU!\n&quot;);<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0}<br>
+}<br>
+#endif /* CONFIG_HAVE_X86PKU */<br>
+<br>
=C2=A0#endif /* __PLAT_COMMON_X86_CPU_H__ */<br>
diff --git a/plat/common/include/x86/cpu_defs.h b/plat/common/include/x86/c=
pu_defs.h<br>
index dcbe2c65..74cff459 100644<br>
--- a/plat/common/include/x86/cpu_defs.h<br>
+++ b/plat/common/include/x86/cpu_defs.h<br>
@@ -71,6 +71,7 @@<br>
=C2=A0#define X86_CR4_OSXMMEXCPT=C2=A0 =C2=A0 =C2=A0 (1 &lt;&lt; 10)=C2=A0 =
=C2=A0/* OS support for FP exceptions */<br>
=C2=A0#define X86_CR4_FSGSBASE=C2=A0 =C2=A0 =C2=A0 =C2=A0 (1 &lt;&lt; 16)=
=C2=A0 =C2=A0/* enable FSGSBASE*/<br>
=C2=A0#define X86_CR4_OSXSAVE=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(1 &lt;&lt; =
18)=C2=A0 =C2=A0/* enable XSAVE, extended states */<br>
+#define X86_CR4_PKE=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(1 &lt;=
&lt; 22)=C2=A0 =C2=A0/* enable protection keys */<br>
<br>
=C2=A0/*<br>
=C2=A0 * Intel CPU features in EFER<br>
@@ -86,6 +87,8 @@<br>
=C2=A0#define X86_CPUID1_EDX_SSE=C2=A0 =C2=A0 =C2=A0 (1 &lt;&lt; 25)<br>
=C2=A0/* CPUID feature bits in EBX and ECX when EAX=3D7, ECX=3D0 */<br>
=C2=A0#define X86_CPUID7_EBX_FSGSBASE (1 &lt;&lt; 0)<br>
+#define X86_CPUID7_ECX_PKU=C2=A0 =C2=A0 =C2=A0(1 &lt;&lt; 3)<br>
+#define X86_CPUID7_ECX_OSPKE=C2=A0 =C2=A0(1 &lt;&lt; 4)<br>
=C2=A0/* CPUID feature bits when EAX=3D0xd, ECX=3D1 */<br>
=C2=A0#define X86_CPUIDD1_EAX_XSAVEOPT (1&lt;&lt;0)<br>
=C2=A0/* CPUID 80000001H:EDX feature list */<br>
diff --git a/plat/kvm/x86/entry64.S b/plat/kvm/x86/entry64.S<br>
index 169f4c82..ef5e0e77 100644<br>
--- a/plat/kvm/x86/entry64.S<br>
+++ b/plat/kvm/x86/entry64.S<br>
@@ -31,6 +31,9 @@<br>
=C2=A0#include &lt;kvm-x86/traps.h&gt;<br>
=C2=A0#include &lt;kvm-x86/multiboot_defs.h&gt;<br>
<br>
+/* necessary for CONFIG_ macros to be accessible */<br>
+#include &lt;uk/config.h&gt;<br>
+<br>
=C2=A0#define ENTRY(x) .globl x; .type x,%function; x:<br>
=C2=A0#define END(x)=C2=A0 =C2=A0.size x, . - x<br>
<br>
@@ -227,6 +230,15 @@ noxsave:<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 orl $(X86_CR4_FSGSBASE), %edi<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 movq %rdi, %cr4<br>
=C2=A0nofsgsbase:<br>
+#if CONFIG_HAVE_X86PKU<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0/* check for Memory Protection Keys (PKU) */<br=
>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0testl $(X86_CPUID7_ECX_PKU), %ecx<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0jz nopku<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0/* if PKU is supported, enable it via CR4 */<br=
>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0orl $(X86_CR4_PKE), %edi<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0movq %rdi, %cr4<br>
+nopku:<br>
+#endif /* CONFIG_HAVE_X86PKU */<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 /* done setting up CPU capabilities */<br>
<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 /* read multiboot info pointer */<br>
diff --git a/plat/kvm/x86/setup.c b/plat/kvm/x86/setup.c<br>
index 284ec793..e8c44a93 100644<br>
--- a/plat/kvm/x86/setup.c<br>
+++ b/plat/kvm/x86/setup.c<br>
@@ -329,6 +329,10 @@ void _libkvmplat_entry(void *arg)<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 _init_syscall();<br>
=C2=A0#endif /* CONFIG_HAVE_SYSCALL */<br>
<br>
+#if CONFIG_HAVE_X86PKU<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0_check_ospke();<br>
+#endif /* CONFIG_HAVE_X86PKU */<br>
+<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 /*<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0* Switch away from the bootstrap stack as=
 early as possible.<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0*/<br>
-- <br>
2.20.1<br>
<br>
<br>
</blockquote></div></div>

--0000000000006e8cc105b6badaa7--


From minios-devel-bounces@lists.xenproject.org Fri Dec 18 10:49:08 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Fri, 18 Dec 2020 10:49:08 +0000
Received: from list by lists.xenproject.org with outflank-mailman.56459.98864 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1kqDJs-0006mh-Pe; Fri, 18 Dec 2020 10:49:08 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 56459.98864; Fri, 18 Dec 2020 10:49: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 1kqDJs-0006mZ-MP; Fri, 18 Dec 2020 10:49:08 +0000
Received: by outflank-mailman (input) for mailman id 56459;
 Fri, 18 Dec 2020 10:49: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=Obmf=FW=gmail.com=gabi.mocanu98@srs-us1.protection.inumbo.net>)
 id 1kqDJr-0006mI-DP
 for minios-devel@lists.xenproject.org; Fri, 18 Dec 2020 10:49:07 +0000
Received: from mail-qv1-xf30.google.com (unknown [2607:f8b0:4864:20::f30])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 0dac941f-46ef-4797-8873-df4bad340530;
 Fri, 18 Dec 2020 10:49:06 +0000 (UTC)
Received: by mail-qv1-xf30.google.com with SMTP id bd6so653602qvb.9
 for <minios-devel@lists.xenproject.org>; Fri, 18 Dec 2020 02:49:06 -0800 (PST)
X-BeenThere: minios-devel@lists.xenproject.org
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
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: 0dac941f-46ef-4797-8873-df4bad340530
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=EKO2bwXLbzC6phGwyQ4d2L2+hW8SbT5XeS8LiYAi+I4=;
        b=HO+i4BR5aeJy3DASISiKASw4D0YdEnqKt9fpsUMKcpQNCxSJWwD5SNPAyIECT+OBQp
         EMw4Em5UnSWCbjpF7mnx0fK8UgPlQbSjdvUthvXdsjBPTfA3RyLt8Et8ck8VJ31Zh4c9
         rk2Gmv5FzlyKH37dy9L+lY5uezWesl4k1ZX4frHxANaVPXNdvTPifYqLLyLwRQR1MVr0
         RwwcNG9dDHBaE2S0J3BuyhkaDjRCAEGk9N+sl7lNwV6gOcHcNJeX1yXa+uMwQ1+E/b+K
         N3YOlerJx6rfaPRLFLPlBY16gkzg7h9hd4X9PmmSTPWQZ+UfRWZKjFKmydJLu6+u24I+
         +4oQ==
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=EKO2bwXLbzC6phGwyQ4d2L2+hW8SbT5XeS8LiYAi+I4=;
        b=g0kFxr40QOREmg+9aj20ByMqMKmVY2bAV0a4v8PCWiAtqOow6DwPcuaUWQy4tOw1ul
         +piH9zkG7OScxZkUGEHsBOEKaJWbnZk/8M0L5G4a1A+YXqA0zeqZwdBKxmUGcMVhIh3+
         n7LfxhnfQffz0N3oiCU2+XsehJM9ejPdvg2fPWEEy8boj3MpLNs+lszZbtM+3jR8AHDf
         WMtu2to7x6V0FKW63koMzllEbDXvbaFtRVyBhpewcVmkn42nPPlZNgK9vSwrE4+/3OT1
         7ZwgcfJ9B/mXgBFe2bimd5iD4agbyU1HphSZAIb0AYSNAr3xuyxqgRkTUjojPsguWAq+
         Kwkg==
X-Gm-Message-State: AOAM533kGNZN+CMJMGHrrz0h0kuOv3f1KT6M9tDjVFwsKttz6sg85cSE
	FuRJY6NjN2psz8MawAjqSelQ+A8Z1/t+WbbFDxjE1aByfSLGKw==
X-Google-Smtp-Source: ABdhPJz5z9VBJ5lSVnN+2pCWEANUm+TWLNqH9IoLwjtDxCr8AzEuUCymN0zTJUZ9IDOrhusiIYbjx9XBcVJcVugAVwU=
X-Received: by 2002:a05:6214:1801:: with SMTP id o1mr3992304qvw.26.1608288546194;
 Fri, 18 Dec 2020 02:49:06 -0800 (PST)
MIME-Version: 1.0
References: <cover.1607704032.git.hugo.lefeuvre@manchester.ac.uk> <cf6ee79f54d9c91bc931909b9c1077e160787cb1.1607704032.git.hugo.lefeuvre@manchester.ac.uk>
In-Reply-To: <cf6ee79f54d9c91bc931909b9c1077e160787cb1.1607704032.git.hugo.lefeuvre@manchester.ac.uk>
From: Gabriel Mocanu <gabi.mocanu98@gmail.com>
Date: Fri, 18 Dec 2020 12:48:55 +0200
Message-ID: <CAFQtcQPcFPdYJWT9yAjREM_HE_--4RVwqxdVxaGhp=c1PxBz4Q@mail.gmail.com>
Subject: Re: [UNIKRAFT PATCH v2 2/4] plat/xen: toggle PKE bit if HAVE_X86PKU
 is enabled
To: Hugo Lefeuvre <hle@owl.eu.com>
Cc: minios-devel@lists.xenproject.org, 
	Hugo Lefeuvre <hugo.lefeuvre@manchester.ac.uk>
Content-Type: multipart/alternative; boundary="0000000000007e072a05b6badba8"

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

Hi, Hugo.

Looks good to me.

Mocanu Gabriel

Reviewed-by: Mocanu Gabriel <gabi.mocanu98@gmail.com>

=C3=8En vin., 11 dec. 2020 la 18:35, Hugo Lefeuvre <hle@owl.eu.com> a scris=
:

> This patch is identical to the KVM patch.
>
> Signed-off-by: Hugo Lefeuvre <hugo.lefeuvre@manchester.ac.uk>
> ---
>  plat/xen/x86/entry64.S | 9 +++++++++
>  plat/xen/x86/setup.c   | 4 ++++
>  2 files changed, 13 insertions(+)
>
> diff --git a/plat/xen/x86/entry64.S b/plat/xen/x86/entry64.S
> index ae118e1d..c1bee635 100644
> --- a/plat/xen/x86/entry64.S
> +++ b/plat/xen/x86/entry64.S
> @@ -115,6 +115,15 @@ noxsave:
>         orl $(X86_CR4_FSGSBASE), %edi
>         movq %rdi, %cr4
>  nofsgsbase:
> +#if CONFIG_HAVE_X86PKU
> +       /* check for Memory Protection Keys (PKU) */
> +       testl $(X86_CPUID7_ECX_PKU), %ecx
> +       jz nopku
> +       /* if PKU is supported, enable it via CR4 */
> +       orl $(X86_CR4_PKE), %edi
> +       movq %rdi, %cr4
> +nopku:
> +#endif /* CONFIG_HAVE_X86PKU */
>         /* Done setting up CPU capabilities, hand over to C entry point. =
*/
>         movq %r8, %rdi /* pass pointer to start_info page to C entry */
>         call _libxenplat_x86entry
> diff --git a/plat/xen/x86/setup.c b/plat/xen/x86/setup.c
> index ebe99328..e5d51b32 100644
> --- a/plat/xen/x86/setup.c
> +++ b/plat/xen/x86/setup.c
> @@ -211,5 +211,9 @@ void _libxenplat_x86entry(void *start_info)
>
>         init_console();
>
> +#if CONFIG_HAVE_X86PKU
> +       _check_ospke();
> +#endif /* CONFIG_HAVE_X86PKU */
> +
>         ukplat_entry_argp(CONFIG_UK_NAME, cmdline, MAX_GUEST_CMDLINE);
>  }
> --
> 2.20.1
>
>
>

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

<div dir=3D"ltr">Hi, Hugo.<br><br>Looks good to me.<br><br>Mocanu Gabriel<b=
r><br>Reviewed-by:=C2=A0Mocanu Gabriel=C2=A0&lt;<a href=3D"mailto:gabi.moca=
nu98@gmail.com">gabi.mocanu98@gmail.com</a>&gt;<br></div><br><div class=3D"=
gmail_quote"><div dir=3D"ltr" class=3D"gmail_attr">=C3=8En vin., 11 dec. 20=
20 la 18:35, Hugo Lefeuvre &lt;<a href=3D"mailto:hle@owl.eu.com">hle@owl.eu=
.com</a>&gt; a scris:<br></div><blockquote class=3D"gmail_quote" style=3D"m=
argin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left=
:1ex">This patch is identical to the KVM patch.<br>
<br>
Signed-off-by: Hugo Lefeuvre &lt;<a href=3D"mailto:hugo.lefeuvre@manchester=
.ac.uk" target=3D"_blank">hugo.lefeuvre@manchester.ac.uk</a>&gt;<br>
---<br>
=C2=A0plat/xen/x86/entry64.S | 9 +++++++++<br>
=C2=A0plat/xen/x86/setup.c=C2=A0 =C2=A0| 4 ++++<br>
=C2=A02 files changed, 13 insertions(+)<br>
<br>
diff --git a/plat/xen/x86/entry64.S b/plat/xen/x86/entry64.S<br>
index ae118e1d..c1bee635 100644<br>
--- a/plat/xen/x86/entry64.S<br>
+++ b/plat/xen/x86/entry64.S<br>
@@ -115,6 +115,15 @@ noxsave:<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 orl $(X86_CR4_FSGSBASE), %edi<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 movq %rdi, %cr4<br>
=C2=A0nofsgsbase:<br>
+#if CONFIG_HAVE_X86PKU<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0/* check for Memory Protection Keys (PKU) */<br=
>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0testl $(X86_CPUID7_ECX_PKU), %ecx<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0jz nopku<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0/* if PKU is supported, enable it via CR4 */<br=
>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0orl $(X86_CR4_PKE), %edi<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0movq %rdi, %cr4<br>
+nopku:<br>
+#endif /* CONFIG_HAVE_X86PKU */<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 /* Done setting up CPU capabilities, hand over =
to C entry point. */<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 movq %r8, %rdi /* pass pointer to start_info pa=
ge to C entry */<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 call _libxenplat_x86entry<br>
diff --git a/plat/xen/x86/setup.c b/plat/xen/x86/setup.c<br>
index ebe99328..e5d51b32 100644<br>
--- a/plat/xen/x86/setup.c<br>
+++ b/plat/xen/x86/setup.c<br>
@@ -211,5 +211,9 @@ void _libxenplat_x86entry(void *start_info)<br>
<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 init_console();<br>
<br>
+#if CONFIG_HAVE_X86PKU<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0_check_ospke();<br>
+#endif /* CONFIG_HAVE_X86PKU */<br>
+<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 ukplat_entry_argp(CONFIG_UK_NAME, cmdline, MAX_=
GUEST_CMDLINE);<br>
=C2=A0}<br>
-- <br>
2.20.1<br>
<br>
<br>
</blockquote></div>

--0000000000007e072a05b6badba8--


From minios-devel-bounces@lists.xenproject.org Fri Dec 18 10:51:47 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Fri, 18 Dec 2020 10:51:47 +0000
Received: from list by lists.xenproject.org with outflank-mailman.56463.98867 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1kqDMQ-0007h1-0z; Fri, 18 Dec 2020 10:51:46 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 56463.98867; Fri, 18 Dec 2020 10:51: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 1kqDMP-0007gu-Tw; Fri, 18 Dec 2020 10:51:45 +0000
Received: by outflank-mailman (input) for mailman id 56463;
 Fri, 18 Dec 2020 10:51: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=Obmf=FW=gmail.com=gabi.mocanu98@srs-us1.protection.inumbo.net>)
 id 1kqDMO-0007gp-Ui
 for minios-devel@lists.xenproject.org; Fri, 18 Dec 2020 10:51:44 +0000
Received: from mail-qk1-x72c.google.com (unknown [2607:f8b0:4864:20::72c])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 0cdad2a7-a191-43a6-b7bb-71c69c7cbecf;
 Fri, 18 Dec 2020 10:51:43 +0000 (UTC)
Received: by mail-qk1-x72c.google.com with SMTP id 143so1524699qke.10
 for <minios-devel@lists.xenproject.org>; Fri, 18 Dec 2020 02:51:43 -0800 (PST)
X-BeenThere: minios-devel@lists.xenproject.org
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
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: 0cdad2a7-a191-43a6-b7bb-71c69c7cbecf
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=T4i0248MhbUs8UY/aHKvGYjhWmBZelcBfuh2AQ6mH7A=;
        b=Mw1ZAqN1kAB/XOMACM7SnJqS9j4SJZauWlAK5gKdcOQbswoDsx6OgWnwN8A5aiw3pi
         WppNd1hg8G1OyJn1e0Jc6YHYT5JPRzyetVP1a9qvwgL/0KLWsAopPIFyHV+OO/vNDUSU
         TRGZGqNZ7ARVS2wubkHr5gS+4ULvnnZrB9QZL0dQGq9sBXmWtKfDZywfZP4TfCPyzfdS
         lZ8/7S91LOJ76yDA629uG/+XPTRZdkPhno3yUm015L1PTHkt1rP0jPktV2w4Rd8EtyZb
         56w525tQHCjfT2e7svKDunqCg+bmLs7x0WdZRYzPyKgJXb7derR8krZMVYeomSAVtfGo
         ooyw==
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=T4i0248MhbUs8UY/aHKvGYjhWmBZelcBfuh2AQ6mH7A=;
        b=XR7GAziDwWkJPTGBdUXIJzDlN6ZGEzx7RhFBHKLI5FhtQKR824Oz7sPscJxgxjSurY
         ECcN56NdDI7U5k3wm2E9QWI6rWW587mrmxFNQGK0HjvGljXjQ7y+KtHHebGhiQIJo092
         Tl+riYc2H3A3ijWS1EMGaQ5NPBgAkPbxf26ogtzrhSKN11mc4ms5NlV+XGHaw90eJmIz
         6GnMOufFxfq/zP/WK65wGERw1wVbab5Jo6mDHX9TQmFNfqsvmuOuNMcR02omBZJb45HQ
         TSNhS8uzGjaLGeAxCXmxU23ljmgmI+HbC8Ho6F+6WKbWJLp8XuD5UIv2r6pd9y1infx+
         51lg==
X-Gm-Message-State: AOAM533cUkQ57xu3PdlHTfCvHru/fMa/zW5BQr4z7+9EQccwUvq4nLYY
	+9Rr5bfg3szk9gFVrx1+XaPGXWCWaftq5AXpf3I=
X-Google-Smtp-Source: ABdhPJw/DoYuCps6RJbqISVlqIzAWUCckO/mTKjNfm2FYtm80AuBWwARpVLBcG+zi+QgBAuWZkxAVhWyBwOvUUVGMYg=
X-Received: by 2002:a37:458:: with SMTP id 85mr3891127qke.61.1608288703324;
 Fri, 18 Dec 2020 02:51:43 -0800 (PST)
MIME-Version: 1.0
References: <cover.1607704032.git.hugo.lefeuvre@manchester.ac.uk> <bd2eb52a05b671b89cdf815e54e5e2152ce7ee96.1607704032.git.hugo.lefeuvre@manchester.ac.uk>
In-Reply-To: <bd2eb52a05b671b89cdf815e54e5e2152ce7ee96.1607704032.git.hugo.lefeuvre@manchester.ac.uk>
From: Gabriel Mocanu <gabi.mocanu98@gmail.com>
Date: Fri, 18 Dec 2020 12:51:32 +0200
Message-ID: <CAFQtcQO2oRtdPOchoKGO2igMEj4OT9MPe9O4sRJgHG51sK0YRw@mail.gmail.com>
Subject: Re: [UNIKRAFT PATCH v2 3/4] plat/kvm: enable XSAVE for PKRU register
To: Hugo Lefeuvre <hle@owl.eu.com>
Cc: minios-devel@lists.xenproject.org, 
	Hugo Lefeuvre <hugo.lefeuvre@manchester.ac.uk>
Content-Type: multipart/alternative; boundary="000000000000dba5d205b6bae48e"

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

Hi, Hugo.

Looks good to me.

Mocanu Gabriel

Reviewed-by: Mocanu Gabriel <gabi.mocanu98@gmail.com>

=C3=8En vin., 11 dec. 2020 la 18:36, Hugo Lefeuvre <hle@owl.eu.com> a scris=
:

> According to Intel 64 and IA-32 Architectures Software Developer=E2=80=99=
s
> Manual Vol. 1, Section 13.5.7 'PKRU State':
>
>         software can use the XSAVE feature set to manage PKRU state
>         only if XCR0[9] =3D 1
>
> This patch sets XCR0[9] if PKU is available (and enabled via
> CONFIG_HAVE_X86PKU).
>
> Note: we do not support PKU without XSAVE. If CONFIG_HAVE_X86PKU is
> selected but XSAVE is not available, we simply don't initialize PKU
> and let the boot process gracefully abort later.
>
> Signed-off-by: Hugo Lefeuvre <hugo.lefeuvre@manchester.ac.uk>
> ---
>  plat/common/include/x86/cpu_defs.h |  1 +
>  plat/kvm/x86/entry64.S             | 19 +++++++++++++++----
>  2 files changed, 16 insertions(+), 4 deletions(-)
>
> diff --git a/plat/common/include/x86/cpu_defs.h
> b/plat/common/include/x86/cpu_defs.h
> index 74cff459..1cf5367d 100644
> --- a/plat/common/include/x86/cpu_defs.h
> +++ b/plat/common/include/x86/cpu_defs.h
> @@ -100,6 +100,7 @@
>  #define X86_XCR0_X87            (1 << 0)
>  #define X86_XCR0_SSE            (1 << 1)
>  #define X86_XCR0_AVX            (1 << 2)
> +#define X86_XCR0_PKRU          (1 << 9)
>
>  /*
>   * Model-specific register addresses
> diff --git a/plat/kvm/x86/entry64.S b/plat/kvm/x86/entry64.S
> index ef5e0e77..287f9029 100644
> --- a/plat/kvm/x86/entry64.S
> +++ b/plat/kvm/x86/entry64.S
> @@ -196,18 +196,19 @@ ENTRY(_libkvmplat_start64)
>         movq %rdi, %cr4
>         ldmxcsr (mxcsr_ptr)
>  #endif /* __SSE__ */
> +#if (__AVX__ || CONFIG_HAVE_X86PKU)
>         /* Check capabilities subject to availability as indicated by
> cpuid.
>          * First, start off with "standard features" */
>         movl $0x1, %eax
>         cpuid
> -#if __AVX__
>         /* ecx and edx now contain capability information, so we can now
>          * enable capabilities based on the indicated features */
> -       /* OSXSAVE needs to be enabled before AVX */
> +       /* note: OSXSAVE needs to be enabled before AVX and PKU */
>         testl $(X86_CPUID1_ECX_XSAVE), %ecx
>         jz noxsave
>         orl $(X86_CR4_OSXSAVE), %edi
>         movq %rdi, %cr4
> +#if __AVX__
>         /* now enable AVX. This needs to be last checking cpuid features
> from
>          * the eax=3D1 cpuid call, because it clobbers ecx */
>         testl $(X86_CPUID1_ECX_AVX), %ecx
> @@ -217,8 +218,10 @@ ENTRY(_libkvmplat_start64)
>         orl $(X86_XCR0_SSE | X86_XCR0_AVX), %eax
>         xsetbv
>  noavx:
> -noxsave:
>  #endif /* __AVX__ */
> +/* Do not enable AVX without XSAVE, otherwise we'll get #UD */
> +noxsave:
> +#endif /* __AVX__ || CONFIG_HAVE_X86PKU */
>         /* Now, check for extended features. */
>         movl $0x7, %eax
>         movl $0x0, %ecx
> @@ -234,9 +237,17 @@ nofsgsbase:
>         /* check for Memory Protection Keys (PKU) */
>         testl $(X86_CPUID7_ECX_PKU), %ecx
>         jz nopku
> -       /* if PKU is supported, enable it via CR4 */
> +       /* only enable PKU if we support XSAVE */
> +       testl $(X86_CR4_OSXSAVE), %edi
> +       jz nopku
> +       /* PKU is supported, enable it via CR4 */
>         orl $(X86_CR4_PKE), %edi
>         movq %rdi, %cr4
> +       /* also enable XSAVE for the PKRU */
> +       xorl %ecx, %ecx
> +       xgetbv
> +       orl $(X86_XCR0_PKRU), %eax
> +       xsetbv
>  nopku:
>  #endif /* CONFIG_HAVE_X86PKU */
>         /* done setting up CPU capabilities */
> --
> 2.20.1
>
>
>

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

<div dir=3D"ltr">Hi, Hugo.<br><br>Looks good to me.<br><br>Mocanu Gabriel<b=
r><br>Reviewed-by:=C2=A0Mocanu Gabriel=C2=A0&lt;<a href=3D"mailto:gabi.moca=
nu98@gmail.com">gabi.mocanu98@gmail.com</a>&gt;<br></div><br><div class=3D"=
gmail_quote"><div dir=3D"ltr" class=3D"gmail_attr">=C3=8En vin., 11 dec. 20=
20 la 18:36, Hugo Lefeuvre &lt;<a href=3D"mailto:hle@owl.eu.com">hle@owl.eu=
.com</a>&gt; a scris:<br></div><blockquote class=3D"gmail_quote" style=3D"m=
argin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left=
:1ex">According to Intel 64 and IA-32 Architectures Software Developer=E2=
=80=99s<br>
Manual Vol. 1, Section 13.5.7 &#39;PKRU State&#39;:<br>
<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 software can use the XSAVE feature set to manag=
e PKRU state<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 only if XCR0[9] =3D 1<br>
<br>
This patch sets XCR0[9] if PKU is available (and enabled via<br>
CONFIG_HAVE_X86PKU).<br>
<br>
Note: we do not support PKU without XSAVE. If CONFIG_HAVE_X86PKU is<br>
selected but XSAVE is not available, we simply don&#39;t initialize PKU<br>
and let the boot process gracefully abort later.<br>
<br>
Signed-off-by: Hugo Lefeuvre &lt;<a href=3D"mailto:hugo.lefeuvre@manchester=
.ac.uk" target=3D"_blank">hugo.lefeuvre@manchester.ac.uk</a>&gt;<br>
---<br>
=C2=A0plat/common/include/x86/cpu_defs.h |=C2=A0 1 +<br>
=C2=A0plat/kvm/x86/entry64.S=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0| 19 +++++++++++++++----<br>
=C2=A02 files changed, 16 insertions(+), 4 deletions(-)<br>
<br>
diff --git a/plat/common/include/x86/cpu_defs.h b/plat/common/include/x86/c=
pu_defs.h<br>
index 74cff459..1cf5367d 100644<br>
--- a/plat/common/include/x86/cpu_defs.h<br>
+++ b/plat/common/include/x86/cpu_defs.h<br>
@@ -100,6 +100,7 @@<br>
=C2=A0#define X86_XCR0_X87=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (1 &lt;=
&lt; 0)<br>
=C2=A0#define X86_XCR0_SSE=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (1 &lt;=
&lt; 1)<br>
=C2=A0#define X86_XCR0_AVX=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (1 &lt;=
&lt; 2)<br>
+#define X86_XCR0_PKRU=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (1 &lt;&lt; 9)<br>
<br>
=C2=A0/*<br>
=C2=A0 * Model-specific register addresses<br>
diff --git a/plat/kvm/x86/entry64.S b/plat/kvm/x86/entry64.S<br>
index ef5e0e77..287f9029 100644<br>
--- a/plat/kvm/x86/entry64.S<br>
+++ b/plat/kvm/x86/entry64.S<br>
@@ -196,18 +196,19 @@ ENTRY(_libkvmplat_start64)<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 movq %rdi, %cr4<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 ldmxcsr (mxcsr_ptr)<br>
=C2=A0#endif /* __SSE__ */<br>
+#if (__AVX__ || CONFIG_HAVE_X86PKU)<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 /* Check capabilities subject to availability a=
s indicated by cpuid.<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0* First, start off with &quot;standard fe=
atures&quot; */<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 movl $0x1, %eax<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 cpuid<br>
-#if __AVX__<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 /* ecx and edx now contain capability informati=
on, so we can now<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0* enable capabilities based on the indica=
ted features */<br>
-=C2=A0 =C2=A0 =C2=A0 =C2=A0/* OSXSAVE needs to be enabled before AVX */<br=
>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0/* note: OSXSAVE needs to be enabled before AVX=
 and PKU */<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 testl $(X86_CPUID1_ECX_XSAVE), %ecx<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 jz noxsave<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 orl $(X86_CR4_OSXSAVE), %edi<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 movq %rdi, %cr4<br>
+#if __AVX__<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 /* now enable AVX. This needs to be last checki=
ng cpuid features from<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0* the eax=3D1 cpuid call, because it clob=
bers ecx */<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 testl $(X86_CPUID1_ECX_AVX), %ecx<br>
@@ -217,8 +218,10 @@ ENTRY(_libkvmplat_start64)<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 orl $(X86_XCR0_SSE | X86_XCR0_AVX), %eax<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 xsetbv<br>
=C2=A0noavx:<br>
-noxsave:<br>
=C2=A0#endif /* __AVX__ */<br>
+/* Do not enable AVX without XSAVE, otherwise we&#39;ll get #UD */<br>
+noxsave:<br>
+#endif /* __AVX__ || CONFIG_HAVE_X86PKU */<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 /* Now, check for extended features. */<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 movl $0x7, %eax<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 movl $0x0, %ecx<br>
@@ -234,9 +237,17 @@ nofsgsbase:<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 /* check for Memory Protection Keys (PKU) */<br=
>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 testl $(X86_CPUID7_ECX_PKU), %ecx<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 jz nopku<br>
-=C2=A0 =C2=A0 =C2=A0 =C2=A0/* if PKU is supported, enable it via CR4 */<br=
>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0/* only enable PKU if we support XSAVE */<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0testl $(X86_CR4_OSXSAVE), %edi<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0jz nopku<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0/* PKU is supported, enable it via CR4 */<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 orl $(X86_CR4_PKE), %edi<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 movq %rdi, %cr4<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0/* also enable XSAVE for the PKRU */<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0xorl %ecx, %ecx<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0xgetbv<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0orl $(X86_XCR0_PKRU), %eax<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0xsetbv<br>
=C2=A0nopku:<br>
=C2=A0#endif /* CONFIG_HAVE_X86PKU */<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 /* done setting up CPU capabilities */<br>
-- <br>
2.20.1<br>
<br>
<br>
</blockquote></div>

--000000000000dba5d205b6bae48e--


From minios-devel-bounces@lists.xenproject.org Fri Dec 18 10:52:34 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Fri, 18 Dec 2020 10:52:34 +0000
Received: from list by lists.xenproject.org with outflank-mailman.56464.98871 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1kqDNC-0007kL-56; Fri, 18 Dec 2020 10:52:34 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 56464.98871; Fri, 18 Dec 2020 10:52: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 1kqDNC-0007kE-1q; Fri, 18 Dec 2020 10:52:34 +0000
Received: by outflank-mailman (input) for mailman id 56464;
 Fri, 18 Dec 2020 10:52:32 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=Obmf=FW=gmail.com=gabi.mocanu98@srs-us1.protection.inumbo.net>)
 id 1kqDNA-0007k9-Ii
 for minios-devel@lists.xenproject.org; Fri, 18 Dec 2020 10:52:32 +0000
Received: from mail-qt1-x830.google.com (unknown [2607:f8b0:4864:20::830])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id e7d51c4d-796c-4820-a72f-6dcb13b94e45;
 Fri, 18 Dec 2020 10:52:31 +0000 (UTC)
Received: by mail-qt1-x830.google.com with SMTP id 2so932446qtt.10
 for <minios-devel@lists.xenproject.org>; Fri, 18 Dec 2020 02:52:31 -0800 (PST)
X-BeenThere: minios-devel@lists.xenproject.org
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
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: e7d51c4d-796c-4820-a72f-6dcb13b94e45
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=5+Z4vh6LOKIhe3bT8ZT1pZXjURumxov7TBGdxhq+Ncg=;
        b=mYmw5QwL8PNI04q5zHu7LZLesbdaL+4SPa8GHczxq1nRhu83p5o97K5toiPHhGgo7T
         C1fURTHtnoswcSrS5I/4Roy7ibyxoaWInQad41da2IGSZ0KvK8QQ/Gkv3AY1D7Ykr4R2
         5WrIF6rvcfhYqJS2VbbbKjHOzdTtrt4FHBKC4yK8cRHzFoAb6vKI9m9Sp4cyBdSyCEp0
         qehAStw9OPGOAVj55u2TugCL7oagF8mOoRSX1A6necMWrS02rrbBYSrSqUftEzTbypxq
         6UrDUumfC1kv/rwoBXiIdzwVtzNdZLm/Yv5jrnonh1BYDBcUrZ6bTAdlpJq8epNMWMep
         bGSw==
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=5+Z4vh6LOKIhe3bT8ZT1pZXjURumxov7TBGdxhq+Ncg=;
        b=Sp6L03xSkQ9v6R/5c9Xj37Vf6CD2Osx5ah8tXMJmZdrjO9+91jW8J14cQ42WOzafuH
         PgzWMhJC+Yk6aTheZ7IoyTo4Ml4ukogLfRdx9ihE/nzazPAeeNoio+EyX/uTbpvj5WIv
         mwIyElKqMqqOgdlxOOlEmp7Pa9BqaGaTc1ZHxwNUX14HRxyfksYZ5A+fIIAol1Mu+oQI
         Alsjv6ywIazBW69CbMwqCqvxhzsLi5nmkc0qdLtZ4CX8aVlk/JmqCWswmHLv482tXK7f
         zjPSp+6WrCSLz6RvaefBkxQQPHh8V5YUA5twJTcheiFgzE4pJ/SlnAdZWUNm9YWzvb4y
         Sm2A==
X-Gm-Message-State: AOAM531Cg4hO8sKTENh8s18aXP4A3tJWmpI/uivbjznF5HryfISUgytR
	EECufVM6MOWGDSLUArr4f8DX6YhYf9/3hnH9UX4=
X-Google-Smtp-Source: ABdhPJyKv1GMMsZQNn0NeAl1aSdqA2wPXaadfh4jw9EchG6dnOnJlhzslgHWuoKreb3dKdTcjlO8dMl4eNyv3KjpT5o=
X-Received: by 2002:ac8:5bcb:: with SMTP id b11mr3277662qtb.336.1608288750936;
 Fri, 18 Dec 2020 02:52:30 -0800 (PST)
MIME-Version: 1.0
References: <cover.1607704032.git.hugo.lefeuvre@manchester.ac.uk> <a102807d5c65567d6fe6c29e4228fecd9783efac.1607704032.git.hugo.lefeuvre@manchester.ac.uk>
In-Reply-To: <a102807d5c65567d6fe6c29e4228fecd9783efac.1607704032.git.hugo.lefeuvre@manchester.ac.uk>
From: Gabriel Mocanu <gabi.mocanu98@gmail.com>
Date: Fri, 18 Dec 2020 12:52:20 +0200
Message-ID: <CAFQtcQNgmOiWoO2ONR8ZOi4zoG5KM53LBeN=oz-+pt3jJCaTcw@mail.gmail.com>
Subject: Re: [UNIKRAFT PATCH v2 4/4] plat/xen: enable XSAVE for PKRU register
To: Hugo Lefeuvre <hle@owl.eu.com>
Cc: minios-devel@lists.xenproject.org, 
	Hugo Lefeuvre <hugo.lefeuvre@manchester.ac.uk>
Content-Type: multipart/alternative; boundary="000000000000b2275e05b6bae7ac"

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

Hi, Hugo.

Looks good to me.

Mocanu Gabriel

Reviewed-by: Mocanu Gabriel <gabi.mocanu98@gmail.com>

=C3=8En vin., 11 dec. 2020 la 18:36, Hugo Lefeuvre <hle@owl.eu.com> a scris=
:

> This patch is identical to the KVM patch.
>
> Signed-off-by: Hugo Lefeuvre <hugo.lefeuvre@manchester.ac.uk>
> ---
>  plat/xen/x86/entry64.S | 19 +++++++++++++++----
>  1 file changed, 15 insertions(+), 4 deletions(-)
>
> diff --git a/plat/xen/x86/entry64.S b/plat/xen/x86/entry64.S
> index c1bee635..dee832ec 100644
> --- a/plat/xen/x86/entry64.S
> +++ b/plat/xen/x86/entry64.S
> @@ -81,18 +81,19 @@ _libxenplat_start:
>         movq %rdi, %cr4
>         ldmxcsr (mxcsr_ptr)
>  #endif /* __SSE__ */
> +#if (__AVX__ || CONFIG_HAVE_X86PKU)
>         /* Check capabilities subject to availability as indicated by
> cpuid.
>          * First, start off with "standard features" */
>         movl $0x1, %eax
>         cpuid
> -#if __AVX__
>         /* ecx and edx now contain capability information, so we can now
>          * enable capabilities based on the indicated features */
> -       /* OSXSAVE needs to be enabled before AVX */
> +       /* note: OSXSAVE needs to be enabled before AVX and PKU */
>         testl $(X86_CPUID1_ECX_XSAVE), %ecx
>         jz noxsave
>         orl $(X86_CR4_OSXSAVE), %edi
>         movq %rdi, %cr4
> +#if __AVX__
>         /* now enable AVX. This needs to be last checking cpuid features
> from
>          * the eax=3D1 cpuid call, because it clobbers ecx */
>         testl $(X86_CPUID1_ECX_AVX), %ecx
> @@ -102,8 +103,10 @@ _libxenplat_start:
>         orl $(X86_XCR0_SSE | X86_XCR0_AVX), %eax
>         xsetbv
>  noavx:
> -noxsave:
>  #endif /* __AVX__ */
> +/* Do not enable AVX without XSAVE, otherwise we'll get #UD */
> +noxsave:
> +#endif /* __AVX__ || CONFIG_HAVE_X86PKU */
>         /* Now, check for extended features. */
>         movl $0x7, %eax
>         movl $0x0, %ecx
> @@ -119,9 +122,17 @@ nofsgsbase:
>         /* check for Memory Protection Keys (PKU) */
>         testl $(X86_CPUID7_ECX_PKU), %ecx
>         jz nopku
> -       /* if PKU is supported, enable it via CR4 */
> +       /* only enable PKU if we support XSAVE */
> +       testl $(X86_CR4_OSXSAVE), %edi
> +       jz nopku
> +       /* PKU is supported, enable it via CR4 */
>         orl $(X86_CR4_PKE), %edi
>         movq %rdi, %cr4
> +       /* also enable XSAVE for the PKRU */
> +       xorl %ecx, %ecx
> +       xgetbv
> +       orl $(X86_XCR0_PKRU), %eax
> +       xsetbv
>  nopku:
>  #endif /* CONFIG_HAVE_X86PKU */
>         /* Done setting up CPU capabilities, hand over to C entry point. =
*/
> --
> 2.20.1
>
>
>

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

<div dir=3D"ltr">Hi, Hugo.<br><br>Looks good to me.<br><br>Mocanu Gabriel<b=
r><br>Reviewed-by:=C2=A0Mocanu Gabriel=C2=A0&lt;<a href=3D"mailto:gabi.moca=
nu98@gmail.com">gabi.mocanu98@gmail.com</a>&gt;<br></div><br><div class=3D"=
gmail_quote"><div dir=3D"ltr" class=3D"gmail_attr">=C3=8En vin., 11 dec. 20=
20 la 18:36, Hugo Lefeuvre &lt;<a href=3D"mailto:hle@owl.eu.com">hle@owl.eu=
.com</a>&gt; a scris:<br></div><blockquote class=3D"gmail_quote" style=3D"m=
argin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left=
:1ex">This patch is identical to the KVM patch.<br>
<br>
Signed-off-by: Hugo Lefeuvre &lt;<a href=3D"mailto:hugo.lefeuvre@manchester=
.ac.uk" target=3D"_blank">hugo.lefeuvre@manchester.ac.uk</a>&gt;<br>
---<br>
=C2=A0plat/xen/x86/entry64.S | 19 +++++++++++++++----<br>
=C2=A01 file changed, 15 insertions(+), 4 deletions(-)<br>
<br>
diff --git a/plat/xen/x86/entry64.S b/plat/xen/x86/entry64.S<br>
index c1bee635..dee832ec 100644<br>
--- a/plat/xen/x86/entry64.S<br>
+++ b/plat/xen/x86/entry64.S<br>
@@ -81,18 +81,19 @@ _libxenplat_start:<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 movq %rdi, %cr4<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 ldmxcsr (mxcsr_ptr)<br>
=C2=A0#endif /* __SSE__ */<br>
+#if (__AVX__ || CONFIG_HAVE_X86PKU)<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 /* Check capabilities subject to availability a=
s indicated by cpuid.<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0* First, start off with &quot;standard fe=
atures&quot; */<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 movl $0x1, %eax<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 cpuid<br>
-#if __AVX__<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 /* ecx and edx now contain capability informati=
on, so we can now<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0* enable capabilities based on the indica=
ted features */<br>
-=C2=A0 =C2=A0 =C2=A0 =C2=A0/* OSXSAVE needs to be enabled before AVX */<br=
>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0/* note: OSXSAVE needs to be enabled before AVX=
 and PKU */<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 testl $(X86_CPUID1_ECX_XSAVE), %ecx<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 jz noxsave<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 orl $(X86_CR4_OSXSAVE), %edi<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 movq %rdi, %cr4<br>
+#if __AVX__<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 /* now enable AVX. This needs to be last checki=
ng cpuid features from<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0* the eax=3D1 cpuid call, because it clob=
bers ecx */<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 testl $(X86_CPUID1_ECX_AVX), %ecx<br>
@@ -102,8 +103,10 @@ _libxenplat_start:<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 orl $(X86_XCR0_SSE | X86_XCR0_AVX), %eax<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 xsetbv<br>
=C2=A0noavx:<br>
-noxsave:<br>
=C2=A0#endif /* __AVX__ */<br>
+/* Do not enable AVX without XSAVE, otherwise we&#39;ll get #UD */<br>
+noxsave:<br>
+#endif /* __AVX__ || CONFIG_HAVE_X86PKU */<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 /* Now, check for extended features. */<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 movl $0x7, %eax<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 movl $0x0, %ecx<br>
@@ -119,9 +122,17 @@ nofsgsbase:<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 /* check for Memory Protection Keys (PKU) */<br=
>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 testl $(X86_CPUID7_ECX_PKU), %ecx<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 jz nopku<br>
-=C2=A0 =C2=A0 =C2=A0 =C2=A0/* if PKU is supported, enable it via CR4 */<br=
>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0/* only enable PKU if we support XSAVE */<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0testl $(X86_CR4_OSXSAVE), %edi<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0jz nopku<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0/* PKU is supported, enable it via CR4 */<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 orl $(X86_CR4_PKE), %edi<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 movq %rdi, %cr4<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0/* also enable XSAVE for the PKRU */<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0xorl %ecx, %ecx<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0xgetbv<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0orl $(X86_XCR0_PKRU), %eax<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0xsetbv<br>
=C2=A0nopku:<br>
=C2=A0#endif /* CONFIG_HAVE_X86PKU */<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 /* Done setting up CPU capabilities, hand over =
to C entry point. */<br>
-- <br>
2.20.1<br>
<br>
<br>
</blockquote></div>

--000000000000b2275e05b6bae7ac--


From minios-devel-bounces@lists.xenproject.org Fri Dec 18 13:18:06 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Fri, 18 Dec 2020 13:18:06 +0000
Received: from list by lists.xenproject.org with outflank-mailman.56497.98938 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1kqFdw-00055A-Se; Fri, 18 Dec 2020 13:18:00 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 56497.98938; Fri, 18 Dec 2020 13:18: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 1kqFdw-000553-Pt; Fri, 18 Dec 2020 13:18:00 +0000
Received: by outflank-mailman (input) for mailman id 56497;
 Fri, 18 Dec 2020 13:17: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=kN/6=FW=gmail.com=razvand@srs-us1.protection.inumbo.net>)
 id 1kqFdv-00054y-Cv
 for minios-devel@lists.xen.org; Fri, 18 Dec 2020 13:17:59 +0000
Received: from mail-wr1-x42f.google.com (unknown [2a00:1450:4864:20::42f])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 696dca9b-f61c-4183-9b08-51463c32c8db;
 Fri, 18 Dec 2020 13:17:57 +0000 (UTC)
Received: by mail-wr1-x42f.google.com with SMTP id 91so2111941wrj.7
 for <minios-devel@lists.xen.org>; Fri, 18 Dec 2020 05:17:57 -0800 (PST)
Received: from localhost ([141.85.225.204])
 by smtp.gmail.com with ESMTPSA id 189sm12376498wma.22.2020.12.18.05.17.55
 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256);
 Fri, 18 Dec 2020 05:17:55 -0800 (PST)
X-BeenThere: minios-devel@lists.xenproject.org
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
Precedence: list
X-Inumbo-ID: 696dca9b-f61c-4183-9b08-51463c32c8db
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=fEHR0cJFN8M/JKm1+Y0p6A3pVTkfJOLDXSszVxCyxJQ=;
        b=Jctm1tKFnS9++XHJZJOKBUFf4rIAv7spKnNwGIjgo/adtdf7yVKaoo3YDuSyw4+MfU
         +Wq+g6NlkmoTqRR1PFwP2SK8FP07Pww4YFaKFC04mBd/89+kBW55te9dXk+dD9WjpICt
         rsy0DkiHnVwYPBXBMy+9xVS0Rws/xDBjd0msoEesH7CPLZbMUq3dxXnjHq5uI58PNRVT
         c5pWR25Wz8DCbqC42UvdhiPB07DaBRg5ZC3kAZ+yK95e8F9nBfDK9u/VAJ2aYl1dArc4
         fkcTz1nQSfBMSAwi1GPD0L3HRp52jYD2IOuU8gmfrOn51ZENsINwp8Zo5+6STpBffOmK
         D+6Q==
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=fEHR0cJFN8M/JKm1+Y0p6A3pVTkfJOLDXSszVxCyxJQ=;
        b=B9Cf91kG3KNijXA8QLemYTT8+iwhNqyPrsKrydICCSA8bbNxK0XfXT6kTsGwUCQ1ot
         Jd7S9QCU06ImHEmHBVOZ1rNmV4o4yirNyp/zPP89rgAO8+1tktkkW7LNDF/2s60gtwNV
         w0y3QS+31yT4Qn+7DqoClZyNClI1axzcoFqfX7T3zFt7aDD1sNNuIJowZ/UNPQPuKb/L
         LCUrbIbeHaWzp0nZnds3jdzYyQ5Yv2oSNmo66YsKcQP1iVf8ogGEGkpUzWJo3xJp6+au
         6DYDXGb8d6zv/TSQ0Cl6Jyo87eHny/Tp7C/tOh8FEEH5FlHC2xYSvqq4OA62Z33xbCPf
         1xWA==
X-Gm-Message-State: AOAM531VtoC4y8ebVdJN5urkxvkYJrzEOFf6f3f4QHaIeNpAQamBxVFM
	1TuOAxECKdBQj1MXusZlxaD75Fp3AWlsNQ==
X-Google-Smtp-Source: ABdhPJzMT4HAIUz5CLJ/9XMIiP42Y3Nef8yPROEym4pdMRKTnATSIuxOt1HQPe6YoEhBuMGqJQhxPg==
X-Received: by 2002:adf:e84c:: with SMTP id d12mr4628108wrn.382.1608297476328;
        Fri, 18 Dec 2020 05:17:56 -0800 (PST)
Sender: Razvan Deaconescu <razvand@gmail.com>
From: Razvan Deaconescu <razvan.deaconescu@cs.pub.ro>
To: Simon Kuenzer <simon.kuenzer@neclab.eu>
Cc: <minios-devel@lists.xen.org>
Subject: Re: [UNIKRAFT PATCH v4 3/5] lib/ukallocpool: Allocate pool on parent allocator
References: <20201209210853.18032-1-simon.kuenzer@neclab.eu>
	<20201209210853.18032-4-simon.kuenzer@neclab.eu>
Date: Fri, 18 Dec 2020 15:17:55 +0200
In-Reply-To: <20201209210853.18032-4-simon.kuenzer@neclab.eu> (Simon Kuenzer's
	message of "Wed, 9 Dec 2020 22:08:51 +0100")
Message-ID: <86czz7xngc.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

Simon Kuenzer <simon.kuenzer@neclab.eu> writes:
> Provides a function that allocates and initializes a pool on a
> given parent allocator.

See inline.

> Signed-off-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
> ---
>  lib/ukallocpool/exportsyms.uk          |  3 ++
>  lib/ukallocpool/include/uk/allocpool.h | 49 +++++++++++++++++++++
>  lib/ukallocpool/pool.c                 | 59 ++++++++++++++++++++++++++
>  3 files changed, 111 insertions(+)
>
> diff --git a/lib/ukallocpool/exportsyms.uk b/lib/ukallocpool/exportsyms.uk
> index 9d47d615..0bd38595 100644
> --- a/lib/ukallocpool/exportsyms.uk
> +++ b/lib/ukallocpool/exportsyms.uk
> @@ -1,4 +1,7 @@
> +uk_allocpool_alloc
> +uk_allocpool_free
>  uk_allocpool_init
> +uk_allocpool_reqmem
>  uk_allocpool_availcount
>  uk_allocpool_objlen
>  uk_allocpool_take
> diff --git a/lib/ukallocpool/include/uk/allocpool.h b/lib/ukallocpool/include/uk/allocpool.h
> index 60a47482..7299286b 100644
> --- a/lib/ukallocpool/include/uk/allocpool.h
> +++ b/lib/ukallocpool/include/uk/allocpool.h
> @@ -47,6 +47,55 @@ typedef void (*uk_allocpool_obj_init_t)(void *obj, size_t len, void *cookie);
>  
>  struct uk_allocpool;
>  
> +/**
> + * Computes the required memory for a pool allocation
> + *
> + * @param obj_count
> + *  Number of objects that are allocated with the pool
> + * @param obj_len
> + *  Size of one object (bytes)
> + * @param obj_align
> + *  Alignment requirement for each pool object
> + * @return
> + *  Number of bytes needed for pool allocation
> + */
> +size_t uk_allocpool_reqmem(unsigned int obj_count, size_t obj_len,
> +			   size_t obj_align);
> +
> +/**
> + * Allocates a memory pool on a parent allocator.
> + *
> + * @param obj_count
> + *  Number of objects that are allocated with the pool
> + * @param obj_len
> + *  Size of one object (bytes)
> + * @param obj_align
> + *  Alignment requirement for each pool object
> + * @param obj_init
> + *  Function pointer to object initialization
> + * @param obj_init_cookie
> + *  Cookie that is hand-over to object initialization
> + * @return
> + *  - (NULL): If allocation failed (e.g., ENOMEM)
> + *  - pointer to allocated pool
> + */

The function comment doesn't correlate with the function interface.

> +struct uk_allocpool *uk_allocpool_alloc(struct uk_alloc *parent,
> +					unsigned int obj_count,
> +					size_t obj_len, size_t obj_align);
> +
> +/**
> + * Frees a memory pool that was allocated with
> + * uk_allocpool_alloc(). The memory is returned to
> + * the parent allocator.
> + * Note: Please make sure that all taken objects
> + * are returned to the pool before free'ing the
> + * pool.
> + *
> + * @param p
> + *  Pointer to memory pool that will be free'd.
> + */
> +void uk_allocpool_free(struct uk_allocpool *p);
> +
>  /**
>   * Initializes a memory pool on a given memory range.
>   *
> diff --git a/lib/ukallocpool/pool.c b/lib/ukallocpool/pool.c
> index 5d5ddbde..31fc8b2d 100644
> --- a/lib/ukallocpool/pool.c
> +++ b/lib/ukallocpool/pool.c
> @@ -73,6 +73,9 @@ struct uk_allocpool {
>  	size_t obj_align;
>  	size_t obj_len;
>  	unsigned int obj_count;
> +
> +	struct uk_alloc *parent;
> +	void *base;
>  };
>  
>  struct free_obj {
> @@ -123,6 +126,21 @@ void uk_allocpool_return(struct uk_allocpool *p, void *obj)
>  	_prepend_free_obj(p, obj);
>  }
>  
> +size_t uk_allocpool_reqmem(unsigned int obj_count, size_t obj_len,
> +			   size_t obj_align)
> +{
> +	size_t obj_alen;
> +
> +	UK_ASSERT(POWER_OF_2(obj_align));
> +
> +	obj_len   = MAX(obj_len, MIN_OBJ_LEN);
> +	obj_align = MAX(obj_align, MIN_OBJ_ALIGN);
> +	obj_alen  = ALIGN_UP(obj_len, obj_align);
> +	return (sizeof(struct uk_allocpool)
> +		+ obj_align
> +		+ ((size_t) obj_count * obj_alen));
> +}
> +
>  unsigned int uk_allocpool_availcount(struct uk_allocpool *p)
>  {
>  	return p->free_obj_count;
> @@ -181,8 +199,49 @@ struct uk_allocpool *uk_allocpool_init(void *base, size_t len,
>  out:
>  	p->obj_len         = obj_alen;
>  	p->obj_align       = obj_align;
> +	p->base            = base;
> +	p->parent          = NULL;
>  
>  	uk_pr_debug("%p: Pool created (%"__PRIsz" B): %u objs of %"__PRIsz" B, aligned to %"__PRIsz" B\n",
>  		    p, len, p->obj_count, p->obj_len, p->obj_align);
>  	return p;
>  }
> +
> +struct uk_allocpool *uk_allocpool_alloc(struct uk_alloc *parent,
> +					unsigned int obj_count,
> +					size_t obj_len, size_t obj_align)
> +{
> +	struct uk_allocpool *p;
> +	void *base;
> +	size_t len;
> +
> +	/* uk_allocpool_reqmem computes minimum requirement */
> +	len = uk_allocpool_reqmem(obj_count, obj_len, obj_align);
> +	base = uk_malloc(parent, len);
> +	if (!base)
> +		return NULL;
> +
> +	p = uk_allocpool_init(base, len, obj_len, obj_align);
> +	if (!p) {
> +		uk_free(parent, base);
> +		errno = ENOSPC;
> +		return NULL;
> +	}
> +
> +	p->parent = parent;
> +	return p;
> +}
> +
> +void uk_allocpool_free(struct uk_allocpool *p)
> +{
> +	/* If we do not have a parent, this pool was created with
> +	 * uk_allocpool_init(). Such a pool cannot be free'd with
> +	 * this function since we are not the owner of the allocation
> +	 */
> +	UK_ASSERT(p->parent);
> +
> +	/* Make sure we got all objects back */
> +	UK_ASSERT(p->free_obj_count == p->obj_count);
> +
> +	uk_free(p->parent, p->base);
> +}


From minios-devel-bounces@lists.xenproject.org Fri Dec 18 13:26:04 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Fri, 18 Dec 2020 13:26:04 +0000
Received: from list by lists.xenproject.org with outflank-mailman.56500.98945 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1kqFlj-00062t-JS; Fri, 18 Dec 2020 13:26:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 56500.98945; Fri, 18 Dec 2020 13:26: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 1kqFlj-00062m-Gd; Fri, 18 Dec 2020 13:26:03 +0000
Received: by outflank-mailman (input) for mailman id 56500;
 Fri, 18 Dec 2020 13:26: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=kN/6=FW=gmail.com=razvand@srs-us1.protection.inumbo.net>)
 id 1kqFli-00062h-I7
 for minios-devel@lists.xen.org; Fri, 18 Dec 2020 13:26:02 +0000
Received: from mail-wr1-x430.google.com (unknown [2a00:1450:4864:20::430])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id d4dd0d6b-490a-4d99-af07-a72c952ecbe9;
 Fri, 18 Dec 2020 13:26:00 +0000 (UTC)
Received: by mail-wr1-x430.google.com with SMTP id m5so2127621wrx.9
 for <minios-devel@lists.xen.org>; Fri, 18 Dec 2020 05:26:00 -0800 (PST)
Received: from localhost ([141.85.225.204])
 by smtp.gmail.com with ESMTPSA id a13sm13002142wrt.96.2020.12.18.05.25.58
 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256);
 Fri, 18 Dec 2020 05:25:58 -0800 (PST)
X-BeenThere: minios-devel@lists.xenproject.org
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
Precedence: list
X-Inumbo-ID: d4dd0d6b-490a-4d99-af07-a72c952ecbe9
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=Vrr3dl9MOLBbhB/OpgkstmtE3P162UN+wK4HWl/Gtzc=;
        b=HdwS/NYg2ULPmeKiQEZ0bplRovIFSf32RFKI8oojcd49+jucFwmWpA9kHokj2ssDFv
         5gfJ5q7GvQ7YWl3Dfo7Uf5izkToTma8ffnur7QAAozafpzGqauyfxNJxNMsiRC4atNEm
         ZtQ3WZPJ/melJxKLpgYiYZHtbusGgFKh8IOLCMuDnojL3qLq7QlZCgkjfg4gZ7/rYOJZ
         JwrnJX9hAI+uD3I1mrGUIVA1lWzvJyjEs2lQvQv8jL0i9aNeSjY5g4FPV50Djcx9/CvC
         KakYsQfuK/hhkak4/+Gf3HVFfuw7cZOKNiWVhwg8WeyYQ4a730IGi/MkIxF4iAJAk/uO
         6HbQ==
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=Vrr3dl9MOLBbhB/OpgkstmtE3P162UN+wK4HWl/Gtzc=;
        b=NakkPRWjGPYVvqofrxPrUcYHA7GiZsKgOljJQm1KPggfS/vof2UHTr17eAaRXAEtwR
         bHv53VXxwrq76juieNcpKuzWw1LaIgAfQwcgs/143Rz8cW1QX/2yUsmm53WSnQo1LDPv
         F2m6MTLQvCHGrno1s1zi5Ix7gLPMMGfcdvj55likL8AdfuCWlPUPuQTiTCraQTPDMwyX
         XGReDSMVS/TeQNVIGjEr7t7j+NuGGDv8/bCE+vy3ZyEWOqUSc2uKQMb0oUZr1zPA45UD
         XNR4VC1+VUnLIZNGXVbMxpd6Wu0SpslC8f5Lg45BfwovNFNhjCMdXMCYo6cUjFrV2IUv
         PV4A==
X-Gm-Message-State: AOAM532fRnw58319ge1De90yRtH3N5Zv9F2NbH5OPX6Gz2hqDzAutj9M
	5NY5RjCXhhUFWSQpYjaBwTQ=
X-Google-Smtp-Source: ABdhPJxBYqReqnbHCf1yPKYb594yP7sblRWLbP16mVWchxj6eAuK1aZtYoqwinN1FNMPH15CHHTfSQ==
X-Received: by 2002:a5d:6289:: with SMTP id k9mr4661280wru.200.1608297959220;
        Fri, 18 Dec 2020 05:25:59 -0800 (PST)
Sender: Razvan Deaconescu <razvand@gmail.com>
From: Razvan Deaconescu <razvan.deaconescu@cs.pub.ro>
To: Simon Kuenzer <simon.kuenzer@neclab.eu>
Cc: <minios-devel@lists.xen.org>
Subject: Re: [UNIKRAFT PATCH v4 2/5] lib/ukallocpool: LIFO pool implementation
References: <20201209210853.18032-1-simon.kuenzer@neclab.eu>
	<20201209210853.18032-3-simon.kuenzer@neclab.eu>
Date: Fri, 18 Dec 2020 15:25:58 +0200
In-Reply-To: <20201209210853.18032-3-simon.kuenzer@neclab.eu> (Simon Kuenzer's
	message of "Wed, 9 Dec 2020 22:08:50 +0100")
Message-ID: <868s9vxn2x.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

Simon Kuenzer <simon.kuenzer@neclab.eu> writes:
> Initial implementation of a memory pool (same-sized and fixed-sized object
> allocator) following LIFO principle by using a single list to keep track of
> free objects. LIFO is chosen to potentially better utilize hardware caches.

See inline. I'll reply with another e-mail for a more in-depth review.

> Signed-off-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
> ---
>  lib/ukallocpool/Makefile.uk            |   2 +
>  lib/ukallocpool/exportsyms.uk          |   5 +
>  lib/ukallocpool/include/uk/allocpool.h | 117 +++++++++++++++
>  lib/ukallocpool/pool.c                 | 188 +++++++++++++++++++++++++
>  4 files changed, 312 insertions(+)
>  create mode 100644 lib/ukallocpool/exportsyms.uk
>  create mode 100644 lib/ukallocpool/include/uk/allocpool.h
>  create mode 100644 lib/ukallocpool/pool.c
>
> diff --git a/lib/ukallocpool/Makefile.uk b/lib/ukallocpool/Makefile.uk
> index c71c9764..63c24dc1 100644
> --- a/lib/ukallocpool/Makefile.uk
> +++ b/lib/ukallocpool/Makefile.uk
> @@ -2,3 +2,5 @@ $(eval $(call addlib_s,libukallocpool,$(CONFIG_LIBUKALLOCPOOL)))
>  
>  CINCLUDES-$(CONFIG_LIBUKALLOCPOOL)	+= -I$(LIBUKALLOCPOOL_BASE)/include
>  CXXINCLUDES-$(CONFIG_LIBUKALLOCPOOL)	+= -I$(LIBUKALLOCPOOL_BASE)/include
> +
> +LIBUKALLOCPOOL_SRCS-y += $(LIBUKALLOCPOOL_BASE)/pool.c
> diff --git a/lib/ukallocpool/exportsyms.uk b/lib/ukallocpool/exportsyms.uk
> new file mode 100644
> index 00000000..9d47d615
> --- /dev/null
> +++ b/lib/ukallocpool/exportsyms.uk
> @@ -0,0 +1,5 @@
> +uk_allocpool_init
> +uk_allocpool_availcount
> +uk_allocpool_objlen
> +uk_allocpool_take
> +uk_allocpool_return
> diff --git a/lib/ukallocpool/include/uk/allocpool.h b/lib/ukallocpool/include/uk/allocpool.h
> new file mode 100644
> index 00000000..60a47482
> --- /dev/null
> +++ b/lib/ukallocpool/include/uk/allocpool.h
> @@ -0,0 +1,117 @@
> +/* SPDX-License-Identifier: BSD-3-Clause */
> +/*
> + * Simple memory pool using LIFO principle
> + *
> + * Authors: Simon Kuenzer <simon.kuenzer@neclab.eu>
> + *
> + *
> + * Copyright (c) 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
> + * 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 __LIBUKALLOCPOOL_H__
> +#define __LIBUKALLOCPOOL_H__
> +
> +#include <uk/alloc.h>
> +
> +#ifdef __cplusplus
> +extern "C" {
> +#endif
> +
> +typedef void (*uk_allocpool_obj_init_t)(void *obj, size_t len, void *cookie);
> +
> +struct uk_allocpool;
> +
> +/**
> + * Initializes a memory pool on a given memory range.
> + *
> + * @param base
> + *  Base address of memory range
> + * @param len
> + *  Length of memory range (bytes)
> + * @param obj_len
> + *  Size of one object (bytes)
> + * @param obj_align
> + *  Alignment requirement for each pool object
> + * @param obj_init
> + *  Function pointer to object initialization
> + * @param obj_init_cookie
> + *  Cookie that is hand-over to object initialization
> + * @return
> + *  - (NULL): Not enough memory for pool
> + *  - pointer to initializes pool
> + */

There are two extra arguments in the function-level comment: obj_init
and obj_init_cookie.

> +struct uk_allocpool *uk_allocpool_init(void *base, size_t len,
> +				       size_t obj_len, size_t obj_align);
> +
> +/**
> + * Return the number of current available (free) objects
> + *
> + * @param p
> + *  Pointer to memory pool.
> + * @return
> + *  Number of free objects in the pool.
> + */
> +unsigned int uk_allocpool_availcount(struct uk_allocpool *p);
> +
> +/**
> + * Return the size of an object
> + *
> + * @param p
> + *  Pointer to memory pool.
> + * @return
> + *  Size of an object
> + */
> +size_t uk_allocpool_objlen(struct uk_allocpool *p);
> +
> +/**
> + * Get one object from a pool
> + *
> + * @param p
> + *  Pointer to memory pool.
> + * @return
> + *  - (NULL): No more free objects available
> + *  - Pointer to object.
> + */
> +void *uk_allocpool_take(struct uk_allocpool *p);
> +
> +/**
> + * Return one object back to a pool
> + *
> + * @param p
> + *  Pointer to memory pool.
> + * @param obj
> + *  Pointer to object that should be returned.
> + */
> +void uk_allocpool_return(struct uk_allocpool *p, void *obj);
> +
> +#ifdef __cplusplus
> +}
> +#endif
> +
> +#endif /* __LIBUKALLOCPOOL_H__ */
> diff --git a/lib/ukallocpool/pool.c b/lib/ukallocpool/pool.c
> new file mode 100644
> index 00000000..5d5ddbde
> --- /dev/null
> +++ b/lib/ukallocpool/pool.c
> @@ -0,0 +1,188 @@
> +/* SPDX-License-Identifier: BSD-3-Clause */
> +/*
> + * Simple memory pool using LIFO principle
> + *
> + * Authors: Simon Kuenzer <simon.kuenzer@neclab.eu>
> + *
> + *
> + * Copyright (c) 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
> + * 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/essentials.h>
> +#include <uk/alloc_impl.h>
> +#include <uk/allocpool.h>
> +#include <uk/list.h>
> +#include <string.h>
> +#include <stddef.h>
> +#include <stdint.h>
> +#include <sys/types.h>
> +#include <errno.h>
> +
> +/*
> + * POOL: MEMORY LAYOUT
> + *
> + *          ++---------------------++
> + *          || struct uk_allocpool ||
> + *          ||                     ||
> + *          ++---------------------++
> + *          |    // padding //      |
> + *          +=======================+
> + *          |       OBJECT 1        |
> + *          +=======================+
> + *          |       OBJECT 2        |
> + *          +=======================+
> + *          |       OBJECT 3        |
> + *          +=======================+
> + *          |         ...           |
> + *          v                       v
> + */
> +
> +#define MIN_OBJ_ALIGN sizeof(void *)
> +#define MIN_OBJ_LEN   sizeof(struct uk_list_head)
> +
> +struct uk_allocpool {
> +	struct uk_list_head free_obj;
> +	unsigned int free_obj_count;
> +
> +	size_t obj_align;
> +	size_t obj_len;
> +	unsigned int obj_count;
> +};
> +
> +struct free_obj {
> +	struct uk_list_head list;
> +};
> +
> +static inline void _prepend_free_obj(struct uk_allocpool *p, void *obj)
> +{
> +	struct uk_list_head *entry;
> +
> +	UK_ASSERT(p);
> +	UK_ASSERT(obj);
> +	UK_ASSERT(p->free_obj_count < p->obj_count);
> +
> +	entry = &((struct free_obj *) obj)->list;
> +	uk_list_add(entry, &p->free_obj);
> +	p->free_obj_count++;
> +}
> +
> +static inline void *_take_free_obj(struct uk_allocpool *p)
> +{
> +	struct free_obj *obj;
> +
> +	UK_ASSERT(p);
> +	UK_ASSERT(p->free_obj_count > 0);
> +
> +	/* get object from list head */
> +	obj = uk_list_first_entry(&p->free_obj, struct free_obj, list);
> +	uk_list_del(&obj->list);
> +	p->free_obj_count--;
> +	return (void *) obj;
> +}
> +
> +void *uk_allocpool_take(struct uk_allocpool *p)
> +{
> +	UK_ASSERT(p);
> +
> +	if (unlikely(uk_list_empty(&p->free_obj)))
> +		return NULL;
> +
> +	return _take_free_obj(p);
> +}
> +
> +void uk_allocpool_return(struct uk_allocpool *p, void *obj)
> +{
> +	UK_ASSERT(p);
> +
> +	_prepend_free_obj(p, obj);
> +}
> +
> +unsigned int uk_allocpool_availcount(struct uk_allocpool *p)
> +{
> +	return p->free_obj_count;
> +}
> +
> +size_t uk_allocpool_objlen(struct uk_allocpool *p)
> +{
> +	return p->obj_len;
> +}
> +
> +struct uk_allocpool *uk_allocpool_init(void *base, size_t len,
> +				       size_t obj_len, size_t obj_align)
> +{
> +	struct uk_allocpool *p;
> +	struct uk_alloc *a;
> +	size_t obj_alen;
> +	size_t left;
> +	void *obj_ptr;
> +
> +	UK_ASSERT(POWER_OF_2(obj_align));
> +
> +	if (!base || sizeof(struct uk_allocpool) > len) {
> +		errno = ENOSPC;
> +		return NULL;
> +	}
> +
> +	/* apply minimum requirements */
> +	obj_len   = MAX(obj_len, MIN_OBJ_LEN);
> +	obj_align = MAX(obj_align, MIN_OBJ_ALIGN);
> +
> +	p = (struct uk_allocpool *) base;
> +	memset(p, 0, sizeof(*p));
> +	a = uk_allocpool2alloc(p);
> +
> +	obj_alen = ALIGN_UP(obj_len, obj_align);
> +	obj_ptr = (void *) ALIGN_UP((uintptr_t) base + sizeof(*p),
> +				    obj_align);
> +	if ((uintptr_t) obj_ptr > (uintptr_t) base + len) {
> +		uk_pr_debug("%p: Empty pool: Not enough space for allocating objects\n",
> +			    p);
> +		goto out;
> +	}
> +
> +	left = len - ((uintptr_t) obj_ptr - (uintptr_t) base);
> +
> +	p->obj_count = 0;
> +	p->free_obj_count = 0;
> +	UK_INIT_LIST_HEAD(&p->free_obj);
> +	while (left >= obj_alen) {
> +		++p->obj_count;
> +		_prepend_free_obj(p, obj_ptr);
> +		obj_ptr = (void *) ((uintptr_t) obj_ptr + obj_alen);
> +		left -= obj_alen;
> +	}
> +
> +out:
> +	p->obj_len         = obj_alen;
> +	p->obj_align       = obj_align;
> +
> +	uk_pr_debug("%p: Pool created (%"__PRIsz" B): %u objs of %"__PRIsz" B, aligned to %"__PRIsz" B\n",
> +		    p, len, p->obj_count, p->obj_len, p->obj_align);
> +	return p;
> +}


From minios-devel-bounces@lists.xenproject.org Fri Dec 18 13:30:30 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Fri, 18 Dec 2020 13:30:30 +0000
Received: from list by lists.xenproject.org with outflank-mailman.56503.98950 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1kqFq1-0006yI-W5; Fri, 18 Dec 2020 13:30:29 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 56503.98950; Fri, 18 Dec 2020 13:30: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 1kqFq1-0006yB-Sc; Fri, 18 Dec 2020 13:30:29 +0000
Received: by outflank-mailman (input) for mailman id 56503;
 Fri, 18 Dec 2020 13:30: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=kN/6=FW=gmail.com=razvand@srs-us1.protection.inumbo.net>)
 id 1kqFq1-0006y6-1w
 for minios-devel@lists.xen.org; Fri, 18 Dec 2020 13:30:29 +0000
Received: from mail-wr1-x42a.google.com (unknown [2a00:1450:4864:20::42a])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id cf4851d5-78f5-407d-8c45-b6cf97f968f1;
 Fri, 18 Dec 2020 13:30:26 +0000 (UTC)
Received: by mail-wr1-x42a.google.com with SMTP id y17so2150272wrr.10
 for <minios-devel@lists.xen.org>; Fri, 18 Dec 2020 05:30:26 -0800 (PST)
Received: from localhost ([141.85.225.204])
 by smtp.gmail.com with ESMTPSA id d191sm11479543wmd.24.2020.12.18.05.30.25
 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256);
 Fri, 18 Dec 2020 05:30:25 -0800 (PST)
X-BeenThere: minios-devel@lists.xenproject.org
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
Precedence: list
X-Inumbo-ID: cf4851d5-78f5-407d-8c45-b6cf97f968f1
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=8dvyEM0PPC1JTaKN8Cj7VxMbMA9eQAiyLvcrXKigJxM=;
        b=PV9f2ko5WUSFtHWxH7OFYv0GTOrRcm926Uc8yrJZhvfPMuleJKQ8AnEshITbaf0HTo
         ozQl9FMxxvBakCgHqRQm0Dvu5dJrHDgRS3z2xSwaMMIn69iFWuoRiEO6mJkivO0yeWcD
         Eg5ye+L2NmffkPYQ1EYY1bCBMdauwmJT9qiT7zVzqE7KGE5x2FACRD8HXNpeC7PtXh9F
         gW7k2uB4fUQfZkBwdHbu8Cy9+MY7DTUG4GvFwtZ6KlARnHSxl9dxN+UyoqDZovsF/ix6
         wy6IpNzpWpwqsbJiyWsIfYWyA/Ca2DIZkC1zdpHLpiomxIUj3r4GPWXN5b+XxQbB992T
         zbhQ==
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=8dvyEM0PPC1JTaKN8Cj7VxMbMA9eQAiyLvcrXKigJxM=;
        b=MqCcpM/Wrj1vR/X1Bu0AmvfsgQpd/n1/rqpflgARMLZunkWRLCDorYo4nT2zLgwEfd
         0Bb5fC3wxEc+ooVNDOuNMNqr+lGr2t0vth/v3gTuaL7K75DKObK4NLMwHjztO3kqVFx+
         RXk1TsNnagcCF30GX+CJq1AO0Eaq71l7U2isRc4DxN1+SUJ1SREx158FlqkK6V5encZq
         ywoynBQk9v4x1KMH7z0ZCbNBYWRgNIZ6anYpw1FUrs9PVPC0MDezEwK25kyfcVtlWUZw
         a4RpQjeCPpJ0kMMH9exTNLhrefZ/xygte10hYbNNCIHN+RtB6uSMwtZwDGh+xgnfPtxi
         hTYw==
X-Gm-Message-State: AOAM533VLBZYG66udzSRAnjvl8oJ9Ehaf3VEbr7GvLgXhb3PccQ+1C8I
	ZvJksLgYmcvSWokInPj5Rr7ZGXTxxmouzg==
X-Google-Smtp-Source: ABdhPJz0EaWhNz7XHyf6zbynLHph77S/Ko2ceEB8TyErjTfva6er0ytzxddvCVHtd/YsgXQnL0i7TA==
X-Received: by 2002:a5d:6845:: with SMTP id o5mr4462657wrw.421.1608298225629;
        Fri, 18 Dec 2020 05:30:25 -0800 (PST)
Sender: Razvan Deaconescu <razvand@gmail.com>
From: Razvan Deaconescu <razvan.deaconescu@cs.pub.ro>
To: Simon Kuenzer <simon.kuenzer@neclab.eu>
Cc: <minios-devel@lists.xen.org>
Subject: Re: [UNIKRAFT PATCH v4 2/5] lib/ukallocpool: LIFO pool implementation
References: <20201209210853.18032-1-simon.kuenzer@neclab.eu>
	<20201209210853.18032-3-simon.kuenzer@neclab.eu>
Date: Fri, 18 Dec 2020 15:30:24 +0200
In-Reply-To: <20201209210853.18032-3-simon.kuenzer@neclab.eu> (Simon Kuenzer's
	message of "Wed, 9 Dec 2020 22:08:50 +0100")
Message-ID: <864kkjxmvj.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

For consistency, please end each comment sentence with a dot (.)

Razvan

Simon Kuenzer <simon.kuenzer@neclab.eu> writes:
> Initial implementation of a memory pool (same-sized and fixed-sized object
> allocator) following LIFO principle by using a single list to keep track of
> free objects. LIFO is chosen to potentially better utilize hardware caches.
>
> Signed-off-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
> ---
>  lib/ukallocpool/Makefile.uk            |   2 +
>  lib/ukallocpool/exportsyms.uk          |   5 +
>  lib/ukallocpool/include/uk/allocpool.h | 117 +++++++++++++++
>  lib/ukallocpool/pool.c                 | 188 +++++++++++++++++++++++++
>  4 files changed, 312 insertions(+)
>  create mode 100644 lib/ukallocpool/exportsyms.uk
>  create mode 100644 lib/ukallocpool/include/uk/allocpool.h
>  create mode 100644 lib/ukallocpool/pool.c
>
> diff --git a/lib/ukallocpool/Makefile.uk b/lib/ukallocpool/Makefile.uk
> index c71c9764..63c24dc1 100644
> --- a/lib/ukallocpool/Makefile.uk
> +++ b/lib/ukallocpool/Makefile.uk
> @@ -2,3 +2,5 @@ $(eval $(call addlib_s,libukallocpool,$(CONFIG_LIBUKALLOCPOOL)))
>  
>  CINCLUDES-$(CONFIG_LIBUKALLOCPOOL)	+= -I$(LIBUKALLOCPOOL_BASE)/include
>  CXXINCLUDES-$(CONFIG_LIBUKALLOCPOOL)	+= -I$(LIBUKALLOCPOOL_BASE)/include
> +
> +LIBUKALLOCPOOL_SRCS-y += $(LIBUKALLOCPOOL_BASE)/pool.c
> diff --git a/lib/ukallocpool/exportsyms.uk b/lib/ukallocpool/exportsyms.uk
> new file mode 100644
> index 00000000..9d47d615
> --- /dev/null
> +++ b/lib/ukallocpool/exportsyms.uk
> @@ -0,0 +1,5 @@
> +uk_allocpool_init
> +uk_allocpool_availcount
> +uk_allocpool_objlen
> +uk_allocpool_take
> +uk_allocpool_return
> diff --git a/lib/ukallocpool/include/uk/allocpool.h b/lib/ukallocpool/include/uk/allocpool.h
> new file mode 100644
> index 00000000..60a47482
> --- /dev/null
> +++ b/lib/ukallocpool/include/uk/allocpool.h
> @@ -0,0 +1,117 @@
> +/* SPDX-License-Identifier: BSD-3-Clause */
> +/*
> + * Simple memory pool using LIFO principle
> + *
> + * Authors: Simon Kuenzer <simon.kuenzer@neclab.eu>
> + *
> + *
> + * Copyright (c) 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
> + * 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 __LIBUKALLOCPOOL_H__
> +#define __LIBUKALLOCPOOL_H__
> +
> +#include <uk/alloc.h>
> +
> +#ifdef __cplusplus
> +extern "C" {
> +#endif
> +
> +typedef void (*uk_allocpool_obj_init_t)(void *obj, size_t len, void *cookie);
> +
> +struct uk_allocpool;
> +
> +/**
> + * Initializes a memory pool on a given memory range.
> + *
> + * @param base
> + *  Base address of memory range
> + * @param len
> + *  Length of memory range (bytes)
> + * @param obj_len
> + *  Size of one object (bytes)
> + * @param obj_align
> + *  Alignment requirement for each pool object
> + * @param obj_init
> + *  Function pointer to object initialization
> + * @param obj_init_cookie
> + *  Cookie that is hand-over to object initialization
> + * @return
> + *  - (NULL): Not enough memory for pool
> + *  - pointer to initializes pool
> + */
> +struct uk_allocpool *uk_allocpool_init(void *base, size_t len,
> +				       size_t obj_len, size_t obj_align);
> +
> +/**
> + * Return the number of current available (free) objects
> + *
> + * @param p
> + *  Pointer to memory pool.
> + * @return
> + *  Number of free objects in the pool.
> + */
> +unsigned int uk_allocpool_availcount(struct uk_allocpool *p);
> +
> +/**
> + * Return the size of an object
> + *
> + * @param p
> + *  Pointer to memory pool.
> + * @return
> + *  Size of an object
> + */
> +size_t uk_allocpool_objlen(struct uk_allocpool *p);
> +
> +/**
> + * Get one object from a pool
> + *
> + * @param p
> + *  Pointer to memory pool.
> + * @return
> + *  - (NULL): No more free objects available
> + *  - Pointer to object.
> + */
> +void *uk_allocpool_take(struct uk_allocpool *p);
> +
> +/**
> + * Return one object back to a pool
> + *
> + * @param p
> + *  Pointer to memory pool.
> + * @param obj
> + *  Pointer to object that should be returned.
> + */
> +void uk_allocpool_return(struct uk_allocpool *p, void *obj);
> +
> +#ifdef __cplusplus
> +}
> +#endif
> +
> +#endif /* __LIBUKALLOCPOOL_H__ */
> diff --git a/lib/ukallocpool/pool.c b/lib/ukallocpool/pool.c
> new file mode 100644
> index 00000000..5d5ddbde
> --- /dev/null
> +++ b/lib/ukallocpool/pool.c
> @@ -0,0 +1,188 @@
> +/* SPDX-License-Identifier: BSD-3-Clause */
> +/*
> + * Simple memory pool using LIFO principle
> + *
> + * Authors: Simon Kuenzer <simon.kuenzer@neclab.eu>
> + *
> + *
> + * Copyright (c) 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
> + * 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/essentials.h>
> +#include <uk/alloc_impl.h>
> +#include <uk/allocpool.h>
> +#include <uk/list.h>
> +#include <string.h>
> +#include <stddef.h>
> +#include <stdint.h>
> +#include <sys/types.h>
> +#include <errno.h>
> +
> +/*
> + * POOL: MEMORY LAYOUT
> + *
> + *          ++---------------------++
> + *          || struct uk_allocpool ||
> + *          ||                     ||
> + *          ++---------------------++
> + *          |    // padding //      |
> + *          +=======================+
> + *          |       OBJECT 1        |
> + *          +=======================+
> + *          |       OBJECT 2        |
> + *          +=======================+
> + *          |       OBJECT 3        |
> + *          +=======================+
> + *          |         ...           |
> + *          v                       v
> + */
> +
> +#define MIN_OBJ_ALIGN sizeof(void *)
> +#define MIN_OBJ_LEN   sizeof(struct uk_list_head)
> +
> +struct uk_allocpool {
> +	struct uk_list_head free_obj;
> +	unsigned int free_obj_count;
> +
> +	size_t obj_align;
> +	size_t obj_len;
> +	unsigned int obj_count;
> +};
> +
> +struct free_obj {
> +	struct uk_list_head list;
> +};
> +
> +static inline void _prepend_free_obj(struct uk_allocpool *p, void *obj)
> +{
> +	struct uk_list_head *entry;
> +
> +	UK_ASSERT(p);
> +	UK_ASSERT(obj);
> +	UK_ASSERT(p->free_obj_count < p->obj_count);
> +
> +	entry = &((struct free_obj *) obj)->list;
> +	uk_list_add(entry, &p->free_obj);
> +	p->free_obj_count++;
> +}
> +
> +static inline void *_take_free_obj(struct uk_allocpool *p)
> +{
> +	struct free_obj *obj;
> +
> +	UK_ASSERT(p);
> +	UK_ASSERT(p->free_obj_count > 0);
> +
> +	/* get object from list head */
> +	obj = uk_list_first_entry(&p->free_obj, struct free_obj, list);
> +	uk_list_del(&obj->list);
> +	p->free_obj_count--;
> +	return (void *) obj;
> +}
> +
> +void *uk_allocpool_take(struct uk_allocpool *p)
> +{
> +	UK_ASSERT(p);
> +
> +	if (unlikely(uk_list_empty(&p->free_obj)))
> +		return NULL;
> +
> +	return _take_free_obj(p);
> +}
> +
> +void uk_allocpool_return(struct uk_allocpool *p, void *obj)
> +{
> +	UK_ASSERT(p);
> +
> +	_prepend_free_obj(p, obj);
> +}
> +
> +unsigned int uk_allocpool_availcount(struct uk_allocpool *p)
> +{
> +	return p->free_obj_count;
> +}
> +
> +size_t uk_allocpool_objlen(struct uk_allocpool *p)
> +{
> +	return p->obj_len;
> +}
> +
> +struct uk_allocpool *uk_allocpool_init(void *base, size_t len,
> +				       size_t obj_len, size_t obj_align)
> +{
> +	struct uk_allocpool *p;
> +	struct uk_alloc *a;
> +	size_t obj_alen;
> +	size_t left;
> +	void *obj_ptr;
> +
> +	UK_ASSERT(POWER_OF_2(obj_align));
> +
> +	if (!base || sizeof(struct uk_allocpool) > len) {
> +		errno = ENOSPC;
> +		return NULL;
> +	}
> +
> +	/* apply minimum requirements */
> +	obj_len   = MAX(obj_len, MIN_OBJ_LEN);
> +	obj_align = MAX(obj_align, MIN_OBJ_ALIGN);
> +
> +	p = (struct uk_allocpool *) base;
> +	memset(p, 0, sizeof(*p));
> +	a = uk_allocpool2alloc(p);
> +
> +	obj_alen = ALIGN_UP(obj_len, obj_align);
> +	obj_ptr = (void *) ALIGN_UP((uintptr_t) base + sizeof(*p),
> +				    obj_align);
> +	if ((uintptr_t) obj_ptr > (uintptr_t) base + len) {
> +		uk_pr_debug("%p: Empty pool: Not enough space for allocating objects\n",
> +			    p);
> +		goto out;
> +	}
> +
> +	left = len - ((uintptr_t) obj_ptr - (uintptr_t) base);
> +
> +	p->obj_count = 0;
> +	p->free_obj_count = 0;
> +	UK_INIT_LIST_HEAD(&p->free_obj);
> +	while (left >= obj_alen) {
> +		++p->obj_count;
> +		_prepend_free_obj(p, obj_ptr);
> +		obj_ptr = (void *) ((uintptr_t) obj_ptr + obj_alen);
> +		left -= obj_alen;
> +	}
> +
> +out:
> +	p->obj_len         = obj_alen;
> +	p->obj_align       = obj_align;
> +
> +	uk_pr_debug("%p: Pool created (%"__PRIsz" B): %u objs of %"__PRIsz" B, aligned to %"__PRIsz" B\n",
> +		    p, len, p->obj_count, p->obj_len, p->obj_align);
> +	return p;
> +}


From minios-devel-bounces@lists.xenproject.org Fri Dec 18 15:56:37 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Fri, 18 Dec 2020 15:56:37 +0000
Received: from list by lists.xenproject.org with outflank-mailman.56556.99061 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1kqI7O-0004s4-9j; Fri, 18 Dec 2020 15:56:34 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 56556.99061; Fri, 18 Dec 2020 15:56: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 1kqI7O-0004rx-6r; Fri, 18 Dec 2020 15:56:34 +0000
Received: by outflank-mailman (input) for mailman id 56556;
 Fri, 18 Dec 2020 15:56: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=6OJK=FW=neclab.eu=simon.kuenzer@srs-us1.protection.inumbo.net>)
 id 1kqI7N-0004rs-NP
 for minios-devel@lists.xen.org; Fri, 18 Dec 2020 15:56:33 +0000
Received: from mailer1.neclab.eu (unknown [195.37.70.40])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 7485647d-0d04-43c8-bce6-5fee9aaf2fd6;
 Fri, 18 Dec 2020 15:56:30 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
 by mailer1.neclab.eu (Postfix) with ESMTP id 78EF6103B44;
 Fri, 18 Dec 2020 16:56:29 +0100 (CET)
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 dZ7oW49mWLNX; Fri, 18 Dec 2020 16:56:29 +0100 (CET)
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 511A2FFDDE;
 Fri, 18 Dec 2020 16:56:29 +0100 (CET)
Received: from [10.7.2.50] (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.2044.4; Fri, 18 Dec
 2020 16:56:28 +0100
X-BeenThere: minios-devel@lists.xenproject.org
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
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: 7485647d-0d04-43c8-bce6-5fee9aaf2fd6
X-Virus-Scanned: Amavisd on Debian GNU/Linux (atlas-a.office.hd)
X-ENC: Last-Hop-TLS-encrypted
X-ENC: Last-Hop-TLS-encrypted
Subject: Re: [UNIKRAFT PATCH v4 2/5] lib/ukallocpool: LIFO pool implementation
To: Razvan Deaconescu <razvan.deaconescu@cs.pub.ro>
CC: <minios-devel@lists.xen.org>
References: <20201209210853.18032-1-simon.kuenzer@neclab.eu>
 <20201209210853.18032-3-simon.kuenzer@neclab.eu>
 <868s9vxn2x.fsf@drone.cs.pub.ro>
From: Simon Kuenzer <simon.kuenzer@neclab.eu>
Message-ID: <2621bc0d-7b61-fbdf-9d9d-9d30313cb896@neclab.eu>
Date: Fri, 18 Dec 2020 16:56:28 +0100
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0)
 Gecko/20100101 Thunderbird/78.5.1
MIME-Version: 1.0
In-Reply-To: <868s9vxn2x.fsf@drone.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)

On 18.12.20 14:25, Razvan Deaconescu wrote:
> Simon Kuenzer <simon.kuenzer@neclab.eu> writes:
>> Initial implementation of a memory pool (same-sized and fixed-sized object
>> allocator) following LIFO principle by using a single list to keep track of
>> free objects. LIFO is chosen to potentially better utilize hardware caches.
> 
> See inline. I'll reply with another e-mail for a more in-depth review.
> 
>> Signed-off-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
>> ---
>>   lib/ukallocpool/Makefile.uk            |   2 +
>>   lib/ukallocpool/exportsyms.uk          |   5 +
>>   lib/ukallocpool/include/uk/allocpool.h | 117 +++++++++++++++
>>   lib/ukallocpool/pool.c                 | 188 +++++++++++++++++++++++++
>>   4 files changed, 312 insertions(+)
>>   create mode 100644 lib/ukallocpool/exportsyms.uk
>>   create mode 100644 lib/ukallocpool/include/uk/allocpool.h
>>   create mode 100644 lib/ukallocpool/pool.c
>>
>> diff --git a/lib/ukallocpool/Makefile.uk b/lib/ukallocpool/Makefile.uk
>> index c71c9764..63c24dc1 100644
>> --- a/lib/ukallocpool/Makefile.uk
>> +++ b/lib/ukallocpool/Makefile.uk
>> @@ -2,3 +2,5 @@ $(eval $(call addlib_s,libukallocpool,$(CONFIG_LIBUKALLOCPOOL)))
>>   
>>   CINCLUDES-$(CONFIG_LIBUKALLOCPOOL)	+= -I$(LIBUKALLOCPOOL_BASE)/include
>>   CXXINCLUDES-$(CONFIG_LIBUKALLOCPOOL)	+= -I$(LIBUKALLOCPOOL_BASE)/include
>> +
>> +LIBUKALLOCPOOL_SRCS-y += $(LIBUKALLOCPOOL_BASE)/pool.c
>> diff --git a/lib/ukallocpool/exportsyms.uk b/lib/ukallocpool/exportsyms.uk
>> new file mode 100644
>> index 00000000..9d47d615
>> --- /dev/null
>> +++ b/lib/ukallocpool/exportsyms.uk
>> @@ -0,0 +1,5 @@
>> +uk_allocpool_init
>> +uk_allocpool_availcount
>> +uk_allocpool_objlen
>> +uk_allocpool_take
>> +uk_allocpool_return
>> diff --git a/lib/ukallocpool/include/uk/allocpool.h b/lib/ukallocpool/include/uk/allocpool.h
>> new file mode 100644
>> index 00000000..60a47482
>> --- /dev/null
>> +++ b/lib/ukallocpool/include/uk/allocpool.h
>> @@ -0,0 +1,117 @@
>> +/* SPDX-License-Identifier: BSD-3-Clause */
>> +/*
>> + * Simple memory pool using LIFO principle
>> + *
>> + * Authors: Simon Kuenzer <simon.kuenzer@neclab.eu>
>> + *
>> + *
>> + * Copyright (c) 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
>> + * 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 __LIBUKALLOCPOOL_H__
>> +#define __LIBUKALLOCPOOL_H__
>> +
>> +#include <uk/alloc.h>
>> +
>> +#ifdef __cplusplus
>> +extern "C" {
>> +#endif
>> +
>> +typedef void (*uk_allocpool_obj_init_t)(void *obj, size_t len, void *cookie);
>> +
>> +struct uk_allocpool;
>> +
>> +/**
>> + * Initializes a memory pool on a given memory range.
>> + *
>> + * @param base
>> + *  Base address of memory range
>> + * @param len
>> + *  Length of memory range (bytes)
>> + * @param obj_len
>> + *  Size of one object (bytes)
>> + * @param obj_align
>> + *  Alignment requirement for each pool object
>> + * @param obj_init
>> + *  Function pointer to object initialization
>> + * @param obj_init_cookie
>> + *  Cookie that is hand-over to object initialization
>> + * @return
>> + *  - (NULL): Not enough memory for pool
>> + *  - pointer to initializes pool
>> + */
> 
> There are two extra arguments in the function-level comment: obj_init
> and obj_init_cookie.
> 

Uuups, sorry. I forgot to update the help text - I will send an update. 
obj_init, obj_init_cookie were there in an ealier version.

>> +struct uk_allocpool *uk_allocpool_init(void *base, size_t len,
>> +				       size_t obj_len, size_t obj_align);
>> +
>> +/**
>> + * Return the number of current available (free) objects
>> + *
>> + * @param p
>> + *  Pointer to memory pool.
>> + * @return
>> + *  Number of free objects in the pool.
>> + */
>> +unsigned int uk_allocpool_availcount(struct uk_allocpool *p);
>> +
>> +/**
>> + * Return the size of an object
>> + *
>> + * @param p
>> + *  Pointer to memory pool.
>> + * @return
>> + *  Size of an object
>> + */
>> +size_t uk_allocpool_objlen(struct uk_allocpool *p);
>> +
>> +/**
>> + * Get one object from a pool
>> + *
>> + * @param p
>> + *  Pointer to memory pool.
>> + * @return
>> + *  - (NULL): No more free objects available
>> + *  - Pointer to object.
>> + */
>> +void *uk_allocpool_take(struct uk_allocpool *p);
>> +
>> +/**
>> + * Return one object back to a pool
>> + *
>> + * @param p
>> + *  Pointer to memory pool.
>> + * @param obj
>> + *  Pointer to object that should be returned.
>> + */
>> +void uk_allocpool_return(struct uk_allocpool *p, void *obj);
>> +
>> +#ifdef __cplusplus
>> +}
>> +#endif
>> +
>> +#endif /* __LIBUKALLOCPOOL_H__ */
>> diff --git a/lib/ukallocpool/pool.c b/lib/ukallocpool/pool.c
>> new file mode 100644
>> index 00000000..5d5ddbde
>> --- /dev/null
>> +++ b/lib/ukallocpool/pool.c
>> @@ -0,0 +1,188 @@
>> +/* SPDX-License-Identifier: BSD-3-Clause */
>> +/*
>> + * Simple memory pool using LIFO principle
>> + *
>> + * Authors: Simon Kuenzer <simon.kuenzer@neclab.eu>
>> + *
>> + *
>> + * Copyright (c) 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
>> + * 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/essentials.h>
>> +#include <uk/alloc_impl.h>
>> +#include <uk/allocpool.h>
>> +#include <uk/list.h>
>> +#include <string.h>
>> +#include <stddef.h>
>> +#include <stdint.h>
>> +#include <sys/types.h>
>> +#include <errno.h>
>> +
>> +/*
>> + * POOL: MEMORY LAYOUT
>> + *
>> + *          ++---------------------++
>> + *          || struct uk_allocpool ||
>> + *          ||                     ||
>> + *          ++---------------------++
>> + *          |    // padding //      |
>> + *          +=======================+
>> + *          |       OBJECT 1        |
>> + *          +=======================+
>> + *          |       OBJECT 2        |
>> + *          +=======================+
>> + *          |       OBJECT 3        |
>> + *          +=======================+
>> + *          |         ...           |
>> + *          v                       v
>> + */
>> +
>> +#define MIN_OBJ_ALIGN sizeof(void *)
>> +#define MIN_OBJ_LEN   sizeof(struct uk_list_head)
>> +
>> +struct uk_allocpool {
>> +	struct uk_list_head free_obj;
>> +	unsigned int free_obj_count;
>> +
>> +	size_t obj_align;
>> +	size_t obj_len;
>> +	unsigned int obj_count;
>> +};
>> +
>> +struct free_obj {
>> +	struct uk_list_head list;
>> +};
>> +
>> +static inline void _prepend_free_obj(struct uk_allocpool *p, void *obj)
>> +{
>> +	struct uk_list_head *entry;
>> +
>> +	UK_ASSERT(p);
>> +	UK_ASSERT(obj);
>> +	UK_ASSERT(p->free_obj_count < p->obj_count);
>> +
>> +	entry = &((struct free_obj *) obj)->list;
>> +	uk_list_add(entry, &p->free_obj);
>> +	p->free_obj_count++;
>> +}
>> +
>> +static inline void *_take_free_obj(struct uk_allocpool *p)
>> +{
>> +	struct free_obj *obj;
>> +
>> +	UK_ASSERT(p);
>> +	UK_ASSERT(p->free_obj_count > 0);
>> +
>> +	/* get object from list head */
>> +	obj = uk_list_first_entry(&p->free_obj, struct free_obj, list);
>> +	uk_list_del(&obj->list);
>> +	p->free_obj_count--;
>> +	return (void *) obj;
>> +}
>> +
>> +void *uk_allocpool_take(struct uk_allocpool *p)
>> +{
>> +	UK_ASSERT(p);
>> +
>> +	if (unlikely(uk_list_empty(&p->free_obj)))
>> +		return NULL;
>> +
>> +	return _take_free_obj(p);
>> +}
>> +
>> +void uk_allocpool_return(struct uk_allocpool *p, void *obj)
>> +{
>> +	UK_ASSERT(p);
>> +
>> +	_prepend_free_obj(p, obj);
>> +}
>> +
>> +unsigned int uk_allocpool_availcount(struct uk_allocpool *p)
>> +{
>> +	return p->free_obj_count;
>> +}
>> +
>> +size_t uk_allocpool_objlen(struct uk_allocpool *p)
>> +{
>> +	return p->obj_len;
>> +}
>> +
>> +struct uk_allocpool *uk_allocpool_init(void *base, size_t len,
>> +				       size_t obj_len, size_t obj_align)
>> +{
>> +	struct uk_allocpool *p;
>> +	struct uk_alloc *a;
>> +	size_t obj_alen;
>> +	size_t left;
>> +	void *obj_ptr;
>> +
>> +	UK_ASSERT(POWER_OF_2(obj_align));
>> +
>> +	if (!base || sizeof(struct uk_allocpool) > len) {
>> +		errno = ENOSPC;
>> +		return NULL;
>> +	}
>> +
>> +	/* apply minimum requirements */
>> +	obj_len   = MAX(obj_len, MIN_OBJ_LEN);
>> +	obj_align = MAX(obj_align, MIN_OBJ_ALIGN);
>> +
>> +	p = (struct uk_allocpool *) base;
>> +	memset(p, 0, sizeof(*p));
>> +	a = uk_allocpool2alloc(p);
>> +
>> +	obj_alen = ALIGN_UP(obj_len, obj_align);
>> +	obj_ptr = (void *) ALIGN_UP((uintptr_t) base + sizeof(*p),
>> +				    obj_align);
>> +	if ((uintptr_t) obj_ptr > (uintptr_t) base + len) {
>> +		uk_pr_debug("%p: Empty pool: Not enough space for allocating objects\n",
>> +			    p);
>> +		goto out;
>> +	}
>> +
>> +	left = len - ((uintptr_t) obj_ptr - (uintptr_t) base);
>> +
>> +	p->obj_count = 0;
>> +	p->free_obj_count = 0;
>> +	UK_INIT_LIST_HEAD(&p->free_obj);
>> +	while (left >= obj_alen) {
>> +		++p->obj_count;
>> +		_prepend_free_obj(p, obj_ptr);
>> +		obj_ptr = (void *) ((uintptr_t) obj_ptr + obj_alen);
>> +		left -= obj_alen;
>> +	}
>> +
>> +out:
>> +	p->obj_len         = obj_alen;
>> +	p->obj_align       = obj_align;
>> +
>> +	uk_pr_debug("%p: Pool created (%"__PRIsz" B): %u objs of %"__PRIsz" B, aligned to %"__PRIsz" B\n",
>> +		    p, len, p->obj_count, p->obj_len, p->obj_align);
>> +	return p;
>> +}


From minios-devel-bounces@lists.xenproject.org Fri Dec 18 17:54:56 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Fri, 18 Dec 2020 17:54:56 +0000
Received: from list by lists.xenproject.org with outflank-mailman.56591.99134 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1kqJxp-0000aV-IG; Fri, 18 Dec 2020 17:54:49 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 56591.99134; Fri, 18 Dec 2020 17:54:49 +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 1kqJxp-0000aO-FE; Fri, 18 Dec 2020 17:54:49 +0000
Received: by outflank-mailman (input) for mailman id 56591;
 Fri, 18 Dec 2020 17:54: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=6OJK=FW=neclab.eu=simon.kuenzer@srs-us1.protection.inumbo.net>)
 id 1kqJxn-0000aJ-Ep
 for minios-devel@lists.xen.org; Fri, 18 Dec 2020 17:54:47 +0000
Received: from mailer1.neclab.eu (unknown [195.37.70.40])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 5114444a-91aa-40d8-a74b-83e677a074ac;
 Fri, 18 Dec 2020 17:54:45 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
 by mailer1.neclab.eu (Postfix) with ESMTP id B4CE2103EDD;
 Fri, 18 Dec 2020 18:54:44 +0100 (CET)
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 3iv7bJHC4UOz; Fri, 18 Dec 2020 18:54:44 +0100 (CET)
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 8B8A910103E
 for <minios-devel@lists.xen.org>; Fri, 18 Dec 2020 18:54:44 +0100 (CET)
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.2044.4; Fri, 18 Dec
 2020 18:54:44 +0100
X-BeenThere: minios-devel@lists.xenproject.org
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
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: 5114444a-91aa-40d8-a74b-83e677a074ac
X-Virus-Scanned: Amavisd on Debian GNU/Linux (atlas-a.office.hd)
X-ENC: Last-Hop-TLS-encrypted
X-ENC: Last-Hop-TLS-encrypted
From: Simon Kuenzer <simon.kuenzer@neclab.eu>
To: <minios-devel@lists.xen.org>
CC: Simon Kuenzer <simon.kuenzer@neclab.eu>
Subject: [UNIKRAFT PATCH] build: Fix typo when initializing `UK_PREPARE-y`
Date: Fri, 18 Dec 2020 18:54:38 +0100
Message-ID: <20201218175438.25658-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: puck.office.hd (192.168.24.91) To puck.office.hd
 (192.168.24.91)

Fixes a typo when initializing `UK_PREPARE-y` in `/Makefile`

Signed-off-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
---
 Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Makefile b/Makefile
index 1f309b7d..76145d27 100644
--- a/Makefile
+++ b/Makefile
@@ -277,7 +277,7 @@ export SHELL CONFIG_SHELL Q KBUILD_VERBOSE
 UK_FETCH:=
 UK_FETCH-y:=
 UK_PREPARE:=
-UK_PREPATE-y:=
+UK_PREPARE-y:=
 UK_PLATS:=
 UK_PLATS-y:=
 UK_LIBS:=
-- 
2.20.1


From minios-devel-bounces@lists.xenproject.org Fri Dec 18 18:09:31 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Fri, 18 Dec 2020 18:09:31 +0000
Received: from list by lists.xenproject.org with outflank-mailman.56596.99148 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1kqKC2-0001l7-Oj; Fri, 18 Dec 2020 18:09:30 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 56596.99148; Fri, 18 Dec 2020 18:09: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 1kqKC2-0001l0-Ly; Fri, 18 Dec 2020 18:09:30 +0000
Received: by outflank-mailman (input) for mailman id 56596;
 Fri, 18 Dec 2020 18:09: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=6OJK=FW=neclab.eu=simon.kuenzer@srs-us1.protection.inumbo.net>)
 id 1kqKC1-0001kv-Jh
 for minios-devel@lists.xen.org; Fri, 18 Dec 2020 18:09:29 +0000
Received: from mailer1.neclab.eu (unknown [195.37.70.40])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id eb4a84b4-3b7b-4b3f-877e-fc97e5227eb0;
 Fri, 18 Dec 2020 18:09:28 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
 by mailer1.neclab.eu (Postfix) with ESMTP id 35D4110400E;
 Fri, 18 Dec 2020 19:09:27 +0100 (CET)
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 29bef3v-eWLq; Fri, 18 Dec 2020 19:09:27 +0100 (CET)
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 08EFF10103E
 for <minios-devel@lists.xen.org>; Fri, 18 Dec 2020 19:09:27 +0100 (CET)
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.2044.4; Fri, 18 Dec
 2020 19:09:26 +0100
X-BeenThere: minios-devel@lists.xenproject.org
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
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: eb4a84b4-3b7b-4b3f-877e-fc97e5227eb0
X-Virus-Scanned: Amavisd on Debian GNU/Linux (atlas-a.office.hd)
X-ENC: Last-Hop-TLS-encrypted
X-ENC: Last-Hop-TLS-encrypted
From: Simon Kuenzer <simon.kuenzer@neclab.eu>
To: <minios-devel@lists.xen.org>
CC: Simon Kuenzer <simon.kuenzer@neclab.eu>
Subject: [UNIKRAFT PATCH 0/7] Pre-processing rules for generating headers
Date: Fri, 18 Dec 2020 19:09:17 +0100
Message-ID: <20201218180924.27217-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)

The final target of this patch series is to enable generating header
files with pre-processors, like M4 and AWK.
For this purpose, another build stage is introduced: `preprocess`.
This stage should make sure that headers are generated before
compiling starts.

Simon Kuenzer (7):
  build: Enable extending pre-processing rules
  build: Use secondary expansion for M4 pre-processing
  build: Per-file flags and includes for M4 pre-processing
  build: Pre-processing rule for AWK progfiles
  build: Introduce pre-processing build stage (`preprocess`)
  build: `*.in` files as pure pre-processed files
  build: Support generating C/C++ headers with pre-processing

 Makefile                     |  9 +++-
 support/build/Makefile.rules | 79 +++++++++++++++++++++++++++++-------
 2 files changed, 72 insertions(+), 16 deletions(-)

-- 
2.20.1


From minios-devel-bounces@lists.xenproject.org Fri Dec 18 18:09:35 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Fri, 18 Dec 2020 18:09:35 +0000
Received: from list by lists.xenproject.org with outflank-mailman.56597.99152 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1kqKC7-0001lu-QW; Fri, 18 Dec 2020 18:09:35 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 56597.99152; Fri, 18 Dec 2020 18:09:35 +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 1kqKC7-0001lq-NW; Fri, 18 Dec 2020 18:09:35 +0000
Received: by outflank-mailman (input) for mailman id 56597;
 Fri, 18 Dec 2020 18:09: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=6OJK=FW=neclab.eu=simon.kuenzer@srs-us1.protection.inumbo.net>)
 id 1kqKC6-0001kv-EK
 for minios-devel@lists.xen.org; Fri, 18 Dec 2020 18:09:34 +0000
Received: from mailer2.neclab.eu (unknown [195.37.70.41])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 6922f8d6-2c5b-4042-b8e4-2302fd713140;
 Fri, 18 Dec 2020 18:09:31 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
 by mailer2.neclab.eu (Postfix) with ESMTP id 5E165F22EC;
 Fri, 18 Dec 2020 19:09:30 +0100 (CET)
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 VNhhGj16zlIK; Fri, 18 Dec 2020 19:09:30 +0100 (CET)
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 28AEEF2277
 for <minios-devel@lists.xen.org>; Fri, 18 Dec 2020 19:09:28 +0100 (CET)
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.2044.4; Fri, 18 Dec
 2020 19:09:27 +0100
X-BeenThere: minios-devel@lists.xenproject.org
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
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: 6922f8d6-2c5b-4042-b8e4-2302fd713140
X-Virus-Scanned: Amavisd on Debian GNU/Linux (atlas-b.office.hd)
X-ENC: Last-Hop-TLS-encrypted
X-ENC: Last-Hop-TLS-encrypted
From: Simon Kuenzer <simon.kuenzer@neclab.eu>
To: <minios-devel@lists.xen.org>
CC: Simon Kuenzer <simon.kuenzer@neclab.eu>
Subject: [UNIKRAFT PATCH 1/7] build: Enable extending pre-processing rules
Date: Fri, 18 Dec 2020 19:09:18 +0100
Message-ID: <20201218180924.27217-2-simon.kuenzer@neclab.eu>
X-Mailer: git-send-email 2.20.1
In-Reply-To: <20201218180924.27217-1-simon.kuenzer@neclab.eu>
References: <20201218180924.27217-1-simon.kuenzer@neclab.eu>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Content-Type: text/plain
X-Originating-IP: [192.168.24.96]
X-ClientProxiedBy: oberon.office.hd (192.168.24.90) To puck.office.hd
 (192.168.24.91)

Similar to build rules, we enable extending the supported pre-process
rules. This can be achieved by specifying a pre-process rule definition
within a libraries' `Makefule.rules` with the following name scheme:

preprule_<source file extension>

Examples:
 preprule_m4 for *.m4 source files
 preprule_awk for *.awk source files

Signed-off-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
---
 support/build/Makefile.rules | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/support/build/Makefile.rules b/support/build/Makefile.rules
index 9a5963fd..82d8fd7c 100644
--- a/support/build/Makefile.rules
+++ b/support/build/Makefile.rules
@@ -634,12 +634,14 @@ endef
 
 # wrapper for preprule_*,
 # selects appropriate pre-process rule depending on file extension
+# if there is no such pre-process rule available, we throw an error.
 #
 # preprule $libname,$source,$preptarget,$extraflags(optional)
 define preprule =
-$(if $(filter %.m4   ,$(2)),$(call preprule_m4 ,$(1),$(2),$(3),$(4)),\
-$(error $(3): missing pre-processing rule for source type $(suffix $(2))) \
-)
+$(if $(filter preprule_$(call fileext,$(strip $(2))),$(.VARIABLES)),,\
+$(error preprule_$(call fileext,$(strip $(2))) is not defined: Failed to install rule for $(2)))
+
+$(call preprule_$(call fileext,$(strip $(2))),$(strip $(1)),$(strip $(2)),$(strip $(3)),$(strip $(4)),$(strip $(5)))
 endef
 
 
-- 
2.20.1


From minios-devel-bounces@lists.xenproject.org Fri Dec 18 18:09:36 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Fri, 18 Dec 2020 18:09:36 +0000
Received: from list by lists.xenproject.org with outflank-mailman.56598.99157 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1kqKC8-0001ma-Rt; Fri, 18 Dec 2020 18:09:36 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 56598.99157; Fri, 18 Dec 2020 18:09: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 1kqKC8-0001mT-Ot; Fri, 18 Dec 2020 18:09:36 +0000
Received: by outflank-mailman (input) for mailman id 56598;
 Fri, 18 Dec 2020 18:09:35 +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=6OJK=FW=neclab.eu=simon.kuenzer@srs-us1.protection.inumbo.net>)
 id 1kqKC7-0001lj-Cj
 for minios-devel@lists.xen.org; Fri, 18 Dec 2020 18:09:35 +0000
Received: from mailer2.neclab.eu (unknown [195.37.70.41])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 8967fc21-6de2-49e5-9ced-2d9bd9e86522;
 Fri, 18 Dec 2020 18:09:33 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
 by mailer2.neclab.eu (Postfix) with ESMTP id 666C5F22F7;
 Fri, 18 Dec 2020 19:09:32 +0100 (CET)
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 PNbuwX9hzZZl; Fri, 18 Dec 2020 19:09:32 +0100 (CET)
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 32C5AF2277
 for <minios-devel@lists.xen.org>; Fri, 18 Dec 2020 19:09:30 +0100 (CET)
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.2044.4; Fri, 18 Dec
 2020 19:09:28 +0100
X-BeenThere: minios-devel@lists.xenproject.org
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
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: 8967fc21-6de2-49e5-9ced-2d9bd9e86522
X-Virus-Scanned: Amavisd on Debian GNU/Linux (atlas-b.office.hd)
X-ENC: Last-Hop-TLS-encrypted
X-ENC: Last-Hop-TLS-encrypted
From: Simon Kuenzer <simon.kuenzer@neclab.eu>
To: <minios-devel@lists.xen.org>
CC: Simon Kuenzer <simon.kuenzer@neclab.eu>
Subject: [UNIKRAFT PATCH 2/7] build: Use secondary expansion for M4 pre-processing
Date: Fri, 18 Dec 2020 19:09:19 +0100
Message-ID: <20201218180924.27217-3-simon.kuenzer@neclab.eu>
X-Mailer: git-send-email 2.20.1
In-Reply-To: <20201218180924.27217-1-simon.kuenzer@neclab.eu>
References: <20201218180924.27217-1-simon.kuenzer@neclab.eu>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
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)

Similar to our build rules, we enable secondary expansion of
flags and includes to M4 pre-processing rules.

Signed-off-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
---
 support/build/Makefile.rules | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/support/build/Makefile.rules b/support/build/Makefile.rules
index 82d8fd7c..44701cd2 100644
--- a/support/build/Makefile.rules
+++ b/support/build/Makefile.rules
@@ -620,10 +620,10 @@ endef
 define preprule_m4 =
 $(3): $(2) | prepare
 	$(call build_cmd,M4,$(1),$(3),\
-		$(M4)  $(M4INCLUDES) $(M4INCLUDES-y) \
-		       $($(call vprefix_lib,$(1),M4INCLUDES)) $($(call vprefix_lib,$(1),M4INCLUDES-y)) \
-		       $(M4FLAGS) $(M4FLAGS-y) \
-		       $($(call vprefix_lib,$(1),M4FLAGS)) $($(call vprefix_lib,$(1),M4FLAGS-y)) \
+		$(M4)  $$(M4INCLUDES) $$(M4INCLUDES-y) \
+		       $$($(call vprefix_lib,$(1),M4INCLUDES)) $$($(call vprefix_lib,$(1),M4INCLUDES-y)) \
+		       $$(M4FLAGS) $$(M4FLAGS-y) \
+		       $$($(call vprefix_lib,$(1),M4FLAGS)) $$($(call vprefix_lib,$(1),M4FLAGS-y)) \
 		       $(4) \
 		       $(2) > $(3)
 	)
-- 
2.20.1


From minios-devel-bounces@lists.xenproject.org Fri Dec 18 18:09:40 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Fri, 18 Dec 2020 18:09:40 +0000
Received: from list by lists.xenproject.org with outflank-mailman.56599.99160 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1kqKCC-0001no-UA; Fri, 18 Dec 2020 18:09:40 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 56599.99160; Fri, 18 Dec 2020 18:09: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 1kqKCC-0001nh-RK; Fri, 18 Dec 2020 18:09:40 +0000
Received: by outflank-mailman (input) for mailman id 56599;
 Fri, 18 Dec 2020 18:09: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=6OJK=FW=neclab.eu=simon.kuenzer@srs-us1.protection.inumbo.net>)
 id 1kqKCB-0001kv-EO
 for minios-devel@lists.xen.org; Fri, 18 Dec 2020 18:09:39 +0000
Received: from mailer2.neclab.eu (unknown [195.37.70.41])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 33c2abf8-5763-426f-8ab4-80ed88b42e54;
 Fri, 18 Dec 2020 18:09:35 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
 by mailer2.neclab.eu (Postfix) with ESMTP id 7B3DCF22EC;
 Fri, 18 Dec 2020 19:09:34 +0100 (CET)
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 0XunBqKql7qT; Fri, 18 Dec 2020 19:09:34 +0100 (CET)
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 45816F2277
 for <minios-devel@lists.xen.org>; Fri, 18 Dec 2020 19:09:32 +0100 (CET)
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.2044.4; Fri, 18 Dec
 2020 19:09:29 +0100
X-BeenThere: minios-devel@lists.xenproject.org
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
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: 33c2abf8-5763-426f-8ab4-80ed88b42e54
X-Virus-Scanned: Amavisd on Debian GNU/Linux (atlas-b.office.hd)
X-ENC: Last-Hop-TLS-encrypted
X-ENC: Last-Hop-TLS-encrypted
From: Simon Kuenzer <simon.kuenzer@neclab.eu>
To: <minios-devel@lists.xen.org>
CC: Simon Kuenzer <simon.kuenzer@neclab.eu>
Subject: [UNIKRAFT PATCH 3/7] build: Per-file flags and includes for M4 pre-processing
Date: Fri, 18 Dec 2020 19:09:20 +0100
Message-ID: <20201218180924.27217-4-simon.kuenzer@neclab.eu>
X-Mailer: git-send-email 2.20.1
In-Reply-To: <20201218180924.27217-1-simon.kuenzer@neclab.eu>
References: <20201218180924.27217-1-simon.kuenzer@neclab.eu>
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)

Similar to build rules, we add support for specifying file-local
flags and includes to M4 pre-processing rules. This can be done
through the following variables:
 <LIBNAME>_<SOURCE NAME>_M4FLAGS
 <LIBNAME>_<SOURCE NAME>_M4INCLUDES

Example: Setting `-myflag` to the M4 pre-processing of `code.m4`:
 LIBMYLIB_SRCS += $(LIBMYLIB_BASE)/code.m4>.c
 LIBMYLIB_CODE_M4FLAGS += -myflag

Signed-off-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
---
 support/build/Makefile.rules | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/support/build/Makefile.rules b/support/build/Makefile.rules
index 44701cd2..6a8c2099 100644
--- a/support/build/Makefile.rules
+++ b/support/build/Makefile.rules
@@ -622,8 +622,10 @@ $(3): $(2) | prepare
 	$(call build_cmd,M4,$(1),$(3),\
 		$(M4)  $$(M4INCLUDES) $$(M4INCLUDES-y) \
 		       $$($(call vprefix_lib,$(1),M4INCLUDES)) $$($(call vprefix_lib,$(1),M4INCLUDES-y)) \
+		       $$($(call vprefix_src,$(1),$(2),,M4INCLUDES)) $$($(call vprefix_src,$(1),$(2),,M4INCLUDES-y)) \
 		       $$(M4FLAGS) $$(M4FLAGS-y) \
 		       $$($(call vprefix_lib,$(1),M4FLAGS)) $$($(call vprefix_lib,$(1),M4FLAGS-y)) \
+		       $$($(call vprefix_src,$(1),$(2),,M4FLAGS)) $$($(call vprefix_src,$(1),$(2),,M4FLAGS-y)) \
 		       $(4) \
 		       $(2) > $(3)
 	)
-- 
2.20.1


From minios-devel-bounces@lists.xenproject.org Fri Dec 18 18:09:41 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Fri, 18 Dec 2020 18:09:41 +0000
Received: from list by lists.xenproject.org with outflank-mailman.56600.99164 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1kqKCD-0001oT-Va; Fri, 18 Dec 2020 18:09:41 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 56600.99164; Fri, 18 Dec 2020 18:09: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 1kqKCD-0001oM-Sr; Fri, 18 Dec 2020 18:09:41 +0000
Received: by outflank-mailman (input) for mailman id 56600;
 Fri, 18 Dec 2020 18:09: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=6OJK=FW=neclab.eu=simon.kuenzer@srs-us1.protection.inumbo.net>)
 id 1kqKCC-0001lj-FL
 for minios-devel@lists.xen.org; Fri, 18 Dec 2020 18:09:40 +0000
Received: from mailer2.neclab.eu (unknown [195.37.70.41])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 72df63b6-69aa-419b-9e36-2f9b0c6d971d;
 Fri, 18 Dec 2020 18:09:39 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
 by mailer2.neclab.eu (Postfix) with ESMTP id A8EC4F22F7;
 Fri, 18 Dec 2020 19:09:38 +0100 (CET)
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 oWQWrqi7S9LC; Fri, 18 Dec 2020 19:09:38 +0100 (CET)
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 669C8F2277
 for <minios-devel@lists.xen.org>; Fri, 18 Dec 2020 19:09:36 +0100 (CET)
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.2044.4; Fri, 18 Dec
 2020 19:09:31 +0100
X-BeenThere: minios-devel@lists.xenproject.org
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
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: 72df63b6-69aa-419b-9e36-2f9b0c6d971d
X-Virus-Scanned: Amavisd on Debian GNU/Linux (atlas-b.office.hd)
X-ENC: Last-Hop-TLS-encrypted
X-ENC: Last-Hop-TLS-encrypted
From: Simon Kuenzer <simon.kuenzer@neclab.eu>
To: <minios-devel@lists.xen.org>
CC: Simon Kuenzer <simon.kuenzer@neclab.eu>
Subject: [UNIKRAFT PATCH 5/7] build: Introduce pre-processing build stage (`preprocess`)
Date: Fri, 18 Dec 2020 19:09:22 +0100
Message-ID: <20201218180924.27217-6-simon.kuenzer@neclab.eu>
X-Mailer: git-send-email 2.20.1
In-Reply-To: <20201218180924.27217-1-simon.kuenzer@neclab.eu>
References: <20201218180924.27217-1-simon.kuenzer@neclab.eu>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
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)

Introduces the pre-process build stage which is executed after
`prepare` and before compiling object files. This is done in
order to let header files be generated later.

Signed-off-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
---
 Makefile                     |  9 ++++++++-
 support/build/Makefile.rules | 18 ++++++++++--------
 2 files changed, 18 insertions(+), 9 deletions(-)

diff --git a/Makefile b/Makefile
index 76145d27..63e42067 100644
--- a/Makefile
+++ b/Makefile
@@ -278,6 +278,8 @@ UK_FETCH:=
 UK_FETCH-y:=
 UK_PREPARE:=
 UK_PREPARE-y:=
+UK_PREPROCESS:=
+UK_PREPROCESS-y:=
 UK_PLATS:=
 UK_PLATS-y:=
 UK_LIBS:=
@@ -652,7 +654,7 @@ endif
 # include Makefile for platform linking (`Linker.uk`)
 $(foreach plat,$(UK_PLATS),$(eval $(call _import_linker,$(plat))))
 
-.PHONY: prepare image libs objs clean
+.PHONY: prepare preprocess image libs objs clean
 
 fetch: $(UK_FETCH) $(UK_FETCH-y)
 
@@ -665,6 +667,8 @@ $(UK_CONFIG_OUT): $(UK_CONFIG)
 prepare: $(KCONFIG_AUTOHEADER) $(UK_CONFIG_OUT) $(UK_PREPARE) $(UK_PREPARE-y)
 prepare: $(UK_FIXDEP) | fetch
 
+preprocess: $(UK_PREPROCESS) $(UK_PREPROCESS-y) | prepare
+
 objs: $(UK_OBJS) $(UK_OBJS-y)
 
 libs: $(UK_ALIBS) $(UK_ALIBS-y) $(UK_OLIBS) $(UK_OLIBS-y)
@@ -719,6 +723,8 @@ fetch: ukconfig
 
 prepare: ukconfig
 
+preprocess: ukconfig
+
 objs: ukconfig
 
 libs: ukconfig
@@ -991,6 +997,7 @@ help:
 	@echo '  libs                   - build libraries and objects'
 	@echo '  [LIBNAME]              - build a single library'
 	@echo '  objs                   - build objects only'
+	@echo '  preprocess             - run preprocessing steps'
 	@echo '  prepare                - run preparation steps'
 	@echo '  fetch                  - fetch, extract, and patch remote code'
 	@echo ''
diff --git a/support/build/Makefile.rules b/support/build/Makefile.rules
index e1c078c3..1797d134 100644
--- a/support/build/Makefile.rules
+++ b/support/build/Makefile.rules
@@ -390,7 +390,7 @@ endef
 # buildrule_* $libname,$source,$variant,$target,$extraflags
 
 define buildrule_S_ =
-$(4): $(2) | prepare
+$(4): $(2) | preprocess
 	$(call build_cmd_fixdep,AS,$(1),$(4),\
 		$(AS)  $$(COMPFLAGS) $$(COMPFLAGS-y) \
 		       $$($(call vprefix_lib,$(1),COMPFLAGS)) $$($(call vprefix_lib,$(1),COMPFLAGS-y)) \
@@ -417,7 +417,7 @@ endef
 buildrule_sx = $(call buildrule_S_,$(1),$(2),$(3),$(4))
 
 define buildrule_s =
-$(4): $(2) | prepare
+$(4): $(2) | preprocess
 	$(call build_cmd,AS,$(1),$(4),\
 		$(AS)  $$(COMPFLAGS) $$(COMPFLAGS-y) \
 		       $$($(call vprefix_lib,$(1),COMPFLAGS)) $$($(call vprefix_lib,$(1),COMPFLAGS-y)) \
@@ -442,7 +442,7 @@ $(eval $(call vprefix_lib,$(1),CLEAN-y) += $(call build_clean,$(4)) $(call out2d
 endef
 
 define buildrule_c =
-$(4): $(2) | prepare
+$(4): $(2) | preprocess
 	$(call build_cmd_fixdep,CC,$(1),$(4),\
 		$(CC)  $$(COMPFLAGS) $$(COMPFLAGS-y) \
 		       $$($(call vprefix_lib,$(1),COMPFLAGS)) $$($(call vprefix_lib,$(1),COMPFLAGS-y)) \
@@ -467,7 +467,7 @@ $(eval $(call vprefix_lib,$(1),CLEAN-y) += $(call build_clean,$(4)) $(call out2d
 endef
 
 define buildrule_cxx =
-$(4): $(2) | prepare
+$(4): $(2) | preprocess
 	$(call build_cmd_fixdep,CXX,$(1),$(4),\
 		$(CXX) $$(COMPFLAGS) $$(COMPFLAGS-y) \
 		       $$(CXXINCLUDES) $$(CXXINCLUDES-y) \
@@ -499,7 +499,7 @@ buildrule_C   = $(call buildrule_cxx,$(1),$(2),$(3),$(4))
 buildrule_c$(plus)$(plus) = $(call buildrule_cxx,$(1),$(2),$(3),$(4))
 
 define buildrule_go =
-$(4): $(2) | prepare
+$(4): $(2) | preprocess
 	$(call build_cmd,GOC,$(1),$(4),\
 		$(GOC) $$(COMPFLAGS) $$(COMPFLAGS-y) \
 		       $$(GOCINCLUDES) $$(GOCINCLUDES-y) \
@@ -531,7 +531,7 @@ $(eval EXTRA_LD_SCRIPT-y += $(1))
 endef
 
 define buildrule_S_lds =
-$(4): $(2) | prepare
+$(4): $(2) | preprocess
 	$(call build_cmd_fixdep,LDS,$(1),$(4),\
 		$(AS)  -E -P -x assembler-with-cpp $$(COMPFLAGS) $$(COMPFLAGS-y) \
 		       $$(ASINCLUDES) $$(ASINCLUDES-y) \
@@ -569,7 +569,7 @@ endef
 
 ## Add the linker file to the common variable used for linker script
 define buildrule_ld  =
-$(2): | prepare
+$(2): | preprocess
 
 $(eval $(call vprefix_lib,$(1),LDS-y) += $(2))
 
@@ -583,7 +583,7 @@ $(if $(strip $($(call uc,$(1))_PLATS)),\
 endef
 
 define buildrule_dts =
-$(4) : $(2) | prepare
+$(4) : $(2) | preprocess
 	$(call build_cmd,DTC,$(1),$(4),\
 	       $(DTC) -I dts -O dtb -o $$(@) $$(<)\
 	)
@@ -631,6 +631,7 @@ $(3): $(2) | prepare
 	)
 
 UK_SRCS-y += $(2)
+UK_PREPROCESS-y += $(3)
 $(eval $(call vprefix_lib,$(1),CLEAN-y) += $(call build_clean,$(3)))
 endef
 
@@ -655,6 +656,7 @@ $(3): $(2) \
 	)
 
 UK_SRCS-y += $(2)
+UK_PREPROCESS-y += $(3)
 $(eval $(call vprefix_lib,$(1),CLEAN-y) += $(call build_clean,$(3)))
 endef
 
-- 
2.20.1


From minios-devel-bounces@lists.xenproject.org Fri Dec 18 18:09:46 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Fri, 18 Dec 2020 18:09:46 +0000
Received: from list by lists.xenproject.org with outflank-mailman.56601.99169 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1kqKCI-0001pm-1t; Fri, 18 Dec 2020 18:09:46 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 56601.99169; Fri, 18 Dec 2020 18:09: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 1kqKCH-0001pe-UO; Fri, 18 Dec 2020 18:09:45 +0000
Received: by outflank-mailman (input) for mailman id 56601;
 Fri, 18 Dec 2020 18:09: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=6OJK=FW=neclab.eu=simon.kuenzer@srs-us1.protection.inumbo.net>)
 id 1kqKCG-0001kv-Eg
 for minios-devel@lists.xen.org; Fri, 18 Dec 2020 18:09:44 +0000
Received: from mailer2.neclab.eu (unknown [195.37.70.41])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id a9c64cf9-3166-46ba-b380-13a8e50591ad;
 Fri, 18 Dec 2020 18:09:37 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
 by mailer2.neclab.eu (Postfix) with ESMTP id 9BB21F22EC;
 Fri, 18 Dec 2020 19:09:36 +0100 (CET)
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 oF9ucWEe8-TD; Fri, 18 Dec 2020 19:09:36 +0100 (CET)
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 54E04F2277
 for <minios-devel@lists.xen.org>; Fri, 18 Dec 2020 19:09:34 +0100 (CET)
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.2044.4; Fri, 18 Dec
 2020 19:09:30 +0100
X-BeenThere: minios-devel@lists.xenproject.org
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
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: a9c64cf9-3166-46ba-b380-13a8e50591ad
X-Virus-Scanned: Amavisd on Debian GNU/Linux (atlas-b.office.hd)
X-ENC: Last-Hop-TLS-encrypted
X-ENC: Last-Hop-TLS-encrypted
From: Simon Kuenzer <simon.kuenzer@neclab.eu>
To: <minios-devel@lists.xen.org>
CC: Simon Kuenzer <simon.kuenzer@neclab.eu>
Subject: [UNIKRAFT PATCH 4/7] build: Pre-processing rule for AWK progfiles
Date: Fri, 18 Dec 2020 19:09:21 +0100
Message-ID: <20201218180924.27217-5-simon.kuenzer@neclab.eu>
X-Mailer: git-send-email 2.20.1
In-Reply-To: <20201218180924.27217-1-simon.kuenzer@neclab.eu>
References: <20201218180924.27217-1-simon.kuenzer@neclab.eu>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Content-Type: text/plain
X-Originating-IP: [192.168.24.96]
X-ClientProxiedBy: oberon.office.hd (192.168.24.90) To puck.office.hd
 (192.168.24.91)

Introduces an AWK pre-processing rule as another way for generating source
files based on AWK progfiles. One intention of this is to simplify
`Makefile.uk` of `lib/syscall_shim`.
The source file is treated as the AWK progfile which will be executed over
given includes (`AWKINCLUDES[-y]`). Because global flags and includes
would not be meaningful for AWK rules, we support only library-local and
file-local scopes.

Example of compiling `uk_syscall6.o` from `uk_syscall6.awk`
in `lib/syscall_shim`:
 LIBSYSCALL_SHIM_SRCS += $(LIBSYSCALL_SHIM_BASE)/gen_uk_syscall6.awk>.c
 LIBSYSCALL_SHIM_GEN_UK_SYSCALL6_AWKFLAGS    += -F '-'
 LIBSYSCALL_SHIM_GEN_UK_SYSCALL6_AWKINCLUDES += $(LIBSYSCALL_SHIM_BUILD)/provided_syscalls.h.in

Signed-off-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
---
 support/build/Makefile.rules | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/support/build/Makefile.rules b/support/build/Makefile.rules
index 6a8c2099..e1c078c3 100644
--- a/support/build/Makefile.rules
+++ b/support/build/Makefile.rules
@@ -634,6 +634,30 @@ UK_SRCS-y += $(2)
 $(eval $(call vprefix_lib,$(1),CLEAN-y) += $(call build_clean,$(3)))
 endef
 
+# Pre-processing rule for awk progs
+# NOTES:
+#  $source is the awk progfile and AWKINCLUDES specify the input files to
+#  process. There are no global scopes for AWKINCLUDES and AWKFLAGS available
+#  because it would not be meaningful.
+define preprule_awk =
+$(3): $(2) \
+      $$($(call vprefix_lib,$(1),AWKINCLUDES)) $$($(call vprefix_lib,$(1),AWKINCLUDES-y)) \
+      $$($(call vprefix_src,$(1),$(2),,AWKINCLUDES)) $$($(call vprefix_src,$(1),$(2),,AWKINCLUDES-y)) \
+      | prepare
+	$(call build_cmd,AWK,$(1),$(3),\
+		$(AWK) -f $(2) \
+		       $$($(call vprefix_lib,$(1),AWKFLAGS)) $$($(call vprefix_lib,$(1),AWKFLAGS-y)) \
+		       $$($(call vprefix_src,$(1),$(2),,AWKFLAGS)) $$($(call vprefix_src,$(1),$(2),,AWKFLAGS-y)) \
+		       $(4) \
+		       $$($(call vprefix_lib,$(1),AWKINCLUDES)) $$($(call vprefix_lib,$(1),AWKINCLUDES-y)) \
+		       $$($(call vprefix_src,$(1),$(2),,AWKINCLUDES)) $$($(call vprefix_src,$(1),$(2),,AWKINCLUDES-y)) \
+		       > $(3)
+	)
+
+UK_SRCS-y += $(2)
+$(eval $(call vprefix_lib,$(1),CLEAN-y) += $(call build_clean,$(3)))
+endef
+
 # wrapper for preprule_*,
 # selects appropriate pre-process rule depending on file extension
 # if there is no such pre-process rule available, we throw an error.
-- 
2.20.1


From minios-devel-bounces@lists.xenproject.org Fri Dec 18 18:09:51 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Fri, 18 Dec 2020 18:09:51 +0000
Received: from list by lists.xenproject.org with outflank-mailman.56602.99172 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1kqKCN-0001rD-2x; Fri, 18 Dec 2020 18:09:51 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 56602.99172; Fri, 18 Dec 2020 18:09: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 1kqKCM-0001r9-W4; Fri, 18 Dec 2020 18:09:50 +0000
Received: by outflank-mailman (input) for mailman id 56602;
 Fri, 18 Dec 2020 18:09: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=6OJK=FW=neclab.eu=simon.kuenzer@srs-us1.protection.inumbo.net>)
 id 1kqKCL-0001kv-F6
 for minios-devel@lists.xen.org; Fri, 18 Dec 2020 18:09:49 +0000
Received: from mailer2.neclab.eu (unknown [195.37.70.41])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 30fe52bc-05cc-4398-90ec-27e25f64d81e;
 Fri, 18 Dec 2020 18:09:41 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
 by mailer2.neclab.eu (Postfix) with ESMTP id A9929F22EC;
 Fri, 18 Dec 2020 19:09:40 +0100 (CET)
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 Z8CRbn8DayxQ; Fri, 18 Dec 2020 19:09:40 +0100 (CET)
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 828EEF2277
 for <minios-devel@lists.xen.org>; Fri, 18 Dec 2020 19:09:38 +0100 (CET)
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.2044.4; Fri, 18 Dec
 2020 19:09:33 +0100
X-BeenThere: minios-devel@lists.xenproject.org
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
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: 30fe52bc-05cc-4398-90ec-27e25f64d81e
X-Virus-Scanned: Amavisd on Debian GNU/Linux (atlas-b.office.hd)
X-ENC: Last-Hop-TLS-encrypted
X-ENC: Last-Hop-TLS-encrypted
From: Simon Kuenzer <simon.kuenzer@neclab.eu>
To: <minios-devel@lists.xen.org>
CC: Simon Kuenzer <simon.kuenzer@neclab.eu>
Subject: [UNIKRAFT PATCH 6/7] build: `*.in` files as pure pre-processed files
Date: Fri, 18 Dec 2020 19:09:23 +0100
Message-ID: <20201218180924.27217-7-simon.kuenzer@neclab.eu>
X-Mailer: git-send-email 2.20.1
In-Reply-To: <20201218180924.27217-1-simon.kuenzer@neclab.eu>
References: <20201218180924.27217-1-simon.kuenzer@neclab.eu>
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)

Registers `*.in` files as purely pre-processed files. The idea is
that such generated files can be used/included by other source
files during pre-processing or compiling.

Example:
 LIBMYLIB_SRCS += $(LIBMYLIB_BASE)/source.m4>.in

Signed-off-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
---
 support/build/Makefile.rules | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/support/build/Makefile.rules b/support/build/Makefile.rules
index 1797d134..1aca3391 100644
--- a/support/build/Makefile.rules
+++ b/support/build/Makefile.rules
@@ -593,6 +593,15 @@ $(eval $(call vprefix_lib,$(1),DTB-y) += $(4))
 $(eval $(call vprefix_lib,$(1),CLEAN-y) += $(call build_clean,$(4)))
 endef
 
+# terminating build rule
+# Only make sure that the file is registered to the preprocess stage
+define buildrule_noop_ =
+UK_PREPROCESS-y += $(2)
+endef
+
+# Aliases for pre-processed files (e.g., *.in)
+buildrule_in   = $(call buildrule_noop_,$(1),$(2))
+
 # wrapper for buildrule_*,
 # selects appropriate buildrule depending on file extension,
 # if there is no such buildrule available, we throw an error.
-- 
2.20.1


From minios-devel-bounces@lists.xenproject.org Fri Dec 18 18:09:56 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Fri, 18 Dec 2020 18:09:56 +0000
Received: from list by lists.xenproject.org with outflank-mailman.56603.99176 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1kqKCS-0001sf-4M; Fri, 18 Dec 2020 18:09:56 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 56603.99176; Fri, 18 Dec 2020 18:09: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 1kqKCS-0001sb-1P; Fri, 18 Dec 2020 18:09:56 +0000
Received: by outflank-mailman (input) for mailman id 56603;
 Fri, 18 Dec 2020 18:09: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=6OJK=FW=neclab.eu=simon.kuenzer@srs-us1.protection.inumbo.net>)
 id 1kqKCQ-0001kv-F9
 for minios-devel@lists.xen.org; Fri, 18 Dec 2020 18:09:54 +0000
Received: from mailer2.neclab.eu (unknown [195.37.70.41])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 3cafa737-47f0-4518-9505-04a63cbafa3f;
 Fri, 18 Dec 2020 18:09:43 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
 by mailer2.neclab.eu (Postfix) with ESMTP id B75E8F22EC;
 Fri, 18 Dec 2020 19:09:42 +0100 (CET)
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 oIaDWQAKgZs1; Fri, 18 Dec 2020 19:09:42 +0100 (CET)
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 8F098F2277
 for <minios-devel@lists.xen.org>; Fri, 18 Dec 2020 19:09:40 +0100 (CET)
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.2044.4; Fri, 18 Dec
 2020 19:09:34 +0100
X-BeenThere: minios-devel@lists.xenproject.org
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
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: 3cafa737-47f0-4518-9505-04a63cbafa3f
X-Virus-Scanned: Amavisd on Debian GNU/Linux (atlas-b.office.hd)
X-ENC: Last-Hop-TLS-encrypted
X-ENC: Last-Hop-TLS-encrypted
From: Simon Kuenzer <simon.kuenzer@neclab.eu>
To: <minios-devel@lists.xen.org>
CC: Simon Kuenzer <simon.kuenzer@neclab.eu>
Subject: [UNIKRAFT PATCH 7/7] build: Support generating C/C++ headers with pre-processing
Date: Fri, 18 Dec 2020 19:09:24 +0100
Message-ID: <20201218180924.27217-8-simon.kuenzer@neclab.eu>
X-Mailer: git-send-email 2.20.1
In-Reply-To: <20201218180924.27217-1-simon.kuenzer@neclab.eu>
References: <20201218180924.27217-1-simon.kuenzer@neclab.eu>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Content-Type: text/plain
X-Originating-IP: [192.168.24.96]
X-ClientProxiedBy: oberon.office.hd (192.168.24.90) To puck.office.hd
 (192.168.24.91)

Supports generating C/C++ header files by the pre-processing rules
of the build system.

Example:
 LIBMYLIB_SRCS += $(LIBMYLIB_BASE)/header.m4>.h

Signed-off-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
---
 support/build/Makefile.rules | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/support/build/Makefile.rules b/support/build/Makefile.rules
index 1aca3391..48c3f4ff 100644
--- a/support/build/Makefile.rules
+++ b/support/build/Makefile.rules
@@ -602,6 +602,16 @@ endef
 # Aliases for pre-processed files (e.g., *.in)
 buildrule_in   = $(call buildrule_noop_,$(1),$(2))
 
+# Aliases for C headers
+buildrule_h   = $(call buildrule_noop_,$(1),$(2))
+
+# Aliases for C++ headers
+buildrule_hp  = $(call buildrule_noop_,$(1),$(2))
+buildrule_hh  = $(call buildrule_noop_,$(1),$(2))
+buildrule_hpp = $(call buildrule_noop_,$(1),$(2))
+buildrule_HPP = $(call buildrule_noop_,$(1),$(2))
+buildrule_H   = $(call buildrule_noop_,$(1),$(2))
+
 # wrapper for buildrule_*,
 # selects appropriate buildrule depending on file extension,
 # if there is no such buildrule available, we throw an error.
-- 
2.20.1


From minios-devel-bounces@lists.xenproject.org Fri Dec 18 18:20:25 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Fri, 18 Dec 2020 18:20:25 +0000
Received: from list by lists.xenproject.org with outflank-mailman.56612.99181 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1kqKMZ-0003ko-Q4; Fri, 18 Dec 2020 18:20:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 56612.99181; Fri, 18 Dec 2020 18:20: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 1kqKMZ-0003kh-Mz; Fri, 18 Dec 2020 18:20:23 +0000
Received: by outflank-mailman (input) for mailman id 56612;
 Fri, 18 Dec 2020 18:20: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=6OJK=FW=neclab.eu=simon.kuenzer@srs-us1.protection.inumbo.net>)
 id 1kqKMY-0003kc-BG
 for minios-devel@lists.xen.org; Fri, 18 Dec 2020 18:20:22 +0000
Received: from mailer2.neclab.eu (unknown [195.37.70.41])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 67c8ebcc-2ad5-4813-9290-fc0363173e19;
 Fri, 18 Dec 2020 18:20:19 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
 by mailer2.neclab.eu (Postfix) with ESMTP id C6717F2301;
 Fri, 18 Dec 2020 19:20:18 +0100 (CET)
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 tbYWZ7GhEVtG; Fri, 18 Dec 2020 19:20:18 +0100 (CET)
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 85850F22EC;
 Fri, 18 Dec 2020 19:20:12 +0100 (CET)
Received: from [10.7.2.49] (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.2044.4; Fri, 18 Dec
 2020 19:20:12 +0100
X-BeenThere: minios-devel@lists.xenproject.org
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
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: 67c8ebcc-2ad5-4813-9290-fc0363173e19
X-Virus-Scanned: Amavisd on Debian GNU/Linux (atlas-b.office.hd)
X-ENC: Last-Hop-TLS-encrypted
X-ENC: Last-Hop-TLS-encrypted
Subject: Re: [UNIKRAFT PATCH 3/5] lib/uktime: Register `gettimeofday` to
 syscall_shim
To: Daniel Dinca <dincadaniel97@gmail.com>, Constantin Raducanu
	<raducanu.costi@gmail.com>, <minios-devel@lists.xen.org>
References: <20200717124718.16583-1-raducanu.costi@gmail.com>
 <20200717124718.16583-3-raducanu.costi@gmail.com>
 <b20506ea-fd25-c477-9403-ea859ac487ab@gmail.com>
From: Simon Kuenzer <simon.kuenzer@neclab.eu>
Message-ID: <a1ed3bcf-afe8-06c3-1880-2f33f0a7454a@neclab.eu>
Date: Fri, 18 Dec 2020 19:20:11 +0100
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0)
 Gecko/20100101 Thunderbird/78.5.1
MIME-Version: 1.0
In-Reply-To: <b20506ea-fd25-c477-9403-ea859ac487ab@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: puck.office.hd (192.168.24.91) To puck.office.hd
 (192.168.24.91)

Hi Daniel,

please send the Reviewed-by tag only when you accept the patch. You did 
not accept it, right?

Thanks,

Simon

On 03.12.20 11:15, Daniel Dinca wrote:
> This should use the UK_SYSCALL_R_DEFINE macro, with the new
> 
> updated version it should support __unused so no warning will appear.
> 
> 
> Reviewed-by: Daniel Dinca <dincadaniel97@gmail.com>
> 
> On 17.07.2020 15:47, Constantin Raducanu wrote:
>> Registers `gettimeofday` system call to syscall_shim library.
>> In order to avoid the unused warning for the second parameter,
>> I had to provide all three system call entry functions manually.
>>
>> Signed-off-by: Constantin Raducanu <raducanu.costi@gmail.com>
>> ---
>>   lib/uktime/Makefile.uk   |  2 ++
>>   lib/uktime/exportsyms.uk |  2 ++
>>   lib/uktime/time.c        | 32 +++++++++++++++++++++++++++-----
>>   3 files changed, 31 insertions(+), 5 deletions(-)
>>
>> diff --git a/lib/uktime/Makefile.uk b/lib/uktime/Makefile.uk
>> index 2976a10..4fdf282 100644
>> --- a/lib/uktime/Makefile.uk
>> +++ b/lib/uktime/Makefile.uk
>> @@ -12,3 +12,5 @@ LIBUKTIME_SRCS-y += 
>> $(LIBUKTIME_BASE)/musl-imported/src/__tm_to_secs.c
>>   LIBUKTIME_SRCS-y += 
>> $(LIBUKTIME_BASE)/musl-imported/src/__year_to_secs.c
>>   LIBUKTIME_SRCS-y += $(LIBUKTIME_BASE)/time.c
>>   LIBUKTIME_SRCS-y += $(LIBUKTIME_BASE)/timer.c
>> +
>> +UK_PROVIDED_SYSCALLS-$(CONFIG_LIBUKTIME) += gettimeofday-2
>> \ No newline at end of file
>> diff --git a/lib/uktime/exportsyms.uk b/lib/uktime/exportsyms.uk
>> index 82b70b7..90ad7f9 100644
>> --- a/lib/uktime/exportsyms.uk
>> +++ b/lib/uktime/exportsyms.uk
>> @@ -2,6 +2,8 @@ clock_getres
>>   clock_gettime
>>   clock_settime
>>   gettimeofday
>> +uk_syscall_e_gettimeofday
>> +uk_syscall_r_gettimeofday
>>   nanosleep
>>   setitimer
>>   sleep
>> diff --git a/lib/uktime/time.c b/lib/uktime/time.c
>> index 4d3ba53..e45b6f4 100644
>> --- a/lib/uktime/time.c
>> +++ b/lib/uktime/time.c
>> @@ -43,6 +43,8 @@
>>   #include <uk/plat/time.h>
>>   #include <uk/config.h>
>>   #include <uk/print.h>
>> +#include <uk/syscall.h>
>> +
>>   #if CONFIG_HAVE_SCHED
>>   #include <uk/sched.h>
>>   #else
>> @@ -125,20 +127,40 @@ unsigned int sleep(unsigned int seconds)
>>       return 0;
>>   }
>> -int gettimeofday(struct timeval *tv, void *tz __unused)
>> +long uk_syscall_r_gettimeofday(long tv, long tz __unused)
>>   {
>>       __nsec now = ukplat_wall_clock();
>>       if (!tv) {
>> -        errno = EINVAL;
>> -        return -1;
>> +        return -EINVAL;
>>       }
>> -    tv->tv_sec = ukarch_time_nsec_to_sec(now);
>> -    tv->tv_usec = ukarch_time_nsec_to_usec(ukarch_time_subsec(now));
>> +    ((struct timeval*) tv)->tv_sec = ukarch_time_nsec_to_sec(now);
>> +    ((struct timeval*) tv)->tv_usec =
>> +        ukarch_time_nsec_to_usec(ukarch_time_subsec(now));
>> +
>>       return 0;
>>   }
>> +long uk_syscall_e_gettimeofday(long tv, long tz __unused)
>> +{
>> +    long ret;
>> +
>> +    ret = uk_syscall_r_gettimeofday(tv, tz);
>> +    if (ret < 0) {
>> +        errno = (int) -ret;
>> +        return -1;
>> +    }
>> +    return 0;
>> +}
>> +
>> +#if !UK_LIBC_SYSCALL
>> +int gettimeofday (struct timeval* tv, void* tz __unused)
>> +{
>> +    return uk_syscall_e_gettimeofday((long) tv, (long)tz);
>> +}
>> +#endif
>> +
>>   int clock_getres(clockid_t clk_id __unused, struct timespec *res 
>> __unused)
>>   {
>>       return 0;
>>


From minios-devel-bounces@lists.xenproject.org Fri Dec 18 18:22:48 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Fri, 18 Dec 2020 18:22:48 +0000
Received: from list by lists.xenproject.org with outflank-mailman.56614.99185 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1kqKOu-0003oj-1V; Fri, 18 Dec 2020 18:22:48 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 56614.99185; Fri, 18 Dec 2020 18:22: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 1kqKOt-0003oc-Um; Fri, 18 Dec 2020 18:22:47 +0000
Received: by outflank-mailman (input) for mailman id 56614;
 Fri, 18 Dec 2020 18:22: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=6OJK=FW=neclab.eu=simon.kuenzer@srs-us1.protection.inumbo.net>)
 id 1kqKOt-0003oX-2p
 for minios-devel@lists.xen.org; Fri, 18 Dec 2020 18:22:47 +0000
Received: from mailer1.neclab.eu (unknown [195.37.70.40])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id bf665566-cc9a-4938-a0de-9b4c2e09476b;
 Fri, 18 Dec 2020 18:22:45 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
 by mailer1.neclab.eu (Postfix) with ESMTP id 9FDEF10400E;
 Fri, 18 Dec 2020 19:22:44 +0100 (CET)
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 38ff51McSLvK; Fri, 18 Dec 2020 19:22:44 +0100 (CET)
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 7AEC3103AF6;
 Fri, 18 Dec 2020 19:22:44 +0100 (CET)
Received: from [10.7.2.49] (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.2044.4; Fri, 18 Dec
 2020 19:22:44 +0100
X-BeenThere: minios-devel@lists.xenproject.org
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
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: bf665566-cc9a-4938-a0de-9b4c2e09476b
X-Virus-Scanned: Amavisd on Debian GNU/Linux (atlas-a.office.hd)
X-ENC: Last-Hop-TLS-encrypted
X-ENC: Last-Hop-TLS-encrypted
Subject: Re: [2/5] lib/ukmmap: Register `mmap` and `munmap` to syscall_shim
To: Liza Babu <lizzababu@gmail.com>, <raducanu.costi@gmail.com>
CC: <minios-devel@lists.xen.org>, Liza Babu <lizza.babu@gmail.com>
References: <20201214090953.35986-1-lizza.babu@gmail.com>
From: Simon Kuenzer <simon.kuenzer@neclab.eu>
Message-ID: <23e200fa-03fc-be72-d6e5-a486da567b4e@neclab.eu>
Date: Fri, 18 Dec 2020 19:22:43 +0100
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0)
 Gecko/20100101 Thunderbird/78.5.1
MIME-Version: 1.0
In-Reply-To: <20201214090953.35986-1-lizza.babu@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)

Hi Liza,

I figured what was going on. When sending a `Reviewed-by`, could you 
reply inline to the original mail (instead of responding with a new & 
fresh email)? Unfortunately, our patchwork system was ignoring this 
email probably because of this.

I will take this patch upstream.

Thanks,

Simon

On 14.12.20 10:09, Liza Babu wrote:
> Hi, Costi.
> 
> Looks good to me.
> 
> Liza Babu
> 
> Reviewed-by: Liza Babu <lizza.babu@gmail.com>
> 


From minios-devel-bounces@lists.xenproject.org Sun Dec 20 18:14:30 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Sun, 20 Dec 2020 18:14:30 +0000
Received: from list by lists.xenproject.org with outflank-mailman.57166.99972 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1kr3Dv-0007mx-WF; Sun, 20 Dec 2020 18:14:28 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 57166.99972; Sun, 20 Dec 2020 18:14:27 +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 1kr3Dv-0007mq-T0; Sun, 20 Dec 2020 18:14:27 +0000
Received: by outflank-mailman (input) for mailman id 57166;
 Sun, 20 Dec 2020 18:14:27 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=XUg7=FY=gmail.com=cezar.craciunoiu@srs-us1.protection.inumbo.net>)
 id 1kr3Dv-0007ml-86
 for minios-devel@lists.xen.org; Sun, 20 Dec 2020 18:14:27 +0000
Received: from mail-ej1-x630.google.com (unknown [2a00:1450:4864:20::630])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 8c4d1caf-5ea2-4706-acca-64b8bf40b686;
 Sun, 20 Dec 2020 18:14:26 +0000 (UTC)
Received: by mail-ej1-x630.google.com with SMTP id 6so10420276ejz.5
 for <minios-devel@lists.xen.org>; Sun, 20 Dec 2020 10:14:26 -0800 (PST)
Received: from [192.168.0.3] ([86.120.179.28])
 by smtp.gmail.com with ESMTPSA id qp16sm8188218ejb.74.2020.12.20.10.14.24
 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128);
 Sun, 20 Dec 2020 10:14:24 -0800 (PST)
X-BeenThere: minios-devel@lists.xenproject.org
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
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: 8c4d1caf-5ea2-4706-acca-64b8bf40b686
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20161025;
        h=mime-version:date:message-id:subject:from:to:cc:in-reply-to
         :references:user-agent;
        bh=e7KLsjRQtzyi32HeN5d1GdHP1vXk8YT1cb84dqI9SAc=;
        b=Spqk1lkYlmjSNnNAOUqcZy+dHuOSDP1UbJmKpZy6WyLKg8DKR20p6eiKwz0kvYmdmH
         NavKhN2Jnzy8H2jSFAHZTBd7rfmBrirQJtILQEYY/9OyQnEOfAZjxoXbYaozhd12KW02
         oHbdgKmX1UAdrqR2UArFBxrtdsRBcWnW0TD2uYjaV91hGxA+pKipXB8BBPBxDchzJUo2
         2AAeHYh1fP6N8G/UlXlugjpQyUf1FoUEIIzdLVWPMeTKhL2bdSx0V5D4u6+Q+1EvuZQU
         DQLFdt/HhVmOa5grVr9X1m5CAPS0Mh1rvPUBUhJOYIYCxm7rFrDsOiS68nfT2dqyEVyb
         bvfg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20161025;
        h=x-gm-message-state:mime-version:date:message-id:subject:from:to:cc
         :in-reply-to:references:user-agent;
        bh=e7KLsjRQtzyi32HeN5d1GdHP1vXk8YT1cb84dqI9SAc=;
        b=BKFKzEbu9RYb+R5WXd4L5GptDcvdtIRf4wq7SQpLN9NkXyymW+eiqofAlZHwMMcob3
         9FAOYCTBCL9rWuJ0jkJeKYAxqGG84BnGqDUtyG7NzJT20kcML4TlIkbmHTqAMiXVQARD
         NkV26m9S0GHc1kIUC9Pgxw0A3mf6noH4c0EhF+EjXATo7Go2MyJrR+UjoazzWLY1qKGI
         12ODCAXOBFHgV+jZ8b1jJy3VXI0wY6WZHWyeu9k7PcGSQ0nNOG19fbp+k/l2YrxlYlEX
         Cx9EIUxWXxzpss1HgESHyxOqh0cbdE63DBz53v9vRpapYXQnwxaIs5J9HyNMe+pUfTGq
         4WRA==
X-Gm-Message-State: AOAM533T8jJ6GcsFE78tOdduC0FRr/zn+Qw1Q4/5nKKSYrguPFMJCV55
	Nq7pJzTpX85J58OwKF1lNvY=
X-Google-Smtp-Source: ABdhPJx+Tk03KewU2OxQ5CtJUig7EZyrNm4G7GwgqnxLWJwoViI9rRBFQeQM0gfdk3voVNh13O8gsw==
X-Received: by 2002:a17:906:3881:: with SMTP id q1mr12835142ejd.490.1608488065203;
        Sun, 20 Dec 2020 10:14:25 -0800 (PST)
Content-Type: multipart/alternative;
 boundary="----=_NextPart_19715818.371853051266"
MIME-Version: 1.0
Date: Sun, 20 Dec 2020 20:13:53 +0200
Message-ID: <Mailbird-0816e40b-d6a1-4a24-bb9c-21e40b38f965@gmail.com>
Subject: Re: [UNIKRAFT/LWIP PATCH] alloc.c: Include missing `<stddef.h>`
From: "Cezar Craciunoiu" <cezar.craciunoiu@gmail.com>
To: "Simon Kuenzer" <simon.kuenzer@neclab.eu>
Cc: "" <minios-devel@lists.xen.org>
In-Reply-To: <20201202233157.28996-1-simon.kuenzer@neclab.eu>
References: <20201202233157.28996-1-simon.kuenzer@neclab.eu>
User-Agent: Mailbird/2.9.13.0
X-Mailbird-ID: Mailbird-0816e40b-d6a1-4a24-bb9c-21e40b38f965@gmail.com

------=_NextPart_19715818.371853051266
Content-Type: text/plain;
 charset="utf-8"
Content-Transfer-Encoding: quoted-printable

Hey Simon,

The patch looks good.

Cezar

Reviewed-by: Cezar Craciunoiu <cezar.craciunoiu@gmail.com [mailto:cezar.cra=
ciunoiu@gmail.com]>
On 2020-12-03 01:32:17, Simon Kuenzer <simon.kuenzer@neclab.eu> wrote:
Include `` that provides the definition for `size_t`.

Signed-off-by: Simon Kuenzer
---
alloc.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/alloc.c b/alloc.c
index a5b4377..af52f27 100644
--- a/alloc.c
+++ b/alloc.c
@@ -32,6 +32,7 @@
*/

#include
+#include

void *sys_malloc(size_t size)
{
--
2.20.1


------=_NextPart_19715818.371853051266
Content-Type: text/html;
 charset="utf-8"
Content-Transfer-Encoding: quoted-printable

<div id=3D"__MailbirdStyleContent" style=3D"font-size: 10pt;font-family: Ar=
ial;color: #000000;text-align: left" dir=3D"ltr">=0A                       =
                 =0A                                        =0A            =
                                =0A                                        =
=0A                                        =0A                             =
           <span style=3D"font-size: 13.3333px">Hey Simon,</span><div style=
=3D"font-size: 13.3333px"><br></div><div style=3D"font-size: 13.3333px">The=
 patch looks good.</div><div style=3D"font-size: 13.3333px"><br></div><div =
style=3D"font-size: 13.3333px">Cezar</div><div style=3D"font-size: 13.3333p=
x"><br></div><div style=3D"font-size: 13.3333px">Reviewed-by: Cezar Craciun=
oiu &lt;<a href=3D"mailto:cezar.craciunoiu@gmail.com" title=3D"Send an emai=
l to cezar.craciunoiu@gmail.com" style=3D"cursor: pointer; color: blue;">ce=
zar.craciunoiu@gmail.com</a>&gt;</div><div class=3D"mb_sig"></div><blockquo=
te class=3D"history_container" type=3D"cite" style=3D"border-left-style:sol=
id;border-width:1px; margin-top:20px; margin-left:0px;padding-left:10px;">=
=0A                        <p style=3D"color: #AAAAAA; margin-top: 10px;">O=
n 2020-12-03 01:32:17, Simon Kuenzer &lt;simon.kuenzer@neclab.eu&gt; wrote:=
</p><div style=3D"font-family:Arial,Helvetica,sans-serif">Include `<stddef.=
h>` that provides the definition for `size_t`.=0A<br>=0A<br>Signed-off-by: =
Simon Kuenzer <simon.kuenzer@neclab.eu>=0A<br>---=0A<br> alloc.c | 1 +=0A<b=
r> 1 file changed, 1 insertion(+)=0A<br>=0A<br>diff --git a/alloc.c b/alloc=
.c=0A<br>index a5b4377..af52f27 100644=0A<br>--- a/alloc.c=0A<br>+++ b/allo=
c.c=0A<br>@@ -32,6 +32,7 @@=0A<br>  */=0A<br> =0A<br> #include <uk alloc.h=
=3D"">=0A<br>+#include <stddef.h>=0A<br> =0A<br> void *sys_malloc(size_t si=
ze)=0A<br> {=0A<br>-- =0A<br>2.20.1=0A<br>=0A<br></stddef.h></uk></simon.ku=
enzer@neclab.eu></stddef.h></div></blockquote>=0A                          =
              =0A                                        </div>
------=_NextPart_19715818.371853051266--


From minios-devel-bounces@lists.xenproject.org Sun Dec 20 18:15:13 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Sun, 20 Dec 2020 18:15:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.57167.99975 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1kr3Ef-0007oW-2l; Sun, 20 Dec 2020 18:15:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 57167.99975; Sun, 20 Dec 2020 18:15: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 1kr3Ee-0007oP-WA; Sun, 20 Dec 2020 18:15:12 +0000
Received: by outflank-mailman (input) for mailman id 57167;
 Sun, 20 Dec 2020 18:15: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=XUg7=FY=gmail.com=cezar.craciunoiu@srs-us1.protection.inumbo.net>)
 id 1kr3Ee-0007oK-NR
 for minios-devel@lists.xen.org; Sun, 20 Dec 2020 18:15:12 +0000
Received: from mail-ed1-x535.google.com (unknown [2a00:1450:4864:20::535])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 39f69dcd-2208-4afe-992b-f3ac0b4f8d7f;
 Sun, 20 Dec 2020 18:15:11 +0000 (UTC)
Received: by mail-ed1-x535.google.com with SMTP id p22so7459384edu.11
 for <minios-devel@lists.xen.org>; Sun, 20 Dec 2020 10:15:11 -0800 (PST)
Received: from [192.168.0.3] ([86.120.179.28])
 by smtp.gmail.com with ESMTPSA id t15sm3933252eds.38.2020.12.20.10.15.10
 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128);
 Sun, 20 Dec 2020 10:15:10 -0800 (PST)
X-BeenThere: minios-devel@lists.xenproject.org
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
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: 39f69dcd-2208-4afe-992b-f3ac0b4f8d7f
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20161025;
        h=mime-version:date:message-id:subject:from:to:cc:in-reply-to
         :references:user-agent;
        bh=RZ0G9Tts2LijxFTdFeZZCklREdr8GFQwnJ4/sY8Euoc=;
        b=aH7UyxQou5a45b3S9K28AqCCs7dsj4W1FL+lV2h388YjSEms3PZbYouTftZJPe0Dtl
         j0DNl2D9gxFxKlcWM+t/pScEWDRqIa6pL9j/SwwX8/H8y4b8TX9oAolEMmwENUsxqsC4
         9j5/HfvBt8tzkySM2o+wyh3lm5BUEDXWrit8YN89bFvSdjM5Hc3Y3qfC1O/fuhe1bbBJ
         m3bUBvNmiv66t5awXCpOThcGW2cTRR12y2yXgtuvZn76TALDco48SSRxuNpboIBcF+AX
         P0IqglGZxPAwwvjR3P+3BiqqgZdKu0JVss+VKv+YtFYpiqjKSw5EGznbiP65jGN3sK1d
         KtSg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20161025;
        h=x-gm-message-state:mime-version:date:message-id:subject:from:to:cc
         :in-reply-to:references:user-agent;
        bh=RZ0G9Tts2LijxFTdFeZZCklREdr8GFQwnJ4/sY8Euoc=;
        b=qmTWV73Oe9USSOn2aMMvMFcRxiYAAeB98BodN3kOvx8iK6ls86+BoaDumwqmHt1TSd
         59MsN89fIc3pWcsljsLv4G7HfEv1Mp6c/lob+l9BhMSB31eIQpQA55O6Q2I7HVHlp2Lu
         Ms+UGtfBramBD7n9qgnsxoKxDgY57jXGHzkN2zowZIu/Mc6kapwnXeQFcMrKRkE7zFe+
         /alVJ4keGv+82GFDLGHrth0dBhH2ICQV+XYUx3F3dwf+Y/Dl5ivEeoJ38yAsGzym+oBT
         EZgAT0BesOAiZZQGQIanJ5ULW7+AJcF0KPK8PP+fmGW+jLIHRtvGhzvx95e/SnOtUxGB
         ti4A==
X-Gm-Message-State: AOAM532tc7kcNScFHzvy/3YEQ9n34XsEamrNJsghvUDK3AIMdo/C7S8V
	O4v4gVBpWgBTmGtaoOa4knM=
X-Google-Smtp-Source: ABdhPJw62ekjygDrQ8eOyK7ISAyyJyER29N7E7EYeUBs/ekMyvEYLcG77o9fTrZAMPjk2CHAjVsCnQ==
X-Received: by 2002:a05:6402:513:: with SMTP id m19mr13242508edv.244.1608488111053;
        Sun, 20 Dec 2020 10:15:11 -0800 (PST)
Content-Type: multipart/alternative;
 boundary="----=_NextPart_63148708.532544636619"
MIME-Version: 1.0
Date: Sun, 20 Dec 2020 20:14:39 +0200
Message-ID: <Mailbird-2f2939ff-db36-4bba-83e5-b1217643426a@gmail.com>
Subject: Re: [UNIKRAFT/LWIP PATCH] Option to force polling mode
From: "Cezar Craciunoiu" <cezar.craciunoiu@gmail.com>
To: "Simon Kuenzer" <simon.kuenzer@neclab.eu>
Cc: "" <minios-devel@lists.xen.org>
In-Reply-To: <20201202233214.29070-1-simon.kuenzer@neclab.eu>
References: <20201202233214.29070-1-simon.kuenzer@neclab.eu>
User-Agent: Mailbird/2.9.13.0
X-Mailbird-ID: Mailbird-2f2939ff-db36-4bba-83e5-b1217643426a@gmail.com

------=_NextPart_63148708.532544636619
Content-Type: text/plain;
 charset="utf-8"
Content-Transfer-Encoding: 7bit

Hey Simon,

The patch looks good to me.

Cezar

Reviewed-by: Cezar Craciunoiu <cezar.craciunoiu@gmail.com>
On 2020-12-03 01:32:35, Simon Kuenzer <simon.kuenzer@neclab.eu> wrote:
Introduces an option to force polling mode for uknetdev devices
irrespective if the device supports interrupt-driven mode.
Because this option always causes 100% CPU utilization it should
be considered as workaround for cases where interrupt-based
handling performs badly.

Signed-off-by: Simon Kuenzer
---
Config.uk | 14 ++++++++++++++
uknetdev.c | 4 ++++
2 files changed, 18 insertions(+)

diff --git a/Config.uk b/Config.uk
index 658e272..6d1fdb1 100644
--- a/Config.uk
+++ b/Config.uk
@@ -23,6 +23,20 @@ config LWIP_UKNETDEV
driver does not support receive interrupts the network
interfaces have to be polled manually (uknetdev_poll()).

+if LWIP_UKNETDEV
+config LWIP_UKNETDEV_POLLONLY
+ depends on LWIP_THREADS
+ bool "Force polling mode (workaround)"
+ default n
+ help
+ This option forces polling mode for uknetdev devices
+ irrespective if the device supports interrupt-driven
+ mode.
+ Because this option always causes 100% CPU utilization
+ it should be considered as workaround for cases where
+ interrupt-based handling performs badly.
+endif
+
config LWIP_UKNETDEV_SCRATCH
int
default 64
diff --git a/uknetdev.c b/uknetdev.c
index 0524f12..b665830 100644
--- a/uknetdev.c
+++ b/uknetdev.c
@@ -477,6 +477,10 @@ err_t uknetdev_init(struct netif *nf)
if (!lwip_data->dev_info.max_rx_queues
|| !lwip_data->dev_info.max_tx_queues)
return ERR_IF;
+#if CONFIG_LWIP_UKNETDEV_POLLONLY
+ /* Unset receive interrupt support: We force polling mode */
+ lwip_data->dev_info.features &= ~UK_FEATURE_RXQ_INTR_AVAILABLE;
+#endif /* CONFIG_LWIP_UKNETDEV_POLLONLY */
lwip_data->pkt_a = a;

LWIP_DEBUGF(NETIF_DEBUG,
--
2.20.1


------=_NextPart_63148708.532544636619
Content-Type: text/html;
 charset="utf-8"
Content-Transfer-Encoding: quoted-printable

<div id=3D"__MailbirdStyleContent" style=3D"font-size: 10pt;font-family: Ar=
ial;color: #000000;text-align: left" dir=3D"ltr">=0A                       =
                 =0A                                        =0A            =
                                =0A                                        =
=0A                                        =0A                             =
           <span style=3D"font-size: 13.3333px">Hey Simon,</span><div class=
=3D"mb_sig" style=3D"font-size: 13.3333px"></div><div style=3D"font-size: 1=
3.3333px"><br></div><div style=3D"font-size: 13.3333px">The patch looks goo=
d to me.</div><div style=3D"font-size: 13.3333px"><br></div><div style=3D"f=
ont-size: 13.3333px">Cezar</div><div style=3D"font-size: 13.3333px"><br></d=
iv><div style=3D"font-size: 13.3333px">Reviewed-by: Cezar Craciunoiu &lt;ce=
zar.craciunoiu@gmail.com&gt;</div><div class=3D"mb_sig"></div><blockquote c=
lass=3D"history_container" type=3D"cite" style=3D"border-left-style:solid;b=
order-width:1px; margin-top:20px; margin-left:0px;padding-left:10px;">=0A  =
                      <p style=3D"color: #AAAAAA; margin-top: 10px;">On 202=
0-12-03 01:32:35, Simon Kuenzer &lt;simon.kuenzer@neclab.eu&gt; wrote:</p><=
div style=3D"font-family:Arial,Helvetica,sans-serif">Introduces an option t=
o force polling mode for uknetdev devices=0A<br>irrespective if the device =
supports interrupt-driven mode.=0A<br>Because this option always causes 100=
% CPU utilization it should=0A<br>be considered as workaround for cases whe=
re interrupt-based=0A<br>handling performs badly.=0A<br>=0A<br>Signed-off-b=
y: Simon Kuenzer <simon.kuenzer@neclab.eu>=0A<br>---=0A<br> Config.uk  | 14=
 ++++++++++++++=0A<br> uknetdev.c |  4 ++++=0A<br> 2 files changed, 18 inse=
rtions(+)=0A<br>=0A<br>diff --git a/Config.uk b/Config.uk=0A<br>index 658e2=
72..6d1fdb1 100644=0A<br>--- a/Config.uk=0A<br>+++ b/Config.uk=0A<br>@@ -23=
,6 +23,20 @@ config LWIP_UKNETDEV=0A<br> 		driver does not support receive =
interrupts the network=0A<br> 		interfaces have to be polled manually (ukne=
tdev_poll()).=0A<br> =0A<br>+if LWIP_UKNETDEV=0A<br>+config LWIP_UKNETDEV_P=
OLLONLY=0A<br>+       depends on LWIP_THREADS=0A<br>+       bool "Force pol=
ling mode (workaround)"=0A<br>+       default n=0A<br>+       help=0A<br>+	=
	This option forces polling mode for uknetdev devices=0A<br>+		irrespective=
 if the device supports interrupt-driven=0A<br>+		mode.=0A<br>+		Because th=
is option always causes 100% CPU utilization=0A<br>+		it should be consider=
ed as workaround for cases where=0A<br>+		interrupt-based handling performs=
 badly.=0A<br>+endif=0A<br>+=0A<br> config LWIP_UKNETDEV_SCRATCH=0A<br> 	in=
t=0A<br> 	default 64=0A<br>diff --git a/uknetdev.c b/uknetdev.c=0A<br>index=
 0524f12..b665830 100644=0A<br>--- a/uknetdev.c=0A<br>+++ b/uknetdev.c=0A<b=
r>@@ -477,6 +477,10 @@ err_t uknetdev_init(struct netif *nf)=0A<br> 	if (!l=
wip_data-&gt;dev_info.max_rx_queues=0A<br> 	    || !lwip_data-&gt;dev_info.=
max_tx_queues)=0A<br> 		return ERR_IF;=0A<br>+#if CONFIG_LWIP_UKNETDEV_POLL=
ONLY=0A<br>+	/* Unset receive interrupt support: We force polling mode */=
=0A<br>+	lwip_data-&gt;dev_info.features &amp;=3D ~UK_FEATURE_RXQ_INTR_AVAI=
LABLE;=0A<br>+#endif /* CONFIG_LWIP_UKNETDEV_POLLONLY */=0A<br> 	lwip_data-=
&gt;pkt_a =3D a;=0A<br> =0A<br> 	LWIP_DEBUGF(NETIF_DEBUG,=0A<br>-- =0A<br>2=
.20.1=0A<br>=0A<br></simon.kuenzer@neclab.eu></div></blockquote>=0A        =
                                =0A                                        =
</div>
------=_NextPart_63148708.532544636619--


From minios-devel-bounces@lists.xenproject.org Mon Dec 21 11:17:32 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Mon, 21 Dec 2020 11:17:32 +0000
Received: from list by lists.xenproject.org with outflank-mailman.57375.100368 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1krJBy-0004i5-EM; Mon, 21 Dec 2020 11:17:30 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 57375.100368; Mon, 21 Dec 2020 11: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 1krJBy-0004hy-BV; Mon, 21 Dec 2020 11:17:30 +0000
Received: by outflank-mailman (input) for mailman id 57375;
 Mon, 21 Dec 2020 11: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=E51K=FZ=gmail.com=dincadaniel97@srs-us1.protection.inumbo.net>)
 id 1krJBx-0004ht-9B
 for minios-devel@lists.xen.org; Mon, 21 Dec 2020 11:17:29 +0000
Received: from mail-oi1-x235.google.com (unknown [2607:f8b0:4864:20::235])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id f5bf5e94-5841-4ef4-bdd9-1ac92e5b3189;
 Mon, 21 Dec 2020 11:17:27 +0000 (UTC)
Received: by mail-oi1-x235.google.com with SMTP id d203so10953638oia.0
 for <minios-devel@lists.xen.org>; Mon, 21 Dec 2020 03:17:27 -0800 (PST)
X-BeenThere: minios-devel@lists.xenproject.org
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
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: f5bf5e94-5841-4ef4-bdd9-1ac92e5b3189
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=6bX/HpYdB6dRWvF/9jwSYnYhguyKVZ966S47FafZ0RQ=;
        b=lomwEZeDrTB7B5Qq0mUYIUmi8/JbRLKSWehBXHPJqC6wQWpPptFUpD+7f6Q10lPX6j
         YyHaO23rU9765Q2mPjBviI36/aXigK2A0vQcKkQm/C1K26Qazb2FgAvDkubVEQ5EBDQj
         5DkelpByi3LZOiAIXkQigjiqq2Cu76q+qHUSg1KXZjQGSW/qEihlpEY1NfUZg6g9Aljy
         M3YD7DoD8Mfgj/0Wx2JDTX0EB1KLK+hECq7/AaVTBorM1+9JK2NeACgJvqzOn5StnKhP
         QncUvq2DLSAq0hNm1L+J4qHY9cqEFmL2Z2a3VS+DDoecPBU253lrU4+DM5U8W4Yx07Z8
         YXEQ==
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=6bX/HpYdB6dRWvF/9jwSYnYhguyKVZ966S47FafZ0RQ=;
        b=eQD/Z5qsGMiiz6f1OBbCJ1lHrC6K+Yfmli0qWYGHkTXcqJjXaPdKyxs1/ZYq1nlNmW
         nmDG0YxgNUjdb+4ZBYYGp/Alt0pcsPNOJ1ZPUL2lA8xpWEpLtxSD7TF3tQbD3Bvb7vaI
         EbofvkqZkxYesY8ZoOnMrw3EcuudR7el0KLYdQBFF/E16UIJEDXMdOETZMLJIvQi+888
         9iYdddT4JqW7RzC1xOPea5pBwM707yFNFvNXnUGHHDL5GfYRyZf8qApAHbfPyDt8s1o2
         XdMX6GQ0JLhpewNNjb9fAkFJ1c5VrVRR3Aq3NoMm/SrYjA/VyXYp7eap6VBRXVb9RSij
         U14w==
X-Gm-Message-State: AOAM530m5KVvuo0AbqW9uOHq9a27Ft1E0IwYxUDj4K5pNKg8QfnwZia0
	SeGCFUyTPobcaseFftL2LLYWiWbYC5QqhxjctWo=
X-Google-Smtp-Source: ABdhPJyG9hCSCzNXWT/oaIkhIxWbxSKh0x/jxEy3TzbBFkFvymuNGLb2N692HgYfK0BXiScXosfLhxOSPi8FIm/6Awc=
X-Received: by 2002:a05:6808:650:: with SMTP id z16mr10416613oih.50.1608549447489;
 Mon, 21 Dec 2020 03:17:27 -0800 (PST)
MIME-Version: 1.0
References: <20200717124718.16583-1-raducanu.costi@gmail.com>
 <20200717124718.16583-3-raducanu.costi@gmail.com> <b20506ea-fd25-c477-9403-ea859ac487ab@gmail.com>
 <a1ed3bcf-afe8-06c3-1880-2f33f0a7454a@neclab.eu>
In-Reply-To: <a1ed3bcf-afe8-06c3-1880-2f33f0a7454a@neclab.eu>
From: Daniel Dinca <dincadaniel97@gmail.com>
Date: Mon, 21 Dec 2020 13:17:16 +0200
Message-ID: <CALjJXS5RLLfq=zkgBRrV2YQsmbt8LyUkT1Ca=_vArVfA8WNCTw@mail.gmail.com>
Subject: Re: [UNIKRAFT PATCH 3/5] lib/uktime: Register `gettimeofday` to syscall_shim
To: Simon Kuenzer <simon.kuenzer@neclab.eu>
Cc: Constantin Raducanu <raducanu.costi@gmail.com>, minios-devel@lists.xen.org
Content-Type: multipart/alternative; boundary="0000000000006bdb2c05b6f79a53"

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

Hi Simon,

Yes, I did not accept this.

Thanks,
Daniel

=C3=8En vin., 18 dec. 2020 la 20:20, Simon Kuenzer <simon.kuenzer@neclab.eu=
> a
scris:

> Hi Daniel,
>
> please send the Reviewed-by tag only when you accept the patch. You did
> not accept it, right?
>
> Thanks,
>
> Simon
>
> On 03.12.20 11:15, Daniel Dinca wrote:
> > This should use the UK_SYSCALL_R_DEFINE macro, with the new
> >
> > updated version it should support __unused so no warning will appear.
> >
> >
> > Reviewed-by: Daniel Dinca <dincadaniel97@gmail.com>
> >
> > On 17.07.2020 15:47, Constantin Raducanu wrote:
> >> Registers `gettimeofday` system call to syscall_shim library.
> >> In order to avoid the unused warning for the second parameter,
> >> I had to provide all three system call entry functions manually.
> >>
> >> Signed-off-by: Constantin Raducanu <raducanu.costi@gmail.com>
> >> ---
> >>   lib/uktime/Makefile.uk   |  2 ++
> >>   lib/uktime/exportsyms.uk |  2 ++
> >>   lib/uktime/time.c        | 32 +++++++++++++++++++++++++++-----
> >>   3 files changed, 31 insertions(+), 5 deletions(-)
> >>
> >> diff --git a/lib/uktime/Makefile.uk b/lib/uktime/Makefile.uk
> >> index 2976a10..4fdf282 100644
> >> --- a/lib/uktime/Makefile.uk
> >> +++ b/lib/uktime/Makefile.uk
> >> @@ -12,3 +12,5 @@ LIBUKTIME_SRCS-y +=3D
> >> $(LIBUKTIME_BASE)/musl-imported/src/__tm_to_secs.c
> >>   LIBUKTIME_SRCS-y +=3D
> >> $(LIBUKTIME_BASE)/musl-imported/src/__year_to_secs.c
> >>   LIBUKTIME_SRCS-y +=3D $(LIBUKTIME_BASE)/time.c
> >>   LIBUKTIME_SRCS-y +=3D $(LIBUKTIME_BASE)/timer.c
> >> +
> >> +UK_PROVIDED_SYSCALLS-$(CONFIG_LIBUKTIME) +=3D gettimeofday-2
> >> \ No newline at end of file
> >> diff --git a/lib/uktime/exportsyms.uk b/lib/uktime/exportsyms.uk
> >> index 82b70b7..90ad7f9 100644
> >> --- a/lib/uktime/exportsyms.uk
> >> +++ b/lib/uktime/exportsyms.uk
> >> @@ -2,6 +2,8 @@ clock_getres
> >>   clock_gettime
> >>   clock_settime
> >>   gettimeofday
> >> +uk_syscall_e_gettimeofday
> >> +uk_syscall_r_gettimeofday
> >>   nanosleep
> >>   setitimer
> >>   sleep
> >> diff --git a/lib/uktime/time.c b/lib/uktime/time.c
> >> index 4d3ba53..e45b6f4 100644
> >> --- a/lib/uktime/time.c
> >> +++ b/lib/uktime/time.c
> >> @@ -43,6 +43,8 @@
> >>   #include <uk/plat/time.h>
> >>   #include <uk/config.h>
> >>   #include <uk/print.h>
> >> +#include <uk/syscall.h>
> >> +
> >>   #if CONFIG_HAVE_SCHED
> >>   #include <uk/sched.h>
> >>   #else
> >> @@ -125,20 +127,40 @@ unsigned int sleep(unsigned int seconds)
> >>       return 0;
> >>   }
> >> -int gettimeofday(struct timeval *tv, void *tz __unused)
> >> +long uk_syscall_r_gettimeofday(long tv, long tz __unused)
> >>   {
> >>       __nsec now =3D ukplat_wall_clock();
> >>       if (!tv) {
> >> -        errno =3D EINVAL;
> >> -        return -1;
> >> +        return -EINVAL;
> >>       }
> >> -    tv->tv_sec =3D ukarch_time_nsec_to_sec(now);
> >> -    tv->tv_usec =3D ukarch_time_nsec_to_usec(ukarch_time_subsec(now))=
;
> >> +    ((struct timeval*) tv)->tv_sec =3D ukarch_time_nsec_to_sec(now);
> >> +    ((struct timeval*) tv)->tv_usec =3D
> >> +        ukarch_time_nsec_to_usec(ukarch_time_subsec(now));
> >> +
> >>       return 0;
> >>   }
> >> +long uk_syscall_e_gettimeofday(long tv, long tz __unused)
> >> +{
> >> +    long ret;
> >> +
> >> +    ret =3D uk_syscall_r_gettimeofday(tv, tz);
> >> +    if (ret < 0) {
> >> +        errno =3D (int) -ret;
> >> +        return -1;
> >> +    }
> >> +    return 0;
> >> +}
> >> +
> >> +#if !UK_LIBC_SYSCALL
> >> +int gettimeofday (struct timeval* tv, void* tz __unused)
> >> +{
> >> +    return uk_syscall_e_gettimeofday((long) tv, (long)tz);
> >> +}
> >> +#endif
> >> +
> >>   int clock_getres(clockid_t clk_id __unused, struct timespec *res
> >> __unused)
> >>   {
> >>       return 0;
> >>
>

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

<div dir=3D"ltr"><div>Hi Simon,</div><div><br></div>Yes, I did not accept t=
his.<div><br></div><div>Thanks,</div><div>Daniel</div></div><br><div class=
=3D"gmail_quote"><div dir=3D"ltr" class=3D"gmail_attr">=C3=8En vin., 18 dec=
. 2020 la 20:20, Simon Kuenzer &lt;<a href=3D"mailto:simon.kuenzer@neclab.e=
u">simon.kuenzer@neclab.eu</a>&gt; a scris:<br></div><blockquote class=3D"g=
mail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204=
,204,204);padding-left:1ex">Hi Daniel,<br>
<br>
please send the Reviewed-by tag only when you accept the patch. You did <br=
>
not accept it, right?<br>
<br>
Thanks,<br>
<br>
Simon<br>
<br>
On 03.12.20 11:15, Daniel Dinca wrote:<br>
&gt; This should use the UK_SYSCALL_R_DEFINE macro, with the new<br>
&gt; <br>
&gt; updated version it should support __unused so no warning will appear.<=
br>
&gt; <br>
&gt; <br>
&gt; Reviewed-by: Daniel Dinca &lt;<a href=3D"mailto:dincadaniel97@gmail.co=
m" target=3D"_blank">dincadaniel97@gmail.com</a>&gt;<br>
&gt; <br>
&gt; On 17.07.2020 15:47, Constantin Raducanu wrote:<br>
&gt;&gt; Registers `gettimeofday` system call to syscall_shim library.<br>
&gt;&gt; In order to avoid the unused warning for the second parameter,<br>
&gt;&gt; I had to provide all three system call entry functions manually.<b=
r>
&gt;&gt;<br>
&gt;&gt; Signed-off-by: Constantin Raducanu &lt;<a href=3D"mailto:raducanu.=
costi@gmail.com" target=3D"_blank">raducanu.costi@gmail.com</a>&gt;<br>
&gt;&gt; ---<br>
&gt;&gt; =C2=A0 lib/uktime/Makefile.uk=C2=A0=C2=A0 |=C2=A0 2 ++<br>
&gt;&gt; =C2=A0 lib/uktime/<a href=3D"http://exportsyms.uk" rel=3D"noreferr=
er" target=3D"_blank">exportsyms.uk</a> |=C2=A0 2 ++<br>
&gt;&gt; =C2=A0 lib/uktime/time.c=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=
 | 32 +++++++++++++++++++++++++++-----<br>
&gt;&gt; =C2=A0 3 files changed, 31 insertions(+), 5 deletions(-)<br>
&gt;&gt;<br>
&gt;&gt; diff --git a/lib/uktime/Makefile.uk b/lib/uktime/Makefile.uk<br>
&gt;&gt; index 2976a10..4fdf282 100644<br>
&gt;&gt; --- a/lib/uktime/Makefile.uk<br>
&gt;&gt; +++ b/lib/uktime/Makefile.uk<br>
&gt;&gt; @@ -12,3 +12,5 @@ LIBUKTIME_SRCS-y +=3D <br>
&gt;&gt; $(LIBUKTIME_BASE)/musl-imported/src/__tm_to_secs.c<br>
&gt;&gt; =C2=A0 LIBUKTIME_SRCS-y +=3D <br>
&gt;&gt; $(LIBUKTIME_BASE)/musl-imported/src/__year_to_secs.c<br>
&gt;&gt; =C2=A0 LIBUKTIME_SRCS-y +=3D $(LIBUKTIME_BASE)/time.c<br>
&gt;&gt; =C2=A0 LIBUKTIME_SRCS-y +=3D $(LIBUKTIME_BASE)/timer.c<br>
&gt;&gt; +<br>
&gt;&gt; +UK_PROVIDED_SYSCALLS-$(CONFIG_LIBUKTIME) +=3D gettimeofday-2<br>
&gt;&gt; \ No newline at end of file<br>
&gt;&gt; diff --git a/lib/uktime/<a href=3D"http://exportsyms.uk" rel=3D"no=
referrer" target=3D"_blank">exportsyms.uk</a> b/lib/uktime/<a href=3D"http:=
//exportsyms.uk" rel=3D"noreferrer" target=3D"_blank">exportsyms.uk</a><br>
&gt;&gt; index 82b70b7..90ad7f9 100644<br>
&gt;&gt; --- a/lib/uktime/<a href=3D"http://exportsyms.uk" rel=3D"noreferre=
r" target=3D"_blank">exportsyms.uk</a><br>
&gt;&gt; +++ b/lib/uktime/<a href=3D"http://exportsyms.uk" rel=3D"noreferre=
r" target=3D"_blank">exportsyms.uk</a><br>
&gt;&gt; @@ -2,6 +2,8 @@ clock_getres<br>
&gt;&gt; =C2=A0 clock_gettime<br>
&gt;&gt; =C2=A0 clock_settime<br>
&gt;&gt; =C2=A0 gettimeofday<br>
&gt;&gt; +uk_syscall_e_gettimeofday<br>
&gt;&gt; +uk_syscall_r_gettimeofday<br>
&gt;&gt; =C2=A0 nanosleep<br>
&gt;&gt; =C2=A0 setitimer<br>
&gt;&gt; =C2=A0 sleep<br>
&gt;&gt; diff --git a/lib/uktime/time.c b/lib/uktime/time.c<br>
&gt;&gt; index 4d3ba53..e45b6f4 100644<br>
&gt;&gt; --- a/lib/uktime/time.c<br>
&gt;&gt; +++ b/lib/uktime/time.c<br>
&gt;&gt; @@ -43,6 +43,8 @@<br>
&gt;&gt; =C2=A0 #include &lt;uk/plat/time.h&gt;<br>
&gt;&gt; =C2=A0 #include &lt;uk/config.h&gt;<br>
&gt;&gt; =C2=A0 #include &lt;uk/print.h&gt;<br>
&gt;&gt; +#include &lt;uk/syscall.h&gt;<br>
&gt;&gt; +<br>
&gt;&gt; =C2=A0 #if CONFIG_HAVE_SCHED<br>
&gt;&gt; =C2=A0 #include &lt;uk/sched.h&gt;<br>
&gt;&gt; =C2=A0 #else<br>
&gt;&gt; @@ -125,20 +127,40 @@ unsigned int sleep(unsigned int seconds)<br>
&gt;&gt; =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 return 0;<br>
&gt;&gt; =C2=A0 }<br>
&gt;&gt; -int gettimeofday(struct timeval *tv, void *tz __unused)<br>
&gt;&gt; +long uk_syscall_r_gettimeofday(long tv, long tz __unused)<br>
&gt;&gt; =C2=A0 {<br>
&gt;&gt; =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 __nsec now =3D ukplat_wall_clock();=
<br>
&gt;&gt; =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 if (!tv) {<br>
&gt;&gt; -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 errno =3D EINVAL;<br>
&gt;&gt; -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 return -1;<br>
&gt;&gt; +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 return -EINVAL;<br>
&gt;&gt; =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 }<br>
&gt;&gt; -=C2=A0=C2=A0=C2=A0 tv-&gt;tv_sec =3D ukarch_time_nsec_to_sec(now)=
;<br>
&gt;&gt; -=C2=A0=C2=A0=C2=A0 tv-&gt;tv_usec =3D ukarch_time_nsec_to_usec(uk=
arch_time_subsec(now));<br>
&gt;&gt; +=C2=A0=C2=A0=C2=A0 ((struct timeval*) tv)-&gt;tv_sec =3D ukarch_t=
ime_nsec_to_sec(now);<br>
&gt;&gt; +=C2=A0=C2=A0=C2=A0 ((struct timeval*) tv)-&gt;tv_usec =3D<br>
&gt;&gt; +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 ukarch_time_nsec_to_us=
ec(ukarch_time_subsec(now));<br>
&gt;&gt; +<br>
&gt;&gt; =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 return 0;<br>
&gt;&gt; =C2=A0 }<br>
&gt;&gt; +long uk_syscall_e_gettimeofday(long tv, long tz __unused)<br>
&gt;&gt; +{<br>
&gt;&gt; +=C2=A0=C2=A0=C2=A0 long ret;<br>
&gt;&gt; +<br>
&gt;&gt; +=C2=A0=C2=A0=C2=A0 ret =3D uk_syscall_r_gettimeofday(tv, tz);<br>
&gt;&gt; +=C2=A0=C2=A0=C2=A0 if (ret &lt; 0) {<br>
&gt;&gt; +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 errno =3D (int) -ret;<=
br>
&gt;&gt; +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 return -1;<br>
&gt;&gt; +=C2=A0=C2=A0=C2=A0 }<br>
&gt;&gt; +=C2=A0=C2=A0=C2=A0 return 0;<br>
&gt;&gt; +}<br>
&gt;&gt; +<br>
&gt;&gt; +#if !UK_LIBC_SYSCALL<br>
&gt;&gt; +int gettimeofday (struct timeval* tv, void* tz __unused)<br>
&gt;&gt; +{<br>
&gt;&gt; +=C2=A0=C2=A0=C2=A0 return uk_syscall_e_gettimeofday((long) tv, (l=
ong)tz);<br>
&gt;&gt; +}<br>
&gt;&gt; +#endif<br>
&gt;&gt; +<br>
&gt;&gt; =C2=A0 int clock_getres(clockid_t clk_id __unused, struct timespec=
 *res <br>
&gt;&gt; __unused)<br>
&gt;&gt; =C2=A0 {<br>
&gt;&gt; =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 return 0;<br>
&gt;&gt;<br>
</blockquote></div>

--0000000000006bdb2c05b6f79a53--


From minios-devel-bounces@lists.xenproject.org Mon Dec 21 15:47:46 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Mon, 21 Dec 2020 15:47:46 +0000
Received: from list by lists.xenproject.org with outflank-mailman.57408.100426 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1krNPR-0002Vx-MC; Mon, 21 Dec 2020 15:47:41 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 57408.100426; Mon, 21 Dec 2020 15:47: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 1krNPR-0002Vq-JE; Mon, 21 Dec 2020 15:47:41 +0000
Received: by outflank-mailman (input) for mailman id 57408;
 Mon, 21 Dec 2020 15:47: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=PNDZ=FZ=neclab.eu=simon.kuenzer@srs-us1.protection.inumbo.net>)
 id 1krNPR-0002Vl-3f
 for minios-devel@lists.xen.org; Mon, 21 Dec 2020 15:47:41 +0000
Received: from mailer1.neclab.eu (unknown [195.37.70.40])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id c80775f2-11d2-497f-a8dd-ade35e3dbcf8;
 Mon, 21 Dec 2020 15:47:39 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
 by mailer1.neclab.eu (Postfix) with ESMTP id D845B103B06;
 Mon, 21 Dec 2020 16:47:37 +0100 (CET)
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 bCllu4K6gApQ; Mon, 21 Dec 2020 16:47:37 +0100 (CET)
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 B80BD1039C3
 for <minios-devel@lists.xen.org>; Mon, 21 Dec 2020 16:47:37 +0100 (CET)
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.2106.2; Mon, 21 Dec
 2020 16:47:37 +0100
X-BeenThere: minios-devel@lists.xenproject.org
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
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: c80775f2-11d2-497f-a8dd-ade35e3dbcf8
X-Virus-Scanned: Amavisd on Debian GNU/Linux (atlas-a.office.hd)
X-ENC: Last-Hop-TLS-encrypted
X-ENC: Last-Hop-TLS-encrypted
From: Simon Kuenzer <simon.kuenzer@neclab.eu>
To: <minios-devel@lists.xen.org>
CC: Simon Kuenzer <simon.kuenzer@neclab.eu>
Subject: [UNIKRAFT PATCH] lib/vfscore: Implement `getcwd` with a raw system call
Date: Mon, 21 Dec 2020 16:47:33 +0100
Message-ID: <20201221154733.8350-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: puck.office.hd (192.168.24.91) To puck.office.hd
 (192.168.24.91)

Implements `getcwd` with a raw system call (`UK_SYSCALL_R_DEFINE`) instead.
This variant should be preferred because it avoids the usage of `errno`.

Signed-off-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
---
 lib/vfscore/main.c | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/lib/vfscore/main.c b/lib/vfscore/main.c
index bd1fcea5e..a3d3a7440 100644
--- a/lib/vfscore/main.c
+++ b/lib/vfscore/main.c
@@ -1346,7 +1346,7 @@ UK_TRACEPOINT(trace_vfs_getcwd, "%p %d", char*, size_t);
 UK_TRACEPOINT(trace_vfs_getcwd_ret, "\"%s\"", const char*);
 UK_TRACEPOINT(trace_vfs_getcwd_err, "%d", int);
 
-UK_SYSCALL_DEFINE(char*, getcwd, char*, path, size_t, size)
+UK_SYSCALL_R_DEFINE(char*, getcwd, char*, path, size_t, size)
 {
 	trace_vfs_getcwd(path, size);
 	struct task *t = main_task;
@@ -1355,7 +1355,7 @@ UK_SYSCALL_DEFINE(char*, getcwd, char*, path, size_t, size)
 
 	if (size < len) {
 		error = ERANGE;
-		goto out_errno;
+		goto out_error;
 	}
 
 	if (!path) {
@@ -1364,12 +1364,12 @@ UK_SYSCALL_DEFINE(char*, getcwd, char*, path, size_t, size)
 		path = (char*)malloc(size);
 		if (!path) {
 			error = ENOMEM;
-			goto out_errno;
+			goto out_error;
 		}
 	} else {
 		if (!size) {
 			error = EINVAL;
-			goto out_errno;
+			goto out_error;
 		}
 	}
 
@@ -1377,10 +1377,9 @@ UK_SYSCALL_DEFINE(char*, getcwd, char*, path, size_t, size)
 	trace_vfs_getcwd_ret(path);
 	return path;
 
-	out_errno:
+out_error:
 	trace_vfs_getcwd_err(error);
-	errno = error;
-	return NULL;
+	return ERR2PTR(-error);
 }
 
 UK_TRACEPOINT(trace_vfs_dup, "%d", int);
-- 
2.20.1


From minios-devel-bounces@lists.xenproject.org Tue Dec 22 12:52:55 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Tue, 22 Dec 2020 12:52:55 +0000
Received: from list by lists.xenproject.org with outflank-mailman.57823.101348 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1krh9n-0007Mv-RH; Tue, 22 Dec 2020 12:52:51 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 57823.101348; Tue, 22 Dec 2020 12:52: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 1krh9n-0007Mm-O3; Tue, 22 Dec 2020 12:52:51 +0000
Received: by outflank-mailman (input) for mailman id 57823;
 Tue, 22 Dec 2020 12:52:50 +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=53M6=F2=neclab.eu=simon.kuenzer@srs-us1.protection.inumbo.net>)
 id 1krh9m-0007Mf-EL
 for minios-devel@lists.xen.org; Tue, 22 Dec 2020 12:52:50 +0000
Received: from mailer2.neclab.eu (unknown [195.37.70.41])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 1b6e0eaf-bfa9-45d5-9a48-c69836c95bba;
 Tue, 22 Dec 2020 12:52:48 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
 by mailer2.neclab.eu (Postfix) with ESMTP id 1746DF25A3;
 Tue, 22 Dec 2020 13:52:47 +0100 (CET)
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 c1nNMtfbmQJq; Tue, 22 Dec 2020 13:52:46 +0100 (CET)
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 E28EBF25A2;
 Tue, 22 Dec 2020 13:52:42 +0100 (CET)
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.2106.2; Tue, 22 Dec
 2020 13:52:42 +0100
X-BeenThere: minios-devel@lists.xenproject.org
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
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: 1b6e0eaf-bfa9-45d5-9a48-c69836c95bba
X-Virus-Scanned: Amavisd on Debian GNU/Linux (atlas-b.office.hd)
X-ENC: Last-Hop-TLS-encrypted
X-ENC: Last-Hop-TLS-encrypted
From: Simon Kuenzer <simon.kuenzer@neclab.eu>
To: <minios-devel@lists.xen.org>, <razvan.deaconescu@cs.pub.ro>
CC: Simon Kuenzer <simon.kuenzer@neclab.eu>
Subject: [UNIKRAFT PATCH v5 0/5] Memory Pools
Date: Tue, 22 Dec 2020 13:52:32 +0100
Message-ID: <20201222125237.29250-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: oberon.office.hd (192.168.24.90) To puck.office.hd
 (192.168.24.91)

This series implements a memory pool allocator. Pool objects have the same
size and are pre-allocated. Due to this simplification allocations and free
operations are as cheap as O(1). Its intended use is performance critical
allocations when allocation sizes do not vary, like network stacks or disk
buffer caches.

Changes since v4:
 - Fix interface descriptions in headers
 - Add a crash (UK_CRASH) as current workaround when free'ing a
   ukallocpool with `ukalloc` interface. The reason is that
   unregistering from ukalloc is not yet supported. Having a pool
   still registered to `ukalloc` although being freed will cause to
   use-after-free bugs.

 - Make each patch individually compile'able: There was an incorrect
   patch split introduced with v4

Changes since v3:
 - Remove functionality to let initialize objects by the pool.
   This should be implemented with a wrapping function instead and
   maybe less confusing when using the pool with the uk_alloc API.
 - Provide `uk_allocpool_objlen()`
 - Fix `uk_allocpool2ukalloc()`, the interface was not exported properly

Changes since v2:
 - Fix compile error when `CONFIG_LIBUKALLOC_IFSTATS` is activated

Changes since v1:
 - Correct license header in `pool.c`

Simon Kuenzer (5):
  lib/ukallocpool: Library skeleton
  lib/ukallocpool: LIFO pool implementation
  lib/ukallocpool: Allocate pool on parent allocator
  lib/ukallocpool: `lib/ukalloc` compatible interface
  lib/ukallocpool: Batched allocation

 lib/Makefile.uk                        |   1 +
 lib/ukallocpool/Config.uk              |   6 +
 lib/ukallocpool/Makefile.uk            |   6 +
 lib/ukallocpool/exportsyms.uk          |  11 +
 lib/ukallocpool/include/uk/allocpool.h | 206 ++++++++++++++
 lib/ukallocpool/pool.c                 | 354 +++++++++++++++++++++++++
 6 files changed, 584 insertions(+)
 create mode 100644 lib/ukallocpool/Config.uk
 create mode 100644 lib/ukallocpool/Makefile.uk
 create mode 100644 lib/ukallocpool/exportsyms.uk
 create mode 100644 lib/ukallocpool/include/uk/allocpool.h
 create mode 100644 lib/ukallocpool/pool.c

-- 
2.20.1


From minios-devel-bounces@lists.xenproject.org Tue Dec 22 12:52:55 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Tue, 22 Dec 2020 12:52:55 +0000
Received: from list by lists.xenproject.org with outflank-mailman.57824.101352 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1krh9r-0007Nb-Sk; Tue, 22 Dec 2020 12:52:55 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 57824.101352; Tue, 22 Dec 2020 12:52: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 1krh9r-0007NU-PX; Tue, 22 Dec 2020 12:52:55 +0000
Received: by outflank-mailman (input) for mailman id 57824;
 Tue, 22 Dec 2020 12:52: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=53M6=F2=neclab.eu=simon.kuenzer@srs-us1.protection.inumbo.net>)
 id 1krh9r-0007Mf-D3
 for minios-devel@lists.xen.org; Tue, 22 Dec 2020 12:52:55 +0000
Received: from mailer2.neclab.eu (unknown [195.37.70.41])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id b536fc89-3606-4a6f-96ad-48ec77944e84;
 Tue, 22 Dec 2020 12:52:52 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
 by mailer2.neclab.eu (Postfix) with ESMTP id 1FC43F25A3;
 Tue, 22 Dec 2020 13:52:51 +0100 (CET)
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 r5XnOW5Su3aJ; Tue, 22 Dec 2020 13:52:51 +0100 (CET)
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 EB1CDF25A2;
 Tue, 22 Dec 2020 13:52:46 +0100 (CET)
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.2106.2; Tue, 22 Dec
 2020 13:52:44 +0100
X-BeenThere: minios-devel@lists.xenproject.org
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
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: b536fc89-3606-4a6f-96ad-48ec77944e84
X-Virus-Scanned: Amavisd on Debian GNU/Linux (atlas-b.office.hd)
X-ENC: Last-Hop-TLS-encrypted
X-ENC: Last-Hop-TLS-encrypted
From: Simon Kuenzer <simon.kuenzer@neclab.eu>
To: <minios-devel@lists.xen.org>, <razvan.deaconescu@cs.pub.ro>
CC: Simon Kuenzer <simon.kuenzer@neclab.eu>
Subject: [UNIKRAFT PATCH v5 1/5] lib/ukallocpool: Library skeleton
Date: Tue, 22 Dec 2020 13:52:33 +0100
Message-ID: <20201222125237.29250-2-simon.kuenzer@neclab.eu>
X-Mailer: git-send-email 2.20.1
In-Reply-To: <20201222125237.29250-1-simon.kuenzer@neclab.eu>
References: <20201222125237.29250-1-simon.kuenzer@neclab.eu>
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)

Registers the library skeleton for ukallocpool.

Signed-off-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
---
 lib/Makefile.uk             | 1 +
 lib/ukallocpool/Config.uk   | 6 ++++++
 lib/ukallocpool/Makefile.uk | 4 ++++
 3 files changed, 11 insertions(+)
 create mode 100644 lib/ukallocpool/Config.uk
 create mode 100644 lib/ukallocpool/Makefile.uk

diff --git a/lib/Makefile.uk b/lib/Makefile.uk
index ff69dfab..7fffdac7 100644
--- a/lib/Makefile.uk
+++ b/lib/Makefile.uk
@@ -15,6 +15,7 @@ $(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))
 $(eval $(call _import_lib,$(CONFIG_UK_BASE)/lib/ukallocregion))
+$(eval $(call _import_lib,$(CONFIG_UK_BASE)/lib/ukallocpool))
 $(eval $(call _import_lib,$(CONFIG_UK_BASE)/lib/uksched))
 $(eval $(call _import_lib,$(CONFIG_UK_BASE)/lib/ukschedcoop))
 $(eval $(call _import_lib,$(CONFIG_UK_BASE)/lib/fdt))
diff --git a/lib/ukallocpool/Config.uk b/lib/ukallocpool/Config.uk
new file mode 100644
index 00000000..5c300117
--- /dev/null
+++ b/lib/ukallocpool/Config.uk
@@ -0,0 +1,6 @@
+config LIBUKALLOCPOOL
+	bool "ukallocpool: Memory pool allocator"
+	default n
+	select LIBNOLIBC if !HAVE_LIBC
+	select LIBUKDEBUG
+	select LIBUKALLOC
diff --git a/lib/ukallocpool/Makefile.uk b/lib/ukallocpool/Makefile.uk
new file mode 100644
index 00000000..c71c9764
--- /dev/null
+++ b/lib/ukallocpool/Makefile.uk
@@ -0,0 +1,4 @@
+$(eval $(call addlib_s,libukallocpool,$(CONFIG_LIBUKALLOCPOOL)))
+
+CINCLUDES-$(CONFIG_LIBUKALLOCPOOL)	+= -I$(LIBUKALLOCPOOL_BASE)/include
+CXXINCLUDES-$(CONFIG_LIBUKALLOCPOOL)	+= -I$(LIBUKALLOCPOOL_BASE)/include
-- 
2.20.1


From minios-devel-bounces@lists.xenproject.org Tue Dec 22 12:53:00 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Tue, 22 Dec 2020 12:53:00 +0000
Received: from list by lists.xenproject.org with outflank-mailman.57825.101356 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1krh9w-0007Od-UT; Tue, 22 Dec 2020 12:53:00 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 57825.101356; Tue, 22 Dec 2020 12: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 1krh9w-0007OW-RV; Tue, 22 Dec 2020 12:53:00 +0000
Received: by outflank-mailman (input) for mailman id 57825;
 Tue, 22 Dec 2020 12:53: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=53M6=F2=neclab.eu=simon.kuenzer@srs-us1.protection.inumbo.net>)
 id 1krh9w-0007Mf-DK
 for minios-devel@lists.xen.org; Tue, 22 Dec 2020 12:53:00 +0000
Received: from mailer2.neclab.eu (unknown [195.37.70.41])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 894854e7-95b0-4cf6-a9a8-15796a9d90f0;
 Tue, 22 Dec 2020 12:52:56 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
 by mailer2.neclab.eu (Postfix) with ESMTP id 33FDDF25A3;
 Tue, 22 Dec 2020 13:52:55 +0100 (CET)
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 i2U_4VJYZe3b; Tue, 22 Dec 2020 13:52:55 +0100 (CET)
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 03B3BF25A2;
 Tue, 22 Dec 2020 13:52:51 +0100 (CET)
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.2106.2; Tue, 22 Dec
 2020 13:52:45 +0100
X-BeenThere: minios-devel@lists.xenproject.org
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
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: 894854e7-95b0-4cf6-a9a8-15796a9d90f0
X-Virus-Scanned: Amavisd on Debian GNU/Linux (atlas-b.office.hd)
X-ENC: Last-Hop-TLS-encrypted
X-ENC: Last-Hop-TLS-encrypted
From: Simon Kuenzer <simon.kuenzer@neclab.eu>
To: <minios-devel@lists.xen.org>, <razvan.deaconescu@cs.pub.ro>
CC: Simon Kuenzer <simon.kuenzer@neclab.eu>
Subject: [UNIKRAFT PATCH v5 2/5] lib/ukallocpool: LIFO pool implementation
Date: Tue, 22 Dec 2020 13:52:34 +0100
Message-ID: <20201222125237.29250-3-simon.kuenzer@neclab.eu>
X-Mailer: git-send-email 2.20.1
In-Reply-To: <20201222125237.29250-1-simon.kuenzer@neclab.eu>
References: <20201222125237.29250-1-simon.kuenzer@neclab.eu>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
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)

Initial implementation of a memory pool (same-sized and fixed-sized object
allocator) following LIFO principle by using a single list to keep track of
free objects. LIFO is chosen to potentially better utilize hardware caches.

Signed-off-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
---
 lib/ukallocpool/Makefile.uk            |   2 +
 lib/ukallocpool/exportsyms.uk          |   5 +
 lib/ukallocpool/include/uk/allocpool.h | 113 +++++++++++++++
 lib/ukallocpool/pool.c                 | 186 +++++++++++++++++++++++++
 4 files changed, 306 insertions(+)
 create mode 100644 lib/ukallocpool/exportsyms.uk
 create mode 100644 lib/ukallocpool/include/uk/allocpool.h
 create mode 100644 lib/ukallocpool/pool.c

diff --git a/lib/ukallocpool/Makefile.uk b/lib/ukallocpool/Makefile.uk
index c71c9764..63c24dc1 100644
--- a/lib/ukallocpool/Makefile.uk
+++ b/lib/ukallocpool/Makefile.uk
@@ -2,3 +2,5 @@ $(eval $(call addlib_s,libukallocpool,$(CONFIG_LIBUKALLOCPOOL)))
 
 CINCLUDES-$(CONFIG_LIBUKALLOCPOOL)	+= -I$(LIBUKALLOCPOOL_BASE)/include
 CXXINCLUDES-$(CONFIG_LIBUKALLOCPOOL)	+= -I$(LIBUKALLOCPOOL_BASE)/include
+
+LIBUKALLOCPOOL_SRCS-y += $(LIBUKALLOCPOOL_BASE)/pool.c
diff --git a/lib/ukallocpool/exportsyms.uk b/lib/ukallocpool/exportsyms.uk
new file mode 100644
index 00000000..9d47d615
--- /dev/null
+++ b/lib/ukallocpool/exportsyms.uk
@@ -0,0 +1,5 @@
+uk_allocpool_init
+uk_allocpool_availcount
+uk_allocpool_objlen
+uk_allocpool_take
+uk_allocpool_return
diff --git a/lib/ukallocpool/include/uk/allocpool.h b/lib/ukallocpool/include/uk/allocpool.h
new file mode 100644
index 00000000..94f487de
--- /dev/null
+++ b/lib/ukallocpool/include/uk/allocpool.h
@@ -0,0 +1,113 @@
+/* SPDX-License-Identifier: BSD-3-Clause */
+/*
+ * Simple memory pool using LIFO principle
+ *
+ * Authors: Simon Kuenzer <simon.kuenzer@neclab.eu>
+ *
+ *
+ * Copyright (c) 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
+ * 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 __LIBUKALLOCPOOL_H__
+#define __LIBUKALLOCPOOL_H__
+
+#include <uk/alloc.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef void (*uk_allocpool_obj_init_t)(void *obj, size_t len, void *cookie);
+
+struct uk_allocpool;
+
+/**
+ * Initializes a memory pool on a given memory range.
+ *
+ * @param base
+ *  Base address of memory range.
+ * @param len
+ *  Length of memory range (bytes).
+ * @param obj_len
+ *  Size of one object (bytes).
+ * @param obj_align
+ *  Alignment requirement for each pool object.
+ * @return
+ *  - (NULL): Not enough memory for pool.
+ *  - pointer to initializes pool.
+ */
+struct uk_allocpool *uk_allocpool_init(void *base, size_t len,
+				       size_t obj_len, size_t obj_align);
+
+/**
+ * Return the number of current available (free) objects.
+ *
+ * @param p
+ *  Pointer to memory pool.
+ * @return
+ *  Number of free objects in the pool.
+ */
+unsigned int uk_allocpool_availcount(struct uk_allocpool *p);
+
+/**
+ * Return the size of an object.
+ *
+ * @param p
+ *  Pointer to memory pool.
+ * @return
+ *  Size of an object.
+ */
+size_t uk_allocpool_objlen(struct uk_allocpool *p);
+
+/**
+ * Get one object from a pool.
+ *
+ * @param p
+ *  Pointer to memory pool.
+ * @return
+ *  - (NULL): No more free objects available.
+ *  - Pointer to object.
+ */
+void *uk_allocpool_take(struct uk_allocpool *p);
+
+/**
+ * Return one object back to a pool.
+ *
+ * @param p
+ *  Pointer to memory pool.
+ * @param obj
+ *  Pointer to object that should be returned.
+ */
+void uk_allocpool_return(struct uk_allocpool *p, void *obj);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __LIBUKALLOCPOOL_H__ */
diff --git a/lib/ukallocpool/pool.c b/lib/ukallocpool/pool.c
new file mode 100644
index 00000000..b6839b68
--- /dev/null
+++ b/lib/ukallocpool/pool.c
@@ -0,0 +1,186 @@
+/* SPDX-License-Identifier: BSD-3-Clause */
+/*
+ * Simple memory pool using LIFO principle
+ *
+ * Authors: Simon Kuenzer <simon.kuenzer@neclab.eu>
+ *
+ *
+ * Copyright (c) 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
+ * 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/essentials.h>
+#include <uk/alloc_impl.h>
+#include <uk/allocpool.h>
+#include <uk/list.h>
+#include <string.h>
+#include <stddef.h>
+#include <stdint.h>
+#include <sys/types.h>
+#include <errno.h>
+
+/*
+ * POOL: MEMORY LAYOUT
+ *
+ *          ++---------------------++
+ *          || struct uk_allocpool ||
+ *          ||                     ||
+ *          ++---------------------++
+ *          |    // padding //      |
+ *          +=======================+
+ *          |       OBJECT 1        |
+ *          +=======================+
+ *          |       OBJECT 2        |
+ *          +=======================+
+ *          |       OBJECT 3        |
+ *          +=======================+
+ *          |         ...           |
+ *          v                       v
+ */
+
+#define MIN_OBJ_ALIGN sizeof(void *)
+#define MIN_OBJ_LEN   sizeof(struct uk_list_head)
+
+struct uk_allocpool {
+	struct uk_list_head free_obj;
+	unsigned int free_obj_count;
+
+	size_t obj_align;
+	size_t obj_len;
+	unsigned int obj_count;
+};
+
+struct free_obj {
+	struct uk_list_head list;
+};
+
+static inline void _prepend_free_obj(struct uk_allocpool *p, void *obj)
+{
+	struct uk_list_head *entry;
+
+	UK_ASSERT(p);
+	UK_ASSERT(obj);
+	UK_ASSERT(p->free_obj_count < p->obj_count);
+
+	entry = &((struct free_obj *) obj)->list;
+	uk_list_add(entry, &p->free_obj);
+	p->free_obj_count++;
+}
+
+static inline void *_take_free_obj(struct uk_allocpool *p)
+{
+	struct free_obj *obj;
+
+	UK_ASSERT(p);
+	UK_ASSERT(p->free_obj_count > 0);
+
+	/* get object from list head */
+	obj = uk_list_first_entry(&p->free_obj, struct free_obj, list);
+	uk_list_del(&obj->list);
+	p->free_obj_count--;
+	return (void *) obj;
+}
+
+void *uk_allocpool_take(struct uk_allocpool *p)
+{
+	UK_ASSERT(p);
+
+	if (unlikely(uk_list_empty(&p->free_obj)))
+		return NULL;
+
+	return _take_free_obj(p);
+}
+
+void uk_allocpool_return(struct uk_allocpool *p, void *obj)
+{
+	UK_ASSERT(p);
+
+	_prepend_free_obj(p, obj);
+}
+
+unsigned int uk_allocpool_availcount(struct uk_allocpool *p)
+{
+	return p->free_obj_count;
+}
+
+size_t uk_allocpool_objlen(struct uk_allocpool *p)
+{
+	return p->obj_len;
+}
+
+struct uk_allocpool *uk_allocpool_init(void *base, size_t len,
+				       size_t obj_len, size_t obj_align)
+{
+	struct uk_allocpool *p;
+	size_t obj_alen;
+	size_t left;
+	void *obj_ptr;
+
+	UK_ASSERT(POWER_OF_2(obj_align));
+
+	if (!base || sizeof(struct uk_allocpool) > len) {
+		errno = ENOSPC;
+		return NULL;
+	}
+
+	/* apply minimum requirements */
+	obj_len   = MAX(obj_len, MIN_OBJ_LEN);
+	obj_align = MAX(obj_align, MIN_OBJ_ALIGN);
+
+	p = (struct uk_allocpool *) base;
+	memset(p, 0, sizeof(*p));
+
+	obj_alen = ALIGN_UP(obj_len, obj_align);
+	obj_ptr = (void *) ALIGN_UP((uintptr_t) base + sizeof(*p),
+				    obj_align);
+	if ((uintptr_t) obj_ptr > (uintptr_t) base + len) {
+		uk_pr_debug("%p: Empty pool: Not enough space for allocating objects\n",
+			    p);
+		goto out;
+	}
+
+	left = len - ((uintptr_t) obj_ptr - (uintptr_t) base);
+
+	p->obj_count = 0;
+	p->free_obj_count = 0;
+	UK_INIT_LIST_HEAD(&p->free_obj);
+	while (left >= obj_alen) {
+		++p->obj_count;
+		_prepend_free_obj(p, obj_ptr);
+		obj_ptr = (void *) ((uintptr_t) obj_ptr + obj_alen);
+		left -= obj_alen;
+	}
+
+out:
+	p->obj_len         = obj_alen;
+	p->obj_align       = obj_align;
+
+	uk_pr_debug("%p: Pool created (%"__PRIsz" B): %u objs of %"__PRIsz" B, aligned to %"__PRIsz" B\n",
+		    p, len, p->obj_count, p->obj_len, p->obj_align);
+	return p;
+}
-- 
2.20.1


From minios-devel-bounces@lists.xenproject.org Tue Dec 22 12:53:03 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Tue, 22 Dec 2020 12:53:03 +0000
Received: from list by lists.xenproject.org with outflank-mailman.57826.101359 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1krh9y-0007PV-W3; Tue, 22 Dec 2020 12:53:02 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 57826.101359; Tue, 22 Dec 2020 12:53: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 1krh9y-0007PO-T5; Tue, 22 Dec 2020 12:53:02 +0000
Received: by outflank-mailman (input) for mailman id 57826;
 Tue, 22 Dec 2020 12:53: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=53M6=F2=neclab.eu=simon.kuenzer@srs-us1.protection.inumbo.net>)
 id 1krh9y-0007PF-Ap
 for minios-devel@lists.xen.org; Tue, 22 Dec 2020 12:53:02 +0000
Received: from mailer2.neclab.eu (unknown [195.37.70.41])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 4b724cd4-c556-4d35-b4bb-f44246c42ebe;
 Tue, 22 Dec 2020 12:53:00 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
 by mailer2.neclab.eu (Postfix) with ESMTP id 3F514F25A3;
 Tue, 22 Dec 2020 13:52:59 +0100 (CET)
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 XTh8rztf1W3M; Tue, 22 Dec 2020 13:52:59 +0100 (CET)
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 0E97EF25A2;
 Tue, 22 Dec 2020 13:52:55 +0100 (CET)
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.2106.2; Tue, 22 Dec
 2020 13:52:46 +0100
X-BeenThere: minios-devel@lists.xenproject.org
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
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: 4b724cd4-c556-4d35-b4bb-f44246c42ebe
X-Virus-Scanned: Amavisd on Debian GNU/Linux (atlas-b.office.hd)
X-ENC: Last-Hop-TLS-encrypted
X-ENC: Last-Hop-TLS-encrypted
From: Simon Kuenzer <simon.kuenzer@neclab.eu>
To: <minios-devel@lists.xen.org>, <razvan.deaconescu@cs.pub.ro>
CC: Simon Kuenzer <simon.kuenzer@neclab.eu>
Subject: [UNIKRAFT PATCH v5 3/5] lib/ukallocpool: Allocate pool on parent allocator
Date: Tue, 22 Dec 2020 13:52:35 +0100
Message-ID: <20201222125237.29250-4-simon.kuenzer@neclab.eu>
X-Mailer: git-send-email 2.20.1
In-Reply-To: <20201222125237.29250-1-simon.kuenzer@neclab.eu>
References: <20201222125237.29250-1-simon.kuenzer@neclab.eu>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Content-Type: text/plain
X-Originating-IP: [192.168.24.96]
X-ClientProxiedBy: oberon.office.hd (192.168.24.90) To puck.office.hd
 (192.168.24.91)

Provides a function that allocates and initializes a pool on a
given parent allocator.

Signed-off-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
---
 lib/ukallocpool/exportsyms.uk          |  3 ++
 lib/ukallocpool/include/uk/allocpool.h | 47 ++++++++++++++++++++
 lib/ukallocpool/pool.c                 | 59 ++++++++++++++++++++++++++
 3 files changed, 109 insertions(+)

diff --git a/lib/ukallocpool/exportsyms.uk b/lib/ukallocpool/exportsyms.uk
index 9d47d615..0bd38595 100644
--- a/lib/ukallocpool/exportsyms.uk
+++ b/lib/ukallocpool/exportsyms.uk
@@ -1,4 +1,7 @@
+uk_allocpool_alloc
+uk_allocpool_free
 uk_allocpool_init
+uk_allocpool_reqmem
 uk_allocpool_availcount
 uk_allocpool_objlen
 uk_allocpool_take
diff --git a/lib/ukallocpool/include/uk/allocpool.h b/lib/ukallocpool/include/uk/allocpool.h
index 94f487de..c2ce31f0 100644
--- a/lib/ukallocpool/include/uk/allocpool.h
+++ b/lib/ukallocpool/include/uk/allocpool.h
@@ -47,6 +47,53 @@ typedef void (*uk_allocpool_obj_init_t)(void *obj, size_t len, void *cookie);
 
 struct uk_allocpool;
 
+/**
+ * Computes the required memory for a pool allocation.
+ *
+ * @param obj_count
+ *  Number of objects that are allocated with the pool.
+ * @param obj_len
+ *  Size of one object (bytes).
+ * @param obj_align
+ *  Alignment requirement for each pool object.
+ * @return
+ *  Number of bytes needed for pool allocation.
+ */
+size_t uk_allocpool_reqmem(unsigned int obj_count, size_t obj_len,
+			   size_t obj_align);
+
+/**
+ * Allocates a memory pool on a parent allocator.
+ *
+ * @param parent
+ *  Allocator on which the pool will be allocated.
+ * @param obj_count
+ *  Number of objects that are allocated with the pool.
+ * @param obj_len
+ *  Size of one object (bytes).
+ * @param obj_align
+ *  Alignment requirement for each pool object.
+ * @return
+ *  - (NULL): If allocation failed (e.g., ENOMEM).
+ *  - pointer to allocated pool.
+ */
+struct uk_allocpool *uk_allocpool_alloc(struct uk_alloc *parent,
+					unsigned int obj_count,
+					size_t obj_len, size_t obj_align);
+
+/**
+ * Frees a memory pool that was allocated with
+ * uk_allocpool_alloc(). The memory is returned to
+ * the parent allocator.
+ * Note: Please make sure that all taken objects
+ * are returned to the pool before free'ing the
+ * pool.
+ *
+ * @param p
+ *  Pointer to memory pool that will be free'd.
+ */
+void uk_allocpool_free(struct uk_allocpool *p);
+
 /**
  * Initializes a memory pool on a given memory range.
  *
diff --git a/lib/ukallocpool/pool.c b/lib/ukallocpool/pool.c
index b6839b68..0b794d85 100644
--- a/lib/ukallocpool/pool.c
+++ b/lib/ukallocpool/pool.c
@@ -73,6 +73,9 @@ struct uk_allocpool {
 	size_t obj_align;
 	size_t obj_len;
 	unsigned int obj_count;
+
+	struct uk_alloc *parent;
+	void *base;
 };
 
 struct free_obj {
@@ -123,6 +126,21 @@ void uk_allocpool_return(struct uk_allocpool *p, void *obj)
 	_prepend_free_obj(p, obj);
 }
 
+size_t uk_allocpool_reqmem(unsigned int obj_count, size_t obj_len,
+			   size_t obj_align)
+{
+	size_t obj_alen;
+
+	UK_ASSERT(POWER_OF_2(obj_align));
+
+	obj_len   = MAX(obj_len, MIN_OBJ_LEN);
+	obj_align = MAX(obj_align, MIN_OBJ_ALIGN);
+	obj_alen  = ALIGN_UP(obj_len, obj_align);
+	return (sizeof(struct uk_allocpool)
+		+ obj_align
+		+ ((size_t) obj_count * obj_alen));
+}
+
 unsigned int uk_allocpool_availcount(struct uk_allocpool *p)
 {
 	return p->free_obj_count;
@@ -179,8 +197,49 @@ struct uk_allocpool *uk_allocpool_init(void *base, size_t len,
 out:
 	p->obj_len         = obj_alen;
 	p->obj_align       = obj_align;
+	p->base            = base;
+	p->parent          = NULL;
 
 	uk_pr_debug("%p: Pool created (%"__PRIsz" B): %u objs of %"__PRIsz" B, aligned to %"__PRIsz" B\n",
 		    p, len, p->obj_count, p->obj_len, p->obj_align);
 	return p;
 }
+
+struct uk_allocpool *uk_allocpool_alloc(struct uk_alloc *parent,
+					unsigned int obj_count,
+					size_t obj_len, size_t obj_align)
+{
+	struct uk_allocpool *p;
+	void *base;
+	size_t len;
+
+	/* uk_allocpool_reqmem computes minimum requirement */
+	len = uk_allocpool_reqmem(obj_count, obj_len, obj_align);
+	base = uk_malloc(parent, len);
+	if (!base)
+		return NULL;
+
+	p = uk_allocpool_init(base, len, obj_len, obj_align);
+	if (!p) {
+		uk_free(parent, base);
+		errno = ENOSPC;
+		return NULL;
+	}
+
+	p->parent = parent;
+	return p;
+}
+
+void uk_allocpool_free(struct uk_allocpool *p)
+{
+	/* If we do not have a parent, this pool was created with
+	 * uk_allocpool_init(). Such a pool cannot be free'd with
+	 * this function since we are not the owner of the allocation
+	 */
+	UK_ASSERT(p->parent);
+
+	/* Make sure we got all objects back */
+	UK_ASSERT(p->free_obj_count == p->obj_count);
+
+	uk_free(p->parent, p->base);
+}
-- 
2.20.1


From minios-devel-bounces@lists.xenproject.org Tue Dec 22 12:53:07 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Tue, 22 Dec 2020 12:53:07 +0000
Received: from list by lists.xenproject.org with outflank-mailman.57827.101363 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1krhA3-0007R0-2B; Tue, 22 Dec 2020 12:53:07 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 57827.101363; Tue, 22 Dec 2020 12:53: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 1krhA2-0007Qt-VX; Tue, 22 Dec 2020 12:53:06 +0000
Received: by outflank-mailman (input) for mailman id 57827;
 Tue, 22 Dec 2020 12:53: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=53M6=F2=neclab.eu=simon.kuenzer@srs-us1.protection.inumbo.net>)
 id 1krhA2-0007Qe-22
 for minios-devel@lists.xen.org; Tue, 22 Dec 2020 12:53:06 +0000
Received: from mailer2.neclab.eu (unknown [195.37.70.41])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 8ba8a764-2559-41d9-a6be-72c62c20d900;
 Tue, 22 Dec 2020 12:53:04 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
 by mailer2.neclab.eu (Postfix) with ESMTP id 4E722F25A3;
 Tue, 22 Dec 2020 13:53:03 +0100 (CET)
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 Cdffp2QCH8-X; Tue, 22 Dec 2020 13:53:03 +0100 (CET)
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 1A8CBF25A2;
 Tue, 22 Dec 2020 13:52:59 +0100 (CET)
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.2106.2; Tue, 22 Dec
 2020 13:52:48 +0100
X-BeenThere: minios-devel@lists.xenproject.org
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
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: 8ba8a764-2559-41d9-a6be-72c62c20d900
X-Virus-Scanned: Amavisd on Debian GNU/Linux (atlas-b.office.hd)
X-ENC: Last-Hop-TLS-encrypted
X-ENC: Last-Hop-TLS-encrypted
From: Simon Kuenzer <simon.kuenzer@neclab.eu>
To: <minios-devel@lists.xen.org>, <razvan.deaconescu@cs.pub.ro>
CC: Simon Kuenzer <simon.kuenzer@neclab.eu>
Subject: [UNIKRAFT PATCH v5 4/5] lib/ukallocpool: `lib/ukalloc` compatible interface
Date: Tue, 22 Dec 2020 13:52:36 +0100
Message-ID: <20201222125237.29250-5-simon.kuenzer@neclab.eu>
X-Mailer: git-send-email 2.20.1
In-Reply-To: <20201222125237.29250-1-simon.kuenzer@neclab.eu>
References: <20201222125237.29250-1-simon.kuenzer@neclab.eu>
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)

Provide a ukalloc compatible interface. This enables the usage of pools
with common allocator interfaces, like `uk_malloc()`, `uk_free()`,
and `uk_memalign()`.

Signed-off-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
---
 lib/ukallocpool/exportsyms.uk          |  1 +
 lib/ukallocpool/include/uk/allocpool.h | 16 ++++++
 lib/ukallocpool/pool.c                 | 80 ++++++++++++++++++++++++++
 3 files changed, 97 insertions(+)

diff --git a/lib/ukallocpool/exportsyms.uk b/lib/ukallocpool/exportsyms.uk
index 0bd38595..68c16ebe 100644
--- a/lib/ukallocpool/exportsyms.uk
+++ b/lib/ukallocpool/exportsyms.uk
@@ -6,3 +6,4 @@ uk_allocpool_availcount
 uk_allocpool_objlen
 uk_allocpool_take
 uk_allocpool_return
+uk_allocpool2ukalloc
diff --git a/lib/ukallocpool/include/uk/allocpool.h b/lib/ukallocpool/include/uk/allocpool.h
index c2ce31f0..1f6747f1 100644
--- a/lib/ukallocpool/include/uk/allocpool.h
+++ b/lib/ukallocpool/include/uk/allocpool.h
@@ -112,6 +112,18 @@ void uk_allocpool_free(struct uk_allocpool *p);
 struct uk_allocpool *uk_allocpool_init(void *base, size_t len,
 				       size_t obj_len, size_t obj_align);
 
+/**
+ * Return uk_alloc compatible interface for allocpool.
+ * With this interface, uk_malloc(), uk_free(), etc. can
+ * be used with the pool.
+ *
+ * @param p
+ *  Pointer to memory pool.
+ * @return
+ *  Pointer to uk_alloc interface of given pool.
+ */
+struct uk_alloc *uk_allocpool2ukalloc(struct uk_allocpool *p);
+
 /**
  * Return the number of current available (free) objects.
  *
@@ -134,6 +146,8 @@ size_t uk_allocpool_objlen(struct uk_allocpool *p);
 
 /**
  * Get one object from a pool.
+ * HINT: It is recommended to use this call instead of uk_malloc() whenever
+ *       feasible. This call is avoiding indirections.
  *
  * @param p
  *  Pointer to memory pool.
@@ -145,6 +159,8 @@ void *uk_allocpool_take(struct uk_allocpool *p);
 
 /**
  * Return one object back to a pool.
+ * HINT: It is recommended to use this call instead of uk_free() whenever
+ *       feasible. This call is avoiding indirections.
  *
  * @param p
  *  Pointer to memory pool.
diff --git a/lib/ukallocpool/pool.c b/lib/ukallocpool/pool.c
index 0b794d85..a7c3acf0 100644
--- a/lib/ukallocpool/pool.c
+++ b/lib/ukallocpool/pool.c
@@ -67,6 +67,8 @@
 #define MIN_OBJ_LEN   sizeof(struct uk_list_head)
 
 struct uk_allocpool {
+	struct uk_alloc self;
+
 	struct uk_list_head free_obj;
 	unsigned int free_obj_count;
 
@@ -82,6 +84,21 @@ struct free_obj {
 	struct uk_list_head list;
 };
 
+static inline struct uk_allocpool *ukalloc2pool(struct uk_alloc *a)
+{
+	UK_ASSERT(a);
+	return __containerof(a, struct uk_allocpool, self);
+}
+
+#define allocpool2ukalloc(p) \
+	(&(p)->self)
+
+struct uk_alloc *uk_allocpool2ukalloc(struct uk_allocpool *p)
+{
+	UK_ASSERT(p);
+	return allocpool2ukalloc(p);
+}
+
 static inline void _prepend_free_obj(struct uk_allocpool *p, void *obj)
 {
 	struct uk_list_head *entry;
@@ -109,6 +126,42 @@ static inline void *_take_free_obj(struct uk_allocpool *p)
 	return (void *) obj;
 }
 
+static void pool_free(struct uk_alloc *a, void *ptr)
+{
+	struct uk_allocpool *p = ukalloc2pool(a);
+
+	if (likely(ptr))
+		_prepend_free_obj(p, ptr);
+}
+
+static void *pool_malloc(struct uk_alloc *a, size_t size)
+{
+	struct uk_allocpool *p = ukalloc2pool(a);
+
+	if (unlikely((size > p->obj_len)
+		     || uk_list_empty(&p->free_obj))) {
+		errno = ENOMEM;
+		return NULL;
+	}
+
+	return _take_free_obj(p);
+}
+
+static int pool_posix_memalign(struct uk_alloc *a, void **memptr, size_t align,
+				size_t size)
+{
+	struct uk_allocpool *p = ukalloc2pool(a);
+
+	if (unlikely((size > p->obj_len)
+		     || (align > p->obj_align)
+		     || uk_list_empty(&p->free_obj))) {
+		return ENOMEM;
+	}
+
+	*memptr = _take_free_obj(p);
+	return 0;
+}
+
 void *uk_allocpool_take(struct uk_allocpool *p)
 {
 	UK_ASSERT(p);
@@ -126,6 +179,15 @@ void uk_allocpool_return(struct uk_allocpool *p, void *obj)
 	_prepend_free_obj(p, obj);
 }
 
+#if CONFIG_LIBUKALLOC_IFSTATS
+static ssize_t pool_availmem(struct uk_alloc *a)
+{
+	struct uk_allocpool *p = ukalloc2pool(a);
+
+	return (size_t) p->free_obj_count * p->obj_len;
+}
+#endif
+
 size_t uk_allocpool_reqmem(unsigned int obj_count, size_t obj_len,
 			   size_t obj_align)
 {
@@ -155,6 +217,7 @@ struct uk_allocpool *uk_allocpool_init(void *base, size_t len,
 				       size_t obj_len, size_t obj_align)
 {
 	struct uk_allocpool *p;
+	struct uk_alloc *a;
 	size_t obj_alen;
 	size_t left;
 	void *obj_ptr;
@@ -172,6 +235,7 @@ struct uk_allocpool *uk_allocpool_init(void *base, size_t len,
 
 	p = (struct uk_allocpool *) base;
 	memset(p, 0, sizeof(*p));
+	a = allocpool2ukalloc(p);
 
 	obj_alen = ALIGN_UP(obj_len, obj_align);
 	obj_ptr = (void *) ALIGN_UP((uintptr_t) base + sizeof(*p),
@@ -200,6 +264,18 @@ out:
 	p->base            = base;
 	p->parent          = NULL;
 
+	uk_alloc_init_malloc(a,
+			     pool_malloc,
+			     uk_calloc_compat,
+			     uk_realloc_compat,
+			     pool_free,
+			     pool_posix_memalign,
+			     uk_memalign_compat,
+			     NULL);
+#if CONFIG_LIBUKALLOC_IFSTATS
+	p->self.availmem = pool_availmem;
+#endif
+
 	uk_pr_debug("%p: Pool created (%"__PRIsz" B): %u objs of %"__PRIsz" B, aligned to %"__PRIsz" B\n",
 		    p, len, p->obj_count, p->obj_len, p->obj_align);
 	return p;
@@ -241,5 +317,9 @@ void uk_allocpool_free(struct uk_allocpool *p)
 	/* Make sure we got all objects back */
 	UK_ASSERT(p->free_obj_count == p->obj_count);
 
+	/* FIXME: Unregister `ukalloc` interface from `lib/ukalloc` */
+	/* TODO: Provide unregistration interface at `lib/ukalloc` */
+	UK_CRASH("Unregistering from `lib/ukalloc` not implemented.\n");
+
 	uk_free(p->parent, p->base);
 }
-- 
2.20.1


From minios-devel-bounces@lists.xenproject.org Tue Dec 22 12:53:11 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Tue, 22 Dec 2020 12:53:11 +0000
Received: from list by lists.xenproject.org with outflank-mailman.57828.101367 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1krhA7-0007S6-3v; Tue, 22 Dec 2020 12:53:11 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 57828.101367; Tue, 22 Dec 2020 12:53: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 1krhA7-0007Rz-0q; Tue, 22 Dec 2020 12:53:11 +0000
Received: by outflank-mailman (input) for mailman id 57828;
 Tue, 22 Dec 2020 12:53: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=53M6=F2=neclab.eu=simon.kuenzer@srs-us1.protection.inumbo.net>)
 id 1krhA6-0007Qe-FG
 for minios-devel@lists.xen.org; Tue, 22 Dec 2020 12:53:10 +0000
Received: from mailer2.neclab.eu (unknown [195.37.70.41])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id b0750f71-c8a2-4dfc-a9fe-c6752f8954fe;
 Tue, 22 Dec 2020 12:53:08 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
 by mailer2.neclab.eu (Postfix) with ESMTP id 4FD3EF25A3;
 Tue, 22 Dec 2020 13:53:07 +0100 (CET)
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 vVwkceQ8X4Pe; Tue, 22 Dec 2020 13:53:07 +0100 (CET)
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 27847F25A2;
 Tue, 22 Dec 2020 13:53:03 +0100 (CET)
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.2106.2; Tue, 22 Dec
 2020 13:52:49 +0100
X-BeenThere: minios-devel@lists.xenproject.org
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
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: b0750f71-c8a2-4dfc-a9fe-c6752f8954fe
X-Virus-Scanned: Amavisd on Debian GNU/Linux (atlas-b.office.hd)
X-ENC: Last-Hop-TLS-encrypted
X-ENC: Last-Hop-TLS-encrypted
From: Simon Kuenzer <simon.kuenzer@neclab.eu>
To: <minios-devel@lists.xen.org>, <razvan.deaconescu@cs.pub.ro>
CC: Simon Kuenzer <simon.kuenzer@neclab.eu>
Subject: [UNIKRAFT PATCH v5 5/5] lib/ukallocpool: Batched allocation
Date: Tue, 22 Dec 2020 13:52:37 +0100
Message-ID: <20201222125237.29250-6-simon.kuenzer@neclab.eu>
X-Mailer: git-send-email 2.20.1
In-Reply-To: <20201222125237.29250-1-simon.kuenzer@neclab.eu>
References: <20201222125237.29250-1-simon.kuenzer@neclab.eu>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
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)

Introduce low-overhead interfaces for batched allocations and batched
freeing of objects.

Signed-off-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
---
 lib/ukallocpool/exportsyms.uk          |  2 ++
 lib/ukallocpool/include/uk/allocpool.h | 30 ++++++++++++++++++++++++++
 lib/ukallocpool/pool.c                 | 29 +++++++++++++++++++++++++
 3 files changed, 61 insertions(+)

diff --git a/lib/ukallocpool/exportsyms.uk b/lib/ukallocpool/exportsyms.uk
index 68c16ebe..0f4c3de4 100644
--- a/lib/ukallocpool/exportsyms.uk
+++ b/lib/ukallocpool/exportsyms.uk
@@ -5,5 +5,7 @@ uk_allocpool_reqmem
 uk_allocpool_availcount
 uk_allocpool_objlen
 uk_allocpool_take
+uk_allocpool_take_batch
 uk_allocpool_return
+uk_allocpool_return_batch
 uk_allocpool2ukalloc
diff --git a/lib/ukallocpool/include/uk/allocpool.h b/lib/ukallocpool/include/uk/allocpool.h
index 1f6747f1..55bccb86 100644
--- a/lib/ukallocpool/include/uk/allocpool.h
+++ b/lib/ukallocpool/include/uk/allocpool.h
@@ -157,6 +157,22 @@ size_t uk_allocpool_objlen(struct uk_allocpool *p);
  */
 void *uk_allocpool_take(struct uk_allocpool *p);
 
+/**
+ * Get multiple objects from a pool.
+ *
+ * @param p
+ *  Pointer to memory pool.
+ * @param obj
+ *  Pointer to array that will be filled with pointers of
+ *  allocated objects from the pool.
+ * @param count
+ *  Maximum number of objects that should be taken from the pool.
+ * @return
+ *  Number of successfully allocated objects on the given array.
+ */
+unsigned int uk_allocpool_take_batch(struct uk_allocpool *p,
+				     void *obj[], unsigned int count);
+
 /**
  * Return one object back to a pool.
  * HINT: It is recommended to use this call instead of uk_free() whenever
@@ -169,6 +185,20 @@ void *uk_allocpool_take(struct uk_allocpool *p);
  */
 void uk_allocpool_return(struct uk_allocpool *p, void *obj);
 
+/**
+ * Return multiple objects to a pool.
+ *
+ * @param p
+ *  Pointer to memory pool.
+ * @param obj
+ *  Pointer to array that with pointers of objects that
+ *  should be returned.
+ * @param count
+ *  Number of objects that are on the array.
+ */
+void uk_allocpool_return_batch(struct uk_allocpool *p,
+			       void *obj[], unsigned int count);
+
 #ifdef __cplusplus
 }
 #endif
diff --git a/lib/ukallocpool/pool.c b/lib/ukallocpool/pool.c
index a7c3acf0..390f6b92 100644
--- a/lib/ukallocpool/pool.c
+++ b/lib/ukallocpool/pool.c
@@ -172,6 +172,23 @@ void *uk_allocpool_take(struct uk_allocpool *p)
 	return _take_free_obj(p);
 }
 
+unsigned int uk_allocpool_take_batch(struct uk_allocpool *p,
+				     void *obj[], unsigned int count)
+{
+	unsigned int i;
+
+	UK_ASSERT(p);
+	UK_ASSERT(obj);
+
+	for (i = 0; i < count; ++i) {
+		if (unlikely(uk_list_empty(&p->free_obj)))
+			break;
+		obj[i] = _take_free_obj(p);
+	}
+
+	return i;
+}
+
 void uk_allocpool_return(struct uk_allocpool *p, void *obj)
 {
 	UK_ASSERT(p);
@@ -179,6 +196,18 @@ void uk_allocpool_return(struct uk_allocpool *p, void *obj)
 	_prepend_free_obj(p, obj);
 }
 
+void uk_allocpool_return_batch(struct uk_allocpool *p,
+			       void *obj[], unsigned int count)
+{
+	unsigned int i;
+
+	UK_ASSERT(p);
+	UK_ASSERT(obj);
+
+	for (i = 0; i < count; ++i)
+		_prepend_free_obj(p, obj[i]);
+}
+
 #if CONFIG_LIBUKALLOC_IFSTATS
 static ssize_t pool_availmem(struct uk_alloc *a)
 {
-- 
2.20.1


From minios-devel-bounces@lists.xenproject.org Tue Dec 22 12:56:53 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Tue, 22 Dec 2020 12:56:53 +0000
Received: from list by lists.xenproject.org with outflank-mailman.57838.101374 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1krhDh-0007YX-G7; Tue, 22 Dec 2020 12:56:53 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 57838.101374; Tue, 22 Dec 2020 12:56: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 1krhDh-0007YQ-DI; Tue, 22 Dec 2020 12:56:53 +0000
Received: by outflank-mailman (input) for mailman id 57838;
 Tue, 22 Dec 2020 12:56: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=53M6=F2=neclab.eu=simon.kuenzer@srs-us1.protection.inumbo.net>)
 id 1krhDg-0007YL-G5
 for minios-devel@lists.xen.org; Tue, 22 Dec 2020 12:56:52 +0000
Received: from mailer1.neclab.eu (unknown [195.37.70.40])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id d1e9689e-5404-4e06-a733-b730e08bd396;
 Tue, 22 Dec 2020 12:56:50 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
 by mailer1.neclab.eu (Postfix) with ESMTP id C192A1039C3;
 Tue, 22 Dec 2020 13:56:49 +0100 (CET)
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 4XGdKKr3K4oj; Tue, 22 Dec 2020 13:56:49 +0100 (CET)
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 8F4261018BF;
 Tue, 22 Dec 2020 13:56:49 +0100 (CET)
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.2106.2; Tue, 22 Dec
 2020 13:56:49 +0100
X-BeenThere: minios-devel@lists.xenproject.org
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
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: d1e9689e-5404-4e06-a733-b730e08bd396
X-Virus-Scanned: Amavisd on Debian GNU/Linux (atlas-a.office.hd)
X-ENC: Last-Hop-TLS-encrypted
X-ENC: Last-Hop-TLS-encrypted
From: Simon Kuenzer <simon.kuenzer@neclab.eu>
To: <minios-devel@lists.xen.org>, <razvan.deaconescu@cs.pub.ro>
CC: Simon Kuenzer <simon.kuenzer@neclab.eu>
Subject: [UNIKRAFT PATCH v2 0/2] lib/ukallocpool: Instrumentation for statistics
Date: Tue, 22 Dec 2020 13:56:30 +0100
Message-ID: <20201222125632.29415-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: oberon.office.hd (192.168.24.90) To puck.office.hd
 (192.168.24.91)

Adopts lib/ukallocpool introduced with series 1606
( https://patchwork.unikraft.org/project/unikraft/list/?series=1606 )
to the lib/ukalloc API changes that are introduced with series 1574
( https://patchwork.unikraft.org/project/unikraft/list/?series=1574 ).

Changes since v1:
 - Adopt to changes of `ukallocpool` series (1597->1606)

Simon Kuenzer (2):
  lib/ukallocpool: Always provide `uk_alloc_availmem()`,
    `uk_alloc_maxalloc()`
  lib/ukallocpool: Instrumentation for statistics

 lib/ukallocpool/pool.c | 50 +++++++++++++++++++++++++++++++++++-------
 1 file changed, 42 insertions(+), 8 deletions(-)

-- 
2.20.1


From minios-devel-bounces@lists.xenproject.org Tue Dec 22 12:56:57 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Tue, 22 Dec 2020 12:56:57 +0000
Received: from list by lists.xenproject.org with outflank-mailman.57839.101378 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1krhDl-0007ar-Hl; Tue, 22 Dec 2020 12:56:57 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 57839.101378; Tue, 22 Dec 2020 12:56: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 1krhDl-0007ak-Eq; Tue, 22 Dec 2020 12:56:57 +0000
Received: by outflank-mailman (input) for mailman id 57839;
 Tue, 22 Dec 2020 12:56: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=53M6=F2=neclab.eu=simon.kuenzer@srs-us1.protection.inumbo.net>)
 id 1krhDk-0007ab-Uq
 for minios-devel@lists.xen.org; Tue, 22 Dec 2020 12:56:56 +0000
Received: from mailer2.neclab.eu (unknown [195.37.70.41])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 110f301e-1a98-49a4-b388-5898f6bd8324;
 Tue, 22 Dec 2020 12:56:56 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
 by mailer2.neclab.eu (Postfix) with ESMTP id 07343F23BB;
 Tue, 22 Dec 2020 13:56:55 +0100 (CET)
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 KAcWg07X6_uk; Tue, 22 Dec 2020 13:56:54 +0100 (CET)
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 D5B21F20A6;
 Tue, 22 Dec 2020 13:56:50 +0100 (CET)
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.2106.2; Tue, 22 Dec
 2020 13:56:50 +0100
X-BeenThere: minios-devel@lists.xenproject.org
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
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: 110f301e-1a98-49a4-b388-5898f6bd8324
X-Virus-Scanned: Amavisd on Debian GNU/Linux (atlas-b.office.hd)
X-ENC: Last-Hop-TLS-encrypted
X-ENC: Last-Hop-TLS-encrypted
From: Simon Kuenzer <simon.kuenzer@neclab.eu>
To: <minios-devel@lists.xen.org>, <razvan.deaconescu@cs.pub.ro>
CC: Simon Kuenzer <simon.kuenzer@neclab.eu>
Subject: [UNIKRAFT PATCH v2 1/2] lib/ukallocpool: Always provide `uk_alloc_availmem()`, `uk_alloc_maxalloc()`
Date: Tue, 22 Dec 2020 13:56:31 +0100
Message-ID: <20201222125632.29415-2-simon.kuenzer@neclab.eu>
X-Mailer: git-send-email 2.20.1
In-Reply-To: <20201222125632.29415-1-simon.kuenzer@neclab.eu>
References: <20201222125632.29415-1-simon.kuenzer@neclab.eu>
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)

Adopts to the changed meaning of `CONFIG_LIBUKALLLC_IFSTATS` and provide
`uk_alloc_availmem()` and `uk_alloc_maxalloc()` always.

Signed-off-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
---
 lib/ukallocpool/pool.c | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/lib/ukallocpool/pool.c b/lib/ukallocpool/pool.c
index 390f6b92..0ff24c38 100644
--- a/lib/ukallocpool/pool.c
+++ b/lib/ukallocpool/pool.c
@@ -208,14 +208,19 @@ void uk_allocpool_return_batch(struct uk_allocpool *p,
 		_prepend_free_obj(p, obj[i]);
 }
 
-#if CONFIG_LIBUKALLOC_IFSTATS
 static ssize_t pool_availmem(struct uk_alloc *a)
 {
 	struct uk_allocpool *p = ukalloc2pool(a);
 
-	return (size_t) p->free_obj_count * p->obj_len;
+	return (ssize_t) (p->free_obj_count * p->obj_len);
+}
+
+static ssize_t pool_maxalloc(struct uk_alloc *a)
+{
+	struct uk_allocpool *p = ukalloc2pool(a);
+
+	return (ssize_t) p->obj_len;
 }
-#endif
 
 size_t uk_allocpool_reqmem(unsigned int obj_count, size_t obj_len,
 			   size_t obj_align)
@@ -300,6 +305,8 @@ out:
 			     pool_free,
 			     pool_posix_memalign,
 			     uk_memalign_compat,
+			     pool_maxalloc,
+			     pool_availmem,
 			     NULL);
 #if CONFIG_LIBUKALLOC_IFSTATS
 	p->self.availmem = pool_availmem;
-- 
2.20.1


From minios-devel-bounces@lists.xenproject.org Tue Dec 22 12:57:02 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Tue, 22 Dec 2020 12:57:02 +0000
Received: from list by lists.xenproject.org with outflank-mailman.57840.101383 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1krhDq-0007bs-Jd; Tue, 22 Dec 2020 12:57:02 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 57840.101383; Tue, 22 Dec 2020 12:57: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 1krhDq-0007bl-GP; Tue, 22 Dec 2020 12:57:02 +0000
Received: by outflank-mailman (input) for mailman id 57840;
 Tue, 22 Dec 2020 12:57: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=53M6=F2=neclab.eu=simon.kuenzer@srs-us1.protection.inumbo.net>)
 id 1krhDp-0007be-0V
 for minios-devel@lists.xen.org; Tue, 22 Dec 2020 12:57:01 +0000
Received: from mailer2.neclab.eu (unknown [195.37.70.41])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 9ee11266-3400-4ea2-a446-ff2c22fff425;
 Tue, 22 Dec 2020 12:56:59 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
 by mailer2.neclab.eu (Postfix) with ESMTP id 15455F23BB;
 Tue, 22 Dec 2020 13:56:59 +0100 (CET)
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 g-t7G4fWH94r; Tue, 22 Dec 2020 13:56:58 +0100 (CET)
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 DF7A2F20A6;
 Tue, 22 Dec 2020 13:56:54 +0100 (CET)
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.2106.2; Tue, 22 Dec
 2020 13:56:51 +0100
X-BeenThere: minios-devel@lists.xenproject.org
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
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: 9ee11266-3400-4ea2-a446-ff2c22fff425
X-Virus-Scanned: Amavisd on Debian GNU/Linux (atlas-b.office.hd)
X-ENC: Last-Hop-TLS-encrypted
X-ENC: Last-Hop-TLS-encrypted
From: Simon Kuenzer <simon.kuenzer@neclab.eu>
To: <minios-devel@lists.xen.org>, <razvan.deaconescu@cs.pub.ro>
CC: Simon Kuenzer <simon.kuenzer@neclab.eu>
Subject: [UNIKRAFT PATCH v2 2/2] lib/ukallocpool: Instrumentation for statistics
Date: Tue, 22 Dec 2020 13:56:32 +0100
Message-ID: <20201222125632.29415-3-simon.kuenzer@neclab.eu>
X-Mailer: git-send-email 2.20.1
In-Reply-To: <20201222125632.29415-1-simon.kuenzer@neclab.eu>
References: <20201222125632.29415-1-simon.kuenzer@neclab.eu>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
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)

Instruments the allocator to record allocation statistics.

Signed-off-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
---
 lib/ukallocpool/pool.c | 37 ++++++++++++++++++++++++++++++++-----
 1 file changed, 32 insertions(+), 5 deletions(-)

diff --git a/lib/ukallocpool/pool.c b/lib/ukallocpool/pool.c
index 0ff24c38..bc337e12 100644
--- a/lib/ukallocpool/pool.c
+++ b/lib/ukallocpool/pool.c
@@ -130,21 +130,27 @@ static void pool_free(struct uk_alloc *a, void *ptr)
 {
 	struct uk_allocpool *p = ukalloc2pool(a);
 
-	if (likely(ptr))
+	if (likely(ptr)) {
 		_prepend_free_obj(p, ptr);
+		uk_alloc_stats_count_free(a, ptr, p->obj_len);
+	}
 }
 
 static void *pool_malloc(struct uk_alloc *a, size_t size)
 {
 	struct uk_allocpool *p = ukalloc2pool(a);
+	void *obj;
 
 	if (unlikely((size > p->obj_len)
 		     || uk_list_empty(&p->free_obj))) {
+		uk_alloc_stats_count_enomem(a, p->obj_len);
 		errno = ENOMEM;
 		return NULL;
 	}
 
-	return _take_free_obj(p);
+	obj = _take_free_obj(p);
+	uk_alloc_stats_count_alloc(a, obj, p->obj_len);
+	return obj;
 }
 
 static int pool_posix_memalign(struct uk_alloc *a, void **memptr, size_t align,
@@ -155,21 +161,31 @@ static int pool_posix_memalign(struct uk_alloc *a, void **memptr, size_t align,
 	if (unlikely((size > p->obj_len)
 		     || (align > p->obj_align)
 		     || uk_list_empty(&p->free_obj))) {
+		uk_alloc_stats_count_enomem(a, p->obj_len);
 		return ENOMEM;
 	}
 
 	*memptr = _take_free_obj(p);
+	uk_alloc_stats_count_alloc(a, *memptr, p->obj_len);
 	return 0;
 }
 
 void *uk_allocpool_take(struct uk_allocpool *p)
 {
+	void *obj;
+
 	UK_ASSERT(p);
 
-	if (unlikely(uk_list_empty(&p->free_obj)))
+	if (unlikely(uk_list_empty(&p->free_obj))) {
+		uk_alloc_stats_count_enomem(allocpool2ukalloc(p),
+					    p->obj_len);
 		return NULL;
+	}
 
-	return _take_free_obj(p);
+	obj = _take_free_obj(p);
+	uk_alloc_stats_count_alloc(allocpool2ukalloc(p),
+				   obj, p->obj_len);
+	return obj;
 }
 
 unsigned int uk_allocpool_take_batch(struct uk_allocpool *p,
@@ -184,8 +200,14 @@ unsigned int uk_allocpool_take_batch(struct uk_allocpool *p,
 		if (unlikely(uk_list_empty(&p->free_obj)))
 			break;
 		obj[i] = _take_free_obj(p);
+		uk_alloc_stats_count_alloc(allocpool2ukalloc(p),
+					   obj[i], p->obj_len);
 	}
 
+	if (unlikely(i == 0))
+		uk_alloc_stats_count_enomem(allocpool2ukalloc(p),
+					    p->obj_len);
+
 	return i;
 }
 
@@ -194,6 +216,8 @@ void uk_allocpool_return(struct uk_allocpool *p, void *obj)
 	UK_ASSERT(p);
 
 	_prepend_free_obj(p, obj);
+	uk_alloc_stats_count_free(allocpool2ukalloc(p),
+				  obj, p->obj_len);
 }
 
 void uk_allocpool_return_batch(struct uk_allocpool *p,
@@ -204,8 +228,11 @@ void uk_allocpool_return_batch(struct uk_allocpool *p,
 	UK_ASSERT(p);
 	UK_ASSERT(obj);
 
-	for (i = 0; i < count; ++i)
+	for (i = 0; i < count; ++i) {
 		_prepend_free_obj(p, obj[i]);
+		uk_alloc_stats_count_free(allocpool2ukalloc(p),
+					  obj[i], p->obj_len);
+	}
 }
 
 static ssize_t pool_availmem(struct uk_alloc *a)
-- 
2.20.1


From minios-devel-bounces@lists.xenproject.org Tue Dec 22 15:24:14 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Tue, 22 Dec 2020 15:24:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.57909.101531 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1krjWF-0004GX-Q5; Tue, 22 Dec 2020 15:24:11 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 57909.101531; Tue, 22 Dec 2020 15:24: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 1krjWF-0004GQ-MO; Tue, 22 Dec 2020 15:24:11 +0000
Received: by outflank-mailman (input) for mailman id 57909;
 Tue, 22 Dec 2020 15:24: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=53M6=F2=neclab.eu=simon.kuenzer@srs-us1.protection.inumbo.net>)
 id 1krjWE-0004GL-OZ
 for minios-devel@lists.xen.org; Tue, 22 Dec 2020 15:24:10 +0000
Received: from mailer1.neclab.eu (unknown [195.37.70.40])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id becd9b38-5250-4c00-a7d1-9138e644dd95;
 Tue, 22 Dec 2020 15:24:08 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
 by mailer1.neclab.eu (Postfix) with ESMTP id 78A46103B1F;
 Tue, 22 Dec 2020 16:24:07 +0100 (CET)
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 eVB4osnDz6oS; Tue, 22 Dec 2020 16:24:07 +0100 (CET)
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 54FE7103B12;
 Tue, 22 Dec 2020 16:24:07 +0100 (CET)
Received: from [10.7.2.24] (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.2106.2; Tue, 22 Dec
 2020 16:24:07 +0100
X-BeenThere: minios-devel@lists.xenproject.org
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
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: becd9b38-5250-4c00-a7d1-9138e644dd95
X-Virus-Scanned: Amavisd on Debian GNU/Linux (atlas-a.office.hd)
X-ENC: Last-Hop-TLS-encrypted
X-ENC: Last-Hop-TLS-encrypted
Subject: Re: [UNIKRAFT PATCH 3/7] lib/ukblkdev: blkreq.h: Use typedef for
 __sector
To: Laurentiu Barbulescu <lrbarbulescu@gmail.com>
CC: <minios-devel@lists.xen.org>
References: <20201022115507.4983-4-simon.kuenzer@neclab.eu>
 <3f651f0572fdf4d56d58f21520fab6542704476c.1607080324.git.lrbarbulescu@gmail.com>
From: Simon Kuenzer <simon.kuenzer@neclab.eu>
Message-ID: <80326ae3-1625-42da-3e73-bab4a4e40dd2@neclab.eu>
Date: Tue, 22 Dec 2020 16:24:06 +0100
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0)
 Gecko/20100101 Thunderbird/78.6.0
MIME-Version: 1.0
In-Reply-To: <3f651f0572fdf4d56d58f21520fab6542704476c.1607080324.git.lrbarbulescu@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)

Hi Laurentiu,

good point. It is not needed in fact. The print macros are defined 
within types.h not limits.h . I will remove the include from the series.

Thanks,

Simon

On 04.12.20 12:33, Laurentiu Barbulescu wrote:
> Considering that `__sz` and `__PRIsz` are defined in `include/uk/arch/types.h`, which is already included by `lib/ukblkdev/include/uk/blkreq.h`, i don't see why we have to include `uk/arch/limits.h`.
> 


From minios-devel-bounces@lists.xenproject.org Tue Dec 22 15:31:57 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Tue, 22 Dec 2020 15:31:57 +0000
Received: from list by lists.xenproject.org with outflank-mailman.57919.101558 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1krjdk-0005Fy-6H; Tue, 22 Dec 2020 15:31:56 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 57919.101558; Tue, 22 Dec 2020 15:31: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 1krjdk-0005Fr-3W; Tue, 22 Dec 2020 15:31:56 +0000
Received: by outflank-mailman (input) for mailman id 57919;
 Tue, 22 Dec 2020 15:31: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=53M6=F2=neclab.eu=simon.kuenzer@srs-us1.protection.inumbo.net>)
 id 1krjdj-0005Ez-6t
 for minios-devel@lists.xen.org; Tue, 22 Dec 2020 15:31:55 +0000
Received: from mailer2.neclab.eu (unknown [195.37.70.41])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id c6a0680d-3d3b-4d5a-b381-a48ff4bc3d2e;
 Tue, 22 Dec 2020 15:31:53 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
 by mailer2.neclab.eu (Postfix) with ESMTP id 707FBF223E;
 Tue, 22 Dec 2020 16:31:52 +0100 (CET)
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 pn5VYJtZTWKg; Tue, 22 Dec 2020 16:31:52 +0100 (CET)
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 31401F2237;
 Tue, 22 Dec 2020 16:31:48 +0100 (CET)
Received: from [10.7.2.24] (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.2106.2; Tue, 22 Dec
 2020 16:31:47 +0100
X-BeenThere: minios-devel@lists.xenproject.org
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
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: c6a0680d-3d3b-4d5a-b381-a48ff4bc3d2e
X-Virus-Scanned: Amavisd on Debian GNU/Linux (atlas-b.office.hd)
X-ENC: Last-Hop-TLS-encrypted
X-ENC: Last-Hop-TLS-encrypted
Subject: Re: [UNIKRAFT PATCH 5/7] lib/ukblkdev: API refactoring:
 `uk_blkdev_queue_configure()`
To: Laurentiu Barbulescu <lrbarbulescu@gmail.com>
CC: <minios-devel@lists.xen.org>
References: <20201022115507.4983-6-simon.kuenzer@neclab.eu>
 <747bde144a18948f9a86f1ccea52fc7582fa81d9.1607080324.git.lrbarbulescu@gmail.com>
From: Simon Kuenzer <simon.kuenzer@neclab.eu>
Message-ID: <f38d1d6d-2853-0b48-679a-c7a808a7ea19@neclab.eu>
Date: Tue, 22 Dec 2020 16:31:47 +0100
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0)
 Gecko/20100101 Thunderbird/78.6.0
MIME-Version: 1.0
In-Reply-To: <747bde144a18948f9a86f1ccea52fc7582fa81d9.1607080324.git.lrbarbulescu@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)

I will keep the word setup in line 51 but adopt the others. A proper API 
documentation is actually really important, thanks a lot for pointing 
out. Somehow I had missed it.

On 04.12.20 12:35, Laurentiu Barbulescu wrote:
> This is affecting only the consistency, but you omitted to modify some comments from `blkdev.h`:
> - on line 54: "*      - uk_blkdev_queue_setup()";
> - on line 51, 200, 501: other non-API comments.
> 


From minios-devel-bounces@lists.xenproject.org Tue Dec 22 15:38:14 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Tue, 22 Dec 2020 15:38:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.57932.101587 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1krjjp-0005WT-8P; Tue, 22 Dec 2020 15:38:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 57932.101587; Tue, 22 Dec 2020 15:38: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 1krjjp-0005WK-4h; Tue, 22 Dec 2020 15:38:13 +0000
Received: by outflank-mailman (input) for mailman id 57932;
 Tue, 22 Dec 2020 15: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=53M6=F2=neclab.eu=simon.kuenzer@srs-us1.protection.inumbo.net>)
 id 1krjjn-0005W7-HS
 for minios-devel@lists.xen.org; Tue, 22 Dec 2020 15:38:11 +0000
Received: from mailer2.neclab.eu (unknown [195.37.70.41])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id fdf866c8-05e6-4e2f-8b85-3789a8f1e3ef;
 Tue, 22 Dec 2020 15:38:10 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
 by mailer2.neclab.eu (Postfix) with ESMTP id 79472F223E;
 Tue, 22 Dec 2020 16:38:09 +0100 (CET)
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 hIsbadSfMRqL; Tue, 22 Dec 2020 16:38:09 +0100 (CET)
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 3A991F2237;
 Tue, 22 Dec 2020 16:38:05 +0100 (CET)
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.2106.2; Tue, 22 Dec
 2020 16:38:04 +0100
X-BeenThere: minios-devel@lists.xenproject.org
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
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: fdf866c8-05e6-4e2f-8b85-3789a8f1e3ef
X-Virus-Scanned: Amavisd on Debian GNU/Linux (atlas-b.office.hd)
X-ENC: Last-Hop-TLS-encrypted
X-ENC: Last-Hop-TLS-encrypted
From: Simon Kuenzer <simon.kuenzer@neclab.eu>
To: <minios-devel@lists.xen.org>, <lrbarbulescu@gmail.com>
CC: Simon Kuenzer <simon.kuenzer@neclab.eu>
Subject: [UNIKRAFT PATCH v2 0/7] lib/ukblkdev: Minor API improvements and fixes
Date: Tue, 22 Dec 2020 16:37:51 +0100
Message-ID: <20201222153758.1731-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: oberon.office.hd (192.168.24.90) To puck.office.hd
 (192.168.24.91)

This series consists of a number of minor improvements and
fixes of the ukblkdev API. This is mainly done to inline
the ukblkdev API with the uknetdev API.

Changes v2:
 - Remove including <uk/arch/types.h> in <uk/blkreq.h>
 - Adapt API documentation in <uk/blkdev.h> to reflect
   `uk_blkdev_queue_configure()`

Simon Kuenzer (7):
  lib/ukblkdev: blkdev.h: Include <uk/assert.h>
  lib/ukblkdev: blkreq.h: Include <uk/arch/atomic.h>
  lib/ukblkdev: blkreq.h: Use typedef for __sector
  lib/ukblkdev: blkreq.h: Use UK_BLKREQ_ prefix for states and ops
  lib/ukblkdev: API refactoring: `uk_blkdev_queue_configure()`
  lib/ukblkdev: Provide `uk_blkdev_size()`
  lib/ukblkdev: blkdev.h: Description about interrupts

 lib/ukblkdev/blkdev.c                   | 16 +++++++--------
 lib/ukblkdev/exportsyms.uk              |  2 +-
 lib/ukblkdev/include/uk/blkdev.h        | 27 +++++++++++++++----------
 lib/ukblkdev/include/uk/blkdev_core.h   |  6 +++---
 lib/ukblkdev/include/uk/blkdev_driver.h |  2 +-
 lib/ukblkdev/include/uk/blkreq.h        | 20 ++++++++++--------
 plat/drivers/virtio/virtio_blk.c        | 16 +++++++--------
 plat/xen/drivers/blk/blkfront.c         | 14 ++++++-------
 8 files changed, 56 insertions(+), 47 deletions(-)

-- 
2.20.1


From minios-devel-bounces@lists.xenproject.org Tue Dec 22 15:38:17 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Tue, 22 Dec 2020 15:38:17 +0000
Received: from list by lists.xenproject.org with outflank-mailman.57934.101590 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1krjjt-0005XO-97; Tue, 22 Dec 2020 15:38:17 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 57934.101590; Tue, 22 Dec 2020 15:38: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 1krjjt-0005XH-6J; Tue, 22 Dec 2020 15:38:17 +0000
Received: by outflank-mailman (input) for mailman id 57934;
 Tue, 22 Dec 2020 15:38:16 +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=53M6=F2=neclab.eu=simon.kuenzer@srs-us1.protection.inumbo.net>)
 id 1krjjr-0005X6-Tt
 for minios-devel@lists.xen.org; Tue, 22 Dec 2020 15:38:15 +0000
Received: from mailer2.neclab.eu (unknown [195.37.70.41])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id b5084403-701f-4bc9-a3ee-f23003bb2f94;
 Tue, 22 Dec 2020 15:38:14 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
 by mailer2.neclab.eu (Postfix) with ESMTP id 761A8F223E;
 Tue, 22 Dec 2020 16:38:13 +0100 (CET)
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 oXpqPiLitgf6; Tue, 22 Dec 2020 16:38:13 +0100 (CET)
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 4338BF2237;
 Tue, 22 Dec 2020 16:38:09 +0100 (CET)
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.2106.2; Tue, 22 Dec
 2020 16:38:06 +0100
X-BeenThere: minios-devel@lists.xenproject.org
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
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: b5084403-701f-4bc9-a3ee-f23003bb2f94
X-Virus-Scanned: Amavisd on Debian GNU/Linux (atlas-b.office.hd)
X-ENC: Last-Hop-TLS-encrypted
X-ENC: Last-Hop-TLS-encrypted
From: Simon Kuenzer <simon.kuenzer@neclab.eu>
To: <minios-devel@lists.xen.org>, <lrbarbulescu@gmail.com>
CC: Simon Kuenzer <simon.kuenzer@neclab.eu>
Subject: [UNIKRAFT PATCH v2 1/7] lib/ukblkdev: blkdev.h: Include <uk/assert.h>
Date: Tue, 22 Dec 2020 16:37:52 +0100
Message-ID: <20201222153758.1731-2-simon.kuenzer@neclab.eu>
X-Mailer: git-send-email 2.20.1
In-Reply-To: <20201222153758.1731-1-simon.kuenzer@neclab.eu>
References: <20201222153758.1731-1-simon.kuenzer@neclab.eu>
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)

The header `blkdev.h` uses UK_ASSERT but did not include
`<uk/assert.h>`.

Signed-off-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
---
 lib/ukblkdev/include/uk/blkdev.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/lib/ukblkdev/include/uk/blkdev.h b/lib/ukblkdev/include/uk/blkdev.h
index c8de0038d..7aa099092 100644
--- a/lib/ukblkdev/include/uk/blkdev.h
+++ b/lib/ukblkdev/include/uk/blkdev.h
@@ -66,6 +66,7 @@
 #include <stdio.h>
 #include <errno.h>
 #include <limits.h>
+#include <uk/assert.h>
 #include <uk/list.h>
 #include <uk/errptr.h>
 
-- 
2.20.1


From minios-devel-bounces@lists.xenproject.org Tue Dec 22 15:38:20 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Tue, 22 Dec 2020 15:38:20 +0000
Received: from list by lists.xenproject.org with outflank-mailman.57935.101595 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1krjjw-0005Yf-Aq; Tue, 22 Dec 2020 15:38:20 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 57935.101595; Tue, 22 Dec 2020 15:38: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 1krjjw-0005YY-7r; Tue, 22 Dec 2020 15:38:20 +0000
Received: by outflank-mailman (input) for mailman id 57935;
 Tue, 22 Dec 2020 15:38: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=53M6=F2=neclab.eu=simon.kuenzer@srs-us1.protection.inumbo.net>)
 id 1krjjv-0005YK-5S
 for minios-devel@lists.xen.org; Tue, 22 Dec 2020 15:38:19 +0000
Received: from mailer2.neclab.eu (unknown [195.37.70.41])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 0acb4c76-e177-4ca4-a750-09c3f75ba616;
 Tue, 22 Dec 2020 15:38:18 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
 by mailer2.neclab.eu (Postfix) with ESMTP id 79F05F223E;
 Tue, 22 Dec 2020 16:38:17 +0100 (CET)
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 5JAfV_oVCacO; Tue, 22 Dec 2020 16:38:17 +0100 (CET)
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 51EE5F2237;
 Tue, 22 Dec 2020 16:38:13 +0100 (CET)
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.2106.2; Tue, 22 Dec
 2020 16:38:07 +0100
X-BeenThere: minios-devel@lists.xenproject.org
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
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: 0acb4c76-e177-4ca4-a750-09c3f75ba616
X-Virus-Scanned: Amavisd on Debian GNU/Linux (atlas-b.office.hd)
X-ENC: Last-Hop-TLS-encrypted
X-ENC: Last-Hop-TLS-encrypted
From: Simon Kuenzer <simon.kuenzer@neclab.eu>
To: <minios-devel@lists.xen.org>, <lrbarbulescu@gmail.com>
CC: Simon Kuenzer <simon.kuenzer@neclab.eu>
Subject: [UNIKRAFT PATCH v2 2/7] lib/ukblkdev: blkreq.h: Include <uk/arch/atomic.h>
Date: Tue, 22 Dec 2020 16:37:53 +0100
Message-ID: <20201222153758.1731-3-simon.kuenzer@neclab.eu>
X-Mailer: git-send-email 2.20.1
In-Reply-To: <20201222153758.1731-1-simon.kuenzer@neclab.eu>
References: <20201222153758.1731-1-simon.kuenzer@neclab.eu>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
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)

The header `blkreq.h` uses atomic operations but did not include
`<uk/arch/atomic.h>`.

Signed-off-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
---
 lib/ukblkdev/include/uk/blkreq.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/lib/ukblkdev/include/uk/blkreq.h b/lib/ukblkdev/include/uk/blkreq.h
index 2c4b9b993..17daa6b52 100644
--- a/lib/ukblkdev/include/uk/blkreq.h
+++ b/lib/ukblkdev/include/uk/blkreq.h
@@ -48,6 +48,8 @@ extern "C" {
 #endif
 
 #define __sector size_t
+#include <uk/arch/atomic.h>
+
 struct uk_blkreq;
 
 /**
-- 
2.20.1


From minios-devel-bounces@lists.xenproject.org Tue Dec 22 15:38:24 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Tue, 22 Dec 2020 15:38:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.57936.101598 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1krjk0-0005Zz-CT; Tue, 22 Dec 2020 15:38:24 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 57936.101598; Tue, 22 Dec 2020 15:38: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 1krjk0-0005Zs-9R; Tue, 22 Dec 2020 15:38:24 +0000
Received: by outflank-mailman (input) for mailman id 57936;
 Tue, 22 Dec 2020 15:38: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=53M6=F2=neclab.eu=simon.kuenzer@srs-us1.protection.inumbo.net>)
 id 1krjjz-0005YK-9M
 for minios-devel@lists.xen.org; Tue, 22 Dec 2020 15:38:23 +0000
Received: from mailer2.neclab.eu (unknown [195.37.70.41])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id b47c0653-8586-44d5-a9ae-ae665bf40671;
 Tue, 22 Dec 2020 15:38:22 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
 by mailer2.neclab.eu (Postfix) with ESMTP id 87FE8F223E;
 Tue, 22 Dec 2020 16:38:21 +0100 (CET)
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 pyYzYxiBhgVk; Tue, 22 Dec 2020 16:38:21 +0100 (CET)
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 5F419F2237;
 Tue, 22 Dec 2020 16:38:17 +0100 (CET)
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.2106.2; Tue, 22 Dec
 2020 16:38:08 +0100
X-BeenThere: minios-devel@lists.xenproject.org
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
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: b47c0653-8586-44d5-a9ae-ae665bf40671
X-Virus-Scanned: Amavisd on Debian GNU/Linux (atlas-b.office.hd)
X-ENC: Last-Hop-TLS-encrypted
X-ENC: Last-Hop-TLS-encrypted
From: Simon Kuenzer <simon.kuenzer@neclab.eu>
To: <minios-devel@lists.xen.org>, <lrbarbulescu@gmail.com>
CC: Simon Kuenzer <simon.kuenzer@neclab.eu>
Subject: [UNIKRAFT PATCH v2 3/7] lib/ukblkdev: blkreq.h: Use typedef for __sector
Date: Tue, 22 Dec 2020 16:37:54 +0100
Message-ID: <20201222153758.1731-4-simon.kuenzer@neclab.eu>
X-Mailer: git-send-email 2.20.1
In-Reply-To: <20201222153758.1731-1-simon.kuenzer@neclab.eu>
References: <20201222153758.1731-1-simon.kuenzer@neclab.eu>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Content-Type: text/plain
X-Originating-IP: [192.168.24.96]
X-ClientProxiedBy: oberon.office.hd (192.168.24.90) To puck.office.hd
 (192.168.24.91)

Introduces `__sector` with a type definition instead with an alias macro.
This is done for consistency reasons. Additionally, the print format macro
`__PRIsctr` is introduced so that a sector number can be printed
correctly.

Signed-off-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
---
 lib/ukblkdev/include/uk/blkreq.h | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/lib/ukblkdev/include/uk/blkreq.h b/lib/ukblkdev/include/uk/blkreq.h
index 17daa6b52..0bf4ae3ff 100644
--- a/lib/ukblkdev/include/uk/blkreq.h
+++ b/lib/ukblkdev/include/uk/blkreq.h
@@ -47,9 +47,11 @@
 extern "C" {
 #endif
 
-#define __sector size_t
 #include <uk/arch/atomic.h>
 
+typedef __sz __sector;
+#define __PRIsctr __PRIsz
+
 struct uk_blkreq;
 
 /**
-- 
2.20.1


From minios-devel-bounces@lists.xenproject.org Tue Dec 22 15:38:29 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Tue, 22 Dec 2020 15:38:29 +0000
Received: from list by lists.xenproject.org with outflank-mailman.57937.101603 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1krjk5-0005bT-Ed; Tue, 22 Dec 2020 15:38:29 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 57937.101603; Tue, 22 Dec 2020 15:38: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 1krjk5-0005bK-BJ; Tue, 22 Dec 2020 15:38:29 +0000
Received: by outflank-mailman (input) for mailman id 57937;
 Tue, 22 Dec 2020 15:38:27 +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=53M6=F2=neclab.eu=simon.kuenzer@srs-us1.protection.inumbo.net>)
 id 1krjk3-0005b4-RY
 for minios-devel@lists.xen.org; Tue, 22 Dec 2020 15:38:27 +0000
Received: from mailer2.neclab.eu (unknown [195.37.70.41])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 83629a05-3d1f-4227-8821-f8a75513ef90;
 Tue, 22 Dec 2020 15:38:26 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
 by mailer2.neclab.eu (Postfix) with ESMTP id 95C4DF223E;
 Tue, 22 Dec 2020 16:38:25 +0100 (CET)
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 pI_BRQHv2X3B; Tue, 22 Dec 2020 16:38:25 +0100 (CET)
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 6C75BF2237;
 Tue, 22 Dec 2020 16:38:21 +0100 (CET)
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.2106.2; Tue, 22 Dec
 2020 16:38:09 +0100
X-BeenThere: minios-devel@lists.xenproject.org
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
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: 83629a05-3d1f-4227-8821-f8a75513ef90
X-Virus-Scanned: Amavisd on Debian GNU/Linux (atlas-b.office.hd)
X-ENC: Last-Hop-TLS-encrypted
X-ENC: Last-Hop-TLS-encrypted
From: Simon Kuenzer <simon.kuenzer@neclab.eu>
To: <minios-devel@lists.xen.org>, <lrbarbulescu@gmail.com>
CC: Simon Kuenzer <simon.kuenzer@neclab.eu>
Subject: [UNIKRAFT PATCH v2 4/7] lib/ukblkdev: blkreq.h: Use UK_BLKREQ_ prefix for states and ops
Date: Tue, 22 Dec 2020 16:37:55 +0100
Message-ID: <20201222153758.1731-5-simon.kuenzer@neclab.eu>
X-Mailer: git-send-email 2.20.1
In-Reply-To: <20201222153758.1731-1-simon.kuenzer@neclab.eu>
References: <20201222153758.1731-1-simon.kuenzer@neclab.eu>
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)

Instead of using `UK_BLKDEV_REQ_` prefix for `struct uk_blkreq`
states (finished, unfinished) and `UK_BLKDEV_` prefix for operation
requests (read, write, flush) this commits simplifies the API by using
the `UK_BLKREQ_` prefix.

Signed-off-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
---
 lib/ukblkdev/include/uk/blkdev.h        | 10 +++++-----
 lib/ukblkdev/include/uk/blkdev_driver.h |  2 +-
 lib/ukblkdev/include/uk/blkreq.h        | 14 +++++++-------
 plat/drivers/virtio/virtio_blk.c        | 12 ++++++------
 plat/xen/drivers/blk/blkfront.c         | 10 +++++-----
 5 files changed, 24 insertions(+), 24 deletions(-)

diff --git a/lib/ukblkdev/include/uk/blkdev.h b/lib/ukblkdev/include/uk/blkdev.h
index 7aa099092..abc228d9c 100644
--- a/lib/ukblkdev/include/uk/blkdev.h
+++ b/lib/ukblkdev/include/uk/blkdev.h
@@ -459,18 +459,18 @@ int uk_blkdev_sync_io(struct uk_blkdev *dev,
 		sector,		\
 		nb_sectors,	\
 		buf)		\
-	uk_blkdev_sync_io(blkdev, queue_id, UK_BLKDEV_WRITE, sector, \
-			nb_sectors, buf) \
+	uk_blkdev_sync_io(blkdev, queue_id, UK_BLKREQ_WRITE, sector, \
+			  nb_sectors, buf)			     \
 
 #define uk_blkdev_sync_read(blkdev,\
 		queue_id,	\
 		sector,		\
 		nb_sectors,	\
 		buf)		\
-	uk_blkdev_sync_io(blkdev, queue_id, UK_BLKDEV_READ, sector, \
-			nb_sectors, buf) \
+	uk_blkdev_sync_io(blkdev, queue_id, UK_BLKREQ_READ, sector, \
+			  nb_sectors, buf)			    \
 
-#endif
+#endif /* CONFIG_LIBUKBLKDEV_SYNC_IO_BLOCKED_WAITING */
 
 /**
  * Stop a Unikraft block device, and set its state to UK_BLKDEV_CONFIGURED
diff --git a/lib/ukblkdev/include/uk/blkdev_driver.h b/lib/ukblkdev/include/uk/blkdev_driver.h
index be8070691..cb1b3ba39 100644
--- a/lib/ukblkdev/include/uk/blkdev_driver.h
+++ b/lib/ukblkdev/include/uk/blkdev_driver.h
@@ -104,7 +104,7 @@ static inline void uk_blkdev_drv_queue_event(struct uk_blkdev *dev,
  *	uk_blkreq structure
  */
 #define uk_blkreq_finished(req) \
-	(ukarch_store_n(&(req)->state.counter, UK_BLKDEV_REQ_FINISHED))
+	(ukarch_store_n(&(req)->state.counter, UK_BLKREQ_FINISHED))
 
 /**
  * Frees the data allocated for the Unikraft Block Device.
diff --git a/lib/ukblkdev/include/uk/blkreq.h b/lib/ukblkdev/include/uk/blkreq.h
index 0bf4ae3ff..ae1a31ed5 100644
--- a/lib/ukblkdev/include/uk/blkreq.h
+++ b/lib/ukblkdev/include/uk/blkreq.h
@@ -58,8 +58,8 @@ struct uk_blkreq;
  *	Operation status
  */
 enum uk_blkreq_state {
-	UK_BLKDEV_REQ_FINISHED = 0,
-	UK_BLKDEV_REQ_UNFINISHED
+	UK_BLKREQ_FINISHED = 0,
+	UK_BLKREQ_UNFINISHED
 };
 
 /**
@@ -67,11 +67,11 @@ enum uk_blkreq_state {
  */
 enum uk_blkreq_op {
 	/* Read operation */
-	UK_BLKDEV_READ = 0,
+	UK_BLKREQ_READ = 0,
 	/* Write operation */
-	UK_BLKDEV_WRITE,
+	UK_BLKREQ_WRITE,
 	/* Flush the volatile write cache */
-	UK_BLKDEV_FFLUSH = 4
+	UK_BLKREQ_FFLUSH = 4
 };
 
 /**
@@ -135,7 +135,7 @@ static inline void uk_blkreq_init(struct uk_blkreq *req,
 	req->start_sector = start;
 	req->nb_sectors = nb_sectors;
 	req->aio_buf = aio_buf;
-	ukarch_store_n(&req->state.counter, UK_BLKDEV_REQ_UNFINISHED);
+	ukarch_store_n(&req->state.counter, UK_BLKREQ_UNFINISHED);
 	req->cb = cb;
 	req->cb_cookie = cb_cookie;
 }
@@ -147,7 +147,7 @@ static inline void uk_blkreq_init(struct uk_blkreq *req,
  *	uk_blkreq structure
  **/
 #define uk_blkreq_is_done(req) \
-		(ukarch_load_n(&(req)->state.counter) == UK_BLKDEV_REQ_FINISHED)
+		(ukarch_load_n(&(req)->state.counter) == UK_BLKREQ_FINISHED)
 
 #ifdef __cplusplus
 }
diff --git a/plat/drivers/virtio/virtio_blk.c b/plat/drivers/virtio/virtio_blk.c
index ff33cc119..262355b49 100644
--- a/plat/drivers/virtio/virtio_blk.c
+++ b/plat/drivers/virtio/virtio_blk.c
@@ -186,7 +186,7 @@ static int virtio_blkdev_request_write(struct uk_blkdev_queue *queue,
 	vbdev = queue->vbd;
 	cap = &vbdev->blkdev.capabilities;
 	req = virtio_blk_req->req;
-	if (req->operation == UK_BLKDEV_WRITE &&
+	if (req->operation == UK_BLKREQ_WRITE &&
 			cap->mode == O_RDONLY)
 		return -EPERM;
 
@@ -209,11 +209,11 @@ static int virtio_blkdev_request_write(struct uk_blkdev_queue *queue,
 		goto out;
 	}
 
-	if (req->operation == UK_BLKDEV_WRITE) {
+	if (req->operation == UK_BLKREQ_WRITE) {
 		*read_segs = queue->sg.sg_nseg - 1;
 		*write_segs = 1;
 		virtio_blk_req->virtio_blk_outhdr.type = VIRTIO_BLK_T_OUT;
-	} else if (req->operation == UK_BLKDEV_READ) {
+	} else if (req->operation == UK_BLKREQ_READ) {
 		*read_segs = 1;
 		*write_segs = queue->sg.sg_nseg - 1;
 		virtio_blk_req->virtio_blk_outhdr.type = VIRTIO_BLK_T_IN;
@@ -278,11 +278,11 @@ static int virtio_blkdev_queue_enqueue(struct uk_blkdev_queue *queue,
 
 	virtio_blk_req->req = req;
 	virtio_blk_req->virtio_blk_outhdr.sector = req->start_sector;
-	if (req->operation == UK_BLKDEV_WRITE ||
-			req->operation == UK_BLKDEV_READ)
+	if (req->operation == UK_BLKREQ_WRITE ||
+			req->operation == UK_BLKREQ_READ)
 		rc = virtio_blkdev_request_write(queue, virtio_blk_req,
 				&read_segs, &write_segs);
-	else if (req->operation == UK_BLKDEV_FFLUSH)
+	else if (req->operation == UK_BLKREQ_FFLUSH)
 		rc = virtio_blkdev_request_flush(queue, virtio_blk_req,
 				&read_segs, &write_segs);
 	else
diff --git a/plat/xen/drivers/blk/blkfront.c b/plat/xen/drivers/blk/blkfront.c
index 5cd5cf226..60b634665 100644
--- a/plat/xen/drivers/blk/blkfront.c
+++ b/plat/xen/drivers/blk/blkfront.c
@@ -250,7 +250,7 @@ static void blkif_request_init(struct blkif_request *ring_req,
 	UK_ASSERT(nb_segments <= BLKIF_MAX_SEGMENTS_PER_REQUEST);
 
 	/* Set ring request */
-	ring_req->operation = (req->operation == UK_BLKDEV_WRITE) ?
+	ring_req->operation = (req->operation == UK_BLKREQ_WRITE) ?
 			BLKIF_OP_WRITE : BLKIF_OP_READ;
 	ring_req->nr_segments = nb_segments;
 	ring_req->sector_number = req->start_sector;
@@ -281,7 +281,7 @@ static int blkfront_request_write(struct blkfront_request *blkfront_req,
 	dev = blkfront_req->queue->dev;
 	cap = &dev->blkdev.capabilities;
 	sector_size = cap->ssize;
-	if (req->operation == UK_BLKDEV_WRITE && cap->mode == O_RDONLY)
+	if (req->operation == UK_BLKREQ_WRITE && cap->mode == O_RDONLY)
 		return -EPERM;
 
 	if (req->aio_buf == NULL)
@@ -360,10 +360,10 @@ static int blkfront_queue_enqueue(struct uk_blkdev_queue *queue,
 	ring_req->id = (uintptr_t) blkfront_req;
 	ring_req->handle = dev->handle;
 
-	if (req->operation == UK_BLKDEV_READ ||
-			req->operation == UK_BLKDEV_WRITE)
+	if (req->operation == UK_BLKREQ_READ ||
+			req->operation == UK_BLKREQ_WRITE)
 		rc = blkfront_request_write(blkfront_req, ring_req);
-	else if (req->operation == UK_BLKDEV_FFLUSH)
+	else if (req->operation == UK_BLKREQ_FFLUSH)
 		rc =  blkfront_request_flush(blkfront_req, ring_req);
 	else
 		rc = -EINVAL;
-- 
2.20.1


From minios-devel-bounces@lists.xenproject.org Tue Dec 22 15:38:33 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Tue, 22 Dec 2020 15:38:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.57939.101606 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1krjk9-0005cu-G6; Tue, 22 Dec 2020 15:38:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 57939.101606; Tue, 22 Dec 2020 15:38: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 1krjk9-0005cn-Cw; Tue, 22 Dec 2020 15:38:33 +0000
Received: by outflank-mailman (input) for mailman id 57939;
 Tue, 22 Dec 2020 15:38:32 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=53M6=F2=neclab.eu=simon.kuenzer@srs-us1.protection.inumbo.net>)
 id 1krjk8-0005cR-19
 for minios-devel@lists.xen.org; Tue, 22 Dec 2020 15:38:32 +0000
Received: from mailer2.neclab.eu (unknown [195.37.70.41])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id f7e924ea-e536-4035-a535-8120052f5ecd;
 Tue, 22 Dec 2020 15:38:30 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
 by mailer2.neclab.eu (Postfix) with ESMTP id A68DBF223E;
 Tue, 22 Dec 2020 16:38:29 +0100 (CET)
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 M5x7lJ_yg_Vq; Tue, 22 Dec 2020 16:38:29 +0100 (CET)
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 79A2DF2237;
 Tue, 22 Dec 2020 16:38:25 +0100 (CET)
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.2106.2; Tue, 22 Dec
 2020 16:38:11 +0100
X-BeenThere: minios-devel@lists.xenproject.org
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
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: f7e924ea-e536-4035-a535-8120052f5ecd
X-Virus-Scanned: Amavisd on Debian GNU/Linux (atlas-b.office.hd)
X-ENC: Last-Hop-TLS-encrypted
X-ENC: Last-Hop-TLS-encrypted
From: Simon Kuenzer <simon.kuenzer@neclab.eu>
To: <minios-devel@lists.xen.org>, <lrbarbulescu@gmail.com>
CC: Simon Kuenzer <simon.kuenzer@neclab.eu>
Subject: [UNIKRAFT PATCH v2 5/7] lib/ukblkdev: API refactoring: `uk_blkdev_queue_configure()`
Date: Tue, 22 Dec 2020 16:37:56 +0100
Message-ID: <20201222153758.1731-6-simon.kuenzer@neclab.eu>
X-Mailer: git-send-email 2.20.1
In-Reply-To: <20201222153758.1731-1-simon.kuenzer@neclab.eu>
References: <20201222153758.1731-1-simon.kuenzer@neclab.eu>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
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)

For API consistency reasons, this patch renames `uk_blkdev_queue_setup()` to
`uk_blkdev_queue_configure()`. This is done to be inline with
lib/uknetdev. Additionally and as counterpart for queue configuration, we
rename `uk_blkdev_release()` to `uk_blkdev_unconfigure()`.

Signed-off-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
---
 lib/ukblkdev/blkdev.c                 | 16 ++++++++--------
 lib/ukblkdev/exportsyms.uk            |  2 +-
 lib/ukblkdev/include/uk/blkdev.h      | 10 +++++-----
 lib/ukblkdev/include/uk/blkdev_core.h |  6 +++---
 plat/drivers/virtio/virtio_blk.c      |  4 ++--
 plat/xen/drivers/blk/blkfront.c       |  4 ++--
 6 files changed, 21 insertions(+), 21 deletions(-)

diff --git a/lib/ukblkdev/blkdev.c b/lib/ukblkdev/blkdev.c
index fc5038ba2..9cafa0c42 100644
--- a/lib/ukblkdev/blkdev.c
+++ b/lib/ukblkdev/blkdev.c
@@ -82,7 +82,7 @@ int uk_blkdev_drv_register(struct uk_blkdev *dev, struct uk_alloc *a,
 	UK_ASSERT(dev->dev_ops);
 	UK_ASSERT(dev->dev_ops->dev_configure);
 	UK_ASSERT(dev->dev_ops->dev_start);
-	UK_ASSERT(dev->dev_ops->queue_setup);
+	UK_ASSERT(dev->dev_ops->queue_configure);
 	UK_ASSERT(dev->dev_ops->get_info);
 	UK_ASSERT(dev->dev_ops->queue_get_info);
 	UK_ASSERT(dev->submit_one);
@@ -313,7 +313,7 @@ int uk_blkdev_queue_configure(struct uk_blkdev *dev, uint16_t queue_id,
 	UK_ASSERT(dev);
 	UK_ASSERT(dev->_data);
 	UK_ASSERT(dev->dev_ops);
-	UK_ASSERT(dev->dev_ops->queue_setup);
+	UK_ASSERT(dev->dev_ops->queue_configure);
 	UK_ASSERT(dev->finish_reqs);
 	UK_ASSERT(queue_id < CONFIG_LIBUKBLKDEV_MAXNBQUEUES);
 	UK_ASSERT(queue_conf);
@@ -339,7 +339,7 @@ int uk_blkdev_queue_configure(struct uk_blkdev *dev, uint16_t queue_id,
 	if (err)
 		goto err_out;
 
-	dev->_queue[queue_id] = dev->dev_ops->queue_setup(dev, queue_id,
+	dev->_queue[queue_id] = dev->dev_ops->queue_configure(dev, queue_id,
 			nb_desc,
 			queue_conf);
 	if (PTRISERR(dev->_queue[queue_id])) {
@@ -493,21 +493,21 @@ int uk_blkdev_stop(struct uk_blkdev *dev)
 	return rc;
 }
 
-int uk_blkdev_queue_release(struct uk_blkdev *dev, uint16_t queue_id)
+int uk_blkdev_queue_unconfigure(struct uk_blkdev *dev, uint16_t queue_id)
 {
 	int rc = 0;
 
 	UK_ASSERT(dev != NULL);
 	UK_ASSERT(dev->_data);
 	UK_ASSERT(dev->dev_ops);
-	UK_ASSERT(dev->dev_ops->queue_release);
+	UK_ASSERT(dev->dev_ops->queue_unconfigure);
 	UK_ASSERT(queue_id < CONFIG_LIBUKBLKDEV_MAXNBQUEUES);
 	UK_ASSERT(dev->_data->state == UK_BLKDEV_CONFIGURED);
 	UK_ASSERT(!PTRISERR(dev->_queue[queue_id]));
 
-	rc = dev->dev_ops->queue_release(dev, dev->_queue[queue_id]);
+	rc = dev->dev_ops->queue_unconfigure(dev, dev->_queue[queue_id]);
 	if (rc)
-		uk_pr_err("Failed to release blkdev%"PRIu16"-q%"PRIu16": %d\n",
+		uk_pr_err("Failed to unconfigure blkdev%"PRIu16"-q%"PRIu16": %d\n",
 				dev->_data->id, queue_id, rc);
 	else {
 #if CONFIG_LIBUKBLKDEV_DISPATCHERTHREADS
@@ -515,7 +515,7 @@ int uk_blkdev_queue_release(struct uk_blkdev *dev, uint16_t queue_id)
 			_destroy_event_handler(
 					&dev->_data->queue_handler[queue_id]);
 #endif
-		uk_pr_info("Released blkdev%"PRIu16"-q%"PRIu16"\n",
+		uk_pr_info("Unconfigured blkdev%"PRIu16"-q%"PRIu16"\n",
 				dev->_data->id, queue_id);
 		dev->_queue[queue_id] = NULL;
 	}
diff --git a/lib/ukblkdev/exportsyms.uk b/lib/ukblkdev/exportsyms.uk
index f3be6c51d..dd93e3940 100644
--- a/lib/ukblkdev/exportsyms.uk
+++ b/lib/ukblkdev/exportsyms.uk
@@ -13,6 +13,6 @@ uk_blkdev_queue_submit_one
 uk_blkdev_queue_finish_reqs
 uk_blkdev_sync_io
 uk_blkdev_stop
-uk_blkdev_queue_release
+uk_blkdev_queue_unconfigure
 uk_blkdev_drv_unregister
 uk_blkdev_unconfigure
diff --git a/lib/ukblkdev/include/uk/blkdev.h b/lib/ukblkdev/include/uk/blkdev.h
index abc228d9c..56b95c88c 100644
--- a/lib/ukblkdev/include/uk/blkdev.h
+++ b/lib/ukblkdev/include/uk/blkdev.h
@@ -51,7 +51,7 @@
  * The functions exported by the Unikraft BLK API to setup a device
  * designated by its ID must be invoked in the following order:
  *      - uk_blkdev_configure()
- *      - uk_blkdev_queue_setup()
+ *      - uk_blkdev_queue_configure()
  *      - uk_blkdev_start()
  *
  * There are 4 states in which a block device can be found:
@@ -197,7 +197,7 @@ int uk_blkdev_queue_get_info(struct uk_blkdev *dev, uint16_t queue_id,
  *	to retrieve limitations.
  * @param queue_conf
  *	The pointer to the configuration data to be used for the queue.
- *	This can be shared across multiple queue setups.
+ *	This can be shared across multiple queue configurations.
  * @return
  *	- 0: Success, receive queue correctly set up.
  *	- <0: Unable to allocate and set up the ring descriptors.
@@ -496,12 +496,12 @@ int uk_blkdev_stop(struct uk_blkdev *dev);
  * @param queue_id
  *	The index of the queue to release.
  *	The value must be in range [0, nb_queue -1] previously supplied
- *	to uk_blkdev_configure()
- *	@return
+ *	to uk_blkdev_queue_configure()
+ * @return
  *	- 0: Success
  *	- (<0): on error returned by driver
  */
-int uk_blkdev_queue_release(struct uk_blkdev *dev, uint16_t queue_id);
+int uk_blkdev_queue_unconfigure(struct uk_blkdev *dev, uint16_t queue_id);
 
 /**
  * Close a stopped Unikraft block device.
diff --git a/lib/ukblkdev/include/uk/blkdev_core.h b/lib/ukblkdev/include/uk/blkdev_core.h
index 56632c7f5..11a642c40 100644
--- a/lib/ukblkdev/include/uk/blkdev_core.h
+++ b/lib/ukblkdev/include/uk/blkdev_core.h
@@ -207,7 +207,7 @@ typedef int (*uk_blkdev_queue_finish_reqs_t)(struct uk_blkdev *dev,
 typedef int (*uk_blkdev_stop_t)(struct uk_blkdev *dev);
 
 /** Driver callback type to release a queue of an Unikraft block device. */
-typedef int (*uk_blkdev_queue_release_t)(struct uk_blkdev *dev,
+typedef int (*uk_blkdev_queue_unconfigure_t)(struct uk_blkdev *dev,
 		struct uk_blkdev_queue *queue);
 
 /** Driver callback type to unconfigure an Unikraft block device. */
@@ -217,12 +217,12 @@ struct uk_blkdev_ops {
 	uk_blkdev_get_info_t				get_info;
 	uk_blkdev_configure_t				dev_configure;
 	uk_blkdev_queue_get_info_t			queue_get_info;
-	uk_blkdev_queue_configure_t			queue_setup;
+	uk_blkdev_queue_configure_t			queue_configure;
 	uk_blkdev_start_t				dev_start;
 	uk_blkdev_stop_t				dev_stop;
 	uk_blkdev_queue_intr_enable_t			queue_intr_enable;
 	uk_blkdev_queue_intr_disable_t			queue_intr_disable;
-	uk_blkdev_queue_release_t			queue_release;
+	uk_blkdev_queue_unconfigure_t			queue_unconfigure;
 	uk_blkdev_unconfigure_t				dev_unconfigure;
 };
 
diff --git a/plat/drivers/virtio/virtio_blk.c b/plat/drivers/virtio/virtio_blk.c
index 262355b49..dac8eb389 100644
--- a/plat/drivers/virtio/virtio_blk.c
+++ b/plat/drivers/virtio/virtio_blk.c
@@ -861,12 +861,12 @@ static const struct uk_blkdev_ops virtio_blkdev_ops = {
 		.get_info = virtio_blkdev_get_info,
 		.dev_configure = virtio_blkdev_configure,
 		.queue_get_info = virtio_blkdev_queue_info_get,
-		.queue_setup = virtio_blkdev_queue_setup,
+		.queue_configure = virtio_blkdev_queue_setup,
 		.queue_intr_enable = virtio_blkdev_queue_intr_enable,
 		.dev_start = virtio_blkdev_start,
 		.dev_stop = virtio_blkdev_stop,
 		.queue_intr_disable = virtio_blkdev_queue_intr_disable,
-		.queue_release = virtio_blkdev_queue_release,
+		.queue_unconfigure = virtio_blkdev_queue_release,
 		.dev_unconfigure = virtio_blkdev_unconfigure,
 };
 
diff --git a/plat/xen/drivers/blk/blkfront.c b/plat/xen/drivers/blk/blkfront.c
index 60b634665..a41373409 100644
--- a/plat/xen/drivers/blk/blkfront.c
+++ b/plat/xen/drivers/blk/blkfront.c
@@ -891,8 +891,8 @@ static const struct uk_blkdev_ops blkfront_ops = {
 	.get_info = blkfront_get_info,
 	.dev_configure = blkfront_configure,
 	.queue_get_info = blkfront_queue_get_info,
-	.queue_setup = blkfront_queue_setup,
-	.queue_release = blkfront_queue_release,
+	.queue_configure = blkfront_queue_setup,
+	.queue_unconfigure = blkfront_queue_release,
 	.dev_start = blkfront_start,
 	.dev_stop = blkfront_stop,
 	.dev_unconfigure = blkfront_unconfigure,
-- 
2.20.1


From minios-devel-bounces@lists.xenproject.org Tue Dec 22 15:38:36 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Tue, 22 Dec 2020 15:38:36 +0000
Received: from list by lists.xenproject.org with outflank-mailman.57941.101610 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1krjkC-0005eI-JX; Tue, 22 Dec 2020 15:38:36 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 57941.101610; Tue, 22 Dec 2020 15:38: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 1krjkC-0005eB-G3; Tue, 22 Dec 2020 15:38:36 +0000
Received: by outflank-mailman (input) for mailman id 57941;
 Tue, 22 Dec 2020 15:38:35 +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=53M6=F2=neclab.eu=simon.kuenzer@srs-us1.protection.inumbo.net>)
 id 1krjkB-0005b4-7Z
 for minios-devel@lists.xen.org; Tue, 22 Dec 2020 15:38:35 +0000
Received: from mailer2.neclab.eu (unknown [195.37.70.41])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 7d8fb24c-0d05-4b4a-8bd1-bf1a8c4595ed;
 Tue, 22 Dec 2020 15:38:34 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
 by mailer2.neclab.eu (Postfix) with ESMTP id B18A2F223E;
 Tue, 22 Dec 2020 16:38:33 +0100 (CET)
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 O1tqdqBtpT-y; Tue, 22 Dec 2020 16:38:33 +0100 (CET)
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 89CFDF2237;
 Tue, 22 Dec 2020 16:38:29 +0100 (CET)
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.2106.2; Tue, 22 Dec
 2020 16:38:12 +0100
X-BeenThere: minios-devel@lists.xenproject.org
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
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: 7d8fb24c-0d05-4b4a-8bd1-bf1a8c4595ed
X-Virus-Scanned: Amavisd on Debian GNU/Linux (atlas-b.office.hd)
X-ENC: Last-Hop-TLS-encrypted
X-ENC: Last-Hop-TLS-encrypted
From: Simon Kuenzer <simon.kuenzer@neclab.eu>
To: <minios-devel@lists.xen.org>, <lrbarbulescu@gmail.com>
CC: Simon Kuenzer <simon.kuenzer@neclab.eu>
Subject: [UNIKRAFT PATCH v2 6/7] lib/ukblkdev: Provide `uk_blkdev_size()`
Date: Tue, 22 Dec 2020 16:37:57 +0100
Message-ID: <20201222153758.1731-7-simon.kuenzer@neclab.eu>
X-Mailer: git-send-email 2.20.1
In-Reply-To: <20201222153758.1731-1-simon.kuenzer@neclab.eu>
References: <20201222153758.1731-1-simon.kuenzer@neclab.eu>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Content-Type: text/plain
X-Originating-IP: [192.168.24.96]
X-ClientProxiedBy: oberon.office.hd (192.168.24.90) To puck.office.hd
 (192.168.24.91)

This commits provides a shortcut macro for retrieving the block device size in
number of bytes.

Signed-off-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
---
 lib/ukblkdev/include/uk/blkdev.h | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/lib/ukblkdev/include/uk/blkdev.h b/lib/ukblkdev/include/uk/blkdev.h
index 56b95c88c..1861bb3b7 100644
--- a/lib/ukblkdev/include/uk/blkdev.h
+++ b/lib/ukblkdev/include/uk/blkdev.h
@@ -255,6 +255,9 @@ static inline const struct uk_blkdev_cap *uk_blkdev_capabilities(
 #define uk_blkdev_sectors(blkdev) \
 	(uk_blkdev_capabilities(blkdev)->sectors)
 
+#define uk_blkdev_size(blkdev) \
+	((size_t) uk_blkdev_sectors(blkdev) * uk_blkdev_ssize(blkdev))
+
 #define uk_blkdev_ioalign(blkdev) \
 	(uk_blkdev_capabilities(blkdev)->ioalign)
 /**
-- 
2.20.1


From minios-devel-bounces@lists.xenproject.org Tue Dec 22 15:38:36 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Tue, 22 Dec 2020 15:38:36 +0000
Received: from list by lists.xenproject.org with outflank-mailman.57942.101615 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1krjkC-0005ec-NM; Tue, 22 Dec 2020 15:38:36 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 57942.101615; Tue, 22 Dec 2020 15:38: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 1krjkC-0005eM-Hp; Tue, 22 Dec 2020 15:38:36 +0000
Received: by outflank-mailman (input) for mailman id 57942;
 Tue, 22 Dec 2020 15:38:35 +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=53M6=F2=neclab.eu=simon.kuenzer@srs-us1.protection.inumbo.net>)
 id 1krjkB-0005b4-Da
 for minios-devel@lists.xen.org; Tue, 22 Dec 2020 15:38:35 +0000
Received: from mailer1.neclab.eu (unknown [195.37.70.40])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 11a709ad-e53e-4618-8fd6-b485edb0c835;
 Tue, 22 Dec 2020 15:38:34 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
 by mailer1.neclab.eu (Postfix) with ESMTP id CA47910400E;
 Tue, 22 Dec 2020 16:38:33 +0100 (CET)
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 7udgCRxdOPDt; Tue, 22 Dec 2020 16:38:33 +0100 (CET)
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 A8C5A103C92;
 Tue, 22 Dec 2020 16:38:33 +0100 (CET)
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.2106.2; Tue, 22 Dec
 2020 16:38:13 +0100
X-BeenThere: minios-devel@lists.xenproject.org
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
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: 11a709ad-e53e-4618-8fd6-b485edb0c835
X-Virus-Scanned: Amavisd on Debian GNU/Linux (atlas-a.office.hd)
X-ENC: Last-Hop-TLS-encrypted
X-ENC: Last-Hop-TLS-encrypted
From: Simon Kuenzer <simon.kuenzer@neclab.eu>
To: <minios-devel@lists.xen.org>, <lrbarbulescu@gmail.com>
CC: Simon Kuenzer <simon.kuenzer@neclab.eu>
Subject: [UNIKRAFT PATCH v2 7/7] lib/ukblkdev: blkdev.h: Description about interrupts
Date: Tue, 22 Dec 2020 16:37:58 +0100
Message-ID: <20201222153758.1731-8-simon.kuenzer@neclab.eu>
X-Mailer: git-send-email 2.20.1
In-Reply-To: <20201222153758.1731-1-simon.kuenzer@neclab.eu>
References: <20201222153758.1731-1-simon.kuenzer@neclab.eu>
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)

Signed-off-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
---
 lib/ukblkdev/include/uk/blkdev.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lib/ukblkdev/include/uk/blkdev.h b/lib/ukblkdev/include/uk/blkdev.h
index 1861bb3b7..3e42eb98a 100644
--- a/lib/ukblkdev/include/uk/blkdev.h
+++ b/lib/ukblkdev/include/uk/blkdev.h
@@ -413,7 +413,8 @@ int uk_blkdev_queue_submit_one(struct uk_blkdev *dev, uint16_t queue_id,
 					     | UK_BLKDEV_STATUS_MORE))
 
 /**
- * Get responses from the queue
+ * Get responses from the queue and re-enable interrupts on the target queue
+ * when they were enabled before.
  *
  * @param dev
  *	The Unikraft Block Device
-- 
2.20.1


From minios-devel-bounces@lists.xenproject.org Tue Dec 22 15:39:28 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Tue, 22 Dec 2020 15:39:28 +0000
Received: from list by lists.xenproject.org with outflank-mailman.57952.101620 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1krjl1-0005mv-Ox; Tue, 22 Dec 2020 15:39:27 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 57952.101620; Tue, 22 Dec 2020 15:39:27 +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 1krjl1-0005mn-LM; Tue, 22 Dec 2020 15:39:27 +0000
Received: by outflank-mailman (input) for mailman id 57952;
 Tue, 22 Dec 2020 15:39: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=53M6=F2=neclab.eu=simon.kuenzer@srs-us1.protection.inumbo.net>)
 id 1krjkz-0005mV-PP
 for minios-devel@lists.xen.org; Tue, 22 Dec 2020 15:39:25 +0000
Received: from mailer2.neclab.eu (unknown [195.37.70.41])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 5ba779e8-90e3-4b99-a972-c664e9e9b878;
 Tue, 22 Dec 2020 15:39:24 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
 by mailer2.neclab.eu (Postfix) with ESMTP id D9E73F223E;
 Tue, 22 Dec 2020 16:39:23 +0100 (CET)
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-pBXqKsyMi1; Tue, 22 Dec 2020 16:39:23 +0100 (CET)
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 B3227F2237;
 Tue, 22 Dec 2020 16:39:19 +0100 (CET)
Received: from [10.7.2.24] (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.2106.2; Tue, 22 Dec
 2020 16:39:19 +0100
X-BeenThere: minios-devel@lists.xenproject.org
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
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: 5ba779e8-90e3-4b99-a972-c664e9e9b878
X-Virus-Scanned: Amavisd on Debian GNU/Linux (atlas-b.office.hd)
X-ENC: Last-Hop-TLS-encrypted
X-ENC: Last-Hop-TLS-encrypted
Subject: Re: [UNIKRAFT PATCH 0/7] lib/ukblkdev: Minor API improvements and
 fixes
To: Laurentiu Barbulescu <lrbarbulescu@gmail.com>
CC: <minios-devel@lists.xen.org>
References: <20201022115507.4983-1-simon.kuenzer@neclab.eu>
 <45e8ca9192cb76e52747941a2c47829c367d8f84.1607080324.git.lrbarbulescu@gmail.com>
From: Simon Kuenzer <simon.kuenzer@neclab.eu>
Message-ID: <2c1d18f2-e01c-c1b9-453f-d07ff905ff81@neclab.eu>
Date: Tue, 22 Dec 2020 16:39:18 +0100
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0)
 Gecko/20100101 Thunderbird/78.6.0
MIME-Version: 1.0
In-Reply-To: <45e8ca9192cb76e52747941a2c47829c367d8f84.1607080324.git.lrbarbulescu@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)

Hi Laurentiu,

thanks a lot for your review. I adopted your comments with a v2 of this 
series. Everything else stayed untouched ;-).

Thanks,

Simon

On 04.12.20 12:32, Laurentiu Barbulescu wrote:
> Hi Simon,
> 
> Overall looks good.
> I have only 2 comments, but I will leave them at the corresponding patches.
> 
> Best wishes,
> Laurentiu
> 


From minios-devel-bounces@lists.xenproject.org Tue Dec 22 16:55:19 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Tue, 22 Dec 2020 16:55:19 +0000
Received: from list by lists.xenproject.org with outflank-mailman.58006.101756 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1krkwQ-0005ZN-86; Tue, 22 Dec 2020 16:55:18 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 58006.101756; Tue, 22 Dec 2020 16:55: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 1krkwQ-0005ZG-5A; Tue, 22 Dec 2020 16:55:18 +0000
Received: by outflank-mailman (input) for mailman id 58006;
 Tue, 22 Dec 2020 16:55:16 +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=53M6=F2=neclab.eu=simon.kuenzer@srs-us1.protection.inumbo.net>)
 id 1krkwO-0005ZB-Qv
 for minios-devel@lists.xen.org; Tue, 22 Dec 2020 16:55:16 +0000
Received: from mailer1.neclab.eu (unknown [195.37.70.40])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 8d2edbc3-be0d-4918-85b0-0d227fb2baaa;
 Tue, 22 Dec 2020 16:55:14 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
 by mailer1.neclab.eu (Postfix) with ESMTP id 672CA103B89;
 Tue, 22 Dec 2020 17:55:13 +0100 (CET)
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 Zc_0rGcTAXHy; Tue, 22 Dec 2020 17:55:13 +0100 (CET)
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 40E17100BD9;
 Tue, 22 Dec 2020 17:55:13 +0100 (CET)
Received: from [10.7.2.24] (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.2106.2; Tue, 22 Dec
 2020 17:55:12 +0100
X-BeenThere: minios-devel@lists.xenproject.org
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
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: 8d2edbc3-be0d-4918-85b0-0d227fb2baaa
X-Virus-Scanned: Amavisd on Debian GNU/Linux (atlas-a.office.hd)
X-ENC: Last-Hop-TLS-encrypted
X-ENC: Last-Hop-TLS-encrypted
Subject: Re: [Minios-devel,v2,0/5] Initrd support
To: gabrielmocanu <gabi.mocanu98@gmail.com>, <minios-devel@lists.xen.org>
References: <20201110233539.1028-1-gabi.mocanu98@gmail.com>
From: Simon Kuenzer <simon.kuenzer@neclab.eu>
Message-ID: <18eaad43-977e-4bd3-30ca-7c644d0e3352@neclab.eu>
Date: Tue, 22 Dec 2020 17:55:12 +0100
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0)
 Gecko/20100101 Thunderbird/78.6.0
MIME-Version: 1.0
In-Reply-To: <20201110233539.1028-1-gabi.mocanu98@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)

Hi Gabriel,

thanks a lot for your work! Sorry that I got slightly confused by this 
series. I think we should integrate your fixes into series 1151. Can you 
send a reworked patch series of 1151 that includes your fixes at the 
according commits?

Thanks,

Simon

On 11.11.20 00:35, gabrielmocanu wrote:
> This patch series depends on the series 1151
> https://patchwork.unikraft.org/project/unikraft/list/?series=1151&state=*
> 
> Change since v2:
>      - Define struct k_stat in a header file and modify mode_t to
>        k_mode_T file in syscall.h
>      - Change close to sys_close and change some error messages
>      - Rename cpio to ukcpio and create Config.uk for the cpio
>      - Modify vfscore/Config.uk to autoselect RamFS and ukcpio
> 
> Robert Hrusecky (5):
>    lib/vfscore: Add support to mount initramfs to root
>    lib/cpio: Add CPIO extraction functionality
>    lib/cpio: Create empty CPIO extraction library
>    plat/linuxu: Add initrd memory region
>    plat/linuxu: Add fstat and open host system calls
> 
>   plat/linuxu/include/linuxu/mode.h           |  8 +++++
>   plat/linuxu/include/linuxu/stat.h           | 39 +++++++++++++++++++++
>   plat/linuxu/include/linuxu/syscall-arm_32.h |  1 +
>   plat/linuxu/include/linuxu/syscall-x86_64.h |  1 +
>   plat/linuxu/include/linuxu/syscall.h        | 20 +++++++++++
>   5 files changed, 69 insertions(+)
>   create mode 100644 plat/linuxu/include/linuxu/mode.h
>   create mode 100644 plat/linuxu/include/linuxu/stat.h
> 


From minios-devel-bounces@lists.xenproject.org Wed Dec 23 07:39:18 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Wed, 23 Dec 2020 07:39:18 +0000
Received: from list by lists.xenproject.org with outflank-mailman.58193.102183 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1kryjs-0006VK-2c; Wed, 23 Dec 2020 07:39:16 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 58193.102183; Wed, 23 Dec 2020 07:39: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 1kryjr-0006VD-Vj; Wed, 23 Dec 2020 07:39:15 +0000
Received: by outflank-mailman (input) for mailman id 58193;
 Wed, 23 Dec 2020 07:39: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=BSFQ=F3=arm.com=justin.he@srs-us1.protection.inumbo.net>)
 id 1kryjq-0006V8-Gf
 for minios-devel@lists.xenproject.org; Wed, 23 Dec 2020 07:39:14 +0000
Received: from foss.arm.com (unknown [217.140.110.172])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTP
 id 10df2122-e295-4c5d-a15c-6dcd08335478;
 Wed, 23 Dec 2020 07:39:11 +0000 (UTC)
Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14])
 by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 4489F30E;
 Tue, 22 Dec 2020 23:39:11 -0800 (PST)
Received: from localhost.localdomain (entos-thunderx2-02.shanghai.arm.com
 [10.169.212.215])
 by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 19F5F3F66E;
 Tue, 22 Dec 2020 23:39:08 -0800 (PST)
X-BeenThere: minios-devel@lists.xenproject.org
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
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: 10df2122-e295-4c5d-a15c-6dcd08335478
From: Jia He <justin.he@arm.com>
To: minios-devel@lists.xenproject.org,
	Felipe Huici <felipe.huici@neclab.eu>
Cc: Simon Kuenzer <simon.kuenzer@neclab.eu>,
	Sharan.Santhanam@neclab.eu,
	Song Zhu <Song.Zhu@arm.com>,
	Jia He <justin.he@arm.com>
Subject: [UNIKRAFT PATCH RFCv4 00/35] Impelment virtio_mmio and pci ecam controller for arm64 kvm plat
Date: Wed, 23 Dec 2020 15:38:22 +0800
Message-Id: <20201223073857.118076-1-justin.he@arm.com>
X-Mailer: git-send-email 2.17.1

To support virtio-* family device, we have 2 choices (virtio mmio, virtio pci)
on arm64 kvm plat. This patch series enable the support of virtio mmio and pci.
virtio pci needs pci controller ECAM mode in arm64 Unikraft.

Patch 1-5 implement the platform bus and virtio mmio skeleton.
Patch 8-10 implement the pci ecam skeleton
Patch 12-13 introduce the new probing interface for virtio mmio and pci
      on arm.
Patch 7,11,14,15,16 lib/fdt or ofw/fdt changes
Patch 17-19 split the arch specific pci bus codes into different directory
Else are the bug fixing or minor changes.

Test
====
1. The test case is a simple httpreply app.
test qemu cmdline:
a. for virtio mmio
-device virtio-net-device,id=net1,netdev=hostnet1,mac=52:54:00:09:a4:38
b. for virtio pci
-device 
virtio-net-pci,id=net0,netdev=hostnet0,mac=52:54:00:09:a4:31,disable-modern=on

2. Besides, I also tested it with nginx app which was suggested by Felipe. ping
and wget both worked. But this needs a workaround in libngix app to avoid crash
diff --git a/src/core/nginx.c b/src/core/nginx.c
index 9fcb0eb..3afcb66 100644
@@ -1101,18 +1103,11 @@ ngx_core_module_init_conf(ngx_cycle_t *cycle, void *conf)

     if (ccf->user == (uid_t) NGX_CONF_UNSET_UINT && geteuid() == 0) {
         struct group   *grp;
-       struct passwd  *pwd;

         ngx_set_errno(0);
-       pwd = getpwnam(NGX_USER);
-       if (pwd == NULL) {
-           ngx_log_error(NGX_LOG_EMERG, cycle->log, ngx_errno,
-                         "getpwnam(\"" NGX_USER "\") failed");
-           return NGX_CONF_ERROR;
-       }

         ccf->username = NGX_USER;
-       ccf->user = pwd->pw_uid;
+       ccf->user = 0;

         ngx_set_errno(0);
         grp = getgrnam(NGX_GROUP);
@@ -1193,7 +1188,6 @@ ngx_set_user(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
     ngx_core_conf_t  *ccf = conf;

     char            *group;
-    struct passwd    *pwd;
     struct group     *grp;
     ngx_str_t  *value;

@@ -1214,14 +1208,8 @@ ngx_set_user(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
     ccf->username = (char *) value[1].data;

     ngx_set_errno(0);
-    pwd = getpwnam((const char *) value[1].data);
-    if (pwd == NULL) {
-       ngx_conf_log_error(NGX_LOG_EMERG, cf, ngx_errno,
-                          "getpwnam(\"%s\") failed", value[1].data);
-       return NGX_CONF_ERROR;
-    }

-    ccf->user = pwd->pw_uid;
+    ccf->user = 0;

     group = (char *) ((cf->args->nelts == 2) ? value[1].data : value[2].data);

Besides, to avoid crashing, the lib posix-user also needs the workaround:
diff --git a/lib/posix-user/user.c b/lib/posix-user/user.c
index 6809d41..c899517 100644
--- a/lib/posix-user/user.c
+++ b/lib/posix-user/user.c
@@ -131,6 +131,7 @@ char *getlogin(void)
 
 void setpwent(void)
 {
+       return;
        iter = UK_SLIST_FIRST(&passwds);
 }
 
@@ -180,6 +181,8 @@ struct passwd *getpwent(void)
 {
        struct passwd *pwd;
 
+       return NULL;
+
        if (iter == NULL)
                return NULL;

This posix-user workaround doesn't need in v3,which might be newly introduced
from v3. This might not be relevant to this patch series itself.

Notes:
======
 - There might be many redundant macro definitions btw arm and x86 in
   pci_bus.h. I will fix it in the future.
 - patch 11 fdt_node_offset_idx_by_compatible_list is also needed in
   Jianyong Wu's rtc patch series. He had posted it, but I still list
   it here for review.

Changes:
========
v4: Add patch 33 and 34. Insert patch 18.
    Rebase the lastest code (patch 17 is significantly changed)
v3: Fix bugs in virtio 9p and arm exception handler to make nginx work
v2: Address the comments from felipe
  - fix the compilation warnings
  - change the better memory barriar for virtio communication
  - fix a bug in virtio-9p
  - make it compilable for individual patch
v1: 
https://lists.xenproject.org/archives/html/minios-devel/2020-03/msg00056.html

---
Jia He (35):
  plat/virtio: Introduce several helpers for virtio ring
  plat/platform: Introduce new platform bus
  plat/virtio: Support virtio_cread/cwrite on arm64
  plat/virtio: Add new virtio_mmio device/driver on arm64
  build: Enable the platform bus and virtio_mmio device on arm64
  plat/kvm: arm64: Fix arm64 memory layout for pcie ecam
  plat/ofw: Export fdt_find_irq_parent_offset
  plat/pci_ecam: Introduce pci/pci_ecam.h
  plat/pci_ecam: Introduce pci ecam skeleton
  lib/ukbus: Adjust default bus register priority
  plat/ofw: Add fdt_node_offset_idx_by_compatible_list
  plat/platform_bus: Add probe/match interface for platform devices
  plat/virtio_mmio: Implement platform probe for virtio_mmio
  plat/ofw: Support completed ranges mapping
  lib/fdt: Fix fdt_address_cell and fdt_size_cell
  plat/ofw: Add fdt_prop_read_bool
  plat/pci_bus: Split specific code into different files
  plat/pci_bus: Pass memory allocation parameter to arch_pci_probe
  plat/pci_bus: arm64: Implement add/probe interfaces on arm64
  build: Make KVM_PCI default enable on arm64
  plat/pci_bus: Change pci_device.base from u16 to unsigned long
  build: Enable pci library on arm64
  plat/pci_ecam: Fix a lot compilation warnings in pci_ecam
  plat/virtio: Fix virtio net device mac negotiation
  plat/virtio: Change irq,base from u16 to u64 on arm64
  plat/virtio: Use better iormb/iowmb on arm64
  plat/platform_bus,virtio_mmio: Avoid useless log storm
  plat/kvm/arm: Add a memory hole at the beginning 128M
  plat/arm: Make sure fpsimd sysregs writing take effects
  plat/virtio_9p: Remove excessive check for max virtqueue size
  plat/virtio_mmio: Fix virtqueue size for virtio 9p device
  plat/arm/generic_timer: Fix assert in ns_to_ticks
  plat/kvm/arm: Fix x19 corruption by interrupt handler
  lib/posix-user: Export several posix-user interfaces
  plat/virtio: Fix the return value check for virtio_cread_bytes_many()

 lib/fdt/exportsyms.uk                       |   1 +
 lib/fdt/fdt_addresses.c                     |  57 +-
 lib/posix-user/exportsyms.uk                |  12 +-
 lib/ukbus/include/uk/bus.h                  |  16 +-
 plat/common/arm/generic_timer.c             |   4 +-
 plat/common/arm/pci_bus_arm64.c             | 201 +++++++
 plat/common/include/arm/arm64/cpu.h         |   6 +
 plat/common/include/arm/arm64/cpu_defs.h    |   3 +
 plat/common/include/pci/pci_bus.h           | 121 ++++-
 plat/common/include/pci/pci_ecam.h          | 101 ++++
 plat/common/include/platform_bus.h          | 116 +++++
 plat/common/pci_bus.c                       | 247 +--------
 plat/common/pci_ecam.c                      | 524 +++++++++++++++++++
 plat/common/platform_bus.c                  | 236 +++++++++
 plat/common/x86/pci_bus_x86.c               | 241 +++++++++
 plat/drivers/include/ofw/fdt.h              |  74 +++
 plat/drivers/include/virtio/virtio_config.h |  73 ++-
 plat/drivers/include/virtio/virtio_mmio.h   | 137 +++++
 plat/drivers/include/virtio/virtqueue.h     |  33 ++
 plat/drivers/ofw/fdt.c                      |  81 ++-
 plat/drivers/virtio/virtio_9p.c             |   6 +-
 plat/drivers/virtio/virtio_mmio.c           | 550 ++++++++++++++++++++
 plat/drivers/virtio/virtio_net.c            |  15 +-
 plat/drivers/virtio/virtio_pci.c            |  11 +-
 plat/drivers/virtio/virtio_ring.c           |  32 ++
 plat/kvm/Config.uk                          |  14 +-
 plat/kvm/Makefile.uk                        |  29 +-
 plat/kvm/arm/exceptions.S                   |   6 +-
 plat/kvm/arm/pagetable64.S                  |  64 ++-
 plat/kvm/include/kvm-arm/arm64/mm.h         |   7 +-
 30 files changed, 2683 insertions(+), 335 deletions(-)
 create mode 100644 plat/common/arm/pci_bus_arm64.c
 create mode 100644 plat/common/include/pci/pci_ecam.h
 create mode 100644 plat/common/include/platform_bus.h
 create mode 100644 plat/common/pci_ecam.c
 create mode 100644 plat/common/platform_bus.c
 create mode 100644 plat/common/x86/pci_bus_x86.c
 create mode 100644 plat/drivers/include/virtio/virtio_mmio.h
 create mode 100644 plat/drivers/virtio/virtio_mmio.c

-- 
2.17.1



From minios-devel-bounces@lists.xenproject.org Wed Dec 23 07:39:20 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Wed, 23 Dec 2020 07:39:20 +0000
Received: from list by lists.xenproject.org with outflank-mailman.58194.102186 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1kryjw-0006W0-4N; Wed, 23 Dec 2020 07:39:20 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 58194.102186; Wed, 23 Dec 2020 07:39: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 1kryjw-0006Vt-14; Wed, 23 Dec 2020 07:39:20 +0000
Received: by outflank-mailman (input) for mailman id 58194;
 Wed, 23 Dec 2020 07:39: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=BSFQ=F3=arm.com=justin.he@srs-us1.protection.inumbo.net>)
 id 1kryju-0006Vj-QL
 for minios-devel@lists.xenproject.org; Wed, 23 Dec 2020 07:39:18 +0000
Received: from foss.arm.com (unknown [217.140.110.172])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTP
 id 16f5a605-7295-4ef4-aae1-98dce7f2a373;
 Wed, 23 Dec 2020 07:39:16 +0000 (UTC)
Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14])
 by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id E54AE1042;
 Tue, 22 Dec 2020 23:39:13 -0800 (PST)
Received: from localhost.localdomain (entos-thunderx2-02.shanghai.arm.com
 [10.169.212.215])
 by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id C09D43F66E;
 Tue, 22 Dec 2020 23:39:11 -0800 (PST)
X-BeenThere: minios-devel@lists.xenproject.org
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
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: 16f5a605-7295-4ef4-aae1-98dce7f2a373
From: Jia He <justin.he@arm.com>
To: minios-devel@lists.xenproject.org,
	Felipe Huici <felipe.huici@neclab.eu>
Cc: Simon Kuenzer <simon.kuenzer@neclab.eu>,
	Sharan.Santhanam@neclab.eu,
	Song Zhu <Song.Zhu@arm.com>,
	Jia He <justin.he@arm.com>
Subject: [UNIKRAFT PATCH RFCv4 01/35] plat/virtio: Introduce several helpers for virtio ring
Date: Wed, 23 Dec 2020 15:38:23 +0800
Message-Id: <20201223073857.118076-2-justin.he@arm.com>
X-Mailer: git-send-email 2.17.1
In-Reply-To: <20201223073857.118076-1-justin.he@arm.com>
References: <20201223073857.118076-1-justin.he@arm.com>

This patch provides several virtqueue helpers for virtio mmio
initialization.

Signed-off-by: Jia He <justin.he@arm.com>
---
 plat/drivers/include/virtio/virtqueue.h | 33 +++++++++++++++++++++++++
 plat/drivers/virtio/virtio_ring.c       | 32 ++++++++++++++++++++++++
 2 files changed, 65 insertions(+)

diff --git a/plat/drivers/include/virtio/virtqueue.h b/plat/drivers/include/virtio/virtqueue.h
index 1479828..a717541 100644
--- a/plat/drivers/include/virtio/virtqueue.h
+++ b/plat/drivers/include/virtio/virtqueue.h
@@ -82,6 +82,39 @@ struct virtqueue {
  */
 __phys_addr virtqueue_physaddr(struct virtqueue *vq);
 
+/**
+ * Fetch the avail address of the descriptor ring.
+ * @param vq
+ *	Reference to the virtqueue.
+ *
+ * @return
+ *	Return the guest avail address of the vring.
+ */
+__phys_addr virtqueue_get_avail_addr(struct virtqueue *vq);
+
+/**
+ * Fetch the used address of the descriptor ring.
+ * @param vq
+ *	Reference to the virtqueue.
+ *
+ * @return
+ *	Return the guest used address of the vring.
+ */
+__phys_addr virtqueue_get_used_addr(struct virtqueue *vq);
+
+/**
+ * Get the number of vring for virtqueue
+ *
+ * @param vq
+ *	Reference to the virtual queue
+ *
+ * @return
+ *	the number of vring for virtqueue
+ *
+ */
+unsigned int virtqueue_vring_get_num(struct virtqueue *vq);
+
+
 /**
  * Ring interrupt handler. This function is invoked from the interrupt handler
  * in the virtio device for interrupt specific to the ring.
diff --git a/plat/drivers/virtio/virtio_ring.c b/plat/drivers/virtio/virtio_ring.c
index 0a5c3f3..bda7549 100644
--- a/plat/drivers/virtio/virtio_ring.c
+++ b/plat/drivers/virtio/virtio_ring.c
@@ -262,6 +262,38 @@ __phys_addr virtqueue_physaddr(struct virtqueue *vq)
 	return ukplat_virt_to_phys(vrq->vring_mem);
 }
 
+__phys_addr virtqueue_get_avail_addr(struct virtqueue *vq)
+{
+	struct virtqueue_vring *vrq = NULL;
+
+	UK_ASSERT(vq);
+
+	vrq = to_virtqueue_vring(vq);
+	return virtqueue_physaddr(vq) +
+		((char *)vrq->vring.avail - (char *)vrq->vring.desc);
+}
+
+__phys_addr virtqueue_get_used_addr(struct virtqueue *vq)
+{
+	struct virtqueue_vring *vrq = NULL;
+
+	UK_ASSERT(vq);
+
+	vrq = to_virtqueue_vring(vq);
+	return virtqueue_physaddr(vq) +
+		((char *)vrq->vring.used - (char *)vrq->vring.desc);
+}
+
+unsigned int virtqueue_vring_get_num(struct virtqueue *vq)
+{
+	struct virtqueue_vring *vrq = NULL;
+
+	UK_ASSERT(vq);
+
+	vrq = to_virtqueue_vring(vq);
+	return vrq->vring.num;
+}
+
 int virtqueue_buffer_dequeue(struct virtqueue *vq, void **cookie, __u32 *len)
 {
 	struct virtqueue_vring *vrq = NULL;
-- 
2.17.1



From minios-devel-bounces@lists.xenproject.org Wed Dec 23 07:39:20 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Wed, 23 Dec 2020 07:39:20 +0000
Received: from list by lists.xenproject.org with outflank-mailman.58195.102189 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1kryjw-0006WJ-7w; Wed, 23 Dec 2020 07:39:20 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 58195.102189; Wed, 23 Dec 2020 07:39: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 1kryjw-0006W5-2a; Wed, 23 Dec 2020 07:39:20 +0000
Received: by outflank-mailman (input) for mailman id 58195;
 Wed, 23 Dec 2020 07:39: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=BSFQ=F3=arm.com=justin.he@srs-us1.protection.inumbo.net>)
 id 1kryjv-0006V8-Bn
 for minios-devel@lists.xenproject.org; Wed, 23 Dec 2020 07:39:19 +0000
Received: from foss.arm.com (unknown [217.140.110.172])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTP
 id 8a4f4391-7b1e-43d9-8a92-b1c5cafa57ac;
 Wed, 23 Dec 2020 07:39:16 +0000 (UTC)
Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14])
 by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 9659B11D4;
 Tue, 22 Dec 2020 23:39:16 -0800 (PST)
Received: from localhost.localdomain (entos-thunderx2-02.shanghai.arm.com
 [10.169.212.215])
 by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 718D33F66E;
 Tue, 22 Dec 2020 23:39:14 -0800 (PST)
X-BeenThere: minios-devel@lists.xenproject.org
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
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: 8a4f4391-7b1e-43d9-8a92-b1c5cafa57ac
From: Jia He <justin.he@arm.com>
To: minios-devel@lists.xenproject.org,
	Felipe Huici <felipe.huici@neclab.eu>
Cc: Simon Kuenzer <simon.kuenzer@neclab.eu>,
	Sharan.Santhanam@neclab.eu,
	Song Zhu <Song.Zhu@arm.com>,
	Jia He <justin.he@arm.com>
Subject: [UNIKRAFT PATCH RFCv4 02/35] plat/platform: Introduce new platform bus
Date: Wed, 23 Dec 2020 15:38:24 +0800
Message-Id: <20201223073857.118076-3-justin.he@arm.com>
X-Mailer: git-send-email 2.17.1
In-Reply-To: <20201223073857.118076-1-justin.he@arm.com>
References: <20201223073857.118076-1-justin.he@arm.com>

platform bus is a simple bus interface for many devices, including
virtio_mmio device on arm64

Signed-off-by: Jia He <justin.he@arm.com>
---
 plat/common/include/platform_bus.h | 100 ++++++++++++
 plat/common/platform_bus.c         | 235 +++++++++++++++++++++++++++++
 2 files changed, 335 insertions(+)
 create mode 100644 plat/common/include/platform_bus.h
 create mode 100644 plat/common/platform_bus.c

diff --git a/plat/common/include/platform_bus.h b/plat/common/include/platform_bus.h
new file mode 100644
index 0000000..efc21a0
--- /dev/null
+++ b/plat/common/include/platform_bus.h
@@ -0,0 +1,100 @@
+/* SPDX-License-Identifier: BSD-3-Clause */
+/*
+ * Authors: Jia He <justin.he@arm.com>
+ *
+ * Copyright (c) 2020, Arm Ltd. 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_COMMON_PF_BUS_H__
+#define __UKPLAT_COMMON_PF_BUS_H__
+
+#include <uk/bus.h>
+#include <uk/alloc.h>
+
+/**
+ * A structure describing an ID for a Platform driver. Each driver provides a
+ * table of these IDs for each device that it supports.
+ */
+#define PLATFORM_DEVICE_ID_START (0x100)
+#define VIRTIO_MMIO_ID PLATFORM_DEVICE_ID_START
+#define PLATFORM_DEVICE_ID_END (PLATFORM_DEVICE_ID_START + 0x100)
+
+#define UK_MAX_VIRTIO_MMIO_DEVICE (0x2)
+
+struct pf_device_id {
+	uint16_t device_id;
+};
+
+struct pf_device;
+
+typedef int (*pf_driver_add_func_t)(struct pf_device *);
+typedef int (*pf_driver_init_func_t)(struct uk_alloc *a);
+
+struct pf_driver {
+	UK_TAILQ_ENTRY(struct pf_driver) next;
+	const struct pf_device_id *device_ids;
+	pf_driver_init_func_t init; /* optional */
+	pf_driver_add_func_t add_dev;
+};
+UK_TAILQ_HEAD(pf_driver_list, struct pf_driver);
+
+enum pf_device_state {
+	PF_DEVICE_STATE_RESET = 0,
+	PF_DEVICE_STATE_RUNNING
+};
+
+struct pf_device {
+	UK_TAILQ_ENTRY(struct pf_device) next; /**< used by pf_bus_handler */
+	struct pf_device_id  id;
+	struct pf_driver     *drv;
+	enum pf_device_state state;
+
+	uint64_t base;
+	unsigned long irq;
+};
+UK_TAILQ_HEAD(pf_device_list, struct pf_device);
+
+
+#define PF_REGISTER_DRIVER(b)                  \
+	_PF_REGISTER_DRIVER(__LIBNAME__, b)
+
+#define _PF_REGFNNAME(x, y)      x##y
+
+#define _PF_REGISTER_DRIVER(libname, b)				\
+	static void __constructor_prio(105)				\
+	_PF_REGFNNAME(libname, _pf_register_driver)(void)		\
+	{								\
+		_pf_register_driver((b));				\
+	}
+
+/* Do not use this function directly: */
+void _pf_register_driver(struct pf_driver *drv);
+
+#endif /* __UKPLAT_COMMON_PF_BUS_H__ */
diff --git a/plat/common/platform_bus.c b/plat/common/platform_bus.c
new file mode 100644
index 0000000..1410e71
--- /dev/null
+++ b/plat/common/platform_bus.c
@@ -0,0 +1,235 @@
+/* SPDX-License-Identifier: BSD-3-Clause */
+/*
+ * Authors: Jia He <justin.he@arm.com>
+ *
+ * Copyright (c) 2020, Arm Ltd. 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 <string.h>
+#include <uk/print.h>
+#include <uk/plat/common/cpu.h>
+#include <platform_bus.h>
+#include <libfdt.h>
+#include <kvm/config.h>
+#include <gic/gic-v2.h>
+#include <ofw/fdt.h>
+
+#define fdt_start (_libkvmplat_cfg.dtb)
+
+struct pf_bus_handler {
+	struct uk_bus b;
+	struct uk_alloc *a;
+	struct pf_driver_list drv_list;  /**< List of platform drivers */
+	int drv_list_initialized;
+	struct pf_device_list dev_list;  /**< List of platform devices */
+};
+static struct pf_bus_handler pfh;
+
+static const char * const pf_device_list[] = {
+	"virtio,mmio",
+};
+
+static inline int pf_device_id_match(const struct pf_device_id *id0,
+					const struct pf_device_id *id1)
+{
+	int rc = 0;
+
+	if (id0->device_id == id1->device_id)
+		rc = 1;
+
+	return rc;
+}
+
+static inline struct pf_driver *pf_find_driver(struct pf_device_id *id)
+{
+	struct pf_driver *drv;
+
+	UK_TAILQ_FOREACH(drv, &pfh.drv_list, next) {
+		if (pf_device_id_match(id, drv->device_ids)) {
+			uk_pr_debug("pf driver found devid=%d\n", drv->device_ids->device_id);
+			return drv; /* driver found */
+		}
+	}
+
+	uk_pr_info("no pf driver found\n");
+
+	return NULL; /* no driver found */
+}
+
+static inline int pf_driver_add_device(struct pf_driver *drv,
+					struct pf_device_id *devid,
+					__u64 dev_base,
+					int dev_irq)
+{
+	struct pf_device *dev;
+	int ret;
+
+	UK_ASSERT(drv != NULL);
+	UK_ASSERT(drv->add_dev != NULL);
+
+	dev = (struct pf_device *) uk_calloc(pfh.a, 1, sizeof(*dev));
+	if (!dev) {
+		uk_pr_err("Platform : Failed to initialize: Out of memory!\n");
+		return -ENOMEM;
+	}
+
+	memcpy(&dev->id, devid, sizeof(dev->id));
+	uk_pr_debug("pf_driver_add_device dev->id=%d\n", dev->id.device_id);
+
+	dev->base = dev_base;
+	dev->irq = dev_irq;
+
+	ret = drv->add_dev(dev);
+	if (ret < 0) {
+		uk_pr_err("Platform Failed to initialize device driver\n");
+		uk_free(pfh.a, dev);
+	}
+
+	return ret;
+}
+
+static int pf_probe(void)
+{
+	struct pf_device_id devid;
+	struct pf_driver *drv;
+	int i;
+	int end_offset = -1;
+	int ret = -ENODEV;
+	const fdt32_t *prop;
+	int type, hwirq, prop_len;
+	__u64 reg_base;
+	__phys_addr dev_base;
+	int dev_irq;
+
+	uk_pr_info("Probe PF\n");
+
+	/* We only support virtio_mmio as a platform device here.
+	 * A loop here is needed for finding drivers if more devices
+	 */
+	devid.device_id = VIRTIO_MMIO_ID;
+
+	drv = pf_find_driver(&devid);
+	if (!drv) {
+		uk_pr_info("<no driver>\n");
+		return -ENODEV;
+	}
+
+	uk_pr_info("driver %p\n", drv);
+
+	/* qemu creates virtio devices in reverse order */
+	for (i = 0; i < UK_MAX_VIRTIO_MMIO_DEVICE; i++) {
+		end_offset = fdt_node_offset_by_compatible_list(fdt_start,
+							end_offset,
+							pf_device_list);
+		if (end_offset == -FDT_ERR_NOTFOUND) {
+			uk_pr_info("device not found in fdt\n");
+			goto error_exit;
+		} else {
+			prop = fdt_getprop(fdt_start, end_offset, "interrupts", &prop_len);
+			if (!prop) {
+				uk_pr_err("irq of device not found in fdt\n");
+				goto error_exit;
+			}
+
+			type = fdt32_to_cpu(prop[0]);
+			hwirq = fdt32_to_cpu(prop[1]);
+
+			prop = fdt_getprop(fdt_start, end_offset, "reg", &prop_len);
+			if (!prop) {
+				uk_pr_err("reg of device not found in fdt\n");
+				goto error_exit;
+			}
+
+			/* only care about base addr, ignore the size */
+			reg_base = fdt32_to_cpu(prop[0]);
+			reg_base = reg_base << 32 | fdt32_to_cpu(prop[1]);
+		}
+
+		dev_base = reg_base;
+		dev_irq = gic_irq_translate(type, hwirq);
+
+		ret = pf_driver_add_device(drv, &devid, dev_base, dev_irq);
+	}
+
+	return ret;
+
+error_exit:
+	return -ENODEV;
+}
+
+
+static int pf_init(struct uk_alloc *a)
+{
+	struct pf_driver *drv, *drv_next;
+	int ret = 0;
+
+	UK_ASSERT(a != NULL);
+
+	pfh.a = a;
+
+	if (!pfh.drv_list_initialized) {
+		UK_TAILQ_INIT(&pfh.drv_list);
+		pfh.drv_list_initialized = 1;
+	}
+	UK_TAILQ_INIT(&pfh.dev_list);
+
+	UK_TAILQ_FOREACH_SAFE(drv, &pfh.drv_list, next, drv_next) {
+		if (drv->init) {
+			ret = drv->init(a);
+			if (ret == 0)
+				continue;
+			uk_pr_err("Failed to initialize pf driver %p: %d\n",
+				  drv, ret);
+			UK_TAILQ_REMOVE(&pfh.drv_list, drv, next);
+		}
+	}
+	return 0;
+}
+
+void _pf_register_driver(struct pf_driver *drv)
+{
+	UK_ASSERT(drv != NULL);
+	uk_pr_debug("_pf_register_driver %p\n", drv);
+
+	if (!pfh.drv_list_initialized) {
+		UK_TAILQ_INIT(&pfh.drv_list);
+		pfh.drv_list_initialized = 1;
+	}
+	UK_TAILQ_INSERT_TAIL(&pfh.drv_list, drv, next);
+}
+
+
+/* Register this bus driver to libukbus:
+ */
+static struct pf_bus_handler pfh = {
+	.b.init = pf_init,
+	.b.probe = pf_probe
+};
+UK_BUS_REGISTER(&pfh.b);
-- 
2.17.1



From minios-devel-bounces@lists.xenproject.org Wed Dec 23 07:39:25 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Wed, 23 Dec 2020 07:39:25 +0000
Received: from list by lists.xenproject.org with outflank-mailman.58196.102195 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1kryk1-0006Y5-8S; Wed, 23 Dec 2020 07:39:25 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 58196.102195; Wed, 23 Dec 2020 07:39: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 1kryk1-0006Xy-50; Wed, 23 Dec 2020 07:39:25 +0000
Received: by outflank-mailman (input) for mailman id 58196;
 Wed, 23 Dec 2020 07:39:24 +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=BSFQ=F3=arm.com=justin.he@srs-us1.protection.inumbo.net>)
 id 1kryk0-0006V8-C2
 for minios-devel@lists.xenproject.org; Wed, 23 Dec 2020 07:39:24 +0000
Received: from foss.arm.com (unknown [217.140.110.172])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTP
 id 85c2dac0-0f35-4545-bfd1-3648f6a02421;
 Wed, 23 Dec 2020 07:39:19 +0000 (UTC)
Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14])
 by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 46BBE1396;
 Tue, 22 Dec 2020 23:39:19 -0800 (PST)
Received: from localhost.localdomain (entos-thunderx2-02.shanghai.arm.com
 [10.169.212.215])
 by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 229CF3F66E;
 Tue, 22 Dec 2020 23:39:16 -0800 (PST)
X-BeenThere: minios-devel@lists.xenproject.org
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
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: 85c2dac0-0f35-4545-bfd1-3648f6a02421
From: Jia He <justin.he@arm.com>
To: minios-devel@lists.xenproject.org,
	Felipe Huici <felipe.huici@neclab.eu>
Cc: Simon Kuenzer <simon.kuenzer@neclab.eu>,
	Sharan.Santhanam@neclab.eu,
	Song Zhu <Song.Zhu@arm.com>,
	Jia He <justin.he@arm.com>
Subject: [UNIKRAFT PATCH RFCv4 03/35] plat/virtio: Support virtio_cread/cwrite on arm64
Date: Wed, 23 Dec 2020 15:38:25 +0800
Message-Id: <20201223073857.118076-4-justin.he@arm.com>
X-Mailer: git-send-email 2.17.1
In-Reply-To: <20201223073857.118076-1-justin.he@arm.com>
References: <20201223073857.118076-1-justin.he@arm.com>

Add virtio_cread/cwrite on arm64 with. Also add iowmb/iormb

Signed-off-by: Jia He <justin.he@arm.com>
---
 plat/drivers/include/virtio/virtio_config.h | 63 ++++++++++++++++++++-
 1 file changed, 62 insertions(+), 1 deletion(-)

diff --git a/plat/drivers/include/virtio/virtio_config.h b/plat/drivers/include/virtio/virtio_config.h
index 1221bbc..b80f26a 100644
--- a/plat/drivers/include/virtio/virtio_config.h
+++ b/plat/drivers/include/virtio/virtio_config.h
@@ -54,6 +54,9 @@ extern "C" {
 #define VIRTIO_TRANSPORT_F_START    28
 #define VIRTIO_TRANSPORT_F_END      32
 
+/* v1.0 compliant. */
+#define VIRTIO_F_VERSION_1		32
+
 #ifdef __X86_64__
 static inline void _virtio_cwrite_bytes(const void *addr, const __u8 offset,
 					const void *buf, int len, int type_len)
@@ -110,7 +113,65 @@ static inline void _virtio_cread_bytes(const void *addr, const __u8 offset,
 	}
 }
 #else  /* __X86_64__ */
-#error "Virtio driver not supported for this architecture"
+
+/* IO barriers */
+#define __iormb()		rmb()
+#define __iowmb()		wmb()
+
+static inline void _virtio_cwrite_bytes(const void *addr, const __u8 offset,
+					const void *buf, int len, int type_len)
+{
+	int i = 0;
+	void *io_addr;
+	int count;
+
+	count  = len / type_len;
+	for (i = 0; i < count; i++) {
+		io_addr = (void *)addr + offset + (i * type_len);
+		__iowmb();
+		switch (type_len) {
+		case 1:
+			ioreg_write8(io_addr, ((__u8 *)buf)[i * type_len]);
+			break;
+		case 2:
+			ioreg_write16(io_addr, ((__u16 *)buf)[i * type_len]);
+			break;
+		case 4:
+			ioreg_write32(io_addr, ((__u32 *)buf)[i * type_len]);
+			break;
+		default:
+			UK_CRASH("Unsupported virtio write operation\n");
+		}
+	}
+}
+
+static inline void _virtio_cread_bytes(const void *addr, const __u8 offset,
+				       void *buf, int len, int type_len)
+{
+	int i = 0;
+	void *io_addr;
+	int count;
+
+	count = len / type_len;
+	for (i = 0; i < count; i++) {
+		io_addr = (void *)addr + offset + (i * type_len);
+		switch (type_len) {
+		case 1:
+			((__u8 *)buf)[i * type_len] = ioreg_read8(io_addr);
+			break;
+		case 2:
+			((__u16 *)buf)[i * type_len] = ioreg_read16(io_addr);
+			break;
+		case 4:
+			((__u32 *)buf)[i * type_len] = ioreg_read32(io_addr);
+			break;
+		default:
+			UK_CRASH("Unsupported virtio read operation\n");
+		}
+		__iormb();
+	}
+}
+
 #endif /* __X86_64__ */
 
 /**
-- 
2.17.1



From minios-devel-bounces@lists.xenproject.org Wed Dec 23 07:39:26 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Wed, 23 Dec 2020 07:39:26 +0000
Received: from list by lists.xenproject.org with outflank-mailman.58197.102199 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1kryk2-0006Yl-9z; Wed, 23 Dec 2020 07:39:26 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 58197.102199; Wed, 23 Dec 2020 07:39: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 1kryk2-0006Ye-6T; Wed, 23 Dec 2020 07:39:26 +0000
Received: by outflank-mailman (input) for mailman id 58197;
 Wed, 23 Dec 2020 07:39: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=BSFQ=F3=arm.com=justin.he@srs-us1.protection.inumbo.net>)
 id 1kryk0-0006Xr-Pe
 for minios-devel@lists.xenproject.org; Wed, 23 Dec 2020 07:39:24 +0000
Received: from foss.arm.com (unknown [217.140.110.172])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTP
 id 6ceca10d-c9c8-4d28-aaf2-7a97fad3517d;
 Wed, 23 Dec 2020 07:39:22 +0000 (UTC)
Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14])
 by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 38CEC1435;
 Tue, 22 Dec 2020 23:39:22 -0800 (PST)
Received: from localhost.localdomain (entos-thunderx2-02.shanghai.arm.com
 [10.169.212.215])
 by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id C73433F66E;
 Tue, 22 Dec 2020 23:39:19 -0800 (PST)
X-BeenThere: minios-devel@lists.xenproject.org
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
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: 6ceca10d-c9c8-4d28-aaf2-7a97fad3517d
From: Jia He <justin.he@arm.com>
To: minios-devel@lists.xenproject.org,
	Felipe Huici <felipe.huici@neclab.eu>
Cc: Simon Kuenzer <simon.kuenzer@neclab.eu>,
	Sharan.Santhanam@neclab.eu,
	Song Zhu <Song.Zhu@arm.com>,
	Jia He <justin.he@arm.com>
Subject: [UNIKRAFT PATCH RFCv4 04/35] plat/virtio: Add new virtio_mmio device/driver on arm64
Date: Wed, 23 Dec 2020 15:38:26 +0800
Message-Id: <20201223073857.118076-5-justin.he@arm.com>
X-Mailer: git-send-email 2.17.1
In-Reply-To: <20201223073857.118076-1-justin.he@arm.com>
References: <20201223073857.118076-1-justin.he@arm.com>

Based on [1], but device removing/releasing is not supported.

[1] http://docs.oasis-open.org/virtio/virtio/v1.0/cs04/virtio-v1.0-cs04.html#x1-1090002

Signed-off-by: Jia He <justin.he@arm.com>
---
 plat/drivers/include/virtio/virtio_mmio.h | 137 ++++++
 plat/drivers/virtio/virtio_mmio.c         | 480 ++++++++++++++++++++++
 2 files changed, 617 insertions(+)
 create mode 100644 plat/drivers/include/virtio/virtio_mmio.h
 create mode 100644 plat/drivers/virtio/virtio_mmio.c

diff --git a/plat/drivers/include/virtio/virtio_mmio.h b/plat/drivers/include/virtio/virtio_mmio.h
new file mode 100644
index 0000000..ecf532a
--- /dev/null
+++ b/plat/drivers/include/virtio/virtio_mmio.h
@@ -0,0 +1,137 @@
+/* SPDX-License-Identifier: BSD-3-Clause */
+/*
+ * Virtio platform device driver
+ *
+ * Copyright 2011, ARM Ltd.
+ * Copyright 2018, ARM Ltd.
+ * Based on Virtio PCI driver by Anthony Liguori, copyright IBM Corp. 2007
+ *
+ * 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 IBM 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 IBM 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 _LINUX_VIRTIO_MMIO_H
+#define _LINUX_VIRTIO_MMIO_H
+
+/*
+ * Control registers
+ */
+
+/* Magic value ("virt" string) - Read Only */
+#define VIRTIO_MMIO_MAGIC_VALUE		0x000
+
+/* Virtio device version - Read Only */
+#define VIRTIO_MMIO_VERSION		0x004
+
+/* Virtio device ID - Read Only */
+#define VIRTIO_MMIO_DEVICE_ID		0x008
+
+/* Virtio vendor ID - Read Only */
+#define VIRTIO_MMIO_VENDOR_ID		0x00c
+
+/* Bitmask of the features supported by the device (host)
+ * (32 bits per set) - Read Only */
+#define VIRTIO_MMIO_DEVICE_FEATURES	0x010
+
+/* Device (host) features set selector - Write Only */
+#define VIRTIO_MMIO_DEVICE_FEATURES_SEL	0x014
+
+/* Bitmask of features activated by the driver (guest)
+ * (32 bits per set) - Write Only */
+#define VIRTIO_MMIO_DRIVER_FEATURES	0x020
+
+/* Activated features set selector - Write Only */
+#define VIRTIO_MMIO_DRIVER_FEATURES_SEL	0x024
+
+
+#ifndef VIRTIO_MMIO_NO_LEGACY /* LEGACY DEVICES ONLY! */
+
+/* Guest's memory page size in bytes - Write Only */
+#define VIRTIO_MMIO_GUEST_PAGE_SIZE	0x028
+
+#endif
+
+
+/* Queue selector - Write Only */
+#define VIRTIO_MMIO_QUEUE_SEL		0x030
+
+/* Maximum size of the currently selected queue - Read Only */
+#define VIRTIO_MMIO_QUEUE_NUM_MAX	0x034
+
+/* Queue size for the currently selected queue - Write Only */
+#define VIRTIO_MMIO_QUEUE_NUM		0x038
+
+
+#ifndef VIRTIO_MMIO_NO_LEGACY /* LEGACY DEVICES ONLY! */
+
+/* Used Ring alignment for the currently selected queue - Write Only */
+#define VIRTIO_MMIO_QUEUE_ALIGN		0x03c
+
+/* Guest's PFN for the currently selected queue - Read Write */
+#define VIRTIO_MMIO_QUEUE_PFN		0x040
+
+#endif
+
+
+/* Ready bit for the currently selected queue - Read Write */
+#define VIRTIO_MMIO_QUEUE_READY		0x044
+
+/* Queue notifier - Write Only */
+#define VIRTIO_MMIO_QUEUE_NOTIFY	0x050
+
+/* Interrupt status - Read Only */
+#define VIRTIO_MMIO_INTERRUPT_STATUS	0x060
+
+/* Interrupt acknowledge - Write Only */
+#define VIRTIO_MMIO_INTERRUPT_ACK	0x064
+
+/* Device status register - Read Write */
+#define VIRTIO_MMIO_STATUS		0x070
+
+/* Selected queue's Descriptor Table address, 64 bits in two halves */
+#define VIRTIO_MMIO_QUEUE_DESC_LOW	0x080
+#define VIRTIO_MMIO_QUEUE_DESC_HIGH	0x084
+
+/* Selected queue's Available Ring address, 64 bits in two halves */
+#define VIRTIO_MMIO_QUEUE_AVAIL_LOW	0x090
+#define VIRTIO_MMIO_QUEUE_AVAIL_HIGH	0x094
+
+/* Selected queue's Used Ring address, 64 bits in two halves */
+#define VIRTIO_MMIO_QUEUE_USED_LOW	0x0a0
+#define VIRTIO_MMIO_QUEUE_USED_HIGH	0x0a4
+
+/* Configuration atomicity value */
+#define VIRTIO_MMIO_CONFIG_GENERATION	0x0fc
+
+/* The config space is defined by each driver as
+ * the per-driver configuration space - Read Write */
+#define VIRTIO_MMIO_CONFIG		0x100
+
+/*
+ * Interrupt flags (re: interrupt status & acknowledge registers)
+ */
+#define VIRTIO_MMIO_INT_VRING		(1 << 0)
+#define VIRTIO_MMIO_INT_CONFIG		(1 << 1)
+
+#endif
diff --git a/plat/drivers/virtio/virtio_mmio.c b/plat/drivers/virtio/virtio_mmio.c
new file mode 100644
index 0000000..6716153
--- /dev/null
+++ b/plat/drivers/virtio/virtio_mmio.c
@@ -0,0 +1,480 @@
+/* SPDX-License-Identifier: BSD-3-Clause */
+/*
+ * Authors: Jia He <justin.he@arm.com>
+ *
+ * Copyright (c) 2020, Arm Ltd. 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/config.h>
+#include <uk/arch/types.h>
+#include <errno.h>
+#include <string.h>
+#include <uk/alloc.h>
+#include <uk/print.h>
+#include <uk/plat/lcpu.h>
+#include <uk/plat/irq.h>
+#include <uk/bus.h>
+#include <uk/bitops.h>
+
+#include <platform_bus.h>
+#include <virtio/virtio_config.h>
+#include <virtio/virtio_bus.h>
+#include <virtio/virtqueue.h>
+#include <virtio/virtio_mmio.h>
+
+/* The alignment to use between consumer and producer parts of vring.
+ * Currently hardcoded to the page size. */
+#define VIRTIO_MMIO_VRING_ALIGN		__PAGE_SIZE
+
+static struct uk_alloc *a;
+struct virtio_mmio_device_id {
+	uint16_t device_id;
+	uint32_t vendor;
+};
+
+struct virtio_mmio_device {
+	struct virtio_dev vdev;
+	char *name;
+	struct virtio_mmio_device_id  id;
+	struct virtio_mmio_driver     *drv;
+	unsigned long version;
+	unsigned long irq;
+	void *base;
+	struct pf_device *pfdev;
+};
+
+#define to_virtio_mmio_device(_dev) \
+	__containerof(_dev, struct virtio_mmio_device, vdev)
+
+struct virtio_mmio_vq_info {
+	/* the actual virtqueue */
+	struct virtqueue *vq;
+};
+typedef void vq_callback_t(struct virtqueue *);
+
+/* Configuration interface */
+
+static __u64 vm_get_features(struct virtio_dev *vdev)
+{
+	struct virtio_mmio_device *vm_dev = to_virtio_mmio_device(vdev);
+	__u64 features = 0;
+
+	virtio_cwrite32(vm_dev->base, VIRTIO_MMIO_DEVICE_FEATURES_SEL, 1);
+	features = virtio_cread32(vm_dev->base, VIRTIO_MMIO_DEVICE_FEATURES);
+	features <<= 32;
+
+	virtio_cwrite32(vm_dev->base, VIRTIO_MMIO_DEVICE_FEATURES_SEL, 0);
+	features |= virtio_cread32(vm_dev->base, VIRTIO_MMIO_DEVICE_FEATURES);
+
+	return features;
+}
+
+static void vm_set_features(struct virtio_dev *vdev,
+					 __u64 features)
+{
+	struct virtio_mmio_device *vm_dev = to_virtio_mmio_device(vdev);
+
+	/* Give virtio_ring a chance to accept features. */
+	virtqueue_feature_negotiate(features);
+
+	/* Make sure there is are no mixed devices */
+	if (vm_dev->version == 2 &&
+		!uk_test_bit(VIRTIO_F_VERSION_1, &vdev->features)) {
+		uk_pr_err("New virtio-mmio devices (version 2) must provide VIRTIO_F_VERSION_1 feature!\n");
+		return;
+	}
+
+	virtio_cwrite32(vm_dev->base, VIRTIO_MMIO_DRIVER_FEATURES_SEL, 1);
+	virtio_cwrite32(vm_dev->base, VIRTIO_MMIO_DRIVER_FEATURES,
+						(__u32)(vdev->features >> 32));
+
+	virtio_cwrite32(vm_dev->base, VIRTIO_MMIO_DRIVER_FEATURES_SEL, 0);
+	virtio_cwrite32(vm_dev->base, VIRTIO_MMIO_DRIVER_FEATURES,
+						(__u32)vdev->features);
+
+	return;
+}
+
+static int vm_get(struct virtio_dev *vdev, __u16 offset,
+		   void *buf, __u32 len, __u8 type_len __unused)
+{
+	struct virtio_mmio_device *vm_dev = to_virtio_mmio_device(vdev);
+	void *base = vm_dev->base + VIRTIO_MMIO_CONFIG;
+	__u8 b;
+	__u16 w;
+	__u32 l;
+
+	if (vm_dev->version == 1) {
+		__u8 *ptr = buf;
+		unsigned i;
+
+		for (i = 0; i < len; i++)
+			ptr[i] = virtio_cread8(base, offset + i);
+		return len;
+	}
+
+	switch (len) {
+	case 1:
+		b = virtio_cread8(base, offset);
+		memcpy(buf, &b, sizeof b);
+		break;
+	case 2:
+		w = (virtio_cread16(base, offset));
+		memcpy(buf, &w, sizeof w);
+		break;
+	case 4:
+		l = (virtio_cread32(base, offset));
+		memcpy(buf, &l, sizeof l);
+		break;
+	case 8:
+		l = (virtio_cread32(base, offset));
+		memcpy(buf, &l, sizeof l);
+		l = (virtio_cread32(base, offset + sizeof l));
+		memcpy(buf + sizeof l, &l, sizeof l);
+		break;
+	default:
+		uk_pr_err("Not supported length(%d) for io read\n", len);
+		UK_BUG();
+	}
+
+	return len;
+}
+
+static int vm_set(struct virtio_dev *vdev, __u16 offset,
+		   const void *buf, __u32 len)
+{
+	struct virtio_mmio_device *vm_dev = to_virtio_mmio_device(vdev);
+	void *base = vm_dev->base + VIRTIO_MMIO_CONFIG;
+	__u8 b;
+	__u16 w;
+	__u32 l;
+
+	if (vm_dev->version == 1) {
+		const __u8 *ptr = buf;
+		__u32 i;
+
+		for (i = 0; i < len; i++)
+			virtio_cwrite8(base, offset + i, ptr[i]);
+		return 0;
+	}
+
+	switch (len) {
+	case 1:
+		memcpy(&b, buf, sizeof b);
+		virtio_cwrite8(base, offset, b);
+		break;
+	case 2:
+		memcpy(&w, buf, sizeof w);
+		virtio_cwrite16(base, offset, w);
+		break;
+	case 4:
+		memcpy(&l, buf, sizeof l);
+		virtio_cwrite32(base, offset, l);
+		break;
+	case 8:
+		memcpy(&l, buf, sizeof l);
+		virtio_cwrite32(base, offset, l);
+		memcpy(&l, buf + sizeof l, sizeof(l));
+		virtio_cwrite32(base, offset + sizeof l, l);
+		break;
+	default:
+		uk_pr_err("Not supported length(%d) for io write\n", len);
+		UK_BUG();
+	}
+
+	return 0;
+}
+
+static __u8 vm_get_status(struct virtio_dev *vdev)
+{
+	struct virtio_mmio_device *vm_dev = to_virtio_mmio_device(vdev);
+
+	return virtio_cread32(vm_dev->base, VIRTIO_MMIO_STATUS) & 0xff;
+}
+
+static void vm_set_status(struct virtio_dev *vdev, __u8 status)
+{
+	struct virtio_mmio_device *vm_dev = to_virtio_mmio_device(vdev);
+
+	/* We should never be setting status to 0. */
+	UK_BUGON(status == 0);
+
+	virtio_cwrite32(vm_dev->base, VIRTIO_MMIO_STATUS, status);
+}
+
+static void vm_reset(struct virtio_dev *vdev)
+{
+	struct virtio_mmio_device *vm_dev = to_virtio_mmio_device(vdev);
+
+	/* 0 status means a reset. */
+	virtio_cwrite32(vm_dev->base, VIRTIO_MMIO_STATUS, 0);
+}
+
+/* Transport interface */
+
+/* the notify function used when creating a virt queue */
+static int vm_notify(struct virtio_dev *vdev, __u16 queue_id)
+{
+	struct virtio_mmio_device *vm_dev = to_virtio_mmio_device(vdev);
+
+	/* We write the queue's selector into the notification register to
+	 * signal the other end */
+	virtio_cwrite32(vm_dev->base, VIRTIO_MMIO_QUEUE_NOTIFY, queue_id);
+	return 1;
+}
+
+/* Notify all virtqueues on an interrupt. */
+static int vm_interrupt(void *opaque)
+{
+	struct virtio_mmio_device *vm_dev = opaque;
+	unsigned long status;
+	unsigned long flags;
+	int rc = 0;
+	struct virtqueue *vq;
+
+	/* Read and acknowledge interrupts */
+	status = virtio_cread32(vm_dev->base, VIRTIO_MMIO_INTERRUPT_STATUS);
+	virtio_cwrite32(vm_dev->base, VIRTIO_MMIO_INTERRUPT_ACK, status);
+
+	if (unlikely(status & VIRTIO_MMIO_INT_CONFIG)) {
+		uk_pr_warn("Unsupported config change interrupt received on virtio-mmio device %p\n",
+			   vm_dev);
+	}
+
+	if (likely(status & VIRTIO_MMIO_INT_VRING)) {
+		flags = ukplat_lcpu_save_irqf();
+		UK_TAILQ_FOREACH(vq, &vm_dev->vdev.vqs, next) {
+			rc |= virtqueue_ring_interrupt(vq);
+		}
+		ukplat_lcpu_restore_irqf(flags);
+	}
+
+	return rc;
+}
+
+
+static struct virtqueue *vm_setup_vq(struct virtio_dev *vdev,
+					__u16 queue_id,
+					__u16 num_desc,
+					virtqueue_callback_t callback,
+					struct uk_alloc *a)
+{
+	struct virtio_mmio_device *vm_dev = to_virtio_mmio_device(vdev);
+	struct virtqueue *vq;
+	unsigned long flags;
+
+	/* Create the vring */
+	vq = virtqueue_create(queue_id, num_desc, VIRTIO_MMIO_VRING_ALIGN,
+			      callback, vm_notify, vdev, a);
+
+	if (PTRISERR(vq)) {
+		uk_pr_err("Failed to create the virtqueue: %d\n",
+			  PTR2ERR(vq));
+
+		goto err_exit;
+	}
+
+	/* Select the queue we're interested in */
+	virtio_cwrite32(vm_dev->base, VIRTIO_MMIO_QUEUE_SEL, queue_id);
+
+	/* Activate the queue */
+	virtio_cwrite32(vm_dev->base, VIRTIO_MMIO_QUEUE_NUM, (__u32)virtqueue_vring_get_num(vq));
+	if (vm_dev->version == 1) {
+
+		virtio_cwrite32(vm_dev->base, VIRTIO_MMIO_QUEUE_ALIGN, __PAGE_SIZE);
+		virtio_cwrite32(vm_dev->base, VIRTIO_MMIO_QUEUE_PFN,
+					virtqueue_physaddr(vq) >> __PAGE_SHIFT);
+	} else {
+		__u64 addr;
+		addr = virtqueue_physaddr(vq);
+		virtio_cwrite32(vm_dev->base, VIRTIO_MMIO_QUEUE_DESC_LOW, (__u32)addr);
+		virtio_cwrite32(vm_dev->base, VIRTIO_MMIO_QUEUE_DESC_HIGH,
+								(__u32)(addr >> 32));
+
+		addr = virtqueue_get_avail_addr(vq);
+		virtio_cwrite32(vm_dev->base, VIRTIO_MMIO_QUEUE_AVAIL_LOW, (__u32)addr);
+		virtio_cwrite32(vm_dev->base, VIRTIO_MMIO_QUEUE_AVAIL_HIGH,
+								(__u32)(addr >> 32));
+
+		addr =  virtqueue_get_used_addr(vq);
+		virtio_cwrite32(vm_dev->base, VIRTIO_MMIO_QUEUE_USED_LOW, (__u32)addr);
+		virtio_cwrite32(vm_dev->base, VIRTIO_MMIO_QUEUE_USED_HIGH,
+								(__u32)(addr >> 32));
+
+		virtio_cwrite32(vm_dev->base, VIRTIO_MMIO_QUEUE_READY, 1);
+	}
+
+	flags = ukplat_lcpu_save_irqf();
+	UK_TAILQ_INSERT_TAIL(&vm_dev->vdev.vqs, vq, next);
+	ukplat_lcpu_restore_irqf(flags);
+
+err_exit:
+	return vq;
+}
+
+static int vm_find_vqs(struct virtio_dev *vdev, __u16 num_vqs, __u16 *qdesc_size)
+{
+	struct virtio_mmio_device *vm_dev = to_virtio_mmio_device(vdev);
+	unsigned int irq = vm_dev->pfdev->irq;
+	int i, err;
+	int vq_cnt = 0;
+
+	err = ukplat_irq_register(irq, vm_interrupt, vm_dev);
+	if (err)
+		return err;
+
+	for (i = 0; i < num_vqs; ++i) {
+		/* Select the queue we're interested in */
+		virtio_cwrite32(vm_dev->base, VIRTIO_MMIO_QUEUE_SEL, i);
+
+		/* Queue shouldn't already be set up. */
+		if (virtio_cread32(vm_dev->base, (vm_dev->version == 1 ?
+				VIRTIO_MMIO_QUEUE_PFN : VIRTIO_MMIO_QUEUE_READY))) {
+			uk_pr_err("vm_find_vqs error mmio queue not ready\n");
+			err = -ENOENT;
+			goto error_exit;
+		}
+
+		qdesc_size[i] = virtio_cread32(vm_dev->base, VIRTIO_MMIO_QUEUE_NUM_MAX);
+		if (qdesc_size[i] == 0) {
+			err = -ENOENT;
+			goto error_exit;
+		}
+
+		vq_cnt++;
+	}
+
+	return vq_cnt;
+error_exit:
+	uk_pr_err("err in vm_find_vqs :%d\n", err);
+	return err;
+}
+
+static struct virtio_config_ops virtio_mmio_config_ops = {
+	.config_get	= vm_get,
+	.config_set	= vm_set,
+	.status_get	= vm_get_status,
+	.status_set	= vm_set_status,
+	.device_reset	= vm_reset,
+	.features_get	= vm_get_features,
+	.features_set	= vm_set_features,
+	.vqs_find	= vm_find_vqs,
+	.vq_setup	= vm_setup_vq,
+};
+
+static int virtio_mmio_add_dev(struct pf_device *pfdev)
+{
+	struct virtio_mmio_device *vm_dev;
+	unsigned int magic;
+	int rc;
+
+	UK_ASSERT(pfdev != NULL);
+	uk_pr_info("virtio_mmio_add dev\n");
+
+	vm_dev = uk_malloc(a, sizeof(*vm_dev));
+	if (!vm_dev) {
+		uk_pr_err("Failed to allocate virtio-pci device\n");
+		return -ENOMEM;
+	}
+
+	/* Fetch Pf Device information */
+	vm_dev->pfdev = pfdev;
+	vm_dev->base = (void *)pfdev->base;
+	vm_dev->vdev.cops = &virtio_mmio_config_ops;
+	vm_dev->name = "virtio_mmio";
+
+	if (vm_dev->base == NULL)
+		return -EFAULT;
+
+	magic = virtio_cread32(vm_dev->base, VIRTIO_MMIO_MAGIC_VALUE);
+	if (magic != ('v' | 'i' << 8 | 'r' << 16 | 't' << 24)) {
+		uk_pr_err("Wrong magic value 0x%x!\n", magic);
+		return -ENODEV;
+	}
+
+	/* Check device version */
+	vm_dev->version = virtio_cread32(vm_dev->base, VIRTIO_MMIO_VERSION);
+	if (vm_dev->version < 1 || vm_dev->version > 2) {
+		uk_pr_err("Version %ld not supported!\n", vm_dev->version);
+		return -ENXIO;
+	}
+
+	vm_dev->vdev.id.virtio_device_id = virtio_cread32(vm_dev->base, VIRTIO_MMIO_DEVICE_ID);
+	if (vm_dev->vdev.id.virtio_device_id == 0) {
+		/*
+		 * virtio-mmio device with an ID 0 is a (dummy) placeholder
+		 * with no function. End probing now with no error reported.
+		 */
+		uk_pr_err("virtio_device_id is 0\n");
+
+		return -ENODEV;
+	}
+	vm_dev->id.vendor = virtio_cread32(vm_dev->base, VIRTIO_MMIO_VENDOR_ID);
+
+	virtio_cwrite32(vm_dev->base, VIRTIO_MMIO_GUEST_PAGE_SIZE, __PAGE_SIZE);
+
+	rc = virtio_bus_register_device(&vm_dev->vdev);
+	if (rc != 0) {
+		uk_pr_err("Failed to register the virtio device: %d\n", rc);
+		goto free_pf_dev;
+	}
+
+	uk_pr_info("finish add a virtio mmio dev\n");
+
+	return rc;
+
+free_pf_dev:
+	uk_free(a, vm_dev);
+
+	return 0;
+}
+
+static int virtio_mmio_drv_init(struct uk_alloc *drv_allocator)
+{
+	/* driver initialization */
+	if (!drv_allocator)
+		return -EINVAL;
+
+	a = drv_allocator;
+
+	return 0;
+}
+
+static const struct pf_device_id virtio_mmio_ids = {
+		.device_id = VIRTIO_MMIO_ID
+};
+
+static struct pf_driver virtio_mmio_drv = {
+	.device_ids = &virtio_mmio_ids,
+	.init = virtio_mmio_drv_init,
+	.add_dev = virtio_mmio_add_dev
+};
+
+PF_REGISTER_DRIVER(&virtio_mmio_drv);
-- 
2.17.1



From minios-devel-bounces@lists.xenproject.org Wed Dec 23 07:39:30 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Wed, 23 Dec 2020 07:39:30 +0000
Received: from list by lists.xenproject.org with outflank-mailman.58198.102203 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1kryk6-0006aS-BT; Wed, 23 Dec 2020 07:39:30 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 58198.102203; Wed, 23 Dec 2020 07:39: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 1kryk6-0006aL-8F; Wed, 23 Dec 2020 07:39:30 +0000
Received: by outflank-mailman (input) for mailman id 58198;
 Wed, 23 Dec 2020 07:39: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=BSFQ=F3=arm.com=justin.he@srs-us1.protection.inumbo.net>)
 id 1kryk4-0006Xr-No
 for minios-devel@lists.xenproject.org; Wed, 23 Dec 2020 07:39:28 +0000
Received: from foss.arm.com (unknown [217.140.110.172])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTP
 id e08e0792-4891-4e29-b517-93f0c1051587;
 Wed, 23 Dec 2020 07:39:25 +0000 (UTC)
Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14])
 by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id DDD2C143D;
 Tue, 22 Dec 2020 23:39:24 -0800 (PST)
Received: from localhost.localdomain (entos-thunderx2-02.shanghai.arm.com
 [10.169.212.215])
 by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id B90E13F66E;
 Tue, 22 Dec 2020 23:39:22 -0800 (PST)
X-BeenThere: minios-devel@lists.xenproject.org
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
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: e08e0792-4891-4e29-b517-93f0c1051587
From: Jia He <justin.he@arm.com>
To: minios-devel@lists.xenproject.org,
	Felipe Huici <felipe.huici@neclab.eu>
Cc: Simon Kuenzer <simon.kuenzer@neclab.eu>,
	Sharan.Santhanam@neclab.eu,
	Song Zhu <Song.Zhu@arm.com>,
	Jia He <justin.he@arm.com>
Subject: [UNIKRAFT PATCH RFCv4 05/35] build: Enable the platform bus and virtio_mmio device on arm64
Date: Wed, 23 Dec 2020 15:38:27 +0800
Message-Id: <20201223073857.118076-6-justin.he@arm.com>
X-Mailer: git-send-email 2.17.1
In-Reply-To: <20201223073857.118076-1-justin.he@arm.com>
References: <20201223073857.118076-1-justin.he@arm.com>

Enable the config for KVM_PF and add virtio mmio to the build system.

Signed-off-by: Jia He <justin.he@arm.com>
---
 plat/kvm/Config.uk   | 12 ++++++++++--
 plat/kvm/Makefile.uk | 12 ++++++++++++
 2 files changed, 22 insertions(+), 2 deletions(-)

diff --git a/plat/kvm/Config.uk b/plat/kvm/Config.uk
index 3372b6c..9540feb 100644
--- a/plat/kvm/Config.uk
+++ b/plat/kvm/Config.uk
@@ -73,10 +73,18 @@ config KVM_PCI
        help
                 PCI bus driver for probing and operating PCI devices
 
+config KVM_PF
+       bool "Platform Bus Driver"
+       default y
+       depends on (ARCH_ARM_64)
+       select LIBUKBUS
+       help
+               Platform bus driver for probing and operating platform devices
+
 config VIRTIO_BUS
       bool  "Virtio bus driver"
       default y
-      depends on (ARCH_X86_64)
+      depends on (ARCH_X86_64 || ARCH_ARM_64)
       depends on LIBUKBUS
       select LIBUKALLOC
       select LIBUKSGLIST
@@ -100,7 +108,7 @@ config VIRTIO_NET
        default n
        depends on LIBUKNETDEV
        imply VIRTIO_PCI if ARCH_X86_64
-       select VIRTIO_BUS
+       select VIRTIO
        select LIBUKSGLIST
        help
               Virtual network driver.
diff --git a/plat/kvm/Makefile.uk b/plat/kvm/Makefile.uk
index 94321e0..7b12b1a 100644
--- a/plat/kvm/Makefile.uk
+++ b/plat/kvm/Makefile.uk
@@ -8,6 +8,7 @@ $(eval $(call addplat_s,kvm,$(CONFIG_PLAT_KVM)))
 ##
 $(eval $(call addplatlib,kvm,libkvmplat))
 $(eval $(call addplatlib_s,kvm,libkvmpci,$(CONFIG_KVM_PCI)))
+$(eval $(call addplatlib_s,kvm,libkvmpf,$(CONFIG_KVM_PF)))
 $(eval $(call addplatlib_s,kvm,libkvmvirtio,$(CONFIG_VIRTIO_BUS)))
 $(eval $(call addplatlib_s,kvm,libkvmvirtionet,$(CONFIG_VIRTIO_NET)))
 $(eval $(call addplatlib_s,kvm,libkvmvirtioblk,$(CONFIG_VIRTIO_BLK)))
@@ -114,6 +115,15 @@ LIBKVMPCI_CINCLUDES-$(CONFIG_ARCH_X86_64)   += -I$(LIBKVMPLAT_BASE)/include
 LIBKVMPCI_CINCLUDES-$(CONFIG_ARCH_X86_64)   += -I$(UK_PLAT_COMMON_BASE)/include
 LIBKVMPCI_SRCS-$(CONFIG_ARCH_X86_64)        += $(UK_PLAT_COMMON_BASE)/pci_bus.c|common
 
+##
+## Platform bus library definitions
+##
+LIBKVMPF_ASINCLUDES-$(CONFIG_ARCH_ARM_64)  += -I$(UK_PLAT_COMMON_BASE)/include
+LIBKVMPF_CINCLUDES-$(CONFIG_ARCH_ARM_64)   += -I$(UK_PLAT_COMMON_BASE)/include
+LIBKVMPF_CINCLUDES-$(CONFIG_ARCH_ARM_64)   += -I$(LIBKVMPLAT_BASE)/include
+LIBKVMPF_CINCLUDES-$(CONFIG_ARCH_ARM_64)   += -I$(UK_PLAT_DRIVERS_BASE)/include
+LIBKVMPF_SRCS-$(CONFIG_ARCH_ARM_64) += $(UK_PLAT_COMMON_BASE)/platform_bus.c|common
+
 ##
 ## Virtio library definitions
 ##
@@ -129,6 +139,8 @@ LIBKVMVIRTIO_SRCS-$(CONFIG_VIRTIO_BUS) +=\
 			$(UK_PLAT_DRIVERS_BASE)/virtio/virtio_ring.c
 LIBKVMVIRTIO_SRCS-$(CONFIG_VIRTIO_PCI) +=\
 			$(UK_PLAT_DRIVERS_BASE)/virtio/virtio_pci.c
+LIBKVMVIRTIO_SRCS-$(CONFIG_ARCH_ARM_64)	+=\
+			$(UK_PLAT_DRIVERS_BASE)/virtio/virtio_mmio.c
 ##
 ## Virtio Net library definition
 ##
-- 
2.17.1



From minios-devel-bounces@lists.xenproject.org Wed Dec 23 07:39:35 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Wed, 23 Dec 2020 07:39:35 +0000
Received: from list by lists.xenproject.org with outflank-mailman.58199.102206 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1krykB-0006c4-EM; Wed, 23 Dec 2020 07:39:35 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 58199.102206; Wed, 23 Dec 2020 07:39:35 +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 1krykB-0006bx-BG; Wed, 23 Dec 2020 07:39:35 +0000
Received: by outflank-mailman (input) for mailman id 58199;
 Wed, 23 Dec 2020 07:39: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=BSFQ=F3=arm.com=justin.he@srs-us1.protection.inumbo.net>)
 id 1kryk9-0006Xr-Nu
 for minios-devel@lists.xenproject.org; Wed, 23 Dec 2020 07:39:33 +0000
Received: from foss.arm.com (unknown [217.140.110.172])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTP
 id 83cac2a2-73e2-4680-825e-c0ce14fffa09;
 Wed, 23 Dec 2020 07:39:27 +0000 (UTC)
Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14])
 by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 8EAF61474;
 Tue, 22 Dec 2020 23:39:27 -0800 (PST)
Received: from localhost.localdomain (entos-thunderx2-02.shanghai.arm.com
 [10.169.212.215])
 by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 6AA9D3F66E;
 Tue, 22 Dec 2020 23:39:25 -0800 (PST)
X-BeenThere: minios-devel@lists.xenproject.org
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
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: 83cac2a2-73e2-4680-825e-c0ce14fffa09
From: Jia He <justin.he@arm.com>
To: minios-devel@lists.xenproject.org,
	Felipe Huici <felipe.huici@neclab.eu>
Cc: Simon Kuenzer <simon.kuenzer@neclab.eu>,
	Sharan.Santhanam@neclab.eu,
	Song Zhu <Song.Zhu@arm.com>,
	Jia He <justin.he@arm.com>
Subject: [UNIKRAFT PATCH RFCv4 06/35] plat/kvm: arm64: Fix arm64 memory layout for pcie ecam
Date: Wed, 23 Dec 2020 15:38:28 +0800
Message-Id: <20201223073857.118076-7-justin.he@arm.com>
X-Mailer: git-send-email 2.17.1
In-Reply-To: <20201223073857.118076-1-justin.he@arm.com>
References: <20201223073857.118076-1-justin.he@arm.com>

In previous memory layout, it doesn't consider the device memory type
for pci ecam controller. This patch creates pci ecam device memory
started from 0x40,0000,0000 for pci config space on arm64.

Signed-off-by: Jia He <justin.he@arm.com>
---
 plat/common/include/arm/arm64/cpu_defs.h |  3 +++
 plat/kvm/arm/pagetable64.S               | 22 +++++++++++++++++-----
 2 files changed, 20 insertions(+), 5 deletions(-)

diff --git a/plat/common/include/arm/arm64/cpu_defs.h b/plat/common/include/arm/arm64/cpu_defs.h
index 675b9e6..06c07b9 100644
--- a/plat/common/include/arm/arm64/cpu_defs.h
+++ b/plat/common/include/arm/arm64/cpu_defs.h
@@ -302,6 +302,9 @@
 		(SECT_ATTR_DEFAULT | ATTR_UXN | \
 		ATTR_AP_RW_BIT | ATTR_IDX(NORMAL_WB))
 #define SECT_ATTR_DEVICE_nGnRE	\
+		(SECT_ATTR_DEFAULT | ATTR_XN | \
+		ATTR_IDX(DEVICE_nGnRE))
+#define SECT_ATTR_DEVICE_nGnRnE	\
 		(SECT_ATTR_DEFAULT | ATTR_XN | \
 		ATTR_IDX(DEVICE_nGnRnE))
 
diff --git a/plat/kvm/arm/pagetable64.S b/plat/kvm/arm/pagetable64.S
index 7899c19..1c2a349 100644
--- a/plat/kvm/arm/pagetable64.S
+++ b/plat/kvm/arm/pagetable64.S
@@ -48,10 +48,11 @@
 #define RAM_ADDR_START    0x40000000
 #define RAM_L2_ENTRIES    255
 #define RAM_ADDR_SIZE     (0x40000000 * RAM_L2_ENTRIES)
+#define PCIE_ECAM_START   0x4000000000
+#define PCIE_ECAM_L2_ENTRIES 256
 #define PCIE_ADDR_START   0x8000000000
 #define PCIE_L2_ENTRIES   512
 #define PCIE_ADDR_SIZE    0x8000000000
-
 /*
  * As we use VA == PA mapping, so the VIRT_BITS must be the same
  * as PA_BITS. We can get PA_BITS from ID_AA64MMFR0_EL1.PARange.
@@ -96,23 +97,34 @@ ENTRY(create_pagetables)
 	 * (0x40000000 ~ (256GiB -1)). The RAM areas that contain kernel
 	 * sections will be update later.
 	 */
-	add x6, x14, #L1_TABLE_OFFSET
+	add x6, x14, #L1_TABLE_OFFSET	/* 1st L2 table page */
 	ldr x7, =SECT_ATTR_NORMAL
 	mov x8, #RAM_ADDR_START
 	mov x9, x8
-	mov x10, #255
+	mov x10, #RAM_L2_ENTRIES
 	bl  build_l1_block_pagetable
 
+        /*
+         * Using 1GiB block to map PCIe ECAM address space
+         * (256GiB ~ 512GiB).
+         */
+        add x6, x14, #L1_TABLE_OFFSET	/* 1st L2 table page */
+        ldr x7, =SECT_ATTR_DEVICE_nGnRnE
+        mov x8, #PCIE_ECAM_START
+        mov x9, x8
+        mov x10, #PCIE_ECAM_L2_ENTRIES
+        bl  build_l1_block_pagetable
+
 	/*
 	 * Using 1GiB block to map high PCIe address space
 	 * (0x512GiB ~ (1TiB -1)).
 	 */
 	add x6, x14, #L1_TABLE_OFFSET
-	add x6, x6, #__PAGE_SIZE
+	add x6, x6, #__PAGE_SIZE	/* 2nd L2 table page */
 	ldr x7, =SECT_ATTR_DEVICE_nGnRE
 	mov x8, #PCIE_ADDR_START
 	mov x9, x8
-	mov x10, #512
+	mov x10, #PCIE_L2_ENTRIES
 	bl  build_l1_block_pagetable
 
 	/*
-- 
2.17.1



From minios-devel-bounces@lists.xenproject.org Wed Dec 23 07:39:38 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Wed, 23 Dec 2020 07:39:38 +0000
Received: from list by lists.xenproject.org with outflank-mailman.58200.102211 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1krykE-0006dF-GB; Wed, 23 Dec 2020 07:39:38 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 58200.102211; Wed, 23 Dec 2020 07:39: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 1krykE-0006d7-Ci; Wed, 23 Dec 2020 07:39:38 +0000
Received: by outflank-mailman (input) for mailman id 58200;
 Wed, 23 Dec 2020 07:39:37 +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=BSFQ=F3=arm.com=justin.he@srs-us1.protection.inumbo.net>)
 id 1krykD-0006cp-EH
 for minios-devel@lists.xenproject.org; Wed, 23 Dec 2020 07:39:37 +0000
Received: from foss.arm.com (unknown [217.140.110.172])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTP
 id c0508498-552b-43f5-9716-78b875fe43d8;
 Wed, 23 Dec 2020 07:39:35 +0000 (UTC)
Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14])
 by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 95ACF1480;
 Tue, 22 Dec 2020 23:39:35 -0800 (PST)
Received: from localhost.localdomain (entos-thunderx2-02.shanghai.arm.com
 [10.169.212.215])
 by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 70AE83F66E;
 Tue, 22 Dec 2020 23:39:33 -0800 (PST)
X-BeenThere: minios-devel@lists.xenproject.org
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
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: c0508498-552b-43f5-9716-78b875fe43d8
From: Jia He <justin.he@arm.com>
To: minios-devel@lists.xenproject.org,
	Felipe Huici <felipe.huici@neclab.eu>
Cc: Simon Kuenzer <simon.kuenzer@neclab.eu>,
	Sharan.Santhanam@neclab.eu,
	Song Zhu <Song.Zhu@arm.com>,
	Jia He <justin.he@arm.com>
Subject: [UNIKRAFT PATCH RFCv4 09/35] plat/pci_ecam: Introduce pci ecam skeleton
Date: Wed, 23 Dec 2020 15:38:31 +0800
Message-Id: <20201223073857.118076-10-justin.he@arm.com>
X-Mailer: git-send-email 2.17.1
In-Reply-To: <20201223073857.118076-1-justin.he@arm.com>
References: <20201223073857.118076-1-justin.he@arm.com>

This patch adds support for a generic PCI host controller. The controller
itself has no configuration registers and has its address spaces described
entirely by the device-tree. Currently, only ECAM is supported.

Signed-off-by: Jia He <justin.he@arm.com>
---
 plat/common/pci_ecam.c | 524 +++++++++++++++++++++++++++++++++++++++++
 1 file changed, 524 insertions(+)
 create mode 100644 plat/common/pci_ecam.c

diff --git a/plat/common/pci_ecam.c b/plat/common/pci_ecam.c
new file mode 100644
index 0000000..b97a580
--- /dev/null
+++ b/plat/common/pci_ecam.c
@@ -0,0 +1,524 @@
+/* SPDX-License-Identifier: BSD-3-Clause */
+/*
+ * Authors: Jia He <justin.he@arm.com>
+ *
+ * Copyright (c) 2018, Arm Ltd. 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 <stdbool.h>
+#include <pci/pci_ecam.h>
+#include <platform_bus.h>
+#include <uk/list.h>
+#include <uk/alloc.h>
+#include <uk/print.h>
+#include <kvm/config.h>
+#include <uk/plat/common/cpu.h>
+#include <libfdt_env.h>
+#include <ofw/fdt.h>
+#include <libfdt.h>
+
+static struct uk_alloc *a;
+static struct pci_ecam_ops pci_generic_ecam_ops;
+static const struct device_match_table gen_pci_match_table[];
+
+struct pci_config_window pcw = {
+	.ops = &pci_generic_ecam_ops
+};
+
+struct pci_range_parser {
+	int offset;		/*  in fdt */
+	const fdt32_t *range;	/* start offset in offset */
+	const fdt32_t *end;	/* end offset in offset */
+	int np;			/* number of property */
+	int pna;		/* parent number of address cell */
+};
+
+struct pci_range {
+	__u32 pci_space;
+	__u64 pci_addr;
+	__u64 cpu_addr;
+	__u64 size;
+	__u32 flags;
+};
+
+#define fdt_start (_libkvmplat_cfg.dtb)
+
+static int gen_pci_fdt; // start offset of pci-ecam in fdt
+/*
+ * Function to implement the pci_ops ->map_bus method
+ */
+static void *pci_ecam_map_bus(__u8 bus, __u8 devfn, int where)
+{
+	__u8 bus_shift = pcw.ops->bus_shift;
+	__u8 devfn_shift = bus_shift - 8;
+	__u8 bus_start = pcw.br.bus_start;
+	__u8 bus_end = pcw.br.bus_end;
+	void *base = (void *)pcw.config_base;
+
+	if (bus < bus_start || bus > bus_end)
+		return NULL;
+
+	return base + (bus << bus_shift) + (devfn << devfn_shift) + where;
+}
+
+int pci_generic_config_read(__u8 bus, __u8 devfn,
+			    int where, int size, __u32 *val)
+{
+	void *addr;
+
+	/* add rmb before io read */
+	rmb();
+	addr = pci_ecam_map_bus(bus, devfn, where);
+	if (!addr) {
+		*val = ~0;
+		return -1;
+	}
+
+	if (size == 1)
+		*val = ioreg_read8(addr);
+	else if (size == 2)
+		*val = ioreg_read16(addr);
+	else if (size == 4)
+		*val = ioreg_read32(addr);
+	else
+		uk_pr_err("not support size pci config read\n");
+
+	return 0;
+}
+
+int pci_generic_config_write(__u8 bus, __u8 devfn,
+			     int where, int size, __u32 val)
+{
+	void *addr;
+	__u32 mask, tmp;
+
+	addr = pci_ecam_map_bus(bus, devfn, where);
+	if (!addr)
+		return -1;
+
+	if (size == 1)
+		ioreg_write8(addr, val);
+	else if (size == 2)
+		ioreg_write16(addr, val);
+	else if (size == 4)
+		ioreg_write32(addr, val);
+	else
+		uk_pr_err("not support size pci config write\n");
+
+	/* add wmb after io write */
+	wmb();
+
+	return 0;
+}
+
+/* ECAM cfg */
+static struct pci_ecam_ops pci_generic_ecam_ops = {
+	.bus_shift	= 20
+};
+
+static unsigned int pci_get_flags(const fdt32_t *addr)
+{
+	unsigned int flags = 0;
+	__u32 w = fdt32_to_cpu(*addr);
+
+	/* only IORESOURCE_IO is supported currently */
+	switch ((w >> 24) & 0x03) {
+	case 0x01:
+		flags |= IORESOURCE_IO;
+		break;
+	case 0x02: /* 32 bits */
+	case 0x03: /* 64 bits */
+	default:
+		uk_pr_err("only supported pci ioresource flags\n");
+		break;
+	}
+
+	return flags;
+}
+
+static int gen_pci_parser_range(struct pci_range_parser *parser, int offset)
+{
+	const int na = 3, ns = 2;
+	int rlen;
+
+	parser->pna = fdt_address_cells(fdt_start, offset);
+	parser->np = parser->pna + na + ns;
+	parser->range = fdt_getprop(fdt_start, offset, "ranges", &rlen);
+	if (parser->range == NULL)
+		return -ENOENT;
+
+	parser->end = parser->range + rlen / sizeof(fdt32_t);
+
+	return 0;
+}
+
+struct pci_range *pci_range_parser_one(struct pci_range_parser *parser,
+					struct pci_range *range, int offset)
+{
+	const int na = 3, ns = 2; /* address and size */
+
+	if (!range)
+		return NULL;
+
+	if (!parser->range || parser->range + parser->np > parser->end)
+		return NULL;
+
+	range->pci_space = fdt32_to_cpu(*parser->range);
+	range->flags = pci_get_flags(parser->range);
+	range->pci_addr = fdt_reg_read_number(parser->range + 1, ns);
+	range->cpu_addr = fdt_translate_address_by_ranges(fdt_start, offset,
+				parser->range + na);
+	range->size = fdt_reg_read_number(parser->range + parser->pna + na, ns);
+
+	parser->range += parser->np;
+
+	return range;
+}
+
+static int irq_find_parent(const void *fdt, int child)
+{
+	int p;
+	int plen;
+	fdt32_t *prop;
+	fdt32_t parent;
+
+	do {
+		prop = fdt_getprop(fdt, child, "interrupt-parent", &plen);
+		if (prop == NULL) {
+			p = fdt_parent_offset(fdt, child);
+		} else	{
+			parent = fdt32_to_cpu(prop[0]);
+			p = fdt_node_offset_by_phandle(fdt, parent);
+		}
+		child = p;
+	} while (p >= 0 && fdt_getprop(fdt, p, "#interrupt-cells", NULL) == NULL);
+
+	return p;
+}
+
+int gen_pci_irq_parse(const fdt32_t *addr, struct fdt_phandle_args *out_irq)
+{
+	int ipar, tnode, old = 0, newpar = 0;
+	fdt32_t initial_match_array[16];
+	const fdt32_t *match_array = initial_match_array;
+	const fdt32_t *tmp, *imap, *imask;
+	const fdt32_t dummy_imask[] = { [0 ... 16] = cpu_to_fdt32(~0) };
+	int intsize, newintsize;
+	int addrsize, newaddrsize = 0;
+	int imaplen, match, i, rc = -EINVAL;
+	int plen;
+	int *prop;
+
+	ipar = gen_pci_fdt;
+
+	/* First get the #interrupt-cells property of the current cursor
+	 * that tells us how to interpret the passed-in intspec. If there
+	 * is none, we are nice and just walk up the tree
+	 */
+	do {
+		prop = fdt_getprop(fdt_start, ipar, "#interrupt-cells", &plen);
+		if (prop != NULL)
+			break;
+		ipar = irq_find_parent(fdt_start, ipar);
+	} while (ipar >= 0);
+
+	if (ipar < 0) {
+		uk_pr_info(" -> no parent found !\n");
+		goto fail;
+	}
+
+	intsize = fdt32_to_cpu(prop[0]);
+	uk_pr_info("irq_parse_raw: ipar=%p, size=%d\n", ipar, intsize);
+
+	if (out_irq->args_count != intsize)
+		goto fail;
+
+	/* Look for this #address-cells. We have to implement the old linux
+	 * trick of looking for the parent here as some device-trees rely on it
+	 */
+	old = ipar;
+	do {
+		tmp = fdt_getprop(fdt_start, old, "#address-cells", NULL);
+		tnode = fdt_parent_offset(fdt_start, old);
+		old = tnode;
+	} while (old >= 0 && tmp == NULL);
+
+	old = 0;
+	addrsize = (tmp == NULL) ? 2 : fdt32_to_cpu(*tmp);
+	uk_pr_info(" -> addrsize=%d\n", addrsize);
+
+	/* Precalculate the match array - this simplifies match loop */
+	for (i = 0; i < addrsize; i++)
+		initial_match_array[i] = addr ? addr[i] : 0;
+	for (i = 0; i < intsize; i++)
+		initial_match_array[addrsize + i] = cpu_to_fdt32(out_irq->args[i]);
+
+	/* Now start the actual "proper" walk of the interrupt tree */
+	while (ipar >= 0) {
+		/* Now check if cursor is an interrupt-controller and if it is
+		 * then we are done
+		 */
+		if (fdt_prop_read_bool(fdt_start, ipar, "interrupt-controller")) {
+			uk_pr_info(" -> got it !\n");
+			return 0;
+		}
+
+		/*
+		 * interrupt-map parsing does not work without a reg
+		 * property when #address-cells != 0
+		 */
+		if (addrsize && !addr) {
+			uk_pr_info(" -> no reg passed in when needed !\n");
+			goto fail;
+		}
+
+		/* Now look for an interrupt-map */
+		imap = fdt_getprop(fdt_start, ipar, "interrupt-map", &imaplen);
+		/* No interrupt map, check for an interrupt parent */
+		if (imap == NULL) {
+			uk_pr_info(" -> no map, getting parent\n");
+			newpar = irq_find_parent(fdt_start, ipar);
+			goto skiplevel;
+		}
+		imaplen /= sizeof(__u32);
+
+		/* Look for a mask */
+		imask = fdt_getprop(fdt_start, ipar, "interrupt-map-mask", NULL);
+		if (!imask)
+			imask = dummy_imask;
+
+		/* Parse interrupt-map */
+		match = 0;
+		while (imaplen > (addrsize + intsize + 1) && !match) {
+			/* Compare specifiers */
+			match = 1;
+			for (i = 0; i < (addrsize + intsize); i++, imaplen--)
+				match &= !((match_array[i] ^ *imap++) & imask[i]);
+
+			uk_pr_info(" -> match=%d (imaplen=%d)\n", match, imaplen);
+
+			/* Get the interrupt parent */
+			newpar = fdt_node_offset_by_phandle(fdt_start, fdt32_to_cpu(*imap));
+			imap++;
+			--imaplen;
+
+			/* Check if not found */
+			if (newpar < 0) {
+				uk_pr_info(" -> imap parent not found !\n");
+				goto fail;
+			}
+
+			/* Get #interrupt-cells and #address-cells of new
+			 * parent
+			 */
+			prop = fdt_getprop(fdt_start, newpar, "#interrupt-cells",
+						 &plen);
+			if (prop == NULL) {
+				uk_pr_info(" -> parent lacks #interrupt-cells!\n");
+				goto fail;
+			}
+			newintsize = fdt32_to_cpu(prop[0]);
+
+			prop = fdt_getprop(fdt_start, newpar, "#address-cells",
+						 &plen);
+			if (prop == NULL) {
+				uk_pr_info(" -> parent lacks #address-cells!\n");
+				goto fail;
+			}
+			newaddrsize = fdt32_to_cpu(prop[0]);
+
+			uk_pr_debug(" -> newintsize=%d, newaddrsize=%d\n",
+			    newintsize, newaddrsize);
+
+			/* Check for malformed properties */
+			if ((newaddrsize + newintsize > 16)
+			    || (imaplen < (newaddrsize + newintsize))) {
+				rc = -EFAULT;
+				goto fail;
+			}
+
+			imap += newaddrsize + newintsize;
+			imaplen -= newaddrsize + newintsize;
+
+			uk_pr_info(" -> imaplen=%d\n", imaplen);
+		}
+		if (!match)
+			goto fail;
+
+		/*
+		 * Successfully parsed an interrrupt-map translation; copy new
+		 * interrupt specifier into the out_irq structure
+		 */
+		match_array = imap - newaddrsize - newintsize;
+		for (i = 0; i < newintsize; i++)
+			out_irq->args[i] = fdt32_to_cpu(*(imap - newintsize + i));
+		out_irq->args_count = intsize = newintsize;
+		addrsize = newaddrsize;
+
+skiplevel:
+		/* Iterate again with new parent */
+		out_irq->np = newpar;
+		uk_pr_info(" -> new parent: %pOF\n", newpar);
+
+		ipar = newpar;
+		newpar = 0;
+	}
+
+	rc = -ENOENT; /* No interrupt-map found */
+
+fail:
+	return rc;
+}
+
+
+static int gen_pci_probe(struct pf_device *pfdev)
+{
+	const fdt32_t *prop;
+	int prop_len;
+	__u64 reg_base;
+	__u64 reg_size;
+	int err;
+	struct pci_range range;
+	struct pci_range_parser parser;
+	struct fdt_phandle_args out_irq;
+	fdt32_t laddr[3];
+
+	/* 1.Get the base and size of config space */
+	gen_pci_fdt = fdt_node_offset_by_compatible(fdt_start, -1,
+						gen_pci_match_table[0].compatible);
+	if (gen_pci_fdt < 0) {
+		uk_pr_info("Error in searching pci controller in fdt\n");
+		goto error_exit;
+	} else {
+		prop = fdt_getprop(fdt_start, gen_pci_fdt, "reg", &prop_len);
+		if (!prop) {
+			uk_pr_err("reg of device not found in fdt\n");
+			goto error_exit;
+		}
+
+		/* Get the base addr and the size */
+		fdt_get_address(fdt_start, gen_pci_fdt, 0,
+					&reg_base, &reg_size);
+		reg_base = fdt32_to_cpu(prop[0]);
+		reg_base = reg_base << 32 | fdt32_to_cpu(prop[1]);
+		reg_size = fdt32_to_cpu(prop[2]);
+		reg_size = reg_size << 32 | fdt32_to_cpu(prop[3]);
+	}
+
+	pcw.config_base = reg_base;
+	pcw.config_space_size = reg_size;
+	uk_pr_info("generic pci config base(0x%llx),size(0x%llx)\n",
+				reg_base, reg_size);
+
+	/* 2.Get the bus range of pci controller */
+	prop = fdt_getprop(fdt_start, gen_pci_fdt, "bus-range", &prop_len);
+	if (!prop) {
+		uk_pr_err("bus-range of device not found in fdt\n");
+		goto error_exit;
+	}
+
+	pcw.br.bus_start = fdt32_to_cpu(prop[0]);
+	pcw.br.bus_end = fdt32_to_cpu(prop[1]);
+	uk_pr_info("generic pci bus start(%d),end(%d)\n",
+				pcw.br.bus_start, pcw.br.bus_end);
+
+	if (pcw.br.bus_start > pcw.br.bus_end) {
+		uk_pr_err("bus-range detect error in fdt\n");
+		goto error_exit;
+	}
+
+	/* 3.Get the pci addr base and limit size for pci devices */
+	err = gen_pci_parser_range(&parser, gen_pci_fdt);
+	do {
+		pci_range_parser_one(&parser, &range, gen_pci_fdt);
+		if (range.flags == IORESOURCE_IO) {
+			pcw.pci_device_base = range.cpu_addr;
+			pcw.pci_device_limit = range.size;
+			break;
+		}
+		parser.range += parser.np;
+	} while (parser.range + parser.np <= parser.end);
+	uk_pr_info("generic pci range base(0x%llx),size(0x%llx)\n",
+				pcw.pci_device_base, pcw.pci_device_limit);
+
+	return 0;
+
+error_exit:
+	return -ENODEV;
+}
+
+static int gen_pci_drv_init(struct uk_alloc *drv_allocator)
+{
+	/* driver initialization */
+	if (!drv_allocator)
+		return -EINVAL;
+
+	a = drv_allocator;
+
+	return 0;
+}
+
+static int gen_pci_add_dev(struct pf_device *pfdev __unused)
+{
+	return 0;
+}
+
+static const struct device_match_table gen_pci_match_table[];
+
+static struct pf_device_id *gen_pci_id_match_compatible(const char *compatible)
+{
+	int i;
+
+	for (int i = 0; gen_pci_match_table[i].compatible != NULL; i++)
+		if (strcmp(gen_pci_match_table[i].compatible, compatible) == 0)
+			return gen_pci_match_table[i].id;
+
+	return NULL;
+}
+
+static const struct pf_device_id gen_pci_ids = {
+		.device_id = GEN_PCI_ID
+};
+
+struct pf_driver gen_pci_driver = {
+	.device_ids = &gen_pci_ids,
+	.init = gen_pci_drv_init,
+	.probe = gen_pci_probe,
+	.add_dev = gen_pci_add_dev,
+	.match = gen_pci_id_match_compatible
+};
+
+static const struct device_match_table gen_pci_match_table[] = {
+	{ .compatible = "pci-host-ecam-generic",
+	  .id = &gen_pci_ids },
+	{NULL}
+};
+
+PF_REGISTER_DRIVER(&gen_pci_driver);
-- 
2.17.1



From minios-devel-bounces@lists.xenproject.org Wed Dec 23 07:39:40 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Wed, 23 Dec 2020 07:39:40 +0000
Received: from list by lists.xenproject.org with outflank-mailman.58201.102215 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1krykG-0006eD-HW; Wed, 23 Dec 2020 07:39:40 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 58201.102215; Wed, 23 Dec 2020 07:39: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 1krykG-0006e5-EI; Wed, 23 Dec 2020 07:39:40 +0000
Received: by outflank-mailman (input) for mailman id 58201;
 Wed, 23 Dec 2020 07:39: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=BSFQ=F3=arm.com=justin.he@srs-us1.protection.inumbo.net>)
 id 1krykE-0006Xr-OD
 for minios-devel@lists.xenproject.org; Wed, 23 Dec 2020 07:39:38 +0000
Received: from foss.arm.com (unknown [217.140.110.172])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTP
 id e308b6a7-4272-4082-9328-d83b5d37fd88;
 Wed, 23 Dec 2020 07:39:30 +0000 (UTC)
Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14])
 by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 3F4631477;
 Tue, 22 Dec 2020 23:39:30 -0800 (PST)
Received: from localhost.localdomain (entos-thunderx2-02.shanghai.arm.com
 [10.169.212.215])
 by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 1B2483F66E;
 Tue, 22 Dec 2020 23:39:27 -0800 (PST)
X-BeenThere: minios-devel@lists.xenproject.org
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
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: e308b6a7-4272-4082-9328-d83b5d37fd88
From: Jia He <justin.he@arm.com>
To: minios-devel@lists.xenproject.org,
	Felipe Huici <felipe.huici@neclab.eu>
Cc: Simon Kuenzer <simon.kuenzer@neclab.eu>,
	Sharan.Santhanam@neclab.eu,
	Song Zhu <Song.Zhu@arm.com>,
	Jia He <justin.he@arm.com>
Subject: [UNIKRAFT PATCH RFCv4 07/35] plat/ofw: Export fdt_find_irq_parent_offset
Date: Wed, 23 Dec 2020 15:38:29 +0800
Message-Id: <20201223073857.118076-8-justin.he@arm.com>
X-Mailer: git-send-email 2.17.1
In-Reply-To: <20201223073857.118076-1-justin.he@arm.com>
References: <20201223073857.118076-1-justin.he@arm.com>

This changes fdt_find_irq_parent_offset from static to extern for pci ecam
to use.

Signed-off-by: Jia He <justin.he@arm.com>
---
 lib/fdt/exportsyms.uk          |  1 +
 plat/drivers/include/ofw/fdt.h | 21 +++++++++++++++++++++
 plat/drivers/ofw/fdt.c         |  2 +-
 3 files changed, 23 insertions(+), 1 deletion(-)

diff --git a/lib/fdt/exportsyms.uk b/lib/fdt/exportsyms.uk
index d64d9dc..a2e9ea8 100644
--- a/lib/fdt/exportsyms.uk
+++ b/lib/fdt/exportsyms.uk
@@ -61,3 +61,4 @@ fdt_stringlist_contains
 fdt_resize
 fdt_overlay_apply
 fdt_getprop_u32_by_offset
+fdt_find_irq_parent_offset
\ No newline at end of file
diff --git a/plat/drivers/include/ofw/fdt.h b/plat/drivers/include/ofw/fdt.h
index 6f80a27..8826845 100644
--- a/plat/drivers/include/ofw/fdt.h
+++ b/plat/drivers/include/ofw/fdt.h
@@ -37,6 +37,27 @@
 
 #define FDT_BAD_ADDR (uint64_t)(-1)
 
+/**
+ * fdt_find_irq_parent_offset - find the irq parent offset
+ * @fdt: pointer to the device tree blob
+ * @phandle: phandle value
+ *
+ * fdt_node_offset_by_phandle() returns the offset of the node
+ * which has the given phandle value.  If there is more than one node
+ * in the tree with the given phandle (an invalid tree), results are
+ * undefined.
+ *
+ * returns:
+ *	structure block offset of the located node (>= 0), on success
+ *	-FDT_ERR_NOTFOUND, no node with that phandle exists
+ *	-FDT_ERR_BADPHANDLE, given phandle value was invalid (0 or -1)
+ *	-FDT_ERR_BADMAGIC,
+ *	-FDT_ERR_BADVERSION,
+ *	-FDT_ERR_BADSTATE,
+ *	-FDT_ERR_BADSTRUCTURE, standard meanings
+ */
+int fdt_find_irq_parent_offset(const void *fdt, int offset);
+
 /**
  * fdt_interrupt_cells - retrieve the number of cells needed to encode an
  *                       interrupt source
diff --git a/plat/drivers/ofw/fdt.c b/plat/drivers/ofw/fdt.c
index 76f8ff3..c097331 100644
--- a/plat/drivers/ofw/fdt.c
+++ b/plat/drivers/ofw/fdt.c
@@ -44,7 +44,7 @@
 #define FDT_CHECK_COUNTS(na, ns)  ((na) > 0 && (na) <= FDT_MAX_ADDR_CELLS && \
 					(ns) > 0)
 
-static int fdt_find_irq_parent_offset(const void *fdt, int offset)
+int fdt_find_irq_parent_offset(const void *fdt, int offset)
 {
 	uint32_t irq_parent;
 
-- 
2.17.1



From minios-devel-bounces@lists.xenproject.org Wed Dec 23 07:39:45 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Wed, 23 Dec 2020 07:39:45 +0000
Received: from list by lists.xenproject.org with outflank-mailman.58202.102219 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1krykL-0006g1-Jv; Wed, 23 Dec 2020 07:39:45 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 58202.102219; Wed, 23 Dec 2020 07:39: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 1krykL-0006ft-G3; Wed, 23 Dec 2020 07:39:45 +0000
Received: by outflank-mailman (input) for mailman id 58202;
 Wed, 23 Dec 2020 07:39: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=BSFQ=F3=arm.com=justin.he@srs-us1.protection.inumbo.net>)
 id 1krykJ-0006Xr-OL
 for minios-devel@lists.xenproject.org; Wed, 23 Dec 2020 07:39:43 +0000
Received: from foss.arm.com (unknown [217.140.110.172])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTP
 id c5859172-798d-4246-b50d-d9feefbb1cb2;
 Wed, 23 Dec 2020 07:39:33 +0000 (UTC)
Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14])
 by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id E3FE21478;
 Tue, 22 Dec 2020 23:39:32 -0800 (PST)
Received: from localhost.localdomain (entos-thunderx2-02.shanghai.arm.com
 [10.169.212.215])
 by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id BF9363F66E;
 Tue, 22 Dec 2020 23:39:30 -0800 (PST)
X-BeenThere: minios-devel@lists.xenproject.org
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
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: c5859172-798d-4246-b50d-d9feefbb1cb2
From: Jia He <justin.he@arm.com>
To: minios-devel@lists.xenproject.org,
	Felipe Huici <felipe.huici@neclab.eu>
Cc: Simon Kuenzer <simon.kuenzer@neclab.eu>,
	Sharan.Santhanam@neclab.eu,
	Song Zhu <Song.Zhu@arm.com>,
	Jia He <justin.he@arm.com>
Subject: [UNIKRAFT PATCH RFCv4 08/35] plat/pci_ecam: Introduce pci/pci_ecam.h
Date: Wed, 23 Dec 2020 15:38:30 +0800
Message-Id: <20201223073857.118076-9-justin.he@arm.com>
X-Mailer: git-send-email 2.17.1
In-Reply-To: <20201223073857.118076-1-justin.he@arm.com>
References: <20201223073857.118076-1-justin.he@arm.com>

On arm64. we use a special generic pci controller, currently it
supports ECAM mode only on arm64 kvm plat.

Signed-off-by: Jia He <justin.he@arm.com>
---
 plat/common/include/pci/pci_ecam.h | 101 +++++++++++++++++++++++++++++
 1 file changed, 101 insertions(+)
 create mode 100644 plat/common/include/pci/pci_ecam.h

diff --git a/plat/common/include/pci/pci_ecam.h b/plat/common/include/pci/pci_ecam.h
new file mode 100644
index 0000000..f325a14
--- /dev/null
+++ b/plat/common/include/pci/pci_ecam.h
@@ -0,0 +1,101 @@
+/* SPDX-License-Identifier: BSD-3-Clause */
+/*
+ * Authors: Jia He <justin.he@arm.com>
+ *
+ * Copyright (c) 2020, Arm Ltd. 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 _PCI_ECAM_H
+#define _PCI_ECAM_H
+
+#include <uk/arch/types.h>
+#include <uk/list.h>
+#include <pci/pci_bus.h>
+#include <platform_bus.h>
+
+/*
+ * struct to hold bus shift of the config window
+ * for a PCI controller.
+ */
+struct pci_ecam_ops {
+	unsigned int			bus_shift;
+};
+
+/*
+ * struct to hold the mappings of a config space window. This
+ * is expected to be used for PCI controllers that
+ * use ECAM.
+ */
+struct bus_range {
+	__u8			bus_start;
+	__u8			bus_end;
+};
+
+struct pci_config_window {
+	__phys_addr		config_base;
+	__u64			config_space_size;
+	struct bus_range br;
+	struct pci_ecam_ops		*ops;
+	__phys_addr		pci_device_base;
+	__u64			pci_device_limit;
+};
+
+struct fdt_phandle_args {
+	int np;
+	int args_count;
+	uint32_t args[16];
+};
+
+/*
+ * IO resources have these defined flags.
+ *
+ * PCI devices expose these flags to userspace in the "resource" sysfs file,
+ * so don't move them.
+ */
+#define IORESOURCE_BITS		0x000000ff	/* Bus-specific bits */
+
+#define IORESOURCE_TYPE_BITS	0x00001f00	/* Resource type */
+#define IORESOURCE_IO		0x00000100	/* PCI/ISA I/O ports */
+#define IORESOURCE_MEM		0x00000200
+#define IORESOURCE_REG		0x00000300	/* Register offsets */
+#define IORESOURCE_IRQ		0x00000400
+#define IORESOURCE_DMA		0x00000800
+#define IORESOURCE_BUS		0x00001000
+
+
+int pci_generic_config_read(__u8 bus, __u8 devfn,
+			    int where, int size, __u32 *val);
+
+int pci_generic_config_write(__u8 bus, __u8 devfn,
+			     int where, int size, __u32 val);
+
+extern struct pf_driver gen_pci_driver;
+#endif
-- 
2.17.1



From minios-devel-bounces@lists.xenproject.org Wed Dec 23 07:39:50 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Wed, 23 Dec 2020 07:39:50 +0000
Received: from list by lists.xenproject.org with outflank-mailman.58203.102222 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1krykQ-0006ha-Lp; Wed, 23 Dec 2020 07:39:50 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 58203.102222; Wed, 23 Dec 2020 07:39: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 1krykQ-0006hV-IV; Wed, 23 Dec 2020 07:39:50 +0000
Received: by outflank-mailman (input) for mailman id 58203;
 Wed, 23 Dec 2020 07:39: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=BSFQ=F3=arm.com=justin.he@srs-us1.protection.inumbo.net>)
 id 1krykO-0006Xr-OO
 for minios-devel@lists.xenproject.org; Wed, 23 Dec 2020 07:39:48 +0000
Received: from foss.arm.com (unknown [217.140.110.172])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTP
 id 0aed90eb-128e-478d-bea1-85bd5dde1a13;
 Wed, 23 Dec 2020 07:39:38 +0000 (UTC)
Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14])
 by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 468481500;
 Tue, 22 Dec 2020 23:39:38 -0800 (PST)
Received: from localhost.localdomain (entos-thunderx2-02.shanghai.arm.com
 [10.169.212.215])
 by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 21DE93F66E;
 Tue, 22 Dec 2020 23:39:35 -0800 (PST)
X-BeenThere: minios-devel@lists.xenproject.org
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
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: 0aed90eb-128e-478d-bea1-85bd5dde1a13
From: Jia He <justin.he@arm.com>
To: minios-devel@lists.xenproject.org,
	Felipe Huici <felipe.huici@neclab.eu>
Cc: Simon Kuenzer <simon.kuenzer@neclab.eu>,
	Sharan.Santhanam@neclab.eu,
	Song Zhu <Song.Zhu@arm.com>,
	Jia He <justin.he@arm.com>
Subject: [UNIKRAFT PATCH RFCv4 10/35] lib/ukbus: Adjust default bus register priority
Date: Wed, 23 Dec 2020 15:38:32 +0800
Message-Id: <20201223073857.118076-11-justin.he@arm.com>
X-Mailer: git-send-email 2.17.1
In-Reply-To: <20201223073857.118076-1-justin.he@arm.com>
References: <20201223073857.118076-1-justin.he@arm.com>

On arm64, platform bus should be probed before pci bus since the pci
controller is considered as a platform device. Thus set the default
priority from 1 to 2, then platform bus priority will be 1, higher
than pci bus.

Signed-off-by: Jia He <justin.he@arm.com>
---
 lib/ukbus/include/uk/bus.h | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/lib/ukbus/include/uk/bus.h b/lib/ukbus/include/uk/bus.h
index fcb6842..5fbe325 100644
--- a/lib/ukbus/include/uk/bus.h
+++ b/lib/ukbus/include/uk/bus.h
@@ -68,22 +68,26 @@ void _uk_bus_register(struct uk_bus *b);
 /* Do not use this function directly: */
 void _uk_bus_unregister(struct uk_bus *b);
 
-/* registers a bus driver to the bus system */
+/* registers a bus driver to the bus system
+ * By default, the priority is 2 */
 #define UK_BUS_REGISTER(b) \
-	_UK_BUS_REGISTER(__LIBNAME__, b)
+	_UK_BUS_REGISTER(__LIBNAME__, b, 2)
+
+#define	UK_BUS_REGISTER_PRIORITY(b, prio) \
+	_UK_BUS_REGISTER(__LIBNAME__, b, prio)
 
 #define _UK_BUS_REGFNNAME(x, y)      x##y
 
-#define _UK_BUS_REGISTER_CTOR(ctor)  \
-	UK_CTOR_PRIO(ctor, UK_BUS_REGISTER_PRIO)
+#define _UK_BUS_REGISTER_CTOR(CTOR, prio)  \
+	UK_CTOR_FUNC(prio, CTOR)
 
-#define _UK_BUS_REGISTER(libname, b)				\
+#define _UK_BUS_REGISTER(libname, b, prio)			\
 	static void						\
 	_UK_BUS_REGFNNAME(libname, _uk_bus_register)(void)	\
 	{							\
 		_uk_bus_register((b));				\
 	}							\
-	_UK_BUS_REGISTER_CTOR(_UK_BUS_REGFNNAME(libname, _uk_bus_register))
+	_UK_BUS_REGISTER_CTOR(_UK_BUS_REGFNNAME(libname, _uk_bus_register), prio)
 
 #ifdef __cplusplus
 }
-- 
2.17.1



From minios-devel-bounces@lists.xenproject.org Wed Dec 23 07:39:50 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Wed, 23 Dec 2020 07:39:50 +0000
Received: from list by lists.xenproject.org with outflank-mailman.58204.102225 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1krykQ-0006i4-Oy; Wed, 23 Dec 2020 07:39:50 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 58204.102225; Wed, 23 Dec 2020 07:39: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 1krykQ-0006hj-K9; Wed, 23 Dec 2020 07:39:50 +0000
Received: by outflank-mailman (input) for mailman id 58204;
 Wed, 23 Dec 2020 07:39:49 +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=BSFQ=F3=arm.com=justin.he@srs-us1.protection.inumbo.net>)
 id 1krykP-0006hE-6B
 for minios-devel@lists.xenproject.org; Wed, 23 Dec 2020 07:39:49 +0000
Received: from foss.arm.com (unknown [217.140.110.172])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTP
 id 0f424f3a-b7ca-4b53-a331-0cb941988e63;
 Wed, 23 Dec 2020 07:39:46 +0000 (UTC)
Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14])
 by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 4D792150C;
 Tue, 22 Dec 2020 23:39:46 -0800 (PST)
Received: from localhost.localdomain (entos-thunderx2-02.shanghai.arm.com
 [10.169.212.215])
 by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 2935E3F66E;
 Tue, 22 Dec 2020 23:39:43 -0800 (PST)
X-BeenThere: minios-devel@lists.xenproject.org
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
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: 0f424f3a-b7ca-4b53-a331-0cb941988e63
From: Jia He <justin.he@arm.com>
To: minios-devel@lists.xenproject.org,
	Felipe Huici <felipe.huici@neclab.eu>
Cc: Simon Kuenzer <simon.kuenzer@neclab.eu>,
	Sharan.Santhanam@neclab.eu,
	Song Zhu <Song.Zhu@arm.com>,
	Jia He <justin.he@arm.com>
Subject: [UNIKRAFT PATCH RFCv4 13/35] plat/virtio_mmio: Implement platform probe for virtio_mmio
Date: Wed, 23 Dec 2020 15:38:35 +0800
Message-Id: <20201223073857.118076-14-justin.he@arm.com>
X-Mailer: git-send-email 2.17.1
In-Reply-To: <20201223073857.118076-1-justin.he@arm.com>
References: <20201223073857.118076-1-justin.he@arm.com>

This implements the probe interface for virtio_mmio device upon platform
bus.

Signed-off-by: Jia He <justin.he@arm.com>
---
 plat/drivers/virtio/virtio_mmio.c | 101 +++++++++++++++++++++++++-----
 1 file changed, 86 insertions(+), 15 deletions(-)

diff --git a/plat/drivers/virtio/virtio_mmio.c b/plat/drivers/virtio/virtio_mmio.c
index 6716153..9be07c1 100644
--- a/plat/drivers/virtio/virtio_mmio.c
+++ b/plat/drivers/virtio/virtio_mmio.c
@@ -42,12 +42,16 @@
 #include <uk/plat/irq.h>
 #include <uk/bus.h>
 #include <uk/bitops.h>
+#include <libfdt.h>
+#include <ofw/fdt.h>
+#include <kvm/config.h>
 
 #include <platform_bus.h>
 #include <virtio/virtio_config.h>
 #include <virtio/virtio_bus.h>
 #include <virtio/virtqueue.h>
 #include <virtio/virtio_mmio.h>
+#include <gic/gic-v2.h>
 
 /* The alignment to use between consumer and producer parts of vring.
  * Currently hardcoded to the page size. */
@@ -389,6 +393,48 @@ static struct virtio_config_ops virtio_mmio_config_ops = {
 	.vq_setup	= vm_setup_vq,
 };
 
+static int virtio_mmio_probe(struct pf_device *pfdev)
+{
+	const fdt32_t *prop;
+	int type, hwirq, prop_len;
+	int fdt_vm = pfdev->fdt_offset;
+	__u64 reg_base;
+	__u64 reg_size;
+
+	if (fdt_vm == -FDT_ERR_NOTFOUND) {
+		uk_pr_info("device not found in fdt\n");
+		goto error_exit;
+	} else {
+		prop = fdt_getprop(_libkvmplat_cfg.dtb, fdt_vm, "interrupts", &prop_len);
+		if (!prop) {
+			uk_pr_err("irq of device not found in fdt\n");
+			goto error_exit;
+		}
+
+		type = fdt32_to_cpu(prop[0]);
+		hwirq = fdt32_to_cpu(prop[1]);
+
+		prop = fdt_getprop(_libkvmplat_cfg.dtb, fdt_vm, "reg", &prop_len);
+		if (!prop) {
+			uk_pr_err("reg of device not found in fdt\n");
+			goto error_exit;
+		}
+
+		/* only care about base addr, ignore the size */
+		fdt_get_address(_libkvmplat_cfg.dtb, fdt_vm, 0,
+					&reg_base, &reg_size);
+	}
+
+	pfdev->base = reg_base;
+	pfdev->irq = gic_irq_translate(type, hwirq);
+	uk_pr_info("virtio mmio probe base(0x%lx) irq(%ld)\n",
+				pfdev->base, pfdev->irq);
+	return 0;
+
+error_exit:
+	return -EFAULT;
+}
+
 static int virtio_mmio_add_dev(struct pf_device *pfdev)
 {
 	struct virtio_mmio_device *vm_dev;
@@ -401,7 +447,8 @@ static int virtio_mmio_add_dev(struct pf_device *pfdev)
 	vm_dev = uk_malloc(a, sizeof(*vm_dev));
 	if (!vm_dev) {
 		uk_pr_err("Failed to allocate virtio-pci device\n");
-		return -ENOMEM;
+		rc = -ENOMEM;
+		goto free_vmdev;
 	}
 
 	/* Fetch Pf Device information */
@@ -410,20 +457,24 @@ static int virtio_mmio_add_dev(struct pf_device *pfdev)
 	vm_dev->vdev.cops = &virtio_mmio_config_ops;
 	vm_dev->name = "virtio_mmio";
 
-	if (vm_dev->base == NULL)
-		return -EFAULT;
+	if (vm_dev->base == NULL) {
+		rc = -EFAULT;
+		goto free_vmdev;
+	}
 
 	magic = virtio_cread32(vm_dev->base, VIRTIO_MMIO_MAGIC_VALUE);
 	if (magic != ('v' | 'i' << 8 | 'r' << 16 | 't' << 24)) {
 		uk_pr_err("Wrong magic value 0x%x!\n", magic);
-		return -ENODEV;
+		rc = -ENODEV;
+		goto free_vmdev;
 	}
 
 	/* Check device version */
 	vm_dev->version = virtio_cread32(vm_dev->base, VIRTIO_MMIO_VERSION);
 	if (vm_dev->version < 1 || vm_dev->version > 2) {
 		uk_pr_err("Version %ld not supported!\n", vm_dev->version);
-		return -ENXIO;
+		rc = -ENXIO;
+		goto free_vmdev;
 	}
 
 	vm_dev->vdev.id.virtio_device_id = virtio_cread32(vm_dev->base, VIRTIO_MMIO_DEVICE_ID);
@@ -434,7 +485,8 @@ static int virtio_mmio_add_dev(struct pf_device *pfdev)
 		 */
 		uk_pr_err("virtio_device_id is 0\n");
 
-		return -ENODEV;
+		rc = -ENODEV;
+		goto free_vmdev;
 	}
 	vm_dev->id.vendor = virtio_cread32(vm_dev->base, VIRTIO_MMIO_VENDOR_ID);
 
@@ -443,17 +495,15 @@ static int virtio_mmio_add_dev(struct pf_device *pfdev)
 	rc = virtio_bus_register_device(&vm_dev->vdev);
 	if (rc != 0) {
 		uk_pr_err("Failed to register the virtio device: %d\n", rc);
-		goto free_pf_dev;
+		goto free_vmdev;
 	}
 
-	uk_pr_info("finish add a virtio mmio dev\n");
-
-	return rc;
-
-free_pf_dev:
-	uk_free(a, vm_dev);
+	uk_pr_info("finish probing a virtio mmio dev\n");
 
 	return 0;
+
+free_vmdev:
+	return rc;
 }
 
 static int virtio_mmio_drv_init(struct uk_alloc *drv_allocator)
@@ -467,14 +517,35 @@ static int virtio_mmio_drv_init(struct uk_alloc *drv_allocator)
 	return 0;
 }
 
-static const struct pf_device_id virtio_mmio_ids = {
+static const struct device_match_table virtio_mmio_match_table[];
+
+static int virtio_mmio_id_match_compatible(const char *compatible)
+{
+	int i;
+
+	for (i = 0; virtio_mmio_match_table[i].compatible != NULL; i++)
+		if (strcmp(virtio_mmio_match_table[i].compatible, compatible) == 0)
+			return virtio_mmio_match_table[i].id->device_id;
+
+	return -1;
+}
+
+static struct pf_device_id virtio_mmio_ids = {
 		.device_id = VIRTIO_MMIO_ID
 };
 
 static struct pf_driver virtio_mmio_drv = {
 	.device_ids = &virtio_mmio_ids,
 	.init = virtio_mmio_drv_init,
-	.add_dev = virtio_mmio_add_dev
+	.probe = virtio_mmio_probe,
+	.add_dev = virtio_mmio_add_dev,
+	.match = virtio_mmio_id_match_compatible
+};
+
+static const struct device_match_table virtio_mmio_match_table[] = {
+	{ .compatible = "virtio,mmio",
+	  .id = &virtio_mmio_ids },
+	{NULL}
 };
 
 PF_REGISTER_DRIVER(&virtio_mmio_drv);
-- 
2.17.1



From minios-devel-bounces@lists.xenproject.org Wed Dec 23 07:39:55 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Wed, 23 Dec 2020 07:39:55 +0000
Received: from list by lists.xenproject.org with outflank-mailman.58205.102231 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1krykV-0006js-PQ; Wed, 23 Dec 2020 07:39:55 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 58205.102231; Wed, 23 Dec 2020 07:39: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 1krykV-0006jk-Lr; Wed, 23 Dec 2020 07:39:55 +0000
Received: by outflank-mailman (input) for mailman id 58205;
 Wed, 23 Dec 2020 07:39: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=BSFQ=F3=arm.com=justin.he@srs-us1.protection.inumbo.net>)
 id 1krykT-0006Xr-OP
 for minios-devel@lists.xenproject.org; Wed, 23 Dec 2020 07:39:53 +0000
Received: from foss.arm.com (unknown [217.140.110.172])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTP
 id 7ccf60ba-bca3-494f-860f-4e2ab7d08538;
 Wed, 23 Dec 2020 07:39:41 +0000 (UTC)
Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14])
 by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id ECBF41509;
 Tue, 22 Dec 2020 23:39:40 -0800 (PST)
Received: from localhost.localdomain (entos-thunderx2-02.shanghai.arm.com
 [10.169.212.215])
 by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id C6C8A3F66E;
 Tue, 22 Dec 2020 23:39:38 -0800 (PST)
X-BeenThere: minios-devel@lists.xenproject.org
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
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: 7ccf60ba-bca3-494f-860f-4e2ab7d08538
From: Jia He <justin.he@arm.com>
To: minios-devel@lists.xenproject.org,
	Felipe Huici <felipe.huici@neclab.eu>
Cc: Simon Kuenzer <simon.kuenzer@neclab.eu>,
	Sharan.Santhanam@neclab.eu,
	Song Zhu <Song.Zhu@arm.com>,
	Jia He <justin.he@arm.com>
Subject: [UNIKRAFT PATCH RFCv4 11/35] plat/ofw: Add fdt_node_offset_idx_by_compatible_list
Date: Wed, 23 Dec 2020 15:38:33 +0800
Message-Id: <20201223073857.118076-12-justin.he@arm.com>
X-Mailer: git-send-email 2.17.1
In-Reply-To: <20201223073857.118076-1-justin.he@arm.com>
References: <20201223073857.118076-1-justin.he@arm.com>

The helper fdt_node_offset_idx_by_compatible_list is similar as
fdt_node_offset_by_compatible_list except that it returns the index
of compatible_list[] array when compatible string is matched.
This is useful when supporting multiple types of platform devices on
arm64.

Signed-off-by: Jia He <justin.he@arm.com>
---
 plat/drivers/include/ofw/fdt.h | 28 ++++++++++++++++++++++++++++
 plat/drivers/ofw/fdt.c         | 18 ++++++++++++++++++
 2 files changed, 46 insertions(+)

diff --git a/plat/drivers/include/ofw/fdt.h b/plat/drivers/include/ofw/fdt.h
index 8826845..0220fad 100644
--- a/plat/drivers/include/ofw/fdt.h
+++ b/plat/drivers/include/ofw/fdt.h
@@ -139,6 +139,34 @@ int fdt_get_address(const void *fdt, int nodeoffset, uint32_t index,
 int fdt_node_offset_by_compatible_list(const void *fdt, int startoffset,
 					const char * const compatibles[]);
 
+/**
+ * fdt_node_offset_idx_by_compatible_list - find nodes with a given
+ *                                     'compatible' list value, and return
+ *                                     index of compatible array
+ * @fdt: pointer to the device tree blob
+ * @startoffset: only find nodes after this offset
+ * @compatibles: a list of 'compatible' string to match, should be ended
+ * with NULL string.
+ * @idx the index of compatible array
+ * fdt_node_offset_idx_by_compatible_list() returns the offset of the
+ * first matched node after startoffset, which has a 'compatible'
+ * property which lists the given compatible string; or if
+ * startoffset is -1, the very first such node in the tree.
+ *
+ * returns:
+ *     structure block offset of the located node (>= 0, >startoffset),
+ *              on success
+ *     -FDT_ERR_NOTFOUND, no node matching the criterion exists in the
+ *             tree after startoffset
+ *     -FDT_ERR_BADOFFSET, nodeoffset does not refer to a BEGIN_NODE tag
+ *     -FDT_ERR_BADMAGIC,
+ *     -FDT_ERR_BADVERSION,
+ *     -FDT_ERR_BADSTATE,
+ *     -FDT_ERR_BADSTRUCTURE, standard meanings
+ */
+int fdt_node_offset_idx_by_compatible_list(const void *fdt, int startoffset,
+				const char * const compatibles[], int *index);
+
 /**
  * fdt_get_interrupt - retrieve device interrupt of a given index
  * @fdt: pointer to the device tree blob
diff --git a/plat/drivers/ofw/fdt.c b/plat/drivers/ofw/fdt.c
index c097331..30ac270 100644
--- a/plat/drivers/ofw/fdt.c
+++ b/plat/drivers/ofw/fdt.c
@@ -256,6 +256,24 @@ int fdt_node_offset_by_compatible_list(const void *fdt, int startoffset,
 	return -FDT_ERR_NOTFOUND;
 }
 
+int fdt_node_offset_idx_by_compatible_list(const void *fdt, int startoffset,
+			  const char * const compatibles[], int *index)
+{
+	int idx, offset;
+
+	for (idx = 0; compatibles[idx] != NULL; idx++) {
+		offset = fdt_node_offset_by_compatible(fdt, startoffset,
+				  compatibles[idx]);
+		if (offset >= 0) {
+			*index = idx;
+			return offset;
+		}
+	}
+
+	*index = idx;
+	return -FDT_ERR_NOTFOUND;
+}
+
 int fdt_get_interrupt(const void *fdt, int nodeoffset,
 			uint32_t index, int *size, fdt32_t **prop)
 {
-- 
2.17.1



From minios-devel-bounces@lists.xenproject.org Wed Dec 23 07:40:00 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Wed, 23 Dec 2020 07:40:00 +0000
Received: from list by lists.xenproject.org with outflank-mailman.58206.102235 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1kryka-0006lO-Qe; Wed, 23 Dec 2020 07:40:00 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 58206.102235; Wed, 23 Dec 2020 07:40: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 1kryka-0006lH-NS; Wed, 23 Dec 2020 07:40:00 +0000
Received: by outflank-mailman (input) for mailman id 58206;
 Wed, 23 Dec 2020 07:39: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=BSFQ=F3=arm.com=justin.he@srs-us1.protection.inumbo.net>)
 id 1krykY-0006Xr-OT
 for minios-devel@lists.xenproject.org; Wed, 23 Dec 2020 07:39:58 +0000
Received: from foss.arm.com (unknown [217.140.110.172])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTP
 id 1387c084-c1a5-4fe1-9881-6c632648ee52;
 Wed, 23 Dec 2020 07:39:43 +0000 (UTC)
Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14])
 by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 9E3E61516;
 Tue, 22 Dec 2020 23:39:43 -0800 (PST)
Received: from localhost.localdomain (entos-thunderx2-02.shanghai.arm.com
 [10.169.212.215])
 by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 78ED03F66E;
 Tue, 22 Dec 2020 23:39:41 -0800 (PST)
X-BeenThere: minios-devel@lists.xenproject.org
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
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: 1387c084-c1a5-4fe1-9881-6c632648ee52
From: Jia He <justin.he@arm.com>
To: minios-devel@lists.xenproject.org,
	Felipe Huici <felipe.huici@neclab.eu>
Cc: Simon Kuenzer <simon.kuenzer@neclab.eu>,
	Sharan.Santhanam@neclab.eu,
	Song Zhu <Song.Zhu@arm.com>,
	Jia He <justin.he@arm.com>
Subject: [UNIKRAFT PATCH RFCv4 12/35] plat/platform_bus: Add probe/match interface for platform devices
Date: Wed, 23 Dec 2020 15:38:34 +0800
Message-Id: <20201223073857.118076-13-justin.he@arm.com>
X-Mailer: git-send-email 2.17.1
In-Reply-To: <20201223073857.118076-1-justin.he@arm.com>
References: <20201223073857.118076-1-justin.he@arm.com>

There is no hardware ID for platform device on arm64 device-tree,
thus it introduces an ID match interface to identify the device id.
device id should be registered as a constant value.

Also it introduces probe interface to parse the neccessary resource
(irq, base/size) in device-tree.

Signed-off-by: Jia He <justin.he@arm.com>
---
 plat/common/include/platform_bus.h |  26 ++++-
 plat/common/platform_bus.c         | 148 +++++++++++++++--------------
 2 files changed, 96 insertions(+), 78 deletions(-)

diff --git a/plat/common/include/platform_bus.h b/plat/common/include/platform_bus.h
index efc21a0..ad56e0e 100644
--- a/plat/common/include/platform_bus.h
+++ b/plat/common/include/platform_bus.h
@@ -43,8 +43,10 @@
  * table of these IDs for each device that it supports.
  */
 #define PLATFORM_DEVICE_ID_START (0x100)
-#define VIRTIO_MMIO_ID PLATFORM_DEVICE_ID_START
-#define PLATFORM_DEVICE_ID_END (PLATFORM_DEVICE_ID_START + 0x100)
+#define VIRTIO_MMIO_ID		(PLATFORM_DEVICE_ID_START)
+#define GEN_PCI_ID		(PLATFORM_DEVICE_ID_START + 1)
+
+#define PLATFORM_DEVICE_ID_END (GEN_PCI_ID + 1)
 
 #define UK_MAX_VIRTIO_MMIO_DEVICE (0x2)
 
@@ -52,16 +54,25 @@ struct pf_device_id {
 	uint16_t device_id;
 };
 
+struct device_match_table {
+	const char		*compatible;
+	struct pf_device_id	*id;
+};
+
 struct pf_device;
 
-typedef int (*pf_driver_add_func_t)(struct pf_device *);
 typedef int (*pf_driver_init_func_t)(struct uk_alloc *a);
+typedef int (*pf_driver_add_func_t)(struct pf_device *);
+typedef int (*pf_driver_probe_func_t)(struct pf_device *);
+typedef int (*pf_driver_match_func_t)(const char *);
 
 struct pf_driver {
 	UK_TAILQ_ENTRY(struct pf_driver) next;
 	const struct pf_device_id *device_ids;
 	pf_driver_init_func_t init; /* optional */
+	pf_driver_probe_func_t probe;
 	pf_driver_add_func_t add_dev;
+	pf_driver_match_func_t match;
 };
 UK_TAILQ_HEAD(pf_driver_list, struct pf_driver);
 
@@ -76,6 +87,7 @@ struct pf_device {
 	struct pf_driver     *drv;
 	enum pf_device_state state;
 
+	int fdt_offset;	/* The start offset of fdt node for device */
 	uint64_t base;
 	unsigned long irq;
 };
@@ -87,12 +99,16 @@ UK_TAILQ_HEAD(pf_device_list, struct pf_device);
 
 #define _PF_REGFNNAME(x, y)      x##y
 
+#define PF_REGISTER_CTOR(CTOR)				\
+		UK_CTOR_FUNC(1, CTOR)
+
 #define _PF_REGISTER_DRIVER(libname, b)				\
-	static void __constructor_prio(105)				\
+	static void						\
 	_PF_REGFNNAME(libname, _pf_register_driver)(void)		\
 	{								\
 		_pf_register_driver((b));				\
-	}
+	}								\
+	PF_REGISTER_CTOR(_PF_REGFNNAME(libname, _pf_register_driver))
 
 /* Do not use this function directly: */
 void _pf_register_driver(struct pf_driver *drv);
diff --git a/plat/common/platform_bus.c b/plat/common/platform_bus.c
index 1410e71..fecb389 100644
--- a/plat/common/platform_bus.c
+++ b/plat/common/platform_bus.c
@@ -52,8 +52,10 @@ struct pf_bus_handler {
 };
 static struct pf_bus_handler pfh;
 
-static const char * const pf_device_list[] = {
+static const char *pf_device_compatilbe_list[] = {
 	"virtio,mmio",
+	"pci-host-ecam-generic",
+	NULL
 };
 
 static inline int pf_device_id_match(const struct pf_device_id *id0,
@@ -67,14 +69,22 @@ static inline int pf_device_id_match(const struct pf_device_id *id0,
 	return rc;
 }
 
-static inline struct pf_driver *pf_find_driver(struct pf_device_id *id)
+static inline struct pf_driver *pf_find_driver(const char *compatible)
 {
 	struct pf_driver *drv;
+	struct pf_device_id id;
 
 	UK_TAILQ_FOREACH(drv, &pfh.drv_list, next) {
-		if (pf_device_id_match(id, drv->device_ids)) {
-			uk_pr_debug("pf driver found devid=%d\n", drv->device_ids->device_id);
-			return drv; /* driver found */
+		if (!drv->match)
+			continue;
+
+		id.device_id = (uint16_t)drv->match(compatible);
+		if (id.device_id) {
+			if (pf_device_id_match(&id, drv->device_ids)) {
+				uk_pr_debug("pf driver found  devid(0x%x)\n", id.device_id);
+
+				return drv;
+			}
 		}
 	}
 
@@ -84,104 +94,96 @@ static inline struct pf_driver *pf_find_driver(struct pf_device_id *id)
 }
 
 static inline int pf_driver_add_device(struct pf_driver *drv,
-					struct pf_device_id *devid,
-					__u64 dev_base,
-					int dev_irq)
+					struct pf_device *dev)
 {
-	struct pf_device *dev;
 	int ret;
 
 	UK_ASSERT(drv != NULL);
 	UK_ASSERT(drv->add_dev != NULL);
+	UK_ASSERT(dev != NULL);
 
-	dev = (struct pf_device *) uk_calloc(pfh.a, 1, sizeof(*dev));
-	if (!dev) {
-		uk_pr_err("Platform : Failed to initialize: Out of memory!\n");
-		return -ENOMEM;
-	}
-
-	memcpy(&dev->id, devid, sizeof(dev->id));
-	uk_pr_debug("pf_driver_add_device dev->id=%d\n", dev->id.device_id);
-
-	dev->base = dev_base;
-	dev->irq = dev_irq;
+	uk_pr_debug("pf_driver_add_device devid=%d\n", dev->id.device_id);
 
 	ret = drv->add_dev(dev);
 	if (ret < 0) {
 		uk_pr_err("Platform Failed to initialize device driver\n");
-		uk_free(pfh.a, dev);
 	}
 
 	return ret;
 }
 
+static inline int pf_driver_probe_device(struct pf_driver *drv,
+					struct pf_device *dev)
+{
+	int ret;
+
+	UK_ASSERT(drv != NULL && dev != NULL);
+	UK_ASSERT(drv->probe != NULL);
+
+	uk_pr_info("pf_driver_probe_device devid=%d\n", dev->id.device_id);
+
+	ret = drv->probe(dev);
+	if (ret < 0) {
+		uk_pr_err("Platform Failed to probe device driver\n");
+
+		return ret;
+	}
+
+	return 0;
+}
+
 static int pf_probe(void)
 {
-	struct pf_device_id devid;
 	struct pf_driver *drv;
-	int i;
-	int end_offset = -1;
+	int idx = 0;
 	int ret = -ENODEV;
-	const fdt32_t *prop;
-	int type, hwirq, prop_len;
-	__u64 reg_base;
-	__phys_addr dev_base;
-	int dev_irq;
+	struct pf_device *dev;
+	int fdt_pf = -1;
 
 	uk_pr_info("Probe PF\n");
 
-	/* We only support virtio_mmio as a platform device here.
-	 * A loop here is needed for finding drivers if more devices
-	 */
-	devid.device_id = VIRTIO_MMIO_ID;
+	/* Search all the platform bus devices provided by fdt */
+	do {
+		fdt_pf = fdt_node_offset_idx_by_compatible_list(_libkvmplat_cfg.dtb,
+						fdt_pf, pf_device_compatilbe_list, &idx);
+		if (fdt_pf < 0) {
+			uk_pr_info("End of searching platform devices\n");
+			break;
+		}
 
-	drv = pf_find_driver(&devid);
-	if (!drv) {
-		uk_pr_info("<no driver>\n");
-		return -ENODEV;
-	}
+		/* Alloc dev */
+		dev = (struct pf_device *) uk_calloc(pfh.a, 1, sizeof(*dev));
+		if (!dev) {
+			uk_pr_err("Platform : Failed to initialize: Out of memory!\n");
+			return -ENOMEM;
+		}
 
-	uk_pr_info("driver %p\n", drv);
-
-	/* qemu creates virtio devices in reverse order */
-	for (i = 0; i < UK_MAX_VIRTIO_MMIO_DEVICE; i++) {
-		end_offset = fdt_node_offset_by_compatible_list(fdt_start,
-							end_offset,
-							pf_device_list);
-		if (end_offset == -FDT_ERR_NOTFOUND) {
-			uk_pr_info("device not found in fdt\n");
-			goto error_exit;
-		} else {
-			prop = fdt_getprop(fdt_start, end_offset, "interrupts", &prop_len);
-			if (!prop) {
-				uk_pr_err("irq of device not found in fdt\n");
-				goto error_exit;
-			}
+		dev->fdt_offset = fdt_pf;
 
-			type = fdt32_to_cpu(prop[0]);
-			hwirq = fdt32_to_cpu(prop[1]);
+		/* Find drv with compatible-id match table */
+		drv = pf_find_driver(pf_device_compatilbe_list[idx]);
+		if (!drv) {
+			uk_free(pfh.a, dev);
+			continue;
+		}
 
-			prop = fdt_getprop(fdt_start, end_offset, "reg", &prop_len);
-			if (!prop) {
-				uk_pr_err("reg of device not found in fdt\n");
-				goto error_exit;
-			}
+		dev->id = *(struct pf_device_id *)drv->device_ids;
+		uk_pr_info("driver %p\n", drv);
 
-			/* only care about base addr, ignore the size */
-			reg_base = fdt32_to_cpu(prop[0]);
-			reg_base = reg_base << 32 | fdt32_to_cpu(prop[1]);
+		ret = pf_driver_probe_device(drv, dev);
+		if (ret < 0) {
+			uk_free(pfh.a, dev);
+			continue;
 		}
 
-		dev_base = reg_base;
-		dev_irq = gic_irq_translate(type, hwirq);
-
-		ret = pf_driver_add_device(drv, &devid, dev_base, dev_irq);
-	}
+		ret = pf_driver_add_device(drv, dev);
+		if (ret < 0) {
+			uk_pr_err("Platform Failed to initialize device driver, ret(%d)\n",ret);
+			uk_free(pfh.a, dev);
+		}
+	} while (1);
 
 	return ret;
-
-error_exit:
-	return -ENODEV;
 }
 
 
@@ -232,4 +234,4 @@ static struct pf_bus_handler pfh = {
 	.b.init = pf_init,
 	.b.probe = pf_probe
 };
-UK_BUS_REGISTER(&pfh.b);
+UK_BUS_REGISTER_PRIORITY(&pfh.b, 1);
-- 
2.17.1



From minios-devel-bounces@lists.xenproject.org Wed Dec 23 07:40:02 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Wed, 23 Dec 2020 07:40:02 +0000
Received: from list by lists.xenproject.org with outflank-mailman.58207.102238 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1krykc-0006uR-Sc; Wed, 23 Dec 2020 07:40:02 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 58207.102238; Wed, 23 Dec 2020 07:40: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 1krykc-0006uJ-PO; Wed, 23 Dec 2020 07:40:02 +0000
Received: by outflank-mailman (input) for mailman id 58207;
 Wed, 23 Dec 2020 07:40: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=BSFQ=F3=arm.com=justin.he@srs-us1.protection.inumbo.net>)
 id 1kryka-0006lG-PF
 for minios-devel@lists.xenproject.org; Wed, 23 Dec 2020 07:40:00 +0000
Received: from foss.arm.com (unknown [217.140.110.172])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTP
 id 23320710-4f86-4f14-b2c9-a7d61bda0da3;
 Wed, 23 Dec 2020 07:40:00 +0000 (UTC)
Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14])
 by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id A91381595;
 Tue, 22 Dec 2020 23:39:59 -0800 (PST)
Received: from localhost.localdomain (entos-thunderx2-02.shanghai.arm.com
 [10.169.212.215])
 by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 84C663F66E;
 Tue, 22 Dec 2020 23:39:57 -0800 (PST)
X-BeenThere: minios-devel@lists.xenproject.org
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
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: 23320710-4f86-4f14-b2c9-a7d61bda0da3
From: Jia He <justin.he@arm.com>
To: minios-devel@lists.xenproject.org,
	Felipe Huici <felipe.huici@neclab.eu>
Cc: Simon Kuenzer <simon.kuenzer@neclab.eu>,
	Sharan.Santhanam@neclab.eu,
	Song Zhu <Song.Zhu@arm.com>,
	Jia He <justin.he@arm.com>
Subject: [UNIKRAFT PATCH RFCv4 18/35]  plat/pci_bus: Pass memory allocation parameter to arch_pci_probe
Date: Wed, 23 Dec 2020 15:38:40 +0800
Message-Id: <20201223073857.118076-19-justin.he@arm.com>
X-Mailer: git-send-email 2.17.1
In-Reply-To: <20201223073857.118076-1-justin.he@arm.com>
References: <20201223073857.118076-1-justin.he@arm.com>

 On Arm, arch_pci_probe will use it when probing the pci device.
 But it is useless on X86, set it as __unused.

 Signed-off-by: Jia He <justin.he@arm.com>
---
 plat/common/pci_bus.c         | 4 ++--
 plat/common/x86/pci_bus_x86.c | 3 ++-
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/plat/common/pci_bus.c b/plat/common/pci_bus.c
index 7446bbe..629c1f2 100644
--- a/plat/common/pci_bus.c
+++ b/plat/common/pci_bus.c
@@ -58,7 +58,7 @@
 #include <uk/plat/common/cpu.h>
 #include <pci/pci_bus.h>
 
-extern int arch_pci_probe(void);
+extern int arch_pci_probe(struct uk_alloc *pha);
 
 static inline int pci_device_id_match(const struct pci_device_id *id0,
 					const struct pci_device_id *id1)
@@ -121,7 +121,7 @@ struct pci_driver *pci_find_driver(struct pci_device_id *id)
 
 static int pci_probe(void)
 {
-	return arch_pci_probe();
+	return arch_pci_probe(ph.a);
 }
 
 
diff --git a/plat/common/x86/pci_bus_x86.c b/plat/common/x86/pci_bus_x86.c
index b6d4ec6..64f6a7f 100644
--- a/plat/common/x86/pci_bus_x86.c
+++ b/plat/common/x86/pci_bus_x86.c
@@ -55,6 +55,7 @@
 #include <string.h>
 #include <uk/print.h>
 #include <uk/plat/common/cpu.h>
+#include <uk/essentials.h>
 #include <pci/pci_bus.h>
 
 #define PCI_CONF_READ(type, ret, a, s)					\
@@ -207,7 +208,7 @@ static void probe_bus(uint32_t bus)
 	}
 }
 
-int arch_pci_probe(void)
+int arch_pci_probe(struct uk_alloc *pha __unused)
 {
 	uint32_t config_addr, function, header_type, vendor_id;
 
-- 
2.17.1



From minios-devel-bounces@lists.xenproject.org Wed Dec 23 07:40:06 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Wed, 23 Dec 2020 07:40:06 +0000
Received: from list by lists.xenproject.org with outflank-mailman.58208.102243 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1krykf-0007GA-VU; Wed, 23 Dec 2020 07:40:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 58208.102243; Wed, 23 Dec 2020 07:40: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 1krykf-0007Fp-SB; Wed, 23 Dec 2020 07:40:05 +0000
Received: by outflank-mailman (input) for mailman id 58208;
 Wed, 23 Dec 2020 07:40: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=BSFQ=F3=arm.com=justin.he@srs-us1.protection.inumbo.net>)
 id 1krykd-0006Xr-P4
 for minios-devel@lists.xenproject.org; Wed, 23 Dec 2020 07:40:03 +0000
Received: from foss.arm.com (unknown [217.140.110.172])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTP
 id a42fa1fb-187c-4068-9d24-bd2b2ec2a4a1;
 Wed, 23 Dec 2020 07:39:49 +0000 (UTC)
Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14])
 by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id F1FC8152D;
 Tue, 22 Dec 2020 23:39:48 -0800 (PST)
Received: from localhost.localdomain (entos-thunderx2-02.shanghai.arm.com
 [10.169.212.215])
 by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id CDBC83F66E;
 Tue, 22 Dec 2020 23:39:46 -0800 (PST)
X-BeenThere: minios-devel@lists.xenproject.org
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
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: a42fa1fb-187c-4068-9d24-bd2b2ec2a4a1
From: Jia He <justin.he@arm.com>
To: minios-devel@lists.xenproject.org,
	Felipe Huici <felipe.huici@neclab.eu>
Cc: Simon Kuenzer <simon.kuenzer@neclab.eu>,
	Sharan.Santhanam@neclab.eu,
	Song Zhu <Song.Zhu@arm.com>,
	Jia He <justin.he@arm.com>
Subject: [UNIKRAFT PATCH RFCv4 14/35] plat/ofw: Support completed ranges mapping
Date: Wed, 23 Dec 2020 15:38:36 +0800
Message-Id: <20201223073857.118076-15-justin.he@arm.com>
X-Mailer: git-send-email 2.17.1
In-Reply-To: <20201223073857.118076-1-justin.he@arm.com>
References: <20201223073857.118076-1-justin.he@arm.com>

Previously, we only support 1:1 mapping for ranges property. This
is not enough for pci ecam on arm64.
e.g.
pcie@10000000 {
		interrupt-map-mask = < 0x1800 0x00 0x00 0x07 >;
		interrupt-map = < ... >;
		#interrupt-cells = < 0x01 >;
		ranges = < 0x1000000 0x00 0x00 0x00 0x3eff0000 0x00 0x10000 0x2000000 0x00 0x10000000 0x00 0x10000000 0x00 0x2eff0000 0x3000000 0x80 0x00 0x80 0x00 0x80 0x00 >;
		reg = < 0x40 0x10000000 0x00 0x10000000 >;
		msi-parent = < 0x8002 >;
		dma-coherent;
		bus-range = < 0x00 0xff >;
		linux,pci-domain = < 0x00 >;
		#size-cells = < 0x02 >;
		#address-cells = < 0x03 >;
		device_type = "pci";
		compatible = "pci-host-ecam-generic";
	};

Signed-off-by: Jia He <justin.he@arm.com>
---
 plat/drivers/ofw/fdt.c | 46 +++++++++++++++++++++++++++++++++++-------
 1 file changed, 39 insertions(+), 7 deletions(-)

diff --git a/plat/drivers/ofw/fdt.c b/plat/drivers/ofw/fdt.c
index 30ac270..780b8dd 100644
--- a/plat/drivers/ofw/fdt.c
+++ b/plat/drivers/ofw/fdt.c
@@ -97,6 +97,24 @@ static void fdt_default_count_cells(const void *fdt, int parentoffset,
 		*sizec = fdt_size_cells(fdt, parentoffset);
 }
 
+static __u64 fdt_default_map(fdt32_t *addr, const fdt32_t *range,
+		int na, int ns, int pna)
+{
+	__u64 cp, s, da;
+
+	cp = fdt_reg_read_number(range, na);
+	s  = fdt_reg_read_number(range + na + pna, ns);
+	da = fdt_reg_read_number(addr, na);
+
+	uk_pr_debug("default map, cp=%llx, s=%llx, da=%llx\n",
+		 (unsigned long long)cp, (unsigned long long)s,
+		 (unsigned long long)da);
+
+	if (da < cp || da >= (cp + s))
+		return FDT_BAD_ADDR;
+	return da - cp;
+}
+
 static int fdt_default_translate(fdt32_t *addr, uint64_t offset, int na)
 {
 	uint64_t a = fdt_reg_read_number(addr, na);
@@ -111,10 +129,11 @@ static int fdt_default_translate(fdt32_t *addr, uint64_t offset, int na)
 }
 
 static int fdt_translate_one(const void *fdt, int parent, fdt32_t *addr,
-				    int na, int pna, const char *rprop)
+				int na, int ns, int pna, const char *rprop)
 {
 	const fdt32_t *ranges;
 	int rlen;
+	int rone;
 	uint64_t offset = FDT_BAD_ADDR;
 
 	ranges = fdt_getprop(fdt, parent, rprop, &rlen);
@@ -126,10 +145,23 @@ static int fdt_translate_one(const void *fdt, int parent, fdt32_t *addr,
 		goto finish;
 	}
 
-	uk_pr_err("Error, only 1:1 translation is supported...\n");
-	return 1;
- finish:
-	uk_pr_debug("with offset: 0x%lx\n", offset);
+	uk_pr_debug("walking ranges...\n");
+	/* Now walk through the ranges */
+	rlen /= 4;
+	rone = na + pna + ns;
+	for (; rlen >= rone; rlen -= rone, ranges += rone) {
+		offset = fdt_default_map(addr, ranges, na, ns, pna);
+		if (offset != FDT_BAD_ADDR)
+			break;
+	}
+	if (offset == FDT_BAD_ADDR) {
+		uk_pr_debug("not found !\n");
+		return 1;
+	}
+	memcpy(addr, ranges + na, 4 * pna);
+
+finish:
+	uk_pr_info("parent translation for:%p %x", addr, pna);
 
 	/* Translate it into parent bus space */
 	return fdt_default_translate(addr, offset, pna);
@@ -140,7 +172,7 @@ static int fdt_translate_one(const void *fdt, int parent, fdt32_t *addr,
  * this walks up the tree and applies the various bus mappings on the
  * way.
  */
-static uint64_t fdt_translate_address_by_ranges(const void *fdt,
+uint64_t fdt_translate_address_by_ranges(const void *fdt,
 					int node_offset, const fdt32_t *regs)
 {
 	int parent;
@@ -188,7 +220,7 @@ static uint64_t fdt_translate_address_by_ranges(const void *fdt,
 
 		/* Apply bus translation */
 		if (fdt_translate_one(fdt, node_offset,
-					addr, na, pna, "ranges"))
+					addr, na, ns, pna, "ranges"))
 			break;
 
 		/* Complete the move up one level */
-- 
2.17.1



From minios-devel-bounces@lists.xenproject.org Wed Dec 23 07:40:06 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Wed, 23 Dec 2020 07:40:06 +0000
Received: from list by lists.xenproject.org with outflank-mailman.58209.102244 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1krykg-0007Gc-2F; Wed, 23 Dec 2020 07:40:06 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 58209.102244; Wed, 23 Dec 2020 07:40: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 1krykf-0007GJ-Ti; Wed, 23 Dec 2020 07:40:05 +0000
Received: by outflank-mailman (input) for mailman id 58209;
 Wed, 23 Dec 2020 07:40: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=BSFQ=F3=arm.com=justin.he@srs-us1.protection.inumbo.net>)
 id 1krykd-0006lG-QG
 for minios-devel@lists.xenproject.org; Wed, 23 Dec 2020 07:40:03 +0000
Received: from foss.arm.com (unknown [217.140.110.172])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTP
 id c1186b4e-7fad-42ec-9941-9f81a710457d;
 Wed, 23 Dec 2020 07:40:02 +0000 (UTC)
Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14])
 by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 59B601596;
 Tue, 22 Dec 2020 23:40:02 -0800 (PST)
Received: from localhost.localdomain (entos-thunderx2-02.shanghai.arm.com
 [10.169.212.215])
 by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 355983F66E;
 Tue, 22 Dec 2020 23:39:59 -0800 (PST)
X-BeenThere: minios-devel@lists.xenproject.org
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
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: c1186b4e-7fad-42ec-9941-9f81a710457d
From: Jia He <justin.he@arm.com>
To: minios-devel@lists.xenproject.org,
	Felipe Huici <felipe.huici@neclab.eu>
Cc: Simon Kuenzer <simon.kuenzer@neclab.eu>,
	Sharan.Santhanam@neclab.eu,
	Song Zhu <Song.Zhu@arm.com>,
	Jia He <justin.he@arm.com>
Subject: [UNIKRAFT PATCH RFCv4 19/35] plat/pci_bus: arm64: Implement add/probe interfaces on arm64
Date: Wed, 23 Dec 2020 15:38:41 +0800
Message-Id: <20201223073857.118076-20-justin.he@arm.com>
X-Mailer: git-send-email 2.17.1
In-Reply-To: <20201223073857.118076-1-justin.he@arm.com>
References: <20201223073857.118076-1-justin.he@arm.com>

This implements arch specific add/probe interfaces on arm64

Signed-off-by: Jia He <justin.he@arm.com>
---
 plat/common/arm/pci_bus_arm64.c   | 205 ++++++++++++++++++++++++++++++
 plat/common/include/pci/pci_bus.h |  52 ++++++++
 plat/kvm/Makefile.uk              |   2 +
 3 files changed, 259 insertions(+)
 create mode 100644 plat/common/arm/pci_bus_arm64.c

diff --git a/plat/common/arm/pci_bus_arm64.c b/plat/common/arm/pci_bus_arm64.c
new file mode 100644
index 0000000..022b3d4
--- /dev/null
+++ b/plat/common/arm/pci_bus_arm64.c
@@ -0,0 +1,205 @@
+/* TODO: SPDX Header */
+/*
+ * Authors: Simon Kuenzer <simon.kuenzer@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.
+ */
+/* Some code was derived from Solo5: */
+/*
+ * Copyright (c) 2015-2017 Contributors as noted in the AUTHORS file
+ *
+ * This file is part of Solo5, a unikernel base layer.
+ *
+ * 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.
+ */
+
+#include <string.h>
+#include <uk/print.h>
+#include <uk/plat/common/cpu.h>
+#include <pci/pci_bus.h>
+#include <pci/pci_ecam.h>
+#include <libfdt_env.h>
+#include <gic/gic-v2.h>
+
+extern struct pci_config_window pcw;
+extern int gen_pci_irq_parse(const fdt32_t *addr, struct fdt_phandle_args *out_irq);
+
+#define DEVFN(dev, fn)   ((dev << PCI_FN_BIT_NBR) | fn)
+#define SIZE_PER_PCI_DEV 0x20	/* legacy pci device size, no msi */
+
+static int arch_pci_driver_add_device(struct pci_driver *drv,
+					struct pci_address *addr,
+					struct pci_device_id *devid,
+					int irq,
+					__u64 base,
+					struct uk_alloc *pha)
+{
+	struct pci_device *dev;
+	int ret;
+	__u32 val;
+
+	UK_ASSERT(drv != NULL);
+	UK_ASSERT(drv->add_dev != NULL);
+	UK_ASSERT(addr != NULL);
+	UK_ASSERT(devid != NULL);
+	UK_ASSERT(pha != NULL);
+
+	dev = (struct pci_device *) uk_calloc(pha, 1, sizeof(*dev));
+	if (!dev) {
+		uk_pr_err("PCI %02x:%02x.%02x: Failed to initialize: Out of memory!\n",
+			  (int) addr->bus,
+			  (int) addr->devid,
+			  (int) addr->function);
+		return -ENOMEM;
+	}
+
+	memcpy(&dev->id, devid, sizeof(dev->id));
+	memcpy(&dev->addr, addr,  sizeof(dev->addr));
+	dev->drv = drv;
+
+	dev->base = base;
+	dev->irq = irq;
+	uk_pr_info("pci dev base(0x%llx) irq(%d)\n", dev->base, dev->irq);
+
+	if (drv->add_dev)
+		ret = drv->add_dev(dev); //virtio pci
+	if (ret < 0) {
+		uk_pr_err("PCI %02x:%02x.%02x: Failed to initialize device driver\n",
+			  (int) addr->bus,
+			  (int) addr->devid,
+			  (int) addr->function);
+		uk_free(pha, dev);
+	}
+
+	return 0;
+}
+
+int arch_pci_probe(struct uk_alloc *pha)
+{
+	struct pci_address addr;
+	struct pci_device_id devid;
+	struct pci_driver *drv;
+	uint32_t bus;
+	uint8_t dev;
+	int err;
+	int irq, pin = 0;
+	__u64 base;
+	int found_pci_device = 0;
+	struct fdt_phandle_args out_irq;
+	fdt32_t fdtaddr[3];
+
+	uk_pr_debug("Probe PCI\n");
+
+	for (bus = 0; bus < PCI_MAX_BUSES; ++bus) {
+		for (dev = 0; dev < PCI_MAX_DEVICES; ++dev) {
+			/* TODO: Retrieve the device identfier */
+			addr.domain   = 0x0;
+			addr.bus      = bus;
+			addr.devid    = dev;
+			 /* TODO: Retrieve the function bus, dev << PCI_DEV_BIT_NBR*/
+			addr.function = 0x0;
+
+			pci_generic_config_read(bus, DEVFN(dev, 0), PCI_VENDOR_ID, 2, &devid.vendor_id);
+			if (devid.vendor_id == PCI_INVALID_ID) {
+				/* Device doesn't exist */
+				continue;
+			}
+
+			/* mark we found any pci device */
+			found_pci_device = 1;
+
+			pci_generic_config_read(bus, DEVFN(dev, 0), PCI_CLASS_REVISION, 4, &devid.class_id);
+			pci_generic_config_read(bus, DEVFN(dev, 0), PCI_VENDOR_ID, 2, &devid.vendor_id);
+			pci_generic_config_read(bus, DEVFN(dev, 0), PCI_DEV_ID, 2, &devid.device_id);
+			pci_generic_config_read(bus, DEVFN(dev, 0), PCI_SUBSYSTEM_VID, 2, &devid.subsystem_vendor_id);
+			pci_generic_config_read(bus, DEVFN(dev, 0), PCI_SUBSYSTEM_ID, 2, &devid.subsystem_device_id);
+			uk_pr_info("PCI %02x:%02x.%02x (%04x %04x:%04x): sb=%d,sv=%4x\n",
+				   (int) addr.bus,
+				   (int) addr.devid,
+				   (int) addr.function,
+				   (int) devid.class_id,
+				   (int) devid.vendor_id,
+				   (int) devid.device_id,
+				   (int) devid.subsystem_device_id,
+				   (int) devid.subsystem_vendor_id);
+
+			/* TODO: gracefully judge it is a pci host bridge */
+			if (bus == 0 && DEVFN(dev, 0) == 0) {
+				pci_generic_config_write(bus, 0, PCI_COMMAND, 2, PCI_COMMAND_INTX_DISABLE);
+				pci_generic_config_write(bus, 0, PCI_COMMAND, 2, PCI_COMMAND_IO);
+				continue;
+			} else {
+				base = pcw.pci_device_base + (bus << 5 | dev)*SIZE_PER_PCI_DEV;
+				pci_generic_config_write(bus, DEVFN(dev, 0), PCI_COMMAND, 2, PCI_COMMAND_INTX_DISABLE);
+				pci_generic_config_write(bus, DEVFN(dev, 0), PCI_BASE_ADDRESS_0, 4, (bus << 5 | dev)*SIZE_PER_PCI_DEV);
+				pci_generic_config_write(bus, DEVFN(dev, 0), PCI_COMMAND, 2, PCI_COMMAND_MASTER | PCI_COMMAND_IO);
+			}
+
+			drv = pci_find_driver(&devid);
+			if (!drv) {
+				uk_pr_info("<no driver> for dev id=%d\n", devid);
+				continue;
+			}
+
+			uk_pr_info("driver %p\n", drv);
+
+			/* probe the irq info*/
+			pci_generic_config_read(bus, DEVFN(dev, 0), PCI_INTERRUPT_PIN, 1, &pin);
+			out_irq.args_count = 1;
+			out_irq.args[0] = pin;
+			fdtaddr[0] = cpu_to_fdt32((bus << 16) | (DEVFN(dev,0) << 8));
+			fdtaddr[1] = fdtaddr[2] = cpu_to_fdt32(0);
+
+			gen_pci_irq_parse(fdtaddr, &out_irq);
+			irq = gic_irq_translate(0, out_irq.args[1]);
+
+			arch_pci_driver_add_device(drv, &addr, &devid, irq, base, pha);
+
+			uk_pr_info("pci dev base(0x%llx) irq(%d)\n");
+		}
+	}
+
+	if (found_pci_device == 0)
+		uk_pr_info("No pci device found!\n");
+
+	return 0;
+}
diff --git a/plat/common/include/pci/pci_bus.h b/plat/common/include/pci/pci_bus.h
index a49e7e3..88ed949 100644
--- a/plat/common/include/pci/pci_bus.h
+++ b/plat/common/include/pci/pci_bus.h
@@ -193,6 +193,10 @@ static struct pci_bus_handler ph;
 #define PCI_MAX_DEVICES             (1 << 5)
 #define PCI_MAX_FUNCTIONS           (1 << 3)
 
+#define PCI_BUS_BIT_NBR			(8)
+#define PCI_DEV_BIT_NBR			(5)
+#define PCI_FN_BIT_NBR			(3)
+
 #define PCI_BUS_SHIFT               (16)
 #define PCI_DEVICE_SHIFT            (11)
 #define PCI_FUNCTION_SHIFT          (8)
@@ -239,6 +243,54 @@ static struct pci_bus_handler ph;
 #define PCI_CONF_IOBAR_SHFT         (0x0)
 #define PCI_CONF_IOBAR_MASK         (~0x3)
 
+#define PCI_BASE_ADDRESS_0	0x10	/* 32 bits */
+#define PCI_BASE_ADDRESS_1	0x14	/* 32 bits */
+#define PCI_BASE_ADDRESS_2	0x18	/* 32 bits */
+#define PCI_BASE_ADDRESS_3	0x1c	/* 32 bits */
+#define PCI_BASE_ADDRESS_4	0x20	/* 32 bits */
+#define PCI_BASE_ADDRESS_5	0x24	/* 32 bits */
+
+#define PCI_VENDOR_ID		0x0
+#define PCI_DEV_ID			0x02
+
+#define PCI_BUS_OFFSET       16
+#define PCI_SLOT_OFFSET      11
+#define PCI_FUNC_OFFSET      8
+#define PCI_CONFIG_ADDRESS_ENABLE   0x80000000
+#define PCI_COMMAND_OFFSET   0x4
+#define PCI_BUS_MASTER_BIT   0x2
+#define PCI_STATUS_OFFSET    0x6
+#define PCI_CLASS_REVISION   0x8
+#define PCI_CLASS_OFFSET     0xb
+#define PCI_SUBCLASS_OFFSET	 0xa
+#define PCI_HEADER_TYPE      0xe
+#define PCI_SUBSYSTEM_ID     0x2e
+#define PCI_SUBSYSTEM_VID    0x2c
+#define PCI_HEADER_MULTI_FUNC   0x80
+#define PCI_BAR0_ADDR        0x10
+#define PCI_CONFIG_SECONDARY_BUS   0x19
+#define PCI_CAPABILITIES_PTR   0x34
+
+#define PCI_COMMAND		0x04	/* 16 bits */
+#define  PCI_COMMAND_IO		0x1	/* Enable response in I/O space */
+#define  PCI_COMMAND_MEMORY	0x2	/* Enable response in Memory space */
+#define  PCI_COMMAND_MASTER	0x4	/* Enable bus mastering */
+#define  PCI_COMMAND_SPECIAL	0x8	/* Enable response to special cycles */
+#define  PCI_COMMAND_INVALIDATE	0x10	/* Use memory write and invalidate */
+#define  PCI_COMMAND_VGA_PALETTE 0x20	/* Enable palette snooping */
+#define  PCI_COMMAND_PARITY	0x40	/* Enable parity checking */
+#define  PCI_COMMAND_WAIT	0x80	/* Enable address/data stepping */
+#define  PCI_COMMAND_SERR	0x100	/* Enable SERR */
+#define  PCI_COMMAND_FAST_BACK	0x200	/* Enable back-to-back writes */
+#define  PCI_COMMAND_INTX_DISABLE 0x400 /* INTx Emulation Disable */
+#define PCI_COMMAND_DECODE_ENABLE	(PCI_COMMAND_MEMORY | PCI_COMMAND_IO)
+
+/* 0x35-0x3b are reserved */
+#define PCI_INTERRUPT_LINE	0x3c	/* 8 bits */
+#define PCI_INTERRUPT_PIN	0x3d	/* 8 bits */
+#define PCI_MIN_GNT		0x3e	/* 8 bits */
+#define PCI_MAX_LAT		0x3f	/* 8 bits */
+
 struct pci_driver *pci_find_driver(struct pci_device_id *id);
 
 #endif /* __UKPLAT_COMMON_PCI_BUS_H__ */
diff --git a/plat/kvm/Makefile.uk b/plat/kvm/Makefile.uk
index 5260670..da2eb30 100644
--- a/plat/kvm/Makefile.uk
+++ b/plat/kvm/Makefile.uk
@@ -117,6 +117,8 @@ LIBKVMPCI_CINCLUDES-$(CONFIG_ARCH_ARM_64)   += -I$(UK_PLAT_DRIVERS_BASE)/include
 LIBKVMPCI_SRCS-y		            += $(UK_PLAT_COMMON_BASE)/pci_bus.c|common
 LIBKVMPCI_SRCS-$(CONFIG_ARCH_X86_64) += \
 				$(UK_PLAT_COMMON_BASE)/x86/pci_bus_x86.c|x86
+LIBKVMPCI_SRCS-$(CONFIG_ARCH_ARM_64) += \
+				$(UK_PLAT_COMMON_BASE)/arm/pci_bus_arm64.c|arm
 
 ##
 ## Platform bus library definitions
-- 
2.17.1



From minios-devel-bounces@lists.xenproject.org Wed Dec 23 07:40:07 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Wed, 23 Dec 2020 07:40:07 +0000
Received: from list by lists.xenproject.org with outflank-mailman.58210.102251 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1krykh-0007NJ-3A; Wed, 23 Dec 2020 07:40:07 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 58210.102251; Wed, 23 Dec 2020 07:40: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 1krykg-0007NC-VZ; Wed, 23 Dec 2020 07:40:06 +0000
Received: by outflank-mailman (input) for mailman id 58210;
 Wed, 23 Dec 2020 07:40: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=BSFQ=F3=arm.com=justin.he@srs-us1.protection.inumbo.net>)
 id 1krykf-0006lG-UY
 for minios-devel@lists.xenproject.org; Wed, 23 Dec 2020 07:40:05 +0000
Received: from foss.arm.com (unknown [217.140.110.172])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTP
 id f14e3283-7807-456a-bb23-600048f4000c;
 Wed, 23 Dec 2020 07:40:05 +0000 (UTC)
Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14])
 by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 13F2F1597;
 Tue, 22 Dec 2020 23:40:05 -0800 (PST)
Received: from localhost.localdomain (entos-thunderx2-02.shanghai.arm.com
 [10.169.212.215])
 by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id DA1C33F66E;
 Tue, 22 Dec 2020 23:40:02 -0800 (PST)
X-BeenThere: minios-devel@lists.xenproject.org
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
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: f14e3283-7807-456a-bb23-600048f4000c
From: Jia He <justin.he@arm.com>
To: minios-devel@lists.xenproject.org,
	Felipe Huici <felipe.huici@neclab.eu>
Cc: Simon Kuenzer <simon.kuenzer@neclab.eu>,
	Sharan.Santhanam@neclab.eu,
	Song Zhu <Song.Zhu@arm.com>,
	Jia He <justin.he@arm.com>
Subject: [UNIKRAFT PATCH RFCv4 20/35] build: Make KVM_PCI default enable on arm64
Date: Wed, 23 Dec 2020 15:38:42 +0800
Message-Id: <20201223073857.118076-21-justin.he@arm.com>
X-Mailer: git-send-email 2.17.1
In-Reply-To: <20201223073857.118076-1-justin.he@arm.com>
References: <20201223073857.118076-1-justin.he@arm.com>

Signed-off-by: Jia He <justin.he@arm.com>
---
 plat/kvm/Config.uk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/plat/kvm/Config.uk b/plat/kvm/Config.uk
index 9540feb..2ee737e 100644
--- a/plat/kvm/Config.uk
+++ b/plat/kvm/Config.uk
@@ -68,7 +68,7 @@ endmenu
 config KVM_PCI
        bool "PCI Bus Driver"
        default y
-       depends on (ARCH_X86_64)
+       depends on (ARCH_X86_64 || ARCH_ARM_64)
        select LIBUKBUS
        help
                 PCI bus driver for probing and operating PCI devices
-- 
2.17.1



From minios-devel-bounces@lists.xenproject.org Wed Dec 23 07:40:10 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Wed, 23 Dec 2020 07:40:10 +0000
Received: from list by lists.xenproject.org with outflank-mailman.58211.102255 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1krykk-0007WM-42; Wed, 23 Dec 2020 07:40:10 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 58211.102255; Wed, 23 Dec 2020 07:40: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 1krykk-0007WF-0u; Wed, 23 Dec 2020 07:40:10 +0000
Received: by outflank-mailman (input) for mailman id 58211;
 Wed, 23 Dec 2020 07:40: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=BSFQ=F3=arm.com=justin.he@srs-us1.protection.inumbo.net>)
 id 1kryki-0006Xr-Ok
 for minios-devel@lists.xenproject.org; Wed, 23 Dec 2020 07:40:08 +0000
Received: from foss.arm.com (unknown [217.140.110.172])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTP
 id 6b9e2689-10f5-42dd-90dc-bc6ba74f2687;
 Wed, 23 Dec 2020 07:39:51 +0000 (UTC)
Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14])
 by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id A2B8D152F;
 Tue, 22 Dec 2020 23:39:51 -0800 (PST)
Received: from localhost.localdomain (entos-thunderx2-02.shanghai.arm.com
 [10.169.212.215])
 by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 7E6E43F66E;
 Tue, 22 Dec 2020 23:39:49 -0800 (PST)
X-BeenThere: minios-devel@lists.xenproject.org
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
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: 6b9e2689-10f5-42dd-90dc-bc6ba74f2687
From: Jia He <justin.he@arm.com>
To: minios-devel@lists.xenproject.org,
	Felipe Huici <felipe.huici@neclab.eu>
Cc: Simon Kuenzer <simon.kuenzer@neclab.eu>,
	Sharan.Santhanam@neclab.eu,
	Song Zhu <Song.Zhu@arm.com>,
	Jia He <justin.he@arm.com>
Subject: [UNIKRAFT PATCH RFCv4 15/35] lib/fdt: Fix fdt_address_cell and fdt_size_cell
Date: Wed, 23 Dec 2020 15:38:37 +0800
Message-Id: <20201223073857.118076-16-justin.he@arm.com>
X-Mailer: git-send-email 2.17.1
In-Reply-To: <20201223073857.118076-1-justin.he@arm.com>
References: <20201223073857.118076-1-justin.he@arm.com>

The address-cell and size_cell should be probed from parent.

Signed-off-by: Jia He <justin.he@arm.com>
---
 lib/fdt/fdt_addresses.c | 57 ++++++++++++++++++++++-------------------
 plat/drivers/ofw/fdt.c  |  7 +++--
 2 files changed, 34 insertions(+), 30 deletions(-)

diff --git a/lib/fdt/fdt_addresses.c b/lib/fdt/fdt_addresses.c
index a1860e6..736858a 100644
--- a/lib/fdt/fdt_addresses.c
+++ b/lib/fdt/fdt_addresses.c
@@ -55,42 +55,47 @@
 
 #include "libfdt_internal.h"
 
+#define OFW_ROOT_NODE_ADDR_CELLS_DEFAULT 2
+#define OFW_ROOT_NODE_SIZE_CELLS_DEFAULT 1
+
 int fdt_address_cells(const void *fdt, int nodeoffset)
 {
-	const fdt32_t *ac;
-	int val;
-	int len;
-
-	ac = fdt_getprop(fdt, nodeoffset, "#address-cells", &len);
-	if (!ac)
-		return 2;
+	int cells;
+	int parent;
+	int off = nodeoffset;
+	const fdt32_t *prop;
 
-	if (len != sizeof(*ac))
-		return -FDT_ERR_BADNCELLS;
+	do {
+		parent = fdt_parent_offset(fdt, off);
+		if (parent >= 0)
+			off = parent;
 
-	val = fdt32_to_cpu(*ac);
-	if ((val <= 0) || (val > FDT_MAX_NCELLS))
-		return -FDT_ERR_BADNCELLS;
+		prop = fdt_getprop(fdt, off, "#address-cells", &cells);
+		if (prop != NULL)
+			return fdt32_to_cpu(prop[0]);
+	} while (parent >= 0);
 
-	return val;
+	/* No #address-cells property for the root node */
+	return OFW_ROOT_NODE_ADDR_CELLS_DEFAULT;
 }
 
 int fdt_size_cells(const void *fdt, int nodeoffset)
 {
-	const fdt32_t *sc;
-	int val;
-	int len;
-
-	sc = fdt_getprop(fdt, nodeoffset, "#size-cells", &len);
-	if (!sc)
-		return 1;
+	int cells;
+	int parent;
+	int off = nodeoffset;
+	const fdt32_t *prop;
 
-	if (len != sizeof(*sc))
-		return -FDT_ERR_BADNCELLS;
+	do {
+		parent = fdt_parent_offset(fdt, off);
+		if (parent >= 0)
+			off = parent;
 
-	val = fdt32_to_cpu(*sc);
-	if ((val < 0) || (val > FDT_MAX_NCELLS))
-		return -FDT_ERR_BADNCELLS;
+		prop = fdt_getprop(fdt, off, "#size-cells", &cells);
+		if (prop != NULL)
+			return fdt32_to_cpu(prop[0]);
+	} while (parent >= 0);
 
-	return val;
+	/* No #size-cells property for the root node */
+	return OFW_ROOT_NODE_SIZE_CELLS_DEFAULT;
 }
diff --git a/plat/drivers/ofw/fdt.c b/plat/drivers/ofw/fdt.c
index 780b8dd..876637d 100644
--- a/plat/drivers/ofw/fdt.c
+++ b/plat/drivers/ofw/fdt.c
@@ -234,7 +234,7 @@ bail:
 int fdt_get_address(const void *fdt, int nodeoffset, uint32_t index,
 			uint64_t *addr, uint64_t *size)
 {
-	int parent;
+	int off = nodeoffset;
 	int len, prop_addr, prop_size;
 	int naddr, nsize, term_size;
 	const void *regs;
@@ -242,12 +242,11 @@ int fdt_get_address(const void *fdt, int nodeoffset, uint32_t index,
 	UK_ASSERT(addr && size);
 
 	/* Get address,size cell from parent */
-	parent = fdt_parent_offset(fdt, nodeoffset);
-	naddr = fdt_address_cells(fdt, parent);
+	naddr = fdt_address_cells(fdt, off);
 	if (naddr < 0 || naddr >= FDT_MAX_NCELLS)
 		return naddr;
 
-	nsize = fdt_size_cells(fdt, parent);
+	nsize = fdt_size_cells(fdt, off);
 	if (nsize < 0 || nsize >= FDT_MAX_NCELLS)
 		return nsize;
 
-- 
2.17.1



From minios-devel-bounces@lists.xenproject.org Wed Dec 23 07:40:12 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Wed, 23 Dec 2020 07:40:12 +0000
Received: from list by lists.xenproject.org with outflank-mailman.58212.102258 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1krykm-0007XX-62; Wed, 23 Dec 2020 07:40:12 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 58212.102258; Wed, 23 Dec 2020 07:40: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 1krykm-0007XQ-2Z; Wed, 23 Dec 2020 07:40:12 +0000
Received: by outflank-mailman (input) for mailman id 58212;
 Wed, 23 Dec 2020 07:40: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=BSFQ=F3=arm.com=justin.he@srs-us1.protection.inumbo.net>)
 id 1krykl-0007X8-Bv
 for minios-devel@lists.xenproject.org; Wed, 23 Dec 2020 07:40:11 +0000
Received: from foss.arm.com (unknown [217.140.110.172])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTP
 id ff319597-e526-4bd0-9bfb-ec1ee4fe8000;
 Wed, 23 Dec 2020 07:40:10 +0000 (UTC)
Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14])
 by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 7192615A2;
 Tue, 22 Dec 2020 23:40:10 -0800 (PST)
Received: from localhost.localdomain (entos-thunderx2-02.shanghai.arm.com
 [10.169.212.215])
 by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 4D0093F66E;
 Tue, 22 Dec 2020 23:40:08 -0800 (PST)
X-BeenThere: minios-devel@lists.xenproject.org
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
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: ff319597-e526-4bd0-9bfb-ec1ee4fe8000
From: Jia He <justin.he@arm.com>
To: minios-devel@lists.xenproject.org,
	Felipe Huici <felipe.huici@neclab.eu>
Cc: Simon Kuenzer <simon.kuenzer@neclab.eu>,
	Sharan.Santhanam@neclab.eu,
	Song Zhu <Song.Zhu@arm.com>,
	Jia He <justin.he@arm.com>
Subject: [UNIKRAFT PATCH RFCv4 22/35] build: Enable pci library on arm64
Date: Wed, 23 Dec 2020 15:38:44 +0800
Message-Id: <20201223073857.118076-23-justin.he@arm.com>
X-Mailer: git-send-email 2.17.1
In-Reply-To: <20201223073857.118076-1-justin.he@arm.com>
References: <20201223073857.118076-1-justin.he@arm.com>

This enables pci library on arm64

Signed-off-by: Jia He <justin.he@arm.com>
---
 plat/kvm/Makefile.uk | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/plat/kvm/Makefile.uk b/plat/kvm/Makefile.uk
index da2eb30..910108a 100644
--- a/plat/kvm/Makefile.uk
+++ b/plat/kvm/Makefile.uk
@@ -109,16 +109,18 @@ LIBKVMPLAT_SRCS-y              += $(UK_PLAT_KVM_DEF_LDS)
 ##
 ## PCI library definitions
 ##
-LIBKVMPCI_ASINCLUDES-$(CONFIG_ARCH_X86_64)  += -I$(LIBKVMPLAT_BASE)/include
-LIBKVMPCI_ASINCLUDES-$(CONFIG_ARCH_X86_64)  += -I$(UK_PLAT_COMMON_BASE)/include
-LIBKVMPCI_CINCLUDES-$(CONFIG_ARCH_X86_64)   += -I$(LIBKVMPLAT_BASE)/include
-LIBKVMPCI_CINCLUDES-$(CONFIG_ARCH_X86_64)   += -I$(UK_PLAT_COMMON_BASE)/include
-LIBKVMPCI_CINCLUDES-$(CONFIG_ARCH_ARM_64)   += -I$(UK_PLAT_DRIVERS_BASE)/include
-LIBKVMPCI_SRCS-y		            += $(UK_PLAT_COMMON_BASE)/pci_bus.c|common
+LIBKVMPCI_ASINCLUDES-y  += -I$(LIBKVMPLAT_BASE)/include
+LIBKVMPCI_ASINCLUDES-y  += -I$(UK_PLAT_COMMON_BASE)/include
+LIBKVMPCI_CINCLUDES-y   += -I$(LIBKVMPLAT_BASE)/include
+LIBKVMPCI_CINCLUDES-y   += -I$(UK_PLAT_COMMON_BASE)/include
+LIBKVMPCI_CINCLUDES-y   += -I$(UK_PLAT_DRIVERS_BASE)/include
+LIBKVMPCI_SRCS-y	+= $(UK_PLAT_COMMON_BASE)/pci_bus.c|common
 LIBKVMPCI_SRCS-$(CONFIG_ARCH_X86_64) += \
 				$(UK_PLAT_COMMON_BASE)/x86/pci_bus_x86.c|x86
 LIBKVMPCI_SRCS-$(CONFIG_ARCH_ARM_64) += \
 				$(UK_PLAT_COMMON_BASE)/arm/pci_bus_arm64.c|arm
+LIBKVMPCI_SRCS-$(CONFIG_ARCH_ARM_64) += \
+				$(UK_PLAT_COMMON_BASE)/pci_ecam.c|arm
 
 ##
 ## Platform bus library definitions
-- 
2.17.1



From minios-devel-bounces@lists.xenproject.org Wed Dec 23 07:40:18 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Wed, 23 Dec 2020 07:40:18 +0000
Received: from list by lists.xenproject.org with outflank-mailman.58216.102262 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1kryks-0007a7-8p; Wed, 23 Dec 2020 07:40:18 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 58216.102262; Wed, 23 Dec 2020 07:40: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 1kryks-0007a0-5n; Wed, 23 Dec 2020 07:40:18 +0000
Received: by outflank-mailman (input) for mailman id 58216;
 Wed, 23 Dec 2020 07:40:16 +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=BSFQ=F3=arm.com=justin.he@srs-us1.protection.inumbo.net>)
 id 1krykq-0007Zi-Ox
 for minios-devel@lists.xenproject.org; Wed, 23 Dec 2020 07:40:16 +0000
Received: from foss.arm.com (unknown [217.140.110.172])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTP
 id 941affa0-d474-450c-a004-d649288c21a5;
 Wed, 23 Dec 2020 07:40:15 +0000 (UTC)
Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14])
 by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id C7D3B15AD;
 Tue, 22 Dec 2020 23:40:15 -0800 (PST)
Received: from localhost.localdomain (entos-thunderx2-02.shanghai.arm.com
 [10.169.212.215])
 by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id A39543F66E;
 Tue, 22 Dec 2020 23:40:13 -0800 (PST)
X-BeenThere: minios-devel@lists.xenproject.org
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
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: 941affa0-d474-450c-a004-d649288c21a5
From: Jia He <justin.he@arm.com>
To: minios-devel@lists.xenproject.org,
	Felipe Huici <felipe.huici@neclab.eu>
Cc: Simon Kuenzer <simon.kuenzer@neclab.eu>,
	Sharan.Santhanam@neclab.eu,
	Song Zhu <Song.Zhu@arm.com>,
	Jia He <justin.he@arm.com>
Subject: [UNIKRAFT PATCH RFCv4 24/35] plat/virtio: Fix virtio net device mac negotiation
Date: Wed, 23 Dec 2020 15:38:46 +0800
Message-Id: <20201223073857.118076-25-justin.he@arm.com>
X-Mailer: git-send-email 2.17.1
In-Reply-To: <20201223073857.118076-1-justin.he@arm.com>
References: <20201223073857.118076-1-justin.he@arm.com>

Otherwise, it causes virtio net mac negotiates failure on arm64.

Signed-off-by: Jia He <justin.he@arm.com>
---
 plat/drivers/virtio/virtio_net.c | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/plat/drivers/virtio/virtio_net.c b/plat/drivers/virtio/virtio_net.c
index b5979d1..5c53c55 100644
--- a/plat/drivers/virtio/virtio_net.c
+++ b/plat/drivers/virtio/virtio_net.c
@@ -833,7 +833,6 @@ static __u16 virtio_net_mtu_get(struct uk_netdev *n)
 static int virtio_netdev_feature_negotiate(struct virtio_net_device *vndev)
 {
 	__u64 host_features = 0;
-	__u16 hw_len;
 	int rc = 0;
 
 	/**
@@ -863,16 +862,18 @@ static int virtio_netdev_feature_negotiate(struct virtio_net_device *vndev)
 	 * virtio device in a separate header file which could be reused across
 	 * different virtio devices.
 	 */
-	hw_len = virtio_config_get(vndev->vdev,
+	virtio_config_get(vndev->vdev,
 				   __offsetof(struct virtio_net_config, mac),
 				   &vndev->hw_addr.addr_bytes[0],
 				   UK_NETDEV_HWADDR_LEN, 1);
-	if (unlikely(hw_len != UK_NETDEV_HWADDR_LEN)) {
-		uk_pr_err("Failed to retrieve the mac address from device\n");
-		rc = -EAGAIN;
-		goto exit;
-	}
 	rc = 0;
+	uk_pr_info("vndev->hw_addr.addr_bytes=[%x %x %x %x %x %x]\n",vndev->hw_addr.addr_bytes[0],
+		vndev->hw_addr.addr_bytes[1],
+		vndev->hw_addr.addr_bytes[2],
+		vndev->hw_addr.addr_bytes[3],
+		vndev->hw_addr.addr_bytes[4],
+		vndev->hw_addr.addr_bytes[5]);
+
 
 	/**
 	 * Mask out features supported by both driver and device.
-- 
2.17.1



From minios-devel-bounces@lists.xenproject.org Wed Dec 23 07:40:26 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Wed, 23 Dec 2020 07:40:26 +0000
Received: from list by lists.xenproject.org with outflank-mailman.58220.102266 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1kryl0-0007c3-Ae; Wed, 23 Dec 2020 07:40:26 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 58220.102266; Wed, 23 Dec 2020 07: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 1kryl0-0007bu-7Z; Wed, 23 Dec 2020 07:40:26 +0000
Received: by outflank-mailman (input) for mailman id 58220;
 Wed, 23 Dec 2020 07:40: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=BSFQ=F3=arm.com=justin.he@srs-us1.protection.inumbo.net>)
 id 1krykz-0007bl-8u
 for minios-devel@lists.xenproject.org; Wed, 23 Dec 2020 07:40:25 +0000
Received: from foss.arm.com (unknown [217.140.110.172])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTP
 id 4773e7b2-ce45-4d1a-bbb3-ec969a72f652;
 Wed, 23 Dec 2020 07:40:24 +0000 (UTC)
Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14])
 by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id E078F1650;
 Tue, 22 Dec 2020 23:40:23 -0800 (PST)
Received: from localhost.localdomain (entos-thunderx2-02.shanghai.arm.com
 [10.169.212.215])
 by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id BB6643F66E;
 Tue, 22 Dec 2020 23:40:21 -0800 (PST)
X-BeenThere: minios-devel@lists.xenproject.org
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
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: 4773e7b2-ce45-4d1a-bbb3-ec969a72f652
From: Jia He <justin.he@arm.com>
To: minios-devel@lists.xenproject.org,
	Felipe Huici <felipe.huici@neclab.eu>
Cc: Simon Kuenzer <simon.kuenzer@neclab.eu>,
	Sharan.Santhanam@neclab.eu,
	Song Zhu <Song.Zhu@arm.com>,
	Jia He <justin.he@arm.com>
Subject: [UNIKRAFT PATCH RFCv4 27/35] plat/platform_bus,virtio_mmio: Avoid useless log storm
Date: Wed, 23 Dec 2020 15:38:49 +0800
Message-Id: <20201223073857.118076-28-justin.he@arm.com>
X-Mailer: git-send-email 2.17.1
In-Reply-To: <20201223073857.118076-1-justin.he@arm.com>
References: <20201223073857.118076-1-justin.he@arm.com>

This is to suppress and adjust some log line level for platform bus and
virtio_mmio. E.g. ENODEV is normal when qemu doesn't create any virtio
mmio devices in the platform bus probing.

Signed-off-by: Jia He <justin.he@arm.com>
---
 plat/common/platform_bus.c        | 7 +++----
 plat/drivers/virtio/virtio_mmio.c | 3 +--
 2 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/plat/common/platform_bus.c b/plat/common/platform_bus.c
index fecb389..83d3e70 100644
--- a/plat/common/platform_bus.c
+++ b/plat/common/platform_bus.c
@@ -81,7 +81,7 @@ static inline struct pf_driver *pf_find_driver(const char *compatible)
 		id.device_id = (uint16_t)drv->match(compatible);
 		if (id.device_id) {
 			if (pf_device_id_match(&id, drv->device_ids)) {
-				uk_pr_debug("pf driver found  devid(0x%x)\n", id.device_id);
+				uk_pr_debug("pf driver found devid(0x%x)\n", id.device_id);
 
 				return drv;
 			}
@@ -105,8 +105,8 @@ static inline int pf_driver_add_device(struct pf_driver *drv,
 	uk_pr_debug("pf_driver_add_device devid=%d\n", dev->id.device_id);
 
 	ret = drv->add_dev(dev);
-	if (ret < 0) {
-		uk_pr_err("Platform Failed to initialize device driver\n");
+	if (ret < 0 && ret != -ENODEV) {
+		uk_pr_err("Platform Failed to initialize device driver, ret(%d)\n",ret);
 	}
 
 	return ret;
@@ -178,7 +178,6 @@ static int pf_probe(void)
 
 		ret = pf_driver_add_device(drv, dev);
 		if (ret < 0) {
-			uk_pr_err("Platform Failed to initialize device driver, ret(%d)\n",ret);
 			uk_free(pfh.a, dev);
 		}
 	} while (1);
diff --git a/plat/drivers/virtio/virtio_mmio.c b/plat/drivers/virtio/virtio_mmio.c
index 9be07c1..be9e59d 100644
--- a/plat/drivers/virtio/virtio_mmio.c
+++ b/plat/drivers/virtio/virtio_mmio.c
@@ -442,7 +442,6 @@ static int virtio_mmio_add_dev(struct pf_device *pfdev)
 	int rc;
 
 	UK_ASSERT(pfdev != NULL);
-	uk_pr_info("virtio_mmio_add dev\n");
 
 	vm_dev = uk_malloc(a, sizeof(*vm_dev));
 	if (!vm_dev) {
@@ -483,7 +482,7 @@ static int virtio_mmio_add_dev(struct pf_device *pfdev)
 		 * virtio-mmio device with an ID 0 is a (dummy) placeholder
 		 * with no function. End probing now with no error reported.
 		 */
-		uk_pr_err("virtio_device_id is 0\n");
+		uk_pr_info("virtio_device_id is 0\n");
 
 		rc = -ENODEV;
 		goto free_vmdev;
-- 
2.17.1



From minios-devel-bounces@lists.xenproject.org Wed Dec 23 07:40:28 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Wed, 23 Dec 2020 07:40:28 +0000
Received: from list by lists.xenproject.org with outflank-mailman.58223.102270 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1kryl2-0007d0-CG; Wed, 23 Dec 2020 07:40:28 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 58223.102270; Wed, 23 Dec 2020 07:40: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 1kryl2-0007ct-9A; Wed, 23 Dec 2020 07:40:28 +0000
Received: by outflank-mailman (input) for mailman id 58223;
 Wed, 23 Dec 2020 07:40:27 +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=BSFQ=F3=arm.com=justin.he@srs-us1.protection.inumbo.net>)
 id 1kryl1-0007bl-QJ
 for minios-devel@lists.xenproject.org; Wed, 23 Dec 2020 07:40:27 +0000
Received: from foss.arm.com (unknown [217.140.110.172])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTP
 id 1cbaa3ea-a3fa-46af-acbb-e9d421621a3f;
 Wed, 23 Dec 2020 07:40:26 +0000 (UTC)
Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14])
 by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 90DA91655;
 Tue, 22 Dec 2020 23:40:26 -0800 (PST)
Received: from localhost.localdomain (entos-thunderx2-02.shanghai.arm.com
 [10.169.212.215])
 by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 6CBFA3F66E;
 Tue, 22 Dec 2020 23:40:24 -0800 (PST)
X-BeenThere: minios-devel@lists.xenproject.org
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
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: 1cbaa3ea-a3fa-46af-acbb-e9d421621a3f
From: Jia He <justin.he@arm.com>
To: minios-devel@lists.xenproject.org,
	Felipe Huici <felipe.huici@neclab.eu>
Cc: Simon Kuenzer <simon.kuenzer@neclab.eu>,
	Sharan.Santhanam@neclab.eu,
	Song Zhu <Song.Zhu@arm.com>,
	Jia He <justin.he@arm.com>
Subject: [UNIKRAFT PATCH RFCv4 28/35] plat/kvm/arm: Add a memory hole at the beginning 128M
Date: Wed, 23 Dec 2020 15:38:50 +0800
Message-Id: <20201223073857.118076-29-justin.he@arm.com>
X-Mailer: git-send-email 2.17.1
In-Reply-To: <20201223073857.118076-1-justin.he@arm.com>
References: <20201223073857.118076-1-justin.he@arm.com>

Previously, arm64 kvm will setup 0x0-0x3fffffff as a device mmio area.
Hence user can even read/write 0x0 arbitrarily without panic.

After whis patch, we can prevent the memory corruption to some extent
since this set the beginning 128M as NONE attr.

Signed-off-by: Jia He <justin.he@arm.com>
---
 plat/kvm/arm/pagetable64.S          | 42 ++++++++++++++++++++++-------
 plat/kvm/include/kvm-arm/arm64/mm.h |  7 ++---
 2 files changed, 36 insertions(+), 13 deletions(-)

diff --git a/plat/kvm/arm/pagetable64.S b/plat/kvm/arm/pagetable64.S
index 1c2a349..6fd9f3b 100644
--- a/plat/kvm/arm/pagetable64.S
+++ b/plat/kvm/arm/pagetable64.S
@@ -38,13 +38,17 @@
 #include <arm/cpu_defs.h>
 /*
  * The following is the Memory Layout of AArch64 Virtual Machine
- * | 0 - 0x3FFFFFFF |   0x40000000 - 0x7FFFFFFFFF           |  512GB - 1TB   |
- * --------------------------------------------------------------------------
- * |  DEVICES MMIO  | DTB|TEXT|DATA|BSS|PAGETABLE|BOOTSTACK | PCI-e High Mem |
- * --------------------------------------------------------------------------
+ * | 0-0x7FFFFFF | 0x8000000-0x3FFFFFFF | 0x40000000-0x7FFFFFFFFF | 512GB-1TB |
+ * ----------------------------------------------------------------------------
+ * | HOLE        | DEVICES MMIO         | <1>                     | <2>       |
+ * ----------------------------------------------------------------------------
+ * <1> DTB|TEXT|DATA|BSS|PAGETABLE|BOOTSTACK
+ * <2> PCI-e High Mem
  */
-#define DEVICE_ADDR_START 0
-#define DEVICE_ADDR_SIZE  0x40000000
+#define HOLE_START 0
+#define HOLE_MEM_ENTRIES  64 /* 128M */
+#define DEVICE_ADDR_START 0x8000000
+#define DEVICE_ENTRIES    448 /* 512-64 */
 #define RAM_ADDR_START    0x40000000
 #define RAM_L2_ENTRIES    255
 #define RAM_ADDR_SIZE     (0x40000000 * RAM_L2_ENTRIES)
@@ -83,14 +87,29 @@ ENTRY(create_pagetables)
 	bl  link_l0_pagetable
 
 	/*
-	 * Using 1GiB block to map device address space (0x0 ~ 0x3fffffff)
+	 * Using 1GiB block to map the hole memory (0x0 ~ 0x7ffffff) and device
+	 * address space (0x0 ~ 0x3fffffff)
 	 */
-	add x6, x14, #L1_TABLE_OFFSET
+	/* Build a L2 block pagetable */
+	add x6, x14, #L2_TABLE_OFFSET
+	ldr x7, =0 /* NONE ATTR*/
+	mov x8, #HOLE_START
+	mov x9, x8
+	ldr x10, =HOLE_MEM_ENTRIES
+	bl  build_l2_block_pagetable
+
+	add x6, x14, #L2_TABLE_OFFSET
 	ldr x7, =SECT_ATTR_DEVICE_nGnRE
 	mov x8, #DEVICE_ADDR_START
 	mov x9, x8
-	mov x10, #1
-	bl  build_l1_block_pagetable
+	ldr x10, =DEVICE_ENTRIES
+	bl  build_l2_block_pagetable
+
+	/* Link this L2 block pagetable to L1 entry */
+	add x6, x14, #L1_TABLE_OFFSET
+	mov x8, #HOLE_START
+	add x9, x14, #L2_TABLE_OFFSET
+	bl  link_l1_pagetable
 
 	/*
 	 * Using 1GiB block to map RAM address space
@@ -135,6 +154,7 @@ ENTRY(create_pagetables)
 	 */
 	/* 1st: Build a L2 block pagetable */
 	add x6, x14, #L2_TABLE_OFFSET
+	add x6, x6, #__PAGE_SIZE
 	ldr x7, =SECT_ATTR_NORMAL
 	mov x8, #RAM_ADDR_START
 	mov x9, x8
@@ -145,6 +165,7 @@ ENTRY(create_pagetables)
 	add x6, x14, #L1_TABLE_OFFSET
 	mov x8, #RAM_ADDR_START
 	add x9, x14, #L2_TABLE_OFFSET
+	add x9, x9, #__PAGE_SIZE
 	bl  link_l1_pagetable
 
 	/* 3rd: Build a L3 pagetable for image occupied memory */
@@ -160,6 +181,7 @@ ENTRY(create_pagetables)
 
 	/* 4th: Link this L3 pagetable to L2 entry */
 	add x6, x14, #L2_TABLE_OFFSET
+	add x6, x6, #__PAGE_SIZE
 1:
 	mov x8, x17
 	mov x9, x16
diff --git a/plat/kvm/include/kvm-arm/arm64/mm.h b/plat/kvm/include/kvm-arm/arm64/mm.h
index 9ec1273..612b9ec 100644
--- a/plat/kvm/include/kvm-arm/arm64/mm.h
+++ b/plat/kvm/include/kvm-arm/arm64/mm.h
@@ -62,11 +62,12 @@
  * Each entry in L2_TABLE can map to a 2MiB block memory or link to a
  * L3_TABLE which supports 2MiB memory mapping. We need a L3_TABLE to
  * cover image area for us to manager different sections attributes.
- * So, we need one page for L2_TABLE to provide 511 enties for 2MiB
- * block mapping and 1 entry for L3_TABLE link.
+ * So, we need two page for L2_TABLE. One is to provide a protecting hole
+ * from memory corrupting. One is to provide 511 enties for 2MiB block
+ * mapping and 1 entry for L3_TABLE link.
  */
 #define L2_TABLE_OFFSET (L1_TABLE_OFFSET + L1_TABLE_SIZE)
-#define L2_TABLE_SIZE   __PAGE_SIZE
+#define L2_TABLE_SIZE   (__PAGE_SIZE * 2)
 
 /*
  * We will use Unikraft image's size to caculate the L3_TABLE_SIZE.
-- 
2.17.1



From minios-devel-bounces@lists.xenproject.org Wed Dec 23 07:40:31 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Wed, 23 Dec 2020 07:40:31 +0000
Received: from list by lists.xenproject.org with outflank-mailman.58224.102275 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1kryl5-0007eJ-Dz; Wed, 23 Dec 2020 07:40:31 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 58224.102275; Wed, 23 Dec 2020 07:40: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 1kryl5-0007eC-Aj; Wed, 23 Dec 2020 07:40:31 +0000
Received: by outflank-mailman (input) for mailman id 58224;
 Wed, 23 Dec 2020 07:40: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=BSFQ=F3=arm.com=justin.he@srs-us1.protection.inumbo.net>)
 id 1kryl4-0007bl-Om
 for minios-devel@lists.xenproject.org; Wed, 23 Dec 2020 07:40:30 +0000
Received: from foss.arm.com (unknown [217.140.110.172])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTP
 id 5966b749-4fcc-476e-8ace-b0d8efa99275;
 Wed, 23 Dec 2020 07:40:29 +0000 (UTC)
Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14])
 by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 4B8901682;
 Tue, 22 Dec 2020 23:40:29 -0800 (PST)
Received: from localhost.localdomain (entos-thunderx2-02.shanghai.arm.com
 [10.169.212.215])
 by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 1D0A93F66E;
 Tue, 22 Dec 2020 23:40:26 -0800 (PST)
X-BeenThere: minios-devel@lists.xenproject.org
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
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: 5966b749-4fcc-476e-8ace-b0d8efa99275
From: Jia He <justin.he@arm.com>
To: minios-devel@lists.xenproject.org,
	Felipe Huici <felipe.huici@neclab.eu>
Cc: Simon Kuenzer <simon.kuenzer@neclab.eu>,
	Sharan.Santhanam@neclab.eu,
	Song Zhu <Song.Zhu@arm.com>,
	Jia He <justin.he@arm.com>
Subject: [UNIKRAFT PATCH RFCv4 29/35] plat/arm: Make sure fpsimd sysregs writing take effects
Date: Wed, 23 Dec 2020 15:38:51 +0800
Message-Id: <20201223073857.118076-30-justin.he@arm.com>
X-Mailer: git-send-email 2.17.1
In-Reply-To: <20201223073857.118076-1-justin.he@arm.com>
References: <20201223073857.118076-1-justin.he@arm.com>

As per [1], we need to add isb() to make sure sysreg writing take
effects.

[1] https://github.com/freebsd/freebsd/blob/1b2bc99e/sys/arm64/arm64/vfp.c#L67

Signed-off-by: Jia He <justin.he@arm.com>
---
 plat/common/include/arm/arm64/cpu.h | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/plat/common/include/arm/arm64/cpu.h b/plat/common/include/arm/arm64/cpu.h
index fe981eb..f96fee4 100644
--- a/plat/common/include/arm/arm64/cpu.h
+++ b/plat/common/include/arm/arm64/cpu.h
@@ -164,11 +164,17 @@ extern void fpsimd_restore_state(uintptr_t ptr);
 static inline void save_extregs(struct sw_ctx *ctx)
 {
 	fpsimd_save_state(ctx->extregs);
+
+	/* make sure sysreg writing takes effects */
+	isb();
 }
 
 static inline void restore_extregs(struct sw_ctx *ctx)
 {
 	fpsimd_restore_state(ctx->extregs);
+
+	/* make sure sysreg writing takes effects */
+	isb();
 }
 
 static inline struct sw_ctx *arch_alloc_sw_ctx(struct uk_alloc *allocator)
-- 
2.17.1



From minios-devel-bounces@lists.xenproject.org Wed Dec 23 07:40:36 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Wed, 23 Dec 2020 07:40:36 +0000
Received: from list by lists.xenproject.org with outflank-mailman.58227.102278 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1krylA-0007g3-FM; Wed, 23 Dec 2020 07:40:36 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 58227.102278; Wed, 23 Dec 2020 07:40: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 1krylA-0007fw-CM; Wed, 23 Dec 2020 07:40:36 +0000
Received: by outflank-mailman (input) for mailman id 58227;
 Wed, 23 Dec 2020 07:40:35 +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=BSFQ=F3=arm.com=justin.he@srs-us1.protection.inumbo.net>)
 id 1kryl9-0007bl-Ox
 for minios-devel@lists.xenproject.org; Wed, 23 Dec 2020 07:40:35 +0000
Received: from foss.arm.com (unknown [217.140.110.172])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTP
 id b7fc4457-5d62-4c4f-b2e8-0e12397caca9;
 Wed, 23 Dec 2020 07:40:34 +0000 (UTC)
Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14])
 by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id B24BF168F;
 Tue, 22 Dec 2020 23:40:34 -0800 (PST)
Received: from localhost.localdomain (entos-thunderx2-02.shanghai.arm.com
 [10.169.212.215])
 by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 85AD63F66E;
 Tue, 22 Dec 2020 23:40:32 -0800 (PST)
X-BeenThere: minios-devel@lists.xenproject.org
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
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: b7fc4457-5d62-4c4f-b2e8-0e12397caca9
From: Jia He <justin.he@arm.com>
To: minios-devel@lists.xenproject.org,
	Felipe Huici <felipe.huici@neclab.eu>
Cc: Simon Kuenzer <simon.kuenzer@neclab.eu>,
	Sharan.Santhanam@neclab.eu,
	Song Zhu <Song.Zhu@arm.com>,
	Jia He <justin.he@arm.com>
Subject: [UNIKRAFT PATCH RFCv4 31/35] plat/virtio_mmio: Fix virtqueue size for virtio 9p device
Date: Wed, 23 Dec 2020 15:38:53 +0800
Message-Id: <20201223073857.118076-32-justin.he@arm.com>
X-Mailer: git-send-email 2.17.1
In-Reply-To: <20201223073857.118076-1-justin.he@arm.com>
References: <20201223073857.118076-1-justin.he@arm.com>

For virtio 9p, the virtqueue size is 128 statically. Without this patch,
virtio 9p device can't be initialized in arm64 kvm plat.

Signed-off-by: Jia He <justin.he@arm.com>
---
 plat/drivers/virtio/virtio_mmio.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/plat/drivers/virtio/virtio_mmio.c b/plat/drivers/virtio/virtio_mmio.c
index be9e59d..dc5c6c2 100644
--- a/plat/drivers/virtio/virtio_mmio.c
+++ b/plat/drivers/virtio/virtio_mmio.c
@@ -309,7 +309,7 @@ static struct virtqueue *vm_setup_vq(struct virtio_dev *vdev,
 	virtio_cwrite32(vm_dev->base, VIRTIO_MMIO_QUEUE_SEL, queue_id);
 
 	/* Activate the queue */
-	virtio_cwrite32(vm_dev->base, VIRTIO_MMIO_QUEUE_NUM, (__u32)virtqueue_vring_get_num(vq));
+	virtio_cwrite32(vm_dev->base, VIRTIO_MMIO_QUEUE_NUM, num_desc);
 	if (vm_dev->version == 1) {
 
 		virtio_cwrite32(vm_dev->base, VIRTIO_MMIO_QUEUE_ALIGN, __PAGE_SIZE);
-- 
2.17.1



From minios-devel-bounces@lists.xenproject.org Wed Dec 23 07:40:44 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Wed, 23 Dec 2020 07:40:44 +0000
Received: from list by lists.xenproject.org with outflank-mailman.58231.102282 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1krylI-0007hy-Gu; Wed, 23 Dec 2020 07:40:44 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 58231.102282; Wed, 23 Dec 2020 07:40: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 1krylI-0007hr-E3; Wed, 23 Dec 2020 07:40:44 +0000
Received: by outflank-mailman (input) for mailman id 58231;
 Wed, 23 Dec 2020 07:40: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=BSFQ=F3=arm.com=justin.he@srs-us1.protection.inumbo.net>)
 id 1krylH-0007hk-Oe
 for minios-devel@lists.xenproject.org; Wed, 23 Dec 2020 07:40:43 +0000
Received: from foss.arm.com (unknown [217.140.110.172])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTP
 id b05a65bd-1ce8-4ce7-8083-434d124f759a;
 Wed, 23 Dec 2020 07:40:42 +0000 (UTC)
Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14])
 by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id C6D4A169C;
 Tue, 22 Dec 2020 23:40:42 -0800 (PST)
Received: from localhost.localdomain (entos-thunderx2-02.shanghai.arm.com
 [10.169.212.215])
 by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 97C2E3F66E;
 Tue, 22 Dec 2020 23:40:40 -0800 (PST)
X-BeenThere: minios-devel@lists.xenproject.org
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
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: b05a65bd-1ce8-4ce7-8083-434d124f759a
From: Jia He <justin.he@arm.com>
To: minios-devel@lists.xenproject.org,
	Felipe Huici <felipe.huici@neclab.eu>
Cc: Simon Kuenzer <simon.kuenzer@neclab.eu>,
	Sharan.Santhanam@neclab.eu,
	Song Zhu <Song.Zhu@arm.com>,
	Jia He <justin.he@arm.com>
Subject: [UNIKRAFT PATCH RFCv4 34/35] lib/posix-user: Export several posix-user interfaces
Date: Wed, 23 Dec 2020 15:38:56 +0800
Message-Id: <20201223073857.118076-35-justin.he@arm.com>
X-Mailer: git-send-email 2.17.1
In-Reply-To: <20201223073857.118076-1-justin.he@arm.com>
References: <20201223073857.118076-1-justin.he@arm.com>

Without these posix-user interfaces, building nginx on arm64 will
trigger linking failures as follows:

.../ngx_process_cycle.c:828: undefined reference to `geteuid'
.../ngx_process_cycle.c:829: undefined reference to `setgid'
.../ngx_process_cycle.c:836: undefined reference to `initgroups'
.../ngx_process_cycle.c:853: undefined reference to `setuid'
<snip>

Signed-off-by: Jia He <justin.he@arm.com>
---
 lib/posix-user/exportsyms.uk | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/lib/posix-user/exportsyms.uk b/lib/posix-user/exportsyms.uk
index 2acde9d..844061c 100644
--- a/lib/posix-user/exportsyms.uk
+++ b/lib/posix-user/exportsyms.uk
@@ -1,6 +1,16 @@
 getpid
+getppid
+getuid
+geteuid
+getlogin
+getpwnam
+getpwuid
+getgrnam
+setgid
+setuid
+issetugid
 uk_syscall_e_getpid
 uk_syscall_r_getpid
-getppid
 uk_syscall_e_getppid
 uk_syscall_r_getppid
+initgroups
-- 
2.17.1



From minios-devel-bounces@lists.xenproject.org Wed Dec 23 07:40:47 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Wed, 23 Dec 2020 07:40:47 +0000
Received: from list by lists.xenproject.org with outflank-mailman.58234.102286 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1krylL-0007j2-Ih; Wed, 23 Dec 2020 07:40:47 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 58234.102286; Wed, 23 Dec 2020 07:40: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 1krylL-0007iv-Fi; Wed, 23 Dec 2020 07:40:47 +0000
Received: by outflank-mailman (input) for mailman id 58234;
 Wed, 23 Dec 2020 07:40:46 +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=BSFQ=F3=arm.com=justin.he@srs-us1.protection.inumbo.net>)
 id 1krylK-0007hk-CK
 for minios-devel@lists.xenproject.org; Wed, 23 Dec 2020 07:40:46 +0000
Received: from foss.arm.com (unknown [217.140.110.172])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTP
 id 26759270-cb79-49d4-8a5e-0d34571ed4d3;
 Wed, 23 Dec 2020 07:40:45 +0000 (UTC)
Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14])
 by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 7F62D169E;
 Tue, 22 Dec 2020 23:40:45 -0800 (PST)
Received: from localhost.localdomain (entos-thunderx2-02.shanghai.arm.com
 [10.169.212.215])
 by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 52F0B3F66E;
 Tue, 22 Dec 2020 23:40:43 -0800 (PST)
X-BeenThere: minios-devel@lists.xenproject.org
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
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: 26759270-cb79-49d4-8a5e-0d34571ed4d3
From: Jia He <justin.he@arm.com>
To: minios-devel@lists.xenproject.org,
	Felipe Huici <felipe.huici@neclab.eu>
Cc: Simon Kuenzer <simon.kuenzer@neclab.eu>,
	Sharan.Santhanam@neclab.eu,
	Song Zhu <Song.Zhu@arm.com>,
	Jia He <justin.he@arm.com>
Subject: [UNIKRAFT PATCH RFCv4 35/35] plat/virtio: Fix the return value check for virtio_cread_bytes_many()
Date: Wed, 23 Dec 2020 15:38:57 +0800
Message-Id: <20201223073857.118076-36-justin.he@arm.com>
X-Mailer: git-send-email 2.17.1
In-Reply-To: <20201223073857.118076-1-justin.he@arm.com>
References: <20201223073857.118076-1-justin.he@arm.com>

The return value of virtio_cread_bytes_many can be:
1) is -1 if something wrong
2) is len (>=0) if everything is fine

So the check condition in vpci_legacy_pci_config_get should be adjusted
if rc!=len

Otherwise, the initialization of virtio-9p device will be failed on
arm64 kvm plat.

Signed-off-by: Jia He <justin.he@arm.com>
---
 plat/drivers/virtio/virtio_pci.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/plat/drivers/virtio/virtio_pci.c b/plat/drivers/virtio/virtio_pci.c
index 3c62a3c..3a2229a 100644
--- a/plat/drivers/virtio/virtio_pci.c
+++ b/plat/drivers/virtio/virtio_pci.c
@@ -278,8 +278,11 @@ static int vpci_legacy_pci_config_get(struct virtio_dev *vdev, __u16 offset,
 		rc = virtio_cread_bytes_many(
 				(void *) (unsigned long)vpdev->pci_base_addr,
 				VIRTIO_PCI_CONFIG_OFF + offset,	buf, len);
+		if (rc != (int)len)
+			return -EFAULT;
 	}
-	return rc;
+
+	return 0;
 }
 
 static __u8 vpci_legacy_pci_status_get(struct virtio_dev *vdev)
-- 
2.17.1



From minios-devel-bounces@lists.xenproject.org Wed Dec 23 07:49:14 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Wed, 23 Dec 2020 07:49:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.58248.102290 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1krytV-0007uR-74; Wed, 23 Dec 2020 07:49:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 58248.102290; Wed, 23 Dec 2020 07:49: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 1krytV-0007uE-3o; Wed, 23 Dec 2020 07:49:13 +0000
Received: by outflank-mailman (input) for mailman id 58248;
 Wed, 23 Dec 2020 07:49: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=BSFQ=F3=arm.com=justin.he@srs-us1.protection.inumbo.net>)
 id 1krykn-0006Xr-Oo
 for minios-devel@lists.xenproject.org; Wed, 23 Dec 2020 07:40:13 +0000
Received: from foss.arm.com (unknown [217.140.110.172])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTP
 id 142a5e46-414e-42d6-8483-000c5885d17e;
 Wed, 23 Dec 2020 07:39:54 +0000 (UTC)
Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14])
 by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 537DB1534;
 Tue, 22 Dec 2020 23:39:54 -0800 (PST)
Received: from localhost.localdomain (entos-thunderx2-02.shanghai.arm.com
 [10.169.212.215])
 by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 2F0C33F66E;
 Tue, 22 Dec 2020 23:39:51 -0800 (PST)
X-BeenThere: minios-devel@lists.xenproject.org
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
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: 142a5e46-414e-42d6-8483-000c5885d17e
From: Jia He <justin.he@arm.com>
To: minios-devel@lists.xenproject.org,
	Felipe Huici <felipe.huici@neclab.eu>
Cc: Simon Kuenzer <simon.kuenzer@neclab.eu>,
	Sharan.Santhanam@neclab.eu,
	Song Zhu <Song.Zhu@arm.com>,
	Jia He <justin.he@arm.com>
Subject: [UNIKRAFT PATCH RFCv4 16/35] plat/ofw: Add fdt_prop_read_bool
Date: Wed, 23 Dec 2020 15:38:38 +0800
Message-Id: <20201223073857.118076-17-justin.he@arm.com>
X-Mailer: git-send-email 2.17.1
In-Reply-To: <20201223073857.118076-1-justin.he@arm.com>
References: <20201223073857.118076-1-justin.he@arm.com>

This fdt_prop_read_bool helper returns true when the property is
existed. This is helpful when we just need to know whether the property
is there instead of getting its value.

Signed-off-by: Jia He <justin.he@arm.com>
---
 plat/drivers/include/ofw/fdt.h | 14 ++++++++++++++
 plat/drivers/ofw/fdt.c         |  8 ++++++++
 2 files changed, 22 insertions(+)

diff --git a/plat/drivers/include/ofw/fdt.h b/plat/drivers/include/ofw/fdt.h
index 0220fad..a3896ff 100644
--- a/plat/drivers/include/ofw/fdt.h
+++ b/plat/drivers/include/ofw/fdt.h
@@ -35,6 +35,8 @@
 #ifndef _PLAT_DRIVER_OFW_FDT_H
 #define _PLAT_DRIVER_OFW_FDT_H
 
+#include <stdbool.h>
+
 #define FDT_BAD_ADDR (uint64_t)(-1)
 
 /**
@@ -186,4 +188,16 @@ int fdt_node_offset_idx_by_compatible_list(const void *fdt, int startoffset,
  */
 int fdt_get_interrupt(const void *fdt, int nodeoffset,
 				uint32_t index, int *size, fdt32_t **prop);
+
+/**
+ * fdt_prop_read_bool - Find a property
+ * @fdt: pointer to the device tree blob
+ * @start_offset: start offset of the node to find the address for
+ * @propname:	name of the property to be searched.
+ *
+ * Search for a property in a device node.
+ * Returns true if the property exists false otherwise.
+ */
+bool fdt_prop_read_bool(const void *fdt, int start_offset,
+					 const char *propname);
 #endif
diff --git a/plat/drivers/ofw/fdt.c b/plat/drivers/ofw/fdt.c
index 876637d..48c5dfd 100644
--- a/plat/drivers/ofw/fdt.c
+++ b/plat/drivers/ofw/fdt.c
@@ -337,3 +337,11 @@ int fdt_get_interrupt(const void *fdt, int nodeoffset,
 
 	return 0;
 }
+
+bool fdt_prop_read_bool(const void *fdt, int start_offset,
+					 const char *propname)
+{
+	const struct fdt_property *prop = fdt_getprop(fdt, start_offset, propname, NULL);
+
+	return prop ? true : false;
+}
-- 
2.17.1



From minios-devel-bounces@lists.xenproject.org Wed Dec 23 07:49:14 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Wed, 23 Dec 2020 07:49:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.58250.102295 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1krytV-0007vH-DY; Wed, 23 Dec 2020 07:49:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 58250.102295; Wed, 23 Dec 2020 07:49: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 1krytV-0007uu-7Q; Wed, 23 Dec 2020 07:49:13 +0000
Received: by outflank-mailman (input) for mailman id 58250;
 Wed, 23 Dec 2020 07:49: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=BSFQ=F3=arm.com=justin.he@srs-us1.protection.inumbo.net>)
 id 1krylR-0006Xr-PT
 for minios-devel@lists.xenproject.org; Wed, 23 Dec 2020 07:40:53 +0000
Received: from foss.arm.com (unknown [217.140.110.172])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTP
 id 4331ef67-9c8a-4735-a337-347ee2348f33;
 Wed, 23 Dec 2020 07:40:40 +0000 (UTC)
Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14])
 by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 175B91692;
 Tue, 22 Dec 2020 23:40:40 -0800 (PST)
Received: from localhost.localdomain (entos-thunderx2-02.shanghai.arm.com
 [10.169.212.215])
 by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id E350A3F66E;
 Tue, 22 Dec 2020 23:40:37 -0800 (PST)
X-BeenThere: minios-devel@lists.xenproject.org
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
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: 4331ef67-9c8a-4735-a337-347ee2348f33
From: Jia He <justin.he@arm.com>
To: minios-devel@lists.xenproject.org,
	Felipe Huici <felipe.huici@neclab.eu>
Cc: Simon Kuenzer <simon.kuenzer@neclab.eu>,
	Sharan.Santhanam@neclab.eu,
	Song Zhu <Song.Zhu@arm.com>,
	Jia He <justin.he@arm.com>
Subject: [UNIKRAFT PATCH RFCv4 33/35] plat/kvm/arm: Fix x19 corruption by interrupt handler
Date: Wed, 23 Dec 2020 15:38:55 +0800
Message-Id: <20201223073857.118076-34-justin.he@arm.com>
X-Mailer: git-send-email 2.17.1
In-Reply-To: <20201223073857.118076-1-justin.he@arm.com>
References: <20201223073857.118076-1-justin.he@arm.com>

There is a crashing when testing nginx on arm64:
        [0x401015bc] trap_el1_sync+0x50/0x58
        [0x4010209c] el1_sync+0x9c/0x100
        [0x401169c0] _vprint+0x158/0x318
        [0x40116ce0] _uk_vprintk+0x64/0x74
        [0x40116d74] _uk_printk+0x84/0x90
        [0x4017f2e8] netif_alloc_rxpkts+0xd0/0x1f8
        [0x4010e5d0] virtio_netdev_rx_fillup+0x78/0x2a4
        [0x4010f298] virtio_netdev_recv+0x20c/0x400
        [0x4017eddc] uk_netdev_rx_one+0x2c8/0x2d0
        [0x4017f8a4] uknetdev_input+0x158/0x348
        [0x4013e5fc] _dispatcher+0x110/0x114
        [0x4011d478] uk_sched_thread_exit+0/0xbc
        [0x40218f44] uk_free+0x1c/0x28
        [0x40219030] free+0x18/0x20
        [0x4012a300] sys_write+0x17c/0x188
        [0x4012dcfc] pwritev+0x6c/0xd0
        [...]

Previously, x18,x19 are incorrectly restored by old _sp_. x18 can be
used/restore freely, but x19 is callee save register which can't be
corrupted.

Signed-off-by: Jia He <justin.he@arm.com>
---
 plat/kvm/arm/exceptions.S | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/plat/kvm/arm/exceptions.S b/plat/kvm/arm/exceptions.S
index 929d900..e0f4cb2 100644
--- a/plat/kvm/arm/exceptions.S
+++ b/plat/kvm/arm/exceptions.S
@@ -111,6 +111,7 @@
 .macro LEAVE_TRAP, el
 	/* Mask IRQ to make sure restore would not be interrupted by IRQ */
 	msr daifset, #2
+
 	/* Restore pstate and exception status register */
 	ldp x22, x23, [sp, #16 * 16]
 	msr spsr_el1, x22
@@ -126,6 +127,7 @@
 	ldp x24, x25, [sp, #16 * 12]
 	ldp x22, x23, [sp, #16 * 11]
 	ldp x20, x21, [sp, #16 * 10]
+	ldp x18, x19, [sp, #16 * 9]
 	ldp x16, x17, [sp, #16 * 8]
 	ldp x14, x15, [sp, #16 * 7]
 	ldp x12, x13, [sp, #16 * 6]
@@ -136,6 +138,7 @@
 	ldp x2, x3, [sp, #16 * 1]
 	ldp x0, x1, [sp, #16 * 0]
 
+	/* x18 can be used freely */
 .if \el == 0
 	/* Restore stack pointer for exception from EL0 */
 	ldr x18, [sp, #__SP_EL0_OFFSET]
@@ -147,9 +150,6 @@
 .endif
 	add sp, sp, #__TRAP_STACK_SIZE
 
-	/* Restore x18,x19 */
-	ldp x18, x19, [sp, #16 * 9]
-
 	eret
 .endm
 
-- 
2.17.1



From minios-devel-bounces@lists.xenproject.org Wed Dec 23 07:49:14 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Wed, 23 Dec 2020 07:49:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.58249.102293 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1krytV-0007uv-BK; Wed, 23 Dec 2020 07:49:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 58249.102293; Wed, 23 Dec 2020 07:49: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 1krytV-0007ud-5Z; Wed, 23 Dec 2020 07:49:13 +0000
Received: by outflank-mailman (input) for mailman id 58249;
 Wed, 23 Dec 2020 07:49: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=BSFQ=F3=arm.com=justin.he@srs-us1.protection.inumbo.net>)
 id 1kryks-0006Xr-Op
 for minios-devel@lists.xenproject.org; Wed, 23 Dec 2020 07:40:18 +0000
Received: from foss.arm.com (unknown [217.140.110.172])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTP
 id 16c1318e-c9fb-4ce7-917a-1225d3260926;
 Wed, 23 Dec 2020 07:39:57 +0000 (UTC)
Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14])
 by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 047EC1570;
 Tue, 22 Dec 2020 23:39:57 -0800 (PST)
Received: from localhost.localdomain (entos-thunderx2-02.shanghai.arm.com
 [10.169.212.215])
 by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id D49A13F66E;
 Tue, 22 Dec 2020 23:39:54 -0800 (PST)
X-BeenThere: minios-devel@lists.xenproject.org
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
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: 16c1318e-c9fb-4ce7-917a-1225d3260926
From: Jia He <justin.he@arm.com>
To: minios-devel@lists.xenproject.org,
	Felipe Huici <felipe.huici@neclab.eu>
Cc: Simon Kuenzer <simon.kuenzer@neclab.eu>,
	Sharan.Santhanam@neclab.eu,
	Song Zhu <Song.Zhu@arm.com>,
	Jia He <justin.he@arm.com>
Subject: [UNIKRAFT PATCH RFCv4 17/35] plat/pci_bus: Split specific code into different files
Date: Wed, 23 Dec 2020 15:38:39 +0800
Message-Id: <20201223073857.118076-18-justin.he@arm.com>
X-Mailer: git-send-email 2.17.1
In-Reply-To: <20201223073857.118076-1-justin.he@arm.com>
References: <20201223073857.118076-1-justin.he@arm.com>

There are significant difference for pci controller on arm64 and x86.
On arm64, only pci ecam is supported.
Hence split arch dependant codes into arch specific directory
No functional changes in this patch, especially for x86 codes.

Signed-off-by: Jia He <justin.he@arm.com>
---
 plat/common/include/pci/pci_bus.h |  66 ++++++++
 plat/common/pci_bus.c             | 247 +-----------------------------
 plat/common/x86/pci_bus_x86.c     | 240 +++++++++++++++++++++++++++++
 plat/kvm/Makefile.uk              |   7 +-
 4 files changed, 315 insertions(+), 245 deletions(-)
 create mode 100644 plat/common/x86/pci_bus_x86.c

diff --git a/plat/common/include/pci/pci_bus.h b/plat/common/include/pci/pci_bus.h
index db406a1..a49e7e3 100644
--- a/plat/common/include/pci/pci_bus.h
+++ b/plat/common/include/pci/pci_bus.h
@@ -174,5 +174,71 @@ struct pci_device {
 /* Do not use this function directly: */
 void _pci_register_driver(struct pci_driver *drv);
 
+struct pci_bus_handler {
+	struct uk_bus b;
+	struct uk_alloc *a;
+	struct uk_list_head drv_list;  /**< List of PCI drivers */
+	struct uk_list_head dev_list;  /**< List of PCI devices */
+};
+static struct pci_bus_handler ph;
+
+#define PCI_INVALID_ID              (0xFFFF)
+#define PCI_DEVICE_ID_MASK          (0xFFFF)
+
+#define PCI_CONFIG_ADDR             (0xCF8)
+#define PCI_CONFIG_DATA             (0xCFC)
+
+/* 8 bits for bus number, 5 bits for devices, 3 for functions */
+#define PCI_MAX_BUSES               (1 << 8)
+#define PCI_MAX_DEVICES             (1 << 5)
+#define PCI_MAX_FUNCTIONS           (1 << 3)
+
+#define PCI_BUS_SHIFT               (16)
+#define PCI_DEVICE_SHIFT            (11)
+#define PCI_FUNCTION_SHIFT          (8)
+#define PCI_ENABLE_BIT              (1 << 31)
+
+#define PCI_CONF_CLASS_ID          (0x08)
+#define PCI_CONF_CLASS_ID_SHFT     (16)
+#define PCI_CONF_CLASS_ID_MASK     (0xFF00)
+
+#define PCI_CONF_VENDOR_ID          (0x00)
+#define PCI_CONF_VENDOR_ID_SHFT     (0)
+#define PCI_CONF_VENDOR_ID_MASK     (0x0000FFFF)
+
+#define PCI_CONF_DEVICE_ID          (0x00)
+#define PCI_CONF_DEVICE_ID_SHFT     (16)
+#define PCI_CONF_DEVICE_ID_MASK     (0x0000FFFF)
+
+#define PCI_CONF_SUBSYSVEN_ID          (0x2c)
+#define PCI_CONF_SUBSYSVEN_ID_SHFT     (0)
+#define PCI_CONF_SUBSYSVEN_ID_MASK     (0xFFFF)
+
+#define PCI_CONF_SUBCLASS_ID          (0x08)
+#define PCI_CONF_SUBCLASS_ID_SHFT     (16)
+#define PCI_CONF_SUBCLASS_ID_MASK     (0x00FF)
+
+#define PCI_CONF_SECONDARY_BUS          (0x18)
+#define PCI_CONF_SECONDARY_BUS_SHFT     (0)
+#define PCI_CONF_SECONDARY_BUS_MASK     (0xFF00)
+
+#define PCI_HEADER_TYPE_MSB_MASK   (0x80)
+#define PCI_CONF_HEADER_TYPE       (0x00)
+#define PCI_CONF_HEADER_TYPE_SHFT  (16)
+#define PCI_CONF_HEADER_TYPE_MASK  (0xFF)
+
+#define PCI_CONF_SUBSYS_ID          (0x2c)
+#define PCI_CONF_SUBSYS_ID_SHFT     (16)
+#define PCI_CONF_SUBSYS_ID_MASK     (0xFFFF)
+
+#define PCI_CONF_IRQ                (0X3C)
+#define PCI_CONF_IRQ_SHFT           (0x0)
+#define PCI_CONF_IRQ_MASK           (0XFF)
+
+#define PCI_CONF_IOBAR              (0x10)
+#define PCI_CONF_IOBAR_SHFT         (0x0)
+#define PCI_CONF_IOBAR_MASK         (~0x3)
+
+struct pci_driver *pci_find_driver(struct pci_device_id *id);
 
 #endif /* __UKPLAT_COMMON_PCI_BUS_H__ */
diff --git a/plat/common/pci_bus.c b/plat/common/pci_bus.c
index cfc404e..7446bbe 100644
--- a/plat/common/pci_bus.c
+++ b/plat/common/pci_bus.c
@@ -58,79 +58,7 @@
 #include <uk/plat/common/cpu.h>
 #include <pci/pci_bus.h>
 
-struct pci_bus_handler {
-	struct uk_bus b;
-	struct uk_alloc *a;
-	struct uk_list_head drv_list;  /**< List of PCI drivers */
-	struct uk_list_head dev_list;  /**< List of PCI devices */
-};
-static struct pci_bus_handler ph;
-
-#define PCI_INVALID_ID              (0xFFFF)
-#define PCI_DEVICE_ID_MASK          (0xFFFF)
-
-#define PCI_CONFIG_ADDR             (0xCF8)
-#define PCI_CONFIG_DATA             (0xCFC)
-
-/* 8 bits for bus number, 5 bits for devices, 3 for functions */
-#define PCI_MAX_BUSES               (1 << 8)
-#define PCI_MAX_DEVICES             (1 << 5)
-#define PCI_MAX_FUNCTIONS           (1 << 3)
-
-#define PCI_BUS_SHIFT               (16)
-#define PCI_DEVICE_SHIFT            (11)
-#define PCI_FUNCTION_SHIFT          (8)
-#define PCI_ENABLE_BIT              (1 << 31)
-
-#define PCI_CONF_CLASS_ID          (0x08)
-#define PCI_CONF_CLASS_ID_SHFT     (16)
-#define PCI_CONF_CLASS_ID_MASK     (0xFF00)
-
-#define PCI_CONF_VENDOR_ID          (0x00)
-#define PCI_CONF_VENDOR_ID_SHFT     (0)
-#define PCI_CONF_VENDOR_ID_MASK     (0x0000FFFF)
-
-#define PCI_CONF_DEVICE_ID          (0x00)
-#define PCI_CONF_DEVICE_ID_SHFT     (16)
-#define PCI_CONF_DEVICE_ID_MASK     (0x0000FFFF)
-
-#define PCI_CONF_SUBSYSVEN_ID          (0x2c)
-#define PCI_CONF_SUBSYSVEN_ID_SHFT     (0)
-#define PCI_CONF_SUBSYSVEN_ID_MASK     (0xFFFF)
-
-#define PCI_CONF_SUBCLASS_ID          (0x08)
-#define PCI_CONF_SUBCLASS_ID_SHFT     (16)
-#define PCI_CONF_SUBCLASS_ID_MASK     (0x00FF)
-
-#define PCI_CONF_SECONDARY_BUS          (0x18)
-#define PCI_CONF_SECONDARY_BUS_SHFT     (0)
-#define PCI_CONF_SECONDARY_BUS_MASK     (0xFF00)
-
-#define PCI_HEADER_TYPE_MSB_MASK   (0x80)
-#define PCI_CONF_HEADER_TYPE       (0x00)
-#define PCI_CONF_HEADER_TYPE_SHFT  (16)
-#define PCI_CONF_HEADER_TYPE_MASK  (0xFF)
-
-#define PCI_CONF_SUBSYS_ID          (0x2c)
-#define PCI_CONF_SUBSYS_ID_SHFT     (16)
-#define PCI_CONF_SUBSYS_ID_MASK     (0xFFFF)
-
-#define PCI_CONF_IRQ                (0X3C)
-#define PCI_CONF_IRQ_SHFT           (0x0)
-#define PCI_CONF_IRQ_MASK           (0XFF)
-
-#define PCI_CONF_IOBAR              (0x10)
-#define PCI_CONF_IOBAR_SHFT         (0x0)
-#define PCI_CONF_IOBAR_MASK         (~0x3)
-
-#define PCI_CONF_READ(type, ret, a, s)					\
-	do {								\
-		uint32_t _conf_data;					\
-		outl(PCI_CONFIG_ADDR, (a) | PCI_CONF_##s);		\
-		_conf_data = ((inl(PCI_CONFIG_DATA) >> PCI_CONF_##s##_SHFT) \
-			      & PCI_CONF_##s##_MASK);			\
-		*(ret) = (type) _conf_data;				\
-	} while (0)
+extern int arch_pci_probe(void);
 
 static inline int pci_device_id_match(const struct pci_device_id *id0,
 					const struct pci_device_id *id1)
@@ -175,7 +103,7 @@ static inline int pci_device_id_is_any(const struct pci_device_id *id)
 	return 0;
 }
 
-static inline struct pci_driver *pci_find_driver(struct pci_device_id *id)
+struct pci_driver *pci_find_driver(struct pci_device_id *id)
 {
 	struct pci_driver *drv;
 	const struct pci_device_id *drv_id;
@@ -191,177 +119,9 @@ static inline struct pci_driver *pci_find_driver(struct pci_device_id *id)
 	return NULL; /* no driver found */
 }
 
-static inline int pci_driver_add_device(struct pci_driver *drv,
-					struct pci_address *addr,
-					struct pci_device_id *devid)
-{
-	struct pci_device *dev;
-	uint32_t config_addr;
-	int ret;
-
-	UK_ASSERT(drv != NULL);
-	UK_ASSERT(drv->add_dev != NULL);
-	UK_ASSERT(addr != NULL);
-	UK_ASSERT(devid != NULL);
-
-	dev = (struct pci_device *) uk_calloc(ph.a, 1, sizeof(*dev));
-	if (!dev) {
-		uk_pr_err("PCI %02x:%02x.%02x: Failed to initialize: Out of memory!\n",
-			  (int) addr->bus,
-			  (int) addr->devid,
-			  (int) addr->function);
-		return -ENOMEM;
-	}
-
-	memcpy(&dev->id,   devid, sizeof(dev->id));
-	memcpy(&dev->addr, addr,  sizeof(dev->addr));
-	dev->drv = drv;
-
-	config_addr = (PCI_ENABLE_BIT)
-			| (addr->bus << PCI_BUS_SHIFT)
-			| (addr->devid << PCI_DEVICE_SHIFT);
-	PCI_CONF_READ(uint16_t, &dev->base, config_addr, IOBAR);
-	PCI_CONF_READ(uint8_t, &dev->irq, config_addr, IRQ);
-
-	ret = drv->add_dev(dev);
-	if (ret < 0) {
-		uk_pr_err("PCI %02x:%02x.%02x: Failed to initialize device driver\n",
-			  (int) addr->bus,
-			  (int) addr->devid,
-			  (int) addr->function);
-		uk_free(ph.a, dev);
-	}
-	return 0;
-}
-
-static void probe_bus(uint32_t);
-
-/* Probe a function. Return 1 if the function does not exist in the device, 0
- * otherwise.
- */
-static int probe_function(uint32_t bus, uint32_t device, uint32_t function)
-{
-	uint32_t config_addr, config_data, subclass, secondary_bus;
-	struct pci_address addr;
-	struct pci_device_id devid;
-	struct pci_driver *drv;
-
-	config_addr = (PCI_ENABLE_BIT)
-			| (bus << PCI_BUS_SHIFT)
-			| (device << PCI_DEVICE_SHIFT)
-			| (function << PCI_FUNCTION_SHIFT);
-
-	outl(PCI_CONFIG_ADDR, config_addr);
-	config_data = inl(PCI_CONFIG_DATA);
-
-	devid.vendor_id = config_data & PCI_DEVICE_ID_MASK;
-	if (devid.vendor_id == PCI_INVALID_ID) {
-		/* Device doesn't exist */
-		return 1;
-	}
-
-	addr.domain   = 0x0;
-	addr.bus      = bus;
-	addr.devid    = device;
-	addr.function = function;
-
-	/* These I/O reads could be batched, but it practice this does not
-	 * appear to make the code more performant.
-	 */
-	PCI_CONF_READ(uint32_t, &devid.class_id,
-			config_addr, CLASS_ID);
-	PCI_CONF_READ(uint32_t, &subclass,
-			config_addr, SUBCLASS_ID);
-	PCI_CONF_READ(uint16_t, &devid.vendor_id,
-			config_addr, VENDOR_ID);
-	PCI_CONF_READ(uint16_t, &devid.device_id,
-			config_addr, DEVICE_ID);
-	PCI_CONF_READ(uint16_t, &devid.subsystem_device_id,
-			config_addr, SUBSYS_ID);
-	PCI_CONF_READ(uint16_t, &devid.subsystem_vendor_id,
-			config_addr, SUBSYSVEN_ID);
-
-	uk_pr_info("PCI %02x:%02x.%02x (%04x %04x:%04x): ",
-		   (int) addr.bus,
-		   (int) addr.devid,
-		   (int) addr.function,
-		   (int) devid.class_id,
-		   (int) devid.vendor_id,
-		   (int) devid.device_id);
-
-	drv = pci_find_driver(&devid);
-	if (!drv) {
-		uk_pr_info("<no driver>\n");
-	} else {
-		uk_pr_info("driver %p\n", drv);
-		pci_driver_add_device(drv, &addr, &devid);
-	}
-
-	/* 0x06 = Bridge Device, 0x04 = PCI-to-PCI bridge */
-	if ((devid.class_id == 0x06) && (subclass == 0x04) ) {
-		PCI_CONF_READ(uint32_t, &secondary_bus,
-				config_addr, SECONDARY_BUS);
-		probe_bus(secondary_bus);
-	}
-
-	return 0;
-}
-
-/* Recursive PCI enumeration: this function is called recursively by
- * probe_function upon discovering PCI-to-PCI bridges.
- */
-static void probe_bus(uint32_t bus)
-{
-	uint32_t config_addr, device, header_type, function = 0;
-
-	for (device = 0; device < PCI_MAX_DEVICES; ++device) {
-		if (!probe_function(bus, device, function))
-			continue;
-
-		config_addr = (PCI_ENABLE_BIT);
-		PCI_CONF_READ(uint32_t, &header_type,
-				config_addr, HEADER_TYPE);
-
-		/* Is this a multi-function device? */
-		if ((header_type & PCI_HEADER_TYPE_MSB_MASK) == 0)
-			continue;
-
-		/* Check remaining functions */
-		for (function = 1; function < PCI_MAX_FUNCTIONS; function++)
-			probe_function(bus, device, function);
-	}
-}
-
 static int pci_probe(void)
 {
-	uint32_t config_addr, function, header_type, vendor_id;
-
-	uk_pr_debug("Probe PCI\n");
-
-	config_addr = (PCI_ENABLE_BIT);
-	PCI_CONF_READ(uint32_t, &header_type,
-			config_addr, HEADER_TYPE);
-
-	if ((header_type & PCI_HEADER_TYPE_MSB_MASK) == 0) {
-		/* Single PCI host controller */
-		probe_bus(0);
-	} else {
-		/* Multiple PCI host controllers */
-		for (function = 0; function < PCI_MAX_FUNCTIONS; function++) {
-			config_addr = (PCI_ENABLE_BIT) |
-					(function << PCI_FUNCTION_SHIFT);
-
-			PCI_CONF_READ(uint32_t, &vendor_id,
-					config_addr, VENDOR_ID);
-
-			if (vendor_id != PCI_INVALID_ID)
-				break;
-
-			probe_bus(function);
-		}
-	}
-
-	return 0;
+	return arch_pci_probe();
 }
 
 
@@ -384,6 +144,7 @@ static int pci_init(struct uk_alloc *a)
 			uk_list_del_init(&drv->list);
 		}
 	}
+
 	return 0;
 }
 
diff --git a/plat/common/x86/pci_bus_x86.c b/plat/common/x86/pci_bus_x86.c
new file mode 100644
index 0000000..b6d4ec6
--- /dev/null
+++ b/plat/common/x86/pci_bus_x86.c
@@ -0,0 +1,240 @@
+/* TODO: SPDX Header */
+/*
+ * Authors: Simon Kuenzer <simon.kuenzer@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.
+ */
+/* Some code was derived from Solo5: */
+/*
+ * Copyright (c) 2015-2017 Contributors as noted in the AUTHORS file
+ *
+ * This file is part of Solo5, a unikernel base layer.
+ *
+ * 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.
+ */
+
+#include <string.h>
+#include <uk/print.h>
+#include <uk/plat/common/cpu.h>
+#include <pci/pci_bus.h>
+
+#define PCI_CONF_READ(type, ret, a, s)					\
+	do {								\
+		uint32_t _conf_data;					\
+		outl(PCI_CONFIG_ADDR, (a) | PCI_CONF_##s);		\
+		_conf_data = ((inl(PCI_CONFIG_DATA) >> PCI_CONF_##s##_SHFT) \
+			      & PCI_CONF_##s##_MASK);			\
+		*(ret) = (type) _conf_data;				\
+	} while (0)
+
+static inline int pci_driver_add_device(struct pci_driver *drv,
+					struct pci_address *addr,
+					struct pci_device_id *devid)
+{
+	struct pci_device *dev;
+	uint32_t config_addr;
+	int ret;
+
+	UK_ASSERT(drv != NULL);
+	UK_ASSERT(drv->add_dev != NULL);
+	UK_ASSERT(addr != NULL);
+	UK_ASSERT(devid != NULL);
+
+	dev = (struct pci_device *) uk_calloc(ph.a, 1, sizeof(*dev));
+	if (!dev) {
+		uk_pr_err("PCI %02x:%02x.%02x: Failed to initialize: Out of memory!\n",
+			  (int) addr->bus,
+			  (int) addr->devid,
+			  (int) addr->function);
+		return -ENOMEM;
+	}
+
+	memcpy(&dev->id,   devid, sizeof(dev->id));
+	memcpy(&dev->addr, addr,  sizeof(dev->addr));
+	dev->drv = drv;
+
+	config_addr = (PCI_ENABLE_BIT)
+			| (addr->bus << PCI_BUS_SHIFT)
+			| (addr->devid << PCI_DEVICE_SHIFT);
+	PCI_CONF_READ(uint16_t, &dev->base, config_addr, IOBAR);
+	PCI_CONF_READ(uint8_t, &dev->irq, config_addr, IRQ);
+
+	ret = drv->add_dev(dev);
+	if (ret < 0) {
+		uk_pr_err("PCI %02x:%02x.%02x: Failed to initialize device driver\n",
+			  (int) addr->bus,
+			  (int) addr->devid,
+			  (int) addr->function);
+		uk_free(ph.a, dev);
+	}
+	return 0;
+}
+
+static void probe_bus(uint32_t);
+
+/* Probe a function. Return 1 if the function does not exist in the device, 0
+ * otherwise.
+ */
+static int probe_function(uint32_t bus, uint32_t device, uint32_t function)
+{
+	uint32_t config_addr, config_data, subclass, secondary_bus;
+	struct pci_address addr;
+	struct pci_device_id devid;
+	struct pci_driver *drv;
+
+	config_addr = (PCI_ENABLE_BIT)
+			| (bus << PCI_BUS_SHIFT)
+			| (device << PCI_DEVICE_SHIFT)
+			| (function << PCI_FUNCTION_SHIFT);
+
+	outl(PCI_CONFIG_ADDR, config_addr);
+	config_data = inl(PCI_CONFIG_DATA);
+
+	devid.vendor_id = config_data & PCI_DEVICE_ID_MASK;
+	if (devid.vendor_id == PCI_INVALID_ID) {
+		/* Device doesn't exist */
+		return 1;
+	}
+
+	addr.domain   = 0x0;
+	addr.bus      = bus;
+	addr.devid    = device;
+	addr.function = function;
+
+	/* These I/O reads could be batched, but it practice this does not
+	 * appear to make the code more performant.
+	 */
+	PCI_CONF_READ(uint32_t, &devid.class_id,
+			config_addr, CLASS_ID);
+	PCI_CONF_READ(uint32_t, &subclass,
+			config_addr, SUBCLASS_ID);
+	PCI_CONF_READ(uint16_t, &devid.vendor_id,
+			config_addr, VENDOR_ID);
+	PCI_CONF_READ(uint16_t, &devid.device_id,
+			config_addr, DEVICE_ID);
+	PCI_CONF_READ(uint16_t, &devid.subsystem_device_id,
+			config_addr, SUBSYS_ID);
+	PCI_CONF_READ(uint16_t, &devid.subsystem_vendor_id,
+			config_addr, SUBSYSVEN_ID);
+
+	uk_pr_info("PCI %02x:%02x.%02x (%04x %04x:%04x): ",
+		   (int) addr.bus,
+		   (int) addr.devid,
+		   (int) addr.function,
+		   (int) devid.class_id,
+		   (int) devid.vendor_id,
+		   (int) devid.device_id);
+
+	drv = pci_find_driver(&devid);
+	if (!drv) {
+		uk_pr_info("<no driver>\n");
+	} else {
+		uk_pr_info("driver %p\n", drv);
+		pci_driver_add_device(drv, &addr, &devid);
+	}
+
+	/* 0x06 = Bridge Device, 0x04 = PCI-to-PCI bridge */
+	if ((devid.class_id == 0x06) && (subclass == 0x04) ) {
+		PCI_CONF_READ(uint32_t, &secondary_bus,
+				config_addr, SECONDARY_BUS);
+		probe_bus(secondary_bus);
+	}
+
+	return 0;
+}
+
+/* Recursive PCI enumeration: this function is called recursively by
+ * probe_function upon discovering PCI-to-PCI bridges.
+ */
+static void probe_bus(uint32_t bus)
+{
+	uint32_t config_addr, device, header_type, function = 0;
+
+	for (device = 0; device < PCI_MAX_DEVICES; ++device) {
+		if (!probe_function(bus, device, function))
+			continue;
+
+		config_addr = (PCI_ENABLE_BIT);
+		PCI_CONF_READ(uint32_t, &header_type,
+				config_addr, HEADER_TYPE);
+
+		/* Is this a multi-function device? */
+		if ((header_type & PCI_HEADER_TYPE_MSB_MASK) == 0)
+			continue;
+
+		/* Check remaining functions */
+		for (function = 1; function < PCI_MAX_FUNCTIONS; function++)
+			probe_function(bus, device, function);
+	}
+}
+
+int arch_pci_probe(void)
+{
+	uint32_t config_addr, function, header_type, vendor_id;
+
+	uk_pr_debug("Probe PCI\n");
+
+	config_addr = (PCI_ENABLE_BIT);
+	PCI_CONF_READ(uint32_t, &header_type,
+			config_addr, HEADER_TYPE);
+
+	if ((header_type & PCI_HEADER_TYPE_MSB_MASK) == 0) {
+		/* Single PCI host controller */
+		probe_bus(0);
+	} else {
+		/* Multiple PCI host controllers */
+		for (function = 0; function < PCI_MAX_FUNCTIONS; function++) {
+			config_addr = (PCI_ENABLE_BIT) |
+					(function << PCI_FUNCTION_SHIFT);
+
+			PCI_CONF_READ(uint32_t, &vendor_id,
+					config_addr, VENDOR_ID);
+
+			if (vendor_id != PCI_INVALID_ID)
+				break;
+
+			probe_bus(function);
+		}
+	}
+
+	return 0;
+}
diff --git a/plat/kvm/Makefile.uk b/plat/kvm/Makefile.uk
index 7b12b1a..5260670 100644
--- a/plat/kvm/Makefile.uk
+++ b/plat/kvm/Makefile.uk
@@ -113,7 +113,10 @@ LIBKVMPCI_ASINCLUDES-$(CONFIG_ARCH_X86_64)  += -I$(LIBKVMPLAT_BASE)/include
 LIBKVMPCI_ASINCLUDES-$(CONFIG_ARCH_X86_64)  += -I$(UK_PLAT_COMMON_BASE)/include
 LIBKVMPCI_CINCLUDES-$(CONFIG_ARCH_X86_64)   += -I$(LIBKVMPLAT_BASE)/include
 LIBKVMPCI_CINCLUDES-$(CONFIG_ARCH_X86_64)   += -I$(UK_PLAT_COMMON_BASE)/include
-LIBKVMPCI_SRCS-$(CONFIG_ARCH_X86_64)        += $(UK_PLAT_COMMON_BASE)/pci_bus.c|common
+LIBKVMPCI_CINCLUDES-$(CONFIG_ARCH_ARM_64)   += -I$(UK_PLAT_DRIVERS_BASE)/include
+LIBKVMPCI_SRCS-y		            += $(UK_PLAT_COMMON_BASE)/pci_bus.c|common
+LIBKVMPCI_SRCS-$(CONFIG_ARCH_X86_64) += \
+				$(UK_PLAT_COMMON_BASE)/x86/pci_bus_x86.c|x86
 
 ##
 ## Platform bus library definitions
@@ -122,7 +125,7 @@ LIBKVMPF_ASINCLUDES-$(CONFIG_ARCH_ARM_64)  += -I$(UK_PLAT_COMMON_BASE)/include
 LIBKVMPF_CINCLUDES-$(CONFIG_ARCH_ARM_64)   += -I$(UK_PLAT_COMMON_BASE)/include
 LIBKVMPF_CINCLUDES-$(CONFIG_ARCH_ARM_64)   += -I$(LIBKVMPLAT_BASE)/include
 LIBKVMPF_CINCLUDES-$(CONFIG_ARCH_ARM_64)   += -I$(UK_PLAT_DRIVERS_BASE)/include
-LIBKVMPF_SRCS-$(CONFIG_ARCH_ARM_64) += $(UK_PLAT_COMMON_BASE)/platform_bus.c|common
+LIBKVMPF_SRCS-$(CONFIG_KVM_PF) += $(UK_PLAT_COMMON_BASE)/platform_bus.c|common
 
 ##
 ## Virtio library definitions
-- 
2.17.1



From minios-devel-bounces@lists.xenproject.org Wed Dec 23 07:49:14 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Wed, 23 Dec 2020 07:49:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.58251.102303 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1krytV-0007ve-KV; Wed, 23 Dec 2020 07:49:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 58251.102303; Wed, 23 Dec 2020 07:49: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 1krytV-0007vK-AT; Wed, 23 Dec 2020 07:49:13 +0000
Received: by outflank-mailman (input) for mailman id 58251;
 Wed, 23 Dec 2020 07:49: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=BSFQ=F3=arm.com=justin.he@srs-us1.protection.inumbo.net>)
 id 1krylC-0006Xr-P7
 for minios-devel@lists.xenproject.org; Wed, 23 Dec 2020 07:40:38 +0000
Received: from foss.arm.com (unknown [217.140.110.172])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTP
 id ac8b3377-e455-4e22-9ab4-607c77d98eb4;
 Wed, 23 Dec 2020 07:40:21 +0000 (UTC)
Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14])
 by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 3B13A15EC;
 Tue, 22 Dec 2020 23:40:21 -0800 (PST)
Received: from localhost.localdomain (entos-thunderx2-02.shanghai.arm.com
 [10.169.212.215])
 by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 0E1DE3F66E;
 Tue, 22 Dec 2020 23:40:18 -0800 (PST)
X-BeenThere: minios-devel@lists.xenproject.org
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
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: ac8b3377-e455-4e22-9ab4-607c77d98eb4
From: Jia He <justin.he@arm.com>
To: minios-devel@lists.xenproject.org,
	Felipe Huici <felipe.huici@neclab.eu>
Cc: Simon Kuenzer <simon.kuenzer@neclab.eu>,
	Sharan.Santhanam@neclab.eu,
	Song Zhu <Song.Zhu@arm.com>,
	Jia He <justin.he@arm.com>
Subject: [UNIKRAFT PATCH RFCv4 26/35] plat/virtio: Use better iormb/iowmb on arm64
Date: Wed, 23 Dec 2020 15:38:48 +0800
Message-Id: <20201223073857.118076-27-justin.he@arm.com>
X-Mailer: git-send-email 2.17.1
In-Reply-To: <20201223073857.118076-1-justin.he@arm.com>
References: <20201223073857.118076-1-justin.he@arm.com>

This replace better mb with the old rmb/wmb

Signed-off-by: Jia He <justin.he@arm.com>
---
 plat/drivers/include/virtio/virtio_config.h | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)

diff --git a/plat/drivers/include/virtio/virtio_config.h b/plat/drivers/include/virtio/virtio_config.h
index b80f26a..84421b4 100644
--- a/plat/drivers/include/virtio/virtio_config.h
+++ b/plat/drivers/include/virtio/virtio_config.h
@@ -115,8 +115,18 @@ static inline void _virtio_cread_bytes(const void *addr, const __u8 offset,
 #else  /* __X86_64__ */
 
 /* IO barriers */
-#define __iormb()		rmb()
-#define __iowmb()		wmb()
+#define __iormb(v)							\
+({									\
+	unsigned long tmp;						\
+	dmb(oshld);							\
+									\
+	asm volatile("eor	%0, %1, %1\n"				\
+		     "cbnz	%0, ."					\
+		     : "=r" (tmp) : "r" ((unsigned long)(v))		\
+		     : "memory");					\
+})
+
+#define __iowmb()		dmb(oshst)
 
 static inline void _virtio_cwrite_bytes(const void *addr, const __u8 offset,
 					const void *buf, int len, int type_len)
@@ -168,7 +178,7 @@ static inline void _virtio_cread_bytes(const void *addr, const __u8 offset,
 		default:
 			UK_CRASH("Unsupported virtio read operation\n");
 		}
-		__iormb();
+		__iormb(io_addr);
 	}
 }
 
-- 
2.17.1



From minios-devel-bounces@lists.xenproject.org Wed Dec 23 07:49:14 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Wed, 23 Dec 2020 07:49:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.58252.102308 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1krytW-0007yE-Ml; Wed, 23 Dec 2020 07:49:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 58252.102308; Wed, 23 Dec 2020 07:49: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 1krytW-0007y7-Gk; Wed, 23 Dec 2020 07:49:14 +0000
Received: by outflank-mailman (input) for mailman id 58252;
 Wed, 23 Dec 2020 07:49: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=BSFQ=F3=arm.com=justin.he@srs-us1.protection.inumbo.net>)
 id 1krylH-0006Xr-PC
 for minios-devel@lists.xenproject.org; Wed, 23 Dec 2020 07:40:43 +0000
Received: from foss.arm.com (unknown [217.140.110.172])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTP
 id 70228b52-2c0b-4068-8beb-ad6bf8c66ac7;
 Wed, 23 Dec 2020 07:40:32 +0000 (UTC)
Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14])
 by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 055BC1688;
 Tue, 22 Dec 2020 23:40:32 -0800 (PST)
Received: from localhost.localdomain (entos-thunderx2-02.shanghai.arm.com
 [10.169.212.215])
 by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id CBFAF3F66E;
 Tue, 22 Dec 2020 23:40:29 -0800 (PST)
X-BeenThere: minios-devel@lists.xenproject.org
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
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: 70228b52-2c0b-4068-8beb-ad6bf8c66ac7
From: Jia He <justin.he@arm.com>
To: minios-devel@lists.xenproject.org,
	Felipe Huici <felipe.huici@neclab.eu>
Cc: Simon Kuenzer <simon.kuenzer@neclab.eu>,
	Sharan.Santhanam@neclab.eu,
	Song Zhu <Song.Zhu@arm.com>,
	Jia He <justin.he@arm.com>
Subject: [UNIKRAFT PATCH RFCv4 30/35] plat/virtio_9p: Remove excessive check for max virtqueue size
Date: Wed, 23 Dec 2020 15:38:52 +0800
Message-Id: <20201223073857.118076-31-justin.he@arm.com>
X-Mailer: git-send-email 2.17.1
In-Reply-To: <20201223073857.118076-1-justin.he@arm.com>
References: <20201223073857.118076-1-justin.he@arm.com>

For qemu virtio mmio read with VIRTIO_MMIO_QUEUE_NUM_MAX, it will
unconditionally return VIRTQUEUE_MAX_SIZE(1024) unlike virtio pci.
But it can set the number of queue size when seting up the virtqueue.
See vm_setup_vq which will be fixed in coming patch.

So the excessive check in virtio 9p is not necessary.

Signed-off-by: Jia He <justin.he@arm.com>
---
 plat/drivers/virtio/virtio_9p.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/plat/drivers/virtio/virtio_9p.c b/plat/drivers/virtio/virtio_9p.c
index 045ce42..aead7a2 100644
--- a/plat/drivers/virtio/virtio_9p.c
+++ b/plat/drivers/virtio/virtio_9p.c
@@ -307,17 +307,15 @@ static int virtio_9p_vq_alloc(struct virtio_9p_device *d)
 
 	d->hwvq_id = 0;
 	if (unlikely(qdesc_size != NUM_SEGMENTS)) {
-		uk_pr_err(DRIVER_NAME": Expected %d descriptors, found %d (virtqueue %"
+		uk_pr_info(DRIVER_NAME": Expected %d descriptors, found %d (virtqueue %"
 			  PRIu16")\n", NUM_SEGMENTS, qdesc_size, d->hwvq_id);
-		rc = -EINVAL;
-		goto exit;
 	}
 
 	uk_sglist_init(&d->sg, ARRAY_SIZE(d->sgsegs), &d->sgsegs[0]);
 
 	d->vq = virtio_vqueue_setup(d->vdev,
 				    d->hwvq_id,
-				    qdesc_size,
+				    NUM_SEGMENTS,
 				    virtio_9p_recv,
 				    a);
 	if (unlikely(PTRISERR(d->vq))) {
-- 
2.17.1



From minios-devel-bounces@lists.xenproject.org Wed Dec 23 07:49:14 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Wed, 23 Dec 2020 07:49:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.58253.102309 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1krytW-0007yW-QB; Wed, 23 Dec 2020 07:49:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 58253.102309; Wed, 23 Dec 2020 07:49: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 1krytW-0007yI-IR; Wed, 23 Dec 2020 07:49:14 +0000
Received: by outflank-mailman (input) for mailman id 58253;
 Wed, 23 Dec 2020 07:49: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=BSFQ=F3=arm.com=justin.he@srs-us1.protection.inumbo.net>)
 id 1krylM-0006Xr-PK
 for minios-devel@lists.xenproject.org; Wed, 23 Dec 2020 07:40:48 +0000
Received: from foss.arm.com (unknown [217.140.110.172])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTP
 id 4ff76146-80cd-49c2-8fc1-e58cd0726437;
 Wed, 23 Dec 2020 07:40:37 +0000 (UTC)
Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14])
 by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 62C711691;
 Tue, 22 Dec 2020 23:40:37 -0800 (PST)
Received: from localhost.localdomain (entos-thunderx2-02.shanghai.arm.com
 [10.169.212.215])
 by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 3EC5A3F66E;
 Tue, 22 Dec 2020 23:40:34 -0800 (PST)
X-BeenThere: minios-devel@lists.xenproject.org
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
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: 4ff76146-80cd-49c2-8fc1-e58cd0726437
From: Jia He <justin.he@arm.com>
To: minios-devel@lists.xenproject.org,
	Felipe Huici <felipe.huici@neclab.eu>
Cc: Simon Kuenzer <simon.kuenzer@neclab.eu>,
	Sharan.Santhanam@neclab.eu,
	Song Zhu <Song.Zhu@arm.com>,
	Jia He <justin.he@arm.com>
Subject: [UNIKRAFT PATCH RFCv4 32/35] plat/arm/generic_timer: Fix assert in ns_to_ticks
Date: Wed, 23 Dec 2020 15:38:54 +0800
Message-Id: <20201223073857.118076-33-justin.he@arm.com>
X-Mailer: git-send-email 2.17.1
In-Reply-To: <20201223073857.118076-1-justin.he@arm.com>
References: <20201223073857.118076-1-justin.he@arm.com>

There is a UK_ASSERT hit when testing nginx app with backtrace:
[   88.612809] CRIT: [libkvmplat] generic_timer.c @ 84   : Assertion failure: ns <= (3600UL*((1) * 1000000000ULL))
[   88.614229] Info: [libkvmplat] shutdown.c @ 35   : Unikraft halted
        [0x4010514c] uk_dump_backtrace+0/0x4c
        [0x40100d78] ns_to_ticks+0x68/0x98
        [0x40101028] generic_timer_cpu_block_until+0x94/0xd8
        [0x40100a08] time_block_until+0x18/0x5c
        [0x401049ec] ukplat_lcpu_halt_to+0x1c/0x30
        [0x4011f258] schedcoop_schedule+0x370/0x414
        [0x4011f7d0] schedcoop_yield+0x14/0x20
        [0x40141568] uk_sched_yield+0xf4/0x100
        [0x40141d60] uk_9preq_waitreply+0x94/0xe4
        [0x40144a24] send_and_wait_zc+0x94/0xc4
        [0x40144a80] send_and_wait_no_zc+0x2c/0x34
        [0x40145370] uk_9p_open+0xcc/0x19c
        [0x4013941c] uk_9pfs_write+0x118/0x2a4
        [0x40132790] vfs_write+0xb8/0x134
        [0x4012a744] sys_write+0x158/0x188
        [0x4012dd5c] pwrite+0x78/0xdc
        [0x4012dee0] __uk_syscall_e_write+0x28/0x30
        [0x4012deb0] uk_syscall_e_write+0x34/0x3c
        [0x4012dde4] write+0x24/0x2c
        [0x4022da44] ngx_write_fd+0x24/0x2c
        [0x4022dd70] ngx_log_error_core+0x324/0x45c
        [0x40235f90] ngx_destroy_pool+0x16c/0x228
        [0x4027a278] ngx_http_close_connection+0x9c/0xa8
        [0x40279584] ngx_http_keepalive_handler+0x26c/0x348
        [0x402564dc] ngx_event_process_posted+0xfc/0x11c
        [0x40250bd8] ngx_process_events_and_timers+0x1c8/0x1d8
        [0x4025c368] ngx_single_process_cycle+0xf4/0x294
        [0x4021b4fc] nginx_main+0x560/0x580
        [0x4021ae7c] main+0x1c/0x24

This fixes it by acquiring until_ticks only when now_ns < until_ns

Signed-off-by: Jia He <justin.he@arm.com>
---
 plat/common/arm/generic_timer.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/plat/common/arm/generic_timer.c b/plat/common/arm/generic_timer.c
index 58a9f40..1b63f84 100644
--- a/plat/common/arm/generic_timer.c
+++ b/plat/common/arm/generic_timer.c
@@ -220,10 +220,10 @@ void generic_timer_cpu_block_until(uint64_t until_ns)
 
 	/* Record current ns and until_ticks for timer */
 	now_ns = ukplat_monotonic_clock();
-	until_ticks = generic_timer_get_ticks()
-				+ ns_to_ticks(until_ns - now_ns);
 
 	if (now_ns < until_ns) {
+		until_ticks = generic_timer_get_ticks()
+				+ ns_to_ticks(until_ns - now_ns);
 		generic_timer_update_compare(until_ticks);
 		generic_timer_enable();
 		generic_timer_unmask_irq();
-- 
2.17.1



From minios-devel-bounces@lists.xenproject.org Wed Dec 23 07:49:14 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Wed, 23 Dec 2020 07:49:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.58254.102314 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1krytW-0007yw-TV; Wed, 23 Dec 2020 07:49:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 58254.102314; Wed, 23 Dec 2020 07:49: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 1krytW-0007yV-Kd; Wed, 23 Dec 2020 07:49:14 +0000
Received: by outflank-mailman (input) for mailman id 58254;
 Wed, 23 Dec 2020 07:49: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=BSFQ=F3=arm.com=justin.he@srs-us1.protection.inumbo.net>)
 id 1kryl7-0006Xr-Oz
 for minios-devel@lists.xenproject.org; Wed, 23 Dec 2020 07:40:33 +0000
Received: from foss.arm.com (unknown [217.140.110.172])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTP
 id a705567a-73f6-4473-99c7-2f19b4485f05;
 Wed, 23 Dec 2020 07:40:18 +0000 (UTC)
Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14])
 by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 8194515BF;
 Tue, 22 Dec 2020 23:40:18 -0800 (PST)
Received: from localhost.localdomain (entos-thunderx2-02.shanghai.arm.com
 [10.169.212.215])
 by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 53EF33F66E;
 Tue, 22 Dec 2020 23:40:16 -0800 (PST)
X-BeenThere: minios-devel@lists.xenproject.org
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
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: a705567a-73f6-4473-99c7-2f19b4485f05
From: Jia He <justin.he@arm.com>
To: minios-devel@lists.xenproject.org,
	Felipe Huici <felipe.huici@neclab.eu>
Cc: Simon Kuenzer <simon.kuenzer@neclab.eu>,
	Sharan.Santhanam@neclab.eu,
	Song Zhu <Song.Zhu@arm.com>,
	Jia He <justin.he@arm.com>
Subject: [UNIKRAFT PATCH RFCv4 25/35] plat/virtio: Change irq,base from u16 to u64 on arm64
Date: Wed, 23 Dec 2020 15:38:47 +0800
Message-Id: <20201223073857.118076-26-justin.he@arm.com>
X-Mailer: git-send-email 2.17.1
In-Reply-To: <20201223073857.118076-1-justin.he@arm.com>
References: <20201223073857.118076-1-justin.he@arm.com>

On arm64, it only supports ECAM pci controller, hence u16 irq,base
is not enough.

Signed-off-by: Jia He <justin.he@arm.com>
---
 plat/drivers/virtio/virtio_pci.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/plat/drivers/virtio/virtio_pci.c b/plat/drivers/virtio/virtio_pci.c
index c0c9032..3c62a3c 100644
--- a/plat/drivers/virtio/virtio_pci.c
+++ b/plat/drivers/virtio/virtio_pci.c
@@ -57,9 +57,9 @@ struct virtio_pci_dev {
 	/* Virtio Device */
 	struct virtio_dev vdev;
 	/* Pci base address */
-	__u16 pci_base_addr;
+	__u64 pci_base_addr;
 	/* ISR Address Range */
-	__u16 pci_isr_addr;
+	__u64 pci_isr_addr;
 	/* Pci device information */
 	struct pci_device *pdev;
 };
@@ -377,6 +377,8 @@ static int virtio_pci_legacy_add_dev(struct pci_device *pci_dev,
 
 	uk_pr_info("Added virtio-pci device %04x\n",
 		   pci_dev->id.device_id);
+	uk_pr_info("Added virtio-pci subsystem_device_id %04x\n",
+		   pci_dev->id.subsystem_device_id);
 
 	/* Mapping the virtio device identifier */
 	vpci_dev->vdev.id.virtio_device_id = pci_dev->id.subsystem_device_id;
-- 
2.17.1



From minios-devel-bounces@lists.xenproject.org Wed Dec 23 07:49:15 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Wed, 23 Dec 2020 07:49:15 +0000
Received: from list by lists.xenproject.org with outflank-mailman.58255.102318 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1krytX-000809-Qx; Wed, 23 Dec 2020 07:49:15 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 58255.102318; Wed, 23 Dec 2020 07:49:15 +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 1krytX-000802-N8; Wed, 23 Dec 2020 07:49:15 +0000
Received: by outflank-mailman (input) for mailman id 58255;
 Wed, 23 Dec 2020 07:49: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=BSFQ=F3=arm.com=justin.he@srs-us1.protection.inumbo.net>)
 id 1krykx-0006Xr-Os
 for minios-devel@lists.xenproject.org; Wed, 23 Dec 2020 07:40:23 +0000
Received: from foss.arm.com (unknown [217.140.110.172])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTP
 id 428fd33f-374c-49be-9e89-e2cb6ef5209c;
 Wed, 23 Dec 2020 07:40:07 +0000 (UTC)
Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14])
 by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id C0CAE15A1;
 Tue, 22 Dec 2020 23:40:07 -0800 (PST)
Received: from localhost.localdomain (entos-thunderx2-02.shanghai.arm.com
 [10.169.212.215])
 by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 944673F66E;
 Tue, 22 Dec 2020 23:40:05 -0800 (PST)
X-BeenThere: minios-devel@lists.xenproject.org
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
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: 428fd33f-374c-49be-9e89-e2cb6ef5209c
From: Jia He <justin.he@arm.com>
To: minios-devel@lists.xenproject.org,
	Felipe Huici <felipe.huici@neclab.eu>
Cc: Simon Kuenzer <simon.kuenzer@neclab.eu>,
	Sharan.Santhanam@neclab.eu,
	Song Zhu <Song.Zhu@arm.com>,
	Jia He <justin.he@arm.com>
Subject: [UNIKRAFT PATCH RFCv4 21/35] plat/pci_bus: Change pci_device.base from u16 to unsigned long
Date: Wed, 23 Dec 2020 15:38:43 +0800
Message-Id: <20201223073857.118076-22-justin.he@arm.com>
X-Mailer: git-send-email 2.17.1
In-Reply-To: <20201223073857.118076-1-justin.he@arm.com>
References: <20201223073857.118076-1-justin.he@arm.com>

On arm64, no ioport at all. It uses iomem instead, hence change the
base from u16 to unsigned long.

Signed-off-by: Jia He <justin.he@arm.com>
---
 plat/common/include/pci/pci_bus.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/plat/common/include/pci/pci_bus.h b/plat/common/include/pci/pci_bus.h
index 88ed949..40c904d 100644
--- a/plat/common/include/pci/pci_bus.h
+++ b/plat/common/include/pci/pci_bus.h
@@ -69,6 +69,7 @@
 #include <uk/bus.h>
 #include <uk/alloc.h>
 #include <uk/ctors.h>
+#include <pci/pci_ecam.h>
 
 /**
  * A structure describing an ID for a PCI driver. Each driver provides a
@@ -150,7 +151,7 @@ struct pci_device {
 	struct pci_driver     *drv;
 	enum pci_device_state state;
 
-	uint16_t base;
+	unsigned long base;
 	unsigned long irq;
 };
 
-- 
2.17.1



From minios-devel-bounces@lists.xenproject.org Wed Dec 23 07:49:15 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Wed, 23 Dec 2020 07:49:15 +0000
Received: from list by lists.xenproject.org with outflank-mailman.58256.102321 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1krytX-00080X-Un; Wed, 23 Dec 2020 07:49:15 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 58256.102321; Wed, 23 Dec 2020 07:49:15 +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 1krytX-00080D-Oq; Wed, 23 Dec 2020 07:49:15 +0000
Received: by outflank-mailman (input) for mailman id 58256;
 Wed, 23 Dec 2020 07:49: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=BSFQ=F3=arm.com=justin.he@srs-us1.protection.inumbo.net>)
 id 1kryl2-0006Xr-Ov
 for minios-devel@lists.xenproject.org; Wed, 23 Dec 2020 07:40:28 +0000
Received: from foss.arm.com (unknown [217.140.110.172])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTP
 id b093f86b-dfe8-49a3-89a6-43f221fda06c;
 Wed, 23 Dec 2020 07:40:13 +0000 (UTC)
Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14])
 by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 2239A15AB;
 Tue, 22 Dec 2020 23:40:13 -0800 (PST)
Received: from localhost.localdomain (entos-thunderx2-02.shanghai.arm.com
 [10.169.212.215])
 by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id F24023F66E;
 Tue, 22 Dec 2020 23:40:10 -0800 (PST)
X-BeenThere: minios-devel@lists.xenproject.org
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
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: b093f86b-dfe8-49a3-89a6-43f221fda06c
From: Jia He <justin.he@arm.com>
To: minios-devel@lists.xenproject.org,
	Felipe Huici <felipe.huici@neclab.eu>
Cc: Simon Kuenzer <simon.kuenzer@neclab.eu>,
	Sharan.Santhanam@neclab.eu,
	Song Zhu <Song.Zhu@arm.com>,
	Jia He <justin.he@arm.com>
Subject: [UNIKRAFT PATCH RFCv4 23/35] plat/pci_ecam: Fix a lot compilation warnings in pci_ecam
Date: Wed, 23 Dec 2020 15:38:45 +0800
Message-Id: <20201223073857.118076-24-justin.he@arm.com>
X-Mailer: git-send-email 2.17.1
In-Reply-To: <20201223073857.118076-1-justin.he@arm.com>
References: <20201223073857.118076-1-justin.he@arm.com>

This fixes the compilation warnings when introducing pci_ecam

Signed-off-by: Jia He <justin.he@arm.com>
---
 plat/common/arm/pci_bus_arm64.c    | 22 ++++++---------
 plat/common/include/pci/pci_bus.h  |  2 +-
 plat/common/include/pci/pci_ecam.h |  2 +-
 plat/common/pci_ecam.c             | 44 +++++++++++++++---------------
 plat/drivers/include/ofw/fdt.h     | 11 ++++++++
 5 files changed, 44 insertions(+), 37 deletions(-)

diff --git a/plat/common/arm/pci_bus_arm64.c b/plat/common/arm/pci_bus_arm64.c
index 022b3d4..17572f3 100644
--- a/plat/common/arm/pci_bus_arm64.c
+++ b/plat/common/arm/pci_bus_arm64.c
@@ -75,7 +75,6 @@ static int arch_pci_driver_add_device(struct pci_driver *drv,
 {
 	struct pci_device *dev;
 	int ret;
-	__u32 val;
 
 	UK_ASSERT(drv != NULL);
 	UK_ASSERT(drv->add_dev != NULL);
@@ -98,7 +97,7 @@ static int arch_pci_driver_add_device(struct pci_driver *drv,
 
 	dev->base = base;
 	dev->irq = irq;
-	uk_pr_info("pci dev base(0x%llx) irq(%d)\n", dev->base, dev->irq);
+	uk_pr_info("pci dev base(0x%lx) irq(%ld)\n", dev->base, dev->irq);
 
 	if (drv->add_dev)
 		ret = drv->add_dev(dev); //virtio pci
@@ -120,7 +119,6 @@ int arch_pci_probe(struct uk_alloc *pha)
 	struct pci_driver *drv;
 	uint32_t bus;
 	uint8_t dev;
-	int err;
 	int irq, pin = 0;
 	__u64 base;
 	int found_pci_device = 0;
@@ -138,7 +136,7 @@ int arch_pci_probe(struct uk_alloc *pha)
 			 /* TODO: Retrieve the function bus, dev << PCI_DEV_BIT_NBR*/
 			addr.function = 0x0;
 
-			pci_generic_config_read(bus, DEVFN(dev, 0), PCI_VENDOR_ID, 2, &devid.vendor_id);
+			pci_generic_config_read(bus, DEVFN(dev, 0), PCI_VENDOR_ID, 2, (void *)&devid.vendor_id);
 			if (devid.vendor_id == PCI_INVALID_ID) {
 				/* Device doesn't exist */
 				continue;
@@ -147,11 +145,11 @@ int arch_pci_probe(struct uk_alloc *pha)
 			/* mark we found any pci device */
 			found_pci_device = 1;
 
-			pci_generic_config_read(bus, DEVFN(dev, 0), PCI_CLASS_REVISION, 4, &devid.class_id);
-			pci_generic_config_read(bus, DEVFN(dev, 0), PCI_VENDOR_ID, 2, &devid.vendor_id);
-			pci_generic_config_read(bus, DEVFN(dev, 0), PCI_DEV_ID, 2, &devid.device_id);
-			pci_generic_config_read(bus, DEVFN(dev, 0), PCI_SUBSYSTEM_VID, 2, &devid.subsystem_vendor_id);
-			pci_generic_config_read(bus, DEVFN(dev, 0), PCI_SUBSYSTEM_ID, 2, &devid.subsystem_device_id);
+			pci_generic_config_read(bus, DEVFN(dev, 0), PCI_CLASS_REVISION, 4, (void *)&devid.class_id);
+			pci_generic_config_read(bus, DEVFN(dev, 0), PCI_VENDOR_ID, 2, (void *)&devid.vendor_id);
+			pci_generic_config_read(bus, DEVFN(dev, 0), PCI_DEV_ID, 2, (void *)&devid.device_id);
+			pci_generic_config_read(bus, DEVFN(dev, 0), PCI_SUBSYSTEM_VID, 2, (void *)&devid.subsystem_vendor_id);
+			pci_generic_config_read(bus, DEVFN(dev, 0), PCI_SUBSYSTEM_ID, 2, (void *)&devid.subsystem_device_id);
 			uk_pr_info("PCI %02x:%02x.%02x (%04x %04x:%04x): sb=%d,sv=%4x\n",
 				   (int) addr.bus,
 				   (int) addr.devid,
@@ -176,14 +174,14 @@ int arch_pci_probe(struct uk_alloc *pha)
 
 			drv = pci_find_driver(&devid);
 			if (!drv) {
-				uk_pr_info("<no driver> for dev id=%d\n", devid);
+				uk_pr_info("<no driver> for dev id=%d\n", devid.device_id);
 				continue;
 			}
 
 			uk_pr_info("driver %p\n", drv);
 
 			/* probe the irq info*/
-			pci_generic_config_read(bus, DEVFN(dev, 0), PCI_INTERRUPT_PIN, 1, &pin);
+			pci_generic_config_read(bus, DEVFN(dev, 0), PCI_INTERRUPT_PIN, 1, (void *)&pin);
 			out_irq.args_count = 1;
 			out_irq.args[0] = pin;
 			fdtaddr[0] = cpu_to_fdt32((bus << 16) | (DEVFN(dev,0) << 8));
@@ -193,8 +191,6 @@ int arch_pci_probe(struct uk_alloc *pha)
 			irq = gic_irq_translate(0, out_irq.args[1]);
 
 			arch_pci_driver_add_device(drv, &addr, &devid, irq, base, pha);
-
-			uk_pr_info("pci dev base(0x%llx) irq(%d)\n");
 		}
 	}
 
diff --git a/plat/common/include/pci/pci_bus.h b/plat/common/include/pci/pci_bus.h
index 40c904d..73ce61a 100644
--- a/plat/common/include/pci/pci_bus.h
+++ b/plat/common/include/pci/pci_bus.h
@@ -181,7 +181,7 @@ struct pci_bus_handler {
 	struct uk_list_head drv_list;  /**< List of PCI drivers */
 	struct uk_list_head dev_list;  /**< List of PCI devices */
 };
-static struct pci_bus_handler ph;
+static struct pci_bus_handler ph __unused;
 
 #define PCI_INVALID_ID              (0xFFFF)
 #define PCI_DEVICE_ID_MASK          (0xFFFF)
diff --git a/plat/common/include/pci/pci_ecam.h b/plat/common/include/pci/pci_ecam.h
index f325a14..e2a42e2 100644
--- a/plat/common/include/pci/pci_ecam.h
+++ b/plat/common/include/pci/pci_ecam.h
@@ -92,7 +92,7 @@ struct fdt_phandle_args {
 
 
 int pci_generic_config_read(__u8 bus, __u8 devfn,
-			    int where, int size, __u32 *val);
+			    int where, int size, void *val);
 
 int pci_generic_config_write(__u8 bus, __u8 devfn,
 			     int where, int size, __u32 val);
diff --git a/plat/common/pci_ecam.c b/plat/common/pci_ecam.c
index b97a580..d07ff1d 100644
--- a/plat/common/pci_ecam.c
+++ b/plat/common/pci_ecam.c
@@ -89,7 +89,7 @@ static void *pci_ecam_map_bus(__u8 bus, __u8 devfn, int where)
 }
 
 int pci_generic_config_read(__u8 bus, __u8 devfn,
-			    int where, int size, __u32 *val)
+			    int where, int size, void *val)
 {
 	void *addr;
 
@@ -97,16 +97,16 @@ int pci_generic_config_read(__u8 bus, __u8 devfn,
 	rmb();
 	addr = pci_ecam_map_bus(bus, devfn, where);
 	if (!addr) {
-		*val = ~0;
+		*(int *)val = ~0;
 		return -1;
 	}
 
 	if (size == 1)
-		*val = ioreg_read8(addr);
+		*(uint8_t *)val = ioreg_read8(addr);
 	else if (size == 2)
-		*val = ioreg_read16(addr);
+		*(uint16_t *)val = ioreg_read16(addr);
 	else if (size == 4)
-		*val = ioreg_read32(addr);
+		*(uint32_t *)val = ioreg_read32(addr);
 	else
 		uk_pr_err("not support size pci config read\n");
 
@@ -117,7 +117,6 @@ int pci_generic_config_write(__u8 bus, __u8 devfn,
 			     int where, int size, __u32 val)
 {
 	void *addr;
-	__u32 mask, tmp;
 
 	addr = pci_ecam_map_bus(bus, devfn, where);
 	if (!addr)
@@ -206,7 +205,7 @@ static int irq_find_parent(const void *fdt, int child)
 {
 	int p;
 	int plen;
-	fdt32_t *prop;
+	const fdt32_t *prop;
 	fdt32_t parent;
 
 	do {
@@ -234,7 +233,7 @@ int gen_pci_irq_parse(const fdt32_t *addr, struct fdt_phandle_args *out_irq)
 	int addrsize, newaddrsize = 0;
 	int imaplen, match, i, rc = -EINVAL;
 	int plen;
-	int *prop;
+	const fdt32_t *prop;
 
 	ipar = gen_pci_fdt;
 
@@ -255,7 +254,7 @@ int gen_pci_irq_parse(const fdt32_t *addr, struct fdt_phandle_args *out_irq)
 	}
 
 	intsize = fdt32_to_cpu(prop[0]);
-	uk_pr_info("irq_parse_raw: ipar=%p, size=%d\n", ipar, intsize);
+	uk_pr_info("irq_parse_raw: ipar=%x, size=%d\n", ipar, intsize);
 
 	if (out_irq->args_count != intsize)
 		goto fail;
@@ -385,7 +384,7 @@ int gen_pci_irq_parse(const fdt32_t *addr, struct fdt_phandle_args *out_irq)
 skiplevel:
 		/* Iterate again with new parent */
 		out_irq->np = newpar;
-		uk_pr_info(" -> new parent: %pOF\n", newpar);
+		uk_pr_info(" -> new parent: %x\n", newpar);
 
 		ipar = newpar;
 		newpar = 0;
@@ -398,17 +397,15 @@ fail:
 }
 
 
-static int gen_pci_probe(struct pf_device *pfdev)
+static int gen_pci_probe(struct pf_device *pfdev __unused)
 {
 	const fdt32_t *prop;
 	int prop_len;
 	__u64 reg_base;
 	__u64 reg_size;
-	int err;
 	struct pci_range range;
 	struct pci_range_parser parser;
-	struct fdt_phandle_args out_irq;
-	fdt32_t laddr[3];
+	int err;
 
 	/* 1.Get the base and size of config space */
 	gen_pci_fdt = fdt_node_offset_by_compatible(fdt_start, -1,
@@ -434,7 +431,7 @@ static int gen_pci_probe(struct pf_device *pfdev)
 
 	pcw.config_base = reg_base;
 	pcw.config_space_size = reg_size;
-	uk_pr_info("generic pci config base(0x%llx),size(0x%llx)\n",
+	uk_pr_info("generic pci config base(0x%lx),size(0x%lx)\n",
 				reg_base, reg_size);
 
 	/* 2.Get the bus range of pci controller */
@@ -456,6 +453,11 @@ static int gen_pci_probe(struct pf_device *pfdev)
 
 	/* 3.Get the pci addr base and limit size for pci devices */
 	err = gen_pci_parser_range(&parser, gen_pci_fdt);
+	if (err < 0) {
+		uk_pr_err("bus-range detect error in fdt\n");
+		goto error_exit;
+	}
+
 	do {
 		pci_range_parser_one(&parser, &range, gen_pci_fdt);
 		if (range.flags == IORESOURCE_IO) {
@@ -465,7 +467,7 @@ static int gen_pci_probe(struct pf_device *pfdev)
 		}
 		parser.range += parser.np;
 	} while (parser.range + parser.np <= parser.end);
-	uk_pr_info("generic pci range base(0x%llx),size(0x%llx)\n",
+	uk_pr_info("generic pci range base(0x%lx),size(0x%lx)\n",
 				pcw.pci_device_base, pcw.pci_device_limit);
 
 	return 0;
@@ -492,18 +494,16 @@ static int gen_pci_add_dev(struct pf_device *pfdev __unused)
 
 static const struct device_match_table gen_pci_match_table[];
 
-static struct pf_device_id *gen_pci_id_match_compatible(const char *compatible)
+static int gen_pci_id_match_compatible(const char *compatible)
 {
-	int i;
-
 	for (int i = 0; gen_pci_match_table[i].compatible != NULL; i++)
 		if (strcmp(gen_pci_match_table[i].compatible, compatible) == 0)
-			return gen_pci_match_table[i].id;
+			return gen_pci_match_table[i].id->device_id;
 
-	return NULL;
+	return -1;
 }
 
-static const struct pf_device_id gen_pci_ids = {
+static struct pf_device_id gen_pci_ids = {
 		.device_id = GEN_PCI_ID
 };
 
diff --git a/plat/drivers/include/ofw/fdt.h b/plat/drivers/include/ofw/fdt.h
index a3896ff..13dfdc2 100644
--- a/plat/drivers/include/ofw/fdt.h
+++ b/plat/drivers/include/ofw/fdt.h
@@ -200,4 +200,15 @@ int fdt_get_interrupt(const void *fdt, int nodeoffset,
  */
 bool fdt_prop_read_bool(const void *fdt, int start_offset,
 					 const char *propname);
+
+/**
+ * fdt_translate_address_by_ranges - Translate an address from the
+ * device-tree into a CPU physical address, this walks up the tree and
+ * applies the various bus mappings on the way.
+ * @fdt: pointer to the device tree blob
+ * @node_offset: start offset of the node to find the address for
+ * @regs regs in device-tree
+ */
+uint64_t fdt_translate_address_by_ranges(const void *fdt,
+				int node_offset, const fdt32_t *regs);
 #endif
-- 
2.17.1



From minios-devel-bounces@lists.xenproject.org Thu Dec 24 09:23:00 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Thu, 24 Dec 2020 09:23:00 +0000
Received: from list by lists.xenproject.org with outflank-mailman.58655.103309 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1ksMpk-0005ur-9J; Thu, 24 Dec 2020 09:22:56 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 58655.103309; Thu, 24 Dec 2020 09:22: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 1ksMpk-0005uk-6S; Thu, 24 Dec 2020 09:22:56 +0000
Received: by outflank-mailman (input) for mailman id 58655;
 Thu, 24 Dec 2020 09:22: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=LXfi=F4=owl.eu.com=hle@srs-us1.protection.inumbo.net>)
 id 1ksMpj-0005uf-Jr
 for minios-devel@lists.xenproject.org; Thu, 24 Dec 2020 09:22:55 +0000
Received: from relay4-d.mail.gandi.net (unknown [217.70.183.196])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 3cd4ad78-8a35-4169-aa13-f08790a12d97;
 Thu, 24 Dec 2020 09:22:53 +0000 (UTC)
Received: from localhost (lfbn-lyo-1-157-204.w86-202.abo.wanadoo.fr
 [86.202.239.204]) (Authenticated sender: hle@owl.eu.com)
 by relay4-d.mail.gandi.net (Postfix) with ESMTPSA id B9F59E000A;
 Thu, 24 Dec 2020 09:22:51 +0000 (UTC)
X-BeenThere: minios-devel@lists.xenproject.org
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
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: 3cd4ad78-8a35-4169-aa13-f08790a12d97
X-Originating-IP: 86.202.239.204
From: Hugo Lefeuvre <hle@owl.eu.com>
To: minios-devel@lists.xenproject.org
Cc: Hugo Lefeuvre <hle@owl.eu.com>,
	Hugo Lefeuvre <hugo.lefeuvre@manchester.ac.uk>
Subject: [UNIKRAFT PATCH] lib/posix-user: add more symbols to exportsyms.uk
Date: Thu, 24 Dec 2020 10:22:42 +0100
Message-Id: <1182d57a53379472c50d722db53de281b99cafcb.1608801609.git.hugo.lefeuvre@manchester.ac.uk>
X-Mailer: git-send-email 2.29.2
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit

These symbols were not previously exported. Without these exports,
users get linking errors.

Signed-off-by: Hugo Lefeuvre <hugo.lefeuvre@manchester.ac.uk>
---
 lib/posix-user/exportsyms.uk | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/lib/posix-user/exportsyms.uk b/lib/posix-user/exportsyms.uk
index 2acde9dc..4dc8c198 100644
--- a/lib/posix-user/exportsyms.uk
+++ b/lib/posix-user/exportsyms.uk
@@ -1,6 +1,17 @@
 getpid
+getppid
+getlogin
+getpwnam
+geteuid
+getuid
+getpwuid
+getpwnam
+getgrnam
+setgid
+setuid
+issetugid
+initgroups
 uk_syscall_e_getpid
 uk_syscall_r_getpid
-getppid
 uk_syscall_e_getppid
 uk_syscall_r_getppid
-- 
2.20.1



From minios-devel-bounces@lists.xenproject.org Thu Dec 24 10:28:07 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Thu, 24 Dec 2020 10:28:07 +0000
Received: from list by lists.xenproject.org with outflank-mailman.58674.103343 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1ksNql-0002ye-KL; Thu, 24 Dec 2020 10:28:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 58674.103343; Thu, 24 Dec 2020 10:28: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 1ksNql-0002yX-HM; Thu, 24 Dec 2020 10:28:03 +0000
Received: by outflank-mailman (input) for mailman id 58674;
 Thu, 24 Dec 2020 10:28: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=HK/e=F4=gmail.com=lrbarbulescu@srs-us1.protection.inumbo.net>)
 id 1ksNqj-0002yS-GA
 for minios-devel@lists.xen.org; Thu, 24 Dec 2020 10:28:01 +0000
Received: from mail-lf1-x12d.google.com (unknown [2a00:1450:4864:20::12d])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 07a80101-33e9-4090-ac99-dcea2147b4e1;
 Thu, 24 Dec 2020 10:28:00 +0000 (UTC)
Received: by mail-lf1-x12d.google.com with SMTP id m25so3758960lfc.11
 for <minios-devel@lists.xen.org>; Thu, 24 Dec 2020 02:28:00 -0800 (PST)
X-BeenThere: minios-devel@lists.xenproject.org
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
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: 07a80101-33e9-4090-ac99-dcea2147b4e1
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=hyqhO1bReZrAPx23+kQ+GeVr9Xfukemg7Je0i2AxYAs=;
        b=Gtt/hklQ1Y++UU8ol9sDqq1TSH5uvqXs3xl9J62C1Y/43V7iHecQBibzoPsCZruDXG
         YJZQn/ZtrOn+S869mEp0U3KvTGI0lcjp7Q982hX2pUp05+2NT8YkAcap520sNxdzhlkE
         AVADkQMqy06Rza7ORs4uHZ/rBJ/17vAwTlY8VAmEKRzy2P1XtUoVQ5BkeHRlylNVdaD7
         jzSJGAFAGNV+4QOHY3jzqu+OlQkQ80nm/1gnfY137uiEaRAztIRBVrAQteFqV9ELzSvK
         UAINEwV6tNiQPS20o9Jg5fjJtjERjZO9YnG4jNV7IXMc0imUBqXy7NxCujsIr0j7ikLW
         hB5g==
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=hyqhO1bReZrAPx23+kQ+GeVr9Xfukemg7Je0i2AxYAs=;
        b=YKwGUkmD7WswgHCzumni7yPvlxXaO5YcWf0/bAhag7KpMxiB7A4soEyv28Hykyl0ue
         1vw3AMBRX2AZP6d6HJTgT3M7ErykJguiYsX0dN4NxE/pdt07gh3Ulbtrk6L7xpBKSEZP
         5obRuc0XGBXfMoUyryQdlT97V8z5/giQNFFxdlWTKZnogQTCs+4JdCjRw4WA++Y5krlH
         EyQDNQdzTbplf0opVCZ0IVBDXtMLPqYqGOvjS6qg/dXozw816XitVOXuQ+k/oQ7OYErL
         KgBgngx89Q6RTFbemelOOqz2wu2xohDf+yRDb9dBLh3pJkDFCcpSuTp2LKMH2VW4mz9y
         wiFA==
X-Gm-Message-State: AOAM531plH4mzoR9O0Lcxq1/qNjoulie3ak0pfRjPPXIuJeSBaiUAbPH
	82U5beHmtZsY+KRJX9O3F1Ol9vt82pcXxFKfJKE=
X-Google-Smtp-Source: ABdhPJzJDWxcgxG1Kmx5p2E3EIjLTxm8dZ2NfsVxPRpOAII5vrlJZsS/T2+8xh4ed0/rZa3qRgiW0gowkdE9C4MYijY=
X-Received: by 2002:a05:6512:3288:: with SMTP id p8mr11504294lfe.443.1608805678859;
 Thu, 24 Dec 2020 02:27:58 -0800 (PST)
MIME-Version: 1.0
References: <20201222153758.1731-1-simon.kuenzer@neclab.eu>
In-Reply-To: <20201222153758.1731-1-simon.kuenzer@neclab.eu>
From: Laurentiu Barbulescu <lrbarbulescu@gmail.com>
Date: Thu, 24 Dec 2020 12:27:48 +0200
Message-ID: <CAMpNDKkhMOkpaWgY6jfkHUwrzskV=nB2RYSDvhOcX6eV813MYA@mail.gmail.com>
Subject: Re: [UNIKRAFT PATCH v2 0/7] lib/ukblkdev: Minor API improvements and fixes
To: Simon Kuenzer <simon.kuenzer@neclab.eu>
Cc: minios-devel@lists.xen.org
Content-Type: multipart/alternative; boundary="000000000000004abd05b73343e4"

--000000000000004abd05b73343e4
Content-Type: text/plain; charset="UTF-8"

Hi Simon,

Thanks for updating this patch series.
It looks good to me and I will mark the patches as reviewed.

Best wishes,
Laurentiu

On Tue, Dec 22, 2020 at 5:38 PM Simon Kuenzer <simon.kuenzer@neclab.eu>
wrote:

> This series consists of a number of minor improvements and
> fixes of the ukblkdev API. This is mainly done to inline
> the ukblkdev API with the uknetdev API.
>
> Changes v2:
>  - Remove including <uk/arch/types.h> in <uk/blkreq.h>
>  - Adapt API documentation in <uk/blkdev.h> to reflect
>    `uk_blkdev_queue_configure()`
>
> Simon Kuenzer (7):
>   lib/ukblkdev: blkdev.h: Include <uk/assert.h>
>   lib/ukblkdev: blkreq.h: Include <uk/arch/atomic.h>
>   lib/ukblkdev: blkreq.h: Use typedef for __sector
>   lib/ukblkdev: blkreq.h: Use UK_BLKREQ_ prefix for states and ops
>   lib/ukblkdev: API refactoring: `uk_blkdev_queue_configure()`
>   lib/ukblkdev: Provide `uk_blkdev_size()`
>   lib/ukblkdev: blkdev.h: Description about interrupts
>
>  lib/ukblkdev/blkdev.c                   | 16 +++++++--------
>  lib/ukblkdev/exportsyms.uk              |  2 +-
>  lib/ukblkdev/include/uk/blkdev.h        | 27 +++++++++++++++----------
>  lib/ukblkdev/include/uk/blkdev_core.h   |  6 +++---
>  lib/ukblkdev/include/uk/blkdev_driver.h |  2 +-
>  lib/ukblkdev/include/uk/blkreq.h        | 20 ++++++++++--------
>  plat/drivers/virtio/virtio_blk.c        | 16 +++++++--------
>  plat/xen/drivers/blk/blkfront.c         | 14 ++++++-------
>  8 files changed, 56 insertions(+), 47 deletions(-)
>
> --
> 2.20.1
>

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

<div dir=3D"ltr">Hi Simon,<br><br>Thanks for updating this patch series.<br=
>It looks good to me and I will mark the patches as reviewed.<br><br>Best w=
ishes,<br>Laurentiu<br></div><br><div class=3D"gmail_quote"><div dir=3D"ltr=
" class=3D"gmail_attr">On Tue, Dec 22, 2020 at 5:38 PM Simon Kuenzer &lt;<a=
 href=3D"mailto:simon.kuenzer@neclab.eu">simon.kuenzer@neclab.eu</a>&gt; wr=
ote:<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">This series=
 consists of a number of minor improvements and<br>
fixes of the ukblkdev API. This is mainly done to inline<br>
the ukblkdev API with the uknetdev API.<br>
<br>
Changes v2:<br>
=C2=A0- Remove including &lt;uk/arch/types.h&gt; in &lt;uk/blkreq.h&gt;<br>
=C2=A0- Adapt API documentation in &lt;uk/blkdev.h&gt; to reflect<br>
=C2=A0 =C2=A0`uk_blkdev_queue_configure()`<br>
<br>
Simon Kuenzer (7):<br>
=C2=A0 lib/ukblkdev: blkdev.h: Include &lt;uk/assert.h&gt;<br>
=C2=A0 lib/ukblkdev: blkreq.h: Include &lt;uk/arch/atomic.h&gt;<br>
=C2=A0 lib/ukblkdev: blkreq.h: Use typedef for __sector<br>
=C2=A0 lib/ukblkdev: blkreq.h: Use UK_BLKREQ_ prefix for states and ops<br>
=C2=A0 lib/ukblkdev: API refactoring: `uk_blkdev_queue_configure()`<br>
=C2=A0 lib/ukblkdev: Provide `uk_blkdev_size()`<br>
=C2=A0 lib/ukblkdev: blkdev.h: Description about interrupts<br>
<br>
=C2=A0lib/ukblkdev/blkdev.c=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0=
 =C2=A0 =C2=A0 =C2=A0| 16 +++++++--------<br>
=C2=A0lib/ukblkdev/<a href=3D"http://exportsyms.uk" rel=3D"noreferrer" targ=
et=3D"_blank">exportsyms.uk</a>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 |=C2=A0 2 +-<br>
=C2=A0lib/ukblkdev/include/uk/blkdev.h=C2=A0 =C2=A0 =C2=A0 =C2=A0 | 27 ++++=
+++++++++++----------<br>
=C2=A0lib/ukblkdev/include/uk/blkdev_core.h=C2=A0 =C2=A0|=C2=A0 6 +++---<br=
>
=C2=A0lib/ukblkdev/include/uk/blkdev_driver.h |=C2=A0 2 +-<br>
=C2=A0lib/ukblkdev/include/uk/blkreq.h=C2=A0 =C2=A0 =C2=A0 =C2=A0 | 20 ++++=
++++++--------<br>
=C2=A0plat/drivers/virtio/virtio_blk.c=C2=A0 =C2=A0 =C2=A0 =C2=A0 | 16 ++++=
+++--------<br>
=C2=A0plat/xen/drivers/blk/blkfront.c=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0| 14=
 ++++++-------<br>
=C2=A08 files changed, 56 insertions(+), 47 deletions(-)<br>
<br>
-- <br>
2.20.1<br>
</blockquote></div>

--000000000000004abd05b73343e4--


From minios-devel-bounces@lists.xenproject.org Thu Dec 24 10:28:44 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Thu, 24 Dec 2020 10:28:44 +0000
Received: from list by lists.xenproject.org with outflank-mailman.58675.103348 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1ksNrQ-000301-OV; Thu, 24 Dec 2020 10:28:44 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 58675.103348; Thu, 24 Dec 2020 10:28: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 1ksNrQ-0002zu-LH; Thu, 24 Dec 2020 10:28:44 +0000
Received: by outflank-mailman (input) for mailman id 58675;
 Thu, 24 Dec 2020 10:28: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=HK/e=F4=gmail.com=lrbarbulescu@srs-us1.protection.inumbo.net>)
 id 1ksNrQ-0002zp-5K
 for minios-devel@lists.xen.org; Thu, 24 Dec 2020 10:28:44 +0000
Received: from mail-lf1-x130.google.com (unknown [2a00:1450:4864:20::130])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id c9a88fc0-b36f-43b1-833a-c56787ca7b04;
 Thu, 24 Dec 2020 10:28:43 +0000 (UTC)
Received: by mail-lf1-x130.google.com with SMTP id b26so3785920lff.9
 for <minios-devel@lists.xen.org>; Thu, 24 Dec 2020 02:28:43 -0800 (PST)
X-BeenThere: minios-devel@lists.xenproject.org
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
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: c9a88fc0-b36f-43b1-833a-c56787ca7b04
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=I+WEeOSiw/HFT4/cUqCCkeif01ZfvauVnj+SeA9ZxjA=;
        b=jsVuqy4PCXZ7QAlw2zvFG3yMViszb6u6vZ6lOeNKtF3yfd0izRm7KSd30UimS0Vhzb
         OX7KZtf57dsiPzMTNcRdlrYDBrRCn/3rr/hJUnke3ZGxscCABpukIHIkEcQoHXdM4dE9
         Z3z9ZPeBTPJXxYdsMmxz2etrYVHHia1+/HbwgN3xR+j5QxdXdMlXQKNb9qa/oqrxSkI0
         i8Gu+95i8hxkU7YGUcB23abRZnYdmdL3Gsz2JkADaPy3DH5RwZII+TklOVL9FBrv3n2t
         /H+1zfzc7IotzB8b0X5MWMOlSgyPPyrhy6fGmq1ITOvIqcHB7N4oP5Tjy+EbwRqitFlC
         DnuQ==
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=I+WEeOSiw/HFT4/cUqCCkeif01ZfvauVnj+SeA9ZxjA=;
        b=Xp/W4CY7hWgP/DeHjlvT3/lyttpomGVMsL2rHVW959v6upq5TO1IfkUIvzoKCtPMO3
         FL4OALBsBbDHT5fOt1OMWjXnGivwuSMoj8wk/vemFbxmrw94MQO7K/HRaQfbXvUra6BL
         vTrgJmT92p3GbpekvqR7poPYPk2KPcxO2nIKXRR9T3O4xHST97VKzP5RWufH/4UqBIoJ
         qFOduvLgF4Or8lCVVUscUrLyrlOsrvHG9zQUqa56zp/ET0GaguFOLTULGqnfJL7IYNZh
         YLeJA6Jtnslc1Exh8ddt3ruczqda80ei6bm70g40BClsz2XRPuU7Vd2I082ppBSMj2BW
         SbAg==
X-Gm-Message-State: AOAM530Ywm/DpDQekFagZJ3Eaa+D2GU9FTqN32G0LJmhy9UmjKBlakem
	uq9WzYHfnZ8TjEZir7twsBTueu1Ft7o5GeMScYY=
X-Google-Smtp-Source: ABdhPJzr2ANxZT+qVFPZjfse54O6FHFHJoxu5hWhpRgZj82Ov025ayRyNDtEsTnbkuJGSgFz6roO7+84V5KZ5t+I1AA=
X-Received: by 2002:a05:651c:11c9:: with SMTP id z9mr13180045ljo.96.1608805722262;
 Thu, 24 Dec 2020 02:28:42 -0800 (PST)
MIME-Version: 1.0
References: <20201222153758.1731-1-simon.kuenzer@neclab.eu> <20201222153758.1731-2-simon.kuenzer@neclab.eu>
In-Reply-To: <20201222153758.1731-2-simon.kuenzer@neclab.eu>
From: Laurentiu Barbulescu <lrbarbulescu@gmail.com>
Date: Thu, 24 Dec 2020 12:28:31 +0200
Message-ID: <CAMpNDK=3ZK2sqgM5XFW2LaOaHqQJsSqjH8sKoAz4kb3vDpBhOA@mail.gmail.com>
Subject: Re: [UNIKRAFT PATCH v2 1/7] lib/ukblkdev: blkdev.h: Include <uk/assert.h>
To: Simon Kuenzer <simon.kuenzer@neclab.eu>
Cc: minios-devel@lists.xen.org
Content-Type: multipart/alternative; boundary="000000000000968e1805b7334521"

--000000000000968e1805b7334521
Content-Type: text/plain; charset="UTF-8"

Hi Simon,

Looks good to me.

Reviewed-by: Laurentiu Barbulescu <lrbarbulescu@gmail.com>

On Tue, Dec 22, 2020 at 5:38 PM Simon Kuenzer <simon.kuenzer@neclab.eu>
wrote:

> The header `blkdev.h` uses UK_ASSERT but did not include
> `<uk/assert.h>`.
>
> Signed-off-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
> ---
>  lib/ukblkdev/include/uk/blkdev.h | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/lib/ukblkdev/include/uk/blkdev.h
> b/lib/ukblkdev/include/uk/blkdev.h
> index c8de0038d..7aa099092 100644
> --- a/lib/ukblkdev/include/uk/blkdev.h
> +++ b/lib/ukblkdev/include/uk/blkdev.h
> @@ -66,6 +66,7 @@
>  #include <stdio.h>
>  #include <errno.h>
>  #include <limits.h>
> +#include <uk/assert.h>
>  #include <uk/list.h>
>  #include <uk/errptr.h>
>
> --
> 2.20.1
>

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

<div dir=3D"ltr">Hi Simon,<br><br>Looks good to me.<br><br>Reviewed-by: Lau=
rentiu Barbulescu &lt;<a href=3D"mailto:lrbarbulescu@gmail.com">lrbarbulesc=
u@gmail.com</a>&gt;<br></div><br><div class=3D"gmail_quote"><div dir=3D"ltr=
" class=3D"gmail_attr">On Tue, Dec 22, 2020 at 5:38 PM Simon Kuenzer &lt;<a=
 href=3D"mailto:simon.kuenzer@neclab.eu">simon.kuenzer@neclab.eu</a>&gt; wr=
ote:<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">The header =
`blkdev.h` uses UK_ASSERT but did not include<br>
`&lt;uk/assert.h&gt;`.<br>
<br>
Signed-off-by: Simon Kuenzer &lt;<a href=3D"mailto:simon.kuenzer@neclab.eu"=
 target=3D"_blank">simon.kuenzer@neclab.eu</a>&gt;<br>
---<br>
=C2=A0lib/ukblkdev/include/uk/blkdev.h | 1 +<br>
=C2=A01 file changed, 1 insertion(+)<br>
<br>
diff --git a/lib/ukblkdev/include/uk/blkdev.h b/lib/ukblkdev/include/uk/blk=
dev.h<br>
index c8de0038d..7aa099092 100644<br>
--- a/lib/ukblkdev/include/uk/blkdev.h<br>
+++ b/lib/ukblkdev/include/uk/blkdev.h<br>
@@ -66,6 +66,7 @@<br>
=C2=A0#include &lt;stdio.h&gt;<br>
=C2=A0#include &lt;errno.h&gt;<br>
=C2=A0#include &lt;limits.h&gt;<br>
+#include &lt;uk/assert.h&gt;<br>
=C2=A0#include &lt;uk/list.h&gt;<br>
=C2=A0#include &lt;uk/errptr.h&gt;<br>
<br>
-- <br>
2.20.1<br>
</blockquote></div>

--000000000000968e1805b7334521--


From minios-devel-bounces@lists.xenproject.org Thu Dec 24 10:29:04 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Thu, 24 Dec 2020 10:29:04 +0000
Received: from list by lists.xenproject.org with outflank-mailman.58676.103352 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1ksNrk-00031Y-Qr; Thu, 24 Dec 2020 10:29:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 58676.103352; Thu, 24 Dec 2020 10:29: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 1ksNrk-00031R-Np; Thu, 24 Dec 2020 10:29:04 +0000
Received: by outflank-mailman (input) for mailman id 58676;
 Thu, 24 Dec 2020 10:29: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=HK/e=F4=gmail.com=lrbarbulescu@srs-us1.protection.inumbo.net>)
 id 1ksNrk-00031L-8y
 for minios-devel@lists.xen.org; Thu, 24 Dec 2020 10:29:04 +0000
Received: from mail-lf1-x136.google.com (unknown [2a00:1450:4864:20::136])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id da7bef9a-e208-48de-8f3e-cede77d4a49f;
 Thu, 24 Dec 2020 10:29:03 +0000 (UTC)
Received: by mail-lf1-x136.google.com with SMTP id m25so3764100lfc.11
 for <minios-devel@lists.xen.org>; Thu, 24 Dec 2020 02:29:03 -0800 (PST)
X-BeenThere: minios-devel@lists.xenproject.org
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
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: da7bef9a-e208-48de-8f3e-cede77d4a49f
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=bHKGhPTU7wL/rI7H2B5JRz5rpPoYC8WM9vOC7TvVgK0=;
        b=Um8W+Rnj2XesbZno0S92SsyhkqXtbK8/xGUUIbqivmsKCjqJeHaLJOUn54UfjTJam+
         tJQeQhWfgYPeZNm/Eh4uZWeSsnu7R0xaq/hwvTfOJzL0czt2xG2eSk/KDFTbPPdD+7nj
         H1T1prS+SD9rFIsN9QAhppi0FXd90En0yirHCZ2j74fqvqo2AtG3cBdZ+wKYSgWZRSS5
         5u9HtrTjBDXtPQ7GPhI9l8g0khI81dy0R5lOcV7bFOkyg8+8TJJJHb243N48UF7AwTE1
         BZMAe022rsTlE9gqoMC5i6tpRv+1lh2yLWTblg2JxKRaeC4p60cZvi4YXzuwdH7aC9yB
         78gg==
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=bHKGhPTU7wL/rI7H2B5JRz5rpPoYC8WM9vOC7TvVgK0=;
        b=U3ZLDzDPeAuh1l0PQWqUugGKbyhYUwqwC2qqlpoXcYSpiP2nf6joqyksjO454lIbUT
         vbCIh5Pv7c3tBV16JCunDn7NR/dD5MK/j79kBC3FxorPJusKZHswnrbNya4fJfRPQ1NT
         G6n3jhN9dHWDOFLzlT0DkpyYEzweOcbUVkz/M4yQTpt+u8wKuxn4nDk1lAjjO7mhBea4
         kgw9xijg0bR9l/E8M92Q/BUOK6pWzy8goqE+rjWnZROkhIP6rQ9/P3/Gv1XJ5xmO4nDk
         QcIMEdgHf73Eg3omjUQeLNqEWxvJ6+fpLTMUv//iKo86BF9AFS0HgNKtLTDuVVYDXEzW
         tUNg==
X-Gm-Message-State: AOAM5320A1FmHHMm7nfkcLutkvhCziHP83yNcZ6dGrMZipBLqJkC2HLJ
	CKMB+PCWDB2t/vXAyMcME4ZR3H6UyZMIbDqMwctxkVzBMj8noIIf
X-Google-Smtp-Source: ABdhPJxnLagU2F5IxwZf3/vcMFmh7HYI5iG6nD494K1G0ZB1XHW2qXe/8k3i/GKkhDPN/HIjOiOn4iSLhkgF9cicSwc=
X-Received: by 2002:a2e:88c8:: with SMTP id a8mr13656545ljk.148.1608805742452;
 Thu, 24 Dec 2020 02:29:02 -0800 (PST)
MIME-Version: 1.0
References: <20201222153758.1731-1-simon.kuenzer@neclab.eu> <20201222153758.1731-3-simon.kuenzer@neclab.eu>
In-Reply-To: <20201222153758.1731-3-simon.kuenzer@neclab.eu>
From: Laurentiu Barbulescu <lrbarbulescu@gmail.com>
Date: Thu, 24 Dec 2020 12:28:51 +0200
Message-ID: <CAMpNDKkerk0BVuA2qK_p2xDPnBpZLGsfFKk44_DYNo78x9rM1g@mail.gmail.com>
Subject: Re: [UNIKRAFT PATCH v2 2/7] lib/ukblkdev: blkreq.h: Include <uk/arch/atomic.h>
To: Simon Kuenzer <simon.kuenzer@neclab.eu>
Cc: minios-devel@lists.xen.org
Content-Type: multipart/alternative; boundary="000000000000caa4f205b73346a8"

--000000000000caa4f205b73346a8
Content-Type: text/plain; charset="UTF-8"

Hi Simon,

Looks good to me.

Reviewed-by: Laurentiu Barbulescu <lrbarbulescu@gmail.com>

On Tue, Dec 22, 2020 at 5:38 PM Simon Kuenzer <simon.kuenzer@neclab.eu>
wrote:

> The header `blkreq.h` uses atomic operations but did not include
> `<uk/arch/atomic.h>`.
>
> Signed-off-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
> ---
>  lib/ukblkdev/include/uk/blkreq.h | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/lib/ukblkdev/include/uk/blkreq.h
> b/lib/ukblkdev/include/uk/blkreq.h
> index 2c4b9b993..17daa6b52 100644
> --- a/lib/ukblkdev/include/uk/blkreq.h
> +++ b/lib/ukblkdev/include/uk/blkreq.h
> @@ -48,6 +48,8 @@ extern "C" {
>  #endif
>
>  #define __sector size_t
> +#include <uk/arch/atomic.h>
> +
>  struct uk_blkreq;
>
>  /**
> --
> 2.20.1
>

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

<div dir=3D"ltr">Hi Simon,<br><br>Looks good to me.<br><br>Reviewed-by: Lau=
rentiu Barbulescu &lt;<a href=3D"mailto:lrbarbulescu@gmail.com">lrbarbulesc=
u@gmail.com</a>&gt;<br></div><br><div class=3D"gmail_quote"><div dir=3D"ltr=
" class=3D"gmail_attr">On Tue, Dec 22, 2020 at 5:38 PM Simon Kuenzer &lt;<a=
 href=3D"mailto:simon.kuenzer@neclab.eu">simon.kuenzer@neclab.eu</a>&gt; wr=
ote:<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">The header =
`blkreq.h` uses atomic operations but did not include<br>
`&lt;uk/arch/atomic.h&gt;`.<br>
<br>
Signed-off-by: Simon Kuenzer &lt;<a href=3D"mailto:simon.kuenzer@neclab.eu"=
 target=3D"_blank">simon.kuenzer@neclab.eu</a>&gt;<br>
---<br>
=C2=A0lib/ukblkdev/include/uk/blkreq.h | 2 ++<br>
=C2=A01 file changed, 2 insertions(+)<br>
<br>
diff --git a/lib/ukblkdev/include/uk/blkreq.h b/lib/ukblkdev/include/uk/blk=
req.h<br>
index 2c4b9b993..17daa6b52 100644<br>
--- a/lib/ukblkdev/include/uk/blkreq.h<br>
+++ b/lib/ukblkdev/include/uk/blkreq.h<br>
@@ -48,6 +48,8 @@ extern &quot;C&quot; {<br>
=C2=A0#endif<br>
<br>
=C2=A0#define __sector size_t<br>
+#include &lt;uk/arch/atomic.h&gt;<br>
+<br>
=C2=A0struct uk_blkreq;<br>
<br>
=C2=A0/**<br>
-- <br>
2.20.1<br>
</blockquote></div>

--000000000000caa4f205b73346a8--


From minios-devel-bounces@lists.xenproject.org Thu Dec 24 10:29:25 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Thu, 24 Dec 2020 10:29:25 +0000
Received: from list by lists.xenproject.org with outflank-mailman.58678.103355 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1ksNs5-00036E-TI; Thu, 24 Dec 2020 10:29:25 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 58678.103355; Thu, 24 Dec 2020 10:29: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 1ksNs5-000367-QS; Thu, 24 Dec 2020 10:29:25 +0000
Received: by outflank-mailman (input) for mailman id 58678;
 Thu, 24 Dec 2020 10:29: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=HK/e=F4=gmail.com=lrbarbulescu@srs-us1.protection.inumbo.net>)
 id 1ksNs5-000362-3N
 for minios-devel@lists.xen.org; Thu, 24 Dec 2020 10:29:25 +0000
Received: from mail-lf1-x129.google.com (unknown [2a00:1450:4864:20::129])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id ff1e77cb-3e48-49de-bd98-2caa192df860;
 Thu, 24 Dec 2020 10:29:24 +0000 (UTC)
Received: by mail-lf1-x129.google.com with SMTP id o19so3883151lfo.1
 for <minios-devel@lists.xen.org>; Thu, 24 Dec 2020 02:29:24 -0800 (PST)
X-BeenThere: minios-devel@lists.xenproject.org
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
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: ff1e77cb-3e48-49de-bd98-2caa192df860
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=z46q9r/8My4tw1I0PQSDs7TAuDNzWisjUtdjbQEZOWA=;
        b=srO18zg75LVJ7V0HA6Rri1eKmdojrX/fI4+5xL3/v7x0qU+2v/o+2cOYWsSOL3Wl9U
         SqGpoWBQ91t2vvTy7RzkDLy7pI7cKq3stgNoV0hdGziW+JLG5dQlnVs816YKX8JICh3n
         41WFCY3UeCGGWCJ5BtrOMu3jok01MyVaDh7r4Wy3GMoye2dSAmrvfgRu9BQoNw8VNa4x
         zPCM/I4szD5TwYjPqmrtTFOlMZF7D4FfJUT8PCa242NEZnPYvuK3sWM9y55+I0DvmeUb
         s8z6FcjNbSfks3PVRNTESXNrr51xVeM3URknPJKXtr5Yt3ueUcKEgcqyJMJCaeODdHea
         p50A==
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=z46q9r/8My4tw1I0PQSDs7TAuDNzWisjUtdjbQEZOWA=;
        b=BjQD7UA/D/gEVYP78Pp3EV3osWie7y5XiCKDZo2nF4OhqQz0XNwBSE7Q/8kAeXsTLV
         ievBIc5DC2nHz9siRERf8P7xIj9wXhKrcohc6z8BNSG3pbMqACUCz1KdTt2DpV3S5qx/
         7wDI1P7RA+hcA6e4QfDuNqIjZZM3BE4ySExFosAqADSf1VytOy2+nrDyhrD7kNMhdENP
         8G0CUX8D0sa0WANSLMKElgc85JqGDqDbMh1H2k5EkiaT10A+kuNIQj1pCRWWNdCckgBF
         dMfe1GcDGXinWoPJ9zD9pomjz2hvy6NdxZob8MxOvZDQWIfmv31KXHz0lWn8EiNzIroK
         rCTA==
X-Gm-Message-State: AOAM532ZtOyvUoIRl/WoTFGLt1U42SVi2JaBEyYb2dqFFW/qrn1n3iPR
	S1jAb45Y9ifThMCSIiaBKx7JQ5J8K3L03qFNxtYhZmPVl2Eahl9v
X-Google-Smtp-Source: ABdhPJy7O1PKR87VIT97orjMIrGtPIJ29ORobBFpaCMC102QQ6m/pUpkIkQ+MMp+yZMyTh/Ib5qS9bfoeUOIg035tek=
X-Received: by 2002:a19:e17:: with SMTP id 23mr12922538lfo.608.1608805763290;
 Thu, 24 Dec 2020 02:29:23 -0800 (PST)
MIME-Version: 1.0
References: <20201222153758.1731-1-simon.kuenzer@neclab.eu> <20201222153758.1731-4-simon.kuenzer@neclab.eu>
In-Reply-To: <20201222153758.1731-4-simon.kuenzer@neclab.eu>
From: Laurentiu Barbulescu <lrbarbulescu@gmail.com>
Date: Thu, 24 Dec 2020 12:29:12 +0200
Message-ID: <CAMpNDK=M2dAg6aUg=3B05TDJBP=ZmAS=XAAPcVsJD0qjwuiLmg@mail.gmail.com>
Subject: Re: [UNIKRAFT PATCH v2 3/7] lib/ukblkdev: blkreq.h: Use typedef for __sector
To: Simon Kuenzer <simon.kuenzer@neclab.eu>
Cc: minios-devel@lists.xen.org
Content-Type: multipart/alternative; boundary="000000000000089c1405b7334846"

--000000000000089c1405b7334846
Content-Type: text/plain; charset="UTF-8"

Hi Simon,

Looks good to me.

Reviewed-by: Laurentiu Barbulescu <lrbarbulescu@gmail.com>

On Tue, Dec 22, 2020 at 5:38 PM Simon Kuenzer <simon.kuenzer@neclab.eu>
wrote:

> Introduces `__sector` with a type definition instead with an alias macro.
> This is done for consistency reasons. Additionally, the print format macro
> `__PRIsctr` is introduced so that a sector number can be printed
> correctly.
>
> Signed-off-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
> ---
>  lib/ukblkdev/include/uk/blkreq.h | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/lib/ukblkdev/include/uk/blkreq.h
> b/lib/ukblkdev/include/uk/blkreq.h
> index 17daa6b52..0bf4ae3ff 100644
> --- a/lib/ukblkdev/include/uk/blkreq.h
> +++ b/lib/ukblkdev/include/uk/blkreq.h
> @@ -47,9 +47,11 @@
>  extern "C" {
>  #endif
>
> -#define __sector size_t
>  #include <uk/arch/atomic.h>
>
> +typedef __sz __sector;
> +#define __PRIsctr __PRIsz
> +
>  struct uk_blkreq;
>
>  /**
> --
> 2.20.1
>

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

<div dir=3D"ltr">Hi Simon,<br><br>Looks good to me.<br><br>Reviewed-by: Lau=
rentiu Barbulescu &lt;<a href=3D"mailto:lrbarbulescu@gmail.com">lrbarbulesc=
u@gmail.com</a>&gt;<br></div><br><div class=3D"gmail_quote"><div dir=3D"ltr=
" class=3D"gmail_attr">On Tue, Dec 22, 2020 at 5:38 PM Simon Kuenzer &lt;<a=
 href=3D"mailto:simon.kuenzer@neclab.eu">simon.kuenzer@neclab.eu</a>&gt; wr=
ote:<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">Introduces =
`__sector` with a type definition instead with an alias macro.<br>
This is done for consistency reasons. Additionally, the print format macro<=
br>
`__PRIsctr` is introduced so that a sector number can be printed<br>
correctly.<br>
<br>
Signed-off-by: Simon Kuenzer &lt;<a href=3D"mailto:simon.kuenzer@neclab.eu"=
 target=3D"_blank">simon.kuenzer@neclab.eu</a>&gt;<br>
---<br>
=C2=A0lib/ukblkdev/include/uk/blkreq.h | 4 +++-<br>
=C2=A01 file changed, 3 insertions(+), 1 deletion(-)<br>
<br>
diff --git a/lib/ukblkdev/include/uk/blkreq.h b/lib/ukblkdev/include/uk/blk=
req.h<br>
index 17daa6b52..0bf4ae3ff 100644<br>
--- a/lib/ukblkdev/include/uk/blkreq.h<br>
+++ b/lib/ukblkdev/include/uk/blkreq.h<br>
@@ -47,9 +47,11 @@<br>
=C2=A0extern &quot;C&quot; {<br>
=C2=A0#endif<br>
<br>
-#define __sector size_t<br>
=C2=A0#include &lt;uk/arch/atomic.h&gt;<br>
<br>
+typedef __sz __sector;<br>
+#define __PRIsctr __PRIsz<br>
+<br>
=C2=A0struct uk_blkreq;<br>
<br>
=C2=A0/**<br>
-- <br>
2.20.1<br>
</blockquote></div>

--000000000000089c1405b7334846--


From minios-devel-bounces@lists.xenproject.org Thu Dec 24 10:30:03 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Thu, 24 Dec 2020 10:30:03 +0000
Received: from list by lists.xenproject.org with outflank-mailman.58681.103360 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1ksNsh-0003KX-1V; Thu, 24 Dec 2020 10:30:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 58681.103360; Thu, 24 Dec 2020 10:30: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 1ksNsg-0003Jz-Tq; Thu, 24 Dec 2020 10:30:02 +0000
Received: by outflank-mailman (input) for mailman id 58681;
 Thu, 24 Dec 2020 10:30: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=HK/e=F4=gmail.com=lrbarbulescu@srs-us1.protection.inumbo.net>)
 id 1ksNsg-0003FV-62
 for minios-devel@lists.xen.org; Thu, 24 Dec 2020 10:30:02 +0000
Received: from mail-lf1-x130.google.com (unknown [2a00:1450:4864:20::130])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 750a5de4-dfc7-48b2-8ee8-aeeaba2167ed;
 Thu, 24 Dec 2020 10:30:00 +0000 (UTC)
Received: by mail-lf1-x130.google.com with SMTP id m12so3822976lfo.7
 for <minios-devel@lists.xen.org>; Thu, 24 Dec 2020 02:30:00 -0800 (PST)
X-BeenThere: minios-devel@lists.xenproject.org
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
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: 750a5de4-dfc7-48b2-8ee8-aeeaba2167ed
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=h1S+NTV+VeM2lRpBdyvtoOsZ2K8IXJQMCd8GJO5+ebA=;
        b=il9L894knONC5HfVcRXmXYHlJU4/YQtymb1QZ4wh+M5WNDDDRAQCurAR44BP2xYtCu
         Tc99MFDj+Hnn21tbO8uXRJRqLviOjwt/2S0c68/Rd0+PItxIrPR+Khs9a7qup7aADOD3
         tYNI8mjlKlnZVy3ooTtPmT+YRmQTstsIH7pfiTcjyxJKPkUy6+hCzWRP9hGzcPG/raOQ
         vXDr4/0z7XqzxfAMfRC9KwnRJIPfcnM/vmQkXck3/4kAv+g7vGeEGFOSdnuixFX3/fqs
         MzMTM1uRdWq7vHeLu18MTXBoI8b7PiKHeibyNOuGAFDFeVvYunJJpuAgLT41t6HTq63x
         inrg==
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=h1S+NTV+VeM2lRpBdyvtoOsZ2K8IXJQMCd8GJO5+ebA=;
        b=MdPgaspf8Lzf5HH47mOoKk3FUCCFu1HDQzyhqCep+ESHwDx9RYzXACr0t6XwjxL37v
         V/DMZjjWbW1rD+miY5hTAMe+h2DFzzQ6KNeYOea68TglNt6qRN8l5urVQfb1REhIaS5R
         objjbWj4sbxWM9WlQ4Nq3VUcuLxVeAH0d44vCsjh2HADG6dzVjnjQJpwn+nrkiXDTRmL
         /pGwfvMZgtAfICHnWFfGd+uzaZm6/3KpfXGcHZBh7j/TMgk2vVYgt+Atq1RaMeoa46Mt
         GtQ+O/msxmGlxe8NTIk2X2pOZMENhvXuNzfJLk4HZcuWSlb1wUUaPC8+Olme2HsGtGVr
         yU7w==
X-Gm-Message-State: AOAM532sHHvxWZ93w6XLo31kotxY/dAXFMrliiHrMd78G8N0kJYYLFwY
	aBFjPNTvTvgxsWMSr1qWNianBELzEQl9iVn8yBY=
X-Google-Smtp-Source: ABdhPJzA4v92gBHYlGI8hKEFuyJre9kFX/Ma85TVZx9ILldDKyKo4UUFYdm+bZyRmGzZDFCmWAi4fqJpNJxTv+OIvOE=
X-Received: by 2002:a19:cc10:: with SMTP id c16mr12080376lfg.43.1608805799349;
 Thu, 24 Dec 2020 02:29:59 -0800 (PST)
MIME-Version: 1.0
References: <20201222153758.1731-1-simon.kuenzer@neclab.eu> <20201222153758.1731-5-simon.kuenzer@neclab.eu>
In-Reply-To: <20201222153758.1731-5-simon.kuenzer@neclab.eu>
From: Laurentiu Barbulescu <lrbarbulescu@gmail.com>
Date: Thu, 24 Dec 2020 12:29:48 +0200
Message-ID: <CAMpNDKknVSz7or-_0DEM4sWwgh4fpPYd1mDxfvCkBEyj+JTi7Q@mail.gmail.com>
Subject: Re: [UNIKRAFT PATCH v2 4/7] lib/ukblkdev: blkreq.h: Use UK_BLKREQ_
 prefix for states and ops
To: Simon Kuenzer <simon.kuenzer@neclab.eu>
Cc: minios-devel@lists.xen.org
Content-Type: multipart/alternative; boundary="0000000000002ed25d05b7334af6"

--0000000000002ed25d05b7334af6
Content-Type: text/plain; charset="UTF-8"

Hi Simon,

Looks good to me.

Reviewed-by: Laurentiu Barbulescu <lrbarbulescu@gmail.com>

On Tue, Dec 22, 2020 at 5:38 PM Simon Kuenzer <simon.kuenzer@neclab.eu>
wrote:

> Instead of using `UK_BLKDEV_REQ_` prefix for `struct uk_blkreq`
> states (finished, unfinished) and `UK_BLKDEV_` prefix for operation
> requests (read, write, flush) this commits simplifies the API by using
> the `UK_BLKREQ_` prefix.
>
> Signed-off-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
> ---
>  lib/ukblkdev/include/uk/blkdev.h        | 10 +++++-----
>  lib/ukblkdev/include/uk/blkdev_driver.h |  2 +-
>  lib/ukblkdev/include/uk/blkreq.h        | 14 +++++++-------
>  plat/drivers/virtio/virtio_blk.c        | 12 ++++++------
>  plat/xen/drivers/blk/blkfront.c         | 10 +++++-----
>  5 files changed, 24 insertions(+), 24 deletions(-)
>
> diff --git a/lib/ukblkdev/include/uk/blkdev.h
> b/lib/ukblkdev/include/uk/blkdev.h
> index 7aa099092..abc228d9c 100644
> --- a/lib/ukblkdev/include/uk/blkdev.h
> +++ b/lib/ukblkdev/include/uk/blkdev.h
> @@ -459,18 +459,18 @@ int uk_blkdev_sync_io(struct uk_blkdev *dev,
>                 sector,         \
>                 nb_sectors,     \
>                 buf)            \
> -       uk_blkdev_sync_io(blkdev, queue_id, UK_BLKDEV_WRITE, sector, \
> -                       nb_sectors, buf) \
> +       uk_blkdev_sync_io(blkdev, queue_id, UK_BLKREQ_WRITE, sector, \
> +                         nb_sectors, buf)                           \
>
>  #define uk_blkdev_sync_read(blkdev,\
>                 queue_id,       \
>                 sector,         \
>                 nb_sectors,     \
>                 buf)            \
> -       uk_blkdev_sync_io(blkdev, queue_id, UK_BLKDEV_READ, sector, \
> -                       nb_sectors, buf) \
> +       uk_blkdev_sync_io(blkdev, queue_id, UK_BLKREQ_READ, sector, \
> +                         nb_sectors, buf)                          \
>
> -#endif
> +#endif /* CONFIG_LIBUKBLKDEV_SYNC_IO_BLOCKED_WAITING */
>
>  /**
>   * Stop a Unikraft block device, and set its state to UK_BLKDEV_CONFIGURED
> diff --git a/lib/ukblkdev/include/uk/blkdev_driver.h
> b/lib/ukblkdev/include/uk/blkdev_driver.h
> index be8070691..cb1b3ba39 100644
> --- a/lib/ukblkdev/include/uk/blkdev_driver.h
> +++ b/lib/ukblkdev/include/uk/blkdev_driver.h
> @@ -104,7 +104,7 @@ static inline void uk_blkdev_drv_queue_event(struct
> uk_blkdev *dev,
>   *     uk_blkreq structure
>   */
>  #define uk_blkreq_finished(req) \
> -       (ukarch_store_n(&(req)->state.counter, UK_BLKDEV_REQ_FINISHED))
> +       (ukarch_store_n(&(req)->state.counter, UK_BLKREQ_FINISHED))
>
>  /**
>   * Frees the data allocated for the Unikraft Block Device.
> diff --git a/lib/ukblkdev/include/uk/blkreq.h
> b/lib/ukblkdev/include/uk/blkreq.h
> index 0bf4ae3ff..ae1a31ed5 100644
> --- a/lib/ukblkdev/include/uk/blkreq.h
> +++ b/lib/ukblkdev/include/uk/blkreq.h
> @@ -58,8 +58,8 @@ struct uk_blkreq;
>   *     Operation status
>   */
>  enum uk_blkreq_state {
> -       UK_BLKDEV_REQ_FINISHED = 0,
> -       UK_BLKDEV_REQ_UNFINISHED
> +       UK_BLKREQ_FINISHED = 0,
> +       UK_BLKREQ_UNFINISHED
>  };
>
>  /**
> @@ -67,11 +67,11 @@ enum uk_blkreq_state {
>   */
>  enum uk_blkreq_op {
>         /* Read operation */
> -       UK_BLKDEV_READ = 0,
> +       UK_BLKREQ_READ = 0,
>         /* Write operation */
> -       UK_BLKDEV_WRITE,
> +       UK_BLKREQ_WRITE,
>         /* Flush the volatile write cache */
> -       UK_BLKDEV_FFLUSH = 4
> +       UK_BLKREQ_FFLUSH = 4
>  };
>
>  /**
> @@ -135,7 +135,7 @@ static inline void uk_blkreq_init(struct uk_blkreq
> *req,
>         req->start_sector = start;
>         req->nb_sectors = nb_sectors;
>         req->aio_buf = aio_buf;
> -       ukarch_store_n(&req->state.counter, UK_BLKDEV_REQ_UNFINISHED);
> +       ukarch_store_n(&req->state.counter, UK_BLKREQ_UNFINISHED);
>         req->cb = cb;
>         req->cb_cookie = cb_cookie;
>  }
> @@ -147,7 +147,7 @@ static inline void uk_blkreq_init(struct uk_blkreq
> *req,
>   *     uk_blkreq structure
>   **/
>  #define uk_blkreq_is_done(req) \
> -               (ukarch_load_n(&(req)->state.counter) ==
> UK_BLKDEV_REQ_FINISHED)
> +               (ukarch_load_n(&(req)->state.counter) ==
> UK_BLKREQ_FINISHED)
>
>  #ifdef __cplusplus
>  }
> diff --git a/plat/drivers/virtio/virtio_blk.c
> b/plat/drivers/virtio/virtio_blk.c
> index ff33cc119..262355b49 100644
> --- a/plat/drivers/virtio/virtio_blk.c
> +++ b/plat/drivers/virtio/virtio_blk.c
> @@ -186,7 +186,7 @@ static int virtio_blkdev_request_write(struct
> uk_blkdev_queue *queue,
>         vbdev = queue->vbd;
>         cap = &vbdev->blkdev.capabilities;
>         req = virtio_blk_req->req;
> -       if (req->operation == UK_BLKDEV_WRITE &&
> +       if (req->operation == UK_BLKREQ_WRITE &&
>                         cap->mode == O_RDONLY)
>                 return -EPERM;
>
> @@ -209,11 +209,11 @@ static int virtio_blkdev_request_write(struct
> uk_blkdev_queue *queue,
>                 goto out;
>         }
>
> -       if (req->operation == UK_BLKDEV_WRITE) {
> +       if (req->operation == UK_BLKREQ_WRITE) {
>                 *read_segs = queue->sg.sg_nseg - 1;
>                 *write_segs = 1;
>                 virtio_blk_req->virtio_blk_outhdr.type = VIRTIO_BLK_T_OUT;
> -       } else if (req->operation == UK_BLKDEV_READ) {
> +       } else if (req->operation == UK_BLKREQ_READ) {
>                 *read_segs = 1;
>                 *write_segs = queue->sg.sg_nseg - 1;
>                 virtio_blk_req->virtio_blk_outhdr.type = VIRTIO_BLK_T_IN;
> @@ -278,11 +278,11 @@ static int virtio_blkdev_queue_enqueue(struct
> uk_blkdev_queue *queue,
>
>         virtio_blk_req->req = req;
>         virtio_blk_req->virtio_blk_outhdr.sector = req->start_sector;
> -       if (req->operation == UK_BLKDEV_WRITE ||
> -                       req->operation == UK_BLKDEV_READ)
> +       if (req->operation == UK_BLKREQ_WRITE ||
> +                       req->operation == UK_BLKREQ_READ)
>                 rc = virtio_blkdev_request_write(queue, virtio_blk_req,
>                                 &read_segs, &write_segs);
> -       else if (req->operation == UK_BLKDEV_FFLUSH)
> +       else if (req->operation == UK_BLKREQ_FFLUSH)
>                 rc = virtio_blkdev_request_flush(queue, virtio_blk_req,
>                                 &read_segs, &write_segs);
>         else
> diff --git a/plat/xen/drivers/blk/blkfront.c
> b/plat/xen/drivers/blk/blkfront.c
> index 5cd5cf226..60b634665 100644
> --- a/plat/xen/drivers/blk/blkfront.c
> +++ b/plat/xen/drivers/blk/blkfront.c
> @@ -250,7 +250,7 @@ static void blkif_request_init(struct blkif_request
> *ring_req,
>         UK_ASSERT(nb_segments <= BLKIF_MAX_SEGMENTS_PER_REQUEST);
>
>         /* Set ring request */
> -       ring_req->operation = (req->operation == UK_BLKDEV_WRITE) ?
> +       ring_req->operation = (req->operation == UK_BLKREQ_WRITE) ?
>                         BLKIF_OP_WRITE : BLKIF_OP_READ;
>         ring_req->nr_segments = nb_segments;
>         ring_req->sector_number = req->start_sector;
> @@ -281,7 +281,7 @@ static int blkfront_request_write(struct
> blkfront_request *blkfront_req,
>         dev = blkfront_req->queue->dev;
>         cap = &dev->blkdev.capabilities;
>         sector_size = cap->ssize;
> -       if (req->operation == UK_BLKDEV_WRITE && cap->mode == O_RDONLY)
> +       if (req->operation == UK_BLKREQ_WRITE && cap->mode == O_RDONLY)
>                 return -EPERM;
>
>         if (req->aio_buf == NULL)
> @@ -360,10 +360,10 @@ static int blkfront_queue_enqueue(struct
> uk_blkdev_queue *queue,
>         ring_req->id = (uintptr_t) blkfront_req;
>         ring_req->handle = dev->handle;
>
> -       if (req->operation == UK_BLKDEV_READ ||
> -                       req->operation == UK_BLKDEV_WRITE)
> +       if (req->operation == UK_BLKREQ_READ ||
> +                       req->operation == UK_BLKREQ_WRITE)
>                 rc = blkfront_request_write(blkfront_req, ring_req);
> -       else if (req->operation == UK_BLKDEV_FFLUSH)
> +       else if (req->operation == UK_BLKREQ_FFLUSH)
>                 rc =  blkfront_request_flush(blkfront_req, ring_req);
>         else
>                 rc = -EINVAL;
> --
> 2.20.1
>

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

<div dir=3D"ltr">Hi Simon,<br><br>Looks good to me.<br><br>Reviewed-by: Lau=
rentiu Barbulescu &lt;<a href=3D"mailto:lrbarbulescu@gmail.com">lrbarbulesc=
u@gmail.com</a>&gt;<br></div><br><div class=3D"gmail_quote"><div dir=3D"ltr=
" class=3D"gmail_attr">On Tue, Dec 22, 2020 at 5:38 PM Simon Kuenzer &lt;<a=
 href=3D"mailto:simon.kuenzer@neclab.eu">simon.kuenzer@neclab.eu</a>&gt; wr=
ote:<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">Instead of =
using `UK_BLKDEV_REQ_` prefix for `struct uk_blkreq`<br>
states (finished, unfinished) and `UK_BLKDEV_` prefix for operation<br>
requests (read, write, flush) this commits simplifies the API by using<br>
the `UK_BLKREQ_` prefix.<br>
<br>
Signed-off-by: Simon Kuenzer &lt;<a href=3D"mailto:simon.kuenzer@neclab.eu"=
 target=3D"_blank">simon.kuenzer@neclab.eu</a>&gt;<br>
---<br>
=C2=A0lib/ukblkdev/include/uk/blkdev.h=C2=A0 =C2=A0 =C2=A0 =C2=A0 | 10 ++++=
+-----<br>
=C2=A0lib/ukblkdev/include/uk/blkdev_driver.h |=C2=A0 2 +-<br>
=C2=A0lib/ukblkdev/include/uk/blkreq.h=C2=A0 =C2=A0 =C2=A0 =C2=A0 | 14 ++++=
+++-------<br>
=C2=A0plat/drivers/virtio/virtio_blk.c=C2=A0 =C2=A0 =C2=A0 =C2=A0 | 12 ++++=
++------<br>
=C2=A0plat/xen/drivers/blk/blkfront.c=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0| 10=
 +++++-----<br>
=C2=A05 files changed, 24 insertions(+), 24 deletions(-)<br>
<br>
diff --git a/lib/ukblkdev/include/uk/blkdev.h b/lib/ukblkdev/include/uk/blk=
dev.h<br>
index 7aa099092..abc228d9c 100644<br>
--- a/lib/ukblkdev/include/uk/blkdev.h<br>
+++ b/lib/ukblkdev/include/uk/blkdev.h<br>
@@ -459,18 +459,18 @@ int uk_blkdev_sync_io(struct uk_blkdev *dev,<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 sector,=C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0\<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 nb_sectors,=C2=A0 =
=C2=A0 =C2=A0\<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 buf)=C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 \<br>
-=C2=A0 =C2=A0 =C2=A0 =C2=A0uk_blkdev_sync_io(blkdev, queue_id, UK_BLKDEV_W=
RITE, sector, \<br>
-=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0nb_sectors, buf) \<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0uk_blkdev_sync_io(blkdev, queue_id, UK_BLKREQ_W=
RITE, sector, \<br>
+=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=A0nb_sectors, buf)=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\<br>
<br>
=C2=A0#define uk_blkdev_sync_read(blkdev,\<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 queue_id,=C2=A0 =C2=
=A0 =C2=A0 =C2=A0\<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 sector,=C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0\<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 nb_sectors,=C2=A0 =
=C2=A0 =C2=A0\<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 buf)=C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 \<br>
-=C2=A0 =C2=A0 =C2=A0 =C2=A0uk_blkdev_sync_io(blkdev, queue_id, UK_BLKDEV_R=
EAD, sector, \<br>
-=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0nb_sectors, buf) \<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0uk_blkdev_sync_io(blkdev, queue_id, UK_BLKREQ_R=
EAD, sector, \<br>
+=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=A0nb_sectors, buf)=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 \<br>
<br>
-#endif<br>
+#endif /* CONFIG_LIBUKBLKDEV_SYNC_IO_BLOCKED_WAITING */<br>
<br>
=C2=A0/**<br>
=C2=A0 * Stop a Unikraft block device, and set its state to UK_BLKDEV_CONFI=
GURED<br>
diff --git a/lib/ukblkdev/include/uk/blkdev_driver.h b/lib/ukblkdev/include=
/uk/blkdev_driver.h<br>
index be8070691..cb1b3ba39 100644<br>
--- a/lib/ukblkdev/include/uk/blkdev_driver.h<br>
+++ b/lib/ukblkdev/include/uk/blkdev_driver.h<br>
@@ -104,7 +104,7 @@ static inline void uk_blkdev_drv_queue_event(struct uk_=
blkdev *dev,<br>
=C2=A0 *=C2=A0 =C2=A0 =C2=A0uk_blkreq structure<br>
=C2=A0 */<br>
=C2=A0#define uk_blkreq_finished(req) \<br>
-=C2=A0 =C2=A0 =C2=A0 =C2=A0(ukarch_store_n(&amp;(req)-&gt;state.counter, U=
K_BLKDEV_REQ_FINISHED))<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0(ukarch_store_n(&amp;(req)-&gt;state.counter, U=
K_BLKREQ_FINISHED))<br>
<br>
=C2=A0/**<br>
=C2=A0 * Frees the data allocated for the Unikraft Block Device.<br>
diff --git a/lib/ukblkdev/include/uk/blkreq.h b/lib/ukblkdev/include/uk/blk=
req.h<br>
index 0bf4ae3ff..ae1a31ed5 100644<br>
--- a/lib/ukblkdev/include/uk/blkreq.h<br>
+++ b/lib/ukblkdev/include/uk/blkreq.h<br>
@@ -58,8 +58,8 @@ struct uk_blkreq;<br>
=C2=A0 *=C2=A0 =C2=A0 =C2=A0Operation status<br>
=C2=A0 */<br>
=C2=A0enum uk_blkreq_state {<br>
-=C2=A0 =C2=A0 =C2=A0 =C2=A0UK_BLKDEV_REQ_FINISHED =3D 0,<br>
-=C2=A0 =C2=A0 =C2=A0 =C2=A0UK_BLKDEV_REQ_UNFINISHED<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0UK_BLKREQ_FINISHED =3D 0,<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0UK_BLKREQ_UNFINISHED<br>
=C2=A0};<br>
<br>
=C2=A0/**<br>
@@ -67,11 +67,11 @@ enum uk_blkreq_state {<br>
=C2=A0 */<br>
=C2=A0enum uk_blkreq_op {<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 /* Read operation */<br>
-=C2=A0 =C2=A0 =C2=A0 =C2=A0UK_BLKDEV_READ =3D 0,<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0UK_BLKREQ_READ =3D 0,<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 /* Write operation */<br>
-=C2=A0 =C2=A0 =C2=A0 =C2=A0UK_BLKDEV_WRITE,<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0UK_BLKREQ_WRITE,<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 /* Flush the volatile write cache */<br>
-=C2=A0 =C2=A0 =C2=A0 =C2=A0UK_BLKDEV_FFLUSH =3D 4<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0UK_BLKREQ_FFLUSH =3D 4<br>
=C2=A0};<br>
<br>
=C2=A0/**<br>
@@ -135,7 +135,7 @@ static inline void uk_blkreq_init(struct uk_blkreq *req=
,<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 req-&gt;start_sector =3D start;<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 req-&gt;nb_sectors =3D nb_sectors;<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 req-&gt;aio_buf =3D aio_buf;<br>
-=C2=A0 =C2=A0 =C2=A0 =C2=A0ukarch_store_n(&amp;req-&gt;state.counter, UK_B=
LKDEV_REQ_UNFINISHED);<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0ukarch_store_n(&amp;req-&gt;state.counter, UK_B=
LKREQ_UNFINISHED);<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 req-&gt;cb =3D cb;<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 req-&gt;cb_cookie =3D cb_cookie;<br>
=C2=A0}<br>
@@ -147,7 +147,7 @@ static inline void uk_blkreq_init(struct uk_blkreq *req=
,<br>
=C2=A0 *=C2=A0 =C2=A0 =C2=A0uk_blkreq structure<br>
=C2=A0 **/<br>
=C2=A0#define uk_blkreq_is_done(req) \<br>
-=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(ukarch_load_n(&amp=
;(req)-&gt;state.counter) =3D=3D UK_BLKDEV_REQ_FINISHED)<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(ukarch_load_n(&amp=
;(req)-&gt;state.counter) =3D=3D UK_BLKREQ_FINISHED)<br>
<br>
=C2=A0#ifdef __cplusplus<br>
=C2=A0}<br>
diff --git a/plat/drivers/virtio/virtio_blk.c b/plat/drivers/virtio/virtio_=
blk.c<br>
index ff33cc119..262355b49 100644<br>
--- a/plat/drivers/virtio/virtio_blk.c<br>
+++ b/plat/drivers/virtio/virtio_blk.c<br>
@@ -186,7 +186,7 @@ static int virtio_blkdev_request_write(struct uk_blkdev=
_queue *queue,<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 vbdev =3D queue-&gt;vbd;<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 cap =3D &amp;vbdev-&gt;blkdev.capabilities;<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 req =3D virtio_blk_req-&gt;req;<br>
-=C2=A0 =C2=A0 =C2=A0 =C2=A0if (req-&gt;operation =3D=3D UK_BLKDEV_WRITE &a=
mp;&amp;<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0if (req-&gt;operation =3D=3D UK_BLKREQ_WRITE &a=
mp;&amp;<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 cap-&gt;mode =3D=3D O_RDONLY)<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 return -EPERM;<br>
<br>
@@ -209,11 +209,11 @@ static int virtio_blkdev_request_write(struct uk_blkd=
ev_queue *queue,<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 goto out;<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 }<br>
<br>
-=C2=A0 =C2=A0 =C2=A0 =C2=A0if (req-&gt;operation =3D=3D UK_BLKDEV_WRITE) {=
<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0if (req-&gt;operation =3D=3D UK_BLKREQ_WRITE) {=
<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 *read_segs =3D queu=
e-&gt;sg.sg_nseg - 1;<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 *write_segs =3D 1;<=
br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 virtio_blk_req-&gt;=
virtio_blk_outhdr.type =3D VIRTIO_BLK_T_OUT;<br>
-=C2=A0 =C2=A0 =C2=A0 =C2=A0} else if (req-&gt;operation =3D=3D UK_BLKDEV_R=
EAD) {<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0} else if (req-&gt;operation =3D=3D UK_BLKREQ_R=
EAD) {<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 *read_segs =3D 1;<b=
r>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 *write_segs =3D que=
ue-&gt;sg.sg_nseg - 1;<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 virtio_blk_req-&gt;=
virtio_blk_outhdr.type =3D VIRTIO_BLK_T_IN;<br>
@@ -278,11 +278,11 @@ static int virtio_blkdev_queue_enqueue(struct uk_blkd=
ev_queue *queue,<br>
<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 virtio_blk_req-&gt;req =3D req;<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 virtio_blk_req-&gt;virtio_blk_outhdr.sector =3D=
 req-&gt;start_sector;<br>
-=C2=A0 =C2=A0 =C2=A0 =C2=A0if (req-&gt;operation =3D=3D UK_BLKDEV_WRITE ||=
<br>
-=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0req-&gt;operation =3D=3D UK_BLKDEV_READ)<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0if (req-&gt;operation =3D=3D UK_BLKREQ_WRITE ||=
<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0req-&gt;operation =3D=3D UK_BLKREQ_READ)<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 rc =3D virtio_blkde=
v_request_write(queue, virtio_blk_req,<br>
=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 &amp;read_segs, &amp;write_segs);<br=
>
-=C2=A0 =C2=A0 =C2=A0 =C2=A0else if (req-&gt;operation =3D=3D UK_BLKDEV_FFL=
USH)<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0else if (req-&gt;operation =3D=3D UK_BLKREQ_FFL=
USH)<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 rc =3D virtio_blkde=
v_request_flush(queue, virtio_blk_req,<br>
=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 &amp;read_segs, &amp;write_segs);<br=
>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 else<br>
diff --git a/plat/xen/drivers/blk/blkfront.c b/plat/xen/drivers/blk/blkfron=
t.c<br>
index 5cd5cf226..60b634665 100644<br>
--- a/plat/xen/drivers/blk/blkfront.c<br>
+++ b/plat/xen/drivers/blk/blkfront.c<br>
@@ -250,7 +250,7 @@ static void blkif_request_init(struct blkif_request *ri=
ng_req,<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 UK_ASSERT(nb_segments &lt;=3D BLKIF_MAX_SEGMENT=
S_PER_REQUEST);<br>
<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 /* Set ring request */<br>
-=C2=A0 =C2=A0 =C2=A0 =C2=A0ring_req-&gt;operation =3D (req-&gt;operation =
=3D=3D UK_BLKDEV_WRITE) ?<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0ring_req-&gt;operation =3D (req-&gt;operation =
=3D=3D UK_BLKREQ_WRITE) ?<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 BLKIF_OP_WRITE : BLKIF_OP_READ;<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 ring_req-&gt;nr_segments =3D nb_segments;<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 ring_req-&gt;sector_number =3D req-&gt;start_se=
ctor;<br>
@@ -281,7 +281,7 @@ static int blkfront_request_write(struct blkfront_reque=
st *blkfront_req,<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 dev =3D blkfront_req-&gt;queue-&gt;dev;<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 cap =3D &amp;dev-&gt;blkdev.capabilities;<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 sector_size =3D cap-&gt;ssize;<br>
-=C2=A0 =C2=A0 =C2=A0 =C2=A0if (req-&gt;operation =3D=3D UK_BLKDEV_WRITE &a=
mp;&amp; cap-&gt;mode =3D=3D O_RDONLY)<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0if (req-&gt;operation =3D=3D UK_BLKREQ_WRITE &a=
mp;&amp; cap-&gt;mode =3D=3D O_RDONLY)<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 return -EPERM;<br>
<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 if (req-&gt;aio_buf =3D=3D NULL)<br>
@@ -360,10 +360,10 @@ static int blkfront_queue_enqueue(struct uk_blkdev_qu=
eue *queue,<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 ring_req-&gt;id =3D (uintptr_t) blkfront_req;<b=
r>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 ring_req-&gt;handle =3D dev-&gt;handle;<br>
<br>
-=C2=A0 =C2=A0 =C2=A0 =C2=A0if (req-&gt;operation =3D=3D UK_BLKDEV_READ ||<=
br>
-=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0req-&gt;operation =3D=3D UK_BLKDEV_WRITE)<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0if (req-&gt;operation =3D=3D UK_BLKREQ_READ ||<=
br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0req-&gt;operation =3D=3D UK_BLKREQ_WRITE)<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 rc =3D blkfront_req=
uest_write(blkfront_req, ring_req);<br>
-=C2=A0 =C2=A0 =C2=A0 =C2=A0else if (req-&gt;operation =3D=3D UK_BLKDEV_FFL=
USH)<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0else if (req-&gt;operation =3D=3D UK_BLKREQ_FFL=
USH)<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 rc =3D=C2=A0 blkfro=
nt_request_flush(blkfront_req, ring_req);<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 else<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 rc =3D -EINVAL;<br>
-- <br>
2.20.1<br>
</blockquote></div>

--0000000000002ed25d05b7334af6--


From minios-devel-bounces@lists.xenproject.org Thu Dec 24 10:30:27 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Thu, 24 Dec 2020 10:30:27 +0000
Received: from list by lists.xenproject.org with outflank-mailman.58683.103363 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1ksNt5-0003pG-4n; Thu, 24 Dec 2020 10:30:27 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 58683.103363; Thu, 24 Dec 2020 10:30:27 +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 1ksNt5-0003p9-1s; Thu, 24 Dec 2020 10:30:27 +0000
Received: by outflank-mailman (input) for mailman id 58683;
 Thu, 24 Dec 2020 10:30: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=HK/e=F4=gmail.com=lrbarbulescu@srs-us1.protection.inumbo.net>)
 id 1ksNt3-0003p2-Vu
 for minios-devel@lists.xen.org; Thu, 24 Dec 2020 10:30:26 +0000
Received: from mail-lf1-x12c.google.com (unknown [2a00:1450:4864:20::12c])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id da6e957f-3b9b-4966-9fdf-251efafe6283;
 Thu, 24 Dec 2020 10:30:24 +0000 (UTC)
Received: by mail-lf1-x12c.google.com with SMTP id m25so3771206lfc.11
 for <minios-devel@lists.xen.org>; Thu, 24 Dec 2020 02:30:23 -0800 (PST)
X-BeenThere: minios-devel@lists.xenproject.org
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
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: da6e957f-3b9b-4966-9fdf-251efafe6283
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=frZO431hpYgrybQKd8m2sQg712sXXXrhgLicfkSDDOo=;
        b=OW1jjBEwfrQdg9EqPDdoPINTTVcLU1lRyQFvRNClFkSqoTzFl+FYiJe9HAAHrHMoG7
         iWVE7xNGl7ZvvxrnnNBeuFKRquZoS+NPYyxpC8txUm58hAAo6VeUD1oCjridDEWgVbtq
         P5TLdrkP2kKeTDIg/V1CdspBMC18SPE9aTqL9mEoj3TMSm5ZHiGRYlBSs5CaAC65mzCJ
         TgkC/ssW6kIdmduQtzHr9VmHe/lWlHNgMuCURWOfK7p6o1zzBvTagbP85WJhtxPM+tjv
         +yXBUBN/pZl03jtziyKJIYQCfGKbopTQ424DinxhuCqfozXpwZq3AKDygbuVAGvA4PLd
         GJiw==
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=frZO431hpYgrybQKd8m2sQg712sXXXrhgLicfkSDDOo=;
        b=D9/Anu1Ga46xDq6nGVrfG6NOEXYxog4BKgr5zi1pFTWcadwQp/Hbv2rY6Ug6nnKY5S
         OYcLlxGqgttt7CBHTNTKPd0jzEUUMEhF81K2x6lMzZ/peJMdgpZJQHbvbTjIQ2sZ7lzy
         narBZBsWUKJt3fntK4ImjAI/ArfOAb1GmsQGp1VL9cVieq5/ykQVsYipP3NfR9FzX66c
         U3bT/Wwo6MQpUAeD6srrTdGpDuLIesNpachhYb9EeZWRZi11O91zMLnDQXVtfSJa/g+K
         ihi4Ut9LYOjEzjq7WF/IK7LSe8SlBwVoDWnScXJJnw5COLN8O28hF+QcGttrdOMqMdtx
         u4og==
X-Gm-Message-State: AOAM530Loc9mjQQ1s1809djeNzfKwJ5jAMor8T7jowvVYXOrjyQU5hGx
	geh8if6u8aryUuS3qqeSs1g5jXTJ/AwvYafCctw=
X-Google-Smtp-Source: ABdhPJzaxxpBCweJjDsqOlG6Dy1faACKSIK1X0f/S/khP/be4fzlYQcGfwE6OYNbIS2hctYyw5XPL/ku3vXFy69VaSY=
X-Received: by 2002:a2e:888e:: with SMTP id k14mr14271184lji.285.1608805822992;
 Thu, 24 Dec 2020 02:30:22 -0800 (PST)
MIME-Version: 1.0
References: <20201222153758.1731-1-simon.kuenzer@neclab.eu> <20201222153758.1731-6-simon.kuenzer@neclab.eu>
In-Reply-To: <20201222153758.1731-6-simon.kuenzer@neclab.eu>
From: Laurentiu Barbulescu <lrbarbulescu@gmail.com>
Date: Thu, 24 Dec 2020 12:30:12 +0200
Message-ID: <CAMpNDKmS_Xt457TEM4W3Qyu-1Xm7PqBJeG5MYsVzajUcSxkw3Q@mail.gmail.com>
Subject: Re: [UNIKRAFT PATCH v2 5/7] lib/ukblkdev: API refactoring: `uk_blkdev_queue_configure()`
To: Simon Kuenzer <simon.kuenzer@neclab.eu>
Cc: minios-devel@lists.xen.org
Content-Type: multipart/alternative; boundary="00000000000097950c05b7334bd2"

--00000000000097950c05b7334bd2
Content-Type: text/plain; charset="UTF-8"

Hi Simon,

Looks good to me.

Reviewed-by: Laurentiu Barbulescu <lrbarbulescu@gmail.com>

On Tue, Dec 22, 2020 at 5:38 PM Simon Kuenzer <simon.kuenzer@neclab.eu>
wrote:

> For API consistency reasons, this patch renames `uk_blkdev_queue_setup()`
> to
> `uk_blkdev_queue_configure()`. This is done to be inline with
> lib/uknetdev. Additionally and as counterpart for queue configuration, we
> rename `uk_blkdev_release()` to `uk_blkdev_unconfigure()`.
>
> Signed-off-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
> ---
>  lib/ukblkdev/blkdev.c                 | 16 ++++++++--------
>  lib/ukblkdev/exportsyms.uk            |  2 +-
>  lib/ukblkdev/include/uk/blkdev.h      | 10 +++++-----
>  lib/ukblkdev/include/uk/blkdev_core.h |  6 +++---
>  plat/drivers/virtio/virtio_blk.c      |  4 ++--
>  plat/xen/drivers/blk/blkfront.c       |  4 ++--
>  6 files changed, 21 insertions(+), 21 deletions(-)
>
> diff --git a/lib/ukblkdev/blkdev.c b/lib/ukblkdev/blkdev.c
> index fc5038ba2..9cafa0c42 100644
> --- a/lib/ukblkdev/blkdev.c
> +++ b/lib/ukblkdev/blkdev.c
> @@ -82,7 +82,7 @@ int uk_blkdev_drv_register(struct uk_blkdev *dev, struct
> uk_alloc *a,
>         UK_ASSERT(dev->dev_ops);
>         UK_ASSERT(dev->dev_ops->dev_configure);
>         UK_ASSERT(dev->dev_ops->dev_start);
> -       UK_ASSERT(dev->dev_ops->queue_setup);
> +       UK_ASSERT(dev->dev_ops->queue_configure);
>         UK_ASSERT(dev->dev_ops->get_info);
>         UK_ASSERT(dev->dev_ops->queue_get_info);
>         UK_ASSERT(dev->submit_one);
> @@ -313,7 +313,7 @@ int uk_blkdev_queue_configure(struct uk_blkdev *dev,
> uint16_t queue_id,
>         UK_ASSERT(dev);
>         UK_ASSERT(dev->_data);
>         UK_ASSERT(dev->dev_ops);
> -       UK_ASSERT(dev->dev_ops->queue_setup);
> +       UK_ASSERT(dev->dev_ops->queue_configure);
>         UK_ASSERT(dev->finish_reqs);
>         UK_ASSERT(queue_id < CONFIG_LIBUKBLKDEV_MAXNBQUEUES);
>         UK_ASSERT(queue_conf);
> @@ -339,7 +339,7 @@ int uk_blkdev_queue_configure(struct uk_blkdev *dev,
> uint16_t queue_id,
>         if (err)
>                 goto err_out;
>
> -       dev->_queue[queue_id] = dev->dev_ops->queue_setup(dev, queue_id,
> +       dev->_queue[queue_id] = dev->dev_ops->queue_configure(dev,
> queue_id,
>                         nb_desc,
>                         queue_conf);
>         if (PTRISERR(dev->_queue[queue_id])) {
> @@ -493,21 +493,21 @@ int uk_blkdev_stop(struct uk_blkdev *dev)
>         return rc;
>  }
>
> -int uk_blkdev_queue_release(struct uk_blkdev *dev, uint16_t queue_id)
> +int uk_blkdev_queue_unconfigure(struct uk_blkdev *dev, uint16_t queue_id)
>  {
>         int rc = 0;
>
>         UK_ASSERT(dev != NULL);
>         UK_ASSERT(dev->_data);
>         UK_ASSERT(dev->dev_ops);
> -       UK_ASSERT(dev->dev_ops->queue_release);
> +       UK_ASSERT(dev->dev_ops->queue_unconfigure);
>         UK_ASSERT(queue_id < CONFIG_LIBUKBLKDEV_MAXNBQUEUES);
>         UK_ASSERT(dev->_data->state == UK_BLKDEV_CONFIGURED);
>         UK_ASSERT(!PTRISERR(dev->_queue[queue_id]));
>
> -       rc = dev->dev_ops->queue_release(dev, dev->_queue[queue_id]);
> +       rc = dev->dev_ops->queue_unconfigure(dev, dev->_queue[queue_id]);
>         if (rc)
> -               uk_pr_err("Failed to release blkdev%"PRIu16"-q%"PRIu16":
> %d\n",
> +               uk_pr_err("Failed to unconfigure
> blkdev%"PRIu16"-q%"PRIu16": %d\n",
>                                 dev->_data->id, queue_id, rc);
>         else {
>  #if CONFIG_LIBUKBLKDEV_DISPATCHERTHREADS
> @@ -515,7 +515,7 @@ int uk_blkdev_queue_release(struct uk_blkdev *dev,
> uint16_t queue_id)
>                         _destroy_event_handler(
>
> &dev->_data->queue_handler[queue_id]);
>  #endif
> -               uk_pr_info("Released blkdev%"PRIu16"-q%"PRIu16"\n",
> +               uk_pr_info("Unconfigured blkdev%"PRIu16"-q%"PRIu16"\n",
>                                 dev->_data->id, queue_id);
>                 dev->_queue[queue_id] = NULL;
>         }
> diff --git a/lib/ukblkdev/exportsyms.uk b/lib/ukblkdev/exportsyms.uk
> index f3be6c51d..dd93e3940 100644
> --- a/lib/ukblkdev/exportsyms.uk
> +++ b/lib/ukblkdev/exportsyms.uk
> @@ -13,6 +13,6 @@ uk_blkdev_queue_submit_one
>  uk_blkdev_queue_finish_reqs
>  uk_blkdev_sync_io
>  uk_blkdev_stop
> -uk_blkdev_queue_release
> +uk_blkdev_queue_unconfigure
>  uk_blkdev_drv_unregister
>  uk_blkdev_unconfigure
> diff --git a/lib/ukblkdev/include/uk/blkdev.h
> b/lib/ukblkdev/include/uk/blkdev.h
> index abc228d9c..56b95c88c 100644
> --- a/lib/ukblkdev/include/uk/blkdev.h
> +++ b/lib/ukblkdev/include/uk/blkdev.h
> @@ -51,7 +51,7 @@
>   * The functions exported by the Unikraft BLK API to setup a device
>   * designated by its ID must be invoked in the following order:
>   *      - uk_blkdev_configure()
> - *      - uk_blkdev_queue_setup()
> + *      - uk_blkdev_queue_configure()
>   *      - uk_blkdev_start()
>   *
>   * There are 4 states in which a block device can be found:
> @@ -197,7 +197,7 @@ int uk_blkdev_queue_get_info(struct uk_blkdev *dev,
> uint16_t queue_id,
>   *     to retrieve limitations.
>   * @param queue_conf
>   *     The pointer to the configuration data to be used for the queue.
> - *     This can be shared across multiple queue setups.
> + *     This can be shared across multiple queue configurations.
>   * @return
>   *     - 0: Success, receive queue correctly set up.
>   *     - <0: Unable to allocate and set up the ring descriptors.
> @@ -496,12 +496,12 @@ int uk_blkdev_stop(struct uk_blkdev *dev);
>   * @param queue_id
>   *     The index of the queue to release.
>   *     The value must be in range [0, nb_queue -1] previously supplied
> - *     to uk_blkdev_configure()
> - *     @return
> + *     to uk_blkdev_queue_configure()
> + * @return
>   *     - 0: Success
>   *     - (<0): on error returned by driver
>   */
> -int uk_blkdev_queue_release(struct uk_blkdev *dev, uint16_t queue_id);
> +int uk_blkdev_queue_unconfigure(struct uk_blkdev *dev, uint16_t queue_id);
>
>  /**
>   * Close a stopped Unikraft block device.
> diff --git a/lib/ukblkdev/include/uk/blkdev_core.h
> b/lib/ukblkdev/include/uk/blkdev_core.h
> index 56632c7f5..11a642c40 100644
> --- a/lib/ukblkdev/include/uk/blkdev_core.h
> +++ b/lib/ukblkdev/include/uk/blkdev_core.h
> @@ -207,7 +207,7 @@ typedef int (*uk_blkdev_queue_finish_reqs_t)(struct
> uk_blkdev *dev,
>  typedef int (*uk_blkdev_stop_t)(struct uk_blkdev *dev);
>
>  /** Driver callback type to release a queue of an Unikraft block device.
> */
> -typedef int (*uk_blkdev_queue_release_t)(struct uk_blkdev *dev,
> +typedef int (*uk_blkdev_queue_unconfigure_t)(struct uk_blkdev *dev,
>                 struct uk_blkdev_queue *queue);
>
>  /** Driver callback type to unconfigure an Unikraft block device. */
> @@ -217,12 +217,12 @@ struct uk_blkdev_ops {
>         uk_blkdev_get_info_t                            get_info;
>         uk_blkdev_configure_t                           dev_configure;
>         uk_blkdev_queue_get_info_t                      queue_get_info;
> -       uk_blkdev_queue_configure_t                     queue_setup;
> +       uk_blkdev_queue_configure_t                     queue_configure;
>         uk_blkdev_start_t                               dev_start;
>         uk_blkdev_stop_t                                dev_stop;
>         uk_blkdev_queue_intr_enable_t                   queue_intr_enable;
>         uk_blkdev_queue_intr_disable_t                  queue_intr_disable;
> -       uk_blkdev_queue_release_t                       queue_release;
> +       uk_blkdev_queue_unconfigure_t                   queue_unconfigure;
>         uk_blkdev_unconfigure_t                         dev_unconfigure;
>  };
>
> diff --git a/plat/drivers/virtio/virtio_blk.c
> b/plat/drivers/virtio/virtio_blk.c
> index 262355b49..dac8eb389 100644
> --- a/plat/drivers/virtio/virtio_blk.c
> +++ b/plat/drivers/virtio/virtio_blk.c
> @@ -861,12 +861,12 @@ static const struct uk_blkdev_ops virtio_blkdev_ops
> = {
>                 .get_info = virtio_blkdev_get_info,
>                 .dev_configure = virtio_blkdev_configure,
>                 .queue_get_info = virtio_blkdev_queue_info_get,
> -               .queue_setup = virtio_blkdev_queue_setup,
> +               .queue_configure = virtio_blkdev_queue_setup,
>                 .queue_intr_enable = virtio_blkdev_queue_intr_enable,
>                 .dev_start = virtio_blkdev_start,
>                 .dev_stop = virtio_blkdev_stop,
>                 .queue_intr_disable = virtio_blkdev_queue_intr_disable,
> -               .queue_release = virtio_blkdev_queue_release,
> +               .queue_unconfigure = virtio_blkdev_queue_release,
>                 .dev_unconfigure = virtio_blkdev_unconfigure,
>  };
>
> diff --git a/plat/xen/drivers/blk/blkfront.c
> b/plat/xen/drivers/blk/blkfront.c
> index 60b634665..a41373409 100644
> --- a/plat/xen/drivers/blk/blkfront.c
> +++ b/plat/xen/drivers/blk/blkfront.c
> @@ -891,8 +891,8 @@ static const struct uk_blkdev_ops blkfront_ops = {
>         .get_info = blkfront_get_info,
>         .dev_configure = blkfront_configure,
>         .queue_get_info = blkfront_queue_get_info,
> -       .queue_setup = blkfront_queue_setup,
> -       .queue_release = blkfront_queue_release,
> +       .queue_configure = blkfront_queue_setup,
> +       .queue_unconfigure = blkfront_queue_release,
>         .dev_start = blkfront_start,
>         .dev_stop = blkfront_stop,
>         .dev_unconfigure = blkfront_unconfigure,
> --
> 2.20.1
>

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

<div dir=3D"ltr">Hi Simon,<br><br>Looks good to me.<br><br>Reviewed-by: Lau=
rentiu Barbulescu &lt;<a href=3D"mailto:lrbarbulescu@gmail.com">lrbarbulesc=
u@gmail.com</a>&gt;<br></div><br><div class=3D"gmail_quote"><div dir=3D"ltr=
" class=3D"gmail_attr">On Tue, Dec 22, 2020 at 5:38 PM Simon Kuenzer &lt;<a=
 href=3D"mailto:simon.kuenzer@neclab.eu">simon.kuenzer@neclab.eu</a>&gt; wr=
ote:<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">For API con=
sistency reasons, this patch renames `uk_blkdev_queue_setup()` to<br>
`uk_blkdev_queue_configure()`. This is done to be inline with<br>
lib/uknetdev. Additionally and as counterpart for queue configuration, we<b=
r>
rename `uk_blkdev_release()` to `uk_blkdev_unconfigure()`.<br>
<br>
Signed-off-by: Simon Kuenzer &lt;<a href=3D"mailto:simon.kuenzer@neclab.eu"=
 target=3D"_blank">simon.kuenzer@neclab.eu</a>&gt;<br>
---<br>
=C2=A0lib/ukblkdev/blkdev.c=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0=
 =C2=A0 =C2=A0| 16 ++++++++--------<br>
=C2=A0lib/ukblkdev/<a href=3D"http://exportsyms.uk" rel=3D"noreferrer" targ=
et=3D"_blank">exportsyms.uk</a>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 |=
=C2=A0 2 +-<br>
=C2=A0lib/ukblkdev/include/uk/blkdev.h=C2=A0 =C2=A0 =C2=A0 | 10 +++++-----<=
br>
=C2=A0lib/ukblkdev/include/uk/blkdev_core.h |=C2=A0 6 +++---<br>
=C2=A0plat/drivers/virtio/virtio_blk.c=C2=A0 =C2=A0 =C2=A0 |=C2=A0 4 ++--<b=
r>
=C2=A0plat/xen/drivers/blk/blkfront.c=C2=A0 =C2=A0 =C2=A0 =C2=A0|=C2=A0 4 +=
+--<br>
=C2=A06 files changed, 21 insertions(+), 21 deletions(-)<br>
<br>
diff --git a/lib/ukblkdev/blkdev.c b/lib/ukblkdev/blkdev.c<br>
index fc5038ba2..9cafa0c42 100644<br>
--- a/lib/ukblkdev/blkdev.c<br>
+++ b/lib/ukblkdev/blkdev.c<br>
@@ -82,7 +82,7 @@ int uk_blkdev_drv_register(struct uk_blkdev *dev, struct =
uk_alloc *a,<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 UK_ASSERT(dev-&gt;dev_ops);<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 UK_ASSERT(dev-&gt;dev_ops-&gt;dev_configure);<b=
r>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 UK_ASSERT(dev-&gt;dev_ops-&gt;dev_start);<br>
-=C2=A0 =C2=A0 =C2=A0 =C2=A0UK_ASSERT(dev-&gt;dev_ops-&gt;queue_setup);<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0UK_ASSERT(dev-&gt;dev_ops-&gt;queue_configure);=
<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 UK_ASSERT(dev-&gt;dev_ops-&gt;get_info);<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 UK_ASSERT(dev-&gt;dev_ops-&gt;queue_get_info);<=
br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 UK_ASSERT(dev-&gt;submit_one);<br>
@@ -313,7 +313,7 @@ int uk_blkdev_queue_configure(struct uk_blkdev *dev, ui=
nt16_t queue_id,<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 UK_ASSERT(dev);<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 UK_ASSERT(dev-&gt;_data);<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 UK_ASSERT(dev-&gt;dev_ops);<br>
-=C2=A0 =C2=A0 =C2=A0 =C2=A0UK_ASSERT(dev-&gt;dev_ops-&gt;queue_setup);<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0UK_ASSERT(dev-&gt;dev_ops-&gt;queue_configure);=
<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 UK_ASSERT(dev-&gt;finish_reqs);<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 UK_ASSERT(queue_id &lt; CONFIG_LIBUKBLKDEV_MAXN=
BQUEUES);<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 UK_ASSERT(queue_conf);<br>
@@ -339,7 +339,7 @@ int uk_blkdev_queue_configure(struct uk_blkdev *dev, ui=
nt16_t queue_id,<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 if (err)<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 goto err_out;<br>
<br>
-=C2=A0 =C2=A0 =C2=A0 =C2=A0dev-&gt;_queue[queue_id] =3D dev-&gt;dev_ops-&g=
t;queue_setup(dev, queue_id,<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0dev-&gt;_queue[queue_id] =3D dev-&gt;dev_ops-&g=
t;queue_configure(dev, queue_id,<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 nb_desc,<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 queue_conf);<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 if (PTRISERR(dev-&gt;_queue[queue_id])) {<br>
@@ -493,21 +493,21 @@ int uk_blkdev_stop(struct uk_blkdev *dev)<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 return rc;<br>
=C2=A0}<br>
<br>
-int uk_blkdev_queue_release(struct uk_blkdev *dev, uint16_t queue_id)<br>
+int uk_blkdev_queue_unconfigure(struct uk_blkdev *dev, uint16_t queue_id)<=
br>
=C2=A0{<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 int rc =3D 0;<br>
<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 UK_ASSERT(dev !=3D NULL);<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 UK_ASSERT(dev-&gt;_data);<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 UK_ASSERT(dev-&gt;dev_ops);<br>
-=C2=A0 =C2=A0 =C2=A0 =C2=A0UK_ASSERT(dev-&gt;dev_ops-&gt;queue_release);<b=
r>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0UK_ASSERT(dev-&gt;dev_ops-&gt;queue_unconfigure=
);<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 UK_ASSERT(queue_id &lt; CONFIG_LIBUKBLKDEV_MAXN=
BQUEUES);<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 UK_ASSERT(dev-&gt;_data-&gt;state =3D=3D UK_BLK=
DEV_CONFIGURED);<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 UK_ASSERT(!PTRISERR(dev-&gt;_queue[queue_id]));=
<br>
<br>
-=C2=A0 =C2=A0 =C2=A0 =C2=A0rc =3D dev-&gt;dev_ops-&gt;queue_release(dev, d=
ev-&gt;_queue[queue_id]);<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0rc =3D dev-&gt;dev_ops-&gt;queue_unconfigure(de=
v, dev-&gt;_queue[queue_id]);<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 if (rc)<br>
-=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0uk_pr_err(&quot;Fai=
led to release blkdev%&quot;PRIu16&quot;-q%&quot;PRIu16&quot;: %d\n&quot;,<=
br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0uk_pr_err(&quot;Fai=
led to unconfigure blkdev%&quot;PRIu16&quot;-q%&quot;PRIu16&quot;: %d\n&quo=
t;,<br>
=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 dev-&gt;_data-&gt;id, queue_id, rc);=
<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 else {<br>
=C2=A0#if CONFIG_LIBUKBLKDEV_DISPATCHERTHREADS<br>
@@ -515,7 +515,7 @@ int uk_blkdev_queue_release(struct uk_blkdev *dev, uint=
16_t queue_id)<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 _destroy_event_handler(<br>
=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 =C2=A0 =C2=A0 =C2=A0 &amp;dev=
-&gt;_data-&gt;queue_handler[queue_id]);<br>
=C2=A0#endif<br>
-=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0uk_pr_info(&quot;Re=
leased blkdev%&quot;PRIu16&quot;-q%&quot;PRIu16&quot;\n&quot;,<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0uk_pr_info(&quot;Un=
configured blkdev%&quot;PRIu16&quot;-q%&quot;PRIu16&quot;\n&quot;,<br>
=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 dev-&gt;_data-&gt;id, queue_id);<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 dev-&gt;_queue[queu=
e_id] =3D NULL;<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 }<br>
diff --git a/lib/ukblkdev/<a href=3D"http://exportsyms.uk" rel=3D"noreferre=
r" target=3D"_blank">exportsyms.uk</a> b/lib/ukblkdev/<a href=3D"http://exp=
ortsyms.uk" rel=3D"noreferrer" target=3D"_blank">exportsyms.uk</a><br>
index f3be6c51d..dd93e3940 100644<br>
--- a/lib/ukblkdev/<a href=3D"http://exportsyms.uk" rel=3D"noreferrer" targ=
et=3D"_blank">exportsyms.uk</a><br>
+++ b/lib/ukblkdev/<a href=3D"http://exportsyms.uk" rel=3D"noreferrer" targ=
et=3D"_blank">exportsyms.uk</a><br>
@@ -13,6 +13,6 @@ uk_blkdev_queue_submit_one<br>
=C2=A0uk_blkdev_queue_finish_reqs<br>
=C2=A0uk_blkdev_sync_io<br>
=C2=A0uk_blkdev_stop<br>
-uk_blkdev_queue_release<br>
+uk_blkdev_queue_unconfigure<br>
=C2=A0uk_blkdev_drv_unregister<br>
=C2=A0uk_blkdev_unconfigure<br>
diff --git a/lib/ukblkdev/include/uk/blkdev.h b/lib/ukblkdev/include/uk/blk=
dev.h<br>
index abc228d9c..56b95c88c 100644<br>
--- a/lib/ukblkdev/include/uk/blkdev.h<br>
+++ b/lib/ukblkdev/include/uk/blkdev.h<br>
@@ -51,7 +51,7 @@<br>
=C2=A0 * The functions exported by the Unikraft BLK API to setup a device<b=
r>
=C2=A0 * designated by its ID must be invoked in the following order:<br>
=C2=A0 *=C2=A0 =C2=A0 =C2=A0 - uk_blkdev_configure()<br>
- *=C2=A0 =C2=A0 =C2=A0 - uk_blkdev_queue_setup()<br>
+ *=C2=A0 =C2=A0 =C2=A0 - uk_blkdev_queue_configure()<br>
=C2=A0 *=C2=A0 =C2=A0 =C2=A0 - uk_blkdev_start()<br>
=C2=A0 *<br>
=C2=A0 * There are 4 states in which a block device can be found:<br>
@@ -197,7 +197,7 @@ int uk_blkdev_queue_get_info(struct uk_blkdev *dev, uin=
t16_t queue_id,<br>
=C2=A0 *=C2=A0 =C2=A0 =C2=A0to retrieve limitations.<br>
=C2=A0 * @param queue_conf<br>
=C2=A0 *=C2=A0 =C2=A0 =C2=A0The pointer to the configuration data to be use=
d for the queue.<br>
- *=C2=A0 =C2=A0 =C2=A0This can be shared across multiple queue setups.<br>
+ *=C2=A0 =C2=A0 =C2=A0This can be shared across multiple queue configurati=
ons.<br>
=C2=A0 * @return<br>
=C2=A0 *=C2=A0 =C2=A0 =C2=A0- 0: Success, receive queue correctly set up.<b=
r>
=C2=A0 *=C2=A0 =C2=A0 =C2=A0- &lt;0: Unable to allocate and set up the ring=
 descriptors.<br>
@@ -496,12 +496,12 @@ int uk_blkdev_stop(struct uk_blkdev *dev);<br>
=C2=A0 * @param queue_id<br>
=C2=A0 *=C2=A0 =C2=A0 =C2=A0The index of the queue to release.<br>
=C2=A0 *=C2=A0 =C2=A0 =C2=A0The value must be in range [0, nb_queue -1] pre=
viously supplied<br>
- *=C2=A0 =C2=A0 =C2=A0to uk_blkdev_configure()<br>
- *=C2=A0 =C2=A0 =C2=A0@return<br>
+ *=C2=A0 =C2=A0 =C2=A0to uk_blkdev_queue_configure()<br>
+ * @return<br>
=C2=A0 *=C2=A0 =C2=A0 =C2=A0- 0: Success<br>
=C2=A0 *=C2=A0 =C2=A0 =C2=A0- (&lt;0): on error returned by driver<br>
=C2=A0 */<br>
-int uk_blkdev_queue_release(struct uk_blkdev *dev, uint16_t queue_id);<br>
+int uk_blkdev_queue_unconfigure(struct uk_blkdev *dev, uint16_t queue_id);=
<br>
<br>
=C2=A0/**<br>
=C2=A0 * Close a stopped Unikraft block device.<br>
diff --git a/lib/ukblkdev/include/uk/blkdev_core.h b/lib/ukblkdev/include/u=
k/blkdev_core.h<br>
index 56632c7f5..11a642c40 100644<br>
--- a/lib/ukblkdev/include/uk/blkdev_core.h<br>
+++ b/lib/ukblkdev/include/uk/blkdev_core.h<br>
@@ -207,7 +207,7 @@ typedef int (*uk_blkdev_queue_finish_reqs_t)(struct uk_=
blkdev *dev,<br>
=C2=A0typedef int (*uk_blkdev_stop_t)(struct uk_blkdev *dev);<br>
<br>
=C2=A0/** Driver callback type to release a queue of an Unikraft block devi=
ce. */<br>
-typedef int (*uk_blkdev_queue_release_t)(struct uk_blkdev *dev,<br>
+typedef int (*uk_blkdev_queue_unconfigure_t)(struct uk_blkdev *dev,<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 struct uk_blkdev_qu=
eue *queue);<br>
<br>
=C2=A0/** Driver callback type to unconfigure an Unikraft block device. */<=
br>
@@ -217,12 +217,12 @@ struct uk_blkdev_ops {<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 uk_blkdev_get_info_t=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 get_=
info;<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 uk_blkdev_configure_t=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=A0de=
v_configure;<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 uk_blkdev_queue_get_info_t=C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 queue_get_info;<br>
-=C2=A0 =C2=A0 =C2=A0 =C2=A0uk_blkdev_queue_configure_t=C2=A0 =C2=A0 =C2=A0=
 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0queue_setup;<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0uk_blkdev_queue_configure_t=C2=A0 =C2=A0 =C2=A0=
 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0queue_configure;<br=
>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 uk_blkdev_start_t=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=A0dev_start;<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 uk_blkdev_stop_t=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 dev_stop;<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 uk_blkdev_queue_intr_enable_t=C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0queue_intr_enable;<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 uk_blkdev_queue_intr_disable_t=C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 queue_intr_disable;<br>
-=C2=A0 =C2=A0 =C2=A0 =C2=A0uk_blkdev_queue_release_t=C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0queue_release=
;<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0uk_blkdev_queue_unconfigure_t=C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0queue_unconfigure;<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 uk_blkdev_unconfigure_t=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=A0dev_uncon=
figure;<br>
=C2=A0};<br>
<br>
diff --git a/plat/drivers/virtio/virtio_blk.c b/plat/drivers/virtio/virtio_=
blk.c<br>
index 262355b49..dac8eb389 100644<br>
--- a/plat/drivers/virtio/virtio_blk.c<br>
+++ b/plat/drivers/virtio/virtio_blk.c<br>
@@ -861,12 +861,12 @@ static const struct uk_blkdev_ops virtio_blkdev_ops =
=3D {<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 .get_info =3D virti=
o_blkdev_get_info,<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 .dev_configure =3D =
virtio_blkdev_configure,<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 .queue_get_info =3D=
 virtio_blkdev_queue_info_get,<br>
-=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0.queue_setup =3D vi=
rtio_blkdev_queue_setup,<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0.queue_configure =
=3D virtio_blkdev_queue_setup,<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 .queue_intr_enable =
=3D virtio_blkdev_queue_intr_enable,<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 .dev_start =3D virt=
io_blkdev_start,<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 .dev_stop =3D virti=
o_blkdev_stop,<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 .queue_intr_disable=
 =3D virtio_blkdev_queue_intr_disable,<br>
-=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0.queue_release =3D =
virtio_blkdev_queue_release,<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0.queue_unconfigure =
=3D virtio_blkdev_queue_release,<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 .dev_unconfigure =
=3D virtio_blkdev_unconfigure,<br>
=C2=A0};<br>
<br>
diff --git a/plat/xen/drivers/blk/blkfront.c b/plat/xen/drivers/blk/blkfron=
t.c<br>
index 60b634665..a41373409 100644<br>
--- a/plat/xen/drivers/blk/blkfront.c<br>
+++ b/plat/xen/drivers/blk/blkfront.c<br>
@@ -891,8 +891,8 @@ static const struct uk_blkdev_ops blkfront_ops =3D {<br=
>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 .get_info =3D blkfront_get_info,<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 .dev_configure =3D blkfront_configure,<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 .queue_get_info =3D blkfront_queue_get_info,<br=
>
-=C2=A0 =C2=A0 =C2=A0 =C2=A0.queue_setup =3D blkfront_queue_setup,<br>
-=C2=A0 =C2=A0 =C2=A0 =C2=A0.queue_release =3D blkfront_queue_release,<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0.queue_configure =3D blkfront_queue_setup,<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0.queue_unconfigure =3D blkfront_queue_release,<=
br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 .dev_start =3D blkfront_start,<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 .dev_stop =3D blkfront_stop,<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 .dev_unconfigure =3D blkfront_unconfigure,<br>
-- <br>
2.20.1<br>
</blockquote></div>

--00000000000097950c05b7334bd2--


From minios-devel-bounces@lists.xenproject.org Thu Dec 24 10:30:42 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Thu, 24 Dec 2020 10:30:42 +0000
Received: from list by lists.xenproject.org with outflank-mailman.58684.103368 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1ksNtK-0003qX-7O; Thu, 24 Dec 2020 10:30:42 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 58684.103368; Thu, 24 Dec 2020 10:30: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 1ksNtK-0003qQ-4K; Thu, 24 Dec 2020 10:30:42 +0000
Received: by outflank-mailman (input) for mailman id 58684;
 Thu, 24 Dec 2020 10:30: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=HK/e=F4=gmail.com=lrbarbulescu@srs-us1.protection.inumbo.net>)
 id 1ksNtJ-0003qH-2W
 for minios-devel@lists.xen.org; Thu, 24 Dec 2020 10:30:41 +0000
Received: from mail-lf1-x12c.google.com (unknown [2a00:1450:4864:20::12c])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 4806f4bf-d814-4910-aec6-920759a2750d;
 Thu, 24 Dec 2020 10:30:40 +0000 (UTC)
Received: by mail-lf1-x12c.google.com with SMTP id o19so3889494lfo.1
 for <minios-devel@lists.xen.org>; Thu, 24 Dec 2020 02:30:40 -0800 (PST)
X-BeenThere: minios-devel@lists.xenproject.org
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
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: 4806f4bf-d814-4910-aec6-920759a2750d
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=IUSt/qmIPZoIN7DrWgwGfktPS/WG1yvrjq06px0s3Yw=;
        b=OHPtRUR8z51rvBQct48qMQGB5POLjB7ydn0KgWtDTCBC0vhN5XmlvinwbC7Gl5y/i1
         NjUWiRPSy34mfHqjUU1gUHhBngEUJV4Jmfx0x+Ni1OJpFvU/FcpU9XMr0xzOY0yivx6m
         74fZ4Ll6L2inv8+Vg3tOcfVlrXu4/SFwYTZBLf+4w9Ypydwm1JSpQsSwYOcl8Z7RH/5b
         wH/827/3n2KfkYUjuTvHNpDK/qUm6yeksVXxn25qqT5XiHTvSdeFWO3dRjMIsSQcVST/
         nPmE1diW9GeFmpIpy/xh4DUa4kFIWAeH0jNZ5GUXsTgEseN6WQXUN0kb+p0sOrr6Sp0n
         Wzrw==
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=IUSt/qmIPZoIN7DrWgwGfktPS/WG1yvrjq06px0s3Yw=;
        b=ACn8rxwlt13v2XWgiHWOXIehrPFErV5t5iULh1MvgUxuSkDhyLXaECOBKybSzfgrC8
         G+kfG0SkXRyq0pybbUgW/tQI4MGrW9ojT8tJt6P5Xk5EvrFake+aZMIFftoKOEnxwrE8
         2X/TI3Xi75lVKwHyNBrqxKuNg32RkPsJncTizT/Cp+8pmUrcR1rerzDjrNfmDnwUWCyG
         0mI+hiW/Z3lkxBXCjmjibDeUwdIQ2YUIkg85QZh6L+AN+cr7U3KKDGkn56aQtCcfhdw0
         B7f2idz0d/EQpa6xj1Yg80Ja9a9Ak2PkqPhaV+N1ID9d+gNbcXj0N2xfL3gz7Ciidcvq
         VXCw==
X-Gm-Message-State: AOAM530owJe6v1vu0cKWmEEFl33jSitWPJ+bisU6ieL0y8ynmtJ6A8WE
	rEjfRSgj1XDXlAms7KwpwkI8bNu2jxpRcxNM2Tg=
X-Google-Smtp-Source: ABdhPJzqoXN79bvTi1cY7WrlNa34snd+t8BXHAd189Q21aloS0P/0L79OmIpyzxBYice4KoEskfF4PAg34Si1ocf03w=
X-Received: by 2002:a05:6512:304c:: with SMTP id b12mr11752267lfb.273.1608805839246;
 Thu, 24 Dec 2020 02:30:39 -0800 (PST)
MIME-Version: 1.0
References: <20201222153758.1731-1-simon.kuenzer@neclab.eu> <20201222153758.1731-7-simon.kuenzer@neclab.eu>
In-Reply-To: <20201222153758.1731-7-simon.kuenzer@neclab.eu>
From: Laurentiu Barbulescu <lrbarbulescu@gmail.com>
Date: Thu, 24 Dec 2020 12:30:28 +0200
Message-ID: <CAMpNDK=3SNAw_wrW3184SU4dW8=iCC2bx24gvLeQwRiJaXmwFQ@mail.gmail.com>
Subject: Re: [UNIKRAFT PATCH v2 6/7] lib/ukblkdev: Provide `uk_blkdev_size()`
To: Simon Kuenzer <simon.kuenzer@neclab.eu>
Cc: minios-devel@lists.xen.org
Content-Type: multipart/alternative; boundary="0000000000008fab6805b7334c09"

--0000000000008fab6805b7334c09
Content-Type: text/plain; charset="UTF-8"

Hi Simon,

Looks good to me.

Reviewed-by: Laurentiu Barbulescu <lrbarbulescu@gmail.com>

On Tue, Dec 22, 2020 at 5:38 PM Simon Kuenzer <simon.kuenzer@neclab.eu>
wrote:

> This commits provides a shortcut macro for retrieving the block device
> size in
> number of bytes.
>
> Signed-off-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
> ---
>  lib/ukblkdev/include/uk/blkdev.h | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/lib/ukblkdev/include/uk/blkdev.h
> b/lib/ukblkdev/include/uk/blkdev.h
> index 56b95c88c..1861bb3b7 100644
> --- a/lib/ukblkdev/include/uk/blkdev.h
> +++ b/lib/ukblkdev/include/uk/blkdev.h
> @@ -255,6 +255,9 @@ static inline const struct uk_blkdev_cap
> *uk_blkdev_capabilities(
>  #define uk_blkdev_sectors(blkdev) \
>         (uk_blkdev_capabilities(blkdev)->sectors)
>
> +#define uk_blkdev_size(blkdev) \
> +       ((size_t) uk_blkdev_sectors(blkdev) * uk_blkdev_ssize(blkdev))
> +
>  #define uk_blkdev_ioalign(blkdev) \
>         (uk_blkdev_capabilities(blkdev)->ioalign)
>  /**
> --
> 2.20.1
>

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

<div dir=3D"ltr">Hi Simon,<br><br>Looks good to me.<br><br>Reviewed-by: Lau=
rentiu Barbulescu &lt;<a href=3D"mailto:lrbarbulescu@gmail.com">lrbarbulesc=
u@gmail.com</a>&gt;<br></div><br><div class=3D"gmail_quote"><div dir=3D"ltr=
" class=3D"gmail_attr">On Tue, Dec 22, 2020 at 5:38 PM Simon Kuenzer &lt;<a=
 href=3D"mailto:simon.kuenzer@neclab.eu">simon.kuenzer@neclab.eu</a>&gt; wr=
ote:<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">This commit=
s provides a shortcut macro for retrieving the block device size in<br>
number of bytes.<br>
<br>
Signed-off-by: Simon Kuenzer &lt;<a href=3D"mailto:simon.kuenzer@neclab.eu"=
 target=3D"_blank">simon.kuenzer@neclab.eu</a>&gt;<br>
---<br>
=C2=A0lib/ukblkdev/include/uk/blkdev.h | 3 +++<br>
=C2=A01 file changed, 3 insertions(+)<br>
<br>
diff --git a/lib/ukblkdev/include/uk/blkdev.h b/lib/ukblkdev/include/uk/blk=
dev.h<br>
index 56b95c88c..1861bb3b7 100644<br>
--- a/lib/ukblkdev/include/uk/blkdev.h<br>
+++ b/lib/ukblkdev/include/uk/blkdev.h<br>
@@ -255,6 +255,9 @@ static inline const struct uk_blkdev_cap *uk_blkdev_cap=
abilities(<br>
=C2=A0#define uk_blkdev_sectors(blkdev) \<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 (uk_blkdev_capabilities(blkdev)-&gt;sectors)<br=
>
<br>
+#define uk_blkdev_size(blkdev) \<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0((size_t) uk_blkdev_sectors(blkdev) * uk_blkdev=
_ssize(blkdev))<br>
+<br>
=C2=A0#define uk_blkdev_ioalign(blkdev) \<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 (uk_blkdev_capabilities(blkdev)-&gt;ioalign)<br=
>
=C2=A0/**<br>
-- <br>
2.20.1<br>
</blockquote></div>

--0000000000008fab6805b7334c09--


From minios-devel-bounces@lists.xenproject.org Thu Dec 24 10:30:54 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Thu, 24 Dec 2020 10:30:54 +0000
Received: from list by lists.xenproject.org with outflank-mailman.58685.103372 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1ksNtW-0003sB-Aj; Thu, 24 Dec 2020 10:30:54 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 58685.103372; Thu, 24 Dec 2020 10:30: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 1ksNtW-0003s4-7N; Thu, 24 Dec 2020 10:30:54 +0000
Received: by outflank-mailman (input) for mailman id 58685;
 Thu, 24 Dec 2020 10:30: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=HK/e=F4=gmail.com=lrbarbulescu@srs-us1.protection.inumbo.net>)
 id 1ksNtV-0003rz-NE
 for minios-devel@lists.xen.org; Thu, 24 Dec 2020 10:30:53 +0000
Received: from mail-lf1-x131.google.com (unknown [2a00:1450:4864:20::131])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id afc4247a-b6f2-41eb-87ec-4ee02c80cfe9;
 Thu, 24 Dec 2020 10:30:52 +0000 (UTC)
Received: by mail-lf1-x131.google.com with SMTP id m12so3827727lfo.7
 for <minios-devel@lists.xen.org>; Thu, 24 Dec 2020 02:30:52 -0800 (PST)
X-BeenThere: minios-devel@lists.xenproject.org
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
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: afc4247a-b6f2-41eb-87ec-4ee02c80cfe9
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=5/8JD7ubxRpknij/ztys05b851eFBAwlJUoPNvKzW3E=;
        b=BvVSjNFbCGUUkcvgp1PAem8TZqfqaPZM84WzdRR0omL0DnxaV0KtzpRlrT868U5W1g
         9ZpoYN4Y0XVCyvgp/dpX+UGZhzMwqNqlHAUkEVOPyBtXLHd6MWBB2iKpUfO63Gl90nyW
         ER9a2Qo20Zt+6HqVG8FBoRWa1K7vRTuV81CS4r50JC3uymU6nFalys7559yQyeXqDkRs
         VScrJ0gVLN146+Qn8zZngDq4hjnNSVQq5jrIworjLjmzJpvWrWwJ0E9GCmFgUSQfkP1S
         NnWdTy+qDmvWAzGBQ2n0CYXQCgRGvQvP+l0QoEwlF3W27J/LYY+RYMH9LeAAEt2Nni6B
         xzgw==
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=5/8JD7ubxRpknij/ztys05b851eFBAwlJUoPNvKzW3E=;
        b=WAAP6+B30x3HEUmuiPwasqJjn/A7hPjyjcikurqFcXA2/4RUxFP7TxeU6+4ahbm205
         fEqf7UZsFBYlfttJEogzw64H6KuhALFboTygk7wv6Aj2palDxTsfy7H0uLj/KwdH81IL
         J/NtPkt994RL6XcMUF3zp5+9L2OW4zE0MM+EGujDBdm/hN0PEL4US/fHAziUOTmeh8rA
         EG0qfQ7Sr+CQJg6o7VQEHotVkFKnl5TK8JotiiISiDT+MnBnL0LhxEZchjVt6CMEI4vP
         Q/vErwGobNVrvuZy0QvKQPnRDW4JtEXVicKhCeybEWHdbK11ueOgj2gg/cRW7z1P0zKo
         KonQ==
X-Gm-Message-State: AOAM533w/IrX/DBOqMp3wTQ1F6zk6pH1tPA8YtD3P5IBw6hUDjndwG/1
	aWC+MFJWHfnJDSt3BRswichVbFB/XXgKjLgc82068ODS6GnkKM9B
X-Google-Smtp-Source: ABdhPJwfRAzVJ9Gz2s/iYqUb0k1FZQk7b6km4I+cF6Ptb61x6jH+bfgNB2vz42LyiMmQJUpqC4FztiludrPqZZOLka0=
X-Received: by 2002:a19:600d:: with SMTP id u13mr11545172lfb.312.1608805851934;
 Thu, 24 Dec 2020 02:30:51 -0800 (PST)
MIME-Version: 1.0
References: <20201222153758.1731-1-simon.kuenzer@neclab.eu> <20201222153758.1731-8-simon.kuenzer@neclab.eu>
In-Reply-To: <20201222153758.1731-8-simon.kuenzer@neclab.eu>
From: Laurentiu Barbulescu <lrbarbulescu@gmail.com>
Date: Thu, 24 Dec 2020 12:30:41 +0200
Message-ID: <CAMpNDKn4k-Duh7JwmJuof5BRohyVAJu2YwJrhVQLzYNNq9b32A@mail.gmail.com>
Subject: Re: [UNIKRAFT PATCH v2 7/7] lib/ukblkdev: blkdev.h: Description about interrupts
To: Simon Kuenzer <simon.kuenzer@neclab.eu>
Cc: minios-devel@lists.xen.org
Content-Type: multipart/alternative; boundary="0000000000005134cc05b7334d83"

--0000000000005134cc05b7334d83
Content-Type: text/plain; charset="UTF-8"

Hi Simon,

Looks good to me.

Reviewed-by: Laurentiu Barbulescu <lrbarbulescu@gmail.com>

On Tue, Dec 22, 2020 at 5:38 PM Simon Kuenzer <simon.kuenzer@neclab.eu>
wrote:

> Signed-off-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
> ---
>  lib/ukblkdev/include/uk/blkdev.h | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/lib/ukblkdev/include/uk/blkdev.h
> b/lib/ukblkdev/include/uk/blkdev.h
> index 1861bb3b7..3e42eb98a 100644
> --- a/lib/ukblkdev/include/uk/blkdev.h
> +++ b/lib/ukblkdev/include/uk/blkdev.h
> @@ -413,7 +413,8 @@ int uk_blkdev_queue_submit_one(struct uk_blkdev *dev,
> uint16_t queue_id,
>                                              | UK_BLKDEV_STATUS_MORE))
>
>  /**
> - * Get responses from the queue
> + * Get responses from the queue and re-enable interrupts on the target
> queue
> + * when they were enabled before.
>   *
>   * @param dev
>   *     The Unikraft Block Device
> --
> 2.20.1
>

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

<div dir=3D"ltr">Hi Simon,<br><br>Looks good to me.<br><br>Reviewed-by: Lau=
rentiu Barbulescu &lt;<a href=3D"mailto:lrbarbulescu@gmail.com">lrbarbulesc=
u@gmail.com</a>&gt;<br></div><br><div class=3D"gmail_quote"><div dir=3D"ltr=
" class=3D"gmail_attr">On Tue, Dec 22, 2020 at 5:38 PM Simon Kuenzer &lt;<a=
 href=3D"mailto:simon.kuenzer@neclab.eu">simon.kuenzer@neclab.eu</a>&gt; wr=
ote:<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">Signed-off-=
by: Simon Kuenzer &lt;<a href=3D"mailto:simon.kuenzer@neclab.eu" target=3D"=
_blank">simon.kuenzer@neclab.eu</a>&gt;<br>
---<br>
=C2=A0lib/ukblkdev/include/uk/blkdev.h | 3 ++-<br>
=C2=A01 file changed, 2 insertions(+), 1 deletion(-)<br>
<br>
diff --git a/lib/ukblkdev/include/uk/blkdev.h b/lib/ukblkdev/include/uk/blk=
dev.h<br>
index 1861bb3b7..3e42eb98a 100644<br>
--- a/lib/ukblkdev/include/uk/blkdev.h<br>
+++ b/lib/ukblkdev/include/uk/blkdev.h<br>
@@ -413,7 +413,8 @@ int uk_blkdev_queue_submit_one(struct uk_blkdev *dev, u=
int16_t queue_id,<br>
=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 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0| UK_BLKDEV_STATUS_MORE))<br>
<br>
=C2=A0/**<br>
- * Get responses from the queue<br>
+ * Get responses from the queue and re-enable interrupts on the target que=
ue<br>
+ * when they were enabled before.<br>
=C2=A0 *<br>
=C2=A0 * @param dev<br>
=C2=A0 *=C2=A0 =C2=A0 =C2=A0The Unikraft Block Device<br>
-- <br>
2.20.1<br>
</blockquote></div>

--0000000000005134cc05b7334d83--


From minios-devel-bounces@lists.xenproject.org Sun Dec 27 00:45:27 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Sun, 27 Dec 2020 00:45:27 +0000
Received: from list by lists.xenproject.org with outflank-mailman.59103.103980 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1ktKBX-0000Mk-IF; Sun, 27 Dec 2020 00:45:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 59103.103980; Sun, 27 Dec 2020 00:45: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 1ktKBX-0000MV-D4; Sun, 27 Dec 2020 00:45:23 +0000
Received: by outflank-mailman (input) for mailman id 59103;
 Sun, 27 Dec 2020 00:45: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=v3jD=F7=upb.ro=vlad_andrei.badoiu@srs-us1.protection.inumbo.net>)
 id 1ktKBW-0000MB-2W
 for minios-devel@lists.xen.org; Sun, 27 Dec 2020 00:45:22 +0000
Received: from mx.upb.ro (unknown [141.85.13.220])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 1b581b27-1484-4447-948d-86849cc3c41a;
 Sun, 27 Dec 2020 00:45:17 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
 by mx.upb.ro (Postfix) with ESMTP id 819D7B561DC6;
 Sun, 27 Dec 2020 02:45:16 +0200 (EET)
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 ib-fSFmVpDZ6; Sun, 27 Dec 2020 02:45:13 +0200 (EET)
Received: from localhost (localhost [127.0.0.1])
 by mx.upb.ro (Postfix) with ESMTP id A5300B561DB0;
 Sun, 27 Dec 2020 02:45:13 +0200 (EET)
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 Se4rL8hyl2O7; Sun, 27 Dec 2020 02:45:13 +0200 (EET)
Received: from localhost.localdomain (5-14-39-185.residential.rdsnet.ro
 [5.14.39.185]) by mx.upb.ro (Postfix) with ESMTPSA id 2982DB560057;
 Sun, 27 Dec 2020 02:45:13 +0200 (EET)
X-BeenThere: minios-devel@lists.xenproject.org
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
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: 1b581b27-1484-4447-948d-86849cc3c41a
DKIM-Filter: OpenDKIM Filter v2.10.3 mx.upb.ro A5300B561DB0
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=upb.ro;
	s=96342B8A-77E4-11E5-BA93-D93D0963A2DF; t=1609029913;
	bh=ekm0heLgmqd/Zd8Z3vmxo+mPoFQGkfjXrgWPQyxdH28=;
	h=From:To:Date:Message-Id:MIME-Version;
	b=f/Q10fHDm9YesS2wm2pljQuLmohfz5uV4tALBDENey1KrGx3TO2m0r0dOF0bhDFEA
	 S7CrxMKOUpLRRmSw1AlZ5kpYbthyJuZu1p/sQkzUhg+reIXDUHMVJ6oR5qKYS9QeqV
	 eMU95vvLTLMfxJq9hXHCARHu8Y6gqNmbkkhOudZA=
X-Virus-Scanned: amavisd-new at upb.ro
From: Vlad-Andrei Badoiu <vlad_andrei.badoiu@upb.ro>
To: minios-devel@lists.xen.org
Cc: razvan.deaconescu@cs.pub.ro,
	simon.kuenzer@neclab.eu,
	Vlad-Andrei Badoiu <vlad_andrei.badoiu@upb.ro>
Subject: [UNIKRAFT PATCH v3 0/3] Add clang support
Date: Sun, 27 Dec 2020 02:45:03 +0200
Message-Id: <20201227004506.16035-1-vlad_andrei.badoiu@upb.ro>
X-Mailer: git-send-email 2.27.0
MIME-Version: 1.0
Content-Transfer-Encoding: quoted-printable

We add support for clang on Unikraft. This is an
adapted series of the previous series of patches
by Alice Suiu.

Changes since v1:
- Add missing check for lto
- Fixed typo in have_gcc

Changes since v2:
- Removed the filter out
- Added a more flexible approach to select the COMPILER,
  now we can use .config, environment variable, and
  command line
- Rebased on staging

Vlad-Andrei Badoiu (3):
  build: Option to configure the compiler
  support/build: Add build functions for clang and gcc check
  build: Add support for clang

 Makefile                     | 14 ++++++++++++--
 Makefile.uk                  | 15 +++++++++++----
 arch/x86/x86_64/Makefile.uk  |  9 ++++++---
 support/build/Makefile.rules | 12 +++++++++++-
 4 files changed, 40 insertions(+), 10 deletions(-)

--=20
2.27.0



From minios-devel-bounces@lists.xenproject.org Sun Dec 27 00:45:27 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Sun, 27 Dec 2020 00:45:27 +0000
Received: from list by lists.xenproject.org with outflank-mailman.59102.103975 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1ktKBX-0000MR-FS; Sun, 27 Dec 2020 00:45:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 59102.103975; Sun, 27 Dec 2020 00:45: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 1ktKBX-0000MK-BX; Sun, 27 Dec 2020 00:45:23 +0000
Received: by outflank-mailman (input) for mailman id 59102;
 Sun, 27 Dec 2020 00:45: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=v3jD=F7=upb.ro=vlad_andrei.badoiu@srs-us1.protection.inumbo.net>)
 id 1ktKBV-0000MA-F9
 for minios-devel@lists.xen.org; Sun, 27 Dec 2020 00:45:22 +0000
Received: from mx.upb.ro (unknown [141.85.13.210])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id c7badae2-2f4f-4acc-81be-14efb6540216;
 Sun, 27 Dec 2020 00:45:17 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
 by mx.upb.ro (Postfix) with ESMTP id BB338B561DB0;
 Sun, 27 Dec 2020 02:45:16 +0200 (EET)
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 BFh4AeCNClre; Sun, 27 Dec 2020 02:45:15 +0200 (EET)
Received: from localhost (localhost [127.0.0.1])
 by mx.upb.ro (Postfix) with ESMTP id D6281B561DB8;
 Sun, 27 Dec 2020 02:45:14 +0200 (EET)
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 ZyWimIBLKpiB; Sun, 27 Dec 2020 02:45:14 +0200 (EET)
Received: from localhost.localdomain (5-14-39-185.residential.rdsnet.ro
 [5.14.39.185]) by mx.upb.ro (Postfix) with ESMTPSA id 3C96FB561DB6;
 Sun, 27 Dec 2020 02:45:14 +0200 (EET)
X-BeenThere: minios-devel@lists.xenproject.org
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
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: c7badae2-2f4f-4acc-81be-14efb6540216
DKIM-Filter: OpenDKIM Filter v2.10.3 mx.upb.ro D6281B561DB8
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=upb.ro;
	s=96342B8A-77E4-11E5-BA93-D93D0963A2DF; t=1609029914;
	bh=5M6YaJcU6AnCL+iZtLe4CYtLS1CmY2whNC8XbFYBtrA=;
	h=From:To:Date:Message-Id:MIME-Version;
	b=VFnlf8329a0ke6xNzVuZfL1P03Z/RG9e5ddDH53SxZqtZv0N7SCsMguAaK9gDT8af
	 bW857tFkFf2qrncpVBmbkf94xS1R6B0Dv8iQ7clvIyTxJtgmHHdDc1HDFDVvGPC/wM
	 4mdDlIFvWt7Mxkg4tJBiwFdnrOqLTBI3X+JGawqc=
X-Virus-Scanned: amavisd-new at upb.ro
From: Vlad-Andrei Badoiu <vlad_andrei.badoiu@upb.ro>
To: minios-devel@lists.xen.org
Cc: razvan.deaconescu@cs.pub.ro,
	simon.kuenzer@neclab.eu,
	Vlad-Andrei Badoiu <vlad_andrei.badoiu@upb.ro>,
	Alice Suiu <alicesuiu17@gmail.com>
Subject: [UNIKRAFT PATCH v3 2/3] support/build: Add build functions for clang and gcc check
Date: Sun, 27 Dec 2020 02:45:05 +0200
Message-Id: <20201227004506.16035-3-vlad_andrei.badoiu@upb.ro>
X-Mailer: git-send-email 2.27.0
In-Reply-To: <20201227004506.16035-1-vlad_andrei.badoiu@upb.ro>
References: <20201227004506.16035-1-vlad_andrei.badoiu@upb.ro>
MIME-Version: 1.0
Content-Transfer-Encoding: quoted-printable

We add have_gcc and have_clang. We modify gcc_version_ge to
use have_gcc.

Signed-off-by: Alice Suiu <alicesuiu17@gmail.com>
Signed-off-by: Vlad-Andrei Badoiu <vlad_andrei.badoiu@upb.ro>
---
 support/build/Makefile.rules | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/support/build/Makefile.rules b/support/build/Makefile.rules
index 2a8a294..c201bc4 100644
--- a/support/build/Makefile.rules
+++ b/support/build/Makefile.rules
@@ -29,10 +29,20 @@ lc =3D $(subst A,a,$(subst B,b,$(subst C,c,$(subst D,=
d,$(subst E,e,$(subst F,f,$(s
 # upper case
 uc =3D $(subst a,A,$(subst b,B,$(subst c,C,$(subst d,D,$(subst e,E,$(sub=
st f,F,$(subst g,G,$(subst h,H,$(subst i,I,$(subst j,J,$(subst k,K,$(subs=
t l,L,$(subst m,M,$(subst n,N,$(subst o,O,$(subst p,P,$(subst q,Q,$(subst=
 r,R,$(subst s,S,$(subst t,T,$(subst u,U,$(subst v,V,$(subst w,W,$(subst =
x,X,$(subst y,Y,$(subst z,Z,$(1)))))))))))))))))))))))))))
=20
+# test if GCC is set as a compiler
+define have_gcc =3D
+$(shell if [ $(CC) =3D gcc ] ; then echo y ; else echo n ; fi)
+endef
+
+# test if CLANG is set as a compiler
+define have_clang =3D
+$(shell if [ $(CC) =3D clang ] ; then echo y ; else echo n ; fi)
+endef
+
 # test whether GCC version is greater than or equal to the minimum requi=
rement
 # gcc_version_ge $gcc_major,$gcc_minor
 define gcc_version_ge =3D
-$(shell if [ $(CC_VER_MAJOR) -gt $(1) ] || ([ $(CC_VER_MAJOR) -eq $(1) ]=
 && [ $(CC_VER_MINOR) -ge $(2) ]) ; then echo y ; fi)
+$(shell if [ $(call have_gcc) =3D y ] ; then if [ $(CC_VER_MAJOR) -gt $(=
1) ] || ([ $(CC_VER_MAJOR) -eq $(1) ] && [ $(CC_VER_MINOR) -ge $(2) ]) ; =
then echo y ; fi ; else echo n ; fi)
 endef
=20
 # print error and stop build when GCC version doesn't meet the minimum r=
equirement
--=20
2.27.0



From minios-devel-bounces@lists.xenproject.org Sun Dec 27 00:45:27 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Sun, 27 Dec 2020 00:45:27 +0000
Received: from list by lists.xenproject.org with outflank-mailman.59104.103984 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1ktKBb-0000Nb-ID; Sun, 27 Dec 2020 00:45:27 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 59104.103984; Sun, 27 Dec 2020 00:45:27 +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 1ktKBb-0000NU-F0; Sun, 27 Dec 2020 00:45:27 +0000
Received: by outflank-mailman (input) for mailman id 59104;
 Sun, 27 Dec 2020 00:45:26 +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=v3jD=F7=upb.ro=vlad_andrei.badoiu@srs-us1.protection.inumbo.net>)
 id 1ktKBa-0000MA-9d
 for minios-devel@lists.xen.org; Sun, 27 Dec 2020 00:45:26 +0000
Received: from mx.upb.ro (unknown [141.85.13.220])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 691bfc81-9998-4a15-aac9-b25a599c0b85;
 Sun, 27 Dec 2020 00:45:18 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
 by mx.upb.ro (Postfix) with ESMTP id DD0CDB560057;
 Sun, 27 Dec 2020 02:45:17 +0200 (EET)
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 Tusg2s3tswlk; Sun, 27 Dec 2020 02:45:15 +0200 (EET)
Received: from localhost (localhost [127.0.0.1])
 by mx.upb.ro (Postfix) with ESMTP id 7F0A1B561DB6;
 Sun, 27 Dec 2020 02:45:15 +0200 (EET)
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 yq8-InDDQuBL; Sun, 27 Dec 2020 02:45:15 +0200 (EET)
Received: from localhost.localdomain (5-14-39-185.residential.rdsnet.ro
 [5.14.39.185]) by mx.upb.ro (Postfix) with ESMTPSA id D5A6AB561DAD;
 Sun, 27 Dec 2020 02:45:14 +0200 (EET)
X-BeenThere: minios-devel@lists.xenproject.org
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
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: 691bfc81-9998-4a15-aac9-b25a599c0b85
DKIM-Filter: OpenDKIM Filter v2.10.3 mx.upb.ro 7F0A1B561DB6
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=upb.ro;
	s=96342B8A-77E4-11E5-BA93-D93D0963A2DF; t=1609029915;
	bh=ApWNG8j4meIg7p/VpisSr/2Gou8LV+rDgjXLrNNvmRY=;
	h=From:To:Date:Message-Id:MIME-Version;
	b=BqkEAUwLHubLCZbrMuit2+/erl0ctRL1rPiQyNNj13X16pNWHOz/pSjMWOmb8SAnZ
	 MoKInR2yl7lOJVWXvDDmYc9VL4X4elOqG5asXKibMAv/BerDiWUe9dIikN/MCg5Ut9
	 WmDZTCl6kzHj1yeii0tKKP2TrUChhNHbYiCNzUzQ=
X-Virus-Scanned: amavisd-new at upb.ro
From: Vlad-Andrei Badoiu <vlad_andrei.badoiu@upb.ro>
To: minios-devel@lists.xen.org
Cc: razvan.deaconescu@cs.pub.ro,
	simon.kuenzer@neclab.eu,
	Vlad-Andrei Badoiu <vlad_andrei.badoiu@upb.ro>,
	Alice Suiu <alicesuiu17@gmail.com>
Subject: [UNIKRAFT PATCH v3 3/3] build: Add support for clang
Date: Sun, 27 Dec 2020 02:45:06 +0200
Message-Id: <20201227004506.16035-4-vlad_andrei.badoiu@upb.ro>
X-Mailer: git-send-email 2.27.0
In-Reply-To: <20201227004506.16035-1-vlad_andrei.badoiu@upb.ro>
References: <20201227004506.16035-1-vlad_andrei.badoiu@upb.ro>
MIME-Version: 1.0
Content-Transfer-Encoding: quoted-printable

We condition the gcc specific flags via have_gcc and the
clang specific flags with have_clang.

Signed-off-by: Alice Suiu <alicesuiu17@gmail.com>
Signed-off-by: Vlad-Andrei Badoiu <vlad_andrei.badoiu@upb.ro>
---
 Makefile                    |  2 ++
 Makefile.uk                 | 15 +++++++++++----
 arch/x86/x86_64/Makefile.uk |  9 ++++++---
 3 files changed, 19 insertions(+), 7 deletions(-)

diff --git a/Makefile b/Makefile
index ce3392a..b5aa987 100644
--- a/Makefile
+++ b/Makefile
@@ -643,10 +643,12 @@ $(error You did not select a library that handles b=
ootstrapping! (e.g., ukboot))
 endif
=20
 ifeq ($(CONFIG_OPTIMIZE_LTO), y)
+ifeq ($(call have_gcc),y)
 ifneq ($(call gcc_version_ge,6,1),y)
 $(error Your gcc version does not support incremental link time optimisa=
tion)
 endif
 endif
+endif
=20
 # Generate build rules
 $(eval $(call verbose_include,$(CONFIG_UK_BASE)/support/build/Makefile.b=
uild))
diff --git a/Makefile.uk b/Makefile.uk
index e505c04..a012967 100644
--- a/Makefile.uk
+++ b/Makefile.uk
@@ -4,9 +4,11 @@
 #
 ########################################################################=
########
=20
-COMPFLAGS    +=3D -nostdinc -nostdlib
+COMPFLAGS    +=3D -nostdlib
 COMPFLAGS    +=3D -U __linux__ -U __FreeBSD__ -U __sun__
-COMPFLAGS    +=3D -fno-omit-frame-pointer -fno-tree-sra -fno-split-stack
+COMPFLAGS    +=3D -fno-omit-frame-pointer
+COMPFLAGS-$(call have_gcc)	+=3D -fno-tree-sra -fno-split-stack -nostdinc
+
 ifneq ($(HAVE_STACKPROTECTOR),y)
 COMPFLAGS    +=3D -fno-stack-protector
 endif
@@ -19,12 +21,14 @@ CINCLUDES    +=3D -I$(CONFIG_UK_BASE)/include
 CXXINCLUDES  +=3D -I$(CONFIG_UK_BASE)/include
 GOCINCLUDES  +=3D -I$(CONFIG_UK_BASE)/include
=20
-LIBLDFLAGS  +=3D -nostdinc -nostdlib -Wl,-r -Wl,-d -Wl,--build-id=3Dnone=
 -no-pie
+LIBLDFLAGS  +=3D -nostdlib -Wl,-r -Wl,-d -Wl,--build-id=3Dnone -no-pie
+LIBLDFLAGS-$(call have_gcc)	+=3D -nostdinc
=20
 # 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.
-LDFLAGS     +=3D -nostdinc -nostdlib -Wl,--omagic -Wl,--build-id=3Dnone
+LDFLAGS	+=3D -nostdlib -Wl,--omagic -Wl,--build-id=3Dnone
+LDFLAGS-$(call have_gcc)	+=3D -nostdinc
=20
 COMPFLAGS-$(CONFIG_OPTIMIZE_NONE)         +=3D -O0 -fno-optimize-sibling=
-calls -fno-tree-vectorize
 COMPFLAGS-$(CONFIG_OPTIMIZE_SIZE)         +=3D -Os
@@ -56,3 +60,6 @@ M4FLAGS      +=3D -DUK_VERSION=3D$(UK_VERSION).$(UK_SUB=
VERSION)
 # "--enable-default-pie" by default.
 COMPFLAGS-$(call gcc_version_ge,6,1)	+=3D -fno-PIC
 LDFLAGS-$(call gcc_version_ge,6,1)	+=3D -no-pie
+
+COMPFLAGS-$(call have_clang)	+=3D-fno-builtin -fno-PIC
+LDFLAGS-$(call have_clang)	+=3D -no-pie
diff --git a/arch/x86/x86_64/Makefile.uk b/arch/x86/x86_64/Makefile.uk
index 24919fb..7af494d 100644
--- a/arch/x86/x86_64/Makefile.uk
+++ b/arch/x86/x86_64/Makefile.uk
@@ -1,7 +1,9 @@
 ARCHFLAGS     +=3D -D__X86_64__
-ARCHFLAGS     +=3D -m64 -mno-red-zone -fno-reorder-blocks -fno-asynchron=
ous-unwind-tables
+ARCHFLAGS     +=3D -m64 -mno-red-zone -fno-asynchronous-unwind-tables
+ARCHFLAGS-$(call have_gcc)	+=3D -fno-reorder-blocks
 ISR_ARCHFLAGS +=3D -D__X86_64__
-ISR_ARCHFLAGS +=3D -m64 -mno-red-zone -fno-reorder-blocks -fno-asynchron=
ous-unwind-tables
+ISR_ARCHFLAGS +=3D -m64 -mno-red-zone -fno-asynchronous-unwind-tables
+ISR_ARCHFLAGS-$(call have_gcc)	+=3D -fno-reorder-blocks =20
=20
 CINCLUDES   +=3D -I$(CONFIG_UK_BASE)/arch/x86/x86_64/include
 ASINCLUDES  +=3D -I$(CONFIG_UK_BASE)/arch/x86/x86_64/include
@@ -9,7 +11,8 @@ CXXINCLUDES +=3D -I$(CONFIG_UK_BASE)/arch/x86/x86_64/inc=
lude
=20
 # compiler flags to prevent use of extended (FP, SSE, AVX) registers.
 # This is for files that contain trap/exception/interrupt handlers
-ISR_ARCHFLAGS +=3D -mno-80387 -mno-fp-ret-in-387 -mno-mmx -mno-sse -mno-=
avx
+ISR_ARCHFLAGS +=3D -mno-80387 -mno-mmx -mno-sse -mno-avx
+ISR_ARCHFLAGS-$(call have_gcc)	+=3D -mno-fp-ret-in-387
 ISR_ARCHFLAGS-$(call gcc_version_ge,7,1) +=3D -mgeneral-regs-only
=20
 ARCHFLAGS-$(CONFIG_MARCH_X86_64_GENERIC)        +=3D -mtune=3Dgeneric
--=20
2.27.0



From minios-devel-bounces@lists.xenproject.org Sun Dec 27 00:45:28 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Sun, 27 Dec 2020 00:45:28 +0000
Received: from list by lists.xenproject.org with outflank-mailman.59105.103987 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1ktKBc-0000OH-JF; Sun, 27 Dec 2020 00:45:28 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 59105.103987; Sun, 27 Dec 2020 00:45: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 1ktKBc-0000O9-GU; Sun, 27 Dec 2020 00:45:28 +0000
Received: by outflank-mailman (input) for mailman id 59105;
 Sun, 27 Dec 2020 00:45:27 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=v3jD=F7=upb.ro=vlad_andrei.badoiu@srs-us1.protection.inumbo.net>)
 id 1ktKBa-0000MB-Vv
 for minios-devel@lists.xen.org; Sun, 27 Dec 2020 00:45:27 +0000
Received: from mx.upb.ro (unknown [141.85.13.200])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id c8b0d99b-414d-4624-bc89-1fa3febc746e;
 Sun, 27 Dec 2020 00:45:18 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
 by mx.upb.ro (Postfix) with ESMTP id 781B7B561DAD;
 Sun, 27 Dec 2020 02:45:16 +0200 (EET)
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 QH7T6_lMjpQo; Sun, 27 Dec 2020 02:45:14 +0200 (EET)
Received: from localhost (localhost [127.0.0.1])
 by mx.upb.ro (Postfix) with ESMTP id 3C819B560057;
 Sun, 27 Dec 2020 02:45:14 +0200 (EET)
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 XesRQgZP7_nl; Sun, 27 Dec 2020 02:45:14 +0200 (EET)
Received: from localhost.localdomain (5-14-39-185.residential.rdsnet.ro
 [5.14.39.185]) by mx.upb.ro (Postfix) with ESMTPSA id 9C52AB561DAD;
 Sun, 27 Dec 2020 02:45:13 +0200 (EET)
X-BeenThere: minios-devel@lists.xenproject.org
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
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: c8b0d99b-414d-4624-bc89-1fa3febc746e
DKIM-Filter: OpenDKIM Filter v2.10.3 mx.upb.ro 3C819B560057
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=upb.ro;
	s=96342B8A-77E4-11E5-BA93-D93D0963A2DF; t=1609029914;
	bh=yvuG39X8ZUNhiKlzvoVi6IW+hmNQlbUtedvZjOE9rk4=;
	h=From:To:Date:Message-Id:MIME-Version;
	b=K1u3kfDl6SzNzykGxdMXzW3Wuf7Kft96FsD4DNbrSam8CVzYlwIeqpfPXMwFWMPyD
	 XkB0p5fkxL5G5AaUUxxK5c0eTTevahc6gUy5JD+CRwk3FLUH7Zqll9bJyf/BYtXTFk
	 jggLxmdXlEEa531BONUEEpHXGVeVbqJybEC4Vm14=
X-Virus-Scanned: amavisd-new at upb.ro
From: Vlad-Andrei Badoiu <vlad_andrei.badoiu@upb.ro>
To: minios-devel@lists.xen.org
Cc: razvan.deaconescu@cs.pub.ro,
	simon.kuenzer@neclab.eu,
	Vlad-Andrei Badoiu <vlad_andrei.badoiu@upb.ro>,
	Alice Suiu <alicesuiu17@gmail.com>
Subject: [UNIKRAFT PATCH v3 1/3] build: Option to configure the compiler
Date: Sun, 27 Dec 2020 02:45:04 +0200
Message-Id: <20201227004506.16035-2-vlad_andrei.badoiu@upb.ro>
X-Mailer: git-send-email 2.27.0
In-Reply-To: <20201227004506.16035-1-vlad_andrei.badoiu@upb.ro>
References: <20201227004506.16035-1-vlad_andrei.badoiu@upb.ro>
MIME-Version: 1.0
Content-Transfer-Encoding: quoted-printable

By default, the compiler is GCC. Use COMPILER to set the compiler. For
example, COMPILER=3Dclang.

Signed-off-by: Alice Suiu <alicesuiu17@gmail.com>
Signed-off-by: Vlad-Andrei Badoiu <vlad_andrei.badoiu@upb.ro>
---
 Makefile | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/Makefile b/Makefile
index 3196554..ce3392a 100644
--- a/Makefile
+++ b/Makefile
@@ -513,6 +513,7 @@ ifeq ($(sub_make_exec), 1)
 ifeq ($(UK_HAVE_DOT_CONFIG),y)
 # Hide troublesome environment variables from sub processes
 unexport CONFIG_CROSS_COMPILE
+unexport CONFIG_COMPILER
 #unexport CC
 #unexport LD
 #unexport AR
@@ -545,11 +546,18 @@ ifneq ("$(origin CROSS_COMPILE)","undefined")
 CONFIG_CROSS_COMPILE :=3D $(CROSS_COMPILE:"%"=3D%)
 endif
=20
+ifneq ("$(origin COMPILER)","undefined")
+	CONFIG_COMPILER :=3D $(COMPILER:"%"=3D%)
+else
+	CONFIG_COMPILER :=3D gcc
+endif
+
+
 $(eval $(call verbose_include,$(CONFIG_UK_BASE)/arch/$(UK_FAMILY)/Compil=
er.uk))
=20
 # Make variables (CC, etc...)
-LD		:=3D $(CONFIG_CROSS_COMPILE)gcc
-CC		:=3D $(CONFIG_CROSS_COMPILE)gcc
+LD		:=3D $(CONFIG_CROSS_COMPILE)$(CONFIG_COMPILER)
+CC		:=3D $(CONFIG_CROSS_COMPILE)$(CONFIG_COMPILER)
 CPP		:=3D $(CC)
 CXX		:=3D $(CPP)
 GOC		:=3D $(CONFIG_CROSS_COMPILE)gccgo-7
--=20
2.27.0



From minios-devel-bounces@lists.xenproject.org Sun Dec 27 00:50:18 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Sun, 27 Dec 2020 00:50:18 +0000
Received: from list by lists.xenproject.org with outflank-mailman.59110.103992 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1ktKGH-0001D8-UA; Sun, 27 Dec 2020 00:50:17 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 59110.103992; Sun, 27 Dec 2020 00:50: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 1ktKGH-0001D1-R4; Sun, 27 Dec 2020 00:50:17 +0000
Received: by outflank-mailman (input) for mailman id 59110;
 Sun, 27 Dec 2020 00:50: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=v3jD=F7=upb.ro=vlad_andrei.badoiu@srs-us1.protection.inumbo.net>)
 id 1ktKGH-0001Cw-0v
 for minios-devel@lists.xenproject.org; Sun, 27 Dec 2020 00:50:17 +0000
Received: from mx.upb.ro (unknown [141.85.13.210])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id d69f8ca2-9fea-40e5-8109-23e72155e6ce;
 Sun, 27 Dec 2020 00:50:15 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
 by mx.upb.ro (Postfix) with ESMTP id 79921B560057;
 Sun, 27 Dec 2020 02:50:14 +0200 (EET)
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 A78-Jyr1RXkP; Sun, 27 Dec 2020 02:50:12 +0200 (EET)
Received: from localhost (localhost [127.0.0.1])
 by mx.upb.ro (Postfix) with ESMTP id A2C86B561DAD;
 Sun, 27 Dec 2020 02:50:12 +0200 (EET)
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 FV2JVxnMm_kF; Sun, 27 Dec 2020 02:50:12 +0200 (EET)
Received: from mx.upb.ro (localhost [127.0.0.1])
 by mx.upb.ro (Postfix) with ESMTP id 87048B560057;
 Sun, 27 Dec 2020 02:50:12 +0200 (EET)
X-BeenThere: minios-devel@lists.xenproject.org
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
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: d69f8ca2-9fea-40e5-8109-23e72155e6ce
DKIM-Filter: OpenDKIM Filter v2.10.3 mx.upb.ro A2C86B561DAD
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=upb.ro;
	s=96342B8A-77E4-11E5-BA93-D93D0963A2DF; t=1609030212;
	bh=zjzwEL1Bxvhq06xZbsG7qIEcxJHSdecX/WcZk/ej4IU=;
	h=Date:From:To:Message-ID:MIME-Version;
	b=eBiJp5l5IMeGw/d0r0wxZAOYfVmgpPQDlgyT132hvu1cMx3jDlJqCyu5BZ4f9vPWX
	 xKzxtpICzfRAUKnVJpq8LKwUWcaIAO+yxkPww86c+bpMXl3ZSoz/5Mx7coFGTvqpfQ
	 /JCDStIRvM4Iy2nhrby9oMsvpLwTKaeljAgSrUg8=
X-Virus-Scanned: amavisd-new at upb.ro
Date: Sun, 27 Dec 2020 02:50:12 +0200 (EET)
From: Vlad-Andrei =?utf-8?Q?B=C4=82DOIU?= <vlad_andrei.badoiu@upb.ro>
To: Hugo Lefeuvre <hle@owl.eu.com>
Cc: minios-devel@lists.xenproject.org, 
	Hugo Lefeuvre <hugo.lefeuvre@manchester.ac.uk>
Message-ID: <1831113520.149559.1609030212491.JavaMail.zimbra@upb.ro>
In-Reply-To: <1182d57a53379472c50d722db53de281b99cafcb.1608801609.git.hugo.lefeuvre@manchester.ac.uk>
References: <1182d57a53379472c50d722db53de281b99cafcb.1608801609.git.hugo.lefeuvre@manchester.ac.uk>
Subject: Re: [UNIKRAFT PATCH] lib/posix-user: add more symbols to
 exportsyms.uk
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit
X-Mailer: Zimbra 8.8.12_GA_3794 (ZimbraWebClient - FF84 (Linux)/8.8.12_GA_3794)
Thread-Topic: lib/posix-user: add more symbols to exportsyms.uk
Thread-Index: s3l6oNxZafs/XSxwXk5pixuiYL0m1Q==

Hi Hugo,
This patch works all right. Thank you!

Reviewed-by: Vlad-Andrei Badoiu <vlad_andrei.badoiu@upb.ro>

----- Original Message -----
From: "Hugo Lefeuvre" <hle@owl.eu.com>
To: minios-devel@lists.xenproject.org
Cc: "Hugo Lefeuvre" <hle@owl.eu.com>, "Hugo Lefeuvre" <hugo.lefeuvre@manchester.ac.uk>
Sent: Thursday, December 24, 2020 11:22:42 AM
Subject: [UNIKRAFT PATCH] lib/posix-user: add more symbols to exportsyms.uk

These symbols were not previously exported. Without these exports,
users get linking errors.

Signed-off-by: Hugo Lefeuvre <hugo.lefeuvre@manchester.ac.uk>
---
 lib/posix-user/exportsyms.uk | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/lib/posix-user/exportsyms.uk b/lib/posix-user/exportsyms.uk
index 2acde9dc..4dc8c198 100644
--- a/lib/posix-user/exportsyms.uk
+++ b/lib/posix-user/exportsyms.uk
@@ -1,6 +1,17 @@
 getpid
+getppid
+getlogin
+getpwnam
+geteuid
+getuid
+getpwuid
+getpwnam
+getgrnam
+setgid
+setuid
+issetugid
+initgroups
 uk_syscall_e_getpid
 uk_syscall_r_getpid
-getppid
 uk_syscall_e_getppid
 uk_syscall_r_getppid
-- 
2.20.1


From minios-devel-bounces@lists.xenproject.org Sun Dec 27 23:13:14 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Sun, 27 Dec 2020 23:13:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.59342.104208 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1ktfDq-0005ir-FY; Sun, 27 Dec 2020 23:13:10 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 59342.104208; Sun, 27 Dec 2020 23:13: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 1ktfDq-0005ik-CP; Sun, 27 Dec 2020 23:13:10 +0000
Received: by outflank-mailman (input) for mailman id 59342;
 Sun, 27 Dec 2020 23:13: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=v3jD=F7=upb.ro=vlad_andrei.badoiu@srs-us1.protection.inumbo.net>)
 id 1ktfDo-0005if-3C
 for minios-devel@lists.xenproject.org; Sun, 27 Dec 2020 23:13:08 +0000
Received: from mx.upb.ro (unknown [141.85.13.220])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 33da8e1e-4eb1-485c-af27-c1df97fa79f4;
 Sun, 27 Dec 2020 23:13:01 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
 by mx.upb.ro (Postfix) with ESMTP id 96DB4B56006A
 for <minios-devel@lists.xenproject.org>; Mon, 28 Dec 2020 01:13:00 +0200 (EET)
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 pgM1VQFBqiew; Mon, 28 Dec 2020 01:12:52 +0200 (EET)
Received: from localhost (localhost [127.0.0.1])
 by mx.upb.ro (Postfix) with ESMTP id BFFF8B56006F;
 Mon, 28 Dec 2020 01:12:52 +0200 (EET)
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 qkk0XwY6SAt5; Mon, 28 Dec 2020 01:12:52 +0200 (EET)
Received: from localhost.localdomain (unknown [194.34.132.58])
 by mx.upb.ro (Postfix) with ESMTPSA id F1D43B56006A;
 Mon, 28 Dec 2020 01:12:51 +0200 (EET)
X-BeenThere: minios-devel@lists.xenproject.org
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
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: 33da8e1e-4eb1-485c-af27-c1df97fa79f4
DKIM-Filter: OpenDKIM Filter v2.10.3 mx.upb.ro BFFF8B56006F
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=upb.ro;
	s=96342B8A-77E4-11E5-BA93-D93D0963A2DF; t=1609110772;
	bh=vXBQtAmeUEI++hT8E9JmEILLLbEw46R991FDDmS8vBY=;
	h=From:To:Date:Message-Id:MIME-Version;
	b=jbF0KIDuYrGgrcT/2tWYc7eqnSDjZoSuOvcJG5sFYIOU8C2YDLdNIiMkBMgC3KN1l
	 Kpp0lFEtAWyFYi6fl4J8iiWZDte+H/2PpysHBRF5UjxUccqPDg4Vg2MhnsEvXgy66t
	 R1TZfY7E8ajPe+RWTmqx2/u7Tt1Knl4mKd8XA17E=
X-Virus-Scanned: amavisd-new at upb.ro
From: Vlad-Andrei Badoiu <vlad_andrei.badoiu@upb.ro>
To: minios-devel@lists.xenproject.org
Cc: Vlad-Andrei Badoiu <vlad_andrei.badoiu@upb.ro>
Subject: [UNIKRAFT/NEWLIB PATCH 1/1] Import missing headers from musl
Date: Mon, 28 Dec 2020 01:12:46 +0200
Message-Id: <20201227231246.200810-1-vlad_andrei.badoiu@upb.ro>
X-Mailer: git-send-email 2.27.0
MIME-Version: 1.0
Content-Transfer-Encoding: quoted-printable

We add import the following header files from musl: mqueue.h,
obstack.h, scsi.h, mtio.h, personality.h, timex.h, vfs.h, utmp.h,
utmpx.h. They are used by the compiler-rt sanitizer.

Signed-off-by: Vlad-Andrei Badoiu <vlad_andrei.badoiu@upb.ro>
---
 musl-imported/include/mqueue.h          |  36 ++
 musl-imported/include/obstack.h         | 538 ++++++++++++++++++++++++
 musl-imported/include/scsi/scsi.h       | 150 +++++++
 musl-imported/include/sys/mtio.h        | 188 +++++++++
 musl-imported/include/sys/personality.h |  46 ++
 musl-imported/include/sys/timex.h       |  98 +++++
 musl-imported/include/sys/vfs.h         |   1 +
 musl-imported/include/utmp.h            |  52 +++
 musl-imported/include/utmpx.h           |  62 +++
 9 files changed, 1171 insertions(+)
 create mode 100644 musl-imported/include/mqueue.h
 create mode 100644 musl-imported/include/obstack.h
 create mode 100644 musl-imported/include/scsi/scsi.h
 create mode 100644 musl-imported/include/sys/mtio.h
 create mode 100644 musl-imported/include/sys/personality.h
 create mode 100644 musl-imported/include/sys/timex.h
 create mode 100644 musl-imported/include/sys/vfs.h
 create mode 100644 musl-imported/include/utmp.h
 create mode 100644 musl-imported/include/utmpx.h

diff --git a/musl-imported/include/mqueue.h b/musl-imported/include/mqueu=
e.h
new file mode 100644
index 0000000..ef4113c
--- /dev/null
+++ b/musl-imported/include/mqueue.h
@@ -0,0 +1,36 @@
+#ifndef _MQUEUE_H
+#define _MQUEUE_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+
+#define __NEED_size_t
+#define __NEED_ssize_t
+#define __NEED_pthread_attr_t
+#define __NEED_time_t
+#define __NEED_struct_timespec
+#include <bits/alltypes.h>
+
+typedef int mqd_t;
+struct mq_attr {
+	long mq_flags, mq_maxmsg, mq_msgsize, mq_curmsgs,_unused[4];
+};
+struct sigevent;
+
+int mq_close(mqd_t);
+int mq_getattr(mqd_t, struct mq_attr *);
+int mq_notify(mqd_t, const struct sigevent *);
+mqd_t mq_open(const char *, int, ...);
+ssize_t mq_receive(mqd_t, char *, size_t, unsigned *);
+int mq_send(mqd_t, const char *, size_t, unsigned);
+int mq_setattr(mqd_t, const struct mq_attr *__restrict, struct mq_attr *=
__restrict);
+ssize_t mq_timedreceive(mqd_t, char *__restrict, size_t, unsigned *__res=
trict, const struct timespec *__restrict);
+int mq_timedsend(mqd_t, const char *, size_t, unsigned, const struct tim=
espec *);
+int mq_unlink(const char *);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/musl-imported/include/obstack.h b/musl-imported/include/obst=
ack.h
new file mode 100644
index 0000000..a9cbc39
--- /dev/null
+++ b/musl-imported/include/obstack.h
@@ -0,0 +1,538 @@
+/* obstack.h - object stack macros
+   Copyright (C) 1988-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
+   <http://www.gnu.org/licenses/>.  */
+
+/* Summary:
+
+   All the apparent functions defined here are macros. The idea
+   is that you would use these pre-tested macros to solve a
+   very specific set of problems, and they would run fast.
+   Caution: no side-effects in arguments please!! They may be
+   evaluated MANY times!!
+
+   These macros operate a stack of objects.  Each object starts life
+   small, and may grow to maturity.  (Consider building a word syllable
+   by syllable.)  An object can move while it is growing.  Once it has
+   been "finished" it never changes address again.  So the "top of the
+   stack" is typically an immature growing object, while the rest of the
+   stack is of mature, fixed size and fixed address objects.
+
+   These routines grab large chunks of memory, using a function you
+   supply, called 'obstack_chunk_alloc'.  On occasion, they free chunks,
+   by calling 'obstack_chunk_free'.  You must define them and declare
+   them before using any obstack macros.
+
+   Each independent stack is represented by a 'struct obstack'.
+   Each of the obstack macros expects a pointer to such a structure
+   as the first argument.
+
+   One motivation for this package is the problem of growing char string=
s
+   in symbol tables.  Unless you are "fascist pig with a read-only mind"
+   --Gosper's immortal quote from HAKMEM item 154, out of context--you
+   would not like to put any arbitrary upper limit on the length of your
+   symbols.
+
+   In practice this often means you will build many short symbols and a
+   few long symbols.  At the time you are reading a symbol you don't kno=
w
+   how long it is.  One traditional method is to read a symbol into a
+   buffer, realloc()ating the buffer every time you try to read a symbol
+   that is longer than the buffer.  This is beaut, but you still will
+   want to copy the symbol from the buffer to a more permanent
+   symbol-table entry say about half the time.
+
+   With obstacks, you can work differently.  Use one obstack for all sym=
bol
+   names.  As you read a symbol, grow the name in the obstack gradually.
+   When the name is complete, finalize it.  Then, if the symbol exists a=
lready,
+   free the newly read name.
+
+   The way we do this is to take a large chunk, allocating memory from
+   low addresses.  When you want to build a symbol in the chunk you just
+   add chars above the current "high water mark" in the chunk.  When you
+   have finished adding chars, because you got to the end of the symbol,
+   you know how long the chars are, and you can create a new object.
+   Mostly the chars will not burst over the highest address of the chunk=
,
+   because you would typically expect a chunk to be (say) 100 times as
+   long as an average object.
+
+   In case that isn't clear, when we have enough chars to make up
+   the object, THEY ARE ALREADY CONTIGUOUS IN THE CHUNK (guaranteed)
+   so we just point to it where it lies.  No moving of chars is
+   needed and this is the second win: potentially long strings need
+   never be explicitly shuffled. Once an object is formed, it does not
+   change its address during its lifetime.
+
+   When the chars burst over a chunk boundary, we allocate a larger
+   chunk, and then copy the partly formed object from the end of the old
+   chunk to the beginning of the new larger chunk.  We then carry on
+   accreting characters to the end of the object as we normally would.
+
+   A special macro is provided to add a single char at a time to a
+   growing object.  This allows the use of register variables, which
+   break the ordinary 'growth' macro.
+
+   Summary:
+        We allocate large chunks.
+        We carve out one object at a time from the current chunk.
+        Once carved, an object never moves.
+        We are free to append data of any size to the currently
+          growing object.
+        Exactly one object is growing in an obstack at any one time.
+        You can run one obstack per control block.
+        You may have as many control blocks as you dare.
+        Because of the way we do it, you can "unwind" an obstack
+          back to a previous state. (You may remove objects much
+          as you would with a stack.)
+ */
+
+
+/* Don't do the contents of this file more than once.  */
+
+#ifndef _OBSTACK_H
+#define _OBSTACK_H 1
+
+#ifndef _OBSTACK_INTERFACE_VERSION
+# define _OBSTACK_INTERFACE_VERSION 2
+#endif
+
+#include <stddef.h>             /* For size_t and ptrdiff_t.  */
+#include <string.h>             /* For __GNU_LIBRARY__, and memcpy.  */
+
+#if _OBSTACK_INTERFACE_VERSION =3D=3D 1
+/* For binary compatibility with obstack version 1, which used "int"
+   and "long" for these two types.  */
+# define _OBSTACK_SIZE_T unsigned int
+# define _CHUNK_SIZE_T unsigned long
+# define _OBSTACK_CAST(type, expr) ((type) (expr))
+#else
+/* Version 2 with sane types, especially for 64-bit hosts.  */
+# define _OBSTACK_SIZE_T size_t
+# define _CHUNK_SIZE_T size_t
+# define _OBSTACK_CAST(type, expr) (expr)
+#endif
+
+/* If B is the base of an object addressed by P, return the result of
+   aligning P to the next multiple of A + 1.  B and P must be of type
+   char *.  A + 1 must be a power of 2.  */
+
+#define __BPTR_ALIGN(B, P, A) ((B) + (((P) - (B) + (A)) & ~(A)))
+
+/* Similar to __BPTR_ALIGN (B, P, A), except optimize the common case
+   where pointers can be converted to integers, aligned as integers,
+   and converted back again.  If ptrdiff_t is narrower than a
+   pointer (e.g., the AS/400), play it safe and compute the alignment
+   relative to B.  Otherwise, use the faster strategy of computing the
+   alignment relative to 0.  */
+
+#define __PTR_ALIGN(B, P, A)						      \
+  __BPTR_ALIGN (sizeof (ptrdiff_t) < sizeof (void *) ? (B) : (char *) 0,=
      \
+                P, A)
+
+#ifndef __attribute_pure__
+# if defined __GNUC_MINOR__ && __GNUC__ * 1000 + __GNUC_MINOR__ >=3D 209=
6
+#  define __attribute_pure__ __attribute__ ((__pure__))
+# else
+#  define __attribute_pure__
+# endif
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+struct _obstack_chunk           /* Lives at front of each chunk. */
+{
+  char *limit;                  /* 1 past end of this chunk */
+  struct _obstack_chunk *prev;  /* address of prior chunk or NULL */
+  char contents[4];             /* objects begin here */
+};
+
+struct obstack          /* control current object in current chunk */
+{
+  _CHUNK_SIZE_T chunk_size;     /* preferred size to allocate chunks in =
*/
+  struct _obstack_chunk *chunk; /* address of current struct obstack_chu=
nk */
+  char *object_base;            /* address of object we are building */
+  char *next_free;              /* where to add next char to current obj=
ect */
+  char *chunk_limit;            /* address of char after current chunk *=
/
+  union
+  {
+    _OBSTACK_SIZE_T i;
+    void *p;
+  } temp;                       /* Temporary for some macros.  */
+  _OBSTACK_SIZE_T alignment_mask;  /* Mask of alignment for each object.=
 */
+
+  /* These prototypes vary based on 'use_extra_arg'.  */
+  union
+  {
+    void *(*plain) (size_t);
+    void *(*extra) (void *, size_t);
+  } chunkfun;
+  union
+  {
+    void (*plain) (void *);
+    void (*extra) (void *, void *);
+  } freefun;
+
+  void *extra_arg;              /* first arg for chunk alloc/dealloc fun=
cs */
+  unsigned use_extra_arg : 1;     /* chunk alloc/dealloc funcs take extr=
a arg */
+  unsigned maybe_empty_object : 1; /* There is a possibility that the cu=
rrent
+                                      chunk contains a zero-length objec=
t.  This
+                                      prevents freeing the chunk if we a=
llocate
+                                      a bigger chunk to replace it. */
+  unsigned alloc_failed : 1;      /* No longer used, as we now call the =
failed
+                                     handler on error, but retained for =
binary
+                                     compatibility.  */
+};
+
+/* Declare the external functions we use; they are in obstack.c.  */
+
+extern void _obstack_newchunk (struct obstack *, _OBSTACK_SIZE_T);
+extern void _obstack_free (struct obstack *, void *);
+extern int _obstack_begin (struct obstack *,
+                           _OBSTACK_SIZE_T, _OBSTACK_SIZE_T,
+                           void *(*) (size_t), void (*) (void *));
+extern int _obstack_begin_1 (struct obstack *,
+                             _OBSTACK_SIZE_T, _OBSTACK_SIZE_T,
+                             void *(*) (void *, size_t),
+                             void (*) (void *, void *), void *);
+extern _OBSTACK_SIZE_T _obstack_memory_used (struct obstack *)
+  __attribute_pure__;
+
+/* Declare obstack_printf; it's in obstack_printf.c. */
+extern int obstack_printf(struct obstack *obstack, const char *__restric=
t fmt, ...);
+
+
+/* Error handler called when 'obstack_chunk_alloc' failed to allocate
+   more memory.  This can be set to a user defined function which
+   should either abort gracefully or use longjump - but shouldn't
+   return.  The default action is to print a message and abort.  */
+extern void (*obstack_alloc_failed_handler) (void);
+
+/* Exit value used when 'print_and_abort' is used.  */
+extern int obstack_exit_failure;
+
+/* Pointer to beginning of object being allocated or to be allocated nex=
t.
+   Note that this might not be the final address of the object
+   because a new chunk might be needed to hold the final size.  */
+
+#define obstack_base(h) ((void *) (h)->object_base)
+
+/* Size for allocating ordinary chunks.  */
+
+#define obstack_chunk_size(h) ((h)->chunk_size)
+
+/* Pointer to next byte not yet allocated in current chunk.  */
+
+#define obstack_next_free(h) ((void *) (h)->next_free)
+
+/* Mask specifying low bits that should be clear in address of an object=
.  */
+
+#define obstack_alignment_mask(h) ((h)->alignment_mask)
+
+/* To prevent prototype warnings provide complete argument list.  */
+#define obstack_init(h)							      \
+  _obstack_begin ((h), 0, 0,						      \
+                  _OBSTACK_CAST (void *(*) (size_t), obstack_chunk_alloc=
),    \
+                  _OBSTACK_CAST (void (*) (void *), obstack_chunk_free))
+
+#define obstack_begin(h, size)						      \
+  _obstack_begin ((h), (size), 0,					      \
+                  _OBSTACK_CAST (void *(*) (size_t), obstack_chunk_alloc=
), \
+                  _OBSTACK_CAST (void (*) (void *), obstack_chunk_free))
+
+#define obstack_specify_allocation(h, size, alignment, chunkfun, freefun=
)     \
+  _obstack_begin ((h), (size), (alignment),				      \
+                  _OBSTACK_CAST (void *(*) (size_t), chunkfun),		      \
+                  _OBSTACK_CAST (void (*) (void *), freefun))
+
+#define obstack_specify_allocation_with_arg(h, size, alignment, chunkfun=
, freefun, arg) \
+  _obstack_begin_1 ((h), (size), (alignment),				      \
+                    _OBSTACK_CAST (void *(*) (void *, size_t), chunkfun)=
,     \
+                    _OBSTACK_CAST (void (*) (void *, void *), freefun), =
arg)
+
+#define obstack_chunkfun(h, newchunkfun)				      \
+  ((void) ((h)->chunkfun.extra =3D (void *(*) (void *, size_t)) (newchun=
kfun)))
+
+#define obstack_freefun(h, newfreefun)					      \
+  ((void) ((h)->freefun.extra =3D (void *(*) (void *, void *)) (newfreef=
un)))
+
+#define obstack_1grow_fast(h, achar) ((void) (*((h)->next_free)++ =3D (a=
char)))
+
+#define obstack_blank_fast(h, n) ((void) ((h)->next_free +=3D (n)))
+
+#define obstack_memory_used(h) _obstack_memory_used (h)
+
+#if defined __GNUC__
+# if !defined __GNUC_MINOR__ || __GNUC__ * 1000 + __GNUC_MINOR__ < 2008
+#  define __extension__
+# endif
+
+/* For GNU C, if not -traditional,
+   we can define these macros to compute all args only once
+   without using a global variable.
+   Also, we can avoid using the 'temp' slot, to make faster code.  */
+
+# define obstack_object_size(OBSTACK)					      \
+  __extension__								      \
+    ({ struct obstack const *__o =3D (OBSTACK);				      \
+       (_OBSTACK_SIZE_T) (__o->next_free - __o->object_base); })
+
+/* The local variable is named __o1 to avoid a shadowed variable
+   warning when invoked from other obstack macros.  */
+# define obstack_room(OBSTACK)						      \
+  __extension__								      \
+    ({ struct obstack const *__o1 =3D (OBSTACK);				      \
+       (_OBSTACK_SIZE_T) (__o1->chunk_limit - __o1->next_free); })
+
+# define obstack_make_room(OBSTACK, length)				      \
+  __extension__								      \
+    ({ struct obstack *__o =3D (OBSTACK);					      \
+       _OBSTACK_SIZE_T __len =3D (length);				      \
+       if (obstack_room (__o) < __len)					      \
+         _obstack_newchunk (__o, __len);				      \
+       (void) 0; })
+
+# define obstack_empty_p(OBSTACK)					      \
+  __extension__								      \
+    ({ struct obstack const *__o =3D (OBSTACK);				      \
+       (__o->chunk->prev =3D=3D 0						      \
+        && __o->next_free =3D=3D __PTR_ALIGN ((char *) __o->chunk,		    =
  \
+                                          __o->chunk->contents,		      \
+                                          __o->alignment_mask)); })
+
+# define obstack_grow(OBSTACK, where, length)				      \
+  __extension__								      \
+    ({ struct obstack *__o =3D (OBSTACK);					      \
+       _OBSTACK_SIZE_T __len =3D (length);				      \
+       if (obstack_room (__o) < __len)					      \
+         _obstack_newchunk (__o, __len);				      \
+       memcpy (__o->next_free, where, __len);				      \
+       __o->next_free +=3D __len;						      \
+       (void) 0; })
+
+# define obstack_grow0(OBSTACK, where, length)				      \
+  __extension__								      \
+    ({ struct obstack *__o =3D (OBSTACK);					      \
+       _OBSTACK_SIZE_T __len =3D (length);				      \
+       if (obstack_room (__o) < __len + 1)				      \
+         _obstack_newchunk (__o, __len + 1);				      \
+       memcpy (__o->next_free, where, __len);				      \
+       __o->next_free +=3D __len;						      \
+       *(__o->next_free)++ =3D 0;						      \
+       (void) 0; })
+
+# define obstack_1grow(OBSTACK, datum)					      \
+  __extension__								      \
+    ({ struct obstack *__o =3D (OBSTACK);					      \
+       if (obstack_room (__o) < 1)					      \
+         _obstack_newchunk (__o, 1);					      \
+       obstack_1grow_fast (__o, datum); })
+
+/* These assume that the obstack alignment is good enough for pointers
+   or ints, and that the data added so far to the current object
+   shares that much alignment.  */
+
+# define obstack_ptr_grow(OBSTACK, datum)				      \
+  __extension__								      \
+    ({ struct obstack *__o =3D (OBSTACK);					      \
+       if (obstack_room (__o) < sizeof (void *))			      \
+         _obstack_newchunk (__o, sizeof (void *));			      \
+       obstack_ptr_grow_fast (__o, datum); })
+
+# define obstack_int_grow(OBSTACK, datum)				      \
+  __extension__								      \
+    ({ struct obstack *__o =3D (OBSTACK);					      \
+       if (obstack_room (__o) < sizeof (int))				      \
+         _obstack_newchunk (__o, sizeof (int));				      \
+       obstack_int_grow_fast (__o, datum); })
+
+# define obstack_ptr_grow_fast(OBSTACK, aptr)				      \
+  __extension__								      \
+    ({ struct obstack *__o1 =3D (OBSTACK);				      \
+       void *__p1 =3D __o1->next_free;					      \
+       *(const void **) __p1 =3D (aptr);					      \
+       __o1->next_free +=3D sizeof (const void *);			      \
+       (void) 0; })
+
+# define obstack_int_grow_fast(OBSTACK, aint)				      \
+  __extension__								      \
+    ({ struct obstack *__o1 =3D (OBSTACK);				      \
+       void *__p1 =3D __o1->next_free;					      \
+       *(int *) __p1 =3D (aint);						      \
+       __o1->next_free +=3D sizeof (int);					      \
+       (void) 0; })
+
+# define obstack_blank(OBSTACK, length)					      \
+  __extension__								      \
+    ({ struct obstack *__o =3D (OBSTACK);					      \
+       _OBSTACK_SIZE_T __len =3D (length);				      \
+       if (obstack_room (__o) < __len)					      \
+         _obstack_newchunk (__o, __len);				      \
+       obstack_blank_fast (__o, __len); })
+
+# define obstack_alloc(OBSTACK, length)					      \
+  __extension__								      \
+    ({ struct obstack *__h =3D (OBSTACK);					      \
+       obstack_blank (__h, (length));					      \
+       obstack_finish (__h); })
+
+# define obstack_copy(OBSTACK, where, length)				      \
+  __extension__								      \
+    ({ struct obstack *__h =3D (OBSTACK);					      \
+       obstack_grow (__h, (where), (length));				      \
+       obstack_finish (__h); })
+
+# define obstack_copy0(OBSTACK, where, length)				      \
+  __extension__								      \
+    ({ struct obstack *__h =3D (OBSTACK);					      \
+       obstack_grow0 (__h, (where), (length));				      \
+       obstack_finish (__h); })
+
+/* The local variable is named __o1 to avoid a shadowed variable
+   warning when invoked from other obstack macros, typically obstack_fre=
e.  */
+# define obstack_finish(OBSTACK)					      \
+  __extension__								      \
+    ({ struct obstack *__o1 =3D (OBSTACK);				      \
+       void *__value =3D (void *) __o1->object_base;			      \
+       if (__o1->next_free =3D=3D __value)					      \
+         __o1->maybe_empty_object =3D 1;					      \
+       __o1->next_free							      \
+         =3D __PTR_ALIGN (__o1->object_base, __o1->next_free,		      \
+                        __o1->alignment_mask);				      \
+       if ((size_t) (__o1->next_free - (char *) __o1->chunk)		      \
+           > (size_t) (__o1->chunk_limit - (char *) __o1->chunk))	      =
\
+         __o1->next_free =3D __o1->chunk_limit;				      \
+       __o1->object_base =3D __o1->next_free;				      \
+       __value; })
+
+# define obstack_free(OBSTACK, OBJ)					      \
+  __extension__								      \
+    ({ struct obstack *__o =3D (OBSTACK);					      \
+       void *__obj =3D (void *) (OBJ);					      \
+       if (__obj > (void *) __o->chunk && __obj < (void *) __o->chunk_li=
mit)  \
+         __o->next_free =3D __o->object_base =3D (char *) __obj;		      =
\
+       else								      \
+         _obstack_free (__o, __obj); })
+
+#else /* not __GNUC__ */
+
+# define obstack_object_size(h)						      \
+  ((_OBSTACK_SIZE_T) ((h)->next_free - (h)->object_base))
+
+# define obstack_room(h)						      \
+  ((_OBSTACK_SIZE_T) ((h)->chunk_limit - (h)->next_free))
+
+# define obstack_empty_p(h)						      \
+  ((h)->chunk->prev =3D=3D 0						      \
+   && (h)->next_free =3D=3D __PTR_ALIGN ((char *) (h)->chunk,		      \
+                                     (h)->chunk->contents,		      \
+                                     (h)->alignment_mask))
+
+/* Note that the call to _obstack_newchunk is enclosed in (..., 0)
+   so that we can avoid having void expressions
+   in the arms of the conditional expression.
+   Casting the third operand to void was tried before,
+   but some compilers won't accept it.  */
+
+# define obstack_make_room(h, length)					      \
+  ((h)->temp.i =3D (length),						      \
+   ((obstack_room (h) < (h)->temp.i)					      \
+    ? (_obstack_newchunk (h, (h)->temp.i), 0) : 0),			      \
+   (void) 0)
+
+# define obstack_grow(h, where, length)					      \
+  ((h)->temp.i =3D (length),						      \
+   ((obstack_room (h) < (h)->temp.i)					      \
+   ? (_obstack_newchunk ((h), (h)->temp.i), 0) : 0),			      \
+   memcpy ((h)->next_free, where, (h)->temp.i),				      \
+   (h)->next_free +=3D (h)->temp.i,					      \
+   (void) 0)
+
+# define obstack_grow0(h, where, length)				      \
+  ((h)->temp.i =3D (length),						      \
+   ((obstack_room (h) < (h)->temp.i + 1)				      \
+   ? (_obstack_newchunk ((h), (h)->temp.i + 1), 0) : 0),		      \
+   memcpy ((h)->next_free, where, (h)->temp.i),				      \
+   (h)->next_free +=3D (h)->temp.i,					      \
+   *((h)->next_free)++ =3D 0,						      \
+   (void) 0)
+
+# define obstack_1grow(h, datum)					      \
+  (((obstack_room (h) < 1)						      \
+    ? (_obstack_newchunk ((h), 1), 0) : 0),				      \
+   obstack_1grow_fast (h, datum))
+
+# define obstack_ptr_grow(h, datum)					      \
+  (((obstack_room (h) < sizeof (char *))				      \
+    ? (_obstack_newchunk ((h), sizeof (char *)), 0) : 0),		      \
+   obstack_ptr_grow_fast (h, datum))
+
+# define obstack_int_grow(h, datum)					      \
+  (((obstack_room (h) < sizeof (int))					      \
+    ? (_obstack_newchunk ((h), sizeof (int)), 0) : 0),			      \
+   obstack_int_grow_fast (h, datum))
+
+# define obstack_ptr_grow_fast(h, aptr)					      \
+  (((const void **) ((h)->next_free +=3D sizeof (void *)))[-1] =3D (aptr=
),	      \
+   (void) 0)
+
+# define obstack_int_grow_fast(h, aint)					      \
+  (((int *) ((h)->next_free +=3D sizeof (int)))[-1] =3D (aint),		      \
+   (void) 0)
+
+# define obstack_blank(h, length)					      \
+  ((h)->temp.i =3D (length),						      \
+   ((obstack_room (h) < (h)->temp.i)					      \
+   ? (_obstack_newchunk ((h), (h)->temp.i), 0) : 0),			      \
+   obstack_blank_fast (h, (h)->temp.i))
+
+# define obstack_alloc(h, length)					      \
+  (obstack_blank ((h), (length)), obstack_finish ((h)))
+
+# define obstack_copy(h, where, length)					      \
+  (obstack_grow ((h), (where), (length)), obstack_finish ((h)))
+
+# define obstack_copy0(h, where, length)				      \
+  (obstack_grow0 ((h), (where), (length)), obstack_finish ((h)))
+
+# define obstack_finish(h)						      \
+  (((h)->next_free =3D=3D (h)->object_base					      \
+    ? (((h)->maybe_empty_object =3D 1), 0)				      \
+    : 0),								      \
+   (h)->temp.p =3D (h)->object_base,					      \
+   (h)->next_free							      \
+     =3D __PTR_ALIGN ((h)->object_base, (h)->next_free,			      \
+                    (h)->alignment_mask),				      \
+   (((size_t) ((h)->next_free - (char *) (h)->chunk)			      \
+     > (size_t) ((h)->chunk_limit - (char *) (h)->chunk))		      \
+   ? ((h)->next_free =3D (h)->chunk_limit) : 0),				      \
+   (h)->object_base =3D (h)->next_free,					      \
+   (h)->temp.p)
+
+# define obstack_free(h, obj)						      \
+  ((h)->temp.p =3D (void *) (obj),					      \
+   (((h)->temp.p > (void *) (h)->chunk					      \
+     && (h)->temp.p < (void *) (h)->chunk_limit)			      \
+    ? (void) ((h)->next_free =3D (h)->object_base =3D (char *) (h)->temp=
.p)       \
+    : _obstack_free ((h), (h)->temp.p)))
+
+#endif /* not __GNUC__ */
+
+#ifdef __cplusplus
+}       /* C++ */
+#endif
+
+#endif /* _OBSTACK_H */
diff --git a/musl-imported/include/scsi/scsi.h b/musl-imported/include/sc=
si/scsi.h
new file mode 100644
index 0000000..8837f58
--- /dev/null
+++ b/musl-imported/include/scsi/scsi.h
@@ -0,0 +1,150 @@
+#ifndef _SCSI_SCSI_H
+#define _SCSI_SCSI_H
+
+#define TEST_UNIT_READY 0x00
+#define REZERO_UNIT 0x01
+#define REQUEST_SENSE 0x03
+#define FORMAT_UNIT 0x04
+#define READ_BLOCK_LIMITS 0x05
+#define REASSIGN_BLOCKS 0x07
+#define READ_6 0x08
+#define WRITE_6 0x0a
+#define SEEK_6 0x0b
+#define READ_REVERSE 0x0f
+#define WRITE_FILEMARKS 0x10
+#define SPACE 0x11
+#define INQUIRY 0x12
+#define RECOVER_BUFFERED_DATA 0x14
+#define MODE_SELECT 0x15
+#define RESERVE 0x16
+#define RELEASE 0x17
+#define COPY 0x18
+#define ERASE 0x19
+#define MODE_SENSE 0x1a
+#define START_STOP 0x1b
+#define RECEIVE_DIAGNOSTIC 0x1c
+#define SEND_DIAGNOSTIC 0x1d
+#define ALLOW_MEDIUM_REMOVAL 0x1e
+#define SET_WINDOW 0x24
+#define READ_CAPACITY 0x25
+#define READ_10 0x28
+#define WRITE_10 0x2a
+#define SEEK_10 0x2b
+#define WRITE_VERIFY 0x2e
+#define VERIFY 0x2f
+#define SEARCH_HIGH 0x30
+#define SEARCH_EQUAL 0x31
+#define SEARCH_LOW 0x32
+#define SET_LIMITS 0x33
+#define PRE_FETCH 0x34
+#define READ_POSITION 0x34
+#define SYNCHRONIZE_CACHE 0x35
+#define LOCK_UNLOCK_CACHE 0x36
+#define READ_DEFECT_DATA 0x37
+#define MEDIUM_SCAN 0x38
+#define COMPARE 0x39
+#define COPY_VERIFY 0x3a
+#define WRITE_BUFFER 0x3b
+#define READ_BUFFER 0x3c
+#define UPDATE_BLOCK 0x3d
+#define READ_LONG 0x3e
+#define WRITE_LONG 0x3f
+#define CHANGE_DEFINITION 0x40
+#define WRITE_SAME 0x41
+#define READ_TOC 0x43
+#define LOG_SELECT 0x4c
+#define LOG_SENSE 0x4d
+#define MODE_SELECT_10 0x55
+#define RESERVE_10 0x56
+#define RELEASE_10 0x57
+#define MODE_SENSE_10 0x5a
+#define PERSISTENT_RESERVE_IN 0x5e
+#define PERSISTENT_RESERVE_OUT 0x5f
+#define MOVE_MEDIUM 0xa5
+#define READ_12 0xa8
+#define WRITE_12 0xaa
+#define WRITE_VERIFY_12 0xae
+#define SEARCH_HIGH_12 0xb0
+#define SEARCH_EQUAL_12 0xb1
+#define SEARCH_LOW_12 0xb2
+#define READ_ELEMENT_STATUS 0xb8
+#define SEND_VOLUME_TAG 0xb6
+#define WRITE_LONG_2 0xea
+#define GOOD 0x00
+#define CHECK_CONDITION 0x01
+#define CONDITION_GOOD 0x02
+#define BUSY 0x04
+#define INTERMEDIATE_GOOD 0x08
+#define INTERMEDIATE_C_GOOD 0x0a
+#define RESERVATION_CONFLICT 0x0c
+#define COMMAND_TERMINATED 0x11
+#define QUEUE_FULL 0x14
+#define STATUS_MASK 0x3e
+#define NO_SENSE 0x00
+#define RECOVERED_ERROR 0x01
+#define NOT_READY 0x02
+#define MEDIUM_ERROR 0x03
+#define HARDWARE_ERROR 0x04
+#define ILLEGAL_REQUEST 0x05
+#define UNIT_ATTENTION 0x06
+#define DATA_PROTECT 0x07
+#define BLANK_CHECK 0x08
+#define COPY_ABORTED 0x0a
+#define ABORTED_COMMAND 0x0b
+#define VOLUME_OVERFLOW 0x0d
+#define MISCOMPARE 0x0e
+#define TYPE_DISK 0x00
+#define TYPE_TAPE 0x01
+#define TYPE_PROCESSOR 0x03
+#define TYPE_WORM 0x04
+#define TYPE_ROM 0x05
+#define TYPE_SCANNER 0x06
+#define TYPE_MOD 0x07
+#define TYPE_MEDIUM_CHANGER 0x08
+#define TYPE_ENCLOSURE 0x0d
+#define TYPE_NO_LUN 0x7f
+#define COMMAND_COMPLETE 0x00
+#define EXTENDED_MESSAGE 0x01
+#define EXTENDED_MODIFY_DATA_POINTER 0x00
+#define EXTENDED_SDTR 0x01
+#define EXTENDED_EXTENDED_IDENTIFY 0x02
+#define EXTENDED_WDTR 0x03
+#define SAVE_POINTERS 0x02
+#define RESTORE_POINTERS 0x03
+#define DISCONNECT 0x04
+#define INITIATOR_ERROR 0x05
+#define ABORT 0x06
+#define MESSAGE_REJECT 0x07
+#define NOP 0x08
+#define MSG_PARITY_ERROR 0x09
+#define LINKED_CMD_COMPLETE 0x0a
+#define LINKED_FLG_CMD_COMPLETE 0x0b
+#define BUS_DEVICE_RESET 0x0c
+#define INITIATE_RECOVERY 0x0f
+#define RELEASE_RECOVERY 0x10
+#define SIMPLE_QUEUE_TAG 0x20
+#define HEAD_OF_QUEUE_TAG 0x21
+#define ORDERED_QUEUE_TAG 0x22
+#define SCSI_IOCTL_GET_IDLUN 0x5382
+#define SCSI_IOCTL_TAGGED_ENABLE 0x5383
+#define SCSI_IOCTL_TAGGED_DISABLE 0x5384
+#define SCSI_IOCTL_PROBE_HOST 0x5385
+#define SCSI_IOCTL_GET_BUS_NUMBER 0x5386
+
+struct ccs_modesel_head {
+	unsigned char _r1;
+	unsigned char medium;
+	unsigned char _r2;
+	unsigned char block_desc_length;
+	unsigned char density;
+	unsigned char number_blocks_hi;
+	unsigned char number_blocks_med;
+	unsigned char number_blocks_lo;
+	unsigned char _r3;
+	unsigned char block_length_hi;
+	unsigned char block_length_med;
+	unsigned char block_length_lo;
+};
+
+#endif
+
diff --git a/musl-imported/include/sys/mtio.h b/musl-imported/include/sys=
/mtio.h
new file mode 100644
index 0000000..f16a529
--- /dev/null
+++ b/musl-imported/include/sys/mtio.h
@@ -0,0 +1,188 @@
+#ifndef _SYS_MTIO_H
+#define _SYS_MTIO_H
+
+#include <sys/types.h>
+#include <sys/ioctl.h>
+
+struct mtop {
+	short mt_op;
+	int mt_count;
+};
+
+#define _IOT_mtop _IOT (_IOTS (short), 1, _IOTS (int), 1, 0, 0)
+#define _IOT_mtget _IOT (_IOTS (long), 7, 0, 0, 0, 0)
+#define _IOT_mtpos _IOT_SIMPLE (long)
+#define _IOT_mtconfiginfo _IOT (_IOTS (long), 2, _IOTS (short), 3, _IOTS=
 (long), 1)
+
+
+#define MTRESET 0
+#define MTFSF	1
+#define MTBSF	2
+#define MTFSR	3
+#define MTBSR	4
+#define MTWEOF	5
+#define MTREW	6
+#define MTOFFL	7
+#define MTNOP	8
+#define MTRETEN 9
+#define MTBSFM	10
+#define MTFSFM  11
+#define MTEOM	12
+#define MTERASE 13
+#define MTRAS1  14
+#define MTRAS2	15
+#define MTRAS3  16
+#define MTSETBLK 20
+#define MTSETDENSITY 21
+#define MTSEEK	22
+#define MTTELL	23
+#define MTSETDRVBUFFER 24
+#define MTFSS	25
+#define MTBSS	26
+#define MTWSM	27
+#define MTLOCK  28
+#define MTUNLOCK 29
+#define MTLOAD  30
+#define MTUNLOAD 31
+#define MTCOMPRESSION 32
+#define MTSETPART 33
+#define MTMKPART  34
+
+struct mtget {
+	long mt_type;
+	long mt_resid;
+	long mt_dsreg;
+	long mt_gstat;
+	long mt_erreg;
+	int mt_fileno;
+	int mt_blkno;
+};
+
+#define MT_ISUNKNOWN		0x01
+#define MT_ISQIC02		0x02
+#define MT_ISWT5150		0x03
+#define MT_ISARCHIVE_5945L2	0x04
+#define MT_ISCMSJ500		0x05
+#define MT_ISTDC3610		0x06
+#define MT_ISARCHIVE_VP60I	0x07
+#define MT_ISARCHIVE_2150L	0x08
+#define MT_ISARCHIVE_2060L	0x09
+#define MT_ISARCHIVESC499	0x0A
+#define MT_ISQIC02_ALL_FEATURES	0x0F
+#define MT_ISWT5099EEN24	0x11
+#define MT_ISTEAC_MT2ST		0x12
+#define MT_ISEVEREX_FT40A	0x32
+#define MT_ISDDS1		0x51
+#define MT_ISDDS2		0x52
+#define MT_ISSCSI1		0x71
+#define MT_ISSCSI2		0x72
+#define MT_ISFTAPE_UNKNOWN	0x800000
+#define MT_ISFTAPE_FLAG		0x800000
+
+struct mt_tape_info {
+	long t_type;
+	char *t_name;
+};
+
+#define MT_TAPE_INFO \
+{									      \
+	{MT_ISUNKNOWN,		"Unknown type of tape device"},		      \
+	{MT_ISQIC02,		"Generic QIC-02 tape streamer"},	      \
+	{MT_ISWT5150,		"Wangtek 5150, QIC-150"},		      \
+	{MT_ISARCHIVE_5945L2,	"Archive 5945L-2"},			      \
+	{MT_ISCMSJ500,		"CMS Jumbo 500"},			      \
+	{MT_ISTDC3610,		"Tandberg TDC 3610, QIC-24"},		      \
+	{MT_ISARCHIVE_VP60I,	"Archive VP60i, QIC-02"},		      \
+	{MT_ISARCHIVE_2150L,	"Archive Viper 2150L"},			      \
+	{MT_ISARCHIVE_2060L,	"Archive Viper 2060L"},			      \
+	{MT_ISARCHIVESC499,	"Archive SC-499 QIC-36 controller"},	      \
+	{MT_ISQIC02_ALL_FEATURES, "Generic QIC-02 tape, all features"},	      \
+	{MT_ISWT5099EEN24,	"Wangtek 5099-een24, 60MB"},		      \
+	{MT_ISTEAC_MT2ST,	"Teac MT-2ST 155mb data cassette drive"},     \
+	{MT_ISEVEREX_FT40A,	"Everex FT40A, QIC-40"},		      \
+	{MT_ISSCSI1,		"Generic SCSI-1 tape"},			      \
+	{MT_ISSCSI2,		"Generic SCSI-2 tape"},			      \
+	{0, 0}								      \
+}
+
+struct mtpos {
+	long mt_blkno;
+};
+
+struct mtconfiginfo  {
+	long mt_type;
+	long ifc_type;
+	unsigned short irqnr;
+	unsigned short dmanr;
+	unsigned short port;
+	unsigned long debug;
+	unsigned have_dens:1;
+	unsigned have_bsf:1;
+	unsigned have_fsr:1;
+	unsigned have_bsr:1;
+	unsigned have_eod:1;
+	unsigned have_seek:1;
+	unsigned have_tell:1;
+	unsigned have_ras1:1;
+	unsigned have_ras2:1;
+	unsigned have_ras3:1;
+	unsigned have_qfa:1;
+	unsigned pad1:5;
+	char reserved[10];
+};
+
+#define	MTIOCTOP _IOW('m', 1, struct mtop)
+#define	MTIOCGET _IOR('m', 2, struct mtget)
+#define	MTIOCPOS _IOR('m', 3, struct mtpos)
+
+#define	MTIOCGETCONFIG	_IOR('m', 4, struct mtconfiginfo)
+#define	MTIOCSETCONFIG	_IOW('m', 5, struct mtconfiginfo)
+
+#define GMT_EOF(x)              ((x) & 0x80000000)
+#define GMT_BOT(x)              ((x) & 0x40000000)
+#define GMT_EOT(x)              ((x) & 0x20000000)
+#define GMT_SM(x)               ((x) & 0x10000000)
+#define GMT_EOD(x)              ((x) & 0x08000000)
+#define GMT_WR_PROT(x)          ((x) & 0x04000000)
+#define GMT_ONLINE(x)           ((x) & 0x01000000)
+#define GMT_D_6250(x)           ((x) & 0x00800000)
+#define GMT_D_1600(x)           ((x) & 0x00400000)
+#define GMT_D_800(x)            ((x) & 0x00200000)
+#define GMT_DR_OPEN(x)          ((x) & 0x00040000)
+#define GMT_IM_REP_EN(x)        ((x) & 0x00010000)
+
+#define MT_ST_BLKSIZE_SHIFT	0
+#define MT_ST_BLKSIZE_MASK	0xffffff
+#define MT_ST_DENSITY_SHIFT	24
+#define MT_ST_DENSITY_MASK	0xff000000
+#define MT_ST_SOFTERR_SHIFT	0
+#define MT_ST_SOFTERR_MASK	0xffff
+#define MT_ST_OPTIONS		0xf0000000
+#define MT_ST_BOOLEANS		0x10000000
+#define MT_ST_SETBOOLEANS	0x30000000
+#define MT_ST_CLEARBOOLEANS	0x40000000
+#define MT_ST_WRITE_THRESHOLD	0x20000000
+#define MT_ST_DEF_BLKSIZE	0x50000000
+#define MT_ST_DEF_OPTIONS	0x60000000
+#define MT_ST_BUFFER_WRITES	0x1
+#define MT_ST_ASYNC_WRITES	0x2
+#define MT_ST_READ_AHEAD	0x4
+#define MT_ST_DEBUGGING		0x8
+#define MT_ST_TWO_FM		0x10
+#define MT_ST_FAST_MTEOM	0x20
+#define MT_ST_AUTO_LOCK		0x40
+#define MT_ST_DEF_WRITES	0x80
+#define MT_ST_CAN_BSR		0x100
+#define MT_ST_NO_BLKLIMS	0x200
+#define MT_ST_CAN_PARTITIONS    0x400
+#define MT_ST_SCSI2LOGICAL      0x800
+#define MT_ST_CLEAR_DEFAULT	0xfffff
+#define MT_ST_DEF_DENSITY	(MT_ST_DEF_OPTIONS | 0x100000)
+#define MT_ST_DEF_COMPRESSION	(MT_ST_DEF_OPTIONS | 0x200000)
+#define MT_ST_DEF_DRVBUFFER	(MT_ST_DEF_OPTIONS | 0x300000)
+#define MT_ST_HPLOADER_OFFSET 10000
+#ifndef DEFTAPE
+# define DEFTAPE	"/dev/tape"
+#endif
+
+#endif
diff --git a/musl-imported/include/sys/personality.h b/musl-imported/incl=
ude/sys/personality.h
new file mode 100644
index 0000000..31d43df
--- /dev/null
+++ b/musl-imported/include/sys/personality.h
@@ -0,0 +1,46 @@
+#ifndef _PERSONALITY_H
+#define _PERSONALITY_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define ADDR_NO_RANDOMIZE  0x0040000
+#define MMAP_PAGE_ZERO     0x0100000
+#define ADDR_COMPAT_LAYOUT 0x0200000
+#define READ_IMPLIES_EXEC  0x0400000
+#define ADDR_LIMIT_32BIT   0x0800000
+#define SHORT_INODE        0x1000000
+#define WHOLE_SECONDS      0x2000000
+#define STICKY_TIMEOUTS    0x4000000
+#define ADDR_LIMIT_3GB     0x8000000
+
+#define PER_LINUX 0
+#define PER_LINUX_32BIT ADDR_LIMIT_32BIT
+#define PER_SVR4 (1 | STICKY_TIMEOUTS | MMAP_PAGE_ZERO)
+#define PER_SVR3 (2 | STICKY_TIMEOUTS | SHORT_INODE)
+#define PER_SCOSVR3 (3 | STICKY_TIMEOUTS | WHOLE_SECONDS | SHORT_INODE)
+#define PER_OSR5 (3 | STICKY_TIMEOUTS | WHOLE_SECONDS)
+#define PER_WYSEV386 (4 | STICKY_TIMEOUTS | SHORT_INODE)
+#define PER_ISCR4 (5 | STICKY_TIMEOUTS)
+#define PER_BSD 6
+#define PER_SUNOS (6 | STICKY_TIMEOUTS)
+#define PER_XENIX (7 | STICKY_TIMEOUTS | SHORT_INODE)
+#define PER_LINUX32 8
+#define PER_LINUX32_3GB (8 | ADDR_LIMIT_3GB)
+#define PER_IRIX32 (9 | STICKY_TIMEOUTS)
+#define PER_IRIXN32 (0xa | STICKY_TIMEOUTS)
+#define PER_IRIX64 (0x0b | STICKY_TIMEOUTS)
+#define PER_RISCOS 0xc
+#define PER_SOLARIS (0xd | STICKY_TIMEOUTS)
+#define PER_UW7 (0xe | STICKY_TIMEOUTS | MMAP_PAGE_ZERO)
+#define PER_OSF4 0xf
+#define PER_HPUX 0x10
+#define PER_MASK 0xff
+
+int personality(unsigned long);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/musl-imported/include/sys/timex.h b/musl-imported/include/sy=
s/timex.h
new file mode 100644
index 0000000..2e68888
--- /dev/null
+++ b/musl-imported/include/sys/timex.h
@@ -0,0 +1,98 @@
+#ifndef _SYS_TIMEX_H
+#define _SYS_TIMEX_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define __NEED_clockid_t
+
+#include <bits/alltypes.h>
+
+#include <sys/time.h>
+
+struct ntptimeval {
+	struct timeval time;
+	long maxerror, esterror;
+};
+
+struct timex {
+	unsigned modes;
+	long offset, freq, maxerror, esterror;
+	int status;
+	long constant, precision, tolerance;
+	struct timeval time;
+	long tick, ppsfreq, jitter;
+	int shift;
+	long stabil, jitcnt, calcnt, errcnt, stbcnt;
+	int tai;
+	int __padding[11];
+};
+
+#define ADJ_OFFSET		0x0001
+#define ADJ_FREQUENCY		0x0002
+#define ADJ_MAXERROR		0x0004
+#define ADJ_ESTERROR		0x0008
+#define ADJ_STATUS		0x0010
+#define ADJ_TIMECONST		0x0020
+#define ADJ_TAI			0x0080
+#define ADJ_SETOFFSET		0x0100
+#define ADJ_MICRO		0x1000
+#define ADJ_NANO		0x2000
+#define ADJ_TICK		0x4000
+#define ADJ_OFFSET_SINGLESHOT	0x8001
+#define ADJ_OFFSET_SS_READ	0xa001
+
+#define MOD_OFFSET	ADJ_OFFSET
+#define MOD_FREQUENCY	ADJ_FREQUENCY
+#define MOD_MAXERROR	ADJ_MAXERROR
+#define MOD_ESTERROR	ADJ_ESTERROR
+#define MOD_STATUS	ADJ_STATUS
+#define MOD_TIMECONST	ADJ_TIMECONST
+#define MOD_CLKB	ADJ_TICK
+#define MOD_CLKA	ADJ_OFFSET_SINGLESHOT
+#define MOD_TAI		ADJ_TAI
+#define MOD_MICRO	ADJ_MICRO
+#define MOD_NANO	ADJ_NANO
+
+#define STA_PLL		0x0001
+#define STA_PPSFREQ	0x0002
+#define STA_PPSTIME	0x0004
+#define STA_FLL		0x0008
+
+#define STA_INS		0x0010
+#define STA_DEL		0x0020
+#define STA_UNSYNC	0x0040
+#define STA_FREQHOLD	0x0080
+
+#define STA_PPSSIGNAL	0x0100
+#define STA_PPSJITTER	0x0200
+#define STA_PPSWANDER	0x0400
+#define STA_PPSERROR	0x0800
+
+#define STA_CLOCKERR	0x1000
+#define STA_NANO	0x2000
+#define STA_MODE	0x4000
+#define STA_CLK		0x8000
+
+#define STA_RONLY (STA_PPSSIGNAL | STA_PPSJITTER | STA_PPSWANDER | \
+    STA_PPSERROR | STA_CLOCKERR | STA_NANO | STA_MODE | STA_CLK)
+
+#define TIME_OK		0
+#define TIME_INS	1
+#define TIME_DEL	2
+#define TIME_OOP	3
+#define TIME_WAIT	4
+#define TIME_ERROR	5
+#define TIME_BAD	TIME_ERROR
+
+#define MAXTC		6
+
+int adjtimex(struct timex *);
+int clock_adjtime(clockid_t, struct timex *);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-imported/include/sys/vfs.h b/musl-imported/include/sys/=
vfs.h
new file mode 100644
index 0000000..a899db2
--- /dev/null
+++ b/musl-imported/include/sys/vfs.h
@@ -0,0 +1 @@
+#include <sys/statfs.h>
diff --git a/musl-imported/include/utmp.h b/musl-imported/include/utmp.h
new file mode 100644
index 0000000..48a400d
--- /dev/null
+++ b/musl-imported/include/utmp.h
@@ -0,0 +1,52 @@
+#ifndef _UTMP_H
+#define _UTMP_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <utmpx.h>
+
+#define ACCOUNTING 9
+#define UT_NAMESIZE 32
+#define UT_HOSTSIZE 256
+#define UT_LINESIZE 32
+
+struct lastlog {
+	time_t ll_time;
+	char ll_line[UT_LINESIZE];
+	char ll_host[UT_HOSTSIZE];
+};
+
+#define ut_time ut_tv.tv_sec
+#define ut_name ut_user
+#define ut_addr ut_addr_v6[0]
+#define utmp utmpx
+#define e_exit __e_exit
+#define e_termination __e_termination
+
+void         endutent(void);
+struct utmp *getutent(void);
+struct utmp *getutid(const struct utmp *);
+struct utmp *getutline(const struct utmp *);
+struct utmp *pututline(const struct utmp *);
+void         setutent(void);
+
+void updwtmp(const char *, const struct utmp *);
+int utmpname(const char *);
+
+int login_tty(int);
+
+#define _PATH_UTMP "/dev/null/utmp"
+#define _PATH_WTMP "/dev/null/wtmp"
+
+#define UTMP_FILE _PATH_UTMP
+#define WTMP_FILE _PATH_WTMP
+#define UTMP_FILENAME _PATH_UTMP
+#define WTMP_FILENAME _PATH_WTMP
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-imported/include/utmpx.h b/musl-imported/include/utmpx.=
h
new file mode 100644
index 0000000..cdcc90d
--- /dev/null
+++ b/musl-imported/include/utmpx.h
@@ -0,0 +1,62 @@
+#ifndef _UTMPX_H
+#define _UTMPX_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+
+#define __NEED_pid_t
+#define __NEED_time_t
+#define __NEED_suseconds_t
+#define __NEED_struct_timeval
+
+#include <bits/alltypes.h>
+
+struct utmpx {
+	short ut_type;
+	pid_t ut_pid;
+	char ut_line[32];
+	char ut_id[4];
+	char ut_user[32];
+	char ut_host[256];
+	struct {
+		short __e_termination;
+		short __e_exit;
+	} ut_exit;
+	long ut_session;
+	struct timeval ut_tv;
+	unsigned ut_addr_v6[4];
+	char unused[20];
+};
+
+void          endutxent(void);
+struct utmpx *getutxent(void);
+struct utmpx *getutxid(const struct utmpx *);
+struct utmpx *getutxline(const struct utmpx *);
+struct utmpx *pututxline(const struct utmpx *);
+void          setutxent(void);
+
+#if defined(_BSD_SOURCE) || defined(_GNU_SOURCE)
+#define e_exit __e_exit
+#define e_termination __e_termination
+void updwtmpx(const char *, const struct utmpx *);
+int utmpxname(const char *);
+#endif
+
+#define EMPTY           0
+#define RUN_LVL         1
+#define BOOT_TIME       2
+#define NEW_TIME        3
+#define OLD_TIME        4
+#define INIT_PROCESS    5
+#define LOGIN_PROCESS   6
+#define USER_PROCESS    7
+#define DEAD_PROCESS    8
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
--=20
2.27.0





From minios-devel-bounces@lists.xenproject.org Sun Dec 27 23:30:40 2020
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Sun, 27 Dec 2020 23:30:40 +0000
Received: from list by lists.xenproject.org with outflank-mailman.59344.104213 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1ktfUl-0007KJ-S1; Sun, 27 Dec 2020 23:30:39 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 59344.104213; Sun, 27 Dec 2020 23:30: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 1ktfUl-0007KC-Oc; Sun, 27 Dec 2020 23:30:39 +0000
Received: by outflank-mailman (input) for mailman id 59344;
 Sun, 27 Dec 2020 23:30:37 +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=v3jD=F7=upb.ro=vlad_andrei.badoiu@srs-us1.protection.inumbo.net>)
 id 1ktfUj-0007K4-S3
 for minios-devel@lists.xenproject.org; Sun, 27 Dec 2020 23:30:37 +0000
Received: from mx.upb.ro (unknown [141.85.13.230])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id a82ac2ed-80f8-4f56-8055-72cd0d3e074d;
 Sun, 27 Dec 2020 23:30:34 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
 by mx.upb.ro (Postfix) with ESMTP id 8E204B56006A
 for <minios-devel@lists.xenproject.org>; Mon, 28 Dec 2020 01:30:33 +0200 (EET)
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 SkPkUWkaVGhK; Mon, 28 Dec 2020 01:30:32 +0200 (EET)
Received: from localhost (localhost [127.0.0.1])
 by mx.upb.ro (Postfix) with ESMTP id F08C9B56006F;
 Mon, 28 Dec 2020 01:30:31 +0200 (EET)
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 DFWrsLKfW9mh; Mon, 28 Dec 2020 01:30:31 +0200 (EET)
Received: from localhost.localdomain (5-14-39-185.residential.rdsnet.ro
 [5.14.39.185]) by mx.upb.ro (Postfix) with ESMTPSA id B6172B56006A;
 Mon, 28 Dec 2020 01:30:31 +0200 (EET)
X-BeenThere: minios-devel@lists.xenproject.org
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
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: a82ac2ed-80f8-4f56-8055-72cd0d3e074d
DKIM-Filter: OpenDKIM Filter v2.10.3 mx.upb.ro F08C9B56006F
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=upb.ro;
	s=96342B8A-77E4-11E5-BA93-D93D0963A2DF; t=1609111832;
	bh=H49UfNezIT04k3N0SkpjgGSZtWlU6Il+1KnBi9zI4gM=;
	h=From:To:Date:Message-Id:MIME-Version;
	b=YY8kfowSuYuTpB4DjgqmNh9EMgkMCmyInkpFRN2JgkGXlgtTO8Lk2WNos/1N5B81i
	 S/oECxhH/+8bTHbdLIgEatuC+6lKO4LVr3uGNZYekoLZD0itOQb6NHGHzFAVBVp3fS
	 sRvw0UtzlnYJPj1JwlG9nd7MRHnRjzvxou2Ced40=
X-Virus-Scanned: amavisd-new at upb.ro
From: Vlad-Andrei Badoiu <vlad_andrei.badoiu@upb.ro>
To: minios-devel@lists.xenproject.org
Cc: Vlad-Andrei Badoiu <vlad_andrei.badoiu@upb.ro>
Subject: [UNIKRAFT/NEWLIB PATCH 1/1] Add NAME_MAX to limits.h
Date: Mon, 28 Dec 2020 01:30:27 +0200
Message-Id: <20201227233027.7208-1-vlad_andrei.badoiu@upb.ro>
X-Mailer: git-send-email 2.27.0
MIME-Version: 1.0
Content-Transfer-Encoding: quoted-printable

Signed-off-by: Vlad-Andrei Badoiu <vlad_andrei.badoiu@upb.ro>
---
 include/limits.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/limits.h b/include/limits.h
index d31d2f2..cbe57fa 100644
--- a/include/limits.h
+++ b/include/limits.h
@@ -73,7 +73,7 @@
 #endif
=20
 #define PATH_MAX        1024
-
+#define NAME_MAX        255
 /* The maximum number of repeated occurrences of a regular expression
  * permitted when using the interval notation `\{M,N\}'.
  */
--=20
2.27.0



