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

[Minios-devel] [UNIKRAFT PATCH v2 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:06:58 +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=pkgHEzEm+nY7UJfj8O4pSWPSYkqA07CqytXEmSa7BVQ=; b=exEaoYMAU7tmN34V76dl0xPioovDRHL2Q7KONG5TxUYRZhhp2UJPKOI65v7iQhIm/82JpBoHQc+ZJByKikPeNZgttPz+36irOtAThm/RazU/AEr15FA0jXB4Qn5UJFLB27gbCnNLo8Y+wTcfucx5+eIoJi5HOz1vK8O6vrRX27ax4GmzYM/q2MmBnE7i52GCrdOHbUb3Sn0mPl0Ey4/YmSshcZz/UnfbkfrreNsSE74VG5VyYlYsXPQgC9UNj19+8MloojH/EYOoRpRZTWcS2GTAxiTeUW/6+6+XjwnYxXg8uG1Ew9wd6gA8N1XY3+Q8KcNaOOgmt5gNaOcCv+rceQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=DP4ytoBzTg0pNQH9cMAwdEwXMhlgb42QFpCmfQsJj+j+5yexN9yZMcIUNx0HnoN9+wAa3W1A/+qyEhBKKoAu8ihvZP37PfEEU5BplOCD3y2hd1pKFDaus6kIC0JL8kNZGXnrFvZiFlPfcyiCuIVmpLhtqQ39GUy6cMKYZNwvq/tRn7yZYg72cLU7W5aIU7aFdcaJFnVin+t4SHjHzb1eQIxMgMbg5ELvGDcs0zN+clAgs3YpeQ/V4J1yZF6WbTn2B9XcL0wK3Bm/mjtWDnjZitpJ9SqOT03BFiMGoJIxUIgfUCIDkROSw+4dJ7evMK2gY1PUTKfiNzL7PK4g1YZgaQ==
  • 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:07:20 +0000
  • List-id: Mini-os development list <minios-devel.lists.xenproject.org>
  • Thread-index: AQHVXoPIF9CNkKRv10+Bxao53HvLJQ==
  • Thread-topic: [UNIKRAFT PATCH v2 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 0bc2c391..72c0807b 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", *cfn);
                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®.