📄 vmx_virt.c
字号:
}static IA64FAULT vmx_emul_mov_to_ar_reg(VCPU *vcpu, INST64 inst){ // I26 and M29 are identical for these fields u64 r2; if(inst.M29.ar3!=44){ panic_domain(vcpu_regs(vcpu),"Can't support ar register other than itc"); } if(vcpu_get_gr_nat(vcpu,inst.M29.r2,&r2)){#ifdef CHECK_FAULT set_isr_reg_nat_consumption(vcpu,0,0); rnat_comsumption(vcpu); return IA64_FAULT;#endif //CHECK_FAULT }#ifdef CHECK_FAULT IA64_PSR vpsr; vpsr.val=vmx_vcpu_get_psr(vcpu); if ( vpsr.cpl != 0) { /* Inject Privileged Operation fault into guest */ set_privileged_operation_isr (vcpu, 0); privilege_op (vcpu); return IA64_FAULT; }#endif // CHECK_FAULT return (vmx_vcpu_set_itc(vcpu, r2));}static IA64FAULT vmx_emul_mov_from_ar_reg(VCPU *vcpu, INST64 inst){ // I27 and M30 are identical for these fields u64 r1; if(inst.M31.ar3!=44){ panic_domain(vcpu_regs(vcpu),"Can't support ar register other than itc"); }#ifdef CHECK_FAULT if(check_target_register(vcpu,inst.M31.r1)){ set_illegal_op_isr(vcpu); illegal_op(vcpu); return IA64_FAULT; } IA64_PSR vpsr; vpsr.val=vmx_vcpu_get_psr(vcpu); if (vpsr.si&& vpsr.cpl != 0) { /* Inject Privileged Operation fault into guest */ set_privileged_operation_isr (vcpu, 0); privilege_op (vcpu); return IA64_FAULT; }#endif // CHECK_FAULT r1 = vmx_vcpu_get_itc(vcpu); vcpu_set_gr(vcpu,inst.M31.r1,r1,0); return IA64_NO_FAULT;}/******************************** * Moves to privileged registers********************************/static IA64FAULT vmx_emul_mov_to_pkr(VCPU *vcpu, INST64 inst){ u64 r3,r2;#ifdef CHECK_FAULT IA64_PSR vpsr; vpsr.val=vmx_vcpu_get_psr(vcpu); if (vpsr.cpl != 0) { /* Inject Privileged Operation fault into guest */ set_privileged_operation_isr (vcpu, 0); privilege_op (vcpu); return IA64_FAULT; }#endif // CHECK_FAULT if(vcpu_get_gr_nat(vcpu,inst.M42.r3,&r3)||vcpu_get_gr_nat(vcpu,inst.M42.r2,&r2)){#ifdef CHECK_FAULT set_isr_reg_nat_consumption(vcpu,0,0); rnat_comsumption(vcpu); return IA64_FAULT;#endif //CHECK_FAULT } return (vmx_vcpu_set_pkr(vcpu,r3,r2));}static IA64FAULT vmx_emul_mov_to_rr(VCPU *vcpu, INST64 inst){ u64 r3,r2;#ifdef CHECK_FAULT IA64_PSR vpsr; vpsr.val=vmx_vcpu_get_psr(vcpu); if (vpsr.cpl != 0) { /* Inject Privileged Operation fault into guest */ set_privileged_operation_isr (vcpu, 0); privilege_op (vcpu); return IA64_FAULT; }#endif // CHECK_FAULT if(vcpu_get_gr_nat(vcpu,inst.M42.r3,&r3)||vcpu_get_gr_nat(vcpu,inst.M42.r2,&r2)){#ifdef CHECK_FAULT set_isr_reg_nat_consumption(vcpu,0,0); rnat_comsumption(vcpu); return IA64_FAULT;#endif //CHECK_FAULT } return (vmx_vcpu_set_rr(vcpu,r3,r2));}static IA64FAULT vmx_emul_mov_to_dbr(VCPU *vcpu, INST64 inst){ u64 r3,r2;#ifdef CHECK_FAULT IA64_PSR vpsr; vpsr.val=vmx_vcpu_get_psr(vcpu); if (vpsr.cpl != 0) { /* Inject Privileged Operation fault into guest */ set_privileged_operation_isr (vcpu, 0); privilege_op (vcpu); return IA64_FAULT; }#endif // CHECK_FAULT if(vcpu_get_gr_nat(vcpu,inst.M42.r3,&r3)||vcpu_get_gr_nat(vcpu,inst.M42.r2,&r2)){#ifdef CHECK_FAULT set_isr_reg_nat_consumption(vcpu,0,0); rnat_comsumption(vcpu); return IA64_FAULT;#endif //CHECK_FAULT } return (vmx_vcpu_set_dbr(vcpu,r3,r2));}static IA64FAULT vmx_emul_mov_to_ibr(VCPU *vcpu, INST64 inst){ u64 r3,r2;#ifdef CHECK_FAULT IA64_PSR vpsr; vpsr.val=vmx_vcpu_get_psr(vcpu); if (vpsr.cpl != 0) { /* Inject Privileged Operation fault into guest */ set_privileged_operation_isr (vcpu, 0); privilege_op (vcpu); return IA64_FAULT; }#endif // CHECK_FAULT if(vcpu_get_gr_nat(vcpu,inst.M42.r3,&r3)||vcpu_get_gr_nat(vcpu,inst.M42.r2,&r2)){#ifdef CHECK_FAULT set_isr_reg_nat_consumption(vcpu,0,0); rnat_comsumption(vcpu); return IA64_FAULT;#endif //CHECK_FAULT } return vmx_vcpu_set_ibr(vcpu,r3,r2);}static IA64FAULT vmx_emul_mov_to_pmc(VCPU *vcpu, INST64 inst){ u64 r3,r2;#ifdef CHECK_FAULT IA64_PSR vpsr; vpsr.val=vmx_vcpu_get_psr(vcpu); if (vpsr.cpl != 0) { /* Inject Privileged Operation fault into guest */ set_privileged_operation_isr (vcpu, 0); privilege_op (vcpu); return IA64_FAULT; }#endif // CHECK_FAULT if(vcpu_get_gr_nat(vcpu,inst.M42.r3,&r3)||vcpu_get_gr_nat(vcpu,inst.M42.r2,&r2)){#ifdef CHECK_FAULT set_isr_reg_nat_consumption(vcpu,0,0); rnat_comsumption(vcpu); return IA64_FAULT;#endif //CHECK_FAULT } return (vmx_vcpu_set_pmc(vcpu,r3,r2));}static IA64FAULT vmx_emul_mov_to_pmd(VCPU *vcpu, INST64 inst){ u64 r3,r2;#ifdef CHECK_FAULT IA64_PSR vpsr; vpsr.val=vmx_vcpu_get_psr(vcpu); if (vpsr.cpl != 0) { /* Inject Privileged Operation fault into guest */ set_privileged_operation_isr (vcpu, 0); privilege_op (vcpu); return IA64_FAULT; }#endif // CHECK_FAULT if(vcpu_get_gr_nat(vcpu,inst.M42.r3,&r3)||vcpu_get_gr_nat(vcpu,inst.M42.r2,&r2)){#ifdef CHECK_FAULT set_isr_reg_nat_consumption(vcpu,0,0); rnat_comsumption(vcpu); return IA64_FAULT;#endif //CHECK_FAULT } return (vmx_vcpu_set_pmd(vcpu,r3,r2));}/********************************** * Moves from privileged registers **********************************/static IA64FAULT vmx_emul_mov_from_rr(VCPU *vcpu, INST64 inst){ u64 r3,r1;#ifdef CHECK_FAULT if(check_target_register(vcpu, inst.M43.r1)){ set_illegal_op_isr(vcpu); illegal_op(vcpu); return IA64_FAULT; } IA64_PSR vpsr; vpsr.val=vmx_vcpu_get_psr(vcpu); if (vpsr.cpl != 0) { /* Inject Privileged Operation fault into guest */ set_privileged_operation_isr (vcpu, 0); privilege_op (vcpu); return IA64_FAULT; }#endif //CHECK_FAULT if(vcpu_get_gr_nat(vcpu,inst.M43.r3,&r3)){#ifdef CHECK_FAULT set_isr_reg_nat_consumption(vcpu,0,0); rnat_comsumption(vcpu); return IA64_FAULT;#endif //CHECK_FAULT }#ifdef CHECK_FAULT if(is_reserved_rr_register(vcpu,r3>>VRN_SHIFT)){ set_rsv_reg_field_isr(vcpu); rsv_reg_field(vcpu); }#endif //CHECK_FAULT vcpu_get_rr(vcpu,r3,&r1); return vcpu_set_gr(vcpu, inst.M43.r1, r1,0);}static IA64FAULT vmx_emul_mov_from_pkr(VCPU *vcpu, INST64 inst){ u64 r3,r1;#ifdef CHECK_FAULT if(check_target_register(vcpu, inst.M43.r1)){ set_illegal_op_isr(vcpu); illegal_op(vcpu); return IA64_FAULT; } IA64_PSR vpsr; vpsr.val=vmx_vcpu_get_psr(vcpu); if (vpsr.cpl != 0) { /* Inject Privileged Operation fault into guest */ set_privileged_operation_isr (vcpu, 0); privilege_op (vcpu); return IA64_FAULT; }#endif //CHECK_FAULT if(vcpu_get_gr_nat(vcpu,inst.M43.r3,&r3)){#ifdef CHECK_FAULT set_isr_reg_nat_consumption(vcpu,0,0); rnat_comsumption(vcpu); return IA64_FAULT;#endif //CHECK_FAULT }#ifdef CHECK_FAULT if(is_reserved_indirect_register(vcpu,r3)){ set_rsv_reg_field_isr(vcpu); rsv_reg_field(vcpu); return IA64_FAULT; }#endif //CHECK_FAULT r1 = vmx_vcpu_get_pkr(vcpu, r3); return vcpu_set_gr(vcpu, inst.M43.r1, r1,0);}static IA64FAULT vmx_emul_mov_from_dbr(VCPU *vcpu, INST64 inst){ u64 r3,r1; IA64FAULT res;#ifdef CHECK_FAULT if(check_target_register(vcpu, inst.M43.r1)){ set_illegal_op_isr(vcpu); illegal_op(vcpu); return IA64_FAULT; } IA64_PSR vpsr; vpsr.val=vmx_vcpu_get_psr(vcpu); if (vpsr.cpl != 0) { /* Inject Privileged Operation fault into guest */ set_privileged_operation_isr (vcpu, 0); privilege_op (vcpu); return IA64_FAULT; }#endif //CHECK_FAULT if(vcpu_get_gr_nat(vcpu,inst.M43.r3,&r3)){#ifdef CHECK_FAULT set_isr_reg_nat_consumption(vcpu,0,0); rnat_comsumption(vcpu); return IA64_FAULT;#endif //CHECK_FAULT }#ifdef CHECK_FAULT if(is_reserved_indirect_register(vcpu,r3)){ set_rsv_reg_field_isr(vcpu); rsv_reg_field(vcpu); return IA64_FAULT; }#endif //CHECK_FAULT res = vmx_vcpu_get_dbr(vcpu, r3, &r1); if (res != IA64_NO_FAULT) return res; return vcpu_set_gr(vcpu, inst.M43.r1, r1,0);}static IA64FAULT vmx_emul_mov_from_ibr(VCPU *vcpu, INST64 inst){ u64 r3,r1; IA64FAULT res;#ifdef CHECK_FAULT if(check_target_register(vcpu, inst.M43.r1)){ set_illegal_op_isr(vcpu); illegal_op(vcpu); return IA64_FAULT; } IA64_PSR vpsr; vpsr.val=vmx_vcpu_get_psr(vcpu); if (vpsr.cpl != 0) { /* Inject Privileged Operation fault into guest */ set_privileged_operation_isr (vcpu, 0); privilege_op (vcpu); return IA64_FAULT; }#endif //CHECK_FAULT if(vcpu_get_gr_nat(vcpu,inst.M43.r3,&r3)){#ifdef CHECK_FAULT set_isr_reg_nat_consumption(vcpu,0,0); rnat_comsumption(vcpu); return IA64_FAULT;#endif //CHECK_FAULT }#ifdef CHECK_FAULT if(is_reserved_indirect_register(vcpu,r3)){ set_rsv_reg_field_isr(vcpu); rsv_reg_field(vcpu); return IA64_FAULT; }#endif //CHECK_FAULT res = vmx_vcpu_get_ibr(vcpu, r3, &r1); if (res != IA64_NO_FAULT) return res; return vcpu_set_gr(vcpu, inst.M43.r1, r1,0);}static IA64FAULT vmx_emul_mov_from_pmc(VCPU *vcpu, INST64 inst){ u64 r3,r1;#ifdef CHECK_FAULT if(check_target_register(vcpu, inst.M43.r1)){ set_illegal_op_isr(vcpu); illegal_op(vcpu); return IA64_FAULT; } IA64_PSR vpsr; vpsr.val=vmx_vcpu_get_psr(vcpu); if (vpsr.cpl != 0) { /* Inject Privileged Operation fault into guest */ set_privileged_operation_isr (vcpu, 0); privilege_op (vcpu); return IA64_FAULT; }#endif //CHECK_FAULT if(vcpu_get_gr_nat(vcpu,inst.M43.r3,&r3)){#ifdef CHECK_FAULT set_isr_reg_nat_consumption(vcpu,0,0); rnat_comsumption(vcpu); return IA64_FAULT;#endif //CHECK_FAULT }#ifdef CHECK_FAULT if(is_reserved_indirect_register(vcpu,r3)){ set_rsv_reg_field_isr(vcpu); rsv_reg_field(vcpu); return IA64_FAULT; }#endif //CHECK_FAULT r1 = vmx_vcpu_get_pmc(vcpu, r3); return vcpu_set_gr(vcpu, inst.M43.r1, r1,0);}static IA64FAULT vmx_emul_mov_from_cpuid(VCPU *vcpu, INST64 inst){ u64 r3,r1;#ifdef CHECK_FAULT if(check_target_register(vcpu, inst.M43.r1)){ set_illegal_op_isr(vcpu); illegal_op(vcpu); return IA64_FAULT; }#endif //CHECK_FAULT if(vcpu_get_gr_nat(vcpu,inst.M43.r3,&r3)){#ifdef CHECK_FAULT set_isr_reg_nat_consumption(vcpu,0,0); rnat_comsumption(vcpu); return IA64_FAULT;#endif //CHECK_FAULT }#ifdef CHECK_FAULT if(is_reserved_indirect_register(vcpu,r3)){ set_rsv_reg_field_isr(vcpu);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -