setup_sigcontext(struct target_sigcontext *sc, struct target_fpstate *fpstate,

		 CPUX86State *env, unsigned long mask)

{

	int err = 0;



	err |= __put_user(env->segs[R_GS], (unsigned int *)&sc->gs);

	err |= __put_user(env->segs[R_FS], (unsigned int *)&sc->fs);

	err |= __put_user(env->segs[R_ES], (unsigned int *)&sc->es);

	err |= __put_user(env->segs[R_DS], (unsigned int *)&sc->ds);

	err |= __put_user(env->regs[R_EDI], &sc->edi);

	err |= __put_user(env->regs[R_ESI], &sc->esi);

	err |= __put_user(env->regs[R_EBP], &sc->ebp);

	err |= __put_user(env->regs[R_ESP], &sc->esp);

	err |= __put_user(env->regs[R_EBX], &sc->ebx);

	err |= __put_user(env->regs[R_EDX], &sc->edx);

	err |= __put_user(env->regs[R_ECX], &sc->ecx);

	err |= __put_user(env->regs[R_EAX], &sc->eax);

	err |= __put_user(env->exception_index, &sc->trapno);

	err |= __put_user(env->error_code, &sc->err);

	err |= __put_user(env->eip, &sc->eip);

	err |= __put_user(env->segs[R_CS], (unsigned int *)&sc->cs);

	err |= __put_user(env->eflags, &sc->eflags);

	err |= __put_user(env->regs[R_ESP], &sc->esp_at_signal);

	err |= __put_user(env->segs[R_SS], (unsigned int *)&sc->ss);

#if 0

	tmp = save_i387(fpstate);

	if (tmp < 0)

	  err = 1;

	else

	  err |= __put_user(tmp ? fpstate : NULL, &sc->fpstate);

#else

        err |= __put_user(0, &sc->fpstate);

#endif

	/* non-iBCS2 extensions.. */

	err |= __put_user(mask, &sc->oldmask);

	err |= __put_user(/*current->thread.cr2*/ 0, &sc->cr2);

	return err;

}

setup_sigcontext(struct target_sigcontext *sc, struct target_fpstate *fpstate,

		 CPUX86State *env, unsigned long mask)

{

	int err = 0;



	err |= __put_user(env->segs[R_GS], (unsigned int *)&sc->gs);

	err |= __put_user(env->segs[R_FS], (unsigned int *)&sc->fs);

	err |= __put_user(env->segs[R_ES], (unsigned int *)&sc->es);

	err |= __put_user(env->segs[R_DS], (unsigned int *)&sc->ds);

	err |= __put_user(env->regs[R_EDI], &sc->edi);

	err |= __put_user(env->regs[R_ESI], &sc->esi);

	err |= __put_user(env->regs[R_EBP], &sc->ebp);

	err |= __put_user(env->regs[R_ESP], &sc->esp);

	err |= __put_user(env->regs[R_EBX], &sc->ebx);

	err |= __put_user(env->regs[R_EDX], &sc->edx);

	err |= __put_user(env->regs[R_ECX], &sc->ecx);

	err |= __put_user(env->regs[R_EAX], &sc->eax);

	err |= __put_user(env->exception_index, &sc->trapno);

	err |= __put_user(env->error_code, &sc->err);

	err |= __put_user(env->eip, &sc->eip);

	err |= __put_user(env->segs[R_CS], (unsigned int *)&sc->cs);

	err |= __put_user(env->eflags, &sc->eflags);

	err |= __put_user(env->regs[R_ESP], &sc->esp_at_signal);

	err |= __put_user(env->segs[R_SS], (unsigned int *)&sc->ss);

#if 0

	tmp = save_i387(fpstate);

	if (tmp < 0)

	  err = 1;

	else

	  err |= __put_user(tmp ? fpstate : NULL, &sc->fpstate);

#else

        err |= __put_user(0, &sc->fpstate);

#endif

	

	err |= __put_user(mask, &sc->oldmask);

	err |= __put_user( 0, &sc->cr2);

	return err;

}

FUNC_0(struct target_sigcontext *VAR_0, struct target_fpstate *VAR_1,

		 CPUX86State *VAR_2, unsigned long VAR_3)

