[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 33/42] linux-user: move cris cpu loop to cris directo
From: |
Laurent Vivier |
Subject: |
[Qemu-devel] [PULL 33/42] linux-user: move cris cpu loop to cris directory |
Date: |
Mon, 30 Apr 2018 11:10:28 +0200 |
No code change, only move code from main.c to
cris/cpu_loop.c.
Signed-off-by: Laurent Vivier <address@hidden>
Reviewed-by: Richard Henderson <address@hidden>
Reviewed-by: Philippe Mathieu-Daudé <address@hidden>
Message-Id: <address@hidden>
---
linux-user/cris/cpu_loop.c | 89 +++++++++++++++++++++++++++++++++++++++++++++
linux-user/main.c | 90 ----------------------------------------------
2 files changed, 89 insertions(+), 90 deletions(-)
diff --git a/linux-user/cris/cpu_loop.c b/linux-user/cris/cpu_loop.c
index b7700a5561..1c5eca9f83 100644
--- a/linux-user/cris/cpu_loop.c
+++ b/linux-user/cris/cpu_loop.c
@@ -21,6 +21,95 @@
#include "qemu.h"
#include "cpu_loop-common.h"
+void cpu_loop(CPUCRISState *env)
+{
+ CPUState *cs = CPU(cris_env_get_cpu(env));
+ int trapnr, ret;
+ target_siginfo_t info;
+
+ while (1) {
+ cpu_exec_start(cs);
+ trapnr = cpu_exec(cs);
+ cpu_exec_end(cs);
+ process_queued_cpu_work(cs);
+
+ switch (trapnr) {
+ case 0xaa:
+ {
+ info.si_signo = TARGET_SIGSEGV;
+ info.si_errno = 0;
+ /* XXX: check env->error_code */
+ info.si_code = TARGET_SEGV_MAPERR;
+ info._sifields._sigfault._addr = env->pregs[PR_EDA];
+ queue_signal(env, info.si_signo, QEMU_SI_FAULT, &info);
+ }
+ break;
+ case EXCP_INTERRUPT:
+ /* just indicate that signals should be handled asap */
+ break;
+ case EXCP_BREAK:
+ ret = do_syscall(env,
+ env->regs[9],
+ env->regs[10],
+ env->regs[11],
+ env->regs[12],
+ env->regs[13],
+ env->pregs[7],
+ env->pregs[11],
+ 0, 0);
+ if (ret == -TARGET_ERESTARTSYS) {
+ env->pc -= 2;
+ } else if (ret != -TARGET_QEMU_ESIGRETURN) {
+ env->regs[10] = ret;
+ }
+ break;
+ case EXCP_DEBUG:
+ {
+ int sig;
+
+ sig = gdb_handlesig(cs, TARGET_SIGTRAP);
+ if (sig)
+ {
+ info.si_signo = sig;
+ info.si_errno = 0;
+ info.si_code = 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)
{
+ CPUState *cpu = ENV_GET_CPU(env);
+ TaskState *ts = cpu->opaque;
+ struct image_info *info = ts->info;
+
+ env->regs[0] = regs->r0;
+ env->regs[1] = regs->r1;
+ env->regs[2] = regs->r2;
+ env->regs[3] = regs->r3;
+ env->regs[4] = regs->r4;
+ env->regs[5] = regs->r5;
+ env->regs[6] = regs->r6;
+ env->regs[7] = regs->r7;
+ env->regs[8] = regs->r8;
+ env->regs[9] = regs->r9;
+ env->regs[10] = regs->r10;
+ env->regs[11] = regs->r11;
+ env->regs[12] = regs->r12;
+ env->regs[13] = regs->r13;
+ env->regs[14] = info->start_stack;
+ env->regs[15] = regs->acr;
+ env->pc = regs->erp;
}
diff --git a/linux-user/main.c b/linux-user/main.c
index d7fee3e3db..9e01325d6a 100644
--- a/linux-user/main.c
+++ b/linux-user/main.c
@@ -149,76 +149,6 @@ void fork_end(int child)
}
}
-#ifdef TARGET_CRIS
-void cpu_loop(CPUCRISState *env)
-{
- CPUState *cs = CPU(cris_env_get_cpu(env));
- int trapnr, ret;
- target_siginfo_t info;
-
- while (1) {
- cpu_exec_start(cs);
- trapnr = cpu_exec(cs);
- cpu_exec_end(cs);
- process_queued_cpu_work(cs);
-
- switch (trapnr) {
- case 0xaa:
- {
- info.si_signo = TARGET_SIGSEGV;
- info.si_errno = 0;
- /* XXX: check env->error_code */
- info.si_code = TARGET_SEGV_MAPERR;
- info._sifields._sigfault._addr = env->pregs[PR_EDA];
- queue_signal(env, info.si_signo, QEMU_SI_FAULT, &info);
- }
- break;
- case EXCP_INTERRUPT:
- /* just indicate that signals should be handled asap */
- break;
- case EXCP_BREAK:
- ret = do_syscall(env,
- env->regs[9],
- env->regs[10],
- env->regs[11],
- env->regs[12],
- env->regs[13],
- env->pregs[7],
- env->pregs[11],
- 0, 0);
- if (ret == -TARGET_ERESTARTSYS) {
- env->pc -= 2;
- } else if (ret != -TARGET_QEMU_ESIGRETURN) {
- env->regs[10] = ret;
- }
- break;
- case EXCP_DEBUG:
- {
- int sig;
-
- sig = gdb_handlesig(cs, TARGET_SIGTRAP);
- if (sig)
- {
- info.si_signo = sig;
- info.si_errno = 0;
- info.si_code = 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_MICROBLAZE
void cpu_loop(CPUMBState *env)
{
@@ -2290,26 +2220,6 @@ int main(int argc, char **argv, char **envp)
env->ir[IR_SP] = regs->usp;
env->pc = regs->pc;
}
-#elif defined(TARGET_CRIS)
- {
- env->regs[0] = regs->r0;
- env->regs[1] = regs->r1;
- env->regs[2] = regs->r2;
- env->regs[3] = regs->r3;
- env->regs[4] = regs->r4;
- env->regs[5] = regs->r5;
- env->regs[6] = regs->r6;
- env->regs[7] = regs->r7;
- env->regs[8] = regs->r8;
- env->regs[9] = regs->r9;
- env->regs[10] = regs->r10;
- env->regs[11] = regs->r11;
- env->regs[12] = regs->r12;
- env->regs[13] = regs->r13;
- env->regs[14] = info->start_stack;
- env->regs[15] = regs->acr;
- env->pc = regs->erp;
- }
#elif defined(TARGET_S390X)
{
int i;
--
2.14.3
- [Qemu-devel] [PULL 05/42] linux-user: move arm signal.c parts to arm directory, (continued)
- [Qemu-devel] [PULL 05/42] linux-user: move arm signal.c parts to arm directory, Laurent Vivier, 2018/04/30
- [Qemu-devel] [PULL 17/42] linux-user: move xtensa signal.c parts to xtensa directory, Laurent Vivier, 2018/04/30
- [Qemu-devel] [PULL 22/42] linux-user: define TARGET_ARCH_HAS_SETUP_FRAME, Laurent Vivier, 2018/04/30
- [Qemu-devel] [PULL 10/42] linux-user: move openrisc signal.c parts to openrisc directory, Laurent Vivier, 2018/04/30
- [Qemu-devel] [PULL 13/42] linux-user: move alpha signal.c parts to alpha directory, Laurent Vivier, 2018/04/30
- [Qemu-devel] [PULL 11/42] linux-user: move s390x signal.c parts to s390x directory, Laurent Vivier, 2018/04/30
- [Qemu-devel] [PULL 16/42] linux-user: move hppa signal.c parts to hppa directory, Laurent Vivier, 2018/04/30
- [Qemu-devel] [PULL 36/42] linux-user: move alpha cpu loop to alpha directory, Laurent Vivier, 2018/04/30
- [Qemu-devel] [PULL 20/42] linux-user: move mips/mips64 signal.c parts to mips directory, Laurent Vivier, 2018/04/30
- [Qemu-devel] [PULL 42/42] linux-user: Add ARM get_tls syscall support, Laurent Vivier, 2018/04/30
- [Qemu-devel] [PULL 33/42] linux-user: move cris cpu loop to cris directory,
Laurent Vivier <=
- [Qemu-devel] [PULL 30/42] linux-user: move nios2 cpu loop to nios2 directory, Laurent Vivier, 2018/04/30
- [Qemu-devel] [PULL 24/42] linux-user: move i386/x86_64 cpu loop to i386 directory, Laurent Vivier, 2018/04/30
- [Qemu-devel] [PULL 25/42] linux-user: move aarch64 cpu loop to aarch64 directory, Laurent Vivier, 2018/04/30
- [Qemu-devel] [PULL 34/42] linux-user: move microblaze cpu loop to microblaze directory, Laurent Vivier, 2018/04/30
- [Qemu-devel] [PULL 15/42] linux-user: move riscv signal.c parts to riscv directory, Laurent Vivier, 2018/04/30
- [Qemu-devel] [PULL 32/42] linux-user: move sh4 cpu loop to sh4 directory, Laurent Vivier, 2018/04/30
- [Qemu-devel] [PULL 14/42] linux-user: move tilegx signal.c parts to tilegx directory, Laurent Vivier, 2018/04/30
- [Qemu-devel] [PULL 35/42] linux-user: move m68k cpu loop to m68k directory, Laurent Vivier, 2018/04/30
- [Qemu-devel] [PULL 31/42] linux-user: move openrisc cpu loop to openrisc directory, Laurent Vivier, 2018/04/30
- [Qemu-devel] [PULL 27/42] linux-user: move sparc/sparc64 cpu loop to sparc directory, Laurent Vivier, 2018/04/30