Blob


1 /* Copyright (C) 2001 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
3 Contributed by Jakub Jelinek <jakub@redhat.com>.
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, write to the Free
17 Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
18 02111-1307 USA. */
20 /* Constants shared between setcontext() and getcontext(). Don't
21 install this header file. */
24 #define UC_LINK 0
25 #define __UC_SIGMASK 16
26 #define UC_M_PC 40
27 #define UC_M_NPC 48
28 #define UC_SIGMASK 536
29 #define SIGMASK_WORDS 16
31 /* Copyright (C) 1997, 2001 Free Software Foundation, Inc.
32 This file is part of the GNU C Library.
33 Contributed by Richard Henderson (rth@tamu.edu).
35 The GNU C Library is free software; you can redistribute it and/or
36 modify it under the terms of the GNU Lesser General Public
37 License as published by the Free Software Foundation; either
38 version 2.1 of the License, or (at your option) any later version.
40 The GNU C Library is distributed in the hope that it will be useful,
41 but WITHOUT ANY WARRANTY; without even the implied warranty of
42 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
43 Lesser General Public License for more details.
45 You should have received a copy of the GNU Lesser General Public
46 License along with the GNU C Library; if not, write to the Free
47 Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
48 02111-1307 USA. */
50 #define ENTRY(x) x:
51 #define END(x)
53 /*#include "ucontext_i.h" (up above) */
55 /* int getcontext(ucontext_t *); */
57 ENTRY(getcontext)
59 ldx [%o0 + UC_LINK], %o1 /* Preserve uc_link field, the
60 trap clears it. */
61 ta 0x6e
62 1:
63 ldx [%o0 + UC_M_PC], %o2
64 ldx [%o0 + UC_M_NPC], %o3
65 ldx [%o0 + __UC_SIGMASK], %o4
66 stx %o1, [%o0 + UC_LINK]
67 add %o2, 2f - 1b, %o2
68 stx %o2, [%o0 + UC_M_PC]
69 add %o3, 2f - 1b, %o3
70 stx %o3, [%o0 + UC_M_NPC]
71 #if SIGMASK_WORDS == 16
72 stx %o4, [%o0 + UC_SIGMASK]
73 stx %g0, [%o0 + UC_SIGMASK + 8]
74 stx %g0, [%o0 + UC_SIGMASK + 16]
75 stx %g0, [%o0 + UC_SIGMASK + 24]
76 stx %g0, [%o0 + UC_SIGMASK + 32]
77 stx %g0, [%o0 + UC_SIGMASK + 40]
78 stx %g0, [%o0 + UC_SIGMASK + 48]
79 stx %g0, [%o0 + UC_SIGMASK + 56]
80 stx %g0, [%o0 + UC_SIGMASK + 64]
81 stx %g0, [%o0 + UC_SIGMASK + 72]
82 stx %g0, [%o0 + UC_SIGMASK + 80]
83 stx %g0, [%o0 + UC_SIGMASK + 88]
84 stx %g0, [%o0 + UC_SIGMASK + 96]
85 stx %g0, [%o0 + UC_SIGMASK + 104]
86 stx %g0, [%o0 + UC_SIGMASK + 112]
87 stx %g0, [%o0 + UC_SIGMASK + 120]
88 #else
89 # error Adjust getcontext
90 #endif
91 2:
92 retl
93 clr %o0
95 END(getcontext)
97 /* Copyright (C) 1997, 2001 Free Software Foundation, Inc.
98 This file is part of the GNU C Library.
99 Contributed by Richard Henderson (rth@tamu.edu).
101 The GNU C Library is free software; you can redistribute it and/or
102 modify it under the terms of the GNU Lesser General Public
103 License as published by the Free Software Foundation; either
104 version 2.1 of the License, or (at your option) any later version.
106 The GNU C Library is distributed in the hope that it will be useful,
107 but WITHOUT ANY WARRANTY; without even the implied warranty of
108 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
109 Lesser General Public License for more details.
111 You should have received a copy of the GNU Lesser General Public
112 License along with the GNU C Library; if not, write to the Free
113 Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
114 02111-1307 USA. */
116 /*
117 #include <sysdep.h>
118 #include "ucontext_i.h"
119 */
121 /* int setcontext(ucontext_t *ctx); */
122 .weak setcontext
123 ENTRY(setcontext)
125 mov 1, %o1
127 /* int __setcontext(ucontext_t *ctx, int restoremask); */
128 ENTRY(__setcontext)
130 ldx [%o0 + UC_SIGMASK], %o2
131 stx %o2, [%o0 + __UC_SIGMASK]
132 ta 0x6f
134 END(__setcontext)