Skip to content

Commit 1a98deb

Browse files
committed
Fix get_max_tcs_num() API for SGX1.
Signed-off-by: Zhang Lili <lili.z.zhang@intel.com>
1 parent 111a916 commit 1a98deb

File tree

4 files changed

+12
-2
lines changed

4 files changed

+12
-2
lines changed

common/inc/internal/global_data.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ typedef struct _global_data_t
5656
sys_word_t rsrv_executable;
5757
sys_word_t thread_policy;
5858
sys_word_t tcs_max_num;
59+
sys_word_t tcs_num;
5960
thread_data_t td_template;
6061
uint8_t tcs_template[TCS_TEMPLATE_SIZE];
6162
uint32_t layout_entry_num;

psw/urts/parser/update_global_data.hxx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ namespace {
8989
global_data->heap_size = (sys_word_t)(create_param->heap_init_size);
9090
global_data->thread_policy = (sys_word_t)metadata->tcs_policy;
9191
global_data->tcs_max_num = (sys_word_t)create_param->tcs_max_num;
92+
global_data->tcs_num = (sys_word_t)create_param->tcs_num;
9293
thread_data_t *thread_data = &global_data->td_template;
9394

9495
thread_data->stack_limit_addr = (sys_word_t)create_param->stack_limit_addr;

sdk/trts/init_enclave.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ uint64_t g_enclave_base __attribute__((section(RELRO_SECTION_NAME))) = 0;
6060
uint64_t g_enclave_size __attribute__((section(RELRO_SECTION_NAME))) = 0;
6161

6262

63-
const volatile global_data_t g_global_data __attribute__((section(".niprod"))) = {VERSION_UINT, 1, 2, 3, 4, 5, 6, 0, 0,
63+
const volatile global_data_t g_global_data __attribute__((section(".niprod"))) = {VERSION_UINT, 1, 2, 3, 4, 5, 6, 0, 0, 0,
6464
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, {0, 0, 0, 0, 0, 0}, 0}, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, 0, 0, {{{0, 0, 0, 0, 0, 0, 0}}}, 0, 0, 0};
6565
uint32_t g_enclave_state __attribute__((section(".nipd"))) = ENCLAVE_INIT_NOT_STARTED;
6666
uint32_t g_cpu_core_num __attribute__((section(RELRO_SECTION_NAME))) = 0;

sdk/trts/trts_util.cpp

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,15 @@ bool is_utility_thread()
195195

196196
size_t get_max_tcs_num()
197197
{
198-
return (size_t)g_global_data.tcs_max_num;
198+
if (EDMM_supported == 1)
199+
{
200+
return (size_t)g_global_data.tcs_max_num;
201+
}
202+
else
203+
{
204+
return (size_t)g_global_data.tcs_num;
205+
}
206+
199207
}
200208

201209
bool is_pkru_enabled()

0 commit comments

Comments
 (0)