xref: /openbmc/u-boot/arch/sandbox/include/asm/setjmp.h (revision 0ae8dcfef7c890330c62bb34c724126ffc169bef)
1b5351a43STom Rini /* SPDX-License-Identifier: GPL-2.0+ */
230eef21fSSimon Glass /*
330eef21fSSimon Glass  * (C) 2018 Google, Inc
430eef21fSSimon Glass  * Written by Simon Glass <sjg@chromium.org>
530eef21fSSimon Glass  */
630eef21fSSimon Glass 
730eef21fSSimon Glass #ifndef _SETJMP_H_
830eef21fSSimon Glass #define _SETJMP_H_
930eef21fSSimon Glass 
1030eef21fSSimon Glass struct jmp_buf_data {
1130eef21fSSimon Glass 	/*
1230eef21fSSimon Glass 	 * We're not sure how long this should be:
1330eef21fSSimon Glass 	 *
1430eef21fSSimon Glass 	 *   amd64: 200 bytes
1530eef21fSSimon Glass 	 *   arm64: 392 bytes
1630eef21fSSimon Glass 	 *   armhf: 392 bytes
1730eef21fSSimon Glass 	 *
1830eef21fSSimon Glass 	 * So allow space for all of those, plus some extra.
1930eef21fSSimon Glass 	 * We don't need to worry about 16-byte alignment, since this does not
2030eef21fSSimon Glass 	 * run on Windows.
2130eef21fSSimon Glass 	 */
2230eef21fSSimon Glass 	ulong data[128];
2330eef21fSSimon Glass };
2430eef21fSSimon Glass 
2530eef21fSSimon Glass typedef struct jmp_buf_data jmp_buf[1];
2630eef21fSSimon Glass 
27*3fcb7147SAlexander Graf /*
28*3fcb7147SAlexander Graf  * We have to directly link with the system versions of
29*3fcb7147SAlexander Graf  * setjmp/longjmp, because setjmp must not return as otherwise
30*3fcb7147SAlexander Graf  * the stack may become invalid.
31*3fcb7147SAlexander Graf  */
3230eef21fSSimon Glass int setjmp(jmp_buf jmp);
3330eef21fSSimon Glass __noreturn void longjmp(jmp_buf jmp, int ret);
3430eef21fSSimon Glass 
3530eef21fSSimon Glass #endif /* _SETJMP_H_ */
36