long do_sigreturn(CPUMBState *env)

{

    struct target_signal_frame *frame;

    abi_ulong frame_addr;

    target_sigset_t target_set;

    sigset_t set;

    int i;



    frame_addr = env->regs[R_SP];

    trace_user_do_sigreturn(env, frame_addr);

    /* Make sure the guest isn't playing games.  */

    if (!lock_user_struct(VERIFY_WRITE, frame, frame_addr, 1))

        goto badframe;



    /* Restore blocked signals */

    __get_user(target_set.sig[0], &frame->uc.tuc_mcontext.oldmask);

    for(i = 1; i < TARGET_NSIG_WORDS; i++) {

        __get_user(target_set.sig[i], &frame->extramask[i - 1]);

    }

    target_to_host_sigset_internal(&set, &target_set);

    do_sigprocmask(SIG_SETMASK, &set, NULL);



    restore_sigcontext(&frame->uc.tuc_mcontext, env);

    /* We got here through a sigreturn syscall, our path back is via an

       rtb insn so setup r14 for that.  */

    env->regs[14] = env->sregs[SR_PC];



    unlock_user_struct(frame, frame_addr, 0);

    return env->regs[10];

badframe:

    force_sig(TARGET_SIGSEGV);

}

long do_sigreturn(CPUMBState *env)

{

    struct target_signal_frame *frame;

    abi_ulong frame_addr;

    target_sigset_t target_set;

    sigset_t set;

    int i;



    frame_addr = env->regs[R_SP];

    trace_user_do_sigreturn(env, frame_addr);

    

    if (!lock_user_struct(VERIFY_WRITE, frame, frame_addr, 1))

        goto badframe;



    

    __get_user(target_set.sig[0], &frame->uc.tuc_mcontext.oldmask);

    for(i = 1; i < TARGET_NSIG_WORDS; i++) {

        __get_user(target_set.sig[i], &frame->extramask[i - 1]);

    }

    target_to_host_sigset_internal(&set, &target_set);

    do_sigprocmask(SIG_SETMASK, &set, NULL);



    restore_sigcontext(&frame->uc.tuc_mcontext, env);

    



    env->regs[14] = env->sregs[SR_PC];



    unlock_user_struct(frame, frame_addr, 0);

    return env->regs[10];

badframe:

    force_sig(TARGET_SIGSEGV);

}

    return env->regs[10];
long FUNC_0(CPUMBState *VAR_0)

{

    struct target_signal_frame *VAR_1;

    abi_ulong frame_addr;

    target_sigset_t target_set;

    sigset_t set;

    int VAR_2;



    frame_addr = VAR_0->regs[R_SP];

    trace_user_do_sigreturn(VAR_0, frame_addr);

    

    if (!lock_user_struct(VERIFY_WRITE, VAR_1, frame_addr, 1))

        goto badframe;



    

    __get_user(target_set.sig[0], &VAR_1->uc.tuc_mcontext.oldmask);

    for(VAR_2 = 1; VAR_2 < TARGET_NSIG_WORDS; VAR_2++) {

        __get_user(target_set.sig[VAR_2], &VAR_1->extramask[VAR_2 - 1]);

    }

    target_to_host_sigset_internal(&set, &target_set);

    do_sigprocmask(SIG_SETMASK, &set, NULL);



    restore_sigcontext(&VAR_1->uc.tuc_mcontext, VAR_0);

    



    VAR_0->regs[14] = VAR_0->sregs[SR_PC];



    unlock_user_struct(VAR_1, frame_addr, 0);

    return VAR_0->regs[10];

badframe:

    force_sig(TARGET_SIGSEGV);

}

long FUNC_0(CPUMBState *VAR_0)
{ struct target_signal_frame *VAR_1; abi_ulong frame_addr; target_sigset_t target_set; sigset_t set; int VAR_2; frame_addr = VAR_0->regs[R_SP]; trace_user_do_sigreturn(VAR_0, frame_addr); if (!lock_user_struct(VERIFY_WRITE, VAR_1, frame_addr, 1))
goto badframe; __get_user(target_set.sig[0], &VAR_1->uc.tuc_mcontext.oldmask); for(VAR_2 = 1; VAR_2 < TARGET_NSIG_WORDS; VAR_2++) { __get_user(target_set.sig[VAR_2], &VAR_1->extramask[VAR_2 - 1]); } target_to_host_sigset_internal(&set, &target_set); do_sigprocmask(SIG_SETMASK, &set, NULL); restore_sigcontext(&VAR_1->uc.tuc_mcontext, VAR_0); VAR_0->regs[14] = VAR_0->sregs[SR_PC]; unlock_user_struct(VAR_1, frame_addr, 0); return VAR_0->regs[10]; badframe:
force_sig(TARGET_SIGSEGV); }