blob: be77e44eb860e09bf978f17cefafd513f70be8e5 [file] [log] [blame]
Markus Armbruster36226342016-06-29 10:47:26 +02001#ifndef SPARC_TARGET_SYSCALL_H
2#define SPARC_TARGET_SYSCALL_H
Lluís Vilanova460c5792016-02-01 19:38:42 +01003
Richard Henderson2f23eec2021-04-25 19:53:16 -07004#if defined(TARGET_SPARC64) && !defined(TARGET_ABI32)
bellard7a3f1942003-09-30 20:36:07 +00005struct target_pt_regs {
Richard Henderson2f23eec2021-04-25 19:53:16 -07006 abi_ulong u_regs[16];
7 abi_ulong tstate;
8 abi_ulong pc;
9 abi_ulong npc;
10 uint32_t y;
11 uint32_t magic;
bellard7a3f1942003-09-30 20:36:07 +000012};
Richard Henderson2f23eec2021-04-25 19:53:16 -070013#else
14struct target_pt_regs {
15 abi_ulong psr;
16 abi_ulong pc;
17 abi_ulong npc;
18 abi_ulong y;
19 abi_ulong u_regs[16];
20};
21#endif
bellardcf720db2004-09-13 21:41:39 +000022
Richard Henderson2f23eec2021-04-25 19:53:16 -070023#ifdef TARGET_SPARC64
24# define UNAME_MACHINE "sparc64"
25#else
26# define UNAME_MACHINE "sparc"
27#endif
Riku Voipiocbc14e62014-02-19 14:50:41 +020028#define UNAME_MINIMUM_RELEASE "2.6.32"
Peter Maydell4ce62432013-07-16 18:44:57 +010029
Richard Henderson2f23eec2021-04-25 19:53:16 -070030/*
31 * SPARC kernels don't define this in their Kconfig, but they have the
Peter Maydell4ce62432013-07-16 18:44:57 +010032 * same ABI as if they did, implemented by sparc-specific code which fishes
33 * directly in the u_regs() struct for half the parameters in sparc_do_fork()
34 * and copy_thread().
35 */
36#define TARGET_CLONE_BACKWARDS
Filip Bozuta02e5d7d2020-08-11 18:45:51 +020037#define TARGET_MCL_CURRENT 0x2000
38#define TARGET_MCL_FUTURE 0x4000
39#define TARGET_MCL_ONFAULT 0x8000
Lluís Vilanova460c5792016-02-01 19:38:42 +010040
Richard Henderson2f23eec2021-04-25 19:53:16 -070041/*
42 * For SPARC SHMLBA is determined at runtime in the kernel, and
43 * libc has to runtime-detect it using the hwcaps.
44 * See glibc sysdeps/unix/sysv/linux/sparc/getshmlba.
Peter Maydellee8e7612016-07-11 16:48:11 +010045 */
46#define TARGET_FORCE_SHMLBA
47
48static inline abi_ulong target_shmlba(CPUSPARCState *env)
49{
Richard Henderson2f23eec2021-04-25 19:53:16 -070050#ifdef TARGET_SPARC64
51 return MAX(TARGET_PAGE_SIZE, 16 * 1024);
52#else
Igor Mammedov576e1c42017-08-24 18:31:26 +020053 if (!(env->def.features & CPU_FEATURE_FLUSH)) {
Peter Maydellee8e7612016-07-11 16:48:11 +010054 return 64 * 1024;
55 } else {
56 return 256 * 1024;
57 }
Richard Henderson2f23eec2021-04-25 19:53:16 -070058#endif
Peter Maydellee8e7612016-07-11 16:48:11 +010059}
60
Markus Armbruster36226342016-06-29 10:47:26 +020061#endif /* SPARC_TARGET_SYSCALL_H */