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

Re: [Minios-devel] [UNIKRAFT PATCH v3 2/4] lib/ukboot: Modify ctor iteration to end at uk_ctortab_end



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

On 29.08.19 18:19, Vlad-Andrei BĂDOIU (78692) wrote:
From: Vlad-Andrei BĂDOIU (78692) <vlad_andrei.badoiu@xxxxxxxxxxxxxxx>

The iteration thourgh the ctortab array of constructors now ends at
uk_ctortab_end. We now use the ukplat_ctor_foreach macro.

Signed-off-by: Vlad-Andrei Badoiu <vlad_andrei.badoiu@xxxxxxxxxxxxxxx>
---
  include/uk/ctors.h | 1 +
  lib/ukboot/boot.c  | 8 ++++----
  2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/include/uk/ctors.h b/include/uk/ctors.h
index a3432e2b..8572cc4b 100644
--- a/include/uk/ctors.h
+++ b/include/uk/ctors.h
@@ -45,6 +45,7 @@ extern "C" {
typedef void (*uk_ctor_func_t)(void);
  extern const uk_ctor_func_t uk_ctortab[];
+extern const uk_ctor_func_t uk_ctortab_end;
/*
   * Register a constructor function that is
diff --git a/lib/ukboot/boot.c b/lib/ukboot/boot.c
index 9738a912..910cd61d 100644
--- a/lib/ukboot/boot.c
+++ b/lib/ukboot/boot.c
@@ -166,8 +166,8 @@ void ukplat_entry_argp(char *arg0, char *argb, __sz 
argb_len)
  /* defined in <uk/plat.h> */
  void ukplat_entry(int argc, char *argv[])
  {
-       const uk_ctor_func_t *cfn;
        struct thread_main_arg tma;
+       int i;
        int kern_args = 0;
        int rc __maybe_unused = 0;
  #if CONFIG_LIBUKALLOC
@@ -182,9 +182,9 @@ void ukplat_entry(int argc, char *argv[])
  #endif
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)();
+       ukplat_ctor_foreach(uk_ctortab, uk_ctortab_end, i) {
+               uk_pr_debug("Call constructor %p\n", uk_ctortab[i]);
+               uk_ctortab[i]();
        }
#ifdef CONFIG_LIBUKLIBPARAM


_______________________________________________
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®.