16291ad77SPeter Maydell /* 26291ad77SPeter Maydell * Alpha specific CPU ABI and functions for linux-user 36291ad77SPeter Maydell * 46291ad77SPeter Maydell * Copyright (c) 2007 Jocelyn Mayer 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 96291ad77SPeter Maydell * version 2 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 */ 1955c5063cSMarkus Armbruster #ifndef ALPHA_TARGET_CPU_H 2055c5063cSMarkus Armbruster #define ALPHA_TARGET_CPU_H 216291ad77SPeter Maydell 22608999d1SRichard Henderson static inline void cpu_clone_regs_child(CPUAlphaState *env, target_ulong newsp, 23608999d1SRichard Henderson unsigned flags) 246291ad77SPeter Maydell { 256291ad77SPeter Maydell if (newsp) { 266291ad77SPeter Maydell env->ir[IR_SP] = newsp; 276291ad77SPeter Maydell } 286291ad77SPeter Maydell env->ir[IR_V0] = 0; 296291ad77SPeter Maydell env->ir[IR_A3] = 0; 30*5849dfe4SRichard Henderson env->ir[IR_A4] = 1; /* OSF/1 secondary return: child */ 316291ad77SPeter Maydell } 326291ad77SPeter Maydell 3307a6ecf4SRichard Henderson static inline void cpu_clone_regs_parent(CPUAlphaState *env, unsigned flags) 3407a6ecf4SRichard Henderson { 35*5849dfe4SRichard Henderson /* 36*5849dfe4SRichard Henderson * OSF/1 secondary return: parent 37*5849dfe4SRichard Henderson * Note that the kernel does not do this if SETTLS, because the 38*5849dfe4SRichard Henderson * settls argument register is still live after copy_thread. 39*5849dfe4SRichard Henderson */ 40*5849dfe4SRichard Henderson if (!(flags & CLONE_SETTLS)) { 41*5849dfe4SRichard Henderson env->ir[IR_A4] = 0; 42*5849dfe4SRichard Henderson } 4307a6ecf4SRichard Henderson } 4407a6ecf4SRichard Henderson 456291ad77SPeter Maydell static inline void cpu_set_tls(CPUAlphaState *env, target_ulong newtls) 466291ad77SPeter Maydell { 476291ad77SPeter Maydell env->unique = newtls; 486291ad77SPeter Maydell } 496291ad77SPeter Maydell 509850f9f6SLaurent Vivier static inline abi_ulong get_sp_from_cpustate(CPUAlphaState *state) 519850f9f6SLaurent Vivier { 529850f9f6SLaurent Vivier return state->ir[IR_SP]; 539850f9f6SLaurent Vivier } 546291ad77SPeter Maydell #endif 55