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 236291ad77SPeter Maydell static inline void cpu_clone_regs(CPUSPARCState *env, target_ulong newsp) 246291ad77SPeter Maydell { 256291ad77SPeter Maydell if (newsp) { 266291ad77SPeter Maydell env->regwptr[22] = newsp; 276291ad77SPeter Maydell } 28f5147c93SPeter Maydell /* syscall return for clone child: 0, and clear CF since 29f5147c93SPeter Maydell * this counts as a success return value. 30f5147c93SPeter Maydell */ 316291ad77SPeter Maydell env->regwptr[0] = 0; 32f5147c93SPeter Maydell #if defined(TARGET_SPARC64) && !defined(TARGET_ABI32) 33f5147c93SPeter Maydell env->xcc &= ~PSR_CARRY; 34f5147c93SPeter Maydell #else 35f5147c93SPeter Maydell env->psr &= ~PSR_CARRY; 36f5147c93SPeter Maydell #endif 376291ad77SPeter Maydell } 386291ad77SPeter Maydell 39f5147c93SPeter Maydell static inline void cpu_set_tls(CPUSPARCState *env, target_ulong newtls) 40f5147c93SPeter Maydell { 41f5147c93SPeter Maydell env->gregs[7] = newtls; 42f5147c93SPeter Maydell } 436291ad77SPeter Maydell 449850f9f6SLaurent Vivier static inline abi_ulong get_sp_from_cpustate(CPUSPARCState *state) 459850f9f6SLaurent Vivier { 46*083244d3SRichard Henderson return state->regwptr[WREG_SP]; 479850f9f6SLaurent Vivier } 48*083244d3SRichard Henderson 496291ad77SPeter Maydell #endif 50