cpu_x86_dump_seg_cache(CPUState *env, FILE *f,

                       int (*cpu_fprintf)(FILE *f, const char *fmt, ...),

                       const char *name, struct SegmentCache *sc)

{

#ifdef TARGET_X86_64

    if (env->hflags & HF_CS64_MASK) {

        cpu_fprintf(f, "%-3s=%04x %016" PRIx64 " %08x %08x", name,

                    sc->selector, sc->base, sc->limit, sc->flags);

    } else

#endif

    {

        cpu_fprintf(f, "%-3s=%04x %08x %08x %08x", name, sc->selector,

                    (uint32_t)sc->base, sc->limit, sc->flags);

    }



    if (!(env->hflags & HF_PE_MASK) || !(sc->flags & DESC_P_MASK))

        goto done;



    cpu_fprintf(f, " DPL=%d ", (sc->flags & DESC_DPL_MASK) >> DESC_DPL_SHIFT);

    if (sc->flags & DESC_S_MASK) {

        if (sc->flags & DESC_CS_MASK) {

            cpu_fprintf(f, (sc->flags & DESC_L_MASK) ? "CS64" :

                           ((sc->flags & DESC_B_MASK) ? "CS32" : "CS16"));

            cpu_fprintf(f, " [%c%c", (sc->flags & DESC_C_MASK) ? 'C' : '-',

                        (sc->flags & DESC_R_MASK) ? 'R' : '-');

        } else {

            cpu_fprintf(f, (sc->flags & DESC_B_MASK) ? "DS  " : "DS16");

            cpu_fprintf(f, " [%c%c", (sc->flags & DESC_E_MASK) ? 'E' : '-',

                        (sc->flags & DESC_W_MASK) ? 'W' : '-');

        }

        cpu_fprintf(f, "%c]", (sc->flags & DESC_A_MASK) ? 'A' : '-');

    } else {

        static const char *sys_type_name[2][16] = {

            { /* 32 bit mode */

                "Reserved", "TSS16-avl", "LDT", "TSS16-busy",

                "CallGate16", "TaskGate", "IntGate16", "TrapGate16",

                "Reserved", "TSS32-avl", "Reserved", "TSS32-busy",

                "CallGate32", "Reserved", "IntGate32", "TrapGate32"

            },

            { /* 64 bit mode */

                "<hiword>", "Reserved", "LDT", "Reserved", "Reserved",

                "Reserved", "Reserved", "Reserved", "Reserved",

                "TSS64-avl", "Reserved", "TSS64-busy", "CallGate64",

                "Reserved", "IntGate64", "TrapGate64"

            }

        };

        cpu_fprintf(f, "%s",

                    sys_type_name[(env->hflags & HF_LMA_MASK) ? 1 : 0]

                                 [(sc->flags & DESC_TYPE_MASK)

                                  >> DESC_TYPE_SHIFT]);

    }

done:

    cpu_fprintf(f, "\n");

}

cpu_x86_dump_seg_cache(CPUState *env, FILE *f,

                       int (*cpu_fprintf)(FILE *f, const char *fmt, ...),

                       const char *name, struct SegmentCache *sc)

