TXR Lisp contains BSD licensed code for setjmp-like saving and restoring, for a modest number of platforms, in a single .S (assembly language with preprocessing) file.
The header file for that is unfortunately not cleanly separated; the top part of this file declares the context structures and the two functions jmp_save and jpm_restore.
https://www.kylheku.com/cgit/txr/tree/jmp.S
The header file for that is unfortunately not cleanly separated; the top part of this file declares the context structures and the two functions jmp_save and jpm_restore.
https://www.kylheku.com/cgit/txr/tree/unwind.h
Unlike longjmp, jmp_restore does not check for a zero argument and does not rewrite it to 1.