static void setup_rt_frame(int usig, struct emulated_sigaction *ka,

                           target_siginfo_t *info,

			   target_sigset_t *set, CPUState *env)

{

	struct rt_sigframe *frame;

	abi_ulong frame_addr = get_sigframe(ka, env, sizeof(*frame));

	struct target_sigaltstack stack;

	int i, err = 0;



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

            return /* 1 */;



	__put_user_error(&frame->info, (abi_ulong *)&frame->pinfo, err);

	__put_user_error(&frame->uc, (abi_ulong *)&frame->puc, err);

	err |= copy_siginfo_to_user(&frame->info, info);



	/* Clear all the bits of the ucontext we don't use.  */

	memset(&frame->uc, 0, offsetof(struct target_ucontext, tuc_mcontext));



        memset(&stack, 0, sizeof(stack));

        __put_user(target_sigaltstack_used.ss_sp, &stack.ss_sp);

        __put_user(target_sigaltstack_used.ss_size, &stack.ss_size);

        __put_user(sas_ss_flags(get_sp_from_cpustate(env)), &stack.ss_flags);

        memcpy(&frame->uc.tuc_stack, &stack, sizeof(stack));



	err |= setup_sigcontext(&frame->uc.tuc_mcontext, /*&frame->fpstate,*/

				env, set->sig[0]);

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

            if (__put_user(set->sig[i], &frame->uc.tuc_sigmask.sig[i]))

                goto end;

        }



	if (err == 0)

		err = setup_return(env, ka, &frame->retcode, frame, usig);



	if (err == 0) {

		/*

		 * For realtime signals we must also set the second and third

		 * arguments for the signal handler.

		 *   -- Peter Maydell <pmaydell@chiark.greenend.org.uk> 2000-12-06

		 */

            env->regs[1] = (abi_ulong)frame->pinfo;

            env->regs[2] = (abi_ulong)frame->puc;

	}



end:

	unlock_user_struct(frame, frame_addr, 1);



        //	return err;

}

static void setup_rt_frame(int usig, struct emulated_sigaction *ka,

                           target_siginfo_t *info,

			   target_sigset_t *set, CPUState *env)

{

	struct rt_sigframe *frame;

	abi_ulong frame_addr = get_sigframe(ka, env, sizeof(*frame));

	struct target_sigaltstack stack;

	int i, err = 0;



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

            return ;



	__put_user_error(&frame->info, (abi_ulong *)&frame->pinfo, err);

	__put_user_error(&frame->uc, (abi_ulong *)&frame->puc, err);

	err |= copy_siginfo_to_user(&frame->info, info);



	

	memset(&frame->uc, 0, offsetof(struct target_ucontext, tuc_mcontext));



        memset(&stack, 0, sizeof(stack));

        __put_user(target_sigaltstack_used.ss_sp, &stack.ss_sp);

        __put_user(target_sigaltstack_used.ss_size, &stack.ss_size);

        __put_user(sas_ss_flags(get_sp_from_cpustate(env)), &stack.ss_flags);

        memcpy(&frame->uc.tuc_stack, &stack, sizeof(stack));



	err |= setup_sigcontext(&frame->uc.tuc_mcontext, 

				env, set->sig[0]);

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

            if (__put_user(set->sig[i], &frame->uc.tuc_sigmask.sig[i]))

                goto end;

        }



	if (err == 0)

		err = setup_return(env, ka, &frame->retcode, frame, usig);



	if (err == 0) {

		









            env->regs[1] = (abi_ulong)frame->pinfo;

            env->regs[2] = (abi_ulong)frame->puc;

	}



end:

	unlock_user_struct(frame, frame_addr, 1);



        

}

static void FUNC_0(int VAR_0, struct emulated_sigaction *VAR_1,

                           target_siginfo_t *VAR_2,

			   target_sigset_t *VAR_3, CPUState *VAR_4)