{

#ifdef TARGET_X86_64

    if (env->hflags & HF_CS64_MASK) {

        cpu_fprintf(f, "%-3s=%04x %016" PRIx64 " %08x %08x", name,

                    sc->selector, sc->base, sc->limit, sc->flags);

    } else

#endif

    {

        cpu_fprintf(f, "%-3s=%04x %08x %08x %08x", name, sc->selector,

                    (uint32_t)sc->base, sc->limit, sc->flags);

    }



    if (!(env->hflags & HF_PE_MASK) || !(sc->flags & DESC_P_MASK))

        goto done;



    cpu_fprintf(f, " DPL=%d ", (sc->flags & DESC_DPL_MASK) >> DESC_DPL_SHIFT);

    if (sc->flags & DESC_S_MASK) {

        if (sc->flags & DESC_CS_MASK) {

            cpu_fprintf(f, (sc->flags & DESC_L_MASK) ? "CS64" :

                           ((sc->flags & DESC_B_MASK) ? "CS32" : "CS16"));

            cpu_fprintf(f, " [%c%c", (sc->flags & DESC_C_MASK) ? 'C' : '-',

                        (sc->flags & DESC_R_MASK) ? 'R' : '-');

        } else {

            cpu_fprintf(f, (sc->flags & DESC_B_MASK) ? "DS  " : "DS16");

            cpu_fprintf(f, " [%c%c", (sc->flags & DESC_E_MASK) ? 'E' : '-',

                        (sc->flags & DESC_W_MASK) ? 'W' : '-');

        }

        cpu_fprintf(f, "%c]", (sc->flags & DESC_A_MASK) ? 'A' : '-');

    } else {

        static const char *sys_type_name[2][16] = {

            { 

                "Reserved", "TSS16-avl", "LDT", "TSS16-busy",

                "CallGate16", "TaskGate", "IntGate16", "TrapGate16",

                "Reserved", "TSS32-avl", "Reserved", "TSS32-busy",

                "CallGate32", "Reserved", "IntGate32", "TrapGate32"

            },

            { 

                "<hiword>", "Reserved", "LDT", "Reserved", "Reserved",

                "Reserved", "Reserved", "Reserved", "Reserved",

                "TSS64-avl", "Reserved", "TSS64-busy", "CallGate64",

                "Reserved", "IntGate64", "TrapGate64"

            }

        };

        cpu_fprintf(f, "%s",

                    sys_type_name[(env->hflags & HF_LMA_MASK) ? 1 : 0]

                                 [(sc->flags & DESC_TYPE_MASK)

                                  >> DESC_TYPE_SHIFT]);

    }

done:

    cpu_fprintf(f, "\n");

}

FUNC_0(CPUState *VAR_0, FILE *VAR_3,

                       int (*VAR_2)(FILE *VAR_3, const char *VAR_3, ...),

                       const char *VAR_4, struct SegmentCache *VAR_5)

{

#ifdef TARGET_X86_64

    if (VAR_0->hflags & HF_CS64_MASK) {

        VAR_2(VAR_3, "%-3s=%04x %016" PRIx64 " %08x %08x", VAR_4,

                    VAR_5->selector, VAR_5->base, VAR_5->limit, VAR_5->flags);

    } else

#endif

    {

        VAR_2(VAR_3, "%-3s=%04x %08x %08x %08x", VAR_4, VAR_5->selector,

                    (uint32_t)VAR_5->base, VAR_5->limit, VAR_5->flags);

    }



    if (!(VAR_0->hflags & HF_PE_MASK) || !(VAR_5->flags & DESC_P_MASK))

        goto done;



    VAR_2(VAR_3, " DPL=%d ", (VAR_5->flags & DESC_DPL_MASK) >> DESC_DPL_SHIFT);

    if (VAR_5->flags & DESC_S_MASK) {

        if (VAR_5->flags & DESC_CS_MASK) {

            VAR_2(VAR_3, (VAR_5->flags & DESC_L_MASK) ? "CS64" :

                           ((VAR_5->flags & DESC_B_MASK) ? "CS32" : "CS16"));

            VAR_2(VAR_3, " [%c%c", (VAR_5->flags & DESC_C_MASK) ? 'C' : '-',

                        (VAR_5->flags & DESC_R_MASK) ? 'R' : '-');

        } else {

            VAR_2(VAR_3, (VAR_5->flags & DESC_B_MASK) ? "DS  " : "DS16");

            VAR_2(VAR_3, " [%c%c", (VAR_5->flags & DESC_E_MASK) ? 'E' : '-',

                        (VAR_5->flags & DESC_W_MASK) ? 'W' : '-');

        }

        VAR_2(VAR_3, "%c]", (VAR_5->flags & DESC_A_MASK) ? 'A' : '-');

    } else {

        static const char *VAR_6[2][16] = {

            { 

                "Reserved", "TSS16-avl", "LDT", "TSS16-busy",

                "CallGate16", "TaskGate", "IntGate16", "TrapGate16",

                "Reserved", "TSS32-avl", "Reserved", "TSS32-busy",

                "CallGate32", "Reserved", "IntGate32", "TrapGate32"

            },

            { 

                "<hiword>", "Reserved", "LDT", "Reserved", "Reserved",

                "Reserved", "Reserved", "Reserved", "Reserved",

                "TSS64-avl", "Reserved", "TSS64-busy", "CallGate64",

                "Reserved", "IntGate64", "TrapGate64"

            }

        };

        VAR_2(VAR_3, "%s",

                    VAR_6[(VAR_0->hflags & HF_LMA_MASK) ? 1 : 0]

                                 [(VAR_5->flags & DESC_TYPE_MASK)

                                  >> DESC_TYPE_SHIFT]);

    }

done:

    VAR_2(VAR_3, "\n");

}

