Lines Matching refs:state

911 ({ unsigned long _x = 0, _ip = state->ip;                               \
912 state->ip += (_size); /* real hardware doesn't truncate */ \
913 generate_exception_if((uint8_t)(state->ip - \
1100 const struct x86_emulate_state *state, in put_fpu() argument
1106 else if ( unlikely(fic->type == X86EMUL_FPU_fpu) && !state->fpu_ctrl ) in put_fpu()
1111 .op = ((ctxt->opcode & 7) << 8) | state->modrm, in put_fpu()
1118 if ( state->ea.type == OP_MEM ) in put_fpu()
1120 aux.dp = state->ea.mem.off; in put_fpu()
1122 ops->read_segment(state->ea.mem.seg, &sreg, in put_fpu()
1126 switch ( state->ea.mem.seg ) in put_fpu()
2060 #define op_bytes (state->op_bytes)
2061 #define ad_bytes (state->ad_bytes)
2062 #define ext (state->ext)
2063 #define modrm (state->modrm)
2064 #define modrm_mod (state->modrm_mod)
2065 #define modrm_reg (state->modrm_reg)
2066 #define modrm_rm (state->modrm_rm)
2067 #define rex_prefix (state->rex_prefix)
2068 #define lock_prefix (state->lock_prefix)
2069 #define vex (state->vex)
2070 #define evex (state->evex)
2071 #define ea (state->ea)
2075 struct x86_emulate_state *state, in x86_decode_onebyte() argument
2104 state->not_64bit = true; in x86_decode_onebyte()
2148 state->desc = DstNone | SrcMem | Mov; in x86_decode_onebyte()
2160 struct x86_emulate_state *state, in x86_decode_twobyte() argument
2172 state->desc |= DstMem | SrcImplicit | Mov; in x86_decode_twobyte()
2175 state->desc |= SrcMem16; in x86_decode_twobyte()
2220 state->desc = DstImplicit | SrcMem | TwoOp; in x86_decode_twobyte()
2221 state->simd_size = simd_other; in x86_decode_twobyte()
2234 state->desc = DstImplicit | SrcMem | Mov; in x86_decode_twobyte()
2239 state->desc = DstMem | SrcImplicit | Mov; in x86_decode_twobyte()
2260 state->desc = DstReg | SrcMem16; in x86_decode_twobyte()
2269 state->desc = DstImplicit | SrcMem | TwoOp; in x86_decode_twobyte()
2270 state->simd_size = simd_other; in x86_decode_twobyte()
2282 if ( state->simd_size && vex.opcx && in x86_decode_twobyte()
2284 state->desc &= ~TwoOp; in x86_decode_twobyte()
2292 struct x86_emulate_state *state, in x86_decode_0f38() argument
2308 state->desc |= repne_prefix() ? ByteOp : Mov; in x86_decode_0f38()
2315 state->desc = DstReg | SrcMem; in x86_decode_0f38()
2342 struct x86_emulate_state *state, in x86_decode_0f3a() argument
2360 state->desc = DstImplicit | SrcMem; in x86_decode_0f3a()
2362 state->desc |= ByteOp; in x86_decode_0f3a()
2367 state->desc = DstImplicit | SrcMem; in x86_decode_0f3a()
2380 struct x86_emulate_state *state, in x86_decode() argument
2392 memset(state, 0, sizeof(*state)); in x86_decode()
2396 state->regs = ctxt->regs; in x86_decode()
2397 state->ip = ctxt->regs->r(ip); in x86_decode()
2481 state->simd_size = twobyte_table[b].size; in x86_decode()
2511 if ( state->regs->eflags & X86_EFLAGS_VM ) in x86_decode()
2596 state->simd_size = twobyte_table[b].size; in x86_decode()
2704 state->simd_size = ext0f38_table[b].simd_size; in x86_decode()
2729 ea.mem.off = state->regs->bx + state->regs->si; in x86_decode()
2732 ea.mem.off = state->regs->bx + state->regs->di; in x86_decode()
2736 ea.mem.off = state->regs->bp + state->regs->si; in x86_decode()
2740 ea.mem.off = state->regs->bp + state->regs->di; in x86_decode()
2743 ea.mem.off = state->regs->si; in x86_decode()
2746 ea.mem.off = state->regs->di; in x86_decode()
2752 ea.mem.off = state->regs->bp; in x86_decode()
2755 ea.mem.off = state->regs->bx; in x86_decode()
2783 state->regs, 0); in x86_decode()
2790 ea.mem.off += state->regs->r(sp); in x86_decode()
2799 ea.mem.off += state->regs->r(bp); in x86_decode()
2803 state->regs, 0); in x86_decode()
2810 state->regs, 0); in x86_decode()
2867 state->desc = d; in x86_decode()
2872 rc = x86_decode_onebyte(state, ctxt, ops); in x86_decode()
2876 rc = x86_decode_twobyte(state, ctxt, ops); in x86_decode()
2880 rc = x86_decode_0f38(state, ctxt, ops); in x86_decode()
2889 state->desc = d; in x86_decode()
2890 state->simd_size = ext0f3a_table[b].simd_size; in x86_decode()
2891 rc = x86_decode_0f3a(state, ctxt, ops); in x86_decode()
2907 ea.mem.off += state->ip; in x86_decode()
2916 switch ( state->simd_size ) in x86_decode()
2990 struct x86_emulate_state state; in x86_emulate() local
3006 rc = x86_decode(&state, ctxt, ops); in x86_emulate()
3011 _regs.r(ip) = state.ip; in x86_emulate()
3016 state.caller = __builtin_return_address(0); in x86_emulate()
3018 rc = ops->validate(&state, ctxt); in x86_emulate()
3020 state.caller = NULL; in x86_emulate()
3029 d = state.desc; in x86_emulate()
3030 #define state (&state) in x86_emulate() macro
3032 generate_exception_if(state->not_64bit && mode_64bit(), EXC_UD); in x86_emulate()
3069 if ( state->simd_size ) in x86_emulate()
3174 if ( state->simd_size ) in x86_emulate()
4209 state->fpu_ctrl = true; in x86_emulate()
4212 state->fpu_ctrl = true; in x86_emulate()
4220 state->fpu_ctrl = true; in x86_emulate()
4223 state->fpu_ctrl = true; in x86_emulate()
4312 state->fpu_ctrl = true; in x86_emulate()
4456 state->fpu_ctrl = true; in x86_emulate()
4459 state->fpu_ctrl = true; in x86_emulate()
4532 state->fpu_ctrl = true; in x86_emulate()
5620 state->simd_size = simd_none; in x86_emulate()
5674 state->simd_size = simd_none; in x86_emulate()
5725 ASSERT(!state->simd_size); in x86_emulate()
5903 ASSERT(!state->simd_size); in x86_emulate()
6107 ASSERT(!state->simd_size); in x86_emulate()
6249 ASSERT(!state->simd_size); in x86_emulate()
6317 ASSERT(!state->simd_size); in x86_emulate()
7196 state->simd_size = simd_none; in x86_emulate()
7608 ASSERT(!state->simd_size); in x86_emulate()
7632 state->simd_size = simd_other; in x86_emulate()
7644 state->simd_size = simd_other; in x86_emulate()
7733 state->simd_size = simd_none; in x86_emulate()
7853 if ( state->simd_size ) in x86_emulate()
7974 !state->simd_size ? &dst.val in x86_emulate()
7987 put_fpu(&fic, false, state, ctxt, ops); in x86_emulate()
8011 put_fpu(&fic, fic.insn_bytes > 0 && dst.type == OP_MEM, state, ctxt, ops); in x86_emulate()
8014 #undef state in x86_emulate()
8108 static DEFINE_PER_CPU(struct x86_emulate_state, state); in x86_decode_insn()
8109 struct x86_emulate_state *state = &this_cpu(state); in x86_decode_insn() local
8114 int rc = x86_decode(state, ctxt, &ops); in x86_decode_insn()
8125 if ( state->caller ) in x86_decode_insn()
8128 state->caller); in x86_decode_insn()
8131 state->caller = __builtin_return_address(0); in x86_decode_insn()
8134 return state; in x86_decode_insn()
8137 static inline void check_state(const struct x86_emulate_state *state) in check_state() argument
8140 ASSERT(state->caller); in check_state()
8145 void x86_emulate_free_state(struct x86_emulate_state *state) in x86_emulate_free_state() argument
8147 check_state(state); in x86_emulate_free_state()
8148 state->caller = NULL; in x86_emulate_free_state()
8153 x86_insn_opsize(const struct x86_emulate_state *state) in x86_insn_opsize() argument
8155 check_state(state); in x86_insn_opsize()
8157 return state->op_bytes << 3; in x86_insn_opsize()
8161 x86_insn_modrm(const struct x86_emulate_state *state, in x86_insn_modrm() argument
8164 check_state(state); in x86_insn_modrm()
8166 if ( unlikely(state->modrm_mod > 3) ) in x86_insn_modrm()
8176 *rm = state->modrm_rm; in x86_insn_modrm()
8178 *reg = state->modrm_reg; in x86_insn_modrm()
8180 return state->modrm_mod; in x86_insn_modrm()
8184 x86_insn_operand_ea(const struct x86_emulate_state *state, in x86_insn_operand_ea() argument
8187 *seg = state->ea.type == OP_MEM ? state->ea.mem.seg : x86_seg_none; in x86_insn_operand_ea()
8189 check_state(state); in x86_insn_operand_ea()
8191 return state->ea.mem.off; in x86_insn_operand_ea()
8195 x86_insn_is_mem_access(const struct x86_emulate_state *state, in x86_insn_is_mem_access() argument
8198 if ( state->ea.type == OP_MEM ) in x86_insn_is_mem_access()
8201 (state->modrm_reg & 7) != 7) /* INVLPG */; in x86_insn_is_mem_access()
8215 return (state->modrm_rm & 7) == 4 && (state->modrm_reg & 7) == 7; in x86_insn_is_mem_access()
8222 x86_insn_is_mem_write(const struct x86_emulate_state *state, in x86_insn_is_mem_write() argument
8225 switch ( state->desc & DstMask ) in x86_insn_is_mem_write()
8229 return state->modrm_mod != 3 || (state->desc & SrcMask) == SrcMem; in x86_insn_is_mem_write()
8239 if ( state->modrm_mod == 3 ) in x86_insn_is_mem_write()
8242 (state->modrm_rm & 7) == 4 && (state->modrm_reg & 7) == 7; in x86_insn_is_mem_write()
8255 switch ( state->modrm_reg & 7 ) in x86_insn_is_mem_write()
8266 switch ( state->modrm_reg & 7 ) in x86_insn_is_mem_write()
8277 switch ( state->modrm_reg & 7 ) in x86_insn_is_mem_write()
8289 switch ( state->modrm_reg & 7 ) in x86_insn_is_mem_write()
8301 return !(state->modrm_reg & 6); /* SGDT / SIDT */ in x86_insn_is_mem_write()
8304 return (state->modrm_reg & 7) > 4; /* BTS / BTR / BTC */ in x86_insn_is_mem_write()
8307 return (state->modrm_reg & 7) == 1; /* CMPXCHG{8,16}B */ in x86_insn_is_mem_write()
8314 x86_insn_is_portio(const struct x86_emulate_state *state, in x86_insn_is_portio() argument
8329 x86_insn_is_cr_access(const struct x86_emulate_state *state, in x86_insn_is_cr_access() argument
8337 if ( x86_insn_modrm(state, NULL, &ext) >= 0 in x86_insn_is_cr_access()
8352 x86_insn_immediate(const struct x86_emulate_state *state, unsigned int nr) in x86_insn_immediate() argument
8354 check_state(state); in x86_insn_immediate()
8359 return state->imm1; in x86_insn_immediate()
8361 return state->imm2; in x86_insn_immediate()
8368 x86_insn_length(const struct x86_emulate_state *state, in x86_insn_length() argument
8371 check_state(state); in x86_insn_length()
8373 return state->ip - ctxt->regs->r(ip); in x86_insn_length()