Skip to content

Conversation

@csegarragonz
Copy link
Collaborator

@csegarragonz csegarragonz commented Feb 17, 2022

In this PR I re-factor and do some clean-up of the code running outside the enclave ({src,include}/enclave/outside).

Changelog:

  • Re-factor SGXWamrWasmModule.{cpp,h} toEnclaveInterface.{cpp,h}: as discussed offline, the real WASM module is inside the enclave, so this name was misleading.
  • Re-factor SGXWAMRWasmModule.S to getSgxSupport.S: the name for the ASM script was also very misleading. This file checks for HW support for SGX. There are other ways to do it (not necessarily less involved), but in any case matter for a different PR.
  • Factor-out the set of defined ECalls from EnclaveInterface.h to ecalls.h for clarity. Note that ECalls are declared outside the enclave, but defined inside*.
  • Add method to process errors when doing ECalls. This was verbose and repeated before as we need to check for two error codes (one for SGX-system errors, one for Faasm-logic errors inside the enclave).

*This is not entirely true, as SGX generates stubbed calls using the EDGER8R tool, so a sort of ECall is defined outside the enclave as part of the build process. But this is not relevant to the discussion.

@csegarragonz csegarragonz self-assigned this Feb 17, 2022
@csegarragonz csegarragonz added the wasm/wamr-sgx SGX related stuff. label Feb 17, 2022
@csegarragonz csegarragonz changed the title Fix outside Clean up enclave-related code running _outside_ the enclave Feb 17, 2022
@csegarragonz csegarragonz changed the title Clean up enclave-related code running _outside_ the enclave Clean up enclave-related code running outside the enclave Feb 17, 2022
@@ -46,34 +38,3 @@ extern "C"
sgx_enclave_id_t enclave_id,
faasm_sgx_status_t* ret_val);
}

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Weird diffing by Github here, but all this removed chunk here has been copied to EnclaveInterface.h

@csegarragonz csegarragonz merged commit f06565b into main Feb 17, 2022
@csegarragonz csegarragonz deleted the fix-outside branch February 17, 2022 15:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

wasm/wamr-sgx SGX related stuff.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants