diff mbox series

[v5,08/10] sandbox: Add support for calling abort()

Message ID 20180622124418.52892-9-agraf@suse.de
State New
Headers show
Series sandbox: efi_loader support | expand

Commit Message

Alexander Graf June 22, 2018, 12:44 p.m. UTC
From: Simon Glass <sjg@chromium.org>

This function is useful to signal that the application needs to exit
immediate. It can be caught with a debugger (e.g. gdb). Add a stub for it
so that it can be called from within sandbox when an internal error
occurs.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Alexander Graf <agraf@suse.de>
---
 arch/sandbox/cpu/os.c | 5 +++++
 include/os.h          | 5 +++++
 2 files changed, 10 insertions(+)
diff mbox series

Patch

diff --git a/arch/sandbox/cpu/os.c b/arch/sandbox/cpu/os.c
index 3067503d51..9fbcb9ef92 100644
--- a/arch/sandbox/cpu/os.c
+++ b/arch/sandbox/cpu/os.c
@@ -631,3 +631,8 @@  void os_localtime(struct rtc_time *rt)
 	rt->tm_yday = tm->tm_yday;
 	rt->tm_isdst = tm->tm_isdst;
 }
+
+void os_abort(void)
+{
+	abort();
+}
diff --git a/include/os.h b/include/os.h
index 64e89a06c9..8fb9d309d0 100644
--- a/include/os.h
+++ b/include/os.h
@@ -330,4 +330,9 @@  int os_spl_to_uboot(const char *fname);
  */
 void os_localtime(struct rtc_time *rt);
 
+/**
+ * os_abort() - Raise SIGABRT to exit sandbox (e.g. to debugger)
+ */
+void os_abort(void);
+
 #endif