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