[lkml]   [2019]   [Apr]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [RFC PATCH v5 4/4] x86/acrn: Add hypercall for ACRN guest
On Thu, Apr 25, 2019 at 06:16:02PM +0800, Zhao, Yakui wrote:
> The parameter register for the VMCALL is predefined in ACRN hypervisor. Now
> the R8 is used to pass the hcall_id.
> It seems that there is no special constraint for R8~R15.
> So the explicit register variable is used so that the R8 can be passed.

If you're going to use the constraint "D" for param1, you can just as
well do

"=a" (result)

everywhere since you have the letter constraint for %rax instead of
declaring it with "register".

Also, you can completely get rid of those "register" declarations
and let gcc have all the freedom to pass in hcall_id and the other

unsigned long result;

asm volatile("mov %[hcall_id], %%r8\n\t"
: "=a" (result)
: [hcall_id] "g" (hcall_id)
: "r8");

return result;

and %r8 will be in the clobber list so gcc will reload it if needed.

gcc turns it into

0000000000001040 <main>:
1040: 4c 8b 05 e1 2f 00 00 mov 0x2fe1(%rip),%r8 # 4028 <hcall_id>
1047: 0f 01 c1 vmcall
104a: c3 retq
104b: 0f 1f 44 00 00 nopl 0x0(%rax,%rax,1)



Good mailing practices for 400: avoid top-posting and trim the reply.

 \ /
  Last update: 2019-04-25 13:01    [W:0.050 / U:0.660 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site