On Fri, Feb 28, 2025 at 03:16:37PM +0100, Jerome Forissier wrote: > > > On 2/28/25 14:28, Heinrich Schuchardt wrote: > > On 28.02.25 14:21, Jerome Forissier wrote: > >> > >> > >> On 2/28/25 14:05, Heinrich Schuchardt wrote: > >>> On 25.02.25 17:34, Jerome Forissier wrote: > >>>> Implement initjmp() for Arm. > >>>> > >>>> Signed-off-by: Jerome Forissier <jerome.foriss...@linaro.org> > >>>> --- > >>>> arch/Kconfig | 1 + > >>>> arch/arm/include/asm/setjmp.h | 1 + > >>>> arch/arm/lib/setjmp.S | 11 +++++++++++ > >>>> arch/arm/lib/setjmp_aarch64.S | 9 +++++++++ > >>>> 4 files changed, 22 insertions(+) > >>>> > >>>> diff --git a/arch/Kconfig b/arch/Kconfig > >>>> index 8d5b54031b3..57695fada8d 100644 > >>>> --- a/arch/Kconfig > >>>> +++ b/arch/Kconfig > >>>> @@ -94,6 +94,7 @@ config ARC > >>>> config ARM > >>>> bool "ARM architecture" > >>>> select HAVE_SETJMP > >>>> + select HAVE_INITJMP > >>>> select ARCH_SUPPORTS_LTO > >>>> select CREATE_ARCH_SYMLINK > >>>> select HAVE_PRIVATE_LIBGCC if !ARM64 > >>>> diff --git a/arch/arm/include/asm/setjmp.h > >>>> b/arch/arm/include/asm/setjmp.h > >>>> index 662bec86321..1ad5b500f2a 100644 > >>>> --- a/arch/arm/include/asm/setjmp.h > >>>> +++ b/arch/arm/include/asm/setjmp.h > >>>> @@ -23,5 +23,6 @@ typedef struct jmp_buf_data jmp_buf[1]; > >>>> > >>>> int setjmp(jmp_buf jmp); > >>>> void longjmp(jmp_buf jmp, int ret); > >>>> +int initjmp(jmp_buf jmp, void __noreturn (*func)(void), void > >>>> *stack_top); > >>> > >>> As this is not a standard function we cannot expect developers to know > >>> what it does and how to use it. > >>> > >>> Please, provide Sphinx style documentation with the necessary information. > >> > >> I agree on principle, but if I add documentation here then I should add the > >> same for all architectures. That being said the prototypes are already > >> duplicated so maybe consolidation is a question for another time. I will > >> add Shpinx style doc to all 3 commits "{arm,riscv,sandbox}: add initjmp()". > > > > Yes, this was not designed correctly: > > > > We should move setjmp.h to include/asm-generic and include an > > architecture specific setjmp_bits.h from there. > > > > setjmp_bits.h would provide the struct jmp_buf_data definition. > > Makes sense. I'll rework in v3. > > > > >> > >> As for usage, I think the best documentation is test/lib/initjmp.c added > >> by "test: lib: add initjmp() test". > > > > Example code is valuable but does not replace documentation. > > Should I provide a stripped-down example in the Sphinx doc? Or do you have > another location in mind? (doc/develop/initjmp.rst?).
We should have doc/api/initjmp.rst and if test/lib/initjmp.c is commented correctly / well enough it can be referenced in the rST via '.. kernel-doc::test/lib/initjmp.c' I think. -- Tom
signature.asc
Description: PGP signature