static void do_interrupt_real(int intno, int is_int, int error_code,

                                 unsigned int next_eip)

{

    SegmentCache *dt;

    uint8_t *ptr, *ssp;

    int selector;

    uint32_t offset, esp;

    uint32_t old_cs, old_eip;



    /* real mode (simpler !) */

    dt = &env->idt;

    if (intno * 4 + 3 > dt->limit)

        raise_exception_err(EXCP0D_GPF, intno * 8 + 2);

    ptr = dt->base + intno * 4;

    offset = lduw(ptr);

    selector = lduw(ptr + 2);

    esp = env->regs[R_ESP];

    ssp = env->segs[R_SS].base;

    if (is_int)

        old_eip = next_eip;

    else

        old_eip = env->eip;

    old_cs = env->segs[R_CS].selector;

    esp -= 2;

    stw(ssp + (esp & 0xffff), compute_eflags());

    esp -= 2;

    stw(ssp + (esp & 0xffff), old_cs);

    esp -= 2;

    stw(ssp + (esp & 0xffff), old_eip);

    

    /* update processor state */

    env->regs[R_ESP] = (env->regs[R_ESP] & ~0xffff) | (esp & 0xffff);

    env->eip = offset;

    env->segs[R_CS].selector = selector;

    env->segs[R_CS].base = (uint8_t *)(selector << 4);

    env->eflags &= ~(IF_MASK | TF_MASK | AC_MASK | RF_MASK);

}

static void do_interrupt_real(int intno, int is_int, int error_code,

                                 unsigned int next_eip)

{

    SegmentCache *dt;

    uint8_t *ptr, *ssp;

    int selector;

    uint32_t offset, esp;

    uint32_t old_cs, old_eip;



    

    dt = &env->idt;

    if (intno * 4 + 3 > dt->limit)

        raise_exception_err(EXCP0D_GPF, intno * 8 + 2);

    ptr = dt->base + intno * 4;

    offset = lduw(ptr);

    selector = lduw(ptr + 2);

    esp = env->regs[R_ESP];

    ssp = env->segs[R_SS].base;

    if (is_int)

        old_eip = next_eip;

    else

        old_eip = env->eip;

    old_cs = env->segs[R_CS].selector;

    esp -= 2;

    stw(ssp + (esp & 0xffff), compute_eflags());

    esp -= 2;

    stw(ssp + (esp & 0xffff), old_cs);

    esp -= 2;

    stw(ssp + (esp & 0xffff), old_eip);

    

    

    env->regs[R_ESP] = (env->regs[R_ESP] & ~0xffff) | (esp & 0xffff);

    env->eip = offset;

    env->segs[R_CS].selector = selector;

    env->segs[R_CS].base = (uint8_t *)(selector << 4);

    env->eflags &= ~(IF_MASK | TF_MASK | AC_MASK | RF_MASK);

}

static void FUNC_0(int VAR_0, int VAR_1, int VAR_2,

                                 unsigned int VAR_3)

{

    SegmentCache *dt;

    uint8_t *ptr, *ssp;

    int VAR_4;

    uint32_t offset, esp;

    uint32_t old_cs, old_eip;



    

    dt = &env->idt;

    if (VAR_0 * 4 + 3 > dt->limit)

        raise_exception_err(EXCP0D_GPF, VAR_0 * 8 + 2);

    ptr = dt->base + VAR_0 * 4;

    offset = lduw(ptr);

    VAR_4 = lduw(ptr + 2);

    esp = env->regs[R_ESP];

    ssp = env->segs[R_SS].base;

    if (VAR_1)

        old_eip = VAR_3;

    else

        old_eip = env->eip;

    old_cs = env->segs[R_CS].VAR_4;

    esp -= 2;

    stw(ssp + (esp & 0xffff), compute_eflags());

    esp -= 2;

    stw(ssp + (esp & 0xffff), old_cs);

    esp -= 2;

    stw(ssp + (esp & 0xffff), old_eip);

    

    

    env->regs[R_ESP] = (env->regs[R_ESP] & ~0xffff) | (esp & 0xffff);

    env->eip = offset;

    env->segs[R_CS].VAR_4 = VAR_4;

    env->segs[R_CS].base = (uint8_t *)(VAR_4 << 4);

    env->eflags &= ~(IF_MASK | TF_MASK | AC_MASK | RF_MASK);

}

static void FUNC_0(int VAR_0, int VAR_1, int VAR_2,
unsigned int VAR_3)
{ SegmentCache *dt; uint8_t *ptr, *ssp; int VAR_4; uint32_t offset, esp; uint32_t old_cs, old_eip; dt = &env->idt; if (VAR_0 * 4 + 3 > dt->limit)
raise_exception_err(EXCP0D_GPF, VAR_0 * 8 + 2); ptr = dt->base + VAR_0 * 4; offset = lduw(ptr); VAR_4 = lduw(ptr + 2); esp = env->regs[R_ESP]; ssp = env->segs[R_SS].base; if (VAR_1)
old_eip = VAR_3; else
old_eip = env->eip; old_cs = env->segs[R_CS].VAR_4; esp -= 2; stw(ssp + (esp & 0xffff), compute_eflags()); esp -= 2; stw(ssp + (esp & 0xffff), old_cs); esp -= 2; stw(ssp + (esp & 0xffff), old_eip); env->regs[R_ESP] = (env->regs[R_ESP] & ~0xffff) | (esp & 0xffff); env->eip = offset; env->segs[R_CS].VAR_4 = VAR_4; env->segs[R_CS].base = (uint8_t *)(VAR_4 << 4); env->eflags &= ~(IF_MASK | TF_MASK | AC_MASK | RF_MASK); }