1/* 2Copyright (c) 1990 The Regents of the University of California. 3All rights reserved. 4 5Redistribution and use in source and binary forms are permitted 6provided that the above copyright notice and this paragraph are 7duplicated in all such forms and that any documentation, 8and/or other materials related to such 9distribution and use acknowledge that the software was developed 10by the University of California, Berkeley. The name of the 11University may not be used to endorse or promote products derived 12from this software without specific prior written permission. 13THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR 14IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED 15WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 16 */ 17# setjmp/longjmp for FR30. The jmpbuf looks like this: 18# 19# Register jmpbuf offset 20# R8 0x00 21# R9 0x04 22# R10 0x08 23# R11 0x0c 24# R12 0x10 25# R13 0x14 26# R14 (FP) 0x18 27# R15 (SP) 0x1c 28# RP 0x20 29 30.macro save reg 31 st \reg,@r4 32 add #4,r4 33.endm 34 35.macro restore reg 36 ld @r4,\reg 37 add #4,r4 38.endm 39 40 41 .text 42 .global setjmp 43setjmp: 44 save r8 45 save r9 46 save r10 47 save r11 48 save r12 49 save r13 50 save r14 51 save r15 52 mov RP,r5 53 st r5,@r4 54 55# Return 0 to caller. 56 ldi:8 #0,r4 57 ret 58 59 .global longjmp 60longjmp: 61 restore r8 62 restore r9 63 restore r10 64 restore r11 65 restore r12 66 restore r13 67 restore r14 68 restore r15 69 ld @r4,r4 70 mov r4,RP 71 72# If caller attempted to return 0, return 1 instead. 73 74 mov r5,r4 75 or r4,r4 76 bne 1f 77 ldi:8 #1,r4 78 1: 79 ret 80