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

[Minios-devel] [UNIKRAFT PATCH v3 2/3] lib/ukboot: Call internal constructors



From: Vlad-Andrei BĂDOIU (78692) <vlad_andrei.badoiu@xxxxxxxxxxxxxxx>

Signed-off-by: Vlad-Andrei Badoiu <vlad_andrei.badoiu@xxxxxxxxxxxxxxx>
---
 lib/ukboot/boot.c | 26 +++++++++++++++++---------
 1 file changed, 17 insertions(+), 9 deletions(-)

diff --git a/lib/ukboot/boot.c b/lib/ukboot/boot.c
index 48467828..90224986 100644
--- a/lib/ukboot/boot.c
+++ b/lib/ukboot/boot.c
@@ -56,6 +56,7 @@
 #include <uk/plat/time.h>
 #include <uk/essentials.h>
 #include <uk/print.h>
+#include <uk/ctors.h>
 #include <uk/argparse.h>
 #if CONFIG_LIBUKBUS
 #include <uk/bus.h>
@@ -79,6 +80,17 @@ static void main_thread_func(void *arg)
        int ret;
        struct thread_main_arg *tma = 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) {
+               if (__init_array_start[i]) {
+                       uk_pr_debug("Call constructor (entry %d (%p): 
%p())...\n",
+                                       i, &__init_array_start[i],
+                                       __init_array_start[i]);
+                       __init_array_start[i]();
+               }
+       }
+
 #ifdef CONFIG_LIBUKBUS
        uk_pr_info("Initialize bus handlers...\n");
        uk_bus_init_all(uk_alloc_get_default());
@@ -141,6 +153,7 @@ void ukplat_entry_argp(char *arg0, char *argb, __sz 
argb_len)
 void ukplat_entry(int argc, char *argv[])
 {
        int i;
+       const uk_ctor_func_t *cfn;
        struct thread_main_arg tma;
 #if CONFIG_LIBUKALLOC
        struct uk_alloc *a = NULL;
@@ -165,15 +178,10 @@ void ukplat_entry(int argc, char *argv[])
                }
        }
 
-       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) {
-               if (__init_array_start[i]) {
-                       uk_pr_debug("Call constructor (entry %d (%p): 
%p())...\n",
-                                   i, &__init_array_start[i],
-                                   __init_array_start[i]);
-                       __init_array_start[i]();
-               }
+       uk_pr_info("Unikraft constructors table at %p\n", uk_ctortab);
+       for (cfn = uk_ctortab; *cfn != NULL; ++cfn) {
+               uk_pr_debug("Call constructor %p\n", *cfn);
+               (*cfn)();
        }
 
 #if CONFIG_LIBUKALLOC && CONFIG_LIBUKALLOCBBUDDY && CONFIG_LIBUKBOOT_INITALLOC
-- 
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®.