1/* 2 * Copyright (c) 2004 Michael Hayes <m.hayes@elec.canterbury.ac.nz>. 3 * 4 * The author hereby grant permission to use, copy, modify, distribute, 5 * and license this software and its documentation for any purpose, provided 6 * that existing copyright notices are retained in all copies and that this 7 * notice is included verbatim in any distributions. No written agreement, 8 * license, or royalty fee is required for any of the authorized uses. 9 * Modifications to this software may be copyrighted by their authors 10 * and need not follow the licensing terms described here, provided that 11 * the new terms are clearly indicated on the first page of each file where 12 * they apply. 13 */ 14/* setjmp/longjmp routines. */ 15 16#include <picolibc.h> 17 18 .sect .text 19 .global setjmp 20 .global longjmp 21 22setjmp: 23 pop r1 24 ldi sp, ar0 25#ifndef _REGPARM 26 ldi *ar0, ar2 27#endif 28 29 sti r4, *ar2++ 30 sti r5, *ar2++ 31 stf r6, *ar2++ 32 stf r7, *ar2++ 33#ifdef _TMS320C4x 34 sti r8, *ar2++ 35#endif 36 sti ar3, *ar2++ 37 sti ar4, *ar2++ 38 sti ar5, *ar2++ 39 sti ar6, *ar2++ 40 sti ar7, *ar2++ 41 bd r1 42 sti r1, *ar2++ 43 sti ar0, *ar2 44 ldi 0, r0 45 46 47longjmp: 48#ifndef _REGPARM 49 ldi sp, ar0 50 ldi *-ar0(1), ar2 51 ldi *-ar0(2), r0 52 ldiz 1, r0 53#else 54 ldi r2, r0 55 ldiz 1, r0 56#endif 57 58 ldi *ar2++, r4 59 ldi *ar2++, r5 60 ldf *ar2++, r6 61 ldf *ar2++, r7 62#ifdef _TMS320C4x 63 ldi *ar2++, r8 64#endif 65 ldi *ar2++, ar3 66 ldi *ar2++, ar4 67 ldi *ar2++, ar5 68 ldi *ar2++, ar6 69 ldi *ar2++, ar7 70 ldi *ar2++, r1 71 ldi *ar2, sp 72 73 b r1 74 .end 75 76 77 78