xref: /qemu/linux-user/loongarch64/target_cpu.h (revision 8f9abdf5)
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 /*
3  * LoongArch specific CPU ABI and functions for linux-user
4  *
5  * Copyright (c) 2021 Loongson Technology Corporation Limited
6  */
7 
8 #ifndef LOONGARCH_TARGET_CPU_H
9 #define LOONGARCH_TARGET_CPU_H
10 
11 static inline void cpu_clone_regs_child(CPULoongArchState *env,
12                                         target_ulong newsp, unsigned flags)
13 {
14     if (newsp) {
15         env->gpr[3] = newsp;
16     }
17     env->gpr[4] = 0;
18 }
19 
20 static inline void cpu_clone_regs_parent(CPULoongArchState *env,
21                                          unsigned flags)
22 {
23 }
24 
25 static inline void cpu_set_tls(CPULoongArchState *env, target_ulong newtls)
26 {
27     env->gpr[2] = newtls;
28 }
29 
30 static inline abi_ulong get_sp_from_cpustate(CPULoongArchState *state)
31 {
32     return state->gpr[3];
33 }
34 #endif
35