      LockGuard lock(&m_thread_mutex);
      trust_thread->decrease_ref();
      return;
+@@ -454,7 +481,7 @@
+ 
+ sgx_status_t CTrustThreadPool::new_thread()
+ {
+-    sgx_status_t ret = SGX_ERROR_UNEXPECTED;
++    sgx_status_t ret = SGX_ERROR_OUT_OF_TCS;
+     if(!m_utility_thread)
+     {
+         return ret;
 @@ -533,7 +560,7 @@
  
      //if free list is NULL, recycle tcs.

 {
     uint64_t page_frame = rva >> SE_PAGE_SHIFT;
     //NOTE:
@@ -181,7 +183,7 @@
     return SGX_SUCCESS;
 }

+    }
     ocall_context_t *context = reinterpret_cast<ocall_context_t*>(thread_data->last_sp);
     if(context->ocall_flag != OCALL_FLAG)
     {
@@ -109,7 +114,7 @@
     *addr = const_cast<void *>(g_ecall_table.ecall_table[ordinal].ecall_addr);
     if(!sgx_is_within_enclave(*addr, 0))
     {
-        return SGX_ERROR_UNEXPECTED;
+        return SGX_ERROR_INVALID_STATE;
     }
 
     return SGX_SUCCESS;
@@ -328,7 +333,7 @@
 
     if(0 != GET_TLS_INFO(&__ImageBase, &tls_addr, &tdata_size))
     {
-        return SGX_ERROR_UNEXPECTED;
+        return SGX_ERROR_INVALID_PARAMETER;
     }
     if(tls_addr)
     {
@@ -339,7 +344,7 @@
     return SGX_SUCCESS;
