[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] What's the proper type of guest pde address, target_ulo
From: |
Wei-Ren Chen |
Subject: |
Re: [Qemu-devel] What's the proper type of guest pde address, target_ulong or target_phys_addr_t? |
Date: |
Fri, 24 Aug 2012 18:43:58 +0800 |
User-agent: |
Mutt/1.5.21 (2010-09-15) |
> In principle, yes, but you need to check the code carefully to make
> sure your type change doesn't change any of the results. (Or if it
> does, you then need to confirm against the specs that this was a bug
> that is being fixed, not a new one being introduced). The thing you have
> to remember is that for the 32 bit x86 cores guest physical addresses
> are only 32 bits but target_phys_addr_t is still a 64 bit type.
> It may be we're deliberately (mis)using target_ulong to get the
> right behaviour on both 32 and 64 bit cores.
Just want to make a note here. According to Intel Software Developer's Manual
Volume 3A, 4.4.2 Linear-Address Translation with PAE Paging [1],
A PDE is selected using the physical address defined as follows:
- Bits 51:12 are from PDPTEi.
- Bits 11:3 are bits 29:21 of the linear address.
- Bits 2:0 are 0.
IIUC, pde_addr/pte_addr are 52-bit wide, but cpu_get_phys_page_debug
declares pde_addr/pte_addr as target_ulong, which is uint32_t for x86
guest. That might be a problem.
target_phys_addr_t cpu_get_phys_page_debug(CPUX86State *env, target_ulong addr)
{
target_ulong pde_addr, pte_addr;
... snip ...
}
Regards,
chenwj
[1]
http://download.intel.com/products/processor/manual/253668.pdf
--
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