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