1#include <picolibc.h> 2 3 ############################################################################## 4 # setjmp.S -- CRX setjmp routine # 5 # # 6 /* Copyright (c) 2004 National Semiconductor Corporation */ 7 # # 8 # The authors hereby grant permission to use, copy, modify, distribute, # 9 # and license this software and its documentation for any purpose, provided # 10 # that existing copyright notices are retained in all copies and that this # 11 # notice is included verbatim in any distributions. No written agreement, # 12 # license, or royalty fee is required for any of the authorized uses. # 13 # Modifications to this software may be copyrighted by their authors # 14 # and need not follow the licensing terms described here, provided that # 15 # the new terms are clearly indicated on the first page of each file where # 16 # they apply. # 17 # # 18 # C library -- setjmp, longjmp # 19 # longjmp(a,v) # 20 # will generate a "return(v)" # 21 # from the last call to # 22 # setjmp(a) # 23 # by restoring r7-ra, sp, # 24 # and pc from 'a' # 25 # and doing a return. (Makes sure that longjmp never returns 0). # 26 ############################################################################## 27 28 .text 29 .file "setjmp.s" 30 .align 4 31 32 .globl _setjmp 33 .align 4 34_setjmp: 35 #r2: .blkw 36 storm r2,{r7,r8,r9,r10,r11,r12,r13,r14} 37 stord sp,0(r2) 38 movd $0,r0 39 jump ra 40 41 .globl _longjmp 42_longjmp: 43 #r2: .blkw # pointer save area 44 #r3: .blkw # ret vlaue 45 loadm r2, {r7,r8,r9,r10,r11,r12,r13,ra} 46 loadd 0(r2), sp 47 movd r3, r0 48 cmpd $0, r3 49 bne end1 50 movd $1, r0 51end1: 52 jump ra 53 .align 4 54