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

                           target_siginfo_t *info,

			   target_sigset_t *set, CPUX86State *env)

{

	struct rt_sigframe *frame;

	int err = 0;



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



#if 0

	if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame)))

		goto give_sigsegv;

#endif



	err |= __put_user((/*current->exec_domain

		    	   && current->exec_domain->signal_invmap

		    	   && sig < 32

		    	   ? current->exec_domain->signal_invmap[sig]

			   : */sig),

			  &frame->sig);

	err |= __put_user((target_ulong)&frame->info, &frame->pinfo);

	err |= __put_user((target_ulong)&frame->uc, &frame->puc);

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

	if (err)

		goto give_sigsegv;



	/* Create the ucontext.  */

	err |= __put_user(0, &frame->uc.uc_flags);

	err |= __put_user(0, &frame->uc.uc_link);

	err |= __put_user(/*current->sas_ss_sp*/ 0, &frame->uc.uc_stack.ss_sp);

	err |= __put_user(/* sas_ss_flags(regs->esp) */ 0,

			  &frame->uc.uc_stack.ss_flags);

	err |= __put_user(/* current->sas_ss_size */ 0, &frame->uc.uc_stack.ss_size);

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

			        env, set->sig[0]);

	err |= __copy_to_user(&frame->uc.uc_sigmask, set, sizeof(*set));

	if (err)

		goto give_sigsegv;



	/* Set up to return from userspace.  If provided, use a stub

	   already in userspace.  */

	if (ka->sa.sa_flags & TARGET_SA_RESTORER) {

		err |= __put_user(ka->sa.sa_restorer, &frame->pretcode);

	} else {

		err |= __put_user(frame->retcode, &frame->pretcode);

		/* This is movl $,%eax ; int $0x80 */

		err |= __put_user(0xb8, (char *)(frame->retcode+0));

		err |= __put_user(TARGET_NR_rt_sigreturn, (int *)(frame->retcode+1));

		err |= __put_user(0x80cd, (short *)(frame->retcode+5));

	}



	if (err)

		goto give_sigsegv;



	/* Set up registers for signal handler */

	env->regs[R_ESP] = (unsigned long) frame;

	env->eip = (unsigned long) ka->sa._sa_handler;



        cpu_x86_load_seg(env, R_DS, __USER_DS);

        cpu_x86_load_seg(env, R_ES, __USER_DS);

        cpu_x86_load_seg(env, R_SS, __USER_DS);

        cpu_x86_load_seg(env, R_CS, __USER_CS);

	env->eflags &= ~TF_MASK;



	return;



give_sigsegv:

	if (sig == TARGET_SIGSEGV)

		ka->sa._sa_handler = TARGET_SIG_DFL;

	force_sig(TARGET_SIGSEGV /* , current */);

}

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

                           target_siginfo_t *info,

			   target_sigset_t *set, CPUX86State *env)

{

	struct rt_sigframe *frame;

	int err = 0;



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



#if 0

	if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame)))

		goto give_sigsegv;

#endif



	err |= __put_user((







sig),

			  &frame->sig);

	err |= __put_user((target_ulong)&frame->info, &frame->pinfo);

	err |= __put_user((target_ulong)&frame->uc, &frame->puc);

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

	if (err)

		goto give_sigsegv;



	

	err |= __put_user(0, &frame->uc.uc_flags);

	err |= __put_user(0, &frame->uc.uc_link);

	err |= __put_user( 0, &frame->uc.uc_stack.ss_sp);

	err |= __put_user( 0,

			  &frame->uc.uc_stack.ss_flags);

	err |= __put_user( 0, &frame->uc.uc_stack.ss_size);

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

			        env, set->sig[0]);

	err |= __copy_to_user(&frame->uc.uc_sigmask, set, sizeof(*set));

	if (err)

		goto give_sigsegv;



	



	if (ka->sa.sa_flags & TARGET_SA_RESTORER) {

		err |= __put_user(ka->sa.sa_restorer, &frame->pretcode);

	} else {

		err |= __put_user(frame->retcode, &frame->pretcode);

		

		err |= __put_user(0xb8, (char *)(frame->retcode+0));

		err |= __put_user(TARGET_NR_rt_sigreturn, (int *)(frame->retcode+1));

		err |= __put_user(0x80cd, (short *)(frame->retcode+5));

	}



	if (err)

		goto give_sigsegv;



	

	env->regs[R_ESP] = (unsigned long) frame;

	env->eip = (unsigned long) ka->sa._sa_handler;



        cpu_x86_load_seg(env, R_DS, __USER_DS);

        cpu_x86_load_seg(env, R_ES, __USER_DS);

        cpu_x86_load_seg(env, R_SS, __USER_DS);

        cpu_x86_load_seg(env, R_CS, __USER_CS);

	env->eflags &= ~TF_MASK;



	return;



give_sigsegv:

	if (sig == TARGET_SIGSEGV)

		ka->sa._sa_handler = TARGET_SIG_DFL;

	force_sig(TARGET_SIGSEGV );

}

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

                           target_siginfo_t *VAR_2,

			   target_sigset_t *VAR_3, CPUX86State *VAR_4)

