1/* A setjmp.c for FT32 2 Copyright (C) 2014 FTDI (support@ftdichip.com) 3 4 The authors 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 for FT32. 15# Total jumpbuf size is 108 bytes, or 27 words. 16# 17 18 .text 19 .global setjmp 20 .type setjmp,@function 21setjmp: 22 pop.l $r5 # return address in $r5 23 sti.l $r0,0,$r5 24 sti.l $r0,4,$r6 25 sti.l $r0,8,$r7 26 sti.l $r0,12,$r8 27 sti.l $r0,16,$r9 28 sti.l $r0,20,$r10 29 sti.l $r0,24,$r11 30 sti.l $r0,28,$r12 31 sti.l $r0,32,$r13 32 sti.l $r0,36,$r14 33 sti.l $r0,40,$r15 34 sti.l $r0,44,$r16 35 sti.l $r0,48,$r17 36 sti.l $r0,52,$r18 37 sti.l $r0,56,$r19 38 sti.l $r0,60,$r20 39 sti.l $r0,64,$r21 40 sti.l $r0,68,$r22 41 sti.l $r0,72,$r23 42 sti.l $r0,76,$r24 43 sti.l $r0,80,$r25 44 sti.l $r0,84,$r26 45 sti.l $r0,88,$r27 46 sti.l $r0,92,$r28 47 sti.l $r0,96,$r29 48 sti.l $r0,100,$r30 49 sti.l $r0,104,$r31 50 ldk.l $r0,0 51 jmpi $r5 52 53.Lend1: 54 .size setjmp,.Lend1-setjmp 55 56 .global longjmp 57 .type longjmp,@function 58longjmp: 59 cmp.l $r1,0 60 jmpc nz,.nonz 61 ldk.l $r1,1 62.nonz: 63 ldi.l $r5,$r0,0 64 ldi.l $r6,$r0,4 65 ldi.l $r7,$r0,8 66 ldi.l $r8,$r0,12 67 ldi.l $r9,$r0,16 68 ldi.l $r10,$r0,20 69 ldi.l $r11,$r0,24 70 ldi.l $r12,$r0,28 71 ldi.l $r13,$r0,32 72 ldi.l $r14,$r0,36 73 ldi.l $r15,$r0,40 74 ldi.l $r16,$r0,44 75 ldi.l $r17,$r0,48 76 ldi.l $r18,$r0,52 77 ldi.l $r19,$r0,56 78 ldi.l $r20,$r0,60 79 ldi.l $r21,$r0,64 80 ldi.l $r22,$r0,68 81 ldi.l $r23,$r0,72 82 ldi.l $r24,$r0,76 83 ldi.l $r25,$r0,80 84 ldi.l $r26,$r0,84 85 ldi.l $r27,$r0,88 86 ldi.l $r28,$r0,92 87 ldi.l $r29,$r0,96 88 ldi.l $r30,$r0,100 89 ldi.l $r31,$r0,104 90 move.l $r0,$r1 91 jmpi $r5 92 93.Lend2: 94 .size longjmp,.Lend2-longjmp 95