[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Minios-devel] [UNIKRAFT PATCH v3 4/4] include: Merge ctors.h with plat/ctors.h


  • To: "minios-devel@xxxxxxxxxxxxx" <minios-devel@xxxxxxxxxxxxx>
  • From: Vlad-Andrei BĂDOIU (78692) <vlad_andrei.badoiu@xxxxxxxxxxxxxxx>
  • Date: Thu, 29 Aug 2019 16:19:39 +0000
  • Accept-language: en-US
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=stud.acs.upb.ro; dmarc=pass action=none header.from=stud.acs.upb.ro; dkim=pass header.d=stud.acs.upb.ro; arc=none
  • 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=qHidHWuvqxfinjee8CQZ2BcJpz3UWDf2m0MoucsTTeA=; b=ErVkUznvd0dhYp+rW+wPT+vhF9suLI6+ExUVKV5VfczzsrHQ4EnanIEie79FDI63avcjaBSExFoNLEp6Od2llEIw/7AfL+AEjV+7EPVxVsi/6iYYgDTqyvPVIVsJU4Kz2A+1lq0N1sxlwlWV9KpRFZEBP9+bF7ZP4tdYdSpiDKPp4UnmqceRKnFTiJCCn9CZCesoPt+bEFCUPEtlFNEIiG9VNjHK2KyF6lcGK9XZ/ecfW/+saFiUSTC514YQzQVZ+xDLAVBn0izRlNU9LnutSsv+Eo9QKl8+hQXZJIkJXyX+p9jx3Ne4grusIpNptUabVLqbIcmQCu2su2HhACmk4w==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=E2TbU5hHFFfblpBAjnB6cJi8ieo22mz90wSvWItlEiRUaPgh73NVyETt8Vfxwvv2I8HDKUTMTcWEVDPrm0bsXYxa3YPboUa+Q9a9PtXxtiw+b1mcT/cXemgwY4um8tJ+TuybBx4W27kQQLs+fCCFUPe9HVhz4SdyfrgC7ZLoji97DS7a18nP1yWP7PHRPELEVzg9ZHJRlRRwvyB3uolIth7m1byTwePvERyPskdfHkduiJgPJvSgpyhY9tA3Swbzo78+8Wyk3eqsyQbKUoC6+bHD+h76Ui/Ygn6FVVWCyE7OSwCl5SKJ2enBzKP/dA8XyhrL1KFtpKa0jJ/MsFupgQ==
  • Authentication-results: spf=none (sender IP is ) smtp.mailfrom=vlad_andrei.badoiu@xxxxxxxxxxxxxxx;
  • Cc: "simon.kuenzer@xxxxxxxxx" <simon.kuenzer@xxxxxxxxx>, Vlad-Andrei BĂDOIU (78692) <vlad_andrei.badoiu@xxxxxxxxxxxxxxx>
  • Delivery-date: Thu, 29 Aug 2019 16:19:54 +0000
  • List-id: Mini-os development list <minios-devel.lists.xenproject.org>
  • Thread-index: AQHVXoWODjyEQAzzaUO7aqtezpqrhw==
  • Thread-topic: [UNIKRAFT PATCH v3 4/4] include: Merge ctors.h with plat/ctors.h

We merge the two headers because they share the same purpose. This patch
moves the content of include/uk/plat/ctors.h to include/uk/ctors.h,
adapts the naming from ukplat_ctor_* to uk_ctor_* and adapts the boot.c
files to work with the new changes.

Signed-off-by: Vlad-Andrei Badoiu <vlad_andrei.badoiu@xxxxxxxxxxxxxxx>
---
 include/uk/ctors.h      | 24 +++++++++++++
 include/uk/plat/ctors.h | 75 -----------------------------------------
 lib/ukboot/boot.c       |  7 ++--
 3 files changed, 27 insertions(+), 79 deletions(-)
 delete mode 100644 include/uk/plat/ctors.h

diff --git a/include/uk/ctors.h b/include/uk/ctors.h
index 8572cc4b..188f0aa2 100644
--- a/include/uk/ctors.h
+++ b/include/uk/ctors.h
@@ -44,6 +44,13 @@ extern "C" {
 #endif
 
 typedef void (*uk_ctor_func_t)(void);
+
+/* Function pointer arrays of constructors; provided by
+ * the platform's linker script */
+extern const uk_ctor_func_t __preinit_array_start[];
+extern const uk_ctor_func_t __preinit_array_end;
+extern const uk_ctor_func_t __init_array_start[];
+extern const uk_ctor_func_t __init_array_end;
 extern const uk_ctor_func_t uk_ctortab[];
 extern const uk_ctor_func_t uk_ctortab_end;
 
@@ -62,6 +69,23 @@ extern const uk_ctor_func_t uk_ctortab_end;
                __uk_ctab ## lvl ## _ ## ctorf = (ctorf)
 #define UK_CTOR_FUNC(lvl, ctorf) __UK_CTOR_FUNC(lvl, ctorf)
 
+/**
+ * Helper macro for iterating over constructor pointer arrays
+ * Please note that the array may contain NULL pointer entries
+ *
+ * @param arr_start
+ *   Start address of pointer array (type: const ukplat_ctor_func_t const [])
+ * @param arr_end
+ *   End address of pointer array
+ * @param i
+ *   Iterator variable (integer) which should be used to access the
+ *   individual fields
+ */
+#define uk_ctor_foreach(arr_start, arr_end, i)                    \
+       for ((i)=0;                                                        \
+            &((arr_start)[i]) < &(arr_end); \
+            ++(i))
+
 #ifdef __cplusplus
 }
 #endif