{

	int VAR_4 = 0;



	VAR_4 |= __put_user(VAR_2->segs[R_GS], (unsigned int *)&VAR_0->gs);

	VAR_4 |= __put_user(VAR_2->segs[R_FS], (unsigned int *)&VAR_0->fs);

	VAR_4 |= __put_user(VAR_2->segs[R_ES], (unsigned int *)&VAR_0->es);

	VAR_4 |= __put_user(VAR_2->segs[R_DS], (unsigned int *)&VAR_0->ds);

	VAR_4 |= __put_user(VAR_2->regs[R_EDI], &VAR_0->edi);

	VAR_4 |= __put_user(VAR_2->regs[R_ESI], &VAR_0->esi);

	VAR_4 |= __put_user(VAR_2->regs[R_EBP], &VAR_0->ebp);

	VAR_4 |= __put_user(VAR_2->regs[R_ESP], &VAR_0->esp);

	VAR_4 |= __put_user(VAR_2->regs[R_EBX], &VAR_0->ebx);

	VAR_4 |= __put_user(VAR_2->regs[R_EDX], &VAR_0->edx);

	VAR_4 |= __put_user(VAR_2->regs[R_ECX], &VAR_0->ecx);

	VAR_4 |= __put_user(VAR_2->regs[R_EAX], &VAR_0->eax);

	VAR_4 |= __put_user(VAR_2->exception_index, &VAR_0->trapno);

	VAR_4 |= __put_user(VAR_2->error_code, &VAR_0->VAR_4);

	VAR_4 |= __put_user(VAR_2->eip, &VAR_0->eip);

	VAR_4 |= __put_user(VAR_2->segs[R_CS], (unsigned int *)&VAR_0->cs);

	VAR_4 |= __put_user(VAR_2->eflags, &VAR_0->eflags);

	VAR_4 |= __put_user(VAR_2->regs[R_ESP], &VAR_0->esp_at_signal);

	VAR_4 |= __put_user(VAR_2->segs[R_SS], (unsigned int *)&VAR_0->ss);

#if 0

	tmp = save_i387(VAR_1);

	if (tmp < 0)

	  VAR_4 = 1;

	else

	  VAR_4 |= __put_user(tmp ? VAR_1 : NULL, &VAR_0->VAR_1);

#else

        VAR_4 |= __put_user(0, &VAR_0->VAR_1);

#endif

	

	VAR_4 |= __put_user(VAR_3, &VAR_0->oldmask);

	VAR_4 |= __put_user( 0, &VAR_0->cr2);

	return VAR_4;

}

FUNC_0(struct target_sigcontext *VAR_0, struct target_fpstate *VAR_1,
CPUX86State *VAR_2, unsigned long VAR_3)
{ int VAR_4 = 0; VAR_4 |= __put_user(VAR_2->segs[R_GS], (unsigned int *)&VAR_0->gs); VAR_4 |= __put_user(VAR_2->segs[R_FS], (unsigned int *)&VAR_0->fs); VAR_4 |= __put_user(VAR_2->segs[R_ES], (unsigned int *)&VAR_0->es); VAR_4 |= __put_user(VAR_2->segs[R_DS], (unsigned int *)&VAR_0->ds); VAR_4 |= __put_user(VAR_2->regs[R_EDI], &VAR_0->edi); VAR_4 |= __put_user(VAR_2->regs[R_ESI], &VAR_0->esi); VAR_4 |= __put_user(VAR_2->regs[R_EBP], &VAR_0->ebp); VAR_4 |= __put_user(VAR_2->regs[R_ESP], &VAR_0->esp); VAR_4 |= __put_user(VAR_2->regs[R_EBX], &VAR_0->ebx); VAR_4 |= __put_user(VAR_2->regs[R_EDX], &VAR_0->edx); VAR_4 |= __put_user(VAR_2->regs[R_ECX], &VAR_0->ecx); VAR_4 |= __put_user(VAR_2->regs[R_EAX], &VAR_0->eax); VAR_4 |= __put_user(VAR_2->exception_index, &VAR_0->trapno); VAR_4 |= __put_user(VAR_2->error_code, &VAR_0->VAR_4); VAR_4 |= __put_user(VAR_2->eip, &VAR_0->eip); VAR_4 |= __put_user(VAR_2->segs[R_CS], (unsigned int *)&VAR_0->cs); VAR_4 |= __put_user(VAR_2->eflags, &VAR_0->eflags); VAR_4 |= __put_user(VAR_2->regs[R_ESP], &VAR_0->esp_at_signal); VAR_4 |= __put_user(VAR_2->segs[R_SS], (unsigned int *)&VAR_0->ss); #if 0
tmp = save_i387(VAR_1); if (tmp < 0)
VAR_4 = 1; else
VAR_4 |= __put_user(tmp ? VAR_1 : NULL, &VAR_0->VAR_1); #else
VAR_4 |= __put_user(0, &VAR_0->VAR_1); #endif
VAR_4 |= __put_user(VAR_3, &VAR_0->oldmask); VAR_4 |= __put_user( 0, &VAR_0->cr2); return VAR_4; }