From nobody Tue Feb 10 19:50:03 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 15234754332507.96942966856102; Wed, 11 Apr 2018 12:37:13 -0700 (PDT) Received: from localhost ([::1]:49855 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f6LYO-0006Ur-7t for importer@patchew.org; Wed, 11 Apr 2018 15:37:12 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38374) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f6KwN-0006QT-GM for qemu-devel@nongnu.org; Wed, 11 Apr 2018 14:57:57 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1f6KwJ-00085n-UL for qemu-devel@nongnu.org; Wed, 11 Apr 2018 14:57:55 -0400 Received: from mout.kundenserver.de ([217.72.192.75]:37715) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1f6Kw6-0007tb-Tu; Wed, 11 Apr 2018 14:57:39 -0400 Received: from localhost.localdomain ([78.238.229.36]) by mrelayeu.kundenserver.de (mreue105 [212.227.15.183]) with ESMTPSA (Nemesis) id 0MPGl6-1fAieN1U6i-004Tzk; Wed, 11 Apr 2018 20:57:11 +0200 From: Laurent Vivier To: qemu-devel@nongnu.org Date: Wed, 11 Apr 2018 20:56:37 +0200 Message-Id: <20180411185651.21351-6-laurent@vivier.eu> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180411185651.21351-1-laurent@vivier.eu> References: <20180411185651.21351-1-laurent@vivier.eu> X-Provags-ID: V03:K1:gdsC189G3TEKmOhCVUPOqG76qrp4SygVkUEa6OrYRBGZtHhM2YX j+gAdX3uCETYNWV35DrkZK89abtC77fqi/brDuNt/VL+YJUo3LL6X1KV2y0ZJ/snYcdxchX nB7bAUkTasXB/JeuE30ktSO2IShJwPmLHxmrCisjIGHxbNfOhQU7hfXRO4/XLIfffUckzBA rwGGXgNWk+117fBlBArjA== X-UI-Out-Filterresults: notjunk:1;V01:K0:fS0EM4KcljE=:UTanTQ1QnFqkw+UHJOkSxb Sy8TZVpAk5RzXsl7uZvOA847Yn+BoJlfIs5WNN3a1UglndI2mVMBjFQ6+jsLeDnmZHjU11915 pa6qbS5ATDbGinM/Ib4nRakHSUoyyh6kqpT7WcJlOrLaXUDoOe61dgFVOG6mfLUvYb3ogipzk +UDxa3w335sUUDeNwH4T6p9g6eTt7OW1gyOQU9pX4Pblfil3L3zx3lvC6pJIIXrOlHz2y4RYq WUdTefT8Too7gGAa82GfjWRGS/coINJw1nL9yw0wUUNgszxu9R7AypFQeDCuax0FJDMWRKUva zPDhfMUM4ZtIdjt6y85hkqzH6hkPzSipmflW0InHiP0eIZ8wvzsD255vxdLfnUcXZlttPUGKv HyPlJO/fYYqy+SP9e6EcUPG/inEhuAYqSaDQhcNEWxgiq6ZJdgSfU+s+w1OpbTalvEWyBJNdC NLw4LIk771VtDQfu6CcoPetXGzxF+sXKiAeaMbedinnuQJ7I+rNCoM3j55Wa0BueEl8l3UipS rIep2HE2J1p8xmOdAsux5wvJB18zFEDtYKzDHpKWMIWtEwAcdLSRtNzJA/HFKDB8RiyXowLGU ceCMz9b/jlu0o1547z5ImE4jPBHPTqaxAkwlMgNfoysQnZ7Cl871UyYOyDlhq6tSPE35AiB/P KHtMqF+clDyqp9pdZdZ3iAgUbyBsj084ZE84sRdOvAbgLUN+W42FXpxz4haNlc92D4L8M3ek3 5QsFrn4vQBlWz+0VLnApCOSEC0AZ3BEAhJFY4g== X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 217.72.192.75 Subject: [Qemu-devel] [PATCH for 2.13 v2 05/19] linux-user: move sparc/sparc64 cpu loop to sparc directory X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Cornelia Huck , Riku Voipio , Richard Henderson , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Laurent Vivier , qemu-s390x@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" No code change, only move code from main.c to sparc/cpu_loop.c. Include sparc/cpu_loop.c in sparc64/cpu_loop.c to avoid to duplicate code. Signed-off-by: Laurent Vivier Reviewed-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- linux-user/main.c | 288 +-------------------------------------= ---- linux-user/sparc/cpu_loop.c | 280 ++++++++++++++++++++++++++++++++++++++= ++ linux-user/sparc64/cpu_loop.c | 8 +- 3 files changed, 282 insertions(+), 294 deletions(-) diff --git a/linux-user/main.c b/linux-user/main.c index 45d1588958..4816ec54bb 100644 --- a/linux-user/main.c +++ b/linux-user/main.c @@ -149,281 +149,6 @@ void fork_end(int child) } } =20 -#ifdef TARGET_SPARC -#define SPARC64_STACK_BIAS 2047 - -//#define DEBUG_WIN - -/* WARNING: dealing with register windows _is_ complicated. More info - can be found at http://www.sics.se/~psm/sparcstack.html */ -static inline int get_reg_index(CPUSPARCState *env, int cwp, int index) -{ - index =3D (index + cwp * 16) % (16 * env->nwindows); - /* wrap handling : if cwp is on the last window, then we use the - registers 'after' the end */ - if (index < 8 && env->cwp =3D=3D env->nwindows - 1) - index +=3D 16 * env->nwindows; - return index; -} - -/* save the register window 'cwp1' */ -static inline void save_window_offset(CPUSPARCState *env, int cwp1) -{ - unsigned int i; - abi_ulong sp_ptr; - - sp_ptr =3D env->regbase[get_reg_index(env, cwp1, 6)]; -#ifdef TARGET_SPARC64 - if (sp_ptr & 3) - sp_ptr +=3D SPARC64_STACK_BIAS; -#endif -#if defined(DEBUG_WIN) - printf("win_overflow: sp_ptr=3D0x" TARGET_ABI_FMT_lx " save_cwp=3D%d\n= ", - sp_ptr, cwp1); -#endif - for(i =3D 0; i < 16; i++) { - /* FIXME - what to do if put_user() fails? */ - put_user_ual(env->regbase[get_reg_index(env, cwp1, 8 + i)], sp_ptr= ); - sp_ptr +=3D sizeof(abi_ulong); - } -} - -static void save_window(CPUSPARCState *env) -{ -#ifndef TARGET_SPARC64 - unsigned int new_wim; - new_wim =3D ((env->wim >> 1) | (env->wim << (env->nwindows - 1))) & - ((1LL << env->nwindows) - 1); - save_window_offset(env, cpu_cwp_dec(env, env->cwp - 2)); - env->wim =3D new_wim; -#else - save_window_offset(env, cpu_cwp_dec(env, env->cwp - 2)); - env->cansave++; - env->canrestore--; -#endif -} - -static void restore_window(CPUSPARCState *env) -{ -#ifndef TARGET_SPARC64 - unsigned int new_wim; -#endif - unsigned int i, cwp1; - abi_ulong sp_ptr; - -#ifndef TARGET_SPARC64 - new_wim =3D ((env->wim << 1) | (env->wim >> (env->nwindows - 1))) & - ((1LL << env->nwindows) - 1); -#endif - - /* restore the invalid window */ - cwp1 =3D cpu_cwp_inc(env, env->cwp + 1); - sp_ptr =3D env->regbase[get_reg_index(env, cwp1, 6)]; -#ifdef TARGET_SPARC64 - if (sp_ptr & 3) - sp_ptr +=3D SPARC64_STACK_BIAS; -#endif -#if defined(DEBUG_WIN) - printf("win_underflow: sp_ptr=3D0x" TARGET_ABI_FMT_lx " load_cwp=3D%d\= n", - sp_ptr, cwp1); -#endif - for(i =3D 0; i < 16; i++) { - /* FIXME - what to do if get_user() fails? */ - get_user_ual(env->regbase[get_reg_index(env, cwp1, 8 + i)], sp_ptr= ); - sp_ptr +=3D sizeof(abi_ulong); - } -#ifdef TARGET_SPARC64 - env->canrestore++; - if (env->cleanwin < env->nwindows - 1) - env->cleanwin++; - env->cansave--; -#else - env->wim =3D new_wim; -#endif -} - -static void flush_windows(CPUSPARCState *env) -{ - int offset, cwp1; - - offset =3D 1; - for(;;) { - /* if restore would invoke restore_window(), then we can stop */ - cwp1 =3D cpu_cwp_inc(env, env->cwp + offset); -#ifndef TARGET_SPARC64 - if (env->wim & (1 << cwp1)) - break; -#else - if (env->canrestore =3D=3D 0) - break; - env->cansave++; - env->canrestore--; -#endif - save_window_offset(env, cwp1); - offset++; - } - cwp1 =3D cpu_cwp_inc(env, env->cwp + 1); -#ifndef TARGET_SPARC64 - /* set wim so that restore will reload the registers */ - env->wim =3D 1 << cwp1; -#endif -#if defined(DEBUG_WIN) - printf("flush_windows: nb=3D%d\n", offset - 1); -#endif -} - -void cpu_loop (CPUSPARCState *env) -{ - CPUState *cs =3D CPU(sparc_env_get_cpu(env)); - int trapnr; - abi_long ret; - target_siginfo_t info; - - while (1) { - cpu_exec_start(cs); - trapnr =3D cpu_exec(cs); - cpu_exec_end(cs); - process_queued_cpu_work(cs); - - /* Compute PSR before exposing state. */ - if (env->cc_op !=3D CC_OP_FLAGS) { - cpu_get_psr(env); - } - - switch (trapnr) { -#ifndef TARGET_SPARC64 - case 0x88: - case 0x90: -#else - case 0x110: - case 0x16d: -#endif - ret =3D do_syscall (env, env->gregs[1], - env->regwptr[0], env->regwptr[1], - env->regwptr[2], env->regwptr[3], - env->regwptr[4], env->regwptr[5], - 0, 0); - if (ret =3D=3D -TARGET_ERESTARTSYS || ret =3D=3D -TARGET_QEMU_= ESIGRETURN) { - break; - } - if ((abi_ulong)ret >=3D (abi_ulong)(-515)) { -#if defined(TARGET_SPARC64) && !defined(TARGET_ABI32) - env->xcc |=3D PSR_CARRY; -#else - env->psr |=3D PSR_CARRY; -#endif - ret =3D -ret; - } else { -#if defined(TARGET_SPARC64) && !defined(TARGET_ABI32) - env->xcc &=3D ~PSR_CARRY; -#else - env->psr &=3D ~PSR_CARRY; -#endif - } - env->regwptr[0] =3D ret; - /* next instruction */ - env->pc =3D env->npc; - env->npc =3D env->npc + 4; - break; - case 0x83: /* flush windows */ -#ifdef TARGET_ABI32 - case 0x103: -#endif - flush_windows(env); - /* next instruction */ - env->pc =3D env->npc; - env->npc =3D env->npc + 4; - break; -#ifndef TARGET_SPARC64 - case TT_WIN_OVF: /* window overflow */ - save_window(env); - break; - case TT_WIN_UNF: /* window underflow */ - restore_window(env); - break; - case TT_TFAULT: - case TT_DFAULT: - { - info.si_signo =3D TARGET_SIGSEGV; - info.si_errno =3D 0; - /* XXX: check env->error_code */ - info.si_code =3D TARGET_SEGV_MAPERR; - info._sifields._sigfault._addr =3D env->mmuregs[4]; - queue_signal(env, info.si_signo, QEMU_SI_FAULT, &info); - } - break; -#else - case TT_SPILL: /* window overflow */ - save_window(env); - break; - case TT_FILL: /* window underflow */ - restore_window(env); - break; - case TT_TFAULT: - case TT_DFAULT: - { - info.si_signo =3D TARGET_SIGSEGV; - info.si_errno =3D 0; - /* XXX: check env->error_code */ - info.si_code =3D TARGET_SEGV_MAPERR; - if (trapnr =3D=3D TT_DFAULT) - info._sifields._sigfault._addr =3D env->dmmu.mmuregs[4= ]; - else - info._sifields._sigfault._addr =3D cpu_tsptr(env)->tpc; - queue_signal(env, info.si_signo, QEMU_SI_FAULT, &info); - } - break; -#ifndef TARGET_ABI32 - case 0x16e: - flush_windows(env); - sparc64_get_context(env); - break; - case 0x16f: - flush_windows(env); - sparc64_set_context(env); - break; -#endif -#endif - case EXCP_INTERRUPT: - /* just indicate that signals should be handled asap */ - break; - case TT_ILL_INSN: - { - info.si_signo =3D TARGET_SIGILL; - info.si_errno =3D 0; - info.si_code =3D TARGET_ILL_ILLOPC; - info._sifields._sigfault._addr =3D env->pc; - queue_signal(env, info.si_signo, QEMU_SI_FAULT, &info); - } - break; - case EXCP_DEBUG: - { - int sig; - - sig =3D gdb_handlesig(cs, TARGET_SIGTRAP); - if (sig) - { - info.si_signo =3D sig; - info.si_errno =3D 0; - info.si_code =3D TARGET_TRAP_BRKPT; - queue_signal(env, info.si_signo, QEMU_SI_FAULT, &info); - } - } - break; - case EXCP_ATOMIC: - cpu_exec_step_atomic(cs); - break; - default: - printf ("Unhandled trap: 0x%x\n", trapnr); - cpu_dump_state(cs, stderr, fprintf, 0); - exit(EXIT_FAILURE); - } - process_pending_signals (env); - } -} - -#endif - #ifdef TARGET_PPC static inline uint64_t cpu_ppc_get_tb(CPUPPCState *env) { @@ -4002,18 +3727,7 @@ int main(int argc, char **argv, char **envp) =20 target_cpu_copy_regs(env, regs); =20 -#if defined(TARGET_SPARC) - { - int i; - env->pc =3D regs->pc; - env->npc =3D regs->npc; - env->y =3D regs->y; - for(i =3D 0; i < 8; i++) - env->gregs[i] =3D regs->u_regs[i]; - for(i =3D 0; i < 8; i++) - env->regwptr[i] =3D regs->u_regs[i + 8]; - } -#elif defined(TARGET_PPC) +#if defined(TARGET_PPC) { int i; =20 diff --git a/linux-user/sparc/cpu_loop.c b/linux-user/sparc/cpu_loop.c index b7700a5561..7c4796ca23 100644 --- a/linux-user/sparc/cpu_loop.c +++ b/linux-user/sparc/cpu_loop.c @@ -21,6 +21,286 @@ #include "qemu.h" #include "cpu_loop-common.h" =20 +#define SPARC64_STACK_BIAS 2047 + +//#define DEBUG_WIN + +/* WARNING: dealing with register windows _is_ complicated. More info + can be found at http://www.sics.se/~psm/sparcstack.html */ +static inline int get_reg_index(CPUSPARCState *env, int cwp, int index) +{ + index =3D (index + cwp * 16) % (16 * env->nwindows); + /* wrap handling : if cwp is on the last window, then we use the + registers 'after' the end */ + if (index < 8 && env->cwp =3D=3D env->nwindows - 1) + index +=3D 16 * env->nwindows; + return index; +} + +/* save the register window 'cwp1' */ +static inline void save_window_offset(CPUSPARCState *env, int cwp1) +{ + unsigned int i; + abi_ulong sp_ptr; + + sp_ptr =3D env->regbase[get_reg_index(env, cwp1, 6)]; +#ifdef TARGET_SPARC64 + if (sp_ptr & 3) + sp_ptr +=3D SPARC64_STACK_BIAS; +#endif +#if defined(DEBUG_WIN) + printf("win_overflow: sp_ptr=3D0x" TARGET_ABI_FMT_lx " save_cwp=3D%d\n= ", + sp_ptr, cwp1); +#endif + for(i =3D 0; i < 16; i++) { + /* FIXME - what to do if put_user() fails? */ + put_user_ual(env->regbase[get_reg_index(env, cwp1, 8 + i)], sp_ptr= ); + sp_ptr +=3D sizeof(abi_ulong); + } +} + +static void save_window(CPUSPARCState *env) +{ +#ifndef TARGET_SPARC64 + unsigned int new_wim; + new_wim =3D ((env->wim >> 1) | (env->wim << (env->nwindows - 1))) & + ((1LL << env->nwindows) - 1); + save_window_offset(env, cpu_cwp_dec(env, env->cwp - 2)); + env->wim =3D new_wim; +#else + save_window_offset(env, cpu_cwp_dec(env, env->cwp - 2)); + env->cansave++; + env->canrestore--; +#endif +} + +static void restore_window(CPUSPARCState *env) +{ +#ifndef TARGET_SPARC64 + unsigned int new_wim; +#endif + unsigned int i, cwp1; + abi_ulong sp_ptr; + +#ifndef TARGET_SPARC64 + new_wim =3D ((env->wim << 1) | (env->wim >> (env->nwindows - 1))) & + ((1LL << env->nwindows) - 1); +#endif + + /* restore the invalid window */ + cwp1 =3D cpu_cwp_inc(env, env->cwp + 1); + sp_ptr =3D env->regbase[get_reg_index(env, cwp1, 6)]; +#ifdef TARGET_SPARC64 + if (sp_ptr & 3) + sp_ptr +=3D SPARC64_STACK_BIAS; +#endif +#if defined(DEBUG_WIN) + printf("win_underflow: sp_ptr=3D0x" TARGET_ABI_FMT_lx " load_cwp=3D%d\= n", + sp_ptr, cwp1); +#endif + for(i =3D 0; i < 16; i++) { + /* FIXME - what to do if get_user() fails? */ + get_user_ual(env->regbase[get_reg_index(env, cwp1, 8 + i)], sp_ptr= ); + sp_ptr +=3D sizeof(abi_ulong); + } +#ifdef TARGET_SPARC64 + env->canrestore++; + if (env->cleanwin < env->nwindows - 1) + env->cleanwin++; + env->cansave--; +#else + env->wim =3D new_wim; +#endif +} + +static void flush_windows(CPUSPARCState *env) +{ + int offset, cwp1; + + offset =3D 1; + for(;;) { + /* if restore would invoke restore_window(), then we can stop */ + cwp1 =3D cpu_cwp_inc(env, env->cwp + offset); +#ifndef TARGET_SPARC64 + if (env->wim & (1 << cwp1)) + break; +#else + if (env->canrestore =3D=3D 0) + break; + env->cansave++; + env->canrestore--; +#endif + save_window_offset(env, cwp1); + offset++; + } + cwp1 =3D cpu_cwp_inc(env, env->cwp + 1); +#ifndef TARGET_SPARC64 + /* set wim so that restore will reload the registers */ + env->wim =3D 1 << cwp1; +#endif +#if defined(DEBUG_WIN) + printf("flush_windows: nb=3D%d\n", offset - 1); +#endif +} + +void cpu_loop (CPUSPARCState *env) +{ + CPUState *cs =3D CPU(sparc_env_get_cpu(env)); + int trapnr; + abi_long ret; + target_siginfo_t info; + + while (1) { + cpu_exec_start(cs); + trapnr =3D cpu_exec(cs); + cpu_exec_end(cs); + process_queued_cpu_work(cs); + + /* Compute PSR before exposing state. */ + if (env->cc_op !=3D CC_OP_FLAGS) { + cpu_get_psr(env); + } + + switch (trapnr) { +#ifndef TARGET_SPARC64 + case 0x88: + case 0x90: +#else + case 0x110: + case 0x16d: +#endif + ret =3D do_syscall (env, env->gregs[1], + env->regwptr[0], env->regwptr[1], + env->regwptr[2], env->regwptr[3], + env->regwptr[4], env->regwptr[5], + 0, 0); + if (ret =3D=3D -TARGET_ERESTARTSYS || ret =3D=3D -TARGET_QEMU_= ESIGRETURN) { + break; + } + if ((abi_ulong)ret >=3D (abi_ulong)(-515)) { +#if defined(TARGET_SPARC64) && !defined(TARGET_ABI32) + env->xcc |=3D PSR_CARRY; +#else + env->psr |=3D PSR_CARRY; +#endif + ret =3D -ret; + } else { +#if defined(TARGET_SPARC64) && !defined(TARGET_ABI32) + env->xcc &=3D ~PSR_CARRY; +#else + env->psr &=3D ~PSR_CARRY; +#endif + } + env->regwptr[0] =3D ret; + /* next instruction */ + env->pc =3D env->npc; + env->npc =3D env->npc + 4; + break; + case 0x83: /* flush windows */ +#ifdef TARGET_ABI32 + case 0x103: +#endif + flush_windows(env); + /* next instruction */ + env->pc =3D env->npc; + env->npc =3D env->npc + 4; + break; +#ifndef TARGET_SPARC64 + case TT_WIN_OVF: /* window overflow */ + save_window(env); + break; + case TT_WIN_UNF: /* window underflow */ + restore_window(env); + break; + case TT_TFAULT: + case TT_DFAULT: + { + info.si_signo =3D TARGET_SIGSEGV; + info.si_errno =3D 0; + /* XXX: check env->error_code */ + info.si_code =3D TARGET_SEGV_MAPERR; + info._sifields._sigfault._addr =3D env->mmuregs[4]; + queue_signal(env, info.si_signo, QEMU_SI_FAULT, &info); + } + break; +#else + case TT_SPILL: /* window overflow */ + save_window(env); + break; + case TT_FILL: /* window underflow */ + restore_window(env); + break; + case TT_TFAULT: + case TT_DFAULT: + { + info.si_signo =3D TARGET_SIGSEGV; + info.si_errno =3D 0; + /* XXX: check env->error_code */ + info.si_code =3D TARGET_SEGV_MAPERR; + if (trapnr =3D=3D TT_DFAULT) + info._sifields._sigfault._addr =3D env->dmmu.mmuregs[4= ]; + else + info._sifields._sigfault._addr =3D cpu_tsptr(env)->tpc; + queue_signal(env, info.si_signo, QEMU_SI_FAULT, &info); + } + break; +#ifndef TARGET_ABI32 + case 0x16e: + flush_windows(env); + sparc64_get_context(env); + break; + case 0x16f: + flush_windows(env); + sparc64_set_context(env); + break; +#endif +#endif + case EXCP_INTERRUPT: + /* just indicate that signals should be handled asap */ + break; + case TT_ILL_INSN: + { + info.si_signo =3D TARGET_SIGILL; + info.si_errno =3D 0; + info.si_code =3D TARGET_ILL_ILLOPC; + info._sifields._sigfault._addr =3D env->pc; + queue_signal(env, info.si_signo, QEMU_SI_FAULT, &info); + } + break; + case EXCP_DEBUG: + { + int sig; + + sig =3D gdb_handlesig(cs, TARGET_SIGTRAP); + if (sig) + { + info.si_signo =3D sig; + info.si_errno =3D 0; + info.si_code =3D TARGET_TRAP_BRKPT; + queue_signal(env, info.si_signo, QEMU_SI_FAULT, &info); + } + } + break; + case EXCP_ATOMIC: + cpu_exec_step_atomic(cs); + break; + default: + printf ("Unhandled trap: 0x%x\n", trapnr); + cpu_dump_state(cs, stderr, fprintf, 0); + exit(EXIT_FAILURE); + } + process_pending_signals (env); + } +} + void target_cpu_copy_regs(CPUArchState *env, struct target_pt_regs *regs) { + int i; + env->pc =3D regs->pc; + env->npc =3D regs->npc; + env->y =3D regs->y; + for(i =3D 0; i < 8; i++) + env->gregs[i] =3D regs->u_regs[i]; + for(i =3D 0; i < 8; i++) + env->regwptr[i] =3D regs->u_regs[i + 8]; } diff --git a/linux-user/sparc64/cpu_loop.c b/linux-user/sparc64/cpu_loop.c index b7700a5561..4fd44e1b1e 100644 --- a/linux-user/sparc64/cpu_loop.c +++ b/linux-user/sparc64/cpu_loop.c @@ -17,10 +17,4 @@ * along with this program; if not, see . */ =20 -#include "qemu/osdep.h" -#include "qemu.h" -#include "cpu_loop-common.h" - -void target_cpu_copy_regs(CPUArchState *env, struct target_pt_regs *regs) -{ -} +#include "../sparc/cpu_loop.c" --=20 2.14.3