From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1I9RIr-0008Tx-JO for qemu-devel@nongnu.org; Fri, 13 Jul 2007 15:59:49 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1I9RIq-0008TF-4w for qemu-devel@nongnu.org; Fri, 13 Jul 2007 15:59:49 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1I9RIp-0008T5-TL for qemu-devel@nongnu.org; Fri, 13 Jul 2007 15:59:47 -0400 Received: from ik-out-1112.google.com ([66.249.90.180]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1I9RIp-0003Hz-Cr for qemu-devel@nongnu.org; Fri, 13 Jul 2007 15:59:47 -0400 Received: by ik-out-1112.google.com with SMTP id c29so656484ika for ; Fri, 13 Jul 2007 12:59:45 -0700 (PDT) Message-ID: Date: Fri, 13 Jul 2007 21:59:44 +0200 From: "andrzej zaborowski" Subject: Re: [Qemu-devel] address translation In-Reply-To: <12835c8f0707121729y29d1a678qf27d29b0ca572f08@mail.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <12835c8f0707121729y29d1a678qf27d29b0ca572f08@mail.gmail.com> Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org On 13/07/07, Shashidhar Mysore wrote: > Hello group, > > I have two questions, both regarding the virtual-physical translation of > addresses (all in the virtual machine context). > > 1> > Can somebody tell me if the program counter value available in the following > snippet from target-i386/translate.c > is virtual or physical? I learnt it may be virtual, in which case is there a > way to extract the physical address corresponding to the > virtual address, or if it is physical, then is there a way to translate to > its virtual address (within the virtual machine context)? It is virtual, I think cpu_get_phys_page_debug() + the offset should give you physical. > > ************************************************ > /* convert one instruction. s->is_jmp is set if the translation must > be stopped. Return the next pc value */ > static target_ulong disas_insn(DisasContext *s, target_ulong pc_start) > { > int b, prefixes, aflag, dflag; > int shift, ot; > int modrm, reg, rm, mod, reg_addr, op, opreg, offset_addr, val; > target_ulong next_eip, tval; > int rex_w, rex_r; > > s->pc = pc_start; // This s->pc is what I am using to extract all > executed PC values This s->pc doesn't correspond to executed PC values, qemu is a translator. > ************************************************ > > > 2> > Second question I have is - Within the functions from target-i386/ops_mem.h > for example, > > void OPPROTO glue(glue(op_ldub, MEMSUFFIX), _T0_A0)(void) > { > T0 = glue(ldub, MEMSUFFIX)(A0); > } > > Is A0 the physical address? or is it virtual? > And how to I translate from one to another in either case? Also virtual. Regards