1@node Xtensa
2@chapter Functions for Xtensa Processors
3
4This chapter describes machine-dependent functions that are included
5in the C library when it is built for Xtensa processors.
6
7@menu
8* setjmp::      Save stack environment
9* longjmp::     Non-local goto
10@end menu
11
12@page
13@node setjmp
14@section @code{setjmp}---save stack environment
15@findex setjmp
16@strong{Synopsis}
17@example
18#include <setjmp.h>
19int setjmp(jmp_buf env);
20
21@end example
22@strong{Description}@*
23@code{setjmp} and @code{longjmp} are useful for dealing with errors
24and interrupts encountered in a low-level subroutine of a program.
25@code{setjmp} saves the stack context/environment in @code{env} for
26later use by @code{longjmp}.  The stack context will be invalidated if
27the function which called @code{setjmp} returns.
28
29@*
30@strong{Returns}@*
31@code{setjmp} returns 0 if returning directly, and non-zero when
32returning from @code{longjmp} using the saved context.
33
34@*
35@strong{Portability}@*
36@code{setjmp} is ANSI C and POSIX.1.
37
38setjmp requires no supporting OS subroutines.
39
40@*
41@page
42@node longjmp
43@section @code{longjmp}---non-local goto
44@findex longjmp
45@strong{Synopsis}
46@example
47#include <setjmp.h>
48void longjmp(jmp_buf env, int val);
49
50@end example
51@strong{Description}@*
52@code{longjmp} and @code{setjmp} are useful for dealing with errors
53and interrupts encountered in a low-level subroutine of a program.
54@code{longjmp} restores the environment saved by the last call of
55@code{setjmp} with the corresponding @code{env} argument.  After
56@code{longjmp} is completed, program execution continues as if the
57corresponding call of @code{setjmp} had just returned the value
58@code{val}.  @code{longjmp} cannot cause 0 to be returned.  If
59@code{longjmp} is invoked with a second argument of 0, 1 will be
60returned instead.
61
62@*
63@strong{Returns}@*
64This function never returns.
65
66@*
67@strong{Portability}@*
68@code{longjmp} is ANSI C and POSIX.1.
69
70longjmp requires no supporting OS subroutines.
71
72@*
73