[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 4/4] x86: Avoid using .byte for instructions where safe to do so


  • To: Jan Beulich <jbeulich@xxxxxxxx>
  • From: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
  • Date: Thu, 8 Jan 2026 21:14:42 +0000
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=citrix.com; dmarc=pass action=none header.from=citrix.com; dkim=pass header.d=citrix.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=0jpXeB/XVHxZbOd4fofwNGRIM3GOxc8aOGrrtgvNOXM=; b=u+T0c2VKK2aPESdXQGX5ooO7kiFd9rB4OnLZUgnS/Hh5pOYMNWpK15VzdOavCCMM7HpN+yhBCXz4wFdm6KJpVTFC55L4yVT69N+nIjTx7RqbwVYyWiIgYGNWt8Vl6/hHDhGjUcawBcmCEQ5VNdc4RrkqJx8a9bEi3Ms4QT7VJlx73tCvE1QMGGlMUWTFQL9hO9XMBJtyGxLq3SUWz7Jb+CdUa+B5hDdllKoQ2GVWwdD5orTG6RmNcS49X5JCE1ROGDDZqV6BmysxJe6J/cD7krS9ln0K4gysxsa1Td9T4tSQ0LUrw1OpxEdI78aGO2GTOfqHmIkELd4/XupE/Ffqzg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=XZ/CKN+3JISeP7pJnO5JRHtstM/06kLUfVFgQ1MYyNhjKrrVvYi8Ph5W8hsEjNp9qL3R6fPvhoS2eDdElB0Ldr0UHTbMPvqIj3SMU7gq2vOkF9JIQ/03OcgKcLpIUpzgDO7owDL1ne94nCprTDfuV0RYEe3vLhEmd2G5O0M5n01kKWOrf1VP5RpheIqXkYlUwWW4MFcQfQyEs2VI58RR1SBmoGa5JPMMxVKFiEGjok2pZi9h3+DAMqFx1csCKmhSpdvg7natM46veHuPSUA7GjGGDFxD5Q3bpgbWQ2HTzH4gStaDT1cgvnAkweDb+tQdC15/arn/znZLlEQOspSQvw==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=citrix.com;
  • Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, Xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • Delivery-date: Thu, 08 Jan 2026 21:14:58 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 05/01/2026 3:58 pm, Jan Beulich wrote:
> On 30.12.2025 14:54, Andrew Cooper wrote:
>> --- a/xen/arch/x86/include/asm/asm-defns.h
>> +++ b/xen/arch/x86/include/asm/asm-defns.h
>> @@ -1,9 +1,5 @@
>>  #include <asm/page-bits.h>
>>  
>> -.macro clzero
>> -    .byte 0x0f, 0x01, 0xfc
>> -.endm
> This can't go away yet, as it became known to gas only in 2.26.
>
>> --- a/xen/arch/x86/include/asm/prot-key.h
>> +++ b/xen/arch/x86/include/asm/prot-key.h
>> @@ -19,16 +19,14 @@ static inline uint32_t rdpkru(void)
>>  {
>>      uint32_t pkru;
>>  
>> -    asm volatile ( ".byte 0x0f,0x01,0xee"
>> -                   : "=a" (pkru) : "c" (0) : "dx" );
>> +    asm volatile ( "rdpkru" : "=a" (pkru) : "c" (0) : "dx" );
>>  
>>      return pkru;
>>  }
>>  
>>  static inline void wrpkru(uint32_t pkru)
>>  {
>> -    asm volatile ( ".byte 0x0f,0x01,0xef"
>> -                   :: "a" (pkru), "d" (0), "c" (0) );
>> +    asm volatile ( "wrpkru" :: "a" (pkru), "d" (0), "c" (0) );
>>  }
> Same for both of these.

Oh - so they did.

This is a fairly old patch, and I don't recall exactly how I did the
analysis, but it was clearly wrong now I've double checked the 2.25 branch.

I'll annotate these rather than dropping them.

~Andrew



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.