diff mbox series

[v2,01/14] arch: introduce symbol HAVE_INITJMP

Message ID 2589612a53a9e9feb67b8e8286e87893359676d1.1740499185.git.jerome.forissier@linaro.org
State New
Headers show
Series Uthreads | expand

Commit Message

Jerome Forissier Feb. 25, 2025, 4:34 p.m. UTC
HAVE_INIJMP will be set by architectures that support initjmp(), a
non-standard extension to setjmp()/longjmp() allowing to initialize a
jump buffer with a function pointer and a stack pointer. This will be
useful to later introduce threads. With this new function it becomes
possible to longjmp() to a particular function pointer (rather than
to a point previously reached during program execution as is the case
with setjmp()), and with a custom stack. Both things are needed to
spin off a new thread. Then the usual setjmp()/ longjmp() pair is
enough to save and restore a context, i.e., switch thread.

Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org>
---
 arch/Kconfig | 6 ++++++
 1 file changed, 6 insertions(+)

Comments

Ilias Apalodimas Feb. 28, 2025, 12:01 p.m. UTC | #1
Hi Jerome,


On Tue, 25 Feb 2025 at 18:35, Jerome Forissier
<jerome.forissier@linaro.org> wrote:
>
> HAVE_INIJMP will be set by architectures that support initjmp(), a
> non-standard extension to setjmp()/longjmp() allowing to initialize a
> jump buffer with a function pointer and a stack pointer. This will be
> useful to later introduce threads. With this new function it becomes
> possible to longjmp() to a particular function pointer (rather than
> to a point previously reached during program execution as is the case
> with setjmp()), and with a custom stack. Both things are needed to
> spin off a new thread. Then the usual setjmp()/ longjmp() pair is
> enough to save and restore a context, i.e., switch thread.
>
> Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org>
> ---
>  arch/Kconfig | 6 ++++++
>  1 file changed, 6 insertions(+)
>
> diff --git a/arch/Kconfig b/arch/Kconfig
> index 35b19f9bfdc..8d5b54031b3 100644
> --- a/arch/Kconfig
> +++ b/arch/Kconfig
> @@ -13,6 +13,12 @@ config HAVE_SETJMP
>         help
>          The architecture supports setjmp() and longjmp().
>
> +config HAVE_INITJMP
> +       bool
> +       help
> +        The architecture supports initjmp(), a non-standard companion to
> +        setjmp() and longjmp().
> +
>  config SUPPORT_BIG_ENDIAN
>         bool
>
> --
> 2.43.0
>\


Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Heinrich Schuchardt Feb. 28, 2025, 12:38 p.m. UTC | #2
On 25.02.25 17:34, Jerome Forissier wrote:
> HAVE_INIJMP will be set by architectures that support initjmp(), a
> non-standard extension to setjmp()/longjmp() allowing to initialize a
> jump buffer with a function pointer and a stack pointer. This will be
> useful to later introduce threads. With this new function it becomes
> possible to longjmp() to a particular function pointer (rather than
> to a point previously reached during program execution as is the case
> with setjmp()), and with a custom stack. Both things are needed to
> spin off a new thread. Then the usual setjmp()/ longjmp() pair is
> enough to save and restore a context, i.e., switch thread.
>
> Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org>
> ---
>   arch/Kconfig | 6 ++++++
>   1 file changed, 6 insertions(+)
>
> diff --git a/arch/Kconfig b/arch/Kconfig
> index 35b19f9bfdc..8d5b54031b3 100644
> --- a/arch/Kconfig
> +++ b/arch/Kconfig
> @@ -13,6 +13,12 @@ config HAVE_SETJMP
>   	help
>   	 The architecture supports setjmp() and longjmp().
>
> +config HAVE_INITJMP
> +	bool

HAVE_SETJMP controls if /arch/<arch>/lib/setjmp.S is compiled.

Please, add the missing dependency.

	depends HAVE_SETJMP

Best regards

Heinrich

> +	help
> +	 The architecture supports initjmp(), a non-standard companion to
> +	 setjmp() and longjmp().
> +
>   config SUPPORT_BIG_ENDIAN
>   	bool
>
Jerome Forissier Feb. 28, 2025, 12:57 p.m. UTC | #3
On 2/28/25 13:38, Heinrich Schuchardt wrote:
> On 25.02.25 17:34, Jerome Forissier wrote:
>> HAVE_INIJMP will be set by architectures that support initjmp(), a
>> non-standard extension to setjmp()/longjmp() allowing to initialize a
>> jump buffer with a function pointer and a stack pointer. This will be
>> useful to later introduce threads. With this new function it becomes
>> possible to longjmp() to a particular function pointer (rather than
>> to a point previously reached during program execution as is the case
>> with setjmp()), and with a custom stack. Both things are needed to
>> spin off a new thread. Then the usual setjmp()/ longjmp() pair is
>> enough to save and restore a context, i.e., switch thread.
>>
>> Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org>
>> ---
>>   arch/Kconfig | 6 ++++++
>>   1 file changed, 6 insertions(+)
>>
>> diff --git a/arch/Kconfig b/arch/Kconfig
>> index 35b19f9bfdc..8d5b54031b3 100644
>> --- a/arch/Kconfig
>> +++ b/arch/Kconfig
>> @@ -13,6 +13,12 @@ config HAVE_SETJMP
>>       help
>>        The architecture supports setjmp() and longjmp().
>>
>> +config HAVE_INITJMP
>> +    bool
> 
> HAVE_SETJMP controls if /arch/<arch>/lib/setjmp.S is compiled.
> 
> Please, add the missing dependency.
> 
>     depends HAVE_SETJMP

Ack.

Thanks,
diff mbox series

Patch

diff --git a/arch/Kconfig b/arch/Kconfig
index 35b19f9bfdc..8d5b54031b3 100644
--- a/arch/Kconfig
+++ b/arch/Kconfig
@@ -13,6 +13,12 @@  config HAVE_SETJMP
 	help
 	 The architecture supports setjmp() and longjmp().
 
+config HAVE_INITJMP
+	bool
+	help
+	 The architecture supports initjmp(), a non-standard companion to
+	 setjmp() and longjmp().
+
 config SUPPORT_BIG_ENDIAN
 	bool