1 #ifndef __PV_EMULATE_H__ 2 #define __PV_EMULATE_H__ 3 4 #include <xen/sched.h> 5 6 #include <asm/processor.h> 7 #include <asm/x86_emulate.h> 8 9 int pv_emul_read_descriptor(unsigned int sel, const struct vcpu *v, 10 unsigned long *base, unsigned long *limit, 11 unsigned int *ar, bool insn_fetch); 12 13 void pv_emul_instruction_done(struct cpu_user_regs *regs, unsigned long rip); 14 pv_emul_is_mem_write(const struct x86_emulate_state * state,struct x86_emulate_ctxt * ctxt)15static inline int pv_emul_is_mem_write(const struct x86_emulate_state *state, 16 struct x86_emulate_ctxt *ctxt) 17 { 18 return x86_insn_is_mem_write(state, ctxt) ? X86EMUL_OKAY 19 : X86EMUL_UNHANDLEABLE; 20 } 21 22 /* Return a pointer to the GDT/LDT descriptor referenced by sel. */ gdt_ldt_desc_ptr(unsigned int sel)23static inline const seg_desc_t *gdt_ldt_desc_ptr(unsigned int sel) 24 { 25 const struct vcpu *curr = current; 26 const seg_desc_t *tbl = (void *) 27 ((sel & X86_XEC_TI) ? LDT_VIRT_START(curr) : GDT_VIRT_START(curr)); 28 29 return &tbl[sel >> 3]; 30 } 31 32 #endif /* __PV_EMULATE_H__ */ 33