All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Jan Beulich <JBeulich@suse.com>
Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com>,
	Kevin Tian <kevin.tian@intel.com>,
	Jun Nakajima <jun.nakajima@intel.com>,
	SuraveeSuthikulpanit <suravee.suthikulpanit@amd.com>,
	Xen-devel <xen-devel@lists.xen.org>
Subject: Re: [PATCH] xen/x86: Improve hypercall page writing
Date: Tue, 20 Dec 2016 12:21:46 +0000	[thread overview]
Message-ID: <6db9b2f2-4c13-48f2-6b3c-67a435c32131@citrix.com> (raw)
In-Reply-To: <5858F05A020000780012AC80@prv-mh.provo.novell.com>

On 20/12/2016 07:48, Jan Beulich wrote:
>
>> @@ -398,10 +400,11 @@ static void hypercall_page_initialise_ring1_kernel(void *hypercall_page)
>>       * calling it.
>>       */
>>      p = (char *)(hypercall_page + (__HYPERVISOR_iret * 32));
>> -    *(u8  *)(p+ 0) = 0x50;    /* push %eax */
>> -    *(u8  *)(p+ 1) = 0xb8;    /* mov  $__HYPERVISOR_iret,%eax */
>> -    *(u32 *)(p+ 2) = __HYPERVISOR_iret;
>> -    *(u16 *)(p+ 6) = (HYPERCALL_VECTOR << 8) | 0xcd; /* int  $xx */
>> +    memcpy(p,
>> +           "\x50"                 /* push %eax */
>> +           "\xb8\x17\x00\x00\x00" /* mov  $__HYPERVISOR_iret, %eax */
>> +           "\xcd\x82",            /* int  $HYPERCALL_VECTOR */
> here as a good idea.

Well, they are fixed in the ABI.  It is not as if we could ever change them.

>  If you used a static const uint8_t[] instead of
> a string literal (which even includes a pointless nul terminator), all of
> this could be avoided afaict.

I can see how that would work for the `int $0x82` case, but how do you
propose fitting 4 bytes of __HYPERVISOR_iret into an initialiser for a
uint8_t array?

~Andrew

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

  reply	other threads:[~2016-12-20 12:21 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-19 16:55 [PATCH] xen/x86: Improve hypercall page writing Andrew Cooper
2016-12-19 19:14 ` Boris Ostrovsky
2016-12-20  5:11 ` Tian, Kevin
2016-12-20  7:48 ` Jan Beulich
2016-12-20 12:21   ` Andrew Cooper [this message]
2016-12-20 12:57     ` Jan Beulich

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=6db9b2f2-4c13-48f2-6b3c-67a435c32131@citrix.com \
    --to=andrew.cooper3@citrix.com \
    --cc=JBeulich@suse.com \
    --cc=boris.ostrovsky@oracle.com \
    --cc=jun.nakajima@intel.com \
    --cc=kevin.tian@intel.com \
    --cc=suravee.suthikulpanit@amd.com \
    --cc=xen-devel@lists.xen.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.