diff --git a/Pal/src/host/Linux-SGX/sgx_entry.S b/Pal/src/host/Linux-SGX/sgx_entry.S index ac810998..3e5a6590 100644 --- a/Pal/src/host/Linux-SGX/sgx_entry.S +++ b/Pal/src/host/Linux-SGX/sgx_entry.S @@ -9,13 +9,19 @@ .type sgx_ecall, @function sgx_ecall: - pushq %rbx - # put entry address in RDX - leaq sgx_entry(%rip), %rdx + leaq .Lsgx_entry(%rip), %rdx # other arguments: RDI - code, RSI - ms +.Ldo_ecall_callee_save: + pushq %rbx + pushq %rbp + pushq %r12 + pushq %r13 + pushq %r14 + pushq %r15 + .Ldo_ecall: # RBX has to be the TCS of the thread movq %gs:PAL_TCB_URTS_TCS, %rbx @@ -27,6 +33,12 @@ sgx_ecall: ENCLU # currently only ECALL_THREAD_RESET returns +.Lafter_resume: + popq %r15 + popq %r14 + popq %r13 + popq %r12 + popq %rbp popq %rbx retq @@ -41,12 +53,9 @@ async_exit_pointer: sgx_raise: leaq .Lafter_resume(%rip), %rdx - jmp .Ldo_ecall + jmp .Ldo_ecall_callee_save -.Lafter_resume: - retq - -sgx_entry: +.Lsgx_entry: # arguments: RDI - code, RSI - ms .cfi_startproc