{

	struct rt_sigframe *VAR_5;

	int VAR_6 = 0;



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



#if 0

	if (!access_ok(VERIFY_WRITE, VAR_5, sizeof(*VAR_5)))

		goto give_sigsegv;

#endif



	VAR_6 |= __put_user((







VAR_0),

			  &VAR_5->VAR_0);

	VAR_6 |= __put_user((target_ulong)&VAR_5->VAR_2, &VAR_5->pinfo);

	VAR_6 |= __put_user((target_ulong)&VAR_5->uc, &VAR_5->puc);

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

	if (VAR_6)

		goto give_sigsegv;



	

	VAR_6 |= __put_user(0, &VAR_5->uc.uc_flags);

	VAR_6 |= __put_user(0, &VAR_5->uc.uc_link);

	VAR_6 |= __put_user( 0, &VAR_5->uc.uc_stack.ss_sp);

	VAR_6 |= __put_user( 0,

			  &VAR_5->uc.uc_stack.ss_flags);

	VAR_6 |= __put_user( 0, &VAR_5->uc.uc_stack.ss_size);

	VAR_6 |= setup_sigcontext(&VAR_5->uc.uc_mcontext, &VAR_5->fpstate,

			        VAR_4, VAR_3->VAR_0[0]);

	VAR_6 |= __copy_to_user(&VAR_5->uc.uc_sigmask, VAR_3, sizeof(*VAR_3));

	if (VAR_6)

		goto give_sigsegv;



	



	if (VAR_1->sa.sa_flags & TARGET_SA_RESTORER) {

		VAR_6 |= __put_user(VAR_1->sa.sa_restorer, &VAR_5->pretcode);

	} else {

		VAR_6 |= __put_user(VAR_5->retcode, &VAR_5->pretcode);

		

		VAR_6 |= __put_user(0xb8, (char *)(VAR_5->retcode+0));

		VAR_6 |= __put_user(TARGET_NR_rt_sigreturn, (int *)(VAR_5->retcode+1));

		VAR_6 |= __put_user(0x80cd, (short *)(VAR_5->retcode+5));

	}



	if (VAR_6)

		goto give_sigsegv;



	

	VAR_4->regs[R_ESP] = (unsigned long) VAR_5;

	VAR_4->eip = (unsigned long) VAR_1->sa._sa_handler;



        cpu_x86_load_seg(VAR_4, R_DS, __USER_DS);

        cpu_x86_load_seg(VAR_4, R_ES, __USER_DS);

        cpu_x86_load_seg(VAR_4, R_SS, __USER_DS);

        cpu_x86_load_seg(VAR_4, R_CS, __USER_CS);

	VAR_4->eflags &= ~TF_MASK;



	return;



give_sigsegv:

	if (VAR_0 == TARGET_SIGSEGV)

		VAR_1->sa._sa_handler = TARGET_SIG_DFL;

	force_sig(TARGET_SIGSEGV );

}

static void FUNC_0(int VAR_0, struct emulated_sigaction *VAR_1,
target_siginfo_t *VAR_2,
target_sigset_t *VAR_3, CPUX86State *VAR_4)
{ struct rt_sigframe *VAR_5; int VAR_6 = 0; VAR_5 = get_sigframe(VAR_1, VAR_4, sizeof(*VAR_5)); #if 0
if (!access_ok(VERIFY_WRITE, VAR_5, sizeof(*VAR_5)))
goto give_sigsegv; #endif
VAR_6 |= __put_user((
VAR_0),
&VAR_5->VAR_0); VAR_6 |= __put_user((target_ulong)&VAR_5->VAR_2, &VAR_5->pinfo); VAR_6 |= __put_user((target_ulong)&VAR_5->uc, &VAR_5->puc); VAR_6 |= copy_siginfo_to_user(&VAR_5->VAR_2, VAR_2); if (VAR_6)
goto give_sigsegv; VAR_6 |= __put_user(0, &VAR_5->uc.uc_flags); VAR_6 |= __put_user(0, &VAR_5->uc.uc_link); VAR_6 |= __put_user( 0, &VAR_5->uc.uc_stack.ss_sp); VAR_6 |= __put_user( 0,
&VAR_5->uc.uc_stack.ss_flags); VAR_6 |= __put_user( 0, &VAR_5->uc.uc_stack.ss_size); VAR_6 |= setup_sigcontext(&VAR_5->uc.uc_mcontext, &VAR_5->fpstate,
VAR_4, VAR_3->VAR_0[0]); VAR_6 |= __copy_to_user(&VAR_5->uc.uc_sigmask, VAR_3, sizeof(*VAR_3)); if (VAR_6)
goto give_sigsegv; if (VAR_1->sa.sa_flags & TARGET_SA_RESTORER) { VAR_6 |= __put_user(VAR_1->sa.sa_restorer, &VAR_5->pretcode); } else { VAR_6 |= __put_user(VAR_5->retcode, &VAR_5->pretcode); VAR_6 |= __put_user(0xb8, (char *)(VAR_5->retcode+0)); VAR_6 |= __put_user(TARGET_NR_rt_sigreturn, (int *)(VAR_5->retcode+1)); VAR_6 |= __put_user(0x80cd, (short *)(VAR_5->retcode+5)); } if (VAR_6)
goto give_sigsegv; VAR_4->regs[R_ESP] = (unsigned long) VAR_5; VAR_4->eip = (unsigned long) VAR_1->sa._sa_handler; cpu_x86_load_seg(VAR_4, R_DS, __USER_DS); cpu_x86_load_seg(VAR_4, R_ES, __USER_DS); cpu_x86_load_seg(VAR_4, R_SS, __USER_DS); cpu_x86_load_seg(VAR_4, R_CS, __USER_CS); VAR_4->eflags &= ~TF_MASK; return; give_sigsegv:
if (VAR_0 == TARGET_SIGSEGV)
VAR_1->sa._sa_handler = TARGET_SIG_DFL; force_sig(TARGET_SIGSEGV ); }