long do_sigreturn(CPUMIPSState *regs)

{

    struct sigframe *frame;

    abi_ulong frame_addr;

    sigset_t blocked;

    target_sigset_t target_set;

    int i;



#if defined(DEBUG_SIGNAL)

    fprintf(stderr, "do_sigreturn\n");

#endif

    frame_addr = regs->active_tc.gpr[29];

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

   	goto badframe;



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

   	if(__get_user(target_set.sig[i], &frame->sf_mask.sig[i]))

	    goto badframe;

    }



    target_to_host_sigset_internal(&blocked, &target_set);

    sigprocmask(SIG_SETMASK, &blocked, NULL);



    if (restore_sigcontext(regs, &frame->sf_sc))

   	goto badframe;



#if 0

    /*

     * Don't let your children do this ...

     */

    __asm__ __volatile__(

   	"move\t$29, %0\n\t"

   	"j\tsyscall_exit"

   	:/* no outputs */

   	:"r" (&regs));

    /* Unreached */

#endif



    regs->active_tc.PC = regs->CP0_EPC;

    mips_set_hflags_isa_mode_from_pc(regs);

    /* I am not sure this is right, but it seems to work

    * maybe a problem with nested signals ? */

    regs->CP0_EPC = 0;

    return -TARGET_QEMU_ESIGRETURN;



badframe:

    force_sig(TARGET_SIGSEGV/*, current*/);

    return 0;

}

long do_sigreturn(CPUMIPSState *regs)

{

    struct sigframe *frame;

    abi_ulong frame_addr;

    sigset_t blocked;

    target_sigset_t target_set;

    int i;



#if defined(DEBUG_SIGNAL)

    fprintf(stderr, "do_sigreturn\n");

#endif

    frame_addr = regs->active_tc.gpr[29];

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

   	goto badframe;



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

   	if(__get_user(target_set.sig[i], &frame->sf_mask.sig[i]))

	    goto badframe;

    }



    target_to_host_sigset_internal(&blocked, &target_set);

    sigprocmask(SIG_SETMASK, &blocked, NULL);



    if (restore_sigcontext(regs, &frame->sf_sc))

   	goto badframe;



#if 0

    





    __asm__ __volatile__(

   	"move\t$29, %0\n\t"

   	"j\tsyscall_exit"

   	:

   	:"r" (&regs));

    

#endif



    regs->active_tc.PC = regs->CP0_EPC;

    mips_set_hflags_isa_mode_from_pc(regs);

    



    regs->CP0_EPC = 0;

    return -TARGET_QEMU_ESIGRETURN;



badframe:

    force_sig(TARGET_SIGSEGV);

    return 0;

}

long FUNC_0(CPUMIPSState *VAR_0)

{

    struct sigframe *VAR_1;

    abi_ulong frame_addr;

    sigset_t blocked;

    target_sigset_t target_set;

    int VAR_2;



#if defined(DEBUG_SIGNAL)

    fprintf(stderr, "FUNC_0\n");

#endif

    frame_addr = VAR_0->active_tc.gpr[29];

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

   	goto badframe;



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

   	if(__get_user(target_set.sig[VAR_2], &VAR_1->sf_mask.sig[VAR_2]))

	    goto badframe;

    }



    target_to_host_sigset_internal(&blocked, &target_set);

    sigprocmask(SIG_SETMASK, &blocked, NULL);



    if (restore_sigcontext(VAR_0, &VAR_1->sf_sc))

   	goto badframe;



#if 0

    





    __asm__ __volatile__(

   	"move\t$29, %0\n\t"

   	"j\tsyscall_exit"

   	:

   	:"r" (&VAR_0));

    

#endif



    VAR_0->active_tc.PC = VAR_0->CP0_EPC;

    mips_set_hflags_isa_mode_from_pc(VAR_0);

    



    VAR_0->CP0_EPC = 0;

    return -TARGET_QEMU_ESIGRETURN;



badframe:

    force_sig(TARGET_SIGSEGV);

    return 0;

}

long FUNC_0(CPUMIPSState *VAR_0)
{ struct sigframe *VAR_1; abi_ulong frame_addr; sigset_t blocked; target_sigset_t target_set; int VAR_2; #if defined(DEBUG_SIGNAL)
fprintf(stderr, "FUNC_0\n"); #endif
frame_addr = VAR_0->active_tc.gpr[29]; if (!lock_user_struct(VERIFY_READ, VAR_1, frame_addr, 1))
goto badframe; for(VAR_2 = 0; VAR_2 < TARGET_NSIG_WORDS; VAR_2++) { if(__get_user(target_set.sig[VAR_2], &VAR_1->sf_mask.sig[VAR_2]))
goto badframe; } target_to_host_sigset_internal(&blocked, &target_set); sigprocmask(SIG_SETMASK, &blocked, NULL); if (restore_sigcontext(VAR_0, &VAR_1->sf_sc))
goto badframe; #if 0
__asm__ __volatile__(
"move\t$29, %0\n\t"
"j\tsyscall_exit"
:
:"r" (&VAR_0)); #endif
VAR_0->active_tc.PC = VAR_0->CP0_EPC; mips_set_hflags_isa_mode_from_pc(VAR_0); VAR_0->CP0_EPC = 0; return -TARGET_QEMU_ESIGRETURN; badframe:
force_sig(TARGET_SIGSEGV); return 0; }