diff --git a/include/uk/plat/ctors.h b/include/uk/plat/ctors.h
deleted file mode 100644
index a15d0b86..00000000
--- a/include/uk/plat/ctors.h
+++ /dev/null
@@ -1,75 +0,0 @@
-/* SPDX-License-Identifier: BSD-3-Clause */
-/*
- * Authors: Simon Kuenzer <simon.kuenzer@xxxxxxxxx>
- *
- *
- * Copyright (c) 2018, NEC Europe Ltd., NEC Corporation. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the copyright holder nor the names of its
- *    contributors may be used to endorse or promote products derived from
- *    this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- * THIS HEADER MAY NOT BE EXTRACTED OR MODIFIED IN ANY WAY.
- */
-
-#ifndef __UKPLAT_CTORS_H__
-#define __UKPLAT_CTORS_H__
-
-#include <uk/essentials.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef void (*ukplat_ctor_func_t)(void);
-
-/* Function pointer arrays of constructors; provided by
- * the platform's linker script */
-extern const ukplat_ctor_func_t __preinit_array_start[];
-extern const ukplat_ctor_func_t __preinit_array_end;
-extern const ukplat_ctor_func_t __init_array_start[];
-extern const ukplat_ctor_func_t __init_array_end;
-
-/**
- * Helper macro for iterating over constructor pointer arrays
- * Please note that the array may contain NULL pointer entries
- *
- * @param arr_start
- *   Start address of pointer array (type: const ukplat_ctor_func_t const [])
- * @param arr_end
- *   End address of pointer array
- * @param i
- *   Iterator variable (integer) which should be used to access the
- *   individual fields
- */
-#define ukplat_ctor_foreach(arr_start, arr_end, i)                        \
-       for ((i)=0;                                                        \
-            &((arr_start)[i]) < &(arr_end); \
-            ++(i))
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* __UKPLAT_CTORS_H__ */
diff --git a/lib/ukboot/boot.c b/lib/ukboot/boot.c
index 910cd61d..3b8d641f 100644
--- a/lib/ukboot/boot.c
+++ b/lib/ukboot/boot.c
@@ -49,7 +49,6 @@
 #endif
 #include <uk/arch/lcpu.h>
 #include <uk/plat/bootstrap.h>
-#include <uk/plat/ctors.h>
 #include <uk/plat/memory.h>
 #include <uk/plat/lcpu.h>
 #include <uk/plat/irq.h>
@@ -85,7 +84,7 @@ static void main_thread_func(void *arg)
 
        uk_pr_info("Pre-init table at %p - %p\n",
                   __preinit_array_start, &__preinit_array_end);
-       ukplat_ctor_foreach(__preinit_array_start, __preinit_array_end, i) {
+       uk_ctor_foreach(__preinit_array_start, __preinit_array_end, i) {
                if (__preinit_array_start[i]) {
                        uk_pr_debug("Call pre-init constructor (entry %d (%p): 
%p())...\n",
                                    i, &__preinit_array_start[i],
@@ -96,7 +95,7 @@ static void main_thread_func(void *arg)
 
        uk_pr_info("Constructor table at %p - %p\n",
                        __init_array_start, &__init_array_end);
-       ukplat_ctor_foreach(__init_array_start, __init_array_end, i) {
+       uk_ctor_foreach(__init_array_start, __init_array_end, i) {
                if (__init_array_start[i]) {
                        uk_pr_debug("Call constructor (entry %d (%p): 
%p())...\n",
                                        i, &__init_array_start[i],
@@ -182,7 +181,7 @@ void ukplat_entry(int argc, char *argv[])
 #endif
 
        uk_pr_info("Unikraft constructors table at %p\n", uk_ctortab);
-       ukplat_ctor_foreach(uk_ctortab, uk_ctortab_end, i) {
+       uk_ctor_foreach(uk_ctortab, uk_ctortab_end, i) {
                uk_pr_debug("Call constructor %p\n", uk_ctortab[i]);
                uk_ctortab[i]();
        }
-- 
2.20.1


_______________________________________________
Minios-devel mailing list
Minios-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/minios-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.