restore_sigcontext(CPUX86State *env, struct target_sigcontext *sc, int *peax)

{

	unsigned int err = 0;

        abi_ulong fpstate_addr;

        unsigned int tmpflags;



        cpu_x86_load_seg(env, R_GS, tswap16(sc->gs));

        cpu_x86_load_seg(env, R_FS, tswap16(sc->fs));

        cpu_x86_load_seg(env, R_ES, tswap16(sc->es));

        cpu_x86_load_seg(env, R_DS, tswap16(sc->ds));



        env->regs[R_EDI] = tswapl(sc->edi);

        env->regs[R_ESI] = tswapl(sc->esi);

        env->regs[R_EBP] = tswapl(sc->ebp);

        env->regs[R_ESP] = tswapl(sc->esp);

        env->regs[R_EBX] = tswapl(sc->ebx);

        env->regs[R_EDX] = tswapl(sc->edx);

        env->regs[R_ECX] = tswapl(sc->ecx);

        env->eip = tswapl(sc->eip);



        cpu_x86_load_seg(env, R_CS, lduw(&sc->cs) | 3);

        cpu_x86_load_seg(env, R_SS, lduw(&sc->ss) | 3);



        tmpflags = tswapl(sc->eflags);

        env->eflags = (env->eflags & ~0x40DD5) | (tmpflags & 0x40DD5);

        //		regs->orig_eax = -1;		/* disable syscall checks */



        fpstate_addr = tswapl(sc->fpstate);

	if (fpstate_addr != 0) {

                if (!access_ok(VERIFY_READ, fpstate_addr, 

                               sizeof(struct target_fpstate)))

                        goto badframe;

                cpu_x86_frstor(env, fpstate_addr, 1);

	}



        *peax = tswapl(sc->eax);

	return err;

badframe:

	return 1;

}

restore_sigcontext(CPUX86State *env, struct target_sigcontext *sc, int *peax)

{

	unsigned int err = 0;

        abi_ulong fpstate_addr;

        unsigned int tmpflags;



        cpu_x86_load_seg(env, R_GS, tswap16(sc->gs));

        cpu_x86_load_seg(env, R_FS, tswap16(sc->fs));

        cpu_x86_load_seg(env, R_ES, tswap16(sc->es));

        cpu_x86_load_seg(env, R_DS, tswap16(sc->ds));



        env->regs[R_EDI] = tswapl(sc->edi);

        env->regs[R_ESI] = tswapl(sc->esi);

        env->regs[R_EBP] = tswapl(sc->ebp);

        env->regs[R_ESP] = tswapl(sc->esp);

        env->regs[R_EBX] = tswapl(sc->ebx);

        env->regs[R_EDX] = tswapl(sc->edx);

        env->regs[R_ECX] = tswapl(sc->ecx);

        env->eip = tswapl(sc->eip);



        cpu_x86_load_seg(env, R_CS, lduw(&sc->cs) | 3);

        cpu_x86_load_seg(env, R_SS, lduw(&sc->ss) | 3);



        tmpflags = tswapl(sc->eflags);

        env->eflags = (env->eflags & ~0x40DD5) | (tmpflags & 0x40DD5);

        



        fpstate_addr = tswapl(sc->fpstate);

	if (fpstate_addr != 0) {

                if (!access_ok(VERIFY_READ, fpstate_addr, 

                               sizeof(struct target_fpstate)))

                        goto badframe;

                cpu_x86_frstor(env, fpstate_addr, 1);

	}



        *peax = tswapl(sc->eax);

	return err;

badframe:

	return 1;

}

        cpu_x86_load_seg(env, R_CS, lduw(&sc->cs) | 3);         cpu_x86_load_seg(env, R_SS, lduw(&sc->ss) | 3);
FUNC_0(CPUX86State *VAR_0, struct target_sigcontext *VAR_1, int *VAR_2)

