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 D10V. The jmpbuf looks like this: 18; 19; Register jmpbuf offset 20; R6 0x00 21; R7 0x02 22; R8 0x04 23; R9 0x06 24; R10 0x08 25; R11 0x0a 26; R13 (return address) 0x0c 27; R15 (SP) 0x0E 28 29 .text 30 .globl setjmp 31 .type setjmp,@function 32 .stabs "setjmp.S",100,0,0,setjmp 33 .stabs "int:t(0,1)=r(0,1);-65536;65535;",128,0,0,0 34 .stabs "setjmp:F(0,1)",36,0,1,setjmp 35 36setjmp: 37; Address of jmpbuf is passed in R0. Save the appropriate registers. 38 st2w r6, @r0+ 39 st2w r8, @r0+ 40 st2w r10, @r0+ 41 st r13, @r0+ 42 st r15, @r0+ 43 44; Return 0 to caller 45 ldi r0, 0 46 jmp r13 47.Lsetjmp: 48 .size setjmp,.Lsetjmp-setjmp 49 .stabs "",36,0,0,.Lsetjmp-setjmp 50 51 .globl longjmp 52 .type longjmp,@function 53 .stabs "longjmp:F(0,1)",36,0,1,longjmp 54longjmp: 55; Address of jmpbuf is in R0. Restore the registers. 56 ld2w r6, @r0+ 57 ld2w r8, @r0+ 58 ld2w r10, @r0+ 59 ld r13, @r0+ 60 ld r15, @r0+ 61 62; Value to return to caller is in R1. If caller attemped to return 0, 63; return 1 instead. 64 65 mv r0, r1 66 cmpeqi r0, 0 67 exef0t || ldi r0,1 68 jmp r13 69.Llongjmp: 70 .size longjmp,.Llongjmp-longjmp 71 .stabs "",36,0,0,.Llongjmp-longjmp 72