3 setjmp, longjmp, notejmp \- non-local goto
11 int setjmp(jmp_buf env)
14 void longjmp(jmp_buf env, int val)
17 void notejmp(void *uregs, jmp_buf env, int val)
19 These routines are useful for dealing with errors
20 and interrupts encountered in
21 a low-level subroutine of a program.
24 saves its stack environment in
31 restores the environment saved by the last call of
33 It then causes execution to
34 continue as if the call of
36 had just returned with value
40 must not itself have returned in the interim.
41 All accessible data have values as of the time
48 except that it is to be called from within a note handler (see
52 argument should be the first argument passed to the note handler.
57 can also be used to switch stacks.
58 Several macros are defined in
59 .B /$objtype/include/u.h
60 that can be used to build
62 by hand. The following code establishes a
67 to begin execution in a function
69 with 1024 bytes of stack:
82 label[JMPBUFPC] = ((ulong)f+JMPBUFDPC);
83 /* -2 leaves room for old pc and new pc in frame */
85 (ulong)(&stack[NSTACK-2*sizeof(ulong*)]);
89 .B /sys/src/libc/$objtype/setjmp.s
91 .B /sys/src/libc/$objtype/notejmp.c
97 cannot recover from an address trap or bus error (page fault) on the 680x0