{

	unsigned int VAR_3 = 0;

        abi_ulong fpstate_addr;

        unsigned int VAR_4;



        cpu_x86_load_seg(VAR_0, R_GS, tswap16(VAR_1->gs));

        cpu_x86_load_seg(VAR_0, R_FS, tswap16(VAR_1->fs));

        cpu_x86_load_seg(VAR_0, R_ES, tswap16(VAR_1->es));

        cpu_x86_load_seg(VAR_0, R_DS, tswap16(VAR_1->ds));



        VAR_0->regs[R_EDI] = tswapl(VAR_1->edi);

        VAR_0->regs[R_ESI] = tswapl(VAR_1->esi);

        VAR_0->regs[R_EBP] = tswapl(VAR_1->ebp);

        VAR_0->regs[R_ESP] = tswapl(VAR_1->esp);

        VAR_0->regs[R_EBX] = tswapl(VAR_1->ebx);

        VAR_0->regs[R_EDX] = tswapl(VAR_1->edx);

        VAR_0->regs[R_ECX] = tswapl(VAR_1->ecx);

        VAR_0->eip = tswapl(VAR_1->eip);



        cpu_x86_load_seg(VAR_0, R_CS, lduw(&VAR_1->cs) | 3);

        cpu_x86_load_seg(VAR_0, R_SS, lduw(&VAR_1->ss) | 3);



        VAR_4 = tswapl(VAR_1->eflags);

        VAR_0->eflags = (VAR_0->eflags & ~0x40DD5) | (VAR_4 & 0x40DD5);

        



        fpstate_addr = tswapl(VAR_1->fpstate);

	if (fpstate_addr != 0) {

                if (!access_ok(VERIFY_READ, fpstate_addr, 

                               sizeof(struct target_fpstate)))

                        goto badframe;

                cpu_x86_frstor(VAR_0, fpstate_addr, 1);

	}



        *VAR_2 = tswapl(VAR_1->eax);

	return VAR_3;

badframe:

	return 1;

}

FUNC_0(CPUX86State *VAR_0, struct target_sigcontext *VAR_1, int *VAR_2)
{ unsigned int VAR_3 = 0; abi_ulong fpstate_addr; unsigned int VAR_4; cpu_x86_load_seg(VAR_0, R_GS, tswap16(VAR_1->gs)); cpu_x86_load_seg(VAR_0, R_FS, tswap16(VAR_1->fs)); cpu_x86_load_seg(VAR_0, R_ES, tswap16(VAR_1->es)); cpu_x86_load_seg(VAR_0, R_DS, tswap16(VAR_1->ds)); VAR_0->regs[R_EDI] = tswapl(VAR_1->edi); VAR_0->regs[R_ESI] = tswapl(VAR_1->esi); VAR_0->regs[R_EBP] = tswapl(VAR_1->ebp); VAR_0->regs[R_ESP] = tswapl(VAR_1->esp); VAR_0->regs[R_EBX] = tswapl(VAR_1->ebx); VAR_0->regs[R_EDX] = tswapl(VAR_1->edx); VAR_0->regs[R_ECX] = tswapl(VAR_1->ecx); VAR_0->eip = tswapl(VAR_1->eip); cpu_x86_load_seg(VAR_0, R_CS, lduw(&VAR_1->cs) | 3); cpu_x86_load_seg(VAR_0, R_SS, lduw(&VAR_1->ss) | 3); VAR_4 = tswapl(VAR_1->eflags); VAR_0->eflags = (VAR_0->eflags & ~0x40DD5) | (VAR_4 & 0x40DD5); fpstate_addr = tswapl(VAR_1->fpstate); if (fpstate_addr != 0) { if (!access_ok(VERIFY_READ, fpstate_addr,
sizeof(struct target_fpstate)))
goto badframe; cpu_x86_frstor(VAR_0, fpstate_addr, 1); } *VAR_2 = tswapl(VAR_1->eax); return VAR_3; badframe:
return 1; }