1e2cea499SAlexander Graf /*
2e2cea499SAlexander Graf  * ARM AArch64 specific CPU ABI and functions for linux-user
3e2cea499SAlexander Graf  *
4e2cea499SAlexander Graf  * Copyright (c) 2013 Alexander Graf <agraf@suse.de>
5e2cea499SAlexander Graf  *
6e2cea499SAlexander Graf  * This library is free software; you can redistribute it and/or
7e2cea499SAlexander Graf  * modify it under the terms of the GNU Lesser General Public
8e2cea499SAlexander Graf  * License as published by the Free Software Foundation; either
91c79145fSChetan Pant  * version 2.1 of the License, or (at your option) any later version.
10e2cea499SAlexander Graf  *
11e2cea499SAlexander Graf  * This library is distributed in the hope that it will be useful,
12e2cea499SAlexander Graf  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13e2cea499SAlexander Graf  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14e2cea499SAlexander Graf  * Lesser General Public License for more details.
15e2cea499SAlexander Graf  *
16e2cea499SAlexander Graf  * You should have received a copy of the GNU Lesser General Public
17e2cea499SAlexander Graf  * License along with this library; if not, see <http://www.gnu.org/licenses/>.
18e2cea499SAlexander Graf  */
1955c5063cSMarkus Armbruster #ifndef AARCH64_TARGET_CPU_H
2055c5063cSMarkus Armbruster #define AARCH64_TARGET_CPU_H
21e2cea499SAlexander Graf 
cpu_clone_regs_child(CPUARMState * env,target_ulong newsp,unsigned flags)22608999d1SRichard Henderson static inline void cpu_clone_regs_child(CPUARMState *env, target_ulong newsp,
23608999d1SRichard Henderson                                         unsigned flags)
24e2cea499SAlexander Graf {
25e2cea499SAlexander Graf     if (newsp) {
26e2cea499SAlexander Graf         env->xregs[31] = newsp;
27e2cea499SAlexander Graf     }
28e2cea499SAlexander Graf     env->xregs[0] = 0;
29e2cea499SAlexander Graf }
30e2cea499SAlexander Graf 
cpu_clone_regs_parent(CPUARMState * env,unsigned flags)3107a6ecf4SRichard Henderson static inline void cpu_clone_regs_parent(CPUARMState *env, unsigned flags)
3207a6ecf4SRichard Henderson {
3307a6ecf4SRichard Henderson }
3407a6ecf4SRichard Henderson 
cpu_set_tls(CPUARMState * env,target_ulong newtls)35e2cea499SAlexander Graf static inline void cpu_set_tls(CPUARMState *env, target_ulong newtls)
36e2cea499SAlexander Graf {
37*95aa4fddSRichard Henderson     /*
38*95aa4fddSRichard Henderson      * Note that AArch64 Linux keeps the TLS pointer in TPIDR; this is
39e4fe830bSPeter Maydell      * different from AArch32 Linux, which uses TPIDRRO.
40e4fe830bSPeter Maydell      */
4154bf36edSFabian Aggeler     env->cp15.tpidr_el[0] = newtls;
42*95aa4fddSRichard Henderson     /* TPIDR2_EL0 is cleared with CLONE_SETTLS. */
43*95aa4fddSRichard Henderson     env->cp15.tpidr2_el0 = 0;
44e2cea499SAlexander Graf }
45e2cea499SAlexander Graf 
get_sp_from_cpustate(CPUARMState * state)469850f9f6SLaurent Vivier static inline abi_ulong get_sp_from_cpustate(CPUARMState *state)
479850f9f6SLaurent Vivier {
489850f9f6SLaurent Vivier    return state->xregs[31];
499850f9f6SLaurent Vivier }
50e2cea499SAlexander Graf #endif
51