public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: "Roedel, Joerg" <Joerg.Roedel@amd.com>
To: Avi Kivity <avi@redhat.com>
Cc: Marcelo Tosatti <mtosatti@redhat.com>,
	"kvm@vger.kernel.org" <kvm@vger.kernel.org>
Subject: Re: [PATCH 04/15] KVM: x86 emulator: Add check_perm callback
Date: Mon, 4 Apr 2011 12:23:48 +0200	[thread overview]
Message-ID: <20110404102348.GD23633@amd.com> (raw)
In-Reply-To: <4D986990.1090604@redhat.com>

On Sun, Apr 03, 2011 at 08:35:28AM -0400, Avi Kivity wrote:
> On 04/01/2011 05:10 PM, Joerg Roedel wrote:
> > This patch adds a check_perm callback for each opcode into
> > the instruction emulator. This will be used to do all
> > necessary permission checks on instructions before checking
> > whether they are intercepted or not.
> >
> >
> > @@ -216,6 +216,7 @@ struct decode_cache {
> >   	u8 seg_override;
> >   	unsigned int d;
> >   	int (*execute)(struct x86_emulate_ctxt *ctxt);
> > +	int (*check_perm)(struct x86_emulate_ctxt *ctxt);
> 
> I originally mean to use a group-like structure to have check_perm only 
> when needed, but I guess this is a premature optimization. #define D(_y) 
> { .flags = (_y) }
> >   #define DI(_y, _i) { .flags = (_y), .intercept = x86_intercept_##_i }
> > +#define DIP(_y, _i) { .flags = (_y), .intercept = x86_intercept_##_i, \
> > +		      .check_perm = em_check_perm_##_i }
> 
> Sorry, this (and all the #defines which follow) are just obfuscating.  I 
> set a bad example here, but the following patches show there is nothing 
> gained by the ## games.  Please use the full function name.

Yeah, this became a bit obfuscating in the end. My intention was to keep
the opcode tables clean and readable, but I changed it now and added the
check-functions directly removing all the #defines.

	Joerg

-- 
AMD Operating System Research Center

Advanced Micro Devices GmbH Einsteinring 24 85609 Dornach
General Managers: Alberto Bozzo, Andrew Bowd
Registration: Dornach, Landkr. Muenchen; Registerger. Muenchen, HRB Nr. 43632


  reply	other threads:[~2011-04-04 10:23 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-01 14:10 [PATCH 0/15] KVM: Make the instruction emulator aware of Nested Virtualization v4 Joerg Roedel
2011-04-01 14:10 ` [PATCH 01/15] KVM: x86 emulator: add framework for instruction intercepts Joerg Roedel
2011-04-01 14:10 ` [PATCH 02/15] KVM: x86 emulator: add SVM intercepts Joerg Roedel
2011-04-01 14:10 ` [PATCH 03/15] KVM: x86 emulator: Don't write-back cpu-state on X86EMUL_INTERCEPTED Joerg Roedel
2011-04-01 14:10 ` [PATCH 04/15] KVM: x86 emulator: Add check_perm callback Joerg Roedel
2011-04-03 12:35   ` Avi Kivity
2011-04-04 10:23     ` Roedel, Joerg [this message]
2011-04-01 14:10 ` [PATCH 05/15] KVM: x86 emulator: Add flag to check for protected mode instructions Joerg Roedel
2011-04-01 14:10 ` [PATCH 06/15] KVM: x86: Add x86 callback for intercept check Joerg Roedel
2011-04-01 14:10 ` [PATCH 07/15] KVM: SVM: Add intercept check for emulated cr accesses Joerg Roedel
2011-04-01 14:10 ` [PATCH 08/15] KVM: SVM: Add intercept check for accessing dr registers Joerg Roedel
2011-04-01 14:10 ` [PATCH 09/15] KVM: SVM: Add intercept checks for descriptor table accesses Joerg Roedel
2011-04-01 14:10 ` [PATCH 10/15] KVM: SVM: Add intercept checks for SVM instructions Joerg Roedel
2011-04-01 14:10 ` [PATCH 11/15] KVM: SVM: Add intercept checks for remaining group7 instructions Joerg Roedel
2011-04-01 14:10 ` [PATCH 12/15] KVM: SVM: Add intercept checks for remaining twobyte instructions Joerg Roedel
2011-04-01 14:10 ` [PATCH 13/15] KVM: SVM: Add intercept checks for one-byte instructions Joerg Roedel
2011-04-01 14:10 ` [PATCH 14/15] KVM: SVM: Add checks for IO instructions Joerg Roedel
2011-04-01 14:10 ` [PATCH 15/15] KVM: SVM: Remove nested sel_cr0_write handling code Joerg Roedel
2011-04-03 12:42 ` [PATCH 0/15] KVM: Make the instruction emulator aware of Nested Virtualization v4 Avi Kivity
  -- strict thread matches above, loose matches on Subject: below --
2011-04-04 10:39 [PATCH 0/15] KVM: Make the instruction emulator aware of Nested Virtualization v5 Joerg Roedel
2011-04-04 10:39 ` [PATCH 04/15] KVM: x86 emulator: Add check_perm callback Joerg Roedel

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=20110404102348.GD23633@amd.com \
    --to=joerg.roedel@amd.com \
    --cc=avi@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=mtosatti@redhat.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox