1 #ifndef SPARC_TARGET_SYSCALL_H
2 #define SPARC_TARGET_SYSCALL_H
3 
4 #include "target_errno.h"
5 
6 #if defined(TARGET_SPARC64) && !defined(TARGET_ABI32)
7 struct target_pt_regs {
8     abi_ulong u_regs[16];
9     abi_ulong tstate;
10     abi_ulong pc;
11     abi_ulong npc;
12     uint32_t y;
13     uint32_t magic;
14 };
15 #else
16 struct target_pt_regs {
17     abi_ulong psr;
18     abi_ulong pc;
19     abi_ulong npc;
20     abi_ulong y;
21     abi_ulong u_regs[16];
22 };
23 #endif
24 
25 #ifdef TARGET_SPARC64
26 # define UNAME_MACHINE "sparc64"
27 #else
28 # define UNAME_MACHINE "sparc"
29 #endif
30 #define UNAME_MINIMUM_RELEASE "2.6.32"
31 
32 /*
33  * SPARC kernels don't define this in their Kconfig, but they have the
34  * same ABI as if they did, implemented by sparc-specific code which fishes
35  * directly in the u_regs() struct for half the parameters in sparc_do_fork()
36  * and copy_thread().
37  */
38 #define TARGET_CLONE_BACKWARDS
39 #define TARGET_MINSIGSTKSZ      4096
40 #define TARGET_MCL_CURRENT 0x2000
41 #define TARGET_MCL_FUTURE  0x4000
42 #define TARGET_MCL_ONFAULT 0x8000
43 
44 /*
45  * For SPARC SHMLBA is determined at runtime in the kernel, and
46  * libc has to runtime-detect it using the hwcaps.
47  * See glibc sysdeps/unix/sysv/linux/sparc/getshmlba.
48  */
49 #define TARGET_FORCE_SHMLBA
50 
51 static inline abi_ulong target_shmlba(CPUSPARCState *env)
52 {
53 #ifdef TARGET_SPARC64
54     return MAX(TARGET_PAGE_SIZE, 16 * 1024);
55 #else
56     if (!(env->def.features & CPU_FEATURE_FLUSH)) {
57         return 64 * 1024;
58     } else {
59         return 256 * 1024;
60     }
61 #endif
62 }
63 
64 #endif /* SPARC_TARGET_SYSCALL_H */
65