xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Cooper <andrew.cooper3@citrix.com>
To: John McDermott <john.mcdermott@nrl.navy.mil>, Xen-devel@lists.xen.org
Subject: Re: Reducing the Number of Context-Sensitive Macros in x86_emulate.c
Date: Wed, 20 Apr 2016 18:26:48 +0100	[thread overview]
Message-ID: <5717BBD8.1010001@citrix.com> (raw)
In-Reply-To: <EC4A48EB-F392-404D-9AD0-EC8B46DA1396@nrl.navy.mil>

On 20/04/16 17:42, John McDermott wrote:
> Xen Developers,
>
> Would there be any interest in replacing some of the
> context-sensitive macros in x86_emulate.c, to make it more
> maintainable?
>
> I work on the Xenon project, which researches ways to transform
> Xen into a higher-security hypervisor. One of the things we do is
> modify Xen code to make it more maintainable. As part of that
> work, we have some experience in improving the maintainability of
> x86_emulate.c.
>
> The design of the x86_emulate function depends on labels in such
> a way that it is probably not practical to remove _all_
> context-sensitive macros. The code could be made more
> maintainable by reducing the number. The ultimate goal would be
> to have only 2 context-sensitive macros, say “chk” and “chkw”,
> referencing the global labels. Everything else would be static
> always_inline functions. This would separate the
> context-sensitive macro concerns into a small amount of code and
> reduce the number of macros in the code. (Two context-sensitive
> macros would be needed because one needs to reference only the
> label “done" but the other needs to reference the label
> “writeback".)
>
> If there is some interest, we could submit a series of patches,
> each one replacing a single context-sensitive macro in the
> code.

I have been wanting to do this for a while.  An item was discussed at
Xen Hackathon (two days ago) which involves rewriting x86_emulate().

The primary motivation is to split instruction decode from emulate, to
be able to have an audit stage in the middle.  A side effect of this is
that we can remove 4 of our 5 pieces of code which currently do x86
instruction prefix decoding (each slightly differently).  A second
motivation is to address the lack of support for non-memory-target
instructions, which is an issue for introspection activities.

Rest assured that I dislike the code as much as you do, and I plan for
the result to be far easier to follow and maintain.

Shortly, I will be submitting notes from that session, and a design
showing how I plan to proceed.

~Andrew

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

      reply	other threads:[~2016-04-20 17:26 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-20 16:42 Reducing the Number of Context-Sensitive Macros in x86_emulate.c John McDermott
2016-04-20 17:26 ` Andrew Cooper [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=5717BBD8.1010001@citrix.com \
    --to=andrew.cooper3@citrix.com \
    --cc=Xen-devel@lists.xen.org \
    --cc=john.mcdermott@nrl.navy.mil \
    /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;
as well as URLs for NNTP newsgroup(s).