I have three problems,anyone can solve them or one of them or give me some clue? thank you
(2) second , whether every VMENTRY will call xmx_entry_helper ?if not, which function will VMENTRY call everytime?
(3)my target is setting VM into debug mode by set Trag_flag, the code below called vmx_properly_set_trap_flag,
and I add it at the end of vmx_vmexit_handler(). but it does not work.
inline void vmx_properly_set_trap_flag(struct vcpu *v)
1301 {
1302 /* we are currently stepping, so we need to set the trap flag
1303 * on the next instruction
1304 */
1305 unsigned long int_state = __vmread(GUEST_INTERRUPTIBILITY_INFO);
1306 unsigned long activity_state = __vmread(GUEST_ACTIVITY_STATE);
1307
1308 unsigned long intercepts = __vmread(EXCEPTION_BITMAP);
1309 unsigned long mask = (1UL << TRAP_debug );
1310
1311 unsigned long flags = __vmread(GUEST_RFLAGS);
1312 unsigned long flags_mask = (X86_EFLAGS_TF);
1313
1314 /* make sure the exception bitmap says to vmexit on
1315 * debug exceptions
1316 */
1317 intercepts |= mask;
1318 __vmwrite(EXCEPTION_BITMAP, intercepts);
1319
1320 /* Default to setting trap flag to on */
1321 flags |= flags_mask;
1322
1323 if((activity_state == 1))
1324 {
1325
1326 /* this means we're in HLT mode. Disabling is OK since
1327 ** we will get an NMI to get out of HLT.
1328 ** The NMI will cause a VMExit which will reset TF
1329 ** execution
1330 **/
1331 printk("Turning off SS due to HLT\n");
1332 //flags &= ~(flags_mask);
1333 }
1334
1335 if((int_state & 3) )
1336 {
1337 int_state &= ~(3);
1338 printk("init_state is 3\n");
1339 //__vmwrite(GUEST_INTERRUPTIBILITY_INFO, int_state);
1340 }
1342 /* setting TF due to stepping enabled;*/
1343 __vmwrite(GUEST_RFLAGS, flags);
1344
1345 }