All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Eddie C. Dost" <ecd@brainaid.de>
To: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] softMMU / MOV translation
Date: Wed, 25 Jul 2007 15:41:35 +0200	[thread overview]
Message-ID: <20070725134135.GA4977@brainaid.de> (raw)
In-Reply-To: <200707251404.47085.clemens.kol@gmx.at>

Hi  Clemens,

if you enable "log asm_in,op,op_opt,asm_out" you will see the
intermediate code used during translation.

The opcodes are generated from the macros you already found in
softmmu_header.h by target-i386/ops_mem.h included from target-i386/op.c

Hope this helps,
Eddie

On Wed, Jul 25, 2007 at 02:04:47PM +0200, Clemens Kolbitsch wrote:
> hi!
> i tried asking this in the irc  but got no answer, hope someone can help me 
> here :-)
> 
> i'm working on memory-protection for my mather's thesis and have to dig into 
> qemu memory management... could someone help me here please? i have the 
> following problem:
> 
> i'm trying to understand the dynamic translation for the following mov-opcode 
> (it's taken from the qemu log with "log asm_in,asm_out"):
> 
> IN:
> 0xc011c9f2:  mov    0x60(%esi),%edx
> the hex-code would be "0x8b 0x56 0x60"
> ...
> 
> OUT:
> OUT: [size=455]
> 0x08d30fa0:  mov    0x18(%ebp),%edi
> 0x08d30fa3:  add    $0x60,%edi
> 0x08d30fa9:  mov    %edi,%edx
> 0x08d30fab:  mov    %edi,%eax
> 0x08d30fad:  shr    $0x8,%edx
> 0x08d30fb0:  and    $0xfffff003,%eax
> 0x08d30fb5:  and    $0xff0,%edx
> 0x08d30fbb:  lea    0x350(%edx,%ebp,1),%edx
> 0x08d30fc2:  cmp    (%edx),%eax
> 0x08d30fc4:  mov    %edi,%eax
> 0x08d30fc6:  je     0x8d30fd4
> 0x08d30fc8:  push   $0x0
> 0x08d30fca:  call   0x80ee06a		// __ldl_mmu
> 0x08d30fcf:  pop    %edx
> 0x08d30fd0:  mov    %eax,%ebx
> 0x08d30fd2:  jmp    0x8d30fd9
> 0x08d30fd4:  add    0xc(%edx),%eax
> 0x08d30fd7:  mov    (%eax),%ebx		// possibly the output of gen_op_ld_T0_A0
> [ot]+ s->mem_index]();
> 0x08d30fd9:  mov    %ebx,0x8(%ebp)	// this is the output of gen_op_mov_reg_T0
> [ot][reg](); (translate.c:4005)
> ...
> 
> 
> therefore, i think the following code in translate.c should be executed:
> 
> case 0x8b: /* mov Ev, Gv */
>         if ((b & 1) == 0)
>             ot = OT_BYTE;
>         else
>             ot = OT_WORD + dflag;
>         modrm = ldub_code(s->pc++);
>         reg = ((modrm >> 3) & 7) | rex_r;
>         
>         gen_ldst_modrm(s, modrm, ot, OR_TMP0, 0);
>         gen_op_mov_reg_T0[ot][reg]();
>         break;
> 
> 
> i debugged some time and found out that the last gen_op
> 
>         gen_op_mov_reg_T0[ot][reg]();
> 
> only produces 
> 
>         mov    %ebx,0x8(%ebp).
> 
> thus, the rest of the OUT-codes is produced by
> 
>        gen_ldst_modrm(s, modrm, ot, OR_TMP0, 0);
> 
> however, i tried reading through the code but i could not find the function 
> where
> 
>       0x08d30fca:  call   0x80ee06a           // __ldl_mmu
> 
> is inserted into the translation-buffer... i (think to) know why it must be 
> inserted, but i just cannot figure out where it is put into the buffer.
> 
> if someone could point that out, it would help me a LOT!
> thanks,
>   Clemens
> 
> 

-- 
___________________________________________________brainaid_____________
Eddie C. Dost           Rue de la Chapelle 51      phone +32 87 788817
                        B-4850 Moresnet            fax   +32 87 788818
ecd@brainaid.de         Belgium                    cell  +49 172 9312808

      parent reply	other threads:[~2007-07-25 13:41 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-07-25 12:04 [Qemu-devel] softMMU / MOV translation Clemens Kolbitsch
2007-07-25 13:22 ` [Qemu-devel] " Clemens Kolbitsch
2007-07-25 14:08   ` [Qemu-devel] " Clemens Kolbitsch
2007-07-25 13:41 ` Eddie C. Dost [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20070725134135.GA4977@brainaid.de \
    --to=ecd@brainaid.de \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.