From minios-devel-bounces@lists.xenproject.org Sat Jan 02 21:48:51 2021
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Sat, 02 Jan 2021 21:48:51 +0000
Received: from list by lists.xenproject.org with outflank-mailman.60868.106760 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1kvolS-0008Ul-2n; Sat, 02 Jan 2021 21:48:46 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 60868.106760; Sat, 02 Jan 2021 21: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 1kvolR-0008Ue-W4; Sat, 02 Jan 2021 21:48:45 +0000
Received: by outflank-mailman (input) for mailman id 60868;
 Sat, 02 Jan 2021 21:48: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=eIzv=GF=upb.ro=vlad_andrei.badoiu@srs-us1.protection.inumbo.net>)
 id 1kvolQ-0008UX-B5
 for minios-devel@lists.xenproject.org; Sat, 02 Jan 2021 21:48:44 +0000
Received: from mx.upb.ro (unknown [141.85.13.230])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 5e2543b8-fb2b-4683-a030-d5487186de00;
 Sat, 02 Jan 2021 21:48:40 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
 by mx.upb.ro (Postfix) with ESMTP id E5F50B56005E
 for <minios-devel@lists.xenproject.org>; Sat,  2 Jan 2021 23:48:38 +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 wWRZSLG8k4S2; Sat,  2 Jan 2021 23:48:37 +0200 (EET)
Received: from localhost (localhost [127.0.0.1])
 by mx.upb.ro (Postfix) with ESMTP id 4ED16B560062;
 Sat,  2 Jan 2021 23:48:37 +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 f1u7FIjivY4C; Sat,  2 Jan 2021 23:48:37 +0200 (EET)
Received: from localhost.localdomain (unknown [188.26.226.218])
 by mx.upb.ro (Postfix) with ESMTPSA id 28AA3B56005E;
 Sat,  2 Jan 2021 23:48:37 +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: 5e2543b8-fb2b-4683-a030-d5487186de00
DKIM-Filter: OpenDKIM Filter v2.10.3 mx.upb.ro 4ED16B560062
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=upb.ro;
	s=96342B8A-77E4-11E5-BA93-D93D0963A2DF; t=1609624117;
	bh=DDpeEWYxSke3eYLIgpZFjYS/eXEBrRjYGppJYTkv5hw=;
	h=From:To:Date:Message-Id:MIME-Version;
	b=bl+1Mqk+iBYOahQq5fxNGMwuapsfN1n7LhEQ3czm0DIpMStPA+sLkAmtFr8lttu2A
	 iM7R+TiXxPrAD7YWT/zUT64gUVLjgBDIQcQyYDB0SAlTyPxTVclB+1xPD6Nee3PfTn
	 WrYwAJpw1QbFGYTThm2rpXGC8ZN7eV4WCIva7Ln0=
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 PATCH 1/1] Cast value to unsigned to avoid undefined behavior
Date: Sat,  2 Jan 2021 23:48:33 +0200
Message-Id: <20210102214833.20841-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>
---
 plat/common/pci_bus.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/plat/common/pci_bus.c b/plat/common/pci_bus.c
index cfc404e..7a66e94 100644
--- a/plat/common/pci_bus.c
+++ b/plat/common/pci_bus.c
@@ -80,7 +80,7 @@ static struct pci_bus_handler ph;
 #define PCI_BUS_SHIFT               (16)
 #define PCI_DEVICE_SHIFT            (11)
 #define PCI_FUNCTION_SHIFT          (8)
-#define PCI_ENABLE_BIT              (1 << 31)
+#define PCI_ENABLE_BIT              (1u << 31)
=20
 #define PCI_CONF_CLASS_ID          (0x08)
 #define PCI_CONF_CLASS_ID_SHFT     (16)
--=20
2.27.0



From minios-devel-bounces@lists.xenproject.org Sun Jan 03 14:59:45 2021
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Sun, 03 Jan 2021 14:59:45 +0000
Received: from list by lists.xenproject.org with outflank-mailman.60948.106909 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1kw4r3-0001qD-35; Sun, 03 Jan 2021 14:59:37 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 60948.106909; Sun, 03 Jan 2021 14:59: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 1kw4r3-0001q6-01; Sun, 03 Jan 2021 14:59:37 +0000
Received: by outflank-mailman (input) for mailman id 60948;
 Sun, 03 Jan 2021 14:59: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=pK6H=GG=upb.ro=vlad_andrei.badoiu@srs-us1.protection.inumbo.net>)
 id 1kw4r0-0001pz-MT
 for minios-devel@lists.xenproject.org; Sun, 03 Jan 2021 14:59:35 +0000
Received: from mx.upb.ro (unknown [141.85.13.200])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id ea98bb4e-51b3-43fe-a734-61d1114c0549;
 Sun, 03 Jan 2021 14:59:30 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
 by mx.upb.ro (Postfix) with ESMTP id 07351B560057;
 Sun,  3 Jan 2021 16:59:29 +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 bhYxvRfbFHox; Sun,  3 Jan 2021 16:59:25 +0200 (EET)
Received: from localhost (localhost [127.0.0.1])
 by mx.upb.ro (Postfix) with ESMTP id 8EF3AB56005D;
 Sun,  3 Jan 2021 16:59:25 +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 klqTFOKsrKhD; Sun,  3 Jan 2021 16:59:25 +0200 (EET)
Received: from localhost.localdomain (unknown [188.26.226.218])
 by mx.upb.ro (Postfix) with ESMTPSA id 63745B560057;
 Sun,  3 Jan 2021 16:59:25 +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: ea98bb4e-51b3-43fe-a734-61d1114c0549
DKIM-Filter: OpenDKIM Filter v2.10.3 mx.upb.ro 8EF3AB56005D
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=upb.ro;
	s=96342B8A-77E4-11E5-BA93-D93D0963A2DF; t=1609685965;
	bh=G0EXaj4ZWsi3G9aIecbA5P4sDEKdGs0t943Qf+OW6TA=;
	h=From:To:Date:Message-Id:MIME-Version;
	b=pmyRQx8gswxYLDuzrkPn3hN1QPCOujuq5WGJZKLF4CszRRWUIZ4v7mMu09viquaFT
	 ke5Dl7PfHKrZ0jv9Rhy6M776eEUM6v+V713d7JS0eGVwJHgO+RitgKyUzy0rwUCX0A
	 aM0uiDBI/dTowpyCqAj+C/btqnEe63CZgW40x8GE=
X-Virus-Scanned: amavisd-new at upb.ro
From: Vlad-Andrei Badoiu <vlad_andrei.badoiu@upb.ro>
To: minios-devel@lists.xenproject.org
Cc: simon.kuenzer@neclab.eu,
	felipe.huici@neclab.eu,
	Vlad-Andrei Badoiu <vlad_andrei.badoiu@upb.ro>
Subject: [UNIKRAFT PATCH 1/1] Add Undefined Behavior Sanitizer Library
Date: Sun,  3 Jan 2021 16:59:22 +0200
Message-Id: <20210103145922.37324-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 an internal library that implements the functions needed
by UBSAN. The flag can either be enabled globally by enabling the
LIBUBSAN_GLOBAL config option or manually by adding the
-fsanitize=3Dundefined flag.

UBSAN can catch runtime bugs such as dereferencing NULL or non-canonical
addresses, certain undefined overflow errors, shifting or multiplying
data which is out of bounds, and other errors.

For example, ubsan will catch the following addition overflow:
int k =3D 0x7fffffff;
k +=3D 127;

Signed-off-by: Vlad-Andrei Badoiu <vlad_andrei.badoiu@upb.ro>
---
 lib/Makefile.uk         |   1 +
 lib/ubsan/Config.uk     |  14 ++
 lib/ubsan/Makefile.uk   |   5 +
 lib/ubsan/exportsyms.uk |  19 +++
 lib/ubsan/ubsan.c       | 321 ++++++++++++++++++++++++++++++++++++++++
 5 files changed, 360 insertions(+)
 create mode 100644 lib/ubsan/Config.uk
 create mode 100644 lib/ubsan/Makefile.uk
 create mode 100644 lib/ubsan/exportsyms.uk
 create mode 100644 lib/ubsan/ubsan.c

diff --git a/lib/Makefile.uk b/lib/Makefile.uk
index 07e8a29..e9fc205 100644
--- a/lib/Makefile.uk
+++ b/lib/Makefile.uk
@@ -37,3 +37,4 @@ $(eval $(call _import_lib,$(CONFIG_UK_BASE)/lib/ukmmap)=
)
 $(eval $(call _import_lib,$(CONFIG_UK_BASE)/lib/ukblkdev))
 $(eval $(call _import_lib,$(CONFIG_UK_BASE)/lib/posix-process))
 $(eval $(call _import_lib,$(CONFIG_UK_BASE)/lib/uksp))
+$(eval $(call _import_lib,$(CONFIG_UK_BASE)/lib/ubsan))
diff --git a/lib/ubsan/Config.uk b/lib/ubsan/Config.uk
new file mode 100644
index 0000000..92239a0
--- /dev/null
+++ b/lib/ubsan/Config.uk
@@ -0,0 +1,14 @@
+menuconfig LIBUBSAN
+	bool "ubsan: Undefined Behavior Sanitization"
+	default n
+
+if LIBUBSAN
+
+config LIBUBSAN_GLOBAL
+	bool "Global undefined sanitization"
+	default n
+	help                            =20
+|       |       Enable undefined behavior sanitization globally.
+
+endif
+
diff --git a/lib/ubsan/Makefile.uk b/lib/ubsan/Makefile.uk
new file mode 100644
index 0000000..ffbb2e9
--- /dev/null
+++ b/lib/ubsan/Makefile.uk
@@ -0,0 +1,5 @@
+$(eval $(call addlib_s,libubsan,$(CONFIG_LIBUBSAN)))
+
+COMPFLAGS-$(CONFIG_LIBUBSAN_GLOBAL)	+=3D -fsanitize=3Dundefined
+
+LIBUBSAN_SRCS-y +=3D $(LIBUBSAN_BASE)/ubsan.c
diff --git a/lib/ubsan/exportsyms.uk b/lib/ubsan/exportsyms.uk
new file mode 100644
index 0000000..50f6165
--- /dev/null
+++ b/lib/ubsan/exportsyms.uk
@@ -0,0 +1,19 @@
+__ubsan_handle_type_mismatch
+__ubsan_handle_type_mismatch_v1
+__ubsan_handle_mul_overflow
+__ubsan_handle_sub_overflow
+__ubsan_handle_pointer_overflow
+__ubsan_handle_add_overflow
+__ubsan_handle_negate_overflow
+__ubsan_handle_out_of_bounds
+__ubsan_handle_shift_out_of_bounds
+__ubsan_handle_nonnull_arg
+__ubsan_handle_divrem_overflow
+__ubsan_handle_vla_bound_not_positive
+__ubsan_handle_load_invalid_value
+__ubsan_handle_cfi_bad_icall
+__ubsan_handle_nonnull_return
+__ubsan_handle_function_type_mismatch
+__ubsan_handle_float_cast_overflow
+__ubsan_handle_builtin_unreachable
+__ubsan_handle_missing_return
diff --git a/lib/ubsan/ubsan.c b/lib/ubsan/ubsan.c
new file mode 100644
index 0000000..fa8feac
--- /dev/null
+++ b/lib/ubsan/ubsan.c
@@ -0,0 +1,321 @@
+/* SPDX-License-Identifier: BSD-3-Clause */
+/*
+ * Authors: Vlad-Andrei Badoiu <vlad_andrei.badoiu@upb.ro>
+ *
+ * Copyright (c) 2020, University Politehnica of Bucharest. All rights r=
eserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in th=
e
+ *    documentation and/or other materials provided with the distributio=
n.
+ * 3. Neither the name of the copyright holder nor the names of its
+ *    contributors may be used to endorse or promote products derived fr=
om
+ *    this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "=
AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,=
 THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PU=
RPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTOR=
S BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSIN=
ESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER =
IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWIS=
E)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED O=
F THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+#include <stdint.h>
+#include <uk/assert.h>
+
+struct source_location {
+	const char *filename;
+	uint32_t line;
+	uint32_t column;
+};
+
+struct type_descriptor {
+	uint16_t kind;
+	uint16_t info;
+	char name[];
+};
+
+struct out_of_bounds_info {
+	struct source_location location;
+	struct type_descriptor left_type;
+	struct type_descriptor right_type;
+};
+
+struct type_mismatch_info {
+	struct source_location location;
+	struct type_descriptor *type;
+	uintptr_t alignment;
+	uint8_t type_check_kind;
+};
+
+static const struct source_location unknown_location =3D {
+
+	"<unknown file>",
+	0,
+	0,
+};
+
+typedef uintptr_t ubsan_value_handle_t;
+
+static void ubsan_log_location(const struct source_location *location,
+			const char *violation) __noreturn;
+
+static void ubsan_log_location(const struct source_location *location,
+			const char *violation)
+{
+	if (!location || !location->filename)
+		location =3D &unknown_location;
+
+	UK_CRASH("Undefined behavior at %s:%d:%d:%s",
+		location->filename, location->line,
+		location->column, violation);
+}
+
+void __ubsan_handle_type_mismatch(void *data_raw,
+				  void *pointer_raw)
+{
+	struct type_mismatch_info *data =3D
+		(struct type_mismatch_info *) data_raw;
+	ubsan_value_handle_t pointer =3D (ubsan_value_handle_t) pointer_raw;
+	const char *violation =3D "type mismatch";
+
+	if (!pointer)
+		violation =3D "null pointer access";
+	else if (data->alignment && (pointer & (data->alignment - 1)))
+		violation =3D "unaligned access";
+
+	ubsan_log_location(&data->location, violation);
+}
+
+void __ubsan_handle_type_mismatch_v1(void *data_raw,
+				  void *pointer_raw)
+{
+	__ubsan_handle_type_mismatch(data_raw, pointer_raw);
+}
+
+struct ubsan_overflow_data {
+	struct source_location location;
+	struct type_descriptor *type;
+};
+
+void __ubsan_handle_mul_overflow(void *data_raw,
+				 void *lhs_raw __unused,
+				 void *rhs_raw __unused)
+{
+	struct ubsan_overflow_data *data =3D
+			(struct ubsan_overflow_data *) data_raw;
+
+	ubsan_log_location(&data->location, "multiplication overflow");
+}
+
+void __ubsan_handle_pointer_overflow(void *data_raw,
+				 void *base __unused,
+				 void *result __unused)
+{
+	struct ubsan_overflow_data *data =3D
+			(struct ubsan_overflow_data *) data_raw;
+
+	ubsan_log_location(&data->location, "pointer overflow");
+}
+
+void __ubsan_handle_sub_overflow(void *data_raw,
+				 void *lhs_raw __unused,
+				 void *rhs_raw __unused)
+{
+	struct ubsan_overflow_data *data =3D
+			(struct ubsan_overflow_data *) data_raw;
+
+	ubsan_log_location(&data->location, "subtraction overflow");
+}
+
+void __ubsan_handle_add_overflow(void *data_raw,
+				 void *lhs_raw __unused,
+				 void *rhs_raw __unused)
+{
+	struct ubsan_overflow_data *data =3D
+			(struct ubsan_overflow_data *) data_raw;
+
+	ubsan_log_location(&data->location, "addition overflow");
+}
+
+void __ubsan_handle_negate_overflow(void *data_raw,
+				    void *old_value_raw __unused)
+{
+	struct ubsan_overflow_data *data =3D
+			(struct ubsan_overflow_data *) data_raw;
+
+	ubsan_log_location(&data->location, "negation overflow");
+}
+
+void __ubsan_handle_divrem_overflow(void *data_raw,
+				    void *lhs_raw __unused,
+				    void *rhs_raw __unused)
+{
+	struct ubsan_overflow_data *data =3D
+			(struct ubsan_overflow_data *) data_raw;
+
+	ubsan_log_location(&data->location, "division remainder overflow");
+}
+
+
+struct ubsan_out_of_bounds_data {
+	struct source_location location;
+	struct type_descriptor *array_type;
+	struct type_descriptor *index_type;
+};
+
+void __ubsan_handle_out_of_bounds(void *data_raw,
+				  void *index_raw __unused)
+{
+	struct ubsan_out_of_bounds_data *data =3D
+			(struct ubsan_out_of_bounds_data *) data_raw;
+
+	ubsan_log_location(&data->location, "out of bounds");
+}
+
+struct ubsan_shift_out_of_bounds_data {
+	struct source_location location;
+	struct type_descriptor *lhs_type;
+	struct type_descriptor *rhs_type;
+};
+
+void __ubsan_handle_shift_out_of_bounds(void *data_raw,
+					void *lhs_raw __unused,
+					void *rhs_raw __unused)
+{
+	struct ubsan_shift_out_of_bounds_data *data =3D
+		(struct ubsan_shift_out_of_bounds_data *) data_raw;
+
+	ubsan_log_location(&data->location, "shift out of bounds");
+}
+
+struct ubsan_nonnull_arg_data {
+	struct source_location location;
+	struct source_location attr_location;
+};
+
+void __ubsan_handle_nonnull_arg(void *data_raw)
+{
+	struct ubsan_nonnull_arg_data *data =3D
+		(struct ubsan_nonnull_arg_data *) data_raw;
+
+	ubsan_log_location(&data->location, "null argument");
+}
+
+struct ubsan_vla_bound_data {
+	struct source_location location;
+	struct type_descriptor *type;
+};
+
+void __ubsan_handle_vla_bound_not_positive(void *data_raw,
+					void *bound_raw __unused)
+{
+	struct ubsan_vla_bound_data *data =3D
+			(struct ubsan_vla_bound_data *) data_raw;
+
+	ubsan_log_location(&data->location, "negative variable array length");
+}
+
+struct ubsan_invalid_value_data {
+	struct source_location location;
+	struct type_descriptor *type;
+};
+
+void __ubsan_handle_load_invalid_value(void *data_raw,
+				void *value_raw __unused)
+{
+	struct ubsan_invalid_value_data *data =3D
+		(struct ubsan_invalid_value_data *) data_raw;
+
+	ubsan_log_location(&data->location, "invalid value load");
+}
+
+struct ubsan_cfi_bad_icall_data {
+	struct source_location location;
+	struct type_descriptor *type;
+};
+
+void __ubsan_handle_cfi_bad_icall(void *data_raw,
+				void *value_raw __unused)
+{
+	struct ubsan_cfi_bad_icall_data *data =3D
+		(struct ubsan_cfi_bad_icall_data *) data_raw;
+
+	ubsan_log_location(&data->location,
+		"control flow integrity check failure during indirect call");
+}
+
+struct ubsan_nonnull_return_data {
+	struct source_location location;
+	struct source_location attr_location;
+};
+
+void __ubsan_handle_nonnull_return(void *data_raw)
+{
+	struct ubsan_nonnull_return_data *data =3D
+		(struct ubsan_nonnull_return_data *) data_raw;
+
+	ubsan_log_location(&data->location, "null return");
+}
+
+struct ubsan_function_type_mismatch_data {
+	struct source_location location;
+	struct type_descriptor *type;
+};
+
+void __ubsan_handle_function_type_mismatch(void *data_raw,
+				void *value_raw __unused)
+{
+	struct ubsan_function_type_mismatch_data *data =3D
+		(struct ubsan_function_type_mismatch_data *) data_raw;
+
+	ubsan_log_location(&data->location, "function type mismatch");
+}
+
+struct ubsan_float_cast_overflow_data {
+	struct source_location location;
+	struct type_descriptor *from_type;
+	struct type_descriptor *to_type;
+};
+
+void __ubsan_handle_float_cast_overflow(void *data_raw,
+				void *from_raw __unused)
+{
+	struct ubsan_float_cast_overflow_data *data =3D
+		(struct ubsan_float_cast_overflow_data *) data_raw;
+
+	ubsan_log_location(&data->location, "float cast overflow");
+}
+
+struct ubsan_unreachable_data {
+	struct source_location location;
+};
+
+void __ubsan_handle_builtin_unreachable(void *data_raw)
+{
+	struct ubsan_unreachable_data *data =3D
+		(struct ubsan_unreachable_data *) data_raw;
+
+	ubsan_log_location(&data->location, "reached unreachable");
+}
+
+void __ubsan_handle_missing_return(void *data_raw) __noreturn;
+
+void __ubsan_handle_missing_return(void *data_raw)
+{
+	struct ubsan_unreachable_data *data =3D
+		(struct ubsan_unreachable_data *) data_raw;
+
+	ubsan_log_location(&data->location, "missing return");
+}
--=20
2.27.0



From minios-devel-bounces@lists.xenproject.org Wed Jan 06 01:55:49 2021
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Wed, 06 Jan 2021 01:55:49 +0000
Received: from list by lists.xenproject.org with outflank-mailman.62279.110206 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1kwy39-0003Do-C4; Wed, 06 Jan 2021 01:55:47 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 62279.110206; Wed, 06 Jan 2021 01:55: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 1kwy39-0003Dh-8r; Wed, 06 Jan 2021 01:55:47 +0000
Received: by outflank-mailman (input) for mailman id 62279;
 Wed, 06 Jan 2021 01:55: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=Dki+=GJ=arm.com=jianyong.wu@srs-us1.protection.inumbo.net>)
 id 1kwy37-0003Dc-Ak
 for minios-devel@lists.xenproject.org; Wed, 06 Jan 2021 01:55:45 +0000
Received: from foss.arm.com (unknown [217.140.110.172])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTP
 id beb1da53-8438-4d06-b0b8-02af4c74e01b;
 Wed, 06 Jan 2021 01:55: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 D3A221FB;
 Tue,  5 Jan 2021 17:55:42 -0800 (PST)
Received: from entos-thunderx2-desktop.shanghai.arm.com
 (entos-thunderx2-desktop.shanghai.arm.com [10.169.212.206])
 by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id D8E5D3F719;
 Tue,  5 Jan 2021 17:55: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: beb1da53-8438-4d06-b0b8-02af4c74e01b
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] arm/entry: set x0 before cache maintenance.
Date: Wed,  6 Jan 2021 09:55:09 +0800
Message-Id: <20210106015509.17033-1-jianyong.wu@arm.com>
X-Mailer: git-send-email 2.17.1

There is a long standing issue in entry code of arm that x0 is not
set before using it in clean_and_invalidate_dcache_range. This error
can be caught by kvm and result in core dump.
Here, x0 is set to the base address of dtb before cache maintain.

Jira: ENTOS-2050
Signed-off-by: Jianyong Wu <jianyong.wu@arm.com>
Change-Id: Ia81f5c65c19a33b7a640efcd4d3117f61c59dd28
---
 plat/kvm/arm/entry64.S | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/plat/kvm/arm/entry64.S b/plat/kvm/arm/entry64.S
index c4de334..0526ae8 100644
--- a/plat/kvm/arm/entry64.S
+++ b/plat/kvm/arm/entry64.S
@@ -92,6 +92,12 @@ ENTRY(_libkvmplat_entry)
 	add x27, x26, x17
 	add x27, x27, #__STACK_SIZE
 	sub x1, x27, x25
+
+	/*
+	 * set x0 to the location stores dtb as the base address of the
+	 * memory range to be cache maintained
+	 */
+	ldr x0, =_dtb
 	bl clean_and_invalidate_dcache_range
 
 	/* Disable the MMU and D-Cache. */
-- 
2.17.1



From minios-devel-bounces@lists.xenproject.org Wed Jan 06 03:09:30 2021
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Wed, 06 Jan 2021 03:09:30 +0000
Received: from list by lists.xenproject.org with outflank-mailman.62281.110211 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1kwzCN-0001tH-OK; Wed, 06 Jan 2021 03:09:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 62281.110211; Wed, 06 Jan 2021 03:09: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 1kwzCN-0001tA-LS; Wed, 06 Jan 2021 03:09:23 +0000
Received: by outflank-mailman (input) for mailman id 62281;
 Wed, 06 Jan 2021 03:09: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=Dki+=GJ=arm.com=jianyong.wu@srs-us1.protection.inumbo.net>)
 id 1kwzCN-0001sZ-Dm
 for minios-devel@lists.xenproject.org; Wed, 06 Jan 2021 03:09:23 +0000
Received: from foss.arm.com (unknown [217.140.110.172])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTP
 id 42bf2b32-6cf7-4ea9-9c02-e87de97d075f;
 Wed, 06 Jan 2021 03:09: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 5DFD131B;
 Tue,  5 Jan 2021 19:09:21 -0800 (PST)
Received: from entos-thunderx2-desktop.shanghai.arm.com
 (entos-thunderx2-desktop.shanghai.arm.com [10.169.212.206])
 by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 62BBC3F719;
 Tue,  5 Jan 2021 19:09: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: 42bf2b32-6cf7-4ea9-9c02-e87de97d075f
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] arm/entry: set x0 before cache maintain.
Date: Wed,  6 Jan 2021 11:09:10 +0800
Message-Id: <20210106030910.28568-1-jianyong.wu@arm.com>
X-Mailer: git-send-email 2.17.1

There is a long standing issue in entry code of arm that x0 is not
set before using it in clean_and_invalidate_dcache_range. This error
can be caught by kvm and result in core dump.
Here, x0 is set to the location where stores dtb before cache maintain.

Signed-off-by: Jianyong Wu <jianyong.wu@arm.com>
---
 plat/kvm/arm/entry64.S | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/plat/kvm/arm/entry64.S b/plat/kvm/arm/entry64.S
index c4de334..aeb70c8 100644
--- a/plat/kvm/arm/entry64.S
+++ b/plat/kvm/arm/entry64.S
@@ -92,6 +92,10 @@ ENTRY(_libkvmplat_entry)
 	add x27, x26, x17
 	add x27, x27, #__STACK_SIZE
 	sub x1, x27, x25
+
+	/* Load dtb address to x0 as a parameter */
+	ldr x0, =_dtb
+
 	bl clean_and_invalidate_dcache_range
 
 	/* Disable the MMU and D-Cache. */
@@ -135,8 +139,6 @@ ENTRY(_libkvmplat_entry)
 	/* Enable the mmu */
 	bl start_mmu
 
-	/* Load dtb address to x0 as a parameter */
-	ldr x0, =_dtb
 	b _libkvmplat_start
 END(_libkvmplat_entry)
 
-- 
2.17.1



From minios-devel-bounces@lists.xenproject.org Wed Jan 06 03:11:44 2021
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Wed, 06 Jan 2021 03:11:44 +0000
Received: from list by lists.xenproject.org with outflank-mailman.62283.110215 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1kwzEd-0002bp-VY; Wed, 06 Jan 2021 03:11:43 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 62283.110215; Wed, 06 Jan 2021 03:11:43 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1kwzEd-0002bi-SO; Wed, 06 Jan 2021 03:11:43 +0000
Received: by outflank-mailman (input) for mailman id 62283;
 Wed, 06 Jan 2021 03:11: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=Dki+=GJ=arm.com=jianyong.wu@srs-us1.protection.inumbo.net>)
 id 1kwzEc-0002bd-S7
 for minios-devel@lists.xenproject.org; Wed, 06 Jan 2021 03:11:43 +0000
Received: from EUR04-DB3-obe.outbound.protection.outlook.com (unknown
 [40.107.6.84]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 0d1373c9-0b32-414d-b1a0-207bfb110c67;
 Wed, 06 Jan 2021 03:11:41 +0000 (UTC)
Received: from AM5PR0301CA0023.eurprd03.prod.outlook.com
 (2603:10a6:206:14::36) by AM6PR08MB5158.eurprd08.prod.outlook.com
 (2603:10a6:20b:ec::15) with Microsoft SMTP Server (version=TLS1_2,
 cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3721.19; Wed, 6 Jan
 2021 03:11:40 +0000
Received: from AM5EUR03FT060.eop-EUR03.prod.protection.outlook.com
 (2603:10a6:206:14:cafe::74) by AM5PR0301CA0023.outlook.office365.com
 (2603:10a6:206:14::36) with Microsoft SMTP Server (version=TLS1_2,
 cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3742.6 via Frontend
 Transport; Wed, 6 Jan 2021 03:11:39 +0000
Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by
 AM5EUR03FT060.mail.protection.outlook.com (10.152.16.160) with
 Microsoft SMTP
 Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id
 15.20.3742.6 via Frontend Transport; Wed, 6 Jan 2021 03:11:39 +0000
Received: ("Tessian outbound 39646a0fd094:v71");
 Wed, 06 Jan 2021 03:11:38 +0000
Received: from f50bd0ba0ff8.3
 by 64aa7808-outbound-1.mta.getcheckrecipient.com id
 DBA834DB-BCB7-4485-8CE7-81224DB6231B.1; 
 Wed, 06 Jan 2021 03:11:33 +0000
Received: from EUR01-DB5-obe.outbound.protection.outlook.com
 by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id f50bd0ba0ff8.3
 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384);
 Wed, 06 Jan 2021 03:11:33 +0000
Received: from VE1PR08MB4766.eurprd08.prod.outlook.com (2603:10a6:802:a9::18)
 by VE1PR08MB5855.eurprd08.prod.outlook.com (2603:10a6:800:1a2::12)
 with Microsoft SMTP Server (version=TLS1_2,
 cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3721.20; Wed, 6 Jan
 2021 03:11:32 +0000
Received: from VE1PR08MB4766.eurprd08.prod.outlook.com
 ([fe80::9cb0:dfc6:9464:a3d8]) by VE1PR08MB4766.eurprd08.prod.outlook.com
 ([fe80::9cb0:dfc6:9464:a3d8%2]) with mapi id 15.20.3721.024; Wed, 6 Jan 2021
 03:11:32 +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: 0d1373c9-0b32-414d-b1a0-207bfb110c67
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=ULjAcIvbygeVLnfdbQfJKBxM7XMKxUE3YjibFaN4dFU=;
 b=ISkFFpcwwAzoXXF8r0rwjjGTHPgCsHG5wlQ0BYVSOE7IH67cEUYlCDpcQg9C6M3IjeVm4vhq4WpNlqqcSuAMAt9HEX814KtiJ8ZgG8e4K4G8qxBjz8+ULvV4Xha80Wt6/CpRxnXU16z/rtz+rp6b90lMOWYaC2GPIL3vg9aBBvA=
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=i2DiNcUooD8j4VNu3t5iHM0ZJoUSy4UgspE85FyJNxUhTfUPxnC/OqfPz6DaUJO9oGzwDfWwZuQZjh2/w+CuC59ifBKlyKfIop5RtiD5Ape/PClMknnCkta2dPrTTYKGVsTJwGjpyWE+MEpkpCXynJJK9hlQsZo8OZKPGGX6VzFlWbDkAFnyyjGJSqpzBnXLYGhzbZfZYywqpaQOsSAEnmXgMG4LicLszlnfTGPk3XGOqPIAKZdcOlI5fHk5WevamqzIhBgKFmpOoJk0BSnaIvRPxnZoDvmSssAz0UTfIWTAsZDs4Konr2lHkwnteUBL6r2CL0UNanIMv0pgebpdmA==
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=ULjAcIvbygeVLnfdbQfJKBxM7XMKxUE3YjibFaN4dFU=;
 b=mGI+GO1bpJktpEtRTwuBU2Dt7Jnku2wu08h9+0TL/wylo1f7LjQAffy0e1M1yW7D3ULRGaZHCdABljD5tu5+o3VJ5jwPzv/JeT45KKj4pMOyl8V/2z6gZbkTXj7lV4DeRbTaGURWtprfrcE9RVBFivEw+B1LrhgF8LC3QJacQbLdYjeVDStS3+ECGe+AgJ5Qm6ajNxhcujL/WiMXYV6cj4lWTL/x0t8n+HpuGAcKVFNgUtatFGghq5EcSTyH0xZur9r3VkZ2Gg5aY4p3iXFZ96gI5uP6soBALKeaYvB1n9EQ8fmc5vkJjLca7G7793pOfR54+/9dXA4xIe0yOTxxaQ==
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=ULjAcIvbygeVLnfdbQfJKBxM7XMKxUE3YjibFaN4dFU=;
 b=ISkFFpcwwAzoXXF8r0rwjjGTHPgCsHG5wlQ0BYVSOE7IH67cEUYlCDpcQg9C6M3IjeVm4vhq4WpNlqqcSuAMAt9HEX814KtiJ8ZgG8e4K4G8qxBjz8+ULvV4Xha80Wt6/CpRxnXU16z/rtz+rp6b90lMOWYaC2GPIL3vg9aBBvA=
From: Jianyong Wu <Jianyong.Wu@arm.com>
To: Jianyong Wu <Jianyong.Wu@arm.com>, "minios-devel@lists.xenproject.org"
	<minios-devel@lists.xenproject.org>, "sharan.santhanam@neclab.eu"
	<sharan.santhanam@neclab.eu>, "simon.kuenzer@neclab.eu"
	<simon.kuenzer@neclab.eu>
CC: Justin He <Justin.He@arm.com>
Subject: RE: [PATCH] arm/entry: set x0 before cache maintenance.
Thread-Topic: [PATCH] arm/entry: set x0 before cache maintenance.
Thread-Index: AQHW488TyOY7bShZNka1TegvFGeeLaoZ6xSQ
Date: Wed, 6 Jan 2021 03:11:32 +0000
Message-ID:
 <VE1PR08MB47660684061A95FAC4A04146F4D00@VE1PR08MB4766.eurprd08.prod.outlook.com>
References: <20210106015509.17033-1-jianyong.wu@arm.com>
In-Reply-To: <20210106015509.17033-1-jianyong.wu@arm.com>
Accept-Language: en-US
Content-Language: en-US
X-MS-Has-Attach:
X-MS-TNEF-Correlator:
x-ts-tracking-id: F9C559A175B2984AA955E06B6600DC1D.0
x-checkrecipientchecked: true
Authentication-Results-Original: arm.com; dkim=none (message not signed)
 header.d=none;arm.com; dmarc=none action=none header.from=arm.com;
x-originating-ip: [203.126.0.112]
x-ms-publictraffictype: Email
X-MS-Office365-Filtering-HT: Tenant
X-MS-Office365-Filtering-Correlation-Id: f3ad5cf5-984f-48d5-b262-08d8b1f0c8c7
x-ms-traffictypediagnostic: VE1PR08MB5855:|AM6PR08MB5158:
x-ms-exchange-transport-forked: True
X-Microsoft-Antispam-PRVS:
	<AM6PR08MB5158D7CD73BBBD77376FE9CFF4D00@AM6PR08MB5158.eurprd08.prod.outlook.com>
x-checkrecipientrouted: true
nodisclaimer: true
x-ms-oob-tlc-oobclassifiers: OLM:5797;OLM:7691;
X-MS-Exchange-SenderADCheck: 1
X-Microsoft-Antispam-Untrusted: BCL:0;
X-Microsoft-Antispam-Message-Info-Original:
 DWKy1dEmzdKFZSmc60cTBMtfjhTolHRAgrzfdgppxVAi+BiBJ7b2z4igpnZ3yogptHXwY4Yxx4SRVoY7lvGmRV4b08G5r8aU2YP8u0F9YfZgrt/yyE5H0ZOlV7W/9xTNp5BqDTRbMGZkMtNWOZ2iU5Q6JjRTqth1kejxKAaohxax6sV5eQedBlFFIcKQcuDMOw45BN63g+VhCcUGsgtkZSfr6lrvvAvZpTJ/m0rM+8NL90PWPUNthwSZyQnzqbtj9AEMe0RyqN2HgcCQDggqLX3zxAlOUHdiypgvCDfYsECScuSSTRuNo5oVI+n5HML5L6IlX1ZrPEEPD05hGYeomjsIOk702LGEeqc/bvQb6b6QDJJHGdbZGPSxNqEUsHoFzu2mm28XQbq1YjegvUiGsA==
X-Forefront-Antispam-Report-Untrusted:
 CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VE1PR08MB4766.eurprd08.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(136003)(346002)(376002)(366004)(39860400002)(396003)(52536014)(86362001)(64756008)(5660300002)(66446008)(66476007)(66556008)(9686003)(33656002)(7696005)(26005)(76116006)(6506007)(186003)(2906002)(53546011)(66946007)(83380400001)(55016002)(71200400001)(110136005)(8676002)(478600001)(4326008)(316002)(8936002);DIR:OUT;SFP:1101;
x-ms-exchange-antispam-messagedata:
 =?us-ascii?Q?vHboyCOuXu1RfB6VArvrSLFeUOOPd69wKD2LIMFsu+Da+pFZ7B3IL0mXtB2m?=
 =?us-ascii?Q?JaaHf3k7w3kWONhjjjWgAAhtSrMT4nL6Y6T5yIXfHyqKm/lBGt4sklfPb6QR?=
 =?us-ascii?Q?DbVjKC0H9LaOKSE/uq05mmzixowVpMuO1SWvFOtee+Sa/l60ZN2ARDcdNKeN?=
 =?us-ascii?Q?CnwxVWT6P8HSKPrah4TT20mcLV9lkUgHqDszIL0rCQU+DfbAI/tAtB2l/Qp5?=
 =?us-ascii?Q?OEzd5UwY+Hav2A71sftiuhm97q8mm8FP7+VD1SIqs2IHwIWLxbIeGXj/6ke6?=
 =?us-ascii?Q?ygWqhJNGwjvBu8TMGYAo7oJgRTI8oOXcZoqJR1K1CqfsYyyhkBrJJVUCg1nN?=
 =?us-ascii?Q?aHSjtxZJ+ixINdQZlXc0PkaG9TCsuY22LKrvtte7iNVbF52Sb8Xdo7wSmPIH?=
 =?us-ascii?Q?h1v4dU3/jpl1SKAuRfe0/DvSmL4Tviqo+djDc593FeK8UgsrzrHx2mqeaU28?=
 =?us-ascii?Q?ichxGOq5t6E1EgyVBpHK2ImeGgm+P7m2ZrslJUvxWc4KQoBEBsmCKpx8Na4y?=
 =?us-ascii?Q?DxFB4GQo/tjOOyEVQwEyORxKKEc4VfABJ6cTwGh6j8qn4JT4mk5mZ+eIezvO?=
 =?us-ascii?Q?dwINuY38i8zQHXG0cibrMkbyGSkUu0gr9JUwQUqwEacLy1aRkxJJ0oG/BNcZ?=
 =?us-ascii?Q?CT3wgi5brdqFnW8a+vvYpJj1eFFRV7ArwlO0zPvQYOnqoLgXhmaVtbFntj1W?=
 =?us-ascii?Q?faiDvRyha4JOrncXbEqQfuCo8udyCB7vI88ZkvYNzhCNBxE8DDc1gdY2E21x?=
 =?us-ascii?Q?QV8U9oBl6+Yws7I7XNwJK5Bmk5G6gjeVGPhz8aEHf0ywJ6UhWsnPHIwjhP8a?=
 =?us-ascii?Q?GWpEo/BHZzEXzF1/xulOeb1+IoVIw92z/IGZaZ40PmIQtwFhDfj4OxbdOFo7?=
 =?us-ascii?Q?XnUkH2GthWGOa8ic4vEMAK/3dq5XQkIz3MZ5ir+DJDe2wpF5WK61zNKd8i1/?=
 =?us-ascii?Q?WrQkEW/I+bhwam1vkzhBRh2gPEX+4tLcgGRWNe+Hoa4=3D?=
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0
X-MS-Exchange-Transport-CrossTenantHeadersStamped: VE1PR08MB5855
Original-Authentication-Results: arm.com; dkim=none (message not signed)
 header.d=none;arm.com; dmarc=none action=none header.from=arm.com;
X-EOPAttributedMessage: 0
X-MS-Exchange-Transport-CrossTenantHeadersStripped:
 AM5EUR03FT060.eop-EUR03.prod.protection.outlook.com
X-MS-Office365-Filtering-Correlation-Id-Prvs:
	2f234a82-6ae8-454c-ff2a-08d8b1f0c4be
X-Microsoft-Antispam: BCL:0;
X-Microsoft-Antispam-Message-Info:
	UuuMSjTgRtBhkIwjvp/699Jhfl9Oq031hOzIkgidc5LWkrz3yn9qBWpftkT+yzaR0lQR09UObU4r2mJRntrOIPfpe5BcGTOsNvqg5IjXzmOWJUiEhChWbDg9UZCdW7ivK0lMlIJe63pQGvQjQdkN6EQSdTg3i3S2iYoTUbcIcTp3YbmgU6/KMzdqg78CzvDhI8a26Ra3Int+mPTur8/281wiYCRyG75va3bMMkuPR4FzXfujtgDGKGgRBvq3L6sonrxLtj4/pxOIeJjWDCiLJk6nq18eLycwemhJPTwBhjGUwdkgPeUh6heOuDkumYzHzePizh2Gvx5gHsPPOd2FHCiGDLS4nhL8m98AIqGfTsz2giwIrg1+x2IrWVYN1ROjSJwAhe3lAigqSHeRBP2E8TkhIPsC4QzRiWb8zSlHkjAd/kz9pzLD9McDhwx109YbQp5VdTjUXANp8s9xUMN3bzIamvZxvKT5JKg9ipQZmw5T91W53r/mzP4vIm3bsDa/
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)(376002)(136003)(346002)(39860400002)(396003)(46966006)(9686003)(26005)(47076005)(186003)(33656002)(70586007)(478600001)(5660300002)(81166007)(34070700002)(8936002)(53546011)(55016002)(70206006)(4326008)(6506007)(8676002)(86362001)(82740400003)(83380400001)(7696005)(82310400003)(356005)(52536014)(2906002)(336012)(316002)(110136005);DIR:OUT;SFP:1101;
X-OriginatorOrg: arm.com
X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Jan 2021 03:11:39.0953
 (UTC)
X-MS-Exchange-CrossTenant-Network-Message-Id: f3ad5cf5-984f-48d5-b262-08d8b1f0c8c7
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:
	AM5EUR03FT060.eop-EUR03.prod.protection.outlook.com
X-MS-Exchange-CrossTenant-AuthAs: Anonymous
X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem
X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR08MB5158

Sorry to have make mistake in this email. please neglect it.

> -----Original Message-----
> From: Jianyong Wu <jianyong.wu@arm.com>
> Sent: Wednesday, January 6, 2021 9:55 AM
> To: minios-devel@lists.xenproject.org; sharan.santhanam@neclab.eu;
> simon.kuenzer@neclab.eu
> Cc: Justin He <Justin.He@arm.com>; Jianyong Wu <Jianyong.Wu@arm.com>
> Subject: [PATCH] arm/entry: set x0 before cache maintenance.
>
> There is a long standing issue in entry code of arm that x0 is not set be=
fore
> using it in clean_and_invalidate_dcache_range. This error can be caught b=
y
> kvm and result in core dump.
> Here, x0 is set to the base address of dtb before cache maintain.
>
> Jira: ENTOS-2050
> Signed-off-by: Jianyong Wu <jianyong.wu@arm.com>
> Change-Id: Ia81f5c65c19a33b7a640efcd4d3117f61c59dd28
> ---
>  plat/kvm/arm/entry64.S | 6 ++++++
>  1 file changed, 6 insertions(+)
>
> diff --git a/plat/kvm/arm/entry64.S b/plat/kvm/arm/entry64.S index
> c4de334..0526ae8 100644
> --- a/plat/kvm/arm/entry64.S
> +++ b/plat/kvm/arm/entry64.S
> @@ -92,6 +92,12 @@ ENTRY(_libkvmplat_entry)
>  add x27, x26, x17
>  add x27, x27, #__STACK_SIZE
>  sub x1, x27, x25
> +
> +/*
> + * set x0 to the location stores dtb as the base address of the
> + * memory range to be cache maintained
> + */
> +ldr x0, =3D_dtb
>  bl clean_and_invalidate_dcache_range
>
>  /* Disable the MMU and D-Cache. */
> --
> 2.17.1

IMPORTANT NOTICE: The contents of this email and any attachments are confid=
ential and may also be privileged. If you are not the intended recipient, p=
lease 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 Wed Jan 06 03:19:06 2021
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Wed, 06 Jan 2021 03:19:06 +0000
Received: from list by lists.xenproject.org with outflank-mailman.62285.110219 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1kwzLl-0002nn-FY; Wed, 06 Jan 2021 03:19:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 62285.110219; Wed, 06 Jan 2021 03:19: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 1kwzLl-0002ng-C7; Wed, 06 Jan 2021 03:19:05 +0000
Received: by outflank-mailman (input) for mailman id 62285;
 Wed, 06 Jan 2021 03:19:04 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=Dki+=GJ=arm.com=jianyong.wu@srs-us1.protection.inumbo.net>)
 id 1kwzLk-0002nb-0M
 for minios-devel@lists.xenproject.org; Wed, 06 Jan 2021 03:19:04 +0000
Received: from EUR05-VI1-obe.outbound.protection.outlook.com (unknown
 [40.107.21.50]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 44ac15fe-e832-4632-810f-12b029ae66f4;
 Wed, 06 Jan 2021 03:19:00 +0000 (UTC)
Received: from DB7PR03CA0077.eurprd03.prod.outlook.com (2603:10a6:10:72::18)
 by DBBPR08MB4267.eurprd08.prod.outlook.com (2603:10a6:10:cb::22) with
 Microsoft SMTP Server (version=TLS1_2,
 cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3721.23; Wed, 6 Jan
 2021 03:18:58 +0000
Received: from DB5EUR03FT016.eop-EUR03.prod.protection.outlook.com
 (2603:10a6:10:72:cafe::c3) by DB7PR03CA0077.outlook.office365.com
 (2603:10a6:10:72::18) with Microsoft SMTP Server (version=TLS1_2,
 cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3742.6 via Frontend
 Transport; Wed, 6 Jan 2021 03:18:58 +0000
Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by
 DB5EUR03FT016.mail.protection.outlook.com (10.152.20.141) with
 Microsoft SMTP
 Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id
 15.20.3742.6 via Frontend Transport; Wed, 6 Jan 2021 03:18:57 +0000
Received: ("Tessian outbound 6af064f543d4:v71");
 Wed, 06 Jan 2021 03:18:57 +0000
Received: from 748df5707e40.2
 by 64aa7808-outbound-1.mta.getcheckrecipient.com id
 7DBBF827-0607-427A-8AAB-A8EC78FE9C04.1; 
 Wed, 06 Jan 2021 03:18:51 +0000
Received: from EUR05-AM6-obe.outbound.protection.outlook.com
 by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 748df5707e40.2
 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384);
 Wed, 06 Jan 2021 03:18:51 +0000
Received: from VE1PR08MB4766.eurprd08.prod.outlook.com (2603:10a6:802:a9::18)
 by VI1PR08MB5357.eurprd08.prod.outlook.com (2603:10a6:803:12e::21)
 with Microsoft SMTP Server (version=TLS1_2,
 cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3742.6; Wed, 6 Jan
 2021 03:18:50 +0000
Received: from VE1PR08MB4766.eurprd08.prod.outlook.com
 ([fe80::9cb0:dfc6:9464:a3d8]) by VE1PR08MB4766.eurprd08.prod.outlook.com
 ([fe80::9cb0:dfc6:9464:a3d8%2]) with mapi id 15.20.3721.024; Wed, 6 Jan 2021
 03:18:50 +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: 44ac15fe-e832-4632-810f-12b029ae66f4
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=AaDcGcaE4nbafJlECE21WZihgN7XRASWPs7GaYcmu2s=;
 b=jDQ8bqRqFcTP8sasQT93T36xYovlo6le9XG1K8GueUj8kdFxR/K1V7vR7PFtqzmvhHu2Q1DbI+dtwZp/lZ8wu+d43n221QZ8KQn/Wl6QWK4P1IUP3u97mKrStzTOlHc2OAzHbjopNWLQ6amXF5z1nFO4CjN8Ton1lftxV4K1ZKM=
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-CheckRecipientChecked: true
X-CR-MTA-CID: dece3a04cf6a6506
X-CR-MTA-TID: 64aa7808
ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none;
 b=gY8RVUFwcEjgCToZgP6uY6NJKk62NFM8frPzuaMBTKABAGaZV7LuA0/Rv93xzBiguJyKMWc/mn/SC4zOEhttioas8TfamAQwuGvg55NFkqetMzzEe3Mz5E1INdGk3S5gN+mPgCdLCGzpMDp89kJFzsqjRuvogHC1qgm3EAYb/R+JC//xOiRqf+AWKPCphcDqpUVRZ+4HGQ+jb1jWxg2loJJ2tnso/jAwnbl8T36vE1TKEP15j6ekands8Kry278Jm6dPo/Ivnv7ZcvXLj0Rzh9ldehvNgXPVoAInj5Xl3I0Fq+GBFj+JwZLMCTXFb3loOK/QsRzCev+U+P3ixQWHLA==
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=AaDcGcaE4nbafJlECE21WZihgN7XRASWPs7GaYcmu2s=;
 b=GwJfUY471oWUR2fTJC38BVuccGW1jc93O1yvxaIjmaQxOZ4ZmYQNZZ5kaBjcURKrNchVT372dW5JLNqOw4pMJZRUwxL+LHbNTlMsfwQ7aKH7KcopvTYZgEaTDZudIw2bKd9E6YP+5wO9O3AI1yHNAac8pmV5SedazA28N3x0eASM2BxebTTedMTtovaUCg5+xgJKXXIISfyHAD5CCeDRQuNvmC53M66UU72vHU+08Ym5v/+Ert7aHu2fvz/mTODtPelgCDke50y++drp36ytop6fQu2d9HMfAhzCRPVcGsinTeThx3DZ4ZWlpeI2uPLXvN3J6ZMjXlvLg7sEDq7dEQ==
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=AaDcGcaE4nbafJlECE21WZihgN7XRASWPs7GaYcmu2s=;
 b=jDQ8bqRqFcTP8sasQT93T36xYovlo6le9XG1K8GueUj8kdFxR/K1V7vR7PFtqzmvhHu2Q1DbI+dtwZp/lZ8wu+d43n221QZ8KQn/Wl6QWK4P1IUP3u97mKrStzTOlHc2OAzHbjopNWLQ6amXF5z1nFO4CjN8Ton1lftxV4K1ZKM=
From: Jianyong Wu <Jianyong.Wu@arm.com>
To: Jianyong Wu <Jianyong.Wu@arm.com>, "minios-devel@lists.xenproject.org"
	<minios-devel@lists.xenproject.org>, "sharan.santhanam@neclab.eu"
	<sharan.santhanam@neclab.eu>, "simon.kuenzer@neclab.eu"
	<simon.kuenzer@neclab.eu>
CC: Justin He <Justin.He@arm.com>
Subject: Recall: [PATCH] arm/entry: set x0 before cache maintenance.
Thread-Topic: [PATCH] arm/entry: set x0 before cache maintenance.
Thread-Index: AQHW49qn5Oe/j7uguEuwwZ/5Un9Q7g==
X-CallingTelephoneNumber: IPM.Note
X-VoiceMessageDuration: 1
X-FaxNumberOfPages: 0
Date: Wed, 6 Jan 2021 03:18:50 +0000
Message-ID:
 <VE1PR08MB4766EDA545CB6FE9205FC9B4F4D00@VE1PR08MB4766.eurprd08.prod.outlook.com>
Accept-Language: en-US
Content-Language: en-US
X-MS-Has-Attach:
X-MS-TNEF-Correlator:
Authentication-Results-Original: arm.com; dkim=none (message not signed)
 header.d=none;arm.com; dmarc=none action=none header.from=arm.com;
x-originating-ip: [203.126.0.112]
x-ms-publictraffictype: Email
X-MS-Office365-Filtering-HT: Tenant
X-MS-Office365-Filtering-Correlation-Id: 794c7c49-9419-4fcc-b013-08d8b1f1ce39
x-ms-traffictypediagnostic: VI1PR08MB5357:|DBBPR08MB4267:
x-ms-exchange-transport-forked: True
X-Microsoft-Antispam-PRVS:
	<DBBPR08MB42674CDA99CCA077EC41B642F4D00@DBBPR08MB4267.eurprd08.prod.outlook.com>
x-checkrecipientrouted: true
nodisclaimer: true
x-ms-oob-tlc-oobclassifiers: OLM:4303;OLM:9508;
X-MS-Exchange-SenderADCheck: 1
X-Microsoft-Antispam-Untrusted: BCL:0;
X-Microsoft-Antispam-Message-Info-Original:
 wmdDUduatKrLh6/PK6mZ1PmUfJV+FxJ9Uo33Pp2CW5aQAjyBxfiLPtPqDS5KJX/3oDdANy2si3F0ThEKkfuvTEDIYCTUQZ9z58IalColhENySh4zNPylNp44OYEHPuLKRWK7Jb9549DdOiUhylzoyKJ01+ZuN3RWxQeVDu8gGHtPm3BLQwB1QXLz6M4Cdf8nrYhDZ1Rua2qrabPsPPxoBwZOuWu8Yk4b+/AW8XlnFrAtWDcT+WQxOdiG4W1cYXyVHcQUyHaEXS0rvJE6oyqF8rSS6hWUjKKuKJrD/onybb9McFqqhlUQ/+eUfJzzeSWHoDu72B3HjT7JHXEZHhBJam8UutObDMudL2iMZ4eQj6PTB6RuzO+H0XOZ35XdTMTUGCQtZvy0bEXFh1KX9NI04Q==
X-Forefront-Antispam-Report-Untrusted:
 CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VE1PR08MB4766.eurprd08.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(136003)(366004)(39860400002)(376002)(346002)(396003)(2906002)(4326008)(33656002)(6506007)(76116006)(83380400001)(7696005)(86362001)(5660300002)(55016002)(9686003)(4744005)(316002)(66476007)(186003)(66446008)(66946007)(66556008)(64756008)(52536014)(110136005)(478600001)(26005)(71200400001)(8936002)(8676002);DIR:OUT;SFP:1101;
x-ms-exchange-antispam-messagedata:
 =?us-ascii?Q?2gc3iyzkgWqIZfba/in9V4juqJCw88GtlknIPb1jWrfvfgaTl4zzcNxLDR0q?=
 =?us-ascii?Q?KOkkZuw8/z2pzq4H8lB/sXeb9oZtbHoLBFsPdZi9SzAlldRcvlED4ygHCaCG?=
 =?us-ascii?Q?p+DT/njvKFyxGUbHSk21TVX9qdIZPlbavtW0c2KwXu/TEEjGl8LdcbABeyKn?=
 =?us-ascii?Q?vR2lDGgvz5G70d6JIjw8zvdbPe3izI8dKi7HgppLPAmy8wkkhcJNCl2g1Gu7?=
 =?us-ascii?Q?qT9aEC0YO6YuPHGcH5wvQ4mA14COw59XeizZZZ9LPomuEXJuUyICXB0cm2UI?=
 =?us-ascii?Q?h0StokPnxElBPwuue/6n4a4rIlr64MlfoFpvr2V5LwIcwoxbdP6KOPfurJ4S?=
 =?us-ascii?Q?2smxFVcp6JMWzqW9rSqx1qgCe0q8qATj3GayIHjkcwyqF+bCCT7cEA4jFCl/?=
 =?us-ascii?Q?5LD23nuFUHujSoUqat0FK5Rq6MAmkgxLT56vuegZiRc/8kzxXzBE8kI1O+bs?=
 =?us-ascii?Q?z2GXqytishI4acZ7kSZD90wZo7rnp+gan8JJzyKpwDoNst5qMHb6kYyvz/hB?=
 =?us-ascii?Q?SF8Ct0re27gM1aOx/766mCKlNEGoSJ4wH7dawvcrlmWZtA/vEkDEOmzJODxO?=
 =?us-ascii?Q?KI2kDqsP1Qv1WjGa4gQuqovLoKoOKQBWLfGJD4lcRNVo/uuQTPlVChG7UK6w?=
 =?us-ascii?Q?crdY38Marcvp/9xdQS8nP7laTF/4otp1m2lJx1Pb1FGTzYY8S0Vo3IPwU5Nv?=
 =?us-ascii?Q?0Z4dsTtcpEa2U08TwhgOrdNpRLLbjZFSkUq2faK8DshabrrkCsLmRafCEL68?=
 =?us-ascii?Q?PnGCQ+Gsh8GW312STarnX1tAiQbggDUB5irkYe4xaMXcTSYDfC0qLAUxpFAp?=
 =?us-ascii?Q?nQkuPe9XR8gWEvB+y83F7vdWuPD7HbHMwvnQale+pWngDIMcgPFoDmF5RzGu?=
 =?us-ascii?Q?ROarBFfb6gJ5nqVPNVrwccfW5Ou1V9VRDXORiFm/4xIp382kNHmNFFAJyuLm?=
 =?us-ascii?Q?Dar01HZZeGtRNulTz9EuKr42yEk9D2UiJ9x4I562GbQ=3D?=
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0
X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR08MB5357
Original-Authentication-Results: arm.com; dkim=none (message not signed)
 header.d=none;arm.com; dmarc=none action=none header.from=arm.com;
X-EOPAttributedMessage: 0
X-MS-Exchange-Transport-CrossTenantHeadersStripped:
 DB5EUR03FT016.eop-EUR03.prod.protection.outlook.com
X-MS-Office365-Filtering-Correlation-Id-Prvs:
	b6739925-b7b6-47cf-b65d-08d8b1f1ca08
X-Microsoft-Antispam: BCL:0;
X-Microsoft-Antispam-Message-Info:
	vOAy4JczAegxykd1SkTCJzBFqpM6OQB/hRQrNBK7bmk2kh80DJ25N2ZWninksmW8TIbKQsQgZFj6HYcOkAf/YUlu8d1EUuyi4wLM1ZSByvmdLlgJGcEtAwqKC11SF2ofdQjo8kQ+irlIXqgC9UNB7F6cQDuVtO5Fjvou9XFTJ3+CAcL+vsNG88VKo3DrFPQpTKk07o5RzbMXEiHrnbDvVc0wrJS2fDPiQSwZxsnFCcS4rXDDfOv58DwngMJjTWbjsr+L6JfIupd8VleWdbDAkGqgnkQSx8SibUUq7s0wkuE6rHejh1J5XfwNwjwWVa6EAkYwtxq+4M5GYWbY5RI2u8B+n8FZ5SDZr79XMKQbNEckNCf1gkzOpsSRmkBad11ATofafNUYtqSoQ5qyh4zEsH9igDtponJn4LXXIdcCtC8ABSA8/4vCa9KbA5XzESmQMVTDzmss07Qpgkt3ntKc+ycTGmvBG7G12h1pA4UVklyRfUNN9J8Lb+8kGvv8nRPW
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)(346002)(376002)(136003)(396003)(39860400002)(46966006)(356005)(83380400001)(316002)(82310400003)(82740400003)(4326008)(7696005)(81166007)(47076005)(2906002)(26005)(8676002)(52536014)(8936002)(186003)(336012)(478600001)(70206006)(6506007)(86362001)(55016002)(110136005)(33656002)(9686003)(4744005)(5660300002)(70586007)(34070700002);DIR:OUT;SFP:1101;
X-OriginatorOrg: arm.com
X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Jan 2021 03:18:57.7977
 (UTC)
X-MS-Exchange-CrossTenant-Network-Message-Id: 794c7c49-9419-4fcc-b013-08d8b1f1ce39
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:
	DB5EUR03FT016.eop-EUR03.prod.protection.outlook.com
X-MS-Exchange-CrossTenant-AuthAs: Anonymous
X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem
X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBBPR08MB4267

Jianyong Wu would like to recall the message, "[PATCH] arm/entry: set x0 be=
fore cache maintenance.".
IMPORTANT NOTICE: The contents of this email and any attachments are confid=
ential and may also be privileged. If you are not the intended recipient, p=
lease 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 Wed Jan 06 03:26:01 2021
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Wed, 06 Jan 2021 03:26:01 +0000
Received: from list by lists.xenproject.org with outflank-mailman.62287.110222 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1kwzST-0003pk-18; Wed, 06 Jan 2021 03:26:01 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 62287.110222; Wed, 06 Jan 2021 03:26:01 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1kwzSS-0003pd-UZ; Wed, 06 Jan 2021 03:26:00 +0000
Received: by outflank-mailman (input) for mailman id 62287;
 Wed, 06 Jan 2021 03:26: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=Dki+=GJ=arm.com=jianyong.wu@srs-us1.protection.inumbo.net>)
 id 1kwzSS-0003pY-CP
 for minios-devel@lists.xenproject.org; Wed, 06 Jan 2021 03:26:00 +0000
Received: from foss.arm.com (unknown [217.140.110.172])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTP
 id 8a562039-a5d3-4558-a126-6a48a699169f;
 Wed, 06 Jan 2021 03:25: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 4990B31B;
 Tue,  5 Jan 2021 19:25:59 -0800 (PST)
Received: from entos-thunderx2-desktop.shanghai.arm.com
 (entos-thunderx2-desktop.shanghai.arm.com [10.169.212.206])
 by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 4C26D3F719;
 Tue,  5 Jan 2021 19:25: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: 8a562039-a5d3-4558-a126-6a48a699169f
From: Jianyong Wu <jianyong.wu@arm.com>
To: minios-devel@lists.xenproject.org,
	sharan.santhanam@neclab.eu,
	simon.kuenzer@neclab.eu,
	jianyong.wu@arm.com
Cc: justin.he@arm.com
Subject: [PATCH] arm/entry: set x0 before cache maintenance.
Date: Wed,  6 Jan 2021 11:25:42 +0800
Message-Id: <20210106032542.33036-1-jianyong.wu@arm.com>
X-Mailer: git-send-email 2.17.1

There is a long standing issue in entry code of arm that x0 is not
set before using it in clean_and_invalidate_dcache_range. This error
can be caught by kvm and result in core dump.
Here, x0 is set to the base address of dtb before cache maintain.

Signed-off-by: Jianyong Wu <jianyong.wu@arm.com>
---
 plat/kvm/arm/entry64.S | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/plat/kvm/arm/entry64.S b/plat/kvm/arm/entry64.S
index c4de334..0526ae8 100644
--- a/plat/kvm/arm/entry64.S
+++ b/plat/kvm/arm/entry64.S
@@ -92,6 +92,12 @@ ENTRY(_libkvmplat_entry)
 	add x27, x26, x17
 	add x27, x27, #__STACK_SIZE
 	sub x1, x27, x25
+
+	/*
+	 * set x0 to the location stores dtb as the base address of the
+	 * memory range to be cache maintained
+	 */
+	ldr x0, =_dtb
 	bl clean_and_invalidate_dcache_range
 
 	/* Disable the MMU and D-Cache. */
-- 
2.17.1



From minios-devel-bounces@lists.xenproject.org Thu Jan 07 16:22:12 2021
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Thu, 07 Jan 2021 16:22:12 +0000
Received: from list by lists.xenproject.org with outflank-mailman.62978.111761 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1kxY38-00015o-UB; Thu, 07 Jan 2021 16:22:10 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 62978.111761; Thu, 07 Jan 2021 16:22: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 1kxY38-00015Y-Jx; Thu, 07 Jan 2021 16:22:10 +0000
Received: by outflank-mailman (input) for mailman id 62978;
 Thu, 07 Jan 2021 16:22: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=g3Qq=GK=gmail.com=lrbarbulescu@srs-us1.protection.inumbo.net>)
 id 1kxY36-00014u-Um
 for minios-devel@lists.xen.org; Thu, 07 Jan 2021 16:22:09 +0000
Received: from mail-lf1-x12d.google.com (unknown [2a00:1450:4864:20::12d])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 21fee948-4435-4057-9bae-6c6efa744a7e;
 Thu, 07 Jan 2021 16:22:07 +0000 (UTC)
Received: by mail-lf1-x12d.google.com with SMTP id 23so15830694lfg.10
 for <minios-devel@lists.xen.org>; Thu, 07 Jan 2021 08:22: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: 21fee948-4435-4057-9bae-6c6efa744a7e
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=Dv2cNmmW1YsM+5sm9w0c1pkqD5m+2XBYr5CLr+t4jdw=;
        b=iK6OI/RLx16yDt1nJ8fHZ5mtJgRNSpzOmmMLQbV5D+BYtxC5jfyYIDvdqOr/RuEgAA
         /Fr3xvyKn+EfpyyUOC1iHBAN3btXAiXWiqA0G17/X9WjFVX8Cit47EXGGlqIzICdFRxb
         IJ10pOqfjOiHtGtolmP358VvHU0OI7ZuODyvdW9cLQbko33waUFtPeVLXNWKk9JcJ8nA
         O2PY54e2vACPpUQRKurY0Mjmy7TlfGnsCG5Q1TlnxUBeSbdRTt5tAvUcsA9ZtkIJi7q0
         gifpqkCWzjP0JEDVu5cViWSj1MSY1gPuYOUzeqtTfssxth7wbZ68GBgKIqgENgLwcoPI
         PSwQ==
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=Dv2cNmmW1YsM+5sm9w0c1pkqD5m+2XBYr5CLr+t4jdw=;
        b=rZP0vjUzGL0pDSqVBT+bWzIVDJmZIePvIyvzxjW2Y17tv/jG3P8rp664s7zlpYE1ya
         9658ebAXOp+B6fkubtki8rW+LW8P/dj1d0Fks/0SnKjjRbxV0yiD++lTkYChjpeYnLnT
         nCH7ywg+W653TGWeB1MsZaxPuVVwR+fKfYTfaRjxzlw2peg0eGxaurxh0SspxvXwjF8g
         CNJ8DZjjd3ZhrNVBIQvDwxiLa4wNwlM9u3YhE07Eke8mW4HC8/0yEM6AE3nn1K8K2aLa
         YgtDk2KrEP75MHfCpG5+7cV2tnjfUsIi3BxJ7GCVgzb40Zy/uCLeaTAXiuLaBYqf10Vb
         JZMw==
X-Gm-Message-State: AOAM531k6+wq0LLwQTAEKW7XSucpoWkbhhVryr96kRRexdXfISfVm4k2
	NIM3J++TWVRnCEtyRbU38vmNKV+3ZIhI1SHt2dg=
X-Google-Smtp-Source: ABdhPJy4RBXG4Aw5Lmp1gy1maGxQ5rmJnf5wTKSJWme+Bm8tcOGqIODSvuHloUTWMuQzaiqRcj+wAd/NGb3f1ufYmAA=
X-Received: by 2002:a2e:9849:: with SMTP id e9mr4664363ljj.319.1610036525894;
 Thu, 07 Jan 2021 08:22:05 -0800 (PST)
MIME-Version: 1.0
References: <20201120154612.27579-1-simon.kuenzer@neclab.eu>
In-Reply-To: <20201120154612.27579-1-simon.kuenzer@neclab.eu>
From: Laurentiu Barbulescu <lrbarbulescu@gmail.com>
Date: Thu, 7 Jan 2021 18:21:50 +0200
Message-ID: <CAMpNDKkkQ774BPHz=Z8Y0BxSG2Ry7mkoE_ff1j1YkPtidBoh9Q@mail.gmail.com>
Subject: Re: [UNIKRAFT PATCH 00/18] Allocator statistics
To: Simon Kuenzer <simon.kuenzer@neclab.eu>
Cc: minios-devel@lists.xen.org, Felipe Huici <felipe.huici@neclab.eu>, 
	Sharan Santhanam <sharan.santhanam@neclab.eu>
Content-Type: multipart/alternative; boundary="00000000000033910a05b851d74d"

--00000000000033910a05b851d74d
Content-Type: text/plain; charset="UTF-8"

Hi Simon,

I was delegated to review only a part of this patch series
(patches from 1 to 9).
Great work overall, but I have some comments which I will
leave inline at the corresponding patches(1, 5, 6 and 7).

Best wishes,
Laurentiu

On Fri, Nov 20, 2020 at 5:46 PM Simon Kuenzer <simon.kuenzer@neclab.eu>
wrote:

> This patch series introduces allocator statistics. With minimal
> instrumentation, allocators can report counters on allocation
> and freeing events that happened.
> For example, the following could be queried per allocator:
>
>  last_alloc_size:         230 B /* size of the last allocation */
>  max_alloc_size:         4096 B /* biggest satisfied allocation size */
>  min_alloc_size:           12 B /* smallest satisfied allocation size */
>  tot_nb_allocs:            75   /* total number of satisfied allocations */
>  tot_nb_frees:             22   /* total number of satisfied free
> operations */
>  cur_nb_allocs:            53   /* current number of active allocations */
>  max_nb_allocs:            53   /* maximum number of active allocations */
>  max_mem_use:          218023 B /* maximum amount of memory that was in
> use */
>  cur_mem_use:          217088 B /* current amount of memory that is in use
> */
>  nb_enomem:                 0   /* number of times failing allocation
> requests */
>
> Note: The meaning of `CONFIG_IFSTAT` changes with this patch series.
> The configuration option originally raised wrong expectations while it
> it just provided an API to query the amount of available memory from
> an allocator. `CONFIG_IFSTAT` is now enabling these detailed allocator
> statistics.
>
> Note: Since this patch series changes some details on the internal ukalloc
> API (`<uk/alloc_impl.h>`), external memory allocators (like TLSF, mimalloc)
> need to be adopted as well. For retrieving statistics from them, they also
> need to be instrumented to count alloc and free events.
>
> The first four commits are doing minor corrections of the API headers.
> Afterwards, the statistics API is introduced. Additionally, the last
> commits introduce a one consolidated global allocator statistics, as
> well as a per library allocator statistics. `lib/nolibc` had to
> instrumented in order to support per-library statistics properly.
> Similar to `nolibc`, `newlib` and `musl` need to be instrumented, too to
> properly support per-library statistics for libc allocation interfaces:
> malloc(), calloc(), free(), etc.
>
> Simon Kuenzer (18):
>   lib/ukalloc: Correct BSD license header
>   lib/ukalloc: Move ifpages comment
>   lib/ukalloc: `extern C {` at the beginning of <uk/alloc.h>
>   lib/ukalloc: Move `uk_zalloc()` after `uk_calloc()`
>   lib/ukalloc: Introduce `uk_alloc_maxalloc()` and make
>     `uk_alloc_availmem()` available
>   lib/ukalloc: Introduce `uk_alloc_pavail()`, `uk_alloc_pmaxalloc()`
>   lib/ukalloc: Wrappers for "fee memory" interfaces
>   lib/ukalloc: Iterator helper for allocators
>   lib/ukalloc: Introduce `uk_alloc_availmem_total(),
>     `uk_alloc_pavail_total()`
>   lib/ukalloc: Allocator statistics
>   lib/ukalloc: Global statistics
>   lib/ukallocbbuddy: Instrumentation for statistics
>   lib/ukallocregion: Internal functions as `static`
>   lib/ukallocregion: Instrumentation for statistics
>   lib/ukalloc: Per-library allocation statistics
>   lib/ukalloc: Iterator for per-library statistics
>   lib/ukalloc: Use Unikraft internal types
>   lib/nolibc: Enable per-library allocator statistics
>
>  lib/nolibc/Makefile.uk                   |   1 -
>  lib/nolibc/include/stdlib.h              |  39 ++-
>  lib/ukalloc/Config.uk                    |  29 ++-
>  lib/ukalloc/Makefile.uk                  |   5 +
>  lib/ukalloc/alloc.c                      | 225 ++++++++++------
>  lib/ukalloc/exportsyms.uk                |   9 +
>  lib/ukalloc/include/uk/alloc.h           | 174 +++++++++----
>  lib/ukalloc/include/uk/alloc_impl.h      | 179 +++++++++++--
>  lib/ukalloc/libstats.c                   | 311 +++++++++++++++++++++++
>  lib/ukalloc/libstats.ld                  |   9 +
>  lib/ukalloc/libstats.localsyms.uk        |   2 +
>  lib/{nolibc/malloc.c => ukalloc/stats.c} |  56 ++--
>  lib/ukallocbbuddy/bbuddy.c               |  50 +++-
>  lib/ukallocregion/region.c               |  54 +++-
>  plat/common/include/pci/pci_bus.h        |   2 +
>  plat/common/memory.c                     |   2 +
>  plat/xen/gnttab.c                        |   1 +
>  plat/xen/memory.c                        |   2 +
>  plat/xen/x86/gnttab.c                    |   1 +
>  19 files changed, 952 insertions(+), 199 deletions(-)
>  create mode 100644 lib/ukalloc/libstats.c
>  create mode 100644 lib/ukalloc/libstats.ld
>  create mode 100644 lib/ukalloc/libstats.localsyms.uk
>  rename lib/{nolibc/malloc.c => ukalloc/stats.c} (62%)
>
> --
> 2.20.1
>
>

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

<div dir=3D"ltr">Hi Simon,<br><br>I was delegated to review only a part of =
this patch series<br>(patches from 1 to 9).<br>Great work overall, but I ha=
ve some comments which I will<br>leave inline at the corresponding patches(=
1, 5, 6 and 7).<br><br>Best wishes,<br>Laurentiu<br></div><br><div class=3D=
"gmail_quote"><div dir=3D"ltr" class=3D"gmail_attr">On Fri, Nov 20, 2020 at=
 5:46 PM Simon Kuenzer &lt;<a href=3D"mailto:simon.kuenzer@neclab.eu">simon=
.kuenzer@neclab.eu</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">This patch series introduces allocator statistics. With m=
inimal<br>
instrumentation, allocators can report counters on allocation<br>
and freeing events that happened.<br>
For example, the following could be queried per allocator:<br>
<br>
=C2=A0last_alloc_size:=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0230 B /* size of th=
e last allocation */<br>
=C2=A0max_alloc_size:=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A04096 B /* biggest sa=
tisfied allocation size */<br>
=C2=A0min_alloc_size:=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A012 B /* small=
est satisfied allocation size */<br>
=C2=A0tot_nb_allocs:=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 75=C2=A0 =C2=
=A0/* total number of satisfied allocations */<br>
=C2=A0tot_nb_frees:=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A022=C2=A0=
 =C2=A0/* total number of satisfied free operations */<br>
=C2=A0cur_nb_allocs:=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 53=C2=A0 =C2=
=A0/* current number of active allocations */<br>
=C2=A0max_nb_allocs:=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 53=C2=A0 =C2=
=A0/* maximum number of active allocations */<br>
=C2=A0max_mem_use:=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 218023 B /* maximum am=
ount of memory that was in use */<br>
=C2=A0cur_mem_use:=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 217088 B /* current am=
ount of memory that is in use */<br>
=C2=A0nb_enomem:=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A00=C2=A0 =C2=A0/* number of times failing allocation requests */<br>
<br>
Note: The meaning of `CONFIG_IFSTAT` changes with this patch series.<br>
The configuration option originally raised wrong expectations while it<br>
it just provided an API to query the amount of available memory from<br>
an allocator. `CONFIG_IFSTAT` is now enabling these detailed allocator<br>
statistics.<br>
<br>
Note: Since this patch series changes some details on the internal ukalloc<=
br>
API (`&lt;uk/alloc_impl.h&gt;`), external memory allocators (like TLSF, mim=
alloc)<br>
need to be adopted as well. For retrieving statistics from them, they also<=
br>
need to be instrumented to count alloc and free events.<br>
<br>
The first four commits are doing minor corrections of the API headers.<br>
Afterwards, the statistics API is introduced. Additionally, the last<br>
commits introduce a one consolidated global allocator statistics, as<br>
well as a per library allocator statistics. `lib/nolibc` had to<br>
instrumented in order to support per-library statistics properly.<br>
Similar to `nolibc`, `newlib` and `musl` need to be instrumented, too to<br=
>
properly support per-library statistics for libc allocation interfaces:<br>
malloc(), calloc(), free(), etc.<br>
<br>
Simon Kuenzer (18):<br>
=C2=A0 lib/ukalloc: Correct BSD license header<br>
=C2=A0 lib/ukalloc: Move ifpages comment<br>
=C2=A0 lib/ukalloc: `extern C {` at the beginning of &lt;uk/alloc.h&gt;<br>
=C2=A0 lib/ukalloc: Move `uk_zalloc()` after `uk_calloc()`<br>
=C2=A0 lib/ukalloc: Introduce `uk_alloc_maxalloc()` and make<br>
=C2=A0 =C2=A0 `uk_alloc_availmem()` available<br>
=C2=A0 lib/ukalloc: Introduce `uk_alloc_pavail()`, `uk_alloc_pmaxalloc()`<b=
r>
=C2=A0 lib/ukalloc: Wrappers for &quot;fee memory&quot; interfaces<br>
=C2=A0 lib/ukalloc: Iterator helper for allocators<br>
=C2=A0 lib/ukalloc: Introduce `uk_alloc_availmem_total(),<br>
=C2=A0 =C2=A0 `uk_alloc_pavail_total()`<br>
=C2=A0 lib/ukalloc: Allocator statistics<br>
=C2=A0 lib/ukalloc: Global statistics<br>
=C2=A0 lib/ukallocbbuddy: Instrumentation for statistics<br>
=C2=A0 lib/ukallocregion: Internal functions as `static`<br>
=C2=A0 lib/ukallocregion: Instrumentation for statistics<br>
=C2=A0 lib/ukalloc: Per-library allocation statistics<br>
=C2=A0 lib/ukalloc: Iterator for per-library statistics<br>
=C2=A0 lib/ukalloc: Use Unikraft internal types<br>
=C2=A0 lib/nolibc: Enable per-library allocator statistics<br>
<br>
=C2=A0lib/nolibc/Makefile.uk=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0|=C2=A0 =C2=A01 -<br>
=C2=A0lib/nolibc/include/stdlib.h=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 |=C2=A0 39 ++-<br>
=C2=A0lib/ukalloc/Config.uk=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0=
 =C2=A0 =C2=A0 =C2=A0 |=C2=A0 29 ++-<br>
=C2=A0lib/ukalloc/Makefile.uk=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 |=C2=A0 =C2=A05 +<br>
=C2=A0lib/ukalloc/alloc.c=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 | 225 ++++++++++------<br>
=C2=A0lib/ukalloc/<a href=3D"http://exportsyms.uk" rel=3D"noreferrer" targe=
t=3D"_blank">exportsyms.uk</a>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 |=C2=A0 =C2=A09 +<br>
=C2=A0lib/ukalloc/include/uk/alloc.h=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0| 174 +++++++++----<br>
=C2=A0lib/ukalloc/include/uk/alloc_impl.h=C2=A0 =C2=A0 =C2=A0 | 179 +++++++=
++++--<br>
=C2=A0lib/ukalloc/libstats.c=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0| 311 +++++++++++++++++++++++<br>
=C2=A0lib/ukalloc/libstats.ld=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 |=C2=A0 =C2=A09 +<br>
=C2=A0lib/ukalloc/<a href=3D"http://libstats.localsyms.uk" rel=3D"noreferre=
r" target=3D"_blank">libstats.localsyms.uk</a>=C2=A0 =C2=A0 =C2=A0 =C2=A0 |=
=C2=A0 =C2=A02 +<br>
=C2=A0lib/{nolibc/malloc.c =3D&gt; ukalloc/stats.c} |=C2=A0 56 ++--<br>
=C2=A0lib/ukallocbbuddy/bbuddy.c=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0|=C2=A0 50 +++-<br>
=C2=A0lib/ukallocregion/region.c=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0|=C2=A0 54 +++-<br>
=C2=A0plat/common/include/pci/pci_bus.h=C2=A0 =C2=A0 =C2=A0 =C2=A0 |=C2=A0 =
=C2=A02 +<br>
=C2=A0plat/common/memory.c=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0|=C2=A0 =C2=A02 +<br>
=C2=A0plat/xen/gnttab.c=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 |=C2=A0 =C2=A01 +<br>
=C2=A0plat/xen/memory.c=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 |=C2=A0 =C2=A02 +<br>
=C2=A0plat/xen/x86/gnttab.c=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0=
 =C2=A0 =C2=A0 =C2=A0 |=C2=A0 =C2=A01 +<br>
=C2=A019 files changed, 952 insertions(+), 199 deletions(-)<br>
=C2=A0create mode 100644 lib/ukalloc/libstats.c<br>
=C2=A0create mode 100644 lib/ukalloc/libstats.ld<br>
=C2=A0create mode 100644 lib/ukalloc/<a href=3D"http://libstats.localsyms.u=
k" rel=3D"noreferrer" target=3D"_blank">libstats.localsyms.uk</a><br>
=C2=A0rename lib/{nolibc/malloc.c =3D&gt; ukalloc/stats.c} (62%)<br>
<br>
-- <br>
2.20.1<br>
<br>
</blockquote></div>

--00000000000033910a05b851d74d--


From minios-devel-bounces@lists.xenproject.org Thu Jan 07 16:24:47 2021
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Thu, 07 Jan 2021 16:24:47 +0000
Received: from list by lists.xenproject.org with outflank-mailman.62985.111769 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1kxY5e-0001Eb-VK; Thu, 07 Jan 2021 16:24:46 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 62985.111769; Thu, 07 Jan 2021 16:24: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 1kxY5e-0001EU-SX; Thu, 07 Jan 2021 16:24:46 +0000
Received: by outflank-mailman (input) for mailman id 62985;
 Thu, 07 Jan 2021 16:24: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=g3Qq=GK=gmail.com=lrbarbulescu@srs-us1.protection.inumbo.net>)
 id 1kxY5d-0001EP-4t
 for minios-devel@lists.xen.org; Thu, 07 Jan 2021 16:24:45 +0000
Received: from mail-lf1-x12f.google.com (unknown [2a00:1450:4864:20::12f])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 126e069f-3202-4f9d-a5e9-f29b0a3aa774;
 Thu, 07 Jan 2021 16:24:44 +0000 (UTC)
Received: by mail-lf1-x12f.google.com with SMTP id o13so15963462lfr.3
 for <minios-devel@lists.xen.org>; Thu, 07 Jan 2021 08:24: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: 126e069f-3202-4f9d-a5e9-f29b0a3aa774
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=M4ivundLjblsVdPYjk9swfvwUpOhC9JYYmMDB25TN8Y=;
        b=pwTVH5iJLvTHvpiOuzfah+ieja0gzhqQSdiWe2X3FCd4kMdfS139poNlFpXDsjm1pN
         ELtggR8KuBGvyR9L1VcINmbn+h9CB0CzROczQ5gZcVL8uKNmJFyIiMmsg6kTO6T8Qg3u
         8y6ndObPSVEB2HSA0wkp0+XMx7/Z1/LozZrajZTZisMcMUBfWo9cvT1KSnRS0jhNP8li
         N4fl5ckIjl+Rmnor3cKVqoPM5tE9CfmCy1Cyabf2kwfHSLv+2PKcClKh5OZPwn4OQVE/
         +ITsCvgZwuhHOiwQ8QvXTsrXGW4h5RhxI063KEm5SVcFW4UL3JFwbyNk3F2bB2J0Q3Tc
         df9A==
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=M4ivundLjblsVdPYjk9swfvwUpOhC9JYYmMDB25TN8Y=;
        b=dG4V7ZuNe4gafSzYrq9BsCEYjcWCZrOwKAG5z0vGn3aOxgOwZpQ7rugssN9a5H/3lO
         lGdWADgNzKG++VrP8HGIoKDhEDKaGnNIHdrkrKuyTPnBC5gqKch+gfOjhnsCDa6k6vvw
         DuxtmC3JT3dkmIeVYsWzw/vFBGVF0GfC/0HOQtR1p57B1Tnbd49dSfAestjR61Jli0xl
         W7Fmrp90d7HZSAbqo9G064kGqaYq1zLjkwWVFqh28pp0NyFjFEAaNoiUSlY+42dpcBFA
         0Xr2yRlIo5pC8kKm65rTRNzGhg62IGdAY1tQCje4Enkkcnurew8sFjfSK+lQNs31to+k
         YNmw==
X-Gm-Message-State: AOAM531muLOqjhQ/bjvHEp2mrC5bOiVC5P00g+t6iN0X3plGmy7Crqyc
	ru6Q8BF4TPyYrULvni1OSsCVcuukT4WXrf+d2DvXaJYRlzI=
X-Google-Smtp-Source: ABdhPJzyrC5wxsJV42l/TnO/uJu94l1vYnHvomwnsv051xe666GfR71kz0hjXlNgkvewXdhNydn06UULhhC9rZjWACE=
X-Received: by 2002:a19:cc10:: with SMTP id c16mr4190417lfg.43.1610036683125;
 Thu, 07 Jan 2021 08:24:43 -0800 (PST)
MIME-Version: 1.0
References: <20201120154612.27579-1-simon.kuenzer@neclab.eu> <20201120154612.27579-2-simon.kuenzer@neclab.eu>
In-Reply-To: <20201120154612.27579-2-simon.kuenzer@neclab.eu>
From: Laurentiu Barbulescu <lrbarbulescu@gmail.com>
Date: Thu, 7 Jan 2021 18:24:27 +0200
Message-ID: <CAMpNDKnegB6a0AE-A82x8Go3ZR1S4DtUCoeZWE4-0G2j0jFrFQ@mail.gmail.com>
Subject: Re: [UNIKRAFT PATCH 01/18] lib/ukalloc: Correct BSD license header
To: Simon Kuenzer <simon.kuenzer@neclab.eu>
Cc: minios-devel@lists.xen.org, Felipe Huici <felipe.huici@neclab.eu>, 
	Sharan Santhanam <sharan.santhanam@neclab.eu>
Content-Type: multipart/alternative; boundary="00000000000092b68405b851e084"

--00000000000092b68405b851e084
Content-Type: text/plain; charset="UTF-8"

There is still one more `THIS HEADER MAY NOT BE EXTRACTED OR MODIFIED IN
ANY WAY.` line in `lib/ukallocbbuddy/include/uk/allocbbuddy.h`.

On Fri, Nov 20, 2020 at 5:46 PM Simon Kuenzer <simon.kuenzer@neclab.eu>
wrote:

> Removes the BSD license incompatible clause:
> `THIS HEADER MAY NOT BE EXTRACTED OR MODIFIED IN ANY WAY.`
>
> Signed-off-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
> ---
>  lib/ukalloc/include/uk/alloc.h      | 2 --
>  lib/ukalloc/include/uk/alloc_impl.h | 2 --
>  2 files changed, 4 deletions(-)
>
> diff --git a/lib/ukalloc/include/uk/alloc.h
> b/lib/ukalloc/include/uk/alloc.h
> index 14579220..a4feb3f4 100644
> --- a/lib/ukalloc/include/uk/alloc.h
> +++ b/lib/ukalloc/include/uk/alloc.h
> @@ -29,8 +29,6 @@
>   * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
>   * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
> THE
>   * POSSIBILITY OF SUCH DAMAGE.
> - *
> - * THIS HEADER MAY NOT BE EXTRACTED OR MODIFIED IN ANY WAY.
>   */
>
>  #ifndef __UK_ALLOC_H__
> diff --git a/lib/ukalloc/include/uk/alloc_impl.h
> b/lib/ukalloc/include/uk/alloc_impl.h
> index b15f49e7..844eca9a 100644
> --- a/lib/ukalloc/include/uk/alloc_impl.h
> +++ b/lib/ukalloc/include/uk/alloc_impl.h
> @@ -29,8 +29,6 @@
>   * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
>   * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
> THE
>   * POSSIBILITY OF SUCH DAMAGE.
> - *
> - * THIS HEADER MAY NOT BE EXTRACTED OR MODIFIED IN ANY WAY.
>   */
>
>  /*
> --
> 2.20.1
>
>

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

<div dir=3D"ltr">There is still one more `THIS HEADER MAY NOT BE EXTRACTED =
OR MODIFIED IN ANY WAY.` line in `lib/ukallocbbuddy/include/uk/allocbbuddy.=
h`.<br></div><br><div class=3D"gmail_quote"><div dir=3D"ltr" class=3D"gmail=
_attr">On Fri, Nov 20, 2020 at 5:46 PM Simon Kuenzer &lt;<a href=3D"mailto:=
simon.kuenzer@neclab.eu">simon.kuenzer@neclab.eu</a>&gt; wrote:<br></div><b=
lockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-le=
ft:1px solid rgb(204,204,204);padding-left:1ex">Removes the BSD license inc=
ompatible clause:<br>
`THIS HEADER MAY NOT BE EXTRACTED OR MODIFIED IN ANY WAY.`<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/ukalloc/include/uk/alloc.h=C2=A0 =C2=A0 =C2=A0 | 2 --<br>
=C2=A0lib/ukalloc/include/uk/alloc_impl.h | 2 --<br>
=C2=A02 files changed, 4 deletions(-)<br>
<br>
diff --git a/lib/ukalloc/include/uk/alloc.h b/lib/ukalloc/include/uk/alloc.=
h<br>
index 14579220..a4feb3f4 100644<br>
--- a/lib/ukalloc/include/uk/alloc.h<br>
+++ b/lib/ukalloc/include/uk/alloc.h<br>
@@ -29,8 +29,6 @@<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>
- * THIS HEADER MAY NOT BE EXTRACTED OR MODIFIED IN ANY WAY.<br>
=C2=A0 */<br>
<br>
=C2=A0#ifndef __UK_ALLOC_H__<br>
diff --git a/lib/ukalloc/include/uk/alloc_impl.h b/lib/ukalloc/include/uk/a=
lloc_impl.h<br>
index b15f49e7..844eca9a 100644<br>
--- a/lib/ukalloc/include/uk/alloc_impl.h<br>
+++ b/lib/ukalloc/include/uk/alloc_impl.h<br>
@@ -29,8 +29,6 @@<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>
- * THIS HEADER MAY NOT BE EXTRACTED OR MODIFIED IN ANY WAY.<br>
=C2=A0 */<br>
<br>
=C2=A0/*<br>
-- <br>
2.20.1<br>
<br>
</blockquote></div>

--00000000000092b68405b851e084--


From minios-devel-bounces@lists.xenproject.org Thu Jan 07 16:31:18 2021
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Thu, 07 Jan 2021 16:31:18 +0000
Received: from list by lists.xenproject.org with outflank-mailman.62988.111774 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1kxYBx-00029Q-Es; Thu, 07 Jan 2021 16:31:17 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 62988.111774; Thu, 07 Jan 2021 16:31: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 1kxYBx-00029J-Bc; Thu, 07 Jan 2021 16:31:17 +0000
Received: by outflank-mailman (input) for mailman id 62988;
 Thu, 07 Jan 2021 16:31: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=g3Qq=GK=gmail.com=lrbarbulescu@srs-us1.protection.inumbo.net>)
 id 1kxYBv-000298-Fy
 for minios-devel@lists.xen.org; Thu, 07 Jan 2021 16:31:15 +0000
Received: from mail-lf1-x12f.google.com (unknown [2a00:1450:4864:20::12f])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id a8c16316-7ac3-41a1-9f12-9689cc303ac5;
 Thu, 07 Jan 2021 16:31:13 +0000 (UTC)
Received: by mail-lf1-x12f.google.com with SMTP id o17so15986938lfg.4
 for <minios-devel@lists.xen.org>; Thu, 07 Jan 2021 08:31: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: a8c16316-7ac3-41a1-9f12-9689cc303ac5
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=eLdcc9fsJxQR/rEI2bdwSz9QpvjO4cZQ4jqfFR2AnZs=;
        b=O1J31ol9vhSRCE47ioKGJSwXYnQ/ogHtMSZnrIVwHHrmJXROylrgR7eZzbQsp4mzQG
         6A8DI960r8BQG5heH6DKs5oELjLNUkbjBnHgoxOpaBzbYWsY1f6KfBh1GJ1+tgDADOxq
         N9ryZOm10UjKxYExLDIrATOXE1RAa9YnJBlP4c3EbQLLElFB0Sme3FFyeQH8pUJtOdDP
         KoS8jsdGgt3P7jR6AxpFPVQRqg7R2g5PP5SyPzSFFdR/3GENAJPlmKRhUnAwcXiRNgaU
         cq0nZQfrw481a1A4vw9rHh3Ycdj6dvhHVv+kWchiSpBhZV6kqlEH1s+YpxnplnP3toEm
         OkfA==
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=eLdcc9fsJxQR/rEI2bdwSz9QpvjO4cZQ4jqfFR2AnZs=;
        b=Zf4UmA68crwfiELw+MiMEMkDDMAPBKViiQlhgTorxn7AnFUhrvINDXMBMu5eSbM1/p
         b40W+wtQig4BGb2XybWmARvXNGYAnb5Z/Jdo7Tc37WrcWNVe85n83In+2T6UN9QTiiKF
         lvDDO2EXGJReXtZX+0R7wyt00KojMh9Jy3LW0yfYz48xynKcxWlYMCMlJbZiy4bDEKst
         PNy/DwpYUzvCT69eph+exk/F1m11o8i0k7xPxVqxH2UbibXgWJTqYTkzN/BLaSd75agi
         tfw5b0+Ljk9hFqEfDZfP/OmNzybDPoSuClh33b+7ITM8HUrW6kwjkxX5V+UWjnUjce9g
         r8KA==
X-Gm-Message-State: AOAM530wlJwCYDkK5JMg6Aj8gx4KlNYjmgVKqX8R5MovE2vZD68vfiIf
	hskl8kXWnDnI9NFq139dXvIPwfBFHdY1F7yThmY=
X-Google-Smtp-Source: ABdhPJyZqL5PSSmT7xW/CaCwNugkO+ZOaLnV6SmrVQqDYVaoYVmQoiQDetRdaWfjN9JYpTW363wuW9mP/pjAViOFn8s=
X-Received: by 2002:a2e:9849:: with SMTP id e9mr4681764ljj.319.1610037072172;
 Thu, 07 Jan 2021 08:31:12 -0800 (PST)
MIME-Version: 1.0
References: <20201120154612.27579-1-simon.kuenzer@neclab.eu> <20201120154612.27579-6-simon.kuenzer@neclab.eu>
In-Reply-To: <20201120154612.27579-6-simon.kuenzer@neclab.eu>
From: Laurentiu Barbulescu <lrbarbulescu@gmail.com>
Date: Thu, 7 Jan 2021 18:30:56 +0200
Message-ID: <CAMpNDKkBujYv48Z2Am7vPp8S_SqqvGLazocs-T9b2GBN2ZUt9w@mail.gmail.com>
Subject: Re: [UNIKRAFT PATCH 05/18] lib/ukalloc: Introduce `uk_alloc_maxalloc()`
 and make `uk_alloc_availmem()` available
To: Simon Kuenzer <simon.kuenzer@neclab.eu>
Cc: minios-devel@lists.xen.org, Felipe Huici <felipe.huici@neclab.eu>, 
	Sharan Santhanam <sharan.santhanam@neclab.eu>
Content-Type: multipart/alternative; boundary="000000000000c31c5f05b851f76c"

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

I have 2 inline comments for this patch.

On Fri, Nov 20, 2020 at 5:47 PM Simon Kuenzer <simon.kuenzer@neclab.eu>
wrote:

> The purpose of this commit is to make `uk_alloc_availmem()` always
> available because it is currently the only way to figure out how much heap
> memory is still available. We also introduce `uk_alloc_maxalloc()` that
> returns the biggest possible allocation that an allocator can currently
> satisfy. The configuration option `CONFIG_IFSTAT` is removed because it
> raises the expectation of an interface that returns detailed allocator
> statistics.
>
> Signed-off-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
> ---
>  lib/ukalloc/Config.uk               |  5 -----
>  lib/ukalloc/include/uk/alloc.h      | 21 +++++++++++++--------
>  lib/ukalloc/include/uk/alloc_impl.h | 10 ++++++++--
>  lib/ukallocbbuddy/bbuddy.c          |  4 ----
>  lib/ukallocregion/region.c          | 16 +++++++++++++++-
>  5 files changed, 36 insertions(+), 20 deletions(-)
>
> diff --git a/lib/ukalloc/Config.uk b/lib/ukalloc/Config.uk
> index c965d080..59a6aa78 100644
> --- a/lib/ukalloc/Config.uk
> +++ b/lib/ukalloc/Config.uk
> @@ -10,9 +10,4 @@ if LIBUKALLOC
>                 default n
>                 help
>                         Provide helpers for allocators defining
> exclusively malloc and free
> -       config LIBUKALLOC_IFSTATS
> -               bool "Statistics interface"
> -               default n
> -               help
> -                       Provide interfaces for querying allocator status
>  endif
> diff --git a/lib/ukalloc/include/uk/alloc.h
> b/lib/ukalloc/include/uk/alloc.h
> index 4c6bb872..af5a71cd 100644
> --- a/lib/ukalloc/include/uk/alloc.h
> +++ b/lib/ukalloc/include/uk/alloc.h
> @@ -66,10 +66,8 @@ typedef void  (*uk_alloc_pfree_func_t)
>                 (struct uk_alloc *a, void *ptr, unsigned long num_pages);
>  typedef int   (*uk_alloc_addmem_func_t)
>                 (struct uk_alloc *a, void *base, size_t size);
> -#if CONFIG_LIBUKALLOC_IFSTATS
>  typedef ssize_t (*uk_alloc_availmem_func_t)
>                 (struct uk_alloc *a);
> -#endif
>
>  struct uk_alloc {
>         /* memory allocation */
> @@ -88,10 +86,9 @@ struct uk_alloc {
>         /* page allocation interface */
>         uk_alloc_palloc_func_t palloc;
>         uk_alloc_pfree_func_t pfree;
> -#if CONFIG_LIBUKALLOC_IFSTATS
> -       /* optional interface */
> -       uk_alloc_availmem_func_t availmem;
> -#endif
> +       /* optional interfaces, but recommended */
>
To avoid any confusions, I suggest to use either a more-general type name
for both function
pointers(like `uk_alloc_meminfo_func_t`), preferable if there is a chance
to add more memory
statistics functions, or a new type for maxalloc, i.e.
`uk_alloc_maxalloc_func_t`.

> +       uk_alloc_availmem_func_t maxalloc; /* biggest alloc req. (bytes) */
> +       uk_alloc_availmem_func_t availmem; /* total memory available
> (bytes) */
>         /* optional interface */
>         uk_alloc_addmem_func_t addmem;
>
> @@ -237,7 +234,16 @@ static inline int uk_alloc_addmem(struct uk_alloc *a,
> void *base,
>         else
>                 return -ENOTSUP;
>  }
> -#if CONFIG_LIBUKALLOC_IFSTATS
> +
> +/* current biggest allocation request possible */
> +static inline ssize_t uk_alloc_maxalloc(struct uk_alloc *a)
> +{
> +       UK_ASSERT(a);
> +       if (!a->maxalloc)
> +               return (ssize_t) -ENOTSUP;
> +       return a->maxalloc(a);
> +}
> +
>  static inline ssize_t uk_alloc_availmem(struct uk_alloc *a)
>  {
>         UK_ASSERT(a);
> @@ -245,7 +251,6 @@ static inline ssize_t uk_alloc_availmem(struct
> uk_alloc *a)
>                 return (ssize_t) -ENOTSUP;
>         return a->availmem(a);
>  }
> -#endif /* CONFIG_LIBUKALLOC_IFSTATS */
>
>  #ifdef __cplusplus
>  }
> diff --git a/lib/ukalloc/include/uk/alloc_impl.h
> b/lib/ukalloc/include/uk/alloc_impl.h
> index 844eca9a..beeb59f0 100644
> --- a/lib/ukalloc/include/uk/alloc_impl.h
> +++ b/lib/ukalloc/include/uk/alloc_impl.h
> @@ -79,7 +79,8 @@ void uk_pfree_compat(struct uk_alloc *a, void *ptr,
> unsigned long num_pages);
>   * palloc() or pfree()
>   */
>  #define uk_alloc_init_malloc(a, malloc_f, calloc_f, realloc_f, free_f, \
> -                               posix_memalign_f, memalign_f, addmem_f) \
> +                            posix_memalign_f, memalign_f, maxalloc_f,  \
> +                            availmem_f, addmem_f)                      \
>         do {                                                            \
>                 (a)->malloc         = (malloc_f);                       \
>                 (a)->calloc         = (calloc_f);                       \
> @@ -89,13 +90,16 @@ void uk_pfree_compat(struct uk_alloc *a, void *ptr,
> unsigned long num_pages);
>                 (a)->free           = (free_f);                         \
>                 (a)->palloc         = uk_palloc_compat;                 \
>                 (a)->pfree          = uk_pfree_compat;                  \
> +               (a)->availmem       = (availmem_f);                     \
> +               (a)->maxalloc       = (maxalloc_f);                     \
>                 (a)->addmem         = (addmem_f);                       \
>                                                                         \
>                 uk_alloc_register((a));                                 \
>         } while (0)
>
>  #if CONFIG_LIBUKALLOC_IFMALLOC
> -#define uk_alloc_init_malloc_ifmalloc(a, malloc_f, free_f, addmem_f)   \
> +#define uk_alloc_init_malloc_ifmalloc(a, malloc_f, free_f, maxalloc_f, \
> +                                     availmem_f, addmem_f)             \
>         do {                                                            \
>                 (a)->malloc         = uk_malloc_ifmalloc;               \
>                 (a)->calloc         = uk_calloc_compat;                 \
> @@ -107,6 +111,8 @@ void uk_pfree_compat(struct uk_alloc *a, void *ptr,
> unsigned long num_pages);
>                 (a)->free           = uk_free_ifmalloc;                 \
>                 (a)->palloc         = uk_palloc_compat;                 \
>                 (a)->pfree          = uk_pfree_compat;                  \
> +               (a)->availmem       = (availmem_f);                     \
> +               (a)->maxalloc       = (maxalloc_f);                     \
>                 (a)->addmem         = (addmem_f);                       \
>                                                                         \
>                 uk_alloc_register((a));                                 \
> diff --git a/lib/ukallocbbuddy/bbuddy.c b/lib/ukallocbbuddy/bbuddy.c
> index 85f3e8db..3730eeb2 100644
> --- a/lib/ukallocbbuddy/bbuddy.c
> +++ b/lib/ukallocbbuddy/bbuddy.c
> @@ -214,7 +214,6 @@ static void map_free(struct uk_bbpalloc *b, uintptr_t
> first_page,
>         b->nr_free_pages += nr_pages;
>  }
>
> -#if CONFIG_LIBUKALLOC_IFSTATS
>  static ssize_t bbuddy_availmem(struct uk_alloc *a)
>  {
>         struct uk_bbpalloc *b;
> @@ -223,7 +222,6 @@ static ssize_t bbuddy_availmem(struct uk_alloc *a)
>         b = (struct uk_bbpalloc *)&a->priv;
>         return (ssize_t) b->nr_free_pages << __PAGE_SHIFT;
>  }
> -#endif
>
>  /* return log of the next power of two of passed number */
>  static inline unsigned long num_pages_to_order(unsigned long num_pages)
> @@ -504,9 +502,7 @@ struct uk_alloc *uk_allocbbuddy_init(void *base,
> size_t len)
>         /* initialize and register allocator interface */
>         uk_alloc_init_palloc(a, bbuddy_palloc, bbuddy_pfree,
>                              bbuddy_addmem);
> -#if CONFIG_LIBUKALLOC_IFSTATS
>         a->availmem = bbuddy_availmem;
> -#endif
>
>         if (max > min + metalen) {
>                 /* add left memory - ignore return value */
> diff --git a/lib/ukallocregion/region.c b/lib/ukallocregion/region.c
> index ae8fcb82..fc8a63b2 100644
> --- a/lib/ukallocregion/region.c
> +++ b/lib/ukallocregion/region.c
> @@ -131,6 +131,19 @@ void uk_allocregion_free(struct uk_alloc *a __unused,
> void *ptr __unused)
>                         "ukallocregion\n", a);
>  }
>
> +static ssize_t uk_allocregion_availmem(struct uk_alloc *a)
> +{
> +       struct uk_allocregion *b;
> +
> +       UK_ASSERT(a != NULL);
> +
> +       b = (struct uk_allocregion *) &a->priv;
> +
> +       UK_ASSERT(b != NULL);
> +
> +       return (uintptr_t) b->heap_top - (uintptr_t) b->heap_base;
> +}
> +
>  int uk_allocregion_addmem(struct uk_alloc *a __unused, void *base
> __unused,
>                                 size_t size __unused)
>  {
> @@ -177,7 +190,8 @@ struct uk_alloc *uk_allocregion_init(void *base,
> size_t len)
>         uk_alloc_init_malloc(a, uk_allocregion_malloc, uk_calloc_compat,
>                                 uk_realloc_compat, uk_allocregion_free,
>                                 uk_allocregion_posix_memalign,
> -                               uk_memalign_compat, NULL);
>
Instead of using `uk_allocregion_availmem` for the argument which
corresponds to
`maxalloc_f`, I suggest to implement a stub function for
`uk_allocregion_maxalloc`.

> +                               uk_memalign_compat,
> uk_allocregion_availmem,
> +                               uk_allocregion_availmem,
> uk_allocregion_addmem);
>
>         return a;
>  }
> --
> 2.20.1
>
>

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

PGRpdiBkaXI9Imx0ciI+PGRpdj5JIGhhdmUgMiBpbmxpbmUgY29tbWVudHMgZm9yIHRoaXMgcGF0
Y2guPC9kaXY+PGJyPjxkaXYgY2xhc3M9ImdtYWlsX3F1b3RlIj48ZGl2IGRpcj0ibHRyIiBjbGFz
cz0iZ21haWxfYXR0ciI+T24gRnJpLCBOb3YgMjAsIDIwMjAgYXQgNTo0NyBQTSBTaW1vbiBLdWVu
emVyICZsdDs8YSBocmVmPSJtYWlsdG86c2ltb24ua3VlbnplckBuZWNsYWIuZXUiPnNpbW9uLmt1
ZW56ZXJAbmVjbGFiLmV1PC9hPiZndDsgd3JvdGU6PGJyPjwvZGl2PjxibG9ja3F1b3RlIGNsYXNz
PSJnbWFpbF9xdW90ZSIgc3R5bGU9Im1hcmdpbjowcHggMHB4IDBweCAwLjhleDtib3JkZXItbGVm
dDoxcHggc29saWQgcmdiKDIwNCwyMDQsMjA0KTtwYWRkaW5nLWxlZnQ6MWV4Ij5UaGUgcHVycG9z
ZSBvZiB0aGlzIGNvbW1pdCBpcyB0byBtYWtlIGB1a19hbGxvY19hdmFpbG1lbSgpYCBhbHdheXM8
YnI+DQphdmFpbGFibGUgYmVjYXVzZSBpdCBpcyBjdXJyZW50bHkgdGhlIG9ubHkgd2F5IHRvIGZp
Z3VyZSBvdXQgaG93IG11Y2ggaGVhcDxicj4NCm1lbW9yeSBpcyBzdGlsbCBhdmFpbGFibGUuIFdl
IGFsc28gaW50cm9kdWNlIGB1a19hbGxvY19tYXhhbGxvYygpYCB0aGF0PGJyPg0KcmV0dXJucyB0
aGUgYmlnZ2VzdCBwb3NzaWJsZSBhbGxvY2F0aW9uIHRoYXQgYW4gYWxsb2NhdG9yIGNhbiBjdXJy
ZW50bHk8YnI+DQpzYXRpc2Z5LiBUaGUgY29uZmlndXJhdGlvbiBvcHRpb24gYENPTkZJR19JRlNU
QVRgIGlzIHJlbW92ZWQgYmVjYXVzZSBpdDxicj4NCnJhaXNlcyB0aGUgZXhwZWN0YXRpb24gb2Yg
YW4gaW50ZXJmYWNlIHRoYXQgcmV0dXJucyBkZXRhaWxlZCBhbGxvY2F0b3I8YnI+DQpzdGF0aXN0
aWNzLjxicj4NCjxicj4NClNpZ25lZC1vZmYtYnk6IFNpbW9uIEt1ZW56ZXIgJmx0OzxhIGhyZWY9
Im1haWx0bzpzaW1vbi5rdWVuemVyQG5lY2xhYi5ldSIgdGFyZ2V0PSJfYmxhbmsiPnNpbW9uLmt1
ZW56ZXJAbmVjbGFiLmV1PC9hPiZndDs8YnI+DQotLS08YnI+DQrCoGxpYi91a2FsbG9jL0NvbmZp
Zy51a8KgIMKgIMKgIMKgIMKgIMKgIMKgIMKgfMKgIDUgLS0tLS08YnI+DQrCoGxpYi91a2FsbG9j
L2luY2x1ZGUvdWsvYWxsb2MuaMKgIMKgIMKgIHwgMjEgKysrKysrKysrKysrKy0tLS0tLS0tPGJy
Pg0KwqBsaWIvdWthbGxvYy9pbmNsdWRlL3VrL2FsbG9jX2ltcGwuaCB8IDEwICsrKysrKysrLS08
YnI+DQrCoGxpYi91a2FsbG9jYmJ1ZGR5L2JidWRkeS5jwqAgwqAgwqAgwqAgwqAgfMKgIDQgLS0t
LTxicj4NCsKgbGliL3VrYWxsb2NyZWdpb24vcmVnaW9uLmPCoCDCoCDCoCDCoCDCoCB8IDE2ICsr
KysrKysrKysrKysrKy08YnI+DQrCoDUgZmlsZXMgY2hhbmdlZCwgMzYgaW5zZXJ0aW9ucygrKSwg
MjAgZGVsZXRpb25zKC0pPGJyPg0KPGJyPg0KZGlmZiAtLWdpdCBhL2xpYi91a2FsbG9jL0NvbmZp
Zy51ayBiL2xpYi91a2FsbG9jL0NvbmZpZy51azxicj4NCmluZGV4IGM5NjVkMDgwLi41OWE2YWE3
OCAxMDA2NDQ8YnI+DQotLS0gYS9saWIvdWthbGxvYy9Db25maWcudWs8YnI+DQorKysgYi9saWIv
dWthbGxvYy9Db25maWcudWs8YnI+DQpAQCAtMTAsOSArMTAsNCBAQCBpZiBMSUJVS0FMTE9DPGJy
Pg0KwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgZGVmYXVsdCBuPGJyPg0KwqAgwqAgwqAgwqAgwqAg
wqAgwqAgwqAgaGVscDxicj4NCsKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIFBy
b3ZpZGUgaGVscGVycyBmb3IgYWxsb2NhdG9ycyBkZWZpbmluZyBleGNsdXNpdmVseSBtYWxsb2Mg
YW5kIGZyZWU8YnI+DQotwqAgwqAgwqAgwqBjb25maWcgTElCVUtBTExPQ19JRlNUQVRTPGJyPg0K
LcKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgYm9vbCAmcXVvdDtTdGF0aXN0aWNzIGludGVyZmFjZSZx
dW90Ozxicj4NCi3CoCDCoCDCoCDCoCDCoCDCoCDCoCDCoGRlZmF1bHQgbjxicj4NCi3CoCDCoCDC
oCDCoCDCoCDCoCDCoCDCoGhlbHA8YnI+DQotwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAg
wqAgwqBQcm92aWRlIGludGVyZmFjZXMgZm9yIHF1ZXJ5aW5nIGFsbG9jYXRvciBzdGF0dXM8YnI+
DQrCoGVuZGlmPGJyPg0KZGlmZiAtLWdpdCBhL2xpYi91a2FsbG9jL2luY2x1ZGUvdWsvYWxsb2Mu
aCBiL2xpYi91a2FsbG9jL2luY2x1ZGUvdWsvYWxsb2MuaDxicj4NCmluZGV4IDRjNmJiODcyLi5h
ZjVhNzFjZCAxMDA2NDQ8YnI+DQotLS0gYS9saWIvdWthbGxvYy9pbmNsdWRlL3VrL2FsbG9jLmg8
YnI+DQorKysgYi9saWIvdWthbGxvYy9pbmNsdWRlL3VrL2FsbG9jLmg8YnI+DQpAQCAtNjYsMTAg
KzY2LDggQEAgdHlwZWRlZiB2b2lkwqAgKCp1a19hbGxvY19wZnJlZV9mdW5jX3QpPGJyPg0KwqAg
wqAgwqAgwqAgwqAgwqAgwqAgwqAgKHN0cnVjdCB1a19hbGxvYyAqYSwgdm9pZCAqcHRyLCB1bnNp
Z25lZCBsb25nIG51bV9wYWdlcyk7PGJyPg0KwqB0eXBlZGVmIGludMKgIMKgKCp1a19hbGxvY19h
ZGRtZW1fZnVuY190KTxicj4NCsKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIChzdHJ1Y3QgdWtfYWxs
b2MgKmEsIHZvaWQgKmJhc2UsIHNpemVfdCBzaXplKTs8YnI+DQotI2lmIENPTkZJR19MSUJVS0FM
TE9DX0lGU1RBVFM8YnI+DQrCoHR5cGVkZWYgc3NpemVfdCAoKnVrX2FsbG9jX2F2YWlsbWVtX2Z1
bmNfdCk8YnI+DQrCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCAoc3RydWN0IHVrX2FsbG9jICphKTs8
YnI+DQotI2VuZGlmPGJyPg0KPGJyPg0KwqBzdHJ1Y3QgdWtfYWxsb2Mgezxicj4NCsKgIMKgIMKg
IMKgIC8qIG1lbW9yeSBhbGxvY2F0aW9uICovPGJyPg0KQEAgLTg4LDEwICs4Niw5IEBAIHN0cnVj
dCB1a19hbGxvYyB7PGJyPg0KwqAgwqAgwqAgwqAgLyogcGFnZSBhbGxvY2F0aW9uIGludGVyZmFj
ZSAqLzxicj4NCsKgIMKgIMKgIMKgIHVrX2FsbG9jX3BhbGxvY19mdW5jX3QgcGFsbG9jOzxicj4N
CsKgIMKgIMKgIMKgIHVrX2FsbG9jX3BmcmVlX2Z1bmNfdCBwZnJlZTs8YnI+DQotI2lmIENPTkZJ
R19MSUJVS0FMTE9DX0lGU1RBVFM8YnI+DQotwqAgwqAgwqAgwqAvKiBvcHRpb25hbCBpbnRlcmZh
Y2UgKi88YnI+DQotwqAgwqAgwqAgwqB1a19hbGxvY19hdmFpbG1lbV9mdW5jX3QgYXZhaWxtZW07
PGJyPg0KLSNlbmRpZjxicj4NCivCoCDCoCDCoCDCoC8qIG9wdGlvbmFsIGludGVyZmFjZXMsIGJ1
dCByZWNvbW1lbmRlZCAqLzxicj48L2Jsb2NrcXVvdGU+PGRpdj5UbyBhdm9pZCBhbnkgY29uZnVz
aW9ucywgSSBzdWdnZXN0IHRvIHVzZSBlaXRoZXIgYSBtb3JlLWdlbmVyYWwgdHlwZSBuYW1lIGZv
ciBib3RoIGZ1bmN0aW9uPC9kaXY+PGRpdj5wb2ludGVycyhsaWtlIGB1a19hbGxvY19tZW1pbmZv
X2Z1bmNfdGApLCBwcmVmZXJhYmxlIGlmIHRoZXJlIGlzIGEgY2hhbmNlIHRvIGFkZCBtb3JlIG1l
bW9yeTwvZGl2PjxkaXY+c3RhdGlzdGljcyBmdW5jdGlvbnMsIG9yIGEgbmV3IHR5cGUgZm9yIG1h
eGFsbG9jLCBpLmUuIGB1a19hbGxvY19tYXhhbGxvY19mdW5jX3RgLsKgPC9kaXY+PGJsb2NrcXVv
dGUgY2xhc3M9ImdtYWlsX3F1b3RlIiBzdHlsZT0ibWFyZ2luOjBweCAwcHggMHB4IDAuOGV4O2Jv
cmRlci1sZWZ0OjFweCBzb2xpZCByZ2IoMjA0LDIwNCwyMDQpO3BhZGRpbmctbGVmdDoxZXgiPg0K
K8KgIMKgIMKgIMKgdWtfYWxsb2NfYXZhaWxtZW1fZnVuY190IG1heGFsbG9jOyAvKiBiaWdnZXN0
IGFsbG9jIHJlcS4gKGJ5dGVzKSAqLzxicj4NCivCoCDCoCDCoCDCoHVrX2FsbG9jX2F2YWlsbWVt
X2Z1bmNfdCBhdmFpbG1lbTsgLyogdG90YWwgbWVtb3J5IGF2YWlsYWJsZSAoYnl0ZXMpICovPGJy
Pg0KwqAgwqAgwqAgwqAgLyogb3B0aW9uYWwgaW50ZXJmYWNlICovPGJyPg0KwqAgwqAgwqAgwqAg
dWtfYWxsb2NfYWRkbWVtX2Z1bmNfdCBhZGRtZW07PGJyPg0KPGJyPg0KQEAgLTIzNyw3ICsyMzQs
MTYgQEAgc3RhdGljIGlubGluZSBpbnQgdWtfYWxsb2NfYWRkbWVtKHN0cnVjdCB1a19hbGxvYyAq
YSwgdm9pZCAqYmFzZSw8YnI+DQrCoCDCoCDCoCDCoCBlbHNlPGJyPg0KwqAgwqAgwqAgwqAgwqAg
wqAgwqAgwqAgcmV0dXJuIC1FTk9UU1VQOzxicj4NCsKgfTxicj4NCi0jaWYgQ09ORklHX0xJQlVL
QUxMT0NfSUZTVEFUUzxicj4NCis8YnI+DQorLyogY3VycmVudCBiaWdnZXN0IGFsbG9jYXRpb24g
cmVxdWVzdCBwb3NzaWJsZSAqLzxicj4NCitzdGF0aWMgaW5saW5lIHNzaXplX3QgdWtfYWxsb2Nf
bWF4YWxsb2Moc3RydWN0IHVrX2FsbG9jICphKTxicj4NCit7PGJyPg0KK8KgIMKgIMKgIMKgVUtf
QVNTRVJUKGEpOzxicj4NCivCoCDCoCDCoCDCoGlmICghYS0mZ3Q7bWF4YWxsb2MpPGJyPg0KK8Kg
IMKgIMKgIMKgIMKgIMKgIMKgIMKgcmV0dXJuIChzc2l6ZV90KSAtRU5PVFNVUDs8YnI+DQorwqAg
wqAgwqAgwqByZXR1cm4gYS0mZ3Q7bWF4YWxsb2MoYSk7PGJyPg0KK308YnI+DQorPGJyPg0KwqBz
dGF0aWMgaW5saW5lIHNzaXplX3QgdWtfYWxsb2NfYXZhaWxtZW0oc3RydWN0IHVrX2FsbG9jICph
KTxicj4NCsKgezxicj4NCsKgIMKgIMKgIMKgIFVLX0FTU0VSVChhKTs8YnI+DQpAQCAtMjQ1LDcg
KzI1MSw2IEBAIHN0YXRpYyBpbmxpbmUgc3NpemVfdCB1a19hbGxvY19hdmFpbG1lbShzdHJ1Y3Qg
dWtfYWxsb2MgKmEpPGJyPg0KwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgcmV0dXJuIChzc2l6ZV90
KSAtRU5PVFNVUDs8YnI+DQrCoCDCoCDCoCDCoCByZXR1cm4gYS0mZ3Q7YXZhaWxtZW0oYSk7PGJy
Pg0KwqB9PGJyPg0KLSNlbmRpZiAvKiBDT05GSUdfTElCVUtBTExPQ19JRlNUQVRTICovPGJyPg0K
PGJyPg0KwqAjaWZkZWYgX19jcGx1c3BsdXM8YnI+DQrCoH08YnI+DQpkaWZmIC0tZ2l0IGEvbGli
L3VrYWxsb2MvaW5jbHVkZS91ay9hbGxvY19pbXBsLmggYi9saWIvdWthbGxvYy9pbmNsdWRlL3Vr
L2FsbG9jX2ltcGwuaDxicj4NCmluZGV4IDg0NGVjYTlhLi5iZWViNTlmMCAxMDA2NDQ8YnI+DQot
LS0gYS9saWIvdWthbGxvYy9pbmNsdWRlL3VrL2FsbG9jX2ltcGwuaDxicj4NCisrKyBiL2xpYi91
a2FsbG9jL2luY2x1ZGUvdWsvYWxsb2NfaW1wbC5oPGJyPg0KQEAgLTc5LDcgKzc5LDggQEAgdm9p
ZCB1a19wZnJlZV9jb21wYXQoc3RydWN0IHVrX2FsbG9jICphLCB2b2lkICpwdHIsIHVuc2lnbmVk
IGxvbmcgbnVtX3BhZ2VzKTs8YnI+DQrCoCAqIHBhbGxvYygpIG9yIHBmcmVlKCk8YnI+DQrCoCAq
Lzxicj4NCsKgI2RlZmluZSB1a19hbGxvY19pbml0X21hbGxvYyhhLCBtYWxsb2NfZiwgY2FsbG9j
X2YsIHJlYWxsb2NfZiwgZnJlZV9mLCBcPGJyPg0KLcKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKg
IMKgIMKgIMKgIMKgIMKgIMKgIMKgcG9zaXhfbWVtYWxpZ25fZiwgbWVtYWxpZ25fZiwgYWRkbWVt
X2YpIFw8YnI+DQorwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgcG9z
aXhfbWVtYWxpZ25fZiwgbWVtYWxpZ25fZiwgbWF4YWxsb2NfZizCoCBcPGJyPg0KK8KgIMKgIMKg
IMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIGF2YWlsbWVtX2YsIGFkZG1lbV9mKcKg
IMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIFw8YnI+DQrCoCDCoCDCoCDCoCBkbyB7wqAg
wqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAg
wqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgXDxicj4NCsKgIMKgIMKgIMKgIMKgIMKgIMKg
IMKgIChhKS0mZ3Q7bWFsbG9jwqAgwqAgwqAgwqAgwqA9IChtYWxsb2NfZik7wqAgwqAgwqAgwqAg
wqAgwqAgwqAgwqAgwqAgwqAgwqAgwqBcPGJyPg0KwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgKGEp
LSZndDtjYWxsb2PCoCDCoCDCoCDCoCDCoD0gKGNhbGxvY19mKTvCoCDCoCDCoCDCoCDCoCDCoCDC
oCDCoCDCoCDCoCDCoCDCoFw8YnI+DQpAQCAtODksMTMgKzkwLDE2IEBAIHZvaWQgdWtfcGZyZWVf
Y29tcGF0KHN0cnVjdCB1a19hbGxvYyAqYSwgdm9pZCAqcHRyLCB1bnNpZ25lZCBsb25nIG51bV9w
YWdlcyk7PGJyPg0KwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgKGEpLSZndDtmcmVlwqAgwqAgwqAg
wqAgwqAgwqA9IChmcmVlX2YpO8KgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKg
XDxicj4NCsKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIChhKS0mZ3Q7cGFsbG9jwqAgwqAgwqAgwqAg
wqA9IHVrX3BhbGxvY19jb21wYXQ7wqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqBcPGJyPg0KwqAg
wqAgwqAgwqAgwqAgwqAgwqAgwqAgKGEpLSZndDtwZnJlZcKgIMKgIMKgIMKgIMKgID0gdWtfcGZy
ZWVfY29tcGF0O8KgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIFw8YnI+DQorwqAgwqAgwqAgwqAg
wqAgwqAgwqAgwqAoYSktJmd0O2F2YWlsbWVtwqAgwqAgwqAgwqA9IChhdmFpbG1lbV9mKTvCoCDC
oCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoFw8YnI+DQorwqAgwqAgwqAgwqAgwqAgwqAgwqAg
wqAoYSktJmd0O21heGFsbG9jwqAgwqAgwqAgwqA9IChtYXhhbGxvY19mKTvCoCDCoCDCoCDCoCDC
oCDCoCDCoCDCoCDCoCDCoCDCoFw8YnI+DQrCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCAoYSktJmd0
O2FkZG1lbcKgIMKgIMKgIMKgIMKgPSAoYWRkbWVtX2YpO8KgIMKgIMKgIMKgIMKgIMKgIMKgIMKg
IMKgIMKgIMKgIMKgXDxicj4NCsKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKg
IMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKg
IMKgIMKgIMKgIMKgIFw8YnI+DQrCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCB1a19hbGxvY19yZWdp
c3RlcigoYSkpO8KgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKg
IMKgXDxicj4NCsKgIMKgIMKgIMKgIH0gd2hpbGUgKDApPGJyPg0KPGJyPg0KwqAjaWYgQ09ORklH
X0xJQlVLQUxMT0NfSUZNQUxMT0M8YnI+DQotI2RlZmluZSB1a19hbGxvY19pbml0X21hbGxvY19p
Zm1hbGxvYyhhLCBtYWxsb2NfZiwgZnJlZV9mLCBhZGRtZW1fZinCoCDCoFw8YnI+DQorI2RlZmlu
ZSB1a19hbGxvY19pbml0X21hbGxvY19pZm1hbGxvYyhhLCBtYWxsb2NfZiwgZnJlZV9mLCBtYXhh
bGxvY19mLCBcPGJyPg0KK8KgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKg
IMKgIMKgIMKgIMKgIMKgYXZhaWxtZW1fZiwgYWRkbWVtX2YpwqAgwqAgwqAgwqAgwqAgwqAgwqBc
PGJyPg0KwqAgwqAgwqAgwqAgZG8ge8KgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKg
IMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIFw8
YnI+DQrCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCAoYSktJmd0O21hbGxvY8KgIMKgIMKgIMKgIMKg
PSB1a19tYWxsb2NfaWZtYWxsb2M7wqAgwqAgwqAgwqAgwqAgwqAgwqAgwqBcPGJyPg0KwqAgwqAg
wqAgwqAgwqAgwqAgwqAgwqAgKGEpLSZndDtjYWxsb2PCoCDCoCDCoCDCoCDCoD0gdWtfY2FsbG9j
X2NvbXBhdDvCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoFw8YnI+DQpAQCAtMTA3LDYgKzExMSw4
IEBAIHZvaWQgdWtfcGZyZWVfY29tcGF0KHN0cnVjdCB1a19hbGxvYyAqYSwgdm9pZCAqcHRyLCB1
bnNpZ25lZCBsb25nIG51bV9wYWdlcyk7PGJyPg0KwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgKGEp
LSZndDtmcmVlwqAgwqAgwqAgwqAgwqAgwqA9IHVrX2ZyZWVfaWZtYWxsb2M7wqAgwqAgwqAgwqAg
wqAgwqAgwqAgwqAgwqBcPGJyPg0KwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgKGEpLSZndDtwYWxs
b2PCoCDCoCDCoCDCoCDCoD0gdWtfcGFsbG9jX2NvbXBhdDvCoCDCoCDCoCDCoCDCoCDCoCDCoCDC
oCDCoFw8YnI+DQrCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCAoYSktJmd0O3BmcmVlwqAgwqAgwqAg
wqAgwqAgPSB1a19wZnJlZV9jb21wYXQ7wqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgXDxicj4N
CivCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoChhKS0mZ3Q7YXZhaWxtZW3CoCDCoCDCoCDCoD0gKGF2
YWlsbWVtX2YpO8KgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgXDxicj4NCivCoCDCoCDC
oCDCoCDCoCDCoCDCoCDCoChhKS0mZ3Q7bWF4YWxsb2PCoCDCoCDCoCDCoD0gKG1heGFsbG9jX2Yp
O8KgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgXDxicj4NCsKgIMKgIMKgIMKgIMKgIMKg
IMKgIMKgIChhKS0mZ3Q7YWRkbWVtwqAgwqAgwqAgwqAgwqA9IChhZGRtZW1fZik7wqAgwqAgwqAg
wqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqBcPGJyPg0KwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAg
wqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAg
wqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgXDxicj4NCsKgIMKgIMKgIMKgIMKgIMKgIMKgIMKg
IHVrX2FsbG9jX3JlZ2lzdGVyKChhKSk7wqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAg
wqAgwqAgwqAgwqAgwqAgwqBcPGJyPg0KZGlmZiAtLWdpdCBhL2xpYi91a2FsbG9jYmJ1ZGR5L2Ji
dWRkeS5jIGIvbGliL3VrYWxsb2NiYnVkZHkvYmJ1ZGR5LmM8YnI+DQppbmRleCA4NWYzZThkYi4u
MzczMGVlYjIgMTAwNjQ0PGJyPg0KLS0tIGEvbGliL3VrYWxsb2NiYnVkZHkvYmJ1ZGR5LmM8YnI+
DQorKysgYi9saWIvdWthbGxvY2JidWRkeS9iYnVkZHkuYzxicj4NCkBAIC0yMTQsNyArMjE0LDYg
QEAgc3RhdGljIHZvaWQgbWFwX2ZyZWUoc3RydWN0IHVrX2JicGFsbG9jICpiLCB1aW50cHRyX3Qg
Zmlyc3RfcGFnZSw8YnI+DQrCoCDCoCDCoCDCoCBiLSZndDtucl9mcmVlX3BhZ2VzICs9IG5yX3Bh
Z2VzOzxicj4NCsKgfTxicj4NCjxicj4NCi0jaWYgQ09ORklHX0xJQlVLQUxMT0NfSUZTVEFUUzxi
cj4NCsKgc3RhdGljIHNzaXplX3QgYmJ1ZGR5X2F2YWlsbWVtKHN0cnVjdCB1a19hbGxvYyAqYSk8
YnI+DQrCoHs8YnI+DQrCoCDCoCDCoCDCoCBzdHJ1Y3QgdWtfYmJwYWxsb2MgKmI7PGJyPg0KQEAg
LTIyMyw3ICsyMjIsNiBAQCBzdGF0aWMgc3NpemVfdCBiYnVkZHlfYXZhaWxtZW0oc3RydWN0IHVr
X2FsbG9jICphKTxicj4NCsKgIMKgIMKgIMKgIGIgPSAoc3RydWN0IHVrX2JicGFsbG9jICopJmFt
cDthLSZndDtwcml2Ozxicj4NCsKgIMKgIMKgIMKgIHJldHVybiAoc3NpemVfdCkgYi0mZ3Q7bnJf
ZnJlZV9wYWdlcyAmbHQ7Jmx0OyBfX1BBR0VfU0hJRlQ7PGJyPg0KwqB9PGJyPg0KLSNlbmRpZjxi
cj4NCjxicj4NCsKgLyogcmV0dXJuIGxvZyBvZiB0aGUgbmV4dCBwb3dlciBvZiB0d28gb2YgcGFz
c2VkIG51bWJlciAqLzxicj4NCsKgc3RhdGljIGlubGluZSB1bnNpZ25lZCBsb25nIG51bV9wYWdl
c190b19vcmRlcih1bnNpZ25lZCBsb25nIG51bV9wYWdlcyk8YnI+DQpAQCAtNTA0LDkgKzUwMiw3
IEBAIHN0cnVjdCB1a19hbGxvYyAqdWtfYWxsb2NiYnVkZHlfaW5pdCh2b2lkICpiYXNlLCBzaXpl
X3QgbGVuKTxicj4NCsKgIMKgIMKgIMKgIC8qIGluaXRpYWxpemUgYW5kIHJlZ2lzdGVyIGFsbG9j
YXRvciBpbnRlcmZhY2UgKi88YnI+DQrCoCDCoCDCoCDCoCB1a19hbGxvY19pbml0X3BhbGxvYyhh
LCBiYnVkZHlfcGFsbG9jLCBiYnVkZHlfcGZyZWUsPGJyPg0KwqAgwqAgwqAgwqAgwqAgwqAgwqAg
wqAgwqAgwqAgwqAgwqAgwqAgwqAgwqBiYnVkZHlfYWRkbWVtKTs8YnI+DQotI2lmIENPTkZJR19M
SUJVS0FMTE9DX0lGU1RBVFM8YnI+DQrCoCDCoCDCoCDCoCBhLSZndDthdmFpbG1lbSA9IGJidWRk
eV9hdmFpbG1lbTs8YnI+DQotI2VuZGlmPGJyPg0KPGJyPg0KwqAgwqAgwqAgwqAgaWYgKG1heCAm
Z3Q7IG1pbiArIG1ldGFsZW4pIHs8YnI+DQrCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCAvKiBhZGQg
bGVmdCBtZW1vcnkgLSBpZ25vcmUgcmV0dXJuIHZhbHVlICovPGJyPg0KZGlmZiAtLWdpdCBhL2xp
Yi91a2FsbG9jcmVnaW9uL3JlZ2lvbi5jIGIvbGliL3VrYWxsb2NyZWdpb24vcmVnaW9uLmM8YnI+
DQppbmRleCBhZThmY2I4Mi4uZmM4YTYzYjIgMTAwNjQ0PGJyPg0KLS0tIGEvbGliL3VrYWxsb2Ny
ZWdpb24vcmVnaW9uLmM8YnI+DQorKysgYi9saWIvdWthbGxvY3JlZ2lvbi9yZWdpb24uYzxicj4N
CkBAIC0xMzEsNiArMTMxLDE5IEBAIHZvaWQgdWtfYWxsb2NyZWdpb25fZnJlZShzdHJ1Y3QgdWtf
YWxsb2MgKmEgX191bnVzZWQsIHZvaWQgKnB0ciBfX3VudXNlZCk8YnI+DQrCoCDCoCDCoCDCoCDC
oCDCoCDCoCDCoCDCoCDCoCDCoCDCoCAmcXVvdDt1a2FsbG9jcmVnaW9uXG4mcXVvdDssIGEpOzxi
cj4NCsKgfTxicj4NCjxicj4NCitzdGF0aWMgc3NpemVfdCB1a19hbGxvY3JlZ2lvbl9hdmFpbG1l
bShzdHJ1Y3QgdWtfYWxsb2MgKmEpPGJyPg0KK3s8YnI+DQorwqAgwqAgwqAgwqBzdHJ1Y3QgdWtf
YWxsb2NyZWdpb24gKmI7PGJyPg0KKzxicj4NCivCoCDCoCDCoCDCoFVLX0FTU0VSVChhICE9IE5V
TEwpOzxicj4NCis8YnI+DQorwqAgwqAgwqAgwqBiID0gKHN0cnVjdCB1a19hbGxvY3JlZ2lvbiAq
KSAmYW1wO2EtJmd0O3ByaXY7PGJyPg0KKzxicj4NCivCoCDCoCDCoCDCoFVLX0FTU0VSVChiICE9
IE5VTEwpOzxicj4NCis8YnI+DQorwqAgwqAgwqAgwqByZXR1cm4gKHVpbnRwdHJfdCkgYi0mZ3Q7
aGVhcF90b3AgLSAodWludHB0cl90KSBiLSZndDtoZWFwX2Jhc2U7PGJyPg0KK308YnI+DQorPGJy
Pg0KwqBpbnQgdWtfYWxsb2NyZWdpb25fYWRkbWVtKHN0cnVjdCB1a19hbGxvYyAqYSBfX3VudXNl
ZCwgdm9pZCAqYmFzZSBfX3VudXNlZCw8YnI+DQrCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDC
oCDCoCDCoCDCoCDCoCDCoCDCoCBzaXplX3Qgc2l6ZSBfX3VudXNlZCk8YnI+DQrCoHs8YnI+DQpA
QCAtMTc3LDcgKzE5MCw4IEBAIHN0cnVjdCB1a19hbGxvYyAqdWtfYWxsb2NyZWdpb25faW5pdCh2
b2lkICpiYXNlLCBzaXplX3QgbGVuKTxicj4NCsKgIMKgIMKgIMKgIHVrX2FsbG9jX2luaXRfbWFs
bG9jKGEsIHVrX2FsbG9jcmVnaW9uX21hbGxvYywgdWtfY2FsbG9jX2NvbXBhdCw8YnI+DQrCoCDC
oCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCB1a19yZWFsbG9jX2Nv
bXBhdCwgdWtfYWxsb2NyZWdpb25fZnJlZSw8YnI+DQrCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDC
oCDCoCDCoCDCoCDCoCDCoCDCoCDCoCB1a19hbGxvY3JlZ2lvbl9wb3NpeF9tZW1hbGlnbiw8YnI+
DQotwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqB1a19tZW1h
bGlnbl9jb21wYXQsIE5VTEwpOzxicj48L2Jsb2NrcXVvdGU+PGRpdj5JbnN0ZWFkIG9mIHVzaW5n
IGB1a19hbGxvY3JlZ2lvbl9hdmFpbG1lbWAgZm9yIHRoZSBhcmd1bWVudCB3aGljaCBjb3JyZXNw
b25kcyB0bzwvZGl2PjxkaXY+YG1heGFsbG9jX2ZgLCBJIHN1Z2dlc3QgdG8gaW1wbGVtZW50IGEg
c3R1YiBmdW5jdGlvbiBmb3IgYHVrX2FsbG9jcmVnaW9uX21heGFsbG9jYC7CoDwvZGl2PjxibG9j
a3F1b3RlIGNsYXNzPSJnbWFpbF9xdW90ZSIgc3R5bGU9Im1hcmdpbjowcHggMHB4IDBweCAwLjhl
eDtib3JkZXItbGVmdDoxcHggc29saWQgcmdiKDIwNCwyMDQsMjA0KTtwYWRkaW5nLWxlZnQ6MWV4
Ij4NCivCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoHVrX21l
bWFsaWduX2NvbXBhdCwgdWtfYWxsb2NyZWdpb25fYXZhaWxtZW0sPGJyPg0KK8KgIMKgIMKgIMKg
IMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgdWtfYWxsb2NyZWdpb25fYXZhaWxt
ZW0sIHVrX2FsbG9jcmVnaW9uX2FkZG1lbSk7PGJyPg0KPGJyPg0KwqAgwqAgwqAgwqAgcmV0dXJu
IGE7PGJyPg0KwqB9PGJyPg0KLS0gPGJyPg0KMi4yMC4xPGJyPg0KPGJyPg0KPC9ibG9ja3F1b3Rl
PjwvZGl2PjwvZGl2Pg0K
--000000000000c31c5f05b851f76c--


From minios-devel-bounces@lists.xenproject.org Thu Jan 07 16:37:59 2021
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Thu, 07 Jan 2021 16:37:59 +0000
Received: from list by lists.xenproject.org with outflank-mailman.62990.111777 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1kxYIP-0002Og-W5; Thu, 07 Jan 2021 16:37:57 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 62990.111777; Thu, 07 Jan 2021 16:37: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 1kxYIP-0002OZ-Sy; Thu, 07 Jan 2021 16:37:57 +0000
Received: by outflank-mailman (input) for mailman id 62990;
 Thu, 07 Jan 2021 16:37: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=g3Qq=GK=gmail.com=lrbarbulescu@srs-us1.protection.inumbo.net>)
 id 1kxYIN-0002Lf-VC
 for minios-devel@lists.xen.org; Thu, 07 Jan 2021 16:37:56 +0000
Received: from mail-lf1-x135.google.com (unknown [2a00:1450:4864:20::135])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id b22eadb8-5d38-481e-a738-3af52bc7c290;
 Thu, 07 Jan 2021 16:37:54 +0000 (UTC)
Received: by mail-lf1-x135.google.com with SMTP id s26so15967268lfc.8
 for <minios-devel@lists.xen.org>; Thu, 07 Jan 2021 08:37: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: b22eadb8-5d38-481e-a738-3af52bc7c290
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=LC9xPa29D4MI9mHdxqouEP3/UA9i6xQ7GkwWUE9aQlE=;
        b=EqjrkNp/hVsOf0OHya4IZSdjjiRk2K6viEGfjjQVFZVfXybxIZhO6d7X1ufXYx99HX
         kT93cgTeaiO26l4i+qhO2qV301wBxNGVMY8ry5yCvR6tfaRavmtA29iR65FKAe8EzlAR
         v1jW6HyIr3gQTSquF7AAIVBNLu8Mseu/X1BppeughTAATd0kCjudClEuNm4q+JPr1UGh
         m2in0hxIttR/lBUy+XV5CMgwprizZjMQmSBrxOgeLtd6Kpww902AKTYNEIbxccEaNVy5
         wBmAYRkXNwXmjrhwFsDtSWnfrtvoppUMboBDOcEgN6MwIiMBO8BFVpZEagFiDJ5kkBvu
         9pMg==
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=LC9xPa29D4MI9mHdxqouEP3/UA9i6xQ7GkwWUE9aQlE=;
        b=XLLx/ZdhhTNFAiQOFYBVL648uQ9SHZrVSFcyLDeLjDseIzsXS8f6i3MOuz3TH/Uizd
         0a1zV4qA6N7p3VOYgqIYXYEOfHZfHiRYCzxjK67DzTPeApIiv/5VwXbhywvOks7+67tV
         /DjHIRbpBfMQCIF+CfV+lVj3/riZ2a/636A60vDI65Eyd/6MKWACV2BE6X6qvWC5MPpZ
         rHw1b/xDmJOAjSt+ARMH75ke80Vwj8EKl+Vxf7mJEvYXP2CN7P5mgfLuopgFneL2YsS2
         r1BE9QSGlPSazdMY/1JJINrJCpmksiFpYr/RQVlKbK+grienE1Rh7fXRYoI+aKedGm9f
         kt6w==
X-Gm-Message-State: AOAM533TIaVazUB65czsqGTMfcoYHWz8mmSCDA7lMkqIfzT/C3jskCpO
	qVEArw5xe+Gxi4I/0T2P3fAWOM8SwbK0BnKwJq82zLBQmVI=
X-Google-Smtp-Source: ABdhPJyOF2CsBvA8I5Hk8Cqc6Jf+23iVqCMhw2DYr9Zv2fT3ogJQ7u2j1W2Dk3x+acnlTbc4Sl3C5jpplB+KGplLT7A=
X-Received: by 2002:a05:651c:551:: with SMTP id q17mr4278084ljp.311.1610037472985;
 Thu, 07 Jan 2021 08:37:52 -0800 (PST)
MIME-Version: 1.0
References: <20201120154612.27579-1-simon.kuenzer@neclab.eu> <20201120154612.27579-7-simon.kuenzer@neclab.eu>
In-Reply-To: <20201120154612.27579-7-simon.kuenzer@neclab.eu>
From: Laurentiu Barbulescu <lrbarbulescu@gmail.com>
Date: Thu, 7 Jan 2021 18:37:37 +0200
Message-ID: <CAMpNDKnMxWKiMxin-fz9zfygSv0zPgSPYHR2zYMfgUK4fmr2QQ@mail.gmail.com>
Subject: Re: [UNIKRAFT PATCH 06/18] lib/ukalloc: Introduce `uk_alloc_pavail()`,
 `uk_alloc_pmaxalloc()`
To: Simon Kuenzer <simon.kuenzer@neclab.eu>
Cc: minios-devel@lists.xen.org, Felipe Huici <felipe.huici@neclab.eu>, 
	Sharan Santhanam <sharan.santhanam@neclab.eu>
Content-Type: multipart/alternative; boundary="000000000000a7077b05b8520fe5"

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

I have 2 inline comments for this patch.

On Fri, Nov 20, 2020 at 5:47 PM Simon Kuenzer <simon.kuenzer@neclab.eu>
wrote:

> This commit introduces
> - `uk_alloc_pavail()` as an equivalent for `uk_alloc_availmem()`
>   for page allocators.
> - `uk_alloc_pmaxalloc()` as an equivalent for `uk_alloc_maxalloc()`
>   for page allocators.
>
> Signed-off-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
> ---
>  lib/ukalloc/include/uk/alloc.h      | 21 +++++++++++++++
>  lib/ukalloc/include/uk/alloc_impl.h |  7 +++--
>  lib/ukallocbbuddy/bbuddy.c          | 41 ++++++++++++++++++++++-------
>  3 files changed, 57 insertions(+), 12 deletions(-)
>
> diff --git a/lib/ukalloc/include/uk/alloc.h
> b/lib/ukalloc/include/uk/alloc.h
> index af5a71cd..b711b56a 100644
> --- a/lib/ukalloc/include/uk/alloc.h
> +++ b/lib/ukalloc/include/uk/alloc.h
> @@ -68,6 +68,8 @@ typedef int   (*uk_alloc_addmem_func_t)
>                 (struct uk_alloc *a, void *base, size_t size);
>  typedef ssize_t (*uk_alloc_availmem_func_t)
>                 (struct uk_alloc *a);
> +typedef long  (*uk_alloc_pavail_func_t)
> +               (struct uk_alloc *a);
>
>  struct uk_alloc {
>         /* memory allocation */
> @@ -89,6 +91,8 @@ struct uk_alloc {
>         /* optional interfaces, but recommended */
>         uk_alloc_availmem_func_t maxalloc; /* biggest alloc req. (bytes) */
>         uk_alloc_availmem_func_t availmem; /* total memory available
> (bytes) */
>
Similar to the previous patch, I suggest to use either a more-general type
name for both function
pointers(like `uk_alloc_pmeminfo_func_t`), preferable if there is a chance
to add more memory
statistics functions, or a new type for pmaxalloc, i.e.
`uk_alloc_pmaxalloc_func_t`.

> +       uk_alloc_pavail_func_t pmaxalloc; /* biggest alloc req. (pages) */
> +       uk_alloc_pavail_func_t pavail; /* total pages available */
>         /* optional interface */
>         uk_alloc_addmem_func_t addmem;
>
> @@ -244,6 +248,15 @@ static inline ssize_t uk_alloc_maxalloc(struct
> uk_alloc *a)
>         return a->maxalloc(a);
>  }
>
> +static inline long uk_alloc_pmaxalloc(struct uk_alloc *a)
> +{
> +       UK_ASSERT(a);
> +       if (!a->pmaxalloc)
> +               return (long) -ENOTSUP;
> +       return a->pmaxalloc(a);
> +}
> +
> +/* total free memory of the allocator */
>  static inline ssize_t uk_alloc_availmem(struct uk_alloc *a)
>  {
>         UK_ASSERT(a);
> @@ -252,6 +265,14 @@ static inline ssize_t uk_alloc_availmem(struct
> uk_alloc *a)
>         return a->availmem(a);
>  }
>
> +static inline long uk_alloc_pavail(struct uk_alloc *a)
> +{
> +       UK_ASSERT(a);
> +       if (!a->pavail)
> +               return (long) -ENOTSUP;
> +       return a->pavail(a);
> +}
> +
>  #ifdef __cplusplus
>  }
>  #endif
> diff --git a/lib/ukalloc/include/uk/alloc_impl.h
> b/lib/ukalloc/include/uk/alloc_impl.h
> index beeb59f0..7e96ed94 100644
> --- a/lib/ukalloc/include/uk/alloc_impl.h
> +++ b/lib/ukalloc/include/uk/alloc_impl.h
> @@ -120,9 +120,10 @@ void uk_pfree_compat(struct uk_alloc *a, void *ptr,
> unsigned long num_pages);
>  #endif
>
>  /* Shortcut for doing a registration of an allocator that only
> - * implements palloc(), pfree(), addmem()
>
You omitted to mention `pmaxalloc()`.

> + * implements palloc(), pfree(), pavail(), addmem()
>   */
> -#define uk_alloc_init_palloc(a, palloc_func, pfree_func, addmem_func)  \
> +#define uk_alloc_init_palloc(a, palloc_func, pfree_func, pmaxalloc_func, \
> +                            pavail_func, addmem_func)                  \
>         do {                                                            \
>                 (a)->malloc         = uk_malloc_ifpages;                \
>                 (a)->calloc         = uk_calloc_compat;                 \
> @@ -132,6 +133,8 @@ void uk_pfree_compat(struct uk_alloc *a, void *ptr,
> unsigned long num_pages);
>                 (a)->free           = uk_free_ifpages;                  \
>                 (a)->palloc         = (palloc_func);                    \
>                 (a)->pfree          = (pfree_func);                     \
> +               (a)->pavail         = (pavail_func);                    \
> +               (a)->pmaxalloc      = (pmaxalloc_func);                 \
>                 (a)->addmem         = (addmem_func);                    \
>                                                                         \
>                 uk_alloc_register((a));                                 \
> diff --git a/lib/ukallocbbuddy/bbuddy.c b/lib/ukallocbbuddy/bbuddy.c
> index 3730eeb2..b63e2fd3 100644
> --- a/lib/ukallocbbuddy/bbuddy.c
> +++ b/lib/ukallocbbuddy/bbuddy.c
> @@ -214,15 +214,6 @@ static void map_free(struct uk_bbpalloc *b, uintptr_t
> first_page,
>         b->nr_free_pages += nr_pages;
>  }
>
> -static ssize_t bbuddy_availmem(struct uk_alloc *a)
> -{
> -       struct uk_bbpalloc *b;
> -
> -       UK_ASSERT(a != NULL);
> -       b = (struct uk_bbpalloc *)&a->priv;
> -       return (ssize_t) b->nr_free_pages << __PAGE_SHIFT;
> -}
> -
>  /* return log of the next power of two of passed number */
>  static inline unsigned long num_pages_to_order(unsigned long num_pages)
>  {
> @@ -360,6 +351,36 @@ static void bbuddy_pfree(struct uk_alloc *a, void
> *obj, unsigned long num_pages)
>         b->free_head[order] = freed_ch;
>  }
>
> +static long bbuddy_pmaxalloc(struct uk_alloc *a)
> +{
> +       struct uk_bbpalloc *b;
> +       size_t i, order;
> +
> +       UK_ASSERT(a != NULL);
> +       b = (struct uk_bbpalloc *)&a->priv;
> +
> +       /* Find biggest order that has still elements available */
> +       order = FREELIST_SIZE;
> +       for (i = 0; i < FREELIST_SIZE; i++) {
> +               if (!FREELIST_EMPTY(b->free_head[i]))
> +                       order = i;
> +       }
> +       if (order == FREELIST_SIZE)
> +               return 0; /* no memory left */
> +
> +       return (long) (1 << order);
> +}
> +
> +static long bbuddy_pavail(struct uk_alloc *a)
> +{
> +       struct uk_bbpalloc *b;
> +
> +       UK_ASSERT(a != NULL);
> +       b = (struct uk_bbpalloc *)&a->priv;
> +
> +       return (long) b->nr_free_pages;
> +}
> +
>  static int bbuddy_addmem(struct uk_alloc *a, void *base, size_t len)
>  {
>         struct uk_bbpalloc *b;
> @@ -501,8 +522,8 @@ struct uk_alloc *uk_allocbbuddy_init(void *base,
> size_t len)
>
>         /* initialize and register allocator interface */
>         uk_alloc_init_palloc(a, bbuddy_palloc, bbuddy_pfree,
> +                            bbuddy_pmaxalloc, bbuddy_pavail,
>                              bbuddy_addmem);
> -       a->availmem = bbuddy_availmem;
>
>         if (max > min + metalen) {
>                 /* add left memory - ignore return value */
> --
> 2.20.1
>
>

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

<div dir=3D"ltr"><div dir=3D"ltr">I have 2 inline comments for this patch.=
=C2=A0=C2=A0<br></div><br><div class=3D"gmail_quote"><div dir=3D"ltr" class=
=3D"gmail_attr">On Fri, Nov 20, 2020 at 5:47 PM Simon Kuenzer &lt;<a href=
=3D"mailto:simon.kuenzer@neclab.eu">simon.kuenzer@neclab.eu</a>&gt; wrote:<=
br></div><blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8e=
x;border-left:1px solid rgb(204,204,204);padding-left:1ex">This commit intr=
oduces<br>
- `uk_alloc_pavail()` as an equivalent for `uk_alloc_availmem()`<br>
=C2=A0 for page allocators.<br>
- `uk_alloc_pmaxalloc()` as an equivalent for `uk_alloc_maxalloc()`<br>
=C2=A0 for page allocators.<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/ukalloc/include/uk/alloc.h=C2=A0 =C2=A0 =C2=A0 | 21 +++++++++++++=
++<br>
=C2=A0lib/ukalloc/include/uk/alloc_impl.h |=C2=A0 7 +++--<br>
=C2=A0lib/ukallocbbuddy/bbuddy.c=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 | 41 +++=
+++++++++++++++++++-------<br>
=C2=A03 files changed, 57 insertions(+), 12 deletions(-)<br>
<br>
diff --git a/lib/ukalloc/include/uk/alloc.h b/lib/ukalloc/include/uk/alloc.=
h<br>
index af5a71cd..b711b56a 100644<br>
--- a/lib/ukalloc/include/uk/alloc.h<br>
+++ b/lib/ukalloc/include/uk/alloc.h<br>
@@ -68,6 +68,8 @@ typedef int=C2=A0 =C2=A0(*uk_alloc_addmem_func_t)<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (struct uk_alloc *a=
, void *base, size_t size);<br>
=C2=A0typedef ssize_t (*uk_alloc_availmem_func_t)<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (struct uk_alloc *a=
);<br>
+typedef long=C2=A0 (*uk_alloc_pavail_func_t)<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(struct uk_alloc *a=
);<br>
<br>
=C2=A0struct uk_alloc {<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 /* memory allocation */<br>
@@ -89,6 +91,8 @@ struct uk_alloc {<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 /* optional interfaces, but recommended */<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 uk_alloc_availmem_func_t maxalloc; /* biggest a=
lloc req. (bytes) */<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 uk_alloc_availmem_func_t availmem; /* total mem=
ory available (bytes) */<br></blockquote><div>Similar to the previous patch=
, I suggest to use either a more-general type name for both function</div><=
div>pointers(like `uk_alloc_pmeminfo_func_t`), preferable if there is a cha=
nce to add more memory</div><div>statistics functions, or a new type for pm=
axalloc, i.e. `uk_alloc_pmaxalloc_func_t`.=C2=A0</div><blockquote class=3D"=
gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(20=
4,204,204);padding-left:1ex">
+=C2=A0 =C2=A0 =C2=A0 =C2=A0uk_alloc_pavail_func_t pmaxalloc; /* biggest al=
loc req. (pages) */<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0uk_alloc_pavail_func_t pavail; /* total pages a=
vailable */<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 /* optional interface */<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 uk_alloc_addmem_func_t addmem;<br>
<br>
@@ -244,6 +248,15 @@ static inline ssize_t uk_alloc_maxalloc(struct uk_allo=
c *a)<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 return a-&gt;maxalloc(a);<br>
=C2=A0}<br>
<br>
+static inline long uk_alloc_pmaxalloc(struct uk_alloc *a)<br>
+{<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0UK_ASSERT(a);<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0if (!a-&gt;pmaxalloc)<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0return (long) -ENOT=
SUP;<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0return a-&gt;pmaxalloc(a);<br>
+}<br>
+<br>
+/* total free memory of the allocator */<br>
=C2=A0static inline ssize_t uk_alloc_availmem(struct uk_alloc *a)<br>
=C2=A0{<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 UK_ASSERT(a);<br>
@@ -252,6 +265,14 @@ static inline ssize_t uk_alloc_availmem(struct uk_allo=
c *a)<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 return a-&gt;availmem(a);<br>
=C2=A0}<br>
<br>
+static inline long uk_alloc_pavail(struct uk_alloc *a)<br>
+{<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0UK_ASSERT(a);<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0if (!a-&gt;pavail)<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0return (long) -ENOT=
SUP;<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0return a-&gt;pavail(a);<br>
+}<br>
+<br>
=C2=A0#ifdef __cplusplus<br>
=C2=A0}<br>
=C2=A0#endif<br>
diff --git a/lib/ukalloc/include/uk/alloc_impl.h b/lib/ukalloc/include/uk/a=
lloc_impl.h<br>
index beeb59f0..7e96ed94 100644<br>
--- a/lib/ukalloc/include/uk/alloc_impl.h<br>
+++ b/lib/ukalloc/include/uk/alloc_impl.h<br>
@@ -120,9 +120,10 @@ void uk_pfree_compat(struct uk_alloc *a, void *ptr, un=
signed long num_pages);<br>
=C2=A0#endif<br>
<br>
=C2=A0/* Shortcut for doing a registration of an allocator that only<br>
- * implements palloc(), pfree(), addmem()<br></blockquote><div>You omitted=
 to mention `pmaxalloc()`.=C2=A0</div><blockquote class=3D"gmail_quote" sty=
le=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);paddi=
ng-left:1ex">
+ * implements palloc(), pfree(), pavail(), addmem()<br>
=C2=A0 */<br>
-#define uk_alloc_init_palloc(a, palloc_func, pfree_func, addmem_func)=C2=
=A0 \<br>
+#define uk_alloc_init_palloc(a, palloc_func, pfree_func, pmaxalloc_func, \=
<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 pavail_func, addmem_func)=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 do {=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =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 (a)-&gt;malloc=C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0=3D uk_malloc_ifpages;=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 (a)-&gt;calloc=C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0=3D uk_calloc_compat;=C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0\<br>
@@ -132,6 +133,8 @@ void uk_pfree_compat(struct uk_alloc *a, void *ptr, uns=
igned long num_pages);<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (a)-&gt;free=C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0=3D uk_free_ifpages;=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 (a)-&gt;palloc=C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0=3D (palloc_func);=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 (a)-&gt;pfree=C2=A0=
 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =3D (pfree_func);=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(a)-&gt;pavail=C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0=3D (pavail_func);=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(a)-&gt;pmaxalloc=
=C2=A0 =C2=A0 =C2=A0 =3D (pmaxalloc_func);=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 (a)-&gt;addmem=C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0=3D (addmem_func);=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 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 uk_alloc_register((=
a));=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =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>
diff --git a/lib/ukallocbbuddy/bbuddy.c b/lib/ukallocbbuddy/bbuddy.c<br>
index 3730eeb2..b63e2fd3 100644<br>
--- a/lib/ukallocbbuddy/bbuddy.c<br>
+++ b/lib/ukallocbbuddy/bbuddy.c<br>
@@ -214,15 +214,6 @@ static void map_free(struct uk_bbpalloc *b, uintptr_t =
first_page,<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 b-&gt;nr_free_pages +=3D nr_pages;<br>
=C2=A0}<br>
<br>
-static ssize_t bbuddy_availmem(struct uk_alloc *a)<br>
-{<br>
-=C2=A0 =C2=A0 =C2=A0 =C2=A0struct uk_bbpalloc *b;<br>
-<br>
-=C2=A0 =C2=A0 =C2=A0 =C2=A0UK_ASSERT(a !=3D NULL);<br>
-=C2=A0 =C2=A0 =C2=A0 =C2=A0b =3D (struct uk_bbpalloc *)&amp;a-&gt;priv;<br=
>
-=C2=A0 =C2=A0 =C2=A0 =C2=A0return (ssize_t) b-&gt;nr_free_pages &lt;&lt; _=
_PAGE_SHIFT;<br>
-}<br>
-<br>
=C2=A0/* return log of the next power of two of passed number */<br>
=C2=A0static inline unsigned long num_pages_to_order(unsigned long num_page=
s)<br>
=C2=A0{<br>
@@ -360,6 +351,36 @@ static void bbuddy_pfree(struct uk_alloc *a, void *obj=
, unsigned long num_pages)<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 b-&gt;free_head[order] =3D freed_ch;<br>
=C2=A0}<br>
<br>
+static long bbuddy_pmaxalloc(struct uk_alloc *a)<br>
+{<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0struct uk_bbpalloc *b;<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0size_t i, order;<br>
+<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0UK_ASSERT(a !=3D NULL);<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0b =3D (struct uk_bbpalloc *)&amp;a-&gt;priv;<br=
>
+<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0/* Find biggest order that has still elements a=
vailable */<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0order =3D FREELIST_SIZE;<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0for (i =3D 0; i &lt; FREELIST_SIZE; i++) {<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0if (!FREELIST_EMPTY=
(b-&gt;free_head[i]))<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0order =3D i;<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0}<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0if (order =3D=3D FREELIST_SIZE)<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0return 0; /* no mem=
ory left */<br>
+<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0return (long) (1 &lt;&lt; order);<br>
+}<br>
+<br>
+static long bbuddy_pavail(struct uk_alloc *a)<br>
+{<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0struct uk_bbpalloc *b;<br>
+<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0UK_ASSERT(a !=3D NULL);<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0b =3D (struct uk_bbpalloc *)&amp;a-&gt;priv;<br=
>
+<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0return (long) b-&gt;nr_free_pages;<br>
+}<br>
+<br>
=C2=A0static int bbuddy_addmem(struct uk_alloc *a, void *base, size_t len)<=
br>
=C2=A0{<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 struct uk_bbpalloc *b;<br>
@@ -501,8 +522,8 @@ struct uk_alloc *uk_allocbbuddy_init(void *base, size_t=
 len)<br>
<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 /* initialize and register allocator interface =
*/<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 uk_alloc_init_palloc(a, bbuddy_palloc, bbuddy_p=
free,<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 bbuddy_pmaxalloc, bbuddy_pavail,<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=A0bbuddy_addmem);<br>
-=C2=A0 =C2=A0 =C2=A0 =C2=A0a-&gt;availmem =3D bbuddy_availmem;<br>
<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 if (max &gt; min + metalen) {<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 /* add left memory =
- ignore return value */<br>
-- <br>
2.20.1<br>
<br>
</blockquote></div></div>

--000000000000a7077b05b8520fe5--


From minios-devel-bounces@lists.xenproject.org Thu Jan 07 16:49:07 2021
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Thu, 07 Jan 2021 16:49:07 +0000
Received: from list by lists.xenproject.org with outflank-mailman.62994.111788 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1kxYTB-0003O5-Ui; Thu, 07 Jan 2021 16:49:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 62994.111788; Thu, 07 Jan 2021 16: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 1kxYTB-0003Ny-Qh; Thu, 07 Jan 2021 16:49:05 +0000
Received: by outflank-mailman (input) for mailman id 62994;
 Thu, 07 Jan 2021 16:49: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=g3Qq=GK=gmail.com=lrbarbulescu@srs-us1.protection.inumbo.net>)
 id 1kxYTA-0003Nt-E6
 for minios-devel@lists.xen.org; Thu, 07 Jan 2021 16:49:04 +0000
Received: from mail-lf1-x12f.google.com (unknown [2a00:1450:4864:20::12f])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 0e962141-b787-40a7-a1a2-ef890dd91833;
 Thu, 07 Jan 2021 16:49:02 +0000 (UTC)
Received: by mail-lf1-x12f.google.com with SMTP id a12so16101961lfl.6
 for <minios-devel@lists.xen.org>; Thu, 07 Jan 2021 08:49: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: 0e962141-b787-40a7-a1a2-ef890dd91833
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=ogRT0iedgXwl7GPt93yEEL5blq3KR5BKeBq/tNIsFks=;
        b=qMspRQAUhZNy9wOvHZvsuofYLfVpFTz+O/G0ADR/1Kc91jmlMfhtP653WF1zIFhiRe
         b6onOKnX6lT0edtnUQyoLSAz40tewbU+1WLWqCVCm2It9PaNfIZUKf3v9xa1ILJmN5GI
         2VEPe+uF/LIikWYEFW0lme6Zm4Omcxwaez2qJckmvdZonRPiMRehqP8hfP1BrRxGTNI1
         IG8Kcgyr4imjQzTcZYMzKuNj55eZZfT2+T1302Ad92KQtMf9+i5kxxDcVLot80KFyG/K
         5UIBcOsSGMCs8WkFcgx72bg+7dxQY+YBCiYct03myHnizKFWuR5z9XDEpptjOOPx9Hqt
         /K3A==
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=ogRT0iedgXwl7GPt93yEEL5blq3KR5BKeBq/tNIsFks=;
        b=TMWrUNwEn3DEqAfGnYpZEDzzT3N2cJDL37lI8hei2a4kGAFmiQHgM1mS6x5yv8ntHE
         Es66pl5Zd39oEn83sk3NX2tD7sq9S9sqAvlSVS4erafEVpCx89u2TuAobKlEbWTYHuNJ
         RX7Cp0MiwzAwu3sgJOxIFngKqOq5iZG35V82pZELYtNIGE6I/eRLtQMLnvR/nP6zM4h0
         XgUqAimatHaMcjy3kZualUFOTwNqmqOcsVmRsJxblg4WQgCyPxoGGaleK7F8jNlH3Sa/
         ITchdNPQQGNeZ2fod4Txi5USSCb4/tQFc3JeT2k9ikDn6J7EU2jKncaTvNydGHadYf6j
         mqjA==
X-Gm-Message-State: AOAM5313xntyLoJ4NIG+pTO2Hk/732Qlj5uKPEIdkqADgCXReYApSe+Y
	nc8QmKfK7YAGNA2jYH0Wf4R4Iebzpk8blsKfdk0kOS0Eo1g=
X-Google-Smtp-Source: ABdhPJwV+u7uQWQVTTO6r+TLU6qfiliuheZHzjbKgxHfAofjv7V2dwmN9dQ7eizKNPPMW8Hh0KfWdP+G8c6iuOfdJdA=
X-Received: by 2002:a19:e17:: with SMTP id 23mr4606234lfo.608.1610038141293;
 Thu, 07 Jan 2021 08:49:01 -0800 (PST)
MIME-Version: 1.0
References: <20201120154612.27579-1-simon.kuenzer@neclab.eu> <20201120154612.27579-8-simon.kuenzer@neclab.eu>
In-Reply-To: <20201120154612.27579-8-simon.kuenzer@neclab.eu>
From: Laurentiu Barbulescu <lrbarbulescu@gmail.com>
Date: Thu, 7 Jan 2021 18:48:45 +0200
Message-ID: <CAMpNDKkHEzDycw8oe=RsZsCcKVJVyYuORcVWQkgxqMuXkVmS8Q@mail.gmail.com>
Subject: Re: [UNIKRAFT PATCH 07/18] lib/ukalloc: Wrappers for "fee memory" interfaces
To: Simon Kuenzer <simon.kuenzer@neclab.eu>
Cc: minios-devel@lists.xen.org, Felipe Huici <felipe.huici@neclab.eu>, 
	Sharan Santhanam <sharan.santhanam@neclab.eu>
Content-Type: multipart/alternative; boundary="0000000000007c95f405b85237d0"

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

The following allocation:
struct uk_alloc *s = uk_alloc_get_default();
ssize_t maxalloc = uk_alloc_maxalloc(s);
char *a = (char *)uk_malloc(s, maxalloc);
would fail, because the real size that needs to be allocated is
`maxalloc+sizeof(struct metadata_ifpages)`.
Honestly, I don't know if we should substract, in the
`uk_alloc_maxalloc_ifpages()` function,
that extra metadata size which is necessary for every allocation, but
basically the biggest
allocation that an allocator can satisfy is `maxalloc-sizeof(struct
metadata_ifpages)`.

On Fri, Nov 20, 2020 at 5:47 PM Simon Kuenzer <simon.kuenzer@neclab.eu>
wrote:

> This commit provides cross compatibility wrappers between page and non-page
> allocators: `uk_alloc_availmem()`, `uk_alloc_maxalloc()`,
> `uk_alloc_pavail()`, and `uk_alloc_pmaxalloc()`.
>
> Signed-off-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
> ---
>  lib/ukalloc/alloc.c                 | 52 +++++++++++++++++++++++++++++
>  lib/ukalloc/exportsyms.uk           |  4 +++
>  lib/ukalloc/include/uk/alloc_impl.h | 20 ++++++++++-
>  3 files changed, 75 insertions(+), 1 deletion(-)
>
> diff --git a/lib/ukalloc/alloc.c b/lib/ukalloc/alloc.c
> index 98a0e94f..bb92301d 100644
> --- a/lib/ukalloc/alloc.c
> +++ b/lib/ukalloc/alloc.c
> @@ -271,6 +271,32 @@ int uk_posix_memalign_ifpages(struct uk_alloc *a,
>         return 0;
>  }
>
> +ssize_t uk_alloc_maxalloc_ifpages(struct uk_alloc *a)
> +{
> +       long num_pages;
> +
> +       UK_ASSERT(a);
> +
> +       num_pages = uk_alloc_pmaxalloc(a);
> +       if (num_pages < 0)
> +               return (ssize_t) num_pages;
> +
> +       return ((ssize_t) num_pages) << __PAGE_SHIFT;
> +}
> +
> +ssize_t uk_alloc_availmem_ifpages(struct uk_alloc *a)
> +{
> +       long num_pages;
> +
> +       UK_ASSERT(a);
> +
> +       num_pages = uk_alloc_pavail(a);
> +       if (num_pages < 0)
> +               return (ssize_t) num_pages;
> +
> +       return ((ssize_t) num_pages) << __PAGE_SHIFT;
> +}
> +
>  #if CONFIG_LIBUKALLOC_IFMALLOC
>
>  struct metadata_ifmalloc {
> @@ -490,3 +516,29 @@ void *uk_memalign_compat(struct uk_alloc *a, size_t
> align, size_t size)
>
>         return ptr;
>  }
> +
> +long uk_alloc_pmaxalloc_compat(struct uk_alloc *a)
> +{
> +       ssize_t mem;
> +
> +       UK_ASSERT(a);
> +
> +       mem = uk_alloc_maxalloc(a);
> +       if (mem < 0)
> +               return (long) mem;
> +
> +       return (long) (mem >> __PAGE_SHIFT);
> +}
> +
> +long uk_alloc_pavail_compat(struct uk_alloc *a)
> +{
> +       ssize_t mem;
> +
> +       UK_ASSERT(a);
> +
> +       mem = uk_alloc_availmem(a);
> +       if (mem < 0)
> +               return (long) mem;
> +
> +       return (long) (mem >> __PAGE_SHIFT);
> +}
> diff --git a/lib/ukalloc/exportsyms.uk b/lib/ukalloc/exportsyms.uk
> index 21c1996f..a99551bd 100644
> --- a/lib/ukalloc/exportsyms.uk
> +++ b/lib/ukalloc/exportsyms.uk
> @@ -4,6 +4,8 @@ uk_malloc_ifpages
>  uk_free_ifpages
>  uk_realloc_ifpages
>  uk_posix_memalign_ifpages
> +uk_alloc_maxalloc_ifpages
> +uk_alloc_availmem_ifpages
>  uk_malloc_ifmalloc
>  uk_realloc_ifmalloc
>  uk_posix_memalign_ifmalloc
> @@ -13,4 +15,6 @@ uk_memalign_compat
>  uk_realloc_compat
>  uk_palloc_compat
>  uk_pfree_compat
> +uk_alloc_pmaxalloc_compat
> +uk_alloc_pavail_compat
>  _uk_alloc_head
> diff --git a/lib/ukalloc/include/uk/alloc_impl.h
> b/lib/ukalloc/include/uk/alloc_impl.h
> index 7e96ed94..4811558e 100644
> --- a/lib/ukalloc/include/uk/alloc_impl.h
> +++ b/lib/ukalloc/include/uk/alloc_impl.h
> @@ -53,12 +53,16 @@ int uk_alloc_register(struct uk_alloc *a);
>   * API functionality is actually implemented.
>   */
>
> -/* Functions that can be used by allocators that implement palloc(),
> pfree() only */
> +/* Functions that can be used by allocators that implement palloc(),
> + * pfree() and potentially pavail(), pmaxalloc() only
> + */
>  void *uk_malloc_ifpages(struct uk_alloc *a, size_t size);
>  void *uk_realloc_ifpages(struct uk_alloc *a, void *ptr, size_t size);
>  int uk_posix_memalign_ifpages(struct uk_alloc *a, void **memptr,
>                                 size_t align, size_t size);
>  void uk_free_ifpages(struct uk_alloc *a, void *ptr);
> +ssize_t uk_alloc_availmem_ifpages(struct uk_alloc *a);
> +ssize_t uk_alloc_maxalloc_ifpages(struct uk_alloc *a);
>
>  #if CONFIG_LIBUKALLOC_IFMALLOC
>  void *uk_malloc_ifmalloc(struct uk_alloc *a, size_t size);
> @@ -74,6 +78,8 @@ void *uk_realloc_compat(struct uk_alloc *a, void *ptr,
> size_t size);
>  void *uk_memalign_compat(struct uk_alloc *a, size_t align, size_t len);
>  void *uk_palloc_compat(struct uk_alloc *a, unsigned long num_pages);
>  void uk_pfree_compat(struct uk_alloc *a, void *ptr, unsigned long
> num_pages);
> +long uk_alloc_pavail_compat(struct uk_alloc *a);
> +long uk_alloc_pmaxalloc_compat(struct uk_alloc *a);
>
>  /* Shortcut for doing a registration of an allocator that does not
> implement
>   * palloc() or pfree()
> @@ -91,7 +97,11 @@ void uk_pfree_compat(struct uk_alloc *a, void *ptr,
> unsigned long num_pages);
>                 (a)->palloc         = uk_palloc_compat;                 \
>                 (a)->pfree          = uk_pfree_compat;                  \
>                 (a)->availmem       = (availmem_f);                     \
> +               (a)->pavail         = (availmem_f != NULL)              \
> +                                     ? uk_alloc_pavail_compat : NULL;  \
>                 (a)->maxalloc       = (maxalloc_f);                     \
> +               (a)->pmaxalloc      = (maxalloc_f != NULL)              \
> +                                     ? uk_alloc_pmaxalloc_compat : NULL; \
>                 (a)->addmem         = (addmem_f);                       \
>                                                                         \
>                 uk_alloc_register((a));                                 \
> @@ -112,7 +122,11 @@ void uk_pfree_compat(struct uk_alloc *a, void *ptr,
> unsigned long num_pages);
>                 (a)->palloc         = uk_palloc_compat;                 \
>                 (a)->pfree          = uk_pfree_compat;                  \
>                 (a)->availmem       = (availmem_f);                     \
> +               (a)->pavail         = (availmem_f != NULL)              \
> +                                     ? uk_alloc_pavail_compat : NULL;  \
>                 (a)->maxalloc       = (maxalloc_f);                     \
> +               (a)->pmaxalloc      = (maxalloc_f != NULL)              \
> +                                     ? uk_alloc_pmaxalloc_compat : NULL; \
>                 (a)->addmem         = (addmem_f);                       \
>                                                                         \
>                 uk_alloc_register((a));                                 \
> @@ -134,7 +148,11 @@ void uk_pfree_compat(struct uk_alloc *a, void *ptr,
> unsigned long num_pages);
>                 (a)->palloc         = (palloc_func);                    \
>                 (a)->pfree          = (pfree_func);                     \
>                 (a)->pavail         = (pavail_func);                    \
> +               (a)->availmem       = (pavail_func != NULL)             \
> +                                     ? uk_alloc_availmem_ifpages : NULL; \
>                 (a)->pmaxalloc      = (pmaxalloc_func);                 \
> +               (a)->maxalloc       = (pmaxalloc_func != NULL)          \
> +                                     ? uk_alloc_maxalloc_ifpages : NULL; \
>                 (a)->addmem         = (addmem_func);                    \
>                                                                         \
>                 uk_alloc_register((a));                                 \
> --
> 2.20.1
>
>

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

PGRpdiBkaXI9Imx0ciI+PGRpdj5UaGUgZm9sbG93aW5nIGFsbG9jYXRpb246PGJyPnN0cnVjdCB1
a19hbGxvYyAqcyA9IHVrX2FsbG9jX2dldF9kZWZhdWx0KCk7PGJyPnNzaXplX3QgbWF4YWxsb2Mg
PSB1a19hbGxvY19tYXhhbGxvYyhzKTs8YnI+Y2hhciAqYSA9IChjaGFyICopdWtfbWFsbG9jKHMs
IG1heGFsbG9jKTs8YnI+d291bGQgZmFpbCwgYmVjYXVzZSB0aGUgcmVhbCBzaXplIHRoYXQgbmVl
ZHMgdG8gYmUgYWxsb2NhdGVkIGlzIGBtYXhhbGxvYytzaXplb2Yoc3RydWN0IG1ldGFkYXRhX2lm
cGFnZXMpYC48YnI+SG9uZXN0bHksIEkgZG9uJiMzOTt0IGtub3cgaWYgd2Ugc2hvdWxkIHN1YnN0
cmFjdCwgaW4gdGhlIGB1a19hbGxvY19tYXhhbGxvY19pZnBhZ2VzKClgIGZ1bmN0aW9uLDwvZGl2
PjxkaXY+dGhhdCBleHRyYSBtZXRhZGF0YSBzaXplIHdoaWNoIGlzIG5lY2Vzc2FyeSBmb3IgZXZl
cnkgYWxsb2NhdGlvbiwgYnV0wqAgYmFzaWNhbGx5IHRoZSBiaWdnZXN0PC9kaXY+PGRpdj5hbGxv
Y2F0aW9uIHRoYXQgYW4gYWxsb2NhdG9yIGNhbiBzYXRpc2Z5IGlzIGBtYXhhbGxvYy1zaXplb2Yo
c3RydWN0IG1ldGFkYXRhX2lmcGFnZXMpYC48L2Rpdj48YnI+PGRpdiBjbGFzcz0iZ21haWxfcXVv
dGUiPjxkaXYgZGlyPSJsdHIiIGNsYXNzPSJnbWFpbF9hdHRyIj5PbiBGcmksIE5vdiAyMCwgMjAy
MCBhdCA1OjQ3IFBNIFNpbW9uIEt1ZW56ZXIgJmx0OzxhIGhyZWY9Im1haWx0bzpzaW1vbi5rdWVu
emVyQG5lY2xhYi5ldSI+c2ltb24ua3VlbnplckBuZWNsYWIuZXU8L2E+Jmd0OyB3cm90ZTo8YnI+
PC9kaXY+PGJsb2NrcXVvdGUgY2xhc3M9ImdtYWlsX3F1b3RlIiBzdHlsZT0ibWFyZ2luOjBweCAw
cHggMHB4IDAuOGV4O2JvcmRlci1sZWZ0OjFweCBzb2xpZCByZ2IoMjA0LDIwNCwyMDQpO3BhZGRp
bmctbGVmdDoxZXgiPlRoaXMgY29tbWl0IHByb3ZpZGVzIGNyb3NzIGNvbXBhdGliaWxpdHkgd3Jh
cHBlcnMgYmV0d2VlbiBwYWdlIGFuZCBub24tcGFnZTxicj4NCmFsbG9jYXRvcnM6IGB1a19hbGxv
Y19hdmFpbG1lbSgpYCwgYHVrX2FsbG9jX21heGFsbG9jKClgLDxicj4NCmB1a19hbGxvY19wYXZh
aWwoKWAsIGFuZCBgdWtfYWxsb2NfcG1heGFsbG9jKClgLjxicj4NCjxicj4NClNpZ25lZC1vZmYt
Ynk6IFNpbW9uIEt1ZW56ZXIgJmx0OzxhIGhyZWY9Im1haWx0bzpzaW1vbi5rdWVuemVyQG5lY2xh
Yi5ldSIgdGFyZ2V0PSJfYmxhbmsiPnNpbW9uLmt1ZW56ZXJAbmVjbGFiLmV1PC9hPiZndDs8YnI+
DQotLS08YnI+DQrCoGxpYi91a2FsbG9jL2FsbG9jLmPCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDC
oHwgNTIgKysrKysrKysrKysrKysrKysrKysrKysrKysrKys8YnI+DQrCoGxpYi91a2FsbG9jLzxh
IGhyZWY9Imh0dHA6Ly9leHBvcnRzeW1zLnVrIiByZWw9Im5vcmVmZXJyZXIiIHRhcmdldD0iX2Js
YW5rIj5leHBvcnRzeW1zLnVrPC9hPsKgIMKgIMKgIMKgIMKgIMKgfMKgIDQgKysrPGJyPg0KwqBs
aWIvdWthbGxvYy9pbmNsdWRlL3VrL2FsbG9jX2ltcGwuaCB8IDIwICsrKysrKysrKystPGJyPg0K
wqAzIGZpbGVzIGNoYW5nZWQsIDc1IGluc2VydGlvbnMoKyksIDEgZGVsZXRpb24oLSk8YnI+DQo8
YnI+DQpkaWZmIC0tZ2l0IGEvbGliL3VrYWxsb2MvYWxsb2MuYyBiL2xpYi91a2FsbG9jL2FsbG9j
LmM8YnI+DQppbmRleCA5OGEwZTk0Zi4uYmI5MjMwMWQgMTAwNjQ0PGJyPg0KLS0tIGEvbGliL3Vr
YWxsb2MvYWxsb2MuYzxicj4NCisrKyBiL2xpYi91a2FsbG9jL2FsbG9jLmM8YnI+DQpAQCAtMjcx
LDYgKzI3MSwzMiBAQCBpbnQgdWtfcG9zaXhfbWVtYWxpZ25faWZwYWdlcyhzdHJ1Y3QgdWtfYWxs
b2MgKmEsPGJyPg0KwqAgwqAgwqAgwqAgcmV0dXJuIDA7PGJyPg0KwqB9PGJyPg0KPGJyPg0KK3Nz
aXplX3QgdWtfYWxsb2NfbWF4YWxsb2NfaWZwYWdlcyhzdHJ1Y3QgdWtfYWxsb2MgKmEpPGJyPg0K
K3s8YnI+DQorwqAgwqAgwqAgwqBsb25nIG51bV9wYWdlczs8YnI+DQorPGJyPg0KK8KgIMKgIMKg
IMKgVUtfQVNTRVJUKGEpOzxicj4NCis8YnI+DQorwqAgwqAgwqAgwqBudW1fcGFnZXMgPSB1a19h
bGxvY19wbWF4YWxsb2MoYSk7PGJyPg0KK8KgIMKgIMKgIMKgaWYgKG51bV9wYWdlcyAmbHQ7IDAp
PGJyPg0KK8KgIMKgIMKgIMKgIMKgIMKgIMKgIMKgcmV0dXJuIChzc2l6ZV90KSBudW1fcGFnZXM7
PGJyPg0KKzxicj4NCivCoCDCoCDCoCDCoHJldHVybiAoKHNzaXplX3QpIG51bV9wYWdlcykgJmx0
OyZsdDsgX19QQUdFX1NISUZUOzxicj4NCit9PGJyPg0KKzxicj4NCitzc2l6ZV90IHVrX2FsbG9j
X2F2YWlsbWVtX2lmcGFnZXMoc3RydWN0IHVrX2FsbG9jICphKTxicj4NCit7PGJyPg0KK8KgIMKg
IMKgIMKgbG9uZyBudW1fcGFnZXM7PGJyPg0KKzxicj4NCivCoCDCoCDCoCDCoFVLX0FTU0VSVChh
KTs8YnI+DQorPGJyPg0KK8KgIMKgIMKgIMKgbnVtX3BhZ2VzID0gdWtfYWxsb2NfcGF2YWlsKGEp
Ozxicj4NCivCoCDCoCDCoCDCoGlmIChudW1fcGFnZXMgJmx0OyAwKTxicj4NCivCoCDCoCDCoCDC
oCDCoCDCoCDCoCDCoHJldHVybiAoc3NpemVfdCkgbnVtX3BhZ2VzOzxicj4NCis8YnI+DQorwqAg
wqAgwqAgwqByZXR1cm4gKChzc2l6ZV90KSBudW1fcGFnZXMpICZsdDsmbHQ7IF9fUEFHRV9TSElG
VDs8YnI+DQorfTxicj4NCis8YnI+DQrCoCNpZiBDT05GSUdfTElCVUtBTExPQ19JRk1BTExPQzxi
cj4NCjxicj4NCsKgc3RydWN0IG1ldGFkYXRhX2lmbWFsbG9jIHs8YnI+DQpAQCAtNDkwLDMgKzUx
NiwyOSBAQCB2b2lkICp1a19tZW1hbGlnbl9jb21wYXQoc3RydWN0IHVrX2FsbG9jICphLCBzaXpl
X3QgYWxpZ24sIHNpemVfdCBzaXplKTxicj4NCjxicj4NCsKgIMKgIMKgIMKgIHJldHVybiBwdHI7
PGJyPg0KwqB9PGJyPg0KKzxicj4NCitsb25nIHVrX2FsbG9jX3BtYXhhbGxvY19jb21wYXQoc3Ry
dWN0IHVrX2FsbG9jICphKTxicj4NCit7PGJyPg0KK8KgIMKgIMKgIMKgc3NpemVfdCBtZW07PGJy
Pg0KKzxicj4NCivCoCDCoCDCoCDCoFVLX0FTU0VSVChhKTs8YnI+DQorPGJyPg0KK8KgIMKgIMKg
IMKgbWVtID0gdWtfYWxsb2NfbWF4YWxsb2MoYSk7PGJyPg0KK8KgIMKgIMKgIMKgaWYgKG1lbSAm
bHQ7IDApPGJyPg0KK8KgIMKgIMKgIMKgIMKgIMKgIMKgIMKgcmV0dXJuIChsb25nKSBtZW07PGJy
Pg0KKzxicj4NCivCoCDCoCDCoCDCoHJldHVybiAobG9uZykgKG1lbSAmZ3Q7Jmd0OyBfX1BBR0Vf
U0hJRlQpOzxicj4NCit9PGJyPg0KKzxicj4NCitsb25nIHVrX2FsbG9jX3BhdmFpbF9jb21wYXQo
c3RydWN0IHVrX2FsbG9jICphKTxicj4NCit7PGJyPg0KK8KgIMKgIMKgIMKgc3NpemVfdCBtZW07
PGJyPg0KKzxicj4NCivCoCDCoCDCoCDCoFVLX0FTU0VSVChhKTs8YnI+DQorPGJyPg0KK8KgIMKg
IMKgIMKgbWVtID0gdWtfYWxsb2NfYXZhaWxtZW0oYSk7PGJyPg0KK8KgIMKgIMKgIMKgaWYgKG1l
bSAmbHQ7IDApPGJyPg0KK8KgIMKgIMKgIMKgIMKgIMKgIMKgIMKgcmV0dXJuIChsb25nKSBtZW07
PGJyPg0KKzxicj4NCivCoCDCoCDCoCDCoHJldHVybiAobG9uZykgKG1lbSAmZ3Q7Jmd0OyBfX1BB
R0VfU0hJRlQpOzxicj4NCit9PGJyPg0KZGlmZiAtLWdpdCBhL2xpYi91a2FsbG9jLzxhIGhyZWY9
Imh0dHA6Ly9leHBvcnRzeW1zLnVrIiByZWw9Im5vcmVmZXJyZXIiIHRhcmdldD0iX2JsYW5rIj5l
eHBvcnRzeW1zLnVrPC9hPiBiL2xpYi91a2FsbG9jLzxhIGhyZWY9Imh0dHA6Ly9leHBvcnRzeW1z
LnVrIiByZWw9Im5vcmVmZXJyZXIiIHRhcmdldD0iX2JsYW5rIj5leHBvcnRzeW1zLnVrPC9hPjxi
cj4NCmluZGV4IDIxYzE5OTZmLi5hOTk1NTFiZCAxMDA2NDQ8YnI+DQotLS0gYS9saWIvdWthbGxv
Yy88YSBocmVmPSJodHRwOi8vZXhwb3J0c3ltcy51ayIgcmVsPSJub3JlZmVycmVyIiB0YXJnZXQ9
Il9ibGFuayI+ZXhwb3J0c3ltcy51azwvYT48YnI+DQorKysgYi9saWIvdWthbGxvYy88YSBocmVm
PSJodHRwOi8vZXhwb3J0c3ltcy51ayIgcmVsPSJub3JlZmVycmVyIiB0YXJnZXQ9Il9ibGFuayI+
ZXhwb3J0c3ltcy51azwvYT48YnI+DQpAQCAtNCw2ICs0LDggQEAgdWtfbWFsbG9jX2lmcGFnZXM8
YnI+DQrCoHVrX2ZyZWVfaWZwYWdlczxicj4NCsKgdWtfcmVhbGxvY19pZnBhZ2VzPGJyPg0KwqB1
a19wb3NpeF9tZW1hbGlnbl9pZnBhZ2VzPGJyPg0KK3VrX2FsbG9jX21heGFsbG9jX2lmcGFnZXM8
YnI+DQordWtfYWxsb2NfYXZhaWxtZW1faWZwYWdlczxicj4NCsKgdWtfbWFsbG9jX2lmbWFsbG9j
PGJyPg0KwqB1a19yZWFsbG9jX2lmbWFsbG9jPGJyPg0KwqB1a19wb3NpeF9tZW1hbGlnbl9pZm1h
bGxvYzxicj4NCkBAIC0xMyw0ICsxNSw2IEBAIHVrX21lbWFsaWduX2NvbXBhdDxicj4NCsKgdWtf
cmVhbGxvY19jb21wYXQ8YnI+DQrCoHVrX3BhbGxvY19jb21wYXQ8YnI+DQrCoHVrX3BmcmVlX2Nv
bXBhdDxicj4NCit1a19hbGxvY19wbWF4YWxsb2NfY29tcGF0PGJyPg0KK3VrX2FsbG9jX3BhdmFp
bF9jb21wYXQ8YnI+DQrCoF91a19hbGxvY19oZWFkPGJyPg0KZGlmZiAtLWdpdCBhL2xpYi91a2Fs
bG9jL2luY2x1ZGUvdWsvYWxsb2NfaW1wbC5oIGIvbGliL3VrYWxsb2MvaW5jbHVkZS91ay9hbGxv
Y19pbXBsLmg8YnI+DQppbmRleCA3ZTk2ZWQ5NC4uNDgxMTU1OGUgMTAwNjQ0PGJyPg0KLS0tIGEv
bGliL3VrYWxsb2MvaW5jbHVkZS91ay9hbGxvY19pbXBsLmg8YnI+DQorKysgYi9saWIvdWthbGxv
Yy9pbmNsdWRlL3VrL2FsbG9jX2ltcGwuaDxicj4NCkBAIC01MywxMiArNTMsMTYgQEAgaW50IHVr
X2FsbG9jX3JlZ2lzdGVyKHN0cnVjdCB1a19hbGxvYyAqYSk7PGJyPg0KwqAgKiBBUEkgZnVuY3Rp
b25hbGl0eSBpcyBhY3R1YWxseSBpbXBsZW1lbnRlZC48YnI+DQrCoCAqLzxicj4NCjxicj4NCi0v
KiBGdW5jdGlvbnMgdGhhdCBjYW4gYmUgdXNlZCBieSBhbGxvY2F0b3JzIHRoYXQgaW1wbGVtZW50
IHBhbGxvYygpLCBwZnJlZSgpIG9ubHkgKi88YnI+DQorLyogRnVuY3Rpb25zIHRoYXQgY2FuIGJl
IHVzZWQgYnkgYWxsb2NhdG9ycyB0aGF0IGltcGxlbWVudCBwYWxsb2MoKSw8YnI+DQorICogcGZy
ZWUoKSBhbmQgcG90ZW50aWFsbHkgcGF2YWlsKCksIHBtYXhhbGxvYygpIG9ubHk8YnI+DQorICov
PGJyPg0KwqB2b2lkICp1a19tYWxsb2NfaWZwYWdlcyhzdHJ1Y3QgdWtfYWxsb2MgKmEsIHNpemVf
dCBzaXplKTs8YnI+DQrCoHZvaWQgKnVrX3JlYWxsb2NfaWZwYWdlcyhzdHJ1Y3QgdWtfYWxsb2Mg
KmEsIHZvaWQgKnB0ciwgc2l6ZV90IHNpemUpOzxicj4NCsKgaW50IHVrX3Bvc2l4X21lbWFsaWdu
X2lmcGFnZXMoc3RydWN0IHVrX2FsbG9jICphLCB2b2lkICoqbWVtcHRyLDxicj4NCsKgIMKgIMKg
IMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIHNpemVfdCBhbGlnbiwgc2l6
ZV90IHNpemUpOzxicj4NCsKgdm9pZCB1a19mcmVlX2lmcGFnZXMoc3RydWN0IHVrX2FsbG9jICph
LCB2b2lkICpwdHIpOzxicj4NCitzc2l6ZV90IHVrX2FsbG9jX2F2YWlsbWVtX2lmcGFnZXMoc3Ry
dWN0IHVrX2FsbG9jICphKTs8YnI+DQorc3NpemVfdCB1a19hbGxvY19tYXhhbGxvY19pZnBhZ2Vz
KHN0cnVjdCB1a19hbGxvYyAqYSk7PGJyPg0KPGJyPg0KwqAjaWYgQ09ORklHX0xJQlVLQUxMT0Nf
SUZNQUxMT0M8YnI+DQrCoHZvaWQgKnVrX21hbGxvY19pZm1hbGxvYyhzdHJ1Y3QgdWtfYWxsb2Mg
KmEsIHNpemVfdCBzaXplKTs8YnI+DQpAQCAtNzQsNiArNzgsOCBAQCB2b2lkICp1a19yZWFsbG9j
X2NvbXBhdChzdHJ1Y3QgdWtfYWxsb2MgKmEsIHZvaWQgKnB0ciwgc2l6ZV90IHNpemUpOzxicj4N
CsKgdm9pZCAqdWtfbWVtYWxpZ25fY29tcGF0KHN0cnVjdCB1a19hbGxvYyAqYSwgc2l6ZV90IGFs
aWduLCBzaXplX3QgbGVuKTs8YnI+DQrCoHZvaWQgKnVrX3BhbGxvY19jb21wYXQoc3RydWN0IHVr
X2FsbG9jICphLCB1bnNpZ25lZCBsb25nIG51bV9wYWdlcyk7PGJyPg0KwqB2b2lkIHVrX3BmcmVl
X2NvbXBhdChzdHJ1Y3QgdWtfYWxsb2MgKmEsIHZvaWQgKnB0ciwgdW5zaWduZWQgbG9uZyBudW1f
cGFnZXMpOzxicj4NCitsb25nIHVrX2FsbG9jX3BhdmFpbF9jb21wYXQoc3RydWN0IHVrX2FsbG9j
ICphKTs8YnI+DQorbG9uZyB1a19hbGxvY19wbWF4YWxsb2NfY29tcGF0KHN0cnVjdCB1a19hbGxv
YyAqYSk7PGJyPg0KPGJyPg0KwqAvKiBTaG9ydGN1dCBmb3IgZG9pbmcgYSByZWdpc3RyYXRpb24g
b2YgYW4gYWxsb2NhdG9yIHRoYXQgZG9lcyBub3QgaW1wbGVtZW50PGJyPg0KwqAgKiBwYWxsb2Mo
KSBvciBwZnJlZSgpPGJyPg0KQEAgLTkxLDcgKzk3LDExIEBAIHZvaWQgdWtfcGZyZWVfY29tcGF0
KHN0cnVjdCB1a19hbGxvYyAqYSwgdm9pZCAqcHRyLCB1bnNpZ25lZCBsb25nIG51bV9wYWdlcyk7
PGJyPg0KwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgKGEpLSZndDtwYWxsb2PCoCDCoCDCoCDCoCDC
oD0gdWtfcGFsbG9jX2NvbXBhdDvCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoFw8YnI+DQrCoCDC
oCDCoCDCoCDCoCDCoCDCoCDCoCAoYSktJmd0O3BmcmVlwqAgwqAgwqAgwqAgwqAgPSB1a19wZnJl
ZV9jb21wYXQ7wqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgXDxicj4NCsKgIMKgIMKgIMKgIMKg
IMKgIMKgIMKgIChhKS0mZ3Q7YXZhaWxtZW3CoCDCoCDCoCDCoD0gKGF2YWlsbWVtX2YpO8KgIMKg
IMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgXDxicj4NCivCoCDCoCDCoCDCoCDCoCDCoCDCoCDC
oChhKS0mZ3Q7cGF2YWlswqAgwqAgwqAgwqAgwqA9IChhdmFpbG1lbV9mICE9IE5VTEwpwqAgwqAg
wqAgwqAgwqAgwqAgwqAgXDxicj4NCivCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDC
oCDCoCDCoCDCoCDCoCDCoCDCoCDCoD8gdWtfYWxsb2NfcGF2YWlsX2NvbXBhdCA6IE5VTEw7wqAg
XDxicj4NCsKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIChhKS0mZ3Q7bWF4YWxsb2PCoCDCoCDCoCDC
oD0gKG1heGFsbG9jX2YpO8KgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgXDxicj4NCivC
oCDCoCDCoCDCoCDCoCDCoCDCoCDCoChhKS0mZ3Q7cG1heGFsbG9jwqAgwqAgwqAgPSAobWF4YWxs
b2NfZiAhPSBOVUxMKcKgIMKgIMKgIMKgIMKgIMKgIMKgIFw8YnI+DQorwqAgwqAgwqAgwqAgwqAg
wqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqA/IHVrX2FsbG9jX3BtYXhh
bGxvY19jb21wYXQgOiBOVUxMOyBcPGJyPg0KwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgKGEpLSZn
dDthZGRtZW3CoCDCoCDCoCDCoCDCoD0gKGFkZG1lbV9mKTvCoCDCoCDCoCDCoCDCoCDCoCDCoCDC
oCDCoCDCoCDCoCDCoFw8YnI+DQrCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDC
oCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDC
oCDCoCDCoCDCoCDCoCBcPGJyPg0KwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgdWtfYWxsb2NfcmVn
aXN0ZXIoKGEpKTvCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDC
oCDCoFw8YnI+DQpAQCAtMTEyLDcgKzEyMiwxMSBAQCB2b2lkIHVrX3BmcmVlX2NvbXBhdChzdHJ1
Y3QgdWtfYWxsb2MgKmEsIHZvaWQgKnB0ciwgdW5zaWduZWQgbG9uZyBudW1fcGFnZXMpOzxicj4N
CsKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIChhKS0mZ3Q7cGFsbG9jwqAgwqAgwqAgwqAgwqA9IHVr
X3BhbGxvY19jb21wYXQ7wqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqBcPGJyPg0KwqAgwqAgwqAg
wqAgwqAgwqAgwqAgwqAgKGEpLSZndDtwZnJlZcKgIMKgIMKgIMKgIMKgID0gdWtfcGZyZWVfY29t
cGF0O8KgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIFw8YnI+DQrCoCDCoCDCoCDCoCDCoCDCoCDC
oCDCoCAoYSktJmd0O2F2YWlsbWVtwqAgwqAgwqAgwqA9IChhdmFpbG1lbV9mKTvCoCDCoCDCoCDC
oCDCoCDCoCDCoCDCoCDCoCDCoCDCoFw8YnI+DQorwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAoYSkt
Jmd0O3BhdmFpbMKgIMKgIMKgIMKgIMKgPSAoYXZhaWxtZW1fZiAhPSBOVUxMKcKgIMKgIMKgIMKg
IMKgIMKgIMKgIFw8YnI+DQorwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAg
wqAgwqAgwqAgwqAgwqAgwqA/IHVrX2FsbG9jX3BhdmFpbF9jb21wYXQgOiBOVUxMO8KgIFw8YnI+
DQrCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCAoYSktJmd0O21heGFsbG9jwqAgwqAgwqAgwqA9ICht
YXhhbGxvY19mKTvCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoFw8YnI+DQorwqAgwqAg
wqAgwqAgwqAgwqAgwqAgwqAoYSktJmd0O3BtYXhhbGxvY8KgIMKgIMKgID0gKG1heGFsbG9jX2Yg
IT0gTlVMTCnCoCDCoCDCoCDCoCDCoCDCoCDCoCBcPGJyPg0KK8KgIMKgIMKgIMKgIMKgIMKgIMKg
IMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgPyB1a19hbGxvY19wbWF4YWxsb2Nf
Y29tcGF0IDogTlVMTDsgXDxicj4NCsKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIChhKS0mZ3Q7YWRk
bWVtwqAgwqAgwqAgwqAgwqA9IChhZGRtZW1fZik7wqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAg
wqAgwqAgwqBcPGJyPg0KwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAg
wqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAg
wqAgwqAgwqAgXDxicj4NCsKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIHVrX2FsbG9jX3JlZ2lzdGVy
KChhKSk7wqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqBc
PGJyPg0KQEAgLTEzNCw3ICsxNDgsMTEgQEAgdm9pZCB1a19wZnJlZV9jb21wYXQoc3RydWN0IHVr
X2FsbG9jICphLCB2b2lkICpwdHIsIHVuc2lnbmVkIGxvbmcgbnVtX3BhZ2VzKTs8YnI+DQrCoCDC
oCDCoCDCoCDCoCDCoCDCoCDCoCAoYSktJmd0O3BhbGxvY8KgIMKgIMKgIMKgIMKgPSAocGFsbG9j
X2Z1bmMpO8KgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIFw8YnI+DQrCoCDCoCDCoCDCoCDC
oCDCoCDCoCDCoCAoYSktJmd0O3BmcmVlwqAgwqAgwqAgwqAgwqAgPSAocGZyZWVfZnVuYyk7wqAg
wqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqBcPGJyPg0KwqAgwqAgwqAgwqAgwqAgwqAgwqAg
wqAgKGEpLSZndDtwYXZhaWzCoCDCoCDCoCDCoCDCoD0gKHBhdmFpbF9mdW5jKTvCoCDCoCDCoCDC
oCDCoCDCoCDCoCDCoCDCoCDCoCBcPGJyPg0KK8KgIMKgIMKgIMKgIMKgIMKgIMKgIMKgKGEpLSZn
dDthdmFpbG1lbcKgIMKgIMKgIMKgPSAocGF2YWlsX2Z1bmMgIT0gTlVMTCnCoCDCoCDCoCDCoCDC
oCDCoCDCoFw8YnI+DQorwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAg
wqAgwqAgwqAgwqAgwqA/IHVrX2FsbG9jX2F2YWlsbWVtX2lmcGFnZXMgOiBOVUxMOyBcPGJyPg0K
wqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgKGEpLSZndDtwbWF4YWxsb2PCoCDCoCDCoCA9IChwbWF4
YWxsb2NfZnVuYyk7wqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqBcPGJyPg0KK8KgIMKgIMKgIMKg
IMKgIMKgIMKgIMKgKGEpLSZndDttYXhhbGxvY8KgIMKgIMKgIMKgPSAocG1heGFsbG9jX2Z1bmMg
IT0gTlVMTCnCoCDCoCDCoCDCoCDCoCBcPGJyPg0KK8KgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKg
IMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgPyB1a19hbGxvY19tYXhhbGxvY19pZnBhZ2Vz
IDogTlVMTDsgXDxicj4NCsKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIChhKS0mZ3Q7YWRkbWVtwqAg
wqAgwqAgwqAgwqA9IChhZGRtZW1fZnVuYyk7wqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAg
XDxicj4NCsKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKg
IMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKg
IFw8YnI+DQrCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCB1a19hbGxvY19yZWdpc3RlcigoYSkpO8Kg
IMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgXDxicj4NCi0t
IDxicj4NCjIuMjAuMTxicj4NCjxicj4NCjwvYmxvY2txdW90ZT48L2Rpdj48L2Rpdj4NCg==
--0000000000007c95f405b85237d0--


From minios-devel-bounces@lists.xenproject.org Fri Jan 08 10:00:41 2021
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Fri, 08 Jan 2021 10:00:41 +0000
Received: from list by lists.xenproject.org with outflank-mailman.63263.112334 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1kxoZT-0000jM-Bo; Fri, 08 Jan 2021 10:00:39 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 63263.112334; Fri, 08 Jan 2021 10:00: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 1kxoZT-0000jF-8m; Fri, 08 Jan 2021 10:00:39 +0000
Received: by outflank-mailman (input) for mailman id 63263;
 Fri, 08 Jan 2021 10:00: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=Zz1M=GL=neclab.eu=sharan.santhanam@srs-us1.protection.inumbo.net>)
 id 1kxoZS-0000jA-70
 for minios-devel@lists.xen.org; Fri, 08 Jan 2021 10:00:38 +0000
Received: from mailer1.neclab.eu (unknown [195.37.70.40])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id b6a812b6-201c-4bde-975a-bb849cf2451d;
 Fri, 08 Jan 2021 10:00:36 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
 by mailer1.neclab.eu (Postfix) with ESMTP id 98E08100BC3;
 Fri,  8 Jan 2021 11:00:34 +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 5ktokMx8ChWy; Fri,  8 Jan 2021 11:00: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 mailer1.neclab.eu (Postfix) with ESMTPS id 648A3FFFC3
 for <minios-devel@lists.xen.org>; Fri,  8 Jan 2021 11:00:34 +0100 (CET)
Received: from N-1309.office.hd (192.168.24.96) by puck.office.hd
 (192.168.24.91) with Microsoft SMTP Server (version=TLS1_2,
 cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2106.2; Fri, 8 Jan 2021
 11:00:32 +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: b6a812b6-201c-4bde-975a-bb849cf2451d
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: Sharan Santhanam <sharan.santhanam@neclab.eu>
To: <minios-devel@lists.xen.org>
CC: Sharan Santhanam <sharan.santhanam@neclab.eu>
Subject: [UNIKRAFT PATCH 0/2] Fixes to the virtio library
Date: Fri, 8 Jan 2021 15:30:12 +0530
Message-ID: <20210108100014.28995-1-sharan.santhanam@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 patch series fixes two bugs in the 9p driver and the virtio bus.
The first one causes the virtio-9p driver to fail to mount a file system
and the other adds an error check which was missed on the previous patch.

Sharan Santhanam (2):
  plat/virtio: virtio_config_get returns >= 0
  plat/virtio: Add error check for tag name

 plat/drivers/include/virtio/virtio_bus.h |  2 +-
 plat/drivers/virtio/virtio_9p.c          | 15 ++++++++++++---
 2 files changed, 13 insertions(+), 4 deletions(-)

-- 
2.20.1



From minios-devel-bounces@lists.xenproject.org Fri Jan 08 10:00:44 2021
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Fri, 08 Jan 2021 10:00:44 +0000
Received: from list by lists.xenproject.org with outflank-mailman.63264.112338 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1kxoZY-0000k5-DQ; Fri, 08 Jan 2021 10:00:44 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 63264.112338; Fri, 08 Jan 2021 10:00: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 1kxoZY-0000k1-AU; Fri, 08 Jan 2021 10:00:44 +0000
Received: by outflank-mailman (input) for mailman id 63264;
 Fri, 08 Jan 2021 10:00: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=Zz1M=GL=neclab.eu=sharan.santhanam@srs-us1.protection.inumbo.net>)
 id 1kxoZX-0000jA-53
 for minios-devel@lists.xen.org; Fri, 08 Jan 2021 10:00:43 +0000
Received: from mailer2.neclab.eu (unknown [195.37.70.41])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 3b6ca7ef-10e9-4277-be28-d6b6ceb0157e;
 Fri, 08 Jan 2021 10:00:39 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
 by mailer2.neclab.eu (Postfix) with ESMTP id ECE31F22ED;
 Fri,  8 Jan 2021 11:00: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 MhMvQ7kUMQpb; Fri,  8 Jan 2021 11:00: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 C9FDCF228C
 for <minios-devel@lists.xen.org>; Fri,  8 Jan 2021 11:00:36 +0100 (CET)
Received: from N-1309.office.hd (192.168.24.96) by puck.office.hd
 (192.168.24.91) with Microsoft SMTP Server (version=TLS1_2,
 cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2106.2; Fri, 8 Jan 2021
 11:00: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: 3b6ca7ef-10e9-4277-be28-d6b6ceb0157e
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: Sharan Santhanam <sharan.santhanam@neclab.eu>
To: <minios-devel@lists.xen.org>
CC: Sharan Santhanam <sharan.santhanam@neclab.eu>
Subject: [UNIKRAFT PATCH 1/2] plat/virtio: virtio_config_get returns >= 0
Date: Fri, 8 Jan 2021 15:30:13 +0530
Message-ID: <20210108100014.28995-2-sharan.santhanam@neclab.eu>
X-Mailer: git-send-email 2.20.1
In-Reply-To: <20210108100014.28995-1-sharan.santhanam@neclab.eu>
References: <20210108100014.28995-1-sharan.santhanam@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 9pfs driver fails to get the configuration when the
virtio_config_get returns a value greater than 0. The function
description on virtio_config_get was incorrect. The patches
changes the error check in the virtio-9p and the function
description

Signed-off-by: Sharan Santhanam <sharan.santhanam@neclab.eu>
---
 plat/drivers/include/virtio/virtio_bus.h | 2 +-
 plat/drivers/virtio/virtio_9p.c          | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/plat/drivers/include/virtio/virtio_bus.h b/plat/drivers/include/virtio/virtio_bus.h
index 56f0dafe..b3bb8331 100644
--- a/plat/drivers/include/virtio/virtio_bus.h
+++ b/plat/drivers/include/virtio/virtio_bus.h
@@ -240,7 +240,7 @@ static inline void virtio_feature_set(struct virtio_dev *vdev, __u32 feature)
  * @param type_len
  *	The data type of the configuration data.
  * @return int
- *	0, on successful reading the configuration space.
+ *	>= 0, on successful reading the configuration space.
  *	< 0, on error.
  */
 static inline int virtio_config_get(struct virtio_dev *vdev, __u16 offset,
diff --git a/plat/drivers/virtio/virtio_9p.c b/plat/drivers/virtio/virtio_9p.c
index 045ce42f..7bd99b8d 100644
--- a/plat/drivers/virtio/virtio_9p.c
+++ b/plat/drivers/virtio/virtio_9p.c
@@ -347,7 +347,7 @@ static int virtio_9p_feature_negotiate(struct virtio_9p_device *d)
 
 	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)) < 0)
 	{
 		rc = -EAGAIN;
 		goto out;
-- 
2.20.1



From minios-devel-bounces@lists.xenproject.org Fri Jan 08 10:00:46 2021
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Fri, 08 Jan 2021 10:00:46 +0000
Received: from list by lists.xenproject.org with outflank-mailman.63265.112343 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1kxoZa-0000kv-FC; Fri, 08 Jan 2021 10:00:46 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 63265.112343; Fri, 08 Jan 2021 10:00: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 1kxoZa-0000kn-Bx; Fri, 08 Jan 2021 10:00:46 +0000
Received: by outflank-mailman (input) for mailman id 63265;
 Fri, 08 Jan 2021 10:00: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=Zz1M=GL=neclab.eu=sharan.santhanam@srs-us1.protection.inumbo.net>)
 id 1kxoZY-0000kK-M2
 for minios-devel@lists.xen.org; Fri, 08 Jan 2021 10:00:44 +0000
Received: from mailer2.neclab.eu (unknown [195.37.70.41])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id c10016d1-9b93-4808-87c5-06a49fa5271f;
 Fri, 08 Jan 2021 10:00:42 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
 by mailer2.neclab.eu (Postfix) with ESMTP id 007CFF23F5;
 Fri,  8 Jan 2021 11:00:41 +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 6sETa88SBOjj; Fri,  8 Jan 2021 11:00: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 D0F35F228C
 for <minios-devel@lists.xen.org>; Fri,  8 Jan 2021 11:00:38 +0100 (CET)
Received: from N-1309.office.hd (192.168.24.96) by puck.office.hd
 (192.168.24.91) with Microsoft SMTP Server (version=TLS1_2,
 cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2106.2; Fri, 8 Jan 2021
 11:00: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: c10016d1-9b93-4808-87c5-06a49fa5271f
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: Sharan Santhanam <sharan.santhanam@neclab.eu>
To: <minios-devel@lists.xen.org>
CC: Sharan Santhanam <sharan.santhanam@neclab.eu>
Subject: [UNIKRAFT PATCH 2/2] plat/virtio: Add error check for tag name
Date: Fri, 8 Jan 2021 15:30:14 +0530
Message-ID: <20210108100014.28995-3-sharan.santhanam@neclab.eu>
X-Mailer: git-send-email 2.20.1
In-Reply-To: <20210108100014.28995-1-sharan.santhanam@neclab.eu>
References: <20210108100014.28995-1-sharan.santhanam@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)

During virtio-9p configuration get we check for error while getting
the tag length but not the tag. The patch adds this check

Signed-off-by: Sharan Santhanam <sharan.santhanam@neclab.eu>
---
 plat/drivers/virtio/virtio_9p.c | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/plat/drivers/virtio/virtio_9p.c b/plat/drivers/virtio/virtio_9p.c
index 7bd99b8d..a783eba2 100644
--- a/plat/drivers/virtio/virtio_9p.c
+++ b/plat/drivers/virtio/virtio_9p.c
@@ -359,14 +359,23 @@ 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),
-			  d->tag, tag_len, 1);
+			  d->tag, tag_len, 1) < 0) {
+		uk_pr_err(DRIVER_NAME": Failed to read the tag on the device %p\n",
+			  d);
+		rc = -EAGAIN;
+		goto free_mem;
+	}
 	d->tag[tag_len] = '\0';
 
 	d->vdev->features &= host_features;
 	virtio_feature_set(d->vdev, d->vdev->features);
+	return 0;
 
+free_mem:
+	uk_free(a, d->tag);
 out:
 	return rc;
 }
-- 
2.20.1



From minios-devel-bounces@lists.xenproject.org Fri Jan 08 10:30:36 2021
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Fri, 08 Jan 2021 10:30:36 +0000
Received: from list by lists.xenproject.org with outflank-mailman.63298.112410 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1kxp2R-0004DN-T1; Fri, 08 Jan 2021 10:30:35 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 63298.112410; Fri, 08 Jan 2021 10:30: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 1kxp2R-0004DF-Pi; Fri, 08 Jan 2021 10:30:35 +0000
Received: by outflank-mailman (input) for mailman id 63298;
 Fri, 08 Jan 2021 10:30: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=MtGq=GL=lancaster.ac.uk=a.jung@srs-us1.protection.inumbo.net>)
 id 1kxp2P-0004D9-OO
 for minios-devel@lists.xen.org; Fri, 08 Jan 2021 10:30:33 +0000
Received: from GBR01-LO2-obe.outbound.protection.outlook.com (unknown
 [40.107.10.128]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 5e849a70-cb9c-4e85-a633-00e25b1d094b;
 Fri, 08 Jan 2021 10:30:31 +0000 (UTC)
Received: from CWXP265MB0375.GBRP265.PROD.OUTLOOK.COM (2603:10a6:401:c::13) by
 CWXP265MB1432.GBRP265.PROD.OUTLOOK.COM (2603:10a6:401:42::12) with
 Microsoft
 SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id
 15.20.3721.19; Fri, 8 Jan 2021 10:30:29 +0000
Received: from CWXP265MB0375.GBRP265.PROD.OUTLOOK.COM
 ([fe80::891b:a2a6:b596:a656]) by CWXP265MB0375.GBRP265.PROD.OUTLOOK.COM
 ([fe80::891b:a2a6:b596:a656%3]) with mapi id 15.20.3721.024; Fri, 8 Jan 2021
 10:30:28 +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: 5e849a70-cb9c-4e85-a633-00e25b1d094b
ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none;
 b=obmF7xiQe4ceYJGE9/RCDsA7nzmVhZrqEmLPj1/dy6kA4F1vJybtO934sZdYsav/QaHW/q8hJQZoyCtCfnOTWIoSoIs1LRuOsZPa0pmctmI4lYTW6H3GDQIStNPsOZ4wqb0AxFl09NE5EQS3lHuWb/b1z2SkQ+2e1eKGByi+TWUDskc5qkBwWc1qNWDSlL0zJEs/pD0xYvXmzrKFmm5h7LyoNjVbi9DuMDHWI7jhAAo6PfxSgD5+Xg6qytnSV9cxG/y8Ysk3MGI6xk1MXfr4wlzb/ox7NwgppHLLch36ejjaXR2+nZwV3r8Wsg/lv3l3lJdEAAMMp/Xw8m70FY/qwg==
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=F4x9piWrX4YZC+j4BNZFSIhmZ4IrkLACziugJ35iSKE=;
 b=SWE2SoZBULfBcrk+jvgm6zD1WdrvkMqPRa2gwyn4SRuGcdmVNB930yVRWEBfZDY2YLamH1dMS0gPFu/nrOLh/wzQErCz2lmxLxNCBdlgMAfqmj8OhJxbgimGyCqyS7y3lldjVBvBRbF6FqtclxJGMb1oAxV+nEV7IPor+s3jqU/ToUtSdmF4i0umvNRPLFfYHO25Q+PiqIUcwe1L1rAtpzoc3TF0c2Ym2qORDixOmk7ic7Jr43ezFxgdsL0Ay46XiS6ErUmaw5ovcNmBSRS3AUJsNQI3aiJa89t7YbXCk/55cqioN3T7Jg8iXjfOIWm3jVnwHxXqnQXK78u6yEEyrA==
ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass
 smtp.mailfrom=lancaster.ac.uk; dmarc=pass action=none
 header.from=lancaster.ac.uk; dkim=pass header.d=lancaster.ac.uk; arc=none
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=livelancsac.onmicrosoft.com; s=selector2-livelancsac-onmicrosoft-com;
 h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck;
 bh=F4x9piWrX4YZC+j4BNZFSIhmZ4IrkLACziugJ35iSKE=;
 b=npHXcotU52Hbtp3ChgJGjCKrPNWSjZOPcZ4B68d7DEXF8C6iGte6qPNBlM4UkKAqH56l7JcBP07/JwBflYk4Yr10FSHM0yXGyO24FgZzWWWRghAFuNfUQpWfEdEp+fHVNGSXC3DSgX9ZU9Dv9cITp43ctc1yU9wzM33ULXBWMe8=
From: "Jung, Alexander (Student)" <a.jung@lancaster.ac.uk>
To: Sharan Santhanam <sharan.santhanam@neclab.eu>,
	"minios-devel@lists.xen.org" <minios-devel@lists.xen.org>
Subject: Re: [External] [UNIKRAFT PATCH 0/2] Fixes to the virtio library
Thread-Topic: [External] [UNIKRAFT PATCH 0/2] Fixes to the virtio library
Thread-Index: AQHW5aUpyHJ6iuKTF0iqpvnEnj5wzaodh0KA
Date: Fri, 8 Jan 2021 10:30:28 +0000
Message-ID: <A8A46293-DA21-4AD4-A070-F1C507D2268A@lancs.ac.uk>
References: <20210108100014.28995-1-sharan.santhanam@neclab.eu>
In-Reply-To: <20210108100014.28995-1-sharan.santhanam@neclab.eu>
Accept-Language: en-GB, en-US
Content-Language: en-US
X-MS-Has-Attach:
X-MS-TNEF-Correlator:
x-mailer: Apple Mail (2.3608.120.23.2.4)
authentication-results: neclab.eu; dkim=none (message not signed)
 header.d=none;neclab.eu; dmarc=none action=none header.from=lancaster.ac.uk;
x-originating-ip: [109.40.131.10]
x-ms-publictraffictype: Email
x-ms-office365-filtering-correlation-id: f3301a99-9de9-4e9e-f5ae-08d8b3c06b66
x-ms-traffictypediagnostic: CWXP265MB1432:
x-microsoft-antispam-prvs:
 <CWXP265MB1432A148629610B891E6C972CEAE0@CWXP265MB1432.GBRP265.PROD.OUTLOOK.COM>
x-ms-oob-tlc-oobclassifiers: OLM:9508;
x-ms-exchange-senderadcheck: 1
x-microsoft-antispam: BCL:0;
x-microsoft-antispam-message-info:
 C7vF0Q+PXfKerdSUFzNBpSsJeggpD1Ghn5xdTfyN91DP2ZUAjF9v5hunY2OErbu1B7JykNkfo7oF4S0L4avbUmHqwA4fTtdvZJx20+iMPcwqmyCiUYHy/favlYnCVqCae5xxcFb3BAgePjqlfcvkvm9jUgSzddrUYG6xDeSwiJQepIcIAlv3EDNQfKJRTfeossEf5MGT3t8mT6I9nxjrgWeP9Ut/SFpYboQKIqjGlM/hEHzzh8Cv67kuvJ+WJ9kmuVfNPODKJ+zx8vkqhnL5q1Ytc4/IM/DUvzJicD8uUf5LjsRbIsqmF2wc+2eZeVRVoesSsxAepsYwA5Tp7iCHckySPqg0TEqrV4EdUp5s6LMU5sacaIh8yrTohPY14u92b6qpUqRSFJF7EY9Ix45O3g==
x-forefront-antispam-report:
 CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:CWXP265MB0375.GBRP265.PROD.OUTLOOK.COM;PTR:;CAT:NONE;SFS:(4636009)(376002)(346002)(136003)(396003)(366004)(39850400004)(26005)(33656002)(8936002)(86362001)(36756003)(2906002)(186003)(316002)(9686003)(6512007)(83380400001)(110136005)(6486002)(786003)(6506007)(478600001)(71200400001)(8676002)(66446008)(66556008)(66476007)(91956017)(64756008)(5660300002)(76116006)(66946007);DIR:OUT;SFP:1102;
x-ms-exchange-antispam-messagedata:
 =?us-ascii?Q?WOTddbRhkPj8VaY/4Sucpn7KVC9PVKEAmQHt33YmNDAZQ4AmpepLqPi1Ixe8?=
 =?us-ascii?Q?xJ3mwQBVDoZZyICpvAKFNbf+k/SMbqb9WiHBYzW2Xil4+5KQXJysiDQvgKLr?=
 =?us-ascii?Q?PSSlDk3cCwamvdss4CwpNH+unh8FrML07NNU0NLnXYe4hjhuvw4kXhLgXCyW?=
 =?us-ascii?Q?xrH9h2cdA7QKaEMsRWWVhBY4fVgM5fvktxFHQBr9dSMUCZ1dlkU7fz7TvT60?=
 =?us-ascii?Q?OSp2+IMERUnrnHJ2Gnt1RMPRrsaHZQ0rtohyi591uQniOOS0w1WKlr9sWEFo?=
 =?us-ascii?Q?OtwN5XxIuX0i2HsmtMq1gAVzc/J4t+da5zQBvXKcBr0aC58K6li4B6F/RcgP?=
 =?us-ascii?Q?jBLUqKhzAzyQ1WEQyJV5AzNgeeZ8JLOoA9FCdcLQFQE6rkLuD/GaPwk9Lo1o?=
 =?us-ascii?Q?rYXnERMaE9K+ofhIestrjjZQXtVtMBssrvGFh61SZ9lHdE1cRMjNa8RyPaEO?=
 =?us-ascii?Q?Ay5bJ6I8B6ndJczHINAhHtQnaqXaTTDWGB0KhMB97Sx5Q8pka8QVBvWx2vpM?=
 =?us-ascii?Q?GZuz5AV4kgh1+4+pUUMqtMFtJ9kqFnU/AC6T6maS8hUK8vXqWNBsAS02V1wi?=
 =?us-ascii?Q?yTwcw9CcHIv66l82HwGfcQ92ZleoiSx/g7cDFq54pAS5CZyzBtOyeP4QzLNS?=
 =?us-ascii?Q?8LuoCr8fWpE2b2i+j8/wAdgx+6G+0lelHui9uRgAfkwspZ6uH6HG58uFy/B6?=
 =?us-ascii?Q?GQYDcuAHxFcYTyU/h40qTcbAVtnTBIXMqcd4GsIQCdFiqX4H+g1gP7sA1PxA?=
 =?us-ascii?Q?i1k9txDXUPbUJPEOXqXVhpkyXNADDlpXe3acUPPB6SWy4EtZAdUqoxbofL9/?=
 =?us-ascii?Q?On1lY+BCnA34j2Zb0vOBbEZYwhabhkRZyGbrFKIHRGJXlaZypAHZT7ukNCXj?=
 =?us-ascii?Q?s2DAPGqd6h+mGMQ/W7K9ZUsIpb59WjRt6RQ5A92NW1kkdFGuQYi5hiNA3hkz?=
 =?us-ascii?Q?8/IHdKDv6gKK/yVX9Q+CrqGYU8CLHo+nQwpjwVEFfZDHmH9upNaUfO5xUM+y?=
 =?us-ascii?Q?iGQD?=
x-ms-exchange-transport-forked: True
Content-Type: text/plain; charset="us-ascii"
Content-ID: <6BF034421FC5EE4B93C6C50E5F58267F@GBRP265.PROD.OUTLOOK.COM>
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0
X-OriginatorOrg: lancaster.ac.uk
X-MS-Exchange-CrossTenant-AuthAs: Internal
X-MS-Exchange-CrossTenant-AuthSource: CWXP265MB0375.GBRP265.PROD.OUTLOOK.COM
X-MS-Exchange-CrossTenant-Network-Message-Id: f3301a99-9de9-4e9e-f5ae-08d8b3c06b66
X-MS-Exchange-CrossTenant-originalarrivaltime: 08 Jan 2021 10:30:28.8535
 (UTC)
X-MS-Exchange-CrossTenant-fromentityheader: Hosted
X-MS-Exchange-CrossTenant-id: 9c9bcd11-977a-4e9c-a9a0-bc734090164a
X-MS-Exchange-CrossTenant-mailboxtype: HOSTED
X-MS-Exchange-CrossTenant-userprincipalname: IY3mWFJSkqfLcmVACGpbMWO5goLav7zZOCwk1scTfhAdl0C5REDD6MBOzIl7sh+3M4UPuL1/q4dfSxIWUb0ksA==
X-MS-Exchange-Transport-CrossTenantHeadersStamped: CWXP265MB1432

Hi Sharan,

Thanks for this series.  Applying this to staging branch has resulted in a =
fix for
what is currently a broken mount to 9pfs.

Without this series, running (for example):

 qemu-guest -k ./build/nginx_kvm-x86_64 -m 64 -e ./fs0 -a "vfs.rootdev=3Dfs=
0 --"

Would result in the following error:

[    0.100652] ERR:  [libkvmvirtio9p] <virtio_9p.c @  386> virtio-9p: Faile=
d to negotiate the device feature -11
[    0.105531] ERR:  [libkvmvirtio] <virtio_bus.c @  162> Failed to add the=
 virtio device 0x2db010: -22
[    0.109986] ERR:  [libkvmvirtio] <virtio_pci.c @  417> Failed to registe=
r the virtio device: -22
[    0.114250] ERR:  [libkvmpci] <pci_bus.c @  228> PCI 00:02.00: Failed to=
 initialize device driver
[    0.119161] CRIT: [libvfscore] <rootfs.c @   85> Failed to mount /: 0
[    0.122318] ERR:  [libukboot] <boot.c @  100> Init function at 0x122a60 =
returned error -1

I will mark each patch as reviewed.

Thanks,

Alexander Jung,

Ph.D Student,
Networking & Systems Research Group,=20
Lancaster University
net.scc.lancs.ac.uk

F4D5 C6B6 9139 4942 9407  7F54 ED30 1A8A 1763 1B62

> On 8. Jan 2021, at 10:00, Sharan Santhanam <sharan.santhanam@neclab.eu> w=
rote:
>=20
> This email originated outside the University. Check before clicking links=
 or attachments.
>=20
> The patch series fixes two bugs in the 9p driver and the virtio bus.
> The first one causes the virtio-9p driver to fail to mount a file system
> and the other adds an error check which was missed on the previous patch.
>=20
> Sharan Santhanam (2):
> plat/virtio: virtio_config_get returns >=3D 0
> plat/virtio: Add error check for tag name
>=20
> plat/drivers/include/virtio/virtio_bus.h |  2 +-
> plat/drivers/virtio/virtio_9p.c          | 15 ++++++++++++---
> 2 files changed, 13 insertions(+), 4 deletions(-)
>=20
> --
> 2.20.1
>=20
>=20



From minios-devel-bounces@lists.xenproject.org Fri Jan 08 10:30:59 2021
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Fri, 08 Jan 2021 10:30:59 +0000
Received: from list by lists.xenproject.org with outflank-mailman.63299.112414 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1kxp2p-0004FD-VH; Fri, 08 Jan 2021 10:30:59 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 63299.112414; Fri, 08 Jan 2021 10:30: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 1kxp2p-0004F6-SF; Fri, 08 Jan 2021 10:30:59 +0000
Received: by outflank-mailman (input) for mailman id 63299;
 Fri, 08 Jan 2021 10:30:58 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <SRS0=mr9K=GL=nderjung.net=alex@srs-us1.protection.inumbo.net>)
 id 1kxp2n-0004Ey-Uh
 for minios-devel@lists.xen.org; Fri, 08 Jan 2021 10:30:58 +0000
Received: from relay3.mymailcheap.com (unknown [217.182.119.155])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 61d3d423-e676-4564-84d1-953bcab9494c;
 Fri, 08 Jan 2021 10:30:56 +0000 (UTC)
Received: from filter2.mymailcheap.com (filter2.mymailcheap.com
 [91.134.140.82])
 by relay3.mymailcheap.com (Postfix) with ESMTPS id DA74E3ECDF;
 Fri,  8 Jan 2021 11:30:55 +0100 (CET)
Received: from localhost (localhost [127.0.0.1])
 by filter2.mymailcheap.com (Postfix) with ESMTP id BEDC72A5BB;
 Fri,  8 Jan 2021 11:30:55 +0100 (CET)
Received: from filter2.mymailcheap.com ([127.0.0.1])
 by localhost (filter2.mymailcheap.com [127.0.0.1]) (amavisd-new, port 10024)
 with ESMTP id RpVUdBwGKClz; Fri,  8 Jan 2021 11:30:54 +0100 (CET)
Received: from mail20.mymailcheap.com (mail20.mymailcheap.com [51.83.111.147])
 (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits))
 (No client certificate requested)
 by filter2.mymailcheap.com (Postfix) with ESMTPS;
 Fri,  8 Jan 2021 11:30:54 +0100 (CET)
Received: from [148.251.23.173] (ml.mymailcheap.com [148.251.23.173])
 by mail20.mymailcheap.com (Postfix) with ESMTP id 3A42940FF4;
 Fri,  8 Jan 2021 10:30:54 +0000 (UTC)
Received: from [192.168.43.47] (ip-109-40-131-10.web.vodafone.de
 [109.40.131.10])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
 (No client certificate requested)
 by mail20.mymailcheap.com (Postfix) with ESMTPSA id D842240FF4;
 Fri,  8 Jan 2021 10:30:46 +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: 61d3d423-e676-4564-84d1-953bcab9494c
DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=mymailcheap.com;
	s=default; t=1610101855;
	bh=ignx2oeoA32v35m8BUPEzsBuDjOafNmRRvcfrWoi71E=;
	h=Subject:From:In-Reply-To:Date:Cc:References:To:From;
	b=lK72oqEtyrnwefy6dCYR8feEW5meOEoQWBJSMbjj73LV/UxhcCgu63vDZdbsZbCn/
	 1qKeOzIr8UVRsepGJG4k/InnFGe5u4TTKz9v/Nt+esPPO+S68zqwBz9ylCQd62oT4Y
	 3nEPexyclxflCR91B6hBvC/6iOF0kJp7FDEL2/c0=
X-Virus-Scanned: Debian amavisd-new at filter2.mymailcheap.com
Authentication-Results: mail20.mymailcheap.com;
	dkim=fail reason="key not found in DNS" (0-bit key; unprotected) header.d=nderjung.net header.i=@nderjung.net header.b="zP/TIIwJ";
	dkim-atps=neutral
AI-Spam-Status: Not processed
DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=nderjung.net;
	s=default; t=1610101847;
	bh=ignx2oeoA32v35m8BUPEzsBuDjOafNmRRvcfrWoi71E=;
	h=Subject:From:In-Reply-To:Date:Cc:References:To:From;
	b=zP/TIIwJjy6du6+ANRnbfQoQFz6q4PEbcx3uRx47r8yedrG2DjHN7PFsduwO6B4QE
	 L/hqu/wO0x/xO2aqgw5Dj9QhbIRt1/WYCWFX3C4wP9XLr7n9v+6EsU2tpPzwJ4VFKd
	 kGtohUOPjvjipmAcdgX5vMgtFmpOTmmfszvo2NHQ=
Content-Type: text/plain;
	charset=us-ascii
Mime-Version: 1.0 (Mac OS X Mail 13.4 \(3608.120.23.2.4\))
Subject: Re: [UNIKRAFT PATCH 1/2] plat/virtio: virtio_config_get returns >= 0
From: Alexander Jung <alex@nderjung.net>
In-Reply-To: <20210108100014.28995-2-sharan.santhanam@neclab.eu>
Date: Fri, 8 Jan 2021 10:30:45 +0000
Cc: minios-devel@lists.xen.org
Content-Transfer-Encoding: quoted-printable
Message-Id: <EB1A175F-E17F-476B-A939-D184D1ECCB33@nderjung.net>
References: <20210108100014.28995-1-sharan.santhanam@neclab.eu>
 <20210108100014.28995-2-sharan.santhanam@neclab.eu>
To: Sharan Santhanam <sharan.santhanam@neclab.eu>
X-Mailer: Apple Mail (2.3608.120.23.2.4)
X-Rspamd-Server: mail20.mymailcheap.com
X-Spamd-Result: default: False [0.40 / 10.00];
	 RCVD_VIA_SMTP_AUTH(0.00)[];
	 R_SPF_FAIL(0.00)[-all];
	 RECEIVED_SPAMHAUS_PBL(0.00)[109.40.131.10:received];
	 FROM_HAS_DN(0.00)[];
	 TO_DN_SOME(0.00)[];
	 MV_CASE(0.50)[];
	 TO_MATCH_ENVRCPT_ALL(0.00)[];
	 MIME_GOOD(-0.10)[text/plain];
	 DMARC_NA(0.00)[nderjung.net];
	 ARC_NA(0.00)[];
	 ML_SERVERS(-3.10)[148.251.23.173];
	 DKIM_TRACE(0.00)[nderjung.net:~];
	 RCPT_COUNT_TWO(0.00)[2];
	 R_DKIM_PERMFAIL(0.00)[nderjung.net:s=default];
	 RCVD_NO_TLS_LAST(0.10)[];
	 FROM_EQ_ENVFROM(0.00)[];
	 MIME_TRACE(0.00)[0:+];
	 ASN(0.00)[asn:24940, ipnet:148.251.0.0/16, country:DE];
	 RCVD_COUNT_TWO(0.00)[2];
	 MID_RHS_MATCH_FROM(0.00)[];
	 HFILTER_HELO_BAREIP(3.00)[148.251.23.173,1]
X-Rspamd-Queue-Id: 3A42940FF4

Reviewed-by: Alexander Jung <a.jung@lancs.ac.uk>

> On 8. Jan 2021, at 10:00, Sharan Santhanam =
<sharan.santhanam@neclab.eu> wrote:
>=20
> The 9pfs driver fails to get the configuration when the
> virtio_config_get returns a value greater than 0. The function
> description on virtio_config_get was incorrect. The patches
> changes the error check in the virtio-9p and the function
> description
>=20
> Signed-off-by: Sharan Santhanam <sharan.santhanam@neclab.eu>
> ---
> plat/drivers/include/virtio/virtio_bus.h | 2 +-
> plat/drivers/virtio/virtio_9p.c          | 2 +-
> 2 files changed, 2 insertions(+), 2 deletions(-)
>=20
> diff --git a/plat/drivers/include/virtio/virtio_bus.h =
b/plat/drivers/include/virtio/virtio_bus.h
> index 56f0dafe..b3bb8331 100644
> --- a/plat/drivers/include/virtio/virtio_bus.h
> +++ b/plat/drivers/include/virtio/virtio_bus.h
> @@ -240,7 +240,7 @@ static inline void virtio_feature_set(struct =
virtio_dev *vdev, __u32 feature)
>  * @param type_len
>  *	The data type of the configuration data.
>  * @return int
> - *	0, on successful reading the configuration space.
> + *	>=3D 0, on successful reading the configuration space.
>  *	< 0, on error.
>  */
> static inline int virtio_config_get(struct virtio_dev *vdev, __u16 =
offset,
> diff --git a/plat/drivers/virtio/virtio_9p.c =
b/plat/drivers/virtio/virtio_9p.c
> index 045ce42f..7bd99b8d 100644
> --- a/plat/drivers/virtio/virtio_9p.c
> +++ b/plat/drivers/virtio/virtio_9p.c
> @@ -347,7 +347,7 @@ static int virtio_9p_feature_negotiate(struct =
virtio_9p_device *d)
>=20
> 	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)) < 0)
> 	{
> 		rc =3D -EAGAIN;
> 		goto out;
> --=20
> 2.20.1
>=20


From minios-devel-bounces@lists.xenproject.org Fri Jan 08 10:31:47 2021
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Fri, 08 Jan 2021 10:31:47 +0000
Received: from list by lists.xenproject.org with outflank-mailman.63302.112417 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1kxp3b-0004Hw-2O; Fri, 08 Jan 2021 10:31:47 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 63302.112417; Fri, 08 Jan 2021 10:31: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 1kxp3a-0004Hp-VU; Fri, 08 Jan 2021 10:31:46 +0000
Received: by outflank-mailman (input) for mailman id 63302;
 Fri, 08 Jan 2021 10:31: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=MtGq=GL=lancaster.ac.uk=a.jung@srs-us1.protection.inumbo.net>)
 id 1kxp3Z-0004Hj-Lf
 for minios-devel@lists.xen.org; Fri, 08 Jan 2021 10:31:45 +0000
Received: from GBR01-CWL-obe.outbound.protection.outlook.com (unknown
 [40.107.11.122]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id f8c66bcf-c82d-4258-8009-1e29b4d9f890;
 Fri, 08 Jan 2021 10:31:42 +0000 (UTC)
Received: from CWXP265MB0375.GBRP265.PROD.OUTLOOK.COM (2603:10a6:401:c::13) by
 CWXP265MB0792.GBRP265.PROD.OUTLOOK.COM (2603:10a6:401:4::18) with
 Microsoft
 SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id
 15.20.3742.6; Fri, 8 Jan 2021 10:31:39 +0000
Received: from CWXP265MB0375.GBRP265.PROD.OUTLOOK.COM
 ([fe80::891b:a2a6:b596:a656]) by CWXP265MB0375.GBRP265.PROD.OUTLOOK.COM
 ([fe80::891b:a2a6:b596:a656%3]) with mapi id 15.20.3721.024; Fri, 8 Jan 2021
 10:31:39 +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: f8c66bcf-c82d-4258-8009-1e29b4d9f890
ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none;
 b=cvPz9JGf+Jrc6QK9+yvgJLN2+ADumOEL9zoGlASUE68bCcRyOWCafaKaiNk7BKhP9IYQvcG4/1yOznYdgP8rmRyOkGCVb/x8PMJB0wmeIAZ1HOvrkmOwZvvj5Gmh4BFJZ/Hbv8o9/rMFmMARndi91r+7U96LrBtfNom+SB7oCJ/zCW8BT6O4INCoCBdx68c/bjCMahG2j2jnxsaMpdxXIA/es552Yn1or4YLTWagE8kRWmJYX+n84TOLdyOYuD64OCtVGx8OmWwGDQakLzgyQpRjPKeGLK7hEyWdOXQMrVzRBVvg9QEZ5nUrIhAb9wtxC4gTq7m+KPdKbZywjk44hg==
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=6uHpnmj6QLUcRCtJaXH0FYiLGqgaYtF5ioIhio8UMj8=;
 b=Ve+MzrkOjkYXHW32wPT3hbIFgYwFqLPehNdTOz3UCHa4Ze5s7lvEMXlJ2NXIlH6+mJzUDjelSyiEaRRcOUsKpEZMtFHbWnsVjML4ESRtkM79fw5RdCg+Uiypb6J547X6qPacDqZYJkHaYpOgVv3BDBBLzJLq/KvrYo7S33O7BT5xvxYTuwH1hKmNEW4R1JvCn7LWHYvhmsxHFEdfDz0oZEj1Al/MHaJUm+ioZy+GqYFQDe1YeUADaf3eMQT2V10SevEvhEh2OjC2YpegBu/DnGojiMzv0QR0ObMyOa7hP/1opX1oD9diHQXv0mBtvAy6sD7g+HyUqL52FmLDIEkvNA==
ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass
 smtp.mailfrom=lancaster.ac.uk; dmarc=pass action=none
 header.from=lancaster.ac.uk; dkim=pass header.d=lancaster.ac.uk; arc=none
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=livelancsac.onmicrosoft.com; s=selector2-livelancsac-onmicrosoft-com;
 h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck;
 bh=6uHpnmj6QLUcRCtJaXH0FYiLGqgaYtF5ioIhio8UMj8=;
 b=MKSXiPxPjqnu++5Da8W44oIbWOpIypQbWmqAZd1eHYNfYnqM+gWRcu5DhlAudiw6oy21fTM4DSrpZ5phb2La6YyL0gV64qGatKK074Q8Po2Hnq8GbrVWJK4I2ymuGWgrT7A6xZFBWkvrK4C6ZdRJWQyPykQDqsmkvb13aLRGfC4=
From: "Jung, Alexander (Student)" <a.jung@lancaster.ac.uk>
To: Sharan Santhanam <sharan.santhanam@neclab.eu>
CC: "minios-devel@lists.xen.org" <minios-devel@lists.xen.org>
Subject: Re: [External] [UNIKRAFT PATCH 2/2] plat/virtio: Add error check for
 tag name
Thread-Topic: [External] [UNIKRAFT PATCH 2/2] plat/virtio: Add error check for
 tag name
Thread-Index: AQHW5aUptdhFQzJRTkWhSZjDDEbxcaodh5uA
Date: Fri, 8 Jan 2021 10:31:39 +0000
Message-ID: <75566A51-3985-4E39-A7BF-BED6C059BB5B@lancs.ac.uk>
References: <20210108100014.28995-1-sharan.santhanam@neclab.eu>
 <20210108100014.28995-3-sharan.santhanam@neclab.eu>
In-Reply-To: <20210108100014.28995-3-sharan.santhanam@neclab.eu>
Accept-Language: en-GB, en-US
Content-Language: en-US
X-MS-Has-Attach:
X-MS-TNEF-Correlator:
x-mailer: Apple Mail (2.3608.120.23.2.4)
authentication-results: neclab.eu; dkim=none (message not signed)
 header.d=none;neclab.eu; dmarc=none action=none header.from=lancaster.ac.uk;
x-originating-ip: [109.40.131.10]
x-ms-publictraffictype: Email
x-ms-office365-filtering-correlation-id: 182c4894-c4b7-4ffa-29b7-08d8b3c09574
x-ms-traffictypediagnostic: CWXP265MB0792:
x-microsoft-antispam-prvs:
 <CWXP265MB0792499BE572A898A7CFCCE4CEAE0@CWXP265MB0792.GBRP265.PROD.OUTLOOK.COM>
x-ms-oob-tlc-oobclassifiers: OLM:8882;
x-ms-exchange-senderadcheck: 1
x-microsoft-antispam: BCL:0;
x-microsoft-antispam-message-info:
 dtu7+jWNfa15Hcv7phCVmYuwyqU+iByIwGrkNYkGdVh/9mGDOGmht+PzuSwP1nC7h54Ff6ykb44MwwhBuGaCqLZBjZUSgojFSaHqCz01d2LM/xLWHde6cjz36DutKR/AOWDLhBjEk9RO62HcYl+naN+cQ3cTbw7y2FmeA+4QFe9T2o9RxsRmrnvCD1p1yRncv/LWxlgWLMeHlVRe4RZ4rW9UtJf2ScYsTjFKuSt4+RQeM2+XvrS7PASJ2kK5KiaS0j0S5uRqtPhjEG9GiLKDil0DLnaXQGxoUYuE5pmfoOxY8g5j4ChYm+Pgmtx+vCVhtquK4rt8LtJYxfYDDMA1bdeZBKe9N5dTE0CNg0YkLm9Qxl0z897EkTf1lmfkgzkUkL62benQ/YNG7hDjbU+2aw==
x-forefront-antispam-report:
 CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:CWXP265MB0375.GBRP265.PROD.OUTLOOK.COM;PTR:;CAT:NONE;SFS:(4636009)(39850400004)(396003)(366004)(136003)(376002)(346002)(6486002)(86362001)(6512007)(6916009)(9686003)(26005)(36756003)(186003)(8676002)(8936002)(2906002)(71200400001)(6506007)(786003)(316002)(66946007)(478600001)(64756008)(66556008)(76116006)(66476007)(66446008)(91956017)(4326008)(33656002)(5660300002)(83380400001);DIR:OUT;SFP:1102;
x-ms-exchange-antispam-messagedata:
 =?us-ascii?Q?3qcZ4/p5soVCtOdskELIduOownrKXrcvRB8Jbx2vZtmx81C/C7T+pCiioHwX?=
 =?us-ascii?Q?tyg97GlYZKKttuH3q7LV7o17gNPyOArDE5iU15iJrLHflQ+mUcZe0SfJhu5G?=
 =?us-ascii?Q?caqtBxBCMqwUziQV1gyDNFBdt+6XCF3CrD0yVY8DVHC1MGkFjlSEedWfi4gH?=
 =?us-ascii?Q?fAoIIG7kQlf9Lpe95Do7BXiPSWC+3BGnVfocFPEr+wwheMd0xwr0JuRC8N/6?=
 =?us-ascii?Q?vq6wLYVM6+Jz9JuTwHFQNXPigjvU8XXbbSTbDRnndhDfrgoYsiHz3yIF5ZDY?=
 =?us-ascii?Q?6z7pcEXnfybKitL/ERpJa/TsmEngE0MPE4hOe4fMqJ931RURTHO+d3USClRi?=
 =?us-ascii?Q?LuwXe5O+ExbhhEeqrBoif4iG29arGuEiSjmPUxmQSFZQhjknnHDhm9CfdQBc?=
 =?us-ascii?Q?R6rMN4WBxSCosxKW3tGc3FmrkI4lcl2mkegQ/ZsMdy214uth+OQe2Qih/JW5?=
 =?us-ascii?Q?Oh1M7wBwWqa9XK1yUS9A9dfA8q3EyRT7ahjvpZ5IJpxiQnxRNjfmCQYoQPzM?=
 =?us-ascii?Q?iV8zB7IfQPiPDNFM+RyAn/dqC/dZ+BWTaNov2u+eqlYN8bGPH0acmpznjJp1?=
 =?us-ascii?Q?oX/u9juO4y+Q07yCn2xuBlbXa4DS3PUMddX1thHhO2GUzlBmfvjmwnMiWyhy?=
 =?us-ascii?Q?i7pwgxiSN+IO95xaoWE4t0wXxeH0VNu8iTwQ+mtIivnosRk09wrYd9qy6yWK?=
 =?us-ascii?Q?/HJP39Sn/ZelqVxW4b4Rhu4HVxmEvgcgEXXn88EngdVHOhzecjxeGe/5TXvs?=
 =?us-ascii?Q?wOF3nAaLAdKvs6kspOTFzDP9Pdhdg9vyHuA68bB7H+C7guouskalA7t1HRxY?=
 =?us-ascii?Q?Scre/h4faRYlOmcOTJ2z8ySnvHQzBSswMpXFweIsZASdjsNGgYj7N1RHkxRY?=
 =?us-ascii?Q?gDNCHxPhekAoxPKzrq9Tlk7ClO11v4tXxBsM/HRPTlpCQbxX+hvh1x4GLLim?=
 =?us-ascii?Q?OGiHEai0U1Z1bLFqqht2h88YiR+Hi9SJDHkTLg/AAJCtn8s2XYWNlqFEr5p/?=
 =?us-ascii?Q?mfIj?=
x-ms-exchange-transport-forked: True
Content-Type: text/plain; charset="us-ascii"
Content-ID: <FD18CD5C406AEB4EA2A17F2DB96770F7@GBRP265.PROD.OUTLOOK.COM>
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0
X-OriginatorOrg: lancaster.ac.uk
X-MS-Exchange-CrossTenant-AuthAs: Internal
X-MS-Exchange-CrossTenant-AuthSource: CWXP265MB0375.GBRP265.PROD.OUTLOOK.COM
X-MS-Exchange-CrossTenant-Network-Message-Id: 182c4894-c4b7-4ffa-29b7-08d8b3c09574
X-MS-Exchange-CrossTenant-originalarrivaltime: 08 Jan 2021 10:31:39.4822
 (UTC)
X-MS-Exchange-CrossTenant-fromentityheader: Hosted
X-MS-Exchange-CrossTenant-id: 9c9bcd11-977a-4e9c-a9a0-bc734090164a
X-MS-Exchange-CrossTenant-mailboxtype: HOSTED
X-MS-Exchange-CrossTenant-userprincipalname: eT+rsC0a5uj7RqyM0PA895YkI+EnlRigfwoMBSV9gAcb8g/deEPJzgSgMlKyZFcZ4alNAedEc0gUN9HKEm0CFw==
X-MS-Exchange-Transport-CrossTenantHeadersStamped: CWXP265MB0792

Reviewed-by: Alexander Jung <a.jung@lancs.ac.uk>

> On 8. Jan 2021, at 10:00, Sharan Santhanam <sharan.santhanam@neclab.eu> w=
rote:
>=20
> This email originated outside the University. Check before clicking links=
 or attachments.
>=20
> During virtio-9p configuration get we check for error while getting
> the tag length but not the tag. The patch adds this check
>=20
> Signed-off-by: Sharan Santhanam <sharan.santhanam@neclab.eu>
> ---
> plat/drivers/virtio/virtio_9p.c | 13 +++++++++++--
> 1 file changed, 11 insertions(+), 2 deletions(-)
>=20
> diff --git a/plat/drivers/virtio/virtio_9p.c b/plat/drivers/virtio/virtio=
_9p.c
> index 7bd99b8d..a783eba2 100644
> --- a/plat/drivers/virtio/virtio_9p.c
> +++ b/plat/drivers/virtio/virtio_9p.c
> @@ -359,14 +359,23 @@ static int virtio_9p_feature_negotiate(struct virti=
o_9p_device *d)
>                goto out;
>        }
>=20
> -       virtio_config_get(d->vdev,
> +
> +       if (virtio_config_get(d->vdev,
>                          __offsetof(struct virtio_9p_config, tag),
> -                         d->tag, tag_len, 1);
> +                         d->tag, tag_len, 1) < 0) {
> +               uk_pr_err(DRIVER_NAME": Failed to read the tag on the dev=
ice %p\n",
> +                         d);
> +               rc =3D -EAGAIN;
> +               goto free_mem;
> +       }
>        d->tag[tag_len] =3D '\0';
>=20
>        d->vdev->features &=3D host_features;
>        virtio_feature_set(d->vdev, d->vdev->features);
> +       return 0;
>=20
> +free_mem:
> +       uk_free(a, d->tag);
> out:
>        return rc;
> }
> --
> 2.20.1
>=20
>=20



From minios-devel-bounces@lists.xenproject.org Sat Jan 09 15:33:10 2021
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Sat, 09 Jan 2021 15:33:10 +0000
Received: from list by lists.xenproject.org with outflank-mailman.62185.113554 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1kyGEl-0003Rp-1B; Sat, 09 Jan 2021 15:33:07 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 62185.113554; Sat, 09 Jan 2021 15:33: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 1kyGEk-0003Rb-Pb; Sat, 09 Jan 2021 15:33:06 +0000
Received: by outflank-mailman (input) for mailman id 62185;
 Tue, 05 Jan 2021 19:31: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=xRfd=GI=student.uliege.be=b.rizzo@srs-us1.protection.inumbo.net>)
 id 1kws3O-0000QR-Fu
 for minios-devel@lists.xenproject.org; Tue, 05 Jan 2021 19:31:38 +0000
Received: from serv108.segi.ulg.ac.be (unknown [139.165.32.111])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 5e4ee848-25e8-4aff-a898-a5c3e036e91c;
 Tue, 05 Jan 2021 19:31:35 +0000 (UTC)
Received: from localhost.localdomain (unknown [91.182.172.238])
 (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
 (No client certificate requested)
 by serv108.segi.ulg.ac.be (Postfix) with ESMTPSA id 66414200EED8;
 Tue,  5 Jan 2021 20:31:34 +0100 (CET)
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: 5e4ee848-25e8-4aff-a898-a5c3e036e91c
DKIM-Filter: OpenDKIM Filter v2.11.0 serv108.segi.ulg.ac.be 66414200EED8
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=uliege.be;
	s=ulg20190529; t=1609875094;
	bh=4oLvBR65b8+jh5YFUwjziR/dj0YHrD5MLVdGbbPtu6o=;
	h=From:To:Cc:Subject:Date:In-Reply-To:References:From;
	b=RMS+7y+QanynX2hzq5EDjsT3AyTGC/tFDSMMr5pyiRfMrVl/I+oaqpabB4+9KJ1K1
	 xC0HNHW82uVv6jj/gN94q/pf7nV9IS6t3yJxoAiliIU+qF2xS6/h0EFhmTMwkVJ6Dx
	 Wbp2GVFKD6lUOKPsV/WMqFZV2xT87GGsRbdpLK/LMpaT09z/Jf+x388Jhg1ef/LF8G
	 0KGKRKGMEpFQcIkubjFomRm69phZuJHVk/Kf2Cd5Ln5CMPOGc7yc5W/MuzUX/W7mdz
	 MPNw/QQYqW35newWAZJ+fPvWtbm+cPsbpKYDb4CBXJ0qYztu363SbbPzc/rQT7Sqfn
	 ESDxM5TuhM4cA==
From: Bernard Rizzo <b.rizzo@student.uliege.be>
To: minios-devel@lists.xenproject.org
Cc: Bernard Rizzo <b.rizzo@student.uliege.be>,
	Felipe Huici <felipe.huici@neclab.eu>
Subject: [PTHREAD EMBEDDED PATCH 1/1] lib/pthread-embedded: Support for uksignal
Date: Tue,  5 Jan 2021 20:30:42 +0100
Message-Id: <20210105193043.504160-2-b.rizzo@student.uliege.be>
X-Mailer: git-send-email 2.25.1
In-Reply-To: <20210105193043.504160-1-b.rizzo@student.uliege.be>
References: <20210105193043.504160-1-b.rizzo@student.uliege.be>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit

This patch is an update of the original.

Signed-off-by: Felipe Huici <felipe.huici@neclab.eu>
Signed-off-by: Bernard Rizzo <b.rizzo@student.uliege.be>
---
 Makefile.uk                                   |  2 ++
 include/pte_osal.h                            |  8 +++++++
 include/pte_types.h                           |  8 +++++++
 ...ead_kill_when_uk_signals_are_enabled.patch | 24 +++++++++++++++++++
 pte_osal.c                                    | 18 ++++++++++++++
 5 files changed, 60 insertions(+)
 create mode 100644 patches/0012-Add_pthread_kill_when_uk_signals_are_enabled.patch

diff --git a/Makefile.uk b/Makefile.uk
index 4ee37cd..2611c7d 100644
--- a/Makefile.uk
+++ b/Makefile.uk
@@ -65,7 +65,9 @@ LIBPTHREAD-EMBEDDED_CXXFLAGS-y += $(LIBPTHREAD-EMBEDDED_SUPPRESS_FLAGS)
 LIBPTHREAD-EMBEDDED_SRCS-y += $(LIBPTHREAD-EMBEDDED_BASE)/pte_osal.c|glue
 LIBPTHREAD-EMBEDDED_SRCS-y += $(LIBPTHREAD-EMBEDDED_BASE)/attributes.c|glue
 LIBPTHREAD-EMBEDDED_SRCS-y += $(LIBPTHREAD-EMBEDDED_BASE)/pthread_atfork.c|glue
+ifneq ($(CONFIG_LIBUKSIGNAL),y)
 LIBPTHREAD-EMBEDDED_SRCS-y += $(LIBPTHREAD-EMBEDDED_BASE)/pthread_sigmask.c|glue
+endif
 LIBPTHREAD-EMBEDDED_SRCS-y += $(LIBPTHREAD-EMBEDDED_BASE)/pthread_condattr.c|glue
 
 ################################################################################
diff --git a/include/pte_osal.h b/include/pte_osal.h
index bcf5374..34122ea 100644
--- a/include/pte_osal.h
+++ b/include/pte_osal.h
@@ -4,10 +4,18 @@
 #include <uk/mutex.h>
 #include <uk/semaphore.h>
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 typedef struct uk_thread* pte_osThreadHandle;
 typedef struct uk_semaphore *pte_osSemaphoreHandle;
 typedef struct uk_mutex *pte_osMutexHandle;
 
+#ifdef __cplusplus
+}
+#endif
+
 #define OS_MAX_SIMUL_THREADS \
 	CONFIG_LIBPTHREAD_EMBEDDED_MAX_SIMUL_THREADS
 
diff --git a/include/pte_types.h b/include/pte_types.h
index c9081fa..817e313 100644
--- a/include/pte_types.h
+++ b/include/pte_types.h
@@ -3,8 +3,16 @@
 
 #include <sys/timeb.h>
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 typedef unsigned int tid_t;
 
 typedef int pid_t;
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* __PTE_TYPES_H__ */
diff --git a/patches/0012-Add_pthread_kill_when_uk_signals_are_enabled.patch b/patches/0012-Add_pthread_kill_when_uk_signals_are_enabled.patch
new file mode 100644
index 0000000..cf30aca
--- /dev/null
+++ b/patches/0012-Add_pthread_kill_when_uk_signals_are_enabled.patch
@@ -0,0 +1,24 @@
+diff --git a/pthread_kill.c b/pthread_kill.c
+index 3a6daf6..4ea7448 100644
+--- a/pthread_kill.c
++++ b/pthread_kill.c
+@@ -47,7 +47,9 @@
+ #include "pthread.h"
+ #include "implement.h"
+
+-#ifdef __hermit__
++#include <uk/config.h>
++
++#if CONFIG_LIBUKSIGNAL
+ int pte_kill(pte_osThreadHandle threadId, int sig);
+ #endif
+
+@@ -98,7 +100,7 @@ pthread_kill (pthread_t thread, int sig)
+
+   pte_osMutexUnlock(pte_thread_reuse_lock);
+
+-#ifdef __hermit__
++#if CONFIG_LIBUKSIGNAL
+   result = pte_kill(tp->threadId, sig);
+ #else
+   if (0 == result && 0 != sig)
diff --git a/pte_osal.c b/pte_osal.c
index 640c3e4..0aac5fd 100644
--- a/pte_osal.c
+++ b/pte_osal.c
@@ -103,6 +103,19 @@ out:
 	return result;
 }
 
+/***************************************************************************
+ *
+ * Signal handling
+ *
+ **************************************************************************/
+#if CONFIG_LIBUKSIGNAL
+int pte_kill(pte_osThreadHandle threadId, int sig)
+{
+	return uk_sig_thread_kill(threadId, sig);
+}
+#endif
+
+
 /****************************************************************************
  *
  * Threads
@@ -162,6 +175,11 @@ pte_osResult pte_osThreadCreate(pte_osThreadEntryPoint entry_point,
 		return PTE_OS_NO_RESOURCES;
 	}
 
+#if CONFIG_LIBUKSIGNAL
+	/* inherit signal mask */
+	ptd->uk_thread->signals_container.mask = uk_thread_current()->signals_container.mask;
+#endif
+
 	ptd->uk_thread->prv = ptd;
 
 	*ph = ptd->uk_thread;
-- 
2.25.1



From minios-devel-bounces@lists.xenproject.org Sat Jan 09 15:33:10 2021
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Sat, 09 Jan 2021 15:33:10 +0000
Received: from list by lists.xenproject.org with outflank-mailman.62183.113548 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1kyGEk-0003Re-Sc; Sat, 09 Jan 2021 15:33:06 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 62183.113548; Sat, 09 Jan 2021 15:33: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 1kyGEk-0003RW-O8; Sat, 09 Jan 2021 15:33:06 +0000
Received: by outflank-mailman (input) for mailman id 62183;
 Tue, 05 Jan 2021 19:31:29 +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=xRfd=GI=student.uliege.be=b.rizzo@srs-us1.protection.inumbo.net>)
 id 1kws3E-0000Q3-Ia
 for minios-devel@lists.xenproject.org; Tue, 05 Jan 2021 19:31:29 +0000
Received: from serv108.segi.ulg.ac.be (unknown [139.165.32.111])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 1d2cf9a3-cb9b-4e63-a481-93d8786f39f2;
 Tue, 05 Jan 2021 19:31:26 +0000 (UTC)
Received: from localhost.localdomain (unknown [91.182.172.238])
 (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
 (No client certificate requested)
 by serv108.segi.ulg.ac.be (Postfix) with ESMTPSA id 1071D200EEDA;
 Tue,  5 Jan 2021 20:31:25 +0100 (CET)
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: 1d2cf9a3-cb9b-4e63-a481-93d8786f39f2
DKIM-Filter: OpenDKIM Filter v2.11.0 serv108.segi.ulg.ac.be 1071D200EEDA
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=uliege.be;
	s=ulg20190529; t=1609875085;
	bh=AhSYam0zIx6nxrJWyRnnzGeiHcN6W1Quu0GBUxb11q4=;
	h=From:To:Cc:Subject:Date:From;
	b=Tu6ir+Oa3sEJfitxAmA5e6MQS0APj/UsD4U0rL3dAwwjY34PjaKoBqih0Ua1hBOeC
	 Hr0Tf/hBPzdZCcJy9Mr7+tmEILAyAvcVd8L1NelO6eWfjMrQKMHXc4UBY+r56Zy7Jr
	 qGcatzTwXueFqx7DoYNRi0gsom5eQkYv8D4DS7wM9mqBgo5FICMKXkB5SZ1LFFPZkL
	 t9/LucoOEYuaBEwanjEUCt06XRgJ6l0klZwoTOO1JDOACG/aWrLnQry1/ub+wTvHE4
	 1In4nLGHZossLdvZLJK0zJAKtvrN2A1jhYSatSVxWu1roVV8pEpo98SboOtwzNEW9W
	 BiII31iTyoFoQ==
From: Bernard Rizzo <b.rizzo@student.uliege.be>
To: minios-devel@lists.xenproject.org
Cc: Bernard Rizzo <b.rizzo@student.uliege.be>,
	Felipe Huici <felipe.huici@neclab.eu>
Subject: [NEWLIB PATCH 1/1] lib/newlib: Support for uksignal
Date: Tue,  5 Jan 2021 20:30:41 +0100
Message-Id: <20210105193043.504160-1-b.rizzo@student.uliege.be>
X-Mailer: git-send-email 2.25.1
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit

This patch is an update of the original.

Signed-off-by: Felipe Huici <felipe.huici@neclab.eu>
Signed-off-by: Bernard Rizzo <b.rizzo@student.uliege.be>
---
 Makefile.uk      |  4 ++++
 include/signal.h | 11 +++++++++++
 plat.c           |  8 --------
 signal.c         | 50 +++++++++++++++++-------------------------------
 4 files changed, 33 insertions(+), 40 deletions(-)
 create mode 100644 include/signal.h

diff --git a/Makefile.uk b/Makefile.uk
index 82836e4..bb3b65f 100644
--- a/Makefile.uk
+++ b/Makefile.uk
@@ -136,7 +136,9 @@ LIBNEWLIBGLUE_SRCS-y += $(LIBNEWLIBC_BASE)/resource.c
 LIBNEWLIBGLUE_SRCS-y += $(LIBNEWLIBC_BASE)/pty.c
 LIBNEWLIBGLUE_SRCS-y += $(LIBNEWLIBC_BASE)/locale.c
 LIBNEWLIBGLUE_SRCS-y += $(LIBNEWLIBC_BASE)/dev.c
+ifneq ($(CONFIG_LIBUKSIGNAL),y)
 LIBNEWLIBGLUE_SRCS-y += $(LIBNEWLIBC_BASE)/signal.c
+endif
 LIBNEWLIBGLUE_SRCS-y += $(LIBNEWLIBC_BASE)/link.c
 LIBNEWLIBGLUE_SRCS-y += $(LIBNEWLIBC_BASE)/mntent.c
 LIBNEWLIBGLUE_SRCS-y += $(LIBNEWLIBC_BASE)/syscall.c
@@ -414,9 +416,11 @@ LIBNEWLIBC_SRCS-y += $(LIBNEWLIB_LIBC)/search/bsd_qsort_r.c
 ################################################################################
 # Newlib/libc code -- signal
 ################################################################################
+ifneq ($(CONFIG_LIBUKSIGNAL),y)
 LIBNEWLIBC_SRCS-y += $(LIBNEWLIB_LIBC)/signal/psignal.c
 LIBNEWLIBC_SRCS-y += $(LIBNEWLIB_LIBC)/signal/raise.c
 LIBNEWLIBC_SRCS-y += $(LIBNEWLIB_LIBC)/signal/signal.c
+endif
 
 ################################################################################
 # Newlib/libc code -- stdio
diff --git a/include/signal.h b/include/signal.h
new file mode 100644
index 0000000..778dec1
--- /dev/null
+++ b/include/signal.h
@@ -0,0 +1,11 @@
+#ifndef _NEWLIB_GLUE_SIGNAL_H_
+#define _NEWLIB_GLUE_SIGNAL_H_
+#include <uk/config.h>
+
+#if CONFIG_LIBUKSIGNAL
+#include <uk/signal.h>
+#else
+#include_next <signal.h>
+#endif
+
+#endif /* _NEWLIB_GLUE_SIGNAL_H_ */
diff --git a/plat.c b/plat.c
index df07dce..2a12801 100644
--- a/plat.c
+++ b/plat.c
@@ -47,14 +47,6 @@ int getentropy(void *buf __unused, size_t buflen __unused)
 	return -1;
 }
 
-int sigprocmask(int how __unused, const sigset_t *set __unused,
-		sigset_t *oldset __unused)
-{
-	/* TODO: implement. */
-	errno = ENOTSUP;
-	return -1;
-}
-
 #include <uk/plat/bootstrap.h>
 
 void abort(void)
diff --git a/signal.c b/signal.c
index 4279ee7..1f6cae3 100644
--- a/signal.c
+++ b/signal.c
@@ -37,51 +37,37 @@
 #include <errno.h>
 #include <signal.h>
 
+int kill(int pid __unused, int sig __unused)
+{
+	errno = EINVAL;
+	return -1;
+}
+
 int sigaction(int sig __unused, const struct sigaction *restrict act __unused,
-	      struct sigaction *restrict oact __unused)
+	     struct sigaction *restrict oact __unused)
 {
 	return 0;
 }
-
+
+int sigprocmask(int how __unused, const sigset_t *set __unused,
+				sigset_t *oldset __unused)
+{
+	/* TODO: implement. */
+	errno = ENOTSUP;
+	return -1;
+}
+
 unsigned int alarm(unsigned int seconds __unused)
 {
 	return 0;
 }
-
+
 int pause(void)
 {
 	return 0;
 }
-
+
 int siginterrupt(int sig __unused, int flag __unused)
 {
 	return 0;
 }
-
-int sigsuspend(const sigset_t *mask)
-{
-	return 0;
-}
-
-int kill(int pid, int sig __unused)
-{
-	/* TODO check sig */
-	if (pid != UNIKRAFT_PID)
-		errno = ESRCH;
-	return -1;
-}
-
-int killpg(int pgrp, int sig __unused)
-{
-	/* TODO check sig */
-	if (pgrp != UNIKRAFT_PGID)
-		errno = ESRCH;
-	return -1;
-}
-
-int sigaltstack(const stack_t *ss, stack_t *old_ss)
-{
-	WARN_STUBBED();
-	errno = ENOTSUP;
-	return -1;
-}
-- 
2.25.1



From minios-devel-bounces@lists.xenproject.org Sat Jan 09 15:33:11 2021
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Sat, 09 Jan 2021 15:33:11 +0000
Received: from list by lists.xenproject.org with outflank-mailman.62187.113556 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1kyGEl-0003SC-37; Sat, 09 Jan 2021 15:33:07 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 62187.113556; Sat, 09 Jan 2021 15:33: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 1kyGEk-0003Rw-S5; Sat, 09 Jan 2021 15:33:06 +0000
Received: by outflank-mailman (input) for mailman id 62187;
 Tue, 05 Jan 2021 19:31: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=xRfd=GI=student.uliege.be=b.rizzo@srs-us1.protection.inumbo.net>)
 id 1kws3d-0000Qo-1I
 for minios-devel@lists.xenproject.org; Tue, 05 Jan 2021 19:31:53 +0000
Received: from serv108.segi.ulg.ac.be (unknown [139.165.32.111])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id fe14c30c-fad4-43e9-91a1-afff5731996b;
 Tue, 05 Jan 2021 19:31:50 +0000 (UTC)
Received: from localhost.localdomain (unknown [91.182.172.238])
 (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
 (No client certificate requested)
 by serv108.segi.ulg.ac.be (Postfix) with ESMTPSA id 05B27200EEDF;
 Tue,  5 Jan 2021 20:31:49 +0100 (CET)
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: fe14c30c-fad4-43e9-91a1-afff5731996b
DKIM-Filter: OpenDKIM Filter v2.11.0 serv108.segi.ulg.ac.be 05B27200EEDF
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=uliege.be;
	s=ulg20190529; t=1609875109;
	bh=fLYFPLzgh5p1a+VC9fNxun2ddFLvN/Ji5J0dnYzI1t0=;
	h=From:To:Cc:Subject:Date:In-Reply-To:References:From;
	b=g/R87FoiC3ngQ/78dIR3VhDoE5btnJ6lwQg48LuUmik89hwGJFFTIA6ws9Z+l9Lzs
	 hAUINGIy0b9eelkFcVD3GRFmelhx8kpPOuYTa9fun5938Z3AyN7lDBKKONMhir8rpo
	 /caoVg6xbFHhcdAOWU3sq7Q0gEGD1P7H9ULuib38axo7arwHnH4Dg1YeyZXhOYaUNx
	 M0gfZ6gkiWPa3VM10G1mGQVyRoUPHGPP2LEFSGYyrcqJ3pi/zqrL9ynoiETj53qGIF
	 u66q0FjRJJ4KQ8ajBEGC53mIr58zpEUmZ2D7AyHaMe04dKpp0Ffbvx/U3wsLXe2dPu
	 rfKD0yOSBJjuw==
From: Bernard Rizzo <b.rizzo@student.uliege.be>
To: minios-devel@lists.xenproject.org
Cc: Bernard Rizzo <b.rizzo@student.uliege.be>,
	Felipe Huici <felipe.huici@neclab.eu>
Subject: [UNIKRAFT PATCH 1/1] lib/uksignal: initial code
Date: Tue,  5 Jan 2021 20:30:43 +0100
Message-Id: <20210105193043.504160-3-b.rizzo@student.uliege.be>
X-Mailer: git-send-email 2.25.1
In-Reply-To: <20210105193043.504160-1-b.rizzo@student.uliege.be>
References: <20210105193043.504160-1-b.rizzo@student.uliege.be>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit

uksignal provides a basic implementation of signals over Unikraft. It
supports signals between threads and process wide signals. It provides
all the definitions needed for signals so we must disable the
definitions provided in libc to run it.

It does not support signal codes, rt signals and executes the signal
handlers on the thread stack. It is also not yet integrated with our
irqs to deliver signals like SIGSEGV.

This implementation is not complete; it is meant as a temporory
solution until we have a proper events delivering system.

This patch is an update of the original.

Signed-off-by: Felipe Huici <felipe.huici@neclab.eu>
Signed-off-by: Bernard Rizzo <b.rizzo@student.uliege.be>
---
 lib/Makefile.uk                            |   1 +
 lib/uksched/include/uk/thread.h            |   6 +
 lib/uksched/sched.c                        |   7 +
 lib/uksched/thread.c                       |   6 +
 lib/uksignal/Config.uk                     |   7 +
 lib/uksignal/Makefile.uk                   |   8 +
 lib/uksignal/README                        |   7 +
 lib/uksignal/exportsyms.uk                 |  27 ++
 lib/uksignal/include/uk/bits/sigset.h      |  66 +++
 lib/uksignal/include/uk/signal.h           | 131 ++++++
 lib/uksignal/include/uk/string/strsignal.h |  19 +
 lib/uksignal/include/uk/uk_signal.h        | 136 +++++++
 lib/uksignal/signal.c                      | 320 +++++++++++++++
 lib/uksignal/sigset.c                      |  51 +++
 lib/uksignal/strsignal.c                   |  61 +++
 lib/uksignal/uk_signal.c                   | 451 +++++++++++++++++++++
 plat/common/x86/thread_start.S             |   7 +
 17 files changed, 1311 insertions(+)
 create mode 100644 lib/uksignal/Config.uk
 create mode 100644 lib/uksignal/Makefile.uk
 create mode 100644 lib/uksignal/README
 create mode 100644 lib/uksignal/exportsyms.uk
 create mode 100644 lib/uksignal/include/uk/bits/sigset.h
 create mode 100644 lib/uksignal/include/uk/signal.h
 create mode 100644 lib/uksignal/include/uk/string/strsignal.h
 create mode 100644 lib/uksignal/include/uk/uk_signal.h
 create mode 100644 lib/uksignal/signal.c
 create mode 100644 lib/uksignal/sigset.c
 create mode 100644 lib/uksignal/strsignal.c
 create mode 100644 lib/uksignal/uk_signal.c

diff --git a/lib/Makefile.uk b/lib/Makefile.uk
index 07e8a29..f50795d 100644
--- a/lib/Makefile.uk
+++ b/lib/Makefile.uk
@@ -37,3 +37,4 @@ $(eval $(call _import_lib,$(CONFIG_UK_BASE)/lib/ukmmap))
 $(eval $(call _import_lib,$(CONFIG_UK_BASE)/lib/ukblkdev))
 $(eval $(call _import_lib,$(CONFIG_UK_BASE)/lib/posix-process))
 $(eval $(call _import_lib,$(CONFIG_UK_BASE)/lib/uksp))
+$(eval $(call _import_lib,$(CONFIG_UK_BASE)/lib/uksignal))
diff --git a/lib/uksched/include/uk/thread.h b/lib/uksched/include/uk/thread.h
index d8a4ac8..5ec25a8 100644
--- a/lib/uksched/include/uk/thread.h
+++ b/lib/uksched/include/uk/thread.h
@@ -36,6 +36,9 @@
 #include <uk/arch/lcpu.h>
 #include <uk/arch/time.h>
 #include <uk/plat/thread.h>
+#if CONFIG_LIBUKSIGNAL
+#include <uk/uk_signal.h>
+#endif
 #include <uk/thread_attr.h>
 #include <uk/wait_types.h>
 #include <uk/list.h>
@@ -62,6 +65,9 @@ struct uk_thread {
 #ifdef CONFIG_LIBNEWLIBC
 	struct _reent reent;
 #endif
+#if CONFIG_LIBUKSIGNAL
+	struct uk_thread_sig signals_container;
+#endif
 };
 
 UK_TAILQ_HEAD(uk_thread_list, struct uk_thread);
diff --git a/lib/uksched/sched.c b/lib/uksched/sched.c
index 4b8e149..5a58629 100644
--- a/lib/uksched/sched.c
+++ b/lib/uksched/sched.c
@@ -42,6 +42,9 @@
 #if CONFIG_LIBUKSCHEDCOOP
 #include <uk/schedcoop.h>
 #endif
+#if CONFIG_LIBUKSIGNAL
+#include <uk/uk_signal.h>
+#endif
 
 struct uk_sched *uk_sched_head;
 
@@ -50,6 +53,10 @@ struct uk_sched *uk_sched_default_init(struct uk_alloc *a)
 {
 	struct uk_sched *s = NULL;
 
+#if CONFIG_LIBUKSIGNAL
+	uk_proc_sig_init(&uk_proc_sig);
+#endif
+
 #if CONFIG_LIBUKSCHEDCOOP
 	s = uk_schedcoop_init(a);
 #endif
diff --git a/lib/uksched/thread.c b/lib/uksched/thread.c
index f8ae786..609a4ce 100644
--- a/lib/uksched/thread.c
+++ b/lib/uksched/thread.c
@@ -125,6 +125,9 @@ int uk_thread_init(struct uk_thread *thread,
 #ifdef CONFIG_LIBNEWLIBC
 	reent_init(&thread->reent);
 #endif
+#if CONFIG_LIBUKSIGNAL
+	uk_thread_sig_init(&thread->signals_container);
+#endif
 
 	uk_pr_info("Thread \"%s\": pointer: %p, stack: %p, tls: %p\n",
 		   name, thread, thread->stack, thread->tls);
@@ -135,6 +138,9 @@ int uk_thread_init(struct uk_thread *thread,
 void uk_thread_fini(struct uk_thread *thread, struct uk_alloc *allocator)
 {
 	UK_ASSERT(thread != NULL);
+#if CONFIG_LIBUKSIGNAL
+	uk_thread_sig_uninit(&thread->signals_container);
+#endif
 	ukplat_thread_ctx_destroy(allocator, thread->ctx);
 }
 
diff --git a/lib/uksignal/Config.uk b/lib/uksignal/Config.uk
new file mode 100644
index 0000000..56c1644
--- /dev/null
+++ b/lib/uksignal/Config.uk
@@ -0,0 +1,7 @@
+menuconfig LIBUKSIGNAL
+	bool "uksignal: Unikraft signals"
+	default n
+	select LIBNOLIBC if !HAVE_LIBC
+	select LIBUKDEBUG
+	select LIBUKALLOC
+	select LIBUKSCHED
diff --git a/lib/uksignal/Makefile.uk b/lib/uksignal/Makefile.uk
new file mode 100644
index 0000000..0f1f539
--- /dev/null
+++ b/lib/uksignal/Makefile.uk
@@ -0,0 +1,8 @@
+$(eval $(call addlib_s,libuksignal,$(CONFIG_LIBUKSIGNAL)))
+
+CINCLUDES-$(CONFIG_LIBUKSIGNAL)     += -I$(LIBUKSIGNAL_BASE)/include
+CXXINCLUDES-$(CONFIG_LIBUKSIGNAL)   += -I$(LIBUKSIGNAL_BASE)/include
+
+LIBUKSIGNAL_SRCS-y += $(LIBUKSIGNAL_BASE)/signal.c
+LIBUKSIGNAL_SRCS-y += $(LIBUKSIGNAL_BASE)/sigset.c
+LIBUKSIGNAL_SRCS-y += $(LIBUKSIGNAL_BASE)/uk_signal.c
\ No newline at end of file
diff --git a/lib/uksignal/README b/lib/uksignal/README
new file mode 100644
index 0000000..ff8691f
--- /dev/null
+++ b/lib/uksignal/README
@@ -0,0 +1,7 @@
+This library provides a basic implementation of signals over
+Unikraft. It supports signals between threads and process wide
+signals.
+
+It doesn't support signal codes, rt signals and executes the signal
+handlers on the thread stack. It is also not yet integrated with our
+irqs to deliver signals like SIGSEGV.
\ No newline at end of file
diff --git a/lib/uksignal/exportsyms.uk b/lib/uksignal/exportsyms.uk
new file mode 100644
index 0000000..dbf23fe
--- /dev/null
+++ b/lib/uksignal/exportsyms.uk
@@ -0,0 +1,27 @@
+# uk_signal.h
+uk_proc_sig
+
+uk_sig_handle_signals
+uk_proc_sig_init
+uk_thread_sig_init
+uk_thread_sig_uninit
+uk_sig_thread_kill
+uk_thread_sigmask
+
+# signal.h
+sigaction
+signal
+sigprocmask
+sigsuspend
+sigpending
+sigwait
+kill
+raise
+pthread_sigmask
+
+# sigset.h
+sigemptyset
+sigfillset
+sigaddset
+sigdelset
+sigismember
\ No newline at end of file
diff --git a/lib/uksignal/include/uk/bits/sigset.h b/lib/uksignal/include/uk/bits/sigset.h
new file mode 100644
index 0000000..3642633
--- /dev/null
+++ b/lib/uksignal/include/uk/bits/sigset.h
@@ -0,0 +1,66 @@
+#ifndef __UK_SIGNAL_H__
+#error Do not include this header directly
+#endif
+
+#ifndef __UK_SIGSET_H__
+#define __UK_SIGSET_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define SIG_BLOCK     0
+#define SIG_UNBLOCK   1
+#define SIG_SETMASK   2
+
+typedef unsigned long __sigset_t;
+typedef __sigset_t sigset_t;
+
+int sigemptyset(sigset_t *set);
+int sigfillset(sigset_t *set);
+int sigaddset(sigset_t *set, int signo);
+int sigdelset(sigset_t *set, int signo);
+int sigismember(const sigset_t *set, int signo);
+
+/* TODO: do we have gnu statement expression?  */
+/* internal use */
+#define uk_sigemptyset(ptr)	\
+		do {	\
+			*(ptr) = 0;	\
+		} while (0)
+#define uk_sigfillset(ptr)	\
+		do {	\
+			*(ptr) = ~((__sigset_t) 0);	\
+		} while (0)
+#define uk_sigaddset(ptr, signo)	\
+		do {	\
+			*(ptr) |= (1 << ((signo) - 1));	\
+		} while (0)
+#define uk_sigdelset(ptr, signo)	\
+		do {	\
+			*(ptr) &= ~(1 << ((signo) - 1));	\
+		} while (0)
+#define uk_sigcopyset(ptr1, ptr2)	\
+		do {	\
+			*(ptr1) = *(ptr2);	\
+		} while (0)
+#define uk_sigandset(ptr1, ptr2)	\
+		do {	\
+			*(ptr1) &= *(ptr2);	\
+		} while (0)
+#define uk_sigorset(ptr1, ptr2)	\
+		do {	\
+			*(ptr1) |= *(ptr2);	\
+		} while (0)
+#define uk_sigreverseset(ptr)	\
+		do {	\
+			*(ptr) = ~(*(ptr));	\
+		} while (0)
+#define uk_sigismember(ptr, signo) (*(ptr) & (1 << ((signo) - 1)))
+#define uk_sigisempty(ptr) (*(ptr) == 0)
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __UK_SIGSET_H__ */
diff --git a/lib/uksignal/include/uk/signal.h b/lib/uksignal/include/uk/signal.h
new file mode 100644
index 0000000..43fdabc
--- /dev/null
+++ b/lib/uksignal/include/uk/signal.h
@@ -0,0 +1,131 @@
+/* adapted from OSv */
+#ifndef __UK_SIGNAL_H__
+#define __UK_SIGNAL_H__
+
+#include <stddef.h>
+#include <uk/bits/sigset.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define SIGHUP    1
+#define SIGINT    2
+#define SIGQUIT   3
+#define SIGILL    4
+#define SIGTRAP   5
+#define SIGABRT   6
+#define SIGIOT    SIGABRT
+#define SIGBUS    7
+#define SIGFPE    8
+#define SIGKILL   9
+#define SIGUSR1   10
+#define SIGSEGV   11
+#define SIGUSR2   12
+#define SIGPIPE   13
+#define SIGALRM   14
+#define SIGTERM   15
+#define SIGSTKFLT 16
+#define SIGCHLD   17
+#define SIGCONT   18
+#define SIGSTOP   19
+#define SIGTSTP   20
+#define SIGTTIN   21
+#define SIGTTOU   22
+#define SIGURG    23
+#define SIGXCPU   24
+#define SIGXFSZ   25
+#define SIGVTALRM 26
+#define SIGPROF   27
+#define SIGWINCH  28
+#define SIGIO     29
+#define SIGPOLL   29
+#define SIGPWR    30
+#define SIGSYS    31
+#define SIGUNUSED SIGSYS
+
+#define _NSIG 32
+
+#define SA_NOCLDSTOP  1
+#define SA_NOCLDWAIT  2
+#define SA_SIGINFO    4
+#define SA_ONSTACK    0x08000000
+#define SA_RESTART    0x10000000
+#define SA_NODEFER    0x40000000
+#define SA_RESETHAND  0x80000000
+#define SA_RESTORER   0x04000000
+
+typedef int pid_t;
+typedef int sig_atomic_t;
+
+#define NSIG _NSIG
+
+typedef struct {
+  int          si_signo;    /* Signal number */
+  int          si_code;     /* Cause of the signal */
+  pid_t	       si_pid;	    /* Sending process ID */
+} siginfo_t;
+
+struct sigaction {
+	union {
+		void (*sa_handler)(int);
+		void (*sa_sigaction)(int, siginfo_t *, void *);
+	} __sa_handler;
+	sigset_t sa_mask;
+	int sa_flags;
+	void (*sa_restorer)(void);
+};
+#define sa_handler   __sa_handler.sa_handler
+#define sa_sigaction __sa_handler.sa_sigaction
+
+#define SIG_ERR  ((void (*)(int))-1)
+#define SIG_DFL  ((void (*)(int)) 0)
+#define SIG_IGN  ((void (*)(int)) 1)
+
+/* TODO: do we have gnu statement expression? */
+#define is_sig_dfl(ptr)	\
+	(!((ptr)->sa_flags & SA_SIGINFO) && (ptr)->sa_handler == SIG_DFL)
+
+#define is_sig_ign(ptr)	\
+	(!((ptr)->sa_flags & SA_SIGINFO) && (ptr)->sa_handler == SIG_IGN)
+
+int
+sigaction(int signum, const struct sigaction *act, struct sigaction *oldact);
+
+int sigpending(sigset_t *set);
+int sigprocmask(int how, const sigset_t *set, sigset_t *oldset);
+int sigsuspend(const sigset_t *mask);
+int sigwait(const sigset_t *set, int *sig);
+
+int kill(pid_t pid, int sig);
+int raise(int sig);
+
+typedef void (*sighandler_t)(int);
+sighandler_t signal(int signum, sighandler_t handler);
+
+int pthread_sigmask(int how, const sigset_t *set, sigset_t *oldset);
+
+/* TODO: not used - defined just for newlib */
+union sigval {
+	int    sival_int;	/* Integer signal value */
+	void  *sival_ptr;	/* Pointer signal value */
+};
+
+struct sigevent {
+	int              sigev_notify;	/* Notification type */
+	int              sigev_signo;	/* Signal number */
+	union sigval     sigev_value;	/* Signal value */
+};
+
+/* TODO: not used - defined just for v8 */
+typedef struct sigaltstack {
+	void *ss_sp;
+	int ss_flags;
+	size_t ss_size;
+} stack_t;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __UK_SIGNAL_H__ */
diff --git a/lib/uksignal/include/uk/string/strsignal.h b/lib/uksignal/include/uk/string/strsignal.h
new file mode 100644
index 0000000..73b69cb
--- /dev/null
+++ b/lib/uksignal/include/uk/string/strsignal.h
@@ -0,0 +1,19 @@
+#ifndef __UK_STRSIGNAL_H__
+#define __UK_STRSIGNAL_H__
+
+/*
+ * TODO: not used - delete
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+extern const char * const sys_siglist[];
+char *strsignal(int sig);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __UK_STRSIGNAL_H__ */
diff --git a/lib/uksignal/include/uk/uk_signal.h b/lib/uksignal/include/uk/uk_signal.h
new file mode 100644
index 0000000..cb066d1
--- /dev/null
+++ b/lib/uksignal/include/uk/uk_signal.h
@@ -0,0 +1,136 @@
+#ifndef __UK_UK_SIGNAL_H__
+#define __UK_UK_SIGNAL_H__
+
+#include <uk/list.h>
+#include <uk/signal.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define _UK_TH_SIG uk_crr_thread_sig_container()
+
+struct uk_thread;
+
+struct uk_signal {
+	siginfo_t info;
+	struct uk_list_head list_node;
+};
+
+/* TODO: add synchronization */
+
+struct uk_proc_sig {
+	/* used as a bitmap for pending signals */
+	sigset_t pending;
+	/* pending signals - valid only if corresponding bit in pending is set */
+	siginfo_t pending_signals[NSIG - 1];
+	/* signal handlers for this process */
+	struct sigaction sigaction[NSIG - 1];
+	/* list of uk_thread_sig from the threads of the proc */
+	struct uk_list_head thread_sig_list;
+};
+
+extern struct uk_proc_sig uk_proc_sig;
+
+enum uk_sig_waiting {
+	UK_SIG_NOT_WAITING = 0,
+	UK_SIG_WAITING = 1,
+	UK_SIG_WAITING_SCHED = 2
+};
+
+struct uk_thread_sig_wait {
+	/*
+	 * waiting status
+	 *
+	 * values:
+	 * 	UK_SIG_NOT_WAITING - thread is not waiting
+	 * 	UK_SIG_WAITING - thread is waiting for a signal
+	 * 	UK_SIG_WAITING_SCHED - thread is waiting to be scheduled
+	 */
+	enum uk_sig_waiting status;
+	/* used as a bitmap for awaited signals */
+	sigset_t awaited;
+	/* awaited signal received */
+	siginfo_t received_signal;
+};
+
+struct uk_thread_sig {
+	/* blocked signals */
+	sigset_t mask;
+	/* used as a bitmap for pending signals */
+	sigset_t pending;
+	/* list of pending signals */
+	struct uk_list_head pending_signals;
+	/* signal waiting state */
+	struct uk_thread_sig_wait wait;
+	/* node for the thread_sig_list from the proc */
+	struct uk_list_head list_node;
+};
+
+/* returns number of executed signal handlers */
+int uk_sig_handle_signals(void);
+
+int uk_proc_sig_init(struct uk_proc_sig *sig);
+int uk_thread_sig_init(struct uk_thread_sig *sig);
+void uk_thread_sig_uninit(struct uk_thread_sig *sig);
+
+/* TODO: replace sched thread_kill? */
+int uk_sig_thread_kill(struct uk_thread *tid, int sig);
+int uk_thread_sigmask(int how, const sigset_t *set, sigset_t *oldset);
+
+/* internal use */
+static inline int uk_sig_is_valid(int sig)
+{
+	return (sig < NSIG && sig > 0);
+}
+
+static inline void uk_sigset_remove_unmaskable(sigset_t *sig)
+{
+	uk_sigdelset(sig, SIGKILL);
+	uk_sigdelset(sig, SIGSTOP);
+}
+
+static inline void uk_add_proc_signal(siginfo_t *sig)
+{
+	uk_proc_sig.pending_signals[sig->si_signo - 1] = *sig;
+	uk_sigaddset(&uk_proc_sig.pending, sig->si_signo);
+}
+
+static inline void uk_remove_proc_signal(int sig)
+{
+	uk_sigdelset(&uk_proc_sig.pending, sig);
+}
+
+/* maybe move to sched */
+struct uk_thread_sig *uk_crr_thread_sig_container(void);
+void uk_sig_init_siginfo(siginfo_t *siginfo, int sig);
+
+/* returns the uk_signal for sig if it is pending on thread */
+struct uk_signal *
+uk_sig_th_get_pending(struct uk_thread_sig *th_sig, int sig);
+
+/* returns the siginfo for sig if it is pending on proc */
+siginfo_t *uk_sig_proc_get_pending(int sig);
+
+/*
+ * returns the uk_signal for a signal from the given
+ * set if it is pending on thread
+ */
+struct uk_signal *
+uk_sig_th_get_pending_any(struct uk_thread_sig *th_sig, sigset_t set);
+
+/*
+ * returns the siginfo for a signal from the given
+ * set if it is pending on proc
+ */
+siginfo_t *uk_sig_proc_get_pending_any(sigset_t set);
+
+int
+uk_deliver_proc_signal(struct uk_thread_sig *th_sig, siginfo_t *sig);
+void uk_execute_handler(siginfo_t sig);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __UK_UK_SIGNAL_H__ */
diff --git a/lib/uksignal/signal.c b/lib/uksignal/signal.c
new file mode 100644
index 0000000..5f5e289
--- /dev/null
+++ b/lib/uksignal/signal.c
@@ -0,0 +1,320 @@
+/* adapted from OSv */
+
+#include <errno.h>
+
+#include <uk/alloc.h>
+#include <uk/sched.h>
+#include <uk/signal.h>
+#include <uk/thread.h>
+#include <uk/uk_signal.h>
+
+/*
+ * Tries to deliver a pending signal to the current thread
+ * Used only with a waiting thread
+ *
+ * Returns: 0 if no signal was delivered, 1 if a signal was delivered
+ */
+static int uk_get_awaited_signal(void)
+{
+	siginfo_t *siginfo;
+	struct uk_signal *signal;
+	struct uk_thread_sig *ptr;
+
+	ptr = _UK_TH_SIG;
+
+	/* try to deliver thread pending signal */
+	signal = uk_sig_th_get_pending_any(ptr, ptr->wait.awaited);
+
+	if (signal) {
+		/* set awaited signal */
+		ptr->wait.received_signal = signal->info;
+
+		/* remove it from the list of pending signals */
+		uk_list_del(&signal->list_node);
+		uk_sigdelset(&ptr->pending, signal->info.si_signo);
+		uk_free(uk_alloc_get_default(), signal);
+		return 1;
+	}
+
+	/* try to deliver process pending signal */
+	siginfo = uk_sig_proc_get_pending_any(ptr->wait.awaited);
+
+	if (siginfo) {
+		ptr->wait.received_signal = *siginfo;
+
+		/* remove it from the list of pending signals */
+		uk_remove_proc_signal(siginfo->si_signo);
+		return 1;
+	}
+
+	return 0;
+}
+
+/* TODO: We do not support any sa_flags besides SA_SIGINFO */
+int
+sigaction(int signum, const struct sigaction *act, struct sigaction *oldact)
+{
+	struct uk_list_head *i;
+	struct uk_thread_sig *th_sig;
+	struct uk_signal *signal;
+
+	if (!uk_sig_is_valid(signum) ||
+			signum == SIGKILL ||
+			signum == SIGSTOP) {
+		errno = EINVAL;
+		return -1;
+	}
+
+	if (oldact)
+		*oldact = uk_proc_sig.sigaction[signum - 1];
+
+	if (act) {
+		/* TODO: SA_NODEFER */
+		uk_proc_sig.sigaction[signum - 1] = *act;
+		uk_sigaddset(&uk_proc_sig.sigaction[signum - 1].sa_mask, signum);
+
+		/* remove signal from where it is pending */
+		if (is_sig_ign(act)) {
+			/* remove it from proc */
+			uk_remove_proc_signal(signum);
+
+			/* remove it from threads*/
+			uk_list_for_each(i, &uk_proc_sig.thread_sig_list) {
+				th_sig = uk_list_entry(i, struct uk_thread_sig, list_node);
+
+				signal = uk_sig_th_get_pending(th_sig, signum);
+
+				if (signal) {
+					/* remove it from the list of pending signals */
+					uk_list_del(&signal->list_node);
+					uk_sigdelset(&th_sig->pending, signal->info.si_signo);
+					uk_free(uk_alloc_get_default(), signal);
+				}
+			}
+		}
+	}
+
+	return 0;
+}
+
+static sighandler_t uk_signal(int signum, sighandler_t handler, int sa_flags)
+{
+	struct sigaction old;
+	struct sigaction act = {
+		.sa_handler = handler,
+		.sa_flags = sa_flags
+	};
+
+	if (sigaction(signum, &act, &old) < 0)
+		return SIG_ERR;
+
+	if (old.sa_flags & SA_SIGINFO)
+		return NULL;
+	else
+		return old.sa_handler;
+}
+
+sighandler_t signal(int signum, sighandler_t handler)
+{
+	/* SA_RESTART <- BSD signal semantics */
+	return uk_signal(signum, handler, SA_RESTART);
+}
+
+int sigpending(sigset_t *set)
+{
+	struct uk_thread_sig *ptr;
+
+	ptr = _UK_TH_SIG;
+
+	uk_sigcopyset(set, &ptr->pending);
+	uk_sigorset(set, &uk_proc_sig.pending);
+
+	return 0;
+}
+
+int sigprocmask(int how, const sigset_t *set, sigset_t *oldset)
+{
+	return uk_thread_sigmask(how, set, oldset);
+}
+
+int pthread_sigmask(int how, const sigset_t *set, sigset_t *oldset)
+{
+	return uk_thread_sigmask(how, set, oldset);
+}
+
+int sigsuspend(const sigset_t *mask)
+{
+	/* If the signals are ignored, this doesn't return <- POSIX */
+
+	sigset_t cleaned_mask, tmp;
+	struct uk_thread_sig *ptr;
+
+	uk_sigcopyset(&cleaned_mask, mask);
+	uk_sigset_remove_unmaskable(&cleaned_mask);
+
+	ptr = _UK_TH_SIG;
+
+	uk_sigcopyset(&ptr->wait.awaited, &cleaned_mask);
+
+	/* we are waiting for all the signals that aren't blocked */
+	uk_sigreverseset(&ptr->wait.awaited);
+
+	/* change mask */
+	uk_sigcopyset(&tmp, &ptr->mask);
+	uk_sigcopyset(&ptr->mask, &cleaned_mask);
+
+	while (1) {
+		/* try to deliver a pending signal */
+		if (uk_get_awaited_signal())
+			break;
+
+		/* block, yield */
+		uk_thread_block(uk_thread_current());
+		ptr->wait.status = UK_SIG_WAITING;
+		uk_sched_yield();
+	}
+
+	ptr->wait.status = UK_SIG_NOT_WAITING;
+
+	/* execute handler */
+	uk_execute_handler(ptr->wait.received_signal);
+
+	/* restore mask
+	 *
+	 * We restore the mask here because we are technically done with
+	 * sigsuspend and the mask must be restored at the end of sigsuspend
+	 */
+	uk_sigcopyset(&ptr->mask, &tmp);
+
+	/* execute other pending signals */
+	uk_sig_handle_signals();
+
+	errno = EINTR;
+	return -1; /* always returns -1 and sets errno to EINTR */
+}
+
+int sigwait(const sigset_t *set, int *sig)
+{
+	/*
+	 * If the signals are ignored, this doesn't return <- TODO: POSIX ??
+	 *
+	 * POSIX states that the signals in set must have been blocked before
+	 * calling sigwait, otherwise behavior is undefined -> for us the
+	 * behavior is not caring -> even if the signal is not blocked sigwait
+	 * will still accept it
+	 *
+	 * NOTE: this function is not signal safe
+	 */
+
+	int signals_executed;
+	sigset_t cleaned_set, awaited_save;
+	struct uk_thread_sig *ptr;
+
+	uk_sigcopyset(&cleaned_set, set);
+	uk_sigset_remove_unmaskable(&cleaned_set);
+
+	if (uk_sigisempty(&cleaned_set))
+		return EINVAL;
+
+	ptr = _UK_TH_SIG;
+
+	uk_sigcopyset(&ptr->wait.awaited, &cleaned_set);
+
+	/* save awaited signals */
+	awaited_save = ptr->wait.awaited;
+
+	while (1) {
+		if (uk_get_awaited_signal())
+			break;
+
+		/*
+		 * sigwait allows signals to be received while
+		 * waiting so handle them
+		 */
+		ptr->wait.status = UK_SIG_NOT_WAITING;
+		signals_executed = uk_sig_handle_signals();
+
+		if (signals_executed) {
+			/*
+			 * awaited might be changed by other waiting
+			 * done while handling the signal
+			 */
+			ptr->wait.awaited = awaited_save;
+
+			/*
+			 * we might have raised / received a waiting signal
+			 * while handling the others
+			 */
+			if (uk_get_awaited_signal())
+				break;
+		}
+
+		/* block, yield */
+		uk_thread_block(uk_thread_current());
+		ptr->wait.status = UK_SIG_WAITING;
+		uk_sched_yield();
+	}
+
+	ptr->wait.status = UK_SIG_NOT_WAITING;
+
+	/* do not execute handler, set received signal */
+	*sig = ptr->wait.received_signal.si_signo;
+
+	/* execute other pending signals */
+	uk_sig_handle_signals();
+
+	return 0; /* returns positive errno */
+}
+
+/*
+ * Search for a thread that does not have the signal blocked
+ * If all of the threads have the signal blocked, add it to process
+ * pending signals
+ */
+int kill(pid_t pid, int sig)
+{
+	/*
+	 * POSIX.1 requires that if a process sends a signal to itself, and the
+	 * sending thread does not have the signal blocked, and no other thread
+	 * has it unblocked or is waiting for it in sigwait(3), at least one
+	 * unblocked signal must be delivered to the sending thread before the
+	 * kill() returns.
+	 *
+	 * FIXME: we don't implement this ^
+	 */
+
+	siginfo_t siginfo;
+	struct uk_list_head *i;
+	struct uk_thread_sig *th_sig;
+
+
+	if (pid != 1 && pid != 0 && pid != -1) {
+		errno = ESRCH;
+		return -1;
+	}
+
+	if (!uk_sig_is_valid(sig)) {
+		errno = EINVAL;
+		return -1;
+	}
+
+	/* setup siginfo */
+	uk_sig_init_siginfo(&siginfo, sig);
+
+	uk_list_for_each(i, &uk_proc_sig.thread_sig_list) {
+		th_sig = uk_list_entry(i, struct uk_thread_sig, list_node);
+
+		if (uk_deliver_proc_signal(th_sig, &siginfo) > 0)
+			return 0;
+	}
+
+	/* didn't find any thread that could accept this signal */
+	uk_add_proc_signal(&siginfo);
+
+	return 0;
+}
+
+int raise(int sig)
+{
+	return uk_sig_thread_kill(uk_thread_current(), sig);
+}
diff --git a/lib/uksignal/sigset.c b/lib/uksignal/sigset.c
new file mode 100644
index 0000000..2624e6c
--- /dev/null
+++ b/lib/uksignal/sigset.c
@@ -0,0 +1,51 @@
+/* taken from newlib */
+
+#include <errno.h>
+#include <uk/signal.h>
+
+int sigemptyset(sigset_t *set)
+{
+	uk_sigemptyset(set);
+	return 0;
+}
+
+int sigfillset(sigset_t *set)
+{
+	uk_sigfillset(set);
+	return 0;
+}
+
+int sigaddset(sigset_t *set, int signo)
+{
+	if (signo >= NSIG || signo <= 0) {
+		errno = EINVAL;
+		return -1;
+	}
+
+	uk_sigaddset(set, signo);
+	return 0;
+}
+
+int sigdelset(sigset_t *set, int signo)
+{
+	if (signo >= NSIG || signo <= 0) {
+		errno = EINVAL;
+		return -1;
+	}
+
+	uk_sigdelset(set, signo);
+	return 0;
+}
+
+int sigismember(const sigset_t *set, int signo)
+{
+	if (signo >= NSIG || signo <= 0) {
+		errno = EINVAL;
+		return -1;
+	}
+
+	if (uk_sigismember(set, signo))
+		return 1;
+	else
+		return 0;
+}
diff --git a/lib/uksignal/strsignal.c b/lib/uksignal/strsignal.c
new file mode 100644
index 0000000..b672e5f
--- /dev/null
+++ b/lib/uksignal/strsignal.c
@@ -0,0 +1,61 @@
+/* taken from newlib */
+
+#include <uk/uk_signal.h>
+
+/*
+ * TODO: not used - delete
+ */
+
+const char *sigstring[] = {
+		"Hangup",
+		"Interrupt",
+		"Quit",
+		"Illegal instruction",
+		"Trace/breakpoint trap",
+		"IOT trap",
+		"EMT trap",
+		"Floating point exception",
+		"Killed",
+		"Bus error",
+		"Segmentation fault",
+		"Bad system call",
+		"Broken pipe",
+		"Alarm clock",
+		"Terminated",
+		"Urgent I/O condition",
+		"Stopped (signal)",
+		"Stopped",
+		"Continued",
+		"Child exited",
+		"Stopped (tty input)",
+		"Stopped (tty output)",
+		"I/O possible",
+		"CPU time limit exceeded",
+		"File size limit exceeded",
+		"Virtual timer expired",
+		"Profiling timer expired",
+		"Window changed",
+		"Resource lost",
+		"User defined signal 1",
+		"User defined signal 2"
+};
+
+char *strsignal(int sig)
+{
+	char *buffer;
+	struct uk_signals_container *ptr;
+
+	ptr = _UK_TH_SIG;
+	buffer = UK_SIG_BUF(ptr);
+
+	/*
+	 * TODO: this assignment doesn't really do anything
+	 * since we return buffer, but newlibc did this
+	 */
+	if (sig <= 0 || sig >= NSIG)
+		*buffer = "Unknown signal";
+	else
+		*buffer = sigstring[sig - 1];
+
+	return buffer;
+}
diff --git a/lib/uksignal/uk_signal.c b/lib/uksignal/uk_signal.c
new file mode 100644
index 0000000..616b8f7
--- /dev/null
+++ b/lib/uksignal/uk_signal.c
@@ -0,0 +1,451 @@
+#include <errno.h>
+
+#include <uk/alloc.h>
+#include <uk/print.h>
+#include <uk/signal.h>
+#include <uk/thread.h>
+#include <uk/uk_signal.h>
+
+struct uk_proc_sig uk_proc_sig;
+
+int uk_proc_sig_init(struct uk_proc_sig *sig)
+{
+	int i;
+
+	sigemptyset(&sig->pending);
+
+	for (i = 0; i < NSIG - 1; ++i) {
+		/* TODO: set ign to the ones that should be ign */
+		sig->sigaction[i].sa_handler = SIG_DFL;
+		sigemptyset(&sig->sigaction[i].sa_mask);
+		sig->sigaction[i].sa_flags = 0;
+	}
+
+	UK_INIT_LIST_HEAD(&sig->thread_sig_list);
+	return 0;
+}
+
+int uk_thread_sig_init(struct uk_thread_sig *sig)
+{
+	sigemptyset(&sig->mask);
+
+	sig->wait.status = UK_SIG_NOT_WAITING;
+	sigemptyset(&sig->wait.awaited);
+
+	sigemptyset(&sig->pending);
+	UK_INIT_LIST_HEAD(&sig->pending_signals);
+
+	uk_list_add(&sig->list_node, &uk_proc_sig.thread_sig_list);
+	return 0;
+}
+
+void uk_thread_sig_uninit(struct uk_thread_sig *sig)
+{
+	/* Clear pending signals */
+	struct uk_list_head *i, *tmp;
+	struct uk_signal *signal;
+
+	uk_list_del(&sig->list_node);
+
+	uk_list_for_each_safe(i, tmp, &sig->pending_signals) {
+		signal = uk_list_entry(i, struct uk_signal, list_node);
+
+		uk_list_del(&signal->list_node);
+		uk_free(uk_alloc_get_default(), signal);
+	}
+}
+
+int uk_sig_handle_signals(void)
+{
+	/*
+	 * Do not run pending signals if the thread is waiting
+	 *
+	 * Iterate over pending signals
+	 * Check if the signal is blocked
+	 *
+	 * Before running the handler, remove it from pending
+	 */
+
+	int handled = 0;
+	sigset_t executable, rmask;
+	struct uk_signal *signal;
+	struct uk_thread_sig *ptr;
+
+	ptr = _UK_TH_SIG;
+
+	/*
+	 * handle_sigals will be called from
+	 * the respective waiting function
+	 */
+	if (ptr->wait.status != UK_SIG_NOT_WAITING)
+		return 0;
+
+	/* reverse mask */
+	uk_sigcopyset(&rmask, &ptr->mask);
+	uk_sigreverseset(&rmask);
+
+	/* calculate executable signals */
+	uk_sigcopyset(&executable, &rmask);
+	uk_sigandset(&executable, &ptr->pending);
+
+	while (!uk_sigisempty(&executable)) {
+		signal = uk_list_first_entry(&ptr->pending_signals, struct uk_signal, list_node);
+
+		/* move it last if it's blocked */
+		if (uk_sigismember(&ptr->mask, signal->info.si_signo)) {
+			uk_list_del(&signal->list_node);
+			uk_list_add_tail(&signal->list_node, &ptr->pending_signals);
+			continue;
+		}
+
+		/* remove from the list */
+		uk_list_del(&signal->list_node);
+
+		/* clear pending status */
+		uk_sigdelset(&ptr->pending, signal->info.si_signo);
+
+		/* execute */
+		uk_execute_handler(signal->info);
+
+		uk_free(uk_alloc_get_default(), signal);
+		handled++;
+
+		/* calculate executable signals */
+		uk_sigcopyset(&executable, &rmask);
+		uk_sigandset(&executable, &ptr->pending);
+	}
+
+	return handled;
+}
+
+/*
+ * returns:
+ *  >0 - on success
+ *  0  - if signal is ignored / already pending
+ *  <0 - on failure
+ */
+static int
+uk_deliver_signal_unmasked(struct uk_thread_sig *th_sig, siginfo_t *sig)
+{
+	struct uk_thread *tid;
+	struct uk_signal *uk_sig;
+
+	/* If the signal is ignored, we don't deliver it */
+	if (is_sig_ign(&uk_proc_sig.sigaction[sig->si_signo - 1]))
+		return 0;
+
+	/* If it is already pending, we don't deliver it */
+	if (uk_sigismember(&th_sig->pending, sig->si_signo))
+		return 0;
+
+	uk_sig = uk_malloc(uk_alloc_get_default(), sizeof(*uk_sig));
+	if (!uk_sig) {
+		uk_pr_warn("Could not allocate uk_signal");
+		return -ENOMEM;
+	}
+
+	uk_sig->info = *sig;
+	uk_list_add(&uk_sig->list_node, &th_sig->pending_signals);
+
+	uk_sigaddset(&th_sig->pending, sig->si_signo);
+
+	/* check if we need to wake the thread */
+	if (th_sig->wait.status != UK_SIG_NOT_WAITING &&
+			th_sig->wait.status != UK_SIG_WAITING_SCHED) {
+		th_sig->wait.status = UK_SIG_WAITING_SCHED;
+
+		tid = __containerof(th_sig, struct uk_thread, signals_container);
+		uk_thread_wake(tid);
+	}
+
+	return 1;
+}
+
+int uk_sig_thread_kill(struct uk_thread *tid, int sig)
+{
+	siginfo_t siginfo;
+	struct uk_signal *signal;
+	struct uk_thread_sig *ptr;
+
+	if (!uk_sig_is_valid(sig)) {
+		errno = EINVAL;
+		return -1;
+	}
+
+	ptr = &tid->signals_container;
+
+	/* setup siginfo */
+	uk_sig_init_siginfo(&siginfo, sig);
+
+	/* check if we are sending this to ourself */
+	if (&tid->signals_container == _UK_TH_SIG) {
+		/* if it's not masked just run it */
+		if (!uk_sigismember(&ptr->mask, sig)) {
+			/* remove the signal from pending */
+			signal = uk_sig_th_get_pending(ptr, sig);
+
+			if (signal) {
+				uk_list_del(&signal->list_node);
+				uk_sigdelset(&ptr->pending, sig);
+				uk_free(uk_alloc_get_default(), signal);
+			}
+
+			uk_execute_handler(siginfo);
+			return 0;
+		}
+	}
+
+	uk_deliver_signal_unmasked(ptr, &siginfo);
+
+	return 0;
+}
+
+/*
+ * Used to deliver pending signals after a mask change
+ *
+ * Since mask doesn't affect the deliverance of signals
+ * directed to threads (this is handled by uk_sig_handle_signals),
+ * we are trying to deliver only pending process signals
+ */
+static inline void uk_deliver_signals_maskchange(void)
+{
+	int i, ret;
+	sigset_t to_send;
+	struct uk_thread_sig *ptr;
+
+	ptr = _UK_TH_SIG;
+
+	uk_sigcopyset(&to_send, &ptr->mask);
+	uk_sigandset(&to_send, &uk_proc_sig.pending);
+
+	for (i = 1; i < NSIG; ++i) {
+		if (uk_sigisempty(&to_send))
+			break;
+
+		if (uk_sigismember(&to_send, i)) {
+			ret = uk_deliver_proc_signal(ptr,
+					&uk_proc_sig.pending_signals[i - 1]);
+
+			if (ret > 0) {
+				uk_remove_proc_signal(i);
+				uk_sigdelset(&to_send, i);
+			}
+		}
+	}
+}
+
+/*
+ * TODO: if we add rt sig, don't allow the
+ * two real-time sig that are used internally by the NPTL
+ * threading implementation. Also for all the functions - ignore
+ * those signals silently
+ */
+int uk_thread_sigmask(int how, const sigset_t *set, sigset_t *oldset)
+{
+	/*
+	 * running this inside a handler has no effect outside the handler
+	 * since the mask is restored in execute_handler
+	 */
+
+	sigset_t *mask, tmp;
+	struct uk_thread_sig *ptr;
+
+	ptr = _UK_TH_SIG;
+	mask = &(ptr->mask);
+
+	if (oldset)
+		*oldset = *mask;
+
+	if (set) {
+		switch (how) {
+		case SIG_BLOCK:
+			uk_sigorset(mask, set);
+			break;
+		case SIG_UNBLOCK:
+			uk_sigcopyset(&tmp, set);
+			uk_sigreverseset(&tmp);
+			uk_sigandset(mask, set);
+			break;
+		case SIG_SETMASK:
+			uk_sigcopyset(mask, set);
+			break;
+		default:
+			errno = EINVAL;
+			return -1;
+		}
+
+		uk_sigset_remove_unmaskable(mask);
+
+		/* Changed the mask, see if we can deliver any pending signals */
+		uk_deliver_signals_maskchange();
+
+		uk_sig_handle_signals();
+	}
+
+	return 0;
+}
+
+struct uk_thread_sig *uk_crr_thread_sig_container(void)
+{
+	return &(uk_thread_current()->signals_container);
+}
+
+void uk_sig_init_siginfo(siginfo_t *siginfo, int sig)
+{
+	siginfo->si_signo = sig;
+
+	/* TODO: add codes; get pid from getpid() */
+	siginfo->si_code = 0;
+	siginfo->si_pid = 1;
+}
+
+/* returns the uk_signal for sig if it is pending on thread */
+struct uk_signal *uk_sig_th_get_pending(struct uk_thread_sig *th_sig, int sig)
+{
+	struct uk_list_head *i;
+	struct uk_signal *signal;
+
+	if (!uk_sigismember(&th_sig->pending, sig))
+		return NULL;
+
+	uk_list_for_each(i, &th_sig->pending_signals) {
+		signal = uk_list_entry(i, struct uk_signal, list_node);
+
+		if (signal->info.si_signo == sig)
+			return signal;
+	}
+
+	/* NOT REACHED */
+	return NULL;
+}
+
+/* returns the siginfo for sig if it is pending on proc */
+siginfo_t *uk_sig_proc_get_pending(int sig)
+{
+	if (!uk_sigismember(&uk_proc_sig.pending, sig))
+		return NULL;
+
+	return &uk_proc_sig.pending_signals[sig - 1];
+}
+
+/*
+ * returns the uk_signal for a signal from the given
+ * set if it is pending on thread
+ */
+struct uk_signal *
+uk_sig_th_get_pending_any(struct uk_thread_sig *th_sig, sigset_t set)
+{
+	sigset_t common;
+	struct uk_list_head *i;
+	struct uk_signal *signal;
+
+	uk_sigcopyset(&common, &th_sig->pending);
+	uk_sigandset(&common, &set);
+
+	if (uk_sigisempty(&common))
+		return NULL;
+
+	uk_list_for_each(i, &th_sig->pending_signals) {
+		signal = uk_list_entry(i, struct uk_signal, list_node);
+
+		if (uk_sigismember(&common, signal->info.si_signo))
+			return signal;
+	}
+
+	/* NOT REACHED */
+	return NULL;
+}
+
+/*
+ * returns the siginfo for a signal from the given
+ * set if it is pending on proc
+ */
+siginfo_t *uk_sig_proc_get_pending_any(sigset_t set)
+{
+	int sig;
+	sigset_t common;
+
+	uk_sigcopyset(&common, &uk_proc_sig.pending);
+	uk_sigandset(&common, &set);
+
+	if (uk_sigisempty(&common))
+		return NULL;
+
+	for (sig = 1; sig < NSIG; ++sig)
+		if (uk_sigismember(&common, sig))
+			return &uk_proc_sig.pending_signals[sig - 1];
+
+	/* NOT REACHED */
+	return NULL;
+}
+
+/*
+ * returns:
+ *  >0 - on success
+ *  0  - if signal is blocked / ignored / already pending
+ *  <0 - on failure
+ */
+int
+uk_deliver_proc_signal(struct uk_thread_sig *th_sig, siginfo_t *sig)
+{
+	if (uk_sigismember(&th_sig->mask, sig->si_signo))
+		return 0;
+
+	return uk_deliver_signal_unmasked(th_sig, sig);
+}
+
+void uk_execute_handler(siginfo_t sig)
+{
+	/*
+	 * We save siginfo locally since it might change
+	 * while the handler is runnnig
+	 * For example, if we execute a waiting function inside
+	 * the handler and we were already inside a waiting function
+	 */
+
+	sigset_t tmp;
+	struct sigaction *act;
+	struct uk_thread_sig *ptr;
+
+	act = &uk_proc_sig.sigaction[sig.si_signo - 1];
+
+	/*
+	 * Check if the signal is ignored
+	 *
+	 * This should never happen since
+	 * we never deliver ignored signals
+	 */
+	if (is_sig_ign(act)) {
+		uk_pr_debug("Ignored signal %d\n",
+				sig.si_signo);
+		ukplat_crash();
+	}
+
+	/* our default handler is shutdown */
+	if (is_sig_dfl(act)) {
+		uk_pr_debug("Uncaught signal %d. Powering off.\n",
+				sig.si_signo);
+		ukplat_crash();
+	}
+
+	ptr = _UK_TH_SIG;
+
+	/* change the mask */
+	uk_sigcopyset(&tmp, &ptr->mask);
+	uk_sigorset(&ptr->mask, &act->sa_mask);
+
+	/* run the handler */
+	if (act->sa_flags & SA_SIGINFO)
+		act->sa_sigaction(sig.si_signo, &sig, NULL);
+	else
+		act->sa_handler(sig.si_signo);
+
+	/* check if we need to reset handler */
+	if (act->sa_flags & SA_RESETHAND) {
+		act->sa_flags = 0;
+		act->sa_handler = SIG_DFL;
+	}
+
+	/* restore the mask */
+	uk_sigcopyset(&ptr->mask, &tmp);
+}
diff --git a/plat/common/x86/thread_start.S b/plat/common/x86/thread_start.S
index 360ca91..a24de0f 100644
--- a/plat/common/x86/thread_start.S
+++ b/plat/common/x86/thread_start.S
@@ -26,6 +26,7 @@
  */
 /* Taken from Mini-OS arch/x86/x86_64.S */
 
+#include <uk/config.h>
 #include <uk/plat/common/sw_ctx.h>
 
 #define ENTRY(X) .globl X ; X :
@@ -55,6 +56,12 @@ ENTRY(asm_sw_ctx_switch)
 	lea .Lreturn(%rip), %rbx
 	movq %rbx, OFFSETOF_SW_CTX_IP(%rdi)       /* save EIP */
 	pushq OFFSETOF_SW_CTX_IP(%rsi)            /* restore EIP */
+
+#if CONFIG_LIBUKSIGNAL
+	/* TODO: do we need to save regs? (e.g fpu) */
+	/* stack is aligned here */
+	call uk_sig_handle_signals
+#endif
 	ret
 .Lreturn:
 	popq %r15
-- 
2.25.1



From minios-devel-bounces@lists.xenproject.org Thu Jan 14 13:11:11 2021
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Thu, 14 Jan 2021 13:11:11 +0000
Received: from list by lists.xenproject.org with outflank-mailman.66999.119235 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1l02P6-0001us-82; Thu, 14 Jan 2021 13:11:08 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 66999.119235; Thu, 14 Jan 2021 13:11: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 1l02P6-0001ul-4s; Thu, 14 Jan 2021 13:11:08 +0000
Received: by outflank-mailman (input) for mailman id 66999;
 Thu, 14 Jan 2021 13:11:07 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=00Ev=GR=gmail.com=costin.lup@srs-us1.protection.inumbo.net>)
 id 1l02P4-0001uf-Tr
 for minios-devel@lists.xenproject.org; Thu, 14 Jan 2021 13:11:07 +0000
Received: from mail-ej1-x634.google.com (unknown [2a00:1450:4864:20::634])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 23d745a0-1e93-4754-9895-0b8a41bf3db7;
 Thu, 14 Jan 2021 13:11:03 +0000 (UTC)
Received: by mail-ej1-x634.google.com with SMTP id by1so1684562ejc.0
 for <minios-devel@lists.xenproject.org>; Thu, 14 Jan 2021 05:11:03 -0800 (PST)
Received: from [192.168.1.35] ([188.27.70.237])
 by smtp.gmail.com with ESMTPSA id l22sm1985830ejk.14.2021.01.14.05.11.00
 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128);
 Thu, 14 Jan 2021 05:11: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: 23d745a0-1e93-4754-9895-0b8a41bf3db7
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:content-transfer-encoding;
        bh=5ne6FD1TGHCUUS6wIciCZgAve85cgZf5SZOyaQmFgGk=;
        b=DTbE0lwNA4qElgwK4/BUDK7OLzGEisI9T1cZfw6HTSzxPwgxjcWxltfSaehqglyVxe
         CRvrBM1c5XO7py+oETtN3pBkOyS8Saw4H50IzskK834VTRwiwz5oZ0Aj7/m/2XHpxTjE
         VEP/BRIX9c2IH7xMkGieF48BfT8ro9HpHd9c1zxnob7WTDrokBeZGKbP4DIW81fWqUze
         d9Fd+0PMiOwYUc42EBZd6kOV2kiSFONOsOg4eC7R62bAgu2Af7Rq8cDvDNn2lt/GueJr
         t7iREQ6g65cdMXZB7ks6GDnHkyy608jPDNVpN/YO30o016e/XaWvsw1nllzfg++4HAxe
         TeAQ==
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
         :content-transfer-encoding;
        bh=5ne6FD1TGHCUUS6wIciCZgAve85cgZf5SZOyaQmFgGk=;
        b=pSs9hTSlUCVbp2P78JoWcFu9KwLFvAlJBtjcuSzk2bx4y5OzEgUIID8n+ehzFQrr/F
         az1pZpKo2TvvW2THOoevIWXN9QYCuSBo9rc2J9Ol5YXG5PwumOQiB1TPistW4KEwwS2D
         y8XmLmBffRJ223lhxOQBfK62ub4Ik9eNYYZk1Vx2FDF6FTurLDOEiw5t79C1h+ZetByn
         +2RsqHAHeXYHCDhyBRz3CYHQdA5jwjDNeD+5Thjq6iiihqAzmQIgSRUSlDIvBA4nNg0+
         9CWaZd6PnLoq1W5BTjwzGKWaCt6hKG0i0djHTF0VV2Q5sjLfjIABxjRXjuBkTJwky8+M
         FRyw==
X-Gm-Message-State: AOAM531KIJiq3/fzype0LgVW8xwDjJDFVZ7o/Sy+sli7MwAQZsfVjCy1
	HHm3EYsyPPxRefIb6EfBkA7b0cHNKmdD0A==
X-Google-Smtp-Source: ABdhPJwdaJp9CkRuQcV0kCwArNtr28UOCOgnriKEph1xvMdXX5fNt3Le7SSlEtSXr81pTdD6SY3NjA==
X-Received: by 2002:a17:906:174f:: with SMTP id d15mr5214632eje.52.1610629862256;
        Thu, 14 Jan 2021 05:11:02 -0800 (PST)
Subject: Re: [UNIKRAFT PATCH 1/1] lib/uksignal: initial code
To: Bernard Rizzo <b.rizzo@student.uliege.be>,
 minios-devel@lists.xenproject.org
Cc: Felipe Huici <felipe.huici@neclab.eu>
References: <20210105193043.504160-1-b.rizzo@student.uliege.be>
 <20210105193043.504160-3-b.rizzo@student.uliege.be>
From: Costin Lupu <costin.lup@gmail.com>
Message-ID: <68cb123f-8eea-4953-6a25-e97e68afd14d@gmail.com>
Date: Thu, 14 Jan 2021 15:10:59 +0200
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101
 Thunderbird/78.6.0
MIME-Version: 1.0
In-Reply-To: <20210105193043.504160-3-b.rizzo@student.uliege.be>
Content-Type: text/plain; charset=utf-8
Content-Language: en-US
Content-Transfer-Encoding: 7bit

Hi Bernard,

These signals related changes (kernel, newlib and pthread-embedded
patches) should have Mihai Pogonaru as primary author since he was the
sole author of initial version of these changes. Consequent changes had
only rebased the patches on latest staging branches.

So please update the authorship accordingly.

Thanks,
Costin

On 1/5/21 9:30 PM, Bernard Rizzo wrote:
> uksignal provides a basic implementation of signals over Unikraft. It
> supports signals between threads and process wide signals. It provides
> all the definitions needed for signals so we must disable the
> definitions provided in libc to run it.
> 
> It does not support signal codes, rt signals and executes the signal
> handlers on the thread stack. It is also not yet integrated with our
> irqs to deliver signals like SIGSEGV.
> 
> This implementation is not complete; it is meant as a temporory
> solution until we have a proper events delivering system.
> 
> This patch is an update of the original.
> 
> Signed-off-by: Felipe Huici <felipe.huici@neclab.eu>
> Signed-off-by: Bernard Rizzo <b.rizzo@student.uliege.be>
> ---
>  lib/Makefile.uk                            |   1 +
>  lib/uksched/include/uk/thread.h            |   6 +
>  lib/uksched/sched.c                        |   7 +
>  lib/uksched/thread.c                       |   6 +
>  lib/uksignal/Config.uk                     |   7 +
>  lib/uksignal/Makefile.uk                   |   8 +
>  lib/uksignal/README                        |   7 +
>  lib/uksignal/exportsyms.uk                 |  27 ++
>  lib/uksignal/include/uk/bits/sigset.h      |  66 +++
>  lib/uksignal/include/uk/signal.h           | 131 ++++++
>  lib/uksignal/include/uk/string/strsignal.h |  19 +
>  lib/uksignal/include/uk/uk_signal.h        | 136 +++++++
>  lib/uksignal/signal.c                      | 320 +++++++++++++++
>  lib/uksignal/sigset.c                      |  51 +++
>  lib/uksignal/strsignal.c                   |  61 +++
>  lib/uksignal/uk_signal.c                   | 451 +++++++++++++++++++++
>  plat/common/x86/thread_start.S             |   7 +
>  17 files changed, 1311 insertions(+)
>  create mode 100644 lib/uksignal/Config.uk
>  create mode 100644 lib/uksignal/Makefile.uk
>  create mode 100644 lib/uksignal/README
>  create mode 100644 lib/uksignal/exportsyms.uk
>  create mode 100644 lib/uksignal/include/uk/bits/sigset.h
>  create mode 100644 lib/uksignal/include/uk/signal.h
>  create mode 100644 lib/uksignal/include/uk/string/strsignal.h
>  create mode 100644 lib/uksignal/include/uk/uk_signal.h
>  create mode 100644 lib/uksignal/signal.c
>  create mode 100644 lib/uksignal/sigset.c
>  create mode 100644 lib/uksignal/strsignal.c
>  create mode 100644 lib/uksignal/uk_signal.c
> 
> diff --git a/lib/Makefile.uk b/lib/Makefile.uk
> index 07e8a29..f50795d 100644
> --- a/lib/Makefile.uk
> +++ b/lib/Makefile.uk
> @@ -37,3 +37,4 @@ $(eval $(call _import_lib,$(CONFIG_UK_BASE)/lib/ukmmap))
>  $(eval $(call _import_lib,$(CONFIG_UK_BASE)/lib/ukblkdev))
>  $(eval $(call _import_lib,$(CONFIG_UK_BASE)/lib/posix-process))
>  $(eval $(call _import_lib,$(CONFIG_UK_BASE)/lib/uksp))
> +$(eval $(call _import_lib,$(CONFIG_UK_BASE)/lib/uksignal))
> diff --git a/lib/uksched/include/uk/thread.h b/lib/uksched/include/uk/thread.h
> index d8a4ac8..5ec25a8 100644
> --- a/lib/uksched/include/uk/thread.h
> +++ b/lib/uksched/include/uk/thread.h
> @@ -36,6 +36,9 @@
>  #include <uk/arch/lcpu.h>
>  #include <uk/arch/time.h>
>  #include <uk/plat/thread.h>
> +#if CONFIG_LIBUKSIGNAL
> +#include <uk/uk_signal.h>
> +#endif
>  #include <uk/thread_attr.h>
>  #include <uk/wait_types.h>
>  #include <uk/list.h>
> @@ -62,6 +65,9 @@ struct uk_thread {
>  #ifdef CONFIG_LIBNEWLIBC
>  	struct _reent reent;
>  #endif
> +#if CONFIG_LIBUKSIGNAL
> +	struct uk_thread_sig signals_container;
> +#endif
>  };
>  
>  UK_TAILQ_HEAD(uk_thread_list, struct uk_thread);
> diff --git a/lib/uksched/sched.c b/lib/uksched/sched.c
> index 4b8e149..5a58629 100644
> --- a/lib/uksched/sched.c
> +++ b/lib/uksched/sched.c
> @@ -42,6 +42,9 @@
>  #if CONFIG_LIBUKSCHEDCOOP
>  #include <uk/schedcoop.h>
>  #endif
> +#if CONFIG_LIBUKSIGNAL
> +#include <uk/uk_signal.h>
> +#endif
>  
>  struct uk_sched *uk_sched_head;
>  
> @@ -50,6 +53,10 @@ struct uk_sched *uk_sched_default_init(struct uk_alloc *a)
>  {
>  	struct uk_sched *s = NULL;
>  
> +#if CONFIG_LIBUKSIGNAL
> +	uk_proc_sig_init(&uk_proc_sig);
> +#endif
> +
>  #if CONFIG_LIBUKSCHEDCOOP
>  	s = uk_schedcoop_init(a);
>  #endif
> diff --git a/lib/uksched/thread.c b/lib/uksched/thread.c
> index f8ae786..609a4ce 100644
> --- a/lib/uksched/thread.c
> +++ b/lib/uksched/thread.c
> @@ -125,6 +125,9 @@ int uk_thread_init(struct uk_thread *thread,
>  #ifdef CONFIG_LIBNEWLIBC
>  	reent_init(&thread->reent);
>  #endif
> +#if CONFIG_LIBUKSIGNAL
> +	uk_thread_sig_init(&thread->signals_container);
> +#endif
>  
>  	uk_pr_info("Thread \"%s\": pointer: %p, stack: %p, tls: %p\n",
>  		   name, thread, thread->stack, thread->tls);
> @@ -135,6 +138,9 @@ int uk_thread_init(struct uk_thread *thread,
>  void uk_thread_fini(struct uk_thread *thread, struct uk_alloc *allocator)
>  {
>  	UK_ASSERT(thread != NULL);
> +#if CONFIG_LIBUKSIGNAL
> +	uk_thread_sig_uninit(&thread->signals_container);
> +#endif
>  	ukplat_thread_ctx_destroy(allocator, thread->ctx);
>  }
>  
> diff --git a/lib/uksignal/Config.uk b/lib/uksignal/Config.uk
> new file mode 100644
> index 0000000..56c1644
> --- /dev/null
> +++ b/lib/uksignal/Config.uk
> @@ -0,0 +1,7 @@
> +menuconfig LIBUKSIGNAL
> +	bool "uksignal: Unikraft signals"
> +	default n
> +	select LIBNOLIBC if !HAVE_LIBC
> +	select LIBUKDEBUG
> +	select LIBUKALLOC
> +	select LIBUKSCHED
> diff --git a/lib/uksignal/Makefile.uk b/lib/uksignal/Makefile.uk
> new file mode 100644
> index 0000000..0f1f539
> --- /dev/null
> +++ b/lib/uksignal/Makefile.uk
> @@ -0,0 +1,8 @@
> +$(eval $(call addlib_s,libuksignal,$(CONFIG_LIBUKSIGNAL)))
> +
> +CINCLUDES-$(CONFIG_LIBUKSIGNAL)     += -I$(LIBUKSIGNAL_BASE)/include
> +CXXINCLUDES-$(CONFIG_LIBUKSIGNAL)   += -I$(LIBUKSIGNAL_BASE)/include
> +
> +LIBUKSIGNAL_SRCS-y += $(LIBUKSIGNAL_BASE)/signal.c
> +LIBUKSIGNAL_SRCS-y += $(LIBUKSIGNAL_BASE)/sigset.c
> +LIBUKSIGNAL_SRCS-y += $(LIBUKSIGNAL_BASE)/uk_signal.c
> \ No newline at end of file
> diff --git a/lib/uksignal/README b/lib/uksignal/README
> new file mode 100644
> index 0000000..ff8691f
> --- /dev/null
> +++ b/lib/uksignal/README
> @@ -0,0 +1,7 @@
> +This library provides a basic implementation of signals over
> +Unikraft. It supports signals between threads and process wide
> +signals.
> +
> +It doesn't support signal codes, rt signals and executes the signal
> +handlers on the thread stack. It is also not yet integrated with our
> +irqs to deliver signals like SIGSEGV.
> \ No newline at end of file
> diff --git a/lib/uksignal/exportsyms.uk b/lib/uksignal/exportsyms.uk
> new file mode 100644
> index 0000000..dbf23fe
> --- /dev/null
> +++ b/lib/uksignal/exportsyms.uk
> @@ -0,0 +1,27 @@
> +# uk_signal.h
> +uk_proc_sig
> +
> +uk_sig_handle_signals
> +uk_proc_sig_init
> +uk_thread_sig_init
> +uk_thread_sig_uninit
> +uk_sig_thread_kill
> +uk_thread_sigmask
> +
> +# signal.h
> +sigaction
> +signal
> +sigprocmask
> +sigsuspend
> +sigpending
> +sigwait
> +kill
> +raise
> +pthread_sigmask
> +
> +# sigset.h
> +sigemptyset
> +sigfillset
> +sigaddset
> +sigdelset
> +sigismember
> \ No newline at end of file
> diff --git a/lib/uksignal/include/uk/bits/sigset.h b/lib/uksignal/include/uk/bits/sigset.h
> new file mode 100644
> index 0000000..3642633
> --- /dev/null
> +++ b/lib/uksignal/include/uk/bits/sigset.h
> @@ -0,0 +1,66 @@
> +#ifndef __UK_SIGNAL_H__
> +#error Do not include this header directly
> +#endif
> +
> +#ifndef __UK_SIGSET_H__
> +#define __UK_SIGSET_H__
> +
> +#ifdef __cplusplus
> +extern "C" {
> +#endif
> +
> +#define SIG_BLOCK     0
> +#define SIG_UNBLOCK   1
> +#define SIG_SETMASK   2
> +
> +typedef unsigned long __sigset_t;
> +typedef __sigset_t sigset_t;
> +
> +int sigemptyset(sigset_t *set);
> +int sigfillset(sigset_t *set);
> +int sigaddset(sigset_t *set, int signo);
> +int sigdelset(sigset_t *set, int signo);
> +int sigismember(const sigset_t *set, int signo);
> +
> +/* TODO: do we have gnu statement expression?  */
> +/* internal use */
> +#define uk_sigemptyset(ptr)	\
> +		do {	\
> +			*(ptr) = 0;	\
> +		} while (0)
> +#define uk_sigfillset(ptr)	\
> +		do {	\
> +			*(ptr) = ~((__sigset_t) 0);	\
> +		} while (0)
> +#define uk_sigaddset(ptr, signo)	\
> +		do {	\
> +			*(ptr) |= (1 << ((signo) - 1));	\
> +		} while (0)
> +#define uk_sigdelset(ptr, signo)	\
> +		do {	\
> +			*(ptr) &= ~(1 << ((signo) - 1));	\
> +		} while (0)
> +#define uk_sigcopyset(ptr1, ptr2)	\
> +		do {	\
> +			*(ptr1) = *(ptr2);	\
> +		} while (0)
> +#define uk_sigandset(ptr1, ptr2)	\
> +		do {	\
> +			*(ptr1) &= *(ptr2);	\
> +		} while (0)
> +#define uk_sigorset(ptr1, ptr2)	\
> +		do {	\
> +			*(ptr1) |= *(ptr2);	\
> +		} while (0)
> +#define uk_sigreverseset(ptr)	\
> +		do {	\
> +			*(ptr) = ~(*(ptr));	\
> +		} while (0)
> +#define uk_sigismember(ptr, signo) (*(ptr) & (1 << ((signo) - 1)))
> +#define uk_sigisempty(ptr) (*(ptr) == 0)
> +
> +#ifdef __cplusplus
> +}
> +#endif
> +
> +#endif /* __UK_SIGSET_H__ */
> diff --git a/lib/uksignal/include/uk/signal.h b/lib/uksignal/include/uk/signal.h
> new file mode 100644
> index 0000000..43fdabc
> --- /dev/null
> +++ b/lib/uksignal/include/uk/signal.h
> @@ -0,0 +1,131 @@
> +/* adapted from OSv */
> +#ifndef __UK_SIGNAL_H__
> +#define __UK_SIGNAL_H__
> +
> +#include <stddef.h>
> +#include <uk/bits/sigset.h>
> +
> +#ifdef __cplusplus
> +extern "C" {
> +#endif
> +
> +#define SIGHUP    1
> +#define SIGINT    2
> +#define SIGQUIT   3
> +#define SIGILL    4
> +#define SIGTRAP   5
> +#define SIGABRT   6
> +#define SIGIOT    SIGABRT
> +#define SIGBUS    7
> +#define SIGFPE    8
> +#define SIGKILL   9
> +#define SIGUSR1   10
> +#define SIGSEGV   11
> +#define SIGUSR2   12
> +#define SIGPIPE   13
> +#define SIGALRM   14
> +#define SIGTERM   15
> +#define SIGSTKFLT 16
> +#define SIGCHLD   17
> +#define SIGCONT   18
> +#define SIGSTOP   19
> +#define SIGTSTP   20
> +#define SIGTTIN   21
> +#define SIGTTOU   22
> +#define SIGURG    23
> +#define SIGXCPU   24
> +#define SIGXFSZ   25
> +#define SIGVTALRM 26
> +#define SIGPROF   27
> +#define SIGWINCH  28
> +#define SIGIO     29
> +#define SIGPOLL   29
> +#define SIGPWR    30
> +#define SIGSYS    31
> +#define SIGUNUSED SIGSYS
> +
> +#define _NSIG 32
> +
> +#define SA_NOCLDSTOP  1
> +#define SA_NOCLDWAIT  2
> +#define SA_SIGINFO    4
> +#define SA_ONSTACK    0x08000000
> +#define SA_RESTART    0x10000000
> +#define SA_NODEFER    0x40000000
> +#define SA_RESETHAND  0x80000000
> +#define SA_RESTORER   0x04000000
> +
> +typedef int pid_t;
> +typedef int sig_atomic_t;
> +
> +#define NSIG _NSIG
> +
> +typedef struct {
> +  int          si_signo;    /* Signal number */
> +  int          si_code;     /* Cause of the signal */
> +  pid_t	       si_pid;	    /* Sending process ID */
> +} siginfo_t;
> +
> +struct sigaction {
> +	union {
> +		void (*sa_handler)(int);
> +		void (*sa_sigaction)(int, siginfo_t *, void *);
> +	} __sa_handler;
> +	sigset_t sa_mask;
> +	int sa_flags;
> +	void (*sa_restorer)(void);
> +};
> +#define sa_handler   __sa_handler.sa_handler
> +#define sa_sigaction __sa_handler.sa_sigaction
> +
> +#define SIG_ERR  ((void (*)(int))-1)
> +#define SIG_DFL  ((void (*)(int)) 0)
> +#define SIG_IGN  ((void (*)(int)) 1)
> +
> +/* TODO: do we have gnu statement expression? */
> +#define is_sig_dfl(ptr)	\
> +	(!((ptr)->sa_flags & SA_SIGINFO) && (ptr)->sa_handler == SIG_DFL)
> +
> +#define is_sig_ign(ptr)	\
> +	(!((ptr)->sa_flags & SA_SIGINFO) && (ptr)->sa_handler == SIG_IGN)
> +
> +int
> +sigaction(int signum, const struct sigaction *act, struct sigaction *oldact);
> +
> +int sigpending(sigset_t *set);
> +int sigprocmask(int how, const sigset_t *set, sigset_t *oldset);
> +int sigsuspend(const sigset_t *mask);
> +int sigwait(const sigset_t *set, int *sig);
> +
> +int kill(pid_t pid, int sig);
> +int raise(int sig);
> +
> +typedef void (*sighandler_t)(int);
> +sighandler_t signal(int signum, sighandler_t handler);
> +
> +int pthread_sigmask(int how, const sigset_t *set, sigset_t *oldset);
> +
> +/* TODO: not used - defined just for newlib */
> +union sigval {
> +	int    sival_int;	/* Integer signal value */
> +	void  *sival_ptr;	/* Pointer signal value */
> +};
> +
> +struct sigevent {
> +	int              sigev_notify;	/* Notification type */
> +	int              sigev_signo;	/* Signal number */
> +	union sigval     sigev_value;	/* Signal value */
> +};
> +
> +/* TODO: not used - defined just for v8 */
> +typedef struct sigaltstack {
> +	void *ss_sp;
> +	int ss_flags;
> +	size_t ss_size;
> +} stack_t;
> +
> +#ifdef __cplusplus
> +}
> +#endif
> +
> +#endif /* __UK_SIGNAL_H__ */
> diff --git a/lib/uksignal/include/uk/string/strsignal.h b/lib/uksignal/include/uk/string/strsignal.h
> new file mode 100644
> index 0000000..73b69cb
> --- /dev/null
> +++ b/lib/uksignal/include/uk/string/strsignal.h
> @@ -0,0 +1,19 @@
> +#ifndef __UK_STRSIGNAL_H__
> +#define __UK_STRSIGNAL_H__
> +
> +/*
> + * TODO: not used - delete
> + */
> +
> +#ifdef __cplusplus
> +extern "C" {
> +#endif
> +
> +extern const char * const sys_siglist[];
> +char *strsignal(int sig);
> +
> +#ifdef __cplusplus
> +}
> +#endif
> +
> +#endif /* __UK_STRSIGNAL_H__ */
> diff --git a/lib/uksignal/include/uk/uk_signal.h b/lib/uksignal/include/uk/uk_signal.h
> new file mode 100644
> index 0000000..cb066d1
> --- /dev/null
> +++ b/lib/uksignal/include/uk/uk_signal.h
> @@ -0,0 +1,136 @@
> +#ifndef __UK_UK_SIGNAL_H__
> +#define __UK_UK_SIGNAL_H__
> +
> +#include <uk/list.h>
> +#include <uk/signal.h>
> +
> +#ifdef __cplusplus
> +extern "C" {
> +#endif
> +
> +#define _UK_TH_SIG uk_crr_thread_sig_container()
> +
> +struct uk_thread;
> +
> +struct uk_signal {
> +	siginfo_t info;
> +	struct uk_list_head list_node;
> +};
> +
> +/* TODO: add synchronization */
> +
> +struct uk_proc_sig {
> +	/* used as a bitmap for pending signals */
> +	sigset_t pending;
> +	/* pending signals - valid only if corresponding bit in pending is set */
> +	siginfo_t pending_signals[NSIG - 1];
> +	/* signal handlers for this process */
> +	struct sigaction sigaction[NSIG - 1];
> +	/* list of uk_thread_sig from the threads of the proc */
> +	struct uk_list_head thread_sig_list;
> +};
> +
> +extern struct uk_proc_sig uk_proc_sig;
> +
> +enum uk_sig_waiting {
> +	UK_SIG_NOT_WAITING = 0,
> +	UK_SIG_WAITING = 1,
> +	UK_SIG_WAITING_SCHED = 2
> +};
> +
> +struct uk_thread_sig_wait {
> +	/*
> +	 * waiting status
> +	 *
> +	 * values:
> +	 * 	UK_SIG_NOT_WAITING - thread is not waiting
> +	 * 	UK_SIG_WAITING - thread is waiting for a signal
> +	 * 	UK_SIG_WAITING_SCHED - thread is waiting to be scheduled
> +	 */
> +	enum uk_sig_waiting status;
> +	/* used as a bitmap for awaited signals */
> +	sigset_t awaited;
> +	/* awaited signal received */
> +	siginfo_t received_signal;
> +};
> +
> +struct uk_thread_sig {
> +	/* blocked signals */
> +	sigset_t mask;
> +	/* used as a bitmap for pending signals */
> +	sigset_t pending;
> +	/* list of pending signals */
> +	struct uk_list_head pending_signals;
> +	/* signal waiting state */
> +	struct uk_thread_sig_wait wait;
> +	/* node for the thread_sig_list from the proc */
> +	struct uk_list_head list_node;
> +};
> +
> +/* returns number of executed signal handlers */
> +int uk_sig_handle_signals(void);
> +
> +int uk_proc_sig_init(struct uk_proc_sig *sig);
> +int uk_thread_sig_init(struct uk_thread_sig *sig);
> +void uk_thread_sig_uninit(struct uk_thread_sig *sig);
> +
> +/* TODO: replace sched thread_kill? */
> +int uk_sig_thread_kill(struct uk_thread *tid, int sig);
> +int uk_thread_sigmask(int how, const sigset_t *set, sigset_t *oldset);
> +
> +/* internal use */
> +static inline int uk_sig_is_valid(int sig)
> +{
> +	return (sig < NSIG && sig > 0);
> +}
> +
> +static inline void uk_sigset_remove_unmaskable(sigset_t *sig)
> +{
> +	uk_sigdelset(sig, SIGKILL);
> +	uk_sigdelset(sig, SIGSTOP);
> +}
> +
> +static inline void uk_add_proc_signal(siginfo_t *sig)
> +{
> +	uk_proc_sig.pending_signals[sig->si_signo - 1] = *sig;
> +	uk_sigaddset(&uk_proc_sig.pending, sig->si_signo);
> +}
> +
> +static inline void uk_remove_proc_signal(int sig)
> +{
> +	uk_sigdelset(&uk_proc_sig.pending, sig);
> +}
> +
> +/* maybe move to sched */
> +struct uk_thread_sig *uk_crr_thread_sig_container(void);
> +void uk_sig_init_siginfo(siginfo_t *siginfo, int sig);
> +
> +/* returns the uk_signal for sig if it is pending on thread */
> +struct uk_signal *
> +uk_sig_th_get_pending(struct uk_thread_sig *th_sig, int sig);
> +
> +/* returns the siginfo for sig if it is pending on proc */
> +siginfo_t *uk_sig_proc_get_pending(int sig);
> +
> +/*
> + * returns the uk_signal for a signal from the given
> + * set if it is pending on thread
> + */
> +struct uk_signal *
> +uk_sig_th_get_pending_any(struct uk_thread_sig *th_sig, sigset_t set);
> +
> +/*
> + * returns the siginfo for a signal from the given
> + * set if it is pending on proc
> + */
> +siginfo_t *uk_sig_proc_get_pending_any(sigset_t set);
> +
> +int
> +uk_deliver_proc_signal(struct uk_thread_sig *th_sig, siginfo_t *sig);
> +void uk_execute_handler(siginfo_t sig);
> +
> +#ifdef __cplusplus
> +}
> +#endif
> +
> +#endif /* __UK_UK_SIGNAL_H__ */
> diff --git a/lib/uksignal/signal.c b/lib/uksignal/signal.c
> new file mode 100644
> index 0000000..5f5e289
> --- /dev/null
> +++ b/lib/uksignal/signal.c
> @@ -0,0 +1,320 @@
> +/* adapted from OSv */
> +
> +#include <errno.h>
> +
> +#include <uk/alloc.h>
> +#include <uk/sched.h>
> +#include <uk/signal.h>
> +#include <uk/thread.h>
> +#include <uk/uk_signal.h>
> +
> +/*
> + * Tries to deliver a pending signal to the current thread
> + * Used only with a waiting thread
> + *
> + * Returns: 0 if no signal was delivered, 1 if a signal was delivered
> + */
> +static int uk_get_awaited_signal(void)
> +{
> +	siginfo_t *siginfo;
> +	struct uk_signal *signal;
> +	struct uk_thread_sig *ptr;
> +
> +	ptr = _UK_TH_SIG;
> +
> +	/* try to deliver thread pending signal */
> +	signal = uk_sig_th_get_pending_any(ptr, ptr->wait.awaited);
> +
> +	if (signal) {
> +		/* set awaited signal */
> +		ptr->wait.received_signal = signal->info;
> +
> +		/* remove it from the list of pending signals */
> +		uk_list_del(&signal->list_node);
> +		uk_sigdelset(&ptr->pending, signal->info.si_signo);
> +		uk_free(uk_alloc_get_default(), signal);
> +		return 1;
> +	}
> +
> +	/* try to deliver process pending signal */
> +	siginfo = uk_sig_proc_get_pending_any(ptr->wait.awaited);
> +
> +	if (siginfo) {
> +		ptr->wait.received_signal = *siginfo;
> +
> +		/* remove it from the list of pending signals */
> +		uk_remove_proc_signal(siginfo->si_signo);
> +		return 1;
> +	}
> +
> +	return 0;
> +}
> +
> +/* TODO: We do not support any sa_flags besides SA_SIGINFO */
> +int
> +sigaction(int signum, const struct sigaction *act, struct sigaction *oldact)
> +{
> +	struct uk_list_head *i;
> +	struct uk_thread_sig *th_sig;
> +	struct uk_signal *signal;
> +
> +	if (!uk_sig_is_valid(signum) ||
> +			signum == SIGKILL ||
> +			signum == SIGSTOP) {
> +		errno = EINVAL;
> +		return -1;
> +	}
> +
> +	if (oldact)
> +		*oldact = uk_proc_sig.sigaction[signum - 1];
> +
> +	if (act) {
> +		/* TODO: SA_NODEFER */
> +		uk_proc_sig.sigaction[signum - 1] = *act;
> +		uk_sigaddset(&uk_proc_sig.sigaction[signum - 1].sa_mask, signum);
> +
> +		/* remove signal from where it is pending */
> +		if (is_sig_ign(act)) {
> +			/* remove it from proc */
> +			uk_remove_proc_signal(signum);
> +
> +			/* remove it from threads*/
> +			uk_list_for_each(i, &uk_proc_sig.thread_sig_list) {
> +				th_sig = uk_list_entry(i, struct uk_thread_sig, list_node);
> +
> +				signal = uk_sig_th_get_pending(th_sig, signum);
> +
> +				if (signal) {
> +					/* remove it from the list of pending signals */
> +					uk_list_del(&signal->list_node);
> +					uk_sigdelset(&th_sig->pending, signal->info.si_signo);
> +					uk_free(uk_alloc_get_default(), signal);
> +				}
> +			}
> +		}
> +	}
> +
> +	return 0;
> +}
> +
> +static sighandler_t uk_signal(int signum, sighandler_t handler, int sa_flags)
> +{
> +	struct sigaction old;
> +	struct sigaction act = {
> +		.sa_handler = handler,
> +		.sa_flags = sa_flags
> +	};
> +
> +	if (sigaction(signum, &act, &old) < 0)
> +		return SIG_ERR;
> +
> +	if (old.sa_flags & SA_SIGINFO)
> +		return NULL;
> +	else
> +		return old.sa_handler;
> +}
> +
> +sighandler_t signal(int signum, sighandler_t handler)
> +{
> +	/* SA_RESTART <- BSD signal semantics */
> +	return uk_signal(signum, handler, SA_RESTART);
> +}
> +
> +int sigpending(sigset_t *set)
> +{
> +	struct uk_thread_sig *ptr;
> +
> +	ptr = _UK_TH_SIG;
> +
> +	uk_sigcopyset(set, &ptr->pending);
> +	uk_sigorset(set, &uk_proc_sig.pending);
> +
> +	return 0;
> +}
> +
> +int sigprocmask(int how, const sigset_t *set, sigset_t *oldset)
> +{
> +	return uk_thread_sigmask(how, set, oldset);
> +}
> +
> +int pthread_sigmask(int how, const sigset_t *set, sigset_t *oldset)
> +{
> +	return uk_thread_sigmask(how, set, oldset);
> +}
> +
> +int sigsuspend(const sigset_t *mask)
> +{
> +	/* If the signals are ignored, this doesn't return <- POSIX */
> +
> +	sigset_t cleaned_mask, tmp;
> +	struct uk_thread_sig *ptr;
> +
> +	uk_sigcopyset(&cleaned_mask, mask);
> +	uk_sigset_remove_unmaskable(&cleaned_mask);
> +
> +	ptr = _UK_TH_SIG;
> +
> +	uk_sigcopyset(&ptr->wait.awaited, &cleaned_mask);
> +
> +	/* we are waiting for all the signals that aren't blocked */
> +	uk_sigreverseset(&ptr->wait.awaited);
> +
> +	/* change mask */
> +	uk_sigcopyset(&tmp, &ptr->mask);
> +	uk_sigcopyset(&ptr->mask, &cleaned_mask);
> +
> +	while (1) {
> +		/* try to deliver a pending signal */
> +		if (uk_get_awaited_signal())
> +			break;
> +
> +		/* block, yield */
> +		uk_thread_block(uk_thread_current());
> +		ptr->wait.status = UK_SIG_WAITING;
> +		uk_sched_yield();
> +	}
> +
> +	ptr->wait.status = UK_SIG_NOT_WAITING;
> +
> +	/* execute handler */
> +	uk_execute_handler(ptr->wait.received_signal);
> +
> +	/* restore mask
> +	 *
> +	 * We restore the mask here because we are technically done with
> +	 * sigsuspend and the mask must be restored at the end of sigsuspend
> +	 */
> +	uk_sigcopyset(&ptr->mask, &tmp);
> +
> +	/* execute other pending signals */
> +	uk_sig_handle_signals();
> +
> +	errno = EINTR;
> +	return -1; /* always returns -1 and sets errno to EINTR */
> +}
> +
> +int sigwait(const sigset_t *set, int *sig)
> +{
> +	/*
> +	 * If the signals are ignored, this doesn't return <- TODO: POSIX ??
> +	 *
> +	 * POSIX states that the signals in set must have been blocked before
> +	 * calling sigwait, otherwise behavior is undefined -> for us the
> +	 * behavior is not caring -> even if the signal is not blocked sigwait
> +	 * will still accept it
> +	 *
> +	 * NOTE: this function is not signal safe
> +	 */
> +
> +	int signals_executed;
> +	sigset_t cleaned_set, awaited_save;
> +	struct uk_thread_sig *ptr;
> +
> +	uk_sigcopyset(&cleaned_set, set);
> +	uk_sigset_remove_unmaskable(&cleaned_set);
> +
> +	if (uk_sigisempty(&cleaned_set))
> +		return EINVAL;
> +
> +	ptr = _UK_TH_SIG;
> +
> +	uk_sigcopyset(&ptr->wait.awaited, &cleaned_set);
> +
> +	/* save awaited signals */
> +	awaited_save = ptr->wait.awaited;
> +
> +	while (1) {
> +		if (uk_get_awaited_signal())
> +			break;
> +
> +		/*
> +		 * sigwait allows signals to be received while
> +		 * waiting so handle them
> +		 */
> +		ptr->wait.status = UK_SIG_NOT_WAITING;
> +		signals_executed = uk_sig_handle_signals();
> +
> +		if (signals_executed) {
> +			/*
> +			 * awaited might be changed by other waiting
> +			 * done while handling the signal
> +			 */
> +			ptr->wait.awaited = awaited_save;
> +
> +			/*
> +			 * we might have raised / received a waiting signal
> +			 * while handling the others
> +			 */
> +			if (uk_get_awaited_signal())
> +				break;
> +		}
> +
> +		/* block, yield */
> +		uk_thread_block(uk_thread_current());
> +		ptr->wait.status = UK_SIG_WAITING;
> +		uk_sched_yield();
> +	}
> +
> +	ptr->wait.status = UK_SIG_NOT_WAITING;
> +
> +	/* do not execute handler, set received signal */
> +	*sig = ptr->wait.received_signal.si_signo;
> +
> +	/* execute other pending signals */
> +	uk_sig_handle_signals();
> +
> +	return 0; /* returns positive errno */
> +}
> +
> +/*
> + * Search for a thread that does not have the signal blocked
> + * If all of the threads have the signal blocked, add it to process
> + * pending signals
> + */
> +int kill(pid_t pid, int sig)
> +{
> +	/*
> +	 * POSIX.1 requires that if a process sends a signal to itself, and the
> +	 * sending thread does not have the signal blocked, and no other thread
> +	 * has it unblocked or is waiting for it in sigwait(3), at least one
> +	 * unblocked signal must be delivered to the sending thread before the
> +	 * kill() returns.
> +	 *
> +	 * FIXME: we don't implement this ^
> +	 */
> +
> +	siginfo_t siginfo;
> +	struct uk_list_head *i;
> +	struct uk_thread_sig *th_sig;
> +
> +
> +	if (pid != 1 && pid != 0 && pid != -1) {
> +		errno = ESRCH;
> +		return -1;
> +	}
> +
> +	if (!uk_sig_is_valid(sig)) {
> +		errno = EINVAL;
> +		return -1;
> +	}
> +
> +	/* setup siginfo */
> +	uk_sig_init_siginfo(&siginfo, sig);
> +
> +	uk_list_for_each(i, &uk_proc_sig.thread_sig_list) {
> +		th_sig = uk_list_entry(i, struct uk_thread_sig, list_node);
> +
> +		if (uk_deliver_proc_signal(th_sig, &siginfo) > 0)
> +			return 0;
> +	}
> +
> +	/* didn't find any thread that could accept this signal */
> +	uk_add_proc_signal(&siginfo);
> +
> +	return 0;
> +}
> +
> +int raise(int sig)
> +{
> +	return uk_sig_thread_kill(uk_thread_current(), sig);
> +}
> diff --git a/lib/uksignal/sigset.c b/lib/uksignal/sigset.c
> new file mode 100644
> index 0000000..2624e6c
> --- /dev/null
> +++ b/lib/uksignal/sigset.c
> @@ -0,0 +1,51 @@
> +/* taken from newlib */
> +
> +#include <errno.h>
> +#include <uk/signal.h>
> +
> +int sigemptyset(sigset_t *set)
> +{
> +	uk_sigemptyset(set);
> +	return 0;
> +}
> +
> +int sigfillset(sigset_t *set)
> +{
> +	uk_sigfillset(set);
> +	return 0;
> +}
> +
> +int sigaddset(sigset_t *set, int signo)
> +{
> +	if (signo >= NSIG || signo <= 0) {
> +		errno = EINVAL;
> +		return -1;
> +	}
> +
> +	uk_sigaddset(set, signo);
> +	return 0;
> +}
> +
> +int sigdelset(sigset_t *set, int signo)
> +{
> +	if (signo >= NSIG || signo <= 0) {
> +		errno = EINVAL;
> +		return -1;
> +	}
> +
> +	uk_sigdelset(set, signo);
> +	return 0;
> +}
> +
> +int sigismember(const sigset_t *set, int signo)
> +{
> +	if (signo >= NSIG || signo <= 0) {
> +		errno = EINVAL;
> +		return -1;
> +	}
> +
> +	if (uk_sigismember(set, signo))
> +		return 1;
> +	else
> +		return 0;
> +}
> diff --git a/lib/uksignal/strsignal.c b/lib/uksignal/strsignal.c
> new file mode 100644
> index 0000000..b672e5f
> --- /dev/null
> +++ b/lib/uksignal/strsignal.c
> @@ -0,0 +1,61 @@
> +/* taken from newlib */
> +
> +#include <uk/uk_signal.h>
> +
> +/*
> + * TODO: not used - delete
> + */
> +
> +const char *sigstring[] = {
> +		"Hangup",
> +		"Interrupt",
> +		"Quit",
> +		"Illegal instruction",
> +		"Trace/breakpoint trap",
> +		"IOT trap",
> +		"EMT trap",
> +		"Floating point exception",
> +		"Killed",
> +		"Bus error",
> +		"Segmentation fault",
> +		"Bad system call",
> +		"Broken pipe",
> +		"Alarm clock",
> +		"Terminated",
> +		"Urgent I/O condition",
> +		"Stopped (signal)",
> +		"Stopped",
> +		"Continued",
> +		"Child exited",
> +		"Stopped (tty input)",
> +		"Stopped (tty output)",
> +		"I/O possible",
> +		"CPU time limit exceeded",
> +		"File size limit exceeded",
> +		"Virtual timer expired",
> +		"Profiling timer expired",
> +		"Window changed",
> +		"Resource lost",
> +		"User defined signal 1",
> +		"User defined signal 2"
> +};
> +
> +char *strsignal(int sig)
> +{
> +	char *buffer;
> +	struct uk_signals_container *ptr;
> +
> +	ptr = _UK_TH_SIG;
> +	buffer = UK_SIG_BUF(ptr);
> +
> +	/*
> +	 * TODO: this assignment doesn't really do anything
> +	 * since we return buffer, but newlibc did this
> +	 */
> +	if (sig <= 0 || sig >= NSIG)
> +		*buffer = "Unknown signal";
> +	else
> +		*buffer = sigstring[sig - 1];
> +
> +	return buffer;
> +}
> diff --git a/lib/uksignal/uk_signal.c b/lib/uksignal/uk_signal.c
> new file mode 100644
> index 0000000..616b8f7
> --- /dev/null
> +++ b/lib/uksignal/uk_signal.c
> @@ -0,0 +1,451 @@
> +#include <errno.h>
> +
> +#include <uk/alloc.h>
> +#include <uk/print.h>
> +#include <uk/signal.h>
> +#include <uk/thread.h>
> +#include <uk/uk_signal.h>
> +
> +struct uk_proc_sig uk_proc_sig;
> +
> +int uk_proc_sig_init(struct uk_proc_sig *sig)
> +{
> +	int i;
> +
> +	sigemptyset(&sig->pending);
> +
> +	for (i = 0; i < NSIG - 1; ++i) {
> +		/* TODO: set ign to the ones that should be ign */
> +		sig->sigaction[i].sa_handler = SIG_DFL;
> +		sigemptyset(&sig->sigaction[i].sa_mask);
> +		sig->sigaction[i].sa_flags = 0;
> +	}
> +
> +	UK_INIT_LIST_HEAD(&sig->thread_sig_list);
> +	return 0;
> +}
> +
> +int uk_thread_sig_init(struct uk_thread_sig *sig)
> +{
> +	sigemptyset(&sig->mask);
> +
> +	sig->wait.status = UK_SIG_NOT_WAITING;
> +	sigemptyset(&sig->wait.awaited);
> +
> +	sigemptyset(&sig->pending);
> +	UK_INIT_LIST_HEAD(&sig->pending_signals);
> +
> +	uk_list_add(&sig->list_node, &uk_proc_sig.thread_sig_list);
> +	return 0;
> +}
> +
> +void uk_thread_sig_uninit(struct uk_thread_sig *sig)
> +{
> +	/* Clear pending signals */
> +	struct uk_list_head *i, *tmp;
> +	struct uk_signal *signal;
> +
> +	uk_list_del(&sig->list_node);
> +
> +	uk_list_for_each_safe(i, tmp, &sig->pending_signals) {
> +		signal = uk_list_entry(i, struct uk_signal, list_node);
> +
> +		uk_list_del(&signal->list_node);
> +		uk_free(uk_alloc_get_default(), signal);
> +	}
> +}
> +
> +int uk_sig_handle_signals(void)
> +{
> +	/*
> +	 * Do not run pending signals if the thread is waiting
> +	 *
> +	 * Iterate over pending signals
> +	 * Check if the signal is blocked
> +	 *
> +	 * Before running the handler, remove it from pending
> +	 */
> +
> +	int handled = 0;
> +	sigset_t executable, rmask;
> +	struct uk_signal *signal;
> +	struct uk_thread_sig *ptr;
> +
> +	ptr = _UK_TH_SIG;
> +
> +	/*
> +	 * handle_sigals will be called from
> +	 * the respective waiting function
> +	 */
> +	if (ptr->wait.status != UK_SIG_NOT_WAITING)
> +		return 0;
> +
> +	/* reverse mask */
> +	uk_sigcopyset(&rmask, &ptr->mask);
> +	uk_sigreverseset(&rmask);
> +
> +	/* calculate executable signals */
> +	uk_sigcopyset(&executable, &rmask);
> +	uk_sigandset(&executable, &ptr->pending);
> +
> +	while (!uk_sigisempty(&executable)) {
> +		signal = uk_list_first_entry(&ptr->pending_signals, struct uk_signal, list_node);
> +
> +		/* move it last if it's blocked */
> +		if (uk_sigismember(&ptr->mask, signal->info.si_signo)) {
> +			uk_list_del(&signal->list_node);
> +			uk_list_add_tail(&signal->list_node, &ptr->pending_signals);
> +			continue;
> +		}
> +
> +		/* remove from the list */
> +		uk_list_del(&signal->list_node);
> +
> +		/* clear pending status */
> +		uk_sigdelset(&ptr->pending, signal->info.si_signo);
> +
> +		/* execute */
> +		uk_execute_handler(signal->info);
> +
> +		uk_free(uk_alloc_get_default(), signal);
> +		handled++;
> +
> +		/* calculate executable signals */
> +		uk_sigcopyset(&executable, &rmask);
> +		uk_sigandset(&executable, &ptr->pending);
> +	}
> +
> +	return handled;
> +}
> +
> +/*
> + * returns:
> + *  >0 - on success
> + *  0  - if signal is ignored / already pending
> + *  <0 - on failure
> + */
> +static int
> +uk_deliver_signal_unmasked(struct uk_thread_sig *th_sig, siginfo_t *sig)
> +{
> +	struct uk_thread *tid;
> +	struct uk_signal *uk_sig;
> +
> +	/* If the signal is ignored, we don't deliver it */
> +	if (is_sig_ign(&uk_proc_sig.sigaction[sig->si_signo - 1]))
> +		return 0;
> +
> +	/* If it is already pending, we don't deliver it */
> +	if (uk_sigismember(&th_sig->pending, sig->si_signo))
> +		return 0;
> +
> +	uk_sig = uk_malloc(uk_alloc_get_default(), sizeof(*uk_sig));
> +	if (!uk_sig) {
> +		uk_pr_warn("Could not allocate uk_signal");
> +		return -ENOMEM;
> +	}
> +
> +	uk_sig->info = *sig;
> +	uk_list_add(&uk_sig->list_node, &th_sig->pending_signals);
> +
> +	uk_sigaddset(&th_sig->pending, sig->si_signo);
> +
> +	/* check if we need to wake the thread */
> +	if (th_sig->wait.status != UK_SIG_NOT_WAITING &&
> +			th_sig->wait.status != UK_SIG_WAITING_SCHED) {
> +		th_sig->wait.status = UK_SIG_WAITING_SCHED;
> +
> +		tid = __containerof(th_sig, struct uk_thread, signals_container);
> +		uk_thread_wake(tid);
> +	}
> +
> +	return 1;
> +}
> +
> +int uk_sig_thread_kill(struct uk_thread *tid, int sig)
> +{
> +	siginfo_t siginfo;
> +	struct uk_signal *signal;
> +	struct uk_thread_sig *ptr;
> +
> +	if (!uk_sig_is_valid(sig)) {
> +		errno = EINVAL;
> +		return -1;
> +	}
> +
> +	ptr = &tid->signals_container;
> +
> +	/* setup siginfo */
> +	uk_sig_init_siginfo(&siginfo, sig);
> +
> +	/* check if we are sending this to ourself */
> +	if (&tid->signals_container == _UK_TH_SIG) {
> +		/* if it's not masked just run it */
> +		if (!uk_sigismember(&ptr->mask, sig)) {
> +			/* remove the signal from pending */
> +			signal = uk_sig_th_get_pending(ptr, sig);
> +
> +			if (signal) {
> +				uk_list_del(&signal->list_node);
> +				uk_sigdelset(&ptr->pending, sig);
> +				uk_free(uk_alloc_get_default(), signal);
> +			}
> +
> +			uk_execute_handler(siginfo);
> +			return 0;
> +		}
> +	}
> +
> +	uk_deliver_signal_unmasked(ptr, &siginfo);
> +
> +	return 0;
> +}
> +
> +/*
> + * Used to deliver pending signals after a mask change
> + *
> + * Since mask doesn't affect the deliverance of signals
> + * directed to threads (this is handled by uk_sig_handle_signals),
> + * we are trying to deliver only pending process signals
> + */
> +static inline void uk_deliver_signals_maskchange(void)
> +{
> +	int i, ret;
> +	sigset_t to_send;
> +	struct uk_thread_sig *ptr;
> +
> +	ptr = _UK_TH_SIG;
> +
> +	uk_sigcopyset(&to_send, &ptr->mask);
> +	uk_sigandset(&to_send, &uk_proc_sig.pending);
> +
> +	for (i = 1; i < NSIG; ++i) {
> +		if (uk_sigisempty(&to_send))
> +			break;
> +
> +		if (uk_sigismember(&to_send, i)) {
> +			ret = uk_deliver_proc_signal(ptr,
> +					&uk_proc_sig.pending_signals[i - 1]);
> +
> +			if (ret > 0) {
> +				uk_remove_proc_signal(i);
> +				uk_sigdelset(&to_send, i);
> +			}
> +		}
> +	}
> +}
> +
> +/*
> + * TODO: if we add rt sig, don't allow the
> + * two real-time sig that are used internally by the NPTL
> + * threading implementation. Also for all the functions - ignore
> + * those signals silently
> + */
> +int uk_thread_sigmask(int how, const sigset_t *set, sigset_t *oldset)
> +{
> +	/*
> +	 * running this inside a handler has no effect outside the handler
> +	 * since the mask is restored in execute_handler
> +	 */
> +
> +	sigset_t *mask, tmp;
> +	struct uk_thread_sig *ptr;
> +
> +	ptr = _UK_TH_SIG;
> +	mask = &(ptr->mask);
> +
> +	if (oldset)
> +		*oldset = *mask;
> +
> +	if (set) {
> +		switch (how) {
> +		case SIG_BLOCK:
> +			uk_sigorset(mask, set);
> +			break;
> +		case SIG_UNBLOCK:
> +			uk_sigcopyset(&tmp, set);
> +			uk_sigreverseset(&tmp);
> +			uk_sigandset(mask, set);
> +			break;
> +		case SIG_SETMASK:
> +			uk_sigcopyset(mask, set);
> +			break;
> +		default:
> +			errno = EINVAL;
> +			return -1;
> +		}
> +
> +		uk_sigset_remove_unmaskable(mask);
> +
> +		/* Changed the mask, see if we can deliver any pending signals */
> +		uk_deliver_signals_maskchange();
> +
> +		uk_sig_handle_signals();
> +	}
> +
> +	return 0;
> +}
> +
> +struct uk_thread_sig *uk_crr_thread_sig_container(void)
> +{
> +	return &(uk_thread_current()->signals_container);
> +}
> +
> +void uk_sig_init_siginfo(siginfo_t *siginfo, int sig)
> +{
> +	siginfo->si_signo = sig;
> +
> +	/* TODO: add codes; get pid from getpid() */
> +	siginfo->si_code = 0;
> +	siginfo->si_pid = 1;
> +}
> +
> +/* returns the uk_signal for sig if it is pending on thread */
> +struct uk_signal *uk_sig_th_get_pending(struct uk_thread_sig *th_sig, int sig)
> +{
> +	struct uk_list_head *i;
> +	struct uk_signal *signal;
> +
> +	if (!uk_sigismember(&th_sig->pending, sig))
> +		return NULL;
> +
> +	uk_list_for_each(i, &th_sig->pending_signals) {
> +		signal = uk_list_entry(i, struct uk_signal, list_node);
> +
> +		if (signal->info.si_signo == sig)
> +			return signal;
> +	}
> +
> +	/* NOT REACHED */
> +	return NULL;
> +}
> +
> +/* returns the siginfo for sig if it is pending on proc */
> +siginfo_t *uk_sig_proc_get_pending(int sig)
> +{
> +	if (!uk_sigismember(&uk_proc_sig.pending, sig))
> +		return NULL;
> +
> +	return &uk_proc_sig.pending_signals[sig - 1];
> +}
> +
> +/*
> + * returns the uk_signal for a signal from the given
> + * set if it is pending on thread
> + */
> +struct uk_signal *
> +uk_sig_th_get_pending_any(struct uk_thread_sig *th_sig, sigset_t set)
> +{
> +	sigset_t common;
> +	struct uk_list_head *i;
> +	struct uk_signal *signal;
> +
> +	uk_sigcopyset(&common, &th_sig->pending);
> +	uk_sigandset(&common, &set);
> +
> +	if (uk_sigisempty(&common))
> +		return NULL;
> +
> +	uk_list_for_each(i, &th_sig->pending_signals) {
> +		signal = uk_list_entry(i, struct uk_signal, list_node);
> +
> +		if (uk_sigismember(&common, signal->info.si_signo))
> +			return signal;
> +	}
> +
> +	/* NOT REACHED */
> +	return NULL;
> +}
> +
> +/*
> + * returns the siginfo for a signal from the given
> + * set if it is pending on proc
> + */
> +siginfo_t *uk_sig_proc_get_pending_any(sigset_t set)
> +{
> +	int sig;
> +	sigset_t common;
> +
> +	uk_sigcopyset(&common, &uk_proc_sig.pending);
> +	uk_sigandset(&common, &set);
> +
> +	if (uk_sigisempty(&common))
> +		return NULL;
> +
> +	for (sig = 1; sig < NSIG; ++sig)
> +		if (uk_sigismember(&common, sig))
> +			return &uk_proc_sig.pending_signals[sig - 1];
> +
> +	/* NOT REACHED */
> +	return NULL;
> +}
> +
> +/*
> + * returns:
> + *  >0 - on success
> + *  0  - if signal is blocked / ignored / already pending
> + *  <0 - on failure
> + */
> +int
> +uk_deliver_proc_signal(struct uk_thread_sig *th_sig, siginfo_t *sig)
> +{
> +	if (uk_sigismember(&th_sig->mask, sig->si_signo))
> +		return 0;
> +
> +	return uk_deliver_signal_unmasked(th_sig, sig);
> +}
> +
> +void uk_execute_handler(siginfo_t sig)
> +{
> +	/*
> +	 * We save siginfo locally since it might change
> +	 * while the handler is runnnig
> +	 * For example, if we execute a waiting function inside
> +	 * the handler and we were already inside a waiting function
> +	 */
> +
> +	sigset_t tmp;
> +	struct sigaction *act;
> +	struct uk_thread_sig *ptr;
> +
> +	act = &uk_proc_sig.sigaction[sig.si_signo - 1];
> +
> +	/*
> +	 * Check if the signal is ignored
> +	 *
> +	 * This should never happen since
> +	 * we never deliver ignored signals
> +	 */
> +	if (is_sig_ign(act)) {
> +		uk_pr_debug("Ignored signal %d\n",
> +				sig.si_signo);
> +		ukplat_crash();
> +	}
> +
> +	/* our default handler is shutdown */
> +	if (is_sig_dfl(act)) {
> +		uk_pr_debug("Uncaught signal %d. Powering off.\n",
> +				sig.si_signo);
> +		ukplat_crash();
> +	}
> +
> +	ptr = _UK_TH_SIG;
> +
> +	/* change the mask */
> +	uk_sigcopyset(&tmp, &ptr->mask);
> +	uk_sigorset(&ptr->mask, &act->sa_mask);
> +
> +	/* run the handler */
> +	if (act->sa_flags & SA_SIGINFO)
> +		act->sa_sigaction(sig.si_signo, &sig, NULL);
> +	else
> +		act->sa_handler(sig.si_signo);
> +
> +	/* check if we need to reset handler */
> +	if (act->sa_flags & SA_RESETHAND) {
> +		act->sa_flags = 0;
> +		act->sa_handler = SIG_DFL;
> +	}
> +
> +	/* restore the mask */
> +	uk_sigcopyset(&ptr->mask, &tmp);
> +}
> diff --git a/plat/common/x86/thread_start.S b/plat/common/x86/thread_start.S
> index 360ca91..a24de0f 100644
> --- a/plat/common/x86/thread_start.S
> +++ b/plat/common/x86/thread_start.S
> @@ -26,6 +26,7 @@
>   */
>  /* Taken from Mini-OS arch/x86/x86_64.S */
>  
> +#include <uk/config.h>
>  #include <uk/plat/common/sw_ctx.h>
>  
>  #define ENTRY(X) .globl X ; X :
> @@ -55,6 +56,12 @@ ENTRY(asm_sw_ctx_switch)
>  	lea .Lreturn(%rip), %rbx
>  	movq %rbx, OFFSETOF_SW_CTX_IP(%rdi)       /* save EIP */
>  	pushq OFFSETOF_SW_CTX_IP(%rsi)            /* restore EIP */
> +
> +#if CONFIG_LIBUKSIGNAL
> +	/* TODO: do we need to save regs? (e.g fpu) */
> +	/* stack is aligned here */
> +	call uk_sig_handle_signals
> +#endif
>  	ret
>  .Lreturn:
>  	popq %r15
> 


From minios-devel-bounces@lists.xenproject.org Thu Jan 14 14:10:54 2021
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Thu, 14 Jan 2021 14:10:54 +0000
Received: from list by lists.xenproject.org with outflank-mailman.67046.119341 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1l03Ku-0008PL-OQ; Thu, 14 Jan 2021 14:10:52 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 67046.119341; Thu, 14 Jan 2021 14: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 1l03Ku-0008PE-Kj; Thu, 14 Jan 2021 14:10:52 +0000
Received: by outflank-mailman (input) for mailman id 67046;
 Thu, 14 Jan 2021 14:10: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=bBuk=GR=gmail.com=dragosargint21@srs-us1.protection.inumbo.net>)
 id 1l03Ks-0008P9-Ru
 for minios-devel@lists.xenproject.org; Thu, 14 Jan 2021 14:10:50 +0000
Received: from mail-wm1-x32c.google.com (unknown [2a00:1450:4864:20::32c])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 46d9b429-de5e-4479-89b6-437a409a7c3f;
 Thu, 14 Jan 2021 14:10:49 +0000 (UTC)
Received: by mail-wm1-x32c.google.com with SMTP id y187so4820492wmd.3
 for <minios-devel@lists.xenproject.org>; Thu, 14 Jan 2021 06:10: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: 46d9b429-de5e-4479-89b6-437a409a7c3f
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=r6jzWLCvqLsrRtYRRooQAhlVfwPrNoTdppOM1H9uVtI=;
        b=nO28vkRH/QMNXSIU5tdODAYlb+isL3TYbemiSTAXVCH6UanF+C5FThDJdXYuCCMnVd
         QkVIvG5sjDKuBYXJMPyIs13xbe+Sr2+1Cqr2bOLkTNQYv5TzAMXUikaOyH+iugteVj/F
         G3Oy285+OTPgGom5EVkNiOtFswWgSMvd1RED2jpP2qYueDQBumWsthTsmL57Na51AY9e
         /BsoJbJ1WGPzGqkp70OZR5ZxOG1V/SMDeFeeyQzO9Skm0I81//ikF1Pc2Z+xv/6jlIDU
         WIyhcpKi7bCU/8/a7e92QAgx1LH6DJF6Scoj98EXMmteOXVLzD1vstpfUknnEtJhDO1H
         qbZA==
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=r6jzWLCvqLsrRtYRRooQAhlVfwPrNoTdppOM1H9uVtI=;
        b=cHAdPf1fQWmM9pwRK+dENOpFr2JTsUwF8A+KTEuyhiLT3CqmVPwo2fcDgdHY9BtRKB
         giPTt6mtUMmzMkZp9SoOv/zu7eV5IDPahoUgGPm2DSUArqUMv6E4Lhh4+MJdfjnt2kAt
         N4V6jRP/7celpGVU8uOqkznNpijRwfoe+lsT4Gad98TbhXoTZKvobpsa4IN3jbVIt4W4
         gjGjWjAW7SQ1stYSjosWrzXLLDG0LyRJmFEBRnJEGqAWZo1nC51qht1+YM2fvFkbgq9f
         utigO+0eXUJ/T3c8ZCZ8zYwgVeThP67Z/u1MdYwbiXZmK9S/ByU8WBLR5Om/pZ69RFV3
         AGQA==
X-Gm-Message-State: AOAM532hP+RJBVt6z+BJb+CqulBR5Vl0dCjsjlf7OZtNwedxJ3v3aCjS
	WZY3pBBivZzmcXVeu2MV3b0tEz2AmB5UH3lQUT+VXSyOcQU=
X-Google-Smtp-Source: ABdhPJx912MIN/uTNhZnNUUti89HN5/6znWmLGOQF3oSbYnBZCe7K2bB3eIHeccvx7jVSWn4zaNNjks4yknOjdf2sfk=
X-Received: by 2002:a05:600c:313:: with SMTP id q19mr4113049wmd.126.1610633448520;
 Thu, 14 Jan 2021 06:10:48 -0800 (PST)
MIME-Version: 1.0
References: <20210105193043.504160-1-b.rizzo@student.uliege.be> <20210105193043.504160-2-b.rizzo@student.uliege.be>
In-Reply-To: <20210105193043.504160-2-b.rizzo@student.uliege.be>
From: dragos argint <dragosargint21@gmail.com>
Date: Thu, 14 Jan 2021 16:10:37 +0200
Message-ID: <CANTUrU=RUmeZp+YVzC2ZR77xo-M-MDrTft6OfT9BPa4DLQwZvg@mail.gmail.com>
Subject: Re: [PTHREAD EMBEDDED PATCH 1/1] lib/pthread-embedded: Support for uksignal
To: Bernard Rizzo <b.rizzo@student.uliege.be>
Cc: minios-devel@lists.xenproject.org, Felipe Huici <felipe.huici@neclab.eu>
Content-Type: multipart/alternative; boundary="0000000000009001b505b8dcd2ac"

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

Hi Bernard,

This patch went into `minios`, not `unikraft` as it should. Can you please
resubmit it, adding the `UNIKRAFT` tag?
Thank you!

Best regards,
Dragos Argint

=C3=8En s=C3=A2m., 9 ian. 2021 la 17:33, Bernard Rizzo <b.rizzo@student.uli=
ege.be> a
scris:

> This patch is an update of the original.
>
> Signed-off-by: Felipe Huici <felipe.huici@neclab.eu>
> Signed-off-by: Bernard Rizzo <b.rizzo@student.uliege.be>
> ---
>  Makefile.uk                                   |  2 ++
>  include/pte_osal.h                            |  8 +++++++
>  include/pte_types.h                           |  8 +++++++
>  ...ead_kill_when_uk_signals_are_enabled.patch | 24 +++++++++++++++++++
>  pte_osal.c                                    | 18 ++++++++++++++
>  5 files changed, 60 insertions(+)
>  create mode 100644
> patches/0012-Add_pthread_kill_when_uk_signals_are_enabled.patch
>
> diff --git a/Makefile.uk b/Makefile.uk
> index 4ee37cd..2611c7d 100644
> --- a/Makefile.uk
> +++ b/Makefile.uk
> @@ -65,7 +65,9 @@ LIBPTHREAD-EMBEDDED_CXXFLAGS-y +=3D
> $(LIBPTHREAD-EMBEDDED_SUPPRESS_FLAGS)
>  LIBPTHREAD-EMBEDDED_SRCS-y +=3D $(LIBPTHREAD-EMBEDDED_BASE)/pte_osal.c|g=
lue
>  LIBPTHREAD-EMBEDDED_SRCS-y +=3D
> $(LIBPTHREAD-EMBEDDED_BASE)/attributes.c|glue
>  LIBPTHREAD-EMBEDDED_SRCS-y +=3D
> $(LIBPTHREAD-EMBEDDED_BASE)/pthread_atfork.c|glue
> +ifneq ($(CONFIG_LIBUKSIGNAL),y)
>  LIBPTHREAD-EMBEDDED_SRCS-y +=3D
> $(LIBPTHREAD-EMBEDDED_BASE)/pthread_sigmask.c|glue
> +endif
>  LIBPTHREAD-EMBEDDED_SRCS-y +=3D
> $(LIBPTHREAD-EMBEDDED_BASE)/pthread_condattr.c|glue
>
>
>  ########################################################################=
########
> diff --git a/include/pte_osal.h b/include/pte_osal.h
> index bcf5374..34122ea 100644
> --- a/include/pte_osal.h
> +++ b/include/pte_osal.h
> @@ -4,10 +4,18 @@
>  #include <uk/mutex.h>
>  #include <uk/semaphore.h>
>
> +#ifdef __cplusplus
> +extern "C" {
> +#endif
> +
>  typedef struct uk_thread* pte_osThreadHandle;
>  typedef struct uk_semaphore *pte_osSemaphoreHandle;
>  typedef struct uk_mutex *pte_osMutexHandle;
>
> +#ifdef __cplusplus
> +}
> +#endif
> +
>  #define OS_MAX_SIMUL_THREADS \
>         CONFIG_LIBPTHREAD_EMBEDDED_MAX_SIMUL_THREADS
>
> diff --git a/include/pte_types.h b/include/pte_types.h
> index c9081fa..817e313 100644
> --- a/include/pte_types.h
> +++ b/include/pte_types.h
> @@ -3,8 +3,16 @@
>
>  #include <sys/timeb.h>
>
> +#ifdef __cplusplus
> +extern "C" {
> +#endif
> +
>  typedef unsigned int tid_t;
>
>  typedef int pid_t;
>
> +#ifdef __cplusplus
> +}
> +#endif
> +
>  #endif /* __PTE_TYPES_H__ */
> diff --git
> a/patches/0012-Add_pthread_kill_when_uk_signals_are_enabled.patch
> b/patches/0012-Add_pthread_kill_when_uk_signals_are_enabled.patch
> new file mode 100644
> index 0000000..cf30aca
> --- /dev/null
> +++ b/patches/0012-Add_pthread_kill_when_uk_signals_are_enabled.patch
> @@ -0,0 +1,24 @@
> +diff --git a/pthread_kill.c b/pthread_kill.c
> +index 3a6daf6..4ea7448 100644
> +--- a/pthread_kill.c
> ++++ b/pthread_kill.c
> +@@ -47,7 +47,9 @@
> + #include "pthread.h"
> + #include "implement.h"
> +
> +-#ifdef __hermit__
> ++#include <uk/config.h>
> ++
> ++#if CONFIG_LIBUKSIGNAL
> + int pte_kill(pte_osThreadHandle threadId, int sig);
> + #endif
> +
> +@@ -98,7 +100,7 @@ pthread_kill (pthread_t thread, int sig)
> +
> +   pte_osMutexUnlock(pte_thread_reuse_lock);
> +
> +-#ifdef __hermit__
> ++#if CONFIG_LIBUKSIGNAL
> +   result =3D pte_kill(tp->threadId, sig);
> + #else
> +   if (0 =3D=3D result && 0 !=3D sig)
> diff --git a/pte_osal.c b/pte_osal.c
> index 640c3e4..0aac5fd 100644
> --- a/pte_osal.c
> +++ b/pte_osal.c
> @@ -103,6 +103,19 @@ out:
>         return result;
>  }
>
>
> +/***********************************************************************=
****
> + *
> + * Signal handling
> + *
> +
> *************************************************************************=
*/
> +#if CONFIG_LIBUKSIGNAL
> +int pte_kill(pte_osThreadHandle threadId, int sig)
> +{
> +       return uk_sig_thread_kill(threadId, sig);
> +}
> +#endif
> +
> +
>
>  /***********************************************************************=
*****
>   *
>   * Threads
> @@ -162,6 +175,11 @@ pte_osResult
> pte_osThreadCreate(pte_osThreadEntryPoint entry_point,
>                 return PTE_OS_NO_RESOURCES;
>         }
>
> +#if CONFIG_LIBUKSIGNAL
> +       /* inherit signal mask */
> +       ptd->uk_thread->signals_container.mask =3D
> uk_thread_current()->signals_container.mask;
> +#endif
> +
>         ptd->uk_thread->prv =3D ptd;
>
>         *ph =3D ptd->uk_thread;
> --
> 2.25.1
>
>
>

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

<div dir=3D"ltr">Hi Bernard,<div><br></div><div>This patch went into `minio=
s`, not `unikraft` as it should. Can you please resubmit it, adding=C2=A0th=
e `UNIKRAFT` tag?</div><div>Thank you!</div><div><br></div><div>Best=C2=A0r=
egards,</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., 9 ian. 2021 la 17:3=
3, Bernard Rizzo &lt;<a href=3D"mailto:b.rizzo@student.uliege.be">b.rizzo@s=
tudent.uliege.be</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">This patch is an update of the original.<br>
<br>
Signed-off-by: Felipe Huici &lt;<a href=3D"mailto:felipe.huici@neclab.eu" t=
arget=3D"_blank">felipe.huici@neclab.eu</a>&gt;<br>
Signed-off-by: Bernard Rizzo &lt;<a href=3D"mailto:b.rizzo@student.uliege.b=
e" target=3D"_blank">b.rizzo@student.uliege.be</a>&gt;<br>
---<br>
=C2=A0Makefile.uk=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0|=C2=
=A0 2 ++<br>
=C2=A0include/pte_osal.h=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 |=C2=A0 8 +++++++<br>
=C2=A0include/pte_types.h=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0|=C2=A0 8 +++++++<br>
=C2=A0...ead_kill_when_uk_signals_are_enabled.patch | 24 ++++++++++++++++++=
+<br>
=C2=A0pte_osal.c=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 | 18 +++=
+++++++++++<br>
=C2=A05 files changed, 60 insertions(+)<br>
=C2=A0create mode 100644 patches/0012-Add_pthread_kill_when_uk_signals_are_=
enabled.patch<br>
<br>
diff --git a/Makefile.uk b/Makefile.uk<br>
index 4ee37cd..2611c7d 100644<br>
--- a/Makefile.uk<br>
+++ b/Makefile.uk<br>
@@ -65,7 +65,9 @@ LIBPTHREAD-EMBEDDED_CXXFLAGS-y +=3D $(LIBPTHREAD-EMBEDDED=
_SUPPRESS_FLAGS)<br>
=C2=A0LIBPTHREAD-EMBEDDED_SRCS-y +=3D $(LIBPTHREAD-EMBEDDED_BASE)/pte_osal.=
c|glue<br>
=C2=A0LIBPTHREAD-EMBEDDED_SRCS-y +=3D $(LIBPTHREAD-EMBEDDED_BASE)/attribute=
s.c|glue<br>
=C2=A0LIBPTHREAD-EMBEDDED_SRCS-y +=3D $(LIBPTHREAD-EMBEDDED_BASE)/pthread_a=
tfork.c|glue<br>
+ifneq ($(CONFIG_LIBUKSIGNAL),y)<br>
=C2=A0LIBPTHREAD-EMBEDDED_SRCS-y +=3D $(LIBPTHREAD-EMBEDDED_BASE)/pthread_s=
igmask.c|glue<br>
+endif<br>
=C2=A0LIBPTHREAD-EMBEDDED_SRCS-y +=3D $(LIBPTHREAD-EMBEDDED_BASE)/pthread_c=
ondattr.c|glue<br>
<br>
=C2=A0#####################################################################=
###########<br>
diff --git a/include/pte_osal.h b/include/pte_osal.h<br>
index bcf5374..34122ea 100644<br>
--- a/include/pte_osal.h<br>
+++ b/include/pte_osal.h<br>
@@ -4,10 +4,18 @@<br>
=C2=A0#include &lt;uk/mutex.h&gt;<br>
=C2=A0#include &lt;uk/semaphore.h&gt;<br>
<br>
+#ifdef __cplusplus<br>
+extern &quot;C&quot; {<br>
+#endif<br>
+<br>
=C2=A0typedef struct uk_thread* pte_osThreadHandle;<br>
=C2=A0typedef struct uk_semaphore *pte_osSemaphoreHandle;<br>
=C2=A0typedef struct uk_mutex *pte_osMutexHandle;<br>
<br>
+#ifdef __cplusplus<br>
+}<br>
+#endif<br>
+<br>
=C2=A0#define OS_MAX_SIMUL_THREADS \<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 CONFIG_LIBPTHREAD_EMBEDDED_MAX_SIMUL_THREADS<br=
>
<br>
diff --git a/include/pte_types.h b/include/pte_types.h<br>
index c9081fa..817e313 100644<br>
--- a/include/pte_types.h<br>
+++ b/include/pte_types.h<br>
@@ -3,8 +3,16 @@<br>
<br>
=C2=A0#include &lt;sys/timeb.h&gt;<br>
<br>
+#ifdef __cplusplus<br>
+extern &quot;C&quot; {<br>
+#endif<br>
+<br>
=C2=A0typedef unsigned int tid_t;<br>
<br>
=C2=A0typedef int pid_t;<br>
<br>
+#ifdef __cplusplus<br>
+}<br>
+#endif<br>
+<br>
=C2=A0#endif /* __PTE_TYPES_H__ */<br>
diff --git a/patches/0012-Add_pthread_kill_when_uk_signals_are_enabled.patc=
h b/patches/0012-Add_pthread_kill_when_uk_signals_are_enabled.patch<br>
new file mode 100644<br>
index 0000000..cf30aca<br>
--- /dev/null<br>
+++ b/patches/0012-Add_pthread_kill_when_uk_signals_are_enabled.patch<br>
@@ -0,0 +1,24 @@<br>
+diff --git a/pthread_kill.c b/pthread_kill.c<br>
+index 3a6daf6..4ea7448 100644<br>
+--- a/pthread_kill.c<br>
++++ b/pthread_kill.c<br>
+@@ -47,7 +47,9 @@<br>
+ #include &quot;pthread.h&quot;<br>
+ #include &quot;implement.h&quot;<br>
+<br>
+-#ifdef __hermit__<br>
++#include &lt;uk/config.h&gt;<br>
++<br>
++#if CONFIG_LIBUKSIGNAL<br>
+ int pte_kill(pte_osThreadHandle threadId, int sig);<br>
+ #endif<br>
+<br>
+@@ -98,7 +100,7 @@ pthread_kill (pthread_t thread, int sig)<br>
+<br>
+=C2=A0 =C2=A0pte_osMutexUnlock(pte_thread_reuse_lock);<br>
+<br>
+-#ifdef __hermit__<br>
++#if CONFIG_LIBUKSIGNAL<br>
+=C2=A0 =C2=A0result =3D pte_kill(tp-&gt;threadId, sig);<br>
+ #else<br>
+=C2=A0 =C2=A0if (0 =3D=3D result &amp;&amp; 0 !=3D sig)<br>
diff --git a/pte_osal.c b/pte_osal.c<br>
index 640c3e4..0aac5fd 100644<br>
--- a/pte_osal.c<br>
+++ b/pte_osal.c<br>
@@ -103,6 +103,19 @@ out:<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 return result;<br>
=C2=A0}<br>
<br>
+/*************************************************************************=
**<br>
+ *<br>
+ * Signal handling<br>
+ *<br>
+ *************************************************************************=
*/<br>
+#if CONFIG_LIBUKSIGNAL<br>
+int pte_kill(pte_osThreadHandle threadId, int sig)<br>
+{<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0return uk_sig_thread_kill(threadId, sig);<br>
+}<br>
+#endif<br>
+<br>
+<br>
=C2=A0/********************************************************************=
********<br>
=C2=A0 *<br>
=C2=A0 * Threads<br>
@@ -162,6 +175,11 @@ pte_osResult pte_osThreadCreate(pte_osThreadEntryPoint=
 entry_point,<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 return PTE_OS_NO_RE=
SOURCES;<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 }<br>
<br>
+#if CONFIG_LIBUKSIGNAL<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0/* inherit signal mask */<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0ptd-&gt;uk_thread-&gt;signals_container.mask =
=3D uk_thread_current()-&gt;signals_container.mask;<br>
+#endif<br>
+<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 ptd-&gt;uk_thread-&gt;prv =3D ptd;<br>
<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 *ph =3D ptd-&gt;uk_thread;<br>
-- <br>
2.25.1<br>
<br>
<br>
</blockquote></div>

--0000000000009001b505b8dcd2ac--


From minios-devel-bounces@lists.xenproject.org Thu Jan 14 14:12:01 2021
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Thu, 14 Jan 2021 14:12:01 +0000
Received: from list by lists.xenproject.org with outflank-mailman.67047.119345 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1l03Lz-0008R2-SA; Thu, 14 Jan 2021 14:11:59 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 67047.119345; Thu, 14 Jan 2021 14:11: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 1l03Lz-0008Qv-PD; Thu, 14 Jan 2021 14:11:59 +0000
Received: by outflank-mailman (input) for mailman id 67047;
 Thu, 14 Jan 2021 14:11: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=bBuk=GR=gmail.com=dragosargint21@srs-us1.protection.inumbo.net>)
 id 1l03Ly-0008Qq-KY
 for minios-devel@lists.xenproject.org; Thu, 14 Jan 2021 14:11:58 +0000
Received: from mail-wm1-x32b.google.com (unknown [2a00:1450:4864:20::32b])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 47b197d4-ecc7-471b-96ec-61809925a4eb;
 Thu, 14 Jan 2021 14:11:57 +0000 (UTC)
Received: by mail-wm1-x32b.google.com with SMTP id h17so4464324wmq.1
 for <minios-devel@lists.xenproject.org>; Thu, 14 Jan 2021 06:11: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: 47b197d4-ecc7-471b-96ec-61809925a4eb
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=tee4I49/t3QYVxV5Q7trZsvLttSW1jUk349W/pIPQ0U=;
        b=V0s/g6tVI/FPhKAc6GCvu6JSKSo8K8DoUsdK98nrp3v6SvR6WJQjl0cZP0l4g+rCtC
         ZTdfLfOLoMDQIZrNpc5l+xwgnkJ5YRP5FY68wkSRlXnWV/SaRO1MFGw0FE6LYci8a4J5
         0NkbKDXiMypO5aIelgHPHd5VoTeZvkJjaEqXkQ8cdsur9PuFDUMfYZpK4I2KF3rJZp8J
         onxN+X8DoLC/P/fRVcKvYY7/e/GAKVT8bQOFdG6YXfB1t2l+qgQIGzBrBE+fLhR3fUv3
         6gfgj1HF9mN779xJw+S+vQus3ZDsJsf7n7og9uLSvC0c3lP3nLltrRWEvDlM0kEOAmP5
         +DcQ==
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=tee4I49/t3QYVxV5Q7trZsvLttSW1jUk349W/pIPQ0U=;
        b=BlX3cVm1hjZ9TM7yPWI9V+2HY6EmxeR6LA5KYGYLfTkpaa0KNWlsyxoxpSPspc5Ukp
         ABXzmzV07/rhhUo6jDNCWbSBp0GM5jQXA+dSCM8ZgCZ0beP93lj/D7mi0nuUQkPjKXIb
         MJWuGHuCZfSpI3uvtFZ0xEOT1GqaQMGwpJUwW5vrylMBvimsiOVnkT6eQC28j1YgKos1
         9pJZMxJF6cDSDVLgkFXGbeK54p06hSb0yxU8Fg+B76AqSLDNNeb0hXRrteNpk+S5SCzS
         YXrQFlMKQ/pdakG1cJiIIn2tvQS1CsFevZJlz3PRKH/BOPp/PREzNzsZg+3DopVNqYQH
         DQOA==
X-Gm-Message-State: AOAM531c7PuKi0Rbw9XbK5DK9YvwzM/Vqv2GehZL9GEOA/hmgZGPf4cP
	ykT7ys+TJNmgh9QUX4wR98W6YcVPjZOeAwIGgXo=
X-Google-Smtp-Source: ABdhPJwFi89Sn1xQUtoQR6B/OEpVKrL1pzNvndsvY67TC1XXI0m99nFP+Edm1gWbLgy8LyKHhMFl3ARmWhXDk3PtHJY=
X-Received: by 2002:a1c:9acb:: with SMTP id c194mr4083164wme.43.1610633516442;
 Thu, 14 Jan 2021 06:11:56 -0800 (PST)
MIME-Version: 1.0
References: <20210105193043.504160-1-b.rizzo@student.uliege.be>
In-Reply-To: <20210105193043.504160-1-b.rizzo@student.uliege.be>
From: dragos argint <dragosargint21@gmail.com>
Date: Thu, 14 Jan 2021 16:11:45 +0200
Message-ID: <CANTUrUkUMBxWcDjzKpDM+z3zGFCF+hScnCDA9mGCcvQuBf2Bjw@mail.gmail.com>
Subject: Re: [NEWLIB PATCH 1/1] lib/newlib: Support for uksignal
To: Bernard Rizzo <b.rizzo@student.uliege.be>
Cc: minios-devel@lists.xenproject.org, Felipe Huici <felipe.huici@neclab.eu>
Content-Type: multipart/alternative; boundary="0000000000009c669e05b8dcd616"

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

Hi Bernard,

This patch went into `minios`, not `unikraft` as it should. Can you please
resubmit it, adding the `UNIKRAFT` tag?
Thank you!

Best regards,
Dragos Argint

=C3=8En s=C3=A2m., 9 ian. 2021 la 17:33, Bernard Rizzo <b.rizzo@student.uli=
ege.be> a
scris:

> This patch is an update of the original.
>
> Signed-off-by: Felipe Huici <felipe.huici@neclab.eu>
> Signed-off-by: Bernard Rizzo <b.rizzo@student.uliege.be>
> ---
>  Makefile.uk      |  4 ++++
>  include/signal.h | 11 +++++++++++
>  plat.c           |  8 --------
>  signal.c         | 50 +++++++++++++++++-------------------------------
>  4 files changed, 33 insertions(+), 40 deletions(-)
>  create mode 100644 include/signal.h
>
> diff --git a/Makefile.uk b/Makefile.uk
> index 82836e4..bb3b65f 100644
> --- a/Makefile.uk
> +++ b/Makefile.uk
> @@ -136,7 +136,9 @@ LIBNEWLIBGLUE_SRCS-y +=3D $(LIBNEWLIBC_BASE)/resource=
.c
>  LIBNEWLIBGLUE_SRCS-y +=3D $(LIBNEWLIBC_BASE)/pty.c
>  LIBNEWLIBGLUE_SRCS-y +=3D $(LIBNEWLIBC_BASE)/locale.c
>  LIBNEWLIBGLUE_SRCS-y +=3D $(LIBNEWLIBC_BASE)/dev.c
> +ifneq ($(CONFIG_LIBUKSIGNAL),y)
>  LIBNEWLIBGLUE_SRCS-y +=3D $(LIBNEWLIBC_BASE)/signal.c
> +endif
>  LIBNEWLIBGLUE_SRCS-y +=3D $(LIBNEWLIBC_BASE)/link.c
>  LIBNEWLIBGLUE_SRCS-y +=3D $(LIBNEWLIBC_BASE)/mntent.c
>  LIBNEWLIBGLUE_SRCS-y +=3D $(LIBNEWLIBC_BASE)/syscall.c
> @@ -414,9 +416,11 @@ LIBNEWLIBC_SRCS-y +=3D
> $(LIBNEWLIB_LIBC)/search/bsd_qsort_r.c
>
>  ########################################################################=
########
>  # Newlib/libc code -- signal
>
>  ########################################################################=
########
> +ifneq ($(CONFIG_LIBUKSIGNAL),y)
>  LIBNEWLIBC_SRCS-y +=3D $(LIBNEWLIB_LIBC)/signal/psignal.c
>  LIBNEWLIBC_SRCS-y +=3D $(LIBNEWLIB_LIBC)/signal/raise.c
>  LIBNEWLIBC_SRCS-y +=3D $(LIBNEWLIB_LIBC)/signal/signal.c
> +endif
>
>
>  ########################################################################=
########
>  # Newlib/libc code -- stdio
> diff --git a/include/signal.h b/include/signal.h
> new file mode 100644
> index 0000000..778dec1
> --- /dev/null
> +++ b/include/signal.h
> @@ -0,0 +1,11 @@
> +#ifndef _NEWLIB_GLUE_SIGNAL_H_
> +#define _NEWLIB_GLUE_SIGNAL_H_
> +#include <uk/config.h>
> +
> +#if CONFIG_LIBUKSIGNAL
> +#include <uk/signal.h>
> +#else
> +#include_next <signal.h>
> +#endif
> +
> +#endif /* _NEWLIB_GLUE_SIGNAL_H_ */
> diff --git a/plat.c b/plat.c
> index df07dce..2a12801 100644
> --- a/plat.c
> +++ b/plat.c
> @@ -47,14 +47,6 @@ int getentropy(void *buf __unused, size_t buflen
> __unused)
>         return -1;
>  }
>
> -int sigprocmask(int how __unused, const sigset_t *set __unused,
> -               sigset_t *oldset __unused)
> -{
> -       /* TODO: implement. */
> -       errno =3D ENOTSUP;
> -       return -1;
> -}
> -
>  #include <uk/plat/bootstrap.h>
>
>  void abort(void)
> diff --git a/signal.c b/signal.c
> index 4279ee7..1f6cae3 100644
> --- a/signal.c
> +++ b/signal.c
> @@ -37,51 +37,37 @@
>  #include <errno.h>
>  #include <signal.h>
>
> +int kill(int pid __unused, int sig __unused)
> +{
> +       errno =3D EINVAL;
> +       return -1;
> +}
> +
>  int sigaction(int sig __unused, const struct sigaction *restrict act
> __unused,
> -             struct sigaction *restrict oact __unused)
> +            struct sigaction *restrict oact __unused)
>  {
>         return 0;
>  }
> -
> +
> +int sigprocmask(int how __unused, const sigset_t *set __unused,
> +                               sigset_t *oldset __unused)
> +{
> +       /* TODO: implement. */
> +       errno =3D ENOTSUP;
> +       return -1;
> +}
> +
>  unsigned int alarm(unsigned int seconds __unused)
>  {
>         return 0;
>  }
> -
> +
>  int pause(void)
>  {
>         return 0;
>  }
> -
> +
>  int siginterrupt(int sig __unused, int flag __unused)
>  {
>         return 0;
>  }
> -
> -int sigsuspend(const sigset_t *mask)
> -{
> -       return 0;
> -}
> -
> -int kill(int pid, int sig __unused)
> -{
> -       /* TODO check sig */
> -       if (pid !=3D UNIKRAFT_PID)
> -               errno =3D ESRCH;
> -       return -1;
> -}
> -
> -int killpg(int pgrp, int sig __unused)
> -{
> -       /* TODO check sig */
> -       if (pgrp !=3D UNIKRAFT_PGID)
> -               errno =3D ESRCH;
> -       return -1;
> -}
> -
> -int sigaltstack(const stack_t *ss, stack_t *old_ss)
> -{
> -       WARN_STUBBED();
> -       errno =3D ENOTSUP;
> -       return -1;
> -}
> --
> 2.25.1
>
>
>

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

<div dir=3D"ltr">Hi Bernard,<div><br></div><div>This patch went into `minio=
s`, not `unikraft` as it should. Can you please resubmit it, adding=C2=A0th=
e `UNIKRAFT` tag?</div><div>Thank you!</div><div><br></div><div>Best=C2=A0r=
egards,</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., 9 ian. 2021 la 17:3=
3, Bernard Rizzo &lt;<a href=3D"mailto:b.rizzo@student.uliege.be">b.rizzo@s=
tudent.uliege.be</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">This patch is an update of the original.<br>
<br>
Signed-off-by: Felipe Huici &lt;<a href=3D"mailto:felipe.huici@neclab.eu" t=
arget=3D"_blank">felipe.huici@neclab.eu</a>&gt;<br>
Signed-off-by: Bernard Rizzo &lt;<a href=3D"mailto:b.rizzo@student.uliege.b=
e" target=3D"_blank">b.rizzo@student.uliege.be</a>&gt;<br>
---<br>
=C2=A0Makefile.uk=C2=A0 =C2=A0 =C2=A0 |=C2=A0 4 ++++<br>
=C2=A0include/signal.h | 11 +++++++++++<br>
=C2=A0plat.c=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0|=C2=A0 8 --------<br>
=C2=A0signal.c=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0| 50 +++++++++++++++++-----=
--------------------------<br>
=C2=A04 files changed, 33 insertions(+), 40 deletions(-)<br>
=C2=A0create mode 100644 include/signal.h<br>
<br>
diff --git a/Makefile.uk b/Makefile.uk<br>
index 82836e4..bb3b65f 100644<br>
--- a/Makefile.uk<br>
+++ b/Makefile.uk<br>
@@ -136,7 +136,9 @@ LIBNEWLIBGLUE_SRCS-y +=3D $(LIBNEWLIBC_BASE)/resource.c=
<br>
=C2=A0LIBNEWLIBGLUE_SRCS-y +=3D $(LIBNEWLIBC_BASE)/pty.c<br>
=C2=A0LIBNEWLIBGLUE_SRCS-y +=3D $(LIBNEWLIBC_BASE)/locale.c<br>
=C2=A0LIBNEWLIBGLUE_SRCS-y +=3D $(LIBNEWLIBC_BASE)/dev.c<br>
+ifneq ($(CONFIG_LIBUKSIGNAL),y)<br>
=C2=A0LIBNEWLIBGLUE_SRCS-y +=3D $(LIBNEWLIBC_BASE)/signal.c<br>
+endif<br>
=C2=A0LIBNEWLIBGLUE_SRCS-y +=3D $(LIBNEWLIBC_BASE)/link.c<br>
=C2=A0LIBNEWLIBGLUE_SRCS-y +=3D $(LIBNEWLIBC_BASE)/mntent.c<br>
=C2=A0LIBNEWLIBGLUE_SRCS-y +=3D $(LIBNEWLIBC_BASE)/syscall.c<br>
@@ -414,9 +416,11 @@ LIBNEWLIBC_SRCS-y +=3D $(LIBNEWLIB_LIBC)/search/bsd_qs=
ort_r.c<br>
=C2=A0#####################################################################=
###########<br>
=C2=A0# Newlib/libc code -- signal<br>
=C2=A0#####################################################################=
###########<br>
+ifneq ($(CONFIG_LIBUKSIGNAL),y)<br>
=C2=A0LIBNEWLIBC_SRCS-y +=3D $(LIBNEWLIB_LIBC)/signal/psignal.c<br>
=C2=A0LIBNEWLIBC_SRCS-y +=3D $(LIBNEWLIB_LIBC)/signal/raise.c<br>
=C2=A0LIBNEWLIBC_SRCS-y +=3D $(LIBNEWLIB_LIBC)/signal/signal.c<br>
+endif<br>
<br>
=C2=A0#####################################################################=
###########<br>
=C2=A0# Newlib/libc code -- stdio<br>
diff --git a/include/signal.h b/include/signal.h<br>
new file mode 100644<br>
index 0000000..778dec1<br>
--- /dev/null<br>
+++ b/include/signal.h<br>
@@ -0,0 +1,11 @@<br>
+#ifndef _NEWLIB_GLUE_SIGNAL_H_<br>
+#define _NEWLIB_GLUE_SIGNAL_H_<br>
+#include &lt;uk/config.h&gt;<br>
+<br>
+#if CONFIG_LIBUKSIGNAL<br>
+#include &lt;uk/signal.h&gt;<br>
+#else<br>
+#include_next &lt;signal.h&gt;<br>
+#endif<br>
+<br>
+#endif /* _NEWLIB_GLUE_SIGNAL_H_ */<br>
diff --git a/plat.c b/plat.c<br>
index df07dce..2a12801 100644<br>
--- a/plat.c<br>
+++ b/plat.c<br>
@@ -47,14 +47,6 @@ int getentropy(void *buf __unused, size_t buflen __unuse=
d)<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 return -1;<br>
=C2=A0}<br>
<br>
-int sigprocmask(int how __unused, const sigset_t *set __unused,<br>
-=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0sigset_t *oldset __=
unused)<br>
-{<br>
-=C2=A0 =C2=A0 =C2=A0 =C2=A0/* TODO: implement. */<br>
-=C2=A0 =C2=A0 =C2=A0 =C2=A0errno =3D ENOTSUP;<br>
-=C2=A0 =C2=A0 =C2=A0 =C2=A0return -1;<br>
-}<br>
-<br>
=C2=A0#include &lt;uk/plat/bootstrap.h&gt;<br>
<br>
=C2=A0void abort(void)<br>
diff --git a/signal.c b/signal.c<br>
index 4279ee7..1f6cae3 100644<br>
--- a/signal.c<br>
+++ b/signal.c<br>
@@ -37,51 +37,37 @@<br>
=C2=A0#include &lt;errno.h&gt;<br>
=C2=A0#include &lt;signal.h&gt;<br>
<br>
+int kill(int pid __unused, int sig __unused)<br>
+{<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0errno =3D EINVAL;<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0return -1;<br>
+}<br>
+<br>
=C2=A0int sigaction(int sig __unused, const struct sigaction *restrict act =
__unused,<br>
-=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0struct sigaction *restrict=
 oact __unused)<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 struct sigaction *restrict oact =
__unused)<br>
=C2=A0{<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 return 0;<br>
=C2=A0}<br>
-<br>
+<br>
+int sigprocmask(int how __unused, const sigset_t *set __unused,<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=A0sigset_t *oldset __unused)<br>
+{<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0/* TODO: implement. */<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0errno =3D ENOTSUP;<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0return -1;<br>
+}<br>
+<br>
=C2=A0unsigned int alarm(unsigned int seconds __unused)<br>
=C2=A0{<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 return 0;<br>
=C2=A0}<br>
-<br>
+<br>
=C2=A0int pause(void)<br>
=C2=A0{<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 return 0;<br>
=C2=A0}<br>
-<br>
+<br>
=C2=A0int siginterrupt(int sig __unused, int flag __unused)<br>
=C2=A0{<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 return 0;<br>
=C2=A0}<br>
-<br>
-int sigsuspend(const sigset_t *mask)<br>
-{<br>
-=C2=A0 =C2=A0 =C2=A0 =C2=A0return 0;<br>
-}<br>
-<br>
-int kill(int pid, int sig __unused)<br>
-{<br>
-=C2=A0 =C2=A0 =C2=A0 =C2=A0/* TODO check sig */<br>
-=C2=A0 =C2=A0 =C2=A0 =C2=A0if (pid !=3D UNIKRAFT_PID)<br>
-=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0errno =3D ESRCH;<br=
>
-=C2=A0 =C2=A0 =C2=A0 =C2=A0return -1;<br>
-}<br>
-<br>
-int killpg(int pgrp, int sig __unused)<br>
-{<br>
-=C2=A0 =C2=A0 =C2=A0 =C2=A0/* TODO check sig */<br>
-=C2=A0 =C2=A0 =C2=A0 =C2=A0if (pgrp !=3D UNIKRAFT_PGID)<br>
-=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0errno =3D ESRCH;<br=
>
-=C2=A0 =C2=A0 =C2=A0 =C2=A0return -1;<br>
-}<br>
-<br>
-int sigaltstack(const stack_t *ss, stack_t *old_ss)<br>
-{<br>
-=C2=A0 =C2=A0 =C2=A0 =C2=A0WARN_STUBBED();<br>
-=C2=A0 =C2=A0 =C2=A0 =C2=A0errno =3D ENOTSUP;<br>
-=C2=A0 =C2=A0 =C2=A0 =C2=A0return -1;<br>
-}<br>
-- <br>
2.25.1<br>
<br>
<br>
</blockquote></div>

--0000000000009c669e05b8dcd616--


From minios-devel-bounces@lists.xenproject.org Sat Jan 16 01:12:29 2021
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Sat, 16 Jan 2021 01:12:29 +0000
Received: from list by lists.xenproject.org with outflank-mailman.68880.123436 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1l0a8h-0000Kt-34; Sat, 16 Jan 2021 01:12:27 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 68880.123436; Sat, 16 Jan 2021 01:12: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 1l0a8h-0000Km-0A; Sat, 16 Jan 2021 01:12:27 +0000
Received: by outflank-mailman (input) for mailman id 68880;
 Sat, 16 Jan 2021 01:12: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=8vDg=GT=student.uliege.be=b.rizzo@srs-us1.protection.inumbo.net>)
 id 1l0a8g-0000Kh-2G
 for minios-devel@lists.xenproject.org; Sat, 16 Jan 2021 01:12:26 +0000
Received: from serv108.segi.ulg.ac.be (unknown [139.165.32.111])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id bf711646-7aaf-48a7-9ac6-bc1a6352b3d8;
 Sat, 16 Jan 2021 01:12:21 +0000 (UTC)
Received: from Berni.home (unknown [91.182.172.238])
 (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
 (No client certificate requested)
 by serv108.segi.ulg.ac.be (Postfix) with ESMTPSA id 3528A200DFAB;
 Sat, 16 Jan 2021 02:12:20 +0100 (CET)
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: bf711646-7aaf-48a7-9ac6-bc1a6352b3d8
DKIM-Filter: OpenDKIM Filter v2.11.0 serv108.segi.ulg.ac.be 3528A200DFAB
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=uliege.be;
	s=ulg20190529; t=1610759540;
	bh=Wiy8TFTy3CNw4Jalxs01ARCQdiEGtcMu6W+Rs5iLOKs=;
	h=From:To:Cc:Subject:Date:From;
	b=cTqZN5vQjfVuRa4BY6cVMX/DCI8OTYO3kvQG0kKYC3xCtsKoF6pxSOwF1X4/vaupo
	 mZvyHXn+fJRTsWmBNWF6LYS29KCToju6mfQUURU35G68ImJ1En6E7HSKX57KLDeqKF
	 PZV3ngdZC5Xt2ziO5cubpCkjfxXVxCLUoUEKHhMHTAvgCYjyUYAfQfeu5e6tQyOkrL
	 W/rs29lVxZg1UmJ/g6/wVrluCJEHkPIHQY6g+L1eIbxd8wcuxhtTVAN0Yu5lDn7KtO
	 0QEBtVMehk5HYA9gpgx8vR650BVYxAgEktGOCxNx36aFCCH4HYY7kIbfo8EUYrGuMm
	 VetQyhrR67UPw==
From: Bernard Rizzo <b.rizzo@student.uliege.be>
To: minios-devel@lists.xenproject.org
Cc: Bernard Rizzo <b.rizzo@student.uliege.be>,
	Mihai Pogonaru <pogonarumihai@gmail.com>,
	Teodora Serbanescu <teo.serbanescu16@gmail.com>,
	Felipe Huici <felipe.huici@neclab.eu>
Subject: [UNIKRAFT PATCH 1/1] lib/uksignal: initial code
Date: Sat, 16 Jan 2021 02:12:07 +0100
Message-Id: <20210116011207.307983-1-b.rizzo@student.uliege.be>
X-Mailer: git-send-email 2.25.1
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit

uksignal provides a basic implementation of signals over Unikraft. It
supports signals between threads and process wide signals. It provides
all the definitions needed for signals so we must disable the
definitions provided in libc to run it.

It does not support signal codes, rt signals and executes the signal
handlers on the thread stack. It is also not yet integrated with our
irqs to deliver signals like SIGSEGV.

This implementation is not complete; it is meant as a temporory
solution until we have a proper events delivering system.

This patch is an update of the original.

Signed-off-by: Mihai Pogonaru <pogonarumihai@gmail.com>
Signed-off-by: Teodora Serbanescu <teo.serbanescu16@gmail.com>
Signed-off-by: Felipe Huici <felipe.huici@neclab.eu>
Signed-off-by: Bernard Rizzo <b.rizzo@student.uliege.be>
---
 lib/Makefile.uk                            |   1 +
 lib/uksched/include/uk/thread.h            |   6 +
 lib/uksched/sched.c                        |   7 +
 lib/uksched/thread.c                       |   6 +
 lib/uksignal/Config.uk                     |   7 +
 lib/uksignal/Makefile.uk                   |   8 +
 lib/uksignal/README                        |   7 +
 lib/uksignal/exportsyms.uk                 |  27 ++
 lib/uksignal/include/uk/bits/sigset.h      |  66 +++
 lib/uksignal/include/uk/signal.h           | 131 ++++++
 lib/uksignal/include/uk/string/strsignal.h |  19 +
 lib/uksignal/include/uk/uk_signal.h        | 136 +++++++
 lib/uksignal/signal.c                      | 320 +++++++++++++++
 lib/uksignal/sigset.c                      |  51 +++
 lib/uksignal/strsignal.c                   |  61 +++
 lib/uksignal/uk_signal.c                   | 451 +++++++++++++++++++++
 plat/common/x86/thread_start.S             |   7 +
 17 files changed, 1311 insertions(+)
 create mode 100644 lib/uksignal/Config.uk
 create mode 100644 lib/uksignal/Makefile.uk
 create mode 100644 lib/uksignal/README
 create mode 100644 lib/uksignal/exportsyms.uk
 create mode 100644 lib/uksignal/include/uk/bits/sigset.h
 create mode 100644 lib/uksignal/include/uk/signal.h
 create mode 100644 lib/uksignal/include/uk/string/strsignal.h
 create mode 100644 lib/uksignal/include/uk/uk_signal.h
 create mode 100644 lib/uksignal/signal.c
 create mode 100644 lib/uksignal/sigset.c
 create mode 100644 lib/uksignal/strsignal.c
 create mode 100644 lib/uksignal/uk_signal.c

diff --git a/lib/Makefile.uk b/lib/Makefile.uk
index 07e8a29..f50795d 100644
--- a/lib/Makefile.uk
+++ b/lib/Makefile.uk
@@ -37,3 +37,4 @@ $(eval $(call _import_lib,$(CONFIG_UK_BASE)/lib/ukmmap))
 $(eval $(call _import_lib,$(CONFIG_UK_BASE)/lib/ukblkdev))
 $(eval $(call _import_lib,$(CONFIG_UK_BASE)/lib/posix-process))
 $(eval $(call _import_lib,$(CONFIG_UK_BASE)/lib/uksp))
+$(eval $(call _import_lib,$(CONFIG_UK_BASE)/lib/uksignal))
diff --git a/lib/uksched/include/uk/thread.h b/lib/uksched/include/uk/thread.h
index d8a4ac8..5ec25a8 100644
--- a/lib/uksched/include/uk/thread.h
+++ b/lib/uksched/include/uk/thread.h
@@ -36,6 +36,9 @@
 #include <uk/arch/lcpu.h>
 #include <uk/arch/time.h>
 #include <uk/plat/thread.h>
+#if CONFIG_LIBUKSIGNAL
+#include <uk/uk_signal.h>
+#endif
 #include <uk/thread_attr.h>
 #include <uk/wait_types.h>
 #include <uk/list.h>
@@ -62,6 +65,9 @@ struct uk_thread {
 #ifdef CONFIG_LIBNEWLIBC
 	struct _reent reent;
 #endif
+#if CONFIG_LIBUKSIGNAL
+	struct uk_thread_sig signals_container;
+#endif
 };
 
 UK_TAILQ_HEAD(uk_thread_list, struct uk_thread);
diff --git a/lib/uksched/sched.c b/lib/uksched/sched.c
index 4b8e149..5a58629 100644
--- a/lib/uksched/sched.c
+++ b/lib/uksched/sched.c
@@ -42,6 +42,9 @@
 #if CONFIG_LIBUKSCHEDCOOP
 #include <uk/schedcoop.h>
 #endif
+#if CONFIG_LIBUKSIGNAL
+#include <uk/uk_signal.h>
+#endif
 
 struct uk_sched *uk_sched_head;
 
@@ -50,6 +53,10 @@ struct uk_sched *uk_sched_default_init(struct uk_alloc *a)
 {
 	struct uk_sched *s = NULL;
 
+#if CONFIG_LIBUKSIGNAL
+	uk_proc_sig_init(&uk_proc_sig);
+#endif
+
 #if CONFIG_LIBUKSCHEDCOOP
 	s = uk_schedcoop_init(a);
 #endif
diff --git a/lib/uksched/thread.c b/lib/uksched/thread.c
index f8ae786..609a4ce 100644
--- a/lib/uksched/thread.c
+++ b/lib/uksched/thread.c
@@ -125,6 +125,9 @@ int uk_thread_init(struct uk_thread *thread,
 #ifdef CONFIG_LIBNEWLIBC
 	reent_init(&thread->reent);
 #endif
+#if CONFIG_LIBUKSIGNAL
+	uk_thread_sig_init(&thread->signals_container);
+#endif
 
 	uk_pr_info("Thread \"%s\": pointer: %p, stack: %p, tls: %p\n",
 		   name, thread, thread->stack, thread->tls);
@@ -135,6 +138,9 @@ int uk_thread_init(struct uk_thread *thread,
 void uk_thread_fini(struct uk_thread *thread, struct uk_alloc *allocator)
 {
 	UK_ASSERT(thread != NULL);
+#if CONFIG_LIBUKSIGNAL
+	uk_thread_sig_uninit(&thread->signals_container);
+#endif
 	ukplat_thread_ctx_destroy(allocator, thread->ctx);
 }
 
diff --git a/lib/uksignal/Config.uk b/lib/uksignal/Config.uk
new file mode 100644
index 0000000..56c1644
--- /dev/null
+++ b/lib/uksignal/Config.uk
@@ -0,0 +1,7 @@
+menuconfig LIBUKSIGNAL
+	bool "uksignal: Unikraft signals"
+	default n
+	select LIBNOLIBC if !HAVE_LIBC
+	select LIBUKDEBUG
+	select LIBUKALLOC
+	select LIBUKSCHED
diff --git a/lib/uksignal/Makefile.uk b/lib/uksignal/Makefile.uk
new file mode 100644
index 0000000..0f1f539
--- /dev/null
+++ b/lib/uksignal/Makefile.uk
@@ -0,0 +1,8 @@
+$(eval $(call addlib_s,libuksignal,$(CONFIG_LIBUKSIGNAL)))
+
+CINCLUDES-$(CONFIG_LIBUKSIGNAL)     += -I$(LIBUKSIGNAL_BASE)/include
+CXXINCLUDES-$(CONFIG_LIBUKSIGNAL)   += -I$(LIBUKSIGNAL_BASE)/include
+
+LIBUKSIGNAL_SRCS-y += $(LIBUKSIGNAL_BASE)/signal.c
+LIBUKSIGNAL_SRCS-y += $(LIBUKSIGNAL_BASE)/sigset.c
+LIBUKSIGNAL_SRCS-y += $(LIBUKSIGNAL_BASE)/uk_signal.c
\ No newline at end of file
diff --git a/lib/uksignal/README b/lib/uksignal/README
new file mode 100644
index 0000000..ff8691f
--- /dev/null
+++ b/lib/uksignal/README
@@ -0,0 +1,7 @@
+This library provides a basic implementation of signals over
+Unikraft. It supports signals between threads and process wide
+signals.
+
+It doesn't support signal codes, rt signals and executes the signal
+handlers on the thread stack. It is also not yet integrated with our
+irqs to deliver signals like SIGSEGV.
\ No newline at end of file
diff --git a/lib/uksignal/exportsyms.uk b/lib/uksignal/exportsyms.uk
new file mode 100644
index 0000000..dbf23fe
--- /dev/null
+++ b/lib/uksignal/exportsyms.uk
@@ -0,0 +1,27 @@
+# uk_signal.h
+uk_proc_sig
+
+uk_sig_handle_signals
+uk_proc_sig_init
+uk_thread_sig_init
+uk_thread_sig_uninit
+uk_sig_thread_kill
+uk_thread_sigmask
+
+# signal.h
+sigaction
+signal
+sigprocmask
+sigsuspend
+sigpending
+sigwait
+kill
+raise
+pthread_sigmask
+
+# sigset.h
+sigemptyset
+sigfillset
+sigaddset
+sigdelset
+sigismember
\ No newline at end of file
diff --git a/lib/uksignal/include/uk/bits/sigset.h b/lib/uksignal/include/uk/bits/sigset.h
new file mode 100644
index 0000000..3642633
--- /dev/null
+++ b/lib/uksignal/include/uk/bits/sigset.h
@@ -0,0 +1,66 @@
+#ifndef __UK_SIGNAL_H__
+#error Do not include this header directly
+#endif
+
+#ifndef __UK_SIGSET_H__
+#define __UK_SIGSET_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define SIG_BLOCK     0
+#define SIG_UNBLOCK   1
+#define SIG_SETMASK   2
+
+typedef unsigned long __sigset_t;
+typedef __sigset_t sigset_t;
+
+int sigemptyset(sigset_t *set);
+int sigfillset(sigset_t *set);
+int sigaddset(sigset_t *set, int signo);
+int sigdelset(sigset_t *set, int signo);
+int sigismember(const sigset_t *set, int signo);
+
+/* TODO: do we have gnu statement expression?  */
+/* internal use */
+#define uk_sigemptyset(ptr)	\
+		do {	\
+			*(ptr) = 0;	\
+		} while (0)
+#define uk_sigfillset(ptr)	\
+		do {	\
+			*(ptr) = ~((__sigset_t) 0);	\
+		} while (0)
+#define uk_sigaddset(ptr, signo)	\
+		do {	\
+			*(ptr) |= (1 << ((signo) - 1));	\
+		} while (0)
+#define uk_sigdelset(ptr, signo)	\
+		do {	\
+			*(ptr) &= ~(1 << ((signo) - 1));	\
+		} while (0)
+#define uk_sigcopyset(ptr1, ptr2)	\
+		do {	\
+			*(ptr1) = *(ptr2);	\
+		} while (0)
+#define uk_sigandset(ptr1, ptr2)	\
+		do {	\
+			*(ptr1) &= *(ptr2);	\
+		} while (0)
+#define uk_sigorset(ptr1, ptr2)	\
+		do {	\
+			*(ptr1) |= *(ptr2);	\
+		} while (0)
+#define uk_sigreverseset(ptr)	\
+		do {	\
+			*(ptr) = ~(*(ptr));	\
+		} while (0)
+#define uk_sigismember(ptr, signo) (*(ptr) & (1 << ((signo) - 1)))
+#define uk_sigisempty(ptr) (*(ptr) == 0)
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __UK_SIGSET_H__ */
diff --git a/lib/uksignal/include/uk/signal.h b/lib/uksignal/include/uk/signal.h
new file mode 100644
index 0000000..43fdabc
--- /dev/null
+++ b/lib/uksignal/include/uk/signal.h
@@ -0,0 +1,131 @@
+/* adapted from OSv */
+#ifndef __UK_SIGNAL_H__
+#define __UK_SIGNAL_H__
+
+#include <stddef.h>
+#include <uk/bits/sigset.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define SIGHUP    1
+#define SIGINT    2
+#define SIGQUIT   3
+#define SIGILL    4
+#define SIGTRAP   5
+#define SIGABRT   6
+#define SIGIOT    SIGABRT
+#define SIGBUS    7
+#define SIGFPE    8
+#define SIGKILL   9
+#define SIGUSR1   10
+#define SIGSEGV   11
+#define SIGUSR2   12
+#define SIGPIPE   13
+#define SIGALRM   14
+#define SIGTERM   15
+#define SIGSTKFLT 16
+#define SIGCHLD   17
+#define SIGCONT   18
+#define SIGSTOP   19
+#define SIGTSTP   20
+#define SIGTTIN   21
+#define SIGTTOU   22
+#define SIGURG    23
+#define SIGXCPU   24
+#define SIGXFSZ   25
+#define SIGVTALRM 26
+#define SIGPROF   27
+#define SIGWINCH  28
+#define SIGIO     29
+#define SIGPOLL   29
+#define SIGPWR    30
+#define SIGSYS    31
+#define SIGUNUSED SIGSYS
+
+#define _NSIG 32
+
+#define SA_NOCLDSTOP  1
+#define SA_NOCLDWAIT  2
+#define SA_SIGINFO    4
+#define SA_ONSTACK    0x08000000
+#define SA_RESTART    0x10000000
+#define SA_NODEFER    0x40000000
+#define SA_RESETHAND  0x80000000
+#define SA_RESTORER   0x04000000
+
+typedef int pid_t;
+typedef int sig_atomic_t;
+
+#define NSIG _NSIG
+
+typedef struct {
+  int          si_signo;    /* Signal number */
+  int          si_code;     /* Cause of the signal */
+  pid_t	       si_pid;	    /* Sending process ID */
+} siginfo_t;
+
+struct sigaction {
+	union {
+		void (*sa_handler)(int);
+		void (*sa_sigaction)(int, siginfo_t *, void *);
+	} __sa_handler;
+	sigset_t sa_mask;
+	int sa_flags;
+	void (*sa_restorer)(void);
+};
+#define sa_handler   __sa_handler.sa_handler
+#define sa_sigaction __sa_handler.sa_sigaction
+
+#define SIG_ERR  ((void (*)(int))-1)
+#define SIG_DFL  ((void (*)(int)) 0)
+#define SIG_IGN  ((void (*)(int)) 1)
+
+/* TODO: do we have gnu statement expression? */
+#define is_sig_dfl(ptr)	\
+	(!((ptr)->sa_flags & SA_SIGINFO) && (ptr)->sa_handler == SIG_DFL)
+
+#define is_sig_ign(ptr)	\
+	(!((ptr)->sa_flags & SA_SIGINFO) && (ptr)->sa_handler == SIG_IGN)
+
+int
+sigaction(int signum, const struct sigaction *act, struct sigaction *oldact);
+
+int sigpending(sigset_t *set);
+int sigprocmask(int how, const sigset_t *set, sigset_t *oldset);
+int sigsuspend(const sigset_t *mask);
+int sigwait(const sigset_t *set, int *sig);
+
+int kill(pid_t pid, int sig);
+int raise(int sig);
+
+typedef void (*sighandler_t)(int);
+sighandler_t signal(int signum, sighandler_t handler);
+
+int pthread_sigmask(int how, const sigset_t *set, sigset_t *oldset);
+
+/* TODO: not used - defined just for newlib */
+union sigval {
+	int    sival_int;	/* Integer signal value */
+	void  *sival_ptr;	/* Pointer signal value */
+};
+
+struct sigevent {
+	int              sigev_notify;	/* Notification type */
+	int              sigev_signo;	/* Signal number */
+	union sigval     sigev_value;	/* Signal value */
+};
+
+/* TODO: not used - defined just for v8 */
+typedef struct sigaltstack {
+	void *ss_sp;
+	int ss_flags;
+	size_t ss_size;
+} stack_t;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __UK_SIGNAL_H__ */
diff --git a/lib/uksignal/include/uk/string/strsignal.h b/lib/uksignal/include/uk/string/strsignal.h
new file mode 100644
index 0000000..73b69cb
--- /dev/null
+++ b/lib/uksignal/include/uk/string/strsignal.h
@@ -0,0 +1,19 @@
+#ifndef __UK_STRSIGNAL_H__
+#define __UK_STRSIGNAL_H__
+
+/*
+ * TODO: not used - delete
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+extern const char * const sys_siglist[];
+char *strsignal(int sig);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __UK_STRSIGNAL_H__ */
diff --git a/lib/uksignal/include/uk/uk_signal.h b/lib/uksignal/include/uk/uk_signal.h
new file mode 100644
index 0000000..cb066d1
--- /dev/null
+++ b/lib/uksignal/include/uk/uk_signal.h
@@ -0,0 +1,136 @@
+#ifndef __UK_UK_SIGNAL_H__
+#define __UK_UK_SIGNAL_H__
+
+#include <uk/list.h>
+#include <uk/signal.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define _UK_TH_SIG uk_crr_thread_sig_container()
+
+struct uk_thread;
+
+struct uk_signal {
+	siginfo_t info;
+	struct uk_list_head list_node;
+};
+
+/* TODO: add synchronization */
+
+struct uk_proc_sig {
+	/* used as a bitmap for pending signals */
+	sigset_t pending;
+	/* pending signals - valid only if corresponding bit in pending is set */
+	siginfo_t pending_signals[NSIG - 1];
+	/* signal handlers for this process */
+	struct sigaction sigaction[NSIG - 1];
+	/* list of uk_thread_sig from the threads of the proc */
+	struct uk_list_head thread_sig_list;
+};
+
+extern struct uk_proc_sig uk_proc_sig;
+
+enum uk_sig_waiting {
+	UK_SIG_NOT_WAITING = 0,
+	UK_SIG_WAITING = 1,
+	UK_SIG_WAITING_SCHED = 2
+};
+
+struct uk_thread_sig_wait {
+	/*
+	 * waiting status
+	 *
+	 * values:
+	 * 	UK_SIG_NOT_WAITING - thread is not waiting
+	 * 	UK_SIG_WAITING - thread is waiting for a signal
+	 * 	UK_SIG_WAITING_SCHED - thread is waiting to be scheduled
+	 */
+	enum uk_sig_waiting status;
+	/* used as a bitmap for awaited signals */
+	sigset_t awaited;
+	/* awaited signal received */
+	siginfo_t received_signal;
+};
+
+struct uk_thread_sig {
+	/* blocked signals */
+	sigset_t mask;
+	/* used as a bitmap for pending signals */
+	sigset_t pending;
+	/* list of pending signals */
+	struct uk_list_head pending_signals;
+	/* signal waiting state */
+	struct uk_thread_sig_wait wait;
+	/* node for the thread_sig_list from the proc */
+	struct uk_list_head list_node;
+};
+
+/* returns number of executed signal handlers */
+int uk_sig_handle_signals(void);
+
+int uk_proc_sig_init(struct uk_proc_sig *sig);
+int uk_thread_sig_init(struct uk_thread_sig *sig);
+void uk_thread_sig_uninit(struct uk_thread_sig *sig);
+
+/* TODO: replace sched thread_kill? */
+int uk_sig_thread_kill(struct uk_thread *tid, int sig);
+int uk_thread_sigmask(int how, const sigset_t *set, sigset_t *oldset);
+
+/* internal use */
+static inline int uk_sig_is_valid(int sig)
+{
+	return (sig < NSIG && sig > 0);
+}
+
+static inline void uk_sigset_remove_unmaskable(sigset_t *sig)
+{
+	uk_sigdelset(sig, SIGKILL);
+	uk_sigdelset(sig, SIGSTOP);
+}
+
+static inline void uk_add_proc_signal(siginfo_t *sig)
+{
+	uk_proc_sig.pending_signals[sig->si_signo - 1] = *sig;
+	uk_sigaddset(&uk_proc_sig.pending, sig->si_signo);
+}
+
+static inline void uk_remove_proc_signal(int sig)
+{
+	uk_sigdelset(&uk_proc_sig.pending, sig);
+}
+
+/* maybe move to sched */
+struct uk_thread_sig *uk_crr_thread_sig_container(void);
+void uk_sig_init_siginfo(siginfo_t *siginfo, int sig);
+
+/* returns the uk_signal for sig if it is pending on thread */
+struct uk_signal *
+uk_sig_th_get_pending(struct uk_thread_sig *th_sig, int sig);
+
+/* returns the siginfo for sig if it is pending on proc */
+siginfo_t *uk_sig_proc_get_pending(int sig);
+
+/*
+ * returns the uk_signal for a signal from the given
+ * set if it is pending on thread
+ */
+struct uk_signal *
+uk_sig_th_get_pending_any(struct uk_thread_sig *th_sig, sigset_t set);
+
+/*
+ * returns the siginfo for a signal from the given
+ * set if it is pending on proc
+ */
+siginfo_t *uk_sig_proc_get_pending_any(sigset_t set);
+
+int
+uk_deliver_proc_signal(struct uk_thread_sig *th_sig, siginfo_t *sig);
+void uk_execute_handler(siginfo_t sig);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __UK_UK_SIGNAL_H__ */
diff --git a/lib/uksignal/signal.c b/lib/uksignal/signal.c
new file mode 100644
index 0000000..5f5e289
--- /dev/null
+++ b/lib/uksignal/signal.c
@@ -0,0 +1,320 @@
+/* adapted from OSv */
+
+#include <errno.h>
+
+#include <uk/alloc.h>
+#include <uk/sched.h>
+#include <uk/signal.h>
+#include <uk/thread.h>
+#include <uk/uk_signal.h>
+
+/*
+ * Tries to deliver a pending signal to the current thread
+ * Used only with a waiting thread
+ *
+ * Returns: 0 if no signal was delivered, 1 if a signal was delivered
+ */
+static int uk_get_awaited_signal(void)
+{
+	siginfo_t *siginfo;
+	struct uk_signal *signal;
+	struct uk_thread_sig *ptr;
+
+	ptr = _UK_TH_SIG;
+
+	/* try to deliver thread pending signal */
+	signal = uk_sig_th_get_pending_any(ptr, ptr->wait.awaited);
+
+	if (signal) {
+		/* set awaited signal */
+		ptr->wait.received_signal = signal->info;
+
+		/* remove it from the list of pending signals */
+		uk_list_del(&signal->list_node);
+		uk_sigdelset(&ptr->pending, signal->info.si_signo);
+		uk_free(uk_alloc_get_default(), signal);
+		return 1;
+	}
+
+	/* try to deliver process pending signal */
+	siginfo = uk_sig_proc_get_pending_any(ptr->wait.awaited);
+
+	if (siginfo) {
+		ptr->wait.received_signal = *siginfo;
+
+		/* remove it from the list of pending signals */
+		uk_remove_proc_signal(siginfo->si_signo);
+		return 1;
+	}
+
+	return 0;
+}
+
+/* TODO: We do not support any sa_flags besides SA_SIGINFO */
+int
+sigaction(int signum, const struct sigaction *act, struct sigaction *oldact)
+{
+	struct uk_list_head *i;
+	struct uk_thread_sig *th_sig;
+	struct uk_signal *signal;
+
+	if (!uk_sig_is_valid(signum) ||
+			signum == SIGKILL ||
+			signum == SIGSTOP) {
+		errno = EINVAL;
+		return -1;
+	}
+
+	if (oldact)
+		*oldact = uk_proc_sig.sigaction[signum - 1];
+
+	if (act) {
+		/* TODO: SA_NODEFER */
+		uk_proc_sig.sigaction[signum - 1] = *act;
+		uk_sigaddset(&uk_proc_sig.sigaction[signum - 1].sa_mask, signum);
+
+		/* remove signal from where it is pending */
+		if (is_sig_ign(act)) {
+			/* remove it from proc */
+			uk_remove_proc_signal(signum);
+
+			/* remove it from threads*/
+			uk_list_for_each(i, &uk_proc_sig.thread_sig_list) {
+				th_sig = uk_list_entry(i, struct uk_thread_sig, list_node);
+
+				signal = uk_sig_th_get_pending(th_sig, signum);
+
+				if (signal) {
+					/* remove it from the list of pending signals */
+					uk_list_del(&signal->list_node);
+					uk_sigdelset(&th_sig->pending, signal->info.si_signo);
+					uk_free(uk_alloc_get_default(), signal);
+				}
+			}
+		}
+	}
+
+	return 0;
+}
+
+static sighandler_t uk_signal(int signum, sighandler_t handler, int sa_flags)
+{
+	struct sigaction old;
+	struct sigaction act = {
+		.sa_handler = handler,
+		.sa_flags = sa_flags
+	};
+
+	if (sigaction(signum, &act, &old) < 0)
+		return SIG_ERR;
+
+	if (old.sa_flags & SA_SIGINFO)
+		return NULL;
+	else
+		return old.sa_handler;
+}
+
+sighandler_t signal(int signum, sighandler_t handler)
+{
+	/* SA_RESTART <- BSD signal semantics */
+	return uk_signal(signum, handler, SA_RESTART);
+}
+
+int sigpending(sigset_t *set)
+{
+	struct uk_thread_sig *ptr;
+
+	ptr = _UK_TH_SIG;
+
+	uk_sigcopyset(set, &ptr->pending);
+	uk_sigorset(set, &uk_proc_sig.pending);
+
+	return 0;
+}
+
+int sigprocmask(int how, const sigset_t *set, sigset_t *oldset)
+{
+	return uk_thread_sigmask(how, set, oldset);
+}
+
+int pthread_sigmask(int how, const sigset_t *set, sigset_t *oldset)
+{
+	return uk_thread_sigmask(how, set, oldset);
+}
+
+int sigsuspend(const sigset_t *mask)
+{
+	/* If the signals are ignored, this doesn't return <- POSIX */
+
+	sigset_t cleaned_mask, tmp;
+	struct uk_thread_sig *ptr;
+
+	uk_sigcopyset(&cleaned_mask, mask);
+	uk_sigset_remove_unmaskable(&cleaned_mask);
+
+	ptr = _UK_TH_SIG;
+
+	uk_sigcopyset(&ptr->wait.awaited, &cleaned_mask);
+
+	/* we are waiting for all the signals that aren't blocked */
+	uk_sigreverseset(&ptr->wait.awaited);
+
+	/* change mask */
+	uk_sigcopyset(&tmp, &ptr->mask);
+	uk_sigcopyset(&ptr->mask, &cleaned_mask);
+
+	while (1) {
+		/* try to deliver a pending signal */
+		if (uk_get_awaited_signal())
+			break;
+
+		/* block, yield */
+		uk_thread_block(uk_thread_current());
+		ptr->wait.status = UK_SIG_WAITING;
+		uk_sched_yield();
+	}
+
+	ptr->wait.status = UK_SIG_NOT_WAITING;
+
+	/* execute handler */
+	uk_execute_handler(ptr->wait.received_signal);
+
+	/* restore mask
+	 *
+	 * We restore the mask here because we are technically done with
+	 * sigsuspend and the mask must be restored at the end of sigsuspend
+	 */
+	uk_sigcopyset(&ptr->mask, &tmp);
+
+	/* execute other pending signals */
+	uk_sig_handle_signals();
+
+	errno = EINTR;
+	return -1; /* always returns -1 and sets errno to EINTR */
+}
+
+int sigwait(const sigset_t *set, int *sig)
+{
+	/*
+	 * If the signals are ignored, this doesn't return <- TODO: POSIX ??
+	 *
+	 * POSIX states that the signals in set must have been blocked before
+	 * calling sigwait, otherwise behavior is undefined -> for us the
+	 * behavior is not caring -> even if the signal is not blocked sigwait
+	 * will still accept it
+	 *
+	 * NOTE: this function is not signal safe
+	 */
+
+	int signals_executed;
+	sigset_t cleaned_set, awaited_save;
+	struct uk_thread_sig *ptr;
+
+	uk_sigcopyset(&cleaned_set, set);
+	uk_sigset_remove_unmaskable(&cleaned_set);
+
+	if (uk_sigisempty(&cleaned_set))
+		return EINVAL;
+
+	ptr = _UK_TH_SIG;
+
+	uk_sigcopyset(&ptr->wait.awaited, &cleaned_set);
+
+	/* save awaited signals */
+	awaited_save = ptr->wait.awaited;
+
+	while (1) {
+		if (uk_get_awaited_signal())
+			break;
+
+		/*
+		 * sigwait allows signals to be received while
+		 * waiting so handle them
+		 */
+		ptr->wait.status = UK_SIG_NOT_WAITING;
+		signals_executed = uk_sig_handle_signals();
+
+		if (signals_executed) {
+			/*
+			 * awaited might be changed by other waiting
+			 * done while handling the signal
+			 */
+			ptr->wait.awaited = awaited_save;
+
+			/*
+			 * we might have raised / received a waiting signal
+			 * while handling the others
+			 */
+			if (uk_get_awaited_signal())
+				break;
+		}
+
+		/* block, yield */
+		uk_thread_block(uk_thread_current());
+		ptr->wait.status = UK_SIG_WAITING;
+		uk_sched_yield();
+	}
+
+	ptr->wait.status = UK_SIG_NOT_WAITING;
+
+	/* do not execute handler, set received signal */
+	*sig = ptr->wait.received_signal.si_signo;
+
+	/* execute other pending signals */
+	uk_sig_handle_signals();
+
+	return 0; /* returns positive errno */
+}
+
+/*
+ * Search for a thread that does not have the signal blocked
+ * If all of the threads have the signal blocked, add it to process
+ * pending signals
+ */
+int kill(pid_t pid, int sig)
+{
+	/*
+	 * POSIX.1 requires that if a process sends a signal to itself, and the
+	 * sending thread does not have the signal blocked, and no other thread
+	 * has it unblocked or is waiting for it in sigwait(3), at least one
+	 * unblocked signal must be delivered to the sending thread before the
+	 * kill() returns.
+	 *
+	 * FIXME: we don't implement this ^
+	 */
+
+	siginfo_t siginfo;
+	struct uk_list_head *i;
+	struct uk_thread_sig *th_sig;
+
+
+	if (pid != 1 && pid != 0 && pid != -1) {
+		errno = ESRCH;
+		return -1;
+	}
+
+	if (!uk_sig_is_valid(sig)) {
+		errno = EINVAL;
+		return -1;
+	}
+
+	/* setup siginfo */
+	uk_sig_init_siginfo(&siginfo, sig);
+
+	uk_list_for_each(i, &uk_proc_sig.thread_sig_list) {
+		th_sig = uk_list_entry(i, struct uk_thread_sig, list_node);
+
+		if (uk_deliver_proc_signal(th_sig, &siginfo) > 0)
+			return 0;
+	}
+
+	/* didn't find any thread that could accept this signal */
+	uk_add_proc_signal(&siginfo);
+
+	return 0;
+}
+
+int raise(int sig)
+{
+	return uk_sig_thread_kill(uk_thread_current(), sig);
+}
diff --git a/lib/uksignal/sigset.c b/lib/uksignal/sigset.c
new file mode 100644
index 0000000..2624e6c
--- /dev/null
+++ b/lib/uksignal/sigset.c
@@ -0,0 +1,51 @@
+/* taken from newlib */
+
+#include <errno.h>
+#include <uk/signal.h>
+
+int sigemptyset(sigset_t *set)
+{
+	uk_sigemptyset(set);
+	return 0;
+}
+
+int sigfillset(sigset_t *set)
+{
+	uk_sigfillset(set);
+	return 0;
+}
+
+int sigaddset(sigset_t *set, int signo)
+{
+	if (signo >= NSIG || signo <= 0) {
+		errno = EINVAL;
+		return -1;
+	}
+
+	uk_sigaddset(set, signo);
+	return 0;
+}
+
+int sigdelset(sigset_t *set, int signo)
+{
+	if (signo >= NSIG || signo <= 0) {
+		errno = EINVAL;
+		return -1;
+	}
+
+	uk_sigdelset(set, signo);
+	return 0;
+}
+
+int sigismember(const sigset_t *set, int signo)
+{
+	if (signo >= NSIG || signo <= 0) {
+		errno = EINVAL;
+		return -1;
+	}
+
+	if (uk_sigismember(set, signo))
+		return 1;
+	else
+		return 0;
+}
diff --git a/lib/uksignal/strsignal.c b/lib/uksignal/strsignal.c
new file mode 100644
index 0000000..b672e5f
--- /dev/null
+++ b/lib/uksignal/strsignal.c
@@ -0,0 +1,61 @@
+/* taken from newlib */
+
+#include <uk/uk_signal.h>
+
+/*
+ * TODO: not used - delete
+ */
+
+const char *sigstring[] = {
+		"Hangup",
+		"Interrupt",
+		"Quit",
+		"Illegal instruction",
+		"Trace/breakpoint trap",
+		"IOT trap",
+		"EMT trap",
+		"Floating point exception",
+		"Killed",
+		"Bus error",
+		"Segmentation fault",
+		"Bad system call",
+		"Broken pipe",
+		"Alarm clock",
+		"Terminated",
+		"Urgent I/O condition",
+		"Stopped (signal)",
+		"Stopped",
+		"Continued",
+		"Child exited",
+		"Stopped (tty input)",
+		"Stopped (tty output)",
+		"I/O possible",
+		"CPU time limit exceeded",
+		"File size limit exceeded",
+		"Virtual timer expired",
+		"Profiling timer expired",
+		"Window changed",
+		"Resource lost",
+		"User defined signal 1",
+		"User defined signal 2"
+};
+
+char *strsignal(int sig)
+{
+	char *buffer;
+	struct uk_signals_container *ptr;
+
+	ptr = _UK_TH_SIG;
+	buffer = UK_SIG_BUF(ptr);
+
+	/*
+	 * TODO: this assignment doesn't really do anything
+	 * since we return buffer, but newlibc did this
+	 */
+	if (sig <= 0 || sig >= NSIG)
+		*buffer = "Unknown signal";
+	else
+		*buffer = sigstring[sig - 1];
+
+	return buffer;
+}
diff --git a/lib/uksignal/uk_signal.c b/lib/uksignal/uk_signal.c
new file mode 100644
index 0000000..616b8f7
--- /dev/null
+++ b/lib/uksignal/uk_signal.c
@@ -0,0 +1,451 @@
+#include <errno.h>
+
+#include <uk/alloc.h>
+#include <uk/print.h>
+#include <uk/signal.h>
+#include <uk/thread.h>
+#include <uk/uk_signal.h>
+
+struct uk_proc_sig uk_proc_sig;
+
+int uk_proc_sig_init(struct uk_proc_sig *sig)
+{
+	int i;
+
+	sigemptyset(&sig->pending);
+
+	for (i = 0; i < NSIG - 1; ++i) {
+		/* TODO: set ign to the ones that should be ign */
+		sig->sigaction[i].sa_handler = SIG_DFL;
+		sigemptyset(&sig->sigaction[i].sa_mask);
+		sig->sigaction[i].sa_flags = 0;
+	}
+
+	UK_INIT_LIST_HEAD(&sig->thread_sig_list);
+	return 0;
+}
+
+int uk_thread_sig_init(struct uk_thread_sig *sig)
+{
+	sigemptyset(&sig->mask);
+
+	sig->wait.status = UK_SIG_NOT_WAITING;
+	sigemptyset(&sig->wait.awaited);
+
+	sigemptyset(&sig->pending);
+	UK_INIT_LIST_HEAD(&sig->pending_signals);
+
+	uk_list_add(&sig->list_node, &uk_proc_sig.thread_sig_list);
+	return 0;
+}
+
+void uk_thread_sig_uninit(struct uk_thread_sig *sig)
+{
+	/* Clear pending signals */
+	struct uk_list_head *i, *tmp;
+	struct uk_signal *signal;
+
+	uk_list_del(&sig->list_node);
+
+	uk_list_for_each_safe(i, tmp, &sig->pending_signals) {
+		signal = uk_list_entry(i, struct uk_signal, list_node);
+
+		uk_list_del(&signal->list_node);
+		uk_free(uk_alloc_get_default(), signal);
+	}
+}
+
+int uk_sig_handle_signals(void)
+{
+	/*
+	 * Do not run pending signals if the thread is waiting
+	 *
+	 * Iterate over pending signals
+	 * Check if the signal is blocked
+	 *
+	 * Before running the handler, remove it from pending
+	 */
+
+	int handled = 0;
+	sigset_t executable, rmask;
+	struct uk_signal *signal;
+	struct uk_thread_sig *ptr;
+
+	ptr = _UK_TH_SIG;
+
+	/*
+	 * handle_sigals will be called from
+	 * the respective waiting function
+	 */
+	if (ptr->wait.status != UK_SIG_NOT_WAITING)
+		return 0;
+
+	/* reverse mask */
+	uk_sigcopyset(&rmask, &ptr->mask);
+	uk_sigreverseset(&rmask);
+
+	/* calculate executable signals */
+	uk_sigcopyset(&executable, &rmask);
+	uk_sigandset(&executable, &ptr->pending);
+
+	while (!uk_sigisempty(&executable)) {
+		signal = uk_list_first_entry(&ptr->pending_signals, struct uk_signal, list_node);
+
+		/* move it last if it's blocked */
+		if (uk_sigismember(&ptr->mask, signal->info.si_signo)) {
+			uk_list_del(&signal->list_node);
+			uk_list_add_tail(&signal->list_node, &ptr->pending_signals);
+			continue;
+		}
+
+		/* remove from the list */
+		uk_list_del(&signal->list_node);
+
+		/* clear pending status */
+		uk_sigdelset(&ptr->pending, signal->info.si_signo);
+
+		/* execute */
+		uk_execute_handler(signal->info);
+
+		uk_free(uk_alloc_get_default(), signal);
+		handled++;
+
+		/* calculate executable signals */
+		uk_sigcopyset(&executable, &rmask);
+		uk_sigandset(&executable, &ptr->pending);
+	}
+
+	return handled;
+}
+
+/*
+ * returns:
+ *  >0 - on success
+ *  0  - if signal is ignored / already pending
+ *  <0 - on failure
+ */
+static int
+uk_deliver_signal_unmasked(struct uk_thread_sig *th_sig, siginfo_t *sig)
+{
+	struct uk_thread *tid;
+	struct uk_signal *uk_sig;
+
+	/* If the signal is ignored, we don't deliver it */
+	if (is_sig_ign(&uk_proc_sig.sigaction[sig->si_signo - 1]))
+		return 0;
+
+	/* If it is already pending, we don't deliver it */
+	if (uk_sigismember(&th_sig->pending, sig->si_signo))
+		return 0;
+
+	uk_sig = uk_malloc(uk_alloc_get_default(), sizeof(*uk_sig));
+	if (!uk_sig) {
+		uk_pr_warn("Could not allocate uk_signal");
+		return -ENOMEM;
+	}
+
+	uk_sig->info = *sig;
+	uk_list_add(&uk_sig->list_node, &th_sig->pending_signals);
+
+	uk_sigaddset(&th_sig->pending, sig->si_signo);
+
+	/* check if we need to wake the thread */
+	if (th_sig->wait.status != UK_SIG_NOT_WAITING &&
+			th_sig->wait.status != UK_SIG_WAITING_SCHED) {
+		th_sig->wait.status = UK_SIG_WAITING_SCHED;
+
+		tid = __containerof(th_sig, struct uk_thread, signals_container);
+		uk_thread_wake(tid);
+	}
+
+	return 1;
+}
+
+int uk_sig_thread_kill(struct uk_thread *tid, int sig)
+{
+	siginfo_t siginfo;
+	struct uk_signal *signal;
+	struct uk_thread_sig *ptr;
+
+	if (!uk_sig_is_valid(sig)) {
+		errno = EINVAL;
+		return -1;
+	}
+
+	ptr = &tid->signals_container;
+
+	/* setup siginfo */
+	uk_sig_init_siginfo(&siginfo, sig);
+
+	/* check if we are sending this to ourself */
+	if (&tid->signals_container == _UK_TH_SIG) {
+		/* if it's not masked just run it */
+		if (!uk_sigismember(&ptr->mask, sig)) {
+			/* remove the signal from pending */
+			signal = uk_sig_th_get_pending(ptr, sig);
+
+			if (signal) {
+				uk_list_del(&signal->list_node);
+				uk_sigdelset(&ptr->pending, sig);
+				uk_free(uk_alloc_get_default(), signal);
+			}
+
+			uk_execute_handler(siginfo);
+			return 0;
+		}
+	}
+
+	uk_deliver_signal_unmasked(ptr, &siginfo);
+
+	return 0;
+}
+
+/*
+ * Used to deliver pending signals after a mask change
+ *
+ * Since mask doesn't affect the deliverance of signals
+ * directed to threads (this is handled by uk_sig_handle_signals),
+ * we are trying to deliver only pending process signals
+ */
+static inline void uk_deliver_signals_maskchange(void)
+{
+	int i, ret;
+	sigset_t to_send;
+	struct uk_thread_sig *ptr;
+
+	ptr = _UK_TH_SIG;
+
+	uk_sigcopyset(&to_send, &ptr->mask);
+	uk_sigandset(&to_send, &uk_proc_sig.pending);
+
+	for (i = 1; i < NSIG; ++i) {
+		if (uk_sigisempty(&to_send))
+			break;
+
+		if (uk_sigismember(&to_send, i)) {
+			ret = uk_deliver_proc_signal(ptr,
+					&uk_proc_sig.pending_signals[i - 1]);
+
+			if (ret > 0) {
+				uk_remove_proc_signal(i);
+				uk_sigdelset(&to_send, i);
+			}
+		}
+	}
+}
+
+/*
+ * TODO: if we add rt sig, don't allow the
+ * two real-time sig that are used internally by the NPTL
+ * threading implementation. Also for all the functions - ignore
+ * those signals silently
+ */
+int uk_thread_sigmask(int how, const sigset_t *set, sigset_t *oldset)
+{
+	/*
+	 * running this inside a handler has no effect outside the handler
+	 * since the mask is restored in execute_handler
+	 */
+
+	sigset_t *mask, tmp;
+	struct uk_thread_sig *ptr;
+
+	ptr = _UK_TH_SIG;
+	mask = &(ptr->mask);
+
+	if (oldset)
+		*oldset = *mask;
+
+	if (set) {
+		switch (how) {
+		case SIG_BLOCK:
+			uk_sigorset(mask, set);
+			break;
+		case SIG_UNBLOCK:
+			uk_sigcopyset(&tmp, set);
+			uk_sigreverseset(&tmp);
+			uk_sigandset(mask, set);
+			break;
+		case SIG_SETMASK:
+			uk_sigcopyset(mask, set);
+			break;
+		default:
+			errno = EINVAL;
+			return -1;
+		}
+
+		uk_sigset_remove_unmaskable(mask);
+
+		/* Changed the mask, see if we can deliver any pending signals */
+		uk_deliver_signals_maskchange();
+
+		uk_sig_handle_signals();
+	}
+
+	return 0;
+}
+
+struct uk_thread_sig *uk_crr_thread_sig_container(void)
+{
+	return &(uk_thread_current()->signals_container);
+}
+
+void uk_sig_init_siginfo(siginfo_t *siginfo, int sig)
+{
+	siginfo->si_signo = sig;
+
+	/* TODO: add codes; get pid from getpid() */
+	siginfo->si_code = 0;
+	siginfo->si_pid = 1;
+}
+
+/* returns the uk_signal for sig if it is pending on thread */
+struct uk_signal *uk_sig_th_get_pending(struct uk_thread_sig *th_sig, int sig)
+{
+	struct uk_list_head *i;
+	struct uk_signal *signal;
+
+	if (!uk_sigismember(&th_sig->pending, sig))
+		return NULL;
+
+	uk_list_for_each(i, &th_sig->pending_signals) {
+		signal = uk_list_entry(i, struct uk_signal, list_node);
+
+		if (signal->info.si_signo == sig)
+			return signal;
+	}
+
+	/* NOT REACHED */
+	return NULL;
+}
+
+/* returns the siginfo for sig if it is pending on proc */
+siginfo_t *uk_sig_proc_get_pending(int sig)
+{
+	if (!uk_sigismember(&uk_proc_sig.pending, sig))
+		return NULL;
+
+	return &uk_proc_sig.pending_signals[sig - 1];
+}
+
+/*
+ * returns the uk_signal for a signal from the given
+ * set if it is pending on thread
+ */
+struct uk_signal *
+uk_sig_th_get_pending_any(struct uk_thread_sig *th_sig, sigset_t set)
+{
+	sigset_t common;
+	struct uk_list_head *i;
+	struct uk_signal *signal;
+
+	uk_sigcopyset(&common, &th_sig->pending);
+	uk_sigandset(&common, &set);
+
+	if (uk_sigisempty(&common))
+		return NULL;
+
+	uk_list_for_each(i, &th_sig->pending_signals) {
+		signal = uk_list_entry(i, struct uk_signal, list_node);
+
+		if (uk_sigismember(&common, signal->info.si_signo))
+			return signal;
+	}
+
+	/* NOT REACHED */
+	return NULL;
+}
+
+/*
+ * returns the siginfo for a signal from the given
+ * set if it is pending on proc
+ */
+siginfo_t *uk_sig_proc_get_pending_any(sigset_t set)
+{
+	int sig;
+	sigset_t common;
+
+	uk_sigcopyset(&common, &uk_proc_sig.pending);
+	uk_sigandset(&common, &set);
+
+	if (uk_sigisempty(&common))
+		return NULL;
+
+	for (sig = 1; sig < NSIG; ++sig)
+		if (uk_sigismember(&common, sig))
+			return &uk_proc_sig.pending_signals[sig - 1];
+
+	/* NOT REACHED */
+	return NULL;
+}
+
+/*
+ * returns:
+ *  >0 - on success
+ *  0  - if signal is blocked / ignored / already pending
+ *  <0 - on failure
+ */
+int
+uk_deliver_proc_signal(struct uk_thread_sig *th_sig, siginfo_t *sig)
+{
+	if (uk_sigismember(&th_sig->mask, sig->si_signo))
+		return 0;
+
+	return uk_deliver_signal_unmasked(th_sig, sig);
+}
+
+void uk_execute_handler(siginfo_t sig)
+{
+	/*
+	 * We save siginfo locally since it might change
+	 * while the handler is runnnig
+	 * For example, if we execute a waiting function inside
+	 * the handler and we were already inside a waiting function
+	 */
+
+	sigset_t tmp;
+	struct sigaction *act;
+	struct uk_thread_sig *ptr;
+
+	act = &uk_proc_sig.sigaction[sig.si_signo - 1];
+
+	/*
+	 * Check if the signal is ignored
+	 *
+	 * This should never happen since
+	 * we never deliver ignored signals
+	 */
+	if (is_sig_ign(act)) {
+		uk_pr_debug("Ignored signal %d\n",
+				sig.si_signo);
+		ukplat_crash();
+	}
+
+	/* our default handler is shutdown */
+	if (is_sig_dfl(act)) {
+		uk_pr_debug("Uncaught signal %d. Powering off.\n",
+				sig.si_signo);
+		ukplat_crash();
+	}
+
+	ptr = _UK_TH_SIG;
+
+	/* change the mask */
+	uk_sigcopyset(&tmp, &ptr->mask);
+	uk_sigorset(&ptr->mask, &act->sa_mask);
+
+	/* run the handler */
+	if (act->sa_flags & SA_SIGINFO)
+		act->sa_sigaction(sig.si_signo, &sig, NULL);
+	else
+		act->sa_handler(sig.si_signo);
+
+	/* check if we need to reset handler */
+	if (act->sa_flags & SA_RESETHAND) {
+		act->sa_flags = 0;
+		act->sa_handler = SIG_DFL;
+	}
+
+	/* restore the mask */
+	uk_sigcopyset(&ptr->mask, &tmp);
+}
diff --git a/plat/common/x86/thread_start.S b/plat/common/x86/thread_start.S
index 360ca91..a24de0f 100644
--- a/plat/common/x86/thread_start.S
+++ b/plat/common/x86/thread_start.S
@@ -26,6 +26,7 @@
  */
 /* Taken from Mini-OS arch/x86/x86_64.S */
 
+#include <uk/config.h>
 #include <uk/plat/common/sw_ctx.h>
 
 #define ENTRY(X) .globl X ; X :
@@ -55,6 +56,12 @@ ENTRY(asm_sw_ctx_switch)
 	lea .Lreturn(%rip), %rbx
 	movq %rbx, OFFSETOF_SW_CTX_IP(%rdi)       /* save EIP */
 	pushq OFFSETOF_SW_CTX_IP(%rsi)            /* restore EIP */
+
+#if CONFIG_LIBUKSIGNAL
+	/* TODO: do we need to save regs? (e.g fpu) */
+	/* stack is aligned here */
+	call uk_sig_handle_signals
+#endif
 	ret
 .Lreturn:
 	popq %r15
-- 
2.25.1



From minios-devel-bounces@lists.xenproject.org Sat Jan 16 01:51:36 2021
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Sat, 16 Jan 2021 01:51:36 +0000
Received: from list by lists.xenproject.org with outflank-mailman.68889.123443 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1l0akZ-00049w-2z; Sat, 16 Jan 2021 01:51:35 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 68889.123443; Sat, 16 Jan 2021 01:51: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 1l0akZ-00049p-04; Sat, 16 Jan 2021 01:51:35 +0000
Received: by outflank-mailman (input) for mailman id 68889;
 Sat, 16 Jan 2021 01:51: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=8vDg=GT=student.uliege.be=b.rizzo@srs-us1.protection.inumbo.net>)
 id 1l0akY-00049k-Cj
 for minios-devel@lists.xenproject.org; Sat, 16 Jan 2021 01:51:34 +0000
Received: from serv108.segi.ulg.ac.be (unknown [139.165.32.111])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 763a463a-1794-4669-9ab7-5c9f434aeebd;
 Sat, 16 Jan 2021 01:51:31 +0000 (UTC)
Received: from localhost.localdomain (unknown [91.182.172.238])
 (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
 (No client certificate requested)
 by serv108.segi.ulg.ac.be (Postfix) with ESMTPSA id DD74B200DFAF;
 Sat, 16 Jan 2021 02:51:30 +0100 (CET)
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: 763a463a-1794-4669-9ab7-5c9f434aeebd
DKIM-Filter: OpenDKIM Filter v2.11.0 serv108.segi.ulg.ac.be DD74B200DFAF
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=uliege.be;
	s=ulg20190529; t=1610761891;
	bh=SwWYWMnWYV+kpdBEvJy5psUr1H50AWRccsIHbiSwdu4=;
	h=From:To:Cc:Subject:Date:From;
	b=Q4UVmZjgClytpMEnYNFWZrg28KZCGBFzvL0We0ZRvedUCXGhAAyjjYPDrbpuCO/EC
	 xoCbH9vGsIHXIjkbaXWxPKAwieUE9+lhFtQ5CRtMbBdkR9cedKBYTPE4KwBWX4+UrV
	 jk0oyKCQI2q2CF383ClCpbABihHSbVn8lOeQj5rQejfj6rM8b8BZCuve4lH8zy2xJZ
	 veH6Bnncx7X7LIJvbTD4A9hrInwss37JQfQUPdpzmvKOqcPvTzjLN11R55svAumpz4
	 t8cpy96KBha/msUWzuPJ6PbkN32y1Uc6RKjgR2xg2btLrv2I3a2Iifvsp2wo0LJmmQ
	 J14CFwexlU4MA==
From: Bernard Rizzo <b.rizzo@student.uliege.be>
To: minios-devel@lists.xenproject.org
Cc: Bernard Rizzo <b.rizzo@student.uliege.be>,
	Mihai Pogonaru <pogonarumihai@gmail.com>,
	Felipe Huici <felipe.huici@neclab.eu>
Subject: [UNIKRAFT/NEWLIB PATCH v2 1/1] lib/newlib: Support for uksignal
Date: Sat, 16 Jan 2021 02:51:17 +0100
Message-Id: <20210116015117.311653-1-b.rizzo@student.uliege.be>
X-Mailer: git-send-email 2.25.1
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit

This patch is an update of the original.
v2: updated subject & authorship.

Signed-off-by: Mihai Pogonaru <pogonarumihai@gmail.com>
Signed-off-by: Felipe Huici <felipe.huici@neclab.eu>
Signed-off-by: Bernard Rizzo <b.rizzo@student.uliege.be>
---
 Makefile.uk      |  4 ++++
 include/signal.h | 11 +++++++++++
 plat.c           |  8 --------
 signal.c         | 50 +++++++++++++++++-------------------------------
 4 files changed, 33 insertions(+), 40 deletions(-)
 create mode 100644 include/signal.h

diff --git a/Makefile.uk b/Makefile.uk
index 82836e4..bb3b65f 100644
--- a/Makefile.uk
+++ b/Makefile.uk
@@ -136,7 +136,9 @@ LIBNEWLIBGLUE_SRCS-y += $(LIBNEWLIBC_BASE)/resource.c
 LIBNEWLIBGLUE_SRCS-y += $(LIBNEWLIBC_BASE)/pty.c
 LIBNEWLIBGLUE_SRCS-y += $(LIBNEWLIBC_BASE)/locale.c
 LIBNEWLIBGLUE_SRCS-y += $(LIBNEWLIBC_BASE)/dev.c
+ifneq ($(CONFIG_LIBUKSIGNAL),y)
 LIBNEWLIBGLUE_SRCS-y += $(LIBNEWLIBC_BASE)/signal.c
+endif
 LIBNEWLIBGLUE_SRCS-y += $(LIBNEWLIBC_BASE)/link.c
 LIBNEWLIBGLUE_SRCS-y += $(LIBNEWLIBC_BASE)/mntent.c
 LIBNEWLIBGLUE_SRCS-y += $(LIBNEWLIBC_BASE)/syscall.c
@@ -414,9 +416,11 @@ LIBNEWLIBC_SRCS-y += $(LIBNEWLIB_LIBC)/search/bsd_qsort_r.c
 ################################################################################
 # Newlib/libc code -- signal
 ################################################################################
+ifneq ($(CONFIG_LIBUKSIGNAL),y)
 LIBNEWLIBC_SRCS-y += $(LIBNEWLIB_LIBC)/signal/psignal.c
 LIBNEWLIBC_SRCS-y += $(LIBNEWLIB_LIBC)/signal/raise.c
 LIBNEWLIBC_SRCS-y += $(LIBNEWLIB_LIBC)/signal/signal.c
+endif
 
 ################################################################################
 # Newlib/libc code -- stdio
diff --git a/include/signal.h b/include/signal.h
new file mode 100644
index 0000000..778dec1
--- /dev/null
+++ b/include/signal.h
@@ -0,0 +1,11 @@
+#ifndef _NEWLIB_GLUE_SIGNAL_H_
+#define _NEWLIB_GLUE_SIGNAL_H_
+#include <uk/config.h>
+
+#if CONFIG_LIBUKSIGNAL
+#include <uk/signal.h>
+#else
+#include_next <signal.h>
+#endif
+
+#endif /* _NEWLIB_GLUE_SIGNAL_H_ */
diff --git a/plat.c b/plat.c
index df07dce..2a12801 100644
--- a/plat.c
+++ b/plat.c
@@ -47,14 +47,6 @@ int getentropy(void *buf __unused, size_t buflen __unused)
 	return -1;
 }
 
-int sigprocmask(int how __unused, const sigset_t *set __unused,
-		sigset_t *oldset __unused)
-{
-	/* TODO: implement. */
-	errno = ENOTSUP;
-	return -1;
-}
-
 #include <uk/plat/bootstrap.h>
 
 void abort(void)
diff --git a/signal.c b/signal.c
index 4279ee7..1f6cae3 100644
--- a/signal.c
+++ b/signal.c
@@ -37,51 +37,37 @@
 #include <errno.h>
 #include <signal.h>
 
+int kill(int pid __unused, int sig __unused)
+{
+	errno = EINVAL;
+	return -1;
+}
+
 int sigaction(int sig __unused, const struct sigaction *restrict act __unused,
-	      struct sigaction *restrict oact __unused)
+	     struct sigaction *restrict oact __unused)
 {
 	return 0;
 }
-
+
+int sigprocmask(int how __unused, const sigset_t *set __unused,
+				sigset_t *oldset __unused)
+{
+	/* TODO: implement. */
+	errno = ENOTSUP;
+	return -1;
+}
+
 unsigned int alarm(unsigned int seconds __unused)
 {
 	return 0;
 }
-
+
 int pause(void)
 {
 	return 0;
 }
-
+
 int siginterrupt(int sig __unused, int flag __unused)
 {
 	return 0;
 }
-
-int sigsuspend(const sigset_t *mask)
-{
-	return 0;
-}
-
-int kill(int pid, int sig __unused)
-{
-	/* TODO check sig */
-	if (pid != UNIKRAFT_PID)
-		errno = ESRCH;
-	return -1;
-}
-
-int killpg(int pgrp, int sig __unused)
-{
-	/* TODO check sig */
-	if (pgrp != UNIKRAFT_PGID)
-		errno = ESRCH;
-	return -1;
-}
-
-int sigaltstack(const stack_t *ss, stack_t *old_ss)
-{
-	WARN_STUBBED();
-	errno = ENOTSUP;
-	return -1;
-}
-- 
2.25.1



From minios-devel-bounces@lists.xenproject.org Sat Jan 16 01:53:22 2021
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Sat, 16 Jan 2021 01:53:22 +0000
Received: from list by lists.xenproject.org with outflank-mailman.68890.123448 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1l0amH-0004Bt-8w; Sat, 16 Jan 2021 01:53:21 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 68890.123448; Sat, 16 Jan 2021 01:53: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 1l0amH-0004Bm-5S; Sat, 16 Jan 2021 01:53:21 +0000
Received: by outflank-mailman (input) for mailman id 68890;
 Sat, 16 Jan 2021 01:53:20 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=8vDg=GT=student.uliege.be=b.rizzo@srs-us1.protection.inumbo.net>)
 id 1l0amG-0004Bh-1R
 for minios-devel@lists.xenproject.org; Sat, 16 Jan 2021 01:53:20 +0000
Received: from serv108.segi.ulg.ac.be (unknown [139.165.32.111])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 2535c743-0d43-4563-9397-3c3a0c84df5e;
 Sat, 16 Jan 2021 01:53:16 +0000 (UTC)
Received: from localhost.localdomain (unknown [91.182.172.238])
 (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
 (No client certificate requested)
 by serv108.segi.ulg.ac.be (Postfix) with ESMTPSA id 493D2200DFAF;
 Sat, 16 Jan 2021 02:53:15 +0100 (CET)
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: 2535c743-0d43-4563-9397-3c3a0c84df5e
DKIM-Filter: OpenDKIM Filter v2.11.0 serv108.segi.ulg.ac.be 493D2200DFAF
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=uliege.be;
	s=ulg20190529; t=1610761995;
	bh=kQkV5t6gctQTL2X4lPaJsvjKloHe9z26Be1XvpUQ91k=;
	h=From:To:Cc:Subject:Date:From;
	b=EiUb7QVON4rC+OJGrOYNfzuuTdAn1JJlGpW1BEnkaP0fC5+BSFT/YGp5bixzN/PzN
	 OtoKsj/D9UmGZ3j460tlvY3OdGaOJ4hKiJgF7k+dU+6hYcbu7mo+9hC6VLx9ZkuP8l
	 vcBONwDFbI/ca5lt+HXGYS+YqYItccm3VVryear77toXLCp9NqOgnyrhFC2w8zjece
	 Hd7xrP/1OU9+1ePtxpx/HqxVozV+8jVftk5u0NP4LKFatB7rmkmLzEA5kyAEPmBHNw
	 +iw6EJzdqCFI3JpKHDCcOyRwCdKSyhszB6PoR/gOKD5big4IvZFAU57Czbe8/DNAWE
	 G0i1mrlwvX5iA==
From: Bernard Rizzo <b.rizzo@student.uliege.be>
To: minios-devel@lists.xenproject.org
Cc: Bernard Rizzo <b.rizzo@student.uliege.be>,
	Mihai Pogonaru <pogonarumihai@gmail.com>,
	Teodora Serbanescu <teo.serbanescu16@gmail.com>,
	Felipe Huici <felipe.huici@neclab.eu>
Subject: [UNIKRAFT/PTHREAD EMBEDDED PATCH v2 1/1] lib/pthread-embedded: Support for uksignal
Date: Sat, 16 Jan 2021 02:52:32 +0100
Message-Id: <20210116015232.311798-1-b.rizzo@student.uliege.be>
X-Mailer: git-send-email 2.25.1
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit

This patch is an update of the original.
v2: updated subject & authorship.

Signed-off-by: Mihai Pogonaru <pogonarumihai@gmail.com>
Signed-off-by: Teodora Serbanescu <teo.serbanescu16@gmail.com>
Signed-off-by: Felipe Huici <felipe.huici@neclab.eu>
---
 Makefile.uk                                   |  2 ++
 include/pte_osal.h                            |  8 +++++++
 include/pte_types.h                           |  8 +++++++
 ...ead_kill_when_uk_signals_are_enabled.patch | 24 +++++++++++++++++++
 pte_osal.c                                    | 18 ++++++++++++++
 5 files changed, 60 insertions(+)
 create mode 100644 patches/0012-Add_pthread_kill_when_uk_signals_are_enabled.patch

diff --git a/Makefile.uk b/Makefile.uk
index 4ee37cd..2611c7d 100644
--- a/Makefile.uk
+++ b/Makefile.uk
@@ -65,7 +65,9 @@ LIBPTHREAD-EMBEDDED_CXXFLAGS-y += $(LIBPTHREAD-EMBEDDED_SUPPRESS_FLAGS)
 LIBPTHREAD-EMBEDDED_SRCS-y += $(LIBPTHREAD-EMBEDDED_BASE)/pte_osal.c|glue
 LIBPTHREAD-EMBEDDED_SRCS-y += $(LIBPTHREAD-EMBEDDED_BASE)/attributes.c|glue
 LIBPTHREAD-EMBEDDED_SRCS-y += $(LIBPTHREAD-EMBEDDED_BASE)/pthread_atfork.c|glue
+ifneq ($(CONFIG_LIBUKSIGNAL),y)
 LIBPTHREAD-EMBEDDED_SRCS-y += $(LIBPTHREAD-EMBEDDED_BASE)/pthread_sigmask.c|glue
+endif
 LIBPTHREAD-EMBEDDED_SRCS-y += $(LIBPTHREAD-EMBEDDED_BASE)/pthread_condattr.c|glue
 
 ################################################################################
diff --git a/include/pte_osal.h b/include/pte_osal.h
index bcf5374..34122ea 100644
--- a/include/pte_osal.h
+++ b/include/pte_osal.h
@@ -4,10 +4,18 @@
 #include <uk/mutex.h>
 #include <uk/semaphore.h>
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 typedef struct uk_thread* pte_osThreadHandle;
 typedef struct uk_semaphore *pte_osSemaphoreHandle;
 typedef struct uk_mutex *pte_osMutexHandle;
 
+#ifdef __cplusplus
+}
+#endif
+
 #define OS_MAX_SIMUL_THREADS \
 	CONFIG_LIBPTHREAD_EMBEDDED_MAX_SIMUL_THREADS
 
diff --git a/include/pte_types.h b/include/pte_types.h
index c9081fa..817e313 100644
--- a/include/pte_types.h
+++ b/include/pte_types.h
@@ -3,8 +3,16 @@
 
 #include <sys/timeb.h>
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 typedef unsigned int tid_t;
 
 typedef int pid_t;
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* __PTE_TYPES_H__ */
diff --git a/patches/0012-Add_pthread_kill_when_uk_signals_are_enabled.patch b/patches/0012-Add_pthread_kill_when_uk_signals_are_enabled.patch
new file mode 100644
index 0000000..cf30aca
--- /dev/null
+++ b/patches/0012-Add_pthread_kill_when_uk_signals_are_enabled.patch
@@ -0,0 +1,24 @@
+diff --git a/pthread_kill.c b/pthread_kill.c
+index 3a6daf6..4ea7448 100644
+--- a/pthread_kill.c
++++ b/pthread_kill.c
+@@ -47,7 +47,9 @@
+ #include "pthread.h"
+ #include "implement.h"
+
+-#ifdef __hermit__
++#include <uk/config.h>
++
++#if CONFIG_LIBUKSIGNAL
+ int pte_kill(pte_osThreadHandle threadId, int sig);
+ #endif
+
+@@ -98,7 +100,7 @@ pthread_kill (pthread_t thread, int sig)
+
+   pte_osMutexUnlock(pte_thread_reuse_lock);
+
+-#ifdef __hermit__
++#if CONFIG_LIBUKSIGNAL
+   result = pte_kill(tp->threadId, sig);
+ #else
+   if (0 == result && 0 != sig)
diff --git a/pte_osal.c b/pte_osal.c
index 640c3e4..0aac5fd 100644
--- a/pte_osal.c
+++ b/pte_osal.c
@@ -103,6 +103,19 @@ out:
 	return result;
 }
 
+/***************************************************************************
+ *
+ * Signal handling
+ *
+ **************************************************************************/
+#if CONFIG_LIBUKSIGNAL
+int pte_kill(pte_osThreadHandle threadId, int sig)
+{
+	return uk_sig_thread_kill(threadId, sig);
+}
+#endif
+
+
 /****************************************************************************
  *
  * Threads
@@ -162,6 +175,11 @@ pte_osResult pte_osThreadCreate(pte_osThreadEntryPoint entry_point,
 		return PTE_OS_NO_RESOURCES;
 	}
 
+#if CONFIG_LIBUKSIGNAL
+	/* inherit signal mask */
+	ptd->uk_thread->signals_container.mask = uk_thread_current()->signals_container.mask;
+#endif
+
 	ptd->uk_thread->prv = ptd;
 
 	*ph = ptd->uk_thread;
-- 
2.25.1



From minios-devel-bounces@lists.xenproject.org Tue Jan 19 10:39:36 2021
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Tue, 19 Jan 2021 10:39:36 +0000
Received: from list by lists.xenproject.org with outflank-mailman.70252.126011 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1l1oQ9-0007xI-V7; Tue, 19 Jan 2021 10:39:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 70252.126011; Tue, 19 Jan 2021 10:39: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 1l1oQ9-0007xB-S1; Tue, 19 Jan 2021 10:39:33 +0000
Received: by outflank-mailman (input) for mailman id 70252;
 Tue, 19 Jan 2021 10:39: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=N6Sb=GW=gmail.com=dragosargint21@srs-us1.protection.inumbo.net>)
 id 1l1oQ8-0007x6-O6
 for minios-devel@lists.xenproject.org; Tue, 19 Jan 2021 10:39:32 +0000
Received: from mail-wr1-x42d.google.com (unknown [2a00:1450:4864:20::42d])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 68e5c69e-aa9c-42d4-9232-b170b6cfb63d;
 Tue, 19 Jan 2021 10:39:31 +0000 (UTC)
Received: by mail-wr1-x42d.google.com with SMTP id a12so19184067wrv.8
 for <minios-devel@lists.xenproject.org>; Tue, 19 Jan 2021 02: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: 68e5c69e-aa9c-42d4-9232-b170b6cfb63d
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=FyV4iuS5YnLVwe2YldCwkagecLb/atYfuzNearJJ3UY=;
        b=WrYpEFe+uEt5/iJrmNNveagoxYRQZJb+FTSi9WA+VpqT7l5PjHi3FKkfoC6GJeV3FC
         pBtqykZ9E96KfXiUCYE+A6ymsYxxjkYBVaoOSHE4hpFK1NFxZSzhD/zFGyMLqXOw6uLk
         kOZccG/bIJJiSnaZp/DOZntVlDEx4Nwy9xwx6sbBIIVwDa1uRP/BJaW5ntSezVvYuT36
         bCQOh/qVzqnbQYYjLUWYq1aEaf13C/dEMgHWrfDR0uiVaQ6ob2GO0+n9tLx9FantnRgG
         QoLjVV7RYsU4lGvQnXALre1JftqekJfkh/dVtYjBaYqjKM69Nj4JNnZ8uYG1vtz4X7VR
         rx/g==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20161025;
        h=x-gm-message-state:mime-version:references:in-reply-to:from:date
         :message-id:subject:to:cc;
        bh=FyV4iuS5YnLVwe2YldCwkagecLb/atYfuzNearJJ3UY=;
        b=QO7UbGX8qwhUchRP9DIyFnBCs597rv0dnljWLCEJ0ywktLgfz/yKtxIXd8o+EcfS6I
         iLWr0i2yRwV92XMl26SlMB0v9wtq3bndcGiMs2ackcfUqEWm9DO6Bbts4Y5iqsUfMVBl
         6p4LqSBcAn4nZnkFB5TJWj2Fo8jsJLMTiVCNDhsgsa0EndLMK/4FTGJZEUi0AIdZODSi
         dj+5QDlTmxL6REbKMBk7nD4RzmGFG/McSAfWo8E/OVrnNzAEPv+N4GmYrNCyjQPydLzc
         6zaF9pUT1tjRz27EP2EGR1PDnELoxMWcImbmlwGSDJ/K/XlTepgePktxZ7W8/x5vDA3j
         2+iA==
X-Gm-Message-State: AOAM531EWofZWVe/w9GSUSHisbIqqM9OSHnqVK6IVOPoQSthr5wVWO0/
	RmXjcL7bHYkmsP1BlU1xBc2MkVOQmEmSQeAomyU=
X-Google-Smtp-Source: ABdhPJx6KT2e4g8wffFAu2cbGsthy0adzWUQ3ncXLNBamyc5Za1xyfdFHmYyzthvEvJ1WoFFDNR5ifRzRRPuSBKMqOg=
X-Received: by 2002:a05:6000:18a3:: with SMTP id b3mr3701085wri.373.1611052770098;
 Tue, 19 Jan 2021 02:39:30 -0800 (PST)
MIME-Version: 1.0
References: <20210116015232.311798-1-b.rizzo@student.uliege.be>
In-Reply-To: <20210116015232.311798-1-b.rizzo@student.uliege.be>
From: dragos argint <dragosargint21@gmail.com>
Date: Tue, 19 Jan 2021 12:39:19 +0200
Message-ID: <CANTUrUmU+9sYZ67Jgd5yNP7t1gRk0-4Ae8r7RAd3iGFjGb3kUg@mail.gmail.com>
Subject: Re: [UNIKRAFT/PTHREAD EMBEDDED PATCH v2 1/1] lib/pthread-embedded:
 Support for uksignal
To: Bernard Rizzo <b.rizzo@student.uliege.be>
Cc: minios-devel@lists.xenproject.org, 
	Mihai Pogonaru <pogonarumihai@gmail.com>, Teodora Serbanescu <teo.serbanescu16@gmail.com>, 
	Felipe Huici <felipe.huici@neclab.eu>
Content-Type: multipart/alternative; boundary="00000000000013800f05b93e74b8"

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

Hi, Bernard

It looks good to me!

Reviewed-by: ARGINT DRAGOS IULIAN <dragosargint21@gmail.com>

=C3=8En s=C3=A2m., 16 ian. 2021 la 03:53, Bernard Rizzo <b.rizzo@student.ul=
iege.be> a
scris:

> This patch is an update of the original.
> v2: updated subject & authorship.
>
> Signed-off-by: Mihai Pogonaru <pogonarumihai@gmail.com>
> Signed-off-by: Teodora Serbanescu <teo.serbanescu16@gmail.com>
> Signed-off-by: Felipe Huici <felipe.huici@neclab.eu>
> ---
>  Makefile.uk                                   |  2 ++
>  include/pte_osal.h                            |  8 +++++++
>  include/pte_types.h                           |  8 +++++++
>  ...ead_kill_when_uk_signals_are_enabled.patch | 24 +++++++++++++++++++
>  pte_osal.c                                    | 18 ++++++++++++++
>  5 files changed, 60 insertions(+)
>  create mode 100644
> patches/0012-Add_pthread_kill_when_uk_signals_are_enabled.patch
>
> diff --git a/Makefile.uk b/Makefile.uk
> index 4ee37cd..2611c7d 100644
> --- a/Makefile.uk
> +++ b/Makefile.uk
> @@ -65,7 +65,9 @@ LIBPTHREAD-EMBEDDED_CXXFLAGS-y +=3D
> $(LIBPTHREAD-EMBEDDED_SUPPRESS_FLAGS)
>  LIBPTHREAD-EMBEDDED_SRCS-y +=3D $(LIBPTHREAD-EMBEDDED_BASE)/pte_osal.c|g=
lue
>  LIBPTHREAD-EMBEDDED_SRCS-y +=3D
> $(LIBPTHREAD-EMBEDDED_BASE)/attributes.c|glue
>  LIBPTHREAD-EMBEDDED_SRCS-y +=3D
> $(LIBPTHREAD-EMBEDDED_BASE)/pthread_atfork.c|glue
> +ifneq ($(CONFIG_LIBUKSIGNAL),y)
>  LIBPTHREAD-EMBEDDED_SRCS-y +=3D
> $(LIBPTHREAD-EMBEDDED_BASE)/pthread_sigmask.c|glue
> +endif
>  LIBPTHREAD-EMBEDDED_SRCS-y +=3D
> $(LIBPTHREAD-EMBEDDED_BASE)/pthread_condattr.c|glue
>
>
>  ########################################################################=
########
> diff --git a/include/pte_osal.h b/include/pte_osal.h
> index bcf5374..34122ea 100644
> --- a/include/pte_osal.h
> +++ b/include/pte_osal.h
> @@ -4,10 +4,18 @@
>  #include <uk/mutex.h>
>  #include <uk/semaphore.h>
>
> +#ifdef __cplusplus
> +extern "C" {
> +#endif
> +
>  typedef struct uk_thread* pte_osThreadHandle;
>  typedef struct uk_semaphore *pte_osSemaphoreHandle;
>  typedef struct uk_mutex *pte_osMutexHandle;
>
> +#ifdef __cplusplus
> +}
> +#endif
> +
>  #define OS_MAX_SIMUL_THREADS \
>         CONFIG_LIBPTHREAD_EMBEDDED_MAX_SIMUL_THREADS
>
> diff --git a/include/pte_types.h b/include/pte_types.h
> index c9081fa..817e313 100644
> --- a/include/pte_types.h
> +++ b/include/pte_types.h
> @@ -3,8 +3,16 @@
>
>  #include <sys/timeb.h>
>
> +#ifdef __cplusplus
> +extern "C" {
> +#endif
> +
>  typedef unsigned int tid_t;
>
>  typedef int pid_t;
>
> +#ifdef __cplusplus
> +}
> +#endif
> +
>  #endif /* __PTE_TYPES_H__ */
> diff --git
> a/patches/0012-Add_pthread_kill_when_uk_signals_are_enabled.patch
> b/patches/0012-Add_pthread_kill_when_uk_signals_are_enabled.patch
> new file mode 100644
> index 0000000..cf30aca
> --- /dev/null
> +++ b/patches/0012-Add_pthread_kill_when_uk_signals_are_enabled.patch
> @@ -0,0 +1,24 @@
> +diff --git a/pthread_kill.c b/pthread_kill.c
> +index 3a6daf6..4ea7448 100644
> +--- a/pthread_kill.c
> ++++ b/pthread_kill.c
> +@@ -47,7 +47,9 @@
> + #include "pthread.h"
> + #include "implement.h"
> +
> +-#ifdef __hermit__
> ++#include <uk/config.h>
> ++
> ++#if CONFIG_LIBUKSIGNAL
> + int pte_kill(pte_osThreadHandle threadId, int sig);
> + #endif
> +
> +@@ -98,7 +100,7 @@ pthread_kill (pthread_t thread, int sig)
> +
> +   pte_osMutexUnlock(pte_thread_reuse_lock);
> +
> +-#ifdef __hermit__
> ++#if CONFIG_LIBUKSIGNAL
> +   result =3D pte_kill(tp->threadId, sig);
> + #else
> +   if (0 =3D=3D result && 0 !=3D sig)
> diff --git a/pte_osal.c b/pte_osal.c
> index 640c3e4..0aac5fd 100644
> --- a/pte_osal.c
> +++ b/pte_osal.c
> @@ -103,6 +103,19 @@ out:
>         return result;
>  }
>
>
> +/***********************************************************************=
****
> + *
> + * Signal handling
> + *
> +
> *************************************************************************=
*/
> +#if CONFIG_LIBUKSIGNAL
> +int pte_kill(pte_osThreadHandle threadId, int sig)
> +{
> +       return uk_sig_thread_kill(threadId, sig);
> +}
> +#endif
> +
> +
>
>  /***********************************************************************=
*****
>   *
>   * Threads
> @@ -162,6 +175,11 @@ pte_osResult
> pte_osThreadCreate(pte_osThreadEntryPoint entry_point,
>                 return PTE_OS_NO_RESOURCES;
>         }
>
> +#if CONFIG_LIBUKSIGNAL
> +       /* inherit signal mask */
> +       ptd->uk_thread->signals_container.mask =3D
> uk_thread_current()->signals_container.mask;
> +#endif
> +
>         ptd->uk_thread->prv =3D ptd;
>
>         *ph =3D ptd->uk_thread;
> --
> 2.25.1
>
>
>

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

<div dir=3D"ltr">Hi, Bernard<div><br></div><div>It looks good to me!</div><=
div><br></div><div>Reviewed-by: ARGINT DRAGOS IULIAN &lt;<a href=3D"mailto:=
dragosargint21@gmail.com">dragosargint21@gmail.com</a>&gt;</div></div><br><=
div class=3D"gmail_quote"><div dir=3D"ltr" class=3D"gmail_attr">=C3=8En s=
=C3=A2m., 16 ian. 2021 la 03:53, Bernard Rizzo &lt;<a href=3D"mailto:b.rizz=
o@student.uliege.be">b.rizzo@student.uliege.be</a>&gt; a scris:<br></div><b=
lockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-le=
ft:1px solid rgb(204,204,204);padding-left:1ex">This patch is an update of =
the original.<br>
v2: updated subject &amp; authorship.<br>
<br>
Signed-off-by: Mihai Pogonaru &lt;<a href=3D"mailto:pogonarumihai@gmail.com=
" target=3D"_blank">pogonarumihai@gmail.com</a>&gt;<br>
Signed-off-by: Teodora Serbanescu &lt;<a href=3D"mailto:teo.serbanescu16@gm=
ail.com" target=3D"_blank">teo.serbanescu16@gmail.com</a>&gt;<br>
Signed-off-by: Felipe Huici &lt;<a href=3D"mailto:felipe.huici@neclab.eu" t=
arget=3D"_blank">felipe.huici@neclab.eu</a>&gt;<br>
---<br>
=C2=A0Makefile.uk=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0|=C2=
=A0 2 ++<br>
=C2=A0include/pte_osal.h=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 |=C2=A0 8 +++++++<br>
=C2=A0include/pte_types.h=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0|=C2=A0 8 +++++++<br>
=C2=A0...ead_kill_when_uk_signals_are_enabled.patch | 24 ++++++++++++++++++=
+<br>
=C2=A0pte_osal.c=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 | 18 +++=
+++++++++++<br>
=C2=A05 files changed, 60 insertions(+)<br>
=C2=A0create mode 100644 patches/0012-Add_pthread_kill_when_uk_signals_are_=
enabled.patch<br>
<br>
diff --git a/Makefile.uk b/Makefile.uk<br>
index 4ee37cd..2611c7d 100644<br>
--- a/Makefile.uk<br>
+++ b/Makefile.uk<br>
@@ -65,7 +65,9 @@ LIBPTHREAD-EMBEDDED_CXXFLAGS-y +=3D $(LIBPTHREAD-EMBEDDED=
_SUPPRESS_FLAGS)<br>
=C2=A0LIBPTHREAD-EMBEDDED_SRCS-y +=3D $(LIBPTHREAD-EMBEDDED_BASE)/pte_osal.=
c|glue<br>
=C2=A0LIBPTHREAD-EMBEDDED_SRCS-y +=3D $(LIBPTHREAD-EMBEDDED_BASE)/attribute=
s.c|glue<br>
=C2=A0LIBPTHREAD-EMBEDDED_SRCS-y +=3D $(LIBPTHREAD-EMBEDDED_BASE)/pthread_a=
tfork.c|glue<br>
+ifneq ($(CONFIG_LIBUKSIGNAL),y)<br>
=C2=A0LIBPTHREAD-EMBEDDED_SRCS-y +=3D $(LIBPTHREAD-EMBEDDED_BASE)/pthread_s=
igmask.c|glue<br>
+endif<br>
=C2=A0LIBPTHREAD-EMBEDDED_SRCS-y +=3D $(LIBPTHREAD-EMBEDDED_BASE)/pthread_c=
ondattr.c|glue<br>
<br>
=C2=A0#####################################################################=
###########<br>
diff --git a/include/pte_osal.h b/include/pte_osal.h<br>
index bcf5374..34122ea 100644<br>
--- a/include/pte_osal.h<br>
+++ b/include/pte_osal.h<br>
@@ -4,10 +4,18 @@<br>
=C2=A0#include &lt;uk/mutex.h&gt;<br>
=C2=A0#include &lt;uk/semaphore.h&gt;<br>
<br>
+#ifdef __cplusplus<br>
+extern &quot;C&quot; {<br>
+#endif<br>
+<br>
=C2=A0typedef struct uk_thread* pte_osThreadHandle;<br>
=C2=A0typedef struct uk_semaphore *pte_osSemaphoreHandle;<br>
=C2=A0typedef struct uk_mutex *pte_osMutexHandle;<br>
<br>
+#ifdef __cplusplus<br>
+}<br>
+#endif<br>
+<br>
=C2=A0#define OS_MAX_SIMUL_THREADS \<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 CONFIG_LIBPTHREAD_EMBEDDED_MAX_SIMUL_THREADS<br=
>
<br>
diff --git a/include/pte_types.h b/include/pte_types.h<br>
index c9081fa..817e313 100644<br>
--- a/include/pte_types.h<br>
+++ b/include/pte_types.h<br>
@@ -3,8 +3,16 @@<br>
<br>
=C2=A0#include &lt;sys/timeb.h&gt;<br>
<br>
+#ifdef __cplusplus<br>
+extern &quot;C&quot; {<br>
+#endif<br>
+<br>
=C2=A0typedef unsigned int tid_t;<br>
<br>
=C2=A0typedef int pid_t;<br>
<br>
+#ifdef __cplusplus<br>
+}<br>
+#endif<br>
+<br>
=C2=A0#endif /* __PTE_TYPES_H__ */<br>
diff --git a/patches/0012-Add_pthread_kill_when_uk_signals_are_enabled.patc=
h b/patches/0012-Add_pthread_kill_when_uk_signals_are_enabled.patch<br>
new file mode 100644<br>
index 0000000..cf30aca<br>
--- /dev/null<br>
+++ b/patches/0012-Add_pthread_kill_when_uk_signals_are_enabled.patch<br>
@@ -0,0 +1,24 @@<br>
+diff --git a/pthread_kill.c b/pthread_kill.c<br>
+index 3a6daf6..4ea7448 100644<br>
+--- a/pthread_kill.c<br>
++++ b/pthread_kill.c<br>
+@@ -47,7 +47,9 @@<br>
+ #include &quot;pthread.h&quot;<br>
+ #include &quot;implement.h&quot;<br>
+<br>
+-#ifdef __hermit__<br>
++#include &lt;uk/config.h&gt;<br>
++<br>
++#if CONFIG_LIBUKSIGNAL<br>
+ int pte_kill(pte_osThreadHandle threadId, int sig);<br>
+ #endif<br>
+<br>
+@@ -98,7 +100,7 @@ pthread_kill (pthread_t thread, int sig)<br>
+<br>
+=C2=A0 =C2=A0pte_osMutexUnlock(pte_thread_reuse_lock);<br>
+<br>
+-#ifdef __hermit__<br>
++#if CONFIG_LIBUKSIGNAL<br>
+=C2=A0 =C2=A0result =3D pte_kill(tp-&gt;threadId, sig);<br>
+ #else<br>
+=C2=A0 =C2=A0if (0 =3D=3D result &amp;&amp; 0 !=3D sig)<br>
diff --git a/pte_osal.c b/pte_osal.c<br>
index 640c3e4..0aac5fd 100644<br>
--- a/pte_osal.c<br>
+++ b/pte_osal.c<br>
@@ -103,6 +103,19 @@ out:<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 return result;<br>
=C2=A0}<br>
<br>
+/*************************************************************************=
**<br>
+ *<br>
+ * Signal handling<br>
+ *<br>
+ *************************************************************************=
*/<br>
+#if CONFIG_LIBUKSIGNAL<br>
+int pte_kill(pte_osThreadHandle threadId, int sig)<br>
+{<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0return uk_sig_thread_kill(threadId, sig);<br>
+}<br>
+#endif<br>
+<br>
+<br>
=C2=A0/********************************************************************=
********<br>
=C2=A0 *<br>
=C2=A0 * Threads<br>
@@ -162,6 +175,11 @@ pte_osResult pte_osThreadCreate(pte_osThreadEntryPoint=
 entry_point,<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 return PTE_OS_NO_RE=
SOURCES;<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 }<br>
<br>
+#if CONFIG_LIBUKSIGNAL<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0/* inherit signal mask */<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0ptd-&gt;uk_thread-&gt;signals_container.mask =
=3D uk_thread_current()-&gt;signals_container.mask;<br>
+#endif<br>
+<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 ptd-&gt;uk_thread-&gt;prv =3D ptd;<br>
<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 *ph =3D ptd-&gt;uk_thread;<br>
-- <br>
2.25.1<br>
<br>
<br>
</blockquote></div>

--00000000000013800f05b93e74b8--


From minios-devel-bounces@lists.xenproject.org Tue Jan 19 10:45:45 2021
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Tue, 19 Jan 2021 10:45:45 +0000
Received: from list by lists.xenproject.org with outflank-mailman.70253.126015 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1l1oW8-0000Hm-Fb; Tue, 19 Jan 2021 10:45:44 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 70253.126015; Tue, 19 Jan 2021 10:45: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 1l1oW8-0000Hf-CU; Tue, 19 Jan 2021 10:45:44 +0000
Received: by outflank-mailman (input) for mailman id 70253;
 Tue, 19 Jan 2021 10:45: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=N6Sb=GW=gmail.com=dragosargint21@srs-us1.protection.inumbo.net>)
 id 1l1oW7-0000Ha-BO
 for minios-devel@lists.xenproject.org; Tue, 19 Jan 2021 10:45:43 +0000
Received: from mail-wm1-x32e.google.com (unknown [2a00:1450:4864:20::32e])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 57b1d8a8-26b6-4519-95e0-331020258b87;
 Tue, 19 Jan 2021 10:45:36 +0000 (UTC)
Received: by mail-wm1-x32e.google.com with SMTP id s24so1353446wmj.0
 for <minios-devel@lists.xenproject.org>; Tue, 19 Jan 2021 02:45: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: 57b1d8a8-26b6-4519-95e0-331020258b87
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=urWHUx0GGKQ+M11bqdX4vInkJ6pLeNlZEV7Fe0lO4E0=;
        b=tX8hrR8Zshl2QoigfTKak5+HDiF4O2aLE4Y2amFa50s2YVpJ8qa9+aO+L6wOX/rY4d
         jNDbucnv4kC4wP0IVg09v01mo8PYpmfUfDRKJogGCTBGIMQT+Qo+C79fXlT7CsA2NYd0
         1Do5KD3S5cs2UpbphbUcam7kireOJ5DFHpMaiLLHbBElMF83qb4mI4HAgh3TRuJh5s9n
         jqXcP3CXFwY5gG2CE3j7SFLiB/xhNV4wjs0hwZOdURs9UwT99Vl3SmgvMvQ9bKJyMbfw
         ZQF1Ju4QHhlfKOvEWiUlC4gxlCFz2FtCjza+C9308ibfWecNikhwEzfEMjvU4NZxqzy/
         MY6Q==
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=urWHUx0GGKQ+M11bqdX4vInkJ6pLeNlZEV7Fe0lO4E0=;
        b=JPPCTMhU8BXCJjPcyZpQRTYRlALmUxSl8QBLECeaBxbGX2g9k2FGKLnsGYaLhUDxs2
         veIaEEZs++mN09G7HrTtPi1gw/5uG9iFBrWqDtXvcI903nKw7/JP9MXD9LiHkqj+Gpgw
         Nevh9mhQ+lPs8dVkTyY9+/h7ZGfUAA/ufFEQRLkxjV+OPqEFsgIXgswX8SMniNcySS5V
         MYkbUVFoqH54KNXXc4uu8GW2WrY2KpdNC5xZkFesowNRCmWx2FZ4zSjwVSla1PB2ecoL
         pEQ4I5WnkbzkhkuENlfNB8ri0hUwB+cBtQO6EzwcID/bpQYaqToEDAHZaA/kqj01QRzu
         l4ig==
X-Gm-Message-State: AOAM5307Q8s1P8GNeiIccKYciTGPUdW1I4dsiAOAZa3/pDwXzIbkTCjt
	NkqwtLiKcaGVCfkpad6eKZkMYavULYqOEL5MvtA=
X-Google-Smtp-Source: ABdhPJwjAYyVd09CCeGqcBaAh9NX5UGn/bhFetHzKjJWqjBOHWIiQnB6HAPkOqoz56JdwySTChMBPMoIkJYHgba8BRs=
X-Received: by 2002:a1c:7402:: with SMTP id p2mr3384661wmc.43.1611053135765;
 Tue, 19 Jan 2021 02:45:35 -0800 (PST)
MIME-Version: 1.0
References: <20210116011207.307983-1-b.rizzo@student.uliege.be>
In-Reply-To: <20210116011207.307983-1-b.rizzo@student.uliege.be>
From: dragos argint <dragosargint21@gmail.com>
Date: Tue, 19 Jan 2021 12:45:24 +0200
Message-ID: <CANTUrUkwu3enSPdKn_59kvSMB+ygxKBgd+TvaDMatdB0hqX4Hw@mail.gmail.com>
Subject: Re: [UNIKRAFT PATCH 1/1] lib/uksignal: initial code
To: Bernard Rizzo <b.rizzo@student.uliege.be>
Cc: minios-devel@lists.xenproject.org, 
	Mihai Pogonaru <pogonarumihai@gmail.com>, Teodora Serbanescu <teo.serbanescu16@gmail.com>, 
	Felipe Huici <felipe.huici@neclab.eu>
Content-Type: multipart/alternative; boundary="000000000000df264105b93e89a4"

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

Hi, Bernard

It looks good to me!

Reviewed-by: ARGINT DRAGOS IULIAN <dragosargint21@gmail.com>

=C3=8En s=C3=A2m., 16 ian. 2021 la 03:13, Bernard Rizzo <b.rizzo@student.ul=
iege.be> a
scris:

> uksignal provides a basic implementation of signals over Unikraft. It
> supports signals between threads and process wide signals. It provides
> all the definitions needed for signals so we must disable the
> definitions provided in libc to run it.
>
> It does not support signal codes, rt signals and executes the signal
> handlers on the thread stack. It is also not yet integrated with our
> irqs to deliver signals like SIGSEGV.
>
> This implementation is not complete; it is meant as a temporory
> solution until we have a proper events delivering system.
>
> This patch is an update of the original.
>
> Signed-off-by: Mihai Pogonaru <pogonarumihai@gmail.com>
> Signed-off-by: Teodora Serbanescu <teo.serbanescu16@gmail.com>
> Signed-off-by: Felipe Huici <felipe.huici@neclab.eu>
> Signed-off-by: Bernard Rizzo <b.rizzo@student.uliege.be>
> ---
>  lib/Makefile.uk                            |   1 +
>  lib/uksched/include/uk/thread.h            |   6 +
>  lib/uksched/sched.c                        |   7 +
>  lib/uksched/thread.c                       |   6 +
>  lib/uksignal/Config.uk                     |   7 +
>  lib/uksignal/Makefile.uk                   |   8 +
>  lib/uksignal/README                        |   7 +
>  lib/uksignal/exportsyms.uk                 |  27 ++
>  lib/uksignal/include/uk/bits/sigset.h      |  66 +++
>  lib/uksignal/include/uk/signal.h           | 131 ++++++
>  lib/uksignal/include/uk/string/strsignal.h |  19 +
>  lib/uksignal/include/uk/uk_signal.h        | 136 +++++++
>  lib/uksignal/signal.c                      | 320 +++++++++++++++
>  lib/uksignal/sigset.c                      |  51 +++
>  lib/uksignal/strsignal.c                   |  61 +++
>  lib/uksignal/uk_signal.c                   | 451 +++++++++++++++++++++
>  plat/common/x86/thread_start.S             |   7 +
>  17 files changed, 1311 insertions(+)
>  create mode 100644 lib/uksignal/Config.uk
>  create mode 100644 lib/uksignal/Makefile.uk
>  create mode 100644 lib/uksignal/README
>  create mode 100644 lib/uksignal/exportsyms.uk
>  create mode 100644 lib/uksignal/include/uk/bits/sigset.h
>  create mode 100644 lib/uksignal/include/uk/signal.h
>  create mode 100644 lib/uksignal/include/uk/string/strsignal.h
>  create mode 100644 lib/uksignal/include/uk/uk_signal.h
>  create mode 100644 lib/uksignal/signal.c
>  create mode 100644 lib/uksignal/sigset.c
>  create mode 100644 lib/uksignal/strsignal.c
>  create mode 100644 lib/uksignal/uk_signal.c
>
> diff --git a/lib/Makefile.uk b/lib/Makefile.uk
> index 07e8a29..f50795d 100644
> --- a/lib/Makefile.uk
> +++ b/lib/Makefile.uk
> @@ -37,3 +37,4 @@ $(eval $(call _import_lib,$(CONFIG_UK_BASE)/lib/ukmmap)=
)
>  $(eval $(call _import_lib,$(CONFIG_UK_BASE)/lib/ukblkdev))
>  $(eval $(call _import_lib,$(CONFIG_UK_BASE)/lib/posix-process))
>  $(eval $(call _import_lib,$(CONFIG_UK_BASE)/lib/uksp))
> +$(eval $(call _import_lib,$(CONFIG_UK_BASE)/lib/uksignal))
> diff --git a/lib/uksched/include/uk/thread.h
> b/lib/uksched/include/uk/thread.h
> index d8a4ac8..5ec25a8 100644
> --- a/lib/uksched/include/uk/thread.h
> +++ b/lib/uksched/include/uk/thread.h
> @@ -36,6 +36,9 @@
>  #include <uk/arch/lcpu.h>
>  #include <uk/arch/time.h>
>  #include <uk/plat/thread.h>
> +#if CONFIG_LIBUKSIGNAL
> +#include <uk/uk_signal.h>
> +#endif
>  #include <uk/thread_attr.h>
>  #include <uk/wait_types.h>
>  #include <uk/list.h>
> @@ -62,6 +65,9 @@ struct uk_thread {
>  #ifdef CONFIG_LIBNEWLIBC
>         struct _reent reent;
>  #endif
> +#if CONFIG_LIBUKSIGNAL
> +       struct uk_thread_sig signals_container;
> +#endif
>  };
>
>  UK_TAILQ_HEAD(uk_thread_list, struct uk_thread);
> diff --git a/lib/uksched/sched.c b/lib/uksched/sched.c
> index 4b8e149..5a58629 100644
> --- a/lib/uksched/sched.c
> +++ b/lib/uksched/sched.c
> @@ -42,6 +42,9 @@
>  #if CONFIG_LIBUKSCHEDCOOP
>  #include <uk/schedcoop.h>
>  #endif
> +#if CONFIG_LIBUKSIGNAL
> +#include <uk/uk_signal.h>
> +#endif
>
>  struct uk_sched *uk_sched_head;
>
> @@ -50,6 +53,10 @@ struct uk_sched *uk_sched_default_init(struct uk_alloc
> *a)
>  {
>         struct uk_sched *s =3D NULL;
>
> +#if CONFIG_LIBUKSIGNAL
> +       uk_proc_sig_init(&uk_proc_sig);
> +#endif
> +
>  #if CONFIG_LIBUKSCHEDCOOP
>         s =3D uk_schedcoop_init(a);
>  #endif
> diff --git a/lib/uksched/thread.c b/lib/uksched/thread.c
> index f8ae786..609a4ce 100644
> --- a/lib/uksched/thread.c
> +++ b/lib/uksched/thread.c
> @@ -125,6 +125,9 @@ int uk_thread_init(struct uk_thread *thread,
>  #ifdef CONFIG_LIBNEWLIBC
>         reent_init(&thread->reent);
>  #endif
> +#if CONFIG_LIBUKSIGNAL
> +       uk_thread_sig_init(&thread->signals_container);
> +#endif
>
>         uk_pr_info("Thread \"%s\": pointer: %p, stack: %p, tls: %p\n",
>                    name, thread, thread->stack, thread->tls);
> @@ -135,6 +138,9 @@ int uk_thread_init(struct uk_thread *thread,
>  void uk_thread_fini(struct uk_thread *thread, struct uk_alloc *allocator=
)
>  {
>         UK_ASSERT(thread !=3D NULL);
> +#if CONFIG_LIBUKSIGNAL
> +       uk_thread_sig_uninit(&thread->signals_container);
> +#endif
>         ukplat_thread_ctx_destroy(allocator, thread->ctx);
>  }
>
> diff --git a/lib/uksignal/Config.uk b/lib/uksignal/Config.uk
> new file mode 100644
> index 0000000..56c1644
> --- /dev/null
> +++ b/lib/uksignal/Config.uk
> @@ -0,0 +1,7 @@
> +menuconfig LIBUKSIGNAL
> +       bool "uksignal: Unikraft signals"
> +       default n
> +       select LIBNOLIBC if !HAVE_LIBC
> +       select LIBUKDEBUG
> +       select LIBUKALLOC
> +       select LIBUKSCHED
> diff --git a/lib/uksignal/Makefile.uk b/lib/uksignal/Makefile.uk
> new file mode 100644
> index 0000000..0f1f539
> --- /dev/null
> +++ b/lib/uksignal/Makefile.uk
> @@ -0,0 +1,8 @@
> +$(eval $(call addlib_s,libuksignal,$(CONFIG_LIBUKSIGNAL)))
> +
> +CINCLUDES-$(CONFIG_LIBUKSIGNAL)     +=3D -I$(LIBUKSIGNAL_BASE)/include
> +CXXINCLUDES-$(CONFIG_LIBUKSIGNAL)   +=3D -I$(LIBUKSIGNAL_BASE)/include
> +
> +LIBUKSIGNAL_SRCS-y +=3D $(LIBUKSIGNAL_BASE)/signal.c
> +LIBUKSIGNAL_SRCS-y +=3D $(LIBUKSIGNAL_BASE)/sigset.c
> +LIBUKSIGNAL_SRCS-y +=3D $(LIBUKSIGNAL_BASE)/uk_signal.c
> \ No newline at end of file
> diff --git a/lib/uksignal/README b/lib/uksignal/README
> new file mode 100644
> index 0000000..ff8691f
> --- /dev/null
> +++ b/lib/uksignal/README
> @@ -0,0 +1,7 @@
> +This library provides a basic implementation of signals over
> +Unikraft. It supports signals between threads and process wide
> +signals.
> +
> +It doesn't support signal codes, rt signals and executes the signal
> +handlers on the thread stack. It is also not yet integrated with our
> +irqs to deliver signals like SIGSEGV.
> \ No newline at end of file
> diff --git a/lib/uksignal/exportsyms.uk b/lib/uksignal/exportsyms.uk
> new file mode 100644
> index 0000000..dbf23fe
> --- /dev/null
> +++ b/lib/uksignal/exportsyms.uk
> @@ -0,0 +1,27 @@
> +# uk_signal.h
> +uk_proc_sig
> +
> +uk_sig_handle_signals
> +uk_proc_sig_init
> +uk_thread_sig_init
> +uk_thread_sig_uninit
> +uk_sig_thread_kill
> +uk_thread_sigmask
> +
> +# signal.h
> +sigaction
> +signal
> +sigprocmask
> +sigsuspend
> +sigpending
> +sigwait
> +kill
> +raise
> +pthread_sigmask
> +
> +# sigset.h
> +sigemptyset
> +sigfillset
> +sigaddset
> +sigdelset
> +sigismember
> \ No newline at end of file
> diff --git a/lib/uksignal/include/uk/bits/sigset.h
> b/lib/uksignal/include/uk/bits/sigset.h
> new file mode 100644
> index 0000000..3642633
> --- /dev/null
> +++ b/lib/uksignal/include/uk/bits/sigset.h
> @@ -0,0 +1,66 @@
> +#ifndef __UK_SIGNAL_H__
> +#error Do not include this header directly
> +#endif
> +
> +#ifndef __UK_SIGSET_H__
> +#define __UK_SIGSET_H__
> +
> +#ifdef __cplusplus
> +extern "C" {
> +#endif
> +
> +#define SIG_BLOCK     0
> +#define SIG_UNBLOCK   1
> +#define SIG_SETMASK   2
> +
> +typedef unsigned long __sigset_t;
> +typedef __sigset_t sigset_t;
> +
> +int sigemptyset(sigset_t *set);
> +int sigfillset(sigset_t *set);
> +int sigaddset(sigset_t *set, int signo);
> +int sigdelset(sigset_t *set, int signo);
> +int sigismember(const sigset_t *set, int signo);
> +
> +/* TODO: do we have gnu statement expression?  */
> +/* internal use */
> +#define uk_sigemptyset(ptr)    \
> +               do {    \
> +                       *(ptr) =3D 0;     \
> +               } while (0)
> +#define uk_sigfillset(ptr)     \
> +               do {    \
> +                       *(ptr) =3D ~((__sigset_t) 0);     \
> +               } while (0)
> +#define uk_sigaddset(ptr, signo)       \
> +               do {    \
> +                       *(ptr) |=3D (1 << ((signo) - 1)); \
> +               } while (0)
> +#define uk_sigdelset(ptr, signo)       \
> +               do {    \
> +                       *(ptr) &=3D ~(1 << ((signo) - 1));        \
> +               } while (0)
> +#define uk_sigcopyset(ptr1, ptr2)      \
> +               do {    \
> +                       *(ptr1) =3D *(ptr2);      \
> +               } while (0)
> +#define uk_sigandset(ptr1, ptr2)       \
> +               do {    \
> +                       *(ptr1) &=3D *(ptr2);     \
> +               } while (0)
> +#define uk_sigorset(ptr1, ptr2)        \
> +               do {    \
> +                       *(ptr1) |=3D *(ptr2);     \
> +               } while (0)
> +#define uk_sigreverseset(ptr)  \
> +               do {    \
> +                       *(ptr) =3D ~(*(ptr));     \
> +               } while (0)
> +#define uk_sigismember(ptr, signo) (*(ptr) & (1 << ((signo) - 1)))
> +#define uk_sigisempty(ptr) (*(ptr) =3D=3D 0)
> +
> +#ifdef __cplusplus
> +}
> +#endif
> +
> +#endif /* __UK_SIGSET_H__ */
> diff --git a/lib/uksignal/include/uk/signal.h
> b/lib/uksignal/include/uk/signal.h
> new file mode 100644
> index 0000000..43fdabc
> --- /dev/null
> +++ b/lib/uksignal/include/uk/signal.h
> @@ -0,0 +1,131 @@
> +/* adapted from OSv */
> +#ifndef __UK_SIGNAL_H__
> +#define __UK_SIGNAL_H__
> +
> +#include <stddef.h>
> +#include <uk/bits/sigset.h>
> +
> +#ifdef __cplusplus
> +extern "C" {
> +#endif
> +
> +#define SIGHUP    1
> +#define SIGINT    2
> +#define SIGQUIT   3
> +#define SIGILL    4
> +#define SIGTRAP   5
> +#define SIGABRT   6
> +#define SIGIOT    SIGABRT
> +#define SIGBUS    7
> +#define SIGFPE    8
> +#define SIGKILL   9
> +#define SIGUSR1   10
> +#define SIGSEGV   11
> +#define SIGUSR2   12
> +#define SIGPIPE   13
> +#define SIGALRM   14
> +#define SIGTERM   15
> +#define SIGSTKFLT 16
> +#define SIGCHLD   17
> +#define SIGCONT   18
> +#define SIGSTOP   19
> +#define SIGTSTP   20
> +#define SIGTTIN   21
> +#define SIGTTOU   22
> +#define SIGURG    23
> +#define SIGXCPU   24
> +#define SIGXFSZ   25
> +#define SIGVTALRM 26
> +#define SIGPROF   27
> +#define SIGWINCH  28
> +#define SIGIO     29
> +#define SIGPOLL   29
> +#define SIGPWR    30
> +#define SIGSYS    31
> +#define SIGUNUSED SIGSYS
> +
> +#define _NSIG 32
> +
> +#define SA_NOCLDSTOP  1
> +#define SA_NOCLDWAIT  2
> +#define SA_SIGINFO    4
> +#define SA_ONSTACK    0x08000000
> +#define SA_RESTART    0x10000000
> +#define SA_NODEFER    0x40000000
> +#define SA_RESETHAND  0x80000000
> +#define SA_RESTORER   0x04000000
> +
> +typedef int pid_t;
> +typedef int sig_atomic_t;
> +
> +#define NSIG _NSIG
> +
> +typedef struct {
> +  int          si_signo;    /* Signal number */
> +  int          si_code;     /* Cause of the signal */
> +  pid_t               si_pid;      /* Sending process ID */
> +} siginfo_t;
> +
> +struct sigaction {
> +       union {
> +               void (*sa_handler)(int);
> +               void (*sa_sigaction)(int, siginfo_t *, void *);
> +       } __sa_handler;
> +       sigset_t sa_mask;
> +       int sa_flags;
> +       void (*sa_restorer)(void);
> +};
> +#define sa_handler   __sa_handler.sa_handler
> +#define sa_sigaction __sa_handler.sa_sigaction
> +
> +#define SIG_ERR  ((void (*)(int))-1)
> +#define SIG_DFL  ((void (*)(int)) 0)
> +#define SIG_IGN  ((void (*)(int)) 1)
> +
> +/* TODO: do we have gnu statement expression? */
> +#define is_sig_dfl(ptr)        \
> +       (!((ptr)->sa_flags & SA_SIGINFO) && (ptr)->sa_handler =3D=3D SIG_=
DFL)
> +
> +#define is_sig_ign(ptr)        \
> +       (!((ptr)->sa_flags & SA_SIGINFO) && (ptr)->sa_handler =3D=3D SIG_=
IGN)
> +
> +int
> +sigaction(int signum, const struct sigaction *act, struct sigaction
> *oldact);
> +
> +int sigpending(sigset_t *set);
> +int sigprocmask(int how, const sigset_t *set, sigset_t *oldset);
> +int sigsuspend(const sigset_t *mask);
> +int sigwait(const sigset_t *set, int *sig);
> +
> +int kill(pid_t pid, int sig);
> +int raise(int sig);
> +
> +typedef void (*sighandler_t)(int);
> +sighandler_t signal(int signum, sighandler_t handler);
> +
> +int pthread_sigmask(int how, const sigset_t *set, sigset_t *oldset);
> +
> +/* TODO: not used - defined just for newlib */
> +union sigval {
> +       int    sival_int;       /* Integer signal value */
> +       void  *sival_ptr;       /* Pointer signal value */
> +};
> +
> +struct sigevent {
> +       int              sigev_notify;  /* Notification type */
> +       int              sigev_signo;   /* Signal number */
> +       union sigval     sigev_value;   /* Signal value */
> +};
> +
> +/* TODO: not used - defined just for v8 */
> +typedef struct sigaltstack {
> +       void *ss_sp;
> +       int ss_flags;
> +       size_t ss_size;
> +} stack_t;
> +
> +#ifdef __cplusplus
> +}
> +#endif
> +
> +#endif /* __UK_SIGNAL_H__ */
> diff --git a/lib/uksignal/include/uk/string/strsignal.h
> b/lib/uksignal/include/uk/string/strsignal.h
> new file mode 100644
> index 0000000..73b69cb
> --- /dev/null
> +++ b/lib/uksignal/include/uk/string/strsignal.h
> @@ -0,0 +1,19 @@
> +#ifndef __UK_STRSIGNAL_H__
> +#define __UK_STRSIGNAL_H__
> +
> +/*
> + * TODO: not used - delete
> + */
> +
> +#ifdef __cplusplus
> +extern "C" {
> +#endif
> +
> +extern const char * const sys_siglist[];
> +char *strsignal(int sig);
> +
> +#ifdef __cplusplus
> +}
> +#endif
> +
> +#endif /* __UK_STRSIGNAL_H__ */
> diff --git a/lib/uksignal/include/uk/uk_signal.h
> b/lib/uksignal/include/uk/uk_signal.h
> new file mode 100644
> index 0000000..cb066d1
> --- /dev/null
> +++ b/lib/uksignal/include/uk/uk_signal.h
> @@ -0,0 +1,136 @@
> +#ifndef __UK_UK_SIGNAL_H__
> +#define __UK_UK_SIGNAL_H__
> +
> +#include <uk/list.h>
> +#include <uk/signal.h>
> +
> +#ifdef __cplusplus
> +extern "C" {
> +#endif
> +
> +#define _UK_TH_SIG uk_crr_thread_sig_container()
> +
> +struct uk_thread;
> +
> +struct uk_signal {
> +       siginfo_t info;
> +       struct uk_list_head list_node;
> +};
> +
> +/* TODO: add synchronization */
> +
> +struct uk_proc_sig {
> +       /* used as a bitmap for pending signals */
> +       sigset_t pending;
> +       /* pending signals - valid only if corresponding bit in pending i=
s
> set */
> +       siginfo_t pending_signals[NSIG - 1];
> +       /* signal handlers for this process */
> +       struct sigaction sigaction[NSIG - 1];
> +       /* list of uk_thread_sig from the threads of the proc */
> +       struct uk_list_head thread_sig_list;
> +};
> +
> +extern struct uk_proc_sig uk_proc_sig;
> +
> +enum uk_sig_waiting {
> +       UK_SIG_NOT_WAITING =3D 0,
> +       UK_SIG_WAITING =3D 1,
> +       UK_SIG_WAITING_SCHED =3D 2
> +};
> +
> +struct uk_thread_sig_wait {
> +       /*
> +        * waiting status
> +        *
> +        * values:
> +        *      UK_SIG_NOT_WAITING - thread is not waiting
> +        *      UK_SIG_WAITING - thread is waiting for a signal
> +        *      UK_SIG_WAITING_SCHED - thread is waiting to be scheduled
> +        */
> +       enum uk_sig_waiting status;
> +       /* used as a bitmap for awaited signals */
> +       sigset_t awaited;
> +       /* awaited signal received */
> +       siginfo_t received_signal;
> +};
> +
> +struct uk_thread_sig {
> +       /* blocked signals */
> +       sigset_t mask;
> +       /* used as a bitmap for pending signals */
> +       sigset_t pending;
> +       /* list of pending signals */
> +       struct uk_list_head pending_signals;
> +       /* signal waiting state */
> +       struct uk_thread_sig_wait wait;
> +       /* node for the thread_sig_list from the proc */
> +       struct uk_list_head list_node;
> +};
> +
> +/* returns number of executed signal handlers */
> +int uk_sig_handle_signals(void);
> +
> +int uk_proc_sig_init(struct uk_proc_sig *sig);
> +int uk_thread_sig_init(struct uk_thread_sig *sig);
> +void uk_thread_sig_uninit(struct uk_thread_sig *sig);
> +
> +/* TODO: replace sched thread_kill? */
> +int uk_sig_thread_kill(struct uk_thread *tid, int sig);
> +int uk_thread_sigmask(int how, const sigset_t *set, sigset_t *oldset);
> +
> +/* internal use */
> +static inline int uk_sig_is_valid(int sig)
> +{
> +       return (sig < NSIG && sig > 0);
> +}
> +
> +static inline void uk_sigset_remove_unmaskable(sigset_t *sig)
> +{
> +       uk_sigdelset(sig, SIGKILL);
> +       uk_sigdelset(sig, SIGSTOP);
> +}
> +
> +static inline void uk_add_proc_signal(siginfo_t *sig)
> +{
> +       uk_proc_sig.pending_signals[sig->si_signo - 1] =3D *sig;
> +       uk_sigaddset(&uk_proc_sig.pending, sig->si_signo);
> +}
> +
> +static inline void uk_remove_proc_signal(int sig)
> +{
> +       uk_sigdelset(&uk_proc_sig.pending, sig);
> +}
> +
> +/* maybe move to sched */
> +struct uk_thread_sig *uk_crr_thread_sig_container(void);
> +void uk_sig_init_siginfo(siginfo_t *siginfo, int sig);
> +
> +/* returns the uk_signal for sig if it is pending on thread */
> +struct uk_signal *
> +uk_sig_th_get_pending(struct uk_thread_sig *th_sig, int sig);
> +
> +/* returns the siginfo for sig if it is pending on proc */
> +siginfo_t *uk_sig_proc_get_pending(int sig);
> +
> +/*
> + * returns the uk_signal for a signal from the given
> + * set if it is pending on thread
> + */
> +struct uk_signal *
> +uk_sig_th_get_pending_any(struct uk_thread_sig *th_sig, sigset_t set);
> +
> +/*
> + * returns the siginfo for a signal from the given
> + * set if it is pending on proc
> + */
> +siginfo_t *uk_sig_proc_get_pending_any(sigset_t set);
> +
> +int
> +uk_deliver_proc_signal(struct uk_thread_sig *th_sig, siginfo_t *sig);
> +void uk_execute_handler(siginfo_t sig);
> +
> +#ifdef __cplusplus
> +}
> +#endif
> +
> +#endif /* __UK_UK_SIGNAL_H__ */
> diff --git a/lib/uksignal/signal.c b/lib/uksignal/signal.c
> new file mode 100644
> index 0000000..5f5e289
> --- /dev/null
> +++ b/lib/uksignal/signal.c
> @@ -0,0 +1,320 @@
> +/* adapted from OSv */
> +
> +#include <errno.h>
> +
> +#include <uk/alloc.h>
> +#include <uk/sched.h>
> +#include <uk/signal.h>
> +#include <uk/thread.h>
> +#include <uk/uk_signal.h>
> +
> +/*
> + * Tries to deliver a pending signal to the current thread
> + * Used only with a waiting thread
> + *
> + * Returns: 0 if no signal was delivered, 1 if a signal was delivered
> + */
> +static int uk_get_awaited_signal(void)
> +{
> +       siginfo_t *siginfo;
> +       struct uk_signal *signal;
> +       struct uk_thread_sig *ptr;
> +
> +       ptr =3D _UK_TH_SIG;
> +
> +       /* try to deliver thread pending signal */
> +       signal =3D uk_sig_th_get_pending_any(ptr, ptr->wait.awaited);
> +
> +       if (signal) {
> +               /* set awaited signal */
> +               ptr->wait.received_signal =3D signal->info;
> +
> +               /* remove it from the list of pending signals */
> +               uk_list_del(&signal->list_node);
> +               uk_sigdelset(&ptr->pending, signal->info.si_signo);
> +               uk_free(uk_alloc_get_default(), signal);
> +               return 1;
> +       }
> +
> +       /* try to deliver process pending signal */
> +       siginfo =3D uk_sig_proc_get_pending_any(ptr->wait.awaited);
> +
> +       if (siginfo) {
> +               ptr->wait.received_signal =3D *siginfo;
> +
> +               /* remove it from the list of pending signals */
> +               uk_remove_proc_signal(siginfo->si_signo);
> +               return 1;
> +       }
> +
> +       return 0;
> +}
> +
> +/* TODO: We do not support any sa_flags besides SA_SIGINFO */
> +int
> +sigaction(int signum, const struct sigaction *act, struct sigaction
> *oldact)
> +{
> +       struct uk_list_head *i;
> +       struct uk_thread_sig *th_sig;
> +       struct uk_signal *signal;
> +
> +       if (!uk_sig_is_valid(signum) ||
> +                       signum =3D=3D SIGKILL ||
> +                       signum =3D=3D SIGSTOP) {
> +               errno =3D EINVAL;
> +               return -1;
> +       }
> +
> +       if (oldact)
> +               *oldact =3D uk_proc_sig.sigaction[signum - 1];
> +
> +       if (act) {
> +               /* TODO: SA_NODEFER */
> +               uk_proc_sig.sigaction[signum - 1] =3D *act;
> +               uk_sigaddset(&uk_proc_sig.sigaction[signum - 1].sa_mask,
> signum);
> +
> +               /* remove signal from where it is pending */
> +               if (is_sig_ign(act)) {
> +                       /* remove it from proc */
> +                       uk_remove_proc_signal(signum);
> +
> +                       /* remove it from threads*/
> +                       uk_list_for_each(i, &uk_proc_sig.thread_sig_list)=
 {
> +                               th_sig =3D uk_list_entry(i, struct
> uk_thread_sig, list_node);
> +
> +                               signal =3D uk_sig_th_get_pending(th_sig,
> signum);
> +
> +                               if (signal) {
> +                                       /* remove it from the list of
> pending signals */
> +                                       uk_list_del(&signal->list_node);
> +                                       uk_sigdelset(&th_sig->pending,
> signal->info.si_signo);
> +                                       uk_free(uk_alloc_get_default(),
> signal);
> +                               }
> +                       }
> +               }
> +       }
> +
> +       return 0;
> +}
> +
> +static sighandler_t uk_signal(int signum, sighandler_t handler, int
> sa_flags)
> +{
> +       struct sigaction old;
> +       struct sigaction act =3D {
> +               .sa_handler =3D handler,
> +               .sa_flags =3D sa_flags
> +       };
> +
> +       if (sigaction(signum, &act, &old) < 0)
> +               return SIG_ERR;
> +
> +       if (old.sa_flags & SA_SIGINFO)
> +               return NULL;
> +       else
> +               return old.sa_handler;
> +}
> +
> +sighandler_t signal(int signum, sighandler_t handler)
> +{
> +       /* SA_RESTART <- BSD signal semantics */
> +       return uk_signal(signum, handler, SA_RESTART);
> +}
> +
> +int sigpending(sigset_t *set)
> +{
> +       struct uk_thread_sig *ptr;
> +
> +       ptr =3D _UK_TH_SIG;
> +
> +       uk_sigcopyset(set, &ptr->pending);
> +       uk_sigorset(set, &uk_proc_sig.pending);
> +
> +       return 0;
> +}
> +
> +int sigprocmask(int how, const sigset_t *set, sigset_t *oldset)
> +{
> +       return uk_thread_sigmask(how, set, oldset);
> +}
> +
> +int pthread_sigmask(int how, const sigset_t *set, sigset_t *oldset)
> +{
> +       return uk_thread_sigmask(how, set, oldset);
> +}
> +
> +int sigsuspend(const sigset_t *mask)
> +{
> +       /* If the signals are ignored, this doesn't return <- POSIX */
> +
> +       sigset_t cleaned_mask, tmp;
> +       struct uk_thread_sig *ptr;
> +
> +       uk_sigcopyset(&cleaned_mask, mask);
> +       uk_sigset_remove_unmaskable(&cleaned_mask);
> +
> +       ptr =3D _UK_TH_SIG;
> +
> +       uk_sigcopyset(&ptr->wait.awaited, &cleaned_mask);
> +
> +       /* we are waiting for all the signals that aren't blocked */
> +       uk_sigreverseset(&ptr->wait.awaited);
> +
> +       /* change mask */
> +       uk_sigcopyset(&tmp, &ptr->mask);
> +       uk_sigcopyset(&ptr->mask, &cleaned_mask);
> +
> +       while (1) {
> +               /* try to deliver a pending signal */
> +               if (uk_get_awaited_signal())
> +                       break;
> +
> +               /* block, yield */
> +               uk_thread_block(uk_thread_current());
> +               ptr->wait.status =3D UK_SIG_WAITING;
> +               uk_sched_yield();
> +       }
> +
> +       ptr->wait.status =3D UK_SIG_NOT_WAITING;
> +
> +       /* execute handler */
> +       uk_execute_handler(ptr->wait.received_signal);
> +
> +       /* restore mask
> +        *
> +        * We restore the mask here because we are technically done with
> +        * sigsuspend and the mask must be restored at the end of
> sigsuspend
> +        */
> +       uk_sigcopyset(&ptr->mask, &tmp);
> +
> +       /* execute other pending signals */
> +       uk_sig_handle_signals();
> +
> +       errno =3D EINTR;
> +       return -1; /* always returns -1 and sets errno to EINTR */
> +}
> +
> +int sigwait(const sigset_t *set, int *sig)
> +{
> +       /*
> +        * If the signals are ignored, this doesn't return <- TODO: POSIX
> ??
> +        *
> +        * POSIX states that the signals in set must have been blocked
> before
> +        * calling sigwait, otherwise behavior is undefined -> for us the
> +        * behavior is not caring -> even if the signal is not blocked
> sigwait
> +        * will still accept it
> +        *
> +        * NOTE: this function is not signal safe
> +        */
> +
> +       int signals_executed;
> +       sigset_t cleaned_set, awaited_save;
> +       struct uk_thread_sig *ptr;
> +
> +       uk_sigcopyset(&cleaned_set, set);
> +       uk_sigset_remove_unmaskable(&cleaned_set);
> +
> +       if (uk_sigisempty(&cleaned_set))
> +               return EINVAL;
> +
> +       ptr =3D _UK_TH_SIG;
> +
> +       uk_sigcopyset(&ptr->wait.awaited, &cleaned_set);
> +
> +       /* save awaited signals */
> +       awaited_save =3D ptr->wait.awaited;
> +
> +       while (1) {
> +               if (uk_get_awaited_signal())
> +                       break;
> +
> +               /*
> +                * sigwait allows signals to be received while
> +                * waiting so handle them
> +                */
> +               ptr->wait.status =3D UK_SIG_NOT_WAITING;
> +               signals_executed =3D uk_sig_handle_signals();
> +
> +               if (signals_executed) {
> +                       /*
> +                        * awaited might be changed by other waiting
> +                        * done while handling the signal
> +                        */
> +                       ptr->wait.awaited =3D awaited_save;
> +
> +                       /*
> +                        * we might have raised / received a waiting sign=
al
> +                        * while handling the others
> +                        */
> +                       if (uk_get_awaited_signal())
> +                               break;
> +               }
> +
> +               /* block, yield */
> +               uk_thread_block(uk_thread_current());
> +               ptr->wait.status =3D UK_SIG_WAITING;
> +               uk_sched_yield();
> +       }
> +
> +       ptr->wait.status =3D UK_SIG_NOT_WAITING;
> +
> +       /* do not execute handler, set received signal */
> +       *sig =3D ptr->wait.received_signal.si_signo;
> +
> +       /* execute other pending signals */
> +       uk_sig_handle_signals();
> +
> +       return 0; /* returns positive errno */
> +}
> +
> +/*
> + * Search for a thread that does not have the signal blocked
> + * If all of the threads have the signal blocked, add it to process
> + * pending signals
> + */
> +int kill(pid_t pid, int sig)
> +{
> +       /*
> +        * POSIX.1 requires that if a process sends a signal to itself,
> and the
> +        * sending thread does not have the signal blocked, and no other
> thread
> +        * has it unblocked or is waiting for it in sigwait(3), at least
> one
> +        * unblocked signal must be delivered to the sending thread befor=
e
> the
> +        * kill() returns.
> +        *
> +        * FIXME: we don't implement this ^
> +        */
> +
> +       siginfo_t siginfo;
> +       struct uk_list_head *i;
> +       struct uk_thread_sig *th_sig;
> +
> +
> +       if (pid !=3D 1 && pid !=3D 0 && pid !=3D -1) {
> +               errno =3D ESRCH;
> +               return -1;
> +       }
> +
> +       if (!uk_sig_is_valid(sig)) {
> +               errno =3D EINVAL;
> +               return -1;
> +       }
> +
> +       /* setup siginfo */
> +       uk_sig_init_siginfo(&siginfo, sig);
> +
> +       uk_list_for_each(i, &uk_proc_sig.thread_sig_list) {
> +               th_sig =3D uk_list_entry(i, struct uk_thread_sig, list_no=
de);
> +
> +               if (uk_deliver_proc_signal(th_sig, &siginfo) > 0)
> +                       return 0;
> +       }
> +
> +       /* didn't find any thread that could accept this signal */
> +       uk_add_proc_signal(&siginfo);
> +
> +       return 0;
> +}
> +
> +int raise(int sig)
> +{
> +       return uk_sig_thread_kill(uk_thread_current(), sig);
> +}
> diff --git a/lib/uksignal/sigset.c b/lib/uksignal/sigset.c
> new file mode 100644
> index 0000000..2624e6c
> --- /dev/null
> +++ b/lib/uksignal/sigset.c
> @@ -0,0 +1,51 @@
> +/* taken from newlib */
> +
> +#include <errno.h>
> +#include <uk/signal.h>
> +
> +int sigemptyset(sigset_t *set)
> +{
> +       uk_sigemptyset(set);
> +       return 0;
> +}
> +
> +int sigfillset(sigset_t *set)
> +{
> +       uk_sigfillset(set);
> +       return 0;
> +}
> +
> +int sigaddset(sigset_t *set, int signo)
> +{
> +       if (signo >=3D NSIG || signo <=3D 0) {
> +               errno =3D EINVAL;
> +               return -1;
> +       }
> +
> +       uk_sigaddset(set, signo);
> +       return 0;
> +}
> +
> +int sigdelset(sigset_t *set, int signo)
> +{
> +       if (signo >=3D NSIG || signo <=3D 0) {
> +               errno =3D EINVAL;
> +               return -1;
> +       }
> +
> +       uk_sigdelset(set, signo);
> +       return 0;
> +}
> +
> +int sigismember(const sigset_t *set, int signo)
> +{
> +       if (signo >=3D NSIG || signo <=3D 0) {
> +               errno =3D EINVAL;
> +               return -1;
> +       }
> +
> +       if (uk_sigismember(set, signo))
> +               return 1;
> +       else
> +               return 0;
> +}
> diff --git a/lib/uksignal/strsignal.c b/lib/uksignal/strsignal.c
> new file mode 100644
> index 0000000..b672e5f
> --- /dev/null
> +++ b/lib/uksignal/strsignal.c
> @@ -0,0 +1,61 @@
> +/* taken from newlib */
> +
> +#include <uk/uk_signal.h>
> +
> +/*
> + * TODO: not used - delete
> + */
> +
> +const char *sigstring[] =3D {
> +               "Hangup",
> +               "Interrupt",
> +               "Quit",
> +               "Illegal instruction",
> +               "Trace/breakpoint trap",
> +               "IOT trap",
> +               "EMT trap",
> +               "Floating point exception",
> +               "Killed",
> +               "Bus error",
> +               "Segmentation fault",
> +               "Bad system call",
> +               "Broken pipe",
> +               "Alarm clock",
> +               "Terminated",
> +               "Urgent I/O condition",
> +               "Stopped (signal)",
> +               "Stopped",
> +               "Continued",
> +               "Child exited",
> +               "Stopped (tty input)",
> +               "Stopped (tty output)",
> +               "I/O possible",
> +               "CPU time limit exceeded",
> +               "File size limit exceeded",
> +               "Virtual timer expired",
> +               "Profiling timer expired",
> +               "Window changed",
> +               "Resource lost",
> +               "User defined signal 1",
> +               "User defined signal 2"
> +};
> +
> +char *strsignal(int sig)
> +{
> +       char *buffer;
> +       struct uk_signals_container *ptr;
> +
> +       ptr =3D _UK_TH_SIG;
> +       buffer =3D UK_SIG_BUF(ptr);
> +
> +       /*
> +        * TODO: this assignment doesn't really do anything
> +        * since we return buffer, but newlibc did this
> +        */
> +       if (sig <=3D 0 || sig >=3D NSIG)
> +               *buffer =3D "Unknown signal";
> +       else
> +               *buffer =3D sigstring[sig - 1];
> +
> +       return buffer;
> +}
> diff --git a/lib/uksignal/uk_signal.c b/lib/uksignal/uk_signal.c
> new file mode 100644
> index 0000000..616b8f7
> --- /dev/null
> +++ b/lib/uksignal/uk_signal.c
> @@ -0,0 +1,451 @@
> +#include <errno.h>
> +
> +#include <uk/alloc.h>
> +#include <uk/print.h>
> +#include <uk/signal.h>
> +#include <uk/thread.h>
> +#include <uk/uk_signal.h>
> +
> +struct uk_proc_sig uk_proc_sig;
> +
> +int uk_proc_sig_init(struct uk_proc_sig *sig)
> +{
> +       int i;
> +
> +       sigemptyset(&sig->pending);
> +
> +       for (i =3D 0; i < NSIG - 1; ++i) {
> +               /* TODO: set ign to the ones that should be ign */
> +               sig->sigaction[i].sa_handler =3D SIG_DFL;
> +               sigemptyset(&sig->sigaction[i].sa_mask);
> +               sig->sigaction[i].sa_flags =3D 0;
> +       }
> +
> +       UK_INIT_LIST_HEAD(&sig->thread_sig_list);
> +       return 0;
> +}
> +
> +int uk_thread_sig_init(struct uk_thread_sig *sig)
> +{
> +       sigemptyset(&sig->mask);
> +
> +       sig->wait.status =3D UK_SIG_NOT_WAITING;
> +       sigemptyset(&sig->wait.awaited);
> +
> +       sigemptyset(&sig->pending);
> +       UK_INIT_LIST_HEAD(&sig->pending_signals);
> +
> +       uk_list_add(&sig->list_node, &uk_proc_sig.thread_sig_list);
> +       return 0;
> +}
> +
> +void uk_thread_sig_uninit(struct uk_thread_sig *sig)
> +{
> +       /* Clear pending signals */
> +       struct uk_list_head *i, *tmp;
> +       struct uk_signal *signal;
> +
> +       uk_list_del(&sig->list_node);
> +
> +       uk_list_for_each_safe(i, tmp, &sig->pending_signals) {
> +               signal =3D uk_list_entry(i, struct uk_signal, list_node);
> +
> +               uk_list_del(&signal->list_node);
> +               uk_free(uk_alloc_get_default(), signal);
> +       }
> +}
> +
> +int uk_sig_handle_signals(void)
> +{
> +       /*
> +        * Do not run pending signals if the thread is waiting
> +        *
> +        * Iterate over pending signals
> +        * Check if the signal is blocked
> +        *
> +        * Before running the handler, remove it from pending
> +        */
> +
> +       int handled =3D 0;
> +       sigset_t executable, rmask;
> +       struct uk_signal *signal;
> +       struct uk_thread_sig *ptr;
> +
> +       ptr =3D _UK_TH_SIG;
> +
> +       /*
> +        * handle_sigals will be called from
> +        * the respective waiting function
> +        */
> +       if (ptr->wait.status !=3D UK_SIG_NOT_WAITING)
> +               return 0;
> +
> +       /* reverse mask */
> +       uk_sigcopyset(&rmask, &ptr->mask);
> +       uk_sigreverseset(&rmask);
> +
> +       /* calculate executable signals */
> +       uk_sigcopyset(&executable, &rmask);
> +       uk_sigandset(&executable, &ptr->pending);
> +
> +       while (!uk_sigisempty(&executable)) {
> +               signal =3D uk_list_first_entry(&ptr->pending_signals, str=
uct
> uk_signal, list_node);
> +
> +               /* move it last if it's blocked */
> +               if (uk_sigismember(&ptr->mask, signal->info.si_signo)) {
> +                       uk_list_del(&signal->list_node);
> +                       uk_list_add_tail(&signal->list_node,
> &ptr->pending_signals);
> +                       continue;
> +               }
> +
> +               /* remove from the list */
> +               uk_list_del(&signal->list_node);
> +
> +               /* clear pending status */
> +               uk_sigdelset(&ptr->pending, signal->info.si_signo);
> +
> +               /* execute */
> +               uk_execute_handler(signal->info);
> +
> +               uk_free(uk_alloc_get_default(), signal);
> +               handled++;
> +
> +               /* calculate executable signals */
> +               uk_sigcopyset(&executable, &rmask);
> +               uk_sigandset(&executable, &ptr->pending);
> +       }
> +
> +       return handled;
> +}
> +
> +/*
> + * returns:
> + *  >0 - on success
> + *  0  - if signal is ignored / already pending
> + *  <0 - on failure
> + */
> +static int
> +uk_deliver_signal_unmasked(struct uk_thread_sig *th_sig, siginfo_t *sig)
> +{
> +       struct uk_thread *tid;
> +       struct uk_signal *uk_sig;
> +
> +       /* If the signal is ignored, we don't deliver it */
> +       if (is_sig_ign(&uk_proc_sig.sigaction[sig->si_signo - 1]))
> +               return 0;
> +
> +       /* If it is already pending, we don't deliver it */
> +       if (uk_sigismember(&th_sig->pending, sig->si_signo))
> +               return 0;
> +
> +       uk_sig =3D uk_malloc(uk_alloc_get_default(), sizeof(*uk_sig));
> +       if (!uk_sig) {
> +               uk_pr_warn("Could not allocate uk_signal");
> +               return -ENOMEM;
> +       }
> +
> +       uk_sig->info =3D *sig;
> +       uk_list_add(&uk_sig->list_node, &th_sig->pending_signals);
> +
> +       uk_sigaddset(&th_sig->pending, sig->si_signo);
> +
> +       /* check if we need to wake the thread */
> +       if (th_sig->wait.status !=3D UK_SIG_NOT_WAITING &&
> +                       th_sig->wait.status !=3D UK_SIG_WAITING_SCHED) {
> +               th_sig->wait.status =3D UK_SIG_WAITING_SCHED;
> +
> +               tid =3D __containerof(th_sig, struct uk_thread,
> signals_container);
> +               uk_thread_wake(tid);
> +       }
> +
> +       return 1;
> +}
> +
> +int uk_sig_thread_kill(struct uk_thread *tid, int sig)
> +{
> +       siginfo_t siginfo;
> +       struct uk_signal *signal;
> +       struct uk_thread_sig *ptr;
> +
> +       if (!uk_sig_is_valid(sig)) {
> +               errno =3D EINVAL;
> +               return -1;
> +       }
> +
> +       ptr =3D &tid->signals_container;
> +
> +       /* setup siginfo */
> +       uk_sig_init_siginfo(&siginfo, sig);
> +
> +       /* check if we are sending this to ourself */
> +       if (&tid->signals_container =3D=3D _UK_TH_SIG) {
> +               /* if it's not masked just run it */
> +               if (!uk_sigismember(&ptr->mask, sig)) {
> +                       /* remove the signal from pending */
> +                       signal =3D uk_sig_th_get_pending(ptr, sig);
> +
> +                       if (signal) {
> +                               uk_list_del(&signal->list_node);
> +                               uk_sigdelset(&ptr->pending, sig);
> +                               uk_free(uk_alloc_get_default(), signal);
> +                       }
> +
> +                       uk_execute_handler(siginfo);
> +                       return 0;
> +               }
> +       }
> +
> +       uk_deliver_signal_unmasked(ptr, &siginfo);
> +
> +       return 0;
> +}
> +
> +/*
> + * Used to deliver pending signals after a mask change
> + *
> + * Since mask doesn't affect the deliverance of signals
> + * directed to threads (this is handled by uk_sig_handle_signals),
> + * we are trying to deliver only pending process signals
> + */
> +static inline void uk_deliver_signals_maskchange(void)
> +{
> +       int i, ret;
> +       sigset_t to_send;
> +       struct uk_thread_sig *ptr;
> +
> +       ptr =3D _UK_TH_SIG;
> +
> +       uk_sigcopyset(&to_send, &ptr->mask);
> +       uk_sigandset(&to_send, &uk_proc_sig.pending);
> +
> +       for (i =3D 1; i < NSIG; ++i) {
> +               if (uk_sigisempty(&to_send))
> +                       break;
> +
> +               if (uk_sigismember(&to_send, i)) {
> +                       ret =3D uk_deliver_proc_signal(ptr,
> +                                       &uk_proc_sig.pending_signals[i -
> 1]);
> +
> +                       if (ret > 0) {
> +                               uk_remove_proc_signal(i);
> +                               uk_sigdelset(&to_send, i);
> +                       }
> +               }
> +       }
> +}
> +
> +/*
> + * TODO: if we add rt sig, don't allow the
> + * two real-time sig that are used internally by the NPTL
> + * threading implementation. Also for all the functions - ignore
> + * those signals silently
> + */
> +int uk_thread_sigmask(int how, const sigset_t *set, sigset_t *oldset)
> +{
> +       /*
> +        * running this inside a handler has no effect outside the handle=
r
> +        * since the mask is restored in execute_handler
> +        */
> +
> +       sigset_t *mask, tmp;
> +       struct uk_thread_sig *ptr;
> +
> +       ptr =3D _UK_TH_SIG;
> +       mask =3D &(ptr->mask);
> +
> +       if (oldset)
> +               *oldset =3D *mask;
> +
> +       if (set) {
> +               switch (how) {
> +               case SIG_BLOCK:
> +                       uk_sigorset(mask, set);
> +                       break;
> +               case SIG_UNBLOCK:
> +                       uk_sigcopyset(&tmp, set);
> +                       uk_sigreverseset(&tmp);
> +                       uk_sigandset(mask, set);
> +                       break;
> +               case SIG_SETMASK:
> +                       uk_sigcopyset(mask, set);
> +                       break;
> +               default:
> +                       errno =3D EINVAL;
> +                       return -1;
> +               }
> +
> +               uk_sigset_remove_unmaskable(mask);
> +
> +               /* Changed the mask, see if we can deliver any pending
> signals */
> +               uk_deliver_signals_maskchange();
> +
> +               uk_sig_handle_signals();
> +       }
> +
> +       return 0;
> +}
> +
> +struct uk_thread_sig *uk_crr_thread_sig_container(void)
> +{
> +       return &(uk_thread_current()->signals_container);
> +}
> +
> +void uk_sig_init_siginfo(siginfo_t *siginfo, int sig)
> +{
> +       siginfo->si_signo =3D sig;
> +
> +       /* TODO: add codes; get pid from getpid() */
> +       siginfo->si_code =3D 0;
> +       siginfo->si_pid =3D 1;
> +}
> +
> +/* returns the uk_signal for sig if it is pending on thread */
> +struct uk_signal *uk_sig_th_get_pending(struct uk_thread_sig *th_sig, in=
t
> sig)
> +{
> +       struct uk_list_head *i;
> +       struct uk_signal *signal;
> +
> +       if (!uk_sigismember(&th_sig->pending, sig))
> +               return NULL;
> +
> +       uk_list_for_each(i, &th_sig->pending_signals) {
> +               signal =3D uk_list_entry(i, struct uk_signal, list_node);
> +
> +               if (signal->info.si_signo =3D=3D sig)
> +                       return signal;
> +       }
> +
> +       /* NOT REACHED */
> +       return NULL;
> +}
> +
> +/* returns the siginfo for sig if it is pending on proc */
> +siginfo_t *uk_sig_proc_get_pending(int sig)
> +{
> +       if (!uk_sigismember(&uk_proc_sig.pending, sig))
> +               return NULL;
> +
> +       return &uk_proc_sig.pending_signals[sig - 1];
> +}
> +
> +/*
> + * returns the uk_signal for a signal from the given
> + * set if it is pending on thread
> + */
> +struct uk_signal *
> +uk_sig_th_get_pending_any(struct uk_thread_sig *th_sig, sigset_t set)
> +{
> +       sigset_t common;
> +       struct uk_list_head *i;
> +       struct uk_signal *signal;
> +
> +       uk_sigcopyset(&common, &th_sig->pending);
> +       uk_sigandset(&common, &set);
> +
> +       if (uk_sigisempty(&common))
> +               return NULL;
> +
> +       uk_list_for_each(i, &th_sig->pending_signals) {
> +               signal =3D uk_list_entry(i, struct uk_signal, list_node);
> +
> +               if (uk_sigismember(&common, signal->info.si_signo))
> +                       return signal;
> +       }
> +
> +       /* NOT REACHED */
> +       return NULL;
> +}
> +
> +/*
> + * returns the siginfo for a signal from the given
> + * set if it is pending on proc
> + */
> +siginfo_t *uk_sig_proc_get_pending_any(sigset_t set)
> +{
> +       int sig;
> +       sigset_t common;
> +
> +       uk_sigcopyset(&common, &uk_proc_sig.pending);
> +       uk_sigandset(&common, &set);
> +
> +       if (uk_sigisempty(&common))
> +               return NULL;
> +
> +       for (sig =3D 1; sig < NSIG; ++sig)
> +               if (uk_sigismember(&common, sig))
> +                       return &uk_proc_sig.pending_signals[sig - 1];
> +
> +       /* NOT REACHED */
> +       return NULL;
> +}
> +
> +/*
> + * returns:
> + *  >0 - on success
> + *  0  - if signal is blocked / ignored / already pending
> + *  <0 - on failure
> + */
> +int
> +uk_deliver_proc_signal(struct uk_thread_sig *th_sig, siginfo_t *sig)
> +{
> +       if (uk_sigismember(&th_sig->mask, sig->si_signo))
> +               return 0;
> +
> +       return uk_deliver_signal_unmasked(th_sig, sig);
> +}
> +
> +void uk_execute_handler(siginfo_t sig)
> +{
> +       /*
> +        * We save siginfo locally since it might change
> +        * while the handler is runnnig
> +        * For example, if we execute a waiting function inside
> +        * the handler and we were already inside a waiting function
> +        */
> +
> +       sigset_t tmp;
> +       struct sigaction *act;
> +       struct uk_thread_sig *ptr;
> +
> +       act =3D &uk_proc_sig.sigaction[sig.si_signo - 1];
> +
> +       /*
> +        * Check if the signal is ignored
> +        *
> +        * This should never happen since
> +        * we never deliver ignored signals
> +        */
> +       if (is_sig_ign(act)) {
> +               uk_pr_debug("Ignored signal %d\n",
> +                               sig.si_signo);
> +               ukplat_crash();
> +       }
> +
> +       /* our default handler is shutdown */
> +       if (is_sig_dfl(act)) {
> +               uk_pr_debug("Uncaught signal %d. Powering off.\n",
> +                               sig.si_signo);
> +               ukplat_crash();
> +       }
> +
> +       ptr =3D _UK_TH_SIG;
> +
> +       /* change the mask */
> +       uk_sigcopyset(&tmp, &ptr->mask);
> +       uk_sigorset(&ptr->mask, &act->sa_mask);
> +
> +       /* run the handler */
> +       if (act->sa_flags & SA_SIGINFO)
> +               act->sa_sigaction(sig.si_signo, &sig, NULL);
> +       else
> +               act->sa_handler(sig.si_signo);
> +
> +       /* check if we need to reset handler */
> +       if (act->sa_flags & SA_RESETHAND) {
> +               act->sa_flags =3D 0;
> +               act->sa_handler =3D SIG_DFL;
> +       }
> +
> +       /* restore the mask */
> +       uk_sigcopyset(&ptr->mask, &tmp);
> +}
> diff --git a/plat/common/x86/thread_start.S
> b/plat/common/x86/thread_start.S
> index 360ca91..a24de0f 100644
> --- a/plat/common/x86/thread_start.S
> +++ b/plat/common/x86/thread_start.S
> @@ -26,6 +26,7 @@
>   */
>  /* Taken from Mini-OS arch/x86/x86_64.S */
>
> +#include <uk/config.h>
>  #include <uk/plat/common/sw_ctx.h>
>
>  #define ENTRY(X) .globl X ; X :
> @@ -55,6 +56,12 @@ ENTRY(asm_sw_ctx_switch)
>         lea .Lreturn(%rip), %rbx
>         movq %rbx, OFFSETOF_SW_CTX_IP(%rdi)       /* save EIP */
>         pushq OFFSETOF_SW_CTX_IP(%rsi)            /* restore EIP */
> +
> +#if CONFIG_LIBUKSIGNAL
> +       /* TODO: do we need to save regs? (e.g fpu) */
> +       /* stack is aligned here */
> +       call uk_sig_handle_signals
> +#endif
>         ret
>  .Lreturn:
>         popq %r15
> --
> 2.25.1
>
>
>

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

<div dir=3D"ltr">Hi, Bernard<div><br></div><div>It looks good to me!</div><=
div><br></div><div>Reviewed-by: ARGINT DRAGOS IULIAN &lt;<a href=3D"mailto:=
dragosargint21@gmail.com">dragosargint21@gmail.com</a>&gt;</div></div><br><=
div class=3D"gmail_quote"><div dir=3D"ltr" class=3D"gmail_attr">=C3=8En s=
=C3=A2m., 16 ian. 2021 la 03:13, Bernard Rizzo &lt;<a href=3D"mailto:b.rizz=
o@student.uliege.be">b.rizzo@student.uliege.be</a>&gt; a scris:<br></div><b=
lockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-le=
ft:1px solid rgb(204,204,204);padding-left:1ex">uksignal provides a basic i=
mplementation of signals over Unikraft. It<br>
supports signals between threads and process wide signals. It provides<br>
all the definitions needed for signals so we must disable the<br>
definitions provided in libc to run it.<br>
<br>
It does not support signal codes, rt signals and executes the signal<br>
handlers on the thread stack. It is also not yet integrated with our<br>
irqs to deliver signals like SIGSEGV.<br>
<br>
This implementation is not complete; it is meant as a temporory<br>
solution until we have a proper events delivering system.<br>
<br>
This patch is an update of the original.<br>
<br>
Signed-off-by: Mihai Pogonaru &lt;<a href=3D"mailto:pogonarumihai@gmail.com=
" target=3D"_blank">pogonarumihai@gmail.com</a>&gt;<br>
Signed-off-by: Teodora Serbanescu &lt;<a href=3D"mailto:teo.serbanescu16@gm=
ail.com" target=3D"_blank">teo.serbanescu16@gmail.com</a>&gt;<br>
Signed-off-by: Felipe Huici &lt;<a href=3D"mailto:felipe.huici@neclab.eu" t=
arget=3D"_blank">felipe.huici@neclab.eu</a>&gt;<br>
Signed-off-by: Bernard Rizzo &lt;<a href=3D"mailto:b.rizzo@student.uliege.b=
e" target=3D"_blank">b.rizzo@student.uliege.be</a>&gt;<br>
---<br>
=C2=A0lib/Makefile.uk=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 |=C2=A0 =C2=A01 +<br>
=C2=A0lib/uksched/include/uk/thread.h=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 |=C2=A0 =C2=A06 +<br>
=C2=A0lib/uksched/sched.c=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 |=C2=A0 =C2=A07 +<br>
=C2=A0lib/uksched/thread.c=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0|=C2=A0 =C2=A06 +<br>
=C2=A0lib/uksignal/Config.uk=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0|=C2=A0 =C2=A07 +<br>
=C2=A0lib/uksignal/Makefile.uk=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0|=C2=A0 =C2=A08 +<br>
=C2=A0lib/uksignal/README=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 |=C2=A0 =C2=A07 +<br>
=C2=A0lib/uksignal/<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 =C2=A0|=C2=A0 27 ++<br>
=C2=A0lib/uksignal/include/uk/bits/sigset.h=C2=A0 =C2=A0 =C2=A0 |=C2=A0 66 =
+++<br>
=C2=A0lib/uksignal/include/uk/signal.h=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0| 131 ++++++<br>
=C2=A0lib/uksignal/include/uk/string/strsignal.h |=C2=A0 19 +<br>
=C2=A0lib/uksignal/include/uk/uk_signal.h=C2=A0 =C2=A0 =C2=A0 =C2=A0 | 136 =
+++++++<br>
=C2=A0lib/uksignal/signal.c=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0=
 =C2=A0 =C2=A0 =C2=A0 =C2=A0 | 320 +++++++++++++++<br>
=C2=A0lib/uksignal/sigset.c=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0=
 =C2=A0 =C2=A0 =C2=A0 =C2=A0 |=C2=A0 51 +++<br>
=C2=A0lib/uksignal/strsignal.c=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0|=C2=A0 61 +++<br>
=C2=A0lib/uksignal/uk_signal.c=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0| 451 +++++++++++++++++++++<br>
=C2=A0plat/common/x86/thread_start.S=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0|=C2=A0 =C2=A07 +<br>
=C2=A017 files changed, 1311 insertions(+)<br>
=C2=A0create mode 100644 lib/uksignal/Config.uk<br>
=C2=A0create mode 100644 lib/uksignal/Makefile.uk<br>
=C2=A0create mode 100644 lib/uksignal/README<br>
=C2=A0create mode 100644 lib/uksignal/<a href=3D"http://exportsyms.uk" rel=
=3D"noreferrer" target=3D"_blank">exportsyms.uk</a><br>
=C2=A0create mode 100644 lib/uksignal/include/uk/bits/sigset.h<br>
=C2=A0create mode 100644 lib/uksignal/include/uk/signal.h<br>
=C2=A0create mode 100644 lib/uksignal/include/uk/string/strsignal.h<br>
=C2=A0create mode 100644 lib/uksignal/include/uk/uk_signal.h<br>
=C2=A0create mode 100644 lib/uksignal/signal.c<br>
=C2=A0create mode 100644 lib/uksignal/sigset.c<br>
=C2=A0create mode 100644 lib/uksignal/strsignal.c<br>
=C2=A0create mode 100644 lib/uksignal/uk_signal.c<br>
<br>
diff --git a/lib/Makefile.uk b/lib/Makefile.uk<br>
index 07e8a29..f50795d 100644<br>
--- a/lib/Makefile.uk<br>
+++ b/lib/Makefile.uk<br>
@@ -37,3 +37,4 @@ $(eval $(call _import_lib,$(CONFIG_UK_BASE)/lib/ukmmap))<=
br>
=C2=A0$(eval $(call _import_lib,$(CONFIG_UK_BASE)/lib/ukblkdev))<br>
=C2=A0$(eval $(call _import_lib,$(CONFIG_UK_BASE)/lib/posix-process))<br>
=C2=A0$(eval $(call _import_lib,$(CONFIG_UK_BASE)/lib/uksp))<br>
+$(eval $(call _import_lib,$(CONFIG_UK_BASE)/lib/uksignal))<br>
diff --git a/lib/uksched/include/uk/thread.h b/lib/uksched/include/uk/threa=
d.h<br>
index d8a4ac8..5ec25a8 100644<br>
--- a/lib/uksched/include/uk/thread.h<br>
+++ b/lib/uksched/include/uk/thread.h<br>
@@ -36,6 +36,9 @@<br>
=C2=A0#include &lt;uk/arch/lcpu.h&gt;<br>
=C2=A0#include &lt;uk/arch/time.h&gt;<br>
=C2=A0#include &lt;uk/plat/thread.h&gt;<br>
+#if CONFIG_LIBUKSIGNAL<br>
+#include &lt;uk/uk_signal.h&gt;<br>
+#endif<br>
=C2=A0#include &lt;uk/thread_attr.h&gt;<br>
=C2=A0#include &lt;uk/wait_types.h&gt;<br>
=C2=A0#include &lt;uk/list.h&gt;<br>
@@ -62,6 +65,9 @@ struct uk_thread {<br>
=C2=A0#ifdef CONFIG_LIBNEWLIBC<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 struct _reent reent;<br>
=C2=A0#endif<br>
+#if CONFIG_LIBUKSIGNAL<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0struct uk_thread_sig signals_container;<br>
+#endif<br>
=C2=A0};<br>
<br>
=C2=A0UK_TAILQ_HEAD(uk_thread_list, struct uk_thread);<br>
diff --git a/lib/uksched/sched.c b/lib/uksched/sched.c<br>
index 4b8e149..5a58629 100644<br>
--- a/lib/uksched/sched.c<br>
+++ b/lib/uksched/sched.c<br>
@@ -42,6 +42,9 @@<br>
=C2=A0#if CONFIG_LIBUKSCHEDCOOP<br>
=C2=A0#include &lt;uk/schedcoop.h&gt;<br>
=C2=A0#endif<br>
+#if CONFIG_LIBUKSIGNAL<br>
+#include &lt;uk/uk_signal.h&gt;<br>
+#endif<br>
<br>
=C2=A0struct uk_sched *uk_sched_head;<br>
<br>
@@ -50,6 +53,10 @@ struct uk_sched *uk_sched_default_init(struct uk_alloc *=
a)<br>
=C2=A0{<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 struct uk_sched *s =3D NULL;<br>
<br>
+#if CONFIG_LIBUKSIGNAL<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0uk_proc_sig_init(&amp;uk_proc_sig);<br>
+#endif<br>
+<br>
=C2=A0#if CONFIG_LIBUKSCHEDCOOP<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 s =3D uk_schedcoop_init(a);<br>
=C2=A0#endif<br>
diff --git a/lib/uksched/thread.c b/lib/uksched/thread.c<br>
index f8ae786..609a4ce 100644<br>
--- a/lib/uksched/thread.c<br>
+++ b/lib/uksched/thread.c<br>
@@ -125,6 +125,9 @@ int uk_thread_init(struct uk_thread *thread,<br>
=C2=A0#ifdef CONFIG_LIBNEWLIBC<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 reent_init(&amp;thread-&gt;reent);<br>
=C2=A0#endif<br>
+#if CONFIG_LIBUKSIGNAL<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0uk_thread_sig_init(&amp;thread-&gt;signals_cont=
ainer);<br>
+#endif<br>
<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 uk_pr_info(&quot;Thread \&quot;%s\&quot;: point=
er: %p, stack: %p, tls: %p\n&quot;,<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0name, =
thread, thread-&gt;stack, thread-&gt;tls);<br>
@@ -135,6 +138,9 @@ int uk_thread_init(struct uk_thread *thread,<br>
=C2=A0void uk_thread_fini(struct uk_thread *thread, struct uk_alloc *alloca=
tor)<br>
=C2=A0{<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 UK_ASSERT(thread !=3D NULL);<br>
+#if CONFIG_LIBUKSIGNAL<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0uk_thread_sig_uninit(&amp;thread-&gt;signals_co=
ntainer);<br>
+#endif<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 ukplat_thread_ctx_destroy(allocator, thread-&gt=
;ctx);<br>
=C2=A0}<br>
<br>
diff --git a/lib/uksignal/Config.uk b/lib/uksignal/Config.uk<br>
new file mode 100644<br>
index 0000000..56c1644<br>
--- /dev/null<br>
+++ b/lib/uksignal/Config.uk<br>
@@ -0,0 +1,7 @@<br>
+menuconfig LIBUKSIGNAL<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0bool &quot;uksignal: Unikraft signals&quot;<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0default n<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0select LIBNOLIBC if !HAVE_LIBC<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0select LIBUKDEBUG<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0select LIBUKALLOC<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0select LIBUKSCHED<br>
diff --git a/lib/uksignal/Makefile.uk b/lib/uksignal/Makefile.uk<br>
new file mode 100644<br>
index 0000000..0f1f539<br>
--- /dev/null<br>
+++ b/lib/uksignal/Makefile.uk<br>
@@ -0,0 +1,8 @@<br>
+$(eval $(call addlib_s,libuksignal,$(CONFIG_LIBUKSIGNAL)))<br>
+<br>
+CINCLUDES-$(CONFIG_LIBUKSIGNAL)=C2=A0 =C2=A0 =C2=A0+=3D -I$(LIBUKSIGNAL_BA=
SE)/include<br>
+CXXINCLUDES-$(CONFIG_LIBUKSIGNAL)=C2=A0 =C2=A0+=3D -I$(LIBUKSIGNAL_BASE)/i=
nclude<br>
+<br>
+LIBUKSIGNAL_SRCS-y +=3D $(LIBUKSIGNAL_BASE)/signal.c<br>
+LIBUKSIGNAL_SRCS-y +=3D $(LIBUKSIGNAL_BASE)/sigset.c<br>
+LIBUKSIGNAL_SRCS-y +=3D $(LIBUKSIGNAL_BASE)/uk_signal.c<br>
\ No newline at end of file<br>
diff --git a/lib/uksignal/README b/lib/uksignal/README<br>
new file mode 100644<br>
index 0000000..ff8691f<br>
--- /dev/null<br>
+++ b/lib/uksignal/README<br>
@@ -0,0 +1,7 @@<br>
+This library provides a basic implementation of signals over<br>
+Unikraft. It supports signals between threads and process wide<br>
+signals.<br>
+<br>
+It doesn&#39;t support signal codes, rt signals and executes the signal<br=
>
+handlers on the thread stack. It is also not yet integrated with our<br>
+irqs to deliver signals like SIGSEGV.<br>
\ No newline at end of file<br>
diff --git a/lib/uksignal/<a href=3D"http://exportsyms.uk" rel=3D"noreferre=
r" target=3D"_blank">exportsyms.uk</a> b/lib/uksignal/<a href=3D"http://exp=
ortsyms.uk" rel=3D"noreferrer" target=3D"_blank">exportsyms.uk</a><br>
new file mode 100644<br>
index 0000000..dbf23fe<br>
--- /dev/null<br>
+++ b/lib/uksignal/<a href=3D"http://exportsyms.uk" rel=3D"noreferrer" targ=
et=3D"_blank">exportsyms.uk</a><br>
@@ -0,0 +1,27 @@<br>
+# uk_signal.h<br>
+uk_proc_sig<br>
+<br>
+uk_sig_handle_signals<br>
+uk_proc_sig_init<br>
+uk_thread_sig_init<br>
+uk_thread_sig_uninit<br>
+uk_sig_thread_kill<br>
+uk_thread_sigmask<br>
+<br>
+# signal.h<br>
+sigaction<br>
+signal<br>
+sigprocmask<br>
+sigsuspend<br>
+sigpending<br>
+sigwait<br>
+kill<br>
+raise<br>
+pthread_sigmask<br>
+<br>
+# sigset.h<br>
+sigemptyset<br>
+sigfillset<br>
+sigaddset<br>
+sigdelset<br>
+sigismember<br>
\ No newline at end of file<br>
diff --git a/lib/uksignal/include/uk/bits/sigset.h b/lib/uksignal/include/u=
k/bits/sigset.h<br>
new file mode 100644<br>
index 0000000..3642633<br>
--- /dev/null<br>
+++ b/lib/uksignal/include/uk/bits/sigset.h<br>
@@ -0,0 +1,66 @@<br>
+#ifndef __UK_SIGNAL_H__<br>
+#error Do not include this header directly<br>
+#endif<br>
+<br>
+#ifndef __UK_SIGSET_H__<br>
+#define __UK_SIGSET_H__<br>
+<br>
+#ifdef __cplusplus<br>
+extern &quot;C&quot; {<br>
+#endif<br>
+<br>
+#define SIG_BLOCK=C2=A0 =C2=A0 =C2=A00<br>
+#define SIG_UNBLOCK=C2=A0 =C2=A01<br>
+#define SIG_SETMASK=C2=A0 =C2=A02<br>
+<br>
+typedef unsigned long __sigset_t;<br>
+typedef __sigset_t sigset_t;<br>
+<br>
+int sigemptyset(sigset_t *set);<br>
+int sigfillset(sigset_t *set);<br>
+int sigaddset(sigset_t *set, int signo);<br>
+int sigdelset(sigset_t *set, int signo);<br>
+int sigismember(const sigset_t *set, int signo);<br>
+<br>
+/* TODO: do we have gnu statement expression?=C2=A0 */<br>
+/* internal use */<br>
+#define uk_sigemptyset(ptr)=C2=A0 =C2=A0 \<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0do {=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*(ptr) =3D 0;=C2=A0 =C2=A0 =C2=A0\<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0} while (0)<br>
+#define uk_sigfillset(ptr)=C2=A0 =C2=A0 =C2=A0\<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0do {=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*(ptr) =3D ~((__sigset_t) 0);=C2=A0 =C2=A0 =C2=A0\<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0} while (0)<br>
+#define uk_sigaddset(ptr, signo)=C2=A0 =C2=A0 =C2=A0 =C2=A0\<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0do {=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*(ptr) |=3D (1 &lt;&lt; ((signo) - 1)); \<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0} while (0)<br>
+#define uk_sigdelset(ptr, signo)=C2=A0 =C2=A0 =C2=A0 =C2=A0\<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0do {=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*(ptr) &amp;=3D ~(1 &lt;&lt; ((signo) - 1));=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} while (0)<br>
+#define uk_sigcopyset(ptr1, ptr2)=C2=A0 =C2=A0 =C2=A0 \<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0do {=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*(ptr1) =3D *(ptr2);=C2=A0 =C2=A0 =C2=A0 \<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0} while (0)<br>
+#define uk_sigandset(ptr1, ptr2)=C2=A0 =C2=A0 =C2=A0 =C2=A0\<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0do {=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*(ptr1) &amp;=3D *(ptr2);=C2=A0 =C2=A0 =C2=A0\<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0} while (0)<br>
+#define uk_sigorset(ptr1, ptr2)=C2=A0 =C2=A0 =C2=A0 =C2=A0 \<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0do {=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*(ptr1) |=3D *(ptr2);=C2=A0 =C2=A0 =C2=A0\<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0} while (0)<br>
+#define uk_sigreverseset(ptr)=C2=A0 \<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0do {=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*(ptr) =3D ~(*(ptr));=C2=A0 =C2=A0 =C2=A0\<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0} while (0)<br>
+#define uk_sigismember(ptr, signo) (*(ptr) &amp; (1 &lt;&lt; ((signo) - 1)=
))<br>
+#define uk_sigisempty(ptr) (*(ptr) =3D=3D 0)<br>
+<br>
+#ifdef __cplusplus<br>
+}<br>
+#endif<br>
+<br>
+#endif /* __UK_SIGSET_H__ */<br>
diff --git a/lib/uksignal/include/uk/signal.h b/lib/uksignal/include/uk/sig=
nal.h<br>
new file mode 100644<br>
index 0000000..43fdabc<br>
--- /dev/null<br>
+++ b/lib/uksignal/include/uk/signal.h<br>
@@ -0,0 +1,131 @@<br>
+/* adapted from OSv */<br>
+#ifndef __UK_SIGNAL_H__<br>
+#define __UK_SIGNAL_H__<br>
+<br>
+#include &lt;stddef.h&gt;<br>
+#include &lt;uk/bits/sigset.h&gt;<br>
+<br>
+#ifdef __cplusplus<br>
+extern &quot;C&quot; {<br>
+#endif<br>
+<br>
+#define SIGHUP=C2=A0 =C2=A0 1<br>
+#define SIGINT=C2=A0 =C2=A0 2<br>
+#define SIGQUIT=C2=A0 =C2=A03<br>
+#define SIGILL=C2=A0 =C2=A0 4<br>
+#define SIGTRAP=C2=A0 =C2=A05<br>
+#define SIGABRT=C2=A0 =C2=A06<br>
+#define SIGIOT=C2=A0 =C2=A0 SIGABRT<br>
+#define SIGBUS=C2=A0 =C2=A0 7<br>
+#define SIGFPE=C2=A0 =C2=A0 8<br>
+#define SIGKILL=C2=A0 =C2=A09<br>
+#define SIGUSR1=C2=A0 =C2=A010<br>
+#define SIGSEGV=C2=A0 =C2=A011<br>
+#define SIGUSR2=C2=A0 =C2=A012<br>
+#define SIGPIPE=C2=A0 =C2=A013<br>
+#define SIGALRM=C2=A0 =C2=A014<br>
+#define SIGTERM=C2=A0 =C2=A015<br>
+#define SIGSTKFLT 16<br>
+#define SIGCHLD=C2=A0 =C2=A017<br>
+#define SIGCONT=C2=A0 =C2=A018<br>
+#define SIGSTOP=C2=A0 =C2=A019<br>
+#define SIGTSTP=C2=A0 =C2=A020<br>
+#define SIGTTIN=C2=A0 =C2=A021<br>
+#define SIGTTOU=C2=A0 =C2=A022<br>
+#define SIGURG=C2=A0 =C2=A0 23<br>
+#define SIGXCPU=C2=A0 =C2=A024<br>
+#define SIGXFSZ=C2=A0 =C2=A025<br>
+#define SIGVTALRM 26<br>
+#define SIGPROF=C2=A0 =C2=A027<br>
+#define SIGWINCH=C2=A0 28<br>
+#define SIGIO=C2=A0 =C2=A0 =C2=A029<br>
+#define SIGPOLL=C2=A0 =C2=A029<br>
+#define SIGPWR=C2=A0 =C2=A0 30<br>
+#define SIGSYS=C2=A0 =C2=A0 31<br>
+#define SIGUNUSED SIGSYS<br>
+<br>
+#define _NSIG 32<br>
+<br>
+#define SA_NOCLDSTOP=C2=A0 1<br>
+#define SA_NOCLDWAIT=C2=A0 2<br>
+#define SA_SIGINFO=C2=A0 =C2=A0 4<br>
+#define SA_ONSTACK=C2=A0 =C2=A0 0x08000000<br>
+#define SA_RESTART=C2=A0 =C2=A0 0x10000000<br>
+#define SA_NODEFER=C2=A0 =C2=A0 0x40000000<br>
+#define SA_RESETHAND=C2=A0 0x80000000<br>
+#define SA_RESTORER=C2=A0 =C2=A00x04000000<br>
+<br>
+typedef int pid_t;<br>
+typedef int sig_atomic_t;<br>
+<br>
+#define NSIG _NSIG<br>
+<br>
+typedef struct {<br>
+=C2=A0 int=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 si_signo;=C2=A0 =C2=A0 /* Sig=
nal number */<br>
+=C2=A0 int=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 si_code;=C2=A0 =C2=A0 =C2=A0/=
* Cause of the signal */<br>
+=C2=A0 pid_t=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0si_pid;=
=C2=A0 =C2=A0 =C2=A0 /* Sending process ID */<br>
+} siginfo_t;<br>
+<br>
+struct sigaction {<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0union {<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0void (*sa_handler)(=
int);<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0void (*sa_sigaction=
)(int, siginfo_t *, void *);<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0} __sa_handler;<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0sigset_t sa_mask;<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0int sa_flags;<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0void (*sa_restorer)(void);<br>
+};<br>
+#define sa_handler=C2=A0 =C2=A0__sa_handler.sa_handler<br>
+#define sa_sigaction __sa_handler.sa_sigaction<br>
+<br>
+#define SIG_ERR=C2=A0 ((void (*)(int))-1)<br>
+#define SIG_DFL=C2=A0 ((void (*)(int)) 0)<br>
+#define SIG_IGN=C2=A0 ((void (*)(int)) 1)<br>
+<br>
+/* TODO: do we have gnu statement expression? */<br>
+#define is_sig_dfl(ptr)=C2=A0 =C2=A0 =C2=A0 =C2=A0 \<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0(!((ptr)-&gt;sa_flags &amp; SA_SIGINFO) &amp;&a=
mp; (ptr)-&gt;sa_handler =3D=3D SIG_DFL)<br>
+<br>
+#define is_sig_ign(ptr)=C2=A0 =C2=A0 =C2=A0 =C2=A0 \<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0(!((ptr)-&gt;sa_flags &amp; SA_SIGINFO) &amp;&a=
mp; (ptr)-&gt;sa_handler =3D=3D SIG_IGN)<br>
+<br>
+int<br>
+sigaction(int signum, const struct sigaction *act, struct sigaction *oldac=
t);<br>
+<br>
+int sigpending(sigset_t *set);<br>
+int sigprocmask(int how, const sigset_t *set, sigset_t *oldset);<br>
+int sigsuspend(const sigset_t *mask);<br>
+int sigwait(const sigset_t *set, int *sig);<br>
+<br>
+int kill(pid_t pid, int sig);<br>
+int raise(int sig);<br>
+<br>
+typedef void (*sighandler_t)(int);<br>
+sighandler_t signal(int signum, sighandler_t handler);<br>
+<br>
+int pthread_sigmask(int how, const sigset_t *set, sigset_t *oldset);<br>
+<br>
+/* TODO: not used - defined just for newlib */<br>
+union sigval {<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0int=C2=A0 =C2=A0 sival_int;=C2=A0 =C2=A0 =C2=A0=
 =C2=A0/* Integer signal value */<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0void=C2=A0 *sival_ptr;=C2=A0 =C2=A0 =C2=A0 =C2=
=A0/* Pointer signal value */<br>
+};<br>
+<br>
+struct sigevent {<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0int=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 sigev_notify;=C2=A0 /* Notification type */<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0int=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 sigev_signo;=C2=A0 =C2=A0/* Signal number */<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0union sigval=C2=A0 =C2=A0 =C2=A0sigev_value;=C2=
=A0 =C2=A0/* Signal value */<br>
+};<br>
+<br>
+/* TODO: not used - defined just for v8 */<br>
+typedef struct sigaltstack {<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0void *ss_sp;<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0int ss_flags;<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0size_t ss_size;<br>
+} stack_t;<br>
+<br>
+#ifdef __cplusplus<br>
+}<br>
+#endif<br>
+<br>
+#endif /* __UK_SIGNAL_H__ */<br>
diff --git a/lib/uksignal/include/uk/string/strsignal.h b/lib/uksignal/incl=
ude/uk/string/strsignal.h<br>
new file mode 100644<br>
index 0000000..73b69cb<br>
--- /dev/null<br>
+++ b/lib/uksignal/include/uk/string/strsignal.h<br>
@@ -0,0 +1,19 @@<br>
+#ifndef __UK_STRSIGNAL_H__<br>
+#define __UK_STRSIGNAL_H__<br>
+<br>
+/*<br>
+ * TODO: not used - delete<br>
+ */<br>
+<br>
+#ifdef __cplusplus<br>
+extern &quot;C&quot; {<br>
+#endif<br>
+<br>
+extern const char * const sys_siglist[];<br>
+char *strsignal(int sig);<br>
+<br>
+#ifdef __cplusplus<br>
+}<br>
+#endif<br>
+<br>
+#endif /* __UK_STRSIGNAL_H__ */<br>
diff --git a/lib/uksignal/include/uk/uk_signal.h b/lib/uksignal/include/uk/=
uk_signal.h<br>
new file mode 100644<br>
index 0000000..cb066d1<br>
--- /dev/null<br>
+++ b/lib/uksignal/include/uk/uk_signal.h<br>
@@ -0,0 +1,136 @@<br>
+#ifndef __UK_UK_SIGNAL_H__<br>
+#define __UK_UK_SIGNAL_H__<br>
+<br>
+#include &lt;uk/list.h&gt;<br>
+#include &lt;uk/signal.h&gt;<br>
+<br>
+#ifdef __cplusplus<br>
+extern &quot;C&quot; {<br>
+#endif<br>
+<br>
+#define _UK_TH_SIG uk_crr_thread_sig_container()<br>
+<br>
+struct uk_thread;<br>
+<br>
+struct uk_signal {<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0siginfo_t info;<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0struct uk_list_head list_node;<br>
+};<br>
+<br>
+/* TODO: add synchronization */<br>
+<br>
+struct uk_proc_sig {<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0/* used as a bitmap for pending signals */<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0sigset_t pending;<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0/* pending signals - valid only if correspondin=
g bit in pending is set */<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0siginfo_t pending_signals[NSIG - 1];<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0/* signal handlers for this process */<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0struct sigaction sigaction[NSIG - 1];<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0/* list of uk_thread_sig from the threads of th=
e proc */<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0struct uk_list_head thread_sig_list;<br>
+};<br>
+<br>
+extern struct uk_proc_sig uk_proc_sig;<br>
+<br>
+enum uk_sig_waiting {<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0UK_SIG_NOT_WAITING =3D 0,<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0UK_SIG_WAITING =3D 1,<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0UK_SIG_WAITING_SCHED =3D 2<br>
+};<br>
+<br>
+struct uk_thread_sig_wait {<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0/*<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 * waiting status<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 *<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 * values:<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 *=C2=A0 =C2=A0 =C2=A0 UK_SIG_NOT_WAITING - thr=
ead is not waiting<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 *=C2=A0 =C2=A0 =C2=A0 UK_SIG_WAITING - thread =
is waiting for a signal<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 *=C2=A0 =C2=A0 =C2=A0 UK_SIG_WAITING_SCHED - t=
hread is waiting to be scheduled<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 */<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0enum uk_sig_waiting status;<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0/* used as a bitmap for awaited signals */<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0sigset_t awaited;<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0/* awaited signal received */<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0siginfo_t received_signal;<br>
+};<br>
+<br>
+struct uk_thread_sig {<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0/* blocked signals */<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0sigset_t mask;<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0/* used as a bitmap for pending signals */<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0sigset_t pending;<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0/* list of pending signals */<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0struct uk_list_head pending_signals;<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0/* signal waiting state */<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0struct uk_thread_sig_wait wait;<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0/* node for the thread_sig_list from the proc *=
/<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0struct uk_list_head list_node;<br>
+};<br>
+<br>
+/* returns number of executed signal handlers */<br>
+int uk_sig_handle_signals(void);<br>
+<br>
+int uk_proc_sig_init(struct uk_proc_sig *sig);<br>
+int uk_thread_sig_init(struct uk_thread_sig *sig);<br>
+void uk_thread_sig_uninit(struct uk_thread_sig *sig);<br>
+<br>
+/* TODO: replace sched thread_kill? */<br>
+int uk_sig_thread_kill(struct uk_thread *tid, int sig);<br>
+int uk_thread_sigmask(int how, const sigset_t *set, sigset_t *oldset);<br>
+<br>
+/* internal use */<br>
+static inline int uk_sig_is_valid(int sig)<br>
+{<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0return (sig &lt; NSIG &amp;&amp; sig &gt; 0);<b=
r>
+}<br>
+<br>
+static inline void uk_sigset_remove_unmaskable(sigset_t *sig)<br>
+{<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0uk_sigdelset(sig, SIGKILL);<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0uk_sigdelset(sig, SIGSTOP);<br>
+}<br>
+<br>
+static inline void uk_add_proc_signal(siginfo_t *sig)<br>
+{<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0uk_proc_sig.pending_signals[sig-&gt;si_signo - =
1] =3D *sig;<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0uk_sigaddset(&amp;uk_proc_sig.pending, sig-&gt;=
si_signo);<br>
+}<br>
+<br>
+static inline void uk_remove_proc_signal(int sig)<br>
+{<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0uk_sigdelset(&amp;uk_proc_sig.pending, sig);<br=
>
+}<br>
+<br>
+/* maybe move to sched */<br>
+struct uk_thread_sig *uk_crr_thread_sig_container(void);<br>
+void uk_sig_init_siginfo(siginfo_t *siginfo, int sig);<br>
+<br>
+/* returns the uk_signal for sig if it is pending on thread */<br>
+struct uk_signal *<br>
+uk_sig_th_get_pending(struct uk_thread_sig *th_sig, int sig);<br>
+<br>
+/* returns the siginfo for sig if it is pending on proc */<br>
+siginfo_t *uk_sig_proc_get_pending(int sig);<br>
+<br>
+/*<br>
+ * returns the uk_signal for a signal from the given<br>
+ * set if it is pending on thread<br>
+ */<br>
+struct uk_signal *<br>
+uk_sig_th_get_pending_any(struct uk_thread_sig *th_sig, sigset_t set);<br>
+<br>
+/*<br>
+ * returns the siginfo for a signal from the given<br>
+ * set if it is pending on proc<br>
+ */<br>
+siginfo_t *uk_sig_proc_get_pending_any(sigset_t set);<br>
+<br>
+int<br>
+uk_deliver_proc_signal(struct uk_thread_sig *th_sig, siginfo_t *sig);<br>
+void uk_execute_handler(siginfo_t sig);<br>
+<br>
+#ifdef __cplusplus<br>
+}<br>
+#endif<br>
+<br>
+#endif /* __UK_UK_SIGNAL_H__ */<br>
diff --git a/lib/uksignal/signal.c b/lib/uksignal/signal.c<br>
new file mode 100644<br>
index 0000000..5f5e289<br>
--- /dev/null<br>
+++ b/lib/uksignal/signal.c<br>
@@ -0,0 +1,320 @@<br>
+/* adapted from OSv */<br>
+<br>
+#include &lt;errno.h&gt;<br>
+<br>
+#include &lt;uk/alloc.h&gt;<br>
+#include &lt;uk/sched.h&gt;<br>
+#include &lt;uk/signal.h&gt;<br>
+#include &lt;uk/thread.h&gt;<br>
+#include &lt;uk/uk_signal.h&gt;<br>
+<br>
+/*<br>
+ * Tries to deliver a pending signal to the current thread<br>
+ * Used only with a waiting thread<br>
+ *<br>
+ * Returns: 0 if no signal was delivered, 1 if a signal was delivered<br>
+ */<br>
+static int uk_get_awaited_signal(void)<br>
+{<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0siginfo_t *siginfo;<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0struct uk_signal *signal;<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0struct uk_thread_sig *ptr;<br>
+<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0ptr =3D _UK_TH_SIG;<br>
+<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0/* try to deliver thread pending signal */<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0signal =3D uk_sig_th_get_pending_any(ptr, ptr-&=
gt;wait.awaited);<br>
+<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0if (signal) {<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0/* set awaited sign=
al */<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0ptr-&gt;wait.receiv=
ed_signal =3D signal-&gt;info;<br>
+<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0/* remove it from t=
he list of pending signals */<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0uk_list_del(&amp;si=
gnal-&gt;list_node);<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0uk_sigdelset(&amp;p=
tr-&gt;pending, signal-&gt;info.si_signo);<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0uk_free(uk_alloc_ge=
t_default(), signal);<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0return 1;<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0}<br>
+<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0/* try to deliver process pending signal */<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0siginfo =3D uk_sig_proc_get_pending_any(ptr-&gt=
;wait.awaited);<br>
+<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0if (siginfo) {<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0ptr-&gt;wait.receiv=
ed_signal =3D *siginfo;<br>
+<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0/* remove it from t=
he list of pending signals */<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0uk_remove_proc_sign=
al(siginfo-&gt;si_signo);<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0return 1;<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0}<br>
+<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0return 0;<br>
+}<br>
+<br>
+/* TODO: We do not support any sa_flags besides SA_SIGINFO */<br>
+int<br>
+sigaction(int signum, const struct sigaction *act, struct sigaction *oldac=
t)<br>
+{<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0struct uk_list_head *i;<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0struct uk_thread_sig *th_sig;<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0struct uk_signal *signal;<br>
+<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0if (!uk_sig_is_valid(signum) ||<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0signum =3D=3D SIGKILL ||<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0signum =3D=3D SIGSTOP) {<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0errno =3D EINVAL;<b=
r>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0return -1;<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0}<br>
+<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0if (oldact)<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0*oldact =3D uk_proc=
_sig.sigaction[signum - 1];<br>
+<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0if (act) {<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0/* TODO: SA_NODEFER=
 */<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0uk_proc_sig.sigacti=
on[signum - 1] =3D *act;<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0uk_sigaddset(&amp;u=
k_proc_sig.sigaction[signum - 1].sa_mask, signum);<br>
+<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0/* remove signal fr=
om where it is pending */<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0if (is_sig_ign(act)=
) {<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/* remove it from proc */<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_remove_proc_signal(signum);<br>
+<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/* remove it from threads*/<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_list_for_each(i, &amp;uk_proc_sig.thread_sig_list) {<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=A0th_sig =3D uk_list_entry(i, struct uk=
_thread_sig, list_node);<br>
+<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=A0signal =3D uk_sig_th_get_pending(th_s=
ig, signum);<br>
+<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=A0if (signal) {<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/* remove=
 it from the list of pending signals */<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=A0uk_list_d=
el(&amp;signal-&gt;list_node);<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=A0uk_sigdel=
set(&amp;th_sig-&gt;pending, signal-&gt;info.si_signo);<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=A0uk_free(u=
k_alloc_get_default(), signal);<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}<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}<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=A0return 0;<br>
+}<br>
+<br>
+static sighandler_t uk_signal(int signum, sighandler_t handler, int sa_fla=
gs)<br>
+{<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0struct sigaction old;<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0struct sigaction act =3D {<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0.sa_handler =3D han=
dler,<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0.sa_flags =3D sa_fl=
ags<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0};<br>
+<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0if (sigaction(signum, &amp;act, &amp;old) &lt; =
0)<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0return SIG_ERR;<br>
+<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0if (old.sa_flags &amp; SA_SIGINFO)<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0return NULL;<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0else<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0return old.sa_handl=
er;<br>
+}<br>
+<br>
+sighandler_t signal(int signum, sighandler_t handler)<br>
+{<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0/* SA_RESTART &lt;- BSD signal semantics */<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0return uk_signal(signum, handler, SA_RESTART);<=
br>
+}<br>
+<br>
+int sigpending(sigset_t *set)<br>
+{<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0struct uk_thread_sig *ptr;<br>
+<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0ptr =3D _UK_TH_SIG;<br>
+<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0uk_sigcopyset(set, &amp;ptr-&gt;pending);<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0uk_sigorset(set, &amp;uk_proc_sig.pending);<br>
+<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0return 0;<br>
+}<br>
+<br>
+int sigprocmask(int how, const sigset_t *set, sigset_t *oldset)<br>
+{<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0return uk_thread_sigmask(how, set, oldset);<br>
+}<br>
+<br>
+int pthread_sigmask(int how, const sigset_t *set, sigset_t *oldset)<br>
+{<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0return uk_thread_sigmask(how, set, oldset);<br>
+}<br>
+<br>
+int sigsuspend(const sigset_t *mask)<br>
+{<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0/* If the signals are ignored, this doesn&#39;t=
 return &lt;- POSIX */<br>
+<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0sigset_t cleaned_mask, tmp;<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0struct uk_thread_sig *ptr;<br>
+<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0uk_sigcopyset(&amp;cleaned_mask, mask);<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0uk_sigset_remove_unmaskable(&amp;cleaned_mask);=
<br>
+<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0ptr =3D _UK_TH_SIG;<br>
+<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0uk_sigcopyset(&amp;ptr-&gt;wait.awaited, &amp;c=
leaned_mask);<br>
+<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0/* we are waiting for all the signals that aren=
&#39;t blocked */<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0uk_sigreverseset(&amp;ptr-&gt;wait.awaited);<br=
>
+<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0/* change mask */<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0uk_sigcopyset(&amp;tmp, &amp;ptr-&gt;mask);<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0uk_sigcopyset(&amp;ptr-&gt;mask, &amp;cleaned_m=
ask);<br>
+<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0while (1) {<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0/* try to deliver a=
 pending signal */<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0if (uk_get_awaited_=
signal())<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0break;<br>
+<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0/* block, yield */<=
br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0uk_thread_block(uk_=
thread_current());<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0ptr-&gt;wait.status=
 =3D UK_SIG_WAITING;<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0uk_sched_yield();<b=
r>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0}<br>
+<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0ptr-&gt;wait.status =3D UK_SIG_NOT_WAITING;<br>
+<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0/* execute handler */<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0uk_execute_handler(ptr-&gt;wait.received_signal=
);<br>
+<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0/* restore mask<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 *<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 * We restore the mask here because we are tech=
nically done with<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 * sigsuspend and the mask must be restored at =
the end of sigsuspend<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 */<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0uk_sigcopyset(&amp;ptr-&gt;mask, &amp;tmp);<br>
+<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0/* execute other pending signals */<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0uk_sig_handle_signals();<br>
+<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0errno =3D EINTR;<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0return -1; /* always returns -1 and sets errno =
to EINTR */<br>
+}<br>
+<br>
+int sigwait(const sigset_t *set, int *sig)<br>
+{<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0/*<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 * If the signals are ignored, this doesn&#39;t=
 return &lt;- TODO: POSIX ??<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 *<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 * POSIX states that the signals in set must ha=
ve been blocked before<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 * calling sigwait, otherwise behavior is undef=
ined -&gt; for us the<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 * behavior is not caring -&gt; even if the sig=
nal is not blocked sigwait<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 * will still accept it<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 *<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 * NOTE: this function is not signal safe<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 */<br>
+<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0int signals_executed;<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0sigset_t cleaned_set, awaited_save;<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0struct uk_thread_sig *ptr;<br>
+<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0uk_sigcopyset(&amp;cleaned_set, set);<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0uk_sigset_remove_unmaskable(&amp;cleaned_set);<=
br>
+<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0if (uk_sigisempty(&amp;cleaned_set))<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0return EINVAL;<br>
+<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0ptr =3D _UK_TH_SIG;<br>
+<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0uk_sigcopyset(&amp;ptr-&gt;wait.awaited, &amp;c=
leaned_set);<br>
+<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0/* save awaited signals */<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0awaited_save =3D ptr-&gt;wait.awaited;<br>
+<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0while (1) {<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0if (uk_get_awaited_=
signal())<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0break;<br>
+<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 =C2=A0 =C2=A0 =C2=A0 =C2=A0 * sigwait allows s=
ignals to be received while<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 * waiting so handl=
e them<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 =C2=A0 =C2=A0 =C2=A0 =C2=A0ptr-&gt;wait.status=
 =3D UK_SIG_NOT_WAITING;<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0signals_executed =
=3D uk_sig_handle_signals();<br>
+<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0if (signals_execute=
d) {<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/*<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 * awaited might be changed by other waiting<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 * done while handling the signal<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 */<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0ptr-&gt;wait.awaited =3D awaited_save;<br>
+<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/*<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 * we might have raised / received a waiting signal<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 * while handling the others<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 */<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0if (uk_get_awaited_signal())<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=A0break;<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/* block, yield */<=
br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0uk_thread_block(uk_=
thread_current());<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0ptr-&gt;wait.status=
 =3D UK_SIG_WAITING;<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0uk_sched_yield();<b=
r>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0}<br>
+<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0ptr-&gt;wait.status =3D UK_SIG_NOT_WAITING;<br>
+<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0/* do not execute handler, set received signal =
*/<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0*sig =3D ptr-&gt;wait.received_signal.si_signo;=
<br>
+<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0/* execute other pending signals */<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0uk_sig_handle_signals();<br>
+<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0return 0; /* returns positive errno */<br>
+}<br>
+<br>
+/*<br>
+ * Search for a thread that does not have the signal blocked<br>
+ * If all of the threads have the signal blocked, add it to process<br>
+ * pending signals<br>
+ */<br>
+int kill(pid_t pid, int sig)<br>
+{<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0/*<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 * POSIX.1 requires that if a process sends a s=
ignal to itself, and the<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 * sending thread does not have the signal bloc=
ked, and no other thread<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 * has it unblocked or is waiting for it in sig=
wait(3), at least one<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 * unblocked signal must be delivered to the se=
nding thread before the<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 * kill() returns.<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 *<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 * FIXME: we don&#39;t implement this ^<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 */<br>
+<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0siginfo_t siginfo;<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0struct uk_list_head *i;<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0struct uk_thread_sig *th_sig;<br>
+<br>
+<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0if (pid !=3D 1 &amp;&amp; pid !=3D 0 &amp;&amp;=
 pid !=3D -1) {<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0errno =3D ESRCH;<br=
>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0return -1;<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0}<br>
+<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0if (!uk_sig_is_valid(sig)) {<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0errno =3D EINVAL;<b=
r>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0return -1;<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0}<br>
+<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0/* setup siginfo */<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0uk_sig_init_siginfo(&amp;siginfo, sig);<br>
+<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0uk_list_for_each(i, &amp;uk_proc_sig.thread_sig=
_list) {<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0th_sig =3D uk_list_=
entry(i, struct uk_thread_sig, list_node);<br>
+<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0if (uk_deliver_proc=
_signal(th_sig, &amp;siginfo) &gt; 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=A0return 0;<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0}<br>
+<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0/* didn&#39;t find any thread that could accept=
 this signal */<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0uk_add_proc_signal(&amp;siginfo);<br>
+<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0return 0;<br>
+}<br>
+<br>
+int raise(int sig)<br>
+{<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0return uk_sig_thread_kill(uk_thread_current(), =
sig);<br>
+}<br>
diff --git a/lib/uksignal/sigset.c b/lib/uksignal/sigset.c<br>
new file mode 100644<br>
index 0000000..2624e6c<br>
--- /dev/null<br>
+++ b/lib/uksignal/sigset.c<br>
@@ -0,0 +1,51 @@<br>
+/* taken from newlib */<br>
+<br>
+#include &lt;errno.h&gt;<br>
+#include &lt;uk/signal.h&gt;<br>
+<br>
+int sigemptyset(sigset_t *set)<br>
+{<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0uk_sigemptyset(set);<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0return 0;<br>
+}<br>
+<br>
+int sigfillset(sigset_t *set)<br>
+{<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0uk_sigfillset(set);<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0return 0;<br>
+}<br>
+<br>
+int sigaddset(sigset_t *set, int signo)<br>
+{<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0if (signo &gt;=3D NSIG || signo &lt;=3D 0) {<br=
>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0errno =3D EINVAL;<b=
r>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0return -1;<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0}<br>
+<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0uk_sigaddset(set, signo);<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0return 0;<br>
+}<br>
+<br>
+int sigdelset(sigset_t *set, int signo)<br>
+{<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0if (signo &gt;=3D NSIG || signo &lt;=3D 0) {<br=
>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0errno =3D EINVAL;<b=
r>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0return -1;<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0}<br>
+<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0uk_sigdelset(set, signo);<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0return 0;<br>
+}<br>
+<br>
+int sigismember(const sigset_t *set, int signo)<br>
+{<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0if (signo &gt;=3D NSIG || signo &lt;=3D 0) {<br=
>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0errno =3D EINVAL;<b=
r>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0return -1;<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0}<br>
+<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0if (uk_sigismember(set, signo))<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0return 1;<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0else<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0return 0;<br>
+}<br>
diff --git a/lib/uksignal/strsignal.c b/lib/uksignal/strsignal.c<br>
new file mode 100644<br>
index 0000000..b672e5f<br>
--- /dev/null<br>
+++ b/lib/uksignal/strsignal.c<br>
@@ -0,0 +1,61 @@<br>
+/* taken from newlib */<br>
+<br>
+#include &lt;uk/uk_signal.h&gt;<br>
+<br>
+/*<br>
+ * TODO: not used - delete<br>
+ */<br>
+<br>
+const char *sigstring[] =3D {<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0&quot;Hangup&quot;,=
<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0&quot;Interrupt&quo=
t;,<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0&quot;Quit&quot;,<b=
r>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0&quot;Illegal instr=
uction&quot;,<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0&quot;Trace/breakpo=
int trap&quot;,<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0&quot;IOT trap&quot=
;,<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0&quot;EMT trap&quot=
;,<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0&quot;Floating poin=
t exception&quot;,<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0&quot;Killed&quot;,=
<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0&quot;Bus error&quo=
t;,<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0&quot;Segmentation =
fault&quot;,<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0&quot;Bad system ca=
ll&quot;,<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0&quot;Broken pipe&q=
uot;,<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0&quot;Alarm clock&q=
uot;,<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0&quot;Terminated&qu=
ot;,<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0&quot;Urgent I/O co=
ndition&quot;,<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0&quot;Stopped (sign=
al)&quot;,<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0&quot;Stopped&quot;=
,<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0&quot;Continued&quo=
t;,<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0&quot;Child exited&=
quot;,<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0&quot;Stopped (tty =
input)&quot;,<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0&quot;Stopped (tty =
output)&quot;,<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0&quot;I/O possible&=
quot;,<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0&quot;CPU time limi=
t exceeded&quot;,<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0&quot;File size lim=
it exceeded&quot;,<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0&quot;Virtual timer=
 expired&quot;,<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0&quot;Profiling tim=
er expired&quot;,<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0&quot;Window change=
d&quot;,<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0&quot;Resource lost=
&quot;,<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0&quot;User defined =
signal 1&quot;,<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0&quot;User defined =
signal 2&quot;<br>
+};<br>
+<br>
+char *strsignal(int sig)<br>
+{<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0char *buffer;<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0struct uk_signals_container *ptr;<br>
+<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0ptr =3D _UK_TH_SIG;<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0buffer =3D UK_SIG_BUF(ptr);<br>
+<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0/*<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 * TODO: this assignment doesn&#39;t really do =
anything<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 * since we return buffer, but newlibc did this=
<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 */<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0if (sig &lt;=3D 0 || sig &gt;=3D NSIG)<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0*buffer =3D &quot;U=
nknown signal&quot;;<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0else<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0*buffer =3D sigstri=
ng[sig - 1];<br>
+<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0return buffer;<br>
+}<br>
diff --git a/lib/uksignal/uk_signal.c b/lib/uksignal/uk_signal.c<br>
new file mode 100644<br>
index 0000000..616b8f7<br>
--- /dev/null<br>
+++ b/lib/uksignal/uk_signal.c<br>
@@ -0,0 +1,451 @@<br>
+#include &lt;errno.h&gt;<br>
+<br>
+#include &lt;uk/alloc.h&gt;<br>
+#include &lt;uk/print.h&gt;<br>
+#include &lt;uk/signal.h&gt;<br>
+#include &lt;uk/thread.h&gt;<br>
+#include &lt;uk/uk_signal.h&gt;<br>
+<br>
+struct uk_proc_sig uk_proc_sig;<br>
+<br>
+int uk_proc_sig_init(struct uk_proc_sig *sig)<br>
+{<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0int i;<br>
+<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0sigemptyset(&amp;sig-&gt;pending);<br>
+<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0for (i =3D 0; i &lt; NSIG - 1; ++i) {<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0/* TODO: set ign to=
 the ones that should be ign */<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0sig-&gt;sigaction[i=
].sa_handler =3D SIG_DFL;<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0sigemptyset(&amp;si=
g-&gt;sigaction[i].sa_mask);<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0sig-&gt;sigaction[i=
].sa_flags =3D 0;<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0}<br>
+<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0UK_INIT_LIST_HEAD(&amp;sig-&gt;thread_sig_list)=
;<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0return 0;<br>
+}<br>
+<br>
+int uk_thread_sig_init(struct uk_thread_sig *sig)<br>
+{<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0sigemptyset(&amp;sig-&gt;mask);<br>
+<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0sig-&gt;wait.status =3D UK_SIG_NOT_WAITING;<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0sigemptyset(&amp;sig-&gt;wait.awaited);<br>
+<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0sigemptyset(&amp;sig-&gt;pending);<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0UK_INIT_LIST_HEAD(&amp;sig-&gt;pending_signals)=
;<br>
+<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0uk_list_add(&amp;sig-&gt;list_node, &amp;uk_pro=
c_sig.thread_sig_list);<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0return 0;<br>
+}<br>
+<br>
+void uk_thread_sig_uninit(struct uk_thread_sig *sig)<br>
+{<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0/* Clear pending signals */<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0struct uk_list_head *i, *tmp;<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0struct uk_signal *signal;<br>
+<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0uk_list_del(&amp;sig-&gt;list_node);<br>
+<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0uk_list_for_each_safe(i, tmp, &amp;sig-&gt;pend=
ing_signals) {<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0signal =3D uk_list_=
entry(i, struct uk_signal, list_node);<br>
+<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0uk_list_del(&amp;si=
gnal-&gt;list_node);<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0uk_free(uk_alloc_ge=
t_default(), signal);<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0}<br>
+}<br>
+<br>
+int uk_sig_handle_signals(void)<br>
+{<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0/*<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 * Do not run pending signals if the thread is =
waiting<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 *<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 * Iterate over pending signals<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 * Check if the signal is blocked<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 *<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 * Before running the handler, remove it from p=
ending<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 */<br>
+<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0int handled =3D 0;<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0sigset_t executable, rmask;<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0struct uk_signal *signal;<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0struct uk_thread_sig *ptr;<br>
+<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0ptr =3D _UK_TH_SIG;<br>
+<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0/*<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 * handle_sigals will be called from<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 * the respective waiting function<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 */<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0if (ptr-&gt;wait.status !=3D UK_SIG_NOT_WAITING=
)<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0return 0;<br>
+<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0/* reverse mask */<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0uk_sigcopyset(&amp;rmask, &amp;ptr-&gt;mask);<b=
r>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0uk_sigreverseset(&amp;rmask);<br>
+<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0/* calculate executable signals */<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0uk_sigcopyset(&amp;executable, &amp;rmask);<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0uk_sigandset(&amp;executable, &amp;ptr-&gt;pend=
ing);<br>
+<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0while (!uk_sigisempty(&amp;executable)) {<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0signal =3D uk_list_=
first_entry(&amp;ptr-&gt;pending_signals, struct uk_signal, list_node);<br>
+<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0/* move it last if =
it&#39;s blocked */<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0if (uk_sigismember(=
&amp;ptr-&gt;mask, signal-&gt;info.si_signo)) {<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_list_del(&amp;signal-&gt;list_node);<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_list_add_tail(&amp;signal-&gt;list_node, &amp;ptr-&gt;pending_=
signals);<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/* remove from the =
list */<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0uk_list_del(&amp;si=
gnal-&gt;list_node);<br>
+<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0/* clear pending st=
atus */<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0uk_sigdelset(&amp;p=
tr-&gt;pending, signal-&gt;info.si_signo);<br>
+<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0/* execute */<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0uk_execute_handler(=
signal-&gt;info);<br>
+<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0uk_free(uk_alloc_ge=
t_default(), signal);<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0handled++;<br>
+<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0/* calculate execut=
able signals */<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0uk_sigcopyset(&amp;=
executable, &amp;rmask);<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0uk_sigandset(&amp;e=
xecutable, &amp;ptr-&gt;pending);<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0}<br>
+<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0return handled;<br>
+}<br>
+<br>
+/*<br>
+ * returns:<br>
+ *=C2=A0 &gt;0 - on success<br>
+ *=C2=A0 0=C2=A0 - if signal is ignored / already pending<br>
+ *=C2=A0 &lt;0 - on failure<br>
+ */<br>
+static int<br>
+uk_deliver_signal_unmasked(struct uk_thread_sig *th_sig, siginfo_t *sig)<b=
r>
+{<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0struct uk_thread *tid;<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0struct uk_signal *uk_sig;<br>
+<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0/* If the signal is ignored, we don&#39;t deliv=
er it */<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0if (is_sig_ign(&amp;uk_proc_sig.sigaction[sig-&=
gt;si_signo - 1]))<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0return 0;<br>
+<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0/* If it is already pending, we don&#39;t deliv=
er it */<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0if (uk_sigismember(&amp;th_sig-&gt;pending, sig=
-&gt;si_signo))<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0return 0;<br>
+<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0uk_sig =3D uk_malloc(uk_alloc_get_default(), si=
zeof(*uk_sig));<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0if (!uk_sig) {<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0uk_pr_warn(&quot;Co=
uld not allocate uk_signal&quot;);<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0return -ENOMEM;<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0}<br>
+<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0uk_sig-&gt;info =3D *sig;<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0uk_list_add(&amp;uk_sig-&gt;list_node, &amp;th_=
sig-&gt;pending_signals);<br>
+<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0uk_sigaddset(&amp;th_sig-&gt;pending, sig-&gt;s=
i_signo);<br>
+<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0/* check if we need to wake the thread */<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0if (th_sig-&gt;wait.status !=3D UK_SIG_NOT_WAIT=
ING &amp;&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=A0th_sig-&gt;wait.status !=3D UK_SIG_WAITING_SCHED) {<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0th_sig-&gt;wait.sta=
tus =3D UK_SIG_WAITING_SCHED;<br>
+<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0tid =3D __container=
of(th_sig, struct uk_thread, signals_container);<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0uk_thread_wake(tid)=
;<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0}<br>
+<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0return 1;<br>
+}<br>
+<br>
+int uk_sig_thread_kill(struct uk_thread *tid, int sig)<br>
+{<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0siginfo_t siginfo;<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0struct uk_signal *signal;<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0struct uk_thread_sig *ptr;<br>
+<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0if (!uk_sig_is_valid(sig)) {<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0errno =3D EINVAL;<b=
r>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0return -1;<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0}<br>
+<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0ptr =3D &amp;tid-&gt;signals_container;<br>
+<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0/* setup siginfo */<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0uk_sig_init_siginfo(&amp;siginfo, sig);<br>
+<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0/* check if we are sending this to ourself */<b=
r>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0if (&amp;tid-&gt;signals_container =3D=3D _UK_T=
H_SIG) {<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0/* if it&#39;s not =
masked just run it */<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0if (!uk_sigismember=
(&amp;ptr-&gt;mask, sig)) {<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/* remove the signal from pending */<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0signal =3D uk_sig_th_get_pending(ptr, sig);<br>
+<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0if (signal) {<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=A0uk_list_del(&amp;signal-&gt;list_node=
);<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=A0uk_sigdelset(&amp;ptr-&gt;pending, si=
g);<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=A0uk_free(uk_alloc_get_default(), signa=
l);<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}<br>
+<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_execute_handler(siginfo);<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0return 0;<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=A0uk_deliver_signal_unmasked(ptr, &amp;siginfo);<=
br>
+<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0return 0;<br>
+}<br>
+<br>
+/*<br>
+ * Used to deliver pending signals after a mask change<br>
+ *<br>
+ * Since mask doesn&#39;t affect the deliverance of signals<br>
+ * directed to threads (this is handled by uk_sig_handle_signals),<br>
+ * we are trying to deliver only pending process signals<br>
+ */<br>
+static inline void uk_deliver_signals_maskchange(void)<br>
+{<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0int i, ret;<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0sigset_t to_send;<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0struct uk_thread_sig *ptr;<br>
+<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0ptr =3D _UK_TH_SIG;<br>
+<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0uk_sigcopyset(&amp;to_send, &amp;ptr-&gt;mask);=
<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0uk_sigandset(&amp;to_send, &amp;uk_proc_sig.pen=
ding);<br>
+<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0for (i =3D 1; i &lt; NSIG; ++i) {<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0if (uk_sigisempty(&=
amp;to_send))<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0break;<br>
+<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0if (uk_sigismember(=
&amp;to_send, i)) {<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0ret =3D uk_deliver_proc_signal(ptr,<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;uk_p=
roc_sig.pending_signals[i - 1]);<br>
+<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0if (ret &gt; 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=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0uk_remove_proc_signal(i);<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=A0uk_sigdelset(&amp;to_send, i);<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}<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>
+<br>
+/*<br>
+ * TODO: if we add rt sig, don&#39;t allow the<br>
+ * two real-time sig that are used internally by the NPTL<br>
+ * threading implementation. Also for all the functions - ignore<br>
+ * those signals silently<br>
+ */<br>
+int uk_thread_sigmask(int how, const sigset_t *set, sigset_t *oldset)<br>
+{<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0/*<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 * running this inside a handler has no effect =
outside the handler<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 * since the mask is restored in execute_handle=
r<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 */<br>
+<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0sigset_t *mask, tmp;<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0struct uk_thread_sig *ptr;<br>
+<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0ptr =3D _UK_TH_SIG;<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0mask =3D &amp;(ptr-&gt;mask);<br>
+<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0if (oldset)<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0*oldset =3D *mask;<=
br>
+<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0if (set) {<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0switch (how) {<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0case SIG_BLOCK:<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_sigorset(mask, set);<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0break;<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0case SIG_UNBLOCK:<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=A0uk_sigcopyset(&amp;tmp, set);<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_sigreverseset(&amp;tmp);<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_sigandset(mask, set);<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0break;<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0case SIG_SETMASK:<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=A0uk_sigcopyset(mask, set);<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0break;<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0default:<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0errno =3D EINVAL;<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0return -1;<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=A0uk_sigset_remove_un=
maskable(mask);<br>
+<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0/* Changed the mask=
, see if we can deliver any pending signals */<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0uk_deliver_signals_=
maskchange();<br>
+<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0uk_sig_handle_signa=
ls();<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0}<br>
+<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0return 0;<br>
+}<br>
+<br>
+struct uk_thread_sig *uk_crr_thread_sig_container(void)<br>
+{<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0return &amp;(uk_thread_current()-&gt;signals_co=
ntainer);<br>
+}<br>
+<br>
+void uk_sig_init_siginfo(siginfo_t *siginfo, int sig)<br>
+{<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0siginfo-&gt;si_signo =3D sig;<br>
+<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0/* TODO: add codes; get pid from getpid() */<br=
>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0siginfo-&gt;si_code =3D 0;<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0siginfo-&gt;si_pid =3D 1;<br>
+}<br>
+<br>
+/* returns the uk_signal for sig if it is pending on thread */<br>
+struct uk_signal *uk_sig_th_get_pending(struct uk_thread_sig *th_sig, int =
sig)<br>
+{<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0struct uk_list_head *i;<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0struct uk_signal *signal;<br>
+<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0if (!uk_sigismember(&amp;th_sig-&gt;pending, si=
g))<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0return NULL;<br>
+<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0uk_list_for_each(i, &amp;th_sig-&gt;pending_sig=
nals) {<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0signal =3D uk_list_=
entry(i, struct uk_signal, list_node);<br>
+<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0if (signal-&gt;info=
.si_signo =3D=3D sig)<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0return signal;<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0}<br>
+<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0/* NOT REACHED */<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0return NULL;<br>
+}<br>
+<br>
+/* returns the siginfo for sig if it is pending on proc */<br>
+siginfo_t *uk_sig_proc_get_pending(int sig)<br>
+{<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0if (!uk_sigismember(&amp;uk_proc_sig.pending, s=
ig))<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0return NULL;<br>
+<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0return &amp;uk_proc_sig.pending_signals[sig - 1=
];<br>
+}<br>
+<br>
+/*<br>
+ * returns the uk_signal for a signal from the given<br>
+ * set if it is pending on thread<br>
+ */<br>
+struct uk_signal *<br>
+uk_sig_th_get_pending_any(struct uk_thread_sig *th_sig, sigset_t set)<br>
+{<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0sigset_t common;<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0struct uk_list_head *i;<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0struct uk_signal *signal;<br>
+<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0uk_sigcopyset(&amp;common, &amp;th_sig-&gt;pend=
ing);<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0uk_sigandset(&amp;common, &amp;set);<br>
+<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0if (uk_sigisempty(&amp;common))<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0return NULL;<br>
+<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0uk_list_for_each(i, &amp;th_sig-&gt;pending_sig=
nals) {<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0signal =3D uk_list_=
entry(i, struct uk_signal, list_node);<br>
+<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0if (uk_sigismember(=
&amp;common, signal-&gt;info.si_signo))<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0return signal;<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0}<br>
+<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0/* NOT REACHED */<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0return NULL;<br>
+}<br>
+<br>
+/*<br>
+ * returns the siginfo for a signal from the given<br>
+ * set if it is pending on proc<br>
+ */<br>
+siginfo_t *uk_sig_proc_get_pending_any(sigset_t set)<br>
+{<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0int sig;<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0sigset_t common;<br>
+<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0uk_sigcopyset(&amp;common, &amp;uk_proc_sig.pen=
ding);<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0uk_sigandset(&amp;common, &amp;set);<br>
+<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0if (uk_sigisempty(&amp;common))<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0return NULL;<br>
+<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0for (sig =3D 1; sig &lt; NSIG; ++sig)<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0if (uk_sigismember(=
&amp;common, sig))<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0return &amp;uk_proc_sig.pending_signals[sig - 1];<br>
+<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0/* NOT REACHED */<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0return NULL;<br>
+}<br>
+<br>
+/*<br>
+ * returns:<br>
+ *=C2=A0 &gt;0 - on success<br>
+ *=C2=A0 0=C2=A0 - if signal is blocked / ignored / already pending<br>
+ *=C2=A0 &lt;0 - on failure<br>
+ */<br>
+int<br>
+uk_deliver_proc_signal(struct uk_thread_sig *th_sig, siginfo_t *sig)<br>
+{<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0if (uk_sigismember(&amp;th_sig-&gt;mask, sig-&g=
t;si_signo))<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0return 0;<br>
+<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0return uk_deliver_signal_unmasked(th_sig, sig);=
<br>
+}<br>
+<br>
+void uk_execute_handler(siginfo_t sig)<br>
+{<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0/*<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 * We save siginfo locally since it might chang=
e<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 * while the handler is runnnig<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 * For example, if we execute a waiting functio=
n inside<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 * the handler and we were already inside a wai=
ting function<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 */<br>
+<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0sigset_t tmp;<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0struct sigaction *act;<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0struct uk_thread_sig *ptr;<br>
+<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0act =3D &amp;uk_proc_sig.sigaction[sig.si_signo=
 - 1];<br>
+<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0/*<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 * Check if the signal is ignored<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 *<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 * This should never happen since<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 * we never deliver ignored signals<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 */<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0if (is_sig_ign(act)) {<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0uk_pr_debug(&quot;I=
gnored signal %d\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=A0sig.si_signo);<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0ukplat_crash();<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0}<br>
+<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0/* our default handler is shutdown */<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0if (is_sig_dfl(act)) {<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0uk_pr_debug(&quot;U=
ncaught signal %d. Powering off.\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=A0sig.si_signo);<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0ukplat_crash();<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0}<br>
+<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0ptr =3D _UK_TH_SIG;<br>
+<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0/* change the mask */<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0uk_sigcopyset(&amp;tmp, &amp;ptr-&gt;mask);<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0uk_sigorset(&amp;ptr-&gt;mask, &amp;act-&gt;sa_=
mask);<br>
+<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0/* run the handler */<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0if (act-&gt;sa_flags &amp; SA_SIGINFO)<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0act-&gt;sa_sigactio=
n(sig.si_signo, &amp;sig, NULL);<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0else<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0act-&gt;sa_handler(=
sig.si_signo);<br>
+<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0/* check if we need to reset handler */<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0if (act-&gt;sa_flags &amp; SA_RESETHAND) {<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0act-&gt;sa_flags =
=3D 0;<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0act-&gt;sa_handler =
=3D SIG_DFL;<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0}<br>
+<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0/* restore the mask */<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0uk_sigcopyset(&amp;ptr-&gt;mask, &amp;tmp);<br>
+}<br>
diff --git a/plat/common/x86/thread_start.S b/plat/common/x86/thread_start.=
S<br>
index 360ca91..a24de0f 100644<br>
--- a/plat/common/x86/thread_start.S<br>
+++ b/plat/common/x86/thread_start.S<br>
@@ -26,6 +26,7 @@<br>
=C2=A0 */<br>
=C2=A0/* Taken from Mini-OS arch/x86/x86_64.S */<br>
<br>
+#include &lt;uk/config.h&gt;<br>
=C2=A0#include &lt;uk/plat/common/sw_ctx.h&gt;<br>
<br>
=C2=A0#define ENTRY(X) .globl X ; X :<br>
@@ -55,6 +56,12 @@ ENTRY(asm_sw_ctx_switch)<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 lea .Lreturn(%rip), %rbx<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 movq %rbx, OFFSETOF_SW_CTX_IP(%rdi)=C2=A0 =C2=
=A0 =C2=A0 =C2=A0/* save EIP */<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 pushq OFFSETOF_SW_CTX_IP(%rsi)=C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 /* restore EIP */<br>
+<br>
+#if CONFIG_LIBUKSIGNAL<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0/* TODO: do we need to save regs? (e.g fpu) */<=
br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0/* stack is aligned here */<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0call uk_sig_handle_signals<br>
+#endif<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 ret<br>
=C2=A0.Lreturn:<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 popq %r15<br>
-- <br>
2.25.1<br>
<br>
<br>
</blockquote></div>

--000000000000df264105b93e89a4--


From minios-devel-bounces@lists.xenproject.org Tue Jan 19 10:48:56 2021
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Tue, 19 Jan 2021 10:48:56 +0000
Received: from list by lists.xenproject.org with outflank-mailman.70254.126019 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1l1oZD-0000Lk-Po; Tue, 19 Jan 2021 10:48:55 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 70254.126019; Tue, 19 Jan 2021 10:48: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 1l1oZD-0000Ld-Mj; Tue, 19 Jan 2021 10:48:55 +0000
Received: by outflank-mailman (input) for mailman id 70254;
 Tue, 19 Jan 2021 10:48: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=N6Sb=GW=gmail.com=dragosargint21@srs-us1.protection.inumbo.net>)
 id 1l1oZC-0000KX-3h
 for minios-devel@lists.xenproject.org; Tue, 19 Jan 2021 10:48:54 +0000
Received: from mail-wm1-x32e.google.com (unknown [2a00:1450:4864:20::32e])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 6c397d9c-6b91-4742-af48-45c78ef050fd;
 Tue, 19 Jan 2021 10:48:52 +0000 (UTC)
Received: by mail-wm1-x32e.google.com with SMTP id c127so820463wmf.5
 for <minios-devel@lists.xenproject.org>; Tue, 19 Jan 2021 02:48: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: 6c397d9c-6b91-4742-af48-45c78ef050fd
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=JLMaerJizGe7rHhXb2WrKwt/r/xdXt6EuN7ua7OM+CY=;
        b=nK5mfx5bfXjV7BVH0sg7wPsR+aK8VG1rHkFsSul29beWBc+MqgV1KJol2wYLmiQGg6
         2+UazAlX5XAmwZBJLxCTdsfpPfsSsHbk4XzPoG37db8WYwNVDudcKutlaZ7+9/Dc5AzG
         daUjDQrF9f1E8uACzX8rHsq69GftQwEM4U8PrWiKERkqKwnttbfK5KoHk/YKjrFdmAva
         Eu05CXu0cYkr9ptIlGTzkCjZ8qm0EXkrbvvE9PV1fiWUho7gUmIJoqie+aq1Dfdj9tfg
         frl611S9mav0Zce+CXU+jXCcpPAdAaRYKhWr4S/s8QAiRv1nAKLv0dKE8KbsDrVScUfs
         zx7A==
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=JLMaerJizGe7rHhXb2WrKwt/r/xdXt6EuN7ua7OM+CY=;
        b=Ase2ET4Nlns+Cnp/CXl9fV8chB0vuBxN/WGKOIdaf96H0UiYquVbEYUO8zKTDaVHNY
         EOcUV+Uradsc2YYRtFFl/xqU6q5+0ttGDmI3GWdF8KPTKsZ/0kHylQ7ZAQQf14rS8dx1
         lySP23Nd6rHK1GiDhh7P5fKLSUNtKBsNMrfam+OFVxfyj/b4NbOKkdwMf8wld9tOeIlF
         cvNIXRxot9e2aerUnvDuM5nMwLpWtOXuFoJ39ejH7w2HMx7vYQyaspOE5/YD9PUaaMYs
         fK00F881mVJXRvUJ9REiGNvs2GwvYiLvE50FhjrucfKerDPRr9ZKdwZDyTD9PVzCUmUG
         tyCw==
X-Gm-Message-State: AOAM5331/Lk9ZaFTEX1jpE6CulkRAixcwfPVwCVZHIp34YsIDNL0HsMh
	OAlv7e0qX0Kr+DlpFjHa70zwuacqqXtU2PYdgaQvw2FejsgmMIRG
X-Google-Smtp-Source: ABdhPJxRSa7d/g8kmV6SlTijOjVwIcFbskogyFV+bEHERJTQfVl7VvU6OvqRAIKRblQ+Bqy6iU9RsbjM8XA7kZ8Ou64=
X-Received: by 2002:a1c:18e:: with SMTP id 136mr2825693wmb.69.1611053331980;
 Tue, 19 Jan 2021 02:48:51 -0800 (PST)
MIME-Version: 1.0
References: <20210116015117.311653-1-b.rizzo@student.uliege.be>
In-Reply-To: <20210116015117.311653-1-b.rizzo@student.uliege.be>
From: dragos argint <dragosargint21@gmail.com>
Date: Tue, 19 Jan 2021 12:48:41 +0200
Message-ID: <CANTUrU=__9fDUtnhNePmm=5jAcPgOW2QrSe-7XgnpDjm_MPezw@mail.gmail.com>
Subject: Re: [UNIKRAFT/NEWLIB PATCH v2 1/1] lib/newlib: Support for uksignal
To: Bernard Rizzo <b.rizzo@student.uliege.be>
Cc: minios-devel@lists.xenproject.org, 
	Mihai Pogonaru <pogonarumihai@gmail.com>, Felipe Huici <felipe.huici@neclab.eu>
Content-Type: multipart/alternative; boundary="0000000000009122bd05b93e9596"

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

Hi, Bernard

It looks good to me!

Reviewed-by: ARGINT DRAGOS IULIAN <dragosargint21@gmail.com>

=C3=8En s=C3=A2m., 16 ian. 2021 la 03:51, Bernard Rizzo <b.rizzo@student.ul=
iege.be> a
scris:

> This patch is an update of the original.
> v2: updated subject & authorship.
>
> Signed-off-by: Mihai Pogonaru <pogonarumihai@gmail.com>
> Signed-off-by: Felipe Huici <felipe.huici@neclab.eu>
> Signed-off-by: Bernard Rizzo <b.rizzo@student.uliege.be>
> ---
>  Makefile.uk      |  4 ++++
>  include/signal.h | 11 +++++++++++
>  plat.c           |  8 --------
>  signal.c         | 50 +++++++++++++++++-------------------------------
>  4 files changed, 33 insertions(+), 40 deletions(-)
>  create mode 100644 include/signal.h
>
> diff --git a/Makefile.uk b/Makefile.uk
> index 82836e4..bb3b65f 100644
> --- a/Makefile.uk
> +++ b/Makefile.uk
> @@ -136,7 +136,9 @@ LIBNEWLIBGLUE_SRCS-y +=3D $(LIBNEWLIBC_BASE)/resource=
.c
>  LIBNEWLIBGLUE_SRCS-y +=3D $(LIBNEWLIBC_BASE)/pty.c
>  LIBNEWLIBGLUE_SRCS-y +=3D $(LIBNEWLIBC_BASE)/locale.c
>  LIBNEWLIBGLUE_SRCS-y +=3D $(LIBNEWLIBC_BASE)/dev.c
> +ifneq ($(CONFIG_LIBUKSIGNAL),y)
>  LIBNEWLIBGLUE_SRCS-y +=3D $(LIBNEWLIBC_BASE)/signal.c
> +endif
>  LIBNEWLIBGLUE_SRCS-y +=3D $(LIBNEWLIBC_BASE)/link.c
>  LIBNEWLIBGLUE_SRCS-y +=3D $(LIBNEWLIBC_BASE)/mntent.c
>  LIBNEWLIBGLUE_SRCS-y +=3D $(LIBNEWLIBC_BASE)/syscall.c
> @@ -414,9 +416,11 @@ LIBNEWLIBC_SRCS-y +=3D
> $(LIBNEWLIB_LIBC)/search/bsd_qsort_r.c
>
>  ########################################################################=
########
>  # Newlib/libc code -- signal
>
>  ########################################################################=
########
> +ifneq ($(CONFIG_LIBUKSIGNAL),y)
>  LIBNEWLIBC_SRCS-y +=3D $(LIBNEWLIB_LIBC)/signal/psignal.c
>  LIBNEWLIBC_SRCS-y +=3D $(LIBNEWLIB_LIBC)/signal/raise.c
>  LIBNEWLIBC_SRCS-y +=3D $(LIBNEWLIB_LIBC)/signal/signal.c
> +endif
>
>
>  ########################################################################=
########
>  # Newlib/libc code -- stdio
> diff --git a/include/signal.h b/include/signal.h
> new file mode 100644
> index 0000000..778dec1
> --- /dev/null
> +++ b/include/signal.h
> @@ -0,0 +1,11 @@
> +#ifndef _NEWLIB_GLUE_SIGNAL_H_
> +#define _NEWLIB_GLUE_SIGNAL_H_
> +#include <uk/config.h>
> +
> +#if CONFIG_LIBUKSIGNAL
> +#include <uk/signal.h>
> +#else
> +#include_next <signal.h>
> +#endif
> +
> +#endif /* _NEWLIB_GLUE_SIGNAL_H_ */
> diff --git a/plat.c b/plat.c
> index df07dce..2a12801 100644
> --- a/plat.c
> +++ b/plat.c
> @@ -47,14 +47,6 @@ int getentropy(void *buf __unused, size_t buflen
> __unused)
>         return -1;
>  }
>
> -int sigprocmask(int how __unused, const sigset_t *set __unused,
> -               sigset_t *oldset __unused)
> -{
> -       /* TODO: implement. */
> -       errno =3D ENOTSUP;
> -       return -1;
> -}
> -
>  #include <uk/plat/bootstrap.h>
>
>  void abort(void)
> diff --git a/signal.c b/signal.c
> index 4279ee7..1f6cae3 100644
> --- a/signal.c
> +++ b/signal.c
> @@ -37,51 +37,37 @@
>  #include <errno.h>
>  #include <signal.h>
>
> +int kill(int pid __unused, int sig __unused)
> +{
> +       errno =3D EINVAL;
> +       return -1;
> +}
> +
>  int sigaction(int sig __unused, const struct sigaction *restrict act
> __unused,
> -             struct sigaction *restrict oact __unused)
> +            struct sigaction *restrict oact __unused)
>  {
>         return 0;
>  }
> -
> +
> +int sigprocmask(int how __unused, const sigset_t *set __unused,
> +                               sigset_t *oldset __unused)
> +{
> +       /* TODO: implement. */
> +       errno =3D ENOTSUP;
> +       return -1;
> +}
> +
>  unsigned int alarm(unsigned int seconds __unused)
>  {
>         return 0;
>  }
> -
> +
>  int pause(void)
>  {
>         return 0;
>  }
> -
> +
>  int siginterrupt(int sig __unused, int flag __unused)
>  {
>         return 0;
>  }
> -
> -int sigsuspend(const sigset_t *mask)
> -{
> -       return 0;
> -}
> -
> -int kill(int pid, int sig __unused)
> -{
> -       /* TODO check sig */
> -       if (pid !=3D UNIKRAFT_PID)
> -               errno =3D ESRCH;
> -       return -1;
> -}
> -
> -int killpg(int pgrp, int sig __unused)
> -{
> -       /* TODO check sig */
> -       if (pgrp !=3D UNIKRAFT_PGID)
> -               errno =3D ESRCH;
> -       return -1;
> -}
> -
> -int sigaltstack(const stack_t *ss, stack_t *old_ss)
> -{
> -       WARN_STUBBED();
> -       errno =3D ENOTSUP;
> -       return -1;
> -}
> --
> 2.25.1
>
>
>

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

<div dir=3D"ltr">Hi, Bernard<div><br></div><div>It looks good to me!</div><=
div><br></div><div>Reviewed-by: ARGINT DRAGOS IULIAN &lt;<a href=3D"mailto:=
dragosargint21@gmail.com">dragosargint21@gmail.com</a>&gt;</div></div><br><=
div class=3D"gmail_quote"><div dir=3D"ltr" class=3D"gmail_attr">=C3=8En s=
=C3=A2m., 16 ian. 2021 la 03:51, Bernard Rizzo &lt;<a href=3D"mailto:b.rizz=
o@student.uliege.be">b.rizzo@student.uliege.be</a>&gt; a scris:<br></div><b=
lockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-le=
ft:1px solid rgb(204,204,204);padding-left:1ex">This patch is an update of =
the original.<br>
v2: updated subject &amp; authorship.<br>
<br>
Signed-off-by: Mihai Pogonaru &lt;<a href=3D"mailto:pogonarumihai@gmail.com=
" target=3D"_blank">pogonarumihai@gmail.com</a>&gt;<br>
Signed-off-by: Felipe Huici &lt;<a href=3D"mailto:felipe.huici@neclab.eu" t=
arget=3D"_blank">felipe.huici@neclab.eu</a>&gt;<br>
Signed-off-by: Bernard Rizzo &lt;<a href=3D"mailto:b.rizzo@student.uliege.b=
e" target=3D"_blank">b.rizzo@student.uliege.be</a>&gt;<br>
---<br>
=C2=A0Makefile.uk=C2=A0 =C2=A0 =C2=A0 |=C2=A0 4 ++++<br>
=C2=A0include/signal.h | 11 +++++++++++<br>
=C2=A0plat.c=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0|=C2=A0 8 --------<br>
=C2=A0signal.c=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0| 50 +++++++++++++++++-----=
--------------------------<br>
=C2=A04 files changed, 33 insertions(+), 40 deletions(-)<br>
=C2=A0create mode 100644 include/signal.h<br>
<br>
diff --git a/Makefile.uk b/Makefile.uk<br>
index 82836e4..bb3b65f 100644<br>
--- a/Makefile.uk<br>
+++ b/Makefile.uk<br>
@@ -136,7 +136,9 @@ LIBNEWLIBGLUE_SRCS-y +=3D $(LIBNEWLIBC_BASE)/resource.c=
<br>
=C2=A0LIBNEWLIBGLUE_SRCS-y +=3D $(LIBNEWLIBC_BASE)/pty.c<br>
=C2=A0LIBNEWLIBGLUE_SRCS-y +=3D $(LIBNEWLIBC_BASE)/locale.c<br>
=C2=A0LIBNEWLIBGLUE_SRCS-y +=3D $(LIBNEWLIBC_BASE)/dev.c<br>
+ifneq ($(CONFIG_LIBUKSIGNAL),y)<br>
=C2=A0LIBNEWLIBGLUE_SRCS-y +=3D $(LIBNEWLIBC_BASE)/signal.c<br>
+endif<br>
=C2=A0LIBNEWLIBGLUE_SRCS-y +=3D $(LIBNEWLIBC_BASE)/link.c<br>
=C2=A0LIBNEWLIBGLUE_SRCS-y +=3D $(LIBNEWLIBC_BASE)/mntent.c<br>
=C2=A0LIBNEWLIBGLUE_SRCS-y +=3D $(LIBNEWLIBC_BASE)/syscall.c<br>
@@ -414,9 +416,11 @@ LIBNEWLIBC_SRCS-y +=3D $(LIBNEWLIB_LIBC)/search/bsd_qs=
ort_r.c<br>
=C2=A0#####################################################################=
###########<br>
=C2=A0# Newlib/libc code -- signal<br>
=C2=A0#####################################################################=
###########<br>
+ifneq ($(CONFIG_LIBUKSIGNAL),y)<br>
=C2=A0LIBNEWLIBC_SRCS-y +=3D $(LIBNEWLIB_LIBC)/signal/psignal.c<br>
=C2=A0LIBNEWLIBC_SRCS-y +=3D $(LIBNEWLIB_LIBC)/signal/raise.c<br>
=C2=A0LIBNEWLIBC_SRCS-y +=3D $(LIBNEWLIB_LIBC)/signal/signal.c<br>
+endif<br>
<br>
=C2=A0#####################################################################=
###########<br>
=C2=A0# Newlib/libc code -- stdio<br>
diff --git a/include/signal.h b/include/signal.h<br>
new file mode 100644<br>
index 0000000..778dec1<br>
--- /dev/null<br>
+++ b/include/signal.h<br>
@@ -0,0 +1,11 @@<br>
+#ifndef _NEWLIB_GLUE_SIGNAL_H_<br>
+#define _NEWLIB_GLUE_SIGNAL_H_<br>
+#include &lt;uk/config.h&gt;<br>
+<br>
+#if CONFIG_LIBUKSIGNAL<br>
+#include &lt;uk/signal.h&gt;<br>
+#else<br>
+#include_next &lt;signal.h&gt;<br>
+#endif<br>
+<br>
+#endif /* _NEWLIB_GLUE_SIGNAL_H_ */<br>
diff --git a/plat.c b/plat.c<br>
index df07dce..2a12801 100644<br>
--- a/plat.c<br>
+++ b/plat.c<br>
@@ -47,14 +47,6 @@ int getentropy(void *buf __unused, size_t buflen __unuse=
d)<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 return -1;<br>
=C2=A0}<br>
<br>
-int sigprocmask(int how __unused, const sigset_t *set __unused,<br>
-=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0sigset_t *oldset __=
unused)<br>
-{<br>
-=C2=A0 =C2=A0 =C2=A0 =C2=A0/* TODO: implement. */<br>
-=C2=A0 =C2=A0 =C2=A0 =C2=A0errno =3D ENOTSUP;<br>
-=C2=A0 =C2=A0 =C2=A0 =C2=A0return -1;<br>
-}<br>
-<br>
=C2=A0#include &lt;uk/plat/bootstrap.h&gt;<br>
<br>
=C2=A0void abort(void)<br>
diff --git a/signal.c b/signal.c<br>
index 4279ee7..1f6cae3 100644<br>
--- a/signal.c<br>
+++ b/signal.c<br>
@@ -37,51 +37,37 @@<br>
=C2=A0#include &lt;errno.h&gt;<br>
=C2=A0#include &lt;signal.h&gt;<br>
<br>
+int kill(int pid __unused, int sig __unused)<br>
+{<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0errno =3D EINVAL;<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0return -1;<br>
+}<br>
+<br>
=C2=A0int sigaction(int sig __unused, const struct sigaction *restrict act =
__unused,<br>
-=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0struct sigaction *restrict=
 oact __unused)<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 struct sigaction *restrict oact =
__unused)<br>
=C2=A0{<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 return 0;<br>
=C2=A0}<br>
-<br>
+<br>
+int sigprocmask(int how __unused, const sigset_t *set __unused,<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=A0sigset_t *oldset __unused)<br>
+{<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0/* TODO: implement. */<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0errno =3D ENOTSUP;<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0return -1;<br>
+}<br>
+<br>
=C2=A0unsigned int alarm(unsigned int seconds __unused)<br>
=C2=A0{<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 return 0;<br>
=C2=A0}<br>
-<br>
+<br>
=C2=A0int pause(void)<br>
=C2=A0{<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 return 0;<br>
=C2=A0}<br>
-<br>
+<br>
=C2=A0int siginterrupt(int sig __unused, int flag __unused)<br>
=C2=A0{<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 return 0;<br>
=C2=A0}<br>
-<br>
-int sigsuspend(const sigset_t *mask)<br>
-{<br>
-=C2=A0 =C2=A0 =C2=A0 =C2=A0return 0;<br>
-}<br>
-<br>
-int kill(int pid, int sig __unused)<br>
-{<br>
-=C2=A0 =C2=A0 =C2=A0 =C2=A0/* TODO check sig */<br>
-=C2=A0 =C2=A0 =C2=A0 =C2=A0if (pid !=3D UNIKRAFT_PID)<br>
-=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0errno =3D ESRCH;<br=
>
-=C2=A0 =C2=A0 =C2=A0 =C2=A0return -1;<br>
-}<br>
-<br>
-int killpg(int pgrp, int sig __unused)<br>
-{<br>
-=C2=A0 =C2=A0 =C2=A0 =C2=A0/* TODO check sig */<br>
-=C2=A0 =C2=A0 =C2=A0 =C2=A0if (pgrp !=3D UNIKRAFT_PGID)<br>
-=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0errno =3D ESRCH;<br=
>
-=C2=A0 =C2=A0 =C2=A0 =C2=A0return -1;<br>
-}<br>
-<br>
-int sigaltstack(const stack_t *ss, stack_t *old_ss)<br>
-{<br>
-=C2=A0 =C2=A0 =C2=A0 =C2=A0WARN_STUBBED();<br>
-=C2=A0 =C2=A0 =C2=A0 =C2=A0errno =3D ENOTSUP;<br>
-=C2=A0 =C2=A0 =C2=A0 =C2=A0return -1;<br>
-}<br>
-- <br>
2.25.1<br>
<br>
<br>
</blockquote></div>

--0000000000009122bd05b93e9596--


From minios-devel-bounces@lists.xenproject.org Mon Jan 25 10:43:56 2021
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Mon, 25 Jan 2021 10:43:56 +0000
Received: from list by lists.xenproject.org with outflank-mailman.74008.133015 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1l3zLd-0001Pr-9m; Mon, 25 Jan 2021 10:43:53 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 74008.133015; Mon, 25 Jan 2021 10:43: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 1l3zLd-0001Pe-6q; Mon, 25 Jan 2021 10:43:53 +0000
Received: by outflank-mailman (input) for mailman id 74008;
 Mon, 25 Jan 2021 10:43: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=y+xC=G4=neclab.eu=sharan.santhanam@srs-us1.protection.inumbo.net>)
 id 1l3zLc-0001PB-1D
 for minios-devel@lists.xenproject.org; Mon, 25 Jan 2021 10:43:52 +0000
Received: from mailer1.neclab.eu (unknown [195.37.70.40])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 3dac7d45-cdb2-44f9-a501-5a90e322eefc;
 Mon, 25 Jan 2021 10:43:49 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
 by mailer1.neclab.eu (Postfix) with ESMTP id C6770103A36;
 Mon, 25 Jan 2021 11:43:48 +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 2G8pCIjrrcIy; Mon, 25 Jan 2021 11:43:48 +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 A22A910103A
 for <minios-devel@lists.xenproject.org>; Mon, 25 Jan 2021 11:43:48 +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.2106.2; Mon, 25 Jan
 2021 11:43: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: 3dac7d45-cdb2-44f9-a501-5a90e322eefc
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/1] Cast value to unsigned to avoid undefined
 behavior
To: <minios-devel@lists.xenproject.org>
References: <20210102214833.20841-1-vlad_andrei.badoiu@upb.ro>
From: Sharan Santhanam <sharan.santhanam@neclab.eu>
Message-ID: <afed5fda-6f2b-f0a2-eaff-77b9dcd66f71@neclab.eu>
Date: Mon, 25 Jan 2021 16:13:43 +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: <20210102214833.20841-1-vlad_andrei.badoiu@upb.ro>
Content-Type: text/plain; charset="utf-8"; format=flowed
Content-Transfer-Encoding: 7bit
Content-Language: en-US
X-Originating-IP: [192.168.24.96]
X-ClientProxiedBy: puck.office.hd (192.168.24.91) To puck.office.hd
 (192.168.24.91)

Hello Vlad,

Thanks for the work.

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


Sharan

On 1/3/21 3:18 AM, Vlad-Andrei Badoiu wrote:
> Signed-off-by: Vlad-Andrei Badoiu <vlad_andrei.badoiu@upb.ro>
> ---
>   plat/common/pci_bus.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/plat/common/pci_bus.c b/plat/common/pci_bus.c
> index cfc404e..7a66e94 100644
> --- a/plat/common/pci_bus.c
> +++ b/plat/common/pci_bus.c
> @@ -80,7 +80,7 @@ static struct pci_bus_handler ph;
>   #define PCI_BUS_SHIFT               (16)
>   #define PCI_DEVICE_SHIFT            (11)
>   #define PCI_FUNCTION_SHIFT          (8)
> -#define PCI_ENABLE_BIT              (1 << 31)
> +#define PCI_ENABLE_BIT              (1u << 31)
>   
>   #define PCI_CONF_CLASS_ID          (0x08)
>   #define PCI_CONF_CLASS_ID_SHFT     (16)


From minios-devel-bounces@lists.xenproject.org Wed Jan 27 09:59:03 2021
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Wed, 27 Jan 2021 09:59:03 +0000
Received: from list by lists.xenproject.org with outflank-mailman.75906.136847 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1l4hbI-0000SE-88; Wed, 27 Jan 2021 09:59:00 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 75906.136847; Wed, 27 Jan 2021 09:59: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 1l4hbI-0000S7-5M; Wed, 27 Jan 2021 09:59:00 +0000
Received: by outflank-mailman (input) for mailman id 75906;
 Wed, 27 Jan 2021 09:58: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=ur+w=G6=uliege.be=gaulthier.gain@srs-us1.protection.inumbo.net>)
 id 1l4hbH-0000S2-0n
 for minios-devel@lists.xenproject.org; Wed, 27 Jan 2021 09:58:59 +0000
Received: from serv108.segi.ulg.ac.be (unknown [139.165.32.111])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 85ec9665-82d3-428e-9795-ba96fbc68e49;
 Wed, 27 Jan 2021 09:58:56 +0000 (UTC)
Received: from gaulthiers-mbp.lan (151.169-240-81.adsl-dyn.isp.belgacom.be
 [81.240.169.151])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
 (No client certificate requested)
 by serv108.segi.ulg.ac.be (Postfix) with ESMTPSA id CADF12012150;
 Wed, 27 Jan 2021 10:58:55 +0100 (CET)
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: 85ec9665-82d3-428e-9795-ba96fbc68e49
DKIM-Filter: OpenDKIM Filter v2.11.0 serv108.segi.ulg.ac.be CADF12012150
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=uliege.be;
	s=ulg20190529; t=1611741535;
	bh=ay7jpZNdrgyavx/tbCptJmsgLaCtDthZWfUVXAJhYuQ=;
	h=From:Subject:Date:In-Reply-To:Cc:To:References:From;
	b=EPg8MTBldv9xWtOJuTCDNpxNMRLAbHaced1YemKr5KhkOQc9AKS13t7+rIQFKz5dw
	 QrVBv0F/bxgu7/2wGH+UDDL1y3Bd9rh0YR63G3bNrGaOCaoOiIHnhfn3SV+oO044vY
	 1v7nfo7BPkbx5u4uvwKtAma3XA+551AEHnqxil2QIX8uBjUySpSH+oanAiSs1s5whm
	 VkjVBCBbrjO61BJUdQMJ38MVYn9yicRDpb6Taqrjeg+v/ugwT5Bc6SRe8hDP6cAjz3
	 2Yfkf3qK3djphLXEn3yH6iNz4M/IZa7KtS8jBK76wSd5qpXekgcj/NZDYshFQKASqe
	 +C2IhbbWrfs9w==
From: Gaulthier Gain <Gaulthier.Gain@uliege.be>
Message-Id: <7BC97F8A-4CCA-4196-A080-164E067CDE45@uliege.be>
Content-Type: multipart/alternative;
	boundary="Apple-Mail=_C9695F0F-4E1C-44B4-B088-383D7197F0E2"
Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.20.0.2.21\))
Subject: Re: [UNIKRAFT/NEWLIB PATCH 1/1] Add NAME_MAX to limits.h
Date: Wed, 27 Jan 2021 10:58:55 +0100
In-Reply-To: <20201227233027.7208-1-vlad_andrei.badoiu@upb.ro>
Cc: minios-devel@lists.xenproject.org
To: Vlad-Andrei Badoiu <vlad_andrei.badoiu@upb.ro>
References: <20201227233027.7208-1-vlad_andrei.badoiu@upb.ro>
X-Mailer: Apple Mail (2.3654.20.0.2.21)


--Apple-Mail=_C9695F0F-4E1C-44B4-B088-383D7197F0E2
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain;
	charset=us-ascii

Hi Vlad,=20

Thanks for this patch.

Reviewed-by: Gaulthier Gain <gaulthier.gain@uliege.be =
<mailto:gaulthier.gain@uliege.be>>

> On 28 Dec 2020, at 00:30, Vlad-Andrei Badoiu =
<vlad_andrei.badoiu@upb.ro> wrote:
>=20
> Signed-off-by: Vlad-Andrei Badoiu <vlad_andrei.badoiu@upb.ro>
> ---
> include/limits.h | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>=20
> 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
>=20
>=20


--Apple-Mail=_C9695F0F-4E1C-44B4-B088-383D7197F0E2
Content-Transfer-Encoding: quoted-printable
Content-Type: text/html;
	charset=us-ascii

<html><head><meta http-equiv=3D"Content-Type" content=3D"text/html; =
charset=3Dus-ascii"></head><body style=3D"word-wrap: break-word; =
-webkit-nbsp-mode: space; line-break: after-white-space;" class=3D""><div =
dir=3D"auto" style=3D"word-wrap: break-word; -webkit-nbsp-mode: space; =
line-break: after-white-space;" class=3D"">Hi Vlad,&nbsp;<div =
class=3D""><br class=3D""></div><div class=3D"">Thanks for this =
patch.</div><div class=3D""><br class=3D""></div><div =
class=3D"">Reviewed-by: Gaulthier Gain &lt;<a =
href=3D"mailto:gaulthier.gain@uliege.be" =
class=3D"">gaulthier.gain@uliege.be</a>&gt;<br class=3D""><div><br =
class=3D""><blockquote type=3D"cite" class=3D""><div class=3D"">On 28 =
Dec 2020, at 00:30, Vlad-Andrei Badoiu &lt;<a =
href=3D"mailto:vlad_andrei.badoiu@upb.ro" =
class=3D"">vlad_andrei.badoiu@upb.ro</a>&gt; wrote:</div><br =
class=3D"Apple-interchange-newline"><div class=3D""><div =
class=3D"">Signed-off-by: Vlad-Andrei Badoiu &lt;<a =
href=3D"mailto:vlad_andrei.badoiu@upb.ro" =
class=3D"">vlad_andrei.badoiu@upb.ro</a>&gt;<br class=3D"">---<br =
class=3D""> include/limits.h | 2 +-<br class=3D""> 1 file changed, 1 =
insertion(+), 1 deletion(-)<br class=3D""><br class=3D"">diff --git =
a/include/limits.h b/include/limits.h<br class=3D"">index =
d31d2f2..cbe57fa 100644<br class=3D"">--- a/include/limits.h<br =
class=3D"">+++ b/include/limits.h<br class=3D"">@@ -73,7 +73,7 @@<br =
class=3D""> #endif<br class=3D""><br class=3D""> #define PATH_MAX =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;1024<br class=3D"">-<br =
class=3D"">+#define NAME_MAX =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;255<br class=3D""> /* The =
maximum number of repeated occurrences of a regular expression<br =
class=3D""> &nbsp;* permitted when using the interval notation =
`\{M,N\}'.<br class=3D""> &nbsp;*/<br class=3D"">-- <br =
class=3D"">2.27.0<br class=3D""><br class=3D""><br =
class=3D""></div></div></blockquote></div><br =
class=3D""></div></div></body></html>=

--Apple-Mail=_C9695F0F-4E1C-44B4-B088-383D7197F0E2--


From minios-devel-bounces@lists.xenproject.org Wed Jan 27 15:36:15 2021
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Wed, 27 Jan 2021 15:36:15 +0000
Received: from list by lists.xenproject.org with outflank-mailman.76164.137307 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1l4mrd-000212-2c; Wed, 27 Jan 2021 15:36:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 76164.137307; Wed, 27 Jan 2021 15:36: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 1l4mrc-00020v-W4; Wed, 27 Jan 2021 15:36:12 +0000
Received: by outflank-mailman (input) for mailman id 76164;
 Wed, 27 Jan 2021 15:36: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=TstE=G6=neclab.eu=sharan.santhanam@srs-us1.protection.inumbo.net>)
 id 1l4mrc-00020q-IY
 for minios-devel@lists.xenproject.org; Wed, 27 Jan 2021 15:36:12 +0000
Received: from mailer2.neclab.eu (unknown [195.37.70.41])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id b8a94014-c5b7-41d9-af0a-050f0df366f6;
 Wed, 27 Jan 2021 15:36:10 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
 by mailer2.neclab.eu (Postfix) with ESMTP id D395DF259E;
 Wed, 27 Jan 2021 16:36:08 +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 b9UknrTttUVb; Wed, 27 Jan 2021 16:36: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 mailer2.neclab.eu (Postfix) with ESMTPS id 9412AF259C;
 Wed, 27 Jan 2021 16:36:04 +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.2106.2; Wed, 27 Jan
 2021 16:36: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: b8a94014-c5b7-41d9-af0a-050f0df366f6
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/1] Add Undefined Behavior Sanitizer Library
To: Vlad-Andrei Badoiu <vlad_andrei.badoiu@upb.ro>,
	<minios-devel@lists.xenproject.org>
CC: <simon.kuenzer@neclab.eu>, <felipe.huici@neclab.eu>
References: <20210103145922.37324-1-vlad_andrei.badoiu@upb.ro>
From: Sharan Santhanam <sharan.santhanam@neclab.eu>
Message-ID: <642de858-2518-121d-047e-9245bac19cbc@neclab.eu>
Date: Wed, 27 Jan 2021 21:05:56 +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: <20210103145922.37324-1-vlad_andrei.badoiu@upb.ro>
Content-Type: text/plain; charset="utf-8"; format=flowed
Content-Transfer-Encoding: 8bit
Content-Language: en-US
X-Originating-IP: [192.168.24.96]
X-ClientProxiedBy: titania.office.hd (192.168.24.89) To puck.office.hd
 (192.168.24.91)

Hello Vlad,

Thanks for the work, Please find the comments inline.

Thanks & Regards

Sharan

On 1/3/21 8:29 PM, Vlad-Andrei Badoiu wrote:
> This patch adds an internal library that implements the functions needed
> by UBSAN. The flag can either be enabled globally by enabling the
> LIBUBSAN_GLOBAL config option or manually by adding the
> -fsanitize=undefined flag.
>
> UBSAN can catch runtime bugs such as dereferencing NULL or non-canonical
> addresses, certain undefined overflow errors, shifting or multiplying
> data which is out of bounds, and other errors.
>
> For example, ubsan will catch the following addition overflow:
> int k = 0x7fffffff;
> k += 127;
>
> Signed-off-by: Vlad-Andrei Badoiu <vlad_andrei.badoiu@upb.ro>
> ---
>   lib/Makefile.uk         |   1 +
>   lib/ubsan/Config.uk     |  14 ++
>   lib/ubsan/Makefile.uk   |   5 +
>   lib/ubsan/exportsyms.uk |  19 +++
>   lib/ubsan/ubsan.c       | 321 ++++++++++++++++++++++++++++++++++++++++
>   5 files changed, 360 insertions(+)
>   create mode 100644 lib/ubsan/Config.uk
>   create mode 100644 lib/ubsan/Makefile.uk
>   create mode 100644 lib/ubsan/exportsyms.uk
>   create mode 100644 lib/ubsan/ubsan.c
>
> diff --git a/lib/Makefile.uk b/lib/Makefile.uk
> index 07e8a29..e9fc205 100644
> --- a/lib/Makefile.uk
> +++ b/lib/Makefile.uk
> @@ -37,3 +37,4 @@ $(eval $(call _import_lib,$(CONFIG_UK_BASE)/lib/ukmmap))
>   $(eval $(call _import_lib,$(CONFIG_UK_BASE)/lib/ukblkdev))
>   $(eval $(call _import_lib,$(CONFIG_UK_BASE)/lib/posix-process))
>   $(eval $(call _import_lib,$(CONFIG_UK_BASE)/lib/uksp))
> +$(eval $(call _import_lib,$(CONFIG_UK_BASE)/lib/ubsan))
> diff --git a/lib/ubsan/Config.uk b/lib/ubsan/Config.uk
> new file mode 100644
> index 0000000..92239a0
> --- /dev/null
> +++ b/lib/ubsan/Config.uk
> @@ -0,0 +1,14 @@
> +menuconfig LIBUBSAN
> +	bool "ubsan: Undefined Behavior Sanitization"
> +	default n
> +
> +if LIBUBSAN
> +
> +config LIBUBSAN_GLOBAL
> +	bool "Global undefined sanitization"
> +	default n
> +	help

There is a trailing white space here.


> +|       |       Enable undefined behavior sanitization globally.

There are some additional characters in the config.


> +
> +endif
> +
> diff --git a/lib/ubsan/Makefile.uk b/lib/ubsan/Makefile.uk
> new file mode 100644
> index 0000000..ffbb2e9
> --- /dev/null
> +++ b/lib/ubsan/Makefile.uk
> @@ -0,0 +1,5 @@
> +$(eval $(call addlib_s,libubsan,$(CONFIG_LIBUBSAN)))
> +
> +COMPFLAGS-$(CONFIG_LIBUBSAN_GLOBAL)	+= -fsanitize=undefined
> +
> +LIBUBSAN_SRCS-y += $(LIBUBSAN_BASE)/ubsan.c
> diff --git a/lib/ubsan/exportsyms.uk b/lib/ubsan/exportsyms.uk
> new file mode 100644
> index 0000000..50f6165
> --- /dev/null
> +++ b/lib/ubsan/exportsyms.uk
> @@ -0,0 +1,19 @@
> +__ubsan_handle_type_mismatch
> +__ubsan_handle_type_mismatch_v1
> +__ubsan_handle_mul_overflow
> +__ubsan_handle_sub_overflow
> +__ubsan_handle_pointer_overflow
> +__ubsan_handle_add_overflow
> +__ubsan_handle_negate_overflow
> +__ubsan_handle_out_of_bounds
> +__ubsan_handle_shift_out_of_bounds
> +__ubsan_handle_nonnull_arg
> +__ubsan_handle_divrem_overflow
> +__ubsan_handle_vla_bound_not_positive
> +__ubsan_handle_load_invalid_value
> +__ubsan_handle_cfi_bad_icall
> +__ubsan_handle_nonnull_return
> +__ubsan_handle_function_type_mismatch
> +__ubsan_handle_float_cast_overflow
> +__ubsan_handle_builtin_unreachable
> +__ubsan_handle_missing_return
> diff --git a/lib/ubsan/ubsan.c b/lib/ubsan/ubsan.c
> new file mode 100644
> index 0000000..fa8feac
> --- /dev/null
> +++ b/lib/ubsan/ubsan.c
> @@ -0,0 +1,321 @@
> +/* SPDX-License-Identifier: BSD-3-Clause */
> +/*
> + * Authors: Vlad-Andrei Badoiu <vlad_andrei.badoiu@upb.ro>
> + *
> + * Copyright (c) 2020, University Politehnica of Bucharest. All rights reserved.
> + *
> + * Redistribution and use in source and binary forms, with or without
> + * modification, are permitted provided that the following conditions
> + * are met:
> + *
> + * 1. Redistributions of source code must retain the above copyright
> + *    notice, this list of conditions and the following disclaimer.
> + * 2. Redistributions in binary form must reproduce the above copyright
> + *    notice, this list of conditions and the following disclaimer in the
> + *    documentation and/or other materials provided with the distribution.
> + * 3. Neither the name of the copyright holder nor the names of its
> + *    contributors may be used to endorse or promote products derived from
> + *    this software without specific prior written permission.
> + *
> + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
> + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
> + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
> + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
> + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
> + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
> + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
> + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
> + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
> + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
> + * POSSIBILITY OF SUCH DAMAGE.
> + *
> + */
> +
> +#include <stdint.h>
> +#include <uk/assert.h>
> +
> +struct source_location {
> +	const char *filename;
> +	uint32_t line;
> +	uint32_t column;
> +};
> +
> +struct type_descriptor {
> +	uint16_t kind;
> +	uint16_t info;
> +	char name[];
> +};
> +
> +struct out_of_bounds_info {
> +	struct source_location location;
> +	struct type_descriptor left_type;
> +	struct type_descriptor right_type;
> +};
> +
> +struct type_mismatch_info {
> +	struct source_location location;
> +	struct type_descriptor *type;
> +	uintptr_t alignment;

 Â Â Â Â Â Â Â Â Â Â  The alignment field of the `type_mismatch_info` becomes a 
field of
 Â Â Â Â Â Â Â Â Â Â  type char in compiler version gcc-8 and llvm version 8. With 
this
 Â Â Â Â Â Â Â Â Â Â  change they introduced the type_mismatch_v1. If we want to 
handle
 Â Â Â Â Â Â Â Â Â Â  this in a type_mismatch_info, we probably should name it 
suitably
 Â Â Â Â Â Â Â Â Â Â  and make the alignment field as unsigned long alignment 
instead of
 Â Â Â Â Â Â Â Â Â Â  the uintptr_t.

> +	uint8_t type_check_kind;
> +};
> +
> +static const struct source_location unknown_location = {
> +
> +	"<unknown file>",
> +	0,
> +	0,
> +};
> +
> +typedef uintptr_t ubsan_value_handle_t;
> +
> +static void ubsan_log_location(const struct source_location *location,
> +			const char *violation) __noreturn;
> +
> +static void ubsan_log_location(const struct source_location *location,
> +			const char *violation)
> +{
> +	if (!location || !location->filename)
> +		location = &unknown_location;
> +
> +	UK_CRASH("Undefined behavior at %s:%d:%d:%s",
> +		location->filename, location->line,
> +		location->column, violation);

 Â Â Â Â Â Â Â Â Â  The default behavior we implement is to crash the 
application. If you

 Â Â Â Â Â Â Â Â Â Â  run ubsan on user application it continues execution. The 
behavior

 Â Â Â Â Â Â Â Â Â  is overriden by using another compiler flag 
-fnosanitize-recover. We
 Â Â Â Â Â Â Â Â Â  probably need to stick with this behavior.
> +}
> +
> +void __ubsan_handle_type_mismatch(void *data_raw,
> +				  void *pointer_raw)
> +{
> +	struct type_mismatch_info *data =
> +		(struct type_mismatch_info *) data_raw;

 Â Â Â Â Â Â Â Â Â  There is data type mismatch between type_mismatch_info and
 Â Â Â Â Â Â Â Â Â  type_mismatch_info_v1, so we should careful in handling it
 Â Â Â Â Â Â Â Â Â  in a common structure.


> +	ubsan_value_handle_t pointer = (ubsan_value_handle_t) pointer_raw;
> +	const char *violation = "type mismatch";
> +
> +	if (!pointer)
> +		violation = "null pointer access";
> +	else if (data->alignment && (pointer & (data->alignment - 1)))
> +		violation = "unaligned access";
> +
> +	ubsan_log_location(&data->location, violation);
> +}
> +
> +void __ubsan_handle_type_mismatch_v1(void *data_raw,
> +				  void *pointer_raw)
> +{
> +	__ubsan_handle_type_mismatch(data_raw, pointer_raw);
> +}
> +
> +struct ubsan_overflow_data {
> +	struct source_location location;
> +	struct type_descriptor *type;
> +};
> +
> +void __ubsan_handle_mul_overflow(void *data_raw,
> +				 void *lhs_raw __unused,
> +				 void *rhs_raw __unused)

Missing <uk/essentials.h>


> +{
> +	struct ubsan_overflow_data *data =
> +			(struct ubsan_overflow_data *) data_raw;
> +
> +	ubsan_log_location(&data->location, "multiplication overflow");
> +}
> +
> +void __ubsan_handle_pointer_overflow(void *data_raw,
> +				 void *base __unused,
> +				 void *result __unused)
> +{
> +	struct ubsan_overflow_data *data =
> +			(struct ubsan_overflow_data *) data_raw;
 Â Â Â Â Â Â Â Â Â  The data_raw is of type pointer_overflow. This type contains
 Â Â Â Â Â Â Â Â Â  only the Location information. The `struct type_descriptor 
*type` is
 Â Â Â Â Â Â Â Â Â  missing pointer_overflow data type. We should be careful with 
this conversion.
> +
> +	ubsan_log_location(&data->location, "pointer overflow");
> +}
> +
> +void __ubsan_handle_sub_overflow(void *data_raw,
> +				 void *lhs_raw __unused,
> +				 void *rhs_raw __unused)
> +{
> +	struct ubsan_overflow_data *data =
> +			(struct ubsan_overflow_data *) data_raw;
> +
> +	ubsan_log_location(&data->location, "subtraction overflow");
> +}
> +
> +void __ubsan_handle_add_overflow(void *data_raw,
> +				 void *lhs_raw __unused,
> +				 void *rhs_raw __unused)
> +{
> +	struct ubsan_overflow_data *data =
> +			(struct ubsan_overflow_data *) data_raw;
> +
> +	ubsan_log_location(&data->location, "addition overflow");
> +}
> +
> +void __ubsan_handle_negate_overflow(void *data_raw,
> +				    void *old_value_raw __unused)
> +{
> +	struct ubsan_overflow_data *data =
> +			(struct ubsan_overflow_data *) data_raw;
> +
> +	ubsan_log_location(&data->location, "negation overflow");
> +}
> +
> +void __ubsan_handle_divrem_overflow(void *data_raw,
> +				    void *lhs_raw __unused,
> +				    void *rhs_raw __unused)
> +{
> +	struct ubsan_overflow_data *data =
> +			(struct ubsan_overflow_data *) data_raw;
> +
> +	ubsan_log_location(&data->location, "division remainder overflow");
> +}
> +
> +
> +struct ubsan_out_of_bounds_data {
> +	struct source_location location;
> +	struct type_descriptor *array_type;
> +	struct type_descriptor *index_type;
> +};
> +
> +void __ubsan_handle_out_of_bounds(void *data_raw,
> +				  void *index_raw __unused)
> +{
> +	struct ubsan_out_of_bounds_data *data =
> +			(struct ubsan_out_of_bounds_data *) data_raw;
> +
> +	ubsan_log_location(&data->location, "out of bounds");
Maybe the error message "Index out of bound" instead of "out of bound". 
We could also print which index caused it.
> +}
> +
> +struct ubsan_shift_out_of_bounds_data {
> +	struct source_location location;
> +	struct type_descriptor *lhs_type;
> +	struct type_descriptor *rhs_type;
> +};
> +
> +void __ubsan_handle_shift_out_of_bounds(void *data_raw,
> +					void *lhs_raw __unused,
> +					void *rhs_raw __unused)
> +{
> +	struct ubsan_shift_out_of_bounds_data *data =
> +		(struct ubsan_shift_out_of_bounds_data *) data_raw;
> +
> +	ubsan_log_location(&data->location, "shift out of bounds");
> +}

 Â Â Â Â Â Â Â Â Â  Shift out bound provides information on why this was caused. 
Do we
 Â Â Â Â Â Â Â Â Â  print the information here or postpone it to later revision 
of the library.

 Â Â Â Â Â Â Â Â Â  Based on the provided inputÂ  argumentsÂ  we can identify 
whether there is problem with the shift
 Â Â Â Â Â Â Â Â Â  operand or the number itself. If we want to add this later 
maybe we can add a TODO
 Â Â Â Â Â Â Â Â Â  comment in the callback.


> +
> +struct ubsan_nonnull_arg_data {
> +	struct source_location location;
> +	struct source_location attr_location;

Missing the index arg.


> +};
> +
> +void __ubsan_handle_nonnull_arg(void *data_raw)
> +{
> +	struct ubsan_nonnull_arg_data *data =
> +		(struct ubsan_nonnull_arg_data *) data_raw;
> +
> +	ubsan_log_location(&data->location, "null argument");
> +}
> +
> +struct ubsan_vla_bound_data {
> +	struct source_location location;
> +	struct type_descriptor *type;
> +};
> +
> +void __ubsan_handle_vla_bound_not_positive(void *data_raw,
> +					void *bound_raw __unused)
> +{
> +	struct ubsan_vla_bound_data *data =
> +			(struct ubsan_vla_bound_data *) data_raw;
> +
> +	ubsan_log_location(&data->location, "negative variable array length");
> +}
> +
> +struct ubsan_invalid_value_data {
> +	struct source_location location;
> +	struct type_descriptor *type;
> +};
> +
> +void __ubsan_handle_load_invalid_value(void *data_raw,
> +				void *value_raw __unused)
> +{
> +	struct ubsan_invalid_value_data *data =
> +		(struct ubsan_invalid_value_data *) data_raw;
> +
> +	ubsan_log_location(&data->location, "invalid value load");
It is wise to print which type along with the value.
> +}
> +
> +struct ubsan_cfi_bad_icall_data {
CheckKind field is missing cfi_bad_icall_data
> +	struct source_location location;
> +	struct type_descriptor *type;
> +};
> +
> +void __ubsan_handle_cfi_bad_icall(void *data_raw,
> +				void *value_raw __unused)
> +{
> +	struct ubsan_cfi_bad_icall_data *data =
> +		(struct ubsan_cfi_bad_icall_data *) data_raw;
> +
> +	ubsan_log_location(&data->location,
> +		"control flow integrity check failure during indirect call");
The value_raw give you a ptr to the pc. We might as well print it.
> +}
> +
> +struct ubsan_nonnull_return_data {
> +	struct source_location location;
> +	struct source_location attr_location;
> +};
 Â  There are two version for the structure `nonnull_return_data` like the

 Â  type_mismatch. The version v1 which is available in the later compilers

 Â  `struct source_location location` is no longer available.

 Â  This location information is passed as `data_raw` argument in the 
`__ubsan_handle_nonnull_return`


> +
> +void __ubsan_handle_nonnull_return(void *data_raw)
> +{
> +	struct ubsan_nonnull_return_data *data =
> +		(struct ubsan_nonnull_return_data *) data_raw;
> +
> +	ubsan_log_location(&data->location, "null return");
> +}
> +
> +struct ubsan_function_type_mismatch_data {
> +	struct source_location location;
> +	struct type_descriptor *type;
> +};
> +
> +void __ubsan_handle_function_type_mismatch(void *data_raw,
> +				void *value_raw __unused)
> +{
> +	struct ubsan_function_type_mismatch_data *data =
> +		(struct ubsan_function_type_mismatch_data *) data_raw;
> +
> +	ubsan_log_location(&data->location, "function type mismatch");
We could also print the location using the value_rawÂ  as it point to the 
`pc`.
> +}
> +
> +struct ubsan_float_cast_overflow_data {
> +	struct source_location location;
> +	struct type_descriptor *from_type;
> +	struct type_descriptor *to_type;
> +};
 Â  There are two version for the floating point conversion data type. 
The version
 Â  'v1' has only from_type and to_type, while 'v2' has the source
 Â  location include in it. We should explicitly name the structure type. We
 Â  may look to support both versions, else we need to at least add an 
comment

 Â  on the supported version.


> +
> +void __ubsan_handle_float_cast_overflow(void *data_raw,
> +				void *from_raw __unused)
> +{
> +	struct ubsan_float_cast_overflow_data *data =
> +		(struct ubsan_float_cast_overflow_data *) data_raw;
> +
> +	ubsan_log_location(&data->location, "float cast overflow");
> +}
> +
> +struct ubsan_unreachable_data {
> +	struct source_location location;
> +};
> +
> +void __ubsan_handle_builtin_unreachable(void *data_raw)
> +{
> +	struct ubsan_unreachable_data *data =
> +		(struct ubsan_unreachable_data *) data_raw;
> +
> +	ubsan_log_location(&data->location, "reached unreachable");
> +}
> +
> +void __ubsan_handle_missing_return(void *data_raw) __noreturn;
> +
> +void __ubsan_handle_missing_return(void *data_raw)
> +{
> +	struct ubsan_unreachable_data *data =
> +		(struct ubsan_unreachable_data *) data_raw;
> +
> +	ubsan_log_location(&data->location, "missing return");
> +}


From minios-devel-bounces@lists.xenproject.org Wed Jan 27 20:55:11 2021
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Wed, 27 Jan 2021 20:55:11 +0000
Received: from list by lists.xenproject.org with outflank-mailman.76435.137932 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1l4rqH-0003rM-OO; Wed, 27 Jan 2021 20:55:09 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 76435.137932; Wed, 27 Jan 2021 20:55: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 1l4rqH-0003rF-Ko; Wed, 27 Jan 2021 20:55:09 +0000
Received: by outflank-mailman (input) for mailman id 76435;
 Wed, 27 Jan 2021 20:55: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=ur+w=G6=uliege.be=gaulthier.gain@srs-us1.protection.inumbo.net>)
 id 1l4rqF-0003r6-GU
 for minios-devel@lists.xenproject.org; Wed, 27 Jan 2021 20:55:08 +0000
Received: from serv108.segi.ulg.ac.be (unknown [139.165.32.111])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 91c3c959-a650-4199-81e9-79e8e1782b0c;
 Wed, 27 Jan 2021 20:54:59 +0000 (UTC)
Received: from gaulthiersmbp2.lan (151.169-240-81.adsl-dyn.isp.belgacom.be
 [81.240.169.151])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
 (No client certificate requested)
 by serv108.segi.ulg.ac.be (Postfix) with ESMTPSA id 2B6E9200DF94;
 Wed, 27 Jan 2021 21:54:58 +0100 (CET)
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: 91c3c959-a650-4199-81e9-79e8e1782b0c
DKIM-Filter: OpenDKIM Filter v2.11.0 serv108.segi.ulg.ac.be 2B6E9200DF94
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=uliege.be;
	s=ulg20190529; t=1611780898;
	bh=0aMEDSw9wz/U7PGSYULCFQ/cjerUjQ71kR5yB2/eMuo=;
	h=From:Subject:Date:In-Reply-To:Cc:To:References:From;
	b=XiYKM6lQFYa9FiwKIt/cLiMPHqUoAxf+KmEfCi2r5atp7F5y5Vty4XrUHN4XRhQum
	 PItAHn1CtGemgs/uCFFLW+O79gTlULDM58W60RotF03j5Ib6OnYAFF2FDZEjuTHKoo
	 PyMgN3xq54NJw8jQgaVsUMfZi5YU7hxiiaFje08g31iMI1EO7W9R60rokBNKVV49rU
	 dJ8QgwTpS/4gS9G/fPte3vuHM9OLNc5Jd2iAPw8QfF4GWmiDod+oXww1GxlW5paFiO
	 ml0TjZ6zY6WPCcVUb3bkxhbULr2t0nJutTH5idkmWeM+d1aKqk2749y3o1ZJnJ6QYo
	 hGFEiboI8jewQ==
From: Gaulthier Gain <Gaulthier.Gain@uliege.be>
Message-Id: <293E097C-94D2-4DDF-909B-CFDAB6AEE199@uliege.be>
Content-Type: multipart/alternative;
	boundary="Apple-Mail=_C4ED6FC8-3DAE-4EA8-9960-A284E367E1D8"
Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.40.0.2.32\))
Subject: Re: [UNIKRAFT/NEWLIB PATCH 1/1] Import missing headers from musl
Date: Wed, 27 Jan 2021 21:54:57 +0100
In-Reply-To: <20201227231246.200810-1-vlad_andrei.badoiu@upb.ro>
Cc: minios-devel@lists.xenproject.org
To: Vlad-Andrei Badoiu <vlad_andrei.badoiu@upb.ro>
References: <20201227231246.200810-1-vlad_andrei.badoiu@upb.ro>
X-Mailer: Apple Mail (2.3654.40.0.2.32)


--Apple-Mail=_C4ED6FC8-3DAE-4EA8-9960-A284E367E1D8
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain;
	charset=us-ascii

Hi Vlad,=20

Thanks for this patch.

Reviewed-by: Gaulthier Gain <gaulthier.gain@uliege.be =
<mailto:gaulthier.gain@uliege.be>>

> On 28 Dec 2020, at 00:12, Vlad-Andrei Badoiu =
<vlad_andrei.badoiu@upb.ro> wrote:
>=20
> 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.
>=20
> 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
>=20
> diff --git a/musl-imported/include/mqueue.h =
b/musl-imported/include/mqueue.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 =
*__restrict, const struct timespec *__restrict);
> +int mq_timedsend(mqd_t, const char *, size_t, unsigned, const struct =
timespec *);
> +int mq_unlink(const char *);
> +
> +#ifdef __cplusplus
> +}
> +#endif
> +#endif
> diff --git a/musl-imported/include/obstack.h =
b/musl-imported/include/obstack.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 =
strings
> +   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 =
know
> +   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 =
symbol
> +   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 already,
> +   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 =
2096
> +#  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_chunk */
> +  char *object_base;            /* address of object we are building =
*/
> +  char *next_free;              /* where to add next char to current =
object */
> +  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 =
funcs */
> +  unsigned use_extra_arg : 1;     /* chunk alloc/dealloc funcs take =
extra arg */
> +  unsigned maybe_empty_object : 1; /* There is a possibility that the =
current
> +                                      chunk contains a zero-length =
object.  This
> +                                      prevents freeing the chunk if =
we allocate
> +                                      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 =
*__restrict 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 =
next.
> +   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)) =
(newchunkfun)))
> +
> +#define obstack_freefun(h, newfreefun)					=
      \
> +  ((void) ((h)->freefun.extra =3D (void *(*) (void *, void *)) =
(newfreefun)))
> +
> +#define obstack_1grow_fast(h, achar) ((void) (*((h)->next_free)++ =3D =
(achar)))
> +
> +#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_free.  */
> +# 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_limit)  \
> +         __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/scsi/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/include/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/sys/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
>=20
>=20
>=20
>=20
>=20


--Apple-Mail=_C4ED6FC8-3DAE-4EA8-9960-A284E367E1D8
Content-Transfer-Encoding: quoted-printable
Content-Type: text/html;
	charset=us-ascii

<html><head><meta http-equiv=3D"Content-Type" content=3D"text/html; =
charset=3Dus-ascii"></head><body style=3D"word-wrap: break-word; =
-webkit-nbsp-mode: space; line-break: after-white-space;" class=3D""><span=
 style=3D"caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);" class=3D"">Hi =
Vlad,&nbsp;</span><div class=3D"" style=3D"caret-color: rgb(0, 0, 0); =
color: rgb(0, 0, 0);"><br class=3D""></div><div class=3D"" =
style=3D"caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);">Thanks for =
this patch.</div><div class=3D"" style=3D"caret-color: rgb(0, 0, 0); =
color: rgb(0, 0, 0);"><br class=3D""></div><div class=3D"" =
style=3D"caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);">Reviewed-by: =
Gaulthier Gain &lt;<a href=3D"mailto:gaulthier.gain@uliege.be" =
class=3D"">gaulthier.gain@uliege.be</a>&gt;</div><div><br =
class=3D""><blockquote type=3D"cite" class=3D""><div class=3D"">On 28 =
Dec 2020, at 00:12, Vlad-Andrei Badoiu &lt;<a =
href=3D"mailto:vlad_andrei.badoiu@upb.ro" =
class=3D"">vlad_andrei.badoiu@upb.ro</a>&gt; wrote:</div><br =
class=3D"Apple-interchange-newline"><div class=3D""><div class=3D"">We =
add import the following header files from musl: mqueue.h,<br =
class=3D"">obstack.h, scsi.h, mtio.h, personality.h, timex.h, vfs.h, =
utmp.h,<br class=3D"">utmpx.h. They are used by the compiler-rt =
sanitizer.<br class=3D""><br class=3D"">Signed-off-by: Vlad-Andrei =
Badoiu &lt;<a href=3D"mailto:vlad_andrei.badoiu@upb.ro" =
class=3D"">vlad_andrei.badoiu@upb.ro</a>&gt;<br class=3D"">---<br =
class=3D""> musl-imported/include/mqueue.h =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;| &nbsp;36 ++<br =
class=3D""> musl-imported/include/obstack.h =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;| 538 =
++++++++++++++++++++++++<br class=3D""> =
musl-imported/include/scsi/scsi.h &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;| =
150 +++++++<br class=3D""> musl-imported/include/sys/mtio.h =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;| 188 +++++++++<br class=3D""> =
musl-imported/include/sys/personality.h | &nbsp;46 ++<br class=3D""> =
musl-imported/include/sys/timex.h &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;| =
&nbsp;98 +++++<br class=3D""> musl-imported/include/sys/vfs.h =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;| &nbsp;&nbsp;1 +<br =
class=3D""> musl-imported/include/utmp.h =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;| =
&nbsp;52 +++<br class=3D""> musl-imported/include/utmpx.h =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;| &nbsp;62 =
+++<br class=3D""> 9 files changed, 1171 insertions(+)<br class=3D""> =
create mode 100644 musl-imported/include/mqueue.h<br class=3D""> create =
mode 100644 musl-imported/include/obstack.h<br class=3D""> create mode =
100644 musl-imported/include/scsi/scsi.h<br class=3D""> create mode =
100644 musl-imported/include/sys/mtio.h<br class=3D""> create mode =
100644 musl-imported/include/sys/personality.h<br class=3D""> create =
mode 100644 musl-imported/include/sys/timex.h<br class=3D""> create mode =
100644 musl-imported/include/sys/vfs.h<br class=3D""> create mode 100644 =
musl-imported/include/utmp.h<br class=3D""> create mode 100644 =
musl-imported/include/utmpx.h<br class=3D""><br class=3D"">diff --git =
a/musl-imported/include/mqueue.h b/musl-imported/include/mqueue.h<br =
class=3D"">new file mode 100644<br class=3D"">index 0000000..ef4113c<br =
class=3D"">--- /dev/null<br class=3D"">+++ =
b/musl-imported/include/mqueue.h<br class=3D"">@@ -0,0 +1,36 @@<br =
class=3D"">+#ifndef _MQUEUE_H<br class=3D"">+#define _MQUEUE_H<br =
class=3D"">+#ifdef __cplusplus<br class=3D"">+extern "C" {<br =
class=3D"">+#endif<br class=3D"">+<br class=3D"">+#include =
&lt;features.h&gt;<br class=3D"">+<br class=3D"">+#define =
__NEED_size_t<br class=3D"">+#define __NEED_ssize_t<br class=3D"">+#define=
 __NEED_pthread_attr_t<br class=3D"">+#define __NEED_time_t<br =
class=3D"">+#define __NEED_struct_timespec<br class=3D"">+#include =
&lt;bits/alltypes.h&gt;<br class=3D"">+<br class=3D"">+typedef int =
mqd_t;<br class=3D"">+struct mq_attr {<br class=3D"">+<span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span>long =
mq_flags, mq_maxmsg, mq_msgsize, mq_curmsgs,_unused[4];<br =
class=3D"">+};<br class=3D"">+struct sigevent;<br class=3D"">+<br =
class=3D"">+int mq_close(mqd_t);<br class=3D"">+int mq_getattr(mqd_t, =
struct mq_attr *);<br class=3D"">+int mq_notify(mqd_t, const struct =
sigevent *);<br class=3D"">+mqd_t mq_open(const char *, int, ...);<br =
class=3D"">+ssize_t mq_receive(mqd_t, char *, size_t, unsigned *);<br =
class=3D"">+int mq_send(mqd_t, const char *, size_t, unsigned);<br =
class=3D"">+int mq_setattr(mqd_t, const struct mq_attr *__restrict, =
struct mq_attr *__restrict);<br class=3D"">+ssize_t =
mq_timedreceive(mqd_t, char *__restrict, size_t, unsigned *__restrict, =
const struct timespec *__restrict);<br class=3D"">+int =
mq_timedsend(mqd_t, const char *, size_t, unsigned, const struct =
timespec *);<br class=3D"">+int mq_unlink(const char *);<br =
class=3D"">+<br class=3D"">+#ifdef __cplusplus<br class=3D"">+}<br =
class=3D"">+#endif<br class=3D"">+#endif<br class=3D"">diff --git =
a/musl-imported/include/obstack.h b/musl-imported/include/obstack.h<br =
class=3D"">new file mode 100644<br class=3D"">index 0000000..a9cbc39<br =
class=3D"">--- /dev/null<br class=3D"">+++ =
b/musl-imported/include/obstack.h<br class=3D"">@@ -0,0 +1,538 @@<br =
class=3D"">+/* obstack.h - object stack macros<br class=3D"">+ =
&nbsp;&nbsp;Copyright (C) 1988-2020 Free Software Foundation, Inc.<br =
class=3D"">+ &nbsp;&nbsp;This file is part of the GNU C Library.<br =
class=3D"">+<br class=3D"">+ &nbsp;&nbsp;The GNU C Library is free =
software; you can redistribute it and/or<br class=3D"">+ =
&nbsp;&nbsp;modify it under the terms of the GNU Lesser General =
Public<br class=3D"">+ &nbsp;&nbsp;License as published by the Free =
Software Foundation; either<br class=3D"">+ &nbsp;&nbsp;version 2.1 of =
the License, or (at your option) any later version.<br class=3D"">+<br =
class=3D"">+ &nbsp;&nbsp;The GNU C Library is distributed in the hope =
that it will be useful,<br class=3D"">+ &nbsp;&nbsp;but WITHOUT ANY =
WARRANTY; without even the implied warranty of<br class=3D"">+ =
&nbsp;&nbsp;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. =
&nbsp;See the GNU<br class=3D"">+ &nbsp;&nbsp;Lesser General Public =
License for more details.<br class=3D"">+<br class=3D"">+ =
&nbsp;&nbsp;You should have received a copy of the GNU Lesser General =
Public<br class=3D"">+ &nbsp;&nbsp;License along with the GNU C Library; =
if not, see<br class=3D"">+ &nbsp;&nbsp;&lt;<a =
href=3D"http://www.gnu.org/licenses/" =
class=3D"">http://www.gnu.org/licenses/</a>&gt;. &nbsp;*/<br =
class=3D"">+<br class=3D"">+/* Summary:<br class=3D"">+<br class=3D"">+ =
&nbsp;&nbsp;All the apparent functions defined here are macros. The =
idea<br class=3D"">+ &nbsp;&nbsp;is that you would use these pre-tested =
macros to solve a<br class=3D"">+ &nbsp;&nbsp;very specific set of =
problems, and they would run fast.<br class=3D"">+ &nbsp;&nbsp;Caution: =
no side-effects in arguments please!! They may be<br class=3D"">+ =
&nbsp;&nbsp;evaluated MANY times!!<br class=3D"">+<br class=3D"">+ =
&nbsp;&nbsp;These macros operate a stack of objects. &nbsp;Each object =
starts life<br class=3D"">+ &nbsp;&nbsp;small, and may grow to maturity. =
&nbsp;(Consider building a word syllable<br class=3D"">+ &nbsp;&nbsp;by =
syllable.) &nbsp;An object can move while it is growing. &nbsp;Once it =
has<br class=3D"">+ &nbsp;&nbsp;been "finished" it never changes address =
again. &nbsp;So the "top of the<br class=3D"">+ &nbsp;&nbsp;stack" is =
typically an immature growing object, while the rest of the<br =
class=3D"">+ &nbsp;&nbsp;stack is of mature, fixed size and fixed =
address objects.<br class=3D"">+<br class=3D"">+ &nbsp;&nbsp;These =
routines grab large chunks of memory, using a function you<br class=3D"">+=
 &nbsp;&nbsp;supply, called 'obstack_chunk_alloc'. &nbsp;On occasion, =
they free chunks,<br class=3D"">+ &nbsp;&nbsp;by calling =
'obstack_chunk_free'. &nbsp;You must define them and declare<br =
class=3D"">+ &nbsp;&nbsp;them before using any obstack macros.<br =
class=3D"">+<br class=3D"">+ &nbsp;&nbsp;Each independent stack is =
represented by a 'struct obstack'.<br class=3D"">+ &nbsp;&nbsp;Each of =
the obstack macros expects a pointer to such a structure<br class=3D"">+ =
&nbsp;&nbsp;as the first argument.<br class=3D"">+<br class=3D"">+ =
&nbsp;&nbsp;One motivation for this package is the problem of growing =
char strings<br class=3D"">+ &nbsp;&nbsp;in symbol tables. &nbsp;Unless =
you are "fascist pig with a read-only mind"<br class=3D"">+ =
&nbsp;&nbsp;--Gosper's immortal quote from HAKMEM item 154, out of =
context--you<br class=3D"">+ &nbsp;&nbsp;would not like to put any =
arbitrary upper limit on the length of your<br class=3D"">+ =
&nbsp;&nbsp;symbols.<br class=3D"">+<br class=3D"">+ &nbsp;&nbsp;In =
practice this often means you will build many short symbols and a<br =
class=3D"">+ &nbsp;&nbsp;few long symbols. &nbsp;At the time you are =
reading a symbol you don't know<br class=3D"">+ &nbsp;&nbsp;how long it =
is. &nbsp;One traditional method is to read a symbol into a<br =
class=3D"">+ &nbsp;&nbsp;buffer, realloc()ating the buffer every time =
you try to read a symbol<br class=3D"">+ &nbsp;&nbsp;that is longer than =
the buffer. &nbsp;This is beaut, but you still will<br class=3D"">+ =
&nbsp;&nbsp;want to copy the symbol from the buffer to a more =
permanent<br class=3D"">+ &nbsp;&nbsp;symbol-table entry say about half =
the time.<br class=3D"">+<br class=3D"">+ &nbsp;&nbsp;With obstacks, you =
can work differently. &nbsp;Use one obstack for all symbol<br class=3D"">+=
 &nbsp;&nbsp;names. &nbsp;As you read a symbol, grow the name in the =
obstack gradually.<br class=3D"">+ &nbsp;&nbsp;When the name is =
complete, finalize it. &nbsp;Then, if the symbol exists already,<br =
class=3D"">+ &nbsp;&nbsp;free the newly read name.<br class=3D"">+<br =
class=3D"">+ &nbsp;&nbsp;The way we do this is to take a large chunk, =
allocating memory from<br class=3D"">+ &nbsp;&nbsp;low addresses. =
&nbsp;When you want to build a symbol in the chunk you just<br =
class=3D"">+ &nbsp;&nbsp;add chars above the current "high water mark" =
in the chunk. &nbsp;When you<br class=3D"">+ &nbsp;&nbsp;have finished =
adding chars, because you got to the end of the symbol,<br class=3D"">+ =
&nbsp;&nbsp;you know how long the chars are, and you can create a new =
object.<br class=3D"">+ &nbsp;&nbsp;Mostly the chars will not burst over =
the highest address of the chunk,<br class=3D"">+ &nbsp;&nbsp;because =
you would typically expect a chunk to be (say) 100 times as<br =
class=3D"">+ &nbsp;&nbsp;long as an average object.<br class=3D"">+<br =
class=3D"">+ &nbsp;&nbsp;In case that isn't clear, when we have enough =
chars to make up<br class=3D"">+ &nbsp;&nbsp;the object, THEY ARE =
ALREADY CONTIGUOUS IN THE CHUNK (guaranteed)<br class=3D"">+ =
&nbsp;&nbsp;so we just point to it where it lies. &nbsp;No moving of =
chars is<br class=3D"">+ &nbsp;&nbsp;needed and this is the second win: =
potentially long strings need<br class=3D"">+ &nbsp;&nbsp;never be =
explicitly shuffled. Once an object is formed, it does not<br class=3D"">+=
 &nbsp;&nbsp;change its address during its lifetime.<br class=3D"">+<br =
class=3D"">+ &nbsp;&nbsp;When the chars burst over a chunk boundary, we =
allocate a larger<br class=3D"">+ &nbsp;&nbsp;chunk, and then copy the =
partly formed object from the end of the old<br class=3D"">+ =
&nbsp;&nbsp;chunk to the beginning of the new larger chunk. &nbsp;We =
then carry on<br class=3D"">+ &nbsp;&nbsp;accreting characters to the =
end of the object as we normally would.<br class=3D"">+<br class=3D"">+ =
&nbsp;&nbsp;A special macro is provided to add a single char at a time =
to a<br class=3D"">+ &nbsp;&nbsp;growing object. &nbsp;This allows the =
use of register variables, which<br class=3D"">+ &nbsp;&nbsp;break the =
ordinary 'growth' macro.<br class=3D"">+<br class=3D"">+ =
&nbsp;&nbsp;Summary:<br class=3D"">+ =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;We allocate large chunks.<br =
class=3D"">+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;We carve out one =
object at a time from the current chunk.<br class=3D"">+ =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Once carved, an object never =
moves.<br class=3D"">+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;We are =
free to append data of any size to the currently<br class=3D"">+ =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;growing object.<br =
class=3D"">+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Exactly one =
object is growing in an obstack at any one time.<br class=3D"">+ =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;You can run one obstack per =
control block.<br class=3D"">+ =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;You may have as many control =
blocks as you dare.<br class=3D"">+ =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Because of the way we do it, =
you can "unwind" an obstack<br class=3D"">+ =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;back to a previous =
state. (You may remove objects much<br class=3D"">+ =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;as you would with =
a stack.)<br class=3D"">+ */<br class=3D"">+<br class=3D"">+<br =
class=3D"">+/* Don't do the contents of this file more than once. =
&nbsp;*/<br class=3D"">+<br class=3D"">+#ifndef _OBSTACK_H<br =
class=3D"">+#define _OBSTACK_H 1<br class=3D"">+<br class=3D"">+#ifndef =
_OBSTACK_INTERFACE_VERSION<br class=3D"">+# define =
_OBSTACK_INTERFACE_VERSION 2<br class=3D"">+#endif<br class=3D"">+<br =
class=3D"">+#include &lt;stddef.h&gt; =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/*=
 For size_t and ptrdiff_t. &nbsp;*/<br class=3D"">+#include =
&lt;string.h&gt; =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/*=
 For __GNU_LIBRARY__, and memcpy. &nbsp;*/<br class=3D"">+<br =
class=3D"">+#if _OBSTACK_INTERFACE_VERSION =3D=3D 1<br class=3D"">+/* =
For binary compatibility with obstack version 1, which used "int"<br =
class=3D"">+ &nbsp;&nbsp;and "long" for these two types. &nbsp;*/<br =
class=3D"">+# define _OBSTACK_SIZE_T unsigned int<br class=3D"">+# =
define _CHUNK_SIZE_T unsigned long<br class=3D"">+# define =
_OBSTACK_CAST(type, expr) ((type) (expr))<br class=3D"">+#else<br =
class=3D"">+/* Version 2 with sane types, especially for 64-bit hosts. =
&nbsp;*/<br class=3D"">+# define _OBSTACK_SIZE_T size_t<br class=3D"">+# =
define _CHUNK_SIZE_T size_t<br class=3D"">+# define _OBSTACK_CAST(type, =
expr) (expr)<br class=3D"">+#endif<br class=3D"">+<br class=3D"">+/* If =
B is the base of an object addressed by P, return the result of<br =
class=3D"">+ &nbsp;&nbsp;aligning P to the next multiple of A + 1. =
&nbsp;B and P must be of type<br class=3D"">+ &nbsp;&nbsp;char *. =
&nbsp;A + 1 must be a power of 2. &nbsp;*/<br class=3D"">+<br =
class=3D"">+#define __BPTR_ALIGN(B, P, A) ((B) + (((P) - (B) + (A)) =
&amp; ~(A)))<br class=3D"">+<br class=3D"">+/* Similar to __BPTR_ALIGN =
(B, P, A), except optimize the common case<br class=3D"">+ =
&nbsp;&nbsp;where pointers can be converted to integers, aligned as =
integers,<br class=3D"">+ &nbsp;&nbsp;and converted back again. &nbsp;If =
ptrdiff_t is narrower than a<br class=3D"">+ &nbsp;&nbsp;pointer (e.g., =
the AS/400), play it safe and compute the alignment<br class=3D"">+ =
&nbsp;&nbsp;relative to B. &nbsp;Otherwise, use the faster strategy of =
computing the<br class=3D"">+ &nbsp;&nbsp;alignment relative to 0. =
&nbsp;*/<br class=3D"">+<br class=3D"">+#define __PTR_ALIGN(B, P, =
A)<span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span><span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span><span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span><span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span><span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span><span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\<br class=3D"">+ =
&nbsp;__BPTR_ALIGN (sizeof (ptrdiff_t) &lt; sizeof (void *) ? (B) : =
(char *) 0, &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\<br class=3D"">+ =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;P, A)<br class=3D"">+<br class=3D"">+#ifndef =
__attribute_pure__<br class=3D"">+# if defined __GNUC_MINOR__ &amp;&amp; =
__GNUC__ * 1000 + __GNUC_MINOR__ &gt;=3D 2096<br class=3D"">+# =
&nbsp;define __attribute_pure__ __attribute__ ((__pure__))<br =
class=3D"">+# else<br class=3D"">+# &nbsp;define __attribute_pure__<br =
class=3D"">+# endif<br class=3D"">+#endif<br class=3D"">+<br =
class=3D"">+#ifdef __cplusplus<br class=3D"">+extern "C" {<br =
class=3D"">+#endif<br class=3D"">+<br class=3D"">+struct _obstack_chunk =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/* Lives at =
front of each chunk. */<br class=3D"">+{<br class=3D"">+ &nbsp;char =
*limit; =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;&nbsp;&nbsp;/* 1 past end of this chunk */<br class=3D"">+=
 &nbsp;struct _obstack_chunk *prev; &nbsp;/* address of prior chunk or =
NULL */<br class=3D"">+ &nbsp;char contents[4]; =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/*=
 objects begin here */<br class=3D"">+};<br class=3D"">+<br =
class=3D"">+struct obstack =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/* control current =
object in current chunk */<br class=3D"">+{<br class=3D"">+ =
&nbsp;_CHUNK_SIZE_T chunk_size; &nbsp;&nbsp;&nbsp;&nbsp;/* preferred =
size to allocate chunks in */<br class=3D"">+ &nbsp;struct =
_obstack_chunk *chunk; /* address of current struct obstack_chunk */<br =
class=3D"">+ &nbsp;char *object_base; =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/* =
address of object we are building */<br class=3D"">+ &nbsp;char =
*next_free; =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;/* where to add next char to current object */<br class=3D"">+ =
&nbsp;char *chunk_limit; =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/* =
address of char after current chunk */<br class=3D"">+ &nbsp;union<br =
class=3D"">+ &nbsp;{<br class=3D"">+ &nbsp;&nbsp;&nbsp;_OBSTACK_SIZE_T =
i;<br class=3D"">+ &nbsp;&nbsp;&nbsp;void *p;<br class=3D"">+ &nbsp;} =
temp; =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/* Temporary =
for some macros. &nbsp;*/<br class=3D"">+ &nbsp;_OBSTACK_SIZE_T =
alignment_mask; &nbsp;/* Mask of alignment for each object. */<br =
class=3D"">+<br class=3D"">+ &nbsp;/* These prototypes vary based on =
'use_extra_arg'. &nbsp;*/<br class=3D"">+ &nbsp;union<br class=3D"">+ =
&nbsp;{<br class=3D"">+ &nbsp;&nbsp;&nbsp;void *(*plain) (size_t);<br =
class=3D"">+ &nbsp;&nbsp;&nbsp;void *(*extra) (void *, size_t);<br =
class=3D"">+ &nbsp;} chunkfun;<br class=3D"">+ &nbsp;union<br class=3D"">+=
 &nbsp;{<br class=3D"">+ &nbsp;&nbsp;&nbsp;void (*plain) (void *);<br =
class=3D"">+ &nbsp;&nbsp;&nbsp;void (*extra) (void *, void *);<br =
class=3D"">+ &nbsp;} freefun;<br class=3D"">+<br class=3D"">+ &nbsp;void =
*extra_arg; =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;/* first arg for chunk alloc/dealloc funcs */<br class=3D"">+ =
&nbsp;unsigned use_extra_arg : 1; &nbsp;&nbsp;&nbsp;&nbsp;/* chunk =
alloc/dealloc funcs take extra arg */<br class=3D"">+ &nbsp;unsigned =
maybe_empty_object : 1; /* There is a possibility that the current<br =
class=3D"">+ =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
chunk contains a zero-length object. &nbsp;This<br class=3D"">+ =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
prevents freeing the chunk if we allocate<br class=3D"">+ =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
a bigger chunk to replace it. */<br class=3D"">+ &nbsp;unsigned =
alloc_failed : 1; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/* No longer used, as we =
now call the failed<br class=3D"">+ =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;handle=
r on error, but retained for binary<br class=3D"">+ =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;compat=
ibility. &nbsp;*/<br class=3D"">+};<br class=3D"">+<br class=3D"">+/* =
Declare the external functions we use; they are in obstack.c. =
&nbsp;*/<br class=3D"">+<br class=3D"">+extern void _obstack_newchunk =
(struct obstack *, _OBSTACK_SIZE_T);<br class=3D"">+extern void =
_obstack_free (struct obstack *, void *);<br class=3D"">+extern int =
_obstack_begin (struct obstack *,<br class=3D"">+ =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;_OBSTACK_SIZE_T, _OBSTACK_SIZE_T,<br class=3D"">+ =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;void *(*) (size_t), void (*) (void *));<br class=3D"">+extern =
int _obstack_begin_1 (struct obstack *,<br class=3D"">+ =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp;_OBSTACK_SIZE_T, _OBSTACK_SIZE_T,<br class=3D"">+ =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp;void *(*) (void *, size_t),<br class=3D"">+ =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp;void (*) (void *, void *), void *);<br =
class=3D"">+extern _OBSTACK_SIZE_T _obstack_memory_used (struct obstack =
*)<br class=3D"">+ &nbsp;__attribute_pure__;<br class=3D"">+<br =
class=3D"">+/* Declare obstack_printf; it's in obstack_printf.c. */<br =
class=3D"">+extern int obstack_printf(struct obstack *obstack, const =
char *__restrict fmt, ...);<br class=3D"">+<br class=3D"">+<br =
class=3D"">+/* Error handler called when 'obstack_chunk_alloc' failed to =
allocate<br class=3D"">+ &nbsp;&nbsp;more memory. &nbsp;This can be set =
to a user defined function which<br class=3D"">+ &nbsp;&nbsp;should =
either abort gracefully or use longjump - but shouldn't<br class=3D"">+ =
&nbsp;&nbsp;return. &nbsp;The default action is to print a message and =
abort. &nbsp;*/<br class=3D"">+extern void =
(*obstack_alloc_failed_handler) (void);<br class=3D"">+<br class=3D"">+/* =
Exit value used when 'print_and_abort' is used. &nbsp;*/<br =
class=3D"">+extern int obstack_exit_failure;<br class=3D"">+<br =
class=3D"">+/* Pointer to beginning of object being allocated or to be =
allocated next.<br class=3D"">+ &nbsp;&nbsp;Note that this might not be =
the final address of the object<br class=3D"">+ &nbsp;&nbsp;because a =
new chunk might be needed to hold the final size. &nbsp;*/<br =
class=3D"">+<br class=3D"">+#define obstack_base(h) ((void *) =
(h)-&gt;object_base)<br class=3D"">+<br class=3D"">+/* Size for =
allocating ordinary chunks. &nbsp;*/<br class=3D"">+<br =
class=3D"">+#define obstack_chunk_size(h) ((h)-&gt;chunk_size)<br =
class=3D"">+<br class=3D"">+/* Pointer to next byte not yet allocated in =
current chunk. &nbsp;*/<br class=3D"">+<br class=3D"">+#define =
obstack_next_free(h) ((void *) (h)-&gt;next_free)<br class=3D"">+<br =
class=3D"">+/* Mask specifying low bits that should be clear in address =
of an object. &nbsp;*/<br class=3D"">+<br class=3D"">+#define =
obstack_alignment_mask(h) ((h)-&gt;alignment_mask)<br class=3D"">+<br =
class=3D"">+/* To prevent prototype warnings provide complete argument =
list. &nbsp;*/<br class=3D"">+#define obstack_init(h)<span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span> =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\<br class=3D"">+ &nbsp;_obstack_begin =
((h), 0, 0,<span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span><span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span><span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span><span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span><span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span><span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\<br class=3D"">+ =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;&nbsp;&nbsp;_OBSTACK_CAST (void *(*) (size_t), =
obstack_chunk_alloc), &nbsp;&nbsp;&nbsp;\<br class=3D"">+ =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;&nbsp;&nbsp;_OBSTACK_CAST (void (*) (void *), =
obstack_chunk_free))<br class=3D"">+<br class=3D"">+#define =
obstack_begin(h, size)<span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span> =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\<br class=3D"">+ &nbsp;_obstack_begin =
((h), (size), 0,<span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span><span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span><span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span><span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span><span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\<br class=3D"">+ =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;&nbsp;&nbsp;_OBSTACK_CAST (void *(*) (size_t), =
obstack_chunk_alloc), \<br class=3D"">+ =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;&nbsp;&nbsp;_OBSTACK_CAST (void (*) (void *), =
obstack_chunk_free))<br class=3D"">+<br class=3D"">+#define =
obstack_specify_allocation(h, size, alignment, chunkfun, freefun) =
&nbsp;&nbsp;&nbsp;&nbsp;\<br class=3D"">+ &nbsp;_obstack_begin ((h), =
(size), (alignment),<span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span> =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\<br class=3D"">+ =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;&nbsp;&nbsp;_OBSTACK_CAST (void *(*) (size_t), =
chunkfun),<span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span><span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\<br class=3D"">+ =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;&nbsp;&nbsp;_OBSTACK_CAST (void (*) (void *), =
freefun))<br class=3D"">+<br class=3D"">+#define =
obstack_specify_allocation_with_arg(h, size, alignment, chunkfun, =
freefun, arg) \<br class=3D"">+ &nbsp;_obstack_begin_1 ((h), (size), =
(alignment),<span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span><span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span><span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span><span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\<br class=3D"">+ =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;_OBSTACK_CAST (void *(*) (void =
*, size_t), chunkfun), &nbsp;&nbsp;&nbsp;&nbsp;\<br class=3D"">+ =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;_OBSTACK_CAST (void (*) (void *, =
void *), freefun), arg)<br class=3D"">+<br class=3D"">+#define =
obstack_chunkfun(h, newchunkfun)<span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span> =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\<br class=3D"">+ &nbsp;((void) =
((h)-&gt;chunkfun.extra =3D (void *(*) (void *, size_t)) =
(newchunkfun)))<br class=3D"">+<br class=3D"">+#define =
obstack_freefun(h, newfreefun)<span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span> =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\<br class=3D"">+ &nbsp;((void) =
((h)-&gt;freefun.extra =3D (void *(*) (void *, void *)) =
(newfreefun)))<br class=3D"">+<br class=3D"">+#define =
obstack_1grow_fast(h, achar) ((void) (*((h)-&gt;next_free)++ =3D =
(achar)))<br class=3D"">+<br class=3D"">+#define obstack_blank_fast(h, =
n) ((void) ((h)-&gt;next_free +=3D (n)))<br class=3D"">+<br =
class=3D"">+#define obstack_memory_used(h) _obstack_memory_used (h)<br =
class=3D"">+<br class=3D"">+#if defined __GNUC__<br class=3D"">+# if =
!defined __GNUC_MINOR__ || __GNUC__ * 1000 + __GNUC_MINOR__ &lt; 2008<br =
class=3D"">+# &nbsp;define __extension__<br class=3D"">+# endif<br =
class=3D"">+<br class=3D"">+/* For GNU C, if not -traditional,<br =
class=3D"">+ &nbsp;&nbsp;we can define these macros to compute all args =
only once<br class=3D"">+ &nbsp;&nbsp;without using a global =
variable.<br class=3D"">+ &nbsp;&nbsp;Also, we can avoid using the =
'temp' slot, to make faster code. &nbsp;*/<br class=3D"">+<br =
class=3D"">+# define obstack_object_size(OBSTACK)<span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span> =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\<br class=3D"">+ &nbsp;__extension__<span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span> =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\<br class=3D"">+ &nbsp;&nbsp;&nbsp;({ =
struct obstack const *__o =3D (OBSTACK);<span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span> =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\<br class=3D"">+ =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(_OBSTACK_SIZE_T) (__o-&gt;next_free =
- __o-&gt;object_base); })<br class=3D"">+<br class=3D"">+/* The local =
variable is named __o1 to avoid a shadowed variable<br class=3D"">+ =
&nbsp;&nbsp;warning when invoked from other obstack macros. &nbsp;*/<br =
class=3D"">+# define obstack_room(OBSTACK)<span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span> =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\<br class=3D"">+ &nbsp;__extension__<span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span> =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\<br class=3D"">+ &nbsp;&nbsp;&nbsp;({ =
struct obstack const *__o1 =3D (OBSTACK);<span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span> =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\<br class=3D"">+ =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(_OBSTACK_SIZE_T) =
(__o1-&gt;chunk_limit - __o1-&gt;next_free); })<br class=3D"">+<br =
class=3D"">+# define obstack_make_room(OBSTACK, length)<span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span> =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\<br class=3D"">+ &nbsp;__extension__<span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span> =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\<br class=3D"">+ &nbsp;&nbsp;&nbsp;({ =
struct obstack *__o =3D (OBSTACK);<span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span> =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\<br class=3D"">+ =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;_OBSTACK_SIZE_T __len =3D =
(length);<span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span><span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span><span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span><span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\<br class=3D"">+ =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if (obstack_room (__o) &lt; =
__len)<span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span><span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span><span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span><span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span><span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\<br class=3D"">+ =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;_obstack_newchunk (__o, =
__len);<span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span><span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span><span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span><span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\<br class=3D"">+ =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(void) 0; })<br class=3D"">+<br =
class=3D"">+# define obstack_empty_p(OBSTACK)<span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span> =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\<br class=3D"">+ &nbsp;__extension__<span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span> =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\<br class=3D"">+ &nbsp;&nbsp;&nbsp;({ =
struct obstack const *__o =3D (OBSTACK);<span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span> =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\<br class=3D"">+ =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(__o-&gt;chunk-&gt;prev =3D=3D =
0<span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span><span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span><span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span><span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span><span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span><span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\<br class=3D"">+ =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&amp;&amp; __o-&gt;next_free =
=3D=3D __PTR_ALIGN ((char *) __o-&gt;chunk,<span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span> =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\<br class=3D"">+ =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
&nbsp;&nbsp;&nbsp;&nbsp;__o-&gt;chunk-&gt;contents,<span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span> =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\<br class=3D"">+ =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
&nbsp;&nbsp;&nbsp;&nbsp;__o-&gt;alignment_mask)); })<br class=3D"">+<br =
class=3D"">+# define obstack_grow(OBSTACK, where, length)<span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span> =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\<br class=3D"">+ &nbsp;__extension__<span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span> =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\<br class=3D"">+ &nbsp;&nbsp;&nbsp;({ =
struct obstack *__o =3D (OBSTACK);<span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span> =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\<br class=3D"">+ =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;_OBSTACK_SIZE_T __len =3D =
(length);<span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span><span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span><span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span><span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\<br class=3D"">+ =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if (obstack_room (__o) &lt; =
__len)<span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span><span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span><span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span><span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span><span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\<br class=3D"">+ =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;_obstack_newchunk (__o, =
__len);<span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span><span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span><span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span><span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\<br class=3D"">+ =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;memcpy (__o-&gt;next_free, where, =
__len);<span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span><span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span><span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span><span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\<br class=3D"">+ =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;__o-&gt;next_free +=3D __len;<span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span> =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\<br class=3D"">+ =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(void) 0; })<br class=3D"">+<br =
class=3D"">+# define obstack_grow0(OBSTACK, where, length)<span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span> =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\<br class=3D"">+ &nbsp;__extension__<span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span> =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\<br class=3D"">+ &nbsp;&nbsp;&nbsp;({ =
struct obstack *__o =3D (OBSTACK);<span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span> =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\<br class=3D"">+ =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;_OBSTACK_SIZE_T __len =3D =
(length);<span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span><span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span><span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span><span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\<br class=3D"">+ =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if (obstack_room (__o) &lt; __len + =
1)<span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span><span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span><span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span><span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\<br class=3D"">+ =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;_obstack_newchunk (__o, =
__len + 1);<span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span><span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span><span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span><span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\<br class=3D"">+ =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;memcpy (__o-&gt;next_free, where, =
__len);<span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span><span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span><span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span><span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\<br class=3D"">+ =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;__o-&gt;next_free +=3D __len;<span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span> =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\<br class=3D"">+ =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*(__o-&gt;next_free)++ =3D 0;<span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span> =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\<br class=3D"">+ =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(void) 0; })<br class=3D"">+<br =
class=3D"">+# define obstack_1grow(OBSTACK, datum)<span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span> =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\<br class=3D"">+ &nbsp;__extension__<span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span> =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\<br class=3D"">+ &nbsp;&nbsp;&nbsp;({ =
struct obstack *__o =3D (OBSTACK);<span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span> =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\<br class=3D"">+ =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if (obstack_room (__o) &lt; 1)<span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span> =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\<br class=3D"">+ =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;_obstack_newchunk (__o, =
1);<span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span><span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span><span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span><span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span><span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\<br class=3D"">+ =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;obstack_1grow_fast (__o, datum); =
})<br class=3D"">+<br class=3D"">+/* These assume that the obstack =
alignment is good enough for pointers<br class=3D"">+ &nbsp;&nbsp;or =
ints, and that the data added so far to the current object<br class=3D"">+=
 &nbsp;&nbsp;shares that much alignment. &nbsp;*/<br class=3D"">+<br =
class=3D"">+# define obstack_ptr_grow(OBSTACK, datum)<span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span> =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\<br class=3D"">+ &nbsp;__extension__<span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span> =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\<br class=3D"">+ &nbsp;&nbsp;&nbsp;({ =
struct obstack *__o =3D (OBSTACK);<span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span> =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\<br class=3D"">+ =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if (obstack_room (__o) &lt; sizeof =
(void *))<span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span><span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span><span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\<br class=3D"">+ =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;_obstack_newchunk (__o, =
sizeof (void *));<span class=3D"Apple-tab-span" style=3D"white-space:pre">=
	</span><span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span><span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\<br class=3D"">+ =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;obstack_ptr_grow_fast (__o, datum); =
})<br class=3D"">+<br class=3D"">+# define obstack_int_grow(OBSTACK, =
datum)<span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span><span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span><span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span><span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\<br class=3D"">+ =
&nbsp;__extension__<span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span> =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\<br class=3D"">+ &nbsp;&nbsp;&nbsp;({ =
struct obstack *__o =3D (OBSTACK);<span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span> =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\<br class=3D"">+ =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if (obstack_room (__o) &lt; sizeof =
(int))<span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span><span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span><span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span><span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\<br class=3D"">+ =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;_obstack_newchunk (__o, =
sizeof (int));<span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span><span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span><span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span><span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\<br class=3D"">+ =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;obstack_int_grow_fast (__o, datum); =
})<br class=3D"">+<br class=3D"">+# define =
obstack_ptr_grow_fast(OBSTACK, aptr)<span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span> =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\<br class=3D"">+ &nbsp;__extension__<span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span> =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\<br class=3D"">+ &nbsp;&nbsp;&nbsp;({ =
struct obstack *__o1 =3D (OBSTACK);<span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span> =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\<br class=3D"">+ =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;void *__p1 =3D =
__o1-&gt;next_free;<span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span> =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\<br class=3D"">+ =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*(const void **) __p1 =3D =
(aptr);<span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span><span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span><span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span><span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span><span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\<br class=3D"">+ =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;__o1-&gt;next_free +=3D sizeof =
(const void *);<span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span><span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span><span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\<br class=3D"">+ =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(void) 0; })<br class=3D"">+<br =
class=3D"">+# define obstack_int_grow_fast(OBSTACK, aint)<span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span> =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\<br class=3D"">+ &nbsp;__extension__<span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span> =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\<br class=3D"">+ &nbsp;&nbsp;&nbsp;({ =
struct obstack *__o1 =3D (OBSTACK);<span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span> =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\<br class=3D"">+ =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;void *__p1 =3D =
__o1-&gt;next_free;<span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span> =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\<br class=3D"">+ =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*(int *) __p1 =3D (aint);<span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span> =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\<br class=3D"">+ =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;__o1-&gt;next_free +=3D sizeof =
(int);<span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span><span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span><span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span><span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span><span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\<br class=3D"">+ =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(void) 0; })<br class=3D"">+<br =
class=3D"">+# define obstack_blank(OBSTACK, length)<span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span> =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\<br class=3D"">+ &nbsp;__extension__<span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span> =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\<br class=3D"">+ &nbsp;&nbsp;&nbsp;({ =
struct obstack *__o =3D (OBSTACK);<span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span> =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\<br class=3D"">+ =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;_OBSTACK_SIZE_T __len =3D =
(length);<span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span><span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span><span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span><span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\<br class=3D"">+ =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if (obstack_room (__o) &lt; =
__len)<span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span><span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span><span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span><span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span><span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\<br class=3D"">+ =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;_obstack_newchunk (__o, =
__len);<span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span><span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span><span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span><span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\<br class=3D"">+ =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;obstack_blank_fast (__o, __len); =
})<br class=3D"">+<br class=3D"">+# define obstack_alloc(OBSTACK, =
length)<span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span><span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span><span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span><span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span><span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\<br class=3D"">+ =
&nbsp;__extension__<span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span> =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\<br class=3D"">+ &nbsp;&nbsp;&nbsp;({ =
struct obstack *__h =3D (OBSTACK);<span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span> =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\<br class=3D"">+ =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;obstack_blank (__h, (length));<span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span> =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\<br class=3D"">+ =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;obstack_finish (__h); })<br =
class=3D"">+<br class=3D"">+# define obstack_copy(OBSTACK, where, =
length)<span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span><span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span><span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span><span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\<br class=3D"">+ =
&nbsp;__extension__<span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span> =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\<br class=3D"">+ &nbsp;&nbsp;&nbsp;({ =
struct obstack *__h =3D (OBSTACK);<span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span> =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\<br class=3D"">+ =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;obstack_grow (__h, (where), =
(length));<span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span><span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span><span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span><span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\<br class=3D"">+ =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;obstack_finish (__h); })<br =
class=3D"">+<br class=3D"">+# define obstack_copy0(OBSTACK, where, =
length)<span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span><span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span><span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span><span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\<br class=3D"">+ =
&nbsp;__extension__<span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span> =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\<br class=3D"">+ &nbsp;&nbsp;&nbsp;({ =
struct obstack *__h =3D (OBSTACK);<span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span> =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\<br class=3D"">+ =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;obstack_grow0 (__h, (where), =
(length));<span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span><span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span><span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span><span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\<br class=3D"">+ =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;obstack_finish (__h); })<br =
class=3D"">+<br class=3D"">+/* The local variable is named __o1 to avoid =
a shadowed variable<br class=3D"">+ &nbsp;&nbsp;warning when invoked =
from other obstack macros, typically obstack_free. &nbsp;*/<br =
class=3D"">+# define obstack_finish(OBSTACK)<span class=3D"Apple-tab-span"=
 style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span> =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\<br class=3D"">+ &nbsp;__extension__<span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span> =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\<br class=3D"">+ &nbsp;&nbsp;&nbsp;({ =
struct obstack *__o1 =3D (OBSTACK);<span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span> =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\<br class=3D"">+ =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;void *__value =3D (void *) =
__o1-&gt;object_base;<span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span> =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\<br class=3D"">+ =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if (__o1-&gt;next_free =3D=3D =
__value)<span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span><span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span><span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span><span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span><span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\<br class=3D"">+ =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;__o1-&gt;maybe_empty_objec=
t =3D 1;<span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span><span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span><span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span><span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span><span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\<br class=3D"">+ =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;__o1-&gt;next_free<span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span> =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\<br class=3D"">+ =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=3D __PTR_ALIGN =
(__o1-&gt;object_base, __o1-&gt;next_free,<span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span> =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\<br class=3D"">+ =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;__o1-&gt;a=
lignment_mask);<span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span><span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span><span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span><span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\<br class=3D"">+ =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if ((size_t) (__o1-&gt;next_free - =
(char *) __o1-&gt;chunk)<span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span> =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\<br class=3D"">+ =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&gt; =
(size_t) (__o1-&gt;chunk_limit - (char *) __o1-&gt;chunk))<span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span> =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\<br class=3D"">+ =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;__o1-&gt;next_free =3D =
__o1-&gt;chunk_limit;<span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span> =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\<br class=3D"">+ =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;__o1-&gt;object_base =3D =
__o1-&gt;next_free;<span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span> =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\<br class=3D"">+ =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;__value; })<br class=3D"">+<br =
class=3D"">+# define obstack_free(OBSTACK, OBJ)<span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span> =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\<br class=3D"">+ &nbsp;__extension__<span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span> =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\<br class=3D"">+ &nbsp;&nbsp;&nbsp;({ =
struct obstack *__o =3D (OBSTACK);<span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span> =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\<br class=3D"">+ =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;void *__obj =3D (void *) (OBJ);<span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span> =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\<br class=3D"">+ =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if (__obj &gt; (void *) =
__o-&gt;chunk &amp;&amp; __obj &lt; (void *) __o-&gt;chunk_limit) =
&nbsp;\<br class=3D"">+ =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;__o-&gt;next_free =3D =
__o-&gt;object_base =3D (char *) __obj;<span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span> =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\<br class=3D"">+ =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;else<span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span> =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\<br class=3D"">+ =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;_obstack_free (__o, =
__obj); })<br class=3D"">+<br class=3D"">+#else /* not __GNUC__ */<br =
class=3D"">+<br class=3D"">+# define obstack_object_size(h)<span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span> =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\<br class=3D"">+ &nbsp;((_OBSTACK_SIZE_T) =
((h)-&gt;next_free - (h)-&gt;object_base))<br class=3D"">+<br =
class=3D"">+# define obstack_room(h)<span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span> =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\<br class=3D"">+ &nbsp;((_OBSTACK_SIZE_T) =
((h)-&gt;chunk_limit - (h)-&gt;next_free))<br class=3D"">+<br =
class=3D"">+# define obstack_empty_p(h)<span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span> =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\<br class=3D"">+ =
&nbsp;((h)-&gt;chunk-&gt;prev =3D=3D 0<span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span> =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\<br class=3D"">+ &nbsp;&nbsp;&amp;&amp; =
(h)-&gt;next_free =3D=3D __PTR_ALIGN ((char *) (h)-&gt;chunk,<span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span> =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\<br class=3D"">+ =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(h)-&g=
t;chunk-&gt;contents,<span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span> =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\<br class=3D"">+ =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(h)-&g=
t;alignment_mask))<br class=3D"">+<br class=3D"">+/* Note that the call =
to _obstack_newchunk is enclosed in (..., 0)<br class=3D"">+ =
&nbsp;&nbsp;so that we can avoid having void expressions<br class=3D"">+ =
&nbsp;&nbsp;in the arms of the conditional expression.<br class=3D"">+ =
&nbsp;&nbsp;Casting the third operand to void was tried before,<br =
class=3D"">+ &nbsp;&nbsp;but some compilers won't accept it. &nbsp;*/<br =
class=3D"">+<br class=3D"">+# define obstack_make_room(h, length)<span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span> =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\<br class=3D"">+ &nbsp;((h)-&gt;temp.i =3D =
(length),<span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span><span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span><span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span><span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span><span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span><span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\<br class=3D"">+ =
&nbsp;&nbsp;((obstack_room (h) &lt; (h)-&gt;temp.i)<span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span> =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\<br class=3D"">+ &nbsp;&nbsp;&nbsp;? =
(_obstack_newchunk (h, (h)-&gt;temp.i), 0) : 0),<span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span> =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\<br class=3D"">+ &nbsp;&nbsp;(void) 0)<br =
class=3D"">+<br class=3D"">+# define obstack_grow(h, where, length)<span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span> =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\<br class=3D"">+ &nbsp;((h)-&gt;temp.i =3D =
(length),<span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span><span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span><span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span><span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span><span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span><span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\<br class=3D"">+ =
&nbsp;&nbsp;((obstack_room (h) &lt; (h)-&gt;temp.i)<span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span> =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\<br class=3D"">+ &nbsp;&nbsp;? =
(_obstack_newchunk ((h), (h)-&gt;temp.i), 0) : 0),<span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span> =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\<br class=3D"">+ &nbsp;&nbsp;memcpy =
((h)-&gt;next_free, where, (h)-&gt;temp.i),<span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span> =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\<br class=3D"">+ =
&nbsp;&nbsp;(h)-&gt;next_free +=3D (h)-&gt;temp.i,<span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span> =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\<br class=3D"">+ &nbsp;&nbsp;(void) 0)<br =
class=3D"">+<br class=3D"">+# define obstack_grow0(h, where, =
length)<span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span><span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span><span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span><span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\<br class=3D"">+ =
&nbsp;((h)-&gt;temp.i =3D (length),<span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span> =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\<br class=3D"">+ =
&nbsp;&nbsp;((obstack_room (h) &lt; (h)-&gt;temp.i + 1)<span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span> =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\<br class=3D"">+ &nbsp;&nbsp;? =
(_obstack_newchunk ((h), (h)-&gt;temp.i + 1), 0) : 0),<span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span> =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\<br class=3D"">+ &nbsp;&nbsp;memcpy =
((h)-&gt;next_free, where, (h)-&gt;temp.i),<span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span> =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\<br class=3D"">+ =
&nbsp;&nbsp;(h)-&gt;next_free +=3D (h)-&gt;temp.i,<span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span> =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\<br class=3D"">+ =
&nbsp;&nbsp;*((h)-&gt;next_free)++ =3D 0,<span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span> =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\<br class=3D"">+ &nbsp;&nbsp;(void) 0)<br =
class=3D"">+<br class=3D"">+# define obstack_1grow(h, datum)<span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span> =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\<br class=3D"">+ &nbsp;(((obstack_room =
(h) &lt; 1)<span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span><span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span><span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span><span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span><span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span><span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\<br class=3D"">+ =
&nbsp;&nbsp;&nbsp;? (_obstack_newchunk ((h), 1), 0) : 0),<span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span> =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\<br class=3D"">+ =
&nbsp;&nbsp;obstack_1grow_fast (h, datum))<br class=3D"">+<br =
class=3D"">+# define obstack_ptr_grow(h, datum)<span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span> =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\<br class=3D"">+ &nbsp;(((obstack_room =
(h) &lt; sizeof (char *))<span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span> =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\<br class=3D"">+ &nbsp;&nbsp;&nbsp;? =
(_obstack_newchunk ((h), sizeof (char *)), 0) : 0),<span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span> =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\<br class=3D"">+ =
&nbsp;&nbsp;obstack_ptr_grow_fast (h, datum))<br class=3D"">+<br =
class=3D"">+# define obstack_int_grow(h, datum)<span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span> =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\<br class=3D"">+ &nbsp;(((obstack_room =
(h) &lt; sizeof (int))<span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span> =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\<br class=3D"">+ &nbsp;&nbsp;&nbsp;? =
(_obstack_newchunk ((h), sizeof (int)), 0) : 0),<span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span> =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\<br class=3D"">+ =
&nbsp;&nbsp;obstack_int_grow_fast (h, datum))<br class=3D"">+<br =
class=3D"">+# define obstack_ptr_grow_fast(h, aptr)<span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span> =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\<br class=3D"">+ &nbsp;(((const void **) =
((h)-&gt;next_free +=3D sizeof (void *)))[-1] =3D (aptr),<span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span> =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\<br class=3D"">+ &nbsp;&nbsp;(void) 0)<br =
class=3D"">+<br class=3D"">+# define obstack_int_grow_fast(h, aint)<span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span> =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\<br class=3D"">+ &nbsp;(((int *) =
((h)-&gt;next_free +=3D sizeof (int)))[-1] =3D (aint),<span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span> =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\<br class=3D"">+ &nbsp;&nbsp;(void) 0)<br =
class=3D"">+<br class=3D"">+# define obstack_blank(h, length)<span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span> =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\<br class=3D"">+ &nbsp;((h)-&gt;temp.i =3D =
(length),<span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span><span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span><span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span><span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span><span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span><span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\<br class=3D"">+ =
&nbsp;&nbsp;((obstack_room (h) &lt; (h)-&gt;temp.i)<span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span> =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\<br class=3D"">+ &nbsp;&nbsp;? =
(_obstack_newchunk ((h), (h)-&gt;temp.i), 0) : 0),<span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span> =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\<br class=3D"">+ =
&nbsp;&nbsp;obstack_blank_fast (h, (h)-&gt;temp.i))<br class=3D"">+<br =
class=3D"">+# define obstack_alloc(h, length)<span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span> =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\<br class=3D"">+ &nbsp;(obstack_blank =
((h), (length)), obstack_finish ((h)))<br class=3D"">+<br class=3D"">+# =
define obstack_copy(h, where, length)<span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span> =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\<br class=3D"">+ &nbsp;(obstack_grow =
((h), (where), (length)), obstack_finish ((h)))<br class=3D"">+<br =
class=3D"">+# define obstack_copy0(h, where, length)<span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span> =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\<br class=3D"">+ &nbsp;(obstack_grow0 =
((h), (where), (length)), obstack_finish ((h)))<br class=3D"">+<br =
class=3D"">+# define obstack_finish(h)<span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span> =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\<br class=3D"">+ =
&nbsp;(((h)-&gt;next_free =3D=3D (h)-&gt;object_base<span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span> =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\<br class=3D"">+ &nbsp;&nbsp;&nbsp;? =
(((h)-&gt;maybe_empty_object =3D 1), 0)<span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span> =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\<br class=3D"">+ &nbsp;&nbsp;&nbsp;: =
0),<span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span><span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span><span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span><span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span><span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span><span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span><span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span><span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\<br class=3D"">+ =
&nbsp;&nbsp;(h)-&gt;temp.p =3D (h)-&gt;object_base,<span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span> =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\<br class=3D"">+ =
&nbsp;&nbsp;(h)-&gt;next_free<span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span> =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\<br class=3D"">+ =
&nbsp;&nbsp;&nbsp;&nbsp;=3D __PTR_ALIGN ((h)-&gt;object_base, =
(h)-&gt;next_free,<span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span> =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\<br class=3D"">+ =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(h)-&gt;alignment_mask),<span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span> =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\<br class=3D"">+ &nbsp;&nbsp;(((size_t) =
((h)-&gt;next_free - (char *) (h)-&gt;chunk)<span class=3D"Apple-tab-span"=
 style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span> =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\<br class=3D"">+ =
&nbsp;&nbsp;&nbsp;&nbsp;&gt; (size_t) ((h)-&gt;chunk_limit - (char *) =
(h)-&gt;chunk))<span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span><span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\<br class=3D"">+ &nbsp;&nbsp;? =
((h)-&gt;next_free =3D (h)-&gt;chunk_limit) : 0),<span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span> =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\<br class=3D"">+ =
&nbsp;&nbsp;(h)-&gt;object_base =3D (h)-&gt;next_free,<span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span> =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\<br class=3D"">+ =
&nbsp;&nbsp;(h)-&gt;temp.p)<br class=3D"">+<br class=3D"">+# define =
obstack_free(h, obj)<span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span> =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\<br class=3D"">+ &nbsp;((h)-&gt;temp.p =3D =
(void *) (obj),<span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span><span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span><span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span><span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span><span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\<br class=3D"">+ =
&nbsp;&nbsp;(((h)-&gt;temp.p &gt; (void *) (h)-&gt;chunk<span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span> =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\<br class=3D"">+ =
&nbsp;&nbsp;&nbsp;&nbsp;&amp;&amp; (h)-&gt;temp.p &lt; (void *) =
(h)-&gt;chunk_limit)<span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span> =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\<br class=3D"">+ &nbsp;&nbsp;&nbsp;? =
(void) ((h)-&gt;next_free =3D (h)-&gt;object_base =3D (char *) =
(h)-&gt;temp.p) &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\<br class=3D"">+ =
&nbsp;&nbsp;&nbsp;: _obstack_free ((h), (h)-&gt;temp.p)))<br =
class=3D"">+<br class=3D"">+#endif /* not __GNUC__ */<br class=3D"">+<br =
class=3D"">+#ifdef __cplusplus<br class=3D"">+} =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/* C++ */<br class=3D"">+#endif<br =
class=3D"">+<br class=3D"">+#endif /* _OBSTACK_H */<br class=3D"">diff =
--git a/musl-imported/include/scsi/scsi.h =
b/musl-imported/include/scsi/scsi.h<br class=3D"">new file mode =
100644<br class=3D"">index 0000000..8837f58<br class=3D"">--- =
/dev/null<br class=3D"">+++ b/musl-imported/include/scsi/scsi.h<br =
class=3D"">@@ -0,0 +1,150 @@<br class=3D"">+#ifndef _SCSI_SCSI_H<br =
class=3D"">+#define _SCSI_SCSI_H<br class=3D"">+<br class=3D"">+#define =
TEST_UNIT_READY 0x00<br class=3D"">+#define REZERO_UNIT 0x01<br =
class=3D"">+#define REQUEST_SENSE 0x03<br class=3D"">+#define =
FORMAT_UNIT 0x04<br class=3D"">+#define READ_BLOCK_LIMITS 0x05<br =
class=3D"">+#define REASSIGN_BLOCKS 0x07<br class=3D"">+#define READ_6 =
0x08<br class=3D"">+#define WRITE_6 0x0a<br class=3D"">+#define SEEK_6 =
0x0b<br class=3D"">+#define READ_REVERSE 0x0f<br class=3D"">+#define =
WRITE_FILEMARKS 0x10<br class=3D"">+#define SPACE 0x11<br =
class=3D"">+#define INQUIRY 0x12<br class=3D"">+#define =
RECOVER_BUFFERED_DATA 0x14<br class=3D"">+#define MODE_SELECT 0x15<br =
class=3D"">+#define RESERVE 0x16<br class=3D"">+#define RELEASE 0x17<br =
class=3D"">+#define COPY 0x18<br class=3D"">+#define ERASE 0x19<br =
class=3D"">+#define MODE_SENSE 0x1a<br class=3D"">+#define START_STOP =
0x1b<br class=3D"">+#define RECEIVE_DIAGNOSTIC 0x1c<br class=3D"">+#define=
 SEND_DIAGNOSTIC 0x1d<br class=3D"">+#define ALLOW_MEDIUM_REMOVAL =
0x1e<br class=3D"">+#define SET_WINDOW 0x24<br class=3D"">+#define =
READ_CAPACITY 0x25<br class=3D"">+#define READ_10 0x28<br =
class=3D"">+#define WRITE_10 0x2a<br class=3D"">+#define SEEK_10 0x2b<br =
class=3D"">+#define WRITE_VERIFY 0x2e<br class=3D"">+#define VERIFY =
0x2f<br class=3D"">+#define SEARCH_HIGH 0x30<br class=3D"">+#define =
SEARCH_EQUAL 0x31<br class=3D"">+#define SEARCH_LOW 0x32<br =
class=3D"">+#define SET_LIMITS 0x33<br class=3D"">+#define PRE_FETCH =
0x34<br class=3D"">+#define READ_POSITION 0x34<br class=3D"">+#define =
SYNCHRONIZE_CACHE 0x35<br class=3D"">+#define LOCK_UNLOCK_CACHE 0x36<br =
class=3D"">+#define READ_DEFECT_DATA 0x37<br class=3D"">+#define =
MEDIUM_SCAN 0x38<br class=3D"">+#define COMPARE 0x39<br =
class=3D"">+#define COPY_VERIFY 0x3a<br class=3D"">+#define WRITE_BUFFER =
0x3b<br class=3D"">+#define READ_BUFFER 0x3c<br class=3D"">+#define =
UPDATE_BLOCK 0x3d<br class=3D"">+#define READ_LONG 0x3e<br =
class=3D"">+#define WRITE_LONG 0x3f<br class=3D"">+#define =
CHANGE_DEFINITION 0x40<br class=3D"">+#define WRITE_SAME 0x41<br =
class=3D"">+#define READ_TOC 0x43<br class=3D"">+#define LOG_SELECT =
0x4c<br class=3D"">+#define LOG_SENSE 0x4d<br class=3D"">+#define =
MODE_SELECT_10 0x55<br class=3D"">+#define RESERVE_10 0x56<br =
class=3D"">+#define RELEASE_10 0x57<br class=3D"">+#define MODE_SENSE_10 =
0x5a<br class=3D"">+#define PERSISTENT_RESERVE_IN 0x5e<br =
class=3D"">+#define PERSISTENT_RESERVE_OUT 0x5f<br class=3D"">+#define =
MOVE_MEDIUM 0xa5<br class=3D"">+#define READ_12 0xa8<br =
class=3D"">+#define WRITE_12 0xaa<br class=3D"">+#define WRITE_VERIFY_12 =
0xae<br class=3D"">+#define SEARCH_HIGH_12 0xb0<br class=3D"">+#define =
SEARCH_EQUAL_12 0xb1<br class=3D"">+#define SEARCH_LOW_12 0xb2<br =
class=3D"">+#define READ_ELEMENT_STATUS 0xb8<br class=3D"">+#define =
SEND_VOLUME_TAG 0xb6<br class=3D"">+#define WRITE_LONG_2 0xea<br =
class=3D"">+#define GOOD 0x00<br class=3D"">+#define CHECK_CONDITION =
0x01<br class=3D"">+#define CONDITION_GOOD 0x02<br class=3D"">+#define =
BUSY 0x04<br class=3D"">+#define INTERMEDIATE_GOOD 0x08<br =
class=3D"">+#define INTERMEDIATE_C_GOOD 0x0a<br class=3D"">+#define =
RESERVATION_CONFLICT 0x0c<br class=3D"">+#define COMMAND_TERMINATED =
0x11<br class=3D"">+#define QUEUE_FULL 0x14<br class=3D"">+#define =
STATUS_MASK 0x3e<br class=3D"">+#define NO_SENSE 0x00<br =
class=3D"">+#define RECOVERED_ERROR 0x01<br class=3D"">+#define =
NOT_READY 0x02<br class=3D"">+#define MEDIUM_ERROR 0x03<br =
class=3D"">+#define HARDWARE_ERROR 0x04<br class=3D"">+#define =
ILLEGAL_REQUEST 0x05<br class=3D"">+#define UNIT_ATTENTION 0x06<br =
class=3D"">+#define DATA_PROTECT 0x07<br class=3D"">+#define BLANK_CHECK =
0x08<br class=3D"">+#define COPY_ABORTED 0x0a<br class=3D"">+#define =
ABORTED_COMMAND 0x0b<br class=3D"">+#define VOLUME_OVERFLOW 0x0d<br =
class=3D"">+#define MISCOMPARE 0x0e<br class=3D"">+#define TYPE_DISK =
0x00<br class=3D"">+#define TYPE_TAPE 0x01<br class=3D"">+#define =
TYPE_PROCESSOR 0x03<br class=3D"">+#define TYPE_WORM 0x04<br =
class=3D"">+#define TYPE_ROM 0x05<br class=3D"">+#define TYPE_SCANNER =
0x06<br class=3D"">+#define TYPE_MOD 0x07<br class=3D"">+#define =
TYPE_MEDIUM_CHANGER 0x08<br class=3D"">+#define TYPE_ENCLOSURE 0x0d<br =
class=3D"">+#define TYPE_NO_LUN 0x7f<br class=3D"">+#define =
COMMAND_COMPLETE 0x00<br class=3D"">+#define EXTENDED_MESSAGE 0x01<br =
class=3D"">+#define EXTENDED_MODIFY_DATA_POINTER 0x00<br =
class=3D"">+#define EXTENDED_SDTR 0x01<br class=3D"">+#define =
EXTENDED_EXTENDED_IDENTIFY 0x02<br class=3D"">+#define EXTENDED_WDTR =
0x03<br class=3D"">+#define SAVE_POINTERS 0x02<br class=3D"">+#define =
RESTORE_POINTERS 0x03<br class=3D"">+#define DISCONNECT 0x04<br =
class=3D"">+#define INITIATOR_ERROR 0x05<br class=3D"">+#define ABORT =
0x06<br class=3D"">+#define MESSAGE_REJECT 0x07<br class=3D"">+#define =
NOP 0x08<br class=3D"">+#define MSG_PARITY_ERROR 0x09<br =
class=3D"">+#define LINKED_CMD_COMPLETE 0x0a<br class=3D"">+#define =
LINKED_FLG_CMD_COMPLETE 0x0b<br class=3D"">+#define BUS_DEVICE_RESET =
0x0c<br class=3D"">+#define INITIATE_RECOVERY 0x0f<br class=3D"">+#define =
RELEASE_RECOVERY 0x10<br class=3D"">+#define SIMPLE_QUEUE_TAG 0x20<br =
class=3D"">+#define HEAD_OF_QUEUE_TAG 0x21<br class=3D"">+#define =
ORDERED_QUEUE_TAG 0x22<br class=3D"">+#define SCSI_IOCTL_GET_IDLUN =
0x5382<br class=3D"">+#define SCSI_IOCTL_TAGGED_ENABLE 0x5383<br =
class=3D"">+#define SCSI_IOCTL_TAGGED_DISABLE 0x5384<br =
class=3D"">+#define SCSI_IOCTL_PROBE_HOST 0x5385<br class=3D"">+#define =
SCSI_IOCTL_GET_BUS_NUMBER 0x5386<br class=3D"">+<br class=3D"">+struct =
ccs_modesel_head {<br class=3D"">+<span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span>unsigned char _r1;<br =
class=3D"">+<span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span>unsigned char medium;<br class=3D"">+<span class=3D"Apple-tab-span"=
 style=3D"white-space:pre">	</span>unsigned char _r2;<br =
class=3D"">+<span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span>unsigned char block_desc_length;<br class=3D"">+<span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span>unsigned =
char density;<br class=3D"">+<span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span>unsigned char =
number_blocks_hi;<br class=3D"">+<span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span>unsigned char =
number_blocks_med;<br class=3D"">+<span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span>unsigned char =
number_blocks_lo;<br class=3D"">+<span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span>unsigned char _r3;<br =
class=3D"">+<span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span>unsigned char block_length_hi;<br class=3D"">+<span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span>unsigned =
char block_length_med;<br class=3D"">+<span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span>unsigned char block_length_lo;<br =
class=3D"">+};<br class=3D"">+<br class=3D"">+#endif<br class=3D"">+<br =
class=3D"">diff --git a/musl-imported/include/sys/mtio.h =
b/musl-imported/include/sys/mtio.h<br class=3D"">new file mode 100644<br =
class=3D"">index 0000000..f16a529<br class=3D"">--- /dev/null<br =
class=3D"">+++ b/musl-imported/include/sys/mtio.h<br class=3D"">@@ -0,0 =
+1,188 @@<br class=3D"">+#ifndef _SYS_MTIO_H<br class=3D"">+#define =
_SYS_MTIO_H<br class=3D"">+<br class=3D"">+#include =
&lt;sys/types.h&gt;<br class=3D"">+#include &lt;sys/ioctl.h&gt;<br =
class=3D"">+<br class=3D"">+struct mtop {<br class=3D"">+<span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span>short =
mt_op;<br class=3D"">+<span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span>int mt_count;<br class=3D"">+};<br =
class=3D"">+<br class=3D"">+#define _IOT_mtop _IOT (_IOTS (short), 1, =
_IOTS (int), 1, 0, 0)<br class=3D"">+#define _IOT_mtget _IOT (_IOTS =
(long), 7, 0, 0, 0, 0)<br class=3D"">+#define _IOT_mtpos _IOT_SIMPLE =
(long)<br class=3D"">+#define _IOT_mtconfiginfo _IOT (_IOTS (long), 2, =
_IOTS (short), 3, _IOTS (long), 1)<br class=3D"">+<br class=3D"">+<br =
class=3D"">+#define MTRESET 0<br class=3D"">+#define MTFSF<span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span>1<br =
class=3D"">+#define MTBSF<span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span>2<br class=3D"">+#define =
MTFSR<span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span>3<br class=3D"">+#define MTBSR<span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span>4<br class=3D"">+#define =
MTWEOF<span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span>5<br class=3D"">+#define MTREW<span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span>6<br class=3D"">+#define =
MTOFFL<span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span>7<br class=3D"">+#define MTNOP<span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span>8<br class=3D"">+#define MTRETEN =
9<br class=3D"">+#define MTBSFM<span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span>10<br class=3D"">+#define MTFSFM =
&nbsp;11<br class=3D"">+#define MTEOM<span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span>12<br class=3D"">+#define MTERASE =
13<br class=3D"">+#define MTRAS1 &nbsp;14<br class=3D"">+#define =
MTRAS2<span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span>15<br class=3D"">+#define MTRAS3 &nbsp;16<br class=3D"">+#define =
MTSETBLK 20<br class=3D"">+#define MTSETDENSITY 21<br class=3D"">+#define =
MTSEEK<span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span>22<br class=3D"">+#define MTTELL<span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span>23<br class=3D"">+#define =
MTSETDRVBUFFER 24<br class=3D"">+#define MTFSS<span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span>25<br =
class=3D"">+#define MTBSS<span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span>26<br class=3D"">+#define =
MTWSM<span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span>27<br class=3D"">+#define MTLOCK &nbsp;28<br class=3D"">+#define =
MTUNLOCK 29<br class=3D"">+#define MTLOAD &nbsp;30<br class=3D"">+#define =
MTUNLOAD 31<br class=3D"">+#define MTCOMPRESSION 32<br class=3D"">+#define=
 MTSETPART 33<br class=3D"">+#define MTMKPART &nbsp;34<br class=3D"">+<br =
class=3D"">+struct mtget {<br class=3D"">+<span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span>long mt_type;<br class=3D"">+<span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span>long =
mt_resid;<br class=3D"">+<span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span>long mt_dsreg;<br class=3D"">+<span=
 class=3D"Apple-tab-span" style=3D"white-space:pre">	</span>long =
mt_gstat;<br class=3D"">+<span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span>long mt_erreg;<br class=3D"">+<span=
 class=3D"Apple-tab-span" style=3D"white-space:pre">	</span>int =
mt_fileno;<br class=3D"">+<span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span>int mt_blkno;<br class=3D"">+};<br =
class=3D"">+<br class=3D"">+#define MT_ISUNKNOWN<span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span>0x01<br =
class=3D"">+#define MT_ISQIC02<span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span>0x02<br class=3D"">+#define =
MT_ISWT5150<span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span><span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span>0x03<br class=3D"">+#define MT_ISARCHIVE_5945L2<span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span>0x04<br =
class=3D"">+#define MT_ISCMSJ500<span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span>0x05<br class=3D"">+#define =
MT_ISTDC3610<span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span><span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span>0x06<br class=3D"">+#define MT_ISARCHIVE_VP60I<span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span>0x07<br =
class=3D"">+#define MT_ISARCHIVE_2150L<span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span>0x08<br class=3D"">+#define =
MT_ISARCHIVE_2060L<span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span>0x09<br class=3D"">+#define =
MT_ISARCHIVESC499<span class=3D"Apple-tab-span" style=3D"white-space:pre">=
	</span>0x0A<br class=3D"">+#define MT_ISQIC02_ALL_FEATURES<span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span>0x0F<br =
class=3D"">+#define MT_ISWT5099EEN24<span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span>0x11<br class=3D"">+#define =
MT_ISTEAC_MT2ST<span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span><span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span>0x12<br class=3D"">+#define MT_ISEVEREX_FT40A<span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span>0x32<br =
class=3D"">+#define MT_ISDDS1<span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span>0x51<br class=3D"">+#define =
MT_ISDDS2<span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span><span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span>0x52<br class=3D"">+#define MT_ISSCSI1<span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span>0x71<br =
class=3D"">+#define MT_ISSCSI2<span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span>0x72<br class=3D"">+#define =
MT_ISFTAPE_UNKNOWN<span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span>0x800000<br class=3D"">+#define =
MT_ISFTAPE_FLAG<span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span><span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span>0x800000<br class=3D"">+<br class=3D"">+struct mt_tape_info {<br =
class=3D"">+<span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span>long t_type;<br class=3D"">+<span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span>char *t_name;<br class=3D"">+};<br =
class=3D"">+<br class=3D"">+#define MT_TAPE_INFO \<br class=3D"">+{<span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span> =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\<br class=3D"">+<span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span>{MT_ISUNKNOWN,<span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span>"Unknown type of tape =
device"},<span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span><span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\<br class=3D"">+<span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span>{MT_ISQIC02,<span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span>"Generic QIC-02 tape =
streamer"},<span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\<br class=3D"">+<span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span>{MT_ISWT5150,<span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span>"Wangtek 5150, QIC-150"},<span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span> =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\<br class=3D"">+<span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span>{MT_ISARCHIVE_5945L2,<span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span>"Archive 5945L-2"},<span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span> =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\<br class=3D"">+<span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span>{MT_ISCMSJ500,<span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span>"CMS Jumbo 500"},<span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span> =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\<br class=3D"">+<span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span>{MT_ISTDC3610,<span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span>"Tandberg TDC 3610, =
QIC-24"},<span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span><span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\<br class=3D"">+<span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span>{MT_ISARCHIVE_VP60I,<span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span>"Archive VP60i, QIC-02"},<span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span> =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\<br class=3D"">+<span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span>{MT_ISARCHIVE_2150L,<span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span>"Archive Viper 2150L"},<span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span> =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\<br class=3D"">+<span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span>{MT_ISARCHIVE_2060L,<span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span>"Archive Viper 2060L"},<span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span> =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\<br class=3D"">+<span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span>{MT_ISARCHIVESC499,<span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span>"Archive SC-499 QIC-36 =
controller"},<span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\<br class=3D"">+<span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span>{MT_ISQIC02_ALL_FEATURES, "Generic QIC-02 tape, all =
features"},<span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\<br class=3D"">+<span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span>{MT_ISWT5099EEN24,<span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span>"Wangtek 5099-een24, 60MB"},<span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span> =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\<br class=3D"">+<span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span>{MT_ISTEAC_MT2ST,<span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span>"Teac MT-2ST 155mb data cassette =
drive"}, &nbsp;&nbsp;&nbsp;&nbsp;\<br class=3D"">+<span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span>{MT_ISEVEREX_FT40A,<span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span>"Everex FT40A, QIC-40"},<span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span> =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\<br class=3D"">+<span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span>{MT_ISSCSI1,<span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span>"Generic SCSI-1 tape"},<span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span> =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\<br class=3D"">+<span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span>{MT_ISSCSI2,<span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span>"Generic SCSI-2 tape"},<span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span> =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\<br class=3D"">+<span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span>{0, =
0}<span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span><span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span><span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span><span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span><span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span><span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span><span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span><span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\<br class=3D"">+}<br =
class=3D"">+<br class=3D"">+struct mtpos {<br class=3D"">+<span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span>long =
mt_blkno;<br class=3D"">+};<br class=3D"">+<br class=3D"">+struct =
mtconfiginfo &nbsp;{<br class=3D"">+<span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span>long mt_type;<br class=3D"">+<span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span>long =
ifc_type;<br class=3D"">+<span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span>unsigned short irqnr;<br =
class=3D"">+<span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span>unsigned short dmanr;<br class=3D"">+<span class=3D"Apple-tab-span"=
 style=3D"white-space:pre">	</span>unsigned short port;<br =
class=3D"">+<span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span>unsigned long debug;<br class=3D"">+<span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span>unsigned have_dens:1;<br =
class=3D"">+<span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span>unsigned have_bsf:1;<br class=3D"">+<span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span>unsigned have_fsr:1;<br =
class=3D"">+<span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span>unsigned have_bsr:1;<br class=3D"">+<span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span>unsigned have_eod:1;<br =
class=3D"">+<span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span>unsigned have_seek:1;<br class=3D"">+<span class=3D"Apple-tab-span"=
 style=3D"white-space:pre">	</span>unsigned have_tell:1;<br =
class=3D"">+<span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span>unsigned have_ras1:1;<br class=3D"">+<span class=3D"Apple-tab-span"=
 style=3D"white-space:pre">	</span>unsigned have_ras2:1;<br =
class=3D"">+<span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span>unsigned have_ras3:1;<br class=3D"">+<span class=3D"Apple-tab-span"=
 style=3D"white-space:pre">	</span>unsigned have_qfa:1;<br =
class=3D"">+<span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span>unsigned pad1:5;<br class=3D"">+<span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span>char reserved[10];<br =
class=3D"">+};<br class=3D"">+<br class=3D"">+#define<span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span>MTIOCTOP =
_IOW('m', 1, struct mtop)<br class=3D"">+#define<span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span>MTIOCGET =
_IOR('m', 2, struct mtget)<br class=3D"">+#define<span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span>MTIOCPOS =
_IOR('m', 3, struct mtpos)<br class=3D"">+<br class=3D"">+#define<span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span>MTIOCGETCONFIG<span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span>_IOR('m', 4, struct =
mtconfiginfo)<br class=3D"">+#define<span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span>MTIOCSETCONFIG<span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span>_IOW('m', =
5, struct mtconfiginfo)<br class=3D"">+<br class=3D"">+#define =
GMT_EOF(x) =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;((x) &amp; 0x80000000)<br class=3D"">+#define GMT_BOT(x) =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;((x) &amp; 0x40000000)<br class=3D"">+#define GMT_EOT(x) =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;((x) &amp; 0x20000000)<br class=3D"">+#define GMT_SM(x) =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;((x) &amp; 0x10000000)<br class=3D"">+#define GMT_EOD(x) =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;((x) &amp; 0x08000000)<br class=3D"">+#define GMT_WR_PROT(x) =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;((x) &amp; =
0x04000000)<br class=3D"">+#define GMT_ONLINE(x) =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;((x) &amp; =
0x01000000)<br class=3D"">+#define GMT_D_6250(x) =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;((x) &amp; =
0x00800000)<br class=3D"">+#define GMT_D_1600(x) =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;((x) &amp; =
0x00400000)<br class=3D"">+#define GMT_D_800(x) =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;((x) =
&amp; 0x00200000)<br class=3D"">+#define GMT_DR_OPEN(x) =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;((x) &amp; =
0x00040000)<br class=3D"">+#define GMT_IM_REP_EN(x) =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;((x) &amp; 0x00010000)<br =
class=3D"">+<br class=3D"">+#define MT_ST_BLKSIZE_SHIFT<span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span>0<br =
class=3D"">+#define MT_ST_BLKSIZE_MASK<span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span>0xffffff<br class=3D"">+#define =
MT_ST_DENSITY_SHIFT<span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span>24<br class=3D"">+#define =
MT_ST_DENSITY_MASK<span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span>0xff000000<br class=3D"">+#define =
MT_ST_SOFTERR_SHIFT<span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span>0<br class=3D"">+#define =
MT_ST_SOFTERR_MASK<span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span>0xffff<br class=3D"">+#define =
MT_ST_OPTIONS<span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span><span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span>0xf0000000<br class=3D"">+#define MT_ST_BOOLEANS<span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span>0x10000000<br class=3D"">+#define MT_ST_SETBOOLEANS<span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span>0x30000000<br class=3D"">+#define MT_ST_CLEARBOOLEANS<span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span>0x40000000<br class=3D"">+#define MT_ST_WRITE_THRESHOLD<span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span>0x20000000<br class=3D"">+#define MT_ST_DEF_BLKSIZE<span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span>0x50000000<br class=3D"">+#define MT_ST_DEF_OPTIONS<span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span>0x60000000<br class=3D"">+#define MT_ST_BUFFER_WRITES<span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span>0x1<br =
class=3D"">+#define MT_ST_ASYNC_WRITES<span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span>0x2<br class=3D"">+#define =
MT_ST_READ_AHEAD<span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span>0x4<br class=3D"">+#define MT_ST_DEBUGGING<span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span>0x8<br =
class=3D"">+#define MT_ST_TWO_FM<span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span>0x10<br class=3D"">+#define =
MT_ST_FAST_MTEOM<span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span>0x20<br class=3D"">+#define MT_ST_AUTO_LOCK<span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span>0x40<br =
class=3D"">+#define MT_ST_DEF_WRITES<span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span>0x80<br class=3D"">+#define =
MT_ST_CAN_BSR<span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span><span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span>0x100<br class=3D"">+#define MT_ST_NO_BLKLIMS<span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span>0x200<br =
class=3D"">+#define MT_ST_CAN_PARTITIONS &nbsp;&nbsp;&nbsp;0x400<br =
class=3D"">+#define MT_ST_SCSI2LOGICAL =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;0x800<br class=3D"">+#define =
MT_ST_CLEAR_DEFAULT<span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span>0xfffff<br class=3D"">+#define =
MT_ST_DEF_DENSITY<span class=3D"Apple-tab-span" style=3D"white-space:pre">=
	</span>(MT_ST_DEF_OPTIONS | 0x100000)<br class=3D"">+#define =
MT_ST_DEF_COMPRESSION<span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span>(MT_ST_DEF_OPTIONS | 0x200000)<br =
class=3D"">+#define MT_ST_DEF_DRVBUFFER<span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span>(MT_ST_DEF_OPTIONS | 0x300000)<br =
class=3D"">+#define MT_ST_HPLOADER_OFFSET 10000<br class=3D"">+#ifndef =
DEFTAPE<br class=3D"">+# define DEFTAPE<span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span>"/dev/tape"<br =
class=3D"">+#endif<br class=3D"">+<br class=3D"">+#endif<br =
class=3D"">diff --git a/musl-imported/include/sys/personality.h =
b/musl-imported/include/sys/personality.h<br class=3D"">new file mode =
100644<br class=3D"">index 0000000..31d43df<br class=3D"">--- =
/dev/null<br class=3D"">+++ b/musl-imported/include/sys/personality.h<br =
class=3D"">@@ -0,0 +1,46 @@<br class=3D"">+#ifndef _PERSONALITY_H<br =
class=3D"">+#define _PERSONALITY_H<br class=3D"">+<br class=3D"">+#ifdef =
__cplusplus<br class=3D"">+extern "C" {<br class=3D"">+#endif<br =
class=3D"">+<br class=3D"">+#define ADDR_NO_RANDOMIZE &nbsp;0x0040000<br =
class=3D"">+#define MMAP_PAGE_ZERO &nbsp;&nbsp;&nbsp;&nbsp;0x0100000<br =
class=3D"">+#define ADDR_COMPAT_LAYOUT 0x0200000<br class=3D"">+#define =
READ_IMPLIES_EXEC &nbsp;0x0400000<br class=3D"">+#define =
ADDR_LIMIT_32BIT &nbsp;&nbsp;0x0800000<br class=3D"">+#define =
SHORT_INODE &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;0x1000000<br =
class=3D"">+#define WHOLE_SECONDS =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;0x2000000<br class=3D"">+#define =
STICKY_TIMEOUTS &nbsp;&nbsp;&nbsp;0x4000000<br class=3D"">+#define =
ADDR_LIMIT_3GB &nbsp;&nbsp;&nbsp;&nbsp;0x8000000<br class=3D"">+<br =
class=3D"">+#define PER_LINUX 0<br class=3D"">+#define PER_LINUX_32BIT =
ADDR_LIMIT_32BIT<br class=3D"">+#define PER_SVR4 (1 | STICKY_TIMEOUTS | =
MMAP_PAGE_ZERO)<br class=3D"">+#define PER_SVR3 (2 | STICKY_TIMEOUTS | =
SHORT_INODE)<br class=3D"">+#define PER_SCOSVR3 (3 | STICKY_TIMEOUTS | =
WHOLE_SECONDS | SHORT_INODE)<br class=3D"">+#define PER_OSR5 (3 | =
STICKY_TIMEOUTS | WHOLE_SECONDS)<br class=3D"">+#define PER_WYSEV386 (4 =
| STICKY_TIMEOUTS | SHORT_INODE)<br class=3D"">+#define PER_ISCR4 (5 | =
STICKY_TIMEOUTS)<br class=3D"">+#define PER_BSD 6<br class=3D"">+#define =
PER_SUNOS (6 | STICKY_TIMEOUTS)<br class=3D"">+#define PER_XENIX (7 | =
STICKY_TIMEOUTS | SHORT_INODE)<br class=3D"">+#define PER_LINUX32 8<br =
class=3D"">+#define PER_LINUX32_3GB (8 | ADDR_LIMIT_3GB)<br =
class=3D"">+#define PER_IRIX32 (9 | STICKY_TIMEOUTS)<br =
class=3D"">+#define PER_IRIXN32 (0xa | STICKY_TIMEOUTS)<br =
class=3D"">+#define PER_IRIX64 (0x0b | STICKY_TIMEOUTS)<br =
class=3D"">+#define PER_RISCOS 0xc<br class=3D"">+#define PER_SOLARIS =
(0xd | STICKY_TIMEOUTS)<br class=3D"">+#define PER_UW7 (0xe | =
STICKY_TIMEOUTS | MMAP_PAGE_ZERO)<br class=3D"">+#define PER_OSF4 0xf<br =
class=3D"">+#define PER_HPUX 0x10<br class=3D"">+#define PER_MASK =
0xff<br class=3D"">+<br class=3D"">+int personality(unsigned long);<br =
class=3D"">+<br class=3D"">+#ifdef __cplusplus<br class=3D"">+}<br =
class=3D"">+#endif<br class=3D"">+#endif<br class=3D"">diff --git =
a/musl-imported/include/sys/timex.h =
b/musl-imported/include/sys/timex.h<br class=3D"">new file mode =
100644<br class=3D"">index 0000000..2e68888<br class=3D"">--- =
/dev/null<br class=3D"">+++ b/musl-imported/include/sys/timex.h<br =
class=3D"">@@ -0,0 +1,98 @@<br class=3D"">+#ifndef _SYS_TIMEX_H<br =
class=3D"">+#define _SYS_TIMEX_H<br class=3D"">+<br class=3D"">+#ifdef =
__cplusplus<br class=3D"">+extern "C" {<br class=3D"">+#endif<br =
class=3D"">+<br class=3D"">+#define __NEED_clockid_t<br class=3D"">+<br =
class=3D"">+#include &lt;bits/alltypes.h&gt;<br class=3D"">+<br =
class=3D"">+#include &lt;sys/time.h&gt;<br class=3D"">+<br =
class=3D"">+struct ntptimeval {<br class=3D"">+<span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span>struct =
timeval time;<br class=3D"">+<span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span>long maxerror, esterror;<br =
class=3D"">+};<br class=3D"">+<br class=3D"">+struct timex {<br =
class=3D"">+<span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span>unsigned modes;<br class=3D"">+<span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span>long offset, freq, maxerror, =
esterror;<br class=3D"">+<span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span>int status;<br class=3D"">+<span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span>long =
constant, precision, tolerance;<br class=3D"">+<span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span>struct =
timeval time;<br class=3D"">+<span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span>long tick, ppsfreq, jitter;<br =
class=3D"">+<span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span>int shift;<br class=3D"">+<span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span>long stabil, jitcnt, calcnt, =
errcnt, stbcnt;<br class=3D"">+<span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span>int tai;<br class=3D"">+<span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span>int =
__padding[11];<br class=3D"">+};<br class=3D"">+<br class=3D"">+#define =
ADJ_OFFSET<span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span><span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span>0x0001<br class=3D"">+#define ADJ_FREQUENCY<span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span>0x0002<br =
class=3D"">+#define ADJ_MAXERROR<span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span>0x0004<br class=3D"">+#define =
ADJ_ESTERROR<span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span><span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span>0x0008<br class=3D"">+#define ADJ_STATUS<span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span>0x0010<br =
class=3D"">+#define ADJ_TIMECONST<span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span>0x0020<br class=3D"">+#define =
ADJ_TAI<span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span><span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span><span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span>0x0080<br class=3D"">+#define ADJ_SETOFFSET<span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span>0x0100<br =
class=3D"">+#define ADJ_MICRO<span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span>0x1000<br class=3D"">+#define =
ADJ_NANO<span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span><span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span>0x2000<br class=3D"">+#define ADJ_TICK<span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span>0x4000<br =
class=3D"">+#define ADJ_OFFSET_SINGLESHOT<span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span>0x8001<br class=3D"">+#define =
ADJ_OFFSET_SS_READ<span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span>0xa001<br class=3D"">+<br =
class=3D"">+#define MOD_OFFSET<span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span>ADJ_OFFSET<br class=3D"">+#define =
MOD_FREQUENCY<span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span>ADJ_FREQUENCY<br class=3D"">+#define MOD_MAXERROR<span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span>ADJ_MAXERROR<br class=3D"">+#define MOD_ESTERROR<span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span>ADJ_ESTERROR<br class=3D"">+#define MOD_STATUS<span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span>ADJ_STATUS<br class=3D"">+#define MOD_TIMECONST<span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span>ADJ_TIMECONST<br class=3D"">+#define MOD_CLKB<span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span>ADJ_TICK<br class=3D"">+#define MOD_CLKA<span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span>ADJ_OFFSET_SINGLESHOT<br class=3D"">+#define MOD_TAI<span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span>ADJ_TAI<br class=3D"">+#define MOD_MICRO<span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span>ADJ_MICRO<br class=3D"">+#define MOD_NANO<span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span>ADJ_NANO<br class=3D"">+<br class=3D"">+#define STA_PLL<span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span>0x0001<br =
class=3D"">+#define STA_PPSFREQ<span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span>0x0002<br class=3D"">+#define =
STA_PPSTIME<span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span>0x0004<br class=3D"">+#define STA_FLL<span class=3D"Apple-tab-span"=
 style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span>0x0008<br class=3D"">+<br =
class=3D"">+#define STA_INS<span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span>0x0010<br class=3D"">+#define =
STA_DEL<span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span><span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span>0x0020<br class=3D"">+#define STA_UNSYNC<span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span>0x0040<br =
class=3D"">+#define STA_FREQHOLD<span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span>0x0080<br class=3D"">+<br =
class=3D"">+#define STA_PPSSIGNAL<span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span>0x0100<br class=3D"">+#define =
STA_PPSJITTER<span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span>0x0200<br class=3D"">+#define STA_PPSWANDER<span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span>0x0400<br =
class=3D"">+#define STA_PPSERROR<span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span>0x0800<br class=3D"">+<br =
class=3D"">+#define STA_CLOCKERR<span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span>0x1000<br class=3D"">+#define =
STA_NANO<span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span>0x2000<br class=3D"">+#define STA_MODE<span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span>0x4000<br =
class=3D"">+#define STA_CLK<span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span>0x8000<br class=3D"">+<br =
class=3D"">+#define STA_RONLY (STA_PPSSIGNAL | STA_PPSJITTER | =
STA_PPSWANDER | \<br class=3D"">+ &nbsp;&nbsp;&nbsp;STA_PPSERROR | =
STA_CLOCKERR | STA_NANO | STA_MODE | STA_CLK)<br class=3D"">+<br =
class=3D"">+#define TIME_OK<span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span>0<br class=3D"">+#define =
TIME_INS<span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span>1<br class=3D"">+#define TIME_DEL<span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span>2<br class=3D"">+#define =
TIME_OOP<span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span>3<br class=3D"">+#define TIME_WAIT<span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span>4<br class=3D"">+#define =
TIME_ERROR<span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span>5<br class=3D"">+#define TIME_BAD<span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span>TIME_ERROR<br class=3D"">+<br =
class=3D"">+#define MAXTC<span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span>6<br class=3D"">+<br =
class=3D"">+int adjtimex(struct timex *);<br class=3D"">+int =
clock_adjtime(clockid_t, struct timex *);<br class=3D"">+<br =
class=3D"">+#ifdef __cplusplus<br class=3D"">+}<br class=3D"">+#endif<br =
class=3D"">+<br class=3D"">+#endif<br class=3D"">diff --git =
a/musl-imported/include/sys/vfs.h b/musl-imported/include/sys/vfs.h<br =
class=3D"">new file mode 100644<br class=3D"">index 0000000..a899db2<br =
class=3D"">--- /dev/null<br class=3D"">+++ =
b/musl-imported/include/sys/vfs.h<br class=3D"">@@ -0,0 +1 @@<br =
class=3D"">+#include &lt;sys/statfs.h&gt;<br class=3D"">diff --git =
a/musl-imported/include/utmp.h b/musl-imported/include/utmp.h<br =
class=3D"">new file mode 100644<br class=3D"">index 0000000..48a400d<br =
class=3D"">--- /dev/null<br class=3D"">+++ =
b/musl-imported/include/utmp.h<br class=3D"">@@ -0,0 +1,52 @@<br =
class=3D"">+#ifndef _UTMP_H<br class=3D"">+#define _UTMP_H<br =
class=3D"">+<br class=3D"">+#ifdef __cplusplus<br class=3D"">+extern "C" =
{<br class=3D"">+#endif<br class=3D"">+<br class=3D"">+#include =
&lt;utmpx.h&gt;<br class=3D"">+<br class=3D"">+#define ACCOUNTING 9<br =
class=3D"">+#define UT_NAMESIZE 32<br class=3D"">+#define UT_HOSTSIZE =
256<br class=3D"">+#define UT_LINESIZE 32<br class=3D"">+<br =
class=3D"">+struct lastlog {<br class=3D"">+<span class=3D"Apple-tab-span"=
 style=3D"white-space:pre">	</span>time_t ll_time;<br =
class=3D"">+<span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span>char ll_line[UT_LINESIZE];<br class=3D"">+<span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span>char =
ll_host[UT_HOSTSIZE];<br class=3D"">+};<br class=3D"">+<br =
class=3D"">+#define ut_time ut_tv.tv_sec<br class=3D"">+#define ut_name =
ut_user<br class=3D"">+#define ut_addr ut_addr_v6[0]<br =
class=3D"">+#define utmp utmpx<br class=3D"">+#define e_exit __e_exit<br =
class=3D"">+#define e_termination __e_termination<br class=3D"">+<br =
class=3D"">+void =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;endutent(void);<br =
class=3D"">+struct utmp *getutent(void);<br class=3D"">+struct utmp =
*getutid(const struct utmp *);<br class=3D"">+struct utmp =
*getutline(const struct utmp *);<br class=3D"">+struct utmp =
*pututline(const struct utmp *);<br class=3D"">+void =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;setutent(void);<br =
class=3D"">+<br class=3D"">+void updwtmp(const char *, const struct utmp =
*);<br class=3D"">+int utmpname(const char *);<br class=3D"">+<br =
class=3D"">+int login_tty(int);<br class=3D"">+<br class=3D"">+#define =
_PATH_UTMP "/dev/null/utmp"<br class=3D"">+#define _PATH_WTMP =
"/dev/null/wtmp"<br class=3D"">+<br class=3D"">+#define UTMP_FILE =
_PATH_UTMP<br class=3D"">+#define WTMP_FILE _PATH_WTMP<br =
class=3D"">+#define UTMP_FILENAME _PATH_UTMP<br class=3D"">+#define =
WTMP_FILENAME _PATH_WTMP<br class=3D"">+<br class=3D"">+#ifdef =
__cplusplus<br class=3D"">+}<br class=3D"">+#endif<br class=3D"">+<br =
class=3D"">+#endif<br class=3D"">diff --git =
a/musl-imported/include/utmpx.h b/musl-imported/include/utmpx.h<br =
class=3D"">new file mode 100644<br class=3D"">index 0000000..cdcc90d<br =
class=3D"">--- /dev/null<br class=3D"">+++ =
b/musl-imported/include/utmpx.h<br class=3D"">@@ -0,0 +1,62 @@<br =
class=3D"">+#ifndef _UTMPX_H<br class=3D"">+#define _UTMPX_H<br =
class=3D"">+<br class=3D"">+#ifdef __cplusplus<br class=3D"">+extern "C" =
{<br class=3D"">+#endif<br class=3D"">+<br class=3D"">+#include =
&lt;features.h&gt;<br class=3D"">+<br class=3D"">+#define =
__NEED_pid_t<br class=3D"">+#define __NEED_time_t<br class=3D"">+#define =
__NEED_suseconds_t<br class=3D"">+#define __NEED_struct_timeval<br =
class=3D"">+<br class=3D"">+#include &lt;bits/alltypes.h&gt;<br =
class=3D"">+<br class=3D"">+struct utmpx {<br class=3D"">+<span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span>short =
ut_type;<br class=3D"">+<span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span>pid_t ut_pid;<br class=3D"">+<span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span>char =
ut_line[32];<br class=3D"">+<span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span>char ut_id[4];<br class=3D"">+<span=
 class=3D"Apple-tab-span" style=3D"white-space:pre">	</span>char =
ut_user[32];<br class=3D"">+<span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span>char ut_host[256];<br =
class=3D"">+<span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span>struct {<br class=3D"">+<span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span>short __e_termination;<br =
class=3D"">+<span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span><span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span>short __e_exit;<br class=3D"">+<span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span>} ut_exit;<br class=3D"">+<span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span>long =
ut_session;<br class=3D"">+<span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span>struct timeval ut_tv;<br =
class=3D"">+<span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span>unsigned ut_addr_v6[4];<br class=3D"">+<span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span>char =
unused[20];<br class=3D"">+};<br class=3D"">+<br class=3D"">+void =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;endutxent(void);<br =
class=3D"">+struct utmpx *getutxent(void);<br class=3D"">+struct utmpx =
*getutxid(const struct utmpx *);<br class=3D"">+struct utmpx =
*getutxline(const struct utmpx *);<br class=3D"">+struct utmpx =
*pututxline(const struct utmpx *);<br class=3D"">+void =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;setutxent(void);<br =
class=3D"">+<br class=3D"">+#if defined(_BSD_SOURCE) || =
defined(_GNU_SOURCE)<br class=3D"">+#define e_exit __e_exit<br =
class=3D"">+#define e_termination __e_termination<br class=3D"">+void =
updwtmpx(const char *, const struct utmpx *);<br class=3D"">+int =
utmpxname(const char *);<br class=3D"">+#endif<br class=3D"">+<br =
class=3D"">+#define EMPTY =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;0<br =
class=3D"">+#define RUN_LVL =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;1<br class=3D"">+#define =
BOOT_TIME &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;2<br class=3D"">+#define =
NEW_TIME &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;3<br =
class=3D"">+#define OLD_TIME =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;4<br class=3D"">+#define =
INIT_PROCESS &nbsp;&nbsp;&nbsp;5<br class=3D"">+#define LOGIN_PROCESS =
&nbsp;&nbsp;6<br class=3D"">+#define USER_PROCESS &nbsp;&nbsp;&nbsp;7<br =
class=3D"">+#define DEAD_PROCESS &nbsp;&nbsp;&nbsp;8<br class=3D"">+<br =
class=3D"">+#ifdef __cplusplus<br class=3D"">+}<br class=3D"">+#endif<br =
class=3D"">+<br class=3D"">+#endif<br class=3D"">-- <br =
class=3D"">2.27.0<br class=3D""><br class=3D""><br class=3D""><br =
class=3D""><br class=3D""><br =
class=3D""></div></div></blockquote></div><br class=3D""></body></html>=

--Apple-Mail=_C4ED6FC8-3DAE-4EA8-9960-A284E367E1D8--


From minios-devel-bounces@lists.xenproject.org Thu Jan 28 11:34:57 2021
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Thu, 28 Jan 2021 11:34:57 +0000
Received: from list by lists.xenproject.org with outflank-mailman.76942.139093 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1l55Ze-0003Oz-Fj; Thu, 28 Jan 2021 11:34:54 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 76942.139093; Thu, 28 Jan 2021 11:34: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 1l55Ze-0003Os-Cl; Thu, 28 Jan 2021 11:34:54 +0000
Received: by outflank-mailman (input) for mailman id 76942;
 Thu, 28 Jan 2021 11:34: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=ZVXE=G7=gmail.com=cristianvijelie@srs-us1.protection.inumbo.net>)
 id 1l55Zd-0003Ol-8l
 for minios-devel@lists.xen.org; Thu, 28 Jan 2021 11:34:53 +0000
Received: from mail-ej1-x62a.google.com (unknown [2a00:1450:4864:20::62a])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id ab66c538-597c-4917-b933-89ad9c0afa8b;
 Thu, 28 Jan 2021 11:34:52 +0000 (UTC)
Received: by mail-ej1-x62a.google.com with SMTP id bl23so7244156ejb.5
 for <minios-devel@lists.xen.org>; Thu, 28 Jan 2021 03:34:52 -0800 (PST)
Received: from localhost.localdomain (5-13-183-146.residential.rdsnet.ro.
 [5.13.183.146])
 by smtp.gmail.com with ESMTPSA id t11sm2735389edd.1.2021.01.28.03.34.50
 for <minios-devel@lists.xen.org>
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Thu, 28 Jan 2021 03:34:50 -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: ab66c538-597c-4917-b933-89ad9c0afa8b
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20161025;
        h=from:to:subject:date:message-id:mime-version
         :content-transfer-encoding;
        bh=u2YOflc+7SIo15o+OxM06R0JOUYGMrD8m1vnAcM/Ako=;
        b=cgZFpOXHogMBoA36EK72gEMrcPjPOe/5gK4yV75K8IkJ7VPXU7E5CfnjlzJXt9NeOf
         pkyL/6UEQkazeuS9EAgNuStp5xsP1yuiGRV193rMI2VNs4hg5qctJQnPy8ETv56WyjAi
         v8h1xfB7OqLyvYKGsrFUphp9uLOYixLBzKXrutLIYzgbePYuBJple+uTIB0Lp2S++bR9
         s52ElcTdybao+sNcNfTQeiR+yjgze7KnDrQUt2+zeaWCwvwnBjo5tPczMwQYUx89GSFj
         +PV9fez0vzAXPqZHaXzb9I5hNobZiATrPB4jV4e5dwW9rBstmIdwPTP4uNSMX7sXJRkE
         S9gA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20161025;
        h=x-gm-message-state:from:to:subject:date:message-id:mime-version
         :content-transfer-encoding;
        bh=u2YOflc+7SIo15o+OxM06R0JOUYGMrD8m1vnAcM/Ako=;
        b=F51Pan0PAHv0pNZ4XzuQULLazLLDH4cXpfrlmoNXizCOwHfjqMopMa2Ee5rLI9uoSR
         U8rXRY1ubdtfEMYa69YHVxjsfZWZQuc6jUl3gpbXBgGAbr0SE5/8xMiiUAib3NALnR3g
         beFF9NIcOG5/Nn3r/lLA3yGZCXtcUFQwujGkY4rNk2jBVRIOFCrI8yPPxImarQTzhXLI
         m+M3lttwJo+GzREX8wmXDESNg+bpv0CTj+3cQ1k+6j5B+P+dQ9sBGbh0Ct/pyR/Ciokl
         slGU1e5mLW3uLO2MvLVIWdlLZAMrBFE/t8MBmXM6QfnkjceH5or0sO3eKv7cwUJ72+1k
         dkyQ==
X-Gm-Message-State: AOAM532LjLRk7gE3MFHAj2hW7eWMTjfXCTS9pJDLRhD4bk2zL1MlEkkS
	vMH7amw5PovjEYJRsMGyUZqw+av/HPQ=
X-Google-Smtp-Source: ABdhPJxOIbHzWiXE9S11rniYKb4AOW6tJPv+LSCNrzlH9zPlDIPewbEBsjaXrRkeFe7M7p4OO70EMg==
X-Received: by 2002:a17:906:7687:: with SMTP id o7mr10738303ejm.209.1611833691135;
        Thu, 28 Jan 2021 03:34:51 -0800 (PST)
From: cristian-vijelie <cristianvijelie@gmail.com>
To: minios-devel@lists.xen.org
Subject: [[UNIKRAFT] 0/4] Provide isr-safe routines for unikraft
Date: Thu, 28 Jan 2021 13:34:45 +0200
Message-Id: <20210128113449.22457-1-cristianvijelie@gmail.com>
X-Mailer: git-send-email 2.25.1
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit

This series of patches adds a new library, isrlib, and modifes
2 existing ones, uklock and ukmpi, to provide interrupt-context-safe
routines to unikraft.

cristian-vijelie (4):
  lib/isrlib: Introduce libc-like interrupt-context-safe routines
  lib/uklock: Provide isr-safe mutex routines
  lib/uklock: Provide isr-safe semaphore routines
  lib/ukmpi: Provide isr-safe routines

 lib/isrlib/Config.uk                  |   3 +
 lib/isrlib/Makefile.uk                |  10 +
 lib/isrlib/include/uk/isr/stdlib.h    |  60 ++++
 lib/isrlib/include/uk/isr/string.h    |  72 +++++
 lib/isrlib/stdlib.c                   | 417 ++++++++++++++++++++++++++
 lib/isrlib/string.c                   | 325 ++++++++++++++++++++
 lib/uklock/include/uk/isr/mutex.h     |   3 +
 lib/uklock/include/uk/isr/semaphore.h |   3 +
 lib/ukmpi/include/uk/isr/mbox.h       |   8 +
 9 files changed, 901 insertions(+)
 create mode 100644 lib/isrlib/Config.uk
 create mode 100644 lib/isrlib/Makefile.uk
 create mode 100644 lib/isrlib/include/uk/isr/stdlib.h
 create mode 100644 lib/isrlib/include/uk/isr/string.h
 create mode 100644 lib/isrlib/stdlib.c
 create mode 100644 lib/isrlib/string.c
 create mode 100644 lib/uklock/include/uk/isr/mutex.h
 create mode 100644 lib/uklock/include/uk/isr/semaphore.h
 create mode 100644 lib/ukmpi/include/uk/isr/mbox.h

-- 
2.25.1



From minios-devel-bounces@lists.xenproject.org Thu Jan 28 11:34:59 2021
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Thu, 28 Jan 2021 11:34:59 +0000
Received: from list by lists.xenproject.org with outflank-mailman.76943.139097 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1l55Zj-0003Pu-Hv; Thu, 28 Jan 2021 11:34:59 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 76943.139097; Thu, 28 Jan 2021 11:34: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 1l55Zj-0003Pl-EJ; Thu, 28 Jan 2021 11:34:59 +0000
Received: by outflank-mailman (input) for mailman id 76943;
 Thu, 28 Jan 2021 11:34: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=ZVXE=G7=gmail.com=cristianvijelie@srs-us1.protection.inumbo.net>)
 id 1l55Zi-0003Ol-7X
 for minios-devel@lists.xen.org; Thu, 28 Jan 2021 11:34:58 +0000
Received: from mail-ej1-x636.google.com (unknown [2a00:1450:4864:20::636])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 54eba052-4125-4dac-aab7-f4a55c230d71;
 Thu, 28 Jan 2021 11:34:54 +0000 (UTC)
Received: by mail-ej1-x636.google.com with SMTP id l9so7257860ejx.3
 for <minios-devel@lists.xen.org>; Thu, 28 Jan 2021 03:34:54 -0800 (PST)
Received: from localhost.localdomain (5-13-183-146.residential.rdsnet.ro.
 [5.13.183.146])
 by smtp.gmail.com with ESMTPSA id t11sm2735389edd.1.2021.01.28.03.34.52
 for <minios-devel@lists.xen.org>
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Thu, 28 Jan 2021 03:34: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: 54eba052-4125-4dac-aab7-f4a55c230d71
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20161025;
        h=from:to:subject:date:message-id:in-reply-to:references:mime-version
         :content-transfer-encoding;
        bh=+jua66Hqt59qBAtum4h/aaU2m9kp23zLKrl333dhU0M=;
        b=ncKc+go25Azm7WQgJwvjSBtRQNiZhmRKrKSMI9uDKasWu3I2Lz+YihojtROXJWTBjR
         3hBbb2/PMhf66kfLhxm8FLz/iDElBUvma4qgxEPXmcccOnKaoozcxde79BSIUMDQ8Srg
         R3WiJbbXl8lwJK31CraHzaxr9mMeLcDedOpVkyILGY29qqb/kJlh26DMqrHzHaQXqcNr
         SqXrF5s9eGL9i8+eOSENAEcw94KpdCh+pL+cHYer+F7pKMMBE1BuQWtBu7DaN7ibCtCN
         jB5kZVsL/0fmzNQR+wd4MI4G/Q3fR0pSo0ffsAWAU+gW7AhodUpFNmEUiWZt4Yc2yq8L
         0N3A==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20161025;
        h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to
         :references:mime-version:content-transfer-encoding;
        bh=+jua66Hqt59qBAtum4h/aaU2m9kp23zLKrl333dhU0M=;
        b=O/WqWKLAByjV3IKtQEJjJA+1WtN6B7M6iSQ9BZsOlBL8dTXBVp8f9O7gAiGj/UeCAK
         vQps0oOSE6ykzIMbPPStj1MKnDFIbsy0yNe2mNNV9B3bLDHVXI+zlYhRoLfL94fyWsto
         RxdfXvo3baCyrFEZfA3d5rnoIcdj18YGkgxJ2ivTRnyzIpk76loSRo/QqqRMdhGoEomY
         dqDLTTvdyd43yyMA0S4a/UgtWbBuD5gwvpdS9KoevLyCkHfnEAEuxrlrn9GiO8DnuT07
         ARaCt6quGSHyoV/Wt4AnsuiJ97Fik+TDfCR+e9uybw2i3KbyYVE7bVTl5TJ1FiYpGTCC
         ll8Q==
X-Gm-Message-State: AOAM532kOlAXWNVPt/FMMSlQJLkpY1nACPqDM374F90KS4rGMyP1zMST
	MQSpYWfELNnElASuev7oNegXQ+Gj7rc=
X-Google-Smtp-Source: ABdhPJzq/0UfqdjdTLKMjdzr5QdOp15AIvdM/ZEIA3bjgTDzvlHrcpowz9GIYOoLZe3wMebtdWpSdQ==
X-Received: by 2002:a17:906:1bf2:: with SMTP id t18mr11102659ejg.166.1611833693281;
        Thu, 28 Jan 2021 03:34:53 -0800 (PST)
From: cristian-vijelie <cristianvijelie@gmail.com>
To: minios-devel@lists.xen.org
Subject: [[UNIKRAFT] 2/4] lib/uklock: Provide isr-safe mutex routines
Date: Thu, 28 Jan 2021 13:34:47 +0200
Message-Id: <20210128113449.22457-3-cristianvijelie@gmail.com>
X-Mailer: git-send-email 2.25.1
In-Reply-To: <20210128113449.22457-1-cristianvijelie@gmail.com>
References: <20210128113449.22457-1-cristianvijelie@gmail.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit

This patch provides isr-safe mutex routines, derived from uklock
library.

Signed-off-by: cristian-vijelie <cristianvijelie@gmail.com>
---
 lib/uklock/include/uk/isr/mutex.h | 3 +++
 1 file changed, 3 insertions(+)
 create mode 100644 lib/uklock/include/uk/isr/mutex.h

diff --git a/lib/uklock/include/uk/isr/mutex.h b/lib/uklock/include/uk/isr/mutex.h
new file mode 100644
index 0000000..9d25599
--- /dev/null
+++ b/lib/uklock/include/uk/isr/mutex.h
@@ -0,0 +1,3 @@
+#include <uk/mutex.h>
+
+#define uk_mutex_trylock_isr(x) uk_mutex_trylock(x)
-- 
2.25.1



From minios-devel-bounces@lists.xenproject.org Thu Jan 28 11:35:04 2021
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Thu, 28 Jan 2021 11:35:04 +0000
Received: from list by lists.xenproject.org with outflank-mailman.76944.139101 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1l55Zo-0003Qz-Is; Thu, 28 Jan 2021 11:35:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 76944.139101; Thu, 28 Jan 2021 11:35: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 1l55Zo-0003Qs-Fr; Thu, 28 Jan 2021 11:35:04 +0000
Received: by outflank-mailman (input) for mailman id 76944;
 Thu, 28 Jan 2021 11:35: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=ZVXE=G7=gmail.com=cristianvijelie@srs-us1.protection.inumbo.net>)
 id 1l55Zn-0003Ol-7p
 for minios-devel@lists.xen.org; Thu, 28 Jan 2021 11:35:03 +0000
Received: from mail-ej1-x631.google.com (unknown [2a00:1450:4864:20::631])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id bf8bff98-8e83-459e-81bc-2350a37293be;
 Thu, 28 Jan 2021 11:34:55 +0000 (UTC)
Received: by mail-ej1-x631.google.com with SMTP id ke15so7190489ejc.12
 for <minios-devel@lists.xen.org>; Thu, 28 Jan 2021 03:34:55 -0800 (PST)
Received: from localhost.localdomain (5-13-183-146.residential.rdsnet.ro.
 [5.13.183.146])
 by smtp.gmail.com with ESMTPSA id t11sm2735389edd.1.2021.01.28.03.34.53
 for <minios-devel@lists.xen.org>
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Thu, 28 Jan 2021 03:34: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: bf8bff98-8e83-459e-81bc-2350a37293be
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20161025;
        h=from:to:subject:date:message-id:in-reply-to:references:mime-version
         :content-transfer-encoding;
        bh=D47PxaZc7H/Iz3v+wk5g1U5NEyAZyPal4mL4oIAitMU=;
        b=IIeS3jdc5xHQm1zTee8z4DMkHZm0CYGTPIhx3zdQXUWxfTe3oQAuqbmYZUMnlb5Q68
         E/jceuZHd+WUp6kcKLmZneNNwOS8W6IUZr13zYt1ed+uvgScxsdx5RREfnwQ8Fa4rhqu
         4HwKDsetSfa5Vg06ARfpDoL8tf5n4y2cmADfrqfEXp0dKupcTqdK8cLxfnVGsTLkgYyR
         srkBoUDhmX3YX/28U26IcutMCgWEeTnSUDHyHM9jFNtlbDVnSRgVkr5DFkq6ltcRO4vN
         JmFPi1fVko6bjCmfoiTuKUwjCezma3TxiFuovIzVsbE9j+XeO7IY7eGlNsg2HV2JkCPt
         nwqQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20161025;
        h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to
         :references:mime-version:content-transfer-encoding;
        bh=D47PxaZc7H/Iz3v+wk5g1U5NEyAZyPal4mL4oIAitMU=;
        b=BicE5mIH/wQlG9ZcP9jvN2VvfHKM55jxBj2Yf/g+sA3nWmkaVfF6HNJ5v055jAX1MY
         jv0B93okN6la/sse53oHjjtCdl6DLEo0Xx8xVRI8hiWH7PIbjZbHS1yWzXQmUWgpOxze
         uqQjdKQnBvMosjeO60LiXYCZb5t6VSc4zYMz1VUc15+fszb1SvWO9YeS5JI4AmJFjDWI
         fghyOC68A05pbMpLUn2WN/7rLO7vijge5ZoX/AaKmrQWQLZ/rR2X3HPe6m3ZkdIkUUmH
         jVhI20GajeIVr/+cdE7TMNEhad/VgHfAI3UP76jGreb2YkVGAD2uhwB+l9gpgpE7faDh
         8mtQ==
X-Gm-Message-State: AOAM531W5aqqHmup6j9AO1s+qjnRg1N2Hm6/R43kq+ca8Jmdwt3FRs5d
	atxPvKR70yTDmznNCMBnasOh88hRAas=
X-Google-Smtp-Source: ABdhPJye+sSD4ftsb1XAyc561mp/8Lj8U6lpe89pwMJ97f9ay11cXmKcFduyTqsmLZ6MD2Iz9lgzlg==
X-Received: by 2002:a17:906:d7:: with SMTP id 23mr8285565eji.108.1611833694484;
        Thu, 28 Jan 2021 03:34:54 -0800 (PST)
From: cristian-vijelie <cristianvijelie@gmail.com>
To: minios-devel@lists.xen.org
Subject: [[UNIKRAFT] 3/4] lib/uklock: Provide isr-safe semaphore routines
Date: Thu, 28 Jan 2021 13:34:48 +0200
Message-Id: <20210128113449.22457-4-cristianvijelie@gmail.com>
X-Mailer: git-send-email 2.25.1
In-Reply-To: <20210128113449.22457-1-cristianvijelie@gmail.com>
References: <20210128113449.22457-1-cristianvijelie@gmail.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit

This patch provides isr-safe semaphore routines, derived from uklock
library.

Signed-off-by: cristian-vijelie <cristianvijelie@gmail.com>
---
 lib/uklock/include/uk/isr/semaphore.h | 3 +++
 1 file changed, 3 insertions(+)
 create mode 100644 lib/uklock/include/uk/isr/semaphore.h

diff --git a/lib/uklock/include/uk/isr/semaphore.h b/lib/uklock/include/uk/isr/semaphore.h
new file mode 100644
index 0000000..a0dd7b5
--- /dev/null
+++ b/lib/uklock/include/uk/isr/semaphore.h
@@ -0,0 +1,3 @@
+#include <uk/semaphore.h>
+
+#define uk_semaphore_down_try_isr(x) uk_semaphore_down_try(x)
-- 
2.25.1



From minios-devel-bounces@lists.xenproject.org Thu Jan 28 11:35:09 2021
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Thu, 28 Jan 2021 11:35:09 +0000
Received: from list by lists.xenproject.org with outflank-mailman.76945.139105 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1l55Zt-0003SC-LK; Thu, 28 Jan 2021 11:35:09 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 76945.139105; Thu, 28 Jan 2021 11:35: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 1l55Zt-0003S4-Hg; Thu, 28 Jan 2021 11:35:09 +0000
Received: by outflank-mailman (input) for mailman id 76945;
 Thu, 28 Jan 2021 11:35: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=ZVXE=G7=gmail.com=cristianvijelie@srs-us1.protection.inumbo.net>)
 id 1l55Zs-0003Ol-7u
 for minios-devel@lists.xen.org; Thu, 28 Jan 2021 11:35:08 +0000
Received: from mail-ej1-x630.google.com (unknown [2a00:1450:4864:20::630])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 57802075-86db-4b99-96ac-aed46c0cf189;
 Thu, 28 Jan 2021 11:34:54 +0000 (UTC)
Received: by mail-ej1-x630.google.com with SMTP id bl23so7244310ejb.5
 for <minios-devel@lists.xen.org>; Thu, 28 Jan 2021 03:34:54 -0800 (PST)
Received: from localhost.localdomain (5-13-183-146.residential.rdsnet.ro.
 [5.13.183.146])
 by smtp.gmail.com with ESMTPSA id t11sm2735389edd.1.2021.01.28.03.34.51
 for <minios-devel@lists.xen.org>
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Thu, 28 Jan 2021 03:34: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: 57802075-86db-4b99-96ac-aed46c0cf189
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20161025;
        h=from:to:subject:date:message-id:in-reply-to:references:mime-version
         :content-transfer-encoding;
        bh=IFrR32iewDZXGRzkNwnPnBOD5rS6SMSTHrT/H+dGHD0=;
        b=HPhwhnwQGt9mhknDRlzo73M95KVu6oxWlXehHu0jvuawt39SLY9LOFkYBnU+AuXS96
         ubywpYxCTBp4xv0U4pQBYtHAvO8mYPzfw5qaUQOvK6xvv9HTqpmCPikAqt0rbmHcY4OS
         OUTzLMgIATugoRwrfpIgJgOh3IjyXVJugzb84q7Oqm9HwJj9KBU/KfggVQxHpUGFPZl0
         4GDz/CAPCrj4HUTi2LpSfUJQamcOHHgSEUXNevgXCm06XZje92dgjoHwxIOudQta3NK1
         Br46V8B2BgFZ05CbccMMNZlFRuljIz+jz59n7lDCuU5qT+0AEp1ceUgBrM/M6nVXLGEl
         FwRQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20161025;
        h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to
         :references:mime-version:content-transfer-encoding;
        bh=IFrR32iewDZXGRzkNwnPnBOD5rS6SMSTHrT/H+dGHD0=;
        b=GPPvQXUSkRxcnmC42Lwn1YQP3iYFamA803XSQs3Huy+gNq9wPvQJxJN7tvIgrkLgo+
         6RUVo0hJttT6r0rrXMpKvxpaqLZk71HsYC5qgLuBfqcJn1zlAmKu//tegyDPY6kjIWqF
         lnUryFQS2oy48/mWQ1NSTlBo62MBQQjQcnc2/X8q0dtCVl3DsHxKdF4i1k2AaO8BwhXj
         VXxm0yrBMnH6kx4W7bu4wLOcjz81Av/M2ccgZzHr7kf5XWGEB8jrU34oraebgQWueB4M
         +39re8fAJddjAIQQClH8yqcH7QRg7LKzzCwpgKIPHQV1uXWeMEHbgkoOQDlG8iDHK93s
         huWQ==
X-Gm-Message-State: AOAM5339af8n2hYsJKzhl6BVuOl18+t5h87fjK8pmR3es0Cwe0onCiXt
	44qx5etdU4n476IwXIGOuNcVzmQHNwk=
X-Google-Smtp-Source: ABdhPJyhisGb00GTQc9dYxQ46SPbxA48+H/9yRHRlL35/jWCaoEBay/HJC7p7IE7AOpiADJp4+Q2Ng==
X-Received: by 2002:a17:906:653:: with SMTP id t19mr10670433ejb.44.1611833692350;
        Thu, 28 Jan 2021 03:34:52 -0800 (PST)
From: cristian-vijelie <cristianvijelie@gmail.com>
To: minios-devel@lists.xen.org
Subject: [[UNIKRAFT] 1/4] lib/isrlib: Introduce libc-like interrupt-context-safe routines
Date: Thu, 28 Jan 2021 13:34:46 +0200
Message-Id: <20210128113449.22457-2-cristianvijelie@gmail.com>
X-Mailer: git-send-email 2.25.1
In-Reply-To: <20210128113449.22457-1-cristianvijelie@gmail.com>
References: <20210128113449.22457-1-cristianvijelie@gmail.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit

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>
---
 lib/isrlib/Config.uk               |   3 +
 lib/isrlib/Makefile.uk             |  10 +
 lib/isrlib/include/uk/isr/stdlib.h |  60 +++++
 lib/isrlib/include/uk/isr/string.h |  72 +++++
 lib/isrlib/stdlib.c                | 417 +++++++++++++++++++++++++++++
 lib/isrlib/string.c                | 325 ++++++++++++++++++++++
 6 files changed, 887 insertions(+)
 create mode 100644 lib/isrlib/Config.uk
 create mode 100644 lib/isrlib/Makefile.uk
 create mode 100644 lib/isrlib/include/uk/isr/stdlib.h
 create mode 100644 lib/isrlib/include/uk/isr/string.h
 create mode 100644 lib/isrlib/stdlib.c
 create mode 100644 lib/isrlib/string.c

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



From minios-devel-bounces@lists.xenproject.org Thu Jan 28 11:35:14 2021
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Thu, 28 Jan 2021 11:35:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.76946.139108 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1l55Zy-0003TQ-Nf; Thu, 28 Jan 2021 11:35:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 76946.139108; Thu, 28 Jan 2021 11:35: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 1l55Zy-0003TJ-KU; Thu, 28 Jan 2021 11:35:14 +0000
Received: by outflank-mailman (input) for mailman id 76946;
 Thu, 28 Jan 2021 11:35: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=ZVXE=G7=gmail.com=cristianvijelie@srs-us1.protection.inumbo.net>)
 id 1l55Zx-0003Ol-82
 for minios-devel@lists.xen.org; Thu, 28 Jan 2021 11:35:13 +0000
Received: from mail-ej1-x633.google.com (unknown [2a00:1450:4864:20::633])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 91dd1633-f795-461f-9395-5b9da8dddb85;
 Thu, 28 Jan 2021 11:34:56 +0000 (UTC)
Received: by mail-ej1-x633.google.com with SMTP id by1so7288322ejc.0
 for <minios-devel@lists.xen.org>; Thu, 28 Jan 2021 03:34:56 -0800 (PST)
Received: from localhost.localdomain (5-13-183-146.residential.rdsnet.ro.
 [5.13.183.146])
 by smtp.gmail.com with ESMTPSA id t11sm2735389edd.1.2021.01.28.03.34.54
 for <minios-devel@lists.xen.org>
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Thu, 28 Jan 2021 03:34: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: 91dd1633-f795-461f-9395-5b9da8dddb85
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20161025;
        h=from:to:subject:date:message-id:in-reply-to:references:mime-version
         :content-transfer-encoding;
        bh=Gtb/qv1jjVx4QchuT2E6Hdrbpo2yAbwbcyWN8rwZqME=;
        b=tMf59jGRIMEeD6vNazEPTN08YYq0jqMv5nK18oouelc0M2F3S4J8P4AGO4NfPxOmrX
         5R5uCu3pqUapyWiK7XU2HbupERKVUptg9Qbf99yAh1OoI8jSJArAdNJSogLCS65E60Uw
         B7x7NqoY+j9khma2Os243SKCA2u3xiQ4Q3GL6kvvSxxiDi+x3Aed4VGpLei6ViT+eX4H
         hoHo44AZZOF6hAzMDXICaOvpPl3kdRPEA8/FxYh1yGT3o/5LbajppvPRPNdaiwDyR0QQ
         DvsViKGJMRrvYP0PkVdepsL5wInpHWVwq0WrkphCfGo6Iz7WllmNZlxmMKqO6Q8D+1Fu
         szPQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20161025;
        h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to
         :references:mime-version:content-transfer-encoding;
        bh=Gtb/qv1jjVx4QchuT2E6Hdrbpo2yAbwbcyWN8rwZqME=;
        b=Z8BuAjz/3Q9LKdH9OIqSd7eju4V4XGAItk11J2FlYW0FQACddIgcvqQ6I7+R5xGMi1
         Je9hrkZmV3mJjmxpT10SFC4zUA3ruTiQ8h0mS+1d74MOprzA4EksBxR+CPPx2TLuCTYD
         DZU04IpuNTsdMbysy/GO0NGh6w/uawjME1rBfUovCruY6jeLUupIYmhpRNUiAjdABioW
         Ft1eTStW5xuzbeKPB+/7pSaxhqFc/tWBgGyq56jbntcdzv61c8Fl+F6iRPdbam5VSKFU
         T6IZH6nyrUkhiDOLCr7EzspyILuDzAeHcxufUugfEuh4A/psFq0YCOi16D6HvR+W7/08
         kRYA==
X-Gm-Message-State: AOAM530YV7w/gHa8tPOb1SsRmj/uK+/p48NPXHVBexFWdwht8mCVB8E3
	BeLo/VwDf8jHQgvMLmdWYXjn6OsDB4M=
X-Google-Smtp-Source: ABdhPJyRFd3mxCrVUplrFn/GmqzOxPI+Ip0y4HboD/ysX1KfH3uUtjWfC3iFnk/yOa2cWDJ/xsZBuw==
X-Received: by 2002:a17:906:c410:: with SMTP id u16mr10259842ejz.159.1611833695580;
        Thu, 28 Jan 2021 03:34:55 -0800 (PST)
From: cristian-vijelie <cristianvijelie@gmail.com>
To: minios-devel@lists.xen.org
Subject: [[UNIKRAFT] 4/4] lib/ukmpi: Provide isr-safe routines
Date: Thu, 28 Jan 2021 13:34:49 +0200
Message-Id: <20210128113449.22457-5-cristianvijelie@gmail.com>
X-Mailer: git-send-email 2.25.1
In-Reply-To: <20210128113449.22457-1-cristianvijelie@gmail.com>
References: <20210128113449.22457-1-cristianvijelie@gmail.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit

This patch provides isr-safe mbox routines, derived from ukmpi
library.

Signed-off-by: cristian-vijelie <cristianvijelie@gmail.com>
---
 lib/ukmpi/include/uk/isr/mbox.h | 8 ++++++++
 1 file changed, 8 insertions(+)
 create mode 100644 lib/ukmpi/include/uk/isr/mbox.h

diff --git a/lib/ukmpi/include/uk/isr/mbox.h b/lib/ukmpi/include/uk/isr/mbox.h
new file mode 100644
index 0000000..78e738c
--- /dev/null
+++ b/lib/ukmpi/include/uk/isr/mbox.h
@@ -0,0 +1,8 @@
+#include <uk/mbox.h>
+
+#if CONFIG_LIBUKMPI_MBOX
+
+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 */
-- 
2.25.1



From minios-devel-bounces@lists.xenproject.org Thu Jan 28 17:06:58 2021
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Thu, 28 Jan 2021 17:06:58 +0000
Received: from list by lists.xenproject.org with outflank-mailman.77281.139865 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1l5Aky-0000W4-7R; Thu, 28 Jan 2021 17:06:56 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 77281.139865; Thu, 28 Jan 2021 17:06: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 1l5Aky-0000Vx-4P; Thu, 28 Jan 2021 17:06:56 +0000
Received: by outflank-mailman (input) for mailman id 77281;
 Thu, 28 Jan 2021 17:06: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=ZVXE=G7=gmail.com=cristianvijelie@srs-us1.protection.inumbo.net>)
 id 1l5Akw-0000Vs-Hr
 for minios-devel@lists.xen.org; Thu, 28 Jan 2021 17:06:54 +0000
Received: from mail-ej1-x62c.google.com (unknown [2a00:1450:4864:20::62c])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 1362cc53-8ef9-4b6c-bbf2-5e36d78c083d;
 Thu, 28 Jan 2021 17:06:53 +0000 (UTC)
Received: by mail-ej1-x62c.google.com with SMTP id ox12so8900026ejb.2
 for <minios-devel@lists.xen.org>; Thu, 28 Jan 2021 09:06:53 -0800 (PST)
Received: from localhost.localdomain (5-13-183-146.residential.rdsnet.ro.
 [5.13.183.146])
 by smtp.gmail.com with ESMTPSA id c18sm3248673edu.20.2021.01.28.09.06.51
 for <minios-devel@lists.xen.org>
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Thu, 28 Jan 2021 09:06: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: 1362cc53-8ef9-4b6c-bbf2-5e36d78c083d
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20161025;
        h=from:to:subject:date:message-id:mime-version
         :content-transfer-encoding;
        bh=DLvo6k12g+zwI5Hf+9VoJU3vQYbGGIjNb31GZpzfozk=;
        b=Q6qN2OpU65SsfIA9G1UNHzbB5FM6SqiYwkoeb11hnPXaQu72YTbVuIrVCgscZFFepm
         KmlDlp2XaOw646K8dI3XCBOo6WkWUEeLsUQGtvOn3fRZZRXA3MgPM4b0KR8CDg35/VVh
         NoUze/wqmS3hHjSCLhwcVPFNTePmS+ImCW7Q12BLyTSYAXVfAcD7ORWi6PIVPDBKOkXG
         XIxWLiTOtNn2XE///XMCZShT2nu8tcMvh/ESqPeZ4F/5dY2GTEaockD1zrqjozI6AmdW
         rRC5aKOiUvuY/CUP4pj7UrVhHujUdiN22fPq270GFCVZiwWfC/b3NZk5VHrzdmg/s8/y
         M5Iw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20161025;
        h=x-gm-message-state:from:to:subject:date:message-id:mime-version
         :content-transfer-encoding;
        bh=DLvo6k12g+zwI5Hf+9VoJU3vQYbGGIjNb31GZpzfozk=;
        b=iARwWTMFLPuvkEPm24uWjk+GwDPGXWtr1csXa6SMlVd3xrwdJj/Lu9eE8VbNj2cwwP
         qnzLc9n0IrECnc43j42qLPZkZfxSQQADtxCr2LMfJXb5OuN/jEyepMT3vmPYNSukMOz/
         1ga8eNwNkO1bMN1inCs+Jv6VZ7DEaT8s/4NE29LaakQJs7tVAHeenUxMXfHXaD9NL839
         VXEHHa8H+s0/bZq9dg/uMEAOKbQzd1c3H9CwFr+ca1K7oNms1KMVl2HbnLMieNGXorBd
         yLhRKO+VRhib905mtmr98I5jXp+TUD4+1x5Cv7/8HfP1t5bsp3fKkVYMiomD2vMSzkCj
         XTvw==
X-Gm-Message-State: AOAM5326/78Da+Nd5TnlmPIfzbYPZe7VkNZQLk+6f/Qc+zfgge045Faw
	rjNjRtct8AaF15PbC78G7gSXcuU9Py0=
X-Google-Smtp-Source: ABdhPJweGAarSe3oOougMJW+Fp1gw9Oj00KZvCPhk+Op0KgCa0TyrOlwGewcmqf3RUgAxjeaCNZlng==
X-Received: by 2002:a17:906:934c:: with SMTP id p12mr318158ejw.269.1611853612414;
        Thu, 28 Jan 2021 09:06:52 -0800 (PST)
From: cristian-vijelie <cristianvijelie@gmail.com>
To: minios-devel@lists.xen.org
Subject: [[UNIKRAFT/LIBNETTLE] v3 0/3] Porting of libnettle to UNIKRAFT
Date: Thu, 28 Jan 2021 19:06:47 +0200
Message-Id: <20210128170650.76513-1-cristianvijelie@gmail.com>
X-Mailer: git-send-email 2.25.1
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit

These patches port the cryptographic library libnettle to Unikraft

cristian-vijelie (3):
  Introducing the library skeleton
  Adding Makefile.uk
  Adding the patches

 .gitignore                                 |   0
 CODING_STYLE.md                            |   4 +
 CONTRIBUTING.md                            |   4 +
 COPYING.md                                 |  37 +
 Config.uk                                  |  17 +
 MAINTAINERS.md                             |  10 +
 Makefile.uk                                | 435 +++++++++++
 README.md                                  |  10 +
 patches/0001-Made-the-tests-runnable.patch | 838 +++++++++++++++++++++
 9 files changed, 1355 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 patches/0001-Made-the-tests-runnable.patch

-- 
2.25.1



From minios-devel-bounces@lists.xenproject.org Thu Jan 28 17:07:01 2021
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Thu, 28 Jan 2021 17:07:01 +0000
Received: from list by lists.xenproject.org with outflank-mailman.77282.139870 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1l5Al3-0000Wp-9q; Thu, 28 Jan 2021 17:07:01 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 77282.139870; Thu, 28 Jan 2021 17:07:01 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1l5Al3-0000Wi-66; Thu, 28 Jan 2021 17:07:01 +0000
Received: by outflank-mailman (input) for mailman id 77282;
 Thu, 28 Jan 2021 17:06: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=ZVXE=G7=gmail.com=cristianvijelie@srs-us1.protection.inumbo.net>)
 id 1l5Al1-0000Vs-9I
 for minios-devel@lists.xen.org; Thu, 28 Jan 2021 17:06:59 +0000
Received: from mail-ej1-x62e.google.com (unknown [2a00:1450:4864:20::62e])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 206cf569-443d-4a7f-bb1d-023b9d489d81;
 Thu, 28 Jan 2021 17:06:54 +0000 (UTC)
Received: by mail-ej1-x62e.google.com with SMTP id ke15so8815332ejc.12
 for <minios-devel@lists.xen.org>; Thu, 28 Jan 2021 09:06:54 -0800 (PST)
Received: from localhost.localdomain (5-13-183-146.residential.rdsnet.ro.
 [5.13.183.146])
 by smtp.gmail.com with ESMTPSA id c18sm3248673edu.20.2021.01.28.09.06.52
 for <minios-devel@lists.xen.org>
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Thu, 28 Jan 2021 09:06: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: 206cf569-443d-4a7f-bb1d-023b9d489d81
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20161025;
        h=from:to:subject:date:message-id:in-reply-to:references:mime-version
         :content-transfer-encoding;
        bh=TC+uGJdSxxoIN6rDRzBqK1jMQ41p9zW4sBcqr+Aczy4=;
        b=GQRJDzMJZyq0MHfpPdkVb6ABaXAX40/OhJjd4VSs7Vo7TCK/0tpi4No3acEwZ33Lka
         QDwHr4Rkp0mLmxL00/5Ty/x10LmVCW3/zQHz8MoUDjZNLP9GvBXYJOOABsH1Ryv+BqAs
         v9qoHT5cM7a6kgPGJlz63yPByRpW54zG3TLJK2PkgtK9qmr3U10OXiPBhySdTmOQAOsA
         22f1RG0XI1D+iA/MZL2zjiZrsT9evs+nTsWlfWwpIqgx5uWqtoyfMDJuTnTUAa/N+1/T
         CzRjiQpgHC4QQUINwl/6bmX2YfHH3hC1dN/+Gysh1c1ewxvxwIiLRrvhznxO3V2g/9nG
         Wa+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:subject:date:message-id:in-reply-to
         :references:mime-version:content-transfer-encoding;
        bh=TC+uGJdSxxoIN6rDRzBqK1jMQ41p9zW4sBcqr+Aczy4=;
        b=NO80mpbEAU/5UKtCbHfazq9/MKzjK1k/bdLVe/5DFHGFTiOVpKcyz/9VGwqSRgJrNt
         rohIUy+iiSZ/aK1Miq97SumjfpBgHRpX0QWD2axIxse7XDDt4tJ86sX+/gkd/DrnDO3+
         Nvaxx1UbGZGr4o1LZzPb5+0fyauvydfpgsH7u/3DWW1CKLdS/ZJ6N9+gj/Bf2lHIsPXa
         lmpmGMJnrIAZuceACK9WyP8gmW59IwcMXJx9IEVl3r2XLwgN15JnCosgq/bqtofViIRq
         TcAX1OOpPs1+8nnUiVKdOD4bBk3upEtZcPhrCz/whuCNOnE3TYG+ySbZ1VYsWVH9E0Z4
         o/Lg==
X-Gm-Message-State: AOAM531uMl0r6gHI1md8Kgazl+N0xOSNRXtKylIiEdMt8xMJZWDDL/4A
	91oBqMC4bNxCkLR2YNuKeIcnqFEZcdw=
X-Google-Smtp-Source: ABdhPJxTUaPZQHUSR90w96wKWatH68kBkgEGlc9FL+eH27MgklKgxw9toeVETEgEEWu91objyr2wHw==
X-Received: by 2002:a17:906:4451:: with SMTP id i17mr340648ejp.436.1611853613614;
        Thu, 28 Jan 2021 09:06:53 -0800 (PST)
From: cristian-vijelie <cristianvijelie@gmail.com>
To: minios-devel@lists.xen.org
Subject: [[UNIKRAFT/LIBNETTLE] v3 1/3] Introducing the library skeleton
Date: Thu, 28 Jan 2021 19:06:48 +0200
Message-Id: <20210128170650.76513-2-cristianvijelie@gmail.com>
X-Mailer: git-send-email 2.25.1
In-Reply-To: <20210128170650.76513-1-cristianvijelie@gmail.com>
References: <20210128170650.76513-1-cristianvijelie@gmail.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit

Signed-off-by: cristian-vijelie <cristianvijelie@gmail.com>
---
 .gitignore      |  0
 CODING_STYLE.md |  4 ++++
 CONTRIBUTING.md |  4 ++++
 COPYING.md      | 37 +++++++++++++++++++++++++++++++++++++
 Config.uk       | 17 +++++++++++++++++
 MAINTAINERS.md  | 10 ++++++++++
 README.md       | 10 ++++++++++
 7 files changed, 82 insertions(+)
 create mode 100644 .gitignore
 create mode 100644 CODING_STYLE.md
 create mode 100644 CONTRIBUTING.md
 create mode 100644 COPYING.md
 create mode 100644 Config.uk
 create mode 100644 MAINTAINERS.md
 create mode 100644 README.md

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



From minios-devel-bounces@lists.xenproject.org Thu Jan 28 17:07:06 2021
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Thu, 28 Jan 2021 17:07:06 +0000
Received: from list by lists.xenproject.org with outflank-mailman.77283.139873 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1l5Al8-0000Xq-BE; Thu, 28 Jan 2021 17:07:06 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 77283.139873; Thu, 28 Jan 2021 17:07: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 1l5Al8-0000Xj-8A; Thu, 28 Jan 2021 17:07:06 +0000
Received: by outflank-mailman (input) for mailman id 77283;
 Thu, 28 Jan 2021 17:07: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=ZVXE=G7=gmail.com=cristianvijelie@srs-us1.protection.inumbo.net>)
 id 1l5Al6-0000Vs-9M
 for minios-devel@lists.xen.org; Thu, 28 Jan 2021 17:07:04 +0000
Received: from mail-ed1-x535.google.com (unknown [2a00:1450:4864:20::535])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 29ac83ff-fc28-466b-b3d0-eca6222c96a1;
 Thu, 28 Jan 2021 17:06:56 +0000 (UTC)
Received: by mail-ed1-x535.google.com with SMTP id d22so7474578edy.1
 for <minios-devel@lists.xen.org>; Thu, 28 Jan 2021 09:06:56 -0800 (PST)
Received: from localhost.localdomain (5-13-183-146.residential.rdsnet.ro.
 [5.13.183.146])
 by smtp.gmail.com with ESMTPSA id c18sm3248673edu.20.2021.01.28.09.06.53
 for <minios-devel@lists.xen.org>
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Thu, 28 Jan 2021 09:06: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: 29ac83ff-fc28-466b-b3d0-eca6222c96a1
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20161025;
        h=from:to:subject:date:message-id:in-reply-to:references:mime-version
         :content-transfer-encoding;
        bh=mRT/d4RHAoBcDGM3U73zaK7Xylvrfs2BgnKsvJtjsWM=;
        b=kJEc9OBMhqEvmMoYjFjXJARnbhpERiCNsXXQdyF5e9NfyJYgTF9bol1/TrXh4cRAy4
         aMW0tUzcilHseHCsV3S0Hkq8/UqleJhPT7PsCf9IqU0LFV2HIkcrYUyzyJlePy5bf1xc
         +FRcZ9HEGd4HfdX3QmZAnLZxB0VLIXdPWmNExA3Pu8N/vOv6pdNzBBzKohdjVzzaV1I2
         mmmhlvGLGQumrQcHpBac0c72TvVR+Wod7anbFsGUULVvjQZ4Demygmd8fRY3B0vSGfzc
         YTsF6WQvBLDdVrbVT7ug9f3dm9hvMCPG/aJWojvQLXldMYxSoHKjCpWNsqQGAflaBYjv
         R8xA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20161025;
        h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to
         :references:mime-version:content-transfer-encoding;
        bh=mRT/d4RHAoBcDGM3U73zaK7Xylvrfs2BgnKsvJtjsWM=;
        b=P9oUd0ypcMkkrnyJhR/3l/RDSlbp5+6EkbhjNsYm0EEHEfHXqouvarRydRHXiNPv6y
         KCmtvvPi8BHhXepQxKfbKXtvH6JNBqbZdvMyAHlm2IIEWU2Ax6Ghrrbx2QVn6qg8AQe8
         CozJSqweO1DQrCSDH3ZxwprsZ7kz+PUpl+Ful8NWz7zUwJy/HCLDnUUSFFMfQU2nFdOQ
         XuNfjL3zTHbahvRhRYykHDzMvZa0ZZsjDEzSWSp6nyYnoIURBtsEp2VAASFcraIyzkmZ
         BhEzv7DvZdv7f+Yu2NjfzWGa42wCqeiHdsKvMbFR1pi+HW2z/Y9Js6PjKu0ydjgC1XL7
         QYDg==
X-Gm-Message-State: AOAM531RCOGF5BAtLagMDwae0cPfPnZ61IN7ksww+PKf1mJabOPezrBP
	sgzfKhavh874WsMaxW6g0NQqLPKiWeg=
X-Google-Smtp-Source: ABdhPJzZ/hVIRjBoUhRf/ieeEQuXQur/odVQ8CREadzq6z+blg0H+E1XMLLw7BG3YaaJUwqXP0Dudw==
X-Received: by 2002:aa7:d649:: with SMTP id v9mr495796edr.383.1611853614700;
        Thu, 28 Jan 2021 09:06:54 -0800 (PST)
From: cristian-vijelie <cristianvijelie@gmail.com>
To: minios-devel@lists.xen.org
Subject: [[UNIKRAFT/LIBNETTLE] v3 2/3] Adding Makefile.uk
Date: Thu, 28 Jan 2021 19:06:49 +0200
Message-Id: <20210128170650.76513-3-cristianvijelie@gmail.com>
X-Mailer: git-send-email 2.25.1
In-Reply-To: <20210128170650.76513-1-cristianvijelie@gmail.com>
References: <20210128170650.76513-1-cristianvijelie@gmail.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit

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

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



From minios-devel-bounces@lists.xenproject.org Thu Jan 28 17:07:11 2021
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Thu, 28 Jan 2021 17:07:11 +0000
Received: from list by lists.xenproject.org with outflank-mailman.77284.139878 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1l5AlD-0000Z4-E2; Thu, 28 Jan 2021 17:07:11 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 77284.139878; Thu, 28 Jan 2021 17:07: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 1l5AlD-0000Yx-Am; Thu, 28 Jan 2021 17:07:11 +0000
Received: by outflank-mailman (input) for mailman id 77284;
 Thu, 28 Jan 2021 17:07: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=ZVXE=G7=gmail.com=cristianvijelie@srs-us1.protection.inumbo.net>)
 id 1l5AlB-0000Vs-9V
 for minios-devel@lists.xen.org; Thu, 28 Jan 2021 17:07: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 089ea07f-26b1-4b7c-8ed9-bea4ec557f72;
 Thu, 28 Jan 2021 17:06:57 +0000 (UTC)
Received: by mail-ej1-x62a.google.com with SMTP id hs11so8889285ejc.1
 for <minios-devel@lists.xen.org>; Thu, 28 Jan 2021 09:06:57 -0800 (PST)
Received: from localhost.localdomain (5-13-183-146.residential.rdsnet.ro.
 [5.13.183.146])
 by smtp.gmail.com with ESMTPSA id c18sm3248673edu.20.2021.01.28.09.06.54
 for <minios-devel@lists.xen.org>
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Thu, 28 Jan 2021 09:06: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: 089ea07f-26b1-4b7c-8ed9-bea4ec557f72
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20161025;
        h=from:to:subject:date:message-id:in-reply-to:references:mime-version
         :content-transfer-encoding;
        bh=BUvtv7Gs9KhVWDZTybeOplrLazD3SrcIykzg/SFnN60=;
        b=Sr6i5hKuUWGHJG4EcAt+YjRNNg1Rd+dbD8kllZWi/Y3wyPeNLO4SLpuZohDQwjk3m9
         WJvcnBODjhCuaLujjyDfPh2mydw6ysqXvE+riUinNluxxDiYsxXHOc9WwDZaBaGONWkw
         pStliN7IhL0Jz6OmDkDYjVH5F6ygNK7wUw4O4om+7fmAFBGi2O+xz3yAdD5Lu34aj3im
         DxjAOJfRI4hHKVUIH/sraDK4+pAdzlnxD16tx+Op6Puc/G1o6EMvb8u/JmddNntiqW6+
         5/AUZWXmao4EM1OMnON3Ns1rTLp8RITDGNOGOquAPAOmLYigJ60IB5gFfN+yTP4eZw6X
         Txgw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20161025;
        h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to
         :references:mime-version:content-transfer-encoding;
        bh=BUvtv7Gs9KhVWDZTybeOplrLazD3SrcIykzg/SFnN60=;
        b=FgSq21EXkgagqgK8J5eXx5TCkqpIMPINq9277ke2eqXEb2cM2dUaXt1IgiXPM4M1fm
         bP5S53BKmc3JJRKhoOzh7Y5wkjwsMEbM7I3lDKoc0bD2R4w7oeB7qgBwNdcVSBLF7l1s
         364aESn3m5/namX1q/8haUck7dWuthS0POqys70u/pjlNZq9bXW7vC1dZpKwwZrkPLzo
         2xj/r1Dp5B/pSzoZW6/0z99zrwBevLM2v2Wo+Gk9lU7qhz7az/aM/Xrf9vp7x5rfwywb
         2PLfJqXmHeBMKsqg9BDD+0f1qa83dUTaa6+XyCkFH8p6pSGHbJk7pWA1bONzk/iBZChR
         YnRg==
X-Gm-Message-State: AOAM531EyNTS25Ip9Qf6aHu6TB1lf3HvH+Mjyd9IqSC0f8vnqOIdAa55
	wJv6SdjC2RWCNEx0GimXQHg+On4ZB3M=
X-Google-Smtp-Source: ABdhPJzo5x4t0VPwY0zEPsF/Qq9jmYJkmUUlP2w5XqCxe03rsVIPkdZn5H4pKnl0m2/Ujw+bCWW4JQ==
X-Received: by 2002:a17:906:4d08:: with SMTP id r8mr341437eju.191.1611853615774;
        Thu, 28 Jan 2021 09:06:55 -0800 (PST)
From: cristian-vijelie <cristianvijelie@gmail.com>
To: minios-devel@lists.xen.org
Subject: [[UNIKRAFT/LIBNETTLE] v3 3/3] Adding the patches
Date: Thu, 28 Jan 2021 19:06:50 +0200
Message-Id: <20210128170650.76513-4-cristianvijelie@gmail.com>
X-Mailer: git-send-email 2.25.1
In-Reply-To: <20210128170650.76513-1-cristianvijelie@gmail.com>
References: <20210128170650.76513-1-cristianvijelie@gmail.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit

The patch is required to be able to run the test suite.

Signed-off-by: cristian-vijelie <cristianvijelie@gmail.com>
---
 patches/0001-Made-the-tests-runnable.patch | 838 +++++++++++++++++++++
 1 file changed, 838 insertions(+)
 create mode 100644 patches/0001-Made-the-tests-runnable.patch

diff --git a/patches/0001-Made-the-tests-runnable.patch b/patches/0001-Made-the-tests-runnable.patch
new file mode 100644
index 0000000..463d0c8
--- /dev/null
+++ b/patches/0001-Made-the-tests-runnable.patch
@@ -0,0 +1,838 @@
+From fb889864b018eb3ceae9dad5328984367dcb3ef3 Mon Sep 17 00:00:00 2001
+From: cristian-vijelie <cristianvijelie@gmail.com>
+Date: Fri, 4 Dec 2020 14:09:40 +0200
+Subject: [PATCH] Made the tests runnable
+
+The test suite provided for libnettle has a test_main() function for each of
+the test files, that is used in testsuite.c, which contains the main function
+of the test suite. So, for each test, a new executable is built. This cannot
+happen in unikraft.
+
+This patch removes the main() function from testutils.c and renames each
+test_main() function from the test sources, so they all have different names.
+This way is possible to call all the functions from the testing app.
+
+Signed-off-by: Cristian Vijelie <cristianvijelie@gmail.com>
+---
+ aes-test.c    |  2 +-
+ arcfour-test.c       |  2 +-
+ arctwo-test.c |  2 +-
+ base16-test.c |  2 +-
+ base64-test.c |  2 +-
+ blowfish-test.c      |  2 +-
+ camellia-test.c      |  2 +-
+ cbc-test.c    |  2 +-
+ ccm-test.c    |  2 +-
+ cfb-test.c    |  2 +-
+ chacha-poly1305-test.c          |  2 +-
+ chacha-test.c |  2 +-
+ cmac-test.c   |  2 +-
+ ctr-test.c    |  2 +-
+ des-test.c    |  2 +-
+ des3-test.c   |  2 +-
+ eax-test.c    |  2 +-
+ gcm-test.c    |  2 +-
+ gosthash94-test.c    |  2 +-
+ hkdf-test.c   |  2 +-
+ hmac-test.c   |  2 +-
+ knuth-lfib-test.c    |  2 +-
+ md2-test.c    |  2 +-
+ md4-test.c    |  2 +-
+ md5-compat-test.c    |  2 +-
+ md5-test.c    |  2 +-
+ meta-aead-test.c     |  2 +-
+ meta-armor-test.c    |  2 +-
+ meta-cipher-test.c   |  2 +-
+ meta-hash-test.c     |  2 +-
+ meta-mac-test.c      |  2 +-
+ pbkdf2-test.c |  2 +-
+ poly1305-test.c      |  2 +-
+ ripemd160-test.c     |  2 +-
+ salsa20-test.c       |  2 +-
+ serpent-test.c       |  2 +-
+ sha1-huge-test.c     |  2 +-
+ sha1-test.c   |  2 +-
+ sha224-test.c |  2 +-
+ sha256-test.c |  2 +-
+ sha3-224-test.c      |  2 +-
+ sha3-256-test.c      |  2 +-
+ sha3-384-test.c      |  2 +-
+ sha3-512-test.c      |  2 +-
+ sha3-permute-test.c  |  2 +-
+ sha384-test.c |  2 +-
+ sha512-224-test.c    |  2 +-
+ sha512-256-test.c    |  2 +-
+ sha512-test.c |  2 +-
+ shake256-test.c      |  2 +-
+ testutils.c   | 21 -------------------
+ twofish-test.c       |  2 +-
+ umac-test.c   |  2 +-
+ xts-test.c    |  2 +-
+ yarrow-test.c |  2 +-
+ buffer-test.c  | 2 +-
+ cast128-test.c | 2 +-
+ 57 files changed, 56 insertions(+), 77 deletions(-)
+
+diff --git a/aes-test.c b/aes-test.c
+index 078bd67..3cd0140 100644
+--- a/aes-test.c
++++ b/aes-test.c
+@@ -116,7 +116,7 @@ test_cipher2(const struct nettle_cipher *c1,
+ }
+ 
+ void
+-test_main(void)
++test_main_aes(void)
+ {
+   /* Test both the new interface and the older unified interface. */
+ 
+diff --git a/arcfour-test.c b/arcfour-test.c
+index b2b039b..bfea126 100644
+--- a/arcfour-test.c
++++ b/arcfour-test.c
+@@ -68,7 +68,7 @@ test_arcfour(const struct tstring *key,
+ }
+ 
+ void
+-test_main(void)
++test_main_arcfour(void)
+ {
+   test_arcfour(SHEX("01234567 89ABCDEF 00000000 00000000"),
+ 	       SHEX("01234567 89ABCDEF"),
+diff --git a/arctwo-test.c b/arctwo-test.c
+index d91d522..78a8235 100644
+--- a/arctwo-test.c
++++ b/arctwo-test.c
+@@ -62,7 +62,7 @@ test_arctwo(unsigned ekb,
+ }
+ 
+ void
+-test_main(void)
++test_main_arctwo(void)
+ {
+   /* Test vectors from Peter Gutmann's paper. */
+   test_cipher(&nettle_arctwo_gutmann128,
+diff --git a/base16-test.c b/base16-test.c
+index 820915b..305b123 100644
+--- a/base16-test.c
++++ b/base16-test.c
+@@ -2,7 +2,7 @@
+ #include "base16.h"
+ 
+ void
+-test_main(void)
++test_main_base16(void)
+ {
+   ASSERT(BASE16_ENCODE_LENGTH(0) == 0);
+   ASSERT(BASE16_ENCODE_LENGTH(1) == 2);
+diff --git a/base64-test.c b/base64-test.c
+index cc45c47..3522277 100644
+--- a/base64-test.c
++++ b/base64-test.c
+@@ -81,7 +81,7 @@ base64_decode_in_place (struct base64_decode_ctx *ctx, size_t *dst_length,
+ }
+ 
+ void
+-test_main(void)
++test_main_base64(void)
+ {
+   ASSERT(BASE64_ENCODE_LENGTH(0) == 0);   /* At most   4 bits */
+   ASSERT(BASE64_ENCODE_LENGTH(1) == 2);   /* At most  12 bits */
+diff --git a/blowfish-test.c b/blowfish-test.c
+index cadeda5..eeb91e5 100644
+--- a/blowfish-test.c
++++ b/blowfish-test.c
+@@ -46,7 +46,7 @@ test_blowfish(const struct tstring *key,
+ }
+ 
+ void
+-test_main(void)
++test_main_blowfish(void)
+ {
+   /* 208 bit key. Test from GNUPG. */
+   test_blowfish(SDATA("abcdefghijklmnopqrstuvwxyz"),
+diff --git a/camellia-test.c b/camellia-test.c
+index f6c850a..fbd4858 100644
+--- a/camellia-test.c
++++ b/camellia-test.c
+@@ -73,7 +73,7 @@ test_invert(const struct tstring *key,
+ }
+ 
+ void
+-test_main(void)
++test_main_camellia(void)
+ {
+   /* Test vectors from RFC 3713 */
+   /* 128 bit keys */
+diff --git a/cbc-test.c b/cbc-test.c
+index 9394f1c..96bf81c 100644
+--- a/cbc-test.c
++++ b/cbc-test.c
+@@ -65,7 +65,7 @@ test_cbc_bulk(void)
+ }
+ 
+ void
+-test_main(void)
++test_main_cbc(void)
+ {
+   /* Intermediate values:
+    *   iv XOR first message block:
+diff --git a/ccm-test.c b/ccm-test.c
+index 4176cc7..a1d0245 100644
+--- a/ccm-test.c
++++ b/ccm-test.c
+@@ -249,7 +249,7 @@ test_cipher_ccm(const struct nettle_cipher *cipher,
+ }
+ 
+ void
+-test_main(void)
++test_main_ccm(void)
+ {
+   /* Create a pattern of 00010203 04050607 08090a00b 0c0d0e0f ... */
+   struct tstring *adata;
+diff --git a/cfb-test.c b/cfb-test.c
+index dbb24e8..f99be6c 100644
+--- a/cfb-test.c
++++ b/cfb-test.c
+@@ -123,7 +123,7 @@ test_cfb8_bulk(void)
+ }
+ 
+ void
+-test_main(void)
++test_main_cfb(void)
+ {
+   /* From NIST spec 800-38a on AES modes.
+    *
+diff --git a/chacha-poly1305-test.c b/chacha-poly1305-test.c
+index 313e822..5afb54b 100644
+--- a/chacha-poly1305-test.c
++++ b/chacha-poly1305-test.c
+@@ -2,7 +2,7 @@
+ #include "nettle-internal.h"
+ 
+ void
+-test_main(void)
++test_main_chacha_poly1305(void)
+ {
+   /* From draft-irtf-cfrg-chacha20-poly1305-08 */
+   test_aead (&nettle_chacha_poly1305, NULL,
+diff --git a/chacha-test.c b/chacha-test.c
+index fb8f1db..d5bdd08 100644
+--- a/chacha-test.c
++++ b/chacha-test.c
+@@ -153,7 +153,7 @@ test_chacha_with_counter(const struct tstring *key, const struct tstring *nonce,
+ }
+ 
+ void
+-test_main(void)
++test_main_chacha(void)
+ {
+   /* Test vectors from draft-strombergson-chacha-test-vectors */
+ #if 0
+diff --git a/cmac-test.c b/cmac-test.c
+index a71baa0..b37efb1 100644
+--- a/cmac-test.c
++++ b/cmac-test.c
+@@ -12,7 +12,7 @@
+   test_mac(&nettle_cmac_des3, key, msg, ref)
+ 
+ void
+-test_main(void)
++test_main_cmac(void)
+ {
+   /*
+    * CMAC-AES Test Vectors from RFC4493.
+diff --git a/ctr-test.c b/ctr-test.c
+index 28f9c38..f9729de 100644
+--- a/ctr-test.c
++++ b/ctr-test.c
+@@ -2,7 +2,7 @@
+ #include "nettle-internal.h"
+ 
+ void
+-test_main(void)
++test_main_ctr(void)
+ {
+   /* From NIST spec 800-38a on AES modes,
+    *
+diff --git a/des-test.c b/des-test.c
+index a9c0eb9..bb3e4c8 100644
+--- a/des-test.c
++++ b/des-test.c
+@@ -63,7 +63,7 @@ test_weak(const struct tstring *key)
+ }
+ 
+ void
+-test_main(void)
++test_main_des(void)
+ {
+   /* From Applied Cryptography */
+   test_des(SHEX("01234567 89ABCDEF"), 1,
+diff --git a/des3-test.c b/des3-test.c
+index f0437ff..d806a75 100644
+--- a/des3-test.c
++++ b/des3-test.c
+@@ -3,7 +3,7 @@
+ #include "des.h"
+ 
+ void
+-test_main(void)
++test_main_des3(void)
+ {
+   /* Intermediate values:
+    *   After first DES encryption:  "cd ea 2a 20 c2 e0 9e 48"
+diff --git a/eax-test.c b/eax-test.c
+index f516df6..9e74c63 100644
+--- a/eax-test.c
++++ b/eax-test.c
+@@ -2,7 +2,7 @@
+ #include "nettle-internal.h"
+ 
+ void
+-test_main(void)
++test_main_eax(void)
+ {
+   /* From the EAX specification,
+      http://www.cs.ucdavis.edu/~rogaway/papers/eax.pdf */
+diff --git a/gcm-test.c b/gcm-test.c
+index c817401..9567668 100644
+--- a/gcm-test.c
++++ b/gcm-test.c
+@@ -57,7 +57,7 @@ nettle_gcm_unified_aes128 = {
+     
+ 
+ void
+-test_main(void)
++test_main_gcm(void)
+ {
+   /* 
+    * GCM-AES Test Vectors from
+diff --git a/gosthash94-test.c b/gosthash94-test.c
+index d4e5015..f3a971e 100644
+--- a/gosthash94-test.c
++++ b/gosthash94-test.c
+@@ -4,7 +4,7 @@
+ /* Using test vectors from Wikipedia article on GOST */
+ 
+ void
+-test_main(void)
++test_main_gosthash94(void)
+ {
+   test_hash(&nettle_gosthash94, SDATA("The quick brown fox jumps over the lazy dog"),
+ 	    SHEX("77b7fa410c9ac58a25f49bca7d0468c9296529315eaca76bd1a10f376d1f4294"));
+diff --git a/hkdf-test.c b/hkdf-test.c
+index 80f4c81..788c281 100644
+--- a/hkdf-test.c
++++ b/hkdf-test.c
+@@ -96,7 +96,7 @@ test_hkdf_sha1(const struct tstring *ikm,
+ }
+ 
+ void
+-test_main(void)
++test_main_hkdf(void)
+ {
+   /* HKDF test vectors from RFC5869 */
+   test_hkdf_sha256(SHEX("0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b"),
+diff --git a/hmac-test.c b/hmac-test.c
+index de1b6bf..1758903 100644
+--- a/hmac-test.c
++++ b/hmac-test.c
+@@ -14,7 +14,7 @@
+   } while (0)
+ 
+ void
+-test_main(void)
++test_main_hmac(void)
+ {
+   /* sha512's digests are longest */
+   uint8_t digest[SHA512_DIGEST_SIZE+1];
+diff --git a/knuth-lfib-test.c b/knuth-lfib-test.c
+index 3e8bfdd..38fdfa0 100644
+--- a/knuth-lfib-test.c
++++ b/knuth-lfib-test.c
+@@ -2,7 +2,7 @@
+ #include "knuth-lfib.h"
+ 
+ void
+-test_main(void)
++test_main_knuth(void)
+ {
+   struct knuth_lfib_ctx ctx;
+ 
+diff --git a/md2-test.c b/md2-test.c
+index af14857..239e751 100644
+--- a/md2-test.c
++++ b/md2-test.c
+@@ -2,7 +2,7 @@
+ #include "md2.h"
+ 
+ void
+-test_main(void)
++test_main_md2(void)
+ {
+   /* Testcases from RFC 1319 */
+   test_hash(&nettle_md2, SDATA(""),
+diff --git a/md4-test.c b/md4-test.c
+index d46693d..928129b 100644
+--- a/md4-test.c
++++ b/md4-test.c
+@@ -2,7 +2,7 @@
+ #include "md4.h"
+ 
+ void
+-test_main(void)
++test_main_md4(void)
+ {
+   /* Testcases from RFC 1320 */
+   test_hash(&nettle_md4, SDATA(""),
+diff --git a/md5-compat-test.c b/md5-compat-test.c
+index e223400..7d13ea1 100644
+--- a/md5-compat-test.c
++++ b/md5-compat-test.c
+@@ -2,7 +2,7 @@
+ #include "md5-compat.h"
+ 
+ void
+-test_main(void)
++test_main_md5_compat(void)
+ {
+   MD5_CTX ctx;
+   unsigned char digest[MD5_DIGEST_SIZE];
+diff --git a/md5-test.c b/md5-test.c
+index 37c2fb1..6eed05e 100644
+--- a/md5-test.c
++++ b/md5-test.c
+@@ -2,7 +2,7 @@
+ #include "md5.h"
+ 
+ void
+-test_main(void)
++test_main_md5(void)
+ {
+   test_hash(&nettle_md5, SDATA(""),
+ 	    SHEX("D41D8CD98F00B204 E9800998ECF8427E"));
+diff --git a/meta-aead-test.c b/meta-aead-test.c
+index 1fcede4..e402720 100644
+--- a/meta-aead-test.c
++++ b/meta-aead-test.c
+@@ -13,7 +13,7 @@ const char* aeads[] = {
+ };
+ 
+ void
+-test_main(void)
++test_main_meta_aead(void)
+ {
+   int i,j;
+   int count = sizeof(aeads)/sizeof(*aeads);
+diff --git a/meta-armor-test.c b/meta-armor-test.c
+index 406c8d0..4c21585 100644
+--- a/meta-armor-test.c
++++ b/meta-armor-test.c
+@@ -8,7 +8,7 @@ const char* armors[] = {
+ };
+ 
+ void
+-test_main(void)
++test_main_meta_armor(void)
+ {
+   int i,j;
+   int count = sizeof(armors)/sizeof(*armors);
+diff --git a/meta-cipher-test.c b/meta-cipher-test.c
+index f949fd7..883a19a 100644
+--- a/meta-cipher-test.c
++++ b/meta-cipher-test.c
+@@ -22,7 +22,7 @@ const char* ciphers[] = {
+ };
+ 
+ void
+-test_main(void)
++test_main_meta_ciphers(void)
+ {
+   int i,j;
+   int count = sizeof(ciphers)/sizeof(*ciphers);
+diff --git a/meta-hash-test.c b/meta-hash-test.c
+index 7d863a7..95c79af 100644
+--- a/meta-hash-test.c
++++ b/meta-hash-test.c
+@@ -23,7 +23,7 @@ const char* hashes[] = {
+ };
+ 
+ void
+-test_main(void)
++test_main_meta_hash(void)
+ {
+   int i;
+   int count = sizeof(hashes)/sizeof(*hashes);
+diff --git a/meta-mac-test.c b/meta-mac-test.c
+index 5533944..8fb11c3 100644
+--- a/meta-mac-test.c
++++ b/meta-mac-test.c
+@@ -15,7 +15,7 @@ const char* macs[] = {
+ };
+ 
+ void
+-test_main(void)
++test_main_meta_mac(void)
+ {
+   int i, j;
+   int count = sizeof(macs)/sizeof(*macs);
+diff --git a/pbkdf2-test.c b/pbkdf2-test.c
+index e64a20d..90f42ce 100644
+--- a/pbkdf2-test.c
++++ b/pbkdf2-test.c
+@@ -22,7 +22,7 @@
+ #define MAX_DKLEN SHA512_DIGEST_SIZE
+ 
+ void
+-test_main (void)
++test_main_pbkdf2 (void)
+ {
+   uint8_t dk[MAX_DKLEN + 1];
+   struct hmac_sha1_ctx sha1ctx;
+diff --git a/poly1305-test.c b/poly1305-test.c
+index ee70b3c..c580a13 100644
+--- a/poly1305-test.c
++++ b/poly1305-test.c
+@@ -52,7 +52,7 @@ test_poly1305 (const struct tstring *key,
+ }
+ 
+ void
+-test_main(void)
++test_main_poly1305(void)
+ {
+   /* From Bernstein's paper. */
+   test_poly1305
+diff --git a/ripemd160-test.c b/ripemd160-test.c
+index 85518e6..c3f5d4c 100644
+--- a/ripemd160-test.c
++++ b/ripemd160-test.c
+@@ -2,7 +2,7 @@
+ #include "ripemd160.h"
+ 
+ void
+-test_main(void)
++test_main_ripemd160(void)
+ {
+   test_hash(&nettle_ripemd160, SDATA(""),
+ 	    SHEX("9c1185a5c5e9fc54612808977ee8f548b2258d31"));
+diff --git a/salsa20-test.c b/salsa20-test.c
+index 3a1b8ea..07f7284 100644
+--- a/salsa20-test.c
++++ b/salsa20-test.c
+@@ -189,7 +189,7 @@ _test_salsa20(salsa20_func *crypt,
+ 
+   
+ void
+-test_main(void)
++test_main_salsa20(void)
+ {
+   /* http://www.ecrypt.eu.org/stream/svn/viewcvs.cgi/ecrypt/trunk/submissions/salsa20/reduced/12-rounds/verified.test-vectors?logsort=rev&rev=210&view=markup */
+   test_salsa20r12(SHEX("80000000 00000000 00000000 00000000"),
+diff --git a/serpent-test.c b/serpent-test.c
+index 4b89a1e..dd3c354 100644
+--- a/serpent-test.c
++++ b/serpent-test.c
+@@ -67,7 +67,7 @@ test_serpent(const struct tstring *key,
+ }
+ 
+ void
+-test_main(void)
++test_main_serpent(void)
+ {
+   /* From libgcrypt */
+   test_cipher(&nettle_serpent128,
+diff --git a/sha1-huge-test.c b/sha1-huge-test.c
+index 156a762..9898187 100644
+--- a/sha1-huge-test.c
++++ b/sha1-huge-test.c
+@@ -1,7 +1,7 @@
+ #include "testutils.h"
+ 
+ void
+-test_main(void)
++test_main_sha1_huge(void)
+ {
+   /* Hashes 10 000 000 x 30 000 bytes > 64 * 2^32. This overflows the
+      low word of the block counter. This test vector is not cross
+diff --git a/sha1-test.c b/sha1-test.c
+index 8356555..d47b055 100644
+--- a/sha1-test.c
++++ b/sha1-test.c
+@@ -1,7 +1,7 @@
+ #include "testutils.h"
+ 
+ void
+-test_main(void)
++test_main_sha1(void)
+ {
+   test_hash(&nettle_sha1, SDATA(""),
+ 	    SHEX("DA39A3EE5E6B4B0D 3255BFEF95601890 AFD80709")); 
+diff --git a/sha224-test.c b/sha224-test.c
+index eb20c30..1731081 100644
+--- a/sha224-test.c
++++ b/sha224-test.c
+@@ -1,7 +1,7 @@
+ #include "testutils.h"
+ 
+ void
+-test_main(void)
++test_main_sha224(void)
+ {
+   /* From FIPS180-2 addendum
+      (http://csrc.nist.gov/publications/fips/fips180-2/fips180-2withchangenotice.pdf) */
+diff --git a/sha256-test.c b/sha256-test.c
+index 551b140..664f894 100644
+--- a/sha256-test.c
++++ b/sha256-test.c
+@@ -1,7 +1,7 @@
+ #include "testutils.h"
+ 
+ void
+-test_main(void)
++test_main_sha256(void)
+ {
+   /* From FIPS180-2 */
+   test_hash(&nettle_sha256, SDATA("abc"),
+diff --git a/sha3-224-test.c b/sha3-224-test.c
+index 627f4cb..39229f0 100644
+--- a/sha3-224-test.c
++++ b/sha3-224-test.c
+@@ -1,7 +1,7 @@
+ #include "testutils.h"
+ 
+ void
+-test_main(void)
++test_main_sha3_224(void)
+ {
+   /* Extracted from ShortMsgKAT_224.txt using sha3.awk. */
+   test_hash(&nettle_sha3_224, /* 0 octets */
+diff --git a/sha3-256-test.c b/sha3-256-test.c
+index f0dad08..ee4c249 100644
+--- a/sha3-256-test.c
++++ b/sha3-256-test.c
+@@ -1,7 +1,7 @@
+ #include "testutils.h"
+ 
+ void
+-test_main(void)
++test_main_sha3_256(void)
+ {
+   /* Extracted from ShortMsgKAT_256.txt using sha3.awk. */
+   test_hash(&nettle_sha3_256, /* 0 octets */
+diff --git a/sha3-384-test.c b/sha3-384-test.c
+index e973cf8..af30e31 100644
+--- a/sha3-384-test.c
++++ b/sha3-384-test.c
+@@ -1,7 +1,7 @@
+ #include "testutils.h"
+ 
+ void
+-test_main(void)
++test_main_sha3_384(void)
+ {
+   /* Extracted from ShortMsgKAT_384.txt using sha3.awk. */
+   test_hash(&nettle_sha3_384, /* 0 octets */
+diff --git a/sha3-512-test.c b/sha3-512-test.c
+index b323a7f..7a42039 100644
+--- a/sha3-512-test.c
++++ b/sha3-512-test.c
+@@ -1,7 +1,7 @@
+ #include "testutils.h"
+ 
+ void
+-test_main(void)
++test_main_sha3_512(void)
+ {
+   /* Extracted from ShortMsgKAT_512.txt using sha3.awk. */
+   test_hash(&nettle_sha3_512, /* 0 octets */
+diff --git a/sha3-permute-test.c b/sha3-permute-test.c
+index 1e4e9de..c2d65cd 100644
+--- a/sha3-permute-test.c
++++ b/sha3-permute-test.c
+@@ -17,7 +17,7 @@ display (const struct sha3_state *state)
+ }
+ 
+ void
+-test_main(void)
++test_main_sha3_permute(void)
+ {
+   /* From KeccakPermutationIntermediateValues.txt */
+   static const struct sha3_state s1 =
+diff --git a/sha384-test.c b/sha384-test.c
+index 13a0214..88a43da 100644
+--- a/sha384-test.c
++++ b/sha384-test.c
+@@ -1,7 +1,7 @@
+ #include "testutils.h"
+ 
+ void
+-test_main(void)
++test_main_sha384(void)
+ {
+   test_hash(&nettle_sha384, SDATA("abc"),
+ 	    SHEX("cb00753f45a35e8b b5a03d699ac65007"
+diff --git a/sha512-224-test.c b/sha512-224-test.c
+index 6b81184..7517477 100644
+--- a/sha512-224-test.c
++++ b/sha512-224-test.c
+@@ -1,7 +1,7 @@
+ #include "testutils.h"
+ 
+ void
+-test_main(void)
++test_main_sha512_224(void)
+ {
+   /* From http://csrc.nist.gov/groups/ST/toolkit/documents/Examples/SHA_All.pdf */
+   test_hash(&nettle_sha512_224, SDATA("abc"),
+diff --git a/sha512-256-test.c b/sha512-256-test.c
+index c0613ed..539408a 100644
+--- a/sha512-256-test.c
++++ b/sha512-256-test.c
+@@ -1,7 +1,7 @@
+ #include "testutils.h"
+ 
+ void
+-test_main(void)
++test_main_sha512_256(void)
+ {
+   /* From http://csrc.nist.gov/groups/ST/toolkit/documents/Examples/SHA_All.pdf */
+   test_hash(&nettle_sha512_256, SDATA("abc"),
+diff --git a/sha512-test.c b/sha512-test.c
+index c501e09..f7ed230 100644
+--- a/sha512-test.c
++++ b/sha512-test.c
+@@ -1,7 +1,7 @@
+ #include "testutils.h"
+ 
+ void
+-test_main(void)
++test_main_sha512(void)
+ {
+   test_hash(&nettle_sha512, SDATA("abc"),
+ 	    SHEX("ddaf35a193617aba cc417349ae204131"
+diff --git a/shake256-test.c b/shake256-test.c
+index b91417c..3feace8 100644
+--- a/shake256-test.c
++++ b/shake256-test.c
+@@ -46,7 +46,7 @@ const struct nettle_hash nettle_shake256 =
+   };
+ 
+ void
+-test_main(void)
++test_main_shake256(void)
+ {
+   /* Extracted from ShortMsgKAT_SHAKE256.txt. */
+   test_hash (&nettle_shake256, /* 0 octets */
+diff --git a/testutils.c b/testutils.c
+index 1f279e9..a0dae33 100644
+--- a/testutils.c
++++ b/testutils.c
+@@ -117,27 +117,6 @@ print_hex(size_t length, const uint8_t *data)
+ 
+ int verbose = 0;
+ 
+-int
+-main(int argc, char **argv)
+-{
+-  if (argc > 1)
+-    {
+-      if (argc == 2 && !strcmp(argv[1], "-v"))
+-	verbose = 1;
+-      else
+-	{
+-	  fprintf(stderr, "Invalid argument `%s', only accepted option is `-v'.\n",
+-		  argv[1]);
+-	  return 1;
+-	}
+-    }
+-
+-  test_main();
+-
+-  tstring_clear();
+-  return EXIT_SUCCESS;
+-}
+-
+ void
+ test_cipher(const struct nettle_cipher *cipher,
+ 	    const struct tstring *key,
+diff --git a/twofish-test.c b/twofish-test.c
+index 2bef44c..187ac46 100644
+--- a/twofish-test.c
++++ b/twofish-test.c
+@@ -2,7 +2,7 @@
+ #include "twofish.h"
+ 
+ void
+-test_main(void)
++test_main_twofish(void)
+ {
+   /* 128 bit key */
+   test_cipher(&nettle_twofish128,
+diff --git a/umac-test.c b/umac-test.c
+index 0fb97cb..af42b2e 100644
+--- a/umac-test.c
++++ b/umac-test.c
+@@ -211,7 +211,7 @@ test_incr (const struct tstring *key,
+ }
+ 
+ void
+-test_main(void)
++test_main_umac(void)
+ {
+   /* From RFC 4418 (except that it lacks the last 32 bits of 128-bit
+      tags) */
+diff --git a/xts-test.c b/xts-test.c
+index 723a5a1..49e66f2 100644
+--- a/xts-test.c
++++ b/xts-test.c
+@@ -108,7 +108,7 @@ test_cipher_xts(const struct nettle_cipher *cipher,
+ }
+ 
+ void
+-test_main(void)
++test_main_xts(void)
+ {
+   /* From NIST CAVS 11.0,
+    *
+diff --git a/yarrow-test.c b/yarrow-test.c
+index facc4fd..57a05b5 100644
+--- a/yarrow-test.c
++++ b/yarrow-test.c
+@@ -59,7 +59,7 @@ open_file(const char *name)
+ }
+ 
+ void
+-test_main(void)
++test_main_yarrow(void)
+ {
+   FILE *input;
+   
+diff --git a/buffer-test.c b/buffer-test.c
+index fe2e222..7585054 100644
+--- a/buffer-test.c
++++ b/buffer-test.c
+@@ -2,7 +2,7 @@
+ #include "buffer.h"
+ 
+ void
+-test_main(void)
++test_main_buffer(void)
+ {
+   struct nettle_buffer buffer;
+   uint8_t s[5];
+diff --git a/cast128-test.c b/cast128-test.c
+index 534eb17..af171a6 100644
+--- a/cast128-test.c
++++ b/cast128-test.c
+@@ -45,7 +45,7 @@ test_cast5(const struct tstring *key,
+ }
+ 
+ void
+-test_main(void)
++test_main_cast128(void)
+ {
+   /* Test vectors from B.1. Single Plaintext-Key-Ciphertext Sets, RFC
+    * 2144 */
+-- 
+2.25.1
+
-- 
2.25.1



From minios-devel-bounces@lists.xenproject.org Thu Jan 28 17:26:34 2021
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Thu, 28 Jan 2021 17:26:34 +0000
Received: from list by lists.xenproject.org with outflank-mailman.77326.139987 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1l5B3x-0003QF-7N; Thu, 28 Jan 2021 17:26:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 77326.139987; Thu, 28 Jan 2021 17:26: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 1l5B3x-0003Q8-4U; Thu, 28 Jan 2021 17:26:33 +0000
Received: by outflank-mailman (input) for mailman id 77326;
 Thu, 28 Jan 2021 17:26: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=ZVXE=G7=gmail.com=cristianvijelie@srs-us1.protection.inumbo.net>)
 id 1l5B3v-0003Pl-CE
 for minios-devel@lists.xen.org; Thu, 28 Jan 2021 17:26:31 +0000
Received: from mail-ej1-x630.google.com (unknown [2a00:1450:4864:20::630])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 3f4953f6-3fa6-418a-9fc0-8aae242ba708;
 Thu, 28 Jan 2021 17:26:30 +0000 (UTC)
Received: by mail-ej1-x630.google.com with SMTP id by1so9008452ejc.0
 for <minios-devel@lists.xen.org>; Thu, 28 Jan 2021 09:26:30 -0800 (PST)
Received: from localhost.localdomain (5-13-183-146.residential.rdsnet.ro.
 [5.13.183.146])
 by smtp.gmail.com with ESMTPSA id k22sm3377721edv.33.2021.01.28.09.26.27
 for <minios-devel@lists.xen.org>
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Thu, 28 Jan 2021 09:26: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: 3f4953f6-3fa6-418a-9fc0-8aae242ba708
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20161025;
        h=from:to:subject:date:message-id:mime-version
         :content-transfer-encoding;
        bh=Qco7R2toTk/nDPFhUBTWvm09HmG3lRCEiXQqll3x6Jo=;
        b=VMXaGQfJ1Qq1zdaIdVT06w1I6AhPy/jW+fvaGO7rCpxtUErnOFU3s3eerenIG2K0HX
         xE3sH577SFvHhIAuBbqHy0IIRplSpItqxX/yPe+k/0u8nPonumvFGc7Nolfkbk4/J7jB
         /3z1R2Y+oZ0ljPUvDg8ansy44xXZQcR5z+LZEdW2xCEFz01GysZb3pkJWUAZC0zkaH37
         f/vElQJvDCz4Ncu/9Gtp0qDpATdO6kJ8UAkZE4oEagVldgqktzXSSOCBCOsYpBXsLLqz
         YF98kEnWXR7BRWk1qNS27x6ymd7ipBhMw9WTul1tUBaD1WKIU999/daJLaKS84VgIPfS
         hLiA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20161025;
        h=x-gm-message-state:from:to:subject:date:message-id:mime-version
         :content-transfer-encoding;
        bh=Qco7R2toTk/nDPFhUBTWvm09HmG3lRCEiXQqll3x6Jo=;
        b=n2ZDTyQQv+2i2b4Bjvp9LM1FMzqmfThDz+ufLFre5G0Ee1xO5bh3+2GUkycMtGbAH1
         NOLZS90X8HXMPwk+2b8pSYBI9CD/otz91Qb3lU5/kWilcWVsmHd/lQTr4HQ5Und3a2Ab
         nKGtmP14kFrIieymiBu1cpMHXpq1tSLbJWP9/uZColq8rDyvYAtW9WI7LRbIiqpnqDF4
         t11uFUAef7o9q26XHsBpz3Y8PK5XkFJbMm2bCaflwmaGjnbLSYgDcGoWbzvdo49Ip2hQ
         OwkHyh8TadZ8BmJo6eDUiEQtE2GHtRoRiWE4DCMNk6LI9S1XlimAXi5V/VVraqeje1LN
         tx0A==
X-Gm-Message-State: AOAM532/cs6ldo0/Z8ezHGkN/eGzX7+vKXZJ2P3aQkKAdO9iYRlXbJo1
	Mhx3H1PEBergvtPw0h/T4itTCycJNrA=
X-Google-Smtp-Source: ABdhPJzAvXKouVCS7pRh3AEIc/PBtq8onc34aiOlA6m0JnKbP/P/Als4Sr3Kk0CJDjYGGU6+Ugw03w==
X-Received: by 2002:a17:906:6a92:: with SMTP id p18mr451073ejr.308.1611854788790;
        Thu, 28 Jan 2021 09:26:28 -0800 (PST)
From: cristian-vijelie <cristianvijelie@gmail.com>
To: minios-devel@lists.xen.org
Subject: [[UNIKRAFT/APP-LIBNETTLE_TEST] 0/3] Introducing the test app for libnettle
Date: Thu, 28 Jan 2021 19:26:24 +0200
Message-Id: <20210128172627.79524-1-cristianvijelie@gmail.com>
X-Mailer: git-send-email 2.25.1
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit

The folowing patches introduce to Unikraft an application that tests
the correct functioning of the nettle library.

cristian-vijelie (3):
  Introducing the app skeleton
  Adding the Makefiles
  Adding the source code

 .gitignore            |    3 +
 CODING_STYLE.md       |    4 +
 CONTRIBUTING.md       |    4 +
 COPYING.md            |   35 +
 Config.uk             |    7 +
 MAINTAINERS.md        |   10 +
 Makefile              |    9 +
 Makefile.uk           |    3 +
 README.md             |   22 +
 guest_fs/gold-bug.txt | 1598 +++++++++++++++++++++++++++++++++++++++++
 guest_fs/test_nr      |    1 +
 include/testsuite.h   |   59 ++
 kraft.yaml            |   19 +
 main.c                |  298 ++++++++
 14 files changed, 2072 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
 create mode 100644 Makefile.uk
 create mode 100644 README.md
 create mode 100644 guest_fs/gold-bug.txt
 create mode 100644 guest_fs/test_nr
 create mode 100644 include/testsuite.h
 create mode 100644 kraft.yaml
 create mode 100644 main.c

-- 
2.25.1



From minios-devel-bounces@lists.xenproject.org Thu Jan 28 17:26:38 2021
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Thu, 28 Jan 2021 17:26:38 +0000
Received: from list by lists.xenproject.org with outflank-mailman.77327.139990 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1l5B42-0003RC-9A; Thu, 28 Jan 2021 17:26:38 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 77327.139990; Thu, 28 Jan 2021 17:26: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 1l5B42-0003R5-6I; Thu, 28 Jan 2021 17:26:38 +0000
Received: by outflank-mailman (input) for mailman id 77327;
 Thu, 28 Jan 2021 17:26: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=ZVXE=G7=gmail.com=cristianvijelie@srs-us1.protection.inumbo.net>)
 id 1l5B40-0003Pl-BD
 for minios-devel@lists.xen.org; Thu, 28 Jan 2021 17:26:36 +0000
Received: from mail-ej1-x62a.google.com (unknown [2a00:1450:4864:20::62a])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id bc28011f-104b-444e-9b39-0e8667c2271a;
 Thu, 28 Jan 2021 17:26:30 +0000 (UTC)
Received: by mail-ej1-x62a.google.com with SMTP id ox12so8994531ejb.2
 for <minios-devel@lists.xen.org>; Thu, 28 Jan 2021 09:26:30 -0800 (PST)
Received: from localhost.localdomain (5-13-183-146.residential.rdsnet.ro.
 [5.13.183.146])
 by smtp.gmail.com with ESMTPSA id k22sm3377721edv.33.2021.01.28.09.26.28
 for <minios-devel@lists.xen.org>
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Thu, 28 Jan 2021 09:26: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: bc28011f-104b-444e-9b39-0e8667c2271a
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20161025;
        h=from:to:subject:date:message-id:in-reply-to:references:mime-version
         :content-transfer-encoding;
        bh=1PvrkbdM1D/jjnlFklqEkxl+fgXhMNXgGmHzP85Tp/0=;
        b=B1WQRyLpR7uZbsmk5L9O3x711S6e4B63iW4rpi1bA7pG/61GhT/0u3hN5PTdQ2Yl+h
         7/eoTShIqxb3W+AOODp1WDngyyqVKFXm94oqqGNk3onGTcF0HVGrW8Js1FRXwtAGkNHI
         ekHW5IM+gt4NTLqQbEEtjM97f0ckzroeuzHdHrCUna6vGjpbAm7TdnVZLtKGpbw9stPk
         ncbQF5c1OhJZBy4kGRA5kRag+w694lwt2In94kZ00wmGlR7ef4aMIYqXjbM5d5Ox3Z+Y
         F6HnFPljXraNn5mgbpj9c+T0ouZGvZ6xSYG6if1oI+yUqMrsaZITCXfZAemhKZxaovf7
         rEqg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20161025;
        h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to
         :references:mime-version:content-transfer-encoding;
        bh=1PvrkbdM1D/jjnlFklqEkxl+fgXhMNXgGmHzP85Tp/0=;
        b=U50QJu2RLu9w8rT5VfFxvnPztzvgnFdDYnYwd0OBP3+d3s3Away5j4sZ2dwU23MHjG
         LyQ58IkoGZZA4Q2fMPGp0egti6R4kl/WntnciY2ITZNLHq9bDjoocI0AthcHoGJ+DfXa
         VgS+hoKn2s4J+Ecq1YtnJe9fl40P+bqPVZyUUtOfD3qtbM+/BBHVvpE3vkKVQqvOxyuL
         yHL44tsOFkQJ2KUwrL3ihkbhqPMydwYefisklpfYRC0OEV3gc2W1ibt2v/P1DWCOadmJ
         c2psxypzYkd4wtKEdFrOHeqr6xkr7304GiscpOzm5SO+v1CF2uLBEM+NLKvv/d5H4onY
         sCTg==
X-Gm-Message-State: AOAM532cbl9KuRPnv49Q3jZMq7xNCxzrkPvzlHs9G+gS8mensRtHPnbx
	YjlLfJueF5fC21MzrgdjNg5Diilzzn8=
X-Google-Smtp-Source: ABdhPJylM2qB9QQxJkqDJjbdlsCYIJ0s4VBw0L9I1XAAgBj0nQWV/Plcc6cn0xSJsnBROGPjor91gQ==
X-Received: by 2002:a17:906:4f0d:: with SMTP id t13mr502003eju.10.1611854789739;
        Thu, 28 Jan 2021 09:26:29 -0800 (PST)
From: cristian-vijelie <cristianvijelie@gmail.com>
To: minios-devel@lists.xen.org
Subject: [[UNIKRAFT/APP-LIBNETTLE_TEST] 1/3] Introducing the app skeleton
Date: Thu, 28 Jan 2021 19:26:25 +0200
Message-Id: <20210128172627.79524-2-cristianvijelie@gmail.com>
X-Mailer: git-send-email 2.25.1
In-Reply-To: <20210128172627.79524-1-cristianvijelie@gmail.com>
References: <20210128172627.79524-1-cristianvijelie@gmail.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit

Signed-off-by: cristian-vijelie <cristianvijelie@gmail.com>
---
 .gitignore      |  3 +++
 CODING_STYLE.md |  4 ++++
 CONTRIBUTING.md |  4 ++++
 COPYING.md      | 35 +++++++++++++++++++++++++++++++++++
 Config.uk       |  7 +++++++
 MAINTAINERS.md  | 10 ++++++++++
 README.md       | 22 ++++++++++++++++++++++
 kraft.yaml      | 19 +++++++++++++++++++
 8 files changed, 104 insertions(+)
 create mode 100644 .gitignore
 create mode 100644 CODING_STYLE.md
 create mode 100644 CONTRIBUTING.md
 create mode 100644 COPYING.md
 create mode 100644 Config.uk
 create mode 100644 MAINTAINERS.md
 create mode 100644 README.md
 create mode 100644 kraft.yaml

diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..910c6c4
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,3 @@
+includes
+.config*
+build
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..7d621b4
--- /dev/null
+++ b/COPYING.md
@@ -0,0 +1,35 @@
+License
+=======
+
+Unikraft LibNettle Test App
+------------------------------
+
+This repository contains an example app to build with Unikraft.
+The code is published under BSD licence:
+
+	Copyright (c) 2020, Politehnica University 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.
diff --git a/Config.uk b/Config.uk
new file mode 100644
index 0000000..c7d85e0
--- /dev/null
+++ b/Config.uk
@@ -0,0 +1,7 @@
+### Invisible option for dependencies
+config APPLIBNETTLETEST_DEPENDENCIES
+	bool
+	default y
+	select LIBNETTLE
+	select LIBNETTLE_TEST
+	select LIBNEWLIBC
diff --git a/MAINTAINERS.md b/MAINTAINERS.md
new file mode 100644
index 0000000..bd3d00e
--- /dev/null
+++ b/MAINTAINERS.md
@@ -0,0 +1,10 @@
+Maintainers List
+================
+
+For notes on how to read this information, please refer to `MAINTAINERS.md` in
+the main Unikraft repository.
+
+	HELLOWORLD-UNIKRAFT
+	M:	Cristian Vijelie <cristianvijelie@gmail.com>
+	L:	minios-devel@lists.xen.org
+	F: *
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..9a4bdda
--- /dev/null
+++ b/README.md
@@ -0,0 +1,22 @@
+# Unikraft LibNettle Test Application
+
+This application tests the correct functioning of the nettle cryptographic
+library.
+
+The application requires newlib and nettle to work. Also, the LIBNETTLE_TEST
+option should be selected for nettle in menuconfig.
+
+You should configure UK_ROOT and UK_LIBS, in Makefile, acording to your setup.
+
+Due to some keyboard intrerrupt issues, to select the test suite number, you
+must replace the -1 in guest_fs/test_nr with the desired test suite number.
+Leaving the -1 will display only the test suites and their contents.
+
+To run with kvm: the following parameters must be given to qemu:
+*   -fsdev local,id=myid,path=guest_fs,security_model=none
+*   -device virtio-9p-pci,fsdev=myid,mount_tag=rootfs,disable-modern=on,disable-legacy=off
+
+Known issues:
+*   On linuxu platform, test suite 0 will make unikraft crash. Test suites
+    are made so unikraft won't crash.
+*   Not tested on Xen.
diff --git a/kraft.yaml b/kraft.yaml
new file mode 100644
index 0000000..402a3c3
--- /dev/null
+++ b/kraft.yaml
@@ -0,0 +1,19 @@
+specification: '0.4'
+
+unikraft: '0.4'
+
+architectures:
+  x86_64: true
+  arm64: true
+      
+platforms:
+  linuxu: true
+  kvm: true
+  xen: true
+
+libraries:
+  newlib: '0.4'
+  nettle:
+    version: '0.4'
+    kconfig:
+      - LIBNETTLE_TEST=y
-- 
2.25.1



From minios-devel-bounces@lists.xenproject.org Thu Jan 28 17:26:42 2021
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Thu, 28 Jan 2021 17:26:42 +0000
Received: from list by lists.xenproject.org with outflank-mailman.77328.139994 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1l5B46-0003SK-Bm; Thu, 28 Jan 2021 17:26:42 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 77328.139994; Thu, 28 Jan 2021 17:26: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 1l5B46-0003SD-8x; Thu, 28 Jan 2021 17:26:42 +0000
Received: by outflank-mailman (input) for mailman id 77328;
 Thu, 28 Jan 2021 17:26: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=ZVXE=G7=gmail.com=cristianvijelie@srs-us1.protection.inumbo.net>)
 id 1l5B45-0003Pl-BR
 for minios-devel@lists.xen.org; Thu, 28 Jan 2021 17:26: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 d672679d-12ba-4553-8653-9d2352c80f1b;
 Thu, 28 Jan 2021 17:26:32 +0000 (UTC)
Received: by mail-ej1-x62e.google.com with SMTP id ox12so8994621ejb.2
 for <minios-devel@lists.xen.org>; Thu, 28 Jan 2021 09:26:31 -0800 (PST)
Received: from localhost.localdomain (5-13-183-146.residential.rdsnet.ro.
 [5.13.183.146])
 by smtp.gmail.com with ESMTPSA id k22sm3377721edv.33.2021.01.28.09.26.29
 for <minios-devel@lists.xen.org>
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Thu, 28 Jan 2021 09:26: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: d672679d-12ba-4553-8653-9d2352c80f1b
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20161025;
        h=from:to:subject:date:message-id:in-reply-to:references:mime-version
         :content-transfer-encoding;
        bh=srSqzRr5ncheJZZ6I3WEyGeHRJZlz/4pqq3twdBhq4c=;
        b=ce1nYugb/utdQmCvjqipwY6X/q0j3GymBC2CuXx6eIySiw9d/EYiurfC9r8w7oAn7y
         3zPvFcaCE4ABO8d3/OXxOeNjQAf/2VlQ3C+hZrPCMWC2rlSVFL1iW2a9rmER8EMk0ytV
         irTlNyV2XBZE1W2ttK0qg6xlxY9N7x2HFLxlivZu78XdM+15F7Dy6rUlIrznBD7xF7aQ
         Lx5jFY66xYFMjqmz51jazzOBkyaKbCT7vwQDY8z70F+oZHzFP2apdSa/vyQ9ngNwTxlr
         o5edP2pqyjOfctECk0Un23BKPOqQ37XrY9Itz7ZiJCKqpEliHtAyp/w+6zxp7NZsd3qL
         Fg2w==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20161025;
        h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to
         :references:mime-version:content-transfer-encoding;
        bh=srSqzRr5ncheJZZ6I3WEyGeHRJZlz/4pqq3twdBhq4c=;
        b=e+TY2/C/0C3lO3op3XwMGRKSKIaXjm8dj/ivN4sOd7d69btx2KPL5stX+ZOpU5bWfr
         ZOOoXKsv28M9ZiwthgUSg2iYxL3F2M/hE2Z10D88B+GG3IMKsGsM115p0egjm4dfPURD
         ycVI019fp3Ib0me5YAKaPka4JUPmaKdbqIo2eGKIb6Rw/Y9EEXUHTTsxwbO+2RPilvWx
         sZmZhtDVh/fdXpMTxtvdZd2VSL242kJIQO7AOq8C7uyGUPnth0jPChBS7kQ3ptaMlqN5
         oRAE+aRgA4fJP9efoXWvCQvv1swChOJeAJ/vQt34ENJoNh/xaiqKQ+308wGt/M++KiSW
         /ksQ==
X-Gm-Message-State: AOAM533NCPPlhBEMppJwhVHYPZEoif4olB/PKWWf+XRXjF9WimNIyBep
	F+LhqXkmhHsBe4yTBgyMh6xeDFIC164=
X-Google-Smtp-Source: ABdhPJyX9lC9RfNfLo19qXqCUoVyO2jOM0lNznWQlw1vxWKwPjLOBDR32985hl53Z1Ga7hMW4g7+qg==
X-Received: by 2002:a17:906:1348:: with SMTP id x8mr429817ejb.81.1611854790837;
        Thu, 28 Jan 2021 09:26:30 -0800 (PST)
From: cristian-vijelie <cristianvijelie@gmail.com>
To: minios-devel@lists.xen.org
Subject: [[UNIKRAFT/APP-LIBNETTLE_TEST] 2/3] Adding the Makefiles
Date: Thu, 28 Jan 2021 19:26:26 +0200
Message-Id: <20210128172627.79524-3-cristianvijelie@gmail.com>
X-Mailer: git-send-email 2.25.1
In-Reply-To: <20210128172627.79524-1-cristianvijelie@gmail.com>
References: <20210128172627.79524-1-cristianvijelie@gmail.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit

Signed-off-by: cristian-vijelie <cristianvijelie@gmail.com>
---
 Makefile    | 9 +++++++++
 Makefile.uk | 3 +++
 2 files changed, 12 insertions(+)
 create mode 100644 Makefile
 create mode 100644 Makefile.uk

diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..bd69f4b
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,9 @@
+UK_ROOT ?= $(PWD)/../../unikraft
+UK_LIBS ?= $(PWD)/../../libs
+LIBS := $(UK_LIBS)/lib-nettle:$(UK_LIBS)/lib-newlib
+
+all:
+	@$(MAKE) -C $(UK_ROOT) A=$(PWD) L=$(LIBS)
+
+$(MAKECMDGOALS):
+	@$(MAKE) -C $(UK_ROOT) A=$(PWD) L=$(LIBS) $(MAKECMDGOALS)
diff --git a/Makefile.uk b/Makefile.uk
new file mode 100644
index 0000000..5ae7f49
--- /dev/null
+++ b/Makefile.uk
@@ -0,0 +1,3 @@
+$(eval $(call addlib,applibnettletest))
+
+APPLIBNETTLETEST_SRCS-y += $(APPLIBNETTLETEST_BASE)/main.c
-- 
2.25.1



From minios-devel-bounces@lists.xenproject.org Thu Jan 28 17:26:47 2021
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Thu, 28 Jan 2021 17:26:47 +0000
Received: from list by lists.xenproject.org with outflank-mailman.77329.139999 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1l5B4B-0003TX-Dl; Thu, 28 Jan 2021 17:26:47 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 77329.139999; Thu, 28 Jan 2021 17:26: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 1l5B4B-0003TQ-Ah; Thu, 28 Jan 2021 17:26:47 +0000
Received: by outflank-mailman (input) for mailman id 77329;
 Thu, 28 Jan 2021 17:26:46 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=ZVXE=G7=gmail.com=cristianvijelie@srs-us1.protection.inumbo.net>)
 id 1l5B4A-0003Pl-Bb
 for minios-devel@lists.xen.org; Thu, 28 Jan 2021 17:26:46 +0000
Received: from mail-ej1-x62f.google.com (unknown [2a00:1450:4864:20::62f])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 02165bc5-783f-4214-9614-f062c6df3c53;
 Thu, 28 Jan 2021 17:26:37 +0000 (UTC)
Received: by mail-ej1-x62f.google.com with SMTP id kg20so8970535ejc.4
 for <minios-devel@lists.xen.org>; Thu, 28 Jan 2021 09:26:37 -0800 (PST)
Received: from localhost.localdomain (5-13-183-146.residential.rdsnet.ro.
 [5.13.183.146])
 by smtp.gmail.com with ESMTPSA id k22sm3377721edv.33.2021.01.28.09.26.30
 for <minios-devel@lists.xen.org>
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Thu, 28 Jan 2021 09:26: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: 02165bc5-783f-4214-9614-f062c6df3c53
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20161025;
        h=from:to:subject:date:message-id:in-reply-to:references:mime-version
         :content-transfer-encoding;
        bh=nBwHeTc1k/2OnmbnhWRnX4DtCB3uJHB7+o7EcbDCrDE=;
        b=LmQO4i5REBv7c1Ncw2oYYLxiqaEEUZWA46sJsK6EFe5orkC3kpj6fpQ1LXRcdd//DU
         9PHsaV3eqhg3fY3S+DIeNZmZ9IaaBW/nEA/NfGa5v5FpWaBLAoClFAb6ggfxwZNMFPPI
         d38MSVxIn86X7t4Ie6hF1Gw+KgMeHwOm+5BZFwd2jni8pDVKnvsk5hYHw2PXYKqhQRxA
         tgMPG9C/xoAbaXqV2jdNwMU6uPufSaQaHOf0KUCyhto0qFvGV9GN9dUy10gq2UrRx8uT
         w76aHcRmJjXqp0K5BA8khUuxsE2Iz71dAOmsriEKrQX7mjvpJBLpkd0ciNCv+DmLeuWm
         rGAQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20161025;
        h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to
         :references:mime-version:content-transfer-encoding;
        bh=nBwHeTc1k/2OnmbnhWRnX4DtCB3uJHB7+o7EcbDCrDE=;
        b=X7ATXUsY+tnwsmYw63OSvTtoXNrbHP0oMi7ZheLjANtmqz95bde84sFClS49rjy2q9
         XWWJpZiEl7Kn5zJul+7tTBGoYctCLhUfJI6W3ATkC6IPP8qEm8QUSdkdIADqMfFnpFd4
         F+ItqfX2GC4RcWs8jmi8SS1+f1CDwlDyXWFd32q3QZ5tReXSQCU6z3vg8wUlZYBoFYrC
         qHaLHgb0NWdn0FyUGzCdo3YYwcjsMGLmRi1UI0zBbkLUQptoyAnMeokR+g1jXbxXVkin
         W/C4MkNlvbOG4NOmnO3sLBZHklKecNxoLXDG8r/h4FBmb7qo4r6mq9rsE3iziyIR6yhF
         3i7w==
X-Gm-Message-State: AOAM530WPG+q38dAqTNwBPDqX7aejJh0B4fFBj8Fx06/D9kTcoGqpbpX
	6WH156jWVp4M8COQ5Ng1njBLX0hzORM=
X-Google-Smtp-Source: ABdhPJxoEfPhdYzTjv6Tjf19RWGnDkOoxkLuc9fwefPUxIW9a5eux1f5dVQomyxS40rU7wrVC1hEqA==
X-Received: by 2002:a17:906:86cf:: with SMTP id j15mr483778ejy.216.1611854792526;
        Thu, 28 Jan 2021 09:26:32 -0800 (PST)
From: cristian-vijelie <cristianvijelie@gmail.com>
To: minios-devel@lists.xen.org
Subject: [[UNIKRAFT/APP-LIBNETTLE_TEST] 3/3] Adding the source code
Date: Thu, 28 Jan 2021 19:26:27 +0200
Message-Id: <20210128172627.79524-4-cristianvijelie@gmail.com>
X-Mailer: git-send-email 2.25.1
In-Reply-To: <20210128172627.79524-1-cristianvijelie@gmail.com>
References: <20210128172627.79524-1-cristianvijelie@gmail.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit

The guest_fs folder contains the files needed by the app to run
corectly. The folder should be mounted as a 9p virtual filesystem
with qemu.

Signed-off-by: cristian-vijelie <cristianvijelie@gmail.com>
---
 guest_fs/gold-bug.txt | 1598 +++++++++++++++++++++++++++++++++++++++++
 guest_fs/test_nr      |    1 +
 include/testsuite.h   |   59 ++
 main.c                |  298 ++++++++
 4 files changed, 1956 insertions(+)
 create mode 100644 guest_fs/gold-bug.txt
 create mode 100644 guest_fs/test_nr
 create mode 100644 include/testsuite.h
 create mode 100644 main.c

diff --git a/guest_fs/gold-bug.txt b/guest_fs/gold-bug.txt
new file mode 100644
index 0000000..be3a2a0
--- /dev/null
+++ b/guest_fs/gold-bug.txt
@@ -0,0 +1,1598 @@
+Edgar Allan Poe
+
+The Gold-Bug
+
+
+What ho! what ho! this fellow is dancing mad!
+He hath been bitten by the Tarantula.
+                                  --All in the Wrong.
+
+
+Many years ago, I contracted an intimacy with a Mr. William
+Legrand.  He was of an ancient Huguenot family, and had once been
+wealthy: but a series of misfortunes had reduced him to want.  To
+avoid the mortification consequent upon his disasters, he left New
+Orleans, the city of his forefathers, and took up his residence at
+Sullivan's Island, near Charleston, South Carolina.
+
+This island is a very singular one.  It consists of little else
+than the sea sand, and is about three miles long.  Its breadth at
+no point exceeds a quarter of a mile.  It is separated from the
+mainland by a scarcely perceptible creek, oozing its way through a
+wilderness of reeds and slime, a favorite resort of the marsh hen.
+The vegetation, as might be supposed, is scant, or at least
+dwarfish.  No trees of any magnitude are to be seen.  Near the
+western extremity, where Fort Moultrie stands, and where are some
+miserable frame buildings, tenanted, during summer, by the
+fugitives from Charleston dust and fever, may be found, indeed, the
+bristly palmetto; but the whole island, with the exception of this
+western point, and a line of hard, white beach on the seacoast, is
+covered with a dense undergrowth of the sweet myrtle so much prized
+by the horticulturists of England.  The shrub here often attains
+the height of fifteen or twenty feet, and forms an almost
+impenetrable coppice, burdening the air with its fragrance.
+
+In the inmost recesses of this coppice, not far from the eastern or
+more remote end of the island, Legrand had built himself a small
+hut, which he occupied when I first, by mere accident, made his
+acquaintance.  This soon ripened into friendship--for there was
+much in the recluse to excite interest and esteem.  I found him
+well educated, with unusual powers of mind, but infected with
+misanthropy, and subject to perverse moods of alternate enthusiasm
+and melancholy.  He had with him many books, but rarely employed
+them.  His chief amusements were gunning and fishing, or sauntering
+along the beach and through the myrtles, in quest of shells or
+entomological specimens--his collection of the latter might have
+been envied by a Swammerdamm.  In these excursions he was usually
+accompanied by an old negro, called Jupiter, who had been
+manumitted before the reverses of the family, but who could be
+induced, neither by threats nor by promises, to abandon what he
+considered his right of attendance upon the footsteps of his young
+"Massa Will."  It is not improbable that the relatives of Legrand,
+conceiving him to be somewhat unsettled in intellect, had contrived
+to instill this obstinacy into Jupiter, with a view to the
+supervision and guardianship of the wanderer.
+
+The winters in the latitude of Sullivan's Island are seldom very
+severe, and in the fall of the year it is a rare event indeed when
+a fire is considered necessary.  About the middle of October, 18--,
+there occurred, however, a day of remarkable chilliness.  Just
+before sunset I scrambled my way through the evergreens to the hut
+of my friend, whom I had not visited for several weeks--my
+residence being, at that time, in Charleston, a distance of nine
+miles from the island, while the facilities of passage and
+repassage were very far behind those of the present day.  Upon
+reaching the hut I rapped, as was my custom, and getting no reply,
+sought for the key where I knew it was secreted, unlocked the door,
+and went in.  A fine fire was blazing upon the hearth.  It was a
+novelty, and by no means an ungrateful one.  I threw off an
+overcoat, took an armchair by the crackling logs, and awaited
+patiently the arrival of my hosts.
+
+Soon after dark they arrived, and gave me a most cordial welcome.
+Jupiter, grinning from ear to ear, bustled about to prepare some
+marsh hens for supper.  Legrand was in one of his fits--how else
+shall I term them?--of enthusiasm.  He had found an unknown
+bivalve, forming a new genus, and, more than this, he had hunted
+down and secured, with Jupiter's assistance, a scarabaeus which he
+believed to be totally new, but in respect to which he wished to
+have my opinion on the morrow.
+
+"And why not to-night?" I asked, rubbing my hands over the blaze,
+and wishing the whole tribe of scarabaei at the devil.
+
+"Ah, if I had only known you were here!" said Legrand, "but it's so
+long since I saw you; and how could I foresee that you would pay me
+a visit this very night of all others?  As I was coming home I met
+Lieutenant G----, from the fort, and, very foolishly, I lent him
+the bug; so it will be impossible for you to see it until the
+morning.  Stay here to-night, and I will send Jup down for it at
+sunrise.  It is the loveliest thing in creation!"
+
+"What?--sunrise?"
+
+"Nonsense! no!--the bug.  It is of a brilliant gold color--about
+the size of a large hickory nut--with two jet black spots near one
+extremity of the back, and another, somewhat longer, at the other.
+The antennae are--"
+
+"Dey ain't NO tin in him, Massa Will, I keep a tellin' on you,"
+here interrupted Jupiter; "de bug is a goole-bug, solid, ebery bit
+of him, inside and all, sep him wing--neber feel half so hebby a
+bug in my life."
+
+"Well, suppose it is, Jup," replied Legrand, somewhat more
+earnestly, it seemed to me, than the case demanded; "is that any
+reason for your letting the birds burn?  The color"--here he turned
+to me--"is really almost enough to warrant Jupiter's idea.  You
+never saw a more brilliant metallic luster than the scales emit--
+but of this you cannot judge till to-morrow.  In the meantime I can
+give you some idea of the shape."  Saying this, he seated himself
+at a small table, on which were a pen and ink, but no paper.  He
+looked for some in a drawer, but found none.
+
+"Never mind," he said at length, "this will answer;" and he drew
+from his waistcoat pocket a scrap of what I took to be very dirty
+foolscap, and made upon it a rough drawing with the pen.  While he
+did this, I retained my seat by the fire, for I was still chilly.
+When the design was complete, he handed it to me without rising.
+As I received it, a loud growl was heard, succeeded by a scratching
+at the door.  Jupiter opened it, and a large Newfoundland,
+belonging to Legrand, rushed in, leaped upon my shoulders, and
+loaded me with caresses; for I had shown him much attention during
+previous visits.  When his gambols were over, I looked at the
+paper, and, to speak the truth, found myself not a little puzzled
+at what my friend had depicted.
+
+"Well!" I said, after contemplating it for some minutes, "this IS a
+strange scarabaeus, I must confess; new to me; never saw anything
+like it before--unless it was a skull, or a death's head, which it
+more nearly resembles than anything else that has come under MY
+observation."
+
+"A death's head!" echoed Legrand.  "Oh--yes--well, it has something
+of that appearance upon paper, no doubt.  The two upper black spots
+look like eyes, eh? and the longer one at the bottom like a mouth--
+and then the shape of the whole is oval."
+
+"Perhaps so," said I; "but, Legrand, I fear you are no artist.  I
+must wait until I see the beetle itself, if I am to form any idea
+of its personal appearance."
+
+"Well, I don't know," said he, a little nettled, "I draw tolerably--
+SHOULD do it at least--have had good masters, and flatter myself
+that I am not quite a blockhead."
+
+"But, my dear fellow, you are joking then," said I, "this is a very
+passable SKULL--indeed, I may say that it is a very EXCELLENT
+skull, according to the vulgar notions about such specimens of
+physiology--and your scarabaeus must be the queerest scarabaeus in
+the world if it resembles it.  Why, we may get up a very thrilling
+bit of superstition upon this hint.  I presume you will call the
+bug Scarabaeus caput hominis, or something of that kind--there are
+many similar titles in the Natural Histories.  But where are the
+antennae you spoke of?"
+
+"The antennae!" said Legrand, who seemed to be getting
+unaccountably warm upon the subject; "I am sure you must see the
+antennae.  I made them as distinct as they are in the original
+insect, and I presume that is sufficient."
+
+"Well, well," I said, "perhaps you have--still I don't see them;"
+and I handed him the paper without additional remark, not wishing
+to ruffle his temper; but I was much surprised at the turn affairs
+had taken; his ill humor puzzled me--and, as for the drawing of the
+beetle, there were positively NO antennae visible, and the whole
+DID bear a very close resemblance to the ordinary cuts of a death's
+head.
+
+He received the paper very peevishly, and was about to crumple it,
+apparently to throw it in the fire, when a casual glance at the
+design seemed suddenly to rivet his attention.  In an instant his
+face grew violently red--in another excessively pale.  For some
+minutes he continued to scrutinize the drawing minutely where he
+sat.  At length he arose, took a candle from the table, and
+proceeded to seat himself upon a sea chest in the farthest corner
+of the room.  Here again he made an anxious examination of the
+paper, turning it in all directions.  He said nothing, however, and
+his conduct greatly astonished me; yet I thought it prudent not to
+exacerbate the growing moodiness of his temper by any comment.
+Presently he took from his coat pocket a wallet, placed the paper
+carefully in it, and deposited both in a writing desk, which he
+locked.  He now grew more composed in his demeanor; but his
+original air of enthusiasm had quite disappeared.  Yet he seemed
+not so much sulky as abstracted.  As the evening wore away he
+became more and more absorbed in reverie, from which no sallies of
+mine could arouse him.  It had been my intention to pass the night
+at the hut, as I had frequently done before, but, seeing my host in
+this mood, I deemed it proper to take leave.  He did not press me
+to remain, but, as I departed, he shook my hand with even more than
+his usual cordiality.
+
+It was about a month after this (and during the interval I had seen
+nothing of Legrand) when I received a visit, at Charleston, from
+his man, Jupiter.  I had never seen the good old negro look so
+dispirited, and I feared that some serious disaster had befallen my
+friend.
+
+"Well, Jup," said I, "what is the matter now?--how is your master?"
+
+"Why, to speak the troof, massa, him not so berry well as mought
+be."
+
+"Not well!  I am truly sorry to hear it.  What does he complain
+of?"
+
+"Dar! dot's it!--him neber 'plain of notin'--but him berry sick for
+all dat."
+
+"VERY sick, Jupiter!--why didn't you say so at once?  Is he
+confined to bed?"
+
+"No, dat he aint!--he aint 'fin'd nowhar--dat's just whar de shoe
+pinch--my mind is got to be berry hebby 'bout poor Massa Will."
+
+"Jupiter, I should like to understand what it is you are talking
+about.  You say your master is sick.  Hasn't he told you what ails
+him?"
+
+"Why, massa, 'taint worf while for to git mad about de matter--
+Massa Will say noffin at all aint de matter wid him--but den what
+make him go about looking dis here way, wid he head down and he
+soldiers up, and as white as a goose?  And den he keep a syphon all
+de time--"
+
+"Keeps a what, Jupiter?"
+
+"Keeps a syphon wid de figgurs on de slate--de queerest figgurs I
+ebber did see.  Ise gittin' to be skeered, I tell you.  Hab for to
+keep mighty tight eye 'pon him 'noovers.  Todder day he gib me slip
+'fore de sun up and was gone de whole ob de blessed day.  I had a
+big stick ready cut for to gib him deuced good beating when he did
+come--but Ise sich a fool dat I hadn't de heart arter all--he
+looked so berry poorly."
+
+"Eh?--what?--ah yes!--upon the whole I think you had better not be
+too severe with the poor fellow--don't flog him, Jupiter--he can't
+very well stand it--but can you form no idea of what has occasioned
+this illness, or rather this change of conduct?  Has anything
+unpleasant happened since I saw you?"
+
+"No, massa, dey aint bin noffin onpleasant SINCE den--'twas 'FORE
+den I'm feared--'twas de berry day you was dare."
+
+"How? what do you mean."
+
+"Why, massa, I mean de bug--dare now."
+
+"The what?"
+
+"De bug--I'm berry sartin dat Massa Will bin bit somewhere 'bout de
+head by dat goole-bug."
+
+"And what cause have you, Jupiter, for such a supposition?"
+
+"Claws enuff, massa, and mouff, too.  I nebber did see sich a
+deuced bug--he kick and he bite eberyting what cum near him.  Massa
+Will cotch him fuss, but had for to let him go 'gin mighty quick, I
+tell you--den was de time he must ha' got de bite.  I didn't like
+de look ob de bug mouff, myself, nohow, so I wouldn't take hold oh
+him wid my finger, but I cotch him wid a piece oh paper dat I
+found.  I rap him up in de paper and stuff a piece of it in he
+mouff--dat was de way."
+
+"And you think, then, that your master was really bitten by the
+beetle, and that the bite made him sick?"
+
+"I don't think noffin about it--I nose it.  What make him dream
+'bout de goole so much, if 'taint cause he bit by the goole-bug?
+Ise heered 'bout dem goole-bugs 'fore dis."
+
+"But how do you know he dreams about gold?"
+
+"How I know?  why, 'cause he talk about it in he sleep--dat's how I
+nose."
+
+"Well, Jup, perhaps you are right; but to what fortunate
+circumstance am I to attribute the honor of a visit from you to-
+day?"
+
+"What de matter, massa?"
+
+"Did you bring any message from Mr. Legrand?"
+
+"No, massa, I bring dis here pissel;" and here Jupiter handed me a
+note which ran thus:
+
+
+"MY DEAR ----
+
+"Why have I not seen you for so long a time?  I hope you have not
+been so foolish as to take offense at any little brusquerie of
+mine; but no, that is improbable.
+
+"Since I saw you I have had great cause for anxiety.  I have
+something to tell you, yet scarcely know how to tell it, or whether
+I should tell it at all.
+
+"I have not been quite well for some days past, and poor old Jup
+annoys me, almost beyond endurance, by his well-meant attentions.
+Would you believe it?--he had prepared a huge stick, the other day,
+with which to chastise me for giving him the slip, and spending the
+day, solus, among the hills on the mainland.  I verily believe that
+my ill looks alone saved me a flogging.
+
+"I have made no addition to my cabinet since we met.  "If you can,
+in any way, make it convenient, come over with Jupiter.  DO come.
+I wish to see you TO-NIGHT, upon business of importance.  I assure
+you that it is of the HIGHEST importance.
+
+"Ever yours,
+
+"WILLIAM LEGRAND."
+
+
+There was something in the tone of this note which gave me great
+uneasiness.  Its whole style differed materially from that of
+Legrand.  What could he be dreaming of?  What new crotchet
+possessed his excitable brain?  What "business of the highest
+importance" could HE possibly have to transact?  Jupiter's account
+of him boded no good.  I dreaded lest the continued pressure of
+misfortune had, at length, fairly unsettled the reason of my
+friend.  Without a moment's hesitation, therefore, I prepared to
+accompany the negro.
+
+Upon reaching the wharf, I noticed a scythe and three spades, all
+apparently new, lying in the bottom of the boat in which we were to
+embark.
+
+"What is the meaning of all this, Jup?" I inquired.
+
+"Him syfe, massa, and spade."
+
+"Very true; but what are they doing here?"
+
+"Him de syfe and de spade what Massa Will sis 'pon my buying for
+him in de town, and de debbil's own lot of money I had to gib for
+em."
+
+"But what, in the name of all that is mysterious, is your 'Massa
+Will' going to do with scythes and spades?"
+
+"Dat's more dan I know, and debbil take me if I don't b'lieve 'tis
+more dan he know too.  But it's all cum ob de bug."
+
+Finding that no satisfaction was to be obtained of Jupiter, whose
+whole intellect seemed to be absorbed by "de bug," I now stepped
+into the boat, and made sail.  With a fair and strong breeze we
+soon ran into the little cove to the northward of Fort Moultrie,
+and a walk of some two miles brought us to the hut.  It was about
+three in the afternoon when we arrived.  Legrand had been awaiting
+us in eager expectation.  He grasped my hand with a nervous
+empressement which alarmed me and strengthened the suspicions
+already entertained.  His countenance was pale even to ghastliness,
+and his deep-set eyes glared with unnatural luster.  After some
+inquiries respecting his health, I asked him, not knowing what
+better to say, if he had yet obtained the scarabaeus from
+Lieutenant G----.
+
+"Oh, yes," he replied, coloring violently, "I got it from him the
+next morning.  Nothing should tempt me to part with that
+scarabaeus.  Do you know that Jupiter is quite right about it?"
+
+"In what way?" I asked, with a sad foreboding at heart.
+
+"In supposing it to be a bug of REAL GOLD."  He said this with an
+air of profound seriousness, and I felt inexpressibly shocked.
+
+"This bug is to make my fortune," he continued, with a triumphant
+smile; "to reinstate me in my family possessions.  Is it any
+wonder, then, that I prize it?  Since Fortune has thought fit to
+bestow it upon me, I have only to use it properly, and I shall
+arrive at the gold of which it is the index.  Jupiter, bring me
+that scarabaeus!"
+
+"What! de bug, massa?  I'd rudder not go fer trubble dat bug; you
+mus' git him for your own self."  Hereupon Legrand arose, with a
+grave and stately air, and brought me the beetle from a glass case
+in which it was enclosed.  It was a beautiful scarabaeus, and, at
+that time, unknown to naturalists--of course a great prize in a
+scientific point of view.  There were two round black spots near
+one extremity of the back, and a long one near the other.  The
+scales were exceedingly hard and glossy, with all the appearance of
+burnished gold.  The weight of the insect was very remarkable, and,
+taking all things into consideration, I could hardly blame Jupiter
+for his opinion respecting it; but what to make of Legrand's
+concordance with that opinion, I could not, for the life of me,
+tell.
+
+"I sent for you," said he, in a grandiloquent tone, when I had
+completed my examination of the beetle, "I sent for you that I
+might have your counsel and assistance in furthering the views of
+Fate and of the bug--"
+
+"My dear Legrand," I cried, interrupting him, "you are certainly
+unwell, and had better use some little precautions.  You shall go
+to bed, and I will remain with you a few days, until you get over
+this.  You are feverish and--"
+
+"Feel my pulse," said he.
+
+I felt it, and, to say the truth, found not the slightest
+indication of fever.
+
+"But you may be ill and yet have no fever.  Allow me this once to
+prescribe for you.  In the first place go to bed.  In the next--"
+
+"You are mistaken," he interposed, "I am as well as I can expect to
+be under the excitement which I suffer.  If you really wish me
+well, you will relieve this excitement."
+
+"And how is this to be done?"
+
+"Very easily.  Jupiter and myself are going upon an expedition into
+the hills, upon the mainland, and, in this expedition, we shall
+need the aid of some person in whom we can confide.  You are the
+only one we can trust.  Whether we succeed or fail, the excitement
+which you now perceive in me will be equally allayed."
+
+"I am anxious to oblige you in any way," I replied; "but do you
+mean to say that this infernal beetle has any connection with your
+expedition into the hills?"
+
+"It has."
+
+"Then, Legrand, I can become a party to no such absurd proceeding."
+
+"I am sorry--very sorry--for we shall have to try it by ourselves."
+
+"Try it by yourselves!  The man is surely mad!--but stay!--how long
+do you propose to be absent?"
+
+"Probably all night.  We shall start immediately, and be back, at
+all events, by sunrise."
+
+"And will you promise me, upon your honor, that when this freak of
+yours is over, and the bug business (good God!) settled to your
+satisfaction, you will then return home and follow my advice
+implicitly, as that of your physician?"
+
+"Yes; I promise; and now let us be off, for we have no time to
+lose."
+
+With a heavy heart I accompanied my friend.  We started about four
+o'clock--Legrand, Jupiter, the dog, and myself.  Jupiter had with
+him the scythe and spades--the whole of which he insisted upon
+carrying--more through fear, it seemed to me, of trusting either of
+the implements within reach of his master, than from any excess of
+industry or complaisance.  His demeanor was dogged in the extreme,
+and "dat deuced bug" were the sole words which escaped his lips
+during the journey.  For my own part, I had charge of a couple of
+dark lanterns, while Legrand contented himself with the scarabaeus,
+which he carried attached to the end of a bit of whipcord; twirling
+it to and fro, with the air of a conjurer, as he went.  When I
+observed this last, plain evidence of my friend's aberration of
+mind, I could scarcely refrain from tears.  I thought it best,
+however, to humor his fancy, at least for the present, or until I
+could adopt some more energetic measures with a chance of success.
+In the meantime I endeavored, but all in vain, to sound him in
+regard to the object of the expedition.  Having succeeded in
+inducing me to accompany him, he seemed unwilling to hold
+conversation upon any topic of minor importance, and to all my
+questions vouchsafed no other reply than "we shall see!"
+
+We crossed the creek at the head of the island by means of a skiff,
+and, ascending the high grounds on the shore of the mainland,
+proceeded in a northwesterly direction, through a tract of country
+excessively wild and desolate, where no trace of a human footstep
+was to be seen.  Legrand led the way with decision; pausing only
+for an instant, here and there, to consult what appeared to be
+certain landmarks of his own contrivance upon a former occasion.
+
+In this manner we journeyed for about two hours, and the sun was
+just setting when we entered a region infinitely more dreary than
+any yet seen.  It was a species of table-land, near the summit of
+an almost inaccessible hill, densely wooded from base to pinnacle,
+and interspersed with huge crags that appeared to lie loosely upon
+the soil, and in many cases were prevented from precipitating
+themselves into the valleys below, merely by the support of the
+trees against which they reclined.  Deep ravines, in various
+directions, gave an air of still sterner solemnity to the scene.
+
+The natural platform to which we had clambered was thickly
+overgrown with brambles, through which we soon discovered that it
+would have been impossible to force our way but for the scythe; and
+Jupiter, by direction of his master, proceeded to clear for us a
+path to the foot of an enormously tall tulip tree, which stood,
+with some eight or ten oaks, upon the level, and far surpassed them
+all, and all other trees which I had then ever seen, in the beauty
+of its foliage and form, in the wide spread of its branches, and in
+the general majesty of its appearance.  When we reached this tree,
+Legrand turned to Jupiter, and asked him if he thought he could
+climb it.  The old man seemed a little staggered by the question,
+and for some moments made no reply.  At length he approached the
+huge trunk, walked slowly around it, and examined it with minute
+attention.  When he had completed his scrutiny, he merely said:
+
+"Yes, massa, Jup climb any tree he ebber see in he life."
+
+"Then up with you as soon as possible, for it will soon be too dark
+to see what we are about."
+
+"How far mus' go up, massa?" inquired Jupiter.
+
+"Get up the main trunk first, and then I will tell you which way to
+go--and here--stop! take this beetle with you."
+
+"De bug, Massa Will!--de goole-bug!" cried the negro, drawing back
+in dismay--"what for mus' tote de bug way up de tree?--d--n if I
+do!"
+
+"If you are afraid, Jup, a great big negro like you, to take hold
+of a harmless little dead beetle, why you can carry it up by this
+string--but, if you do not take it up with you in some way, I shall
+be under the necessity of breaking your head with this shovel."
+
+"What de matter now, massa?" said Jup, evidently shamed into
+compliance; "always want for to raise fuss wid old nigger.  Was
+only funnin anyhow.  ME feered de bug! what I keer for de bug?"
+Here he took cautiously hold of the extreme end of the string, and,
+maintaining the insect as far from his person as circumstances
+would permit, prepared to ascend the tree.
+
+In youth, the tulip tree, or Liriodendron tulipiferum, the most
+magnificent of American foresters, has a trunk peculiarly smooth,
+and often rises to a great height without lateral branches; but, in
+its riper age, the bark becomes gnarled and uneven, while many
+short limbs make their appearance on the stem.  Thus the difficulty
+of ascension, in the present case, lay more in semblance than in
+reality.  Embracing the huge cylinder, as closely as possible, with
+his arms and knees, seizing with his hands some projections, and
+resting his naked toes upon others, Jupiter, after one or two
+narrow escapes from falling, at length wriggled himself into the
+first great fork, and seemed to consider the whole business as
+virtually accomplished.  The RISK of the achievement was, in fact,
+now over, although the climber was some sixty or seventy feet from
+the ground.
+
+"Which way mus' go now, Massa Will?" he asked.
+
+"Keep up the largest branch--the one on this side," said Legrand.
+The negro obeyed him promptly, and apparently with but little
+trouble; ascending higher and higher, until no glimpse of his squat
+figure could be obtained through the dense foliage which enveloped
+it.  Presently his voice was heard in a sort of halloo.
+
+"How much fudder is got to go?"
+
+"How high up are you?" asked Legrand.
+
+"Ebber so fur," replied the negro; "can see de sky fru de top oh de
+tree."
+
+"Never mind the sky, but attend to what I say.  Look down the trunk
+and count the limbs below you on this side.  How many limbs have
+you passed?"
+
+"One, two, tree, four, fibe--I done pass fibe big limb, massa, 'pon
+dis side."
+
+"Then go one limb higher."
+
+In a few minutes the voice was heard again, announcing that the
+seventh limb was attained.
+
+"Now, Jup," cried Legrand, evidently much excited, "I want you to
+work your way out upon that limb as far as you can.  If you see
+anything strange let me know."
+
+By this time what little doubt I might have entertained of my poor
+friend's insanity was put finally at rest.  I had no alternative
+but to conclude him stricken with lunacy, and I became seriously
+anxious about getting him home.  While I was pondering upon what
+was best to be done, Jupiter's voice was again heard.
+
+"Mos feered for to ventur pon dis limb berry far--'tis dead limb
+putty much all de way."
+
+"Did you say it was a DEAD limb, Jupiter?" cried Legrand in a
+quavering voice.
+
+"Yes, massa, him dead as de door-nail--done up for sartin--done
+departed dis here life."
+
+"What in the name of heaven shall I do?" asked Legrand, seemingly
+in the greatest distress.
+
+"Do!" said I, glad of an opportunity to interpose a word, "why come
+home and go to bed.  Come now!--that's a fine fellow.  It's getting
+late, and, besides, you remember your promise."
+
+"Jupiter," cried he, without heeding me in the least, "do you hear
+me?"
+
+"Yes, Massa Will, hear you ebber so plain."
+
+"Try the wood well, then, with your knife, and see if you think it
+VERY rotten."
+
+"Him rotten, massa, sure nuff," replied the negro in a few moments,
+"but not so berry rotten as mought be.  Mought venture out leetle
+way pon de limb by myself, dat's true."
+
+"By yourself!--what do you mean?"
+
+"Why, I mean de bug.  'Tis BERRY hebby bug.  Spose I drop him down
+fuss, an den de limb won't break wid just de weight of one nigger."
+
+"You infernal scoundrel!" cried Legrand, apparently much relieved,
+"what do you mean by telling me such nonsense as that?  As sure as
+you drop that beetle I'll break your neck.  Look here, Jupiter, do
+you hear me?"
+
+"Yes, massa, needn't hollo at poor nigger dat style."
+
+"Well! now listen!--if you will venture out on the limb as far as
+you think safe, and not let go the beetle, I'll make you a present
+of a silver dollar as soon as you get down."
+
+"I'm gwine, Massa Will--deed I is," replied the negro very
+promptly--"mos out to the eend now."
+
+"OUT TO THE END!" here fairly screamed Legrand; "do you say you are
+out to the end of that limb?"
+
+"Soon be to de eend, massa--o-o-o-o-oh!  Lor-gol-a-marcy! what IS
+dis here pon de tree?"
+
+"Well!" cried Legrand, highly delighted, "what is it?"
+
+"Why 'taint noffin but a skull--somebody bin lef him head up de
+tree, and de crows done gobble ebery bit ob de meat off."
+
+"A skull, you say!--very well,--how is it fastened to the limb?--
+what holds it on?"
+
+"Sure nuff, massa; mus look.  Why dis berry curious sarcumstance,
+pon my word--dare's a great big nail in de skull, what fastens ob
+it on to de tree."
+
+"Well now, Jupiter, do exactly as I tell you--do you hear?"
+
+"Yes, massa."
+
+"Pay attention, then--find the left eye of the skull."
+
+"Hum! hoo! dat's good! why dey ain't no eye lef at all."
+
+"Curse your stupidity! do you know your right hand from your left?"
+
+"Yes, I knows dat--knows all about dat--'tis my lef hand what I
+chops de wood wid."
+
+"To be sure! you are left-handed; and your left eye is on the same
+side as your left hand.  Now, I suppose, you can find the left eye
+of the skull, or the place where the left eye has been.  Have you
+found it?"
+
+Here was a long pause.  At length the negro asked:
+
+"Is de lef eye of de skull pon de same side as de lef hand of de
+skull too?--cause de skull aint got not a bit oh a hand at all--
+nebber mind!  I got de lef eye now--here de lef eye! what mus do
+wid it?"
+
+Let the beetle drop through it, as far as the string will reach--
+but be careful and not let go your hold of the string."
+
+"All dat done, Massa Will; mighty easy ting for to put de bug fru
+de hole--look out for him dare below!"
+
+During this colloquy no portion of Jupiter's person could be seen;
+but the beetle, which he had suffered to descend, was now visible
+at the end of the string, and glistened, like a globe of burnished
+gold, in the last rays of the setting sun, some of which still
+faintly illumined the eminence upon which we stood.  The scarabaeus
+hung quite clear of any branches, and, if allowed to fall, would
+have fallen at our feet.  Legrand immediately took the scythe, and
+cleared with it a circular space, three or four yards in diameter,
+just beneath the insect, and, having accomplished this, ordered
+Jupiter to let go the string and come down from the tree.
+
+Driving a peg, with great nicety, into the ground, at the precise
+spot where the beetle fell, my friend now produced from his pocket
+a tape measure.  Fastening one end of this at that point of the
+trunk of the tree which was nearest the peg, he unrolled it till it
+reached the peg and thence further unrolled it, in the direction
+already established by the two points of the tree and the peg, for
+the distance of fifty feet--Jupiter clearing away the brambles with
+the scythe.  At the spot thus attained a second peg was driven, and
+about this, as a center, a rude circle, about four feet in
+diameter, described.  Taking now a spade himself, and giving one to
+Jupiter and one to me, Legrand begged us to set about digging as
+quickly as possible.
+
+To speak the truth, I had no especial relish for such amusement at
+any time, and, at that particular moment, would willingly have
+declined it; for the night was coming on, and I felt much fatigued
+with the exercise already taken; but I saw no mode of escape, and
+was fearful of disturbing my poor friend's equanimity by a refusal.
+Could I have depended, indeed, upon Jupiter's aid, I would have had
+no hesitation in attempting to get the lunatic home by force; but I
+was too well assured of the old negro's disposition, to hope that
+he would assist me, under any circumstances, in a personal contest
+with his master.  I made no doubt that the latter had been infected
+with some of the innumerable Southern superstitions about money
+buried, and that his fantasy had received confirmation by the
+finding of the scarabaeus, or, perhaps, by Jupiter's obstinacy in
+maintaining it to be "a bug of real gold."  A mind disposed to
+lunacy would readily be led away by such suggestions--especially if
+chiming in with favorite preconceived ideas--and then I called to
+mind the poor fellow's speech about the beetle's being "the index
+of his fortune."  Upon the whole, I was sadly vexed and puzzled,
+but, at length, I concluded to make a virtue of necessity--to dig
+with a good will, and thus the sooner to convince the visionary, by
+ocular demonstration, of the fallacy of the opinion he entertained.
+
+The lanterns having been lit, we all fell to work with a zeal
+worthy a more rational cause; and, as the glare fell upon our
+persons and implements, I could not help thinking how picturesque a
+group we composed, and how strange and suspicious our labors must
+have appeared to any interloper who, by chance, might have stumbled
+upon our whereabouts.
+
+We dug very steadily for two hours.  Little was said; and our chief
+embarrassment lay in the yelpings of the dog, who took exceeding
+interest in our proceedings.  He, at length, became so obstreperous
+that we grew fearful of his giving the alarm to some stragglers in
+the vicinity,--or, rather, this was the apprehension of Legrand;--
+for myself, I should have rejoiced at any interruption which might
+have enabled me to get the wanderer home.  The noise was, at
+length, very effectually silenced by Jupiter, who, getting out of
+the hole with a dogged air of deliberation, tied the brute's mouth
+up with one of his suspenders, and then returned, with a grave
+chuckle, to his task.
+
+When the time mentioned had expired, we had reached a depth of five
+feet, and yet no signs of any treasure became manifest.  A general
+pause ensued, and I began to hope that the farce was at an end.
+Legrand, however, although evidently much disconcerted, wiped his
+brow thoughtfully and recommenced.  We had excavated the entire
+circle of four feet diameter, and now we slightly enlarged the
+limit, and went to the farther depth of two feet.  Still nothing
+appeared.  The gold-seeker, whom I sincerely pitied, at length
+clambered from the pit, with the bitterest disappointment imprinted
+upon every feature, and proceeded, slowly and reluctantly, to put
+on his coat, which he had thrown off at the beginning of his labor.
+In the meantime I made no remark.  Jupiter, at a signal from his
+master, began to gather up his tools.  This done, and the dog
+having been unmuzzled, we turned in profound silence toward home.
+
+We had taken, perhaps, a dozen steps in this direction, when, with
+a loud oath, Legrand strode up to Jupiter, and seized him by the
+collar.  The astonished negro opened his eyes and mouth to the
+fullest extent, let fall the spades, and fell upon his knees.
+
+"You scoundrel!" said Legrand, hissing out the syllables from
+between his clenched teeth--"you infernal black villain!--speak, I
+tell you!--answer me this instant, without prevarication!--which--
+which is your left eye?"
+
+"Oh, my golly, Massa Will! aint dis here my lef eye for sartain?"
+roared the terrified Jupiter, placing his hand upon his RIGHT organ
+of vision, and holding it there with a desperate pertinacity, as if
+in immediate, dread of his master's attempt at a gouge.
+
+"I thought so!--I knew it! hurrah!" vociferated Legrand, letting
+the negro go and executing a series of curvets and caracols, much
+to the astonishment of his valet, who, arising from his knees,
+looked, mutely, from his master to myself, and then from myself to
+his master.
+
+"Come! we must go back," said the latter, "the game's not up yet;"
+and he again led the way to the tulip tree.
+
+"Jupiter," said he, when we reached its foot, "come here! was the
+skull nailed to the limb with the face outward, or with the face to
+the limb?"
+
+"De face was out, massa, so dat de crows could get at de eyes good,
+widout any trouble."
+
+"Well, then, was it this eye or that through which you dropped the
+beetle?" here Legrand touched each of Jupiter's eyes.
+
+"'Twas dis eye, massa--de lef eye--jis as you tell me," and here it
+was his right eye that the negro indicated.
+
+"That will do--we must try it again."
+
+Here my friend, about whose madness I now saw, or fancied that I
+saw, certain indications of method, removed the peg which marked
+the spot where the beetle fell, to a spot about three inches to the
+westward of its former position.  Taking, now, the tape measure
+from the nearest point of the trunk to the peg, as before, and
+continuing the extension in a straight line to the distance of
+fifty feet, a spot was indicated, removed, by several yards, from
+the point at which we had been digging.
+
+Around the new position a circle, somewhat larger than in the
+former instance, was now described, and we again set to work with
+the spade.  I was dreadfully weary, but, scarcely understanding
+what had occasioned the change in my thoughts, I felt no longer any
+great aversion from the labor imposed.  I had become most
+unaccountably interested--nay, even excited.  Perhaps there was
+something, amid all the extravagant demeanor of Legrand--some air
+of forethought, or of deliberation, which impressed me.  I dug
+eagerly, and now and then caught myself actually looking, with
+something that very much resembled expectation, for the fancied
+treasure, the vision of which had demented my unfortunate
+companion.  At a period when such vagaries of thought most fully
+possessed me, and when we had been at work perhaps an hour and a
+half, we were again interrupted by the violent howlings of the dog.
+His uneasiness, in the first instance, had been, evidently, but the
+result of playfulness or caprice, but he now assumed a bitter and
+serious tone.  Upon Jupiter's again attempting to muzzle him, he
+made furious resistance, and, leaping into the hole, tore up the
+mold frantically with his claws.  In a few seconds he had uncovered
+a mass of human bones, forming two complete skeletons, intermingled
+with several buttons of metal, and what appeared to be the dust of
+decayed woolen.  One or two strokes of a spade upturned the blade
+of a large Spanish knife, and, as we dug farther, three or four
+loose pieces of gold and silver coin came to light.
+
+At sight of these the joy of Jupiter could scarcely be restrained,
+but the countenance of his master wore an air of extreme
+disappointment.  He urged us, however, to continue our exertions,
+and the words were hardly uttered when I stumbled and fell forward,
+having caught the toe of my boot in a large ring of iron that lay
+half buried in the loose earth.
+
+We now worked in earnest, and never did I pass ten minutes of more
+intense excitement.  During this interval we had fairly unearthed
+an oblong chest of wood, which, from its perfect preservation and
+wonderful hardness, had plainly been subjected to some mineralizing
+process--perhaps that of the bichloride of mercury.  This box was
+three feet and a half long, three feet broad, and two and a half
+feet deep.  It was firmly secured by bands of wrought iron,
+riveted, and forming a kind of open trelliswork over the whole.  On
+each side of the chest, near the top, were three rings of iron--six
+in all--by means of which a firm hold could be obtained by six
+persons.  Our utmost united endeavors served only to disturb the
+coffer very slightly in its bed.  We at once saw the impossibility
+of removing so great a weight.  Luckily, the sole fastenings of the
+lid consisted of two sliding bolts.  These we drew back--trembling
+and panting with anxiety.  In an instant, a treasure of
+incalculable value lay gleaming before us.  As the rays of the
+lanterns fell within the pit, there flashed upward a glow and a
+glare, from a confused heap of gold and of jewels, that absolutely
+dazzled our eyes.
+
+I shall not pretend to describe the feelings with which I gazed.
+Amazement was, of course, predominant.  Legrand appeared exhausted
+with excitement, and spoke very few words.  Jupiter's countenance
+wore, for some minutes, as deadly a pallor as it is possible, in
+the nature of things, for any negro's visage to assume.  He seemed
+stupefied--thunderstricken.  Presently he fell upon his knees in
+the pit, and burying his naked arms up to the elbows in gold, let
+them there remain, as if enjoying the luxury of a bath.  At length,
+with a deep sigh, he exclaimed, as if in a soliloquy:
+
+"And dis all cum of de goole-bug! de putty goole-bug! de poor
+little goole-bug, what I boosed in that sabage kind oh style!
+Ain't you shamed oh yourself, nigger?--answer me dat!"
+
+It became necessary, at last, that I should arouse both master and
+valet to the expediency of removing the treasure.  It was growing
+late, and it behooved us to make exertion, that we might get
+everything housed before daylight.  It was difficult to say what
+should he done, and much time was spent in deliberation--so
+confused were the ideas of all.  We, finally, lightened the box by
+removing two thirds of its contents, when we were enabled, with
+some trouble, to raise it from the hole.  The articles taken out
+were deposited among the brambles, and the dog left to guard them,
+with strict orders from Jupiter neither, upon any pretense, to stir
+from the spot, nor to open his mouth until our return.  We then
+hurriedly made for home with the chest; reaching the hut in safety,
+but after excessive toil, at one o'clock in the morning.  Worn out
+as we were, it was not in human nature to do more immediately.  We
+rested until two, and had supper; starting for the hills
+immediately afterwards, armed with three stout sacks, which, by
+good luck, were upon the premises.  A little before four we arrived
+at the pit, divided the remainder of the booty, as equally as might
+be, among us, and, leaving the holes unfilled, again set out for
+the hut, at which, for the second time, we deposited our golden
+burdens, just as the first faint streaks of the dawn gleamed from
+over the treetops in the east.
+
+We were now thoroughly broken down; but the intense excitement of
+the time denied us repose.  After an unquiet slumber of some three
+or four hours' duration, we arose, as if by preconcert, to make
+examination of our treasure.
+
+The chest had been full to the brim, and we spent the whole day,
+and the greater part of the next night, in a scrutiny of its
+contents.  There had been nothing like order or arrangement.
+Everything had been heaped in promiscuously.  Having assorted all
+with care, we found ourselves possessed of even vaster wealth than
+we had at first supposed.  In coin there was rather more than four
+hundred and fifty thousand dollars--estimating the value of the
+pieces, as accurately as we could, by the tables of the period.
+There was not a particle of silver.  All was gold of antique date
+and of great variety--French, Spanish, and German money, with a few
+English guineas, and some counters, of which we had never seen
+specimens before.  There were several very large and heavy coins,
+so worn that we could make nothing of their inscriptions.  There
+was no American money.  The value of the jewels we found more
+difficulty in estimating.  There were diamonds--some of them
+exceedingly large and fine--a hundred and ten in all, and not one
+of them small; eighteen rubies of remarkable brilliancy;--three
+hundred and ten emeralds, all very beautiful; and twenty-one
+sapphires, with an opal.  These stones had all been broken from
+their settings and thrown loose in the chest.  The settings
+themselves, which we picked out from among the other gold, appeared
+to have been beaten up with hammers, as if to prevent
+identification.  Besides all this, there was a vast quantity of
+solid gold ornaments; nearly two hundred massive finger and ears
+rings; rich chains--thirty of these, if I remember; eighty-three
+very large and heavy crucifixes; five gold censers of great value;
+a prodigious golden punch bowl, ornamented with richly chased vine
+leaves and Bacchanalian figures; with two sword handles exquisitely
+embossed, and many other smaller articles which I cannot recollect.
+The weight of these valuables exceeded three hundred and fifty
+pounds avoirdupois; and in this estimate I have not included one
+hundred and ninety-seven superb gold watches; three of the number
+being worth each five hundred dollars, if one.  Many of them were
+very old, and as timekeepers valueless; the works having suffered,
+more or less, from corrosion--but all were richly jeweled and in
+cases of great worth.  We estimated the entire contents of the
+chest, that night, at a million and a half of dollars; and upon the
+subsequent disposal of the trinkets and jewels (a few being
+retained for our own use), it was found that we had greatly
+undervalued the treasure.
+
+When, at length, we had concluded our examination, and the intense
+excitement of the time had, in some measure, subsided, Legrand, who
+saw that I was dying with impatience for a solution of this most
+extraordinary riddle, entered into a full detail of all the
+circumstances connected with it.
+
+"You remember," said he, "the night when I handed you the rough
+sketch I had made of the scarabaeus.  You recollect, also, that I
+became quite vexed at you for insisting that my drawing resembled a
+death's head.  When you first made this assertion I thought you
+were jesting; but afterwards I called to mind the peculiar spots on
+the back of the insect, and admitted to myself that your remark had
+some little foundation in fact.  Still, the sneer at my graphic
+powers irritated me--for I am considered a good artist--and,
+therefore, when you handed me the scrap of parchment, I was about
+to crumple it up and throw it angrily into the fire."
+
+"The scrap of paper, you mean," said I.
+
+"No; it had much of the appearance of paper, and at first I
+supposed it to be such, but when I came to draw upon it, I
+discovered it at once to be a piece of very thin parchment.  It was
+quite dirty, you remember.  Well, as I was in the very act of
+crumpling it up, my glance fell upon the sketch at which you had
+been looking, and you may imagine my astonishment when I perceived,
+in fact, the figure of a death's head just where, it seemed to me,
+I had made the drawing of the beetle.  For a moment I was too much
+amazed to think with accuracy.  I knew that my design was very
+different in detail from this--although there was a certain
+similarity in general outline.  Presently I took a candle, and
+seating myself at the other end of the room, proceeded to
+scrutinize the parchment more closely.  Upon turning it over, I saw
+my own sketch upon the reverse, just as I had made it.  My first
+idea, now, was mere surprise at the really remarkable similarity of
+outline--at the singular coincidence involved in the fact that,
+unknown to me, there should have been a skull upon the other side
+of the parchment, immediately beneath my figure of the scarabaeus,
+and that this skull, not only in outline, but in size, should so
+closely resemble my drawing.  I say the singularity of this
+coincidence absolutely stupefied me for a time.  This is the usual
+effect of such coincidences.  The mind struggles to establish a
+connection--a sequence of cause and effect--and, being unable to do
+so, suffers a species of temporary paralysis.  But, when I
+recovered from this stupor, there dawned upon me gradually a
+conviction which startled me even far more than the coincidence.  I
+began distinctly, positively, to remember that there had been NO
+drawing upon the parchment, when I made my sketch of the
+scarabaeus.  I became perfectly certain of this; for I recollected
+turning up first one side and then the other, in search of the
+cleanest spot.  Had the skull been then there, of course I could
+not have failed to notice it.  Here was indeed a mystery which I
+felt it impossible to explain; but, even at that early moment,
+there seemed to glimmer, faintly, within the most remote and secret
+chambers of my intellect, a glow-wormlike conception of that truth
+which last night's adventure brought to so magnificent a
+demonstration.  I arose at once, and putting the parchment securely
+away, dismissed all further reflection until I should be alone.
+
+"When you had gone, and when Jupiter was fast asleep, I betook
+myself to a more methodical investigation of the affair.  In the
+first place I considered the manner in which the parchment had come
+into my possession.  The spot where we discovered the scarabaeus
+was on the coast of the mainland, about a mile eastward of the
+island, and but a short distance above high-water mark.  Upon my
+taking hold of it, it gave me a sharp bite, which caused me to let
+it drop.  Jupiter, with his accustomed caution, before seizing the
+insect, which had flown toward him, looked about him for a leaf, or
+something of that nature, by which to take hold of it.  It was at
+this moment that his eyes, and mine also, fell upon the scrap of
+parchment, which I then supposed to be paper.  It was lying half
+buried in the sand, a corner sticking up.  Near the spot where we
+found it, I observed the remnants of the hull of what appeared to
+have been a ship's longboat.  The wreck seemed to have been there
+for a very great while, for the resemblance to boat timbers could
+scarcely be traced.
+
+"Well, Jupiter picked up the parchment, wrapped the beetle in it,
+and gave it to me.  Soon afterwards we turned to go home, and on
+the way met Lieutenant G----.  I showed him the insect, and he
+begged me to let him take it to the fort.  Upon my consenting, he
+thrust it forthwith into his waistcoat pocket, without the
+parchment in which it had been wrapped, and which I had continued
+to hold in my hand during his inspection.  Perhaps he dreaded my
+changing my mind, and thought it best to make sure of the prize at
+once--you know how enthusiastic he is on all subjects connected
+with Natural History.  At the same time, without being conscious of
+it, I must have deposited the parchment in my own pocket.
+
+"You remember that when I went to the table, for the purpose of
+making a sketch of the beetle, I found no paper where it was
+usually kept.  I looked in the drawer, and found none there.  I
+searched my pockets, hoping to find an old letter, when my hand
+fell upon the parchment.  I thus detail the precise mode in which
+it came into my possession, for the circumstances impressed me with
+peculiar force.
+
+"No doubt you will think me fanciful--but I had already established
+a kind of CONNECTION.  I had put together two links of a great
+chain.  There was a boat lying upon a seacoast, and not far from
+the boat was a parchment--NOT A PAPER--with a skull depicted upon
+it.  You will, of course, ask 'where is the connection?'  I reply
+that the skull, or death's head, is the well-known emblem of the
+pirate.  The flag of the death's head is hoisted in all
+engagements.
+
+"I have said that the scrap was parchment, and not paper.
+Parchment is durable--almost imperishable.  Matters of little
+moment are rarely consigned to parchment; since, for the mere
+ordinary purposes of drawing or writing, it is not nearly so well
+adapted as paper.  This reflection suggested some meaning--some
+relevancy--in the death's head.  I did not fail to observe, also,
+the FORM of the parchment.  Although one of its corners had been,
+by some accident, destroyed, it could be seen that the original
+form was oblong.  It was just such a slip, indeed, as might have
+been chosen for a memorandum--for a record of something to be long
+remembered, and carefully preserved."
+
+"But," I interposed, "you say that the skull was NOT upon the
+parchment when you made the drawing of the beetle.  How then do you
+trace any connection between the boat and the skull--since this
+latter, according to your own admission, must have been designed
+(God only knows how or by whom) at some period subsequent to your
+sketching the scarabaeus?"
+
+"Ah, hereupon turns the whole mystery; although the secret, at this
+point, I had comparatively little difficulty in solving.  My steps
+were sure, and could afford but a single result.  I reasoned, for
+example, thus: When I drew the scarabaeus, there was no skull
+apparent upon the parchment.  When I had completed the drawing I
+gave it to you, and observed you narrowly until you returned it.
+YOU, therefore, did not design the skull, and no one else was
+present to do it.  Then it was not done by human agency.  And
+nevertheless it was done.
+
+"At this stage of my reflections I endeavored to remember, and DID
+remember, with entire distinctness, every incident which occurred
+about the period in question.  The weather was chilly (oh, rare and
+happy accident!), and a fire was blazing upon the hearth.  I was
+heated with exercise and sat near the table.  You, however, had
+drawn a chair close to the chimney.  Just as I placed the parchment
+in your hand, and as you were in the act of inspecting it, Wolf,
+the Newfoundland, entered, and leaped upon your shoulders.  With
+your left hand you caressed him and kept him off, while your right,
+holding the parchment, was permitted to fall listlessly between
+your knees, and in close proximity to the fire.  At one moment I
+thought the blaze had caught it, and was about to caution you, but,
+before I could speak, you had withdrawn it, and were engaged in its
+examination.  When I considered all these particulars, I doubted
+not for a moment that HEAT had been the agent in bringing to light,
+upon the parchment, the skull which I saw designed upon it.  You
+are well aware that chemical preparations exist, and have existed
+time out of mind, by means of which it is possible to write upon
+either paper or vellum, so that the characters shall become visible
+only when subjected to the action of fire.  Zaffre, digested in
+aqua regia, and diluted with four times its weight of water, is
+sometimes employed; a green tint results.  The regulus of cobalt,
+dissolved in spirit of niter, gives a red.  These colors disappear
+at longer or shorter intervals after the material written upon
+cools, but again become apparent upon the reapplication of heat.
+
+"I now scrutinized the death's head with care.  Its outer edges--
+the edges of the drawing nearest the edge of the vellum--were far
+more DISTINCT than the others.  It was clear that the action of the
+caloric had been imperfect or unequal.  I immediately kindled a
+fire, and subjected every portion of the parchment to a glowing
+heat.  At first, the only effect was the strengthening of the faint
+lines in the skull; but, upon persevering in the experiment, there
+became visible, at the corner of the slip, diagonally opposite to
+the spot in which the death's head was delineated, the figure of
+what I at first supposed to be a goat.  A closer scrutiny, however,
+satisfied me that it was intended for a kid."
+
+"Ha! ha!" said I, "to be sure I have no right to laugh at you--a
+million and a half of money is too serious a matter for mirth--but
+you are not about to establish a third link in your chain--you will
+not find any especial connection between your pirates and a goat--
+pirates, you know, have nothing to do with goats; they appertain to
+the farming interest."
+
+"But I have just said that the figure was NOT that of a goat."
+
+"Well, a kid then--pretty much the same thing."
+
+"Pretty much, but not altogether," said Legrand.  "You may have
+heard of one CAPTAIN Kidd.  I at once looked upon the figure of the
+animal as a kind of punning or hieroglyphical signature.  I say
+signature; because its position upon the vellum suggested this
+idea.  The death's head at the corner diagonally opposite, had, in
+the same manner, the air of a stamp, or seal.  But I was sorely put
+out by the absence of all else--of the body to my imagined
+instrument--of the text for my context."
+
+"I presume you expected to find a letter between the stamp and the
+signature."
+
+"Something of that kind.  The fact is, I felt irresistibly
+impressed with a presentiment of some vast good fortune impending.
+I can scarcely say why.  Perhaps, after all, it was rather a desire
+than an actual belief;--but do you know that Jupiter's silly words,
+about the bug being of solid gold, had a remarkable effect upon my
+fancy?  And then the series of accidents and coincidents--these
+were so VERY extraordinary.  Do you observe how mere an accident it
+was that these events should have occurred upon the SOLE day of all
+the year in which it has been, or may be sufficiently cool for
+fire, and that without the fire, or without the intervention of the
+dog at the precise moment in which he appeared, I should never have
+become aware of the death's head, and so never the possessor of the
+treasure?"
+
+"But proceed--I am all impatience."
+
+"Well; you have heard, of course, the many stories current--the
+thousand vague rumors afloat about money buried, somewhere upon the
+Atlantic coast, by Kidd and his associates.  These rumors must have
+had some foundation in fact.  And that the rumors have existed so
+long and so continuous, could have resulted, it appeared to me,
+only from the circumstance of the buried treasures still REMAINING
+entombed.  Had Kidd concealed his plunder for a time, and
+afterwards reclaimed it, the rumors would scarcely have reached us
+in their present unvarying form.  You will observe that the stories
+told are all about money-seekers, not about money-finders.  Had the
+pirate recovered his money, there the affair would have dropped.
+It seemed to me that some accident--say the loss of a memorandum
+indicating its locality--had deprived him of the means of
+recovering it, and that this accident had become known to his
+followers, who otherwise might never have heard that the treasure
+had been concealed at all, and who, busying themselves in vain,
+because unguided, attempts to regain it, had given first birth, and
+then universal currency, to the reports which are now so common.
+Have you ever heard of any important treasure being unearthed along
+the coast?"
+
+"Never."
+
+"But that Kidd's accumulations were immense, is well known.  I took
+it for granted, therefore, that the earth still held them; and you
+will scarcely be surprised when I tell you that I felt a hope,
+nearly amounting to certainty, that the parchment so strangely
+found involved a lost record of the place of deposit."
+
+"But how did you proceed?"
+
+"I held the vellum again to the fire, after increasing the heat,
+but nothing appeared.  I now thought it possible that the coating
+of dirt might have something to do with the failure: so I carefully
+rinsed the parchment by pouring warm water over it, and, having
+done this, I placed it in a tin pan, with the skull downward, and
+put the pan upon a furnace of lighted charcoal.  In a few minutes,
+the pan having become thoroughly heated, I removed the slip, and,
+to my inexpressible joy, found it spotted, in several places, with
+what appeared to be figures arranged in lines.  Again I placed it
+in the pan, and suffered it to remain another minute.  Upon taking
+it off, the whole was just as you see it now."
+
+Here Legrand, having reheated the parchment, submitted it to my
+inspection.  The following characters were rudely traced, in a red
+tint, between the death's head and the goat:
+
+
+"53++!305))6*;4826)4+)4+).;806*;48!8]60))85;1+8*:+(;:+*8!83(88)5*!;
+46(;88*96*?;8)*+(;485);5*!2:*+(;4956*2(5*-4)8]8*;4069285);)6!8)4++;
+1(+9;48081;8:8+1;48!85;4)485!528806*81(+9;48;(88;4(+?34;48)4+;161;:
+188;+?;"
+
+
+"But," said I, returning him the slip, "I am as much in the dark as
+ever.  Were all the jewels of Golconda awaiting me upon my solution
+of this enigma, I am quite sure that I should be unable to earn
+them."
+
+"And yet," said Legrand, "the solution is by no means so difficult
+as you might be led to imagine from the first hasty inspection of
+the characters.  These characters, as anyone might readily guess,
+form a cipher--that is to say, they convey a meaning; but then from
+what is known of Kidd, I could not suppose him capable of
+constructing any of the more abstruse cryptographs.  I made up my
+mind, at once, that this was of a simple species--such, however, as
+would appear, to the crude intellect of the sailor, absolutely
+insoluble without the key."
+
+"And you really solved it?"
+
+"Readily; I have solved others of an abstruseness ten thousand
+times greater.  Circumstances, and a certain bias of mind, have led
+me to take interest in such riddles, and it may well be doubted
+whether human ingenuity can construct an enigma of the kind which
+human ingenuity may not, by proper application, resolve.  In fact,
+having once established connected and legible characters, I
+scarcely gave a thought to the mere difficulty of developing their
+import.
+
+"In the present case--indeed in all cases of secret writing--the
+first question regards the LANGUAGE of the cipher; for the
+principles of solution, so far, especially, as the more simple
+ciphers are concerned, depend upon, and are varied by, the genius
+of the particular idiom.  In general, there is no alternative but
+experiment (directed by probabilities) of every tongue known to him
+who attempts the solution, until the true one be attained.  But,
+with the cipher now before us, all difficulty was removed by the
+signature.  The pun upon the word 'Kidd' is appreciable in no other
+language than the English.  But for this consideration I should
+have begun my attempts with the Spanish and French, as the tongues
+in which a secret of this kind would most naturally have been
+written by a pirate of the Spanish main.  As it was, I assumed the
+cryptograph to be English.
+
+"You observe there are no divisions between the words.  Had there
+been divisions the task would have been comparatively easy.  In
+such cases I should have commenced with a collation and analysis of
+the shorter words, and, had a word of a single letter occurred, as
+is most likely, (a or I, for example,) I should have considered the
+solution as assured.  But, there being no division, my first step
+was to ascertain the predominant letters, as well as the least
+frequent.  Counting all, I constructed a table thus:
+
+
+Of the character 8 there are 33.
+                 ;     "     26.
+                 4     "     19.
+                +)     "     16.
+                 *     "     13.
+                 5     "     12.
+                 6     "     11.
+                !1     "      8.
+                 0     "      6.
+                92     "      5.
+                :3     "      4.
+                 ?     "      3.
+                 ]     "      2.
+                -.     "      1.
+
+
+"Now, in English, the letter which most frequently occurs is e.
+Afterwards, the succession runs thus: a o i d h n r s t u y c f g l
+m w b k p q x z.  E predominates so remarkably, that an individual
+sentence of any length is rarely seen, in which it is not the
+prevailing character.
+
+"Here, then, we have, in the very beginning, the groundwork for
+something more than a mere guess.  The general use which may be
+made of the table is obvious--but, in this particular cipher, we
+shall only very partially require its aid.  As our predominant
+character is 8, we will commence by assuming it as the e of the
+natural alphabet.  To verify the supposition, let us observe if the
+8 be seen often in couples--for e is doubled with great frequency
+in English--in such words, for example, as 'meet,' 'fleet,'
+'speed,' 'seen,' 'been,' 'agree,' etc.  In the present instance we
+see it doubled no less than five times, although the cryptograph is
+brief.
+
+"Let us assume 8, then, as e.  Now, of all WORDS in the language,
+'the' is most usual; let us see, therefore, whether there are not
+repetitions of any three characters, in the same order of
+collocation, the last of them being 8.  If we discover repetitions
+of such letters, so arranged, they will most probably represent the
+word 'the.'  Upon inspection, we find no less than seven such
+arrangements, the characters being ;48.  We may, therefore, assume
+that ; represents t, 4 represents h, and 8 represents e--the last
+being now well confirmed.  Thus a great step has been taken.
+
+"But, having established a single word, we are enabled to establish
+a vastly important point; that is to say, several commencements and
+terminations of other words.  Let us refer, for example, to the
+last instance but one, in which the combination ;48 occurs--not far
+from the end of the cipher.  We know that the ; immediately ensuing
+is the commencement of a word, and, of the six characters
+succeeding this 'the,' we are cognizant of no less than five.  Let
+us set these characters down, thus, by the letters we know them to
+represent, leaving a space for the unknown--
+
+
+t eeth.
+
+
+"Here we are enabled, at once, to discard the 'th,' as forming no
+portion of the word commencing with the first t; since, by
+experiment of the entire alphabet for a letter adapted to the
+vacancy, we perceive that no word can be formed of which this th
+can be a part.  We are thus narrowed into
+
+
+t ee,
+
+
+and, going through the alphabet, if necessary, as before, we arrive
+at the word 'tree,' as the sole possible reading.  We thus gain
+another letter, r, represented by (, with the words 'the tree' in
+juxtaposition.
+
+"Looking beyond these words, for a short distance, we again see the
+combination ;48, and employ it by way of TERMINATION to what
+immediately precedes.  We have thus this arrangement:
+
+
+the tree ;4(4+?34 the,
+
+
+or, substituting the natural letters, where known, it reads thus:
+
+
+the tree thr+?3h the.
+
+
+"Now, if, in place of the unknown characters, we leave blank
+spaces, or substitute dots, we read thus:
+
+
+the tree thr...h the,
+
+
+when the word 'through' makes itself evident at once.  But this
+discovery gives us three new letters, o, u, and g, represented by
++, ?, and 3.
+
+"Looking now, narrowly, through the cipher for combinations of
+known characters, we find, not very far from the beginning, this
+arrangement,
+
+
+83(88, or egree,
+
+
+which plainly, is the conclusion of the word 'degree,' and gives us
+another letter, d, represented by !.
+
+"Four letters beyond the word 'degree,' we perceive the combination
+
+
+;46(;88.
+
+
+"Translating the known characters, and representing the unknown by
+dots, as before, we read thus:
+
+
+th.rtee,
+
+
+an arrangement immediately suggestive of the word thirteen,' and
+again furnishing us with two new characters, i and n, represented
+by 6 and *.
+
+"Referring, now, to the beginning of the cryptograph, we find the
+combination,
+
+
+53++!.
+
+
+"Translating as before, we obtain
+
+
+.good,
+
+
+which assures us that the first letter is A, and that the first two
+words are 'A good.'
+
+"It is now time that we arrange our key, as far as discovered, in a
+tabular form, to avoid confusion.  It will stand thus:
+
+
+5 represents a
+!     "      d
+8     "      e
+3     "      g
+4     "      h
+6     "      i
+*     "      n
++     "      o
+(     "      r
+;     "      t
+?     "      u
+
+
+"We have, therefore, no less than eleven of the most important
+letters represented, and it will be unnecessary to proceed with the
+details of the solution.  I have said enough to convince you that
+ciphers of this nature are readily soluble, and to give you some
+insight into the rationale of their development.  But be assured
+that the specimen before us appertains to the very simplest species
+of cryptograph.  It now only remains to give you the full
+translation of the characters upon the parchment, as unriddled.
+Here it is:
+
+
+"'A good glass in the bishop's hostel in the devil's seat forty-one
+degrees and thirteen minutes northeast and by north main branch
+seventh limb east side shoot from the left eye of the death's head
+a bee-line from the tree through the shot fifty feet out.'"
+
+
+"But," said I, "the enigma seems still in as bad a condition as
+ever.  How is it possible to extort a meaning from all this jargon
+about 'devil's seats,' 'death's heads,' and 'bishop's hostels'?"
+
+"I confess," replied Legrand, "that the matter still wears a
+serious aspect, when regarded with a casual glance.  My first
+endeavor was to divide the sentence into the natural division
+intended by the cryptographist."
+
+"You mean, to punctuate it?"
+
+"Something of that kind."
+
+"But how was it possible to effect this?"
+
+"I reflected that it had been a POINT with the writer to run his
+words together without division, so as to increase the difficulty
+of solution.  Now, a not overacute man, in pursuing such an object,
+would be nearly certain to overdo the matter.  When, in the course
+of his composition, he arrived at a break in his subject which
+would naturally require a pause, or a point, he would be
+exceedingly apt to run his characters, at this place, more than
+usually close together.  If you will observe the MS., in the
+present instance, you will easily detect five such cases of unusual
+crowding.  Acting upon this hint I made the division thus:
+
+
+"'A good glass in the bishop's hostel in the devil's seat--forty-
+one degrees and thirteen minutes--northeast and by north--main
+branch seventh limb east side--shoot from the left eye of the
+death's head--a bee-line from the tree through the shot fifty feet
+out.'"
+
+
+"Even this division," said I, "leaves me still in the dark."
+
+"It left me also in the dark," replied Legrand, "for a few days;
+during which I made diligent inquiry in the neighborhood of
+Sullivan's Island, for any building which went by name of the
+'Bishop's Hotel'; for, of course, I dropped the obsolete word
+'hostel.'  Gaining no information on the subject, I was on the
+point of extending my sphere of search, and proceeding in a more
+systematic manner, when, one morning, it entered into my head,
+quite suddenly, that this 'Bishop's Hostel' might have some
+reference to an old family, of the name of Bessop, which, time out
+of mind, had held possession of an ancient manor house, about four
+miles to the northward of the island.  I accordingly went over to
+the plantation, and reinstituted my inquiries among the older
+negroes of the place.  At length one of the most aged of the women
+said that she had heard of such a place as Bessop's Castle, and
+thought that she could guide me to it, but that it was not a
+castle, nor a tavern, but a high rock.
+
+"I offered to pay her well for her trouble, and, after some demur,
+she consented to accompany me to the spot.  We found it without
+much difficulty, when, dismissing her, I proceeded to examine the
+place.  The 'castle' consisted of an irregular assemblage of cliffs
+and rocks--one of the latter being quite remarkable for its height
+as well as for its insulated and artificial appearance.  I
+clambered to its apex, and then felt much at a loss as to what
+should be next done.
+
+"While I was busied in reflection, my eyes fell upon a narrow ledge
+in the eastern face of the rock, perhaps a yard below the summit
+upon which I stood.  This ledge projected about eighteen inches,
+and was not more than a foot wide, while a niche in the cliff just
+above it gave it a rude resemblance to one of the hollow-backed
+chairs used by our ancestors.  I made no doubt that here was the
+'devil's seat' alluded to in the MS., and now I seemed to grasp the
+full secret of the riddle.
+
+"The 'good glass,' I knew, could have reference to nothing but a
+telescope; for the word 'glass' is rarely employed in any other
+sense by seamen.  Now here, I at once saw, was a telescope to be
+used, and a definite point of view, ADMITTING NO VARIATION, from
+which to use it.  Nor did I hesitate to believe that the phrases,
+'forty-one degrees and thirteen minutes,' and 'northeast and by
+north,' were intended as directions for the leveling of the glass.
+Greatly excited by these discoveries, I hurried home, procured a
+telescope, and returned to the rock.
+
+"I let myself down to the ledge, and found that it was impossible
+to retain a seat upon it except in one particular position.  This
+fact confirmed my preconceived idea.  I proceeded to use the glass.
+Of course, the 'forty-one degrees and thirteen minutes' could
+allude to nothing but elevation above the visible horizon, since
+the horizontal direction was clearly indicated by the words,
+'northeast and by north.'  This latter direction I at once
+established by means of a pocket compass; then, pointing the glass
+as nearly at an angle of forty-one degrees of elevation as I could
+do it by guess, I moved it cautiously up or down, until my
+attention was arrested by a circular rift or opening in the foliage
+of a large tree that overtopped its fellows in the distance.  In
+the center of this rift I perceived a white spot, but could not, at
+first, distinguish what it was.  Adjusting the focus of the
+telescope, I again looked, and now made it out to be a human skull.
+
+"Upon this discovery I was so sanguine as to consider the enigma
+solved; for the phrase 'main branch, seventh limb, east side,'
+could refer only to the position of the skull upon the tree, while
+'shoot from the left eye of the death's head' admitted, also, of
+but one interpretation, in regard to a search for buried treasure.
+I perceived that the design was to drop a bullet from the left eye
+of the skull, and that a bee-line, or, in other words, a straight
+line, drawn from the nearest point of the trunk 'through the shot'
+(or the spot where the bullet fell), and thence extended to a
+distance of fifty feet, would indicate a definite point--and
+beneath this point I thought it at least POSSIBLE that a deposit of
+value lay concealed."
+
+"All this," I said, "is exceedingly clear, and, although ingenious,
+still simple and explicit.  When you left the Bishop's Hotel, what
+then?"
+
+"Why, having carefully taken the bearings of the tree, I turned
+homeward.  The instant that I left 'the devil's seat,' however, the
+circular rift vanished; nor could I get a glimpse of it afterwards,
+turn as I would.  What seems to me the chief ingenuity in this
+whole business, is the fact (for repeated experiment has convinced
+me it IS a fact) that the circular opening in question is visible
+from no other attainable point of view than that afforded by the
+narrow ledge upon the face of the rock.
+
+"In this expedition to the 'Bishop's Hotel' I had been attended by
+Jupiter, who had, no doubt, observed, for some weeks past, the
+abstraction of my demeanor, and took especial care not to leave me
+alone.  But, on the next day, getting up very early, I contrived to
+give him the slip, and went into the hills in search of the tree.
+After much toil I found it.  When I came home at night my valet
+proposed to give me a flogging.  With the rest of the adventure I
+believe you are as well acquainted as myself."
+
+"I suppose," said I, "you missed the spot, in the first attempt at
+digging, through Jupiter's stupidity in letting the bug fall
+through the right instead of through the left eye of the skull."
+
+"Precisely.  This mistake made a difference of about two inches and
+a half in the 'shot'--that is to say, in the position of the peg
+nearest the tree; and had the treasure been BENEATH the 'shot,' the
+error would have been of little moment; but 'the shot,' together
+with the nearest point of the tree, were merely two points for the
+establishment of a line of direction; of course the error, however
+trivial in the beginning, increased as we proceeded with the line,
+and by the time we had gone fifty feet threw us quite off the
+scent.  But for my deep-seated impressions that treasure was here
+somewhere actually buried, we might have had all our labor in
+vain."
+
+"But your grandiloquence, and your conduct in swinging the beetle--
+how excessively odd!  I was sure you were mad.  And why did you
+insist upon letting fall the bug, instead of a bullet, from the
+skull?"
+
+"Why, to be frank, I felt somewhat annoyed by your evident
+suspicions touching my sanity, and so resolved to punish you
+quietly, in my own way, by a little bit of sober mystification.
+For this reason I swung the beetle, and for this reason I let it
+fall from the tree.  An observation of yours about its great weight
+suggested the latter idea."
+
+"Yes, I perceive; and now there is only one point which puzzles me.
+What are we to make of the skeletons found in the hole?"
+
+"That is a question I am no more able to answer than yourself.
+There seems, however, only one plausible way of accounting for
+them--and yet it is dreadful to believe in such atrocity as my
+suggestion would imply.  It is clear that Kidd--if Kidd indeed
+secreted this treasure, which I doubt not--it is clear that he must
+have had assistance in the labor.  But this labor concluded, he may
+have thought it expedient to remove all participants in his secret.
+Perhaps a couple of blows with a mattock were sufficient, while his
+coadjutors were busy in the pit; perhaps it required a dozen--who
+shall tell?"
diff --git a/guest_fs/test_nr b/guest_fs/test_nr
new file mode 100644
index 0000000..d7d17fc
--- /dev/null
+++ b/guest_fs/test_nr
@@ -0,0 +1 @@
+-1
\ No newline at end of file
diff --git a/include/testsuite.h b/include/testsuite.h
new file mode 100644
index 0000000..ba2eca0
--- /dev/null
+++ b/include/testsuite.h
@@ -0,0 +1,59 @@
+#ifndef APP_LIBNETTLETEST_TESTSUITE_H
+#define APP_LIBNETTLETEST_TESTSUITE_H
+void test_main_aes(void);
+void test_main_arcfour(void);
+void test_main_arctwo(void);	
+void test_main_base16(void);
+void test_main_base64(void);
+void test_main_blowfish(void);
+void test_main_buffer(void);
+void test_main_camellia(void);	
+void test_main_cast128(void);
+void test_main_cbc(void);
+void test_main_ccm(void);
+void test_main_cfb(void);
+void test_main_chacha_poly1305(void);
+void test_main_chacha(void);
+void test_main_cmac(void);
+void test_main_ctr(void);
+void test_main_des(void);
+void test_main_des3(void);
+void test_main_eax(void);
+void test_main_gcm(void);
+void test_main_gosthash94(void);
+void test_main_hkdf(void);
+void test_main_hmac(void);
+void test_main_knuth(void);
+void test_main_md2(void);
+void test_main_md4(void);
+void test_main_md5_compat(void);
+void test_main_md5(void);
+void test_main_meta_aead(void);
+void test_main_meta_armor(void);
+void test_main_meta_ciphers(void);
+void test_main_meta_hash(void);
+void test_main_meta_mac(void);
+void test_main_pbkdf2(void);
+void test_main_poly1305(void);
+void test_main_ripemd160(void);
+void test_main_salsa20(void);
+void test_main_serpent(void);
+void test_main_sha1(void);
+void test_main_sha1_huge(void);
+void test_main_sha3_224(void);
+void test_main_sha3_256(void);
+void test_main_sha3_384(void);
+void test_main_sha3_512(void);
+void test_main_sha3_permute(void);
+void test_main_sha224(void);
+void test_main_sha256(void);
+void test_main_sha384(void);
+void test_main_sha512(void);
+void test_main_sha512_224(void);
+void test_main_sha512_256(void);
+void test_main_shake256(void);
+void test_main_twofish(void);
+void test_main_umac(void);
+void test_main_xts(void);
+void test_main_yarrow(void);
+#endif /* APP_LIBNETTLETEST_TESTSUITE_H */
diff --git a/main.c b/main.c
new file mode 100644
index 0000000..e9935f3
--- /dev/null
+++ b/main.c
@@ -0,0 +1,298 @@
+#include "include/testsuite.h"
+#include <stdio.h>
+
+int main()
+{
+	int tests_nr = -1, ret;
+	FILE *infile;
+
+	infile = fopen("test_nr", "r");
+	if (infile == NULL)
+	{
+		printf("ERROR: test_nr could not be opened!\n");
+		exit(1);
+	}
+
+	ret = fscanf(infile, "%d", &tests_nr);
+	if (ret == 0)
+	{
+		printf("ERROR: file test_nr should not be empty!\n");
+		exit(1);
+	}
+	
+	fclose(infile);
+
+	if (tests_nr == -1)
+	{
+		printf("\nSelect test suite: [1..11]\n");
+		printf("\t[0]\tALL\n");
+		printf("\t[1]\tMETA AEAD, META ARMOR, META CIPHERS, META HASH, META MAC, AES, ARCTWO, ARCFOUR, BASE16, BASE64, BLOWFISH,\n");
+		printf("\t\tBUFFER, CAMELLIA, CAST128, CBC, CCM, CFM, CHACHA, POLY1305, CMAC, CTR, DES, DES3, EAX, GCM, GOSTHASH94\n");
+		printf("\t[2]\tHKDF, HMAC, KNUTH, MD2, MD4, MD5\n");
+		printf("\t[3]\tPBKDF2, RIPEMD160, SALSA20, SERPENT\n");
+		printf("\t[4]\tSHA1 - WILL TAKE A LONG TIME\n");
+		printf("\t[5]\tSHA3-224\n");
+		printf("\t[6]\tSHA3-256\n");
+		printf("\t[7]\tSHA3-384\n");
+		printf("\t[8]\tSHA3-512\n");
+		printf("\t[9]\tSHA3 PERMUTE\n");
+		printf("\t[10]\tSHA224, SHA256, SHA384, SHA512, SHA512-224, SHA512-256, SHAKE256, TWOFISH, UMAC\n");
+		printf("\t[11]\tXTS, YARROW\n");
+
+		sleep(20);
+
+		return 0;
+	}
+
+	if (tests_nr == 1 || tests_nr == 0)
+	{
+		printf("Testing META AEAD...\n");
+		test_main_meta_aead();
+		printf("PASSED\n");
+
+		printf("Testing META ARMOR...\n");
+		test_main_meta_armor();
+		printf("PASSED\n");
+
+		printf("Testing META CIPHERS...\n");
+		test_main_meta_ciphers();
+		printf("PASSED\n");
+
+		printf("Testing META HASH...\n");
+		test_main_meta_hash();
+		printf("PASSED\n");
+
+		printf("Testing META MAC...\n");
+		test_main_meta_mac();
+		printf("PASSED\n");
+
+		printf("Testing AES...\n");
+		test_main_aes();
+		printf("PASSED\n");
+
+		printf("Testing ARCTWO...\n");
+		test_main_arctwo();
+		printf("PASSED\n");
+
+		printf("Testing ARCFOUR...\n");
+		test_main_arcfour();
+		printf("PASSED\n");
+
+		printf("Testing BASE16...\n");
+		test_main_base16();
+		printf("PASSED\n");
+
+		printf("Testing BASE64...\n");
+		test_main_base64();
+		printf("PASSED\n");
+
+		printf("Testing BLOWFISH...\n");
+		test_main_blowfish();
+		printf("PASSED\n");
+
+		printf("Testing BUFFER...\n");
+		test_main_buffer();
+		printf("PASSED\n");
+
+		printf("Testing CAMELLIA...\n");
+		test_main_camellia();
+		printf("PASSED\n");
+
+		printf("Testing CAST128...\n");
+		test_main_cast128();
+		printf("PASSED\n");
+
+		printf("Testing CBC...\n");
+		test_main_cbc();
+		printf("PASSED\n");
+
+		printf("Testing CCM...\n");
+		test_main_ccm();
+		printf("PASSED\n");
+
+		printf("Testing CFB...\n");
+		test_main_cfb();
+		printf("PASSED\n");
+
+		printf("Testing CHACHA...\n");
+		test_main_chacha();
+		printf("PASSED\n");
+
+		printf("Testing POLY1305...\n");
+		test_main_poly1305();
+		printf("PASSED\n");
+
+		printf("Testing CHACHA-POLY1305...\n");
+		test_main_chacha_poly1305();
+		printf("PASSED\n");
+
+		printf("Testing CMAC...\n");
+		test_main_cmac();
+		printf("PASSED\n");
+
+		printf("Testing CTR...\n");
+		test_main_ctr();
+		printf("PASSED\n");
+
+		printf("Testing DES...\n");
+		test_main_des();
+		printf("PASSED\n");
+
+		printf("Testing DES3...\n");
+		test_main_des3();
+		printf("PASSED\n");
+
+		printf("Testing EAX...\n");
+		test_main_eax();
+		printf("PASSED\n");
+
+		printf("Testing GCM...\n");
+		test_main_gcm();
+		printf("PASSED\n");
+
+		printf("Testing GOSTHASH94...\n");
+		test_main_gosthash94();
+		printf("PASSED\n");
+	}
+	if (tests_nr == 2 || tests_nr == 0)
+	{
+		printf("Testing HKDF...\n");
+		test_main_hkdf();
+		printf("PASSED\n");
+
+		printf("Testing HMAC...\n");
+		test_main_hmac();
+		printf("PASSED\n");
+
+		printf("Testing KNUTH...\n");
+		test_main_knuth();
+		printf("PASSED\n");
+
+		printf("Testing MD2...\n");
+		test_main_md2();
+		printf("PASSED\n");
+
+		printf("Testing MD4...\n");
+		test_main_md4();
+		printf("PASSED\n");
+
+		printf("Testing MD5-COMPAT...\n");
+		test_main_md5_compat();
+		printf("PASSED\n");
+
+		printf("Testing MD5...\n");
+		test_main_md5();
+		printf("PASSED\n");
+	}
+	if (tests_nr == 3 || tests_nr == 0)
+	{
+		printf("Testing PBKDF2...\n");
+		test_main_pbkdf2();
+		printf("PASSED\n");
+
+		printf("Testing RIPEMD160...\n");
+		test_main_ripemd160();
+		printf("PASSED\n");
+
+		printf("Testing SALSA20...\n");
+		test_main_salsa20();
+		printf("PASSED\n");
+
+		printf("Testing SERPENT...\n");
+		test_main_serpent();
+		printf("PASSED\n");
+	}
+	if (tests_nr == 4 || tests_nr == 0)
+	{
+		printf("Testing SHA1...\n");
+		test_main_sha1();
+		printf("PASSED\n");
+
+		printf("Testing SHA1 HUGE...\n");
+		test_main_sha1_huge();
+		printf("PASSED\n");
+	}
+	if (tests_nr == 5 || tests_nr == 0)
+	{
+		printf("Testing SHA3-224...\n");
+		test_main_sha3_224();
+		printf("PASSED\n");
+	}
+	if (tests_nr == 6 || tests_nr == 0)
+	{
+		printf("Testing SHA3 256...\n");
+		test_main_sha3_256();
+		printf("PASSED\n");
+	}
+	if (tests_nr == 7 || tests_nr == 0)
+	{
+		printf("Testing SHA3-384...\n");
+		test_main_sha3_384();
+		printf("PASSED\n");
+	}
+	if (tests_nr == 8 || tests_nr == 0)
+	{
+		printf("Testing SHA3-512...\n");
+		test_main_sha3_512();
+		printf("PASSED\n");
+	}
+	if (tests_nr == 9 || tests_nr == 0)
+	{
+		printf("Testing SHA3 PERMUTE...\n");
+		test_main_sha3_permute();
+		printf("PASSED\n");
+	}
+	if (tests_nr == 10 || tests_nr == 0)
+	{
+		printf("Testing SHA224...\n");
+		test_main_sha224();
+		printf("PASSED\n");
+
+		printf("Testing SHA256...\n");
+		test_main_sha256();
+		printf("PASSED\n");
+
+		printf("Testing SHA384...\n");
+		test_main_sha384();
+		printf("PASSED\n");
+
+		printf("Testing SHA512...\n");
+		test_main_sha512();
+		printf("PASSED\n");
+
+		printf("Testing SHA512-224...\n");
+		test_main_sha512_224();
+		printf("PASSED\n");
+
+		printf("Testing SHA512-256...\n");
+		test_main_sha512_256();
+		printf("PASSED\n");
+
+		printf("Testing SHAKE256...\n");
+		test_main_shake256();
+		printf("PASSED\n");
+
+		printf("Testing TWOFISH...\n");
+		test_main_twofish();
+		printf("PASSED\n");
+
+		printf("Testing UMAC...\n");
+		test_main_umac();
+		printf("PASSED\n");
+	}
+	if (tests_nr == 11 || tests_nr == 0)
+	{
+		printf("Testing XTS...\n");
+		test_main_xts();
+		printf("PASSED\n");
+
+		printf("Testing YARROW...\n");
+		test_main_yarrow();
+		printf("PASSED\n");
+	}
+
+	printf("All tests passed\n");
+	sleep(5);
+
+	return 0;
+}
-- 
2.25.1



From minios-devel-bounces@lists.xenproject.org Thu Jan 28 17:33:38 2021
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Thu, 28 Jan 2021 17:33:38 +0000
Received: from list by lists.xenproject.org with outflank-mailman.77336.140009 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1l5BAn-0004Qp-2M; Thu, 28 Jan 2021 17:33:37 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 77336.140009; Thu, 28 Jan 2021 17:33: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 1l5BAm-0004Qi-VK; Thu, 28 Jan 2021 17:33:36 +0000
Received: by outflank-mailman (input) for mailman id 77336;
 Thu, 28 Jan 2021 17:33: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=VIkR=G7=gmail.com=cezar.craciunoiu@srs-us1.protection.inumbo.net>)
 id 1l5BAm-0004Qd-8L
 for minios-devel@lists.xenproject.org; Thu, 28 Jan 2021 17:33:36 +0000
Received: from mail-ed1-x535.google.com (unknown [2a00:1450:4864:20::535])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id d2074ac6-f616-4143-a438-656c8046ac6a;
 Thu, 28 Jan 2021 17:33:34 +0000 (UTC)
Received: by mail-ed1-x535.google.com with SMTP id d22so7575978edy.1
 for <minios-devel@lists.xenproject.org>; Thu, 28 Jan 2021 09:33:34 -0800 (PST)
Received: from [192.168.0.3] ([86.120.251.107])
 by smtp.gmail.com with ESMTPSA id l17sm3386675edr.75.2021.01.28.09.33.32
 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128);
 Thu, 28 Jan 2021 09:33: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: d2074ac6-f616-4143-a438-656c8046ac6a
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=4EhS0ym549xG8X1y/bYiLFkCMyXCE7/kBEWTMELmTuY=;
        b=epN97XUbkDWb/bEKBrrizp+N9oOiDBNr73CvSI4dOSWZmNwt85CPeolu6NfLzmoQEV
         /QM7Ick8vX4zKZWEUD2lWnWyzCCl+iOo1ykt77fH83JDgyhtLxF+G71vsKwFGxxFcxHP
         n5oseAOxYWL7JlcKz9y0LlEmZ+8fWM5CrOuQREkmEGKuo4IPod2boMvvs1FJBEdYjr76
         LufQz3NRcKZcKaC4KWoFUNMk2jnbhnaYJfnHa8zZLl92RlYglogA+FNRmWmMWWC5ZDvj
         qK8WeEWs+Yi3b3a0U2xZhwvTgorgc38I5JdXLho02y6QqFWQkU6yNltuU1LfUbZCdgWL
         0vGg==
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=4EhS0ym549xG8X1y/bYiLFkCMyXCE7/kBEWTMELmTuY=;
        b=iMLll+28pwZky/XOpLVCgxbUcHQD+vLNDJheOtdK/U1xs7at5s1qfGpXaU3cXQqzlL
         ySCT1leedkvbhEKfqmG4PKgpAnakXEMVzVq3OmD32SkH0cqsRVHbdHt/fiHBxHCJsWqi
         efZcVJY3e2slWC4T9upQxyRoxeLVrfDe/vV7/O7Kc8GUs+Z35xMZmB91yUjIZrXRvhUT
         Aq86uUuIbYItpQRDEotng19EYF4wxEontTJxC+xrFr9pAlvecnHVIcQFpWaSvx3VYJRK
         bm9miCkwQxhTPFDilKwGDVv/aoqYRXJvxb+GjdMeKRwnyKgZHwMwbtUDZZsRS96yoWnB
         Er4A==
X-Gm-Message-State: AOAM530EfvfT/iqYUdmtPOR5KIi+HRLAxS9U052Gm1j9sto7aHxETTE6
	x3fnAmRwR9DlNBEc77P919M=
X-Google-Smtp-Source: ABdhPJxeFsiyBZdjflPq6DNUF/KKI1O6IK1dAiWWNigBp4mI68ZoVjP++DtZ07xd3ktPm1wR45yTGA==
X-Received: by 2002:a50:d6dc:: with SMTP id l28mr677785edj.105.1611855213819;
        Thu, 28 Jan 2021 09:33:33 -0800 (PST)
Content-Type: multipart/alternative;
 boundary="----=_NextPart_37774510.527647290025"
MIME-Version: 1.0
Date: Thu, 28 Jan 2021 19:33:15 +0200
Message-ID: <Mailbird-d6f2f9a1-7a50-4e5b-8a09-8770a9f0379c@gmail.com>
Subject: Re: [[UNIKRAFT/LIBNETTLE] v3 1/3] Introducing the library skeleton
From: "Cezar Craciunoiu" <cezar.craciunoiu@gmail.com>
To: "cristian-vijelie" <cristianvijelie@gmail.com>
Cc: "" <minios-devel@lists.xenproject.org>
In-Reply-To: <20210128170650.76513-2-cristianvijelie@gmail.com>
References: <20210128170650.76513-1-cristianvijelie@gmail.com>
 <20210128170650.76513-2-cristianvijelie@gmail.com>
User-Agent: Mailbird/2.9.16.0
X-Mailbird-ID: Mailbird-d6f2f9a1-7a50-4e5b-8a09-8770a9f0379c@gmail.com

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

Hey Cristian,

This patch looks good to me.

Reviewed-by: Cezar Craciunoiu <cezar.craciunoiu@gmail.com>

On 2021-01-28 19:07:11, cristian-vijelie <cristianvijelie@gmail.com> wrote:
Signed-off-by: cristian-vijelie
---
.gitignore | 0
CODING_STYLE.md | 4 ++++
CONTRIBUTING.md | 4 ++++
COPYING.md | 37 +++++++++++++++++++++++++++++++++++++
Config.uk | 17 +++++++++++++++++
MAINTAINERS.md | 10 ++++++++++
README.md | 10 ++++++++++
7 files changed, 82 insertions(+)
create mode 100644 .gitignore
create mode 100644 CODING_STYLE.md
create mode 100644 CONTRIBUTING.md
create mode 100644 COPYING.md
create mode 100644 Config.uk
create mode 100644 MAINTAINERS.md
create mode 100644 README.md

diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..e69de29
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
+=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+
+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
+=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+
+Please refer to the `CONTRIBUTING.md` file in the main Unikraft repository.
diff --git a/COPYING.md b/COPYING.md
new file mode 100644
index 0000000..3953481
--- /dev/null
+++ b/COPYING.md
@@ -0,0 +1,37 @@
+License
+=3D=3D=3D=3D=3D=3D=3D
+
+Unikraft Nettle wrappers
+----------------------------------
+
+This repository contains wrapper code to build Nettle cryptographic library
+with Unikraft. Each C code file in this repository should declare who is
+the copyright owner and under which terms and conditions the code is licen=
sed.
+If such a licence note is missing, the following copyright notice will app=
ly:
+
+ 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 I=
S"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
\ No newline at end of file
diff --git a/Config.uk b/Config.uk
new file mode 100644
index 0000000..6b7f7c6
--- /dev/null
+++ b/Config.uk
@@ -0,0 +1,17 @@
+menuconfig LIBNETTLE
+ bool "libnettle: Symmetric and one-way cryptographic library"
+ select LIBNEWLIBC
+ select LIBUK9P if PLAT_KVM
+ select LIB9PFS if PLAT_KVM
+ select LIBVFSCORE_AUTOMOUNT_ROOTFS if PLAT_KVM
+ default y
+
+if LIBNETTLE
+ config LIBNETTLE_TEST
+ bool "Provide test suite"
+ default n
+endif
+
+choice LIBVFSCORE_ROOTFS
+ default LIBVFSCORE_ROOTFS_9PFS
+endchoice
diff --git a/MAINTAINERS.md b/MAINTAINERS.md
new file mode 100644
index 0000000..c3a227d
--- /dev/null
+++ b/MAINTAINERS.md
@@ -0,0 +1,10 @@
+Maintainers List
+=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+
+For notes on how to read this information, please refer to `MAINTAINERS.md=
` in
+the main Unikraft repository.
+
+ LIBNETTLE-UNIKRAFT
+ M: Cristian Vijelie
+ L: minios-devel@lists.xen.org
+ F: *
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..1928478
--- /dev/null
+++ b/README.md
@@ -0,0 +1,10 @@
+Nettle crypto library for Unikraft
+=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
+
+This is the port of Nettle crypto library for Unikraft as external library.
+It requires newlibc to work. When adding the library in the dependencies l=
ist,
+the libraries should be like this:
+`...$(UK_LIBS)/nettle:$(UK_LIBS)/newlib:...`
+
+Please refer to the `README.md` as well as the documentation in the `doc/`
+subdirectory of the main unikraft repository.
--
2.25.1



------=_NextPart_37774510.527647290025
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                             =
           Hey Cristian,<div><br></div><div>This patch looks good to me.</d=
iv><div><br></div><div>Reviewed-by: Cezar Craciunoiu &lt;cezar.craciunoiu@g=
mail.com&gt;<br><div class=3D"mb_sig"></div><blockquote class=3D"history_co=
ntainer" type=3D"cite" style=3D"border-left-style:solid;border-width:1px; m=
argin-top:20px; margin-left:0px;padding-left:10px;">=0A                    =
    <p style=3D"color: #AAAAAA; margin-top: 10px;">On 2021-01-28 19:07:11, =
cristian-vijelie &lt;cristianvijelie@gmail.com&gt; wrote:</p><div style=3D"=
font-family:Arial,Helvetica,sans-serif">Signed-off-by: cristian-vijelie <cr=
istianvijelie@gmail.com>=0A<br>---=0A<br> .gitignore      |  0=0A<br> CODIN=
G_STYLE.md |  4 ++++=0A<br> CONTRIBUTING.md |  4 ++++=0A<br> COPYING.md    =
  | 37 +++++++++++++++++++++++++++++++++++++=0A<br> Config.uk       | 17 ++=
+++++++++++++++=0A<br> MAINTAINERS.md  | 10 ++++++++++=0A<br> README.md    =
   | 10 ++++++++++=0A<br> 7 files changed, 82 insertions(+)=0A<br> create m=
ode 100644 .gitignore=0A<br> create mode 100644 CODING_STYLE.md=0A<br> crea=
te mode 100644 CONTRIBUTING.md=0A<br> create mode 100644 COPYING.md=0A<br> =
create mode 100644 Config.uk=0A<br> create mode 100644 MAINTAINERS.md=0A<br=
> create mode 100644 README.md=0A<br>=0A<br>diff --git a/.gitignore b/.giti=
gnore=0A<br>new file mode 100644=0A<br>index 0000000..e69de29=0A<br>diff --=
git a/CODING_STYLE.md b/CODING_STYLE.md=0A<br>new file mode 100644=0A<br>in=
dex 0000000..5730041=0A<br>--- /dev/null=0A<br>+++ b/CODING_STYLE.md=0A<br>=
@@ -0,0 +1,4 @@=0A<br>+Coding Style=0A<br>+=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=0A<br>+=0A<br>+Please refer to the `CODING_STYLE.md` file in the mai=
n Unikraft repository.=0A<br>diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md=
=0A<br>new file mode 100644=0A<br>index 0000000..14f6ac6=0A<br>--- /dev/nul=
l=0A<br>+++ b/CONTRIBUTING.md=0A<br>@@ -0,0 +1,4 @@=0A<br>+Contributing to =
Unikraft=0A<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=0A<br>+=0A<br>+Please refer to the `CONTRIBUTING.md` file i=
n the main Unikraft repository.=0A<br>diff --git a/COPYING.md b/COPYING.md=
=0A<br>new file mode 100644=0A<br>index 0000000..3953481=0A<br>--- /dev/nul=
l=0A<br>+++ b/COPYING.md=0A<br>@@ -0,0 +1,37 @@=0A<br>+License=0A<br>+=3D=
=3D=3D=3D=3D=3D=3D=0A<br>+=0A<br>+Unikraft Nettle wrappers=0A<br>+---------=
-------------------------=0A<br>+=0A<br>+This repository contains wrapper c=
ode to build Nettle cryptographic library =0A<br>+with Unikraft. Each C cod=
e file in this repository should declare who is =0A<br>+the copyright owner=
 and under which terms and conditions the code is licensed.=0A<br>+If such =
a licence note is missing, the following copyright notice will apply:=0A<br=
>+=0A<br>+	Copyright (c) Year, Institution. All rights reserved.=0A<br>+=0A=
<br>+	Redistribution and use in source and binary forms, with or without=0A=
<br>+	modification, are permitted provided that the following conditions=0A=
<br>+	are met:=0A<br>+=0A<br>+	1. Redistributions of source code must retai=
n the above copyright=0A<br>+	   notice, this list of conditions and the fo=
llowing disclaimer.=0A<br>+	2. Redistributions in binary form must reproduc=
e the above copyright=0A<br>+	   notice, this list of conditions and the fo=
llowing disclaimer in the=0A<br>+	   documentation and/or other materials p=
rovided with the distribution.=0A<br>+	3. Neither the name of the copyright=
 holder nor the names of its=0A<br>+	   contributors may be used to endorse=
 or promote products derived from=0A<br>+	   this software without specific=
 prior written permission.=0A<br>+=0A<br>+	THIS SOFTWARE IS PROVIDED BY THE=
 COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"=0A<br>+	AND ANY EXPRESS OR IMPL=
IED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE=0A<br>+	IMPLIED WARRANTI=
ES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE=0A<br>+	ARE DISC=
LAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE=0A<br>+	L=
IABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR=0A<br>+	=
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF=0A<br>=
+	SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS=
=0A<br>+	INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETH=
ER IN=0A<br>+	CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR =
OTHERWISE)=0A<br>+	ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN=
 IF ADVISED OF THE=0A<br>+	POSSIBILITY OF SUCH DAMAGE.=0A<br>\ No newline a=
t end of file=0A<br>diff --git a/Config.uk b/Config.uk=0A<br>new file mode =
100644=0A<br>index 0000000..6b7f7c6=0A<br>--- /dev/null=0A<br>+++ b/Config.=
uk=0A<br>@@ -0,0 +1,17 @@=0A<br>+menuconfig LIBNETTLE=0A<br>+    bool "libn=
ettle: Symmetric and one-way cryptographic library"=0A<br>+    select LIBNE=
WLIBC=0A<br>+    select LIBUK9P if PLAT_KVM=0A<br>+    select LIB9PFS if PL=
AT_KVM=0A<br>+    select LIBVFSCORE_AUTOMOUNT_ROOTFS if PLAT_KVM=0A<br>+   =
 default y=0A<br>+=0A<br>+if LIBNETTLE=0A<br>+    config LIBNETTLE_TEST=0A<=
br>+    bool "Provide test suite"=0A<br>+    default n=0A<br>+endif=0A<br>+=
=0A<br>+choice LIBVFSCORE_ROOTFS=0A<br>+    default LIBVFSCORE_ROOTFS_9PFS=
=0A<br>+endchoice=0A<br>diff --git a/MAINTAINERS.md b/MAINTAINERS.md=0A<br>=
new file mode 100644=0A<br>index 0000000..c3a227d=0A<br>--- /dev/null=0A<br=
>+++ b/MAINTAINERS.md=0A<br>@@ -0,0 +1,10 @@=0A<br>+Maintainers List=0A<br>=
+=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=0A<br>+=0A<br>+For notes =
on how to read this information, please refer to `MAINTAINERS.md` in=0A<br>=
+the main Unikraft repository.=0A<br>+=0A<br>+	LIBNETTLE-UNIKRAFT=0A<br>+	M=
: 	Cristian Vijelie <cristianvijelie@gmail.com>=0A<br>+	L:	minios-devel@lis=
ts.xen.org=0A<br>+	F: *=0A<br>diff --git a/README.md b/README.md=0A<br>new =
file mode 100644=0A<br>index 0000000..1928478=0A<br>--- /dev/null=0A<br>+++=
 b/README.md=0A<br>@@ -0,0 +1,10 @@=0A<br>+Nettle crypto library for Unikra=
ft=0A<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=0A<br>+=0A<br>+This is the port of Nettle crypto l=
ibrary for Unikraft as external library.=0A<br>+It requires newlibc to work=
. When adding the library in the dependencies list,=0A<br>+the libraries sh=
ould be like this:=0A<br>+`...$(UK_LIBS)/nettle:$(UK_LIBS)/newlib:...`=0A<b=
r>+=0A<br>+Please refer to the `README.md` as well as the documentation in =
the `doc/`=0A<br>+subdirectory of the main unikraft repository.=0A<br>-- =
=0A<br>2.25.1=0A<br>=0A<br>=0A<br></cristianvijelie@gmail.com></cristianvij=
elie@gmail.com></div></blockquote>=0A                                      =
  =0A                                        </div></div>
------=_NextPart_37774510.527647290025--


From minios-devel-bounces@lists.xenproject.org Thu Jan 28 17:33:55 2021
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Thu, 28 Jan 2021 17:33:55 +0000
Received: from list by lists.xenproject.org with outflank-mailman.77337.140013 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1l5BB5-0004Rv-4c; Thu, 28 Jan 2021 17:33:55 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 77337.140013; Thu, 28 Jan 2021 17:33:55 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1l5BB5-0004Ro-1Y; Thu, 28 Jan 2021 17:33:55 +0000
Received: by outflank-mailman (input) for mailman id 77337;
 Thu, 28 Jan 2021 17:33: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=VIkR=G7=gmail.com=cezar.craciunoiu@srs-us1.protection.inumbo.net>)
 id 1l5BB3-0004Rj-Pp
 for minios-devel@lists.xenproject.org; Thu, 28 Jan 2021 17:33:53 +0000
Received: from mail-ej1-x62e.google.com (unknown [2a00:1450:4864:20::62e])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 9b16e72b-ba9c-4703-9da1-71dcb4c87d18;
 Thu, 28 Jan 2021 17:33:49 +0000 (UTC)
Received: by mail-ej1-x62e.google.com with SMTP id w1so8959055ejf.11
 for <minios-devel@lists.xenproject.org>; Thu, 28 Jan 2021 09:33:49 -0800 (PST)
Received: from [192.168.0.3] ([86.120.251.107])
 by smtp.gmail.com with ESMTPSA id p15sm2614880ejx.109.2021.01.28.09.33.48
 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128);
 Thu, 28 Jan 2021 09:33: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: 9b16e72b-ba9c-4703-9da1-71dcb4c87d18
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=/V4UTT2/Wd5xUeL50dwKYCgkjAOezILmXbgzpULQr7E=;
        b=npJJ4a/8rdYAH8xddFTqN1rm9tMqoSwBHCEsYJ9/St+SHKcx6qQQsYd7vrrxI0g0hV
         u4bvWxc2XDJc31kW0CHD3xD3WW1rqYopfwcDS0CzEHYVKDmldcY9ShVDQwKkHBxM392T
         x7pPBQOshyUVCmcufNng25OWL7BJQGN4K5PHKqybGjCgcw+3RUicoyOH3NdwE7AFVgTN
         zTtZxfWTI9cMCIRHTd4kkXXsuSpwJzJ7JjWmEfA24QldKwmtsHFTtbpdhuH6edYjllmv
         2+agFZMKPlkad6FPff7cKeTqCN1k2P94298o3uQQ9VY7zKB0VAHLjOVO1WDWOImLpe3g
         uFZw==
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=/V4UTT2/Wd5xUeL50dwKYCgkjAOezILmXbgzpULQr7E=;
        b=XMnXi33Yz/mLJ9PuSqlB8UtgarNUDu4QLpldu/m9zRW+8COvHGd/2266m4Ul59w1ka
         n+x4BVKpUDRRSK/mdccsCdaixtTzXv1SIbI9/XPg82MJtwxZ5jm+vXmzGD+NKxARGMzQ
         GIr0PLLkaB0hiF/ME/WRdg5cEZCyZJPcmwuhg9IRJA1klZJ3pkojntAhBIFX9PT6aMSJ
         GQqC9ohkv8zRD6Xh90BY8FeJK7Avl4OeficKtJKqLZlVnJUN+dBTOtoLvl9S0Pj/BJ7h
         R6A93TbCVbW0RpT/lWCMfWz7bVbSuEnxs5biSpp9GPjT7cENrRXz0L/vqeRiZxOiyhxr
         n67g==
X-Gm-Message-State: AOAM531CdbmfiWe9LsdDeWRjO6In9VMadg1O0Vqi0LxdgvbU+VQYBzYv
	mEUMmisug8CzHYKGD0Q2ANPn4hXMmxs=
X-Google-Smtp-Source: ABdhPJzRZYTb/45hKVc8RhSZH7wWH23k0wvKdsF9XP1lwNjw4FsY5c7d4W7s7q+b7bsQNUo5owwOdQ==
X-Received: by 2002:a17:906:abd7:: with SMTP id kq23mr518003ejb.292.1611855228991;
        Thu, 28 Jan 2021 09:33:48 -0800 (PST)
Content-Type: multipart/alternative;
 boundary="----=_NextPart_19520957.857309132540"
MIME-Version: 1.0
Date: Thu, 28 Jan 2021 19:33:31 +0200
Message-ID: <Mailbird-dcdcbc84-6852-4e89-baa5-ad35f5206ebc@gmail.com>
Subject: Re: [[UNIKRAFT/LIBNETTLE] v3 2/3] Adding Makefile.uk
From: "Cezar Craciunoiu" <cezar.craciunoiu@gmail.com>
To: "cristian-vijelie" <cristianvijelie@gmail.com>
Cc: "" <minios-devel@lists.xenproject.org>
In-Reply-To: <20210128170650.76513-3-cristianvijelie@gmail.com>
References: <20210128170650.76513-1-cristianvijelie@gmail.com>
 <20210128170650.76513-3-cristianvijelie@gmail.com>
User-Agent: Mailbird/2.9.16.0
X-Mailbird-ID: Mailbird-dcdcbc84-6852-4e89-baa5-ad35f5206ebc@gmail.com

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

Hey Cristian,

This patch looks good to me.

Reviewed-by: Cezar Craciunoiu <cezar.craciunoiu@gmail.com>
On 2021-01-28 19:07:20, cristian-vijelie <cristianvijelie@gmail.com> wrote:
Signed-off-by: cristian-vijelie
---
Makefile.uk | 435 ++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 435 insertions(+)
create mode 100644 Makefile.uk

diff --git a/Makefile.uk b/Makefile.uk
new file mode 100644
index 0000000..7b8f4d2
--- /dev/null
+++ b/Makefile.uk
@@ -0,0 +1,435 @@
+##########################################################################=
######
+# Library registration
+##########################################################################=
######
+$(eval $(call addlib_s,libnettle,$(CONFIG_LIBNETTLE)))
+
+##########################################################################=
######
+# Original sources
+##########################################################################=
######
+LIBNETTLE_VERSION=3D3.6
+LIBNETTLE_TARNAME=3Dnettle-$(LIBNETTLE_VERSION)
+LIBNETTLE_URL=3Dhttps://ftp.gnu.org/gnu/nettle/$(LIBNETTLE_TARNAME).tar.gz
+$(eval $(call fetch,libnettle,$(LIBNETTLE_URL)))
+LIBNETTLE_PATCHDIR=3D$(LIBNETTLE_BASE)/patches
+$(eval $(call patch,libnettle,$(LIBNETTLE_PATCHDIR),$(LIBNETTLE_TARNAME)))
+
+##########################################################################=
######
+# Helpers
+##########################################################################=
######
+LIBNETTLE_DIR =3D $(LIBNETTLE_ORIGIN)/$(LIBNETTLE_TARNAME)
+
+##########################################################################=
######
+# Library includes
+##########################################################################=
######
+LIBNETTLE-CINCLUDES-y =3D -I$(LIBNETTLE_DIR)
+
+##########################################################################=
######
+# Global flags
+##########################################################################=
######
+LIBNETTLE_CFLAGS =3D -DHAVE_CONFIG_H -g -O2 -ggdb3 -Wall -W -Wno-sign-comp=
are \
+-Wno-missing-prototypes -Wno-missing-declarations -Wstrict-prototypes \
+-Wpointer-arith -Wbad-function-cast -Wnested-externs -fpic -MT $@ -MD -MP \
+-MF $@.d
+
+##########################################################################=
######
+# Nettle code
+##########################################################################=
######
+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/aes-decrypt-internal.s
+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/aes-decrypt.c
+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/aes-encrypt-internal.s
+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/aes-encrypt.c
+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/aes-encrypt-table.c
+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/aes-invert-internal.c
+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/aes-set-key-internal.c
+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/aes-set-encrypt-key.c
+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/aes-set-decrypt-key.c
+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/aes128-set-encrypt-key.c
+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/aes128-set-decrypt-key.c
+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/aes128-meta.c
+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/aes192-set-encrypt-key.c
+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/aes192-set-decrypt-key.c
+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/aes192-meta.c
+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/aes256-set-encrypt-key.c
+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/aes256-set-decrypt-key.c
+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/aes256-meta.c
+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/arcfour.c
+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/arcfour-crypt.c
+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/arctwo.c
+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/arctwo-meta.c
+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/blowfish.c
+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/base16-encode.c
+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/base16-decode.c
+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/base16-meta.c
+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/base64-encode.c
+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/base64-decode.c
+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/base64-meta.c
+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/base64url-encode.c
+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/base64url-decode.c
+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/base64url-meta.c
+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/buffer.c
+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/buffer-init.c
+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/camellia-crypt-internal.s
+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/camellia-table.c
+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/camellia-absorb.c
+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/camellia-invert-key.c
+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/camellia128-set-encrypt-key.c
+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/camellia128-crypt.c
+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/camellia128-set-decrypt-key.c
+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/camellia128-meta.c
+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/camellia192-meta.c
+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/camellia256-set-encrypt-key.c
+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/camellia256-crypt.c
+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/camellia256-set-decrypt-key.c
+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/camellia256-meta.c
+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/cast128.c
+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/cast128-meta.c
+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/cbc.c
+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/ccm.c
+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/ccm-aes128.c
+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/ccm-aes192.c
+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/ccm-aes256.c
+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/cfb.c
+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/siv-cmac.c
+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/siv-cmac-aes128.c
+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/siv-cmac-aes256.c
+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/cnd-memcpy.c
+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/chacha-crypt.c
+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/chacha-core-internal.s
+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/chacha-poly1305.c
+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/chacha-poly1305-meta.c
+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/chacha-set-key.c
+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/chacha-set-nonce.c
+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/ctr.c
+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/ctr16.c
+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/des.c
+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/des3.c
+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/eax.c
+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/eax-aes128.c
+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/eax-aes128-meta.c
+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/gcm.c
+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/gcm-aes.c
+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/gcm-aes128.c
+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/gcm-aes128-meta.c
+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/gcm-aes192.c
+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/gcm-aes192-meta.c
+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/gcm-aes256.c
+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/gcm-aes256-meta.c
+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/gcm-camellia128.c
+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/gcm-camellia128-meta.c
+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/gcm-camellia256.c
+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/gcm-camellia256-meta.c
+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/cmac.c
+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/cmac64.c
+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/cmac-aes128.c
+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/cmac-aes256.c
+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/cmac-des3.c
+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/cmac-aes128-meta.c
+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/cmac-aes256-meta.c
+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/cmac-des3-meta.c
+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/gost28147.c
+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/gosthash94.c
+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/gosthash94-meta.c
+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/hmac.c
+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/hmac-gosthash94.c
+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/hmac-md5.c
+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/hmac-ripemd160.c
+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/hmac-sha1.c
+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/hmac-sha224.c
+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/hmac-sha256.c
+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/hmac-sha384.c
+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/hmac-sha512.c
+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/hmac-md5-meta.c
+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/hmac-ripemd160-meta.c
+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/hmac-sha1-meta.c
+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/hmac-sha224-meta.c
+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/hmac-sha256-meta.c
+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/hmac-sha384-meta.c
+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/hmac-sha512-meta.c
+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/knuth-lfib.c
+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/hkdf.c
+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/md2.c
+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/md2-meta.c
+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/md4.c
+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/md4-meta.c
+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/md5.c
+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/md5-compress.s
+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/md5-compat.c
+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/md5-meta.c
+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/memeql-sec.c
+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/memxor.s
+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/memxor3.s
+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/nettle-lookup-hash.c
+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/nettle-meta-aeads.c
+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/nettle-meta-armors.c
+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/nettle-meta-ciphers.c
+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/nettle-meta-hashes.c
+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/nettle-meta-macs.c
+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/pbkdf2.c
+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/pbkdf2-hmac-gosthash94.c
+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/pbkdf2-hmac-sha1.c
+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/pbkdf2-hmac-sha256.c
+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/poly1305-aes.c
+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/poly1305-internal.s
+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/realloc.c
+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/ripemd160.c
+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/ripemd160-compress.c
+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/ripemd160-meta.c
+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/salsa20-core-internal.s
+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/salsa20-crypt.c
+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/salsa20r12-crypt.c
+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/salsa20-set-key.c
+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/salsa20-set-nonce.c
+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/salsa20-128-set-key.c
+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/salsa20-256-set-key.c
+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/sha1.c
+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/sha1-compress.s
+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/sha1-meta.c
+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/sha256.c
+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/sha256-compress.s
+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/sha224-meta.c
+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/sha256-meta.c
+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/sha512.c
+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/sha512-compress.s
+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/sha384-meta.c
+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/sha512-meta.c
+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/sha512-224-meta.c
+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/sha512-256-meta.c
+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/sha3.c
+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/sha3-permute.s
+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/sha3-224.c
+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/sha3-224-meta.c
+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/sha3-256.c
+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/sha3-256-meta.c
+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/sha3-384.c
+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/sha3-384-meta.c
+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/sha3-512.c
+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/sha3-512-meta.c
+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/shake256.c
+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/serpent-set-key.c
+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/serpent-encrypt.s
+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/serpent-decrypt.s
+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/serpent-meta.c
+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/twofish.c
+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/twofish-meta.c
+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/umac-nh.s
+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/umac-nh-n.s
+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/umac-l2.c
+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/umac-l3.c
+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/umac-poly64.c
+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/umac-poly128.c
+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/umac-set-key.c
+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/umac32.c
+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/umac64.c
+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/umac96.c
+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/umac128.c
+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/version.c
+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/write-be32.c
+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/write-le32.c
+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/write-le64.c
+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/yarrow256.c
+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/yarrow_key_event.c
+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/xts.c
+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/xts-aes128.c
+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/xts-aes256.c
+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/gcm-hash8.s
+
+LIBNETTLE_SRCS-$(CONFIG_LIBNETTLE_TEST) +=3D $(LIBNETTLE_DIR)/aes-test.c
+LIBNETTLE_SRCS-$(CONFIG_LIBNETTLE_TEST) +=3D $(LIBNETTLE_DIR)/arcfour-test=
.c
+LIBNETTLE_SRCS-$(CONFIG_LIBNETTLE_TEST) +=3D $(LIBNETTLE_DIR)/arctwo-test.c
+LIBNETTLE_SRCS-$(CONFIG_LIBNETTLE_TEST) +=3D $(LIBNETTLE_DIR)/base16-test.c
+LIBNETTLE_SRCS-$(CONFIG_LIBNETTLE_TEST) +=3D $(LIBNETTLE_DIR)/base64-test.c
+LIBNETTLE_SRCS-$(CONFIG_LIBNETTLE_TEST) +=3D $(LIBNETTLE_DIR)/blowfish-tes=
t.c
+LIBNETTLE_SRCS-$(CONFIG_LIBNETTLE_TEST) +=3D $(LIBNETTLE_DIR)/buffer-test.c
+LIBNETTLE_SRCS-$(CONFIG_LIBNETTLE_TEST) +=3D $(LIBNETTLE_DIR)/camellia-tes=
t.c
+LIBNETTLE_SRCS-$(CONFIG_LIBNETTLE_TEST) +=3D $(LIBNETTLE_DIR)/cast128-test=
.c
+LIBNETTLE_SRCS-$(CONFIG_LIBNETTLE_TEST) +=3D $(LIBNETTLE_DIR)/cbc-test.c
+LIBNETTLE_SRCS-$(CONFIG_LIBNETTLE_TEST) +=3D $(LIBNETTLE_DIR)/ccm-test.c
+LIBNETTLE_SRCS-$(CONFIG_LIBNETTLE_TEST) +=3D $(LIBNETTLE_DIR)/cfb-test.c
+LIBNETTLE_SRCS-$(CONFIG_LIBNETTLE_TEST) +=3D $(LIBNETTLE_DIR)/chacha-poly1=
305-test.c
+LIBNETTLE_SRCS-$(CONFIG_LIBNETTLE_TEST) +=3D $(LIBNETTLE_DIR)/chacha-test.c
+LIBNETTLE_SRCS-$(CONFIG_LIBNETTLE_TEST) +=3D $(LIBNETTLE_DIR)/cmac-test.c
+LIBNETTLE_SRCS-$(CONFIG_LIBNETTLE_TEST) +=3D $(LIBNETTLE_DIR)/ctr-test.c
+LIBNETTLE_SRCS-$(CONFIG_LIBNETTLE_TEST) +=3D $(LIBNETTLE_DIR)/des-test.c
+LIBNETTLE_SRCS-$(CONFIG_LIBNETTLE_TEST) +=3D $(LIBNETTLE_DIR)/des3-test.c
+LIBNETTLE_SRCS-$(CONFIG_LIBNETTLE_TEST) +=3D $(LIBNETTLE_DIR)/eax-test.c
+LIBNETTLE_SRCS-$(CONFIG_LIBNETTLE_TEST) +=3D $(LIBNETTLE_DIR)/gcm-test.c
+LIBNETTLE_SRCS-$(CONFIG_LIBNETTLE_TEST) +=3D $(LIBNETTLE_DIR)/gosthash94-t=
est.c
+LIBNETTLE_SRCS-$(CONFIG_LIBNETTLE_TEST) +=3D $(LIBNETTLE_DIR)/hkdf-test.c
+LIBNETTLE_SRCS-$(CONFIG_LIBNETTLE_TEST) +=3D $(LIBNETTLE_DIR)/hmac-test.c
+LIBNETTLE_SRCS-$(CONFIG_LIBNETTLE_TEST) +=3D $(LIBNETTLE_DIR)/knuth-lfib-t=
est.c
+LIBNETTLE_SRCS-$(CONFIG_LIBNETTLE_TEST) +=3D $(LIBNETTLE_DIR)/md2-test.c
+LIBNETTLE_SRCS-$(CONFIG_LIBNETTLE_TEST) +=3D $(LIBNETTLE_DIR)/md4-test.c
+LIBNETTLE_SRCS-$(CONFIG_LIBNETTLE_TEST) +=3D $(LIBNETTLE_DIR)/md5-compat-t=
est.c
+LIBNETTLE_SRCS-$(CONFIG_LIBNETTLE_TEST) +=3D $(LIBNETTLE_DIR)/md5-test.c
+LIBNETTLE_SRCS-$(CONFIG_LIBNETTLE_TEST) +=3D $(LIBNETTLE_DIR)/meta-aead-te=
st.c
+LIBNETTLE_SRCS-$(CONFIG_LIBNETTLE_TEST) +=3D $(LIBNETTLE_DIR)/meta-armor-t=
est.c
+LIBNETTLE_SRCS-$(CONFIG_LIBNETTLE_TEST) +=3D $(LIBNETTLE_DIR)/meta-cipher-=
test.c
+LIBNETTLE_SRCS-$(CONFIG_LIBNETTLE_TEST) +=3D $(LIBNETTLE_DIR)/meta-hash-te=
st.c
+LIBNETTLE_SRCS-$(CONFIG_LIBNETTLE_TEST) +=3D $(LIBNETTLE_DIR)/meta-mac-tes=
t.c
+LIBNETTLE_SRCS-$(CONFIG_LIBNETTLE_TEST) +=3D $(LIBNETTLE_DIR)/pbkdf2-test.c
+LIBNETTLE_SRCS-$(CONFIG_LIBNETTLE_TEST) +=3D $(LIBNETTLE_DIR)/poly1305-tes=
t.c
+LIBNETTLE_SRCS-$(CONFIG_LIBNETTLE_TEST) +=3D $(LIBNETTLE_DIR)/ripemd160-te=
st.c
+LIBNETTLE_SRCS-$(CONFIG_LIBNETTLE_TEST) +=3D $(LIBNETTLE_DIR)/salsa20-test=
.c
+LIBNETTLE_SRCS-$(CONFIG_LIBNETTLE_TEST) +=3D $(LIBNETTLE_DIR)/serpent-test=
.c
+LIBNETTLE_SRCS-$(CONFIG_LIBNETTLE_TEST) +=3D $(LIBNETTLE_DIR)/sha1-huge-te=
st.c
+LIBNETTLE_SRCS-$(CONFIG_LIBNETTLE_TEST) +=3D $(LIBNETTLE_DIR)/sha1-test.c
+LIBNETTLE_SRCS-$(CONFIG_LIBNETTLE_TEST) +=3D $(LIBNETTLE_DIR)/sha3-224-tes=
t.c
+LIBNETTLE_SRCS-$(CONFIG_LIBNETTLE_TEST) +=3D $(LIBNETTLE_DIR)/sha3-256-tes=
t.c
+LIBNETTLE_SRCS-$(CONFIG_LIBNETTLE_TEST) +=3D $(LIBNETTLE_DIR)/sha3-384-tes=
t.c
+LIBNETTLE_SRCS-$(CONFIG_LIBNETTLE_TEST) +=3D $(LIBNETTLE_DIR)/sha3-512-tes=
t.c
+LIBNETTLE_SRCS-$(CONFIG_LIBNETTLE_TEST) +=3D $(LIBNETTLE_DIR)/sha3-permute=
-test.c
+LIBNETTLE_SRCS-$(CONFIG_LIBNETTLE_TEST) +=3D $(LIBNETTLE_DIR)/sha224-test.c
+LIBNETTLE_SRCS-$(CONFIG_LIBNETTLE_TEST) +=3D $(LIBNETTLE_DIR)/sha256-test.c
+LIBNETTLE_SRCS-$(CONFIG_LIBNETTLE_TEST) +=3D $(LIBNETTLE_DIR)/sha384-test.c
+LIBNETTLE_SRCS-$(CONFIG_LIBNETTLE_TEST) +=3D $(LIBNETTLE_DIR)/sha512-224-t=
est.c
+LIBNETTLE_SRCS-$(CONFIG_LIBNETTLE_TEST) +=3D $(LIBNETTLE_DIR)/sha512-256-t=
est.c
+LIBNETTLE_SRCS-$(CONFIG_LIBNETTLE_TEST) +=3D $(LIBNETTLE_DIR)/sha512-test.c
+LIBNETTLE_SRCS-$(CONFIG_LIBNETTLE_TEST) +=3D $(LIBNETTLE_DIR)/shake256-tes=
t.c
+LIBNETTLE_SRCS-$(CONFIG_LIBNETTLE_TEST) +=3D $(LIBNETTLE_DIR)/twofish-test=
.c
+LIBNETTLE_SRCS-$(CONFIG_LIBNETTLE_TEST) +=3D $(LIBNETTLE_DIR)/umac-test.c
+LIBNETTLE_SRCS-$(CONFIG_LIBNETTLE_TEST) +=3D $(LIBNETTLE_DIR)/xts-test.c
+LIBNETTLE_SRCS-$(CONFIG_LIBNETTLE_TEST) +=3D $(LIBNETTLE_DIR)/yarrow-test.c
+LIBNETTLE_SRCS-$(CONFIG_LIBNETTLE_TEST) +=3D $(LIBNETTLE_DIR)/testutils.c
+LIBNETTLE_SRCS-$(CONFIG_LIBNETTLE_TEST) +=3D $(LIBNETTLE_DIR)/nettle-inter=
nal.c
+
+##########################################################################=
######
+# Nettle prepare
+##########################################################################=
######
+# Run ./configure
+$(LIBNETTLE_DIR)/.configured: $(LIBNETTLE_BUILD)/.origin
+ $(call verbose_cmd,CONFIG,libnettle: $(notdir $@), cd $(LIBNETTLE_DIR) &&=
 ./configure && touch $@ && cp config.h testsuite/)
+
+# Generate assembly files
+
+LIBNETTLE_ASSEMBLY_DEPS =3D $(LIBNETTLE_DIR)/asm.m4 $(LIBNETTLE_DIR)/machi=
ne.m4 $(LIBNETTLE_DIR)/config.m4
+
+$(LIBNETTLE_DIR)/aes-decrypt-internal.s: $(LIBNETTLE_ASSEMBLY_DEPS) $(LIBN=
ETTLE_DIR)/aes-decrypt-internal.asm
+ $(call verbose_cmd,GEN,libnettle: $(notdir $@), cd $(LIBNETTLE_DIR) && /u=
sr/bin/m4 $^ >$@)
+$(LIBNETTLE_DIR)/aes-encrypt-internal.s: $(LIBNETTLE_ASSEMBLY_DEPS) $(LIBN=
ETTLE_DIR)/aes-encrypt-internal.asm
+ $(call verbose_cmd,GEN,libnettle: $(notdir $@), cd $(LIBNETTLE_DIR) && /u=
sr/bin/m4 $^ >$@)
+$(LIBNETTLE_DIR)/camellia-crypt-internal.s: $(LIBNETTLE_ASSEMBLY_DEPS) $(L=
IBNETTLE_DIR)/camellia-crypt-internal.asm
+ $(call verbose_cmd,GEN,libnettle: $(notdir $@), cd $(LIBNETTLE_DIR) && /u=
sr/bin/m4 $^ >$@)
+$(LIBNETTLE_DIR)/chacha-core-internal.s: $(LIBNETTLE_ASSEMBLY_DEPS) $(LIBN=
ETTLE_DIR)/chacha-core-internal.asm
+ $(call verbose_cmd,GEN,libnettle: $(notdir $@), cd $(LIBNETTLE_DIR) && /u=
sr/bin/m4 $^ >$@)
+$(LIBNETTLE_DIR)/md5-compress.s: $(LIBNETTLE_ASSEMBLY_DEPS) $(LIBNETTLE_DI=
R)/md5-compress.asm
+ $(call verbose_cmd,GEN,libnettle: $(notdir $@), cd $(LIBNETTLE_DIR) && /u=
sr/bin/m4 $^ >$@)
+$(LIBNETTLE_DIR)/memxor.s: $(LIBNETTLE_ASSEMBLY_DEPS) $(LIBNETTLE_DIR)/mem=
xor.asm
+ $(call verbose_cmd,GEN,libnettle: $(notdir $@), cd $(LIBNETTLE_DIR) && /u=
sr/bin/m4 $^ >$@)
+$(LIBNETTLE_DIR)/memxor3.s: $(LIBNETTLE_ASSEMBLY_DEPS) $(LIBNETTLE_DIR)/me=
mxor3.asm
+ $(call verbose_cmd,GEN,libnettle: $(notdir $@), cd $(LIBNETTLE_DIR) && /u=
sr/bin/m4 $^ >$@)
+$(LIBNETTLE_DIR)/poly1305-internal.s: $(LIBNETTLE_ASSEMBLY_DEPS) $(LIBNETT=
LE_DIR)/poly1305-internal.asm
+ $(call verbose_cmd,GEN,libnettle: $(notdir $@), cd $(LIBNETTLE_DIR) && /u=
sr/bin/m4 $^ >$@)
+$(LIBNETTLE_DIR)/salsa20-core-internal.s: $(LIBNETTLE_ASSEMBLY_DEPS) $(LIB=
NETTLE_DIR)/salsa20-core-internal.asm
+ $(call verbose_cmd,GEN,libnettle: $(notdir $@), cd $(LIBNETTLE_DIR) && /u=
sr/bin/m4 $^ >$@)
+$(LIBNETTLE_DIR)/salsa20-crypt.s: $(LIBNETTLE_ASSEMBLY_DEPS) $(LIBNETTLE_D=
IR)/salsa20-crypt.asm
+ $(call verbose_cmd,GEN,libnettle: $(notdir $@), cd $(LIBNETTLE_DIR) && /u=
sr/bin/m4 $^ >$@)
+$(LIBNETTLE_DIR)/sha1-compress.s: $(LIBNETTLE_ASSEMBLY_DEPS) $(LIBNETTLE_D=
IR)/sha1-compress.asm
+ $(call verbose_cmd,GEN,libnettle: $(notdir $@), cd $(LIBNETTLE_DIR) && /u=
sr/bin/m4 $^ >$@)
+$(LIBNETTLE_DIR)/sha256-compress.s: $(LIBNETTLE_ASSEMBLY_DEPS) $(LIBNETTLE=
_DIR)/sha256-compress.asm
+ $(call verbose_cmd,GEN,libnettle: $(notdir $@), cd $(LIBNETTLE_DIR) && /u=
sr/bin/m4 $^ >$@)
+$(LIBNETTLE_DIR)/sha512-compress.s: $(LIBNETTLE_ASSEMBLY_DEPS) $(LIBNETTLE=
_DIR)/sha512-compress.asm
+ $(call verbose_cmd,GEN,libnettle: $(notdir $@), cd $(LIBNETTLE_DIR) && /u=
sr/bin/m4 $^ >$@)
+$(LIBNETTLE_DIR)/sha3-permute.s: $(LIBNETTLE_ASSEMBLY_DEPS) $(LIBNETTLE_DI=
R)/sha3-permute.asm
+ $(call verbose_cmd,GEN,libnettle: $(notdir $@), cd $(LIBNETTLE_DIR) && /u=
sr/bin/m4 $^ >$@)
+$(LIBNETTLE_DIR)/serpent-encrypt.s: $(LIBNETTLE_ASSEMBLY_DEPS) $(LIBNETTLE=
_DIR)/serpent-encrypt.asm
+ $(call verbose_cmd,GEN,libnettle: $(notdir $@), cd $(LIBNETTLE_DIR) && /u=
sr/bin/m4 $^ >$@)
+$(LIBNETTLE_DIR)/serpent-decrypt.s: $(LIBNETTLE_ASSEMBLY_DEPS) $(LIBNETTLE=
_DIR)/serpent-decrypt.asm
+ $(call verbose_cmd,GEN,libnettle: $(notdir $@), cd $(LIBNETTLE_DIR) && /u=
sr/bin/m4 $^ >$@)
+$(LIBNETTLE_DIR)/umac-nh.s: $(LIBNETTLE_ASSEMBLY_DEPS) $(LIBNETTLE_DIR)/um=
ac-nh.asm
+ $(call verbose_cmd,GEN,libnettle: $(notdir $@), cd $(LIBNETTLE_DIR) && /u=
sr/bin/m4 $^ >$@)
+$(LIBNETTLE_DIR)/umac-nh-n.s: $(LIBNETTLE_ASSEMBLY_DEPS) $(LIBNETTLE_DIR)/=
umac-nh-n.asm
+ $(call verbose_cmd,GEN,libnettle: $(notdir $@), cd $(LIBNETTLE_DIR) && /u=
sr/bin/m4 $^ >$@)
+$(LIBNETTLE_DIR)/gcm-hash8.s: $(LIBNETTLE_ASSEMBLY_DEPS) $(LIBNETTLE_DIR)/=
gcm-hash8.asm
+ $(call verbose_cmd,GEN,libnettle: $(notdir $@), cd $(LIBNETTLE_DIR) && /u=
sr/bin/m4 $^ >$@)
+
+LIBNETTLE_TEST_SRCS =3D \
+ $(LIBNETTLE_DIR)/testsuite/aes-test.c \
+ $(LIBNETTLE_DIR)/testsuite/arcfour-test.c \
+ $(LIBNETTLE_DIR)/testsuite/arctwo-test.c \
+ $(LIBNETTLE_DIR)/testsuite/base16-test.c \
+ $(LIBNETTLE_DIR)/testsuite/base64-test.c \
+ $(LIBNETTLE_DIR)/testsuite/blowfish-test.c \
+ $(LIBNETTLE_DIR)/testsuite/buffer-test.c \
+ $(LIBNETTLE_DIR)/testsuite/camellia-test.c \
+ $(LIBNETTLE_DIR)/testsuite/cast128-test.c \
+ $(LIBNETTLE_DIR)/testsuite/cbc-test.c \
+ $(LIBNETTLE_DIR)/testsuite/ccm-test.c \
+ $(LIBNETTLE_DIR)/testsuite/cfb-test.c \
+ $(LIBNETTLE_DIR)/testsuite/chacha-poly1305-test.c \
+ $(LIBNETTLE_DIR)/testsuite/chacha-test.c \
+ $(LIBNETTLE_DIR)/testsuite/cmac-test.c \
+ $(LIBNETTLE_DIR)/testsuite/ctr-test.c \
+ $(LIBNETTLE_DIR)/testsuite/des-test.c \
+ $(LIBNETTLE_DIR)/testsuite/des3-test.c \
+ $(LIBNETTLE_DIR)/testsuite/eax-test.c \
+ $(LIBNETTLE_DIR)/testsuite/gcm-test.c \
+ $(LIBNETTLE_DIR)/testsuite/gosthash94-test.c \
+ $(LIBNETTLE_DIR)/testsuite/hkdf-test.c \
+ $(LIBNETTLE_DIR)/testsuite/hmac-test.c \
+ $(LIBNETTLE_DIR)/testsuite/knuth-lfib-test.c \
+ $(LIBNETTLE_DIR)/testsuite/md2-test.c \
+ $(LIBNETTLE_DIR)/testsuite/md4-test.c \
+ $(LIBNETTLE_DIR)/testsuite/md5-compat-test.c \
+ $(LIBNETTLE_DIR)/testsuite/md5-test.c \
+ $(LIBNETTLE_DIR)/testsuite/meta-aead-test.c \
+ $(LIBNETTLE_DIR)/testsuite/meta-armor-test.c \
+ $(LIBNETTLE_DIR)/testsuite/meta-cipher-test.c \
+ $(LIBNETTLE_DIR)/testsuite/meta-hash-test.c \
+ $(LIBNETTLE_DIR)/testsuite/meta-mac-test.c \
+ $(LIBNETTLE_DIR)/testsuite/pbkdf2-test.c \
+ $(LIBNETTLE_DIR)/testsuite/poly1305-test.c \
+ $(LIBNETTLE_DIR)/testsuite/ripemd160-test.c \
+ $(LIBNETTLE_DIR)/testsuite/salsa20-test.c \
+ $(LIBNETTLE_DIR)/testsuite/serpent-test.c \
+ $(LIBNETTLE_DIR)/testsuite/sha1-huge-test.c \
+ $(LIBNETTLE_DIR)/testsuite/sha1-test.c \
+ $(LIBNETTLE_DIR)/testsuite/sha3-224-test.c \
+ $(LIBNETTLE_DIR)/testsuite/sha3-256-test.c \
+ $(LIBNETTLE_DIR)/testsuite/sha3-384-test.c \
+ $(LIBNETTLE_DIR)/testsuite/sha3-512-test.c \
+ $(LIBNETTLE_DIR)/testsuite/sha3-permute-test.c \
+ $(LIBNETTLE_DIR)/testsuite/sha224-test.c \
+ $(LIBNETTLE_DIR)/testsuite/sha256-test.c \
+ $(LIBNETTLE_DIR)/testsuite/sha384-test.c \
+ $(LIBNETTLE_DIR)/testsuite/sha512-224-test.c \
+ $(LIBNETTLE_DIR)/testsuite/sha512-256-test.c \
+ $(LIBNETTLE_DIR)/testsuite/sha512-test.c \
+ $(LIBNETTLE_DIR)/testsuite/shake256-test.c \
+ $(LIBNETTLE_DIR)/testsuite/twofish-test.c \
+ $(LIBNETTLE_DIR)/testsuite/umac-test.c \
+ $(LIBNETTLE_DIR)/testsuite/xts-test.c \
+ $(LIBNETTLE_DIR)/testsuite/yarrow-test.c \
+ $(LIBNETTLE_DIR)/testsuite/testutils.c \
+ $(LIBNETTLE_DIR)/testsuite/testutils.h
+
+
+$(LIBNETTLE_DIR)/testsuite/.deps: $(LIBNETTLE_TEST_SRCS)
+ $(call verbose_cmd,GEN,libnettle: $(notdir $@), cd $(LIBNETTLE_DIR)/tests=
uite && cp $^ $(LIBNETTLE_DIR) && touch $@)
+
+LIBNETTLE_PREPARED_DEPS =3D \
+ $(LIBNETTLE_DIR)/.configured \
+ $(LIBNETTLE_DIR)/aes-decrypt-internal.s \
+ $(LIBNETTLE_DIR)/aes-encrypt-internal.s \
+ $(LIBNETTLE_DIR)/camellia-crypt-internal.s \
+ $(LIBNETTLE_DIR)/chacha-core-internal.s \
+ $(LIBNETTLE_DIR)/md5-compress.s \
+ $(LIBNETTLE_DIR)/memxor.s \
+ $(LIBNETTLE_DIR)/memxor3.s \
+ $(LIBNETTLE_DIR)/poly1305-internal.s \
+ $(LIBNETTLE_DIR)/salsa20-core-internal.s \
+ $(LIBNETTLE_DIR)/salsa20-crypt.s \
+ $(LIBNETTLE_DIR)/sha1-compress.s \
+ $(LIBNETTLE_DIR)/sha256-compress.s \
+ $(LIBNETTLE_DIR)/sha512-compress.s \
+ $(LIBNETTLE_DIR)/sha3-permute.s \
+ $(LIBNETTLE_DIR)/serpent-encrypt.s \
+ $(LIBNETTLE_DIR)/serpent-decrypt.s \
+ $(LIBNETTLE_DIR)/umac-nh.s \
+ $(LIBNETTLE_DIR)/umac-nh-n.s \
+ $(LIBNETTLE_DIR)/gcm-hash8.s \
+ $(LIBNETTLE_DIR)/testsuite/.deps
+
+$(LIBNETTLE_BUILD)/.prepared : $(LIBNETTLE_PREPARED_DEPS)
+ $(call verbose_cmd,GEN,libnettle: $(notdir $@), cd $(LIBNETTLE_DIR) && to=
uch $@)
+
+UK_PREPARE +=3D $(LIBNETTLE_BUILD)/.prepared
--
2.25.1



------=_NextPart_19520957.857309132540
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 Cristian,</span><div st=
yle=3D"font-size: 13.3333px"><br></div><div style=3D"font-size: 13.3333px">=
This patch looks good to me.</div><div style=3D"font-size: 13.3333px"><br><=
/div><div style=3D"font-size: 13.3333px">Reviewed-by: Cezar Craciunoiu &lt;=
cezar.craciunoiu@gmail.com&gt;</div><div class=3D"mb_sig"></div><blockquote=
 class=3D"history_container" type=3D"cite" style=3D"border-left-style:solid=
;border-width:1px; margin-top:20px; margin-left:0px;padding-left:10px;">=0A=
                        <p style=3D"color: #AAAAAA; margin-top: 10px;">On 2=
021-01-28 19:07:20, cristian-vijelie &lt;cristianvijelie@gmail.com&gt; wrot=
e:</p><div style=3D"font-family:Arial,Helvetica,sans-serif">Signed-off-by: =
cristian-vijelie <cristianvijelie@gmail.com>=0A<br>---=0A<br> Makefile.uk |=
 435 ++++++++++++++++++++++++++++++++++++++++++++++++++++=0A<br> 1 file cha=
nged, 435 insertions(+)=0A<br> create mode 100644 Makefile.uk=0A<br>=0A<br>=
diff --git a/Makefile.uk b/Makefile.uk=0A<br>new file mode 100644=0A<br>ind=
ex 0000000..7b8f4d2=0A<br>--- /dev/null=0A<br>+++ b/Makefile.uk=0A<br>@@ -0=
,0 +1,435 @@=0A<br>+#######################################################=
#########################=0A<br>+# Library registration=0A<br>+############=
####################################################################=0A<br>=
+$(eval $(call addlib_s,libnettle,$(CONFIG_LIBNETTLE)))=0A<br>+=0A<br>+####=
###########################################################################=
#=0A<br>+# Original sources=0A<br>+########################################=
########################################=0A<br>+LIBNETTLE_VERSION=3D3.6=0A<=
br>+LIBNETTLE_TARNAME=3Dnettle-$(LIBNETTLE_VERSION)=0A<br>+LIBNETTLE_URL=3D=
https://ftp.gnu.org/gnu/nettle/$(LIBNETTLE_TARNAME).tar.gz=0A<br>+$(eval $(=
call fetch,libnettle,$(LIBNETTLE_URL)))=0A<br>+LIBNETTLE_PATCHDIR=3D$(LIBNE=
TTLE_BASE)/patches=0A<br>+$(eval $(call patch,libnettle,$(LIBNETTLE_PATCHDI=
R),$(LIBNETTLE_TARNAME)))=0A<br>+=0A<br>+##################################=
##############################################=0A<br>+# Helpers=0A<br>+####=
###########################################################################=
#=0A<br>+LIBNETTLE_DIR =3D $(LIBNETTLE_ORIGIN)/$(LIBNETTLE_TARNAME)=0A<br>+=
=0A<br>+###################################################################=
#############=0A<br>+# Library includes=0A<br>+############################=
####################################################=0A<br>+LIBNETTLE-CINCL=
UDES-y =3D -I$(LIBNETTLE_DIR)=0A<br>+=0A<br>+##############################=
##################################################=0A<br>+# Global flags=0A=
<br>+######################################################################=
##########=0A<br>+LIBNETTLE_CFLAGS =3D -DHAVE_CONFIG_H -g -O2 -ggdb3 -Wall =
-W -Wno-sign-compare   \=0A<br>+-Wno-missing-prototypes -Wno-missing-declar=
ations -Wstrict-prototypes   \=0A<br>+-Wpointer-arith -Wbad-function-cast -=
Wnested-externs -fpic -MT $@ -MD -MP \=0A<br>+-MF $@.d=0A<br>+=0A<br>+#####=
###########################################################################=
=0A<br>+# Nettle code=0A<br>+##############################################=
##################################=0A<br>+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE=
_DIR)/aes-decrypt-internal.s=0A<br>+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/=
aes-decrypt.c=0A<br>+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/aes-encrypt-int=
ernal.s=0A<br>+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/aes-encrypt.c=0A<br>+=
LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/aes-encrypt-table.c=0A<br>+LIBNETTLE=
_SRCS-y +=3D $(LIBNETTLE_DIR)/aes-invert-internal.c=0A<br>+LIBNETTLE_SRCS-y=
 +=3D $(LIBNETTLE_DIR)/aes-set-key-internal.c=0A<br>+LIBNETTLE_SRCS-y +=3D =
$(LIBNETTLE_DIR)/aes-set-encrypt-key.c=0A<br>+LIBNETTLE_SRCS-y +=3D $(LIBNE=
TTLE_DIR)/aes-set-decrypt-key.c=0A<br>+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DI=
R)/aes128-set-encrypt-key.c=0A<br>+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/a=
es128-set-decrypt-key.c=0A<br>+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/aes12=
8-meta.c=0A<br>+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/aes192-set-encrypt-k=
ey.c=0A<br>+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/aes192-set-decrypt-key.c=
=0A<br>+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/aes192-meta.c=0A<br>+LIBNETT=
LE_SRCS-y +=3D $(LIBNETTLE_DIR)/aes256-set-encrypt-key.c=0A<br>+LIBNETTLE_S=
RCS-y +=3D $(LIBNETTLE_DIR)/aes256-set-decrypt-key.c=0A<br>+LIBNETTLE_SRCS-=
y +=3D $(LIBNETTLE_DIR)/aes256-meta.c=0A<br>+LIBNETTLE_SRCS-y +=3D $(LIBNET=
TLE_DIR)/arcfour.c=0A<br>+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/arcfour-cr=
ypt.c=0A<br>+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/arctwo.c=0A<br>+LIBNETT=
LE_SRCS-y +=3D $(LIBNETTLE_DIR)/arctwo-meta.c=0A<br>+LIBNETTLE_SRCS-y +=3D =
$(LIBNETTLE_DIR)/blowfish.c=0A<br>+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/b=
ase16-encode.c=0A<br>+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/base16-decode.=
c=0A<br>+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/base16-meta.c=0A<br>+LIBNET=
TLE_SRCS-y +=3D $(LIBNETTLE_DIR)/base64-encode.c=0A<br>+LIBNETTLE_SRCS-y +=
=3D $(LIBNETTLE_DIR)/base64-decode.c=0A<br>+LIBNETTLE_SRCS-y +=3D $(LIBNETT=
LE_DIR)/base64-meta.c=0A<br>+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/base64u=
rl-encode.c=0A<br>+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/base64url-decode.=
c=0A<br>+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/base64url-meta.c=0A<br>+LIB=
NETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/buffer.c=0A<br>+LIBNETTLE_SRCS-y +=3D $=
(LIBNETTLE_DIR)/buffer-init.c=0A<br>+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)=
/camellia-crypt-internal.s=0A<br>+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/ca=
mellia-table.c=0A<br>+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/camellia-absor=
b.c=0A<br>+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/camellia-invert-key.c=0A<=
br>+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/camellia128-set-encrypt-key.c=0A=
<br>+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/camellia128-crypt.c=0A<br>+LIBN=
ETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/camellia128-set-decrypt-key.c=0A<br>+LIB=
NETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/camellia128-meta.c=0A<br>+LIBNETTLE_SRC=
S-y +=3D $(LIBNETTLE_DIR)/camellia192-meta.c=0A<br>+LIBNETTLE_SRCS-y +=3D $=
(LIBNETTLE_DIR)/camellia256-set-encrypt-key.c=0A<br>+LIBNETTLE_SRCS-y +=3D =
$(LIBNETTLE_DIR)/camellia256-crypt.c=0A<br>+LIBNETTLE_SRCS-y +=3D $(LIBNETT=
LE_DIR)/camellia256-set-decrypt-key.c=0A<br>+LIBNETTLE_SRCS-y +=3D $(LIBNET=
TLE_DIR)/camellia256-meta.c=0A<br>+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/c=
ast128.c=0A<br>+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/cast128-meta.c=0A<br=
>+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/cbc.c=0A<br>+LIBNETTLE_SRCS-y +=3D=
 $(LIBNETTLE_DIR)/ccm.c=0A<br>+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/ccm-a=
es128.c=0A<br>+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/ccm-aes192.c=0A<br>+L=
IBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/ccm-aes256.c=0A<br>+LIBNETTLE_SRCS-y =
+=3D $(LIBNETTLE_DIR)/cfb.c=0A<br>+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/s=
iv-cmac.c=0A<br>+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/siv-cmac-aes128.c=
=0A<br>+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/siv-cmac-aes256.c=0A<br>+LIB=
NETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/cnd-memcpy.c=0A<br>+LIBNETTLE_SRCS-y +=
=3D $(LIBNETTLE_DIR)/chacha-crypt.c=0A<br>+LIBNETTLE_SRCS-y +=3D $(LIBNETTL=
E_DIR)/chacha-core-internal.s=0A<br>+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)=
/chacha-poly1305.c=0A<br>+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/chacha-pol=
y1305-meta.c=0A<br>+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/chacha-set-key.c=
=0A<br>+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/chacha-set-nonce.c=0A<br>+LI=
BNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/ctr.c=0A<br>+LIBNETTLE_SRCS-y +=3D $(L=
IBNETTLE_DIR)/ctr16.c=0A<br>+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/des.c=
=0A<br>+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/des3.c=0A<br>+LIBNETTLE_SRCS=
-y +=3D $(LIBNETTLE_DIR)/eax.c=0A<br>+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR=
)/eax-aes128.c=0A<br>+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/eax-aes128-met=
a.c=0A<br>+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/gcm.c=0A<br>+LIBNETTLE_SR=
CS-y +=3D $(LIBNETTLE_DIR)/gcm-aes.c=0A<br>+LIBNETTLE_SRCS-y +=3D $(LIBNETT=
LE_DIR)/gcm-aes128.c=0A<br>+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/gcm-aes1=
28-meta.c=0A<br>+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/gcm-aes192.c=0A<br>=
+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/gcm-aes192-meta.c=0A<br>+LIBNETTLE_=
SRCS-y +=3D $(LIBNETTLE_DIR)/gcm-aes256.c=0A<br>+LIBNETTLE_SRCS-y +=3D $(LI=
BNETTLE_DIR)/gcm-aes256-meta.c=0A<br>+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR=
)/gcm-camellia128.c=0A<br>+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/gcm-camel=
lia128-meta.c=0A<br>+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/gcm-camellia256=
.c=0A<br>+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/gcm-camellia256-meta.c=0A<=
br>+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/cmac.c=0A<br>+LIBNETTLE_SRCS-y +=
=3D $(LIBNETTLE_DIR)/cmac64.c=0A<br>+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)=
/cmac-aes128.c=0A<br>+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/cmac-aes256.c=
=0A<br>+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/cmac-des3.c=0A<br>+LIBNETTLE=
_SRCS-y +=3D $(LIBNETTLE_DIR)/cmac-aes128-meta.c=0A<br>+LIBNETTLE_SRCS-y +=
=3D $(LIBNETTLE_DIR)/cmac-aes256-meta.c=0A<br>+LIBNETTLE_SRCS-y +=3D $(LIBN=
ETTLE_DIR)/cmac-des3-meta.c=0A<br>+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/g=
ost28147.c=0A<br>+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/gosthash94.c=0A<br=
>+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/gosthash94-meta.c=0A<br>+LIBNETTLE=
_SRCS-y +=3D $(LIBNETTLE_DIR)/hmac.c=0A<br>+LIBNETTLE_SRCS-y +=3D $(LIBNETT=
LE_DIR)/hmac-gosthash94.c=0A<br>+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/hma=
c-md5.c=0A<br>+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/hmac-ripemd160.c=0A<b=
r>+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/hmac-sha1.c=0A<br>+LIBNETTLE_SRCS=
-y +=3D $(LIBNETTLE_DIR)/hmac-sha224.c=0A<br>+LIBNETTLE_SRCS-y +=3D $(LIBNE=
TTLE_DIR)/hmac-sha256.c=0A<br>+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/hmac-=
sha384.c=0A<br>+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/hmac-sha512.c=0A<br>=
+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/hmac-md5-meta.c=0A<br>+LIBNETTLE_SR=
CS-y +=3D $(LIBNETTLE_DIR)/hmac-ripemd160-meta.c=0A<br>+LIBNETTLE_SRCS-y +=
=3D $(LIBNETTLE_DIR)/hmac-sha1-meta.c=0A<br>+LIBNETTLE_SRCS-y +=3D $(LIBNET=
TLE_DIR)/hmac-sha224-meta.c=0A<br>+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/h=
mac-sha256-meta.c=0A<br>+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/hmac-sha384=
-meta.c=0A<br>+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/hmac-sha512-meta.c=0A=
<br>+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/knuth-lfib.c=0A<br>+LIBNETTLE_S=
RCS-y +=3D $(LIBNETTLE_DIR)/hkdf.c=0A<br>+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE=
_DIR)/md2.c=0A<br>+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/md2-meta.c=0A<br>=
+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/md4.c=0A<br>+LIBNETTLE_SRCS-y +=3D =
$(LIBNETTLE_DIR)/md4-meta.c=0A<br>+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/m=
d5.c=0A<br>+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/md5-compress.s=0A<br>+LI=
BNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/md5-compat.c=0A<br>+LIBNETTLE_SRCS-y +=
=3D $(LIBNETTLE_DIR)/md5-meta.c=0A<br>+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DI=
R)/memeql-sec.c=0A<br>+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/memxor.s=0A<b=
r>+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/memxor3.s=0A<br>+LIBNETTLE_SRCS-y=
 +=3D $(LIBNETTLE_DIR)/nettle-lookup-hash.c=0A<br>+LIBNETTLE_SRCS-y +=3D $(=
LIBNETTLE_DIR)/nettle-meta-aeads.c=0A<br>+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE=
_DIR)/nettle-meta-armors.c=0A<br>+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/ne=
ttle-meta-ciphers.c=0A<br>+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/nettle-me=
ta-hashes.c=0A<br>+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/nettle-meta-macs.=
c=0A<br>+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/pbkdf2.c=0A<br>+LIBNETTLE_S=
RCS-y +=3D $(LIBNETTLE_DIR)/pbkdf2-hmac-gosthash94.c=0A<br>+LIBNETTLE_SRCS-=
y +=3D $(LIBNETTLE_DIR)/pbkdf2-hmac-sha1.c=0A<br>+LIBNETTLE_SRCS-y +=3D $(L=
IBNETTLE_DIR)/pbkdf2-hmac-sha256.c=0A<br>+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE=
_DIR)/poly1305-aes.c=0A<br>+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/poly1305=
-internal.s=0A<br>+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/realloc.c=0A<br>+=
LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/ripemd160.c=0A<br>+LIBNETTLE_SRCS-y =
+=3D $(LIBNETTLE_DIR)/ripemd160-compress.c=0A<br>+LIBNETTLE_SRCS-y +=3D $(L=
IBNETTLE_DIR)/ripemd160-meta.c=0A<br>+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR=
)/salsa20-core-internal.s=0A<br>+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/sal=
sa20-crypt.c=0A<br>+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/salsa20r12-crypt=
.c=0A<br>+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/salsa20-set-key.c=0A<br>+L=
IBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/salsa20-set-nonce.c=0A<br>+LIBNETTLE_=
SRCS-y +=3D $(LIBNETTLE_DIR)/salsa20-128-set-key.c=0A<br>+LIBNETTLE_SRCS-y =
+=3D $(LIBNETTLE_DIR)/salsa20-256-set-key.c=0A<br>+LIBNETTLE_SRCS-y +=3D $(=
LIBNETTLE_DIR)/sha1.c=0A<br>+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/sha1-co=
mpress.s=0A<br>+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/sha1-meta.c=0A<br>+L=
IBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/sha256.c=0A<br>+LIBNETTLE_SRCS-y +=3D=
 $(LIBNETTLE_DIR)/sha256-compress.s=0A<br>+LIBNETTLE_SRCS-y +=3D $(LIBNETTL=
E_DIR)/sha224-meta.c=0A<br>+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/sha256-m=
eta.c=0A<br>+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/sha512.c=0A<br>+LIBNETT=
LE_SRCS-y +=3D $(LIBNETTLE_DIR)/sha512-compress.s=0A<br>+LIBNETTLE_SRCS-y +=
=3D $(LIBNETTLE_DIR)/sha384-meta.c=0A<br>+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE=
_DIR)/sha512-meta.c=0A<br>+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/sha512-22=
4-meta.c=0A<br>+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/sha512-256-meta.c=0A=
<br>+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/sha3.c=0A<br>+LIBNETTLE_SRCS-y =
+=3D $(LIBNETTLE_DIR)/sha3-permute.s=0A<br>+LIBNETTLE_SRCS-y +=3D $(LIBNETT=
LE_DIR)/sha3-224.c=0A<br>+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/sha3-224-m=
eta.c=0A<br>+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/sha3-256.c=0A<br>+LIBNE=
TTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/sha3-256-meta.c=0A<br>+LIBNETTLE_SRCS-y +=
=3D $(LIBNETTLE_DIR)/sha3-384.c=0A<br>+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DI=
R)/sha3-384-meta.c=0A<br>+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/sha3-512.c=
=0A<br>+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/sha3-512-meta.c=0A<br>+LIBNE=
TTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/shake256.c=0A<br>+LIBNETTLE_SRCS-y +=3D $=
(LIBNETTLE_DIR)/serpent-set-key.c=0A<br>+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_=
DIR)/serpent-encrypt.s=0A<br>+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/serpen=
t-decrypt.s=0A<br>+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/serpent-meta.c=0A=
<br>+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/twofish.c=0A<br>+LIBNETTLE_SRCS=
-y +=3D $(LIBNETTLE_DIR)/twofish-meta.c=0A<br>+LIBNETTLE_SRCS-y +=3D $(LIBN=
ETTLE_DIR)/umac-nh.s=0A<br>+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/umac-nh-=
n.s=0A<br>+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/umac-l2.c=0A<br>+LIBNETTL=
E_SRCS-y +=3D $(LIBNETTLE_DIR)/umac-l3.c=0A<br>+LIBNETTLE_SRCS-y +=3D $(LIB=
NETTLE_DIR)/umac-poly64.c=0A<br>+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/uma=
c-poly128.c=0A<br>+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/umac-set-key.c=0A=
<br>+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/umac32.c=0A<br>+LIBNETTLE_SRCS-=
y +=3D $(LIBNETTLE_DIR)/umac64.c=0A<br>+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_D=
IR)/umac96.c=0A<br>+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/umac128.c=0A<br>=
+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/version.c=0A<br>+LIBNETTLE_SRCS-y +=
=3D $(LIBNETTLE_DIR)/write-be32.c=0A<br>+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_=
DIR)/write-le32.c=0A<br>+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/write-le64.=
c=0A<br>+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/yarrow256.c=0A<br>+LIBNETTL=
E_SRCS-y +=3D $(LIBNETTLE_DIR)/yarrow_key_event.c=0A<br>+LIBNETTLE_SRCS-y +=
=3D $(LIBNETTLE_DIR)/xts.c=0A<br>+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/xt=
s-aes128.c=0A<br>+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/xts-aes256.c=0A<br=
>+LIBNETTLE_SRCS-y +=3D $(LIBNETTLE_DIR)/gcm-hash8.s=0A<br>+=0A<br>+LIBNETT=
LE_SRCS-$(CONFIG_LIBNETTLE_TEST) +=3D $(LIBNETTLE_DIR)/aes-test.c=0A<br>+LI=
BNETTLE_SRCS-$(CONFIG_LIBNETTLE_TEST) +=3D $(LIBNETTLE_DIR)/arcfour-test.c=
=0A<br>+LIBNETTLE_SRCS-$(CONFIG_LIBNETTLE_TEST) +=3D $(LIBNETTLE_DIR)/arctw=
o-test.c=0A<br>+LIBNETTLE_SRCS-$(CONFIG_LIBNETTLE_TEST) +=3D $(LIBNETTLE_DI=
R)/base16-test.c=0A<br>+LIBNETTLE_SRCS-$(CONFIG_LIBNETTLE_TEST) +=3D $(LIBN=
ETTLE_DIR)/base64-test.c=0A<br>+LIBNETTLE_SRCS-$(CONFIG_LIBNETTLE_TEST) +=
=3D $(LIBNETTLE_DIR)/blowfish-test.c=0A<br>+LIBNETTLE_SRCS-$(CONFIG_LIBNETT=
LE_TEST) +=3D $(LIBNETTLE_DIR)/buffer-test.c=0A<br>+LIBNETTLE_SRCS-$(CONFIG=
_LIBNETTLE_TEST) +=3D $(LIBNETTLE_DIR)/camellia-test.c=0A<br>+LIBNETTLE_SRC=
S-$(CONFIG_LIBNETTLE_TEST) +=3D $(LIBNETTLE_DIR)/cast128-test.c=0A<br>+LIBN=
ETTLE_SRCS-$(CONFIG_LIBNETTLE_TEST) +=3D $(LIBNETTLE_DIR)/cbc-test.c=0A<br>=
+LIBNETTLE_SRCS-$(CONFIG_LIBNETTLE_TEST) +=3D $(LIBNETTLE_DIR)/ccm-test.c=
=0A<br>+LIBNETTLE_SRCS-$(CONFIG_LIBNETTLE_TEST) +=3D $(LIBNETTLE_DIR)/cfb-t=
est.c=0A<br>+LIBNETTLE_SRCS-$(CONFIG_LIBNETTLE_TEST) +=3D $(LIBNETTLE_DIR)/=
chacha-poly1305-test.c=0A<br>+LIBNETTLE_SRCS-$(CONFIG_LIBNETTLE_TEST) +=3D =
$(LIBNETTLE_DIR)/chacha-test.c=0A<br>+LIBNETTLE_SRCS-$(CONFIG_LIBNETTLE_TES=
T) +=3D $(LIBNETTLE_DIR)/cmac-test.c=0A<br>+LIBNETTLE_SRCS-$(CONFIG_LIBNETT=
LE_TEST) +=3D $(LIBNETTLE_DIR)/ctr-test.c=0A<br>+LIBNETTLE_SRCS-$(CONFIG_LI=
BNETTLE_TEST) +=3D $(LIBNETTLE_DIR)/des-test.c=0A<br>+LIBNETTLE_SRCS-$(CONF=
IG_LIBNETTLE_TEST) +=3D $(LIBNETTLE_DIR)/des3-test.c=0A<br>+LIBNETTLE_SRCS-=
$(CONFIG_LIBNETTLE_TEST) +=3D $(LIBNETTLE_DIR)/eax-test.c=0A<br>+LIBNETTLE_=
SRCS-$(CONFIG_LIBNETTLE_TEST) +=3D $(LIBNETTLE_DIR)/gcm-test.c=0A<br>+LIBNE=
TTLE_SRCS-$(CONFIG_LIBNETTLE_TEST) +=3D $(LIBNETTLE_DIR)/gosthash94-test.c=
=0A<br>+LIBNETTLE_SRCS-$(CONFIG_LIBNETTLE_TEST) +=3D $(LIBNETTLE_DIR)/hkdf-=
test.c=0A<br>+LIBNETTLE_SRCS-$(CONFIG_LIBNETTLE_TEST) +=3D $(LIBNETTLE_DIR)=
/hmac-test.c=0A<br>+LIBNETTLE_SRCS-$(CONFIG_LIBNETTLE_TEST) +=3D $(LIBNETTL=
E_DIR)/knuth-lfib-test.c=0A<br>+LIBNETTLE_SRCS-$(CONFIG_LIBNETTLE_TEST) +=
=3D $(LIBNETTLE_DIR)/md2-test.c=0A<br>+LIBNETTLE_SRCS-$(CONFIG_LIBNETTLE_TE=
ST) +=3D $(LIBNETTLE_DIR)/md4-test.c=0A<br>+LIBNETTLE_SRCS-$(CONFIG_LIBNETT=
LE_TEST) +=3D $(LIBNETTLE_DIR)/md5-compat-test.c=0A<br>+LIBNETTLE_SRCS-$(CO=
NFIG_LIBNETTLE_TEST) +=3D $(LIBNETTLE_DIR)/md5-test.c=0A<br>+LIBNETTLE_SRCS=
-$(CONFIG_LIBNETTLE_TEST) +=3D $(LIBNETTLE_DIR)/meta-aead-test.c=0A<br>+LIB=
NETTLE_SRCS-$(CONFIG_LIBNETTLE_TEST) +=3D $(LIBNETTLE_DIR)/meta-armor-test.=
c=0A<br>+LIBNETTLE_SRCS-$(CONFIG_LIBNETTLE_TEST) +=3D $(LIBNETTLE_DIR)/meta=
-cipher-test.c=0A<br>+LIBNETTLE_SRCS-$(CONFIG_LIBNETTLE_TEST) +=3D $(LIBNET=
TLE_DIR)/meta-hash-test.c=0A<br>+LIBNETTLE_SRCS-$(CONFIG_LIBNETTLE_TEST) +=
=3D $(LIBNETTLE_DIR)/meta-mac-test.c=0A<br>+LIBNETTLE_SRCS-$(CONFIG_LIBNETT=
LE_TEST) +=3D $(LIBNETTLE_DIR)/pbkdf2-test.c=0A<br>+LIBNETTLE_SRCS-$(CONFIG=
_LIBNETTLE_TEST) +=3D $(LIBNETTLE_DIR)/poly1305-test.c=0A<br>+LIBNETTLE_SRC=
S-$(CONFIG_LIBNETTLE_TEST) +=3D $(LIBNETTLE_DIR)/ripemd160-test.c=0A<br>+LI=
BNETTLE_SRCS-$(CONFIG_LIBNETTLE_TEST) +=3D $(LIBNETTLE_DIR)/salsa20-test.c=
=0A<br>+LIBNETTLE_SRCS-$(CONFIG_LIBNETTLE_TEST) +=3D $(LIBNETTLE_DIR)/serpe=
nt-test.c=0A<br>+LIBNETTLE_SRCS-$(CONFIG_LIBNETTLE_TEST) +=3D $(LIBNETTLE_D=
IR)/sha1-huge-test.c=0A<br>+LIBNETTLE_SRCS-$(CONFIG_LIBNETTLE_TEST) +=3D $(=
LIBNETTLE_DIR)/sha1-test.c=0A<br>+LIBNETTLE_SRCS-$(CONFIG_LIBNETTLE_TEST) +=
=3D $(LIBNETTLE_DIR)/sha3-224-test.c=0A<br>+LIBNETTLE_SRCS-$(CONFIG_LIBNETT=
LE_TEST) +=3D $(LIBNETTLE_DIR)/sha3-256-test.c=0A<br>+LIBNETTLE_SRCS-$(CONF=
IG_LIBNETTLE_TEST) +=3D $(LIBNETTLE_DIR)/sha3-384-test.c=0A<br>+LIBNETTLE_S=
RCS-$(CONFIG_LIBNETTLE_TEST) +=3D $(LIBNETTLE_DIR)/sha3-512-test.c=0A<br>+L=
IBNETTLE_SRCS-$(CONFIG_LIBNETTLE_TEST) +=3D $(LIBNETTLE_DIR)/sha3-permute-t=
est.c=0A<br>+LIBNETTLE_SRCS-$(CONFIG_LIBNETTLE_TEST) +=3D $(LIBNETTLE_DIR)/=
sha224-test.c=0A<br>+LIBNETTLE_SRCS-$(CONFIG_LIBNETTLE_TEST) +=3D $(LIBNETT=
LE_DIR)/sha256-test.c=0A<br>+LIBNETTLE_SRCS-$(CONFIG_LIBNETTLE_TEST) +=3D $=
(LIBNETTLE_DIR)/sha384-test.c=0A<br>+LIBNETTLE_SRCS-$(CONFIG_LIBNETTLE_TEST=
) +=3D $(LIBNETTLE_DIR)/sha512-224-test.c=0A<br>+LIBNETTLE_SRCS-$(CONFIG_LI=
BNETTLE_TEST) +=3D $(LIBNETTLE_DIR)/sha512-256-test.c=0A<br>+LIBNETTLE_SRCS=
-$(CONFIG_LIBNETTLE_TEST) +=3D $(LIBNETTLE_DIR)/sha512-test.c=0A<br>+LIBNET=
TLE_SRCS-$(CONFIG_LIBNETTLE_TEST) +=3D $(LIBNETTLE_DIR)/shake256-test.c=0A<=
br>+LIBNETTLE_SRCS-$(CONFIG_LIBNETTLE_TEST) +=3D $(LIBNETTLE_DIR)/twofish-t=
est.c=0A<br>+LIBNETTLE_SRCS-$(CONFIG_LIBNETTLE_TEST) +=3D $(LIBNETTLE_DIR)/=
umac-test.c=0A<br>+LIBNETTLE_SRCS-$(CONFIG_LIBNETTLE_TEST) +=3D $(LIBNETTLE=
_DIR)/xts-test.c=0A<br>+LIBNETTLE_SRCS-$(CONFIG_LIBNETTLE_TEST) +=3D $(LIBN=
ETTLE_DIR)/yarrow-test.c=0A<br>+LIBNETTLE_SRCS-$(CONFIG_LIBNETTLE_TEST) +=
=3D $(LIBNETTLE_DIR)/testutils.c=0A<br>+LIBNETTLE_SRCS-$(CONFIG_LIBNETTLE_T=
EST) +=3D $(LIBNETTLE_DIR)/nettle-internal.c=0A<br>+=0A<br>+###############=
#################################################################=0A<br>+# =
Nettle prepare=0A<br>+#####################################################=
###########################=0A<br>+# Run ./configure=0A<br>+$(LIBNETTLE_DIR=
)/.configured: $(LIBNETTLE_BUILD)/.origin=0A<br>+	$(call verbose_cmd,CONFIG=
,libnettle: $(notdir $@), cd $(LIBNETTLE_DIR) &amp;&amp; ./configure &amp;&=
amp; touch $@ &amp;&amp; cp config.h testsuite/)=0A<br>+=0A<br>+# Generate =
assembly files=0A<br>+=0A<br>+LIBNETTLE_ASSEMBLY_DEPS =3D $(LIBNETTLE_DIR)/=
asm.m4 $(LIBNETTLE_DIR)/machine.m4 $(LIBNETTLE_DIR)/config.m4=0A<br>+=0A<br=
>+$(LIBNETTLE_DIR)/aes-decrypt-internal.s: $(LIBNETTLE_ASSEMBLY_DEPS) $(LIB=
NETTLE_DIR)/aes-decrypt-internal.asm=0A<br>+	$(call verbose_cmd,GEN,libnett=
le: $(notdir $@), cd $(LIBNETTLE_DIR) &amp;&amp; /usr/bin/m4 $^ &gt;$@)=0A<=
br>+$(LIBNETTLE_DIR)/aes-encrypt-internal.s: $(LIBNETTLE_ASSEMBLY_DEPS) $(L=
IBNETTLE_DIR)/aes-encrypt-internal.asm=0A<br>+	$(call verbose_cmd,GEN,libne=
ttle: $(notdir $@), cd $(LIBNETTLE_DIR) &amp;&amp; /usr/bin/m4 $^ &gt;$@)=
=0A<br>+$(LIBNETTLE_DIR)/camellia-crypt-internal.s: $(LIBNETTLE_ASSEMBLY_DE=
PS) $(LIBNETTLE_DIR)/camellia-crypt-internal.asm=0A<br>+	$(call verbose_cmd=
,GEN,libnettle: $(notdir $@), cd $(LIBNETTLE_DIR) &amp;&amp; /usr/bin/m4 $^=
 &gt;$@)=0A<br>+$(LIBNETTLE_DIR)/chacha-core-internal.s: $(LIBNETTLE_ASSEMB=
LY_DEPS) $(LIBNETTLE_DIR)/chacha-core-internal.asm=0A<br>+	$(call verbose_c=
md,GEN,libnettle: $(notdir $@), cd $(LIBNETTLE_DIR) &amp;&amp; /usr/bin/m4 =
$^ &gt;$@)=0A<br>+$(LIBNETTLE_DIR)/md5-compress.s: $(LIBNETTLE_ASSEMBLY_DEP=
S) $(LIBNETTLE_DIR)/md5-compress.asm=0A<br>+	$(call verbose_cmd,GEN,libnett=
le: $(notdir $@), cd $(LIBNETTLE_DIR) &amp;&amp; /usr/bin/m4 $^ &gt;$@)=0A<=
br>+$(LIBNETTLE_DIR)/memxor.s: $(LIBNETTLE_ASSEMBLY_DEPS) $(LIBNETTLE_DIR)/=
memxor.asm=0A<br>+	$(call verbose_cmd,GEN,libnettle: $(notdir $@), cd $(LIB=
NETTLE_DIR) &amp;&amp; /usr/bin/m4 $^ &gt;$@)=0A<br>+$(LIBNETTLE_DIR)/memxo=
r3.s: $(LIBNETTLE_ASSEMBLY_DEPS) $(LIBNETTLE_DIR)/memxor3.asm=0A<br>+	$(cal=
l verbose_cmd,GEN,libnettle: $(notdir $@), cd $(LIBNETTLE_DIR) &amp;&amp; /=
usr/bin/m4 $^ &gt;$@)=0A<br>+$(LIBNETTLE_DIR)/poly1305-internal.s: $(LIBNET=
TLE_ASSEMBLY_DEPS) $(LIBNETTLE_DIR)/poly1305-internal.asm=0A<br>+	$(call ve=
rbose_cmd,GEN,libnettle: $(notdir $@), cd $(LIBNETTLE_DIR) &amp;&amp; /usr/=
bin/m4 $^ &gt;$@)=0A<br>+$(LIBNETTLE_DIR)/salsa20-core-internal.s: $(LIBNET=
TLE_ASSEMBLY_DEPS) $(LIBNETTLE_DIR)/salsa20-core-internal.asm=0A<br>+	$(cal=
l verbose_cmd,GEN,libnettle: $(notdir $@), cd $(LIBNETTLE_DIR) &amp;&amp; /=
usr/bin/m4 $^ &gt;$@)=0A<br>+$(LIBNETTLE_DIR)/salsa20-crypt.s: $(LIBNETTLE_=
ASSEMBLY_DEPS) $(LIBNETTLE_DIR)/salsa20-crypt.asm=0A<br>+	$(call verbose_cm=
d,GEN,libnettle: $(notdir $@), cd $(LIBNETTLE_DIR) &amp;&amp; /usr/bin/m4 $=
^ &gt;$@)=0A<br>+$(LIBNETTLE_DIR)/sha1-compress.s: $(LIBNETTLE_ASSEMBLY_DEP=
S) $(LIBNETTLE_DIR)/sha1-compress.asm=0A<br>+	$(call verbose_cmd,GEN,libnet=
tle: $(notdir $@), cd $(LIBNETTLE_DIR) &amp;&amp; /usr/bin/m4 $^ &gt;$@)=0A=
<br>+$(LIBNETTLE_DIR)/sha256-compress.s: $(LIBNETTLE_ASSEMBLY_DEPS) $(LIBNE=
TTLE_DIR)/sha256-compress.asm=0A<br>+	$(call verbose_cmd,GEN,libnettle: $(n=
otdir $@), cd $(LIBNETTLE_DIR) &amp;&amp; /usr/bin/m4 $^ &gt;$@)=0A<br>+$(L=
IBNETTLE_DIR)/sha512-compress.s: $(LIBNETTLE_ASSEMBLY_DEPS) $(LIBNETTLE_DIR=
)/sha512-compress.asm=0A<br>+	$(call verbose_cmd,GEN,libnettle: $(notdir $@=
), cd $(LIBNETTLE_DIR) &amp;&amp; /usr/bin/m4 $^ &gt;$@)=0A<br>+$(LIBNETTLE=
_DIR)/sha3-permute.s: $(LIBNETTLE_ASSEMBLY_DEPS) $(LIBNETTLE_DIR)/sha3-perm=
ute.asm=0A<br>+	$(call verbose_cmd,GEN,libnettle: $(notdir $@), cd $(LIBNET=
TLE_DIR) &amp;&amp; /usr/bin/m4 $^ &gt;$@)=0A<br>+$(LIBNETTLE_DIR)/serpent-=
encrypt.s: $(LIBNETTLE_ASSEMBLY_DEPS) $(LIBNETTLE_DIR)/serpent-encrypt.asm=
=0A<br>+	$(call verbose_cmd,GEN,libnettle: $(notdir $@), cd $(LIBNETTLE_DIR=
) &amp;&amp; /usr/bin/m4 $^ &gt;$@)=0A<br>+$(LIBNETTLE_DIR)/serpent-decrypt=
.s: $(LIBNETTLE_ASSEMBLY_DEPS) $(LIBNETTLE_DIR)/serpent-decrypt.asm=0A<br>+=
	$(call verbose_cmd,GEN,libnettle: $(notdir $@), cd $(LIBNETTLE_DIR) &amp;&=
amp; /usr/bin/m4 $^ &gt;$@)=0A<br>+$(LIBNETTLE_DIR)/umac-nh.s: $(LIBNETTLE_=
ASSEMBLY_DEPS) $(LIBNETTLE_DIR)/umac-nh.asm=0A<br>+	$(call verbose_cmd,GEN,=
libnettle: $(notdir $@), cd $(LIBNETTLE_DIR) &amp;&amp; /usr/bin/m4 $^ &gt;=
$@)=0A<br>+$(LIBNETTLE_DIR)/umac-nh-n.s: $(LIBNETTLE_ASSEMBLY_DEPS) $(LIBNE=
TTLE_DIR)/umac-nh-n.asm=0A<br>+	$(call verbose_cmd,GEN,libnettle: $(notdir =
$@), cd $(LIBNETTLE_DIR) &amp;&amp; /usr/bin/m4 $^ &gt;$@)=0A<br>+$(LIBNETT=
LE_DIR)/gcm-hash8.s: $(LIBNETTLE_ASSEMBLY_DEPS) $(LIBNETTLE_DIR)/gcm-hash8.=
asm=0A<br>+	$(call verbose_cmd,GEN,libnettle: $(notdir $@), cd $(LIBNETTLE_=
DIR) &amp;&amp; /usr/bin/m4 $^ &gt;$@)=0A<br>+=0A<br>+LIBNETTLE_TEST_SRCS =
=3D \=0A<br>+	$(LIBNETTLE_DIR)/testsuite/aes-test.c \=0A<br>+	$(LIBNETTLE_D=
IR)/testsuite/arcfour-test.c \=0A<br>+	$(LIBNETTLE_DIR)/testsuite/arctwo-te=
st.c \=0A<br>+	$(LIBNETTLE_DIR)/testsuite/base16-test.c \=0A<br>+	$(LIBNETT=
LE_DIR)/testsuite/base64-test.c \=0A<br>+	$(LIBNETTLE_DIR)/testsuite/blowfi=
sh-test.c \=0A<br>+	$(LIBNETTLE_DIR)/testsuite/buffer-test.c \=0A<br>+	$(LI=
BNETTLE_DIR)/testsuite/camellia-test.c \=0A<br>+	$(LIBNETTLE_DIR)/testsuite=
/cast128-test.c \=0A<br>+	$(LIBNETTLE_DIR)/testsuite/cbc-test.c \=0A<br>+	$=
(LIBNETTLE_DIR)/testsuite/ccm-test.c \=0A<br>+	$(LIBNETTLE_DIR)/testsuite/c=
fb-test.c \=0A<br>+	$(LIBNETTLE_DIR)/testsuite/chacha-poly1305-test.c \=0A<=
br>+	$(LIBNETTLE_DIR)/testsuite/chacha-test.c \=0A<br>+	$(LIBNETTLE_DIR)/te=
stsuite/cmac-test.c \=0A<br>+	$(LIBNETTLE_DIR)/testsuite/ctr-test.c \=0A<br=
>+	$(LIBNETTLE_DIR)/testsuite/des-test.c \=0A<br>+	$(LIBNETTLE_DIR)/testsui=
te/des3-test.c \=0A<br>+	$(LIBNETTLE_DIR)/testsuite/eax-test.c \=0A<br>+	$(=
LIBNETTLE_DIR)/testsuite/gcm-test.c \=0A<br>+	$(LIBNETTLE_DIR)/testsuite/go=
sthash94-test.c \=0A<br>+	$(LIBNETTLE_DIR)/testsuite/hkdf-test.c \=0A<br>+	=
$(LIBNETTLE_DIR)/testsuite/hmac-test.c \=0A<br>+	$(LIBNETTLE_DIR)/testsuite=
/knuth-lfib-test.c \=0A<br>+	$(LIBNETTLE_DIR)/testsuite/md2-test.c \=0A<br>=
+	$(LIBNETTLE_DIR)/testsuite/md4-test.c \=0A<br>+	$(LIBNETTLE_DIR)/testsuit=
e/md5-compat-test.c \=0A<br>+	$(LIBNETTLE_DIR)/testsuite/md5-test.c \=0A<br=
>+	$(LIBNETTLE_DIR)/testsuite/meta-aead-test.c \=0A<br>+	$(LIBNETTLE_DIR)/t=
estsuite/meta-armor-test.c \=0A<br>+	$(LIBNETTLE_DIR)/testsuite/meta-cipher=
-test.c \=0A<br>+	$(LIBNETTLE_DIR)/testsuite/meta-hash-test.c \=0A<br>+	$(L=
IBNETTLE_DIR)/testsuite/meta-mac-test.c \=0A<br>+	$(LIBNETTLE_DIR)/testsuit=
e/pbkdf2-test.c \=0A<br>+	$(LIBNETTLE_DIR)/testsuite/poly1305-test.c \=0A<b=
r>+	$(LIBNETTLE_DIR)/testsuite/ripemd160-test.c \=0A<br>+	$(LIBNETTLE_DIR)/=
testsuite/salsa20-test.c \=0A<br>+	$(LIBNETTLE_DIR)/testsuite/serpent-test.=
c \=0A<br>+	$(LIBNETTLE_DIR)/testsuite/sha1-huge-test.c \=0A<br>+	$(LIBNETT=
LE_DIR)/testsuite/sha1-test.c \=0A<br>+	$(LIBNETTLE_DIR)/testsuite/sha3-224=
-test.c \=0A<br>+	$(LIBNETTLE_DIR)/testsuite/sha3-256-test.c \=0A<br>+	$(LI=
BNETTLE_DIR)/testsuite/sha3-384-test.c \=0A<br>+	$(LIBNETTLE_DIR)/testsuite=
/sha3-512-test.c \=0A<br>+	$(LIBNETTLE_DIR)/testsuite/sha3-permute-test.c \=
=0A<br>+	$(LIBNETTLE_DIR)/testsuite/sha224-test.c \=0A<br>+	$(LIBNETTLE_DIR=
)/testsuite/sha256-test.c \=0A<br>+	$(LIBNETTLE_DIR)/testsuite/sha384-test.=
c \=0A<br>+	$(LIBNETTLE_DIR)/testsuite/sha512-224-test.c \=0A<br>+	$(LIBNET=
TLE_DIR)/testsuite/sha512-256-test.c \=0A<br>+	$(LIBNETTLE_DIR)/testsuite/s=
ha512-test.c \=0A<br>+	$(LIBNETTLE_DIR)/testsuite/shake256-test.c \=0A<br>+=
	$(LIBNETTLE_DIR)/testsuite/twofish-test.c \=0A<br>+	$(LIBNETTLE_DIR)/tests=
uite/umac-test.c \=0A<br>+	$(LIBNETTLE_DIR)/testsuite/xts-test.c \=0A<br>+	=
$(LIBNETTLE_DIR)/testsuite/yarrow-test.c \=0A<br>+	$(LIBNETTLE_DIR)/testsui=
te/testutils.c \=0A<br>+	$(LIBNETTLE_DIR)/testsuite/testutils.h=0A<br>+=0A<=
br>+=0A<br>+$(LIBNETTLE_DIR)/testsuite/.deps: $(LIBNETTLE_TEST_SRCS)=0A<br>=
+	$(call verbose_cmd,GEN,libnettle: $(notdir $@), cd $(LIBNETTLE_DIR)/tests=
uite &amp;&amp; cp $^ $(LIBNETTLE_DIR) &amp;&amp; touch $@)=0A<br>+=0A<br>+=
LIBNETTLE_PREPARED_DEPS =3D \=0A<br>+	$(LIBNETTLE_DIR)/.configured \=0A<br>=
+	$(LIBNETTLE_DIR)/aes-decrypt-internal.s \=0A<br>+	$(LIBNETTLE_DIR)/aes-en=
crypt-internal.s \=0A<br>+	$(LIBNETTLE_DIR)/camellia-crypt-internal.s \=0A<=
br>+	$(LIBNETTLE_DIR)/chacha-core-internal.s \=0A<br>+	$(LIBNETTLE_DIR)/md5=
-compress.s \=0A<br>+	$(LIBNETTLE_DIR)/memxor.s \=0A<br>+	$(LIBNETTLE_DIR)/=
memxor3.s \=0A<br>+	$(LIBNETTLE_DIR)/poly1305-internal.s \=0A<br>+	$(LIBNET=
TLE_DIR)/salsa20-core-internal.s \=0A<br>+	$(LIBNETTLE_DIR)/salsa20-crypt.s=
 \=0A<br>+	$(LIBNETTLE_DIR)/sha1-compress.s \=0A<br>+	$(LIBNETTLE_DIR)/sha2=
56-compress.s \=0A<br>+	$(LIBNETTLE_DIR)/sha512-compress.s \=0A<br>+	$(LIBN=
ETTLE_DIR)/sha3-permute.s \=0A<br>+	$(LIBNETTLE_DIR)/serpent-encrypt.s \=0A=
<br>+	$(LIBNETTLE_DIR)/serpent-decrypt.s \=0A<br>+	$(LIBNETTLE_DIR)/umac-nh=
.s \=0A<br>+	$(LIBNETTLE_DIR)/umac-nh-n.s \=0A<br>+	$(LIBNETTLE_DIR)/gcm-ha=
sh8.s \=0A<br>+	$(LIBNETTLE_DIR)/testsuite/.deps =0A<br>+=0A<br>+$(LIBNETTL=
E_BUILD)/.prepared : $(LIBNETTLE_PREPARED_DEPS)=0A<br>+	$(call verbose_cmd,=
GEN,libnettle: $(notdir $@), cd $(LIBNETTLE_DIR) &amp;&amp; touch $@)=0A<br=
>+=0A<br>+UK_PREPARE +=3D $(LIBNETTLE_BUILD)/.prepared=0A<br>-- =0A<br>2.25=
.1=0A<br>=0A<br>=0A<br></cristianvijelie@gmail.com></div></blockquote>=0A  =
                                      =0A                                  =
      </div>
------=_NextPart_19520957.857309132540--


From minios-devel-bounces@lists.xenproject.org Thu Jan 28 17:34:17 2021
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Thu, 28 Jan 2021 17:34:17 +0000
Received: from list by lists.xenproject.org with outflank-mailman.77338.140016 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1l5BBR-0004Uv-8V; Thu, 28 Jan 2021 17:34:17 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 77338.140016; Thu, 28 Jan 2021 17:34: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 1l5BBR-0004Uo-4x; Thu, 28 Jan 2021 17:34:17 +0000
Received: by outflank-mailman (input) for mailman id 77338;
 Thu, 28 Jan 2021 17:34: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=VIkR=G7=gmail.com=cezar.craciunoiu@srs-us1.protection.inumbo.net>)
 id 1l5BBQ-0004Ui-41
 for minios-devel@lists.xenproject.org; Thu, 28 Jan 2021 17:34:16 +0000
Received: from mail-ej1-x62a.google.com (unknown [2a00:1450:4864:20::62a])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 407c30ff-10d1-49a8-af28-bf67f2b7afe0;
 Thu, 28 Jan 2021 17:34:12 +0000 (UTC)
Received: by mail-ej1-x62a.google.com with SMTP id ke15so8948068ejc.12
 for <minios-devel@lists.xenproject.org>; Thu, 28 Jan 2021 09:34:12 -0800 (PST)
Received: from [192.168.0.3] ([86.120.251.107])
 by smtp.gmail.com with ESMTPSA id rh6sm1305867ejb.45.2021.01.28.09.34.10
 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128);
 Thu, 28 Jan 2021 09:34: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: 407c30ff-10d1-49a8-af28-bf67f2b7afe0
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=50CKDRuWNhNJqQuVPdl0Jf6EuBfxj4lQFLvsaWu343o=;
        b=PU6KtrCf1+KV1W0Ixsx/oYWhksSVcZMcoIpjSmAu1hBJg9nBiUE1hQj+7KUb8v01CG
         mYTrxnpZiJUVJcz9HSK3mhTwVqqeL8/p3kiCsQv1p4X1heijRqS2Y7ntyQHmtFdCUAmV
         jPkDTYWnOz78hIX1UnGiCfwy4tBhux2M3y7buS0gRH5GJ45izdZEQiaAsQAOSdSe3SCh
         USbK5MUzrLpBhR4sYzcESWM4ZqBxdfeu4uMG0blU+IIQgQXHl6UdIfa0V1EsIql6iyoZ
         JQjFpIOhlhoOtOCatW51vkd+o49NEyYVki8xrAsybUfkujwA9SSlTS5mGvlLg+Hjpxru
         LAmw==
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=50CKDRuWNhNJqQuVPdl0Jf6EuBfxj4lQFLvsaWu343o=;
        b=IcIP65noXKes4l662W1KYb0+lbhunwaYvkAZ//dgYAwk1+EB65+MSZ+u8vbyqzRGLq
         ZdOoHNlH43fmwOLjU2Rp7wvDZQExY6LOP5elLluWcrpQ2uIhoIFsiMu0WkTkOpPPutsd
         E1oHZ/xN3ki+uedt7UJ7CLWvGVI9F8Gi50Fs9qBnvsn23cEcz5Zpqy4y1HHan9OyWgRN
         KCFowbfZaLXYl6718YxJ4qWb4/saoEsf50lcGcFAEBd5I14iRK6FDxcuF4TqDTcG36bV
         38o2R3malsyT7pguxstpYkd1kjaO2V4tO+009jAozu0zouGBiBQtGyNYpGIzpubqaDN/
         2ztQ==
X-Gm-Message-State: AOAM533+NL+BEiY1eWQn2oTfJLxmOy+Kl7A50ADNqsKX36eiHmquYJdW
	ypWj0RFh5DRAUU3qXrbXATBlGDKllrM=
X-Google-Smtp-Source: ABdhPJxqwPIRqzifbqL6GLCq8dQmLXpiWJKloksnI4CYx15KYbT+xVg2AItHJc35GZ3cWz+apZ3nzw==
X-Received: by 2002:a17:907:961d:: with SMTP id gb29mr494817ejc.460.1611855251564;
        Thu, 28 Jan 2021 09:34:11 -0800 (PST)
Content-Type: multipart/alternative;
 boundary="----=_NextPart_32760917.711275528375"
MIME-Version: 1.0
Date: Thu, 28 Jan 2021 19:33:46 +0200
Message-ID: <Mailbird-5326987f-0f95-4851-94e7-8485bbdc0fb6@gmail.com>
Subject: Re: [[UNIKRAFT/LIBNETTLE] v3 3/3] Adding the patches
From: "Cezar Craciunoiu" <cezar.craciunoiu@gmail.com>
To: "cristian-vijelie" <cristianvijelie@gmail.com>
Cc: "" <minios-devel@lists.xenproject.org>
In-Reply-To: <20210128170650.76513-4-cristianvijelie@gmail.com>
References: <20210128170650.76513-1-cristianvijelie@gmail.com>
 <20210128170650.76513-4-cristianvijelie@gmail.com>
User-Agent: Mailbird/2.9.16.0
X-Mailbird-ID: Mailbird-5326987f-0f95-4851-94e7-8485bbdc0fb6@gmail.com

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

Hey Cristian,

This patch looks good to me.

Reviewed-by: Cezar Craciunoiu <cezar.craciunoiu@gmail.com>
On 2021-01-28 19:07:24, cristian-vijelie <cristianvijelie@gmail.com> wrote:
The patch is required to be able to run the test suite.

Signed-off-by: cristian-vijelie
---
patches/0001-Made-the-tests-runnable.patch | 838 +++++++++++++++++++++
1 file changed, 838 insertions(+)
create mode 100644 patches/0001-Made-the-tests-runnable.patch

diff --git a/patches/0001-Made-the-tests-runnable.patch b/patches/0001-Made=
-the-tests-runnable.patch
new file mode 100644
index 0000000..463d0c8
--- /dev/null
+++ b/patches/0001-Made-the-tests-runnable.patch
@@ -0,0 +1,838 @@
+From fb889864b018eb3ceae9dad5328984367dcb3ef3 Mon Sep 17 00:00:00 2001
+From: cristian-vijelie
+Date: Fri, 4 Dec 2020 14:09:40 +0200
+Subject: [PATCH] Made the tests runnable
+
+The test suite provided for libnettle has a test_main() function for each =
of
+the test files, that is used in testsuite.c, which contains the main funct=
ion
+of the test suite. So, for each test, a new executable is built. This cann=
ot
+happen in unikraft.
+
+This patch removes the main() function from testutils.c and renames each
+test_main() function from the test sources, so they all have different nam=
es.
+This way is possible to call all the functions from the testing app.
+
+Signed-off-by: Cristian Vijelie
+---
+ aes-test.c | 2 +-
+ arcfour-test.c | 2 +-
+ arctwo-test.c | 2 +-
+ base16-test.c | 2 +-
+ base64-test.c | 2 +-
+ blowfish-test.c | 2 +-
+ camellia-test.c | 2 +-
+ cbc-test.c | 2 +-
+ ccm-test.c | 2 +-
+ cfb-test.c | 2 +-
+ chacha-poly1305-test.c | 2 +-
+ chacha-test.c | 2 +-
+ cmac-test.c | 2 +-
+ ctr-test.c | 2 +-
+ des-test.c | 2 +-
+ des3-test.c | 2 +-
+ eax-test.c | 2 +-
+ gcm-test.c | 2 +-
+ gosthash94-test.c | 2 +-
+ hkdf-test.c | 2 +-
+ hmac-test.c | 2 +-
+ knuth-lfib-test.c | 2 +-
+ md2-test.c | 2 +-
+ md4-test.c | 2 +-
+ md5-compat-test.c | 2 +-
+ md5-test.c | 2 +-
+ meta-aead-test.c | 2 +-
+ meta-armor-test.c | 2 +-
+ meta-cipher-test.c | 2 +-
+ meta-hash-test.c | 2 +-
+ meta-mac-test.c | 2 +-
+ pbkdf2-test.c | 2 +-
+ poly1305-test.c | 2 +-
+ ripemd160-test.c | 2 +-
+ salsa20-test.c | 2 +-
+ serpent-test.c | 2 +-
+ sha1-huge-test.c | 2 +-
+ sha1-test.c | 2 +-
+ sha224-test.c | 2 +-
+ sha256-test.c | 2 +-
+ sha3-224-test.c | 2 +-
+ sha3-256-test.c | 2 +-
+ sha3-384-test.c | 2 +-
+ sha3-512-test.c | 2 +-
+ sha3-permute-test.c | 2 +-
+ sha384-test.c | 2 +-
+ sha512-224-test.c | 2 +-
+ sha512-256-test.c | 2 +-
+ sha512-test.c | 2 +-
+ shake256-test.c | 2 +-
+ testutils.c | 21 -------------------
+ twofish-test.c | 2 +-
+ umac-test.c | 2 +-
+ xts-test.c | 2 +-
+ yarrow-test.c | 2 +-
+ buffer-test.c | 2 +-
+ cast128-test.c | 2 +-
+ 57 files changed, 56 insertions(+), 77 deletions(-)
+
+diff --git a/aes-test.c b/aes-test.c
+index 078bd67..3cd0140 100644
+--- a/aes-test.c
++++ b/aes-test.c
+@@ -116,7 +116,7 @@ test_cipher2(const struct nettle_cipher *c1,
+ }
+
+ void
+-test_main(void)
++test_main_aes(void)
+ {
+ /* Test both the new interface and the older unified interface. */
+
+diff --git a/arcfour-test.c b/arcfour-test.c
+index b2b039b..bfea126 100644
+--- a/arcfour-test.c
++++ b/arcfour-test.c
+@@ -68,7 +68,7 @@ test_arcfour(const struct tstring *key,
+ }
+
+ void
+-test_main(void)
++test_main_arcfour(void)
+ {
+ test_arcfour(SHEX("01234567 89ABCDEF 00000000 00000000"),
+ SHEX("01234567 89ABCDEF"),
+diff --git a/arctwo-test.c b/arctwo-test.c
+index d91d522..78a8235 100644
+--- a/arctwo-test.c
++++ b/arctwo-test.c
+@@ -62,7 +62,7 @@ test_arctwo(unsigned ekb,
+ }
+
+ void
+-test_main(void)
++test_main_arctwo(void)
+ {
+ /* Test vectors from Peter Gutmann's paper. */
+ test_cipher(&nettle_arctwo_gutmann128,
+diff --git a/base16-test.c b/base16-test.c
+index 820915b..305b123 100644
+--- a/base16-test.c
++++ b/base16-test.c
+@@ -2,7 +2,7 @@
+ #include "base16.h"
+
+ void
+-test_main(void)
++test_main_base16(void)
+ {
+ ASSERT(BASE16_ENCODE_LENGTH(0) =3D=3D 0);
+ ASSERT(BASE16_ENCODE_LENGTH(1) =3D=3D 2);
+diff --git a/base64-test.c b/base64-test.c
+index cc45c47..3522277 100644
+--- a/base64-test.c
++++ b/base64-test.c
+@@ -81,7 +81,7 @@ base64_decode_in_place (struct base64_decode_ctx *ctx, s=
ize_t *dst_length,
+ }
+
+ void
+-test_main(void)
++test_main_base64(void)
+ {
+ ASSERT(BASE64_ENCODE_LENGTH(0) =3D=3D 0); /* At most 4 bits */
+ ASSERT(BASE64_ENCODE_LENGTH(1) =3D=3D 2); /* At most 12 bits */
+diff --git a/blowfish-test.c b/blowfish-test.c
+index cadeda5..eeb91e5 100644
+--- a/blowfish-test.c
++++ b/blowfish-test.c
+@@ -46,7 +46,7 @@ test_blowfish(const struct tstring *key,
+ }
+
+ void
+-test_main(void)
++test_main_blowfish(void)
+ {
+ /* 208 bit key. Test from GNUPG. */
+ test_blowfish(SDATA("abcdefghijklmnopqrstuvwxyz"),
+diff --git a/camellia-test.c b/camellia-test.c
+index f6c850a..fbd4858 100644
+--- a/camellia-test.c
++++ b/camellia-test.c
+@@ -73,7 +73,7 @@ test_invert(const struct tstring *key,
+ }
+
+ void
+-test_main(void)
++test_main_camellia(void)
+ {
+ /* Test vectors from RFC 3713 */
+ /* 128 bit keys */
+diff --git a/cbc-test.c b/cbc-test.c
+index 9394f1c..96bf81c 100644
+--- a/cbc-test.c
++++ b/cbc-test.c
+@@ -65,7 +65,7 @@ test_cbc_bulk(void)
+ }
+
+ void
+-test_main(void)
++test_main_cbc(void)
+ {
+ /* Intermediate values:
+ * iv XOR first message block:
+diff --git a/ccm-test.c b/ccm-test.c
+index 4176cc7..a1d0245 100644
+--- a/ccm-test.c
++++ b/ccm-test.c
+@@ -249,7 +249,7 @@ test_cipher_ccm(const struct nettle_cipher *cipher,
+ }
+
+ void
+-test_main(void)
++test_main_ccm(void)
+ {
+ /* Create a pattern of 00010203 04050607 08090a00b 0c0d0e0f ... */
+ struct tstring *adata;
+diff --git a/cfb-test.c b/cfb-test.c
+index dbb24e8..f99be6c 100644
+--- a/cfb-test.c
++++ b/cfb-test.c
+@@ -123,7 +123,7 @@ test_cfb8_bulk(void)
+ }
+
+ void
+-test_main(void)
++test_main_cfb(void)
+ {
+ /* From NIST spec 800-38a on AES modes.
+ *
+diff --git a/chacha-poly1305-test.c b/chacha-poly1305-test.c
+index 313e822..5afb54b 100644
+--- a/chacha-poly1305-test.c
++++ b/chacha-poly1305-test.c
+@@ -2,7 +2,7 @@
+ #include "nettle-internal.h"
+
+ void
+-test_main(void)
++test_main_chacha_poly1305(void)
+ {
+ /* From draft-irtf-cfrg-chacha20-poly1305-08 */
+ test_aead (&nettle_chacha_poly1305, NULL,
+diff --git a/chacha-test.c b/chacha-test.c
+index fb8f1db..d5bdd08 100644
+--- a/chacha-test.c
++++ b/chacha-test.c
+@@ -153,7 +153,7 @@ test_chacha_with_counter(const struct tstring *key, co=
nst struct tstring *nonce,
+ }
+
+ void
+-test_main(void)
++test_main_chacha(void)
+ {
+ /* Test vectors from draft-strombergson-chacha-test-vectors */
+ #if 0
+diff --git a/cmac-test.c b/cmac-test.c
+index a71baa0..b37efb1 100644
+--- a/cmac-test.c
++++ b/cmac-test.c
+@@ -12,7 +12,7 @@
+ test_mac(&nettle_cmac_des3, key, msg, ref)
+
+ void
+-test_main(void)
++test_main_cmac(void)
+ {
+ /*
+ * CMAC-AES Test Vectors from RFC4493.
+diff --git a/ctr-test.c b/ctr-test.c
+index 28f9c38..f9729de 100644
+--- a/ctr-test.c
++++ b/ctr-test.c
+@@ -2,7 +2,7 @@
+ #include "nettle-internal.h"
+
+ void
+-test_main(void)
++test_main_ctr(void)
+ {
+ /* From NIST spec 800-38a on AES modes,
+ *
+diff --git a/des-test.c b/des-test.c
+index a9c0eb9..bb3e4c8 100644
+--- a/des-test.c
++++ b/des-test.c
+@@ -63,7 +63,7 @@ test_weak(const struct tstring *key)
+ }
+
+ void
+-test_main(void)
++test_main_des(void)
+ {
+ /* From Applied Cryptography */
+ test_des(SHEX("01234567 89ABCDEF"), 1,
+diff --git a/des3-test.c b/des3-test.c
+index f0437ff..d806a75 100644
+--- a/des3-test.c
++++ b/des3-test.c
+@@ -3,7 +3,7 @@
+ #include "des.h"
+
+ void
+-test_main(void)
++test_main_des3(void)
+ {
+ /* Intermediate values:
+ * After first DES encryption: "cd ea 2a 20 c2 e0 9e 48"
+diff --git a/eax-test.c b/eax-test.c
+index f516df6..9e74c63 100644
+--- a/eax-test.c
++++ b/eax-test.c
+@@ -2,7 +2,7 @@
+ #include "nettle-internal.h"
+
+ void
+-test_main(void)
++test_main_eax(void)
+ {
+ /* From the EAX specification,
+ http://www.cs.ucdavis.edu/~rogaway/papers/eax.pdf */
+diff --git a/gcm-test.c b/gcm-test.c
+index c817401..9567668 100644
+--- a/gcm-test.c
++++ b/gcm-test.c
+@@ -57,7 +57,7 @@ nettle_gcm_unified_aes128 =3D {
+
+
+ void
+-test_main(void)
++test_main_gcm(void)
+ {
+ /*
+ * GCM-AES Test Vectors from
+diff --git a/gosthash94-test.c b/gosthash94-test.c
+index d4e5015..f3a971e 100644
+--- a/gosthash94-test.c
++++ b/gosthash94-test.c
+@@ -4,7 +4,7 @@
+ /* Using test vectors from Wikipedia article on GOST */
+
+ void
+-test_main(void)
++test_main_gosthash94(void)
+ {
+ test_hash(&nettle_gosthash94, SDATA("The quick brown fox jumps over the l=
azy dog"),
+ SHEX("77b7fa410c9ac58a25f49bca7d0468c9296529315eaca76bd1a10f376d1f4294"));
+diff --git a/hkdf-test.c b/hkdf-test.c
+index 80f4c81..788c281 100644
+--- a/hkdf-test.c
++++ b/hkdf-test.c
+@@ -96,7 +96,7 @@ test_hkdf_sha1(const struct tstring *ikm,
+ }
+
+ void
+-test_main(void)
++test_main_hkdf(void)
+ {
+ /* HKDF test vectors from RFC5869 */
+ test_hkdf_sha256(SHEX("0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b"),
+diff --git a/hmac-test.c b/hmac-test.c
+index de1b6bf..1758903 100644
+--- a/hmac-test.c
++++ b/hmac-test.c
+@@ -14,7 +14,7 @@
+ } while (0)
+
+ void
+-test_main(void)
++test_main_hmac(void)
+ {
+ /* sha512's digests are longest */
+ uint8_t digest[SHA512_DIGEST_SIZE+1];
+diff --git a/knuth-lfib-test.c b/knuth-lfib-test.c
+index 3e8bfdd..38fdfa0 100644
+--- a/knuth-lfib-test.c
++++ b/knuth-lfib-test.c
+@@ -2,7 +2,7 @@
+ #include "knuth-lfib.h"
+
+ void
+-test_main(void)
++test_main_knuth(void)
+ {
+ struct knuth_lfib_ctx ctx;
+
+diff --git a/md2-test.c b/md2-test.c
+index af14857..239e751 100644
+--- a/md2-test.c
++++ b/md2-test.c
+@@ -2,7 +2,7 @@
+ #include "md2.h"
+
+ void
+-test_main(void)
++test_main_md2(void)
+ {
+ /* Testcases from RFC 1319 */
+ test_hash(&nettle_md2, SDATA(""),
+diff --git a/md4-test.c b/md4-test.c
+index d46693d..928129b 100644
+--- a/md4-test.c
++++ b/md4-test.c
+@@ -2,7 +2,7 @@
+ #include "md4.h"
+
+ void
+-test_main(void)
++test_main_md4(void)
+ {
+ /* Testcases from RFC 1320 */
+ test_hash(&nettle_md4, SDATA(""),
+diff --git a/md5-compat-test.c b/md5-compat-test.c
+index e223400..7d13ea1 100644
+--- a/md5-compat-test.c
++++ b/md5-compat-test.c
+@@ -2,7 +2,7 @@
+ #include "md5-compat.h"
+
+ void
+-test_main(void)
++test_main_md5_compat(void)
+ {
+ MD5_CTX ctx;
+ unsigned char digest[MD5_DIGEST_SIZE];
+diff --git a/md5-test.c b/md5-test.c
+index 37c2fb1..6eed05e 100644
+--- a/md5-test.c
++++ b/md5-test.c
+@@ -2,7 +2,7 @@
+ #include "md5.h"
+
+ void
+-test_main(void)
++test_main_md5(void)
+ {
+ test_hash(&nettle_md5, SDATA(""),
+ SHEX("D41D8CD98F00B204 E9800998ECF8427E"));
+diff --git a/meta-aead-test.c b/meta-aead-test.c
+index 1fcede4..e402720 100644
+--- a/meta-aead-test.c
++++ b/meta-aead-test.c
+@@ -13,7 +13,7 @@ const char* aeads[] =3D {
+ };
+
+ void
+-test_main(void)
++test_main_meta_aead(void)
+ {
+ int i,j;
+ int count =3D sizeof(aeads)/sizeof(*aeads);
+diff --git a/meta-armor-test.c b/meta-armor-test.c
+index 406c8d0..4c21585 100644
+--- a/meta-armor-test.c
++++ b/meta-armor-test.c
+@@ -8,7 +8,7 @@ const char* armors[] =3D {
+ };
+
+ void
+-test_main(void)
++test_main_meta_armor(void)
+ {
+ int i,j;
+ int count =3D sizeof(armors)/sizeof(*armors);
+diff --git a/meta-cipher-test.c b/meta-cipher-test.c
+index f949fd7..883a19a 100644
+--- a/meta-cipher-test.c
++++ b/meta-cipher-test.c
+@@ -22,7 +22,7 @@ const char* ciphers[] =3D {
+ };
+
+ void
+-test_main(void)
++test_main_meta_ciphers(void)
+ {
+ int i,j;
+ int count =3D sizeof(ciphers)/sizeof(*ciphers);
+diff --git a/meta-hash-test.c b/meta-hash-test.c
+index 7d863a7..95c79af 100644
+--- a/meta-hash-test.c
++++ b/meta-hash-test.c
+@@ -23,7 +23,7 @@ const char* hashes[] =3D {
+ };
+
+ void
+-test_main(void)
++test_main_meta_hash(void)
+ {
+ int i;
+ int count =3D sizeof(hashes)/sizeof(*hashes);
+diff --git a/meta-mac-test.c b/meta-mac-test.c
+index 5533944..8fb11c3 100644
+--- a/meta-mac-test.c
++++ b/meta-mac-test.c
+@@ -15,7 +15,7 @@ const char* macs[] =3D {
+ };
+
+ void
+-test_main(void)
++test_main_meta_mac(void)
+ {
+ int i, j;
+ int count =3D sizeof(macs)/sizeof(*macs);
+diff --git a/pbkdf2-test.c b/pbkdf2-test.c
+index e64a20d..90f42ce 100644
+--- a/pbkdf2-test.c
++++ b/pbkdf2-test.c
+@@ -22,7 +22,7 @@
+ #define MAX_DKLEN SHA512_DIGEST_SIZE
+
+ void
+-test_main (void)
++test_main_pbkdf2 (void)
+ {
+ uint8_t dk[MAX_DKLEN + 1];
+ struct hmac_sha1_ctx sha1ctx;
+diff --git a/poly1305-test.c b/poly1305-test.c
+index ee70b3c..c580a13 100644
+--- a/poly1305-test.c
++++ b/poly1305-test.c
+@@ -52,7 +52,7 @@ test_poly1305 (const struct tstring *key,
+ }
+
+ void
+-test_main(void)
++test_main_poly1305(void)
+ {
+ /* From Bernstein's paper. */
+ test_poly1305
+diff --git a/ripemd160-test.c b/ripemd160-test.c
+index 85518e6..c3f5d4c 100644
+--- a/ripemd160-test.c
++++ b/ripemd160-test.c
+@@ -2,7 +2,7 @@
+ #include "ripemd160.h"
+
+ void
+-test_main(void)
++test_main_ripemd160(void)
+ {
+ test_hash(&nettle_ripemd160, SDATA(""),
+ SHEX("9c1185a5c5e9fc54612808977ee8f548b2258d31"));
+diff --git a/salsa20-test.c b/salsa20-test.c
+index 3a1b8ea..07f7284 100644
+--- a/salsa20-test.c
++++ b/salsa20-test.c
+@@ -189,7 +189,7 @@ _test_salsa20(salsa20_func *crypt,
+
+
+ void
+-test_main(void)
++test_main_salsa20(void)
+ {
+ /* http://www.ecrypt.eu.org/stream/svn/viewcvs.cgi/ecrypt/trunk/submissio=
ns/salsa20/reduced/12-rounds/verified.test-vectors?logsort=3Drev&rev=3D210&=
view=3Dmarkup */
+ test_salsa20r12(SHEX("80000000 00000000 00000000 00000000"),
+diff --git a/serpent-test.c b/serpent-test.c
+index 4b89a1e..dd3c354 100644
+--- a/serpent-test.c
++++ b/serpent-test.c
+@@ -67,7 +67,7 @@ test_serpent(const struct tstring *key,
+ }
+
+ void
+-test_main(void)
++test_main_serpent(void)
+ {
+ /* From libgcrypt */
+ test_cipher(&nettle_serpent128,
+diff --git a/sha1-huge-test.c b/sha1-huge-test.c
+index 156a762..9898187 100644
+--- a/sha1-huge-test.c
++++ b/sha1-huge-test.c
+@@ -1,7 +1,7 @@
+ #include "testutils.h"
+
+ void
+-test_main(void)
++test_main_sha1_huge(void)
+ {
+ /* Hashes 10 000 000 x 30 000 bytes > 64 * 2^32. This overflows the
+ low word of the block counter. This test vector is not cross
+diff --git a/sha1-test.c b/sha1-test.c
+index 8356555..d47b055 100644
+--- a/sha1-test.c
++++ b/sha1-test.c
+@@ -1,7 +1,7 @@
+ #include "testutils.h"
+
+ void
+-test_main(void)
++test_main_sha1(void)
+ {
+ test_hash(&nettle_sha1, SDATA(""),
+ SHEX("DA39A3EE5E6B4B0D 3255BFEF95601890 AFD80709"));
+diff --git a/sha224-test.c b/sha224-test.c
+index eb20c30..1731081 100644
+--- a/sha224-test.c
++++ b/sha224-test.c
+@@ -1,7 +1,7 @@
+ #include "testutils.h"
+
+ void
+-test_main(void)
++test_main_sha224(void)
+ {
+ /* From FIPS180-2 addendum
+ (http://csrc.nist.gov/publications/fips/fips180-2/fips180-2withchangenoti=
ce.pdf) */
+diff --git a/sha256-test.c b/sha256-test.c
+index 551b140..664f894 100644
+--- a/sha256-test.c
++++ b/sha256-test.c
+@@ -1,7 +1,7 @@
+ #include "testutils.h"
+
+ void
+-test_main(void)
++test_main_sha256(void)
+ {
+ /* From FIPS180-2 */
+ test_hash(&nettle_sha256, SDATA("abc"),
+diff --git a/sha3-224-test.c b/sha3-224-test.c
+index 627f4cb..39229f0 100644
+--- a/sha3-224-test.c
++++ b/sha3-224-test.c
+@@ -1,7 +1,7 @@
+ #include "testutils.h"
+
+ void
+-test_main(void)
++test_main_sha3_224(void)
+ {
+ /* Extracted from ShortMsgKAT_224.txt using sha3.awk. */
+ test_hash(&nettle_sha3_224, /* 0 octets */
+diff --git a/sha3-256-test.c b/sha3-256-test.c
+index f0dad08..ee4c249 100644
+--- a/sha3-256-test.c
++++ b/sha3-256-test.c
+@@ -1,7 +1,7 @@
+ #include "testutils.h"
+
+ void
+-test_main(void)
++test_main_sha3_256(void)
+ {
+ /* Extracted from ShortMsgKAT_256.txt using sha3.awk. */
+ test_hash(&nettle_sha3_256, /* 0 octets */
+diff --git a/sha3-384-test.c b/sha3-384-test.c
+index e973cf8..af30e31 100644
+--- a/sha3-384-test.c
++++ b/sha3-384-test.c
+@@ -1,7 +1,7 @@
+ #include "testutils.h"
+
+ void
+-test_main(void)
++test_main_sha3_384(void)
+ {
+ /* Extracted from ShortMsgKAT_384.txt using sha3.awk. */
+ test_hash(&nettle_sha3_384, /* 0 octets */
+diff --git a/sha3-512-test.c b/sha3-512-test.c
+index b323a7f..7a42039 100644
+--- a/sha3-512-test.c
++++ b/sha3-512-test.c
+@@ -1,7 +1,7 @@
+ #include "testutils.h"
+
+ void
+-test_main(void)
++test_main_sha3_512(void)
+ {
+ /* Extracted from ShortMsgKAT_512.txt using sha3.awk. */
+ test_hash(&nettle_sha3_512, /* 0 octets */
+diff --git a/sha3-permute-test.c b/sha3-permute-test.c
+index 1e4e9de..c2d65cd 100644
+--- a/sha3-permute-test.c
++++ b/sha3-permute-test.c
+@@ -17,7 +17,7 @@ display (const struct sha3_state *state)
+ }
+
+ void
+-test_main(void)
++test_main_sha3_permute(void)
+ {
+ /* From KeccakPermutationIntermediateValues.txt */
+ static const struct sha3_state s1 =3D
+diff --git a/sha384-test.c b/sha384-test.c
+index 13a0214..88a43da 100644
+--- a/sha384-test.c
++++ b/sha384-test.c
+@@ -1,7 +1,7 @@
+ #include "testutils.h"
+
+ void
+-test_main(void)
++test_main_sha384(void)
+ {
+ test_hash(&nettle_sha384, SDATA("abc"),
+ SHEX("cb00753f45a35e8b b5a03d699ac65007"
+diff --git a/sha512-224-test.c b/sha512-224-test.c
+index 6b81184..7517477 100644
+--- a/sha512-224-test.c
++++ b/sha512-224-test.c
+@@ -1,7 +1,7 @@
+ #include "testutils.h"
+
+ void
+-test_main(void)
++test_main_sha512_224(void)
+ {
+ /* From http://csrc.nist.gov/groups/ST/toolkit/documents/Examples/SHA_All=
.pdf */
+ test_hash(&nettle_sha512_224, SDATA("abc"),
+diff --git a/sha512-256-test.c b/sha512-256-test.c
+index c0613ed..539408a 100644
+--- a/sha512-256-test.c
++++ b/sha512-256-test.c
+@@ -1,7 +1,7 @@
+ #include "testutils.h"
+
+ void
+-test_main(void)
++test_main_sha512_256(void)
+ {
+ /* From http://csrc.nist.gov/groups/ST/toolkit/documents/Examples/SHA_All=
.pdf */
+ test_hash(&nettle_sha512_256, SDATA("abc"),
+diff --git a/sha512-test.c b/sha512-test.c
+index c501e09..f7ed230 100644
+--- a/sha512-test.c
++++ b/sha512-test.c
+@@ -1,7 +1,7 @@
+ #include "testutils.h"
+
+ void
+-test_main(void)
++test_main_sha512(void)
+ {
+ test_hash(&nettle_sha512, SDATA("abc"),
+ SHEX("ddaf35a193617aba cc417349ae204131"
+diff --git a/shake256-test.c b/shake256-test.c
+index b91417c..3feace8 100644
+--- a/shake256-test.c
++++ b/shake256-test.c
+@@ -46,7 +46,7 @@ const struct nettle_hash nettle_shake256 =3D
+ };
+
+ void
+-test_main(void)
++test_main_shake256(void)
+ {
+ /* Extracted from ShortMsgKAT_SHAKE256.txt. */
+ test_hash (&nettle_shake256, /* 0 octets */
+diff --git a/testutils.c b/testutils.c
+index 1f279e9..a0dae33 100644
+--- a/testutils.c
++++ b/testutils.c
+@@ -117,27 +117,6 @@ print_hex(size_t length, const uint8_t *data)
+
+ int verbose =3D 0;
+
+-int
+-main(int argc, char **argv)
+-{
+- if (argc > 1)
+- {
+- if (argc =3D=3D 2 && !strcmp(argv[1], "-v"))
+- verbose =3D 1;
+- else
+- {
+- fprintf(stderr, "Invalid argument `%s', only accepted option is `-v'.\n",
+- argv[1]);
+- return 1;
+- }
+- }
+-
+- test_main();
+-
+- tstring_clear();
+- return EXIT_SUCCESS;
+-}
+-
+ void
+ test_cipher(const struct nettle_cipher *cipher,
+ const struct tstring *key,
+diff --git a/twofish-test.c b/twofish-test.c
+index 2bef44c..187ac46 100644
+--- a/twofish-test.c
++++ b/twofish-test.c
+@@ -2,7 +2,7 @@
+ #include "twofish.h"
+
+ void
+-test_main(void)
++test_main_twofish(void)
+ {
+ /* 128 bit key */
+ test_cipher(&nettle_twofish128,
+diff --git a/umac-test.c b/umac-test.c
+index 0fb97cb..af42b2e 100644
+--- a/umac-test.c
++++ b/umac-test.c
+@@ -211,7 +211,7 @@ test_incr (const struct tstring *key,
+ }
+
+ void
+-test_main(void)
++test_main_umac(void)
+ {
+ /* From RFC 4418 (except that it lacks the last 32 bits of 128-bit
+ tags) */
+diff --git a/xts-test.c b/xts-test.c
+index 723a5a1..49e66f2 100644
+--- a/xts-test.c
++++ b/xts-test.c
+@@ -108,7 +108,7 @@ test_cipher_xts(const struct nettle_cipher *cipher,
+ }
+
+ void
+-test_main(void)
++test_main_xts(void)
+ {
+ /* From NIST CAVS 11.0,
+ *
+diff --git a/yarrow-test.c b/yarrow-test.c
+index facc4fd..57a05b5 100644
+--- a/yarrow-test.c
++++ b/yarrow-test.c
+@@ -59,7 +59,7 @@ open_file(const char *name)
+ }
+
+ void
+-test_main(void)
++test_main_yarrow(void)
+ {
+ FILE *input;
+
+diff --git a/buffer-test.c b/buffer-test.c
+index fe2e222..7585054 100644
+--- a/buffer-test.c
++++ b/buffer-test.c
+@@ -2,7 +2,7 @@
+ #include "buffer.h"
+
+ void
+-test_main(void)
++test_main_buffer(void)
+ {
+ struct nettle_buffer buffer;
+ uint8_t s[5];
+diff --git a/cast128-test.c b/cast128-test.c
+index 534eb17..af171a6 100644
+--- a/cast128-test.c
++++ b/cast128-test.c
+@@ -45,7 +45,7 @@ test_cast5(const struct tstring *key,
+ }
+
+ void
+-test_main(void)
++test_main_cast128(void)
+ {
+ /* Test vectors from B.1. Single Plaintext-Key-Ciphertext Sets, RFC
+ * 2144 */
+--
+2.25.1
+
--
2.25.1



------=_NextPart_32760917.711275528375
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 Cristian,</span><div st=
yle=3D"font-size: 13.3333px"><br></div><div style=3D"font-size: 13.3333px">=
This patch looks good to me.</div><div style=3D"font-size: 13.3333px"><br><=
/div><div style=3D"font-size: 13.3333px">Reviewed-by: Cezar Craciunoiu &lt;=
cezar.craciunoiu@gmail.com&gt;</div><div class=3D"mb_sig"></div><blockquote=
 class=3D"history_container" type=3D"cite" style=3D"border-left-style:solid=
;border-width:1px; margin-top:20px; margin-left:0px;padding-left:10px;">=0A=
                        <p style=3D"color: #AAAAAA; margin-top: 10px;">On 2=
021-01-28 19:07:24, cristian-vijelie &lt;cristianvijelie@gmail.com&gt; wrot=
e:</p><div style=3D"font-family:Arial,Helvetica,sans-serif">The patch is re=
quired to be able to run the test suite.=0A<br>=0A<br>Signed-off-by: cristi=
an-vijelie <cristianvijelie@gmail.com>=0A<br>---=0A<br> patches/0001-Made-t=
he-tests-runnable.patch | 838 +++++++++++++++++++++=0A<br> 1 file changed, =
838 insertions(+)=0A<br> create mode 100644 patches/0001-Made-the-tests-run=
nable.patch=0A<br>=0A<br>diff --git a/patches/0001-Made-the-tests-runnable.=
patch b/patches/0001-Made-the-tests-runnable.patch=0A<br>new file mode 1006=
44=0A<br>index 0000000..463d0c8=0A<br>--- /dev/null=0A<br>+++ b/patches/000=
1-Made-the-tests-runnable.patch=0A<br>@@ -0,0 +1,838 @@=0A<br>+From fb88986=
4b018eb3ceae9dad5328984367dcb3ef3 Mon Sep 17 00:00:00 2001=0A<br>+From: cri=
stian-vijelie <cristianvijelie@gmail.com>=0A<br>+Date: Fri, 4 Dec 2020 14:0=
9:40 +0200=0A<br>+Subject: [PATCH] Made the tests runnable=0A<br>+=0A<br>+T=
he test suite provided for libnettle has a test_main() function for each of=
=0A<br>+the test files, that is used in testsuite.c, which contains the mai=
n function=0A<br>+of the test suite. So, for each test, a new executable is=
 built. This cannot=0A<br>+happen in unikraft.=0A<br>+=0A<br>+This patch re=
moves the main() function from testutils.c and renames each=0A<br>+test_mai=
n() function from the test sources, so they all have different names.=0A<br=
>+This way is possible to call all the functions from the testing app.=0A<b=
r>+=0A<br>+Signed-off-by: Cristian Vijelie <cristianvijelie@gmail.com>=0A<b=
r>+---=0A<br>+ aes-test.c    |  2 +-=0A<br>+ arcfour-test.c       |  2 +-=
=0A<br>+ arctwo-test.c |  2 +-=0A<br>+ base16-test.c |  2 +-=0A<br>+ base64=
-test.c |  2 +-=0A<br>+ blowfish-test.c      |  2 +-=0A<br>+ camellia-test.=
c      |  2 +-=0A<br>+ cbc-test.c    |  2 +-=0A<br>+ ccm-test.c    |  2 +-=
=0A<br>+ cfb-test.c    |  2 +-=0A<br>+ chacha-poly1305-test.c          |  2=
 +-=0A<br>+ chacha-test.c |  2 +-=0A<br>+ cmac-test.c   |  2 +-=0A<br>+ ctr=
-test.c    |  2 +-=0A<br>+ des-test.c    |  2 +-=0A<br>+ des3-test.c   |  2=
 +-=0A<br>+ eax-test.c    |  2 +-=0A<br>+ gcm-test.c    |  2 +-=0A<br>+ gos=
thash94-test.c    |  2 +-=0A<br>+ hkdf-test.c   |  2 +-=0A<br>+ hmac-test.c=
   |  2 +-=0A<br>+ knuth-lfib-test.c    |  2 +-=0A<br>+ md2-test.c    |  2 =
+-=0A<br>+ md4-test.c    |  2 +-=0A<br>+ md5-compat-test.c    |  2 +-=0A<br=
>+ md5-test.c    |  2 +-=0A<br>+ meta-aead-test.c     |  2 +-=0A<br>+ meta-=
armor-test.c    |  2 +-=0A<br>+ meta-cipher-test.c   |  2 +-=0A<br>+ meta-h=
ash-test.c     |  2 +-=0A<br>+ meta-mac-test.c      |  2 +-=0A<br>+ pbkdf2-=
test.c |  2 +-=0A<br>+ poly1305-test.c      |  2 +-=0A<br>+ ripemd160-test.=
c     |  2 +-=0A<br>+ salsa20-test.c       |  2 +-=0A<br>+ serpent-test.c  =
     |  2 +-=0A<br>+ sha1-huge-test.c     |  2 +-=0A<br>+ sha1-test.c   |  =
2 +-=0A<br>+ sha224-test.c |  2 +-=0A<br>+ sha256-test.c |  2 +-=0A<br>+ sh=
a3-224-test.c      |  2 +-=0A<br>+ sha3-256-test.c      |  2 +-=0A<br>+ sha=
3-384-test.c      |  2 +-=0A<br>+ sha3-512-test.c      |  2 +-=0A<br>+ sha3=
-permute-test.c  |  2 +-=0A<br>+ sha384-test.c |  2 +-=0A<br>+ sha512-224-t=
est.c    |  2 +-=0A<br>+ sha512-256-test.c    |  2 +-=0A<br>+ sha512-test.c=
 |  2 +-=0A<br>+ shake256-test.c      |  2 +-=0A<br>+ testutils.c   | 21 --=
-----------------=0A<br>+ twofish-test.c       |  2 +-=0A<br>+ umac-test.c =
  |  2 +-=0A<br>+ xts-test.c    |  2 +-=0A<br>+ yarrow-test.c |  2 +-=0A<br=
>+ buffer-test.c  | 2 +-=0A<br>+ cast128-test.c | 2 +-=0A<br>+ 57 files cha=
nged, 56 insertions(+), 77 deletions(-)=0A<br>+=0A<br>+diff --git a/aes-tes=
t.c b/aes-test.c=0A<br>+index 078bd67..3cd0140 100644=0A<br>+--- a/aes-test=
.c=0A<br>++++ b/aes-test.c=0A<br>+@@ -116,7 +116,7 @@ test_cipher2(const st=
ruct nettle_cipher *c1,=0A<br>+ }=0A<br>+ =0A<br>+ void=0A<br>+-test_main(v=
oid)=0A<br>++test_main_aes(void)=0A<br>+ {=0A<br>+   /* Test both the new i=
nterface and the older unified interface. */=0A<br>+ =0A<br>+diff --git a/a=
rcfour-test.c b/arcfour-test.c=0A<br>+index b2b039b..bfea126 100644=0A<br>+=
--- a/arcfour-test.c=0A<br>++++ b/arcfour-test.c=0A<br>+@@ -68,7 +68,7 @@ t=
est_arcfour(const struct tstring *key,=0A<br>+ }=0A<br>+ =0A<br>+ void=0A<b=
r>+-test_main(void)=0A<br>++test_main_arcfour(void)=0A<br>+ {=0A<br>+   tes=
t_arcfour(SHEX("01234567 89ABCDEF 00000000 00000000"),=0A<br>+ 	       SHEX=
("01234567 89ABCDEF"),=0A<br>+diff --git a/arctwo-test.c b/arctwo-test.c=0A=
<br>+index d91d522..78a8235 100644=0A<br>+--- a/arctwo-test.c=0A<br>++++ b/=
arctwo-test.c=0A<br>+@@ -62,7 +62,7 @@ test_arctwo(unsigned ekb,=0A<br>+ }=
=0A<br>+ =0A<br>+ void=0A<br>+-test_main(void)=0A<br>++test_main_arctwo(voi=
d)=0A<br>+ {=0A<br>+   /* Test vectors from Peter Gutmann's paper. */=0A<br=
>+   test_cipher(&amp;nettle_arctwo_gutmann128,=0A<br>+diff --git a/base16-=
test.c b/base16-test.c=0A<br>+index 820915b..305b123 100644=0A<br>+--- a/ba=
se16-test.c=0A<br>++++ b/base16-test.c=0A<br>+@@ -2,7 +2,7 @@=0A<br>+ #incl=
ude "base16.h"=0A<br>+ =0A<br>+ void=0A<br>+-test_main(void)=0A<br>++test_m=
ain_base16(void)=0A<br>+ {=0A<br>+   ASSERT(BASE16_ENCODE_LENGTH(0) =3D=3D =
0);=0A<br>+   ASSERT(BASE16_ENCODE_LENGTH(1) =3D=3D 2);=0A<br>+diff --git a=
/base64-test.c b/base64-test.c=0A<br>+index cc45c47..3522277 100644=0A<br>+=
--- a/base64-test.c=0A<br>++++ b/base64-test.c=0A<br>+@@ -81,7 +81,7 @@ bas=
e64_decode_in_place (struct base64_decode_ctx *ctx, size_t *dst_length,=0A<=
br>+ }=0A<br>+ =0A<br>+ void=0A<br>+-test_main(void)=0A<br>++test_main_base=
64(void)=0A<br>+ {=0A<br>+   ASSERT(BASE64_ENCODE_LENGTH(0) =3D=3D 0);   /*=
 At most   4 bits */=0A<br>+   ASSERT(BASE64_ENCODE_LENGTH(1) =3D=3D 2);   =
/* At most  12 bits */=0A<br>+diff --git a/blowfish-test.c b/blowfish-test.=
c=0A<br>+index cadeda5..eeb91e5 100644=0A<br>+--- a/blowfish-test.c=0A<br>+=
+++ b/blowfish-test.c=0A<br>+@@ -46,7 +46,7 @@ test_blowfish(const struct t=
string *key,=0A<br>+ }=0A<br>+ =0A<br>+ void=0A<br>+-test_main(void)=0A<br>=
++test_main_blowfish(void)=0A<br>+ {=0A<br>+   /* 208 bit key. Test from GN=
UPG. */=0A<br>+   test_blowfish(SDATA("abcdefghijklmnopqrstuvwxyz"),=0A<br>=
+diff --git a/camellia-test.c b/camellia-test.c=0A<br>+index f6c850a..fbd48=
58 100644=0A<br>+--- a/camellia-test.c=0A<br>++++ b/camellia-test.c=0A<br>+=
@@ -73,7 +73,7 @@ test_invert(const struct tstring *key,=0A<br>+ }=0A<br>+ =
=0A<br>+ void=0A<br>+-test_main(void)=0A<br>++test_main_camellia(void)=0A<b=
r>+ {=0A<br>+   /* Test vectors from RFC 3713 */=0A<br>+   /* 128 bit keys =
*/=0A<br>+diff --git a/cbc-test.c b/cbc-test.c=0A<br>+index 9394f1c..96bf81=
c 100644=0A<br>+--- a/cbc-test.c=0A<br>++++ b/cbc-test.c=0A<br>+@@ -65,7 +6=
5,7 @@ test_cbc_bulk(void)=0A<br>+ }=0A<br>+ =0A<br>+ void=0A<br>+-test_mai=
n(void)=0A<br>++test_main_cbc(void)=0A<br>+ {=0A<br>+   /* Intermediate val=
ues:=0A<br>+    *   iv XOR first message block:=0A<br>+diff --git a/ccm-tes=
t.c b/ccm-test.c=0A<br>+index 4176cc7..a1d0245 100644=0A<br>+--- a/ccm-test=
.c=0A<br>++++ b/ccm-test.c=0A<br>+@@ -249,7 +249,7 @@ test_cipher_ccm(const=
 struct nettle_cipher *cipher,=0A<br>+ }=0A<br>+ =0A<br>+ void=0A<br>+-test=
_main(void)=0A<br>++test_main_ccm(void)=0A<br>+ {=0A<br>+   /* Create a pat=
tern of 00010203 04050607 08090a00b 0c0d0e0f ... */=0A<br>+   struct tstrin=
g *adata;=0A<br>+diff --git a/cfb-test.c b/cfb-test.c=0A<br>+index dbb24e8.=
.f99be6c 100644=0A<br>+--- a/cfb-test.c=0A<br>++++ b/cfb-test.c=0A<br>+@@ -=
123,7 +123,7 @@ test_cfb8_bulk(void)=0A<br>+ }=0A<br>+ =0A<br>+ void=0A<br>=
+-test_main(void)=0A<br>++test_main_cfb(void)=0A<br>+ {=0A<br>+   /* From N=
IST spec 800-38a on AES modes.=0A<br>+    *=0A<br>+diff --git a/chacha-poly=
1305-test.c b/chacha-poly1305-test.c=0A<br>+index 313e822..5afb54b 100644=
=0A<br>+--- a/chacha-poly1305-test.c=0A<br>++++ b/chacha-poly1305-test.c=0A=
<br>+@@ -2,7 +2,7 @@=0A<br>+ #include "nettle-internal.h"=0A<br>+ =0A<br>+ =
void=0A<br>+-test_main(void)=0A<br>++test_main_chacha_poly1305(void)=0A<br>=
+ {=0A<br>+   /* From draft-irtf-cfrg-chacha20-poly1305-08 */=0A<br>+   tes=
t_aead (&amp;nettle_chacha_poly1305, NULL,=0A<br>+diff --git a/chacha-test.=
c b/chacha-test.c=0A<br>+index fb8f1db..d5bdd08 100644=0A<br>+--- a/chacha-=
test.c=0A<br>++++ b/chacha-test.c=0A<br>+@@ -153,7 +153,7 @@ test_chacha_wi=
th_counter(const struct tstring *key, const struct tstring *nonce,=0A<br>+ =
}=0A<br>+ =0A<br>+ void=0A<br>+-test_main(void)=0A<br>++test_main_chacha(vo=
id)=0A<br>+ {=0A<br>+   /* Test vectors from draft-strombergson-chacha-test=
-vectors */=0A<br>+ #if 0=0A<br>+diff --git a/cmac-test.c b/cmac-test.c=0A<=
br>+index a71baa0..b37efb1 100644=0A<br>+--- a/cmac-test.c=0A<br>++++ b/cma=
c-test.c=0A<br>+@@ -12,7 +12,7 @@=0A<br>+   test_mac(&amp;nettle_cmac_des3,=
 key, msg, ref)=0A<br>+ =0A<br>+ void=0A<br>+-test_main(void)=0A<br>++test_=
main_cmac(void)=0A<br>+ {=0A<br>+   /*=0A<br>+    * CMAC-AES Test Vectors f=
rom RFC4493.=0A<br>+diff --git a/ctr-test.c b/ctr-test.c=0A<br>+index 28f9c=
38..f9729de 100644=0A<br>+--- a/ctr-test.c=0A<br>++++ b/ctr-test.c=0A<br>+@=
@ -2,7 +2,7 @@=0A<br>+ #include "nettle-internal.h"=0A<br>+ =0A<br>+ void=
=0A<br>+-test_main(void)=0A<br>++test_main_ctr(void)=0A<br>+ {=0A<br>+   /*=
 From NIST spec 800-38a on AES modes,=0A<br>+    *=0A<br>+diff --git a/des-=
test.c b/des-test.c=0A<br>+index a9c0eb9..bb3e4c8 100644=0A<br>+--- a/des-t=
est.c=0A<br>++++ b/des-test.c=0A<br>+@@ -63,7 +63,7 @@ test_weak(const stru=
ct tstring *key)=0A<br>+ }=0A<br>+ =0A<br>+ void=0A<br>+-test_main(void)=0A=
<br>++test_main_des(void)=0A<br>+ {=0A<br>+   /* From Applied Cryptography =
*/=0A<br>+   test_des(SHEX("01234567 89ABCDEF"), 1,=0A<br>+diff --git a/des=
3-test.c b/des3-test.c=0A<br>+index f0437ff..d806a75 100644=0A<br>+--- a/de=
s3-test.c=0A<br>++++ b/des3-test.c=0A<br>+@@ -3,7 +3,7 @@=0A<br>+ #include =
"des.h"=0A<br>+ =0A<br>+ void=0A<br>+-test_main(void)=0A<br>++test_main_des=
3(void)=0A<br>+ {=0A<br>+   /* Intermediate values:=0A<br>+    *   After fi=
rst DES encryption:  "cd ea 2a 20 c2 e0 9e 48"=0A<br>+diff --git a/eax-test=
.c b/eax-test.c=0A<br>+index f516df6..9e74c63 100644=0A<br>+--- a/eax-test.=
c=0A<br>++++ b/eax-test.c=0A<br>+@@ -2,7 +2,7 @@=0A<br>+ #include "nettle-i=
nternal.h"=0A<br>+ =0A<br>+ void=0A<br>+-test_main(void)=0A<br>++test_main_=
eax(void)=0A<br>+ {=0A<br>+   /* From the EAX specification,=0A<br>+      h=
ttp://www.cs.ucdavis.edu/~rogaway/papers/eax.pdf */=0A<br>+diff --git a/gcm=
-test.c b/gcm-test.c=0A<br>+index c817401..9567668 100644=0A<br>+--- a/gcm-=
test.c=0A<br>++++ b/gcm-test.c=0A<br>+@@ -57,7 +57,7 @@ nettle_gcm_unified_=
aes128 =3D {=0A<br>+     =0A<br>+ =0A<br>+ void=0A<br>+-test_main(void)=0A<=
br>++test_main_gcm(void)=0A<br>+ {=0A<br>+   /* =0A<br>+    * GCM-AES Test =
Vectors from=0A<br>+diff --git a/gosthash94-test.c b/gosthash94-test.c=0A<b=
r>+index d4e5015..f3a971e 100644=0A<br>+--- a/gosthash94-test.c=0A<br>++++ =
b/gosthash94-test.c=0A<br>+@@ -4,7 +4,7 @@=0A<br>+ /* Using test vectors fr=
om Wikipedia article on GOST */=0A<br>+ =0A<br>+ void=0A<br>+-test_main(voi=
d)=0A<br>++test_main_gosthash94(void)=0A<br>+ {=0A<br>+   test_hash(&amp;ne=
ttle_gosthash94, SDATA("The quick brown fox jumps over the lazy dog"),=0A<b=
r>+ 	    SHEX("77b7fa410c9ac58a25f49bca7d0468c9296529315eaca76bd1a10f376d1f=
4294"));=0A<br>+diff --git a/hkdf-test.c b/hkdf-test.c=0A<br>+index 80f4c81=
..788c281 100644=0A<br>+--- a/hkdf-test.c=0A<br>++++ b/hkdf-test.c=0A<br>+@=
@ -96,7 +96,7 @@ test_hkdf_sha1(const struct tstring *ikm,=0A<br>+ }=0A<br>=
+ =0A<br>+ void=0A<br>+-test_main(void)=0A<br>++test_main_hkdf(void)=0A<br>=
+ {=0A<br>+   /* HKDF test vectors from RFC5869 */=0A<br>+   test_hkdf_sha2=
56(SHEX("0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b"),=0A<br>+diff --git =
a/hmac-test.c b/hmac-test.c=0A<br>+index de1b6bf..1758903 100644=0A<br>+---=
 a/hmac-test.c=0A<br>++++ b/hmac-test.c=0A<br>+@@ -14,7 +14,7 @@=0A<br>+   =
} while (0)=0A<br>+ =0A<br>+ void=0A<br>+-test_main(void)=0A<br>++test_main=
_hmac(void)=0A<br>+ {=0A<br>+   /* sha512's digests are longest */=0A<br>+ =
  uint8_t digest[SHA512_DIGEST_SIZE+1];=0A<br>+diff --git a/knuth-lfib-test=
.c b/knuth-lfib-test.c=0A<br>+index 3e8bfdd..38fdfa0 100644=0A<br>+--- a/kn=
uth-lfib-test.c=0A<br>++++ b/knuth-lfib-test.c=0A<br>+@@ -2,7 +2,7 @@=0A<br=
>+ #include "knuth-lfib.h"=0A<br>+ =0A<br>+ void=0A<br>+-test_main(void)=0A=
<br>++test_main_knuth(void)=0A<br>+ {=0A<br>+   struct knuth_lfib_ctx ctx;=
=0A<br>+ =0A<br>+diff --git a/md2-test.c b/md2-test.c=0A<br>+index af14857.=
.239e751 100644=0A<br>+--- a/md2-test.c=0A<br>++++ b/md2-test.c=0A<br>+@@ -=
2,7 +2,7 @@=0A<br>+ #include "md2.h"=0A<br>+ =0A<br>+ void=0A<br>+-test_mai=
n(void)=0A<br>++test_main_md2(void)=0A<br>+ {=0A<br>+   /* Testcases from R=
FC 1319 */=0A<br>+   test_hash(&amp;nettle_md2, SDATA(""),=0A<br>+diff --gi=
t a/md4-test.c b/md4-test.c=0A<br>+index d46693d..928129b 100644=0A<br>+---=
 a/md4-test.c=0A<br>++++ b/md4-test.c=0A<br>+@@ -2,7 +2,7 @@=0A<br>+ #inclu=
de "md4.h"=0A<br>+ =0A<br>+ void=0A<br>+-test_main(void)=0A<br>++test_main_=
md4(void)=0A<br>+ {=0A<br>+   /* Testcases from RFC 1320 */=0A<br>+   test_=
hash(&amp;nettle_md4, SDATA(""),=0A<br>+diff --git a/md5-compat-test.c b/md=
5-compat-test.c=0A<br>+index e223400..7d13ea1 100644=0A<br>+--- a/md5-compa=
t-test.c=0A<br>++++ b/md5-compat-test.c=0A<br>+@@ -2,7 +2,7 @@=0A<br>+ #inc=
lude "md5-compat.h"=0A<br>+ =0A<br>+ void=0A<br>+-test_main(void)=0A<br>++t=
est_main_md5_compat(void)=0A<br>+ {=0A<br>+   MD5_CTX ctx;=0A<br>+   unsign=
ed char digest[MD5_DIGEST_SIZE];=0A<br>+diff --git a/md5-test.c b/md5-test.=
c=0A<br>+index 37c2fb1..6eed05e 100644=0A<br>+--- a/md5-test.c=0A<br>++++ b=
/md5-test.c=0A<br>+@@ -2,7 +2,7 @@=0A<br>+ #include "md5.h"=0A<br>+ =0A<br>=
+ void=0A<br>+-test_main(void)=0A<br>++test_main_md5(void)=0A<br>+ {=0A<br>=
+   test_hash(&amp;nettle_md5, SDATA(""),=0A<br>+ 	    SHEX("D41D8CD98F00B2=
04 E9800998ECF8427E"));=0A<br>+diff --git a/meta-aead-test.c b/meta-aead-te=
st.c=0A<br>+index 1fcede4..e402720 100644=0A<br>+--- a/meta-aead-test.c=0A<=
br>++++ b/meta-aead-test.c=0A<br>+@@ -13,7 +13,7 @@ const char* aeads[] =3D=
 {=0A<br>+ };=0A<br>+ =0A<br>+ void=0A<br>+-test_main(void)=0A<br>++test_ma=
in_meta_aead(void)=0A<br>+ {=0A<br>+   int i,j;=0A<br>+   int count =3D siz=
eof(aeads)/sizeof(*aeads);=0A<br>+diff --git a/meta-armor-test.c b/meta-arm=
or-test.c=0A<br>+index 406c8d0..4c21585 100644=0A<br>+--- a/meta-armor-test=
.c=0A<br>++++ b/meta-armor-test.c=0A<br>+@@ -8,7 +8,7 @@ const char* armors=
[] =3D {=0A<br>+ };=0A<br>+ =0A<br>+ void=0A<br>+-test_main(void)=0A<br>++t=
est_main_meta_armor(void)=0A<br>+ {=0A<br>+   int i,j;=0A<br>+   int count =
=3D sizeof(armors)/sizeof(*armors);=0A<br>+diff --git a/meta-cipher-test.c =
b/meta-cipher-test.c=0A<br>+index f949fd7..883a19a 100644=0A<br>+--- a/meta=
-cipher-test.c=0A<br>++++ b/meta-cipher-test.c=0A<br>+@@ -22,7 +22,7 @@ con=
st char* ciphers[] =3D {=0A<br>+ };=0A<br>+ =0A<br>+ void=0A<br>+-test_main=
(void)=0A<br>++test_main_meta_ciphers(void)=0A<br>+ {=0A<br>+   int i,j;=0A=
<br>+   int count =3D sizeof(ciphers)/sizeof(*ciphers);=0A<br>+diff --git a=
/meta-hash-test.c b/meta-hash-test.c=0A<br>+index 7d863a7..95c79af 100644=
=0A<br>+--- a/meta-hash-test.c=0A<br>++++ b/meta-hash-test.c=0A<br>+@@ -23,=
7 +23,7 @@ const char* hashes[] =3D {=0A<br>+ };=0A<br>+ =0A<br>+ void=0A<b=
r>+-test_main(void)=0A<br>++test_main_meta_hash(void)=0A<br>+ {=0A<br>+   i=
nt i;=0A<br>+   int count =3D sizeof(hashes)/sizeof(*hashes);=0A<br>+diff -=
-git a/meta-mac-test.c b/meta-mac-test.c=0A<br>+index 5533944..8fb11c3 1006=
44=0A<br>+--- a/meta-mac-test.c=0A<br>++++ b/meta-mac-test.c=0A<br>+@@ -15,=
7 +15,7 @@ const char* macs[] =3D {=0A<br>+ };=0A<br>+ =0A<br>+ void=0A<br>=
+-test_main(void)=0A<br>++test_main_meta_mac(void)=0A<br>+ {=0A<br>+   int =
i, j;=0A<br>+   int count =3D sizeof(macs)/sizeof(*macs);=0A<br>+diff --git=
 a/pbkdf2-test.c b/pbkdf2-test.c=0A<br>+index e64a20d..90f42ce 100644=0A<br=
>+--- a/pbkdf2-test.c=0A<br>++++ b/pbkdf2-test.c=0A<br>+@@ -22,7 +22,7 @@=
=0A<br>+ #define MAX_DKLEN SHA512_DIGEST_SIZE=0A<br>+ =0A<br>+ void=0A<br>+=
-test_main (void)=0A<br>++test_main_pbkdf2 (void)=0A<br>+ {=0A<br>+   uint8=
_t dk[MAX_DKLEN + 1];=0A<br>+   struct hmac_sha1_ctx sha1ctx;=0A<br>+diff -=
-git a/poly1305-test.c b/poly1305-test.c=0A<br>+index ee70b3c..c580a13 1006=
44=0A<br>+--- a/poly1305-test.c=0A<br>++++ b/poly1305-test.c=0A<br>+@@ -52,=
7 +52,7 @@ test_poly1305 (const struct tstring *key,=0A<br>+ }=0A<br>+ =0A<=
br>+ void=0A<br>+-test_main(void)=0A<br>++test_main_poly1305(void)=0A<br>+ =
{=0A<br>+   /* From Bernstein's paper. */=0A<br>+   test_poly1305=0A<br>+di=
ff --git a/ripemd160-test.c b/ripemd160-test.c=0A<br>+index 85518e6..c3f5d4=
c 100644=0A<br>+--- a/ripemd160-test.c=0A<br>++++ b/ripemd160-test.c=0A<br>=
+@@ -2,7 +2,7 @@=0A<br>+ #include "ripemd160.h"=0A<br>+ =0A<br>+ void=0A<br=
>+-test_main(void)=0A<br>++test_main_ripemd160(void)=0A<br>+ {=0A<br>+   te=
st_hash(&amp;nettle_ripemd160, SDATA(""),=0A<br>+ 	    SHEX("9c1185a5c5e9fc=
54612808977ee8f548b2258d31"));=0A<br>+diff --git a/salsa20-test.c b/salsa20=
-test.c=0A<br>+index 3a1b8ea..07f7284 100644=0A<br>+--- a/salsa20-test.c=0A=
<br>++++ b/salsa20-test.c=0A<br>+@@ -189,7 +189,7 @@ _test_salsa20(salsa20_=
func *crypt,=0A<br>+ =0A<br>+   =0A<br>+ void=0A<br>+-test_main(void)=0A<br=
>++test_main_salsa20(void)=0A<br>+ {=0A<br>+   /* http://www.ecrypt.eu.org/=
stream/svn/viewcvs.cgi/ecrypt/trunk/submissions/salsa20/reduced/12-rounds/v=
erified.test-vectors?logsort=3Drev&amp;rev=3D210&amp;view=3Dmarkup */=0A<br=
>+   test_salsa20r12(SHEX("80000000 00000000 00000000 00000000"),=0A<br>+di=
ff --git a/serpent-test.c b/serpent-test.c=0A<br>+index 4b89a1e..dd3c354 10=
0644=0A<br>+--- a/serpent-test.c=0A<br>++++ b/serpent-test.c=0A<br>+@@ -67,=
7 +67,7 @@ test_serpent(const struct tstring *key,=0A<br>+ }=0A<br>+ =0A<br=
>+ void=0A<br>+-test_main(void)=0A<br>++test_main_serpent(void)=0A<br>+ {=
=0A<br>+   /* From libgcrypt */=0A<br>+   test_cipher(&amp;nettle_serpent12=
8,=0A<br>+diff --git a/sha1-huge-test.c b/sha1-huge-test.c=0A<br>+index 156=
a762..9898187 100644=0A<br>+--- a/sha1-huge-test.c=0A<br>++++ b/sha1-huge-t=
est.c=0A<br>+@@ -1,7 +1,7 @@=0A<br>+ #include "testutils.h"=0A<br>+ =0A<br>=
+ void=0A<br>+-test_main(void)=0A<br>++test_main_sha1_huge(void)=0A<br>+ {=
=0A<br>+   /* Hashes 10 000 000 x 30 000 bytes &gt; 64 * 2^32. This overflo=
ws the=0A<br>+      low word of the block counter. This test vector is not =
cross=0A<br>+diff --git a/sha1-test.c b/sha1-test.c=0A<br>+index 8356555..d=
47b055 100644=0A<br>+--- a/sha1-test.c=0A<br>++++ b/sha1-test.c=0A<br>+@@ -=
1,7 +1,7 @@=0A<br>+ #include "testutils.h"=0A<br>+ =0A<br>+ void=0A<br>+-te=
st_main(void)=0A<br>++test_main_sha1(void)=0A<br>+ {=0A<br>+   test_hash(&a=
mp;nettle_sha1, SDATA(""),=0A<br>+ 	    SHEX("DA39A3EE5E6B4B0D 3255BFEF9560=
1890 AFD80709")); =0A<br>+diff --git a/sha224-test.c b/sha224-test.c=0A<br>=
+index eb20c30..1731081 100644=0A<br>+--- a/sha224-test.c=0A<br>++++ b/sha2=
24-test.c=0A<br>+@@ -1,7 +1,7 @@=0A<br>+ #include "testutils.h"=0A<br>+ =0A=
<br>+ void=0A<br>+-test_main(void)=0A<br>++test_main_sha224(void)=0A<br>+ {=
=0A<br>+   /* From FIPS180-2 addendum=0A<br>+      (http://csrc.nist.gov/pu=
blications/fips/fips180-2/fips180-2withchangenotice.pdf) */=0A<br>+diff --g=
it a/sha256-test.c b/sha256-test.c=0A<br>+index 551b140..664f894 100644=0A<=
br>+--- a/sha256-test.c=0A<br>++++ b/sha256-test.c=0A<br>+@@ -1,7 +1,7 @@=
=0A<br>+ #include "testutils.h"=0A<br>+ =0A<br>+ void=0A<br>+-test_main(voi=
d)=0A<br>++test_main_sha256(void)=0A<br>+ {=0A<br>+   /* From FIPS180-2 */=
=0A<br>+   test_hash(&amp;nettle_sha256, SDATA("abc"),=0A<br>+diff --git a/=
sha3-224-test.c b/sha3-224-test.c=0A<br>+index 627f4cb..39229f0 100644=0A<b=
r>+--- a/sha3-224-test.c=0A<br>++++ b/sha3-224-test.c=0A<br>+@@ -1,7 +1,7 @=
@=0A<br>+ #include "testutils.h"=0A<br>+ =0A<br>+ void=0A<br>+-test_main(vo=
id)=0A<br>++test_main_sha3_224(void)=0A<br>+ {=0A<br>+   /* Extracted from =
ShortMsgKAT_224.txt using sha3.awk. */=0A<br>+   test_hash(&amp;nettle_sha3=
_224, /* 0 octets */=0A<br>+diff --git a/sha3-256-test.c b/sha3-256-test.c=
=0A<br>+index f0dad08..ee4c249 100644=0A<br>+--- a/sha3-256-test.c=0A<br>++=
++ b/sha3-256-test.c=0A<br>+@@ -1,7 +1,7 @@=0A<br>+ #include "testutils.h"=
=0A<br>+ =0A<br>+ void=0A<br>+-test_main(void)=0A<br>++test_main_sha3_256(v=
oid)=0A<br>+ {=0A<br>+   /* Extracted from ShortMsgKAT_256.txt using sha3.a=
wk. */=0A<br>+   test_hash(&amp;nettle_sha3_256, /* 0 octets */=0A<br>+diff=
 --git a/sha3-384-test.c b/sha3-384-test.c=0A<br>+index e973cf8..af30e31 10=
0644=0A<br>+--- a/sha3-384-test.c=0A<br>++++ b/sha3-384-test.c=0A<br>+@@ -1=
,7 +1,7 @@=0A<br>+ #include "testutils.h"=0A<br>+ =0A<br>+ void=0A<br>+-tes=
t_main(void)=0A<br>++test_main_sha3_384(void)=0A<br>+ {=0A<br>+   /* Extrac=
ted from ShortMsgKAT_384.txt using sha3.awk. */=0A<br>+   test_hash(&amp;ne=
ttle_sha3_384, /* 0 octets */=0A<br>+diff --git a/sha3-512-test.c b/sha3-51=
2-test.c=0A<br>+index b323a7f..7a42039 100644=0A<br>+--- a/sha3-512-test.c=
=0A<br>++++ b/sha3-512-test.c=0A<br>+@@ -1,7 +1,7 @@=0A<br>+ #include "test=
utils.h"=0A<br>+ =0A<br>+ void=0A<br>+-test_main(void)=0A<br>++test_main_sh=
a3_512(void)=0A<br>+ {=0A<br>+   /* Extracted from ShortMsgKAT_512.txt usin=
g sha3.awk. */=0A<br>+   test_hash(&amp;nettle_sha3_512, /* 0 octets */=0A<=
br>+diff --git a/sha3-permute-test.c b/sha3-permute-test.c=0A<br>+index 1e4=
e9de..c2d65cd 100644=0A<br>+--- a/sha3-permute-test.c=0A<br>++++ b/sha3-per=
mute-test.c=0A<br>+@@ -17,7 +17,7 @@ display (const struct sha3_state *stat=
e)=0A<br>+ }=0A<br>+ =0A<br>+ void=0A<br>+-test_main(void)=0A<br>++test_mai=
n_sha3_permute(void)=0A<br>+ {=0A<br>+   /* From KeccakPermutationIntermedi=
ateValues.txt */=0A<br>+   static const struct sha3_state s1 =3D=0A<br>+dif=
f --git a/sha384-test.c b/sha384-test.c=0A<br>+index 13a0214..88a43da 10064=
4=0A<br>+--- a/sha384-test.c=0A<br>++++ b/sha384-test.c=0A<br>+@@ -1,7 +1,7=
 @@=0A<br>+ #include "testutils.h"=0A<br>+ =0A<br>+ void=0A<br>+-test_main(=
void)=0A<br>++test_main_sha384(void)=0A<br>+ {=0A<br>+   test_hash(&amp;net=
tle_sha384, SDATA("abc"),=0A<br>+ 	    SHEX("cb00753f45a35e8b b5a03d699ac65=
007"=0A<br>+diff --git a/sha512-224-test.c b/sha512-224-test.c=0A<br>+index=
 6b81184..7517477 100644=0A<br>+--- a/sha512-224-test.c=0A<br>++++ b/sha512=
-224-test.c=0A<br>+@@ -1,7 +1,7 @@=0A<br>+ #include "testutils.h"=0A<br>+ =
=0A<br>+ void=0A<br>+-test_main(void)=0A<br>++test_main_sha512_224(void)=0A=
<br>+ {=0A<br>+   /* From http://csrc.nist.gov/groups/ST/toolkit/documents/=
Examples/SHA_All.pdf */=0A<br>+   test_hash(&amp;nettle_sha512_224, SDATA("=
abc"),=0A<br>+diff --git a/sha512-256-test.c b/sha512-256-test.c=0A<br>+ind=
ex c0613ed..539408a 100644=0A<br>+--- a/sha512-256-test.c=0A<br>++++ b/sha5=
12-256-test.c=0A<br>+@@ -1,7 +1,7 @@=0A<br>+ #include "testutils.h"=0A<br>+=
 =0A<br>+ void=0A<br>+-test_main(void)=0A<br>++test_main_sha512_256(void)=
=0A<br>+ {=0A<br>+   /* From http://csrc.nist.gov/groups/ST/toolkit/documen=
ts/Examples/SHA_All.pdf */=0A<br>+   test_hash(&amp;nettle_sha512_256, SDAT=
A("abc"),=0A<br>+diff --git a/sha512-test.c b/sha512-test.c=0A<br>+index c5=
01e09..f7ed230 100644=0A<br>+--- a/sha512-test.c=0A<br>++++ b/sha512-test.c=
=0A<br>+@@ -1,7 +1,7 @@=0A<br>+ #include "testutils.h"=0A<br>+ =0A<br>+ voi=
d=0A<br>+-test_main(void)=0A<br>++test_main_sha512(void)=0A<br>+ {=0A<br>+ =
  test_hash(&amp;nettle_sha512, SDATA("abc"),=0A<br>+ 	    SHEX("ddaf35a193=
617aba cc417349ae204131"=0A<br>+diff --git a/shake256-test.c b/shake256-tes=
t.c=0A<br>+index b91417c..3feace8 100644=0A<br>+--- a/shake256-test.c=0A<br=
>++++ b/shake256-test.c=0A<br>+@@ -46,7 +46,7 @@ const struct nettle_hash n=
ettle_shake256 =3D=0A<br>+   };=0A<br>+ =0A<br>+ void=0A<br>+-test_main(voi=
d)=0A<br>++test_main_shake256(void)=0A<br>+ {=0A<br>+   /* Extracted from S=
hortMsgKAT_SHAKE256.txt. */=0A<br>+   test_hash (&amp;nettle_shake256, /* 0=
 octets */=0A<br>+diff --git a/testutils.c b/testutils.c=0A<br>+index 1f279=
e9..a0dae33 100644=0A<br>+--- a/testutils.c=0A<br>++++ b/testutils.c=0A<br>=
+@@ -117,27 +117,6 @@ print_hex(size_t length, const uint8_t *data)=0A<br>+=
 =0A<br>+ int verbose =3D 0;=0A<br>+ =0A<br>+-int=0A<br>+-main(int argc, ch=
ar **argv)=0A<br>+-{=0A<br>+-  if (argc &gt; 1)=0A<br>+-    {=0A<br>+-     =
 if (argc =3D=3D 2 &amp;&amp; !strcmp(argv[1], "-v"))=0A<br>+-	verbose =3D =
1;=0A<br>+-      else=0A<br>+-	{=0A<br>+-	  fprintf(stderr, "Invalid argume=
nt `%s', only accepted option is `-v'.\n",=0A<br>+-		  argv[1]);=0A<br>+-	 =
 return 1;=0A<br>+-	}=0A<br>+-    }=0A<br>+-=0A<br>+-  test_main();=0A<br>+=
-=0A<br>+-  tstring_clear();=0A<br>+-  return EXIT_SUCCESS;=0A<br>+-}=0A<br=
>+-=0A<br>+ void=0A<br>+ test_cipher(const struct nettle_cipher *cipher,=0A=
<br>+ 	    const struct tstring *key,=0A<br>+diff --git a/twofish-test.c b/=
twofish-test.c=0A<br>+index 2bef44c..187ac46 100644=0A<br>+--- a/twofish-te=
st.c=0A<br>++++ b/twofish-test.c=0A<br>+@@ -2,7 +2,7 @@=0A<br>+ #include "t=
wofish.h"=0A<br>+ =0A<br>+ void=0A<br>+-test_main(void)=0A<br>++test_main_t=
wofish(void)=0A<br>+ {=0A<br>+   /* 128 bit key */=0A<br>+   test_cipher(&a=
mp;nettle_twofish128,=0A<br>+diff --git a/umac-test.c b/umac-test.c=0A<br>+=
index 0fb97cb..af42b2e 100644=0A<br>+--- a/umac-test.c=0A<br>++++ b/umac-te=
st.c=0A<br>+@@ -211,7 +211,7 @@ test_incr (const struct tstring *key,=0A<br=
>+ }=0A<br>+ =0A<br>+ void=0A<br>+-test_main(void)=0A<br>++test_main_umac(v=
oid)=0A<br>+ {=0A<br>+   /* From RFC 4418 (except that it lacks the last 32=
 bits of 128-bit=0A<br>+      tags) */=0A<br>+diff --git a/xts-test.c b/xts=
-test.c=0A<br>+index 723a5a1..49e66f2 100644=0A<br>+--- a/xts-test.c=0A<br>=
++++ b/xts-test.c=0A<br>+@@ -108,7 +108,7 @@ test_cipher_xts(const struct n=
ettle_cipher *cipher,=0A<br>+ }=0A<br>+ =0A<br>+ void=0A<br>+-test_main(voi=
d)=0A<br>++test_main_xts(void)=0A<br>+ {=0A<br>+   /* From NIST CAVS 11.0,=
=0A<br>+    *=0A<br>+diff --git a/yarrow-test.c b/yarrow-test.c=0A<br>+inde=
x facc4fd..57a05b5 100644=0A<br>+--- a/yarrow-test.c=0A<br>++++ b/yarrow-te=
st.c=0A<br>+@@ -59,7 +59,7 @@ open_file(const char *name)=0A<br>+ }=0A<br>+=
 =0A<br>+ void=0A<br>+-test_main(void)=0A<br>++test_main_yarrow(void)=0A<br=
>+ {=0A<br>+   FILE *input;=0A<br>+   =0A<br>+diff --git a/buffer-test.c b/=
buffer-test.c=0A<br>+index fe2e222..7585054 100644=0A<br>+--- a/buffer-test=
.c=0A<br>++++ b/buffer-test.c=0A<br>+@@ -2,7 +2,7 @@=0A<br>+ #include "buff=
er.h"=0A<br>+ =0A<br>+ void=0A<br>+-test_main(void)=0A<br>++test_main_buffe=
r(void)=0A<br>+ {=0A<br>+   struct nettle_buffer buffer;=0A<br>+   uint8_t =
s[5];=0A<br>+diff --git a/cast128-test.c b/cast128-test.c=0A<br>+index 534e=
b17..af171a6 100644=0A<br>+--- a/cast128-test.c=0A<br>++++ b/cast128-test.c=
=0A<br>+@@ -45,7 +45,7 @@ test_cast5(const struct tstring *key,=0A<br>+ }=
=0A<br>+ =0A<br>+ void=0A<br>+-test_main(void)=0A<br>++test_main_cast128(vo=
id)=0A<br>+ {=0A<br>+   /* Test vectors from B.1. Single Plaintext-Key-Ciph=
ertext Sets, RFC=0A<br>+    * 2144 */=0A<br>+-- =0A<br>+2.25.1=0A<br>+=0A<b=
r>-- =0A<br>2.25.1=0A<br>=0A<br>=0A<br></cristianvijelie@gmail.com></cristi=
anvijelie@gmail.com></cristianvijelie@gmail.com></div></blockquote>=0A     =
                                   =0A                                     =
   </div>
------=_NextPart_32760917.711275528375--


From minios-devel-bounces@lists.xenproject.org Thu Jan 28 17:34:27 2021
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Thu, 28 Jan 2021 17:34:27 +0000
Received: from list by lists.xenproject.org with outflank-mailman.77339.140020 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1l5BBb-0004W7-B7; Thu, 28 Jan 2021 17:34:27 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 77339.140020; Thu, 28 Jan 2021 17:34: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 1l5BBb-0004W0-81; Thu, 28 Jan 2021 17:34:27 +0000
Received: by outflank-mailman (input) for mailman id 77339;
 Thu, 28 Jan 2021 17:34: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=VIkR=G7=gmail.com=cezar.craciunoiu@srs-us1.protection.inumbo.net>)
 id 1l5BBa-0004Vt-3R
 for minios-devel@lists.xenproject.org; Thu, 28 Jan 2021 17:34:26 +0000
Received: from mail-ej1-x635.google.com (unknown [2a00:1450:4864:20::635])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 41e434d7-438d-4a98-b42e-0350762d20d8;
 Thu, 28 Jan 2021 17:34:24 +0000 (UTC)
Received: by mail-ej1-x635.google.com with SMTP id gx5so8981996ejb.7
 for <minios-devel@lists.xenproject.org>; Thu, 28 Jan 2021 09:34:24 -0800 (PST)
Received: from [192.168.0.3] ([86.120.251.107])
 by smtp.gmail.com with ESMTPSA id z2sm2584952ejd.44.2021.01.28.09.34.23
 for <minios-devel@lists.xenproject.org>
 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128);
 Thu, 28 Jan 2021 09:34: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: 41e434d7-438d-4a98-b42e-0350762d20d8
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=ajPsD3lW3FMpjpJWkDgIQ7nxT4uCp4uopmLcv7gmZ1k=;
        b=p2X6BQuNY1U5zXbUaLDmvFEm2MsqS3p0QJ9ib0rTou3uWhg/KzKgCct4tIUYIPYrXA
         NpyzCtQ2FR+HdMO0OHZATiKndwjuf/a4Buwkb7MIBhPDQSqxuap0yxD9EVsaWkUxzYTN
         u6bCJFi33qHoVHcdmwOkv4dnqdIl1kKo3LdpzduKyJaPZ5e32K10feh5avhzqSmg3aJq
         +L+DmRqrLUb5prBjaQwRf088GnerdSmQoOr7h9FvJikusv3bmPKkLKZrku2JT8UUg/ll
         hp2eK9CFXjpagawMQK/DYu5efkboZ1i/BZXDkHt5xM5AqfZVYdPxgPQJZ33BAsm92++T
         wTDA==
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=ajPsD3lW3FMpjpJWkDgIQ7nxT4uCp4uopmLcv7gmZ1k=;
        b=OVXWwpCiDsLqOyx0SFn2vBqfouq7obGwoANDJW2ibWC/kVBLLq9zr6cN45KDCKDj7h
         h/X6UFA/EUiRKsv7xZBdBvhwXybt5UziqXTag6d75oINj0YoRXtvnC5EizRHm6aDRhGI
         8FqcgD5bbtYDvxETcZyp8nLnEyBZ9K0jwpY8sexA+jLvyGZog7hiOegpGjoQkBT3hpJD
         BEIGFmirBK2V0B4bY8qoFwnC2YO9FKAbffmjB2zu9L00jFPxOVztxaXclfT9ywTrn5tI
         Cjvyt65cMBXlJ7hlQuA64V/R4ZWSVqNmtFFpyu9MMkcO0MIeqoQLuABUtaeurMa6kaQB
         6WTA==
X-Gm-Message-State: AOAM530oDIMhIHHhdymjs59n5wyjkasdZlbRGWnbzLfnCeyHObkCwGAY
	LB8Mn+/h/dNynBD2qDMGA6VFv5SKz4o=
X-Google-Smtp-Source: ABdhPJybW3mK1Al1c5THzK5KC+BmAeGvj2eK4QBWou3tyh68pDVNgGOUVcDys2mDjGsbYr9U4yblRg==
X-Received: by 2002:a17:906:3ce:: with SMTP id c14mr445555eja.497.1611855263568;
        Thu, 28 Jan 2021 09:34:23 -0800 (PST)
Content-Type: multipart/alternative;
 boundary="----=_NextPart_56498718.373454065033"
MIME-Version: 1.0
Date: Thu, 28 Jan 2021 19:34:09 +0200
Message-ID: <Mailbird-7ad97722-3810-4de4-b881-fa8736eaf02a@gmail.com>
Subject: Re: [[UNIKRAFT/APP-LIBNETTLE_TEST] 1/3] Introducing the app skeleton
From: "Cezar Craciunoiu" <cezar.craciunoiu@gmail.com>
To: "cristian-vijelie" <cristianvijelie@gmail.com>
Cc: "" <minios-devel@lists.xenproject.org>
In-Reply-To: <20210128172627.79524-2-cristianvijelie@gmail.com>
References: <20210128172627.79524-1-cristianvijelie@gmail.com>
 <20210128172627.79524-2-cristianvijelie@gmail.com>
User-Agent: Mailbird/2.9.16.0
X-Mailbird-ID: Mailbird-7ad97722-3810-4de4-b881-fa8736eaf02a@gmail.com

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

Hey Cristian,

This patch looks good to me.

Reviewed-by: Cezar Craciunoiu <cezar.craciunoiu@gmail.com>
On 2021-01-28 19:26:50, cristian-vijelie <cristianvijelie@gmail.com> wrote:
Signed-off-by: cristian-vijelie
---
.gitignore | 3 +++
CODING_STYLE.md | 4 ++++
CONTRIBUTING.md | 4 ++++
COPYING.md | 35 +++++++++++++++++++++++++++++++++++
Config.uk | 7 +++++++
MAINTAINERS.md | 10 ++++++++++
README.md | 22 ++++++++++++++++++++++
kraft.yaml | 19 +++++++++++++++++++
8 files changed, 104 insertions(+)
create mode 100644 .gitignore
create mode 100644 CODING_STYLE.md
create mode 100644 CONTRIBUTING.md
create mode 100644 COPYING.md
create mode 100644 Config.uk
create mode 100644 MAINTAINERS.md
create mode 100644 README.md
create mode 100644 kraft.yaml

diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..910c6c4
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,3 @@
+includes
+.config*
+build
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
+=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+
+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
+=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+
+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..7d621b4
--- /dev/null
+++ b/COPYING.md
@@ -0,0 +1,35 @@
+License
+=3D=3D=3D=3D=3D=3D=3D
+
+Unikraft LibNettle Test App
+------------------------------
+
+This repository contains an example app to build with Unikraft.
+The code is published under BSD licence:
+
+ Copyright (c) 2020, Politehnica University of Bucharest. All rights reser=
ved.
+
+ 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 I=
S"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
diff --git a/Config.uk b/Config.uk
new file mode 100644
index 0000000..c7d85e0
--- /dev/null
+++ b/Config.uk
@@ -0,0 +1,7 @@
+### Invisible option for dependencies
+config APPLIBNETTLETEST_DEPENDENCIES
+ bool
+ default y
+ select LIBNETTLE
+ select LIBNETTLE_TEST
+ select LIBNEWLIBC
diff --git a/MAINTAINERS.md b/MAINTAINERS.md
new file mode 100644
index 0000000..bd3d00e
--- /dev/null
+++ b/MAINTAINERS.md
@@ -0,0 +1,10 @@
+Maintainers List
+=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+
+For notes on how to read this information, please refer to `MAINTAINERS.md=
` in
+the main Unikraft repository.
+
+ HELLOWORLD-UNIKRAFT
+ M: Cristian Vijelie
+ L: minios-devel@lists.xen.org
+ F: *
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..9a4bdda
--- /dev/null
+++ b/README.md
@@ -0,0 +1,22 @@
+# Unikraft LibNettle Test Application
+
+This application tests the correct functioning of the nettle cryptographic
+library.
+
+The application requires newlib and nettle to work. Also, the LIBNETTLE_TE=
ST
+option should be selected for nettle in menuconfig.
+
+You should configure UK_ROOT and UK_LIBS, in Makefile, acording to your se=
tup.
+
+Due to some keyboard intrerrupt issues, to select the test suite number, y=
ou
+must replace the -1 in guest_fs/test_nr with the desired test suite number.
+Leaving the -1 will display only the test suites and their contents.
+
+To run with kvm: the following parameters must be given to qemu:
+* -fsdev local,id=3Dmyid,path=3Dguest_fs,security_model=3Dnone
+* -device virtio-9p-pci,fsdev=3Dmyid,mount_tag=3Drootfs,disable-modern=3Do=
n,disable-legacy=3Doff
+
+Known issues:
+* On linuxu platform, test suite 0 will make unikraft crash. Test suites
+ are made so unikraft won't crash.
+* Not tested on Xen.
diff --git a/kraft.yaml b/kraft.yaml
new file mode 100644
index 0000000..402a3c3
--- /dev/null
+++ b/kraft.yaml
@@ -0,0 +1,19 @@
+specification: '0.4'
+
+unikraft: '0.4'
+
+architectures:
+ x86_64: true
+ arm64: true
+
+platforms:
+ linuxu: true
+ kvm: true
+ xen: true
+
+libraries:
+ newlib: '0.4'
+ nettle:
+ version: '0.4'
+ kconfig:
+ - LIBNETTLE_TEST=3Dy
--
2.25.1



------=_NextPart_56498718.373454065033
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 Cristian,</span><div st=
yle=3D"font-size: 13.3333px"><br></div><div style=3D"font-size: 13.3333px">=
This patch looks good to me.</div><div style=3D"font-size: 13.3333px"><br><=
/div><div style=3D"font-size: 13.3333px">Reviewed-by: Cezar Craciunoiu &lt;=
cezar.craciunoiu@gmail.com&gt;</div><div class=3D"mb_sig"></div><blockquote=
 class=3D"history_container" type=3D"cite" style=3D"border-left-style:solid=
;border-width:1px; margin-top:20px; margin-left:0px;padding-left:10px;">=0A=
                        <p style=3D"color: #AAAAAA; margin-top: 10px;">On 2=
021-01-28 19:26:50, cristian-vijelie &lt;cristianvijelie@gmail.com&gt; wrot=
e:</p><div style=3D"font-family:Arial,Helvetica,sans-serif">Signed-off-by: =
cristian-vijelie <cristianvijelie@gmail.com>=0A<br>---=0A<br> .gitignore   =
   |  3 +++=0A<br> CODING_STYLE.md |  4 ++++=0A<br> CONTRIBUTING.md |  4 ++=
++=0A<br> COPYING.md      | 35 +++++++++++++++++++++++++++++++++++=0A<br> C=
onfig.uk       |  7 +++++++=0A<br> MAINTAINERS.md  | 10 ++++++++++=0A<br> R=
EADME.md       | 22 ++++++++++++++++++++++=0A<br> kraft.yaml      | 19 ++++=
+++++++++++++++=0A<br> 8 files changed, 104 insertions(+)=0A<br> create mod=
e 100644 .gitignore=0A<br> create mode 100644 CODING_STYLE.md=0A<br> create=
 mode 100644 CONTRIBUTING.md=0A<br> create mode 100644 COPYING.md=0A<br> cr=
eate mode 100644 Config.uk=0A<br> create mode 100644 MAINTAINERS.md=0A<br> =
create mode 100644 README.md=0A<br> create mode 100644 kraft.yaml=0A<br>=0A=
<br>diff --git a/.gitignore b/.gitignore=0A<br>new file mode 100644=0A<br>i=
ndex 0000000..910c6c4=0A<br>--- /dev/null=0A<br>+++ b/.gitignore=0A<br>@@ -=
0,0 +1,3 @@=0A<br>+includes=0A<br>+.config*=0A<br>+build=0A<br>diff --git a=
/CODING_STYLE.md b/CODING_STYLE.md=0A<br>new file mode 100644=0A<br>index 0=
000000..5730041=0A<br>--- /dev/null=0A<br>+++ b/CODING_STYLE.md=0A<br>@@ -0=
,0 +1,4 @@=0A<br>+Coding Style=0A<br>+=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=0A<br>+=0A<br>+Please refer to the `CODING_STYLE.md` file in the main Unik=
raft repository.=0A<br>diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md=0A<br=
>new file mode 100644=0A<br>index 0000000..14f6ac6=0A<br>--- /dev/null=0A<b=
r>+++ b/CONTRIBUTING.md=0A<br>@@ -0,0 +1,4 @@=0A<br>+Contributing to Unikra=
ft=0A<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=0A<br>+=0A<br>+Please refer to the `CONTRIBUTING.md` file in the =
main Unikraft repository.=0A<br>diff --git a/COPYING.md b/COPYING.md=0A<br>=
new file mode 100644=0A<br>index 0000000..7d621b4=0A<br>--- /dev/null=0A<br=
>+++ b/COPYING.md=0A<br>@@ -0,0 +1,35 @@=0A<br>+License=0A<br>+=3D=3D=3D=3D=
=3D=3D=3D=0A<br>+=0A<br>+Unikraft LibNettle Test App=0A<br>+---------------=
---------------=0A<br>+=0A<br>+This repository contains an example app to b=
uild with Unikraft.=0A<br>+The code is published under BSD licence:=0A<br>+=
=0A<br>+	Copyright (c) 2020, Politehnica University of Bucharest. All right=
s reserved.=0A<br>+=0A<br>+	Redistribution and use in source and binary for=
ms, with or without=0A<br>+	modification, are permitted provided that the f=
ollowing conditions=0A<br>+	are met:=0A<br>+=0A<br>+	1. Redistributions of =
source code must retain the above copyright=0A<br>+	   notice, this list of=
 conditions and the following disclaimer.=0A<br>+	2. Redistributions in bin=
ary form must reproduce the above copyright=0A<br>+	   notice, this list of=
 conditions and the following disclaimer in the=0A<br>+	   documentation an=
d/or other materials provided with the distribution.=0A<br>+	3. Neither the=
 name of the copyright holder nor the names of its=0A<br>+	   contributors =
may be used to endorse or promote products derived from=0A<br>+	   this sof=
tware without specific prior written permission.=0A<br>+=0A<br>+	THIS SOFTW=
ARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"=0A<br>+	A=
ND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE=0A=
<br>+	IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PU=
RPOSE=0A<br>+	ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CON=
TRIBUTORS BE=0A<br>+	LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, =
EXEMPLARY, OR=0A<br>+	CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,=
 PROCUREMENT OF=0A<br>+	SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR=
 PROFITS; OR BUSINESS=0A<br>+	INTERRUPTION) HOWEVER CAUSED AND ON ANY THEOR=
Y OF LIABILITY, WHETHER IN=0A<br>+	CONTRACT, STRICT LIABILITY, OR TORT (INC=
LUDING NEGLIGENCE OR OTHERWISE)=0A<br>+	ARISING IN ANY WAY OUT OF THE USE O=
F THIS SOFTWARE, EVEN IF ADVISED OF THE=0A<br>+	POSSIBILITY OF SUCH DAMAGE.=
=0A<br>diff --git a/Config.uk b/Config.uk=0A<br>new file mode 100644=0A<br>=
index 0000000..c7d85e0=0A<br>--- /dev/null=0A<br>+++ b/Config.uk=0A<br>@@ -=
0,0 +1,7 @@=0A<br>+### Invisible option for dependencies=0A<br>+config APPL=
IBNETTLETEST_DEPENDENCIES=0A<br>+	bool=0A<br>+	default y=0A<br>+	select LIB=
NETTLE=0A<br>+	select LIBNETTLE_TEST=0A<br>+	select LIBNEWLIBC=0A<br>diff -=
-git a/MAINTAINERS.md b/MAINTAINERS.md=0A<br>new file mode 100644=0A<br>ind=
ex 0000000..bd3d00e=0A<br>--- /dev/null=0A<br>+++ b/MAINTAINERS.md=0A<br>@@=
 -0,0 +1,10 @@=0A<br>+Maintainers List=0A<br>+=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=0A<br>+=0A<br>+For notes on how to read this informat=
ion, please refer to `MAINTAINERS.md` in=0A<br>+the main Unikraft repositor=
y.=0A<br>+=0A<br>+	HELLOWORLD-UNIKRAFT=0A<br>+	M:	Cristian Vijelie <cristia=
nvijelie@gmail.com>=0A<br>+	L:	minios-devel@lists.xen.org=0A<br>+	F: *=0A<b=
r>diff --git a/README.md b/README.md=0A<br>new file mode 100644=0A<br>index=
 0000000..9a4bdda=0A<br>--- /dev/null=0A<br>+++ b/README.md=0A<br>@@ -0,0 +=
1,22 @@=0A<br>+# Unikraft LibNettle Test Application=0A<br>+=0A<br>+This ap=
plication tests the correct functioning of the nettle cryptographic=0A<br>+=
library.=0A<br>+=0A<br>+The application requires newlib and nettle to work.=
 Also, the LIBNETTLE_TEST=0A<br>+option should be selected for nettle in me=
nuconfig.=0A<br>+=0A<br>+You should configure UK_ROOT and UK_LIBS, in Makef=
ile, acording to your setup.=0A<br>+=0A<br>+Due to some keyboard intrerrupt=
 issues, to select the test suite number, you=0A<br>+must replace the -1 in=
 guest_fs/test_nr with the desired test suite number.=0A<br>+Leaving the -1=
 will display only the test suites and their contents.=0A<br>+=0A<br>+To ru=
n with kvm: the following parameters must be given to qemu:=0A<br>+*   -fsd=
ev local,id=3Dmyid,path=3Dguest_fs,security_model=3Dnone=0A<br>+*   -device=
 virtio-9p-pci,fsdev=3Dmyid,mount_tag=3Drootfs,disable-modern=3Don,disable-=
legacy=3Doff=0A<br>+=0A<br>+Known issues:=0A<br>+*   On linuxu platform, te=
st suite 0 will make unikraft crash. Test suites=0A<br>+    are made so uni=
kraft won't crash.=0A<br>+*   Not tested on Xen.=0A<br>diff --git a/kraft.y=
aml b/kraft.yaml=0A<br>new file mode 100644=0A<br>index 0000000..402a3c3=0A=
<br>--- /dev/null=0A<br>+++ b/kraft.yaml=0A<br>@@ -0,0 +1,19 @@=0A<br>+spec=
ification: '0.4'=0A<br>+=0A<br>+unikraft: '0.4'=0A<br>+=0A<br>+architecture=
s:=0A<br>+  x86_64: true=0A<br>+  arm64: true=0A<br>+      =0A<br>+platform=
s:=0A<br>+  linuxu: true=0A<br>+  kvm: true=0A<br>+  xen: true=0A<br>+=0A<b=
r>+libraries:=0A<br>+  newlib: '0.4'=0A<br>+  nettle:=0A<br>+    version: '=
0.4'=0A<br>+    kconfig:=0A<br>+      - LIBNETTLE_TEST=3Dy=0A<br>-- =0A<br>=
2.25.1=0A<br>=0A<br>=0A<br></cristianvijelie@gmail.com></cristianvijelie@gm=
ail.com></div></blockquote>=0A                                        =0A  =
                                      </div><img class=3D"mailbird" width=
=3D"1" height=3D"1" style=3D"border:0; width:1; height:1;" src=3D"https://t=
racking.getmailbird.com/OpenTrackingPixel/?messageId=3DMailbird-7ad97722-38=
10-4de4-b881-fa8736eaf02a@gmail.com&senderHash=3D428129F4185574465E427FF361=
B7A682A725F0E09E2FF4560B6E3FC22B0B586D&recipientHash=3D79A0D3D6185ABBFFCD4C=
C1D8E905E7AD651E2D4F6D203F93730F897F2BEF07B6&internalId=3D4a415c40-baf0-479=
3-b4f1-a35cc23f417f">

------=_NextPart_56498718.373454065033--


From minios-devel-bounces@lists.xenproject.org Thu Jan 28 17:34:43 2021
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Thu, 28 Jan 2021 17:34:43 +0000
Received: from list by lists.xenproject.org with outflank-mailman.77340.140025 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1l5BBr-0004Xn-DL; Thu, 28 Jan 2021 17:34:43 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 77340.140025; Thu, 28 Jan 2021 17:34:43 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1l5BBr-0004Xg-AB; Thu, 28 Jan 2021 17:34:43 +0000
Received: by outflank-mailman (input) for mailman id 77340;
 Thu, 28 Jan 2021 17:34:42 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=VIkR=G7=gmail.com=cezar.craciunoiu@srs-us1.protection.inumbo.net>)
 id 1l5BBq-0004XW-1n
 for minios-devel@lists.xenproject.org; Thu, 28 Jan 2021 17:34:42 +0000
Received: from mail-ej1-x629.google.com (unknown [2a00:1450:4864:20::629])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id b7aa0cd2-4fa3-452e-bd11-ac9318fd64d2;
 Thu, 28 Jan 2021 17:34:41 +0000 (UTC)
Received: by mail-ej1-x629.google.com with SMTP id g12so8982103ejf.8
 for <minios-devel@lists.xenproject.org>; Thu, 28 Jan 2021 09:34:41 -0800 (PST)
Received: from [192.168.0.3] ([86.120.251.107])
 by smtp.gmail.com with ESMTPSA id s1sm2627330ejx.25.2021.01.28.09.34.39
 for <minios-devel@lists.xenproject.org>
 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128);
 Thu, 28 Jan 2021 09:34: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: b7aa0cd2-4fa3-452e-bd11-ac9318fd64d2
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=d0nCEOwSSJl8yDGbJu8Y9NmqSsCknyqvp85KmnnImYk=;
        b=gdnNOddMN/MxAp9SEDHExjQcTQcwxVBavGkMG+rduz5WuN2nNYnqMa9w/IV3qZ/MhM
         HKQkunlCBDJW6yCFVWOSr+OQNlz4HPkMlQgmEFUCzjDLavO4ga23WMWSBXT7CtTmLwb7
         /0+YOmAnGL4hl9nL1ayqWw+sEcDGItn4P7JduaJbYNbdWvMo2+wk8/7W+eCQAUCLct9B
         RVe3QrtNV5NGkMDZ6BfNoRxIVvVY6VM9+XCQO/BTh1MlGXmYwcpEB/F5t+Kg31zLD+Ls
         oJgHLUyd/DhrurnFoT+TWpNq2pAHszjwlJj887y5zZK3E51ef5HCZ1683AQBVYDR6V8d
         ZOFA==
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=d0nCEOwSSJl8yDGbJu8Y9NmqSsCknyqvp85KmnnImYk=;
        b=Kya/QVIX/qUIBCGTgH3kfwQX0dJ9bmJ4fqTiYqU3+fJv4bDbIUFsbHpmKxbhzk0nRh
         mpnkaXiuK6SK4eicAJ7xcTIfZkeIND4sY9hsTUHQ/XJv+JRJy5G6ZzF43x+dtTrvHPTl
         xiSs47oSmjL3IJwqXd5L796h6ZTykOtnvuF/JI0lLR0QC+UwRvhJVo+c2HipudXrtax1
         FulheYsKZl9sUmDmZvid7Lds1GNpi1lwezGIhwO5BhKqSzYMxBiM9/ZPfq/A9TjNcN6N
         LALoA9SsmykrJXUSUgTdxCxHbCB5pt2uYJQrxgBLrjgoV+hOeFegp+v+hySU++1lE+aH
         A/UA==
X-Gm-Message-State: AOAM533QK5eU6TrX2DetWL46IEo0haDYNI+QJ6VA8ZsEDABDO2MyAgfR
	k7hdddofKDkvNEcj5LUuLvPT5XLYoRg=
X-Google-Smtp-Source: ABdhPJwF+T2m+0CiHJ2l7nPVk7zbDUy6UKMPACJ/dzrbWKYquukvzcd9OldrUJRM7lfvBRJqmVB88w==
X-Received: by 2002:a17:907:1701:: with SMTP id le1mr532896ejc.68.1611855280233;
        Thu, 28 Jan 2021 09:34:40 -0800 (PST)
Content-Type: multipart/alternative;
 boundary="----=_NextPart_38629916.953692988652"
MIME-Version: 1.0
Date: Thu, 28 Jan 2021 19:34:20 +0200
Message-ID: <Mailbird-d39cd14a-6883-4955-a546-9d695ef28831@gmail.com>
Subject: Re: [[UNIKRAFT/APP-LIBNETTLE_TEST] 2/3] Adding the Makefiles
From: "Cezar Craciunoiu" <cezar.craciunoiu@gmail.com>
To: "cristian-vijelie" <cristianvijelie@gmail.com>
Cc: "" <minios-devel@lists.xenproject.org>
In-Reply-To: <20210128172627.79524-3-cristianvijelie@gmail.com>
References: <20210128172627.79524-1-cristianvijelie@gmail.com>
 <20210128172627.79524-3-cristianvijelie@gmail.com>
User-Agent: Mailbird/2.9.16.0
X-Mailbird-ID: Mailbird-d39cd14a-6883-4955-a546-9d695ef28831@gmail.com

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

Hey Cristian,

This patch looks good to me.

Reviewed-by: Cezar Craciunoiu <cezar.craciunoiu@gmail.com>
On 2021-01-28 19:26:54, cristian-vijelie <cristianvijelie@gmail.com> wrote:
Signed-off-by: cristian-vijelie
---
Makefile | 9 +++++++++
Makefile.uk | 3 +++
2 files changed, 12 insertions(+)
create mode 100644 Makefile
create mode 100644 Makefile.uk

diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..bd69f4b
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,9 @@
+UK_ROOT ?= $(PWD)/../../unikraft
+UK_LIBS ?= $(PWD)/../../libs
+LIBS := $(UK_LIBS)/lib-nettle:$(UK_LIBS)/lib-newlib
+
+all:
+ @$(MAKE) -C $(UK_ROOT) A=$(PWD) L=$(LIBS)
+
+$(MAKECMDGOALS):
+ @$(MAKE) -C $(UK_ROOT) A=$(PWD) L=$(LIBS) $(MAKECMDGOALS)
diff --git a/Makefile.uk b/Makefile.uk
new file mode 100644
index 0000000..5ae7f49
--- /dev/null
+++ b/Makefile.uk
@@ -0,0 +1,3 @@
+$(eval $(call addlib,applibnettletest))
+
+APPLIBNETTLETEST_SRCS-y += $(APPLIBNETTLETEST_BASE)/main.c
--
2.25.1



------=_NextPart_38629916.953692988652
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 Cristian,</span><div st=
yle=3D"font-size: 13.3333px"><br></div><div style=3D"font-size: 13.3333px">=
This patch looks good to me.</div><div style=3D"font-size: 13.3333px"><br><=
/div><div style=3D"font-size: 13.3333px">Reviewed-by: Cezar Craciunoiu &lt;=
cezar.craciunoiu@gmail.com&gt;</div><div class=3D"mb_sig"></div><blockquote=
 class=3D"history_container" type=3D"cite" style=3D"border-left-style:solid=
;border-width:1px; margin-top:20px; margin-left:0px;padding-left:10px;">=0A=
                        <p style=3D"color: #AAAAAA; margin-top: 10px;">On 2=
021-01-28 19:26:54, cristian-vijelie &lt;cristianvijelie@gmail.com&gt; wrot=
e:</p><div style=3D"font-family:Arial,Helvetica,sans-serif">Signed-off-by: =
cristian-vijelie <cristianvijelie@gmail.com>=0A<br>---=0A<br> Makefile    |=
 9 +++++++++=0A<br> Makefile.uk | 3 +++=0A<br> 2 files changed, 12 insertio=
ns(+)=0A<br> create mode 100644 Makefile=0A<br> create mode 100644 Makefile=
.uk=0A<br>=0A<br>diff --git a/Makefile b/Makefile=0A<br>new file mode 10064=
4=0A<br>index 0000000..bd69f4b=0A<br>--- /dev/null=0A<br>+++ b/Makefile=0A<=
br>@@ -0,0 +1,9 @@=0A<br>+UK_ROOT ?=3D $(PWD)/../../unikraft=0A<br>+UK_LIBS=
 ?=3D $(PWD)/../../libs=0A<br>+LIBS :=3D $(UK_LIBS)/lib-nettle:$(UK_LIBS)/l=
ib-newlib=0A<br>+=0A<br>+all:=0A<br>+	@$(MAKE) -C $(UK_ROOT) A=3D$(PWD) L=
=3D$(LIBS)=0A<br>+=0A<br>+$(MAKECMDGOALS):=0A<br>+	@$(MAKE) -C $(UK_ROOT) A=
=3D$(PWD) L=3D$(LIBS) $(MAKECMDGOALS)=0A<br>diff --git a/Makefile.uk b/Make=
file.uk=0A<br>new file mode 100644=0A<br>index 0000000..5ae7f49=0A<br>--- /=
dev/null=0A<br>+++ b/Makefile.uk=0A<br>@@ -0,0 +1,3 @@=0A<br>+$(eval $(call=
 addlib,applibnettletest))=0A<br>+=0A<br>+APPLIBNETTLETEST_SRCS-y +=3D $(AP=
PLIBNETTLETEST_BASE)/main.c=0A<br>-- =0A<br>2.25.1=0A<br>=0A<br>=0A<br></cr=
istianvijelie@gmail.com></div></blockquote>=0A                             =
           =0A                                        </div><img class=3D"m=
ailbird" width=3D"1" height=3D"1" style=3D"border:0; width:1; height:1;" sr=
c=3D"https://tracking.getmailbird.com/OpenTrackingPixel/?messageId=3DMailbi=
rd-d39cd14a-6883-4955-a546-9d695ef28831@gmail.com&senderHash=3D428129F41855=
74465E427FF361B7A682A725F0E09E2FF4560B6E3FC22B0B586D&recipientHash=3D79A0D3=
D6185ABBFFCD4CC1D8E905E7AD651E2D4F6D203F93730F897F2BEF07B6&internalId=3Dd56=
50360-bc0f-4848-aa35-46d8c43e66be">

------=_NextPart_38629916.953692988652--


From minios-devel-bounces@lists.xenproject.org Thu Jan 28 17:35:25 2021
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Thu, 28 Jan 2021 17:35:25 +0000
Received: from list by lists.xenproject.org with outflank-mailman.77341.140029 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1l5BCX-0004ZF-HA; Thu, 28 Jan 2021 17:35:25 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 77341.140029; Thu, 28 Jan 2021 17:35: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 1l5BCX-0004Z8-DZ; Thu, 28 Jan 2021 17:35:25 +0000
Received: by outflank-mailman (input) for mailman id 77341;
 Thu, 28 Jan 2021 17:35: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=VIkR=G7=gmail.com=cezar.craciunoiu@srs-us1.protection.inumbo.net>)
 id 1l5BCW-0004Z3-Km
 for minios-devel@lists.xenproject.org; Thu, 28 Jan 2021 17:35:24 +0000
Received: from mail-ed1-x52a.google.com (unknown [2a00:1450:4864:20::52a])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id e35a77f6-9f27-4fd8-9b05-d8f6ce3b73e8;
 Thu, 28 Jan 2021 17:35:11 +0000 (UTC)
Received: by mail-ed1-x52a.google.com with SMTP id z22so7568592edb.9
 for <minios-devel@lists.xenproject.org>; Thu, 28 Jan 2021 09:35:11 -0800 (PST)
Received: from [192.168.0.3] ([86.120.251.107])
 by smtp.gmail.com with ESMTPSA id p16sm3243503edw.44.2021.01.28.09.35.08
 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128);
 Thu, 28 Jan 2021 09:35: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: e35a77f6-9f27-4fd8-9b05-d8f6ce3b73e8
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=l6nJwBiE4Z1yC2Ut+jrLCR7KNVmOMYwPIfZwjgQgb2E=;
        b=JYmv/wvNoXvbaGIIFdO+lucAo9S/Bp37w/TGCmfNHqHfoCNfcsrSJyPKef5XNasoZL
         vJSq9Q9aV3xosrR6ObgMTBSEMvW2be6DiB2gSDntK2JZJ1cxMTsV245+qrS1m2pot+Gr
         NeHkotyU5nW+f2TsvCoCpWdtAdtKpL21AhWY5gRiqdjBgoXBbNm5t+QTt8oemqrNQPG9
         b9AS9qYw42ikwKMYOn6pQerI+8Dch5qc+PZ9rCCkhUBW9lQ8EvqAmgTDGpN74XmN9GJE
         fsIBo5fLVkJI/olJ6Tuy3eiBLNbFVqVuRGIi0vfrVMq93nt98AWADWiSKGuRM01aGpjy
         vs9A==
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=l6nJwBiE4Z1yC2Ut+jrLCR7KNVmOMYwPIfZwjgQgb2E=;
        b=sAVGSKjy5dHph1calWjKsD2/zLUMQVzZWm/N8YzL+SMyDU0tqOoxOR1nnGotTcg0fn
         t18DvUOZ9yTPbKzwefTrRgYWms0RANnCanKOeTm+fpDhxSoDM6+UEOaQZlK6ey8uCmvi
         L3kF2O8G6oc7hqbpLIqsb3nRtCRUstclWTp7tmGoVdyTs4mGZOahSMiwTiLBLJCPDqwy
         eruquUB7Z/jmafCIcjgaj76J2YIj6fQdHqZZd6jwkUaMoSsnvTd1v7W627ULB4jEyfRw
         uDT4W9Zag/1FnUXaeaTpbopSkgkJacjeoQvl2KxWi+9if9mHgXsTW+ZgPB5KyBmLwMSa
         ycDQ==
X-Gm-Message-State: AOAM533dI7aTeYHw8ZVUGugSE3/gm/xoYfeyYGELze7IZAChnJa2mRBR
	2ogQ0qukqYXDkFDtMxmX4VE=
X-Google-Smtp-Source: ABdhPJxkjlSrVnNZyGSum0eWd+M4zfzWq8l8ilXhqcsVYXqpx5G/jnQSbFa6K/3CQdW4tpAPYrYIrA==
X-Received: by 2002:aa7:c583:: with SMTP id g3mr687075edq.357.1611855310261;
        Thu, 28 Jan 2021 09:35:10 -0800 (PST)
Content-Type: multipart/alternative;
 boundary="----=_NextPart_31515703.926552591639"
MIME-Version: 1.0
Date: Thu, 28 Jan 2021 19:34:37 +0200
Message-ID: <Mailbird-9c34b08c-5425-4b47-ae61-15c1c4a3d1ec@gmail.com>
Subject: Re: [[UNIKRAFT/APP-LIBNETTLE_TEST] 3/3] Adding the source code
From: "Cezar Craciunoiu" <cezar.craciunoiu@gmail.com>
To: "cristian-vijelie" <cristianvijelie@gmail.com>
Cc: "" <minios-devel@lists.xenproject.org>
In-Reply-To: <20210128172627.79524-4-cristianvijelie@gmail.com>
References: <20210128172627.79524-1-cristianvijelie@gmail.com>
 <20210128172627.79524-4-cristianvijelie@gmail.com>
User-Agent: Mailbird/2.9.16.0
X-Mailbird-ID: Mailbird-9c34b08c-5425-4b47-ae61-15c1c4a3d1ec@gmail.com

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

Hey Cristian,

This patch looks good to me.

Reviewed-by: Cezar Craciunoiu <cezar.craciunoiu@gmail.com>
On 2021-01-28 19:27:02, cristian-vijelie <cristianvijelie@gmail.com> wrote:
The guest_fs folder contains the files needed by the app to run
corectly. The folder should be mounted as a 9p virtual filesystem
with qemu.

Signed-off-by: cristian-vijelie
---
guest_fs/gold-bug.txt | 1598 +++++++++++++++++++++++++++++++++++++++++
guest_fs/test_nr | 1 +
include/testsuite.h | 59 ++
main.c | 298 ++++++++
4 files changed, 1956 insertions(+)
create mode 100644 guest_fs/gold-bug.txt
create mode 100644 guest_fs/test_nr
create mode 100644 include/testsuite.h
create mode 100644 main.c

diff --git a/guest_fs/gold-bug.txt b/guest_fs/gold-bug.txt
new file mode 100644
index 0000000..be3a2a0
--- /dev/null
+++ b/guest_fs/gold-bug.txt
@@ -0,0 +1,1598 @@
+Edgar Allan Poe
+
+The Gold-Bug
+
+
+What ho! what ho! this fellow is dancing mad!
+He hath been bitten by the Tarantula.
+ --All in the Wrong.
+
+
+Many years ago, I contracted an intimacy with a Mr. William
+Legrand. He was of an ancient Huguenot family, and had once been
+wealthy: but a series of misfortunes had reduced him to want. To
+avoid the mortification consequent upon his disasters, he left New
+Orleans, the city of his forefathers, and took up his residence at
+Sullivan's Island, near Charleston, South Carolina.
+
+This island is a very singular one. It consists of little else
+than the sea sand, and is about three miles long. Its breadth at
+no point exceeds a quarter of a mile. It is separated from the
+mainland by a scarcely perceptible creek, oozing its way through a
+wilderness of reeds and slime, a favorite resort of the marsh hen.
+The vegetation, as might be supposed, is scant, or at least
+dwarfish. No trees of any magnitude are to be seen. Near the
+western extremity, where Fort Moultrie stands, and where are some
+miserable frame buildings, tenanted, during summer, by the
+fugitives from Charleston dust and fever, may be found, indeed, the
+bristly palmetto; but the whole island, with the exception of this
+western point, and a line of hard, white beach on the seacoast, is
+covered with a dense undergrowth of the sweet myrtle so much prized
+by the horticulturists of England. The shrub here often attains
+the height of fifteen or twenty feet, and forms an almost
+impenetrable coppice, burdening the air with its fragrance.
+
+In the inmost recesses of this coppice, not far from the eastern or
+more remote end of the island, Legrand had built himself a small
+hut, which he occupied when I first, by mere accident, made his
+acquaintance. This soon ripened into friendship--for there was
+much in the recluse to excite interest and esteem. I found him
+well educated, with unusual powers of mind, but infected with
+misanthropy, and subject to perverse moods of alternate enthusiasm
+and melancholy. He had with him many books, but rarely employed
+them. His chief amusements were gunning and fishing, or sauntering
+along the beach and through the myrtles, in quest of shells or
+entomological specimens--his collection of the latter might have
+been envied by a Swammerdamm. In these excursions he was usually
+accompanied by an old negro, called Jupiter, who had been
+manumitted before the reverses of the family, but who could be
+induced, neither by threats nor by promises, to abandon what he
+considered his right of attendance upon the footsteps of his young
+"Massa Will." It is not improbable that the relatives of Legrand,
+conceiving him to be somewhat unsettled in intellect, had contrived
+to instill this obstinacy into Jupiter, with a view to the
+supervision and guardianship of the wanderer.
+
+The winters in the latitude of Sullivan's Island are seldom very
+severe, and in the fall of the year it is a rare event indeed when
+a fire is considered necessary. About the middle of October, 18--,
+there occurred, however, a day of remarkable chilliness. Just
+before sunset I scrambled my way through the evergreens to the hut
+of my friend, whom I had not visited for several weeks--my
+residence being, at that time, in Charleston, a distance of nine
+miles from the island, while the facilities of passage and
+repassage were very far behind those of the present day. Upon
+reaching the hut I rapped, as was my custom, and getting no reply,
+sought for the key where I knew it was secreted, unlocked the door,
+and went in. A fine fire was blazing upon the hearth. It was a
+novelty, and by no means an ungrateful one. I threw off an
+overcoat, took an armchair by the crackling logs, and awaited
+patiently the arrival of my hosts.
+
+Soon after dark they arrived, and gave me a most cordial welcome.
+Jupiter, grinning from ear to ear, bustled about to prepare some
+marsh hens for supper. Legrand was in one of his fits--how else
+shall I term them?--of enthusiasm. He had found an unknown
+bivalve, forming a new genus, and, more than this, he had hunted
+down and secured, with Jupiter's assistance, a scarabaeus which he
+believed to be totally new, but in respect to which he wished to
+have my opinion on the morrow.
+
+"And why not to-night?" I asked, rubbing my hands over the blaze,
+and wishing the whole tribe of scarabaei at the devil.
+
+"Ah, if I had only known you were here!" said Legrand, "but it's so
+long since I saw you; and how could I foresee that you would pay me
+a visit this very night of all others? As I was coming home I met
+Lieutenant G----, from the fort, and, very foolishly, I lent him
+the bug; so it will be impossible for you to see it until the
+morning. Stay here to-night, and I will send Jup down for it at
+sunrise. It is the loveliest thing in creation!"
+
+"What?--sunrise?"
+
+"Nonsense! no!--the bug. It is of a brilliant gold color--about
+the size of a large hickory nut--with two jet black spots near one
+extremity of the back, and another, somewhat longer, at the other.
+The antennae are--"
+
+"Dey ain't NO tin in him, Massa Will, I keep a tellin' on you,"
+here interrupted Jupiter; "de bug is a goole-bug, solid, ebery bit
+of him, inside and all, sep him wing--neber feel half so hebby a
+bug in my life."
+
+"Well, suppose it is, Jup," replied Legrand, somewhat more
+earnestly, it seemed to me, than the case demanded; "is that any
+reason for your letting the birds burn? The color"--here he turned
+to me--"is really almost enough to warrant Jupiter's idea. You
+never saw a more brilliant metallic luster than the scales emit--
+but of this you cannot judge till to-morrow. In the meantime I can
+give you some idea of the shape." Saying this, he seated himself
+at a small table, on which were a pen and ink, but no paper. He
+looked for some in a drawer, but found none.
+
+"Never mind," he said at length, "this will answer;" and he drew
+from his waistcoat pocket a scrap of what I took to be very dirty
+foolscap, and made upon it a rough drawing with the pen. While he
+did this, I retained my seat by the fire, for I was still chilly.
+When the design was complete, he handed it to me without rising.
+As I received it, a loud growl was heard, succeeded by a scratching
+at the door. Jupiter opened it, and a large Newfoundland,
+belonging to Legrand, rushed in, leaped upon my shoulders, and
+loaded me with caresses; for I had shown him much attention during
+previous visits. When his gambols were over, I looked at the
+paper, and, to speak the truth, found myself not a little puzzled
+at what my friend had depicted.
+
+"Well!" I said, after contemplating it for some minutes, "this IS a
+strange scarabaeus, I must confess; new to me; never saw anything
+like it before--unless it was a skull, or a death's head, which it
+more nearly resembles than anything else that has come under MY
+observation."
+
+"A death's head!" echoed Legrand. "Oh--yes--well, it has something
+of that appearance upon paper, no doubt. The two upper black spots
+look like eyes, eh? and the longer one at the bottom like a mouth--
+and then the shape of the whole is oval."
+
+"Perhaps so," said I; "but, Legrand, I fear you are no artist. I
+must wait until I see the beetle itself, if I am to form any idea
+of its personal appearance."
+
+"Well, I don't know," said he, a little nettled, "I draw tolerably--
+SHOULD do it at least--have had good masters, and flatter myself
+that I am not quite a blockhead."
+
+"But, my dear fellow, you are joking then," said I, "this is a very
+passable SKULL--indeed, I may say that it is a very EXCELLENT
+skull, according to the vulgar notions about such specimens of
+physiology--and your scarabaeus must be the queerest scarabaeus in
+the world if it resembles it. Why, we may get up a very thrilling
+bit of superstition upon this hint. I presume you will call the
+bug Scarabaeus caput hominis, or something of that kind--there are
+many similar titles in the Natural Histories. But where are the
+antennae you spoke of?"
+
+"The antennae!" said Legrand, who seemed to be getting
+unaccountably warm upon the subject; "I am sure you must see the
+antennae. I made them as distinct as they are in the original
+insect, and I presume that is sufficient."
+
+"Well, well," I said, "perhaps you have--still I don't see them;"
+and I handed him the paper without additional remark, not wishing
+to ruffle his temper; but I was much surprised at the turn affairs
+had taken; his ill humor puzzled me--and, as for the drawing of the
+beetle, there were positively NO antennae visible, and the whole
+DID bear a very close resemblance to the ordinary cuts of a death's
+head.
+
+He received the paper very peevishly, and was about to crumple it,
+apparently to throw it in the fire, when a casual glance at the
+design seemed suddenly to rivet his attention. In an instant his
+face grew violently red--in another excessively pale. For some
+minutes he continued to scrutinize the drawing minutely where he
+sat. At length he arose, took a candle from the table, and
+proceeded to seat himself upon a sea chest in the farthest corner
+of the room. Here again he made an anxious examination of the
+paper, turning it in all directions. He said nothing, however, and
+his conduct greatly astonished me; yet I thought it prudent not to
+exacerbate the growing moodiness of his temper by any comment.
+Presently he took from his coat pocket a wallet, placed the paper
+carefully in it, and deposited both in a writing desk, which he
+locked. He now grew more composed in his demeanor; but his
+original air of enthusiasm had quite disappeared. Yet he seemed
+not so much sulky as abstracted. As the evening wore away he
+became more and more absorbed in reverie, from which no sallies of
+mine could arouse him. It had been my intention to pass the night
+at the hut, as I had frequently done before, but, seeing my host in
+this mood, I deemed it proper to take leave. He did not press me
+to remain, but, as I departed, he shook my hand with even more than
+his usual cordiality.
+
+It was about a month after this (and during the interval I had seen
+nothing of Legrand) when I received a visit, at Charleston, from
+his man, Jupiter. I had never seen the good old negro look so
+dispirited, and I feared that some serious disaster had befallen my
+friend.
+
+"Well, Jup," said I, "what is the matter now?--how is your master?"
+
+"Why, to speak the troof, massa, him not so berry well as mought
+be."
+
+"Not well! I am truly sorry to hear it. What does he complain
+of?"
+
+"Dar! dot's it!--him neber 'plain of notin'--but him berry sick for
+all dat."
+
+"VERY sick, Jupiter!--why didn't you say so at once? Is he
+confined to bed?"
+
+"No, dat he aint!--he aint 'fin'd nowhar--dat's just whar de shoe
+pinch--my mind is got to be berry hebby 'bout poor Massa Will."
+
+"Jupiter, I should like to understand what it is you are talking
+about. You say your master is sick. Hasn't he told you what ails
+him?"
+
+"Why, massa, 'taint worf while for to git mad about de matter--
+Massa Will say noffin at all aint de matter wid him--but den what
+make him go about looking dis here way, wid he head down and he
+soldiers up, and as white as a goose? And den he keep a syphon all
+de time--"
+
+"Keeps a what, Jupiter?"
+
+"Keeps a syphon wid de figgurs on de slate--de queerest figgurs I
+ebber did see. Ise gittin' to be skeered, I tell you. Hab for to
+keep mighty tight eye 'pon him 'noovers. Todder day he gib me slip
+'fore de sun up and was gone de whole ob de blessed day. I had a
+big stick ready cut for to gib him deuced good beating when he did
+come--but Ise sich a fool dat I hadn't de heart arter all--he
+looked so berry poorly."
+
+"Eh?--what?--ah yes!--upon the whole I think you had better not be
+too severe with the poor fellow--don't flog him, Jupiter--he can't
+very well stand it--but can you form no idea of what has occasioned
+this illness, or rather this change of conduct? Has anything
+unpleasant happened since I saw you?"
+
+"No, massa, dey aint bin noffin onpleasant SINCE den--'twas 'FORE
+den I'm feared--'twas de berry day you was dare."
+
+"How? what do you mean."
+
+"Why, massa, I mean de bug--dare now."
+
+"The what?"
+
+"De bug--I'm berry sartin dat Massa Will bin bit somewhere 'bout de
+head by dat goole-bug."
+
+"And what cause have you, Jupiter, for such a supposition?"
+
+"Claws enuff, massa, and mouff, too. I nebber did see sich a
+deuced bug--he kick and he bite eberyting what cum near him. Massa
+Will cotch him fuss, but had for to let him go 'gin mighty quick, I
+tell you--den was de time he must ha' got de bite. I didn't like
+de look ob de bug mouff, myself, nohow, so I wouldn't take hold oh
+him wid my finger, but I cotch him wid a piece oh paper dat I
+found. I rap him up in de paper and stuff a piece of it in he
+mouff--dat was de way."
+
+"And you think, then, that your master was really bitten by the
+beetle, and that the bite made him sick?"
+
+"I don't think noffin about it--I nose it. What make him dream
+'bout de goole so much, if 'taint cause he bit by the goole-bug?
+Ise heered 'bout dem goole-bugs 'fore dis."
+
+"But how do you know he dreams about gold?"
+
+"How I know? why, 'cause he talk about it in he sleep--dat's how I
+nose."
+
+"Well, Jup, perhaps you are right; but to what fortunate
+circumstance am I to attribute the honor of a visit from you to-
+day?"
+
+"What de matter, massa?"
+
+"Did you bring any message from Mr. Legrand?"
+
+"No, massa, I bring dis here pissel;" and here Jupiter handed me a
+note which ran thus:
+
+
+"MY DEAR ----
+
+"Why have I not seen you for so long a time? I hope you have not
+been so foolish as to take offense at any little brusquerie of
+mine; but no, that is improbable.
+
+"Since I saw you I have had great cause for anxiety. I have
+something to tell you, yet scarcely know how to tell it, or whether
+I should tell it at all.
+
+"I have not been quite well for some days past, and poor old Jup
+annoys me, almost beyond endurance, by his well-meant attentions.
+Would you believe it?--he had prepared a huge stick, the other day,
+with which to chastise me for giving him the slip, and spending the
+day, solus, among the hills on the mainland. I verily believe that
+my ill looks alone saved me a flogging.
+
+"I have made no addition to my cabinet since we met. "If you can,
+in any way, make it convenient, come over with Jupiter. DO come.
+I wish to see you TO-NIGHT, upon business of importance. I assure
+you that it is of the HIGHEST importance.
+
+"Ever yours,
+
+"WILLIAM LEGRAND."
+
+
+There was something in the tone of this note which gave me great
+uneasiness. Its whole style differed materially from that of
+Legrand. What could he be dreaming of? What new crotchet
+possessed his excitable brain? What "business of the highest
+importance" could HE possibly have to transact? Jupiter's account
+of him boded no good. I dreaded lest the continued pressure of
+misfortune had, at length, fairly unsettled the reason of my
+friend. Without a moment's hesitation, therefore, I prepared to
+accompany the negro.
+
+Upon reaching the wharf, I noticed a scythe and three spades, all
+apparently new, lying in the bottom of the boat in which we were to
+embark.
+
+"What is the meaning of all this, Jup?" I inquired.
+
+"Him syfe, massa, and spade."
+
+"Very true; but what are they doing here?"
+
+"Him de syfe and de spade what Massa Will sis 'pon my buying for
+him in de town, and de debbil's own lot of money I had to gib for
+em."
+
+"But what, in the name of all that is mysterious, is your 'Massa
+Will' going to do with scythes and spades?"
+
+"Dat's more dan I know, and debbil take me if I don't b'lieve 'tis
+more dan he know too. But it's all cum ob de bug."
+
+Finding that no satisfaction was to be obtained of Jupiter, whose
+whole intellect seemed to be absorbed by "de bug," I now stepped
+into the boat, and made sail. With a fair and strong breeze we
+soon ran into the little cove to the northward of Fort Moultrie,
+and a walk of some two miles brought us to the hut. It was about
+three in the afternoon when we arrived. Legrand had been awaiting
+us in eager expectation. He grasped my hand with a nervous
+empressement which alarmed me and strengthened the suspicions
+already entertained. His countenance was pale even to ghastliness,
+and his deep-set eyes glared with unnatural luster. After some
+inquiries respecting his health, I asked him, not knowing what
+better to say, if he had yet obtained the scarabaeus from
+Lieutenant G----.
+
+"Oh, yes," he replied, coloring violently, "I got it from him the
+next morning. Nothing should tempt me to part with that
+scarabaeus. Do you know that Jupiter is quite right about it?"
+
+"In what way?" I asked, with a sad foreboding at heart.
+
+"In supposing it to be a bug of REAL GOLD." He said this with an
+air of profound seriousness, and I felt inexpressibly shocked.
+
+"This bug is to make my fortune," he continued, with a triumphant
+smile; "to reinstate me in my family possessions. Is it any
+wonder, then, that I prize it? Since Fortune has thought fit to
+bestow it upon me, I have only to use it properly, and I shall
+arrive at the gold of which it is the index. Jupiter, bring me
+that scarabaeus!"
+
+"What! de bug, massa? I'd rudder not go fer trubble dat bug; you
+mus' git him for your own self." Hereupon Legrand arose, with a
+grave and stately air, and brought me the beetle from a glass case
+in which it was enclosed. It was a beautiful scarabaeus, and, at
+that time, unknown to naturalists--of course a great prize in a
+scientific point of view. There were two round black spots near
+one extremity of the back, and a long one near the other. The
+scales were exceedingly hard and glossy, with all the appearance of
+burnished gold. The weight of the insect was very remarkable, and,
+taking all things into consideration, I could hardly blame Jupiter
+for his opinion respecting it; but what to make of Legrand's
+concordance with that opinion, I could not, for the life of me,
+tell.
+
+"I sent for you," said he, in a grandiloquent tone, when I had
+completed my examination of the beetle, "I sent for you that I
+might have your counsel and assistance in furthering the views of
+Fate and of the bug--"
+
+"My dear Legrand," I cried, interrupting him, "you are certainly
+unwell, and had better use some little precautions. You shall go
+to bed, and I will remain with you a few days, until you get over
+this. You are feverish and--"
+
+"Feel my pulse," said he.
+
+I felt it, and, to say the truth, found not the slightest
+indication of fever.
+
+"But you may be ill and yet have no fever. Allow me this once to
+prescribe for you. In the first place go to bed. In the next--"
+
+"You are mistaken," he interposed, "I am as well as I can expect to
+be under the excitement which I suffer. If you really wish me
+well, you will relieve this excitement."
+
+"And how is this to be done?"
+
+"Very easily. Jupiter and myself are going upon an expedition into
+the hills, upon the mainland, and, in this expedition, we shall
+need the aid of some person in whom we can confide. You are the
+only one we can trust. Whether we succeed or fail, the excitement
+which you now perceive in me will be equally allayed."
+
+"I am anxious to oblige you in any way," I replied; "but do you
+mean to say that this infernal beetle has any connection with your
+expedition into the hills?"
+
+"It has."
+
+"Then, Legrand, I can become a party to no such absurd proceeding."
+
+"I am sorry--very sorry--for we shall have to try it by ourselves."
+
+"Try it by yourselves! The man is surely mad!--but stay!--how long
+do you propose to be absent?"
+
+"Probably all night. We shall start immediately, and be back, at
+all events, by sunrise."
+
+"And will you promise me, upon your honor, that when this freak of
+yours is over, and the bug business (good God!) settled to your
+satisfaction, you will then return home and follow my advice
+implicitly, as that of your physician?"
+
+"Yes; I promise; and now let us be off, for we have no time to
+lose."
+
+With a heavy heart I accompanied my friend. We started about four
+o'clock--Legrand, Jupiter, the dog, and myself. Jupiter had with
+him the scythe and spades--the whole of which he insisted upon
+carrying--more through fear, it seemed to me, of trusting either of
+the implements within reach of his master, than from any excess of
+industry or complaisance. His demeanor was dogged in the extreme,
+and "dat deuced bug" were the sole words which escaped his lips
+during the journey. For my own part, I had charge of a couple of
+dark lanterns, while Legrand contented himself with the scarabaeus,
+which he carried attached to the end of a bit of whipcord; twirling
+it to and fro, with the air of a conjurer, as he went. When I
+observed this last, plain evidence of my friend's aberration of
+mind, I could scarcely refrain from tears. I thought it best,
+however, to humor his fancy, at least for the present, or until I
+could adopt some more energetic measures with a chance of success.
+In the meantime I endeavored, but all in vain, to sound him in
+regard to the object of the expedition. Having succeeded in
+inducing me to accompany him, he seemed unwilling to hold
+conversation upon any topic of minor importance, and to all my
+questions vouchsafed no other reply than "we shall see!"
+
+We crossed the creek at the head of the island by means of a skiff,
+and, ascending the high grounds on the shore of the mainland,
+proceeded in a northwesterly direction, through a tract of country
+excessively wild and desolate, where no trace of a human footstep
+was to be seen. Legrand led the way with decision; pausing only
+for an instant, here and there, to consult what appeared to be
+certain landmarks of his own contrivance upon a former occasion.
+
+In this manner we journeyed for about two hours, and the sun was
+just setting when we entered a region infinitely more dreary than
+any yet seen. It was a species of table-land, near the summit of
+an almost inaccessible hill, densely wooded from base to pinnacle,
+and interspersed with huge crags that appeared to lie loosely upon
+the soil, and in many cases were prevented from precipitating
+themselves into the valleys below, merely by the support of the
+trees against which they reclined. Deep ravines, in various
+directions, gave an air of still sterner solemnity to the scene.
+
+The natural platform to which we had clambered was thickly
+overgrown with brambles, through which we soon discovered that it
+would have been impossible to force our way but for the scythe; and
+Jupiter, by direction of his master, proceeded to clear for us a
+path to the foot of an enormously tall tulip tree, which stood,
+with some eight or ten oaks, upon the level, and far surpassed them
+all, and all other trees which I had then ever seen, in the beauty
+of its foliage and form, in the wide spread of its branches, and in
+the general majesty of its appearance. When we reached this tree,
+Legrand turned to Jupiter, and asked him if he thought he could
+climb it. The old man seemed a little staggered by the question,
+and for some moments made no reply. At length he approached the
+huge trunk, walked slowly around it, and examined it with minute
+attention. When he had completed his scrutiny, he merely said:
+
+"Yes, massa, Jup climb any tree he ebber see in he life."
+
+"Then up with you as soon as possible, for it will soon be too dark
+to see what we are about."
+
+"How far mus' go up, massa?" inquired Jupiter.
+
+"Get up the main trunk first, and then I will tell you which way to
+go--and here--stop! take this beetle with you."
+
+"De bug, Massa Will!--de goole-bug!" cried the negro, drawing back
+in dismay--"what for mus' tote de bug way up de tree?--d--n if I
+do!"
+
+"If you are afraid, Jup, a great big negro like you, to take hold
+of a harmless little dead beetle, why you can carry it up by this
+string--but, if you do not take it up with you in some way, I shall
+be under the necessity of breaking your head with this shovel."
+
+"What de matter now, massa?" said Jup, evidently shamed into
+compliance; "always want for to raise fuss wid old nigger. Was
+only funnin anyhow. ME feered de bug! what I keer for de bug?"
+Here he took cautiously hold of the extreme end of the string, and,
+maintaining the insect as far from his person as circumstances
+would permit, prepared to ascend the tree.
+
+In youth, the tulip tree, or Liriodendron tulipiferum, the most
+magnificent of American foresters, has a trunk peculiarly smooth,
+and often rises to a great height without lateral branches; but, in
+its riper age, the bark becomes gnarled and uneven, while many
+short limbs make their appearance on the stem. Thus the difficulty
+of ascension, in the present case, lay more in semblance than in
+reality. Embracing the huge cylinder, as closely as possible, with
+his arms and knees, seizing with his hands some projections, and
+resting his naked toes upon others, Jupiter, after one or two
+narrow escapes from falling, at length wriggled himself into the
+first great fork, and seemed to consider the whole business as
+virtually accomplished. The RISK of the achievement was, in fact,
+now over, although the climber was some sixty or seventy feet from
+the ground.
+
+"Which way mus' go now, Massa Will?" he asked.
+
+"Keep up the largest branch--the one on this side," said Legrand.
+The negro obeyed him promptly, and apparently with but little
+trouble; ascending higher and higher, until no glimpse of his squat
+figure could be obtained through the dense foliage which enveloped
+it. Presently his voice was heard in a sort of halloo.
+
+"How much fudder is got to go?"
+
+"How high up are you?" asked Legrand.
+
+"Ebber so fur," replied the negro; "can see de sky fru de top oh de
+tree."
+
+"Never mind the sky, but attend to what I say. Look down the trunk
+and count the limbs below you on this side. How many limbs have
+you passed?"
+
+"One, two, tree, four, fibe--I done pass fibe big limb, massa, 'pon
+dis side."
+
+"Then go one limb higher."
+
+In a few minutes the voice was heard again, announcing that the
+seventh limb was attained.
+
+"Now, Jup," cried Legrand, evidently much excited, "I want you to
+work your way out upon that limb as far as you can. If you see
+anything strange let me know."
+
+By this time what little doubt I might have entertained of my poor
+friend's insanity was put finally at rest. I had no alternative
+but to conclude him stricken with lunacy, and I became seriously
+anxious about getting him home. While I was pondering upon what
+was best to be done, Jupiter's voice was again heard.
+
+"Mos feered for to ventur pon dis limb berry far--'tis dead limb
+putty much all de way."
+
+"Did you say it was a DEAD limb, Jupiter?" cried Legrand in a
+quavering voice.
+
+"Yes, massa, him dead as de door-nail--done up for sartin--done
+departed dis here life."
+
+"What in the name of heaven shall I do?" asked Legrand, seemingly
+in the greatest distress.
+
+"Do!" said I, glad of an opportunity to interpose a word, "why come
+home and go to bed. Come now!--that's a fine fellow. It's getting
+late, and, besides, you remember your promise."
+
+"Jupiter," cried he, without heeding me in the least, "do you hear
+me?"
+
+"Yes, Massa Will, hear you ebber so plain."
+
+"Try the wood well, then, with your knife, and see if you think it
+VERY rotten."
+
+"Him rotten, massa, sure nuff," replied the negro in a few moments,
+"but not so berry rotten as mought be. Mought venture out leetle
+way pon de limb by myself, dat's true."
+
+"By yourself!--what do you mean?"
+
+"Why, I mean de bug. 'Tis BERRY hebby bug. Spose I drop him down
+fuss, an den de limb won't break wid just de weight of one nigger."
+
+"You infernal scoundrel!" cried Legrand, apparently much relieved,
+"what do you mean by telling me such nonsense as that? As sure as
+you drop that beetle I'll break your neck. Look here, Jupiter, do
+you hear me?"
+
+"Yes, massa, needn't hollo at poor nigger dat style."
+
+"Well! now listen!--if you will venture out on the limb as far as
+you think safe, and not let go the beetle, I'll make you a present
+of a silver dollar as soon as you get down."
+
+"I'm gwine, Massa Will--deed I is," replied the negro very
+promptly--"mos out to the eend now."
+
+"OUT TO THE END!" here fairly screamed Legrand; "do you say you are
+out to the end of that limb?"
+
+"Soon be to de eend, massa--o-o-o-o-oh! Lor-gol-a-marcy! what IS
+dis here pon de tree?"
+
+"Well!" cried Legrand, highly delighted, "what is it?"
+
+"Why 'taint noffin but a skull--somebody bin lef him head up de
+tree, and de crows done gobble ebery bit ob de meat off."
+
+"A skull, you say!--very well,--how is it fastened to the limb?--
+what holds it on?"
+
+"Sure nuff, massa; mus look. Why dis berry curious sarcumstance,
+pon my word--dare's a great big nail in de skull, what fastens ob
+it on to de tree."
+
+"Well now, Jupiter, do exactly as I tell you--do you hear?"
+
+"Yes, massa."
+
+"Pay attention, then--find the left eye of the skull."
+
+"Hum! hoo! dat's good! why dey ain't no eye lef at all."
+
+"Curse your stupidity! do you know your right hand from your left?"
+
+"Yes, I knows dat--knows all about dat--'tis my lef hand what I
+chops de wood wid."
+
+"To be sure! you are left-handed; and your left eye is on the same
+side as your left hand. Now, I suppose, you can find the left eye
+of the skull, or the place where the left eye has been. Have you
+found it?"
+
+Here was a long pause. At length the negro asked:
+
+"Is de lef eye of de skull pon de same side as de lef hand of de
+skull too?--cause de skull aint got not a bit oh a hand at all--
+nebber mind! I got de lef eye now--here de lef eye! what mus do
+wid it?"
+
+Let the beetle drop through it, as far as the string will reach--
+but be careful and not let go your hold of the string."
+
+"All dat done, Massa Will; mighty easy ting for to put de bug fru
+de hole--look out for him dare below!"
+
+During this colloquy no portion of Jupiter's person could be seen;
+but the beetle, which he had suffered to descend, was now visible
+at the end of the string, and glistened, like a globe of burnished
+gold, in the last rays of the setting sun, some of which still
+faintly illumined the eminence upon which we stood. The scarabaeus
+hung quite clear of any branches, and, if allowed to fall, would
+have fallen at our feet. Legrand immediately took the scythe, and
+cleared with it a circular space, three or four yards in diameter,
+just beneath the insect, and, having accomplished this, ordered
+Jupiter to let go the string and come down from the tree.
+
+Driving a peg, with great nicety, into the ground, at the precise
+spot where the beetle fell, my friend now produced from his pocket
+a tape measure. Fastening one end of this at that point of the
+trunk of the tree which was nearest the peg, he unrolled it till it
+reached the peg and thence further unrolled it, in the direction
+already established by the two points of the tree and the peg, for
+the distance of fifty feet--Jupiter clearing away the brambles with
+the scythe. At the spot thus attained a second peg was driven, and
+about this, as a center, a rude circle, about four feet in
+diameter, described. Taking now a spade himself, and giving one to
+Jupiter and one to me, Legrand begged us to set about digging as
+quickly as possible.
+
+To speak the truth, I had no especial relish for such amusement at
+any time, and, at that particular moment, would willingly have
+declined it; for the night was coming on, and I felt much fatigued
+with the exercise already taken; but I saw no mode of escape, and
+was fearful of disturbing my poor friend's equanimity by a refusal.
+Could I have depended, indeed, upon Jupiter's aid, I would have had
+no hesitation in attempting to get the lunatic home by force; but I
+was too well assured of the old negro's disposition, to hope that
+he would assist me, under any circumstances, in a personal contest
+with his master. I made no doubt that the latter had been infected
+with some of the innumerable Southern superstitions about money
+buried, and that his fantasy had received confirmation by the
+finding of the scarabaeus, or, perhaps, by Jupiter's obstinacy in
+maintaining it to be "a bug of real gold." A mind disposed to
+lunacy would readily be led away by such suggestions--especially if
+chiming in with favorite preconceived ideas--and then I called to
+mind the poor fellow's speech about the beetle's being "the index
+of his fortune." Upon the whole, I was sadly vexed and puzzled,
+but, at length, I concluded to make a virtue of necessity--to dig
+with a good will, and thus the sooner to convince the visionary, by
+ocular demonstration, of the fallacy of the opinion he entertained.
+
+The lanterns having been lit, we all fell to work with a zeal
+worthy a more rational cause; and, as the glare fell upon our
+persons and implements, I could not help thinking how picturesque a
+group we composed, and how strange and suspicious our labors must
+have appeared to any interloper who, by chance, might have stumbled
+upon our whereabouts.
+
+We dug very steadily for two hours. Little was said; and our chief
+embarrassment lay in the yelpings of the dog, who took exceeding
+interest in our proceedings. He, at length, became so obstreperous
+that we grew fearful of his giving the alarm to some stragglers in
+the vicinity,--or, rather, this was the apprehension of Legrand;--
+for myself, I should have rejoiced at any interruption which might
+have enabled me to get the wanderer home. The noise was, at
+length, very effectually silenced by Jupiter, who, getting out of
+the hole with a dogged air of deliberation, tied the brute's mouth
+up with one of his suspenders, and then returned, with a grave
+chuckle, to his task.
+
+When the time mentioned had expired, we had reached a depth of five
+feet, and yet no signs of any treasure became manifest. A general
+pause ensued, and I began to hope that the farce was at an end.
+Legrand, however, although evidently much disconcerted, wiped his
+brow thoughtfully and recommenced. We had excavated the entire
+circle of four feet diameter, and now we slightly enlarged the
+limit, and went to the farther depth of two feet. Still nothing
+appeared. The gold-seeker, whom I sincerely pitied, at length
+clambered from the pit, with the bitterest disappointment imprinted
+upon every feature, and proceeded, slowly and reluctantly, to put
+on his coat, which he had thrown off at the beginning of his labor.
+In the meantime I made no remark. Jupiter, at a signal from his
+master, began to gather up his tools. This done, and the dog
+having been unmuzzled, we turned in profound silence toward home.
+
+We had taken, perhaps, a dozen steps in this direction, when, with
+a loud oath, Legrand strode up to Jupiter, and seized him by the
+collar. The astonished negro opened his eyes and mouth to the
+fullest extent, let fall the spades, and fell upon his knees.
+
+"You scoundrel!" said Legrand, hissing out the syllables from
+between his clenched teeth--"you infernal black villain!--speak, I
+tell you!--answer me this instant, without prevarication!--which--
+which is your left eye?"
+
+"Oh, my golly, Massa Will! aint dis here my lef eye for sartain?"
+roared the terrified Jupiter, placing his hand upon his RIGHT organ
+of vision, and holding it there with a desperate pertinacity, as if
+in immediate, dread of his master's attempt at a gouge.
+
+"I thought so!--I knew it! hurrah!" vociferated Legrand, letting
+the negro go and executing a series of curvets and caracols, much
+to the astonishment of his valet, who, arising from his knees,
+looked, mutely, from his master to myself, and then from myself to
+his master.
+
+"Come! we must go back," said the latter, "the game's not up yet;"
+and he again led the way to the tulip tree.
+
+"Jupiter," said he, when we reached its foot, "come here! was the
+skull nailed to the limb with the face outward, or with the face to
+the limb?"
+
+"De face was out, massa, so dat de crows could get at de eyes good,
+widout any trouble."
+
+"Well, then, was it this eye or that through which you dropped the
+beetle?" here Legrand touched each of Jupiter's eyes.
+
+"'Twas dis eye, massa--de lef eye--jis as you tell me," and here it
+was his right eye that the negro indicated.
+
+"That will do--we must try it again."
+
+Here my friend, about whose madness I now saw, or fancied that I
+saw, certain indications of method, removed the peg which marked
+the spot where the beetle fell, to a spot about three inches to the
+westward of its former position. Taking, now, the tape measure
+from the nearest point of the trunk to the peg, as before, and
+continuing the extension in a straight line to the distance of
+fifty feet, a spot was indicated, removed, by several yards, from
+the point at which we had been digging.
+
+Around the new position a circle, somewhat larger than in the
+former instance, was now described, and we again set to work with
+the spade. I was dreadfully weary, but, scarcely understanding
+what had occasioned the change in my thoughts, I felt no longer any
+great aversion from the labor imposed. I had become most
+unaccountably interested--nay, even excited. Perhaps there was
+something, amid all the extravagant demeanor of Legrand--some air
+of forethought, or of deliberation, which impressed me. I dug
+eagerly, and now and then caught myself actually looking, with
+something that very much resembled expectation, for the fancied
+treasure, the vision of which had demented my unfortunate
+companion. At a period when such vagaries of thought most fully
+possessed me, and when we had been at work perhaps an hour and a
+half, we were again interrupted by the violent howlings of the dog.
+His uneasiness, in the first instance, had been, evidently, but the
+result of playfulness or caprice, but he now assumed a bitter and
+serious tone. Upon Jupiter's again attempting to muzzle him, he
+made furious resistance, and, leaping into the hole, tore up the
+mold frantically with his claws. In a few seconds he had uncovered
+a mass of human bones, forming two complete skeletons, intermingled
+with several buttons of metal, and what appeared to be the dust of
+decayed woolen. One or two strokes of a spade upturned the blade
+of a large Spanish knife, and, as we dug farther, three or four
+loose pieces of gold and silver coin came to light.
+
+At sight of these the joy of Jupiter could scarcely be restrained,
+but the countenance of his master wore an air of extreme
+disappointment. He urged us, however, to continue our exertions,
+and the words were hardly uttered when I stumbled and fell forward,
+having caught the toe of my boot in a large ring of iron that lay
+half buried in the loose earth.
+
+We now worked in earnest, and never did I pass ten minutes of more
+intense excitement. During this interval we had fairly unearthed
+an oblong chest of wood, which, from its perfect preservation and
+wonderful hardness, had plainly been subjected to some mineralizing
+process--perhaps that of the bichloride of mercury. This box was
+three feet and a half long, three feet broad, and two and a half
+feet deep. It was firmly secured by bands of wrought iron,
+riveted, and forming a kind of open trelliswork over the whole. On
+each side of the chest, near the top, were three rings of iron--six
+in all--by means of which a firm hold could be obtained by six
+persons. Our utmost united endeavors served only to disturb the
+coffer very slightly in its bed. We at once saw the impossibility
+of removing so great a weight. Luckily, the sole fastenings of the
+lid consisted of two sliding bolts. These we drew back--trembling
+and panting with anxiety. In an instant, a treasure of
+incalculable value lay gleaming before us. As the rays of the
+lanterns fell within the pit, there flashed upward a glow and a
+glare, from a confused heap of gold and of jewels, that absolutely
+dazzled our eyes.
+
+I shall not pretend to describe the feelings with which I gazed.
+Amazement was, of course, predominant. Legrand appeared exhausted
+with excitement, and spoke very few words. Jupiter's countenance
+wore, for some minutes, as deadly a pallor as it is possible, in
+the nature of things, for any negro's visage to assume. He seemed
+stupefied--thunderstricken. Presently he fell upon his knees in
+the pit, and burying his naked arms up to the elbows in gold, let
+them there remain, as if enjoying the luxury of a bath. At length,
+with a deep sigh, he exclaimed, as if in a soliloquy:
+
+"And dis all cum of de goole-bug! de putty goole-bug! de poor
+little goole-bug, what I boosed in that sabage kind oh style!
+Ain't you shamed oh yourself, nigger?--answer me dat!"
+
+It became necessary, at last, that I should arouse both master and
+valet to the expediency of removing the treasure. It was growing
+late, and it behooved us to make exertion, that we might get
+everything housed before daylight. It was difficult to say what
+should he done, and much time was spent in deliberation--so
+confused were the ideas of all. We, finally, lightened the box by
+removing two thirds of its contents, when we were enabled, with
+some trouble, to raise it from the hole. The articles taken out
+were deposited among the brambles, and the dog left to guard them,
+with strict orders from Jupiter neither, upon any pretense, to stir
+from the spot, nor to open his mouth until our return. We then
+hurriedly made for home with the chest; reaching the hut in safety,
+but after excessive toil, at one o'clock in the morning. Worn out
+as we were, it was not in human nature to do more immediately. We
+rested until two, and had supper; starting for the hills
+immediately afterwards, armed with three stout sacks, which, by
+good luck, were upon the premises. A little before four we arrived
+at the pit, divided the remainder of the booty, as equally as might
+be, among us, and, leaving the holes unfilled, again set out for
+the hut, at which, for the second time, we deposited our golden
+burdens, just as the first faint streaks of the dawn gleamed from
+over the treetops in the east.
+
+We were now thoroughly broken down; but the intense excitement of
+the time denied us repose. After an unquiet slumber of some three
+or four hours' duration, we arose, as if by preconcert, to make
+examination of our treasure.
+
+The chest had been full to the brim, and we spent the whole day,
+and the greater part of the next night, in a scrutiny of its
+contents. There had been nothing like order or arrangement.
+Everything had been heaped in promiscuously. Having assorted all
+with care, we found ourselves possessed of even vaster wealth than
+we had at first supposed. In coin there was rather more than four
+hundred and fifty thousand dollars--estimating the value of the
+pieces, as accurately as we could, by the tables of the period.
+There was not a particle of silver. All was gold of antique date
+and of great variety--French, Spanish, and German money, with a few
+English guineas, and some counters, of which we had never seen
+specimens before. There were several very large and heavy coins,
+so worn that we could make nothing of their inscriptions. There
+was no American money. The value of the jewels we found more
+difficulty in estimating. There were diamonds--some of them
+exceedingly large and fine--a hundred and ten in all, and not one
+of them small; eighteen rubies of remarkable brilliancy;--three
+hundred and ten emeralds, all very beautiful; and twenty-one
+sapphires, with an opal. These stones had all been broken from
+their settings and thrown loose in the chest. The settings
+themselves, which we picked out from among the other gold, appeared
+to have been beaten up with hammers, as if to prevent
+identification. Besides all this, there was a vast quantity of
+solid gold ornaments; nearly two hundred massive finger and ears
+rings; rich chains--thirty of these, if I remember; eighty-three
+very large and heavy crucifixes; five gold censers of great value;
+a prodigious golden punch bowl, ornamented with richly chased vine
+leaves and Bacchanalian figures; with two sword handles exquisitely
+embossed, and many other smaller articles which I cannot recollect.
+The weight of these valuables exceeded three hundred and fifty
+pounds avoirdupois; and in this estimate I have not included one
+hundred and ninety-seven superb gold watches; three of the number
+being worth each five hundred dollars, if one. Many of them were
+very old, and as timekeepers valueless; the works having suffered,
+more or less, from corrosion--but all were richly jeweled and in
+cases of great worth. We estimated the entire contents of the
+chest, that night, at a million and a half of dollars; and upon the
+subsequent disposal of the trinkets and jewels (a few being
+retained for our own use), it was found that we had greatly
+undervalued the treasure.
+
+When, at length, we had concluded our examination, and the intense
+excitement of the time had, in some measure, subsided, Legrand, who
+saw that I was dying with impatience for a solution of this most
+extraordinary riddle, entered into a full detail of all the
+circumstances connected with it.
+
+"You remember," said he, "the night when I handed you the rough
+sketch I had made of the scarabaeus. You recollect, also, that I
+became quite vexed at you for insisting that my drawing resembled a
+death's head. When you first made this assertion I thought you
+were jesting; but afterwards I called to mind the peculiar spots on
+the back of the insect, and admitted to myself that your remark had
+some little foundation in fact. Still, the sneer at my graphic
+powers irritated me--for I am considered a good artist--and,
+therefore, when you handed me the scrap of parchment, I was about
+to crumple it up and throw it angrily into the fire."
+
+"The scrap of paper, you mean," said I.
+
+"No; it had much of the appearance of paper, and at first I
+supposed it to be such, but when I came to draw upon it, I
+discovered it at once to be a piece of very thin parchment. It was
+quite dirty, you remember. Well, as I was in the very act of
+crumpling it up, my glance fell upon the sketch at which you had
+been looking, and you may imagine my astonishment when I perceived,
+in fact, the figure of a death's head just where, it seemed to me,
+I had made the drawing of the beetle. For a moment I was too much
+amazed to think with accuracy. I knew that my design was very
+different in detail from this--although there was a certain
+similarity in general outline. Presently I took a candle, and
+seating myself at the other end of the room, proceeded to
+scrutinize the parchment more closely. Upon turning it over, I saw
+my own sketch upon the reverse, just as I had made it. My first
+idea, now, was mere surprise at the really remarkable similarity of
+outline--at the singular coincidence involved in the fact that,
+unknown to me, there should have been a skull upon the other side
+of the parchment, immediately beneath my figure of the scarabaeus,
+and that this skull, not only in outline, but in size, should so
+closely resemble my drawing. I say the singularity of this
+coincidence absolutely stupefied me for a time. This is the usual
+effect of such coincidences. The mind struggles to establish a
+connection--a sequence of cause and effect--and, being unable to do
+so, suffers a species of temporary paralysis. But, when I
+recovered from this stupor, there dawned upon me gradually a
+conviction which startled me even far more than the coincidence. I
+began distinctly, positively, to remember that there had been NO
+drawing upon the parchment, when I made my sketch of the
+scarabaeus. I became perfectly certain of this; for I recollected
+turning up first one side and then the other, in search of the
+cleanest spot. Had the skull been then there, of course I could
+not have failed to notice it. Here was indeed a mystery which I
+felt it impossible to explain; but, even at that early moment,
+there seemed to glimmer, faintly, within the most remote and secret
+chambers of my intellect, a glow-wormlike conception of that truth
+which last night's adventure brought to so magnificent a
+demonstration. I arose at once, and putting the parchment securely
+away, dismissed all further reflection until I should be alone.
+
+"When you had gone, and when Jupiter was fast asleep, I betook
+myself to a more methodical investigation of the affair. In the
+first place I considered the manner in which the parchment had come
+into my possession. The spot where we discovered the scarabaeus
+was on the coast of the mainland, about a mile eastward of the
+island, and but a short distance above high-water mark. Upon my
+taking hold of it, it gave me a sharp bite, which caused me to let
+it drop. Jupiter, with his accustomed caution, before seizing the
+insect, which had flown toward him, looked about him for a leaf, or
+something of that nature, by which to take hold of it. It was at
+this moment that his eyes, and mine also, fell upon the scrap of
+parchment, which I then supposed to be paper. It was lying half
+buried in the sand, a corner sticking up. Near the spot where we
+found it, I observed the remnants of the hull of what appeared to
+have been a ship's longboat. The wreck seemed to have been there
+for a very great while, for the resemblance to boat timbers could
+scarcely be traced.
+
+"Well, Jupiter picked up the parchment, wrapped the beetle in it,
+and gave it to me. Soon afterwards we turned to go home, and on
+the way met Lieutenant G----. I showed him the insect, and he
+begged me to let him take it to the fort. Upon my consenting, he
+thrust it forthwith into his waistcoat pocket, without the
+parchment in which it had been wrapped, and which I had continued
+to hold in my hand during his inspection. Perhaps he dreaded my
+changing my mind, and thought it best to make sure of the prize at
+once--you know how enthusiastic he is on all subjects connected
+with Natural History. At the same time, without being conscious of
+it, I must have deposited the parchment in my own pocket.
+
+"You remember that when I went to the table, for the purpose of
+making a sketch of the beetle, I found no paper where it was
+usually kept. I looked in the drawer, and found none there. I
+searched my pockets, hoping to find an old letter, when my hand
+fell upon the parchment. I thus detail the precise mode in which
+it came into my possession, for the circumstances impressed me with
+peculiar force.
+
+"No doubt you will think me fanciful--but I had already established
+a kind of CONNECTION. I had put together two links of a great
+chain. There was a boat lying upon a seacoast, and not far from
+the boat was a parchment--NOT A PAPER--with a skull depicted upon
+it. You will, of course, ask 'where is the connection?' I reply
+that the skull, or death's head, is the well-known emblem of the
+pirate. The flag of the death's head is hoisted in all
+engagements.
+
+"I have said that the scrap was parchment, and not paper.
+Parchment is durable--almost imperishable. Matters of little
+moment are rarely consigned to parchment; since, for the mere
+ordinary purposes of drawing or writing, it is not nearly so well
+adapted as paper. This reflection suggested some meaning--some
+relevancy--in the death's head. I did not fail to observe, also,
+the FORM of the parchment. Although one of its corners had been,
+by some accident, destroyed, it could be seen that the original
+form was oblong. It was just such a slip, indeed, as might have
+been chosen for a memorandum--for a record of something to be long
+remembered, and carefully preserved."
+
+"But," I interposed, "you say that the skull was NOT upon the
+parchment when you made the drawing of the beetle. How then do you
+trace any connection between the boat and the skull--since this
+latter, according to your own admission, must have been designed
+(God only knows how or by whom) at some period subsequent to your
+sketching the scarabaeus?"
+
+"Ah, hereupon turns the whole mystery; although the secret, at this
+point, I had comparatively little difficulty in solving. My steps
+were sure, and could afford but a single result. I reasoned, for
+example, thus: When I drew the scarabaeus, there was no skull
+apparent upon the parchment. When I had completed the drawing I
+gave it to you, and observed you narrowly until you returned it.
+YOU, therefore, did not design the skull, and no one else was
+present to do it. Then it was not done by human agency. And
+nevertheless it was done.
+
+"At this stage of my reflections I endeavored to remember, and DID
+remember, with entire distinctness, every incident which occurred
+about the period in question. The weather was chilly (oh, rare and
+happy accident!), and a fire was blazing upon the hearth. I was
+heated with exercise and sat near the table. You, however, had
+drawn a chair close to the chimney. Just as I placed the parchment
+in your hand, and as you were in the act of inspecting it, Wolf,
+the Newfoundland, entered, and leaped upon your shoulders. With
+your left hand you caressed him and kept him off, while your right,
+holding the parchment, was permitted to fall listlessly between
+your knees, and in close proximity to the fire. At one moment I
+thought the blaze had caught it, and was about to caution you, but,
+before I could speak, you had withdrawn it, and were engaged in its
+examination. When I considered all these particulars, I doubted
+not for a moment that HEAT had been the agent in bringing to light,
+upon the parchment, the skull which I saw designed upon it. You
+are well aware that chemical preparations exist, and have existed
+time out of mind, by means of which it is possible to write upon
+either paper or vellum, so that the characters shall become visible
+only when subjected to the action of fire. Zaffre, digested in
+aqua regia, and diluted with four times its weight of water, is
+sometimes employed; a green tint results. The regulus of cobalt,
+dissolved in spirit of niter, gives a red. These colors disappear
+at longer or shorter intervals after the material written upon
+cools, but again become apparent upon the reapplication of heat.
+
+"I now scrutinized the death's head with care. Its outer edges--
+the edges of the drawing nearest the edge of the vellum--were far
+more DISTINCT than the others. It was clear that the action of the
+caloric had been imperfect or unequal. I immediately kindled a
+fire, and subjected every portion of the parchment to a glowing
+heat. At first, the only effect was the strengthening of the faint
+lines in the skull; but, upon persevering in the experiment, there
+became visible, at the corner of the slip, diagonally opposite to
+the spot in which the death's head was delineated, the figure of
+what I at first supposed to be a goat. A closer scrutiny, however,
+satisfied me that it was intended for a kid."
+
+"Ha! ha!" said I, "to be sure I have no right to laugh at you--a
+million and a half of money is too serious a matter for mirth--but
+you are not about to establish a third link in your chain--you will
+not find any especial connection between your pirates and a goat--
+pirates, you know, have nothing to do with goats; they appertain to
+the farming interest."
+
+"But I have just said that the figure was NOT that of a goat."
+
+"Well, a kid then--pretty much the same thing."
+
+"Pretty much, but not altogether," said Legrand. "You may have
+heard of one CAPTAIN Kidd. I at once looked upon the figure of the
+animal as a kind of punning or hieroglyphical signature. I say
+signature; because its position upon the vellum suggested this
+idea. The death's head at the corner diagonally opposite, had, in
+the same manner, the air of a stamp, or seal. But I was sorely put
+out by the absence of all else--of the body to my imagined
+instrument--of the text for my context."
+
+"I presume you expected to find a letter between the stamp and the
+signature."
+
+"Something of that kind. The fact is, I felt irresistibly
+impressed with a presentiment of some vast good fortune impending.
+I can scarcely say why. Perhaps, after all, it was rather a desire
+than an actual belief;--but do you know that Jupiter's silly words,
+about the bug being of solid gold, had a remarkable effect upon my
+fancy? And then the series of accidents and coincidents--these
+were so VERY extraordinary. Do you observe how mere an accident it
+was that these events should have occurred upon the SOLE day of all
+the year in which it has been, or may be sufficiently cool for
+fire, and that without the fire, or without the intervention of the
+dog at the precise moment in which he appeared, I should never have
+become aware of the death's head, and so never the possessor of the
+treasure?"
+
+"But proceed--I am all impatience."
+
+"Well; you have heard, of course, the many stories current--the
+thousand vague rumors afloat about money buried, somewhere upon the
+Atlantic coast, by Kidd and his associates. These rumors must have
+had some foundation in fact. And that the rumors have existed so
+long and so continuous, could have resulted, it appeared to me,
+only from the circumstance of the buried treasures still REMAINING
+entombed. Had Kidd concealed his plunder for a time, and
+afterwards reclaimed it, the rumors would scarcely have reached us
+in their present unvarying form. You will observe that the stories
+told are all about money-seekers, not about money-finders. Had the
+pirate recovered his money, there the affair would have dropped.
+It seemed to me that some accident--say the loss of a memorandum
+indicating its locality--had deprived him of the means of
+recovering it, and that this accident had become known to his
+followers, who otherwise might never have heard that the treasure
+had been concealed at all, and who, busying themselves in vain,
+because unguided, attempts to regain it, had given first birth, and
+then universal currency, to the reports which are now so common.
+Have you ever heard of any important treasure being unearthed along
+the coast?"
+
+"Never."
+
+"But that Kidd's accumulations were immense, is well known. I took
+it for granted, therefore, that the earth still held them; and you
+will scarcely be surprised when I tell you that I felt a hope,
+nearly amounting to certainty, that the parchment so strangely
+found involved a lost record of the place of deposit."
+
+"But how did you proceed?"
+
+"I held the vellum again to the fire, after increasing the heat,
+but nothing appeared. I now thought it possible that the coating
+of dirt might have something to do with the failure: so I carefully
+rinsed the parchment by pouring warm water over it, and, having
+done this, I placed it in a tin pan, with the skull downward, and
+put the pan upon a furnace of lighted charcoal. In a few minutes,
+the pan having become thoroughly heated, I removed the slip, and,
+to my inexpressible joy, found it spotted, in several places, with
+what appeared to be figures arranged in lines. Again I placed it
+in the pan, and suffered it to remain another minute. Upon taking
+it off, the whole was just as you see it now."
+
+Here Legrand, having reheated the parchment, submitted it to my
+inspection. The following characters were rudely traced, in a red
+tint, between the death's head and the goat:
+
+
+"53++!305))6*;4826)4+)4+).;806*;48!8]60))85;1+8*:+(;:+*8!83(88)5*!;
+46(;88*96*?;8)*+(;485);5*!2:*+(;4956*2(5*-4)8]8*;4069285);)6!8)4++;
+1(+9;48081;8:8+1;48!85;4)485!528806*81(+9;48;(88;4(+?34;48)4+;161;:
+188;+?;"
+
+
+"But," said I, returning him the slip, "I am as much in the dark as
+ever. Were all the jewels of Golconda awaiting me upon my solution
+of this enigma, I am quite sure that I should be unable to earn
+them."
+
+"And yet," said Legrand, "the solution is by no means so difficult
+as you might be led to imagine from the first hasty inspection of
+the characters. These characters, as anyone might readily guess,
+form a cipher--that is to say, they convey a meaning; but then from
+what is known of Kidd, I could not suppose him capable of
+constructing any of the more abstruse cryptographs. I made up my
+mind, at once, that this was of a simple species--such, however, as
+would appear, to the crude intellect of the sailor, absolutely
+insoluble without the key."
+
+"And you really solved it?"
+
+"Readily; I have solved others of an abstruseness ten thousand
+times greater. Circumstances, and a certain bias of mind, have led
+me to take interest in such riddles, and it may well be doubted
+whether human ingenuity can construct an enigma of the kind which
+human ingenuity may not, by proper application, resolve. In fact,
+having once established connected and legible characters, I
+scarcely gave a thought to the mere difficulty of developing their
+import.
+
+"In the present case--indeed in all cases of secret writing--the
+first question regards the LANGUAGE of the cipher; for the
+principles of solution, so far, especially, as the more simple
+ciphers are concerned, depend upon, and are varied by, the genius
+of the particular idiom. In general, there is no alternative but
+experiment (directed by probabilities) of every tongue known to him
+who attempts the solution, until the true one be attained. But,
+with the cipher now before us, all difficulty was removed by the
+signature. The pun upon the word 'Kidd' is appreciable in no other
+language than the English. But for this consideration I should
+have begun my attempts with the Spanish and French, as the tongues
+in which a secret of this kind would most naturally have been
+written by a pirate of the Spanish main. As it was, I assumed the
+cryptograph to be English.
+
+"You observe there are no divisions between the words. Had there
+been divisions the task would have been comparatively easy. In
+such cases I should have commenced with a collation and analysis of
+the shorter words, and, had a word of a single letter occurred, as
+is most likely, (a or I, for example,) I should have considered the
+solution as assured. But, there being no division, my first step
+was to ascertain the predominant letters, as well as the least
+frequent. Counting all, I constructed a table thus:
+
+
+Of the character 8 there are 33.
+ ; " 26.
+ 4 " 19.
+ +) " 16.
+ * " 13.
+ 5 " 12.
+ 6 " 11.
+ !1 " 8.
+ 0 " 6.
+ 92 " 5.
+ :3 " 4.
+ ? " 3.
+ ] " 2.
+ -. " 1.
+
+
+"Now, in English, the letter which most frequently occurs is e.
+Afterwards, the succession runs thus: a o i d h n r s t u y c f g l
+m w b k p q x z. E predominates so remarkably, that an individual
+sentence of any length is rarely seen, in which it is not the
+prevailing character.
+
+"Here, then, we have, in the very beginning, the groundwork for
+something more than a mere guess. The general use which may be
+made of the table is obvious--but, in this particular cipher, we
+shall only very partially require its aid. As our predominant
+character is 8, we will commence by assuming it as the e of the
+natural alphabet. To verify the supposition, let us observe if the
+8 be seen often in couples--for e is doubled with great frequency
+in English--in such words, for example, as 'meet,' 'fleet,'
+'speed,' 'seen,' 'been,' 'agree,' etc. In the present instance we
+see it doubled no less than five times, although the cryptograph is
+brief.
+
+"Let us assume 8, then, as e. Now, of all WORDS in the language,
+'the' is most usual; let us see, therefore, whether there are not
+repetitions of any three characters, in the same order of
+collocation, the last of them being 8. If we discover repetitions
+of such letters, so arranged, they will most probably represent the
+word 'the.' Upon inspection, we find no less than seven such
+arrangements, the characters being ;48. We may, therefore, assume
+that ; represents t, 4 represents h, and 8 represents e--the last
+being now well confirmed. Thus a great step has been taken.
+
+"But, having established a single word, we are enabled to establish
+a vastly important point; that is to say, several commencements and
+terminations of other words. Let us refer, for example, to the
+last instance but one, in which the combination ;48 occurs--not far
+from the end of the cipher. We know that the ; immediately ensuing
+is the commencement of a word, and, of the six characters
+succeeding this 'the,' we are cognizant of no less than five. Let
+us set these characters down, thus, by the letters we know them to
+represent, leaving a space for the unknown--
+
+
+t eeth.
+
+
+"Here we are enabled, at once, to discard the 'th,' as forming no
+portion of the word commencing with the first t; since, by
+experiment of the entire alphabet for a letter adapted to the
+vacancy, we perceive that no word can be formed of which this th
+can be a part. We are thus narrowed into
+
+
+t ee,
+
+
+and, going through the alphabet, if necessary, as before, we arrive
+at the word 'tree,' as the sole possible reading. We thus gain
+another letter, r, represented by (, with the words 'the tree' in
+juxtaposition.
+
+"Looking beyond these words, for a short distance, we again see the
+combination ;48, and employ it by way of TERMINATION to what
+immediately precedes. We have thus this arrangement:
+
+
+the tree ;4(4+?34 the,
+
+
+or, substituting the natural letters, where known, it reads thus:
+
+
+the tree thr+?3h the.
+
+
+"Now, if, in place of the unknown characters, we leave blank
+spaces, or substitute dots, we read thus:
+
+
+the tree thr...h the,
+
+
+when the word 'through' makes itself evident at once. But this
+discovery gives us three new letters, o, u, and g, represented by
++, ?, and 3.
+
+"Looking now, narrowly, through the cipher for combinations of
+known characters, we find, not very far from the beginning, this
+arrangement,
+
+
+83(88, or egree,
+
+
+which plainly, is the conclusion of the word 'degree,' and gives us
+another letter, d, represented by !.
+
+"Four letters beyond the word 'degree,' we perceive the combination
+
+
+;46(;88.
+
+
+"Translating the known characters, and representing the unknown by
+dots, as before, we read thus:
+
+
+th.rtee,
+
+
+an arrangement immediately suggestive of the word thirteen,' and
+again furnishing us with two new characters, i and n, represented
+by 6 and *.
+
+"Referring, now, to the beginning of the cryptograph, we find the
+combination,
+
+
+53++!.
+
+
+"Translating as before, we obtain
+
+
+.good,
+
+
+which assures us that the first letter is A, and that the first two
+words are 'A good.'
+
+"It is now time that we arrange our key, as far as discovered, in a
+tabular form, to avoid confusion. It will stand thus:
+
+
+5 represents a
+! " d
+8 " e
+3 " g
+4 " h
+6 " i
+* " n
++ " o
+( " r
+; " t
+? " u
+
+
+"We have, therefore, no less than eleven of the most important
+letters represented, and it will be unnecessary to proceed with the
+details of the solution. I have said enough to convince you that
+ciphers of this nature are readily soluble, and to give you some
+insight into the rationale of their development. But be assured
+that the specimen before us appertains to the very simplest species
+of cryptograph. It now only remains to give you the full
+translation of the characters upon the parchment, as unriddled.
+Here it is:
+
+
+"'A good glass in the bishop's hostel in the devil's seat forty-one
+degrees and thirteen minutes northeast and by north main branch
+seventh limb east side shoot from the left eye of the death's head
+a bee-line from the tree through the shot fifty feet out.'"
+
+
+"But," said I, "the enigma seems still in as bad a condition as
+ever. How is it possible to extort a meaning from all this jargon
+about 'devil's seats,' 'death's heads,' and 'bishop's hostels'?"
+
+"I confess," replied Legrand, "that the matter still wears a
+serious aspect, when regarded with a casual glance. My first
+endeavor was to divide the sentence into the natural division
+intended by the cryptographist."
+
+"You mean, to punctuate it?"
+
+"Something of that kind."
+
+"But how was it possible to effect this?"
+
+"I reflected that it had been a POINT with the writer to run his
+words together without division, so as to increase the difficulty
+of solution. Now, a not overacute man, in pursuing such an object,
+would be nearly certain to overdo the matter. When, in the course
+of his composition, he arrived at a break in his subject which
+would naturally require a pause, or a point, he would be
+exceedingly apt to run his characters, at this place, more than
+usually close together. If you will observe the MS., in the
+present instance, you will easily detect five such cases of unusual
+crowding. Acting upon this hint I made the division thus:
+
+
+"'A good glass in the bishop's hostel in the devil's seat--forty-
+one degrees and thirteen minutes--northeast and by north--main
+branch seventh limb east side--shoot from the left eye of the
+death's head--a bee-line from the tree through the shot fifty feet
+out.'"
+
+
+"Even this division," said I, "leaves me still in the dark."
+
+"It left me also in the dark," replied Legrand, "for a few days;
+during which I made diligent inquiry in the neighborhood of
+Sullivan's Island, for any building which went by name of the
+'Bishop's Hotel'; for, of course, I dropped the obsolete word
+'hostel.' Gaining no information on the subject, I was on the
+point of extending my sphere of search, and proceeding in a more
+systematic manner, when, one morning, it entered into my head,
+quite suddenly, that this 'Bishop's Hostel' might have some
+reference to an old family, of the name of Bessop, which, time out
+of mind, had held possession of an ancient manor house, about four
+miles to the northward of the island. I accordingly went over to
+the plantation, and reinstituted my inquiries among the older
+negroes of the place. At length one of the most aged of the women
+said that she had heard of such a place as Bessop's Castle, and
+thought that she could guide me to it, but that it was not a
+castle, nor a tavern, but a high rock.
+
+"I offered to pay her well for her trouble, and, after some demur,
+she consented to accompany me to the spot. We found it without
+much difficulty, when, dismissing her, I proceeded to examine the
+place. The 'castle' consisted of an irregular assemblage of cliffs
+and rocks--one of the latter being quite remarkable for its height
+as well as for its insulated and artificial appearance. I
+clambered to its apex, and then felt much at a loss as to what
+should be next done.
+
+"While I was busied in reflection, my eyes fell upon a narrow ledge
+in the eastern face of the rock, perhaps a yard below the summit
+upon which I stood. This ledge projected about eighteen inches,
+and was not more than a foot wide, while a niche in the cliff just
+above it gave it a rude resemblance to one of the hollow-backed
+chairs used by our ancestors. I made no doubt that here was the
+'devil's seat' alluded to in the MS., and now I seemed to grasp the
+full secret of the riddle.
+
+"The 'good glass,' I knew, could have reference to nothing but a
+telescope; for the word 'glass' is rarely employed in any other
+sense by seamen. Now here, I at once saw, was a telescope to be
+used, and a definite point of view, ADMITTING NO VARIATION, from
+which to use it. Nor did I hesitate to believe that the phrases,
+'forty-one degrees and thirteen minutes,' and 'northeast and by
+north,' were intended as directions for the leveling of the glass.
+Greatly excited by these discoveries, I hurried home, procured a
+telescope, and returned to the rock.
+
+"I let myself down to the ledge, and found that it was impossible
+to retain a seat upon it except in one particular position. This
+fact confirmed my preconceived idea. I proceeded to use the glass.
+Of course, the 'forty-one degrees and thirteen minutes' could
+allude to nothing but elevation above the visible horizon, since
+the horizontal direction was clearly indicated by the words,
+'northeast and by north.' This latter direction I at once
+established by means of a pocket compass; then, pointing the glass
+as nearly at an angle of forty-one degrees of elevation as I could
+do it by guess, I moved it cautiously up or down, until my
+attention was arrested by a circular rift or opening in the foliage
+of a large tree that overtopped its fellows in the distance. In
+the center of this rift I perceived a white spot, but could not, at
+first, distinguish what it was. Adjusting the focus of the
+telescope, I again looked, and now made it out to be a human skull.
+
+"Upon this discovery I was so sanguine as to consider the enigma
+solved; for the phrase 'main branch, seventh limb, east side,'
+could refer only to the position of the skull upon the tree, while
+'shoot from the left eye of the death's head' admitted, also, of
+but one interpretation, in regard to a search for buried treasure.
+I perceived that the design was to drop a bullet from the left eye
+of the skull, and that a bee-line, or, in other words, a straight
+line, drawn from the nearest point of the trunk 'through the shot'
+(or the spot where the bullet fell), and thence extended to a
+distance of fifty feet, would indicate a definite point--and
+beneath this point I thought it at least POSSIBLE that a deposit of
+value lay concealed."
+
+"All this," I said, "is exceedingly clear, and, although ingenious,
+still simple and explicit. When you left the Bishop's Hotel, what
+then?"
+
+"Why, having carefully taken the bearings of the tree, I turned
+homeward. The instant that I left 'the devil's seat,' however, the
+circular rift vanished; nor could I get a glimpse of it afterwards,
+turn as I would. What seems to me the chief ingenuity in this
+whole business, is the fact (for repeated experiment has convinced
+me it IS a fact) that the circular opening in question is visible
+from no other attainable point of view than that afforded by the
+narrow ledge upon the face of the rock.
+
+"In this expedition to the 'Bishop's Hotel' I had been attended by
+Jupiter, who had, no doubt, observed, for some weeks past, the
+abstraction of my demeanor, and took especial care not to leave me
+alone. But, on the next day, getting up very early, I contrived to
+give him the slip, and went into the hills in search of the tree.
+After much toil I found it. When I came home at night my valet
+proposed to give me a flogging. With the rest of the adventure I
+believe you are as well acquainted as myself."
+
+"I suppose," said I, "you missed the spot, in the first attempt at
+digging, through Jupiter's stupidity in letting the bug fall
+through the right instead of through the left eye of the skull."
+
+"Precisely. This mistake made a difference of about two inches and
+a half in the 'shot'--that is to say, in the position of the peg
+nearest the tree; and had the treasure been BENEATH the 'shot,' the
+error would have been of little moment; but 'the shot,' together
+with the nearest point of the tree, were merely two points for the
+establishment of a line of direction; of course the error, however
+trivial in the beginning, increased as we proceeded with the line,
+and by the time we had gone fifty feet threw us quite off the
+scent. But for my deep-seated impressions that treasure was here
+somewhere actually buried, we might have had all our labor in
+vain."
+
+"But your grandiloquence, and your conduct in swinging the beetle--
+how excessively odd! I was sure you were mad. And why did you
+insist upon letting fall the bug, instead of a bullet, from the
+skull?"
+
+"Why, to be frank, I felt somewhat annoyed by your evident
+suspicions touching my sanity, and so resolved to punish you
+quietly, in my own way, by a little bit of sober mystification.
+For this reason I swung the beetle, and for this reason I let it
+fall from the tree. An observation of yours about its great weight
+suggested the latter idea."
+
+"Yes, I perceive; and now there is only one point which puzzles me.
+What are we to make of the skeletons found in the hole?"
+
+"That is a question I am no more able to answer than yourself.
+There seems, however, only one plausible way of accounting for
+them--and yet it is dreadful to believe in such atrocity as my
+suggestion would imply. It is clear that Kidd--if Kidd indeed
+secreted this treasure, which I doubt not--it is clear that he must
+have had assistance in the labor. But this labor concluded, he may
+have thought it expedient to remove all participants in his secret.
+Perhaps a couple of blows with a mattock were sufficient, while his
+coadjutors were busy in the pit; perhaps it required a dozen--who
+shall tell?"
diff --git a/guest_fs/test_nr b/guest_fs/test_nr
new file mode 100644
index 0000000..d7d17fc
--- /dev/null
+++ b/guest_fs/test_nr
@@ -0,0 +1 @@
+-1
\ No newline at end of file
diff --git a/include/testsuite.h b/include/testsuite.h
new file mode 100644
index 0000000..ba2eca0
--- /dev/null
+++ b/include/testsuite.h
@@ -0,0 +1,59 @@
+#ifndef APP_LIBNETTLETEST_TESTSUITE_H
+#define APP_LIBNETTLETEST_TESTSUITE_H
+void test_main_aes(void);
+void test_main_arcfour(void);
+void test_main_arctwo(void);
+void test_main_base16(void);
+void test_main_base64(void);
+void test_main_blowfish(void);
+void test_main_buffer(void);
+void test_main_camellia(void);
+void test_main_cast128(void);
+void test_main_cbc(void);
+void test_main_ccm(void);
+void test_main_cfb(void);
+void test_main_chacha_poly1305(void);
+void test_main_chacha(void);
+void test_main_cmac(void);
+void test_main_ctr(void);
+void test_main_des(void);
+void test_main_des3(void);
+void test_main_eax(void);
+void test_main_gcm(void);
+void test_main_gosthash94(void);
+void test_main_hkdf(void);
+void test_main_hmac(void);
+void test_main_knuth(void);
+void test_main_md2(void);
+void test_main_md4(void);
+void test_main_md5_compat(void);
+void test_main_md5(void);
+void test_main_meta_aead(void);
+void test_main_meta_armor(void);
+void test_main_meta_ciphers(void);
+void test_main_meta_hash(void);
+void test_main_meta_mac(void);
+void test_main_pbkdf2(void);
+void test_main_poly1305(void);
+void test_main_ripemd160(void);
+void test_main_salsa20(void);
+void test_main_serpent(void);
+void test_main_sha1(void);
+void test_main_sha1_huge(void);
+void test_main_sha3_224(void);
+void test_main_sha3_256(void);
+void test_main_sha3_384(void);
+void test_main_sha3_512(void);
+void test_main_sha3_permute(void);
+void test_main_sha224(void);
+void test_main_sha256(void);
+void test_main_sha384(void);
+void test_main_sha512(void);
+void test_main_sha512_224(void);
+void test_main_sha512_256(void);
+void test_main_shake256(void);
+void test_main_twofish(void);
+void test_main_umac(void);
+void test_main_xts(void);
+void test_main_yarrow(void);
+#endif /* APP_LIBNETTLETEST_TESTSUITE_H */
diff --git a/main.c b/main.c
new file mode 100644
index 0000000..e9935f3
--- /dev/null
+++ b/main.c
@@ -0,0 +1,298 @@
+#include "include/testsuite.h"
+#include
+
+int main()
+{
+ int tests_nr =3D -1, ret;
+ FILE *infile;
+
+ infile =3D fopen("test_nr", "r");
+ if (infile =3D=3D NULL)
+ {
+ printf("ERROR: test_nr could not be opened!\n");
+ exit(1);
+ }
+
+ ret =3D fscanf(infile, "%d", &tests_nr);
+ if (ret =3D=3D 0)
+ {
+ printf("ERROR: file test_nr should not be empty!\n");
+ exit(1);
+ }
+
+ fclose(infile);
+
+ if (tests_nr =3D=3D -1)
+ {
+ printf("\nSelect test suite: [1..11]\n");
+ printf("\t[0]\tALL\n");
+ printf("\t[1]\tMETA AEAD, META ARMOR, META CIPHERS, META HASH, META MAC, =
AES, ARCTWO, ARCFOUR, BASE16, BASE64, BLOWFISH,\n");
+ printf("\t\tBUFFER, CAMELLIA, CAST128, CBC, CCM, CFM, CHACHA, POLY1305, C=
MAC, CTR, DES, DES3, EAX, GCM, GOSTHASH94\n");
+ printf("\t[2]\tHKDF, HMAC, KNUTH, MD2, MD4, MD5\n");
+ printf("\t[3]\tPBKDF2, RIPEMD160, SALSA20, SERPENT\n");
+ printf("\t[4]\tSHA1 - WILL TAKE A LONG TIME\n");
+ printf("\t[5]\tSHA3-224\n");
+ printf("\t[6]\tSHA3-256\n");
+ printf("\t[7]\tSHA3-384\n");
+ printf("\t[8]\tSHA3-512\n");
+ printf("\t[9]\tSHA3 PERMUTE\n");
+ printf("\t[10]\tSHA224, SHA256, SHA384, SHA512, SHA512-224, SHA512-256, S=
HAKE256, TWOFISH, UMAC\n");
+ printf("\t[11]\tXTS, YARROW\n");
+
+ sleep(20);
+
+ return 0;
+ }
+
+ if (tests_nr =3D=3D 1 || tests_nr =3D=3D 0)
+ {
+ printf("Testing META AEAD...\n");
+ test_main_meta_aead();
+ printf("PASSED\n");
+
+ printf("Testing META ARMOR...\n");
+ test_main_meta_armor();
+ printf("PASSED\n");
+
+ printf("Testing META CIPHERS...\n");
+ test_main_meta_ciphers();
+ printf("PASSED\n");
+
+ printf("Testing META HASH...\n");
+ test_main_meta_hash();
+ printf("PASSED\n");
+
+ printf("Testing META MAC...\n");
+ test_main_meta_mac();
+ printf("PASSED\n");
+
+ printf("Testing AES...\n");
+ test_main_aes();
+ printf("PASSED\n");
+
+ printf("Testing ARCTWO...\n");
+ test_main_arctwo();
+ printf("PASSED\n");
+
+ printf("Testing ARCFOUR...\n");
+ test_main_arcfour();
+ printf("PASSED\n");
+
+ printf("Testing BASE16...\n");
+ test_main_base16();
+ printf("PASSED\n");
+
+ printf("Testing BASE64...\n");
+ test_main_base64();
+ printf("PASSED\n");
+
+ printf("Testing BLOWFISH...\n");
+ test_main_blowfish();
+ printf("PASSED\n");
+
+ printf("Testing BUFFER...\n");
+ test_main_buffer();
+ printf("PASSED\n");
+
+ printf("Testing CAMELLIA...\n");
+ test_main_camellia();
+ printf("PASSED\n");
+
+ printf("Testing CAST128...\n");
+ test_main_cast128();
+ printf("PASSED\n");
+
+ printf("Testing CBC...\n");
+ test_main_cbc();
+ printf("PASSED\n");
+
+ printf("Testing CCM...\n");
+ test_main_ccm();
+ printf("PASSED\n");
+
+ printf("Testing CFB...\n");
+ test_main_cfb();
+ printf("PASSED\n");
+
+ printf("Testing CHACHA...\n");
+ test_main_chacha();
+ printf("PASSED\n");
+
+ printf("Testing POLY1305...\n");
+ test_main_poly1305();
+ printf("PASSED\n");
+
+ printf("Testing CHACHA-POLY1305...\n");
+ test_main_chacha_poly1305();
+ printf("PASSED\n");
+
+ printf("Testing CMAC...\n");
+ test_main_cmac();
+ printf("PASSED\n");
+
+ printf("Testing CTR...\n");
+ test_main_ctr();
+ printf("PASSED\n");
+
+ printf("Testing DES...\n");
+ test_main_des();
+ printf("PASSED\n");
+
+ printf("Testing DES3...\n");
+ test_main_des3();
+ printf("PASSED\n");
+
+ printf("Testing EAX...\n");
+ test_main_eax();
+ printf("PASSED\n");
+
+ printf("Testing GCM...\n");
+ test_main_gcm();
+ printf("PASSED\n");
+
+ printf("Testing GOSTHASH94...\n");
+ test_main_gosthash94();
+ printf("PASSED\n");
+ }
+ if (tests_nr =3D=3D 2 || tests_nr =3D=3D 0)
+ {
+ printf("Testing HKDF...\n");
+ test_main_hkdf();
+ printf("PASSED\n");
+
+ printf("Testing HMAC...\n");
+ test_main_hmac();
+ printf("PASSED\n");
+
+ printf("Testing KNUTH...\n");
+ test_main_knuth();
+ printf("PASSED\n");
+
+ printf("Testing MD2...\n");
+ test_main_md2();
+ printf("PASSED\n");
+
+ printf("Testing MD4...\n");
+ test_main_md4();
+ printf("PASSED\n");
+
+ printf("Testing MD5-COMPAT...\n");
+ test_main_md5_compat();
+ printf("PASSED\n");
+
+ printf("Testing MD5...\n");
+ test_main_md5();
+ printf("PASSED\n");
+ }
+ if (tests_nr =3D=3D 3 || tests_nr =3D=3D 0)
+ {
+ printf("Testing PBKDF2...\n");
+ test_main_pbkdf2();
+ printf("PASSED\n");
+
+ printf("Testing RIPEMD160...\n");
+ test_main_ripemd160();
+ printf("PASSED\n");
+
+ printf("Testing SALSA20...\n");
+ test_main_salsa20();
+ printf("PASSED\n");
+
+ printf("Testing SERPENT...\n");
+ test_main_serpent();
+ printf("PASSED\n");
+ }
+ if (tests_nr =3D=3D 4 || tests_nr =3D=3D 0)
+ {
+ printf("Testing SHA1...\n");
+ test_main_sha1();
+ printf("PASSED\n");
+
+ printf("Testing SHA1 HUGE...\n");
+ test_main_sha1_huge();
+ printf("PASSED\n");
+ }
+ if (tests_nr =3D=3D 5 || tests_nr =3D=3D 0)
+ {
+ printf("Testing SHA3-224...\n");
+ test_main_sha3_224();
+ printf("PASSED\n");
+ }
+ if (tests_nr =3D=3D 6 || tests_nr =3D=3D 0)
+ {
+ printf("Testing SHA3 256...\n");
+ test_main_sha3_256();
+ printf("PASSED\n");
+ }
+ if (tests_nr =3D=3D 7 || tests_nr =3D=3D 0)
+ {
+ printf("Testing SHA3-384...\n");
+ test_main_sha3_384();
+ printf("PASSED\n");
+ }
+ if (tests_nr =3D=3D 8 || tests_nr =3D=3D 0)
+ {
+ printf("Testing SHA3-512...\n");
+ test_main_sha3_512();
+ printf("PASSED\n");
+ }
+ if (tests_nr =3D=3D 9 || tests_nr =3D=3D 0)
+ {
+ printf("Testing SHA3 PERMUTE...\n");
+ test_main_sha3_permute();
+ printf("PASSED\n");
+ }
+ if (tests_nr =3D=3D 10 || tests_nr =3D=3D 0)
+ {
+ printf("Testing SHA224...\n");
+ test_main_sha224();
+ printf("PASSED\n");
+
+ printf("Testing SHA256...\n");
+ test_main_sha256();
+ printf("PASSED\n");
+
+ printf("Testing SHA384...\n");
+ test_main_sha384();
+ printf("PASSED\n");
+
+ printf("Testing SHA512...\n");
+ test_main_sha512();
+ printf("PASSED\n");
+
+ printf("Testing SHA512-224...\n");
+ test_main_sha512_224();
+ printf("PASSED\n");
+
+ printf("Testing SHA512-256...\n");
+ test_main_sha512_256();
+ printf("PASSED\n");
+
+ printf("Testing SHAKE256...\n");
+ test_main_shake256();
+ printf("PASSED\n");
+
+ printf("Testing TWOFISH...\n");
+ test_main_twofish();
+ printf("PASSED\n");
+
+ printf("Testing UMAC...\n");
+ test_main_umac();
+ printf("PASSED\n");
+ }
+ if (tests_nr =3D=3D 11 || tests_nr =3D=3D 0)
+ {
+ printf("Testing XTS...\n");
+ test_main_xts();
+ printf("PASSED\n");
+
+ printf("Testing YARROW...\n");
+ test_main_yarrow();
+ printf("PASSED\n");
+ }
+
+ printf("All tests passed\n");
+ sleep(5);
+
+ return 0;
+}
--
2.25.1



------=_NextPart_31515703.926552591639
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 Cristian,</span><div st=
yle=3D"font-size: 13.3333px"><br></div><div style=3D"font-size: 13.3333px">=
This patch looks good to me.</div><div style=3D"font-size: 13.3333px"><br><=
/div><div style=3D"font-size: 13.3333px">Reviewed-by: Cezar Craciunoiu &lt;=
cezar.craciunoiu@gmail.com&gt;</div><div class=3D"mb_sig"></div><blockquote=
 class=3D"history_container" type=3D"cite" style=3D"border-left-style:solid=
;border-width:1px; margin-top:20px; margin-left:0px;padding-left:10px;">=0A=
                        <p style=3D"color: #AAAAAA; margin-top: 10px;">On 2=
021-01-28 19:27:02, cristian-vijelie &lt;cristianvijelie@gmail.com&gt; wrot=
e:</p><div style=3D"font-family:Arial,Helvetica,sans-serif">The guest_fs fo=
lder contains the files needed by the app to run=0A<br>corectly. The folder=
 should be mounted as a 9p virtual filesystem=0A<br>with qemu.=0A<br>=0A<br=
>Signed-off-by: cristian-vijelie <cristianvijelie@gmail.com>=0A<br>---=0A<b=
r> guest_fs/gold-bug.txt | 1598 +++++++++++++++++++++++++++++++++++++++++=
=0A<br> guest_fs/test_nr      |    1 +=0A<br> include/testsuite.h   |   59 =
++=0A<br> main.c                |  298 ++++++++=0A<br> 4 files changed, 195=
6 insertions(+)=0A<br> create mode 100644 guest_fs/gold-bug.txt=0A<br> crea=
te mode 100644 guest_fs/test_nr=0A<br> create mode 100644 include/testsuite=
.h=0A<br> create mode 100644 main.c=0A<br>=0A<br>diff --git a/guest_fs/gold=
-bug.txt b/guest_fs/gold-bug.txt=0A<br>new file mode 100644=0A<br>index 000=
0000..be3a2a0=0A<br>--- /dev/null=0A<br>+++ b/guest_fs/gold-bug.txt=0A<br>@=
@ -0,0 +1,1598 @@=0A<br>+Edgar Allan Poe=0A<br>+=0A<br>+The Gold-Bug=0A<br>=
+=0A<br>+=0A<br>+What ho! what ho! this fellow is dancing mad!=0A<br>+He ha=
th been bitten by the Tarantula.=0A<br>+                                  -=
-All in the Wrong.=0A<br>+=0A<br>+=0A<br>+Many years ago, I contracted an i=
ntimacy with a Mr. William=0A<br>+Legrand.  He was of an ancient Huguenot f=
amily, and had once been=0A<br>+wealthy: but a series of misfortunes had re=
duced him to want.  To=0A<br>+avoid the mortification consequent upon his d=
isasters, he left New=0A<br>+Orleans, the city of his forefathers, and took=
 up his residence at=0A<br>+Sullivan's Island, near Charleston, South Carol=
ina.=0A<br>+=0A<br>+This island is a very singular one.  It consists of lit=
tle else=0A<br>+than the sea sand, and is about three miles long.  Its brea=
dth at=0A<br>+no point exceeds a quarter of a mile.  It is separated from t=
he=0A<br>+mainland by a scarcely perceptible creek, oozing its way through =
a=0A<br>+wilderness of reeds and slime, a favorite resort of the marsh hen.=
=0A<br>+The vegetation, as might be supposed, is scant, or at least=0A<br>+=
dwarfish.  No trees of any magnitude are to be seen.  Near the=0A<br>+weste=
rn extremity, where Fort Moultrie stands, and where are some=0A<br>+miserab=
le frame buildings, tenanted, during summer, by the=0A<br>+fugitives from C=
harleston dust and fever, may be found, indeed, the=0A<br>+bristly palmetto=
; but the whole island, with the exception of this=0A<br>+western point, an=
d a line of hard, white beach on the seacoast, is=0A<br>+covered with a den=
se undergrowth of the sweet myrtle so much prized=0A<br>+by the horticultur=
ists of England.  The shrub here often attains=0A<br>+the height of fifteen=
 or twenty feet, and forms an almost=0A<br>+impenetrable coppice, burdening=
 the air with its fragrance.=0A<br>+=0A<br>+In the inmost recesses of this =
coppice, not far from the eastern or=0A<br>+more remote end of the island, =
Legrand had built himself a small=0A<br>+hut, which he occupied when I firs=
t, by mere accident, made his=0A<br>+acquaintance.  This soon ripened into =
friendship--for there was=0A<br>+much in the recluse to excite interest and=
 esteem.  I found him=0A<br>+well educated, with unusual powers of mind, bu=
t infected with=0A<br>+misanthropy, and subject to perverse moods of altern=
ate enthusiasm=0A<br>+and melancholy.  He had with him many books, but rare=
ly employed=0A<br>+them.  His chief amusements were gunning and fishing, or=
 sauntering=0A<br>+along the beach and through the myrtles, in quest of she=
lls or=0A<br>+entomological specimens--his collection of the latter might h=
ave=0A<br>+been envied by a Swammerdamm.  In these excursions he was usuall=
y=0A<br>+accompanied by an old negro, called Jupiter, who had been=0A<br>+m=
anumitted before the reverses of the family, but who could be=0A<br>+induce=
d, neither by threats nor by promises, to abandon what he=0A<br>+considered=
 his right of attendance upon the footsteps of his young=0A<br>+"Massa Will=
."  It is not improbable that the relatives of Legrand,=0A<br>+conceiving h=
im to be somewhat unsettled in intellect, had contrived=0A<br>+to instill t=
his obstinacy into Jupiter, with a view to the=0A<br>+supervision and guard=
ianship of the wanderer.=0A<br>+=0A<br>+The winters in the latitude of Sull=
ivan's Island are seldom very=0A<br>+severe, and in the fall of the year it=
 is a rare event indeed when=0A<br>+a fire is considered necessary.  About =
the middle of October, 18--,=0A<br>+there occurred, however, a day of remar=
kable chilliness.  Just=0A<br>+before sunset I scrambled my way through the=
 evergreens to the hut=0A<br>+of my friend, whom I had not visited for seve=
ral weeks--my=0A<br>+residence being, at that time, in Charleston, a distan=
ce of nine=0A<br>+miles from the island, while the facilities of passage an=
d=0A<br>+repassage were very far behind those of the present day.  Upon=0A<=
br>+reaching the hut I rapped, as was my custom, and getting no reply,=0A<b=
r>+sought for the key where I knew it was secreted, unlocked the door,=0A<b=
r>+and went in.  A fine fire was blazing upon the hearth.  It was a=0A<br>+=
novelty, and by no means an ungrateful one.  I threw off an=0A<br>+overcoat=
, took an armchair by the crackling logs, and awaited=0A<br>+patiently the =
arrival of my hosts.=0A<br>+=0A<br>+Soon after dark they arrived, and gave =
me a most cordial welcome.=0A<br>+Jupiter, grinning from ear to ear, bustle=
d about to prepare some=0A<br>+marsh hens for supper.  Legrand was in one o=
f his fits--how else=0A<br>+shall I term them?--of enthusiasm.  He had foun=
d an unknown=0A<br>+bivalve, forming a new genus, and, more than this, he h=
ad hunted=0A<br>+down and secured, with Jupiter's assistance, a scarabaeus =
which he=0A<br>+believed to be totally new, but in respect to which he wish=
ed to=0A<br>+have my opinion on the morrow.=0A<br>+=0A<br>+"And why not to-=
night?" I asked, rubbing my hands over the blaze,=0A<br>+and wishing the wh=
ole tribe of scarabaei at the devil.=0A<br>+=0A<br>+"Ah, if I had only know=
n you were here!" said Legrand, "but it's so=0A<br>+long since I saw you; a=
nd how could I foresee that you would pay me=0A<br>+a visit this very night=
 of all others?  As I was coming home I met=0A<br>+Lieutenant G----, from t=
he fort, and, very foolishly, I lent him=0A<br>+the bug; so it will be impo=
ssible for you to see it until the=0A<br>+morning.  Stay here to-night, and=
 I will send Jup down for it at=0A<br>+sunrise.  It is the loveliest thing =
in creation!"=0A<br>+=0A<br>+"What?--sunrise?"=0A<br>+=0A<br>+"Nonsense! no=
!--the bug.  It is of a brilliant gold color--about=0A<br>+the size of a la=
rge hickory nut--with two jet black spots near one=0A<br>+extremity of the =
back, and another, somewhat longer, at the other.=0A<br>+The antennae are--=
"=0A<br>+=0A<br>+"Dey ain't NO tin in him, Massa Will, I keep a tellin' on =
you,"=0A<br>+here interrupted Jupiter; "de bug is a goole-bug, solid, ebery=
 bit=0A<br>+of him, inside and all, sep him wing--neber feel half so hebby =
a=0A<br>+bug in my life."=0A<br>+=0A<br>+"Well, suppose it is, Jup," replie=
d Legrand, somewhat more=0A<br>+earnestly, it seemed to me, than the case d=
emanded; "is that any=0A<br>+reason for your letting the birds burn?  The c=
olor"--here he turned=0A<br>+to me--"is really almost enough to warrant Jup=
iter's idea.  You=0A<br>+never saw a more brilliant metallic luster than th=
e scales emit--=0A<br>+but of this you cannot judge till to-morrow.  In the=
 meantime I can=0A<br>+give you some idea of the shape."  Saying this, he s=
eated himself=0A<br>+at a small table, on which were a pen and ink, but no =
paper.  He=0A<br>+looked for some in a drawer, but found none.=0A<br>+=0A<b=
r>+"Never mind," he said at length, "this will answer;" and he drew=0A<br>+=
from his waistcoat pocket a scrap of what I took to be very dirty=0A<br>+fo=
olscap, and made upon it a rough drawing with the pen.  While he=0A<br>+did=
 this, I retained my seat by the fire, for I was still chilly.=0A<br>+When =
the design was complete, he handed it to me without rising.=0A<br>+As I rec=
eived it, a loud growl was heard, succeeded by a scratching=0A<br>+at the d=
oor.  Jupiter opened it, and a large Newfoundland,=0A<br>+belonging to Legr=
and, rushed in, leaped upon my shoulders, and=0A<br>+loaded me with caresse=
s; for I had shown him much attention during=0A<br>+previous visits.  When =
his gambols were over, I looked at the=0A<br>+paper, and, to speak the trut=
h, found myself not a little puzzled=0A<br>+at what my friend had depicted.=
=0A<br>+=0A<br>+"Well!" I said, after contemplating it for some minutes, "t=
his IS a=0A<br>+strange scarabaeus, I must confess; new to me; never saw an=
ything=0A<br>+like it before--unless it was a skull, or a death's head, whi=
ch it=0A<br>+more nearly resembles than anything else that has come under M=
Y=0A<br>+observation."=0A<br>+=0A<br>+"A death's head!" echoed Legrand.  "O=
h--yes--well, it has something=0A<br>+of that appearance upon paper, no dou=
bt.  The two upper black spots=0A<br>+look like eyes, eh? and the longer on=
e at the bottom like a mouth--=0A<br>+and then the shape of the whole is ov=
al."=0A<br>+=0A<br>+"Perhaps so," said I; "but, Legrand, I fear you are no =
artist.  I=0A<br>+must wait until I see the beetle itself, if I am to form =
any idea=0A<br>+of its personal appearance."=0A<br>+=0A<br>+"Well, I don't =
know," said he, a little nettled, "I draw tolerably--=0A<br>+SHOULD do it a=
t least--have had good masters, and flatter myself=0A<br>+that I am not qui=
te a blockhead."=0A<br>+=0A<br>+"But, my dear fellow, you are joking then,"=
 said I, "this is a very=0A<br>+passable SKULL--indeed, I may say that it i=
s a very EXCELLENT=0A<br>+skull, according to the vulgar notions about such=
 specimens of=0A<br>+physiology--and your scarabaeus must be the queerest s=
carabaeus in=0A<br>+the world if it resembles it.  Why, we may get up a ver=
y thrilling=0A<br>+bit of superstition upon this hint.  I presume you will =
call the=0A<br>+bug Scarabaeus caput hominis, or something of that kind--th=
ere are=0A<br>+many similar titles in the Natural Histories.  But where are=
 the=0A<br>+antennae you spoke of?"=0A<br>+=0A<br>+"The antennae!" said Leg=
rand, who seemed to be getting=0A<br>+unaccountably warm upon the subject; =
"I am sure you must see the=0A<br>+antennae.  I made them as distinct as th=
ey are in the original=0A<br>+insect, and I presume that is sufficient."=0A=
<br>+=0A<br>+"Well, well," I said, "perhaps you have--still I don't see the=
m;"=0A<br>+and I handed him the paper without additional remark, not wishin=
g=0A<br>+to ruffle his temper; but I was much surprised at the turn affairs=
=0A<br>+had taken; his ill humor puzzled me--and, as for the drawing of the=
=0A<br>+beetle, there were positively NO antennae visible, and the whole=0A=
<br>+DID bear a very close resemblance to the ordinary cuts of a death's=0A=
<br>+head.=0A<br>+=0A<br>+He received the paper very peevishly, and was abo=
ut to crumple it,=0A<br>+apparently to throw it in the fire, when a casual =
glance at the=0A<br>+design seemed suddenly to rivet his attention.  In an =
instant his=0A<br>+face grew violently red--in another excessively pale.  F=
or some=0A<br>+minutes he continued to scrutinize the drawing minutely wher=
e he=0A<br>+sat.  At length he arose, took a candle from the table, and=0A<=
br>+proceeded to seat himself upon a sea chest in the farthest corner=0A<br=
>+of the room.  Here again he made an anxious examination of the=0A<br>+pap=
er, turning it in all directions.  He said nothing, however, and=0A<br>+his=
 conduct greatly astonished me; yet I thought it prudent not to=0A<br>+exac=
erbate the growing moodiness of his temper by any comment.=0A<br>+Presently=
 he took from his coat pocket a wallet, placed the paper=0A<br>+carefully i=
n it, and deposited both in a writing desk, which he=0A<br>+locked.  He now=
 grew more composed in his demeanor; but his=0A<br>+original air of enthusi=
asm had quite disappeared.  Yet he seemed=0A<br>+not so much sulky as abstr=
acted.  As the evening wore away he=0A<br>+became more and more absorbed in=
 reverie, from which no sallies of=0A<br>+mine could arouse him.  It had be=
en my intention to pass the night=0A<br>+at the hut, as I had frequently do=
ne before, but, seeing my host in=0A<br>+this mood, I deemed it proper to t=
ake leave.  He did not press me=0A<br>+to remain, but, as I departed, he sh=
ook my hand with even more than=0A<br>+his usual cordiality.=0A<br>+=0A<br>=
+It was about a month after this (and during the interval I had seen=0A<br>=
+nothing of Legrand) when I received a visit, at Charleston, from=0A<br>+hi=
s man, Jupiter.  I had never seen the good old negro look so=0A<br>+dispiri=
ted, and I feared that some serious disaster had befallen my=0A<br>+friend.=
=0A<br>+=0A<br>+"Well, Jup," said I, "what is the matter now?--how is your =
master?"=0A<br>+=0A<br>+"Why, to speak the troof, massa, him not so berry w=
ell as mought=0A<br>+be."=0A<br>+=0A<br>+"Not well!  I am truly sorry to he=
ar it.  What does he complain=0A<br>+of?"=0A<br>+=0A<br>+"Dar! dot's it!--h=
im neber 'plain of notin'--but him berry sick for=0A<br>+all dat."=0A<br>+=
=0A<br>+"VERY sick, Jupiter!--why didn't you say so at once?  Is he=0A<br>+=
confined to bed?"=0A<br>+=0A<br>+"No, dat he aint!--he aint 'fin'd nowhar--=
dat's just whar de shoe=0A<br>+pinch--my mind is got to be berry hebby 'bou=
t poor Massa Will."=0A<br>+=0A<br>+"Jupiter, I should like to understand wh=
at it is you are talking=0A<br>+about.  You say your master is sick.  Hasn'=
t he told you what ails=0A<br>+him?"=0A<br>+=0A<br>+"Why, massa, 'taint wor=
f while for to git mad about de matter--=0A<br>+Massa Will say noffin at al=
l aint de matter wid him--but den what=0A<br>+make him go about looking dis=
 here way, wid he head down and he=0A<br>+soldiers up, and as white as a go=
ose?  And den he keep a syphon all=0A<br>+de time--"=0A<br>+=0A<br>+"Keeps =
a what, Jupiter?"=0A<br>+=0A<br>+"Keeps a syphon wid de figgurs on de slate=
--de queerest figgurs I=0A<br>+ebber did see.  Ise gittin' to be skeered, I=
 tell you.  Hab for to=0A<br>+keep mighty tight eye 'pon him 'noovers.  Tod=
der day he gib me slip=0A<br>+'fore de sun up and was gone de whole ob de b=
lessed day.  I had a=0A<br>+big stick ready cut for to gib him deuced good =
beating when he did=0A<br>+come--but Ise sich a fool dat I hadn't de heart =
arter all--he=0A<br>+looked so berry poorly."=0A<br>+=0A<br>+"Eh?--what?--a=
h yes!--upon the whole I think you had better not be=0A<br>+too severe with=
 the poor fellow--don't flog him, Jupiter--he can't=0A<br>+very well stand =
it--but can you form no idea of what has occasioned=0A<br>+this illness, or=
 rather this change of conduct?  Has anything=0A<br>+unpleasant happened si=
nce I saw you?"=0A<br>+=0A<br>+"No, massa, dey aint bin noffin onpleasant S=
INCE den--'twas 'FORE=0A<br>+den I'm feared--'twas de berry day you was dar=
e."=0A<br>+=0A<br>+"How? what do you mean."=0A<br>+=0A<br>+"Why, massa, I m=
ean de bug--dare now."=0A<br>+=0A<br>+"The what?"=0A<br>+=0A<br>+"De bug--I=
'm berry sartin dat Massa Will bin bit somewhere 'bout de=0A<br>+head by da=
t goole-bug."=0A<br>+=0A<br>+"And what cause have you, Jupiter, for such a =
supposition?"=0A<br>+=0A<br>+"Claws enuff, massa, and mouff, too.  I nebber=
 did see sich a=0A<br>+deuced bug--he kick and he bite eberyting what cum n=
ear him.  Massa=0A<br>+Will cotch him fuss, but had for to let him go 'gin =
mighty quick, I=0A<br>+tell you--den was de time he must ha' got de bite.  =
I didn't like=0A<br>+de look ob de bug mouff, myself, nohow, so I wouldn't =
take hold oh=0A<br>+him wid my finger, but I cotch him wid a piece oh paper=
 dat I=0A<br>+found.  I rap him up in de paper and stuff a piece of it in h=
e=0A<br>+mouff--dat was de way."=0A<br>+=0A<br>+"And you think, then, that =
your master was really bitten by the=0A<br>+beetle, and that the bite made =
him sick?"=0A<br>+=0A<br>+"I don't think noffin about it--I nose it.  What =
make him dream=0A<br>+'bout de goole so much, if 'taint cause he bit by the=
 goole-bug?=0A<br>+Ise heered 'bout dem goole-bugs 'fore dis."=0A<br>+=0A<b=
r>+"But how do you know he dreams about gold?"=0A<br>+=0A<br>+"How I know? =
 why, 'cause he talk about it in he sleep--dat's how I=0A<br>+nose."=0A<br>=
+=0A<br>+"Well, Jup, perhaps you are right; but to what fortunate=0A<br>+ci=
rcumstance am I to attribute the honor of a visit from you to-=0A<br>+day?"=
=0A<br>+=0A<br>+"What de matter, massa?"=0A<br>+=0A<br>+"Did you bring any =
message from Mr. Legrand?"=0A<br>+=0A<br>+"No, massa, I bring dis here piss=
el;" and here Jupiter handed me a=0A<br>+note which ran thus:=0A<br>+=0A<br=
>+=0A<br>+"MY DEAR ----=0A<br>+=0A<br>+"Why have I not seen you for so long=
 a time?  I hope you have not=0A<br>+been so foolish as to take offense at =
any little brusquerie of=0A<br>+mine; but no, that is improbable.=0A<br>+=
=0A<br>+"Since I saw you I have had great cause for anxiety.  I have=0A<br>=
+something to tell you, yet scarcely know how to tell it, or whether=0A<br>=
+I should tell it at all.=0A<br>+=0A<br>+"I have not been quite well for so=
me days past, and poor old Jup=0A<br>+annoys me, almost beyond endurance, b=
y his well-meant attentions.=0A<br>+Would you believe it?--he had prepared =
a huge stick, the other day,=0A<br>+with which to chastise me for giving hi=
m the slip, and spending the=0A<br>+day, solus, among the hills on the main=
land.  I verily believe that=0A<br>+my ill looks alone saved me a flogging.=
=0A<br>+=0A<br>+"I have made no addition to my cabinet since we met.  "If y=
ou can,=0A<br>+in any way, make it convenient, come over with Jupiter.  DO =
come.=0A<br>+I wish to see you TO-NIGHT, upon business of importance.  I as=
sure=0A<br>+you that it is of the HIGHEST importance.=0A<br>+=0A<br>+"Ever =
yours,=0A<br>+=0A<br>+"WILLIAM LEGRAND."=0A<br>+=0A<br>+=0A<br>+There was s=
omething in the tone of this note which gave me great=0A<br>+uneasiness.  I=
ts whole style differed materially from that of=0A<br>+Legrand.  What could=
 he be dreaming of?  What new crotchet=0A<br>+possessed his excitable brain=
?  What "business of the highest=0A<br>+importance" could HE possibly have =
to transact?  Jupiter's account=0A<br>+of him boded no good.  I dreaded les=
t the continued pressure of=0A<br>+misfortune had, at length, fairly unsett=
led the reason of my=0A<br>+friend.  Without a moment's hesitation, therefo=
re, I prepared to=0A<br>+accompany the negro.=0A<br>+=0A<br>+Upon reaching =
the wharf, I noticed a scythe and three spades, all=0A<br>+apparently new, =
lying in the bottom of the boat in which we were to=0A<br>+embark.=0A<br>+=
=0A<br>+"What is the meaning of all this, Jup?" I inquired.=0A<br>+=0A<br>+=
"Him syfe, massa, and spade."=0A<br>+=0A<br>+"Very true; but what are they =
doing here?"=0A<br>+=0A<br>+"Him de syfe and de spade what Massa Will sis '=
pon my buying for=0A<br>+him in de town, and de debbil's own lot of money I=
 had to gib for=0A<br>+em."=0A<br>+=0A<br>+"But what, in the name of all th=
at is mysterious, is your 'Massa=0A<br>+Will' going to do with scythes and =
spades?"=0A<br>+=0A<br>+"Dat's more dan I know, and debbil take me if I don=
't b'lieve 'tis=0A<br>+more dan he know too.  But it's all cum ob de bug."=
=0A<br>+=0A<br>+Finding that no satisfaction was to be obtained of Jupiter,=
 whose=0A<br>+whole intellect seemed to be absorbed by "de bug," I now step=
ped=0A<br>+into the boat, and made sail.  With a fair and strong breeze we=
=0A<br>+soon ran into the little cove to the northward of Fort Moultrie,=0A=
<br>+and a walk of some two miles brought us to the hut.  It was about=0A<b=
r>+three in the afternoon when we arrived.  Legrand had been awaiting=0A<br=
>+us in eager expectation.  He grasped my hand with a nervous=0A<br>+empres=
sement which alarmed me and strengthened the suspicions=0A<br>+already ente=
rtained.  His countenance was pale even to ghastliness,=0A<br>+and his deep=
-set eyes glared with unnatural luster.  After some=0A<br>+inquiries respec=
ting his health, I asked him, not knowing what=0A<br>+better to say, if he =
had yet obtained the scarabaeus from=0A<br>+Lieutenant G----.=0A<br>+=0A<br=
>+"Oh, yes," he replied, coloring violently, "I got it from him the=0A<br>+=
next morning.  Nothing should tempt me to part with that=0A<br>+scarabaeus.=
  Do you know that Jupiter is quite right about it?"=0A<br>+=0A<br>+"In wha=
t way?" I asked, with a sad foreboding at heart.=0A<br>+=0A<br>+"In supposi=
ng it to be a bug of REAL GOLD."  He said this with an=0A<br>+air of profou=
nd seriousness, and I felt inexpressibly shocked.=0A<br>+=0A<br>+"This bug =
is to make my fortune," he continued, with a triumphant=0A<br>+smile; "to r=
einstate me in my family possessions.  Is it any=0A<br>+wonder, then, that =
I prize it?  Since Fortune has thought fit to=0A<br>+bestow it upon me, I h=
ave only to use it properly, and I shall=0A<br>+arrive at the gold of which=
 it is the index.  Jupiter, bring me=0A<br>+that scarabaeus!"=0A<br>+=0A<br=
>+"What! de bug, massa?  I'd rudder not go fer trubble dat bug; you=0A<br>+=
mus' git him for your own self."  Hereupon Legrand arose, with a=0A<br>+gra=
ve and stately air, and brought me the beetle from a glass case=0A<br>+in w=
hich it was enclosed.  It was a beautiful scarabaeus, and, at=0A<br>+that t=
ime, unknown to naturalists--of course a great prize in a=0A<br>+scientific=
 point of view.  There were two round black spots near=0A<br>+one extremity=
 of the back, and a long one near the other.  The=0A<br>+scales were exceed=
ingly hard and glossy, with all the appearance of=0A<br>+burnished gold.  T=
he weight of the insect was very remarkable, and,=0A<br>+taking all things =
into consideration, I could hardly blame Jupiter=0A<br>+for his opinion res=
pecting it; but what to make of Legrand's=0A<br>+concordance with that opin=
ion, I could not, for the life of me,=0A<br>+tell.=0A<br>+=0A<br>+"I sent f=
or you," said he, in a grandiloquent tone, when I had=0A<br>+completed my e=
xamination of the beetle, "I sent for you that I=0A<br>+might have your cou=
nsel and assistance in furthering the views of=0A<br>+Fate and of the bug--=
"=0A<br>+=0A<br>+"My dear Legrand," I cried, interrupting him, "you are cer=
tainly=0A<br>+unwell, and had better use some little precautions.  You shal=
l go=0A<br>+to bed, and I will remain with you a few days, until you get ov=
er=0A<br>+this.  You are feverish and--"=0A<br>+=0A<br>+"Feel my pulse," sa=
id he.=0A<br>+=0A<br>+I felt it, and, to say the truth, found not the sligh=
test=0A<br>+indication of fever.=0A<br>+=0A<br>+"But you may be ill and yet=
 have no fever.  Allow me this once to=0A<br>+prescribe for you.  In the fi=
rst place go to bed.  In the next--"=0A<br>+=0A<br>+"You are mistaken," he =
interposed, "I am as well as I can expect to=0A<br>+be under the excitement=
 which I suffer.  If you really wish me=0A<br>+well, you will relieve this =
excitement."=0A<br>+=0A<br>+"And how is this to be done?"=0A<br>+=0A<br>+"V=
ery easily.  Jupiter and myself are going upon an expedition into=0A<br>+th=
e hills, upon the mainland, and, in this expedition, we shall=0A<br>+need t=
he aid of some person in whom we can confide.  You are the=0A<br>+only one =
we can trust.  Whether we succeed or fail, the excitement=0A<br>+which you =
now perceive in me will be equally allayed."=0A<br>+=0A<br>+"I am anxious t=
o oblige you in any way," I replied; "but do you=0A<br>+mean to say that th=
is infernal beetle has any connection with your=0A<br>+expedition into the =
hills?"=0A<br>+=0A<br>+"It has."=0A<br>+=0A<br>+"Then, Legrand, I can becom=
e a party to no such absurd proceeding."=0A<br>+=0A<br>+"I am sorry--very s=
orry--for we shall have to try it by ourselves."=0A<br>+=0A<br>+"Try it by =
yourselves!  The man is surely mad!--but stay!--how long=0A<br>+do you prop=
ose to be absent?"=0A<br>+=0A<br>+"Probably all night.  We shall start imme=
diately, and be back, at=0A<br>+all events, by sunrise."=0A<br>+=0A<br>+"An=
d will you promise me, upon your honor, that when this freak of=0A<br>+your=
s is over, and the bug business (good God!) settled to your=0A<br>+satisfac=
tion, you will then return home and follow my advice=0A<br>+implicitly, as =
that of your physician?"=0A<br>+=0A<br>+"Yes; I promise; and now let us be =
off, for we have no time to=0A<br>+lose."=0A<br>+=0A<br>+With a heavy heart=
 I accompanied my friend.  We started about four=0A<br>+o'clock--Legrand, J=
upiter, the dog, and myself.  Jupiter had with=0A<br>+him the scythe and sp=
ades--the whole of which he insisted upon=0A<br>+carrying--more through fea=
r, it seemed to me, of trusting either of=0A<br>+the implements within reac=
h of his master, than from any excess of=0A<br>+industry or complaisance.  =
His demeanor was dogged in the extreme,=0A<br>+and "dat deuced bug" were th=
e sole words which escaped his lips=0A<br>+during the journey.  For my own =
part, I had charge of a couple of=0A<br>+dark lanterns, while Legrand conte=
nted himself with the scarabaeus,=0A<br>+which he carried attached to the e=
nd of a bit of whipcord; twirling=0A<br>+it to and fro, with the air of a c=
onjurer, as he went.  When I=0A<br>+observed this last, plain evidence of m=
y friend's aberration of=0A<br>+mind, I could scarcely refrain from tears. =
 I thought it best,=0A<br>+however, to humor his fancy, at least for the pr=
esent, or until I=0A<br>+could adopt some more energetic measures with a ch=
ance of success.=0A<br>+In the meantime I endeavored, but all in vain, to s=
ound him in=0A<br>+regard to the object of the expedition.  Having succeede=
d in=0A<br>+inducing me to accompany him, he seemed unwilling to hold=0A<br=
>+conversation upon any topic of minor importance, and to all my=0A<br>+que=
stions vouchsafed no other reply than "we shall see!"=0A<br>+=0A<br>+We cro=
ssed the creek at the head of the island by means of a skiff,=0A<br>+and, a=
scending the high grounds on the shore of the mainland,=0A<br>+proceeded in=
 a northwesterly direction, through a tract of country=0A<br>+excessively w=
ild and desolate, where no trace of a human footstep=0A<br>+was to be seen.=
  Legrand led the way with decision; pausing only=0A<br>+for an instant, he=
re and there, to consult what appeared to be=0A<br>+certain landmarks of hi=
s own contrivance upon a former occasion.=0A<br>+=0A<br>+In this manner we =
journeyed for about two hours, and the sun was=0A<br>+just setting when we =
entered a region infinitely more dreary than=0A<br>+any yet seen.  It was a=
 species of table-land, near the summit of=0A<br>+an almost inaccessible hi=
ll, densely wooded from base to pinnacle,=0A<br>+and interspersed with huge=
 crags that appeared to lie loosely upon=0A<br>+the soil, and in many cases=
 were prevented from precipitating=0A<br>+themselves into the valleys below=
, merely by the support of the=0A<br>+trees against which they reclined.  D=
eep ravines, in various=0A<br>+directions, gave an air of still sterner sol=
emnity to the scene.=0A<br>+=0A<br>+The natural platform to which we had cl=
ambered was thickly=0A<br>+overgrown with brambles, through which we soon d=
iscovered that it=0A<br>+would have been impossible to force our way but fo=
r the scythe; and=0A<br>+Jupiter, by direction of his master, proceeded to =
clear for us a=0A<br>+path to the foot of an enormously tall tulip tree, wh=
ich stood,=0A<br>+with some eight or ten oaks, upon the level, and far surp=
assed them=0A<br>+all, and all other trees which I had then ever seen, in t=
he beauty=0A<br>+of its foliage and form, in the wide spread of its branche=
s, and in=0A<br>+the general majesty of its appearance.  When we reached th=
is tree,=0A<br>+Legrand turned to Jupiter, and asked him if he thought he c=
ould=0A<br>+climb it.  The old man seemed a little staggered by the questio=
n,=0A<br>+and for some moments made no reply.  At length he approached the=
=0A<br>+huge trunk, walked slowly around it, and examined it with minute=0A=
<br>+attention.  When he had completed his scrutiny, he merely said:=0A<br>=
+=0A<br>+"Yes, massa, Jup climb any tree he ebber see in he life."=0A<br>+=
=0A<br>+"Then up with you as soon as possible, for it will soon be too dark=
=0A<br>+to see what we are about."=0A<br>+=0A<br>+"How far mus' go up, mass=
a?" inquired Jupiter.=0A<br>+=0A<br>+"Get up the main trunk first, and then=
 I will tell you which way to=0A<br>+go--and here--stop! take this beetle w=
ith you."=0A<br>+=0A<br>+"De bug, Massa Will!--de goole-bug!" cried the neg=
ro, drawing back=0A<br>+in dismay--"what for mus' tote de bug way up de tre=
e?--d--n if I=0A<br>+do!"=0A<br>+=0A<br>+"If you are afraid, Jup, a great b=
ig negro like you, to take hold=0A<br>+of a harmless little dead beetle, wh=
y you can carry it up by this=0A<br>+string--but, if you do not take it up =
with you in some way, I shall=0A<br>+be under the necessity of breaking you=
r head with this shovel."=0A<br>+=0A<br>+"What de matter now, massa?" said =
Jup, evidently shamed into=0A<br>+compliance; "always want for to raise fus=
s wid old nigger.  Was=0A<br>+only funnin anyhow.  ME feered de bug! what I=
 keer for de bug?"=0A<br>+Here he took cautiously hold of the extreme end o=
f the string, and,=0A<br>+maintaining the insect as far from his person as =
circumstances=0A<br>+would permit, prepared to ascend the tree.=0A<br>+=0A<=
br>+In youth, the tulip tree, or Liriodendron tulipiferum, the most=0A<br>+=
magnificent of American foresters, has a trunk peculiarly smooth,=0A<br>+an=
d often rises to a great height without lateral branches; but, in=0A<br>+it=
s riper age, the bark becomes gnarled and uneven, while many=0A<br>+short l=
imbs make their appearance on the stem.  Thus the difficulty=0A<br>+of asce=
nsion, in the present case, lay more in semblance than in=0A<br>+reality.  =
Embracing the huge cylinder, as closely as possible, with=0A<br>+his arms a=
nd knees, seizing with his hands some projections, and=0A<br>+resting his n=
aked toes upon others, Jupiter, after one or two=0A<br>+narrow escapes from=
 falling, at length wriggled himself into the=0A<br>+first great fork, and =
seemed to consider the whole business as=0A<br>+virtually accomplished.  Th=
e RISK of the achievement was, in fact,=0A<br>+now over, although the climb=
er was some sixty or seventy feet from=0A<br>+the ground.=0A<br>+=0A<br>+"W=
hich way mus' go now, Massa Will?" he asked.=0A<br>+=0A<br>+"Keep up the la=
rgest branch--the one on this side," said Legrand.=0A<br>+The negro obeyed =
him promptly, and apparently with but little=0A<br>+trouble; ascending high=
er and higher, until no glimpse of his squat=0A<br>+figure could be obtaine=
d through the dense foliage which enveloped=0A<br>+it.  Presently his voice=
 was heard in a sort of halloo.=0A<br>+=0A<br>+"How much fudder is got to g=
o?"=0A<br>+=0A<br>+"How high up are you?" asked Legrand.=0A<br>+=0A<br>+"Eb=
ber so fur," replied the negro; "can see de sky fru de top oh de=0A<br>+tre=
e."=0A<br>+=0A<br>+"Never mind the sky, but attend to what I say.  Look dow=
n the trunk=0A<br>+and count the limbs below you on this side.  How many li=
mbs have=0A<br>+you passed?"=0A<br>+=0A<br>+"One, two, tree, four, fibe--I =
done pass fibe big limb, massa, 'pon=0A<br>+dis side."=0A<br>+=0A<br>+"Then=
 go one limb higher."=0A<br>+=0A<br>+In a few minutes the voice was heard a=
gain, announcing that the=0A<br>+seventh limb was attained.=0A<br>+=0A<br>+=
"Now, Jup," cried Legrand, evidently much excited, "I want you to=0A<br>+wo=
rk your way out upon that limb as far as you can.  If you see=0A<br>+anythi=
ng strange let me know."=0A<br>+=0A<br>+By this time what little doubt I mi=
ght have entertained of my poor=0A<br>+friend's insanity was put finally at=
 rest.  I had no alternative=0A<br>+but to conclude him stricken with lunac=
y, and I became seriously=0A<br>+anxious about getting him home.  While I w=
as pondering upon what=0A<br>+was best to be done, Jupiter's voice was agai=
n heard.=0A<br>+=0A<br>+"Mos feered for to ventur pon dis limb berry far--'=
tis dead limb=0A<br>+putty much all de way."=0A<br>+=0A<br>+"Did you say it=
 was a DEAD limb, Jupiter?" cried Legrand in a=0A<br>+quavering voice.=0A<b=
r>+=0A<br>+"Yes, massa, him dead as de door-nail--done up for sartin--done=
=0A<br>+departed dis here life."=0A<br>+=0A<br>+"What in the name of heaven=
 shall I do?" asked Legrand, seemingly=0A<br>+in the greatest distress.=0A<=
br>+=0A<br>+"Do!" said I, glad of an opportunity to interpose a word, "why =
come=0A<br>+home and go to bed.  Come now!--that's a fine fellow.  It's get=
ting=0A<br>+late, and, besides, you remember your promise."=0A<br>+=0A<br>+=
"Jupiter," cried he, without heeding me in the least, "do you hear=0A<br>+m=
e?"=0A<br>+=0A<br>+"Yes, Massa Will, hear you ebber so plain."=0A<br>+=0A<b=
r>+"Try the wood well, then, with your knife, and see if you think it=0A<br=
>+VERY rotten."=0A<br>+=0A<br>+"Him rotten, massa, sure nuff," replied the =
negro in a few moments,=0A<br>+"but not so berry rotten as mought be.  Moug=
ht venture out leetle=0A<br>+way pon de limb by myself, dat's true."=0A<br>=
+=0A<br>+"By yourself!--what do you mean?"=0A<br>+=0A<br>+"Why, I mean de b=
ug.  'Tis BERRY hebby bug.  Spose I drop him down=0A<br>+fuss, an den de li=
mb won't break wid just de weight of one nigger."=0A<br>+=0A<br>+"You infer=
nal scoundrel!" cried Legrand, apparently much relieved,=0A<br>+"what do yo=
u mean by telling me such nonsense as that?  As sure as=0A<br>+you drop tha=
t beetle I'll break your neck.  Look here, Jupiter, do=0A<br>+you hear me?"=
=0A<br>+=0A<br>+"Yes, massa, needn't hollo at poor nigger dat style."=0A<br=
>+=0A<br>+"Well! now listen!--if you will venture out on the limb as far as=
=0A<br>+you think safe, and not let go the beetle, I'll make you a present=
=0A<br>+of a silver dollar as soon as you get down."=0A<br>+=0A<br>+"I'm gw=
ine, Massa Will--deed I is," replied the negro very=0A<br>+promptly--"mos o=
ut to the eend now."=0A<br>+=0A<br>+"OUT TO THE END!" here fairly screamed =
Legrand; "do you say you are=0A<br>+out to the end of that limb?"=0A<br>+=
=0A<br>+"Soon be to de eend, massa--o-o-o-o-oh!  Lor-gol-a-marcy! what IS=
=0A<br>+dis here pon de tree?"=0A<br>+=0A<br>+"Well!" cried Legrand, highly=
 delighted, "what is it?"=0A<br>+=0A<br>+"Why 'taint noffin but a skull--so=
mebody bin lef him head up de=0A<br>+tree, and de crows done gobble ebery b=
it ob de meat off."=0A<br>+=0A<br>+"A skull, you say!--very well,--how is i=
t fastened to the limb?--=0A<br>+what holds it on?"=0A<br>+=0A<br>+"Sure nu=
ff, massa; mus look.  Why dis berry curious sarcumstance,=0A<br>+pon my wor=
d--dare's a great big nail in de skull, what fastens ob=0A<br>+it on to de =
tree."=0A<br>+=0A<br>+"Well now, Jupiter, do exactly as I tell you--do you =
hear?"=0A<br>+=0A<br>+"Yes, massa."=0A<br>+=0A<br>+"Pay attention, then--fi=
nd the left eye of the skull."=0A<br>+=0A<br>+"Hum! hoo! dat's good! why de=
y ain't no eye lef at all."=0A<br>+=0A<br>+"Curse your stupidity! do you kn=
ow your right hand from your left?"=0A<br>+=0A<br>+"Yes, I knows dat--knows=
 all about dat--'tis my lef hand what I=0A<br>+chops de wood wid."=0A<br>+=
=0A<br>+"To be sure! you are left-handed; and your left eye is on the same=
=0A<br>+side as your left hand.  Now, I suppose, you can find the left eye=
=0A<br>+of the skull, or the place where the left eye has been.  Have you=
=0A<br>+found it?"=0A<br>+=0A<br>+Here was a long pause.  At length the neg=
ro asked:=0A<br>+=0A<br>+"Is de lef eye of de skull pon de same side as de =
lef hand of de=0A<br>+skull too?--cause de skull aint got not a bit oh a ha=
nd at all--=0A<br>+nebber mind!  I got de lef eye now--here de lef eye! wha=
t mus do=0A<br>+wid it?"=0A<br>+=0A<br>+Let the beetle drop through it, as =
far as the string will reach--=0A<br>+but be careful and not let go your ho=
ld of the string."=0A<br>+=0A<br>+"All dat done, Massa Will; mighty easy ti=
ng for to put de bug fru=0A<br>+de hole--look out for him dare below!"=0A<b=
r>+=0A<br>+During this colloquy no portion of Jupiter's person could be see=
n;=0A<br>+but the beetle, which he had suffered to descend, was now visible=
=0A<br>+at the end of the string, and glistened, like a globe of burnished=
=0A<br>+gold, in the last rays of the setting sun, some of which still=0A<b=
r>+faintly illumined the eminence upon which we stood.  The scarabaeus=0A<b=
r>+hung quite clear of any branches, and, if allowed to fall, would=0A<br>+=
have fallen at our feet.  Legrand immediately took the scythe, and=0A<br>+c=
leared with it a circular space, three or four yards in diameter,=0A<br>+ju=
st beneath the insect, and, having accomplished this, ordered=0A<br>+Jupite=
r to let go the string and come down from the tree.=0A<br>+=0A<br>+Driving =
a peg, with great nicety, into the ground, at the precise=0A<br>+spot where=
 the beetle fell, my friend now produced from his pocket=0A<br>+a tape meas=
ure.  Fastening one end of this at that point of the=0A<br>+trunk of the tr=
ee which was nearest the peg, he unrolled it till it=0A<br>+reached the peg=
 and thence further unrolled it, in the direction=0A<br>+already establishe=
d by the two points of the tree and the peg, for=0A<br>+the distance of fif=
ty feet--Jupiter clearing away the brambles with=0A<br>+the scythe.  At the=
 spot thus attained a second peg was driven, and=0A<br>+about this, as a ce=
nter, a rude circle, about four feet in=0A<br>+diameter, described.  Taking=
 now a spade himself, and giving one to=0A<br>+Jupiter and one to me, Legra=
nd begged us to set about digging as=0A<br>+quickly as possible.=0A<br>+=0A=
<br>+To speak the truth, I had no especial relish for such amusement at=0A<=
br>+any time, and, at that particular moment, would willingly have=0A<br>+d=
eclined it; for the night was coming on, and I felt much fatigued=0A<br>+wi=
th the exercise already taken; but I saw no mode of escape, and=0A<br>+was =
fearful of disturbing my poor friend's equanimity by a refusal.=0A<br>+Coul=
d I have depended, indeed, upon Jupiter's aid, I would have had=0A<br>+no h=
esitation in attempting to get the lunatic home by force; but I=0A<br>+was =
too well assured of the old negro's disposition, to hope that=0A<br>+he wou=
ld assist me, under any circumstances, in a personal contest=0A<br>+with hi=
s master.  I made no doubt that the latter had been infected=0A<br>+with so=
me of the innumerable Southern superstitions about money=0A<br>+buried, and=
 that his fantasy had received confirmation by the=0A<br>+finding of the sc=
arabaeus, or, perhaps, by Jupiter's obstinacy in=0A<br>+maintaining it to b=
e "a bug of real gold."  A mind disposed to=0A<br>+lunacy would readily be =
led away by such suggestions--especially if=0A<br>+chiming in with favorite=
 preconceived ideas--and then I called to=0A<br>+mind the poor fellow's spe=
ech about the beetle's being "the index=0A<br>+of his fortune."  Upon the w=
hole, I was sadly vexed and puzzled,=0A<br>+but, at length, I concluded to =
make a virtue of necessity--to dig=0A<br>+with a good will, and thus the so=
oner to convince the visionary, by=0A<br>+ocular demonstration, of the fall=
acy of the opinion he entertained.=0A<br>+=0A<br>+The lanterns having been =
lit, we all fell to work with a zeal=0A<br>+worthy a more rational cause; a=
nd, as the glare fell upon our=0A<br>+persons and implements, I could not h=
elp thinking how picturesque a=0A<br>+group we composed, and how strange an=
d suspicious our labors must=0A<br>+have appeared to any interloper who, by=
 chance, might have stumbled=0A<br>+upon our whereabouts.=0A<br>+=0A<br>+We=
 dug very steadily for two hours.  Little was said; and our chief=0A<br>+em=
barrassment lay in the yelpings of the dog, who took exceeding=0A<br>+inter=
est in our proceedings.  He, at length, became so obstreperous=0A<br>+that =
we grew fearful of his giving the alarm to some stragglers in=0A<br>+the vi=
cinity,--or, rather, this was the apprehension of Legrand;--=0A<br>+for mys=
elf, I should have rejoiced at any interruption which might=0A<br>+have ena=
bled me to get the wanderer home.  The noise was, at=0A<br>+length, very ef=
fectually silenced by Jupiter, who, getting out of=0A<br>+the hole with a d=
ogged air of deliberation, tied the brute's mouth=0A<br>+up with one of his=
 suspenders, and then returned, with a grave=0A<br>+chuckle, to his task.=
=0A<br>+=0A<br>+When the time mentioned had expired, we had reached a depth=
 of five=0A<br>+feet, and yet no signs of any treasure became manifest.  A =
general=0A<br>+pause ensued, and I began to hope that the farce was at an e=
nd.=0A<br>+Legrand, however, although evidently much disconcerted, wiped hi=
s=0A<br>+brow thoughtfully and recommenced.  We had excavated the entire=0A=
<br>+circle of four feet diameter, and now we slightly enlarged the=0A<br>+=
limit, and went to the farther depth of two feet.  Still nothing=0A<br>+app=
eared.  The gold-seeker, whom I sincerely pitied, at length=0A<br>+clambere=
d from the pit, with the bitterest disappointment imprinted=0A<br>+upon eve=
ry feature, and proceeded, slowly and reluctantly, to put=0A<br>+on his coa=
t, which he had thrown off at the beginning of his labor.=0A<br>+In the mea=
ntime I made no remark.  Jupiter, at a signal from his=0A<br>+master, began=
 to gather up his tools.  This done, and the dog=0A<br>+having been unmuzzl=
ed, we turned in profound silence toward home.=0A<br>+=0A<br>+We had taken,=
 perhaps, a dozen steps in this direction, when, with=0A<br>+a loud oath, L=
egrand strode up to Jupiter, and seized him by the=0A<br>+collar.  The asto=
nished negro opened his eyes and mouth to the=0A<br>+fullest extent, let fa=
ll the spades, and fell upon his knees.=0A<br>+=0A<br>+"You scoundrel!" sai=
d Legrand, hissing out the syllables from=0A<br>+between his clenched teeth=
--"you infernal black villain!--speak, I=0A<br>+tell you!--answer me this i=
nstant, without prevarication!--which--=0A<br>+which is your left eye?"=0A<=
br>+=0A<br>+"Oh, my golly, Massa Will! aint dis here my lef eye for sartain=
?"=0A<br>+roared the terrified Jupiter, placing his hand upon his RIGHT org=
an=0A<br>+of vision, and holding it there with a desperate pertinacity, as =
if=0A<br>+in immediate, dread of his master's attempt at a gouge.=0A<br>+=
=0A<br>+"I thought so!--I knew it! hurrah!" vociferated Legrand, letting=0A=
<br>+the negro go and executing a series of curvets and caracols, much=0A<b=
r>+to the astonishment of his valet, who, arising from his knees,=0A<br>+lo=
oked, mutely, from his master to myself, and then from myself to=0A<br>+his=
 master.=0A<br>+=0A<br>+"Come! we must go back," said the latter, "the game=
's not up yet;"=0A<br>+and he again led the way to the tulip tree.=0A<br>+=
=0A<br>+"Jupiter," said he, when we reached its foot, "come here! was the=
=0A<br>+skull nailed to the limb with the face outward, or with the face to=
=0A<br>+the limb?"=0A<br>+=0A<br>+"De face was out, massa, so dat de crows =
could get at de eyes good,=0A<br>+widout any trouble."=0A<br>+=0A<br>+"Well=
, then, was it this eye or that through which you dropped the=0A<br>+beetle=
?" here Legrand touched each of Jupiter's eyes.=0A<br>+=0A<br>+"'Twas dis e=
ye, massa--de lef eye--jis as you tell me," and here it=0A<br>+was his righ=
t eye that the negro indicated.=0A<br>+=0A<br>+"That will do--we must try i=
t again."=0A<br>+=0A<br>+Here my friend, about whose madness I now saw, or =
fancied that I=0A<br>+saw, certain indications of method, removed the peg w=
hich marked=0A<br>+the spot where the beetle fell, to a spot about three in=
ches to the=0A<br>+westward of its former position.  Taking, now, the tape =
measure=0A<br>+from the nearest point of the trunk to the peg, as before, a=
nd=0A<br>+continuing the extension in a straight line to the distance of=0A=
<br>+fifty feet, a spot was indicated, removed, by several yards, from=0A<b=
r>+the point at which we had been digging.=0A<br>+=0A<br>+Around the new po=
sition a circle, somewhat larger than in the=0A<br>+former instance, was no=
w described, and we again set to work with=0A<br>+the spade.  I was dreadfu=
lly weary, but, scarcely understanding=0A<br>+what had occasioned the chang=
e in my thoughts, I felt no longer any=0A<br>+great aversion from the labor=
 imposed.  I had become most=0A<br>+unaccountably interested--nay, even exc=
ited.  Perhaps there was=0A<br>+something, amid all the extravagant demeano=
r of Legrand--some air=0A<br>+of forethought, or of deliberation, which imp=
ressed me.  I dug=0A<br>+eagerly, and now and then caught myself actually l=
ooking, with=0A<br>+something that very much resembled expectation, for the=
 fancied=0A<br>+treasure, the vision of which had demented my unfortunate=
=0A<br>+companion.  At a period when such vagaries of thought most fully=0A=
<br>+possessed me, and when we had been at work perhaps an hour and a=0A<br=
>+half, we were again interrupted by the violent howlings of the dog.=0A<br=
>+His uneasiness, in the first instance, had been, evidently, but the=0A<br=
>+result of playfulness or caprice, but he now assumed a bitter and=0A<br>+=
serious tone.  Upon Jupiter's again attempting to muzzle him, he=0A<br>+mad=
e furious resistance, and, leaping into the hole, tore up the=0A<br>+mold f=
rantically with his claws.  In a few seconds he had uncovered=0A<br>+a mass=
 of human bones, forming two complete skeletons, intermingled=0A<br>+with s=
everal buttons of metal, and what appeared to be the dust of=0A<br>+decayed=
 woolen.  One or two strokes of a spade upturned the blade=0A<br>+of a larg=
e Spanish knife, and, as we dug farther, three or four=0A<br>+loose pieces =
of gold and silver coin came to light.=0A<br>+=0A<br>+At sight of these the=
 joy of Jupiter could scarcely be restrained,=0A<br>+but the countenance of=
 his master wore an air of extreme=0A<br>+disappointment.  He urged us, how=
ever, to continue our exertions,=0A<br>+and the words were hardly uttered w=
hen I stumbled and fell forward,=0A<br>+having caught the toe of my boot in=
 a large ring of iron that lay=0A<br>+half buried in the loose earth.=0A<br=
>+=0A<br>+We now worked in earnest, and never did I pass ten minutes of mor=
e=0A<br>+intense excitement.  During this interval we had fairly unearthed=
=0A<br>+an oblong chest of wood, which, from its perfect preservation and=
=0A<br>+wonderful hardness, had plainly been subjected to some mineralizing=
=0A<br>+process--perhaps that of the bichloride of mercury.  This box was=
=0A<br>+three feet and a half long, three feet broad, and two and a half=0A=
<br>+feet deep.  It was firmly secured by bands of wrought iron,=0A<br>+riv=
eted, and forming a kind of open trelliswork over the whole.  On=0A<br>+eac=
h side of the chest, near the top, were three rings of iron--six=0A<br>+in =
all--by means of which a firm hold could be obtained by six=0A<br>+persons.=
  Our utmost united endeavors served only to disturb the=0A<br>+coffer very=
 slightly in its bed.  We at once saw the impossibility=0A<br>+of removing =
so great a weight.  Luckily, the sole fastenings of the=0A<br>+lid consiste=
d of two sliding bolts.  These we drew back--trembling=0A<br>+and panting w=
ith anxiety.  In an instant, a treasure of=0A<br>+incalculable value lay gl=
eaming before us.  As the rays of the=0A<br>+lanterns fell within the pit, =
there flashed upward a glow and a=0A<br>+glare, from a confused heap of gol=
d and of jewels, that absolutely=0A<br>+dazzled our eyes.=0A<br>+=0A<br>+I =
shall not pretend to describe the feelings with which I gazed.=0A<br>+Amaze=
ment was, of course, predominant.  Legrand appeared exhausted=0A<br>+with e=
xcitement, and spoke very few words.  Jupiter's countenance=0A<br>+wore, fo=
r some minutes, as deadly a pallor as it is possible, in=0A<br>+the nature =
of things, for any negro's visage to assume.  He seemed=0A<br>+stupefied--t=
hunderstricken.  Presently he fell upon his knees in=0A<br>+the pit, and bu=
rying his naked arms up to the elbows in gold, let=0A<br>+them there remain=
, as if enjoying the luxury of a bath.  At length,=0A<br>+with a deep sigh,=
 he exclaimed, as if in a soliloquy:=0A<br>+=0A<br>+"And dis all cum of de =
goole-bug! de putty goole-bug! de poor=0A<br>+little goole-bug, what I boos=
ed in that sabage kind oh style!=0A<br>+Ain't you shamed oh yourself, nigge=
r?--answer me dat!"=0A<br>+=0A<br>+It became necessary, at last, that I sho=
uld arouse both master and=0A<br>+valet to the expediency of removing the t=
reasure.  It was growing=0A<br>+late, and it behooved us to make exertion, =
that we might get=0A<br>+everything housed before daylight.  It was difficu=
lt to say what=0A<br>+should he done, and much time was spent in deliberati=
on--so=0A<br>+confused were the ideas of all.  We, finally, lightened the b=
ox by=0A<br>+removing two thirds of its contents, when we were enabled, wit=
h=0A<br>+some trouble, to raise it from the hole.  The articles taken out=
=0A<br>+were deposited among the brambles, and the dog left to guard them,=
=0A<br>+with strict orders from Jupiter neither, upon any pretense, to stir=
=0A<br>+from the spot, nor to open his mouth until our return.  We then=0A<=
br>+hurriedly made for home with the chest; reaching the hut in safety,=0A<=
br>+but after excessive toil, at one o'clock in the morning.  Worn out=0A<b=
r>+as we were, it was not in human nature to do more immediately.  We=0A<br=
>+rested until two, and had supper; starting for the hills=0A<br>+immediate=
ly afterwards, armed with three stout sacks, which, by=0A<br>+good luck, we=
re upon the premises.  A little before four we arrived=0A<br>+at the pit, d=
ivided the remainder of the booty, as equally as might=0A<br>+be, among us,=
 and, leaving the holes unfilled, again set out for=0A<br>+the hut, at whic=
h, for the second time, we deposited our golden=0A<br>+burdens, just as the=
 first faint streaks of the dawn gleamed from=0A<br>+over the treetops in t=
he east.=0A<br>+=0A<br>+We were now thoroughly broken down; but the intense=
 excitement of=0A<br>+the time denied us repose.  After an unquiet slumber =
of some three=0A<br>+or four hours' duration, we arose, as if by preconcert=
, to make=0A<br>+examination of our treasure.=0A<br>+=0A<br>+The chest had =
been full to the brim, and we spent the whole day,=0A<br>+and the greater p=
art of the next night, in a scrutiny of its=0A<br>+contents.  There had bee=
n nothing like order or arrangement.=0A<br>+Everything had been heaped in p=
romiscuously.  Having assorted all=0A<br>+with care, we found ourselves pos=
sessed of even vaster wealth than=0A<br>+we had at first supposed.  In coin=
 there was rather more than four=0A<br>+hundred and fifty thousand dollars-=
-estimating the value of the=0A<br>+pieces, as accurately as we could, by t=
he tables of the period.=0A<br>+There was not a particle of silver.  All wa=
s gold of antique date=0A<br>+and of great variety--French, Spanish, and Ge=
rman money, with a few=0A<br>+English guineas, and some counters, of which =
we had never seen=0A<br>+specimens before.  There were several very large a=
nd heavy coins,=0A<br>+so worn that we could make nothing of their inscript=
ions.  There=0A<br>+was no American money.  The value of the jewels we foun=
d more=0A<br>+difficulty in estimating.  There were diamonds--some of them=
=0A<br>+exceedingly large and fine--a hundred and ten in all, and not one=
=0A<br>+of them small; eighteen rubies of remarkable brilliancy;--three=0A<=
br>+hundred and ten emeralds, all very beautiful; and twenty-one=0A<br>+sap=
phires, with an opal.  These stones had all been broken from=0A<br>+their s=
ettings and thrown loose in the chest.  The settings=0A<br>+themselves, whi=
ch we picked out from among the other gold, appeared=0A<br>+to have been be=
aten up with hammers, as if to prevent=0A<br>+identification.  Besides all =
this, there was a vast quantity of=0A<br>+solid gold ornaments; nearly two =
hundred massive finger and ears=0A<br>+rings; rich chains--thirty of these,=
 if I remember; eighty-three=0A<br>+very large and heavy crucifixes; five g=
old censers of great value;=0A<br>+a prodigious golden punch bowl, ornament=
ed with richly chased vine=0A<br>+leaves and Bacchanalian figures; with two=
 sword handles exquisitely=0A<br>+embossed, and many other smaller articles=
 which I cannot recollect.=0A<br>+The weight of these valuables exceeded th=
ree hundred and fifty=0A<br>+pounds avoirdupois; and in this estimate I hav=
e not included one=0A<br>+hundred and ninety-seven superb gold watches; thr=
ee of the number=0A<br>+being worth each five hundred dollars, if one.  Man=
y of them were=0A<br>+very old, and as timekeepers valueless; the works hav=
ing suffered,=0A<br>+more or less, from corrosion--but all were richly jewe=
led and in=0A<br>+cases of great worth.  We estimated the entire contents o=
f the=0A<br>+chest, that night, at a million and a half of dollars; and upo=
n the=0A<br>+subsequent disposal of the trinkets and jewels (a few being=0A=
<br>+retained for our own use), it was found that we had greatly=0A<br>+und=
ervalued the treasure.=0A<br>+=0A<br>+When, at length, we had concluded our=
 examination, and the intense=0A<br>+excitement of the time had, in some me=
asure, subsided, Legrand, who=0A<br>+saw that I was dying with impatience f=
or a solution of this most=0A<br>+extraordinary riddle, entered into a full=
 detail of all the=0A<br>+circumstances connected with it.=0A<br>+=0A<br>+"=
You remember," said he, "the night when I handed you the rough=0A<br>+sketc=
h I had made of the scarabaeus.  You recollect, also, that I=0A<br>+became =
quite vexed at you for insisting that my drawing resembled a=0A<br>+death's=
 head.  When you first made this assertion I thought you=0A<br>+were jestin=
g; but afterwards I called to mind the peculiar spots on=0A<br>+the back of=
 the insect, and admitted to myself that your remark had=0A<br>+some little=
 foundation in fact.  Still, the sneer at my graphic=0A<br>+powers irritate=
d me--for I am considered a good artist--and,=0A<br>+therefore, when you ha=
nded me the scrap of parchment, I was about=0A<br>+to crumple it up and thr=
ow it angrily into the fire."=0A<br>+=0A<br>+"The scrap of paper, you mean,=
" said I.=0A<br>+=0A<br>+"No; it had much of the appearance of paper, and a=
t first I=0A<br>+supposed it to be such, but when I came to draw upon it, I=
=0A<br>+discovered it at once to be a piece of very thin parchment.  It was=
=0A<br>+quite dirty, you remember.  Well, as I was in the very act of=0A<br=
>+crumpling it up, my glance fell upon the sketch at which you had=0A<br>+b=
een looking, and you may imagine my astonishment when I perceived,=0A<br>+i=
n fact, the figure of a death's head just where, it seemed to me,=0A<br>+I =
had made the drawing of the beetle.  For a moment I was too much=0A<br>+ama=
zed to think with accuracy.  I knew that my design was very=0A<br>+differen=
t in detail from this--although there was a certain=0A<br>+similarity in ge=
neral outline.  Presently I took a candle, and=0A<br>+seating myself at the=
 other end of the room, proceeded to=0A<br>+scrutinize the parchment more c=
losely.  Upon turning it over, I saw=0A<br>+my own sketch upon the reverse,=
 just as I had made it.  My first=0A<br>+idea, now, was mere surprise at th=
e really remarkable similarity of=0A<br>+outline--at the singular coinciden=
ce involved in the fact that,=0A<br>+unknown to me, there should have been =
a skull upon the other side=0A<br>+of the parchment, immediately beneath my=
 figure of the scarabaeus,=0A<br>+and that this skull, not only in outline,=
 but in size, should so=0A<br>+closely resemble my drawing.  I say the sing=
ularity of this=0A<br>+coincidence absolutely stupefied me for a time.  Thi=
s is the usual=0A<br>+effect of such coincidences.  The mind struggles to e=
stablish a=0A<br>+connection--a sequence of cause and effect--and, being un=
able to do=0A<br>+so, suffers a species of temporary paralysis.  But, when =
I=0A<br>+recovered from this stupor, there dawned upon me gradually a=0A<br=
>+conviction which startled me even far more than the coincidence.  I=0A<br=
>+began distinctly, positively, to remember that there had been NO=0A<br>+d=
rawing upon the parchment, when I made my sketch of the=0A<br>+scarabaeus. =
 I became perfectly certain of this; for I recollected=0A<br>+turning up fi=
rst one side and then the other, in search of the=0A<br>+cleanest spot.  Ha=
d the skull been then there, of course I could=0A<br>+not have failed to no=
tice it.  Here was indeed a mystery which I=0A<br>+felt it impossible to ex=
plain; but, even at that early moment,=0A<br>+there seemed to glimmer, fain=
tly, within the most remote and secret=0A<br>+chambers of my intellect, a g=
low-wormlike conception of that truth=0A<br>+which last night's adventure b=
rought to so magnificent a=0A<br>+demonstration.  I arose at once, and putt=
ing the parchment securely=0A<br>+away, dismissed all further reflection un=
til I should be alone.=0A<br>+=0A<br>+"When you had gone, and when Jupiter =
was fast asleep, I betook=0A<br>+myself to a more methodical investigation =
of the affair.  In the=0A<br>+first place I considered the manner in which =
the parchment had come=0A<br>+into my possession.  The spot where we discov=
ered the scarabaeus=0A<br>+was on the coast of the mainland, about a mile e=
astward of the=0A<br>+island, and but a short distance above high-water mar=
k.  Upon my=0A<br>+taking hold of it, it gave me a sharp bite, which caused=
 me to let=0A<br>+it drop.  Jupiter, with his accustomed caution, before se=
izing the=0A<br>+insect, which had flown toward him, looked about him for a=
 leaf, or=0A<br>+something of that nature, by which to take hold of it.  It=
 was at=0A<br>+this moment that his eyes, and mine also, fell upon the scra=
p of=0A<br>+parchment, which I then supposed to be paper.  It was lying hal=
f=0A<br>+buried in the sand, a corner sticking up.  Near the spot where we=
=0A<br>+found it, I observed the remnants of the hull of what appeared to=
=0A<br>+have been a ship's longboat.  The wreck seemed to have been there=
=0A<br>+for a very great while, for the resemblance to boat timbers could=
=0A<br>+scarcely be traced.=0A<br>+=0A<br>+"Well, Jupiter picked up the par=
chment, wrapped the beetle in it,=0A<br>+and gave it to me.  Soon afterward=
s we turned to go home, and on=0A<br>+the way met Lieutenant G----.  I show=
ed him the insect, and he=0A<br>+begged me to let him take it to the fort. =
 Upon my consenting, he=0A<br>+thrust it forthwith into his waistcoat pocke=
t, without the=0A<br>+parchment in which it had been wrapped, and which I h=
ad continued=0A<br>+to hold in my hand during his inspection.  Perhaps he d=
readed my=0A<br>+changing my mind, and thought it best to make sure of the =
prize at=0A<br>+once--you know how enthusiastic he is on all subjects conne=
cted=0A<br>+with Natural History.  At the same time, without being consciou=
s of=0A<br>+it, I must have deposited the parchment in my own pocket.=0A<br=
>+=0A<br>+"You remember that when I went to the table, for the purpose of=
=0A<br>+making a sketch of the beetle, I found no paper where it was=0A<br>=
+usually kept.  I looked in the drawer, and found none there.  I=0A<br>+sea=
rched my pockets, hoping to find an old letter, when my hand=0A<br>+fell up=
on the parchment.  I thus detail the precise mode in which=0A<br>+it came i=
nto my possession, for the circumstances impressed me with=0A<br>+peculiar =
force.=0A<br>+=0A<br>+"No doubt you will think me fanciful--but I had alrea=
dy established=0A<br>+a kind of CONNECTION.  I had put together two links o=
f a great=0A<br>+chain.  There was a boat lying upon a seacoast, and not fa=
r from=0A<br>+the boat was a parchment--NOT A PAPER--with a skull depicted =
upon=0A<br>+it.  You will, of course, ask 'where is the connection?'  I rep=
ly=0A<br>+that the skull, or death's head, is the well-known emblem of the=
=0A<br>+pirate.  The flag of the death's head is hoisted in all=0A<br>+enga=
gements.=0A<br>+=0A<br>+"I have said that the scrap was parchment, and not =
paper.=0A<br>+Parchment is durable--almost imperishable.  Matters of little=
=0A<br>+moment are rarely consigned to parchment; since, for the mere=0A<br=
>+ordinary purposes of drawing or writing, it is not nearly so well=0A<br>+=
adapted as paper.  This reflection suggested some meaning--some=0A<br>+rele=
vancy--in the death's head.  I did not fail to observe, also,=0A<br>+the FO=
RM of the parchment.  Although one of its corners had been,=0A<br>+by some =
accident, destroyed, it could be seen that the original=0A<br>+form was obl=
ong.  It was just such a slip, indeed, as might have=0A<br>+been chosen for=
 a memorandum--for a record of something to be long=0A<br>+remembered, and =
carefully preserved."=0A<br>+=0A<br>+"But," I interposed, "you say that the=
 skull was NOT upon the=0A<br>+parchment when you made the drawing of the b=
eetle.  How then do you=0A<br>+trace any connection between the boat and th=
e skull--since this=0A<br>+latter, according to your own admission, must ha=
ve been designed=0A<br>+(God only knows how or by whom) at some period subs=
equent to your=0A<br>+sketching the scarabaeus?"=0A<br>+=0A<br>+"Ah, hereup=
on turns the whole mystery; although the secret, at this=0A<br>+point, I ha=
d comparatively little difficulty in solving.  My steps=0A<br>+were sure, a=
nd could afford but a single result.  I reasoned, for=0A<br>+example, thus:=
 When I drew the scarabaeus, there was no skull=0A<br>+apparent upon the pa=
rchment.  When I had completed the drawing I=0A<br>+gave it to you, and obs=
erved you narrowly until you returned it.=0A<br>+YOU, therefore, did not de=
sign the skull, and no one else was=0A<br>+present to do it.  Then it was n=
ot done by human agency.  And=0A<br>+nevertheless it was done.=0A<br>+=0A<b=
r>+"At this stage of my reflections I endeavored to remember, and DID=0A<br=
>+remember, with entire distinctness, every incident which occurred=0A<br>+=
about the period in question.  The weather was chilly (oh, rare and=0A<br>+=
happy accident!), and a fire was blazing upon the hearth.  I was=0A<br>+hea=
ted with exercise and sat near the table.  You, however, had=0A<br>+drawn a=
 chair close to the chimney.  Just as I placed the parchment=0A<br>+in your=
 hand, and as you were in the act of inspecting it, Wolf,=0A<br>+the Newfou=
ndland, entered, and leaped upon your shoulders.  With=0A<br>+your left han=
d you caressed him and kept him off, while your right,=0A<br>+holding the p=
archment, was permitted to fall listlessly between=0A<br>+your knees, and i=
n close proximity to the fire.  At one moment I=0A<br>+thought the blaze ha=
d caught it, and was about to caution you, but,=0A<br>+before I could speak=
, you had withdrawn it, and were engaged in its=0A<br>+examination.  When I=
 considered all these particulars, I doubted=0A<br>+not for a moment that H=
EAT had been the agent in bringing to light,=0A<br>+upon the parchment, the=
 skull which I saw designed upon it.  You=0A<br>+are well aware that chemic=
al preparations exist, and have existed=0A<br>+time out of mind, by means o=
f which it is possible to write upon=0A<br>+either paper or vellum, so that=
 the characters shall become visible=0A<br>+only when subjected to the acti=
on of fire.  Zaffre, digested in=0A<br>+aqua regia, and diluted with four t=
imes its weight of water, is=0A<br>+sometimes employed; a green tint result=
s.  The regulus of cobalt,=0A<br>+dissolved in spirit of niter, gives a red=
.  These colors disappear=0A<br>+at longer or shorter intervals after the m=
aterial written upon=0A<br>+cools, but again become apparent upon the reapp=
lication of heat.=0A<br>+=0A<br>+"I now scrutinized the death's head with c=
are.  Its outer edges--=0A<br>+the edges of the drawing nearest the edge of=
 the vellum--were far=0A<br>+more DISTINCT than the others.  It was clear t=
hat the action of the=0A<br>+caloric had been imperfect or unequal.  I imme=
diately kindled a=0A<br>+fire, and subjected every portion of the parchment=
 to a glowing=0A<br>+heat.  At first, the only effect was the strengthening=
 of the faint=0A<br>+lines in the skull; but, upon persevering in the exper=
iment, there=0A<br>+became visible, at the corner of the slip, diagonally o=
pposite to=0A<br>+the spot in which the death's head was delineated, the fi=
gure of=0A<br>+what I at first supposed to be a goat.  A closer scrutiny, h=
owever,=0A<br>+satisfied me that it was intended for a kid."=0A<br>+=0A<br>=
+"Ha! ha!" said I, "to be sure I have no right to laugh at you--a=0A<br>+mi=
llion and a half of money is too serious a matter for mirth--but=0A<br>+you=
 are not about to establish a third link in your chain--you will=0A<br>+not=
 find any especial connection between your pirates and a goat--=0A<br>+pira=
tes, you know, have nothing to do with goats; they appertain to=0A<br>+the =
farming interest."=0A<br>+=0A<br>+"But I have just said that the figure was=
 NOT that of a goat."=0A<br>+=0A<br>+"Well, a kid then--pretty much the sam=
e thing."=0A<br>+=0A<br>+"Pretty much, but not altogether," said Legrand.  =
"You may have=0A<br>+heard of one CAPTAIN Kidd.  I at once looked upon the =
figure of the=0A<br>+animal as a kind of punning or hieroglyphical signatur=
e.  I say=0A<br>+signature; because its position upon the vellum suggested =
this=0A<br>+idea.  The death's head at the corner diagonally opposite, had,=
 in=0A<br>+the same manner, the air of a stamp, or seal.  But I was sorely =
put=0A<br>+out by the absence of all else--of the body to my imagined=0A<br=
>+instrument--of the text for my context."=0A<br>+=0A<br>+"I presume you ex=
pected to find a letter between the stamp and the=0A<br>+signature."=0A<br>=
+=0A<br>+"Something of that kind.  The fact is, I felt irresistibly=0A<br>+=
impressed with a presentiment of some vast good fortune impending.=0A<br>+I=
 can scarcely say why.  Perhaps, after all, it was rather a desire=0A<br>+t=
han an actual belief;--but do you know that Jupiter's silly words,=0A<br>+a=
bout the bug being of solid gold, had a remarkable effect upon my=0A<br>+fa=
ncy?  And then the series of accidents and coincidents--these=0A<br>+were s=
o VERY extraordinary.  Do you observe how mere an accident it=0A<br>+was th=
at these events should have occurred upon the SOLE day of all=0A<br>+the ye=
ar in which it has been, or may be sufficiently cool for=0A<br>+fire, and t=
hat without the fire, or without the intervention of the=0A<br>+dog at the =
precise moment in which he appeared, I should never have=0A<br>+become awar=
e of the death's head, and so never the possessor of the=0A<br>+treasure?"=
=0A<br>+=0A<br>+"But proceed--I am all impatience."=0A<br>+=0A<br>+"Well; y=
ou have heard, of course, the many stories current--the=0A<br>+thousand vag=
ue rumors afloat about money buried, somewhere upon the=0A<br>+Atlantic coa=
st, by Kidd and his associates.  These rumors must have=0A<br>+had some fou=
ndation in fact.  And that the rumors have existed so=0A<br>+long and so co=
ntinuous, could have resulted, it appeared to me,=0A<br>+only from the circ=
umstance of the buried treasures still REMAINING=0A<br>+entombed.  Had Kidd=
 concealed his plunder for a time, and=0A<br>+afterwards reclaimed it, the =
rumors would scarcely have reached us=0A<br>+in their present unvarying for=
m.  You will observe that the stories=0A<br>+told are all about money-seeke=
rs, not about money-finders.  Had the=0A<br>+pirate recovered his money, th=
ere the affair would have dropped.=0A<br>+It seemed to me that some acciden=
t--say the loss of a memorandum=0A<br>+indicating its locality--had deprive=
d him of the means of=0A<br>+recovering it, and that this accident had beco=
me known to his=0A<br>+followers, who otherwise might never have heard that=
 the treasure=0A<br>+had been concealed at all, and who, busying themselves=
 in vain,=0A<br>+because unguided, attempts to regain it, had given first b=
irth, and=0A<br>+then universal currency, to the reports which are now so c=
ommon.=0A<br>+Have you ever heard of any important treasure being unearthed=
 along=0A<br>+the coast?"=0A<br>+=0A<br>+"Never."=0A<br>+=0A<br>+"But that =
Kidd's accumulations were immense, is well known.  I took=0A<br>+it for gra=
nted, therefore, that the earth still held them; and you=0A<br>+will scarce=
ly be surprised when I tell you that I felt a hope,=0A<br>+nearly amounting=
 to certainty, that the parchment so strangely=0A<br>+found involved a lost=
 record of the place of deposit."=0A<br>+=0A<br>+"But how did you proceed?"=
=0A<br>+=0A<br>+"I held the vellum again to the fire, after increasing the =
heat,=0A<br>+but nothing appeared.  I now thought it possible that the coat=
ing=0A<br>+of dirt might have something to do with the failure: so I carefu=
lly=0A<br>+rinsed the parchment by pouring warm water over it, and, having=
=0A<br>+done this, I placed it in a tin pan, with the skull downward, and=
=0A<br>+put the pan upon a furnace of lighted charcoal.  In a few minutes,=
=0A<br>+the pan having become thoroughly heated, I removed the slip, and,=
=0A<br>+to my inexpressible joy, found it spotted, in several places, with=
=0A<br>+what appeared to be figures arranged in lines.  Again I placed it=
=0A<br>+in the pan, and suffered it to remain another minute.  Upon taking=
=0A<br>+it off, the whole was just as you see it now."=0A<br>+=0A<br>+Here =
Legrand, having reheated the parchment, submitted it to my=0A<br>+inspectio=
n.  The following characters were rudely traced, in a red=0A<br>+tint, betw=
een the death's head and the goat:=0A<br>+=0A<br>+=0A<br>+"53++!305))6*;482=
6)4+)4+).;806*;48!8]60))85;1+8*:+(;:+*8!83(88)5*!;=0A<br>+46(;88*96*?;8)*+(=
;485);5*!2:*+(;4956*2(5*-4)8]8*;4069285);)6!8)4++;=0A<br>+1(+9;48081;8:8+1;=
48!85;4)485!528806*81(+9;48;(88;4(+?34;48)4+;161;:=0A<br>+188;+?;"=0A<br>+=
=0A<br>+=0A<br>+"But," said I, returning him the slip, "I am as much in the=
 dark as=0A<br>+ever.  Were all the jewels of Golconda awaiting me upon my =
solution=0A<br>+of this enigma, I am quite sure that I should be unable to =
earn=0A<br>+them."=0A<br>+=0A<br>+"And yet," said Legrand, "the solution is=
 by no means so difficult=0A<br>+as you might be led to imagine from the fi=
rst hasty inspection of=0A<br>+the characters.  These characters, as anyone=
 might readily guess,=0A<br>+form a cipher--that is to say, they convey a m=
eaning; but then from=0A<br>+what is known of Kidd, I could not suppose him=
 capable of=0A<br>+constructing any of the more abstruse cryptographs.  I m=
ade up my=0A<br>+mind, at once, that this was of a simple species--such, ho=
wever, as=0A<br>+would appear, to the crude intellect of the sailor, absolu=
tely=0A<br>+insoluble without the key."=0A<br>+=0A<br>+"And you really solv=
ed it?"=0A<br>+=0A<br>+"Readily; I have solved others of an abstruseness te=
n thousand=0A<br>+times greater.  Circumstances, and a certain bias of mind=
, have led=0A<br>+me to take interest in such riddles, and it may well be d=
oubted=0A<br>+whether human ingenuity can construct an enigma of the kind w=
hich=0A<br>+human ingenuity may not, by proper application, resolve.  In fa=
ct,=0A<br>+having once established connected and legible characters, I=0A<b=
r>+scarcely gave a thought to the mere difficulty of developing their=0A<br=
>+import.=0A<br>+=0A<br>+"In the present case--indeed in all cases of secre=
t writing--the=0A<br>+first question regards the LANGUAGE of the cipher; fo=
r the=0A<br>+principles of solution, so far, especially, as the more simple=
=0A<br>+ciphers are concerned, depend upon, and are varied by, the genius=
=0A<br>+of the particular idiom.  In general, there is no alternative but=
=0A<br>+experiment (directed by probabilities) of every tongue known to him=
=0A<br>+who attempts the solution, until the true one be attained.  But,=0A=
<br>+with the cipher now before us, all difficulty was removed by the=0A<br=
>+signature.  The pun upon the word 'Kidd' is appreciable in no other=0A<br=
>+language than the English.  But for this consideration I should=0A<br>+ha=
ve begun my attempts with the Spanish and French, as the tongues=0A<br>+in =
which a secret of this kind would most naturally have been=0A<br>+written b=
y a pirate of the Spanish main.  As it was, I assumed the=0A<br>+cryptograp=
h to be English.=0A<br>+=0A<br>+"You observe there are no divisions between=
 the words.  Had there=0A<br>+been divisions the task would have been compa=
ratively easy.  In=0A<br>+such cases I should have commenced with a collati=
on and analysis of=0A<br>+the shorter words, and, had a word of a single le=
tter occurred, as=0A<br>+is most likely, (a or I, for example,) I should ha=
ve considered the=0A<br>+solution as assured.  But, there being no division=
, my first step=0A<br>+was to ascertain the predominant letters, as well as=
 the least=0A<br>+frequent.  Counting all, I constructed a table thus:=0A<b=
r>+=0A<br>+=0A<br>+Of the character 8 there are 33.=0A<br>+                =
 ;     "     26.=0A<br>+                 4     "     19.=0A<br>+           =
     +)     "     16.=0A<br>+                 *     "     13.=0A<br>+      =
           5     "     12.=0A<br>+                 6     "     11.=0A<br>+ =
               !1     "      8.=0A<br>+                 0     "      6.=0A<=
br>+                92     "      5.=0A<br>+                :3     "      4=
.=0A<br>+                 ?     "      3.=0A<br>+                 ]     "  =
    2.=0A<br>+                -.     "      1.=0A<br>+=0A<br>+=0A<br>+"Now,=
 in English, the letter which most frequently occurs is e.=0A<br>+Afterward=
s, the succession runs thus: a o i d h n r s t u y c f g l=0A<br>+m w b k p=
 q x z.  E predominates so remarkably, that an individual=0A<br>+sentence o=
f any length is rarely seen, in which it is not the=0A<br>+prevailing chara=
cter.=0A<br>+=0A<br>+"Here, then, we have, in the very beginning, the groun=
dwork for=0A<br>+something more than a mere guess.  The general use which m=
ay be=0A<br>+made of the table is obvious--but, in this particular cipher, =
we=0A<br>+shall only very partially require its aid.  As our predominant=0A=
<br>+character is 8, we will commence by assuming it as the e of the=0A<br>=
+natural alphabet.  To verify the supposition, let us observe if the=0A<br>=
+8 be seen often in couples--for e is doubled with great frequency=0A<br>+i=
n English--in such words, for example, as 'meet,' 'fleet,'=0A<br>+'speed,' =
'seen,' 'been,' 'agree,' etc.  In the present instance we=0A<br>+see it dou=
bled no less than five times, although the cryptograph is=0A<br>+brief.=0A<=
br>+=0A<br>+"Let us assume 8, then, as e.  Now, of all WORDS in the languag=
e,=0A<br>+'the' is most usual; let us see, therefore, whether there are not=
=0A<br>+repetitions of any three characters, in the same order of=0A<br>+co=
llocation, the last of them being 8.  If we discover repetitions=0A<br>+of =
such letters, so arranged, they will most probably represent the=0A<br>+wor=
d 'the.'  Upon inspection, we find no less than seven such=0A<br>+arrangeme=
nts, the characters being ;48.  We may, therefore, assume=0A<br>+that ; rep=
resents t, 4 represents h, and 8 represents e--the last=0A<br>+being now we=
ll confirmed.  Thus a great step has been taken.=0A<br>+=0A<br>+"But, havin=
g established a single word, we are enabled to establish=0A<br>+a vastly im=
portant point; that is to say, several commencements and=0A<br>+termination=
s of other words.  Let us refer, for example, to the=0A<br>+last instance b=
ut one, in which the combination ;48 occurs--not far=0A<br>+from the end of=
 the cipher.  We know that the ; immediately ensuing=0A<br>+is the commence=
ment of a word, and, of the six characters=0A<br>+succeeding this 'the,' we=
 are cognizant of no less than five.  Let=0A<br>+us set these characters do=
wn, thus, by the letters we know them to=0A<br>+represent, leaving a space =
for the unknown--=0A<br>+=0A<br>+=0A<br>+t eeth.=0A<br>+=0A<br>+=0A<br>+"He=
re we are enabled, at once, to discard the 'th,' as forming no=0A<br>+porti=
on of the word commencing with the first t; since, by=0A<br>+experiment of =
the entire alphabet for a letter adapted to the=0A<br>+vacancy, we perceive=
 that no word can be formed of which this th=0A<br>+can be a part.  We are =
thus narrowed into=0A<br>+=0A<br>+=0A<br>+t ee,=0A<br>+=0A<br>+=0A<br>+and,=
 going through the alphabet, if necessary, as before, we arrive=0A<br>+at t=
he word 'tree,' as the sole possible reading.  We thus gain=0A<br>+another =
letter, r, represented by (, with the words 'the tree' in=0A<br>+juxtaposit=
ion.=0A<br>+=0A<br>+"Looking beyond these words, for a short distance, we a=
gain see the=0A<br>+combination ;48, and employ it by way of TERMINATION to=
 what=0A<br>+immediately precedes.  We have thus this arrangement:=0A<br>+=
=0A<br>+=0A<br>+the tree ;4(4+?34 the,=0A<br>+=0A<br>+=0A<br>+or, substitut=
ing the natural letters, where known, it reads thus:=0A<br>+=0A<br>+=0A<br>=
+the tree thr+?3h the.=0A<br>+=0A<br>+=0A<br>+"Now, if, in place of the unk=
nown characters, we leave blank=0A<br>+spaces, or substitute dots, we read =
thus:=0A<br>+=0A<br>+=0A<br>+the tree thr...h the,=0A<br>+=0A<br>+=0A<br>+w=
hen the word 'through' makes itself evident at once.  But this=0A<br>+disco=
very gives us three new letters, o, u, and g, represented by=0A<br>++, ?, a=
nd 3.=0A<br>+=0A<br>+"Looking now, narrowly, through the cipher for combina=
tions of=0A<br>+known characters, we find, not very far from the beginning,=
 this=0A<br>+arrangement,=0A<br>+=0A<br>+=0A<br>+83(88, or egree,=0A<br>+=
=0A<br>+=0A<br>+which plainly, is the conclusion of the word 'degree,' and =
gives us=0A<br>+another letter, d, represented by !.=0A<br>+=0A<br>+"Four l=
etters beyond the word 'degree,' we perceive the combination=0A<br>+=0A<br>=
+=0A<br>+;46(;88.=0A<br>+=0A<br>+=0A<br>+"Translating the known characters,=
 and representing the unknown by=0A<br>+dots, as before, we read thus:=0A<b=
r>+=0A<br>+=0A<br>+th.rtee,=0A<br>+=0A<br>+=0A<br>+an arrangement immediate=
ly suggestive of the word thirteen,' and=0A<br>+again furnishing us with tw=
o new characters, i and n, represented=0A<br>+by 6 and *.=0A<br>+=0A<br>+"R=
eferring, now, to the beginning of the cryptograph, we find the=0A<br>+comb=
ination,=0A<br>+=0A<br>+=0A<br>+53++!.=0A<br>+=0A<br>+=0A<br>+"Translating =
as before, we obtain=0A<br>+=0A<br>+=0A<br>+.good,=0A<br>+=0A<br>+=0A<br>+w=
hich assures us that the first letter is A, and that the first two=0A<br>+w=
ords are 'A good.'=0A<br>+=0A<br>+"It is now time that we arrange our key, =
as far as discovered, in a=0A<br>+tabular form, to avoid confusion.  It wil=
l stand thus:=0A<br>+=0A<br>+=0A<br>+5 represents a=0A<br>+!     "      d=
=0A<br>+8     "      e=0A<br>+3     "      g=0A<br>+4     "      h=0A<br>+6=
     "      i=0A<br>+*     "      n=0A<br>++     "      o=0A<br>+(     "   =
   r=0A<br>+;     "      t=0A<br>+?     "      u=0A<br>+=0A<br>+=0A<br>+"We=
 have, therefore, no less than eleven of the most important=0A<br>+letters =
represented, and it will be unnecessary to proceed with the=0A<br>+details =
of the solution.  I have said enough to convince you that=0A<br>+ciphers of=
 this nature are readily soluble, and to give you some=0A<br>+insight into =
the rationale of their development.  But be assured=0A<br>+that the specime=
n before us appertains to the very simplest species=0A<br>+of cryptograph. =
 It now only remains to give you the full=0A<br>+translation of the charact=
ers upon the parchment, as unriddled.=0A<br>+Here it is:=0A<br>+=0A<br>+=0A=
<br>+"'A good glass in the bishop's hostel in the devil's seat forty-one=0A=
<br>+degrees and thirteen minutes northeast and by north main branch=0A<br>=
+seventh limb east side shoot from the left eye of the death's head=0A<br>+=
a bee-line from the tree through the shot fifty feet out.'"=0A<br>+=0A<br>+=
=0A<br>+"But," said I, "the enigma seems still in as bad a condition as=0A<=
br>+ever.  How is it possible to extort a meaning from all this jargon=0A<b=
r>+about 'devil's seats,' 'death's heads,' and 'bishop's hostels'?"=0A<br>+=
=0A<br>+"I confess," replied Legrand, "that the matter still wears a=0A<br>=
+serious aspect, when regarded with a casual glance.  My first=0A<br>+endea=
vor was to divide the sentence into the natural division=0A<br>+intended by=
 the cryptographist."=0A<br>+=0A<br>+"You mean, to punctuate it?"=0A<br>+=
=0A<br>+"Something of that kind."=0A<br>+=0A<br>+"But how was it possible t=
o effect this?"=0A<br>+=0A<br>+"I reflected that it had been a POINT with t=
he writer to run his=0A<br>+words together without division, so as to incre=
ase the difficulty=0A<br>+of solution.  Now, a not overacute man, in pursui=
ng such an object,=0A<br>+would be nearly certain to overdo the matter.  Wh=
en, in the course=0A<br>+of his composition, he arrived at a break in his s=
ubject which=0A<br>+would naturally require a pause, or a point, he would b=
e=0A<br>+exceedingly apt to run his characters, at this place, more than=0A=
<br>+usually close together.  If you will observe the MS., in the=0A<br>+pr=
esent instance, you will easily detect five such cases of unusual=0A<br>+cr=
owding.  Acting upon this hint I made the division thus:=0A<br>+=0A<br>+=0A=
<br>+"'A good glass in the bishop's hostel in the devil's seat--forty-=0A<b=
r>+one degrees and thirteen minutes--northeast and by north--main=0A<br>+br=
anch seventh limb east side--shoot from the left eye of the=0A<br>+death's =
head--a bee-line from the tree through the shot fifty feet=0A<br>+out.'"=0A=
<br>+=0A<br>+=0A<br>+"Even this division," said I, "leaves me still in the =
dark."=0A<br>+=0A<br>+"It left me also in the dark," replied Legrand, "for =
a few days;=0A<br>+during which I made diligent inquiry in the neighborhood=
 of=0A<br>+Sullivan's Island, for any building which went by name of the=0A=
<br>+'Bishop's Hotel'; for, of course, I dropped the obsolete word=0A<br>+'=
hostel.'  Gaining no information on the subject, I was on the=0A<br>+point =
of extending my sphere of search, and proceeding in a more=0A<br>+systemati=
c manner, when, one morning, it entered into my head,=0A<br>+quite suddenly=
, that this 'Bishop's Hostel' might have some=0A<br>+reference to an old fa=
mily, of the name of Bessop, which, time out=0A<br>+of mind, had held posse=
ssion of an ancient manor house, about four=0A<br>+miles to the northward o=
f the island.  I accordingly went over to=0A<br>+the plantation, and reinst=
ituted my inquiries among the older=0A<br>+negroes of the place.  At length=
 one of the most aged of the women=0A<br>+said that she had heard of such a=
 place as Bessop's Castle, and=0A<br>+thought that she could guide me to it=
, but that it was not a=0A<br>+castle, nor a tavern, but a high rock.=0A<br=
>+=0A<br>+"I offered to pay her well for her trouble, and, after some demur=
,=0A<br>+she consented to accompany me to the spot.  We found it without=0A=
<br>+much difficulty, when, dismissing her, I proceeded to examine the=0A<b=
r>+place.  The 'castle' consisted of an irregular assemblage of cliffs=0A<b=
r>+and rocks--one of the latter being quite remarkable for its height=0A<br=
>+as well as for its insulated and artificial appearance.  I=0A<br>+clamber=
ed to its apex, and then felt much at a loss as to what=0A<br>+should be ne=
xt done.=0A<br>+=0A<br>+"While I was busied in reflection, my eyes fell upo=
n a narrow ledge=0A<br>+in the eastern face of the rock, perhaps a yard bel=
ow the summit=0A<br>+upon which I stood.  This ledge projected about eighte=
en inches,=0A<br>+and was not more than a foot wide, while a niche in the c=
liff just=0A<br>+above it gave it a rude resemblance to one of the hollow-b=
acked=0A<br>+chairs used by our ancestors.  I made no doubt that here was t=
he=0A<br>+'devil's seat' alluded to in the MS., and now I seemed to grasp t=
he=0A<br>+full secret of the riddle.=0A<br>+=0A<br>+"The 'good glass,' I kn=
ew, could have reference to nothing but a=0A<br>+telescope; for the word 'g=
lass' is rarely employed in any other=0A<br>+sense by seamen.  Now here, I =
at once saw, was a telescope to be=0A<br>+used, and a definite point of vie=
w, ADMITTING NO VARIATION, from=0A<br>+which to use it.  Nor did I hesitate=
 to believe that the phrases,=0A<br>+'forty-one degrees and thirteen minute=
s,' and 'northeast and by=0A<br>+north,' were intended as directions for th=
e leveling of the glass.=0A<br>+Greatly excited by these discoveries, I hur=
ried home, procured a=0A<br>+telescope, and returned to the rock.=0A<br>+=
=0A<br>+"I let myself down to the ledge, and found that it was impossible=
=0A<br>+to retain a seat upon it except in one particular position.  This=
=0A<br>+fact confirmed my preconceived idea.  I proceeded to use the glass.=
=0A<br>+Of course, the 'forty-one degrees and thirteen minutes' could=0A<br=
>+allude to nothing but elevation above the visible horizon, since=0A<br>+t=
he horizontal direction was clearly indicated by the words,=0A<br>+'northea=
st and by north.'  This latter direction I at once=0A<br>+established by me=
ans of a pocket compass; then, pointing the glass=0A<br>+as nearly at an an=
gle of forty-one degrees of elevation as I could=0A<br>+do it by guess, I m=
oved it cautiously up or down, until my=0A<br>+attention was arrested by a =
circular rift or opening in the foliage=0A<br>+of a large tree that overtop=
ped its fellows in the distance.  In=0A<br>+the center of this rift I perce=
ived a white spot, but could not, at=0A<br>+first, distinguish what it was.=
  Adjusting the focus of the=0A<br>+telescope, I again looked, and now made=
 it out to be a human skull.=0A<br>+=0A<br>+"Upon this discovery I was so s=
anguine as to consider the enigma=0A<br>+solved; for the phrase 'main branc=
h, seventh limb, east side,'=0A<br>+could refer only to the position of the=
 skull upon the tree, while=0A<br>+'shoot from the left eye of the death's =
head' admitted, also, of=0A<br>+but one interpretation, in regard to a sear=
ch for buried treasure.=0A<br>+I perceived that the design was to drop a bu=
llet from the left eye=0A<br>+of the skull, and that a bee-line, or, in oth=
er words, a straight=0A<br>+line, drawn from the nearest point of the trunk=
 'through the shot'=0A<br>+(or the spot where the bullet fell), and thence =
extended to a=0A<br>+distance of fifty feet, would indicate a definite poin=
t--and=0A<br>+beneath this point I thought it at least POSSIBLE that a depo=
sit of=0A<br>+value lay concealed."=0A<br>+=0A<br>+"All this," I said, "is =
exceedingly clear, and, although ingenious,=0A<br>+still simple and explici=
t.  When you left the Bishop's Hotel, what=0A<br>+then?"=0A<br>+=0A<br>+"Wh=
y, having carefully taken the bearings of the tree, I turned=0A<br>+homewar=
d.  The instant that I left 'the devil's seat,' however, the=0A<br>+circula=
r rift vanished; nor could I get a glimpse of it afterwards,=0A<br>+turn as=
 I would.  What seems to me the chief ingenuity in this=0A<br>+whole busine=
ss, is the fact (for repeated experiment has convinced=0A<br>+me it IS a fa=
ct) that the circular opening in question is visible=0A<br>+from no other a=
ttainable point of view than that afforded by the=0A<br>+narrow ledge upon =
the face of the rock.=0A<br>+=0A<br>+"In this expedition to the 'Bishop's H=
otel' I had been attended by=0A<br>+Jupiter, who had, no doubt, observed, f=
or some weeks past, the=0A<br>+abstraction of my demeanor, and took especia=
l care not to leave me=0A<br>+alone.  But, on the next day, getting up very=
 early, I contrived to=0A<br>+give him the slip, and went into the hills in=
 search of the tree.=0A<br>+After much toil I found it.  When I came home a=
t night my valet=0A<br>+proposed to give me a flogging.  With the rest of t=
he adventure I=0A<br>+believe you are as well acquainted as myself."=0A<br>=
+=0A<br>+"I suppose," said I, "you missed the spot, in the first attempt at=
=0A<br>+digging, through Jupiter's stupidity in letting the bug fall=0A<br>=
+through the right instead of through the left eye of the skull."=0A<br>+=
=0A<br>+"Precisely.  This mistake made a difference of about two inches and=
=0A<br>+a half in the 'shot'--that is to say, in the position of the peg=0A=
<br>+nearest the tree; and had the treasure been BENEATH the 'shot,' the=0A=
<br>+error would have been of little moment; but 'the shot,' together=0A<br=
>+with the nearest point of the tree, were merely two points for the=0A<br>=
+establishment of a line of direction; of course the error, however=0A<br>+=
trivial in the beginning, increased as we proceeded with the line,=0A<br>+a=
nd by the time we had gone fifty feet threw us quite off the=0A<br>+scent. =
 But for my deep-seated impressions that treasure was here=0A<br>+somewhere=
 actually buried, we might have had all our labor in=0A<br>+vain."=0A<br>+=
=0A<br>+"But your grandiloquence, and your conduct in swinging the beetle--=
=0A<br>+how excessively odd!  I was sure you were mad.  And why did you=0A<=
br>+insist upon letting fall the bug, instead of a bullet, from the=0A<br>+=
skull?"=0A<br>+=0A<br>+"Why, to be frank, I felt somewhat annoyed by your e=
vident=0A<br>+suspicions touching my sanity, and so resolved to punish you=
=0A<br>+quietly, in my own way, by a little bit of sober mystification.=0A<=
br>+For this reason I swung the beetle, and for this reason I let it=0A<br>=
+fall from the tree.  An observation of yours about its great weight=0A<br>=
+suggested the latter idea."=0A<br>+=0A<br>+"Yes, I perceive; and now there=
 is only one point which puzzles me.=0A<br>+What are we to make of the skel=
etons found in the hole?"=0A<br>+=0A<br>+"That is a question I am no more a=
ble to answer than yourself.=0A<br>+There seems, however, only one plausibl=
e way of accounting for=0A<br>+them--and yet it is dreadful to believe in s=
uch atrocity as my=0A<br>+suggestion would imply.  It is clear that Kidd--i=
f Kidd indeed=0A<br>+secreted this treasure, which I doubt not--it is clear=
 that he must=0A<br>+have had assistance in the labor.  But this labor conc=
luded, he may=0A<br>+have thought it expedient to remove all participants i=
n his secret.=0A<br>+Perhaps a couple of blows with a mattock were sufficie=
nt, while his=0A<br>+coadjutors were busy in the pit; perhaps it required a=
 dozen--who=0A<br>+shall tell?"=0A<br>diff --git a/guest_fs/test_nr b/guest=
_fs/test_nr=0A<br>new file mode 100644=0A<br>index 0000000..d7d17fc=0A<br>-=
-- /dev/null=0A<br>+++ b/guest_fs/test_nr=0A<br>@@ -0,0 +1 @@=0A<br>+-1=0A<=
br>\ No newline at end of file=0A<br>diff --git a/include/testsuite.h b/inc=
lude/testsuite.h=0A<br>new file mode 100644=0A<br>index 0000000..ba2eca0=0A=
<br>--- /dev/null=0A<br>+++ b/include/testsuite.h=0A<br>@@ -0,0 +1,59 @@=0A=
<br>+#ifndef APP_LIBNETTLETEST_TESTSUITE_H=0A<br>+#define APP_LIBNETTLETEST=
_TESTSUITE_H=0A<br>+void test_main_aes(void);=0A<br>+void test_main_arcfour=
(void);=0A<br>+void test_main_arctwo(void);	=0A<br>+void test_main_base16(v=
oid);=0A<br>+void test_main_base64(void);=0A<br>+void test_main_blowfish(vo=
id);=0A<br>+void test_main_buffer(void);=0A<br>+void test_main_camellia(voi=
d);	=0A<br>+void test_main_cast128(void);=0A<br>+void test_main_cbc(void);=
=0A<br>+void test_main_ccm(void);=0A<br>+void test_main_cfb(void);=0A<br>+v=
oid test_main_chacha_poly1305(void);=0A<br>+void test_main_chacha(void);=0A=
<br>+void test_main_cmac(void);=0A<br>+void test_main_ctr(void);=0A<br>+voi=
d test_main_des(void);=0A<br>+void test_main_des3(void);=0A<br>+void test_m=
ain_eax(void);=0A<br>+void test_main_gcm(void);=0A<br>+void test_main_gosth=
ash94(void);=0A<br>+void test_main_hkdf(void);=0A<br>+void test_main_hmac(v=
oid);=0A<br>+void test_main_knuth(void);=0A<br>+void test_main_md2(void);=
=0A<br>+void test_main_md4(void);=0A<br>+void test_main_md5_compat(void);=
=0A<br>+void test_main_md5(void);=0A<br>+void test_main_meta_aead(void);=0A=
<br>+void test_main_meta_armor(void);=0A<br>+void test_main_meta_ciphers(vo=
id);=0A<br>+void test_main_meta_hash(void);=0A<br>+void test_main_meta_mac(=
void);=0A<br>+void test_main_pbkdf2(void);=0A<br>+void test_main_poly1305(v=
oid);=0A<br>+void test_main_ripemd160(void);=0A<br>+void test_main_salsa20(=
void);=0A<br>+void test_main_serpent(void);=0A<br>+void test_main_sha1(void=
);=0A<br>+void test_main_sha1_huge(void);=0A<br>+void test_main_sha3_224(vo=
id);=0A<br>+void test_main_sha3_256(void);=0A<br>+void test_main_sha3_384(v=
oid);=0A<br>+void test_main_sha3_512(void);=0A<br>+void test_main_sha3_perm=
ute(void);=0A<br>+void test_main_sha224(void);=0A<br>+void test_main_sha256=
(void);=0A<br>+void test_main_sha384(void);=0A<br>+void test_main_sha512(vo=
id);=0A<br>+void test_main_sha512_224(void);=0A<br>+void test_main_sha512_2=
56(void);=0A<br>+void test_main_shake256(void);=0A<br>+void test_main_twofi=
sh(void);=0A<br>+void test_main_umac(void);=0A<br>+void test_main_xts(void)=
;=0A<br>+void test_main_yarrow(void);=0A<br>+#endif /* APP_LIBNETTLETEST_TE=
STSUITE_H */=0A<br>diff --git a/main.c b/main.c=0A<br>new file mode 100644=
=0A<br>index 0000000..e9935f3=0A<br>--- /dev/null=0A<br>+++ b/main.c=0A<br>=
@@ -0,0 +1,298 @@=0A<br>+#include "include/testsuite.h"=0A<br>+#include <st=
dio.h>=0A<br>+=0A<br>+int main()=0A<br>+{=0A<br>+	int tests_nr =3D -1, ret;=
=0A<br>+	FILE *infile;=0A<br>+=0A<br>+	infile =3D fopen("test_nr", "r");=0A=
<br>+	if (infile =3D=3D NULL)=0A<br>+	{=0A<br>+		printf("ERROR: test_nr cou=
ld not be opened!\n");=0A<br>+		exit(1);=0A<br>+	}=0A<br>+=0A<br>+	ret =3D =
fscanf(infile, "%d", &amp;tests_nr);=0A<br>+	if (ret =3D=3D 0)=0A<br>+	{=0A=
<br>+		printf("ERROR: file test_nr should not be empty!\n");=0A<br>+		exit(=
1);=0A<br>+	}=0A<br>+	=0A<br>+	fclose(infile);=0A<br>+=0A<br>+	if (tests_nr=
 =3D=3D -1)=0A<br>+	{=0A<br>+		printf("\nSelect test suite: [1..11]\n");=0A=
<br>+		printf("\t[0]\tALL\n");=0A<br>+		printf("\t[1]\tMETA AEAD, META ARMO=
R, META CIPHERS, META HASH, META MAC, AES, ARCTWO, ARCFOUR, BASE16, BASE64,=
 BLOWFISH,\n");=0A<br>+		printf("\t\tBUFFER, CAMELLIA, CAST128, CBC, CCM, C=
FM, CHACHA, POLY1305, CMAC, CTR, DES, DES3, EAX, GCM, GOSTHASH94\n");=0A<br=
>+		printf("\t[2]\tHKDF, HMAC, KNUTH, MD2, MD4, MD5\n");=0A<br>+		printf("\=
t[3]\tPBKDF2, RIPEMD160, SALSA20, SERPENT\n");=0A<br>+		printf("\t[4]\tSHA1=
 - WILL TAKE A LONG TIME\n");=0A<br>+		printf("\t[5]\tSHA3-224\n");=0A<br>+=
		printf("\t[6]\tSHA3-256\n");=0A<br>+		printf("\t[7]\tSHA3-384\n");=0A<br>=
+		printf("\t[8]\tSHA3-512\n");=0A<br>+		printf("\t[9]\tSHA3 PERMUTE\n");=
=0A<br>+		printf("\t[10]\tSHA224, SHA256, SHA384, SHA512, SHA512-224, SHA51=
2-256, SHAKE256, TWOFISH, UMAC\n");=0A<br>+		printf("\t[11]\tXTS, YARROW\n"=
);=0A<br>+=0A<br>+		sleep(20);=0A<br>+=0A<br>+		return 0;=0A<br>+	}=0A<br>+=
=0A<br>+	if (tests_nr =3D=3D 1 || tests_nr =3D=3D 0)=0A<br>+	{=0A<br>+		pri=
ntf("Testing META AEAD...\n");=0A<br>+		test_main_meta_aead();=0A<br>+		pri=
ntf("PASSED\n");=0A<br>+=0A<br>+		printf("Testing META ARMOR...\n");=0A<br>=
+		test_main_meta_armor();=0A<br>+		printf("PASSED\n");=0A<br>+=0A<br>+		pr=
intf("Testing META CIPHERS...\n");=0A<br>+		test_main_meta_ciphers();=0A<br=
>+		printf("PASSED\n");=0A<br>+=0A<br>+		printf("Testing META HASH...\n");=
=0A<br>+		test_main_meta_hash();=0A<br>+		printf("PASSED\n");=0A<br>+=0A<br=
>+		printf("Testing META MAC...\n");=0A<br>+		test_main_meta_mac();=0A<br>+=
		printf("PASSED\n");=0A<br>+=0A<br>+		printf("Testing AES...\n");=0A<br>+	=
	test_main_aes();=0A<br>+		printf("PASSED\n");=0A<br>+=0A<br>+		printf("Tes=
ting ARCTWO...\n");=0A<br>+		test_main_arctwo();=0A<br>+		printf("PASSED\n"=
);=0A<br>+=0A<br>+		printf("Testing ARCFOUR...\n");=0A<br>+		test_main_arcf=
our();=0A<br>+		printf("PASSED\n");=0A<br>+=0A<br>+		printf("Testing BASE16=
...\n");=0A<br>+		test_main_base16();=0A<br>+		printf("PASSED\n");=0A<br>+=
=0A<br>+		printf("Testing BASE64...\n");=0A<br>+		test_main_base64();=0A<br=
>+		printf("PASSED\n");=0A<br>+=0A<br>+		printf("Testing BLOWFISH...\n");=
=0A<br>+		test_main_blowfish();=0A<br>+		printf("PASSED\n");=0A<br>+=0A<br>=
+		printf("Testing BUFFER...\n");=0A<br>+		test_main_buffer();=0A<br>+		pri=
ntf("PASSED\n");=0A<br>+=0A<br>+		printf("Testing CAMELLIA...\n");=0A<br>+	=
	test_main_camellia();=0A<br>+		printf("PASSED\n");=0A<br>+=0A<br>+		printf=
("Testing CAST128...\n");=0A<br>+		test_main_cast128();=0A<br>+		printf("PA=
SSED\n");=0A<br>+=0A<br>+		printf("Testing CBC...\n");=0A<br>+		test_main_c=
bc();=0A<br>+		printf("PASSED\n");=0A<br>+=0A<br>+		printf("Testing CCM...\=
n");=0A<br>+		test_main_ccm();=0A<br>+		printf("PASSED\n");=0A<br>+=0A<br>+=
		printf("Testing CFB...\n");=0A<br>+		test_main_cfb();=0A<br>+		printf("PA=
SSED\n");=0A<br>+=0A<br>+		printf("Testing CHACHA...\n");=0A<br>+		test_mai=
n_chacha();=0A<br>+		printf("PASSED\n");=0A<br>+=0A<br>+		printf("Testing P=
OLY1305...\n");=0A<br>+		test_main_poly1305();=0A<br>+		printf("PASSED\n");=
=0A<br>+=0A<br>+		printf("Testing CHACHA-POLY1305...\n");=0A<br>+		test_mai=
n_chacha_poly1305();=0A<br>+		printf("PASSED\n");=0A<br>+=0A<br>+		printf("=
Testing CMAC...\n");=0A<br>+		test_main_cmac();=0A<br>+		printf("PASSED\n")=
;=0A<br>+=0A<br>+		printf("Testing CTR...\n");=0A<br>+		test_main_ctr();=0A=
<br>+		printf("PASSED\n");=0A<br>+=0A<br>+		printf("Testing DES...\n");=0A<=
br>+		test_main_des();=0A<br>+		printf("PASSED\n");=0A<br>+=0A<br>+		printf=
("Testing DES3...\n");=0A<br>+		test_main_des3();=0A<br>+		printf("PASSED\n=
");=0A<br>+=0A<br>+		printf("Testing EAX...\n");=0A<br>+		test_main_eax();=
=0A<br>+		printf("PASSED\n");=0A<br>+=0A<br>+		printf("Testing GCM...\n");=
=0A<br>+		test_main_gcm();=0A<br>+		printf("PASSED\n");=0A<br>+=0A<br>+		pr=
intf("Testing GOSTHASH94...\n");=0A<br>+		test_main_gosthash94();=0A<br>+		=
printf("PASSED\n");=0A<br>+	}=0A<br>+	if (tests_nr =3D=3D 2 || tests_nr =3D=
=3D 0)=0A<br>+	{=0A<br>+		printf("Testing HKDF...\n");=0A<br>+		test_main_h=
kdf();=0A<br>+		printf("PASSED\n");=0A<br>+=0A<br>+		printf("Testing HMAC..=
.\n");=0A<br>+		test_main_hmac();=0A<br>+		printf("PASSED\n");=0A<br>+=0A<b=
r>+		printf("Testing KNUTH...\n");=0A<br>+		test_main_knuth();=0A<br>+		pri=
ntf("PASSED\n");=0A<br>+=0A<br>+		printf("Testing MD2...\n");=0A<br>+		test=
_main_md2();=0A<br>+		printf("PASSED\n");=0A<br>+=0A<br>+		printf("Testing =
MD4...\n");=0A<br>+		test_main_md4();=0A<br>+		printf("PASSED\n");=0A<br>+=
=0A<br>+		printf("Testing MD5-COMPAT...\n");=0A<br>+		test_main_md5_compat(=
);=0A<br>+		printf("PASSED\n");=0A<br>+=0A<br>+		printf("Testing MD5...\n")=
;=0A<br>+		test_main_md5();=0A<br>+		printf("PASSED\n");=0A<br>+	}=0A<br>+	=
if (tests_nr =3D=3D 3 || tests_nr =3D=3D 0)=0A<br>+	{=0A<br>+		printf("Test=
ing PBKDF2...\n");=0A<br>+		test_main_pbkdf2();=0A<br>+		printf("PASSED\n")=
;=0A<br>+=0A<br>+		printf("Testing RIPEMD160...\n");=0A<br>+		test_main_rip=
emd160();=0A<br>+		printf("PASSED\n");=0A<br>+=0A<br>+		printf("Testing SAL=
SA20...\n");=0A<br>+		test_main_salsa20();=0A<br>+		printf("PASSED\n");=0A<=
br>+=0A<br>+		printf("Testing SERPENT...\n");=0A<br>+		test_main_serpent();=
=0A<br>+		printf("PASSED\n");=0A<br>+	}=0A<br>+	if (tests_nr =3D=3D 4 || te=
sts_nr =3D=3D 0)=0A<br>+	{=0A<br>+		printf("Testing SHA1...\n");=0A<br>+		t=
est_main_sha1();=0A<br>+		printf("PASSED\n");=0A<br>+=0A<br>+		printf("Test=
ing SHA1 HUGE...\n");=0A<br>+		test_main_sha1_huge();=0A<br>+		printf("PASS=
ED\n");=0A<br>+	}=0A<br>+	if (tests_nr =3D=3D 5 || tests_nr =3D=3D 0)=0A<br=
>+	{=0A<br>+		printf("Testing SHA3-224...\n");=0A<br>+		test_main_sha3_224(=
);=0A<br>+		printf("PASSED\n");=0A<br>+	}=0A<br>+	if (tests_nr =3D=3D 6 || =
tests_nr =3D=3D 0)=0A<br>+	{=0A<br>+		printf("Testing SHA3 256...\n");=0A<b=
r>+		test_main_sha3_256();=0A<br>+		printf("PASSED\n");=0A<br>+	}=0A<br>+	i=
f (tests_nr =3D=3D 7 || tests_nr =3D=3D 0)=0A<br>+	{=0A<br>+		printf("Testi=
ng SHA3-384...\n");=0A<br>+		test_main_sha3_384();=0A<br>+		printf("PASSED\=
n");=0A<br>+	}=0A<br>+	if (tests_nr =3D=3D 8 || tests_nr =3D=3D 0)=0A<br>+	=
{=0A<br>+		printf("Testing SHA3-512...\n");=0A<br>+		test_main_sha3_512();=
=0A<br>+		printf("PASSED\n");=0A<br>+	}=0A<br>+	if (tests_nr =3D=3D 9 || te=
sts_nr =3D=3D 0)=0A<br>+	{=0A<br>+		printf("Testing SHA3 PERMUTE...\n");=0A=
<br>+		test_main_sha3_permute();=0A<br>+		printf("PASSED\n");=0A<br>+	}=0A<=
br>+	if (tests_nr =3D=3D 10 || tests_nr =3D=3D 0)=0A<br>+	{=0A<br>+		printf=
("Testing SHA224...\n");=0A<br>+		test_main_sha224();=0A<br>+		printf("PASS=
ED\n");=0A<br>+=0A<br>+		printf("Testing SHA256...\n");=0A<br>+		test_main_=
sha256();=0A<br>+		printf("PASSED\n");=0A<br>+=0A<br>+		printf("Testing SHA=
384...\n");=0A<br>+		test_main_sha384();=0A<br>+		printf("PASSED\n");=0A<br=
>+=0A<br>+		printf("Testing SHA512...\n");=0A<br>+		test_main_sha512();=0A<=
br>+		printf("PASSED\n");=0A<br>+=0A<br>+		printf("Testing SHA512-224...\n"=
);=0A<br>+		test_main_sha512_224();=0A<br>+		printf("PASSED\n");=0A<br>+=0A=
<br>+		printf("Testing SHA512-256...\n");=0A<br>+		test_main_sha512_256();=
=0A<br>+		printf("PASSED\n");=0A<br>+=0A<br>+		printf("Testing SHAKE256...\=
n");=0A<br>+		test_main_shake256();=0A<br>+		printf("PASSED\n");=0A<br>+=0A=
<br>+		printf("Testing TWOFISH...\n");=0A<br>+		test_main_twofish();=0A<br>=
+		printf("PASSED\n");=0A<br>+=0A<br>+		printf("Testing UMAC...\n");=0A<br>=
+		test_main_umac();=0A<br>+		printf("PASSED\n");=0A<br>+	}=0A<br>+	if (tes=
ts_nr =3D=3D 11 || tests_nr =3D=3D 0)=0A<br>+	{=0A<br>+		printf("Testing XT=
S...\n");=0A<br>+		test_main_xts();=0A<br>+		printf("PASSED\n");=0A<br>+=0A=
<br>+		printf("Testing YARROW...\n");=0A<br>+		test_main_yarrow();=0A<br>+	=
	printf("PASSED\n");=0A<br>+	}=0A<br>+=0A<br>+	printf("All tests passed\n")=
;=0A<br>+	sleep(5);=0A<br>+=0A<br>+	return 0;=0A<br>+}=0A<br>-- =0A<br>2.25=
.1=0A<br>=0A<br>=0A<br></stdio.h></cristianvijelie@gmail.com></div></blockq=
uote>=0A                                        =0A                        =
                </div>
------=_NextPart_31515703.926552591639--


From minios-devel-bounces@lists.xenproject.org Thu Jan 28 20:24:47 2021
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Thu, 28 Jan 2021 20:24:47 +0000
Received: from list by lists.xenproject.org with outflank-mailman.77452.140269 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1l5DqO-0006Jd-TR; Thu, 28 Jan 2021 20:24:44 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 77452.140269; Thu, 28 Jan 2021 20:24: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 1l5DqO-0006JW-Qb; Thu, 28 Jan 2021 20:24:44 +0000
Received: by outflank-mailman (input) for mailman id 77452;
 Thu, 28 Jan 2021 20:24:42 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <SRS0=uSI8=G7=gmail.com=razvand@srs-us1.protection.inumbo.net>)
 id 1l5DqM-0006JN-Q5
 for minios-devel@lists.xen.org; Thu, 28 Jan 2021 20:24:42 +0000
Received: from mail-wr1-x431.google.com (unknown [2a00:1450:4864:20::431])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 2bb511cb-a988-4a0e-b055-828eaf7479ef;
 Thu, 28 Jan 2021 20:24:40 +0000 (UTC)
Received: by mail-wr1-x431.google.com with SMTP id s7so3725098wru.5
 for <minios-devel@lists.xen.org>; Thu, 28 Jan 2021 12:24:40 -0800 (PST)
Received: from localhost ([141.85.225.204])
 by smtp.gmail.com with ESMTPSA id j13sm6794185wmi.24.2021.01.28.12.24.37
 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256);
 Thu, 28 Jan 2021 12:24: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
X-Inumbo-ID: 2bb511cb-a988-4a0e-b055-828eaf7479ef
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=Q6wjSy8R24hyRgnNQNjbMznkyhF1/iT2UzLexJIqxUQ=;
        b=A5NX3RbHJobvU/+Esv5kiwZy4tSmMWQ5DkYkgvysYiJXeKCgRlg5dNLJ4m/zvKv5+U
         XTxqdrcmS7RhC9OY3079cEICzezhjtjF4NXIQtAukct8A7NxFTc742GSAnbJYIr3eCrD
         aezWPAaQ9xAAxhogNrDsmo+j5wJpUf8lPRG630tx3AlTDoY9+bR2IFF0jZ9DYbQycFeT
         fQBD9Ts110MhDghGRT23LZ3mGioQmtjw4J6y02aqLdQw8epy9fp+DT2+nzZWC18KBnXG
         z/ntS9NjWQAUB7ZgrLNTOhAtimcemGEgF3jnuUH06M5amtT2l9neYl3eigfOjdFtGUXD
         TbZw==
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=Q6wjSy8R24hyRgnNQNjbMznkyhF1/iT2UzLexJIqxUQ=;
        b=JxAMVSyAJpJ2z4gZVCwy38pi99o3SgIQoY5VPblN8X0VLOAPV0Lg6e5whXVvbxVKyr
         W6os6ZoDDBmzi/djcKE/FWf6iYfooyrVa4YAeYRWMisieQdgQSvO3yVORksc3qYvvZBw
         f+wc/wmH0qZkwLnsW/R3nhl4PDISJl75DSiGeFUHCSLnQ2WnAw2p/DpcsrRhVGbr8My6
         O4kTMiR9G1ephvUqdSqAmDOf1FPwItXsZlQLkYLo1GW9snDdNnjCLPHVvGN8/Sp7ObfB
         B2/+ye0EHBLZjWY/KjrZTYEDZyC050vlpk/pBiChpAhXz/RHLjICnyqAnKOqDM+bvR/R
         Gr+w==
X-Gm-Message-State: AOAM532j1f9bwLwaR5mI9WLbkmYpXNlsG+hxgEvnwMi8NtY0mOmtlG9U
	JM1xspnBfmQRsP3IcithCO0=
X-Google-Smtp-Source: ABdhPJzKRjwTvmUgHTkBfZWugXvrQKMQfT1dY8/boPFlK1SbnMNJDOnRCcVHIOdRuXkaXjxmazMCjQ==
X-Received: by 2002:a5d:452f:: with SMTP id j15mr910789wra.298.1611865479704;
        Thu, 28 Jan 2021 12:24:39 -0800 (PST)
Sender: Razvan Deaconescu <razvand@gmail.com>
From: Razvan Deaconescu <razvan.deaconescu@cs.pub.ro>
To: Vlad-Andrei Badoiu <vlad_andrei.badoiu@upb.ro>
Cc: minios-devel@lists.xen.org,  simon.kuenzer@neclab.eu,  Alice Suiu <alicesuiu17@gmail.com>
Subject: Re: [UNIKRAFT PATCH v3 3/3] build: Add support for clang
References: <20201227004506.16035-1-vlad_andrei.badoiu@upb.ro>
	<20201227004506.16035-4-vlad_andrei.badoiu@upb.ro>
Date: Thu, 28 Jan 2021 22:24:37 +0200
In-Reply-To: <20201227004506.16035-4-vlad_andrei.badoiu@upb.ro> (Vlad-Andrei
	Badoiu's message of "Sun, 27 Dec 2020 02:45:06 +0200")
Message-ID: <86zh0srere.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

Hi, Vlad.

A small thing below. Then we can upstream this.

Razvan

Vlad-Andrei Badoiu <vlad_andrei.badoiu@upb.ro> writes:
> 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 bootstrapping! (e.g., ukboot))
>  endif
>  
>  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 optimisation)
>  endif
>  endif
> +endif
>  
>  # Generate build rules
>  $(eval $(call verbose_include,$(CONFIG_UK_BASE)/support/build/Makefile.build))
> diff --git a/Makefile.uk b/Makefile.uk
> index e505c04..a012967 100644
> --- a/Makefile.uk
> +++ b/Makefile.uk
> @@ -4,9 +4,11 @@
>  #
>  ################################################################################
>  
> -COMPFLAGS    += -nostdinc -nostdlib
> +COMPFLAGS    += -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 -nostdinc
> +
>  ifneq ($(HAVE_STACKPROTECTOR),y)
>  COMPFLAGS    += -fno-stack-protector
>  endif
> @@ -19,12 +21,14 @@ 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 -no-pie
> +LIBLDFLAGS  += -nostdlib -Wl,-r -Wl,-d -Wl,--build-id=none -no-pie
> +LIBLDFLAGS-$(call have_gcc)	+= -nostdinc
>  
>  # 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     += -nostdinc -nostdlib -Wl,--omagic -Wl,--build-id=none
> +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
>  COMPFLAGS-$(CONFIG_OPTIMIZE_SIZE)         += -Os
> @@ -56,3 +60,6 @@ M4FLAGS      += -DUK_VERSION=$(UK_VERSION).$(UK_SUBVERSION)
>  # "--enable-default-pie" by default.
>  COMPFLAGS-$(call gcc_version_ge,6,1)	+= -fno-PIC
>  LDFLAGS-$(call gcc_version_ge,6,1)	+= -no-pie
> +
> +COMPFLAGS-$(call have_clang)	+=-fno-builtin -fno-PIC
> +LDFLAGS-$(call have_clang)	+= -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     += -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  

You have extra trailing spaces above (at the end of -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

Razvan


From minios-devel-bounces@lists.xenproject.org Thu Jan 28 20:27:18 2021
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Thu, 28 Jan 2021 20:27:18 +0000
Received: from list by lists.xenproject.org with outflank-mailman.77456.140285 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1l5Dsr-0006S5-HI; Thu, 28 Jan 2021 20:27:17 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 77456.140285; Thu, 28 Jan 2021 20:27:17 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1l5Dsr-0006Ry-EI; Thu, 28 Jan 2021 20:27:17 +0000
Received: by outflank-mailman (input) for mailman id 77456;
 Thu, 28 Jan 2021 20:27: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=uSI8=G7=gmail.com=razvand@srs-us1.protection.inumbo.net>)
 id 1l5Dsq-0006Rq-3k
 for minios-devel@lists.xen.org; Thu, 28 Jan 2021 20:27:16 +0000
Received: from mail-wr1-x42d.google.com (unknown [2a00:1450:4864:20::42d])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id f161e415-55f5-416e-9c43-6521d0ec7c95;
 Thu, 28 Jan 2021 20:27:14 +0000 (UTC)
Received: by mail-wr1-x42d.google.com with SMTP id g10so6735424wrx.1
 for <minios-devel@lists.xen.org>; Thu, 28 Jan 2021 12:27:14 -0800 (PST)
Received: from localhost ([141.85.225.204])
 by smtp.gmail.com with ESMTPSA id 62sm7147507wmd.34.2021.01.28.12.27.13
 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256);
 Thu, 28 Jan 2021 12:27: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
X-Inumbo-ID: f161e415-55f5-416e-9c43-6521d0ec7c95
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=b5UgPZDMEu+cjlaAevH9UFsHFWsALqLk2y2J0tLFEVo=;
        b=jweSEp/IF/i3FVFhpTduUG0Yy+N3nzPN/Es0MMKMZ2hMdQjYwKTlTk0Yt1S5HeHpVt
         tZGNf3TPtp4cOdnXlHBMU310vmFFjrZfEqOcxSZQ+lXdy4TpFDF5KOeCaoy5lUABcEQI
         tBtnBj7MM4Q226W42CEkf3WGTbqLvONFYIvIIcKghkwPsjNuVFJM3DyQZhUCBmZDLCqL
         IRib6BBZAeboa8P2d3CxC+jBAbZKiicJf01KNvfm79WZmOtEbTlC/+UbDhxdPB80VehE
         WmQ3NV1Oks4ssXrd23fAscdgZMRdfm81Fy4IpjDVLn3F3wvVIKT0P7GjYANdhdnKMcS0
         jHMA==
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=b5UgPZDMEu+cjlaAevH9UFsHFWsALqLk2y2J0tLFEVo=;
        b=FT/CwihrRPAIQQKDai1yMSCHpICndbDWDFndGz9wp8xw1pFXkTBX0VySsw6zikbHYC
         HaBCYNTuSRL0ElyIDbiyqcfLXcoJIF/0wVdQxmDApamVdmUpXCsPj7X5R833Az8tihgE
         OPjQachvQnj3AwsLJt4oGRiba2TdJ3suJ2dyJwh8j27mZ0KHEBIbMi7sKdjmBs6ICVIl
         b95ct4EAAplSdArVUz5CDeGbFhjdmjEVRbNPbzPVAYyr28gfS5DyItS30pkwjvRrzI8b
         hHRLXibQ8S+byePpNeXV+J+yL7ISSp3isMR9jvCtPp1OHbzuNUxx1OO8r30KZGZ06t0f
         hu5g==
X-Gm-Message-State: AOAM530Km4RCtJJwmwUq4ImdZ6NERNkI9E/3mvYOt5GX8+WrGWHoLlco
	2G3FiqHbe5ldunTDTFIaMNw=
X-Google-Smtp-Source: ABdhPJyKjr3Z5rpN9hyFehT25mSc4Cids3SwFNSAtbn6D/3LyUvFgdkCjDqw2qzn6jyqh+Ud4pen/Q==
X-Received: by 2002:a05:6000:1a8c:: with SMTP id f12mr847498wry.173.1611865633787;
        Thu, 28 Jan 2021 12:27:13 -0800 (PST)
Sender: Razvan Deaconescu <razvand@gmail.com>
From: Razvan Deaconescu <razvan.deaconescu@cs.pub.ro>
To: Vlad-Andrei Badoiu <vlad_andrei.badoiu@upb.ro>
Cc: minios-devel@lists.xen.org,  simon.kuenzer@neclab.eu,  Alice Suiu <alicesuiu17@gmail.com>
Subject: Re: [UNIKRAFT PATCH v3 3/3] build: Add support for clang
References: <20201227004506.16035-1-vlad_andrei.badoiu@upb.ro>
	<20201227004506.16035-4-vlad_andrei.badoiu@upb.ro>
Date: Thu, 28 Jan 2021 22:27:12 +0200
In-Reply-To: <20201227004506.16035-4-vlad_andrei.badoiu@upb.ro> (Vlad-Andrei
	Badoiu's message of "Sun, 27 Dec 2020 02:45:06 +0200")
Message-ID: <86v9bgren3.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

Oops, forgot something else. See below.

Razvan

Vlad-Andrei Badoiu <vlad_andrei.badoiu@upb.ro> writes:
> 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 bootstrapping! (e.g., ukboot))
>  endif
>  
>  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 optimisation)
>  endif
>  endif
> +endif
>  
>  # Generate build rules
>  $(eval $(call verbose_include,$(CONFIG_UK_BASE)/support/build/Makefile.build))
> diff --git a/Makefile.uk b/Makefile.uk
> index e505c04..a012967 100644
> --- a/Makefile.uk
> +++ b/Makefile.uk
> @@ -4,9 +4,11 @@
>  #
>  ################################################################################
>  
> -COMPFLAGS    += -nostdinc -nostdlib
> +COMPFLAGS    += -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 -nostdinc
> +
>  ifneq ($(HAVE_STACKPROTECTOR),y)
>  COMPFLAGS    += -fno-stack-protector
>  endif
> @@ -19,12 +21,14 @@ 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 -no-pie
> +LIBLDFLAGS  += -nostdlib -Wl,-r -Wl,-d -Wl,--build-id=none -no-pie
> +LIBLDFLAGS-$(call have_gcc)	+= -nostdinc
>  
>  # 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     += -nostdinc -nostdlib -Wl,--omagic -Wl,--build-id=none
> +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
>  COMPFLAGS-$(CONFIG_OPTIMIZE_SIZE)         += -Os
> @@ -56,3 +60,6 @@ M4FLAGS      += -DUK_VERSION=$(UK_VERSION).$(UK_SUBVERSION)
>  # "--enable-default-pie" by default.
>  COMPFLAGS-$(call gcc_version_ge,6,1)	+= -fno-PIC
>  LDFLAGS-$(call gcc_version_ge,6,1)	+= -no-pie
> +
> +COMPFLAGS-$(call have_clang)	+=-fno-builtin -fno-PIC

Add space before -fno-builtin, for consistency.

> +LDFLAGS-$(call have_clang)	+= -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     += -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 Thu Jan 28 20:27:51 2021
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Thu, 28 Jan 2021 20:27:51 +0000
Received: from list by lists.xenproject.org with outflank-mailman.77457.140289 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1l5DtP-0006UI-Jl; Thu, 28 Jan 2021 20:27:51 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 77457.140289; Thu, 28 Jan 2021 20:27: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 1l5DtP-0006UB-H1; Thu, 28 Jan 2021 20:27:51 +0000
Received: by outflank-mailman (input) for mailman id 77457;
 Thu, 28 Jan 2021 20:27: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=uSI8=G7=gmail.com=razvand@srs-us1.protection.inumbo.net>)
 id 1l5DtO-0006U6-Mb
 for minios-devel@lists.xen.org; Thu, 28 Jan 2021 20:27:50 +0000
Received: from mail-wr1-x432.google.com (unknown [2a00:1450:4864:20::432])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id ce559613-1de1-413a-9964-87dcf294afe7;
 Thu, 28 Jan 2021 20:27:49 +0000 (UTC)
Received: by mail-wr1-x432.google.com with SMTP id s7so3732197wru.5
 for <minios-devel@lists.xen.org>; Thu, 28 Jan 2021 12:27:49 -0800 (PST)
Received: from localhost ([141.85.225.204])
 by smtp.gmail.com with ESMTPSA id u10sm6694448wmj.40.2021.01.28.12.27.47
 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256);
 Thu, 28 Jan 2021 12:27:47 -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: ce559613-1de1-413a-9964-87dcf294afe7
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=tN0vRo52HqHcXICZ9IAYC1MdfVlksXWsS20BmEeJn7c=;
        b=d+JcwJPa3cls8Q9099Na3xN+OpQ8lnNmlnzEe1zFAsWhiW5/cL5C5Mvn437vIND8kc
         kazsOUXb85jpTphnb6YMhmmrV9O13VXe8bwZ4PAI/NXmGPKsgamPNgyYS9iXbabgMn5C
         ZiDzENzC5xp2aE7uChsBsGDgMCYKkHI2Eig4g4H8PzjZoUYKc3fzOoKtrGrLwLd9nbBW
         QsmJxL1G3m1UqY2Y8ekVD1f/P2GPTe5F6SPvXfBg1KqpKXYXtCg8c7/+rTd+pT4U27ZG
         uitwcYWhIn6qkMtLG1cvveezZOX69YOeJERdkTrbiRokwrP4YkVVFVYZl1H4brDw1fAM
         pgpw==
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=tN0vRo52HqHcXICZ9IAYC1MdfVlksXWsS20BmEeJn7c=;
        b=QvBnZCvsMjh7ZPHnpcZhsgxJqoWGx1pNcN+/+U6gJwzhZ34GRO7sb9E97WF9lCSuMv
         TiZvC69teT50YVnCXPIS67c4++IxqzKhy2QJtAjbDWNTLjllM03xEiW+kLC7d3b1hnA7
         FYVh+3XJTStCrJN0NM0TH/pMY8/Y2yNlbx+SPcwhtyPXPgF/4W1qVEfHjNPXjQp+UMv0
         rLYj8VWtWfN7rfxj5np0dThgWwIJ5RCtn+4d6u98fJw586iZzzZqJ4NOR7LHBuQRQFpm
         4ZwmfLvB2BHam0dIuzLnTSXCMxVOHDm+KkGFPLgESzuYX15XMxi+u0eKcyVIsCC8fdYT
         16Tw==
X-Gm-Message-State: AOAM531mS3b9xJ2U/y+2wwIPBQZi/v1Jdjq5DxcsOyoc+IrC0U+qjBU/
	Yr73QzWa7InnlVoeVSMtvtI=
X-Google-Smtp-Source: ABdhPJxLt7pYbw+/hrJ64ff/JrTQZlnAPzlNv2bVdat4Xb6rh6uDN6egue3EHG5vYG4CQcJGO+O0+g==
X-Received: by 2002:a5d:6206:: with SMTP id y6mr836375wru.413.1611865668217;
        Thu, 28 Jan 2021 12:27:48 -0800 (PST)
Sender: Razvan Deaconescu <razvand@gmail.com>
From: Razvan Deaconescu <razvan.deaconescu@cs.pub.ro>
To: Vlad-Andrei Badoiu <vlad_andrei.badoiu@upb.ro>
Cc: minios-devel@lists.xen.org,  simon.kuenzer@neclab.eu,  Alice Suiu <alicesuiu17@gmail.com>
Subject: Re: [UNIKRAFT PATCH v3 1/3] build: Option to configure the compiler
References: <20201227004506.16035-1-vlad_andrei.badoiu@upb.ro>
	<20201227004506.16035-2-vlad_andrei.badoiu@upb.ro>
Date: Thu, 28 Jan 2021 22:27:47 +0200
In-Reply-To: <20201227004506.16035-2-vlad_andrei.badoiu@upb.ro> (Vlad-Andrei
	Badoiu's message of "Sun, 27 Dec 2020 02:45:04 +0200")
Message-ID: <86r1m4rem4.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

Awesome, Vlad.

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

Vlad-Andrei Badoiu <vlad_andrei.badoiu@upb.ro> writes:
> By default, the compiler is GCC. Use COMPILER to set the compiler. For
> example, COMPILER=clang.
>
> 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 := $(CROSS_COMPILE:"%"=%)
>  endif
>  
> +ifneq ("$(origin COMPILER)","undefined")
> +	CONFIG_COMPILER := $(COMPILER:"%"=%)
> +else
> +	CONFIG_COMPILER := gcc
> +endif
> +
> +
>  $(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


From minios-devel-bounces@lists.xenproject.org Thu Jan 28 20:28:13 2021
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Thu, 28 Jan 2021 20:28:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.77459.140294 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1l5Dtl-0006Vq-MQ; Thu, 28 Jan 2021 20:28:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 77459.140294; Thu, 28 Jan 2021 20:28: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 1l5Dtl-0006Vj-JN; Thu, 28 Jan 2021 20:28:13 +0000
Received: by outflank-mailman (input) for mailman id 77459;
 Thu, 28 Jan 2021 20:28: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=uSI8=G7=gmail.com=razvand@srs-us1.protection.inumbo.net>)
 id 1l5Dtk-0006Ve-N5
 for minios-devel@lists.xen.org; Thu, 28 Jan 2021 20:28:12 +0000
Received: from mail-wr1-x432.google.com (unknown [2a00:1450:4864:20::432])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 90eacfd2-d879-420d-bb78-59dc60e61c31;
 Thu, 28 Jan 2021 20:28:11 +0000 (UTC)
Received: by mail-wr1-x432.google.com with SMTP id g10so6737618wrx.1
 for <minios-devel@lists.xen.org>; Thu, 28 Jan 2021 12:28:11 -0800 (PST)
Received: from localhost ([141.85.225.204])
 by smtp.gmail.com with ESMTPSA id b3sm8019589wme.32.2021.01.28.12.28.09
 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256);
 Thu, 28 Jan 2021 12:28: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
X-Inumbo-ID: 90eacfd2-d879-420d-bb78-59dc60e61c31
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=ux9wysAIGHwJEVp1Gh3Oxgr5xH4ajcBM/wyeq239rFE=;
        b=CvGbeYEnyjGHYw3LrDCB3RKEYrCXAM5E450cmpHCY7OuJ66MFAyL40UjmcysIzamgF
         Bz40xm/NCJpVKgUJDXULOkcvouw5t1BFI/HBxue9e1U6t4ArpOR8WROfx/42CQApI/cu
         WGNqk3drc0y13thn/m9iMHKmq/UkeDRfV6sQzumF/XTHc/HvB9ZrBAct3YeIF9KksZm4
         3ml4QPEIsNziBldE5BgbDO0JFwxlqzxij91FLeviwLBZDx3uurnvsTxe8niOr6KMm7/A
         TTLrGYe0dFaTJAzLC7SU9O58MWudPn2RdpSSsN9+6EhV7gYEI9QBOfF++phVDhkoW97G
         Ljlg==
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=ux9wysAIGHwJEVp1Gh3Oxgr5xH4ajcBM/wyeq239rFE=;
        b=Mf157OnHWCcq9r4jfoA3jTYw+m5+fRURBU3HZ/YZc+X4TZXtWDyZVMslE7enmxWFUk
         IjdVpv4Y+i5+nHu589O/6FCMfobcB8bADxJ6pqSJ0H/vlR/uR6WwTNu9QPMQTj7Cem4X
         aCfiaWPPabeF4yApshrknIdXYHFuHnTO/8MBGt0t/zTGI/kCAbg4hJ0PeIu9TgiSGabz
         jKs30AMzfi6v4V5+C/WAkMrHIBhEac/QKHVx5RxXndo1TR+EG81W16jgbKMBkptW0Rzi
         fEE+IzTS17SYCFgdsXNBGaJGZvdlr5G5u0FN7SwwpYQNw0fJwU6ptBsuIumf/wxOqwck
         BtMg==
X-Gm-Message-State: AOAM532yRXyn1iUtz+vf7ZFt5BNZe/MEUI+TwjhMReHhlZ7+3G0wR9Iq
	Im6luw/p3sslwAkNSpqRTBI=
X-Google-Smtp-Source: ABdhPJxaSlvaYIqCosFqjg2/rvE6oPbqReYbjUVXBiyJpokn6RNXAvUVTgDv6koPpef1lVVaBy0ldg==
X-Received: by 2002:adf:fb91:: with SMTP id a17mr868079wrr.93.1611865690498;
        Thu, 28 Jan 2021 12:28:10 -0800 (PST)
Sender: Razvan Deaconescu <razvand@gmail.com>
From: Razvan Deaconescu <razvan.deaconescu@cs.pub.ro>
To: Vlad-Andrei Badoiu <vlad_andrei.badoiu@upb.ro>
Cc: minios-devel@lists.xen.org,  simon.kuenzer@neclab.eu,  Alice Suiu <alicesuiu17@gmail.com>
Subject: Re: [UNIKRAFT PATCH v3 2/3] support/build: Add build functions for clang and gcc check
References: <20201227004506.16035-1-vlad_andrei.badoiu@upb.ro>
	<20201227004506.16035-3-vlad_andrei.badoiu@upb.ro>
Date: Thu, 28 Jan 2021 22:28:09 +0200
In-Reply-To: <20201227004506.16035-3-vlad_andrei.badoiu@upb.ro> (Vlad-Andrei
	Badoiu's message of "Sun, 27 Dec 2020 02:45:05 +0200")
Message-ID: <86mtwsreli.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

All good.

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

Vlad-Andrei Badoiu <vlad_andrei.badoiu@upb.ro> writes:
> 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 = $(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)
> +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
>  
>  # print error and stop build when GCC version doesn't meet the minimum requirement


From minios-devel-bounces@lists.xenproject.org Thu Jan 28 20:34:05 2021
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Thu, 28 Jan 2021 20:34:05 +0000
Received: from list by lists.xenproject.org with outflank-mailman.77462.140298 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1l5DzO-0007RL-4l; Thu, 28 Jan 2021 20:34:02 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 77462.140298; Thu, 28 Jan 2021 20:34: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 1l5DzO-0007RE-1j; Thu, 28 Jan 2021 20:34:02 +0000
Received: by outflank-mailman (input) for mailman id 77462;
 Thu, 28 Jan 2021 20:34: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=uSI8=G7=gmail.com=razvand@srs-us1.protection.inumbo.net>)
 id 1l5DzM-0007R9-HS
 for minios-devel@lists.xen.org; Thu, 28 Jan 2021 20:34:00 +0000
Received: from mail-wm1-x329.google.com (unknown [2a00:1450:4864:20::329])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 5d7c8229-358a-4910-a914-223287c772da;
 Thu, 28 Jan 2021 20:33:59 +0000 (UTC)
Received: by mail-wm1-x329.google.com with SMTP id m1so2311407wml.2
 for <minios-devel@lists.xen.org>; Thu, 28 Jan 2021 12:33:59 -0800 (PST)
Received: from localhost ([141.85.225.204])
 by smtp.gmail.com with ESMTPSA id w129sm7317777wmb.11.2021.01.28.12.33.57
 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256);
 Thu, 28 Jan 2021 12:33: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
X-Inumbo-ID: 5d7c8229-358a-4910-a914-223287c772da
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=oyDwthWrR3ZM42QLpDvdRVvKZ3A4xIoio63cblpL/W0=;
        b=dCbFkj1M2Cg3yIdUk5LtwRCJ1oIWFZvZ7X5GyBT0ZqfMQ0SqyXbwtP8Jqr3SwTrOhJ
         Fnjiy1Uk5PtOYhtTgWe91ODFtFzUa+ktgt1VZCBeyoU6udYhb1+5V67cyEvt1LtGPUCq
         aVOid9xdfpi4auSMgkR9Gy3mDFh1+/DaYsT+YAsTuAckAXXOTqG6Kkr3OI3AYskF2B6N
         VttHo5hPT6PRFtRu4Z89U5q5PswXArSYpNY1fHgIoS0LjckVX4VoheTdAnYJV8ZZADJZ
         pFChty8L/NEFDHi1n/zFyYDXB8NlB07eXWzWSxv2v12KapBkg1TXKV2eDsd9P1Gglc+m
         3KKQ==
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=oyDwthWrR3ZM42QLpDvdRVvKZ3A4xIoio63cblpL/W0=;
        b=TvR8CG+uLsU2CEt2yiIGr3koMQNqSwY0FCFsNOCbEPwejZX7D7Of+DAG+0dQjyeBic
         atAd+oTGi7Gy7+DjAna8GhHOs+7V2M7ee93K0F4G5ArjR1M7gqUWpqLt3RmKqluO9suN
         VsP8HutxaVq+B6Jnl/u5RPUlXSaQrqwPOqpn1FKBuI0zpYtbmVjLvcZycGPQJYAknR0A
         Zv0kHbD8XtqYmfDd5RUEf/HpwbKGpXXm2TsMQAebwWfPAFk0hkLNy5hylEaidx+SQkM+
         0zXYU/nrY5IDaPoN7D5hZuTFMx1gmK4VosvU47p7pHww8jq2NLki4MqyW4g9lt33atSh
         BD9Q==
X-Gm-Message-State: AOAM532AQct7omTKYuSENVyUivm3+Nfj9kSwX80y6PGDuLeA/kpwBRk0
	n+r4H2pa5i57Vu5Z2+A3hhY=
X-Google-Smtp-Source: ABdhPJxcDFCQ0gZl2Aojb25mRJ3e8UTHuy2ISM83ih6EZ8139/nEf4JExhDL/HD1L0JBIKVNDM8tYw==
X-Received: by 2002:a1c:f001:: with SMTP id a1mr878869wmb.21.1611866038477;
        Thu, 28 Jan 2021 12:33:58 -0800 (PST)
Sender: Razvan Deaconescu <razvand@gmail.com>
From: Razvan Deaconescu <razvan.deaconescu@cs.pub.ro>
To: Vlad-Andrei Badoiu <vlad_andrei.badoiu@upb.ro>
Cc: minios-devel@lists.xen.org,  simon.kuenzer@neclab.eu
Subject: Re: [UNIKRAFT PATCH v3 0/3] Add clang support
References: <20201227004506.16035-1-vlad_andrei.badoiu@upb.ro>
Date: Thu, 28 Jan 2021 22:33:57 +0200
In-Reply-To: <20201227004506.16035-1-vlad_andrei.badoiu@upb.ro> (Vlad-Andrei
	Badoiu's message of "Sun, 27 Dec 2020 02:45:03 +0200")
Message-ID: <86im7grebu.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

Hi, Vlad.

This looks good.

There are some warnings that come up when compiling C++ programs due to
compilation flags for lib-compiler-rt:
---
warning: unknown warning option '-Wno-unused-but-set-variable'; did you mean '-Wno-unused-const-variable'? [-Wunknown-warning-option]
warning: unknown warning option '-Wno-maybe-uninitialized'; did you mean '-Wno-uninitialized'? [-Wunknown-warning-option]
---

But these should be handled as patches to lib-compiler-rt, so I added an
issue on GitHub[1].

[1] https://github.com/unikraft/lib-compiler-rt/issues/1

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

Vlad-Andrei Badoiu <vlad_andrei.badoiu@upb.ro> writes:
> 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(-)


From minios-devel-bounces@lists.xenproject.org Thu Jan 28 23:45:43 2021
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Thu, 28 Jan 2021 23:45:43 +0000
Received: from list by lists.xenproject.org with outflank-mailman.77516.140417 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1l5Gyr-0001Qf-Bj; Thu, 28 Jan 2021 23:45:41 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 77516.140417; Thu, 28 Jan 2021 23:45: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 1l5Gyr-0001QY-8o; Thu, 28 Jan 2021 23:45:41 +0000
Received: by outflank-mailman (input) for mailman id 77516;
 Thu, 28 Jan 2021 23:45: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=WIh7=G7=gmail.com=lizzababu@srs-us1.protection.inumbo.net>)
 id 1l5Gyq-0001QS-19
 for minios-devel@lists.xen.org; Thu, 28 Jan 2021 23:45:40 +0000
Received: from mail-yb1-xb2b.google.com (unknown [2607:f8b0:4864:20::b2b])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 8931b5b5-7fee-42e3-987b-ad4e905d0b82;
 Thu, 28 Jan 2021 23:45:39 +0000 (UTC)
Received: by mail-yb1-xb2b.google.com with SMTP id e67so7157237ybc.12
 for <minios-devel@lists.xen.org>; Thu, 28 Jan 2021 15:45: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: 8931b5b5-7fee-42e3-987b-ad4e905d0b82
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=QcSFICHg0yoI/bU0tWFIkbTC37txq59Hi6jKBR8W6ko=;
        b=Z8t8Pd88AsTE+lkZhqvf9na8+U5Lbc3NbHNQdEw0ezc4KvnNOYP++HSey8Q1RPQwLr
         2hOJGDUPx20JuVpwsiLxs0sdeeSUWWYOMnLxrUiQVb9SRM5KOuVzkW/wyfz//P3ApZ4t
         qiG0re41YCcvW+tuhe/E9NRcrspVHkYxLG/8Vfe+82nv85ngvs092LZFV20JTsfWj2qY
         VUUDd70Vx3/MwPsIvRxrvXZ8r+j8/ZkAjBaoeZ6m4bddMARY+B+1R62MKQ9EmQN5gceT
         S1Imi/j7mFS9WRsR3PcRg9cpY4UUdHqXeba7j0wcv6/4rYkIn8lGN4eaf0y8gtZEtVxW
         j9oA==
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=QcSFICHg0yoI/bU0tWFIkbTC37txq59Hi6jKBR8W6ko=;
        b=R0XpSnuWowu0AtpDeA6fJroGmXlPZeJC742/R2pXOX3+zugsoTuFTA+vMlz3mV2MCw
         V5FfhnJWo/JOwssuDu1a2A02kj4K8QUWNmP5HZAl3uqpGqvtS9OL/4Su+b7Y+6UmNfRN
         yYxjBTX2qKUQPbyubIXb8bU/sVfhDbFH7NvY+md7rjJ8lvteYzfdixSaim0kqAhcZ/z3
         fypJ/hryiYsIPGYvdnnJDHc4baR1LOWHD13LpMCLf4SYpzhYn3XPdv1SH+XhupIG9dCT
         BOx2CmhcEmDGyCYo7SChd5FOQnVNhGhGeGy/kDbbx+mO0nvKH9az0DSr83ke4ZCAnSBi
         WhPQ==
X-Gm-Message-State: AOAM533o8Qs0qJlrEcOWGE0C723QCd3g6JRUh+ut8Kt96/bAIKUIfkIf
	asN7eXbkzHKuHQoD0CqAaIzNXkn+RzngClVkcojpzE0PwhYiWA==
X-Google-Smtp-Source: ABdhPJy6R3vXv3X8LyGVQSvyIo1Sby7gvaA2vvzTShOaxg3Y6eB02Jx4zKmFDBxG5seqg+XuwBLCi0DQNytMajUcHUs=
X-Received: by 2002:a25:f8a:: with SMTP id 132mr3200921ybp.228.1611877538667;
 Thu, 28 Jan 2021 15:45:38 -0800 (PST)
MIME-Version: 1.0
References: <20201221154733.8350-1-simon.kuenzer@neclab.eu>
In-Reply-To: <20201221154733.8350-1-simon.kuenzer@neclab.eu>
From: Liza Babu <lizzababu@gmail.com>
Date: Fri, 29 Jan 2021 01:45:28 +0200
Message-ID: <CAEGg8OvtLJwpFQHYUoiGxsJa2-jPhT3H_aYHxBN192YmTBx+Zg@mail.gmail.com>
Subject: Re: [UNIKRAFT PATCH] lib/vfscore: Implement `getcwd` with a raw
 system call
To: Simon Kuenzer <simon.kuenzer@neclab.eu>
Cc: minios-devel@lists.xen.org
Content-Type: text/plain; charset="UTF-8"

Hi, Simon.

Looks good to me.

Liza Babu

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

On Mon, Dec 21, 2020 at 5:48 PM Simon Kuenzer <simon.kuenzer@neclab.eu> wrote:
>
> 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 Fri Jan 29 09:15:28 2021
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Fri, 29 Jan 2021 09:15:28 +0000
Received: from list by lists.xenproject.org with outflank-mailman.77817.141208 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1l5PsD-0004vh-Hk; Fri, 29 Jan 2021 09:15:25 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 77817.141208; Fri, 29 Jan 2021 09:15: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 1l5PsD-0004vX-Dr; Fri, 29 Jan 2021 09:15:25 +0000
Received: by outflank-mailman (input) for mailman id 77817;
 Fri, 29 Jan 2021 09:15: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=4uNe=HA=neclab.eu=sharan.santhanam@srs-us1.protection.inumbo.net>)
 id 1l5PsB-0004v3-DS
 for minios-devel@lists.xenproject.org; Fri, 29 Jan 2021 09:15:23 +0000
Received: from mailer2.neclab.eu (unknown [195.37.70.41])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 4e7ea454-6637-441e-85b6-769f413e1ba8;
 Fri, 29 Jan 2021 09:15:18 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
 by mailer2.neclab.eu (Postfix) with ESMTP id 83520F2338;
 Fri, 29 Jan 2021 10:15: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 MLIwpID8VJ69; Fri, 29 Jan 2021 10:15: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 34DB4F22D1;
 Fri, 29 Jan 2021 10:15:11 +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.2106.2; Fri, 29 Jan
 2021 10:15: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: 4e7ea454-6637-441e-85b6-769f413e1ba8
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/NEWLIB PATCH 1/1] Import missing headers from musl
To: Gaulthier Gain <Gaulthier.Gain@uliege.be>, Vlad-Andrei Badoiu
	<vlad_andrei.badoiu@upb.ro>
CC: <minios-devel@lists.xenproject.org>
References: <20201227231246.200810-1-vlad_andrei.badoiu@upb.ro>
 <293E097C-94D2-4DDF-909B-CFDAB6AEE199@uliege.be>
From: Sharan Santhanam <sharan.santhanam@neclab.eu>
Message-ID: <0b4f615f-628a-5bd0-2ed7-475bcf5e7490@neclab.eu>
Date: Fri, 29 Jan 2021 14:45:05 +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: <293E097C-94D2-4DDF-909B-CFDAB6AEE199@uliege.be>
Content-Type: text/plain; charset="windows-1252"; format=flowed
Content-Transfer-Encoding: 8bit
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,

Please find the comment inline

Thanks & Regards

Sharan

On 1/28/21 2:24 AM, Gaulthier Gain wrote:
> Hi Vlad,
>
> Thanks for this patch.
>
> Reviewed-by: Gaulthier Gain <gaulthier.gain@uliege.be 
> <mailto:gaulthier.gain@uliege.be>>
>
>> On 28 Dec 2020, at 00:12, Vlad-Andrei Badoiu 
>> <vlad_andrei.badoiu@upb.ro <mailto:vlad_andrei.badoiu@upb.ro>> wrote:
>>
>> 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 
>> <mailto: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/mqueue.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 
>> *__restrict, const struct timespec *__restrict);
>> +int mq_timedsend(mqd_t, const char *, size_t, unsigned, const struct 
>> timespec *);
>> +int mq_unlink(const char *);
>> +
>> +#ifdef __cplusplus
>> +}
>> +#endif
>> +#endif
>> diff --git a/musl-imported/include/obstack.h 
>> b/musl-imported/include/obstack.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/>.  */
>> +

We are using LGPL license here. Do we have the BSD equivalence for this 
header file?


>> +/* 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 
>> strings
>> +   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 
>> know
>> +   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 
>> symbol
>> +   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 already,
>> +   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 == 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__ >= 2096
>> +#  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_chunk */
>> +  char *object_base;            /* address of object we are building */
>> +  char *next_free;              /* where to add next char to current 
>> object */
>> +  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 
>> funcs */
>> +  unsigned use_extra_arg : 1;     /* chunk alloc/dealloc funcs take 
>> extra arg */
>> +  unsigned maybe_empty_object : 1; /* There is a possibility that 
>> the current
>> +                                      chunk contains a zero-length 
>> object.  This
>> +                                      prevents freeing the chunk if 
>> we allocate
>> +                                      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 
>> *__restrict 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 
>> next.
>> +   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 = (void *(*) (void *, size_t)) 
>> (newchunkfun)))
>> +
>> +#define obstack_freefun(h, newfreefun)     \
>> +  ((void) ((h)->freefun.extra = (void *(*) (void *, void *)) 
>> (newfreefun)))
>> +
>> +#define obstack_1grow_fast(h, achar) ((void) (*((h)->next_free)++ = 
>> (achar)))
>> +
>> +#define obstack_blank_fast(h, n) ((void) ((h)->next_free += (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 = (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 = (OBSTACK);     \
>> +       (_OBSTACK_SIZE_T) (__o1->chunk_limit - __o1->next_free); })
>> +
>> +# define obstack_make_room(OBSTACK, length)     \
>> +  __extension__     \
>> +    ({ struct obstack *__o = (OBSTACK);     \
>> +       _OBSTACK_SIZE_T __len = (length);     \
>> +       if (obstack_room (__o) < __len)     \
>> +         _obstack_newchunk (__o, __len);     \
>> +       (void) 0; })
>> +
>> +# define obstack_empty_p(OBSTACK)     \
>> +  __extension__     \
>> +    ({ struct obstack const *__o = (OBSTACK);     \
>> +       (__o->chunk->prev == 0     \
>> +        && __o->next_free == __PTR_ALIGN ((char *) __o->chunk,     \
>> +                                          __o->chunk->contents,     \
>> +                                          __o->alignment_mask)); })
>> +
>> +# define obstack_grow(OBSTACK, where, length)     \
>> +  __extension__     \
>> +    ({ struct obstack *__o = (OBSTACK);     \
>> +       _OBSTACK_SIZE_T __len = (length);     \
>> +       if (obstack_room (__o) < __len)     \
>> +         _obstack_newchunk (__o, __len);     \
>> +       memcpy (__o->next_free, where, __len);     \
>> +       __o->next_free += __len;     \
>> +       (void) 0; })
>> +
>> +# define obstack_grow0(OBSTACK, where, length)     \
>> +  __extension__     \
>> +    ({ struct obstack *__o = (OBSTACK);     \
>> +       _OBSTACK_SIZE_T __len = (length);     \
>> +       if (obstack_room (__o) < __len + 1)     \
>> +         _obstack_newchunk (__o, __len + 1);     \
>> +       memcpy (__o->next_free, where, __len);     \
>> +       __o->next_free += __len;     \
>> +       *(__o->next_free)++ = 0;     \
>> +       (void) 0; })
>> +
>> +# define obstack_1grow(OBSTACK, datum)     \
>> +  __extension__     \
>> +    ({ struct obstack *__o = (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 = (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 = (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 = (OBSTACK);     \
>> +       void *__p1 = __o1->next_free;     \
>> +       *(const void **) __p1 = (aptr);     \
>> +       __o1->next_free += sizeof (const void *);     \
>> +       (void) 0; })
>> +
>> +# define obstack_int_grow_fast(OBSTACK, aint)     \
>> +  __extension__     \
>> +    ({ struct obstack *__o1 = (OBSTACK);     \
>> +       void *__p1 = __o1->next_free;     \
>> +       *(int *) __p1 = (aint);     \
>> +       __o1->next_free += sizeof (int);     \
>> +       (void) 0; })
>> +
>> +# define obstack_blank(OBSTACK, length)     \
>> +  __extension__     \
>> +    ({ struct obstack *__o = (OBSTACK);     \
>> +       _OBSTACK_SIZE_T __len = (length);     \
>> +       if (obstack_room (__o) < __len)     \
>> +         _obstack_newchunk (__o, __len);     \
>> +       obstack_blank_fast (__o, __len); })
>> +
>> +# define obstack_alloc(OBSTACK, length)     \
>> +  __extension__     \
>> +    ({ struct obstack *__h = (OBSTACK);     \
>> +       obstack_blank (__h, (length));     \
>> +       obstack_finish (__h); })
>> +
>> +# define obstack_copy(OBSTACK, where, length)     \
>> +  __extension__     \
>> +    ({ struct obstack *__h = (OBSTACK);     \
>> +       obstack_grow (__h, (where), (length));     \
>> +       obstack_finish (__h); })
>> +
>> +# define obstack_copy0(OBSTACK, where, length)     \
>> +  __extension__     \
>> +    ({ struct obstack *__h = (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_free.  */
>> +# define obstack_finish(OBSTACK)     \
>> +  __extension__     \
>> +    ({ struct obstack *__o1 = (OBSTACK);     \
>> +       void *__value = (void *) __o1->object_base;     \
>> +       if (__o1->next_free == __value)     \
>> +         __o1->maybe_empty_object = 1;     \
>> +       __o1->next_free     \
>> +         = __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 = __o1->chunk_limit;     \
>> +       __o1->object_base = __o1->next_free;     \
>> +       __value; })
>> +
>> +# define obstack_free(OBSTACK, OBJ)     \
>> +  __extension__     \
>> +    ({ struct obstack *__o = (OBSTACK);     \
>> +       void *__obj = (void *) (OBJ);     \
>> +       if (__obj > (void *) __o->chunk && __obj < (void *) 
>> __o->chunk_limit)  \
>> +         __o->next_free = __o->object_base = (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 == 0     \
>> +   && (h)->next_free == __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 = (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 = (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 += (h)->temp.i,     \
>> +   (void) 0)
>> +
>> +# define obstack_grow0(h, where, length)     \
>> +  ((h)->temp.i = (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 += (h)->temp.i,     \
>> +   *((h)->next_free)++ = 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 += sizeof (void *)))[-1] = 
>> (aptr),     \
>> +   (void) 0)
>> +
>> +# define obstack_int_grow_fast(h, aint)     \
>> +  (((int *) ((h)->next_free += sizeof (int)))[-1] = (aint),     \
>> +   (void) 0)
>> +
>> +# define obstack_blank(h, length)     \
>> +  ((h)->temp.i = (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 == (h)->object_base     \
>> +    ? (((h)->maybe_empty_object = 1), 0)     \
>> +    : 0),     \
>> +   (h)->temp.p = (h)->object_base,     \
>> +   (h)->next_free     \
>> +     = __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 = (h)->chunk_limit) : 0),     \
>> +   (h)->object_base = (h)->next_free,     \
>> +   (h)->temp.p)
>> +
>> +# define obstack_free(h, obj)     \
>> +  ((h)->temp.p = (void *) (obj),     \
>> +   (((h)->temp.p > (void *) (h)->chunk     \
>> +     && (h)->temp.p < (void *) (h)->chunk_limit)     \
>> +    ? (void) ((h)->next_free = (h)->object_base = (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/scsi/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 MTFSF1
>> +#define MTBSF2
>> +#define MTFSR3
>> +#define MTBSR4
>> +#define MTWEOF5
>> +#define MTREW6
>> +#define MTOFFL7
>> +#define MTNOP8
>> +#define MTRETEN 9
>> +#define MTBSFM10
>> +#define MTFSFM  11
>> +#define MTEOM12
>> +#define MTERASE 13
>> +#define MTRAS1  14
>> +#define MTRAS215
>> +#define MTRAS3  16
>> +#define MTSETBLK 20
>> +#define MTSETDENSITY 21
>> +#define MTSEEK22
>> +#define MTTELL23
>> +#define MTSETDRVBUFFER 24
>> +#define MTFSS25
>> +#define MTBSS26
>> +#define MTWSM27
>> +#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_ISUNKNOWN0x01
>> +#define MT_ISQIC020x02
>> +#define MT_ISWT51500x03
>> +#define MT_ISARCHIVE_5945L20x04
>> +#define MT_ISCMSJ5000x05
>> +#define MT_ISTDC36100x06
>> +#define MT_ISARCHIVE_VP60I0x07
>> +#define MT_ISARCHIVE_2150L0x08
>> +#define MT_ISARCHIVE_2060L0x09
>> +#define MT_ISARCHIVESC4990x0A
>> +#define MT_ISQIC02_ALL_FEATURES0x0F
>> +#define MT_ISWT5099EEN240x11
>> +#define MT_ISTEAC_MT2ST0x12
>> +#define MT_ISEVEREX_FT40A0x32
>> +#define MT_ISDDS10x51
>> +#define MT_ISDDS20x52
>> +#define MT_ISSCSI10x71
>> +#define MT_ISSCSI20x72
>> +#define MT_ISFTAPE_UNKNOWN0x800000
>> +#define MT_ISFTAPE_FLAG0x800000
>> +
>> +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];
>> +};
>> +
>> +#defineMTIOCTOP _IOW('m', 1, struct mtop)
>> +#defineMTIOCGET _IOR('m', 2, struct mtget)
>> +#defineMTIOCPOS _IOR('m', 3, struct mtpos)
>> +
>> +#defineMTIOCGETCONFIG_IOR('m', 4, struct mtconfiginfo)
>> +#defineMTIOCSETCONFIG_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_SHIFT0
>> +#define MT_ST_BLKSIZE_MASK0xffffff
>> +#define MT_ST_DENSITY_SHIFT24
>> +#define MT_ST_DENSITY_MASK0xff000000
>> +#define MT_ST_SOFTERR_SHIFT0
>> +#define MT_ST_SOFTERR_MASK0xffff
>> +#define MT_ST_OPTIONS0xf0000000
>> +#define MT_ST_BOOLEANS0x10000000
>> +#define MT_ST_SETBOOLEANS0x30000000
>> +#define MT_ST_CLEARBOOLEANS0x40000000
>> +#define MT_ST_WRITE_THRESHOLD0x20000000
>> +#define MT_ST_DEF_BLKSIZE0x50000000
>> +#define MT_ST_DEF_OPTIONS0x60000000
>> +#define MT_ST_BUFFER_WRITES0x1
>> +#define MT_ST_ASYNC_WRITES0x2
>> +#define MT_ST_READ_AHEAD0x4
>> +#define MT_ST_DEBUGGING0x8
>> +#define MT_ST_TWO_FM0x10
>> +#define MT_ST_FAST_MTEOM0x20
>> +#define MT_ST_AUTO_LOCK0x40
>> +#define MT_ST_DEF_WRITES0x80
>> +#define MT_ST_CAN_BSR0x100
>> +#define MT_ST_NO_BLKLIMS0x200
>> +#define MT_ST_CAN_PARTITIONS    0x400
>> +#define MT_ST_SCSI2LOGICAL      0x800
>> +#define MT_ST_CLEAR_DEFAULT0xfffff
>> +#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/include/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/sys/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_OFFSET0x0001
>> +#define ADJ_FREQUENCY0x0002
>> +#define ADJ_MAXERROR0x0004
>> +#define ADJ_ESTERROR0x0008
>> +#define ADJ_STATUS0x0010
>> +#define ADJ_TIMECONST0x0020
>> +#define ADJ_TAI0x0080
>> +#define ADJ_SETOFFSET0x0100
>> +#define ADJ_MICRO0x1000
>> +#define ADJ_NANO0x2000
>> +#define ADJ_TICK0x4000
>> +#define ADJ_OFFSET_SINGLESHOT0x8001
>> +#define ADJ_OFFSET_SS_READ0xa001
>> +
>> +#define MOD_OFFSETADJ_OFFSET
>> +#define MOD_FREQUENCYADJ_FREQUENCY
>> +#define MOD_MAXERRORADJ_MAXERROR
>> +#define MOD_ESTERRORADJ_ESTERROR
>> +#define MOD_STATUSADJ_STATUS
>> +#define MOD_TIMECONSTADJ_TIMECONST
>> +#define MOD_CLKBADJ_TICK
>> +#define MOD_CLKAADJ_OFFSET_SINGLESHOT
>> +#define MOD_TAIADJ_TAI
>> +#define MOD_MICROADJ_MICRO
>> +#define MOD_NANOADJ_NANO
>> +
>> +#define STA_PLL0x0001
>> +#define STA_PPSFREQ0x0002
>> +#define STA_PPSTIME0x0004
>> +#define STA_FLL0x0008
>> +
>> +#define STA_INS0x0010
>> +#define STA_DEL0x0020
>> +#define STA_UNSYNC0x0040
>> +#define STA_FREQHOLD0x0080
>> +
>> +#define STA_PPSSIGNAL0x0100
>> +#define STA_PPSJITTER0x0200
>> +#define STA_PPSWANDER0x0400
>> +#define STA_PPSERROR0x0800
>> +
>> +#define STA_CLOCKERR0x1000
>> +#define STA_NANO0x2000
>> +#define STA_MODE0x4000
>> +#define STA_CLK0x8000
>> +
>> +#define STA_RONLY (STA_PPSSIGNAL | STA_PPSJITTER | STA_PPSWANDER | \
>> +    STA_PPSERROR | STA_CLOCKERR | STA_NANO | STA_MODE | STA_CLK)
>> +
>> +#define TIME_OK0
>> +#define TIME_INS1
>> +#define TIME_DEL2
>> +#define TIME_OOP3
>> +#define TIME_WAIT4
>> +#define TIME_ERROR5
>> +#define TIME_BADTIME_ERROR
>> +
>> +#define MAXTC6
>> +
>> +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
>> -- 
>> 2.27.0
>>
>>
>>
>>
>>
>



From minios-devel-bounces@lists.xenproject.org Fri Jan 29 13:24:57 2021
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Fri, 29 Jan 2021 13:24:57 +0000
Received: from list by lists.xenproject.org with outflank-mailman.78139.142012 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1l5Tlc-0003JX-Cb; Fri, 29 Jan 2021 13:24:52 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 78139.142012; Fri, 29 Jan 2021 13:24:52 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1l5Tlc-0003JQ-9f; Fri, 29 Jan 2021 13:24:52 +0000
Received: by outflank-mailman (input) for mailman id 78139;
 Fri, 29 Jan 2021 13:24: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=DSqt=HA=gmail.com=razvand@srs-us1.protection.inumbo.net>)
 id 1l5Tla-0003JL-Nw
 for minios-devel@lists.xen.org; Fri, 29 Jan 2021 13:24:50 +0000
Received: from mail-wm1-x334.google.com (unknown [2a00:1450:4864:20::334])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 3c54f8a7-3f8c-4859-b636-ee4d4dcf9869;
 Fri, 29 Jan 2021 13:24:48 +0000 (UTC)
Received: by mail-wm1-x334.google.com with SMTP id i9so7183451wmq.1
 for <minios-devel@lists.xen.org>; Fri, 29 Jan 2021 05:24:48 -0800 (PST)
Received: from localhost ([141.85.225.206])
 by smtp.gmail.com with ESMTPSA id l5sm11976872wrv.44.2021.01.29.05.24.46
 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256);
 Fri, 29 Jan 2021 05:24: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
X-Inumbo-ID: 3c54f8a7-3f8c-4859-b636-ee4d4dcf9869
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=KYQW/KCKP3jsTbD2Yvb7yk80mQiGSyd9IjIvhYEJKts=;
        b=SY1gSnZhaTanPfkNF8On5FPKiY8twsaiVnGApQC27nxcHvvc6fxAlAJt9jQsMLV8BY
         HIiLYp3p2zoERrL72pvsCCULk9BH3BGCVmNTvhHoaPJqJg784uEl8+AQzzd9Fqqln5Bo
         3Llhw1X7Bchdd34rr+xe7qMNvqJPA71a09+4YrkF+pz9Mtz/16Ubq+FwOVxElQ5fbOCn
         +K8mMg2cOM9lgQhib/817PrZblL3c/elZGmFrX3oDwL6TA4YN42C5v9QStg3MZTV8FPR
         r1oU91hcRPMStxX2DvW+PwTKnDZ6oytFOZb1r61zxE/p3w+U/O27XiFsTwVg4HQQiYTE
         jWKg==
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=KYQW/KCKP3jsTbD2Yvb7yk80mQiGSyd9IjIvhYEJKts=;
        b=NnQyJZKufVWGxgSzAiLt2zvLt9fW/RleKQYSWMezl6jsqDp5eakWm4z0XX5i61bmsf
         KzVJ3Qw/LythPQbU/wNmViQ3V6Qn4lIzM02x/q8H2v8pQir+PrKQRqQImD9963XSioJM
         bsQYiVN/kdTpoh6kc6960jJbGmdC09gLNZMFdpKwrVf5KLnXYy19iR4s5RIPrMicNy4W
         l2B1f8tiQ2Y3/O1OD7jgj+m/RqGE1eqCTZuVYCJIOfBGU/HFN2RizWGwvnoEQuZJIDAp
         F5BFxsngs4t+its81uDBrSCS1w0/GSvOiuQO5H0LyAdfL7gdZ5SliWFmtSWpLzb7p0tH
         AGPg==
X-Gm-Message-State: AOAM531UODfXA4xREjia0jbcda77RpYMU4cT+afbQD0GhBzc9ANfLD6Q
	2Njw3XSIegVL6R+ZNcJ9am+UjRLXatck6w==
X-Google-Smtp-Source: ABdhPJw0e8j23tQ2LCnJHVglKxI6VwN64hq9owNzbJ/y1iEQ/mKI3C8/5Bh0EpbUhRf7XIiMj7KQsg==
X-Received: by 2002:a1c:1d12:: with SMTP id d18mr3714758wmd.121.1611926687717;
        Fri, 29 Jan 2021 05:24:47 -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 v5 0/5] Memory Pools
References: <20201222125237.29250-1-simon.kuenzer@neclab.eu>
Date: Fri, 29 Jan 2021 15:24:46 +0200
In-Reply-To: <20201222125237.29250-1-simon.kuenzer@neclab.eu> (Simon Kuenzer's
	message of "Tue, 22 Dec 2020 13:52:32 +0100")
Message-ID: <86o8h7ho4h.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

Hi, Simon.

This looks good. The interface is clean and well documented.

One minor thing is a patch doesn't apply to the current staging version
of Unikraft, I'll mark the issue in the respective patch e-mail.

Razvan

Simon Kuenzer <simon.kuenzer@neclab.eu> writes:
> 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


From minios-devel-bounces@lists.xenproject.org Fri Jan 29 13:27:40 2021
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Fri, 29 Jan 2021 13:27:40 +0000
Received: from list by lists.xenproject.org with outflank-mailman.78141.142016 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1l5ToJ-0003Ll-Kp; Fri, 29 Jan 2021 13:27:39 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 78141.142016; Fri, 29 Jan 2021 13:27: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 1l5ToJ-0003Le-Hw; Fri, 29 Jan 2021 13:27:39 +0000
Received: by outflank-mailman (input) for mailman id 78141;
 Fri, 29 Jan 2021 13:27: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=DSqt=HA=gmail.com=razvand@srs-us1.protection.inumbo.net>)
 id 1l5ToH-0003LZ-Ks
 for minios-devel@lists.xen.org; Fri, 29 Jan 2021 13:27:37 +0000
Received: from mail-wm1-x32b.google.com (unknown [2a00:1450:4864:20::32b])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id a5678202-208f-45e2-a409-b1e1ed837a8c;
 Fri, 29 Jan 2021 13:27:36 +0000 (UTC)
Received: by mail-wm1-x32b.google.com with SMTP id u14so6837782wml.4
 for <minios-devel@lists.xen.org>; Fri, 29 Jan 2021 05:27:36 -0800 (PST)
Received: from localhost ([141.85.225.206])
 by smtp.gmail.com with ESMTPSA id o14sm11686894wri.48.2021.01.29.05.27.34
 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256);
 Fri, 29 Jan 2021 05:27: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
X-Inumbo-ID: a5678202-208f-45e2-a409-b1e1ed837a8c
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=BVu0S4PZdBDaCFZWX20U0NylubqDS/HbBB8rJHiaAPo=;
        b=D0fCF4zeVQmC0r7mnWxT4KdSINSWwPRe2boeAF5S7QtakcODhxGtxtXHPLdnVBhOjk
         AC0HLMAGlG28jSxFTy9QF6YfIyy3xUz5LT4D3YkNP43EE+WPMmfz3hX718yKPwUTqFNf
         ZEH8lgh+mVpddiIYcgS4WECAwixqL/6V4WGdI4RGZdufU8f3QtplSOMCHlgL3sdlXNIA
         J+p8B/LdxVfShiPVd8qrvQSfT7lveo2LHqF9cJbPJyT6j/xpq1+QJhwiNI5qrWbuy41M
         XwzCVZAVYBuI4UWkhgjSiPwGmT0JN8CQKKYbu9OjWSZN3UW9RqRLQ74LShRx0RYTcZfP
         tTrg==
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=BVu0S4PZdBDaCFZWX20U0NylubqDS/HbBB8rJHiaAPo=;
        b=K1TuIeJhOfRiEMrbq/7DHi0vjNe1ealnIaK1DsQotTZ7JeacdpT9osmSIxKr1vvKp4
         CIg7dYVOhzr8/jgXDFMXuW++Jr95pf183LG0p+C8nMgqkVbchQNrbQ5KR8LLWP+vzgH0
         Q2hhPqaihBRrH66GkUKD1tV1m24KNSISLvJgwrfQuZbQDig8PWumNwZdNsAfVSbDWina
         c71/EfUZ+BqrY8eSOPqQiqG2TA9wkugkoS021MDMxvIershYIf+DfojijFFHV3++Vvza
         J33W3uAuD+atkOOh4XiyJMCp/HdjSRqSWE99JGc+KS1U3Iko7Ja9vNgwltLY1oBxrzuY
         zZxg==
X-Gm-Message-State: AOAM5324LmW5d0prvzvkI9KQGMpUEEYke8proeyUCqQvxTyau/YLPkfN
	rNm127gp0Pfblf8943tSXEw=
X-Google-Smtp-Source: ABdhPJzGD2udRED1Q4f+CKQf1o6ofTqKTBNqLJ7x36EI49yUTPdDArZtOuMFja0VPqSr/Ft0TSsIoA==
X-Received: by 2002:a1c:bc8b:: with SMTP id m133mr3860860wmf.58.1611926855245;
        Fri, 29 Jan 2021 05:27:35 -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 v5 1/5] lib/ukallocpool: Library skeleton
References: <20201222125237.29250-1-simon.kuenzer@neclab.eu>
	<20201222125237.29250-2-simon.kuenzer@neclab.eu>
Date: Fri, 29 Jan 2021 15:27:34 +0200
In-Reply-To: <20201222125237.29250-2-simon.kuenzer@neclab.eu> (Simon Kuenzer's
	message of "Tue, 22 Dec 2020 13:52:33 +0100")
Message-ID: <86h7mzhnzt.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

All good.

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

Simon Kuenzer <simon.kuenzer@neclab.eu> writes:
> 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


From minios-devel-bounces@lists.xenproject.org Fri Jan 29 13:27:50 2021
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Fri, 29 Jan 2021 13:27:50 +0000
Received: from list by lists.xenproject.org with outflank-mailman.78143.142020 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1l5ToU-0003NF-Mi; Fri, 29 Jan 2021 13:27:50 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 78143.142020; Fri, 29 Jan 2021 13:27: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 1l5ToU-0003N7-Jk; Fri, 29 Jan 2021 13:27:50 +0000
Received: by outflank-mailman (input) for mailman id 78143;
 Fri, 29 Jan 2021 13:27:49 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <SRS0=DSqt=HA=gmail.com=razvand@srs-us1.protection.inumbo.net>)
 id 1l5ToT-0003Mx-4m
 for minios-devel@lists.xen.org; Fri, 29 Jan 2021 13:27:49 +0000
Received: from mail-wr1-x431.google.com (unknown [2a00:1450:4864:20::431])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id c6e73c6a-63c2-49ba-8ea0-039cdbaf873c;
 Fri, 29 Jan 2021 13:27:47 +0000 (UTC)
Received: by mail-wr1-x431.google.com with SMTP id c4so6128121wru.9
 for <minios-devel@lists.xen.org>; Fri, 29 Jan 2021 05:27:47 -0800 (PST)
Received: from localhost ([141.85.225.206])
 by smtp.gmail.com with ESMTPSA id u1sm9792122wml.11.2021.01.29.05.27.45
 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256);
 Fri, 29 Jan 2021 05:27: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
X-Inumbo-ID: c6e73c6a-63c2-49ba-8ea0-039cdbaf873c
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=nxXJhDKaZRjlMqmW6itllgkcCaYYEbzXRk0wyBpRL9g=;
        b=rxl1dZ+ibAovy4GD2FhgIFvR2JpcM9eVutAjxFKkVL4al5ZSYLj/pQaA29mtJExSDh
         R0aM+0bRTYn5/soD+ltfSbxaP/gTAmwChYakFCksCJQDTdKSSrtEyAqFaN7AQMNaU25Z
         Vl4MME1EOcrzfeBfbmrLQ8I7ipQ56T0hPkrII+bIMA73GTqASjTYH+v5yiXgj1uYddYP
         tzd7iYaCAYRpTEAl4NlF/JeSH5c2mpanoBagRa85QZcCuQxG7EmVqoAC11yKyIBPuxBT
         7iGk05mgcHNVMXWERVtVqLv0XeSe8B+Oh0TTju20xBMfy55Vx2q5iZUtEnlpRfDkWqMk
         7puQ==
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=nxXJhDKaZRjlMqmW6itllgkcCaYYEbzXRk0wyBpRL9g=;
        b=rBW277yUI3+FGhDCLvYnR8yObH80CeTawsTtA2yGkzRfOqefNJ9Fx57AnVp9cqZ8pb
         GnvXe6dLSw+o1h2o/cPt6teaZjXukSCzqTRGYj5g3hl2h1/m7QOuX4aqPENKQXvYlH2O
         Jd5I1PMMF/8rGaOHPOFgCFAPQDjAOshGyhVxWXXIzV3xb15uB4ZLNmcx4CdVbXZjHtMy
         LrBBKln34TYnNW9cHPOUIWPStc7qe88dUui7eehdDRhSWLO4M811YZ3NseuoFxsllimo
         XWg103B68pZvDr0PCVAGMn5dXhAhXnzQM6HfhELvao/cnmB+u2lwPV8+BgI+AEBNOhnI
         k3uw==
X-Gm-Message-State: AOAM530GPBA9Lx9GnbXukRH1ivLDbjAhDLxHM6/3na2g+SHJ1XBkcA25
	vY9lhp6EHtfpIR2GJcJttpM=
X-Google-Smtp-Source: ABdhPJxVgHBpqv7SKH6lkTnmyflqFYDJMEFHV6dHBQSidmVVk++CIXbUHbsp/us/cmpFXQg8SSKbag==
X-Received: by 2002:a5d:4e4c:: with SMTP id r12mr4585806wrt.354.1611926866683;
        Fri, 29 Jan 2021 05:27:46 -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 v5 3/5] lib/ukallocpool: Allocate pool on parent allocator
References: <20201222125237.29250-1-simon.kuenzer@neclab.eu>
	<20201222125237.29250-4-simon.kuenzer@neclab.eu>
Date: Fri, 29 Jan 2021 15:27:45 +0200
In-Reply-To: <20201222125237.29250-4-simon.kuenzer@neclab.eu> (Simon Kuenzer's
	message of "Tue, 22 Dec 2020 13:52:35 +0100")
Message-ID: <86czxnhnzi.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

All good.

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

Simon Kuenzer <simon.kuenzer@neclab.eu> writes:
> 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);
> +}


From minios-devel-bounces@lists.xenproject.org Fri Jan 29 13:28:17 2021
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Fri, 29 Jan 2021 13:28:17 +0000
Received: from list by lists.xenproject.org with outflank-mailman.78145.142025 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1l5Tov-0003Oe-PR; Fri, 29 Jan 2021 13:28:17 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 78145.142025; Fri, 29 Jan 2021 13:28: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 1l5Tov-0003OX-MK; Fri, 29 Jan 2021 13:28:17 +0000
Received: by outflank-mailman (input) for mailman id 78145;
 Fri, 29 Jan 2021 13:28: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=DSqt=HA=gmail.com=razvand@srs-us1.protection.inumbo.net>)
 id 1l5Tou-0003OS-Cb
 for minios-devel@lists.xen.org; Fri, 29 Jan 2021 13:28:16 +0000
Received: from mail-wm1-x32a.google.com (unknown [2a00:1450:4864:20::32a])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 3fe664f5-a05b-41d5-98f4-d0affc667ab2;
 Fri, 29 Jan 2021 13:28:14 +0000 (UTC)
Received: by mail-wm1-x32a.google.com with SMTP id y187so7180759wmd.3
 for <minios-devel@lists.xen.org>; Fri, 29 Jan 2021 05:28:14 -0800 (PST)
Received: from localhost ([141.85.225.206])
 by smtp.gmail.com with ESMTPSA id t25sm9523794wmj.39.2021.01.29.05.28.13
 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256);
 Fri, 29 Jan 2021 05:28: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
X-Inumbo-ID: 3fe664f5-a05b-41d5-98f4-d0affc667ab2
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=3PIc9fv4ODlAzNwvrkoXRtSl+7IHmjEoTHchvnKWnQ4=;
        b=tfBMCvZ71C/FJ/FRHps7E90By6Dqc1UIbv/fHTf3KgKPtf54ByZ+pdK0hSFWIVlDFz
         U9CNp5n/QsY7AhLhtOIcIH/qCRdBcedMeFOInjCa36AMBoM7rv4A4HSqHTeCZcXuKlR1
         1xuSaYR6b7YzNL4QU5e10kPpA7y9jhQkDKq7wYWLnphNbsODobTeb9J4e6G6IK2Z3YwI
         uX59D74IsZ//tmUs8CLIpfuq+NB5Ep6+zVu0G6krpF3H4w67Zvd4oqnhfDNpqgjbo1me
         fIa5EVgK5sdR8wSkuWarSjt86VJc0upjRxTbGOal16VuXNEpqVkVVSofYNxkaPAu1tpv
         xusQ==
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=3PIc9fv4ODlAzNwvrkoXRtSl+7IHmjEoTHchvnKWnQ4=;
        b=t5+Z67ULhZCJF1KQWTpZa8qtTVGYHrKmlvQq3QKpT0OVO6LZYqK2WdJ2tHvQD1tZfb
         iT068p4zFTd/WilrCNYZr330BV2ZzOYUGIxu7y0Qmn+lD799BVGG0fKWbGxZsfbaWe1n
         oXx0r0qCcA33BMNcVWV34dcj6o7OQtlGxG3OBXQPVd7IX/BDCRBNqakulph4cPpi3DYX
         y7X1g1RkFtThemb++IfefptLdPhF4Ti0TPS+9weD0CVoNg0b2WJ90qtIw+qRqyyeAP6V
         eElfznXYjEvrie+lDOwXxVcqmMn+xQ4j5BKjqFDT5ukM5MhWYLPWMSQBIEJ8UFxHIuDm
         L+1w==
X-Gm-Message-State: AOAM530gtn08DsIKBIs3TPVls3iC50gMkDlckNWnDs7chQe+yHZt9cKT
	MLDWVTYp1p8wt0jRwtSMbqg=
X-Google-Smtp-Source: ABdhPJy7msUtoybawBiE4Q5YqgxdLIvaUqC6f1/6S2MBO8eQ1y/5vUG/Iy5KEzalumd7gaofxBNeog==
X-Received: by 2002:a05:600c:2204:: with SMTP id z4mr3761954wml.138.1611926893663;
        Fri, 29 Jan 2021 05:28:13 -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 v5 2/5] lib/ukallocpool: LIFO pool implementation
References: <20201222125237.29250-1-simon.kuenzer@neclab.eu>
	<20201222125237.29250-3-simon.kuenzer@neclab.eu>
Date: Fri, 29 Jan 2021 15:28:12 +0200
In-Reply-To: <20201222125237.29250-3-simon.kuenzer@neclab.eu> (Simon Kuenzer's
	message of "Tue, 22 Dec 2020 13:52:34 +0100")
Message-ID: <868s8bhnyr.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

All good.

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

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


From minios-devel-bounces@lists.xenproject.org Fri Jan 29 13:28:23 2021
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Fri, 29 Jan 2021 13:28:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.78147.142028 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1l5Tp1-0003Pr-Re; Fri, 29 Jan 2021 13:28:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 78147.142028; Fri, 29 Jan 2021 13:28: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 1l5Tp1-0003Pk-Os; Fri, 29 Jan 2021 13:28:23 +0000
Received: by outflank-mailman (input) for mailman id 78147;
 Fri, 29 Jan 2021 13:28: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=DSqt=HA=gmail.com=razvand@srs-us1.protection.inumbo.net>)
 id 1l5Tp0-0003OS-GR
 for minios-devel@lists.xen.org; Fri, 29 Jan 2021 13:28:22 +0000
Received: from mail-wm1-x32f.google.com (unknown [2a00:1450:4864:20::32f])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 20ca7ac6-ef84-4820-bcc7-bc24cf1010c4;
 Fri, 29 Jan 2021 13:28:21 +0000 (UTC)
Received: by mail-wm1-x32f.google.com with SMTP id s24so7042453wmj.0
 for <minios-devel@lists.xen.org>; Fri, 29 Jan 2021 05:28:21 -0800 (PST)
Received: from localhost ([141.85.225.206])
 by smtp.gmail.com with ESMTPSA id o17sm12346315wrm.52.2021.01.29.05.28.19
 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256);
 Fri, 29 Jan 2021 05:28: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
X-Inumbo-ID: 20ca7ac6-ef84-4820-bcc7-bc24cf1010c4
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=7rxJCH7ErOOtaDIZNdSXi/qEwIwoPLn2tkrCRCFchNw=;
        b=j125+WXCkktRKZgdJNXWsedez7ydaZPX5/2b5QWDOS9PVyU2vNIWIX/kPve+6jxn76
         f9UFwahhyOQRE313/IBUaPgj23Zpkb/PJX3wa1zzjzP1kL0f/DgsynhEI0Ve6XOPyqU2
         VvsL4tJJt2B8HnDEvZjWl0GDwoGU9dg39kEUKGatB0bybuQjBK1uEwQG+G+/VWvDSOje
         jpcTg2c4Dwo73K8M4RXcX3FNO7Uk9pGf2PWW+OJ1OFupl23SjqhzxxHEWvIE3vWMuj+e
         CKABEUw9R4NPNuwEZ2KHLgJmL5OILfjBHjY6Leh8qdxvmzYT3Xu/LX5YRN+JLBHKWlt1
         bKUg==
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=7rxJCH7ErOOtaDIZNdSXi/qEwIwoPLn2tkrCRCFchNw=;
        b=CEvyuvlL9M3JuyIBsbujdI39p9sna4lJ6sbun1DmaMEenCJNWydh2xUhItCZyTg8h/
         hbWSXKXQCjvzqpxsEHZcyQ8QMLqBSYUKrxf/5YUVmdAPyuZsYa7X50I3mijUcrwiN/55
         +PrbIDw1LlZwkuMvKI4H7FjBdTCf9hm+1gvfm+MGgHMuatqW4S24uhE6FbIHbYEtndKV
         75dKfmx301xu1npBCxaIj1arxvG4D3DEwXKuRZmkNPtCUt6E7SQdRrPp45uQPy0hhldF
         AFGR5SloC8PyaXpe1+e36bD+1wz2T8oyeUXguDn3kBA3lP5xxfTuuULFz0IWLga6HVlr
         ysbg==
X-Gm-Message-State: AOAM531k5se1UbleKwV/NxiVmPzNdHIAfGNXjSYFT/xkMWHmMK8CKawy
	wGeaytvEOcHyGTUbTRuzfhA=
X-Google-Smtp-Source: ABdhPJzPukafOq10s3niVMfd7szbZTTGEupROHEpr8E5XvriyUS05krhKUFkE5JG0uFnz55lMzLaZA==
X-Received: by 2002:a1c:6744:: with SMTP id b65mr3835176wmc.60.1611926900224;
        Fri, 29 Jan 2021 05:28:20 -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 v5 4/5] lib/ukallocpool: `lib/ukalloc` compatible interface
References: <20201222125237.29250-1-simon.kuenzer@neclab.eu>
	<20201222125237.29250-5-simon.kuenzer@neclab.eu>
Date: Fri, 29 Jan 2021 15:28:19 +0200
In-Reply-To: <20201222125237.29250-5-simon.kuenzer@neclab.eu> (Simon Kuenzer's
	message of "Tue, 22 Dec 2020 13:52:36 +0100")
Message-ID: <864kizhnyk.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

All good.

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

Simon Kuenzer <simon.kuenzer@neclab.eu> writes:
> 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);
>  }


From minios-devel-bounces@lists.xenproject.org Fri Jan 29 13:28:32 2021
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Fri, 29 Jan 2021 13:28:32 +0000
Received: from list by lists.xenproject.org with outflank-mailman.78149.142032 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1l5TpA-0003RA-Th; Fri, 29 Jan 2021 13:28:32 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 78149.142032; Fri, 29 Jan 2021 13:28: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 1l5TpA-0003R3-Qq; Fri, 29 Jan 2021 13:28:32 +0000
Received: by outflank-mailman (input) for mailman id 78149;
 Fri, 29 Jan 2021 13:28: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=DSqt=HA=gmail.com=razvand@srs-us1.protection.inumbo.net>)
 id 1l5Tp8-0003Qr-QE
 for minios-devel@lists.xen.org; Fri, 29 Jan 2021 13:28:30 +0000
Received: from mail-wm1-x32b.google.com (unknown [2a00:1450:4864:20::32b])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id df1054f5-2edf-466a-acf5-80989823c737;
 Fri, 29 Jan 2021 13:28:29 +0000 (UTC)
Received: by mail-wm1-x32b.google.com with SMTP id i9so7192750wmq.1
 for <minios-devel@lists.xen.org>; Fri, 29 Jan 2021 05:28:29 -0800 (PST)
Received: from localhost ([141.85.225.206])
 by smtp.gmail.com with ESMTPSA id h15sm12233680wrt.10.2021.01.29.05.28.28
 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256);
 Fri, 29 Jan 2021 05:28: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
X-Inumbo-ID: df1054f5-2edf-466a-acf5-80989823c737
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=Wdh3dEQbJ36iDiMyedv7q4XbK4HUEdfPELjmqWCKFps=;
        b=W9eOPCJB08cxAqNLTyzhCN5OW1L4ujXHEWxRtCUEPg//gkjt6BFb7qVbT5bfqmQnLh
         NL+u/A2kttjlgFiLqD7f0v+ru0rgYnBVAkPwtJGmmdZKv2Du/vVDRkIaHw3JJcLqUwIg
         TW8UXU6ZIOVWl4XK5014FPo1M+dOYGLUmOSoj0Lq87QFoKRbD1/5MiGpSACIJX7qNoV1
         FdYpS1Q1/I8v7PoLmMaGiSxjQ1k9LLvFemI5Nh9QIjcopmC0QRMEmCBQtt8w7dh3en9Y
         rIs60u2+B0hxx+FxVvdqQtNODj83YrylWtb7VbZWuYLQNDQs6AB7dLgw9AY6MjtEX0t0
         vhtw==
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=Wdh3dEQbJ36iDiMyedv7q4XbK4HUEdfPELjmqWCKFps=;
        b=bEzyED6ht8KmlQ2uv0rM9WnEUAhumK/l7PswoLpewGYO02TFSQi8Qf2ZD+ZwlhOIw6
         n3PFAZBwLaX8fFybpav5MLRoJL2gEarPagbd377dVl8y4IdVqZBIdxX7qGQK2CojdT7v
         xUj2wM7cNIhpRnOm+ieUrExBwLWWjyxue6yve5VPUe33WbpJeCR1qvNhTtzfl7Tajidk
         3Ef5hQOxKFB38zWeVS4TOa3q2CgA66nELD7G0jebaDswos4ZbYAlXm+2kY80LOsCpNkl
         J9LqYwJ4O6loO52KfeKtvtuqZ4FAEFV+lLDQc6Gd6rEsAAv2MOop83fmM2jV74yOMOjX
         90Dw==
X-Gm-Message-State: AOAM530GrYYQEuZDJACYA7jq0fjWtOiXLluaD+SZ/CvCL2RTNQy7H5kk
	ooNqs/8Svwa1D/aa3qzF/poY0sf24E8CaQ==
X-Google-Smtp-Source: ABdhPJx9L0o+Zrv1ZVQuC4XSBJ7tKKTqsizCKD/jFwSPC0oZfiH1V+YvdXpewjDAVDdwSHEDcmCj+Q==
X-Received: by 2002:a1c:11:: with SMTP id 17mr3924550wma.12.1611926908967;
        Fri, 29 Jan 2021 05:28:28 -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 v5 5/5] lib/ukallocpool: Batched allocation
References: <20201222125237.29250-1-simon.kuenzer@neclab.eu>
	<20201222125237.29250-6-simon.kuenzer@neclab.eu>
Date: Fri, 29 Jan 2021 15:28:27 +0200
In-Reply-To: <20201222125237.29250-6-simon.kuenzer@neclab.eu> (Simon Kuenzer's
	message of "Tue, 22 Dec 2020 13:52:37 +0100")
Message-ID: <86zh0rg9dw.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

All good.

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

Simon Kuenzer <simon.kuenzer@neclab.eu> writes:
> 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)
>  {


From minios-devel-bounces@lists.xenproject.org Fri Jan 29 13:31:11 2021
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Fri, 29 Jan 2021 13:31:11 +0000
Received: from list by lists.xenproject.org with outflank-mailman.78151.142036 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1l5Tri-0004Mn-5f; Fri, 29 Jan 2021 13:31:10 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 78151.142036; Fri, 29 Jan 2021 13:31: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 1l5Tri-0004Mg-2d; Fri, 29 Jan 2021 13:31:10 +0000
Received: by outflank-mailman (input) for mailman id 78151;
 Fri, 29 Jan 2021 13:31: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=DSqt=HA=gmail.com=razvand@srs-us1.protection.inumbo.net>)
 id 1l5Trg-0004Mb-S9
 for minios-devel@lists.xen.org; Fri, 29 Jan 2021 13:31:08 +0000
Received: from mail-wr1-x430.google.com (unknown [2a00:1450:4864:20::430])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 0d961078-aba5-4897-936f-68761bef864b;
 Fri, 29 Jan 2021 13:31:07 +0000 (UTC)
Received: by mail-wr1-x430.google.com with SMTP id 6so8845826wri.3
 for <minios-devel@lists.xen.org>; Fri, 29 Jan 2021 05:31:07 -0800 (PST)
Received: from localhost ([141.85.225.204])
 by smtp.gmail.com with ESMTPSA id r124sm10344010wmr.16.2021.01.29.05.31.06
 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256);
 Fri, 29 Jan 2021 05:31: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
X-Inumbo-ID: 0d961078-aba5-4897-936f-68761bef864b
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=wjMZR/ajWjNpl5X0ZWO//Ul55TiLVMzk4jd/9xYNkQg=;
        b=hlB/PveaRW6et+4pigMm5tWzg6AVO6kkw1f7Ia84WLIkQn7cKP4TReiWkhwTjFJ2N2
         nKkjn/JCI0W5gjjovvuvaTrWtROHlA91GJOdBUXuR1HTcOxUvmPAbH3Q5VTPoOMU7kJw
         nmYG34lSZr3CvVaLQgpPymOGrLnar/68kjqYBquiaCgrvAVO6RWJ+TZ77jBIHC6CdKxv
         FNmHqO+z7lvczPFUfVQubhZu5bEIZGGrbWNMHMTEbXLaK9s9bANwjZkQ0xMmrRvIHyVD
         qP2Vj856B8XL2rJ1NlQfIEVvkGSvbHazfYwFkdVr9uwI1lYEnogxO7tw81orAY6Vsxzv
         8lYg==
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=wjMZR/ajWjNpl5X0ZWO//Ul55TiLVMzk4jd/9xYNkQg=;
        b=uNn7pw4+nyo95psRiFzFeKtolQRtAd12FhzIDjefs0ZVQV3MoxD8TTdZmXRFcey6S5
         J5QZpUPXKFuu+wnw8ceJOnZQhiTA7EgfAqy91WNEg9lu4vjDnmgZ5ns8tXASWIu4D1KH
         maCRAKx9u/vkG+CbJFw4tSxVKfDELbdoOt7htiwfiB6aCwq0KvuvvwB4migoh6ny03PG
         dMc0HJV2rGJ6IuW3fqW0/ApJ9QnFBMFfd0EmjP/8fJWeCJtulCxcCY67m5NMgNACHMa3
         19mTY2cgrXiqLs8CIemoN14UotxgIBQ/j2uodO4Ym+Sa4+IshF/kESFur//L6gqikccr
         oXYA==
X-Gm-Message-State: AOAM532Uk3qgdY6YQ5tI+JubGzvu/MeCgiTi6gw4i6Cv78/1bzT/S9L4
	rkndvsYqlgUW2adjpYnTdFI=
X-Google-Smtp-Source: ABdhPJwkf/Ns5sT4V3cTg9gqABExXLW7iwGQmPGXO+ZKku5UgiRQid3SOJlWunuldAVTizOxxzIroA==
X-Received: by 2002:adf:ff91:: with SMTP id j17mr4391209wrr.377.1611927066928;
        Fri, 29 Jan 2021 05:31:06 -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 v5 0/5] Memory Pools
References: <20201222125237.29250-1-simon.kuenzer@neclab.eu>
	<86o8h7ho4h.fsf@drone.cs.pub.ro>
Date: Fri, 29 Jan 2021 15:31:05 +0200
In-Reply-To: <86o8h7ho4h.fsf@drone.cs.pub.ro> (Razvan Deaconescu's message of
	"Fri, 29 Jan 2021 15:24:46 +0200")
Message-ID: <861re3g99i.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:
> Hi, Simon.
>
> This looks good. The interface is clean and well documented.
>
> One minor thing is a patch doesn't apply to the current staging version
> of Unikraft, I'll mark the issue in the respective patch e-mail.

Scratch that. I was doing it wrong: I was using the master branch, not
the staging branch. All is good.

Razvan


From minios-devel-bounces@lists.xenproject.org Fri Jan 29 13:38:32 2021
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Fri, 29 Jan 2021 13:38:32 +0000
Received: from list by lists.xenproject.org with outflank-mailman.78153.142041 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1l5Tyo-0004Sc-OR; Fri, 29 Jan 2021 13:38:30 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 78153.142041; Fri, 29 Jan 2021 13:38: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 1l5Tyo-0004SV-LP; Fri, 29 Jan 2021 13:38:30 +0000
Received: by outflank-mailman (input) for mailman id 78153;
 Fri, 29 Jan 2021 13:38: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=DSqt=HA=gmail.com=razvand@srs-us1.protection.inumbo.net>)
 id 1l5Tyo-0004SQ-9v
 for minios-devel@lists.xen.org; Fri, 29 Jan 2021 13:38:30 +0000
Received: from mail-wm1-x32a.google.com (unknown [2a00:1450:4864:20::32a])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 1d7ac8ff-303d-4d4f-a8a6-27294e62e1fd;
 Fri, 29 Jan 2021 13:38:29 +0000 (UTC)
Received: by mail-wm1-x32a.google.com with SMTP id m2so6878583wmm.1
 for <minios-devel@lists.xen.org>; Fri, 29 Jan 2021 05:38:29 -0800 (PST)
Received: from localhost ([141.85.225.204])
 by smtp.gmail.com with ESMTPSA id d3sm13556826wrp.79.2021.01.29.05.38.27
 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256);
 Fri, 29 Jan 2021 05:38: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
X-Inumbo-ID: 1d7ac8ff-303d-4d4f-a8a6-27294e62e1fd
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=YScmVkbpZZgC1a/pcLZLCL/BXllpCDYkVJKSswud7BI=;
        b=CINj3v8YY9ySeb7iB5BzjF+ChHOg6Y8sG2u27CFk21KnJuo1NsLg2bCfBhYDI5t7dt
         3SDAP0Pw53RXRk4oYjlcXs7p0QZTLLgRB9gWN1CdtxYNrYVJv5BTB3icTJFAnEqEm5qX
         gvvIN/h6HWeMR03lu2zthxm90L/Wj7sCBjADHhGQGqDflX5FdgGndAQ6XKcRiXcDe71l
         081xiMnucrQM/mdo1KUZhHw+31XQGxotX0IYoGmbrQXHGJ1MC1i+1saBVcAU+P0t1GMn
         XCMfEfCx/FQYqImQVdP7p0DslYMkTnry8fTGafOKuoxQR3vl/eYF5opKzozNCPKbSiF3
         ZYRg==
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=YScmVkbpZZgC1a/pcLZLCL/BXllpCDYkVJKSswud7BI=;
        b=CzKREz/PWHw5IC6FP3YXrlLmKsSm3MHR1kP0BzY2/puBn4ut06992wlSpELCmzC5QK
         mIoqN1Cnh16hpn6ihJXUtASQRa0ANmgUHaBLfvOHegaqWpIKD2UiH5GsGWT+znuTWepj
         qaovd1CA8MIbNInfonKpyYqeBJKjGCGdAfS18/IUDUJBJh+rFi6+8eMLpWqdWNdDD5Js
         GNsbv1s4DnnlLKJiAHAF4CzGo1x1YsxXSWAWuENUvznRJoc1u5elxbX98uSDm+MS+09x
         9sEJ45N2QtCvJlHeb2RqgRRNg0TZPpJkVSePOrkOeIr1EMZMARIFMVWHHRsOwWhiW9Co
         Te3w==
X-Gm-Message-State: AOAM530Ch09MSFgH1L+HgxfS3w4vWL0JCk6ssgAM3I7gJ0Y/2pKRfgaW
	aQ0OnonZ+ksTKwlUvUodp2mVciMl37KQpA==
X-Google-Smtp-Source: ABdhPJxgnFxSRTt0xBmzF+s+AdqWkdK3yzDWiCcPrNNTptSAdkqHhwC6r+a31Oep4dlTZJDDglNOkg==
X-Received: by 2002:a1c:7906:: with SMTP id l6mr3900388wme.22.1611927508569;
        Fri, 29 Jan 2021 05:38:28 -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] build: Fix typo when initializing `UK_PREPARE-y`
References: <20201218175438.25658-1-simon.kuenzer@neclab.eu>
Date: Fri, 29 Jan 2021 15:38:27 +0200
In-Reply-To: <20201218175438.25658-1-simon.kuenzer@neclab.eu> (Simon Kuenzer's
	message of "Fri, 18 Dec 2020 18:54:38 +0100")
Message-ID: <86wnvveucs.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

All good.

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

Simon Kuenzer <simon.kuenzer@neclab.eu> writes:
> 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:=


From minios-devel-bounces@lists.xenproject.org Fri Jan 29 13:49:45 2021
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Fri, 29 Jan 2021 13:49:45 +0000
Received: from list by lists.xenproject.org with outflank-mailman.78156.142044 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1l5U9g-0005cn-KI; Fri, 29 Jan 2021 13:49:44 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 78156.142044; Fri, 29 Jan 2021 13:49: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 1l5U9g-0005cg-HH; Fri, 29 Jan 2021 13:49:44 +0000
Received: by outflank-mailman (input) for mailman id 78156;
 Fri, 29 Jan 2021 13:49:43 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <julien@xen.org>) id 1l5U9f-0005cb-3t
 for minios-devel@lists.xenproject.org; Fri, 29 Jan 2021 13:49:43 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <julien@xen.org>)
 id 1l5U9e-0006oV-7D; Fri, 29 Jan 2021 13:49:42 +0000
Received: from 54-240-197-232.amazon.com ([54.240.197.232]
 helo=a483e7b01a66.ant.amazon.com)
 by xenbits.xenproject.org with esmtpsa
 (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92)
 (envelope-from <julien@xen.org>)
 id 1l5U9e-0000rV-0g; Fri, 29 Jan 2021 13:49:42 +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>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Content-Transfer-Encoding:Content-Type:In-Reply-To:
	MIME-Version:Date:Message-ID:From:References:Cc:To:Subject;
	bh=npm0dPsYyC4jjpVWzDHSdAO7+nH4SJh5I3RtBYJe3pw=; b=1AuD6FIP4BB28P+DiExkCoAXw+
	86/sxUhlQJUGKOJZT2RWPlnnnHEVKHrkU9Rwp80eEAXnkrX9h7qCr1vL94EAIzGbDDHjBKPO4L7/W
	BfKN5hyWwLWr1hynoKiGOyBeuIg18LEDFjqigFeXsnA/5fb91IlTLWFXQY0HGmbyJKy8=;
Subject: Re: [PATCH] arm/entry: set x0 before cache maintenance.
To: Jianyong Wu <jianyong.wu@arm.com>, minios-devel@lists.xenproject.org,
 sharan.santhanam@neclab.eu, simon.kuenzer@neclab.eu
Cc: justin.he@arm.com
References: <20210106032542.33036-1-jianyong.wu@arm.com>
From: Julien Grall <julien@xen.org>
Message-ID: <fe217665-7d6d-5a40-ad6c-7c5cd22e4898@xen.org>
Date: Fri, 29 Jan 2021 13:49:40 +0000
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0)
 Gecko/20100101 Thunderbird/78.7.0
MIME-Version: 1.0
In-Reply-To: <20210106032542.33036-1-jianyong.wu@arm.com>
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Language: en-GB
Content-Transfer-Encoding: 7bit

Hi,

On 06/01/2021 03:25, Jianyong Wu wrote:
> There is a long standing issue in entry code of arm that x0 is not
> set before using it in clean_and_invalidate_dcache_range. This error
> can be caught by kvm and result in core dump.
> Here, x0 is set to the base address of dtb before cache maintain.
> Signed-off-by: Jianyong Wu <jianyong.wu@arm.com>
> ---
>   plat/kvm/arm/entry64.S | 6 ++++++
>   1 file changed, 6 insertions(+)
> 
> diff --git a/plat/kvm/arm/entry64.S b/plat/kvm/arm/entry64.S
> index c4de334..0526ae8 100644
> --- a/plat/kvm/arm/entry64.S
> +++ b/plat/kvm/arm/entry64.S
> @@ -92,6 +92,12 @@ ENTRY(_libkvmplat_entry)
>   	add x27, x26, x17
>   	add x27, x27, #__STACK_SIZE
>   	sub x1, x27, x25
> +
> +	/*
> +	 * set x0 to the location stores dtb as the base address of the
> +	 * memory range to be cache maintained
> +	 */

There is already a few lines above explaining what the clean is meant to 
do. I think it would be best to modify this comment (if you need to) 
rather than adding a new comment.

It would also make sense to introduce a new symbol (maybe start_binary) 
to avoid relying on _dtb to always be first.

> +	ldr x0, =_dtb

Unrelated to this patch, I am a bit confused with the code. The comment 
on top of __libkvmplat_entry suggests that the DTB in x0, so this 
implies the DTB can be dynamic.

However, this line will load the DTB from the image. Can you clarify the 
expected behavior?

>   	bl clean_and_invalidate_dcache_range
>   
>   	/* Disable the MMU and D-Cache. */
> 

Cheers,

-- 
Julien Grall


From minios-devel-bounces@lists.xenproject.org Fri Jan 29 14:09:06 2021
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Fri, 29 Jan 2021 14:09:06 +0000
Received: from list by lists.xenproject.org with outflank-mailman.78170.142079 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1l5USO-0007yW-LD; Fri, 29 Jan 2021 14:09:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 78170.142079; Fri, 29 Jan 2021 14:09: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 1l5USO-0007yP-Hm; Fri, 29 Jan 2021 14:09:04 +0000
Received: by outflank-mailman (input) for mailman id 78170;
 Fri, 29 Jan 2021 14:09: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=Imk7=HA=gmail.com=felipehuici@srs-us1.protection.inumbo.net>)
 id 1l5USM-0007xY-Ta
 for minios-devel@lists.xen.org; Fri, 29 Jan 2021 14:09:02 +0000
Received: from mail-vs1-xe30.google.com (unknown [2607:f8b0:4864:20::e30])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id afde3de5-28ab-4e54-85a2-1f39eeb292b9;
 Fri, 29 Jan 2021 14:09:01 +0000 (UTC)
Received: by mail-vs1-xe30.google.com with SMTP id s83so2531256vsc.4
 for <minios-devel@lists.xen.org>; Fri, 29 Jan 2021 06:09: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: afde3de5-28ab-4e54-85a2-1f39eeb292b9
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=JQKMlVHyHbWRivCzPfT3gwVlIhQSBkmIDvUdf5Vgq8g=;
        b=gyIxKnnPjlzFuIqM251ktmGEyIV0mFwt/HItvevviOAGvZjtEUgK5QwXQKn1SCcU4E
         mpwlU19CxJ5jy4Uy6ZZnjPDIqhEDgXMZLg7TrXNsYDCCFetBTc6OSvCF23d6s1WFZYxC
         yzcP5hJABn4q4801qXEfOQupgtvQoKniWSUb/z3mIYB9E8/i4WDGZrnlEjV8bFGRHUNE
         kaFp01IVeb729EW2dZTDQAf0uGTvD62piNQ+ZAEJiUu6lg5FkvtOnztaz7uc9e6ODqG3
         08A4jjyr9oFs+F5syyk/F6H/E/iieJTdV+XyTS1CWC442WaiC3LrbfKxyTs2Z5sg9+Vs
         CStQ==
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=JQKMlVHyHbWRivCzPfT3gwVlIhQSBkmIDvUdf5Vgq8g=;
        b=qx5KZ44YrUwAf2dCapdKl9/6xpFb3JLdw3lH89XmMuAFLF+3uRl0fEq+PtKpnLKDZy
         0Qvapl/XhawBcXcYEh7KrSxvY84tdkZmj8cHkz/f2Y9Tbi5JUSlX1ua8xUR15srbCsyu
         cfSwNE/zvPE8MhWmzgdV4TqWokAyI4tbWXC02QaNZzFaVXfPPIZ2p6akw17RuajfovdW
         BEei7NqYyQX4zS+3WtBs30X4pvMPUZtXz4S0pEwzXLC6mXBhy4bSwPlhQilPTiKexcsu
         eFZC60DNoUMXXvXy8aOeq09ZE5rzqrB0HTFmTYhp3vr/xmJyOea5P1l61eh80f3L0bmX
         HRGQ==
X-Gm-Message-State: AOAM533ru35GkgJLg52l9m0y5nbFnmClx/8C751qFPN55S2FiurRZF6e
	kXYEaMBQd+Dq+XdeJq2N+5Su9/7U710zCFz5sOtULXOv
X-Google-Smtp-Source: ABdhPJyewHC8ghFd6IrXNXjgyMgVaMyKn1s9eUoxVZNVV0WmGvrzfYKH+0iEtfknlDsDwLMfVQwPgPiQlbL5A3+C3X8=
X-Received: by 2002:a67:11c3:: with SMTP id 186mr2548331vsr.3.1611929341191;
 Fri, 29 Jan 2021 06:09:01 -0800 (PST)
MIME-Version: 1.0
References: <20201201120917.226063-1-vlad_andrei.badoiu@upb.ro>
In-Reply-To: <20201201120917.226063-1-vlad_andrei.badoiu@upb.ro>
From: felipehuici <felipehuici@gmail.com>
Date: Fri, 29 Jan 2021 15:08:49 +0100
Message-ID: <CAEX4t-Mk9GZtNwf4+NTQk3truVnksvaDEikxa5VDDCR0Vhs8vg@mail.gmail.com>
Subject: Re: [UNIKRAFT/PYTHON3 1/1] Fix sqlite module
To: Vlad-Andrei Badoiu <vlad_andrei.badoiu@upb.ro>
Cc: minios-devel@lists.xen.org, Felipe Huici <felipe.huici@neclab.eu>
Content-Type: multipart/alternative; boundary="000000000000c8e99005ba0a8bca"

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

Hi Vlad,

This doesn't build because there are number of missing symbols. Could you
please send a further patch that exposes these via exportsyms.uk? That way
I can review the new patch you'll send, this patch, and the related one to
the SQLite lib, together.

Thanks,

-- Felipe

On Tue, Dec 1, 2020 at 1:12 PM Vlad-Andrei Badoiu <vlad_andrei.badoiu@upb.ro>
wrote:

> 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 +=
> $(LIBPYTHON3_SRC)/Modules/sha512module.c
>  LIBPYTHON3_EXTENSIONS_SRCS-y += $(LIBPYTHON3_SRC)/Modules/socketmodule.c
>  # TODO enable LIBPYTHON3_EXTENSIONS_SRCS-y +=
> $(LIBPYTHON3_SRC)/Modules/spwdmodule.c
>  ifeq ($(CONFIG_LIBPYTHON3_EXTENSION_SQLITE),y)
> -LIBPYTHON3_EXTENSIONS_SRCS-y += $(LIBPYTHON3_SRC)/Modules/_sqlite/cache.c
> -LIBPYTHON3_EXTENSIONS_SRCS-y +=
> $(LIBPYTHON3_SRC)/Modules/_sqlite/connection.c
> -LIBPYTHON3_EXTENSIONS_SRCS-y += $(LIBPYTHON3_SRC)/Modules/_sqlite/cursor.c
> -LIBPYTHON3_EXTENSIONS_SRCS-y +=
> $(LIBPYTHON3_SRC)/Modules/_sqlite/microprotocols.c
> -LIBPYTHON3_EXTENSIONS_SRCS-y += $(LIBPYTHON3_SRC)/Modules/_sqlite/module.c
> -LIBPYTHON3_EXTENSIONS_SRCS-y +=
> $(LIBPYTHON3_SRC)/Modules/_sqlite/prepare_protocol.c
> -LIBPYTHON3_EXTENSIONS_SRCS-y += $(LIBPYTHON3_SRC)/Modules/_sqlite/row.c
> -LIBPYTHON3_EXTENSIONS_SRCS-y +=
> $(LIBPYTHON3_SRC)/Modules/_sqlite/statement.c
> -LIBPYTHON3_EXTENSIONS_SRCS-y += $(LIBPYTHON3_SRC)/Modules/_sqlite/util.c
> +LIBPYTHON3_EXTENSIONS_CFLAGS-y    += -DMODULE_NAME="\"sqlite3\""
> +LIBPYTHON3_EXTENSIONS_SRCS-y +=
> $(LIBPYTHON3_SRC)/Modules/_sqlite/cache.c|sqlite
> +LIBPYTHON3_EXTENSIONS_SRCS-y +=
> $(LIBPYTHON3_SRC)/Modules/_sqlite/connection.c|sqlite
> +LIBPYTHON3_EXTENSIONS_SRCS-y +=
> $(LIBPYTHON3_SRC)/Modules/_sqlite/cursor.c|sqlite
> +LIBPYTHON3_EXTENSIONS_SRCS-y +=
> $(LIBPYTHON3_SRC)/Modules/_sqlite/microprotocols.c|sqlite
> +LIBPYTHON3_EXTENSIONS_SRCS-y +=
> $(LIBPYTHON3_SRC)/Modules/_sqlite/module.c|sqlite
> +LIBPYTHON3_EXTENSIONS_SRCS-y +=
> $(LIBPYTHON3_SRC)/Modules/_sqlite/prepare_protocol.c|sqlite
> +LIBPYTHON3_EXTENSIONS_SRCS-y +=
> $(LIBPYTHON3_SRC)/Modules/_sqlite/row.c|sqlite
> +LIBPYTHON3_EXTENSIONS_SRCS-y +=
> $(LIBPYTHON3_SRC)/Modules/_sqlite/statement.c|sqlite
> +LIBPYTHON3_EXTENSIONS_SRCS-y +=
> $(LIBPYTHON3_SRC)/Modules/_sqlite/util.c|sqlite
>  endif
>  LIBPYTHON3_EXTENSIONS_SRCS-$(CONFIG_LIBPYTHON3_EXTENSION_SSL) +=
> $(LIBPYTHON3_SRC)/Modules/_ssl.c
>  LIBPYTHON3_EXTENSIONS_SRCS-y += $(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 -- */
>
> --
> 2.27.0
>
>
>

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

<div dir=3D"ltr">Hi Vlad,<div><br></div><div>This doesn&#39;t build because=
 there are number of missing symbols. Could you please send a further patch=
 that exposes these via <a href=3D"http://exportsyms.uk">exportsyms.uk</a>?=
 That way I can review the new patch you&#39;ll send, this patch, and the r=
elated one to the SQLite lib, together.</div><div><br></div><div>Thanks,</d=
iv><div><br></div><div>-- Felipe</div></div><br><div class=3D"gmail_quote">=
<div dir=3D"ltr" class=3D"gmail_attr">On Tue, Dec 1, 2020 at 1:12 PM Vlad-A=
ndrei Badoiu &lt;<a href=3D"mailto:vlad_andrei.badoiu@upb.ro">vlad_andrei.b=
adoiu@upb.ro</a>&gt; wrote:<br></div><blockquote class=3D"gmail_quote" styl=
e=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);paddin=
g-left:1ex">This patch fixes the sqlite module. Python now compiles when<br=
>
the sqlite extension is selected from menuconfig.<br>
<br>
Signed-off-by: Vlad-Andrei Badoiu &lt;<a href=3D"mailto:vlad_andrei.badoiu@=
upb.ro" target=3D"_blank">vlad_andrei.badoiu@upb.ro</a>&gt;<br>
---<br>
=C2=A0Makefile.uk=C2=A0 =C2=A0 =C2=A0 | 19 ++++++++++---------<br>
=C2=A0modules_config.c |=C2=A0 4 ++++<br>
=C2=A02 files changed, 14 insertions(+), 9 deletions(-)<br>
<br>
diff --git a/Makefile.uk b/Makefile.uk<br>
index efd58a1..c718b3c 100644<br>
--- a/Makefile.uk<br>
+++ b/Makefile.uk<br>
@@ -419,15 +419,16 @@ LIBPYTHON3_EXTENSIONS_SRCS-y +=3D $(LIBPYTHON3_SRC)/M=
odules/sha512module.c<br>
=C2=A0LIBPYTHON3_EXTENSIONS_SRCS-y +=3D $(LIBPYTHON3_SRC)/Modules/socketmod=
ule.c<br>
=C2=A0# TODO enable LIBPYTHON3_EXTENSIONS_SRCS-y +=3D $(LIBPYTHON3_SRC)/Mod=
ules/spwdmodule.c<br>
=C2=A0ifeq ($(CONFIG_LIBPYTHON3_EXTENSION_SQLITE),y)<br>
-LIBPYTHON3_EXTENSIONS_SRCS-y +=3D $(LIBPYTHON3_SRC)/Modules/_sqlite/cache.=
c<br>
-LIBPYTHON3_EXTENSIONS_SRCS-y +=3D $(LIBPYTHON3_SRC)/Modules/_sqlite/connec=
tion.c<br>
-LIBPYTHON3_EXTENSIONS_SRCS-y +=3D $(LIBPYTHON3_SRC)/Modules/_sqlite/cursor=
.c<br>
-LIBPYTHON3_EXTENSIONS_SRCS-y +=3D $(LIBPYTHON3_SRC)/Modules/_sqlite/microp=
rotocols.c<br>
-LIBPYTHON3_EXTENSIONS_SRCS-y +=3D $(LIBPYTHON3_SRC)/Modules/_sqlite/module=
.c<br>
-LIBPYTHON3_EXTENSIONS_SRCS-y +=3D $(LIBPYTHON3_SRC)/Modules/_sqlite/prepar=
e_protocol.c<br>
-LIBPYTHON3_EXTENSIONS_SRCS-y +=3D $(LIBPYTHON3_SRC)/Modules/_sqlite/row.c<=
br>
-LIBPYTHON3_EXTENSIONS_SRCS-y +=3D $(LIBPYTHON3_SRC)/Modules/_sqlite/statem=
ent.c<br>
-LIBPYTHON3_EXTENSIONS_SRCS-y +=3D $(LIBPYTHON3_SRC)/Modules/_sqlite/util.c=
<br>
+LIBPYTHON3_EXTENSIONS_CFLAGS-y=C2=A0 =C2=A0 +=3D -DMODULE_NAME=3D&quot;\&q=
uot;sqlite3\&quot;&quot;<br>
+LIBPYTHON3_EXTENSIONS_SRCS-y +=3D $(LIBPYTHON3_SRC)/Modules/_sqlite/cache.=
c|sqlite<br>
+LIBPYTHON3_EXTENSIONS_SRCS-y +=3D $(LIBPYTHON3_SRC)/Modules/_sqlite/connec=
tion.c|sqlite<br>
+LIBPYTHON3_EXTENSIONS_SRCS-y +=3D $(LIBPYTHON3_SRC)/Modules/_sqlite/cursor=
.c|sqlite<br>
+LIBPYTHON3_EXTENSIONS_SRCS-y +=3D $(LIBPYTHON3_SRC)/Modules/_sqlite/microp=
rotocols.c|sqlite<br>
+LIBPYTHON3_EXTENSIONS_SRCS-y +=3D $(LIBPYTHON3_SRC)/Modules/_sqlite/module=
.c|sqlite<br>
+LIBPYTHON3_EXTENSIONS_SRCS-y +=3D $(LIBPYTHON3_SRC)/Modules/_sqlite/prepar=
e_protocol.c|sqlite<br>
+LIBPYTHON3_EXTENSIONS_SRCS-y +=3D $(LIBPYTHON3_SRC)/Modules/_sqlite/row.c|=
sqlite<br>
+LIBPYTHON3_EXTENSIONS_SRCS-y +=3D $(LIBPYTHON3_SRC)/Modules/_sqlite/statem=
ent.c|sqlite<br>
+LIBPYTHON3_EXTENSIONS_SRCS-y +=3D $(LIBPYTHON3_SRC)/Modules/_sqlite/util.c=
|sqlite<br>
=C2=A0endif<br>
=C2=A0LIBPYTHON3_EXTENSIONS_SRCS-$(CONFIG_LIBPYTHON3_EXTENSION_SSL) +=3D $(=
LIBPYTHON3_SRC)/Modules/_ssl.c<br>
=C2=A0LIBPYTHON3_EXTENSIONS_SRCS-y +=3D $(LIBPYTHON3_SRC)/Modules/_struct.c=
<br>
diff --git a/modules_config.c b/modules_config.c<br>
index 7772d00..1bb591c 100644<br>
--- a/modules_config.c<br>
+++ b/modules_config.c<br>
@@ -145,6 +145,10 @@ extern PyObject* PyInit_zipimport(void);<br>
=C2=A0#ifdef CONFIG_LIBZLIB<br>
=C2=A0extern PyObject* PyInit_zlib(void);<br>
=C2=A0#endif<br>
+#if CONFIG_LIBPYTHON3_EXTENSION_SQLITE<br>
+extern PyObject* PyInit__sqlite3(void);<br>
+#endif<br>
+<br>
=C2=A0/* Unikraft Marker end */<br>
=C2=A0/* -- ADDMODULE MARKER 1 -- */<br>
<br>
-- <br>
2.27.0<br>
<br>
<br>
</blockquote></div>

--000000000000c8e99005ba0a8bca--


From minios-devel-bounces@lists.xenproject.org Fri Jan 29 14:54:26 2021
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Fri, 29 Jan 2021 14:54:26 +0000
Received: from list by lists.xenproject.org with outflank-mailman.78201.142157 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1l5VAF-00051S-Pk; Fri, 29 Jan 2021 14:54:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 78201.142157; Fri, 29 Jan 2021 14:54:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1l5VAF-00051L-Mo; Fri, 29 Jan 2021 14:54:23 +0000
Received: by outflank-mailman (input) for mailman id 78201;
 Fri, 29 Jan 2021 14:54:22 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <SRS0=DSqt=HA=gmail.com=razvand@srs-us1.protection.inumbo.net>)
 id 1l5VAE-00051G-9K
 for minios-devel@lists.xen.org; Fri, 29 Jan 2021 14:54:22 +0000
Received: from mail-wm1-x32d.google.com (unknown [2a00:1450:4864:20::32d])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 4d4169ba-17e2-44ed-879d-fd90f593f7ed;
 Fri, 29 Jan 2021 14:54:21 +0000 (UTC)
Received: by mail-wm1-x32d.google.com with SMTP id f16so7044295wmq.5
 for <minios-devel@lists.xen.org>; Fri, 29 Jan 2021 06:54:21 -0800 (PST)
Received: from localhost ([141.85.225.206])
 by smtp.gmail.com with ESMTPSA id f17sm13396579wrv.0.2021.01.29.06.54.19
 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256);
 Fri, 29 Jan 2021 06:54: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
X-Inumbo-ID: 4d4169ba-17e2-44ed-879d-fd90f593f7ed
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=0WvgFz9cLaWZ2Pt9Du6e94AGPo82YbMEC1m1S272Yjc=;
        b=NF0D0BP/v1EzhYRSyvr9ZLq2aShsPz1lOzwM9pppHE1j+vnespiefDJZHtFBpKJR3Y
         QcNwSUEDkKvlqSKtTlNRPu8FzIww0pmSh0hB9AbfIPxYXhSvJimw75QkFtZcZTJnvwtR
         rR/r7XenCJjvhKwyUGZiGWRdPOWeu78ppm2kq6VM8MSchwl1TDWeGwGMNl6gTY1MJcHR
         5yQ8lw1INKM9aNufvZ7OOyYmp/E3zDuTZerodX1HiDI6+hUw44JaTw64NutFspsNXq0w
         8u+Ji/ZQb+/XCbMu1Q3TtwmfoQlym6atUU7WMGGD2pw7YrOq/4QfbW6GFUv07ViIEf5x
         zX2A==
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=0WvgFz9cLaWZ2Pt9Du6e94AGPo82YbMEC1m1S272Yjc=;
        b=n3C4gEPyNV2SR4XqFDaafG/r5fICVTvFVQa6Zh8FgUY8+O3Hsn6DiG+g1GQHHSapLc
         E0+jZ60BCeVJ024l813eITrcXAC8IpqYkeWNEnqiiSjypO+TqzhudsfEfRydOMCWeOsZ
         2w1OLX8V4y/L1jeGJpdndxqJ2WOgSmfv5JjtNeBj9FLzDgq0jnHhMbrb//NWGABBR3Ec
         I1rhNyRPOT8uPPZLy4j1zgsZ6XJSDsfOIYjhzc9iGYl/80nCG51LqiTk6yTkwnVAS82/
         Lf4ZLalRUeGIFz+PJfZguZehWz6GKRs6TkGcImVdGRsKbeVHRav+rJeP67rC4Ja+3sqS
         Qmbg==
X-Gm-Message-State: AOAM532SNNGW0/lThMBWFzW+jH6drUGwntXKY6FoNB41mw+sD4nCNnQM
	eSC4W6aaWCMdTp+lmwtz1eo=
X-Google-Smtp-Source: ABdhPJylbjTqnlsAXHOMd/7MAr67UD0kAwoL+SHLJjJc0i4Z2GoVBaWBtaLyfKq1m6FmrEY68vkyuw==
X-Received: by 2002:a1c:e443:: with SMTP id b64mr4261163wmh.136.1611932060306;
        Fri, 29 Jan 2021 06:54:20 -0800 (PST)
Sender: Razvan Deaconescu <razvand@gmail.com>
From: Razvan Deaconescu <razvan.deaconescu@cs.pub.ro>
To: Vlad-Andrei Badoiu <vlad_andrei.badoiu@upb.ro>
Cc: minios-devel@lists.xen.org,  felipe.huici@neclab.eu
Subject: Re: [UNIKRAFT PATCH 1/1] lib/posix-libdl: Add dlvsym stub
References: <20201129150311.122761-1-vlad_andrei.badoiu@upb.ro>
Date: Fri, 29 Jan 2021 16:54:18 +0200
In-Reply-To: <20201129150311.122761-1-vlad_andrei.badoiu@upb.ro> (Vlad-Andrei
	Badoiu's message of "Sun, 29 Nov 2020 17:03:11 +0200")
Message-ID: <86y2gbdc9x.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

I'm relaying this message from Sergiu Moga; he couldn't reply to an
e-mail he hadn't received (he wasn't subscribed to the mailing list).

Hello Vlad,

The patch looks good!

Reviewed-by: Sergiu Moga <serjueovp@gmail.com>

Vlad-Andrei Badoiu <vlad_andrei.badoiu@upb.ro> writes:
> Signed-off-by: Vlad-Andrei Badoiu <vlad_andrei.badoiu@upb.ro>
> ---
>  lib/posix-libdl/exportsyms.uk   | 3 ++-
>  lib/posix-libdl/include/dlfcn.h | 1 +
>  lib/posix-libdl/stubs.c         | 4 ++++
>  3 files changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/lib/posix-libdl/exportsyms.uk b/lib/posix-libdl/exportsyms.uk
> index 77c7a542..d570a578 100644
> --- a/lib/posix-libdl/exportsyms.uk
> +++ b/lib/posix-libdl/exportsyms.uk
> @@ -3,4 +3,5 @@ dlclose
>  dlsym
>  dlerror
>  dladdr
> -dlinfo
> \ No newline at end of file
> +dlinfo
> +dlvsym
> diff --git a/lib/posix-libdl/include/dlfcn.h b/lib/posix-libdl/include/dlfcn.h
> index 706245a5..6cb6cf52 100644
> --- a/lib/posix-libdl/include/dlfcn.h
> +++ b/lib/posix-libdl/include/dlfcn.h
> @@ -58,6 +58,7 @@ typedef struct {
>  } Dl_info;
>  int dladdr(const void *, Dl_info *);
>  int dlinfo(void *, int, void *);
> +void *dlvsym(void *handle, const char *symbol, const char *version);
>  
>  #ifdef __cplusplus
>  }
> diff --git a/lib/posix-libdl/stubs.c b/lib/posix-libdl/stubs.c
> index dbfac7d1..8f5ee384 100644
> --- a/lib/posix-libdl/stubs.c
> +++ b/lib/posix-libdl/stubs.c
> @@ -67,3 +67,7 @@ int dlinfo(void *handle __unused, int request __unused, void *info __unused)
>  {
>  	return 0;
>  }
> +
> +void *dlvsym(void *handle, const char *symbol, const char *version)
> +{
> +}


From minios-devel-bounces@lists.xenproject.org Fri Jan 29 14:57:09 2021
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Fri, 29 Jan 2021 14:57:09 +0000
Received: from list by lists.xenproject.org with outflank-mailman.77421.142161 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1l5VCv-00054k-1X; Fri, 29 Jan 2021 14:57:09 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 77421.142161; Fri, 29 Jan 2021 14:57: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 1l5VCu-00054d-Ul; Fri, 29 Jan 2021 14:57:08 +0000
Received: by outflank-mailman (input) for mailman id 77421;
 Thu, 28 Jan 2021 18:50: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=HTaP=G7=gmail.com=serjueovp@srs-us1.protection.inumbo.net>)
 id 1l5CNI-0005Jr-Qy
 for minios-devel@lists.xen.org; Thu, 28 Jan 2021 18:50:36 +0000
Received: from mail-ej1-x631.google.com (unknown [2a00:1450:4864:20::631])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 6a20bb78-8390-477c-ae45-59d1be2d7056;
 Thu, 28 Jan 2021 18:50:35 +0000 (UTC)
Received: by mail-ej1-x631.google.com with SMTP id hs11so9357119ejc.1
 for <minios-devel@lists.xen.org>; Thu, 28 Jan 2021 10:50:35 -0800 (PST)
Received: from localhost.localdomain ([82.79.100.26])
 by smtp.googlemail.com with ESMTPSA id gb14sm2564040ejc.61.2021.01.28.10.50.34
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Thu, 28 Jan 2021 10:50: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: 6a20bb78-8390-477c-ae45-59d1be2d7056
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=Pr664QceLd/ho4RmyG9Xy8/xU5aSc7pFUGvBJUAV28w=;
        b=LL8/76osqQ3ZW3f5JriAC39MrBk74l7NV4utZU8QFBv29r0TzQWW9UTsmSlSza4AOf
         4DLD0ISmq6mih/cIRMzSMmrf0ejl5CPY0oszSZivFwl6WudoxGx3Um7FrNCc6JYWjL0I
         Sae003TASqV4Dkb8EBxsx9OxDcBCkf+wdY1ObEbn53slyL7s0JF2sg2fLMLCKSoAtXYx
         ymyRHxhWcQ1BBW6EsXs6/lZeUBN9PjvVYWcBYiFg4oDBgE6U8a9gHwonWe+TNP3rENM1
         fgXHI9NSFhiz14btIZf/w1Mt0YuKthz65/WMTarCKa72ZW6I5M3K1rlJ+MAzuT+YVu49
         klJQ==
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=Pr664QceLd/ho4RmyG9Xy8/xU5aSc7pFUGvBJUAV28w=;
        b=bpMXAhatfrPhKCGYLqlRUzru7yJnUnUHpTt37/qyTfFXqFTnlSqXJBxpBxfiqit7oR
         XHataZUKQR8aT7WZ79BkP4N9bZy9RQq2geuuCBcfkO+SDGN9XPR5t/maO6Pjsr7yLy1a
         GZo6hDgWzPdHpGTfxfuHQvbSzIeqbJZDBTSOnjoPVWAbNQ/9PJMhw5GyPWck/rN9KtH2
         kHXEz4EShZFUh2q2CxufPfk0UNmONUYtM/XF3vWL/kaYnR+ULe2y1NdxD7ihFpnkz32b
         h3UVLKEXtnyhskvxOb6Kp+WidEHtpamZz8pquWnE1dfiJHyOY7M5czemTzbC9exy5c5a
         bLdQ==
X-Gm-Message-State: AOAM5316pfxxzghL2h5+5syCSvr/lk6rvwzjE21zx0M0zfyW79AoKD1U
	3BbGCFcazhFK885LOSlke+I=
X-Google-Smtp-Source: ABdhPJwi1m+5OlQ8Ita1Llg0fBxVK9tPuLiXuvx9ESPy4V1d7BtqCZ1CSXnoR2AxTCNdAxEECWY12Q==
X-Received: by 2002:a17:906:4e0c:: with SMTP id z12mr815919eju.370.1611859835045;
        Thu, 28 Jan 2021 10:50:35 -0800 (PST)
From: Sergiu Moga <serjueovp@gmail.com>
To: vlad_andrei.badoiu@upb.ro
Cc: minios-devel@lists.xen.org,
	Sergiu Moga <serjueovp@gmail.com>
Subject: Re: [1/1] lib/posix-libdl: Add dlvsym stub
Date: Thu, 28 Jan 2021 20:50:24 +0200
Message-Id: <20210128185024.16306-1-serjueovp@gmail.com>
X-Mailer: git-send-email 2.25.1
In-Reply-To: <20201129150311.122761-1-vlad_andrei.badoiu@upb.ro>
References: <20201129150311.122761-1-vlad_andrei.badoiu@upb.ro>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit

Hello Vlad,

The patch looks good!

Reviewed-by: Sergiu Moga <serjueovp@gmail.com>


From minios-devel-bounces@lists.xenproject.org Fri Jan 29 14:57:10 2021
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Fri, 29 Jan 2021 14:57:10 +0000
Received: from list by lists.xenproject.org with outflank-mailman.78192.142164 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1l5VCv-000554-4Q; Fri, 29 Jan 2021 14:57:09 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 78192.142164; Fri, 29 Jan 2021 14:57: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 1l5VCu-00054p-WE; Fri, 29 Jan 2021 14:57:09 +0000
Received: by outflank-mailman (input) for mailman id 78192;
 Fri, 29 Jan 2021 14:31: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=KNcH=HA=gmail.com=serjueovp@srs-us1.protection.inumbo.net>)
 id 1l5UoT-0002nv-RR
 for minios-devel@lists.xen.org; Fri, 29 Jan 2021 14:31:53 +0000
Received: from mail-ed1-x530.google.com (unknown [2a00:1450:4864:20::530])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 80dc80f5-4b11-496c-bbe8-63bed641935d;
 Fri, 29 Jan 2021 14:31:53 +0000 (UTC)
Received: by mail-ed1-x530.google.com with SMTP id c6so10800686ede.0
 for <minios-devel@lists.xen.org>; Fri, 29 Jan 2021 06:31:52 -0800 (PST)
Received: from localhost.localdomain ([82.79.100.26])
 by smtp.googlemail.com with ESMTPSA id x20sm3835709ejv.66.2021.01.29.06.31.51
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Fri, 29 Jan 2021 06:31: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: 80dc80f5-4b11-496c-bbe8-63bed641935d
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=Pr664QceLd/ho4RmyG9Xy8/xU5aSc7pFUGvBJUAV28w=;
        b=rPyt9RdP2FkhT1dBFxe3NGpDANZFGKp8JyTMde39AMiYZ9SBAP+dOUtbJOa86xW1c2
         snMqtc0An7YPHpWz6ASHsB3uuzBVbGJD7grFs0mQoUtyrvN25ZItHqCXqcqzcO6EMNBU
         JbFhlUfY7G0231kDg0Bv58ym2SRonk0DJlJSEtegQSH9uV2GJ/fmniqwMvoQkEZtjMtU
         7ahVqO1N7/pwLsBSo9xWupzPkyA95rol2oLWDIMBAWWotY9V3hozRHXTiGCv9VlK9s9k
         dsq2r+PUhfToQFcEjxwc22o/+3phAw60ccJUEYN+bzJgY02kwA1pnCN2/9KG876Igz4B
         xLwQ==
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=Pr664QceLd/ho4RmyG9Xy8/xU5aSc7pFUGvBJUAV28w=;
        b=fBR8S+HCk53wTkzYcLLzYtYB7ARIZif4LAKai+NrSkDrlA77GR5TohRCMtLkqdySjA
         M6B9r288JmERxhrqB5hZm4xpeeuP9vKKJJXkJKVsPNTOlWmoC6RHY4UpDVH89KRWvaA6
         blxewCxTyCB+JEDwjs+Mef3fsrbvEXPEMyyl1QDV31x3GNdZOQr8IPXjlEiN6NoR6MBv
         FoY9u5Pl95Qb7FhJsSy4ffSHJuzWnZC4NMd+UYbr4jtFA+f8fWlhJZqYlakXbjGVchFZ
         4Rws1e195G3iKwwmuKY5cTeFfG/n3KDt9MwAoNfhjqFw4bkleyFjXc2Qs4nq4jZlEnaJ
         UuZQ==
X-Gm-Message-State: AOAM531ghlpyF0L4BvKb/es0H9+b8BcqB1rB2t5blD1WPMegYHmErkeu
	xQny+4Xvt/kjsS696qDnO0Y=
X-Google-Smtp-Source: ABdhPJze7gq6u711ivdAWRbfi5uV+vl/jenpAIoGOiRieupz9HLZDOfiqJAkwlm9Pmj3OFjHuUh0iw==
X-Received: by 2002:a05:6402:149:: with SMTP id s9mr5345975edu.247.1611930712154;
        Fri, 29 Jan 2021 06:31:52 -0800 (PST)
From: Sergiu Moga <serjueovp@gmail.com>
To: vlad_andrei.badoiu@upb.ro
Cc: minios-devel@lists.xen.org,
	Sergiu Moga <serjueovp@gmail.com>
Subject: Re: [1/1] lib/posix-libdl: Add dlvsym stub
Date: Fri, 29 Jan 2021 16:31:43 +0200
Message-Id: <20210129143143.13185-1-serjueovp@gmail.com>
X-Mailer: git-send-email 2.25.1
In-Reply-To: <20201129150311.122761-1-vlad_andrei.badoiu@upb.ro>
References: <20201129150311.122761-1-vlad_andrei.badoiu@upb.ro>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit

Hello Vlad,

The patch looks good!

Reviewed-by: Sergiu Moga <serjueovp@gmail.com>


From minios-devel-bounces@lists.xenproject.org Sun Jan 31 10:32:49 2021
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Sun, 31 Jan 2021 10:32:49 +0000
Received: from list by lists.xenproject.org with outflank-mailman.79234.144282 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1l6A2B-0004Ui-Ip; Sun, 31 Jan 2021 10:32:47 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 79234.144282; Sun, 31 Jan 2021 10: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 1l6A2B-0004UT-Ce; Sun, 31 Jan 2021 10:32:47 +0000
Received: by outflank-mailman (input) for mailman id 79234;
 Sun, 31 Jan 2021 10:32:46 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=3ac9=HC=upb.ro=vlad_andrei.badoiu@srs-us1.protection.inumbo.net>)
 id 1l6A2A-0004U8-KU
 for minios-devel@lists.xen.org; Sun, 31 Jan 2021 10:32:46 +0000
Received: from mx.upb.ro (unknown [141.85.13.220])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 73b75a2a-9593-40df-9077-9034403763f3;
 Sun, 31 Jan 2021 10:32:42 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
 by mx.upb.ro (Postfix) with ESMTP id E9807B560068;
 Sun, 31 Jan 2021 12:32:40 +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 Kb4bvM3Ht97v; Sun, 31 Jan 2021 12:32:38 +0200 (EET)
Received: from localhost (localhost [127.0.0.1])
 by mx.upb.ro (Postfix) with ESMTP id D81B9B560095;
 Sun, 31 Jan 2021 12:32:38 +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 YqFk3lccLuHJ; Sun, 31 Jan 2021 12:32:38 +0200 (EET)
Received: from localhost.localdomain (unknown [86.121.175.249])
 by mx.upb.ro (Postfix) with ESMTPSA id B914DB56008A;
 Sun, 31 Jan 2021 12:32:38 +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: 73b75a2a-9593-40df-9077-9034403763f3
DKIM-Filter: OpenDKIM Filter v2.10.3 mx.upb.ro D81B9B560095
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=upb.ro;
	s=96342B8A-77E4-11E5-BA93-D93D0963A2DF; t=1612089158;
	bh=4u9EP8dL3qlUtSrKf/6FCUghhuQdQkWBzHFXvmPdRJM=;
	h=From:To:Date:Message-Id:MIME-Version;
	b=L5Wo3j4Cytv3lmS5LnRc1vM3olBaeaeh6d5HZXfsQ/wma5TksoON9l5a9WC4r9N1f
	 MAVW9ZU5SQ8YDslb6h8jqn99JAt6KZrnpiP8c0CnqGlu4+4NEuJuEdfS2BS8DOdMAa
	 dfWI6UjyGVZattGIxKTIvFXMrts5m4XEpZ0X3Qac=
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,
	Vlad-Andrei Badoiu <vlad_andrei.badoiu@upb.ro>,
	Alice Suiu <alicesuiu17@gmail.com>
Subject: [UNIKRAFT PATCH v4 2/3] support/build: Add build functions for clang and gcc check
Date: Sun, 31 Jan 2021 12:32:33 +0200
Message-Id: <20210131103234.32867-3-vlad_andrei.badoiu@upb.ro>
X-Mailer: git-send-email 2.27.0
In-Reply-To: <20210131103234.32867-1-vlad_andrei.badoiu@upb.ro>
References: <20210131103234.32867-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>
Reviewed-by: Razvan Deaconescu <razvan.deaconescu@cs.pub.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 Jan 31 10:32:49 2021
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Sun, 31 Jan 2021 10:32:49 +0000
Received: from list by lists.xenproject.org with outflank-mailman.79233.144275 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1l6A2B-0004UO-Ep; Sun, 31 Jan 2021 10:32:47 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 79233.144275; Sun, 31 Jan 2021 10: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 1l6A2B-0004UH-BF; Sun, 31 Jan 2021 10:32:47 +0000
Received: by outflank-mailman (input) for mailman id 79233;
 Sun, 31 Jan 2021 10:32: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=3ac9=HC=upb.ro=vlad_andrei.badoiu@srs-us1.protection.inumbo.net>)
 id 1l6A2A-0004U7-2i
 for minios-devel@lists.xen.org; Sun, 31 Jan 2021 10:32:46 +0000
Received: from mx.upb.ro (unknown [141.85.13.200])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 734f53cd-0714-456d-9a16-0718fac7363c;
 Sun, 31 Jan 2021 10:32:42 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
 by mx.upb.ro (Postfix) with ESMTP id A14A8B56008E;
 Sun, 31 Jan 2021 12:32:40 +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 qHpCACcZWHL4; Sun, 31 Jan 2021 12:32:38 +0200 (EET)
Received: from localhost (localhost [127.0.0.1])
 by mx.upb.ro (Postfix) with ESMTP id D4197B560068;
 Sun, 31 Jan 2021 12:32:38 +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 qHVo9Xwqb-5L; Sun, 31 Jan 2021 12:32:38 +0200 (EET)
Received: from localhost.localdomain (unknown [86.121.175.249])
 by mx.upb.ro (Postfix) with ESMTPSA id A8331B56007B;
 Sun, 31 Jan 2021 12:32:38 +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: 734f53cd-0714-456d-9a16-0718fac7363c
DKIM-Filter: OpenDKIM Filter v2.10.3 mx.upb.ro D4197B560068
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=upb.ro;
	s=96342B8A-77E4-11E5-BA93-D93D0963A2DF; t=1612089158;
	bh=CA3b542DKduh0vIgLoDP85ye+3W0vF6hmqnX42m85eM=;
	h=From:To:Date:Message-Id:MIME-Version;
	b=f4P+BmVsyxk6VBsL5yK8fIr0lCm4woOgp0v+K3v4SW/5Xrhi6KW51zCQuxP07jofJ
	 zPJd2n5F/mFPyzH5IukuvZS5JjSxXApywjqJ5fnmjSKjO1zqJQboVOICe5sTRDZfJU
	 W7vkTQx0F9PRPSK0pZeAxCjojUq2H6KY+Oq+CiMg=
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,
	Vlad-Andrei Badoiu <vlad_andrei.badoiu@upb.ro>,
	Alice Suiu <alicesuiu17@gmail.com>
Subject: [UNIKRAFT PATCH v4 1/3] build: Option to configure the compiler
Date: Sun, 31 Jan 2021 12:32:32 +0200
Message-Id: <20210131103234.32867-2-vlad_andrei.badoiu@upb.ro>
X-Mailer: git-send-email 2.27.0
In-Reply-To: <20210131103234.32867-1-vlad_andrei.badoiu@upb.ro>
References: <20210131103234.32867-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>
Reviewed-by: Razvan Deaconescu <razvan.deaconescu@cs.pub.ro>
---
 Makefile | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/Makefile b/Makefile
index 8e14817..c22dbad 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 Jan 31 10:32:51 2021
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Sun, 31 Jan 2021 10:32:51 +0000
Received: from list by lists.xenproject.org with outflank-mailman.79235.144284 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1l6A2F-0004Vh-IM; Sun, 31 Jan 2021 10:32:51 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 79235.144284; Sun, 31 Jan 2021 10:32: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 1l6A2F-0004VZ-Eu; Sun, 31 Jan 2021 10:32:51 +0000
Received: by outflank-mailman (input) for mailman id 79235;
 Sun, 31 Jan 2021 10:32: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=3ac9=HC=upb.ro=vlad_andrei.badoiu@srs-us1.protection.inumbo.net>)
 id 1l6A2E-0004U7-RR
 for minios-devel@lists.xen.org; Sun, 31 Jan 2021 10:32:50 +0000
Received: from mx.upb.ro (unknown [141.85.13.230])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 27064c8e-f42f-4401-ac56-796f82d008c5;
 Sun, 31 Jan 2021 10:32:42 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
 by mx.upb.ro (Postfix) with ESMTP id 3E450B560093;
 Sun, 31 Jan 2021 12:32:41 +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 or8u_Mlxwvxz; Sun, 31 Jan 2021 12:32:39 +0200 (EET)
Received: from localhost (localhost [127.0.0.1])
 by mx.upb.ro (Postfix) with ESMTP id F0DB2B56007B;
 Sun, 31 Jan 2021 12:32:38 +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 THOTt_IvFD31; Sun, 31 Jan 2021 12:32:38 +0200 (EET)
Received: from localhost.localdomain (unknown [86.121.175.249])
 by mx.upb.ro (Postfix) with ESMTPSA id C95D8B560093;
 Sun, 31 Jan 2021 12:32:38 +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: 27064c8e-f42f-4401-ac56-796f82d008c5
DKIM-Filter: OpenDKIM Filter v2.10.3 mx.upb.ro F0DB2B56007B
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=upb.ro;
	s=96342B8A-77E4-11E5-BA93-D93D0963A2DF; t=1612089159;
	bh=rsA0t8Mzwy7CHf0W8C9Tichu+e0lJTCswJBnJa1n7Xw=;
	h=From:To:Date:Message-Id:MIME-Version;
	b=iHlQVlV5OnMTfOvk6Of+5QLpUz8R7LyajB1AddM0EM6dIXL1RsXGr1rkX6ygsG1yf
	 ypI+xmLLIvTRDINU5JMyxRUjsOXAPF39Z2ms2AvHNsyGzrKSM4sK82IE7S0vrUFLNZ
	 jsNq/psyaDWVSBgmad552mEk6Q7auPI1+Bn2egW4=
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,
	Vlad-Andrei Badoiu <vlad_andrei.badoiu@upb.ro>,
	Alice Suiu <alicesuiu17@gmail.com>
Subject: [UNIKRAFT PATCH v4 3/3] build: Add support for clang
Date: Sun, 31 Jan 2021 12:32:34 +0200
Message-Id: <20210131103234.32867-4-vlad_andrei.badoiu@upb.ro>
X-Mailer: git-send-email 2.27.0
In-Reply-To: <20210131103234.32867-1-vlad_andrei.badoiu@upb.ro>
References: <20210131103234.32867-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 c22dbad..b12dc8b 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..9f0da22 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..c4d5109 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
 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 Jan 31 10:32:52 2021
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Sun, 31 Jan 2021 10:32:52 +0000
Received: from list by lists.xenproject.org with outflank-mailman.79236.144288 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1l6A2G-0004WN-JP; Sun, 31 Jan 2021 10:32:52 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 79236.144288; Sun, 31 Jan 2021 10:32: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 1l6A2G-0004WG-GR; Sun, 31 Jan 2021 10:32:52 +0000
Received: by outflank-mailman (input) for mailman id 79236;
 Sun, 31 Jan 2021 10: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=3ac9=HC=upb.ro=vlad_andrei.badoiu@srs-us1.protection.inumbo.net>)
 id 1l6A2F-0004U8-FK
 for minios-devel@lists.xen.org; Sun, 31 Jan 2021 10:32:51 +0000
Received: from mx.upb.ro (unknown [141.85.13.5])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id e4c3fc15-fbdd-4ac4-8fe0-6d2eae3af08f;
 Sun, 31 Jan 2021 10:32:42 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
 by mx.upb.ro (Postfix) with ESMTP id 809E6B56008A
 for <minios-devel@lists.xen.org>; Sun, 31 Jan 2021 12:32:40 +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 8zV1xwG1zaxp; Sun, 31 Jan 2021 12:32:38 +0200 (EET)
Received: from localhost (localhost [127.0.0.1])
 by mx.upb.ro (Postfix) with ESMTP id BBA87B56008E;
 Sun, 31 Jan 2021 12:32:38 +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 TCXbIpllmyJ8; Sun, 31 Jan 2021 12:32:38 +0200 (EET)
Received: from localhost.localdomain (unknown [86.121.175.249])
 by mx.upb.ro (Postfix) with ESMTPSA id 99FEEB560068;
 Sun, 31 Jan 2021 12:32:38 +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: e4c3fc15-fbdd-4ac4-8fe0-6d2eae3af08f
DKIM-Filter: OpenDKIM Filter v2.10.3 mx.upb.ro BBA87B56008E
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=upb.ro;
	s=96342B8A-77E4-11E5-BA93-D93D0963A2DF; t=1612089158;
	bh=+4tLEdyERbdYAioGB32Fm6k1xE7o3lGLo4JjFX+D4EI=;
	h=From:To:Date:Message-Id:MIME-Version;
	b=X4g4hqvjL0ScLxPKo/+oE5Uw76tH+vj9CA3pCz8733jtVWBz5blTqtrZ+kPgVkRbP
	 bwPIOqRVVrg5gpx7et4+ShPd0AklA9FwXU+p/WAN5/WDFDYMqZxOEcGIIQqtYhuukx
	 iQEQqeQOt++PEaHSq/8gzcBJYIytM2ce1Qdp/itc=
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,
	Vlad-Andrei Badoiu <vlad_andrei.badoiu@upb.ro>
Subject: [UNIKRAFT PATCH v4 0/3] Add clang support
Date: Sun, 31 Jan 2021 12:32:31 +0200
Message-Id: <20210131103234.32867-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

Changes since v3:
- Fixed several style issues

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 Jan 31 10:52:44 2021
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Sun, 31 Jan 2021 10:52:44 +0000
Received: from list by lists.xenproject.org with outflank-mailman.79250.144312 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1l6ALT-0006eU-DI; Sun, 31 Jan 2021 10:52:43 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 79250.144312; Sun, 31 Jan 2021 10:52:43 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1l6ALT-0006eN-AJ; Sun, 31 Jan 2021 10:52:43 +0000
Received: by outflank-mailman (input) for mailman id 79250;
 Sun, 31 Jan 2021 10:52:42 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=3ac9=HC=upb.ro=vlad_andrei.badoiu@srs-us1.protection.inumbo.net>)
 id 1l6ALS-0006eF-1i
 for minios-devel@lists.xen.org; Sun, 31 Jan 2021 10:52:42 +0000
Received: from mx.upb.ro (unknown [141.85.13.210])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 729eff32-7299-4f06-9344-a2b933d42acd;
 Sun, 31 Jan 2021 10:52:39 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
 by mx.upb.ro (Postfix) with ESMTP id 5D965B560068;
 Sun, 31 Jan 2021 12:52:38 +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 Oj6NY_oheI2o; Sun, 31 Jan 2021 12:52:36 +0200 (EET)
Received: from localhost (localhost [127.0.0.1])
 by mx.upb.ro (Postfix) with ESMTP id 63BC4B56007B;
 Sun, 31 Jan 2021 12:52:36 +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 Lm4L05NqcUYa; Sun, 31 Jan 2021 12:52:36 +0200 (EET)
Received: from localhost.localdomain (unknown [86.121.175.249])
 by mx.upb.ro (Postfix) with ESMTPSA id 3D71EB560068;
 Sun, 31 Jan 2021 12:52:36 +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: 729eff32-7299-4f06-9344-a2b933d42acd
DKIM-Filter: OpenDKIM Filter v2.10.3 mx.upb.ro 63BC4B56007B
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=upb.ro;
	s=96342B8A-77E4-11E5-BA93-D93D0963A2DF; t=1612090356;
	bh=H6ei93Hjm0ie52RRNuV13eU0kuRijx8O+3TDIdcEeGE=;
	h=From:To:Date:Message-Id:MIME-Version;
	b=gGeUtvYsyPv7rEG3UEKfJAViLHuzs64BgV4xSx3kP2dq1qW91H156qhGQiYtHudZW
	 SITbEWBwg0VGwl37e9uqMGiypD99qeyb+LA7fi/jke/xf2RpeNtHJZMYKjMJfHAS5G
	 OvpQELcyYQiFr3kqwo1Wp2qDFfjFOlult52TQ6BA=
X-Virus-Scanned: amavisd-new at upb.ro
From: Vlad-Andrei Badoiu <vlad_andrei.badoiu@upb.ro>
To: minios-devel@lists.xen.org
Cc: felipehuici@gmail.com,
	Vlad-Andrei Badoiu <vlad_andrei.badoiu@upb.ro>
Subject: [UNIKRAFT PATCH 1/1] Add missing symbols to exportsyms.uk
Date: Sun, 31 Jan 2021 12:52:33 +0200
Message-Id: <20210131105233.35176-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>
---
 lib/posix-user/exportsyms.uk | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)

diff --git a/lib/posix-user/exportsyms.uk b/lib/posix-user/exportsyms.uk
index 31caec2..91302c3 100644
--- a/lib/posix-user/exportsyms.uk
+++ b/lib/posix-user/exportsyms.uk
@@ -18,3 +18,26 @@ uk_syscall_r_getppid
 getpgid
 uk_syscall_e_getpgid
 uk_syscall_r_getpgid
+seteuid
+getresuid
+setresuid
+setreuid
+getlogin
+setpwent
+endpwent
+getpwnam_r
+getpwuid_r
+getpwent
+getgid
+setgid
+getegid
+setegid
+getresgid
+setresgid
+setregid
+getgroups
+setgroups
+getgrnam_r
+setgrent
+endgrent
+getgrent
--=20
2.27.0



From minios-devel-bounces@lists.xenproject.org Sun Jan 31 23:29:39 2021
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Sun, 31 Jan 2021 23:29:39 +0000
Received: from list by lists.xenproject.org with outflank-mailman.79471.144616 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1l6M9u-0004ly-EG; Sun, 31 Jan 2021 23:29:34 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 79471.144616; Sun, 31 Jan 2021 23:29: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 1l6M9u-0004lr-BU; Sun, 31 Jan 2021 23:29:34 +0000
Received: by outflank-mailman (input) for mailman id 79471;
 Sun, 31 Jan 2021 23:29: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=YQSI=HC=gmail.com=razvand@srs-us1.protection.inumbo.net>)
 id 1l6M9s-0004lm-SD
 for minios-devel@lists.xen.org; Sun, 31 Jan 2021 23:29:32 +0000
Received: from mail-wm1-x332.google.com (unknown [2a00:1450:4864:20::332])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 78ebcd50-b283-4ffc-a524-39fb86794996;
 Sun, 31 Jan 2021 23:29:30 +0000 (UTC)
Received: by mail-wm1-x332.google.com with SMTP id u14so11080886wml.4
 for <minios-devel@lists.xen.org>; Sun, 31 Jan 2021 15:29:30 -0800 (PST)
Received: from localhost ([141.85.225.206])
 by smtp.gmail.com with ESMTPSA id q6sm18712010wmj.32.2021.01.31.15.29.28
 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256);
 Sun, 31 Jan 2021 15:29: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
X-Inumbo-ID: 78ebcd50-b283-4ffc-a524-39fb86794996
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=9UBCIM+B4gia7z1rMm/qaYyivGVvpSCdjTULjbOS3aE=;
        b=pL+Nnfk4y0G8O5oY7Pt6wJK7kP7AudiET3ue3fBww+U3oo9LVwBrOqyivU0f1tWkm9
         ivddl3F5+IAcSvx4ZA/RDja8QQQN4g2OMg3xbME3xoa1mHNMphN+jqqIdfB/QUCCMJT/
         04SI023+kE3PahCKXWr1djxeSRB6+X9exKes8Ja9F+39wf54YLi54bHh7HhjsdwiGFks
         2g9o/us8pBT7bBciEKPcR5kOF9jRAD1AGbaqbIhjwhYZDNGITHMD1r5skKkbAi/ppHrl
         4qZyy1DC+8dpcicKDZdDTHI4zdZFWdR3TkPt+HekqJdr9jvBmHLZcEzDWQYfpmFH16wm
         5LMA==
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=9UBCIM+B4gia7z1rMm/qaYyivGVvpSCdjTULjbOS3aE=;
        b=Y9uH8FlRSlxGWZI7u2682Khno99cXwxXkXi7G+DcpMIoQO3zi6sVGlo/v0bpULmS3S
         uCCP4PP6Yt7SFA45F3pjInrvu6luhvFSL0eiHhxdkAOjZ5rKSr2+zPFT+qs+dEUs2wRs
         WIkmigPVLvd/x+XpGqtZUEMlm+8+5OvH4PR4nxqMy0++M8Rn/nIyF/PFyl9fDbwvtP6m
         uy7VgG6Pa4Qcl+57oYzO0I9Ic3R03pfGpMDD24np8+oTcQevCig6bzjVQs6OF3SD7LMC
         wWf7tQTWa3Y3fuQyK4KgD/z3lh7/PvkvFxaezVjBQqW4v4XTDVjg9Hucm58+dMn085au
         /fRA==
X-Gm-Message-State: AOAM530XH6YpoqWW8LE4hJ008uD41LANzfm/Qa/p8493vc2Cm858l3Iu
	c/iOUh4C9NnfK5lTWpcWhCk=
X-Google-Smtp-Source: ABdhPJwJBVGm9+//dMwDWVUQ8LzJVitKX2ALrsWuY1BT8M0FvZ/F2gqXTugYmF/OkQYw9AtXvs3Ttg==
X-Received: by 2002:a1c:27c3:: with SMTP id n186mr12592846wmn.96.1612135769429;
        Sun, 31 Jan 2021 15:29:29 -0800 (PST)
Sender: Razvan Deaconescu <razvand@gmail.com>
From: Razvan Deaconescu <razvan.deaconescu@cs.pub.ro>
To: Vlad-Andrei Badoiu <vlad_andrei.badoiu@upb.ro>
Cc: minios-devel@lists.xen.org
Subject: Re: [UNIKRAFT PATCH v4 0/3] Add clang support
References: <20210131103234.32867-1-vlad_andrei.badoiu@upb.ro>
Date: Mon, 01 Feb 2021 01:29:28 +0200
In-Reply-To: <20210131103234.32867-1-vlad_andrei.badoiu@upb.ro> (Vlad-Andrei
	Badoiu's message of "Sun, 31 Jan 2021 12:32:31 +0200")
Message-ID: <86lfc8lm7b.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

Hi, Vlad.

This looks good. Thanks!

Razvan

Vlad-Andrei Badoiu <vlad_andrei.badoiu@upb.ro> writes:
> 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
>
> Changes since v3:
> - Fixed several style issues
>
> 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(-)


From minios-devel-bounces@lists.xenproject.org Sun Jan 31 23:29:46 2021
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Sun, 31 Jan 2021 23:29:46 +0000
Received: from list by lists.xenproject.org with outflank-mailman.79472.144620 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1l6MA6-0004mu-GV; Sun, 31 Jan 2021 23:29:46 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 79472.144620; Sun, 31 Jan 2021 23:29: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 1l6MA6-0004mm-DS; Sun, 31 Jan 2021 23:29:46 +0000
Received: by outflank-mailman (input) for mailman id 79472;
 Sun, 31 Jan 2021 23:29: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=YQSI=HC=gmail.com=razvand@srs-us1.protection.inumbo.net>)
 id 1l6MA5-0004mg-M2
 for minios-devel@lists.xen.org; Sun, 31 Jan 2021 23:29:45 +0000
Received: from mail-wm1-x32d.google.com (unknown [2a00:1450:4864:20::32d])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 5b3685f2-ab66-48f4-957d-09561cb72cde;
 Sun, 31 Jan 2021 23:29:44 +0000 (UTC)
Received: by mail-wm1-x32d.google.com with SMTP id u14so11626780wmq.4
 for <minios-devel@lists.xen.org>; Sun, 31 Jan 2021 15:29:44 -0800 (PST)
Received: from localhost ([141.85.225.206])
 by smtp.gmail.com with ESMTPSA id y6sm24297595wrp.6.2021.01.31.15.29.42
 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256);
 Sun, 31 Jan 2021 15:29: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
X-Inumbo-ID: 5b3685f2-ab66-48f4-957d-09561cb72cde
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=GH5dGah8rjnKQYCKQpA+ffMjf3T+PuFIE5VzKMF1JYI=;
        b=Qtj740hjPCLfLQ89l2ibQ0PGeBgrkWT1J/A35KPlAz4/xnro6lLOtaywk23VLBRwSL
         hxE8M+HXYqHgBbzn2Svgg+hneHjCYljX9EBJXAL4fiEU2vAq3ljvkFQoqYEwHPdauOF5
         u/WgT+pnYzCvIDPtNjGqimB4hWdZZSRU54CHNM+U2l9TSoLacCvaM+L+V4lYvXecf2TA
         dynL1aaaO7CJTj4iQlXgHd5b7+bJHlCFep3ZNFY3GfPZONqfOPGMjPM5DvFmQmYA16/M
         pMKBEILe7w2qIZRQxorNooUb6ADoGhINMUuL19fW8t8BfzXSzYvkWlvWJayTrSenJCSn
         9zgg==
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=GH5dGah8rjnKQYCKQpA+ffMjf3T+PuFIE5VzKMF1JYI=;
        b=LlOa23EbzIk0O6e0kEPU0VhTVLIHdxDbtl20QG/TVK6OYEGZ2iz0aSERshDkeR31a0
         zSmz0JGLAhtizftzCWcW054H3lChseFb17/jTA0D0pFLnft7ZK8skBsgm1oOf8zXXEM1
         el2VMH/tyUMiSwueTbT7vs/8rnqbedXfZftuC1bNNfReSDOt9Bz862cqHke1zT4EmAPf
         dms0CNoVqvsYSqHo5U5nGBXrGcm9PWCnk4btOt0sdhmDydJfyjcDdlYsU9eXbVzU8ivn
         TXuPLW0VdnPAVLyeEQLOTjogM5TRX59iKNFo6AXuqmcSYxaU2KpnMUtlXPtKu2uWnXgz
         wFdg==
X-Gm-Message-State: AOAM530w3Huar2reM91BbyT5/4E8p36S2mCDwy7s2UmYgwEbR5JejRRp
	B4EGU0igx1Y+RKMCvN1HMKE=
X-Google-Smtp-Source: ABdhPJywMv6KUi194xy+e51plJ7btcqrjbdpYGX9bJVp4cUmjlkEcz47o7akKihkZliKk9KpchbsAQ==
X-Received: by 2002:a1c:3185:: with SMTP id x127mr12254833wmx.117.1612135783302;
        Sun, 31 Jan 2021 15:29:43 -0800 (PST)
Sender: Razvan Deaconescu <razvand@gmail.com>
From: Razvan Deaconescu <razvan.deaconescu@cs.pub.ro>
To: Vlad-Andrei Badoiu <vlad_andrei.badoiu@upb.ro>
Cc: minios-devel@lists.xen.org,  Alice Suiu <alicesuiu17@gmail.com>
Subject: Re: [UNIKRAFT PATCH v4 2/3] support/build: Add build functions for clang and gcc check
References: <20210131103234.32867-1-vlad_andrei.badoiu@upb.ro>
	<20210131103234.32867-3-vlad_andrei.badoiu@upb.ro>
Date: Mon, 01 Feb 2021 01:29:42 +0200
In-Reply-To: <20210131103234.32867-3-vlad_andrei.badoiu@upb.ro> (Vlad-Andrei
	Badoiu's message of "Sun, 31 Jan 2021 12:32:33 +0200")
Message-ID: <86h7mwlm6x.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

All good.

Razvan

Vlad-Andrei Badoiu <vlad_andrei.badoiu@upb.ro> writes:
> 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>
> Reviewed-by: Razvan Deaconescu <razvan.deaconescu@cs.pub.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 = $(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)
> +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
>  
>  # print error and stop build when GCC version doesn't meet the minimum requirement


From minios-devel-bounces@lists.xenproject.org Sun Jan 31 23:30:11 2021
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Sun, 31 Jan 2021 23:30:11 +0000
Received: from list by lists.xenproject.org with outflank-mailman.79473.144624 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1l6MAV-0005UK-Iq; Sun, 31 Jan 2021 23:30:11 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 79473.144624; Sun, 31 Jan 2021 23:30: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 1l6MAV-0005UD-Fw; Sun, 31 Jan 2021 23:30:11 +0000
Received: by outflank-mailman (input) for mailman id 79473;
 Sun, 31 Jan 2021 23:30: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=YQSI=HC=gmail.com=razvand@srs-us1.protection.inumbo.net>)
 id 1l6MAU-0005U6-7D
 for minios-devel@lists.xen.org; Sun, 31 Jan 2021 23:30:10 +0000
Received: from mail-wm1-x333.google.com (unknown [2a00:1450:4864:20::333])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 99d86517-49af-4488-9162-337b4bb3fcfd;
 Sun, 31 Jan 2021 23:30:08 +0000 (UTC)
Received: by mail-wm1-x333.google.com with SMTP id o5so1443446wmq.2
 for <minios-devel@lists.xen.org>; Sun, 31 Jan 2021 15:30:08 -0800 (PST)
Received: from localhost ([141.85.225.206])
 by smtp.gmail.com with ESMTPSA id h207sm17192066wme.18.2021.01.31.15.30.07
 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256);
 Sun, 31 Jan 2021 15:30: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
X-Inumbo-ID: 99d86517-49af-4488-9162-337b4bb3fcfd
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=aTYYbfsN7Va2EQF2ZgOdLu3xhqrTQhJMHrKtw4dNf8k=;
        b=JQebaPxkKvk4SwjkwhOVLNDMBPb19r/V6kh5AdE5OtOA3HNGsfYLicNUDW2quZ4l71
         Imga47+6FFFnVjGMKZGJi8t+GVeCxozi6w+WtyYZbseaAwmu13/NhA3zxBZd+CzoH1Ek
         DvTXFabid9v8nZoOEd0mDDgHphrl7sr42QzmfT5t7uEnQ6U1wZPXU5YaVlbd/1XB0ChP
         2N2xahNFesaQnBae/JOoW0j/BmLLkl0+XWnFxGRUlVciKQGvF2K7Yz3CgRapi8GbvQN2
         FSAgNu1mxR9hChX4e3CQH4HHsml6DeOOe1wP1MGZ5UwIfeqIvySBA48JfnJMkQ2sOJWc
         v1Pw==
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=aTYYbfsN7Va2EQF2ZgOdLu3xhqrTQhJMHrKtw4dNf8k=;
        b=hqDOldT+FLt1u3nLdcf45738su5XJsmhjpjFf5zfJks81t/LR2ASbvnmeBv0nQy819
         FD/qC8HS22R3U9X0s6SzaiCTB3jhThaBetbhauEVHvoCiE/c0VCF4JV+5g1nYGxZtgEd
         4sFY+kNKj4u7SQmkOza6piWG79FlINDIpCgA1x3RXzGYBOIGNUHxL14iPxJ587YkRxDh
         j/16nDTnfAImgovbxmywoyLK9K1u+Cm48NQ1P1R8mRQ7OwIzHA7AzD2Q6LwcnSlbqEer
         LNqDic5K56WSyL6O5sf1N3BJJL/fGewodEGft7moTNmxFGsLxaHBNWKJkO+2XMlfHI4+
         1S1g==
X-Gm-Message-State: AOAM531dUDFWsH1Mu7jy3mbyCPXFOz5AfrtAZMf+CSpbRjV9vcXjPEDB
	+seSX2DEE5jT8diep+t6jbs=
X-Google-Smtp-Source: ABdhPJwTIIj6qp2IS9Z+3gLAAcExs/9lNIzsagVwOyYiYGmk8uDJTJ2JZrlEipLstOK0GdqEdx80zw==
X-Received: by 2002:a1c:29c6:: with SMTP id p189mr12674372wmp.110.1612135807808;
        Sun, 31 Jan 2021 15:30:07 -0800 (PST)
Sender: Razvan Deaconescu <razvand@gmail.com>
From: Razvan Deaconescu <razvan.deaconescu@cs.pub.ro>
To: Vlad-Andrei Badoiu <vlad_andrei.badoiu@upb.ro>
Cc: minios-devel@lists.xen.org,  Alice Suiu <alicesuiu17@gmail.com>
Subject: Re: [UNIKRAFT PATCH v4 3/3] build: Add support for clang
References: <20210131103234.32867-1-vlad_andrei.badoiu@upb.ro>
	<20210131103234.32867-4-vlad_andrei.badoiu@upb.ro>
Date: Mon, 01 Feb 2021 01:30:06 +0200
In-Reply-To: <20210131103234.32867-4-vlad_andrei.badoiu@upb.ro> (Vlad-Andrei
	Badoiu's message of "Sun, 31 Jan 2021 12:32:34 +0200")
Message-ID: <86czxklm69.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

All good.

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

Vlad-Andrei Badoiu <vlad_andrei.badoiu@upb.ro> writes:
> 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 c22dbad..b12dc8b 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -643,10 +643,12 @@ $(error You did not select a library that handles bootstrapping! (e.g., ukboot))
>  endif
>  
>  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 optimisation)
>  endif
>  endif
> +endif
>  
>  # Generate build rules
>  $(eval $(call verbose_include,$(CONFIG_UK_BASE)/support/build/Makefile.build))
> diff --git a/Makefile.uk b/Makefile.uk
> index e505c04..9f0da22 100644
> --- a/Makefile.uk
> +++ b/Makefile.uk
> @@ -4,9 +4,11 @@
>  #
>  ################################################################################
>  
> -COMPFLAGS    += -nostdinc -nostdlib
> +COMPFLAGS    += -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 -nostdinc
> +
>  ifneq ($(HAVE_STACKPROTECTOR),y)
>  COMPFLAGS    += -fno-stack-protector
>  endif
> @@ -19,12 +21,14 @@ 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 -no-pie
> +LIBLDFLAGS  += -nostdlib -Wl,-r -Wl,-d -Wl,--build-id=none -no-pie
> +LIBLDFLAGS-$(call have_gcc)	+= -nostdinc
>  
>  # 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     += -nostdinc -nostdlib -Wl,--omagic -Wl,--build-id=none
> +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
>  COMPFLAGS-$(CONFIG_OPTIMIZE_SIZE)         += -Os
> @@ -56,3 +60,6 @@ M4FLAGS      += -DUK_VERSION=$(UK_VERSION).$(UK_SUBVERSION)
>  # "--enable-default-pie" by default.
>  COMPFLAGS-$(call gcc_version_ge,6,1)	+= -fno-PIC
>  LDFLAGS-$(call gcc_version_ge,6,1)	+= -no-pie
> +
> +COMPFLAGS-$(call have_clang)	+= -fno-builtin -fno-PIC
> +LDFLAGS-$(call have_clang)	+= -no-pie
> diff --git a/arch/x86/x86_64/Makefile.uk b/arch/x86/x86_64/Makefile.uk
> index 24919fb..c4d5109 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 Sun Jan 31 23:30:21 2021
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Sun, 31 Jan 2021 23:30:21 +0000
Received: from list by lists.xenproject.org with outflank-mailman.79474.144628 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1l6MAf-0005VS-Kp; Sun, 31 Jan 2021 23:30:21 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 79474.144628; Sun, 31 Jan 2021 23:30: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 1l6MAf-0005VL-Hv; Sun, 31 Jan 2021 23:30:21 +0000
Received: by outflank-mailman (input) for mailman id 79474;
 Sun, 31 Jan 2021 23:30: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=YQSI=HC=gmail.com=razvand@srs-us1.protection.inumbo.net>)
 id 1l6MAe-0005VB-3b
 for minios-devel@lists.xen.org; Sun, 31 Jan 2021 23:30:20 +0000
Received: from mail-wm1-x329.google.com (unknown [2a00:1450:4864:20::329])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id a471c3e1-1415-4b9c-a48f-49fc60873a09;
 Sun, 31 Jan 2021 23:30:18 +0000 (UTC)
Received: by mail-wm1-x329.google.com with SMTP id e15so11629615wme.0
 for <minios-devel@lists.xen.org>; Sun, 31 Jan 2021 15:30:18 -0800 (PST)
Received: from localhost ([141.85.225.206])
 by smtp.gmail.com with ESMTPSA id s23sm3572437wmc.29.2021.01.31.15.30.16
 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256);
 Sun, 31 Jan 2021 15:30: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
X-Inumbo-ID: a471c3e1-1415-4b9c-a48f-49fc60873a09
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=+fLuq7Z5T8iq9FF1oYPiZQvLo6prLwMwAaKwqFHarI8=;
        b=QYnqIgnDvQlL3otGlmj6J3QO9TcKsanuP8YrnFpkh+Ta3IaBwNnN2PMuEdP2Sjjph9
         W0xpmoM6K2qOCjlMOvBCq0k/RpkiX5k3IVmqvmUdSnE2Kdykw5oB/0t0MTtayBf0XZsR
         dCBtQOAQMVPx6UuQ2qvOmRE5Fw3lzV47/SG3wIPHDqhoJX+jhzNa4ISTu+SjUKTU3uoU
         /DQc1R+OL00ZC8fGQ9bLHiGEDHN3TJmGVnP6l0f6wwGbFiTrMUVsKQJxC4EhumvJmFGm
         qXkWduWcwvujlz0r41q9rp5Kpz3H29WqhHvWteVKX6lMYpCIzjyxINWdSDKTgAHUvUcN
         Bzmw==
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=+fLuq7Z5T8iq9FF1oYPiZQvLo6prLwMwAaKwqFHarI8=;
        b=QdNlvf8Wa73FL4znlct6IgG46hbYCBIci7EgVpctHBNsUeEcRD1cDgsi5Q8MeK/BMj
         kI/jNgJ0laPV/qAosEsvqm4vFxa7QZc/kYLU/Vkea9rZdobqpTmrEseZv4WbVzqTld5j
         jxAELdfDgsu3G7jkoCYiWjbDfoDYdHHpyhYXG3pHGNGEeN049mTYYmhJWiD/U6EIYQfA
         cWVwW1y8ElWhssxv6C31q3OPAxm9wEpupq2PUU7EVji6bsAIP5p0sI186iaSul+3tuIS
         fzuLQ+Wdf9VMa58AoDa0t/gqmm0VLRJlfFhFFtVBqtaLGv15eRgfFsrUPg7P7+5JfCL3
         KMng==
X-Gm-Message-State: AOAM532eVJNwmCDj3Dmy6UkyDjw6o3sq/qtm68NfQojJ5jPFt8Lw67yx
	2uwmAoA7cRYRbk5jkI9GdmY=
X-Google-Smtp-Source: ABdhPJyBsjpuR+K8meyc0RjZwxRN+rYZqdzo4fnYEnSgLYIbonFeQ7YM3qxlucMMl4jdC1rCyCZMmA==
X-Received: by 2002:a1c:6387:: with SMTP id x129mr6447483wmb.84.1612135817553;
        Sun, 31 Jan 2021 15:30:17 -0800 (PST)
Sender: Razvan Deaconescu <razvand@gmail.com>
From: Razvan Deaconescu <razvan.deaconescu@cs.pub.ro>
To: Vlad-Andrei Badoiu <vlad_andrei.badoiu@upb.ro>
Cc: minios-devel@lists.xen.org,  Alice Suiu <alicesuiu17@gmail.com>
Subject: Re: [UNIKRAFT PATCH v4 1/3] build: Option to configure the compiler
References: <20210131103234.32867-1-vlad_andrei.badoiu@upb.ro>
	<20210131103234.32867-2-vlad_andrei.badoiu@upb.ro>
Date: Mon, 01 Feb 2021 01:30:16 +0200
In-Reply-To: <20210131103234.32867-2-vlad_andrei.badoiu@upb.ro> (Vlad-Andrei
	Badoiu's message of "Sun, 31 Jan 2021 12:32:32 +0200")
Message-ID: <868s88lm5z.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

All good.

Razvan

Vlad-Andrei Badoiu <vlad_andrei.badoiu@upb.ro> writes:
> By default, the compiler is GCC. Use COMPILER to set the compiler. For
> example, COMPILER=clang.
>
> Signed-off-by: Alice Suiu <alicesuiu17@gmail.com>
> Signed-off-by: Vlad-Andrei Badoiu <vlad_andrei.badoiu@upb.ro>
> Reviewed-by: Razvan Deaconescu <razvan.deaconescu@cs.pub.ro>
> ---
>  Makefile | 12 ++++++++++--
>  1 file changed, 10 insertions(+), 2 deletions(-)
>
> diff --git a/Makefile b/Makefile
> index 8e14817..c22dbad 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 := $(CROSS_COMPILE:"%"=%)
>  endif
>  
> +ifneq ("$(origin COMPILER)","undefined")
> +	CONFIG_COMPILER := $(COMPILER:"%"=%)
> +else
> +	CONFIG_COMPILER := gcc
> +endif
> +
> +
>  $(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


