summaryrefslogtreecommitdiffstats
path: root/arch/sandbox/Kconfig
diff options
context:
space:
mode:
authorAhmad Fatoum <a.fatoum@pengutronix.de>2021-03-10 09:47:48 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2021-03-17 11:55:30 +0100
commite74e330216baff384b844fde06720b022614168b (patch)
treebbd2baba1378e43b36d37b65dac48f5d1f4be3a6 /arch/sandbox/Kconfig
parent01064a3c91492e09c13c2d158f1d2fa63cb90468 (diff)
downloadbarebox-e74e330216baff384b844fde06720b022614168b.tar.gz
barebox-e74e330216baff384b844fde06720b022614168b.tar.xz
sandbox: asm: implement setjmp/longjmp/initjmp
To extend incoming bthread support to sandbox, implement setjmp, longjmp and initjmp. Unlike bare metal platforms, setjmp() and longjmp() are readily provided on standard-conforming hosted platforms. initjmp() on the other hand requires us to be able to invoke a function with a user-supplied stack pointer, which isn't possible in standard C. For POSIX systems, there are two methods to portably achieve this though: - Use makecontext(2) to set up a new context. makecontext(2) was however removed in POSIX.1-2008 and at least GCC 10.2.1 ASan complains that it "doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases!" - Use sigaltstack to set a new signal stack, raise the signal call, setjmp in the signal handler to store the new stack pointer, return regularly from signal handler and then longjmp back Both methods are implemented in QEMU. While QEMU uses the makecontext method by default, for the reasons described, import the second implementation and use it implement initjmp. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'arch/sandbox/Kconfig')
-rw-r--r--arch/sandbox/Kconfig1
1 files changed, 1 insertions, 0 deletions
diff --git a/arch/sandbox/Kconfig b/arch/sandbox/Kconfig
index 1a4e3bacf6..cef8e9fb7a 100644
--- a/arch/sandbox/Kconfig
+++ b/arch/sandbox/Kconfig
@@ -13,6 +13,7 @@ config SANDBOX
select PARTITION_DISK
select ARCH_HAS_STACK_DUMP if ASAN
select GENERIC_FIND_NEXT_BIT
+ select HAS_ARCH_SJLJ
default y
config ARCH_TEXT_BASE