From f5bcbba74dd592aba991b6675c884b5d6f1d171f Mon Sep 17 00:00:00 2001 From: Ju Chen Date: Fri, 17 Nov 2017 16:39:59 -0500 Subject: [PATCH] implment cmove_int32 --- Enclave/utility.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/Enclave/utility.cpp b/Enclave/utility.cpp index f12ab08..302ec7d 100644 --- a/Enclave/utility.cpp +++ b/Enclave/utility.cpp @@ -22,3 +22,14 @@ void print_arr(const int32_t* arr, int32_t len) for (int32_t i = 0; i < len; ++i) EPrintf("%d ", arr[i]); EPrintf("\n"); } + + +void cmove_int32(bool cond, int32_t* src, int32_t* dest) { + __asm__ ( + "mov %%rdi, %%rax\n\t" + "mov (%%rsi),%%rbx\n\t" + "cmove %%rbx,%%rcx\n\t" + "mov %%rcx,(%%rdx)\n\t" + ::: + ); +}