{"id":2228174,"url":"http://patchwork.ozlabs.org/api/1.1/patches/2228174/?format=json","web_url":"http://patchwork.ozlabs.org/project/qemu-devel/patch/20260425155140.50186-6-deller@kernel.org/","project":{"id":14,"url":"http://patchwork.ozlabs.org/api/1.1/projects/14/?format=json","name":"QEMU Development","link_name":"qemu-devel","list_id":"qemu-devel.nongnu.org","list_email":"qemu-devel@nongnu.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20260425155140.50186-6-deller@kernel.org>","date":"2026-04-25T15:51:31","name":"[PULL,05/14] linux-user/arm/nwfpe: Replace user_registers with current_cpu","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"be46ae36a9bfb4d6e609380a01cd238d77506a67","submitter":{"id":87076,"url":"http://patchwork.ozlabs.org/api/1.1/people/87076/?format=json","name":"Helge Deller","email":"deller@kernel.org"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/qemu-devel/patch/20260425155140.50186-6-deller@kernel.org/mbox/","series":[{"id":501448,"url":"http://patchwork.ozlabs.org/api/1.1/series/501448/?format=json","web_url":"http://patchwork.ozlabs.org/project/qemu-devel/list/?series=501448","date":"2026-04-25T15:51:29","name":"[PULL,01/14] MAINTAINERS: Add myself as maintainer for linux-user","version":1,"mbox":"http://patchwork.ozlabs.org/series/501448/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/2228174/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/2228174/checks/","tags":{},"headers":{"Return-Path":"<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@legolas.ozlabs.org","Authentication-Results":["legolas.ozlabs.org;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256\n header.s=k20201202 header.b=W/wXxi6G;\n\tdkim-atps=neutral","legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org\n (client-ip=209.51.188.17; helo=lists1p.gnu.org;\n envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n receiver=patchwork.ozlabs.org)"],"Received":["from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17])\n\t(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4g2vVv5YqTz1yHv\n\tfor <incoming@patchwork.ozlabs.org>; Sun, 26 Apr 2026 01:53:11 +1000 (AEST)","from localhost ([::1] helo=lists1p.gnu.org)\n\tby lists1p.gnu.org with esmtp (Exim 4.90_1)\n\t(envelope-from <qemu-devel-bounces@nongnu.org>)\n\tid 1wGfIn-00086g-DN; Sat, 25 Apr 2026 11:52:17 -0400","from eggs.gnu.org ([2001:470:142:3::10])\n by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)\n (Exim 4.90_1) (envelope-from <deller@kernel.org>) id 1wGfIV-00080g-Id\n for qemu-devel@nongnu.org; Sat, 25 Apr 2026 11:52:00 -0400","from tor.source.kernel.org ([172.105.4.254])\n by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)\n (Exim 4.90_1) (envelope-from <deller@kernel.org>) id 1wGfIS-00012S-Eh\n for qemu-devel@nongnu.org; Sat, 25 Apr 2026 11:51:59 -0400","from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58])\n by tor.source.kernel.org (Postfix) with ESMTP id BF9F36011F;\n Sat, 25 Apr 2026 15:51:53 +0000 (UTC)","by smtp.kernel.org (Postfix) with ESMTPSA id 12733C2BCB0;\n Sat, 25 Apr 2026 15:51:51 +0000 (UTC)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org;\n s=k20201202; t=1777132313;\n bh=QIFtf3dqQlSgmjSkVvwlhh3G2J8OJkshPhuv1bYI+XA=;\n h=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n b=W/wXxi6GPNWlBF2vwGQ2mInU1zcNbHELKUz6F3mGR1p0e+ahF3jPQQAL3oKx1YxdW\n aCvwjSckA4E00F52MBoKAwA1yaEORWNZ5WrC2i8CgS3RWiv9GcoE7FEqMDKGQx8cKF\n mJQW3iuEAC7JV4xqTDsVvNE+1ZpnZOVzPTX0AC8goFTLf+qohYN993xKhortbQAqMm\n LrLbyafmspdR4834ChsCYXFFTpxHW1GDFED7JbnCpA3bk88c01W0kRenhGAEfwMTlQ\n AZ54t0MaOvsgubvg8d7JW4e+lWjtlB9+kuVI69g19WtGFD0OcyWIpRymiGuxf807Hc\n ttMGGAgMXHFpA==","From":"Helge Deller <deller@kernel.org>","To":"qemu-devel@nongnu.org","Cc":"Helge Deller <deller@gmx.de>, Jiaxun Yang <jiaxun.yang@flygoat.com>,\n Laurent Vivier <laurent@vivier.eu>,\n Pierrick Bouvier <pierrick.bouvier@linaro.org>, =?utf-8?q?Philippe_Mathieu-?=\n\t=?utf-8?q?Daud=C3=A9?= <philmd@linaro.org>","Subject":"[PULL 05/14] linux-user/arm/nwfpe: Replace user_registers with\n current_cpu","Date":"Sat, 25 Apr 2026 17:51:31 +0200","Message-ID":"<20260425155140.50186-6-deller@kernel.org>","X-Mailer":"git-send-email 2.53.0","In-Reply-To":"<20260425155140.50186-1-deller@kernel.org>","References":"<20260425155140.50186-1-deller@kernel.org>","MIME-Version":"1.0","Content-Type":"text/plain; charset=UTF-8","Content-Transfer-Encoding":"8bit","Received-SPF":"pass client-ip=172.105.4.254; envelope-from=deller@kernel.org;\n helo=tor.source.kernel.org","X-Spam_score_int":"-20","X-Spam_score":"-2.1","X-Spam_bar":"--","X-Spam_report":"(-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001,\n DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,\n SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no","X-Spam_action":"no action","X-BeenThere":"qemu-devel@nongnu.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"qemu development <qemu-devel.nongnu.org>","List-Unsubscribe":"<https://lists.nongnu.org/mailman/options/qemu-devel>,\n <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>","List-Archive":"<https://lists.nongnu.org/archive/html/qemu-devel>","List-Post":"<mailto:qemu-devel@nongnu.org>","List-Help":"<mailto:qemu-devel-request@nongnu.org?subject=help>","List-Subscribe":"<https://lists.nongnu.org/mailman/listinfo/qemu-devel>,\n <mailto:qemu-devel-request@nongnu.org?subject=subscribe>","Errors-To":"qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org","Sender":"qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org"},"content":"From: Richard Henderson <richard.henderson@linaro.org>\n\nUse the thread-local variable current_cpu instead of\na global variable to access the general registers.\nThis also means we don't need to pass env to EmulateAll.\n\nSigned-off-by: Richard Henderson <richard.henderson@linaro.org>\nReviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>\nSigned-off-by: Helge Deller <deller@gmx.de>\n---\n linux-user/arm/cpu_loop.c    |  2 +-\n linux-user/arm/nwfpe/fpa11.c |  9 +--------\n linux-user/arm/nwfpe/fpa11.h | 23 +++++++----------------\n 3 files changed, 9 insertions(+), 25 deletions(-)","diff":"diff --git a/linux-user/arm/cpu_loop.c b/linux-user/arm/cpu_loop.c\nindex 19874f4c72..262ab5cc41 100644\n--- a/linux-user/arm/cpu_loop.c\n+++ b/linux-user/arm/cpu_loop.c\n@@ -215,7 +215,7 @@ static bool insn_is_linux_bkpt(uint32_t opcode, bool is_thumb)\n static bool emulate_arm_fpa11(CPUARMState *env, uint32_t opcode)\n {\n     TaskState *ts = get_task_state(env_cpu(env));\n-    int rc = EmulateAll(opcode, &ts->fpa, env);\n+    int rc = EmulateAll(opcode, &ts->fpa);\n     int raise, enabled;\n \n     if (rc == 0) {\ndiff --git a/linux-user/arm/nwfpe/fpa11.c b/linux-user/arm/nwfpe/fpa11.c\nindex 0f1afbd91d..44783934b2 100644\n--- a/linux-user/arm/nwfpe/fpa11.c\n+++ b/linux-user/arm/nwfpe/fpa11.c\n@@ -30,7 +30,6 @@\n \n \n FPA11* qemufpa = NULL;\n-CPUARMState* user_registers;\n \n /* Reset the FPA11 chip.  Called to initialize and reset the emulator. */\n void resetFPA11(void)\n@@ -156,7 +155,7 @@ void SetRoundingPrecision(const unsigned int opcode)\n \n /* Emulate the instruction in the opcode. */\n /* ??? This is not thread safe.  */\n-unsigned int EmulateAll(unsigned int opcode, FPA11* qfpa, CPUARMState* qregs)\n+unsigned int EmulateAll(unsigned int opcode, FPA11* qfpa)\n {\n   unsigned int nRc = 0;\n //  unsigned long flags;\n@@ -173,12 +172,6 @@ unsigned int EmulateAll(unsigned int opcode, FPA11* qfpa, CPUARMState* qregs)\n   }\n \n   qemufpa=qfpa;\n-  user_registers=qregs;\n-\n-#if 0\n-  fprintf(stderr,\"emulating FP insn 0x%08x, PC=0x%08x\\n\",\n-          opcode, qregs[ARM_REG_PC]);\n-#endif\n   fpa11 = GET_FPA11();\n \n   if (fpa11->initflag == 0)\t\t/* good place for __builtin_expect */\ndiff --git a/linux-user/arm/nwfpe/fpa11.h b/linux-user/arm/nwfpe/fpa11.h\nindex d459c5da02..20f9d2eb81 100644\n--- a/linux-user/arm/nwfpe/fpa11.h\n+++ b/linux-user/arm/nwfpe/fpa11.h\n@@ -25,15 +25,6 @@\n \n #define GET_FPA11() (qemufpa)\n \n-/*\n- * The processes registers are always at the very top of the 8K\n- * stack+task struct.  Use the same method as 'current' uses to\n- * reach them.\n- */\n-extern CPUARMState *user_registers;\n-\n-#define GET_USERREG() (user_registers)\n-\n /* Need task_struct */\n //#include <linux/sched.h>\n \n@@ -91,25 +82,25 @@ void SetRoundingPrecision(const unsigned int);\n \n static inline unsigned int readRegister(unsigned int reg)\n {\n-    return (user_registers->regs[(reg)]);\n+    CPUARMState *env = cpu_env(current_cpu);\n+    return env->regs[reg];\n }\n \n static inline void writeRegister(unsigned int x, unsigned int y)\n {\n-#if 0\n-\tprintf(\"writing %d to r%d\\n\",y,x);\n-#endif\n-        user_registers->regs[(x)]=(y);\n+    CPUARMState *env = cpu_env(current_cpu);\n+    env->regs[x] = y;\n }\n \n static inline void writeConditionCodes(unsigned int x)\n {\n-    cpsr_write(user_registers, x, CPSR_NZCV, CPSRWriteByInstr);\n+    CPUARMState *env = cpu_env(current_cpu);\n+    cpsr_write(env, x, CPSR_NZCV, CPSRWriteByInstr);\n }\n \n #define ARM_REG_PC 15\n \n-unsigned int EmulateAll(unsigned int opcode, FPA11* qfpa, CPUARMState* qregs);\n+unsigned int EmulateAll(unsigned int opcode, FPA11* qfpa);\n \n unsigned int EmulateCPDO(const unsigned int);\n unsigned int EmulateCPDT(const unsigned int);\n","prefixes":["PULL","05/14"]}