16291ad77SPeter Maydell /*
26291ad77SPeter Maydell  * OpenRISC specific CPU ABI and functions for linux-user
36291ad77SPeter Maydell  *
46291ad77SPeter Maydell  * Copyright (c) 2011-2012 Jia Liu <proljc@gmail.com>
56291ad77SPeter Maydell  *
66291ad77SPeter Maydell  * This library is free software; you can redistribute it and/or
76291ad77SPeter Maydell  * modify it under the terms of the GNU Lesser General Public
86291ad77SPeter Maydell  * License as published by the Free Software Foundation; either
9198a2d21SThomas Huth  * version 2.1 of the License, or (at your option) any later version.
106291ad77SPeter Maydell  *
116291ad77SPeter Maydell  * This library is distributed in the hope that it will be useful,
126291ad77SPeter Maydell  * but WITHOUT ANY WARRANTY; without even the implied warranty of
136291ad77SPeter Maydell  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
146291ad77SPeter Maydell  * Lesser General Public License for more details.
156291ad77SPeter Maydell  *
166291ad77SPeter Maydell  * You should have received a copy of the GNU Lesser General Public
176291ad77SPeter Maydell  * License along with this library; if not, see <http://www.gnu.org/licenses/>.
186291ad77SPeter Maydell  */
196291ad77SPeter Maydell 
2055c5063cSMarkus Armbruster #ifndef OPENRISC_TARGET_CPU_H
2155c5063cSMarkus Armbruster #define OPENRISC_TARGET_CPU_H
226291ad77SPeter Maydell 
cpu_clone_regs_child(CPUOpenRISCState * env,target_ulong newsp,unsigned flags)23608999d1SRichard Henderson static inline void cpu_clone_regs_child(CPUOpenRISCState *env,
24608999d1SRichard Henderson                                         target_ulong newsp,
25608999d1SRichard Henderson                                         unsigned flags)
266291ad77SPeter Maydell {
276291ad77SPeter Maydell     if (newsp) {
28d89e71e8SStafford Horne         cpu_set_gpr(env, 1, newsp);
296291ad77SPeter Maydell     }
30d89e71e8SStafford Horne     cpu_set_gpr(env, 11, 0);
316291ad77SPeter Maydell }
326291ad77SPeter Maydell 
cpu_clone_regs_parent(CPUOpenRISCState * env,unsigned flags)33*07a6ecf4SRichard Henderson static inline void cpu_clone_regs_parent(CPUOpenRISCState *env, unsigned flags)
34*07a6ecf4SRichard Henderson {
35*07a6ecf4SRichard Henderson }
36*07a6ecf4SRichard Henderson 
cpu_set_tls(CPUOpenRISCState * env,target_ulong newtls)37442a59c8SPeter Maydell static inline void cpu_set_tls(CPUOpenRISCState *env, target_ulong newtls)
38442a59c8SPeter Maydell {
39d89e71e8SStafford Horne     cpu_set_gpr(env, 10, newtls);
40442a59c8SPeter Maydell }
416291ad77SPeter Maydell 
get_sp_from_cpustate(CPUOpenRISCState * state)429850f9f6SLaurent Vivier static inline abi_ulong get_sp_from_cpustate(CPUOpenRISCState *state)
439850f9f6SLaurent Vivier {
449850f9f6SLaurent Vivier     return cpu_get_gpr(state, 1);
459850f9f6SLaurent Vivier }
466291ad77SPeter Maydell #endif
47