diff mbox series

[RFC,01/10] arch: introduce symbol HAVE_INITJMP

Message ID 20250214140031.484344-2-jerome.forissier@linaro.org
State New
Headers show
Series Uthreads | expand

Commit Message

Jerome Forissier Feb. 14, 2025, 2 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.

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

Comments

Heinrich Schuchardt Feb. 14, 2025, 2:41 p.m. UTC | #1
On 14.02.25 15:00, 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.

How is initjmp() used in threading?

A cover-letter for the series would have been helpful.

>
> 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().

If this required for thread support, I would have expected this to be in
the help text.

Best regards

Heinrich

> +
>   config SUPPORT_BIG_ENDIAN
>   	bool
>
Jerome Forissier Feb. 14, 2025, 3:03 p.m. UTC | #2
Hi Heinrich,

On 2/14/25 15:41, Heinrich Schuchardt wrote:
> On 14.02.25 15:00, 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.
> 
> How is initjmp() used in threading?

It's used so that we can 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 thread.

I will update the description.

> 
> A cover-letter for the series would have been helpful.

It's here [1].

[1] https://lists.denx.de/pipermail/u-boot/2025-February/580550.html

> 
>>
>> 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().
> 
> If this required for thread support, I would have expected this to be in
> the help text.
> 
> Best regards
> 
> Heinrich
> 
>> +
>>   config SUPPORT_BIG_ENDIAN
>>       bool
>>
>
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