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 m32r. The jmpbuf looks like this: 18# 19# Register jmpbuf offset 20# reserved 0x00 21# R8 0x04 22# R9 0x08 23# R10 0x0c 24# R11 0x10 25# R12 0x14 26# R13 (FP) 0x18 27# R14 (LR) 0x1c 28# R15 (SP) 0x20 29# reserved 0x24 30 31 .text 32 .global setjmp 33setjmp: 34 ;addi r0, #-4 ; commented out as first word is reserved 35 ;st r1, @+r0 36 st r8, @+r0 37 st r9, @+r0 38 st r10, @+r0 39 st r11, @+r0 40 st r12, @+r0 41 st r13, @+r0 42 st r14, @+r0 43 st r15, @+r0 44 45# Return 0 to caller. 46 ldi r0, #0 47 jmp lr 48 49 .global longjmp 50longjmp: 51 addi r0, #4 ; first word is reserved 52 ;ld r1, @r0+ 53 ld r8, @r0+ 54 ld r9, @r0+ 55 ld r10, @r0+ 56 ld r11, @r0+ 57 ld r12, @r0+ 58 ld r13, @r0+ 59 ld r2, @r0+ ; return address 60 ld r15, @r0+ 61 62# If caller attempted to return 0, return 1 instead. 63 64 mv r0, r1 65 bnez r0, .Lnonzero 66 ldi r0, #1 67.Lnonzero: 68 jmp r2 69