setjmp.s

来自「klibc精简化的c程序库」· S 代码 · 共 39 行

S
39
字号
!! setjmp.S!! Basic setjmp/longjmp!! This code was based on the equivalent code in NetBSD!#include <machine/asm.h>#include <machine/trap.h>!! The jmp_buf contains the following entries:!   sp!   fp!   pc!ENTRY(setjmp)	st	%sp,[%o0+0]	! Callers stack pointer	st	%o7,[%o0+4]	! Return pc	st	%fp,[%o0+8]	! Frame pointer	retl			! Return	 clr	%o0		!  ...0ENTRY(longjmp)	sub	%sp, 64, %sp	! set up a local stack frame0:	t	ST_FLUSHWIN	! flush register windows out to memory	!	! We restore the saved stack pointer to %fp, then issue	! a restore instruction which will reload the register	! window from the stack.	!        ld      [%o0+4], %o7    /* restore return pc */        ld      [%o0+0], %fp    /* and stack pointer */        retl                    ! success, return %g6         restore        %o1, 0, %o0

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?