linux-user/arm/nwfpe: Replace user_registers with current_cpu

Use the thread-local variable current_cpu instead of
a global variable to access the general registers.
This also means we don't need to pass env to EmulateAll.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Helge Deller <deller@gmx.de>
This commit is contained in:
Richard Henderson
2026-04-14 09:02:50 +10:00
committed by Helge Deller
parent 93484c768f
commit c8ea175900
3 changed files with 9 additions and 25 deletions

View File

@@ -215,7 +215,7 @@ static bool insn_is_linux_bkpt(uint32_t opcode, bool is_thumb)
static bool emulate_arm_fpa11(CPUARMState *env, uint32_t opcode)
{
TaskState *ts = get_task_state(env_cpu(env));
int rc = EmulateAll(opcode, &ts->fpa, env);
int rc = EmulateAll(opcode, &ts->fpa);
int raise, enabled;
if (rc == 0) {

View File

@@ -30,7 +30,6 @@
FPA11* qemufpa = NULL;
CPUARMState* user_registers;
/* Reset the FPA11 chip. Called to initialize and reset the emulator. */
void resetFPA11(void)
@@ -156,7 +155,7 @@ void SetRoundingPrecision(const unsigned int opcode)
/* Emulate the instruction in the opcode. */
/* ??? This is not thread safe. */
unsigned int EmulateAll(unsigned int opcode, FPA11* qfpa, CPUARMState* qregs)
unsigned int EmulateAll(unsigned int opcode, FPA11* qfpa)
{
unsigned int nRc = 0;
// unsigned long flags;
@@ -173,12 +172,6 @@ unsigned int EmulateAll(unsigned int opcode, FPA11* qfpa, CPUARMState* qregs)
}
qemufpa=qfpa;
user_registers=qregs;
#if 0
fprintf(stderr,"emulating FP insn 0x%08x, PC=0x%08x\n",
opcode, qregs[ARM_REG_PC]);
#endif
fpa11 = GET_FPA11();
if (fpa11->initflag == 0) /* good place for __builtin_expect */

View File

@@ -25,15 +25,6 @@
#define GET_FPA11() (qemufpa)
/*
* The processes registers are always at the very top of the 8K
* stack+task struct. Use the same method as 'current' uses to
* reach them.
*/
extern CPUARMState *user_registers;
#define GET_USERREG() (user_registers)
/* Need task_struct */
//#include <linux/sched.h>
@@ -91,25 +82,25 @@ void SetRoundingPrecision(const unsigned int);
static inline unsigned int readRegister(unsigned int reg)
{
return (user_registers->regs[(reg)]);
CPUARMState *env = cpu_env(current_cpu);
return env->regs[reg];
}
static inline void writeRegister(unsigned int x, unsigned int y)
{
#if 0
printf("writing %d to r%d\n",y,x);
#endif
user_registers->regs[(x)]=(y);
CPUARMState *env = cpu_env(current_cpu);
env->regs[x] = y;
}
static inline void writeConditionCodes(unsigned int x)
{
cpsr_write(user_registers, x, CPSR_NZCV, CPSRWriteByInstr);
CPUARMState *env = cpu_env(current_cpu);
cpsr_write(env, x, CPSR_NZCV, CPSRWriteByInstr);
}
#define ARM_REG_PC 15
unsigned int EmulateAll(unsigned int opcode, FPA11* qfpa, CPUARMState* qregs);
unsigned int EmulateAll(unsigned int opcode, FPA11* qfpa);
unsigned int EmulateCPDO(const unsigned int);
unsigned int EmulateCPDT(const unsigned int);