[Lguest] [patch][v2] cleanup hypercall code
Jes Sorensen
jes at sgi.com
Wed Aug 22 17:35:23 EST 2007
Rusty Russell wrote:
> On Mon, 2007-08-20 at 13:33 +0200, Jes Sorensen wrote:
>> Hi,
>>
>> Here's an updated version of the hypercall cleanup patch. I changed it
>> so the hcall_args are a union in struct lguest_regs on i386 - also
>> changed the e[a-d]x regs to be unsigned long as I presume they will be
>> 64 bit on x86_64 - trying to reduce the breakage there.
>
> Some of this patch was missing (the union change). I stuck with a cast
> for the moment, see below.
Argh, I must have forgotten to add that to my quilt files :( I've
attached it here.
>> The LG_GET_HCALL_ARGS I have kept as a macro. I tried turning it into
>> an inline, but that releases a whole avalanche of circular dependencies,
>> which I don't think is worth the hassle to get into.
>
> Yeah, I lower-cased it since it has no side-effects.
Please don't do that!! The Linux convention is that macros are upper
case and functions are lower case names, as long as it's a macro it
should stay upper case.
> I'm now wondering if anyone is going to do something other than pass
> args in registers? If not, we can do something like this in struct
> lguest:
>
> /* The arguments for a hypercall are in registers. */
> union {
> struct hcall_args *hargs;
> struct lguest_regs *regs;
> };
>
> An arch defines hcall_args and lguest_regs, so it can arrange them any
> way it wants...
Hmmm I don't think we want to rely on archs mapping things between the
two so I think it's better to do it on an arch level. In some cases
the arch may require to create a full args struct and pass it in to the
hypercall.
Cheers,
Jes
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: lguest-regs-union.diff
URL: <http://lists.ozlabs.org/pipermail/lguest/attachments/20070822/9232cd6d/attachment.txt>
More information about the Lguest
mailing list