compat_sigsetjmp.S revision 1.1 1 1.1 uwe /* $NetBSD: compat_sigsetjmp.S,v 1.1 2005/10/15 22:11:22 uwe Exp $ */
2 1.1 uwe /*
3 1.1 uwe * Copyright (c) 1995 Paul Kranenburg
4 1.1 uwe * All rights reserved.
5 1.1 uwe *
6 1.1 uwe * Redistribution and use in source and binary forms, with or without
7 1.1 uwe * modification, are permitted provided that the following conditions
8 1.1 uwe * are met:
9 1.1 uwe * 1. Redistributions of source code must retain the above copyright
10 1.1 uwe * notice, this list of conditions and the following disclaimer.
11 1.1 uwe * 2. Redistributions in binary form must reproduce the above copyright
12 1.1 uwe * notice, this list of conditions and the following disclaimer in the
13 1.1 uwe * documentation and/or other materials provided with the distribution.
14 1.1 uwe * 3. All advertising materials mentioning features or use of this software
15 1.1 uwe * must display the following acknowledgement:
16 1.1 uwe * This product includes software developed by Paul Kranenburg.
17 1.1 uwe * 4. The name of the author may not be used to endorse or promote products
18 1.1 uwe * derived from this software without specific prior written permission
19 1.1 uwe *
20 1.1 uwe * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
21 1.1 uwe * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
22 1.1 uwe * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
23 1.1 uwe * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
24 1.1 uwe * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
25 1.1 uwe * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 1.1 uwe * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27 1.1 uwe * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 1.1 uwe * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
29 1.1 uwe * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 1.1 uwe *
31 1.1 uwe */
32 1.1 uwe
33 1.1 uwe #include "SYS.h"
34 1.1 uwe
35 1.1 uwe #ifdef PIC
36 1.1 uwe
37 1.1 uwe ENTRY(sigsetjmp)
38 1.1 uwe PIC_PROLOGUE(%g1,%g2) ! %g1 = _GLOBAL_OFFSET_TABLE
39 1.1 uwe cmp %o1,0
40 1.1 uwe st %o1,[%o0+40] ! jmpbuf[JBLEN]
41 1.1 uwe bne,a 1f
42 1.1 uwe ld [%g1+_C_LABEL(setjmp)], %g1 ! if (%o1 != 0) goto _setjmp;
43 1.1 uwe ld [%g1+_C_LABEL(_setjmp)], %g1 ! else goto __setjmp;
44 1.1 uwe 1:
45 1.1 uwe jmp %g1
46 1.1 uwe nop
47 1.1 uwe
48 1.1 uwe ENTRY(siglongjmp)
49 1.1 uwe PIC_PROLOGUE(%g1,%g2) ! %g1 = _GLOBAL_OFFSET_TABLE
50 1.1 uwe ld [%o0+40],%g2 ! jmpbuf[JBLEN]
51 1.1 uwe cmp %g2,0
52 1.1 uwe bne,a 1f
53 1.1 uwe ld [%g1+_C_LABEL(longjmp)], %g1 ! if (%g2 != 0) goto _longjmp;
54 1.1 uwe ld [%g1+_C_LABEL(_longjmp)], %g1 ! else goto __longjmp;
55 1.1 uwe 1:
56 1.1 uwe jmp %g1
57 1.1 uwe nop
58 1.1 uwe unimp 0
59 1.1 uwe
60 1.1 uwe #else /* PIC */
61 1.1 uwe
62 1.1 uwe ENTRY(sigsetjmp)
63 1.1 uwe cmp %o1,0
64 1.1 uwe be _C_LABEL(_setjmp)
65 1.1 uwe st %o1,[%o0+40] ! jmpbuf[JBLEN]
66 1.1 uwe nop
67 1.1 uwe ba,a _C_LABEL(setjmp)
68 1.1 uwe unimp 0
69 1.1 uwe
70 1.1 uwe ENTRY(siglongjmp)
71 1.1 uwe ld [%o0+40],%g1
72 1.1 uwe cmp %g1,0
73 1.1 uwe be _C_LABEL(_longjmp)
74 1.1 uwe nop
75 1.1 uwe ba,a _C_LABEL(longjmp)
76 1.1 uwe unimp 0
77 1.1 uwe
78 1.1 uwe #endif /* PIC */
79