1 #ifndef ASM_KVM_CACHE_REGS_H
2 #define ASM_KVM_CACHE_REGS_H
4 static inline unsigned long kvm_register_read(struct kvm_vcpu
*vcpu
,
7 if (!test_bit(reg
, (unsigned long *)&vcpu
->arch
.regs_avail
))
8 kvm_x86_ops
->cache_reg(vcpu
, reg
);
10 return vcpu
->arch
.regs
[reg
];
13 static inline void kvm_register_write(struct kvm_vcpu
*vcpu
,
17 vcpu
->arch
.regs
[reg
] = val
;
18 __set_bit(reg
, (unsigned long *)&vcpu
->arch
.regs_dirty
);
19 __set_bit(reg
, (unsigned long *)&vcpu
->arch
.regs_avail
);
22 static inline unsigned long kvm_rip_read(struct kvm_vcpu
*vcpu
)
24 return kvm_register_read(vcpu
, VCPU_REGS_RIP
);
27 static inline void kvm_rip_write(struct kvm_vcpu
*vcpu
, unsigned long val
)
29 kvm_register_write(vcpu
, VCPU_REGS_RIP
, val
);
32 static inline u64
kvm_pdptr_read(struct kvm_vcpu
*vcpu
, int index
)
34 if (!test_bit(VCPU_EXREG_PDPTR
,
35 (unsigned long *)&vcpu
->arch
.regs_avail
))
36 kvm_x86_ops
->cache_reg(vcpu
, VCPU_EXREG_PDPTR
);
38 return vcpu
->arch
.pdptrs
[index
];