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

Re: [Minios-devel] [UNIKRAFT PATCH] lib/nolibc: Provide abort()



Hi Simon, this patch looks good, thanks.

Reviewed-by: Felipe Huici <felipe.huici@xxxxxxxxx>

On Tue, Mar 31, 2020 at 12:10 PM Simon Kuenzer <simon.kuenzer@xxxxxxxxx> wrote:
>
> Provide `void abort(void)` implementation with `<stdlib.h>`.
> The function terminates the kernel execution with crashed
> state by calling `ukplat_crash()`.
>
> Signed-off-by: Simon Kuenzer <simon.kuenzer@xxxxxxxxx>
> ---
>  lib/nolibc/include/stdlib.h | 3 +++
>  lib/nolibc/stdlib.c         | 8 ++++++++
>  2 files changed, 11 insertions(+)
>
> diff --git a/lib/nolibc/include/stdlib.h b/lib/nolibc/include/stdlib.h
> index 02dd8500..cd6651c4 100644
> --- a/lib/nolibc/include/stdlib.h
> +++ b/lib/nolibc/include/stdlib.h
> @@ -28,6 +28,7 @@
>  #define __STDLIB_H__
>
>  #include <uk/config.h>
> +#include <uk/essentials.h>
>
>  #ifdef __cplusplus
>  extern "C" {
> @@ -86,6 +87,8 @@ int posix_memalign(void **memptr, size_t align, size_t 
> size);
>  void *memalign(size_t align, size_t size);
>  #endif /* CONFIG_LIBUKALLOC */
>
> +void abort(void) __noreturn;
> +
>  #if CONFIG_LIBPOSIX_PROCESS
>  int system(const char *command);
>  #endif
> diff --git a/lib/nolibc/stdlib.c b/lib/nolibc/stdlib.c
> index c83c6de5..5cab9b28 100644
> --- a/lib/nolibc/stdlib.c
> +++ b/lib/nolibc/stdlib.c
> @@ -56,6 +56,8 @@
>  #include <stdlib.h>
>  #include <limits.h>
>  #include <ctype.h>
> +#include <uk/print.h>
> +#include <uk/plat/bootstrap.h>
>
>  #define __DECONST(type, var) ((type)(uintptr_t)(const void *)(var))
>
> @@ -412,3 +414,9 @@ int atoi(const char *s)
>
>         return (int) atoll;
>  }
> +
> +void abort(void)
> +{
> +       uk_pr_crit("Abnormal termination!\n");
> +       ukplat_crash();
> +}
> --
> 2.20.1
>
>
> _______________________________________________
> Minios-devel mailing list
> Minios-devel@xxxxxxxxxxxxxxxxxxxx
> https://lists.xenproject.org/mailman/listinfo/minios-devel

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