void cpu_loop (CPUSPARCState *env)

{

    int trapnr, ret;

    target_siginfo_t info;



    while (1) {

        trapnr = cpu_sparc_exec (env);



        switch (trapnr) {

#ifndef TARGET_SPARC64

        case 0x88:

        case 0x90:

#else

        case 0x110:

        case 0x16d:

#endif

            ret = do_syscall (env, env->gregs[1],

                              env->regwptr[0], env->regwptr[1],

                              env->regwptr[2], env->regwptr[3],

                              env->regwptr[4], env->regwptr[5]);

            if ((unsigned int)ret >= (unsigned int)(-515)) {

#if defined(TARGET_SPARC64) && !defined(TARGET_ABI32)

                env->xcc |= PSR_CARRY;

#else

                env->psr |= PSR_CARRY;

#endif

                ret = -ret;

            } else {

#if defined(TARGET_SPARC64) && !defined(TARGET_ABI32)

                env->xcc &= ~PSR_CARRY;

#else

                env->psr &= ~PSR_CARRY;

#endif

            }

            env->regwptr[0] = ret;

            /* next instruction */

            env->pc = env->npc;

            env->npc = env->npc + 4;

            break;

        case 0x83: /* flush windows */

#ifdef TARGET_ABI32

        case 0x103:

#endif

            flush_windows(env);

            /* next instruction */

            env->pc = env->npc;

            env->npc = 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 = SIGSEGV;

                info.si_errno = 0;

                /* XXX: check env->error_code */

                info.si_code = TARGET_SEGV_MAPERR;

                info._sifields._sigfault._addr = env->mmuregs[4];

                queue_signal(env, info.si_signo, &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 = SIGSEGV;

                info.si_errno = 0;

                /* XXX: check env->error_code */

                info.si_code = TARGET_SEGV_MAPERR;

                if (trapnr == TT_DFAULT)

                    info._sifields._sigfault._addr = env->dmmuregs[4];

                else

                    info._sifields._sigfault._addr = env->tsptr->tpc;

                queue_signal(env, info.si_signo, &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 EXCP_DEBUG:

            {

                int sig;



                sig = gdb_handlesig (env, 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;

        default:

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

            cpu_dump_state(env, stderr, fprintf, 0);

            exit (1);

        }

        process_pending_signals (env);

    }

}

void cpu_loop (CPUSPARCState *env)

{

    int trapnr, ret;

    target_siginfo_t info;



    while (1) {

        trapnr = cpu_sparc_exec (env);



        switch (trapnr) {

#ifndef TARGET_SPARC64

        case 0x88:

        case 0x90:

#else

        case 0x110:

        case 0x16d:

#endif

            ret = do_syscall (env, env->gregs[1],

                              env->regwptr[0], env->regwptr[1],

                              env->regwptr[2], env->regwptr[3],

                              env->regwptr[4], env->regwptr[5]);

            if ((unsigned int)ret >= (unsigned int)(-515)) {

#if defined(TARGET_SPARC64) && !defined(TARGET_ABI32)

                env->xcc |= PSR_CARRY;

#else

                env->psr |= PSR_CARRY;

#endif

                ret = -ret;

            } else {

#if defined(TARGET_SPARC64) && !defined(TARGET_ABI32)

                env->xcc &= ~PSR_CARRY;

#else

                env->psr &= ~PSR_CARRY;

#endif

            }

            env->regwptr[0] = ret;

            

            env->pc = env->npc;

            env->npc = env->npc + 4;

            break;

        case 0x83: 

#ifdef TARGET_ABI32

        case 0x103:

#endif

            flush_windows(env);

            

            env->pc = env->npc;

            env->npc = env->npc + 4;

            break;

#ifndef TARGET_SPARC64

        case TT_WIN_OVF: 

            save_window(env);

            break;

        case TT_WIN_UNF: 

            restore_window(env);

            break;

        case TT_TFAULT:

        case TT_DFAULT:

            {

                info.si_signo = SIGSEGV;

                info.si_errno = 0;

                

                info.si_code = TARGET_SEGV_MAPERR;

                info._sifields._sigfault._addr = env->mmuregs[4];

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

            }

            break;

#else

        case TT_SPILL: 

            save_window(env);

            break;

        case TT_FILL: 

            restore_window(env);

            break;

        case TT_TFAULT:

        case TT_DFAULT:

            {

                info.si_signo = SIGSEGV;

                info.si_errno = 0;

                

                info.si_code = TARGET_SEGV_MAPERR;

                if (trapnr == TT_DFAULT)

                    info._sifields._sigfault._addr = env->dmmuregs[4];

                else

                    info._sifields._sigfault._addr = env->tsptr->tpc;

                queue_signal(env, info.si_signo, &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:

            

            break;

        case EXCP_DEBUG:

            {

                int sig;



                sig = gdb_handlesig (env, 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;

        default:

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

            cpu_dump_state(env, stderr, fprintf, 0);

            exit (1);

        }

        process_pending_signals (env);

    }

}

                    info._sifields._sigfault._addr = env->tsptr->tpc;
void FUNC_0 (CPUSPARCState *VAR_0)

{

    int VAR_1, VAR_2;

    target_siginfo_t info;



    while (1) {

        VAR_1 = cpu_sparc_exec (VAR_0);



        switch (VAR_1) {

#ifndef TARGET_SPARC64

        case 0x88:

        case 0x90:

#else

        case 0x110:

        case 0x16d:

#endif

            VAR_2 = do_syscall (VAR_0, VAR_0->gregs[1],

                              VAR_0->regwptr[0], VAR_0->regwptr[1],

                              VAR_0->regwptr[2], VAR_0->regwptr[3],

                              VAR_0->regwptr[4], VAR_0->regwptr[5]);

            if ((unsigned int)VAR_2 >= (unsigned int)(-515)) {

#if defined(TARGET_SPARC64) && !defined(TARGET_ABI32)

                VAR_0->xcc |= PSR_CARRY;

#else

                VAR_0->psr |= PSR_CARRY;

#endif

                VAR_2 = -VAR_2;

            } else {

#if defined(TARGET_SPARC64) && !defined(TARGET_ABI32)

                VAR_0->xcc &= ~PSR_CARRY;

#else

                VAR_0->psr &= ~PSR_CARRY;

#endif

            }

            VAR_0->regwptr[0] = VAR_2;

            

            VAR_0->pc = VAR_0->npc;

            VAR_0->npc = VAR_0->npc + 4;

            break;

        case 0x83: 

#ifdef TARGET_ABI32

        case 0x103:

#endif

            flush_windows(VAR_0);

            

            VAR_0->pc = VAR_0->npc;

            VAR_0->npc = VAR_0->npc + 4;

            break;

#ifndef TARGET_SPARC64

        case TT_WIN_OVF: 

            save_window(VAR_0);

            break;

        case TT_WIN_UNF: 

            restore_window(VAR_0);

            break;

        case TT_TFAULT:

        case TT_DFAULT:

            {

                info.si_signo = SIGSEGV;

                info.si_errno = 0;

                

                info.si_code = TARGET_SEGV_MAPERR;

                info._sifields._sigfault._addr = VAR_0->mmuregs[4];

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

            }

            break;

#else

        case TT_SPILL: 

            save_window(VAR_0);

            break;

        case TT_FILL: 

            restore_window(VAR_0);

            break;

        case TT_TFAULT:

        case TT_DFAULT:

            {

                info.si_signo = SIGSEGV;

                info.si_errno = 0;

                

                info.si_code = TARGET_SEGV_MAPERR;

                if (VAR_1 == TT_DFAULT)

                    info._sifields._sigfault._addr = VAR_0->dmmuregs[4];

                else

                    info._sifields._sigfault._addr = VAR_0->tsptr->tpc;

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

            }

            break;

#ifndef TARGET_ABI32

        case 0x16e:

            flush_windows(VAR_0);

            sparc64_get_context(VAR_0);

            break;

        case 0x16f:

            flush_windows(VAR_0);

            sparc64_set_context(VAR_0);

            break;

#endif

#endif

        case EXCP_INTERRUPT:

            

            break;

        case EXCP_DEBUG:

            {

                int VAR_3;



                VAR_3 = gdb_handlesig (VAR_0, 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;

        default:

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

            cpu_dump_state(VAR_0, stderr, fprintf, 0);

            exit (1);

        }

        process_pending_signals (VAR_0);

    }

}

void FUNC_0 (CPUSPARCState *VAR_0)
{ int VAR_1, VAR_2; target_siginfo_t info; while (1) { VAR_1 = cpu_sparc_exec (VAR_0); switch (VAR_1) { #ifndef TARGET_SPARC64
case 0x88:
case 0x90:
#else
case 0x110:
case 0x16d:
#endif
VAR_2 = do_syscall (VAR_0, VAR_0->gregs[1],
VAR_0->regwptr[0], VAR_0->regwptr[1],
VAR_0->regwptr[2], VAR_0->regwptr[3],
VAR_0->regwptr[4], VAR_0->regwptr[5]); if ((unsigned int)VAR_2 >= (unsigned int)(-515)) { #if defined(TARGET_SPARC64) && !defined(TARGET_ABI32)
VAR_0->xcc |= PSR_CARRY; #else
VAR_0->psr |= PSR_CARRY; #endif
VAR_2 = -VAR_2; } else { #if defined(TARGET_SPARC64) && !defined(TARGET_ABI32)
VAR_0->xcc &= ~PSR_CARRY; #else
VAR_0->psr &= ~PSR_CARRY; #endif
} VAR_0->regwptr[0] = VAR_2; VAR_0->pc = VAR_0->npc; VAR_0->npc = VAR_0->npc + 4; break; case 0x83:
#ifdef TARGET_ABI32
case 0x103:
#endif
flush_windows(VAR_0); VAR_0->pc = VAR_0->npc; VAR_0->npc = VAR_0->npc + 4; break; #ifndef TARGET_SPARC64
case TT_WIN_OVF:
save_window(VAR_0); break; case TT_WIN_UNF:
restore_window(VAR_0); break; case TT_TFAULT:
case TT_DFAULT:
{ info.si_signo = SIGSEGV; info.si_errno = 0; info.si_code = TARGET_SEGV_MAPERR; info._sifields._sigfault._addr = VAR_0->mmuregs[4]; queue_signal(VAR_0, info.si_signo, &info); } break; #else
case TT_SPILL:
save_window(VAR_0); break; case TT_FILL:
restore_window(VAR_0); break; case TT_TFAULT:
case TT_DFAULT:
{ info.si_signo = SIGSEGV; info.si_errno = 0; info.si_code = TARGET_SEGV_MAPERR; if (VAR_1 == TT_DFAULT)
info._sifields._sigfault._addr = VAR_0->dmmuregs[4]; else
info._sifields._sigfault._addr = VAR_0->tsptr->tpc; queue_signal(VAR_0, info.si_signo, &info); } break; #ifndef TARGET_ABI32
case 0x16e:
flush_windows(VAR_0); sparc64_get_context(VAR_0); break; case 0x16f:
flush_windows(VAR_0); sparc64_set_context(VAR_0); break; #endif
#endif
case EXCP_INTERRUPT:
break; case EXCP_DEBUG:
{ int VAR_3; VAR_3 = gdb_handlesig (VAR_0, 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; default:
printf ("Unhandled trap: 0x%x\n", VAR_1); cpu_dump_state(VAR_0, stderr, fprintf, 0); exit (1); } process_pending_signals (VAR_0); } }