1 /* Userland trampoline code for sigaction on Linux/SPARC */
2 /* (C) 1996, 1997 Free Software Foundation, Inc. */
3 /* This file is part of the GNU C Library. */
4 /* Contributed by Miguel de Icaza (miguel@gnu.ai.mit.edu) */
5 /* Many thanks go to David Miller for explaining all this to me */
6 /* miguel@nuclecu.unam.mx */
7 /* Sources: David Miller, 4.4BSD/SPARC code */
12 #include <asm/ptrace.h>
15 /* The C compiler frame size */
20 ENTRY(____sparc_signal_trampoline)
21 .global C_SYMBOL_NAME(____sig_table)
23 /* Make room for 32 %f registers + %fsr
24 * this is 132 bytes + alignement = 136
25 * 96 is the C frame size
27 save %sp,-136-CCFSZ,%sp
29 /* save regular registers */
37 /* save fpu registers */
38 ld [%fp+64+16+20],%l0 /* load the psr from sigcontext */
40 andcc %l0,%l1,%l0 /* is floating point enabled? */
42 rd %y,%l1 /* save y anyways */
44 /* save fpu registers */
45 st %fsr, [%sp + CCFSZ + 0]
46 std %f0, [%sp + CCFSZ + 8]
47 std %f2, [%sp + CCFSZ + 16]
48 std %f4, [%sp + CCFSZ + 24]
49 std %f6, [%sp + CCFSZ + 32]
50 std %f8, [%sp + CCFSZ + 40]
51 std %f10, [%sp + CCFSZ + 48]
52 std %f12, [%sp + CCFSZ + 56]
53 std %f14, [%sp + CCFSZ + 64]
54 std %f16, [%sp + CCFSZ + 72]
55 std %f18, [%sp + CCFSZ + 80]
56 std %f20, [%sp + CCFSZ + 88]
57 std %f22, [%sp + CCFSZ + 96]
58 std %f24, [%sp + CCFSZ + 104]
59 std %f26, [%sp + CCFSZ + 112]
60 std %f28, [%sp + CCFSZ + 120]
61 std %f30, [%sp + CCFSZ + 128]
64 /* Load signal number */
65 ld [%fp + REGWIN_SZ],%o0
72 or %g0,%g0,%g1 /*Call sys_setup */
76 /* Save return address */
82 sethi %hi(_GLOBAL_OFFSET_TABLE_-(___sxx-.)),%o5
83 or %o5,%lo(_GLOBAL_OFFSET_TABLE_-(___sxx-.)),%o5
85 /* restore return address */
88 /* o4 has the GOT pointer */
90 sethi %hi(C_SYMBOL_NAME(____sig_table)),%o5
91 or %o5,%lo(C_SYMBOL_NAME(____sig_table)),%o5
99 ld [%fp + REGWIN_SZ + 4],%o1 /* Load subcode */
100 ld [%fp + REGWIN_SZ + 8],%o2 /* pointer to sigcontext */
102 ld [%fp + REGWIN_SZ + 12],%o3 /* Address where signal ocurre
105 /* handler returned, restore state */
110 /* fpu restoration */
111 ld [%sp + CCFSZ + 0], %fsr
112 ldd [%sp + CCFSZ + 8], %f0
113 ldd [%sp + CCFSZ + 16], %f2
114 ldd [%sp + CCFSZ + 24], %f4
115 ldd [%sp + CCFSZ + 32], %f6
116 ldd [%sp + CCFSZ + 40], %f8
117 ldd [%sp + CCFSZ + 48], %f10
118 ldd [%sp + CCFSZ + 56], %f12
119 ldd [%sp + CCFSZ + 64], %f14
120 ldd [%sp + CCFSZ + 72], %f16
121 ldd [%sp + CCFSZ + 80], %f18
122 ldd [%sp + CCFSZ + 88], %f20
123 ldd [%sp + CCFSZ + 96], %f22
124 ldd [%sp + CCFSZ + 104], %f24
125 ldd [%sp + CCFSZ + 112], %f26
126 ldd [%sp + CCFSZ + 120], %f28
127 ldd [%sp + CCFSZ + 128], %f30
138 restore %g0,SYS_ify(sigreturn),%g1 /* register back and set syscal */
141 /* if we return, sysreturn failed */
142 mov SYS_ify(exit),%g1