{

	struct rt_sigframe *VAR_5;

	abi_ulong frame_addr = get_sigframe(VAR_1, VAR_4, sizeof(*VAR_5));

	struct target_sigaltstack VAR_6;

	int VAR_7, VAR_8 = 0;



	if (!lock_user_struct(VERIFY_WRITE, VAR_5, frame_addr, 0))

            return ;



	__put_user_error(&VAR_5->VAR_2, (abi_ulong *)&VAR_5->pinfo, VAR_8);

	__put_user_error(&VAR_5->uc, (abi_ulong *)&VAR_5->puc, VAR_8);

	VAR_8 |= copy_siginfo_to_user(&VAR_5->VAR_2, VAR_2);



	

	memset(&VAR_5->uc, 0, offsetof(struct target_ucontext, tuc_mcontext));



        memset(&VAR_6, 0, sizeof(VAR_6));

        __put_user(target_sigaltstack_used.ss_sp, &VAR_6.ss_sp);

        __put_user(target_sigaltstack_used.ss_size, &VAR_6.ss_size);

        __put_user(sas_ss_flags(get_sp_from_cpustate(VAR_4)), &VAR_6.ss_flags);

        memcpy(&VAR_5->uc.tuc_stack, &VAR_6, sizeof(VAR_6));



	VAR_8 |= setup_sigcontext(&VAR_5->uc.tuc_mcontext, 

				VAR_4, VAR_3->sig[0]);

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

            if (__put_user(VAR_3->sig[VAR_7], &VAR_5->uc.tuc_sigmask.sig[VAR_7]))

                goto end;

        }



	if (VAR_8 == 0)

		VAR_8 = setup_return(VAR_4, VAR_1, &VAR_5->retcode, VAR_5, VAR_0);



	if (VAR_8 == 0) {

		









            VAR_4->regs[1] = (abi_ulong)VAR_5->pinfo;

            VAR_4->regs[2] = (abi_ulong)VAR_5->puc;

	}



end:

	unlock_user_struct(VAR_5, frame_addr, 1);



        

}

static void FUNC_0(int VAR_0, struct emulated_sigaction *VAR_1,
target_siginfo_t *VAR_2,
target_sigset_t *VAR_3, CPUState *VAR_4)
{ struct rt_sigframe *VAR_5; abi_ulong frame_addr = get_sigframe(VAR_1, VAR_4, sizeof(*VAR_5)); struct target_sigaltstack VAR_6; int VAR_7, VAR_8 = 0; if (!lock_user_struct(VERIFY_WRITE, VAR_5, frame_addr, 0))
return ; __put_user_error(&VAR_5->VAR_2, (abi_ulong *)&VAR_5->pinfo, VAR_8); __put_user_error(&VAR_5->uc, (abi_ulong *)&VAR_5->puc, VAR_8); VAR_8 |= copy_siginfo_to_user(&VAR_5->VAR_2, VAR_2); memset(&VAR_5->uc, 0, offsetof(struct target_ucontext, tuc_mcontext)); memset(&VAR_6, 0, sizeof(VAR_6)); __put_user(target_sigaltstack_used.ss_sp, &VAR_6.ss_sp); __put_user(target_sigaltstack_used.ss_size, &VAR_6.ss_size); __put_user(sas_ss_flags(get_sp_from_cpustate(VAR_4)), &VAR_6.ss_flags); memcpy(&VAR_5->uc.tuc_stack, &VAR_6, sizeof(VAR_6)); VAR_8 |= setup_sigcontext(&VAR_5->uc.tuc_mcontext,
VAR_4, VAR_3->sig[0]); for(VAR_7 = 0; VAR_7 < TARGET_NSIG_WORDS; VAR_7++) { if (__put_user(VAR_3->sig[VAR_7], &VAR_5->uc.tuc_sigmask.sig[VAR_7]))
goto end; } if (VAR_8 == 0)
VAR_8 = setup_return(VAR_4, VAR_1, &VAR_5->retcode, VAR_5, VAR_0); if (VAR_8 == 0) { VAR_4->regs[1] = (abi_ulong)VAR_5->pinfo; VAR_4->regs[2] = (abi_ulong)VAR_5->puc; } end:
unlock_user_struct(VAR_5, frame_addr, 1); }