All of lore.kernel.org
 help / color / mirror / Atom feed
From: Richard Henderson <rth@twiddle.net>
To: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Cc: Edgar Iglesias <edgari@xilinx.com>,
	Peter Maydell <peter.maydell@linaro.org>,
	"claudio.fontana" <claudio.fontana@gmail.com>,
	Peter Crosthwaite <crosthwaite.peter@gmail.com>,
	Alexander Graf <agraf@suse.de>,
	QEMU Developers <qemu-devel@nongnu.org>,
	Peter Crosthwaite <crosthwaitepeter@gmail.com>,
	"Edgar E. Iglesias" <edgar.iglesias@gmail.com>
Subject: Re: [Qemu-devel] [PATCH 6/7] monitor: "i": Add ARM specifics
Date: Wed, 06 May 2015 06:57:37 -0700	[thread overview]
Message-ID: <554A1DD1.8060602@twiddle.net> (raw)
In-Reply-To: <CAEgOgz76u07HVmZOrcGHVKR_owhywJPc1=vdj=38cZ=JCeeGTw@mail.gmail.com>

On 05/05/2015 11:57 PM, Peter Crosthwaite wrote:
> So I have made a start on this. The ARM, MB and CRIS in this patch
> series is rather easy. Its X86 im having trouble with but your example
> here looks like most of the work ...
> 
>> Indeed, the flags setup becomes less obscure when, instead of
>>
>> #ifdef TARGET_I386
>>         if (wsize == 2) {
>>             flags = 1;
>>         } else if (wsize == 4) {
>>             flags = 0;
>>         } else {
> 
> So here the monitor is actually using the argument memory-dump size to
> dictate the flags. Is this flawed and should we delete this wsize
> if-else and rely on the CPU-state driven logic for correct disas info
> selection? This wsize reliance seems unique to x86. I think we would
> have to give this up in a QOMified approach.

Hmm.  I don't think that I've ever noticed the monitor disassembly could do
that.  If I were going to do that kind of debugging I certainly wouldn't use
the monitor -- I'd use gdb.  ;-)

If someone thinks we ought to keep that feature, speak now...

>>             /* as default we use the current CS size */
>>             flags = 0;
>>             if (env) {
>> #ifdef TARGET_X86_64
>>                 if ((env->efer & MSR_EFER_LMA) &&
>>                     (env->segs[R_CS].flags & DESC_L_MASK))
> 
> This uses env->efer and segs to drive the flags...
> 
>>                     flags = 2;
>>                 else
>> #endif
>>                 if (!(env->segs[R_CS].flags & DESC_B_MASK))
>>                     flags = 1;
>>             }
>>         }
>>
>> in one place and
>>
>> #if defined(TARGET_I386)
>>     if (flags == 2) {
>>         s.info.mach = bfd_mach_x86_64;
>>     } else if (flags == 1) {
>>         s.info.mach = bfd_mach_i386_i8086;
>>     } else {
>>         s.info.mach = bfd_mach_i386_i386;
>>     }
>>     print_insn = print_insn_i386;
>>
>> in another, we merge the two so that we get
>>
>>     s.info.mach = bfd_mach_i386_i8086;
>>     if (env->hflags & (1U << HF_CS32_SHIFT)) {
> 
> But your new implementation uses hflags. Are they the same state? I
> couldnt find easy correltation between MSR_EFER_LMA and HF_CSXX_SHIFT
> (although I do see that map to hflags HF_LMA?).
> 
> Is your code a functional change?

It's not intended to be.  Since I couldn't find where wsize was initialized, I
pulled the tests used by target-i386/translator.c, for dc->code32 and
dc->code64, since I knew where to find them right away.  ;-)

Without going back to the manuals, I don't know the difference between CS64 and
LMA; from the code it appears only the behaviour of sysret, which seems surprising.

> I went for adding print_insn to disassembly_info and passing just that
> to the hook. Patches soon! I might leave X86 out for the first spin.

Sounds good.


r~

  reply	other threads:[~2015-05-06 13:57 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-05  4:44 [Qemu-devel] [PATCH 0/7] disas: Unify target_disas and monitor_disas Peter Crosthwaite
2015-05-05  4:44 ` [Qemu-devel] [PATCH 1/7] disas: Create factored out fn for monitor and target disas Peter Crosthwaite
2015-05-05 14:45   ` Claudio Fontana
2015-05-05  4:44 ` [Qemu-devel] [PATCH 2/7] disas: microblaze: Migrate setup to common code Peter Crosthwaite
2015-05-05  4:45 ` [Qemu-devel] [PATCH 3/7] disas: cris: Fix 0 buffer length case Peter Crosthwaite
2015-05-05  4:45 ` [Qemu-devel] [PATCH 4/7] disas: cris: Migrate setup to common code Peter Crosthwaite
2015-05-05  4:45 ` [Qemu-devel] [PATCH 5/7] disas: arm-a64: Make printfer and stream variable Peter Crosthwaite
2015-05-05 14:41   ` Claudio Fontana
2015-05-05 17:22   ` Richard Henderson
2015-05-05  4:45 ` [Qemu-devel] [PATCH 6/7] monitor: "i": Add ARM specifics Peter Crosthwaite
2015-05-05 14:40   ` Claudio Fontana
2015-05-05 17:19   ` Peter Maydell
2015-05-05 17:43     ` Richard Henderson
2015-05-06  6:57       ` Peter Crosthwaite
2015-05-06 13:57         ` Richard Henderson [this message]
2015-05-06  7:06       ` Peter Crosthwaite
2015-05-06 14:12         ` Richard Henderson
2015-05-06 14:17           ` Paolo Bonzini
2015-05-06 14:32             ` Stefano Stabellini
2015-05-06 15:44           ` Peter Maydell
2015-05-06 18:24             ` Richard Henderson
2015-05-06 18:39               ` Peter Maydell
2015-05-05  4:45 ` [Qemu-devel] [PATCH 7/7] disas: arm: Use target_disas impl for monitor Peter Crosthwaite
2015-05-05 14:38   ` Claudio Fontana
2015-05-05 16:48     ` Peter Crosthwaite
2015-05-05 17:18 ` [Qemu-devel] [PATCH 0/7] disas: Unify target_disas and monitor_disas Richard Henderson

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=554A1DD1.8060602@twiddle.net \
    --to=rth@twiddle.net \
    --cc=agraf@suse.de \
    --cc=claudio.fontana@gmail.com \
    --cc=crosthwaite.peter@gmail.com \
    --cc=crosthwaitepeter@gmail.com \
    --cc=edgar.iglesias@gmail.com \
    --cc=edgari@xilinx.com \
    --cc=peter.crosthwaite@xilinx.com \
    --cc=peter.maydell@linaro.org \
    --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.