xref: /qemu/linux-user/i386/target_cpu.h (revision bc22eb447c0552e2327f278fdc6bedccb14fc7a3)
16291ad77SPeter Maydell /*
26291ad77SPeter Maydell  * i386 specific CPU ABI and functions for linux-user
36291ad77SPeter Maydell  *
46291ad77SPeter Maydell  *  Copyright (c) 2003 Fabrice Bellard
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  */
196291ad77SPeter Maydell 
206291ad77SPeter Maydell #ifndef TARGET_CPU_H
216291ad77SPeter Maydell #define TARGET_CPU_H
226291ad77SPeter Maydell 
236291ad77SPeter Maydell static inline void cpu_clone_regs(CPUX86State *env, target_ulong newsp)
246291ad77SPeter Maydell {
256291ad77SPeter Maydell     if (newsp) {
266291ad77SPeter Maydell         env->regs[R_ESP] = newsp;
276291ad77SPeter Maydell     }
286291ad77SPeter Maydell     env->regs[R_EAX] = 0;
296291ad77SPeter Maydell }
306291ad77SPeter Maydell 
31*bc22eb44SAlexander Graf #if defined(TARGET_ABI32)
32*bc22eb44SAlexander Graf abi_long do_set_thread_area(CPUX86State *env, abi_ulong ptr);
336291ad77SPeter Maydell 
34*bc22eb44SAlexander Graf static inline void cpu_set_tls(CPUX86State *env, target_ulong newtls)
35*bc22eb44SAlexander Graf {
36*bc22eb44SAlexander Graf     do_set_thread_area(env, newtls);
37*bc22eb44SAlexander Graf     cpu_x86_load_seg(env, R_GS, env->segs[R_GS].selector);
38*bc22eb44SAlexander Graf }
39*bc22eb44SAlexander Graf #endif /* defined(TARGET_ABI32) */
40*bc22eb44SAlexander Graf 
41*bc22eb44SAlexander Graf #endif /* !defined(TARGET_CPU_H) */
42