Revision a4c075f1 linux-user/main.c

b/linux-user/main.c
2701 2701
}
2702 2702
#endif /* TARGET_ALPHA */
2703 2703

  
2704
#ifdef TARGET_S390X
2705
void cpu_loop(CPUS390XState *env)
2706
{
2707
    int trapnr;
2708
    target_siginfo_t info;
2709

  
2710
    while (1) {
2711
        trapnr = cpu_s390x_exec (env);
2712

  
2713
        switch (trapnr) {
2714
        case EXCP_INTERRUPT:
2715
            /* just indicate that signals should be handled asap */
2716
            break;
2717
        case EXCP_DEBUG:
2718
            {
2719
                int sig;
2720

  
2721
                sig = gdb_handlesig (env, TARGET_SIGTRAP);
2722
                if (sig) {
2723
                    info.si_signo = sig;
2724
                    info.si_errno = 0;
2725
                    info.si_code = TARGET_TRAP_BRKPT;
2726
                    queue_signal(env, info.si_signo, &info);
2727
                }
2728
            }
2729
            break;
2730
        case EXCP_SVC:
2731
            {
2732
                int n = env->int_svc_code;
2733
                if (!n) {
2734
                    /* syscalls > 255 */
2735
                    n = env->regs[1];
2736
                }
2737
                env->psw.addr += env->int_svc_ilc;
2738
                env->regs[2] = do_syscall(env, n,
2739
                           env->regs[2],
2740
                           env->regs[3],
2741
                           env->regs[4],
2742
                           env->regs[5],
2743
                           env->regs[6],
2744
                           env->regs[7]);
2745
            }
2746
            break;
2747
        case EXCP_ADDR:
2748
            {
2749
                info.si_signo = SIGSEGV;
2750
                info.si_errno = 0;
2751
                /* XXX: check env->error_code */
2752
                info.si_code = TARGET_SEGV_MAPERR;
2753
                info._sifields._sigfault._addr = env->__excp_addr;
2754
                queue_signal(env, info.si_signo, &info);
2755
            }
2756
            break;
2757
        case EXCP_SPEC:
2758
            {
2759
                fprintf(stderr,"specification exception insn 0x%08x%04x\n", ldl(env->psw.addr), lduw(env->psw.addr + 4));
2760
                info.si_signo = SIGILL;
2761
                info.si_errno = 0;
2762
                info.si_code = TARGET_ILL_ILLOPC;
2763
                info._sifields._sigfault._addr = env->__excp_addr;
2764
                queue_signal(env, info.si_signo, &info);
2765
            }
2766
            break;
2767
        default:
2768
            printf ("Unhandled trap: 0x%x\n", trapnr);
2769
            cpu_dump_state(env, stderr, fprintf, 0);
2770
            exit (1);
2771
        }
2772
        process_pending_signals (env);
2773
    }
2774
}
2775

  
2776
#endif /* TARGET_S390X */
2777

  
2704 2778
static void version(void)
2705 2779
{
2706 2780
    printf("qemu-" TARGET_ARCH " version " QEMU_VERSION QEMU_PKGVERSION
......
3450 3524
	    env->regs[15] = regs->acr;	    
3451 3525
	    env->pc = regs->erp;
3452 3526
    }
3527
#elif defined(TARGET_S390X)
3528
    {
3529
            int i;
3530
            for (i = 0; i < 16; i++) {
3531
                env->regs[i] = regs->gprs[i];
3532
            }
3533
            env->psw.mask = regs->psw.mask;
3534
            env->psw.addr = regs->psw.addr;
3535
    }
3453 3536
#else
3454 3537
#error unsupported target CPU
3455 3538
#endif

Also available in: Unified diff