Re: [PATCH v22 07/24] x86/sgx: Add wrappers for ENCLS leaf functions

From: Borislav Petkov
Date: Tue Oct 08 2019 - 03:19:00 EST


On Mon, Oct 07, 2019 at 09:04:05PM -0700, Sean Christopherson wrote:
> > BIT(30)
>
> This is intentionally open coded so that it can be stringified in asm.

It stringifies just fine with the BIT() macro too:

# 187 "arch/x86/kernel/cpu/sgx/encls.h" 1
1: .byte 0x0f, 0x01, 0xcf;
2:
.section .fixup,"ax"
3: orl $((((1UL))) << (30)),%eax
jmp 2b
.previous

and the resulting object:

Disassembly of section .fixup:

0000000000000000 <.fixup>:
0: 0d 00 00 00 40 or $0x40000000,%eax
5: e9 00 00 00 00 jmpq a <__addressable_sgx_free_page107+0x2>

--
Regards/Gruss,
Boris.

https://people.kernel.org/tglx/notes-about-netiquette