void cpu_loop(CPUSH4State *env)

{

    CPUState *cs = CPU(sh_env_get_cpu(env));

    int trapnr, ret;

    target_siginfo_t info;



    while (1) {

        cpu_exec_start(cs);

        trapnr = cpu_sh4_exec(cs);

        cpu_exec_end(cs);



        switch (trapnr) {

        case 0x160:

            env->pc += 2;

            ret = do_syscall(env,

                             env->gregs[3],

                             env->gregs[4],

                             env->gregs[5],

                             env->gregs[6],

                             env->gregs[7],

                             env->gregs[0],

                             env->gregs[1],

                             0, 0);

            env->gregs[0] = ret;

            break;

        case EXCP_INTERRUPT:

            /* just indicate that signals should be handled asap */

            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, &info);

                  }

            }

            break;

	case 0xa0:

	case 0xc0:

            info.si_signo = TARGET_SIGSEGV;

            info.si_errno = 0;

            info.si_code = TARGET_SEGV_MAPERR;

            info._sifields._sigfault._addr = env->tea;

            queue_signal(env, info.si_signo, &info);

	    break;



        default:

            printf ("Unhandled trap: 0x%x\n", trapnr);

            cpu_dump_state(cs, stderr, fprintf, 0);

            exit(EXIT_FAILURE);

        }

        process_pending_signals (env);

    }

}

void cpu_loop(CPUSH4State *env)

{

    CPUState *cs = CPU(sh_env_get_cpu(env));

    int trapnr, ret;

    target_siginfo_t info;



    while (1) {

        cpu_exec_start(cs);

        trapnr = cpu_sh4_exec(cs);

        cpu_exec_end(cs);



        switch (trapnr) {

        case 0x160:

            env->pc += 2;

            ret = do_syscall(env,

                             env->gregs[3],

                             env->gregs[4],

                             env->gregs[5],

                             env->gregs[6],

                             env->gregs[7],

                             env->gregs[0],

                             env->gregs[1],

                             0, 0);

            env->gregs[0] = ret;

            break;

        case EXCP_INTERRUPT:

            

            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, &info);

                  }

            }

            break;

	case 0xa0:

	case 0xc0:

            info.si_signo = TARGET_SIGSEGV;

            info.si_errno = 0;

            info.si_code = TARGET_SEGV_MAPERR;

            info._sifields._sigfault._addr = env->tea;

            queue_signal(env, info.si_signo, &info);

	    break;



        default:

            printf ("Unhandled trap: 0x%x\n", trapnr);

            cpu_dump_state(cs, stderr, fprintf, 0);

            exit(EXIT_FAILURE);

        }

        process_pending_signals (env);

    }

}

void FUNC_0(CPUSH4State *VAR_0)

{

    CPUState *cs = CPU(sh_env_get_cpu(VAR_0));

    int VAR_1, VAR_2;

    target_siginfo_t info;



    while (1) {

        cpu_exec_start(cs);

        VAR_1 = cpu_sh4_exec(cs);

        cpu_exec_end(cs);



        switch (VAR_1) {

        case 0x160:

            VAR_0->pc += 2;

            VAR_2 = do_syscall(VAR_0,

                             VAR_0->gregs[3],

                             VAR_0->gregs[4],

                             VAR_0->gregs[5],

                             VAR_0->gregs[6],

                             VAR_0->gregs[7],

                             VAR_0->gregs[0],

                             VAR_0->gregs[1],

                             0, 0);

            VAR_0->gregs[0] = VAR_2;

            break;

        case EXCP_INTERRUPT:

            

            break;

        case EXCP_DEBUG:

            {

                int VAR_3;



                VAR_3 = gdb_handlesig(cs, TARGET_SIGTRAP);

                if (VAR_3)

                  {

                    info.si_signo = VAR_3;

                    info.si_errno = 0;

                    info.si_code = TARGET_TRAP_BRKPT;

                    queue_signal(VAR_0, info.si_signo, &info);

                  }

            }

            break;

	case 0xa0:

	case 0xc0:

            info.si_signo = TARGET_SIGSEGV;

            info.si_errno = 0;

            info.si_code = TARGET_SEGV_MAPERR;

            info._sifields._sigfault._addr = VAR_0->tea;

            queue_signal(VAR_0, info.si_signo, &info);

	    break;



        default:

            printf ("Unhandled trap: 0x%x\n", VAR_1);

            cpu_dump_state(cs, stderr, fprintf, 0);

            exit(EXIT_FAILURE);

        }

        process_pending_signals (VAR_0);

    }

}

void FUNC_0(CPUSH4State *VAR_0)
{ CPUState *cs = CPU(sh_env_get_cpu(VAR_0)); int VAR_1, VAR_2; target_siginfo_t info; while (1) { cpu_exec_start(cs); VAR_1 = cpu_sh4_exec(cs); cpu_exec_end(cs); switch (VAR_1) { case 0x160:
VAR_0->pc += 2; VAR_2 = do_syscall(VAR_0,
VAR_0->gregs[3],
VAR_0->gregs[4],
VAR_0->gregs[5],
VAR_0->gregs[6],
VAR_0->gregs[7],
VAR_0->gregs[0],
VAR_0->gregs[1],
0, 0); VAR_0->gregs[0] = VAR_2; break; case EXCP_INTERRUPT:
break; case EXCP_DEBUG:
{ int VAR_3; VAR_3 = gdb_handlesig(cs, TARGET_SIGTRAP); if (VAR_3)
{ info.si_signo = VAR_3; info.si_errno = 0; info.si_code = TARGET_TRAP_BRKPT; queue_signal(VAR_0, info.si_signo, &info); } } break; case 0xa0:
case 0xc0:
info.si_signo = TARGET_SIGSEGV; info.si_errno = 0; info.si_code = TARGET_SEGV_MAPERR; info._sifields._sigfault._addr = VAR_0->tea; queue_signal(VAR_0, info.si_signo, &info); break; default:
printf ("Unhandled trap: 0x%x\n", VAR_1); cpu_dump_state(cs, stderr, fprintf, 0); exit(EXIT_FAILURE); } process_pending_signals (VAR_0); } }