]> git.ipfire.org Git - thirdparty/glibc.git/blame - sysdeps/unix/sysv/linux/sh/sh4/setcontext.S
* po/ru.po: Update from translation team.
[thirdparty/glibc.git] / sysdeps / unix / sysv / linux / sh / sh4 / setcontext.S
CommitLineData
76e95c88
UD
1/* Install given context.
2 Copyright (C) 2005 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
4
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.
9
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.
14
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. */
19
20#include <sysdep.h>
21
22#include "ucontext_i.h"
23
24/* int __setcontext (const ucontext_t *uc); */
25
26 .text
27 .align 5
76e95c88
UD
28ENTRY(__setcontext)
29
30 mov r4, r8
31
32 /* sigprocmask (SIG_SETMASK, &uc->uc_sigmask, NULL). */
33 mov r4, r5
34 add #(oSIGMASK/2), r5
35 add #(oSIGMASK/2), r5
36 mov #SIG_SETMASK, r4
37 mov #0, r6
38 mov #+SYS_ify(sigprocmask), r3
39 trapa #0x13
40 mov r0, r1
41 mov #-12, r2
42 shad r2, r1
43 not r1, r1 // r1=0 means r0 = -1 to -4095
44 tst r1, r1 // i.e. error in linux
45 bf .Lsetcontext_restore
46.Lsyscall_error:
47 SYSCALL_ERROR_HANDLER
48.Lpseudo_end:
49 rts
50 nop
51
52.Lsetcontext_restore:
53 mov r8, r0
54 add #(oFR0),r0
55 fmov.s @r0+, fr0
56 fmov.s @r0+, fr1
57 fmov.s @r0+, fr2
58 fmov.s @r0+, fr3
59 fmov.s @r0+, fr4
60 fmov.s @r0+, fr5
61 fmov.s @r0+, fr6
62 fmov.s @r0+, fr7
63 fmov.s @r0+, fr8
64 fmov.s @r0+, fr9
65 fmov.s @r0+, fr10
66 fmov.s @r0+, fr11
67 fmov.s @r0+, fr12
68 fmov.s @r0+, fr13
69 fmov.s @r0+, fr14
70 fmov.s @r0+, fr15
71 frchg
72 fmov.s @r0+, fr0
73 fmov.s @r0+, fr1
74 fmov.s @r0+, fr2
75 fmov.s @r0+, fr3
76 fmov.s @r0+, fr4
77 fmov.s @r0+, fr5
78 fmov.s @r0+, fr6
79 fmov.s @r0+, fr7
80 fmov.s @r0+, fr8
81 fmov.s @r0+, fr9
82 fmov.s @r0+, fr10
83 fmov.s @r0+, fr11
84 fmov.s @r0+, fr12
85 fmov.s @r0+, fr13
86 fmov.s @r0+, fr14
87 fmov.s @r0+, fr15
88 frchg
89 lds.l @r0+, fpscr
90 lds.l @r0+, fpul
91
92 mov r8, r0
93 add #(oPC), r0
94 mov.l @r0+, r2
95 lds.l @r0+, pr
96
97 /* Restore T frag. */
98 mov.l @r0+, r1
99 shlr r1
100 /* Skip GBR which is used for thread pointer. */
101 add #4, r0
102
103 lds.l @r0+, mach
104 lds.l @r0+, macl
105
106 mov r8, r0
107 add #(oR9), r0
108 mov.l @r0+, r9
109 mov.l @r0+, r10
110 mov.l @r0+, r11
111 mov.l @r0+, r12
112 mov.l @r0+, r13
113 mov.l @r0+, r14
114 mov.l @r0+, r15
115
116 mov r8, r0
117 mov.l @(oR0,r0), r1
118 mov.l r1, @-r15
119 cfi_adjust_cfa_offset(4)
120 cfi_rel_offset (r1, 0)
121 mov.l r2, @-r15
122 cfi_adjust_cfa_offset(4)
123 cfi_rel_offset (r2, 0)
124
125 mov.l @(oR1,r0), r1
126 mov.l @(oR2,r0), r2
127 mov.l @(oR3,r0), r3
128 mov.l @(oR4,r0), r4
129 mov.l @(oR5,r0), r5
130 mov.l @(oR6,r0), r6
131 mov.l @(oR7,r0), r7
132 mov.l @(oR8,r0), r8
133 mov.l @r15+, r0
134 jmp @r0
135 mov.l @r15+, r0
136
76e95c88
UD
137PSEUDO_END(__setcontext)
138
139weak_alias (__setcontext, setcontext)