Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[PAL/Linux-SGX] Rename sgx_entry to sgx_do_host_ocall #1969

Merged
merged 1 commit into from
Aug 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions pal/src/host/linux-sgx/enclave_entry.S
Original file line number Diff line number Diff line change
Expand Up @@ -940,9 +940,9 @@ restore_xregs:
# called __morestack.
#
# To make GDB backtrace work, we make sure that the first function outside of enclave
# (sgx_entry) has a return address on stack, pointing inside __morestack. We will not actually
# return to this function (sgx_entry performs EENTER to go back to enclave), but GDB will make a
# stack frame for it.
# (sgx_do_host_ocall) has a return address on stack, pointing inside __morestack. We will not
# actually return to this function (sgx_do_host_ocall performs EENTER to go back to enclave),
# but GDB will make a stack frame for it.
#
# The function contains CFI directives to make sure that all callee-saved registers can be
# recovered. They should reflect the situation during EEXIT in code above.
Expand Down
19 changes: 16 additions & 3 deletions pal/src/host/linux-sgx/host_entry.S
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
# This file contains host-to-enclave and enclave-to-host flows, from the side of untrusted runtime:
#
# - Host-to-enclave normal-context flow (ECALL) -- sgx_ecall() function.
#
# - Host-to-enclave signal-handling flow (ECALL) -- sgx_raise() function.
#
# - Enclave-to-host syscall-handling flow (OCALL) -- Lsgx_do_host_ocall label. The sgx_ecall()
# flow pushes the address of this label into RDX before calling EENTER, and the enclave code
# jumps to it when handling the OCALL, see enclave_entry.S:sgx_ocall().
#
# - Enclave-to-host asynchronous enclave exit (AEX) -- async_exit_pointer() function.

#include "sgx_arch.h"

#include "asm-offsets.h"
Expand All @@ -11,8 +23,8 @@
sgx_ecall:
.cfi_startproc

# put entry address in RDX
leaq .Lsgx_entry(%rip), %rdx
# put host-OCALL target in RDX (enclave code will jump to it when handling the OCALL)
leaq .Lsgx_do_host_ocall(%rip), %rdx

# other arguments: RDI - code, RSI - ms

Expand Down Expand Up @@ -126,7 +138,7 @@ sgx_raise:
leaq .Lafter_resume(%rip), %rdx
jmp .Ldo_ecall_callee_save

.Lsgx_entry:
.Lsgx_do_host_ocall:
# arguments: RDI - code, RSI - ms
.cfi_startproc

Expand Down Expand Up @@ -163,6 +175,7 @@ sgx_raise:
andq $~0xF, %rsp # Required by System V AMD64 ABI.
#endif

# call one of the sgx_ocall_* functions defined in host_ocalls.c
callq *%rbx

movq %rbp, %rsp
Expand Down