This adds new fields in the CPUX86State struct to store the x87 exception pointers. Also it adds a new enum type that encodes the operand size and the processor operating mode (protected and real mode).
Signed-off-by: jaume.mar...@gmail.com --- target-i386/cpu.h | 23 +++++++++++++++++++++-- target-i386/machine.c | 2 +- 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/target-i386/cpu.h b/target-i386/cpu.h index 3460b12..a749c43 100644 --- a/target-i386/cpu.h +++ b/target-i386/cpu.h @@ -690,6 +690,24 @@ typedef enum { CC_OP_NB, } CCOp; +typedef enum { + B8 = 0, + B16 = 1, + B32 = 2, + B64 = 3, + BSIZE = 3, /* Mask for the above. */ + + RM = 4, + PM = 8, + + PM32 = PM | B32, + PM16 = PM | B16, + RM32 = RM | B32, + RM16 = RM | B16, +} OMode; + +#define TO_OMODE(bsize, is_pm) ((bsize & BSIZE) | (1 << (is_pm ? 3 : 2))) + typedef struct SegmentCache { uint32_t selector; target_ulong base; @@ -821,10 +839,11 @@ typedef struct CPUX86State { uint16_t fpuc; uint8_t fptags[8]; /* 0 = valid, 1 = empty */ FPReg fpregs[8]; - /* KVM-only so far */ - uint16_t fpop; + uint32_t fpop; uint64_t fpip; uint64_t fpdp; + uint32_t fpcs; + uint32_t fpds; /* emulator internal variables */ float_status fp_status; diff --git a/target-i386/machine.c b/target-i386/machine.c index fb89065..0557100 100644 --- a/target-i386/machine.c +++ b/target-i386/machine.c @@ -397,7 +397,7 @@ static const VMStateDescription vmstate_fpop_ip_dp = { .version_id = 1, .minimum_version_id = 1, .fields = (VMStateField[]) { - VMSTATE_UINT16(env.fpop, X86CPU), + VMSTATE_UINT32(env.fpop, X86CPU), VMSTATE_UINT64(env.fpip, X86CPU), VMSTATE_UINT64(env.fpdp, X86CPU), VMSTATE_END_OF_LIST() -- 2.1.0