title: How to read the registers of a QEMU VM with KVM enabled?
body: <p>I'm trying to sample the EIP register of a QEMU virtual machine at random times.
  For that, I created a thread inside QEMU that performs:</p>
  
  <pre><code>CPUState* cpu=/*code for choosing a random virtual cpu*/;
  X86CPU *x86cpu = X86_CPU(cpu);
  CPUX86State *env = &amp;x86cpu-&gt;env;
  while(true){
      waittime=(rand()%50000);
      usleep(waittime);
      eip = env-&gt;eip;
      printf("EIP= %zu\n",eip);
  }
  </code></pre>
  
  <p>However, it always outputs the same value! </p>
  
  <p>On the other hand - if I disable KVM - it perfectly prints various values... But I really need KVM working...</p>
  
  <p>How can I do it with KVM working?</p>