All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Yang, Sheng" <sheng.yang-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
To: Avi Kivity <avi-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
Cc: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org,
	Eric Liu <eric.e.liu-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Subject: Re: [PATCH] KVM: emulator: Only allow VMCALL/VMMCALL trapped by #UD
Date: Mon, 7 Jan 2008 19:21:53 +0800	[thread overview]
Message-ID: <200801071921.54294.sheng.yang@intel.com> (raw)
In-Reply-To: <47820268.9060309-atKUWr5tajBWk0Htik3J/w@public.gmane.org>

On Monday 07 January 2008 18:43:52 Avi Kivity wrote:
> Yang, Sheng wrote:
> > On Monday 07 January 2008 17:22:43 Avi Kivity wrote:
> >> Yang, Sheng wrote:
> >>>> I have a vague plan for improving decode; basically extend the decode
> >>>> tables to add group decoding.  We add a bit to opcode_table and
> >>>> twobyte_table that is set for all instructions which need group
> >>>> decoding.  When the bit is set, the rest of the value in opcode_table
> >>>> is interpreted as an index (together with modrm_reg) into a new
> >>>> group_table, so we can have different decoding for such instructions.
> >>>
> >>> I also have tried to propose a table for Grp opcode, but can't find a
> >>> easy way. Using the rest of the value in opcode_table is a good idea,
> >>> but I'm afraid the same value for different group exists, e.g.
> >>> 0x82(Grp1) and 0xc0 (Grp2) got the same value as: ByteOp | DstMem |
> >>> SrcImm | ModRM. If we add more factors to this, it would become unclear
> >>> and more tricky, the table also may become larger...
> >>>
> >>> Currently, if we want to using group_table, I think the straightforward
> >>> way is better: another big "switch"... The only exception is 1a, and we
> >>> may use 0 instead of it.
> >>
> >> Not sure what you mean.  I thought of adding code like
> >>
> >>
> >>     if (c->d & Group) {
> >>           c->group = c->d & GroupMask;
> >
> > I meant the c->d & GroupMask is not sufficient to indicate different
> > group. For example, 0x82(Grp1) and 0xc0(Grp2) have same c->d & GroupMask
> > = ByteOp | DstMem | SrcImm | ModRM.
>
> I now see the source of confusion...
>
> >>           // fetch modrm_reg
> >>           c->d = group_table[c->group * 8 + modrm_reg];
> >
> > In this case, how can you deal with c->group =  ByteOp | DstMem | SrcImm
> > | ModRM, and modrm_reg = 6. Is it a XOR or nothing?
>
> In this case, we would have
>
>    opcode_table[0x82] == Group | Grp1  (c->group == Grp1 == 1)
>    opcode_table[0xc0] == Group | Grp2  (c->group == Grp2 == 2)
>    group_table[Grp1 * 8 + 6] == ByteOp | DstMem | SrcImm | ModRM
>    group_table[Grp2 * 8 + 0] == ByteOp | DstMem | SrcImm | ModRM
>
> If Group is set in opcode_table, the rest of the value is the group
> number, with the reg part used to pick the final decode flags.

Faint... 

Yeah, I think that's pretty good. Sorry for misunderstanding...

-- 
Thanks
Yang, Sheng

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/

      parent reply	other threads:[~2008-01-07 11:21 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-01-04  1:36 [PATCH] KVM: emulator: Only allow VMCALL/VMMCALL trapped by #UD Yang, Sheng
     [not found] ` <200801040936.08670.sheng.yang-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2008-01-04  2:12   ` Anthony Liguori
     [not found]     ` <477D9610.4010605-rdkfGonbjUSkNkDKm+mE6A@public.gmane.org>
2008-01-04  5:52       ` Dong, Eddie
     [not found]         ` <10EA09EFD8728347A513008B6B0DA77A029B54D6-wq7ZOvIWXbNpB2pF5aRoyrfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2008-01-05 23:36           ` Dor Laor
2008-01-06  2:29           ` Anthony Liguori
     [not found]             ` <47803CEF.7000303-rdkfGonbjUSkNkDKm+mE6A@public.gmane.org>
2008-01-07 10:01               ` Dong, Eddie
     [not found]                 ` <10EA09EFD8728347A513008B6B0DA77A029B5DC3-wq7ZOvIWXbNpB2pF5aRoyrfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2008-01-07 10:09                   ` Avi Kivity
     [not found]                     ` <4781FA68.7040604-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2008-01-07 14:42                       ` Dong, Eddie
     [not found]                         ` <10EA09EFD8728347A513008B6B0DA77A029B5E20-wq7ZOvIWXbNpB2pF5aRoyrfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2008-01-07 17:43                           ` Avi Kivity
     [not found]                             ` <478264B5.8030503-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2008-01-09 15:03                               ` Dong, Eddie
     [not found]                                 ` <10EA09EFD8728347A513008B6B0DA77A029F5259-wq7ZOvIWXbNpB2pF5aRoyrfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2008-01-09 15:20                                   ` Avi Kivity
     [not found]                                     ` <4784E64E.30205-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2008-01-09 15:34                                       ` Dong, Eddie
2008-01-06  8:40   ` Avi Kivity
     [not found]     ` <478093F0.6060003-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2008-01-07  2:21       ` Yang, Sheng
     [not found]         ` <200801071021.12038.sheng.yang-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2008-01-07  9:22           ` Avi Kivity
     [not found]             ` <4781EF63.4010201-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2008-01-07 10:23               ` Yang, Sheng
     [not found]                 ` <200801071823.15040.sheng.yang-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2008-01-07 10:43                   ` Avi Kivity
     [not found]                     ` <47820268.9060309-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2008-01-07 11:21                       ` Yang, Sheng [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=200801071921.54294.sheng.yang@intel.com \
    --to=sheng.yang-ral2jqcrhueavxtiumwx3w@public.gmane.org \
    --cc=avi-atKUWr5tajBWk0Htik3J/w@public.gmane.org \
    --cc=eric.e.liu-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
    --cc=kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.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.