-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
linux-user: Move cpu_clone_regs() and cpu_set_tls() into linux-user
The functions cpu_clone_regs() and cpu_set_tls() are not purely CPU related -- they are specific to the TLS ABI for a a particular OS. Move them into the linux-user/ tree where they belong. target-lm32 had entirely unused implementations, since it has no linux-user target; just drop them. Signed-off-by: Peter Maydell <[email protected]> Acked-by: Richard Henderson <[email protected]> Signed-off-by: Andreas Färber <[email protected]>
- Loading branch information
Showing
31 changed files
with
460 additions
and
188 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/* | ||
* Alpha specific CPU ABI and functions for linux-user | ||
* | ||
* Copyright (c) 2007 Jocelyn Mayer | ||
* | ||
* This library is free software; you can redistribute it and/or | ||
* modify it under the terms of the GNU Lesser General Public | ||
* License as published by the Free Software Foundation; either | ||
* version 2 of the License, or (at your option) any later version. | ||
* | ||
* This library is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
* Lesser General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Lesser General Public | ||
* License along with this library; if not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
#ifndef TARGET_CPU_H | ||
#define TARGET_CPU_H | ||
|
||
static inline void cpu_clone_regs(CPUAlphaState *env, target_ulong newsp) | ||
{ | ||
if (newsp) { | ||
env->ir[IR_SP] = newsp; | ||
} | ||
env->ir[IR_V0] = 0; | ||
env->ir[IR_A3] = 0; | ||
} | ||
|
||
static inline void cpu_set_tls(CPUAlphaState *env, target_ulong newtls) | ||
{ | ||
env->unique = newtls; | ||
} | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
/* | ||
* ARM specific CPU ABI and functions for linux-user | ||
* | ||
* Copyright (c) 2003 Fabrice Bellard | ||
* | ||
* This library is free software; you can redistribute it and/or | ||
* modify it under the terms of the GNU Lesser General Public | ||
* License as published by the Free Software Foundation; either | ||
* version 2 of the License, or (at your option) any later version. | ||
* | ||
* This library is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
* Lesser General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Lesser General Public | ||
* License along with this library; if not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
#ifndef TARGET_CPU_H | ||
#define TARGET_CPU_H | ||
|
||
static inline void cpu_clone_regs(CPUARMState *env, target_ulong newsp) | ||
{ | ||
if (newsp) { | ||
env->regs[13] = newsp; | ||
} | ||
env->regs[0] = 0; | ||
} | ||
|
||
static inline void cpu_set_tls(CPUARMState *env, target_ulong newtls) | ||
{ | ||
env->cp15.c13_tls2 = newtls; | ||
} | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/* | ||
* CRIS specific CPU ABI and functions for linux-user | ||
* | ||
* Copyright (c) 2007 AXIS Communications AB | ||
* Written by Edgar E. Iglesias | ||
* | ||
* This library is free software; you can redistribute it and/or | ||
* modify it under the terms of the GNU Lesser General Public | ||
* License as published by the Free Software Foundation; either | ||
* version 2 of the License, or (at your option) any later version. | ||
* | ||
* This library is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
* General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Lesser General Public | ||
* License along with this library; if not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
#ifndef TARGET_CPU_H | ||
#define TARGET_CPU_H | ||
|
||
static inline void cpu_clone_regs(CPUCRISState *env, target_ulong newsp) | ||
{ | ||
if (newsp) { | ||
env->regs[14] = newsp; | ||
} | ||
env->regs[10] = 0; | ||
} | ||
|
||
static inline void cpu_set_tls(CPUCRISState *env, target_ulong newtls) | ||
{ | ||
env->pregs[PR_PID] = (env->pregs[PR_PID] & 0xff) | newtls; | ||
} | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/* | ||
* i386 specific CPU ABI and functions for linux-user | ||
* | ||
* Copyright (c) 2003 Fabrice Bellard | ||
* | ||
* This library is free software; you can redistribute it and/or | ||
* modify it under the terms of the GNU Lesser General Public | ||
* License as published by the Free Software Foundation; either | ||
* version 2 of the License, or (at your option) any later version. | ||
* | ||
* This library is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
* Lesser General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Lesser General Public | ||
* License along with this library; if not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
#ifndef TARGET_CPU_H | ||
#define TARGET_CPU_H | ||
|
||
static inline void cpu_clone_regs(CPUX86State *env, target_ulong newsp) | ||
{ | ||
if (newsp) { | ||
env->regs[R_ESP] = newsp; | ||
} | ||
env->regs[R_EAX] = 0; | ||
} | ||
|
||
/* TODO: need to implement cpu_set_tls() */ | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/* | ||
* m68k specific CPU ABI and functions for linux-user | ||
* | ||
* Copyright (c) 2005-2007 CodeSourcery | ||
* Written by Paul Brook | ||
* | ||
* This library is free software; you can redistribute it and/or | ||
* modify it under the terms of the GNU Lesser General Public | ||
* License as published by the Free Software Foundation; either | ||
* version 2 of the License, or (at your option) any later version. | ||
* | ||
* This library is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
* General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Lesser General Public | ||
* License along with this library; if not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
#ifndef TARGET_CPU_H | ||
#define TARGET_CPU_H | ||
|
||
static inline void cpu_clone_regs(CPUM68KState *env, target_ulong newsp) | ||
{ | ||
if (newsp) { | ||
env->aregs[7] = newsp; | ||
} | ||
env->dregs[0] = 0; | ||
} | ||
|
||
/* TODO: need to implement cpu_set_tls() */ | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
/* | ||
* MicroBlaze specific CPU ABI and functions for linux-user | ||
* | ||
* Copyright (c) 2009 Edgar E. Iglesias | ||
* | ||
* This library is free software; you can redistribute it and/or | ||
* modify it under the terms of the GNU Lesser General Public | ||
* License as published by the Free Software Foundation; either | ||
* version 2 of the License, or (at your option) any later version. | ||
* | ||
* This library is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
* General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Lesser General Public | ||
* License along with this library; if not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
#ifndef TARGET_CPU_H | ||
#define TARGET_CPU_H | ||
|
||
static inline void cpu_clone_regs(CPUMBState *env, target_ulong newsp) | ||
{ | ||
if (newsp) { | ||
env->regs[R_SP] = newsp; | ||
} | ||
env->regs[3] = 0; | ||
} | ||
|
||
static inline void cpu_set_tls(CPUMBState *env, target_ulong newtls) | ||
{ | ||
env->regs[21] = newtls; | ||
} | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/* | ||
* MIPS specific CPU ABI and functions for linux-user | ||
* | ||
* Copyright (c) 2004-2005 Jocelyn Mayer | ||
* | ||
* This library is free software; you can redistribute it and/or | ||
* modify it under the terms of the GNU Lesser General Public | ||
* License as published by the Free Software Foundation; either | ||
* version 2 of the License, or (at your option) any later version. | ||
* | ||
* This library is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
* Lesser General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Lesser General Public | ||
* License along with this library; if not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
#ifndef TARGET_CPU_H | ||
#define TARGET_CPU_H | ||
|
||
static inline void cpu_clone_regs(CPUMIPSState *env, target_ulong newsp) | ||
{ | ||
if (newsp) { | ||
env->active_tc.gpr[29] = newsp; | ||
} | ||
env->active_tc.gpr[7] = 0; | ||
env->active_tc.gpr[2] = 0; | ||
} | ||
|
||
static inline void cpu_set_tls(CPUMIPSState *env, target_ulong newtls) | ||
{ | ||
env->tls_value = newtls; | ||
} | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
#include "../mips/target_cpu.h" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/* | ||
* OpenRISC specific CPU ABI and functions for linux-user | ||
* | ||
* Copyright (c) 2011-2012 Jia Liu <[email protected]> | ||
* | ||
* This library is free software; you can redistribute it and/or | ||
* modify it under the terms of the GNU Lesser General Public | ||
* License as published by the Free Software Foundation; either | ||
* version 2 of the License, or (at your option) any later version. | ||
* | ||
* This library is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
* Lesser General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Lesser General Public | ||
* License along with this library; if not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
#ifndef TARGET_CPU_H | ||
#define TARGET_CPU_H | ||
|
||
static inline void cpu_clone_regs(CPUOpenRISCState *env, target_ulong newsp) | ||
{ | ||
if (newsp) { | ||
env->gpr[1] = newsp; | ||
} | ||
env->gpr[2] = 0; | ||
} | ||
|
||
/* TODO: need to implement cpu_set_tls() */ | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
/* | ||
* PowerPC specific CPU ABI and functions for linux-user | ||
* | ||
* Copyright (c) 2003-2007 Jocelyn Mayer | ||
* | ||
* This library is free software; you can redistribute it and/or | ||
* modify it under the terms of the GNU Lesser General Public | ||
* License as published by the Free Software Foundation; either | ||
* version 2 of the License, or (at your option) any later version. | ||
* | ||
* This library is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
* Lesser General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Lesser General Public | ||
* License along with this library; if not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
#ifndef TARGET_CPU_H | ||
#define TARGET_CPU_H | ||
|
||
static inline void cpu_clone_regs(CPUPPCState *env, target_ulong newsp) | ||
{ | ||
if (newsp) { | ||
env->gpr[1] = newsp; | ||
} | ||
env->gpr[3] = 0; | ||
} | ||
|
||
static inline void cpu_set_tls(CPUPPCState *env, target_ulong newtls) | ||
{ | ||
#if defined(TARGET_PPC64) | ||
/* The kernel checks TIF_32BIT here; we don't support loading 32-bit | ||
binaries on PPC64 yet. */ | ||
env->gpr[13] = newtls; | ||
#else | ||
env->gpr[2] = newtls; | ||
#endif | ||
} | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/* | ||
* S/390 specific CPU ABI and functions for linux-user | ||
* | ||
* Copyright (c) 2009 Ulrich Hecht | ||
* | ||
* This library is free software; you can redistribute it and/or | ||
* modify it under the terms of the GNU Lesser General Public | ||
* License as published by the Free Software Foundation; either | ||
* version 2 of the License, or (at your option) any later version. | ||
* | ||
* This library is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
* Lesser General Public License for more details. | ||
* | ||
* Contributions after 2012-10-29 are licensed under the terms of the | ||
* GNU GPL, version 2 or (at your option) any later version. | ||
* | ||
* You should have received a copy of the GNU (Lesser) General Public | ||
* License along with this library; if not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
#ifndef TARGET_CPU_H | ||
#define TARGET_CPU_H | ||
|
||
static inline void cpu_clone_regs(CPUS390XState *env, target_ulong newsp) | ||
{ | ||
if (newsp) { | ||
env->regs[15] = newsp; | ||
} | ||
env->regs[2] = 0; | ||
} | ||
|
||
static inline void cpu_set_tls(CPUS390XState *env, target_ulong newtls) | ||
{ | ||
env->aregs[0] = newtls >> 32; | ||
env->aregs[1] = newtls & 0xffffffffULL; | ||
} | ||
|
||
#endif |
Oops, something went wrong.