Message ID | 20200330180811.31381-4-sean.j.christopherson@intel.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | x86/sgx: Make vDSO callable from C | expand |
On Mon, Mar 30, 2020 at 11:08:09AM -0700, Sean Christopherson wrote: > Pass EENTER to the vDSO wrapper via %ecx instead of hardcoding it to > make the wrapper compatible with the new vDSO calling convention. > > Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com> I think it'd be good if you merge 1/5-3/5 and 4/5-55 to have two patches. Easier to review given the strong bounds, easier for you to update and easier for me to merge later on. /Jarko
On Tue, Mar 31, 2020 at 12:07:16AM +0300, Jarkko Sakkinen wrote: > On Mon, Mar 30, 2020 at 11:08:09AM -0700, Sean Christopherson wrote: > > Pass EENTER to the vDSO wrapper via %ecx instead of hardcoding it to > > make the wrapper compatible with the new vDSO calling convention. > > > > Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com> > > I think it'd be good if you merge 1/5-3/5 and 4/5-55 to have two patches. > > Easier to review given the strong bounds, easier for you to update > and easier for me to merge later on. I mean {1, 2, 3} and {4, 5} /Jarkko
diff --git a/tools/testing/selftests/sgx/call.S b/tools/testing/selftests/sgx/call.S index c37f55a607c8..77131e83db42 100644 --- a/tools/testing/selftests/sgx/call.S +++ b/tools/testing/selftests/sgx/call.S @@ -37,7 +37,6 @@ sgx_call_vdso: .cfi_adjust_cfa_offset 8 push 0x48(%rsp) .cfi_adjust_cfa_offset 8 - mov $2, %eax call *eenter(%rip) add $0x20, %rsp .cfi_adjust_cfa_offset -0x20 diff --git a/tools/testing/selftests/sgx/defines.h b/tools/testing/selftests/sgx/defines.h index 1802cace7527..be8969922804 100644 --- a/tools/testing/selftests/sgx/defines.h +++ b/tools/testing/selftests/sgx/defines.h @@ -15,6 +15,7 @@ #define __packed __attribute__((packed)) #include "../../../../arch/x86/kernel/cpu/sgx/arch.h" +#include "../../../../arch/x86/include/asm/enclu.h" #include "../../../../arch/x86/include/uapi/asm/sgx.h" #endif /* DEFINES_H */ diff --git a/tools/testing/selftests/sgx/main.c b/tools/testing/selftests/sgx/main.c index 9238cce47f77..f6bb40f22884 100644 --- a/tools/testing/selftests/sgx/main.c +++ b/tools/testing/selftests/sgx/main.c @@ -171,7 +171,7 @@ int main(int argc, char *argv[], char *envp[]) eenter = addr + eenter_sym->st_value; - sgx_call_vdso((void *)&MAGIC, &result, 0, NULL, NULL, NULL, + sgx_call_vdso((void *)&MAGIC, &result, 0, EENTER, NULL, NULL, (void *)encl.encl_base, &exception, NULL); if (result != MAGIC) goto err; diff --git a/tools/testing/selftests/sgx/main.h b/tools/testing/selftests/sgx/main.h index 6e1ae292bd25..999422cc7343 100644 --- a/tools/testing/selftests/sgx/main.h +++ b/tools/testing/selftests/sgx/main.h @@ -32,7 +32,7 @@ bool encl_load(const char *path, struct encl *encl); bool encl_measure(struct encl *encl); bool encl_build(struct encl *encl); -int sgx_call_vdso(void *rdi, void *rsi, long rdx, void *rcx, void *r8, void *r9, +int sgx_call_vdso(void *rdi, void *rsi, long rdx, u32 leaf, void *r8, void *r9, void *tcs, struct sgx_enclave_exception *ei, void *cb); #endif /* MAIN_H */
Pass EENTER to the vDSO wrapper via %ecx instead of hardcoding it to make the wrapper compatible with the new vDSO calling convention. Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com> --- tools/testing/selftests/sgx/call.S | 1 - tools/testing/selftests/sgx/defines.h | 1 + tools/testing/selftests/sgx/main.c | 2 +- tools/testing/selftests/sgx/main.h | 2 +- 4 files changed, 3 insertions(+), 3 deletions(-)