From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:56303) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T4rN4-0008Jv-Ro for qemu-devel@nongnu.org; Fri, 24 Aug 2012 06:44:16 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1T4rN3-00011l-Iw for qemu-devel@nongnu.org; Fri, 24 Aug 2012 06:44:10 -0400 Received: from csmailer.cs.nctu.edu.tw ([140.113.235.130]:57249) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T4rN3-0000yN-1V for qemu-devel@nongnu.org; Fri, 24 Aug 2012 06:44:09 -0400 Received: from csmailer.cs.nctu.edu.tw (localhost [127.0.0.1]) by csmailer.cs.nctu.edu.tw (Postfix) with ESMTP id 3F7EB67B for ; Fri, 24 Aug 2012 18:43:59 +0800 (CST) Received: from alumni.cs.nctu.edu.tw (alumni.cs.nctu.edu.tw [140.113.235.116]) by csmailer.cs.nctu.edu.tw (Postfix) with ESMTP id 2E5B867A for ; Fri, 24 Aug 2012 18:43:59 +0800 (CST) Received: (from chenwj@localhost) by alumni.cs.nctu.edu.tw (8.14.4/8.14.4/Submit) id q7OAhwvn073543 for qemu-devel@nongnu.org; Fri, 24 Aug 2012 18:43:58 +0800 (CST) (envelope-from chenwj) Date: Fri, 24 Aug 2012 18:43:58 +0800 From: =?utf-8?B?6Zmz6Z+L5Lu7IChXZWktUmVuIENoZW4p?= Message-ID: <20120824104358.GA73318@cs.nctu.edu.tw> References: <20120824033401.GB62168@cs.nctu.edu.tw> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] What's the proper type of guest pde address, target_ulong or target_phys_addr_t? List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org > 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 hav= e > 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 =20 [1] http://download.intel.com/products/processor/manual/253668.pdf --=20 Wei-Ren Chen (=E9=99=B3=E9=9F=8B=E4=BB=BB) 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