From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andrew Cooper Subject: Re: Hypercalls: ignored output registers? Date: Sun, 27 Dec 2015 11:22:35 +0000 Message-ID: <567FC9FB.7080700@citrix.com> References: Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============7754084619084328784==" Return-path: In-Reply-To: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Carl Patenaude Poulin , xen-devel@lists.xen.org List-Id: xen-devel@lists.xenproject.org This is a multi-part message in MIME format. --===============7754084619084328784== Content-Type: multipart/alternative; boundary="------------050201030103020007070507" This is a multi-part message in MIME format. --------------050201030103020007070507 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit On 27/12/2015 03:42, Carl Patenaude Poulin wrote: > Hi all, > > I'm looking at how hypercalls are implemented in Mini-OS and Andrew > Cooper's xen-test-framework. In both cases, several registers are > defined as outputs, they're bound by input registers, and their > outputs are ignored. Is there any reason for doing this instead of > just declaring directly the input registers? > > Is it because the registers are callee-saved? If that's the case, > why not just put them in the clobber list? This is because of some of the restrictions when constructing asm statements. The clobber list must be mutually exclusive with any of the named inputs/ouputs. Anything listed in the inputs alone is expected to retain its value across the asm statement. As the values in the registers are modified by the hypercall, we need a separate way to indicate that they are clobbered. This is done by listing them as an output as well (which indicates that their value is now different to the value they had as an input), being directed at a variable which is never referenced again (i.e. we don't care what the eventual value actually is). ~Andrew --------------050201030103020007070507 Content-Type: text/html; charset=windows-1252 Content-Length: 2015 Content-Transfer-Encoding: quoted-printable On 27/12/2015 03:42, Carl Patenaude Poulin wrote:
Hi all,

I'm looking at how hypercalls are implemented in Mini-OS and Andrew
Cooper's xen-test-framework. In both cases, several registers are
defined as outputs, they're bound by input registers, and their
outputs are ignored. Is there any reason for doing this instead of
just declaring directly the input registers=3F

Is it because the registers are callee-saved=3F If that's the case,
why not just put them in the clobber list=3F

This is because of some of the restrictions when constructing asm statements.

The clobber list must be mutually exclusive with any of the named inputs/ouputs.=A0 Anything listed in the inputs alone is expected to retain its value across the asm statement.

As the values in the registers are modified by the hypercall, we need a separate way to indicate that they are clobbered.

This is done by listing them as an output as well (which indicates that their value is now different to the value they had as an input), being directed at a variable which is never referenced again (i.e. we don't care what the eventual value actually is).

~Andrew
--------------050201030103020007070507-- --===============7754084619084328784== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel --===============7754084619084328784==--