]>
Commit | Line | Data |
---|---|---|
dff8da6b | 1 | /* Copyright (C) 1997-2024 Free Software Foundation, Inc. |
5ae3e846 | 2 | This file is part of the GNU C Library. |
5ae3e846 UD |
3 | |
4 | The GNU C Library is free software; you can redistribute it and/or | |
41bdb6e2 AJ |
5 | modify it under the terms of the GNU Lesser General Public |
6 | License as published by the Free Software Foundation; either | |
7 | version 2.1 of the License, or (at your option) any later version. | |
5ae3e846 UD |
8 | |
9 | The GNU C Library is distributed in the hope that it will be useful, | |
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
41bdb6e2 | 12 | Lesser General Public License for more details. |
5ae3e846 | 13 | |
41bdb6e2 | 14 | You should have received a copy of the GNU Lesser General Public |
59ba27a6 | 15 | License along with the GNU C Library; if not, see |
5a82c748 | 16 | <https://www.gnu.org/licenses/>. */ |
5ae3e846 UD |
17 | |
18 | #ifndef _LINUX_SPARC64_SYSDEP_H | |
19 | #define _LINUX_SPARC64_SYSDEP_H 1 | |
20 | ||
aab39a09 | 21 | #include <sysdeps/unix/sysv/linux/sparc/sysdep.h> |
5ae3e846 | 22 | |
a3848485 | 23 | #if IS_IN (rtld) |
369b849f RM |
24 | # include <dl-sysdep.h> /* Defines RTLD_PRIVATE_ERRNO. */ |
25 | #endif | |
ced368f7 | 26 | #include <tls.h> |
369b849f | 27 | |
5ae3e846 UD |
28 | #undef SYS_ify |
29 | #define SYS_ify(syscall_name) __NR_##syscall_name | |
30 | ||
66715f83 | 31 | #ifdef __ASSEMBLER__ |
5ae3e846 | 32 | |
131fd126 | 33 | #define LOADSYSCALL(x) mov __NR_##x, %g1 |
5ae3e846 | 34 | |
5ae3e846 | 35 | #undef PSEUDO |
043cee37 RM |
36 | #define PSEUDO(name, syscall_name, args) \ |
37 | .text; \ | |
043cee37 RM |
38 | ENTRY(name); \ |
39 | LOADSYSCALL(syscall_name); \ | |
40 | ta 0x6d; \ | |
41 | bcc,pt %xcc, 1f; \ | |
3ba57516 DM |
42 | nop; \ |
43 | SYSCALL_ERROR_HANDLER \ | |
043cee37 RM |
44 | 1: |
45 | ||
aab39a09 | 46 | #undef PSEUDO_NOERRNO |
043cee37 RM |
47 | #define PSEUDO_NOERRNO(name, syscall_name, args)\ |
48 | .text; \ | |
49 | ENTRY(name); \ | |
50 | LOADSYSCALL(syscall_name); \ | |
51 | ta 0x6d; | |
52 | ||
aab39a09 | 53 | #undef PSEUDO_ERRVAL |
043cee37 RM |
54 | #define PSEUDO_ERRVAL(name, syscall_name, args) \ |
55 | .text; \ | |
56 | ENTRY(name); \ | |
57 | LOADSYSCALL(syscall_name); \ | |
58 | ta 0x6d; | |
59 | ||
aab39a09 | 60 | #undef PSEUDO_END |
043cee37 RM |
61 | #define PSEUDO_END(name) \ |
62 | END(name) | |
a334319f | 63 | |
3ba57516 DM |
64 | #ifndef PIC |
65 | # define SYSCALL_ERROR_HANDLER \ | |
66 | mov %o7, %g1; \ | |
67 | call __syscall_error; \ | |
68 | mov %g1, %o7; | |
69 | #else | |
70 | # if RTLD_PRIVATE_ERRNO | |
53362a4b | 71 | # define SYSCALL_ERROR_HANDLER \ |
3d2b3019 DM |
72 | 0: SETUP_PIC_REG_LEAF(o2,g1) \ |
73 | sethi %gdop_hix22(rtld_errno), %g1; \ | |
74 | xor %g1, %gdop_lox10(rtld_errno), %g1;\ | |
75 | ldx [%o2 + %g1], %g1, %gdop(rtld_errno); \ | |
76 | st %o0, [%g1]; \ | |
77 | jmp %o7 + 8; \ | |
78 | mov -1, %o0; | |
3ba57516 DM |
79 | # elif defined _LIBC_REENTRANT |
80 | ||
4f41c682 | 81 | # if IS_IN (libc) |
d063d164 UD |
82 | # define SYSCALL_ERROR_ERRNO __libc_errno |
83 | # else | |
84 | # define SYSCALL_ERROR_ERRNO errno | |
85 | # endif | |
dd54084d DM |
86 | # define SYSCALL_ERROR_HANDLER \ |
87 | 0: SETUP_PIC_REG_LEAF(o2,g1) \ | |
3ba57516 DM |
88 | sethi %tie_hi22(SYSCALL_ERROR_ERRNO), %g1; \ |
89 | add %g1, %tie_lo10(SYSCALL_ERROR_ERRNO), %g1; \ | |
90 | ldx [%o2 + %g1], %g1, %tie_ldx(SYSCALL_ERROR_ERRNO);\ | |
d063d164 UD |
91 | st %o0, [%g7 + %g1]; \ |
92 | jmp %o7 + 8; \ | |
3ba57516 | 93 | mov -1, %o0; |
3ba57516 | 94 | # else |
53362a4b | 95 | # define SYSCALL_ERROR_HANDLER \ |
3d2b3019 DM |
96 | 0: SETUP_PIC_REG_LEAF(o2,g1) \ |
97 | sethi %gdop_hix22(errno), %g1;\ | |
98 | xor %g1, %gdop_lox10(errno), %g1;\ | |
99 | ldx [%o2 + %g1], %g1, %gdop(errno);\ | |
100 | st %o0, [%g1]; \ | |
101 | jmp %o7 + 8; \ | |
102 | mov -1, %o0; | |
3ba57516 DM |
103 | # endif /* _LIBC_REENTRANT */ |
104 | #endif /* PIC */ | |
5ae3e846 | 105 | |
4d76a0ec UD |
106 | #else /* __ASSEMBLER__ */ |
107 | ||
108 | #define __SYSCALL_STRING \ | |
2c1903cb | 109 | "mov %[scn], %%g1;" \ |
4d76a0ec UD |
110 | "ta 0x6d;" \ |
111 | "bcc,pt %%xcc, 1f;" \ | |
86c5d2cf | 112 | " nop;" \ |
3ba57516 | 113 | "sub %%g0, %%o0, %%o0;" \ |
369b849f RM |
114 | "1:" |
115 | ||
86746abb | 116 | #define __SYSCALL_CLOBBERS \ |
2c1903cb | 117 | "g1", "f0", "f1", "f2", "f3", "f4", "f5", "f6", "f7", \ |
4d76a0ec UD |
118 | "f8", "f9", "f10", "f11", "f12", "f13", "f14", "f15", \ |
119 | "f16", "f17", "f18", "f19", "f20", "f21", "f22", "f23", \ | |
120 | "f24", "f25", "f26", "f27", "f28", "f29", "f30", "f31", \ | |
121 | "f32", "f34", "f36", "f38", "f40", "f42", "f44", "f46", \ | |
122 | "f48", "f50", "f52", "f54", "f56", "f58", "f60", "f62", \ | |
123 | "cc", "memory" | |
124 | ||
66715f83 | 125 | #endif /* __ASSEMBLER__ */ |
5ae3e846 | 126 | |
9bd9c815 | 127 | /* This is the offset from the %sp to the backing store above the |
5ae3e846 UD |
128 | register windows. So if you poke stack memory directly you add this. */ |
129 | #define STACK_BIAS 2047 | |
130 | ||
131 | #endif /* linux/sparc64/sysdep.h */ |