u-boot/include/setjmp.h
Heinrich Schuchardt 7082c9e656 common: clean up setjmp.h
Separate setjmp.h into an architecture independent part and an architecture
specific part. This simplifies moving from using struct jmp_buf_data
directly to using type jmp_buf in our code which is the C compliant way.

Reviewed-by: Jerome Forissier <jerome.forissier@linaro.org>
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2025-03-10 07:41:16 +01:00

40 lines
967 B
C

/* SPDX-License-Identifier: GPL-2.0-or-later */
#ifndef _SETJMP_H_
#define _SETJMP_H_ 1
#ifdef CONFIG_HAVE_SETJMP
#include <asm/setjmp.h>
#else
struct jmp_buf_data {
};
#endif
/**
* typedef jmp_buf - information needed to restore a calling environment
*/
typedef struct jmp_buf_data jmp_buf[1];
/**
* setjmp() - prepare for a long jump
*
* Registers, the stack pointer, and the return address are saved in the
* jump bufffer. The function returns zero afterwards. When longjmp() is
* executed the function returns a second time with a non-zero value.
*
* @env: jump buffer used to store register values
* Return: 0 after setting up jump buffer, non-zero after longjmp()
*/
int setjmp(jmp_buf env);
/**
* longjmp() - long jump
*
* Jump back to the address and the register state saved by setjmp().
*
* @env: jump buffer
* @val: value to be returned by setjmp(), 0 is replaced by 1
*/
void longjmp(jmp_buf env, int val);
#endif /* _SETJMP_H_ */