Browse Source

Add "earlyclobber" constraint to oselect_uint32_t

Specifying "=&r" instead of "=r" tells the compiler not to use the same
registers for the input and the output registers.  Otherwise, writing to
the output can clobber the input before it's used.

Guess how I came across this?
Ian Goldberg 1 year ago
parent
commit
7b94f67102
1 changed files with 1 additions and 1 deletions
  1. 1 1
      Enclave/OblivAlgs/oasm_lib.h

+ 1 - 1
Enclave/OblivAlgs/oasm_lib.h

@@ -171,7 +171,7 @@
         "mov %[value0], %[out]\n"
         "test %[flag], %[flag]\n"
         "cmovnz %[value1], %[out]\n"
-        : [out] "=r" (out)
+        : [out] "=&r" (out)
         : [value0] "r" (value_0), [value1] "r" (value_1), [flag] "r" (flag)
         : "cc"
     );