public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Anthony Liguori <anthony-rdkfGonbjUSkNkDKm+mE6A@public.gmane.org>
To: Dor Laor <dor.laor-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
Cc: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
Subject: Re: [PATCH 1/4] [HYPERCALL] Add hypercalls functions
Date: Mon, 27 Aug 2007 17:13:51 -0500	[thread overview]
Message-ID: <1188252831.22727.2.camel@squirrel> (raw)
In-Reply-To: <64F9B87B6B770947A9F8391472E032160D59004C-yEcIvxbTEBqsx+V+t5oei8rau4O3wl8o3fe8/T/H7NteoWH0uzbU5w@public.gmane.org>

On Fri, 2007-08-24 at 16:57 -0700, Dor Laor wrote:
> The hypercalls can be called with various parameters number.
> Both x86_64 and i386 are supported.
> 
> Signed-off-by: Dor Laor <dor.laor-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
> ---
> +static inline int
> +__hypercall6(unsigned int nr, unsigned long p1, unsigned long p2,
> +	     unsigned long p3, unsigned long p4, unsigned long p5,
> +	     unsigned long p6)
> +{
> +	int ret;
> +	asm (" call hypercall_addr\n"
> +		: "=a" (ret)
> +		: "b" (nr),
> +		  "a" (p1),
> +		  "c" (p2),
> +		  "d" (p3),
> +		  "S" (p4),
> +		  "D" (p5),
> +		  "bp" (p6)
> +		: "memory", "cc"
> +	);
> +	return ret;
> +}
> +
> +#define hypercall(nr_params, args...)			\
> +({							\
> +	/* __ret is volatile to make sure call to this	\
> +	 * function isn't optimized away by gcc. Just	\
> +	 * having the __hypercallN() functions mention	\
> +	 * memory is clobbered isn't enough		\
> +	 */						\
> +	volatile int __ret;				\
> +							\
> +	__ret = __hypercall##nr_params(args);		\
> +							\
> +	__ret;						\
> +})

A couple things are different in my patchset.  I didn't do this
hypercall macro.  I tried it at first but IMHO it was pretty ugly.  It
makes things less readable to me.  The second thing is I only have up to
4 parameters to a hypercall.  That leaves some GP registers on 32-bit
and Xen seems to be happily using 4 registers so I don't think there's
anything we can't express without the extra 2.

Regards,

Anthony Liguori


-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/

  parent reply	other threads:[~2007-08-27 22:13 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-08-24 23:57 [PATCH 1/4] [HYPERCALL] Add hypercalls functions Dor Laor
     [not found] ` <64F9B87B6B770947A9F8391472E032160D59004C-yEcIvxbTEBqsx+V+t5oei8rau4O3wl8o3fe8/T/H7NteoWH0uzbU5w@public.gmane.org>
2007-08-25  8:08   ` Avi Kivity
2007-08-27 13:01   ` Christian Borntraeger
     [not found]     ` <200708271501.18099.borntraeger-tA70FqPdS9bQT0dZR+AlfA@public.gmane.org>
2007-08-29  6:50       ` Dor Laor
2007-08-27 14:34   ` Christian Borntraeger
     [not found]     ` <200708271634.18944.borntraeger-tA70FqPdS9bQT0dZR+AlfA@public.gmane.org>
2007-08-29  6:50       ` Dor Laor
2007-08-27 22:13   ` Anthony Liguori [this message]
2007-08-29  7:02     ` Dor Laor

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=1188252831.22727.2.camel@squirrel \
    --to=anthony-rdkfgonbjusknkdkm+me6a@public.gmane.org \
    --cc=dor.laor-atKUWr5tajBWk0Htik3J/w@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox