Revision d2fbca94 linux-user/main.c

b/linux-user/main.c
816 816

  
817 817
#endif
818 818

  
819
#ifdef TARGET_UNICORE32
820

  
821
void cpu_loop(CPUState *env)
822
{
823
    int trapnr;
824
    unsigned int n, insn;
825
    target_siginfo_t info;
826

  
827
    for (;;) {
828
        cpu_exec_start(env);
829
        trapnr = uc32_cpu_exec(env);
830
        cpu_exec_end(env);
831
        switch (trapnr) {
832
        case UC32_EXCP_PRIV:
833
            {
834
                /* system call */
835
                get_user_u32(insn, env->regs[31] - 4);
836
                n = insn & 0xffffff;
837

  
838
                if (n >= UC32_SYSCALL_BASE) {
839
                    /* linux syscall */
840
                    n -= UC32_SYSCALL_BASE;
841
                    if (n == UC32_SYSCALL_NR_set_tls) {
842
                            cpu_set_tls(env, env->regs[0]);
843
                            env->regs[0] = 0;
844
                    } else {
845
                        env->regs[0] = do_syscall(env,
846
                                                  n,
847
                                                  env->regs[0],
848
                                                  env->regs[1],
849
                                                  env->regs[2],
850
                                                  env->regs[3],
851
                                                  env->regs[4],
852
                                                  env->regs[5]);
853
                    }
854
                } else {
855
                    goto error;
856
                }
857
            }
858
            break;
859
        case UC32_EXCP_TRAP:
860
            info.si_signo = SIGSEGV;
861
            info.si_errno = 0;
862
            /* XXX: check env->error_code */
863
            info.si_code = TARGET_SEGV_MAPERR;
864
            info._sifields._sigfault._addr = env->cp0.c4_faultaddr;
865
            queue_signal(env, info.si_signo, &info);
866
            break;
867
        case EXCP_INTERRUPT:
868
            /* just indicate that signals should be handled asap */
869
            break;
870
        case EXCP_DEBUG:
871
            {
872
                int sig;
873

  
874
                sig = gdb_handlesig(env, TARGET_SIGTRAP);
875
                if (sig) {
876
                    info.si_signo = sig;
877
                    info.si_errno = 0;
878
                    info.si_code = TARGET_TRAP_BRKPT;
879
                    queue_signal(env, info.si_signo, &info);
880
                }
881
            }
882
            break;
883
        default:
884
            goto error;
885
        }
886
        process_pending_signals(env);
887
    }
888

  
889
error:
890
    fprintf(stderr, "qemu: unhandled CPU exception 0x%x - aborting\n", trapnr);
891
    cpu_dump_state(env, stderr, fprintf, 0);
892
    abort();
893
}
894
#endif
895

  
819 896
#ifdef TARGET_SPARC
820 897
#define SPARC64_STACK_BIAS 2047
821 898

  
......
2925 3002
#endif
2926 3003
#elif defined(TARGET_ARM)
2927 3004
        cpu_model = "any";
3005
#elif defined(TARGET_UNICORE32)
3006
        cpu_model = "any";
2928 3007
#elif defined(TARGET_M68K)
2929 3008
        cpu_model = "any";
2930 3009
#elif defined(TARGET_SPARC)
......
3227 3306
            env->regs[i] = regs->uregs[i];
3228 3307
        }
3229 3308
    }
3309
#elif defined(TARGET_UNICORE32)
3310
    {
3311
        int i;
3312
        cpu_asr_write(env, regs->uregs[32], 0xffffffff);
3313
        for (i = 0; i < 32; i++) {
3314
            env->regs[i] = regs->uregs[i];
3315
        }
3316
    }
3230 3317
#elif defined(TARGET_SPARC)
3231 3318
    {
3232 3319
        int i;
......
3367 3454
#error unsupported target CPU
3368 3455
#endif
3369 3456

  
3370
#if defined(TARGET_ARM) || defined(TARGET_M68K)
3457
#if defined(TARGET_ARM) || defined(TARGET_M68K) || defined(TARGET_UNICORE32)
3371 3458
    ts->stack_base = info->start_stack;
3372 3459
    ts->heap_base = info->brk;
3373 3460
    /* This will be filled in on the first SYS_HEAPINFO call.  */

Also available in: Unified diff