Merge remote-tracking branch 'remotes/alistair23/tags/pull-riscv-to-apply-20211022...
[qemu.git] / linux-user / sparc / target_syscall.h
1 #ifndef SPARC_TARGET_SYSCALL_H
2 #define SPARC_TARGET_SYSCALL_H
3
4 #if defined(TARGET_SPARC64) && !defined(TARGET_ABI32)
5 struct target_pt_regs {
6 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;
12 };
13 #else
14 struct 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
22
23 #ifdef TARGET_SPARC64
24 # define UNAME_MACHINE "sparc64"
25 #else
26 # define UNAME_MACHINE "sparc"
27 #endif
28 #define UNAME_MINIMUM_RELEASE "2.6.32"
29
30 /*
31 * SPARC kernels don't define this in their Kconfig, but they have the
32 * 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
37 #define TARGET_MINSIGSTKSZ 4096
38 #define TARGET_MCL_CURRENT 0x2000
39 #define TARGET_MCL_FUTURE 0x4000
40 #define TARGET_MCL_ONFAULT 0x8000
41
42 /*
43 * For SPARC SHMLBA is determined at runtime in the kernel, and
44 * libc has to runtime-detect it using the hwcaps.
45 * See glibc sysdeps/unix/sysv/linux/sparc/getshmlba.
46 */
47 #define TARGET_FORCE_SHMLBA
48
49 static inline abi_ulong target_shmlba(CPUSPARCState *env)
50 {
51 #ifdef TARGET_SPARC64
52 return MAX(TARGET_PAGE_SIZE, 16 * 1024);
53 #else
54 if (!(env->def.features & CPU_FEATURE_FLUSH)) {
55 return 64 * 1024;
56 } else {
57 return 256 * 1024;
58 }
59 #endif
60 }
61
62 #endif /* SPARC_TARGET_SYSCALL_H */