FUNC_0(CPUState *VAR_0, FILE *VAR_3,
int (*VAR_2)(FILE *VAR_3, const char *VAR_3, ...),
const char *VAR_4, struct SegmentCache *VAR_5)
{ #ifdef TARGET_X86_64
if (VAR_0->hflags & HF_CS64_MASK) { VAR_2(VAR_3, "%-3s=%04x %016" PRIx64 " %08x %08x", VAR_4,
VAR_5->selector, VAR_5->base, VAR_5->limit, VAR_5->flags); } else #endif
{ VAR_2(VAR_3, "%-3s=%04x %08x %08x %08x", VAR_4, VAR_5->selector,
(uint32_t)VAR_5->base, VAR_5->limit, VAR_5->flags); } if (!(VAR_0->hflags & HF_PE_MASK) || !(VAR_5->flags & DESC_P_MASK))
goto done; VAR_2(VAR_3, " DPL=%d ", (VAR_5->flags & DESC_DPL_MASK) >> DESC_DPL_SHIFT); if (VAR_5->flags & DESC_S_MASK) { if (VAR_5->flags & DESC_CS_MASK) { VAR_2(VAR_3, (VAR_5->flags & DESC_L_MASK) ? "CS64" :
((VAR_5->flags & DESC_B_MASK) ? "CS32" : "CS16")); VAR_2(VAR_3, " [%c%c", (VAR_5->flags & DESC_C_MASK) ? 'C' : '-',
(VAR_5->flags & DESC_R_MASK) ? 'R' : '-'); } else { VAR_2(VAR_3, (VAR_5->flags & DESC_B_MASK) ? "DS  " : "DS16"); VAR_2(VAR_3, " [%c%c", (VAR_5->flags & DESC_E_MASK) ? 'E' : '-',
(VAR_5->flags & DESC_W_MASK) ? 'W' : '-'); } VAR_2(VAR_3, "%c]", (VAR_5->flags & DESC_A_MASK) ? 'A' : '-'); } else { static const char *VAR_6[2][16] = { { "Reserved", "TSS16-avl", "LDT", "TSS16-busy",
"CallGate16", "TaskGate", "IntGate16", "TrapGate16",
"Reserved", "TSS32-avl", "Reserved", "TSS32-busy",
"CallGate32", "Reserved", "IntGate32", "TrapGate32"
}, { "<hiword>", "Reserved", "LDT", "Reserved", "Reserved",
"Reserved", "Reserved", "Reserved", "Reserved",
"TSS64-avl", "Reserved", "TSS64-busy", "CallGate64",
"Reserved", "IntGate64", "TrapGate64"
} }; VAR_2(VAR_3, "%s",
VAR_6[(VAR_0->hflags & HF_LMA_MASK) ? 1 : 0]
[(VAR_5->flags & DESC_TYPE_MASK)
>> DESC_TYPE_SHIFT]); } done:
VAR_2(VAR_3, "\n"); }