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
9*1c79145fSChetan 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 
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 
3107a6ecf4SRichard Henderson static inline void cpu_clone_regs_parent(CPUARMState *env, unsigned flags)
3207a6ecf4SRichard Henderson {
3307a6ecf4SRichard Henderson }
3407a6ecf4SRichard Henderson 
35e2cea499SAlexander Graf static inline void cpu_set_tls(CPUARMState *env, target_ulong newtls)
36e2cea499SAlexander Graf {
37e4fe830bSPeter Maydell     /* Note that AArch64 Linux keeps the TLS pointer in TPIDR; this is
38e4fe830bSPeter Maydell      * different from AArch32 Linux, which uses TPIDRRO.
39e4fe830bSPeter Maydell      */
4054bf36edSFabian Aggeler     env->cp15.tpidr_el[0] = newtls;
41e2cea499SAlexander Graf }
42e2cea499SAlexander Graf 
439850f9f6SLaurent Vivier static inline abi_ulong get_sp_from_cpustate(CPUARMState *state)
449850f9f6SLaurent Vivier {
459850f9f6SLaurent Vivier    return state->xregs[31];
469850f9f6SLaurent Vivier }
47e2cea499SAlexander Graf #endif
48