qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] Dump guest page table inside QEMU makes system hang
@ 2012-08-21  7:21 陳韋任 (Wei-Ren Chen)
  2012-08-21 18:19 ` Blue Swirl
  0 siblings, 1 reply; 6+ messages in thread
From: 陳韋任 (Wei-Ren Chen) @ 2012-08-21  7:21 UTC (permalink / raw)
  To: qemu-devel

Hi all,

  I want to dump guest page table when guest writes to cr3,
the code snipt below,

---
uint32_t pgd[1024][1024]; // guest page table
static void dump_guest_pgtable(target_ulong cr3)
{
    int i, j;
    uint32_t phyaddr = cr3;
    uint32_t val;

    for (i = 0; i < NUM_ENTRY; ++i)
    {
        phyaddr += i * 4;
        for (j = 0; j < NUM_ENTRY; ++j)
        {
            cpu_physical_memory_read(phyaddr, &val, 4);
            pgd[i][j] = val;
        }
    }
}

void cpu_x86_update_cr3(CPUX86State *env, target_ulong new_cr3)
{
    env->cr[3] = new_cr3; // guest cr3

    if (env->cr[0] & CR0_PG_MASK) {
        tlb_flush(env, 0);

        // dump guest page table by using guest cr3
        dump_guest_pgtable(new_cr3);
    }
}
---

  The system will hang while booting. However, if I comment 
cpu_physical_memory_read in function dump_guest_pgtable, there
is no problem. What I am missing here? Thanks.

Regards,
chenwj

-- 
Wei-Ren Chen (陳韋任)
Computer Systems Lab, Institute of Information Science,
Academia Sinica, Taiwan (R.O.C.)
Tel:886-2-2788-3799 #1667
Homepage: http://people.cs.nctu.edu.tw/~chenwj

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2012-08-23  3:55 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-08-21  7:21 [Qemu-devel] Dump guest page table inside QEMU makes system hang 陳韋任 (Wei-Ren Chen)
2012-08-21 18:19 ` Blue Swirl
2012-08-22  2:20   ` 陳韋任 (Wei-Ren Chen)
2012-08-22 12:06   ` Max Filippov
2012-08-23  2:53     ` 陳韋任 (Wei-Ren Chen)
2012-08-23  3:55       ` 陳韋任 (Wei-Ren Chen)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).