Projectname
large_stringclasses
15 values
Filepath
large_stringlengths
4
106
⌀
Function
large_stringlengths
11
3.45k
Label
list
Linux Kernel
arch/x86/kernel/unwind_orc.c
static bool deref_stack_iret_regs(struct unwind_state *state, unsigned long addr, unsigned long *ip, unsigned long *sp) { struct pt_regs *regs = (void *)addr - IRET_FRAME_OFFSET; if (!stack_access_ok(state, addr, IRET_FRAME_SIZE)) return fals...
[ 0, 0 ]
Linux Kernel
arch/x86/kernel/uprobes.c
static inline unsigned long *scratch_reg(struct arch_uprobe *auprobe, struct pt_regs *regs) { if (auprobe->defparam.fixups & UPROBE_FIX_RIP_SI) return &regs->si; if (auprobe->defparam.fixups & UPROBE_FIX_RIP_DI) return &regs->di; return &regs->bx; }
[ 0, 0 ]
Linux Kernel
arch/x86/kernel/uprobes.c
static void default_abort_op(struct arch_uprobe *auprobe, struct pt_regs *regs) { riprel_post_xol(auprobe, regs); }
[ 0, 0 ]
Linux Kernel
arch/x86/kernel/uprobes.c
static bool branch_emulate_op(struct arch_uprobe *auprobe, struct pt_regs *regs) { unsigned long new_ip = regs->ip += auprobe->branch.ilen; unsigned long offs = (long)auprobe->branch.offs; if (branch_is_call(auprobe)) { if (emulate_push_stack(regs, new_ip)) return false; ...
[ 1, 0 ]
Linux Kernel
arch/x86/kernel/uprobes.c
static void branch_clear_offset(struct arch_uprobe *auprobe, struct insn *insn) { memset(auprobe->insn + insn_offset_immediate(insn), 0, insn->immediate.nbytes); }
[ 1, 0 ]
Linux Kernel
arch/x86/kernel/uprobes.c
static int branch_setup_xol_ops(struct arch_uprobe *auprobe, struct insn *insn) { u8 opc1 = OPCODE1(insn); insn_byte_t p; int i; switch (opc1) { case 0xeb: case 0xe9: /* jmp 32 */ break; case 0x90: /* prefix* + nop; same as jmp with .offs = 0 */ goto setup; case...
[ 1, 0 ]
Linux Kernel
arch/x86/kernel/uprobes.c
int arch_uprobe_exception_notify(struct notifier_block *self, unsigned long val, void *data) { struct die_args *args = data; struct pt_regs *regs = args->regs; int ret = NOTIFY_DONE; if (regs && !user_mode(regs)) return NOTIFY_DONE; switch (val) { case DIE_INT3: if...
[ 0, 0 ]
Linux Kernel
arch/x86/kernel/uprobes.c
static bool __skip_sstep(struct arch_uprobe *auprobe, struct pt_regs *regs) { if (auprobe->ops->emulate) return auprobe->ops->emulate(auprobe, regs); return false; }
[ 0, 0 ]
Linux Kernel
arch/x86/kernel/vm86_32.c
static inline void clear_IF(struct kernel_vm86_regs *regs) { VEFLAGS &= ~X86_EFLAGS_VIF; }
[ 0, 0 ]
Linux Kernel
arch/x86/kernel/vm86_32.c
static inline void clear_TF(struct kernel_vm86_regs *regs) { regs->pt.flags &= ~X86_EFLAGS_TF; }
[ 0, 0 ]
Linux Kernel
arch/x86/kernel/vm86_32.c
static inline void free_vm86_irq(int irqnumber) { unsigned long flags; free_irq(irqnumber, NULL); vm86_irqs[irqnumber].tsk = NULL; spin_lock_irqsave(&irqbits_lock, flags); irqbits &= ~(1 << irqnumber); spin_unlock_irqrestore(&irqbits_lock, flags); }
[ 0, 0 ]
Linux Kernel
arch/x86/kernel/vm86_32.c
void release_vm86_irqs(struct task_struct *task) { int i; for (i = FIRST_VM86_IRQ; i <= LAST_VM86_IRQ; i++) if (vm86_irqs[i].tsk == task) free_vm86_irq(i); }
[ 0, 0 ]
Linux Kernel
arch/x86/kernel/vm86_32.c
static int do_vm86_irq_handling(int subfunction, int irqnumber) { int ret; switch (subfunction) { case VM86_GET_AND_RESET_IRQ: { return get_and_reset_irq(irqnumber); } case VM86_GET_IRQ_BITS: { return irqbits; } case VM86_REQUEST_IRQ: { int sig = irqnumber >> 8; int irq = irqnumber & 255...
[ 1, 0 ]
Linux Kernel
arch/x86/kernel/vsmp_64.c
static void __init set_vsmp_ctl(void) {} #endif
[ 0, 0 ]
Linux Kernel
arch/x86/kernel/vsmp_64.c
static void __init vsmp_cap_cpus(void) { #if !defined(CONFIG_X86_VSMP) && defined(CONFIG_SMP) && defined(CONFIG_PCI) void __iomem *address; unsigned int cfg, topology, node_shift, maxcpus; if (setup_max_cpus != NR_CPUS) return; /* Read the vSMP Foundation topology register */ cfg = read_pci_config(0, 0x...
[ 1, 0 ]
Linux Kernel
arch/x86/kernel/vsmp_64.c
static void vsmp_apic_post_init(void) { apic->phys_pkg_id = apicid_phys_pkg_id; }
[ 0, 0 ]
Linux Kernel
arch/x86/kernel/x86_init.c
static bool enc_status_change_finish_noop(unsigned long vaddr, int npages, bool enc) { return false; }
[ 0, 0 ]
Linux Kernel
arch/x86/kernel/x86_init.c
static bool enc_tlb_flush_required_noop(bool enc) { return false; }
[ 0, 0 ]
Linux Kernel
arch/x86/kernel/x86_init.c
static bool enc_cache_flush_required_noop(void) { return false; }
[ 0, 0 ]
Linux Kernel
arch/x86/kvm/cpuid.c
static struct kvm_cpuid_entry2 * __kvm_find_kvm_cpuid_features(struct kvm_vcpu *vcpu, struct kvm_cpuid_entry2 *entries, int nent) { u32 base = vcpu->arch.kvm_cpuid_base; if (!base) return NULL; return cpuid_entry2_find(entries, nent, base | KVM_CPUID_FEATURES, ...
[ 0, 0 ]
Linux Kernel
arch/x86/kvm/cpuid.c
int kvm_vcpu_ioctl_set_cpuid2(struct kvm_vcpu *vcpu, struct kvm_cpuid2 *cpuid, struct kvm_cpuid_entry2 __user *entries) { struct kvm_cpuid_entry2 *e2 = NULL; int r; if (cpuid->nent > KVM_MAX_CPUID_ENTRIES) return -E2BIG; if (cpuid->nent) { e2 = vmemdup_user(entries, arra...
[ 0, 0 ]
Linux Kernel
arch/x86/kvm/cpuid.c
static __always_inline void kvm_cpu_cap_init_scattered(enum kvm_only_cpuid_leafs leaf, u32 mask) { BUILD_BUG_ON(leaf < NCAPINTS); kvm_cpu_caps[leaf] = mask; __kvm_cpu_cap_mask(leaf); }
[ 0, 0 ]
Linux Kernel
arch/x86/kvm/cpuid.c
static bool sanity_check_entries(struct kvm_cpuid_entry2 __user *entries, __u32 num_entries, unsigned int ioctl_type) { int i; __u32 pad[3]; if (ioctl_type != KVM_GET_EMULATED_CPUID) return false; for (i = 0; i < num_entries; i++) { if (copy_from_user(pad, entries[i].p...
[ 1, 0 ]
Linux Kernel
arch/x86/kvm/cpuid.c
int kvm_dev_ioctl_get_cpuid(struct kvm_cpuid2 *cpuid, struct kvm_cpuid_entry2 __user *entries, unsigned int type) { static const u32 funcs[] = { 0, 0x80000000, CENTAUR_CPUID_SIGNATURE, KVM_CPUID_SIGNATURE, }; struct kvm_cpuid_array ...
[ 1, 0 ]
Linux Kernel
arch/x86/kvm/cpuid.c
struct kvm_cpuid_entry2 *kvm_find_cpuid_entry_index(struct kvm_vcpu *vcpu, u32 function, u32 index) { return cpuid_entry2_find(vcpu->arch.cpuid_entries, vcpu->arch.cpuid_nent, function, index); }
[ 0, 0 ]
Linux Kernel
arch/x86/kvm/cpuid.c
struct kvm_cpuid_entry2 *kvm_find_cpuid_entry(struct kvm_vcpu *vcpu, u32 function) { return cpuid_entry2_find(vcpu->arch.cpuid_entries, vcpu->arch.cpuid_nent, function, KVM_CPUID_INDEX_NOT_SIGNIFICANT); }
[ 0, 0 ]
Linux Kernel
arch/x86/kvm/cpuid.h
static inline bool kvm_vcpu_is_legal_aligned_gpa(struct kvm_vcpu *vcpu, gpa_t gpa, gpa_t alignment) { return IS_ALIGNED(gpa, alignment) && kvm_vcpu_is_legal_gpa(vcpu, gpa); }
[ 0, 0 ]
Linux Kernel
arch/x86/kvm/cpuid.h
static inline bool page_address_valid(struct kvm_vcpu *vcpu, gpa_t gpa) { return kvm_vcpu_is_legal_aligned_gpa(vcpu, gpa, PAGE_SIZE); }
[ 0, 0 ]
Linux Kernel
arch/x86/kvm/cpuid.h
static inline bool guest_cpuid_is_amd_or_hygon(struct kvm_vcpu *vcpu) { struct kvm_cpuid_entry2 *best; best = kvm_find_cpuid_entry(vcpu, 0); return best && (is_guest_vendor_amd(best->ebx, best->ecx, best->edx) || is_guest_vendor_hygon(best->ebx, best->ecx, best->edx)); }
[ 1, 0 ]
Linux Kernel
arch/x86/kvm/cpuid.h
static inline bool guest_cpuid_is_intel(struct kvm_vcpu *vcpu) { struct kvm_cpuid_entry2 *best; best = kvm_find_cpuid_entry(vcpu, 0); return best && is_guest_vendor_intel(best->ebx, best->ecx, best->edx); }
[ 1, 0 ]
Linux Kernel
arch/x86/kvm/cpuid.h
static inline bool guest_has_spec_ctrl_msr(struct kvm_vcpu *vcpu) { return (guest_cpuid_has(vcpu, X86_FEATURE_SPEC_CTRL) || guest_cpuid_has(vcpu, X86_FEATURE_AMD_STIBP) || guest_cpuid_has(vcpu, X86_FEATURE_AMD_IBRS) || guest_cpuid_has(vcpu, X86_FEATURE_AMD_SSBD)); }
[ 0, 0 ]
Linux Kernel
arch/x86/kvm/debugfs.c
void kvm_arch_create_vcpu_debugfs(struct kvm_vcpu *vcpu, struct dentry *debugfs_dentry) { debugfs_create_file("guest_mode", 0444, debugfs_dentry, vcpu, &vcpu_guest_mode_fops); debugfs_create_file("tsc-offset", 0444, debugfs_dentry, vcpu, ...
[ 0, 0 ]
Linux Kernel
arch/x86/kvm/debugfs.c
static int kvm_mmu_rmaps_stat_release(struct inode *inode, struct file *file) { struct kvm *kvm = inode->i_private; kvm_put_kvm(kvm); return single_release(inode, file); }
[ 0, 0 ]
Linux Kernel
arch/x86/kvm/emulate.c
static ulong reg_read(struct x86_emulate_ctxt *ctxt, unsigned nr) { if (KVM_EMULATOR_BUG_ON(nr >= NR_EMULATOR_GPRS, ctxt)) nr &= NR_EMULATOR_GPRS - 1; if (!(ctxt->regs_valid & (1 << nr))) { ctxt->regs_valid |= 1 << nr; ctxt->_regs[nr] = ctxt->ops->read_gpr(ctxt, nr); } return ctxt->_regs[nr]; }
[ 0, 0 ]
Linux Kernel
arch/x86/kvm/emulate.c
static ulong *reg_write(struct x86_emulate_ctxt *ctxt, unsigned nr) { if (KVM_EMULATOR_BUG_ON(nr >= NR_EMULATOR_GPRS, ctxt)) nr &= NR_EMULATOR_GPRS - 1; BUILD_BUG_ON(sizeof(ctxt->regs_dirty) * BITS_PER_BYTE < NR_EMULATOR_GPRS); BUILD_BUG_ON(sizeof(ctxt->regs_valid) * BITS_PER_BYTE < NR_EMULATOR_GPRS); ct...
[ 0, 0 ]
Linux Kernel
arch/x86/kvm/emulate.c
static void invalidate_registers(struct x86_emulate_ctxt *ctxt) { ctxt->regs_dirty = 0; ctxt->regs_valid = 0; } #define EFLAGS_MASK \ (X86_EFLAGS_OF | X86_EFLAGS_SF | X86_EFLAGS_ZF | X86_EFLAGS_AF | \ X86_EFLAGS_PF | X86_EFLAGS_CF) #ifdef...
[ 0, 0 ]
Linux Kernel
arch/x86/kvm/emulate.c
static void assign_register(unsigned long *reg, u64 val, int bytes) { switch (bytes) { case 1: *(u8 *)reg = (u8)val; break; case 2: *(u16 *)reg = (u16)val; break; case 4: *reg = (u32)val; break; /* 64b: zero-extend */ case 8: *reg = val; break; } }
[ 1, 0 ]
Linux Kernel
arch/x86/kvm/emulate.c
static inline unsigned long ad_mask(struct x86_emulate_ctxt *ctxt) { return (1UL << (ctxt->ad_bytes << 3)) - 1; }
[ 1, 0 ]
Linux Kernel
arch/x86/kvm/emulate.c
static inline void register_address_increment(struct x86_emulate_ctxt *ctxt, int reg, int inc) { ulong *preg = reg_rmw(ctxt, reg); assign_register(preg, *preg + inc, ctxt->ad_bytes); }
[ 0, 0 ]
Linux Kernel
arch/x86/kvm/emulate.c
static u32 desc_limit_scaled(struct desc_struct *desc) { u32 limit = get_desc_limit(desc); return desc->g ? (limit << 12) | 0xfff : limit; }
[ 0, 0 ]
Linux Kernel
arch/x86/kvm/emulate.c
static u16 get_segment_selector(struct x86_emulate_ctxt *ctxt, unsigned seg) { u16 selector; struct desc_struct desc; ctxt->ops->get_segment(ctxt, &selector, &desc, NULL, seg); return selector; }
[ 0, 0 ]
Linux Kernel
arch/x86/kvm/emulate.c
static inline int assign_eip_near(struct x86_emulate_ctxt *ctxt, ulong dst) { return assign_eip(ctxt, dst); }
[ 0, 0 ]
Linux Kernel
arch/x86/kvm/emulate.c
static int assign_eip_far(struct x86_emulate_ctxt *ctxt, ulong dst) { int rc = emulator_recalc_and_set_mode(ctxt); if (rc != X86EMUL_CONTINUE) return rc; return assign_eip(ctxt, dst); }
[ 0, 0 ]
Linux Kernel
arch/x86/kvm/emulate.c
static int linear_write_system(struct x86_emulate_ctxt *ctxt, ulong linear, void *data, unsigned int size) { return ctxt->ops->write_std(ctxt, linear, data, size, &ctxt->exception, true); }
[ 0, 0 ]
Linux Kernel
arch/x86/kvm/emulate.c
static void *decode_register(struct x86_emulate_ctxt *ctxt, u8 modrm_reg, int byteop) { void *p; int highbyte_regs = (ctxt->rex_prefix == 0) && byteop; if (highbyte_regs && modrm_reg >= 4 && modrm_reg < 8) p = (unsigned char *)reg_rmw(ctxt, modrm_reg & 3) + 1; else p = reg_...
[ 1, 0 ]
Linux Kernel
arch/x86/kvm/emulate.c
static void decode_register_operand(struct x86_emulate_ctxt *ctxt, struct operand *op) { unsigned int reg; if (ctxt->d & ModRM) reg = ctxt->modrm_reg; else reg = (ctxt->b & 7) | ((ctxt->rex_prefix & 1) << 3); if (ctxt->d & Sse) { op->type = OP_XMM; op->byte...
[ 1, 0 ]
Linux Kernel
arch/x86/kvm/emulate.c
static int decode_abs(struct x86_emulate_ctxt *ctxt, struct operand *op) { int rc = X86EMUL_CONTINUE; op->type = OP_MEM; switch (ctxt->ad_bytes) { case 2: op->addr.mem.ea = insn_fetch(u16, ctxt); break; case 4: op->addr.mem.ea = insn_fetch(u32, ctxt); break; case 8: op->addr.mem.ea = i...
[ 1, 0 ]
Linux Kernel
arch/x86/kvm/emulate.c
static int segmented_cmpxchg(struct x86_emulate_ctxt *ctxt, struct segmented_address addr, const void *orig_data, const void *data, unsigned size) { int rc; ulong linear; rc = linearize(ctxt, addr, size, true, &linear); if ...
[ 0, 0 ]
Linux Kernel
arch/x86/kvm/emulate.c
static int read_interrupt_descriptor(struct x86_emulate_ctxt *ctxt, u16 index, struct desc_struct *desc) { struct desc_ptr dt; ulong addr; ctxt->ops->get_idt(ctxt, &dt); if (dt.size < index * 8 + 7) return emulate_gp(ctxt, index << 3 | 0x2); addr = dt.address + ind...
[ 1, 0 ]
Linux Kernel
arch/x86/kvm/emulate.c
static int writeback(struct x86_emulate_ctxt *ctxt, struct operand *op) { switch (op->type) { case OP_REG: write_register_operand(op); break; case OP_MEM: if (ctxt->lock_prefix) return segmented_cmpxchg(ctxt, op->addr.mem, &op->orig_val, &op->val, op->bytes); e...
[ 0, 0 ]
Linux Kernel
arch/x86/kvm/emulate.c
static int emulate_popf(struct x86_emulate_ctxt *ctxt, void *dest, int len) { int rc; unsigned long val, change_mask; int iopl = (ctxt->eflags & X86_EFLAGS_IOPL) >> X86_EFLAGS_IOPL_BIT; int cpl = ctxt->ops->cpl(ctxt); rc = emulate_pop(ctxt, &val, len); if (rc != X86EMUL_CONTINUE) return rc; change_m...
[ 1, 0 ]
Linux Kernel
arch/x86/kvm/emulate.c
static int em_enter(struct x86_emulate_ctxt *ctxt) { int rc; unsigned frame_size = ctxt->src.val; unsigned nesting_level = ctxt->src2.val & 31; ulong rbp; if (nesting_level) return X86EMUL_UNHANDLEABLE; rbp = reg_read(ctxt, VCPU_REGS_RBP); rc = push(ctxt, &rbp, stack_size(ctxt)); if (rc != X86EMU...
[ 1, 0 ]
Linux Kernel
arch/x86/kvm/emulate.c
static int em_push_sreg(struct x86_emulate_ctxt *ctxt) { int seg = ctxt->src2.val; ctxt->src.val = get_segment_selector(ctxt, seg); if (ctxt->op_bytes == 4) { rsp_increment(ctxt, -2); ctxt->op_bytes = 2; } return em_push(ctxt); }
[ 0, 0 ]
Linux Kernel
arch/x86/kvm/emulate.c
static int em_pusha(struct x86_emulate_ctxt *ctxt) { unsigned long old_esp = reg_read(ctxt, VCPU_REGS_RSP); int rc = X86EMUL_CONTINUE; int reg = VCPU_REGS_RAX; while (reg <= VCPU_REGS_RDI) { (reg == VCPU_REGS_RSP) ? (ctxt->src.val = old_esp) : (ctxt->src.val = reg_read(ctxt, reg...
[ 1, 0 ]
Linux Kernel
arch/x86/kvm/emulate.c
static int emulate_iret_real(struct x86_emulate_ctxt *ctxt) { int rc = X86EMUL_CONTINUE; unsigned long temp_eip = 0; unsigned long temp_eflags = 0; unsigned long cs = 0; unsigned long mask = X86_EFLAGS_CF | X86_EFLAGS_PF | X86_EFLAGS_AF | X86_EFLAGS_ZF | X86_EFLAGS_SF | X86_EFLAGS_TF | ...
[ 1, 1 ]
Linux Kernel
arch/x86/kvm/emulate.c
static int em_jmp_far(struct x86_emulate_ctxt *ctxt) { int rc; unsigned short sel; struct desc_struct new_desc; u8 cpl = ctxt->ops->cpl(ctxt); memcpy(&sel, ctxt->src.valptr + ctxt->op_bytes, 2); rc = __load_segment_descriptor(ctxt, sel, VCPU_SREG_CS, cpl, X86_TRANSFER_CALL...
[ 1, 0 ]
Linux Kernel
arch/x86/kvm/emulate.c
static int em_jmp_abs(struct x86_emulate_ctxt *ctxt) { return assign_eip_near(ctxt, ctxt->src.val); }
[ 0, 0 ]
Linux Kernel
arch/x86/kvm/emulate.c
static int em_call_near_abs(struct x86_emulate_ctxt *ctxt) { int rc; long int old_eip; old_eip = ctxt->_eip; rc = assign_eip_near(ctxt, ctxt->src.val); if (rc != X86EMUL_CONTINUE) return rc; ctxt->src.val = old_eip; rc = em_push(ctxt); return rc; }
[ 0, 0 ]
Linux Kernel
arch/x86/kvm/emulate.c
static int em_ret_far(struct x86_emulate_ctxt *ctxt) { int rc; unsigned long eip, cs; int cpl = ctxt->ops->cpl(ctxt); struct desc_struct new_desc; rc = emulate_pop(ctxt, &eip, ctxt->op_bytes); if (rc != X86EMUL_CONTINUE) return rc; rc = emulate_pop(ctxt, &cs, ctxt->op_bytes); if (rc != X86EMUL_CONT...
[ 0, 0 ]
Linux Kernel
arch/x86/kvm/emulate.c
static int em_ret_far_imm(struct x86_emulate_ctxt *ctxt) { int rc; rc = em_ret_far(ctxt); if (rc != X86EMUL_CONTINUE) return rc; rsp_increment(ctxt, ctxt->src.val); return X86EMUL_CONTINUE; }
[ 0, 0 ]
Linux Kernel
arch/x86/kvm/emulate.c
static void rsm_set_desc_flags(struct desc_struct *desc, u32 flags) { desc->g = (flags >> 23) & 1; desc->d = (flags >> 22) & 1; desc->l = (flags >> 21) & 1; desc->avl = (flags >> 20) & 1; desc->p = (flags >> 15) & 1; desc->dpl = (flags >> 13) & 3; desc->s = (flags >> 12) & 1; desc->type = (flags >> 8) ...
[ 0, 0 ]
Linux Kernel
arch/x86/kvm/emulate.c
static int task_switch_32(struct x86_emulate_ctxt *ctxt, u16 old_tss_sel, ulong old_tss_base, struct desc_struct *new_desc) { struct tss_segment_32 tss_seg; int ret; u32 new_tss_base = get_desc_base(new_desc); u32 eip_offset = offsetof(struct tss_segment_32, eip); u32 ldt_sel_offset ...
[ 1, 0 ]
Linux Kernel
arch/x86/kvm/emulate.c
int emulator_task_switch(struct x86_emulate_ctxt *ctxt, u16 tss_selector, int idt_index, int reason, bool has_error_code, u32 error_code) { int rc; invalidate_registers(ctxt); ctxt->_eip = ctxt->eip; ctxt->dst.type = OP_NONE; rc = emulator_do_task_switch(ct...
[ 0, 0 ]
Linux Kernel
arch/x86/kvm/emulate.c
static int em_aad(struct x86_emulate_ctxt *ctxt) { u8 al = ctxt->dst.val & 0xff; u8 ah = (ctxt->dst.val >> 8) & 0xff; al = (al + (ah * ctxt->src.val)) & 0xff; ctxt->dst.val = (ctxt->dst.val & 0xffff0000) | al; ctxt->src.type = OP_IMM; ctxt->src.val = 0; ctxt->src.bytes = 1; fastop(ctxt, em_or); re...
[ 1, 0 ]
Linux Kernel
arch/x86/kvm/emulate.c
static int em_call(struct x86_emulate_ctxt *ctxt) { int rc; long rel = ctxt->src.val; ctxt->src.val = (unsigned long)ctxt->_eip; rc = jmp_rel(ctxt, rel); if (rc != X86EMUL_CONTINUE) return rc; return em_push(ctxt); }
[ 0, 0 ]
Linux Kernel
arch/x86/kvm/emulate.c
static int em_rdpid(struct x86_emulate_ctxt *ctxt) { u64 tsc_aux = 0; if (!ctxt->ops->guest_has_rdpid(ctxt)) return emulate_ud(ctxt); ctxt->ops->get_msr(ctxt, MSR_TSC_AUX, &tsc_aux); ctxt->dst.val = tsc_aux; return X86EMUL_CONTINUE; }
[ 1, 0 ]
Linux Kernel
arch/x86/kvm/emulate.c
static int em_cr_write(struct x86_emulate_ctxt *ctxt) { int cr_num = ctxt->modrm_reg; int r; if (ctxt->ops->set_cr(ctxt, cr_num, ctxt->src.val)) return emulate_gp(ctxt, 0); ctxt->dst.type = OP_NONE; if (cr_num == 0) { /* * CR0 write might have updated CR0.PE and/or CR0.PG * which can affe...
[ 0, 0 ]
Linux Kernel
arch/x86/kvm/emulate.c
static int em_dr_write(struct x86_emulate_ctxt *ctxt) { unsigned long val; if (ctxt->mode == X86EMUL_MODE_PROT64) val = ctxt->src.val & ~0ULL; else val = ctxt->src.val & ~0U; if (ctxt->ops->set_dr(ctxt, ctxt->modrm_reg, val) < 0) return emulate_gp(ctxt, 0); /* Disable writeback. */ ctxt->dst....
[ 0, 0 ]
Linux Kernel
arch/x86/kvm/emulate.c
static int em_sldt(struct x86_emulate_ctxt *ctxt) { return em_store_sreg(ctxt, VCPU_SREG_LDTR); }
[ 0, 0 ]
Linux Kernel
arch/x86/kvm/emulate.c
static int em_ltr(struct x86_emulate_ctxt *ctxt) { u16 sel = ctxt->src.val; ctxt->dst.type = OP_NONE; return load_segment_descriptor(ctxt, sel, VCPU_SREG_TR); }
[ 0, 0 ]
Linux Kernel
arch/x86/kvm/emulate.c
static int em_clts(struct x86_emulate_ctxt *ctxt) { ulong cr0; cr0 = ctxt->ops->get_cr(ctxt, 0); cr0 &= ~X86_CR0_TS; ctxt->ops->set_cr(ctxt, 0, cr0); return X86EMUL_CONTINUE; }
[ 0, 0 ]
Linux Kernel
arch/x86/kvm/emulate.c
static int emulate_store_desc_ptr(struct x86_emulate_ctxt *ctxt, void (*get)(struct x86_emulate_ctxt *ctxt, struct desc_ptr *ptr)) { struct desc_ptr desc_ptr; if ((ctxt->ops->get_cr(ctxt, 4) & X86_CR4_UMIP) && ctxt->ops->cpl(ctxt) > 0)...
[ 1, 0 ]
Linux Kernel
arch/x86/kvm/emulate.c
static int em_lidt(struct x86_emulate_ctxt *ctxt) { return em_lgdt_lidt(ctxt, false); }
[ 0, 0 ]
Linux Kernel
arch/x86/kvm/emulate.c
static int em_jcxz(struct x86_emulate_ctxt *ctxt) { int rc = X86EMUL_CONTINUE; if (address_mask(ctxt, reg_read(ctxt, VCPU_REGS_RCX)) == 0) rc = jmp_rel(ctxt, ctxt->src.val); return rc; }
[ 0, 0 ]
Linux Kernel
arch/x86/kvm/emulate.c
static int em_sti(struct x86_emulate_ctxt *ctxt) { if (emulator_bad_iopl(ctxt)) return emulate_gp(ctxt, 0); ctxt->interruptibility = KVM_X86_SHADOW_INT_STI; ctxt->eflags |= X86_EFLAGS_IF; return X86EMUL_CONTINUE; }
[ 0, 0 ]
Linux Kernel
arch/x86/kvm/emulate.c
static int em_clflush(struct x86_emulate_ctxt *ctxt) { return X86EMUL_CONTINUE; }
[ 0, 0 ]
Linux Kernel
arch/x86/kvm/emulate.c
static int em_clflushopt(struct x86_emulate_ctxt *ctxt) { return X86EMUL_CONTINUE; }
[ 0, 0 ]
Linux Kernel
arch/x86/kvm/emulate.c
static int em_fxsave(struct x86_emulate_ctxt *ctxt) { struct fxregs_state fx_state; int rc; rc = check_fxsr(ctxt); if (rc != X86EMUL_CONTINUE) return rc; kvm_fpu_get(); rc = asm_safe("fxsave %[fx]", , [fx] "+m"(fx_state)); kvm_fpu_put(); if (rc != X86EMUL_CONTINUE) return rc; return segm...
[ 0, 0 ]
Linux Kernel
arch/x86/kvm/emulate.c
static int em_xsetbv(struct x86_emulate_ctxt *ctxt) { u32 eax, ecx, edx; if (!(ctxt->ops->get_cr(ctxt, 4) & X86_CR4_OSXSAVE)) return emulate_ud(ctxt); eax = reg_read(ctxt, VCPU_REGS_RAX); edx = reg_read(ctxt, VCPU_REGS_RDX); ecx = reg_read(ctxt, VCPU_REGS_RCX); if (ctxt->ops->set_xcr(ctxt, ecx, ((u6...
[ 0, 0 ]
Linux Kernel
arch/x86/kvm/emulate.c
static int check_dr_read(struct x86_emulate_ctxt *ctxt) { int dr = ctxt->modrm_reg; u64 cr4; if (dr > 7) return emulate_ud(ctxt); cr4 = ctxt->ops->get_cr(ctxt, 4); if ((cr4 & X86_CR4_DE) && (dr == 4 || dr == 5)) return emulate_ud(ctxt); if (check_dr7_gd(ctxt)) { ulong dr6; ctxt->ops->ge...
[ 0, 0 ]
Linux Kernel
arch/x86/kvm/emulate.c
static int check_rdtsc(struct x86_emulate_ctxt *ctxt) { u64 cr4 = ctxt->ops->get_cr(ctxt, 4); if (cr4 & X86_CR4_TSD && ctxt->ops->cpl(ctxt)) return emulate_gp(ctxt, 0); return X86EMUL_CONTINUE; }
[ 1, 0 ]
Linux Kernel
arch/x86/kvm/emulate.c
static int decode_imm(struct x86_emulate_ctxt *ctxt, struct operand *op, unsigned size, bool sign_extension) { int rc = X86EMUL_CONTINUE; op->type = OP_IMM; op->bytes = size; op->addr.mem.ea = ctxt->_eip; switch (op->bytes) { case 1: op->val = insn_fetch(s8, ctxt); break; c...
[ 1, 0 ]
Linux Kernel
arch/x86/kvm/emulate.c
static void fetch_possible_mmx_operand(struct operand *op) { if (op->type == OP_MM) kvm_read_mmx_reg(op->addr.mm, &op->mm_val); }
[ 0, 0 ]
Linux Kernel
arch/x86/kvm/emulate.c
static int fastop(struct x86_emulate_ctxt *ctxt, fastop_t fop) { ulong flags = (ctxt->eflags & EFLAGS_MASK) | X86_EFLAGS_IF; if (!(ctxt->d & ByteOp)) fop += __ffs(ctxt->dst.bytes) * FASTOP_SIZE; asm("push %[flags]; popf; " CALL_NOSPEC " ; pushf; pop %[flags]\n" : "+a"(ctxt->dst.val), "+d"(ctxt...
[ 0, 0 ]
Linux Kernel
arch/x86/kvm/fpu.h
static inline void _kvm_read_mmx_reg(int reg, u64 *data) { switch (reg) { case 0: asm("movq %%mm0, %0" : "=m"(*data)); break; case 1: asm("movq %%mm1, %0" : "=m"(*data)); break; case 2: asm("movq %%mm2, %0" : "=m"(*data)); break; case 3: asm("movq %%mm3, %0" : "=m"(*data)); br...
[ 0, 0 ]
Linux Kernel
arch/x86/kvm/fpu.h
static inline void kvm_write_sse_reg(int reg, const sse128_t *data) { kvm_fpu_get(); _kvm_write_sse_reg(reg, data); kvm_fpu_put(); }
[ 0, 0 ]
Linux Kernel
arch/x86/kvm/hyperv.c
static bool kvm_hv_is_syndbg_enabled(struct kvm_vcpu *vcpu) { struct kvm_vcpu_hv *hv_vcpu = to_hv_vcpu(vcpu); return hv_vcpu->cpuid_cache.syndbg_cap_eax & HV_X64_SYNDBG_CAP_ALLOW_KERNEL_DEBUGGING; }
[ 0, 0 ]
Linux Kernel
arch/x86/kvm/hyperv.c
static int kvm_hv_syndbg_complete_userspace(struct kvm_vcpu *vcpu) { struct kvm_hv *hv = to_kvm_hv(vcpu->kvm); if (vcpu->run->hyperv.u.syndbg.msr == HV_X64_MSR_SYNDBG_CONTROL) hv->hv_syndbg.control.status = vcpu->run->hyperv.u.syndbg.status; return 1; }
[ 1, 0 ]
Linux Kernel
arch/x86/kvm/hyperv.c
static void syndbg_exit(struct kvm_vcpu *vcpu, u32 msr) { struct kvm_hv_syndbg *syndbg = to_hv_syndbg(vcpu); struct kvm_vcpu_hv *hv_vcpu = to_hv_vcpu(vcpu); hv_vcpu->exit.type = KVM_EXIT_HYPERV_SYNDBG; hv_vcpu->exit.u.syndbg.msr = msr; hv_vcpu->exit.u.syndbg.control = syndbg->control.control; hv_vcpu->exi...
[ 0, 0 ]
Linux Kernel
arch/x86/kvm/hyperv.c
static int synic_get_msr(struct kvm_vcpu_hv_synic *synic, u32 msr, u64 *pdata, bool host) { int ret; if (!synic->active && !host) return 1; ret = 0; switch (msr) { case HV_X64_MSR_SCONTROL: *pdata = synic->control; break; case HV_X64_MSR_SVERSION: *pdata = synic->...
[ 0, 0 ]
Linux Kernel
arch/x86/kvm/hyperv.c
static int synic_set_irq(struct kvm_vcpu_hv_synic *synic, u32 sint) { struct kvm_vcpu *vcpu = hv_synic_to_vcpu(synic); struct kvm_lapic_irq irq; int ret, vector; if (KVM_BUG_ON(!lapic_in_kernel(vcpu), vcpu->kvm)) return -EINVAL; if (sint >= ARRAY_SIZE(synic->sint)) return -EINVAL; vector = synic...
[ 1, 0 ]
Linux Kernel
arch/x86/kvm/hyperv.c
int kvm_hv_synic_set_irq(struct kvm *kvm, u32 vpidx, u32 sint) { struct kvm_vcpu_hv_synic *synic; synic = synic_get(kvm, vpidx); if (!synic) return -EINVAL; return synic_set_irq(synic, sint); }
[ 0, 0 ]
Linux Kernel
arch/x86/kvm/hyperv.c
static void synic_init(struct kvm_vcpu_hv_synic *synic) { int i; memset(synic, 0, sizeof(*synic)); synic->version = HV_SYNIC_VERSION_1; for (i = 0; i < ARRAY_SIZE(synic->sint); i++) { atomic64_set(&synic->sint[i], HV_SYNIC_SINT_MASKED); atomic_set(&synic->sint_to_gsi[i], -1); } }
[ 1, 0 ]
Linux Kernel
arch/x86/kvm/hyperv.c
static int stimer_set_count(struct kvm_vcpu_hv_stimer *stimer, u64 count, bool host) { struct kvm_vcpu *vcpu = hv_stimer_to_vcpu(stimer); struct kvm_vcpu_hv_synic *synic = to_hv_synic(vcpu); if (!synic->active && (!host || count)) return 1; trace_kvm_hv_stimer_set_count(hv_sti...
[ 1, 0 ]
Linux Kernel
arch/x86/kvm/hyperv.c
static int stimer_get_config(struct kvm_vcpu_hv_stimer *stimer, u64 *pconfig) { *pconfig = stimer->config.as_uint64; return 0; }
[ 0, 0 ]
Linux Kernel
arch/x86/kvm/hyperv.c
static int stimer_send_msg(struct kvm_vcpu_hv_stimer *stimer) { struct kvm_vcpu *vcpu = hv_stimer_to_vcpu(stimer); struct hv_message *msg = &stimer->msg; struct hv_timer_message_payload *payload = (struct hv_timer_message_payload *)&msg->u.payload; bool no_retry = stimer->config.periodic; payload->exp...
[ 0, 0 ]
Linux Kernel
arch/x86/kvm/hyperv.c
void kvm_hv_vcpu_uninit(struct kvm_vcpu *vcpu) { struct kvm_vcpu_hv *hv_vcpu = to_hv_vcpu(vcpu); int i; if (!hv_vcpu) return; for (i = 0; i < ARRAY_SIZE(hv_vcpu->stimer); i++) stimer_cleanup(&hv_vcpu->stimer[i]); kfree(hv_vcpu); vcpu->arch.hyperv = NULL; }
[ 0, 0 ]
Linux Kernel
arch/x86/kvm/hyperv.c
bool kvm_hv_get_assist_page(struct kvm_vcpu *vcpu, struct hv_vp_assist_page *assist_page) { if (!kvm_hv_assist_page_enabled(vcpu)) return false; return !kvm_read_guest_cached(vcpu->kvm, &vcpu->arch.pv_eoi.data, assist_page, sizeof(*assist_page)); }
[ 1, 0 ]
Linux Kernel
arch/x86/kvm/hyperv.c
static int kvm_hv_msr_set_crash_data(struct kvm *kvm, u32 index, u64 data) { struct kvm_hv *hv = to_kvm_hv(kvm); size_t size = ARRAY_SIZE(hv->hv_crash_param); if (WARN_ON_ONCE(index >= size)) return -EINVAL; hv->hv_crash_param[array_index_nospec(index, size)] = data; return 0; }
[ 0, 0 ]
Linux Kernel
arch/x86/kvm/hyperv.c
static u64 kvm_get_sparse_vp_set(struct kvm *kvm, struct kvm_hv_hcall *hc, int consumed_xmm_halves, u64 *sparse_banks, gpa_t offset) { u16 var_cnt; int i; if (hc->var_cnt > 64) return -EINVAL; var_cnt = min_t(u16, hc->var_cnt, KVM_HV_MAX_SP...
[ 1, 0 ]