16291ad77SPeter Maydell /* 26291ad77SPeter Maydell * SPARC specific CPU ABI and functions for linux-user 36291ad77SPeter Maydell * 46291ad77SPeter Maydell * Copyright (C) 2003 Thomas M. Ogrisegg <tom@fnord.at> 56291ad77SPeter Maydell * Copyright (C) 2003-2005 Fabrice Bellard 66291ad77SPeter Maydell * 76291ad77SPeter Maydell * This library is free software; you can redistribute it and/or 86291ad77SPeter Maydell * modify it under the terms of the GNU Lesser General Public 96291ad77SPeter Maydell * License as published by the Free Software Foundation; either 106291ad77SPeter Maydell * version 2 of the License, or (at your option) any later version. 116291ad77SPeter Maydell * 126291ad77SPeter Maydell * This library is distributed in the hope that it will be useful, 136291ad77SPeter Maydell * but WITHOUT ANY WARRANTY; without even the implied warranty of 146291ad77SPeter Maydell * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 156291ad77SPeter Maydell * Lesser General Public License for more details. 166291ad77SPeter Maydell * 176291ad77SPeter Maydell * You should have received a copy of the GNU Lesser General Public 186291ad77SPeter Maydell * License along with this library; if not, see <http://www.gnu.org/licenses/>. 196291ad77SPeter Maydell */ 2055c5063cSMarkus Armbruster #ifndef SPARC_TARGET_CPU_H 2155c5063cSMarkus Armbruster #define SPARC_TARGET_CPU_H 226291ad77SPeter Maydell 23608999d1SRichard Henderson static inline void cpu_clone_regs_child(CPUSPARCState *env, target_ulong newsp, 24608999d1SRichard Henderson unsigned flags) 256291ad77SPeter Maydell { 266291ad77SPeter Maydell if (newsp) { 276291ad77SPeter Maydell env->regwptr[22] = newsp; 286291ad77SPeter Maydell } 29f5147c93SPeter Maydell /* syscall return for clone child: 0, and clear CF since 30f5147c93SPeter Maydell * this counts as a success return value. 31f5147c93SPeter Maydell */ 326291ad77SPeter Maydell env->regwptr[0] = 0; 33f5147c93SPeter Maydell #if defined(TARGET_SPARC64) && !defined(TARGET_ABI32) 34f5147c93SPeter Maydell env->xcc &= ~PSR_CARRY; 35f5147c93SPeter Maydell #else 36f5147c93SPeter Maydell env->psr &= ~PSR_CARRY; 37f5147c93SPeter Maydell #endif 386291ad77SPeter Maydell } 396291ad77SPeter Maydell 40*07a6ecf4SRichard Henderson static inline void cpu_clone_regs_parent(CPUSPARCState *env, unsigned flags) 41*07a6ecf4SRichard Henderson { 42*07a6ecf4SRichard Henderson } 43*07a6ecf4SRichard Henderson 44f5147c93SPeter Maydell static inline void cpu_set_tls(CPUSPARCState *env, target_ulong newtls) 45f5147c93SPeter Maydell { 46f5147c93SPeter Maydell env->gregs[7] = newtls; 47f5147c93SPeter Maydell } 486291ad77SPeter Maydell 499850f9f6SLaurent Vivier static inline abi_ulong get_sp_from_cpustate(CPUSPARCState *state) 509850f9f6SLaurent Vivier { 51083244d3SRichard Henderson return state->regwptr[WREG_SP]; 529850f9f6SLaurent Vivier } 53083244d3SRichard Henderson 546291ad77SPeter Maydell #endif 55