Re: [PATCH v22 07/24] x86/sgx: Add wrappers for ENCLS leaf functions
From: Sean Christopherson
Date: Tue Oct 08 2019 - 09:35:14 EST
On Tue, Oct 08, 2019 at 09:18:45AM +0200, Borislav Petkov wrote:
> 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>
Hmm, I get assembler errors using gcc 5.4.0
linux/arch/x86/kernel/cpu/sgx/encls.h: Assembler messages:
linux/arch/x86/kernel/cpu/sgx/encls.h:207: Error: missing ')'
linux/arch/x86/kernel/cpu/sgx/encls.h:207: Error: missing ')'
linux/arch/x86/kernel/cpu/sgx/encls.h:207: Error: missing ')'
linux/arch/x86/kernel/cpu/sgx/encls.h:207: Error: missing ')'
linux/arch/x86/kernel/cpu/sgx/encls.h:207: Error: junk `UL)))<<(30))' after expression
linux/arch/x86/kernel/cpu/sgx/encls.h:207: Error: missing ')'
linux/arch/x86/kernel/cpu/sgx/encls.h:207: Error: missing ')'
linux/arch/x86/kernel/cpu/sgx/encls.h:207: Error: missing ')'
linux/arch/x86/kernel/cpu/sgx/encls.h:207: Error: missing ')'
linux/arch/x86/kernel/cpu/sgx/encls.h:207: Error: junk `UL)))<<(30))' after expression
linux/arch/x86/kernel/cpu/sgx/encls.h:207: Error: missing ')'
linux/arch/x86/kernel/cpu/sgx/encls.h:207: Error: missing ')'
linux/arch/x86/kernel/cpu/sgx/encls.h:207: Error: missing ')'
linux/arch/x86/kernel/cpu/sgx/encls.h:207: Error: missing ')'
linux/arch/x86/kernel/cpu/sgx/encls.h:207: Error: junk `UL)))<<(30))' after expression
linux/scripts/Makefile.build:265: recipe for target 'arch/x86/kernel/cpu/sgx/encls.o' failed