2 # Setjmp/longjmp for MeP
4 # DJ Delorie, Red Hat Inc.
6 # 19 32-bit words in the jmpbuf:
15 # Note that $0 is saved but not restored. It can't be restored
16 # as it's the return value of setjmp, but we save it in case
17 # some application wants to see it in the jmp_buf. Ideally,
18 # we should not need to save anything that is call-clobbered,
19 # but you never know what the user is going to tell gcc with -f
26 .type setjmp,@function
30 # $1 is the address of the buffer. We return 0 in $0.
65 .type longjmp,@function
69 # $1 is the address of the buffer. $2 is the value setjmp
70 # returns. We do not faithfully restore $0 or $lp, because
71 # the act of calling setjmp clobbered those anyway.
77 # We restore $sp first so we can save the return value there,
78 # otherwise we'd need to have another unrestored register.
83 # Now restore the general registers.
98 # We restore $pc's value to $lp so that we can just ret later.
104 beqz $0, lj_skip_hilo
114 # Get the return value off the stack, and restore the stack.