~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/tools/testing/selftests/sgx/test_encl_bootstrap.S

Version: ~ [ linux-6.12-rc7 ] ~ [ linux-6.11.7 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.60 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.116 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.171 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.229 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.285 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.323 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.12 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /* SPDX-License-Identifier: GPL-2.0 */
  2 /*
  3  * Copyright(c) 2016-20 Intel Corporation.
  4  */
  5 
  6         .macro ENCLU
  7         .byte 0x0f, 0x01, 0xd7
  8         .endm
  9 
 10         .section ".tcs", "aw"
 11         .balign 4096
 12 
 13         .fill   1, 8, 0                 # STATE (set by CPU)
 14         .fill   1, 8, 0                 # FLAGS
 15         .quad   encl_ssa_tcs1           # OSSA
 16         .fill   1, 4, 0                 # CSSA (set by CPU)
 17         .fill   1, 4, 1                 # NSSA
 18         .quad   encl_entry              # OENTRY
 19         .fill   1, 8, 0                 # AEP (set by EENTER and ERESUME)
 20         .fill   1, 8, 0                 # OFSBASE
 21         .fill   1, 8, 0                 # OGSBASE
 22         .fill   1, 4, 0xFFFFFFFF        # FSLIMIT
 23         .fill   1, 4, 0xFFFFFFFF        # GSLIMIT
 24         .fill   4024, 1, 0              # Reserved
 25 
 26         # TCS2
 27         .fill   1, 8, 0                 # STATE (set by CPU)
 28         .fill   1, 8, 0                 # FLAGS
 29         .quad   encl_ssa_tcs2           # OSSA
 30         .fill   1, 4, 0                 # CSSA (set by CPU)
 31         .fill   1, 4, 1                 # NSSA
 32         .quad   encl_entry              # OENTRY
 33         .fill   1, 8, 0                 # AEP (set by EENTER and ERESUME)
 34         .fill   1, 8, 0                 # OFSBASE
 35         .fill   1, 8, 0                 # OGSBASE
 36         .fill   1, 4, 0xFFFFFFFF        # FSLIMIT
 37         .fill   1, 4, 0xFFFFFFFF        # GSLIMIT
 38         .fill   4024, 1, 0              # Reserved
 39 
 40         .text
 41 
 42 encl_entry:
 43         # RBX contains the base address for TCS, which is the first address
 44         # inside the enclave for TCS #1 and one page into the enclave for
 45         # TCS #2. First make it relative by substracting __encl_base and
 46         # then add the address of encl_stack to get the address for the stack.
 47         lea __encl_base(%rip), %rax
 48         sub %rax, %rbx
 49         lea encl_stack(%rip), %rax
 50         add %rbx, %rax
 51         jmp encl_entry_core
 52 encl_dyn_entry:
 53         # Entry point for dynamically created TCS page expected to follow
 54         # its stack directly.
 55         lea -1(%rbx), %rax
 56 encl_entry_core:
 57         xchg    %rsp, %rax
 58         push    %rax
 59 
 60         push    %rcx # push the address after EENTER
 61 
 62         # NOTE: as the selftest enclave is *not* intended for production,
 63         # simplify the code by not initializing ABI registers on entry or
 64         # cleansing caller-save registers on exit.
 65         call    encl_body
 66 
 67         # Prepare EEXIT target by popping the address of the instruction after
 68         # EENTER to RBX.
 69         pop     %rbx
 70 
 71         # Restore the caller stack.
 72         pop     %rax
 73         mov     %rax, %rsp
 74 
 75         # EEXIT
 76         mov     $4, %rax
 77         enclu
 78 
 79         .section ".data", "aw"
 80 
 81 encl_ssa_tcs1:
 82         .space 4096
 83 encl_ssa_tcs2:
 84         .space 4096
 85 
 86         .balign 4096
 87         # Stack of TCS #1
 88         .space 4096
 89 encl_stack:
 90         .balign 4096
 91         # Stack of TCS #2
 92         .space 4096

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php